WXL
2024-10-12 9da8c98e3a623e6758ee45e2b74b78837398c650
src/views/repositoryai/templateku/configurat/index.vue
@@ -267,7 +267,7 @@
                >
                  <el-option
                    class="ruleFormaa"
                    v-for="item in belongDepts"
                    v-for="item in flatArray"
                    :key="item.deptCode"
                    :label="item.deptName"
                    :value="item.deptCode"
@@ -290,7 +290,7 @@
                >
                  <el-option
                    class="ruleFormaa"
                    v-for="item in belongWards"
                    v-for="item in flatArray"
                    :key="item.districtCode"
                    :label="item.districtName"
                    :value="item.districtCode"
@@ -299,24 +299,7 @@
                </el-select> </el-form-item
            ></el-col>
          </el-row>
          <el-row :gutter="20">
            <el-col :span="12">
              <el-form-item label="随访前处理" prop="name">
                <el-input
                  type="textarea"
                  show-word-limit
                  v-model="ruleForm.revisitBefore"
                ></el-input></el-form-item
            ></el-col>
            <el-col :span="12">
              <el-form-item label="随访后处理" prop="region">
                <el-input
                  type="textarea"
                  show-word-limit
                  v-model="ruleForm.revisitAfter"
                ></el-input> </el-form-item
            ></el-col>
          </el-row>
          <el-row :gutter="20">
            <el-col :span="8">
              <el-form-item label="静默时间(秒)" prop="name">
@@ -1378,13 +1361,15 @@
  getFollowuplist,
  deltargetillness,
  getillnesslist,
  depthospgetsonlist ,
  depthospgetson,
  depthospgetsonlist,
  illnesslistget,
  getillness,
  getgenerallist,
} from "@/api/AiCentre/index";
import OptionalForm from "@/components/OptionalForm"; //正则组件
import { getToken } from "@/utils/auth";
import { deptTreeSelect } from "@/api/system/user";
export default {
  name: "Tpuconfigurat",
@@ -1480,6 +1465,7 @@
        { variatename: "病情", variate: "${illness}", default: 1 },
      ],
      deptList: [],
      flatArray:[],
      props: { multiple: true, value: "deptId", label: "deptName" },
      variablelist: [
@@ -1519,7 +1505,7 @@
      this.gettabList();
      this.getvFollowup();
      this.auxiliary();
    }else{
    } else {
      this.tempDetpRelevanceslistform = [];
      this.tempbelongWardsform = [];
    }
@@ -1530,6 +1516,7 @@
    this.gettabList();
    this.getvFollowup();
    this.auxiliary();
    this.getDeptTree();
    this.mode = store.getters.mode;
    this.usable = store.getters.usable;
    this.required = store.getters.required;
@@ -1569,11 +1556,34 @@
    RoutingDataProcessing() {
      this.id = this.$route.query.id;
      this.task = this.$route.query.task;
    },
    // 获取科室树
    getDeptTree() {
      // 科室列表
      deptTreeSelect().then((response) => {
        this.deptOptions = response.data;
        this.flatArray = this.flattenArray(response.data);
        console.log(this.flatArray,'扩展数据');
      });
    },
    flattenArray(multiArray) {
      let result = [];
      // console.log(this.task, "task");
      // if (this.task) {
      //   this.id = this.$route.query.id;
      // }
      // 递归函数,用于将多级数组转换为一维数组
      function flatten(element, parentId) {
        // 克隆元素以避免修改原始数据
        let item = JSON.parse(JSON.stringify(element));
        if (parentId !== undefined) {
          item.parentId = parentId; // 使用字符串或数字作为键
        }
        result.push(item); // 将元素添加到结果数组
        if (element.children && element.children.length > 0) {
          element.children.forEach((child) => flatten(child, element.id)); // 递归处理子元素
        }
      }
      multiArray.forEach((element) => flatten(element, null)); // 从顶层元素开始递归
      return result; // 返回一维数组
    },
    // 获取表单数据
    getvFollowup() {
@@ -1682,9 +1692,12 @@
        this.ruleForm.assortid = -1;
      }
      this.ruleForm.labelInfo = JSON.stringify(this.dynamicTags);
      if (Array.isArray(this.ruleForm.suitway)) this.ruleForm.suitway = this.ruleForm.suitway.join(",");
      if (Array.isArray(this.ruleForm.campus))this.ruleForm.campus = this.ruleForm.campus.join(",");
      if (Array.isArray(this.ruleForm.submoduleID))this.ruleForm.submoduleID = this.ruleForm.submoduleID.join(",");
      if (Array.isArray(this.ruleForm.suitway))
        this.ruleForm.suitway = this.ruleForm.suitway.join(",");
      if (Array.isArray(this.ruleForm.campus))
        this.ruleForm.campus = this.ruleForm.campus.join(",");
      if (Array.isArray(this.ruleForm.submoduleID))
        this.ruleForm.submoduleID = this.ruleForm.submoduleID.join(",");
      //   提交
      this.ruleForm.ivrLibaTemplateScriptVOList.forEach((res) => {
@@ -1768,8 +1781,8 @@
      }, 1000);
      // this.submitForm();
    },
     // 保存科室/病区
     putbelongDepts(id) {
    // 保存科室/病区
    putbelongDepts(id) {
      if (this.tempDetpRelevanceslistform.length > 0) {
        depthospgetson(this.tempDetpRelevanceslistform).then((res) => {
          if (res.code == 200) {
@@ -1888,6 +1901,13 @@
              tagname: tagname,
              isoperation: 1,
            };
          }
          const exists = this.dynamicTags.some(
            (department) => department.tagname === tagname
          );
          if (exists) {
            this.$modal.msgError("标签重复");
            return;
          }
          this.ruleForm.ivrLibaTemplateTagList.push(tagvalue);
          this.dynamicTags.push(tagvalue);
@@ -2056,8 +2076,8 @@
    resetForm(formName) {
      this.$refs[formName].resetFields();
    },
  // 科室删除触发
  removetag(row) {
    // 科室删除触发
    removetag(row) {
      let result = this.deptlist
        .filter((item) => item.deptCode == row)
        .map((item) => item.id);
@@ -2074,12 +2094,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) {
          }
        });
      }
    },
    // 预览---------------
    preview() {
@@ -2093,7 +2113,7 @@
        .confirm("即将前往模板测试页面,请确认模板数据已保存。")
        .then((res) => {
          this.$router.push({
            path: "/knowledge/tpuconfigurat/measurement",
            path: "/knowledge/templateku/configurat/measurement",
            query: { id: this.id, name: this.ruleForm.templateName },
          });
        })