ljlong_2630
5 months ago
158 changed files with 7765 additions and 1016 deletions
@ -0,0 +1,63 @@ |
|||
import request from '@/config/axios' |
|||
|
|||
export interface BasicSpotCheckOptionVO { |
|||
id: number |
|||
code: string |
|||
name: string |
|||
selectId: number |
|||
describing: string |
|||
isUpdated: boolean |
|||
departmentCode: string |
|||
remark: string |
|||
siteId: string |
|||
available: string |
|||
deletionTime: Date |
|||
deleterId: byte[] |
|||
concurrencyStamp: number |
|||
} |
|||
|
|||
// 查询点检方案列表
|
|||
export const getBasicSpotCheckOptionPage = async (params) => { |
|||
if (params.isSearch) { |
|||
delete params.isSearch |
|||
const data = {...params} |
|||
return await request.post({ url: '/eam/basic-spotCheck-option/senior', data }) |
|||
} else { |
|||
return await request.get({ url: `/eam/basic-spotCheck-option/page`, params }) |
|||
} |
|||
} |
|||
|
|||
// 查询点检方案详情
|
|||
export const getBasicSpotCheckOption = async (id: number) => { |
|||
return await request.get({ url: `/eam/basic-spotCheck-option/get?id=` + id }) |
|||
} |
|||
|
|||
// 新增点检方案
|
|||
export const createBasicSpotCheckOption = async (data: BasicSpotCheckOptionVO) => { |
|||
return await request.post({ url: `/eam/basic-spotCheck-option/create`, data }) |
|||
} |
|||
|
|||
// 修改点检方案
|
|||
export const updateBasicSpotCheckOption = async (data: BasicSpotCheckOptionVO) => { |
|||
return await request.put({ url: `/eam/basic-spotCheck-option/update`, data }) |
|||
} |
|||
|
|||
// 删除点检方案
|
|||
export const deleteBasicSpotCheckOption = async (id: number) => { |
|||
return await request.delete({ url: `/eam/basic-spotCheck-option/delete?id=` + id }) |
|||
} |
|||
|
|||
// 导出点检方案 Excel
|
|||
export const exportBasicSpotCheckOption = async (params) => { |
|||
return await request.download({ url: `/eam/basic-spotCheck-option/export-excel`, params }) |
|||
} |
|||
|
|||
// 下载用户导入模板
|
|||
export const importTemplate = () => { |
|||
return request.download({ url: '/eam/basic-spotCheck-option/get-import-template' }) |
|||
} |
|||
|
|||
// 启用 / 禁用
|
|||
export const updateEnableCode = async (data: BasicSpotCheckOptionVO) => { |
|||
return await request.post({ url: `/eam/basic-spotCheck-option/ables` , data }) |
|||
} |
@ -0,0 +1,91 @@ |
|||
import request from '@/config/axios' |
|||
import {MaintenanceVO} from "@/api/eam/maintenance"; |
|||
|
|||
export interface PlanInspectionVO { |
|||
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 |
|||
lineCode: string |
|||
processCode: string |
|||
workstationCode: string |
|||
departmentCode: string |
|||
remark: string |
|||
siteId: string |
|||
available: string |
|||
deletionTime: Date |
|||
deleterId: byte[] |
|||
concurrencyStamp: number |
|||
} |
|||
|
|||
// 查询巡检计划列表
|
|||
export const getPlanInspectionPage = async (params) => { |
|||
if (params.isSearch) { |
|||
delete params.isSearch |
|||
const data = {...params} |
|||
return await request.post({ url: '/eam/plan-inspection/senior', data }) |
|||
} else { |
|||
return await request.get({ url: `/eam/plan-inspection/page`, params }) |
|||
} |
|||
} |
|||
|
|||
// 查询巡检计划详情
|
|||
export const getPlanInspection = async (id: number) => { |
|||
return await request.get({ url: `/eam/plan-inspection/get?id=` + id }) |
|||
} |
|||
|
|||
// 新增巡检计划
|
|||
export const createPlanInspection = async (data: PlanInspectionVO) => { |
|||
return await request.post({ url: `/eam/plan-inspection/create`, data }) |
|||
} |
|||
|
|||
// 修改巡检计划
|
|||
export const updatePlanInspection = async (data: PlanInspectionVO) => { |
|||
return await request.put({ url: `/eam/plan-inspection/update`, data }) |
|||
} |
|||
|
|||
// 修改巡检计划-审核
|
|||
export const updateInspectionPlanAudi = async (data: PlanInspectionVO) => { |
|||
return await request.post({ url: `/eam/plan-inspection/updateAudi`, data }) |
|||
} |
|||
|
|||
// 删除巡检计划
|
|||
export const deletePlanInspection = async (id: number) => { |
|||
return await request.delete({ url: `/eam/plan-inspection/delete?id=` + id }) |
|||
} |
|||
|
|||
// 导出巡检计划 Excel
|
|||
export const exportPlanInspection = async (params) => { |
|||
return await request.download({ url: `/eam/plan-inspection/export-excel`, params }) |
|||
} |
|||
|
|||
// 下载用户导入模板
|
|||
export const importTemplate = () => { |
|||
return request.download({ url: '/eam/plan-inspection/get-import-template' }) |
|||
} |
|||
|
|||
|
|||
// 启用 / 禁用
|
|||
export const updateEnableCode = async (data: PlanInspectionVO) => { |
|||
return await request.post({ url: `/eam/plan-inspection/ables` , data }) |
|||
} |
|||
|
|||
|
|||
// 修改计划状态
|
|||
export const updateInspectionPlan = async (data: PlanInspectionVO) => { |
|||
return await request.post({ url: `/eam/plan-inspection/updatePlan`, data }) |
|||
} |
@ -0,0 +1,91 @@ |
|||
import request from '@/config/axios' |
|||
import {PlanInspectionVO} from "@/api/eam/planInspection"; |
|||
|
|||
export interface PlanSpotCheckVO { |
|||
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 |
|||
lineCode: string |
|||
processCode: string |
|||
workstationCode: string |
|||
departmentCode: string |
|||
remark: string |
|||
siteId: string |
|||
available: string |
|||
deletionTime: Date |
|||
deleterId: byte[] |
|||
concurrencyStamp: number |
|||
} |
|||
|
|||
// 查询点检计划列表
|
|||
export const getPlanSpotCheckPage = async (params) => { |
|||
if (params.isSearch) { |
|||
delete params.isSearch |
|||
const data = {...params} |
|||
return await request.post({ url: '/eam/plan-spot-check/senior', data }) |
|||
} else { |
|||
return await request.get({ url: `/eam/plan-spot-check/page`, params }) |
|||
} |
|||
} |
|||
|
|||
// 查询点检计划详情
|
|||
export const getPlanSpotCheck = async (id: number) => { |
|||
return await request.get({ url: `/eam/plan-spot-check/get?id=` + id }) |
|||
} |
|||
|
|||
// 新增点检计划
|
|||
export const createPlanSpotCheck = async (data: PlanSpotCheckVO) => { |
|||
return await request.post({ url: `/eam/plan-spot-check/create`, data }) |
|||
} |
|||
|
|||
// 修改点检计划
|
|||
export const updatePlanSpotCheck = async (data: PlanSpotCheckVO) => { |
|||
return await request.put({ url: `/eam/plan-spot-check/update`, data }) |
|||
} |
|||
|
|||
// 修改巡检计划-审核
|
|||
export const updateSpotCheckPlanAudi = async (data: PlanSpotCheckVO) => { |
|||
return await request.post({ url: `/eam/plan-spot-check/updateAudi`, data }) |
|||
} |
|||
|
|||
// 删除点检计划
|
|||
export const deletePlanSpotCheck = async (id: number) => { |
|||
return await request.delete({ url: `/eam/plan-spot-check/delete?id=` + id }) |
|||
} |
|||
|
|||
// 导出点检计划 Excel
|
|||
export const exportPlanSpotCheck = async (params) => { |
|||
return await request.download({ url: `/eam/plan-spot-check/export-excel`, params }) |
|||
} |
|||
|
|||
// 下载用户导入模板
|
|||
export const importTemplate = () => { |
|||
return request.download({ url: '/eam/plan-spot-check/get-import-template' }) |
|||
} |
|||
|
|||
|
|||
// 启用 / 禁用
|
|||
export const updateEnableCode = async (data: PlanSpotCheckVO) => { |
|||
return await request.post({ url: `/eam/plan-spot-check/ables` , data }) |
|||
} |
|||
|
|||
|
|||
// 修改计划状态
|
|||
export const updateSpotCheckPlan = async (data: PlanSpotCheckVO) => { |
|||
return await request.post({ url: `/eam/plan-spot-check/updatePlan`, data }) |
|||
} |
@ -0,0 +1,58 @@ |
|||
import request from '@/config/axios' |
|||
|
|||
export interface SparePartsInLocationDetailVO { |
|||
id: number |
|||
number: string |
|||
masterId: number |
|||
sparePartsCode: string |
|||
isRadeIn: string |
|||
applyQty: number |
|||
departmentCode: string |
|||
remark: string |
|||
siteId: string |
|||
available: string |
|||
deletionTime: Date |
|||
deleterId: byte[] |
|||
concurrencyStamp: number |
|||
} |
|||
|
|||
// 查询备件入库记录子列表
|
|||
export const getSparePartsInLocationDetailPage = async (params) => { |
|||
if (params.isSearch) { |
|||
delete params.isSearch |
|||
const data = {...params} |
|||
return await request.post({ url: '/eam/spare-parts-in-location-detail/senior', data }) |
|||
} else { |
|||
return await request.get({ url: `/eam/spare-parts-in-location-detail/page`, params }) |
|||
} |
|||
} |
|||
|
|||
// 查询备件入库记录子详情
|
|||
export const getSparePartsInLocationDetail = async (id: number) => { |
|||
return await request.get({ url: `/eam/spare-parts-in-location-detail/get?id=` + id }) |
|||
} |
|||
|
|||
// 新增备件入库记录子
|
|||
export const createSparePartsInLocationDetail = async (data: SparePartsInLocationDetailVO) => { |
|||
return await request.post({ url: `/eam/spare-parts-in-location-detail/create`, data }) |
|||
} |
|||
|
|||
// 修改备件入库记录子
|
|||
export const updateSparePartsInLocationDetail = async (data: SparePartsInLocationDetailVO) => { |
|||
return await request.put({ url: `/eam/spare-parts-in-location-detail/update`, data }) |
|||
} |
|||
|
|||
// 删除备件入库记录子
|
|||
export const deleteSparePartsInLocationDetail = async (id: number) => { |
|||
return await request.delete({ url: `/eam/spare-parts-in-location-detail/delete?id=` + id }) |
|||
} |
|||
|
|||
// 导出备件入库记录子 Excel
|
|||
export const exportSparePartsInLocationDetail = async (params) => { |
|||
return await request.download({ url: `/eam/spare-parts-in-location-detail/export-excel`, params }) |
|||
} |
|||
|
|||
// 下载用户导入模板
|
|||
export const importTemplate = () => { |
|||
return request.download({ url: '/eam/spare-parts-in-location-detail/get-import-template' }) |
|||
} |
@ -0,0 +1,87 @@ |
|||
import request from '@/config/axios' |
|||
|
|||
export interface SparePartsInLocationMainVO { |
|||
id: number |
|||
number: string |
|||
theme: string |
|||
status: string |
|||
applyer: string |
|||
approver: number |
|||
approveContent: string |
|||
approveTime: Date |
|||
autoExamine: string |
|||
autoAgree: string |
|||
directCreateRecord: string |
|||
areaCode: string |
|||
locationCode: string |
|||
departmentCode: string |
|||
remark: string |
|||
siteId: string |
|||
available: string |
|||
deletionTime: Date |
|||
deleterId: byte[] |
|||
concurrencyStamp: number |
|||
} |
|||
|
|||
// 查询备件入库记录主列表
|
|||
export const getSparePartsInLocationMainPage = async (params) => { |
|||
if (params.isSearch) { |
|||
delete params.isSearch |
|||
const data = {...params} |
|||
return await request.post({ url: '/eam/spare-parts-in-location-main/senior', data }) |
|||
} else { |
|||
return await request.get({ url: `/eam/spare-parts-in-location-main/page`, params }) |
|||
} |
|||
} |
|||
|
|||
// 查询备件入库记录主详情
|
|||
export const getSparePartsInLocationMain = async (id: number) => { |
|||
return await request.get({ url: `/eam/spare-parts-in-location-main/get?id=` + id }) |
|||
} |
|||
|
|||
// 新增备件入库记录主
|
|||
export const createSparePartsInLocationMain = async (data: SparePartsInLocationMainVO) => { |
|||
return await request.post({ url: `/eam/spare-parts-in-location-main/create`, data }) |
|||
} |
|||
|
|||
// 修改备件入库记录主
|
|||
export const updateSparePartsInLocationMain = async (data: SparePartsInLocationMainVO) => { |
|||
return await request.put({ url: `/eam/spare-parts-in-location-main/update`, data }) |
|||
} |
|||
|
|||
// 删除备件入库记录主
|
|||
export const deleteSparePartsInLocationMain = async (id: number) => { |
|||
return await request.delete({ url: `/eam/spare-parts-in-location-main/delete?id=` + id }) |
|||
} |
|||
|
|||
// 导出备件入库记录主 Excel
|
|||
export const exportSparePartsInLocationMain = async (params) => { |
|||
if (params.isSearch) { |
|||
const data = {...params} |
|||
return await request.downloadPost({ url: `/eam/spare-parts-in-location-main/export-excel-senior`, data }) |
|||
}else{ |
|||
return await request.download({ url: `/eam/spare-parts-in-location-main/export-excel`, params }) |
|||
} |
|||
} |
|||
|
|||
// 下载用户导入模板
|
|||
export const importTemplate = () => { |
|||
return request.download({ url: '/eam/spare-parts-in-location-main/get-import-template' }) |
|||
} |
|||
|
|||
// 撤回
|
|||
export const cancelSparePartsInLocation = async (id) => { |
|||
return await request.get({ url: `/eam/spare-parts-in-location-main/cancel?id=` + id }) |
|||
} |
|||
// 审核
|
|||
export const submitExamineSparePartsInLocation = async (id) => { |
|||
return await request.get({ url: `/eam/spare-parts-in-location-main/submitExamine?id=` + id }) |
|||
} |
|||
// 审核驳回
|
|||
export const rejectSparePartsInLocation = async (id) => { |
|||
return await request.get({ url: `/eam/spare-parts-in-location-main/reject?id=` + id }) |
|||
} |
|||
// 审核通过
|
|||
export const approveSparePartsInLocation = async (data) => { |
|||
return await request.post({ url: `/eam/spare-parts-in-location-main/approve`,data }) |
|||
} |
@ -0,0 +1,58 @@ |
|||
import request from '@/config/axios' |
|||
|
|||
export interface SparePartsInLocationDetailRecordVO { |
|||
id: number |
|||
number: string |
|||
masterId: number |
|||
sparePartsCode: string |
|||
isRadeIn: string |
|||
applyQty: number |
|||
departmentCode: string |
|||
remark: string |
|||
siteId: string |
|||
available: string |
|||
deletionTime: Date |
|||
deleterId: byte[] |
|||
concurrencyStamp: number |
|||
} |
|||
|
|||
// 查询备件入库记录子列表
|
|||
export const getSparePartsInLocationDetailRecordPage = async (params) => { |
|||
if (params.isSearch) { |
|||
delete params.isSearch |
|||
const data = {...params} |
|||
return await request.post({ url: '/eam/spare-parts-in-location-detail-record/senior', data }) |
|||
} else { |
|||
return await request.get({ url: `/eam/spare-parts-in-location-detail-record/page`, params }) |
|||
} |
|||
} |
|||
|
|||
// 查询备件入库记录子详情
|
|||
export const getSparePartsInLocationDetailRecord = async (id: number) => { |
|||
return await request.get({ url: `/eam/spare-parts-in-location-detail-record/get?id=` + id }) |
|||
} |
|||
|
|||
// 新增备件入库记录子
|
|||
export const createSparePartsInLocationDetailRecord = async (data: SparePartsInLocationDetailRecordVO) => { |
|||
return await request.post({ url: `/eam/spare-parts-in-location-detail-record/create`, data }) |
|||
} |
|||
|
|||
// 修改备件入库记录子
|
|||
export const updateSparePartsInLocationDetailRecord = async (data: SparePartsInLocationDetailRecordVO) => { |
|||
return await request.put({ url: `/eam/spare-parts-in-location-detail-record/update`, data }) |
|||
} |
|||
|
|||
// 删除备件入库记录子
|
|||
export const deleteSparePartsInLocationDetailRecord = async (id: number) => { |
|||
return await request.delete({ url: `/eam/spare-parts-in-location-detail-record/delete?id=` + id }) |
|||
} |
|||
|
|||
// 导出备件入库记录子 Excel
|
|||
export const exportSparePartsInLocationDetailRecord = async (params) => { |
|||
return await request.download({ url: `/eam/spare-parts-in-location-detail-record/export-excel`, params }) |
|||
} |
|||
|
|||
// 下载用户导入模板
|
|||
export const importTemplate = () => { |
|||
return request.download({ url: '/eam/spare-parts-in-location-detail-record/get-import-template' }) |
|||
} |
@ -0,0 +1,72 @@ |
|||
import request from '@/config/axios' |
|||
|
|||
export interface SparePartsInLocationMainRecordVO { |
|||
id: number |
|||
number: string |
|||
theme: string |
|||
status: string |
|||
applyer: string |
|||
approver: number |
|||
approveContent: string |
|||
approveTime: Date |
|||
autoExamine: string |
|||
autoAgree: string |
|||
directCreateRecord: string |
|||
areaCode: string |
|||
locationCode: string |
|||
departmentCode: string |
|||
remark: string |
|||
siteId: string |
|||
available: string |
|||
deletionTime: Date |
|||
deleterId: byte[] |
|||
concurrencyStamp: number |
|||
} |
|||
|
|||
// 查询备件入库记录主列表
|
|||
export const getSparePartsInLocationMainRecordPage = async (params) => { |
|||
if (params.isSearch) { |
|||
delete params.isSearch |
|||
const data = { ...params } |
|||
return await request.post({ url: '/eam/spare-parts-in-location-main-record/senior', data }) |
|||
} else { |
|||
return await request.get({ url: `/eam/spare-parts-in-location-main-record/page`, params }) |
|||
} |
|||
} |
|||
|
|||
// 查询备件入库记录主详情
|
|||
export const getSparePartsInLocationMainRecord = async (id: number) => { |
|||
return await request.get({ url: `/eam/spare-parts-in-location-main-record/get?id=` + id }) |
|||
} |
|||
|
|||
// 新增备件入库记录主
|
|||
export const createSparePartsInLocationMainRecord = async ( |
|||
data: SparePartsInLocationMainRecordVO |
|||
) => { |
|||
return await request.post({ url: `/eam/spare-parts-in-location-main-record/create`, data }) |
|||
} |
|||
|
|||
// 修改备件入库记录主
|
|||
export const updateSparePartsInLocationMainRecord = async ( |
|||
data: SparePartsInLocationMainRecordVO |
|||
) => { |
|||
return await request.put({ url: `/eam/spare-parts-in-location-main-record/update`, data }) |
|||
} |
|||
|
|||
// 删除备件入库记录主
|
|||
export const deleteSparePartsInLocationMainRecord = async (id: number) => { |
|||
return await request.delete({ url: `/eam/spare-parts-in-location-main-record/delete?id=` + id }) |
|||
} |
|||
|
|||
// 导出备件入库记录主 Excel
|
|||
export const exportSparePartsInLocationMainRecord = async (params) => { |
|||
return await request.download({ |
|||
url: `/eam/spare-parts-in-location-main-record/export-excel`, |
|||
params |
|||
}) |
|||
} |
|||
|
|||
// 下载用户导入模板
|
|||
export const importTemplate = () => { |
|||
return request.download({ url: '/eam/spare-parts-in-location-main-record/get-import-template' }) |
|||
} |
@ -0,0 +1,54 @@ |
|||
import request from '@/utils/request' |
|||
|
|||
// 创建领用出库记录子
|
|||
export function createSparePartsOutLocationRecordDetail(data) { |
|||
return request({ |
|||
url: '/eam/spare-parts-out-location-detail-record/create', |
|||
method: 'post', |
|||
data: data |
|||
}) |
|||
} |
|||
|
|||
// 更新领用出库记录子
|
|||
export function updateSparePartsOutLocationRecordDetail(data) { |
|||
return request({ |
|||
url: '/eam/spare-parts-out-location-detail-record/update', |
|||
method: 'put', |
|||
data: data |
|||
}) |
|||
} |
|||
|
|||
// 删除领用出库记录子
|
|||
export function deleteSparePartsOutLocationRecordDetail(id) { |
|||
return request({ |
|||
url: '/eam/spare-parts-out-location-detail-record/delete?id=' + id, |
|||
method: 'delete' |
|||
}) |
|||
} |
|||
|
|||
// 获得领用出库记录子
|
|||
export function getSparePartsOutLocationRecordDetail(id) { |
|||
return request({ |
|||
url: '/eam/spare-parts-out-location-detail-record/get?id=' + id, |
|||
method: 'get' |
|||
}) |
|||
} |
|||
|
|||
// 获得领用出库记录子分页
|
|||
export function getSparePartsOutLocationRecordDetailPage(query) { |
|||
return request({ |
|||
url: '/eam/spare-parts-out-location-detail-record/page', |
|||
method: 'get', |
|||
params: query |
|||
}) |
|||
} |
|||
|
|||
// 导出领用出库记录子 Excel
|
|||
export function exportSparePartsOutLocationRecordDetailExcel(query) { |
|||
return request({ |
|||
url: '/eam/spare-parts-out-location-detail-record/export-excel', |
|||
method: 'get', |
|||
params: query, |
|||
responseType: 'blob' |
|||
}) |
|||
} |
@ -0,0 +1,71 @@ |
|||
import request from '@/config/axios' |
|||
|
|||
export interface SparePartsOutLocationRecordMainVO { |
|||
id: number |
|||
number: string |
|||
theme: string |
|||
applyer: string |
|||
approver: number |
|||
approveContent: string |
|||
approveTime: Date |
|||
autoExamine: string |
|||
autoAgree: string |
|||
directCreateRecord: string |
|||
areaCode: string |
|||
locationCode: string |
|||
departmentCode: string |
|||
remark: string |
|||
siteId: string |
|||
available: string |
|||
deletionTime: Date |
|||
deleterId: byte[] |
|||
concurrencyStamp: number |
|||
} |
|||
|
|||
// 查询领用出库记录主列表
|
|||
export const getSparePartsOutLocationRecordMainPage = async (params) => { |
|||
if (params.isSearch) { |
|||
delete params.isSearch |
|||
const data = { ...params } |
|||
return await request.post({ url: '/eam/spare-parts-out-location-main-record/senior', data }) |
|||
} else { |
|||
return await request.get({ url: `/eam/spare-parts-out-location-main-record/page`, params }) |
|||
} |
|||
} |
|||
|
|||
// 查询领用出库记录主详情
|
|||
export const getSparePartsOutLocationRecordMain = async (id: number) => { |
|||
return await request.get({ url: `/eam/spare-parts-out-location-main-record/get?id=` + id }) |
|||
} |
|||
|
|||
// 新增领用出库记录主
|
|||
export const createSparePartsOutLocationRecordMain = async ( |
|||
data: SparePartsOutLocationRecordMainVO |
|||
) => { |
|||
return await request.post({ url: `/eam/spare-parts-out-location-main-record/create`, data }) |
|||
} |
|||
|
|||
// 修改领用出库记录主
|
|||
export const updateSparePartsOutLocationRecordMain = async ( |
|||
data: SparePartsOutLocationRecordMainVO |
|||
) => { |
|||
return await request.put({ url: `/eam/spare-parts-out-location-main-record/update`, data }) |
|||
} |
|||
|
|||
// 删除领用出库记录主
|
|||
export const deleteSparePartsOutLocationRecordMain = async (id: number) => { |
|||
return await request.delete({ url: `/eam/spare-parts-out-location-main-record/delete?id=` + id }) |
|||
} |
|||
|
|||
// 导出领用出库记录主 Excel
|
|||
export const exportSparePartsOutLocationRecordMain = async (params) => { |
|||
return await request.download({ |
|||
url: `/eam/spare-parts-out-location-main-record/export-excel`, |
|||
params |
|||
}) |
|||
} |
|||
|
|||
// 下载用户导入模板
|
|||
export const importTemplate = () => { |
|||
return request.download({ url: '/eam/spare-parts-out-location-main-record/get-import-template' }) |
|||
} |
@ -0,0 +1,300 @@ |
|||
import type { CrudSchema } from '@/hooks/web/useCrudSchemas' |
|||
|
|||
import * as ItemAccountsApi from '@/api/eam/itemAccounts' |
|||
import { ItemAccounts } from '@/views/eam/itemAccounts/itemAccounts.data' |
|||
|
|||
import { EquipmentAccounts } from '@/views/eam/equipmentAccounts/equipmentAccounts.data' |
|||
import * as EquipmentItemApi from '@/api/eam/equipmentAccounts' |
|||
|
|||
import { dateFormatter } from '@/utils/formatTime' |
|||
|
|||
export const SparePartsOutLocationRecordMain = useCrudSchemas( |
|||
reactive<CrudSchema[]>([ |
|||
{ |
|||
label: '申请编号', |
|||
field: 'number', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
isForm: false |
|||
}, |
|||
{ |
|||
label: '描述', |
|||
field: 'description', |
|||
sort: 'custom', |
|||
isSearch: true |
|||
}, |
|||
{ |
|||
label: '申领备件总价', |
|||
field: 'sumVal', |
|||
sort: 'custom', |
|||
isSearch: false, |
|||
isTable: false, |
|||
isForm: false |
|||
}, |
|||
{ |
|||
label: '流程状态', |
|||
field: 'status', |
|||
sort: 'custom', |
|||
dictType: DICT_TYPE.SPAREPARTS_APPLY_STATUS_ENUM, |
|||
dictClass: 'string', // 默认都是字符串类型其他暂不考虑
|
|||
isSearch: true, |
|||
form: { |
|||
component: 'Select' |
|||
} |
|||
}, |
|||
{ |
|||
label: '申请人', |
|||
field: 'applyer', |
|||
sort: 'custom', |
|||
isSearch: false, |
|||
isTable: false, |
|||
isForm: false |
|||
}, |
|||
{ |
|||
label: '审核人', |
|||
field: 'approver', |
|||
sort: 'custom', |
|||
isSearch: false, |
|||
isTable: false, |
|||
isForm: false, |
|||
form: { |
|||
component: 'InputNumber', |
|||
value: 0 |
|||
} |
|||
}, |
|||
{ |
|||
label: '审核内容', |
|||
field: 'approveContent', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
isTable: false, |
|||
isForm: false |
|||
}, |
|||
{ |
|||
label: '审核时间', |
|||
field: 'approveTime', |
|||
sort: 'custom', |
|||
formatter: dateFormatter, |
|||
isSearch: false, |
|||
isTable: false, |
|||
isForm: 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', |
|||
isSearch: false, |
|||
isTable: false, |
|||
isForm: false |
|||
}, |
|||
{ |
|||
label: '自动通过', |
|||
field: 'autoAgree', |
|||
sort: 'custom', |
|||
isSearch: false, |
|||
isTable: false, |
|||
isForm: false |
|||
}, |
|||
{ |
|||
label: '直接生成记录', |
|||
field: 'directCreateRecord', |
|||
sort: 'custom', |
|||
isSearch: false, |
|||
isTable: false, |
|||
isForm: false |
|||
}, |
|||
{ |
|||
label: '创建时间', |
|||
field: 'createTime', |
|||
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')] |
|||
} |
|||
}, |
|||
isForm: false |
|||
}, |
|||
{ |
|||
label: '操作', |
|||
field: 'action', |
|||
isForm: false, |
|||
table: { |
|||
width: 150, |
|||
fixed: 'right' |
|||
} |
|||
} |
|||
]) |
|||
) |
|||
|
|||
//表单校验
|
|||
export const SparePartsOutLocationRecordMainRules = reactive({ |
|||
description: [{ required: true, message: '描述不能为空', trigger: 'change' }] |
|||
}) |
|||
/** |
|||
* @returns {Array} 备件申请子表 |
|||
*/ |
|||
export const SparePartsOutLocationRecordDetail = useCrudSchemas( |
|||
reactive<CrudSchema[]>([ |
|||
{ |
|||
label: '备件编号', |
|||
field: 'sparePartsCode', |
|||
sort: 'custom', |
|||
table: { |
|||
width: 150 |
|||
}, |
|||
form: { |
|||
// labelMessage: '信息提示说明!!!',
|
|||
componentProps: { |
|||
isSearchList: true, // 开启查询弹窗
|
|||
searchListPlaceholder: '请选择备件编号', // 输入框占位文本
|
|||
searchField: 'itemNumber', // 查询弹窗赋值字段
|
|||
searchTitle: '备件信息', // 查询弹窗标题
|
|||
searchAllSchemas: ItemAccounts.allSchemas, // 查询弹窗所需类
|
|||
searchPage: ItemAccountsApi.getItemAccountsPage, // 查询弹窗所需分页方法
|
|||
searchCondition: [ |
|||
{ |
|||
key: 'available', |
|||
value: 'TRUE', |
|||
isMainValue: false |
|||
} |
|||
] |
|||
} |
|||
}, |
|||
tableForm: { |
|||
isInpuFocusShow: true, |
|||
searchListPlaceholder: '请选择备件编号', // 输入框占位文本
|
|||
searchField: 'itemNumber', // 查询弹窗赋值字段
|
|||
searchTitle: '备件信息', // 查询弹窗标题
|
|||
searchAllSchemas: ItemAccounts.allSchemas, // 查询弹窗所需类
|
|||
searchPage: ItemAccountsApi.getItemAccountsPage, // 查询弹窗所需分页方法
|
|||
searchCondition: [ |
|||
{ |
|||
key: 'available', |
|||
value: 'TRUE', |
|||
isMainValue: false |
|||
} |
|||
] |
|||
} |
|||
}, |
|||
{ |
|||
label: '设备类别', |
|||
field: 'type', |
|||
dictType: DICT_TYPE.DEVICE_TYPE, |
|||
dictClass: 'string', |
|||
isTable: true, |
|||
sort: 'custom', |
|||
isSearch: false, |
|||
table: { |
|||
width: 150 |
|||
}, |
|||
tableForm: { |
|||
type: 'Select' |
|||
} |
|||
}, |
|||
{ |
|||
label: '设备工装编号', |
|||
field: 'equipmentCode', |
|||
sort: 'custom', |
|||
table: { |
|||
width: 150 |
|||
}, |
|||
form: { |
|||
// labelMessage: '信息提示说明!!!',
|
|||
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 |
|||
} |
|||
] |
|||
} |
|||
}, |
|||
tableForm: { |
|||
isInpuFocusShow: true, |
|||
searchListPlaceholder: '请选择备件编号', // 输入框占位文本
|
|||
searchField: 'code', // 查询弹窗赋值字段
|
|||
searchTitle: '备件信息', // 查询弹窗标题
|
|||
searchAllSchemas: EquipmentAccounts.allSchemas, // 查询弹窗所需类
|
|||
searchPage: EquipmentItemApi.getEquipmentAccountsPage, // 查询弹窗所需分页方法
|
|||
searchCondition: [ |
|||
{ |
|||
key: 'status', |
|||
value: 'NORMAL', |
|||
action: '==', |
|||
isSearch: true, |
|||
isMainValue: false |
|||
} |
|||
] |
|||
} |
|||
}, |
|||
|
|||
{ |
|||
label: '库存数量', |
|||
field: 'currentQty', |
|||
sort: 'custom', |
|||
isSearch: false, |
|||
tableForm: { |
|||
disabled: true |
|||
} |
|||
}, |
|||
{ |
|||
label: '申领数量', |
|||
field: 'applyQty', |
|||
sort: 'custom', |
|||
isSearch: false |
|||
}, |
|||
{ |
|||
label: '备注', |
|||
field: 'remark', |
|||
sort: 'custom', |
|||
isSearch: false |
|||
}, |
|||
{ |
|||
label: '操作', |
|||
field: 'action', |
|||
isDetail: false, |
|||
isForm: false, |
|||
table: { |
|||
width: 150, |
|||
fixed: 'right' |
|||
}, |
|||
isTableForm: false |
|||
} |
|||
]) |
|||
) |
|||
|
|||
//表单校验
|
|||
export const SparePartsOutLocationRecordDetailRules = reactive({ |
|||
applyQty: [{ required: true, message: '请输入标包数量', trigger: 'blur' }] |
|||
}) |
@ -0,0 +1,374 @@ |
|||
<template> |
|||
<ContentWrap> |
|||
<!-- 搜索工作栏 --> |
|||
<Search |
|||
:schema="SparePartsOutLocationRecordMain.allSchemas.searchSchema" |
|||
@search="setSearchParams" |
|||
@reset="setSearchParams" |
|||
/> |
|||
</ContentWrap> |
|||
|
|||
<!-- 列表头部 --> |
|||
<TableHead |
|||
:HeadButttondata="HeadButttondata" |
|||
@button-base-click="buttonBaseClick" |
|||
:routeName="routeName" |
|||
@updataTableColumns="updataTableColumns" |
|||
@searchFormClick="searchFormClick" |
|||
:allSchemas="SparePartsOutLocationRecordMain.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="formRef" |
|||
@success="getList" |
|||
:rules="SparePartsOutLocationRecordMainRules" |
|||
:formAllSchemas="SparePartsOutLocationRecordMain.allSchemas" |
|||
:tableAllSchemas="SparePartsOutLocationRecordDetail.allSchemas" |
|||
:tableFormRules="SparePartsOutLocationRecordDetailRules" |
|||
:tableData="tableData" |
|||
:apiUpdate="SparePartsOutLocationRecordMainApi.updateSparePartsOutLocationRecordMain" |
|||
:apiCreate="SparePartsOutLocationRecordMainApi.createSparePartsOutLocationRecordMain" |
|||
:isBusiness="true" |
|||
@handleAddTable="handleAddTable" |
|||
@handleDeleteTable="handleDeleteTable" |
|||
@searchTableSuccess="searchTableSuccess" |
|||
@submitForm="submitForm" |
|||
/> |
|||
|
|||
<!-- 详情 --> |
|||
<Detail |
|||
ref="detailRef" |
|||
:isBasic="false" |
|||
:allSchemas="SparePartsOutLocationRecordMain.allSchemas" |
|||
:detailAllSchemas="SparePartsOutLocationRecordDetail.allSchemas" |
|||
:detailAllSchemasRules="SparePartsOutLocationRecordDetailRules" |
|||
:apiCreate="SparePartsOutLocationRecordDetailApi.createSparePartsOutLocationRecordDetail" |
|||
:apiUpdate="SparePartsOutLocationRecordDetailApi.updateSparePartsOutLocationRecordDetail" |
|||
:apiPage="SparePartsOutLocationRecordDetailApi.getSparePartsOutLocationRecordDetailPage" |
|||
:apiDelete="SparePartsOutLocationRecordDetailApi.deleteSparePartsOutLocationRecordDetail" |
|||
@searchTableSuccessDetail="searchTableSuccessDetail" |
|||
:isShowAddBtn="false" |
|||
:detailButtonIsShow="true" |
|||
/> |
|||
|
|||
<!-- 导入 --> |
|||
<ImportForm |
|||
ref="importFormRef" |
|||
url="/eam/sparePartsOutLocationRecordDetail/import" |
|||
:importTemplateData="importTemplateData" |
|||
@success="importSuccess" |
|||
/> |
|||
</template> |
|||
|
|||
<script setup lang="ts"> |
|||
import download from '@/utils/download' |
|||
import { |
|||
SparePartsOutLocationRecordMain, |
|||
SparePartsOutLocationRecordMainRules, |
|||
SparePartsOutLocationRecordDetail, |
|||
SparePartsOutLocationRecordDetailRules |
|||
} from '.SparePartsOutLocationRecord.data' |
|||
import * as SparePartsOutLocationRecordMainApi from '@/api/eam/sparePartsOutLocationRecordMain/index' |
|||
import * as SparePartsOutLocationRecordDetailApi from '@/api/eam/sparePartsOutLocationRecordDetail/sparePartsOutLocationDetailRecord.js' |
|||
import * as defaultButtons from '@/utils/disposition/defaultButtons' |
|||
import TableHead from '@/components/TableHead/src/TableHead.vue' |
|||
import ImportForm from '@/components/ImportForm/src/ImportForm.vue' |
|||
|
|||
// 采购订单 |
|||
defineOptions({ name: 'SparePartsOutLocationRecord' }) |
|||
|
|||
const message = useMessage() // 消息弹窗 |
|||
const { t } = useI18n() // 国际化 |
|||
const route = useRoute() // 路由信息 |
|||
const routeName = ref() |
|||
routeName.value = route.name |
|||
const tableColumns = ref(SparePartsOutLocationRecordMain.allSchemas.tableColumns) |
|||
|
|||
// 字段设置 更新主列表字段 |
|||
const updataTableColumns = (val) => { |
|||
tableColumns.value = val |
|||
} |
|||
|
|||
// 查询页面返回 |
|||
const searchTableSuccess = (formField, searchField, val, formRef, type, row) => { |
|||
nextTick(() => { |
|||
nextTick(() => { |
|||
const setV = {} |
|||
setV[formField] = val[0][searchField] |
|||
if (formField == 'sparePartsCode') { |
|||
row['sparePartsCode'] = val[0].itemNumber |
|||
row['currentQty'] = val[0].qty |
|||
} |
|||
if (formField == 'equipmentCode') { |
|||
row['equipmentCode'] = val[0].code |
|||
} |
|||
formRef.setValues(setV) |
|||
}) |
|||
}) |
|||
} |
|||
// 查询页面返回——详情 |
|||
const searchTableSuccessDetail = (formField, searchField, val, formRef) => { |
|||
nextTick(async () => { |
|||
const setV = {} |
|||
// if(formField == 'itemCode'){ |
|||
// await ItembasicApi.getItembasicPage({ |
|||
// code: setV['itemCode'] |
|||
// }).then(res => { |
|||
// setV['uom'] = res.list[0].uom |
|||
// setV[formField] = val[0][searchField] |
|||
// }) |
|||
// } |
|||
formRef.setValues(setV) |
|||
}) |
|||
} |
|||
|
|||
// 子表新增的时候选择表格之后需要会显得字段 |
|||
const Echo = [] |
|||
const { tableObject, tableMethods } = useTable({ |
|||
getListApi: SparePartsOutLocationRecordMainApi.getSparePartsOutLocationRecordMainPage // 分页接口 |
|||
}) |
|||
|
|||
// 获得表格的各种操作 |
|||
const { getList, setSearchParams } = tableMethods |
|||
|
|||
// 列表头部按钮 |
|||
const HeadButttondata = [ |
|||
defaultButtons.defaultAddBtn(null), // 新增 |
|||
// defaultButtons.defaultImportBtn(null), // 导入 |
|||
// defaultButtons.defaultExportBtn(null), // 导出 |
|||
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.mainAdjust(null),// 盘点调整 |
|||
] |
|||
} |
|||
|
|||
// 列表-操作按钮事件 |
|||
const buttonTableClick = async (val, row) => { |
|||
if (val == 'edit') { |
|||
// 编辑 |
|||
openForm('update', row) |
|||
} |
|||
// else if (val == 'mainOrderClo') { |
|||
// // 关闭 |
|||
// handleClose(row.id) |
|||
// } |
|||
else if (val == 'delete') { |
|||
// 删除 |
|||
handleDelete(row.id) |
|||
} |
|||
} |
|||
|
|||
/** 添加/修改操作 */ |
|||
const formRef = ref() |
|||
const openForm = async (type: string, row?: number) => { |
|||
tableData.value = [] // 重置明细数据 |
|||
formRef.value.open(type, row) |
|||
} |
|||
|
|||
/** 详情操作 */ |
|||
const detailRef = ref() |
|||
const openDetail = (row: any, titleName: any, titleValue: any) => { |
|||
detailRef.value.openDetail(row, titleName, titleValue, 'basicSparePartsOutLocationRecordMain') |
|||
} |
|||
|
|||
/** 删除按钮操作 */ |
|||
const handleDelete = async (id: number) => { |
|||
try { |
|||
// 删除的二次确认 |
|||
await message.delConfirm() |
|||
// 发起删除 |
|||
await SparePartsOutLocationRecordMainApi.deleteSparePartsOutLocationRecordMain(id) |
|||
message.success(t('common.delSuccess')) |
|||
// 刷新列表 |
|||
await getList() |
|||
} catch {} |
|||
} |
|||
|
|||
/** 列表导出按钮操作 */ |
|||
const exportLoading = ref(false) // 导出的加载中 |
|||
const handleMainExport = async (id: number) => { |
|||
try { |
|||
// 导出的二次确认 |
|||
await message.exportConfirm() |
|||
// 发起导出 |
|||
exportLoading.value = true |
|||
const data = await SparePartsOutLocationRecordMainApi.exportSparePartsOutLocationRecordMain(id) |
|||
download.excel(data, '盘点工单.xlsx') |
|||
} catch { |
|||
} finally { |
|||
exportLoading.value = false |
|||
} |
|||
} |
|||
|
|||
/** 关闭按钮操作 */ |
|||
// const handleClose = async (id: number) => { |
|||
// try { |
|||
// // 关闭的二次确认 |
|||
// await message.confirm('是否关闭所选中数据?') |
|||
// // 发起关闭 |
|||
// await SparePartsOutLocationRecordMainApi.closeSparePartsOutLocationRecordMain(id) |
|||
// message.success(t('关闭成功!')) |
|||
// // 刷新列表 |
|||
// await getList() |
|||
// } catch {} |
|||
// } |
|||
|
|||
/** 导出按钮操作 */ |
|||
const handleExport = async () => { |
|||
try { |
|||
// 导出的二次确认 |
|||
await message.exportConfirm() |
|||
// 发起导出 |
|||
exportLoading.value = true |
|||
const data = await SparePartsOutLocationRecordMainApi.exportSparePartsOutLocationRecordMain( |
|||
tableObject.params |
|||
) |
|||
download.excel(data, '备件申领记录主.xlsx') |
|||
} catch { |
|||
} finally { |
|||
exportLoading.value = false |
|||
} |
|||
} |
|||
|
|||
/** |
|||
* tableForm方法 |
|||
*/ |
|||
const tableFormKeys = {} |
|||
SparePartsOutLocationRecordDetail.allSchemas.tableFormColumns.forEach((item) => { |
|||
tableFormKeys[item.field] = item.default ? item.default : '' |
|||
}) |
|||
const tableData = ref([]) |
|||
|
|||
// 添加明细 |
|||
const handleAddTable = () => { |
|||
tableData.value.push(JSON.parse(JSON.stringify(tableFormKeys))) |
|||
} |
|||
// 删除明细 |
|||
const handleDeleteTable = (item, index) => { |
|||
tableData.value.splice(index, 1) |
|||
} |
|||
|
|||
// 主子数据 提交 |
|||
const submitForm = async (formType, data) => { |
|||
data.subList = tableData.value // 拼接子表数据参数 |
|||
try { |
|||
if (formType === 'create') { |
|||
await SparePartsOutLocationRecordMainApi.createSparePartsOutLocationRecordMain(data) |
|||
message.success(t('common.createSuccess')) |
|||
} else { |
|||
await SparePartsOutLocationRecordMainApi.updateSparePartsOutLocationRecordMain(data) |
|||
message.success(t('common.updateSuccess')) |
|||
} |
|||
formRef.value.dialogVisible = false |
|||
// 刷新当前列表 |
|||
getList() |
|||
} finally { |
|||
formRef.value.formLoading = 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 SparePartsOutLocationRecordMainApi.importTemplate() |
|||
}) |
|||
</script> |
@ -0,0 +1,393 @@ |
|||
<template> |
|||
<Dialog v-model="dialogVisible" :title="dialogTitle"> |
|||
<el-form |
|||
ref="basicFormRef" |
|||
v-loading="formLoading" |
|||
:model="formData" |
|||
:rules="formRules" |
|||
label-width="100px" |
|||
> |
|||
<el-row> |
|||
<el-col :span="12"> |
|||
<el-form-item label="方案编号" prop="code"> |
|||
<el-input v-model="formData.code" placeholder="方案编号" :disabled="isDisabled"/> |
|||
</el-form-item> |
|||
</el-col> |
|||
<el-col :span="12"> |
|||
<el-form-item label="方案名称" prop="name"> |
|||
<el-input v-model="formData.name" placeholder="请输入方案名称" /> |
|||
</el-form-item> |
|||
</el-col> |
|||
</el-row> |
|||
<el-row> |
|||
<el-col :span="12"> |
|||
<el-form-item label="是否可修改" prop="isUpdated"> |
|||
<el-select v-model="formData.isUpdated" style="width: 200px"> |
|||
<el-option label="是" value="TRUE"></el-option> |
|||
<el-option label="否" value="FALSE"></el-option> |
|||
</el-select> |
|||
</el-form-item> |
|||
</el-col> |
|||
<el-col :span="12"> |
|||
<el-form-item label="描述" prop="describing"> |
|||
<el-input v-model="formData.describing" placeholder="请输入描述" /> |
|||
</el-form-item> |
|||
</el-col> |
|||
</el-row> |
|||
<el-row> |
|||
<el-col :span="12"> |
|||
<el-form-item label="是否可用" prop="available"> |
|||
<el-select v-model="formData.available" style="width: 200px"> |
|||
<el-option label="是" value="TRUE"></el-option> |
|||
<el-option label="否" value="FALSE"></el-option> |
|||
</el-select> |
|||
</el-form-item> |
|||
</el-col> |
|||
<el-col :span="12"> |
|||
<el-form-item label="备注" prop="remark"> |
|||
<el-input v-model="formData.remark" placeholder="请输入备注" /> |
|||
</el-form-item> |
|||
</el-col> |
|||
</el-row> |
|||
<el-row> |
|||
<el-col :span="11"> |
|||
<el-form-item label="选择集ID" prop="selectId"> |
|||
<div class="tag-container flex gap-2"> |
|||
<el-tag v-for="ent in tags" :key="ent.selectId" closable :disable-transitions="false" @close="handleClose(ent.selectId)"> |
|||
{{ ent.selectId}} |
|||
</el-tag> |
|||
<el-input v-if="inputVisible" ref="InputRef" v-model="inputValue" class="w-20" size="small"/> |
|||
<el-button v-else class="button-new-tag" size="small" @click="addItem"> |
|||
添加巡检选择集 |
|||
</el-button> |
|||
</div> |
|||
</el-form-item> |
|||
</el-col> |
|||
</el-row> |
|||
</el-form> |
|||
<el-table :data="inspectionItemData" style="width: 100%; height: 80%"> |
|||
<el-table-column prop="itemCode" label="巡检项ID" /> |
|||
<el-table-column prop="itemName" label="巡检名称" /> |
|||
<el-table-column prop="isSelectd" label="" width="150" > |
|||
<template #header> |
|||
<span>是否必选(默认是)</span> |
|||
</template> |
|||
<template #default="scope"> |
|||
<el-switch |
|||
v-model="scope.row.isSelectd" |
|||
active-color="#13ce66" |
|||
inactive-color="#ff4949" |
|||
active-text="是" |
|||
inactive-text="否" |
|||
/> |
|||
</template> |
|||
</el-table-column> |
|||
</el-table> |
|||
<el-pagination |
|||
small |
|||
:page-size="3" |
|||
background |
|||
layout="prev, pager, next" |
|||
:total="5" |
|||
class="mt-4" |
|||
@current-change="handleGroupPageChange" |
|||
/> |
|||
<template #footer> |
|||
<el-button :disabled="formLoading" type="primary" @click="submitForm">确 定</el-button> |
|||
<el-button @click="dialogVisible = false">取 消</el-button> |
|||
</template> |
|||
</Dialog> |
|||
|
|||
<!--添加巡检项弹窗--> |
|||
<SearchTable ref="searchTableRef" @searchTableSuccess="searchTableSuccess" /> |
|||
|
|||
</template> |
|||
<script lang="ts" setup> |
|||
import * as BasicInspectionOptionApi from '@/api/eam/basicInspectionOption' |
|||
import request from "@/config/axios"; |
|||
import { SearchTable } from '@/components/SearchTable' |
|||
import { InspectionItemSelectSet} from "@/views/eam/inspectionItemSelectSet/inspectionItemSelectSet.data"; |
|||
import * as inspectionItemItemSelectSetApi from "@/api/eam/inspectionItemSelectSet"; |
|||
import {ElInput} from "element-plus"; |
|||
|
|||
|
|||
defineOptions({ name: 'TeamForm' }) |
|||
|
|||
const { t } = useI18n() // 国际化 |
|||
const message = useMessage() // 消息弹窗 |
|||
|
|||
const dialogVisible = ref(false) // 弹窗的是否展示 |
|||
const dialogTitle = ref('') // 弹窗的标题 |
|||
const formLoading = ref(false) // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用 |
|||
const formType = ref('') // 表单的类型:create - 新增;update - 修改 |
|||
const tags=ref([]) |
|||
|
|||
const inputValue = ref('') |
|||
const inputVisible = ref(false) |
|||
const isDisabled = ref(false) |
|||
const InputRef = ref<InstanceType<typeof ElInput>>() |
|||
//巡检项相关参数 |
|||
const inspectionItemData = ref([]) |
|||
|
|||
const itemData = ref({ |
|||
id: '', |
|||
content: '', |
|||
selectId:'' |
|||
}) |
|||
|
|||
const formData = ref({ |
|||
code: '', |
|||
name: '', |
|||
describing: '', |
|||
isUpdated: '', |
|||
remark: '', |
|||
available: '', |
|||
selectId: '', |
|||
optionItem:[] |
|||
}) |
|||
const formRules = reactive({ |
|||
code: [ |
|||
{ required: true, message: '方案编号不能为空', trigger: 'blur' }, |
|||
{ max: 50, message: '不得超过50个字符', trigger: 'blur' } |
|||
], |
|||
name: [ |
|||
{ required: true, message: '方案名称不能为空', trigger: 'blur' }, |
|||
{ max: 50, message: '不得超过50个字符', trigger: 'blur' } |
|||
], |
|||
isUpdated: [ |
|||
{ required: true, message: '不能为空', trigger: 'blur' }, |
|||
], |
|||
available: [ |
|||
{ required: true, message: '不能为空', trigger: 'blur' }, |
|||
], |
|||
remark: [ |
|||
{ max: 50, message: '不得超过50个字符', trigger: 'blur' } |
|||
], |
|||
}) |
|||
const basicFormRef = ref() // 表单 Ref |
|||
|
|||
/** 删除巡检项 */ |
|||
const handleClose = (id: string) => { |
|||
const index = tags.value.findIndex(tag => tag.selectId === id); |
|||
if (index !== -1) { |
|||
tags.value.splice(index, 1); |
|||
} |
|||
} |
|||
|
|||
/** 弹窗相关参数 */ |
|||
const searchTableRef = ref(); |
|||
const _searchTableTitle = ref(); |
|||
const _searchTableAllSchemas = ref(); |
|||
const _searchTablePage = ref(); |
|||
const _formField = ref(); |
|||
const _searchField = ref(); |
|||
const _multiple = ref(); |
|||
const _type = ref(); |
|||
const _row = ref(); |
|||
const _searchCondition = ref({}) |
|||
|
|||
|
|||
const addItem = () =>{ |
|||
addItemCommon(true,'xunJianItem') |
|||
} |
|||
|
|||
/** 选择巡检项弹窗 */ |
|||
const addItemCommon = (multiple,field) => { |
|||
_searchCondition.value = {} |
|||
const filters: any[] = [] |
|||
filters.push({ |
|||
action: "==", |
|||
column: 'available', |
|||
value: 'TRUE' |
|||
}) |
|||
// 参数整理 |
|||
_searchCondition.value.isSearch = true |
|||
_searchCondition.value.filters = filters |
|||
_searchTableTitle.value = '选择巡检项' |
|||
//_multiple.value = multiple |
|||
_formField.value = field |
|||
_searchField.value = field |
|||
_searchTablePage.value = inspectionItemItemSelectSetApi.getInspectionItemSelectSetPage |
|||
_searchTableAllSchemas.value = InspectionItemSelectSet.allSchemas |
|||
openCommon() |
|||
} |
|||
|
|||
/** 弹窗选择之后 回调函数 添加选择集 */ |
|||
const searchTableSuccess = (formField, searchField, val, formRef, type, row ) => { |
|||
nextTick?.(async () => { |
|||
if (formField === 'xunJianItem') { |
|||
let itemsId = ''; |
|||
//选择集ID赋值 |
|||
val.forEach(item => { |
|||
const isExist = tags.value.some(tag => tag.id === item.id); |
|||
if (!isExist) { |
|||
const newItem = {}; |
|||
newItem['itemCode'] = item.itemCode; |
|||
newItem['selectId'] = item.id; |
|||
tags.value = []; |
|||
tags.value.push(newItem); |
|||
} |
|||
itemsId = item.itemCode; |
|||
}); |
|||
//巡检项赋值 |
|||
try { |
|||
formLoading.value = true; |
|||
inspectionItemData.value = []; |
|||
for (const item of itemsId.split(",")) { |
|||
let res = await request.get({url: `/eam/basic/inspection-item/get?id=` + item}) |
|||
console.log(res) |
|||
const newItem = {}; |
|||
newItem['itemCode'] = res.id; |
|||
newItem['itemName'] = res.name; |
|||
newItem['equipmentParts'] = res.equipmentParts; |
|||
newItem['isSelectd'] = true; |
|||
inspectionItemData.value.push(newItem); |
|||
} |
|||
} finally { |
|||
formLoading.value = false; |
|||
} |
|||
} |
|||
}) |
|||
} |
|||
/*打开弹窗*/ |
|||
const openCommon = () => { |
|||
searchTableRef.value.open( |
|||
_searchTableTitle.value, |
|||
_searchTableAllSchemas.value, |
|||
_searchTablePage.value, |
|||
_formField.value, |
|||
_searchField.value, |
|||
_multiple.value, |
|||
_type.value, |
|||
_row.value, |
|||
_searchCondition.value |
|||
) |
|||
} |
|||
/** 初始化弹窗 */ |
|||
const open = async (type: string, row?: object) => { |
|||
dialogVisible.value = true |
|||
dialogTitle.value = t('action.' + type) |
|||
formType.value = type |
|||
// 修改时,设置数据 |
|||
if (row) { |
|||
isDisabled.value = true; |
|||
formLoading.value = true |
|||
formData.value = row; |
|||
//添加巡检选择集 |
|||
let item = (row.id.toString()).split(",") |
|||
try { |
|||
tags.value=[]; |
|||
for (var i = 0; i < item.length; i++) { |
|||
itemData.value = await request.get({ url: `/eam/basic-inspection-option/get?id=` + item[i] }); |
|||
tags.value.push(itemData.value); |
|||
} |
|||
} finally { |
|||
formLoading.value = false |
|||
} |
|||
//添加巡检项 |
|||
let res = await request.get({url: `/eam/relation-inspection-option-item/getList?optionCode=` + row.code}) |
|||
try { |
|||
inspectionItemData.value = []; |
|||
formLoading.value = true; |
|||
for (const item of res) { |
|||
const newItem = {}; |
|||
newItem['id'] = item.id; |
|||
newItem['itemCode'] = item.itemCode; |
|||
newItem['itemName'] = item.itemName; |
|||
newItem['isSelectd'] = item.isSelectd; |
|||
inspectionItemData.value.push(newItem); |
|||
} |
|||
} finally { |
|||
formLoading.value = false; |
|||
} |
|||
} |
|||
// 新增时 |
|||
else { |
|||
resetForm() |
|||
isDisabled.value = false; |
|||
} |
|||
} |
|||
defineExpose({ open }) // 提供 open 方法,用于打开弹窗 |
|||
|
|||
/** 提交表单 */ |
|||
const emit = defineEmits(['success']) // 定义 success 事件,用于操作成功后的回调 |
|||
const submitForm = async () => { |
|||
// 校验表单 |
|||
if (!basicFormRef) return |
|||
const valid = await basicFormRef.value.validate() |
|||
if (!valid) return |
|||
if (inspectionItemData.value.length > 10 ){ |
|||
message.warning('巡检项最多10个'); |
|||
return |
|||
} |
|||
|
|||
//赋值 巡检选择集ID |
|||
formData.value.selectId = tags.value[0].selectId |
|||
// 提交请求 |
|||
formLoading.value = true |
|||
try { |
|||
if (formType.value === 'create') { |
|||
for (var i = 0; i < inspectionItemData.value.length; i++) { |
|||
inspectionItemData.value[i].optionCode = formData.value.code |
|||
} |
|||
formData.value.optionItem = inspectionItemData.value |
|||
//新增巡检方案 及 方案与项关系 |
|||
await BasicInspectionOptionApi.createBasicInspectionOption(formData.value) |
|||
message.success(t('common.createSuccess')) |
|||
} else { |
|||
for (var i = 0; i < inspectionItemData.value.length; i++) { |
|||
inspectionItemData.value[i].optionCode = formData.value.code |
|||
} |
|||
formData.value.optionItem = inspectionItemData.value |
|||
await BasicInspectionOptionApi.updateBasicInspectionOption(formData.value) |
|||
message.success(t('common.updateSuccess')) |
|||
} |
|||
dialogVisible.value = false |
|||
// 发送操作成功的事件 |
|||
emit('success') |
|||
} finally { |
|||
formLoading.value = false |
|||
} |
|||
} |
|||
|
|||
/** 重置表单 */ |
|||
const resetForm = () => { |
|||
formData.value = { |
|||
code: '', |
|||
name: '', |
|||
describing: '', |
|||
isUpdated: '', |
|||
remark: '', |
|||
available: '', |
|||
selectId: '' |
|||
} |
|||
tags.value=[]; |
|||
inspectionItemData.value = []; |
|||
basicFormRef.value?.resetFields() |
|||
} |
|||
|
|||
</script> |
|||
|
|||
<style scoped> |
|||
.tag-container { |
|||
margin-top: 10px; /* 可根据需要调整标签容器与表单项之间的间距 */ |
|||
border: 1px solid #ccc; /* 添加边框样式 */ |
|||
padding: 10px; /* 可根据需要调整容器内边距 */ |
|||
width: 950px; /* 设置固定宽度为 950px */ |
|||
overflow-y: auto; /* 当内容溢出容器高度时显示滚动条 */ |
|||
word-wrap: break-word; /* 使用 word-wrap 属性实现超出范围换行 */ |
|||
overflow-wrap: break-word; /* 兼容性更好的写法 */ |
|||
flex-wrap: wrap; |
|||
} |
|||
.input-with-button { |
|||
display: flex; |
|||
align-items: center; |
|||
width: 100%; |
|||
} |
|||
|
|||
.input-with-button > .el-input { |
|||
flex: 1; |
|||
/*margin-right: 10px;*/ |
|||
} |
|||
|
|||
</style> |
@ -0,0 +1,200 @@ |
|||
import type { CrudSchema } from '@/hooks/web/useCrudSchemas' |
|||
import { dateFormatter } from '@/utils/formatTime' |
|||
import * as ItemApi from "@/api/eam/spotCheckSelectSet"; |
|||
import {BasicSpotCheckSelectSet} from "@/views/eam/spotCheckSelectSet/spotCheckSelectSet.data"; |
|||
|
|||
// 表单校验
|
|||
export const BasicSpotCheckOptionRules = reactive({ |
|||
code: [required], |
|||
selectId: [required], |
|||
}) |
|||
|
|||
export const BasicSpotCheckOption = useCrudSchemas(reactive<CrudSchema[]>([ |
|||
{ |
|||
label: 'id', |
|||
field: 'id', |
|||
sort: 'custom', |
|||
isSearch: false, |
|||
isTable: false, |
|||
isForm: false, |
|||
isDetail:false, |
|||
}, |
|||
{ |
|||
label: '编号', |
|||
field: 'code', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
}, |
|||
{ |
|||
label: '方案名称', |
|||
field: 'name', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
}, |
|||
{ |
|||
label: '选择集ID', |
|||
field: 'selectId', |
|||
sort: 'custom', |
|||
isDetail: true, |
|||
form: { |
|||
componentProps: { |
|||
isSearchList: true, // 开启查询弹窗
|
|||
searchTitle: '点检选择集信息', // 查询弹窗标题
|
|||
searchAllSchemas: BasicSpotCheckSelectSet.allSchemas, // 查询弹窗所需类
|
|||
searchField: 'id', // 查询弹窗赋值字段
|
|||
searchPage: ItemApi.getBasicSpotCheckSelectSetPage, // 查询弹窗所需分页方法
|
|||
multiple:true, |
|||
searchCondition: [{ |
|||
key: 'available', |
|||
value: 'TRUE', |
|||
action: '==', |
|||
isSearch: true, |
|||
isMainValue: false |
|||
}] |
|||
} |
|||
} |
|||
}, |
|||
{ |
|||
label: '描述', |
|||
field: 'describing', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
}, |
|||
{ |
|||
label: '项是否可修改', |
|||
field: 'isUpdated', |
|||
sort: 'custom', |
|||
dictType: DICT_TYPE.IS_UPDATED, |
|||
dictClass: 'string', // 默认都是字符串类型其他暂不考虑
|
|||
isTable: true, |
|||
isDetail: false, |
|||
isSearch: true, |
|||
isTableForm: false, |
|||
isForm: true, |
|||
form: { |
|||
component: 'Switch', |
|||
value: 'TRUE', |
|||
componentProps: { |
|||
inactiveValue: 'FALSE', |
|||
activeValue: 'TRUE' |
|||
} |
|||
}, |
|||
}, |
|||
// {
|
|||
// label: '保养项',
|
|||
// field: 'type',
|
|||
// sort: 'custom',
|
|||
// isSearch: true,
|
|||
// },
|
|||
{ |
|||
label: '创建时间', |
|||
field: 'createTime', |
|||
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')] |
|||
} |
|||
}, |
|||
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: false, |
|||
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,300 @@ |
|||
<template> |
|||
<ContentWrap> |
|||
<!-- 搜索工作栏 --> |
|||
<Search :schema="BasicSpotCheckOption.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" /> |
|||
</ContentWrap> |
|||
|
|||
<!-- 列表头部 --> |
|||
<TableHead |
|||
:HeadButttondata="HeadButttondata" |
|||
@button-base-click="buttonBaseClick" |
|||
:routeName="routeName" |
|||
@updataTableColumns="updataTableColumns" |
|||
@searchFormClick="searchFormClick" |
|||
:allSchemas="BasicSpotCheckOption.allSchemas" |
|||
/> |
|||
|
|||
<!-- 列表 --> |
|||
<ContentWrap> |
|||
<Table |
|||
:columns="tableColumns" |
|||
:data="tableObject.tableList" |
|||
:loading="tableObject.loading" |
|||
:pagination="{ |
|||
total: tableObject.total |
|||
}" |
|||
v-model:pageSize="tableObject.pageSize" |
|||
v-model:currentPage="tableObject.currentPage" |
|||
v-model:sort="tableObject.sort" |
|||
> |
|||
<template #code="{row}"> |
|||
<el-button type="primary" link @click="openDetail(row, '代码', row.code)"> |
|||
<span>{{ row.code }}</span> |
|||
</el-button> |
|||
</template> |
|||
<template #action="{ row }"> |
|||
<ButtonBase :Butttondata="butttondata(row)" @button-base-click="buttonTableClick($event,row)" /> |
|||
</template> |
|||
</Table> |
|||
</ContentWrap> |
|||
|
|||
<!-- 表单弹窗:添加/修改 --> |
|||
<!-- <BasicForm--> |
|||
<!-- ref="basicFormRef"--> |
|||
<!-- @success="formsSuccess"--> |
|||
<!-- :rules="BasicSpotCheckOptionRules"--> |
|||
<!-- :formAllSchemas="BasicSpotCheckOption.allSchemas"--> |
|||
<!-- :apiUpdate="BasicSpotCheckOptionApi.updateBasicSpotCheckOption"--> |
|||
<!-- :apiCreate="BasicSpotCheckOptionApi.createBasicSpotCheckOption"--> |
|||
<!-- @searchTableSuccess="searchTableSuccess"--> |
|||
<!-- :isBusiness="false"--> |
|||
<!-- />--> |
|||
<ItemForm ref="basicFormRef" @success="getData"/> |
|||
|
|||
<!-- 详情 --> |
|||
<Detail ref="detailRef" :isBasic="true" :allSchemas="BasicSpotCheckOption.allSchemas" /> |
|||
|
|||
<!-- 导入 --> |
|||
<ImportForm ref="importFormRef" url="/eam/basic-spot-check-option/import" :importTemplateData="importTemplateData" @success="importSuccess" /> |
|||
</template> |
|||
|
|||
<script setup lang="ts"> |
|||
import download from '@/utils/download' |
|||
import { BasicSpotCheckOption,BasicSpotCheckOptionRules } from './basicSpotCheckOption.data' |
|||
import * as BasicSpotCheckOptionApi from '@/api/eam/basicSpotCheckOption' |
|||
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 ItemForm from "@/views/eam/basicSpotCheckOption/itemSelectSetForm.vue"; |
|||
|
|||
defineOptions({ name: 'BasicSpotCheckOption' }) |
|||
|
|||
const message = useMessage() // 消息弹窗 |
|||
const { t } = useI18n() // 国际化 |
|||
|
|||
const route = useRoute() // 路由信息 |
|||
const routeName = ref() |
|||
routeName.value = route.name |
|||
const tableColumns = ref(BasicSpotCheckOption.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: BasicSpotCheckOptionApi.getBasicSpotCheckOptionPage // 分页接口 |
|||
}) |
|||
|
|||
// 获得表格的各种操作 |
|||
const { getList, setSearchParams } = tableMethods |
|||
|
|||
// 列表头部按钮 |
|||
const HeadButttondata = [ |
|||
defaultButtons.defaultAddBtn({hasPermi:'eam:basicSpotCheckOption:create'}), // 新增 |
|||
defaultButtons.defaultImportBtn({hasPermi:'eam:basicSpotCheckOption:import'}), // 导入 |
|||
defaultButtons.defaultExportBtn({hasPermi:'eam:basicSpotCheckOption: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:basicSpotCheckOption:update'}), // 编辑 |
|||
//defaultButtons.mainListDeleteBtn({hasPermi:'eam:basicSpotCheckOption:delete'}), // 删除 |
|||
defaultButtons.mainListEnableBtn({hide:isShowMainButton(row,['FALSE']),hasPermi:'eam:basicSpotCheckOption:update'}), |
|||
defaultButtons.mainListDisableBtn({hide:isShowMainButton(row,['TRUE']),hasPermi:'eam:basicSpotCheckOption: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 =BasicSpotCheckOption.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 BasicSpotCheckOptionApi.createBasicSpotCheckOption(data) |
|||
message.success(t('common.createSuccess')) |
|||
} else { |
|||
await BasicSpotCheckOptionApi.updateBasicSpotCheckOption(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, 'basicBasicSpotCheckOption') |
|||
} |
|||
|
|||
/** 删除按钮操作 */ |
|||
const handleDelete = async (id: number) => { |
|||
try { |
|||
// 删除的二次确认 |
|||
await message.delConfirm() |
|||
// 发起删除 |
|||
await BasicSpotCheckOptionApi.deleteBasicSpotCheckOption(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 BasicSpotCheckOptionApi.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 BasicSpotCheckOptionApi.updateEnableCode(params.value) |
|||
message.success(t('common.updateSuccess')) |
|||
// 刷新列表 |
|||
await getList() |
|||
} catch {} |
|||
} |
|||
|
|||
//刷新页面 |
|||
const getData = async() => { |
|||
getList(); |
|||
} |
|||
|
|||
/** 导出按钮操作 */ |
|||
const exportLoading = ref(false) // 导出的加载中 |
|||
const handleExport = async () => { |
|||
try { |
|||
// 导出的二次确认 |
|||
await message.exportConfirm() |
|||
// 发起导出 |
|||
exportLoading.value = true |
|||
const data = await BasicSpotCheckOptionApi.exportBasicSpotCheckOption(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,387 @@ |
|||
<template> |
|||
<Dialog v-model="dialogVisible" :title="dialogTitle"> |
|||
<el-form |
|||
ref="basicFormRef" |
|||
v-loading="formLoading" |
|||
:model="formData" |
|||
:rules="formRules" |
|||
label-width="100px" |
|||
> |
|||
<el-row> |
|||
<el-col :span="12"> |
|||
<el-form-item label="方案编号" prop="code"> |
|||
<el-input v-model="formData.code" placeholder="方案编号" :disabled="isDisabled"/> |
|||
</el-form-item> |
|||
</el-col> |
|||
<el-col :span="12"> |
|||
<el-form-item label="方案名称" prop="name"> |
|||
<el-input v-model="formData.name" placeholder="请输入方案名称" /> |
|||
</el-form-item> |
|||
</el-col> |
|||
</el-row> |
|||
<el-row> |
|||
<el-col :span="12"> |
|||
<el-form-item label="是否可修改" prop="isUpdated"> |
|||
<el-select v-model="formData.isUpdated" style="width: 200px"> |
|||
<el-option label="是" value="TRUE"></el-option> |
|||
<el-option label="否" value="FALSE"></el-option> |
|||
</el-select> |
|||
</el-form-item> |
|||
</el-col> |
|||
<el-col :span="12"> |
|||
<el-form-item label="描述" prop="describing"> |
|||
<el-input v-model="formData.describing" placeholder="请输入描述" /> |
|||
</el-form-item> |
|||
</el-col> |
|||
</el-row> |
|||
<el-row> |
|||
<el-col :span="12"> |
|||
<el-form-item label="是否可用" prop="available"> |
|||
<el-select v-model="formData.available" style="width: 200px"> |
|||
<el-option label="是" value="TRUE"></el-option> |
|||
<el-option label="否" value="FALSE"></el-option> |
|||
</el-select> |
|||
</el-form-item> |
|||
</el-col> |
|||
<el-col :span="12"> |
|||
<el-form-item label="备注" prop="remark"> |
|||
<el-input v-model="formData.remark" placeholder="请输入备注" /> |
|||
</el-form-item> |
|||
</el-col> |
|||
</el-row> |
|||
<el-row> |
|||
<el-col :span="11"> |
|||
<el-form-item label="选择集ID" prop="selectId"> |
|||
<div class="tag-container flex gap-2"> |
|||
<el-tag v-for="ent in tags" :key="ent.selectId" closable :disable-transitions="false" @close="handleClose(ent.selectId)"> |
|||
{{ ent.selectId}} |
|||
</el-tag> |
|||
<el-input v-if="inputVisible" ref="InputRef" v-model="inputValue" class="w-20" size="small"/> |
|||
<el-button v-else class="button-new-tag" size="small" @click="addItem"> |
|||
添加点检选择集 |
|||
</el-button> |
|||
</div> |
|||
</el-form-item> |
|||
</el-col> |
|||
</el-row> |
|||
</el-form> |
|||
<el-table :data="spotCheckItemData" style="width: 100%; height: 80%"> |
|||
<el-table-column prop="itemCode" label="点检项ID" /> |
|||
<el-table-column prop="itemName" label="点检名称" /> |
|||
<el-table-column prop="isSelectd" label="" width="150" > |
|||
<template #header> |
|||
<span>是否必选(默认是)</span> |
|||
</template> |
|||
<template #default="scope"> |
|||
<el-switch |
|||
v-model="scope.row.isSelectd" |
|||
active-color="#13ce66" |
|||
inactive-color="#ff4949" |
|||
active-text="是" |
|||
inactive-text="否" |
|||
/> |
|||
</template> |
|||
</el-table-column> |
|||
</el-table> |
|||
<template #footer> |
|||
<el-button :disabled="formLoading" type="primary" @click="submitForm">确 定</el-button> |
|||
<el-button @click="dialogVisible = false">取 消</el-button> |
|||
</template> |
|||
</Dialog> |
|||
|
|||
<!--添加巡检项弹窗--> |
|||
<SearchTable ref="searchTableRef" @searchTableSuccess="searchTableSuccess" /> |
|||
|
|||
</template> |
|||
<script lang="ts" setup> |
|||
import request from "@/config/axios"; |
|||
import { SearchTable } from '@/components/SearchTable' |
|||
import { BasicSpotCheckSelectSet} from "@/views/eam/spotCheckSelectSet/spotCheckSelectSet.data"; |
|||
import * as SpotCheckSelectSetApi from "@/api/eam/spotCheckSelectSet"; |
|||
import * as BasicSpotCheckOptionApi from "@/api/eam/basicSpotCheckOption"; |
|||
import {ElInput} from "element-plus"; |
|||
|
|||
|
|||
defineOptions({ name: 'TeamForm' }) |
|||
|
|||
const { t } = useI18n() // 国际化 |
|||
const message = useMessage() // 消息弹窗 |
|||
|
|||
const dialogVisible = ref(false) // 弹窗的是否展示 |
|||
const dialogTitle = ref('') // 弹窗的标题 |
|||
const formLoading = ref(false) // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用 |
|||
const formType = ref('') // 表单的类型:create - 新增;update - 修改 |
|||
const tags=ref([]) |
|||
|
|||
const inputValue = ref('') |
|||
const inputVisible = ref(false) |
|||
const isDisabled = ref(false) |
|||
const InputRef = ref<InstanceType<typeof ElInput>>() |
|||
//点检项相关参数 |
|||
const spotCheckItemData = ref([]) |
|||
|
|||
const itemData = ref({ |
|||
id: '', |
|||
content: '', |
|||
selectId:'' |
|||
}) |
|||
|
|||
const formData = ref({ |
|||
code: '', |
|||
name: '', |
|||
describing: '', |
|||
isUpdated: '', |
|||
remark: '', |
|||
available: '', |
|||
selectId: '', |
|||
optionItem:[] |
|||
}) |
|||
const formRules = reactive({ |
|||
code: [ |
|||
{ required: true, message: '方案编号不能为空', trigger: 'blur' }, |
|||
{ max: 50, message: '不得超过50个字符', trigger: 'blur' } |
|||
], |
|||
name: [ |
|||
{ required: true, message: '方案名称不能为空', trigger: 'blur' }, |
|||
{ max: 50, message: '不得超过50个字符', trigger: 'blur' } |
|||
], |
|||
isUpdated: [ |
|||
{ required: true, message: '不能为空', trigger: 'blur' }, |
|||
], |
|||
available: [ |
|||
{ required: true, message: '不能为空', trigger: 'blur' }, |
|||
], |
|||
remark: [ |
|||
{ max: 50, message: '不得超过50个字符', trigger: 'blur' } |
|||
], |
|||
}) |
|||
const basicFormRef = ref() // 表单 Ref |
|||
|
|||
/** 删除巡检项 */ |
|||
const handleClose = (id: string) => { |
|||
console.log(id) |
|||
console.log(tags) |
|||
const index = tags.value.findIndex(tag => tag.selectId === id); |
|||
if (index !== -1) { |
|||
tags.value.splice(index, 1); |
|||
} |
|||
} |
|||
|
|||
/** 弹窗相关参数 */ |
|||
const searchTableRef = ref(); |
|||
const _searchTableTitle = ref(); |
|||
const _searchTableAllSchemas = ref(); |
|||
const _searchTablePage = ref(); |
|||
const _formField = ref(); |
|||
const _searchField = ref(); |
|||
const _multiple = ref(); |
|||
const _type = ref(); |
|||
const _row = ref(); |
|||
const _searchCondition = ref({}) |
|||
|
|||
|
|||
const addItem = () =>{ |
|||
addItemCommon(true,'dianJianItem') |
|||
} |
|||
|
|||
/** 选择巡检项弹窗 */ |
|||
const addItemCommon = (multiple,field) => { |
|||
_searchCondition.value = {} |
|||
const filters: any[] = [] |
|||
filters.push({ |
|||
action: "==", |
|||
column: 'available', |
|||
value: 'TRUE' |
|||
}) |
|||
// 参数整理 |
|||
_searchCondition.value.isSearch = true |
|||
_searchCondition.value.filters = filters |
|||
_searchTableTitle.value = '选择点检项' |
|||
//_multiple.value = multiple |
|||
_formField.value = field |
|||
_searchField.value = field |
|||
_searchTablePage.value = SpotCheckSelectSetApi.getBasicSpotCheckSelectSetPage |
|||
_searchTableAllSchemas.value = BasicSpotCheckSelectSet.allSchemas |
|||
openCommon() |
|||
} |
|||
|
|||
/** 弹窗选择之后 回调函数 添加选择集 */ |
|||
const searchTableSuccess = (formField, searchField, val, formRef, type, row ) => { |
|||
nextTick?.(async () => { |
|||
if (formField === 'dianJianItem') { |
|||
let itemsId = ''; |
|||
//选择集ID赋值 |
|||
val.forEach(item => { |
|||
const isExist = tags.value.some(tag => tag.id === item.id); |
|||
if (!isExist) { |
|||
const newItem = {}; |
|||
newItem['itemCode'] = item.itemCode; |
|||
newItem['selectId'] = item.id; |
|||
tags.value = []; |
|||
tags.value.push(newItem); |
|||
} |
|||
itemsId = item.itemCode; |
|||
}); |
|||
//点检项赋值 |
|||
try { |
|||
formLoading.value = true; |
|||
spotCheckItemData.value = []; |
|||
for (const item of itemsId.split(",")) { |
|||
let res = await request.get({url: `/eam/basic/spot-check-item/get?id=` + item}) |
|||
const newItem = {}; |
|||
newItem['itemCode'] = res.id; |
|||
newItem['itemName'] = res.name; |
|||
newItem['equipmentParts'] = res.equipmentParts; |
|||
newItem['isSelectd'] = true; |
|||
spotCheckItemData.value.push(newItem); |
|||
} |
|||
} finally { |
|||
formLoading.value = false; |
|||
} |
|||
} |
|||
}) |
|||
} |
|||
/*打开弹窗*/ |
|||
const openCommon = () => { |
|||
searchTableRef.value.open( |
|||
_searchTableTitle.value, |
|||
_searchTableAllSchemas.value, |
|||
_searchTablePage.value, |
|||
_formField.value, |
|||
_searchField.value, |
|||
_multiple.value, |
|||
_type.value, |
|||
_row.value, |
|||
_searchCondition.value |
|||
) |
|||
} |
|||
/** 初始化弹窗 */ |
|||
const open = async (type: string, row?: object) => { |
|||
dialogVisible.value = true |
|||
dialogTitle.value = t('action.' + type) |
|||
formType.value = type |
|||
// 修改时,设置数据 |
|||
if (row) { |
|||
isDisabled.value = true; |
|||
formLoading.value = true |
|||
formData.value = row; |
|||
//添加点检选择集 |
|||
let item = (row.id.toString()).split(",") |
|||
try { |
|||
tags.value=[]; |
|||
for (var i = 0; i < item.length; i++) { |
|||
itemData.value = await request.get({ url: `/eam/basic-spotCheck-option/get?id=` + item[i] }); |
|||
tags.value.push(itemData.value); |
|||
} |
|||
} finally { |
|||
formLoading.value = false |
|||
} |
|||
//添加点检项 |
|||
let res = await request.get({url: `/eam/relation-spotCheck-option-item/getList?optionCode=` + row.code}) |
|||
try { |
|||
spotCheckItemData.value = []; |
|||
formLoading.value = true; |
|||
for (const item of res) { |
|||
const newItem = {}; |
|||
newItem['id'] = item.id; |
|||
newItem['itemCode'] = item.itemCode; |
|||
newItem['itemName'] = item.itemName; |
|||
newItem['isSelectd'] = item.isSelectd; |
|||
spotCheckItemData.value.push(newItem); |
|||
} |
|||
} finally { |
|||
formLoading.value = false; |
|||
} |
|||
} |
|||
// 新增时 |
|||
else { |
|||
resetForm() |
|||
isDisabled.value = false; |
|||
} |
|||
} |
|||
defineExpose({ open }) // 提供 open 方法,用于打开弹窗 |
|||
|
|||
/** 提交表单 */ |
|||
const emit = defineEmits(['success']) // 定义 success 事件,用于操作成功后的回调 |
|||
const submitForm = async () => { |
|||
// 校验表单 |
|||
if (!basicFormRef) return |
|||
const valid = await basicFormRef.value.validate() |
|||
if (!valid) return |
|||
if (spotCheckItemData.value.length > 10 ){ |
|||
message.warning('点检项最多10个'); |
|||
return |
|||
} |
|||
|
|||
//赋值 点检选择集ID |
|||
formData.value.selectId = tags.value[0].selectId |
|||
// 提交请求 |
|||
formLoading.value = true |
|||
//formData.value.members = JSON.stringify(tags.value) |
|||
try { |
|||
if (formType.value === 'create') { |
|||
for (var i = 0; i < spotCheckItemData.value.length; i++) { |
|||
spotCheckItemData.value[i].optionCode = formData.value.code |
|||
} |
|||
formData.value.optionItem = spotCheckItemData.value |
|||
//新增点检方案 及 方案与项关系 |
|||
await BasicSpotCheckOptionApi.createBasicSpotCheckOption(formData.value) |
|||
message.success(t('common.createSuccess')) |
|||
} else { |
|||
for (var i = 0; i < spotCheckItemData.value.length; i++) { |
|||
spotCheckItemData.value[i].optionCode = formData.value.code |
|||
} |
|||
formData.value.optionItem = spotCheckItemData.value |
|||
console.log(formData.value) |
|||
await BasicSpotCheckOptionApi.updateBasicSpotCheckOption(formData.value) |
|||
message.success(t('common.updateSuccess')) |
|||
} |
|||
dialogVisible.value = false |
|||
// 发送操作成功的事件 |
|||
emit('success') |
|||
} finally { |
|||
formLoading.value = false |
|||
} |
|||
} |
|||
|
|||
/** 重置表单 */ |
|||
const resetForm = () => { |
|||
formData.value = { |
|||
code: '', |
|||
name: '', |
|||
describing: '', |
|||
isUpdated: '', |
|||
remark: '', |
|||
available: '', |
|||
selectId: '' |
|||
} |
|||
tags.value=[]; |
|||
spotCheckItemData.value = []; |
|||
basicFormRef.value?.resetFields() |
|||
} |
|||
|
|||
</script> |
|||
|
|||
<style scoped> |
|||
.tag-container { |
|||
margin-top: 10px; /* 可根据需要调整标签容器与表单项之间的间距 */ |
|||
border: 1px solid #ccc; /* 添加边框样式 */ |
|||
padding: 10px; /* 可根据需要调整容器内边距 */ |
|||
width: 950px; /* 设置固定宽度为 950px */ |
|||
overflow-y: auto; /* 当内容溢出容器高度时显示滚动条 */ |
|||
word-wrap: break-word; /* 使用 word-wrap 属性实现超出范围换行 */ |
|||
overflow-wrap: break-word; /* 兼容性更好的写法 */ |
|||
flex-wrap: wrap; |
|||
} |
|||
.input-with-button { |
|||
display: flex; |
|||
align-items: center; |
|||
width: 100%; |
|||
} |
|||
|
|||
.input-with-button > .el-input { |
|||
flex: 1; |
|||
/*margin-right: 10px;*/ |
|||
} |
|||
|
|||
</style> |
@ -0,0 +1,344 @@ |
|||
<template> |
|||
<Dialog v-model="dialogVisible" :title="dialogTitle" :close-on-click-modal="false"> |
|||
<el-form ref="basicFormRef" v-loading="formLoading" :model="formData" :rules="formRules" label-width="100px"> |
|||
<el-row> |
|||
<el-col :span="12"> |
|||
<el-form-item label="转办类型" prop="transferType"> |
|||
<el-select v-model="formData.transferType" placeholder="请选择转办类型" style="width: 150px" @change="onChangeSec"> |
|||
<el-option label="人员转办" value="0"></el-option> |
|||
<el-option label="类型转办" value="1"></el-option> |
|||
</el-select> |
|||
</el-form-item> |
|||
</el-col> |
|||
<el-col :span="12"> |
|||
<el-form-item label="故障类型" prop="faultType"> |
|||
<el-input v-model="formData.faultType" style="width: 150px" disabled></el-input> |
|||
<el-button :icon="Search" @click="chooseFaultType" /> |
|||
</el-form-item> |
|||
</el-col> |
|||
</el-row> |
|||
<el-row> |
|||
<el-col :span="12"> |
|||
<el-form-item label="设备类别" prop="type" > |
|||
<el-select v-model="formData.type" placeholder="请选择设备类别" style="width: 150px" :disabled = "isDisabled1" @change="onChangeType"> |
|||
<el-option label="设备" value="DEVICE"></el-option> |
|||
<el-option label="工装" value="EQUIPMENT"></el-option> |
|||
</el-select> |
|||
</el-form-item> |
|||
</el-col> |
|||
<el-col :span="12"> |
|||
<el-form-item label="设备编号" prop="equipmentCode" > |
|||
<el-input v-model="formData.equipmentCode" style="width: 150px" disabled></el-input> |
|||
<el-button :icon="Search" @click="chooseEquipmentCode" :disabled = "isDisabled1"/> |
|||
</el-form-item> |
|||
</el-col> |
|||
</el-row> |
|||
<el-row> |
|||
<el-col :span="12"> |
|||
<el-form-item label="车间" prop="workshopCode"> |
|||
<el-input v-model="formData.workshopCode" style="width: 150px" disabled></el-input> |
|||
<el-button :icon="Search" @click="chooseWorkshopCode" :disabled = "isDisabled2"/> |
|||
</el-form-item> |
|||
</el-col> |
|||
<el-col :span="12"> |
|||
<el-form-item label="维修人" prop="maintenancer"> |
|||
<el-input v-model="formData.maintenancer" style="width: 150px" :disabled = "isDisabled2"></el-input> |
|||
<!-- <el-button :icon="Search" @click="chooseWorkshopCode" />--> |
|||
</el-form-item> |
|||
</el-col> |
|||
</el-row> |
|||
<el-row> |
|||
<el-col :span="12"> |
|||
<el-form-item label="班组" prop="classType"> |
|||
<el-select v-model="formData.classType" placeholder="请选择班组类别" style="width: 150px"> |
|||
<el-option label="白班" value="0"></el-option> |
|||
<el-option label="夜班" value="1"></el-option> |
|||
</el-select> |
|||
</el-form-item> |
|||
</el-col> |
|||
</el-row> |
|||
</el-form> |
|||
<template #footer> |
|||
<el-button :disabled="formLoading" type="primary" @click="submitForm('success')">确 定</el-button> |
|||
<el-button @click="handleClose('close')">取 消</el-button> |
|||
</template> |
|||
</Dialog> |
|||
|
|||
<!--添加巡检项弹窗--> |
|||
<SearchTable ref="searchTableRef" @searchTableSuccess="searchTableSuccess" /> |
|||
|
|||
</template> |
|||
<script lang="ts" setup> |
|||
import { SearchTable } from '@/components/SearchTable' |
|||
import {ElInput} from "element-plus"; |
|||
import { Search } from '@element-plus/icons-vue' |
|||
import * as EquipmentRepairJobMainApi from "@/api/eam/equipmentRepairJobMain"; |
|||
import * as WorkshopApi from "@/api/wms/workshop"; |
|||
import {Workshop} from "@/views/wms/basicDataManage/factoryModeling/workshop/workshop.data"; |
|||
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"; |
|||
import {BasicFaultType} from "@/views/eam/basicFaultType/basicFaultType.data"; |
|||
import * as BasicFaultTypeApi from "@/api/eam/basicFaultType"; |
|||
|
|||
defineOptions({ name: 'TeamForm' }) |
|||
|
|||
const { t } = useI18n() // 国际化 |
|||
const message = useMessage() // 消息弹窗 |
|||
|
|||
const dialogVisible = ref(false) // 弹窗的是否展示 |
|||
const dialogTitle = ref('转办') // 弹窗的标题 |
|||
const formLoading = ref(false) // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用 |
|||
const formType = ref('') // 表单的类型:create - 新增;update - 修改 |
|||
const tags=ref([]) |
|||
|
|||
const typeValue = ref('') |
|||
const inputVisible = ref(false) |
|||
const isDisabled1 = ref(false) |
|||
const isDisabled2 = ref(false) |
|||
const InputRef = ref<InstanceType<typeof ElInput>>() |
|||
|
|||
|
|||
const formData = ref({ |
|||
id:'', |
|||
number:'', |
|||
transferType:'', |
|||
faultType:'', |
|||
type:'', |
|||
equipmentCode:'', |
|||
workshopCode:'', |
|||
maintenancer: '', |
|||
classType: '', |
|||
}) |
|||
const formRules = reactive({ |
|||
transferType: [ |
|||
{ required: true, message: '转办类型不能为空', trigger: 'change' }, |
|||
{ max: 50, message: '不得超过50个字符', trigger: 'change' } |
|||
], |
|||
faultType: [ |
|||
{ required: true, message: '故障类型不能为空', trigger: 'change' }, |
|||
], |
|||
classType: [ |
|||
{ required: true, message: '班次不能为空', trigger: 'change' }, |
|||
], |
|||
workshopCode: [ |
|||
{ required: false, message: '车间不能为空', trigger: 'change' }, |
|||
], |
|||
maintenancer: [ |
|||
{ required: false, message: '维修人不能为空', trigger: 'change' }, |
|||
], |
|||
type: [ |
|||
{ required: false, message: '设备类别不能为空', trigger: 'change' }, |
|||
], |
|||
equipmentCode: [ |
|||
{ required: false, message: '设备编号不能为空', trigger: 'change' }, |
|||
], |
|||
}) |
|||
const basicFormRef = ref() // 表单 Ref |
|||
|
|||
// /** 弹窗相关参数 */ |
|||
const searchTableRef = ref(); |
|||
const _searchTableTitle = ref(); |
|||
const _searchTableAllSchemas = ref(); |
|||
const _searchTablePage = ref(); |
|||
const _searchField = ref(); |
|||
const _formField = ref(); |
|||
const _multiple = ref(); |
|||
const _searchCondition = ref({}) |
|||
|
|||
|
|||
/** 选择故障类型弹窗 */ |
|||
const chooseFaultType = (field) => { |
|||
_searchCondition.value = {} |
|||
const filters: any[] = [] |
|||
filters.push({ |
|||
key: 'available', |
|||
value: 'TRUE', |
|||
isMainValue: false |
|||
}) |
|||
// 参数整理 |
|||
_searchCondition.value.isSearch = true |
|||
_searchCondition.value.filters = filters |
|||
_searchTableTitle.value = '选择故障类型' |
|||
_searchField.value = "faultType" |
|||
_formField.value = 'faultType' |
|||
_searchTablePage.value = BasicFaultTypeApi.getBasicFaultTypePage, |
|||
_searchTableAllSchemas.value = BasicFaultType.allSchemas, |
|||
openCommon() |
|||
} |
|||
|
|||
|
|||
/** 选择设备编码弹窗 */ |
|||
const chooseEquipmentCode = (field) => { |
|||
_searchCondition.value = {} |
|||
const filters: any[] = [] |
|||
filters.push({ |
|||
key: 'status', |
|||
value: 'NORMAL', |
|||
action: '==', |
|||
isSearch: true, |
|||
isMainValue: false |
|||
}) |
|||
// 参数整理 |
|||
_searchCondition.value.isSearch = true |
|||
_searchCondition.value.filters = filters |
|||
_searchField.value = "equipmentCode" |
|||
_formField.value = 'equipmentCode' |
|||
if(typeValue.value == 'DEVICE'){ |
|||
_searchTableTitle.value = '选择设备编号' |
|||
_searchTablePage.value = EquipmentItemApi.getEquipmentAccountsPage, |
|||
_searchTableAllSchemas.value = EquipmentAccounts.allSchemas |
|||
}else{ |
|||
_searchTableTitle.value = '选择工装编号' |
|||
_searchTablePage.value = ToolItemApi.getToolAccountsPage, |
|||
_searchTableAllSchemas.value = ToolAccounts.allSchemas |
|||
} |
|||
openCommon() |
|||
} |
|||
|
|||
|
|||
/** 选择车间弹窗 */ |
|||
const chooseWorkshopCode = (field) => { |
|||
_searchCondition.value = {} |
|||
const filters: any[] = [] |
|||
filters.push({ |
|||
key: 'available', |
|||
value: 'TRUE', |
|||
isMainValue: false |
|||
}) |
|||
// 参数整理 |
|||
_searchCondition.value.isSearch = true |
|||
_searchCondition.value.filters = filters |
|||
_searchTableTitle.value = '选择车间' |
|||
_searchField.value = "workshopCode" |
|||
_formField.value = 'workshopCode' |
|||
_searchTablePage.value = WorkshopApi.getWorkshopPage, |
|||
_searchTableAllSchemas.value = Workshop.allSchemas, |
|||
openCommon() |
|||
} |
|||
|
|||
/*打开弹窗*/ |
|||
const openCommon = () => { |
|||
searchTableRef.value.open( |
|||
_searchTableTitle.value, |
|||
_searchTableAllSchemas.value, |
|||
_searchTablePage.value, |
|||
_searchField.value, |
|||
_searchCondition.value |
|||
) |
|||
} |
|||
|
|||
/** 弹窗选择之后 回调函数 */ |
|||
const searchTableSuccess = (formField, searchField, val) => { |
|||
nextTick?.(() => { |
|||
console.log(formField) |
|||
if (formField === 'workshopCode') { |
|||
formData.value.workshopCode = val[0].code |
|||
} |
|||
if (formField === 'equipmentCode') { |
|||
formData.value.equipmentCode = val[0].code |
|||
} |
|||
if (formField === 'faultType') { |
|||
formData.value.faultType = val[0].code |
|||
} |
|||
}) |
|||
} |
|||
|
|||
/** 初始化弹窗 */ |
|||
const open = async (type: string, row?: object) => { |
|||
dialogVisible.value = true |
|||
dialogTitle.value = t('action.' + type) |
|||
formType.value = type |
|||
//初始化数据 |
|||
formData.value.id = row.id |
|||
formData.value.number = row.number |
|||
} |
|||
defineExpose({ open }) // 提供 open 方法,用于打开弹窗 |
|||
|
|||
|
|||
const onChangeType = (field) => { |
|||
typeValue.value = '' |
|||
if(field == 'DEVICE'){ |
|||
typeValue.value = 'DEVICE' |
|||
formData.value.equipmentCode = null |
|||
}else if(field == 'EQUIPMENT'){ |
|||
typeValue.value = 'EQUIPMENT' |
|||
formData.value.equipmentCode = null |
|||
} |
|||
} |
|||
|
|||
const onChangeSec = (field) => { |
|||
//人员转办 |
|||
if(field == '0'){ |
|||
formData.value.equipmentCode = null |
|||
formData.value.type = null |
|||
isDisabled1.value = true |
|||
isDisabled2.value = false |
|||
formRules.workshopCode[0].required = true |
|||
formRules.maintenancer[0].required = true |
|||
formRules.type[0].required = false |
|||
formRules.equipmentCode[0].required = false |
|||
}else{ |
|||
//类型转办 |
|||
formData.value.workshopCode = null |
|||
formData.value.maintenancer = null |
|||
isDisabled1.value = false |
|||
isDisabled2.value = true |
|||
formRules.workshopCode[0].required = false |
|||
formRules.maintenancer[0].required = false |
|||
formRules.type[0].required = true |
|||
formRules.equipmentCode[0].required = true |
|||
} |
|||
} |
|||
|
|||
/** 提交表单 */ |
|||
const submitForm = async (val) => { |
|||
|
|||
// 校验表单 |
|||
if (!basicFormRef) return |
|||
const valid = await basicFormRef.value.validate() |
|||
if (!valid) return |
|||
|
|||
await message.delConfirm('是否提交数据?'); |
|||
|
|||
//发送数据 |
|||
await EquipmentRepairJobMainApi.updateEquipmentRepairJobMain(formData.value) |
|||
//把success函数传递到父页面 |
|||
emit('success',formData.value.id) |
|||
dialogVisible.value = false |
|||
} |
|||
|
|||
const handleClose=(val)=>{ |
|||
dialogVisible.value = false |
|||
emit('close',val) |
|||
} |
|||
|
|||
// 传递给父类 |
|||
const emit = defineEmits(['close','success']) |
|||
|
|||
</script> |
|||
|
|||
<style scoped> |
|||
.tag-container { |
|||
margin-top: 10px; /* 可根据需要调整标签容器与表单项之间的间距 */ |
|||
border: 1px solid #ccc; /* 添加边框样式 */ |
|||
padding: 10px; /* 可根据需要调整容器内边距 */ |
|||
width: 950px; /* 设置固定宽度为 950px */ |
|||
overflow-y: auto; /* 当内容溢出容器高度时显示滚动条 */ |
|||
word-wrap: break-word; /* 使用 word-wrap 属性实现超出范围换行 */ |
|||
overflow-wrap: break-word; /* 兼容性更好的写法 */ |
|||
flex-wrap: wrap; |
|||
} |
|||
.input-with-button { |
|||
display: flex; |
|||
align-items: center; |
|||
width: 100%; |
|||
} |
|||
|
|||
.input-with-button > .el-input { |
|||
flex: 1; |
|||
/*margin-right: 10px;*/ |
|||
} |
|||
|
|||
</style> |
@ -0,0 +1,126 @@ |
|||
<template> |
|||
<Dialog v-model="dialogVisible" :title="dialogTitle" :close-on-click-modal="false"> |
|||
<el-form ref="basicFormRef" v-loading="formLoading" :model="formData" :rules="formRules" label-width="100px"> |
|||
<el-row> |
|||
<el-col :span="24"> |
|||
<el-form-item label="审核内容" prop="approveContent"> |
|||
<el-input type="textarea" :input-style="{height:'200px'}" maxlength="300" v-model="formData.approveContent" placeholder="请输入审核内容" /> |
|||
</el-form-item> |
|||
</el-col> |
|||
</el-row> |
|||
</el-form> |
|||
<template #footer> |
|||
<el-button :disabled="formLoading" type="primary" @click="submitForm('success')">确 定</el-button> |
|||
<el-button @click="handleClose('close')">取 消</el-button> |
|||
</template> |
|||
</Dialog> |
|||
|
|||
<!--添加巡检项弹窗--> |
|||
<SearchTable ref="searchTableRef" @searchTableSuccess="searchTableSuccess" /> |
|||
|
|||
</template> |
|||
<script lang="ts" setup> |
|||
import * as PlanInspectionApi from '@/api/eam/planInspection' |
|||
import { SearchTable } from '@/components/SearchTable' |
|||
import {ElInput} from "element-plus"; |
|||
|
|||
defineOptions({ name: 'TeamForm' }) |
|||
|
|||
const { t } = useI18n() // 国际化 |
|||
const message = useMessage() // 消息弹窗 |
|||
|
|||
const dialogVisible = ref(false) // 弹窗的是否展示 |
|||
const dialogTitle = ref('') // 弹窗的标题 |
|||
const formLoading = ref(false) // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用 |
|||
const formType = ref('') // 表单的类型:create - 新增;update - 修改 |
|||
const tags=ref([]) |
|||
|
|||
const inputValue = ref('') |
|||
const inputVisible = ref(false) |
|||
const isDisabled = ref(false) |
|||
const InputRef = ref<InstanceType<typeof ElInput>>() |
|||
|
|||
|
|||
const formData = ref({ |
|||
id:'', |
|||
number:'', |
|||
approver: '', |
|||
approveContent: '', |
|||
approveTime: '', |
|||
}) |
|||
const formRules = reactive({ |
|||
approver: [ |
|||
{ required: true, message: '审核人不能为空', trigger: 'blur' }, |
|||
{ max: 50, message: '不得超过50个字符', trigger: 'blur' } |
|||
], |
|||
approveContent: [ |
|||
{ required: true, message: '审核内容不能为空', trigger: 'blur' }, |
|||
{ max: 50, message: '不得超过50个字符', trigger: 'blur' } |
|||
], |
|||
approveTime: [ |
|||
{ required: true, message: '审核时间不能为空', trigger: 'blur' }, |
|||
], |
|||
}) |
|||
const basicFormRef = ref() // 表单 Ref |
|||
|
|||
|
|||
/** 初始化弹窗 */ |
|||
const open = async (type: string, row?: object) => { |
|||
dialogVisible.value = true |
|||
dialogTitle.value = t('action.' + type) |
|||
formType.value = type |
|||
//初始化数据 |
|||
formData.value.id = row.id |
|||
formData.value.number = row.number |
|||
} |
|||
defineExpose({ open }) // 提供 open 方法,用于打开弹窗 |
|||
|
|||
/** 提交表单 */ |
|||
const submitForm = async (val) => { |
|||
|
|||
// 校验表单 |
|||
if (!basicFormRef) return |
|||
const valid = await basicFormRef.value.validate() |
|||
if (!valid) return |
|||
|
|||
//发送数据 |
|||
await PlanInspectionApi.updateInspectionPlanAudi(formData.value) |
|||
|
|||
//把success函数传递到父页面 |
|||
emit('success',formData.value.id) |
|||
dialogVisible.value = false |
|||
} |
|||
|
|||
const handleClose=(val)=>{ |
|||
dialogVisible.value = false |
|||
emit('close',val) |
|||
} |
|||
|
|||
// 传递给父类 |
|||
const emit = defineEmits(['close','success']) |
|||
|
|||
</script> |
|||
|
|||
<style scoped> |
|||
.tag-container { |
|||
margin-top: 10px; /* 可根据需要调整标签容器与表单项之间的间距 */ |
|||
border: 1px solid #ccc; /* 添加边框样式 */ |
|||
padding: 10px; /* 可根据需要调整容器内边距 */ |
|||
width: 950px; /* 设置固定宽度为 950px */ |
|||
overflow-y: auto; /* 当内容溢出容器高度时显示滚动条 */ |
|||
word-wrap: break-word; /* 使用 word-wrap 属性实现超出范围换行 */ |
|||
overflow-wrap: break-word; /* 兼容性更好的写法 */ |
|||
flex-wrap: wrap; |
|||
} |
|||
.input-with-button { |
|||
display: flex; |
|||
align-items: center; |
|||
width: 100%; |
|||
} |
|||
|
|||
.input-with-button > .el-input { |
|||
flex: 1; |
|||
/*margin-right: 10px;*/ |
|||
} |
|||
|
|||
</style> |
@ -0,0 +1,419 @@ |
|||
<template> |
|||
<ContentWrap> |
|||
<!-- 搜索工作栏 --> |
|||
<Search :schema="PlanInspection.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" /> |
|||
</ContentWrap> |
|||
|
|||
<!-- 列表头部 --> |
|||
<TableHead |
|||
:HeadButttondata="HeadButttondata" |
|||
@button-base-click="buttonBaseClick" |
|||
:routeName="routeName" |
|||
@updataTableColumns="updataTableColumns" |
|||
@searchFormClick="searchFormClick" |
|||
:allSchemas="PlanInspection.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="PlanInspectionRules" |
|||
:formAllSchemas="PlanInspection.allSchemas" |
|||
:apiUpdate="PlanInspectionApi.updatePlanInspection" |
|||
:apiCreate="PlanInspectionApi.createPlanInspection" |
|||
@searchTableSuccess="searchTableSuccess" |
|||
:isBusiness="false" |
|||
@onChange="onChange" |
|||
/> |
|||
|
|||
<!-- 详情 --> |
|||
<Detail ref="detailRef" :isBasic="true" :allSchemas="PlanInspection.allSchemas" /> |
|||
|
|||
<AudiForm ref="audiFormRef" @success="getData" @close="getClosed"/> |
|||
|
|||
<!-- 导入 --> |
|||
<ImportForm ref="importFormRef" url="/eam/plan-inspection/import" :importTemplateData="importTemplateData" @success="importSuccess" /> |
|||
</template> |
|||
|
|||
<script setup lang="ts"> |
|||
import download from '@/utils/download' |
|||
import { PlanInspection,PlanInspectionRules } from './planInspection.data' |
|||
import * as PlanInspectionApi from '@/api/eam/planInspection' |
|||
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 {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"; |
|||
import AudiForm from '@/views/eam/planInspection/audiForm.vue' |
|||
|
|||
defineOptions({ name: 'PlanInspection' }) |
|||
|
|||
const message = useMessage() // 消息弹窗 |
|||
const { t } = useI18n() // 国际化 |
|||
|
|||
const route = useRoute() // 路由信息 |
|||
const routeName = ref() |
|||
routeName.value = route.name |
|||
const tableColumns = ref(PlanInspection.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: PlanInspectionApi.getPlanInspectionPage // 分页接口 |
|||
}) |
|||
|
|||
// 获得表格的各种操作 |
|||
const { getList, setSearchParams } = tableMethods |
|||
|
|||
// 列表头部按钮 |
|||
const HeadButttondata = [ |
|||
defaultButtons.defaultAddBtn({hasPermi:'eam:planInspection:create'}), // 新增 |
|||
//defaultButtons.defaultImportBtn({hasPermi:'eam:planInspection:import'}), // 导入 |
|||
defaultButtons.defaultExportBtn({hasPermi:'eam:planInspection: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 isShowStatusButton = (row,val) => { |
|||
if (val.indexOf(row.status) > -1) { |
|||
return false |
|||
} else { |
|||
return true |
|||
} |
|||
} |
|||
|
|||
// 列表-操作按钮 |
|||
const butttondata = (row) => { |
|||
return [ |
|||
defaultButtons.mainListEditBtn({hasPermi:'eam:planInspection:update'}), // 编辑 |
|||
defaultButtons.mainListAuditingBtn({hide: isShowStatusButton(row,['0']),hasPermi:'eam:planInspection:update'}), // 审核 |
|||
defaultButtons.mainListFinishBtn({hide: isShowStatusButton(row,['3']),hasPermi:'eam:planInspection:update'}), // 完成 |
|||
defaultButtons.mainListEnableBtn({hide:isShowMainButton(row,['FALSE']),hasPermi:'eam:planInspection:update'}), |
|||
defaultButtons.mainListDisableBtn({hide:isShowMainButton(row,['TRUE']),hasPermi:'eam:planInspection: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) |
|||
} else if (val == 'auditing') { // 审核 |
|||
handleAuditing(row.id) |
|||
} else if (val == 'finish') { // 完成 |
|||
handleFinish(row) |
|||
} |
|||
} |
|||
|
|||
/** 添加/修改操作 */ |
|||
const basicFormRef = ref() |
|||
const openForm = (type: string, row?: any) => { |
|||
if(type == "create"){ |
|||
PlanInspection.allSchemas.formSchema.forEach((item) => { |
|||
if(item.field == 'status'){ |
|||
item.componentProps.disabled = true |
|||
} |
|||
}) |
|||
}else{ |
|||
PlanInspection.allSchemas.formSchema.forEach((item) => { |
|||
if(item.field == 'status'){ |
|||
item.componentProps.disabled = false |
|||
} |
|||
}) |
|||
} |
|||
|
|||
basicFormRef.value.open(type, row) |
|||
} |
|||
|
|||
// form表单提交 |
|||
const formsSuccess = async (formType,data) => { |
|||
var isHave =PlanInspection.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 PlanInspectionApi.createPlanInspection(data) |
|||
message.success(t('common.createSuccess')) |
|||
} else { |
|||
await PlanInspectionApi.updatePlanInspection(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, 'basicPlanInspection') |
|||
} |
|||
|
|||
//完成按钮 |
|||
const handleFinish = async (row) => { |
|||
message.confirmAudi(t('')).then(async () => { |
|||
//打开提交表单 |
|||
audiFormRef.value.open('update', row); |
|||
}).catch(async (action: Action) => { |
|||
if(action === 'cancel'){ |
|||
const params = ref({ |
|||
id: '', |
|||
status:'', |
|||
}) |
|||
params.value.id = row.id |
|||
params.value.status = '5' |
|||
await PlanInspectionApi.updateInspectionPlan(params.value) |
|||
message.success(t('common.updateSuccess')) |
|||
// 刷新列表 |
|||
await getList() |
|||
} |
|||
}) |
|||
} |
|||
|
|||
//审核按钮 |
|||
const audiFormRef = ref() |
|||
const handleAuditing = async (id: number) => { |
|||
await message.delConfirm('是否审核所选中工单?'); |
|||
const params = ref({ |
|||
id: '', |
|||
status:'', |
|||
}) |
|||
params.value.id = id |
|||
params.value.status = '3' |
|||
await PlanInspectionApi.updateInspectionPlan(params.value) |
|||
message.success(t('common.updateSuccess')) |
|||
// 刷新列表 |
|||
await getList() |
|||
} |
|||
|
|||
/** 启用 */ |
|||
const handleEnable = async (id: number) => { |
|||
try { |
|||
const params = ref({ |
|||
id: '', |
|||
available:'', |
|||
}) |
|||
params.value.id = id |
|||
params.value.available = 'TRUE' |
|||
await PlanInspectionApi.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 PlanInspectionApi.updateEnableCode(params.value) |
|||
message.success(t('common.updateSuccess')) |
|||
// 刷新列表 |
|||
await getList() |
|||
} catch {} |
|||
} |
|||
|
|||
/** 删除按钮操作 */ |
|||
const handleDelete = async (id: number) => { |
|||
try { |
|||
// 删除的二次确认 |
|||
await message.delConfirm() |
|||
// 发起删除 |
|||
await PlanInspectionApi.deletePlanInspection(id) |
|||
message.success(t('common.delSuccess')) |
|||
// 刷新列表 |
|||
await getList() |
|||
} catch {} |
|||
} |
|||
|
|||
const onChange = (field, item) => { |
|||
//设备 |
|||
if(field == 'type' && item == 'DEVICE'){ |
|||
PlanInspection.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'){ |
|||
PlanInspection.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 PlanInspectionApi.exportPlanInspection(tableObject.params) |
|||
download.excel(data, '巡检计划.xlsx') |
|||
} catch { |
|||
} finally { |
|||
exportLoading.value = false |
|||
} |
|||
} |
|||
|
|||
|
|||
//audiForm 关闭按钮回传 |
|||
const getClosed=(val)=> { |
|||
nextTick?.(() => { |
|||
getList() |
|||
}) |
|||
} |
|||
|
|||
//audiForm 提交按钮回传 |
|||
const getData=(val)=> { |
|||
nextTick?.(async () => { |
|||
|
|||
try { |
|||
const params = ref({ |
|||
id: '', |
|||
status:'', |
|||
}) |
|||
params.value.id = val |
|||
params.value.status = '4' |
|||
await PlanInspectionApi.updateInspectionPlan(params.value) |
|||
message.success(t('计划已流转')) |
|||
// 刷新列表 |
|||
await getList() |
|||
} catch {} |
|||
|
|||
} |
|||
) |
|||
} |
|||
|
|||
/** 导入 */ |
|||
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,395 @@ |
|||
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"; |
|||
import * as BasicInspectionApi from "@/api/eam/basicInspectionOption"; |
|||
import {BasicInspectionOption} from "@/views/eam/basicInspectionOption/basicInspectionOption.data"; |
|||
import {getBasicInspectionOptionPage} from "@/api/eam/basicInspectionOption"; |
|||
import {Workshop} from "@/views/wms/basicDataManage/factoryModeling/workshop/workshop.data"; |
|||
import * as WorkshopApi from "@/api/wms/workshop"; |
|||
|
|||
// 表单校验
|
|||
export const PlanInspectionRules = reactive({ |
|||
number: [required], |
|||
name: [required], |
|||
equipmentCode: [required], |
|||
optionCode: [required], |
|||
cycle: [required], |
|||
startTime: [required], |
|||
endTime: [required], |
|||
}) |
|||
|
|||
export const PlanInspection = useCrudSchemas(reactive<CrudSchema[]>([ |
|||
{ |
|||
label: 'id', |
|||
field: 'id', |
|||
sort: 'custom', |
|||
isSearch: false, |
|||
isTable: false, |
|||
isForm: false, |
|||
isDetail:false, |
|||
}, |
|||
{ |
|||
label: '计划编号', |
|||
field: 'number', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
isForm: false, |
|||
isDetail:true, |
|||
}, |
|||
{ |
|||
label: '计划名称', |
|||
field: 'name', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
}, |
|||
{ |
|||
label: '设备类别', |
|||
field: 'type', |
|||
dictType: DICT_TYPE.DEVICE_TYPE, |
|||
dictClass: 'string', |
|||
sort: 'custom', |
|||
isSearch: false, |
|||
}, |
|||
{ |
|||
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, |
|||
isForm: true, |
|||
form: { |
|||
componentProps: { |
|||
isSearchList: true, // 开启查询弹窗
|
|||
searchTitle: '巡检方案信息', // 查询弹窗标题
|
|||
searchListPlaceholder: '请选择巡检方案', // 输入框占位文本
|
|||
searchAllSchemas: BasicInspectionOption.allSchemas, // 查询弹窗所需类
|
|||
searchField: 'code', // 查询弹窗赋值字段
|
|||
searchPage: BasicInspectionApi.getBasicInspectionOptionPage, // 查询弹窗所需分页方法
|
|||
multiple:true, |
|||
searchCondition: [{ |
|||
key: 'available', |
|||
value: 'TRUE', |
|||
action: '==', |
|||
isSearch: true, |
|||
isMainValue: false |
|||
}] |
|||
} |
|||
} |
|||
}, |
|||
{ |
|||
label: '计划类型', |
|||
field: 'cycle', |
|||
dictType: DICT_TYPE.INSPECTION_CYCLE, |
|||
dictClass: 'string', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
}, |
|||
{ |
|||
label: '计划开始时间', |
|||
field: 'startTime', |
|||
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: 'endTime', |
|||
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: 'status', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
dictType: DICT_TYPE.EAM_PLAN_STATUS, |
|||
dictClass: 'string', |
|||
}, |
|||
{ |
|||
label: '审核人', |
|||
field: 'approver', |
|||
sort: 'custom', |
|||
isSearch: false, |
|||
}, |
|||
{ |
|||
label: '审核内容', |
|||
field: 'approveContent', |
|||
sort: 'custom', |
|||
isSearch: false, |
|||
}, |
|||
{ |
|||
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', |
|||
isSearch: false, |
|||
isTable: false, |
|||
isForm: false, |
|||
isDetail:false, |
|||
}, |
|||
{ |
|||
label: '自动通过', |
|||
field: 'autoAgree', |
|||
sort: 'custom', |
|||
isSearch: false, |
|||
isTable: false, |
|||
isForm: false, |
|||
isDetail:false, |
|||
}, |
|||
{ |
|||
label: '直接生成记录', |
|||
field: 'directCreateRecord', |
|||
sort: 'custom', |
|||
isSearch: false, |
|||
}, |
|||
{ |
|||
label: '所属厂区编号', |
|||
field: 'factoryAreaCode', |
|||
sort: 'custom', |
|||
isSearch: false, |
|||
isTable: false, |
|||
isForm: false, |
|||
isDetail:false, |
|||
}, |
|||
{ |
|||
label: '车间编号', |
|||
field: 'workshopCode', |
|||
sort: 'custom', |
|||
isSearch: false, |
|||
required: 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: false, |
|||
isTable: false, |
|||
isForm: false, |
|||
isDetail:false, |
|||
}, |
|||
{ |
|||
label: '工序编号', |
|||
field: 'processCode', |
|||
sort: 'custom', |
|||
isSearch: false, |
|||
isTable: false, |
|||
isForm: false, |
|||
isDetail:false, |
|||
}, |
|||
{ |
|||
label: '工位编号', |
|||
field: 'workstationCode', |
|||
sort: 'custom', |
|||
isSearch: false, |
|||
isTable: false, |
|||
isForm: false, |
|||
isDetail:false, |
|||
}, |
|||
{ |
|||
label: '创建时间', |
|||
field: 'createTime', |
|||
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')] |
|||
} |
|||
}, |
|||
isForm: false, |
|||
}, |
|||
{ |
|||
label: '部门id', |
|||
field: 'departmentCode', |
|||
sort: 'custom', |
|||
isSearch: false, |
|||
isTable: false, |
|||
isForm: false, |
|||
isDetail:false, |
|||
}, |
|||
{ |
|||
label: '备注', |
|||
field: 'remark', |
|||
sort: 'custom', |
|||
isSearch: false, |
|||
isTable: false, |
|||
isForm: false, |
|||
isDetail:false, |
|||
}, |
|||
{ |
|||
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,125 @@ |
|||
<template> |
|||
<Dialog v-model="dialogVisible" :title="dialogTitle" :close-on-click-modal="false"> |
|||
<el-form ref="basicFormRef" v-loading="formLoading" :model="formData" :rules="formRules" label-width="100px"> |
|||
<el-row> |
|||
<el-col :span="24"> |
|||
<el-form-item label="审核内容" prop="approveContent"> |
|||
<el-input type="textarea" :input-style="{height:'200px'}" maxlength="300" v-model="formData.approveContent" placeholder="请输入审核内容" /> |
|||
</el-form-item> |
|||
</el-col> |
|||
</el-row> |
|||
</el-form> |
|||
<template #footer> |
|||
<el-button :disabled="formLoading" type="primary" @click="submitForm('success')">确 定</el-button> |
|||
<el-button @click="handleClose('close')">取 消</el-button> |
|||
</template> |
|||
</Dialog> |
|||
<!--添加巡检项弹窗--> |
|||
<SearchTable ref="searchTableRef" @searchTableSuccess="searchTableSuccess" /> |
|||
|
|||
</template> |
|||
<script lang="ts" setup> |
|||
import * as SpotCheckApi from '@/api/eam/planSpotCheck' |
|||
import { SearchTable } from '@/components/SearchTable' |
|||
import {ElInput} from "element-plus"; |
|||
|
|||
defineOptions({ name: 'TeamForm' }) |
|||
|
|||
const { t } = useI18n() // 国际化 |
|||
const message = useMessage() // 消息弹窗 |
|||
|
|||
const dialogVisible = ref(false) // 弹窗的是否展示 |
|||
const dialogTitle = ref('') // 弹窗的标题 |
|||
const formLoading = ref(false) // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用 |
|||
const formType = ref('') // 表单的类型:create - 新增;update - 修改 |
|||
const tags=ref([]) |
|||
|
|||
const inputValue = ref('') |
|||
const inputVisible = ref(false) |
|||
const isDisabled = ref(false) |
|||
const InputRef = ref<InstanceType<typeof ElInput>>() |
|||
|
|||
|
|||
const formData = ref({ |
|||
id:'', |
|||
number:'', |
|||
approver: '', |
|||
approveContent: '', |
|||
approveTime: '', |
|||
}) |
|||
const formRules = reactive({ |
|||
approver: [ |
|||
{ required: true, message: '审核人不能为空', trigger: 'blur' }, |
|||
{ max: 50, message: '不得超过50个字符', trigger: 'blur' } |
|||
], |
|||
approveContent: [ |
|||
{ required: true, message: '审核内容不能为空', trigger: 'blur' }, |
|||
{ max: 50, message: '不得超过50个字符', trigger: 'blur' } |
|||
], |
|||
approveTime: [ |
|||
{ required: true, message: '审核时间不能为空', trigger: 'blur' }, |
|||
], |
|||
}) |
|||
const basicFormRef = ref() // 表单 Ref |
|||
|
|||
|
|||
/** 初始化弹窗 */ |
|||
const open = async (type: string, row?: object) => { |
|||
dialogVisible.value = true |
|||
dialogTitle.value = t('action.' + type) |
|||
formType.value = type |
|||
//初始化数据 |
|||
formData.value.id = row.id |
|||
formData.value.number = row.number |
|||
} |
|||
defineExpose({ open }) // 提供 open 方法,用于打开弹窗 |
|||
|
|||
/** 提交表单 */ |
|||
const submitForm = async (val) => { |
|||
|
|||
// 校验表单 |
|||
if (!basicFormRef) return |
|||
const valid = await basicFormRef.value.validate() |
|||
if (!valid) return |
|||
|
|||
//发送数据 |
|||
await SpotCheckApi.updateSpotCheckPlanAudi(formData.value) |
|||
|
|||
//把success函数传递到父页面 |
|||
emit('success',formData.value.id) |
|||
dialogVisible.value = false |
|||
} |
|||
|
|||
const handleClose=(val)=>{ |
|||
dialogVisible.value = false |
|||
emit('close',val) |
|||
} |
|||
|
|||
// 传递给父类 |
|||
const emit = defineEmits(['close','success']) |
|||
|
|||
</script> |
|||
|
|||
<style scoped> |
|||
.tag-container { |
|||
margin-top: 10px; /* 可根据需要调整标签容器与表单项之间的间距 */ |
|||
border: 1px solid #ccc; /* 添加边框样式 */ |
|||
padding: 10px; /* 可根据需要调整容器内边距 */ |
|||
width: 950px; /* 设置固定宽度为 950px */ |
|||
overflow-y: auto; /* 当内容溢出容器高度时显示滚动条 */ |
|||
word-wrap: break-word; /* 使用 word-wrap 属性实现超出范围换行 */ |
|||
overflow-wrap: break-word; /* 兼容性更好的写法 */ |
|||
flex-wrap: wrap; |
|||
} |
|||
.input-with-button { |
|||
display: flex; |
|||
align-items: center; |
|||
width: 100%; |
|||
} |
|||
|
|||
.input-with-button > .el-input { |
|||
flex: 1; |
|||
/*margin-right: 10px;*/ |
|||
} |
|||
|
|||
</style> |
@ -0,0 +1,422 @@ |
|||
<template> |
|||
<ContentWrap> |
|||
<!-- 搜索工作栏 --> |
|||
<Search :schema="PlanSpotCheck.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" /> |
|||
</ContentWrap> |
|||
|
|||
<!-- 列表头部 --> |
|||
<TableHead |
|||
:HeadButttondata="HeadButttondata" |
|||
@button-base-click="buttonBaseClick" |
|||
:routeName="routeName" |
|||
@updataTableColumns="updataTableColumns" |
|||
@searchFormClick="searchFormClick" |
|||
:allSchemas="PlanSpotCheck.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="PlanSpotCheckRules" |
|||
:formAllSchemas="PlanSpotCheck.allSchemas" |
|||
:apiUpdate="PlanSpotCheckApi.updatePlanSpotCheck" |
|||
:apiCreate="PlanSpotCheckApi.createPlanSpotCheck" |
|||
@searchTableSuccess="searchTableSuccess" |
|||
:isBusiness="false" |
|||
@onChange="onChange" |
|||
/> |
|||
|
|||
<!-- 详情 --> |
|||
<Detail ref="detailRef" :isBasic="true" :allSchemas="PlanSpotCheck.allSchemas" /> |
|||
|
|||
<AudiForm ref="audiFormRef" @success="getData" @close="getClosed"/> |
|||
|
|||
<!-- 导入 --> |
|||
<ImportForm ref="importFormRef" url="/eam/plan-spot-check/import" :importTemplateData="importTemplateData" @success="importSuccess" /> |
|||
</template> |
|||
|
|||
<script setup lang="ts"> |
|||
import download from '@/utils/download' |
|||
import { PlanSpotCheck,PlanSpotCheckRules } from './planSpotCheck.data' |
|||
import * as PlanSpotCheckApi from '@/api/eam/planSpotCheck' |
|||
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 {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"; |
|||
import AudiForm from '@/views/eam/planSpotCheck/audiForm.vue' |
|||
import {updateSpotCheckPlan} from "@/api/eam/planSpotCheck"; |
|||
|
|||
defineOptions({ name: 'PlanSpotCheck' }) |
|||
|
|||
const message = useMessage() // 消息弹窗 |
|||
const { t } = useI18n() // 国际化 |
|||
|
|||
const route = useRoute() // 路由信息 |
|||
const routeName = ref() |
|||
routeName.value = route.name |
|||
const tableColumns = ref(PlanSpotCheck.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: PlanSpotCheckApi.getPlanSpotCheckPage // 分页接口 |
|||
}) |
|||
|
|||
// 获得表格的各种操作 |
|||
const { getList, setSearchParams } = tableMethods |
|||
|
|||
// 列表头部按钮 |
|||
const HeadButttondata = [ |
|||
defaultButtons.defaultAddBtn({hasPermi:'eam:planSpotCheck:create'}), // 新增 |
|||
//defaultButtons.defaultImportBtn({hasPermi:'eam:planSpotCheck:import'}), // 导入 |
|||
defaultButtons.defaultExportBtn({hasPermi:'eam:planSpotCheck: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 isShowStatusButton = (row,val) => { |
|||
if (val.indexOf(row.status) > -1) { |
|||
return false |
|||
} else { |
|||
return true |
|||
} |
|||
} |
|||
|
|||
// 列表-操作按钮 |
|||
const butttondata = (row) => { |
|||
return [ |
|||
defaultButtons.mainListEditBtn({hasPermi:'eam:planSpotCheck:update'}), // 编辑 |
|||
defaultButtons.mainListAuditingBtn({hide: isShowStatusButton(row,['0']),hasPermi:'eam:planSpotCheck:update'}), // 审核 |
|||
defaultButtons.mainListFinishBtn({hide: isShowStatusButton(row,['3']),hasPermi:'eam:planSpotCheck:update'}), // 完成 |
|||
defaultButtons.mainListEnableBtn({hide:isShowMainButton(row,['FALSE']),hasPermi:'eam:planSpotCheck:update'}), |
|||
defaultButtons.mainListDisableBtn({hide:isShowMainButton(row,['TRUE']),hasPermi:'eam:planSpotCheck: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) |
|||
} else if (val == 'auditing') { // 审核 |
|||
handleAuditing(row.id) |
|||
} else if (val == 'finish') { // 完成 |
|||
handleFinish(row) |
|||
} |
|||
} |
|||
|
|||
/** 添加/修改操作 */ |
|||
const basicFormRef = ref() |
|||
const openForm = (type: string, row?: any) => { |
|||
if(type == "create"){ |
|||
PlanSpotCheck.allSchemas.formSchema.forEach((item) => { |
|||
if(item.field == 'status'){ |
|||
item.componentProps.disabled = true |
|||
} |
|||
}) |
|||
}else{ |
|||
PlanSpotCheck.allSchemas.formSchema.forEach((item) => { |
|||
if(item.field == 'status'){ |
|||
item.componentProps.disabled = false |
|||
} |
|||
}) |
|||
} |
|||
basicFormRef.value.open(type, row) |
|||
} |
|||
|
|||
// form表单提交 |
|||
const formsSuccess = async (formType,data) => { |
|||
var isHave =PlanSpotCheck.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 PlanSpotCheckApi.createPlanSpotCheck(data) |
|||
message.success(t('common.createSuccess')) |
|||
} else { |
|||
await PlanSpotCheckApi.updatePlanSpotCheck(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, 'basicPlanSpotCheck') |
|||
} |
|||
|
|||
/** 删除按钮操作 */ |
|||
const handleDelete = async (id: number) => { |
|||
try { |
|||
// 删除的二次确认 |
|||
await message.delConfirm() |
|||
// 发起删除 |
|||
await PlanSpotCheckApi.deletePlanSpotCheck(id) |
|||
message.success(t('common.delSuccess')) |
|||
// 刷新列表 |
|||
await getList() |
|||
} catch {} |
|||
} |
|||
|
|||
|
|||
//完成按钮 |
|||
const handleFinish = async (row) => { |
|||
message.confirmAudi(t('')).then(async () => { |
|||
//打开提交表单 |
|||
audiFormRef.value.open('update', row); |
|||
}).catch(async (action: Action) => { |
|||
if(action === 'cancel'){ |
|||
const params = ref({ |
|||
id: '', |
|||
status:'', |
|||
}) |
|||
params.value.id = row.id |
|||
params.value.status = '5' |
|||
await PlanSpotCheckApi.updateSpotCheckPlan(params.value) |
|||
message.success(t('common.updateSuccess')) |
|||
// 刷新列表 |
|||
await getList() |
|||
} |
|||
}) |
|||
} |
|||
|
|||
//审核按钮 |
|||
const audiFormRef = ref() |
|||
const handleAuditing = async (id: number) => { |
|||
await message.delConfirm('是否审核所选中工单?'); |
|||
try { |
|||
const params = ref({ |
|||
id: '', |
|||
status:'', |
|||
}) |
|||
params.value.id = id |
|||
params.value.status = '3' |
|||
await PlanSpotCheckApi.updateSpotCheckPlan(params.value) |
|||
message.success(t('common.updateSuccess')) |
|||
// 刷新列表 |
|||
await getList() |
|||
} catch {} |
|||
} |
|||
|
|||
/** 启用 */ |
|||
const handleEnable = async (id: number) => { |
|||
try { |
|||
const params = ref({ |
|||
id: '', |
|||
available:'', |
|||
}) |
|||
params.value.id = id |
|||
params.value.available = 'TRUE' |
|||
await PlanSpotCheckApi.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 PlanSpotCheckApi.updateEnableCode(params.value) |
|||
message.success(t('common.updateSuccess')) |
|||
// 刷新列表 |
|||
await getList() |
|||
} catch {} |
|||
} |
|||
|
|||
const onChange = (field, item) => { |
|||
//设备 |
|||
if(field == 'type' && item == 'DEVICE'){ |
|||
PlanSpotCheck.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'){ |
|||
PlanSpotCheck.allSchemas.formSchema.forEach((items) => { |
|||
if (items.field == 'equipmentCode') { |
|||
basicFormRef.value.formRef.setValues({ |
|||
equipmentCode:'' |
|||
}) |
|||
items.componentProps.searchAllSchemas = ToolAccounts.allSchemas |
|||
items.componentProps.searchPage = ToolItemApi.getToolAccountsPage |
|||
} |
|||
}) |
|||
} |
|||
} |
|||
|
|||
|
|||
//audiForm 关闭按钮回传 |
|||
const getClosed=(val)=> { |
|||
nextTick?.(() => { |
|||
getList() |
|||
}) |
|||
} |
|||
|
|||
//audiForm 提交按钮回传 |
|||
const getData=(val)=> { |
|||
nextTick?.(async () => { |
|||
|
|||
try { |
|||
const params = ref({ |
|||
id: '', |
|||
status:'', |
|||
}) |
|||
params.value.id = val |
|||
params.value.status = '4' |
|||
await PlanSpotCheckApi.updateSpotCheckPlan(params.value) |
|||
message.success(t('计划已流转')) |
|||
// 刷新列表 |
|||
await getList() |
|||
} catch {} |
|||
|
|||
} |
|||
) |
|||
} |
|||
|
|||
/** 导出按钮操作 */ |
|||
const exportLoading = ref(false) // 导出的加载中 |
|||
const handleExport = async () => { |
|||
try { |
|||
// 导出的二次确认 |
|||
await message.exportConfirm() |
|||
// 发起导出 |
|||
exportLoading.value = true |
|||
const data = await PlanSpotCheckApi.exportPlanSpotCheck(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,394 @@ |
|||
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"; |
|||
import * as SpotCheckOptionApi from "@/api/eam/basicSpotCheckOption"; |
|||
import {BasicSpotCheckOption} from "@/views/eam/basicSpotCheckOption/basicSpotCheckOption.data"; |
|||
import {Workshop} from "@/views/wms/basicDataManage/factoryModeling/workshop/workshop.data"; |
|||
import * as WorkshopApi from "@/api/wms/workshop"; |
|||
|
|||
// 表单校验
|
|||
export const PlanSpotCheckRules = reactive({ |
|||
number: [required], |
|||
name: [required], |
|||
equipmentCode: [required], |
|||
optionCode: [required], |
|||
cycle: [required], |
|||
startTime: [required], |
|||
endTime: [required], |
|||
}) |
|||
|
|||
export const PlanSpotCheck = useCrudSchemas(reactive<CrudSchema[]>([ |
|||
{ |
|||
label: 'id', |
|||
field: 'id', |
|||
sort: 'custom', |
|||
isSearch: false, |
|||
isTable: false, |
|||
isForm: false, |
|||
isDetail:false, |
|||
}, |
|||
{ |
|||
label: '计划编号', |
|||
field: 'number', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
isForm: false, |
|||
isDetail:true, |
|||
}, |
|||
{ |
|||
label: '计划名称', |
|||
field: 'name', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
}, |
|||
{ |
|||
label: '设备类别', |
|||
field: 'type', |
|||
dictType: DICT_TYPE.DEVICE_TYPE, |
|||
dictClass: 'string', |
|||
sort: 'custom', |
|||
isSearch: false, |
|||
}, |
|||
{ |
|||
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, |
|||
isForm: true, |
|||
form: { |
|||
componentProps: { |
|||
isSearchList: true, // 开启查询弹窗
|
|||
searchTitle: '点检方案信息', // 查询弹窗标题
|
|||
searchListPlaceholder: '请选择点检方案', // 输入框占位文本
|
|||
searchAllSchemas: BasicSpotCheckOption.allSchemas, // 查询弹窗所需类
|
|||
searchField: 'code', // 查询弹窗赋值字段
|
|||
searchPage: SpotCheckOptionApi.getBasicSpotCheckOptionPage, // 查询弹窗所需分页方法
|
|||
multiple:true, |
|||
searchCondition: [{ |
|||
key: 'available', |
|||
value: 'TRUE', |
|||
action: '==', |
|||
isSearch: true, |
|||
isMainValue: false |
|||
}] |
|||
} |
|||
} |
|||
}, |
|||
{ |
|||
label: '计划类型', |
|||
field: 'cycle', |
|||
dictType: DICT_TYPE.SPOTCHECK_CYCLE, |
|||
dictClass: 'string', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
}, |
|||
{ |
|||
label: '计划开始时间', |
|||
field: 'startTime', |
|||
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: 'endTime', |
|||
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: 'status', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
dictType: DICT_TYPE.EAM_PLAN_STATUS, |
|||
dictClass: 'string', |
|||
}, |
|||
{ |
|||
label: '审核人', |
|||
field: 'approver', |
|||
sort: 'custom', |
|||
isSearch: false, |
|||
}, |
|||
{ |
|||
label: '审核内容', |
|||
field: 'approveContent', |
|||
sort: 'custom', |
|||
isSearch: false, |
|||
}, |
|||
{ |
|||
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', |
|||
isSearch: false, |
|||
isTable: false, |
|||
isForm: false, |
|||
isDetail:false, |
|||
}, |
|||
{ |
|||
label: '自动通过', |
|||
field: 'autoAgree', |
|||
sort: 'custom', |
|||
isSearch: false, |
|||
isTable: false, |
|||
isForm: false, |
|||
isDetail:false, |
|||
}, |
|||
{ |
|||
label: '直接生成记录', |
|||
field: 'directCreateRecord', |
|||
sort: 'custom', |
|||
isSearch: false, |
|||
}, |
|||
{ |
|||
label: '所属厂区编号', |
|||
field: 'factoryAreaCode', |
|||
sort: 'custom', |
|||
isSearch: false, |
|||
isTable: false, |
|||
isForm: false, |
|||
isDetail:false, |
|||
}, |
|||
{ |
|||
label: '车间编号', |
|||
field: 'workshopCode', |
|||
sort: 'custom', |
|||
isSearch: false, |
|||
required: 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: false, |
|||
isTable: false, |
|||
isForm: false, |
|||
isDetail:false, |
|||
}, |
|||
{ |
|||
label: '工序编号', |
|||
field: 'processCode', |
|||
sort: 'custom', |
|||
isSearch: false, |
|||
isTable: false, |
|||
isForm: false, |
|||
isDetail:false, |
|||
}, |
|||
{ |
|||
label: '工位编号', |
|||
field: 'workstationCode', |
|||
sort: 'custom', |
|||
isSearch: false, |
|||
isTable: false, |
|||
isForm: false, |
|||
isDetail:false, |
|||
}, |
|||
{ |
|||
label: '创建时间', |
|||
field: 'createTime', |
|||
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')] |
|||
} |
|||
}, |
|||
isForm: false, |
|||
}, |
|||
{ |
|||
label: '部门id', |
|||
field: 'departmentCode', |
|||
sort: 'custom', |
|||
isSearch: false, |
|||
isTable: false, |
|||
isForm: false, |
|||
isDetail:false, |
|||
}, |
|||
{ |
|||
label: '备注', |
|||
field: 'remark', |
|||
sort: 'custom', |
|||
isSearch: false, |
|||
isTable: false, |
|||
isForm: false, |
|||
isDetail:false, |
|||
}, |
|||
{ |
|||
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,438 @@ |
|||
<template> |
|||
<ContentWrap> |
|||
<!-- 搜索工作栏 --> |
|||
<Search |
|||
:schema="SparePartsInLocationMain.allSchemas.searchSchema" |
|||
@search="setSearchParams" |
|||
@reset="setSearchParams" |
|||
/> |
|||
</ContentWrap> |
|||
|
|||
<!-- 列表头部 --> |
|||
<TableHead |
|||
:HeadButttondata="HeadButttondata" |
|||
@button-base-click="buttonBaseClick" |
|||
:routeName="routeName" |
|||
@updataTableColumns="updataTableColumns" |
|||
@searchFormClick="searchFormClick" |
|||
:allSchemas="SparePartsInLocationMain.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="formRef" |
|||
@success="getList" |
|||
:rules="SparePartsInLocationMainRules" |
|||
:formAllSchemas="SparePartsInLocationMain.allSchemas" |
|||
:tableAllSchemas="SparePartsInLocationDetail.allSchemas" |
|||
:tableFormRules="SparePartsInLocationDetailRules" |
|||
:tableData="tableData" |
|||
:apiUpdate="SparePartsInLocationMainApi.updateSparePartsApplyMain" |
|||
:apiCreate="SparePartsInLocationMainApi.createSparePartsApplyMain" |
|||
:isBusiness="true" |
|||
@handleAddTable="handleAddTable" |
|||
@handleDeleteTable="handleDeleteTable" |
|||
@searchTableSuccess="searchTableSuccess" |
|||
@submitForm="submitForm" |
|||
/> |
|||
|
|||
<!-- 详情 --> |
|||
<Detail |
|||
ref="detailRef" |
|||
:isBasic="false" |
|||
:allSchemas="SparePartsInLocationMain.allSchemas" |
|||
:detailAllSchemas="SparePartsInLocationDetail.allSchemas" |
|||
:detailAllSchemasRules="SparePartsInLocationDetailRules" |
|||
:apiCreate="SparePartsInLocationDetailApi.createSparePartsInLocationDetail" |
|||
:apiUpdate="SparePartsInLocationDetailApi.updateSparePartsInLocationDetail" |
|||
:apiPage="SparePartsInLocationDetailApi.getSparePartsInLocationDetailPage" |
|||
:apiDelete="SparePartsInLocationDetailApi.deleteSparePartsInLocationDetail" |
|||
@searchTableSuccessDetail="searchTableSuccessDetail" |
|||
:isShowAddBtn="true" |
|||
:detailButtonIsShowAdd="false" |
|||
/> |
|||
<!-- 审核页面 --> |
|||
<!-- <AudiForm ref="audiFormRef" @success="handleApprove"/> --> |
|||
<BasicForm |
|||
ref="formRefApproved" |
|||
:rules="SparePartsInLocationMainRules" |
|||
:formAllSchemas="SparePartsInLocationExamine.allSchemas" |
|||
@submitForm="approveSparePartsInLocation" |
|||
/> |
|||
<!-- 导入 --> |
|||
<ImportForm |
|||
ref="importFormRef" |
|||
url="/eam/spare-parts-in-location-main/import" |
|||
:importTemplateData="importTemplateData" |
|||
@success="importSuccess" |
|||
/> |
|||
</template> |
|||
|
|||
<script setup lang="ts"> |
|||
import download from '@/utils/download' |
|||
import { |
|||
SparePartsInLocationMain, |
|||
SparePartsInLocationMainRules, |
|||
SparePartsInLocationDetail, |
|||
SparePartsInLocationDetailRules, |
|||
SparePartsInLocationExamine |
|||
} from './sparePartsInLocationMain.data' |
|||
import * as SparePartsInLocationMainApi from '@/api/eam/sparePartsInLocationMain' |
|||
import * as SparePartsInLocationDetailApi from '@/api/eam/sparePartsInLocationDetail' |
|||
import * as defaultButtons from '@/utils/disposition/defaultButtons' |
|||
import TableHead from '@/components/TableHead/src/TableHead.vue' |
|||
import ImportForm from '@/components/ImportForm/src/ImportForm.vue' |
|||
// import AudiForm from '@/views/eam/sparepartsinlocation/audiForm.vue' |
|||
|
|||
// 采购订单 |
|||
defineOptions({ name: 'SparePartsApply' }) |
|||
|
|||
const message = useMessage() // 消息弹窗 |
|||
const { t } = useI18n() // 国际化 |
|||
const route = useRoute() // 路由信息 |
|||
const routeName = ref() |
|||
routeName.value = route.name |
|||
const formRef = ref() |
|||
const formRefApproved = ref() |
|||
const tableColumns = ref(SparePartsInLocationMain.allSchemas.tableColumns) |
|||
// const audiFormRef = ref() |
|||
// 字段设置 更新主列表字段 |
|||
const updataTableColumns = (val) => { |
|||
tableColumns.value = val |
|||
} |
|||
|
|||
// 查询页面返回 |
|||
const searchTableSuccess = (formField, searchField, val, formRef, type, row) => { |
|||
nextTick(() => { |
|||
nextTick(() => { |
|||
const setV = {} |
|||
setV[formField] = val[0][searchField] |
|||
if (type == 'tableForm') { |
|||
if (formField == 'locationCode') { |
|||
// row['sparePartsCode'] = val[0].itemNumber |
|||
row['locationCode'] = val[0].code |
|||
row['areaCode'] = val[0].areaCode |
|||
row['sparePartsCode'] = val[0].sparePartsCode |
|||
row['currentQty'] = val[0].qty |
|||
row['isRadeIn'] = val[0].isRadeIn |
|||
} |
|||
} else { |
|||
if (formField == 'locationCode') { |
|||
setV['locationCode'] = val[0].code |
|||
setV['areaCode'] = val[0].areaCode |
|||
setV['sparePartsCode'] = val[0].sparePartsCode |
|||
setV['currentQty'] = val[0].qty |
|||
setV['isRadeIn'] = val[0].isRadeIn |
|||
|
|||
} |
|||
} |
|||
formRef.setValues(setV) |
|||
}) |
|||
}) |
|||
} |
|||
// 查询页面返回——详情 |
|||
const searchTableSuccessDetail = (formField, searchField, val, formRef) => { |
|||
nextTick(async () => { |
|||
const setV = {} |
|||
if (formField == 'locationCode') { |
|||
setV['locationCode'] = val[0].code |
|||
setV['areaCode'] = val[0].areaCode |
|||
setV['sparePartsCode'] = val[0].sparePartsCode |
|||
setV['currentQty'] = val[0].qty |
|||
setV['isRadeIn'] = val[0].isRadeIn |
|||
} |
|||
formRef.setValues(setV) |
|||
}) |
|||
} |
|||
|
|||
// 子表新增的时候选择表格之后需要会显得字段 |
|||
const Echo = [] |
|||
const { tableObject, tableMethods } = useTable({ |
|||
getListApi: SparePartsInLocationMainApi.getSparePartsInLocationMainPage // 分页接口 |
|||
}) |
|||
|
|||
// 获得表格的各种操作 |
|||
const { getList, setSearchParams } = tableMethods |
|||
|
|||
// 列表头部按钮 |
|||
const HeadButttondata = [ |
|||
defaultButtons.defaultAddBtn({hasPermi:'eam:spare-parts-in-location-main:create'}), // 新增 |
|||
defaultButtons.defaultImportBtn({hasPermi:'eam:spare-parts-in-location-main:import'}), // 导入 |
|||
defaultButtons.defaultExportBtn({hasPermi:'eam:spare-parts-in-location-main: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({hide: isShowStatusButton(row, ['0']), hasPermi: 'eam:spare-parts-in-location-main:update' }), // 编辑 |
|||
defaultButtons.mainListDeleteBtn({hide: isShowStatusButton(row, ['0']), hasPermi: 'eam:spare-parts-in-location-main:delete' }), // 删除 |
|||
defaultButtons.mainListAuditingBtn({hide: isShowStatusButton(row, ['0']), hasPermi: 'eam:spare-parts-in-location-main:examine' }), //审核 |
|||
defaultButtons.mainListRevokeBtn({hide: isShowStatusButton(row, ['3']), hasPermi: 'eam:spare-parts-in-location-main:cancel'}), // 撤回 |
|||
defaultButtons.mainListTurnDownBtn({hide: isShowStatusButton(row, ['3']), hasPermi: 'eam:spare-parts-in-location-main:rejecte' }), //驳回 |
|||
defaultButtons.mainListApproveBtn({hide: isShowStatusButton(row, ['3']), hasPermi: 'eam:spare-parts-in-location-main:approve' }), //审批通过 |
|||
] |
|||
} |
|||
|
|||
// 列表-操作按钮事件 |
|||
const buttonTableClick = async (val, row) => { |
|||
if (val == 'edit') { |
|||
// 编辑 |
|||
openForm('update', row) |
|||
} |
|||
else if (val == 'auditing') { |
|||
//审核 |
|||
handleSubmitExamine(row.id) |
|||
} |
|||
else if (val == 'mainTurnDown') { |
|||
//驳回 |
|||
handleRejecte(row.id) |
|||
} |
|||
else if (val == 'mainApprove') { |
|||
//审核通过 |
|||
formRefApproved.value.open('update',row,{masterId:row.id},'auditing') |
|||
} |
|||
else if (val == 'revoke') { // 撤回 |
|||
handleCancel(row.id) |
|||
} |
|||
else if (val == 'delete') { |
|||
// 删除 |
|||
handleDelete(row.id) |
|||
} |
|||
} |
|||
|
|||
const isShowStatusButton = (row,val) => { |
|||
if (val.indexOf(row.status) > -1) { |
|||
return false |
|||
} else { |
|||
return true |
|||
} |
|||
} |
|||
|
|||
/** 添加/修改操作 */ |
|||
const openForm = async (type: string, row?: number) => { |
|||
tableData.value = [] // 重置明细数据 |
|||
formRef.value.open(type, row) |
|||
} |
|||
|
|||
/** 详情操作 */ |
|||
const detailRef = ref() |
|||
const openDetail = (row: any, titleName: any, titleValue: any) => { |
|||
detailRef.value.openDetail(row, titleName, titleValue, 'basicSparePartsApplyMain') |
|||
} |
|||
|
|||
/** 删除按钮操作 */ |
|||
const handleDelete = async (id: number) => { |
|||
try { |
|||
// 删除的二次确认 |
|||
await message.delConfirm() |
|||
// 发起删除 |
|||
await SparePartsInLocationMainApi.deleteSparePartsInLocationMain(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 SparePartsInLocationMainApi.exportSparePartsInLocationMain( |
|||
tableObject.params |
|||
) |
|||
download.excel(data, '备件申领记录主.xlsx') |
|||
} catch { |
|||
} finally { |
|||
exportLoading.value = false |
|||
} |
|||
} |
|||
|
|||
/** |
|||
* tableForm方法 |
|||
*/ |
|||
const tableFormKeys = {} |
|||
SparePartsInLocationDetail.allSchemas.tableFormColumns.forEach((item) => { |
|||
tableFormKeys[item.field] = item.default ? item.default : '' |
|||
}) |
|||
const tableData = ref([]) |
|||
|
|||
// 添加明细 |
|||
const handleAddTable = () => { |
|||
tableData.value.push(JSON.parse(JSON.stringify(tableFormKeys))) |
|||
} |
|||
// 删除明细 |
|||
const handleDeleteTable = (item, index) => { |
|||
tableData.value.splice(index, 1) |
|||
} |
|||
|
|||
// 主子数据 提交 |
|||
const submitForm = async (formType, data) => { |
|||
data.subList = tableData.value // 拼接子表数据参数 |
|||
console.log(formRef.value) |
|||
formRef.value.formLoading = true |
|||
try { |
|||
if (formType === 'create') { |
|||
await SparePartsInLocationMainApi.createSparePartsInLocationMain(data) |
|||
message.success(t('common.createSuccess')) |
|||
} else { |
|||
await SparePartsInLocationMainApi.updateSparePartsInLocationMain(data) |
|||
message.success(t('common.updateSuccess')) |
|||
} |
|||
formRef.value.dialogVisible = false |
|||
// 刷新当前列表 |
|||
getList() |
|||
} finally { |
|||
formRef.value.formLoading = 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 handleSubmitExamine = async (id: number) => { |
|||
await message.delConfirm(t('ts.是否提交审核?')); |
|||
try { |
|||
await SparePartsInLocationMainApi.submitExamineSparePartsInLocation(id) |
|||
message.success(t('ts.提交审批成功!')) |
|||
// 刷新列表 |
|||
await getList() |
|||
} catch {} |
|||
} |
|||
/** 撤回按钮操作 */ |
|||
const handleCancel = async (id: number) => { |
|||
await message.delConfirm(t('ts.是否撤回所选中数据?')); |
|||
try { |
|||
await SparePartsInLocationMainApi.cancelSparePartsInLocation(id) |
|||
message.success(t('ts.撤回成功')) |
|||
// 刷新列表 |
|||
await getList() |
|||
} catch {} |
|||
} |
|||
|
|||
//审核驳回按钮 |
|||
const handleRejecte=async(id: number)=> { |
|||
await message.delConfirm(t('ts.是否驳回所选中数据?')); |
|||
try { |
|||
await SparePartsInLocationMainApi.rejectSparePartsInLocation(id) |
|||
message.success(t('ts.驳回成功!')) |
|||
// 刷新列表 |
|||
await getList() |
|||
} catch {} |
|||
} |
|||
// 审核通过 |
|||
const approveSparePartsInLocation =async(formType,data)=> { |
|||
console.log(data) |
|||
try { |
|||
// const params = { |
|||
// id: |
|||
// } |
|||
await SparePartsInLocationMainApi.approveSparePartsInLocation(data) |
|||
message.success(t('ts.审核通过!')) |
|||
// 刷新列表 |
|||
await getList() |
|||
} catch {} |
|||
|
|||
|
|||
} |
|||
/** 初始化 **/ |
|||
onMounted(async () => { |
|||
getList() |
|||
importTemplateData.templateUrl = await SparePartsInLocationMainApi.importTemplate() |
|||
}) |
|||
</script> |
@ -0,0 +1,297 @@ |
|||
import type { CrudSchema } from '@/hooks/web/useCrudSchemas' |
|||
import { dateFormatter } from '@/utils/formatTime' |
|||
import * as LocationApi from '@/api/wms/location' |
|||
import { Location } from '@/views/wms/basicDataManage/factoryModeling/location/location.data' |
|||
import * as ItemAccountsApi from '@/api/eam/itemAccounts' |
|||
import { ItemAccounts } from '@/views/eam/itemAccounts/itemAccounts.data' |
|||
|
|||
|
|||
// 表单校验
|
|||
export const SparePartsInLocationMainRules = reactive({ |
|||
number: [required], |
|||
theme: [required], |
|||
type: [required], |
|||
}) |
|||
// 备件入库主表
|
|||
export const SparePartsInLocationMain = useCrudSchemas(reactive<CrudSchema[]>([ |
|||
{ |
|||
label: 'id', |
|||
field: 'id', |
|||
sort: 'custom', |
|||
isSearch: false, |
|||
isTable: false, |
|||
isForm: false, |
|||
isDetail:false, |
|||
}, |
|||
{ |
|||
label: '编号', |
|||
field: 'number', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
isForm: false, |
|||
}, |
|||
{ |
|||
label: '入库主题', |
|||
field: 'theme', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
},{ |
|||
label: '入库类型', |
|||
field: 'type', |
|||
sort: 'custom', |
|||
dictType: DICT_TYPE.PUT_IN_TYPE, |
|||
dictClass: 'string', |
|||
|
|||
}, |
|||
{ |
|||
label: '流程状态', |
|||
field: 'status', |
|||
sort: 'custom', |
|||
isSearch: false, |
|||
isForm:false, |
|||
|
|||
dictType: DICT_TYPE.SPAREPARTS_APPLY_STATUS_ENUM, |
|||
dictClass: 'string', |
|||
|
|||
}, |
|||
{ |
|||
label: '入库申请人', |
|||
field: 'applyer', |
|||
sort: 'custom', |
|||
isSearch: false, |
|||
}, |
|||
{ |
|||
label: '审核人', |
|||
field: 'approver', |
|||
sort: 'custom', |
|||
isSearch: false, |
|||
isForm:false |
|||
}, |
|||
{ |
|||
label: '审核内容', |
|||
field: 'approveContent', |
|||
sort: 'custom', |
|||
isSearch: false, |
|||
isForm:false |
|||
}, |
|||
{ |
|||
label: '审核时间', |
|||
field: 'approveTime', |
|||
sort: 'custom', |
|||
formatter: dateFormatter, |
|||
isSearch: false, |
|||
isForm: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' |
|||
} |
|||
}, |
|||
detail: { |
|||
dateFormat: 'YYYY-MM-DD HH:mm:ss' |
|||
}, |
|||
}, |
|||
{ |
|||
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, |
|||
detail: { |
|||
dateFormat: 'YYYY-MM-DD HH:mm:ss' |
|||
}, |
|||
}, |
|||
|
|||
|
|||
{ |
|||
label: '备注', |
|||
field: 'remark', |
|||
sort: 'custom', |
|||
isSearch: false, |
|||
}, |
|||
|
|||
{ |
|||
label: '操作', |
|||
field: 'action', |
|||
isForm: false, |
|||
table: { |
|||
width: 220, |
|||
fixed: 'right' |
|||
}, |
|||
isDetail:false |
|||
} |
|||
])) |
|||
// 备件入库子表
|
|||
export const SparePartsInLocationDetailRules = reactive({ |
|||
number: [required], |
|||
masterId: [required], |
|||
locationCode: [required], |
|||
areaCode: [required], |
|||
sparePartsCode: [required], |
|||
applyQty: [required], |
|||
}) |
|||
|
|||
export const SparePartsInLocationDetail = useCrudSchemas(reactive<CrudSchema[]>([ |
|||
{ |
|||
label: '库位编号', |
|||
field: 'locationCode', |
|||
sort: 'custom', |
|||
isSearch: false, |
|||
form: { |
|||
componentProps: { |
|||
isSearchList: true, // 开启查询弹窗
|
|||
searchListPlaceholder: '请选择库位编号', // 输入框占位文本
|
|||
searchField: 'code', // 查询弹窗赋值字段
|
|||
searchTitle: '库位信息', // 查询弹窗标题
|
|||
searchAllSchemas: Location.allSchemas, // 查询弹窗所需类
|
|||
searchPage: LocationApi.getLocationPage, // 查询弹窗所需分页方法
|
|||
searchCondition: [ |
|||
{ |
|||
key: 'available', |
|||
value: 'TRUE', |
|||
isMainValue: false |
|||
} |
|||
] |
|||
} |
|||
}, |
|||
tableForm: { |
|||
// isInpuFocusShow: true,
|
|||
// searchListPlaceholder: '请选择备件编号', // 输入框占位文本
|
|||
// searchField: 'itemNumber', // 查询弹窗赋值字段
|
|||
// searchTitle: '备件信息', // 查询弹窗标题
|
|||
// searchAllSchemas: Location.allSchemas, // 查询弹窗所需类
|
|||
// searchPage: LocationApi.getLocationPage, // 查询弹窗所需分页方法
|
|||
// searchCondition: [
|
|||
// {
|
|||
// key: 'available',
|
|||
// value: 'TRUE',
|
|||
// isMainValue: false
|
|||
// }
|
|||
// ]
|
|||
} |
|||
}, |
|||
{ |
|||
label: '库区编号', |
|||
field: 'areaCode', |
|||
sort: 'custom', |
|||
isSearch: false, |
|||
form: { |
|||
componentProps: { |
|||
disabled: true |
|||
} |
|||
}, |
|||
tableForm:{ |
|||
// disabled: true
|
|||
} |
|||
}, |
|||
{ |
|||
label: '备件编号', |
|||
field: 'sparePartsCode', |
|||
sort: 'custom', |
|||
table: { |
|||
width: 150 |
|||
}, |
|||
form: { |
|||
componentProps: { |
|||
disabled: true |
|||
} |
|||
}, |
|||
tableForm:{ |
|||
// disabled: true
|
|||
} |
|||
}, |
|||
{ |
|||
label: '库存数量', |
|||
field: 'currentQty', |
|||
sort: 'custom', |
|||
isSearch: false, |
|||
tableForm: { |
|||
disabled: true |
|||
}, |
|||
form:{ |
|||
componentProps:{ |
|||
disabled: true |
|||
} |
|||
}, |
|||
isDetail:false, |
|||
isTable:false |
|||
}, |
|||
{ |
|||
label: '申领数量', |
|||
field: 'applyQty', |
|||
sort: 'custom', |
|||
isSearch: false |
|||
}, |
|||
{ |
|||
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, |
|||
isTableForm:false |
|||
}, |
|||
{ |
|||
label: '备注', |
|||
field: 'remark', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
}, |
|||
{ |
|||
label: '操作', |
|||
field: 'action', |
|||
isForm: false, |
|||
table: { |
|||
width: 150, |
|||
fixed: 'right' |
|||
}, |
|||
isTableForm:false, |
|||
isTable:false |
|||
} |
|||
])) |
|||
export const SparePartsInLocationExamineRules = reactive({ |
|||
approver: [required], |
|||
approveContent: [required], |
|||
sparePartsCode: [required], |
|||
}) |
|||
// 审核完成字段
|
|||
export const SparePartsInLocationExamine = useCrudSchemas(reactive<CrudSchema[]>([ |
|||
{ |
|||
label: '审核内容', |
|||
field: 'approveContent', |
|||
sort: 'custom', |
|||
isSearch: false, |
|||
form:{ |
|||
componentProps:{ |
|||
|
|||
} |
|||
} |
|||
}, |
|||
])) |
|||
|
Some files were not shown because too many files changed in this diff
Loading…
Reference in new issue