yejiaxing
10 months ago
6 changed files with 0 additions and 869 deletions
@ -1,56 +0,0 @@ |
|||||
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' }) |
|
||||
} |
|
@ -1,56 +0,0 @@ |
|||||
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' }) |
|
||||
} |
|
@ -1,244 +0,0 @@ |
|||||
<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> |
|
@ -1,134 +0,0 @@ |
|||||
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: '事务类型', |
|
||||
field: 'transactionType', |
|
||||
dictType: DICT_TYPE.TRANSACTION_TYPE, |
|
||||
dictClass: 'string', |
|
||||
isSearch: false, |
|
||||
isTable: true, |
|
||||
sort: 'custom', |
|
||||
table: { |
|
||||
width: 150 |
|
||||
}, |
|
||||
tableForm: { |
|
||||
type: 'Select', |
|
||||
inactiveValue: 'FALSE', |
|
||||
disabled: true |
|
||||
}, |
|
||||
form: { |
|
||||
component: 'Switch', |
|
||||
value: 'TRUE', |
|
||||
componentProps: { |
|
||||
inactiveValue: 'FALSE', |
|
||||
activeValue: 'TRUE' |
|
||||
} |
|
||||
} |
|
||||
}, |
|
||||
{ |
|
||||
label: '库存动作', |
|
||||
field: 'inventoryAction', |
|
||||
sort: 'custom', |
|
||||
isSearch: false, |
|
||||
}, |
|
||||
{ |
|
||||
label: '业务类型', |
|
||||
field: 'businessType', |
|
||||
sort: 'custom', |
|
||||
isSearch: false, |
|
||||
form: { |
|
||||
component: 'Select' |
|
||||
}, |
|
||||
}, |
|
||||
{ |
|
||||
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: false, |
|
||||
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: '是否可用', |
|
||||
field: 'available', |
|
||||
dictType: DICT_TYPE.TRUE_FALSE, |
|
||||
dictClass: 'string', |
|
||||
isSearch: false, |
|
||||
isTable: true, |
|
||||
sort: 'custom', |
|
||||
table: { |
|
||||
width: 150 |
|
||||
}, |
|
||||
tableForm: { |
|
||||
type: 'Select', |
|
||||
inactiveValue: 'FALSE', |
|
||||
disabled: true |
|
||||
}, |
|
||||
form: { |
|
||||
component: 'Switch', |
|
||||
value: 'TRUE', |
|
||||
componentProps: { |
|
||||
inactiveValue: 'FALSE', |
|
||||
activeValue: 'TRUE' |
|
||||
} |
|
||||
} |
|
||||
}, |
|
||||
{ |
|
||||
label: '操作', |
|
||||
field: 'action', |
|
||||
isForm: false, |
|
||||
table: { |
|
||||
width: 150, |
|
||||
fixed: 'right' |
|
||||
} |
|
||||
} |
|
||||
])) |
|
@ -1,244 +0,0 @@ |
|||||
<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> |
|
@ -1,135 +0,0 @@ |
|||||
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: '事务类型', |
|
||||
field: 'transactionType', |
|
||||
dictType: DICT_TYPE.TRANSACTION_TYPE, |
|
||||
dictClass: 'string', |
|
||||
isSearch: false, |
|
||||
isTable: true, |
|
||||
sort: 'custom', |
|
||||
table: { |
|
||||
width: 150 |
|
||||
}, |
|
||||
tableForm: { |
|
||||
type: 'Select', |
|
||||
inactiveValue: 'FALSE', |
|
||||
disabled: true |
|
||||
}, |
|
||||
form: { |
|
||||
component: 'Switch', |
|
||||
value: 'TRUE', |
|
||||
componentProps: { |
|
||||
inactiveValue: 'FALSE', |
|
||||
activeValue: 'TRUE' |
|
||||
} |
|
||||
} |
|
||||
}, |
|
||||
{ |
|
||||
label: '库存动作', |
|
||||
field: 'inventoryAction', |
|
||||
sort: 'custom', |
|
||||
isSearch: false, |
|
||||
}, |
|
||||
{ |
|
||||
label: '业务类型', |
|
||||
field: 'businessType', |
|
||||
sort: 'custom', |
|
||||
isSearch: false, |
|
||||
form: { |
|
||||
component: 'Select' |
|
||||
}, |
|
||||
}, |
|
||||
{ |
|
||||
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: false, |
|
||||
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: '是否可用', |
|
||||
field: 'available', |
|
||||
dictType: DICT_TYPE.TRUE_FALSE, |
|
||||
dictClass: 'string', |
|
||||
isSearch: false, |
|
||||
isTable: true, |
|
||||
sort: 'custom', |
|
||||
table: { |
|
||||
width: 150 |
|
||||
}, |
|
||||
tableForm: { |
|
||||
type: 'Select', |
|
||||
inactiveValue: 'FALSE', |
|
||||
disabled: true |
|
||||
}, |
|
||||
form: { |
|
||||
component: 'Switch', |
|
||||
value: 'TRUE', |
|
||||
componentProps: { |
|
||||
inactiveValue: 'FALSE', |
|
||||
activeValue: 'TRUE' |
|
||||
} |
|
||||
} |
|
||||
}, |
|
||||
{ |
|
||||
label: '操作', |
|
||||
field: 'action', |
|
||||
isForm: false, |
|
||||
table: { |
|
||||
width: 150, |
|
||||
fixed: 'right' |
|
||||
} |
|
||||
} |
|
||||
])) |
|
Loading…
Reference in new issue