事项配置重构
This commit is contained in:
		| @@ -69,7 +69,6 @@ export default { | ||||
|       ] | ||||
|     }, | ||||
|     detailTitle: v => v.detailObj?.id ? "编辑事项" : "添加事项", | ||||
|     processType: v => v.$route.hash == "#add" ? 0 : 2 | ||||
|   }, | ||||
|   methods: { | ||||
|     ...mapActions(['closePage']), | ||||
| @@ -119,7 +118,6 @@ export default { | ||||
|      */ | ||||
|     save() { | ||||
|       this.$refs['processApproval'].handleProcessApproval().then(res => { | ||||
|         const {processType} = this | ||||
|         this.instance.post(`/app/approval-process-def/add-update`, { | ||||
|           ...this.detailObj, | ||||
|           ...this.baseInfo, | ||||
| @@ -131,7 +129,7 @@ export default { | ||||
|           tableType: 0, | ||||
|           processAnnexDefs: this.annexs.map(e => ({...e, mustFill: Number(e.mustFill)})), | ||||
|           processNodeList: res.processNodeList, | ||||
|           processType | ||||
|           processType: 0 | ||||
|         }).then(res => { | ||||
|           if (res.code == 0) { | ||||
|             this.$message.success("保存成功") | ||||
| @@ -144,7 +142,7 @@ export default { | ||||
|     }, | ||||
|     getDetail() { | ||||
|       const {id} = this.$route.query | ||||
|       this.instance.post(`/app/approval-process-def/info-id`, null, {params: {id}}).then(res => { | ||||
|       id && this.instance.post(`/app/approval-process-def/info-id`, null, {params: {id}}).then(res => { | ||||
|         if (res?.data) { | ||||
|           this.detailObj = res.data | ||||
|           this.filedList = res.data.tableInfo.tableFieldInfos | ||||
|   | ||||
| @@ -15,23 +15,17 @@ | ||||
|                   <el-form-item label="所属部门" prop="department"> | ||||
|                     <el-select placeholder="请选择" size="small" v-model="form.department" clearable style="width: 100%;"> | ||||
|                       <el-option | ||||
|                         v-for="(item,i) in dict.getDict('hbDepartment')" :key="i" | ||||
|                         :label="item.dictName" | ||||
|                         :value="item.dictValue"> | ||||
|                           v-for="(item,i) in dict.getDict('hbDepartment')" :key="i" | ||||
|                           :label="item.dictName" | ||||
|                           :value="item.dictValue"> | ||||
|                       </el-option> | ||||
|                     </el-select> | ||||
|                   </el-form-item> | ||||
|                 </el-col> | ||||
|                 <el-col :span="12"> | ||||
|                   <el-form-item label="所属分类" prop="classificationId"> | ||||
|                     <el-select placeholder="请选择" size="small" v-model="form.classificationId" clearable | ||||
|                                style="width: 100%;"> | ||||
|                       <el-option | ||||
|                         v-for="(item,i) in classList" :key="i" | ||||
|                         :label="item.name" | ||||
|                         :value="item.id"> | ||||
|                       </el-option> | ||||
|                     </el-select> | ||||
|                     <ai-select v-model="form.classificationId" :instance="instance" action="/app/zwspapprovalclassification/list?status=1" | ||||
|                                :prop="{label:'name'}"/> | ||||
|                   </el-form-item> | ||||
|                 </el-col> | ||||
|               </el-row> | ||||
| @@ -40,9 +34,9 @@ | ||||
|               </el-form-item> | ||||
|               <el-form-item label="是否启用" prop="processDefStatus"> | ||||
|                 <el-switch | ||||
|                   v-model="form.processDefStatus" | ||||
|                   active-color="#5088FF" | ||||
|                   inactive-color="#D0D4DC" active-value="1" inactive-value="0"> | ||||
|                     v-model="form.processDefStatus" | ||||
|                     active-color="#5088FF" | ||||
|                     inactive-color="#D0D4DC" active-value="1" inactive-value="0"> | ||||
|                 </el-switch> | ||||
|               </el-form-item> | ||||
|             </el-form> | ||||
| @@ -58,162 +52,144 @@ | ||||
| </template> | ||||
|  | ||||
| <script> | ||||
| import {mapMutations} from "vuex"; | ||||
|  | ||||
|   export default { | ||||
|     name: "addConfig", | ||||
|     props: { | ||||
|       instance: Function, | ||||
|       dict: Object, | ||||
|       row: Object, | ||||
|       processType: String | ||||
|     }, | ||||
|     data() { | ||||
|       return { | ||||
|         form: { | ||||
|           processName: "", | ||||
|           department: "", | ||||
|           classificationId: "", | ||||
|           needToKnow: "", | ||||
|           processDefStatus: "1", | ||||
|         }, | ||||
|         classList: [], | ||||
|       } | ||||
|     }, | ||||
|     computed: { | ||||
|       rules() { | ||||
|         return { | ||||
|           processName: [{required: true, message: '请输入事项名称', trigger: 'blur'}], | ||||
|           department: [{required: true, message: '请选择所属部门', trigger: 'change'}], | ||||
|           classificationId: [{required: true, message: '请选择所属分类', trigger: 'change'}], | ||||
|           needToKnow: [{required: true, message: '请输入办理须知', trigger: 'blur'}], | ||||
|           processDefStatus: [{required: true, message: '请选择是否启用', trigger: 'change'}], | ||||
|         } | ||||
| export default { | ||||
|   name: "guidance", | ||||
|   props: { | ||||
|     instance: Function, | ||||
|     dict: Object, | ||||
|   }, | ||||
|   data() { | ||||
|     return { | ||||
|       form: { | ||||
|         processName: "", | ||||
|         department: "", | ||||
|         classificationId: "", | ||||
|         needToKnow: "", | ||||
|         processDefStatus: "1", | ||||
|       }, | ||||
|       detailTitle() { | ||||
|         return this.row?.id ? "编辑办事指南" : "添加办事指南" | ||||
|       } | ||||
|     }, | ||||
|     methods: { | ||||
|       /** | ||||
|        * 获取分类 | ||||
|        */ | ||||
|       getClassification() { | ||||
|         this.instance.post(`/app/zwspapprovalclassification/list`, null, { | ||||
|           params: { | ||||
|             current: 1, | ||||
|             status: 1, | ||||
|             size: 9999 | ||||
|           } | ||||
|         }).then(res => { | ||||
|           if (res?.data) { | ||||
|             this.classList = res.data.records | ||||
|           } | ||||
|         }) | ||||
|       }, | ||||
|       /** | ||||
|        * 保存 | ||||
|        */ | ||||
|       save() { | ||||
|         this.$refs["baseInfoForm"].validate(valid => { | ||||
|           if (valid) { | ||||
|             this.instance.post(`/app/approval-process-def/add-update`, { | ||||
|               ...this.form, | ||||
|               id: this.row.id, | ||||
|               processType: this.processType | ||||
|             }).then(res => { | ||||
|               if (res.code == 0) { | ||||
|                 this.$message.success("保存成功") | ||||
|                 this.$router.push({query: {}}) | ||||
|               } | ||||
|             }) | ||||
|           } | ||||
|         }) | ||||
|       }, | ||||
|       getDetail(id) { | ||||
|         this.instance.post(`/app/approval-process-def/info-id`, null, {params: {id}}).then(res => { | ||||
|           if (res?.data) { | ||||
|             Object.keys(this.form).map(e => this.form[e] = res.data[e]) | ||||
|           } | ||||
|         }) | ||||
|       }, | ||||
|       handleBack() { | ||||
|         this.$router.push({query: {}}) | ||||
|       } | ||||
|     }, | ||||
|     created() { | ||||
|       this.getClassification() | ||||
|       if (this.row?.id) { | ||||
|         this.getDetail(this.row?.id) | ||||
|       } | ||||
|     } | ||||
|   }, | ||||
|   computed: { | ||||
|     rules() { | ||||
|       return { | ||||
|         processName: [{required: true, message: '请输入事项名称', trigger: 'blur'}], | ||||
|         department: [{required: true, message: '请选择所属部门', trigger: 'change'}], | ||||
|         classificationId: [{required: true, message: '请选择所属分类', trigger: 'change'}], | ||||
|         needToKnow: [{required: true, message: '请输入办理须知', trigger: 'blur'}], | ||||
|         processDefStatus: [{required: true, message: '请选择是否启用', trigger: 'change'}], | ||||
|       } | ||||
|     }, | ||||
|     detailTitle: v => v.detailObj?.id ? "编辑办事指南" : "添加办事指南", | ||||
|   }, | ||||
|   methods: { | ||||
|     ...mapMutations(['setPageTitle']), | ||||
|     /** | ||||
|      * 获取分类 | ||||
|      */ | ||||
|     /** | ||||
|      * 保存 | ||||
|      */ | ||||
|     save() { | ||||
|       this.$refs["baseInfoForm"].validate(valid => { | ||||
|         if (valid) { | ||||
|           this.instance.post(`/app/approval-process-def/add-update`, { | ||||
|             ...this.form, | ||||
|             processType: 2 | ||||
|           }).then(res => { | ||||
|             if (res.code == 0) { | ||||
|               this.$message.success("保存成功") | ||||
|               this.$router.push({query: {}}) | ||||
|             } | ||||
|           }) | ||||
|         } | ||||
|       }) | ||||
|     }, | ||||
|     getDetail() { | ||||
|       const {id} = this.$route.query | ||||
|       id && this.instance.post(`/app/approval-process-def/info-id`, null, {params: {id}}).then(res => { | ||||
|         if (res?.data) { | ||||
|           Object.keys(this.form).map(e => this.form[e] = res.data[e]) | ||||
|         } | ||||
|       }) | ||||
|     }, | ||||
|     handleBack() { | ||||
|       this.$router.push({query: {}}) | ||||
|     } | ||||
|   }, | ||||
|   created() { | ||||
|     this.setPageTitle(this.detailTitle) | ||||
|     this.getDetail() | ||||
|   } | ||||
| } | ||||
| </script> | ||||
|  | ||||
| <style lang="scss" scoped> | ||||
|   .add-config { | ||||
|     height: 100%; | ||||
| .guidance { | ||||
|   height: 100%; | ||||
|  | ||||
|     .step { | ||||
|       width: 100%; | ||||
|   .step { | ||||
|     width: 100%; | ||||
|     height: 72px; | ||||
|     font-size: 14px; | ||||
|  | ||||
|     .el-steps { | ||||
|       display: flex; | ||||
|       align-items: center; | ||||
|       height: 72px; | ||||
|       font-size: 14px; | ||||
|  | ||||
|       .el-steps { | ||||
|         display: flex; | ||||
|         align-items: center; | ||||
|         height: 72px; | ||||
|         padding: 0 calc(50% - 380px); | ||||
|       padding: 0 calc(50% - 380px); | ||||
|  | ||||
|  | ||||
|         :deep( .el-step ){ | ||||
|           font-weight: bold; | ||||
|       :deep( .el-step ) { | ||||
|         font-weight: bold; | ||||
|  | ||||
|           :deep( .el-step__icon ){ | ||||
|             width: 24px; | ||||
|             height: 24px; | ||||
|             background: #fff; | ||||
|         :deep( .el-step__icon ) { | ||||
|           width: 24px; | ||||
|           height: 24px; | ||||
|           background: #fff; | ||||
|  | ||||
|             .iconfont { | ||||
|               font-size: 24px; | ||||
|             } | ||||
|           } | ||||
|  | ||||
|           :deep( .el-step__main ){ | ||||
|             display: flex; | ||||
|             align-items: center; | ||||
|  | ||||
|             .el-step__arrow { | ||||
|               background: #D0D4DC; | ||||
|               margin: 0 8px; | ||||
|               height: 2px; | ||||
|  | ||||
|               &:before, &:after { | ||||
|                 display: none; | ||||
|               } | ||||
|             } | ||||
|           } | ||||
|  | ||||
|           .is-process { | ||||
|             color: #2266FF; | ||||
|           } | ||||
|  | ||||
|           .is-wait { | ||||
|             color: #666; | ||||
|             border-color: #D0D4DC; | ||||
|           .iconfont { | ||||
|             font-size: 24px; | ||||
|           } | ||||
|         } | ||||
|  | ||||
|         :deep( .el-step__main ) { | ||||
|           display: flex; | ||||
|           align-items: center; | ||||
|  | ||||
|           .el-step__arrow { | ||||
|             background: #D0D4DC; | ||||
|             margin: 0 8px; | ||||
|             height: 2px; | ||||
|  | ||||
|             &:before, &:after { | ||||
|               display: none; | ||||
|             } | ||||
|           } | ||||
|         } | ||||
|  | ||||
|         .is-process { | ||||
|           color: #2266FF; | ||||
|         } | ||||
|  | ||||
|         .is-wait { | ||||
|           color: #666; | ||||
|           border-color: #D0D4DC; | ||||
|         } | ||||
|       } | ||||
|  | ||||
|     } | ||||
|  | ||||
|     .btn { | ||||
|       width: 92px; | ||||
|       height: 32px; | ||||
|   } | ||||
|  | ||||
|       &:nth-child(2) { | ||||
|         margin-left: 24px; | ||||
|       } | ||||
|   .btn { | ||||
|     width: 92px; | ||||
|     height: 32px; | ||||
|  | ||||
|     &:nth-child(2) { | ||||
|       margin-left: 24px; | ||||
|     } | ||||
|   } | ||||
| } | ||||
| </style> | ||||
|   | ||||
		Reference in New Issue
	
	Block a user