diff --git a/src/views/modules/communityService/policy/addPolicy.vue b/src/views/modules/communityService/policy/addPolicy.vue index b7344abb..f654f89f 100644 --- a/src/views/modules/communityService/policy/addPolicy.vue +++ b/src/views/modules/communityService/policy/addPolicy.vue @@ -6,6 +6,7 @@ :inline="true" :model="formData" :rules="dataRule" + :disabled="formType==='detail'" class="div_form"> 取 消 - 确 定 @@ -275,7 +277,24 @@ export default { const { data, code, msg } = await requestPost(url, params) if (code === 0) { + this.demandIdArray = [] + data.categoryList.forEach(element => { + let arr = element.codePath.split(',') + this.demandIdArray.push(arr) + }); + this.ruleList = data.ruleList + + this.formData = data + + + this.$nextTick(() => { + data.ruleList.forEach((element, index) => { + this.$refs['ref_rule' + index][0].setRule(element.resiRuleList, element.houseRuleList, element.statRuleList) + }); + }) + + } else { this.$message.error(msg) } @@ -327,6 +346,7 @@ export default { handleCateSlect (val) { + debugger console.log("val", val); let arr = [] val.forEach((item) => { @@ -343,8 +363,6 @@ export default { }, - - async handleComfirm () { @@ -353,16 +371,13 @@ export default { }, async handleAdd () { - - let ruleList = [] - let _this = this - + let isOk = false this.ruleList.forEach((oneRule, index) => { if (!oneRule.ruleName) { this.$message.error('政策细则不能为空') - return false + isOk = false } - let refObj = _this.$refs['ref_rule' + index][0] + let refObj = this.$refs['ref_rule' + index][0] refObj.getRule() if (refObj.okflag) { @@ -370,11 +385,18 @@ export default { oneRule.houseRuleList = refObj.houseRuleList oneRule.statRuleList = refObj.statRuleList + isOk = true + } else { - return false + isOk = false + } }); + if (!isOk) { + return false + } + this.formData.ruleList = this.ruleList this.btnDisable = true @@ -396,10 +418,15 @@ export default { async addFuwu () { console.log(this.formData) + let url = '/heart/policy/add' + if (this.formType === 'add') { + url = '/heart/policy/add' + } else { + url = '/heart/policy/update' + this.formData.policyId = this.policyId + } - - const url = '/heart/policy/add' // const url = 'http://yapi.elinkservice.cn/mock/245/heart/icServiceProject/service/initiate' let params = { @@ -558,6 +585,9 @@ export default { title: [ { required: true, message: '政策标题不能为空', trigger: 'change' } ], + content: [ + { required: true, message: '政策内容不能为空', trigger: 'change' } + ], } diff --git a/src/views/modules/communityService/policy/personList.vue b/src/views/modules/communityService/policy/personList.vue new file mode 100644 index 00000000..be4bf566 --- /dev/null +++ b/src/views/modules/communityService/policy/personList.vue @@ -0,0 +1,113 @@ + + + + + + + + diff --git a/src/views/modules/communityService/policy/personListItem.vue b/src/views/modules/communityService/policy/personListItem.vue new file mode 100644 index 00000000..4a277e8e --- /dev/null +++ b/src/views/modules/communityService/policy/personListItem.vue @@ -0,0 +1,564 @@ + + + + + + + + diff --git a/src/views/modules/communityService/policy/policyList.vue b/src/views/modules/communityService/policy/policyList.vue index 118cb54e..ed89fb26 100644 --- a/src/views/modules/communityService/policy/policyList.vue +++ b/src/views/modules/communityService/policy/policyList.vue @@ -136,7 +136,7 @@ type="text" size="small" class="div-table-button--edit">编辑 - 人员名单 @@ -178,21 +178,22 @@ @handleOk="handleOk" @handleClose="handleClose"> - - + - + @@ -205,11 +206,11 @@ import { mapGetters } from "vuex"; // import eventInfo from "./cpts/event-info"; import axios from "axios"; import addPolicy from "./addPolicy"; -import detailForm from "./detailForm"; +import personList from "./personList"; export default { - components: { addPolicy, detailForm }, + components: { addPolicy, personList }, data () { @@ -247,11 +248,13 @@ export default { serviceProjectName: '', showAdd: false, - showDetail: false, - showFeedback: false, + formType: 'add', addDiaTitle: '新增政策', - detailDiaTitle: '服务详情', + + showPersonList: false, + ruleList: [] + }; }, @@ -281,8 +284,6 @@ export default { this.getTableData(); }, - - async handleAdd () { this.addDiaTitle = '新增政策' this.formType = 'add' @@ -291,26 +292,43 @@ export default { async handleDetail (row) { this.policyId = row.policyId - + this.addDiaTitle = '政策详情' this.formType = 'detail' - this.showDetail = true + this.showAdd = true }, async handleEdit (row) { this.policyId = row.policyId + this.addDiaTitle = '编辑政策' this.formType = 'edit' this.showAdd = true; }, //加载组织数据 - async handleFeedback (row) { + async handlePersonList (row) { this.policyId = row.policyId - this.serviceProjectName = row.serviceProjectName - this.addDiaTitle = '服务反馈' - this.formType = 'feedback' - this.showAdd = true; + await this.loadRuleList() + this.formType = 'personList' + this.showPersonList = true; + }, + + async loadRuleList () { + + const url = "/heart/policy/rulelist/" + this.policyId + + let params = {} + + const { data, code, msg } = await requestPost(url, params) + + if (code === 0) { + this.ruleList = data + + } else { + this.$message.error(msg) + } + }, @@ -319,7 +337,8 @@ export default { this.formType = '' this.showAdd = false - this.showDetail = false + this.showPersonList = false + }, @@ -359,13 +378,13 @@ export default { async cancelFuwu () { - const url = `/heart/icServiceProject/service/cancel/${this.policyId}`; + const url = `/heart/policy/delete/${this.policyId}`; const { data, code, msg } = await requestPost(url, {}); if (code === 0) { - this.$message.success("取消成功!"); + this.$message.success("删除成功!"); this.getTableData(); } else { this.$message.error("操作失败!"); diff --git a/src/views/modules/communityService/policy/rule.vue b/src/views/modules/communityService/policy/rule.vue index 61dc1990..a0499aae 100644 --- a/src/views/modules/communityService/policy/rule.vue +++ b/src/views/modules/communityService/policy/rule.vue @@ -73,6 +73,7 @@ @@ -164,6 +165,7 @@ @@ -255,6 +257,7 @@ @@ -336,7 +339,7 @@ export default { resiRuleList1: [ { ruleDesc: '',//规则描述文字,例如:基础信息性别等于女 - lastLogicalRel: '',//与上一条的关系;and、or + nextLogicalRel: '',//与上一条的关系;and、or itemGroupId: '', itemId: '', queryType: '', @@ -354,7 +357,7 @@ export default { houseRuleList1: [ { ruleDesc: '', - lastLogicalRel: '',//与上一条的关系;and、or + nextLogicalRel: '',//与上一条的关系;and、or queryType: '', colTable: '', colKey: '', @@ -369,7 +372,7 @@ export default { statRuleList1: [ { ruleDesc: '', - lastLogicalRel: '',//与上一条的关系;and、or + nextLogicalRel: '',//与上一条的关系;and、or queryType: '', colTable: '', colKey: '', @@ -399,6 +402,53 @@ export default { methods: { + async setRule (resiRuleList, houseRuleList, statRuleList) { + this.resiRuleList = resiRuleList + + + this.resiRuleList.forEach((element, index) => { + + let selGroup = this.groupList.filter((item) => + element.itemGroupId === item.id + ); + + if (selGroup.length > 0) { + this.handleSelGroup(index, selGroup[0], true) + } + + }); + + + this.houseRuleList = houseRuleList + + this.houseRuleList.forEach((element, index) => { + + let selHouseItem = this.houseItemList.filter((item) => + element.colKey === item.colKey + ); + + if (selHouseItem.length > 0) { + this.handleSelHouseItem(index, selHouseItem[0], true) + } + + }); + + this.statRuleList = statRuleList + + this.statRuleList.forEach((element, index) => { + + let selStaticItem = this.staticItemList.filter((item) => + element.colKey === item.colKey + ); + + if (selStaticItem.length > 0) { + this.handleSelStaticItem(index, selStaticItem[0], true) + } + + }); + + }, + getRule () { this.okflag = false let messageObj = this.validateRule() @@ -411,6 +461,19 @@ export default { this.$message.error(messageObj) } else { + + if (this.resiRuleList.length > 0) { + this.resiRuleList[this.resiRuleList.length - 1].nextLogicalRel = '' + } + + if (this.houseRuleList.length > 0) { + this.houseRuleList[this.houseRuleList.length - 1].nextLogicalRel = '' + } + + if (this.statRuleList.length > 0) { + this.statRuleList[this.statRuleList.length - 1].nextLogicalRel = '' + } + this.okflag = true } @@ -421,8 +484,9 @@ export default { let message = '' this.resiRuleList.forEach((item, index) => { + if (index === this.resiRuleList.length - 1) { - if (item.lastLogicalRel === '' || + if ( item.ruleDesc === '' || item.itemGroupId === '' || item.itemId === '' || @@ -434,7 +498,7 @@ export default { return message } } else { - if ( + if (item.nextLogicalRel === '' || item.ruleDesc === '' || item.itemGroupId === '' || item.itemId === '' || @@ -464,7 +528,7 @@ export default { return message } } else { - if (item.lastLogicalRel === '' || + if (item.nextLogicalRel === '' || item.ruleDesc === '' || item.queryType === '' || item.colKey === '' || @@ -490,7 +554,7 @@ export default { } } else { if ( - item.lastLogicalRel === '' || + item.nextLogicalRel === '' || item.ruleDesc === '' || item.queryType === '' || item.colKey === '' || @@ -541,7 +605,7 @@ export default { addPerson () { let obj = { ruleDesc: '',//规则描述文字,例如:基础信息性别等于女 - lastLogicalRel: 'and',//与上一条的关系;and、or + nextLogicalRel: 'and',//与上一条的关系;and、or itemGroupId: '', itemId: '', queryType: '', @@ -564,7 +628,7 @@ export default { addHouse () { let obj = { ruleDesc: '房屋信息', - lastLogicalRel: 'and',//与上一条的关系;and、or + nextLogicalRel: 'and',//与上一条的关系;and、or queryType: '', colTable: '', colKey: '', @@ -585,7 +649,7 @@ export default { addStatic () { let obj = { ruleDesc: '统计信息', - lastLogicalRel: 'and',//与上一条的关系;and、or + nextLogicalRel: 'and',//与上一条的关系;and、or queryType: '', colTable: '', colKey: '', @@ -604,7 +668,7 @@ export default { }, //选择人员信息第一列下拉框 - async handleSelGroup (personIndex, item) { + async handleSelGroup (personIndex, item, isEdit) { const url = '/oper/customize/icformitem/getItemListV2' // const url = 'http://yapi.elinkservice.cn/mock/245/gov/org/isServiceProject/service/serviceScopeTree' let params = { @@ -621,6 +685,14 @@ export default { 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]) + } + } } else { this.$message.error(msg) } @@ -660,7 +732,7 @@ export default { //选择房屋信息第二列下拉框 async handleSelHouseItem (houseIndex, item) { - // debugger + let oneData = this.houseRuleList[houseIndex] oneData.colTable = item.tableName @@ -727,10 +799,11 @@ export default { // 获取人员信息---第一列 async loadPersonGroup () { - const url = '/oper/customize//icformitemgroup/list' + const url = '/oper/customize/icformitemgroup/list' // const url = 'http://yapi.elinkservice.cn/mock/245/gov/org/isServiceProject/service/serviceScopeTree' let params = { - formCode: 'resi_base_info' + formCode: 'resi_base_info', + policyFlag: '1' } const { data, code, msg } = await requestPost(url, params)