diff --git a/src/api/basicdata/basicClient.js b/src/api/basicdata/basicClient.js index b96f5e60..0dc3e8a1 100644 --- a/src/api/basicdata/basicClient.js +++ b/src/api/basicdata/basicClient.js @@ -120,4 +120,14 @@ export const $_mainList = data => { method: 'post', data, }); -}; \ No newline at end of file +}; + +// 获取客户列表 +export const $_updateClientTime = data => { + return request({ + url: '/api/logpm-basicdata/basicdataClient/updateClientTime', + method: 'post', + data, + }); +}; + diff --git a/src/views/basicdata/brand/basicClient.vue b/src/views/basicdata/brand/basicClient.vue index 0cea2cd1..e0a17cf1 100644 --- a/src/views/basicdata/brand/basicClient.vue +++ b/src/views/basicdata/brand/basicClient.vue @@ -45,6 +45,7 @@ 新 增 删 除 导 入 + 批量修改
@@ -196,7 +197,7 @@ - + @@ -327,6 +328,28 @@ + + + + + + + + + + + + + @@ -343,14 +366,16 @@ import { getClientLogList, $_exportclientTemplate, $_mainList, + $_updateClientTime, } from '@/api/basicdata/basicClient'; import option from '@/option/basicdata/basicClient'; import { mapGetters } from 'vuex'; +import { ElMessage, ElMessageBox } from 'element-plus' import BasicShopSub from '@/views/basicdata/brand/basicShopSub.vue'; import { getDictionaryBiz } from '@/api/system/dict'; import { getSelect, getLazyTree, getLazyList, getLazyTreeAll } from '@/api/base/region'; import { getToken } from '@/utils/auth'; -import globalc from '@/api/basicdata/globalc'; +// import globalc from '@/api/basicdata/globalc'; import { Base64 } from 'js-base64'; import dayjs from 'dayjs'; import { exportBlob } from '@/api/common'; @@ -363,6 +388,12 @@ export default { }, data() { return { + formTime: { + contractEndTime: '', + contractStartTime: '', + }, + loadingTime: false, + dialogTime: false, excelForm: {}, clientloading: false, dictList: [], @@ -1075,7 +1106,76 @@ export default { encodeURIComponent(Base64.encode(row.leaseAccessories)) ); }, + // 批量修改合同时间 + BatchModify() { + if (!this.selectionList.length) { + ElMessage({ + message: '请勾选要修改的数据', + type: 'warning', + }) + return + } + this.formTime = {} + this.dialogTime = true; + }, + // 批量修改时间提交 + TimeSubmit() { + if (!this.formTime.contractEndTime && !this.formTime.contractStartTime) { + ElMessage({ + message: '开始时间和结束时间至少选择一个', + type: 'warning', + }) + return + } + ElMessageBox.confirm( + '是否确认批量修改?', + '提示', + { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning', + } + ) + .then(async () => { + try { + this.loading = true + this.loadingTime = true + let data = { + ...this.formTime, + ids: this.selectionList.map(item => item.id) + } + if (!data.contractEndTime) { + delete data.contractEndTime + } + if (!data.contractStartTime) { + delete data.contractStartTime + } + console.log(data, '准备提交的数据'); + let res = await $_updateClientTime(data) + const { code, msg } = res.data + if (code == 200) { + ElMessage({ + message: msg, + type: 'success', + }) + this.dialogTime = false; + this.onLoad(this.page); + } + } catch (e) { + this.loading = false; + console.log(e, 'e:=>>>>'); + + } finally { + this.loadingTime = false; + } + + }) + .catch(() => { + + }) + + }, async changeclientId() { $_mainList( { @@ -1306,10 +1406,10 @@ export default { }); return; } - if(this.form.mainId){ - this.form.mainName = this.dictList.find(item=>item.id == this.form.mainId).name;//客户主体名称 + if (this.form.mainId) { + this.form.mainName = this.dictList.find(item => item.id == this.form.mainId).name;//客户主体名称 } - + await add(this.form); this.box = false; this.onLoad(this.page); @@ -1350,8 +1450,8 @@ export default { }); return; } - if(this.form.mainId){ - this.form.mainName = this.dictList.find(item=>item.id == this.form.mainId).name;//客户主体名称 + if (this.form.mainId) { + this.form.mainName = this.dictList.find(item => item.id == this.form.mainId).name;//客户主体名称 } await update(this.form); this.box = false;