sqg 4 年 前
コミット
dcab7a3910
2 ファイル変更44 行追加32 行削除
  1. 12 5
      front-vue/src/api/system/user.js
  2. 32 27
      front-vue/src/views/system/user/index.vue

+ 12 - 5
front-vue/src/api/system/user.js

@@ -11,11 +11,18 @@ export function listUser(query) {
 }
 
 // 查询用户详细
-export function getUser(userId) {
-  return request({
-    url: '/system/user/' + praseStrEmpty(userId),
-    method: 'get'
-  })
+export function getUser(userId, scyId) {
+  if(userId && scyId){
+    return request({
+      url: '/system/user/' + praseStrEmpty(userId) +'/' + scyId,
+      method: 'get'
+  })
+  }else{
+    return request({
+      url: '/system/user/' + praseStrEmpty(userId),
+      method: 'get'
+    })
+  }
 }
 
 // 新增用户

+ 32 - 27
front-vue/src/views/system/user/index.vue

@@ -78,6 +78,7 @@
                 clearable
                 size="small"
                 style="width: 240px"
+                maxlength="11"
                 @keyup.enter.native="handleQuery"
               />
             </el-form-item>
@@ -88,6 +89,7 @@
                 clearable
                 size="small"
                 style="width: 240px"
+                maxlength="30"
                 @keyup.enter.native="handleQuery"
               />
             </el-form-item>
@@ -184,6 +186,20 @@
             v-if="uncheckList.nickName"
           />
           <el-table-column
+            label="企业名称"
+            align="center"
+            prop="scyName"
+            :show-overflow-tooltip="true"
+            v-if="uncheckList.scyName"
+          />
+          <el-table-column
+            label="部门名称"
+            align="center"
+            prop="deptName"
+            :show-overflow-tooltip="true"
+            v-if="uncheckList.deptName"
+          />
+          <el-table-column
             label="状态"
             align="center"
             prop="state"
@@ -624,8 +640,12 @@ export default {
           value: "用户姓名",
         },
         {
-          label: "phonenumber",
-          value: "手机号码",
+          label: "scyName",
+          value: "企业名称",
+        },
+        {
+          label: "deptName",
+          value: "部门",
         },
         {
           label: "state",
@@ -679,8 +699,8 @@ export default {
         roleIds: [
           {
             required: true,
-            message: "不能为空",
-            trigger: "blur",
+            message: "角色不能为空",
+            trigger: ["blur", "change"],
           },
         ],
         userName: [
@@ -699,14 +719,14 @@ export default {
           {
             required: true,
             message: "用户姓名不能为空",
-            trigger: "blur",
+            trigger: ["blur", "change"],
           },
         ],
         deptId: [
           {
             required: true,
             message: "归属部门不能为空",
-            trigger: "blur",
+            trigger: ["blur", "change"],
           },
         ],
         postIds: [
@@ -751,16 +771,10 @@ export default {
             trigger: "blur",
           },
           {
-            min: 6,
-            max: 20,
-            message: "长度在 6 到 20 个字符",
-            trigger: "blur",
-          },
-          {
             pattern: /^(?![0-9]+$)(?![a-z]+$)(?![A-Z]+$)(?!([^(0-9a-zA-Z)])+$).{6,20}$/,
             message: "密码请包含数字,英文,字符中的两种以上,长度6-20位",
             trigger: ["blur", "change"],
-          },
+          }
         ],
       },
       peoplpeName: false,
@@ -840,8 +854,6 @@ export default {
     },
     //根据企业id查询部门和角色信息
     getRodept(item) {
-      this.$set(this.form, "deptId", null);
-      this.$set(this.form, "roleIds", null);
       if (item) {
         this.rodeptShow = true;
         const companyId = item;
@@ -1105,7 +1117,6 @@ export default {
     },
     /** 修改按钮操作 */
     handleUpdate(row) {
-      console.log(row)
       if (this.signCompanyId == "000000") {
         this.rodeptShow = false;
       } else if (this.signCompanyId != "000000") {
@@ -1118,18 +1129,11 @@ export default {
       this.peoplpeName = true;
       this.getFormTreeselect();
       const userId = row.userId || this.ids;
-      getUser(userId).then((response) => {
+      const scyId = row.scyId;
+      this.form = row;
+      getUser(userId, scyId).then((response) => {
         this.uinParams.ssId = response.data.staffCode;
-        this.form = response.data;
-        if (this.signCompanyId == "000000") {
-          companyList(userId).then((response) => {
-            this.companyList = response.data;
-            if (response.data.length > 0) {
-              this.$set(this.form, "companyId", response.data[0].scyId);
-              this.getRodept(response.data[0].scyId);
-            }
-          });
-        }
+        this.getRodept(scyId);
         this.postOptions = response.posts;
         this.roleOptions = response.roles;
         this.form.postIds = response.postIds;
@@ -1209,6 +1213,7 @@ export default {
               background: "rgba(0, 0, 0, 0.7)",
             });
             this.$set(this.form, "createTime", null);
+            this.$set(this.form, "companyId", this.form.scyId);
             updateUser(this.form)
               .then((response) => {
                 loading.close();