Browse Source

检验申请添加新增,修改功能,

master_hella_20240701
zhang_li 7 months ago
parent
commit
1b88dbc540
  1. 10
      src/api/qms/inspectionRequest/index.ts
  2. 12
      src/views/qms/inspection/inspectionJob/addForm.vue
  3. 73
      src/views/qms/inspection/inspectionRequest/index.vue
  4. 207
      src/views/qms/inspection/inspectionRequest/inspectionMain.data.ts

10
src/api/qms/inspectionRequest/index.ts

@ -2,25 +2,19 @@ import request from '@/config/axios'
export interface InspectionMainVO { export interface InspectionMainVO {
number: string number: string
applicationDate: localdate applicationDate: Date
applicationTime: Date applicationTime: Date
requestStartTime: Date requestStartTime: Date
requestEndTime: Date requestEndTime: Date
finishTime: Date finishTime: Date
supplierCode: string supplierCode: string
materialCode: string itemCode: string
batch: string batch: string
requestInspectionNum: number requestInspectionNum: number
referenceOrderCode: string referenceOrderCode: string
referenceOrderRow: number referenceOrderRow: number
referenceCertificateCode: string referenceCertificateCode: string
referenceCertificateRow: number referenceCertificateRow: number
inspectionSchemeCode: string
inspectionStageCode: string
applicationPackageCode: string
inspectionLevel: string
aqlValue: number
available: string
} }
// 查询检验申请列表 // 查询检验申请列表

12
src/views/qms/inspection/inspectionJob/addForm.vue

@ -170,18 +170,6 @@ import { getCurrentInstance } from 'vue'
import { DICT_TYPE, getStrDictOptions } from '@/utils/dict' import { DICT_TYPE, getStrDictOptions } from '@/utils/dict'
import * as InspectionJobDetailPageApi from '@/api/qms/inspectionJob/inspectionJobDetail' import * as InspectionJobDetailPageApi from '@/api/qms/inspectionJob/inspectionJobDetail'
import { SearchTable } from '@/components/SearchTable' import { SearchTable } from '@/components/SearchTable'
import { SamplingProcess } from '@/views/qms/samplingProcess/samplingProcess.data'
// import { InspectionTemplateMain } from '@/views/qms/basicDataManage/inspectionTemplate/inspectionTemplate.data'
// import * as InspectionTemplateApi from '@/api/qms/inspectionTemplate'
// import { Itembasic } from '@/views/wms/basicDataManage/itemManage/itembasic/itembasic.data'
// import * as ItemBasicApi from '@/api/wms/itembasic'
import * as SamplingProcessApi from '@/api/qms/samplingProcess' //
import * as InspectionMethodApi from '@/api/qms/inspectionMethod' //
import { InspectionMethod } from '@/views/qms/inspectionMethod/inspectionMethod.data' //
import * as DynamicRuleApi from '@/api/qms/dynamicRule' //
import { DynamicRule } from '@/views/qms/basicDataManage/dynamicRule/dynamicRule.data' //
import * as SelectedSetApi from '@/api/qms/selectedSet' //
import { SelectedSet } from '@/views/qms/basicDataManage/selectedSet/selectedSet.data' //
import * as InspectionJobMainApi from '@/api/qms/inspectionJob/inspectionJobMain' import * as InspectionJobMainApi from '@/api/qms/inspectionJob/inspectionJobMain'
const { proxy } = getCurrentInstance() const { proxy } = getCurrentInstance()

73
src/views/qms/inspection/inspectionRequest/index.vue

@ -27,9 +27,22 @@
</ContentWrap> </ContentWrap>
<!-- 表单弹窗添加/修改 --> <!-- 表单弹窗添加/修改 -->
<BasicForm ref="basicFormRef" @success="formsSuccess" :rules="InspectionMainRules" <BasicForm
:formAllSchemas="InspectionMain.allSchemas" :apiUpdate="InspectionMainApi.updateInspectionMain" ref="formRef"
:apiCreate="InspectionMainApi.createInspectionMain" @searchTableSuccess="searchTableSuccess" :isBusiness="false" /> @submitForm="submitForm"
basicFormWidth="60"
:rules="InspectionMainRules"
:formAllSchemas="InspectionMain.allSchemas"
:tableAllSchemas="InspectionRequestPackage.allSchemas"
:tableFormRules="InspectionRequestPackageRules"
:apiUpdate="InspectionMainApi.updateInspectionMain"
:apiCreate="InspectionMainApi.createInspectionMain"
:isBusiness="true"
:tableData="tableData"
@handleAddTable="handleAddTable"
@handleDeleteTable="handleDeleteTable"
@searchTableSuccess="searchTableSuccess"
/>
<!-- 详情 --> <!-- 详情 -->
<Detail ref="detailRef" :isBasic="true" :allSchemas="InspectionMain.allSchemas" /> <Detail ref="detailRef" :isBasic="true" :allSchemas="InspectionMain.allSchemas" />
@ -43,7 +56,7 @@
<script setup lang="ts"> <script setup lang="ts">
import download from '@/utils/download' import download from '@/utils/download'
import { InspectionMain, InspectionMainRules,InspectionRequestPackage } from './inspectionMain.data' import { InspectionMain, InspectionMainRules,InspectionRequestPackage,InspectionRequestPackageRules } from './inspectionMain.data'
import * as InspectionMainApi from '@/api/qms/inspectionRequest' import * as InspectionMainApi from '@/api/qms/inspectionRequest'
import * as defaultButtons from '@/utils/disposition/defaultButtons' import * as defaultButtons from '@/utils/disposition/defaultButtons'
import ListTable from '@/components/ListTable/src/ListTable.vue' import ListTable from '@/components/ListTable/src/ListTable.vue'
@ -64,9 +77,18 @@
// //
const searchTableSuccess = (formField, searchField, val, formRef) => { const searchTableSuccess = (formField, searchField, val, formRef) => {
console.log(formField)
console.log(searchField)
console.log(val)
nextTick(() => { nextTick(() => {
const setV = {} const setV = {}
setV[formField] = val[0][searchField] setV[formField] = val[0][searchField]
if(formField == 'itemCode'){
setV['itemName'] = val[0].name
}else if(formField == 'supplierCode'){
setV['supplierName'] = val[0].name
}
formRef.setValues(setV) formRef.setValues(setV)
}) })
} }
@ -85,9 +107,9 @@
// //
const HeadButttondata = [ const HeadButttondata = [
// defaultButtons.defaultAddBtn(null), // defaultButtons.defaultAddBtn(null), //
defaultButtons.defaultImportBtn({ hasPermi: 'wms:inspectionMain:import' }), // // defaultButtons.defaultImportBtn({ hasPermi: 'wms:inspectionMain:import' }), //
defaultButtons.defaultExportBtn({ hasPermi: 'wms:inspectionMain:export' }), // // defaultButtons.defaultExportBtn({ hasPermi: 'wms:inspectionMain:export' }), //
defaultButtons.defaultFreshBtn(null), // defaultButtons.defaultFreshBtn(null), //
defaultButtons.defaultFilterBtn(null), // defaultButtons.defaultFilterBtn(null), //
defaultButtons.defaultSetBtn(null), // defaultButtons.defaultSetBtn(null), //
@ -137,7 +159,7 @@
defaultButtons.mainListApproveBtn({ hide: isShowMainButton(row, ['2']), hasPermi: 'qms:inspection-request-main:agree' }), // defaultButtons.mainListApproveBtn({ hide: isShowMainButton(row, ['2']), hasPermi: 'qms:inspection-request-main:agree' }), //
defaultButtons.mainListHandleBtn({ hide: isShowMainButton(row, ['3']), hasPermi: 'qms:inspection-request-main:handle' }), // defaultButtons.mainListHandleBtn({ hide: isShowMainButton(row, ['3']), hasPermi: 'qms:inspection-request-main:handle' }), //
defaultButtons.mainListPackageBtn(null), // defaultButtons.mainListPackageBtn(null), //
// defaultButtons.mainListEditBtn({hide:isShowMainButton(row,['1']),hasPermi:'wms:purchasereceipt-request-main:update'}), // defaultButtons.mainListEditBtn({hide:isShowMainButton(row,['1']),hasPermi:'qms:inspection-request-main:edit'}), //
] ]
} }
const listTableRef = ref() const listTableRef = ref()
@ -250,18 +272,20 @@ const listTableRef = ref()
} }
// form // form
const formsSuccess = async (formType, data) => { const submitForm = async (formType, data) => {
var isHave = InspectionMain.allSchemas.formSchema.some(function (item) { var isHave = InspectionMain.allSchemas.formSchema.some(function (item) {
return item.field === 'activeTime' || item.field === 'expireTime'; return item.field === 'requestStartTime' || item.field === 'requestEndTime';
}); });
if (isHave){ if (isHave){
if (data.activeTime && data.expireTime && data.activeTime >= data.expireTime) { if (data.requestStartTime && data.requestEndTime && data.requestStartTime >= data.requestEndTime) {
message.error('失效时间要大于生效时间') message.error('要求结束时间要大于要求开始时间')
return; return;
} }
} }
if (data.activeTime == 0) data.activeTime = null; if (data.requestStartTime == 0) data.requestStartTime = null;
if (data.expireTime == 0) data.expireTime = null; if (data.requestEndTime == 0) data.requestEndTime = null;
data.inspectionRequestPackageCreateReqVO = tableData.value //
try{
if (formType === 'create') { if (formType === 'create') {
await InspectionMainApi.createInspectionMain(data) await InspectionMainApi.createInspectionMain(data)
message.success(t('common.createSuccess')) message.success(t('common.createSuccess'))
@ -269,8 +293,11 @@ const listTableRef = ref()
await InspectionMainApi.updateInspectionMain(data) await InspectionMainApi.updateInspectionMain(data)
message.success(t('common.updateSuccess')) message.success(t('common.updateSuccess'))
} }
basicFormRef.value.dialogVisible = false formRef.value.dialogVisible = false
getList() getList()
}finally{
formRef.value.formLoading = false
}
} }
/** 详情操作 */ /** 详情操作 */
@ -331,7 +358,23 @@ const listTableRef = ref()
} }
getList() // getList() //
} }
/**
* tableForm方法
*/
const tableFormKeys = {}
InspectionRequestPackage.allSchemas.tableFormColumns.forEach(item => {
tableFormKeys[item.field] = item.default ? item.default : ''
})
const tableData = ref([])
//
const handleAddTable = () => {
tableData.value.push(JSON.parse(JSON.stringify(tableFormKeys)))
}
//
const handleDeleteTable = (item, index) => {
tableData.value.splice(index, 1)
}
/** 初始化 **/ /** 初始化 **/
onMounted(async () => { onMounted(async () => {
getList() getList()

207
src/views/qms/inspection/inspectionRequest/inspectionMain.data.ts

@ -1,20 +1,23 @@
import type { CrudSchema } from '@/hooks/web/useCrudSchemas' import type { CrudSchema } from '@/hooks/web/useCrudSchemas'
import { dateFormatter } from '@/utils/formatTime' import { dateFormatter } from '@/utils/formatTime'
import * as ItemApi from '@/api/wms/itembasic'
import { Itembasic } from '@/views/wms/basicDataManage/itemManage/itembasic/itembasic.data'
import * as SupplierApi from '@/api/wms/supplier'
import { Supplier } from '@/views/wms/basicDataManage/supplierManage/supplier/supplier.data'
import { validateInteger,validateTwoNum } from '@/utils/validator'
// 表单校验 // 表单校验
export const InspectionMainRules = reactive({ export const InspectionMainRules = reactive({
number: [required], requestStartTime: [required],
applicationDate: [required], itemCode: [required],
applicationTime: [required], requestEndTime: [required],
supplierCode: [required], batch: [required,{ validator:validateInteger, message: '请输入正确的整数', trigger: 'blur'}],
materialCode: [required], requestInspectionNum: [required,{ validator:validateTwoNum, message: '小数点后最多2位', trigger: 'blur'}],
batch: [required],
referenceOrderCode: [required], referenceOrderCode: [required],
referenceOrderRow: [required], referenceOrderRow: [required,{ validator:validateInteger, message: '请输入正确的整数', trigger: 'blur'}],
inspectionSchemeCode: [required], referenceCertificateCode: [required],
inspectionStageCode: [required], referenceCertificateRow: [required,{ validator:validateInteger, message: '请输入正确的整数', trigger: 'blur'}],
inspectionLevel: [required], inspectionType: [required],
available: [required],
}) })
export const InspectionMain = useCrudSchemas(reactive<CrudSchema[]>([ export const InspectionMain = useCrudSchemas(reactive<CrudSchema[]>([
@ -27,6 +30,11 @@ export const InspectionMain = useCrudSchemas(reactive<CrudSchema[]>([
table: { table: {
width: 200, width: 200,
fixed: 'left' fixed: 'left'
},
form:{
componentProps:{
disabled:true
}
} }
}, },
{ {
@ -43,6 +51,7 @@ export const InspectionMain = useCrudSchemas(reactive<CrudSchema[]>([
defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')] defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')]
} }
}, },
isForm:false,
form: { form: {
component: 'DatePicker', component: 'DatePicker',
componentProps: { componentProps: {
@ -68,6 +77,7 @@ export const InspectionMain = useCrudSchemas(reactive<CrudSchema[]>([
defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')] defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')]
} }
}, },
isForm:false,
form: { form: {
component: 'DatePicker', component: 'DatePicker',
componentProps: { componentProps: {
@ -173,6 +183,16 @@ export const InspectionMain = useCrudSchemas(reactive<CrudSchema[]>([
isSearch: false, isSearch: false,
table: { table: {
width: 150 width: 150
},
form:{
componentProps: {
isSearchList: true, // 开启查询弹窗
searchTitle: '供应商信息', // 查询弹窗标题
searchAllSchemas: Supplier.allSchemas, // 查询弹窗所需类
searchField: 'code', // 查询弹窗赋值字段
searchPage: SupplierApi.getSupplierPage, // 查询弹窗所需分页方法
multiple:false,
}
} }
}, },
{ {
@ -182,6 +202,11 @@ export const InspectionMain = useCrudSchemas(reactive<CrudSchema[]>([
isSearch: false, isSearch: false,
table: { table: {
width: 150 width: 150
},
form:{
componentProps: {
disabled:true
}
} }
}, },
{ {
@ -191,6 +216,16 @@ export const InspectionMain = useCrudSchemas(reactive<CrudSchema[]>([
isSearch: false, isSearch: false,
table: { table: {
width: 150 width: 150
},
form:{
componentProps: {
isSearchList: true, // 开启查询弹窗
searchTitle: '物料信息', // 查询弹窗标题
searchAllSchemas: Itembasic.allSchemas, // 查询弹窗所需类
searchField: 'code', // 查询弹窗赋值字段
searchPage: ItemApi.getItembasicPage, // 查询弹窗所需分页方法
multiple:false,
}
} }
}, },
{ {
@ -200,6 +235,11 @@ export const InspectionMain = useCrudSchemas(reactive<CrudSchema[]>([
isSearch: false, isSearch: false,
table: { table: {
width: 150 width: 150
},
form:{
componentProps: {
disabled:true
}
} }
}, },
{ {
@ -264,15 +304,15 @@ export const InspectionMain = useCrudSchemas(reactive<CrudSchema[]>([
width: 150 width: 150
} }
}, },
{ // {
label: '检验方案编码', // label: '检验方案编码',
field: 'inspectionSchemeCode', // field: 'inspectionSchemeCode',
sort: 'custom', // sort: 'custom',
isSearch: false, // isSearch: false,
table: { // table: {
width: 150 // width: 150
} // }
}, // },
{ {
label: '检验类型', label: '检验类型',
field: 'inspectionType', field: 'inspectionType',
@ -282,39 +322,6 @@ export const InspectionMain = useCrudSchemas(reactive<CrudSchema[]>([
dictClass: 'string', dictClass: 'string',
form: { form: {
componentProps: { componentProps: {
disabled: true
}
},
table: {
width: 150
}
},
{
label: '检验阶段',
field: 'inspectionStage',
sort: 'custom',
isSearch: false,
form: {
component: 'InputNumber',
value: 0,
componentProps: {
disabled: true
}
},
table: {
width: 130
}
},
{
label: '检验严格性',
field: 'inspectionStringency',
sort: 'custom',
isSearch: false,
dictType: DICT_TYPE.INSPECTION_SEVERITY,
dictClass: 'string',
form: {
componentProps: {
disabled: true
} }
}, },
table: { table: {
@ -322,6 +329,38 @@ export const InspectionMain = useCrudSchemas(reactive<CrudSchema[]>([
} }
}, },
// { // {
// label: '检验阶段',
// field: 'inspectionStage',
// sort: 'custom',
// isSearch: false,
// form: {
// component: 'InputNumber',
// value: 0,
// componentProps: {
// disabled: true
// }
// },
// table: {
// width: 130
// }
// },
// {
// label: '检验严格性',
// field: 'inspectionStringency',
// sort: 'custom',
// isSearch: false,
// dictType: DICT_TYPE.INSPECTION_SEVERITY,
// dictClass: 'string',
// form: {
// componentProps: {
// disabled: true
// }
// },
// table: {
// width: 150
// }
// },
// {
// label: '检验申请包装列表', // label: '检验申请包装列表',
// field: 'applicationPackageCode', // field: 'applicationPackageCode',
// sort: 'custom', // sort: 'custom',
@ -330,26 +369,26 @@ export const InspectionMain = useCrudSchemas(reactive<CrudSchema[]>([
// width: 150 // width: 150
// } // }
// }, // },
{ // {
label: '检验水平', // label: '检验水平',
field: 'inspectionLevel', // field: 'inspectionLevel',
dictType: DICT_TYPE.INSPECTION_LEVEL, // dictType: DICT_TYPE.INSPECTION_LEVEL,
sort: 'custom', // sort: 'custom',
isSearch: false, // isSearch: false,
table: { // table: {
width: 150 // width: 150
} // }
}, // },
{ // {
label: 'AQL值', // label: 'AQL值',
field: 'aqlValue', // field: 'aqlValue',
sort: 'custom', // sort: 'custom',
isSearch: false, // isSearch: false,
dictType: DICT_TYPE.BASIC_AQL, // dictType: DICT_TYPE.BASIC_AQL,
table: { // table: {
width: 150 // width: 150
} // }
}, // },
// { // {
// label: '是否可用', // label: '是否可用',
// field: 'available', // field: 'available',
@ -370,6 +409,15 @@ export const InspectionMain = useCrudSchemas(reactive<CrudSchema[]>([
} }
} }
])) ]))
// 表单校验
export const InspectionRequestPackageRules = reactive({
packageCode: [required],
packageSpecificationCode: [required],
amount: [required,{ validator:validateTwoNum, message: '小数点后最多2位', trigger: 'blur'}],
measuringUnit: [required],
})
/** /**
* @returns {Array} * @returns {Array}
*/ */
@ -384,7 +432,8 @@ export const InspectionRequestPackage = useCrudSchemas(reactive<CrudSchema[]>([
}, },
table:{ table:{
width:200 width:200
} },
isTableForm:false
}, },
{ {
label: '包装号', label: '包装号',
@ -392,7 +441,7 @@ export const InspectionRequestPackage = useCrudSchemas(reactive<CrudSchema[]>([
sort: 'custom', sort: 'custom',
isSearch: true, isSearch: true,
tableForm:{ tableForm:{
disabled:true disabled:false
}, },
table:{ table:{
width:200 width:200
@ -404,7 +453,7 @@ export const InspectionRequestPackage = useCrudSchemas(reactive<CrudSchema[]>([
sort: 'custom', sort: 'custom',
isSearch: true, isSearch: true,
tableForm:{ tableForm:{
disabled:true disabled:false
}, },
table:{ table:{
width:180 width:180
@ -414,13 +463,13 @@ export const InspectionRequestPackage = useCrudSchemas(reactive<CrudSchema[]>([
label: '数量', label: '数量',
field: 'amount', field: 'amount',
sort: 'custom', sort: 'custom',
isSearch: true, isSearch: false,
form: { form: {
component: 'InputNumber', component: 'InputNumber',
value: 0 value: 0
}, },
tableForm:{ tableForm:{
disabled:true disabled:false
}, },
table:{ table:{
width:150 width:150
@ -432,7 +481,7 @@ export const InspectionRequestPackage = useCrudSchemas(reactive<CrudSchema[]>([
sort: 'custom', sort: 'custom',
isSearch: true, isSearch: true,
tableForm:{ tableForm:{
disabled:true disabled:false
}, },
table:{ table:{
width:150 width:150

Loading…
Cancel
Save