From f974eaf3d62c4b5071408ecb7be4a4d7f93c30ee Mon Sep 17 00:00:00 2001 From: 13176889840 <13176889840@163.com> Date: Thu, 25 Nov 2021 15:05:37 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=9A=E5=91=98=E9=A3=8E=E9=87=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/communityParty/elegant/index.vue | 235 +++++++++++------- 1 file changed, 152 insertions(+), 83 deletions(-) diff --git a/src/views/modules/communityParty/elegant/index.vue b/src/views/modules/communityParty/elegant/index.vue index 07c0cf23..6dac5ac4 100644 --- a/src/views/modules/communityParty/elegant/index.vue +++ b/src/views/modules/communityParty/elegant/index.vue @@ -6,7 +6,7 @@ @@ -43,7 +43,6 @@ :with-credentials="true" :show-file-list="false" :auto-upload="true" - :on-progress="handleProgress" :on-success="handleExcelSuccess" :before-upload="beforeExcelUpload" :http-request="uploadHttpRequest" @@ -130,9 +129,10 @@ > - + @@ -140,16 +140,37 @@ - + - + - +
+
+ + +
+ + + + + +
@@ -172,10 +193,12 @@ import axios from 'axios' export default { data() { return { + uploadUlr: window.SITE_CONFIG['apiURL'] + '/oss/file/uploadqrcodeV2', importBtnTitle: '导入人员数据', importLoading: false, tableLoading: false, btnLoading: false, + uploading: false, disabled: false, pageLoading: false, dialogVisible: false, @@ -183,9 +206,12 @@ export default { pageSize: 20, total: null, tableData: [], + unloadPencent: 0, addLevel: '1', addType: 'add', value: '', + optionsEditG: [], + optionsG: [], options: [ { label: '是', @@ -220,7 +246,6 @@ export default { customerId: '', searchForm: { gridId: '', - agencyId: '', mainDeed: '', name: '' }, @@ -238,8 +263,11 @@ export default { }, async created() { this.customerId = localStorage.getItem('customerId') - this.getTableData() - this.getOptions() + setTimeout(() => { + this.getTableData() + this.getGridList('query') + this.getGridList('addorupdate') + }, 200) this.pageLoading = true }, mounted() { @@ -275,7 +303,9 @@ export default { } }, handleProgress(event, file, fileList) { - console.log('percentage', file.percentage) + console.log('percentage', event, file.percentage) + this.uploading = true + this.unloadPencent = Number(file.percentage.toFixed(0)) }, beforeExcelUpload (file) { console.log('file', file) @@ -287,10 +317,10 @@ export default { this.$message.error('上传文件只能是xls/xlsx格式!') } - // if (!isLt1M) { - // this.$message.error('上传图片大小不能超过 10MB!') - // } - return fileType + if (!isLt1M) { + this.$message.error('上传文件大小不能超过 10MB!') + } + return fileType && isLt1M }, uploadHttpRequest(file) { this.importLoading = true @@ -326,39 +356,64 @@ export default { }) }, handleExport() { - let params = { - formCode: 'resi_base_info', - conditions: this.conditions - } - + let params = {} + // window.location.href = window.SITE_CONFIG['apiURL'] + '/resi/partymember/icpartymemberstyle/export' // .post('epmetuser/icresiuser/exportExcel', params) - axios({ - url: window.SITE_CONFIG['apiURL'] + '/resi/partymember/icpartymemberstyle/export', - // url: 'epmetuser/icresiuser/exportExcel', - method: 'post', - data: params, - responseType: 'blob' - }) + // axios({ + // url: window.SITE_CONFIG['apiURL'] + '/resi/partymember/icpartymemberstyle/export', + // // url: 'epmetuser/icresiuser/exportExcel', + // method: 'post', + // data: params, + // responseType: 'blob' + // }) + this.$http.post('/resi/partymember/icpartymemberstyle/export') .then(res => { console.log('resllll', 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对象 + // 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('网络错误') }) }, + beforeImgUpload (file) { + const isPNG = (file.type === 'image/png') || (file.type === 'image/jpeg') + const isLt1M = file.size / 1024 / 1024 < 10 + + if (!isPNG) { + this.$message.error('上传图片只能是 PNG 或 JPEG 格式!') + } + if (!isLt1M) { + this.$message.error('上传图片大小不能超过 10MB!') + } + return isPNG && isLt1M + }, + handleImgSuccess (res, file) { + if (res.code === 0 && res.msg === 'success') { + + console.log('res.data.url', res.data.url) + this.uploading = false + this.unloadPencent = 0 + this.form.imageList.push(res.data.url) + + } else { + this.$message.error(res.msg) + } + }, + handleDelimg(item, index) { + this.form.imageList.splice(index, 1) + }, handleSearch(val) { console.log('searchhh--', val) this.currentPage = 1 @@ -372,34 +427,27 @@ export default { }, handlerCancle() { + for(const n in this.form) { + this.form[n] = '' + if (n === 'imageList') this.form[n] = [] + } + this.disabled = false this.dialogVisible = false }, async handleLook(row) { - const params = { - categoryId: row.categoryId, - usableFlag: !row.usableFlag - } - this.$http - .post('/heart/icresidemanddict/updatestatus', params) - .then(({ data: res }) => { - if (res.code !== 0) { - return this.$message.error(res.msg) - } else { - this.getTableData() - } - }) - .catch(() => { - return this.$message.error('网络错误') - }) + this.disabled = true + await this.getDetail(row.id) }, async handleEdit(row, addType) { - - this.form = { ...row } - this.dialogVisible = true + // this.form = { ...row } + await this.getDetail(row.id) + // this.dialogVisible = true }, async addNew() { + const { user } = await this.$store.state const _form = { - ...this.form + ...this.form, + agencyId: user.agencyId } await this.$http .post('/resi/partymember/icpartymemberstyle/save', _form) @@ -407,11 +455,13 @@ export default { if (res.code !== 0) { return this.$message.error(res.msg) } else { - this.dialogVisible = false + this.$message.success('操作成功') + this.handlerCancle() this.getTableData() } }) - .catch(() => { + .catch(err => { + console.log('err', err) return this.$message.error('网络错误') }) this.btnLoading = false @@ -450,20 +500,18 @@ export default { return this.$message.error('网络错误') }) }, - sortData() { - const _data = this.tableData.map((item, index)=> { - return { - id: item.id, - sort: index - } - }) + async getDetail(id) { + let params = { + id, + } this.$http - .post('/oper/customize/resicategorystatsconfig/updatesort', _data) + .post('/resi/partymember/icpartymemberstyle/detail', params) .then(({ data: res }) => { if (res.code !== 0) { return this.$message.error(res.msg) } else { - // this.getTableData() + this.form = { ...res.data } + this.dialogVisible = true } }) .catch((err) => { @@ -471,17 +519,20 @@ export default { return this.$message.error('网络错误') }) }, - async getOptions() { - const params = { - parentCategoryCode: 0 - } - this.$http - .post('/heart/icresidemanddict/subcodelist', params) + async getGridList(type, agencyId) { + const { user } = await this.$store.state + console.log('user---ppp', user) + // addorupdate query + await this.$http + .post('/gov/org/customergrid/gridoption', { agencyId: agencyId || user.agencyId, purpose: type }) .then(({ data: res }) => { if (res.code !== 0) { return this.$message.error(res.msg) } else { - this.demandOptions = res.data + console.log('获取查询详情成功', res.data) + + if (type === 'query') this.optionsG = res.data + else this.optionsEditG = res.data } }) .catch(() => { @@ -490,9 +541,10 @@ export default { }, async getTableData() { this.tableLoading = true + const { user } = await this.$store.state let params = { - // formCode: 'resi_base_info', ...this.searchForm, + agencyId: user.agencyId, pageNo: this.currentPage, pageSize: this.pageSize } @@ -544,6 +596,23 @@ export default { .input-width-textarea { width: 400px; } + .imsg-list { + display: flex; + align-items: center; + .imgs-item { + position: relative; + margin-right: 10px; + .el-icon-delete { + position: absolute; + top: 0; + right: 0; + font-size: 18px; + color: red; + z-index: 3; + cursor: pointer; + } + } + } } @@ -587,8 +656,8 @@ export default { border-color: #409EFF; } .avatar { - width: 70px; - height: 70px; + width: 100px; + height: 100px; display: block; } .avatar-uploader-icon { @@ -596,9 +665,9 @@ export default { border-radius: 6px; font-size: 28px; color: #8c939d; - width: 70px; - height: 70px; - line-height: 70px; + width: 100px; + height: 100px; + line-height: 100px; text-align: center; } }