diff --git a/src/views/qms/inspectionQ2/index.vue b/src/views/qms/inspectionQ2/index.vue index 035970ae9..92cec2464 100644 --- a/src/views/qms/inspectionQ2/index.vue +++ b/src/views/qms/inspectionQ2/index.vue @@ -49,7 +49,7 @@ { const { claimAddress } = formModel formRef.value.setValues({ @@ -63,19 +63,28 @@ :apiUpdate="Q2Api.updateQ2" :apiCreate="Q2Api.createQ2" @searchTableSuccess="searchTableSuccess" + @clearSearchInput="clearSearchInput" :isBusiness="false" @onChange="onChange" > - @@ -105,6 +114,7 @@ import * as SupplierApi from '@/api/wms/supplier' import * as ItembasicApi from '@/api/wms/itembasic' import { useUserStore } from '@/store/modules/user' import { usePageLoading } from '@/hooks/web/usePageLoading' +import { log } from 'console' const { loadStart, loadDone } = usePageLoading() const userStore = useUserStore() @@ -117,7 +127,42 @@ const route = useRoute() // 路由信息 const routeName = ref() routeName.value = route.name const tableColumns = ref(Q2.allSchemas.tableColumns) - +const clearSearchInput = (formField) => { + if (formField == 'itemCode') { + basicFormRef.value.formRef.setValues({ + itemName: '', + SupplierCode: '', + SupplierName: '' + }) + } + if (formField == 'lightItemCode') { + basicFormRef.value.formRef.setValues({ + standardCostPrice: '', + lightQty: 0, + claimAmount: '', + otherClaimAmount: 0, + summaryAmount: 0, + disbursementAmount: 0, + remainingAmount: 0 + }) + const params2 = { + by: 'ASC', + filters: [{ column: 'itemCode', action: '==', value: basicFormRef.value.formRef.formModel.itemCode }], + pageNo: 1, + pageSize: 500, + sort: '' + } + params2.isSearch = true + StdcostpriceApi.getStdcostpricePage(params2).then((res) => { + if (res.list?.length > 0) { + priceObj.value = res.list[0] + basicFormRef.value.formRef.setValues({ + standardCostPrice: priceObj.value.price + }) + } + }) + } +} // 查询页面返回 const priceObj = ref() const searchTableSuccess = (formField, searchField, val, formRef) => { @@ -147,7 +192,7 @@ const searchTableSuccess = (formField, searchField, val, formRef) => { if (formField == 'purchaseReceiptNumber') { let result = '' for (var i = 0; i < val.length; i++) { - result += val[i].number + ',' + result += val[i].receiptNumber + ',' } if (result.endsWith(',')) { result = result.substring(0, result.length - 1) @@ -187,7 +232,7 @@ const searchTableSuccess = (formField, searchField, val, formRef) => { formRef.setValues(setV) } - if (formField == 'q1Number') { + if (formField == 'q1Number') { setV['q1Number'] = val[0].code setV[formField] = val[0][searchField] formRef.setValues(setV) @@ -248,6 +293,32 @@ const searchTableSuccess = (formField, searchField, val, formRef) => { }) } }) + + if (val[0].lightItemCode == null) { + setV['standardCostPrice'] = '' + setV['lightQty'] = 0 + setV['claimAmount'] = '' + setV['otherClaimAmount'] = 0 + setV['summaryAmount'] = 0 + setV['disbursementAmount'] = 0 + setV['remainingAmount'] = 0 + const params2 = { + by: 'ASC', + filters: [{ column: 'itemCode', action: '==', value: val[0].itemCode }], + pageNo: 1, + pageSize: 500, + sort: '' + } + params2.isSearch = true + StdcostpriceApi.getStdcostpricePage(params2).then((res) => { + if (res.list?.length > 0) { + priceObj.value = res.list[0] + formRef.setValues({ + standardCostPrice: priceObj.value.price + }) + } + }) + } setV[formField] = val[0][searchField] formRef.setValues(setV) } @@ -255,8 +326,6 @@ const searchTableSuccess = (formField, searchField, val, formRef) => { } const onChange = (field, e) => { - console.log('onChange',field) - console.log(basicFormRef.value.formRef.formModel) if (field == 'lightQty') { basicFormRef.value.formRef.formModel.claimAmount = ( parseFloat(basicFormRef.value.formRef.formModel.lightQty) * @@ -265,7 +334,7 @@ const onChange = (field, e) => { ).toFixed(6) basicFormRef.value.formRef.formModel.summaryAmount = ( parseFloat(basicFormRef.value.formRef.formModel.claimAmount) + - parseFloat(basicFormRef.value.formRef.formModel.otherClaimAmount||0) + parseFloat(basicFormRef.value.formRef.formModel.otherClaimAmount || 0) ).toFixed(6) basicFormRef.value.formRef.formModel.remainingAmount = ( parseFloat(basicFormRef.value.formRef.formModel.summaryAmount) - @@ -440,7 +509,7 @@ const handleFinish = async (id: number) => { /** 添加/修改操作 */ const basicFormRef = ref() const openForm = (type: string, row?: any) => { - if (row && row.claimAddress?.trim()) { + if (row && row.claimAddress?.trim()) { row.filePathList = row.claimAddress.split(',') } @@ -454,8 +523,8 @@ const openForm = (type: string, row?: any) => { } basicFormRef.value.open(type, row) - if(!row || !row.claimAmount){ - nextTick(() => { + if (!row || !row.claimAmount) { + nextTick(() => { basicFormRef.value.formRef.setValues({ claimAmount: '' }) @@ -470,11 +539,9 @@ const openForm = (type: string, row?: any) => { disbursementAmount: 0 }) }) - const currentTime = new Date().getTime() + const currentTime = new Date().getTime() const fileId = Q2.allSchemas.formSchema.find((item) => item.field == 'fileId') - const uploadFile = Q2.allSchemas.formSchema.find( - (item) => item.field == 'claimAddress' - ) + const uploadFile = Q2.allSchemas.formSchema.find((item) => item.field == 'claimAddress') if (fileId) { fileId['value'] = currentTime } @@ -482,11 +549,8 @@ const openForm = (type: string, row?: any) => { uploadFile['componentProps']['upData']['tableId'] = currentTime uploadFile['componentProps']['modelValue'] = [] } - } - else if (type == 'update') { - const uploadFile = Q2.allSchemas.formSchema.find( - (item) => item.field == 'claimAddress' - ) + } else if (type == 'update') { + const uploadFile = Q2.allSchemas.formSchema.find((item) => item.field == 'claimAddress') uploadFile['componentProps']['modelValue'] = row.filePathListView } } @@ -503,10 +567,10 @@ const formsSuccess = async (formType, data) => { return } } - if (data.lightQty == 0) { - message.error('整灯数量不能为0') - return - } + // if (data.lightQty == 0) { + // message.error('数量不能为0') + // return + // } if (!data.standardCostPrice) { message.error('标准成本价格不能为0或空') return diff --git a/src/views/qms/inspectionQ2/inspectionQ2.data.ts b/src/views/qms/inspectionQ2/inspectionQ2.data.ts index ea33b0796..898bb7f94 100644 --- a/src/views/qms/inspectionQ2/inspectionQ2.data.ts +++ b/src/views/qms/inspectionQ2/inspectionQ2.data.ts @@ -10,8 +10,7 @@ import { Q1 } from '@/views/qms/inspectionQ1/inspectionQ1.data' import * as SupplieritemApi from '@/api/wms/supplieritem' import { Supplieritem } from '@/views/wms/basicDataManage/supplierManage/supplieritem/supplieritem.data' -import * as PurchasereceiptRecordDetailApi from '@/api/wms/purchasereceiptRecordDetail' -import { PurchasereceiptRecordDetail } from '@/views/wms/purchasereceiptManage/purchasereceipt/purchasereceiptRecordMain/purchasereceiptRecordMain.data' +import * as PurchasereturnRequestDetailApi from '@/api/wms/purchasereturnRequestDetail' import * as ItembasicApi from '@/api/wms/itembasic' import { Itembasic } from '@/views/wms/basicDataManage/itemManage/itembasic/itembasic.data' @@ -24,12 +23,11 @@ export const Q2Rules = reactive({ itemCode: [{ required: true, message: '请选择供应商物料代码', trigger: 'change' }], supplierCode: [{ required: true, message: '请选择供应商代码', trigger: 'change' }], purchaseReceiptNumber: [ - { required: true, message: '请选择采购收货单号', trigger: 'change' }, + // { required: true, message: '请选择采购收货单号', trigger: 'change' }, { max: 255, message: '不得超过255个字符', trigger: 'blur' } ], claimTime: [{ required: true, message: '请选择索赔日期', trigger: 'change' }], - lightItemCode: [{ required: true, message: '请选择整灯物料代码', trigger: 'change' }], - lightQty: [{ required: true, message: '请选择整灯数量', trigger: 'change' }], + lightQty: [{ required: true, message: '请选择数量', trigger: 'change' }], code: [{ required: true, message: '请选择缺陷代码', trigger: 'change' }], priority: [{ required: true, message: '请选择优先级', trigger: 'change' }], claimMultiple: [{ required: true, message: '请选择索赔倍数', trigger: 'change' }], @@ -39,6 +37,123 @@ export const Q2Rules = reactive({ handleTime: [{ required: true, message: '请选择选择处理时间', trigger: 'change' }] }) +export const Q2result = useCrudSchemas( + reactive([ + { + label: '收货日期', + field: 'currentDeliveryDate', + isTable: true, + formatter: dateFormatter, + detail: { + dateFormat: 'YYYY-MM-DD HH:mm:ss' + }, + sort: 'custom', + table: { + width: 180 + }, + form: { + component: 'DatePicker', + componentProps: { + style: {width:'100%'}, + type: 'datetime', + dateFormat: 'YYYY-MM-DD HH:mm:ss', + valueFormat: 'x', + } + } + }, + { + label: '收货单号', + field: 'receiptNumber', + sort: 'custom', + tableForm:{ + disabled:true + }, + form: { + componentProps:{ + disabled:true + } + } + }, + { + label: '发货单号', + field: 'asnNumber', + sort: 'custom', + tableForm:{ + disabled:true + }, + form: { + componentProps:{ + disabled:true + } + } + }, + { + label: '订单号', + field: 'poNumber', + sort: 'custom', + table: { + width: 150 + }, + tableForm:{ + disabled:true + }, + form: { + componentProps:{ + disabled:true + } + } + }, + { + label: '订单行', + field: 'poLine', + sort: 'custom', + table: { + width: 150 + }, + tableForm:{ + disabled:true + }, + form: { + componentProps:{ + disabled:true + } + } + }, + { + label: '批次', + field: 'batch', + sort: 'custom', + table: { + width: 150 + }, + tableForm:{ + disabled:true + }, + form: { + componentProps:{ + disabled:true + } + } + }, + { + label: '数量', + field: 'qty', + sort: 'custom', + table: { + width: 150 + }, + tableForm:{ + disabled:true + }, + form: { + componentProps:{ + disabled:true + } + } + } + ]) +) + export const Q2 = useCrudSchemas( reactive([ { @@ -175,8 +290,8 @@ export const Q2 = useCrudSchemas( searchListPlaceholder: '请选择采购收货记录单号', // 输入框占位文本 searchField: 'number', // 查询弹窗赋值字段 searchTitle: '采购收货记录', // 查询弹窗标题 - searchAllSchemas: PurchasereceiptRecordDetail.allSchemas, // 查询弹窗所需类 - searchPage: PurchasereceiptRecordDetailApi.pageForQ2, // 查询弹窗所需分页方法 + searchAllSchemas: Q2result.allSchemas, // 查询弹窗所需类 + searchPage: PurchasereturnRequestDetailApi.getPurchasereturnPurchasereceiptRecordByItemCode, // 查询弹窗所需分页方法 searchCondition: [ { key: 'supplierCode', @@ -238,8 +353,8 @@ export const Q2 = useCrudSchemas( isMainValue: false }, { - key: 'type', - value: 'CCP', + key: 'typeQ2', + value: 'CCP,BCP', isMainValue: false } ], @@ -276,7 +391,7 @@ export const Q2 = useCrudSchemas( } }, { - label: '整灯数量', + label: '数量', field: 'lightQty', sort: 'custom', isTable: true, @@ -624,7 +739,7 @@ export const Q2 = useCrudSchemas( tableName: 'basicInspectionQ2', tableId: '' }, - fileType: ['doc', 'xls', 'ppt', 'txt'], + fileType: ['doc', 'xls', 'ppt', 'txt', 'pdf'], modelValue: [] } } @@ -759,3 +874,5 @@ export const Q2 = useCrudSchemas( } ]) ) + +