Browse Source

智能查询逻辑

dev-新版ui
jiangyy 3 years ago
parent
commit
e5fee9c02f
  1. 58
      src/views/components/resiSearch.vue
  2. 109
      src/views/components/smartSearchRule.vue

58
src/views/components/resiSearch.vue

@ -182,11 +182,11 @@
class="resi-row-more">
<el-col :span="24">
<el-button v-for="btnItem in btnList"
:key="btnItem.index"
<el-button v-for="(btnItem,index) in btnList"
:key="index"
size="small"
:class="selBtnIndex===btnItem.index?'diy-button--blue':'diy-button--gray'"
@click="handelSelSmartBtn(btnItem.index)">{{btnItem.name}}</el-button>
:class="selBtnIndex===index?'diy-button--blue':'diy-button--gray'"
@click="handelSelSmartBtn(index)">{{btnItem.name}}</el-button>
</el-col>
<el-col>
@ -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 () {

109
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

Loading…
Cancel
Save