Răsfoiți Sursa

履职内容定义优化

jiawuxian 2 ani în urmă
părinte
comite
8818855179

+ 2 - 12
src/views/commonOption.js

@@ -1,15 +1,5 @@
-const statusOptions = [
-  {
-    value: 0,
-    label: "启用",
-  },
-  {
-    value: 1,
-    label: "禁用",
-  },
-];
 const getLabel=(options,value)=>{
-  let option=options.find(o=>o.value===value);
+  let option=options.find(o=>o.value==value);
   return option?option.label:'';
 }
-export { statusOptions ,getLabel};
+export { getLabel};

+ 11 - 14
src/views/resumption/rule/dialog.edit.vue

@@ -3,6 +3,7 @@
     <el-dialog
       :title="id ? '编辑履职内容库定义' : '新增履职内容库定义'"
       :visible.sync="isShow"
+      @close="onHide"
       width="500px"
     >
       <div class="page-body">
@@ -19,7 +20,6 @@
             <el-input
               v-model="formData.name"
               :maxlength="50"
-              name="name"
               placeholder="请输入履职内容库名称"
               clearable
             />
@@ -84,7 +84,7 @@
       </div>
 
       <div slot="footer" class="dialog-footer">
-        <el-button @click="onHide">取消</el-button>
+        <el-button @click="isShow=false">取消</el-button>
         <el-button type="primary" @click="onSubmit">确定</el-button>
       </div>
     </el-dialog>
@@ -94,14 +94,9 @@
 <script>
 import { mapState, mapMutations } from "vuex";
 import * as api from "@/api/resumption/rule";
-import { statusOptions } from "./../../commonOption";
 
 export default {
   data() {
-    // const params = this.$route.params;
-    // let o1=options;
-    // let o=statusOptions;
-    // debugger
     return {
       id: null,
       isShow: false,
@@ -112,7 +107,6 @@ export default {
         orgType: [{ required: true, message: "请选择履职机构类型" }],
         status: [{ required: true, message: "请选择状态" }],
       },
-      statusOptions: statusOptions,
     };
   },
   props: {
@@ -122,6 +116,9 @@ export default {
     ruleTypeOptions: {
       type: Array,
     },
+    statusOptions: {
+      type: Array,
+    },
   },
   watch: {},
   computed: {
@@ -140,7 +137,7 @@ export default {
       };
     },
     async refresh(id, other) {
-      this.formData = id ? (await api.get(id)).data : this.reset(other);      
+      this.formData = id ? (await api.get(id)).data : this.reset(other);
     },
     async show(id, other = {}) {
       this.id = id;
@@ -149,16 +146,16 @@ export default {
     },
 
     // 事件
-    onHide() {
-      this.isShow = false;
-      this.$refs.form.resetFields();
+    onHide() {   
+      this.formData=this.reset();
+      this.$refs.form.resetFields(); 
     },
     onSubmit() {
       this.$refs.form.validate(async (isValidate) => {
         if (!isValidate) return;
         await api.update(this.formData);
-          this.$emit("success");
-          this.onHide();
+        this.$emit("success");
+        this.isShow = false;
       });
     },
 

+ 5 - 8
src/views/resumption/rule/index.vue

@@ -163,7 +163,7 @@
           ></el-table-column>
           <el-table-column prop="status" label="状态" v-if="columns[5].visible">
             <template slot-scope="r">
-              <span>{{ getStatusLabel(r.row.status) }}</span>
+              <span>{{ getLabel(dict.type.plan_status,r.row.status) }}</span>
             </template>
           </el-table-column>
           <el-table-column
@@ -208,6 +208,7 @@
       @success="getList()"
       :orgTypeOptions="dict.type.sys_org_type"
       :ruleTypeOptions="dict.type.rule_type"
+      :statusOptions="dict.type.plan_status"
     ></dialog-edit>
   </div>
 </template>
@@ -217,11 +218,11 @@ import OrgTree from "@/components/orgTree";
 import { mapState, mapMutations } from "vuex";
 import DialogEdit from "./dialog.edit";
 import * as api from "@/api/resumption/rule";
-import { statusOptions, getLabel } from "./../../commonOption";
+import { getLabel } from "./../../commonOption";
 
 export default {
   name: "ruletype",
-  dicts: ["sys_org_type", "rule_type"],
+  dicts: ["sys_org_type", "rule_type","plan_status"],
   components: {
     DialogEdit,
     OrgTree,
@@ -323,11 +324,7 @@ export default {
     clickTreeNode(data) {
       this.queryParams.orgId = data.id;
       this.getList();
-    },
-    getStatusLabel(value) {
-      return getLabel(statusOptions, value);
-    },
-
+    }
     //apimark//
   },
   mounted() {},