Browse Source

上传质量报告功能

master_hella_20240701
yufei0306 7 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) {
return __defaultBtnOption(option,{

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

@ -45,6 +45,8 @@
<!-- 表单弹窗添加/修改 -->
<BasicForm
ref="formRef"
:isOpenSearchTable="true"
:indexTableColumn="3"
@success="getList"
:rules="SupplierdeliverRequestMainRules"
:formAllSchemas="SupplierdeliverRequestMain.allSchemas"
@ -99,6 +101,18 @@
@submitForm="submitFormLabel"
:isShowReduceButton="false"
/>
<!-- 上传质量报告 -->
<BasicForm
ref="ploadQualityReportRef"
@success="getList"
:formAllSchemas="UploadQualityReport.allSchemas"
:tableAllSchemas="UploadQualityReport.allSchemas"
:tableData="ploadQualityReportTableData"
@handleAddTable="handleAddTableUploadQualityReport"
@handleDeleteTable="handleDeleteTableUploadQualityReport"
@submitForm="submitFormUploadQualityReport"
:isShowReduceButton="true"
/>
</template>
@ -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) => {

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

@ -224,20 +224,20 @@ export const SupplierdeliverRequestMain = useCrudSchemas(reactive<CrudSchema[]>(
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<CrudSchema[]>(
},
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<CrudSchema[]
width: 150
},
tableForm: {
disabled: true
disabled: false
}
},
{
label: '替代批次',
field: 'altBatch',
sort: 'custom',
table: {
width: 150
},
isTableForm: false,
isForm: false
},
// {
// label: '替代批次',
// field: 'altBatch',
// sort: 'custom',
// table: {
// width: 150
// },
// isTableForm: false,
// isForm: false
// },
{
label: '到货日期',
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({
// 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<CrudSch
valueFormat: 'x',
}
},
{
label: '替代批次',
field: 'altBatch',
sort: 'custom',
table: {
width: 150
},
isTableForm: false,
isForm: false,
tableForm:{
disabled:true
}
},
// {
// label: '替代批次',
// field: 'altBatch',
// sort: 'custom',
// table: {
// width: 150
// },
// isTableForm: false,
// isForm: false,
// tableForm:{
// disabled:true
// }
// },
{
label: '到货日期',
field: 'arriveDate',
@ -1561,4 +1575,66 @@ export const SupplierdeliverRequestDetailLabel = useCrudSchemas(reactive<CrudSch
isTableForm: 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