Browse Source

12.17

master
lichong 4 days ago
parent
commit
dc30e3f8ca
  1. 2
      package.json
  2. 5
      src/renderer/src/components/tablecomponent.vue
  3. 60
      src/renderer/src/views/shujuguanli.vue

2
package.json

@ -1,6 +1,6 @@
{
"name": "electron",
"version": "1.0.5",
"version": "1.0.6",
"description": "An Electron application with Vue",
"main": "./out/main/index.js",
"author": "lichong",

5
src/renderer/src/components/tablecomponent.vue

@ -10,11 +10,10 @@
v-for="(headerItem, headerIndex) in tableHeader" :key="headerIndex" :sortable="headerItem.isSort">
<template #default="{ row }">
<template v-if="headerItem.type === 'text'">
<span>{{ headerItem.width }}</span>
<span>!{{ row[headerItem.prop] }}</span>
<span>{{ row[headerItem.prop] }}</span>
</template>
<template v-else>
<span> {{ headerItem.type }}!{{ row[headerItem.prop] }}</span>
<span> {{ row[headerItem.prop] }}</span>
</template>
</template>
</vxe-column>

60
src/renderer/src/views/shujuguanli.vue

@ -321,6 +321,7 @@ export default {
}
//
if (rowIndex === 2) {
console.log(317, XLSX.utils.format_cell(cell));
that.otherChangeList.push({
key: String.fromCharCode("a".charCodeAt() + colIndex),
value: XLSX.utils.format_cell(cell)
@ -559,9 +560,9 @@ export default {
let element = this.otherChangeList[i];
if (element.value === "商店名称") {
sdmc = element.key
} else if (element.value === "箱数") {
} else if (["店铺箱数", "箱数"].includes(element.value)) {
xs = element.key
} else if (element.value === "条码贴") {
} else if (["条码贴", "条形码"].includes(element.value)) {
tmt = element.key
}
}
@ -614,14 +615,14 @@ export default {
let hasBarcode = sheetData[hasBarcodeIndex]
//
hasBarcode["Barcode"] = firstItem[tmt]
hasBarcode["Quantity of containers"] += firstItem[xs]
hasBarcode["Quantity of containers"] += Number(firstItem[xs])
hasBarcode["Quantity to deliver"] += firstItem[firstItem.typeKey]
hasBarcode["Quantity per container"] = firstItem[firstItem.typeKey]
let newItem = ""
if (this.atype === "a1") {
newItem = _.find(newData, o => _.toLower(o.Description).includes(`, ${_.toLower(firstItem.type)}, `) && Number(o.Store) === Number(firstItem[sdmc]) && _.trim(o.Barcode))
} else if (this.atype === "a2") {
newItem = _.find(newData, o => _.toLower(o.Description).includes(`, ${_.toLower(firstItem.type)}`) && Number(o.Store) === Number(firstItem[sdmc]) && _.trim(o.Barcode))
newItem = _.find(newData, o => _.toLower(o.Description).includes(`, ${_.toLower(firstItem.type)} M`) && Number(o.Store) === Number(firstItem[sdmc]) && _.trim(o.Barcode))
} else if (this.atype === "a3") {
let typeTemp = firstItem.type.replace(/([0-9])([a-zA-Z])/g, '$1 $2').replace(/([a-zA-Z])([0-9])/g, '$1 $2')
newItem = _.find(newData, o => _.toLower(o.Description).includes(`, ${_.toLower(typeTemp)}`) && Number(o.Store) === Number(firstItem[sdmc]) && _.trim(o.Barcode))
@ -630,23 +631,25 @@ export default {
} else if (this.atype === "a5") {
newItem = _.find(newData, o => _.toLower(o.Description).includes(`, ${_.toLower(firstItem.type)}`) && Number(o.Store) === Number(firstItem[sdmc]) && _.trim(o.Barcode))
}
//
newItem["Quantity of containers"] += firstItem[xs]
newItem["Quantity to deliver"] += firstItem[firstItem.typeKey]
//
newData.push({
...hasBarcode,
"Barcode": firstItem[tmt],
"Quantity of containers": "",
"Quantity to deliver": "",
"Quantity per container": firstItem[firstItem.typeKey]
})
if (newItem) {
//
newItem["Quantity of containers"] += Number(firstItem[xs])
// newItem["Quantity to deliver"] += firstItem[firstItem.typeKey]
//
newData.push({
...hasBarcode,
"Barcode": firstItem[tmt],
"Quantity of containers": 0,
"Quantity to deliver": "",
"Quantity per container": firstItem[firstItem.typeKey]
})
}
} else if (noBarcodeIndex !== -1) {
let noBarcode = sheetData[noBarcodeIndex]
//
noBarcode["Barcode"] = firstItem[tmt]
noBarcode["Quantity of containers"] = firstItem[xs]
noBarcode["Quantity to deliver"] = firstItem[firstItem.typeKey]
noBarcode["Quantity of containers"] = Number(firstItem[xs])
// noBarcode["Quantity to deliver"] = firstItem[firstItem.typeKey]
noBarcode["Quantity per container"] = firstItem[firstItem.typeKey]
newData.push({
...noBarcode,
@ -716,13 +719,19 @@ export default {
"Barcode", "Quantity per container", "Total", "Cluster",
"", "", "", ""
];
//
let lilstLocal = listCopy.map(item => ({
...item,
'Quantity to deliver': item["Quantity to deliver"] ? item["Quantity to deliver"].toFixed(3) : ""
}));
let eTotal = 0
let iTotal = 0
let lilstLocal = []
for (let i = 0; i < listCopy.length; i++) {
let item = listCopy[i];
lilstLocal.push({
...item,
'Quantity to deliver': item["Quantity to deliver"] ? item["Quantity to deliver"].toFixed(3) : ""
})
eTotal += Number(item["Quantity to deliver"])
iTotal += Number(item["Quantity per container"])
}
// 簿
let workbook = new ExcelJS.Workbook();
let worksheet = workbook.addWorksheet('Sheet1');
@ -747,6 +756,11 @@ export default {
cell.font = { name: 'Arial', size: 10, color: { argb: '000000' } };
cell.alignment = { horizontal: 'center', vertical: 'center' };
}
if (Number(row["Quantity to deliver"]) < Number(row["Quantity per container"])) {
let qpcCol = _.findIndex(rowKeys, o => o === "Quantity per container")
let cell = worksheet.getCell(rowIndex + 2, qpcCol + 1);
cell.fill = { type: 'pattern', pattern: 'solid', fgColor: { argb: 'FFFF00' }, };
}
});
//

Loading…
Cancel
Save