From 9487f3aca95d07d2de88cabd814634ad895ffe6e Mon Sep 17 00:00:00 2001 From: 13176889840 <13176889840@163.com> Date: Wed, 11 May 2022 15:07:26 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E5=B5=8C=E5=85=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/base/huji/immigration/edit.vue | 89 ++++++---- .../modules/base/huji/immigration/index.vue | 157 +++++++++++++----- 2 files changed, 174 insertions(+), 72 deletions(-) diff --git a/src/views/modules/base/huji/immigration/edit.vue b/src/views/modules/base/huji/immigration/edit.vue index 437ac47e..2aab95da 100644 --- a/src/views/modules/base/huji/immigration/edit.vue +++ b/src/views/modules/base/huji/immigration/edit.vue @@ -123,8 +123,6 @@ > @@ -288,27 +286,26 @@ 0) { const labels = this.$refs.nowArea.getCheckedNodes()[0].pathLabels - this.fmData.presentAddressCode = val[val.length - 1] - this.fmData.presentAddress = labels.join('-') - this.fmData.presentAddressPathCode = val.join(',') - console.log('presentAddress', this.formData.presentAddress) - this.$refs.ref_form.clearValidate('presentAddress') + this.fmData.sourceAddressCode = val[val.length - 1] + this.fmData.sourceAddress = labels.join('-') + this.fmData.sourceAddressPathCode = val.join(',') + console.log('sourceAddress', this.fmData.sourceAddressPathCode) + this.$refs.ref_form.clearValidate('sourceAddress') } else { - this.fmData.presentAddressCode = '' - this.fmData.presentAddress = '' - this.fmData.presentAddressPathCode = '' + this.fmData.sourceAddressCode = '' + this.fmData.sourceAddress = '' + this.fmData.sourceAddressPathCode = '' } }, handleBlurId(val) { @@ -707,9 +708,10 @@ export default { return this.$message.error(res.msg) } else { console.log('获取户主信息成功', res.data) - const { name } = res.data - if (name) { - this.fmData.houseHolderName = name + + if (res.data) { + const { name } = res.data + this.fmData.householderName = name this.alreadyHaveMaster = true } else { this.alreadyHaveMaster = false @@ -725,8 +727,14 @@ export default { this.$refs.ref_form.resetFields() this.formType = type + if (id) { - this.getDatail(id) + await this.getDatail(id) + } + if (this.formType != 'add') { + this.getBuildList() + this.getUniList() + this.getHouseList() } }, async getDatail(moveInId) { @@ -735,17 +743,18 @@ export default { const params = { moveInId: moveInId || '' } - const { data, code, msg } = await requestPost(url, this.fmData) + const { data, code, msg } = await requestPost(url, params) if (code === 0) { this.fmData = { ...data } + this.nowAllCode = data.sourceAddressPathCode && data.sourceAddressPathCode.split(',') } else this.$message.error(msg) }, async handleComfirm() { this.btnDisable = true - setTimeout(() => { - this.btnDisable = false - }, 10000) + // setTimeout(() => { + // this.btnDisable = false + // }, 10000) this.$refs['ref_form'].validate((valid, messageObj) => { if (!valid) { app.util.validateRule(messageObj) @@ -763,9 +772,27 @@ export default { }, async submit() { + if (this.fmData.isCHeck && this.userInfo && this.userInfo.resiHomeId) { + const { user } = this.$store.state + if (user.agencyId == this.userInfo.resiAgencyId) { + if (this.userInfo.resiHomeId !== this.fmData.homeId) { + this.$confirm('居民信息中房屋信息与当前选择房屋不一致,是否更新?', '提示', { + confirmButtonText: '更新', + cancelButtonText: '取消', + type: 'warning' + }).then(() => { + this.fmData.isReplace = '1' + }).catch(() => { + this.fmData.isReplace = '0' + }); + return + } + } + + } let url = '' if (this.formType === 'add') { - url = '/epmetuser/icMoveIn/save' + url = '/epmetuser/icMoveIn/add' } else { url = '/epmetuser/icMoveIn/edit' diff --git a/src/views/modules/base/huji/immigration/index.vue b/src/views/modules/base/huji/immigration/index.vue index f49e38cd..897365ca 100644 --- a/src/views/modules/base/huji/immigration/index.vue +++ b/src/views/modules/base/huji/immigration/index.vue @@ -235,7 +235,7 @@ border style="width: 100%" class="resi-table" - :height="maxTableHeight" + :height="tableHeight" > - + /> { + this.tableHeight = this.$store.state.inIframe ? h : _h + }) } }, mounted() { this.getGridList() this.getValiheList() this.getTableData() + this.searchH = this.$refs.searchCard.$el.offsetHeight + 260 + console.log('searchH----', this.$refs.searchCard.$el.offsetHeight) }, methods: { handleClearVillage() { @@ -796,38 +809,99 @@ export default { async handleChu() { const url = - '/heart/iccommunityselforganization/exportcommunityselforganization' + '/epmetuser/icMoveIn/export' const { pageSize, pageNo, fmData } = this - axios({ - url: window.SITE_CONFIG['apiURL'] + url, - method: 'post', + await this.$http({ + method: 'POST', + url, + responseType: 'blob', data: { pageSize, pageNo, ...fmData - }, - responseType: 'blob' + } }) - .then((res) => { - let fileName = window.decodeURI( - res.headers['content-disposition'].split(';')[1].split('=')[1] - ) - console.log('filename', fileName) - let blob = new Blob([res.data], { type: 'application/vnd.ms-excel' }) - var url = window.URL.createObjectURL(blob) - var aLink = document.createElement('a') - aLink.style.display = 'none' - aLink.href = url - aLink.setAttribute('download', fileName) - document.body.appendChild(aLink) - aLink.click() - document.body.removeChild(aLink) //下载完成移除元素 - window.URL.revokeObjectURL(url) //释放掉blob对象 + .then(res => { + console.log('res----dddd', res) + // this.download(res.data, title + '.xls') + // this.getTemplateList() + + // this.exportLoading = false + // if (res.data.code && res.data.code == 9999) { + // return this.$message.error(res.data.msg) + // } + this.formatData(res) + }) - .catch((err) => { - console.log('获取导出情失败', err) + .catch(err => { + console.log('err', err) + this.exportLoading = false return this.$message.error('网络错误') }) + // axios({ + // url: window.SITE_CONFIG['apiURL'] + url, + // method: 'post', + // data: { + // pageSize, + // pageNo, + // ...fmData + // }, + // responseType: 'blob' + // }) + // .then((res) => { + // let fileName = window.decodeURI( + // res.headers['content-disposition'].split(';')[1].split('=')[1] + // ) + // console.log('filename', fileName) + // let blob = new Blob([res.data], { type: 'application/vnd.ms-excel' }) + // var url = window.URL.createObjectURL(blob) + // var aLink = document.createElement('a') + // aLink.style.display = 'none' + // aLink.href = url + // aLink.setAttribute('download', fileName) + // document.body.appendChild(aLink) + // aLink.click() + // document.body.removeChild(aLink) //下载完成移除元素 + // window.URL.revokeObjectURL(url) //释放掉blob对象 + // }) + // .catch((err) => { + // console.log('获取导出情失败', err) + // return this.$message.error('网络错误') + // }) + }, + formatData(res) { + const fileReader = new FileReader() + fileReader.onloadend = () => { + try { + const jsonData = JSON.parse(fileReader.result) // 说明是普通对象数据,后台转换失败 + // 后台信息 + console.log('jsonData---1', jsonData) + return this.$message.error(jsonData.msg) + } catch (err) { // 解析成对象失败,说明是正常的文件流 + // 下载文件 + console.log('errr-----', err, this) + this.downloadFile(res) + } + } + fileReader.readAsText(res.data) + }, + downloadFile(res) { + if (res.headers["content-disposition"]) { + let fileName = window.decodeURI(res.headers["content-disposition"].split(";")[1].split("=")[1]) + console.log('filename', fileName) + let blob = new Blob([res.data], { type: 'application/vnd.ms-excel' }) + var url = window.URL.createObjectURL(blob) + var aLink = document.createElement('a') + aLink.style.display = 'none' + aLink.href = url + aLink.setAttribute('download', fileName) + document.body.appendChild(aLink) + aLink.click() + document.body.removeChild(aLink) //下载完成移除元素 + window.URL.revokeObjectURL(url) //释放掉blob对象 + this.$message.success('导出成功') + this.$emit('close') + } else this.$message.error('下载失败') }, async handleWatch(rowIndex) { @@ -923,9 +997,9 @@ export default { overflow: visible; } -.demo-form-inline .resi-cell { - display: flex; - align-items: center; +.demo-form-inline { + // display: flex; + // align-items: center; // margin-bottom: 20px; .resi-cell-label { @@ -965,6 +1039,7 @@ export default { margin-right: 0; } } + .mt10 { margin-top: 10px; } From 880bd944100e2e2fa963d2eb00d3043e8f406ff7 Mon Sep 17 00:00:00 2001 From: 13176889840 <13176889840@163.com> Date: Wed, 11 May 2022 15:48:29 +0800 Subject: [PATCH 2/2] dd --- src/views/modules/base/huji/immigration/edit.vue | 1 + 1 file changed, 1 insertion(+) diff --git a/src/views/modules/base/huji/immigration/edit.vue b/src/views/modules/base/huji/immigration/edit.vue index 2aab95da..9143e550 100644 --- a/src/views/modules/base/huji/immigration/edit.vue +++ b/src/views/modules/base/huji/immigration/edit.vue @@ -489,6 +489,7 @@ export default { type: 'error', message: `请联系${data.resiAgencyName}迁出该居民后操作` }) + this.btnDisable = true } this.userInfo = { ...data } } else {