From 5115f0c87cb1c11778fbd02253184ecaf7780643 Mon Sep 17 00:00:00 2001
From: Administrator <admin>
Date: Mon, 11 Jul 2022 16:01:25 +0800
Subject: [PATCH] 农场绑定修改

---
 src/views/system/user.vue |  190 +++++++++++++++++++++++++++-------------------
 1 files changed, 111 insertions(+), 79 deletions(-)

diff --git a/src/views/system/user.vue b/src/views/system/user.vue
index 831b2df..4381408 100644
--- a/src/views/system/user.vue
+++ b/src/views/system/user.vue
@@ -179,6 +179,7 @@
   } from "@/api/system/user";
   import {exportBlob} from "@/api/common";
   import {getDeptTree, getDeptLazyTree} from "@/api/system/dept";
+  import {getFarmList} from "@/api/farm/farm";
   import {getRoleTree} from "@/api/system/role";
   import {getPostList} from "@/api/system/post";
   import {mapGetters} from "vuex";
@@ -307,31 +308,31 @@
               slot: true,
               display: false
             },
-            {
-              label: "用户平台",
-              prop: "userTypeName",
-              slot: true,
-              display: false
-            },
-            {
-              label: "用户平台",
-              type: "select",
-              dicUrl: "/api/blade-system/dict/dictionary?code=user_type",
-              props: {
-                label: "dictValue",
-                value: "dictKey"
-              },
-              dataType: "number",
-              search: true,
-              hide: true,
-              display: false,
-              prop: "userType",
-              rules: [{
-                required: true,
-                message: "请选择用户平台",
-                trigger: "blur"
-              }]
-            },
+            // {
+            //   label: "用户平台",
+            //   prop: "userTypeName",
+            //   slot: true,
+            //   display: false
+            // },
+            // {
+            //   label: "用户平台",
+            //   type: "select",
+            //   dicUrl: "/api/blade-system/dict/dictionary?code=user_type",
+            //   props: {
+            //     label: "dictValue",
+            //     value: "dictKey"
+            //   },
+            //   dataType: "number",
+            //   search: true,
+            //   hide: true,
+            //   display: false,
+            //   prop: "userType",
+            //   rules: [{
+            //     required: true,
+            //     message: "请选择用户平台",
+            //     trigger: "blur"
+            //   }]
+            // },
           ],
           group: [
             {
@@ -368,23 +369,23 @@
                     trigger: "blur"
                   }],
                 },
-                {
-                  label: "用户平台",
-                  type: "select",
-                  dicUrl: "/api/blade-system/dict/dictionary?code=user_type",
-                  props: {
-                    label: "dictValue",
-                    value: "dictKey"
-                  },
-                  dataType: "number",
-                  slot: true,
-                  prop: "userType",
-                  rules: [{
-                    required: true,
-                    message: "请选择用户平台",
-                    trigger: "blur"
-                  }]
-                },
+                // {
+                //   label: "用户平台",
+                //   type: "select",
+                //   dicUrl: "/api/blade-system/dict/dictionary?code=user_type",
+                //   props: {
+                //     label: "dictValue",
+                //     value: "dictKey"
+                //   },
+                //   dataType: "number",
+                //   slot: true,
+                //   prop: "userType",
+                //   rules: [{
+                //     required: true,
+                //     message: "请选择用户平台",
+                //     trigger: "blur"
+                //   }]
+                // },
                 {
                   label: '密码',
                   prop: 'password',
@@ -483,10 +484,10 @@
               prop: 'dutyInfo',
               icon: 'el-icon-s-custom',
               column: [
-                {
-                  label: "用户编号",
-                  prop: "code",
-                },
+                // {
+                //   label: "用户编号",
+                //   prop: "code",
+                // },
                 {
                   label: "所属角色",
                   prop: "roleId",
@@ -505,38 +506,57 @@
                   }]
                 },
                 {
-                  label: "所属部门",
-                  prop: "deptId",
+                  label: "负责的农场",
+                  prop: "farmId",
+                  labelWidth:110,
                   type: "tree",
                   multiple: true,
                   dicData: [],
                   props: {
-                    label: "title"
+                    label: "farmName",
+                    value:"id"
                   },
                   checkStrictly: true,
                   slot: true,
                   rules: [{
                     required: true,
-                    message: "请选择所属部门",
+                    message: "请选择负责的农场",
                     trigger: "click"
                   }]
                 },
-                {
-                  label: "所属岗位",
-                  prop: "postId",
-                  type: "tree",
-                  multiple: true,
-                  dicData: [],
-                  props: {
-                    label: "postName",
-                    value: "id"
-                  },
-                  rules: [{
-                    required: true,
-                    message: "请选择所属岗位",
-                    trigger: "click"
-                  }],
-                },
+                // {
+                //   label: "所属部门",
+                //   prop: "deptId",
+                //   type: "tree",
+                //   multiple: true,
+                //   dicData: [],
+                //   props: {
+                //     label: "title"
+                //   },
+                //   checkStrictly: true,
+                //   slot: true,
+                //   rules: [{
+                //     required: true,
+                //     message: "请选择所属部门",
+                //     trigger: "click"
+                //   }]
+                // },
+                // {
+                //   label: "所属岗位",
+                //   prop: "postId",
+                //   type: "tree",
+                //   multiple: true,
+                //   dicData: [],
+                //   props: {
+                //     label: "postName",
+                //     value: "id"
+                //   },
+                //   rules: [{
+                //     required: true,
+                //     message: "请选择所属岗位",
+                //     trigger: "click"
+                //   }],
+                // },
               ]
             },
           ]
@@ -723,14 +743,21 @@
           const column = this.findObject(this.option.group, "roleId");
           column.dicData = res.data.data;
         });
-        getDeptTree(tenantId).then(res => {
-          const column = this.findObject(this.option.group, "deptId");
+        const data = {
+          deptId:this.userInfo.dept_id
+        }
+        getFarmList(data).then(res => {
+          const column = this.findObject(this.option.group, "farmId");
           column.dicData = res.data.data;
         });
-        getPostList(tenantId).then(res => {
-          const column = this.findObject(this.option.group, "postId");
-          column.dicData = res.data.data;
-        });
+        // getDeptTree(tenantId).then(res => {
+        //   const column = this.findObject(this.option.group, "deptId");
+        //   column.dicData = res.data.data;
+        // });
+        // getPostList(tenantId).then(res => {
+        //   const column = this.findObject(this.option.group, "postId");
+        //   column.dicData = res.data.data;
+        // });
       },
       submitRole() {
         const roleList = this.$refs.treeRole.getCheckedKeys().join(",");
@@ -744,9 +771,10 @@
         });
       },
       rowSave(row, done, loading) {
-        row.deptId = row.deptId.join(",");
+        row['deptId'] = this.userInfo.dept_id;
         row.roleId = row.roleId.join(",");
-        row.postId = row.postId.join(",");
+        row.farmId = row.farmId.join(",");
+        // row.postId = row.postId.join(",");
         add(row).then(() => {
           this.initFlag = false;
           this.onLoad(this.page);
@@ -761,9 +789,10 @@
         });
       },
       rowUpdate(row, index, done, loading) {
-        row.deptId = row.deptId.join(",");
+        debugger;
+        row['deptId'] = this.userInfo.dept_id;
         row.roleId = row.roleId.join(",");
-        row.postId = row.postId.join(",");
+        row.farmId = row.farmId.join(",");
         update(row).then(() => {
           this.initFlag = false;
           this.onLoad(this.page);
@@ -926,12 +955,15 @@
             if(this.form.hasOwnProperty("deptId")){
               this.form.deptId = this.form.deptId.split(",");
             }
+            if(this.form.hasOwnProperty("farmId")){
+              this.form.farmId = this.form.farmId.split(",");
+            }
             if(this.form.hasOwnProperty("roleId")){
               this.form.roleId = this.form.roleId.split(",");
             }
-            if(this.form.hasOwnProperty("postId")){
-              this.form.postId = this.form.postId.split(",");
-            }
+            // if(this.form.hasOwnProperty("postId")){
+            //   this.form.postId = this.form.postId.split(",");
+            // }
           });
         }
         this.initFlag = true;

--
Gitblit v1.9.3