chenfang
6 months ago
106 changed files with 3248 additions and 148 deletions
@ -0,0 +1,61 @@ |
|||
import request from '@/config/axios' |
|||
import {EquipmentMainPartVO} from "@/api/eam/equipmentMainPart"; |
|||
|
|||
export interface InspectionItemSelectSetVO { |
|||
id: number |
|||
name: string |
|||
itemCode: string |
|||
departmentCode: string |
|||
remark: string |
|||
siteId: string |
|||
available: string |
|||
deletionTime: Date |
|||
deleterId: byte[] |
|||
concurrencyStamp: number |
|||
} |
|||
|
|||
// 查询巡检项选择集列表
|
|||
export const getInspectionItemSelectSetPage = async (params) => { |
|||
if (params.isSearch) { |
|||
delete params.isSearch |
|||
const data = {...params} |
|||
return await request.post({ url: '/eam/inspection-item-select-set/senior', data }) |
|||
} else { |
|||
return await request.get({ url: `/eam/inspection-item-select-set/page`, params }) |
|||
} |
|||
} |
|||
|
|||
// 查询巡检项选择集详情
|
|||
export const getInspectionItemSelectSet = async (id: number) => { |
|||
return await request.get({ url: `/eam/inspection-item-select-set/get?id=` + id }) |
|||
} |
|||
|
|||
// 新增巡检项选择集
|
|||
export const createInspectionItemSelectSet = async (data: InspectionItemSelectSetVO) => { |
|||
return await request.post({ url: `/eam/inspection-item-select-set/create`, data }) |
|||
} |
|||
|
|||
// 修改巡检项选择集
|
|||
export const updateInspectionItemSelectSet = async (data: InspectionItemSelectSetVO) => { |
|||
return await request.put({ url: `/eam/inspection-item-select-set/update`, data }) |
|||
} |
|||
|
|||
// 删除巡检项选择集
|
|||
export const deleteInspectionItemSelectSet = async (id: number) => { |
|||
return await request.delete({ url: `/eam/inspection-item-select-set/delete?id=` + id }) |
|||
} |
|||
|
|||
// 导出巡检项选择集 Excel
|
|||
export const exportInspectionItemSelectSet = async (params) => { |
|||
return await request.download({ url: `/eam/inspection-item-select-set/export-excel`, params }) |
|||
} |
|||
|
|||
// 下载用户导入模板
|
|||
export const importTemplate = () => { |
|||
return request.download({ url: '/eam/inspection-item-select-set/get-import-template' }) |
|||
} |
|||
|
|||
// 启用 / 禁用
|
|||
export const updateEnableCode = async (data: EquipmentMainPartVO) => { |
|||
return await request.post({ url: `/eam/inspection-item-select-set/ables` , data }) |
|||
} |
@ -0,0 +1,61 @@ |
|||
import request from '@/config/axios' |
|||
|
|||
export interface MaintenanceItemVO { |
|||
id: number |
|||
content: string |
|||
serialNumber: number |
|||
equipmentParts: string |
|||
departmentCode: string |
|||
remark: string |
|||
siteId: string |
|||
available: string |
|||
deletionTime: Date |
|||
deleterId: byte[] |
|||
concurrencyStamp: number |
|||
} |
|||
|
|||
// 查询保养项维护列表
|
|||
export const getMaintenanceItemPage = async (params) => { |
|||
if (params.isSearch) { |
|||
delete params.isSearch |
|||
const data = {...params} |
|||
return await request.post({ url: '/eam/basic/maintenance-item/senior', data }) |
|||
} else { |
|||
return await request.get({ url: `/eam/basic/maintenance-item/page`, params }) |
|||
} |
|||
} |
|||
|
|||
// 查询保养项维护详情
|
|||
export const getMaintenanceItem = async (id: number) => { |
|||
return await request.get({ url: `/eam/basic/maintenance-item/get?id=` + id }) |
|||
} |
|||
|
|||
// 新增保养项维护
|
|||
export const createMaintenanceItem = async (data: MaintenanceItemVO) => { |
|||
return await request.post({ url: `/eam/basic/maintenance-item/create`, data }) |
|||
} |
|||
|
|||
// 修改保养项维护
|
|||
export const updateMaintenanceItem = async (data: MaintenanceItemVO) => { |
|||
return await request.put({ url: `/eam/basic/maintenance-item/update`, data }) |
|||
} |
|||
|
|||
// 删除保养项维护
|
|||
export const deleteMaintenanceItem = async (id: number) => { |
|||
return await request.delete({ url: `/eam/basic/maintenance-item/delete?id=` + id }) |
|||
} |
|||
|
|||
// 导出保养项维护 Excel
|
|||
export const exportMaintenanceItem = async (params) => { |
|||
if (params.isSearch) { |
|||
const data = { ...params } |
|||
return await request.downloadPost({ url: `/eam/basic/maintenance-item/export-excel-senior`, data }) |
|||
} else { |
|||
return await request.download({ url: `/eam/basic/maintenance-item/export-excel`, params }) |
|||
} |
|||
} |
|||
|
|||
// 下载用户导入模板
|
|||
export const importTemplate = () => { |
|||
return request.download({ url: '/eam/basic/maintenance-item/get-import-template' }) |
|||
} |
@ -0,0 +1,79 @@ |
|||
import request from '@/config/axios' |
|||
|
|||
export interface ToolAccountsVO { |
|||
id: number |
|||
code: string |
|||
name: string |
|||
specification: string |
|||
type: string |
|||
equity: string |
|||
electricMachine: string |
|||
isCustomerAptitude: boolean |
|||
customerId: string |
|||
storageLocation: string |
|||
useDept: string |
|||
principal: string |
|||
principalTelephone: string |
|||
status: string |
|||
startDate: Date |
|||
supplierCode: string |
|||
purchaseTime: Date |
|||
purchaseDept: string |
|||
purchaser: string |
|||
productionDate: Date |
|||
manufactureCode: string |
|||
equipmentLife: string |
|||
acceptanceDate: Date |
|||
purchasePrice: number |
|||
factoryAreaCode: string |
|||
workshopCode: string |
|||
workshopSectionCode: string |
|||
departmentCode: string |
|||
remark: string |
|||
siteId: string |
|||
available: string |
|||
deletionTime: Date |
|||
deleterId: byte[] |
|||
concurrencyStamp: number |
|||
} |
|||
|
|||
// 查询工装台账列表
|
|||
export const getToolAccountsPage = async (params) => { |
|||
if (params.isSearch) { |
|||
delete params.isSearch |
|||
const data = {...params} |
|||
return await request.post({ url: '/eam/tool-accounts/senior', data }) |
|||
} else { |
|||
return await request.get({ url: `/eam/tool-accounts/page`, params }) |
|||
} |
|||
} |
|||
|
|||
// 查询工装台账详情
|
|||
export const getToolAccounts = async (id: number) => { |
|||
return await request.get({ url: `/eam/tool-accounts/get?id=` + id }) |
|||
} |
|||
|
|||
// 新增工装台账
|
|||
export const createToolAccounts = async (data: ToolAccountsVO) => { |
|||
return await request.post({ url: `/eam/tool-accounts/create`, data }) |
|||
} |
|||
|
|||
// 修改工装台账
|
|||
export const updateToolAccounts = async (data: ToolAccountsVO) => { |
|||
return await request.put({ url: `/eam/tool-accounts/update`, data }) |
|||
} |
|||
|
|||
// 删除工装台账
|
|||
export const deleteToolAccounts = async (id: number) => { |
|||
return await request.delete({ url: `/eam/tool-accounts/delete?id=` + id }) |
|||
} |
|||
|
|||
// 导出工装台账 Excel
|
|||
export const exportToolAccounts = async (params) => { |
|||
return await request.download({ url: `/eam/tool-accounts/export-excel`, params }) |
|||
} |
|||
|
|||
// 下载用户导入模板
|
|||
export const importTemplate = () => { |
|||
return request.download({ url: '/eam/tool-accounts/get-import-template' }) |
|||
} |
@ -0,0 +1,61 @@ |
|||
import request from '@/config/axios' |
|||
|
|||
export interface ToolModVO { |
|||
id: number |
|||
modCode: string |
|||
toolCode: string |
|||
type: string |
|||
departmentCode: string |
|||
remark: string |
|||
siteId: string |
|||
available: string |
|||
deletionTime: Date |
|||
deleterId: byte[] |
|||
concurrencyStamp: number |
|||
} |
|||
|
|||
// 查询工装物料关联列表
|
|||
export const getToolModPage = async (params) => { |
|||
if (params.isSearch) { |
|||
delete params.isSearch |
|||
const data = {...params} |
|||
return await request.post({ url: '/eam/basic/tool-mod/senior', data }) |
|||
} else { |
|||
return await request.get({ url: `/eam/basic/tool-mod/page`, params }) |
|||
} |
|||
} |
|||
|
|||
// 查询工装物料关联详情
|
|||
export const getToolMod = async (id: number) => { |
|||
return await request.get({ url: `/eam/basic/tool-mod/get?id=` + id }) |
|||
} |
|||
|
|||
// 新增工装物料关联
|
|||
export const createToolMod = async (data: ToolModVO) => { |
|||
return await request.post({ url: `/eam/basic/tool-mod/create`, data }) |
|||
} |
|||
|
|||
// 修改工装物料关联
|
|||
export const updateToolMod = async (data: ToolModVO) => { |
|||
return await request.put({ url: `/eam/basic/tool-mod/update`, data }) |
|||
} |
|||
|
|||
// 删除工装物料关联
|
|||
export const deleteToolMod = async (id: number) => { |
|||
return await request.delete({ url: `/eam/basic/tool-mod/delete?id=` + id }) |
|||
} |
|||
|
|||
// 导出工装物料关联 Excel
|
|||
export const exportToolMod = async (params) => { |
|||
return await request.download({ url: `/eam/basic/tool-mod/export-excel`, params }) |
|||
} |
|||
|
|||
// 下载用户导入模板
|
|||
export const importTemplate = () => { |
|||
return request.download({ url: '/eam/basic/tool-mod/get-import-template' }) |
|||
} |
|||
|
|||
// 新增工装物料关联
|
|||
export const createToolModBatch = async (data: ToolModVO) => { |
|||
return await request.post({ url: `/eam/basic/tool-mod/createBatch`, data }) |
|||
} |
After Width: | Height: | Size: 607 KiB |
After Width: | Height: | Size: 146 KiB |
Before Width: | Height: | Size: 4.8 KiB After Width: | Height: | Size: 52 KiB |
@ -0,0 +1,287 @@ |
|||
<template> |
|||
<ContentWrap> |
|||
<!-- 搜索工作栏 --> |
|||
<Search :schema="InspectionItemSelectSet.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" /> |
|||
</ContentWrap> |
|||
|
|||
<!-- 列表头部 --> |
|||
<TableHead |
|||
:HeadButttondata="HeadButttondata" |
|||
@button-base-click="buttonBaseClick" |
|||
:routeName="routeName" |
|||
@updataTableColumns="updataTableColumns" |
|||
@searchFormClick="searchFormClick" |
|||
:allSchemas="InspectionItemSelectSet.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 #name="{row}"> |
|||
<el-button type="primary" link @click="openDetail(row, '代码', row.name)"> |
|||
<span>{{ row.name }}</span> |
|||
</el-button> |
|||
</template> |
|||
<template #action="{ row }"> |
|||
<ButtonBase :Butttondata="butttondata(row)" @button-base-click="buttonTableClick($event,row)" /> |
|||
</template> |
|||
</Table> |
|||
</ContentWrap> |
|||
|
|||
<!-- 表单弹窗:添加/修改 --> |
|||
<teamForm ref="basicFormRef" @success="getData"/> |
|||
|
|||
<!-- 详情 --> |
|||
<Detail ref="detailRef" :isBasic="true" :allSchemas="InspectionItemSelectSet.allSchemas" /> |
|||
|
|||
<!-- 导入 --> |
|||
<ImportForm ref="importFormRef" url="/eam/inspection-item-select-set/import" :importTemplateData="importTemplateData" @success="importSuccess" /> |
|||
</template> |
|||
|
|||
<script setup lang="ts"> |
|||
import download from '@/utils/download' |
|||
import { InspectionItemSelectSet,InspectionItemSelectSetRules } from './inspectionItemSelectSet.data' |
|||
import * as InspectionItemSelectSetApi from '@/api/eam/inspectionItemSelectSet' |
|||
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 TeamForm from "@/views/eam/inspectionItemSelectSet/itemSelectSetForm.vue"; |
|||
|
|||
defineOptions({ name: 'InspectionItemSelectSet' }) |
|||
|
|||
const message = useMessage() // 消息弹窗 |
|||
const { t } = useI18n() // 国际化 |
|||
|
|||
const route = useRoute() // 路由信息 |
|||
const routeName = ref() |
|||
routeName.value = route.name |
|||
const tableColumns = ref(InspectionItemSelectSet.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: InspectionItemSelectSetApi.getInspectionItemSelectSetPage // 分页接口 |
|||
}) |
|||
|
|||
// 获得表格的各种操作 |
|||
const { getList, setSearchParams } = tableMethods |
|||
|
|||
// 列表头部按钮 |
|||
const HeadButttondata = [ |
|||
defaultButtons.defaultAddBtn({hasPermi:'eam:inspectionItemSelectSet:create'}), // 新增 |
|||
//defaultButtons.defaultImportBtn({hasPermi:'eam:inspectionItemSelectSet:import'}), // 导入 |
|||
//defaultButtons.defaultExportBtn({hasPermi:'eam:inspectionItemSelectSet: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 isShowMainButton = (row,val) => { |
|||
if (val.indexOf(row.available) > -1) { |
|||
return false |
|||
} else { |
|||
return true |
|||
} |
|||
} |
|||
|
|||
// 列表-操作按钮 |
|||
const butttondata = (row) => { |
|||
return [ |
|||
defaultButtons.mainListEditBtn({hasPermi:'eam:inspectionItemSelectSet:update'}), // 编辑 |
|||
//defaultButtons.mainListDeleteBtn({hasPermi:'eam:equipmentMainPart:delete'}), // 删除 |
|||
defaultButtons.mainListEnableBtn({hide:isShowMainButton(row,['FALSE']),hasPermi:'eam:inspectionItemSelectSet:update'}), |
|||
defaultButtons.mainListDisableBtn({hide:isShowMainButton(row,['TRUE']),hasPermi:'eam:inspectionItemSelectSet:update'}), |
|||
] |
|||
} |
|||
|
|||
// 列表-操作按钮事件 |
|||
const buttonTableClick = async (val, row) => { |
|||
if (val == 'edit') { // 编辑 |
|||
openForm('update', row) |
|||
} else if (val == 'delete') { // 删除 |
|||
handleDelete(row.id) |
|||
} else if (val == 'enable') { |
|||
handleEnable(row.id) |
|||
} else if (val == 'disable') { |
|||
handleDisable(row.id) |
|||
} |
|||
} |
|||
|
|||
/** 添加/修改操作 */ |
|||
const basicFormRef = ref() |
|||
const openForm = (type: string, row?: any) => { |
|||
basicFormRef.value.open(type, row) |
|||
} |
|||
|
|||
// form表单提交 |
|||
const formsSuccess = async (formType,data) => { |
|||
var isHave =InspectionItemSelectSet.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 InspectionItemSelectSetApi.createInspectionItemSelectSet(data) |
|||
message.success(t('common.createSuccess')) |
|||
} else { |
|||
await InspectionItemSelectSetApi.updateInspectionItemSelectSet(data) |
|||
message.success(t('common.updateSuccess')) |
|||
} |
|||
basicFormRef.value.dialogVisible = false |
|||
getList() |
|||
} |
|||
|
|||
//刷新页面 |
|||
const getData = async() => { |
|||
getList(); |
|||
} |
|||
|
|||
/** 详情操作 */ |
|||
const detailRef = ref() |
|||
const openDetail = (row: any, titleName: any, titleValue: any) => { |
|||
detailRef.value.openDetail(row, titleName, titleValue, 'basicInspectionItemSelectSet') |
|||
} |
|||
|
|||
/** 删除按钮操作 */ |
|||
const handleDelete = async (id: number) => { |
|||
try { |
|||
// 删除的二次确认 |
|||
await message.delConfirm() |
|||
// 发起删除 |
|||
await InspectionItemSelectSetApi.deleteInspectionItemSelectSet(id) |
|||
message.success(t('common.delSuccess')) |
|||
// 刷新列表 |
|||
await getList() |
|||
} catch {} |
|||
} |
|||
|
|||
/** 启用 */ |
|||
const handleEnable = async (id: number) => { |
|||
try { |
|||
const params = ref({ |
|||
id: '', |
|||
available:'', |
|||
}) |
|||
params.value.id = id |
|||
params.value.available = 'TRUE' |
|||
await InspectionItemSelectSetApi.updateEnableCode(params.value) |
|||
message.success(t('common.updateSuccess')) |
|||
// 刷新列表 |
|||
await getList() |
|||
} catch {} |
|||
} |
|||
/** 禁用 */ |
|||
const handleDisable = async (id: number) => { |
|||
try { |
|||
const params = ref({ |
|||
id: '', |
|||
available:'', |
|||
}) |
|||
params.value.id = id |
|||
params.value.available = 'FALSE' |
|||
await InspectionItemSelectSetApi.updateEnableCode(params.value) |
|||
message.success(t('common.updateSuccess')) |
|||
// 刷新列表 |
|||
await getList() |
|||
} catch {} |
|||
} |
|||
|
|||
/** 导出按钮操作 */ |
|||
const exportLoading = ref(false) // 导出的加载中 |
|||
const handleExport = async () => { |
|||
try { |
|||
// 导出的二次确认 |
|||
await message.exportConfirm() |
|||
// 发起导出 |
|||
exportLoading.value = true |
|||
const data = await InspectionItemSelectSetApi.exportInspectionItemSelectSet(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() |
|||
}) |
|||
|
|||
</script> |
@ -0,0 +1,141 @@ |
|||
import type { CrudSchema } from '@/hooks/web/useCrudSchemas' |
|||
import { dateFormatter } from '@/utils/formatTime' |
|||
|
|||
// 表单校验
|
|||
export const InspectionItemSelectSetRules = reactive({ |
|||
name: [required], |
|||
itemCode: [required], |
|||
concurrencyStamp: [required], |
|||
}) |
|||
|
|||
export const InspectionItemSelectSet = useCrudSchemas(reactive<CrudSchema[]>([ |
|||
{ |
|||
label: 'id', |
|||
field: 'id', |
|||
sort: 'custom', |
|||
isSearch: false, |
|||
isTable: false, |
|||
isForm: false, |
|||
isDetail:false, |
|||
}, |
|||
{ |
|||
label: '选择集名称', |
|||
field: 'name', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
}, |
|||
{ |
|||
label: '项编号', |
|||
field: 'itemCode', |
|||
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: 'departmentCode', |
|||
sort: 'custom', |
|||
isSearch: false, |
|||
isTable: false, |
|||
isForm: false, |
|||
isDetail:false, |
|||
}, |
|||
{ |
|||
label: '备注', |
|||
field: 'remark', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
}, |
|||
{ |
|||
label: '地点ID', |
|||
field: 'siteId', |
|||
sort: 'custom', |
|||
isSearch: false, |
|||
isTable: false, |
|||
isForm: false, |
|||
isDetail:false, |
|||
}, |
|||
{ |
|||
label: '是否可用', |
|||
field: 'available', |
|||
sort: 'custom', |
|||
dictType: DICT_TYPE.TRUE_FALSE, |
|||
dictClass: 'string', // 默认都是字符串类型其他暂不考虑
|
|||
isTable: true, |
|||
isDetail: false, |
|||
isSearch: true, |
|||
isTableForm: false, |
|||
isForm: false, |
|||
}, |
|||
{ |
|||
label: '删除时间', |
|||
field: 'deletionTime', |
|||
sort: 'custom', |
|||
formatter: dateFormatter, |
|||
isSearch: false, |
|||
isTable: false, |
|||
isForm: false, |
|||
isDetail: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: '删除人id', |
|||
field: 'deleterId', |
|||
sort: 'custom', |
|||
isSearch: false, |
|||
isTable: false, |
|||
isForm: false, |
|||
isDetail:false, |
|||
}, |
|||
{ |
|||
label: '并发乐观锁', |
|||
field: 'concurrencyStamp', |
|||
sort: 'custom', |
|||
isSearch: false, |
|||
isTable: false, |
|||
isForm: false, |
|||
isDetail:false, |
|||
form: { |
|||
component: 'InputNumber', |
|||
value: 0 |
|||
}, |
|||
}, |
|||
{ |
|||
label: '操作', |
|||
field: 'action', |
|||
isForm: false, |
|||
table: { |
|||
width: 150, |
|||
fixed: 'right' |
|||
} |
|||
} |
|||
])) |
@ -0,0 +1,283 @@ |
|||
<template> |
|||
<Dialog v-model="dialogVisible" :title="dialogTitle"> |
|||
<el-form |
|||
ref="basicFormRef" |
|||
v-loading="formLoading" |
|||
:model="formData" |
|||
:rules="formRules" |
|||
label-width="100px" |
|||
> |
|||
<el-row> |
|||
<el-col :span="12"> |
|||
<el-form-item label="选择集名称" prop="name"> |
|||
<el-input v-model="formData.name" placeholder="选择集名称" :disabled="isDisabled"/> |
|||
</el-form-item> |
|||
</el-col> |
|||
<el-col :span="12"> |
|||
<el-form-item label="备注" prop="remark"> |
|||
<el-input v-model="formData.remark" placeholder="请输入备注名称" /> |
|||
</el-form-item> |
|||
</el-col> |
|||
</el-row> |
|||
|
|||
<el-row> |
|||
<el-col :span="24"> |
|||
<el-form-item label="巡检项" prop="items"> |
|||
<div class="tag-container flex gap-2"> |
|||
<el-tag v-for="ent in tags" :key="ent.content" closable :disable-transitions="false" @close="handleClose(ent.id)"> |
|||
{{ ent.content}} |
|||
</el-tag> |
|||
<el-input v-if="inputVisible" ref="InputRef" v-model="inputValue" class="w-20" size="small"/> |
|||
<el-button v-else class="button-new-tag" size="small" @click="addItem"> |
|||
添加巡检项 + |
|||
</el-button> |
|||
</div> |
|||
</el-form-item> |
|||
</el-col> |
|||
</el-row> |
|||
</el-form> |
|||
<template #footer> |
|||
<el-button :disabled="formLoading" type="primary" @click="submitForm">确 定</el-button> |
|||
<el-button @click="dialogVisible = false">取 消</el-button> |
|||
</template> |
|||
</Dialog> |
|||
|
|||
<!--添加巡检项弹窗--> |
|||
<SearchTable ref="searchTableRef" @searchTableSuccess="searchTableSuccess" /> |
|||
|
|||
</template> |
|||
<script lang="ts" setup> |
|||
import * as SelectSetApi from '@/api/eam/inspectionItemSelectSet' |
|||
import request from "@/config/axios"; |
|||
import { SearchTable } from '@/components/SearchTable' |
|||
import { InspectionItem} from "@/views/eam/inspectionItem/inspectionItem.data"; |
|||
import * as inspectionItemApi from "@/api/eam/inspectionItem"; |
|||
import {ElInput} from "element-plus"; |
|||
|
|||
defineOptions({ name: 'TeamForm' }) |
|||
|
|||
const { t } = useI18n() // 国际化 |
|||
const message = useMessage() // 消息弹窗 |
|||
|
|||
const dialogVisible = ref(false) // 弹窗的是否展示 |
|||
const dialogTitle = ref('') // 弹窗的标题 |
|||
const formLoading = ref(false) // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用 |
|||
const formType = ref('') // 表单的类型:create - 新增;update - 修改 |
|||
const tags=ref([]) |
|||
|
|||
const inputValue = ref('') |
|||
const inputVisible = ref(false) |
|||
const isDisabled = ref(false) |
|||
const InputRef = ref<InstanceType<typeof ElInput>>() |
|||
|
|||
const itemData = ref({ |
|||
id: '', |
|||
content: '' |
|||
}) |
|||
|
|||
const formData = ref({ |
|||
id: '', |
|||
name: '', |
|||
itemCode: '', |
|||
available: 'TRUE', |
|||
remark: '', |
|||
createTime: '' |
|||
}) |
|||
const formRules = reactive({ |
|||
name: [ |
|||
{ required: true, message: '选择集名称不能为空', trigger: 'blur' }, |
|||
{ max: 50, message: '不得超过50个字符', trigger: 'blur' } |
|||
], |
|||
remark: [ |
|||
{ max: 50, message: '不得超过50个字符', trigger: 'blur' } |
|||
], |
|||
items: [ |
|||
{ required: true, message: '巡检项不能为空', trigger: 'blur' }, |
|||
], |
|||
}) |
|||
const basicFormRef = ref() // 表单 Ref |
|||
|
|||
/** 删除巡检项 */ |
|||
const handleClose = (id: string) => { |
|||
const index = tags.value.findIndex(tag => tag.id === id); |
|||
if (index !== -1) { |
|||
tags.value.splice(index, 1); |
|||
} |
|||
} |
|||
|
|||
/** 弹窗相关参数 */ |
|||
const searchTableRef = ref(); |
|||
const _searchTableTitle = ref(); |
|||
const _searchTableAllSchemas = ref(); |
|||
const _searchTablePage = ref(); |
|||
const _formField = ref(); |
|||
const _searchField = ref(); |
|||
const _multiple = ref(); |
|||
const _type = ref(); |
|||
const _row = ref(); |
|||
const _searchCondition = ref({}) |
|||
|
|||
|
|||
const addItem = () =>{ |
|||
addItemCommon(true,'xunJianItem') |
|||
} |
|||
|
|||
/** 选择巡检项弹窗 */ |
|||
const addItemCommon = (multiple,field) => { |
|||
_searchCondition.value = {} |
|||
const filters: any[] = [] |
|||
filters.push({ |
|||
action: "==", |
|||
column: 'available', |
|||
value: 'TRUE' |
|||
}) |
|||
// 参数整理 |
|||
_searchCondition.value.isSearch = true |
|||
_searchCondition.value.filters = filters |
|||
_searchTableTitle.value = '选择巡检项' |
|||
_multiple.value = multiple |
|||
_formField.value = field |
|||
_searchField.value = field |
|||
_searchTablePage.value = inspectionItemApi.getInspectionItemPage |
|||
_searchTableAllSchemas.value = InspectionItem.allSchemas |
|||
openCommon() |
|||
} |
|||
|
|||
/** 弹窗选择之后 回调函数 添加选择集 */ |
|||
const searchTableSuccess = (formField, searchField, val, formRef, type, row ) => { |
|||
nextTick?.(() => { |
|||
if (formField === 'xunJianItem') { |
|||
val.forEach(item => { |
|||
const isExist = tags.value.some(tag => tag.content === item.content); |
|||
if (!isExist){ |
|||
const newItem = {}; |
|||
newItem['content'] = item.content; |
|||
newItem['id'] = item.id; |
|||
tags.value.push(newItem); |
|||
} |
|||
}); |
|||
} |
|||
}) |
|||
} |
|||
/*打开弹窗*/ |
|||
const openCommon = () => { |
|||
searchTableRef.value.open( |
|||
_searchTableTitle.value, |
|||
_searchTableAllSchemas.value, |
|||
_searchTablePage.value, |
|||
_formField.value, |
|||
_searchField.value, |
|||
_multiple.value, |
|||
_type.value, |
|||
_row.value, |
|||
_searchCondition.value |
|||
) |
|||
} |
|||
/** 初始化弹窗 */ |
|||
const open = async (type: string, row?: object) => { |
|||
dialogVisible.value = true |
|||
dialogTitle.value = t('action.' + type) |
|||
formType.value = type |
|||
// 修改时,设置数据 |
|||
if (row) { |
|||
tags.value=[]; |
|||
isDisabled.value = true; |
|||
formLoading.value = true |
|||
formData.value = row; |
|||
let item = (row.itemCode).split(",") |
|||
try { |
|||
for (var i = 0; i < item.length; i++) { |
|||
itemData.value = await request.get({ url: `/eam/basic/inspection-item/get?id=` + item[i] }); |
|||
tags.value.push(itemData.value); |
|||
} |
|||
} finally { |
|||
formLoading.value = false |
|||
} |
|||
} |
|||
// 新增时 |
|||
else { |
|||
resetForm() |
|||
isDisabled.value = false; |
|||
} |
|||
} |
|||
defineExpose({ open }) // 提供 open 方法,用于打开弹窗 |
|||
|
|||
/** 提交表单 */ |
|||
const emit = defineEmits(['success']) // 定义 success 事件,用于操作成功后的回调 |
|||
const submitForm = async () => { |
|||
// 校验表单 |
|||
// if (!basicFormRef) return |
|||
// const valid = await basicFormRef.value.validate() |
|||
// if (!valid) return |
|||
if (tags.value.length > 10 ){ |
|||
message.warning('巡检项最多10个'); |
|||
return |
|||
} |
|||
|
|||
let result = ''; |
|||
for (var i = 0; i < tags.value.length; i++) { |
|||
result += tags.value[i].id + ','; |
|||
} |
|||
if(result.endsWith(',')){ |
|||
result = result.substring(0,result.length -1) |
|||
} |
|||
formData.value.itemCode = result |
|||
// 提交请求 |
|||
formLoading.value = true |
|||
//formData.value.members = JSON.stringify(tags.value) |
|||
try { |
|||
const data = formData.value as unknown as SelectSetApi.InspectionItemSelectSetVO |
|||
if (formType.value === 'create') { |
|||
await SelectSetApi.createInspectionItemSelectSet(data) |
|||
message.success(t('common.createSuccess')) |
|||
} else { |
|||
await SelectSetApi.updateInspectionItemSelectSet(data) |
|||
message.success(t('common.updateSuccess')) |
|||
} |
|||
dialogVisible.value = false |
|||
// 发送操作成功的事件 |
|||
emit('success') |
|||
} finally { |
|||
formLoading.value = false |
|||
} |
|||
} |
|||
|
|||
/** 重置表单 */ |
|||
const resetForm = () => { |
|||
formData.value = { |
|||
id: '', |
|||
name: '', |
|||
itemCode: '', |
|||
available: 'TRUE', |
|||
remark: '', |
|||
createTime: '' |
|||
} |
|||
tags.value=[]; |
|||
basicFormRef.value?.resetFields() |
|||
} |
|||
|
|||
</script> |
|||
|
|||
<style scoped> |
|||
.tag-container { |
|||
margin-top: 10px; /* 可根据需要调整标签容器与表单项之间的间距 */ |
|||
border: 1px solid #ccc; /* 添加边框样式 */ |
|||
padding: 10px; /* 可根据需要调整容器内边距 */ |
|||
width: 950px; /* 设置固定宽度为 950px */ |
|||
overflow-y: auto; /* 当内容溢出容器高度时显示滚动条 */ |
|||
word-wrap: break-word; /* 使用 word-wrap 属性实现超出范围换行 */ |
|||
overflow-wrap: break-word; /* 兼容性更好的写法 */ |
|||
flex-wrap: wrap; |
|||
} |
|||
.input-with-button { |
|||
display: flex; |
|||
align-items: center; |
|||
width: 100%; |
|||
} |
|||
|
|||
.input-with-button > .el-input { |
|||
flex: 1; |
|||
/*margin-right: 10px;*/ |
|||
} |
|||
|
|||
</style> |
@ -0,0 +1,268 @@ |
|||
<template> |
|||
<ContentWrap> |
|||
<!-- 搜索工作栏 --> |
|||
<Search :schema="MaintenanceItem.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" /> |
|||
</ContentWrap> |
|||
|
|||
<!-- 列表头部 --> |
|||
<TableHead |
|||
:HeadButttondata="HeadButttondata" |
|||
@button-base-click="buttonBaseClick" |
|||
:routeName="routeName" |
|||
@updataTableColumns="updataTableColumns" |
|||
@searchFormClick="searchFormClick" |
|||
:allSchemas="MaintenanceItem.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(row)" @button-base-click="buttonTableClick($event,row)" /> |
|||
</template> |
|||
</Table> |
|||
</ContentWrap> |
|||
|
|||
<!-- 表单弹窗:添加/修改 --> |
|||
<BasicForm |
|||
ref="basicFormRef" |
|||
@success="formsSuccess" |
|||
:rules="MaintenanceItemRules" |
|||
:formAllSchemas="MaintenanceItem.allSchemas" |
|||
:apiUpdate="MaintenanceItemApi.updateMaintenanceItem" |
|||
:apiCreate="MaintenanceItemApi.createMaintenanceItem" |
|||
@searchTableSuccess="searchTableSuccess" |
|||
:isBusiness="false" |
|||
/> |
|||
|
|||
<!-- 详情 --> |
|||
<Detail ref="detailRef" :isBasic="true" :allSchemas="MaintenanceItem.allSchemas" /> |
|||
|
|||
<!-- 导入 --> |
|||
<ImportForm ref="importFormRef" url="/eam/basic/maintenance-item/import" :importTemplateData="importTemplateData" @success="importSuccess" /> |
|||
</template> |
|||
|
|||
<script setup lang="ts"> |
|||
import download from '@/utils/download' |
|||
import { MaintenanceItem,MaintenanceItemRules } from './maintenanceItem.data' |
|||
import * as MaintenanceItemApi from '@/api/eam/maintenanceItem' |
|||
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: 'MaintenanceItem' }) |
|||
|
|||
const message = useMessage() // 消息弹窗 |
|||
const { t } = useI18n() // 国际化 |
|||
|
|||
const route = useRoute() // 路由信息 |
|||
const routeName = ref() |
|||
routeName.value = route.name |
|||
const tableColumns = ref(MaintenanceItem.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: MaintenanceItemApi.getMaintenanceItemPage // 分页接口 |
|||
}) |
|||
|
|||
const judgeStatus = (row) =>{ |
|||
if(row.available === 'TRUE'){ |
|||
return true |
|||
}else{ |
|||
return false |
|||
} |
|||
} |
|||
|
|||
// 获得表格的各种操作 |
|||
const { getList, setSearchParams } = tableMethods |
|||
|
|||
// 列表头部按钮 |
|||
const HeadButttondata = [ |
|||
defaultButtons.defaultAddBtn({hasPermi:'eam:maintenance-item:create'}), // 新增 |
|||
defaultButtons.defaultImportBtn({hasPermi:'eam:maintenance-item:import'}), // 导入 |
|||
defaultButtons.defaultExportBtn({hasPermi:'eam:maintenance-item: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 = (row) => { |
|||
return [ |
|||
defaultButtons.mainListEditBtn({hasPermi:'eam:maintenance-item:update'}), // 编辑 |
|||
defaultButtons.mainListEnableBtn({hasPermi:'eam:maintenance-item:enable',hide: judgeStatus(row)}), // 启用 |
|||
defaultButtons.mainListDisableBtn({hasPermi:'eam:maintenance-item:disable',hide: !judgeStatus(row)}), // 禁用 |
|||
// defaultButtons.mainListDeleteBtn({hasPermi:'eam:maintenance-item:delete'}), // 删除 |
|||
]} |
|||
|
|||
// 列表-操作按钮事件 |
|||
const buttonTableClick = async (val, row) => { |
|||
if (val == 'edit') { // 编辑 |
|||
openForm('update', row) |
|||
} else if (val == 'delete') { // 删除 |
|||
handleDelete(row.id) |
|||
} else if (val == 'enable') { // 启用 |
|||
handleEnable(row,'TRUE') |
|||
}else if (val == 'disable') {// 禁用 |
|||
handleEnable(row,'FALSE') |
|||
} |
|||
} |
|||
|
|||
/** 添加/修改操作 */ |
|||
const basicFormRef = ref() |
|||
const openForm = (type: string, row?: any) => { |
|||
basicFormRef.value.open(type, row) |
|||
} |
|||
|
|||
// form表单提交 |
|||
const formsSuccess = async (formType,data) => { |
|||
var isHave =MaintenanceItem.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 MaintenanceItemApi.createMaintenanceItem(data) |
|||
message.success(t('common.createSuccess')) |
|||
} else { |
|||
await MaintenanceItemApi.updateMaintenanceItem(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, 'basicMaintenanceItem') |
|||
} |
|||
|
|||
/** 删除按钮操作 */ |
|||
const handleDelete = async (id: number) => { |
|||
try { |
|||
// 删除的二次确认 |
|||
await message.delConfirm() |
|||
// 发起删除 |
|||
await MaintenanceItemApi.deleteMaintenanceItem(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 MaintenanceItemApi.exportMaintenanceItem(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 handleEnable = (row,enable) =>{ |
|||
message.confirm(t('您确定'+(enable=='TRUE'?'启用':'禁用')+'该项吗, 是否继续?')).then(() => { |
|||
row.available = enable |
|||
MaintenanceItemApi.updateMaintenanceItem(row).then(res => { |
|||
message.success(t('common.updateSuccess')) |
|||
}) |
|||
}) |
|||
} |
|||
|
|||
/** 初始化 **/ |
|||
onMounted(async () => { |
|||
getList() |
|||
importTemplateData.templateUrl = await MaintenanceItemApi.importTemplate() |
|||
}) |
|||
|
|||
</script> |
@ -0,0 +1,106 @@ |
|||
import type { CrudSchema } from '@/hooks/web/useCrudSchemas' |
|||
import { dateFormatter } from '@/utils/formatTime' |
|||
import { handleTreeToComponentOptions } from '@/utils/tree' |
|||
import * as DeptApi from '@/api/system/dept' |
|||
const deptList = ref<Tree[]>([]) // 树形结构
|
|||
|
|||
// 加载部门树(默认格式)
|
|||
deptList.value = handleTreeToComponentOptions(await DeptApi.getSimpleDeptList()) |
|||
|
|||
// 表单校验
|
|||
export const MaintenanceItemRules = reactive({ |
|||
content: [required], |
|||
serialNumber: [required], |
|||
concurrencyStamp: [required] |
|||
}) |
|||
|
|||
export const MaintenanceItem = useCrudSchemas(reactive<CrudSchema[]>([ |
|||
|
|||
{ |
|||
label: '序号', |
|||
field: 'serialNumber', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
fixed: 'left', |
|||
form: { |
|||
component:'InputNumber' |
|||
}, |
|||
}, |
|||
{ |
|||
label: '保养内容', |
|||
field: 'content', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
form: { |
|||
component: 'Input', |
|||
componentProps: { |
|||
type: 'textarea', |
|||
rows: 4 |
|||
}, |
|||
colProps: { |
|||
span: 24 |
|||
} |
|||
} |
|||
}, |
|||
{ |
|||
label: '保养部位', |
|||
field: 'equipmentParts', |
|||
sort: 'custom', |
|||
isSearch: true |
|||
}, |
|||
{ |
|||
label: '部门', |
|||
field: 'departmentCode', |
|||
sort: 'custom', |
|||
isTable: false, |
|||
isDetail: false, |
|||
isSearch: false, |
|||
isTableForm: false, |
|||
form: { |
|||
component: 'TreeSelect', |
|||
componentProps: { // 假设deptList是部门数据列表
|
|||
data: deptList, |
|||
placeholder: "请选择部门", |
|||
filterable: true, |
|||
// multiple: true,
|
|||
} |
|||
} |
|||
}, |
|||
{ |
|||
label: '备注', |
|||
field: 'remark', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
form: { |
|||
component: 'Input', |
|||
componentProps: { |
|||
type: 'textarea', |
|||
rows: 4 |
|||
}, |
|||
colProps: { |
|||
span: 24 |
|||
} |
|||
} |
|||
}, |
|||
{ |
|||
label: '是否可用', |
|||
field: 'available', |
|||
sort: 'custom', |
|||
dictType: DICT_TYPE.TRUE_FALSE, |
|||
dictClass: 'string', // 默认都是字符串类型其他暂不考虑
|
|||
isTable: true, |
|||
isDetail: false, |
|||
isSearch: false, |
|||
isTableForm: false, |
|||
isForm: false, |
|||
}, |
|||
{ |
|||
label: '操作', |
|||
field: 'action', |
|||
isForm: false, |
|||
table: { |
|||
width: 150, |
|||
fixed: 'right' |
|||
} |
|||
} |
|||
])) |
@ -0,0 +1,244 @@ |
|||
<template> |
|||
<ContentWrap> |
|||
<!-- 搜索工作栏 --> |
|||
<Search :schema="ToolAccounts.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" /> |
|||
</ContentWrap> |
|||
|
|||
<!-- 列表头部 --> |
|||
<TableHead |
|||
:HeadButttondata="HeadButttondata" |
|||
@button-base-click="buttonBaseClick" |
|||
:routeName="routeName" |
|||
@updataTableColumns="updataTableColumns" |
|||
@searchFormClick="searchFormClick" |
|||
:allSchemas="ToolAccounts.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="ToolAccountsRules" |
|||
:formAllSchemas="ToolAccounts.allSchemas" |
|||
:apiUpdate="ToolAccountsApi.updateToolAccounts" |
|||
:apiCreate="ToolAccountsApi.createToolAccounts" |
|||
@searchTableSuccess="searchTableSuccess" |
|||
:isBusiness="false" |
|||
/> |
|||
|
|||
<!-- 详情 --> |
|||
<Detail ref="detailRef" :isBasic="true" :allSchemas="ToolAccounts.allSchemas" /> |
|||
|
|||
<!-- 导入 --> |
|||
<ImportForm ref="importFormRef" url="/eam/tool-accounts/import" :importTemplateData="importTemplateData" @success="importSuccess" /> |
|||
</template> |
|||
|
|||
<script setup lang="ts"> |
|||
import download from '@/utils/download' |
|||
import { ToolAccounts,ToolAccountsRules } from './toolAccounts.data' |
|||
import * as ToolAccountsApi from '@/api/eam/toolAccounts' |
|||
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: 'ToolAccounts' }) |
|||
|
|||
const message = useMessage() // 消息弹窗 |
|||
const { t } = useI18n() // 国际化 |
|||
|
|||
const route = useRoute() // 路由信息 |
|||
const routeName = ref() |
|||
routeName.value = route.name |
|||
const tableColumns = ref(ToolAccounts.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: ToolAccountsApi.getToolAccountsPage // 分页接口 |
|||
}) |
|||
|
|||
// 获得表格的各种操作 |
|||
const { getList, setSearchParams } = tableMethods |
|||
|
|||
// 列表头部按钮 |
|||
const HeadButttondata = [ |
|||
defaultButtons.defaultAddBtn({hasPermi:'eam:tool-accounts:create'}), // 新增 |
|||
defaultButtons.defaultImportBtn({hasPermi:'eam:tool-accounts:import'}), // 导入 |
|||
defaultButtons.defaultExportBtn({hasPermi:'eam:tool-accounts: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-accounts:update'}), // 编辑 |
|||
defaultButtons.mainListDeleteBtn({hasPermi:'eam:tool-accounts: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 =ToolAccounts.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 ToolAccountsApi.createToolAccounts(data) |
|||
message.success(t('common.createSuccess')) |
|||
} else { |
|||
await ToolAccountsApi.updateToolAccounts(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, 'basicToolAccounts') |
|||
} |
|||
|
|||
/** 删除按钮操作 */ |
|||
const handleDelete = async (id: number) => { |
|||
try { |
|||
// 删除的二次确认 |
|||
await message.delConfirm() |
|||
// 发起删除 |
|||
await ToolAccountsApi.deleteToolAccounts(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 ToolAccountsApi.exportToolAccounts(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 ToolAccountsApi.importTemplate() |
|||
}) |
|||
|
|||
</script> |
@ -0,0 +1,279 @@ |
|||
import type { CrudSchema } from '@/hooks/web/useCrudSchemas' |
|||
import { dateFormatter } from '@/utils/formatTime' |
|||
|
|||
// 表单校验
|
|||
export const ToolAccountsRules = reactive({ |
|||
code: [required], |
|||
name: [required], |
|||
concurrencyStamp: [required] |
|||
}) |
|||
|
|||
export const ToolAccounts = useCrudSchemas(reactive<CrudSchema[]>([ |
|||
{ |
|||
label: '工装编号', |
|||
field: 'code', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
isForm: false, |
|||
}, |
|||
{ |
|||
label: '名称', |
|||
field: 'name', |
|||
sort: 'custom', |
|||
isSearch: true |
|||
}, |
|||
{ |
|||
label: '型号', |
|||
field: 'specification', |
|||
sort: 'custom', |
|||
isSearch: true |
|||
}, |
|||
{ |
|||
label: '类型', |
|||
field: 'type', |
|||
sort: 'custom', |
|||
isSearch: false, |
|||
form: { |
|||
component: 'Select' |
|||
} |
|||
}, |
|||
{ |
|||
label: '产权', |
|||
field: 'equity', |
|||
sort: 'custom', |
|||
isSearch: false |
|||
}, |
|||
{ |
|||
label: '电机', |
|||
field: 'electricMachine', |
|||
sort: 'custom', |
|||
isSearch: false |
|||
}, |
|||
{ |
|||
label: '是否客户资质', |
|||
field: 'isCustomerAptitude', |
|||
sort: 'custom', |
|||
isSearch: false, |
|||
form: { |
|||
component: 'Switch' |
|||
} |
|||
}, |
|||
{ |
|||
label: '客户id', |
|||
field: 'customerId', |
|||
sort: 'custom', |
|||
isSearch: false |
|||
}, |
|||
{ |
|||
label: '存放位置', |
|||
field: 'storageLocation', |
|||
sort: 'custom', |
|||
isSearch: false |
|||
}, |
|||
{ |
|||
label: '使用部门', |
|||
field: 'useDept', |
|||
sort: 'custom', |
|||
isSearch: false |
|||
}, |
|||
{ |
|||
label: '负责人', |
|||
field: 'principal', |
|||
sort: 'custom', |
|||
isSearch: false |
|||
}, |
|||
{ |
|||
label: '负责人联系方式', |
|||
field: 'principalTelephone', |
|||
sort: 'custom', |
|||
isSearch: false |
|||
}, |
|||
{ |
|||
label: '设备状态', |
|||
field: 'status', |
|||
sort: 'custom', |
|||
isSearch: false, |
|||
form: { |
|||
component: 'Switch' |
|||
} |
|||
}, |
|||
{ |
|||
label: '启用日期', |
|||
field: 'startDate', |
|||
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: 'supplierCode', |
|||
sort: 'custom', |
|||
isSearch: false |
|||
}, |
|||
{ |
|||
label: '采购时间', |
|||
field: 'purchaseTime', |
|||
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: 'purchaseDept', |
|||
sort: 'custom', |
|||
isSearch: true |
|||
}, |
|||
{ |
|||
label: '采购人', |
|||
field: 'purchaser', |
|||
sort: 'custom', |
|||
isSearch: true |
|||
}, |
|||
{ |
|||
label: '出厂日期', |
|||
field: 'productionDate', |
|||
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: 'manufactureCode', |
|||
sort: 'custom', |
|||
isSearch: false |
|||
}, |
|||
{ |
|||
label: '设备使用寿命', |
|||
field: 'equipmentLife', |
|||
sort: 'custom', |
|||
isSearch: false |
|||
}, |
|||
{ |
|||
label: '验收日期', |
|||
field: 'acceptanceDate', |
|||
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: 'purchasePrice', |
|||
sort: 'custom', |
|||
isSearch: false |
|||
}, |
|||
{ |
|||
label: '所属厂区编号', |
|||
field: 'factoryAreaCode', |
|||
sort: 'custom', |
|||
isSearch: true |
|||
}, |
|||
{ |
|||
label: '车间编号', |
|||
field: 'workshopCode', |
|||
sort: 'custom', |
|||
isSearch: true |
|||
}, |
|||
{ |
|||
label: '工段编号', |
|||
field: 'workshopSectionCode', |
|||
sort: 'custom', |
|||
isSearch: true |
|||
}, |
|||
{ |
|||
label: '部门', |
|||
field: 'departmentCode', |
|||
sort: 'custom', |
|||
isSearch: false |
|||
}, |
|||
{ |
|||
label: '备注', |
|||
field: 'remark', |
|||
sort: 'custom', |
|||
isSearch: false |
|||
}, |
|||
// {
|
|||
// 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,285 @@ |
|||
<template> |
|||
<ContentWrap> |
|||
<!-- 搜索工作栏 --> |
|||
<Search :schema="ToolMod.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" /> |
|||
</ContentWrap> |
|||
|
|||
<!-- 列表头部 --> |
|||
<TableHead |
|||
:HeadButttondata="HeadButttondata" |
|||
@button-base-click="buttonBaseClick" |
|||
:routeName="routeName" |
|||
@updataTableColumns="updataTableColumns" |
|||
@searchFormClick="searchFormClick" |
|||
:allSchemas="ToolMod.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(row)" @button-base-click="buttonTableClick($event,row)" /> |
|||
</template> |
|||
</Table> |
|||
</ContentWrap> |
|||
|
|||
<!-- 表单弹窗:添加/修改 --> |
|||
<!-- <BasicForm |
|||
ref="basicFormRef" |
|||
@success="formsSuccess" |
|||
:rules="ToolModRules" |
|||
:formAllSchemas="ToolMod.allSchemas" |
|||
:apiUpdate="ToolModApi.updateToolMod" |
|||
:apiCreate="ToolModApi.createToolMod" |
|||
@searchTableSuccess="searchTableSuccess" |
|||
:isBusiness="false" |
|||
/> --> |
|||
|
|||
<!-- 详情 --> |
|||
<Detail ref="detailRef" :isBasic="true" :allSchemas="ToolMod.allSchemas" /> |
|||
|
|||
<!-- 导入 --> |
|||
<ImportForm ref="importFormRef" url="/eam/basic/tool-mod/import" :importTemplateData="importTemplateData" @success="importSuccess" /> |
|||
|
|||
<!-- 表单弹窗:添加/修改 --> |
|||
<teamForm ref="basicFormRef" @success="formsSuccess" :formAllSchemas="ToolMod.allSchemas"/> |
|||
</template> |
|||
|
|||
<script setup lang="ts"> |
|||
import download from '@/utils/download' |
|||
import { ToolMod,ToolModRules } from './toolMod.data' |
|||
import * as ToolModApi from '@/api/eam/toolMod' |
|||
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 TeamForm from "./operateForm.vue"; |
|||
defineOptions({ name: 'ToolMod' }) |
|||
|
|||
const message = useMessage() // 消息弹窗 |
|||
const { t } = useI18n() // 国际化 |
|||
|
|||
const route = useRoute() // 路由信息 |
|||
const routeName = ref() |
|||
routeName.value = route.name |
|||
const tableColumns = ref(ToolMod.allSchemas.tableColumns) |
|||
|
|||
// 字段设置 更新主列表字段 |
|||
const updataTableColumns = (val) => { |
|||
tableColumns.value = val |
|||
} |
|||
|
|||
const { tableObject, tableMethods } = useTable({ |
|||
getListApi: ToolModApi.getToolModPage // 分页接口 |
|||
}) |
|||
const judgeStatus = (row) =>{ |
|||
if(row.available === 'TRUE'){ |
|||
return true |
|||
}else{ |
|||
return false |
|||
} |
|||
} |
|||
// 获得表格的各种操作 |
|||
const { getList, setSearchParams } = tableMethods |
|||
|
|||
// 列表头部按钮 |
|||
const HeadButttondata = [ |
|||
defaultButtons.defaultAddBtn({hasPermi:'eam:tool-mod:create'}), // 新增 |
|||
defaultButtons.defaultImportBtn({hasPermi:'eam:tool-mod:import'}), // 导入 |
|||
defaultButtons.defaultExportBtn({hasPermi:'eam:tool-mod: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 = (row) => { |
|||
return [ |
|||
defaultButtons.mainListEditBtn({hasPermi:'eam:tool-mod:update'}), // 编辑 |
|||
defaultButtons.mainListEnableBtn({hasPermi:'eam:tool-mod:enable',hide: judgeStatus(row)}), // 启用 |
|||
defaultButtons.mainListDisableBtn({hasPermi:'eam:tool-mod:disable',hide: !judgeStatus(row)}), // 禁用 |
|||
// defaultButtons.mainListDeleteBtn({hasPermi:'eam:tool-mod:delete'}), // 删除 |
|||
]} |
|||
|
|||
// 列表-操作按钮事件 |
|||
const buttonTableClick = async (val, row) => { |
|||
if (val == 'edit') { // 编辑 |
|||
openForm('update', row) |
|||
} else if (val == 'delete') { // 删除 |
|||
handleDelete(row.id) |
|||
} else if (val == 'enable') { // 启用 |
|||
handleEnable(row,'TRUE') |
|||
}else if (val == 'disable') {// 禁用 |
|||
handleEnable(row,'FALSE') |
|||
} |
|||
} |
|||
|
|||
/** 添加/修改操作 */ |
|||
const basicFormRef = ref() |
|||
const openForm = (type: string, row?: any) => { |
|||
basicFormRef.value.open(type, row) |
|||
} |
|||
|
|||
// form表单提交 |
|||
const formsSuccess = async (formType,data) => { |
|||
var isHave =ToolMod.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 ToolModApi.createToolMod(data) |
|||
message.success(t('common.createSuccess')) |
|||
} else { |
|||
await ToolModApi.updateToolMod(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, 'basicToolMod') |
|||
} |
|||
|
|||
/** 删除按钮操作 */ |
|||
const handleDelete = async (id: number) => { |
|||
try { |
|||
// 删除的二次确认 |
|||
await message.delConfirm() |
|||
// 发起删除 |
|||
await ToolModApi.deleteToolMod(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 ToolModApi.exportToolMod(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 searchTableSuccess = (formField, searchField, val, formRef) => { |
|||
nextTick(() => { |
|||
const setV = {} |
|||
if (formField == 'modCodeShow') { |
|||
let str = '' |
|||
let modCodeList = Array(String) |
|||
val.forEach((element) => { |
|||
str += element.name + ':' + element.code + ',' |
|||
modCodeList.push(element.code) |
|||
}) |
|||
str = str.substring(0, str.length - 1) |
|||
setV['modCodeShow'] = str |
|||
setV['modCodeList'] = modCodeList |
|||
formRef.setValues(setV); |
|||
}else if(formField == 'toolCodeShow'){ |
|||
let str = val[0].name + ':' + val[0].code |
|||
str = str.substring(0, str.length - 1) |
|||
setV['toolCodeShow'] = str |
|||
setV['toolCode'] = val[0].code |
|||
formRef.setValues(setV); |
|||
} |
|||
}) |
|||
} |
|||
|
|||
const handleEnable = (row,enable) =>{ |
|||
message.confirm(t('您确定'+(enable=='TRUE'?'启用':'禁用')+'该项吗, 是否继续?')).then(() => { |
|||
row.available = enable |
|||
ToolModApi.updateToolMod(row).then(res => { |
|||
message.success(t('common.updateSuccess')) |
|||
}) |
|||
}) |
|||
} |
|||
|
|||
/** 初始化 **/ |
|||
onMounted(async () => { |
|||
getList() |
|||
importTemplateData.templateUrl = await ToolModApi.importTemplate() |
|||
}) |
|||
|
|||
</script> |
@ -0,0 +1,320 @@ |
|||
<template> |
|||
<Dialog v-model="dialogVisible" :title="dialogTitle"> |
|||
<el-form |
|||
ref="basicFormRef" |
|||
v-loading="formLoading" |
|||
:model="formData" |
|||
:rules="formRules" |
|||
label-width="80px" |
|||
> |
|||
<el-row> |
|||
<el-col :span="24"> |
|||
<el-form-item label="工装" prop="toolCode"> |
|||
<div class="tag-container flex gap-2"> |
|||
<el-tag v-for="ent in toolCodeList" :key="ent.code" closable :disable-transitions="false" |
|||
@close="handleToolClose(ent.code)"> |
|||
{{ ent.name}} |
|||
</el-tag> |
|||
<el-input |
|||
v-if="inputToolVisible" |
|||
ref="InputRef" |
|||
v-model="inputToolValue" |
|||
class="w-20" |
|||
size="small" |
|||
/> |
|||
<el-button v-else class="button-new-tag" size="small" @click="addTool"> |
|||
选定工装 + |
|||
</el-button> |
|||
</div> |
|||
</el-form-item> |
|||
</el-col> |
|||
<el-col :span="24"> |
|||
<el-form-item label="物料" prop="modCodeList"> |
|||
<div class="tag-container flex gap-2"> |
|||
<el-tag v-for="ent in tags" :key="ent.code" closable :disable-transitions="false" |
|||
@close="handleClose(ent.code)"> |
|||
{{ ent.name}} |
|||
</el-tag> |
|||
<el-input |
|||
v-if="inputVisible" |
|||
ref="InputRef" |
|||
v-model="inputValue" |
|||
class="w-20" |
|||
size="small" |
|||
/> |
|||
<el-button v-else class="button-new-tag" size="small" @click="addMod"> |
|||
添加物料 + |
|||
</el-button> |
|||
</div> |
|||
</el-form-item> |
|||
</el-col> |
|||
</el-row> |
|||
<el-row> |
|||
<el-col :span="12"> |
|||
<el-form-item label="类型" prop="type"> |
|||
<el-select v-model="formData.type" placeholder="请选择类型"> |
|||
<el-option |
|||
v-for="dict in getStrDictOptions(DICT_TYPE.DEVICE_TYPE)" |
|||
:key="dict.value" |
|||
:label="dict.label" |
|||
:value="dict.value" |
|||
/> |
|||
</el-select> |
|||
</el-form-item> |
|||
</el-col> |
|||
<el-col :span="12"> |
|||
<el-form-item label="备注" prop="remark"> |
|||
<el-input v-model="formData.remark" placeholder="请输入内容" /> |
|||
</el-form-item> |
|||
</el-col> |
|||
</el-row> |
|||
</el-form> |
|||
<template #footer> |
|||
<el-button :disabled="formLoading" type="primary" @click="submitForm">确 定</el-button> |
|||
<el-button @click="dialogVisible = false">取 消</el-button> |
|||
</template> |
|||
</Dialog> |
|||
|
|||
<!--添加班组人员弹窗--> |
|||
<SearchTable ref="searchTableRef" @searchTableSuccess="searchTableSuccess" /> |
|||
|
|||
</template> |
|||
<script lang="ts" setup> |
|||
import { DICT_TYPE, getStrDictOptions } from '@/utils/dict' |
|||
import request from "@/config/axios"; |
|||
import download from '@/utils/download' |
|||
import { ToolMod,ToolModRules } from './toolMod.data' |
|||
import {Itembasic} from "@/views/wms/basicDataManage/itemManage/itembasic/itembasic.data"; |
|||
import * as ItembasicApi from "@/api/wms/itembasic"; |
|||
import { ToolAccounts,ToolAccountsRules } from '../toolAccounts/toolAccounts.data' |
|||
import * as ToolAccountsApi from '@/api/eam/toolAccounts' |
|||
import * as ToolModApi from '@/api/eam/toolMod' |
|||
import * as defaultButtons from '@/utils/disposition/defaultButtons' |
|||
defineOptions({ name: 'OperateForm' }) |
|||
|
|||
const { t } = useI18n() // 国际化 |
|||
const message = useMessage() // 消息弹窗 |
|||
|
|||
const dialogVisible = ref(false) // 弹窗的是否展示 |
|||
const dialogTitle = ref('') // 弹窗的标题 |
|||
const formLoading = ref(false) // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用 |
|||
const formType = ref('') // 表单的类型:create - 新增;update - 修改 |
|||
const tags=ref([]) |
|||
const toolCodeList = ref([]) |
|||
const inputValue = ref('') |
|||
const inputToolValue = ref('') |
|||
const inputVisible = ref(false) |
|||
const inputToolVisible = ref(false) |
|||
const isDisabled = ref(false) |
|||
const isToolDisabled = ref(false) |
|||
const InputRef = ref<InstanceType<typeof ElInput>>() |
|||
|
|||
const formData = ref({ |
|||
toolCode: '', |
|||
modCodeList: [], |
|||
type: null, |
|||
remark: '' |
|||
}) |
|||
const formRules = reactive({ |
|||
modCodeList: [required], |
|||
toolCode: [required], |
|||
type: [required], |
|||
concurrencyStamp: [required] |
|||
}) |
|||
const basicFormRef = ref() // 表单 Ref |
|||
const handleClose = (code) => { |
|||
tags.value = tags.value.filter(item=>{ |
|||
return item.code!=code |
|||
}) |
|||
} |
|||
const handleToolClose = (code) => { |
|||
toolCodeList.value = toolCodeList.value.filter(item=>{ |
|||
return item.code!=code |
|||
}) |
|||
} |
|||
/** 弹窗相关参数 */ |
|||
const searchTableRef = ref(); |
|||
const _searchTableTitle = ref(); |
|||
const _searchTableAllSchemas = ref(); |
|||
const _searchTablePage = ref(); |
|||
const _formField = ref(); |
|||
const _searchField = ref(); |
|||
const _multiple = ref(); |
|||
const _type = ref(); |
|||
const _row = ref(); |
|||
const _searchCondition = ref({}) |
|||
|
|||
const addTool = () =>{ |
|||
addToolCommon(true,'toolCodeList') |
|||
} |
|||
const addMod = () =>{ |
|||
addModCommon(true,'modCodeList') |
|||
} |
|||
|
|||
|
|||
/** 选择物料弹窗 */ |
|||
const addModCommon = (multiple,field) => { |
|||
_searchCondition.value = {} |
|||
const filters: any[] = [] |
|||
filters.push({ |
|||
action: "==", |
|||
column: 'available', |
|||
value: 'TRUE' |
|||
}) |
|||
// 参数整理 |
|||
_searchCondition.value.isSearch = true |
|||
_searchCondition.value.filters = filters |
|||
_searchTableTitle.value = '选择物料' |
|||
_multiple.value = multiple |
|||
_formField.value = field |
|||
_searchField.value = field |
|||
_searchTablePage.value = ItembasicApi.getItembasicPage, |
|||
_searchTableAllSchemas.value = Itembasic.allSchemas, |
|||
openCommon() |
|||
} |
|||
|
|||
|
|||
/** 选择物料弹窗 */ |
|||
const addToolCommon = (multiple,field) => { |
|||
_searchCondition.value = {} |
|||
const filters: any[] = [] |
|||
filters.push({ |
|||
action: "==", |
|||
column: 'available', |
|||
value: 'TRUE' |
|||
}) |
|||
// 参数整理 |
|||
_searchCondition.value.isSearch = true |
|||
_searchCondition.value.filters = filters |
|||
_searchTableTitle.value = '选定工装' |
|||
_multiple.value = multiple |
|||
_formField.value = field |
|||
_searchField.value = field |
|||
_searchTablePage.value = ToolAccountsApi.getToolAccountsPage, |
|||
_searchTableAllSchemas.value = ToolAccounts.allSchemas, |
|||
openCommon() |
|||
} |
|||
|
|||
/** 弹窗选择之后 回调函数 */ |
|||
const searchTableSuccess = (formField, searchField, val, formRef, type, row ) => { |
|||
if (formField === 'modCodeList') { |
|||
tags.value = []; |
|||
val.forEach(item => { |
|||
let newMod = {} |
|||
newMod['code'] = item.code; |
|||
newMod['name'] = item.name; |
|||
tags.value.push(newMod); |
|||
}); |
|||
}else if (formField === 'toolCodeList') { |
|||
toolCodeList.value = []; |
|||
val.forEach(item => { |
|||
let newTool = {} |
|||
newTool['code'] = item.code; |
|||
newTool['name'] = item.name; |
|||
toolCodeList.value.push(newTool); |
|||
}); |
|||
} |
|||
} |
|||
/*打开弹窗*/ |
|||
const openCommon = () => { |
|||
searchTableRef.value.open( |
|||
_searchTableTitle.value, |
|||
_searchTableAllSchemas.value, |
|||
_searchTablePage.value, |
|||
_formField.value, |
|||
_searchField.value, |
|||
_multiple.value, |
|||
_type.value, |
|||
_row.value, |
|||
_searchCondition.value |
|||
) |
|||
} |
|||
/** 初始化弹窗 */ |
|||
const open = async (type: string, row?: object) => { |
|||
dialogVisible.value = true |
|||
dialogTitle.value = t('action.' + type) |
|||
formType.value = type |
|||
resetForm() |
|||
// 修改时,设置数据 |
|||
if (row) { |
|||
isDisabled.value = true; |
|||
formLoading.value = true |
|||
try { |
|||
// formData.value = await request.get({ url: `/wms/itembasic/get?id=` + row.id }); |
|||
// tags.value=formData.value |
|||
} finally { |
|||
formLoading.value = false |
|||
} |
|||
} |
|||
else { |
|||
isDisabled.value = false; |
|||
tags.value=[]; |
|||
} |
|||
} |
|||
defineExpose({ open }) // 提供 open 方法,用于打开弹窗 |
|||
|
|||
/** 提交表单 */ |
|||
const emit = defineEmits(['success']) // 定义 success 事件,用于操作成功后的回调 |
|||
const submitForm = async () => { |
|||
|
|||
formData.value.modCodeList = tags.value.map(item=>item.code) |
|||
formData.value.toolCode = toolCodeList.value[0].code |
|||
// 校验表单 |
|||
if (!basicFormRef) return |
|||
const valid = await basicFormRef.value.validate() |
|||
if (!valid) return |
|||
// 提交请求 |
|||
formLoading.value = true |
|||
try { |
|||
const data = formData.value as unknown as ToolModApi.ToolModVO |
|||
if (formType.value === 'create') { |
|||
await ToolModApi.createToolModBatch(data) |
|||
message.success(t('common.createSuccess')) |
|||
} else { |
|||
await ToolModApi.updateToolMod(data) |
|||
message.success(t('common.updateSuccess')) |
|||
} |
|||
dialogVisible.value = false |
|||
// 发送操作成功的事件 |
|||
emit('success') |
|||
} finally { |
|||
formLoading.value = false |
|||
} |
|||
} |
|||
|
|||
/** 重置表单 */ |
|||
const resetForm = () => { |
|||
formData.value = { |
|||
toolCode: '', |
|||
modCodeList: [], |
|||
type: null, |
|||
remark: '' |
|||
} |
|||
basicFormRef.value?.resetFields() |
|||
} |
|||
|
|||
</script> |
|||
|
|||
<style scoped> |
|||
.tag-container { |
|||
margin-top: 10px; /* 可根据需要调整标签容器与表单项之间的间距 */ |
|||
border: 1px solid #ccc; /* 添加边框样式 */ |
|||
padding: 10px; /* 可根据需要调整容器内边距 */ |
|||
width: 950px; /* 设置固定宽度为 950px */ |
|||
overflow-y: auto; /* 当内容溢出容器高度时显示滚动条 */ |
|||
word-wrap: break-word; /* 使用 word-wrap 属性实现超出范围换行 */ |
|||
overflow-wrap: break-word; /* 兼容性更好的写法 */ |
|||
flex-wrap: wrap; |
|||
} |
|||
.input-with-button { |
|||
display: flex; |
|||
align-items: center; |
|||
width: 100%; |
|||
} |
|||
|
|||
.input-with-button > .el-input { |
|||
flex: 1; |
|||
/*margin-right: 10px;*/ |
|||
} |
|||
|
|||
</style> |
@ -0,0 +1,155 @@ |
|||
import type { CrudSchema } from '@/hooks/web/useCrudSchemas' |
|||
import { dateFormatter } from '@/utils/formatTime' |
|||
import {Itembasic} from "@/views/wms/basicDataManage/itemManage/itembasic/itembasic.data"; |
|||
import * as ItembasicApi from "@/api/wms/itembasic"; |
|||
import { ToolAccounts,ToolAccountsRules } from '../toolAccounts/toolAccounts.data' |
|||
import * as ToolAccountsApi from '@/api/eam/toolAccounts' |
|||
|
|||
// 表单校验
|
|||
export const ToolModRules = reactive({ |
|||
modCode: [required], |
|||
toolCode: [required], |
|||
type: [required], |
|||
concurrencyStamp: [required] |
|||
}) |
|||
|
|||
export const ToolMod = useCrudSchemas(reactive<CrudSchema[]>([ |
|||
{ |
|||
label: '工装编码', |
|||
field: 'toolCode', |
|||
sort: 'custom', |
|||
isSearch: false, |
|||
isDetail: false, |
|||
isForm: false, |
|||
isTable: true, |
|||
isTableForm: false, |
|||
}, |
|||
// {
|
|||
// label: '工装编码',
|
|||
// field: 'toolCodeShow',
|
|||
// sort: 'custom',
|
|||
// isSearch: true,
|
|||
// form: {
|
|||
// componentProps: {
|
|||
// isSearchList: true,
|
|||
// searchListPlaceholder: '请选择工装代码',
|
|||
// searchField: 'toolCodeShow',
|
|||
// searchTitle: '客户物料基础信息',
|
|||
// searchAllSchemas: ToolAccounts.allSchemas,
|
|||
// searchPage: ToolAccountsApi.getToolAccountsPage,
|
|||
// searchCondition: [{
|
|||
// key: 'available',
|
|||
// value: 'TRUE',
|
|||
// isMainValue: false
|
|||
// }]
|
|||
// }
|
|||
// },
|
|||
// search: {
|
|||
// componentProps: {
|
|||
// isSearchList: true,
|
|||
// searchListPlaceholder: '请选择工装代码',
|
|||
// searchField: 'toolCodeShow',
|
|||
// searchTitle: '客户物料基础信息',
|
|||
// searchAllSchemas: ToolAccounts.allSchemas,
|
|||
// searchPage: ToolAccountsApi.getToolAccountsPage,
|
|||
// searchCondition: [{
|
|||
// key: 'available',
|
|||
// value: 'TRUE',
|
|||
// isMainValue: false
|
|||
// }]
|
|||
// }
|
|||
// }
|
|||
// },
|
|||
{ |
|||
label: '物料编号', |
|||
field: 'modCode', |
|||
sort: 'custom', |
|||
isSearch: false, |
|||
isDetail: false, |
|||
isForm: false, |
|||
isTable: true, |
|||
isTableForm: false, |
|||
}, |
|||
// {
|
|||
// label: '物料编号',
|
|||
// field: 'modCodeShow',
|
|||
// sort: 'custom',
|
|||
// isSearch: true,
|
|||
// form: {
|
|||
// componentProps: {
|
|||
// isSearchList: true,
|
|||
// searchListPlaceholder: '请选择物料代码',
|
|||
// searchField: 'modCodeShow',
|
|||
// searchTitle: '客户物料基础信息',
|
|||
// multiple:true,
|
|||
// searchAllSchemas: Itembasic.allSchemas,
|
|||
// searchPage: ItembasicApi.getItembasicPage,
|
|||
// searchCondition: [{
|
|||
// key: 'available',
|
|||
// value: 'TRUE',
|
|||
// isMainValue: false
|
|||
// }]
|
|||
// }
|
|||
// },
|
|||
// search: {
|
|||
// componentProps: {
|
|||
// isSearchList: true,
|
|||
// searchListPlaceholder: '请选择物料代码',
|
|||
// searchField: 'modCodeShow',
|
|||
// searchTitle: '客户物料基础信息',
|
|||
// multiple: true,
|
|||
// searchAllSchemas: Itembasic.allSchemas,
|
|||
// searchPage: ItembasicApi.getItembasicPage,
|
|||
// searchCondition: [{
|
|||
// key: 'available',
|
|||
// value: 'TRUE',
|
|||
// isMainValue: false
|
|||
// }]
|
|||
// }
|
|||
// }
|
|||
// },
|
|||
{ |
|||
label: '类型', |
|||
field: 'type', |
|||
sort: 'custom', |
|||
dictType: DICT_TYPE.DEVICE_TYPE, |
|||
dictClass: 'string', // 默认都是字符串类型其他暂不考虑
|
|||
isSearch: true, |
|||
form: { |
|||
component: 'Select' |
|||
} |
|||
}, |
|||
// {
|
|||
// label: '部门',
|
|||
// field: 'departmentCode',
|
|||
// sort: 'custom',
|
|||
// isSearch: true
|
|||
// },
|
|||
{ |
|||
label: '备注', |
|||
field: 'remark', |
|||
sort: 'custom', |
|||
isSearch: true |
|||
}, |
|||
{ |
|||
label: '是否可用', |
|||
field: 'available', |
|||
sort: 'custom', |
|||
dictType: DICT_TYPE.TRUE_FALSE, |
|||
dictClass: 'string', // 默认都是字符串类型其他暂不考虑
|
|||
isTable: true, |
|||
isDetail: false, |
|||
isSearch: false, |
|||
isTableForm: false, |
|||
isForm: false, |
|||
}, |
|||
{ |
|||
label: '操作', |
|||
field: 'action', |
|||
isForm: false, |
|||
table: { |
|||
width: 150, |
|||
fixed: 'right' |
|||
} |
|||
} |
|||
])) |
Some files were not shown because too many files changed in this diff
Loading…
Reference in new issue