diff --git a/src/views/components/resiSearch.vue b/src/views/components/resiSearch.vue index c12a99ffc..6810c8f96 100644 --- a/src/views/components/resiSearch.vue +++ b/src/views/components/resiSearch.vue @@ -190,9 +190,8 @@ - + @@ -369,15 +368,92 @@ export default { btnList: [ { name: '智能查询', - index: 1 + index: 1, + }, { name: '租户', - index: 2 + index: 2, + ruleList: [ + { + selSmartType: 'house', + nextLogicalRel: "", + nextLogicalRelName: "", + personRule: { + ruleDesc: '',//规则描述文字,例如:基础信息性别等于女 + itemGroupId: '', + itemId: '', + queryType: '', + colTable: '', + colKey: '', + colVal: '', + + itemList: [], + colType: '',//详细参数的组件类型 + colOption: [], + itemGroupName: '', + itemLabel: '', + queryTypeName: '', + colValLabel: '', + }, + houseRule: { + colKey: "RENT_FLAG", + colTable: "ic_house", + colVal: "1", + colValLabel: "出租", + itemGroupId: null, + itemGroupName: "房屋信息", + itemId: null, + itemLabel: "房屋状态", + nextLogicalRel: "", + nextLogicalRelName: "", + queryType: "=", + queryTypeName: "等于", + ruleDesc: "房屋信息房屋状态等于出租", + + }, + }, + ] }, { name: '第一党支部党员', - index: 3 + index: 3, + ruleList: [ + { + selSmartType: 'person', + nextLogicalRel: "", + nextLogicalRelName: "", + personRule: { + colKey: "IS_BDHJ", + colTable: "ic_resi_user", + colVal: "1", + colValLabel: "是", + itemGroupId: "45687aa479955f9d06204d415238f7cc_0", + itemGroupName: "基础信息", + itemId: "20220422102809_1005", + itemLabel: "本地户籍", + queryType: "=", + queryTypeName: "等于", + ruleDesc: "基础信息本地户籍等于是", + }, + houseRule: { + ruleDesc: '', + queryType: '', + colTable: '', + colKey: '', + colVal: '', + + titleName: '房屋信息', + colType: '',//详细参数的组件类型 + colOption: [], + itemGroupName: '房屋信息', + itemLabel: '', + queryTypeName: '', + colValLabel: '', + + }, + }, + ] } ] @@ -483,33 +559,40 @@ export default { // this.orgOptions = []; }, handleSearch () { - // console.log('formmmmm---', this.form) - const itemTypes = ['daterange', 'timerange', 'checkbox'] - let a = this.tempFormList.filter(item => item.itemType != 'inputRange') - let arr = a.filter((n) => n.isChange).map((item) => { - return { - queryType: item.queryType, - tableName: item.tableName, - columnName: item.columnName, - // columnValue: [] - columnValue: this.form[item.columnName] && - (itemTypes.includes(item.queryType) || - itemTypes.includes(item.itemType) || item.multiSelect == 1 - ? this.form[item.columnName] - : [this.form[item.columnName].toString()]) - } - }) - const arr2 = arr.filter(item => item.columnValue.length > 0) - let arr1 = this.fixedList - .filter((n) => n.columnValue.length > 0) - .map((item) => { + if (this.showSmartSearchForm) { + let refObj = this.$refs['ref_rule'] + + refObj.getRule() + } else { + // console.log('formmmmm---', this.form) + const itemTypes = ['daterange', 'timerange', 'checkbox'] + let a = this.tempFormList.filter(item => item.itemType != 'inputRange') + let arr = a.filter((n) => n.isChange).map((item) => { return { - ...item + queryType: item.queryType, + tableName: item.tableName, + columnName: item.columnName, + // columnValue: [] + columnValue: this.form[item.columnName] && + (itemTypes.includes(item.queryType) || + itemTypes.includes(item.itemType) || item.multiSelect == 1 + ? this.form[item.columnName] + : [this.form[item.columnName].toString()]) } }) - let arr3 = [...arr1, ...arr2] - this.$emit('search', arr3) - return arr3 + const arr2 = arr.filter(item => item.columnValue.length > 0) + let arr1 = this.fixedList + .filter((n) => n.columnValue.length > 0) + .map((item) => { + return { + ...item + } + }) + let arr3 = [...arr1, ...arr2] + this.$emit('search', arr3) + return arr3 + } + }, handleOpenSearch () { this.openSearch = !this.openSearch diff --git a/src/views/components/smartSearchRule.vue b/src/views/components/smartSearchRule.vue index 62306c9b3..7def60b5c 100644 --- a/src/views/components/smartSearchRule.vue +++ b/src/views/components/smartSearchRule.vue @@ -3,145 +3,143 @@
- - - - - -
- + :key="ruleIndex"> +
- - - - - -
- + + + + + + - - - - - - -
+
-
+ + + + + + + + + +
-
-
+ +
- -
+
- - - - + v-model="ruleItem.personRule.colVal">
-
+ + + + + + + +
+ +
保存为常用查询条件
+
- - - - - - - +
@@ -204,11 +206,7 @@ export default { personChecked: false, houseChecked: false, - houseSel: true, - personSel: false, - - - smartList1: [ + smartList: [ { value: 'house', label: '房屋信息' @@ -232,48 +230,6 @@ export default { ], houseItemList: [],//房屋信息第二列 - resiRuleList: [ - { - ruleDesc: '',//规则描述文字,例如:基础信息性别等于女 - nextLogicalRel: '',//与上一条的关系;and、or - itemGroupId: '', - itemId: '', - queryType: '', - colTable: '', - colKey: '', - colVal: '', - - itemList: [], - colType: '',//详细参数的组件类型 - colOption: [], - itemGroupName: '', - itemLabel: '', - queryTypeName: '', - colValLabel: '', - nextLogicalRelName: '', - } - ], - - houseRuleList: [ - { - ruleDesc: '', - nextLogicalRel: '',//与上一条的关系;and、or - queryType: '', - colTable: '', - colKey: '', - colVal: '', - - titleName: '房屋信息', - colType: '',//详细参数的组件类型 - colOption: [], - itemGroupName: '房屋信息', - itemLabel: '', - queryTypeName: '', - colValLabel: '', - nextLogicalRelName: '', - } - ], - okflag: false, showPersonList: false, @@ -282,9 +238,10 @@ export default { smartRuleList: [ { selSmartType: 'house', + nextLogicalRel: '',//与上一条的关系;and、or + nextLogicalRelName: '', houseRule: { ruleDesc: '', - nextLogicalRel: '',//与上一条的关系;and、or queryType: '', colTable: '', colKey: '', @@ -297,11 +254,28 @@ export default { itemLabel: '', queryTypeName: '', colValLabel: '', - nextLogicalRelName: '', + + }, + personRule: { + ruleDesc: '',//规则描述文字,例如:基础信息性别等于女 + itemGroupId: '', + itemId: '', + queryType: '', + colTable: '', + colKey: '', + colVal: '', + + itemList: [], + colType: '',//详细参数的组件类型 + colOption: [], + itemGroupName: '', + itemLabel: '', + queryTypeName: '', + colValLabel: '', + } }, - ], } @@ -326,228 +300,228 @@ export default { handleSelSmartType (ruleIndex, item) { let oneData = this.smartRuleList[ruleIndex] - if (item.value === 'house') { - oneData.houseRule = { - ruleDesc: '', - nextLogicalRel: '',//与上一条的关系;and、or - queryType: '', - colTable: '', - colKey: '', - colVal: '', - - titleName: '房屋信息', - colType: '',//详细参数的组件类型 - colOption: [], - itemGroupName: '房屋信息', - itemLabel: '', - queryTypeName: '', - colValLabel: '', - nextLogicalRelName: '', - } + // if (item.value === 'house') { + oneData.houseRule = { + ruleDesc: '', + queryType: '', + colTable: '', + colKey: '', + colVal: '', + + titleName: '房屋信息', + colType: '',//详细参数的组件类型 + colOption: [], + itemGroupName: '房屋信息', + itemLabel: '', + queryTypeName: '', + colValLabel: '', - } else { - oneData.personRule = { - ruleDesc: '',//规则描述文字,例如:基础信息性别等于女 - nextLogicalRel: '',//与上一条的关系;and、or - itemGroupId: '', - itemId: '', - queryType: '', - colTable: '', - colKey: '', - colVal: '', + } + oneData.personRule = { + ruleDesc: '',//规则描述文字,例如:基础信息性别等于女 + itemGroupId: '', + itemId: '', + queryType: '', + colTable: '', + colKey: '', + colVal: '', + + itemList: [], + colType: '',//详细参数的组件类型 + colOption: [], + itemGroupName: '', + itemLabel: '', + queryTypeName: '', + colValLabel: '', - itemList: [], - colType: '',//详细参数的组件类型 - colOption: [], - itemGroupName: '', - itemLabel: '', - queryTypeName: '', - colValLabel: '', - nextLogicalRelName: '', - } } + // } else { + + // } + this.$set(this.smartRuleList, ruleIndex, oneData) + console.log(this.smartRuleList) }, - async setRule (resiRuleList, houseRuleList) { - // this.startLoading() - if (this.groupList.length == 0 || this.houseItemList.length === 0) { - setTimeout(() => { - this.setRule(resiRuleList, houseRuleList); - }, 500); - return false - } + // async setRule (smartRuleList, smartRuleList) { + // // this.startLoading() + // if (this.groupList.length == 0 || this.houseItemList.length === 0) { + // setTimeout(() => { + // this.setRule(smartRuleList, smartRuleList); + // }, 500); + // return false + // } - this.resiRuleList = resiRuleList - if (this.resiRuleList && this.resiRuleList.length > 0) { - this.personChecked = true - for (let i = 0; i < this.resiRuleList.length; i++) { - let element = this.resiRuleList[i] + // 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) + // let selGroup = this.groupList.filter((item) => + // element.itemGroupId === item.id + // ); + // console.log(selGroup) - if (selGroup.length > 0) { - await this.handleSelGroup(i, selGroup[0], true) + // 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) - } + // 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.houseChecked = true - this.houseRuleList.forEach((element, index) => { + // 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 - ); + // 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) + // } - }); - } + // }); + // } - }, + // }, getRule () { this.okflag = false - - let messageObj = this.validateRule(this.personChecked, this.houseChecked) - - // console.log('resiRuleList', this.resiRuleList) - // console.log('houseRuleList', this.houseRuleList) + let messageObj = this.validateRule() if (messageObj) { this.$message.error(messageObj) } else { - if (this.resiRuleList.length > 0) { - this.resiRuleList[this.resiRuleList.length - 1].nextLogicalRel = '' + if (this.smartRuleList.length > 0) { + this.smartRuleList[this.smartRuleList.length - 1].nextLogicalRel = '' } - - if (this.houseRuleList.length > 0) { - this.houseRuleList[this.houseRuleList.length - 1].nextLogicalRel = '' - } - - + console.log('smartRuleList', this.smartRuleList) this.okflag = true } }, - validateRule (valPerson, valHouse) { + validateRule () { let message = '' - if (valPerson) { - this.resiRuleList.forEach((item, index) => { + this.smartRuleList.forEach((item, index) => { + if (item.selSmartType === 'person') { - if (item.itemGroupId === '' || - item.itemId === '' || - item.queryType === '' || - item.colKey === '' + if (item.personRule.itemGroupId === '' || + item.personRule.itemId === '' || + item.personRule.queryType === '' || + item.personRule.colKey === '' ) { - message = '匹配规则' + (this.index + 1) + '人员信息不完整,请填写完整!' - return message - } - if ((index != this.resiRuleList.length - 1) && item.nextLogicalRel === '') { - message = '匹配规则' + (this.index + 1) + '人员信息不完整,请填写完整!' + message = '第' + (index + 1) + '行人员信息不完整,请填写完整!' return message } - if ((item.queryType !== 'is_null' && item.queryType !== 'is_not_null') && item.colVal === '') { - message = '匹配规则' + (this.index + 1) + '人员信息不完整,请填写完整!' + if ((item.personRule.queryType !== 'is_null' && item.personRule.queryType !== 'is_not_null') && item.personRule.colVal === '') { + message = '第' + (index + 1) + '行人员信息不完整,请填写完整!' return message } + } - }); - - - } - - if (valHouse) { + if (item.selSmartType === 'house') { - this.houseRuleList.forEach((item, index) => { - if (item.itemGroupId === '' || - item.itemId === '' || - item.queryType === '' || - item.colKey === '' + if (item.houseRule.itemGroupId === '' || + item.houseRule.itemId === '' || + item.houseRule.queryType === '' || + item.houseRule.colKey === '' ) { - message = '匹配规则' + (this.index + 1) + '房屋信息不完整,请填写完整!' - return message - } - if ((index != this.houseRuleList.length - 1) && item.nextLogicalRel === '') { - message = '匹配规则' + (this.index + 1) + '房屋信息不完整,请填写完整!' + message = '第' + (index + 1) + '行房屋信息不完整,请填写完整!' return message } - if ((item.queryType !== 'is_null' && item.queryType !== 'is_not_null') && item.colVal === '') { - message = '匹配规则' + (this.index + 1) + '房屋信息不完整,请填写完整!' + + if ((item.houseRule.queryType !== 'is_null' && item.houseRule.queryType !== 'is_not_null') && item.houseRule.colVal === '') { + message = '第' + (index + 1) + '行房屋信息不完整,请填写完整!' return message } + } - }); - } - - - + if ((index != this.smartRuleList.length - 1) && item.nextLogicalRel === '') { + message = '第' + (index + 1) + '行逻辑选项不能为空!' + return message + } + }); return message }, - handlePreview () { - if (!this.personChecked && !this.houseChecked) { - this.$message.info('请勾选要预览的规则') - return false - } + handleClose () { + this.showPersonList = false + }, - this.getRule() - if (!this.okflag) { - return false - } - this.ruleList = {} - this.ruleList = { - resiRuleList: [], - houseRuleList: [], + addRule () { - } + let obj = { + selSmartType: 'house', + nextLogicalRel: '',//与上一条的关系;and、or + nextLogicalRelName: '', + houseRule: { + ruleDesc: '', + queryType: '', + colTable: '', + colKey: '', + colVal: '', - if (this.personChecked) { - this.ruleList.resiRuleList = this.resiRuleList - } - if (this.houseChecked) { - this.ruleList.houseRuleList = this.houseRuleList - } + titleName: '房屋信息', + colType: '',//详细参数的组件类型 + colOption: [], + itemGroupName: '房屋信息', + itemLabel: '', + queryTypeName: '', + colValLabel: '', + }, + personRule: { + ruleDesc: '',//规则描述文字,例如:基础信息性别等于女 + itemGroupId: '', + itemId: '', + queryType: '', + colTable: '', + colKey: '', + colVal: '', - this.showPersonList = true - }, + itemList: [], + colType: '',//详细参数的组件类型 + colOption: [], + itemGroupName: '', + itemLabel: '', + queryTypeName: '', + colValLabel: '', + } + } - handleClose () { - this.showPersonList = false + this.smartRuleList.push(obj) + }, + delRule (index) { + this.smartRuleList.splice(index, 1); }, + //选择人员信息第一列下拉框 - async handleSelGroup (personIndex, item, isSet) { + async handleSelGroup (ruleIndex, item, isSet) { const url = '/oper/customize/icformitem/getItemListV2' // const url = 'http://yapi.elinkservice.cn/mock/245/gov/org/isServiceProject/service/serviceScopeTree' let params = { @@ -560,20 +534,20 @@ export default { if (code === 0) { - let oneData = this.resiRuleList[personIndex] - oneData.itemGroupName = item.label - oneData.itemList = data - oneData.colTable = item.tableName + let oneData = this.smartRuleList[ruleIndex] + oneData.personRule.itemGroupName = item.label + oneData.personRule.itemList = data + oneData.personRule.colTable = item.tableName if (!isSet) {//如果是详情,赋值,不需要置空 - oneData.nextLogicalRel = '' - oneData.itemId = '' - oneData.queryType = '' - oneData.colKey = '' - oneData.colVal = '' + + oneData.personRule.itemId = '' + oneData.personRule.queryType = '' + oneData.personRule.colKey = '' + oneData.personRule.colVal = '' } - this.$set(this.resiRuleList, personIndex, oneData) + this.$set(this.smartRuleList, ruleIndex, oneData) } else { this.$message.error(msg) @@ -581,18 +555,18 @@ export default { }, //选择人员信息第二列下拉框 - async handleSelGroupItem (personIndex, item, isSet) { + async handleSelGroupItem (ruleIndex, item, isSet) { - let oneData = this.resiRuleList[personIndex] + let oneData = this.smartRuleList[ruleIndex] - oneData.colKey = item.columnName - oneData.colType = item.itemType - oneData.itemLabel = item.label + oneData.personRule.colKey = item.columnName + oneData.personRule.colType = item.itemType + oneData.personRule.itemLabel = item.label if (!isSet) {//如果是详情,赋值,不需要置空 - oneData.nextLogicalRel = '' - oneData.queryType = '' - oneData.colVal = '' + + oneData.personRule.queryType = '' + oneData.personRule.colVal = '' } if (item.optionSourceType === 'remote') { @@ -603,61 +577,54 @@ export default { const { data, code, msg } = await requestPost(url, params) if (code === 0) { - oneData.colOption = data + oneData.personRule.colOption = data } else { this.$message.error(msg) } } else { - oneData.colOption = item.options + oneData.personRule.colOption = item.options } - this.$set(this.resiRuleList, personIndex, oneData) + this.$set(this.smartRuleList, ruleIndex, oneData) }, //选择人员信息第三列 - handleSelPersonQuery (personIndex, item) { - let oneData = this.resiRuleList[personIndex] - oneData.queryTypeName = item.label + handleSelPersonQuery (ruleIndex, item) { + let oneData = this.smartRuleList[ruleIndex] + oneData.personRule.queryTypeName = item.label - oneData.nextLogicalRel = '' - oneData.colVal = '' - oneData.colValLabel = '' - this.$set(this.resiRuleList, personIndex, oneData) + oneData.personRule.colVal = '' + oneData.personRule.colValLabel = '' + + this.$set(this.smartRuleList, ruleIndex, oneData) }, //选择人员信息第四列 - handleSelPersonValue (personIndex, item) { - let oneData = this.resiRuleList[personIndex] - - oneData.colValLabel = item.label - oneData.nextLogicalRel = '' + handleSelPersonValue (ruleIndex, item) { + let oneData = this.smartRuleList[ruleIndex] - this.$set(this.resiRuleList, personIndex, oneData) - }, - //选择人员信息第五列 - handleSelPersonLogical (personIndex, item) { - let oneData = this.resiRuleList[personIndex] + oneData.personRule.colValLabel = item.label - oneData.nextLogicalRelName = item.label - this.$set(this.resiRuleList, personIndex, oneData) + this.$set(this.smartRuleList, ruleIndex, oneData) }, + //选择房屋信息第二列下拉框 - async handleSelHouseItem (houseIndex, item, isSet) { + async handleSelHouseItem (ruleIndex, item, isSet) { - let oneData = this.houseRuleList[houseIndex] + let oneData = this.smartRuleList[ruleIndex] - oneData.colTable = item.tableName - oneData.colType = item.itemType - oneData.itemLabel = item.label + oneData.houseRule.colTable = item.tableName + oneData.houseRule.colType = item.itemType + oneData.houseRule.itemLabel = item.label if (!isSet) {//如果是详情,赋值,不需要置空 - oneData.nextLogicalRel = '' - oneData.queryType = '' - oneData.colVal = '' + + oneData.houseRule.queryType = '' + oneData.houseRule.colVal = '' } if (item.optionSourceType === 'remote') { @@ -672,47 +639,47 @@ export default { const { data, code, msg } = await requestPost(url, params) if (code === 0) { - oneData.colOption = data + oneData.houseRule.colOption = data } else { this.$message.error(msg) } } else { - oneData.colOption = [] + oneData.houseRule.colOption = [] } - this.$set(this.houseRuleList, houseIndex, oneData) + this.$set(this.smartRuleList, ruleIndex, oneData) }, //选择房屋第三列 - handleSelHouseQuery (houseIndex, item) { - let oneData = this.houseRuleList[houseIndex] - oneData.queryTypeName = item.label + handleSelHouseQuery (ruleIndex, item) { + let oneData = this.smartRuleList[ruleIndex] + oneData.houseRule.queryTypeName = item.label + - oneData.nextLogicalRel = '' - oneData.colVal = '' - oneData.colValLabel = '' + oneData.houseRule.colVal = '' + oneData.houseRule.colValLabel = '' - this.$set(this.houseRuleList, houseIndex, oneData) + this.$set(this.smartRuleList, ruleIndex, oneData) }, //选择房屋第四列 - handleSelHouseValue (houseIndex, item) { - let oneData = this.houseRuleList[houseIndex] - oneData.colValLabel = item.label - oneData.nextLogicalRel = '' + handleSelHouseValue (ruleIndex, item) { + let oneData = this.smartRuleList[ruleIndex] + oneData.houseRule.colValLabel = item.label - this.$set(this.houseRuleList, houseIndex, oneData) + + this.$set(this.smartRuleList, ruleIndex, oneData) }, - //选择房屋第五列 - handleSelHouseLogical (houseIndex, item) { - let oneData = this.houseRuleList[houseIndex] + + //选择第五列:逻辑 + handleSelLogical (ruleIndex, item) { + let oneData = this.smartRuleList[ruleIndex] oneData.nextLogicalRelName = item.label - this.$set(this.houseRuleList, houseIndex, oneData) + this.$set(this.smartRuleList, ruleIndex, oneData) }, - // 获取人员信息---第一列 async loadPersonGroup () { const url = '/oper/customize/icformitemgroup/list' @@ -784,45 +751,6 @@ export default { } }, computed: { - dataRule () { - return { - - - serviceTimeStart: [ - { required: true, message: '服务时间不能为空', trigger: 'blur' } - ], - serviceScope: [ - { required: true, message: '服务范围不能为空', trigger: 'blur' } - ], - - } - }, - feedbackDataRule () { - return { - - - serviceGoal: [ - { required: true, message: '服务目标不能为空', trigger: 'blur' } - ], - - serviceEffect: [ - { required: true, message: '服务效果不能为空', trigger: 'blur' } - ], - servicePeopleNumber: [ - { required: true, message: '服务人数不能为空', trigger: 'blur' } - ], - serviceStatus: [ - { required: true, message: '服务状态不能为空', trigger: 'blur' } - ], - satisfaction: [ - { required: true, message: '满意度不能为空', trigger: 'blur' } - ], - address: [ - { required: true, message: '地址不能为空', trigger: 'blur' } - ] - } - }, - }, props: { @@ -830,10 +758,7 @@ export default { type: String, required: 'true' }, - index: { - type: Number, - default: 1 - }, + } } @@ -842,7 +767,7 @@ export default {