1
wwl
2025-01-20 cf5aacd7d2cb663e3b6886245ce905ec05e78e48
src/views/hosp/project/index.vue
@@ -244,11 +244,7 @@
        </el-form-item>
        <el-form-item label="LIS编码" prop="lisXmbm">
          <el-input
            v-model="form.lisXmbm"
            placeholder="请输入his编码"
            style="width: 260px"
          />
          <el-input v-model="form.lisXmbm" placeholder="请输入his编码" style="width: 260px" />
        </el-form-item>
        <el-form-item label="备注" prop="proRemark">
          <el-input v-model="form.proRemark" placeholder="请输入备注" style="width: 200px" />
@@ -667,6 +663,8 @@
      };
      getAllChildListById(data).then((response) => {
        this.projectList = response.data.list;
        console.log("进来了列表并且获取到了值", this.projectList);
        this.loading = false;
      });
    },
@@ -988,9 +986,7 @@
        proId: this.queryParams.proId,
      };
      getAllChildListById(data).then((response) => {
        // this.projectList = this.handleTree(response.data.list, "proId");
        // this.ListId.push(this.projectList[0].proId);
        // this.key = response.data.key;
        this.loading = false;
      });
    },
@@ -1155,7 +1151,6 @@
    },
    handleUpdate1() {
      this.form = this.xiugaiList;
      console.log('调用了handleUpdate1');
      this.form.proStatus = this.form.proStatus.toString();
      this.proParent = true;
@@ -1164,9 +1159,6 @@
      // if(){
      //   this.proParent = true
      // }
      // 这个是干啥的
      // 按理来说此时只需要open为true就好了啊
      // 压根不理解,你就看我给你说的那个问题,这里面问题多的很
      getlist().then((response) => {
        if (response.code == 200) {
          this.loading = false;
@@ -1252,8 +1244,6 @@
            this.projectOptions.push(project);
          }
        });
        // 用的都是同一个dialog啊
        this.open = true;
        this.title = "体检项目信息维护";
      });
@@ -1290,134 +1280,43 @@
    /** 提交按钮 */
    submitForm() {
      this.noclick = true
      if (this.key == "N") {
        console.log('1111');
        // 这个是上面修改还是单行修改
        this.$refs["form"].validate((valid) => {
      this.noclick = true;
      this.$refs["form"].validate(valid => {
          if (valid) {
            if (this.form.proId != null) {
              if (this.form.tjStandardList != null) {
                this.form.tjStandardList.forEach((items) => {
                  if (items.tjSex === "男" || items.tjSex === "0") {
                    items.tjSex = "0";
                  } else if (items.tjSex === "女" || items.tjSex === "1") {
                    items.tjSex = "1";
                  } else {
                    items.tjSex = null;
                  }
                  if (items.tjType === "婴儿") {
                    items.tjType = 0;
                  }
                  if (items.tjType === "幼儿") {
                    items.tjType = 1;
                  }
                  if (items.tjType === "儿童") {
                    items.tjType = 2;
                  }
                  if (items.tjType === "少年") {
                    items.tjType = 3;
                  }
                  if (items.tjType === "青年") {
                    items.tjType = 4;
                  }
                  if (items.tjType === "中年") {
                    items.tjType = 5;
                  }
                  if (items.tjType === "老年") {
                    items.tjType = 6;
                  }
          const isUpdate = this.form.proId != null;
          // 处理性别和年龄组的转换
          if (this.form.tjStandardList) {
            this.form.tjStandardList.forEach(item => {
              item.tjSex = item.tjSex === "男" || item.tjSex === "0" ? "0" : (item.tjSex === "女" || item.tjSex === "1" ? "1" : null);
              item.tjType = {
                "婴儿": 0, "幼儿": 1, "儿童": 2, "少年": 3, "青年": 4, "中年": 5, "老年": 6
              }[item.tjType] || null;
                });
              }
              this.form.lisXmbm = this.form.lisXmbm;
              updateProject(this.form).then((response) => {
                this.$modal.msgSuccess("修改成功");
                if (this.proParent == true) {
                  console.log('进入了proParent == true')
                  this.getDeptTree();
                  this.cancel();
                } else {
                  console.log('进入了proParent == false')
                  this.cancel();
                  this.getList();
                }
              });
            } else {
              if (this.form.proParentId === 0) {
                this.form.tjStandardList = null;
              } else {
                this.form.consumablesList = null;
              }
              if (this.form.deptId === null || this.form.proParentId === null) {
                this.$message.error("请填写父项名称或科室名称");
                this.open = true;
              } else {
          // 设置 lisXmbm
                this.form.lisXmbm = this.form.lisXmbm;
                addProject(this.form).then((response) => {
                  this.$modal.msgSuccess("新增成功");
                  this.cancel();
                  this.getList();
                });
              }
            }
          }
        });
      } else if (this.key == "Y") {
          // 根据 key 值选择不同的操作流程
          if (this.key === "N") {
            this.processSubmission(isUpdate, false);
          } else if (this.key === "Y") {
        this.form.sfxmId = this.sfxmId;
        this.$refs["form"].validate((valid) => {
          if (valid) {
            console.log('222');
            if (this.form.proId != null) {
              console.log('22-11');
              if (this.form.tjStandardList != null) {
                this.form.tjStandardList.forEach((items) => {
                  if (items.tjSex === "男" || items.tjSex === "0") {
                    items.tjSex = "0";
                  } else if (items.tjSex === "女" || items.tjSex === "1") {
                    items.tjSex = "1";
                  } else {
                    items.tjSex = null;
            this.processSubmission(isUpdate, true);
                  }
                  if (items.tjType === "婴儿") {
                    items.tjType = 0;
                  }
                  if (items.tjType === "幼儿") {
                    items.tjType = 1;
                  }
                  if (items.tjType === "儿童") {
                    items.tjType = 2;
                  }
                  if (items.tjType === "少年") {
                    items.tjType = 3;
                  }
                  if (items.tjType === "青年") {
                    items.tjType = 4;
                  }
                  if (items.tjType === "中年") {
                    items.tjType = 5;
                  }
                  if (items.tjType === "老年") {
                    items.tjType = 6;
                  }
                });
              }
              this.form.lisXmbm = this.form.lisXmbm;
              updateProject(this.form).then((response) => {
                this.$modal.msgSuccess("修改成功");
                if (this.proParent == true) {
                  this.getDeptTree();
                  this.cancel();
                } else {
                  this.cancel();
                  this.getList();
                }
              });
            } else {
              console.log('22-22');
    },
    processSubmission(isUpdate, isY) {
      if (isUpdate) {
        updateProject(this.form).then(response => {
          this.$modal.msgSuccess("修改成功");
          this.handleSuccess(isY);
        });
      } else {
        // 新增逻辑
              if (this.form.proParentId === 0) {
                this.form.tjStandardList = null;
              } else {
@@ -1428,19 +1327,21 @@
                this.$message.error("请填写父项名称或科室名称");
                this.open = true;
              } else {
                this.form.lisXmbm = this.form.lisXmbm;
                addProject(this.form).then((response) => {
          addProject(this.form).then(response => {
                  this.$modal.msgSuccess("新增成功");
                  this.cancel();
                  this.getList();
            this.handleSuccess(isY);
                });
              }
            }
          }
        });
      }
    },
    handleSuccess(isY) {
      this.cancel();
      this.getList();
      if (this.proParent || isY) {
        this.getDeptTree();
      }
    },
    // 收费项目确认
    submit() {
      this.ChangeList.forEach((item) => {