diff --git a/src/views/components/resiSearch.vue b/src/views/components/resiSearch.vue index ddbd29fa..f9211028 100644 --- a/src/views/components/resiSearch.vue +++ b/src/views/components/resiSearch.vue @@ -4,6 +4,20 @@ +
+
所属组织
+
+ +
+
+
+
所属房屋
@@ -272,7 +286,7 @@ export default { }) let form = initForm(itemList, this.columnName) let tempFormList = itemList.map(item => { - + return { ...item, isChange: this.columnName && this.columnName === item.columnName ? true : false @@ -286,6 +300,14 @@ export default { UNIT_ID: '', HOME_ID: '' } + let orgOptionProps = { + multiple: false, + value: 'agencyId', + label: 'agencyName', + children: 'subAgencyList', + checkStrictly: true + } + return { pageLoading: false, openSearch: false, @@ -294,10 +316,14 @@ export default { optionsH: [], optionsD: [], optionsG: [], + orgOptions: [], + orgOptionProps, + agencyIdArray:[], value: '', itemList, fixedList: [], fixedForm: { + AGENCY_ID: '', GRID_ID: '', VILLAGE_ID: '', BUILD_ID: '', @@ -307,6 +333,7 @@ export default { constForm, form: { ...form, + AGENCY_ID: '', GRID_ID: '', VILLAGE_ID: '', BUILD_ID: '', @@ -344,6 +371,10 @@ export default { } } ] + }, + + queryType:{ + 'AGENCY_ID':'like' } } }, @@ -392,7 +423,7 @@ export default { created() { // this.initForm() // console.log('formcccc---', this.form) - + this.getOrgTreeList() this.getGridList() this.getValiheList() if (this.columnName) this.handleChangeForm(this.columnName) @@ -429,11 +460,12 @@ export default { } } else if (typeof this.form[n] == 'object') this.form[n] = [] else this.form[n] = '' - + } // let arr3 = [...arr1, ...arr] this.$emit('search', []) // this.handleSearch() + this.orgOptions = []; }, handleSearch() { // console.log('formmmmm---', this.form) @@ -445,7 +477,7 @@ export default { tableName: item.tableName, columnName: item.columnName, // columnValue: [] - columnValue: this.form[item.columnName] && + columnValue: this.form[item.columnName] && (itemTypes.includes(item.queryType) || itemTypes.includes(item.itemType) || item.multiSelect == 1 ? this.form[item.columnName] @@ -475,6 +507,28 @@ export default { this.form.BIRTHDAY = [s, e] } }, + handleChangeAgency(val) { + let obj = this.$refs["myCascader"].getCheckedNodes()[0].data + if (obj) { + if(obj.level === 'grid'){ + this.form.GRID_ID = this.agencyIdArray.length > 0 ? this.agencyIdArray[this.agencyIdArray.length - 1] : ''; + this.form.AGENCY_ID='' + }else{ + this.form.AGENCY_ID = this.agencyIdArray.length > 0 ? this.agencyIdArray[this.agencyIdArray.length - 1] : ''; + this.form.GRID_ID = '' + } + + }else{ + this.form.AGENCY_ID='' + this.form.GRID_ID = '' + } + + this.form.VILLAGE_ID = '' + this.form.BUILD_ID = '' + this.form.UNIT_ID = '' + this.form.HOME_ID = '' + this.getValiheList() + }, handleChangeGrid(val) { console.log('val', val) this.form.VILLAGE_ID = '' @@ -504,6 +558,7 @@ export default { // 监听基础form handleChangeForm(val) { for (let n in this.fixedForm) { + if (n === val) { if (this.fixedList.length > 0) { let _item = {} @@ -516,7 +571,7 @@ export default { console.log('fixedList----val', this.fixedList) } else { _item = { - queryType: 'equal', + queryType: this.queryType[val]?this.queryType[val]:'equal',//'equal', tableName: 'ic_resi_user', columnName: val, columnValue: [this.form[val]] @@ -528,7 +583,7 @@ export default { if (Object.keys(_item).length > 0 && !hasVal) this.fixedList.push(_item) } else { this.$set(this.fixedList, 0, { - queryType: 'equal', + queryType: this.queryType[val]?this.queryType[val]:'equal',//'equal', tableName: 'ic_resi_user', columnName: val, columnValue: [this.form[val]] @@ -541,6 +596,23 @@ export default { if (item.columnName === val) item.isChange = true }) }, + getOrgTreeList() { + const { user } = this.$store.state + this.$http + .post('/gov/org/customeragency/agencygridtree', {}) + .then(({ data: res }) => { + if (res.code !== 0) { + return this.$message.error(res.msg) + } else { + console.log('获取组织树成功', res.data) + this.orgOptions=[] + this.orgOptions .push( res.data) + } + }) + .catch(() => { + return this.$message.error('网络错误') + }) + }, getGridList() { const { user } = this.$store.state this.$http @@ -562,7 +634,7 @@ export default { this.$http .post('/gov/org/icneighborhood/neighborhoodoption', { gridId: this.form.GRID_ID, - agencyId: '' + agencyId: this.form.AGENCY_ID, // agencyId: user.agencyId }) .then(({ data: res }) => { @@ -627,10 +699,10 @@ export default { }) }, computedBirth(age) { - let now = new Date(); - let nowYear = now.getFullYear(); - let nowMonth = now.getMonth()+1; - let nowDay = now.getDate(); // 按照减法原理,先day相减,不够向month借;然后month相减,不够向year借;最后year相减。 + let now = new Date(); + let nowYear = now.getFullYear(); + let nowMonth = now.getMonth()+1; + let nowDay = now.getDate(); // 按照减法原理,先day相减,不够向month借;然后month相减,不够向year借;最后year相减。 let subYear = nowYear - age if(nowMonth < 10){ nowMonth = '0'+ nowMonth @@ -713,7 +785,7 @@ export default { width: 200px; } .resi-cell--daterange { - max-width: 260px; + max-width: 235px; } .resi-cell-select { width: 200px;