| | |
| | | <!-- <el-tag v-if="hasMore" type="info">+{{ remaining }} more</el-tag> --> |
| | | </el-form-item> |
| | | </div> |
| | | <div |
| | | style=" |
| | | margin-bottom: 20px; |
| | | padding: 8px 12px; |
| | | background-color: #f0f9ff; |
| | | border-left: 4px solid #409eff; |
| | | " |
| | | > |
| | | <p |
| | | style=" |
| | | margin: 0; |
| | | color: #606266; |
| | | font-size: 13px; |
| | | line-height: 1.4; |
| | | " |
| | | > |
| | | <i |
| | | class="el-icon-info" |
| | | style="color: #409eff; margin-right: 6px" |
| | | ></i> |
| | | 针对同一疾病在多科室/病区下存在的情况,可选择性配置固定科室/病区 |
| | | </p> |
| | | </div> |
| | | <!-- 新增:疾病关联下的科室配置(单选) --> |
| | | <el-row :gutter="20" style="margin-top: 20px"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="关联科室" prop="diseaseDept"> |
| | | <el-select |
| | | v-model="diseaseDept" |
| | | style="width: 100%" |
| | | clearable |
| | | filterable |
| | | placeholder="请选择科室(可选)" |
| | | value-key="deptCode" |
| | | @change="handleDiseaseDeptChange" |
| | | > |
| | | <el-option |
| | | v-for="item in belongDepts" |
| | | :key="item.deptCode" |
| | | :label="item.deptName" |
| | | :value="item" |
| | | ></el-option> |
| | | </el-select> |
| | | <div v-if="diseaseDept" class="selected-info"> |
| | | 已选择: {{ diseaseDept.deptName }} ({{ |
| | | diseaseDept.deptCode |
| | | }}) |
| | | </div> |
| | | </el-form-item> |
| | | </el-col> |
| | | |
| | | <el-col :span="12"> |
| | | <el-form-item label="关联病区" prop="diseaseWard"> |
| | | <el-select |
| | | v-model="diseaseWard" |
| | | style="width: 100%" |
| | | clearable |
| | | filterable |
| | | placeholder="请选择病区(可选)" |
| | | value-key="districtCode" |
| | | @change="handleDiseaseWardChange" |
| | | > |
| | | <el-option |
| | | v-for="item in belongWards" |
| | | :key="item.districtCode" |
| | | :label="item.districtName" |
| | | :value="item" |
| | | ></el-option> |
| | | </el-select> |
| | | <div v-if="diseaseWard" class="selected-info"> |
| | | 已选择: {{ diseaseWard.districtName }} ({{ |
| | | diseaseWard.districtCode |
| | | }}) |
| | | </div> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | </el-row> |
| | | <el-row v-if="form.appltype == 4"> |
| | | <el-col :span="20" |
| | |
| | | placeholder="请点击右侧选择" |
| | | /> |
| | | <el-button |
| | | v-if=" |
| | | (form.templateid && form.sendState == 1) || |
| | | !form.templateid |
| | | " |
| | | v-if="form.templateid" |
| | | style="margin-left: 10px" |
| | | type="primary" |
| | | icon="el-icon-edit" |
| | |
| | | v-if="item.scriptType == 1" |
| | | > |
| | | <div class="dev-text"> |
| | | {{ item.sort }}、[单选]<span>{{ item.scriptContent }}</span> |
| | | {{ item.sort }}. [单选]<span>{{ item.scriptContent }}</span> |
| | | </div> |
| | | <div class="dev-xx"> |
| | | <el-radio-group v-model="item.remark"> |
| | |
| | | v-if="item.scriptType == 2" |
| | | > |
| | | <div class="dev-text"> |
| | | {{ item.sort }}、[多选]<span>{{ item.scriptContent }}</span> |
| | | {{ item.sort }}. [多选]<span>{{ item.scriptContent }}</span> |
| | | </div> |
| | | <div class="dev-xx"> |
| | | <el-checkbox-group v-model="qremark"> |
| | |
| | | v-if="item.scriptType == 4" |
| | | > |
| | | <div class="dev-text"> |
| | | {{ item.sort }}、[问答]<span>{{ item.scriptContent }}</span> |
| | | {{ item.sort }}. [问答]<span>{{ item.scriptContent }}</span> |
| | | </div> |
| | | <div class="dev-xx"> |
| | | <el-input |
| | |
| | | donorchargeList: [], |
| | | baseoperaList: [], |
| | | selectedOrder: [], |
| | | diseaseDept: null, // 疾病关联下的科室(存储整个对象) |
| | | diseaseWard: null, // 疾病关联下的病区(存储整个对象) |
| | | |
| | | usable: [ |
| | | { value: "0", label: "可用" }, |
| | |
| | | } else if ( |
| | | this.form.serviceType == 2 || |
| | | this.form.serviceType == 18 || |
| | | this.form.serviceType == 19 || |
| | | this.form.serviceType == 3 || |
| | | this.form.serviceType == 16 || |
| | | this.form.serviceType == 4 |
| | |
| | | }, |
| | | // 保存 |
| | | submitForm(type) { |
| | | // 防止重复提交 |
| | | if (this.submitLoading) { |
| | | return; |
| | | } |
| | | // 第二步:开启加载状态,禁用按钮 |
| | | |
| | | // 开启加载状态 |
| | | this.submitLoading = true; |
| | | |
| | | try { |
| | | if (this.templateor && type) this.templateor = false; |
| | | if (this.time4 && this.form.sendType == 3) |
| | | // 模板相关处理 |
| | | if (this.templateor && type) { |
| | | this.templateor = false; |
| | | } |
| | | |
| | | // 时间处理 |
| | | if (this.time4 && this.form.sendType == 3) { |
| | | this.form.showTimeMorn = this.time4; |
| | | } |
| | | this.form.sendTimeslot = [ |
| | | { |
| | | begantime: this.time4, |
| | |
| | | xh: 1, |
| | | }, |
| | | ]; |
| | | |
| | | // 根据应用类型清理字段 |
| | | if (this.form.appltype == 1) { |
| | | this.leavehospitaldistrictcodes = []; |
| | | this.operationcodes = []; |
| | |
| | | this.illnesscodes = []; |
| | | this.leavehospitaldistrictcodes = []; |
| | | } |
| | | |
| | | // ===== 表单校验 ===== |
| | | |
| | | // 1. 服务类型校验 |
| | | if (this.checkList) { |
| | | this.form.preachform = this.checkList.join(",") || []; |
| | | this.form.preachformList = this.selectedOrder || []; |
| | | } else { |
| | | this.$modal.msgError("请选择服务类型"); |
| | | this.submitLoading = false; |
| | | |
| | | return; |
| | | } |
| | | |
| | | if ( |
| | | // 2. 疾病关联科室或病区校验 |
| | | if (this.form.appltype == 3) { |
| | | const hasDept = this.diseaseDept?.deptCode; |
| | | const hasWard = this.diseaseWard?.districtCode; |
| | | |
| | | if (!hasDept && !hasWard) { |
| | | this.$modal.msgError("当前疾病需关联科室或病区"); |
| | | this.submitLoading = false; |
| | | return; |
| | | } |
| | | } |
| | | |
| | | // 3. 任务关联条件校验 |
| | | const hasCondition = |
| | | this.deptcodesWards[0] || |
| | | this.leavehospitaldistrictcodes[0] || |
| | | this.diagglist[0] || |
| | | this.operationcodes[0] || |
| | | this.form.longTask == 2 || |
| | | this.serviceType == 3 |
| | | ) { |
| | | } else { |
| | | this.serviceType == 3; |
| | | |
| | | if (!hasCondition) { |
| | | this.$modal.msgError("请选择任务关联条件"); |
| | | this.submitLoading = false; |
| | | |
| | | return; |
| | | } |
| | | // if (!this.form.patTaskRelevances[0] && !this.form.longTask) { |
| | | // this.$modal.msgError("请选择病人"); |
| | | // return; |
| | | // } |
| | | |
| | | // 4. 模板校验 |
| | | if (!this.form.templatename && !this.templateor) { |
| | | this.$modal.msgError("未选择模板"); |
| | | this.submitLoading = false; |
| | | |
| | | return; |
| | | } |
| | | |
| | | if ( |
| | | // 5. 时间信息校验 |
| | | const isValidTime = |
| | | (this.form.sendType == 1 && this.time1) || |
| | | this.form.sendType == 2 |
| | | ) { |
| | | } else if ( |
| | | this.form.sendType == 2 || |
| | | (this.form.sendType == 3 && this.time4) || |
| | | this.form.longTask |
| | | ) { |
| | | } else { |
| | | this.submitLoading = false; |
| | | this.form.longTask; |
| | | |
| | | return this.$modal.msgError("时间信息缺失"); |
| | | if (!isValidTime) { |
| | | this.submitLoading = false; |
| | | this.$modal.msgError("时间信息缺失"); |
| | | return; |
| | | } |
| | | |
| | | // ===== 数据处理 ===== |
| | | |
| | | // 过滤文本参数 |
| | | const filteredArray = this.variableList.filter( |
| | | (item) => |
| | | item.name !== "姓名" && item.name !== "电话" && item.name !== "地址" |
| | | ); |
| | | this.form.textParam = this.convertFormat2ToFormat1(filteredArray); |
| | | |
| | | // 设置操作类型 |
| | | if (this.form.taskid) { |
| | | this.form.isoperation = 2; |
| | | } else { |
| | | this.form.isoperation = 1; |
| | | } |
| | | |
| | | // 设置类型 |
| | | if (!this.form.type) { |
| | | this.form.type = this.$route.query.type; |
| | | } |
| | | |
| | | // 疾病关联的科室/病区 |
| | | if (this.form.appltype == 3) { |
| | | if (this.diseaseDept) { |
| | | this.form.deptcode = this.diseaseDept.deptCode; |
| | | this.form.deptname = this.diseaseDept.deptName; |
| | | } |
| | | |
| | | if (this.diseaseWard) { |
| | | this.form.leavehospitaldistrictcode = this.diseaseWard.districtCode; |
| | | this.form.leavehospitaldistrictname = this.diseaseWard.districtName; |
| | | } |
| | | } |
| | | |
| | | // 组装提交数据 |
| | | this.form.serviceType = this.serviceType; |
| | | this.form.deptcode = this.deptcodesWards.join(","); |
| | | this.form.leavehospitaldistrictcode = |
| | |
| | | this.form.icd10name = this.diagglist |
| | | .map((item) => item.icdname) |
| | | .join(","); |
| | | Editsingletask(this.form).then((res) => { |
| | | if (res.code == 200) { |
| | | if (this.form.taskid) { |
| | | this.$modal.msgSuccess("修改成功"); |
| | | |
| | | // ===== 提交接口 ===== |
| | | Editsingletask(this.form) |
| | | .then((res) => { |
| | | if (res.code == 200) { |
| | | // ✅ 成功 |
| | | if (this.form.taskid) { |
| | | this.$modal.msgSuccess("修改成功"); |
| | | } else { |
| | | this.$modal.msgSuccess("新增成功"); |
| | | } |
| | | this.submitLoading = false; |
| | | this.$router.push({ |
| | | path: "/followvisit/tasklist", |
| | | query: { tasktopic: this.form.serviceType }, |
| | | }); |
| | | } else { |
| | | this.$modal.msgSuccess("新增成功"); |
| | | // ✅ 接口返回错误码 |
| | | this.$modal.msgError(res.msg || "操作失败"); |
| | | this.submitLoading = false; |
| | | } |
| | | }) |
| | | .catch((error) => { |
| | | // ✅ 捕获接口请求异常 |
| | | console.error("提交失败:", error); |
| | | this.$modal.msgError(error.message || "网络异常,请稍后重试"); |
| | | this.submitLoading = false; |
| | | this.$router.push({ |
| | | path: "/followvisit/tasklist", |
| | | query: { tasktopic: this.form.serviceType }, |
| | | }); |
| | | } |
| | | }); |
| | | }); |
| | | } catch (error) { |
| | | // ✅ 捕获同步代码异常 |
| | | console.error("表单提交异常:", error); |
| | | this.$modal.msgError(error.message || "表单提交异常"); |
| | | this.submitLoading = false; |
| | | } finally { |
| | | // 第四步:无论成功或失败,最终都关闭加载状态 |
| | | } |
| | | }, |
| | | handleDiseaseDeptChange(dept) { |
| | | console.log(dept, "dept"); |
| | | |
| | | // 当选择科室时,存储整个科室对象 |
| | | this.diseaseDept = dept; |
| | | }, |
| | | |
| | | handleDiseaseWardChange(ward) { |
| | | // 当选择病区时,存储整个病区对象 |
| | | this.diseaseWard = ward; |
| | | }, |
| | | // ----------------------表格子组件事件 |
| | | |
| | | // 选择预览 |
| | |
| | | let filteredArray = ""; |
| | | if (res.code == 200) { |
| | | this.form = res.data; |
| | | this.diseaseDept = { |
| | | deptCode: this.form.deptcode, |
| | | deptName: this.form.deptname, |
| | | }; |
| | | this.diseaseWard = { |
| | | districtCode: this.form.leavehospitaldistrictcode, |
| | | districtName: this.form.leavehospitaldistrictname, |
| | | }; |
| | | console.log(this.diseaseWard, this.diseaseDept); |
| | | |
| | | this.form.serviceType = this.serviceType; |
| | | this.form.patTaskRelevances = this.form.patTaskRelevances |
| | | ? this.form.patTaskRelevances |
| | |
| | | let arr = res.rows; |
| | | arr.forEach((item) => { |
| | | getillnesslist({ |
| | | icdcode: item.icd10code, |
| | | icdname: item.icd10name, |
| | | }).then((res) => { |
| | | item.icdname = res.rows[0].icdname; |
| | | this.diagglist.push(item); |