From e5fee9c02fd48bcc146a3ef3cccc00ad6cfa305b Mon Sep 17 00:00:00 2001 From: jiangyy Date: Fri, 2 Dec 2022 14:51:03 +0800 Subject: [PATCH] =?UTF-8?q?=E6=99=BA=E8=83=BD=E6=9F=A5=E8=AF=A2=E9=80=BB?= =?UTF-8?q?=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/components/resiSearch.vue | 58 ++++++++++-- src/views/components/smartSearchRule.vue | 109 +++++++++++------------ 2 files changed, 102 insertions(+), 65 deletions(-) diff --git a/src/views/components/resiSearch.vue b/src/views/components/resiSearch.vue index 6810c8f96..703e1a4e8 100644 --- a/src/views/components/resiSearch.vue +++ b/src/views/components/resiSearch.vue @@ -182,11 +182,11 @@ class="resi-row-more"> - {{btnItem.name}} + :class="selBtnIndex===index?'diy-button--blue':'diy-button--gray'" + @click="handelSelSmartBtn(index)">{{btnItem.name}} @@ -364,16 +364,56 @@ export default { showSmartSearchForm: true, formType: 'add', - selBtnIndex: 1, + selBtnIndex: 0, btnList: [ { name: '智能查询', - index: 1, + + ruleList: [ + { + selSmartType: 'house', + nextLogicalRel: "", + nextLogicalRelName: "", + personRule: { + ruleDesc: '',//规则描述文字,例如:基础信息性别等于女 + itemGroupId: '', + itemId: '', + queryType: '', + colTable: '', + colKey: '', + colVal: '', + + itemList: [], + colType: '',//详细参数的组件类型 + colOption: [], + itemGroupName: '', + itemLabel: '', + queryTypeName: '', + colValLabel: '', + }, + houseRule: { + ruleDesc: '', + queryType: '', + colTable: '', + colKey: '', + colVal: '', + + titleName: '房屋信息', + colType: '',//详细参数的组件类型 + colOption: [], + itemGroupName: '房屋信息', + itemLabel: '', + queryTypeName: '', + colValLabel: '', + + }, + } + ] }, { name: '租户', - index: 2, + ruleList: [ { selSmartType: 'house', @@ -412,12 +452,13 @@ export default { ruleDesc: "房屋信息房屋状态等于出租", }, + }, ] }, { name: '第一党支部党员', - index: 3, + ruleList: [ { selSmartType: 'person', @@ -517,6 +558,7 @@ export default { handelSelSmartBtn (index) { this.selBtnIndex = index + this.$refs['ref_rule'].setRule(this.btnList[index].ruleList) }, initForm () { diff --git a/src/views/components/smartSearchRule.vue b/src/views/components/smartSearchRule.vue index 7def60b5c..26794dc02 100644 --- a/src/views/components/smartSearchRule.vue +++ b/src/views/components/smartSearchRule.vue @@ -300,7 +300,6 @@ export default { handleSelSmartType (ruleIndex, item) { let oneData = this.smartRuleList[ruleIndex] - // if (item.value === 'house') { oneData.houseRule = { ruleDesc: '', queryType: '', @@ -336,65 +335,61 @@ export default { } - // } else { - - // } - this.$set(this.smartRuleList, ruleIndex, oneData) console.log(this.smartRuleList) }, - // async setRule (smartRuleList, smartRuleList) { - // // this.startLoading() - // if (this.groupList.length == 0 || this.houseItemList.length === 0) { - // setTimeout(() => { - // this.setRule(smartRuleList, smartRuleList); - // }, 500); - // return false - // } - - - // this.smartRuleList = smartRuleList - // if (this.smartRuleList && this.smartRuleList.length > 0) { - // this.personChecked = true - // for (let i = 0; i < this.smartRuleList.length; i++) { - // let element = this.smartRuleList[i] - - // let selGroup = this.groupList.filter((item) => - // element.itemGroupId === item.id - // ); - // console.log(selGroup) - - // if (selGroup.length > 0) { - // await this.handleSelGroup(i, 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.smartRuleList = smartRuleList - // if (this.smartRuleList && this.smartRuleList.length > 0) { - // this.houseChecked = true - // this.smartRuleList.forEach((element, index) => { - - // let selHouseItem = this.houseItemList.filter((item) => - // element.colKey === item.colKey - // ); - - // if (selHouseItem.length > 0) { - // this.handleSelHouseItem(index, selHouseItem[0], true) - // } - - // }); - // } - - // }, + async setRule (ruleList) { + // this.startLoading() + if (this.groupList.length == 0 || this.houseItemList.length === 0) { + setTimeout(() => { + this.setRule(ruleList); + }, 500); + return false + } + + this.smartRuleList = ruleList + if (this.smartRuleList && this.smartRuleList.length > 0) { + + for (let i = 0; i < this.smartRuleList.length; i++) { + + let element = this.smartRuleList[i] + if (element.selSmartType === 'house') { + + let selHouseItem = this.houseItemList.filter((item) => + element.houseRule.colKey === item.colKey + ); + + if (selHouseItem.length > 0) { + await this.handleSelHouseItem(i, selHouseItem[0], true) + } + } + + if (element.selSmartType === 'person') { + + let selGroup = this.groupList.filter((item) => + element.personRule.itemGroupId === item.id + ); + console.log(selGroup) + + if (selGroup.length > 0) { + await this.handleSelGroup(i, selGroup[0], true) + + + let selItem = element.personRule.itemList.filter((item) => + element.personRule.itemId === item.itemId); + if (selItem.length > 0) { + await this.handleSelGroupItem(i, selItem[0], true) + } + + } + } + + } + } + + + + }, getRule () { this.okflag = false