|
@ -4,29 +4,17 @@ |
|
|
<Search :schema="ReplaceItemDes.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" /> |
|
|
<Search :schema="ReplaceItemDes.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" /> |
|
|
</ContentWrap> |
|
|
</ContentWrap> |
|
|
|
|
|
|
|
|
<!-- 列表头部 --> |
|
|
<!-- 列表头部 --> |
|
|
<TableHead |
|
|
<TableHead :HeadButttondata="HeadButttondata" @button-base-click="buttonBaseClick" :routeName="routeName" |
|
|
:HeadButttondata="HeadButttondata" |
|
|
@updataTableColumns="updataTableColumns" @searchFormClick="searchFormClick" |
|
|
@button-base-click="buttonBaseClick" |
|
|
:allSchemas="ReplaceItemDes.allSchemas" /> |
|
|
:routeName="routeName" |
|
|
|
|
|
@updataTableColumns="updataTableColumns" |
|
|
|
|
|
@searchFormClick="searchFormClick" |
|
|
|
|
|
:allSchemas="ReplaceItemDes.allSchemas" |
|
|
|
|
|
/> |
|
|
|
|
|
|
|
|
|
|
|
<!-- 列表 --> |
|
|
<!-- 列表 --> |
|
|
<ContentWrap> |
|
|
<ContentWrap> |
|
|
<Table |
|
|
<Table :columns="tableColumns" :data="tableObject.tableList" :loading="tableObject.loading" :pagination="{ |
|
|
:columns="tableColumns" |
|
|
|
|
|
:data="tableObject.tableList" |
|
|
|
|
|
:loading="tableObject.loading" |
|
|
|
|
|
:pagination="{ |
|
|
|
|
|
total: tableObject.total |
|
|
total: tableObject.total |
|
|
}" |
|
|
}" v-model:pageSize="tableObject.pageSize" v-model:currentPage="tableObject.currentPage" |
|
|
v-model:pageSize="tableObject.pageSize" |
|
|
v-model:sort="tableObject.sort"> |
|
|
v-model:currentPage="tableObject.currentPage" |
|
|
|
|
|
v-model:sort="tableObject.sort" |
|
|
|
|
|
> |
|
|
|
|
|
<template #code="{row}"> |
|
|
<template #code="{row}"> |
|
|
<el-button type="primary" link @click="openDetail(row, '代码', row.code)"> |
|
|
<el-button type="primary" link @click="openDetail(row, '代码', row.code)"> |
|
|
<span>{{ row.code }}</span> |
|
|
<span>{{ row.code }}</span> |
|
@ -39,201 +27,198 @@ |
|
|
</ContentWrap> |
|
|
</ContentWrap> |
|
|
|
|
|
|
|
|
<!-- 表单弹窗:添加/修改 --> |
|
|
<!-- 表单弹窗:添加/修改 --> |
|
|
<BasicForm |
|
|
<BasicForm ref="basicFormRef" @success="formsSuccess" :rules="ReplaceItemDesRules" |
|
|
ref="basicFormRef" |
|
|
:formAllSchemas="ReplaceItemDes.allSchemas" :apiUpdate="ReplaceItemDesApi.updateReplaceItemDes" |
|
|
@success="formsSuccess" |
|
|
:apiCreate="ReplaceItemDesApi.createReplaceItemDes" @searchTableSuccess="searchTableSuccess" :isBusiness="false" /> |
|
|
:rules="ReplaceItemDesRules" |
|
|
|
|
|
:formAllSchemas="ReplaceItemDes.allSchemas" |
|
|
|
|
|
:apiUpdate="ReplaceItemDesApi.updateReplaceItemDes" |
|
|
|
|
|
:apiCreate="ReplaceItemDesApi.createReplaceItemDes" |
|
|
|
|
|
@searchTableSuccess="searchTableSuccess" |
|
|
|
|
|
:isBusiness="false" |
|
|
|
|
|
/> |
|
|
|
|
|
|
|
|
|
|
|
<!-- 详情 --> |
|
|
<!-- 详情 --> |
|
|
<Detail ref="detailRef" :isBasic="true" :allSchemas="ReplaceItemDes.allSchemas" /> |
|
|
<Detail ref="detailRef" :isBasic="true" :allSchemas="ReplaceItemDes.allSchemas" /> |
|
|
|
|
|
|
|
|
<!-- 导入 --> |
|
|
<!-- 导入 --> |
|
|
<ImportForm ref="importFormRef" url="/eam/item-accounts/import" :importTemplateData="importTemplateData" @success="importSuccess" /> |
|
|
<ImportForm ref="importFormRef" url="/eam/item-accounts/import" :importTemplateData="importTemplateData" |
|
|
|
|
|
@success="importSuccess" /> |
|
|
</template> |
|
|
</template> |
|
|
|
|
|
|
|
|
<script setup lang="ts"> |
|
|
<script setup lang="ts"> |
|
|
import download from '@/utils/download' |
|
|
import download from '@/utils/download' |
|
|
import { ReplaceItemDes,ReplaceItemDesRules } from './replaceItemDes.data' |
|
|
import { ReplaceItemDes, ReplaceItemDesRules } from './replaceItemDes.data' |
|
|
import * as ReplaceItemDesApi from '@/api/eam/item/replaceItemDes' |
|
|
import * as ReplaceItemDesApi from '@/api/eam/item/replaceItemDes' |
|
|
import * as defaultButtons from '@/utils/disposition/defaultButtons' |
|
|
import * as defaultButtons from '@/utils/disposition/defaultButtons' |
|
|
import TableHead from '@/components/TableHead/src/TableHead.vue' |
|
|
import TableHead from '@/components/TableHead/src/TableHead.vue' |
|
|
import ImportForm from '@/components/ImportForm/src/ImportForm.vue' |
|
|
import ImportForm from '@/components/ImportForm/src/ImportForm.vue' |
|
|
import Detail from '@/components/Detail/src/Detail.vue' |
|
|
import Detail from '@/components/Detail/src/Detail.vue' |
|
|
|
|
|
|
|
|
defineOptions({ name: 'ReplaceItemDes' }) |
|
|
defineOptions({ name: 'ReplaceItemDes' }) |
|
|
|
|
|
|
|
|
const message = useMessage() // 消息弹窗 |
|
|
const message = useMessage() // 消息弹窗 |
|
|
const { t } = useI18n() // 国际化 |
|
|
const { t } = useI18n() // 国际化 |
|
|
|
|
|
|
|
|
const route = useRoute() // 路由信息 |
|
|
const route = useRoute() // 路由信息 |
|
|
const routeName = ref() |
|
|
const routeName = ref() |
|
|
routeName.value = route.name |
|
|
routeName.value = route.name |
|
|
const tableColumns = ref(ReplaceItemDes.allSchemas.tableColumns) |
|
|
const tableColumns = ref(ReplaceItemDes.allSchemas.tableColumns) |
|
|
|
|
|
|
|
|
// 查询页面返回 |
|
|
// 查询页面返回 |
|
|
const searchTableSuccess = (formField, searchField, val, formRef) => { |
|
|
const searchTableSuccess = (formField, searchField, val, formRef) => { |
|
|
nextTick(() => { |
|
|
nextTick(() => { |
|
|
const setV = {} |
|
|
const setV = {} |
|
|
setV[formField] = val[0][searchField] |
|
|
setV[formField] = val[0][searchField] |
|
|
formRef.setValues(setV) |
|
|
formRef.setValues(setV) |
|
|
|
|
|
}) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 字段设置 更新主列表字段 |
|
|
|
|
|
const updataTableColumns = (val) => { |
|
|
|
|
|
tableColumns.value = val |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const { tableObject, tableMethods } = useTable({ |
|
|
|
|
|
getListApi: ReplaceItemDesApi.getReplaceItemDesPage // 分页接口 |
|
|
}) |
|
|
}) |
|
|
} |
|
|
|
|
|
|
|
|
// 获得表格的各种操作 |
|
|
// 字段设置 更新主列表字段 |
|
|
const { getList, setSearchParams } = tableMethods |
|
|
const updataTableColumns = (val) => { |
|
|
|
|
|
tableColumns.value = val |
|
|
// 列表头部按钮 |
|
|
} |
|
|
const HeadButttondata = [ |
|
|
|
|
|
defaultButtons.defaultAddBtn(null), // 新增 |
|
|
const { tableObject, tableMethods } = useTable({ |
|
|
// { |
|
|
getListApi: ReplaceItemDesApi.getReplaceItemDesPage // 分页接口 |
|
|
// label: '自定义扩展按钮', |
|
|
}) |
|
|
// name: 'zdy', |
|
|
|
|
|
// hide: false, |
|
|
// 获得表格的各种操作 |
|
|
// type: 'primary', |
|
|
const { getList, setSearchParams } = tableMethods |
|
|
// icon: 'Select', |
|
|
|
|
|
// color: '' |
|
|
// 列表头部按钮 |
|
|
// }, |
|
|
const HeadButttondata = [ |
|
|
] |
|
|
defaultButtons.defaultAddBtn(null), // 新增 |
|
|
|
|
|
// { |
|
|
// 头部按钮事件 |
|
|
// label: '自定义扩展按钮', |
|
|
const buttonBaseClick = (val, item) => { |
|
|
// name: 'zdy', |
|
|
if (val == 'add') { // 新增 |
|
|
// hide: false, |
|
|
openForm('create') |
|
|
// type: 'primary', |
|
|
} else if (val == 'import') { // 导入 |
|
|
// icon: 'Select', |
|
|
handleImport() |
|
|
// color: '' |
|
|
} else if (val == 'export') { // 导出 |
|
|
// }, |
|
|
handleExport() |
|
|
] |
|
|
} else if (val == 'refresh') { // 刷新 |
|
|
|
|
|
getList() |
|
|
// 头部按钮事件 |
|
|
} else if (val == 'filtrate') { // 筛选 |
|
|
const buttonBaseClick = (val, item) => { |
|
|
} else { // 其他按钮 |
|
|
if (val == 'add') { // 新增 |
|
|
console.log('其他按钮', item) |
|
|
openForm('create') |
|
|
} |
|
|
} else if (val == 'import') { // 导入 |
|
|
|
|
|
handleImport() |
|
|
|
|
|
} else if (val == 'export') { // 导出 |
|
|
|
|
|
handleExport() |
|
|
|
|
|
} else if (val == 'refresh') { // 刷新 |
|
|
|
|
|
getList() |
|
|
|
|
|
} else if (val == 'filtrate') { // 筛选 |
|
|
|
|
|
} else { // 其他按钮 |
|
|
|
|
|
console.log('其他按钮', 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) |
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** 添加/修改操作 */ |
|
|
|
|
|
const basicFormRef = ref() |
|
|
|
|
|
const openForm = (type : string, row ?: any) => { |
|
|
|
|
|
basicFormRef.value.open(type, row) |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// form表单提交 |
|
|
/** 添加/修改操作 */ |
|
|
const formsSuccess = async (formType, data) => { |
|
|
const basicFormRef = ref() |
|
|
var isHave = ReplaceItemDes.allSchemas.formSchema.some(function (item) { |
|
|
const openForm = (type: string, row?: any) => { |
|
|
return item.field === 'activeTime' || item.field === 'expireTime'; |
|
|
basicFormRef.value.open(type, row) |
|
|
}); |
|
|
} |
|
|
if (isHave) { |
|
|
|
|
|
if (data.activeTime && data.expireTime && data.activeTime >= data.expireTime) { |
|
|
// form表单提交 |
|
|
message.error('失效时间要大于生效时间') |
|
|
const formsSuccess = async (formType,data) => { |
|
|
return; |
|
|
var isHave =ReplaceItemDes.allSchemas.formSchema.some(function (item) { |
|
|
} |
|
|
return item.field === 'activeTime' || item.field === 'expireTime'; |
|
|
} |
|
|
}); |
|
|
if (data.activeTime == 0) data.activeTime = null; |
|
|
if(isHave){ |
|
|
if (data.expireTime == 0) data.expireTime = null; |
|
|
if(data.activeTime && data.expireTime && data.activeTime >=data.expireTime){ |
|
|
data.filePathList=[]; |
|
|
message.error('失效时间要大于生效时间') |
|
|
for (let i = 0; i < data.filePathListView.length; i++) { |
|
|
return; |
|
|
data.filePathList.push(data.filePathListView[i].url); |
|
|
|
|
|
} |
|
|
|
|
|
if (formType === 'create') { |
|
|
|
|
|
await ReplaceItemDesApi.createReplaceItemDes(data) |
|
|
|
|
|
message.success(t('common.createSuccess')) |
|
|
|
|
|
} else { |
|
|
|
|
|
await ReplaceItemDesApi.createReplaceItemDes(data) |
|
|
|
|
|
message.success(t('common.updateSuccess')) |
|
|
} |
|
|
} |
|
|
|
|
|
basicFormRef.value.dialogVisible = false |
|
|
|
|
|
getList() |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** 详情操作 */ |
|
|
|
|
|
const detailRef = ref() |
|
|
|
|
|
const openDetail = (row : any, titleName : any, titleValue : any) => { |
|
|
|
|
|
detailRef.value.openDetail(row, titleName, titleValue, 'basicReplaceItemDes') |
|
|
} |
|
|
} |
|
|
if(data.activeTime==0)data.activeTime = null; |
|
|
|
|
|
if(data.expireTime==0)data.expireTime = null; |
|
|
/** 删除按钮操作 */ |
|
|
if (formType === 'create') { |
|
|
const handleDelete = async (id : number) => { |
|
|
await ReplaceItemDesApi.createReplaceItemDes(data) |
|
|
try { |
|
|
message.success(t('common.createSuccess')) |
|
|
// 删除的二次确认 |
|
|
} else { |
|
|
await message.delConfirm() |
|
|
await ReplaceItemDesApi.updateReplaceItemDes(data) |
|
|
// 发起删除 |
|
|
message.success(t('common.updateSuccess')) |
|
|
await ReplaceItemDesApi.deleteReplaceItemDes(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 ReplaceItemDesApi.exportReplaceItemDes(tableObject.params) |
|
|
|
|
|
download.excel(data, '备件台账.xlsx') |
|
|
|
|
|
} catch { |
|
|
|
|
|
} finally { |
|
|
|
|
|
exportLoading.value = false |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
basicFormRef.value.dialogVisible = false |
|
|
|
|
|
getList() |
|
|
/** 导入 */ |
|
|
} |
|
|
const importFormRef = ref() |
|
|
|
|
|
const handleImport = () => { |
|
|
/** 详情操作 */ |
|
|
importFormRef.value.open() |
|
|
const detailRef = ref() |
|
|
|
|
|
const openDetail = (row: any, titleName: any, titleValue: any) => { |
|
|
|
|
|
detailRef.value.openDetail(row, titleName, titleValue, 'basicReplaceItemDes') |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** 删除按钮操作 */ |
|
|
|
|
|
const handleDelete = async (id: number) => { |
|
|
|
|
|
try { |
|
|
|
|
|
// 删除的二次确认 |
|
|
|
|
|
await message.delConfirm() |
|
|
|
|
|
// 发起删除 |
|
|
|
|
|
await ReplaceItemDesApi.deleteReplaceItemDes(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 ReplaceItemDesApi.exportReplaceItemDes(tableObject.params) |
|
|
|
|
|
download.excel(data, '备件台账.xlsx') |
|
|
|
|
|
} catch { |
|
|
|
|
|
} finally { |
|
|
|
|
|
exportLoading.value = false |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
// 导入附件弹窗所需的参数 |
|
|
|
|
|
const importTemplateData = reactive({ |
|
|
/** 导入 */ |
|
|
templateUrl: '', |
|
|
const importFormRef = ref() |
|
|
templateTitle: '备件台账导入模版.xlsx' |
|
|
const handleImport = () => { |
|
|
}) |
|
|
importFormRef.value.open() |
|
|
// 导入成功之后 |
|
|
} |
|
|
const importSuccess = () => { |
|
|
// 导入附件弹窗所需的参数 |
|
|
getList() |
|
|
const importTemplateData = reactive({ |
|
|
|
|
|
templateUrl: '', |
|
|
|
|
|
templateTitle: '备件台账导入模版.xlsx' |
|
|
|
|
|
}) |
|
|
|
|
|
// 导入成功之后 |
|
|
|
|
|
const importSuccess = () => { |
|
|
|
|
|
getList() |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 筛选提交 |
|
|
|
|
|
const searchFormClick = (searchData) => { |
|
|
|
|
|
tableObject.params = { |
|
|
|
|
|
isSearch: true, |
|
|
|
|
|
filters: searchData.filters |
|
|
|
|
|
} |
|
|
} |
|
|
getList() // 刷新当前列表 |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** 初始化 **/ |
|
|
// 筛选提交 |
|
|
onMounted(async () => { |
|
|
const searchFormClick = (searchData) => { |
|
|
getList() |
|
|
tableObject.params = { |
|
|
importTemplateData.templateUrl = await ReplaceItemDesApi.importTemplate() |
|
|
isSearch: true, |
|
|
}) |
|
|
filters: searchData.filters |
|
|
|
|
|
} |
|
|
|
|
|
getList() // 刷新当前列表 |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** 初始化 **/ |
|
|
|
|
|
onMounted(async () => { |
|
|
|
|
|
getList() |
|
|
|
|
|
importTemplateData.templateUrl = await ReplaceItemDesApi.importTemplate() |
|
|
|
|
|
}) |
|
|
</script> |
|
|
</script> |
|
|