diff --git a/src/assets/scss/common-dai.scss b/src/assets/scss/common-dai.scss index f1595043a..00da13333 100644 --- a/src/assets/scss/common-dai.scss +++ b/src/assets/scss/common-dai.scss @@ -478,7 +478,7 @@ img { bottom: 0; z-index: 1020; width: $sidebar--width + $sidebar--width-fold; - overflow: hidden; + // overflow: hidden; transition: width 0.3s; background-color: transparent; diff --git a/src/views/components/rangeInput.vue b/src/views/components/rangeInput.vue index a7cad965e..1aacc21cb 100644 --- a/src/views/components/rangeInput.vue +++ b/src/views/components/rangeInput.vue @@ -1,19 +1,18 @@ + + + + + + + + + + - - + + - - - - - - - - - - - - - - - - - - - + +
+
+ + + + + + + + + + + + + + + + +
+
- + - {{btnItem.name}} + {{ btnItem.name }} - + - + - 智能查询 - 重置 - 查询 - - {{boxHeight?'收起':'展开'}} - + 智能查询 + 重置 + 查询 + {{ boxHeight ? '收起' : '展开' }} @@ -242,7 +144,7 @@ export default { default: false } }, - data () { + data() { let initForm = (arr, columnName) => { let _form = {} // console.log('formInfo', obj) @@ -269,6 +171,8 @@ export default { ...item } }) + + let form = initForm(itemList, this.columnName) let tempFormList = itemList.map(item => { @@ -292,9 +196,23 @@ export default { children: 'subAgencyList', checkStrictly: true } + let endDisabledDate = (time) => {//这个关键属性我们一定要写在data的里面并且return的外面,这是动态改变区间的关键 + let nowData = Date.now() + if (this.updateStartDate) { + let startTime = new Date(this.updateStartDate) + return time.getTime() > nowData || time.getTime() < startTime || time.getTime() === startTime + } else { + return time.getTime() > nowData + } + + } + let startDisabledDate = (time) => {//这个关键属性我们一定要写在data的里面并且return的外面,这是动态改变区间的关键 + let nowData = Date.now() + return time.getTime() > nowData + } return { - boxHeight: false, + boxHeight: true, pageLoading: false, openSearch: false, optionsV: [], @@ -306,6 +224,7 @@ export default { orgOptionProps, agencyIdArray: [], value: '', + // 1 itemList, fixedList: [], fixedForm: { @@ -331,7 +250,7 @@ export default { shortcuts: [ { text: '最近一周', - onClick (picker) { + onClick(picker) { const end = new Date() const start = new Date() start.setTime(start.getTime() - 3600 * 1000 * 24 * 7) @@ -340,7 +259,7 @@ export default { }, { text: '最近一个月', - onClick (picker) { + onClick(picker) { const end = new Date() const start = new Date() start.setTime(start.getTime() - 3600 * 1000 * 24 * 30) @@ -349,7 +268,7 @@ export default { }, { text: '最近三个月', - onClick (picker) { + onClick(picker) { const end = new Date() const start = new Date() start.setTime(start.getTime() - 3600 * 1000 * 24 * 90) @@ -456,13 +375,23 @@ export default { }, ] } - ] - + ], + endPickerOptions: { + disabledDate: endDisabledDate + }, + startPickerOptions: { + disabledDate: startDisabledDate + }, + timer: { + startPickerTime: '', + endPickerTime: '' + } } }, computed: { - sliceList () { + sliceList() { return function (data, count) { + // 接收 if (data !== undefined) { let index = 0 let arrTemp = [] @@ -472,25 +401,25 @@ export default { arrTemp.push([]) } arrTemp[index].push(data[i]) + // console.log(data[i],'zhi'); } - console.log(arrTemp); return arrTemp } } }, - changeVDisabled () { + changeVDisabled() { return !this.form.VILLAGE_ID }, - changeBDisabled () { + changeBDisabled() { return !this.form.BUILD_ID }, - changeDDisabled () { + changeDDisabled() { return !this.form.UNIT_ID }, }, watch: { form: { - handler (val, val2) { + handler(val, val2) { // console.log('valpppp----', val, val2) for (let n in val) { if (this.constForm[n] !== val[n]) { @@ -501,9 +430,16 @@ export default { this.constForm = { ...val } }, deep: true + }, + timer: { + handler(newVal) { + this.handelWatchStartDate(newVal) + }, + deep: true, + immediate: true } }, - created () { + created() { // this.initForm() // console.log('formcccc---', this.form) this.getOrgTreeList() @@ -512,47 +448,51 @@ export default { if (this.columnName) this.handleChangeForm(this.columnName) }, methods: { - handleSmartSearch () { + handleSmartSearch() { this.showSmartSearchForm = !this.showSmartSearchForm }, - - handelSelSmartBtn (index) { + handelSelSmartBtn(index) { this.selBtnIndex = index }, - - initForm () { + handelWatchStartDate(val) { + return val + }, + initForm() { this.formList.forEach((item) => { this.$set(this.form, item.columnName, '') }) console.log('formcccc---', this.form) }, - computdSpan (len) { + computdSpan(len) { return len == 1 ? 24 : 6 }, - handleClearVillage () { + handleClearVillage() { this.form.BUILD_ID = '' this.form.HOME_ID = '' }, - handleClearBuild () { + handleClearBuild() { this.form.BUILD_ID = '' this.form.UNIT_ID = '' this.form.HOME_ID = '' }, - handleClearDan () { + handleClearDan() { this.form.UNIT_ID = '' this.form.HOME_ID = '' }, - resetForm (formName) { + resetForm(formName) { for (const n in this.form) { if (n == 'age') { this.form.age = { start: '', end: '' } + } else if (n == 'BIRTHDAY') { + this.form.BIRTHDAY = [] + this.timer.startPickerTime = null + this.timer.endPickerTime = null } else if (typeof this.form[n] == 'object') this.form[n] = [] else this.form[n] = '' - } this.agencyIdArray = [] // let arr3 = [...arr1, ...arr] @@ -560,21 +500,20 @@ export default { // this.handleSearch() // this.orgOptions = []; }, - handleSearch () { + handleSearch() { if (this.showSmartSearchForm) { let refObj = this.$refs['ref_rule'] - refObj.getRule() } else { + // debugger // 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) => { + 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 @@ -590,24 +529,47 @@ export default { ...item } }) - let arr3 = [...arr1, ...arr2] + var arr4 = [] + var arr3 = [...arr1, ...arr2]; + if (this.timer.startPickerTime && this.timer.endPickerTime) { + arr4 = [{ + queryType: 'daterange', + tableName: 'ic_resi_user', + columnName: 'BIRTHDAY', + columnValue: [this.timer.startPickerTime || '', this.timer.endPickerTime || ''] + }] + arr3 = [...arr1, ...arr2, ...arr4] + } else { + let i = arr3.findIndex(item => item.columnName == 'BIRTHDAY') + console.log(i, '标'); + arr3 = arr3.splice(i,1) + console.log(arr3); + } this.$emit('search', arr3) + arr3 = [] return arr3 + } }, - handleOpenSearch () { + handleOpenSearch() { this.openSearch = !this.openSearch }, - handleAgeChange (val) { + handleAgeChange(val) { + // debugger 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] - } + // console.log(v); + if(val.start){ + const s = this.computedBirth1(val.start) + const e = this.computedBirth(val.start) + this.form.BIRTHDAY = [s, e] + }else { + this.form.BIRTHDAY = [] + return + } + }, - handleChangeAgency (val) { + handleChangeAgency(val) { let obj = this.$refs["myCascader"].getCheckedNodes()[0].data if (obj) { if (obj.level === 'grid') { @@ -629,7 +591,7 @@ export default { this.form.HOME_ID = '' this.getValiheList() }, - handleChangeGrid (val) { + handleChangeGrid(val) { console.log('val', val) this.form.VILLAGE_ID = '' this.form.BUILD_ID = '' @@ -637,28 +599,27 @@ export default { this.form.HOME_ID = '' this.getValiheList() }, - handleChangeV (val) { + handleChangeV(val) { console.log('val', val) this.form.BUILD_ID = '' this.form.UNIT_ID = '' this.form.HOME_ID = '' this.getBuildList() }, - handleChangeB (val) { + handleChangeB(val) { console.log('val', val) this.form.UNIT_ID = '' this.form.HOME_ID = '' this.getUniList() }, - handleChangeD (val) { + handleChangeD(val) { console.log('val', val) this.form.HOME_ID = '' this.getHouseList() }, // 监听基础form - handleChangeForm (val) { + handleChangeForm(val) { for (let n in this.fixedForm) { - if (n === val) { if (this.fixedList.length > 0) { let _item = {} @@ -696,7 +657,7 @@ export default { if (item.columnName === val) item.isChange = true }) }, - getOrgTreeList () { + getOrgTreeList() { const { user } = this.$store.state this.$http .post('/gov/org/customeragency/agencygridtree', {}) @@ -713,7 +674,7 @@ export default { return this.$message.error('网络错误') }) }, - getGridList () { + getGridList() { const { user } = this.$store.state this.$http .post('/gov/org/customergrid/gridoption', { agencyId: user.agencyId, purpose: 'query' }) @@ -729,7 +690,7 @@ export default { return this.$message.error('网络错误') }) }, - getValiheList () { + getValiheList() { const { user } = this.$store.state this.$http .post('/gov/org/icneighborhood/neighborhoodoption', { @@ -749,7 +710,7 @@ export default { return this.$message.error('网络错误') }) }, - getBuildList () { + getBuildList() { this.$http .post('/gov/org/icbuilding/buildingoption', { neighborHoodId: this.form.VILLAGE_ID @@ -766,7 +727,7 @@ export default { return this.$message.error('网络错误') }) }, - getUniList () { + getUniList() { this.$http .post('/gov/org/icbuildingunit/unitoption', { buildingId: this.form.BUILD_ID @@ -783,7 +744,7 @@ export default { return this.$message.error('网络错误') }) }, - getHouseList () { + getHouseList() { this.$http .post('/gov/org/ichouse/houseoption', { unitId: this.form.UNIT_ID }) .then(({ data: res }) => { @@ -798,7 +759,7 @@ export default { return this.$message.error('网络错误') }) }, - computedBirth (age) { + computedBirth(age) { let now = new Date(); let nowYear = now.getFullYear(); let nowMonth = now.getMonth() + 1; @@ -810,8 +771,21 @@ export default { if (nowDay < 10) { nowDay = '0' + nowDay } - console.log(subYear + '-' + nowMonth + '-' + nowDay); return subYear + '-' + nowMonth + '-' + nowDay + }, + computedBirth1(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 + } + return subYear - 1 + '-' + nowMonth + '-' + nowDay } } } @@ -820,6 +794,8 @@ export default { diff --git a/src/views/main-sidebar.vue b/src/views/main-sidebar.vue index c6100e518..d4a1862b3 100644 --- a/src/views/main-sidebar.vue +++ b/src/views/main-sidebar.vue @@ -3,7 +3,7 @@