ljlong_2630
5 months ago
21 changed files with 3133 additions and 165 deletions
@ -0,0 +1,64 @@ |
|||
import request from '@/config/axios' |
|||
|
|||
export interface ToolEquipmentInVO { |
|||
id: number |
|||
describing: string |
|||
toolCode: string |
|||
status: string |
|||
approver: number |
|||
approveContent: string |
|||
approveTime: Date |
|||
factoryAreaCode: string |
|||
workshopCode: string |
|||
lineCode: string |
|||
processCode: string |
|||
workstationCode: string |
|||
departmentCode: string |
|||
remark: string |
|||
siteId: string |
|||
available: string |
|||
deletionTime: Date |
|||
deleterId: byte[] |
|||
concurrencyStamp: number |
|||
} |
|||
|
|||
// 查询工装入库记录列表
|
|||
export const getToolEquipmentInPage = async (params) => { |
|||
if (params.isSearch) { |
|||
delete params.isSearch |
|||
const data = {...params} |
|||
return await request.post({ url: '/eam/tool/tool-equipment-in/senior', data }) |
|||
} else { |
|||
return await request.get({ url: `/eam/tool/tool-equipment-in/page`, params }) |
|||
} |
|||
} |
|||
|
|||
// 查询工装入库记录详情
|
|||
export const getToolEquipmentIn = async (id: number) => { |
|||
return await request.get({ url: `/eam/tool/tool-equipment-in/get?id=` + id }) |
|||
} |
|||
|
|||
// 新增工装入库记录
|
|||
export const createToolEquipmentIn = async (data: ToolEquipmentInVO) => { |
|||
return await request.post({ url: `/eam/tool/tool-equipment-in/create`, data }) |
|||
} |
|||
|
|||
// 修改工装入库记录
|
|||
export const updateToolEquipmentIn = async (data: ToolEquipmentInVO) => { |
|||
return await request.put({ url: `/eam/tool/tool-equipment-in/update`, data }) |
|||
} |
|||
|
|||
// 删除工装入库记录
|
|||
export const deleteToolEquipmentIn = async (id: number) => { |
|||
return await request.delete({ url: `/eam/tool/tool-equipment-in/delete?id=` + id }) |
|||
} |
|||
|
|||
// 导出工装入库记录 Excel
|
|||
export const exportToolEquipmentIn = async (params) => { |
|||
return await request.download({ url: `/eam/tool/tool-equipment-in/export-excel`, params }) |
|||
} |
|||
|
|||
// 下载用户导入模板
|
|||
export const importTemplate = () => { |
|||
return request.download({ url: '/eam/tool/tool-equipment-in/get-import-template' }) |
|||
} |
@ -0,0 +1,64 @@ |
|||
import request from '@/config/axios' |
|||
|
|||
export interface ToolEquipmentOutVO { |
|||
id: number |
|||
theme: string |
|||
toolCode: string |
|||
type: string |
|||
qty: number |
|||
status: string |
|||
applyer: string |
|||
approver: number |
|||
approveContent: string |
|||
approveTime: Date |
|||
autoExamine: string |
|||
autoAgree: string |
|||
departmentCode: string |
|||
remark: string |
|||
siteId: string |
|||
available: string |
|||
deletionTime: Date |
|||
deleterId: byte[] |
|||
concurrencyStamp: number |
|||
} |
|||
|
|||
// 查询工装出库记录列表
|
|||
export const getToolEquipmentOutPage = async (params) => { |
|||
if (params.isSearch) { |
|||
delete params.isSearch |
|||
const data = {...params} |
|||
return await request.post({ url: '/eam/tool/tool-equipment-out/senior', data }) |
|||
} else { |
|||
return await request.get({ url: `/eam/tool/tool-equipment-out/page`, params }) |
|||
} |
|||
} |
|||
|
|||
// 查询工装出库记录详情
|
|||
export const getToolEquipmentOut = async (id: number) => { |
|||
return await request.get({ url: `/eam/tool/tool-equipment-out/get?id=` + id }) |
|||
} |
|||
|
|||
// 新增工装出库记录
|
|||
export const createToolEquipmentOut = async (data: ToolEquipmentOutVO) => { |
|||
return await request.post({ url: `/eam/tool/tool-equipment-out/create`, data }) |
|||
} |
|||
|
|||
// 修改工装出库记录
|
|||
export const updateToolEquipmentOut = async (data: ToolEquipmentOutVO) => { |
|||
return await request.put({ url: `/eam/tool/tool-equipment-out/update`, data }) |
|||
} |
|||
|
|||
// 删除工装出库记录
|
|||
export const deleteToolEquipmentOut = async (id: number) => { |
|||
return await request.delete({ url: `/eam/tool/tool-equipment-out/delete?id=` + id }) |
|||
} |
|||
|
|||
// 导出工装出库记录 Excel
|
|||
export const exportToolEquipmentOut = async (params) => { |
|||
return await request.download({ url: `/eam/tool/tool-equipment-out/export-excel`, params }) |
|||
} |
|||
|
|||
// 下载用户导入模板
|
|||
export const importTemplate = () => { |
|||
return request.download({ url: '/eam/tool/tool-equipment-out/get-import-template' }) |
|||
} |
@ -0,0 +1,270 @@ |
|||
<template> |
|||
<ContentWrap> |
|||
<!-- 搜索工作栏 --> |
|||
<Search :schema="EquipmentSigning.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" /> |
|||
</ContentWrap> |
|||
|
|||
<!-- 列表头部 --> |
|||
<TableHead |
|||
:HeadButttondata="HeadButttondata" |
|||
@button-base-click="buttonBaseClick" |
|||
:routeName="routeName" |
|||
@updataTableColumns="updataTableColumns" |
|||
@searchFormClick="searchFormClick" |
|||
:allSchemas="EquipmentSigning.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="EquipmentSigningRules" |
|||
:formAllSchemas="EquipmentSigning.allSchemas" |
|||
:apiUpdate="EquipmentSigningApi.updateEquipmentSigning" |
|||
:apiCreate="EquipmentSigningApi.createEquipmentSigning" |
|||
@searchTableSuccess="searchTableSuccess" |
|||
:isBusiness="false" |
|||
@onChange="onChange" |
|||
/> |
|||
|
|||
<!-- 详情 --> |
|||
<Detail ref="detailRef" :isBasic="true" :allSchemas="EquipmentSigning.allSchemas" /> |
|||
|
|||
<!-- 导入 --> |
|||
<ImportForm ref="importFormRef" url="/eam/equipment-signing/import" :importTemplateData="importTemplateData" @success="importSuccess" /> |
|||
</template> |
|||
|
|||
<script setup lang="ts"> |
|||
import download from '@/utils/download' |
|||
import { EquipmentSigning,EquipmentSigningRules } from './equipmentSigning.data' |
|||
import * as EquipmentSigningApi from '@/api/eam/equipmentSigning' |
|||
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' |
|||
import * as UserApi from '@/api/system/user' |
|||
|
|||
defineOptions({ name: 'EquipmentSigning' }) |
|||
|
|||
const message = useMessage() // 消息弹窗 |
|||
const { t } = useI18n() // 国际化 |
|||
|
|||
const route = useRoute() // 路由信息 |
|||
const routeName = ref() |
|||
export interface User { |
|||
id: number, |
|||
nickname: string |
|||
} |
|||
const userList = ref<User[]>([]) |
|||
routeName.value = route.name |
|||
const tableColumns = ref(EquipmentSigning.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: EquipmentSigningApi.getEquipmentSigningPage // 分页接口 |
|||
}) |
|||
|
|||
// 获得表格的各种操作 |
|||
const { getList, setSearchParams } = tableMethods |
|||
|
|||
// 列表头部按钮 |
|||
const HeadButttondata = [ |
|||
defaultButtons.defaultAddBtn({hasPermi:'eam:equipment-signing:create'}), // 新增 |
|||
// defaultButtons.defaultImportBtn({hasPermi:'eam:equipment-signing:import'}), // 导入 |
|||
// defaultButtons.defaultExportBtn({hasPermi:'eam:equipment-signing: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:equipment-signing:update'}), // 编辑 |
|||
defaultButtons.mainListDeleteBtn({hasPermi:'eam:equipment-signing:delete'}), // 删除 |
|||
] |
|||
|
|||
// 列表-操作按钮事件 |
|||
const buttonTableClick = async (val, row) => { |
|||
if (val == 'edit') { // 编辑 |
|||
openForm('update', row) |
|||
} else if (val == 'delete') { // 删除 |
|||
handleDelete(row.id) |
|||
} |
|||
} |
|||
|
|||
/** 添加/修改操作 */ |
|||
const basicFormRef = ref() |
|||
const openForm = async (type: string, row?: any) => { |
|||
userList.value = await UserApi.getSimpleUserList() |
|||
EquipmentSigning.allSchemas.formSchema.find(item => item.field == 'operationer').componentProps.options = userList.value |
|||
if(type == 'update'){ |
|||
row.operationDept = Number(row.operationDept) |
|||
row.operationer = Number(row.operationer) |
|||
} |
|||
basicFormRef.value.open(type, row) |
|||
} |
|||
|
|||
// form表单提交 |
|||
const formsSuccess = async (formType,data) => { |
|||
var isHave =EquipmentSigning.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 EquipmentSigningApi.createEquipmentSigning(data) |
|||
message.success(t('common.createSuccess')) |
|||
} else { |
|||
await EquipmentSigningApi.updateEquipmentSigning(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, 'basicEquipmentSigning') |
|||
} |
|||
|
|||
/** 删除按钮操作 */ |
|||
const handleDelete = async (id: number) => { |
|||
try { |
|||
// 删除的二次确认 |
|||
await message.delConfirm() |
|||
// 发起删除 |
|||
await EquipmentSigningApi.deleteEquipmentSigning(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 EquipmentSigningApi.exportEquipmentSigning(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() // 刷新当前列表 |
|||
} |
|||
|
|||
const onChange = async (field, cur, formRef) => { |
|||
if(field == 'operationDept'){ |
|||
userList.value = await UserApi.getUserListByDeptIds([cur]) |
|||
EquipmentSigning.allSchemas.formSchema.find(item => item.field == 'operationer').componentProps.options = userList.value |
|||
let setV = {} |
|||
setV['operationer'] = '' |
|||
formRef.value.setValues(setV) |
|||
} |
|||
|
|||
} |
|||
|
|||
|
|||
/** 初始化 **/ |
|||
onMounted(async () => { |
|||
getList() |
|||
importTemplateData.templateUrl = await EquipmentSigningApi.importTemplate() |
|||
}) |
|||
|
|||
</script> |
|||
|
@ -0,0 +1,290 @@ |
|||
<template> |
|||
<ContentWrap> |
|||
<!-- 搜索工作栏 --> |
|||
<Search :schema="ToolEquipmentIn.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" /> |
|||
</ContentWrap> |
|||
|
|||
<!-- 列表头部 --> |
|||
<TableHead |
|||
:HeadButttondata="HeadButttondata" |
|||
@button-base-click="buttonBaseClick" |
|||
:routeName="routeName" |
|||
@updataTableColumns="updataTableColumns" |
|||
@searchFormClick="searchFormClick" |
|||
:allSchemas="ToolEquipmentIn.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="ToolEquipmentInRules" |
|||
:formAllSchemas="ToolEquipmentIn.allSchemas" |
|||
:apiUpdate="ToolEquipmentInApi.updateToolEquipmentIn" |
|||
:apiCreate="ToolEquipmentInApi.createToolEquipmentIn" |
|||
@searchTableSuccess="searchTableSuccess" |
|||
:isBusiness="false" |
|||
/> |
|||
|
|||
<!-- 详情 --> |
|||
<Detail ref="detailRef" :isBasic="true" :allSchemas="ToolEquipmentIn.allSchemas" /> |
|||
|
|||
<!-- 导入 --> |
|||
<ImportForm ref="importFormRef" url="/eam/tool/tool-equipment-in/import" :importTemplateData="importTemplateData" @success="importSuccess" /> |
|||
</template> |
|||
|
|||
<script setup lang="ts"> |
|||
import download from '@/utils/download' |
|||
import { ToolEquipmentIn,ToolEquipmentInRules } from './toolEquipmentIn.data' |
|||
import * as ToolEquipmentInApi from '@/api/eam/toolEquipmentIn' |
|||
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' |
|||
import * as RelationMainPartApi from '@/api/eam/relationMainPart' |
|||
import * as EquipmentMainPartApi from '@/api/eam/equipmentMainPart' |
|||
import * as SparePartApi from '@/api/eam/sparePart' |
|||
import * as EquipmentToolSparePartApi from '@/api/eam/equipmentToolSparePart' |
|||
import * as EquipmentReportRepairRequestApi from '@/api/eam/equipmentReportRepairRequest' |
|||
import * as EquipmentSpotCheckRecordMainApi from '@/api/eam/equipmentSpotCheckRecordMain' |
|||
import * as EquipmentSpotCheckRecordDetailApi from '@/api/eam/equipmentSpotCheckRecordDetail' |
|||
import * as EquipmentInspectionRecordMainApi from '@/api/eam/equipmentInspectionRecordMain' |
|||
import * as EquipmentInspectionRecordDetailApi from '@/api/eam/equipmentInspectionRecordDetail' |
|||
import * as EquipmentRepairRecordMainApi from '@/api/eam/equipmentRepairRecordMain' |
|||
import * as EquipmentRepairRecordDetailApi from '@/api/eam/equipmentRepairRecordDetail' |
|||
import * as EquipmentMaintenanceRecordMainApi from '@/api/eam/equipmentMaintenanceRecordMain' |
|||
import * as EquipmentMaintenanceRecordDetailApi from '@/api/eam/equipmentMaintenanceRecordDetail' |
|||
import * as WorkshopApi from '@/api/wms/workshop' |
|||
import * as ProductionlineApi from '@/api/wms/productionline' |
|||
import * as EquipmentSupplierApi from '@/api/eam/equipmentSupplier' |
|||
import * as EquipmentManufacturerApi from '@/api/eam/equipmentManufacturer' |
|||
import * as ToolAccountsApi from '@/api/eam/toolAccounts' |
|||
|
|||
defineOptions({ name: 'ToolEquipmentIn' }) |
|||
|
|||
const message = useMessage() // 消息弹窗 |
|||
const { t } = useI18n() // 国际化 |
|||
|
|||
const route = useRoute() // 路由信息 |
|||
const routeName = ref() |
|||
routeName.value = route.name |
|||
const tableColumns = ref(ToolEquipmentIn.allSchemas.tableColumns) |
|||
|
|||
// 查询页面返回 |
|||
const searchTableSuccess = (formField, searchField, val, formRef) => { |
|||
nextTick(() => { |
|||
const setV = {} |
|||
setV[formField] = val[0][searchField] |
|||
if(formField == 'workshopName'){ |
|||
setV['workshopCode'] = val[0]['code'] |
|||
setV['workshopName'] = val[0]['name'] |
|||
}else if(formField == 'lineName'){ |
|||
setV['lineCode'] = val[0]['code'] |
|||
setV['lineName'] = val[0]['name'] |
|||
}else if(formField == 'manufactureName'){ |
|||
setV['manufactureCode'] = val[0]['number'] |
|||
setV['manufactureName'] = val[0]['name'] |
|||
}else if(formField == 'supplierName'){ |
|||
setV['supplierCode'] = val[0]['number'] |
|||
setV['supplierName'] = val[0]['name'] |
|||
}else if(formField == 'toolName'){ |
|||
setV['toolCode'] = val[0]['code'] |
|||
setV['toolName'] = val[0]['name'] |
|||
} |
|||
formRef.setValues(setV) |
|||
}) |
|||
} |
|||
|
|||
// 字段设置 更新主列表字段 |
|||
const updataTableColumns = (val) => { |
|||
tableColumns.value = val |
|||
} |
|||
|
|||
const { tableObject, tableMethods } = useTable({ |
|||
getListApi: ToolEquipmentInApi.getToolEquipmentInPage // 分页接口 |
|||
}) |
|||
|
|||
// 获得表格的各种操作 |
|||
const { getList, setSearchParams } = tableMethods |
|||
|
|||
// 列表头部按钮 |
|||
const HeadButttondata = [ |
|||
defaultButtons.defaultAddBtn({hasPermi:'eam:tool-equipment-in:create'}), // 新增 |
|||
defaultButtons.defaultImportBtn({hasPermi:'eam:tool-equipment-in:import'}), // 导入 |
|||
defaultButtons.defaultExportBtn({hasPermi:'eam:tool-equipment-in: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:tool-equipment-in:update'}), // 编辑 |
|||
// defaultButtons.mainListDeleteBtn({hasPermi:'eam:tool-equipment-in:delete'}), // 删除 |
|||
] |
|||
|
|||
// 列表-操作按钮事件 |
|||
const buttonTableClick = async (val, row) => { |
|||
if (val == 'edit') { // 编辑 |
|||
openForm('update', row) |
|||
} else if (val == 'delete') { // 删除 |
|||
handleDelete(row.id) |
|||
} |
|||
} |
|||
|
|||
/** 添加/修改操作 */ |
|||
const basicFormRef = ref() |
|||
const openForm = async (type: string, row?: any) => { |
|||
if(type == 'update'){ |
|||
const equipmentManufacturerNoPage = await EquipmentManufacturerApi.getEquipmentManufacturerNoPage({}) |
|||
const equipmentSupplierNoPage = await EquipmentSupplierApi.getEquipmentSupplierNoPage({}) |
|||
const workshopNoPage = await WorkshopApi.getWorkshopNoPage({}) |
|||
const productionlineNoPage = await ProductionlineApi.getProductionlineNoPage({}); |
|||
const toolAccountsListNoPage = await ToolAccountsApi.getToolAccountsNoPage({}); |
|||
row.toolName = toolAccountsListNoPage?.find(item=>item.code == row.workshopCode)?.name |
|||
row.workshopName = workshopNoPage?.find(item=>item.code == row.workshopCode)?.name |
|||
row.lineName = productionlineNoPage?.find(item=>item.code == row.lineCode)?.name |
|||
row.manufactureName = equipmentManufacturerNoPage?.find(item=>item.number == row.manufactureCode)?.name |
|||
row.supplierName = equipmentSupplierNoPage?.find(item=>item.number == row.supplierCode)?.name |
|||
} |
|||
basicFormRef.value.open(type, row) |
|||
} |
|||
|
|||
// form表单提交 |
|||
const formsSuccess = async (formType,data) => { |
|||
var isHave =ToolEquipmentIn.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 ToolEquipmentInApi.createToolEquipmentIn(data) |
|||
message.success(t('common.createSuccess')) |
|||
} else { |
|||
await ToolEquipmentInApi.updateToolEquipmentIn(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, 'basicToolEquipmentIn') |
|||
} |
|||
|
|||
/** 删除按钮操作 */ |
|||
const handleDelete = async (id: number) => { |
|||
try { |
|||
// 删除的二次确认 |
|||
await message.delConfirm() |
|||
// 发起删除 |
|||
await ToolEquipmentInApi.deleteToolEquipmentIn(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 ToolEquipmentInApi.exportToolEquipmentIn(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 ToolEquipmentInApi.importTemplate() |
|||
}) |
|||
|
|||
</script> |
@ -0,0 +1,350 @@ |
|||
import type { CrudSchema } from '@/hooks/web/useCrudSchemas' |
|||
import { dateFormatter } from '@/utils/formatTime' |
|||
import * as WorkshopApi from '@/api/wms/workshop' |
|||
import { Workshop } from '@/views/wms/basicDataManage/factoryModeling/workshop/workshop.data' |
|||
import * as ProductionlineApi from '@/api/wms/productionline' |
|||
import { Productionline } from '@/views/wms/basicDataManage/factoryModeling/productionline/productionline.data' |
|||
import { ToolAccounts} from '../toolAccounts/toolAccounts.data' |
|||
import * as ToolAccountsApi from '@/api/eam/toolAccounts' |
|||
|
|||
const workshopNoPage = await WorkshopApi.getWorkshopNoPage({}) |
|||
const productionlineNoPage = await ProductionlineApi.getProductionlineNoPage({}); |
|||
const toolAccountsListNoPage = await ToolAccountsApi.getToolAccountsNoPage({}); |
|||
|
|||
// 表单校验
|
|||
export const ToolEquipmentInRules = reactive({ |
|||
toolCode: [required], |
|||
status: [required] |
|||
}) |
|||
|
|||
export const ToolEquipmentIn = useCrudSchemas(reactive<CrudSchema[]>([ |
|||
{ |
|||
label: '工装', |
|||
field: 'toolCode', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
isDetail: false, |
|||
isForm: false, |
|||
isTable: true, |
|||
isTableForm: false, |
|||
search: { |
|||
component: 'Select', |
|||
componentProps: { |
|||
options: toolAccountsListNoPage, |
|||
optionsAlias: { |
|||
labelField: 'name', |
|||
valueField: 'code' |
|||
}, |
|||
filterable: true, |
|||
} |
|||
}, |
|||
formatter: (_: Recordable, __: TableColumn, cellValue: string) => { |
|||
return toolAccountsListNoPage.find((item) => item.code == cellValue)?.name |
|||
}, |
|||
}, |
|||
{ |
|||
label: '工装', |
|||
field: 'toolName', |
|||
sort: 'custom', |
|||
isSearch: false, |
|||
isDetail: false, |
|||
isForm: true, |
|||
isTable: false, |
|||
isTableForm: false, |
|||
form: { |
|||
// labelMessage: '信息提示说明!!!',
|
|||
componentProps: { |
|||
isSearchList: true, // 开启查询弹窗
|
|||
searchListPlaceholder: '请选择工装', // 输入框占位文本
|
|||
searchField: 'code', // 查询弹窗赋值字段
|
|||
searchTitle: '工装信息', // 查询弹窗标题
|
|||
searchAllSchemas: ToolAccounts.allSchemas, // 查询弹窗所需类
|
|||
searchPage: ToolAccountsApi.getToolAccountsPage, // 查询弹窗所需分页方法
|
|||
searchCondition: [{ |
|||
key: 'available', |
|||
value: 'TRUE', |
|||
isMainValue: false |
|||
}] |
|||
} |
|||
}, |
|||
}, |
|||
{ |
|||
label: '入库信息描述', |
|||
field: 'describing', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
form: { |
|||
component: 'Input', |
|||
componentProps: { |
|||
type: 'textarea', |
|||
} |
|||
} |
|||
}, |
|||
{ |
|||
label: '入库审核状态', |
|||
field: 'status', |
|||
sort: 'custom', |
|||
dictType: DICT_TYPE.JOB_STATUS, |
|||
dictClass: 'string', // 默认都是字符串类型其他暂不考虑
|
|||
isSearch: true, |
|||
form: { |
|||
component: 'Select' |
|||
} |
|||
}, |
|||
{ |
|||
label: '审核人', |
|||
field: 'approver', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
form: { |
|||
component: 'InputNumber', |
|||
value: 0 |
|||
} |
|||
}, |
|||
{ |
|||
label: '审核内容', |
|||
field: 'approveContent', |
|||
sort: 'custom', |
|||
isSearch: false, |
|||
form: { |
|||
component: 'Input', |
|||
componentProps: { |
|||
type: 'textarea', |
|||
} |
|||
} |
|||
}, |
|||
{ |
|||
label: '审核时间', |
|||
field: 'approveTime', |
|||
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')] |
|||
} |
|||
}, |
|||
form: { |
|||
component: 'DatePicker', |
|||
componentProps: { |
|||
type: 'datetime', |
|||
valueFormat: 'x' |
|||
} |
|||
} |
|||
}, |
|||
// {
|
|||
// label: '所属厂区编号',
|
|||
// field: 'factoryAreaCode',
|
|||
// sort: 'custom',
|
|||
// isSearch: true
|
|||
// },
|
|||
{ |
|||
label: '车间编号', |
|||
field: 'workshopCode', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
isDetail: false, |
|||
isForm: false, |
|||
isTable: true, |
|||
isTableForm: false, |
|||
search: { |
|||
component: 'Select', |
|||
componentProps: { |
|||
options: workshopNoPage, |
|||
optionsAlias: { |
|||
labelField: 'name', |
|||
valueField: 'code' |
|||
}, |
|||
filterable: true, |
|||
} |
|||
}, |
|||
formatter: (_: Recordable, __: TableColumn, cellValue: string) => { |
|||
return workshopNoPage.find((item) => item.code == cellValue)?.name |
|||
}, |
|||
}, |
|||
{ |
|||
label: '车间编号', |
|||
field: 'workshopName', |
|||
sort: 'custom', |
|||
isSearch: false, |
|||
isDetail: false, |
|||
isForm: true, |
|||
isTable: false, |
|||
isTableForm: false, |
|||
form: { |
|||
// labelMessage: '信息提示说明!!!',
|
|||
componentProps: { |
|||
isSearchList: true, // 开启查询弹窗
|
|||
searchListPlaceholder: '请选择车间代码', // 输入框占位文本
|
|||
searchField: 'code', // 查询弹窗赋值字段
|
|||
searchTitle: '车间信息', // 查询弹窗标题
|
|||
searchAllSchemas: Workshop.allSchemas, // 查询弹窗所需类
|
|||
searchPage: WorkshopApi.getWorkshopPage, // 查询弹窗所需分页方法
|
|||
disable:true, |
|||
searchCondition: [{ |
|||
key: 'available', |
|||
value: 'TRUE', |
|||
isMainValue: false |
|||
}] |
|||
} |
|||
}, |
|||
}, |
|||
{ |
|||
label: '产线编号', |
|||
field: 'lineCode', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
isDetail: false, |
|||
isForm: false, |
|||
isTable: true, |
|||
isTableForm: false, |
|||
search: { |
|||
component: 'Select', |
|||
componentProps: { |
|||
options: productionlineNoPage, |
|||
optionsAlias: { |
|||
labelField: 'name', |
|||
valueField: 'code' |
|||
}, |
|||
filterable: true, |
|||
} |
|||
}, |
|||
formatter: (_: Recordable, __: TableColumn, cellValue: string) => { |
|||
return productionlineNoPage.find((item) => item.code == cellValue)?.name |
|||
}, |
|||
}, |
|||
{ |
|||
label: '产线编号', |
|||
field: 'lineName', |
|||
sort: 'custom', |
|||
isSearch: false, |
|||
isDetail: false, |
|||
isForm: true, |
|||
isTable: false, |
|||
isTableForm: false, |
|||
form: { |
|||
// labelMessage: '信息提示说明!!!',
|
|||
componentProps: { |
|||
isSearchList: true, // 开启查询弹窗
|
|||
searchListPlaceholder: '请选择生产线代码', // 输入框占位文本
|
|||
multiple:true, |
|||
searchField: 'code', // 查询弹窗赋值字段
|
|||
searchTitle: '生产线信息', // 查询弹窗标题
|
|||
searchAllSchemas: Productionline.allSchemas, // 查询弹窗所需类
|
|||
searchPage: ProductionlineApi.getProductionlinePage, // 查询弹窗所需分页方法
|
|||
searchCondition: [{ |
|||
key:'workshopCode', |
|||
value:'workshopCode', |
|||
message: '请填写车间代码!', |
|||
isMainValue: true |
|||
},{ |
|||
key: 'available', |
|||
value: 'TRUE', |
|||
isMainValue: false |
|||
}] |
|||
} |
|||
} |
|||
}, |
|||
// {
|
|||
// label: '工序编号',
|
|||
// field: 'processCode',
|
|||
// sort: 'custom',
|
|||
// isSearch: true,
|
|||
// form:{
|
|||
// componentProps: {
|
|||
// isSearchList: true,
|
|||
// searchListPlaceholder: '请选择工序代码',
|
|||
// searchField: 'code',
|
|||
// searchTitle: '工序信息',
|
|||
// searchAllSchemas: Process.allSchemas,
|
|||
// searchPage: ProcessApi.getProcessPage,
|
|||
// searchCondition: [{
|
|||
// key:'productionLineCode',
|
|||
// value:'lineCode',
|
|||
// message: '请填写生产线代码!',
|
|||
// isMainValue: true
|
|||
// },{
|
|||
// key:'workshopCode',
|
|||
// value:'workshopCode',
|
|||
// message: '请填写车间代码!',
|
|||
// isMainValue: true
|
|||
// },{
|
|||
// key: 'available',
|
|||
// value: 'TRUE',
|
|||
// isMainValue: false
|
|||
// }]
|
|||
// }
|
|||
// },
|
|||
// },
|
|||
// {
|
|||
// label: '工位编号',
|
|||
// field: 'workstationCode',
|
|||
// sort: 'custom',
|
|||
// isSearch: true,
|
|||
// form:{
|
|||
// componentProps: {
|
|||
// isSearchList: true, // 开启查询弹窗
|
|||
// searchListPlaceholder: '请选择工位', // 输入框占位文本
|
|||
// searchField: 'code', // 查询弹窗赋值字段
|
|||
// searchTitle: '工位信息', // 查询弹窗标题
|
|||
// searchAllSchemas: Workstation.allSchemas, // 查询弹窗所需类
|
|||
// searchPage: WorkStationApi.getWorkstationPage, // 查询弹窗所需分页方法
|
|||
// searchCondition: [{
|
|||
// key:'productionLineCode',
|
|||
// value:'lineCode',
|
|||
// message: '请填写生产线代码!',
|
|||
// isMainValue: true
|
|||
// },{
|
|||
// key:'workshopCode',
|
|||
// value:'workshopCode',
|
|||
// message: '请填写车间代码!',
|
|||
// isMainValue: true
|
|||
// },{
|
|||
// key:'available',
|
|||
// value:'TRUE',
|
|||
// isMainValue: false
|
|||
// }]
|
|||
// }
|
|||
// },
|
|||
// },
|
|||
{ |
|||
label: '备注', |
|||
field: 'remark', |
|||
sort: 'custom', |
|||
isSearch: false, |
|||
form: { |
|||
component: 'Input', |
|||
componentProps: { |
|||
type: 'textarea', |
|||
} |
|||
} |
|||
}, |
|||
// {
|
|||
// label: '是否可用',
|
|||
// field: 'available',
|
|||
// sort: 'custom',
|
|||
// dictType: DICT_TYPE.TRUE_FALSE,
|
|||
// dictClass: 'string', // 默认都是字符串类型其他暂不考虑
|
|||
// isSearch: false,
|
|||
// form: {
|
|||
// component: 'Switch',
|
|||
// value: 'TRUE',
|
|||
// componentProps: {
|
|||
// inactiveValue: 'FALSE',
|
|||
// activeValue: 'TRUE'
|
|||
// }
|
|||
// }
|
|||
// },
|
|||
{ |
|||
label: '操作', |
|||
field: 'action', |
|||
isForm: false, |
|||
table: { |
|||
width: 150, |
|||
fixed: 'right' |
|||
} |
|||
} |
|||
])) |
@ -0,0 +1,253 @@ |
|||
<template> |
|||
<ContentWrap> |
|||
<!-- 搜索工作栏 --> |
|||
<Search :schema="ToolEquipmentOut.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" /> |
|||
</ContentWrap> |
|||
|
|||
<!-- 列表头部 --> |
|||
<TableHead |
|||
:HeadButttondata="HeadButttondata" |
|||
@button-base-click="buttonBaseClick" |
|||
:routeName="routeName" |
|||
@updataTableColumns="updataTableColumns" |
|||
@searchFormClick="searchFormClick" |
|||
:allSchemas="ToolEquipmentOut.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="ToolEquipmentOutRules" |
|||
:formAllSchemas="ToolEquipmentOut.allSchemas" |
|||
:apiUpdate="ToolEquipmentOutApi.updateToolEquipmentOut" |
|||
:apiCreate="ToolEquipmentOutApi.createToolEquipmentOut" |
|||
@searchTableSuccess="searchTableSuccess" |
|||
:isBusiness="false" |
|||
/> |
|||
|
|||
<!-- 详情 --> |
|||
<Detail ref="detailRef" :isBasic="true" :allSchemas="ToolEquipmentOut.allSchemas" /> |
|||
|
|||
<!-- 导入 --> |
|||
<ImportForm ref="importFormRef" url="/eam/tool/tool-equipment-out/import" :importTemplateData="importTemplateData" @success="importSuccess" /> |
|||
</template> |
|||
|
|||
<script setup lang="ts"> |
|||
import download from '@/utils/download' |
|||
import { ToolEquipmentOut,ToolEquipmentOutRules } from './toolEquipmentOut.data' |
|||
import * as ToolEquipmentOutApi from '@/api/eam/toolEquipmentOut' |
|||
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' |
|||
import * as ToolAccountsApi from '@/api/eam/toolAccounts' |
|||
|
|||
defineOptions({ name: 'ToolEquipmentOut' }) |
|||
|
|||
const message = useMessage() // 消息弹窗 |
|||
const { t } = useI18n() // 国际化 |
|||
|
|||
const route = useRoute() // 路由信息 |
|||
const routeName = ref() |
|||
routeName.value = route.name |
|||
const tableColumns = ref(ToolEquipmentOut.allSchemas.tableColumns) |
|||
|
|||
// 查询页面返回 |
|||
const searchTableSuccess = (formField, searchField, val, formRef) => { |
|||
nextTick(() => { |
|||
const setV = {} |
|||
setV[formField] = val[0][searchField] |
|||
if(formField == 'toolName'){ |
|||
setV['toolCode'] = val[0]['code'] |
|||
setV['toolName'] = val[0]['name'] |
|||
} |
|||
formRef.setValues(setV) |
|||
}) |
|||
} |
|||
|
|||
// 字段设置 更新主列表字段 |
|||
const updataTableColumns = (val) => { |
|||
tableColumns.value = val |
|||
} |
|||
|
|||
const { tableObject, tableMethods } = useTable({ |
|||
getListApi: ToolEquipmentOutApi.getToolEquipmentOutPage // 分页接口 |
|||
}) |
|||
|
|||
// 获得表格的各种操作 |
|||
const { getList, setSearchParams } = tableMethods |
|||
|
|||
// 列表头部按钮 |
|||
const HeadButttondata = [ |
|||
defaultButtons.defaultAddBtn({hasPermi:'eam:tool-equipment-out:create'}), // 新增 |
|||
defaultButtons.defaultImportBtn({hasPermi:'eam:tool-equipment-out:import'}), // 导入 |
|||
defaultButtons.defaultExportBtn({hasPermi:'eam:tool-equipment-out: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:tool-equipment-out:update'}), // 编辑 |
|||
// defaultButtons.mainListDeleteBtn({hasPermi:'eam:tool-equipment-out:delete'}), // 删除 |
|||
] |
|||
|
|||
// 列表-操作按钮事件 |
|||
const buttonTableClick = async (val, row) => { |
|||
if (val == 'edit') { // 编辑 |
|||
openForm('update', row) |
|||
} else if (val == 'delete') { // 删除 |
|||
handleDelete(row.id) |
|||
} |
|||
} |
|||
|
|||
/** 添加/修改操作 */ |
|||
const basicFormRef = ref() |
|||
const openForm = async (type: string, row?: any) => { |
|||
if(type == 'update'){ |
|||
const toolAccountsListNoPage = await ToolAccountsApi.getToolAccountsNoPage({}); |
|||
row.toolName = toolAccountsListNoPage?.find(item=>item.code == row.toolCode)?.name |
|||
} |
|||
basicFormRef.value.open(type, row) |
|||
} |
|||
|
|||
// form表单提交 |
|||
const formsSuccess = async (formType,data) => { |
|||
var isHave =ToolEquipmentOut.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 ToolEquipmentOutApi.createToolEquipmentOut(data) |
|||
message.success(t('common.createSuccess')) |
|||
} else { |
|||
await ToolEquipmentOutApi.updateToolEquipmentOut(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, 'basicToolEquipmentOut') |
|||
} |
|||
|
|||
/** 删除按钮操作 */ |
|||
const handleDelete = async (id: number) => { |
|||
try { |
|||
// 删除的二次确认 |
|||
await message.delConfirm() |
|||
// 发起删除 |
|||
await ToolEquipmentOutApi.deleteToolEquipmentOut(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 ToolEquipmentOutApi.exportToolEquipmentOut(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 ToolEquipmentOutApi.importTemplate() |
|||
}) |
|||
|
|||
</script> |
@ -0,0 +1,230 @@ |
|||
import type { CrudSchema } from '@/hooks/web/useCrudSchemas' |
|||
import { dateFormatter } from '@/utils/formatTime' |
|||
import { ToolAccounts} from '../toolAccounts/toolAccounts.data' |
|||
import * as ToolAccountsApi from '@/api/eam/toolAccounts' |
|||
import * as UserApi from '@/api/system/user' |
|||
const toolAccountsListNoPage = await ToolAccountsApi.getToolAccountsNoPage({}); |
|||
const userListNoPage = await UserApi.getSimpleUserList(); |
|||
|
|||
// 表单校验
|
|||
export const ToolEquipmentOutRules = reactive({ |
|||
theme: [required], |
|||
toolCode: [required], |
|||
type: [required], |
|||
qty: [required], |
|||
status: [required], |
|||
applyer: [required], |
|||
concurrencyStamp: [required] |
|||
}) |
|||
|
|||
export const ToolEquipmentOut = useCrudSchemas(reactive<CrudSchema[]>([ |
|||
{ |
|||
label: '工装', |
|||
field: 'toolCode', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
isDetail: false, |
|||
isForm: false, |
|||
isTable: true, |
|||
isTableForm: false, |
|||
search: { |
|||
component: 'Select', |
|||
componentProps: { |
|||
options: toolAccountsListNoPage, |
|||
optionsAlias: { |
|||
labelField: 'name', |
|||
valueField: 'code' |
|||
}, |
|||
filterable: true, |
|||
} |
|||
}, |
|||
formatter: (_: Recordable, __: TableColumn, cellValue: string) => { |
|||
return toolAccountsListNoPage.find((item) => item.code == cellValue)?.name |
|||
}, |
|||
}, |
|||
{ |
|||
label: '工装', |
|||
field: 'toolName', |
|||
sort: 'custom', |
|||
isSearch: false, |
|||
isDetail: false, |
|||
isForm: true, |
|||
isTable: false, |
|||
isTableForm: false, |
|||
form: { |
|||
// labelMessage: '信息提示说明!!!',
|
|||
componentProps: { |
|||
isSearchList: true, // 开启查询弹窗
|
|||
searchListPlaceholder: '请选择工装', // 输入框占位文本
|
|||
searchField: 'code', // 查询弹窗赋值字段
|
|||
searchTitle: '工装信息', // 查询弹窗标题
|
|||
searchAllSchemas: ToolAccounts.allSchemas, // 查询弹窗所需类
|
|||
searchPage: ToolAccountsApi.getToolAccountsPage, // 查询弹窗所需分页方法
|
|||
searchCondition: [{ |
|||
key: 'available', |
|||
value: 'TRUE', |
|||
isMainValue: false |
|||
}] |
|||
} |
|||
}, |
|||
}, |
|||
{ |
|||
label: '出库主题', |
|||
field: 'theme', |
|||
sort: 'custom', |
|||
isSearch: true |
|||
}, |
|||
{ |
|||
label: '出库类型', |
|||
field: 'type', |
|||
sort: 'custom', |
|||
dictType: DICT_TYPE.TOOL_OUT_TYPE, |
|||
dictClass: 'string', // 默认都是字符串类型其他暂不考虑
|
|||
isSearch: true, |
|||
form: { |
|||
component: 'Select' |
|||
} |
|||
}, |
|||
{ |
|||
label: '数量', |
|||
field: 'qty', |
|||
sort: 'custom', |
|||
isSearch: false, |
|||
form: { |
|||
component: 'InputNumber', |
|||
value: 0 |
|||
} |
|||
}, |
|||
{ |
|||
label: '流程状态', |
|||
field: 'status', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
dictType: DICT_TYPE.JOB_STATUS, |
|||
dictClass: 'string', // 默认都是字符串类型其他暂不考虑
|
|||
form: { |
|||
component: 'Select', |
|||
} |
|||
}, |
|||
{ |
|||
label: '出库申请人', |
|||
field: 'applyer', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
form: { |
|||
component: 'Select', |
|||
componentProps: { |
|||
options: userListNoPage, |
|||
optionsAlias: { |
|||
labelField: 'nickname', |
|||
valueField: 'id' |
|||
} |
|||
} |
|||
}, |
|||
formatter: (_: Recordable, __: TableColumn, cellValue: number) => { |
|||
return userListNoPage.find((item) => item.id == cellValue)?.nickname |
|||
}, |
|||
}, |
|||
{ |
|||
label: '审核人', |
|||
field: 'approver', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
form: { |
|||
component: 'Select', |
|||
componentProps: { |
|||
options: userListNoPage, |
|||
optionsAlias: { |
|||
labelField: 'nickname', |
|||
valueField: 'id' |
|||
} |
|||
} |
|||
}, |
|||
formatter: (_: Recordable, __: TableColumn, cellValue: number) => { |
|||
return userListNoPage.find((item) => item.id == cellValue)?.nickname |
|||
}, |
|||
}, |
|||
{ |
|||
label: '审核内容', |
|||
field: 'approveContent', |
|||
sort: 'custom', |
|||
isSearch: false, |
|||
form: { |
|||
component: 'Input', |
|||
componentProps: { |
|||
type: 'textarea', |
|||
} |
|||
} |
|||
}, |
|||
{ |
|||
label: '审核时间', |
|||
field: 'approveTime', |
|||
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')] |
|||
} |
|||
}, |
|||
form: { |
|||
component: 'DatePicker', |
|||
componentProps: { |
|||
type: 'datetime', |
|||
valueFormat: 'x' |
|||
} |
|||
} |
|||
}, |
|||
{ |
|||
label: '自动审核', |
|||
field: 'autoExamine', |
|||
sort: 'custom', |
|||
isForm: false, |
|||
}, |
|||
{ |
|||
label: '自动通过', |
|||
field: 'autoAgree', |
|||
sort: 'custom', |
|||
isForm: false, |
|||
}, |
|||
{ |
|||
label: '备注', |
|||
field: 'remark', |
|||
sort: 'custom', |
|||
isSearch: false, |
|||
form: { |
|||
component: 'Input', |
|||
componentProps: { |
|||
type: 'textarea', |
|||
} |
|||
} |
|||
}, |
|||
// {
|
|||
// label: '是否可用',
|
|||
// field: 'available',
|
|||
// sort: 'custom',
|
|||
// dictType: DICT_TYPE.TRUE_FALSE,
|
|||
// dictClass: 'string', // 默认都是字符串类型其他暂不考虑
|
|||
// isSearch: false,
|
|||
// 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