diff --git a/build/webpack.dev.conf.js b/build/webpack.dev.conf.js index 83cb871..04d96c3 100644 --- a/build/webpack.dev.conf.js +++ b/build/webpack.dev.conf.js @@ -42,6 +42,7 @@ const devWebpackConfig = merge(baseWebpackConfig, { overlay: { errors: config.dev.errorOverlay, warnings: false, + runtimeErrors:false, }, }, }, diff --git a/src/api/mdp_pub/mdp_api_base.js b/src/api/mdp_pub/mdp_api_base.js index ec8bfc0..a788706 100644 --- a/src/api/mdp_pub/mdp_api_base.js +++ b/src/api/mdp_pub/mdp_api_base.js @@ -69,7 +69,7 @@ clearDictCache:function(itemCode,params){ **/ ajaxGetDictOptions:function(itemCode, params) { - debugger; + var codeKey=funcs.getCodeKey(itemCode,params); return new Promise((resolve,reject)=>{ var data=funcs.getDictOptionsFromCache(codeKey,itemCode,params) diff --git a/src/components/mdp-ui-ext/mdp-expand/FormData.vue b/src/components/mdp-ui-ext/mdp-expand/FormData.vue index bcbee5e..1d31a11 100644 --- a/src/components/mdp-ui-ext/mdp-expand/FormData.vue +++ b/src/components/mdp-ui-ext/mdp-expand/FormData.vue @@ -3,8 +3,9 @@ - - + + + @@ -14,34 +15,7 @@ 关闭 提交 - - - - - - - - - + @@ -70,9 +44,22 @@ import treeTool from '@/components/mdp-ui/js/treeTool.js' this.initFieldQx(k) }) return formFields - } + }, + + isExtInfosCpd(){ + return this.formDef?this.formDef.dataType=='2':false + }, + camelDataField(){ + if(this.formDef){ + return this.$mdp.toCamel(this.formDef.dataField) + }else{ + return 'extInfos2' + } + + }, }, props:{ + visible:{type:Boolean,default:false}, value:{type:Object,default:null}, formDef:{type:Object,default:null}, @@ -140,19 +127,19 @@ import treeTool from '@/components/mdp-ui/js/treeTool.js' editSubmit: function () { this.$refs.editForm.validate((valid) => { if (valid) { + debugger this.editLoading = true; - let params = Object.assign({}, this.editForm); - var extInfosKeys=Object.keys(params).filter(k=>k.indexOf(".")>0) - if(extInfosKeys && extInfosKeys.length>0){ + let params = Object.assign({}, this.editForm); + if(this.isExtInfosCpd){ var extInfos=[] - extInfosKeys.forEach(k=>{ - var key=k.split(".")[1] - extInfos[key]=params[k] - var extInfo={id:key,value:params[k]} - extInfos.push(extInfo) - delete params[k] + var extInfos2=this.editForm[this.camelDataField+"2"] + Object.keys(extInfos2).forEach(k=>{ + var key=k + var extInfo={id:key,value:extInfos2[k]} + extInfos.push(extInfo) }) - params['extInfos']=JSON.stringify(extInfos) + delete params[this.camelDataField+"2"] + params[this.camelDataField]=JSON.stringify(extInfos) } if(params.formId==null || params.formId==''){ params.formId=this.formDef.id diff --git a/src/components/mdp-ui-ext/mdp-expand/FormDataItem.vue b/src/components/mdp-ui-ext/mdp-expand/FormDataItem.vue index 5cb28d0..e137bbb 100644 --- a/src/components/mdp-ui-ext/mdp-expand/FormDataItem.vue +++ b/src/components/mdp-ui-ext/mdp-expand/FormDataItem.vue @@ -1,5 +1,5 @@ - - @@ -89,19 +95,7 @@ export default { }, computed: { pkOptions(){ - var pkOptions=[] - if(this.formFields){ - pkOptions.push(...this.formFields.filter(k=>k.extType!='row' && k.extType!='card' && k.extType!='tabs')) - } - pkOptions.push({id:'cuserid',title:'创建用户编号'}) - pkOptions.push({id:'deptid',title:'创建部门编号'}) - pkOptions.push({id:'ctime:1',title:'创建日期(yyy)'}) - pkOptions.push({id:'ctime:2',title:'创建日期(yyy-MM)'}) - pkOptions.push({id:'ctime:3',title:'创建日期(yyy-MM-dd)'}) - pkOptions.push({id:'ctime:4',title:'创建日期(yyy-MM-dd HH)'}) - pkOptions.push({id:'ctime:5',title:'创建日期(yyy-MM-dd HH:mm)'}) - pkOptions.push({id:'ctime:6',title:'创建日期(yyy-MM-dd HH:mm:ss)'}) - return pkOptions; + return this.getPkOptions() } }, props:{ @@ -148,6 +142,21 @@ export default { }, methods: { dataSourceList, + getPkOptions(){ + var formFields=this.$refs.formFields.getFieldList(); + var pkOptions=[...formFields.filter(k=>k.extType!='row' && k.extType!='card' && k.extType!='tabs')]; + if(this.editForm.dataType=='1'){ + pkOptions.push({id:'cuserid',title:'创建用户编号'}) + pkOptions.push({id:'deptid',title:'创建部门编号'}) + pkOptions.push({id:'ctime:1',title:'创建日期(yyy)'}) + pkOptions.push({id:'ctime:2',title:'创建日期(yyy-MM)'}) + pkOptions.push({id:'ctime:3',title:'创建日期(yyy-MM-dd)'}) + pkOptions.push({id:'ctime:4',title:'创建日期(yyy-MM-dd HH)'}) + pkOptions.push({id:'ctime:5',title:'创建日期(yyy-MM-dd HH:mm)'}) + pkOptions.push({id:'ctime:6',title:'创建日期(yyy-MM-dd HH:mm:ss)'}) + } + return pkOptions; + }, //由组件扩展添加其它的初始页面的逻辑(mounted+onOpen都会调用此函数,建议只添加公共逻辑) initCurrData(){ if(!this.formId){ @@ -211,6 +220,63 @@ export default { return true; }, saveSubmit: function () { + + if(this.editForm.formName==''){ + this.$notify({position:'bottom-left',showClose:true,message: '表单名称不能为空', type: 'error' }); + return; + } + var formFields=this.$refs.formFields.getFieldList(); + if(formFields.length==0 ){ + this.$notify({position:'bottom-left',showClose:true,message: '最少需要定义一个字段', type: 'error' }); + return; + } + + if(this.editForm.dataType=='1'||this.editForm.dataType=='3'){ + if(!this.editForm.pks){ + this.$notify({position:'bottom-left',showClose:true,message: '请设置表单主键', type: 'error' }); + return; + } + + } + this.$confirm('确认提交吗?', '提示', {}).then(() => { + this.load.edit=true + let formDef = Object.assign({}, this.editForm); + if(this.currOpType=='add'){ + formDef.deptid=this.userInfo.deptid + formDef.branchId=this.userInfo.branchId + } + + this.$refs.formFields.setPrimaryKeys(); + + formFields.forEach((i,index)=>{i.seq=index}); + var params={formDef:formDef,formFields:formFields}; + if(!this.preParamCheck(params)){ + this.load.edit=false + return; + } + var func=this.apis.add + if(this.currOpType=='edit'){ + func=this.apis.edit + } + func(params).then((res) => { + this.load.edit=false + var tips=res.data.tips; + if(tips.isOk){ + var data=res.data.data + Object.assign(this.editForm,data.formDef) + this.formFields=data.formFields + this.$mdp.removeFormFieldsCache(this.editForm.id) + this.currOpType='edit' + this.afterSubmit(res,tips.isOk,this.currOpType); + } + this.$notify({ position:'bottom-left',showClose:true, message: tips.msg, type: tips.isOk?'success':'error' }); + }).catch( err =>this.load.edit=false); + }).catch(()=>{}); + + }, + + saveSubmitDialog: function () { + this.$refs['editFormRef'].validate(valid=>{ if(valid==false){ this.$notify({position:'bottom-left',showClose:true,message: '表单验证不通过', type: 'error' }); @@ -224,7 +290,7 @@ export default { if(formFields.length==0 ){ this.$notify({position:'bottom-left',showClose:true,message: '最少需要定义一个字段', type: 'error' }); return; - } + } this.$confirm('确认提交吗?', '提示', {}).then(() => { this.load.edit=true let formDef = Object.assign({}, this.editForm); @@ -249,16 +315,17 @@ export default { this.load.edit=false var tips=res.data.tips; if(tips.isOk){ - this.$mdp.removeFormFieldsCache(formDef.id) - this.currOpType='edit' + var data=res.data.data Object.assign(this.editForm,data.formDef) this.formFields=data.formFields + this.$mdp.removeFormFieldsCache(this.editForm.id) + this.currOpType='edit' this.afterSubmit(res,tips.isOk,this.currOpType); } this.$notify({ position:'bottom-left',showClose:true, message: tips.msg, type: tips.isOk?'success':'error' }); }).catch( err =>this.load.edit=false); - }); + }).catch(()=>{}); }) diff --git a/src/views/mdp/lcode/formDef/Index.vue b/src/views/mdp/lcode/formDef/Index.vue index 6597f29..9169461 100644 --- a/src/views/mdp/lcode/formDef/Index.vue +++ b/src/views/mdp/lcode/formDef/Index.vue @@ -50,7 +50,7 @@ @@ -131,7 +131,7 @@ 设计 权限 - 数据 + 数据 @@ -302,7 +302,7 @@ export default { } }, openRoute(data){ - this.$router.push({path:'/mdp/lcode/data/index/'+data.formId}) + this.$router.push({path:`/mdp/lcode/data/index/${data.formId}/${data.dataType}/${data.dataField}`}) }, toDesignAdd(){ diff --git a/src/views/mdp/lcode/formField/FieldCfg.vue b/src/views/mdp/lcode/formField/FieldCfg.vue index d7fea30..f6dd33f 100644 --- a/src/views/mdp/lcode/formField/FieldCfg.vue +++ b/src/views/mdp/lcode/formField/FieldCfg.vue @@ -20,9 +20,7 @@ :open-delay="700" trigger="hover">
- 编码规则: 支持两种编码格式:假设有字段 客户姓名 cust_name
- 1. ext_infos.cust_name, 此编码方式的字段,用户录入的客户姓名将存储在【ext_infos.cust_name】中
- 2. cust_name 不带【ext_infos.】,此编码方式的字段,用户录入的客户姓名将存储在 【cust_name】中
+ 编码规则: 举例 客户姓名 cust_name