| | |
| | | > |
| | | <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> |
| | |
| | | > |
| | | <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 |
| | |
| | | } from "@/api/AiCentre/index"; |
| | | import OptionalForm from "@/components/OptionalForm"; //正则组件 |
| | | import { getToken } from "@/utils/auth"; |
| | | import { deptTreeSelect } from "@/api/system/user"; |
| | | |
| | | |
| | | export default { |
| | | name: "Questionnaireinfo", |
| | |
| | | illnessVisible: false, //指标疾病弹框 |
| | | Operateit: true, |
| | | deptOptions: [], |
| | | flatArray:[], |
| | | optionsillness: [], |
| | | delScriptVOList: [], |
| | | illnesslistapi: [], |
| | |
| | | created() { |
| | | this.getissueinfo(); |
| | | this.gettabList(); |
| | | this.getDeptTree(); |
| | | this.mode = store.getters.Askmode; |
| | | this.languagelist = store.getters.languagelist; |
| | | this.usable = store.getters.usable; |
| | |
| | | } |
| | | }); |
| | | }, |
| | | // 获取科室树 |
| | | 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)) { |