|
|
@ -41,8 +41,8 @@ |
|
|
|
<!-- 表单弹窗:添加/修改 --> |
|
|
|
<BasicForm |
|
|
|
ref="basicFormRef" |
|
|
|
@success="getList" |
|
|
|
:rules="DetectionTemplateRules" |
|
|
|
@success="formsSuccess" |
|
|
|
:rules="rules" |
|
|
|
:formAllSchemas="DetectionTemplate.allSchemas" |
|
|
|
:searchTableParams="searchTableParams" |
|
|
|
:apiUpdate="DetectionTemplateApi.updateDetectionTemplate" |
|
|
@ -60,7 +60,7 @@ |
|
|
|
|
|
|
|
<script setup lang="ts"> |
|
|
|
import download from '@/utils/download' |
|
|
|
import { DetectionTemplate,DetectionTemplateRules } from './detectionTemplate.data' |
|
|
|
import { DetectionTemplate,DetectionTemplateRules,rules } from './detectionTemplate.data' |
|
|
|
import * as DetectionTemplateApi from '@/api/spc/detectionTemplate' |
|
|
|
import * as defaultButtons from '@/utils/disposition/defaultButtons' |
|
|
|
// import TableHead from '@/components/TableHead/src/TableHead.vue' |
|
|
@ -156,14 +156,60 @@ const openForm = (type: string, row?: any) => { |
|
|
|
} |
|
|
|
|
|
|
|
// 查询页面返回 |
|
|
|
const searchTableSuccess = (formField, searchField, val, formRef) => { |
|
|
|
const searchTableSuccess = (formField, searchField, val, formRef,type,row) => { |
|
|
|
// nextTick(() => { |
|
|
|
// const setV = {} |
|
|
|
// setV[formField] = val[0][searchField] |
|
|
|
// formRef.setValues(setV) |
|
|
|
// }) |
|
|
|
nextTick(() => { |
|
|
|
if (type == 'tableForm') { |
|
|
|
// 子表查询页赋值 |
|
|
|
row[formField] = val[0][searchField] |
|
|
|
row['poLine'] = val[0]['poLine'] |
|
|
|
row['batch'] = val[0]['toBatch'] |
|
|
|
row['altBatch'] = val[0]['altBatch'] |
|
|
|
row['itemCode'] = val[0]['itemCode'] |
|
|
|
row['itemName'] = val[0]['itemName'] |
|
|
|
row['itemDesc1'] = val[0]['itemDesc1'] |
|
|
|
row['itemDesc2'] = val[0]['itemDesc2'] |
|
|
|
row['projectCode'] = val[0]['projectCode'] |
|
|
|
row['qty'] = val[0]['qty'] |
|
|
|
row['uom'] = val[0]['uom'] |
|
|
|
} else { |
|
|
|
// 主表查询页赋值 |
|
|
|
const setV = {} |
|
|
|
setV[formField] = val[0][searchField] |
|
|
|
setV['itemName'] = val[0]['name'] |
|
|
|
setV['projectName'] = val[0]['projectName'] |
|
|
|
formRef.setValues(setV) |
|
|
|
} |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
const formsSuccess = async (formType,data) => { |
|
|
|
var isHave =DetectionTemplate.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; |
|
|
|
if (formType === 'create') { |
|
|
|
await DetectionTemplateApi.createDetectionTemplate(data) |
|
|
|
message.success(t('common.createSuccess')) |
|
|
|
} else { |
|
|
|
await DetectionTemplateApi.updateDetectionTemplate(data) |
|
|
|
message.success(t('common.updateSuccess')) |
|
|
|
} |
|
|
|
basicFormRef.value.dialogVisible = false |
|
|
|
getList() |
|
|
|
} |
|
|
|
|
|
|
|
/** 详情操作 */ |
|
|
|
const openDetail = () => { |
|
|
|
router.push({ path: '/spc/templateitemdetails' }) |
|
|
|