From a06ba7498c05c781947048ac94bfeff726968a63 Mon Sep 17 00:00:00 2001 From: xzg <4727863@qq.com> Date: Wed, 27 Mar 2024 19:11:41 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=9C=B0=E5=9B=BE=EF=BC=8C?= =?UTF-8?q?=E5=B7=B2=E7=9F=A5bug=EF=BC=8C=E6=B7=BB=E5=8A=A0=E5=AD=97?= =?UTF-8?q?=E6=AE=B5=EF=BC=8C=E5=8F=96=E6=B6=88=E8=AE=A1=E5=88=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../distributionDeliveryListdis.vue | 11 ++ .../distributionDeliveryListedt.vue | 155 +++++++++++------ .../distributionDeliveryListmar.vue | 14 +- .../distributionStockListDetails.vue | 164 +++++++++--------- src/views/distribution/reservation/atlas.vue | 162 ++++++++++++----- .../distribution/reservation/reservation.vue | 12 +- vite.config.js | 2 +- 7 files changed, 340 insertions(+), 180 deletions(-) diff --git a/src/views/distribution/deliverylist/distributionDeliveryListdis.vue b/src/views/distribution/deliverylist/distributionDeliveryListdis.vue index 7ce6ab55..8e7554b7 100644 --- a/src/views/distribution/deliverylist/distributionDeliveryListdis.vue +++ b/src/views/distribution/deliverylist/distributionDeliveryListdis.vue @@ -408,6 +408,17 @@ export default { sortable: true, hide: true, }, + { + prop: 'orderCode', + label: '订单自编号', + type: 2, + values: '', + width: '180', + checkarr: [], + fixed: false, + sortable: true, + hide: true, + }, { prop: 'kindName', label: '配送种类', diff --git a/src/views/distribution/deliverylist/distributionDeliveryListedt.vue b/src/views/distribution/deliverylist/distributionDeliveryListedt.vue index 10d04cc2..a402f8ac 100644 --- a/src/views/distribution/deliverylist/distributionDeliveryListedt.vue +++ b/src/views/distribution/deliverylist/distributionDeliveryListedt.vue @@ -128,11 +128,9 @@ <!-- </div>--> <!-- </div>--> <!-- </el-row>--> - <el-button type="warning" - plain - icon="el-icon-download" - @click="handleExport">导 出 - </el-button> + <el-button type="warning" plain icon="el-icon-download" @click="handleExport" + >导 出 + </el-button> <el-tabs v-model="activeTab" @tab-click="handleTabClick" @@ -607,9 +605,9 @@ <el-button @click="LdBatchsigning" style="margin-bottom: 4px" type="primary" >批量签收</el-button > - <el-button @click="LdBatchcancellation" style="margin-bottom: 4px" type="primary" + <!-- <el-button @click="LdBatchcancellation" style="margin-bottom: 4px" type="primary" >批量计划取消</el-button - > + > --> <tablecmt :columnList="wrapoption.LessThantruckloadListData" :tableData="LessThantruckloadListData" @@ -1782,17 +1780,17 @@ export default { fixed: false, sortable: true, }, - // { - // prop: 'fahuoTime', - // label: '发货时间', - // type: 1, - // values: '', - // width: '150', - // checkarr: [], - // fixed: false, - // sortable: true, - // head: false, - // }, + // { + // prop: 'fahuoTime', + // label: '发货时间', + // type: 1, + // values: '', + // width: '150', + // checkarr: [], + // fixed: false, + // sortable: true, + // head: false, + // }, { prop: 'warehouseEntryTimeEnd', label: '入库时间', @@ -3131,6 +3129,21 @@ export default { }, ], reservationInventoryoptioncolumn: [ + { + prop: '', + label: '复选框', + type: 0, + width: 55, + fixed: true, + }, + { + prop: '', + label: '序号', + type: 12, + values: '', + width: 55, + fixed: true, + }, { prop: 'incomingBatch', label: '入库批次号', @@ -4043,7 +4056,7 @@ export default { this.website.tokenHeader }=${getToken()}`; let values = { - deliveryId:this.deliveryId + deliveryId: this.deliveryId, }; this.$confirm('是否导出数据?', '提示', { confirmButtonText: '确定', @@ -4304,24 +4317,30 @@ export default { }); }, cancelReservationInventoryPackage(row) { - console.log('row', row); - console.log('deliveryId', this.deliveryId); - console.log('reservationId', this.wid); - this.$message.warning('功能维护中...'); - return; - - // let data = { - // deliveryId:this.deliveryId, - // reservationId:this.wid, - // type:1, - // packageIds:row.id - // } - // cancelReservationPackage(data).then(res=>{ - // if (res.data.code === 200){ - // this.$message.success(res.data.msg); - // this.getWrapdetails(this.page); - // } - // }) + this.$confirm('是否计划取消?') + .then(() => { + this.loading = true; //开启加载 + let data = { + deliveryId: this.deliveryId, + reservationId: this.wid, + type: 2, + packageIds: row.id, + }; + this.loading = true; + cancelReservationPackage(data) + .then(res => { + if (res.data.code === 200) { + this.$message.success(res.data.msg); + this.getReservationInventoryPackageListInfo(this.page); + } + }) + .catch(res => { + + }).finally(()=>{ + this.loading = false; + }); + }) + .catch(() => {}); }, signingReservationPackage(row) { console.log('row', row); @@ -4486,26 +4505,50 @@ export default { }, // 批量计划取消 Batchcancellation() { - let data = { - deliveryId: this.deliveryId, - reservationId: this.wid, - type: 1, - packageIds: this.selectionList.map(item => item.id).join(','), - }; - this.loading = true; - cancelReservationPackage(data) - .then(res => { - if (res.data.code === 200) { - this.$message.success(res.data.msg); - this.getWrapdetails(this.page); - } - this.selectionList = []; //清空选择 - this.loading = false; - }) - .catch(res => { - this.selectionList = []; //清空选择 - this.loading = false; + if (!this.selectionList.length) { + ElMessage({ + message: '请勾选需要计划取消的数据', + type: 'warning', }); + return; + } + let result = this.selectionList.every(item => item.stockSignfoStatus == 10 && item.stockLockingStatus==10); + if(!result){ + ElMessage({ + message: '有已经存在签收的订单,不满足批量签收条件', + type: 'warning', + }); + return + } + this.$confirm('是否进行批量计划取消?') + .then(() => { + this.loading = true; //开启加载 + let data = { + deliveryId: this.deliveryId, + reservationId: this.wid, + type: 2, + packageIds: this.selectionList.map(item => item.id).join(','), + }; + this.loading = true; + cancelReservationPackage(data) + .then(res => { + if (res.data.code === 200) { + this.$message.success(res.data.msg); + this.getReservationInventoryPackageListInfo(this.page); + } + this.selectionList = []; //清空选择 + this.loading = false; + }) + .catch(res => { + this.selectionList = []; //清空选择 + this.loading = false; + }); + }) + .catch(() => {}); + + + + }, /**printTemplate * 打印 diff --git a/src/views/distribution/deliverylist/distributionDeliveryListmar.vue b/src/views/distribution/deliverylist/distributionDeliveryListmar.vue index 13e6da8f..4aa33085 100644 --- a/src/views/distribution/deliverylist/distributionDeliveryListmar.vue +++ b/src/views/distribution/deliverylist/distributionDeliveryListmar.vue @@ -8,7 +8,7 @@ <el-input v-model="query.trainNumber" placeholder="请输入配送车次"></el-input> </el-form-item> <el-form-item label="客户名称:"> - <el-input v-model="query.clineName" placeholder="请客户名称"></el-input> + <el-input v-model="query.clineName" placeholder="请输入客户名称"></el-input> </el-form-item> <el-form-item label="配送日期:" class="el-times"> <el-date-picker v-model="query.taskTime" type="date" placeholder="选择日期"> @@ -318,7 +318,17 @@ export default { fixed: false, sortable: true, }, - + { + prop: 'orderCode', + label: '订单自编号', + type: 2, + type: 2, + values: '', + width: '140', + checkarr: [], + fixed: false, + sortable: true, + }, { prop: 'kindName', label: '配送种类', diff --git a/src/views/distribution/inventory/distributionStockListDetails.vue b/src/views/distribution/inventory/distributionStockListDetails.vue index 764c07a3..59742423 100644 --- a/src/views/distribution/inventory/distributionStockListDetails.vue +++ b/src/views/distribution/inventory/distributionStockListDetails.vue @@ -1,32 +1,66 @@ <template> - <basic-container v-loading="loadingObj.pageLoading"> + <basic-container> <div class="avue-crud"> - <el-divider>{{ $route.query.name }}</el-divider> + <!-- <el-row v-if="!search" style="padding:6px 18px">--> + <!-- 查询模块 --> + <el-form :model="queryOwn" label-width="80px"> + <el-row> + <el-col :span="10"> + <el-form-item label="货物名称:"> + <span>{{ queryOwn.descriptionGoods }}</span> + </el-form-item> + </el-col> + <el-col :span="10"> + <el-form-item label="货物编码:"> + <span>{{ queryOwn.cargoNumber }}</span> + </el-form-item> + </el-col> + </el-row> + <el-row> + <el-col :span="10"> + <el-form-item label="所在仓库:"> + <span>{{ queryOwn.warehouseName }}</span> + </el-form-item> + </el-col> + <el-col :span="10"> + <el-form-item label="商场/客户:"> + <span>{{ queryOwn.marketName }}</span> + </el-form-item> + </el-col> + </el-row> + <el-row> + <el-col :span="10"> + <el-form-item label="货物单位:"> + <span>{{ queryOwn.cargoUnit || '无' }}</span> + </el-form-item> + </el-col> + <el-col :span="10"> + <el-form-item label="门店地址:"> + <!-- <span>{{ queryOwn?:!queryOwn.storeName ? !queryOwn: '无' : queryOwn.storeName }}</span> --> + <span>{{ queryOwn.storeNam || '无' }}</span> + </el-form-item> + </el-col> + </el-row> + <!-- <el-row> + <el-col :span="10"> + <el-form-item label="库位信息:"> + <span>{{query.orderCode}}</span> + </el-form-item> - <div class="flex header_info"> - <el-form-item label="货物名称:"> - <span>{{ queryOwn.descriptionGoods }}</span> - </el-form-item> - <el-form-item label="货物编码:"> - <span>{{ queryOwn.cargoNumber }}</span> - </el-form-item> - <el-form-item label="所在仓库:"> - <span>{{ queryOwn.warehouseName }}</span> - </el-form-item> - <el-form-item label="商场/客户:"> - <span>{{ queryOwn.marketName }}</span> - </el-form-item> - <el-form-item label="货物单位:"> - <span>{{ queryOwn.cargoUnit }}</span> - </el-form-item> - <el-form-item label="门店地址:"> - <span>{{ queryOwn.storeNam }}</span> - </el-form-item> - <el-form-item label="在库数:"> - <span>{{ queryOwn.quantityStock }}</span> - </el-form-item> - </div> + </el-col> + <el-col :span="10"> + <el-form-item label="商城名称:"> + <el-input v-model="query.mallName" placeholder="请输入商城名称"></el-input> + </el-form-item> + </el-col> + </el-row>--> + <!-- 查询按钮 --> + <!-- <el-form-item>--> + <!-- <el-button type="primary" icon="el-icon-search" @click="searchChange">搜 索</el-button>--> + <!-- <el-button icon="el-icon-delete" @click="searchReset()">清 空</el-button>--> + <!-- </el-form-item>--> + </el-form> <el-row> <!-- 列表模块 --> <el-tabs @@ -194,7 +228,7 @@ </el-row>--> </div> <el-dialog title="二维码" :visible.sync="dialogVisibleF" width="780px" v-model="dialogVisibleF"> - <div class="printNode"> + <div> <div v-html="html"></div> </div> <span slot="footer" class="dialog-footer"> @@ -226,7 +260,6 @@ import { getListStock } from '@/api/distribution/distributionStock'; import { getStockListInfoList } from '@/api/distribution/distributionStockListInfo'; import { downloadXls } from '@/utils/util'; import { ElMessage, ElMessageBox } from 'element-plus'; -import print from '@/utils/print'; export default { data() { return { @@ -398,17 +431,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: '货位数', @@ -584,9 +617,6 @@ export default { data2: [], data3: [], leibiao: '', - loadingObj: { - pageLoading: false, - }, }; }, mounted() { @@ -614,23 +644,22 @@ export default { }, methods: { //查看二维码 - async handleInventoryQRCode({ row }) { - try { - this.loadingObj.pageLoading = true; - - this.html = ''; - const res = await showInventorySourcePackageCode(row.incomingBatch, row.parcelListId); - const { code, data } = res.data; - if (code !== 200) retrun; + handleInventoryQRCode(scope) { + const { row } = scope; + console.log('执行查看二维码------------>row:', row); - this.html = this.getHtmls(data.dataList, data.templateHtml); - - this.dialogVisibleF = true; - } catch (error) { - console.log('error :>> ', error); - } finally { - this.loadingObj.pageLoading = false; - } + this.materialQRCode = row; + console.log('---------------->', row); + let qr = { + ids: row.id, + }; + this.html = ''; + showInventorySourcePackageCode(row.incomingBatch, row.parcelListId).then(res => { + // this.orderPackageCode = res.data + console.log(res.data); + this.html = this.getHtmls(res.data.data.dataList, res.data.data.templateHtml); + }); + this.dialogVisibleF = true; }, revokeFn(val) { ElMessageBox.confirm('撤销物料会产生库存数量扣减,是否继续?', 'Warning', { @@ -950,11 +979,6 @@ export default { await this.getOnKu(page, (params = { pid: this.queryOwn.pid })); } }, - /** 打印 */ - printTemplate() { - const nodeArr = document.querySelectorAll('.printNode>div>div'); - print(nodeArr); - }, }, }; </script> @@ -971,20 +995,4 @@ el-select { .el-form-item__label { justify-content: flex-start; } - -.header_info { - flex-wrap: wrap; - > div { - width: 33%; - box-sizing: border-box; - margin: 0; - padding: 0 20px 20px 0; - font-size: 0.9rem; - } -} - -:deep(.el-divider__text.is-center) { - font-size: 1.5rem; - color: var(--el-color-primary); -} </style> diff --git a/src/views/distribution/reservation/atlas.vue b/src/views/distribution/reservation/atlas.vue index 6686879c..88428593 100644 --- a/src/views/distribution/reservation/atlas.vue +++ b/src/views/distribution/reservation/atlas.vue @@ -19,7 +19,7 @@ /> </div> </el-scrollbar> - <span class="txbxSpan">当前总条数:{{datalists.length}}  当前勾选条数:{{Checkthebox.length}}</span> + <span class="txbxSpan">总条数:{{CheckthMax.length}}  地址正确总条数:{{datalists.length}}  <span v-if="Checkthebox.length"> 当前勾选条数:{{Checkthebox.length}} </span></span> </div> </div> <div style="display: flex; align-items: center; justify-content: center"> @@ -57,6 +57,7 @@ let details = reactive({ // datalist:[] }); const Checkthebox=ref([]); +const CheckthMax=ref([]); onMounted(() => { initmap(); }); @@ -65,8 +66,10 @@ watchEffect(() => { details.item = router.currentRoute.value.query.id; if (!details.item) return; getReservationAddr(details.item).then(res => { + console.log(res.data.data,'参数接受的'); - Checkthebox.value = res.data.data;//统计当前勾选 + CheckthMax.value = res.data.data;//统计当前勾选 + const data = res.data.data; details.reservationData = res.data.data; details.mapLoc.remove(details.markersarr); @@ -78,7 +81,7 @@ watchEffect(() => { details.drivingarrs = []; // details.datalists = []; init(res.data.data); - Dtloading.value=false + }); }); function initmap() { @@ -87,10 +90,12 @@ function initmap() { viewMode: '2D', // 默认使用 2D 模式 zoom: 9, //初始化地图层级 center: [104.293242, 30.582939], //初始化地图中心点 + zooms:[3,16], //设置缩放级别范围 3-20 级 }); }); } function checkgoto() { + let ids = []; details.datalists.map(item => { console.log('item>>>>>>>>>>>>>>', item); @@ -112,57 +117,129 @@ function checkgoto() { }); useStores.commit('DEL_TAG_CURRENT'); } +// async function init(data) { +// if (details.mapLoc) { + +// await details.mapLoc.clearMap(); //重置地图标记 + +// // maplabel() +// let geocodess = []; +// var geocoder = new AMap.Geocoder({}); +// data.map(async (item, index) => { +// if (!item.jingdu || !item.weidu) { +// return ElMessage.warning('地址有问题'); +// } +// var marker = new AMap.Marker({ +// map: details.mapLoc, +// position: [item.jingdu, item.weidu], +// icon: '//a.amap.com/jsapi_demos/static/demo-center/icons/poi-marker-default.png', +// anchor: 'bottom-center', +// offset: new AMap.Pixel(0, 0), +// }); +// await marker.setMap(details.mapLoc); +// await marker.setLabel({ +// offset: new AMap.Pixel(0, -5), //设置文本标注偏移量 +// content: `<div class='info'>${item.warehouseName}</div>`, //设置文本标注内容 +// direction: 'top', //设置文本标注方位 +// }); +// // details.markersarr=[]//修改过 +// details.markersarr.push(marker); +// await geocoder.getLocation(item.deliveryAddress, (status, result) => { +// console.log(status,'status'); +// console.log(result,'result'); +// if (status == 'complete' && result.info == 'OK') { +// // result中对应详细地理坐标信息 +// details.mapLoc.setCenter([ +// result.geocodes[0].location.lng, +// result.geocodes[0].location.lat, +// ]); +// geocodess.push({ +// pontion: result.geocodes[0].location, +// content: item.consignee + '--' + item.deliveryAddress + '' + '--' + item.deliveryPhone, +// items: item, +// }); +// // if (index + 1 == data.length) { +// // console.log(geocodess,'geocodess'); +// // maker(geocodess); +// // Driving(geocodess); +// // } +// // 修改过 +// console.log(geocodess,'geocodess'); +// maker(geocodess); +// Driving(geocodess); +// } +// }); +// }); +// } +// } async function init(data) { - await details.mapLoc.clearMap(); //重置地图标记 - // maplabel() - console.log(details.mapLoc); + if (!details.mapLoc) { + return; // 如果没有地图对象,则直接返回 + } + + await details.mapLoc.clearMap(); // 重置地图标记 let geocodess = []; - var geocoder = new AMap.Geocoder({}); - data.map(async (item, index) => { + const geocoder = new AMap.Geocoder({}); + details.markersarr = []; // 确保这是一个空数组 + + // 使用 for...of 循环替代 map,因为需要异步操作 + for (let item of data) { if (!item.jingdu || !item.weidu) { - console.log(item.jingdu); - return ElMessage.warning('地址有问题'); + ElMessage.warning('地址有问题'); + continue; // 如果经纬度有问题,跳过此次循环 } - var marker = new AMap.Marker({ + + const marker = new AMap.Marker({ map: details.mapLoc, position: [item.jingdu, item.weidu], icon: '//a.amap.com/jsapi_demos/static/demo-center/icons/poi-marker-default.png', anchor: 'bottom-center', offset: new AMap.Pixel(0, 0), }); + await marker.setMap(details.mapLoc); - await marker.setLabel({ - offset: new AMap.Pixel(0, -5), //设置文本标注偏移量 - content: `<div class='info'>${item.warehouseName}</div>`, //设置文本标注内容 - direction: 'top', //设置文本标注方位 + marker.setLabel({ + offset: new AMap.Pixel(0,0), // 设置文本标注偏移量 + content: `<div class='info'>${item.warehouseName}</div>`, // 设置文本标注内容 + direction: 'top', // 设置文本标注方位 }); - // details.markersarr=[]//修改过 - details.markersarr.push(marker); - await geocoder.getLocation(item.deliveryAddress, (status, result) => { - console.log(status,'status'); - console.log(result,'result'); - if (status === 'complete' && result.info === 'OK') { - // result中对应详细地理坐标信息 - details.mapLoc.setCenter([ - result.geocodes[0].location.lng, - result.geocodes[0].location.lat, - ]); - geocodess.push({ - pontion: result.geocodes[0].location, - content: item.consignee + '--' + item.deliveryAddress + '' + '--' + item.deliveryPhone, - items: item, - }); - if (index + 1 == data.length) { - maker(geocodess); - Driving(geocodess); + + details.markersarr.push(marker); // 将标记添加到数组中 + // 对 geocoder.getLocation 的调用现在是同步的,使用 await 等待回调结果 + const result = await new Promise((resolve) => { + geocoder.getLocation(item.deliveryAddress, (status, response) => { + if (status === 'complete' && response.info === 'OK') { + resolve(response); + } else { + resolve(null); // 如果获取位置失败,则返回 null } - } + }); }); - }); + + if (result) { + details.mapLoc.setCenter([ + result.geocodes[0].location.lng, + result.geocodes[0].location.lat, + ]); + geocodess.push({ + pontion: result.geocodes[0].location, + content: `${item.consignee}--${item.deliveryAddress}--${item.deliveryPhone}`, + items: item, + }); + } + } + + if (geocodess.length > 0) { + maker(geocodess); + Driving(geocodess); + }else{ + Dtloading.value=false + } + } //地图标点 -function maker(geocodess) { - geocodess.map(item => { +async function maker (geocodess) { + await geocodess.map(item => { if (item.pontion) { console.log(item, 'item====='); var marker = new AMap.Marker({ @@ -181,6 +258,8 @@ function maker(geocodess) { details.markersarr.push(marker); } }); + + Dtloading.value=false } //地图公里数和时间计算 // 假设 seenIds 在适当的作用域中已经初始化 @@ -196,6 +275,7 @@ function Driving(geocodess) { new AMap.LngLat(item.items.jingdu, item.items.weidu), new AMap.LngLat(item.pontion.lng, item.pontion.lat), function (status, result) { + console.log(status); if (status === 'complete') { // console.log(result.routes[0]); item.time = formatSeconds(result.routes[0].time); @@ -237,13 +317,15 @@ function back() { } const { datalists } = toRefs(details); const ListChange = val => { - console.log(val,'val===='); + Dtloading.value=true console.log(details.datalists, '最新的数据'); - let data = details.datalists.filter(item => item.isck === true).map(item => item.items); + let data = details.datalists.filter(item => item.isck === true).map(item => item.items); init(data); Checkthebox.value = data;//统计当前勾选 console.log(details.datalists, '数据'); }; + + </script> <style lang="scss" scoped> diff --git a/src/views/distribution/reservation/reservation.vue b/src/views/distribution/reservation/reservation.vue index f541aa26..85cfbcc9 100644 --- a/src/views/distribution/reservation/reservation.vue +++ b/src/views/distribution/reservation/reservation.vue @@ -1002,8 +1002,6 @@ export default { }, editsolt(scope) { const { row } = scope; - this.$store.commit('DEL_ONCE_TAG', '/distribution/reservation/reservationAddFrom'); - this.$router.push({ path: '/distribution/reservation/reservationAddFrom', query: { @@ -1288,11 +1286,19 @@ export default { }); }, handleAdd() { - this.$store.commit('DEL_ONCE_TAG', '/distribution/reservation/reservationAddFrom'); this.$router.push({ path: '/distribution/reservation/reservationAddFrom', }); }, + handleEdit(row) { + console.log(row); + this.$router.push({ + path: '/distribution/reservation/reservationAddFrom', + query: { + reservationId: row.id, + }, + }); + }, aaa() { this.queryA.reservationStatus = '1'; this.onLoad(this.page); diff --git a/vite.config.js b/vite.config.js index 090c7763..439ab923 100644 --- a/vite.config.js +++ b/vite.config.js @@ -16,7 +16,7 @@ export default ({ mode, command }) => { // hy // target: 'http://192.168.3.12:13000', // xiaohei - // target: 'http://192.168.3.18:13000', + // target: 'http://192.168.3.18:13000', // lmy // target: 'http://192.168.10.123:8889', // target: 'http://192.168.10.101:8888',