Browse Source

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

master_hella_20240701
zhang_li 7 months ago
parent
commit
1b88dbc540
  1. 10
      src/api/qms/inspectionRequest/index.ts
  2. 14
      src/views/qms/inspection/inspectionJob/addForm.vue
  3. 87
      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 {
number: string
applicationDate: localdate
applicationDate: Date
applicationTime: Date
requestStartTime: Date
requestEndTime: Date
finishTime: Date
supplierCode: string
materialCode: string
itemCode: string
batch: string
requestInspectionNum: number
referenceOrderCode: string
referenceOrderRow: number
referenceCertificateCode: string
referenceCertificateRow: number
inspectionSchemeCode: string
inspectionStageCode: string
applicationPackageCode: string
inspectionLevel: string
aqlValue: number
available: string
}
// 查询检验申请列表

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

@ -170,19 +170,7 @@ import { getCurrentInstance } from 'vue'
import { DICT_TYPE, getStrDictOptions } from '@/utils/dict'
import * as InspectionJobDetailPageApi from '@/api/qms/inspectionJob/inspectionJobDetail'
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()

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

@ -27,9 +27,22 @@
</ContentWrap>
<!-- 表单弹窗添加/修改 -->
<BasicForm ref="basicFormRef" @success="formsSuccess" :rules="InspectionMainRules"
:formAllSchemas="InspectionMain.allSchemas" :apiUpdate="InspectionMainApi.updateInspectionMain"
:apiCreate="InspectionMainApi.createInspectionMain" @searchTableSuccess="searchTableSuccess" :isBusiness="false" />
<BasicForm
ref="formRef"
@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" />
@ -38,12 +51,12 @@
<ImportForm ref="importFormRef" url="/request/inspection-main/import" :importTemplateData="importTemplateData"
@success="importSuccess" />
<!-- 包装信息 -->
<ListTable ref="listTableRef" titleName="包装信息"/>
<ListTable ref="listTableRef" titleName="包装信息" />
</template>
<script setup lang="ts">
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 defaultButtons from '@/utils/disposition/defaultButtons'
import ListTable from '@/components/ListTable/src/ListTable.vue'
@ -64,9 +77,18 @@
//
const searchTableSuccess = (formField, searchField, val, formRef) => {
console.log(formField)
console.log(searchField)
console.log(val)
nextTick(() => {
const setV = {}
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)
})
}
@ -85,9 +107,9 @@
//
const HeadButttondata = [
// defaultButtons.defaultAddBtn(null), //
defaultButtons.defaultImportBtn({ hasPermi: 'wms:inspectionMain:import' }), //
defaultButtons.defaultExportBtn({ hasPermi: 'wms:inspectionMain:export' }), //
defaultButtons.defaultAddBtn(null), //
// defaultButtons.defaultImportBtn({ hasPermi: 'wms:inspectionMain:import' }), //
// defaultButtons.defaultExportBtn({ hasPermi: 'wms:inspectionMain:export' }), //
defaultButtons.defaultFreshBtn(null), //
defaultButtons.defaultFilterBtn(null), //
defaultButtons.defaultSetBtn(null), //
@ -137,7 +159,7 @@
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.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()
@ -250,27 +272,32 @@ const listTableRef = ref()
}
// form
const formsSuccess = async (formType, data) => {
const submitForm = async (formType, data) => {
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 (data.activeTime && data.expireTime && data.activeTime >= data.expireTime) {
message.error('失效时间要大于生效时间')
if (isHave){
if (data.requestStartTime && data.requestEndTime && data.requestStartTime >= data.requestEndTime) {
message.error('要求结束时间要大于要求开始时间')
return;
}
}
if (data.activeTime == 0) data.activeTime = null;
if (data.expireTime == 0) data.expireTime = null;
if (formType === 'create') {
if (data.requestStartTime == 0) data.requestStartTime = null;
if (data.requestEndTime == 0) data.requestEndTime = null;
data.inspectionRequestPackageCreateReqVO = tableData.value //
try{
if (formType === 'create') {
await InspectionMainApi.createInspectionMain(data)
message.success(t('common.createSuccess'))
} else {
await InspectionMainApi.updateInspectionMain(data)
message.success(t('common.updateSuccess'))
} else {
await InspectionMainApi.updateInspectionMain(data)
message.success(t('common.updateSuccess'))
}
formRef.value.dialogVisible = false
getList()
}finally{
formRef.value.formLoading = false
}
basicFormRef.value.dialogVisible = false
getList()
}
/** 详情操作 */
@ -331,7 +358,23 @@ const listTableRef = ref()
}
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 () => {
getList()

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

@ -1,20 +1,23 @@
import type { CrudSchema } from '@/hooks/web/useCrudSchemas'
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({
number: [required],
applicationDate: [required],
applicationTime: [required],
supplierCode: [required],
materialCode: [required],
batch: [required],
requestStartTime: [required],
itemCode: [required],
requestEndTime: [required],
batch: [required,{ validator:validateInteger, message: '请输入正确的整数', trigger: 'blur'}],
requestInspectionNum: [required,{ validator:validateTwoNum, message: '小数点后最多2位', trigger: 'blur'}],
referenceOrderCode: [required],
referenceOrderRow: [required],
inspectionSchemeCode: [required],
inspectionStageCode: [required],
inspectionLevel: [required],
available: [required],
referenceOrderRow: [required,{ validator:validateInteger, message: '请输入正确的整数', trigger: 'blur'}],
referenceCertificateCode: [required],
referenceCertificateRow: [required,{ validator:validateInteger, message: '请输入正确的整数', trigger: 'blur'}],
inspectionType: [required],
})
export const InspectionMain = useCrudSchemas(reactive<CrudSchema[]>([
@ -27,6 +30,11 @@ export const InspectionMain = useCrudSchemas(reactive<CrudSchema[]>([
table: {
width: 200,
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')]
}
},
isForm:false,
form: {
component: 'DatePicker',
componentProps: {
@ -68,6 +77,7 @@ export const InspectionMain = useCrudSchemas(reactive<CrudSchema[]>([
defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')]
}
},
isForm:false,
form: {
component: 'DatePicker',
componentProps: {
@ -173,6 +183,16 @@ export const InspectionMain = useCrudSchemas(reactive<CrudSchema[]>([
isSearch: false,
table: {
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,
table: {
width: 150
},
form:{
componentProps: {
disabled:true
}
}
},
{
@ -191,6 +216,16 @@ export const InspectionMain = useCrudSchemas(reactive<CrudSchema[]>([
isSearch: false,
table: {
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,
table: {
width: 150
},
form:{
componentProps: {
disabled:true
}
}
},
{
@ -264,15 +304,15 @@ export const InspectionMain = useCrudSchemas(reactive<CrudSchema[]>([
width: 150
}
},
{
label: '检验方案编码',
field: 'inspectionSchemeCode',
sort: 'custom',
isSearch: false,
table: {
width: 150
}
},
// {
// label: '检验方案编码',
// field: 'inspectionSchemeCode',
// sort: 'custom',
// isSearch: false,
// table: {
// width: 150
// }
// },
{
label: '检验类型',
field: 'inspectionType',
@ -282,39 +322,6 @@ export const InspectionMain = useCrudSchemas(reactive<CrudSchema[]>([
dictClass: 'string',
form: {
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: {
@ -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: '检验申请包装列表',
// field: 'applicationPackageCode',
// sort: 'custom',
@ -330,26 +369,26 @@ export const InspectionMain = useCrudSchemas(reactive<CrudSchema[]>([
// width: 150
// }
// },
{
label: '检验水平',
field: 'inspectionLevel',
dictType: DICT_TYPE.INSPECTION_LEVEL,
sort: 'custom',
isSearch: false,
table: {
width: 150
}
},
{
label: 'AQL值',
field: 'aqlValue',
sort: 'custom',
isSearch: false,
dictType: DICT_TYPE.BASIC_AQL,
table: {
width: 150
}
},
// {
// label: '检验水平',
// field: 'inspectionLevel',
// dictType: DICT_TYPE.INSPECTION_LEVEL,
// sort: 'custom',
// isSearch: false,
// table: {
// width: 150
// }
// },
// {
// label: 'AQL值',
// field: 'aqlValue',
// sort: 'custom',
// isSearch: false,
// dictType: DICT_TYPE.BASIC_AQL,
// table: {
// width: 150
// }
// },
// {
// label: '是否可用',
// 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}
*/
@ -384,7 +432,8 @@ export const InspectionRequestPackage = useCrudSchemas(reactive<CrudSchema[]>([
},
table:{
width:200
}
},
isTableForm:false
},
{
label: '包装号',
@ -392,7 +441,7 @@ export const InspectionRequestPackage = useCrudSchemas(reactive<CrudSchema[]>([
sort: 'custom',
isSearch: true,
tableForm:{
disabled:true
disabled:false
},
table:{
width:200
@ -404,7 +453,7 @@ export const InspectionRequestPackage = useCrudSchemas(reactive<CrudSchema[]>([
sort: 'custom',
isSearch: true,
tableForm:{
disabled:true
disabled:false
},
table:{
width:180
@ -414,13 +463,13 @@ export const InspectionRequestPackage = useCrudSchemas(reactive<CrudSchema[]>([
label: '数量',
field: 'amount',
sort: 'custom',
isSearch: true,
isSearch: false,
form: {
component: 'InputNumber',
value: 0
},
tableForm:{
disabled:true
disabled:false
},
table:{
width:150
@ -432,7 +481,7 @@ export const InspectionRequestPackage = useCrudSchemas(reactive<CrudSchema[]>([
sort: 'custom',
isSearch: true,
tableForm:{
disabled:true
disabled:false
},
table:{
width:150

Loading…
Cancel
Save