|
@ -1,8 +1,8 @@ |
|
|
<template> |
|
|
<template> |
|
|
<div class="resi-container"> |
|
|
<div class="resi-container"> |
|
|
<el-card class="resi-card"> |
|
|
<!-- <el-card class="resi-card"> --> |
|
|
<el-row class="resi-row-box" :class="openSearch && 'resi-row-more'"> |
|
|
<el-row class="resi-row-box" :class="!isArrow && 'resi-row-more'"> |
|
|
<el-row class="resi-row"> |
|
|
<el-row v-if="showGrid" class="resi-row"> |
|
|
<el-col :span="6"> |
|
|
<el-col :span="6"> |
|
|
<div class="resi-cell"> |
|
|
<div class="resi-cell"> |
|
|
<div class="resi-cell-label">所属网格</div> |
|
|
<div class="resi-cell-label">所属网格</div> |
|
@ -107,13 +107,13 @@ |
|
|
</el-col> |
|
|
</el-col> |
|
|
</el-row> |
|
|
</el-row> |
|
|
<el-row |
|
|
<el-row |
|
|
v-for="(item, index) in sliceList(formList, 4)" |
|
|
v-for="(item, index) in sliceList(itemList, 4)" |
|
|
:key="index" |
|
|
:key="index" |
|
|
class="resi-row" |
|
|
class="resi-row" |
|
|
> |
|
|
> |
|
|
<el-col v-for="n in item" :key="n.id" :span="6"> |
|
|
<el-col v-for="n in item" :key="n.id" :span="computdSpan(item.length)"> |
|
|
<div class="resi-cell"> |
|
|
<div class="resi-cell"> |
|
|
<div class="resi-cell-label">{{ n.label }}</div> |
|
|
<div class="resi-cell-label" :class="item.length != 4 && 'resi-cell-label1'">{{ n.label }}</div> |
|
|
<div |
|
|
<div |
|
|
class="resi-cell-value" |
|
|
class="resi-cell-value" |
|
|
:class="n.itemType === 'radio' && 'resi-cell-value-radio'" |
|
|
:class="n.itemType === 'radio' && 'resi-cell-value-radio'" |
|
@ -127,6 +127,16 @@ |
|
|
placeholder="请输入内容" |
|
|
placeholder="请输入内容" |
|
|
> |
|
|
> |
|
|
</el-input> |
|
|
</el-input> |
|
|
|
|
|
<template v-else-if="n.itemType == 'inputRange'"> |
|
|
|
|
|
<!-- <el-input |
|
|
|
|
|
v-model.trim="form[n.columnName]" |
|
|
|
|
|
class="resi-cell-input" |
|
|
|
|
|
size="small" |
|
|
|
|
|
clearable |
|
|
|
|
|
placeholder="请输入内容" |
|
|
|
|
|
/> --> |
|
|
|
|
|
<inputRange v-model="form[n.columnName]" :type="n.validType" @change="handleAgeChange" /> |
|
|
|
|
|
</template> |
|
|
<template v-else-if="n.itemType === 'datepicker'"> |
|
|
<template v-else-if="n.itemType === 'datepicker'"> |
|
|
<el-date-picker |
|
|
<el-date-picker |
|
|
v-if="n.queryType === 'daterange'" |
|
|
v-if="n.queryType === 'daterange'" |
|
@ -182,12 +192,18 @@ |
|
|
class="resi-cell-select" |
|
|
class="resi-cell-select" |
|
|
> |
|
|
> |
|
|
</el-cascader> |
|
|
</el-cascader> |
|
|
|
|
|
<template v-else-if="n.itemType === 'checkbox'"> |
|
|
|
|
|
<el-checkbox-group v-model="form[n.columnName]"> |
|
|
|
|
|
<el-checkbox v-for="ns in n.options" :key="ns.value" :label="ns.value">{{ns.label}}</el-checkbox> |
|
|
|
|
|
<!-- <el-checkbox label="n.la"></el-checkbox> --> |
|
|
|
|
|
</el-checkbox-group> |
|
|
|
|
|
</template> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</el-col> |
|
|
</el-col> |
|
|
</el-row> |
|
|
</el-row> |
|
|
</el-row> |
|
|
</el-row> |
|
|
<el-row class="resi-search"> |
|
|
<el-row v-if="isArrow" class="resi-search"> |
|
|
<!-- <el-col :span="20"> |
|
|
<!-- <el-col :span="20"> |
|
|
<el-button type="primary" size="mini">查询</el-button> |
|
|
<el-button type="primary" size="mini">查询</el-button> |
|
|
</el-col> --> |
|
|
</el-col> --> |
|
@ -196,17 +212,21 @@ |
|
|
<el-button class="diy-button--reset" size="small" @click="resetForm">重置</el-button> |
|
|
<el-button class="diy-button--reset" size="small" @click="resetForm">重置</el-button> |
|
|
</el-col> |
|
|
</el-col> |
|
|
</el-row> |
|
|
</el-row> |
|
|
<div class="resi-down" @click="handleOpenSearch"> |
|
|
<!-- <div v-if="isArrow" class="resi-down" @click="handleOpenSearch"> |
|
|
<img v-if="openSearch" src="../../assets/img/arrow-up.png" /> |
|
|
<img v-if="openSearch" src="../../assets/img/arrow-up.png" /> |
|
|
<img v-else src="../../assets/img/arrow-down.png" /> |
|
|
<img v-else src="../../assets/img/arrow-down.png" /> |
|
|
</div> |
|
|
</div> --> |
|
|
</el-card> |
|
|
<!-- </el-card> --> |
|
|
</div> |
|
|
</div> |
|
|
</template> |
|
|
</template> |
|
|
|
|
|
|
|
|
<script> |
|
|
<script> |
|
|
|
|
|
import inputRange from './rangeInput.vue' |
|
|
export default { |
|
|
export default { |
|
|
name: 'ResiSearch', |
|
|
name: 'ResiSearch', |
|
|
|
|
|
components: { |
|
|
|
|
|
inputRange |
|
|
|
|
|
}, |
|
|
props: { |
|
|
props: { |
|
|
formList: { |
|
|
formList: { |
|
|
type: Array, |
|
|
type: Array, |
|
@ -215,6 +235,14 @@ export default { |
|
|
columnName: { |
|
|
columnName: { |
|
|
type: String, |
|
|
type: String, |
|
|
default: '' |
|
|
default: '' |
|
|
|
|
|
}, |
|
|
|
|
|
showGrid: { |
|
|
|
|
|
type: Boolean, |
|
|
|
|
|
default: false |
|
|
|
|
|
}, |
|
|
|
|
|
isArrow: { |
|
|
|
|
|
type: Boolean, |
|
|
|
|
|
default: false |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
data() { |
|
|
data() { |
|
@ -226,13 +254,23 @@ export default { |
|
|
// return _form |
|
|
// return _form |
|
|
// } |
|
|
// } |
|
|
arr.forEach((item) => { |
|
|
arr.forEach((item) => { |
|
|
if (columnName && columnName === item.columnName) _form[item.columnName] = '1' |
|
|
if (item.itemType == 'checkbox') _form[item.columnName] = [] |
|
|
|
|
|
else if (columnName && columnName === item.columnName) _form[item.columnName] = '1' |
|
|
|
|
|
else if (item.itemType == 'inputRange') _form[item.columnName] = { start: '', end: ''} |
|
|
else _form[item.columnName] = '' |
|
|
else _form[item.columnName] = '' |
|
|
}) |
|
|
}) |
|
|
return _form |
|
|
return _form |
|
|
} |
|
|
} |
|
|
let form = initForm(this.formList, this.columnName) |
|
|
let itemList = this.formList.map(item => { |
|
|
let tempFormList = this.formList.map(item => { |
|
|
if (item.itemType == 'inputRange' && item.funType == 'agetoyear') { |
|
|
|
|
|
item.columnName = 'age' |
|
|
|
|
|
} |
|
|
|
|
|
return { |
|
|
|
|
|
...item |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
let form = initForm(itemList, this.columnName) |
|
|
|
|
|
let tempFormList = itemList.map(item => { |
|
|
|
|
|
|
|
|
return { |
|
|
return { |
|
|
...item, |
|
|
...item, |
|
@ -256,6 +294,7 @@ export default { |
|
|
optionsD: [], |
|
|
optionsD: [], |
|
|
optionsG: [], |
|
|
optionsG: [], |
|
|
value: '', |
|
|
value: '', |
|
|
|
|
|
itemList, |
|
|
fixedList: [], |
|
|
fixedList: [], |
|
|
fixedForm: { |
|
|
fixedForm: { |
|
|
GRID_ID: '', |
|
|
GRID_ID: '', |
|
@ -332,7 +371,7 @@ export default { |
|
|
}, |
|
|
}, |
|
|
changeDDisabled() { |
|
|
changeDDisabled() { |
|
|
return !this.form.UNIT_ID |
|
|
return !this.form.UNIT_ID |
|
|
} |
|
|
}, |
|
|
}, |
|
|
}, |
|
|
watch: { |
|
|
watch: { |
|
|
form: { |
|
|
form: { |
|
@ -352,6 +391,7 @@ export default { |
|
|
created() { |
|
|
created() { |
|
|
// this.initForm() |
|
|
// this.initForm() |
|
|
// console.log('formcccc---', this.form) |
|
|
// console.log('formcccc---', this.form) |
|
|
|
|
|
|
|
|
this.getGridList() |
|
|
this.getGridList() |
|
|
this.getValiheList() |
|
|
this.getValiheList() |
|
|
if (this.columnName) this.handleChangeForm(this.columnName) |
|
|
if (this.columnName) this.handleChangeForm(this.columnName) |
|
@ -363,6 +403,9 @@ export default { |
|
|
}) |
|
|
}) |
|
|
console.log('formcccc---', this.form) |
|
|
console.log('formcccc---', this.form) |
|
|
}, |
|
|
}, |
|
|
|
|
|
computdSpan(len) { |
|
|
|
|
|
return len == 1 ? 24 : 6 |
|
|
|
|
|
}, |
|
|
handleClearVillage() { |
|
|
handleClearVillage() { |
|
|
this.form.BUILD_ID = '' |
|
|
this.form.BUILD_ID = '' |
|
|
this.form.HOME_ID = '' |
|
|
this.form.HOME_ID = '' |
|
@ -378,28 +421,37 @@ export default { |
|
|
}, |
|
|
}, |
|
|
resetForm(formName) { |
|
|
resetForm(formName) { |
|
|
for(const n in this.form) { |
|
|
for(const n in this.form) { |
|
|
this.form[n] = '' |
|
|
if (n == 'age') { |
|
|
|
|
|
this.form.age = { |
|
|
|
|
|
start: '', |
|
|
|
|
|
end: '' |
|
|
|
|
|
} |
|
|
|
|
|
} else if (typeof this.form[n] == 'object') this.form[n] = [] |
|
|
|
|
|
else this.form[n] = '' |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
this.handleSearch() |
|
|
// let arr3 = [...arr1, ...arr] |
|
|
|
|
|
this.$emit('search', []) |
|
|
|
|
|
// this.handleSearch() |
|
|
}, |
|
|
}, |
|
|
handleSearch() { |
|
|
handleSearch() { |
|
|
// console.log('formmmmm---', this.form) |
|
|
// console.log('formmmmm---', this.form) |
|
|
const itemTypes = ['daterange', 'timerange'] |
|
|
const itemTypes = ['daterange', 'timerange', 'checkbox'] |
|
|
let arr = this.tempFormList |
|
|
let a = this.tempFormList.filter(item => item.itemType != 'inputRange') |
|
|
.filter((n) => n.isChange) |
|
|
let arr = a.filter((n) => n.isChange).map((item) => { |
|
|
.map((item) => { |
|
|
|
|
|
return { |
|
|
return { |
|
|
queryType: item.queryType, |
|
|
queryType: item.queryType, |
|
|
tableName: item.tableName, |
|
|
tableName: item.tableName, |
|
|
columnName: item.columnName, |
|
|
columnName: item.columnName, |
|
|
// columnValue: [] |
|
|
// columnValue: [] |
|
|
columnValue: |
|
|
columnValue: this.form[item.columnName] && |
|
|
itemTypes.includes(item.queryType) || |
|
|
(itemTypes.includes(item.queryType) || |
|
|
itemTypes.includes(item.itemType) |
|
|
itemTypes.includes(item.itemType) |
|
|
? this.form[item.columnName] |
|
|
? this.form[item.columnName] |
|
|
: [this.form[item.columnName].toString()] |
|
|
: [this.form[item.columnName].toString()]) |
|
|
} |
|
|
} |
|
|
}) |
|
|
}) |
|
|
|
|
|
const arr2 = arr.filter(item => item.columnValue.length > 0) |
|
|
let arr1 = this.fixedList |
|
|
let arr1 = this.fixedList |
|
|
.filter((n) => n.columnValue.length > 0) |
|
|
.filter((n) => n.columnValue.length > 0) |
|
|
.map((item) => { |
|
|
.map((item) => { |
|
@ -407,12 +459,21 @@ export default { |
|
|
...item |
|
|
...item |
|
|
} |
|
|
} |
|
|
}) |
|
|
}) |
|
|
let arr3 = [...arr1, ...arr] |
|
|
let arr3 = [...arr1, ...arr2] |
|
|
this.$emit('search', arr3) |
|
|
this.$emit('search', arr3) |
|
|
|
|
|
return arr3 |
|
|
}, |
|
|
}, |
|
|
handleOpenSearch() { |
|
|
handleOpenSearch() { |
|
|
this.openSearch = !this.openSearch |
|
|
this.openSearch = !this.openSearch |
|
|
}, |
|
|
}, |
|
|
|
|
|
handleAgeChange(val) { |
|
|
|
|
|
console.log('val----age---', val) |
|
|
|
|
|
if (val.end) { |
|
|
|
|
|
const s = this.computedBirth(val.end) |
|
|
|
|
|
const e = this.computedBirth(val.start) |
|
|
|
|
|
this.form.BIRTHDAY = [s, e] |
|
|
|
|
|
} |
|
|
|
|
|
}, |
|
|
handleChangeGrid(val) { |
|
|
handleChangeGrid(val) { |
|
|
console.log('val', val) |
|
|
console.log('val', val) |
|
|
this.form.VILLAGE_ID = '' |
|
|
this.form.VILLAGE_ID = '' |
|
@ -563,16 +624,35 @@ export default { |
|
|
.catch(() => { |
|
|
.catch(() => { |
|
|
return this.$message.error('网络错误') |
|
|
return this.$message.error('网络错误') |
|
|
}) |
|
|
}) |
|
|
|
|
|
}, |
|
|
|
|
|
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 subYear = nowYear - age |
|
|
|
|
|
if(nowMonth < 10){ |
|
|
|
|
|
nowMonth = '0'+ nowMonth |
|
|
|
|
|
} |
|
|
|
|
|
if(nowDay < 10){ |
|
|
|
|
|
nowDay = '0' + nowDay |
|
|
|
|
|
} |
|
|
|
|
|
console.log(subYear+'-'+nowMonth+'-'+nowDay); |
|
|
|
|
|
return subYear + '-' + nowMonth + '-' + nowDay |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
</script> |
|
|
</script> |
|
|
|
|
|
|
|
|
<style lang="scss" scope> |
|
|
<style lang="scss" scope> |
|
|
.resi-container .resi-card { |
|
|
// .resi-container { |
|
|
position: relative; |
|
|
// position: relative; |
|
|
overflow: visible; |
|
|
// overflow: visible; |
|
|
} |
|
|
// } |
|
|
|
|
|
// .resi-container .resi-card { |
|
|
|
|
|
// position: relative; |
|
|
|
|
|
// overflow: visible; |
|
|
|
|
|
// } |
|
|
.resi-down { |
|
|
.resi-down { |
|
|
position: absolute; |
|
|
position: absolute; |
|
|
left: 50%; |
|
|
left: 50%; |
|
@ -614,12 +694,15 @@ export default { |
|
|
align-items: center; |
|
|
align-items: center; |
|
|
.resi-cell-label { |
|
|
.resi-cell-label { |
|
|
flex-shrink: 0; |
|
|
flex-shrink: 0; |
|
|
width: 70px; |
|
|
min-width: 70px; |
|
|
box-sizing: border-box; |
|
|
box-sizing: border-box; |
|
|
margin-right: 15px; |
|
|
margin-right: 15px; |
|
|
text-align: right; |
|
|
text-align: right; |
|
|
// line-height: 32; |
|
|
// line-height: 32; |
|
|
} |
|
|
} |
|
|
|
|
|
.resi-cell-label1 { |
|
|
|
|
|
width: max-content; |
|
|
|
|
|
} |
|
|
.resi-cell-value-radio { |
|
|
.resi-cell-value-radio { |
|
|
display: flex; |
|
|
display: flex; |
|
|
align-items: center; |
|
|
align-items: center; |
|
|