Browse Source

检验方案,模板

master_hella_20240701
zhang_li 8 months ago
parent
commit
e80b022211
  1. 317
      src/views/qms/basicDataManage/inspectionPlan/addForm.vue
  2. 50
      src/views/qms/basicDataManage/inspectionPlan/index.vue
  3. 213
      src/views/qms/basicDataManage/inspectionPlan/inspectionPlan.data.ts
  4. 66
      src/views/qms/basicDataManage/inspectionTemplate/addForm.vue

317
src/views/qms/basicDataManage/inspectionPlan/addForm.vue

@ -1,4 +1,5 @@
<template> <template>
<div>
<Dialog <Dialog
:title="dialogTitle" :title="dialogTitle"
v-model="dialogVisible" v-model="dialogVisible"
@ -15,8 +16,29 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="描述" prop="description"> <el-form-item label="物料编码" prop="itemCode">
<el-input v-model="data.description" placeholder="请填写描述" /> <div style="display: flex; width: 100%">
<el-input v-model="data.itemCode" disabled placeholder="请选择物料编码" />
<el-button
type="info"
plain
style="width: 40px"
@click="
opensearchTable(
'itemCode',
null,
'物料编码',
Itembasic.allSchemas,
ItemBasicApi.getItembasicPage,
null,
false,
'form',
null
)
"
><Icon icon="ep:search" />
</el-button>
</div>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
@ -25,46 +47,66 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="检验类型编码" prop="testTypeCode" > <el-form-item label="检验类型编码" prop="testTypeCode">
<div style="display: flex; width: 100%"> <div style="display: flex; width: 100%">
<el-input <el-input v-model="data.testTypeCode" disabled placeholder="请选择检验类型编码" />
v-model="data.testTypeCode"
disabled
placeholder="请选择检验类型编码"
/>
<el-button <el-button
type="info" type="info"
plain plain
style="width: 40px" style="width: 40px"
@click="opensearchTable('testTypeCode', null,'检验类型',SamplingProcess.allSchemas,SamplingProcessApi.getSamplingProcessPage,null,false,null,item)" @click="
><Icon icon="ep:search"/> opensearchTable(
'testTypeCode',
null,
'检验类型',
SamplingProcess.allSchemas,
SamplingProcessApi.getSamplingProcessPage,
null,
false,
'form',
null
)
"
><Icon icon="ep:search" />
</el-button> </el-button>
</div> </div>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="检验模板编码" prop="programmeTemplateCode" > <el-form-item label="检验模板编码" prop="programmeTemplateCode">
<div style="display: flex; width: 100%"> <div style="display: flex; width: 100%">
<el-input <el-input
v-model="data.testTypeCode" v-model="data.programmeTemplateCode"
disabled disabled
placeholder="请选择检验模板编码" placeholder="请选择检验模板编码"
/> />
<el-button <el-button
type="info" type="info"
plain plain
style="width: 40px" style="width: 40px"
@click="opensearchTable('programmeTemplateCode', null,'检验类型',SamplingProcess.allSchemas,SamplingProcessApigetSamplingProcessPage,null,false,null,item)" @click="
><Icon icon="ep:search"/> opensearchTable(
</el-button> 'programmeTemplateCode',
null,
'检验模板编码',
InspectionTemplateMain.allSchemas,
InspectionTemplateApi.inspectionTemplatePage,
null,
false,
'form',
null
)
"
><Icon icon="ep:search" />
</el-button>
</div> </div>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="拆分规则" prop="splitRule"> <el-form-item label="拆分规则" prop="splitRule">
<el-select v-model="data.splitRule" placeholder="请选择拆分规则" > <el-select v-model="data.splitRule" placeholder="请选择拆分规则">
<el-option <el-option
v-for="dict in getStrDictOptions( DICT_TYPE.SPLIT_RULES )" v-for="dict in getStrDictOptions(DICT_TYPE.SPLIT_RULES)"
:key="dict.value" :key="dict.value"
:label="dict.label" :label="dict.label"
:value="dict.value" :value="dict.value"
@ -74,9 +116,9 @@
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="aql" prop="aql"> <el-form-item label="aql" prop="aql">
<el-select v-model="data.aql" placeholder="请选择aql" > <el-select v-model="data.aql" placeholder="请选择aql">
<el-option <el-option
v-for="dict in getStrDictOptions( DICT_TYPE.BASIC_AQL )" v-for="dict in getStrDictOptions(DICT_TYPE.BASIC_AQL)"
:key="dict.value" :key="dict.value"
:label="dict.label" :label="dict.label"
:value="dict.value" :value="dict.value"
@ -86,9 +128,9 @@
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="检验水平" prop="inspectionLevel"> <el-form-item label="检验水平" prop="inspectionLevel">
<el-select v-model="data.inspectionLevel" placeholder="请选择检验水平" > <el-select v-model="data.inspectionLevel" placeholder="请选择检验水平">
<el-option <el-option
v-for="dict in getStrDictOptions(DICT_TYPE.INSPECTION_LEVEL )" v-for="dict in getStrDictOptions(DICT_TYPE.INSPECTION_LEVEL)"
:key="dict.value" :key="dict.value"
:label="dict.label" :label="dict.label"
:value="dict.value" :value="dict.value"
@ -102,7 +144,8 @@
v-model="data.effectiveDate" v-model="data.effectiveDate"
type="datetime" type="datetime"
placeholder="请选择生效时间" placeholder="请选择生效时间"
style="width:100%" style="width: 100%"
value-format="x"
/> />
</el-form-item> </el-form-item>
</el-col> </el-col>
@ -112,7 +155,8 @@
v-model="data.expirationDate" v-model="data.expirationDate"
type="datetime" type="datetime"
placeholder="请选择失效时间" placeholder="请选择失效时间"
style="width:100%" style="width: 100%"
value-format="x"
/> />
</el-form-item> </el-form-item>
</el-col> </el-col>
@ -297,17 +341,7 @@
label="是否允许修改特征值" label="是否允许修改特征值"
prop="inspectionCharacteristicsBaseVO.isCanUpdate" prop="inspectionCharacteristicsBaseVO.isCanUpdate"
> >
<el-select <el-switch v-model="item.inspectionCharacteristicsBaseVO.isCanUpdate" disabled/>
v-model="item.inspectionCharacteristicsBaseVO.isCanUpdate"
placeholder="请选择是否允许修改特征值"
>
<el-option
v-for="item in isYesList"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
@ -337,6 +371,7 @@
v-model="item.inspectionCharacteristicsBaseVO.featureType" v-model="item.inspectionCharacteristicsBaseVO.featureType"
placeholder="请选择特征类型" placeholder="请选择特征类型"
@change="changeFeatureType" @change="changeFeatureType"
:disabled="!item.inspectionCharacteristicsBaseVO.isCanUpdate"
> >
<el-option <el-option
v-for="dict in getStrDictOptions( v-for="dict in getStrDictOptions(
@ -355,18 +390,8 @@
label="是否设定上限" label="是否设定上限"
prop="inspectionCharacteristicsBaseVO.quantifyIsCapping" prop="inspectionCharacteristicsBaseVO.quantifyIsCapping"
> >
<el-select <el-switch v-model="item.inspectionCharacteristicsBaseVO.quantifyIsCapping" @change="changeIsCapping"
v-model="item.inspectionCharacteristicsBaseVO.quantifyIsCapping" :disabled="!item.inspectionCharacteristicsBaseVO.isCanUpdate"/>
placeholder="请选择是否设定上限"
@change="changeIsCapping"
>
<el-option
v-for="item in isYesList"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
@ -375,7 +400,10 @@
prop="inspectionCharacteristicsBaseVO.quantifyCapping" prop="inspectionCharacteristicsBaseVO.quantifyCapping"
v-if="item.inspectionCharacteristicsBaseVO.featureType == 0" v-if="item.inspectionCharacteristicsBaseVO.featureType == 0"
> >
<el-input v-model="item.inspectionCharacteristicsBaseVO.quantifyCapping" /> <el-input
v-model="item.inspectionCharacteristicsBaseVO.quantifyCapping"
:disabled="!item.inspectionCharacteristicsBaseVO.isCanUpdate"
/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
@ -384,18 +412,9 @@
label="是否设定下限" label="是否设定下限"
v-if="item.inspectionCharacteristicsBaseVO.featureType == 0" v-if="item.inspectionCharacteristicsBaseVO.featureType == 0"
> >
<el-select
v-model="item.inspectionCharacteristicsBaseVO.quantifyIsLowlimit" <el-switch v-model="item.inspectionCharacteristicsBaseVO.quantifyIsLowlimit" @change="changeLowlimit"
placeholder="请选择是否设定下限" :disabled="!item.inspectionCharacteristicsBaseVO.isCanUpdate"/>
@change="changeLowlimit"
>
<el-option
v-for="item in isYesList"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
@ -404,7 +423,10 @@
prop="inspectionCharacteristicsBaseVO.quantifyLowlimit" prop="inspectionCharacteristicsBaseVO.quantifyLowlimit"
v-if="item.inspectionCharacteristicsBaseVO.featureType == 0" v-if="item.inspectionCharacteristicsBaseVO.featureType == 0"
> >
<el-input v-model="item.inspectionCharacteristicsBaseVO.quantifyLowlimit" /> <el-input
v-model="item.inspectionCharacteristicsBaseVO.quantifyLowlimit"
:disabled="!item.inspectionCharacteristicsBaseVO.isCanUpdate"
/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
@ -413,18 +435,8 @@
label="是否设定目标值" label="是否设定目标值"
v-if="item.inspectionCharacteristicsBaseVO.featureType == 0" v-if="item.inspectionCharacteristicsBaseVO.featureType == 0"
> >
<el-select <el-switch v-model="item.inspectionCharacteristicsBaseVO.quantifyIsTarget" @change="changeIsTarget"
v-model="item.inspectionCharacteristicsBaseVO.quantifyIsTarget" :disabled="!item.inspectionCharacteristicsBaseVO.isCanUpdate"/>
placeholder="请选择是否设定目标值"
@change="changeIsTarget"
>
<el-option
v-for="item in isYesList"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
@ -433,7 +445,10 @@
prop="inspectionCharacteristicsBaseVO.quantifyTarget" prop="inspectionCharacteristicsBaseVO.quantifyTarget"
v-if="item.inspectionCharacteristicsBaseVO.featureType == 0" v-if="item.inspectionCharacteristicsBaseVO.featureType == 0"
> >
<el-input v-model="item.inspectionCharacteristicsBaseVO.quantifyTarget" /> <el-input
v-model="item.inspectionCharacteristicsBaseVO.quantifyTarget"
:disabled="!item.inspectionCharacteristicsBaseVO.isCanUpdate"
/>
</el-form-item> </el-form-item>
</el-col> </el-col>
@ -443,7 +458,10 @@
prop="inspectionCharacteristicsBaseVO.quantifyUom" prop="inspectionCharacteristicsBaseVO.quantifyUom"
v-if="item.inspectionCharacteristicsBaseVO.featureType == 0" v-if="item.inspectionCharacteristicsBaseVO.featureType == 0"
> >
<el-input v-model="item.inspectionCharacteristicsBaseVO.quantifyUom" /> <el-input
v-model="item.inspectionCharacteristicsBaseVO.quantifyUom"
:disabled="!item.inspectionCharacteristicsBaseVO.isCanUpdate"
/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
@ -452,7 +470,10 @@
prop="inspectionCharacteristicsBaseVO.quantifyDecimal" prop="inspectionCharacteristicsBaseVO.quantifyDecimal"
v-if="item.inspectionCharacteristicsBaseVO.featureType == 0" v-if="item.inspectionCharacteristicsBaseVO.featureType == 0"
> >
<el-input v-model="item.inspectionCharacteristicsBaseVO.quantifyDecimal" /> <el-input
v-model="item.inspectionCharacteristicsBaseVO.quantifyDecimal"
:disabled="!item.inspectionCharacteristicsBaseVO.isCanUpdate"
/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
@ -484,6 +505,7 @@
item item
) )
" "
v-if="item.inspectionCharacteristicsBaseVO.isCanUpdate"
><Icon icon="ep:search" ><Icon icon="ep:search"
/></el-button> /></el-button>
</div> </div>
@ -514,6 +536,7 @@
</template> </template>
</Dialog> </Dialog>
<SearchTable ref="searchTableRef" @searchTableSuccess="searchTableSuccess" /> <SearchTable ref="searchTableRef" @searchTableSuccess="searchTableSuccess" />
</div>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
@ -524,6 +547,10 @@ import * as InspectionProcessPageApi from '@/api/qms/inspectionTemplate'
import { SearchTable } from '@/components/SearchTable' import { SearchTable } from '@/components/SearchTable'
import { SamplingProcess } from '@/views/qms/samplingProcess/samplingProcess.data' import { SamplingProcess } from '@/views/qms/samplingProcess/samplingProcess.data'
import * as SamplingProcessApi from '@/api/qms/samplingProcess' import * as SamplingProcessApi from '@/api/qms/samplingProcess'
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'
const message = useMessage() // const message = useMessage() //
const props = defineProps({ const props = defineProps({
@ -570,21 +597,19 @@ const formProcessRef = ref()
const data = ref({ const data = ref({
code: '', code: '',
description: '', itemCode: '',
version: '', version: '',
available:true, testTypeCode:'',
programmeTemplateCode:'',
splitRule:'',
aql:'',
inspectionLevel:'',
effectiveDate:'',
expirationDate:'',
available: true,
process: [] process: []
}) })
const isYesList = [
{
value: true,
label: '是'
},
{
value: false,
label: '否'
}
]
const dialogVisibleName = ref(false) const dialogVisibleName = ref(false)
const nameForm = ref({ const nameForm = ref({
name: '' name: ''
@ -596,11 +621,15 @@ if (props.basicFormWidth) {
dialogWidth.value = props.isBusiness ? '60%' : '40%' dialogWidth.value = props.isBusiness ? '60%' : '40%'
} }
const rules = ref({ const rules = ref({
description: [{ required: true, message: '请填写描述', trigger: 'blur' }], itemCode: [{ required: true, message: '请选择物料编码', trigger: 'blur' }],
version: [{ required: true, message: '请填写版本', trigger: 'blur' }], version: [{ required: true, message: '请填写版本', trigger: 'blur' }],
inspectionCode: [{ required: true, message: '请选择检验方案模板编码', trigger: 'blur' }], testTypeCode: [{ required: true, message: '请选择检验类型编码', trigger: ['blur', 'change'] }],
sequenceCode: [{ required: true, message: '请填写顺序号', trigger: 'blur' }], programmeTemplateCode: [{ required: true, message: '请选择检验模板编码', trigger:['blur', 'change'] }],
inspectionCharCode: [{ required: true, message: '请选择检验特性编码', trigger: 'blur' }], splitRule: [{ required: true, message: '请选择拆分规则', trigger: ['blur', 'change']}],
aql: [{ required: true, message: '请选择aql', trigger: ['blur', 'change']}],
inspectionLevel: [{ required: true, message: '请选择检验水平', trigger: ['blur', 'change']}],
effectiveDate: [{ required: true, message: '请选择生效时间', trigger: ['blur', 'change']}],
expirationDate: [{ required: true, message: '请选择失效时间', trigger: ['blur', 'change']}],
'inspectionCharacteristicsBaseVO.description': [ 'inspectionCharacteristicsBaseVO.description': [
{ required: true, message: '请填写描述', trigger: ['blur', 'change'] } { required: true, message: '请填写描述', trigger: ['blur', 'change'] }
], ],
@ -666,28 +695,27 @@ const open = async (type: string, row?: any, masterParmas?: any, titleName?: any
formType.value = type formType.value = type
if (row) { if (row) {
data.value = row data.value = row
let list = await InspectionProcessPageApi.getListByTempleteCode(row.code) let list = await InspectionProcessPageApi.getListByTempleteCode(row.code)
list.forEach((item, index) => { list.forEach((item, index) => {
editableTabsValue.value = index + 1 editableTabsValue.value = index + 1
item.name = index + 1 item.name = index + 1
// //
if(item.quantifyIsCapping){ if (item.quantifyIsCapping) {
rules.value['inspectionCharacteristicsBaseVO.quantifyCapping'][0].required = true rules.value['inspectionCharacteristicsBaseVO.quantifyCapping'][0].required = true
}else{ } else {
rules.value['inspectionCharacteristicsBaseVO.quantifyCapping'][0].required = false rules.value['inspectionCharacteristicsBaseVO.quantifyCapping'][0].required = false
} }
if(item.quantifyIsLowlimit){ if (item.quantifyIsLowlimit) {
rules.value['inspectionCharacteristicsBaseVO.quantifyLowlimit'][0].required = true rules.value['inspectionCharacteristicsBaseVO.quantifyLowlimit'][0].required = true
}else{ } else {
rules.value['inspectionCharacteristicsBaseVO.quantifyLowlimit'][0].required = false rules.value['inspectionCharacteristicsBaseVO.quantifyLowlimit'][0].required = false
} }
if(item.quantifyIsTarget){ if (item.quantifyIsTarget) {
rules.value['inspectionCharacteristicsBaseVO.quantifyTarget'][0].required = true rules.value['inspectionCharacteristicsBaseVO.quantifyTarget'][0].required = true
}else{ } else {
rules.value['inspectionCharacteristicsBaseVO.quantifyTarget'][0].required = false rules.value['inspectionCharacteristicsBaseVO.quantifyTarget'][0].required = false
} }
}) })
data.value.process = list data.value.process = list
} else { } else {
@ -695,7 +723,14 @@ const open = async (type: string, row?: any, masterParmas?: any, titleName?: any
code: '', code: '',
description: '', description: '',
version: '', version: '',
available:true, testTypeCode:'',
programmeTemplateCode:'',
splitRule:'',
aql:'',
inspectionLevel:'',
effectiveDate:'',
expirationDate:'',
available: true,
process: [] process: []
} }
} }
@ -809,27 +844,33 @@ const submitForm = async () => {
await formMainRef.value.validate() await formMainRef.value.validate()
if (!data.value.process || data.value.process.length == 0) { if (!data.value.process || data.value.process.length == 0) {
message.error(`请添加工序`) message.error(`请添加工序`)
return; return
} }
const bol1 = await validateForm(formProcessRef.value) const bol1 = await validateForm(formProcessRef.value)
const bol2 = await validateForm(formFeaturesRef.value) const bol2 = await validateForm(formFeaturesRef.value)
if (!bol1 || !bol2) { if (!bol1 || !bol2) {
message.error(`模板中有检验工序和检验特性未填写完全`) message.error(`模板中有检验工序和检验特性未填写完全`)
return; return
} }
const arr = data.value.process.filter(item=>(!item.inspectionCharacteristicsBaseVO.quantifyIsCapping&&!item.inspectionCharacteristicsBaseVO.quantifyIsLowlimit&&!item.inspectionCharacteristicsBaseVO.quantifyIsTarget&&item.inspectionCharacteristicsBaseVO.featureType == 0)) const arr = data.value.process.filter(
(item) =>
!item.inspectionCharacteristicsBaseVO.quantifyIsCapping &&
!item.inspectionCharacteristicsBaseVO.quantifyIsLowlimit &&
!item.inspectionCharacteristicsBaseVO.quantifyIsTarget &&
item.inspectionCharacteristicsBaseVO.featureType == 0
)
console.log(arr) console.log(arr)
if(arr&&arr.length>0){ if (arr && arr.length > 0) {
const str = arr.map(item=>item.description).join(',') const str = arr.map((item) => item.description).join(',')
message.error(`${str}是否设定上线,是否设定下限,是否是定目标值至少一项为是`) message.error(`${str}是否设定上线,是否设定下限,是否是定目标值至少一项为是`)
return; return
} }
if (formType.value == 'create') { if (formType.value == 'create') {
// //
emit('submitForm', formType.value, data) emit('submitForm', formType.value, data.value)
} else { } else {
// //
emit('submitForm', formType.value, data) emit('submitForm', formType.value, data.value)
} }
} catch { } catch {
console.log(111) console.log(111)
@ -866,7 +907,6 @@ const opensearchTable = (
type, type,
row row
) => { ) => {
console.log(988, row)
const _searchCondition = {} const _searchCondition = {}
// //
if (searchCondition && searchCondition.length > 0) { if (searchCondition && searchCondition.length > 0) {
@ -932,15 +972,42 @@ const opensearchTable = (
} }
// //
// val row // val row
const searchTableSuccess = (formField, searchField, val, type, row) => { const searchTableSuccess = async (formField, searchField, val, type, row) => {
console.log(row)
data.value.process.forEach((item) => { if (type == 'tableForm') {
if (item.description == row.description) { //
item.inspectionCharacteristicsBaseVO[formField] = val[0].code row[formField] = val[0][searchField]
} else {
console.log(formField)
console.log(val[0].code)
console.log(type)
data.value[formField] = val[0].code
if (formField == 'programmeTemplateCode') {
let list = await InspectionProcessPageApi.getListByTempleteCode(val[0].code)
list.forEach((item, index) => {
editableTabsValue.value = index + 1
item.name = index + 1
//
if (item.quantifyIsCapping) {
rules.value['inspectionCharacteristicsBaseVO.quantifyCapping'][0].required = true
} else {
rules.value['inspectionCharacteristicsBaseVO.quantifyCapping'][0].required = false
}
if (item.quantifyIsLowlimit) {
rules.value['inspectionCharacteristicsBaseVO.quantifyLowlimit'][0].required = true
} else {
rules.value['inspectionCharacteristicsBaseVO.quantifyLowlimit'][0].required = false
}
if (item.quantifyIsTarget) {
rules.value['inspectionCharacteristicsBaseVO.quantifyTarget'][0].required = true
} else {
rules.value['inspectionCharacteristicsBaseVO.quantifyTarget'][0].required = false
}
})
data.value.process = list
} }
}) }
// row.inspectionCharacteristicsBaseVO.inspectionMethodCode = val[0].code
// emit('searchTableSuccess', formField, searchField, val, formRef.value, type, row) // emit('searchTableSuccess', formField, searchField, val, formRef.value, type, row)
} }
// //

50
src/views/qms/basicDataManage/inspectionPlan/index.vue

@ -1,7 +1,7 @@
<template> <template>
<ContentWrap> <ContentWrap>
<!-- 搜索工作栏 --> <!-- 搜索工作栏 -->
<Search :schema="InspectionTemplateMain.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" /> <Search :schema="InspectionPlanMain.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" />
</ContentWrap> </ContentWrap>
<!-- 列表头部 --> <!-- 列表头部 -->
@ -11,7 +11,7 @@
:routeName="routeName" :routeName="routeName"
@updataTableColumns="updataTableColumns" @updataTableColumns="updataTableColumns"
@searchFormClick="searchFormClick" @searchFormClick="searchFormClick"
:allSchemas="InspectionTemplateMain.allSchemas" :allSchemas="InspectionPlanMain.allSchemas"
/> />
<!-- 列表 --> <!-- 列表 -->
@ -48,25 +48,19 @@
:rules="InspectionTemplateRules" :rules="InspectionTemplateRules"
@submitForm="submitForm" @submitForm="submitForm"
/> />
<!-- 详情 -->
<Detail
ref="detailRef"
:isBasic="true"
:allSchemas="InspectionTemplateMain.allSchemas"
/>
<!-- 导入 -->
<ImportForm ref="importFormRef" url="/wms/agv-locationrelation/import" :importTemplateData="importTemplateData" @success="importSuccess" />
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { InspectionTemplateMain,InspectionTemplateProcess,InspectionTemplateFeatures,InspectionTemplateRules } from './inspectionPlan.data' import {InspectionPlanMain } from './inspectionPlan.data'
import { InspectionTemplateMain,InspectionTemplateProcess,InspectionTemplateFeatures,InspectionTemplateRules } from '../inspectionTemplate/inspectionTemplate.data'
import * as defaultButtons from '@/utils/disposition/defaultButtons' import * as defaultButtons from '@/utils/disposition/defaultButtons'
import TableHead from '@/components/TableHead/src/TableHead.vue' import TableHead from '@/components/TableHead/src/TableHead.vue'
import Detail from '@/components/Detail/src/Detail.vue' import Detail from '@/components/Detail/src/Detail.vue'
import AddForm from './addForm.vue' import AddForm from './addForm.vue'
import * as InspectionPlanApi from '@/api/qms/inspectionPlan' import * as InspectionPlanApi from '@/api/qms/inspectionPlan'
import { json } from 'stream/consumers'
defineOptions({ name: 'AgvLocationrelation' }) defineOptions({ name: 'AgvLocationrelation' })
@ -76,7 +70,7 @@ const { t } = useI18n() // 国际化
const route = useRoute() // const route = useRoute() //
const routeName = ref() const routeName = ref()
routeName.value = route.name routeName.value = route.name
const tableColumns = ref(InspectionTemplateMain.allSchemas.tableColumns) const tableColumns = ref(InspectionPlanMain.allSchemas.tableColumns)
// //
const updataTableColumns = (val) => { const updataTableColumns = (val) => {
@ -147,12 +141,35 @@ const openForm = (type: string, row?: any) => {
// form // form
const submitForm = async (formType,data) => { const submitForm = async (formType,data) => {
console.log(data.value) var isHave =InspectionPlanMain.allSchemas.formSchema.some(function (item) {
return item.field === 'effectiveDate' || item.field === 'expirationDate';
});
if(isHave){
if(data.effectiveDate && data.expirationDate && data.effectiveDate >=data.expirationDate){
message.error('失效时间要大于生效时间')
return;
}
}
const data1 = {
id: data.id,
code: data.code,
itemCode: data.itemCode,
version: data.version,
testTypeCode: data.testTypeCode,
programmeTemplateCode: data.programmeTemplateCode,
splitRule: data.splitRule,
aql: data.aql,
inspectionLevel: data.inspectionLevel,
effectiveDate: data.effectiveDate,
expirationDate: data.expirationDate,
available: data.available,
content:JSON.stringify(data.process)
}
if (formType === 'create') { if (formType === 'create') {
await InspectionPlanApi.inspectionPlanCreat(data.value) await InspectionPlanApi.inspectionPlanCreat(data1)
message.success(t('common.createSuccess')) message.success(t('common.createSuccess'))
} else { } else {
await InspectionPlanApi.inspectionPlanUpdate(data.value) await InspectionPlanApi.inspectionPlanUpdate(data1)
message.success(t('common.updateSuccess')) message.success(t('common.updateSuccess'))
} }
basicFormRef.value.dialogVisible = false basicFormRef.value.dialogVisible = false
@ -193,5 +210,4 @@ onMounted(async () => {
getList() getList()
}) })
</script> </script>
./inspectionPlan.data

213
src/views/qms/basicDataManage/inspectionPlan/inspectionPlan.data.ts

@ -68,7 +68,7 @@ export const InspectionTemplateRules = reactive({
{ required: true, message: '请输入选择集编码', trigger: 'blur' } { required: true, message: '请输入选择集编码', trigger: 'blur' }
], ],
}) })
export const InspectionTemplateMain = useCrudSchemas(reactive<CrudSchema[]>([ export const InspectionPlanMain = useCrudSchemas(reactive<CrudSchema[]>([
{ {
label: '编码', label: '编码',
field: 'code', field: 'code',
@ -81,207 +81,68 @@ export const InspectionTemplateMain = useCrudSchemas(reactive<CrudSchema[]>([
} }
}, },
{ {
label: '描述', label: '物料编码',
field: 'description', field: 'itemCode',
sort: 'custom', sort: 'custom',
},{ },{
label: '版本', label: '版本',
field: 'version', field: 'version',
sort: 'custom', sort: 'custom',
},
{
label: '操作',
field: 'action',
isForm: false,
table: {
width: 150,
fixed: 'right'
}
}
]))
export const InspectionTemplateProcess = useCrudSchemas(reactive<CrudSchema[]>([
{
label: '编码',
field: 'code',
sort: 'custom',
form:{
componentProps:{
disabled:true,
placeholder:'系统自动获取'
}
}
},
{
label: '描述',
field: 'description',
sort: 'custom',
isForm:false
},{
label: '检验方案模板编码',
field: 'inspectionCode',
sort: 'custom',
},{
label: '顺序号',
field: 'sequenceCode',
},{
label: '检验特性编码',
field: 'inspectionCharCode',
sort: 'custom',
}
]))
export const InspectionTemplateFeatures= useCrudSchemas(reactive<CrudSchema[]>([
{
label: '编码',
field: 'code',
sort: 'custom',
form:{
componentProps:{
disabled:true,
placeholder:'系统自动获取'
}
}
},
{
label: '描述',
field: 'describe',
sort: 'custom',
},{
label: '检验方法编码',
field: 'inspectionMethodCode',
sort: 'custom',
},{ },{
label: '采样过程编码', label: '检验类型编码',
field: 'dynamicUpdateCode', field: 'testTypeCode',
sort: 'custom', sort: 'custom',
},{ },{
label: '动态修改规则编码', label: '检验模板编码',
field: 'inspectionMethod', field: 'programmeTemplateCode',
sort: 'custom',
},{
label: '是否允许修改特征值',
field: 'isCanUpdate',
sort: 'custom',
form:{
component:'Select',
api: () => [{
value:0,
label:'是'
},{
value:1,
label:'否'
}],
componentProps:{
optionsAlias: {
labelField: 'label',
valueField: 'value'
}
}
}
},{
label: '是否破坏性检验',
field: 'isDestructionInspection',
sort: 'custom', sort: 'custom',
form:{
component:'Select',
api: () => [{
value:0,
label:'是'
},{
value:1,
label:'否'
}],
componentProps:{
optionsAlias: {
labelField: 'label',
valueField: 'value'
}
}
}
},{ },{
label: '结果录入方式', label: '拆分规则',
field: 'resultEntryMethod', field: 'splitRule',
sort: 'custom', sort: 'custom',
dictType: DICT_TYPE.INSPECTION_CHARACTERISTICS_RESULT_ENTRY, dictType: DICT_TYPE.SPLIT_RULES,
dictClass: 'string', dictClass: 'string', // 默认都是字符串类型其他暂不考虑
table: { table: {
width: 150 width: 150
}, },
},{ },{
label: '特征类型', label: 'aql',
field: 'featureType', field: 'aql',
sort: 'custom', sort: 'custom',
dictType: DICT_TYPE.INSPECTION_CHARACTERISTICS_FEATURE_TYPE, dictType: DICT_TYPE.BASIC_AQL,
dictClass: 'string', dictClass: 'string',
table: { table: {
width: 150 width: 150
},
},{
label: '是否设定上限',
field: 'quantifyIsCapping',
sort: 'custom',
form:{
component:'Select',
api: () => [{
value:0,
label:'是'
},{
value:1,
label:'否'
}],
componentProps:{
optionsAlias: {
labelField: 'label',
valueField: 'value'
}
}
} }
},{ },{
label: '是否设定下限', label: '检验水平',
field: 'quantifyIsLowlimit', field: 'inspectionLevel',
sort: 'custom',
form:{
component:'Select',
api: () => [{
value:0,
label:'是'
},{
value:1,
label:'否'
}],
componentProps:{
optionsAlias: {
labelField: 'label',
valueField: 'value'
}
}
}
},{
label: '目标值',
field: 'quantifyTarget',
sort: 'custom',
},{
label: '上限值',
field: 'quantifyCapping',
sort: 'custom',
},{
label: '下限值',
field: 'quantifyLowlimit',
sort: 'custom', sort: 'custom',
dictType: DICT_TYPE.INSPECTION_LEVEL,
dictClass: 'string',
table: {
width: 150
},
},{ },{
label: '计量单位', label: '生效时间',
field: 'quantifyUom', field: 'effectiveDate',
sort: 'custom', sort: 'custom',
},{ },{
label: '小数位', label: '失效时间',
field: 'quantifyDecimal', field: 'expirationDate',
sort: 'custom', sort: 'custom',
},{ },{
label: '选择集编码', label: '是否可用',
field: 'quantifyQuantifyCode', field: 'available',
sort: 'custom', sort: 'custom',
form:{ },
component:'Select' {
label: '操作',
field: 'action',
isForm: false,
table: {
width: 150,
fixed: 'right'
} }
} }
])) ]))

66
src/views/qms/basicDataManage/inspectionTemplate/addForm.vue

@ -8,8 +8,8 @@
> >
<div style="max-height: 60vh; overflow-y: auto; padding: 0px 20px"> <div style="max-height: 60vh; overflow-y: auto; padding: 0px 20px">
<!-- <Form ref="formRefMain" :schema="formAllSchemasMain" :is-col="true" :rules="rules" /> --> <!-- <Form ref="formRefMain" :schema="formAllSchemasMain" :is-col="true" :rules="rules" /> -->
<el-form :model="data" label-width="auto" :rules="rules" ref="formMainRef" gutter="20"> <el-form :model="data" label-width="auto" :rules="rules" ref="formMainRef">
<el-row> <el-row gutter="20">
<el-col :span="12"> <el-col :span="12">
<el-form-item label="编码" prop="code"> <el-form-item label="编码" prop="code">
<el-input v-model="data.code" placeholder="根据系统生成" :disabled="true" /> <el-input v-model="data.code" placeholder="根据系统生成" :disabled="true" />
@ -226,17 +226,7 @@
label="是否允许修改特征值" label="是否允许修改特征值"
prop="inspectionCharacteristicsBaseVO.isCanUpdate" prop="inspectionCharacteristicsBaseVO.isCanUpdate"
> >
<el-select <el-switch v-model="item.inspectionCharacteristicsBaseVO.isCanUpdate"/>
v-model="item.inspectionCharacteristicsBaseVO.isCanUpdate"
placeholder="请选择是否允许修改特征值"
>
<el-option
v-for="item in isYesList"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
@ -286,18 +276,7 @@
> >
<el-switch v-model="item.inspectionCharacteristicsBaseVO.quantifyIsCapping" @change="changeIsCapping"/> <el-switch v-model="item.inspectionCharacteristicsBaseVO.quantifyIsCapping" @change="changeIsCapping"/>
<!-- <el-select
v-model="item.inspectionCharacteristicsBaseVO.quantifyIsCapping"
placeholder="请选择是否设定上限"
@change="changeIsCapping"
>
<el-option
v-for="item in isYesList"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select> -->
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
@ -316,18 +295,7 @@
v-if="item.inspectionCharacteristicsBaseVO.featureType == 0" v-if="item.inspectionCharacteristicsBaseVO.featureType == 0"
> >
<el-switch v-model="item.inspectionCharacteristicsBaseVO.quantifyIsLowlimit" @change="changeLowlimit"/> <el-switch v-model="item.inspectionCharacteristicsBaseVO.quantifyIsLowlimit" @change="changeLowlimit"/>
<!-- <el-select
v-model="item.inspectionCharacteristicsBaseVO.quantifyIsLowlimit"
placeholder="请选择是否设定下限"
@change="changeLowlimit"
>
<el-option
v-for="item in isYesList"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select> -->
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
@ -346,18 +314,7 @@
v-if="item.inspectionCharacteristicsBaseVO.featureType == 0" v-if="item.inspectionCharacteristicsBaseVO.featureType == 0"
> >
<el-switch v-model="item.inspectionCharacteristicsBaseVO.quantifyIsTarget" @change="changeIsTarget"/> <el-switch v-model="item.inspectionCharacteristicsBaseVO.quantifyIsTarget" @change="changeIsTarget"/>
<!-- <el-select
v-model="item.inspectionCharacteristicsBaseVO.quantifyIsTarget"
placeholder="请选择是否设定目标值"
@change="changeIsTarget"
>
<el-option
v-for="item in isYesList"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select> -->
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
@ -516,16 +473,7 @@ const data = ref({
version: '', version: '',
process: [] process: []
}) })
const isYesList = [
{
value: true,
label: '是'
},
{
value: false,
label: '否'
}
]
const dialogVisibleName = ref(false) const dialogVisibleName = ref(false)
const nameForm = ref({ const nameForm = ref({
name: '' name: ''

Loading…
Cancel
Save