diff --git a/src/views/modules/communityService/policy/addPolicy.vue b/src/views/modules/communityService/policy/addPolicy.vue index f654f89f..8719b65e 100644 --- a/src/views/modules/communityService/policy/addPolicy.vue +++ b/src/views/modules/communityService/policy/addPolicy.vue @@ -10,9 +10,10 @@ class="div_form"> - @@ -26,6 +27,7 @@ 确 定 + @click="handleAdd">确 定 @@ -290,6 +292,7 @@ export default { this.$nextTick(() => { data.ruleList.forEach((element, index) => { + this.$refs['ref_rule' + index][0].setRule(element.resiRuleList, element.houseRuleList, element.statRuleList) }); }) @@ -363,28 +366,66 @@ export default { }, - async handleComfirm () { - - - this.handleAdd() - - }, - async handleAdd () { let isOk = false this.ruleList.forEach((oneRule, index) => { - if (!oneRule.ruleName) { - this.$message.error('政策细则不能为空') - isOk = false - } + // if (!oneRule.ruleName) { + // this.$message.error('政策细则不能为空') + // isOk = false + // } let refObj = this.$refs['ref_rule' + index][0] refObj.getRule() if (refObj.okflag) { oneRule.resiRuleList = refObj.resiRuleList + oneRule.resiRuleList.forEach(element => { + element.itemList = [] + element.colOption = [] + + if (!element.colValLabel) { + element.colValLabel = element.colVal + } + if (!element.nextLogicalRelName) { + element.nextLogicalRelName = '' + } + + element.ruleDesc = element.itemGroupName + element.itemLabel + element.queryTypeName + element.colValLabel + element.nextLogicalRelName + + }); + oneRule.houseRuleList = refObj.houseRuleList + oneRule.houseRuleList.forEach(element => { + element.itemList = [] + element.colOption = [] + + if (!element.colValLabel) { + element.colValLabel = element.colVal + } + if (!element.nextLogicalRelName) { + element.nextLogicalRelName = '' + } + + element.ruleDesc = element.itemGroupName + element.itemLabel + element.queryTypeName + element.colValLabel + element.nextLogicalRelName + + }); + oneRule.statRuleList = refObj.statRuleList + oneRule.statRuleList.forEach(element => { + element.itemList = [] + element.colOption = [] + + if (!element.colValLabel) { + element.colValLabel = element.colVal + } + if (!element.nextLogicalRelName) { + element.nextLogicalRelName = '' + } + + element.ruleDesc = element.itemGroupName + element.itemLabel + element.queryTypeName + element.colValLabel + element.nextLogicalRelName + + }); + isOk = true } else { @@ -393,16 +434,21 @@ export default { } }); + + if (!isOk) { return false } this.formData.ruleList = this.ruleList + console.log(this.formData.ruleList) + + this.btnDisable = true setTimeout(() => { this.btnDisable = false - }, 10000) + }, 5000) this.$refs['ref_form'].validate((valid, messageObj) => { if (!valid) { app.util.validateRule(messageObj) @@ -440,6 +486,7 @@ export default { this.resetData() this.$emit('handleOk') } else { + this.btnDisable = false this.$message.error(msg) } }, @@ -616,8 +663,9 @@ export default { @import "@/assets/scss/modules/management/form-main.scss"; .btn-add-rule { + margin-left: 70px; display: flex; - justify-content: center; + justify-content: flex-start; margin-bottom: 20px; } diff --git a/src/views/modules/communityService/policy/personListItem.vue b/src/views/modules/communityService/policy/personListItem.vue index e7c093cc..1693a099 100644 --- a/src/views/modules/communityService/policy/personListItem.vue +++ b/src/views/modules/communityService/policy/personListItem.vue @@ -274,7 +274,7 @@ export default { async loadTable () { this.tableLoading = true - const url = "/heart/policy/resiuserlist" + const url = "/data/aggregator/icuser/listByPolicyRules" // const url = "http://yapi.elinkservice.cn/mock/245/epmetuser/icEpidemicSpecialAttention/list" let params = { pageSize: this.pageSize, @@ -408,7 +408,7 @@ export default { this.formData = { ruleId: '', - ruleList: [], + ruleList: {}, name: '', mobile: '', idCard: '', @@ -520,9 +520,9 @@ export default { required: '' }, ruleList: { - type: Array, + type: Object, default () { - return [] + return {} } }, diff --git a/src/views/modules/communityService/policy/policyList.vue b/src/views/modules/communityService/policy/policyList.vue index 8f3d2940..e7395e54 100644 --- a/src/views/modules/communityService/policy/policyList.vue +++ b/src/views/modules/communityService/policy/policyList.vue @@ -355,13 +355,13 @@ export default { this.policyId = row.policyId - this.$confirm("确认取消服务?", "提示", { + this.$confirm("确认删除政策?", "提示", { confirmButtonText: "确定", cancelButtonText: "取消", type: "warning" }) .then(() => { - this.cancelFuwu() + this.delPolicy() }) .catch(err => { if (err == "cancel") { @@ -370,18 +370,14 @@ export default { // message: "已取消删除" // }); } - }); - - }, - async cancelFuwu () { + async delPolicy () { const url = `/heart/policy/delete/${this.policyId}`; - const { data, code, msg } = await requestPost(url, {}); if (code === 0) { diff --git a/src/views/modules/communityService/policy/rule.vue b/src/views/modules/communityService/policy/rule.vue index 50444635..a4b35b86 100644 --- a/src/views/modules/communityService/policy/rule.vue +++ b/src/views/modules/communityService/policy/rule.vue @@ -27,8 +27,7 @@ + placeholder="全部"> + placeholder="全部"> + placeholder="全部"> @@ -65,9 +63,9 @@ class="item_width_1" v-model="personItem.colVal" size="mini" - placeholder="全部" - clearable> + placeholder="全部"> @@ -100,9 +98,9 @@ class="item_width_1" v-model="personItem.nextLogicalRel" size="mini" - placeholder="全部" - clearable> + placeholder="全部"> @@ -131,8 +129,7 @@ + placeholder="全部"> + placeholder="全部"> @@ -157,9 +154,9 @@ class="item_width_1" v-model="houseItem.colVal" size="mini" - placeholder="全部" - clearable> + placeholder="全部"> @@ -192,9 +189,9 @@ class="item_width_1" v-model="houseItem.nextLogicalRel" size="mini" - placeholder="全部" - clearable> + placeholder="全部"> @@ -223,8 +220,7 @@ + placeholder="全部"> + placeholder="全部"> @@ -249,9 +245,9 @@ class="item_width_1" v-model="staticItem.colVal" size="mini" - placeholder="全部" - clearable> + placeholder="全部"> @@ -283,9 +279,9 @@ class="item_width_1" v-model="staticItem.nextLogicalRel" size="mini" - placeholder="全部" - clearable> + placeholder="全部"> @@ -368,6 +364,11 @@ export default { itemList: [], colType: '',//详细参数的组件类型 colOption: [], + itemGroupName: '', + itemLabel: '', + queryTypeName: '', + colValLabel: '', + nextLogicalRelName: '', } ], @@ -384,6 +385,11 @@ export default { titleName: '房屋信息', colType: '',//详细参数的组件类型 colOption: [], + itemGroupName: '房屋信息', + itemLabel: '', + queryTypeName: '', + colValLabel: '', + nextLogicalRelName: '', } ], statRuleList: [], @@ -399,13 +405,18 @@ export default { titleName: '统计信息', colType: '',//详细参数的组件类型 colOption: [], + itemGroupName: '统计信息', + itemLabel: '', + queryTypeName: '', + colValLabel: '', + nextLogicalRelName: '', } ], okflag: false, showPersonList: false, - ruleList: [] + ruleList: {} } }, @@ -414,59 +425,80 @@ export default { }, components: { personListItem }, - async mounted () { - this.loadPersonGroup() - this.loadHouseItem() - this.loadStaticItem() - this.loadDicOption() + async created () { + this.startLoading() + await this.loadPersonGroup() + await this.loadHouseItem() + await this.loadStaticItem() + await this.loadDicOption() + + }, methods: { async setRule (resiRuleList, houseRuleList, statRuleList) { + // this.startLoading() + if (this.groupList.length == 0 || this.houseItemList.length === 0 || this.staticItemList.length === 0) { + setTimeout(() => { + this.setRule(resiRuleList, houseRuleList, statRuleList); + }, 500); + return false + } this.resiRuleList = resiRuleList + if (this.resiRuleList && this.resiRuleList.length > 0) { + for (let i = 0; i < this.resiRuleList.length; i++) { + let element = this.resiRuleList[i] + let selGroup = this.groupList.filter((item) => + element.itemGroupId === item.id + ); + console.log(selGroup) - this.resiRuleList.forEach((element, index) => { + if (selGroup.length > 0) { + await this.handleSelGroup(i, selGroup[0], true) - let selGroup = this.groupList.filter((item) => - element.itemGroupId === item.id - ); - if (selGroup.length > 0) { - this.handleSelGroup(index, selGroup[0], true) - } - - }); + let selItem = element.itemList.filter((item) => + element.itemId === item.itemId); + if (selItem.length > 0) { + await this.handleSelGroupItem(i, selItem[0], true) + } + } + } + } this.houseRuleList = houseRuleList + if (this.houseRuleList && this.houseRuleList.length > 0) { + this.houseRuleList.forEach((element, index) => { - this.houseRuleList.forEach((element, index) => { + let selHouseItem = this.houseItemList.filter((item) => + element.colKey === item.colKey + ); - let selHouseItem = this.houseItemList.filter((item) => - element.colKey === item.colKey - ); - - if (selHouseItem.length > 0) { - this.handleSelHouseItem(index, selHouseItem[0], true) - } - - }); + if (selHouseItem.length > 0) { + this.handleSelHouseItem(index, selHouseItem[0], true) + } + }); + } this.statRuleList = statRuleList + if (this.statRuleList && this.statRuleList.length > 0) { + this.statRuleList.forEach((element, index) => { - this.statRuleList.forEach((element, index) => { + let selStaticItem = this.staticItemList.filter((item) => + element.colKey === item.colKey + ); - let selStaticItem = this.staticItemList.filter((item) => - element.colKey === item.colKey - ); + if (selStaticItem.length > 0) { + this.handleSelStaticItem(index, selStaticItem[0], true) + } - if (selStaticItem.length > 0) { - this.handleSelStaticItem(index, selStaticItem[0], true) - } + }); + } - }); + this.endLoading() }, @@ -474,9 +506,9 @@ export default { this.okflag = false let messageObj = this.validateRule() - console.log('resiRuleList', this.resiRuleList) - console.log('houseRuleList', this.houseRuleList) - console.log('statRuleList', this.statRuleList) + // console.log('resiRuleList', this.resiRuleList) + // console.log('houseRuleList', this.houseRuleList) + // console.log('statRuleList', this.statRuleList) if (messageObj) { this.$message.error(messageObj) @@ -507,9 +539,7 @@ export default { this.resiRuleList.forEach((item, index) => { if (index === this.resiRuleList.length - 1) { - if ( - item.ruleDesc === '' || - item.itemGroupId === '' || + if (item.itemGroupId === '' || item.itemId === '' || item.queryType === '' || item.colKey === '' || @@ -520,7 +550,6 @@ export default { } } else { if (item.nextLogicalRel === '' || - item.ruleDesc === '' || item.itemGroupId === '' || item.itemId === '' || item.queryType === '' || @@ -538,10 +567,7 @@ export default { if (index === this.houseRuleList.length - 1) { - if ( - - item.ruleDesc === '' || - item.queryType === '' || + if (item.queryType === '' || item.colKey === '' || item.colVal === '') { @@ -550,7 +576,6 @@ export default { } } else { if (item.nextLogicalRel === '' || - item.ruleDesc === '' || item.queryType === '' || item.colKey === '' || item.colVal === '') { @@ -563,10 +588,7 @@ export default { this.statRuleList.forEach((item, index) => { if (index === this.statRuleList.length - 1) { - if ( - - item.ruleDesc === '' || - item.queryType === '' || + if (item.queryType === '' || item.colKey === '' || item.colVal === '') { @@ -574,9 +596,7 @@ export default { return message } } else { - if ( - item.nextLogicalRel === '' || - item.ruleDesc === '' || + if (item.nextLogicalRel === '' || item.queryType === '' || item.colKey === '' || item.colVal === '') { @@ -594,118 +614,32 @@ export default { handlePreview () { this.ruleList = {} this.ruleList = { - resiRuleList: this.resiRuleList, - houseRuleList: this.houseRuleList, - statRuleList: this.statRuleList, - } - - this.showPersonList = true - }, - - handleClose () { - this.showPersonList = false - - }, - - clickTab (type) { - if (type === 'person') { - this.personSel = true - this.houseSel = false - this.staticSel = false - } - if (type === 'house') { - this.personSel = false - this.houseSel = true - this.staticSel = false - } - if (type === 'static') { - this.personSel = false - this.houseSel = false - this.staticSel = true - } - }, - - addRule () { - if (this.personSel) { - this.addPerson() + resiRuleList: [], + houseRuleList: [], + statRuleList: [], } - if (this.houseSel) { - this.addHouse() + if (this.personChecked) { + this.ruleList.resiRuleList = this.resiRuleList } - - if (this.staticSel) { - this.addStatic() - } - }, - - addPerson () { - let obj = { - ruleDesc: '',//规则描述文字,例如:基础信息性别等于女 - nextLogicalRel: 'and',//与上一条的关系;and、or - itemGroupId: '', - itemId: '', - queryType: '', - colTable: '', - colKey: '', - colVal: '', - - itemList: [], - colType: '',//详细参数的组件类型 - colOption: [], + if (this.houseChecked) { + this.ruleList.houseRuleList = this.houseRuleList } - - this.resiRuleList.push(obj) - }, - - delPerson (index) { - this.resiRuleList.splice(index, 1); - }, - - addHouse () { - let obj = { - ruleDesc: '房屋信息', - nextLogicalRel: 'and',//与上一条的关系;and、or - queryType: '', - colTable: '', - colKey: '', - colVal: '', - - titleName: '房屋信息', - colType: '',//详细参数的组件类型 - colOption: [], + if (this.staticChecked) { + this.ruleList.statRuleList = this.statRuleList } - this.houseRuleList.push(obj) - }, - - delHouse (index) { - this.houseRuleList.splice(index, 1); + this.showPersonList = true }, - addStatic () { - let obj = { - ruleDesc: '统计信息', - nextLogicalRel: 'and',//与上一条的关系;and、or - queryType: '', - colTable: '', - colKey: '', - colVal: '', - - titleName: '统计信息', - colType: '',//详细参数的组件类型 - colOption: [], - } + handleClose () { + this.showPersonList = false - this.statRuleList.push(obj) }, - delStatic (index) { - this.statRuleList.splice(index, 1); - }, //选择人员信息第一列下拉框 - async handleSelGroup (personIndex, item, isEdit) { + async handleSelGroup (personIndex, item, isSet) { const url = '/oper/customize/icformitem/getItemListV2' // const url = 'http://yapi.elinkservice.cn/mock/245/gov/org/isServiceProject/service/serviceScopeTree' let params = { @@ -717,34 +651,41 @@ export default { const { data, code, msg } = await requestPost(url, params) if (code === 0) { + let oneData = this.resiRuleList[personIndex] - oneData.ruleDesc = item.label + oneData.itemGroupName = item.label oneData.itemList = data oneData.colTable = item.tableName - this.$set(this.resiRuleList, personIndex, oneData) - if (isEdit) { - let selItem = oneData.itemList.filter((item) => - oneData.itemId === item.itemId); - if (selItem.length > 0) { - this.handleSelGroupItem(personIndex, selItem[0]) - } + if (!isSet) {//如果是详情,赋值,不需要置空 + oneData.nextLogicalRel = '' + oneData.itemId = '' + oneData.queryType = '' + oneData.colKey = '' + oneData.colVal = '' } + + this.$set(this.resiRuleList, personIndex, oneData) + } else { this.$message.error(msg) } }, //选择人员信息第二列下拉框 - async handleSelGroupItem (personIndex, item) { + async handleSelGroupItem (personIndex, item, isSet) { let oneData = this.resiRuleList[personIndex] oneData.colKey = item.columnName oneData.colType = item.itemType + oneData.itemLabel = item.label - oneData.ruleDesc = oneData.ruleDesc + item.label - + if (!isSet) {//如果是详情,赋值,不需要置空 + oneData.nextLogicalRel = '' + oneData.queryType = '' + oneData.colVal = '' + } if (item.optionSourceType === 'remote') { const url = item.optionSourceValue @@ -767,14 +708,49 @@ export default { }, + //选择人员信息第三列 + handleSelPersonQuery (personIndex, item) { + let oneData = this.resiRuleList[personIndex] + oneData.queryTypeName = item.label + + oneData.nextLogicalRel = '' + oneData.colVal = '' + oneData.colValLabel = '' + + this.$set(this.resiRuleList, personIndex, oneData) + }, + //选择人员信息第四列 + handleSelPersonValue (personIndex, item) { + let oneData = this.resiRuleList[personIndex] + + oneData.colValLabel = item.label + oneData.nextLogicalRel = '' + + this.$set(this.resiRuleList, personIndex, oneData) + }, + //选择人员信息第五列 + handleSelPersonLogical (personIndex, item) { + let oneData = this.resiRuleList[personIndex] + + oneData.nextLogicalRelName = item.label + + this.$set(this.resiRuleList, personIndex, oneData) + }, + //选择房屋信息第二列下拉框 - async handleSelHouseItem (houseIndex, item) { + async handleSelHouseItem (houseIndex, item, isSet) { let oneData = this.houseRuleList[houseIndex] oneData.colTable = item.tableName oneData.colType = item.itemType - oneData.ruleDesc = oneData.ruleDesc + item.label + oneData.itemLabel = item.label + + if (!isSet) {//如果是详情,赋值,不需要置空 + oneData.nextLogicalRel = '' + oneData.queryType = '' + oneData.colVal = '' + } if (item.optionSourceType === 'remote') { const url = item.optionSourceUrl @@ -796,18 +772,50 @@ export default { oneData.colOption = [] } + this.$set(this.houseRuleList, houseIndex, oneData) + + }, + + //选择房屋第三列 + handleSelHouseQuery (houseIndex, item) { + let oneData = this.houseRuleList[houseIndex] + oneData.queryTypeName = item.label + + oneData.nextLogicalRel = '' + oneData.colVal = '' + oneData.colValLabel = '' this.$set(this.houseRuleList, houseIndex, oneData) + }, + //选择房屋第四列 + handleSelHouseValue (houseIndex, item) { + let oneData = this.houseRuleList[houseIndex] + oneData.colValLabel = item.label + oneData.nextLogicalRel = '' + this.$set(this.houseRuleList, houseIndex, oneData) + }, + //选择房屋第五列 + handleSelHouseLogical (houseIndex, item) { + let oneData = this.houseRuleList[houseIndex] + oneData.nextLogicalRelName = item.label + + this.$set(this.houseRuleList, houseIndex, oneData) }, //选择统计信息第二列下拉框 - async handleSelStaticItem (staticIndex, item) { + async handleSelStaticItem (staticIndex, item, isSet) { let oneData = this.statRuleList[staticIndex] oneData.colTable = item.tableName oneData.colType = item.itemType - oneData.ruleDesc = oneData.ruleDesc + item.label + oneData.itemLabel = item.label + + if (!isSet) {//如果是详情,赋值,不需要置空 + oneData.nextLogicalRel = '' + oneData.queryType = '' + oneData.colVal = '' + } if (item.optionSourceType === 'remote') { const url = item.optionSourceUrl @@ -834,6 +842,145 @@ export default { }, + //选择统计信息第三列 + handleSelStaticQuery (staticIndex, item) { + let oneData = this.statRuleList[staticIndex] + oneData.queryTypeName = item.label + + oneData.nextLogicalRel = '' + oneData.colVal = '' + oneData.colValLabel = '' + + this.$set(this.statRuleList, staticIndex, oneData) + }, + //选择统计信息第四列 + handleSelStaticValue (staticIndex, item) { + let oneData = this.statRuleList[staticIndex] + oneData.colValLabel = item.label + oneData.nextLogicalRel = '' + + this.$set(this.statRuleList, staticIndex, oneData) + }, + //选择统计信息第五列 + handleSelStaticLogical (staticIndex, item) { + let oneData = this.statRuleList[staticIndex] + oneData.nextLogicalRelName = item.label + + this.$set(this.statRuleList, staticIndex, oneData) + }, + + clickTab (type) { + if (type === 'person') { + this.personSel = true + this.houseSel = false + this.staticSel = false + } + if (type === 'house') { + this.personSel = false + this.houseSel = true + this.staticSel = false + } + if (type === 'static') { + this.personSel = false + this.houseSel = false + this.staticSel = true + } + }, + + addRule () { + if (this.personSel) { + this.addPerson() + } + + if (this.houseSel) { + this.addHouse() + } + + if (this.staticSel) { + this.addStatic() + } + }, + + addPerson () { + let obj = { + ruleDesc: '',//规则描述文字,例如:基础信息性别等于女 + nextLogicalRel: 'and',//与上一条的关系;and、or + itemGroupId: '', + itemId: '', + queryType: '', + colTable: '', + colKey: '', + colVal: '', + + itemList: [], + colType: '',//详细参数的组件类型 + colOption: [], + itemGroupName: '', + itemLabel: '', + queryTypeName: '', + colValLabel: '', + nextLogicalRelName: '', + } + + this.resiRuleList.push(obj) + }, + + delPerson (index) { + this.resiRuleList.splice(index, 1); + }, + + addHouse () { + let obj = { + ruleDesc: '', + nextLogicalRel: 'and',//与上一条的关系;and、or + queryType: '', + colTable: '', + colKey: '', + colVal: '', + + titleName: '房屋信息', + colType: '',//详细参数的组件类型 + colOption: [], + itemGroupName: '房屋信息', + itemLabel: '', + queryTypeName: '', + colValLabel: '', + nextLogicalRelName: '', + } + + this.houseRuleList.push(obj) + }, + + delHouse (index) { + this.houseRuleList.splice(index, 1); + }, + + addStatic () { + let obj = { + ruleDesc: '', + nextLogicalRel: 'and',//与上一条的关系;and、or + queryType: '', + colTable: '', + colKey: '', + colVal: '', + + titleName: '统计信息', + colType: '',//详细参数的组件类型 + colOption: [], + itemGroupName: '统计信息', + itemLabel: '', + queryTypeName: '', + colValLabel: '', + nextLogicalRelName: '', + } + + this.statRuleList.push(obj) + }, + + delStatic (index) { + this.statRuleList.splice(index, 1); + }, + // 获取人员信息---第一列 async loadPersonGroup () { const url = '/oper/customize/icformitemgroup/list'