Browse Source

检验模板

master_hella_20240701
zhang_li 8 months ago
parent
commit
d429614844
  1. 26
      src/api/qms/inspectionTemplate/index.ts
  2. 712
      src/views/qms/basicDataManage/inspectionTemplate/addForm.vue
  3. 95
      src/views/qms/basicDataManage/inspectionTemplate/index.vue
  4. 207
      src/views/qms/basicDataManage/inspectionTemplate/inspectionTemplate.data.ts

26
src/api/qms/inspectionTemplate/index.ts

@ -3,6 +3,28 @@ import request from '@/config/axios'
// 查询采样过程列表
export const getInspectionProcessPage = async (params) => {
return await request.get({ url: `/qms/inspection-process/page`})
export const getListByTempleteCode = async (code) => {
return await request.get({ url: `/qms/inspection-process/getListByTempleteCode?code=`+code})
}
// 新增
export const inspectionTemplateCreat = async (data) => {
return await request.post({ url: `/qms/programme-template/create`,data})
}
// 编辑
export const inspectionTemplateUpdate = async (data) => {
return await request.put({ url: `/qms/programme-template/update`,data})
}
// 删除
export const inspectionTemplateDelete = async (id) => {
return await request.delete({ url: `/qms/programme-template/delete?id=`+id})
}
// 列表
export const inspectionTemplatePage = async (params) => {
if (params.isSearch) {
delete params.isSearch
const data = {...params}
return request.post({ url: '/wms/accountcalendar/senior', data })
} else {
return await request.get({ url: `/qms/programme-template/page`, params })
}
}

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

@ -8,25 +8,25 @@
>
<div style="max-height: 60vh; overflow-y: auto; padding: 0px 20px">
<!-- <Form ref="formRefMain" :schema="formAllSchemasMain" :is-col="true" :rules="rules" /> -->
<el-form :model="data" label-width="auto">
<el-row>
<el-col :span="12">
<el-form-item label="编码">
<el-input v-model="data.code" placeholder="根据系统生成" :disabled="true"/>
</el-form-item>
</el-col>
<el-form :model="data" label-width="auto" :rules="rules" ref="formMainRef">
<el-row>
<el-col :span="12">
<el-form-item label="描述">
<el-input v-model="data.description" placeholder="请填写描述"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="版本">
<el-input v-model="data.version" placeholder="请填写版本"/>
</el-form-item>
</el-col>
</el-row>
</el-form>
<el-form-item label="编码" prop="code">
<el-input v-model="data.code" placeholder="根据系统生成" :disabled="true" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="描述" prop="description">
<el-input v-model="data.description" placeholder="请填写描述" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="版本" prop="version">
<el-input v-model="data.version" placeholder="请填写版本" />
</el-form-item>
</el-col>
</el-row>
</el-form>
<el-tabs
v-model="editableTabsValue"
editable
@ -50,89 +50,168 @@
labelWidth="150px"
:rules="rules"
/> -->
<el-form :model="item" label-width="auto">
<el-form :model="item" label-width="auto" :rules="rules" ref="formProcessRef">
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="编码">
<el-input v-model="item.code" placeholder="根据系统生成" :disabled="true"/>
<el-form-item label="编码" prop="code">
<el-input v-model="item.code" placeholder="根据系统生成" :disabled="true" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="检验方案模板编码">
<el-input v-model="item.inspectionCode" placeholder="根据系统生成" :disabled="true"/>
<el-input
v-model="item.inspectionCode"
placeholder="根据系统生成"
:disabled="true"
/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="描述">
<el-form-item label="描述" prop="description">
<el-input v-model="item.description" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="顺序号">
<el-form-item label="顺序号" prop="sequenceCode">
<el-input v-model="item.sequenceCode" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="检验特性编码">
<el-input v-model="item.inspectionCharCode" placeholder="根据系统生成" :disabled="true"/>
<el-input
v-model="item.inspectionCharCode"
placeholder="根据系统生成"
:disabled="true"
/>
</el-form-item>
</el-col>
</el-row>
</el-form>
<div class="small-title">检验特性</div>
<el-form :model="item" label-width="auto">
<el-form :model="item" label-width="auto" :rules="rules" ref="formFeaturesRef">
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="编码">
<el-input v-model="item.inspectionCharacteristicsBaseVO.code" placeholder="根据系统生成" :disabled="true"/>
<el-input
v-model="item.inspectionCharacteristicsBaseVO.code"
placeholder="根据系统生成"
:disabled="true"
/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="描述">
<el-form-item label="描述" prop="inspectionCharacteristicsBaseVO.description">
<el-input v-model="item.inspectionCharacteristicsBaseVO.description" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="检验方法编码">
<el-select v-model="item.inspectionCharacteristicsBaseVO.inspectionMethodCode" placeholder="请选择检验方法编码">
<el-option
v-for="item in inspectionProcessList"
:key="item.id"
:label="item.description"
:value="item.id"
<el-form-item
label="检验方法编码"
prop="inspectionCharacteristicsBaseVO.inspectionMethodCode"
>
<div style="display: flex; width: 100%">
<el-input
v-model="item.inspectionCharacteristicsBaseVO.inspectionMethodCode"
disabled
placeholder="请选择检验方法编码"
/>
</el-select>
<el-button
type="info"
plain
style="width: 40px"
@click="
opensearchTable(
'inspectionMethodCode',
null,
'检验方法',
SamplingProcess.allSchemas,
SamplingProcessApi.getSamplingProcessPage,
null,
false,
null,
item
)
"
><Icon icon="ep:search"
/></el-button>
</div>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="采样过程编码">
<el-select v-model="item.inspectionCharacteristicsBaseVO.inspectionProcessPage" placeholder="请选择采样过程编码">
<el-option
v-for="item in inspectionProcessList"
:key="item.id"
:label="item.description"
:value="item.id"
<el-form-item
label="采样过程编码"
prop="inspectionCharacteristicsBaseVO.dynamicUpdateCode"
>
<div style="display: flex; width: 100%">
<el-input
v-model="item.inspectionCharacteristicsBaseVO.dynamicUpdateCode"
disabled
placeholder="请选择采样过程编码"
/>
</el-select>
<el-button
type="info"
plain
style="width: 40px"
@click="
opensearchTable(
'dynamicUpdateCode',
null,
'采样过程编码',
SamplingProcess.allSchemas,
SamplingProcessApi.getSamplingProcessPage,
null,
false,
null,
item
)
"
><Icon icon="ep:search"
/></el-button>
</div>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="动态修改规则编码">
<el-select v-model="item.inspectionCharacteristicsBaseVO.inspectionMethod" placeholder="请选择动态修改规则编码">
<el-option
v-for="item in inspectionProcessList"
:key="item.id"
:label="item.description"
:value="item.id"
<el-form-item
label="动态修改规则编码"
prop="inspectionCharacteristicsBaseVO.inspectionMethod"
>
<div style="display: flex; width: 100%">
<el-input
v-model="item.inspectionCharacteristicsBaseVO.inspectionMethod"
disabled
placeholder="请选择动态修改规则编码"
/>
</el-select>
<el-button
type="info"
plain
style="width: 40px"
@click="
opensearchTable(
'inspectionMethod',
null,
'动态修改规则编码',
SamplingProcess.allSchemas,
SamplingProcessApi.getSamplingProcessPage,
null,
false,
null,
item
)
"
><Icon icon="ep:search"
/></el-button>
</div>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="是否允许修改特征值">
<el-select v-model="item.inspectionCharacteristicsBaseVO.isCanUpdate" placeholder="请选择是否允许修改特征值">
<el-form-item
label="是否允许修改特征值"
prop="inspectionCharacteristicsBaseVO.isCanUpdate"
>
<el-select
v-model="item.inspectionCharacteristicsBaseVO.isCanUpdate"
placeholder="请选择是否允许修改特征值"
>
<el-option
v-for="item in isYesList"
:key="item.value"
@ -143,10 +222,18 @@
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="结果录入方式">
<el-select v-model="item.inspectionCharacteristicsBaseVO.resultEntryMethod" placeholder="请选择结果录入方式">
<el-form-item
label="结果录入方式"
prop="inspectionCharacteristicsBaseVO.resultEntryMethod"
>
<el-select
v-model="item.inspectionCharacteristicsBaseVO.resultEntryMethod"
placeholder="请选择结果录入方式"
>
<el-option
v-for="dict in getStrDictOptions(DICT_TYPE.INSPECTION_CHARACTERISTICS_RESULT_ENTRY)"
v-for="dict in getStrDictOptions(
DICT_TYPE.INSPECTION_CHARACTERISTICS_RESULT_ENTRY
)"
:key="dict.value"
:label="dict.label"
:value="dict.value"
@ -155,11 +242,17 @@
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="特征类型">
<el-form-item label="特征类型" prop="inspectionCharacteristicsBaseVO.featureType">
<!-- <el-input v-model="item.featureType" /> -->
<el-select v-model="item.inspectionCharacteristicsBaseVO.featureType" placeholder="请选择特征类型">
<el-select
v-model="item.inspectionCharacteristicsBaseVO.featureType"
placeholder="请选择特征类型"
@change="changeFeatureType"
>
<el-option
v-for="dict in getStrDictOptions(DICT_TYPE.INSPECTION_CHARACTERISTICS_FEATURE_TYPE)"
v-for="dict in getStrDictOptions(
DICT_TYPE.INSPECTION_CHARACTERISTICS_FEATURE_TYPE
)"
:key="dict.value"
:label="dict.label"
:value="dict.value"
@ -168,9 +261,16 @@
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="是否设定上限">
<el-select v-model="item.inspectionCharacteristicsBaseVO.quantifyIsCapping" placeholder="请选择是否设定上限">
<el-col :span="12" v-if="item.inspectionCharacteristicsBaseVO.featureType == 0">
<el-form-item
label="是否设定上限"
prop="inspectionCharacteristicsBaseVO.quantifyIsCapping"
>
<el-select
v-model="item.inspectionCharacteristicsBaseVO.quantifyIsCapping"
placeholder="请选择是否设定上限"
@change="changeIsCapping"
>
<el-option
v-for="item in isYesList"
:key="item.value"
@ -181,8 +281,25 @@
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="是否设定下限">
<el-select v-model="item.inspectionCharacteristicsBaseVO.quantifyIsLowlimit" placeholder="请选择是否设定下限">
<el-form-item
label="上限值"
prop="inspectionCharacteristicsBaseVO.quantifyCapping"
v-if="item.inspectionCharacteristicsBaseVO.featureType == 0"
>
<el-input v-model="item.inspectionCharacteristicsBaseVO.quantifyCapping" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item
prop="inspectionCharacteristicsBaseVO.quantifyIsLowlimit"
label="是否设定下限"
v-if="item.inspectionCharacteristicsBaseVO.featureType == 0"
>
<el-select
v-model="item.inspectionCharacteristicsBaseVO.quantifyIsLowlimit"
placeholder="请选择是否设定下限"
@change="changeLowlimit"
>
<el-option
v-for="item in isYesList"
:key="item.value"
@ -193,40 +310,94 @@
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="目标值">
<el-input v-model="item.inspectionCharacteristicsBaseVO.quantifyTarget" />
<el-form-item
label="下限值"
prop="inspectionCharacteristicsBaseVO.quantifyLowlimit"
v-if="item.inspectionCharacteristicsBaseVO.featureType == 0"
>
<el-input v-model="item.inspectionCharacteristicsBaseVO.quantifyLowlimit" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="上限值">
<el-input v-model="item.inspectionCharacteristicsBaseVO.quantifyCapping" />
<el-form-item
prop="inspectionCharacteristicsBaseVO.quantifyIsTarget"
label="是否设定目标值"
v-if="item.inspectionCharacteristicsBaseVO.featureType == 0"
>
<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-col>
<el-col :span="12">
<el-form-item label="下限值">
<el-input v-model="item.inspectionCharacteristicsBaseVO.quantifyLowlimit" />
<el-form-item
label="目标值"
prop="inspectionCharacteristicsBaseVO.quantifyTarget"
v-if="item.inspectionCharacteristicsBaseVO.featureType == 0"
>
<el-input v-model="item.inspectionCharacteristicsBaseVO.quantifyTarget" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="计量单位">
<el-form-item
label="计量单位"
prop="inspectionCharacteristicsBaseVO.quantifyUom"
v-if="item.inspectionCharacteristicsBaseVO.featureType == 0"
>
<el-input v-model="item.inspectionCharacteristicsBaseVO.quantifyUom" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="小数位">
<el-form-item
label="小数位"
prop="inspectionCharacteristicsBaseVO.quantifyDecimal"
v-if="item.inspectionCharacteristicsBaseVO.featureType == 0"
>
<el-input v-model="item.inspectionCharacteristicsBaseVO.quantifyDecimal" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="选择集编码">
<el-select v-model="item.inspectionCharacteristicsBaseVO.quantifyQuantifyCode" placeholder="请选择集编码">
<el-option
v-for="item in inspectionProcessList"
:key="item.id"
:label="item.description"
:value="item.id"
<el-form-item
label="选择集编码"
prop="inspectionCharacteristicsBaseVO.quantifyQuantifyCode"
v-if="item.inspectionCharacteristicsBaseVO.featureType == 1"
>
<div style="display: flex; width: 100%">
<el-input
v-model="item.inspectionCharacteristicsBaseVO.quantifyQuantifyCode"
disabled
placeholder="请选择选择集编码"
/>
</el-select>
<el-button
type="info"
plain
style="width: 40px"
@click="
opensearchTable(
'quantifyQuantifyCode',
null,
'选择集编码',
SamplingProcess.allSchemas,
SamplingProcessApi.getSamplingProcessPage,
null,
false,
null,
item
)
"
><Icon icon="ep:search"
/></el-button>
</div>
</el-form-item>
</el-col>
</el-row>
@ -240,12 +411,20 @@
</Dialog>
<Dialog title="修改名称" v-model="dialogVisibleName" width="500px" :close-on-click-modal="false">
<div style="padding: 0px 20px">
<el-input v-model="name" style="width: 240px" placeholder="请输入名称" />
<el-form ref="nameRef" :model="nameForm">
<el-form-item
:rules="[{ required: true, message: '请输入名称', trigger: 'blur' }]"
prop="name"
>
<el-input v-model="nameForm.name" style="width: 240px" placeholder="请输入名称" />
</el-form-item>
</el-form>
</div>
<template #footer>
<ButtonBase :Butttondata="Butttondata" @button-base-click="buttonBaseClick1" />
</template>
</Dialog>
<SearchTable ref="searchTableRef" @searchTableSuccess="searchTableSuccess" />
</template>
<script setup lang="ts">
@ -253,21 +432,11 @@ import * as defaultButtons from '@/utils/disposition/defaultButtons'
import { getCurrentInstance } from 'vue'
import { DICT_TYPE, getStrDictOptions } from '@/utils/dict'
import * as InspectionProcessPageApi from '@/api/qms/inspectionTemplate'
const inspectionProcessList = ref([])
const isYesList = ref([])
onMounted(async()=>{
let inspectionProcessPage = await InspectionProcessPageApi.getInspectionProcessPage()
inspectionProcessList.value = inspectionProcessPage.list
console.log(inspectionProcessList)
import { SearchTable } from '@/components/SearchTable'
import { SamplingProcess } from '@/views/qms/samplingProcess/samplingProcess.data'
import * as SamplingProcessApi from '@/api/qms/samplingProcess'
const message = useMessage() //
isYesList.value =[{
value:0,
label:'是'
},{
value:1,
label:'否'
}]
})
const props = defineProps({
//
basicFormWidth: {
@ -297,40 +466,106 @@ const props = defineProps({
type: Array,
required: false,
default: null
},
// rules
rules: {
type: Object,
required: true,
default: null
}
})
const { t } = useI18n() //
const dialogVisible = ref(true) //
const dialogVisible = ref(false) //
const dialogTitle = ref('') //
const formLoading = ref(false) // 12
const formType = ref('') // create - update -
const dialogWidth = ref()
const formMainRef = ref()
const formFeaturesRef = ref()
const formProcessRef = ref()
const data = ref({
code: '',
description:'',
version:'',
process:[]
description: '',
version: '',
process: []
})
const isYesList = [
{
value: true,
label: '是'
},
{
value: false,
label: '否'
}
]
const dialogVisibleName = ref(false)
const name = ref('')
const onSubmit = () => {
console.log('submit!')
}
const nameForm = ref({
name: ''
})
const nameRef = ref()
if (props.basicFormWidth) {
dialogWidth.value = props.basicFormWidth + '%'
} else {
dialogWidth.value = props.isBusiness ? '60%' : '40%'
}
const rules = ref({
description: [{ required: true, message: '请填写描述', trigger: 'blur' }],
version: [{ required: true, message: '请填写版本', trigger: 'blur' }],
inspectionCode: [{ required: true, message: '请选择检验方案模板编码', trigger: 'blur' }],
sequenceCode: [{ required: true, message: '请填写顺序号', trigger: 'blur' }],
inspectionCharCode: [{ required: true, message: '请选择检验特性编码', trigger: 'blur' }],
'inspectionCharacteristicsBaseVO.description': [
{ required: true, message: '请填写描述', trigger: ['blur', 'change'] }
],
'inspectionCharacteristicsBaseVO.inspectionMethodCode': [
{ required: true, message: '请选择检验方法编码', trigger: 'blur' }
],
'inspectionCharacteristicsBaseVO.dynamicUpdateCode': [
{ required: true, message: '请选择采样过程编码', trigger: ['blur', 'change'] }
],
'inspectionCharacteristicsBaseVO.inspectionMethod': [
{ required: true, message: '请选择动态修改规则编码', trigger: ['blur', 'change'] }
],
'inspectionCharacteristicsBaseVO.isCanUpdate': [
{ required: true, message: '请选择是否允许修改特征值', trigger: ['blur', 'change'] }
],
'inspectionCharacteristicsBaseVO.isDestructionInspection': [
{ required: true, message: '请选择是否破坏性检验', trigger: ['blur', 'change'] }
],
'inspectionCharacteristicsBaseVO.resultEntryMethod': [
{ required: true, message: '请选择结果录入方式', trigger: ['blur', 'change'] }
],
'inspectionCharacteristicsBaseVO.featureType': [
{ required: true, message: '请选择特征类型', trigger: ['blur', 'change'] }
],
'inspectionCharacteristicsBaseVO.quantifyIsCapping': [
{ required: true, message: '请选择是否设定上限', trigger: ['blur', 'change'] }
],
'inspectionCharacteristicsBaseVO.quantifyIsLowlimit': [
{ required: true, message: '请选择是否设定下限', trigger: ['blur', 'change'] }
],
'inspectionCharacteristicsBaseVO.quantifyIsTarget': [
{ required: true, message: '请选择是否设定目标值', trigger: ['blur', 'change'] }
],
'inspectionCharacteristicsBaseVO.quantifyTarget': [
{ required: true, message: '请输入目标值', trigger: 'blur' }
],
'inspectionCharacteristicsBaseVO.quantifyCapping': [
{ required: true, message: '请输入上限值', trigger: 'blur' }
],
'inspectionCharacteristicsBaseVO.quantifyLowlimit': [
{ required: true, message: '请输入下限值', trigger: 'blur' }
],
'inspectionCharacteristicsBaseVO.quantifyUom': [
{ required: true, message: '请选择计量单位', trigger: 'blur' }
],
'inspectionCharacteristicsBaseVO.quantifyDecimal': [
{ required: true, message: '请输入小数位', trigger: 'blur' }
],
'inspectionCharacteristicsBaseVO.quantifyQuantifyCode': [
{ required: true, message: '请输入选择集编码', trigger: 'blur' }
]
})
/** 打开弹窗 */
let tabIndex = 1
const open = async (type: string, row?: any, masterParmas?: any, titleName?: any) => {
dialogVisible.value = true
if (titleName) {
@ -338,17 +573,35 @@ const open = async (type: string, row?: any, masterParmas?: any, titleName?: any
} else {
dialogTitle.value = t('action.' + type)
}
formType.value = type
if (row) {
data.value = row
let list = await InspectionProcessPageApi.getListByTempleteCode(row.code)
list.forEach((item, index) => {
editableTabsValue.value = index + 1
item.name = index + 1
})
data.value.process = list
} else {
data.value = {
code: '',
description: '',
version: '',
process: []
}
}
tabIndex = data.value.process.length + 1
}
defineExpose({ open, dialogVisible, formLoading }) // open
import type { TabPaneName } from 'element-plus'
let tabIndex = 1
const editableTabsValue = ref('1')
// const editableTabs = ref([])
const handleTabsEdit = (targetName: TabPaneName | undefined, action: 'remove' | 'add') => {
if (action === 'add') {
name.value = ''
nameForm.value.name = ''
dialogVisibleName.value = true
} else if (action === 'remove') {
const tabs = data.value.process
@ -370,39 +623,45 @@ const handleTabsEdit = (targetName: TabPaneName | undefined, action: 'remove' |
/** 修改名称时间 */
const buttonBaseClick1 = (val) => {
//
console.log(val)
if (val == 'save') {
const newTabName = `${++tabIndex}`
data.value.process.push({
description: name.value,
name: newTabName,
inspectionCode: '',
sequenceCode: '',
inspectionCharCode: '',
inspectionCharacteristicsBaseVO:{
describe: '',
inspectionMethodCode: '',
dynamicUpdateCode: '',
inspectionMethod: '',
isCanUpdate: '',
isDestructionInspection: '',
resultEntryMethod: '',
featureType: '',
quantifyIsCapping: '',
quantifyIsLowlimit: '',
quantifyTarget: '',
quantifyCapping: '',
quantifyLowlimit: '',
quantifyUom: '',
quantifyDecimal: '',
quantifyQuantifyCode: ''
if (!nameRef.value) return
nameRef.value.validate((valid, fields) => {
if (valid) {
const newTabName = `${++tabIndex}`
data.value.process.push({
description: nameForm.value.name,
name: newTabName,
inspectionCode: '',
sequenceCode: '',
inspectionCharCode: '',
inspectionCharacteristicsBaseVO: {
describe: '',
inspectionMethodCode: '',
dynamicUpdateCode: '',
inspectionMethod: '',
isCanUpdate: '',
isDestructionInspection: '',
resultEntryMethod: '',
featureType: '',
quantifyIsCapping: '',
quantifyIsLowlimit: '',
quantifyTarget: '',
quantifyCapping: '',
quantifyLowlimit: '',
quantifyUom: '',
quantifyDecimal: '',
quantifyQuantifyCode: ''
}
})
console.log(data.value.process)
editableTabsValue.value = newTabName
dialogVisibleName.value = false
} else {
console.log('error submit!')
return false
}
})
console.log( data.value.process)
editableTabsValue.value = newTabName
dialogVisibleName.value = false
}
//
else if (val == 'close') {
@ -419,14 +678,44 @@ const buttonBaseClick = (val) => {
dialogVisible.value = false
}
}
//
const emit = defineEmits(['submitForm', 'searchTableSuccess'])
const validateForm = (formRef) => {
// console.log(TableBaseForm_Ref.value)
let _lists = formRef?.map((v) => v.validate())
return Promise.all(_lists)
.then(() => {
return true
})
.catch(() => {
return false
})
}
const submitForm = async () => {
// const data1= unref(formRefMain)?.formModel
// const data2= unref(formRefProcess)?.formModel
// const data3= unref(formRefFeatures)?.formModel
// console.log(data1)
// console.log(data2)
console.log(data.list)
emit('submitForm', formType.value, data)
try {
const validateForm1 = await validateForm(formProcessRef.value)
console.log(validateForm1)
await formMainRef.value.validate()
if (!data.value.process || data.value.process.length == 0) {
message.error(`请添加工序`)
return;
}
const bol1 = await validateForm(formProcessRef.value)
const bol2 = await validateForm(formFeaturesRef.value)
if (!bol1 || !bol2) {
message.error(`模板中有检验工序和检验特性未填写完全`)
return;
}
if (formType.value == 'create') {
//
emit('submitForm', formType.value, data)
} else {
//
emit('submitForm', formType.value, data)
}
} catch {
console.log(111)
}
}
/** 弹窗按钮 */
let Butttondata: any = []
@ -438,6 +727,123 @@ if (props.footButttondata) {
defaultButtons.formCloseBtn(null) //
]
}
//
const changeFeatureType = (e) => {
console.log(e)
}
const searchTableRef = ref()
const opensearchTable = (
formField,
searchField,
searchTitle,
searchAllSchemas,
searchPage,
searchCondition,
multiple,
type,
row
) => {
console.log(988, row)
const _searchCondition = {}
//
if (searchCondition && searchCondition.length > 0) {
//
let filters: any[] = []
for (var i = 0; i < searchCondition.length; i++) {
// searchCondition.forEach((item) => {
// row
if (searchCondition[i].isMainValue) {
_searchCondition[searchCondition[i].key] = formRef.value.formModel[searchCondition[i].value]
? formRef.value.formModel[searchCondition[i].value]
: props.detailData
? props.detailData[searchCondition[i].value]
: row
? row[searchCondition[i].value]
: ''
//
let isNull = false
if (
_searchCondition[searchCondition[i].key] == '' ||
_searchCondition[searchCondition[i].key] == undefined
) {
isNull = true
}
if (isNull) {
message.warning(
searchCondition[i].message ? searchCondition[i].message : '前置条件未选择!'
)
return
}
} else {
//
if (searchCondition[i].isSearch) {
filters.push({
action: searchCondition[i].action,
column: searchCondition[i].key,
value: searchCondition[i].value
})
} else {
_searchCondition[searchCondition[i].key] = searchCondition[i].value
}
}
}
if (filters.length > 0) {
_searchCondition.isSearch = true
_searchCondition.filters = filters
}
}
const _searchTableTitle = searchTitle
const _searchTableAllSchemas = searchAllSchemas
const _searchTablePage = searchPage
searchTableRef.value.open(
_searchTableTitle,
_searchTableAllSchemas,
_searchTablePage,
formField,
searchField,
multiple,
type,
row,
_searchCondition
)
}
//
// val row
const searchTableSuccess = (formField, searchField, val, type, row) => {
console.log(row)
data.value.process.forEach((item) => {
if (item.description == row.description) {
item.inspectionCharacteristicsBaseVO[formField] = val[0].code
}
})
// row.inspectionCharacteristicsBaseVO.inspectionMethodCode = val[0].code
// emit('searchTableSuccess', formField, searchField, val, formRef.value, type, row)
}
//
const changeIsCapping = (e) => {
if (e) {
rules.value['inspectionCharacteristicsBaseVO.quantifyCapping'][0].required = true
} else {
rules.value['inspectionCharacteristicsBaseVO.quantifyCapping'][0].required = false
}
}
//
const changeLowlimit = (e) => {
if (e) {
rules.value['inspectionCharacteristicsBaseVO.quantifyLowlimit'][0].required = true
} else {
rules.value['inspectionCharacteristicsBaseVO.quantifyLowlimit'][0].required = false
}
}
//
const changeIsTarget = (e) => {
if (e) {
rules.value['inspectionCharacteristicsBaseVO.quantifyTarget'][0].required = true
} else {
rules.value['inspectionCharacteristicsBaseVO.quantifyTarget'][0].required = false
}
}
</script>
<style scoped>
.small-title {

95
src/views/qms/basicDataManage/inspectionTemplate/index.vue

@ -1,7 +1,7 @@
<template>
<ContentWrap>
<!-- 搜索工作栏 -->
<Search :schema="AgvLocationrelation.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" />
<Search :schema="InspectionTemplateMain.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" />
</ContentWrap>
<!-- 列表头部 -->
@ -11,7 +11,7 @@
:routeName="routeName"
@updataTableColumns="updataTableColumns"
@searchFormClick="searchFormClick"
:allSchemas="AgvLocationrelation.allSchemas"
:allSchemas="InspectionTemplateMain.allSchemas"
/>
<!-- 列表 -->
@ -39,16 +39,6 @@
</ContentWrap>
<!-- 表单弹窗添加/修改 -->
<!-- <BasicForm
ref="basicFormRef"
@success="formsSuccess"
:rules="AgvLocationrelationRules"
:formAllSchemas="AgvLocationrelation.allSchemas"
:apiUpdate="AgvLocationrelationApi.updateAgvLocationrelation"
:apiCreate="AgvLocationrelationApi.createAgvLocationrelation"
@searchTableSuccess="searchTableSuccess"
:isBusiness="false"
/> -->
<AddForm
ref="basicFormRef"
basicFormWidth="80"
@ -56,12 +46,13 @@
:formAllSchemasProcess="InspectionTemplateProcess.allSchemas"
:formAllSchemasMain="InspectionTemplateMain.allSchemas"
:rules="InspectionTemplateRules"
@submitForm="submitForm"
/>
<!-- 详情 -->
<Detail
ref="detailRef"
:isBasic="true"
:allSchemas="AgvLocationrelation.allSchemas"
:allSchemas="InspectionTemplateMain.allSchemas"
/>
<!-- 导入 -->
@ -70,13 +61,13 @@
<script setup lang="ts">
import download from '@/utils/download'
import { AgvLocationrelation,AgvLocationrelationRules,InspectionTemplateMain,InspectionTemplateProcess,InspectionTemplateFeatures,InspectionTemplateRules } from './agvLocationrelation.data'
import * as AgvLocationrelationApi from '@/api/wms/agvLocationrelation'
import { InspectionTemplateMain,InspectionTemplateProcess,InspectionTemplateFeatures,InspectionTemplateRules } from './inspectionTemplate.data'
import * as defaultButtons from '@/utils/disposition/defaultButtons'
import TableHead from '@/components/TableHead/src/TableHead.vue'
import ImportForm from '@/components/ImportForm/src/ImportForm.vue'
import Detail from '@/components/Detail/src/Detail.vue'
import AddForm from './addForm.vue'
import * as InspectionProcessPageApi from '@/api/qms/inspectionTemplate'
defineOptions({ name: 'AgvLocationrelation' })
@ -86,16 +77,7 @@ const { t } = useI18n() // 国际化
const route = useRoute() //
const routeName = ref()
routeName.value = route.name
const tableColumns = ref(AgvLocationrelation.allSchemas.tableColumns)
//
const searchTableSuccess = (formField, searchField, val, formRef) => {
nextTick(() => {
const setV = {}
setV[formField] = val[0][searchField]
formRef.setValues(setV)
})
}
const tableColumns = ref(InspectionTemplateMain.allSchemas.tableColumns)
//
const updataTableColumns = (val) => {
@ -103,7 +85,7 @@ const updataTableColumns = (val) => {
}
const { tableObject, tableMethods } = useTable({
getListApi: AgvLocationrelationApi.getAgvLocationrelationPage //
getListApi: InspectionProcessPageApi.inspectionTemplatePage //
})
//
@ -112,8 +94,8 @@ const { getList, setSearchParams } = tableMethods
//
const HeadButttondata = [
defaultButtons.defaultAddBtn({hasPermi:'wms:agv-locationrelation:create'}), //
defaultButtons.defaultImportBtn({hasPermi:'wms:agv-locationrelation:import'}), //
defaultButtons.defaultExportBtn({hasPermi:'wms:agv-locationrelation:export'}), //
// defaultButtons.defaultImportBtn({hasPermi:'wms:agv-locationrelation:import'}), //
// defaultButtons.defaultExportBtn({hasPermi:'wms:agv-locationrelation:export'}), //
defaultButtons.defaultFreshBtn(null), //
defaultButtons.defaultFilterBtn(null), //
defaultButtons.defaultSetBtn(null), //
@ -145,8 +127,8 @@ const buttonBaseClick = (val, item) => {
// -
const butttondata = [
defaultButtons.mainListEditBtn({hasPermi:'wms:agv-locationrelation:update'}), //
defaultButtons.mainListDeleteBtn({hasPermi:'wms:agv-locationrelation:delete'}), //
defaultButtons.mainListEditBtn({hasPermi:'qms:inspectionTemplate:update'}), //
defaultButtons.mainListDeleteBtn({hasPermi:'qms:inspectionTemplate:delete'}), //
]
// -
@ -165,23 +147,13 @@ const openForm = (type: string, row?: any) => {
}
// form
const formsSuccess = async (formType,data) => {
var isHave =AgvLocationrelation.allSchemas.formSchema.some(function (item) {
return item.field === 'activeTime' || item.field === 'expireTime';
});
if(isHave){
if(data.activeTime && data.expireTime && data.activeTime >=data.expireTime){
message.error('失效时间要大于生效时间')
return;
}
}
if(data.activeTime==0)data.activeTime = null;
if(data.expireTime==0)data.expireTime = null;
const submitForm = async (formType,data) => {
console.log(data.value)
if (formType === 'create') {
await AgvLocationrelationApi.createAgvLocationrelation(data)
await InspectionProcessPageApi.inspectionTemplateCreat(data.value)
message.success(t('common.createSuccess'))
} else {
await AgvLocationrelationApi.updateAgvLocationrelation(data)
await InspectionProcessPageApi.inspectionTemplateUpdate(data.value)
message.success(t('common.updateSuccess'))
}
basicFormRef.value.dialogVisible = false
@ -200,43 +172,13 @@ const handleDelete = async (id: number) => {
//
await message.delConfirm()
//
await AgvLocationrelationApi.deleteAgvLocationrelation(id)
await InspectionProcessPageApi.inspectionTemplateDelete(id)
message.success(t('common.delSuccess'))
//
await getList()
} catch {}
}
/** 导出按钮操作 */
const exportLoading = ref(false) //
const handleExport = async () => {
try {
//
await message.exportConfirm()
//
exportLoading.value = true
const data = await AgvLocationrelationApi.exportAgvLocationrelation(tableObject.params)
download.excel(data, 'AGV库位转换.xlsx')
} catch {
} finally {
exportLoading.value = false
}
}
/** 导入 */
const importFormRef = ref()
const handleImport = () => {
importFormRef.value.open()
}
//
const importTemplateData = reactive({
templateUrl: '',
templateTitle: 'AGV库位转换导入模版.xlsx'
})
//
const importSuccess = () => {
getList()
}
//
const searchFormClick = (searchData) => {
@ -250,7 +192,6 @@ const searchFormClick = (searchData) => {
/** 初始化 **/
onMounted(async () => {
getList()
importTemplateData.templateUrl = await AgvLocationrelationApi.importTemplate()
})
</script>

207
src/views/qms/basicDataManage/inspectionTemplate/agvLocationrelation.data.ts → src/views/qms/basicDataManage/inspectionTemplate/inspectionTemplate.data.ts

@ -1,157 +1,9 @@
import type { CrudSchema } from '@/hooks/web/useCrudSchemas'
import { dateFormatter } from '@/utils/formatTime'
import * as AreaApi from '@/api/wms/areabasic'
import { Area } from '@/views/wms/basicDataManage/factoryModeling/areabasic/areabasic.data'
import * as LocationApi from '@/api/wms/location'
import { Location } from '@/views/wms/basicDataManage/factoryModeling/location/location.data'
import * as InspectionProcessPageApi from '@/api/qms/inspectionTemplate'
let inspectionProcessPage = await InspectionProcessPageApi.getInspectionProcessPage()
inspectionProcessPage = inspectionProcessPage.list
// 表单校验
export const AgvLocationrelationRules = reactive({
positionCode: [
{ required: true, message: '请填写AGV点位', trigger: 'change' }
],
positionArea: [
{ required: true, message: '请填写AGV库区', trigger: 'change' }
],
wmsArea: [
{ required: true, message: '请填写WMS库区', trigger: 'change' }
],
wmsPosition: [
{ required: true, message: '请填写WMS库位', trigger: 'change' }
]
})
export const AgvLocationrelation = useCrudSchemas(reactive<CrudSchema[]>([
{
label: '单据号',
field: 'reqCode',
sort: 'custom',
isSearch: true,
isForm: false,
},
{
label: 'AGV点位',
field: 'positionCode',
sort: 'custom',
isSearch: false,
},
{
label: 'AGV库区',
field: 'positionArea',
sort: 'custom',
isSearch: false,
},
{
label: 'WMS库区',
field: 'wmsArea',
sort: 'custom',
isSearch: false,
form: {
// labelMessage: '信息提示说明!!!',
componentProps: {
isSearchList: true, // 开启查询弹窗
searchListPlaceholder: '请选择库区代码', // 输入框占位文本
searchField: 'code', // 查询弹窗赋值字段
searchTitle: '库区信息', // 查询弹窗标题
searchAllSchemas: Area.allSchemas, // 查询弹窗所需类
searchPage: AreaApi.getAreaPage, // 查询弹窗所需分页方法
searchCondition: [{
key: 'available',
value: 'TRUE',
isMainValue: false
}]
}
}
},
{
label: 'WMS库位',
field: 'wmsPosition',
sort: 'custom',
table: {
width: 150
},
form: {
// labelMessage: '信息提示说明!!!',
componentProps: {
isSearchList: true, // 开启查询弹窗
searchListPlaceholder: '请选择库位代码', // 输入框占位文本
searchField: 'code', // 查询弹窗赋值字段
searchTitle: '库位信息', // 查询弹窗标题
searchAllSchemas: Location.allSchemas, // 查询弹窗所需类
searchPage: LocationApi.getLocationPage, // 查询弹窗所需分页方法
searchCondition: [{
key: 'available',
value: 'TRUE',
isMainValue: false
},
{
key: 'areaCode',
value: "wmsArea",
message: '请选择库区代码!',
isMainValue: true
}]
}
}
},
{
label: '是否可用',
field: 'available',
dictType: DICT_TYPE.TRUE_FALSE,
dictClass: 'string',
isTable: true,
isSearch: false,
sort: 'custom',
table: {
width: 150
},
form: {
component: 'Switch',
value: 'TRUE',
componentProps: {
inactiveValue: 'FALSE',
activeValue: 'TRUE'
}
}
},
{
label: '创建时间',
field: 'createTime',
sort: 'custom',
formatter: dateFormatter,
isSearch: true,
search: {
component: 'DatePicker',
componentProps: {
valueFormat: 'YYYY-MM-DD HH:mm:ss',
type: 'daterange',
defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')]
}
},
detail: {
dateFormat: 'YYYY-MM-DD HH:mm:ss'
},
isForm: false,
},
{
label: '备注',
field: 'remark',
sort: 'custom',
isSearch: false,
},
{
label: '操作',
field: 'action',
isForm: false,
isDetail: false,
table: {
width: 150,
fixed: 'right'
}
}
]))
export const InspectionTemplateRules = reactive({
description: [
{ required: true , message: '请填写描述', trigger: 'blur' }
@ -237,6 +89,15 @@ export const InspectionTemplateMain = useCrudSchemas(reactive<CrudSchema[]>([
label: '版本',
field: 'version',
sort: 'custom',
},
{
label: '操作',
field: 'action',
isForm: false,
table: {
width: 150,
fixed: 'right'
}
}
]))
export const InspectionTemplateProcess = useCrudSchemas(reactive<CrudSchema[]>([
@ -260,16 +121,6 @@ export const InspectionTemplateProcess = useCrudSchemas(reactive<CrudSchema[]>([
label: '检验方案模板编码',
field: 'inspectionCode',
sort: 'custom',
form:{
component:'Select',
api: () => inspectionProcessPage,
componentProps:{
optionsAlias: {
labelField: 'description',
valueField: 'id'
}
}
}
},{
label: '顺序号',
field: 'sequenceCode',
@ -277,16 +128,6 @@ export const InspectionTemplateProcess = useCrudSchemas(reactive<CrudSchema[]>([
label: '检验特性编码',
field: 'inspectionCharCode',
sort: 'custom',
form:{
component:'Select',
api: () => inspectionProcessPage,
componentProps:{
optionsAlias: {
labelField: 'description',
valueField: 'id'
}
}
}
}
]))
export const InspectionTemplateFeatures= useCrudSchemas(reactive<CrudSchema[]>([
@ -309,44 +150,14 @@ export const InspectionTemplateFeatures= useCrudSchemas(reactive<CrudSchema[]>([
label: '检验方法编码',
field: 'inspectionMethodCode',
sort: 'custom',
form:{
component:'Select',
api: () => inspectionProcessPage,
componentProps:{
optionsAlias: {
labelField: 'description',
valueField: 'id'
}
}
}
},{
label: '采样过程编码',
field: 'dynamicUpdateCode',
sort: 'custom',
form:{
component:'Select',
api: () => inspectionProcessPage,
componentProps:{
optionsAlias: {
labelField: 'description',
valueField: 'id'
}
}
}
},{
label: '动态修改规则编码',
field: 'inspectionMethod',
sort: 'custom',
form:{
component:'Select',
api: () => inspectionProcessPage,
componentProps:{
optionsAlias: {
labelField: 'description',
valueField: 'id'
}
}
}
},{
label: '是否允许修改特征值',
field: 'isCanUpdate',
Loading…
Cancel
Save