From 632d19358386dd4678a5be7702f9d345b53f64af Mon Sep 17 00:00:00 2001 From: yufei0306 <13417315+yufei0306@user.noreply.gitee.com> Date: Tue, 9 Apr 2024 19:46:37 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E8=B4=A8=E9=87=8F=E6=8A=A5?= =?UTF-8?q?=E5=91=8A=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/utils/disposition/defaultButtons.ts | 13 ++ .../supplierdeliverRequestMain/index.vue | 91 ++++++-- .../supplierdeliverRequestMain.data.ts | 204 ++++++++++++------ 3 files changed, 225 insertions(+), 83 deletions(-) diff --git a/src/utils/disposition/defaultButtons.ts b/src/utils/disposition/defaultButtons.ts index 998e0a9ac..664d6d47e 100644 --- a/src/utils/disposition/defaultButtons.ts +++ b/src/utils/disposition/defaultButtons.ts @@ -471,6 +471,19 @@ export function mainListPlanCloBtn(option:any) { }) } +// 主列表-上传质量报告 +export function mainListPlanUploadQualityReportBtn(option:any) { + return __defaultBtnOption(option,{ + label: '上传质量报告', + name: 'mainPlanUploadQualityReport', + hide: false, + type: 'primary', + color: '', + link: true, // 文本展现按钮 + hasPermi: '' + }) +} + // 主列表-计划流程-提交审批按钮 export function mainListPlanSubBtn(option:any) { return __defaultBtnOption(option,{ diff --git a/src/views/wms/purchasereceiptManage/supplierdeliver/supplierdeliverRequestMain/index.vue b/src/views/wms/purchasereceiptManage/supplierdeliver/supplierdeliverRequestMain/index.vue index e046b3943..6f933f9f5 100644 --- a/src/views/wms/purchasereceiptManage/supplierdeliver/supplierdeliverRequestMain/index.vue +++ b/src/views/wms/purchasereceiptManage/supplierdeliver/supplierdeliverRequestMain/index.vue @@ -45,6 +45,8 @@ + + @@ -112,12 +126,12 @@ import { SupplierdeliverRequestDetail, SupplierdeliverRequestDetailRules, SupplierdeliverRequestDetailLabel, + UploadQualityReport } from './supplierdeliverRequestMain.data' import * as SupplierdeliverRequestMainApi from '@/api/wms/supplierdeliverRequestMain' import * as SupplierdeliverRequestDetailApi from '@/api/wms/supplierdeliverRequestDetail' import * as defaultButtons from '@/utils/disposition/defaultButtons' -import { formatDate,addDay } from '@/utils/formatTime' -import * as itemBasicApi from '@/api/wms/itembasic' +import { formatDate } from '@/utils/formatTime' // 供应商发货申请 defineOptions({ name: 'SupplierdeliverRequestMain' }) @@ -139,25 +153,28 @@ const planArriveTimeStr = ref() // 查询页面返回 const searchTableSuccess = (formField, searchField, val, formRef, type, row) => { nextTick(() => { + console.log("type:",type) console.log("formField:",formField) if (type == 'tableForm') { // 明细查询页赋值 - row[formField] = val[0][searchField] - if (formField == 'poNumber') { - row['poNumber'] = val[0]['poNumber'] - row['itemCode'] = val[0]['itemCode'] - row['poLine'] = val[0]['poLine'] - row['orderQty'] = val[0]['orderQty'] - row['uom'] = val[0]['uom'] - itemBasicApi.getItembasicPage({ - code: val[0]['itemCode'] - }).then((res) => { - let cf = addDay(row['produceDate'],res.list[0].validityDays); - row['expireDate'] = cf; - }).catch((err) => { - console.log(err) - }) - } + // row[formField] = val[0][searchField] + // if (formField == 'poNumber') { + // row['poNumber'] = val[0]['poNumber'] + // row['itemCode'] = val[0]['itemCode'] + // row['poLine'] = val[0]['poLine'] + // row['orderQty'] = val[0]['orderQty'] + // row['uom'] = val[0]['uom'] + // } + val.forEach(item=>{ + const newRow = {...row} + newRow[formField] = item[searchField] + newRow['poNumber'] = item['poNumber'] + newRow['itemCode'] = item['itemCode'] + newRow['poLine'] = item['poLine'] + newRow['orderQty'] = item['orderQty'] + newRow['uom'] = item['uom'] + tableData.value.push(newRow) + }) } else { const setV = {} setV[formField] = val[0][searchField] @@ -292,6 +309,7 @@ const isShowMainButtonLabel = (row, val) => { const butttondata = (row) => { return [ defaultButtons.mainListPurchasePlanOpeBtn({ hide: isShowMainButton(row, ['5']) }), // 打开 + defaultButtons.mainListPlanUploadQualityReportBtn({ hide: isShowMainButton(row, ['1']) }), // 提交审批 defaultButtons.mainListPlanSubBtn({ hide: isShowMainButton(row, ['1']) }), // 提交审批 defaultButtons.mainListPlanAppBtn({ hide: isShowMainButton(row, ['2']) }), // 审批通过 defaultButtons.mainListPlanTurBtn({ hide: isShowMainButton(row, ['2']) }), // 驳回按钮 @@ -335,7 +353,10 @@ const buttonTableClick = async (val, row) => { } else if (val == 'mainPurPlanClo') { // 关闭 handleClo(row.id) - } else if (val == 'mainPlanSub') { + } else if (val == 'mainPlanUploadQualityReport') { + // 上传质量报告 + handleUploadQualityReport(row.id) + } else if (val == 'mainPlanSub') { // 提交审批 handleSub(row.id) } else if (val == 'mainPlanApp') { @@ -475,6 +496,38 @@ const handleOpe = async (id: number) => { tableObject.loading = false } } +const ploadQualityReportRef = ref() +const ploadQualityReportTableData = ref([]) +/** 上传质量报告 */ +const handleUploadQualityReport = async (id: number) => { + console.log('UploadQualityReport',UploadQualityReport.allSchemas) + // ploadQualityReportRef.value.dialogVisible = true + ploadQualityReportRef.value.open('create', null, null,'上传质量报告')//创建标签页面 createLabel 标题 + const tableFormKeys = {} + UploadQualityReport.allSchemas.tableFormColumns.forEach((item) => { + tableFormKeys[item.field] = item.default ? item.default : '' + }) + ploadQualityReportTableData.value = [tableFormKeys] +} +const handleAddTableUploadQualityReport = ()=>{ + const tableFormKeys = {} + UploadQualityReport.allSchemas.tableFormColumns.forEach((item) => { + tableFormKeys[item.field] = item.default ? item.default : '' + }) + ploadQualityReportTableData.value.push(tableFormKeys) +} +const handleDeleteTableUploadQualityReport = (item, index) => { + ploadQualityReportTableData.value.splice(index, 1) +} + +const submitFormUploadQualityReport = (formType, data) => { + console.log("formType==",formType) + console.log("data==",data) + ploadQualityReportRef.value.dialogVisible = false + // formLabelRef.value.formLoading = false + // formLabelRef.value.dialogVisible = false + +} /** 提交审批按钮操作 */ const handleSub = async (id: number) => { diff --git a/src/views/wms/purchasereceiptManage/supplierdeliver/supplierdeliverRequestMain/supplierdeliverRequestMain.data.ts b/src/views/wms/purchasereceiptManage/supplierdeliver/supplierdeliverRequestMain/supplierdeliverRequestMain.data.ts index 1f34ebe5b..e57d5b280 100644 --- a/src/views/wms/purchasereceiptManage/supplierdeliver/supplierdeliverRequestMain/supplierdeliverRequestMain.data.ts +++ b/src/views/wms/purchasereceiptManage/supplierdeliver/supplierdeliverRequestMain/supplierdeliverRequestMain.data.ts @@ -224,20 +224,20 @@ export const SupplierdeliverRequestMain = useCrudSchemas(reactive( width: 150 }, }, - { - label: '业务类型', - field: 'businessType', - sort: 'custom', - table: { - width: 150 - }, - form: { - value: 'SupplierDeliver', - componentProps: { - disabled: true, - } - } - }, + // { + // label: '业务类型', + // field: 'businessType', + // sort: 'custom', + // table: { + // width: 150 + // }, + // form: { + // value: 'SupplierDeliver', + // componentProps: { + // disabled: true, + // } + // } + // }, { label: '备注', field: 'remark', @@ -322,29 +322,29 @@ export const SupplierdeliverRequestMain = useCrudSchemas(reactive( }, isForm: false }, - { - label: '部门', - field: 'departmentCode', - sort: 'custom', - table: { - width: 150 - }, - formatter: (_: Recordable, __: TableColumn, cellValue: number) => { - return userDeptArray.find((account) => account.id == cellValue)?.name - }, - form: { - value: userDept.id, - component: 'Select', - api: () => userDeptArray, - componentProps: { - disabled: true, - optionsAlias: { - labelField: 'name', - valueField: 'id' - } - } - } - }, + // { + // label: '部门', + // field: 'departmentCode', + // sort: 'custom', + // table: { + // width: 150 + // }, + // formatter: (_: Recordable, __: TableColumn, cellValue: number) => { + // return userDeptArray.find((account) => account.id == cellValue)?.name + // }, + // form: { + // value: userDept.id, + // component: 'Select', + // api: () => userDeptArray, + // componentProps: { + // disabled: true, + // optionsAlias: { + // labelField: 'name', + // valueField: 'id' + // } + // } + // } + // }, { label: '状态', field: 'status', @@ -528,9 +528,9 @@ export const SupplierdeliverRequestMainRules = reactive({ planArriveTime: [ { required: true, message: '请输入计划到货时间', trigger: 'blur' } ], - departmentCode: [ - { required: true, message: '请输入部门', trigger: 'blur' } - ], + // departmentCode: [ + // { required: true, message: '请输入部门', trigger: 'blur' } + // ], autoCommit: [ { required: true, message: '请选择是否自动提交', trigger: 'change' } ], @@ -586,19 +586,19 @@ export const SupplierdeliverRequestDetail = useCrudSchemas(reactive { + const reg = /^[_a-zA-Z0-9]+$/; + if (value == '' || value == undefined || value == null) { + callback(); + } else { + if (!reg.test(value)) { + callback(new Error('英文字母、数字或下划线')); + } else { + callback(); + } + } +} //表单校验 export const SupplierdeliverRequestDetailRules = reactive({ // packingNumber: [ @@ -1022,6 +1035,7 @@ export const SupplierdeliverRequestDetailRules = reactive({ batch: [ { required: true, message: '请输入批次', trigger: 'blur' }, { max: 50, message: '不得超过50个字符', trigger: 'blur' }, + { validator: validateBatch, trigger: 'change' } ], produceDate: [ { required: true, message: '请输入生产日期', trigger: 'blur' } @@ -1089,19 +1103,19 @@ export const SupplierdeliverRequestDetailLabel = useCrudSchemas(reactive([ + { + label: '上传质检报告', + field: 'uploadFile', + sort: 'custom', + isTable:false, + isTableForm:false, + form: { + component: 'UploadFile', + componentProps: { + upData:{ + tableId: '', + tableName: '' + }, + limit:1, + } + }, + }, + { + label: '物料代码', + field: 'itemCode', + sort: 'custom', + isForm:false, + isTableForm:true, + table: { + width: 150, + }, + }, + { + label: '计量单位', + field: 'uom', + sort: 'custom', + isForm:false, + isTableForm:true, + table: { + width: 150, + }, + }, + { + label: '数量', + field: 'orderQty', + table: { + width: 150 + }, + isForm:false, + tableForm: { + type: 'InputNumber', + min: 0, + precision: 6 + } + }, + { + label: '批次', + field: 'batch', + sort: 'custom', + isForm:false, + table: { + width: 150 + }, + }, ])) \ No newline at end of file