WXL
2024-12-11 9a1a82e442721ce04a743381b278482487d6a60b
src/views/knowledge/questionnaire/compilequer/index.vue
@@ -259,11 +259,11 @@
                  filterable
                  placeholder="请选择科室"
                >
                  <el-option
                <el-option
                    class="ruleFormaa"
                    v-for="item in belongDepts"
                    v-for="item in flatArray"
                    :key="item.deptCode"
                    :label="item.deptName"
                    :label="item.label"
                    :value="item.deptCode"
                  >
                  </el-option>
@@ -282,12 +282,12 @@
                  filterable
                  placeholder="请选择病区"
                >
                  <el-option
                <el-option
                    class="ruleFormaa"
                    v-for="item in belongWards"
                    :key="item.districtCode"
                    :label="item.districtName"
                    :value="item.districtCode"
                    v-for="item in flatArray"
                    :key="item.deptCode"
                    :label="item.label"
                    :value="item.deptCode"
                  >
                  </el-option>
                </el-select> </el-form-item
@@ -435,7 +435,6 @@
                  align="center"
                  key="nextScriptno"
                  prop="nextScriptno"
                  :show-overflow-tooltip="true"
                >
                  <template slot-scope="scope">
                    <span>{{
@@ -1263,6 +1262,8 @@
} from "@/api/AiCentre/index";
import OptionalForm from "@/components/OptionalForm"; //正则组件
import { getToken } from "@/utils/auth";
import { deptTreeSelect } from "@/api/system/user";
export default {
  name: "Questionnaireinfo",
@@ -1383,6 +1384,7 @@
      illnessVisible: false, //指标疾病弹框
      Operateit: true,
      deptOptions: [],
      flatArray:[],
      optionsillness: [],
      delScriptVOList: [],
      illnesslistapi: [],
@@ -1435,6 +1437,7 @@
        this.ruleForm.svyLibTemplateTagList.filter(
          (item) => item.isoperation != 3
        );
      if (this.ruleForm.suitway)
        this.ruleForm.suitway = this.ruleForm.suitway.split(",");
      this.delScriptVOList = [];
      this.tempDetpRelevanceslistform = [];
@@ -1445,6 +1448,7 @@
  created() {
    this.getissueinfo();
    this.gettabList();
    this.getDeptTree();
    this.mode = store.getters.Askmode;
    this.languagelist = store.getters.languagelist;
    this.usable = store.getters.usable;
@@ -1455,7 +1459,6 @@
    this.appraiselist = store.getters.appraiselist;
    this.belongWards = store.getters.belongWards;
    this.belongDepts = store.getters.belongDepts;
    // this.test();
  },
@@ -1517,7 +1520,9 @@
          this.dynamicTags = this.ruleForm.svyLibTemplateTagList.map(
            this.processElement
          );
          this.ruleForm.suitway = this.ruleForm.suitway.split(",");
          console.log(this.dynamicTags, "this.dynamicTags");
          if (this.ruleForm.suitway)
            this.ruleForm.suitway = this.ruleForm.suitway.split(",");
        });
        getillness({ outid: this.id, type: 5 }).then((res) => {
          this.illnesslist = res.rows;
@@ -1551,6 +1556,33 @@
        }
      });
    },
    // 获取科室树
    getDeptTree() {
      // 科室列表
      deptTreeSelect().then((response) => {
        this.deptOptions = response.data;
        this.flatArray = this.flattenArray(response.data);
      });
    },
    flattenArray(multiArray) {
      let result = [];
      // 递归函数,用于将多级数组转换为一维数组,只包含最底层的元素
      function flatten(element) {
        // 如果当前元素有子元素,继续递归
        if (element.children && element.children.length > 0) {
          element.children.forEach((child) => flatten(child));
        } else {
          // 克隆元素以避免修改原始数据
          let item = JSON.parse(JSON.stringify(element));
          result.push(item); // 将最底层的元素添加到结果数组
        }
      }
      // 从顶层元素开始递归
      multiArray.forEach((element) => flatten(element));
      return result; // 返回只包含最底层元素的一维数组
    },
    submitForm(formName) {
      this.$modal.loading("正在修正保存数据,请稍候...");
      if (Array.isArray(this.ruleForm.suitway)) {
@@ -1559,6 +1591,24 @@
      if (!this.ruleForm.categoryid) {
        this.ruleForm.categoryid = -1;
      }
      // 题目保存处理
        //   提交
        this.ruleForm.svyTemplateLibScripts.forEach((res) => {
        if (!res.isoperation) {
          res.isoperation = 2;
        }
        res.ivrLibaScriptTargetoptionList =
          res.svyLibTemplateTargetoptions.map((item) => {
            if (!item.isoperation) {
              item.isoperation = 2;
              item.templateID = this.ruleForm.id;
            }
            return item;
          });
      });
      this.delScriptVOList.forEach((item)=>{
          this.ruleForm.svyTemplateLibScripts.push(item)
        })
      if (this.id) {
        this.ruleForm.isoperation = 2;
        this.ruleForm.tempDetpRelevances = null;
@@ -1567,7 +1617,8 @@
          this.confirmillness();
          this.putbelongDepts();
          this.$modal.closeLoading();
          this.$router.go(-1);
          // this.$router.go(-1);
          window.location.reload();
        });
      } else {
        this.ruleForm.isoperation = 1;
@@ -1586,7 +1637,6 @@
    },
    // 科室/院区处理
    Departmenttreatment() {
      this.tempDetpRelevanceslist.forEach((item) => {
        console.log(item);
        let result = this.deptlist.some((obj) => obj.deptCode == item);
@@ -1615,7 +1665,6 @@
        }
      });
      // return
      setTimeout(() => {
        this.submitForm();
@@ -1639,12 +1688,12 @@
      let result = this.hosplist
        .filter((item) => item.deptCode == row)
        .map((item) => item.id);
        if (result.length) {
          depthospgetsondel(result).then((res) => {
            if (res.code) {
            }
          });
        }
      if (result.length) {
        depthospgetsondel(result).then((res) => {
          if (res.code) {
          }
        });
      }
    },
    // 下一步
    nextstep() {
@@ -1865,6 +1914,12 @@
    },
    // 保存科室/病区
    putbelongDepts(id) {
      this.tempDetpRelevanceslistform.forEach(item=>{
        if (!item.tempid) item.tempid=id;
      })
      this.tempbelongWardsform.forEach(item=>{
        if (!item.tempid) item.tempid=id;
      })
      if (this.tempDetpRelevanceslistform.length > 0) {
        depthospgetson(this.tempDetpRelevanceslistform).then((res) => {
          if (res.code == 200) {