diff --git a/src/views/system/ManageNodeInformation/index.js b/src/views/system/ManageNodeInformation/index.js new file mode 100644 index 0000000..0d6a4dd --- /dev/null +++ b/src/views/system/ManageNodeInformation/index.js @@ -0,0 +1,844 @@ +import wangeditor from "../components/wangEditor.vue"; +import question from "../components/question.vue"; +import message from "../components/message.vue"; +import scripts from "../components/script.vue"; +import propaganda from "../components/propaganda.vue"; +import officialAccount from "../components/officialAccount.vue"; +import miniProgram from "../components/miniProgram.vue"; +import { getAgencytype } from "@/api/system/agency"; +import { + selectTaskTypeList, + taskPartitionList, + taskStatusDictList, + specialDiseaseNode, + triggerCondition, + selectSpecialDisease, + updateRouteCheckStatus, + list, + triggerConditionList, + getList, +} from "@/api/system/specialDiseaseNode"; +import Cookies from "js-cookie"; + +export default { + components: { + wangeditor, + question, + propaganda, + message, + scripts, + officialAccount, + miniProgram, + }, + name: "specialDiseaseNode", + data() { + return { + value:1, + ConditionValue: [], + dictDataType: "", + openlist: { + suitRange: "", + routeId: "", + triggerConditionList: [], + }, + open: false, + show3: false, + activeNames: ["1"], + routeform: { + routeCheckStatus: null, + routeCheckRemark: "", + }, + optionslist: [], + // 包含 + optionstriggerConditionOperator: [], + optionslistS: [], + optionslistSname: [], + // 诊断 + optionsname: [], + routeName: "", + updata: [], + updatalists: [], + updatalist: [], + // triggerConditionList: [{}], + form: { + specialDiseaseNodeId: "", + nodeContent: "", + templateId: "", + templateName: "", + taskType: "", + taskTypeName: "", + taskSubdivision: "", + taskSubdivisionName: "", + taskStatus: "", + secondClassifyDescribe: "", + executionTime: "", + appletPushSign: "0", + officialPushSign: "0", + messagePushSign: "0", + taskSubdivisiontemplateType: "", + }, + itemindex: 0, + listindex: 0, + totalNumber: 0, + agreeNumber: 0, + value: "", + input: "", + //任务类型 + selectTaskTypeList: [], + //任务状态 + taskStatusDictList: [], + //任务细分 + taskPartitionList: [], + routeId: "", + options: [], + lists: [], + dialogVisible: false, + parentDictCodelist: [], + parentDictCode: "", + itemlist: { + specialDiseaseRouteId: "", + // suitRange: "", + routeName: "", + specialDiseaseNodeList: [], + }, + updataname: "", + rules: { + routeCheckStatus: [ + { required: true, message: "请选择节点审核状态", trigger: "change" }, + ], + }, + }; + }, + created() { + if (this.$route.query) { + this.$set(this.form, "specialDiseaseNodeId", this.$route.query.id); + this.$set(this.openlist, "suitRange", this.$route.query.suitRange); + this.openlist.routeId = this.$route.query.id; + } + this.taskinfo(); + this.infolistname(); + + this.infolists(); + this.infolistoptionslistS(); + this.infolistMESSAGE(); + this.infolistword(); + this.optiononditionOperator(); + this.optiononditionOperators(); + }, + beforeDestroy() {}, + watch: { + "form.phoneMessageRemind": { + handler(newValue, oldValue) { + if (newValue == "NOT_SEND_MESSAGE") { + this.form.phoneMessageTemplateId = ""; + this.form.phoneMessageTemplateName = ""; + } + }, + deep: true, + }, + }, + mounted() { + // this.form = this.lists[0].list[0]; + }, + methods: { + // 短信提醒 + infolistword() { + var dictType = "text_message_remind"; + getAgencytype(dictType).then((res) => { + this.optionslist = res.data; + // this.taskinfo(); + }); + }, + + // 重播次数 + infolistMESSAGE() { + var dictType = "redial_times"; + getAgencytype(dictType).then((res) => { + this.optionslistSname = res.data; + this.taskinfo(); + }); + }, + // 弹框确定 + upload() { + const loading = this.$loading({ + lock: true, + text: "Loading", + spinner: "el-icon-loading", + background: "rgba(0, 0, 0, 0.7)", + }); + this.openlist.triggerConditionList.forEach((e) => { + e.routeId = this.$route.query.id; + e.routeName = this.$route.query.routeName; + }); + + loading.close(); + // return; + triggerCondition(this.openlist).then((res) => { + if (res.code == 200) { + this.$notify({ + type: "success", + title: "提示", + message: "修改触发条件成功", + }); + + this.routeName = res.data; + Cookies.remove("routeName"); + + Cookies.set("routeName", this.routeName); + // this.$router.go(0); + // window.location.reload(); + } + this.infolist(); + // this.handlelist(); + this.openfalse(); + }); + }, + // 关闭弹框 + openfalse() { + this.openlist.triggerConditionList = [ + { + routeId: "", + routeName: "", + triggerConditionName: "", + triggerConditionOperator: "", + triggerConditionValue: "", + + triggerConditionOperatorName: "", + dictDataType: "STRING", + + triggerLogic: "AND", + triggerLogicName: "", + }, + ]; + this.open = false; + this.resetForm("openlist"); + }, + // 批量新增添加属性 + addtriggerCondition() { + this.idd++; + var obj = { + routeId: "", + routeName: "", + triggerConditionName: "", + triggerConditionOperator: "", + triggerConditionValue: "", + + triggerConditionOperatorName: "", + dictDataType: "STRING", + triggerLogic: "AND", + triggerLogicName: "", + }; + + if (this.openlist.triggerConditionList.length == 3) { + this.$message.error("至多仅支持两种属性"); + } else { + this.openlist.triggerConditionList.push(obj); + } + }, + // 删除属性 + delitemlistname(index, item) { + this.openlist.triggerConditionList.splice(index, 1); + }, + //取消 + handleClose() { + this.dialogVisible = false; + this.routeform = { + routeCheckStatus: "", + routeCheckRemark: "", + }; + this.resetForm("routeform"); + }, + //审核 + auditing() { + this.$refs["routeform"].validate((valid) => { + if (valid) { + const loading = this.$loading({ + lock: true, + text: "审核中", + spinner: "el-icon-loading", + background: "rgba(0, 0, 0, 0.7)", + }); + if (!this.form.routeNodeDay) { + this.$message.error("请输入节点时间段天数"); + return loading.close(); + } + if (!this.form.routeNodeName) { + this.$message.error("请选择节点时间段"); + return loading.close(); + } + if (!this.form.taskType) { + this.$message.error("请选择任务类型"); + return loading.close(); + } + if (!this.form.taskSubdivision) { + this.$message.error("请选择任务细分"); + return loading.close(); + } + if (!this.form.taskStatus) { + this.$message.error("请选择任务状态"); + return loading.close(); + } + updateRouteCheckStatus({ + routeCheckStatus: this.routeform.routeCheckStatus, + id: this.form.specialDiseaseNodeId, + routeCheckRemark: this.routeform.routeCheckRemark, + routeCheckPerson: JSON.parse(localStorage.getItem("user")).nickName, + }).then((res) => { + loading.close(); + if (res.data == 1) { + this.info(); + this.handleClose(); + this.$modal.msgSuccess("审核成功!"); + } + }); + } + }); + }, + // 保存触发条件 + addlistname() { + this.show3 = !this.show3; + }, + // 适用范围 + changeoptions(e) { + this.parentDictCode = this.options.find( + (el) => el.dictValue == e + )?.dictCode; + this.changelisy(); + }, + changelisy() { + list(this.parentDictCode).then((res) => { + this.parentDictCodelist = res.rows; + }); + }, + + // 回显 + info() { + const loading = this.$loading({ + lock: true, + text: "数据加载中", + spinner: "el-icon-loading", + background: "rgba(0, 0, 0, 0.7)", + }); + this.lists = []; + if (this.$route.query) { + this.$set(this.updata, "suitRange", this.$route.query.suitRange); + this.parentDictCode = this.options.find( + (el) => el.dictValue == this.updata.suitRange + )?.dictCode; + setTimeout(() => { + this.changelisy(); + }, 1000); + this.itemlist.specialDiseaseRouteId = this.$route.query.id; + this.itemlist.routeName = Cookies.get("routeName"); + selectSpecialDisease(this.$route.query.id).then((res) => { + loading.close(); + this.agreeNumber = res.data.agreeNumber; + this.totalNumber = res.data.totalNumber; + res.data.specialDiseaseNodeList.forEach((e) => { + if (e.messagePushSign) { + e.messagePushSign = "" + e.messagePushSign; + } + if (e.officialPushSign) { + e.officialPushSign = "" + e.officialPushSign; + } + if (e.appletPushSign) { + e.appletPushSign = "" + e.appletPushSign; + } + if (e.phonePushSign) { + e.phonePushSign = "" + e.phonePushSign; + } + }); + this.lists = this.handleData( + res.data.specialDiseaseNodeList, + "routeNodeDay", + "routeNodeName" + ); + this.form = this.lists[0].list[0]; + if (this.form.taskType) { + this.changeTaskType(this.form.taskType, this.form.taskSubdivision); + } + }); + } else { + loading.close(); + this.lists.push({ + routeNodeName: "", + routeNodeDay: "", + list: [ + { + nodeContent: "
", + templateId: "", + templateName: "", + taskType: "", + taskSubdivision: "", + taskSubdivisionName: "", + taskStatus: "", + secondClassifyDescribe: "", + executionTime: "", + appletPushSign: "0", + officialPushSign: "0", + messagePushSign: "0", + messagePreview: "", + officialRemindContent: "", + taskSubdivisiontemplateType: "", + appletRemindContent: "", + appletPromptDescription: "", + }, + ], + }); + this.form = this.lists[0].list[0]; + } + }, + handleData(list, key, keytwo) { + //得到数据的主键列表 + let keysArr = list.map((item) => { + return { + routeNodeDay: item[key], + routeNodeName: item[keytwo], + }; + }); + let array = keysArr.filter( + (item, index, arr) => + index === + arr.findIndex( + (ite) => + ite.routeNodeDay == item.routeNodeDay && + ite.routeNodeName == item.routeNodeName + ) + ); + + let keys = [...new Set(array)]; + let newList = keys.map((item) => { + return { + //这里写新的 数据结构 如下是整体复制 + routeNodeDay: item[key], + routeNodeName: item[keytwo], + list: list.filter( + (i) => i[key] == item[key] && i[keytwo] == item[keytwo] + ), + }; + }); + return newList; + }, + + // 且或 + infolistoptionslistS() { + var dictType = "trigger_logic"; + getAgencytype(dictType).then((res) => { + this.optionslistS = res.data; + }); + }, + // 诊断 + optiononditionOperators() { + var dictType = "trigger_condition_name"; + getAgencytype(dictType).then((res) => { + this.optionsname = res.data; + }); + }, + // 包含 + optiononditionOperator() { + var dictType = "trigger_condition_operator"; + getAgencytype(dictType).then((res) => { + this.optionstriggerConditionOperator = res.data; + }); + }, + // 包含或等号接口 + handlelist() { + var dictType = "trigger_condition_operator"; + + getList(dictType, this.dictDataType).then((res) => { + this.optionstriggerConditionOperator = res.data; + console.log( + this.optionstriggerConditionOperator, + " this.optionstriggerConditionOperator " + ); + }); + }, + + // 包含 + changetriggerLogic(e, index) { + this.openlist.triggerConditionList[index].triggerConditionOperatorName = + this.optionstriggerConditionOperator.find( + (el) => el.dictValue == e + ).dictLabel; + this.openlist.triggerConditionList[index].triggerConditionValue = null; + }, + + // 诊断 + changetriggerConditionName(e, index) { + var dictType = e; + getAgencytype(dictType).then((res) => { + this.ConditionValue = res.data; + }); + this.openlist.triggerConditionList[index].triggerConditionName = + this.optionsname.find((el) => el.dictValue == e).dictLabel; + this.openlist.triggerConditionList[index].triggerConditionOperator = null; + this.openlist.triggerConditionList[index].triggerConditionValue = null; + this.dictDataType = this.optionsname.find( + (el) => el.dictValue == e + ).dictDataType; + this.openlist.triggerConditionList[index].dictDataType = + this.optionsname.find((el) => el.dictValue == e).dictDataType; + this.handlelist(); + }, + + // 且或 + changetriggerLogicsname(e, index) { + this.openlist.triggerConditionList[index].triggerLogic = e; + this.openlist.triggerConditionList[index].triggerLogicName = + this.optionslistS.find((el) => el.dictValue == e).dictLabel; + }, + // 适用范围 + infolists() { + var dictType = "suit_range"; + getAgencytype(dictType).then((res) => { + this.options = res.data; + }); + this.infolist(); + }, + // 展示触发条件 + infolist() { + this.routeId = this.$route.query.id; + triggerConditionList(this.routeId).then((res) => { + this.openlist.triggerConditionList = res.data; + res.data.forEach((p) => { + this.optiononditionOperators(); + p.dictDataType = this.optionsname.find( + (el) => el.dictValue == p.triggerConditionCode + )?.dictDataType; + var dictType = p.triggerConditionCode; + getAgencytype(dictType).then((res) => { + this.ConditionValue = res.data; + }); + // console.log(this.ConditionValue,'ConditionValueConditionValueConditionValueConditionValue') + + // this.handlelist(); + // var dictType = "trigger_condition_operator"; + + // getList(dictType, this.dictDataType).then((res) => { + // this.optionstriggerConditionOperator = res.data; + // }); + }); + if (res.data.length == 1) { + // 回显一条时 + this.updata = res.data[0]; + // console.log(this.updata, " this.updata"); + + this.updata.triggerConditionOperatorName = + this.optionstriggerConditionOperator.find( + (el) => el.dictValue == this.updata.triggerConditionOperator + )?.dictLabel; + this.updatalist = []; + } else { + // 回显两条或者三条 + this.updata = res.data[0]; + this.updata.triggerConditionOperatorName = + this.optionstriggerConditionOperator.find( + (el) => el.dictValue == this.updata.triggerConditionOperator + )?.dictLabel; + // console.log(this.updata, " this.updata"); + + res.data.splice(0, 1); + this.updatalist = res.data; + // console.log(this.updatalist, " this.updatalist"); + this.updatalist.forEach((e) => { + e.triggerConditionOperatorName = + this.optionstriggerConditionOperator.find( + (el) => el.dictValue == e.triggerConditionOperator + )?.dictLabel; + }); + } + if (this.open == true) { + this.$set(this.openlist, "suitRange", this.$route.query.suitRange); + } else { + this.$set(this.updata, "suitRange", this.openlist.suitRange); + } + }); + }, + // 编辑接口 + infolistname() { + this.routeId = this.$route.query.id; + triggerConditionList(this.routeId).then((res) => { + this.openlist.triggerConditionList = res.data; + this.openlist.triggerConditionList.forEach((o) => { + this.optiononditionOperators(); + o.dictDataType = this.optionsname.find( + (el) => el.dictValue == o.triggerConditionCode + )?.dictDataType; + var dictType = o.triggerConditionCode; + getAgencytype(dictType).then((res) => { + this.ConditionValue = res.data; + }); + // if (o.triggerConditionCode.includes("SEX")) { + // var dictType = "SEX"; + // getAgencytype(dictType).then((res) => { + // this.ConditionValue = res.data; + // }); + // } + }); + this.$set(this.updata, "suitRange", this.openlist.suitRange); + }); + }, + // 编辑 + edit() { + this.open = true; + this.infolistname(); + + // this.openfalse(); + }, + //wangeditor传值 + onNodeContent(item) { + this.form.nodeContent = item.nodeContent; + var abc = new RegExp("