Browse Source

供应商生成标签

master_hella_20240701
zhang_li 5 months ago
parent
commit
eef893aac2
  1. 2
      src/components/Table/src/Table.vue
  2. 1
      src/locales/en-US.ts
  3. 1
      src/locales/zh-CN.ts
  4. 14
      src/utils/disposition/defaultButtons.ts
  5. 8
      src/views/wms/basicDataManage/itemManage/itempackage/index.vue
  6. 18
      src/views/wms/purchasereceiptManage/supplierdeliver/supplierdeliverRequestMain/index.vue
  7. 444
      src/views/wms/purchasereceiptManage/supplierdeliver/supplierdeliverRequestMain/labelForm.vue

2
src/components/Table/src/Table.vue

@ -62,6 +62,7 @@ export default defineComponent({
}, },
searchTableSelectionsList:[],// searchTableSelectionsList:[],//
selectionColor: propTypes.bool.def(false), selectionColor: propTypes.bool.def(false),
rowKey: propTypes.string.def(''),
}, },
emits: ['update:pageSize', 'update:currentPage', 'register', 'update:sort','getSelectionRows'], emits: ['update:pageSize', 'update:currentPage', 'register', 'update:sort','getSelectionRows'],
setup(props, { attrs, slots, emit, expose }) { setup(props, { attrs, slots, emit, expose }) {
@ -388,6 +389,7 @@ export default defineComponent({
onSelect-all={selectAll} onSelect-all={selectAll}
onSelection-change={selectionChange} onSelection-change={selectionChange}
onSort-change={sortChange} onSort-change={sortChange}
row-key={unref(getProps).rowKey}
{...unref(getBindValue)} {...unref(getBindValue)}
> >
{{ {{

1
src/locales/en-US.ts

@ -884,6 +884,7 @@ export default {
:'Total', :'Total',
:'Open', :'Open',
:'Save', :'Save',
:'Next',
:'Please select filter', :'Please select filter',
:'Please inputr content', :'Please inputr content',
:'Attachment', :'Attachment',

1
src/locales/zh-CN.ts

@ -884,6 +884,7 @@ export default {
:'共', :'共',
:'打开', :'打开',
:'保存', :'保存',
:'下一步',
:'请选择筛选对象', :'请选择筛选对象',
:'请输入内容', :'请输入内容',
:'附件', :'附件',

14
src/utils/disposition/defaultButtons.ts

@ -236,7 +236,19 @@ export function formStagingBtn(option:any) {
hasPermi: '' hasPermi: ''
}) })
} }
// form表单-下一步按钮
export function formNextStepBtn(option:any) {
return __defaultBtnOption(option,{
label: t(`ts.下一步`).replace('ts.', ''),
name: 'nextStep',
hide: false,
type: 'primary',
icon: 'ep:select',
color: '',
float:'right',
hasPermi: ''
})
}
// drawer抽屉头部-编辑按钮 // drawer抽屉头部-编辑按钮
export function drawerEditBtn(option:any) { export function drawerEditBtn(option:any) {

8
src/views/wms/basicDataManage/itemManage/itempackage/index.vue

@ -30,6 +30,7 @@
v-model:pageSize="tableObject.pageSize" v-model:pageSize="tableObject.pageSize"
v-model:currentPage="tableObject.currentPage" v-model:currentPage="tableObject.currentPage"
v-model:sort="tableObject.sort" v-model:sort="tableObject.sort"
rowKey="id"
> >
<template #itemCode="{ row }"> <template #itemCode="{ row }">
<el-button type="primary" link @click="openDetail(row, '物料代码', row.itemCode)"> <el-button type="primary" link @click="openDetail(row, '物料代码', row.itemCode)">
@ -328,7 +329,12 @@ const searchFormClick = (searchData) => {
/** 初始化 **/ /** 初始化 **/
onMounted(async () => { onMounted(async () => {
getList() await getList()
tableObject.tableList.forEach(item=>{
item.children=[{
packUnit:'300000100'
}]
})
importTemplateData.templateUrl = await ItempackagingApi.importTemplate() importTemplateData.templateUrl = await ItempackagingApi.importTemplate()
}) })
</script> </script>

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

@ -133,6 +133,8 @@
@submitForm="submitFormLabel" @submitForm="submitFormLabel"
:isShowReduceButton="false" :isShowReduceButton="false"
@clearInput='clearInput' @clearInput='clearInput'
:footButttondata="footButttondata"
@footButtonClick='footButtonClick'
/> />
<!-- 上传质量报告 --> <!-- 上传质量报告 -->
<BasicForm <BasicForm
@ -159,6 +161,7 @@
<el-button type="primary" @click="printAllClick">打印全部</el-button> <el-button type="primary" @click="printAllClick">打印全部</el-button>
</template> --> </template> -->
</SearchTable> </SearchTable>
<labelForm ref="labelFormRef" :tableAllSchemas="SupplierdeliverRequestDetailLabel.allSchemas"/>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
@ -185,6 +188,7 @@ import { PurchasePlanDetail } from '../purchasePlanMain/purchasePlanMain.data'
import * as SupplierApi from '@/api/wms/supplier' import * as SupplierApi from '@/api/wms/supplier'
import { Supplier } from '@/views/wms/basicDataManage/supplierManage/supplier/supplier.data' import { Supplier } from '@/views/wms/basicDataManage/supplierManage/supplier/supplier.data'
import supplierdeliverBasicForm from './supplierdeliverBasicForm.vue' import supplierdeliverBasicForm from './supplierdeliverBasicForm.vue'
import labelForm from './labelForm.vue'
import { getJmreportBaseUrl } from '@/utils/systemParam' import { getJmreportBaseUrl } from '@/utils/systemParam'
// //
defineOptions({ name: 'SupplierdeliverRequestMain' }) defineOptions({ name: 'SupplierdeliverRequestMain' })
@ -557,7 +561,19 @@ const buttonTableClick = async (val, row) => {
handleDocumentPrint(row.masterId) handleDocumentPrint(row.masterId)
} }
} }
const footButttondata = ref([
defaultButtons.formNextStepBtn(null), // BOM
defaultButtons.formCloseBtn(null) // BOM
])
//
const labelFormRef = ref()
const footButtonClick = (val)=>{
if(val == 'nextStep'){
labelFormRef.value.openLabel(detatableData.tableList)
}else if(val == 'close'){
formLabelRef.value.dialogVisible = false
}
}
// //
const { wsCache } = useCache() const { wsCache } = useCache()
/** 详情操作 */ /** 详情操作 */

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

@ -0,0 +1,444 @@
<template>
<el-dialog v-model="dialogTableVisible" title="标签" width="1100">
<el-table
:data="tableData"
border
row-key="id"
style="width: 1050px; max-height: 70vh; overflow-y: auto"
v-if="tableData.length>0"
>
<el-table-column type="expand" width="50">
<template #default="scope">
<div
style="margin-left: 400px; margin-top: -8px; margin-bottom: -8px"
v-if="scope.row.packUnit && scope.row.packQty"
>
<el-table
:data="scope.row.children"
border
style="width: 550px"
row-key="id"
:row-class-name="getRowClass"
>
<el-table-column type="expand" width="50">
<template #default="scope1">
<div style="margin-left: 150px; margin-top: -8px; margin-bottom: -8px">
<el-table
:data="scope1.row.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="qty1" align="center">
<template #default="scope2">
<el-input
v-model="scope2.row.qty1"
@blur="blurTwo(scope.row, scope1.row, scope2.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, scope1.row, scope1.$index,1)"
>添加箱</el-button
>
</template>
<template #default="scope2">
<el-button
type="warning"
link
@click="
removeX(
scope.row,
scope.$index,
scope1.row,
scope1.$index,
scope2.row,
scope2.$index,
1
)
"
>移出</el-button
>
</template>
</el-table-column>
</el-table>
</div>
</template>
</el-table-column>
<el-table-column label="托行号" width="100" prop="tPoNumber" align="center" />
<el-table-column label="箱个数" width="100" prop="xNumber" align="center">
<template #default="scope1">
<el-input v-model="scope1.row.xNumber" @blur="blurOne(scope.row, scope1.row)" />
</template>
</el-table-column>
<el-table-column label="数量" width="100" prop="qty1" align="center" />
<el-table-column label="操作" width="100" prop="action" align="center">
<template #default="scope1">
<el-button
type="warning"
link
@click="removeT(scope.row, scope.$index, scope1.row, scope1.$index)"
>移出</el-button
>
</template>
</el-table-column>
<el-table-column label="添加托" width="100" prop="add" align="center">
<template #header>
<el-button type="primary" link @click="addT(scope.row)">添加托</el-button>
</template>
</el-table-column>
</el-table>
</div>
<div style="margin-left: 550px; margin-top: -8px; margin-bottom: -8px" v-else>
<el-table
:data="scope.row.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="qty1" align="center">
<template #default="scope1">
<el-input v-model="scope1.row.qty1" @blur="blurThree(scope.row, 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
>
</template>
<template #default="scope1">
<el-button type="warning" link @click="removeX(scope.row, scope.$index, scope1.row, scope1.$index)"
>移出</el-button
>
</template>
</el-table-column>
</el-table>
</div>
</template>
</el-table-column>
<el-table-column label="物料代码" width="150" prop="itemCode" align="center" />
<el-table-column label="批次" width="150" prop="batch" align="center" />
<el-table-column label="数量" width="100" prop="orderQty" align="center" />
<el-table-column label="计量单位" width="100" prop="uom" align="center" />
<el-table-column label="托个数" width="100" prop="packQty1" 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="secondPackUnit" align="center" />
<el-table-column label="箱数量" width="100" prop="secondPackQty" align="center" />
</el-table>
<template #footer>
<slot name="foorter"></slot>
<ButtonBase :Butttondata="Butttondata" @button-base-click="buttonBaseClick" />
</template>
</el-dialog>
</template>
<script setup lang="ts">
import * as defaultButtons from '@/utils/disposition/defaultButtons'
const message = useMessage() //
const { t } = useI18n() //
const props = defineProps({
//
tableAllSchemas: {
type: Array,
required: true,
default: null
}
})
const dialogTableVisible = ref(false)
const tableData = ref([])
const openLabel = (tableList) => {
console.log(tableList)
dialogTableVisible.value = true
tableData.value = tableList
intData()
}
const oneId = ref(0)
const twoId = ref(0)
const intData = () => {
// 1
tableData.value.forEach((item) => {
item.packQty1 = 3
//
console.log(44,item.packUnit);
console.log(item.packQty);
if (item.packUnit && item.packQty) {
//
item.lastNumber = parseFloat(item.orderQty) % parseFloat(item.packQty)
// /
item.otherNumber = parseFloat(item.packQty) / parseFloat(item.secondPackQty)
// %
item.allPackQty = Math.ceil(parseFloat(item.orderQty) / parseFloat(item.secondPackQty))
item.children = []
for (let i = 0; i < item.packQty1; i++) {
oneId.value++
//
if (item.lastNumber) {
//
if (i == item.packQty1 - 1) {
item.children.push({
id: oneId.value,
tPoNumber: i + 1,
xNumber: Math.ceil(item.lastNumber / parseFloat(item.secondPackQty)),
qty1: item.lastNumber
})
} else {
//
item.children.push({
id: oneId.value,
tPoNumber: i + 1,
xNumber: item.otherNumber,
qty1: item.packQty
})
}
} else {
// ,
item.children.push({
id: oneId.value,
tPoNumber: i + 1,
xNumber: item.otherNumber,
qty1: item.packQty
})
}
}
//
if (item.secondPackUnit && item.secondPackQty) {
item.children.forEach((cur, key) => {
cur.children = []
//
cur.xLastNumber = parseFloat(cur.xNumber) % parseFloat(item.secondPackQty)
for (let j = 0; j < cur.xNumber; j++) {
twoId.value++
//
if (cur.xLastNumber) {
//
if (j == cur.xNumbery - 1) {
cur.children.push({
id: twoId.value,
xPoNumber: j + 1,
qty1: cur.xLastNumber
})
} else {
//
cur.children.push({
id: twoId.value,
xPoNumber: j + 1,
qty1: item.secondPackQty
})
}
} else {
// ,
cur.children.push({
id: twoId.value,
xPoNumber: j + 1,
qty1: item.secondPackQty
})
}
}
})
}
}else{
//
item.lastNumber = parseFloat(item.orderQty) % parseFloat(item.secondPackQty)
item.children=[]
console.log(item.packQty1)
for (let i = 0; i < item.packQty1; i++) {
oneId.value++
if (item.lastNumber) {
//
if (i == item.packQty - 1) {
item.children.push({
id: oneId.value,
xPoNumber : i + 1,
qty1: item.lastNumber
})
} else {
//
item.children.push({
id: oneId.value,
xPoNumber: i + 1,
qty1: item.secondPackQty
})
}
}else{
item.children.push({
id: oneId.value,
xPoNumber: i + 1,
qty1: item.secondPackQty
})
}
}
console.log(item.children)
}
})
console.log(tableData.value)
}
/** 弹窗按钮 */
let Butttondata: any = []
Butttondata = [
defaultButtons.formSaveBtn(null), //
defaultButtons.formCloseBtn(null) //
]
/** 按钮事件 */
const buttonBaseClick = (val) => {
//
if (val == 'save') {
submitForm()
}
//
else if (val == 'close') {
dialogTableVisible.value = false
}
}
//
const addT = (oneRow) => {
console.log(oneRow)
oneId.value++
oneRow.children.push({
id: oneId.value,
tPoNumber: oneRow.children[oneRow.children.length - 1].tPoNumber + 1,
xNumber: '',
qty1: ''
})
oneRow.packQty1 = oneRow.children.length
}
//
const removeT = (oneRow, oneIndex, twoRow, twoIndex) => {
oneRow.children.splice(twoIndex, 1)
oneRow.packQty1 = oneRow.children.length
}
const addX = (oneRow, oneIndex, twoRow, twoIndex,type) => {
twoId.value++
//
if(type == 1){
console.log(444,twoRow.children)
twoRow.children.push({
id:twoId.value,
xPoNumber: twoRow?.children[twoRow.children.length - 1]?.xPoNumber? twoRow?.children[twoRow.children.length - 1]?.xPoNumber:0 + 1,
qty1: ''
})
twoRow.xNumber = twoRow.children.length
}else{
oneRow.children.push({
id:oneId.value,
xPoNumber: oneRow.children[oneRow.children.length - 1].xPoNumber + 1,
qty1: ''
})
oneRow.packQty1 = oneRow.children.length
}
}
const removeX = (oneRow, oneIndex, twoRow, twoIndex, threeRow, threeIndex,type) => {
//
if(type == 1){
twoRow.children.splice(threeIndex, 1)
let num = 0
twoRow.children.forEach((item) => {
num += parseFloat(item.qty1) || 0
})
twoRow.qty1 = num
twoRow.xNumber = twoRow.children.length
}else{
oneRow.children.splice(twoIndex, 1)
oneRow.packQty1 = oneRow.children.length
}
}
//
const getRowClass = (row) => {
if (!row.row.children || row.row.children.length == 0) {
return 'row-expand-cover'
}
}
const blurOne = (oneRow, twoRow) => {
if (parseFloat(twoRow.xNumber) > parseFloat(oneRow.otherNumber)) {
message.warning('每托箱个数最多' + oneRow.otherNumber + '箱')
twoRow.xNumber = oneRow.otherNumber
twoRow.children = []
twoRow.qty1 = parseFloat(twoRow.xNumber) * parseFloat(oneRow.secondPackQty)
}
twoRow.qty1 = parseFloat(twoRow.xNumber) * parseFloat(oneRow.secondPackQty)
let num = 0
oneRow.children.forEach((item) => {
num += parseFloat(item.xNumber) || 0
})
if (num > oneRow.allPackQty) {
message.warning('总箱数不可以大于' + oneRow.allPackQty)
twoRow.xNumber = ''
return
}
//
if (oneRow.secondPackUnit && oneRow.secondPackQty) {
oneRow.children.forEach((cur, key) => {
cur.children = []
//
cur.xLastNumber = parseFloat(cur.xNumber) % parseFloat(oneRow.secondPackQty)
for (let j = 0; j < cur.xNumber; j++) {
twoId.value++
//
if (cur.xLastNumber) {
//
if (j == cur.xNumbery - 1) {
cur.children.push({
id: twoId.value,
xPoNumber: j + 1,
qty1: cur.xLastNumber
})
} else {
//
cur.children.push({
id: twoId.value,
xPoNumber: j + 1,
qty1: oneRow.secondPackQty
})
}
} else {
// ,
cur.children.push({
id: twoId.value,
xPoNumber: j + 1,
qty1: oneRow.secondPackQty
})
}
}
})
}
}
const blurTwo = (oneRow, twoRow, threeRow) => {
if (parseFloat(threeRow.xNumber) > parseFloat(oneRow.secondPackQty)) {
message.warning('数量不可以大于箱数量')
threeRow.qty1 = ''
return
}
let num = 0
twoRow.children.forEach((item) => {
num += parseFloat(item.qty1) || 0
})
twoRow.qty1 = num
}
const blurThree = (oneRow,twoRow)=>{
if(parseFloat(twoRow.qty1)>parseFloat(oneRow.secondPackQty)){
message.warning('每箱个数最多' + oneRow.secondPackQty )
twoRow.qty1 =oneRow.secondPackQty
}
}
defineExpose({ openLabel }) // open
</script>
<style lang="scss" scoped>
::v-deep .row-expand-cover td .el-table__expand-icon {
visibility: hidden;
}
</style>
Loading…
Cancel
Save