Browse Source

上传质量报告功能

master_hella_20240701
yufei0306 8 months ago
parent
commit
632d193583
  1. 13
      src/utils/disposition/defaultButtons.ts
  2. 91
      src/views/wms/purchasereceiptManage/supplierdeliver/supplierdeliverRequestMain/index.vue
  3. 204
      src/views/wms/purchasereceiptManage/supplierdeliver/supplierdeliverRequestMain/supplierdeliverRequestMain.data.ts

13
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) { export function mainListPlanSubBtn(option:any) {
return __defaultBtnOption(option,{ return __defaultBtnOption(option,{

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

@ -45,6 +45,8 @@
<!-- 表单弹窗添加/修改 --> <!-- 表单弹窗添加/修改 -->
<BasicForm <BasicForm
ref="formRef" ref="formRef"
:isOpenSearchTable="true"
:indexTableColumn="3"
@success="getList" @success="getList"
:rules="SupplierdeliverRequestMainRules" :rules="SupplierdeliverRequestMainRules"
:formAllSchemas="SupplierdeliverRequestMain.allSchemas" :formAllSchemas="SupplierdeliverRequestMain.allSchemas"
@ -99,6 +101,18 @@
@submitForm="submitFormLabel" @submitForm="submitFormLabel"
:isShowReduceButton="false" :isShowReduceButton="false"
/> />
<!-- 上传质量报告 -->
<BasicForm
ref="ploadQualityReportRef"
@success="getList"
:formAllSchemas="UploadQualityReport.allSchemas"
:tableAllSchemas="UploadQualityReport.allSchemas"
:tableData="ploadQualityReportTableData"
@handleAddTable="handleAddTableUploadQualityReport"
@handleDeleteTable="handleDeleteTableUploadQualityReport"
@submitForm="submitFormUploadQualityReport"
:isShowReduceButton="true"
/>
</template> </template>
@ -112,12 +126,12 @@ import {
SupplierdeliverRequestDetail, SupplierdeliverRequestDetail,
SupplierdeliverRequestDetailRules, SupplierdeliverRequestDetailRules,
SupplierdeliverRequestDetailLabel, SupplierdeliverRequestDetailLabel,
UploadQualityReport
} from './supplierdeliverRequestMain.data' } from './supplierdeliverRequestMain.data'
import * as SupplierdeliverRequestMainApi from '@/api/wms/supplierdeliverRequestMain' import * as SupplierdeliverRequestMainApi from '@/api/wms/supplierdeliverRequestMain'
import * as SupplierdeliverRequestDetailApi from '@/api/wms/supplierdeliverRequestDetail' import * as SupplierdeliverRequestDetailApi from '@/api/wms/supplierdeliverRequestDetail'
import * as defaultButtons from '@/utils/disposition/defaultButtons' import * as defaultButtons from '@/utils/disposition/defaultButtons'
import { formatDate,addDay } from '@/utils/formatTime' import { formatDate } from '@/utils/formatTime'
import * as itemBasicApi from '@/api/wms/itembasic'
// //
defineOptions({ name: 'SupplierdeliverRequestMain' }) defineOptions({ name: 'SupplierdeliverRequestMain' })
@ -139,25 +153,28 @@ const planArriveTimeStr = ref()
// //
const searchTableSuccess = (formField, searchField, val, formRef, type, row) => { const searchTableSuccess = (formField, searchField, val, formRef, type, row) => {
nextTick(() => { nextTick(() => {
console.log("type:",type)
console.log("formField:",formField) console.log("formField:",formField)
if (type == 'tableForm') { if (type == 'tableForm') {
// //
row[formField] = val[0][searchField] // row[formField] = val[0][searchField]
if (formField == 'poNumber') { // if (formField == 'poNumber') {
row['poNumber'] = val[0]['poNumber'] // row['poNumber'] = val[0]['poNumber']
row['itemCode'] = val[0]['itemCode'] // row['itemCode'] = val[0]['itemCode']
row['poLine'] = val[0]['poLine'] // row['poLine'] = val[0]['poLine']
row['orderQty'] = val[0]['orderQty'] // row['orderQty'] = val[0]['orderQty']
row['uom'] = val[0]['uom'] // row['uom'] = val[0]['uom']
itemBasicApi.getItembasicPage({ // }
code: val[0]['itemCode'] val.forEach(item=>{
}).then((res) => { const newRow = {...row}
let cf = addDay(row['produceDate'],res.list[0].validityDays); newRow[formField] = item[searchField]
row['expireDate'] = cf; newRow['poNumber'] = item['poNumber']
}).catch((err) => { newRow['itemCode'] = item['itemCode']
console.log(err) newRow['poLine'] = item['poLine']
}) newRow['orderQty'] = item['orderQty']
} newRow['uom'] = item['uom']
tableData.value.push(newRow)
})
} else { } else {
const setV = {} const setV = {}
setV[formField] = val[0][searchField] setV[formField] = val[0][searchField]
@ -292,6 +309,7 @@ const isShowMainButtonLabel = (row, val) => {
const butttondata = (row) => { const butttondata = (row) => {
return [ return [
defaultButtons.mainListPurchasePlanOpeBtn({ hide: isShowMainButton(row, ['5']) }), // defaultButtons.mainListPurchasePlanOpeBtn({ hide: isShowMainButton(row, ['5']) }), //
defaultButtons.mainListPlanUploadQualityReportBtn({ hide: isShowMainButton(row, ['1']) }), //
defaultButtons.mainListPlanSubBtn({ hide: isShowMainButton(row, ['1']) }), // defaultButtons.mainListPlanSubBtn({ hide: isShowMainButton(row, ['1']) }), //
defaultButtons.mainListPlanAppBtn({ hide: isShowMainButton(row, ['2']) }), // defaultButtons.mainListPlanAppBtn({ hide: isShowMainButton(row, ['2']) }), //
defaultButtons.mainListPlanTurBtn({ hide: isShowMainButton(row, ['2']) }), // defaultButtons.mainListPlanTurBtn({ hide: isShowMainButton(row, ['2']) }), //
@ -335,7 +353,10 @@ const buttonTableClick = async (val, row) => {
} else if (val == 'mainPurPlanClo') { } else if (val == 'mainPurPlanClo') {
// //
handleClo(row.id) handleClo(row.id)
} else if (val == 'mainPlanSub') { } else if (val == 'mainPlanUploadQualityReport') {
//
handleUploadQualityReport(row.id)
} else if (val == 'mainPlanSub') {
// //
handleSub(row.id) handleSub(row.id)
} else if (val == 'mainPlanApp') { } else if (val == 'mainPlanApp') {
@ -475,6 +496,38 @@ const handleOpe = async (id: number) => {
tableObject.loading = false 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) => { const handleSub = async (id: number) => {

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

@ -224,20 +224,20 @@ export const SupplierdeliverRequestMain = useCrudSchemas(reactive<CrudSchema[]>(
width: 150 width: 150
}, },
}, },
{ // {
label: '业务类型', // label: '业务类型',
field: 'businessType', // field: 'businessType',
sort: 'custom', // sort: 'custom',
table: { // table: {
width: 150 // width: 150
}, // },
form: { // form: {
value: 'SupplierDeliver', // value: 'SupplierDeliver',
componentProps: { // componentProps: {
disabled: true, // disabled: true,
} // }
} // }
}, // },
{ {
label: '备注', label: '备注',
field: 'remark', field: 'remark',
@ -322,29 +322,29 @@ export const SupplierdeliverRequestMain = useCrudSchemas(reactive<CrudSchema[]>(
}, },
isForm: false isForm: false
}, },
{ // {
label: '部门', // label: '部门',
field: 'departmentCode', // field: 'departmentCode',
sort: 'custom', // sort: 'custom',
table: { // table: {
width: 150 // width: 150
}, // },
formatter: (_: Recordable, __: TableColumn, cellValue: number) => { // formatter: (_: Recordable, __: TableColumn, cellValue: number) => {
return userDeptArray.find((account) => account.id == cellValue)?.name // return userDeptArray.find((account) => account.id == cellValue)?.name
}, // },
form: { // form: {
value: userDept.id, // value: userDept.id,
component: 'Select', // component: 'Select',
api: () => userDeptArray, // api: () => userDeptArray,
componentProps: { // componentProps: {
disabled: true, // disabled: true,
optionsAlias: { // optionsAlias: {
labelField: 'name', // labelField: 'name',
valueField: 'id' // valueField: 'id'
} // }
} // }
} // }
}, // },
{ {
label: '状态', label: '状态',
field: 'status', field: 'status',
@ -528,9 +528,9 @@ export const SupplierdeliverRequestMainRules = reactive({
planArriveTime: [ planArriveTime: [
{ required: true, message: '请输入计划到货时间', trigger: 'blur' } { required: true, message: '请输入计划到货时间', trigger: 'blur' }
], ],
departmentCode: [ // departmentCode: [
{ required: true, message: '请输入部门', trigger: 'blur' } // { required: true, message: '请输入部门', trigger: 'blur' }
], // ],
autoCommit: [ autoCommit: [
{ required: true, message: '请选择是否自动提交', trigger: 'change' } { required: true, message: '请选择是否自动提交', trigger: 'change' }
], ],
@ -586,19 +586,19 @@ export const SupplierdeliverRequestDetail = useCrudSchemas(reactive<CrudSchema[]
width: 150 width: 150
}, },
tableForm: { tableForm: {
disabled: true disabled: false
} }
}, },
{ // {
label: '替代批次', // label: '替代批次',
field: 'altBatch', // field: 'altBatch',
sort: 'custom', // sort: 'custom',
table: { // table: {
width: 150 // width: 150
}, // },
isTableForm: false, // isTableForm: false,
isForm: false // isForm: false
}, // },
{ {
label: '到货日期', label: '到货日期',
field: 'arriveDate', field: 'arriveDate',
@ -1014,6 +1014,19 @@ export const SupplierdeliverRequestDetail = useCrudSchemas(reactive<CrudSchema[]
} }
])) ]))
// 批次校验
const validateBatch = (rule: any, value: any, callback: any) => {
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({ export const SupplierdeliverRequestDetailRules = reactive({
// packingNumber: [ // packingNumber: [
@ -1022,6 +1035,7 @@ export const SupplierdeliverRequestDetailRules = reactive({
batch: [ batch: [
{ required: true, message: '请输入批次', trigger: 'blur' }, { required: true, message: '请输入批次', trigger: 'blur' },
{ max: 50, message: '不得超过50个字符', trigger: 'blur' }, { max: 50, message: '不得超过50个字符', trigger: 'blur' },
{ validator: validateBatch, trigger: 'change' }
], ],
produceDate: [ produceDate: [
{ required: true, message: '请输入生产日期', trigger: 'blur' } { required: true, message: '请输入生产日期', trigger: 'blur' }
@ -1089,19 +1103,19 @@ export const SupplierdeliverRequestDetailLabel = useCrudSchemas(reactive<CrudSch
valueFormat: 'x', valueFormat: 'x',
} }
}, },
{ // {
label: '替代批次', // label: '替代批次',
field: 'altBatch', // field: 'altBatch',
sort: 'custom', // sort: 'custom',
table: { // table: {
width: 150 // width: 150
}, // },
isTableForm: false, // isTableForm: false,
isForm: false, // isForm: false,
tableForm:{ // tableForm:{
disabled:true // disabled:true
} // }
}, // },
{ {
label: '到货日期', label: '到货日期',
field: 'arriveDate', field: 'arriveDate',
@ -1561,4 +1575,66 @@ export const SupplierdeliverRequestDetailLabel = useCrudSchemas(reactive<CrudSch
isTableForm: false, isTableForm: false,
isForm: false isForm: false
}, },
]))
export const UploadQualityReport = useCrudSchemas(reactive<CrudSchema[]>([
{
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
},
},
])) ]))
Loading…
Cancel
Save