yxh
2023-11-21 dacf3c6ae5ede1c0a8a8b4afb24e2a3b62f0e368
src/views/patient/patient/index.vue
@@ -261,15 +261,14 @@
    <!-- 添加或修改用户配置对话框 -->
    <el-dialog
      :title="title"
      :title="amendtag ? '修改患者信息' : '新增患者'"
      :visible.sync="Labelchange"
      width="900px"
      append-to-body
    >
      <el-form ref="form" :model="form" :rules="rules" label-width="100px">
        <el-row>
          <el-col :span="12">
            <el-form-item label="姓名" prop="nickName">
            <el-form-item label="姓名" prop="name">
              <el-input
                v-model="form.name"
                placeholder="请输入姓名"
@@ -278,7 +277,7 @@
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="性别" prop="deptId">
            <el-form-item label="性别" prop="sex">
              <el-select v-model="form.sex" placeholder="请选择性别">
                <el-option
                  v-for="dict in dict.type.sys_user_sex"
@@ -292,7 +291,7 @@
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="证件类型" prop="phonenumber">
            <el-form-item label="证件类型" prop="iccardtype">
              <el-select v-model="form.iccardtype" placeholder="请选择性别">
                <el-option
                  v-for="item in paperstypes"
@@ -304,7 +303,7 @@
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="证件号" prop="email">
            <el-form-item label="证件号" prop="iccardno">
              <el-input
                v-model="form.iccardno"
                placeholder="请输入证件号"
@@ -315,7 +314,7 @@
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="本人手机号" prop="userName">
            <el-form-item label="本人手机号" prop="telcode">
              <el-input
                v-model="form.telcode"
                placeholder="请输入手机号"
@@ -324,7 +323,7 @@
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="亲属手机号" prop="password">
            <el-form-item label="亲属手机号" prop="relativetelcode">
              <el-input
                v-model="form.relativetelcode"
                placeholder="请输入亲属手机号"
@@ -337,7 +336,7 @@
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="年龄" prop="nickName">
            <el-form-item label="年龄" prop="age">
              <el-input
                v-model="form.age"
                placeholder="请输入年龄"
@@ -471,30 +470,30 @@
</template>
<script>
import { delUser } from "@/api/system/user";
import {
  delUser,
  addUser,
  updateUser,
  resetUserPwd,
  changeUserStatus,
  deptTreeSelect,
} from "@/api/system/user";
  listpat_archive,
  getpat_archive,
  addpat_archive,
  updatepat_archive,
  delpat_archive,
} from "@/api/smartorpor/pat_archive";
import {
  listpatient,
  messagelistpatient,
  alterpatient,
  addpatient,
  particularpatient,
  deletepatient,
  Exporterrorpatient,
  toleadpatient,
} from "@/api/patient/homepage";
import { listtag } from "@/api/system/label";
import { getToken } from "@/utils/auth";
import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
export default {
  name: "User",
  name: "Userhuanze",
  dicts: ["sys_normal_disable", "sys_user_sex"],
  components: { Treeselect },
  data() {
@@ -583,49 +582,49 @@
      },
      // 表单校验
      rules: {
        userName: [
          { required: true, message: "用户名称不能为空", trigger: "blur" },
          {
            min: 2,
            max: 20,
            message: "用户名称长度必须介于 2 和 20 之间",
            trigger: "blur",
          },
        ],
        nickName: [
          { required: true, message: "用户昵称不能为空", trigger: "blur" },
        ],
        password: [
          { required: true, message: "用户密码不能为空", trigger: "blur" },
          {
            min: 5,
            max: 20,
            message: "用户密码长度必须介于 5 和 20 之间",
            trigger: "blur",
          },
        ],
        email: [
          {
            type: "email",
            message: "请输入正确的邮箱地址",
            trigger: ["blur", "change"],
          },
        ],
        phonenumber: [
          {
            pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/,
            message: "请输入正确的手机号码",
            trigger: "blur",
          },
        ],
        IDnumber: [
          {
            pattern:
              /^\d{6}((((((19|20)\d{2})(0[13-9]|1[012])(0[1-9]|[12]\d|30))|(((19|20)\d{2})(0[13578]|1[02])31)|((19|20)\d{2})02(0[1-9]|1\d|2[0-8])|((((19|20)([13579][26]|[2468][048]|0[48]))|(2000))0229))\d{3})|((((\d{2})(0[13-9]|1[012])(0[1-9]|[12]\d|30))|((\d{2})(0[13578]|1[02])31)|((\d{2})02(0[1-9]|1\d|2[0-8]))|(([13579][26]|[2468][048]|0[048])0229))\d{2}))(\d|X|x)$/,
            message: "请输入正确的身份证号码",
            trigger: "blur",
          },
        ],
        // userName: [
        //   { required: true, message: "用户名称不能为空", trigger: "blur" },
        //   {
        //     min: 2,
        //     max: 20,
        //     message: "用户名称长度必须介于 2 和 20 之间",
        //     trigger: "blur",
        //   },
        // ],
        // nickName: [
        //   { required: true, message: "用户昵称不能为空", trigger: "blur" },
        // ],
        // password: [
        //   { required: true, message: "用户密码不能为空", trigger: "blur" },
        //   {
        //     min: 5,
        //     max: 20,
        //     message: "用户密码长度必须介于 5 和 20 之间",
        //     trigger: "blur",
        //   },
        // ],
        // email: [
        //   {
        //     type: "email",
        //     message: "请输入正确的邮箱地址",
        //     trigger: ["blur", "change"],
        //   },
        // ],
        // phonenumber: [
        //   {
        //     pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/,
        //     message: "请输入正确的手机号码",
        //     trigger: "blur",
        //   },
        // ],
        // IDnumber: [
        //   {
        //     pattern:
        //       /^\d{6}((((((19|20)\d{2})(0[13-9]|1[012])(0[1-9]|[12]\d|30))|(((19|20)\d{2})(0[13578]|1[02])31)|((19|20)\d{2})02(0[1-9]|1\d|2[0-8])|((((19|20)([13579][26]|[2468][048]|0[48]))|(2000))0229))\d{3})|((((\d{2})(0[13-9]|1[012])(0[1-9]|[12]\d|30))|((\d{2})(0[13578]|1[02])31)|((\d{2})02(0[1-9]|1\d|2[0-8]))|(([13579][26]|[2468][048]|0[048])0229))\d{2}))(\d|X|x)$/,
        //     message: "请输入正确的身份证号码",
        //     trigger: "blur",
        //   },
        // ],
      },
    };
  },
@@ -638,10 +637,6 @@
  created() {
    this.getList();
    this.gettabList();
    this.getDeptTree();
    this.getConfigKey("sys.user.initPassword").then((response) => {
      this.initPassword = response.msg;
    });
  },
  methods: {
    /** 查询患者列表 */
@@ -657,7 +652,7 @@
    /** 查询标签列表 */
    gettabList() {
      const queryParams = {};
      listtag(this.addDateRange(queryParams)).then((response) => {
      listtag().then((response) => {
        console.log(response);
        this.optionstag = response.rows;
      });
@@ -671,12 +666,7 @@
        this.loading = false;
      });
    },
    /** 查询部门下拉树结构 */
    getDeptTree() {
      deptTreeSelect().then((response) => {
        this.deptOptions = response.data;
      });
    },
    // 筛选节点
    filterNode(value, data) {
      if (!value) return true;
@@ -687,35 +677,25 @@
      this.queryParams.deptId = data.id;
      this.handleQuery();
    },
    // 用户状态修改
    handleStatusChange(row) {
      let text = row.status === "0" ? "启用" : "停用";
      this.$modal
        .confirm('确认要"' + text + '""' + row.userName + '"用户吗?')
        .then(function () {
          return changeUserStatus(row.userId, row.status);
        })
        .then(() => {
          this.$modal.msgSuccess(text + "成功");
        })
        .catch(function () {
          row.status = row.status === "0" ? "1" : "0";
        });
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.Labelchange = false;
      this.reset();
    },
    // 表单重置
    reset() {
      this.form = {
        isupload: "",
        tagname: "",
        tagcategoryid: "",
        tagdescription: "",
        name: "",
        age: "",
        sex: "",
        tagList: [],
        iccardno: "",
        telcode: "",
        iccardtype: "",
        relativetelcode: "",
      };
      this.resetForm("form");
      // this.resetForm("form");
    },
    /** 搜索按钮操作 */
    handleQuery() {
@@ -740,60 +720,53 @@
    handleAdd() {
      this.reset();
      this.Labelchange = true;
      this.amendtag = false;
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.Labelchange = true;
      this.reset();
    },
    /** 重置密码按钮操作 */
    handleResetPwd(row) {
      this.$prompt('请输入"' + row.userName + '"的新密码', "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        closeOnClickModal: false,
        inputPattern: /^.{5,20}$/,
        inputErrorMessage: "用户密码长度必须介于 5 和 20 之间",
      })
        .then(({ value }) => {
          resetUserPwd(row.userId, value).then((response) => {
            this.$modal.msgSuccess("修改成功,新密码是:" + value);
          });
        })
        .catch(() => {});
    },
    /** 分配角色操作 */
    handleAuthRole: function (row) {
      const userId = row.userId;
      this.$router.push("/system/user-auth/role/" + userId);
    },
    /** 提交按钮 */
    submitForm: function () {
      this.$refs["form"].validate((valid) => {
        if (valid) {
          if (this.form.userId != undefined) {
            updateUser(this.form).then((response) => {
              this.$modal.msgSuccess("修改成功");
              this.open = false;
              this.getList();
            });
          } else {
            addUser(this.form).then((response) => {
              this.$modal.msgSuccess("新增成功");
              this.open = false;
              this.getList();
            });
          }
        }
      console.log(row);
      const userIds = row.patid || this.ids;
      particularpatient(userIds).then((response) => {
        console.log(response);
        this.form = response.data;
      });
      this.amendtag = true;
      this.Labelchange = true;
    },
    //修改/新增患者
    submitForm() {
      if (this.amendtag) {
        alterpatient(this.form)
          .then((response) => {
            console.log(response);
          })
          .then(() => {
            this.getList();
            this.$modal.msgSuccess("修改成功");
          });
      } else {
        addpatient(this.form)
          .then((response) => {
            console.log(response);
          })
          .then(() => {
            this.getList();
            this.$modal.msgSuccess("添加成功");
          });
      }
      this.reset();
      // this.idds = "";
      this.Labelchange = false;
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      const userIds = row.userId || this.ids;
      this.$modal
        .confirm('是否确认删除用户编号为"' + userIds + '"的数据项?')
        .then(function () {
          return delUser(userIds);
          return deletepatient(userIds);
        })
        .then(() => {
          this.getList();