From b5a56d53e44c426fa188ba3e4e1db3eb779e2fd9 Mon Sep 17 00:00:00 2001
From: WXL <1785969728@qq.com>
Date: 星期三, 11 九月 2024 21:49:21 +0800
Subject: [PATCH] 测试完成

---
 src/views/system/user/index.vue |   67 ++++++++++++++++++++++++++++-----
 1 files changed, 57 insertions(+), 10 deletions(-)

diff --git a/src/views/system/user/index.vue b/src/views/system/user/index.vue
index bb206c6..23cce5e 100644
--- a/src/views/system/user/index.vue
+++ b/src/views/system/user/index.vue
@@ -228,7 +228,7 @@
             width="160"
           >
             <template slot-scope="scope">
-              <span>{{ parseTime(scope.row.createTime) }}</span>
+              <span>{{ formatTime(scope.row.createTime) }}</span>
             </template>
           </el-table-column>
           <el-table-column
@@ -304,18 +304,52 @@
               />
             </el-form-item>
           </el-col>
-          <el-col :span="12">
+          <!-- <el-col :span="12">
             <el-form-item label="褰掑睘閮ㄩ棬" prop="deptId">
               <treeselect
-                v-model="deptIds"
+                v-model="form.depts"
                 :options="deptOptions"
                 :multiple="true"
                 :show-count="true"
                 placeholder="璇烽�夋嫨褰掑睘閮ㄩ棬"
               />
             </el-form-item>
-          </el-col>
+          </el-col> -->
         </el-row>
+        <el-form-item label="閫傜敤绉戝" prop="region">
+                <el-cascader
+                style="width: 478px"
+                  v-model="form.leaveldeptcodes"
+                  :options="deptOptions"
+                  :props="props"
+                  :show-all-levels="false"
+                  clearable
+                >
+                  <template slot-scope="{ node, data }">
+                    <span>{{ data.label }}</span>
+                    <span v-if="!node.isLeaf">
+                      ({{ data.children.length }})
+                    </span>
+                  </template>
+                </el-cascader>
+              </el-form-item>
+              <el-form-item label="閫傜敤闄㈠尯" prop="region">
+                <el-cascader
+                style="width: 478px"
+                  v-model="form.leavehospitaldistrictcodes"
+                  :options="deptOptions"
+                  :props="props"
+                  :show-all-levels="false"
+                  clearable
+                >
+                  <template slot-scope="{ node, data }">
+                    <span>{{ data.label }}</span>
+                    <span v-if="!node.isLeaf">
+                      ({{ data.children.length }})
+                    </span>
+                  </template>
+                </el-cascader>
+              </el-form-item>
         <el-row>
           <el-col :span="12">
             <el-form-item label="鎵嬫満鍙风爜" prop="phonenumber">
@@ -548,6 +582,7 @@
         children: "children",
         label: "label",
       },
+      props: { multiple: true, value: "id", label: "label" },
       // 鐢ㄦ埛瀵煎叆鍙傛暟
       upload: {
         // 鏄惁鏄剧ず寮瑰嚭灞傦紙鐢ㄦ埛瀵煎叆锛�
@@ -737,13 +772,15 @@
     /** 鏂板鎸夐挳鎿嶄綔 */
     handleAdd() {
       this.reset();
-      getUser().then((response) => {
-        this.postOptions = response.posts;
-        this.roleOptions = response.roles;
-        this.open = true;
+      this.open = true;
         this.title = "娣诲姞鐢ㄦ埛";
         this.form.password = this.initPassword;
-      });
+        this.form.depts = [];
+      // getUser().then((response) => {
+      //   this.postOptions = response.posts;
+      //   this.roleOptions = response.roles;
+
+      // });
     },
     /** 淇敼鎸夐挳鎿嶄綔 */
     handleUpdate(row) {
@@ -752,7 +789,8 @@
       const userId = row.userId || this.ids;
       getUser(userId).then((response) => {
         this.form = response.data;
-
+        this.form.leaveldeptcodes = JSON.parse(this.form.hospInfo);
+        this.form.leavehospitaldistrictcodes = JSON.parse(this.form.deptInfo);
         this.postOptions = response.posts;
         this.roleOptions = response.roles;
         this.$set(this.form, "postIds", response.postIds);
@@ -785,6 +823,15 @@
     },
     /** 鎻愪氦鎸夐挳 */
     submitForm: function () {
+      this.form.hospInfo = JSON.stringify(this.form.leaveldeptcodes);
+      this.form.deptInfo = JSON.stringify(this.form.leavehospitaldistrictcodes);
+      this.form.leaveldeptcodes = this.form.leaveldeptcodes.map(
+        (subArr) => subArr[subArr.length - 1]
+      );
+      this.form.leavehospitaldistrictcodes = this.form.leavehospitaldistrictcodes.map(
+        (subArr) => subArr[subArr.length - 1]
+      );
+
       this.$refs["form"].validate((valid) => {
         if (valid) {
           if (this.form.userId != undefined) {

--
Gitblit v1.9.3