From 0f1e30b39227145ca615fae7c90bd4dbfa063ca5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E8=A3=95=E8=B4=A2?= Date: Tue, 17 Oct 2023 19:08:18 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build/webpack.dev.conf.js | 1 + src/api/mdp_pub/mdp_api_base.js | 2 +- src/views/mdp/lcode/formDef/Form.vue | 71 ++++++++++++++++++++++--- src/views/mdp/lcode/formDef/Index.vue | 2 +- src/views/mdp/lcode/formField/Index.vue | 6 ++- src/views/mdp/lcode/gen/Index.vue | 5 +- 6 files changed, 74 insertions(+), 13 deletions(-) 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/views/mdp/lcode/formDef/Form.vue b/src/views/mdp/lcode/formDef/Form.vue index e5096f5..5a935af 100644 --- a/src/views/mdp/lcode/formDef/Form.vue +++ b/src/views/mdp/lcode/formDef/Form.vue @@ -33,10 +33,15 @@ - - + + + + + + + @@ -46,12 +51,13 @@ - - - + + + + @@ -61,8 +67,8 @@ @@ -211,6 +217,55 @@ 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; + } + 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){ + this.$mdp.removeFormFieldsCache(formDef.id) + this.currOpType='edit' + var data=res.data.data + Object.assign(this.editForm,data.formDef) + this.formFields=data.formFields + 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' }); @@ -258,7 +313,7 @@ export default { } 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..7ee64f7 100644 --- a/src/views/mdp/lcode/formDef/Index.vue +++ b/src/views/mdp/lcode/formDef/Index.vue @@ -50,7 +50,7 @@ diff --git a/src/views/mdp/lcode/formField/Index.vue b/src/views/mdp/lcode/formField/Index.vue index 00c894f..f4b58f2 100644 --- a/src/views/mdp/lcode/formField/Index.vue +++ b/src/views/mdp/lcode/formField/Index.vue @@ -64,8 +64,8 @@ - - + + @@ -138,6 +138,7 @@ import axios from '@/utils/request' import axiosNoAuth from '@/utils/requestNoAuth' import { getToken} from '@/utils/auth' +import {dataSourceList} from '@/api/mdp/lcode/dev' import draggable from 'vuedraggable' import { mapGetters } from 'vuex' import MdpFormField from './Field.vue' @@ -316,6 +317,7 @@ export default { }//end return },//end data methods: { + dataSourceList, // 取消按钮点击 父组件监听@cancel="addFormVisible=false" 监听 handleCancel:function(){ this.$emit('cancel'); diff --git a/src/views/mdp/lcode/gen/Index.vue b/src/views/mdp/lcode/gen/Index.vue index 817445b..34ddc35 100644 --- a/src/views/mdp/lcode/gen/Index.vue +++ b/src/views/mdp/lcode/gen/Index.vue @@ -4,7 +4,7 @@ - + @@ -40,6 +40,8 @@