|
|
@ -1,18 +1,22 @@ |
|
|
|
<template> |
|
|
|
<ContentWrap> |
|
|
|
<!-- 搜索工作栏 --> |
|
|
|
<Search :schema="DetectionTemplate.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" /> |
|
|
|
<Search |
|
|
|
:schema="DetectionTemplate.allSchemas.searchSchema" |
|
|
|
@search="setSearchParams" |
|
|
|
@reset="setSearchParams" |
|
|
|
/> |
|
|
|
</ContentWrap> |
|
|
|
|
|
|
|
<!-- 列表头部 allschemas管理列表标题--> |
|
|
|
<TableHead |
|
|
|
:HeadButttondata="HeadButttondata" |
|
|
|
@button-base-click="buttonBaseClick" |
|
|
|
:routeName="routeName" |
|
|
|
@updataTableColumns="updataTableColumns" |
|
|
|
@searchFormClick="searchFormClick" |
|
|
|
:allSchemas="DetectionTemplate.allSchemas" |
|
|
|
/> |
|
|
|
<!-- 列表头部 allschemas管理列表标题--> |
|
|
|
<TableHead |
|
|
|
:HeadButttondata="HeadButttondata" |
|
|
|
@button-base-click="buttonBaseClick" |
|
|
|
:routeName="routeName" |
|
|
|
@updataTableColumns="updataTableColumns" |
|
|
|
@searchFormClick="searchFormClick" |
|
|
|
:allSchemas="DetectionTemplate.allSchemas" |
|
|
|
/> |
|
|
|
|
|
|
|
<!-- 列表 --> |
|
|
|
<ContentWrap> |
|
|
@ -27,13 +31,13 @@ |
|
|
|
v-model:currentPage="tableObject.currentPage" |
|
|
|
v-model:sort="tableObject.sort" |
|
|
|
> |
|
|
|
<template #itemCode="{row}"> |
|
|
|
<template #itemCode="{ row }"> |
|
|
|
<el-button type="primary" link @click="openDetail(row, '模版项管理', row.code)"> |
|
|
|
<span>{{ row.itemCode }}</span> |
|
|
|
</el-button> |
|
|
|
</template> |
|
|
|
<template #action="{ row }"> |
|
|
|
<ButtonBase :Butttondata="butttondata" @button-base-click="buttonTableClick($event,row)" /> |
|
|
|
<ButtonBase :Butttondata="butttondata" @button-base-click="buttonTableClick($event, row)" /> |
|
|
|
</template> |
|
|
|
</Table> |
|
|
|
</ContentWrap> |
|
|
@ -42,7 +46,7 @@ |
|
|
|
<BasicForm |
|
|
|
ref="basicFormRef" |
|
|
|
@success="formsSuccess" |
|
|
|
:rules="rules" |
|
|
|
:rules="rules" |
|
|
|
:formAllSchemas="DetectionTemplate.allSchemas" |
|
|
|
:searchTableParams="searchTableParams" |
|
|
|
:apiUpdate="DetectionTemplateApi.updateDetectionTemplate" |
|
|
@ -63,16 +67,17 @@ |
|
|
|
:apiPage="TemplateItemDetailsApi.getTemplateItemDetailsPage" |
|
|
|
:apiDelete="TemplateItemDetailsApi.deleteTemplateItemDetails" |
|
|
|
:Echo="Echo" |
|
|
|
width="60%" |
|
|
|
width="60%" |
|
|
|
fromeWhere="detectionTemplateManagement" |
|
|
|
@searchTableSuccessDetail="searchTableSuccessDetail" |
|
|
|
@typeSelectChange="typeSelectChange" |
|
|
|
/> |
|
|
|
|
|
|
|
</template> |
|
|
|
|
|
|
|
<script setup lang="ts"> |
|
|
|
import download from '@/utils/download' |
|
|
|
import { DetectionTemplate,rules } from './detectionTemplate.data' |
|
|
|
import { TemplateItemDetails,TemplateItemDetailsRules} from './templateItemDetails.data' |
|
|
|
import { DetectionTemplate, rules } from './detectionTemplate.data' |
|
|
|
import { TemplateItemDetails, TemplateItemDetailsRules } from './templateItemDetails.data' |
|
|
|
import * as TemplateItemDetailsApi from '@/api/spc/templateItemDetails' |
|
|
|
import * as DetectionTemplateApi from '@/api/spc/detectionTemplate' |
|
|
|
import * as defaultButtons from '@/utils/disposition/defaultButtons' |
|
|
@ -95,12 +100,12 @@ const updataTableColumns = (val) => { |
|
|
|
|
|
|
|
// 查询列表页面参数设置 |
|
|
|
const searchTableParams = ref([ |
|
|
|
//{ |
|
|
|
// formField: 'productItemCode', |
|
|
|
// searchTableTitle: '物料信息', |
|
|
|
// searchTableAllSchemas: Itembasic.allSchemas, |
|
|
|
// searchTablePage: ItembasicApi.getItembasicPage |
|
|
|
//} |
|
|
|
//{ |
|
|
|
// formField: 'productItemCode', |
|
|
|
// searchTableTitle: '物料信息', |
|
|
|
// searchTableAllSchemas: Itembasic.allSchemas, |
|
|
|
// searchTablePage: ItembasicApi.getItembasicPage |
|
|
|
//} |
|
|
|
]) |
|
|
|
|
|
|
|
const { tableObject, tableMethods } = useTable({ |
|
|
@ -108,8 +113,7 @@ const { tableObject, tableMethods } = useTable({ |
|
|
|
}) |
|
|
|
|
|
|
|
// 获得表格的各种操作 |
|
|
|
const {getList, setSearchParams } = tableMethods |
|
|
|
|
|
|
|
const { getList, setSearchParams } = tableMethods |
|
|
|
|
|
|
|
// 列表头部按钮 |
|
|
|
const HeadButttondata = [ |
|
|
@ -118,7 +122,7 @@ const HeadButttondata = [ |
|
|
|
// defaultButtons.defaultExportBtn(null), // 导出 |
|
|
|
defaultButtons.defaultFreshBtn(null), // 刷新 |
|
|
|
// defaultButtons.defaultFilterBtn(null), // 筛选 |
|
|
|
defaultButtons.defaultSetBtn(null), // 设置 |
|
|
|
defaultButtons.defaultSetBtn(null) // 设置 |
|
|
|
// { |
|
|
|
// label: '自定义扩展按钮', |
|
|
|
// name: 'zdy', |
|
|
@ -131,16 +135,22 @@ const HeadButttondata = [ |
|
|
|
|
|
|
|
// 头部按钮事件 |
|
|
|
const buttonBaseClick = (val, item) => { |
|
|
|
if (val == 'add') { // 新增 |
|
|
|
if (val == 'add') { |
|
|
|
// 新增 |
|
|
|
openForm('create') |
|
|
|
} else if (val == 'import') { // 导入 |
|
|
|
} else if (val == 'import') { |
|
|
|
// 导入 |
|
|
|
handleImport() |
|
|
|
} else if (val == 'export') { // 导出 |
|
|
|
} else if (val == 'export') { |
|
|
|
// 导出 |
|
|
|
handleExport() |
|
|
|
} else if (val == 'refresh') { // 刷新 |
|
|
|
} else if (val == 'refresh') { |
|
|
|
// 刷新 |
|
|
|
getList() |
|
|
|
} else if (val == 'filtrate') { // 筛选 |
|
|
|
} else { // 其他按钮 |
|
|
|
} else if (val == 'filtrate') { |
|
|
|
// 筛选 |
|
|
|
} else { |
|
|
|
// 其他按钮 |
|
|
|
console.log('其他按钮', item) |
|
|
|
} |
|
|
|
} |
|
|
@ -148,14 +158,16 @@ const buttonBaseClick = (val, item) => { |
|
|
|
// 列表-操作按钮 |
|
|
|
const butttondata = [ |
|
|
|
defaultButtons.mainListEditBtn(null), // 编辑 |
|
|
|
defaultButtons.mainListDeleteBtn(null), // 删除 |
|
|
|
defaultButtons.mainListDeleteBtn(null) // 删除 |
|
|
|
] |
|
|
|
|
|
|
|
// 列表-操作按钮事件 |
|
|
|
const buttonTableClick = async (val, row) => { |
|
|
|
if (val == 'edit') { // 编辑 |
|
|
|
if (val == 'edit') { |
|
|
|
// 编辑 |
|
|
|
openForm('update', row) |
|
|
|
} else if (val == 'delete') { // 删除 |
|
|
|
} else if (val == 'delete') { |
|
|
|
// 删除 |
|
|
|
handleDelete(row.id) |
|
|
|
} |
|
|
|
} |
|
|
@ -167,7 +179,7 @@ const openForm = (type: string, row?: any) => { |
|
|
|
} |
|
|
|
|
|
|
|
// 查询页面返回 |
|
|
|
const searchTableSuccess = (formField, searchField, val, formRef,type,row) => { |
|
|
|
const searchTableSuccess = (formField, searchField, val, formRef, type, row) => { |
|
|
|
// nextTick(() => { |
|
|
|
// const setV = {} |
|
|
|
// setV[formField] = val[0][searchField] |
|
|
@ -199,7 +211,7 @@ const searchTableSuccess = (formField, searchField, val, formRef,type,row) => { |
|
|
|
} |
|
|
|
|
|
|
|
// 子页面查询页面返回 |
|
|
|
const searchTableSuccessDetail = (formField, searchField, val, formRef,type,row) => { |
|
|
|
const searchTableSuccessDetail = (formField, searchField, val, formRef, type, row) => { |
|
|
|
// nextTick(() => { |
|
|
|
// const setV = {} |
|
|
|
// setV[formField] = val[0][searchField] |
|
|
@ -230,27 +242,27 @@ const searchTableSuccessDetail = (formField, searchField, val, formRef,type,row) |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
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 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() |
|
|
|
} |
|
|
|
|
|
|
|
/** 详情操作 */ |
|
|
@ -314,11 +326,22 @@ const searchFormClick = (searchData) => { |
|
|
|
} |
|
|
|
getList() // 刷新当前列表 |
|
|
|
} |
|
|
|
|
|
|
|
// 详情新增的时候选择数据类型的时候针对上限和下限的操作 |
|
|
|
const typeSelectChange = (field, val,formRef) => { |
|
|
|
if (field == 'type') { |
|
|
|
console.log(formRef) |
|
|
|
if (val == 'NO_NUMBER') { |
|
|
|
TemplateItemDetails.allSchemas.formSchema[5].componentProps.disabled = true |
|
|
|
TemplateItemDetails.allSchemas.formSchema[6].componentProps.disabled = true |
|
|
|
} else { |
|
|
|
TemplateItemDetails.allSchemas.formSchema[5].componentProps.disabled= false |
|
|
|
TemplateItemDetails.allSchemas.formSchema[6].componentProps.disabled= false |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
/** 初始化 **/ |
|
|
|
onMounted(async () => { |
|
|
|
getList() |
|
|
|
//importTemplateData.templateUrl = await DetectionTemplateApi.importTemplate() |
|
|
|
}) |
|
|
|
|
|
|
|
</script> |
|
|
|