|
|
@ -4,64 +4,48 @@ |
|
|
|
<Search :schema="DeviceInspectionMain.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" /> |
|
|
|
</ContentWrap> |
|
|
|
|
|
|
|
<!-- 列表头部 --> |
|
|
|
<TableHead |
|
|
|
:HeadButttondata="HeadButttondata" |
|
|
|
@button-base-click="buttonBaseClick" |
|
|
|
:routeName="routeName" |
|
|
|
@updataTableColumns="updataTableColumns" |
|
|
|
@searchFormClick="searchFormClick" |
|
|
|
:allSchemas="DeviceInspectionMain.allSchemas" |
|
|
|
/> |
|
|
|
<!-- 列表头部 --> |
|
|
|
<TableHead :HeadButttondata="HeadButttondata" @button-base-click="buttonBaseClick" :routeName="routeName" |
|
|
|
@updataTableColumns="updataTableColumns" @searchFormClick="searchFormClick" |
|
|
|
:allSchemas="DeviceInspectionMain.allSchemas" /> |
|
|
|
|
|
|
|
<!-- 列表 --> |
|
|
|
<ContentWrap> |
|
|
|
<Table |
|
|
|
:columns="tableColumns" |
|
|
|
:data="tableObject.tableList" |
|
|
|
:loading="tableObject.loading" |
|
|
|
:pagination="{ |
|
|
|
total: tableObject.total |
|
|
|
}" |
|
|
|
v-model:pageSize="tableObject.pageSize" |
|
|
|
v-model:currentPage="tableObject.currentPage" |
|
|
|
v-model:sort="tableObject.sort" |
|
|
|
> |
|
|
|
<template #code="{row}"> |
|
|
|
<Table :columns="tableColumns" :data="tableObject.tableList" :loading="tableObject.loading" :pagination="{ |
|
|
|
total: tableObject.total |
|
|
|
}" v-model:pageSize="tableObject.pageSize" v-model:currentPage="tableObject.currentPage" |
|
|
|
v-model:sort="tableObject.sort"> |
|
|
|
<template #code="{ row }"> |
|
|
|
<el-button type="primary" link @click="openDetail(row, '代码', row.code)"> |
|
|
|
<span>{{ row.code }}</span> |
|
|
|
</el-button> |
|
|
|
</template> |
|
|
|
<template #action="{ row }"> |
|
|
|
<ButtonBase :Butttondata="butttondata" @button-base-click="buttonTableClick($event,row)" /> |
|
|
|
<ButtonBase :Butttondata="butttondata(row)" @button-base-click="buttonTableClick($event, row)" /> |
|
|
|
</template> |
|
|
|
</Table> |
|
|
|
</ContentWrap> |
|
|
|
|
|
|
|
<!-- 表单弹窗:添加/修改 --> |
|
|
|
<BasicForm |
|
|
|
ref="basicFormRef" |
|
|
|
@success="formsSuccess" |
|
|
|
:rules="DeviceInspectionMainRules" |
|
|
|
:formAllSchemas="DeviceInspectionMain.allSchemas" |
|
|
|
:apiUpdate="DeviceInspectionMainApi.updateDeviceInspectionMain" |
|
|
|
:apiCreate="DeviceInspectionMainApi.createDeviceInspectionMain" |
|
|
|
@searchTableSuccess="searchTableSuccess" |
|
|
|
:isBusiness="false" |
|
|
|
/> |
|
|
|
<BasicForm ref="basicFormRef" @success="formsSuccess" :rules="DeviceInspectionMainRules" |
|
|
|
:formAllSchemas="DeviceInspectionMain.allSchemas" :apiUpdate="DeviceInspectionMainApi.updateDeviceInspectionMain" |
|
|
|
:apiCreate="DeviceInspectionMainApi.createDeviceInspectionMain" @searchTableSuccess="searchTableSuccess" |
|
|
|
:isBusiness="false" /> |
|
|
|
|
|
|
|
<!-- 详情 --> |
|
|
|
<Detail ref="detailRef" :isBasic="true" :allSchemas="DeviceInspectionMain.allSchemas" /> |
|
|
|
|
|
|
|
<!-- 导入 --> |
|
|
|
<ImportForm ref="importFormRef" url="/eam/device-inspection-main/import" :importTemplateData="importTemplateData" @success="importSuccess" /> |
|
|
|
<ImportForm ref="importFormRef" url="/eam/device-inspection-main/import" :importTemplateData="importTemplateData" |
|
|
|
@success="importSuccess" /> |
|
|
|
</template> |
|
|
|
|
|
|
|
<script setup lang="ts"> |
|
|
|
import download from '@/utils/download' |
|
|
|
import { DeviceInspectionMain,DeviceInspectionMainRules } from './deviceInspectionMain.data' |
|
|
|
import { DeviceInspectionMain, DeviceInspectionMainRules } from './deviceInspectionMain.data' |
|
|
|
import * as DeviceInspectionMainApi from '@/api/eam/device/deviceInspectionMain' |
|
|
|
import * as defaultButtons from '@/utils/disposition/defaultButtons' |
|
|
|
import { useUserStore } from '@/store/modules/user' |
|
|
|
// import TableHead from '@/components/TableHead/src/TableHead.vue' |
|
|
|
// import ImportForm from '@/components/ImportForm/src/ImportForm.vue' |
|
|
|
// import Detail from '@/components/Detail/src/Detail.vue' |
|
|
@ -70,7 +54,7 @@ defineOptions({ name: 'DeviceInspectionMain' }) |
|
|
|
|
|
|
|
const message = useMessage() // 消息弹窗 |
|
|
|
const { t } = useI18n() // 国际化 |
|
|
|
|
|
|
|
const userStore = useUserStore() // 用户信息 |
|
|
|
const route = useRoute() // 路由信息 |
|
|
|
const routeName = ref() |
|
|
|
routeName.value = route.name |
|
|
@ -99,12 +83,14 @@ const { getList, setSearchParams } = tableMethods |
|
|
|
|
|
|
|
// 列表头部按钮 |
|
|
|
const HeadButttondata = [ |
|
|
|
defaultButtons.defaultAddBtn({hasPermi:'eam:deviceInspectionMain:create'}), // 新增 |
|
|
|
defaultButtons.defaultImportBtn({hasPermi:'eam:deviceInspectionMain:import'}), // 导入 |
|
|
|
defaultButtons.defaultExportBtn({hasPermi:'eam:deviceInspectionMain:export'}), // 导出 |
|
|
|
// defaultButtons.defaultAddBtn({hasPermi:'eam:deviceInspectionMain:create'}), // 新增 |
|
|
|
// defaultButtons.defaultImportBtn({hasPermi:'eam:deviceInspectionMain:import'}), // 导入 |
|
|
|
// defaultButtons.defaultExportBtn({ hasPermi: 'eam:deviceInspectionMain:export' }), // 导出 |
|
|
|
defaultButtons.defaultAddBtn({ hide: !(userStore?.userSelfInfo?.posts?.some((item) => item.code == 'worker') || userStore?.userSelfInfo?.posts?.some((item) => item.code == 'engineer')) }), // 新增 |
|
|
|
defaultButtons.defaultFreshBtn(null), // 刷新 |
|
|
|
defaultButtons.defaultFilterBtn(null), // 筛选 |
|
|
|
defaultButtons.defaultSetBtn(null), // 设置 |
|
|
|
|
|
|
|
// { |
|
|
|
// label: '自定义扩展按钮', |
|
|
|
// name: 'zdy', |
|
|
@ -132,17 +118,24 @@ const buttonBaseClick = (val, item) => { |
|
|
|
} |
|
|
|
|
|
|
|
// 列表-操作按钮 |
|
|
|
const butttondata = [ |
|
|
|
defaultButtons.mainListEditBtn({hasPermi:'eam:deviceInspectionMain:update'}), // 编辑 |
|
|
|
defaultButtons.mainListDeleteBtn({hasPermi:'eam:deviceInspectionMain:delete'}), // 删除 |
|
|
|
] |
|
|
|
const butttondata = (row) => { |
|
|
|
return [ |
|
|
|
// defaultButtons.mainListEditBtn({hasPermi:'eam:deviceInspectionMain:update'}), // 编辑 |
|
|
|
// defaultButtons.mainListDeleteBtn({hasPermi:'eam:deviceInspectionMain:delete'}), // 删除 |
|
|
|
defaultButtons.mainListEditBtn(null), // 编辑 |
|
|
|
defaultButtons.maintenanceOrderBtn({ hide: !(row.status == 'PROCCED' && (userStore.getUser.id == row.maintenance)) }), //检修 |
|
|
|
defaultButtons.finishOrderBtn({ hide: !(row.status == 'PROCCED' && (userStore.getUser.id == row.maintenance)) }), //完成 |
|
|
|
] |
|
|
|
} |
|
|
|
|
|
|
|
// 列表-操作按钮事件 |
|
|
|
const buttonTableClick = async (val, row) => { |
|
|
|
if (val == 'edit') { // 编辑 |
|
|
|
openForm('update', row) |
|
|
|
} else if (val == 'delete') { // 删除 |
|
|
|
handleDelete(row.id) |
|
|
|
} else if (val == 'maintenanceOrder') { // 检修 |
|
|
|
handleMaintenanceOrder(row) |
|
|
|
} else if (val == 'finishOrder') { // 完成 |
|
|
|
handleFinishOrder(row) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
@ -153,18 +146,18 @@ const openForm = (type: string, row?: any) => { |
|
|
|
} |
|
|
|
|
|
|
|
// form表单提交 |
|
|
|
const formsSuccess = async (formType,data) => { |
|
|
|
var isHave =DeviceInspectionMain.allSchemas.formSchema.some(function (item) { |
|
|
|
const formsSuccess = async (formType, data) => { |
|
|
|
var isHave = DeviceInspectionMain.allSchemas.formSchema.some(function (item) { |
|
|
|
return item.field === 'activeTime' || item.field === 'expireTime'; |
|
|
|
}); |
|
|
|
if(isHave){ |
|
|
|
if(data.activeTime && data.expireTime && data.activeTime >=data.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 (data.activeTime == 0) data.activeTime = null; |
|
|
|
if (data.expireTime == 0) data.expireTime = null; |
|
|
|
if (formType === 'create') { |
|
|
|
await DeviceInspectionMainApi.createDeviceInspectionMain(data) |
|
|
|
message.success(t('common.createSuccess')) |
|
|
@ -192,7 +185,7 @@ const handleDelete = async (id: number) => { |
|
|
|
message.success(t('common.delSuccess')) |
|
|
|
// 刷新列表 |
|
|
|
await getList() |
|
|
|
} catch {} |
|
|
|
} catch { } |
|
|
|
} |
|
|
|
|
|
|
|
/** 导出按钮操作 */ |
|
|
@ -235,6 +228,14 @@ const searchFormClick = (searchData) => { |
|
|
|
getList() // 刷新当前列表 |
|
|
|
} |
|
|
|
|
|
|
|
function handleMaintenanceOrder(row) { |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
function handleFinishOrder(row) { |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
/** 初始化 **/ |
|
|
|
onMounted(async () => { |
|
|
|
getList() |
|
|
|