WXL
2024-09-11 b5a56d53e44c426fa188ba3e4e1db3eb779e2fd9
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) {