|
@ -1,18 +1,22 @@ |
|
|
<template> |
|
|
<template> |
|
|
<ContentWrap> |
|
|
<ContentWrap> |
|
|
<!-- 搜索工作栏 --> |
|
|
<!-- 搜索工作栏 --> |
|
|
<Search :schema="DetectionTemplate.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" /> |
|
|
<Search |
|
|
|
|
|
:schema="DetectionTemplate.allSchemas.searchSchema" |
|
|
|
|
|
@search="setSearchParams" |
|
|
|
|
|
@reset="setSearchParams" |
|
|
|
|
|
/> |
|
|
</ContentWrap> |
|
|
</ContentWrap> |
|
|
|
|
|
|
|
|
<!-- 列表头部 allschemas管理列表标题--> |
|
|
<!-- 列表头部 allschemas管理列表标题--> |
|
|
<TableHead |
|
|
<TableHead |
|
|
:HeadButttondata="HeadButttondata" |
|
|
:HeadButttondata="HeadButttondata" |
|
|
@button-base-click="buttonBaseClick" |
|
|
@button-base-click="buttonBaseClick" |
|
|
:routeName="routeName" |
|
|
:routeName="routeName" |
|
|
@updataTableColumns="updataTableColumns" |
|
|
@updataTableColumns="updataTableColumns" |
|
|
@searchFormClick="searchFormClick" |
|
|
@searchFormClick="searchFormClick" |
|
|
:allSchemas="DetectionTemplate.allSchemas" |
|
|
:allSchemas="DetectionTemplate.allSchemas" |
|
|
/> |
|
|
/> |
|
|
|
|
|
|
|
|
<!-- 列表 --> |
|
|
<!-- 列表 --> |
|
|
<ContentWrap> |
|
|
<ContentWrap> |
|
@ -27,13 +31,13 @@ |
|
|
v-model:currentPage="tableObject.currentPage" |
|
|
v-model:currentPage="tableObject.currentPage" |
|
|
v-model:sort="tableObject.sort" |
|
|
v-model:sort="tableObject.sort" |
|
|
> |
|
|
> |
|
|
<template #itemCode="{row}"> |
|
|
<template #itemCode="{ row }"> |
|
|
<el-button type="primary" link @click="openDetail(row, '模版项管理', row.code)"> |
|
|
<el-button type="primary" link @click="openDetail(row, '模版项管理', row.code)"> |
|
|
<span>{{ row.itemCode }}</span> |
|
|
<span>{{ row.itemCode }}</span> |
|
|
</el-button> |
|
|
</el-button> |
|
|
</template> |
|
|
</template> |
|
|
<template #action="{ row }"> |
|
|
<template #action="{ row }"> |
|
|
<ButtonBase :Butttondata="butttondata" @button-base-click="buttonTableClick($event,row)" /> |
|
|
<ButtonBase :Butttondata="butttondata" @button-base-click="buttonTableClick($event, row)" /> |
|
|
</template> |
|
|
</template> |
|
|
</Table> |
|
|
</Table> |
|
|
</ContentWrap> |
|
|
</ContentWrap> |
|
@ -63,16 +67,17 @@ |
|
|
:apiPage="TemplateItemDetailsApi.getTemplateItemDetailsPage" |
|
|
:apiPage="TemplateItemDetailsApi.getTemplateItemDetailsPage" |
|
|
:apiDelete="TemplateItemDetailsApi.deleteTemplateItemDetails" |
|
|
:apiDelete="TemplateItemDetailsApi.deleteTemplateItemDetails" |
|
|
:Echo="Echo" |
|
|
:Echo="Echo" |
|
|
width="60%" |
|
|
width="60%" |
|
|
|
|
|
fromeWhere="detectionTemplateManagement" |
|
|
@searchTableSuccessDetail="searchTableSuccessDetail" |
|
|
@searchTableSuccessDetail="searchTableSuccessDetail" |
|
|
|
|
|
@typeSelectChange="typeSelectChange" |
|
|
/> |
|
|
/> |
|
|
|
|
|
|
|
|
</template> |
|
|
</template> |
|
|
|
|
|
|
|
|
<script setup lang="ts"> |
|
|
<script setup lang="ts"> |
|
|
import download from '@/utils/download' |
|
|
import download from '@/utils/download' |
|
|
import { DetectionTemplate,rules } from './detectionTemplate.data' |
|
|
import { DetectionTemplate, rules } from './detectionTemplate.data' |
|
|
import { TemplateItemDetails,TemplateItemDetailsRules} from './templateItemDetails.data' |
|
|
import { TemplateItemDetails, TemplateItemDetailsRules } from './templateItemDetails.data' |
|
|
import * as TemplateItemDetailsApi from '@/api/spc/templateItemDetails' |
|
|
import * as TemplateItemDetailsApi from '@/api/spc/templateItemDetails' |
|
|
import * as DetectionTemplateApi from '@/api/spc/detectionTemplate' |
|
|
import * as DetectionTemplateApi from '@/api/spc/detectionTemplate' |
|
|
import * as defaultButtons from '@/utils/disposition/defaultButtons' |
|
|
import * as defaultButtons from '@/utils/disposition/defaultButtons' |
|
@ -95,12 +100,12 @@ const updataTableColumns = (val) => { |
|
|
|
|
|
|
|
|
// 查询列表页面参数设置 |
|
|
// 查询列表页面参数设置 |
|
|
const searchTableParams = ref([ |
|
|
const searchTableParams = ref([ |
|
|
//{ |
|
|
//{ |
|
|
// formField: 'productItemCode', |
|
|
// formField: 'productItemCode', |
|
|
// searchTableTitle: '物料信息', |
|
|
// searchTableTitle: '物料信息', |
|
|
// searchTableAllSchemas: Itembasic.allSchemas, |
|
|
// searchTableAllSchemas: Itembasic.allSchemas, |
|
|
// searchTablePage: ItembasicApi.getItembasicPage |
|
|
// searchTablePage: ItembasicApi.getItembasicPage |
|
|
//} |
|
|
//} |
|
|
]) |
|
|
]) |
|
|
|
|
|
|
|
|
const { tableObject, tableMethods } = useTable({ |
|
|
const { tableObject, tableMethods } = useTable({ |
|
@ -108,8 +113,7 @@ const { tableObject, tableMethods } = useTable({ |
|
|
}) |
|
|
}) |
|
|
|
|
|
|
|
|
// 获得表格的各种操作 |
|
|
// 获得表格的各种操作 |
|
|
const {getList, setSearchParams } = tableMethods |
|
|
const { getList, setSearchParams } = tableMethods |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 列表头部按钮 |
|
|
// 列表头部按钮 |
|
|
const HeadButttondata = [ |
|
|
const HeadButttondata = [ |
|
@ -118,7 +122,7 @@ const HeadButttondata = [ |
|
|
// defaultButtons.defaultExportBtn(null), // 导出 |
|
|
// defaultButtons.defaultExportBtn(null), // 导出 |
|
|
defaultButtons.defaultFreshBtn(null), // 刷新 |
|
|
defaultButtons.defaultFreshBtn(null), // 刷新 |
|
|
// defaultButtons.defaultFilterBtn(null), // 筛选 |
|
|
// defaultButtons.defaultFilterBtn(null), // 筛选 |
|
|
defaultButtons.defaultSetBtn(null), // 设置 |
|
|
defaultButtons.defaultSetBtn(null) // 设置 |
|
|
// { |
|
|
// { |
|
|
// label: '自定义扩展按钮', |
|
|
// label: '自定义扩展按钮', |
|
|
// name: 'zdy', |
|
|
// name: 'zdy', |
|
@ -131,16 +135,22 @@ const HeadButttondata = [ |
|
|
|
|
|
|
|
|
// 头部按钮事件 |
|
|
// 头部按钮事件 |
|
|
const buttonBaseClick = (val, item) => { |
|
|
const buttonBaseClick = (val, item) => { |
|
|
if (val == 'add') { // 新增 |
|
|
if (val == 'add') { |
|
|
|
|
|
// 新增 |
|
|
openForm('create') |
|
|
openForm('create') |
|
|
} else if (val == 'import') { // 导入 |
|
|
} else if (val == 'import') { |
|
|
|
|
|
// 导入 |
|
|
handleImport() |
|
|
handleImport() |
|
|
} else if (val == 'export') { // 导出 |
|
|
} else if (val == 'export') { |
|
|
|
|
|
// 导出 |
|
|
handleExport() |
|
|
handleExport() |
|
|
} else if (val == 'refresh') { // 刷新 |
|
|
} else if (val == 'refresh') { |
|
|
|
|
|
// 刷新 |
|
|
getList() |
|
|
getList() |
|
|
} else if (val == 'filtrate') { // 筛选 |
|
|
} else if (val == 'filtrate') { |
|
|
} else { // 其他按钮 |
|
|
// 筛选 |
|
|
|
|
|
} else { |
|
|
|
|
|
// 其他按钮 |
|
|
console.log('其他按钮', item) |
|
|
console.log('其他按钮', item) |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
@ -148,14 +158,16 @@ const buttonBaseClick = (val, item) => { |
|
|
// 列表-操作按钮 |
|
|
// 列表-操作按钮 |
|
|
const butttondata = [ |
|
|
const butttondata = [ |
|
|
defaultButtons.mainListEditBtn(null), // 编辑 |
|
|
defaultButtons.mainListEditBtn(null), // 编辑 |
|
|
defaultButtons.mainListDeleteBtn(null), // 删除 |
|
|
defaultButtons.mainListDeleteBtn(null) // 删除 |
|
|
] |
|
|
] |
|
|
|
|
|
|
|
|
// 列表-操作按钮事件 |
|
|
// 列表-操作按钮事件 |
|
|
const buttonTableClick = async (val, row) => { |
|
|
const buttonTableClick = async (val, row) => { |
|
|
if (val == 'edit') { // 编辑 |
|
|
if (val == 'edit') { |
|
|
|
|
|
// 编辑 |
|
|
openForm('update', row) |
|
|
openForm('update', row) |
|
|
} else if (val == 'delete') { // 删除 |
|
|
} else if (val == 'delete') { |
|
|
|
|
|
// 删除 |
|
|
handleDelete(row.id) |
|
|
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(() => { |
|
|
// nextTick(() => { |
|
|
// const setV = {} |
|
|
// const setV = {} |
|
|
// setV[formField] = val[0][searchField] |
|
|
// setV[formField] = val[0][searchField] |
|
@ -200,7 +212,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(() => { |
|
|
// nextTick(() => { |
|
|
// const setV = {} |
|
|
// const setV = {} |
|
|
// setV[formField] = val[0][searchField] |
|
|
// setV[formField] = val[0][searchField] |
|
@ -231,27 +243,27 @@ const searchTableSuccessDetail = (formField, searchField, val, formRef,type,row) |
|
|
}) |
|
|
}) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
const formsSuccess = async (formType,data) => { |
|
|
const formsSuccess = async (formType, data) => { |
|
|
var isHave =DetectionTemplate.allSchemas.formSchema.some(function (item) { |
|
|
var isHave = DetectionTemplate.allSchemas.formSchema.some(function (item) { |
|
|
return item.field === 'activeTime' || item.field === 'expireTime'; |
|
|
return item.field === 'activeTime' || item.field === 'expireTime' |
|
|
}); |
|
|
}) |
|
|
if(isHave){ |
|
|
if (isHave) { |
|
|
if(data.activeTime && data.expireTime && data.activeTime >=data.expireTime){ |
|
|
if (data.activeTime && data.expireTime && data.activeTime >= data.expireTime) { |
|
|
message.error('失效时间要大于生效时间') |
|
|
message.error('失效时间要大于生效时间') |
|
|
return; |
|
|
return |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
if(data.activeTime==0)data.activeTime = null; |
|
|
if (data.activeTime == 0) data.activeTime = null |
|
|
if(data.expireTime==0)data.expireTime = null; |
|
|
if (data.expireTime == 0) data.expireTime = null |
|
|
if (formType === 'create') { |
|
|
if (formType === 'create') { |
|
|
await DetectionTemplateApi.createDetectionTemplate(data) |
|
|
await DetectionTemplateApi.createDetectionTemplate(data) |
|
|
message.success(t('common.createSuccess')) |
|
|
message.success(t('common.createSuccess')) |
|
|
} else { |
|
|
} else { |
|
|
await DetectionTemplateApi.updateDetectionTemplate(data) |
|
|
await DetectionTemplateApi.updateDetectionTemplate(data) |
|
|
message.success(t('common.updateSuccess')) |
|
|
message.success(t('common.updateSuccess')) |
|
|
} |
|
|
} |
|
|
basicFormRef.value.dialogVisible = false |
|
|
basicFormRef.value.dialogVisible = false |
|
|
getList() |
|
|
getList() |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/** 详情操作 */ |
|
|
/** 详情操作 */ |
|
@ -315,11 +327,22 @@ const searchFormClick = (searchData) => { |
|
|
} |
|
|
} |
|
|
getList() // 刷新当前列表 |
|
|
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 () => { |
|
|
onMounted(async () => { |
|
|
getList() |
|
|
getList() |
|
|
//importTemplateData.templateUrl = await DetectionTemplateApi.importTemplate() |
|
|
//importTemplateData.templateUrl = await DetectionTemplateApi.importTemplate() |
|
|
}) |
|
|
}) |
|
|
|
|
|
|
|
|
</script> |
|
|
</script> |
|
|