diff --git a/src/views/qms/inspection/inspectionJob/addForm.vue b/src/views/qms/inspection/inspectionJob/addForm.vue index d1217fd2b..fdef80d4c 100644 --- a/src/views/qms/inspection/inspectionJob/addForm.vue +++ b/src/views/qms/inspection/inspectionJob/addForm.vue @@ -26,7 +26,7 @@ :maxHeight = "490" :tableFields="tableAllSchemas.tableFormColumns" :tableFormRules="tableFormRules" - :tableData="data.packageVOList" + :tableData="data.packageList" :isShowButton="false" :isShowReduceButton="false" /> @@ -312,7 +312,6 @@ - @@ -359,7 +358,6 @@ - + + diff --git a/src/views/qms/inspection/inspectionRecord/index.vue b/src/views/qms/inspection/inspectionRecord/index.vue index 7d7cacf9c..3bf88f430 100644 --- a/src/views/qms/inspection/inspectionRecord/index.vue +++ b/src/views/qms/inspection/inspectionRecord/index.vue @@ -27,21 +27,30 @@ - + :apiCreate="InspectionRecordMainApi.createInspectionRecordMain" - - + @handleAddTable="handleAddTable" + @handleDeleteTable="handleDeleteTable" + @searchTableSuccess="searchTableSuccess" + @submitForm="submitForm" /> --> + import download from '@/utils/download' - import { InspectionRecordMain, InspectionRecordMainRules, InspectionRecordDetail, InspectionRecordDetailRules } from './inspectionRecordMain.data' - import { InspectionJobPackage} from '../inspectionJob/inspectionJobMain.data' + import { InspectionRecordMain, InspectionRecordMainRules, InspectionRecordDetail, InspectionRecordDetailRules,InspectionRecordPackage, InspectionRecordPackageRules} from './inspectionRecordMain.data' + // import { InspectionJobPackage,InspectionJobPackageRules} from '../inspectionJob/inspectionJobMain.data' import * as InspectionRecordMainApi from '@/api/qms/inspectionRecord/inspectionRecordMain' import * as InspectionRecordDetailApi from '@/api/qms/inspectionRecord/inspectionRecordDetail' import * as defaultButtons from '@/utils/disposition/defaultButtons' import listTable from '@/components/listTable/src/listTable.vue' import TableHead from '@/components/TableHead/src/TableHead.vue' + import AddForm from './addForm.vue' import Detail from './detail.vue' // 采购订单 @@ -173,6 +183,7 @@ defaultButtons.mainListEditBtn(null), // 编辑 // defaultButtons.mainListDeleteBtn(null), // 删除 defaultButtons.mainListOrderPubBtn(null), // 发布 + defaultButtons.mainListPackageBtn(null), // 包装 ] } @@ -197,7 +208,7 @@ openForm('update', row) }else if (val == 'mainPackage') { // 包装 const list = await InspectionRecordMainApi.getInspectionRecordPackageList(row.id) - listTableRef.value.openPackage(row,'包装信息',InspectionJobPackage.allSchemas.tableColumns,list) + listTableRef.value.openPackage(row,'包装信息',InspectionRecordPackage.allSchemas.tableColumns,list) }else if (val == 'delete') { // 删除 handleDelete(row.id) }else if (val == 'mainOrderPub') { //发布 @@ -278,8 +289,23 @@ const handleDeleteTable = (item, index) => { tableData.value.splice(index, 1) } - - // 主子数据 提交 + const count = ref(0) + const onChange = (field, cur)=>{ + console.log(field, cur) + // if(field=='useDecision'){ + // if(cur == 1){ + // InspectionRecordPackage.allSchemas.tableFormColumns.forEach(item=>{ + // if(item.field == 'qualifiedAmount'){ + // console.log(item.disabled) + // item.disabled = true + // console.log(item.disabled) + // } + // }) + // } + // } + console.log(InspectionRecordPackage.allSchemas.tableFormColumns) +} +// // 主子数据 提交 const submitForm = async (formType, data) => { data.subList = tableData.value // 拼接子表数据参数 try { diff --git a/src/views/qms/inspection/inspectionRecord/inspectionRecordMain.data.ts b/src/views/qms/inspection/inspectionRecord/inspectionRecordMain.data.ts index 0264c6085..c927a4210 100644 --- a/src/views/qms/inspection/inspectionRecord/inspectionRecordMain.data.ts +++ b/src/views/qms/inspection/inspectionRecord/inspectionRecordMain.data.ts @@ -2,6 +2,7 @@ import type { CrudSchema } from '@/hooks/web/useCrudSchemas' import { dateFormatter2 } from '@/utils/formatTime' import { validateHanset, validateEmail } from '@/utils/validator' import { dateFormatter } from '@/utils/formatTime' +import {validateTwoNum } from '@/utils/validator' const { t } = useI18n() // 国际化 /** @@ -398,25 +399,7 @@ export const InspectionRecordMain = useCrudSchemas(reactive([ //表单校验 export const InspectionRecordMainRules = reactive({ - number: [required], - applicationCode: [required], - taskCode: [required], - supplierCode: [required], - materialCode: [required], - batch: [required], - inspectionSchemeCode: [required], - inspectionBatch: [required], - inspectionBatchAmount: [required], - sampleTatalAmount: [required], - inspectionType: [required], - inspectionBatchSource: [required], - orderCode: [required], - orderRow: [required], - inspectionStage: [required], - inspectionStringency: [required], useDecision: [required], - inspectionLevel: [required], - available: [required], }) @@ -569,3 +552,123 @@ export const InspectionRecordDetailRules = reactive({ isDestroyInspection: [required], available: [required], }) + +/** + * @returns {Array} 检验记录包装 + */ +export const InspectionRecordPackage = useCrudSchemas(reactive([ + { + label: '编码', + field: 'number', + sort: 'custom', + isSearch: true, + tableForm:{ + disabled:true + } + }, + { + label: '包装号', + field: 'packageCode', + sort: 'custom', + isSearch: true, + tableForm:{ + disabled:true + } + }, + { + label: '包装规格', + field: 'packageSpecificationCode', + sort: 'custom', + isSearch: true, + tableForm:{ + disabled:true + } + }, + { + label: '数量', + field: 'amount', + sort: 'custom', + isSearch: true, + form: { + component: 'InputNumber', + value: 0 + }, + tableForm:{ + disabled:true + } + }, + { + label: '计量单位', + field: 'measuringUnit', + sort: 'custom', + isSearch: true, + tableForm:{ + disabled:true + } + }, + { + label: '采样数量', + field: 'sampleAmount', + sort: 'custom', + isSearch: true, + tableForm:{ + disabled:true + } + }, + { + label: '合格数量', + field: 'qualifiedAmount', + sort: 'custom', + isSearch: true, + tableForm:{ + disabled:true + } + }, + { + label: '不合格数量', + field: 'noQualifiedAmount', + sort: 'custom', + isSearch: true, + tableForm:{ + disabled:true + } + }, + { + label: '破坏数量', + field: 'destroyAmount', + sort: 'custom', + isSearch: true, + tableForm:{ + disabled:true + } + }, + { + label: '冻结数量', + field: 'frozenAmount', + sort: 'custom', + isSearch: true, + tableForm:{ + disabled:true + } + } +])) + +//表单校验 +export const InspectionRecordPackageRules = reactive({ + qualifiedAmount: [ + required, + { validator:validateTwoNum, message: '小数点后最多2位', trigger: 'blur'} + ], + frozenAmount: [ + required, + { validator:validateTwoNum, message: '小数点后最多2位', trigger: 'blur'} + ], + destroyAmount: [ + required, + { validator:validateTwoNum, message: '小数点后最多2位', trigger: 'blur'} + ], + noQualifiedAmount: [ + required, + { validator:validateTwoNum, message: '小数点后最多2位', trigger: 'blur'} + ], +}) \ No newline at end of file