ljlong_2630
6 months ago
138 changed files with 4877 additions and 890 deletions
@ -0,0 +1,74 @@ |
|||
import request from '@/config/axios' |
|||
|
|||
export interface EquipmentMaintenanceMainVO { |
|||
id: number |
|||
number: string |
|||
describing: string |
|||
equipmentCode: string |
|||
type: string |
|||
classes: string |
|||
planNumber: string |
|||
faultType: string |
|||
cycle: string |
|||
times: string |
|||
verifyer: number |
|||
verifyContent: string |
|||
verifyTime: Date |
|||
maintenancer: number |
|||
maintenancePhone: string |
|||
completeResult: string |
|||
completionTime: Date |
|||
maintenanceTime: Date |
|||
status: string |
|||
factoryAreaCode: string |
|||
workshopCode: string |
|||
workshopSectionCode: string |
|||
departmentCode: string |
|||
remark: string |
|||
siteId: string |
|||
available: string |
|||
deletionTime: Date |
|||
deleterId: byte[] |
|||
concurrencyStamp: number |
|||
} |
|||
|
|||
// 查询设备保养工单主列表
|
|||
export const getEquipmentMaintenanceMainPage = async (params) => { |
|||
if (params.isSearch) { |
|||
delete params.isSearch |
|||
const data = {...params} |
|||
return await request.post({ url: '/eam/equipment-maintenance-main/senior', data }) |
|||
} else { |
|||
return await request.get({ url: `/eam/equipment-maintenance-main/page`, params }) |
|||
} |
|||
} |
|||
|
|||
// 查询设备保养工单主详情
|
|||
export const getEquipmentMaintenanceMain = async (id: number) => { |
|||
return await request.get({ url: `/eam/equipment-maintenance-main/get?id=` + id }) |
|||
} |
|||
|
|||
// 新增设备保养工单主
|
|||
export const createEquipmentMaintenanceMain = async (data: EquipmentMaintenanceMainVO) => { |
|||
return await request.post({ url: `/eam/equipment-maintenance-main/create`, data }) |
|||
} |
|||
|
|||
// 修改设备保养工单主
|
|||
export const updateEquipmentMaintenanceMain = async (data: EquipmentMaintenanceMainVO) => { |
|||
return await request.put({ url: `/eam/equipment-maintenance-main/update`, data }) |
|||
} |
|||
|
|||
// 删除设备保养工单主
|
|||
export const deleteEquipmentMaintenanceMain = async (id: number) => { |
|||
return await request.delete({ url: `/eam/equipment-maintenance-main/delete?id=` + id }) |
|||
} |
|||
|
|||
// 导出设备保养工单主 Excel
|
|||
export const exportEquipmentMaintenanceMain = async (params) => { |
|||
return await request.download({ url: `/eam/equipment-maintenance-main/export-excel`, params }) |
|||
} |
|||
|
|||
// 下载用户导入模板
|
|||
export const importTemplate = () => { |
|||
return request.download({ url: '/eam/equipment-maintenance-main/get-import-template' }) |
|||
} |
@ -0,0 +1,77 @@ |
|||
import request from '@/config/axios' |
|||
import {InspectionItemSelectSetVO} from "@/api/eam/inspectionItemSelectSet"; |
|||
|
|||
export interface MaintenanceVO { |
|||
id: number |
|||
number: string |
|||
name: string |
|||
equipmentCode: string |
|||
type: string |
|||
optionCode: string |
|||
cycle: string |
|||
startTime: Date |
|||
endTime: Date |
|||
status: string |
|||
approver: number |
|||
approveContent: string |
|||
approveTime: Date |
|||
autoExamine: string |
|||
autoAgree: string |
|||
directCreateRecord: string |
|||
factoryAreaCode: string |
|||
workshopCode: string |
|||
workshopSectionCode: string |
|||
departmentCode: string |
|||
remark: string |
|||
siteId: string |
|||
available: string |
|||
deletionTime: Date |
|||
deleterId: byte[] |
|||
concurrencyStamp: number |
|||
} |
|||
|
|||
// 查询保养计划列表
|
|||
export const getMaintenancePage = async (params) => { |
|||
if (params.isSearch) { |
|||
delete params.isSearch |
|||
const data = {...params} |
|||
return await request.post({ url: '/eam/maintenance/senior', data }) |
|||
} else { |
|||
return await request.get({ url: `/eam/maintenance/page`, params }) |
|||
} |
|||
} |
|||
|
|||
// 查询保养计划详情
|
|||
export const getMaintenance = async (id: number) => { |
|||
return await request.get({ url: `/eam/maintenance/get?id=` + id }) |
|||
} |
|||
|
|||
// 新增保养计划
|
|||
export const createMaintenance = async (data: MaintenanceVO) => { |
|||
return await request.post({ url: `/eam/maintenance/create`, data }) |
|||
} |
|||
|
|||
// 修改保养计划
|
|||
export const updateMaintenance = async (data: MaintenanceVO) => { |
|||
return await request.put({ url: `/eam/maintenance/update`, data }) |
|||
} |
|||
|
|||
// 删除保养计划
|
|||
export const deleteMaintenance = async (id: number) => { |
|||
return await request.delete({ url: `/eam/maintenance/delete?id=` + id }) |
|||
} |
|||
|
|||
// 导出保养计划 Excel
|
|||
export const exportMaintenance = async (params) => { |
|||
return await request.download({ url: `/eam/maintenance/export-excel`, params }) |
|||
} |
|||
|
|||
// 下载用户导入模板
|
|||
export const importTemplate = () => { |
|||
return request.download({ url: '/eam/maintenance/get-import-template' }) |
|||
} |
|||
|
|||
// 启用 / 禁用
|
|||
export const updateEnableCode = async (data: MaintenanceVO) => { |
|||
return await request.post({ url: `/eam/maintenance/ables` , data }) |
|||
} |
@ -0,0 +1,60 @@ |
|||
import request from '@/config/axios' |
|||
|
|||
export interface QadCostcentreVO { |
|||
id: number |
|||
code: string |
|||
usageDescription: string |
|||
costcentreId: string |
|||
costcentreCode: string |
|||
costcentreDescription: string |
|||
costcentreActive: string |
|||
costcentreType: string |
|||
available: string |
|||
remark: string |
|||
deletionTime: Date |
|||
deleterId: string |
|||
extraProperties: string |
|||
concurrencyStamp: number |
|||
siteId: string |
|||
} |
|||
|
|||
// 查询QAD成品中心列表
|
|||
export const getQadCostcentrePage = async (params) => { |
|||
if (params.isSearch) { |
|||
delete params.isSearch |
|||
const data = {...params} |
|||
return await request.post({ url: '/wms/qad-costcentre/senior', data }) |
|||
} else { |
|||
return await request.get({ url: `/wms/qad-costcentre/page`, params }) |
|||
} |
|||
} |
|||
|
|||
// 查询QAD成品中心详情
|
|||
export const getQadCostcentre = async (id: number) => { |
|||
return await request.get({ url: `/wms/qad-costcentre/get?id=` + id }) |
|||
} |
|||
|
|||
// 新增QAD成品中心
|
|||
export const createQadCostcentre = async (data: QadCostcentreVO) => { |
|||
return await request.post({ url: `/wms/qad-costcentre/create`, data }) |
|||
} |
|||
|
|||
// 修改QAD成品中心
|
|||
export const updateQadCostcentre = async (data: QadCostcentreVO) => { |
|||
return await request.put({ url: `/wms/qad-costcentre/update`, data }) |
|||
} |
|||
|
|||
// 删除QAD成品中心
|
|||
export const deleteQadCostcentre = async (id: number) => { |
|||
return await request.delete({ url: `/wms/qad-costcentre/delete?id=` + id }) |
|||
} |
|||
|
|||
// 导出QAD成品中心 Excel
|
|||
export const exportQadCostcentre = async (params) => { |
|||
return await request.download({ url: `/wms/qad-costcentre/export-excel`, params }) |
|||
} |
|||
|
|||
// 下载用户导入模板
|
|||
export const importTemplate = () => { |
|||
return request.download({ url: '/wms/qad-costcentre/get-import-template' }) |
|||
} |
@ -0,0 +1,59 @@ |
|||
import request from '@/config/axios' |
|||
|
|||
export interface QadProjectVO { |
|||
id: number |
|||
projectId: string |
|||
projectCode: string |
|||
projectDescription: string |
|||
projectStartDate: string |
|||
projectEndDate: string |
|||
statusCode: string |
|||
available: string |
|||
remark: string |
|||
deletionTime: Date |
|||
deleterId: string |
|||
extraProperties: string |
|||
concurrencyStamp: number |
|||
siteId: string |
|||
} |
|||
|
|||
// 查询QAD项目信息列表
|
|||
export const getQadProjectPage = async (params) => { |
|||
if (params.isSearch) { |
|||
delete params.isSearch |
|||
const data = {...params} |
|||
return await request.post({ url: '/wms/qad-project/senior', data }) |
|||
} else { |
|||
return await request.get({ url: `/wms/qad-project/page`, params }) |
|||
} |
|||
} |
|||
|
|||
// 查询QAD项目信息详情
|
|||
export const getQadProject = async (id: number) => { |
|||
return await request.get({ url: `/wms/qad-project/get?id=` + id }) |
|||
} |
|||
|
|||
// 新增QAD项目信息
|
|||
export const createQadProject = async (data: QadProjectVO) => { |
|||
return await request.post({ url: `/wms/qad-project/create`, data }) |
|||
} |
|||
|
|||
// 修改QAD项目信息
|
|||
export const updateQadProject = async (data: QadProjectVO) => { |
|||
return await request.put({ url: `/wms/qad-project/update`, data }) |
|||
} |
|||
|
|||
// 删除QAD项目信息
|
|||
export const deleteQadProject = async (id: number) => { |
|||
return await request.delete({ url: `/wms/qad-project/delete?id=` + id }) |
|||
} |
|||
|
|||
// 导出QAD项目信息 Excel
|
|||
export const exportQadProject = async (params) => { |
|||
return await request.download({ url: `/wms/qad-project/export-excel`, params }) |
|||
} |
|||
|
|||
// 下载用户导入模板
|
|||
export const importTemplate = () => { |
|||
return request.download({ url: '/wms/qad-project/get-import-template' }) |
|||
} |
@ -0,0 +1,66 @@ |
|||
import request from '@/config/axios' |
|||
|
|||
export interface SubjectAccountVO { |
|||
id: number |
|||
code: string |
|||
usageDescription: string |
|||
costecentreId: string |
|||
costecentreCode: string |
|||
costecentreType: string |
|||
projectId: string |
|||
projectCode: string |
|||
address: string |
|||
available: string |
|||
remark: string |
|||
deletionTime: Date |
|||
deleterId: string |
|||
extraProperties: string |
|||
concurrencyStamp: number |
|||
siteId: string |
|||
} |
|||
|
|||
// 查询科目账户配置列表
|
|||
export const getSubjectAccountPage = async (params) => { |
|||
if (params.isSearch) { |
|||
delete params.isSearch |
|||
const data = {...params} |
|||
return await request.post({ url: '/wms/subject-account/senior', data }) |
|||
} else { |
|||
return await request.get({ url: `/wms/subject-account/page`, params }) |
|||
} |
|||
} |
|||
|
|||
// 查询科目账户配置详情
|
|||
export const getSubjectAccount = async (id: number) => { |
|||
return await request.get({ url: `/wms/subject-account/get?id=` + id }) |
|||
} |
|||
|
|||
// 新增科目账户配置
|
|||
export const createSubjectAccount = async (data: SubjectAccountVO) => { |
|||
return await request.post({ url: `/wms/subject-account/create`, data }) |
|||
} |
|||
|
|||
// 修改科目账户配置
|
|||
export const updateSubjectAccount = async (data: SubjectAccountVO) => { |
|||
return await request.put({ url: `/wms/subject-account/update`, data }) |
|||
} |
|||
|
|||
// 删除科目账户配置
|
|||
export const deleteSubjectAccount = async (id: number) => { |
|||
return await request.delete({ url: `/wms/subject-account/delete?id=` + id }) |
|||
} |
|||
|
|||
// 导出科目账户配置 Excel
|
|||
export const exportSubjectAccount = async (params) => { |
|||
if (params.isSearch) { |
|||
const data = {...params} |
|||
return await request.downloadPost({ url: `/wms/subject-account/export-excel-senior`, data }) |
|||
}else{ |
|||
return await request.download({ url: `/wms/subject-account/export-excel`, params }) |
|||
} |
|||
} |
|||
|
|||
// 下载用户导入模板
|
|||
export const importTemplate = () => { |
|||
return request.download({ url: '/wms/subject-account/get-import-template' }) |
|||
} |
@ -0,0 +1,339 @@ |
|||
<!-- 导入组件 --> |
|||
<template> |
|||
<Dialog v-model="dialogVisible" :title="t('ts.导入')" width="600" :close-on-click-modal="false"> |
|||
<el-upload |
|||
ref="uploadRef" |
|||
v-model:file-list="fileList" |
|||
:action=" |
|||
importUrl + |
|||
'?mode=' + |
|||
mode + |
|||
'&file=' + |
|||
file + |
|||
'&updatePart=' + |
|||
updatePart + |
|||
'&outFile=' + |
|||
outFile + |
|||
'&extend=' + extend + |
|||
'&fromInventoryStatus=' + fromInventoryStatus + |
|||
'&toInventoryStatus=' + toInventoryStatus |
|||
" |
|||
:auto-upload="false" |
|||
:disabled="formLoading" |
|||
:headers="uploadHeaders" |
|||
:limit="1" |
|||
:on-error="submitFormError" |
|||
:on-exceed="handleExceed" |
|||
:on-success="submitFormSuccess" |
|||
:accept="accept" |
|||
drag |
|||
style="width: 300px; margin: 0 auto" |
|||
v-loading="formLoading" |
|||
> |
|||
<Icon icon="ep:upload-filled" color="#c0c4cc" :size="60" /> |
|||
<div class="el-upload__text">{{t('ts.将文件拖到此处,或')}}<em>{{t('ts.点击上传')}}</em></div> |
|||
<template #tip> |
|||
<div class="el-upload__tip ml--126px mr--80px"> |
|||
<div class="flex"> |
|||
<div |
|||
class="label h-32px mr-26px color-#acaeb3 font-size-14px w-100px text-right" |
|||
style="line-height: 32px" |
|||
>{{t('ts.导入模式')}}</div |
|||
> |
|||
<div class=""> |
|||
<div class="radio"> |
|||
<el-radio-group v-model="mode"> |
|||
<el-radio :label="1" :disabled="updateIsDisable">{{ t('ts.更新')}}</el-radio> |
|||
<!-- <el-radio :label="2" :disabled="appendIsDisable">{{ t('ts.追加') }}</el-radio> |
|||
<el-radio :label="3" :disabled="coverIsDisable">{{ t('ts.覆盖') }}</el-radio> --> |
|||
</el-radio-group> |
|||
</div> |
|||
|
|||
<div class="tips color-#acaeb3 font-size-14px"> |
|||
<div class="mt-2">{{t('ts.更新:新增并修改')}}</div> |
|||
<!-- <div class="mt-2">{{ t('ts.追加:只新增,不修改') }}</div> |
|||
<div class="mt-2">{{ t('ts.覆盖:只修改不新增') }}</div> --> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<div class="flex mt-16px"> |
|||
<!-- <div |
|||
class="label h-32px mr-26px color-#acaeb3 font-size-14px w-100px text-right" |
|||
style="line-height: 32px" |
|||
>{{ t('ts.部分保存') }}</div |
|||
> |
|||
<div class=""> |
|||
<div class="switch"> |
|||
<el-switch v-model="updatePart" /> |
|||
</div> |
|||
<div class="tips color-#acaeb3 font-size-14px"> |
|||
<div class="mt-2">{{ t('ts.部分保存:如存在错误数据,正确数据正常导入') }}</div> |
|||
<div class="mt-2">{{ t('ts.全部保存:全部数据正确,才能导入') }}</div> |
|||
</div> |
|||
</div> --> |
|||
</div> |
|||
<div class="flex mt-16px" v-if="isShowOut"> |
|||
<div |
|||
class="label h-32px mr-26px color-#acaeb3 font-size-14px w-100px text-right" |
|||
style="line-height: 32px" |
|||
>是否外部资源</div |
|||
> |
|||
<div class=""> |
|||
<div class="switch"> |
|||
<el-switch v-model="outFile" /> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</template> |
|||
</el-upload> |
|||
<template #footer> |
|||
<div class="flex items-center"> |
|||
<div class="flex-1 text-left"> |
|||
<!-- <el-button type="primary" plain @click="importTemplate"> |
|||
<Icon icon="ep:download" /> |
|||
{{ t('ts.下载模板') }} |
|||
</el-button> --> |
|||
</div> |
|||
<el-button :disabled="formLoading" type="primary" @click="submitForm">{{ t('ts.确 定') }}</el-button> |
|||
<el-button @click="dialogVisible = false">{{ t('ts.取 消') }}</el-button> |
|||
</div> |
|||
</template> |
|||
</Dialog> |
|||
</template> |
|||
<script lang="ts" setup> |
|||
import { getAccessToken, getTenantId } from '@/utils/auth' |
|||
import download from '@/utils/download' |
|||
|
|||
defineOptions({ name: 'ImportDetailForm' }) |
|||
const { t } = useI18n() |
|||
|
|||
const message = useMessage() // 消息弹窗 |
|||
|
|||
const dialogVisible = ref(false) // 弹窗的是否展示 |
|||
const formLoading = ref(false) // 表单的加载中 |
|||
const uploadRef = ref() |
|||
const uploadHeaders = ref() // 上传 Header 头 |
|||
const fileList = ref([]) // 文件列表 |
|||
const file = ref('') |
|||
|
|||
const props = defineProps({ |
|||
importTemplateData: { |
|||
type: Object, |
|||
required: true |
|||
}, |
|||
// 可以导入的文件类型 |
|||
accept: { |
|||
type: String, |
|||
required: false, |
|||
default: '.xlsx,.xls' |
|||
}, |
|||
// 是否更新已经存在的用户数据.默认值是1 |
|||
mode: { |
|||
type: Number, |
|||
required: false, |
|||
default: 1 |
|||
}, |
|||
// 更新是否禁用,默认值不禁用 |
|||
updateIsDisable: { |
|||
type: Boolean, |
|||
required: false, |
|||
default: false |
|||
}, |
|||
// 追加是否禁用,默认值不禁用 |
|||
appendIsDisable: { |
|||
type: Boolean, |
|||
required: false, |
|||
default: false |
|||
}, |
|||
// 覆盖是否禁用,默认值不禁用 |
|||
coverIsDisable: { |
|||
type: Boolean, |
|||
required: false, |
|||
default: false |
|||
}, |
|||
// 是否部门保存,默认是 |
|||
updatePart: { |
|||
type: Boolean, |
|||
required: false, |
|||
default: false |
|||
}, |
|||
url: { |
|||
type: String, |
|||
required: false |
|||
}, |
|||
// 显示是否外部资源 |
|||
isShowOut: { |
|||
type: Boolean, |
|||
required: false, |
|||
default: false |
|||
}, |
|||
outFile: { |
|||
type: Boolean, |
|||
required: false, |
|||
default: false |
|||
}, |
|||
// 扩展额外属性 |
|||
extend: { |
|||
type: String, |
|||
required: false, |
|||
default: '' |
|||
}, |
|||
// 库存修改 扩展额外属性 TODO: 后续优化 业务限定属性应转为统一的额外扩展属性 此处不应该出现业务相关属性 cxm |
|||
fromInventoryStatus: { |
|||
type: String, |
|||
required: false, |
|||
default: '' |
|||
}, |
|||
// 库存修改 扩展额外属性 TODO: 后续优化 业务限定属性应转为统一的额外扩展属性 此处不应该出现业务相关属性 cxm |
|||
toInventoryStatus: { |
|||
type: String, |
|||
required: false, |
|||
default: '' |
|||
} |
|||
}) |
|||
const importTemplateData = ref(props.importTemplateData) |
|||
const accept = ref(props.accept) |
|||
const mode = ref(props.mode) //是否更新已经存在的用户数据.默认值是1 |
|||
const updateIsDisable = ref(props.updateIsDisable) //更新是否禁用,默认值不禁用 |
|||
const appendIsDisable = ref(props.appendIsDisable) //追加是否禁用,默认值不禁用 |
|||
const coverIsDisable = ref(props.coverIsDisable) //覆盖是否禁用,默认值不禁用 |
|||
const updatePart = ref(props.updatePart) //是否部门保存 |
|||
const outFile = ref(props.outFile) //是否引入外部资源 |
|||
|
|||
const importUrl = import.meta.env.VITE_BASE_URL + import.meta.env.VITE_API_URL + props.url |
|||
|
|||
/** 打开弹窗 */ |
|||
const open = () => { |
|||
dialogVisible.value = true |
|||
resetForm() |
|||
} |
|||
defineExpose({ open }) // 提供 open 方法,用于打开弹窗 |
|||
|
|||
/** 提交表单 */ |
|||
const submitForm = async () => { |
|||
if (fileList.value.length == 0) { |
|||
message.error('请上传文件') |
|||
return |
|||
} |
|||
file.value = fileList.value[0].name |
|||
// 提交请求 |
|||
uploadHeaders.value = { |
|||
Authorization: 'Bearer ' + getAccessToken(), |
|||
'tenant-id': getTenantId() |
|||
} |
|||
formLoading.value = true |
|||
uploadRef.value!.submit() |
|||
} |
|||
|
|||
/** 文件上传成功 */ |
|||
const emits = defineEmits(['success']) |
|||
const submitFormSuccess = (response: any) => { |
|||
formLoading.value = true |
|||
console.log(response) |
|||
if (response) { |
|||
if (response.code == 500) { |
|||
uploadRef.value!.clearFiles() |
|||
message.error('导入失败') |
|||
formLoading.value = false |
|||
return |
|||
} else if (response.code == 0) { |
|||
if (response.data.errorCount > 0) { |
|||
message.confirm('文件中有部分数据导入失败,是否下载失败数据?').then(() => { |
|||
// download.excel(file, 'file_' + new Date().getTime()) |
|||
// 通过url下载文件 |
|||
// const downloadElement = document.createElement('a') |
|||
// console.log(172, import.meta.env.VITE_BASE_URL + import.meta.env.VITE_API_URL + '/' + response.data.errorFile) |
|||
// console.log(172, import.meta.env.VITE_BASE_URL + '/admin-api/opt/profile/' + response.data.errorFile) |
|||
window.open( |
|||
import.meta.env.VITE_BASE_URL + '/admin-api' + response.data.errorFile, |
|||
'222' |
|||
) |
|||
// downloadElement.setAttribute('href', import.meta.env.VITE_BASE_URL + import.meta.env.VITE_API_URL + response.data.errorFile ) |
|||
// 点击下载 |
|||
// downloadElement.click() |
|||
}) |
|||
} else { |
|||
message.success('导入成功') |
|||
} |
|||
}else if(response.data == null){ |
|||
message.error(response.msg) |
|||
} |
|||
} |
|||
|
|||
// if (response.code !== 0) { |
|||
// message.error(response.msg) |
|||
// formLoading.value = false |
|||
// return |
|||
// } |
|||
// // 拼接提示语 |
|||
// const data = response.data |
|||
// const create = response.data.importResult[0] |
|||
// const update = response.data.importResult[1] |
|||
// const failure = response.data.importResult[2] |
|||
// let text = '上传成功数量:' + data[create].length + ';' |
|||
// for (let name of data[create]) { |
|||
// text += '< ' + name + ' >' |
|||
// } |
|||
// text += '更新成功数量:' + data[update].length + ';' |
|||
// for (const name of data[update]) { |
|||
// text += '< ' + name + ' >' |
|||
// } |
|||
// text += '更新失败数量:' + Object.keys(data[failure]).length + ';' |
|||
// for (const name in data[failure]) { |
|||
// text += '< ' + name + ': ' + data[failure][name] + ' >' |
|||
// } |
|||
// message.alert(text) |
|||
|
|||
// 发送操作成功的事件 |
|||
|
|||
formLoading.value = false |
|||
emits('success') |
|||
dialogVisible.value = false |
|||
} |
|||
/** 上传错误提示 */ |
|||
const submitFormError = (): void => { |
|||
message.error('上传失败,请您重新上传!') |
|||
formLoading.value = false |
|||
} |
|||
|
|||
/** 重置表单 */ |
|||
const resetForm = () => { |
|||
// 重置上传状态和文件 |
|||
formLoading.value = false |
|||
uploadRef.value?.clearFiles() |
|||
fileList.value = [] |
|||
} |
|||
|
|||
/** 文件数超出提示 */ |
|||
const handleExceed = (): void => { |
|||
message.error('最多只能上传一个文件!') |
|||
} |
|||
|
|||
/** 下载模板操作 */ |
|||
const importTemplate = () => { |
|||
const res = importTemplateData.value.templateUrl |
|||
download.excel(res, importTemplateData.value.templateTitle) |
|||
} |
|||
</script> |
|||
|
|||
<style scoped lang="scss"> |
|||
.tips { |
|||
div { |
|||
position: relative; |
|||
padding-left: 22px; |
|||
|
|||
&::before { |
|||
width: 4px; |
|||
height: 4px; |
|||
border-radius: 50%; |
|||
content: ''; |
|||
background: #c2c2c2; |
|||
position: absolute; |
|||
top: 50%; |
|||
margin-top: -2px; |
|||
left: 4px; |
|||
} |
|||
} |
|||
} |
|||
</style> |
@ -0,0 +1,318 @@ |
|||
import type { CrudSchema } from '@/hooks/web/useCrudSchemas' |
|||
import { dateFormatter } from '@/utils/formatTime' |
|||
|
|||
// 表单校验
|
|||
export const EquipmentMaintenanceMainRules = reactive({ |
|||
number: [required], |
|||
equipmentCode: [required], |
|||
planNumber: [required], |
|||
status: [required], |
|||
factoryAreaCode: [required], |
|||
concurrencyStamp: [required], |
|||
}) |
|||
|
|||
export const EquipmentMaintenanceMain = useCrudSchemas(reactive<CrudSchema[]>([ |
|||
{ |
|||
label: 'id', |
|||
field: 'id', |
|||
sort: 'custom', |
|||
isSearch: false, |
|||
isTable: false, |
|||
isForm: false, |
|||
isDetail:false, |
|||
}, |
|||
{ |
|||
label: '保养工单编号', |
|||
field: 'number', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
}, |
|||
{ |
|||
label: '描述', |
|||
field: 'describing', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
}, |
|||
{ |
|||
label: '设备编号', |
|||
field: 'equipmentCode', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
}, |
|||
{ |
|||
label: '设备分类', |
|||
field: 'type', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
}, |
|||
{ |
|||
label: '班次枚举', |
|||
field: 'classes', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
}, |
|||
{ |
|||
label: '保养计划工单号', |
|||
field: 'planNumber', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
}, |
|||
{ |
|||
label: '故障类型枚举', |
|||
field: 'faultType', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
}, |
|||
{ |
|||
label: '保养周期', |
|||
field: 'cycle', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
}, |
|||
{ |
|||
label: '保养次数', |
|||
field: 'times', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
}, |
|||
{ |
|||
label: '验证人', |
|||
field: 'verifyer', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
form: { |
|||
component: 'InputNumber', |
|||
value: 0 |
|||
}, |
|||
}, |
|||
{ |
|||
label: '验证内容', |
|||
field: 'verifyContent', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
form: { |
|||
component: 'Editor', |
|||
componentProps: { |
|||
valueHtml: '', |
|||
height: 200 |
|||
} |
|||
}, |
|||
}, |
|||
{ |
|||
label: '验证时间', |
|||
field: 'verifyTime', |
|||
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: '保养人id', |
|||
field: 'maintenancer', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
form: { |
|||
component: 'InputNumber', |
|||
value: 0 |
|||
}, |
|||
}, |
|||
{ |
|||
label: '保养人联系电话', |
|||
field: 'maintenancePhone', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
}, |
|||
{ |
|||
label: '结果枚举临时措施、完成', |
|||
field: 'completeResult', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
}, |
|||
{ |
|||
label: '完成时间', |
|||
field: 'completionTime', |
|||
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: 'maintenanceTime', |
|||
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: 'status', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
form: { |
|||
component: 'Radio' |
|||
}, |
|||
}, |
|||
{ |
|||
label: '所属厂区编号', |
|||
field: 'factoryAreaCode', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
}, |
|||
{ |
|||
label: '车间编号', |
|||
field: 'workshopCode', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
}, |
|||
{ |
|||
label: '工段编号', |
|||
field: 'workshopSectionCode', |
|||
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: '是否可用默认TRUE', |
|||
field: 'available', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
}, |
|||
{ |
|||
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,244 @@ |
|||
<template> |
|||
<ContentWrap> |
|||
<!-- 搜索工作栏 --> |
|||
<Search :schema="EquipmentMaintenanceMain.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" /> |
|||
</ContentWrap> |
|||
|
|||
<!-- 列表头部 --> |
|||
<TableHead |
|||
:HeadButttondata="HeadButttondata" |
|||
@button-base-click="buttonBaseClick" |
|||
:routeName="routeName" |
|||
@updataTableColumns="updataTableColumns" |
|||
@searchFormClick="searchFormClick" |
|||
:allSchemas="EquipmentMaintenanceMain.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="EquipmentMaintenanceMainRules" |
|||
:formAllSchemas="EquipmentMaintenanceMain.allSchemas" |
|||
:apiUpdate="EquipmentMaintenanceMainApi.updateEquipmentMaintenanceMain" |
|||
:apiCreate="EquipmentMaintenanceMainApi.createEquipmentMaintenanceMain" |
|||
@searchTableSuccess="searchTableSuccess" |
|||
:isBusiness="false" |
|||
/> |
|||
|
|||
<!-- 详情 --> |
|||
<Detail ref="detailRef" :isBasic="true" :allSchemas="EquipmentMaintenanceMain.allSchemas" /> |
|||
|
|||
<!-- 导入 --> |
|||
<ImportForm ref="importFormRef" url="/eam/equipment-maintenance-main/import" :importTemplateData="importTemplateData" @success="importSuccess" /> |
|||
</template> |
|||
|
|||
<script setup lang="ts"> |
|||
import download from '@/utils/download' |
|||
import { EquipmentMaintenanceMain,EquipmentMaintenanceMainRules } from './equipmentMaintenanceMain.data' |
|||
import * as EquipmentMaintenanceMainApi from '@/api/eam/equipmentMaintenanceMain' |
|||
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: 'EquipmentMaintenanceMain' }) |
|||
|
|||
const message = useMessage() // 消息弹窗 |
|||
const { t } = useI18n() // 国际化 |
|||
|
|||
const route = useRoute() // 路由信息 |
|||
const routeName = ref() |
|||
routeName.value = route.name |
|||
const tableColumns = ref(EquipmentMaintenanceMain.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: EquipmentMaintenanceMainApi.getEquipmentMaintenanceMainPage // 分页接口 |
|||
}) |
|||
|
|||
// 获得表格的各种操作 |
|||
const { getList, setSearchParams } = tableMethods |
|||
|
|||
// 列表头部按钮 |
|||
const HeadButttondata = [ |
|||
defaultButtons.defaultAddBtn({hasPermi:'eam:equipmentMaintenanceMain:create'}), // 新增 |
|||
//defaultButtons.defaultImportBtn({hasPermi:'eam:equipmentMaintenanceMain:import'}), // 导入 |
|||
defaultButtons.defaultExportBtn({hasPermi:'eam:equipmentMaintenanceMain: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:equipmentMaintenanceMain:update'}), // 编辑 |
|||
defaultButtons.mainListDeleteBtn({hasPermi:'eam:equipmentMaintenanceMain: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 =EquipmentMaintenanceMain.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 EquipmentMaintenanceMainApi.createEquipmentMaintenanceMain(data) |
|||
message.success(t('common.createSuccess')) |
|||
} else { |
|||
await EquipmentMaintenanceMainApi.updateEquipmentMaintenanceMain(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, 'basicEquipmentMaintenanceMain') |
|||
} |
|||
|
|||
/** 删除按钮操作 */ |
|||
const handleDelete = async (id: number) => { |
|||
try { |
|||
// 删除的二次确认 |
|||
await message.delConfirm() |
|||
// 发起删除 |
|||
await EquipmentMaintenanceMainApi.deleteEquipmentMaintenanceMain(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 EquipmentMaintenanceMainApi.exportEquipmentMaintenanceMain(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 EquipmentMaintenanceMainApi.importTemplate() |
|||
}) |
|||
|
|||
</script> |
@ -0,0 +1,326 @@ |
|||
<template> |
|||
<ContentWrap> |
|||
<!-- 搜索工作栏 --> |
|||
<Search :schema="Maintenance.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" /> |
|||
</ContentWrap> |
|||
|
|||
<!-- 列表头部 --> |
|||
<TableHead |
|||
:HeadButttondata="HeadButttondata" |
|||
@button-base-click="buttonBaseClick" |
|||
:routeName="routeName" |
|||
@updataTableColumns="updataTableColumns" |
|||
@searchFormClick="searchFormClick" |
|||
:allSchemas="Maintenance.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 #number="{row}"> |
|||
<el-button type="primary" link @click="openDetail(row, '代码', row.number)"> |
|||
<span>{{ row.number }}</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="MaintenanceRules" |
|||
:formAllSchemas="Maintenance.allSchemas" |
|||
:apiUpdate="MaintenanceApi.updateMaintenance" |
|||
:apiCreate="MaintenanceApi.createMaintenance" |
|||
@searchTableSuccess="searchTableSuccess" |
|||
:isBusiness="false" |
|||
@onChange="onChange" |
|||
/> |
|||
|
|||
<!-- 详情 --> |
|||
<Detail ref="detailRef" :isBasic="true" :allSchemas="Maintenance.allSchemas" /> |
|||
|
|||
<!-- 导入 --> |
|||
<ImportForm ref="importFormRef" url="/eam/maintenance/import" :importTemplateData="importTemplateData" @success="importSuccess" /> |
|||
</template> |
|||
|
|||
<script setup lang="ts"> |
|||
import download from '@/utils/download' |
|||
import { Maintenance,MaintenanceRules } from './maintenance.data' |
|||
import * as MaintenanceApi from '@/api/eam/maintenance' |
|||
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 BasicInspectionOptionApi from "@/api/eam/basicInspectionOption"; |
|||
import {EquipmentAccounts} from "@/views/eam/equipmentAccounts/equipmentAccounts.data"; |
|||
import * as EquipmentItemApi from "@/api/eam/equipmentAccounts"; |
|||
import { ToolAccounts } from "@/views/eam/toolAccounts/ToolAccounts.data"; |
|||
import * as ToolItemApi from "@/api/eam/toolAccounts"; |
|||
|
|||
defineOptions({ name: 'Maintenance' }) |
|||
|
|||
const message = useMessage() // 消息弹窗 |
|||
const { t } = useI18n() // 国际化 |
|||
|
|||
const route = useRoute() // 路由信息 |
|||
const routeName = ref() |
|||
routeName.value = route.name |
|||
const tableColumns = ref(Maintenance.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: MaintenanceApi.getMaintenancePage // 分页接口 |
|||
}) |
|||
|
|||
// 获得表格的各种操作 |
|||
const { getList, setSearchParams } = tableMethods |
|||
|
|||
// 列表头部按钮 |
|||
const HeadButttondata = [ |
|||
defaultButtons.defaultAddBtn({hasPermi:'eam:maintenance:create'}), // 新增 |
|||
// defaultButtons.defaultImportBtn({hasPermi:'eam:maintenance:import'}), // 导入 |
|||
// defaultButtons.defaultExportBtn({hasPermi:'eam:maintenance: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:maintenance:update'}), // 编辑 |
|||
//defaultButtons.mainListDeleteBtn({hasPermi:'eam:basicInspectionOption:delete'}), // 删除 |
|||
defaultButtons.mainListEnableBtn({hide:isShowMainButton(row,['FALSE']),hasPermi:'eam:maintenance:update'}), |
|||
defaultButtons.mainListDisableBtn({hide:isShowMainButton(row,['TRUE']),hasPermi:'eam:maintenance: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 =Maintenance.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 MaintenanceApi.createMaintenance(data) |
|||
message.success(t('common.createSuccess')) |
|||
} else { |
|||
await MaintenanceApi.updateMaintenance(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, 'basicMaintenance') |
|||
} |
|||
|
|||
/** 删除按钮操作 */ |
|||
const handleDelete = async (id: number) => { |
|||
try { |
|||
// 删除的二次确认 |
|||
await message.delConfirm() |
|||
// 发起删除 |
|||
await MaintenanceApi.deleteMaintenance(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 MaintenanceApi.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 MaintenanceApi.updateEnableCode(params.value) |
|||
message.success(t('common.updateSuccess')) |
|||
// 刷新列表 |
|||
await getList() |
|||
} catch {} |
|||
} |
|||
|
|||
const onChange = (field, item) => { |
|||
console.log(field) |
|||
console.log(item) |
|||
//设备 |
|||
if(field == 'type' && item == 'DEVICE'){ |
|||
Maintenance.allSchemas.formSchema.forEach((items) => { |
|||
if (items.field == 'equipmentCode') { |
|||
basicFormRef.value.formRef.setValues({ |
|||
equipmentCode:'' |
|||
}) |
|||
items.componentProps.searchAllSchemas = EquipmentAccounts.allSchemas |
|||
items.componentProps.searchPage = EquipmentItemApi.getEquipmentAccountsPage |
|||
} |
|||
}) |
|||
} |
|||
//工装 |
|||
if(field == 'type' && item == 'EQUIPMENT'){ |
|||
Maintenance.allSchemas.formSchema.forEach((items) => { |
|||
if (items.field == 'equipmentCode') { |
|||
basicFormRef.value.formRef.setValues({ |
|||
equipmentCode:'' |
|||
}) |
|||
items.componentProps.searchAllSchemas = ToolAccounts.allSchemas |
|||
items.componentProps.searchPage = ToolItemApi.getToolAccountsPage |
|||
} |
|||
}) |
|||
} |
|||
} |
|||
|
|||
/** 导出按钮操作 */ |
|||
const exportLoading = ref(false) // 导出的加载中 |
|||
const handleExport = async () => { |
|||
try { |
|||
// 导出的二次确认 |
|||
await message.exportConfirm() |
|||
// 发起导出 |
|||
exportLoading.value = true |
|||
const data = await MaintenanceApi.exportMaintenance(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,322 @@ |
|||
import type {CrudSchema} from '@/hooks/web/useCrudSchemas' |
|||
import {dateFormatter} from '@/utils/formatTime' |
|||
import { EquipmentAccounts } from "@/views/eam/equipmentAccounts/equipmentAccounts.data"; |
|||
import * as EquipmentItemApi from "@/api/eam/equipmentAccounts"; |
|||
|
|||
// 表单校验
|
|||
export const MaintenanceRules = reactive({ |
|||
number: [required], |
|||
name: [required], |
|||
equipmentCode: [required], |
|||
optionCode: [required], |
|||
cycle: [required], |
|||
startTime: [required], |
|||
endTime: [required], |
|||
}) |
|||
|
|||
export const Maintenance = useCrudSchemas(reactive<CrudSchema[]>([ |
|||
{ |
|||
label: 'id', |
|||
field: 'id', |
|||
sort: 'custom', |
|||
isSearch: false, |
|||
isTable: false, |
|||
isForm: false, |
|||
isDetail:false, |
|||
}, |
|||
{ |
|||
label: '计划编号', |
|||
field: 'number', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
}, |
|||
{ |
|||
label: '计划名称', |
|||
field: 'name', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
}, |
|||
{ |
|||
label: '设备类别', |
|||
field: 'type', |
|||
dictType: DICT_TYPE.DEVICE_TYPE, |
|||
dictClass: 'string', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
}, |
|||
{ |
|||
label: '设备工装编号', |
|||
field: 'equipmentCode', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
isForm: true, |
|||
form: { |
|||
componentProps: { |
|||
isSearchList: true, // 开启查询弹窗
|
|||
searchTitle: '设备信息', // 查询弹窗标题
|
|||
searchListPlaceholder: '请选择 设备编号', // 输入框占位文本
|
|||
searchAllSchemas: EquipmentAccounts.allSchemas, // 查询弹窗所需类
|
|||
searchField: 'code', // 查询弹窗赋值字段
|
|||
searchPage: EquipmentItemApi.getEquipmentAccountsPage, // 查询弹窗所需分页方法
|
|||
multiple:true, |
|||
searchCondition: [{ |
|||
key: 'status', |
|||
value: 'NORMAL', |
|||
action: '==', |
|||
isSearch: true, |
|||
isMainValue: false |
|||
}] |
|||
} |
|||
} |
|||
}, |
|||
{ |
|||
label: '方案编号', |
|||
field: 'optionCode', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
}, |
|||
{ |
|||
label: '周期', |
|||
field: 'cycle', |
|||
dictType: DICT_TYPE.MAINTENANCE_CYCLE, |
|||
dictClass: 'string', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
}, |
|||
{ |
|||
label: '计划开始时间', |
|||
field: 'startTime', |
|||
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: 'endTime', |
|||
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: 'status', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
|
|||
}, |
|||
{ |
|||
label: '审核人', |
|||
field: 'approver', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
}, |
|||
{ |
|||
label: '审核内容', |
|||
field: 'approveContent', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
form: { |
|||
component: 'Editor', |
|||
componentProps: { |
|||
valueHtml: '', |
|||
height: 200 |
|||
} |
|||
}, |
|||
}, |
|||
{ |
|||
label: '审核时间', |
|||
field: 'approveTime', |
|||
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: 'autoExamine', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
}, |
|||
{ |
|||
label: '自动通过', |
|||
field: 'autoAgree', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
}, |
|||
{ |
|||
label: '直接生成记录', |
|||
field: 'directCreateRecord', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
}, |
|||
{ |
|||
label: '所属厂区编号', |
|||
field: 'factoryAreaCode', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
}, |
|||
{ |
|||
label: '车间编号', |
|||
field: 'workshopCode', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
}, |
|||
{ |
|||
label: '工段编号', |
|||
field: 'workshopSectionCode', |
|||
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,244 @@ |
|||
<template> |
|||
<ContentWrap> |
|||
<!-- 搜索工作栏 --> |
|||
<Search :schema="QadCostcentre.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" /> |
|||
</ContentWrap> |
|||
|
|||
<!-- 列表头部 --> |
|||
<TableHead |
|||
:HeadButttondata="HeadButttondata" |
|||
@button-base-click="buttonBaseClick" |
|||
:routeName="routeName" |
|||
@updataTableColumns="updataTableColumns" |
|||
@searchFormClick="searchFormClick" |
|||
:allSchemas="QadCostcentre.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="QadCostcentreRules" |
|||
:formAllSchemas="QadCostcentre.allSchemas" |
|||
:apiUpdate="QadCostcentreApi.updateQadCostcentre" |
|||
:apiCreate="QadCostcentreApi.createQadCostcentre" |
|||
@searchTableSuccess="searchTableSuccess" |
|||
:isBusiness="false" |
|||
/> |
|||
|
|||
<!-- 详情 --> |
|||
<Detail ref="detailRef" :isBasic="true" :allSchemas="QadCostcentre.allSchemas" /> |
|||
|
|||
<!-- 导入 --> |
|||
<ImportForm ref="importFormRef" url="/wms/qad-costcentre/import" :importTemplateData="importTemplateData" @success="importSuccess" /> |
|||
</template> |
|||
|
|||
<script setup lang="ts"> |
|||
import download from '@/utils/download' |
|||
import { QadCostcentre,QadCostcentreRules } from './qadCostcentre.data' |
|||
import * as QadCostcentreApi from '@/api/wms/qadCostcentre' |
|||
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: 'QadCostcentre' }) |
|||
|
|||
const message = useMessage() // 消息弹窗 |
|||
const { t } = useI18n() // 国际化 |
|||
|
|||
const route = useRoute() // 路由信息 |
|||
const routeName = ref() |
|||
routeName.value = route.name |
|||
const tableColumns = ref(QadCostcentre.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: QadCostcentreApi.getQadCostcentrePage // 分页接口 |
|||
}) |
|||
|
|||
// 获得表格的各种操作 |
|||
const { getList, setSearchParams } = tableMethods |
|||
|
|||
// 列表头部按钮 |
|||
const HeadButttondata = [ |
|||
defaultButtons.defaultAddBtn({hasPermi:'wms:qadCostcentre:create'}), // 新增 |
|||
defaultButtons.defaultImportBtn({hasPermi:'wms:qadCostcentre:import'}), // 导入 |
|||
defaultButtons.defaultExportBtn({hasPermi:'wms:qadCostcentre: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:'wms:qadCostcentre:update'}), // 编辑 |
|||
defaultButtons.mainListDeleteBtn({hasPermi:'wms:qadCostcentre: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 =QadCostcentre.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 QadCostcentreApi.createQadCostcentre(data) |
|||
message.success(t('common.createSuccess')) |
|||
} else { |
|||
await QadCostcentreApi.updateQadCostcentre(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, 'basicQadCostcentre') |
|||
} |
|||
|
|||
/** 删除按钮操作 */ |
|||
const handleDelete = async (id: number) => { |
|||
try { |
|||
// 删除的二次确认 |
|||
await message.delConfirm() |
|||
// 发起删除 |
|||
await QadCostcentreApi.deleteQadCostcentre(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 QadCostcentreApi.exportQadCostcentre(tableObject.params) |
|||
download.excel(data, 'QAD成品中心.xlsx') |
|||
} catch { |
|||
} finally { |
|||
exportLoading.value = false |
|||
} |
|||
} |
|||
|
|||
/** 导入 */ |
|||
const importFormRef = ref() |
|||
const handleImport = () => { |
|||
importFormRef.value.open() |
|||
} |
|||
// 导入附件弹窗所需的参数 |
|||
const importTemplateData = reactive({ |
|||
templateUrl: '', |
|||
templateTitle: 'QAD成品中心导入模版.xlsx' |
|||
}) |
|||
// 导入成功之后 |
|||
const importSuccess = () => { |
|||
getList() |
|||
} |
|||
|
|||
// 筛选提交 |
|||
const searchFormClick = (searchData) => { |
|||
tableObject.params = { |
|||
isSearch: true, |
|||
filters: searchData.filters |
|||
} |
|||
getList() // 刷新当前列表 |
|||
} |
|||
|
|||
/** 初始化 **/ |
|||
onMounted(async () => { |
|||
getList() |
|||
importTemplateData.templateUrl = await QadCostcentreApi.importTemplate() |
|||
}) |
|||
|
|||
</script> |
@ -0,0 +1,167 @@ |
|||
import type { CrudSchema } from '@/hooks/web/useCrudSchemas' |
|||
import { dateFormatter } from '@/utils/formatTime' |
|||
|
|||
// 表单校验
|
|||
export const QadCostcentreRules = reactive({ |
|||
code: [required], |
|||
usageDescription: [required], |
|||
available: [required], |
|||
concurrencyStamp: [required], |
|||
}) |
|||
|
|||
export const QadCostcentre = useCrudSchemas(reactive<CrudSchema[]>([ |
|||
{ |
|||
label: 'id', |
|||
field: 'id', |
|||
sort: 'custom', |
|||
isForm: false, |
|||
isTable:false, |
|||
}, |
|||
{ |
|||
label: '成本中心ID', |
|||
field: 'costcentreId', |
|||
sort: 'custom', |
|||
isSearch: false, |
|||
}, |
|||
{ |
|||
label: '成本中心代码', |
|||
field: 'costcentreCode', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
}, |
|||
{ |
|||
label: '成本中心描述', |
|||
field: 'costcentreDescription', |
|||
sort: 'custom', |
|||
isSearch: false, |
|||
form: { |
|||
component: 'Editor', |
|||
componentProps: { |
|||
valueHtml: '', |
|||
height: 200 |
|||
} |
|||
}, |
|||
}, |
|||
{ |
|||
label: '启用', |
|||
field: 'costcentreActive', |
|||
sort: 'custom', |
|||
isSearch: false, |
|||
}, |
|||
{ |
|||
label: '成本中心类型', |
|||
field: 'costcentreType', |
|||
sort: 'custom', |
|||
isSearch: false, |
|||
form: { |
|||
component: 'SelectV2' |
|||
}, |
|||
}, |
|||
{ |
|||
label: '是否可用', |
|||
field: 'available', |
|||
sort: 'custom', |
|||
isSearch: false, |
|||
dictType: DICT_TYPE.TRUE_FALSE, |
|||
dictClass: 'string', |
|||
isTable: true, |
|||
table: { |
|||
width: 120 |
|||
}, |
|||
form: { |
|||
component: 'Switch', |
|||
value: 'TRUE', |
|||
componentProps: { |
|||
inactiveValue: 'FALSE', |
|||
activeValue: 'TRUE' |
|||
} |
|||
}, |
|||
}, |
|||
{ |
|||
label: '备注', |
|||
field: 'remark', |
|||
sort: 'custom', |
|||
isSearch: false, |
|||
}, |
|||
{ |
|||
label: '创建时间', |
|||
field: 'createTime', |
|||
sort: 'custom', |
|||
formatter: dateFormatter, |
|||
isSearch: false, |
|||
search: { |
|||
component: 'DatePicker', |
|||
componentProps: { |
|||
valueFormat: 'YYYY-MM-DD HH:mm:ss', |
|||
type: 'daterange', |
|||
defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')] |
|||
} |
|||
}, |
|||
isForm: false, |
|||
}, |
|||
{ |
|||
label: '删除时间', |
|||
field: 'deletionTime', |
|||
sort: 'custom', |
|||
formatter: dateFormatter, |
|||
isSearch: false, |
|||
isTable: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, |
|||
}, |
|||
{ |
|||
label: '扩展属性', |
|||
field: 'extraProperties', |
|||
sort: 'custom', |
|||
isSearch: false, |
|||
isTable:false, |
|||
}, |
|||
{ |
|||
label: '并发乐观锁', |
|||
field: 'concurrencyStamp', |
|||
sort: 'custom', |
|||
isSearch: false, |
|||
isTable:false, |
|||
form: { |
|||
component: 'InputNumber', |
|||
value: 0 |
|||
}, |
|||
}, |
|||
{ |
|||
label: '地点ID', |
|||
field: 'siteId', |
|||
sort: 'custom', |
|||
isSearch: false, |
|||
isTable:false, |
|||
}, |
|||
{ |
|||
label: '操作', |
|||
field: 'action', |
|||
isForm: false, |
|||
isTable:false, |
|||
table: { |
|||
width: 150, |
|||
fixed: 'right' |
|||
} |
|||
} |
|||
])) |
@ -0,0 +1,244 @@ |
|||
<template> |
|||
<ContentWrap> |
|||
<!-- 搜索工作栏 --> |
|||
<Search :schema="QadProject.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" /> |
|||
</ContentWrap> |
|||
|
|||
<!-- 列表头部 --> |
|||
<TableHead |
|||
:HeadButttondata="HeadButttondata" |
|||
@button-base-click="buttonBaseClick" |
|||
:routeName="routeName" |
|||
@updataTableColumns="updataTableColumns" |
|||
@searchFormClick="searchFormClick" |
|||
:allSchemas="QadProject.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="QadProjectRules" |
|||
:formAllSchemas="QadProject.allSchemas" |
|||
:apiUpdate="QadProjectApi.updateQadProject" |
|||
:apiCreate="QadProjectApi.createQadProject" |
|||
@searchTableSuccess="searchTableSuccess" |
|||
:isBusiness="false" |
|||
/> |
|||
|
|||
<!-- 详情 --> |
|||
<Detail ref="detailRef" :isBasic="true" :allSchemas="QadProject.allSchemas" /> |
|||
|
|||
<!-- 导入 --> |
|||
<ImportForm ref="importFormRef" url="/wms/qad-project/import" :importTemplateData="importTemplateData" @success="importSuccess" /> |
|||
</template> |
|||
|
|||
<script setup lang="ts"> |
|||
import download from '@/utils/download' |
|||
import { QadProject,QadProjectRules } from './qadProject.data' |
|||
import * as QadProjectApi from '@/api/wms/qadProject' |
|||
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: 'QadProject' }) |
|||
|
|||
const message = useMessage() // 消息弹窗 |
|||
const { t } = useI18n() // 国际化 |
|||
|
|||
const route = useRoute() // 路由信息 |
|||
const routeName = ref() |
|||
routeName.value = route.name |
|||
const tableColumns = ref(QadProject.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: QadProjectApi.getQadProjectPage // 分页接口 |
|||
}) |
|||
|
|||
// 获得表格的各种操作 |
|||
const { getList, setSearchParams } = tableMethods |
|||
|
|||
// 列表头部按钮 |
|||
const HeadButttondata = [ |
|||
defaultButtons.defaultAddBtn({hasPermi:'wms:qadProject:create'}), // 新增 |
|||
defaultButtons.defaultImportBtn({hasPermi:'wms:qadProject:import'}), // 导入 |
|||
defaultButtons.defaultExportBtn({hasPermi:'wms:qadProject: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:'wms:qadProject:update'}), // 编辑 |
|||
defaultButtons.mainListDeleteBtn({hasPermi:'wms:qadProject: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 =QadProject.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 QadProjectApi.createQadProject(data) |
|||
message.success(t('common.createSuccess')) |
|||
} else { |
|||
await QadProjectApi.updateQadProject(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, 'basicQadProject') |
|||
} |
|||
|
|||
/** 删除按钮操作 */ |
|||
const handleDelete = async (id: number) => { |
|||
try { |
|||
// 删除的二次确认 |
|||
await message.delConfirm() |
|||
// 发起删除 |
|||
await QadProjectApi.deleteQadProject(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 QadProjectApi.exportQadProject(tableObject.params) |
|||
download.excel(data, 'QAD项目信息.xlsx') |
|||
} catch { |
|||
} finally { |
|||
exportLoading.value = false |
|||
} |
|||
} |
|||
|
|||
/** 导入 */ |
|||
const importFormRef = ref() |
|||
const handleImport = () => { |
|||
importFormRef.value.open() |
|||
} |
|||
// 导入附件弹窗所需的参数 |
|||
const importTemplateData = reactive({ |
|||
templateUrl: '', |
|||
templateTitle: 'QAD项目信息导入模版.xlsx' |
|||
}) |
|||
// 导入成功之后 |
|||
const importSuccess = () => { |
|||
getList() |
|||
} |
|||
|
|||
// 筛选提交 |
|||
const searchFormClick = (searchData) => { |
|||
tableObject.params = { |
|||
isSearch: true, |
|||
filters: searchData.filters |
|||
} |
|||
getList() // 刷新当前列表 |
|||
} |
|||
|
|||
/** 初始化 **/ |
|||
onMounted(async () => { |
|||
getList() |
|||
importTemplateData.templateUrl = await QadProjectApi.importTemplate() |
|||
}) |
|||
|
|||
</script> |
@ -0,0 +1,186 @@ |
|||
import type { CrudSchema } from '@/hooks/web/useCrudSchemas' |
|||
import { dateFormatter } from '@/utils/formatTime' |
|||
|
|||
// 表单校验
|
|||
export const QadProjectRules = reactive({ |
|||
available: [required], |
|||
concurrencyStamp: [required], |
|||
}) |
|||
|
|||
export const QadProject = useCrudSchemas(reactive<CrudSchema[]>([ |
|||
{ |
|||
label: 'id', |
|||
field: 'id', |
|||
sort: 'custom', |
|||
isForm: false, |
|||
isTable:false, |
|||
}, |
|||
{ |
|||
label: '项目ID', |
|||
field: 'projectId', |
|||
sort: 'custom', |
|||
isSearch: false, |
|||
}, |
|||
{ |
|||
label: '项目代码', |
|||
field: 'projectCode', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
}, |
|||
{ |
|||
label: '项目描述', |
|||
field: 'projectDescription', |
|||
sort: 'custom', |
|||
isSearch: false, |
|||
form: { |
|||
component: 'Editor', |
|||
componentProps: { |
|||
valueHtml: '', |
|||
height: 200 |
|||
} |
|||
}, |
|||
}, |
|||
{ |
|||
label: '项目开始时间', |
|||
field: 'projectStartDate', |
|||
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: 'projectEndDate', |
|||
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: 'statusCode', |
|||
sort: 'custom', |
|||
isSearch: false, |
|||
}, |
|||
{ |
|||
label: '是否可用', |
|||
field: 'available', |
|||
sort: 'custom', |
|||
isSearch: false, |
|||
}, |
|||
{ |
|||
label: '备注', |
|||
field: 'remark', |
|||
sort: 'custom', |
|||
isSearch: false, |
|||
}, |
|||
{ |
|||
label: '创建时间', |
|||
field: 'createTime', |
|||
sort: 'custom', |
|||
formatter: dateFormatter, |
|||
isSearch: false, |
|||
search: { |
|||
component: 'DatePicker', |
|||
componentProps: { |
|||
valueFormat: 'YYYY-MM-DD HH:mm:ss', |
|||
type: 'daterange', |
|||
defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')] |
|||
} |
|||
}, |
|||
isForm: false, |
|||
}, |
|||
{ |
|||
label: '删除时间', |
|||
field: 'deletionTime', |
|||
sort: 'custom', |
|||
formatter: dateFormatter, |
|||
isSearch: false, |
|||
isTable: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, |
|||
}, |
|||
{ |
|||
label: '扩展属性', |
|||
field: 'extraProperties', |
|||
sort: 'custom', |
|||
isSearch: false, |
|||
isTable:false, |
|||
}, |
|||
{ |
|||
label: '并发乐观锁', |
|||
field: 'concurrencyStamp', |
|||
sort: 'custom', |
|||
isSearch: false, |
|||
isTable:false, |
|||
form: { |
|||
component: 'InputNumber', |
|||
value: 0 |
|||
}, |
|||
}, |
|||
{ |
|||
label: '地点ID', |
|||
field: 'siteId', |
|||
sort: 'custom', |
|||
isSearch: false, |
|||
isTable:false, |
|||
}, |
|||
{ |
|||
label: '操作', |
|||
field: 'action', |
|||
isForm: false, |
|||
isTable:false, |
|||
table: { |
|||
width: 150, |
|||
fixed: 'right' |
|||
} |
|||
} |
|||
])) |
@ -0,0 +1,253 @@ |
|||
<template> |
|||
<ContentWrap> |
|||
<!-- 搜索工作栏 --> |
|||
<Search :schema="SubjectAccount.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" /> |
|||
</ContentWrap> |
|||
|
|||
<!-- 列表头部 --> |
|||
<TableHead |
|||
:HeadButttondata="HeadButttondata" |
|||
@button-base-click="buttonBaseClick" |
|||
:routeName="routeName" |
|||
@updataTableColumns="updataTableColumns" |
|||
@searchFormClick="searchFormClick" |
|||
:allSchemas="SubjectAccount.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="SubjectAccountRules" |
|||
:formAllSchemas="SubjectAccount.allSchemas" |
|||
:apiUpdate="SubjectAccountApi.updateSubjectAccount" |
|||
:apiCreate="SubjectAccountApi.createSubjectAccount" |
|||
@searchTableSuccess="searchTableSuccess" |
|||
:isBusiness="false" |
|||
/> |
|||
|
|||
<!-- 详情 --> |
|||
<Detail ref="detailRef" :isBasic="true" :allSchemas="SubjectAccount.allSchemas" /> |
|||
|
|||
<!-- 导入 --> |
|||
<ImportForm ref="importFormRef" url="/wms/subject-account/import" :importTemplateData="importTemplateData" @success="importSuccess" /> |
|||
</template> |
|||
|
|||
<script setup lang="ts"> |
|||
import download from '@/utils/download' |
|||
import { SubjectAccount,SubjectAccountRules } from './subjectAccount.data' |
|||
import * as SubjectAccountApi from '@/api/wms/subjectAccount' |
|||
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: 'SubjectAccount' }) |
|||
|
|||
const message = useMessage() // 消息弹窗 |
|||
const { t } = useI18n() // 国际化 |
|||
|
|||
const route = useRoute() // 路由信息 |
|||
const routeName = ref() |
|||
routeName.value = route.name |
|||
const tableColumns = ref(SubjectAccount.allSchemas.tableColumns) |
|||
|
|||
// 查询页面返回 |
|||
const searchTableSuccess = (formField, searchField, val, formRef) => { |
|||
nextTick(() => { |
|||
const setV = {} |
|||
if (formField === 'costecentreCode') { |
|||
setV['costecentreId'] = val[0]['costcentreId'] |
|||
setV['costcentreCode'] = val[0]['costcentreCode'] |
|||
setV['costecentreType'] = val[0]['costcentreType'] |
|||
} |
|||
if( formField === 'projectCode'){ |
|||
setV['projectId'] = val[0]['projectId'] |
|||
setV['projectCode'] = val[0]['projectCode'] |
|||
} |
|||
setV[formField] = val[0][searchField] |
|||
formRef.setValues(setV) |
|||
}) |
|||
} |
|||
|
|||
// 字段设置 更新主列表字段 |
|||
const updataTableColumns = (val) => { |
|||
tableColumns.value = val |
|||
} |
|||
|
|||
const { tableObject, tableMethods } = useTable({ |
|||
getListApi: SubjectAccountApi.getSubjectAccountPage // 分页接口 |
|||
}) |
|||
|
|||
// 获得表格的各种操作 |
|||
const { getList, setSearchParams } = tableMethods |
|||
|
|||
// 列表头部按钮 |
|||
const HeadButttondata = [ |
|||
defaultButtons.defaultAddBtn({hasPermi:'wms:subject-account:create'}), // 新增 |
|||
defaultButtons.defaultImportBtn({hasPermi:'wms:subject-account:import'}), // 导入 |
|||
defaultButtons.defaultExportBtn({hasPermi:'wms:subject-account: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:'wms:subject-account:update'}), // 编辑 |
|||
defaultButtons.mainListDeleteBtn({hasPermi:'wms:subject-account: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 =SubjectAccount.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 SubjectAccountApi.createSubjectAccount(data) |
|||
message.success(t('common.createSuccess')) |
|||
} else { |
|||
await SubjectAccountApi.updateSubjectAccount(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, 'basicSubjectAccount') |
|||
} |
|||
|
|||
/** 删除按钮操作 */ |
|||
const handleDelete = async (id: number) => { |
|||
try { |
|||
// 删除的二次确认 |
|||
await message.delConfirm() |
|||
// 发起删除 |
|||
await SubjectAccountApi.deleteSubjectAccount(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 SubjectAccountApi.exportSubjectAccount(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 SubjectAccountApi.importTemplate() |
|||
}) |
|||
|
|||
</script> |
@ -0,0 +1,166 @@ |
|||
import type { CrudSchema } from '@/hooks/web/useCrudSchemas' |
|||
import { dateFormatter } from '@/utils/formatTime' |
|||
import * as QadCostcentreApi from '@/api/wms/qadCostcentre' |
|||
import { QadCostcentre } from '../qadCostcentre/qadCostcentre.data' |
|||
import * as QadProjectApi from '@/api/wms/qadProject' |
|||
import { QadProject } from '../qadProject/qadProject.data' |
|||
|
|||
// 表单校验
|
|||
export const SubjectAccountRules = reactive({ |
|||
code: [required], |
|||
usageDescription: [required], |
|||
costecentreCode: [required], |
|||
projectId: [required], |
|||
projectCode: [required], |
|||
available: [required], |
|||
}) |
|||
|
|||
export const SubjectAccount = useCrudSchemas(reactive<CrudSchema[]>([ |
|||
{ |
|||
label: 'id', |
|||
field: 'id', |
|||
sort: 'custom', |
|||
isForm: false, |
|||
isTable:false, |
|||
}, |
|||
{ |
|||
label: '代码', |
|||
field: 'code', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
}, |
|||
{ |
|||
label: '领用描述', |
|||
field: 'usageDescription', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
}, |
|||
{ |
|||
label: '成本中心ID', |
|||
field: 'costecentreId', |
|||
sort: 'custom', |
|||
isSearch: false, |
|||
isTable:false, |
|||
form:{ |
|||
componentProps:{ |
|||
disabled:true |
|||
} |
|||
} |
|||
}, |
|||
{ |
|||
label: '成本中心代码', |
|||
field: 'costecentreCode', |
|||
sort: 'custom', |
|||
isSearch: false, |
|||
form: { |
|||
// labelMessage: '信息提示说明!!!',
|
|||
componentProps: { |
|||
isSearchList: true, // 开启查询弹窗
|
|||
searchListPlaceholder: '请选择物料代码', // 输入框占位文本
|
|||
searchField: 'costcentreCode', // 查询弹窗赋值字段
|
|||
searchTitle: '成本中心信息', // 查询弹窗标题
|
|||
searchAllSchemas: QadCostcentre.allSchemas, // 查询弹窗所需类
|
|||
searchPage: QadCostcentreApi.getQadCostcentrePage, // 查询弹窗所需分页方法
|
|||
searchCondition: [{ |
|||
key: 'available', |
|||
value: 'TRUE', |
|||
isMainValue: false |
|||
}] |
|||
} |
|||
} |
|||
}, |
|||
{ |
|||
label: '成本中心类型', |
|||
field: 'costecentreType', |
|||
sort: 'custom', |
|||
isSearch: false, |
|||
form:{ |
|||
componentProps:{ |
|||
disabled:true |
|||
} |
|||
} |
|||
}, |
|||
{ |
|||
label: '项目ID', |
|||
field: 'projectId', |
|||
sort: 'custom', |
|||
isSearch: false, |
|||
isTable:false, |
|||
disabled:true, |
|||
form:{ |
|||
componentProps:{ |
|||
disabled:true |
|||
} |
|||
} |
|||
}, |
|||
{ |
|||
label: '项目代码', |
|||
field: 'projectCode', |
|||
sort: 'custom', |
|||
isSearch: false, |
|||
form: { |
|||
// labelMessage: '信息提示说明!!!',
|
|||
componentProps: { |
|||
isSearchList: true, // 开启查询弹窗
|
|||
searchListPlaceholder: '请选择物料代码', // 输入框占位文本
|
|||
searchField: 'projectCode', // 查询弹窗赋值字段
|
|||
searchTitle: '物料基础信息', // 查询弹窗标题
|
|||
searchAllSchemas: QadProject.allSchemas, // 查询弹窗所需类
|
|||
searchPage: QadProjectApi.getQadProjectPage, // 查询弹窗所需分页方法
|
|||
searchCondition: [{ |
|||
key: 'available', |
|||
value: 'TRUE', |
|||
isMainValue: false |
|||
}] |
|||
} |
|||
} |
|||
}, |
|||
{ |
|||
label: '是否可用', |
|||
field: 'available', |
|||
sort: 'custom', |
|||
dictType: DICT_TYPE.TRUE_FALSE, |
|||
dictClass: 'string', |
|||
isTable: true, |
|||
table: { |
|||
width: 120 |
|||
}, |
|||
form: { |
|||
component: 'Switch', |
|||
value: 'TRUE', |
|||
componentProps: { |
|||
inactiveValue: 'FALSE', |
|||
activeValue: 'TRUE' |
|||
} |
|||
}, |
|||
}, |
|||
{ |
|||
label: '备注', |
|||
field: 'remark', |
|||
sort: 'custom', |
|||
}, |
|||
{ |
|||
label: '创建时间', |
|||
field: 'createTime', |
|||
sort: 'custom', |
|||
formatter: dateFormatter, |
|||
search: { |
|||
component: 'DatePicker', |
|||
componentProps: { |
|||
valueFormat: 'YYYY-MM-DD HH:mm:ss', |
|||
type: 'daterange', |
|||
defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')] |
|||
} |
|||
}, |
|||
isForm: false, |
|||
}, |
|||
{ |
|||
label: '操作', |
|||
field: '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