Browse Source

生成标签优化

master_hella_20240701
zhang_li 5 months ago
parent
commit
2e5c8bcbaa
  1. 21
      src/components/TableForm/src/TableForm.vue
  2. 45
      src/views/wms/purchasereceiptManage/supplierdeliver/supplierdeliverRequestMain/index.vue
  3. 95
      src/views/wms/purchasereceiptManage/supplierdeliver/supplierdeliverRequestMain/labelForm.vue
  4. 148
      src/views/wms/purchasereceiptManage/supplierdeliver/supplierdeliverRequestMain/supplierdeliverRequestMain.data.ts

21
src/components/TableForm/src/TableForm.vue

@ -168,9 +168,9 @@
> >
<el-option <el-option
v-for="op in initSelectOptions(headerItem,row)" v-for="op in initSelectOptions(headerItem,row)"
:label="t(`ts.${op.label}`).replace('ts.', '')" :label="t(`ts.${initLabel(headerItem,op)}`).replace('ts.', '')"
:value="op.value" :value="initValue(headerItem,op)"
:key="op.value" :key="initValue(headerItem,op)"
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
@ -699,7 +699,20 @@ const disabledInput = (headerItem, row) => {
) )
} }
} }
const initLabel=(headerItem,op)=>{
if(headerItem?.tableForm?.labelField){
return op[headerItem?.tableForm?.labelField]
}else{
return op.label
}
}
const initValue=(headerItem,op)=>{
if(headerItem?.tableForm?.valueField){
return op[headerItem?.tableForm?.valueField]
}else{
return op.value
}
}
// setup // setup
defineExpose({ defineExpose({
TableBaseComponents_Ref, TableBaseComponents_Ref,

45
src/views/wms/purchasereceiptManage/supplierdeliver/supplierdeliverRequestMain/index.vue

@ -601,11 +601,7 @@ const buttonTableClick = async (val, row) => {
detatableData1.value = res detatableData1.value = res
detatableData1.value.forEach((item) => { detatableData1.value.forEach((item) => {
console.log(item.boxPackaging) console.log(item.boxPackaging)
if (item.boxPackaging?.length > 0) { item.packUnitInitOptions = item.boxPackaging
item.packUnitInitOptions = item.boxPackaging.map((cur) => {
return { label: cur.packName, value: cur.packUnit }
})
}
}) })
}) })
formLabelRef.value.open('create', row, null, 'createLabel') // createLabel formLabelRef.value.open('create', row, null, 'createLabel') // createLabel
@ -676,7 +672,6 @@ const footButtonClick = async (val) => {
} }
} }
// //
let tuoList = []
const formSelectChangeLabel = (field, val, row) => { const formSelectChangeLabel = (field, val, row) => {
if (field == 'packUnit') { if (field == 'packUnit') {
let obj = row.boxPackaging.find((item) => item.packUnit == val) let obj = row.boxPackaging.find((item) => item.packUnit == val)
@ -693,15 +688,12 @@ const formSelectChangeLabel = (field, val, row) => {
packUnit: row.packUnit packUnit: row.packUnit
} }
SupplierdeliverRequestDetailApi.getGenerateLabelParentList(params1).then((res) => { SupplierdeliverRequestDetailApi.getGenerateLabelParentList(params1).then((res) => {
tuoList = res row.secondPackUnitInitOptions = res
row.secondPackUnitInitOptions = res.map((cur) => {
return { label: cur.packName, value: cur.packUnit }
})
}) })
} }
// //
if (field == 'secondPackUnit') { if (field == 'secondPackUnit') {
let obj = tuoList.find((item) => item.packUnit == val) let obj = row.secondPackUnitInitOptions.find((item) => item.packUnit == val)
if (obj) { if (obj) {
row.secondPackQty = obj.packQty row.secondPackQty = obj.packQty
} else { } else {
@ -996,35 +988,16 @@ detatableData.pageSize = 500
const { getList: getDetailList } = detatableMethods const { getList: getDetailList } = detatableMethods
// //
const submitFormLabel = async (data) => { const submitFormLabel = async (list) => {
try { try {
const data1 = {
subList: JSON.parse(JSON.stringify(data))
}
data1.subList.forEach((row) => {
if (row.secondPackUnit && row.secondPackQty) {
} else {
row.children = []
let obj = {}
row.packageList.forEach((item) => {
obj = {
xPoNumber: item.xPoNumber,
qtyTwo: item.qtyOne
}
row.children.push(obj)
})
row.packageList = []
row.packageList.push({
isTuo: 0,
children: row.children
})
}
})
console.log(data1) let data = {
subList:list
}
console.log(data)
await message.confirm(t('ts.是否为此数据生成标签?')) await message.confirm(t('ts.是否为此数据生成标签?'))
labelFormRef.value.isLoading = true labelFormRef.value.isLoading = true
await SupplierdeliverRequestMainApi.genLabel(data1) await SupplierdeliverRequestMainApi.genLabel(data)
isCreateLabel.value = true isCreateLabel.value = true
message.success(t('ts.创建标签成功')) message.success(t('ts.创建标签成功'))
getList() getList()

95
src/views/wms/purchasereceiptManage/supplierdeliver/supplierdeliverRequestMain/labelForm.vue

@ -6,7 +6,7 @@
row-key="id" row-key="id"
style="width: 1050px; max-height: 70vh; overflow-y: auto" style="width: 1050px; max-height: 70vh; overflow-y: auto"
v-if="tableData.length > 0 && dialogTableVisible == true" v-if="tableData.length > 0 && dialogTableVisible == true"
v-loading='isLoading' v-loading="isLoading"
> >
<el-table-column type="expand" width="50"> <el-table-column type="expand" width="50">
<template #default="scope"> <template #default="scope">
@ -91,16 +91,23 @@
</el-table> </el-table>
</div> </div>
<div style="margin-left: 550px; margin-top: -8px; margin-bottom: -8px" v-else> <div style="margin-left: 550px; margin-top: -8px; margin-bottom: -8px" v-else>
<el-table :data="scope.row.packageList" border style="width: 300px" row-key="id"> <div v-for="(item, index) in scope.row.packageList" :key="index">
<el-table :data="item.children" border style="width: 300px" row-key="id">
<el-table-column label="箱行号" width="100" prop="xPoNumber" align="center" /> <el-table-column label="箱行号" width="100" prop="xPoNumber" align="center" />
<el-table-column label="数量" width="100" prop="qtyOne" align="center"> <el-table-column label="数量" width="100" prop="qtyOne" align="center">
<template #default="scope1"> <template #default="scope1">
<el-input v-model="scope1.row.qtyOne" @blur="blurThree(scope.row, scope1.row)" /> <el-input
v-model="scope1.row.qtyTwo"
@blur="blurThree(scope.row, item, scope1.row)"
/>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="添加箱" width="100" prop="add" align="center"> <el-table-column label="添加箱" width="100" prop="add" align="center">
<template #header> <template #header>
<el-button type="primary" link @click="addX(scope.row, scope.$index)" <el-button
type="primary"
link
@click="addX(scope.row, scope.$index, item, index)"
>添加箱</el-button >添加箱</el-button
> >
</template> </template>
@ -108,13 +115,14 @@
<el-button <el-button
type="warning" type="warning"
link link
@click="removeX(scope.row, scope.$index, scope1.row, scope1.$index)" @click="removeX(scope.row, scope.$index, item, index)"
>移出</el-button >移出</el-button
> >
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
</div> </div>
</div>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="物料代码" width="150" prop="itemCode" align="center" /> <el-table-column label="物料代码" width="150" prop="itemCode" align="center" />
@ -164,14 +172,11 @@ const twoId = ref(0) //每箱的id
const intData = () => { const intData = () => {
tableData.value.forEach((row) => { tableData.value.forEach((row) => {
if (row.secondPackUnit && row.secondPackQty) { if (row.secondPackUnit && row.secondPackQty) {
row.isTuo = 1 //
// % // %
row.allTuoQty = Math.ceil(parseFloat(row.qty) / parseFloat(row.secondPackQty)) row.allTuoQty = Math.ceil(parseFloat(row.qty) / parseFloat(row.secondPackQty))
} else { } else {
row.isTuo = 0 //
// % // %
row.allTuoQty = Math.ceil(parseFloat(row.qty) / parseFloat(row.packQty)) row.allTuoQty = Math.ceil(parseFloat(row.qty) / parseFloat(row.packQty))
} }
expandChange(row) expandChange(row)
}) })
@ -195,7 +200,7 @@ const expandChange = (row: any, expandedRows: any[]) => {
tPoNumber: i + 1, tPoNumber: i + 1,
xNumber: '', xNumber: '',
qtyOne: '', qtyOne: '',
isTuo : 1 // isTuo: 1 //
} }
// //
if (row.lastNumber) { if (row.lastNumber) {
@ -221,35 +226,33 @@ const expandChange = (row: any, expandedRows: any[]) => {
// //
cur.xLastNumber = parseFloat(cur.qtyOne) % parseFloat(row.packQty) cur.xLastNumber = parseFloat(cur.qtyOne) % parseFloat(row.packQty)
// cur.xiangNumber = Math.ceil(parseFloat(cur.qtyOne) / parseFloat(item.secondPackQty)) // cur.xiangNumber = Math.ceil(parseFloat(cur.qtyOne) / parseFloat(item.secondPackQty))
for (let i = 0; i < cur.xNumber; i++) { for (let j = 0; j < cur.xNumber; j++) {
twoId.value++ twoId.value++
cur.children[i] = { cur.children[j] = {
id: twoId.value, id: twoId.value,
xPoNumber: i + 1 xPoNumber: j + 1
} }
// //
if (cur.xLastNumber) { if (cur.xLastNumber) {
// //
if (i == cur.xNumber - 1) { if (j == cur.xNumber - 1) {
cur.children[i].qtyTwo = cur.xLastNumber cur.children[j].qtyTwo = cur.xLastNumber
} else { } else {
// //
cur.children[i].qtyTwo = row.packQty cur.children[j].qtyTwo = row.packQty
} }
} else { } else {
// , // ,
cur.children[i].qtyTwo = row.packQty cur.children[j].qtyTwo = row.packQty
} }
} }
}) })
} }
} else { } else {
row.isTuo = 0 //
//
row.lastNumber = parseFloat(row.qty) % parseFloat(row.packQty)
// % // %
row.allTuoQty = Math.ceil(parseFloat(row.qty) / parseFloat(row.packQty)) row.allXiangQty = Math.ceil(parseFloat(row.qty) / parseFloat(row.packQty))
row.packageList = [] row.packageList = []
row.allTuoQty = 1
// //
for (let i = 0; i < row.allTuoQty; i++) { for (let i = 0; i < row.allTuoQty; i++) {
oneId.value++ oneId.value++
@ -257,22 +260,35 @@ const expandChange = (row: any, expandedRows: any[]) => {
row.packageList[i] = { row.packageList[i] = {
id: oneId.value, id: oneId.value,
xPoNumber: i + 1, xPoNumber: i + 1,
qtyOne: '' qtyOne: row.qty,
isTuo: 0 //
}
}
row.packageList.forEach((cur) => {
cur.children = []
for (let j = 0; j < row.allXiangQty; j++) {
twoId.value++
cur.children[j] = {
id: twoId.value,
xPoNumber: j + 1
} }
//
cur.lastNumber = parseFloat(row.qty) % parseFloat(row.packQty)
// //
if (row.lastNumber) { if (cur.lastNumber) {
// //
if (i == row.allTuoQty - 1) { if (j == row.allXiangQty - 1) {
row.packageList[i].qtyOne = row.lastNumber cur.children[j].qtyTwo = cur.lastNumber
} else { } else {
// //
row.packageList[i].qtyOne = row.packQty cur.children[j].qtyTwo = row.packQty
} }
} else { } else {
// , // ,
row.packageList[i].qtyOne = row.packQty cur.children[j].qtyTwo = row.packQty
} }
} }
})
} }
} }
@ -347,12 +363,12 @@ const addX = (oneRow, oneIndex, twoRow, twoIndex, type) => {
twoRow.xNumber = twoRow.children.length twoRow.xNumber = twoRow.children.length
} else { } else {
// //
oneRow.packageList.push({ twoRow.children.push({
id: oneId.value, id: twoId.value,
xPoNumber: oneRow.packageList[oneRow.packageList.length - 1].xPoNumber + 1, xPoNumber: twoRow.children[twoRow.children.length - 1].xPoNumber + 1,
qtyOne: '' qtyTwo: ''
}) })
oneRow.allTuoQty = oneRow.packageList.length oneRow.allTuoQty = twoRow.children.length
} }
} }
// //
@ -368,8 +384,8 @@ const removeX = (oneRow, oneIndex, twoRow, twoIndex, threeRow, threeIndex, type)
twoRow.qtyOne = num twoRow.qtyOne = num
twoRow.xNumber = twoRow.children.length twoRow.xNumber = twoRow.children.length
} else { } else {
oneRow.packageList.splice(twoIndex, 1) twoRow.children.splice(twoIndex, 1)
oneRow.allTuoQty = oneRow.packageList.length oneRow.allTuoQty = twoRow.children.length
} }
} }
// //
@ -452,15 +468,20 @@ const blurTwo = (oneRow, twoRow, threeRow) => {
twoRow.qtyOne = num twoRow.qtyOne = num
} }
// //
const blurThree = (oneRow, twoRow) => { const blurThree = (oneRow, twoRow, thereeRow) => {
if (parseFloat(twoRow.qtyOne) > parseFloat(oneRow.packQty)) { if (parseFloat(thereeRow.qtyTwo) > parseFloat(oneRow.packQty)) {
message.warning('每箱个数最多' + oneRow.packQty) message.warning('每箱个数最多' + oneRow.packQty)
twoRow.qtyOne = oneRow.packQty thereeRow.qtyTwo = oneRow.packQty
} }
let num = 0
twoRow.children.forEach((item) => {
num += parseFloat(item.qtyTwo) || 0
})
twoRow.qtyOne = num
} }
// //
const emit = defineEmits(['submitForm']) const emit = defineEmits(['submitForm'])
defineExpose({ openLabel,dialogTableVisible,isLoading }) // open defineExpose({ openLabel, dialogTableVisible, isLoading }) // open
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
::v-deep .row-expand-cover td .el-table__expand-icon { ::v-deep .row-expand-cover td .el-table__expand-icon {

148
src/views/wms/purchasereceiptManage/supplierdeliver/supplierdeliverRequestMain/supplierdeliverRequestMain.data.ts

@ -1487,77 +1487,23 @@ export const SupplierdeliverRequestDetailLabel = useCrudSchemas(reactive<CrudSch
} }
}, },
{ {
label: '包装规格1', label: '箱规格',
field: 'packUnit', field: 'packUnit',
isTable: true, isTable: true,
sort: 'custom', sort: 'custom',
table: {
width: 150,
componentProps: {
disabled: true,
isSearchList: true,
searchListPlaceholder: '请选择包装',
searchField: 'packUnit',
searchTitle: '物品包装信息',
searchAllSchemas: Itempackaging.allSchemas,
searchPage: ItemPackageApi.getItempackagingPageBySupplierdeliver,
searchCondition: [
{
key: 'itemCode',
value: 'itemCode',
message: '请选择订单行',
isMainValue: true
},
{
key: 'available',
value: 'TRUE',
isMainValue: false
}
]
}
},
tableForm: {
disabled: true,
isInpuFocusShow: true,
searchListPlaceholder: '请选择包装',
searchField: 'itemCode',
searchTitle: '物品包装信息',
searchAllSchemas: Itempackaging.allSchemas,
searchPage: ItemPackageApi.getItempackagingPageBySupplierdeliver,
searchCondition: [
{
key: 'itemCode',
value: 'itemCode',
message: '请选择订单行',
isTableRowValue: true,
isMainValue:false
},
{
key: 'available',
value: 'TRUE',
isMainValue: false
}]
}
},
{
label: '包装名称1',
field: 'packName',
sort: 'custom',
table: {
width: 150
},
form: { form: {
componentProps: {
disabled: true
}
}, },
tableForm: { tableForm: {
disabled: true type: 'Select',
labelField: 'packName',
valueField: 'packUnit',
initOptions: [{
label: '',
value: ''
}]
} }
}, },{
{ label: '箱规格数量',
label: '物料数量1',
field: 'packQty', field: 'packQty',
sort: 'custom', sort: 'custom',
table: { table: {
@ -1568,81 +1514,28 @@ export const SupplierdeliverRequestDetailLabel = useCrudSchemas(reactive<CrudSch
} }
}, },
tableForm: { tableForm: {
disabled:true
} }
}, },
{ {
label: '包装规格2', label: '托规格',
field: 'secondPackUnit', field: 'secondPackUnit',
isTable: true, isTable: true,
sort: 'custom', sort: 'custom',
table: {
width: 150,
componentProps: {
disabled: true,
isSearchList: true,
searchListPlaceholder: '请选择包装',
searchField: 'packUnit',
searchTitle: '物品包装信息',
searchAllSchemas: Itempackaging.allSchemas,
searchPage: ItemPackageApi.getItempackagingPageBySupplierdeliver,
searchCondition: [
{
key: 'itemCode',
value: 'itemCode',
message: '请选择订单行',
isMainValue: true
},
{
key: 'available',
value: 'TRUE',
isMainValue: false
}
]
}
},
tableForm: {
clearable: true,
disabled: true,
isInpuFocusShow: true,
searchListPlaceholder: '请选择包装',
searchField: 'packUnit',
searchTitle: '物品包装信息',
searchAllSchemas: Itempackaging.allSchemas,
searchPage: ItemPackageApi.getItempackagingPageBySupplierdeliver,
searchCondition: [
{
key: 'itemCode',
value: 'itemCode',
message: '请选择订单行',
isTableRowValue: true,
isMainValue:false
},
{
key: 'available',
value: 'TRUE',
isMainValue: false
}]
}
},
{
label: '包装名称2',
field: 'secondPackName',
sort: 'custom',
table: {
width: 150
},
form: { form: {
componentProps: {
disabled: true
}
}, },
tableForm: { tableForm: {
disabled: true type: 'Select',
labelField: 'packName',
valueField: 'packUnit',
initOptions: [{
label: '',
value: ''
}]
} }
}, },
{ {
label: '物料数量2', label: '托规格数量',
field: 'secondPackQty', field: 'secondPackQty',
sort: 'custom', sort: 'custom',
table: { table: {
@ -1653,6 +1546,7 @@ export const SupplierdeliverRequestDetailLabel = useCrudSchemas(reactive<CrudSch
} }
}, },
tableForm: { tableForm: {
disabled:true
} }
}, },
{ {

Loading…
Cancel
Save