songguoqiang
10 months ago
21 changed files with 2882 additions and 0 deletions
@ -0,0 +1,52 @@ |
|||
import request from '@/config/axios' |
|||
|
|||
export interface ItemAccountsVO { |
|||
itemNumber: string |
|||
qty: number |
|||
areaNumber: string |
|||
isInAccount: string |
|||
siteId: string |
|||
available: string |
|||
concurrencyStamp: number |
|||
} |
|||
|
|||
// 查询备件台账列表
|
|||
export const getItemAccountsPage = async (params) => { |
|||
if (params.isSearch) { |
|||
delete params.isSearch |
|||
const data = {...params} |
|||
return await request.post({ url: '/eam/item-accounts/senior', data }) |
|||
} else { |
|||
return await request.get({ url: `/eam/item-accounts/page`, params }) |
|||
} |
|||
} |
|||
|
|||
// 查询备件台账详情
|
|||
export const getItemAccounts = async (id: number) => { |
|||
return await request.get({ url: `/eam/item-accounts/get?id=` + id }) |
|||
} |
|||
|
|||
// 新增备件台账
|
|||
export const createItemAccounts = async (data: ItemAccountsVO) => { |
|||
return await request.post({ url: `/eam/item-accounts/create`, data }) |
|||
} |
|||
|
|||
// 修改备件台账
|
|||
export const updateItemAccounts = async (data: ItemAccountsVO) => { |
|||
return await request.put({ url: `/eam/item-accounts/update`, data }) |
|||
} |
|||
|
|||
// 删除备件台账
|
|||
export const deleteItemAccounts = async (id: number) => { |
|||
return await request.delete({ url: `/eam/item-accounts/delete?id=` + id }) |
|||
} |
|||
|
|||
// 导出备件台账 Excel
|
|||
export const exportItemAccounts = async (params) => { |
|||
return await request.download({ url: `/eam/item-accounts/export-excel`, params }) |
|||
} |
|||
|
|||
// 下载用户导入模板
|
|||
export const importTemplate = () => { |
|||
return request.download({ url: '/eam/item-accounts/get-import-template' }) |
|||
} |
@ -0,0 +1,57 @@ |
|||
import request from '@/config/axios' |
|||
|
|||
export interface ItemApplyMainVO { |
|||
number: string |
|||
name: string |
|||
type: string |
|||
applyId: number |
|||
applyDeptId: number |
|||
approveId: number |
|||
approveTime: Date |
|||
outId: number |
|||
outTime: Date |
|||
siteId: string |
|||
available: string |
|||
concurrencyStamp: number |
|||
} |
|||
|
|||
// 查询备件申领记录主列表
|
|||
export const getItemApplyMainPage = async (params) => { |
|||
if (params.isSearch) { |
|||
delete params.isSearch |
|||
const data = {...params} |
|||
return await request.post({ url: '/eam/item-apply-main/senior', data }) |
|||
} else { |
|||
return await request.get({ url: `/eam/item-apply-main/page`, params }) |
|||
} |
|||
} |
|||
|
|||
// 查询备件申领记录主详情
|
|||
export const getItemApplyMain = async (id: number) => { |
|||
return await request.get({ url: `/eam/item-apply-main/get?id=` + id }) |
|||
} |
|||
|
|||
// 新增备件申领记录主
|
|||
export const createItemApplyMain = async (data: ItemApplyMainVO) => { |
|||
return await request.post({ url: `/eam/item-apply-main/create`, data }) |
|||
} |
|||
|
|||
// 修改备件申领记录主
|
|||
export const updateItemApplyMain = async (data: ItemApplyMainVO) => { |
|||
return await request.put({ url: `/eam/item-apply-main/update`, data }) |
|||
} |
|||
|
|||
// 删除备件申领记录主
|
|||
export const deleteItemApplyMain = async (id: number) => { |
|||
return await request.delete({ url: `/eam/item-apply-main/delete?id=` + id }) |
|||
} |
|||
|
|||
// 导出备件申领记录主 Excel
|
|||
export const exportItemApplyMain = async (params) => { |
|||
return await request.download({ url: `/eam/item-apply-main/export-excel`, params }) |
|||
} |
|||
|
|||
// 下载用户导入模板
|
|||
export const importTemplate = () => { |
|||
return request.download({ url: '/eam/item-apply-main/get-import-template' }) |
|||
} |
@ -0,0 +1,56 @@ |
|||
import request from '@/config/axios' |
|||
|
|||
export interface ItemLocationInRecordVO { |
|||
itemNumber: string |
|||
locationNumber: string |
|||
transactionType: string |
|||
inventoryAction: string |
|||
businessType: string |
|||
inventoryStatus: string |
|||
uom: string |
|||
qty: number |
|||
siteId: string |
|||
available: string |
|||
concurrencyStamp: number |
|||
} |
|||
|
|||
// 查询备件库存记录列表
|
|||
export const getItemLocationInRecordPage = async (params) => { |
|||
if (params.isSearch) { |
|||
delete params.isSearch |
|||
const data = {...params} |
|||
return await request.post({ url: '/eam/item-location-record/senior', data }) |
|||
} else { |
|||
return await request.get({ url: `/eam/item-location-record/page`, params }) |
|||
} |
|||
} |
|||
|
|||
// 查询备件库存记录详情
|
|||
export const getItemLocationInRecord = async (id: number) => { |
|||
return await request.get({ url: `/eam/item-location-record/get?id=` + id }) |
|||
} |
|||
|
|||
// 新增备件库存记录
|
|||
export const createItemLocationInRecord = async (data: ItemLocationInRecordVO) => { |
|||
return await request.post({ url: `/eam/item-location-record/create`, data }) |
|||
} |
|||
|
|||
// 修改备件库存记录
|
|||
export const updateItemLocationInRecord = async (data: ItemLocationInRecordVO) => { |
|||
return await request.put({ url: `/eam/item-location-record/update`, data }) |
|||
} |
|||
|
|||
// 删除备件库存记录
|
|||
export const deleteItemLocationInRecord = async (id: number) => { |
|||
return await request.delete({ url: `/eam/item-location-record/delete?id=` + id }) |
|||
} |
|||
|
|||
// 导出备件库存记录 Excel
|
|||
export const exportItemLocationInRecord = async (params) => { |
|||
return await request.download({ url: `/eam/item-location-record/export-excel`, params }) |
|||
} |
|||
|
|||
// 下载用户导入模板
|
|||
export const importTemplate = () => { |
|||
return request.download({ url: '/eam/item-location-record/get-import-template' }) |
|||
} |
@ -0,0 +1,56 @@ |
|||
import request from '@/config/axios' |
|||
|
|||
export interface ItemLocationOutRecordVO { |
|||
itemNumber: string |
|||
locationNumber: string |
|||
transactionType: string |
|||
inventoryAction: string |
|||
businessType: string |
|||
inventoryStatus: string |
|||
uom: string |
|||
qty: number |
|||
siteId: string |
|||
available: string |
|||
concurrencyStamp: number |
|||
} |
|||
|
|||
// 查询备件库存记录列表
|
|||
export const getItemLocationOutRecordPage = async (params) => { |
|||
if (params.isSearch) { |
|||
delete params.isSearch |
|||
const data = {...params} |
|||
return await request.post({ url: '/eam/item-location-record/senior', data }) |
|||
} else { |
|||
return await request.get({ url: `/eam/item-location-record/page`, params }) |
|||
} |
|||
} |
|||
|
|||
// 查询备件库存记录详情
|
|||
export const getItemLocationOutRecord = async (id: number) => { |
|||
return await request.get({ url: `/eam/item-location-record/get?id=` + id }) |
|||
} |
|||
|
|||
// 新增备件库存记录
|
|||
export const createItemLocationOutRecord = async (data: ItemLocationOutRecordVO) => { |
|||
return await request.post({ url: `/eam/item-location-record/create`, data }) |
|||
} |
|||
|
|||
// 修改备件库存记录
|
|||
export const updateItemLocationOutRecord = async (data: ItemLocationOutRecordVO) => { |
|||
return await request.put({ url: `/eam/item-location-record/update`, data }) |
|||
} |
|||
|
|||
// 删除备件库存记录
|
|||
export const deleteItemLocationOutRecord = async (id: number) => { |
|||
return await request.delete({ url: `/eam/item-location-record/delete?id=` + id }) |
|||
} |
|||
|
|||
// 导出备件库存记录 Excel
|
|||
export const exportItemLocationOutRecord = async (params) => { |
|||
return await request.download({ url: `/eam/item-location-record/export-excel`, params }) |
|||
} |
|||
|
|||
// 下载用户导入模板
|
|||
export const importTemplate = () => { |
|||
return request.download({ url: '/eam/item-location-record/get-import-template' }) |
|||
} |
@ -0,0 +1,56 @@ |
|||
import request from '@/config/axios' |
|||
|
|||
export interface ItemLocationRecordVO { |
|||
itemNumber: string |
|||
locationNumber: string |
|||
transactionType: string |
|||
inventoryAction: string |
|||
businessType: string |
|||
inventoryStatus: string |
|||
uom: string |
|||
qty: number |
|||
siteId: string |
|||
available: string |
|||
concurrencyStamp: number |
|||
} |
|||
|
|||
// 查询备件库存记录列表
|
|||
export const getItemLocationRecordPage = async (params) => { |
|||
if (params.isSearch) { |
|||
delete params.isSearch |
|||
const data = {...params} |
|||
return await request.post({ url: '/eam/item-location-record/senior', data }) |
|||
} else { |
|||
return await request.get({ url: `/eam/item-location-record/page`, params }) |
|||
} |
|||
} |
|||
|
|||
// 查询备件库存记录详情
|
|||
export const getItemLocationRecord = async (id: number) => { |
|||
return await request.get({ url: `/eam/item-location-record/get?id=` + id }) |
|||
} |
|||
|
|||
// 新增备件库存记录
|
|||
export const createItemLocationRecord = async (data: ItemLocationRecordVO) => { |
|||
return await request.post({ url: `/eam/item-location-record/create`, data }) |
|||
} |
|||
|
|||
// 修改备件库存记录
|
|||
export const updateItemLocationRecord = async (data: ItemLocationRecordVO) => { |
|||
return await request.put({ url: `/eam/item-location-record/update`, data }) |
|||
} |
|||
|
|||
// 删除备件库存记录
|
|||
export const deleteItemLocationRecord = async (id: number) => { |
|||
return await request.delete({ url: `/eam/item-location-record/delete?id=` + id }) |
|||
} |
|||
|
|||
// 导出备件库存记录 Excel
|
|||
export const exportItemLocationRecord = async (params) => { |
|||
return await request.download({ url: `/eam/item-location-record/export-excel`, params }) |
|||
} |
|||
|
|||
// 下载用户导入模板
|
|||
export const importTemplate = () => { |
|||
return request.download({ url: '/eam/item-location-record/get-import-template' }) |
|||
} |
@ -0,0 +1,52 @@ |
|||
import request from '@/config/axios' |
|||
|
|||
export interface ItemMaintenanceVO { |
|||
number: string |
|||
itemNumber: string |
|||
qty: number |
|||
result: string |
|||
siteId: string |
|||
available: string |
|||
concurrencyStamp: number |
|||
} |
|||
|
|||
// 查询备件维修记录列表
|
|||
export const getItemMaintenancePage = async (params) => { |
|||
if (params.isSearch) { |
|||
delete params.isSearch |
|||
const data = {...params} |
|||
return await request.post({ url: '/eam/item-maintenance/senior', data }) |
|||
} else { |
|||
return await request.get({ url: `/eam/item-maintenance/page`, params }) |
|||
} |
|||
} |
|||
|
|||
// 查询备件维修记录详情
|
|||
export const getItemMaintenance = async (id: number) => { |
|||
return await request.get({ url: `/eam/item-maintenance/get?id=` + id }) |
|||
} |
|||
|
|||
// 新增备件维修记录
|
|||
export const createItemMaintenance = async (data: ItemMaintenanceVO) => { |
|||
return await request.post({ url: `/eam/item-maintenance/create`, data }) |
|||
} |
|||
|
|||
// 修改备件维修记录
|
|||
export const updateItemMaintenance = async (data: ItemMaintenanceVO) => { |
|||
return await request.put({ url: `/eam/item-maintenance/update`, data }) |
|||
} |
|||
|
|||
// 删除备件维修记录
|
|||
export const deleteItemMaintenance = async (id: number) => { |
|||
return await request.delete({ url: `/eam/item-maintenance/delete?id=` + id }) |
|||
} |
|||
|
|||
// 导出备件维修记录 Excel
|
|||
export const exportItemMaintenance = async (params) => { |
|||
return await request.download({ url: `/eam/item-maintenance/export-excel`, params }) |
|||
} |
|||
|
|||
// 下载用户导入模板
|
|||
export const importTemplate = () => { |
|||
return request.download({ url: '/eam/item-maintenance/get-import-template' }) |
|||
} |
@ -0,0 +1,65 @@ |
|||
import request from '@/config/axios' |
|||
|
|||
export interface ItemOrderMainVO { |
|||
number: string |
|||
date: string |
|||
phone: string |
|||
fax: string |
|||
purchaser: string |
|||
supplierNumber: string |
|||
supplierName: string |
|||
supplierAddress: string |
|||
shipTo: string |
|||
invoiceTo: string |
|||
contacts: string |
|||
contactsPhone: string |
|||
paymentType: string |
|||
registLocation: string |
|||
bank: string |
|||
account: string |
|||
dutyParagraph: string |
|||
siteId: string |
|||
available: string |
|||
concurrencyStamp: number |
|||
} |
|||
|
|||
// 查询备件采购订单主列表
|
|||
export const getItemOrderMainPage = async (params) => { |
|||
if (params.isSearch) { |
|||
delete params.isSearch |
|||
const data = {...params} |
|||
return await request.post({ url: '/eam/item-order-main/senior', data }) |
|||
} else { |
|||
return await request.get({ url: `/eam/item-order-main/page`, params }) |
|||
} |
|||
} |
|||
|
|||
// 查询备件采购订单主详情
|
|||
export const getItemOrderMain = async (id: number) => { |
|||
return await request.get({ url: `/eam/item-order-main/get?id=` + id }) |
|||
} |
|||
|
|||
// 新增备件采购订单主
|
|||
export const createItemOrderMain = async (data: ItemOrderMainVO) => { |
|||
return await request.post({ url: `/eam/item-order-main/create`, data }) |
|||
} |
|||
|
|||
// 修改备件采购订单主
|
|||
export const updateItemOrderMain = async (data: ItemOrderMainVO) => { |
|||
return await request.put({ url: `/eam/item-order-main/update`, data }) |
|||
} |
|||
|
|||
// 删除备件采购订单主
|
|||
export const deleteItemOrderMain = async (id: number) => { |
|||
return await request.delete({ url: `/eam/item-order-main/delete?id=` + id }) |
|||
} |
|||
|
|||
// 导出备件采购订单主 Excel
|
|||
export const exportItemOrderMain = async (params) => { |
|||
return await request.download({ url: `/eam/item-order-main/export-excel`, params }) |
|||
} |
|||
|
|||
// 下载用户导入模板
|
|||
export const importTemplate = () => { |
|||
return request.download({ url: '/eam/item-order-main/get-import-template' }) |
|||
} |
@ -0,0 +1,244 @@ |
|||
<template> |
|||
<ContentWrap> |
|||
<!-- 搜索工作栏 --> |
|||
<Search :schema="ItemAccounts.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" /> |
|||
</ContentWrap> |
|||
|
|||
<!-- 列表头部 --> |
|||
<TableHead |
|||
:HeadButttondata="HeadButttondata" |
|||
@button-base-click="buttonBaseClick" |
|||
:routeName="routeName" |
|||
@updataTableColumns="updataTableColumns" |
|||
@searchFormClick="searchFormClick" |
|||
:allSchemas="ItemAccounts.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}"> |
|||
<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)" /> |
|||
</template> |
|||
</Table> |
|||
</ContentWrap> |
|||
|
|||
<!-- 表单弹窗:添加/修改 --> |
|||
<BasicForm |
|||
ref="basicFormRef" |
|||
@success="formsSuccess" |
|||
:rules="ItemAccountsRules" |
|||
:formAllSchemas="ItemAccounts.allSchemas" |
|||
:apiUpdate="ItemAccountsApi.updateItemAccounts" |
|||
:apiCreate="ItemAccountsApi.createItemAccounts" |
|||
@searchTableSuccess="searchTableSuccess" |
|||
:isBusiness="false" |
|||
/> |
|||
|
|||
<!-- 详情 --> |
|||
<Detail ref="detailRef" :isBasic="true" :allSchemas="ItemAccounts.allSchemas" /> |
|||
|
|||
<!-- 导入 --> |
|||
<ImportForm ref="importFormRef" url="/eam/item-accounts/import" :importTemplateData="importTemplateData" @success="importSuccess" /> |
|||
</template> |
|||
|
|||
<script setup lang="ts"> |
|||
import download from '@/utils/download' |
|||
import { ItemAccounts,ItemAccountsRules } from './itemAccounts.data' |
|||
import * as ItemAccountsApi from '@/api/eam/item/itemAccounts' |
|||
import * as defaultButtons from '@/utils/disposition/defaultButtons' |
|||
import TableHead from '@/components/TableHead/src/TableHead.vue' |
|||
import ImportForm from '@/components/ImportForm/src/ImportForm.vue' |
|||
import Detail from '@/components/Detail/src/Detail.vue' |
|||
|
|||
defineOptions({ name: 'ItemAccounts' }) |
|||
|
|||
const message = useMessage() // 消息弹窗 |
|||
const { t } = useI18n() // 国际化 |
|||
|
|||
const route = useRoute() // 路由信息 |
|||
const routeName = ref() |
|||
routeName.value = route.name |
|||
const tableColumns = ref(ItemAccounts.allSchemas.tableColumns) |
|||
|
|||
// 查询页面返回 |
|||
const searchTableSuccess = (formField, searchField, val, formRef) => { |
|||
nextTick(() => { |
|||
const setV = {} |
|||
setV[formField] = val[0][searchField] |
|||
formRef.setValues(setV) |
|||
}) |
|||
} |
|||
|
|||
// 字段设置 更新主列表字段 |
|||
const updataTableColumns = (val) => { |
|||
tableColumns.value = val |
|||
} |
|||
|
|||
const { tableObject, tableMethods } = useTable({ |
|||
getListApi: ItemAccountsApi.getItemAccountsPage // 分页接口 |
|||
}) |
|||
|
|||
// 获得表格的各种操作 |
|||
const { getList, setSearchParams } = tableMethods |
|||
|
|||
// 列表头部按钮 |
|||
const HeadButttondata = [ |
|||
defaultButtons.defaultAddBtn({hasPermi:'eam:itemAccounts:create'}), // 新增 |
|||
defaultButtons.defaultImportBtn({hasPermi:'eam:itemAccounts:import'}), // 导入 |
|||
defaultButtons.defaultExportBtn({hasPermi:'eam:itemAccounts:export'}), // 导出 |
|||
defaultButtons.defaultFreshBtn(null), // 刷新 |
|||
defaultButtons.defaultFilterBtn(null), // 筛选 |
|||
defaultButtons.defaultSetBtn(null), // 设置 |
|||
// { |
|||
// label: '自定义扩展按钮', |
|||
// name: 'zdy', |
|||
// hide: false, |
|||
// type: 'primary', |
|||
// icon: 'Select', |
|||
// color: '' |
|||
// }, |
|||
] |
|||
|
|||
// 头部按钮事件 |
|||
const buttonBaseClick = (val, item) => { |
|||
if (val == 'add') { // 新增 |
|||
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 = [ |
|||
defaultButtons.mainListEditBtn({hasPermi:'eam:itemAccounts:update'}), // 编辑 |
|||
defaultButtons.mainListDeleteBtn({hasPermi:'eam:itemAccounts:delete'}), // 删除 |
|||
] |
|||
|
|||
// 列表-操作按钮事件 |
|||
const buttonTableClick = async (val, row) => { |
|||
if (val == 'edit') { // 编辑 |
|||
openForm('update', row) |
|||
} else if (val == 'delete') { // 删除 |
|||
handleDelete(row.id) |
|||
} |
|||
} |
|||
|
|||
/** 添加/修改操作 */ |
|||
const basicFormRef = ref() |
|||
const openForm = (type: string, row?: any) => { |
|||
basicFormRef.value.open(type, row) |
|||
} |
|||
|
|||
// form表单提交 |
|||
const formsSuccess = async (formType,data) => { |
|||
var isHave =ItemAccounts.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 ItemAccountsApi.createItemAccounts(data) |
|||
message.success(t('common.createSuccess')) |
|||
} else { |
|||
await ItemAccountsApi.updateItemAccounts(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, 'basicItemAccounts') |
|||
} |
|||
|
|||
/** 删除按钮操作 */ |
|||
const handleDelete = async (id: number) => { |
|||
try { |
|||
// 删除的二次确认 |
|||
await message.delConfirm() |
|||
// 发起删除 |
|||
await ItemAccountsApi.deleteItemAccounts(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 ItemAccountsApi.exportItemAccounts(tableObject.params) |
|||
download.excel(data, '备件台账.xlsx') |
|||
} catch { |
|||
} finally { |
|||
exportLoading.value = false |
|||
} |
|||
} |
|||
|
|||
/** 导入 */ |
|||
const importFormRef = ref() |
|||
const handleImport = () => { |
|||
importFormRef.value.open() |
|||
} |
|||
// 导入附件弹窗所需的参数 |
|||
const importTemplateData = reactive({ |
|||
templateUrl: '', |
|||
templateTitle: '备件台账导入模版.xlsx' |
|||
}) |
|||
// 导入成功之后 |
|||
const importSuccess = () => { |
|||
getList() |
|||
} |
|||
|
|||
// 筛选提交 |
|||
const searchFormClick = (searchData) => { |
|||
tableObject.params = { |
|||
isSearch: true, |
|||
filters: searchData.filters |
|||
} |
|||
getList() // 刷新当前列表 |
|||
} |
|||
|
|||
/** 初始化 **/ |
|||
onMounted(async () => { |
|||
getList() |
|||
importTemplateData.templateUrl = await ItemAccountsApi.importTemplate() |
|||
}) |
|||
|
|||
</script> |
@ -0,0 +1,68 @@ |
|||
import type { CrudSchema } from '@/hooks/web/useCrudSchemas' |
|||
import { dateFormatter } from '@/utils/formatTime' |
|||
|
|||
// 表单校验
|
|||
export const ItemAccountsRules = reactive({ |
|||
itemNumber: [required], |
|||
areaNumber: [required], |
|||
concurrencyStamp: [required], |
|||
}) |
|||
|
|||
export const ItemAccounts = useCrudSchemas(reactive<CrudSchema[]>([ |
|||
{ |
|||
label: '备件编号', |
|||
field: 'itemNumber', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
}, |
|||
{ |
|||
label: '库存数量', |
|||
field: 'qty', |
|||
sort: 'custom', |
|||
}, |
|||
{ |
|||
label: '库区编号', |
|||
field: 'areaNumber', |
|||
sort: 'custom', |
|||
}, |
|||
{ |
|||
label: '是否账内库TRUE账内FALSE账外', |
|||
field: 'isInAccount', |
|||
sort: 'custom', |
|||
}, |
|||
{ |
|||
label: '创建时间', |
|||
field: 'createTime', |
|||
sort: 'custom', |
|||
formatter: dateFormatter, |
|||
isForm: false, |
|||
}, |
|||
{ |
|||
label: '地点ID', |
|||
field: 'siteId', |
|||
sort: 'custom', |
|||
}, |
|||
{ |
|||
label: '是否可用', |
|||
field: 'available', |
|||
sort: 'custom', |
|||
}, |
|||
{ |
|||
label: '并发乐观锁', |
|||
field: 'concurrencyStamp', |
|||
sort: 'custom', |
|||
form: { |
|||
component: 'InputNumber', |
|||
value: 0 |
|||
}, |
|||
}, |
|||
{ |
|||
label: '操作', |
|||
field: 'action', |
|||
isForm: false, |
|||
table: { |
|||
width: 150, |
|||
fixed: 'right' |
|||
} |
|||
} |
|||
])) |
@ -0,0 +1,244 @@ |
|||
<template> |
|||
<ContentWrap> |
|||
<!-- 搜索工作栏 --> |
|||
<Search :schema="ItemApplyMain.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" /> |
|||
</ContentWrap> |
|||
|
|||
<!-- 列表头部 --> |
|||
<TableHead |
|||
:HeadButttondata="HeadButttondata" |
|||
@button-base-click="buttonBaseClick" |
|||
:routeName="routeName" |
|||
@updataTableColumns="updataTableColumns" |
|||
@searchFormClick="searchFormClick" |
|||
:allSchemas="ItemApplyMain.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}"> |
|||
<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)" /> |
|||
</template> |
|||
</Table> |
|||
</ContentWrap> |
|||
|
|||
<!-- 表单弹窗:添加/修改 --> |
|||
<BasicForm |
|||
ref="basicFormRef" |
|||
@success="formsSuccess" |
|||
:rules="ItemApplyMainRules" |
|||
:formAllSchemas="ItemApplyMain.allSchemas" |
|||
:apiUpdate="ItemApplyMainApi.updateItemApplyMain" |
|||
:apiCreate="ItemApplyMainApi.createItemApplyMain" |
|||
@searchTableSuccess="searchTableSuccess" |
|||
:isBusiness="false" |
|||
/> |
|||
|
|||
<!-- 详情 --> |
|||
<Detail ref="detailRef" :isBasic="true" :allSchemas="ItemApplyMain.allSchemas" /> |
|||
|
|||
<!-- 导入 --> |
|||
<ImportForm ref="importFormRef" url="/eam/item-apply-main/import" :importTemplateData="importTemplateData" @success="importSuccess" /> |
|||
</template> |
|||
|
|||
<script setup lang="ts"> |
|||
import download from '@/utils/download' |
|||
import { ItemApplyMain,ItemApplyMainRules } from './itemApplyMain.data' |
|||
import * as ItemApplyMainApi from '@/api/eam/item/itemApplyMain' |
|||
import * as defaultButtons from '@/utils/disposition/defaultButtons' |
|||
import TableHead from '@/components/TableHead/src/TableHead.vue' |
|||
import ImportForm from '@/components/ImportForm/src/ImportForm.vue' |
|||
import Detail from '@/components/Detail/src/Detail.vue' |
|||
|
|||
defineOptions({ name: 'ItemApplyMain' }) |
|||
|
|||
const message = useMessage() // 消息弹窗 |
|||
const { t } = useI18n() // 国际化 |
|||
|
|||
const route = useRoute() // 路由信息 |
|||
const routeName = ref() |
|||
routeName.value = route.name |
|||
const tableColumns = ref(ItemApplyMain.allSchemas.tableColumns) |
|||
|
|||
// 查询页面返回 |
|||
const searchTableSuccess = (formField, searchField, val, formRef) => { |
|||
nextTick(() => { |
|||
const setV = {} |
|||
setV[formField] = val[0][searchField] |
|||
formRef.setValues(setV) |
|||
}) |
|||
} |
|||
|
|||
// 字段设置 更新主列表字段 |
|||
const updataTableColumns = (val) => { |
|||
tableColumns.value = val |
|||
} |
|||
|
|||
const { tableObject, tableMethods } = useTable({ |
|||
getListApi: ItemApplyMainApi.getItemApplyMainPage // 分页接口 |
|||
}) |
|||
|
|||
// 获得表格的各种操作 |
|||
const { getList, setSearchParams } = tableMethods |
|||
|
|||
// 列表头部按钮 |
|||
const HeadButttondata = [ |
|||
defaultButtons.defaultAddBtn({hasPermi:'eam:itemApplyMain:create'}), // 新增 |
|||
defaultButtons.defaultImportBtn({hasPermi:'eam:itemApplyMain:import'}), // 导入 |
|||
defaultButtons.defaultExportBtn({hasPermi:'eam:itemApplyMain:export'}), // 导出 |
|||
defaultButtons.defaultFreshBtn(null), // 刷新 |
|||
defaultButtons.defaultFilterBtn(null), // 筛选 |
|||
defaultButtons.defaultSetBtn(null), // 设置 |
|||
// { |
|||
// label: '自定义扩展按钮', |
|||
// name: 'zdy', |
|||
// hide: false, |
|||
// type: 'primary', |
|||
// icon: 'Select', |
|||
// color: '' |
|||
// }, |
|||
] |
|||
|
|||
// 头部按钮事件 |
|||
const buttonBaseClick = (val, item) => { |
|||
if (val == 'add') { // 新增 |
|||
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 = [ |
|||
defaultButtons.mainListEditBtn({hasPermi:'eam:itemApplyMain:update'}), // 编辑 |
|||
defaultButtons.mainListDeleteBtn({hasPermi:'eam:itemApplyMain:delete'}), // 删除 |
|||
] |
|||
|
|||
// 列表-操作按钮事件 |
|||
const buttonTableClick = async (val, row) => { |
|||
if (val == 'edit') { // 编辑 |
|||
openForm('update', row) |
|||
} else if (val == 'delete') { // 删除 |
|||
handleDelete(row.id) |
|||
} |
|||
} |
|||
|
|||
/** 添加/修改操作 */ |
|||
const basicFormRef = ref() |
|||
const openForm = (type: string, row?: any) => { |
|||
basicFormRef.value.open(type, row) |
|||
} |
|||
|
|||
// form表单提交 |
|||
const formsSuccess = async (formType,data) => { |
|||
var isHave =ItemApplyMain.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 ItemApplyMainApi.createItemApplyMain(data) |
|||
message.success(t('common.createSuccess')) |
|||
} else { |
|||
await ItemApplyMainApi.updateItemApplyMain(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, 'basicItemApplyMain') |
|||
} |
|||
|
|||
/** 删除按钮操作 */ |
|||
const handleDelete = async (id: number) => { |
|||
try { |
|||
// 删除的二次确认 |
|||
await message.delConfirm() |
|||
// 发起删除 |
|||
await ItemApplyMainApi.deleteItemApplyMain(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 ItemApplyMainApi.exportItemApplyMain(tableObject.params) |
|||
download.excel(data, '备件申领记录主.xlsx') |
|||
} catch { |
|||
} finally { |
|||
exportLoading.value = false |
|||
} |
|||
} |
|||
|
|||
/** 导入 */ |
|||
const importFormRef = ref() |
|||
const handleImport = () => { |
|||
importFormRef.value.open() |
|||
} |
|||
// 导入附件弹窗所需的参数 |
|||
const importTemplateData = reactive({ |
|||
templateUrl: '', |
|||
templateTitle: '备件申领记录主导入模版.xlsx' |
|||
}) |
|||
// 导入成功之后 |
|||
const importSuccess = () => { |
|||
getList() |
|||
} |
|||
|
|||
// 筛选提交 |
|||
const searchFormClick = (searchData) => { |
|||
tableObject.params = { |
|||
isSearch: true, |
|||
filters: searchData.filters |
|||
} |
|||
getList() // 刷新当前列表 |
|||
} |
|||
|
|||
/** 初始化 **/ |
|||
onMounted(async () => { |
|||
getList() |
|||
importTemplateData.templateUrl = await ItemApplyMainApi.importTemplate() |
|||
}) |
|||
|
|||
</script> |
@ -0,0 +1,146 @@ |
|||
import type { CrudSchema } from '@/hooks/web/useCrudSchemas' |
|||
import { dateFormatter } from '@/utils/formatTime' |
|||
|
|||
// 表单校验
|
|||
export const ItemApplyMainRules = reactive({ |
|||
number: [required], |
|||
name: [required], |
|||
concurrencyStamp: [required], |
|||
}) |
|||
|
|||
export const ItemApplyMain = useCrudSchemas(reactive<CrudSchema[]>([ |
|||
{ |
|||
label: '编号', |
|||
field: 'number', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
}, |
|||
{ |
|||
label: '描述', |
|||
field: 'name', |
|||
sort: 'custom', |
|||
}, |
|||
{ |
|||
label: '维修申领、以旧换新字典', |
|||
field: 'type', |
|||
sort: 'custom', |
|||
form: { |
|||
component: 'SelectV2' |
|||
}, |
|||
}, |
|||
{ |
|||
label: '申领人id', |
|||
field: 'applyId', |
|||
sort: 'custom', |
|||
form: { |
|||
component: 'InputNumber', |
|||
value: 0 |
|||
}, |
|||
}, |
|||
{ |
|||
label: '申领人部门id', |
|||
field: 'applyDeptId', |
|||
sort: 'custom', |
|||
form: { |
|||
component: 'InputNumber', |
|||
value: 0 |
|||
}, |
|||
}, |
|||
{ |
|||
label: '审批人id', |
|||
field: 'approveId', |
|||
sort: 'custom', |
|||
form: { |
|||
component: 'InputNumber', |
|||
value: 0 |
|||
}, |
|||
}, |
|||
{ |
|||
label: '审批时间', |
|||
field: 'approveTime', |
|||
sort: 'custom', |
|||
formatter: dateFormatter, |
|||
form: { |
|||
component: 'DatePicker', |
|||
componentProps: { |
|||
type: 'datetime', |
|||
valueFormat: 'x' |
|||
} |
|||
}, |
|||
}, |
|||
{ |
|||
label: '出库人id', |
|||
field: 'outId', |
|||
sort: 'custom', |
|||
form: { |
|||
component: 'InputNumber', |
|||
value: 0 |
|||
}, |
|||
}, |
|||
{ |
|||
label: '出库时间', |
|||
field: 'outTime', |
|||
sort: 'custom', |
|||
formatter: dateFormatter, |
|||
isSearch: true, |
|||
search: { |
|||
component: 'DatePicker', |
|||
componentProps: { |
|||
valueFormat: 'YYYY-MM-DD HH:mm:ss', |
|||
type: 'daterange', |
|||
defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')] |
|||
} |
|||
}, |
|||
form: { |
|||
component: 'DatePicker', |
|||
componentProps: { |
|||
type: 'datetime', |
|||
valueFormat: 'x' |
|||
} |
|||
}, |
|||
}, |
|||
{ |
|||
label: '创建时间', |
|||
field: 'createTime', |
|||
sort: 'custom', |
|||
formatter: dateFormatter, |
|||
isSearch: true, |
|||
search: { |
|||
component: 'DatePicker', |
|||
componentProps: { |
|||
valueFormat: 'YYYY-MM-DD HH:mm:ss', |
|||
type: 'daterange', |
|||
defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')] |
|||
} |
|||
}, |
|||
isForm: false, |
|||
}, |
|||
{ |
|||
label: '地点ID', |
|||
field: 'siteId', |
|||
sort: 'custom', |
|||
}, |
|||
{ |
|||
label: '是否可用', |
|||
field: 'available', |
|||
sort: 'custom', |
|||
}, |
|||
{ |
|||
label: '并发乐观锁', |
|||
field: 'concurrencyStamp', |
|||
sort: 'custom', |
|||
form: { |
|||
component: 'InputNumber', |
|||
value: 0 |
|||
}, |
|||
}, |
|||
{ |
|||
label: '操作', |
|||
field: 'action', |
|||
isForm: false, |
|||
table: { |
|||
width: 150, |
|||
fixed: 'right' |
|||
} |
|||
} |
|||
])) |
@ -0,0 +1,244 @@ |
|||
<template> |
|||
<ContentWrap> |
|||
<!-- 搜索工作栏 --> |
|||
<Search :schema="ItemLocationInRecord.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" /> |
|||
</ContentWrap> |
|||
|
|||
<!-- 列表头部 --> |
|||
<TableHead |
|||
:HeadButttondata="HeadButttondata" |
|||
@button-base-click="buttonBaseClick" |
|||
:routeName="routeName" |
|||
@updataTableColumns="updataTableColumns" |
|||
@searchFormClick="searchFormClick" |
|||
:allSchemas="ItemLocationInRecord.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}"> |
|||
<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)" /> |
|||
</template> |
|||
</Table> |
|||
</ContentWrap> |
|||
|
|||
<!-- 表单弹窗:添加/修改 --> |
|||
<BasicForm |
|||
ref="basicFormRef" |
|||
@success="formsSuccess" |
|||
:rules="ItemLocationInRecordRules" |
|||
:formAllSchemas="ItemLocationInRecord.allSchemas" |
|||
:apiUpdate="ItemLocationInRecordApi.updateItemLocationInRecord" |
|||
:apiCreate="ItemLocationInRecordApi.createItemLocationInRecord" |
|||
@searchTableSuccess="searchTableSuccess" |
|||
:isBusiness="false" |
|||
/> |
|||
|
|||
<!-- 详情 --> |
|||
<Detail ref="detailRef" :isBasic="true" :allSchemas="ItemLocationInRecord.allSchemas" /> |
|||
|
|||
<!-- 导入 --> |
|||
<ImportForm ref="importFormRef" url="/eam/item-location-in-record/import" :importTemplateData="importTemplateData" @success="importSuccess" /> |
|||
</template> |
|||
|
|||
<script setup lang="ts"> |
|||
import download from '@/utils/download' |
|||
import { ItemLocationInRecord,ItemLocationInRecordRules } from './itemLocationInRecord.data' |
|||
import * as ItemLocationInRecordApi from '@/api/eam/item/itemLocationInRecord' |
|||
import * as defaultButtons from '@/utils/disposition/defaultButtons' |
|||
import TableHead from '@/components/TableHead/src/TableHead.vue' |
|||
import ImportForm from '@/components/ImportForm/src/ImportForm.vue' |
|||
import Detail from '@/components/Detail/src/Detail.vue' |
|||
|
|||
defineOptions({ name: 'ItemLocationInRecord' }) |
|||
|
|||
const message = useMessage() // 消息弹窗 |
|||
const { t } = useI18n() // 国际化 |
|||
|
|||
const route = useRoute() // 路由信息 |
|||
const routeName = ref() |
|||
routeName.value = route.name |
|||
const tableColumns = ref(ItemLocationInRecord.allSchemas.tableColumns) |
|||
|
|||
// 查询页面返回 |
|||
const searchTableSuccess = (formField, searchField, val, formRef) => { |
|||
nextTick(() => { |
|||
const setV = {} |
|||
setV[formField] = val[0][searchField] |
|||
formRef.setValues(setV) |
|||
}) |
|||
} |
|||
|
|||
// 字段设置 更新主列表字段 |
|||
const updataTableColumns = (val) => { |
|||
tableColumns.value = val |
|||
} |
|||
|
|||
const { tableObject, tableMethods } = useTable({ |
|||
getListApi: ItemLocationInRecordApi.getItemLocationInRecordPage // 分页接口 |
|||
}) |
|||
|
|||
// 获得表格的各种操作 |
|||
const { getList, setSearchParams } = tableMethods |
|||
|
|||
// 列表头部按钮 |
|||
const HeadButttondata = [ |
|||
defaultButtons.defaultAddBtn({hasPermi:'eam:itemLocationInRecord:create'}), // 新增 |
|||
defaultButtons.defaultImportBtn({hasPermi:'eam:itemLocationInRecord:import'}), // 导入 |
|||
defaultButtons.defaultExportBtn({hasPermi:'eam:itemLocationInRecord:export'}), // 导出 |
|||
defaultButtons.defaultFreshBtn(null), // 刷新 |
|||
defaultButtons.defaultFilterBtn(null), // 筛选 |
|||
defaultButtons.defaultSetBtn(null), // 设置 |
|||
// { |
|||
// label: '自定义扩展按钮', |
|||
// name: 'zdy', |
|||
// hide: false, |
|||
// type: 'primary', |
|||
// icon: 'Select', |
|||
// color: '' |
|||
// }, |
|||
] |
|||
|
|||
// 头部按钮事件 |
|||
const buttonBaseClick = (val, item) => { |
|||
if (val == 'add') { // 新增 |
|||
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 = [ |
|||
defaultButtons.mainListEditBtn({hasPermi:'eam:itemLocationInRecord:update'}), // 编辑 |
|||
defaultButtons.mainListDeleteBtn({hasPermi:'eam:itemLocationInRecord:delete'}), // 删除 |
|||
] |
|||
|
|||
// 列表-操作按钮事件 |
|||
const buttonTableClick = async (val, row) => { |
|||
if (val == 'edit') { // 编辑 |
|||
openForm('update', row) |
|||
} else if (val == 'delete') { // 删除 |
|||
handleDelete(row.id) |
|||
} |
|||
} |
|||
|
|||
/** 添加/修改操作 */ |
|||
const basicFormRef = ref() |
|||
const openForm = (type: string, row?: any) => { |
|||
basicFormRef.value.open(type, row) |
|||
} |
|||
|
|||
// form表单提交 |
|||
const formsSuccess = async (formType,data) => { |
|||
var isHave =ItemLocationInRecord.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 ItemLocationInRecordApi.createItemLocationInRecord(data) |
|||
message.success(t('common.createSuccess')) |
|||
} else { |
|||
await ItemLocationInRecordApi.updateItemLocationInRecord(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, 'basicItemLocationInRecord') |
|||
} |
|||
|
|||
/** 删除按钮操作 */ |
|||
const handleDelete = async (id: number) => { |
|||
try { |
|||
// 删除的二次确认 |
|||
await message.delConfirm() |
|||
// 发起删除 |
|||
await ItemLocationInRecordApi.deleteItemLocationInRecord(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 ItemLocationInRecordApi.exportItemLocationInRecord(tableObject.params) |
|||
download.excel(data, '备件库存记录.xlsx') |
|||
} catch { |
|||
} finally { |
|||
exportLoading.value = false |
|||
} |
|||
} |
|||
|
|||
/** 导入 */ |
|||
const importFormRef = ref() |
|||
const handleImport = () => { |
|||
importFormRef.value.open() |
|||
} |
|||
// 导入附件弹窗所需的参数 |
|||
const importTemplateData = reactive({ |
|||
templateUrl: '', |
|||
templateTitle: '备件库存记录导入模版.xlsx' |
|||
}) |
|||
// 导入成功之后 |
|||
const importSuccess = () => { |
|||
getList() |
|||
} |
|||
|
|||
// 筛选提交 |
|||
const searchFormClick = (searchData) => { |
|||
tableObject.params = { |
|||
isSearch: true, |
|||
filters: searchData.filters |
|||
} |
|||
getList() // 刷新当前列表 |
|||
} |
|||
|
|||
/** 初始化 **/ |
|||
onMounted(async () => { |
|||
getList() |
|||
importTemplateData.templateUrl = await ItemLocationInRecordApi.importTemplate() |
|||
}) |
|||
|
|||
</script> |
@ -0,0 +1,111 @@ |
|||
import type { CrudSchema } from '@/hooks/web/useCrudSchemas' |
|||
import { dateFormatter } from '@/utils/formatTime' |
|||
|
|||
// 表单校验
|
|||
export const ItemLocationInRecordRules = reactive({ |
|||
itemNumber: [required], |
|||
locationNumber: [required], |
|||
inventoryAction: [required], |
|||
businessType: [required], |
|||
uom: [required], |
|||
concurrencyStamp: [required], |
|||
}) |
|||
|
|||
export const ItemLocationInRecord = useCrudSchemas(reactive<CrudSchema[]>([ |
|||
{ |
|||
label: '编号唯一标识', |
|||
field: 'itemNumber', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
}, |
|||
{ |
|||
label: '库存编码', |
|||
field: 'locationNumber', |
|||
sort: 'custom', |
|||
}, |
|||
{ |
|||
label: '事务类型IN、OUT', |
|||
field: 'transactionType', |
|||
sort: 'custom', |
|||
form: { |
|||
component: 'SelectV2' |
|||
}, |
|||
}, |
|||
{ |
|||
label: '库存动作', |
|||
field: 'inventoryAction', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
}, |
|||
{ |
|||
label: '业务类型', |
|||
field: 'businessType', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
form: { |
|||
component: 'SelectV2' |
|||
}, |
|||
}, |
|||
{ |
|||
label: '库存状态', |
|||
field: 'inventoryStatus', |
|||
sort: 'custom', |
|||
form: { |
|||
component: 'Radio' |
|||
}, |
|||
}, |
|||
{ |
|||
label: '计量单位从备件中获取', |
|||
field: 'uom', |
|||
sort: 'custom', |
|||
}, |
|||
{ |
|||
label: '数量', |
|||
field: 'qty', |
|||
sort: 'custom', |
|||
}, |
|||
{ |
|||
label: '创建时间', |
|||
field: 'createTime', |
|||
sort: 'custom', |
|||
formatter: dateFormatter, |
|||
isSearch: true, |
|||
search: { |
|||
component: 'DatePicker', |
|||
componentProps: { |
|||
valueFormat: 'YYYY-MM-DD HH:mm:ss', |
|||
type: 'daterange', |
|||
defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')] |
|||
} |
|||
}, |
|||
isForm: false, |
|||
}, |
|||
{ |
|||
label: '地点ID', |
|||
field: 'siteId', |
|||
sort: 'custom', |
|||
}, |
|||
{ |
|||
label: '是否可用', |
|||
field: 'available', |
|||
sort: 'custom', |
|||
}, |
|||
{ |
|||
label: '并发乐观锁', |
|||
field: 'concurrencyStamp', |
|||
sort: 'custom', |
|||
form: { |
|||
component: 'InputNumber', |
|||
value: 0 |
|||
}, |
|||
}, |
|||
{ |
|||
label: '操作', |
|||
field: 'action', |
|||
isForm: false, |
|||
table: { |
|||
width: 150, |
|||
fixed: 'right' |
|||
} |
|||
} |
|||
])) |
@ -0,0 +1,244 @@ |
|||
<template> |
|||
<ContentWrap> |
|||
<!-- 搜索工作栏 --> |
|||
<Search :schema="ItemLocationOutRecord.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" /> |
|||
</ContentWrap> |
|||
|
|||
<!-- 列表头部 --> |
|||
<TableHead |
|||
:HeadButttondata="HeadButttondata" |
|||
@button-base-click="buttonBaseClick" |
|||
:routeName="routeName" |
|||
@updataTableColumns="updataTableColumns" |
|||
@searchFormClick="searchFormClick" |
|||
:allSchemas="ItemLocationOutRecord.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}"> |
|||
<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)" /> |
|||
</template> |
|||
</Table> |
|||
</ContentWrap> |
|||
|
|||
<!-- 表单弹窗:添加/修改 --> |
|||
<BasicForm |
|||
ref="basicFormRef" |
|||
@success="formsSuccess" |
|||
:rules="ItemLocationOutRecordRules" |
|||
:formAllSchemas="ItemLocationOutRecord.allSchemas" |
|||
:apiUpdate="ItemLocationOutRecordApi.updateItemLocationOutRecord" |
|||
:apiCreate="ItemLocationOutRecordApi.createItemLocationOutRecord" |
|||
@searchTableSuccess="searchTableSuccess" |
|||
:isBusiness="false" |
|||
/> |
|||
|
|||
<!-- 详情 --> |
|||
<Detail ref="detailRef" :isBasic="true" :allSchemas="ItemLocationOutRecord.allSchemas" /> |
|||
|
|||
<!-- 导入 --> |
|||
<ImportForm ref="importFormRef" url="/eam/item-location-out-record/import" :importTemplateData="importTemplateData" @success="importSuccess" /> |
|||
</template> |
|||
|
|||
<script setup lang="ts"> |
|||
import download from '@/utils/download' |
|||
import { ItemLocationOutRecord,ItemLocationOutRecordRules } from './itemLocationOutRecord.data' |
|||
import * as ItemLocationOutRecordApi from '@/api/eam/item/itemLocationOutRecord' |
|||
import * as defaultButtons from '@/utils/disposition/defaultButtons' |
|||
import TableHead from '@/components/TableHead/src/TableHead.vue' |
|||
import ImportForm from '@/components/ImportForm/src/ImportForm.vue' |
|||
import Detail from '@/components/Detail/src/Detail.vue' |
|||
|
|||
defineOptions({ name: 'ItemLocationOutRecord' }) |
|||
|
|||
const message = useMessage() // 消息弹窗 |
|||
const { t } = useI18n() // 国际化 |
|||
|
|||
const route = useRoute() // 路由信息 |
|||
const routeName = ref() |
|||
routeName.value = route.name |
|||
const tableColumns = ref(ItemLocationOutRecord.allSchemas.tableColumns) |
|||
|
|||
// 查询页面返回 |
|||
const searchTableSuccess = (formField, searchField, val, formRef) => { |
|||
nextTick(() => { |
|||
const setV = {} |
|||
setV[formField] = val[0][searchField] |
|||
formRef.setValues(setV) |
|||
}) |
|||
} |
|||
|
|||
// 字段设置 更新主列表字段 |
|||
const updataTableColumns = (val) => { |
|||
tableColumns.value = val |
|||
} |
|||
|
|||
const { tableObject, tableMethods } = useTable({ |
|||
getListApi: ItemLocationOutRecordApi.getItemLocationOutRecordPage // 分页接口 |
|||
}) |
|||
|
|||
// 获得表格的各种操作 |
|||
const { getList, setSearchParams } = tableMethods |
|||
|
|||
// 列表头部按钮 |
|||
const HeadButttondata = [ |
|||
defaultButtons.defaultAddBtn({hasPermi:'eam:itemLocationOutRecord:create'}), // 新增 |
|||
defaultButtons.defaultImportBtn({hasPermi:'eam:itemLocationOutRecord:import'}), // 导入 |
|||
defaultButtons.defaultExportBtn({hasPermi:'eam:itemLocationOutRecord:export'}), // 导出 |
|||
defaultButtons.defaultFreshBtn(null), // 刷新 |
|||
defaultButtons.defaultFilterBtn(null), // 筛选 |
|||
defaultButtons.defaultSetBtn(null), // 设置 |
|||
// { |
|||
// label: '自定义扩展按钮', |
|||
// name: 'zdy', |
|||
// hide: false, |
|||
// type: 'primary', |
|||
// icon: 'Select', |
|||
// color: '' |
|||
// }, |
|||
] |
|||
|
|||
// 头部按钮事件 |
|||
const buttonBaseClick = (val, item) => { |
|||
if (val == 'add') { // 新增 |
|||
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 = [ |
|||
defaultButtons.mainListEditBtn({hasPermi:'eam:itemLocationOutRecord:update'}), // 编辑 |
|||
defaultButtons.mainListDeleteBtn({hasPermi:'eam:itemLocationOutRecord:delete'}), // 删除 |
|||
] |
|||
|
|||
// 列表-操作按钮事件 |
|||
const buttonTableClick = async (val, row) => { |
|||
if (val == 'edit') { // 编辑 |
|||
openForm('update', row) |
|||
} else if (val == 'delete') { // 删除 |
|||
handleDelete(row.id) |
|||
} |
|||
} |
|||
|
|||
/** 添加/修改操作 */ |
|||
const basicFormRef = ref() |
|||
const openForm = (type: string, row?: any) => { |
|||
basicFormRef.value.open(type, row) |
|||
} |
|||
|
|||
// form表单提交 |
|||
const formsSuccess = async (formType,data) => { |
|||
var isHave =ItemLocationOutRecord.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 ItemLocationOutRecordApi.createItemLocationOutRecord(data) |
|||
message.success(t('common.createSuccess')) |
|||
} else { |
|||
await ItemLocationOutRecordApi.updateItemLocationOutRecord(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, 'basicItemLocationOutRecord') |
|||
} |
|||
|
|||
/** 删除按钮操作 */ |
|||
const handleDelete = async (id: number) => { |
|||
try { |
|||
// 删除的二次确认 |
|||
await message.delConfirm() |
|||
// 发起删除 |
|||
await ItemLocationOutRecordApi.deleteItemLocationOutRecord(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 ItemLocationOutRecordApi.exportItemLocationOutRecord(tableObject.params) |
|||
download.excel(data, '备件库存记录.xlsx') |
|||
} catch { |
|||
} finally { |
|||
exportLoading.value = false |
|||
} |
|||
} |
|||
|
|||
/** 导入 */ |
|||
const importFormRef = ref() |
|||
const handleImport = () => { |
|||
importFormRef.value.open() |
|||
} |
|||
// 导入附件弹窗所需的参数 |
|||
const importTemplateData = reactive({ |
|||
templateUrl: '', |
|||
templateTitle: '备件库存记录导入模版.xlsx' |
|||
}) |
|||
// 导入成功之后 |
|||
const importSuccess = () => { |
|||
getList() |
|||
} |
|||
|
|||
// 筛选提交 |
|||
const searchFormClick = (searchData) => { |
|||
tableObject.params = { |
|||
isSearch: true, |
|||
filters: searchData.filters |
|||
} |
|||
getList() // 刷新当前列表 |
|||
} |
|||
|
|||
/** 初始化 **/ |
|||
onMounted(async () => { |
|||
getList() |
|||
importTemplateData.templateUrl = await ItemLocationOutRecordApi.importTemplate() |
|||
}) |
|||
|
|||
</script> |
@ -0,0 +1,111 @@ |
|||
import type { CrudSchema } from '@/hooks/web/useCrudSchemas' |
|||
import { dateFormatter } from '@/utils/formatTime' |
|||
|
|||
// 表单校验
|
|||
export const ItemLocationOutRecordRules = reactive({ |
|||
itemNumber: [required], |
|||
locationNumber: [required], |
|||
inventoryAction: [required], |
|||
businessType: [required], |
|||
uom: [required], |
|||
concurrencyStamp: [required], |
|||
}) |
|||
|
|||
export const ItemLocationOutRecord = useCrudSchemas(reactive<CrudSchema[]>([ |
|||
{ |
|||
label: '编号唯一标识', |
|||
field: 'itemNumber', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
}, |
|||
{ |
|||
label: '库存编码', |
|||
field: 'locationNumber', |
|||
sort: 'custom', |
|||
}, |
|||
{ |
|||
label: '事务类型IN、OUT', |
|||
field: 'transactionType', |
|||
sort: 'custom', |
|||
form: { |
|||
component: 'SelectV2' |
|||
}, |
|||
}, |
|||
{ |
|||
label: '库存动作', |
|||
field: 'inventoryAction', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
}, |
|||
{ |
|||
label: '业务类型', |
|||
field: 'businessType', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
form: { |
|||
component: 'SelectV2' |
|||
}, |
|||
}, |
|||
{ |
|||
label: '库存状态', |
|||
field: 'inventoryStatus', |
|||
sort: 'custom', |
|||
form: { |
|||
component: 'Radio' |
|||
}, |
|||
}, |
|||
{ |
|||
label: '计量单位从备件中获取', |
|||
field: 'uom', |
|||
sort: 'custom', |
|||
}, |
|||
{ |
|||
label: '数量', |
|||
field: 'qty', |
|||
sort: 'custom', |
|||
}, |
|||
{ |
|||
label: '创建时间', |
|||
field: 'createTime', |
|||
sort: 'custom', |
|||
formatter: dateFormatter, |
|||
isSearch: true, |
|||
search: { |
|||
component: 'DatePicker', |
|||
componentProps: { |
|||
valueFormat: 'YYYY-MM-DD HH:mm:ss', |
|||
type: 'daterange', |
|||
defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')] |
|||
} |
|||
}, |
|||
isForm: false, |
|||
}, |
|||
{ |
|||
label: '地点ID', |
|||
field: 'siteId', |
|||
sort: 'custom', |
|||
}, |
|||
{ |
|||
label: '是否可用', |
|||
field: 'available', |
|||
sort: 'custom', |
|||
}, |
|||
{ |
|||
label: '并发乐观锁', |
|||
field: 'concurrencyStamp', |
|||
sort: 'custom', |
|||
form: { |
|||
component: 'InputNumber', |
|||
value: 0 |
|||
}, |
|||
}, |
|||
{ |
|||
label: '操作', |
|||
field: 'action', |
|||
isForm: false, |
|||
table: { |
|||
width: 150, |
|||
fixed: 'right' |
|||
} |
|||
} |
|||
])) |
@ -0,0 +1,244 @@ |
|||
<template> |
|||
<ContentWrap> |
|||
<!-- 搜索工作栏 --> |
|||
<Search :schema="ItemLocationRecord.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" /> |
|||
</ContentWrap> |
|||
|
|||
<!-- 列表头部 --> |
|||
<TableHead |
|||
:HeadButttondata="HeadButttondata" |
|||
@button-base-click="buttonBaseClick" |
|||
:routeName="routeName" |
|||
@updataTableColumns="updataTableColumns" |
|||
@searchFormClick="searchFormClick" |
|||
:allSchemas="ItemLocationRecord.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}"> |
|||
<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)" /> |
|||
</template> |
|||
</Table> |
|||
</ContentWrap> |
|||
|
|||
<!-- 表单弹窗:添加/修改 --> |
|||
<BasicForm |
|||
ref="basicFormRef" |
|||
@success="formsSuccess" |
|||
:rules="ItemLocationRecordRules" |
|||
:formAllSchemas="ItemLocationRecord.allSchemas" |
|||
:apiUpdate="ItemLocationRecordApi.updateItemLocationRecord" |
|||
:apiCreate="ItemLocationRecordApi.createItemLocationRecord" |
|||
@searchTableSuccess="searchTableSuccess" |
|||
:isBusiness="false" |
|||
/> |
|||
|
|||
<!-- 详情 --> |
|||
<Detail ref="detailRef" :isBasic="true" :allSchemas="ItemLocationRecord.allSchemas" /> |
|||
|
|||
<!-- 导入 --> |
|||
<ImportForm ref="importFormRef" url="/eam/item-location-record/import" :importTemplateData="importTemplateData" @success="importSuccess" /> |
|||
</template> |
|||
|
|||
<script setup lang="ts"> |
|||
import download from '@/utils/download' |
|||
import { ItemLocationRecord,ItemLocationRecordRules } from './itemLocationRecord.data' |
|||
import * as ItemLocationRecordApi from '@/api/eam/item/itemLocationRecord' |
|||
import * as defaultButtons from '@/utils/disposition/defaultButtons' |
|||
import TableHead from '@/components/TableHead/src/TableHead.vue' |
|||
import ImportForm from '@/components/ImportForm/src/ImportForm.vue' |
|||
import Detail from '@/components/Detail/src/Detail.vue' |
|||
|
|||
defineOptions({ name: 'ItemLocationRecord' }) |
|||
|
|||
const message = useMessage() // 消息弹窗 |
|||
const { t } = useI18n() // 国际化 |
|||
|
|||
const route = useRoute() // 路由信息 |
|||
const routeName = ref() |
|||
routeName.value = route.name |
|||
const tableColumns = ref(ItemLocationRecord.allSchemas.tableColumns) |
|||
|
|||
// 查询页面返回 |
|||
const searchTableSuccess = (formField, searchField, val, formRef) => { |
|||
nextTick(() => { |
|||
const setV = {} |
|||
setV[formField] = val[0][searchField] |
|||
formRef.setValues(setV) |
|||
}) |
|||
} |
|||
|
|||
// 字段设置 更新主列表字段 |
|||
const updataTableColumns = (val) => { |
|||
tableColumns.value = val |
|||
} |
|||
|
|||
const { tableObject, tableMethods } = useTable({ |
|||
getListApi: ItemLocationRecordApi.getItemLocationRecordPage // 分页接口 |
|||
}) |
|||
|
|||
// 获得表格的各种操作 |
|||
const { getList, setSearchParams } = tableMethods |
|||
|
|||
// 列表头部按钮 |
|||
const HeadButttondata = [ |
|||
defaultButtons.defaultAddBtn({hasPermi:'eam:itemLocationRecord:create'}), // 新增 |
|||
defaultButtons.defaultImportBtn({hasPermi:'eam:itemLocationRecord:import'}), // 导入 |
|||
defaultButtons.defaultExportBtn({hasPermi:'eam:itemLocationRecord:export'}), // 导出 |
|||
defaultButtons.defaultFreshBtn(null), // 刷新 |
|||
defaultButtons.defaultFilterBtn(null), // 筛选 |
|||
defaultButtons.defaultSetBtn(null), // 设置 |
|||
// { |
|||
// label: '自定义扩展按钮', |
|||
// name: 'zdy', |
|||
// hide: false, |
|||
// type: 'primary', |
|||
// icon: 'Select', |
|||
// color: '' |
|||
// }, |
|||
] |
|||
|
|||
// 头部按钮事件 |
|||
const buttonBaseClick = (val, item) => { |
|||
if (val == 'add') { // 新增 |
|||
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 = [ |
|||
defaultButtons.mainListEditBtn({hasPermi:'eam:itemLocationRecord:update'}), // 编辑 |
|||
defaultButtons.mainListDeleteBtn({hasPermi:'eam:itemLocationRecord:delete'}), // 删除 |
|||
] |
|||
|
|||
// 列表-操作按钮事件 |
|||
const buttonTableClick = async (val, row) => { |
|||
if (val == 'edit') { // 编辑 |
|||
openForm('update', row) |
|||
} else if (val == 'delete') { // 删除 |
|||
handleDelete(row.id) |
|||
} |
|||
} |
|||
|
|||
/** 添加/修改操作 */ |
|||
const basicFormRef = ref() |
|||
const openForm = (type: string, row?: any) => { |
|||
basicFormRef.value.open(type, row) |
|||
} |
|||
|
|||
// form表单提交 |
|||
const formsSuccess = async (formType,data) => { |
|||
var isHave =ItemLocationRecord.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 ItemLocationRecordApi.createItemLocationRecord(data) |
|||
message.success(t('common.createSuccess')) |
|||
} else { |
|||
await ItemLocationRecordApi.updateItemLocationRecord(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, 'basicItemLocationRecord') |
|||
} |
|||
|
|||
/** 删除按钮操作 */ |
|||
const handleDelete = async (id: number) => { |
|||
try { |
|||
// 删除的二次确认 |
|||
await message.delConfirm() |
|||
// 发起删除 |
|||
await ItemLocationRecordApi.deleteItemLocationRecord(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 ItemLocationRecordApi.exportItemLocationRecord(tableObject.params) |
|||
download.excel(data, '备件库存记录.xlsx') |
|||
} catch { |
|||
} finally { |
|||
exportLoading.value = false |
|||
} |
|||
} |
|||
|
|||
/** 导入 */ |
|||
const importFormRef = ref() |
|||
const handleImport = () => { |
|||
importFormRef.value.open() |
|||
} |
|||
// 导入附件弹窗所需的参数 |
|||
const importTemplateData = reactive({ |
|||
templateUrl: '', |
|||
templateTitle: '备件库存记录导入模版.xlsx' |
|||
}) |
|||
// 导入成功之后 |
|||
const importSuccess = () => { |
|||
getList() |
|||
} |
|||
|
|||
// 筛选提交 |
|||
const searchFormClick = (searchData) => { |
|||
tableObject.params = { |
|||
isSearch: true, |
|||
filters: searchData.filters |
|||
} |
|||
getList() // 刷新当前列表 |
|||
} |
|||
|
|||
/** 初始化 **/ |
|||
onMounted(async () => { |
|||
getList() |
|||
importTemplateData.templateUrl = await ItemLocationRecordApi.importTemplate() |
|||
}) |
|||
|
|||
</script> |
@ -0,0 +1,111 @@ |
|||
import type { CrudSchema } from '@/hooks/web/useCrudSchemas' |
|||
import { dateFormatter } from '@/utils/formatTime' |
|||
|
|||
// 表单校验
|
|||
export const ItemLocationRecordRules = reactive({ |
|||
itemNumber: [required], |
|||
locationNumber: [required], |
|||
inventoryAction: [required], |
|||
businessType: [required], |
|||
uom: [required], |
|||
concurrencyStamp: [required], |
|||
}) |
|||
|
|||
export const ItemLocationRecord = useCrudSchemas(reactive<CrudSchema[]>([ |
|||
{ |
|||
label: '编号唯一标识', |
|||
field: 'itemNumber', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
}, |
|||
{ |
|||
label: '库存编码', |
|||
field: 'locationNumber', |
|||
sort: 'custom', |
|||
}, |
|||
{ |
|||
label: '事务类型IN、OUT', |
|||
field: 'transactionType', |
|||
sort: 'custom', |
|||
form: { |
|||
component: 'SelectV2' |
|||
}, |
|||
}, |
|||
{ |
|||
label: '库存动作', |
|||
field: 'inventoryAction', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
}, |
|||
{ |
|||
label: '业务类型', |
|||
field: 'businessType', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
form: { |
|||
component: 'SelectV2' |
|||
}, |
|||
}, |
|||
{ |
|||
label: '库存状态', |
|||
field: 'inventoryStatus', |
|||
sort: 'custom', |
|||
form: { |
|||
component: 'Radio' |
|||
}, |
|||
}, |
|||
{ |
|||
label: '计量单位从备件中获取', |
|||
field: 'uom', |
|||
sort: 'custom', |
|||
}, |
|||
{ |
|||
label: '数量', |
|||
field: 'qty', |
|||
sort: 'custom', |
|||
}, |
|||
{ |
|||
label: '创建时间', |
|||
field: 'createTime', |
|||
sort: 'custom', |
|||
formatter: dateFormatter, |
|||
isSearch: true, |
|||
search: { |
|||
component: 'DatePicker', |
|||
componentProps: { |
|||
valueFormat: 'YYYY-MM-DD HH:mm:ss', |
|||
type: 'daterange', |
|||
defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')] |
|||
} |
|||
}, |
|||
isForm: false, |
|||
}, |
|||
{ |
|||
label: '地点ID', |
|||
field: 'siteId', |
|||
sort: 'custom', |
|||
}, |
|||
{ |
|||
label: '是否可用', |
|||
field: 'available', |
|||
sort: 'custom', |
|||
}, |
|||
{ |
|||
label: '并发乐观锁', |
|||
field: 'concurrencyStamp', |
|||
sort: 'custom', |
|||
form: { |
|||
component: 'InputNumber', |
|||
value: 0 |
|||
}, |
|||
}, |
|||
{ |
|||
label: '操作', |
|||
field: 'action', |
|||
isForm: false, |
|||
table: { |
|||
width: 150, |
|||
fixed: 'right' |
|||
} |
|||
} |
|||
])) |
@ -0,0 +1,244 @@ |
|||
<template> |
|||
<ContentWrap> |
|||
<!-- 搜索工作栏 --> |
|||
<Search :schema="ItemMaintenance.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" /> |
|||
</ContentWrap> |
|||
|
|||
<!-- 列表头部 --> |
|||
<TableHead |
|||
:HeadButttondata="HeadButttondata" |
|||
@button-base-click="buttonBaseClick" |
|||
:routeName="routeName" |
|||
@updataTableColumns="updataTableColumns" |
|||
@searchFormClick="searchFormClick" |
|||
:allSchemas="ItemMaintenance.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}"> |
|||
<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)" /> |
|||
</template> |
|||
</Table> |
|||
</ContentWrap> |
|||
|
|||
<!-- 表单弹窗:添加/修改 --> |
|||
<BasicForm |
|||
ref="basicFormRef" |
|||
@success="formsSuccess" |
|||
:rules="ItemMaintenanceRules" |
|||
:formAllSchemas="ItemMaintenance.allSchemas" |
|||
:apiUpdate="ItemMaintenanceApi.updateItemMaintenance" |
|||
:apiCreate="ItemMaintenanceApi.createItemMaintenance" |
|||
@searchTableSuccess="searchTableSuccess" |
|||
:isBusiness="false" |
|||
/> |
|||
|
|||
<!-- 详情 --> |
|||
<Detail ref="detailRef" :isBasic="true" :allSchemas="ItemMaintenance.allSchemas" /> |
|||
|
|||
<!-- 导入 --> |
|||
<ImportForm ref="importFormRef" url="/eam/item-maintenance/import" :importTemplateData="importTemplateData" @success="importSuccess" /> |
|||
</template> |
|||
|
|||
<script setup lang="ts"> |
|||
import download from '@/utils/download' |
|||
import { ItemMaintenance,ItemMaintenanceRules } from './itemMaintenance.data' |
|||
import * as ItemMaintenanceApi from '@/api/eam/item/itemMaintenance' |
|||
import * as defaultButtons from '@/utils/disposition/defaultButtons' |
|||
import TableHead from '@/components/TableHead/src/TableHead.vue' |
|||
import ImportForm from '@/components/ImportForm/src/ImportForm.vue' |
|||
import Detail from '@/components/Detail/src/Detail.vue' |
|||
|
|||
defineOptions({ name: 'ItemMaintenance' }) |
|||
|
|||
const message = useMessage() // 消息弹窗 |
|||
const { t } = useI18n() // 国际化 |
|||
|
|||
const route = useRoute() // 路由信息 |
|||
const routeName = ref() |
|||
routeName.value = route.name |
|||
const tableColumns = ref(ItemMaintenance.allSchemas.tableColumns) |
|||
|
|||
// 查询页面返回 |
|||
const searchTableSuccess = (formField, searchField, val, formRef) => { |
|||
nextTick(() => { |
|||
const setV = {} |
|||
setV[formField] = val[0][searchField] |
|||
formRef.setValues(setV) |
|||
}) |
|||
} |
|||
|
|||
// 字段设置 更新主列表字段 |
|||
const updataTableColumns = (val) => { |
|||
tableColumns.value = val |
|||
} |
|||
|
|||
const { tableObject, tableMethods } = useTable({ |
|||
getListApi: ItemMaintenanceApi.getItemMaintenancePage // 分页接口 |
|||
}) |
|||
|
|||
// 获得表格的各种操作 |
|||
const { getList, setSearchParams } = tableMethods |
|||
|
|||
// 列表头部按钮 |
|||
const HeadButttondata = [ |
|||
defaultButtons.defaultAddBtn({hasPermi:'eam:itemMaintenance:create'}), // 新增 |
|||
defaultButtons.defaultImportBtn({hasPermi:'eam:itemMaintenance:import'}), // 导入 |
|||
defaultButtons.defaultExportBtn({hasPermi:'eam:itemMaintenance:export'}), // 导出 |
|||
defaultButtons.defaultFreshBtn(null), // 刷新 |
|||
defaultButtons.defaultFilterBtn(null), // 筛选 |
|||
defaultButtons.defaultSetBtn(null), // 设置 |
|||
// { |
|||
// label: '自定义扩展按钮', |
|||
// name: 'zdy', |
|||
// hide: false, |
|||
// type: 'primary', |
|||
// icon: 'Select', |
|||
// color: '' |
|||
// }, |
|||
] |
|||
|
|||
// 头部按钮事件 |
|||
const buttonBaseClick = (val, item) => { |
|||
if (val == 'add') { // 新增 |
|||
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 = [ |
|||
defaultButtons.mainListEditBtn({hasPermi:'eam:itemMaintenance:update'}), // 编辑 |
|||
defaultButtons.mainListDeleteBtn({hasPermi:'eam:itemMaintenance:delete'}), // 删除 |
|||
] |
|||
|
|||
// 列表-操作按钮事件 |
|||
const buttonTableClick = async (val, row) => { |
|||
if (val == 'edit') { // 编辑 |
|||
openForm('update', row) |
|||
} else if (val == 'delete') { // 删除 |
|||
handleDelete(row.id) |
|||
} |
|||
} |
|||
|
|||
/** 添加/修改操作 */ |
|||
const basicFormRef = ref() |
|||
const openForm = (type: string, row?: any) => { |
|||
basicFormRef.value.open(type, row) |
|||
} |
|||
|
|||
// form表单提交 |
|||
const formsSuccess = async (formType,data) => { |
|||
var isHave =ItemMaintenance.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 ItemMaintenanceApi.createItemMaintenance(data) |
|||
message.success(t('common.createSuccess')) |
|||
} else { |
|||
await ItemMaintenanceApi.updateItemMaintenance(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, 'basicItemMaintenance') |
|||
} |
|||
|
|||
/** 删除按钮操作 */ |
|||
const handleDelete = async (id: number) => { |
|||
try { |
|||
// 删除的二次确认 |
|||
await message.delConfirm() |
|||
// 发起删除 |
|||
await ItemMaintenanceApi.deleteItemMaintenance(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 ItemMaintenanceApi.exportItemMaintenance(tableObject.params) |
|||
download.excel(data, '备件维修记录.xlsx') |
|||
} catch { |
|||
} finally { |
|||
exportLoading.value = false |
|||
} |
|||
} |
|||
|
|||
/** 导入 */ |
|||
const importFormRef = ref() |
|||
const handleImport = () => { |
|||
importFormRef.value.open() |
|||
} |
|||
// 导入附件弹窗所需的参数 |
|||
const importTemplateData = reactive({ |
|||
templateUrl: '', |
|||
templateTitle: '备件维修记录导入模版.xlsx' |
|||
}) |
|||
// 导入成功之后 |
|||
const importSuccess = () => { |
|||
getList() |
|||
} |
|||
|
|||
// 筛选提交 |
|||
const searchFormClick = (searchData) => { |
|||
tableObject.params = { |
|||
isSearch: true, |
|||
filters: searchData.filters |
|||
} |
|||
getList() // 刷新当前列表 |
|||
} |
|||
|
|||
/** 初始化 **/ |
|||
onMounted(async () => { |
|||
getList() |
|||
importTemplateData.templateUrl = await ItemMaintenanceApi.importTemplate() |
|||
}) |
|||
|
|||
</script> |
@ -0,0 +1,80 @@ |
|||
import type { CrudSchema } from '@/hooks/web/useCrudSchemas' |
|||
import { dateFormatter } from '@/utils/formatTime' |
|||
|
|||
// 表单校验
|
|||
export const ItemMaintenanceRules = reactive({ |
|||
number: [required], |
|||
itemNumber: [required], |
|||
qty: [required], |
|||
concurrencyStamp: [required], |
|||
}) |
|||
|
|||
export const ItemMaintenance = useCrudSchemas(reactive<CrudSchema[]>([ |
|||
{ |
|||
label: '代码', |
|||
field: 'number', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
}, |
|||
{ |
|||
label: '备件代码', |
|||
field: 'itemNumber', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
}, |
|||
{ |
|||
label: '数量', |
|||
field: 'qty', |
|||
sort: 'custom', |
|||
}, |
|||
{ |
|||
label: '维修结果YES、NO', |
|||
field: 'result', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
}, |
|||
{ |
|||
label: '创建时间', |
|||
field: 'createTime', |
|||
sort: 'custom', |
|||
formatter: dateFormatter, |
|||
isSearch: true, |
|||
search: { |
|||
component: 'DatePicker', |
|||
componentProps: { |
|||
valueFormat: 'YYYY-MM-DD HH:mm:ss', |
|||
type: 'daterange', |
|||
defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')] |
|||
} |
|||
}, |
|||
isForm: false, |
|||
}, |
|||
{ |
|||
label: '地点ID', |
|||
field: 'siteId', |
|||
sort: 'custom', |
|||
}, |
|||
{ |
|||
label: '是否可用', |
|||
field: 'available', |
|||
sort: 'custom', |
|||
}, |
|||
{ |
|||
label: '并发乐观锁', |
|||
field: 'concurrencyStamp', |
|||
sort: 'custom', |
|||
form: { |
|||
component: 'InputNumber', |
|||
value: 0 |
|||
}, |
|||
}, |
|||
{ |
|||
label: '操作', |
|||
field: 'action', |
|||
isForm: false, |
|||
table: { |
|||
width: 150, |
|||
fixed: 'right' |
|||
} |
|||
} |
|||
])) |
@ -0,0 +1,244 @@ |
|||
<template> |
|||
<ContentWrap> |
|||
<!-- 搜索工作栏 --> |
|||
<Search :schema="ItemOrderMain.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" /> |
|||
</ContentWrap> |
|||
|
|||
<!-- 列表头部 --> |
|||
<TableHead |
|||
:HeadButttondata="HeadButttondata" |
|||
@button-base-click="buttonBaseClick" |
|||
:routeName="routeName" |
|||
@updataTableColumns="updataTableColumns" |
|||
@searchFormClick="searchFormClick" |
|||
:allSchemas="ItemOrderMain.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}"> |
|||
<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)" /> |
|||
</template> |
|||
</Table> |
|||
</ContentWrap> |
|||
|
|||
<!-- 表单弹窗:添加/修改 --> |
|||
<BasicForm |
|||
ref="basicFormRef" |
|||
@success="formsSuccess" |
|||
:rules="ItemOrderMainRules" |
|||
:formAllSchemas="ItemOrderMain.allSchemas" |
|||
:apiUpdate="ItemOrderMainApi.updateItemOrderMain" |
|||
:apiCreate="ItemOrderMainApi.createItemOrderMain" |
|||
@searchTableSuccess="searchTableSuccess" |
|||
:isBusiness="false" |
|||
/> |
|||
|
|||
<!-- 详情 --> |
|||
<Detail ref="detailRef" :isBasic="true" :allSchemas="ItemOrderMain.allSchemas" /> |
|||
|
|||
<!-- 导入 --> |
|||
<ImportForm ref="importFormRef" url="/eam/item-order-main/import" :importTemplateData="importTemplateData" @success="importSuccess" /> |
|||
</template> |
|||
|
|||
<script setup lang="ts"> |
|||
import download from '@/utils/download' |
|||
import { ItemOrderMain,ItemOrderMainRules } from './itemOrderMain.data' |
|||
import * as ItemOrderMainApi from '@/api/eam/item/itemOrderMain' |
|||
import * as defaultButtons from '@/utils/disposition/defaultButtons' |
|||
import TableHead from '@/components/TableHead/src/TableHead.vue' |
|||
import ImportForm from '@/components/ImportForm/src/ImportForm.vue' |
|||
import Detail from '@/components/Detail/src/Detail.vue' |
|||
|
|||
defineOptions({ name: 'ItemOrderMain' }) |
|||
|
|||
const message = useMessage() // 消息弹窗 |
|||
const { t } = useI18n() // 国际化 |
|||
|
|||
const route = useRoute() // 路由信息 |
|||
const routeName = ref() |
|||
routeName.value = route.name |
|||
const tableColumns = ref(ItemOrderMain.allSchemas.tableColumns) |
|||
|
|||
// 查询页面返回 |
|||
const searchTableSuccess = (formField, searchField, val, formRef) => { |
|||
nextTick(() => { |
|||
const setV = {} |
|||
setV[formField] = val[0][searchField] |
|||
formRef.setValues(setV) |
|||
}) |
|||
} |
|||
|
|||
// 字段设置 更新主列表字段 |
|||
const updataTableColumns = (val) => { |
|||
tableColumns.value = val |
|||
} |
|||
|
|||
const { tableObject, tableMethods } = useTable({ |
|||
getListApi: ItemOrderMainApi.getItemOrderMainPage // 分页接口 |
|||
}) |
|||
|
|||
// 获得表格的各种操作 |
|||
const { getList, setSearchParams } = tableMethods |
|||
|
|||
// 列表头部按钮 |
|||
const HeadButttondata = [ |
|||
defaultButtons.defaultAddBtn({hasPermi:'eam:itemOrderMain:create'}), // 新增 |
|||
defaultButtons.defaultImportBtn({hasPermi:'eam:itemOrderMain:import'}), // 导入 |
|||
defaultButtons.defaultExportBtn({hasPermi:'eam:itemOrderMain:export'}), // 导出 |
|||
defaultButtons.defaultFreshBtn(null), // 刷新 |
|||
defaultButtons.defaultFilterBtn(null), // 筛选 |
|||
defaultButtons.defaultSetBtn(null), // 设置 |
|||
// { |
|||
// label: '自定义扩展按钮', |
|||
// name: 'zdy', |
|||
// hide: false, |
|||
// type: 'primary', |
|||
// icon: 'Select', |
|||
// color: '' |
|||
// }, |
|||
] |
|||
|
|||
// 头部按钮事件 |
|||
const buttonBaseClick = (val, item) => { |
|||
if (val == 'add') { // 新增 |
|||
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 = [ |
|||
defaultButtons.mainListEditBtn({hasPermi:'eam:itemOrderMain:update'}), // 编辑 |
|||
defaultButtons.mainListDeleteBtn({hasPermi:'eam:itemOrderMain:delete'}), // 删除 |
|||
] |
|||
|
|||
// 列表-操作按钮事件 |
|||
const buttonTableClick = async (val, row) => { |
|||
if (val == 'edit') { // 编辑 |
|||
openForm('update', row) |
|||
} else if (val == 'delete') { // 删除 |
|||
handleDelete(row.id) |
|||
} |
|||
} |
|||
|
|||
/** 添加/修改操作 */ |
|||
const basicFormRef = ref() |
|||
const openForm = (type: string, row?: any) => { |
|||
basicFormRef.value.open(type, row) |
|||
} |
|||
|
|||
// form表单提交 |
|||
const formsSuccess = async (formType,data) => { |
|||
var isHave =ItemOrderMain.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 ItemOrderMainApi.createItemOrderMain(data) |
|||
message.success(t('common.createSuccess')) |
|||
} else { |
|||
await ItemOrderMainApi.updateItemOrderMain(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, 'basicItemOrderMain') |
|||
} |
|||
|
|||
/** 删除按钮操作 */ |
|||
const handleDelete = async (id: number) => { |
|||
try { |
|||
// 删除的二次确认 |
|||
await message.delConfirm() |
|||
// 发起删除 |
|||
await ItemOrderMainApi.deleteItemOrderMain(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 ItemOrderMainApi.exportItemOrderMain(tableObject.params) |
|||
download.excel(data, '备件采购订单主.xlsx') |
|||
} catch { |
|||
} finally { |
|||
exportLoading.value = false |
|||
} |
|||
} |
|||
|
|||
/** 导入 */ |
|||
const importFormRef = ref() |
|||
const handleImport = () => { |
|||
importFormRef.value.open() |
|||
} |
|||
// 导入附件弹窗所需的参数 |
|||
const importTemplateData = reactive({ |
|||
templateUrl: '', |
|||
templateTitle: '备件采购订单主导入模版.xlsx' |
|||
}) |
|||
// 导入成功之后 |
|||
const importSuccess = () => { |
|||
getList() |
|||
} |
|||
|
|||
// 筛选提交 |
|||
const searchFormClick = (searchData) => { |
|||
tableObject.params = { |
|||
isSearch: true, |
|||
filters: searchData.filters |
|||
} |
|||
getList() // 刷新当前列表 |
|||
} |
|||
|
|||
/** 初始化 **/ |
|||
onMounted(async () => { |
|||
getList() |
|||
importTemplateData.templateUrl = await ItemOrderMainApi.importTemplate() |
|||
}) |
|||
|
|||
</script> |
@ -0,0 +1,153 @@ |
|||
import type { CrudSchema } from '@/hooks/web/useCrudSchemas' |
|||
import { dateFormatter } from '@/utils/formatTime' |
|||
|
|||
// 表单校验
|
|||
export const ItemOrderMainRules = reactive({ |
|||
number: [required], |
|||
date: [required], |
|||
concurrencyStamp: [required], |
|||
}) |
|||
|
|||
export const ItemOrderMain = useCrudSchemas(reactive<CrudSchema[]>([ |
|||
{ |
|||
label: '订单号唯一标识', |
|||
field: 'number', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
}, |
|||
{ |
|||
label: '日期', |
|||
field: 'date', |
|||
sort: 'custom', |
|||
formatter: dateFormatter, |
|||
form: { |
|||
component: 'DatePicker', |
|||
componentProps: { |
|||
type: 'datetime', |
|||
valueFormat: 'x' |
|||
} |
|||
}, |
|||
}, |
|||
{ |
|||
label: '电话', |
|||
field: 'phone', |
|||
sort: 'custom', |
|||
}, |
|||
{ |
|||
label: '传真', |
|||
field: 'fax', |
|||
sort: 'custom', |
|||
}, |
|||
{ |
|||
label: '采购员', |
|||
field: 'purchaser', |
|||
sort: 'custom', |
|||
}, |
|||
{ |
|||
label: '供应商编号', |
|||
field: 'supplierNumber', |
|||
sort: 'custom', |
|||
}, |
|||
{ |
|||
label: '供应商名称', |
|||
field: 'supplierName', |
|||
sort: 'custom', |
|||
}, |
|||
{ |
|||
label: '供应商地址', |
|||
field: 'supplierAddress', |
|||
sort: 'custom', |
|||
}, |
|||
{ |
|||
label: '发货至', |
|||
field: 'shipTo', |
|||
sort: 'custom', |
|||
}, |
|||
{ |
|||
label: '开票至', |
|||
field: 'invoiceTo', |
|||
sort: 'custom', |
|||
}, |
|||
{ |
|||
label: '联系人', |
|||
field: 'contacts', |
|||
sort: 'custom', |
|||
}, |
|||
{ |
|||
label: '联系电话', |
|||
field: 'contactsPhone', |
|||
sort: 'custom', |
|||
}, |
|||
{ |
|||
label: '付款方式', |
|||
field: 'paymentType', |
|||
sort: 'custom', |
|||
form: { |
|||
component: 'SelectV2' |
|||
}, |
|||
}, |
|||
{ |
|||
label: '注册地', |
|||
field: 'registLocation', |
|||
sort: 'custom', |
|||
}, |
|||
{ |
|||
label: '开户行', |
|||
field: 'bank', |
|||
sort: 'custom', |
|||
}, |
|||
{ |
|||
label: '账号', |
|||
field: 'account', |
|||
sort: 'custom', |
|||
}, |
|||
{ |
|||
label: '税号', |
|||
field: 'dutyParagraph', |
|||
sort: 'custom', |
|||
}, |
|||
{ |
|||
label: '创建时间', |
|||
field: 'createTime', |
|||
sort: 'custom', |
|||
formatter: dateFormatter, |
|||
isSearch: true, |
|||
search: { |
|||
component: 'DatePicker', |
|||
componentProps: { |
|||
valueFormat: 'YYYY-MM-DD HH:mm:ss', |
|||
type: 'daterange', |
|||
defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')] |
|||
} |
|||
}, |
|||
isForm: false, |
|||
}, |
|||
{ |
|||
label: '地点ID', |
|||
field: 'siteId', |
|||
sort: 'custom', |
|||
}, |
|||
{ |
|||
label: '是否可用', |
|||
field: 'available', |
|||
sort: 'custom', |
|||
}, |
|||
{ |
|||
label: '并发乐观锁', |
|||
field: 'concurrencyStamp', |
|||
sort: 'custom', |
|||
form: { |
|||
component: 'InputNumber', |
|||
value: 0 |
|||
}, |
|||
}, |
|||
{ |
|||
label: '操作', |
|||
field: 'action', |
|||
isForm: false, |
|||
table: { |
|||
width: 150, |
|||
fixed: 'right' |
|||
} |
|||
} |
|||
])) |
Loading…
Reference in new issue