Browse Source

生成标签默认显示箱规格,分页问题

master_hella_20240701
zhang_li 5 months ago
parent
commit
afd292db91
  1. 7
      src/components/BasicForm/src/BasicForm.vue
  2. 8
      src/components/TableForm/src/TableForm.vue
  3. 90
      src/views/wms/purchasereceiptManage/supplierdeliver/supplierdeliverRequestMain/index.vue
  4. 38
      src/views/wms/purchasereceiptManage/supplierdeliver/supplierdeliverRequestMain/labelForm.vue

7
src/components/BasicForm/src/BasicForm.vue

@ -102,6 +102,7 @@
@clearInput='clearInput' @clearInput='clearInput'
@batchAdd="batchAdd" @batchAdd="batchAdd"
:routeName="routeName" :routeName="routeName"
@visibleChange='visibleChange'
> >
<template v-slot="{row}"> <template v-slot="{row}">
<slot :row="row"></slot> <slot :row="row"></slot>
@ -692,8 +693,12 @@ const emit = defineEmits([
'footButtonClick', 'footButtonClick',
'clearSearchInput', 'clearSearchInput',
'clearInput', 'clearInput',
'sumFormDataHandle' 'sumFormDataHandle',
'visibleChange'
]) ])
const visibleChange = (field, val, row, index) => {
emit('visibleChange',field, val, row, index)
}
// //
const formSelectChange = (field, val, row) => { const formSelectChange = (field, val, row) => {
emit('formSelectChange', field, val, row) emit('formSelectChange', field, val, row)

8
src/components/TableForm/src/TableForm.vue

@ -165,6 +165,7 @@
:placeholder="headerItem?.tableForm?.placeholder || '请选择' + headerItem.label" :placeholder="headerItem?.tableForm?.placeholder || '请选择' + headerItem.label"
@change="formSelectChange(headerItem.field, $event, row)" @change="formSelectChange(headerItem.field, $event, row)"
@blur="tableFormSelectOnBlur(headerItem.field, $event, row, $index)" @blur="tableFormSelectOnBlur(headerItem.field, $event, row, $index)"
@visible-change="visibleChange(headerItem.field, $event, row, $index)"
> >
<el-option <el-option
v-for="op in initSelectOptions(headerItem,row)" v-for="op in initSelectOptions(headerItem,row)"
@ -518,7 +519,8 @@ const emit = defineEmits([
'tableFormSelectOnBlur', 'tableFormSelectOnBlur',
'formFormDateChange', 'formFormDateChange',
'clearInput', 'clearInput',
'batchAdd' 'batchAdd',
'visibleChange'
]) ])
// | type = radio | type = select // | type = radio | type = select
const initSelectOptions = (headerItem,row) => { const initSelectOptions = (headerItem,row) => {
@ -653,7 +655,9 @@ const clearInput = (field, row, index) => {
const buttonOperationClick = (row, label, index) => { const buttonOperationClick = (row, label, index) => {
emit('buttonOperationClick', row, label, index) emit('buttonOperationClick', row, label, index)
} }
const visibleChange = (field, val, row, index) => {
emit('visibleChange',field, val, row, index)
}
const currentPage = ref(1) const currentPage = ref(1)
const pageSize = ref(10) const pageSize = ref(10)
const showTableData = () => { const showTableData = () => {

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

@ -154,6 +154,7 @@
:footButttondata="footButttondata" :footButttondata="footButttondata"
@footButtonClick="footButtonClick" @footButtonClick="footButtonClick"
@formSelectChange="formSelectChangeLabel" @formSelectChange="formSelectChangeLabel"
@visibleChange='visibleChange'
/> />
<!-- 上传质量报告 --> <!-- 上传质量报告 -->
<BasicForm <BasicForm
@ -590,20 +591,7 @@ const buttonTableClick = async (val, row) => {
} }
genLabelId.value = row.masterId genLabelId.value = row.masterId
// await getDetailList() // await getDetailList()
const params1 = { await getGenerateLabelList(row)
masterId: row.masterId,
pageSize: '500',
pageNo: '1',
sort: '',
by: 'ASC'
}
await SupplierdeliverRequestDetailApi.getGenerateLabelList(params1).then((res) => {
detatableData1.value = res
detatableData1.value.forEach((item) => {
console.log(item.boxPackaging)
item.packUnitInitOptions = item.boxPackaging
})
})
formLabelRef.value.open('create', row, null, 'createLabel') // createLabel formLabelRef.value.open('create', row, null, 'createLabel') // createLabel
} else if (val == 'ressbq') { } else if (val == 'ressbq') {
console.log('重新生成标签') console.log('重新生成标签')
@ -620,24 +608,7 @@ const buttonTableClick = async (val, row) => {
} }
genLabelId.value = row.masterId genLabelId.value = row.masterId
// await getDetailList() // await getDetailList()
const params1 = { await getGenerateLabelList(row)
masterId: row.masterId,
pageSize: '500',
pageNo: '1',
sort: '',
by: 'ASC'
}
await SupplierdeliverRequestDetailApi.getGenerateLabelList(params1).then((res) => {
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 }
})
}
})
})
formLabelRef.value.open('create', row, null, 'createLabel') // createLabel formLabelRef.value.open('create', row, null, 'createLabel') // createLabel
} }
}) })
@ -657,6 +628,27 @@ const footButttondata = ref([
defaultButtons.formNextStepBtn(null), // BOM defaultButtons.formNextStepBtn(null), // BOM
defaultButtons.formCloseBtn(null) // BOM defaultButtons.formCloseBtn(null) // BOM
]) ])
//
const getGenerateLabelList=async(row)=>{
const params1 = {
masterId: row.masterId,
pageSize: '500',
pageNo: '1',
sort: '',
by: 'ASC'
}
await SupplierdeliverRequestDetailApi.getGenerateLabelList(params1).then((res) => {
detatableData1.value = res
detatableData1.value.forEach((item) => {
item.packUnitInitOptions = item.boxPackaging
let obj = item?.boxPackaging[0]
if (obj) {
item.packUnit= obj.packUnit
item.packQty = obj.packQty
}
})
})
}
// //
const labelFormRef = ref() const labelFormRef = ref()
const footButtonClick = async (val) => { const footButtonClick = async (val) => {
@ -665,6 +657,13 @@ const footButtonClick = async (val) => {
if (!validateForm) { if (!validateForm) {
return return
} }
let isNext = detatableData1.value.some((item)=>{
return !item.packUnit || !item.packQty
})
if(isNext){
message.warning('有数据没有选择箱规格')
return;
}
const data = JSON.parse(JSON.stringify(detatableData1.value)) const data = JSON.parse(JSON.stringify(detatableData1.value))
labelFormRef.value.openLabel(data) labelFormRef.value.openLabel(data)
} else if (val == 'close') { } else if (val == 'close') {
@ -682,14 +681,7 @@ const formSelectChangeLabel = (field, val, row) => {
} }
row.secondPackUnit = '' row.secondPackUnit = ''
row.secondPackQty = '' row.secondPackQty = ''
//
const params1 = {
itemCode: row.itemCode,
packUnit: row.packUnit
}
SupplierdeliverRequestDetailApi.getGenerateLabelParentList(params1).then((res) => {
row.secondPackUnitInitOptions = res
})
} }
// //
if (field == 'secondPackUnit') { if (field == 'secondPackUnit') {
@ -701,6 +693,24 @@ const formSelectChangeLabel = (field, val, row) => {
} }
} }
} }
// tableForm
const visibleChange=(field, val, row, index)=>{
row.secondPackUnitInitOptions=[]
console.log(field, val, row)
if(field=='secondPackUnit'){
if(val){
//
const params1 = {
itemCode: row.itemCode,
packUnit: row.packUnit
}
SupplierdeliverRequestDetailApi.getGenerateLabelParentList(params1).then((res) => {
row.secondPackUnitInitOptions = res
})
}
}
}
// //
const { wsCache } = useCache() const { wsCache } = useCache()

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

@ -1,7 +1,7 @@
<template> <template>
<el-dialog v-model="dialogTableVisible" title="标签" width="1100"> <el-dialog v-model="dialogTableVisible" title="标签" width="1100">
<el-table <el-table
:data="tableData" :data="showTableData()"
border border
row-key="id" row-key="id"
style="width: 1050px; max-height: 70vh; overflow-y: auto" style="width: 1050px; max-height: 70vh; overflow-y: auto"
@ -135,6 +135,16 @@
<el-table-column label="箱规格" width="100" prop="packUnit" align="center" /> <el-table-column label="箱规格" width="100" prop="packUnit" align="center" />
<el-table-column label="箱数量" width="100" prop="packQty" align="center" /> <el-table-column label="箱数量" width="100" prop="packQty" align="center" />
</el-table> </el-table>
<el-pagination
v-show="tableData.length > 10"
style="margin-top: 10px"
v-model:current-page="currentPage"
v-model:page-size="pageSize"
:small="true"
:background="false"
layout="total, prev, pager, next, jumper"
:total="tableData.length"
/>
<template #footer> <template #footer>
<slot name="foorter"></slot> <slot name="foorter"></slot>
<ButtonBase :Butttondata="Butttondata" @button-base-click="buttonBaseClick" /> <ButtonBase :Butttondata="Butttondata" @button-base-click="buttonBaseClick" />
@ -157,19 +167,31 @@ const props = defineProps({
const dialogTableVisible = ref(false) const dialogTableVisible = ref(false)
const defaultExpandAll = ref(false) const defaultExpandAll = ref(false)
const tableData = ref([]) const tableData = ref([])
const isLoading = ref(false) const isLoading = ref(false)
const openLabel = (tableList) => { const oneId = ref(0) //id
const twoId = ref(0) //id
const openLabel =async (tableList) => {
dialogTableVisible.value = true dialogTableVisible.value = true
tableData.value = tableList tableData.value = tableList
defaultExpandAll.value = false defaultExpandAll.value = false
// intData() await intData()
intData()
} }
const oneId = ref(0) //id const currentPage = ref(1)
const twoId = ref(0) //id const pageSize = ref(10)
const intData = () => { const showTableData = () => {
console.log(777,tableData.value.length)
if (tableData.value.length > 10) {
return tableData.value.slice(
(currentPage.value - 1) * pageSize.value,
currentPage.value * pageSize.value
)
} else {
return tableData.value
}
}
const intData =async () => {
tableData.value.forEach((row) => { tableData.value.forEach((row) => {
if (row.secondPackUnit && row.secondPackQty) { if (row.secondPackUnit && row.secondPackQty) {
// % // %

Loading…
Cancel
Save