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. 91
      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
v-for="op in initSelectOptions(headerItem,row)"
:label="t(`ts.${op.label}`).replace('ts.', '')"
:value="op.value"
:key="op.value"
:label="t(`ts.${initLabel(headerItem,op)}`).replace('ts.', '')"
:value="initValue(headerItem,op)"
:key="initValue(headerItem,op)"
/>
</el-select>
</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
defineExpose({
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.forEach((item) => {
console.log(item.boxPackaging)
if (item.boxPackaging?.length > 0) {
item.packUnitInitOptions = item.boxPackaging.map((cur) => {
return { label: cur.packName, value: cur.packUnit }
})
}
item.packUnitInitOptions = item.boxPackaging
})
})
formLabelRef.value.open('create', row, null, 'createLabel') // createLabel
@ -676,7 +672,6 @@ const footButtonClick = async (val) => {
}
}
//
let tuoList = []
const formSelectChangeLabel = (field, val, row) => {
if (field == 'packUnit') {
let obj = row.boxPackaging.find((item) => item.packUnit == val)
@ -693,15 +688,12 @@ const formSelectChangeLabel = (field, val, row) => {
packUnit: row.packUnit
}
SupplierdeliverRequestDetailApi.getGenerateLabelParentList(params1).then((res) => {
tuoList = res
row.secondPackUnitInitOptions = res.map((cur) => {
return { label: cur.packName, value: cur.packUnit }
})
row.secondPackUnitInitOptions = res
})
}
//
if (field == 'secondPackUnit') {
let obj = tuoList.find((item) => item.packUnit == val)
let obj = row.secondPackUnitInitOptions.find((item) => item.packUnit == val)
if (obj) {
row.secondPackQty = obj.packQty
} else {
@ -996,35 +988,16 @@ detatableData.pageSize = 500
const { getList: getDetailList } = detatableMethods
//
const submitFormLabel = async (data) => {
const submitFormLabel = async (list) => {
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.是否为此数据生成标签?'))
labelFormRef.value.isLoading = true
await SupplierdeliverRequestMainApi.genLabel(data1)
await SupplierdeliverRequestMainApi.genLabel(data)
isCreateLabel.value = true
message.success(t('ts.创建标签成功'))
getList()

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

@ -6,7 +6,7 @@
row-key="id"
style="width: 1050px; max-height: 70vh; overflow-y: auto"
v-if="tableData.length > 0 && dialogTableVisible == true"
v-loading='isLoading'
v-loading="isLoading"
>
<el-table-column type="expand" width="50">
<template #default="scope">
@ -91,16 +91,23 @@
</el-table>
</div>
<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="qtyOne" align="center">
<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>
</el-table-column>
<el-table-column label="添加箱" width="100" prop="add" align="center">
<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
>
</template>
@ -108,13 +115,14 @@
<el-button
type="warning"
link
@click="removeX(scope.row, scope.$index, scope1.row, scope1.$index)"
@click="removeX(scope.row, scope.$index, item, index)"
>移出</el-button
>
</template>
</el-table-column>
</el-table>
</div>
</div>
</template>
</el-table-column>
<el-table-column label="物料代码" width="150" prop="itemCode" align="center" />
@ -164,14 +172,11 @@ const twoId = ref(0) //每箱的id
const intData = () => {
tableData.value.forEach((row) => {
if (row.secondPackUnit && row.secondPackQty) {
row.isTuo = 1 //
// %
row.allTuoQty = Math.ceil(parseFloat(row.qty) / parseFloat(row.secondPackQty))
} else {
row.isTuo = 0 //
// %
row.allTuoQty = Math.ceil(parseFloat(row.qty) / parseFloat(row.packQty))
}
expandChange(row)
})
@ -221,35 +226,33 @@ const expandChange = (row: any, expandedRows: any[]) => {
//
cur.xLastNumber = parseFloat(cur.qtyOne) % parseFloat(row.packQty)
// 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++
cur.children[i] = {
cur.children[j] = {
id: twoId.value,
xPoNumber: i + 1
xPoNumber: j + 1
}
//
if (cur.xLastNumber) {
//
if (i == cur.xNumber - 1) {
cur.children[i].qtyTwo = cur.xLastNumber
if (j == cur.xNumber - 1) {
cur.children[j].qtyTwo = cur.xLastNumber
} else {
//
cur.children[i].qtyTwo = row.packQty
cur.children[j].qtyTwo = row.packQty
}
} else {
// ,
cur.children[i].qtyTwo = row.packQty
cur.children[j].qtyTwo = row.packQty
}
}
})
}
} 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.allTuoQty = 1
//
for (let i = 0; i < row.allTuoQty; i++) {
oneId.value++
@ -257,22 +260,35 @@ const expandChange = (row: any, expandedRows: any[]) => {
row.packageList[i] = {
id: oneId.value,
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) {
row.packageList[i].qtyOne = row.lastNumber
if (j == row.allXiangQty - 1) {
cur.children[j].qtyTwo = cur.lastNumber
} else {
//
row.packageList[i].qtyOne = row.packQty
cur.children[j].qtyTwo = row.packQty
}
} 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
} else {
//
oneRow.packageList.push({
id: oneId.value,
xPoNumber: oneRow.packageList[oneRow.packageList.length - 1].xPoNumber + 1,
qtyOne: ''
twoRow.children.push({
id: twoId.value,
xPoNumber: twoRow.children[twoRow.children.length - 1].xPoNumber + 1,
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.xNumber = twoRow.children.length
} else {
oneRow.packageList.splice(twoIndex, 1)
oneRow.allTuoQty = oneRow.packageList.length
twoRow.children.splice(twoIndex, 1)
oneRow.allTuoQty = twoRow.children.length
}
}
//
@ -452,11 +468,16 @@ const blurTwo = (oneRow, twoRow, threeRow) => {
twoRow.qtyOne = num
}
//
const blurThree = (oneRow, twoRow) => {
if (parseFloat(twoRow.qtyOne) > parseFloat(oneRow.packQty)) {
const blurThree = (oneRow, twoRow, thereeRow) => {
if (parseFloat(thereeRow.qtyTwo) > parseFloat(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'])

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',
isTable: true,
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: {
componentProps: {
disabled: true
}
},
tableForm: {
disabled: true
type: 'Select',
labelField: 'packName',
valueField: 'packUnit',
initOptions: [{
label: '',
value: ''
}]
}
},
{
label: '物料数量1',
},{
label: '箱规格数量',
field: 'packQty',
sort: 'custom',
table: {
@ -1568,81 +1514,28 @@ export const SupplierdeliverRequestDetailLabel = useCrudSchemas(reactive<CrudSch
}
},
tableForm: {
disabled:true
}
},
{
label: '包装规格2',
label: '托规格',
field: 'secondPackUnit',
isTable: true,
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: {
componentProps: {
disabled: true
}
},
tableForm: {
disabled: true
type: 'Select',
labelField: 'packName',
valueField: 'packUnit',
initOptions: [{
label: '',
value: ''
}]
}
},
{
label: '物料数量2',
label: '托规格数量',
field: 'secondPackQty',
sort: 'custom',
table: {
@ -1653,6 +1546,7 @@ export const SupplierdeliverRequestDetailLabel = useCrudSchemas(reactive<CrudSch
}
},
tableForm: {
disabled:true
}
},
{

Loading…
Cancel
Save