1
wwl
2025-03-05 cb1f69717eed3b6a61b6c61a8934bac752782b2d
src/views/hosp/project/index.vue
@@ -9,8 +9,8 @@
        <div class="scrollable-container">
          <div class="content">
            <el-tree :data="deptOptions" :props="defaultProps" :expand-on-click-node="false"
              :filter-node-method="filterNode" ref="tree" node-key="id" :default-expanded-keys="treeId"
              highlight-current @node-click="handleNodeClick" :render-content="renderContent" />
              :filter-node-method="filterNode" ref="tree" node-key="id" :default-expanded-keys="treeId"
              highlight-current @node-click="handleNodeClick" :render-content="renderContent"  v-loading="loadings"/>
          </div>
        </div>
      </el-col>
@@ -244,14 +244,13 @@
        </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" />
        </el-form-item>
        <el-form-item label="排序" prop="xh">
          <el-input v-model="form.xh" placeholder="请输入备注" style="width: 200px" />
        </el-form-item>
      </el-form>
      <el-button style="margin-left: 40px" type="primary" plain size="mini" icon="el-icon-plus"
@@ -419,6 +418,7 @@
import IconSelect from "@/components/IconSelect";
import { listConsumables } from "@/api/hosp/consumables";
import { Message } from "element-ui";
import cnchar from 'cnchar';
import {
  listSfxm,
  getSfxm,
@@ -476,6 +476,7 @@
      ChangeList: [],
      // 遮罩层
      loading: true,
      loadings: false,
      key: "",
      // 选中数组
      ids: [],
@@ -550,6 +551,7 @@
        sfzhfy: "Y",
        hisdj: "",
        sl: "",
        xh:"0",
        proStatus: "0",
        proName: "",
        proPrice: "",
@@ -667,6 +669,8 @@
      };
      getAllChildListById(data).then((response) => {
        this.projectList = response.data.list;
        // console.log("进来了列表并且获取到了值", this.projectList);
        this.loading = false;
      });
    },
@@ -885,7 +889,6 @@
      deptTree111().then((response) => {
        this.deptOptions = response.data;
        this.treeId.push(this.treeDate.id);
        console.log(this.treeId)
      });
    },
@@ -920,14 +923,37 @@
      return data.xmmc.indexOf(value) !== -1;
    },
    // 筛选节点
    // filterNode(value, data) {
    //   console.log(value, data)
    //   if (!value) return true;
    //   return data.label.indexOf(value) !== -1;
    // },
    filterNode(value, data) {
      if (!value) return true;
      return data.label.indexOf(value) !== -1;
        if (!value) return true;
        if (data.label.indexOf(value) !== -1) return true;
        // 匹配小写
        let arr = data.label.spell('low', 'array');
        let spell = arr.join('');
        let lengths = [0];
        for (var i = 0; i < arr.length - 1; i++) {
            lengths.push(lengths[i] + arr[i].length);
        };
        //判断label完整拼音 中 输入值的 index 是不是等于某个汉字第一个拼音字母的index值
        if(lengths.indexOf(spell.indexOf(value)) !== -1) return true
        // 大写
        let arrUp = data.label.spell('up', 'array');
        let spellUp = arrUp.join('');
        let lengthsUp = [0];
        for (var i = 0; i < arrUp.length - 1; i++) {
            lengthsUp.push(lengthsUp[i] + arrUp[i].length);
        };
        return lengthsUp.indexOf(spellUp.indexOf(value)) !== -1;
    },
    // 节点单击事件
    handleNodeClick(date) {
      console.log("调用了handleNodeClick ", date.id, this.id)
      // console.log("调用了handleNodeClick ", date.id, this.id)
      this.treeDate = date;
      if (date.qf == "0") {
        this.xiugais = true;
@@ -988,9 +1014,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;
      });
    },
@@ -1006,6 +1030,7 @@
        proEngName: null,
        proPrice: "0.00",
        proRemark: null,
        xh:"0",
        createBy: null,
        createTime: null,
        updateBy: null,
@@ -1155,7 +1180,6 @@
    },
    handleUpdate1() {
      this.form = this.xiugaiList;
      console.log('调用了handleUpdate1');
      this.form.proStatus = this.form.proStatus.toString();
      this.proParent = true;
@@ -1164,9 +1188,6 @@
      // if(){
      //   this.proParent = true
      // }
      // 这个是干啥的
      // 按理来说此时只需要open为true就好了啊
      // 压根不理解,你就看我给你说的那个问题,这里面问题多的很
      getlist().then((response) => {
        if (response.code == 200) {
          this.loading = false;
@@ -1252,8 +1273,6 @@
            this.projectOptions.push(project);
          }
        });
        // 用的都是同一个dialog啊
        this.open = true;
        this.title = "体检项目信息维护";
      });
@@ -1290,157 +1309,68 @@
    /** 提交按钮 */
    submitForm() {
      this.noclick = true
      if (this.key == "N") {
        console.log('1111');
      this.noclick = true;
      this.$refs["form"].validate(valid => {
        if (valid) {
          const isUpdate = this.form.proId != null;
        // 这个是上面修改还是单行修改
        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;
                  }
                });
              }
              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 {
                this.form.lisXmbm = this.form.lisXmbm;
                addProject(this.form).then((response) => {
                  this.$modal.msgSuccess("新增成功");
                  this.cancel();
                  this.getList();
                });
              }
            }
          // 处理性别和年龄组的转换
          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;
            });
          }
        });
      } 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;
                  }
                  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');
          // 设置 lisXmbm
          this.form.lisXmbm = this.form.lisXmbm;
              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 {
                this.form.lisXmbm = this.form.lisXmbm;
                addProject(this.form).then((response) => {
                  this.$modal.msgSuccess("新增成功");
                  this.cancel();
                  this.getList();
                });
              }
            }
          // 根据 key 值选择不同的操作流程
          if (this.key === "N") {
            this.processSubmission(isUpdate, false);
          } else if (this.key === "Y") {
            this.form.sfxmId = this.sfxmId;
            this.processSubmission(isUpdate, true);
          }
        }
      });
    },
    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 {
          this.form.consumablesList = null;
        }
        if (this.form.deptId === null || this.form.proParentId === null) {
          this.$message.error("请填写父项名称或科室名称");
          this.open = true;
        } else {
          addProject(this.form).then(response => {
            this.$modal.msgSuccess("新增成功");
            this.handleSuccess(isY);
          });
        }
      }
    },
    handleSuccess(isY) {
      this.cancel();
      this.getList();
      if (this.proParent || isY) {
        this.getDeptTree();
      }
    },
    // 收费项目确认
    submit() {
      this.ChangeList.forEach((item) => {