ljlong_2630
6 months ago
15 changed files with 1206 additions and 233 deletions
@ -0,0 +1,61 @@ |
|||||
|
import request from '@/config/axios' |
||||
|
|
||||
|
export interface EquipmentShutdownVO { |
||||
|
id: number |
||||
|
equipmentCode: string |
||||
|
operationDate: Date |
||||
|
operationer: string |
||||
|
factoryAreaCode: string |
||||
|
workshopCode: string |
||||
|
workshopSectionCode: string |
||||
|
status: string |
||||
|
shutdownCause: string |
||||
|
departmentCode: string |
||||
|
remark: string |
||||
|
siteId: string |
||||
|
available: string |
||||
|
deletionTime: Date |
||||
|
deleterId: byte[] |
||||
|
concurrencyStamp: number |
||||
|
} |
||||
|
|
||||
|
// 查询设备停机记录列表
|
||||
|
export const getEquipmentShutdownPage = async (params) => { |
||||
|
if (params.isSearch) { |
||||
|
delete params.isSearch |
||||
|
const data = {...params} |
||||
|
return await request.post({ url: '/eam/equipment-shutdown/senior', data }) |
||||
|
} else { |
||||
|
return await request.get({ url: `/eam/equipment-shutdown/page`, params }) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// 查询设备停机记录详情
|
||||
|
export const getEquipmentShutdown = async (id: number) => { |
||||
|
return await request.get({ url: `/eam/equipment-shutdown/get?id=` + id }) |
||||
|
} |
||||
|
|
||||
|
// 新增设备停机记录
|
||||
|
export const createEquipmentShutdown = async (data: EquipmentShutdownVO) => { |
||||
|
return await request.post({ url: `/eam/equipment-shutdown/create`, data }) |
||||
|
} |
||||
|
|
||||
|
// 修改设备停机记录
|
||||
|
export const updateEquipmentShutdown = async (data: EquipmentShutdownVO) => { |
||||
|
return await request.put({ url: `/eam/equipment-shutdown/update`, data }) |
||||
|
} |
||||
|
|
||||
|
// 删除设备停机记录
|
||||
|
export const deleteEquipmentShutdown = async (id: number) => { |
||||
|
return await request.delete({ url: `/eam/equipment-shutdown/delete?id=` + id }) |
||||
|
} |
||||
|
|
||||
|
// 导出设备停机记录 Excel
|
||||
|
export const exportEquipmentShutdown = async (params) => { |
||||
|
return await request.download({ url: `/eam/equipment-shutdown/export-excel`, params }) |
||||
|
} |
||||
|
|
||||
|
// 下载用户导入模板
|
||||
|
export const importTemplate = () => { |
||||
|
return request.download({ url: '/eam/equipment-shutdown/get-import-template' }) |
||||
|
} |
@ -0,0 +1,72 @@ |
|||||
|
import request from '@/config/axios' |
||||
|
|
||||
|
export interface EquipmentSigningVO { |
||||
|
id: number |
||||
|
equipmentCode: string |
||||
|
operationDate: Date |
||||
|
operationer: string |
||||
|
operationDept: string |
||||
|
telephone: string |
||||
|
supplierCode: string |
||||
|
supplierPeople: string |
||||
|
supplierTelephone: string |
||||
|
status: string |
||||
|
approver: number |
||||
|
approveContent: string |
||||
|
approveTime: Date |
||||
|
autoExamine: string |
||||
|
autoAgree: string |
||||
|
directCreateRecord: string |
||||
|
storageLocation: string |
||||
|
factoryAreaCode: string |
||||
|
workshopCode: string |
||||
|
workshopSectionCode: string |
||||
|
departmentCode: string |
||||
|
remark: string |
||||
|
siteId: string |
||||
|
available: string |
||||
|
deletionTime: Date |
||||
|
deleterId: byte[] |
||||
|
concurrencyStamp: number |
||||
|
} |
||||
|
|
||||
|
// 查询设备到货签收记录列表
|
||||
|
export const getEquipmentSigningPage = async (params) => { |
||||
|
if (params.isSearch) { |
||||
|
delete params.isSearch |
||||
|
const data = {...params} |
||||
|
return await request.post({ url: '/eam/equipment-signing/senior', data }) |
||||
|
} else { |
||||
|
return await request.get({ url: `/eam/equipment-signing/page`, params }) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// 查询设备到货签收记录详情
|
||||
|
export const getEquipmentSigning = async (id: number) => { |
||||
|
return await request.get({ url: `/eam/equipment-signing/get?id=` + id }) |
||||
|
} |
||||
|
|
||||
|
// 新增设备到货签收记录
|
||||
|
export const createEquipmentSigning = async (data: EquipmentSigningVO) => { |
||||
|
return await request.post({ url: `/eam/equipment-signing/create`, data }) |
||||
|
} |
||||
|
|
||||
|
// 修改设备到货签收记录
|
||||
|
export const updateEquipmentSigning = async (data: EquipmentSigningVO) => { |
||||
|
return await request.put({ url: `/eam/equipment-signing/update`, data }) |
||||
|
} |
||||
|
|
||||
|
// 删除设备到货签收记录
|
||||
|
export const deleteEquipmentSigning = async (id: number) => { |
||||
|
return await request.delete({ url: `/eam/equipment-signing/delete?id=` + id }) |
||||
|
} |
||||
|
|
||||
|
// 导出设备到货签收记录 Excel
|
||||
|
export const exportEquipmentSigning = async (params) => { |
||||
|
return await request.download({ url: `/eam/equipment-signing/export-excel`, params }) |
||||
|
} |
||||
|
|
||||
|
// 下载用户导入模板
|
||||
|
export const importTemplate = () => { |
||||
|
return request.download({ url: '/eam/equipment-signing/get-import-template' }) |
||||
|
} |
@ -0,0 +1,112 @@ |
|||||
|
import type { CrudSchema } from '@/hooks/web/useCrudSchemas' |
||||
|
import { dateFormatter } from '@/utils/formatTime' |
||||
|
|
||||
|
// 表单校验
|
||||
|
export const EquipmentShutdownRules = reactive({ |
||||
|
equipmentCode: [required], |
||||
|
operationDate: [required], |
||||
|
concurrencyStamp: [required] |
||||
|
}) |
||||
|
|
||||
|
export const EquipmentShutdown = useCrudSchemas(reactive<CrudSchema[]>([ |
||||
|
{ |
||||
|
label: '设备编码', |
||||
|
field: 'equipmentCode', |
||||
|
sort: 'custom', |
||||
|
isSearch: true |
||||
|
}, |
||||
|
{ |
||||
|
label: '操作日期', |
||||
|
field: 'operationDate', |
||||
|
sort: 'custom', |
||||
|
formatter: dateFormatter, |
||||
|
isSearch: true, |
||||
|
search: { |
||||
|
component: 'DatePicker', |
||||
|
componentProps: { |
||||
|
valueFormat: 'YYYY-MM-DD HH:mm:ss', |
||||
|
type: 'daterange', |
||||
|
defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')] |
||||
|
} |
||||
|
}, |
||||
|
form: { |
||||
|
component: 'DatePicker', |
||||
|
componentProps: { |
||||
|
type: 'datetime', |
||||
|
valueFormat: 'x' |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '操作人', |
||||
|
field: 'operationer', |
||||
|
sort: 'custom', |
||||
|
isSearch: true |
||||
|
}, |
||||
|
// {
|
||||
|
// label: '所属厂区编号',
|
||||
|
// field: 'factoryAreaCode',
|
||||
|
// sort: 'custom',
|
||||
|
// isSearch: true
|
||||
|
// },
|
||||
|
{ |
||||
|
label: '车间编号', |
||||
|
field: 'workshopCode', |
||||
|
sort: 'custom', |
||||
|
isSearch: true |
||||
|
}, |
||||
|
{ |
||||
|
label: '工段编号', |
||||
|
field: 'workshopSectionCode', |
||||
|
sort: 'custom', |
||||
|
isSearch: false |
||||
|
}, |
||||
|
{ |
||||
|
label: '是否停机', |
||||
|
field: 'status', |
||||
|
sort: 'custom', |
||||
|
dictType: DICT_TYPE.TRUE_FALSE, |
||||
|
dictClass: 'string', // 默认都是字符串类型其他暂不考虑
|
||||
|
isSearch: false, |
||||
|
form: { |
||||
|
component: 'Radio' |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '设备停机原因', |
||||
|
field: 'shutdownCause', |
||||
|
sort: 'custom', |
||||
|
isSearch: false |
||||
|
}, |
||||
|
{ |
||||
|
label: '备注', |
||||
|
field: 'remark', |
||||
|
sort: 'custom', |
||||
|
isSearch: false |
||||
|
}, |
||||
|
// {
|
||||
|
// label: '是否可用',
|
||||
|
// field: 'available',
|
||||
|
// sort: 'custom',
|
||||
|
// dictType: DICT_TYPE.TRUE_FALSE,
|
||||
|
// dictClass: 'string', // 默认都是字符串类型其他暂不考虑
|
||||
|
// isSearch: true,
|
||||
|
// form: {
|
||||
|
// component: 'Switch',
|
||||
|
// value: 'TRUE',
|
||||
|
// componentProps: {
|
||||
|
// inactiveValue: 'FALSE',
|
||||
|
// activeValue: 'TRUE'
|
||||
|
// }
|
||||
|
// }
|
||||
|
// },
|
||||
|
{ |
||||
|
label: '操作', |
||||
|
field: 'action', |
||||
|
isForm: false, |
||||
|
table: { |
||||
|
width: 150, |
||||
|
fixed: 'right' |
||||
|
} |
||||
|
} |
||||
|
])) |
@ -0,0 +1,244 @@ |
|||||
|
<template> |
||||
|
<ContentWrap> |
||||
|
<!-- 搜索工作栏 --> |
||||
|
<Search :schema="EquipmentShutdown.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" /> |
||||
|
</ContentWrap> |
||||
|
|
||||
|
<!-- 列表头部 --> |
||||
|
<TableHead |
||||
|
:HeadButttondata="HeadButttondata" |
||||
|
@button-base-click="buttonBaseClick" |
||||
|
:routeName="routeName" |
||||
|
@updataTableColumns="updataTableColumns" |
||||
|
@searchFormClick="searchFormClick" |
||||
|
:allSchemas="EquipmentShutdown.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="EquipmentShutdownRules" |
||||
|
:formAllSchemas="EquipmentShutdown.allSchemas" |
||||
|
:apiUpdate="EquipmentShutdownApi.updateEquipmentShutdown" |
||||
|
:apiCreate="EquipmentShutdownApi.createEquipmentShutdown" |
||||
|
@searchTableSuccess="searchTableSuccess" |
||||
|
:isBusiness="false" |
||||
|
/> |
||||
|
|
||||
|
<!-- 详情 --> |
||||
|
<Detail ref="detailRef" :isBasic="true" :allSchemas="EquipmentShutdown.allSchemas" /> |
||||
|
|
||||
|
<!-- 导入 --> |
||||
|
<ImportForm ref="importFormRef" url="/eam/equipment-shutdown/import" :importTemplateData="importTemplateData" @success="importSuccess" /> |
||||
|
</template> |
||||
|
|
||||
|
<script setup lang="ts"> |
||||
|
import download from '@/utils/download' |
||||
|
import { EquipmentShutdown,EquipmentShutdownRules } from './equipmentShutdown.data' |
||||
|
import * as EquipmentShutdownApi from '@/api/eam/equipmentShutdown' |
||||
|
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: 'EquipmentShutdown' }) |
||||
|
|
||||
|
const message = useMessage() // 消息弹窗 |
||||
|
const { t } = useI18n() // 国际化 |
||||
|
|
||||
|
const route = useRoute() // 路由信息 |
||||
|
const routeName = ref() |
||||
|
routeName.value = route.name |
||||
|
const tableColumns = ref(EquipmentShutdown.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: EquipmentShutdownApi.getEquipmentShutdownPage // 分页接口 |
||||
|
}) |
||||
|
|
||||
|
// 获得表格的各种操作 |
||||
|
const { getList, setSearchParams } = tableMethods |
||||
|
|
||||
|
// 列表头部按钮 |
||||
|
const HeadButttondata = [ |
||||
|
defaultButtons.defaultAddBtn({hasPermi:'eam:equipment-shutdown:create'}), // 新增 |
||||
|
defaultButtons.defaultImportBtn({hasPermi:'eam:equipment-shutdown:import'}), // 导入 |
||||
|
defaultButtons.defaultExportBtn({hasPermi:'eam:equipment-shutdown: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-shutdown:update'}), // 编辑 |
||||
|
defaultButtons.mainListDeleteBtn({hasPermi:'eam:equipment-shutdown: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 =EquipmentShutdown.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 EquipmentShutdownApi.createEquipmentShutdown(data) |
||||
|
message.success(t('common.createSuccess')) |
||||
|
} else { |
||||
|
await EquipmentShutdownApi.updateEquipmentShutdown(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, 'basicEquipmentShutdown') |
||||
|
} |
||||
|
|
||||
|
/** 删除按钮操作 */ |
||||
|
const handleDelete = async (id: number) => { |
||||
|
try { |
||||
|
// 删除的二次确认 |
||||
|
await message.delConfirm() |
||||
|
// 发起删除 |
||||
|
await EquipmentShutdownApi.deleteEquipmentShutdown(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 EquipmentShutdownApi.exportEquipmentShutdown(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 EquipmentShutdownApi.importTemplate() |
||||
|
}) |
||||
|
|
||||
|
</script> |
@ -0,0 +1,343 @@ |
|||||
|
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 { handleTreeToComponentOptions } from '@/utils/tree' |
||||
|
import * as DeptApi from '@/api/system/dept' |
||||
|
import * as UserApi from '@/api/system/user' |
||||
|
import { EquipmentAccounts,EquipmentAccountsRules } from '../equipmentAccounts/equipmentAccounts.data' |
||||
|
import * as EquipmentAccountsApi from '@/api/eam/equipmentAccounts' |
||||
|
|
||||
|
export interface User { |
||||
|
id: number, |
||||
|
nickname: string |
||||
|
} |
||||
|
|
||||
|
const deptList = ref<Tree[]>([]) // 树形结构
|
||||
|
const workshopNoPage = await WorkshopApi.getWorkshopNoPage({}) |
||||
|
const userList = ref<User[]>([]) |
||||
|
// 加载部门树(默认格式)
|
||||
|
deptList.value = handleTreeToComponentOptions(await DeptApi.getSimpleDeptList()) |
||||
|
|
||||
|
// 表单校验
|
||||
|
export const EquipmentSigningRules = reactive({ |
||||
|
equipmentCode: [required], |
||||
|
operationDate: [required], |
||||
|
operationer: [required], |
||||
|
operationDept: [required], |
||||
|
supplierCode: [required], |
||||
|
status: [required], |
||||
|
storageLocation: [required], |
||||
|
concurrencyStamp: [required] |
||||
|
}) |
||||
|
|
||||
|
export const EquipmentSigning = useCrudSchemas(reactive<CrudSchema[]>([ |
||||
|
{ |
||||
|
label: '设备编码', |
||||
|
field: 'equipmentCode', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
form: { |
||||
|
// labelMessage: '信息提示说明!!!',
|
||||
|
componentProps: { |
||||
|
isSearchList: true, // 开启查询弹窗
|
||||
|
searchListPlaceholder: '请选择设备', // 输入框占位文本
|
||||
|
searchField: 'code', // 查询弹窗赋值字段
|
||||
|
searchTitle: '设备信息', // 查询弹窗标题
|
||||
|
searchAllSchemas: EquipmentAccounts.allSchemas, // 查询弹窗所需类
|
||||
|
searchPage: EquipmentAccountsApi.getEquipmentAccountsPage, // 查询弹窗所需分页方法
|
||||
|
searchCondition: [{ |
||||
|
key: 'available', |
||||
|
value: 'TRUE', |
||||
|
isMainValue: false |
||||
|
}] |
||||
|
} |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
label: '验收日期', |
||||
|
field: 'operationDate', |
||||
|
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: 'operationDept', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
form: { |
||||
|
component: 'TreeSelect', |
||||
|
componentProps: { // 假设deptList是部门数据列表
|
||||
|
data: deptList, |
||||
|
disabled: false, |
||||
|
placeholder: "请选择部门", |
||||
|
filterable: true, |
||||
|
multiple: false, |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '验收人', |
||||
|
field: 'operationer', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
form: { |
||||
|
component: 'Select', |
||||
|
componentProps: { // 假设deptList是部门数据列表
|
||||
|
options: [], |
||||
|
optionsAlias: { |
||||
|
valueField: 'id', |
||||
|
labelField: 'nickname' |
||||
|
}, |
||||
|
disabled: false, |
||||
|
placeholder: "请先选择部门", |
||||
|
filterable: true, |
||||
|
multiple: false, |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '验收人联系方式', |
||||
|
field: 'telephone', |
||||
|
sort: 'custom', |
||||
|
isSearch: false |
||||
|
}, |
||||
|
{ |
||||
|
label: '供应商编号', |
||||
|
field: 'supplierCode', |
||||
|
sort: 'custom', |
||||
|
isSearch: true |
||||
|
}, |
||||
|
{ |
||||
|
label: '供应商联系人', |
||||
|
field: 'supplierPeople', |
||||
|
sort: 'custom', |
||||
|
isSearch: true |
||||
|
}, |
||||
|
{ |
||||
|
label: '供应商联系方式', |
||||
|
field: 'supplierTelephone', |
||||
|
sort: 'custom', |
||||
|
isSearch: false |
||||
|
}, |
||||
|
// {
|
||||
|
// label: '流程状态',
|
||||
|
// field: 'status',
|
||||
|
// sort: 'custom',
|
||||
|
// isSearch: true,
|
||||
|
// dictType: DICT_TYPE.JOB_STATUS,
|
||||
|
// dictClass: 'string', // 默认都是字符串类型其他暂不考虑
|
||||
|
// 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',
|
||||
|
// valueHtml: '',
|
||||
|
// height: 200
|
||||
|
// }
|
||||
|
// }
|
||||
|
// },
|
||||
|
// {
|
||||
|
// 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',
|
||||
|
// dictType: DICT_TYPE.TRUE_FALSE,
|
||||
|
// dictClass: 'string', // 默认都是字符串类型其他暂不考虑
|
||||
|
// isSearch: false,
|
||||
|
// form: {
|
||||
|
// component: 'Switch',
|
||||
|
// value: 'TRUE',
|
||||
|
// componentProps: {
|
||||
|
// inactiveValue: 'FALSE',
|
||||
|
// activeValue: 'TRUE'
|
||||
|
// }
|
||||
|
// }
|
||||
|
// },
|
||||
|
// {
|
||||
|
// label: '自动通过',
|
||||
|
// field: 'autoAgree',
|
||||
|
// sort: 'custom',
|
||||
|
// dictType: DICT_TYPE.TRUE_FALSE,
|
||||
|
// dictClass: 'string', // 默认都是字符串类型其他暂不考虑
|
||||
|
// isSearch: false,
|
||||
|
// form: {
|
||||
|
// component: 'Switch',
|
||||
|
// value: 'TRUE',
|
||||
|
// componentProps: {
|
||||
|
// inactiveValue: 'FALSE',
|
||||
|
// activeValue: 'TRUE'
|
||||
|
// }
|
||||
|
// }
|
||||
|
// },
|
||||
|
// {
|
||||
|
// label: '直接生成记录',
|
||||
|
// field: 'directCreateRecord',
|
||||
|
// sort: 'custom',
|
||||
|
// dictType: DICT_TYPE.TRUE_FALSE,
|
||||
|
// dictClass: 'string', // 默认都是字符串类型其他暂不考虑
|
||||
|
// isSearch: false,
|
||||
|
// form: {
|
||||
|
// component: 'Switch',
|
||||
|
// value: 'TRUE',
|
||||
|
// componentProps: {
|
||||
|
// inactiveValue: 'FALSE',
|
||||
|
// activeValue: 'TRUE'
|
||||
|
// }
|
||||
|
// }
|
||||
|
// },
|
||||
|
{ |
||||
|
label: '存放位置描述', |
||||
|
field: 'storageLocation', |
||||
|
sort: 'custom', |
||||
|
isSearch: false, |
||||
|
form: { |
||||
|
component: 'Input', |
||||
|
componentProps: { |
||||
|
type: 'textarea', |
||||
|
placeholder: '请输入存放位置描述' |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
// {
|
||||
|
// label: '所属厂区编号',
|
||||
|
// field: 'factoryAreaCode',
|
||||
|
// sort: 'custom',
|
||||
|
// isSearch: false
|
||||
|
// },
|
||||
|
{ |
||||
|
label: '车间编号', |
||||
|
field: 'workshopCode', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
form: { |
||||
|
// labelMessage: '信息提示说明!!!',
|
||||
|
componentProps: { |
||||
|
isSearchList: true, // 开启查询弹窗
|
||||
|
searchListPlaceholder: '请选择车间代码', // 输入框占位文本
|
||||
|
searchField: 'code', // 查询弹窗赋值字段
|
||||
|
searchTitle: '车间信息', // 查询弹窗标题
|
||||
|
searchAllSchemas: Workshop.allSchemas, // 查询弹窗所需类
|
||||
|
searchPage: WorkshopApi.getWorkshopPage, // 查询弹窗所需分页方法
|
||||
|
searchCondition: [{ |
||||
|
key: 'available', |
||||
|
value: 'TRUE', |
||||
|
isMainValue: false |
||||
|
}] |
||||
|
} |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
label: '产线编号', |
||||
|
field: 'lineCode', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
form: { |
||||
|
component: 'Select' |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '工序编号', |
||||
|
field: 'processCode', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
form: { |
||||
|
component: 'Select' |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '工位编号', |
||||
|
field: 'workstationCode', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
form: { |
||||
|
component: 'Select' |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '备注', |
||||
|
field: 'remark', |
||||
|
sort: 'custom', |
||||
|
isSearch: false |
||||
|
}, |
||||
|
// {
|
||||
|
// label: '是否可用',
|
||||
|
// field: 'available',
|
||||
|
// sort: 'custom',
|
||||
|
// dictType: DICT_TYPE.TRUE_FALSE,
|
||||
|
// dictClass: 'string', // 默认都是字符串类型其他暂不考虑
|
||||
|
// isSearch: true,
|
||||
|
// form: {
|
||||
|
// component: 'Switch',
|
||||
|
// value: 'TRUE',
|
||||
|
// componentProps: {
|
||||
|
// inactiveValue: 'FALSE',
|
||||
|
// activeValue: 'TRUE'
|
||||
|
// }
|
||||
|
// }
|
||||
|
// },
|
||||
|
{ |
||||
|
label: '操作', |
||||
|
field: 'action', |
||||
|
isForm: false, |
||||
|
table: { |
||||
|
width: 150, |
||||
|
fixed: 'right' |
||||
|
} |
||||
|
} |
||||
|
])) |
@ -0,0 +1,263 @@ |
|||||
|
<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 = (type: string, row?: any) => { |
||||
|
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> |
Loading…
Reference in new issue