From a2b22eb61b56e7aa2a815c147e7bca7bad70f39a Mon Sep 17 00:00:00 2001 From: xzg <4727863@qq.com> Date: Fri, 26 Apr 2024 19:41:27 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BA=93=E4=BD=8D=E5=9C=A8=E5=BA=93=E6=95=B0?= =?UTF-8?q?=E5=B1=95=E7=A4=BA=EF=BC=8C=E8=B4=A2=E5=8A=A1=E5=AF=BC=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/utils/poptxt.js | 16 +--- src/views/Pricesystem/ListOfPriceSystems.vue | 88 ++++++++++++++++++- .../basicdata/brand/basicdataFreight.vue | 9 +- .../BasicdataGoodsAllocationDetails.vue | 7 -- .../distributionStockListDetails.vue | 37 +++++--- .../financialsector/CustomerBaseprice.vue | 79 +++-------------- 6 files changed, 133 insertions(+), 103 deletions(-) diff --git a/src/utils/poptxt.js b/src/utils/poptxt.js index 98023724..f77a11c3 100644 --- a/src/utils/poptxt.js +++ b/src/utils/poptxt.js @@ -1,15 +1,5 @@ -import { ElMessage } from 'element-plus' // 引入 ElMessage 组件 export function popmsg(res) { // 显示成功消息 - if (res.msg == '导入成功') { - ElMessage({ - message: res.msg, - type: 'success', - }); - return; - }else{ - - // 创建包含 p 标签的内容的 div 元素 var fragment = document.createDocumentFragment(); var div = document.createElement('div'); @@ -23,14 +13,14 @@ export function popmsg(res) { div.style.left = '50%'; div.style.transform = 'translate(-50%, -50%)'; div.style.width = '50%'; - div.style.height = '200px'; + div.style.height = '50%'; div.style.backgroundColor = '#ffffff'; div.style.borderRadius = '4px'; div.style.overflow = 'scroll'; div.style.border = '1px solid #ccc'; div.style.padding = '10px'; // 将后端返回的内容作为 HTML 插入到 div 中 - div.innerHTML = res.msg; + div.innerHTML = res.data; // 遍历所有的 <p> 标签并设置首行缩进 var pTags = div.querySelectorAll('p'); pTags.forEach(function (pTag) { @@ -63,5 +53,5 @@ export function popmsg(res) { // 添加点击事件监听 document.addEventListener('click', closePopupOnClickOutside); - } + } \ No newline at end of file diff --git a/src/views/Pricesystem/ListOfPriceSystems.vue b/src/views/Pricesystem/ListOfPriceSystems.vue index 2bf91694..1bc5f7ce 100644 --- a/src/views/Pricesystem/ListOfPriceSystems.vue +++ b/src/views/Pricesystem/ListOfPriceSystems.vue @@ -16,7 +16,14 @@ <!-- 控件模块 --> <div class="flex-c-sb"> <!-- 头部左侧按钮模块 --> - <div class="avue-crud__left"></div> + <div class="avue-crud__left"> + <el-button type="primary" @click="exporTemp"> + <el-icon><Download /></el-icon>导出模板</el-button + > + <el-button type="primary" @click="ImportTemplate"> + <el-icon><Download /></el-icon>导入模板</el-button + > + </div> <!-- 头部右侧按钮模块 --> <div class="avue-crud__right"> <el-button type="primary" icon="el-icon-search" @click="searchChange">搜 索</el-button> @@ -143,7 +150,32 @@ </span> </template> </el-dialog> + <!-- 导入模板 --> + <el-dialog v-model="dialogTemp" title="导入模板" width="500"> + <el-upload + class="upload-demo" + drag + action="/api/logpm-basicdata/basicdataPrice/upload" + :headers="headers" + :on-success="handleSuccess" + :before-upload="beforeAvatarUpload" + method="post" + > + <el-icon class="el-icon--upload"><upload-filled /></el-icon> + <div class="el-upload__text">点击上传 <em>或者拖拽上传</em></div> + <template #tip> + <div class="el-upload__tip">请上传Excel模板文件</div> + </template> + </el-upload> + <template #footer> + <div class="dialog-footer"> + <el-button @click="dialogTemp = false">关闭</el-button> + <el-button type="primary" @click="dialogVisible"> 确定 </el-button> + </div> + </template> + </el-dialog> + <div id="createdDiv"></div> <!-- 列表配置显示 --> <edittablehead @setcolum="setnewcolum" @@ -156,18 +188,21 @@ <script setup> import { ref, reactive, toRefs, computed, onMounted, nextTick, watch } from 'vue'; import { columnList } from '@/option/Pricesystem/index.js'; -import { $_getpriceTemplate, $_deletelpriceTemplate } from '@/api/financialsector/index'; //价格模板 +import { $_getpriceTemplate, $_deletelpriceTemplate , $_getexport} from '@/api/financialsector/index'; //价格模板 import { getBasicdataPrice, postBasicdataPrice } from '@/api/Pricesystem/index'; //价格模板 import { getDictionaryBiz } from '@/api/system/dict'; //字典 import { processRowProperty, setNodeHeight } from '@/utils/util'; +import { getToken } from 'utils/auth'; // 用于获取存储的Token import functions from '@/utils/functions.js'; import { ElMessageBox, ElMessage } from 'element-plus'; +import { popmsg } from '@/utils/poptxt'; import { downloadXls, deepClone } from '@/utils/util'; import { useStore } from 'vuex'; import dayjs from 'dayjs'; const $router = useRouter(); //跳转 const $useStore = useStore(); //权限 const $route = useRoute(); //获取地址栏参数 +const dialogTemp=ref(false) const details = reactive({ /** 是否开启搜索 */ search: false, @@ -239,7 +274,56 @@ const details = reactive({ /** 价格模板数组 */ templateArr: [], }); +const headers = computed(() => { + return { 'Blade-Auth': 'Bearer ' + getToken() }; +}); +const handleSuccess = res => { + if (res.code == 200 && !res.data) { + ElMessage({ + message: res.msg, + type: 'success', + }); + } else if (res.code == 200 && res.data) { + ElMessage({ + message: '导入失败,请查看原因重新导入!', + type: 'warning', + }); + popmsg(res); + } else{ + ElMessage({ + message: res.msg, + type: 'warning', + }); + } + console.log(res, 'datas'); +}; +// 上传文件之前 +const beforeAvatarUpload= (rawFile) => { + console.log(rawFile,'rawFile'); + + if (rawFile.type !== 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet') { + ElMessage.error('请上传EXCEL文件!') + return false + } + return true +} +// 导出模板 +const exporTemp = () => { + ElMessageBox.confirm('是否导出价格模板', '提示', { + confirmButtonText: '确认', + cancelButtonText: '取消', + type: 'warning', + }).then(() => { + $_getexport().then(res => { + downloadXls(res.data, `价格模板.xlsx`); + }); + }); +}; +// 导入模板 +const ImportTemplate = () => { + dialogTemp.value = true; +}; /** 生效时间 -- 生效时间不能大于到期时间 */ const time1 = time => { if (!details.form.expiryTime) return false; diff --git a/src/views/basicdata/brand/basicdataFreight.vue b/src/views/basicdata/brand/basicdataFreight.vue index 515a4412..47a5032c 100644 --- a/src/views/basicdata/brand/basicdataFreight.vue +++ b/src/views/basicdata/brand/basicdataFreight.vue @@ -735,8 +735,15 @@ export default { methods: { // 上传成功 async doubledCountSuce(res) { - await popmsg(res); + if (res.msg == '导入成功') { + ElMessage({ + message: res.msg, + type: 'success', + }); + }else{ + await popmsg(res); this.onLoad(this.page); + } }, uploadAfter(res, done, loading, column) { console.log('121221'); diff --git a/src/views/basicdata/warehouse/goodsAllocation/BasicdataGoodsAllocationDetails.vue b/src/views/basicdata/warehouse/goodsAllocation/BasicdataGoodsAllocationDetails.vue index f6d5e162..11fbe0bc 100644 --- a/src/views/basicdata/warehouse/goodsAllocation/BasicdataGoodsAllocationDetails.vue +++ b/src/views/basicdata/warehouse/goodsAllocation/BasicdataGoodsAllocationDetails.vue @@ -617,14 +617,7 @@ async function onLoad(page, params = {}) { default: break; } - - let query= JSON.parse($route.query.info) - console.log(query,'结构参数'); data.areaType =details.pageInfo.areaType - - - - let response = await geturl(url, data); if (response.data.code == 200) { console.log('res', response.data); diff --git a/src/views/distribution/inventory/distributionStockListDetails.vue b/src/views/distribution/inventory/distributionStockListDetails.vue index 8d22fe67..8f4d966d 100644 --- a/src/views/distribution/inventory/distributionStockListDetails.vue +++ b/src/views/distribution/inventory/distributionStockListDetails.vue @@ -41,6 +41,14 @@ </el-form-item> </el-col> </el-row> + + <el-row> + <el-col :span="10"> + <el-form-item label="在库数:"> + <span>{{ stockquantity || 0 }}</span> + </el-form-item> + </el-col> + </el-row> <!-- <el-row> <el-col :span="10"> <el-form-item label="库位信息:"> @@ -305,6 +313,7 @@ export default { data() { return { dialogVisibleF: false, + stockquantity:0,//在库数 html: '', columnListarrs: { //入库明细 @@ -564,17 +573,17 @@ export default { sortable: true, head: false, }, - { - prop: 'quantityStock', - label: '在库数', - type: 2, - values: '', - width: '150', - checkarr: [], - fixed: false, - sortable: true, - head: false, - }, + // { + // prop: 'quantityStock', + // label: '在库数', + // type: 2, + // values: '', + // width: '150', + // checkarr: [], + // fixed: false, + // sortable: true, + // head: false, + // }, { prop: 'num', label: '货位数', @@ -1162,9 +1171,15 @@ export default { // this.selectionClear(); // }); let a = await getList(page.currentPage, page.pageSize, Object.assign(params, this.query)); + console.log(a,'aaaa===>>'); + if(a.data.code !=200){ + return + } + console.log('aaaa', a.data.data.records); this.queryOwn = a.data.data.records[0] || {}; console.log(this.queryOwn, '参数'); + this.stockquantity= this.queryOwn.quantityStock ;//在库数量 if (!this.queryOwn.pid) { console.log('11111111111'); //查全部 diff --git a/src/views/financialsector/CustomerBaseprice.vue b/src/views/financialsector/CustomerBaseprice.vue index 7df8a7b9..b80a6086 100644 --- a/src/views/financialsector/CustomerBaseprice.vue +++ b/src/views/financialsector/CustomerBaseprice.vue @@ -85,42 +85,7 @@ </el-row> </div> - <!-- 导入模板 --> - <el-dialog - v-model="dialogTemp" - title="导入模板" - width="500" - > - <el-upload - class="upload-demo" - drag - action="/api/logpm-basicdata/basicdataPrice/upload" - multiple - :headers="headers" - :on-success="handleSuccess" - method="post" - > - <el-icon class="el-icon--upload"><upload-filled /></el-icon> - <div class="el-upload__text"> - 点击上传 <em>或者拖拽上传</em> - </div> - <template #tip> - <div class="el-upload__tip"> - 请上传Excel模板文件 - </div> - </template> - </el-upload> - - <template #footer> - <div class="dialog-footer"> - <el-button @click="dialogTemp = false">关闭</el-button> - <el-button type="primary" @click="dialogVisible"> - 确定 - </el-button> - </div> - </template> - </el-dialog> </basic-container> <!-- 列表配置显示 --> <edittablehead @@ -129,6 +94,9 @@ :drawerShow="drawerShow" :columnList="details.columnList" ></edittablehead> + + + </template> <script setup> @@ -136,20 +104,20 @@ import { ref, reactive, toRefs, computed, onMounted, nextTick, watch } from 'vue import { columnList } from '@/option/financialsector/index.js'; import { $_getpriceTemplate, - $_deletelpriceTemplate, - $_getexport, + $_deletelpriceTemplate } from '@/api/financialsector/index'; //价格模板 import { getDictionaryBiz } from '@/api/system/dict'; //字典 import { processRowProperty, setNodeHeight, deepClone, downloadXls } from '@/utils/util'; import { getToken } from 'utils/auth'; // 用于获取存储的Token import functions from '@/utils/functions.js'; import { ElMessageBox, ElMessage } from 'element-plus'; +import { popmsg } from '@/utils/poptxt'; import { useStore } from 'vuex'; import dayjs from 'dayjs'; const $router = useRouter(); //跳转 const $useStore = useStore(); //权限 const $route = useRoute(); //获取地址栏参数 -const dialogTemp=ref(true);//导入模板弹窗 +const dialogTemp = ref(false); //导入模板弹窗 const details = reactive({ /** 是否开启搜索 */ search: false, @@ -282,19 +250,7 @@ const timesc = (index, row) => { } }; -const headers = computed(() => { - return { 'Blade-Auth': 'Bearer ' + getToken() }; -}); -const handleSuccess=(data)=>{ -console.log(data,'datas'); -if(data.code==200 && data.data=='请维护客户信息中的基础数据'){ - ElMessage({ - message: data.data, - type: 'warning', - }) -}; -} /** 表格表头输入框搜索 */ const btnsc = val => { console.log(val); @@ -429,28 +385,13 @@ const Modifytemplate = row => { path: '/financialsector/FinanceHome', }); }; -// 导出模板 -const exporTemp = () => { - ElMessageBox.confirm('是否导出价格模板', 'Warning', { - confirmButtonText: '确认', - cancelButtonText: '取消', - type: 'warning', - }).then(() => { - $_getexport().then(res => { - downloadXls(res.data, `价格模板.xlsx`); - }); - }); -}; // 导入模板 -const ImportTemplate=()=>{ - dialogTemp.value=true - -} +const ImportTemplate = () => { + dialogTemp.value = true; +}; // 导出确定 -const dialogVisible=()=>{ - -} +const dialogVisible = () => {}; </script> <style scoped lang="scss">