Browse Source

修改履职计划

luojun 2 years ago
parent
commit
9ae7773e8e

+ 1 - 0
src/store/getters.js

@@ -11,6 +11,7 @@ const getters = {
   userId: state => state.user.userId,
   deptId: state => state.user.deptId,
   orgId: state => state.user.orgId,
+  orgName: state => state.user.orgName,
   introduction: state => state.user.introduction,
   roles: state => state.user.roles,
   permissions: state => state.user.permissions,

+ 7 - 2
src/store/modules/user.js

@@ -9,7 +9,8 @@ const user = {
     orgId:'',
     avatar: '',
     roles: [],
-    permissions: []
+    permissions: [],
+    orgName: '',
   },
 
   mutations: {
@@ -36,7 +37,10 @@ const user = {
     },
     SET_PERMISSIONS: (state, permissions) => {
       state.permissions = permissions
-    }
+    },
+    SET_ORG_NAME: (state, val) => {
+      state.orgName = val
+    },
   },
 
   actions: {
@@ -77,6 +81,7 @@ const user = {
           commit('SET_NAME', user.name)
           commit('SET_AVATAR', avatar)
           commit('SET_ORG_ID', user.orgId)
+          commit('SET_ORG_NAME', user.orgName)
           resolve(res)
         }).catch(error => {
           reject(error)

+ 75 - 42
src/views/resumption/plan/dialog.edit.vue

@@ -92,6 +92,7 @@
                   v-model="formData.execOrgType"
                   placeholder="请选择履职机构类型"
                   clearable
+                  
                 >
                   <el-option
                     v-for="item in dict.type.sys_org_type"
@@ -104,18 +105,21 @@
               </el-form-item>
             </el-col>
             <el-col :span="6">
-              <el-form-item prop="roleNames" label="履职角色:">
+              <el-form-item prop="roleList" label="履职角色:">
                 <el-select
+                  @visible-change="getRolesByOrg"
                   label="履职角色"
-                  v-model="formData.roleNames"
+                  v-model="formData.resumptionRole"
                   placeholder="请选择履职角色"
-                  clearable
+                  multiple
+                  filterable
+                  @change="handleRolesChange"
                 >
                   <el-option
-                    v-for="item in roleNames"
-                    :key="item.value"
-                    :label="item.label"
-                    :value="item.value"
+                    v-for="item in resumptionRoles"
+                    :key="item.index"
+                    :label="item.roleName"
+                    :value="item.id"
                   >
                   </el-option>
                 </el-select>
@@ -142,14 +146,13 @@
             <el-col :span="6">
               <el-form-item prop="count" label="履职次数:">
                 <el-input-number
-            style="margin-left: 10px"
-            v-model="count"
-            controls-position="right"
-            @change="handleChange"
-            :min="1"
-            :max="10"
-          ></el-input-number>
-                
+                  style="margin-left: 10px"
+                  v-model="formData.count"
+                  controls-position="right"
+                  @change="handleChange"
+                  :min="1"
+                  :max="10"
+                ></el-input-number>
               </el-form-item>
             </el-col>
           </el-row>
@@ -194,27 +197,37 @@
 </template>
 
 <script>
-import { mapState, mapMutations } from "vuex";
+import { mapGetters } from "vuex";
 import * as api from "@/api/resumption/plan";
 import { statusOptions } from "./../../commonOption";
+import { listRole } from "@/api/system/role";
 
 export default {
-  dicts: ['resumption_plan_type',"resumption_plan_cycle","resumption_org_type","resumption_plan_status","sys_org_type","resumption_plan_exec"],
+  dicts: [
+    "resumption_plan_type",
+    "resumption_plan_cycle",
+    "resumption_org_type",
+    "resumption_plan_status",
+    "sys_org_type",
+    "resumption_plan_exec",
+  ],
   data() {
     // const params = this.$route.params;
     // let o1=options;
     // let o=statusOptions;
     // debugger
     return {
+      selectedValues: [],
+      resumptionRoles: [],
       planName: null,
-        planType: null,
-        planCycle: null,
-        planStatus: null,
-        execOrgType: null,
-        roleNames: null,
-        planExec:null,
-        count: null,
-        description: null,
+      planType: null,
+      planCycle: null,
+      planStatus: null,
+      execOrgType: null,
+      roleNames: null,
+      planExec: null,
+      count: 0,
+      description: null,
       propItem: "",
       propList: [
         {
@@ -271,10 +284,9 @@ export default {
   },
   watch: {},
   computed: {
-    ...mapState([]),
+    ...mapGetters(['orgId',"orgName"]),
   },
   methods: {
-    ...mapMutations([]),
     reset() {
       return {
         planName: null,
@@ -285,28 +297,44 @@ export default {
         roleNames: null,
         count: null,
         description: null,
-        tableData:null,
-        itemList:null,
-        planExec:null,
+        tableData: null,
+        itemList: null,
+        planExec: null,
+        count:0,
+        note:null,
+        planCreateOrgId:null,
+        planCreateOrgName:null,
+      };
+    },
+    getRolesByOrg() {
+      let params = {
+        orgType: this.formData.execOrgType,
       };
+      listRole(params).then((res) => {
+        // console.info(res);
+        this.resumptionRoles = res.rows;
+      });
+    },
+    handleChange(value) {
+      console.log(value);
+      this.count = value;
     },
-    handleChange(value) {},
     async refresh(id, other) {
       this.formData = id ? (await api.get(id)).data : this.reset(other);
     },
     async show(id, other = {}) {
       this.id = id;
-      this.tableData=null;
-      this.formData.itemList=null;
+      this.tableData = null;
+      this.formData.itemList = null;
       await this.refresh(id, other);
-      console.log(id)
-      if(id!==undefined){
+      console.log(id);
+      if (id !== undefined) {
         await api.get(id).then((res) => {
-        console.log(res);
-        this.tableData = res.data.itemList;
-      });
+          console.log(res);
+          this.tableData = res.data.itemList;
+        });
       }
- 
+
       this.isShow = true;
     },
     removeRow(index) {
@@ -318,15 +346,20 @@ export default {
     },
     onSubmit() {
       this.$refs.form.validate(async (isValidate) => {
-        console.log(this.formData)
+        this.formData.note = this.formData.description;
+        this.formData.planCreateOrgId=this.orgId;
+        this.formData.planCreateOrgName=this.orgName;
         if (!isValidate) return;
-        this.formData.itemList=this.tableData;
+        this.formData.itemList = this.tableData==null?[]:this.tableData;
+        this.formData.roleList = this.selectedValues;
         await api.update(this.formData);
         this.$emit("success");
         this.onHide();
       });
     },
-
+    handleRolesChange(val){
+      this.selectedValues = val.toString().split(',');
+    },
     // 事件
     //apimark//
   },

+ 19 - 5
src/views/resumption/plan/index.vue

@@ -39,17 +39,19 @@
           </el-form-item>
           <el-form-item prop="resumptionRole" label="履职角色">
             <el-select
+            @visible-change="getRolesByOrg"
               prop="resumptionRole"
               label="履职角色"
               v-model="queryParams.resumptionRole"
               placeholder="请选择履职角色"
+             
               clearable
             >
               <el-option
-                v-for="dict in dict.type.resumptionRole"
-                :key="dict.value"
-                :label="dict.label"
-                :value="dict.value"
+                v-for="dict in resumptionRoles"
+                :key="dict.index"
+                :label="dict.roleName"
+                :value="dict.id"
               />
             </el-select>
           </el-form-item>
@@ -305,7 +307,7 @@ import { mapState, mapMutations } from "vuex";
 import DialogEdit from "./dialog.edit";
 import * as api from "@/api/resumption/plan";
 import { statusOptions, getLabel } from "./../../commonOption";
-
+import {listRole} from "@/api/system/role"
 export default {
   name: "resumptionplan",
   dicts: ["sys_org_type", "rule_type","resumption_plan_type","resumption_plan_cycle","resumption_plan_status","resumption_plan_exec"],
@@ -325,6 +327,7 @@ export default {
       multiple: true,
       // 显示搜索条件
       showSearch: true,
+      resumptionRoles:[],
       total: 0,
       queryParams: {
         orgId: null,
@@ -362,6 +365,17 @@ export default {
   },
   methods: {
     ...mapMutations([]),
+
+    getRolesByOrg(){
+      let params = {
+        // orgId:this.queryParams.orgId
+      }
+      listRole(params).then(res=>{
+        // console.info(res);
+        this.resumptionRoles = res.rows
+      })
+
+    },
     getList() {
       this.loading = true;
       console.info(this.dict.type);