ljlong_2630
8 months ago
76 changed files with 11353 additions and 443 deletions
@ -0,0 +1,56 @@ |
|||||
|
import request from '@/config/axios' |
||||
|
|
||||
|
export interface AbilityInfoVO { |
||||
|
deleteTime: Date |
||||
|
id: number |
||||
|
status: string |
||||
|
concurrencyStamp: number |
||||
|
remark: string |
||||
|
deleter: string |
||||
|
siteId: number |
||||
|
ablityCode: string |
||||
|
ablityName: string |
||||
|
trainMinHours: number |
||||
|
operMinHours: number |
||||
|
} |
||||
|
|
||||
|
// 查询能力矩阵信息列表
|
||||
|
export const getAbilityInfoPage = async (params) => { |
||||
|
if (params.isSearch) { |
||||
|
delete params.isSearch |
||||
|
const data = {...params} |
||||
|
return await request.post({ url: '/mes/ability-info/senior', data }) |
||||
|
} else { |
||||
|
return await request.get({ url: `/mes/ability-info/page`, params }) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// 查询能力矩阵信息详情
|
||||
|
export const getAbilityInfo = async (id: number) => { |
||||
|
return await request.get({ url: `/mes/ability-info/get?id=` + id }) |
||||
|
} |
||||
|
|
||||
|
// 新增能力矩阵信息
|
||||
|
export const createAbilityInfo = async (data: AbilityInfoVO) => { |
||||
|
return await request.post({ url: `/mes/ability-info/create`, data }) |
||||
|
} |
||||
|
|
||||
|
// 修改能力矩阵信息
|
||||
|
export const updateAbilityInfo = async (data: AbilityInfoVO) => { |
||||
|
return await request.put({ url: `/mes/ability-info/update`, data }) |
||||
|
} |
||||
|
|
||||
|
// 删除能力矩阵信息
|
||||
|
export const deleteAbilityInfo = async (id: number) => { |
||||
|
return await request.delete({ url: `/mes/ability-info/delete?id=` + id }) |
||||
|
} |
||||
|
|
||||
|
// 导出能力矩阵信息 Excel
|
||||
|
export const exportAbilityInfo = async (params) => { |
||||
|
return await request.download({ url: `/mes/ability-info/export-excel`, params }) |
||||
|
} |
||||
|
|
||||
|
// 下载用户导入模板
|
||||
|
export const importTemplate = () => { |
||||
|
return request.download({ url: '/mes/ability-info/get-import-template' }) |
||||
|
} |
@ -0,0 +1,58 @@ |
|||||
|
import request from '@/config/axios' |
||||
|
|
||||
|
export interface HrPersonAbilityVO { |
||||
|
deleteTime: Date |
||||
|
id: number |
||||
|
status: string |
||||
|
concurrencyStamp: number |
||||
|
remark: string |
||||
|
deleter: string |
||||
|
siteId: number |
||||
|
personId: number |
||||
|
personCode: string |
||||
|
ablityCode: string |
||||
|
ablityLevel: number |
||||
|
studyDuration: number |
||||
|
workDuration: number |
||||
|
} |
||||
|
|
||||
|
// 查询人员能力矩阵配置列表
|
||||
|
export const getHrPersonAbilityPage = async (params) => { |
||||
|
if (params.isSearch) { |
||||
|
delete params.isSearch |
||||
|
const data = {...params} |
||||
|
return await request.post({ url: '/mes/hr-person-ability/senior', data }) |
||||
|
} else { |
||||
|
return await request.get({ url: `/mes/hr-person-ability/page`, params }) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// 查询人员能力矩阵配置详情
|
||||
|
export const getHrPersonAbility = async (id: number) => { |
||||
|
return await request.get({ url: `/mes/hr-person-ability/get?id=` + id }) |
||||
|
} |
||||
|
|
||||
|
// 新增人员能力矩阵配置
|
||||
|
export const createHrPersonAbility = async (data: HrPersonAbilityVO) => { |
||||
|
return await request.post({ url: `/mes/hr-person-ability/create`, data }) |
||||
|
} |
||||
|
|
||||
|
// 修改人员能力矩阵配置
|
||||
|
export const updateHrPersonAbility = async (data: HrPersonAbilityVO) => { |
||||
|
return await request.put({ url: `/mes/hr-person-ability/update`, data }) |
||||
|
} |
||||
|
|
||||
|
// 删除人员能力矩阵配置
|
||||
|
export const deleteHrPersonAbility = async (id: number) => { |
||||
|
return await request.delete({ url: `/mes/hr-person-ability/delete?id=` + id }) |
||||
|
} |
||||
|
|
||||
|
// 导出人员能力矩阵配置 Excel
|
||||
|
export const exportHrPersonAbility = async (params) => { |
||||
|
return await request.download({ url: `/mes/hr-person-ability/export-excel`, params }) |
||||
|
} |
||||
|
|
||||
|
// 下载用户导入模板
|
||||
|
export const importTemplate = () => { |
||||
|
return request.download({ url: '/mes/hr-person-ability/get-import-template' }) |
||||
|
} |
@ -0,0 +1,61 @@ |
|||||
|
import request from '@/config/axios' |
||||
|
|
||||
|
export interface ItemVO { |
||||
|
deleteTime: Date |
||||
|
id: number |
||||
|
status: string |
||||
|
concurrencyStamp: number |
||||
|
remark: string |
||||
|
deleter: string |
||||
|
siteId: number |
||||
|
itemCode: string |
||||
|
itemName: string |
||||
|
itemType: string |
||||
|
qmsClass: string |
||||
|
dataType: string |
||||
|
dataVerify: string |
||||
|
dataStandvalue: string |
||||
|
dataDescripe: string |
||||
|
} |
||||
|
|
||||
|
// 查询质检项目定义列表
|
||||
|
export const getItemPage = async (params) => { |
||||
|
console.log(params); |
||||
|
if (params.isSearch) { |
||||
|
delete params.isSearch |
||||
|
const data = {...params} |
||||
|
return await request.post({ url: '/mes/item/senior', data }) |
||||
|
} else { |
||||
|
return await request.get({ url: `/mes/item/page`, params }) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// 查询质检项目定义详情
|
||||
|
export const getItem = async (id: number) => { |
||||
|
return await request.get({ url: `/mes/item/get?id=` + id }) |
||||
|
} |
||||
|
|
||||
|
// 新增质检项目定义
|
||||
|
export const createItem = async (data: ItemVO) => { |
||||
|
return await request.post({ url: `/mes/item/create`, data }) |
||||
|
} |
||||
|
|
||||
|
// 修改质检项目定义
|
||||
|
export const updateItem = async (data: ItemVO) => { |
||||
|
return await request.put({ url: `/mes/item/update`, data }) |
||||
|
} |
||||
|
|
||||
|
// 删除质检项目定义
|
||||
|
export const deleteItem = async (id: number) => { |
||||
|
return await request.delete({ url: `/mes/item/delete?id=` + id }) |
||||
|
} |
||||
|
|
||||
|
// 导出质检项目定义 Excel
|
||||
|
export const exportItem = async (params) => { |
||||
|
return await request.download({ url: `/mes/item/export-excel`, params }) |
||||
|
} |
||||
|
|
||||
|
// 下载用户导入模板
|
||||
|
export const importTemplate = () => { |
||||
|
return request.download({ url: '/mes/item/get-import-template' }) |
||||
|
} |
@ -0,0 +1,55 @@ |
|||||
|
import request from '@/config/axios' |
||||
|
|
||||
|
export interface OperstepsVO { |
||||
|
deleteTime: Date |
||||
|
id: number |
||||
|
status: string |
||||
|
concurrencyStamp: number |
||||
|
remark: string |
||||
|
deleter: string |
||||
|
siteId: number |
||||
|
stepsCode: string |
||||
|
stepsName: string |
||||
|
collectCode: string |
||||
|
} |
||||
|
|
||||
|
// 查询MES操作步骤信息列表
|
||||
|
export const getOperstepsPage = async (params) => { |
||||
|
if (params.isSearch) { |
||||
|
delete params.isSearch |
||||
|
const data = {...params} |
||||
|
return await request.post({ url: '/mes/opersteps/senior', data }) |
||||
|
} else { |
||||
|
return await request.get({ url: `/mes/opersteps/page`, params }) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// 查询MES操作步骤信息详情
|
||||
|
export const getOpersteps = async (id: number) => { |
||||
|
return await request.get({ url: `/mes/opersteps/get?id=` + id }) |
||||
|
} |
||||
|
|
||||
|
// 新增MES操作步骤信息
|
||||
|
export const createOpersteps = async (data: OperstepsVO) => { |
||||
|
return await request.post({ url: `/mes/opersteps/create`, data }) |
||||
|
} |
||||
|
|
||||
|
// 修改MES操作步骤信息
|
||||
|
export const updateOpersteps = async (data: OperstepsVO) => { |
||||
|
return await request.put({ url: `/mes/opersteps/update`, data }) |
||||
|
} |
||||
|
|
||||
|
// 删除MES操作步骤信息
|
||||
|
export const deleteOpersteps = async (id: number) => { |
||||
|
return await request.delete({ url: `/mes/opersteps/delete?id=` + id }) |
||||
|
} |
||||
|
|
||||
|
// 导出MES操作步骤信息 Excel
|
||||
|
export const exportOpersteps = async (params) => { |
||||
|
return await request.download({ url: `/mes/opersteps/export-excel`, params }) |
||||
|
} |
||||
|
|
||||
|
// 下载用户导入模板
|
||||
|
export const importTemplate = () => { |
||||
|
return request.download({ url: '/mes/opersteps/get-import-template' }) |
||||
|
} |
@ -0,0 +1,57 @@ |
|||||
|
import request from '@/config/axios' |
||||
|
|
||||
|
export interface OperstepsTypeVO { |
||||
|
collectCode: string |
||||
|
collectName: string |
||||
|
collectType: string |
||||
|
adpaterClass: string |
||||
|
argLsit: string |
||||
|
deleteTime: Date |
||||
|
id: number |
||||
|
status: string |
||||
|
concurrencyStamp: number |
||||
|
remark: string |
||||
|
deleter: string |
||||
|
siteId: number |
||||
|
} |
||||
|
|
||||
|
// 查询操作步骤类型配置列表
|
||||
|
export const getOperstepsTypePage = async (params) => { |
||||
|
if (params.isSearch) { |
||||
|
delete params.isSearch |
||||
|
const data = {...params} |
||||
|
return await request.post({ url: '/mes/opersteps-type/senior', data }) |
||||
|
} else { |
||||
|
return await request.get({ url: `/mes/opersteps-type/page`, params }) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// 查询操作步骤类型配置详情
|
||||
|
export const getOperstepsType = async (id: number) => { |
||||
|
return await request.get({ url: `/mes/opersteps-type/get?id=` + id }) |
||||
|
} |
||||
|
|
||||
|
// 新增操作步骤类型配置
|
||||
|
export const createOperstepsType = async (data: OperstepsTypeVO) => { |
||||
|
return await request.post({ url: `/mes/opersteps-type/create`, data }) |
||||
|
} |
||||
|
|
||||
|
// 修改操作步骤类型配置
|
||||
|
export const updateOperstepsType = async (data: OperstepsTypeVO) => { |
||||
|
return await request.put({ url: `/mes/opersteps-type/update`, data }) |
||||
|
} |
||||
|
|
||||
|
// 删除操作步骤类型配置
|
||||
|
export const deleteOperstepsType = async (id: number) => { |
||||
|
return await request.delete({ url: `/mes/opersteps-type/delete?id=` + id }) |
||||
|
} |
||||
|
|
||||
|
// 导出操作步骤类型配置 Excel
|
||||
|
export const exportOperstepsType = async (params) => { |
||||
|
return await request.download({ url: `/mes/opersteps-type/export-excel`, params }) |
||||
|
} |
||||
|
|
||||
|
// 下载用户导入模板
|
||||
|
export const importTemplate = () => { |
||||
|
return request.download({ url: '/mes/opersteps-type/get-import-template' }) |
||||
|
} |
@ -0,0 +1,102 @@ |
|||||
|
import request from '@/config/axios' |
||||
|
|
||||
|
export interface OrderDayVO { |
||||
|
status: string |
||||
|
remark: string |
||||
|
planNoMonth: string |
||||
|
planNoDay: string |
||||
|
productCode: string |
||||
|
workroomCode: string |
||||
|
lineCode: string |
||||
|
planCount: number |
||||
|
processrouteCode: string |
||||
|
tempProcessroute: string |
||||
|
standardBom: string |
||||
|
tempBom: string |
||||
|
workMode: string |
||||
|
planDate: Date |
||||
|
startTime: Date |
||||
|
endTime: Date |
||||
|
taskMode: string |
||||
|
} |
||||
|
|
||||
|
// 查询生产日计划列表
|
||||
|
export const getOrderDayPage = async (params) => { |
||||
|
if (params.isSearch) { |
||||
|
delete params.isSearch |
||||
|
const data = {...params} |
||||
|
return await request.post({ url: '/mes/orderday/senior', data }) |
||||
|
} else { |
||||
|
return await request.get({ url: `/mes/orderday/page`, params }) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// 查询生产日计划详情
|
||||
|
export const getOrderDay = async (id: number) => { |
||||
|
return await request.get({ url: `/mes/orderday/get?id=` + id }) |
||||
|
} |
||||
|
|
||||
|
// 新增生产日计划
|
||||
|
export const createOrderDay = async (data: OrderDayVO) => { |
||||
|
return await request.post({ url: `/mes/orderday/create`, data }) |
||||
|
} |
||||
|
|
||||
|
// 修改生产日计划
|
||||
|
export const updateOrderDay = async (data: OrderDayVO) => { |
||||
|
return await request.put({ url: `/mes/orderday/update`, data }) |
||||
|
} |
||||
|
|
||||
|
// 删除生产日计划
|
||||
|
export const deleteOrderDay = async (id: number) => { |
||||
|
return await request.delete({ url: `/mes/orderday/delete?id=` + id }) |
||||
|
} |
||||
|
|
||||
|
// 导出生产日计划 Excel
|
||||
|
export const exportOrderDay = async (params) => { |
||||
|
return await request.download({ url: `/mes/orderday/export-excel`, params }) |
||||
|
} |
||||
|
// 下载用户导入模板
|
||||
|
export const importTemplate = () => { |
||||
|
return request.download({ url: '/mes/orderday/get-import-template' }) |
||||
|
} |
||||
|
// 根据产品编码获取Bom
|
||||
|
export const getBoms = async (code: String) => { |
||||
|
return request.get({ url: '/mes/common/geBomByProductCode?code='+code }) |
||||
|
} |
||||
|
// 根据产品编码获取工艺路线
|
||||
|
export const getProcessroutes = async (code: String) => { |
||||
|
return request.get({ url: '/mes/common/getProcessRouteByProductCode?code='+code }) |
||||
|
} |
||||
|
// 根据车间编码获取产线列表
|
||||
|
export const getProductlines = async (code: String) => { |
||||
|
return request.get({ url: '/mes/common/getLinesByWorkRoomCode?code='+code }) |
||||
|
} |
||||
|
// 获取产线信息
|
||||
|
export const getProductlineInfo = async (code: String) => { |
||||
|
return request.get({ url: '/mes/common/getLinesByWorkRoomCode?code='+code }) |
||||
|
} |
||||
|
// 根据工艺路线的工序信息
|
||||
|
export const getProcessroutesDetail = async (code) => { |
||||
|
return await request.get({ url: `/mes/orderday/getProcessInfo?code=`+ code }) |
||||
|
} |
||||
|
// 根据获取计划BOM信息
|
||||
|
export const getPlanBom = async (params) => { |
||||
|
return await request.get({ url: `/mes/orderday/getBomInfo`,params }) |
||||
|
} |
||||
|
// 根据计划的车间、产线、计划时间 查询已经配置的人员
|
||||
|
export const getPlanWorks = async (params) => { |
||||
|
return await request.get({ url: `/mes/orderday/getWorkGroup`,params }) |
||||
|
} |
||||
|
// 根据车间、产线 查询已配置的设备
|
||||
|
export const getPlanDevices = async (params) => { |
||||
|
return await request.get({ url: `/mes/orderday/getDeviceInfo`,params }) |
||||
|
} |
||||
|
|
||||
|
///发布计划
|
||||
|
export const publishPlan = async (params) => { |
||||
|
return await request.post({ url: `/mes/orderday/publishPlan`,params }) |
||||
|
} |
||||
|
//终止计划
|
||||
|
export const stopPlan = async (params) => { |
||||
|
return await request.post({ url: `/mes/orderday/stopPlan`,params }) |
||||
|
} |
@ -0,0 +1,55 @@ |
|||||
|
import request from '@/config/axios' |
||||
|
|
||||
|
export interface QualityclassVO { |
||||
|
deleteTime: Date |
||||
|
id: number |
||||
|
status: string |
||||
|
concurrencyStamp: number |
||||
|
remark: string |
||||
|
deleter: string |
||||
|
siteId: number |
||||
|
code: string |
||||
|
name: string |
||||
|
groupCode: string |
||||
|
} |
||||
|
|
||||
|
// 查询质检类别列表
|
||||
|
export const getQualityclassPage = async (params) => { |
||||
|
if (params.isSearch) { |
||||
|
delete params.isSearch |
||||
|
const data = {...params} |
||||
|
return await request.post({ url: '/mes/qualityclass/senior', data }) |
||||
|
} else { |
||||
|
return await request.get({ url: `/mes/qualityclass/page`, params }) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// 查询质检类别详情
|
||||
|
export const getQualityclass = async (id: number) => { |
||||
|
return await request.get({ url: `/mes/qualityclass/get?id=` + id }) |
||||
|
} |
||||
|
|
||||
|
// 新增质检类别
|
||||
|
export const createQualityclass = async (data: QualityclassVO) => { |
||||
|
return await request.post({ url: `/mes/qualityclass/create`, data }) |
||||
|
} |
||||
|
|
||||
|
// 修改质检类别
|
||||
|
export const updateQualityclass = async (data: QualityclassVO) => { |
||||
|
return await request.put({ url: `/mes/qualityclass/update`, data }) |
||||
|
} |
||||
|
|
||||
|
// 删除质检类别
|
||||
|
export const deleteQualityclass = async (id: number) => { |
||||
|
return await request.delete({ url: `/mes/qualityclass/delete?id=` + id }) |
||||
|
} |
||||
|
|
||||
|
// 导出质检类别 Excel
|
||||
|
export const exportQualityclass = async (params) => { |
||||
|
return await request.download({ url: `/mes/qualityclass/export-excel`, params }) |
||||
|
} |
||||
|
|
||||
|
// 下载用户导入模板
|
||||
|
export const importTemplate = () => { |
||||
|
return request.download({ url: '/mes/qualityclass/get-import-template' }) |
||||
|
} |
@ -0,0 +1,55 @@ |
|||||
|
import request from '@/config/axios' |
||||
|
|
||||
|
export interface QualityformVO { |
||||
|
deleteTime: Date |
||||
|
id: number |
||||
|
status: string |
||||
|
concurrencyStamp: number |
||||
|
remark: string |
||||
|
deleter: string |
||||
|
siteId: number |
||||
|
formNo: string |
||||
|
formName: string |
||||
|
formType: string |
||||
|
} |
||||
|
|
||||
|
// 查询质检表单列表
|
||||
|
export const getQualityformPage = async (params) => { |
||||
|
if (params.isSearch) { |
||||
|
delete params.isSearch |
||||
|
const data = {...params} |
||||
|
return await request.post({ url: '/mes/qualityform/senior', data }) |
||||
|
} else { |
||||
|
return await request.get({ url: `/mes/qualityform/page`, params }) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// 查询质检表单详情
|
||||
|
export const getQualityform = async (id: number) => { |
||||
|
return await request.get({ url: `/mes/qualityform/get?id=` + id }) |
||||
|
} |
||||
|
|
||||
|
// 新增质检表单
|
||||
|
export const createQualityform = async (data: QualityformVO) => { |
||||
|
return await request.post({ url: `/mes/qualityform/create`, data }) |
||||
|
} |
||||
|
|
||||
|
// 修改质检表单
|
||||
|
export const updateQualityform = async (data: QualityformVO) => { |
||||
|
return await request.put({ url: `/mes/qualityform/update`, data }) |
||||
|
} |
||||
|
|
||||
|
// 删除质检表单
|
||||
|
export const deleteQualityform = async (id: number) => { |
||||
|
return await request.delete({ url: `/mes/qualityform/delete?id=` + id }) |
||||
|
} |
||||
|
|
||||
|
// 导出质检表单 Excel
|
||||
|
export const exportQualityform = async (params) => { |
||||
|
return await request.download({ url: `/mes/qualityform/export-excel`, params }) |
||||
|
} |
||||
|
|
||||
|
// 下载用户导入模板
|
||||
|
export const importTemplate = () => { |
||||
|
return request.download({ url: '/mes/qualityform/get-import-template' }) |
||||
|
} |
@ -0,0 +1,61 @@ |
|||||
|
import request from '@/config/axios' |
||||
|
|
||||
|
export interface QualityformdetailVO { |
||||
|
deleteTime: Date |
||||
|
id: number |
||||
|
status: string |
||||
|
concurrencyStamp: number |
||||
|
remark: string |
||||
|
deleter: string |
||||
|
siteId: number |
||||
|
formNo: string |
||||
|
itemCode: string |
||||
|
itemName: string |
||||
|
itemType: string |
||||
|
qmsClass: string |
||||
|
dataType: string |
||||
|
dataVerify: string |
||||
|
dataStandvalue: string |
||||
|
dataDescripe: string |
||||
|
} |
||||
|
|
||||
|
// 查询质检表单子表列表
|
||||
|
export const getQualityformdetailPage = async (params) => { |
||||
|
if (params.isSearch) { |
||||
|
delete params.isSearch |
||||
|
const data = {...params} |
||||
|
return await request.post({ url: '/mes/qualityformdetail/senior', data }) |
||||
|
} else { |
||||
|
return await request.get({ url: `/mes/qualityformdetail/page`, params }) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// 查询质检表单子表详情
|
||||
|
export const getQualityformdetail = async (id: number) => { |
||||
|
return await request.get({ url: `/mes/qualityformdetail/get?id=` + id }) |
||||
|
} |
||||
|
|
||||
|
// 新增质检表单子表
|
||||
|
export const createQualityformdetail = async (data: QualityformdetailVO) => { |
||||
|
return await request.post({ url: `/mes/qualityformdetail/create`, data }) |
||||
|
} |
||||
|
|
||||
|
// 修改质检表单子表
|
||||
|
export const updateQualityformdetail = async (data: QualityformdetailVO) => { |
||||
|
return await request.put({ url: `/mes/qualityformdetail/update`, data }) |
||||
|
} |
||||
|
|
||||
|
// 删除质检表单子表
|
||||
|
export const deleteQualityformdetail = async (id: number) => { |
||||
|
return await request.delete({ url: `/mes/qualityformdetail/delete?id=` + id }) |
||||
|
} |
||||
|
|
||||
|
// 导出质检表单子表 Excel
|
||||
|
export const exportQualityformdetail = async (params) => { |
||||
|
return await request.download({ url: `/mes/qualityformdetail/export-excel`, params }) |
||||
|
} |
||||
|
|
||||
|
// 下载用户导入模板
|
||||
|
export const importTemplate = () => { |
||||
|
return request.download({ url: '/mes/qualityformdetail/get-import-template' }) |
||||
|
} |
@ -0,0 +1,58 @@ |
|||||
|
import request from '@/config/axios' |
||||
|
|
||||
|
export interface QualityformlogVO { |
||||
|
deleteTime: Date |
||||
|
id: number |
||||
|
status: string |
||||
|
concurrencyStamp: number |
||||
|
remark: string |
||||
|
deleter: string |
||||
|
siteId: number |
||||
|
masterId: number |
||||
|
formNo: string |
||||
|
operation: string |
||||
|
operator: string |
||||
|
operateContent: string |
||||
|
operateTime: Date |
||||
|
} |
||||
|
|
||||
|
// 查询质检表单日志列表
|
||||
|
export const getQualityformlogPage = async (params) => { |
||||
|
if (params.isSearch) { |
||||
|
delete params.isSearch |
||||
|
const data = {...params} |
||||
|
return await request.post({ url: '/mes/qualityformlog/senior', data }) |
||||
|
} else { |
||||
|
return await request.get({ url: `/mes/qualityformlog/page`, params }) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// 查询质检表单日志详情
|
||||
|
export const getQualityformlog = async (id: number) => { |
||||
|
return await request.get({ url: `/mes/qualityformlog/get?id=` + id }) |
||||
|
} |
||||
|
|
||||
|
// 新增质检表单日志
|
||||
|
export const createQualityformlog = async (data: QualityformlogVO) => { |
||||
|
return await request.post({ url: `/mes/qualityformlog/create`, data }) |
||||
|
} |
||||
|
|
||||
|
// 修改质检表单日志
|
||||
|
export const updateQualityformlog = async (data: QualityformlogVO) => { |
||||
|
return await request.put({ url: `/mes/qualityformlog/update`, data }) |
||||
|
} |
||||
|
|
||||
|
// 删除质检表单日志
|
||||
|
export const deleteQualityformlog = async (id: number) => { |
||||
|
return await request.delete({ url: `/mes/qualityformlog/delete?id=` + id }) |
||||
|
} |
||||
|
|
||||
|
// 导出质检表单日志 Excel
|
||||
|
export const exportQualityformlog = async (params) => { |
||||
|
return await request.download({ url: `/mes/qualityformlog/export-excel`, params }) |
||||
|
} |
||||
|
|
||||
|
// 下载用户导入模板
|
||||
|
export const importTemplate = () => { |
||||
|
return request.download({ url: '/mes/qualityformlog/get-import-template' }) |
||||
|
} |
@ -0,0 +1,55 @@ |
|||||
|
import request from '@/config/axios' |
||||
|
|
||||
|
export interface QualitygroupVO { |
||||
|
deleteTime: Date |
||||
|
id: number |
||||
|
status: string |
||||
|
concurrencyStamp: number |
||||
|
remark: string |
||||
|
deleter: string |
||||
|
siteId: number |
||||
|
code: string |
||||
|
name: string |
||||
|
groupCode: string |
||||
|
} |
||||
|
|
||||
|
// 查询质检分组列表
|
||||
|
export const getQualitygroupPage = async (params) => { |
||||
|
if (params.isSearch) { |
||||
|
delete params.isSearch |
||||
|
const data = {...params} |
||||
|
return await request.post({ url: '/mes/qualitygroup/senior', data }) |
||||
|
} else { |
||||
|
return await request.get({ url: `/mes/qualitygroup/page`, params }) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// 查询质检分组详情
|
||||
|
export const getQualitygroup = async (id: number) => { |
||||
|
return await request.get({ url: `/mes/qualitygroup/get?id=` + id }) |
||||
|
} |
||||
|
|
||||
|
// 新增质检分组
|
||||
|
export const createQualitygroup = async (data: QualitygroupVO) => { |
||||
|
return await request.post({ url: `/mes/qualitygroup/create`, data }) |
||||
|
} |
||||
|
|
||||
|
// 修改质检分组
|
||||
|
export const updateQualitygroup = async (data: QualitygroupVO) => { |
||||
|
return await request.put({ url: `/mes/qualitygroup/update`, data }) |
||||
|
} |
||||
|
|
||||
|
// 删除质检分组
|
||||
|
export const deleteQualitygroup = async (id: number) => { |
||||
|
return await request.delete({ url: `/mes/qualitygroup/delete?id=` + id }) |
||||
|
} |
||||
|
|
||||
|
// 导出质检分组 Excel
|
||||
|
export const exportQualitygroup = async (params) => { |
||||
|
return await request.download({ url: `/mes/qualitygroup/export-excel`, params }) |
||||
|
} |
||||
|
|
||||
|
// 下载用户导入模板
|
||||
|
export const importTemplate = () => { |
||||
|
return request.download({ url: '/mes/qualitygroup/get-import-template' }) |
||||
|
} |
@ -0,0 +1,60 @@ |
|||||
|
import request from '@/config/axios' |
||||
|
|
||||
|
export interface ReworkSingleVO { |
||||
|
deleteTime: Date |
||||
|
id: number |
||||
|
status: string |
||||
|
concurrencyStamp: number |
||||
|
remark: string |
||||
|
deleter: string |
||||
|
siteId: number |
||||
|
reworkType: string |
||||
|
productionCode: string |
||||
|
reworkAction: string |
||||
|
replaceFlag: string |
||||
|
reworkPersoncode: string |
||||
|
reworkTime: Date |
||||
|
reworkResult: string |
||||
|
reworkbillNo: string |
||||
|
} |
||||
|
|
||||
|
// 查询返工登记单件列表
|
||||
|
export const getReworkSinglePage = async (params) => { |
||||
|
if (params.isSearch) { |
||||
|
delete params.isSearch |
||||
|
const data = {...params} |
||||
|
return await request.post({ url: '/mes/rework-single/senior', data }) |
||||
|
} else { |
||||
|
return await request.get({ url: `/mes/rework-single/page`, params }) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// 查询返工登记单件详情
|
||||
|
export const getReworkSingle = async (id: number) => { |
||||
|
return await request.get({ url: `/mes/rework-single/get?id=` + id }) |
||||
|
} |
||||
|
|
||||
|
// 新增返工登记单件
|
||||
|
export const createReworkSingle = async (data: ReworkSingleVO) => { |
||||
|
return await request.post({ url: `/mes/rework-single/create`, data }) |
||||
|
} |
||||
|
|
||||
|
// 修改返工登记单件
|
||||
|
export const updateReworkSingle = async (data: ReworkSingleVO) => { |
||||
|
return await request.put({ url: `/mes/rework-single/update`, data }) |
||||
|
} |
||||
|
|
||||
|
// 删除返工登记单件
|
||||
|
export const deleteReworkSingle = async (id: number) => { |
||||
|
return await request.delete({ url: `/mes/rework-single/delete?id=` + id }) |
||||
|
} |
||||
|
|
||||
|
// 导出返工登记单件 Excel
|
||||
|
export const exportReworkSingle = async (params) => { |
||||
|
return await request.download({ url: `/mes/rework-single/export-excel`, params }) |
||||
|
} |
||||
|
|
||||
|
// 下载用户导入模板
|
||||
|
export const importTemplate = () => { |
||||
|
return request.download({ url: '/mes/rework-single/get-import-template' }) |
||||
|
} |
@ -0,0 +1,103 @@ |
|||||
|
import request from '@/config/axios' |
||||
|
|
||||
|
export interface AqlVO { |
||||
|
id: number |
||||
|
sampleProgCode: string |
||||
|
inspectionQualification: string |
||||
|
sampleCharacterCode: string |
||||
|
sampleSize: number |
||||
|
a0010: number |
||||
|
r0010: number |
||||
|
a0015: number |
||||
|
r0015: number |
||||
|
a0025: number |
||||
|
r0025: number |
||||
|
a0040: number |
||||
|
r0040: number |
||||
|
a0065: number |
||||
|
r0065: number |
||||
|
a010: number |
||||
|
r010: number |
||||
|
a015: number |
||||
|
r015: number |
||||
|
a025: number |
||||
|
r025: number |
||||
|
a040: number |
||||
|
r040: number |
||||
|
a065: number |
||||
|
r065: number |
||||
|
a10: number |
||||
|
r10: number |
||||
|
a15: number |
||||
|
r15: number |
||||
|
a25: number |
||||
|
r25: number |
||||
|
a40: number |
||||
|
r40: number |
||||
|
a65: number |
||||
|
r65: number |
||||
|
a10: number |
||||
|
r10: number |
||||
|
a15: number |
||||
|
r15: number |
||||
|
a25: number |
||||
|
r25: number |
||||
|
a40: number |
||||
|
r40: number |
||||
|
a65: number |
||||
|
r65: number |
||||
|
a100: number |
||||
|
r100: number |
||||
|
a150: number |
||||
|
r150: number |
||||
|
a250: number |
||||
|
r250: number |
||||
|
a400: number |
||||
|
r400: number |
||||
|
a650: number |
||||
|
r650: number |
||||
|
a1000: number |
||||
|
r1000: number |
||||
|
available: string |
||||
|
} |
||||
|
|
||||
|
// 查询aql列表
|
||||
|
export const getAqlPage = async (params) => { |
||||
|
if (params.isSearch) { |
||||
|
delete params.isSearch |
||||
|
const data = {...params} |
||||
|
return await request.post({ url: '/qms/aql/senior', data }) |
||||
|
} else { |
||||
|
return await request.get({ url: `/qms/aql/page`, params }) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// 查询aql详情
|
||||
|
export const getAql = async (id: number) => { |
||||
|
return await request.get({ url: `/qms/aql/get?id=` + id }) |
||||
|
} |
||||
|
|
||||
|
// 新增aql
|
||||
|
export const createAql = async (data: AqlVO) => { |
||||
|
return await request.post({ url: `/qms/aql/create`, data }) |
||||
|
} |
||||
|
|
||||
|
// 修改aql
|
||||
|
export const updateAql = async (data: AqlVO) => { |
||||
|
return await request.put({ url: `/qms/aql/update`, data }) |
||||
|
} |
||||
|
|
||||
|
// 删除aql
|
||||
|
export const deleteAql = async (id: number) => { |
||||
|
return await request.delete({ url: `/qms/aql/delete?id=` + id }) |
||||
|
} |
||||
|
|
||||
|
// 导出aql Excel
|
||||
|
export const exportAql = async (params) => { |
||||
|
return await request.download({ url: `/qms/aql/export-excel`, params }) |
||||
|
} |
||||
|
|
||||
|
// 下载用户导入模板
|
||||
|
export const importTemplate = () => { |
||||
|
return request.download({ url: '/qms/aql/get-import-template' }) |
||||
|
} |
@ -0,0 +1,65 @@ |
|||||
|
import request from '@/config/axios' |
||||
|
|
||||
|
export interface InspectionJobDetailVO { |
||||
|
number: string |
||||
|
applicationDate: localdate |
||||
|
applicationTime: Date |
||||
|
requestStartTime: Date |
||||
|
requestEndTime: Date |
||||
|
finishTime: Date |
||||
|
supplierCode: string |
||||
|
materialCode: string |
||||
|
batch: string |
||||
|
requestInspectionNum: number |
||||
|
referenceOrderCode: string |
||||
|
referenceOrderRow: number |
||||
|
referenceCertificateCode: string |
||||
|
referenceCertificateRow: number |
||||
|
inspectionSchemeCode: string |
||||
|
inspectionStageCode: string |
||||
|
applicationPackageCode: string |
||||
|
inspectionLevel: string |
||||
|
aqlValue: number |
||||
|
available: string |
||||
|
} |
||||
|
|
||||
|
// 查询检验申请列表
|
||||
|
export const getInspectionJobDetailPage = async (params) => { |
||||
|
if (params.isSearch) { |
||||
|
delete params.isSearch |
||||
|
const data = {...params} |
||||
|
return await request.post({ url: '/inspection/inspection-job-detail/senior', data }) |
||||
|
} else { |
||||
|
return await request.get({ url: `/inspection/inspection-job-detail/page`, params }) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// 查询检验申请详情
|
||||
|
export const getInspectionJobDetail = async (id: number) => { |
||||
|
return await request.get({ url: `/inspection/inspection-job-detail/get?id=` + id }) |
||||
|
} |
||||
|
|
||||
|
// 新增检验申请
|
||||
|
export const createInspectionJobDetail = async (data: InspectionJobDetailVO) => { |
||||
|
return await request.post({ url: `/inspection/inspection-job-detail/create`, data }) |
||||
|
} |
||||
|
|
||||
|
// 修改检验申请
|
||||
|
export const updateInspectionJobDetail = async (data: InspectionJobDetailVO) => { |
||||
|
return await request.put({ url: `/inspection/inspection-job-detail/update`, data }) |
||||
|
} |
||||
|
|
||||
|
// 删除检验申请
|
||||
|
export const deleteInspectionJobDetail = async (id: number) => { |
||||
|
return await request.delete({ url: `/inspection/inspection-job-detail/delete?id=` + id }) |
||||
|
} |
||||
|
|
||||
|
// 导出检验申请 Excel
|
||||
|
export const exportInspectionJobDetail = async (params) => { |
||||
|
return await request.download({ url: `/inspection/inspection-job-detail/export-excel`, params }) |
||||
|
} |
||||
|
|
||||
|
// 下载用户导入模板
|
||||
|
export const importTemplate = () => { |
||||
|
return request.download({ url: '/inspection/inspection-job-detail/get-import-template' }) |
||||
|
} |
@ -0,0 +1,65 @@ |
|||||
|
import request from '@/config/axios' |
||||
|
|
||||
|
export interface InspectionJobMainVO { |
||||
|
number: string |
||||
|
applicationDate: localdate |
||||
|
applicationTime: Date |
||||
|
requestStartTime: Date |
||||
|
requestEndTime: Date |
||||
|
finishTime: Date |
||||
|
supplierCode: string |
||||
|
materialCode: string |
||||
|
batch: string |
||||
|
requestInspectionNum: number |
||||
|
referenceOrderCode: string |
||||
|
referenceOrderRow: number |
||||
|
referenceCertificateCode: string |
||||
|
referenceCertificateRow: number |
||||
|
inspectionSchemeCode: string |
||||
|
inspectionStageCode: string |
||||
|
applicationPackageCode: string |
||||
|
inspectionLevel: string |
||||
|
aqlValue: number |
||||
|
available: string |
||||
|
} |
||||
|
|
||||
|
// 查询检验申请列表
|
||||
|
export const getInspectionJobMainPage = async (params) => { |
||||
|
if (params.isSearch) { |
||||
|
delete params.isSearch |
||||
|
const data = {...params} |
||||
|
return await request.post({ url: '/inspection/inspection-job-main/senior', data }) |
||||
|
} else { |
||||
|
return await request.get({ url: `/inspection/inspection-job-main/page`, params }) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// 查询检验申请详情
|
||||
|
export const getInspectionJobMain = async (id: number) => { |
||||
|
return await request.get({ url: `/inspection/inspection-job-main/get?id=` + id }) |
||||
|
} |
||||
|
|
||||
|
// 新增检验申请
|
||||
|
export const createInspectionJobMain = async (data: InspectionJobMainVO) => { |
||||
|
return await request.post({ url: `/inspection/inspection-job-main/create`, data }) |
||||
|
} |
||||
|
|
||||
|
// 修改检验申请
|
||||
|
export const updateInspectionJobMain = async (data: InspectionJobMainVO) => { |
||||
|
return await request.put({ url: `/inspection/inspection-job-main/update`, data }) |
||||
|
} |
||||
|
|
||||
|
// 删除检验申请
|
||||
|
export const deleteInspectionJobMain = async (id: number) => { |
||||
|
return await request.delete({ url: `/inspection/inspection-job-main/delete?id=` + id }) |
||||
|
} |
||||
|
|
||||
|
// 导出检验申请 Excel
|
||||
|
export const exportInspectionJobMain = async (params) => { |
||||
|
return await request.download({ url: `/inspection/inspection-job-main/export-excel`, params }) |
||||
|
} |
||||
|
|
||||
|
// 下载用户导入模板
|
||||
|
export const importTemplate = () => { |
||||
|
return request.download({ url: '/inspection/inspection-job-main/get-import-template' }) |
||||
|
} |
@ -0,0 +1,53 @@ |
|||||
|
import request from '@/config/axios' |
||||
|
|
||||
|
export interface InspectionMethodVO { |
||||
|
id: number |
||||
|
code: string |
||||
|
describe: string |
||||
|
version: string |
||||
|
status: string |
||||
|
operationGuidance: string |
||||
|
videoAddress: string |
||||
|
available: string |
||||
|
} |
||||
|
|
||||
|
// 查询检验方法列表
|
||||
|
export const getInspectionMethodPage = async (params) => { |
||||
|
if (params.isSearch) { |
||||
|
delete params.isSearch |
||||
|
const data = {...params} |
||||
|
return await request.post({ url: '/qms/inspection-method/senior', data }) |
||||
|
} else { |
||||
|
return await request.get({ url: `/qms/inspection-method/page`, params }) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// 查询检验方法详情
|
||||
|
export const getInspectionMethod = async (id: number) => { |
||||
|
return await request.get({ url: `/qms/inspection-method/get?id=` + id }) |
||||
|
} |
||||
|
|
||||
|
// 新增检验方法
|
||||
|
export const createInspectionMethod = async (data: InspectionMethodVO) => { |
||||
|
return await request.post({ url: `/qms/inspection-method/create`, data }) |
||||
|
} |
||||
|
|
||||
|
// 修改检验方法
|
||||
|
export const updateInspectionMethod = async (data: InspectionMethodVO) => { |
||||
|
return await request.put({ url: `/qms/inspection-method/update`, data }) |
||||
|
} |
||||
|
|
||||
|
// 删除检验方法
|
||||
|
export const deleteInspectionMethod = async (id: number) => { |
||||
|
return await request.delete({ url: `/qms/inspection-method/delete?id=` + id }) |
||||
|
} |
||||
|
|
||||
|
// 导出检验方法 Excel
|
||||
|
export const exportInspectionMethod = async (params) => { |
||||
|
return await request.download({ url: `/qms/inspection-method/export-excel`, params }) |
||||
|
} |
||||
|
|
||||
|
// 下载用户导入模板
|
||||
|
export const importTemplate = () => { |
||||
|
return request.download({ url: '/qms/inspection-method/get-import-template' }) |
||||
|
} |
@ -0,0 +1,65 @@ |
|||||
|
import request from '@/config/axios' |
||||
|
|
||||
|
export interface InspectionMainVO { |
||||
|
number: string |
||||
|
applicationDate: localdate |
||||
|
applicationTime: Date |
||||
|
requestStartTime: Date |
||||
|
requestEndTime: Date |
||||
|
finishTime: Date |
||||
|
supplierCode: string |
||||
|
materialCode: string |
||||
|
batch: string |
||||
|
requestInspectionNum: number |
||||
|
referenceOrderCode: string |
||||
|
referenceOrderRow: number |
||||
|
referenceCertificateCode: string |
||||
|
referenceCertificateRow: number |
||||
|
inspectionSchemeCode: string |
||||
|
inspectionStageCode: string |
||||
|
applicationPackageCode: string |
||||
|
inspectionLevel: string |
||||
|
aqlValue: number |
||||
|
available: string |
||||
|
} |
||||
|
|
||||
|
// 查询检验申请列表
|
||||
|
export const getInspectionMainPage = async (params) => { |
||||
|
if (params.isSearch) { |
||||
|
delete params.isSearch |
||||
|
const data = {...params} |
||||
|
return await request.post({ url: '/inspection/inspection-main/senior', data }) |
||||
|
} else { |
||||
|
return await request.get({ url: `/inspection/inspection-main/page`, params }) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// 查询检验申请详情
|
||||
|
export const getInspectionMain = async (id: number) => { |
||||
|
return await request.get({ url: `/inspection/inspection-main/get?id=` + id }) |
||||
|
} |
||||
|
|
||||
|
// 新增检验申请
|
||||
|
export const createInspectionMain = async (data: InspectionMainVO) => { |
||||
|
return await request.post({ url: `/inspection/inspection-main/create`, data }) |
||||
|
} |
||||
|
|
||||
|
// 修改检验申请
|
||||
|
export const updateInspectionMain = async (data: InspectionMainVO) => { |
||||
|
return await request.put({ url: `/inspection/inspection-main/update`, data }) |
||||
|
} |
||||
|
|
||||
|
// 删除检验申请
|
||||
|
export const deleteInspectionMain = async (id: number) => { |
||||
|
return await request.delete({ url: `/inspection/inspection-main/delete?id=` + id }) |
||||
|
} |
||||
|
|
||||
|
// 导出检验申请 Excel
|
||||
|
export const exportInspectionMain = async (params) => { |
||||
|
return await request.download({ url: `/inspection/inspection-main/export-excel`, params }) |
||||
|
} |
||||
|
|
||||
|
// 下载用户导入模板
|
||||
|
export const importTemplate = () => { |
||||
|
return request.download({ url: '/inspection/inspection-main/get-import-template' }) |
||||
|
} |
@ -0,0 +1,8 @@ |
|||||
|
import request from '@/config/axios' |
||||
|
|
||||
|
|
||||
|
|
||||
|
// 查询采样过程列表
|
||||
|
export const getInspectionProcessPage = async (params) => { |
||||
|
return await request.get({ url: `/qms/inspection-process/page`}) |
||||
|
} |
@ -0,0 +1,57 @@ |
|||||
|
import request from '@/config/axios' |
||||
|
|
||||
|
export interface SampleCodeVO { |
||||
|
id: number |
||||
|
code: string |
||||
|
batchLow limiting: number |
||||
|
batchUpperLimiting: number |
||||
|
s1: number |
||||
|
s2: number |
||||
|
s3: number |
||||
|
s4: number |
||||
|
g1: number |
||||
|
g2: number |
||||
|
g3: number |
||||
|
available: string |
||||
|
} |
||||
|
|
||||
|
// 查询样本字码列表
|
||||
|
export const getSampleCodePage = async (params) => { |
||||
|
if (params.isSearch) { |
||||
|
delete params.isSearch |
||||
|
const data = {...params} |
||||
|
return await request.post({ url: '/qms/sample-code/senior', data }) |
||||
|
} else { |
||||
|
return await request.get({ url: `/qms/sample-code/page`, params }) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// 查询样本字码详情
|
||||
|
export const getSampleCode = async (id: number) => { |
||||
|
return await request.get({ url: `/qms/sample-code/get?id=` + id }) |
||||
|
} |
||||
|
|
||||
|
// 新增样本字码
|
||||
|
export const createSampleCode = async (data: SampleCodeVO) => { |
||||
|
return await request.post({ url: `/qms/sample-code/create`, data }) |
||||
|
} |
||||
|
|
||||
|
// 修改样本字码
|
||||
|
export const updateSampleCode = async (data: SampleCodeVO) => { |
||||
|
return await request.put({ url: `/qms/sample-code/update`, data }) |
||||
|
} |
||||
|
|
||||
|
// 删除样本字码
|
||||
|
export const deleteSampleCode = async (id: number) => { |
||||
|
return await request.delete({ url: `/qms/sample-code/delete?id=` + id }) |
||||
|
} |
||||
|
|
||||
|
// 导出样本字码 Excel
|
||||
|
export const exportSampleCode = async (params) => { |
||||
|
return await request.download({ url: `/qms/sample-code/export-excel`, params }) |
||||
|
} |
||||
|
|
||||
|
// 下载用户导入模板
|
||||
|
export const importTemplate = () => { |
||||
|
return request.download({ url: '/qms/sample-code/get-import-template' }) |
||||
|
} |
@ -0,0 +1,50 @@ |
|||||
|
import request from '@/config/axios' |
||||
|
|
||||
|
export interface SamplingSchemeVO { |
||||
|
id: number |
||||
|
code: string |
||||
|
describe: string |
||||
|
status: string |
||||
|
available: string |
||||
|
} |
||||
|
|
||||
|
// 查询采样方案列表
|
||||
|
export const getSamplingSchemePage = async (params) => { |
||||
|
if (params.isSearch) { |
||||
|
delete params.isSearch |
||||
|
const data = {...params} |
||||
|
return await request.post({ url: '/qms/sampling-scheme/senior', data }) |
||||
|
} else { |
||||
|
return await request.get({ url: `/qms/sampling-scheme/page`, params }) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// 查询采样方案详情
|
||||
|
export const getSamplingScheme = async (id: number) => { |
||||
|
return await request.get({ url: `/qms/sampling-scheme/get?id=` + id }) |
||||
|
} |
||||
|
|
||||
|
// 新增采样方案
|
||||
|
export const createSamplingScheme = async (data: SamplingSchemeVO) => { |
||||
|
return await request.post({ url: `/qms/sampling-scheme/create`, data }) |
||||
|
} |
||||
|
|
||||
|
// 修改采样方案
|
||||
|
export const updateSamplingScheme = async (data: SamplingSchemeVO) => { |
||||
|
return await request.put({ url: `/qms/sampling-scheme/update`, data }) |
||||
|
} |
||||
|
|
||||
|
// 删除采样方案
|
||||
|
export const deleteSamplingScheme = async (id: number) => { |
||||
|
return await request.delete({ url: `/qms/sampling-scheme/delete?id=` + id }) |
||||
|
} |
||||
|
|
||||
|
// 导出采样方案 Excel
|
||||
|
export const exportSamplingScheme = async (params) => { |
||||
|
return await request.download({ url: `/qms/sampling-scheme/export-excel`, params }) |
||||
|
} |
||||
|
|
||||
|
// 下载用户导入模板
|
||||
|
export const importTemplate = () => { |
||||
|
return request.download({ url: '/qms/sampling-scheme/get-import-template' }) |
||||
|
} |
@ -0,0 +1,172 @@ |
|||||
|
import type { CrudSchema } from '@/hooks/web/useCrudSchemas' |
||||
|
import { dateFormatter } from '@/utils/formatTime' |
||||
|
|
||||
|
// 表单校验
|
||||
|
export const AbilityInfoRules = reactive({ |
||||
|
ablityCode: [required], |
||||
|
ablityName: [required], |
||||
|
trainMinHours: [required], |
||||
|
operMinHours: [required], |
||||
|
}) |
||||
|
|
||||
|
export const AbilityInfo = useCrudSchemas(reactive<CrudSchema[]>([ |
||||
|
{ |
||||
|
label: '删除时间', |
||||
|
field: 'deleteTime', |
||||
|
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: '主键', |
||||
|
field: 'id', |
||||
|
sort: 'custom', |
||||
|
isForm: false, |
||||
|
isTable: false, |
||||
|
isDetail:false, |
||||
|
}, |
||||
|
{ |
||||
|
label: '并发乐观锁', |
||||
|
field: 'concurrencyStamp', |
||||
|
sort: 'custom', |
||||
|
isSearch: false, |
||||
|
isTable: false, |
||||
|
isForm:false, |
||||
|
isDetail:false, |
||||
|
form: { |
||||
|
component: 'InputNumber', |
||||
|
value: 0 |
||||
|
}, |
||||
|
}, |
||||
|
|
||||
|
{ |
||||
|
label: '创建时间', |
||||
|
field: 'createTime', |
||||
|
sort: 'custom', |
||||
|
formatter: dateFormatter, |
||||
|
isSearch: false, |
||||
|
isTable: 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: '删除用户名', |
||||
|
field: 'deleter', |
||||
|
sort: 'custom', |
||||
|
isSearch: false, |
||||
|
isTable: false, |
||||
|
isForm: false, |
||||
|
isDetail:false |
||||
|
}, |
||||
|
{ |
||||
|
label: '位置ID', |
||||
|
field: 'siteId', |
||||
|
sort: 'custom', |
||||
|
isSearch: false, |
||||
|
isTable: false, |
||||
|
isForm: false, |
||||
|
isDetail:false, |
||||
|
form: { |
||||
|
component: 'InputNumber', |
||||
|
value: 0 |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
label: '技能编号', |
||||
|
field: 'ablityCode', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
}, |
||||
|
{ |
||||
|
label: '技能名称', |
||||
|
field: 'ablityName', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
}, |
||||
|
{ |
||||
|
label: '要求培训时长', |
||||
|
field: 'trainMinHours', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
form: { |
||||
|
component: 'InputNumber', |
||||
|
componentProps: { |
||||
|
min: 0, |
||||
|
precision: 1 |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '操作时长', |
||||
|
field: 'operMinHours', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
form: { |
||||
|
component: 'InputNumber', |
||||
|
componentProps: { |
||||
|
min: 0, |
||||
|
precision: 1 |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '备注', |
||||
|
field: 'remark', |
||||
|
sort: 'custom', |
||||
|
isSearch: false, |
||||
|
isTable: false |
||||
|
}, |
||||
|
{ |
||||
|
label: '状态', |
||||
|
field: 'status', |
||||
|
sort: 'custom', |
||||
|
dictType: DICT_TYPE.QUALIFY_STATUS, |
||||
|
dictClass: 'string', |
||||
|
isForm: true, |
||||
|
isSearch: true, |
||||
|
isTable: true, |
||||
|
form: { |
||||
|
component: 'Switch', |
||||
|
value: '2', |
||||
|
componentProps: { |
||||
|
inactiveValue: '2', |
||||
|
activeValue: '1' |
||||
|
} |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
label: '操作', |
||||
|
field: 'action', |
||||
|
isForm: false, |
||||
|
table: { |
||||
|
width: 150, |
||||
|
fixed: 'right' |
||||
|
} |
||||
|
} |
||||
|
])) |
@ -0,0 +1,244 @@ |
|||||
|
<template> |
||||
|
<ContentWrap> |
||||
|
<!-- 搜索工作栏 --> |
||||
|
<Search :schema="AbilityInfo.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" /> |
||||
|
</ContentWrap> |
||||
|
|
||||
|
<!-- 列表头部 --> |
||||
|
<TableHead |
||||
|
:HeadButttondata="HeadButttondata" |
||||
|
@button-base-click="buttonBaseClick" |
||||
|
:routeName="routeName" |
||||
|
@updataTableColumns="updataTableColumns" |
||||
|
@searchFormClick="searchFormClick" |
||||
|
:allSchemas="AbilityInfo.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 #ablityCode="{row}"> |
||||
|
<el-button type="primary" link @click="openDetail(row, '代码', row.ablityCode)"> |
||||
|
<span>{{ row.ablityCode }}</span> |
||||
|
</el-button> |
||||
|
</template> |
||||
|
<template #action="{ row }"> |
||||
|
<ButtonBase :Butttondata="butttondata" @button-base-click="buttonTableClick($event,row)" /> |
||||
|
</template> |
||||
|
</Table> |
||||
|
</ContentWrap> |
||||
|
|
||||
|
<!-- 表单弹窗:添加/修改 --> |
||||
|
<BasicForm |
||||
|
ref="basicFormRef" |
||||
|
@success="formsSuccess" |
||||
|
:rules="AbilityInfoRules" |
||||
|
:formAllSchemas="AbilityInfo.allSchemas" |
||||
|
:apiUpdate="AbilityInfoApi.updateAbilityInfo" |
||||
|
:apiCreate="AbilityInfoApi.createAbilityInfo" |
||||
|
@searchTableSuccess="searchTableSuccess" |
||||
|
:isBusiness="false" |
||||
|
/> |
||||
|
|
||||
|
<!-- 详情 --> |
||||
|
<Detail ref="detailRef" :isBasic="true" :allSchemas="AbilityInfo.allSchemas" /> |
||||
|
|
||||
|
<!-- 导入 --> |
||||
|
<ImportForm ref="importFormRef" url="/mes/ability-info/import" :importTemplateData="importTemplateData" @success="importSuccess" /> |
||||
|
</template> |
||||
|
|
||||
|
<script setup lang="ts"> |
||||
|
import download from '@/utils/download' |
||||
|
import { AbilityInfo,AbilityInfoRules } from './abilityInfo.data' |
||||
|
import * as AbilityInfoApi from '@/api/mes/abilityInfo' |
||||
|
import * as defaultButtons from '@/utils/disposition/defaultButtons' |
||||
|
import TableHead from '@/components/TableHead/src/TableHead.vue' |
||||
|
import ImportForm from '@/components/ImportForm/src/ImportForm.vue' |
||||
|
import Detail from '@/components/Detail/src/Detail.vue' |
||||
|
|
||||
|
defineOptions({ name: 'AbilityInfo' }) |
||||
|
|
||||
|
const message = useMessage() // 消息弹窗 |
||||
|
const { t } = useI18n() // 国际化 |
||||
|
|
||||
|
const route = useRoute() // 路由信息 |
||||
|
const routeName = ref() |
||||
|
routeName.value = route.name |
||||
|
const tableColumns = ref(AbilityInfo.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: AbilityInfoApi.getAbilityInfoPage // 分页接口 |
||||
|
}) |
||||
|
|
||||
|
// 获得表格的各种操作 |
||||
|
const { getList, setSearchParams } = tableMethods |
||||
|
|
||||
|
// 列表头部按钮 |
||||
|
const HeadButttondata = [ |
||||
|
defaultButtons.defaultAddBtn({hasPermi:'mes:abilityInfo:create'}), // 新增 |
||||
|
defaultButtons.defaultImportBtn({hasPermi:'mes:abilityInfo:import'}), // 导入 |
||||
|
defaultButtons.defaultExportBtn({hasPermi:'mes:abilityInfo:export'}), // 导出 |
||||
|
defaultButtons.defaultFreshBtn(null), // 刷新 |
||||
|
defaultButtons.defaultFilterBtn(null), // 筛选 |
||||
|
defaultButtons.defaultSetBtn(null), // 设置 |
||||
|
// { |
||||
|
// label: '自定义扩展按钮', |
||||
|
// name: 'zdy', |
||||
|
// hide: false, |
||||
|
// type: 'primary', |
||||
|
// icon: 'Select', |
||||
|
// color: '' |
||||
|
// }, |
||||
|
] |
||||
|
|
||||
|
// 头部按钮事件 |
||||
|
const buttonBaseClick = (val, item) => { |
||||
|
if (val == 'add') { // 新增 |
||||
|
openForm('create') |
||||
|
} else if (val == 'import') { // 导入 |
||||
|
handleImport() |
||||
|
} else if (val == 'export') { // 导出 |
||||
|
handleExport() |
||||
|
} else if (val == 'refresh') { // 刷新 |
||||
|
getList() |
||||
|
} else if (val == 'filtrate') { // 筛选 |
||||
|
} else { // 其他按钮 |
||||
|
console.log('其他按钮', item) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// 列表-操作按钮 |
||||
|
const butttondata = [ |
||||
|
defaultButtons.mainListEditBtn({hasPermi:'mes:abilityInfo:update'}), // 编辑 |
||||
|
defaultButtons.mainListDeleteBtn({hasPermi:'mes:abilityInfo:delete'}), // 删除 |
||||
|
] |
||||
|
|
||||
|
// 列表-操作按钮事件 |
||||
|
const buttonTableClick = async (val, row) => { |
||||
|
if (val == 'edit') { // 编辑 |
||||
|
openForm('update', row) |
||||
|
} else if (val == 'delete') { // 删除 |
||||
|
handleDelete(row.id) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/** 添加/修改操作 */ |
||||
|
const basicFormRef = ref() |
||||
|
const openForm = (type: string, row?: any) => { |
||||
|
basicFormRef.value.open(type, row) |
||||
|
} |
||||
|
|
||||
|
// form表单提交 |
||||
|
const formsSuccess = async (formType,data) => { |
||||
|
var isHave =AbilityInfo.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 AbilityInfoApi.createAbilityInfo(data) |
||||
|
message.success(t('common.createSuccess')) |
||||
|
} else { |
||||
|
await AbilityInfoApi.updateAbilityInfo(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, 'basicAbilityInfo') |
||||
|
} |
||||
|
|
||||
|
/** 删除按钮操作 */ |
||||
|
const handleDelete = async (id: number) => { |
||||
|
try { |
||||
|
// 删除的二次确认 |
||||
|
await message.delConfirm() |
||||
|
// 发起删除 |
||||
|
await AbilityInfoApi.deleteAbilityInfo(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 AbilityInfoApi.exportAbilityInfo(tableObject.params) |
||||
|
download.excel(data, '能力矩阵信息.xlsx') |
||||
|
} catch { |
||||
|
} finally { |
||||
|
exportLoading.value = false |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/** 导入 */ |
||||
|
const importFormRef = ref() |
||||
|
const handleImport = () => { |
||||
|
importFormRef.value.open() |
||||
|
} |
||||
|
// 导入附件弹窗所需的参数 |
||||
|
const importTemplateData = reactive({ |
||||
|
templateUrl: '', |
||||
|
templateTitle: '能力矩阵信息导入模版.xlsx' |
||||
|
}) |
||||
|
// 导入成功之后 |
||||
|
const importSuccess = () => { |
||||
|
getList() |
||||
|
} |
||||
|
|
||||
|
// 筛选提交 |
||||
|
const searchFormClick = (searchData) => { |
||||
|
tableObject.params = { |
||||
|
isSearch: true, |
||||
|
filters: searchData.filters |
||||
|
} |
||||
|
getList() // 刷新当前列表 |
||||
|
} |
||||
|
|
||||
|
/** 初始化 **/ |
||||
|
onMounted(async () => { |
||||
|
getList() |
||||
|
importTemplateData.templateUrl = await AbilityInfoApi.importTemplate() |
||||
|
}) |
||||
|
|
||||
|
</script> |
@ -0,0 +1,210 @@ |
|||||
|
import type { CrudSchema } from '@/hooks/web/useCrudSchemas' |
||||
|
import { dateFormatter } from '@/utils/formatTime' |
||||
|
import * as AbilityInfoApi from '@/api/mes/abilityInfo' |
||||
|
import { AbilityInfo } from '../abilityInfo/abilityInfo.data' |
||||
|
|
||||
|
|
||||
|
// 表单校验
|
||||
|
export const HrPersonAbilityRules = reactive({ |
||||
|
ablityCode: [required], |
||||
|
personCode: [required], |
||||
|
|
||||
|
}) |
||||
|
|
||||
|
export const HrPersonAbility = useCrudSchemas(reactive<CrudSchema[]>([ |
||||
|
{ |
||||
|
label: '删除时间', |
||||
|
field: 'deleteTime', |
||||
|
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: '主键', |
||||
|
field: 'id', |
||||
|
sort: 'custom', |
||||
|
isForm: false, |
||||
|
isTable: false, |
||||
|
isDetail:false |
||||
|
}, |
||||
|
{ |
||||
|
label: '并发乐观锁', |
||||
|
field: 'concurrencyStamp', |
||||
|
sort: 'custom', |
||||
|
isSearch: false, |
||||
|
isTable: false, |
||||
|
isForm:false, |
||||
|
isDetail:false, |
||||
|
form: { |
||||
|
component: 'InputNumber', |
||||
|
value: 0 |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
label: '创建时间', |
||||
|
field: 'createTime', |
||||
|
sort: 'custom', |
||||
|
formatter: dateFormatter, |
||||
|
isSearch: false, |
||||
|
isTable: 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: '删除用户名', |
||||
|
field: 'deleter', |
||||
|
sort: 'custom', |
||||
|
isSearch: false, |
||||
|
isTable: false, |
||||
|
isForm: false, |
||||
|
isDetail:false, |
||||
|
}, |
||||
|
{ |
||||
|
label: '位置ID', |
||||
|
field: 'siteId', |
||||
|
sort: 'custom', |
||||
|
isSearch: false, |
||||
|
isTable: false, |
||||
|
isForm: false, |
||||
|
isDetail:false, |
||||
|
form: { |
||||
|
component: 'InputNumber', |
||||
|
value: 0 |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
label: '人员ID', |
||||
|
field: 'personId', |
||||
|
sort: 'custom', |
||||
|
isSearch: false, |
||||
|
isTable: false, |
||||
|
isForm: false, |
||||
|
isDetail:false, |
||||
|
form: { |
||||
|
component: 'InputNumber', |
||||
|
value: 0 |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
label: '人员工号', |
||||
|
field: 'personCode', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
}, |
||||
|
{ |
||||
|
label: '能力编号', |
||||
|
field: 'ablityCode', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
form: { |
||||
|
componentProps: { |
||||
|
isSearchList: true, // 开启查询弹窗
|
||||
|
searchTitle: '能力矩阵信息', // 查询弹窗标题
|
||||
|
searchAllSchemas: AbilityInfo.allSchemas, // 查询弹窗所需类
|
||||
|
searchField: 'ablityCode', // 查询弹窗赋值字段
|
||||
|
searchPage: AbilityInfoApi.getAbilityInfoPage, // 查询弹窗所需分页方法
|
||||
|
searchCondition: [{ |
||||
|
key: 'status', |
||||
|
value: '1', |
||||
|
action: '==' |
||||
|
}] |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '能力等级', |
||||
|
field: 'ablityLevel', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
form: { |
||||
|
component: 'InputNumber', |
||||
|
value: 0 |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
label: '学习累计时长', |
||||
|
field: 'studyDuration', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
form: { |
||||
|
component: 'InputNumber', |
||||
|
componentProps: { |
||||
|
min: 0, |
||||
|
precision: 1 |
||||
|
} |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
label: '工作累计时长', |
||||
|
field: 'workDuration', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
form: { |
||||
|
component: 'InputNumber', |
||||
|
componentProps: { |
||||
|
min: 0, |
||||
|
precision: 1 |
||||
|
} |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
label: '备注', |
||||
|
field: 'remark', |
||||
|
sort: 'custom', |
||||
|
isSearch: false, |
||||
|
isTable: false |
||||
|
}, |
||||
|
{ |
||||
|
label: '状态', |
||||
|
field: 'status', |
||||
|
sort: 'custom', |
||||
|
dictType: DICT_TYPE.QUALIFY_STATUS, |
||||
|
dictClass: 'string', |
||||
|
isForm: true, |
||||
|
isSearch: true, |
||||
|
isTable: true, |
||||
|
form: { |
||||
|
component: 'Switch', |
||||
|
value: '2', |
||||
|
componentProps: { |
||||
|
inactiveValue: '2', |
||||
|
activeValue: '1' |
||||
|
} |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
label: '操作', |
||||
|
field: 'action', |
||||
|
isForm: false, |
||||
|
table: { |
||||
|
width: 150, |
||||
|
fixed: 'right' |
||||
|
} |
||||
|
} |
||||
|
])) |
@ -0,0 +1,257 @@ |
|||||
|
<template> |
||||
|
<ContentWrap> |
||||
|
<!-- 搜索工作栏 --> |
||||
|
<Search :schema="HrPersonAbility.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" /> |
||||
|
</ContentWrap> |
||||
|
|
||||
|
<!-- 列表头部 --> |
||||
|
<TableHead |
||||
|
:HeadButttondata="HeadButttondata" |
||||
|
@button-base-click="buttonBaseClick" |
||||
|
:routeName="routeName" |
||||
|
@updataTableColumns="updataTableColumns" |
||||
|
@searchFormClick="searchFormClick" |
||||
|
:allSchemas="HrPersonAbility.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 #personCode="{row}"> |
||||
|
<el-button type="primary" link @click="openDetail(row, '代码', row.personCode)"> |
||||
|
<span>{{ row.personCode }}</span> |
||||
|
</el-button> |
||||
|
</template> |
||||
|
<template #action="{ row }"> |
||||
|
<ButtonBase :Butttondata="butttondata" @button-base-click="buttonTableClick($event,row)" /> |
||||
|
</template> |
||||
|
</Table> |
||||
|
</ContentWrap> |
||||
|
|
||||
|
<!-- 表单弹窗:添加/修改 --> |
||||
|
<BasicForm |
||||
|
ref="basicFormRef" |
||||
|
@success="formsSuccess" |
||||
|
:rules="HrPersonAbilityRules" |
||||
|
:formAllSchemas="HrPersonAbility.allSchemas" |
||||
|
:apiUpdate="HrPersonAbilityApi.updateHrPersonAbility" |
||||
|
:apiCreate="HrPersonAbilityApi.createHrPersonAbility" |
||||
|
@searchTableSuccess="searchTableSuccess" |
||||
|
:isBusiness="false" |
||||
|
/> |
||||
|
|
||||
|
<!-- 详情 --> |
||||
|
<Detail ref="detailRef" :isBasic="true" :allSchemas="HrPersonAbility.allSchemas" /> |
||||
|
|
||||
|
<!-- 导入 --> |
||||
|
<ImportForm ref="importFormRef" url="/mes/hr-person-ability/import" :importTemplateData="importTemplateData" @success="importSuccess" /> |
||||
|
</template> |
||||
|
|
||||
|
<script setup lang="ts"> |
||||
|
import download from '@/utils/download' |
||||
|
import { HrPersonAbility,HrPersonAbilityRules } from './hrPersonAbility.data' |
||||
|
import * as HrPersonAbilityApi from '@/api/mes/hrPersonAbility' |
||||
|
import * as defaultButtons from '@/utils/disposition/defaultButtons' |
||||
|
import TableHead from '@/components/TableHead/src/TableHead.vue' |
||||
|
import ImportForm from '@/components/ImportForm/src/ImportForm.vue' |
||||
|
import Detail from '@/components/Detail/src/Detail.vue' |
||||
|
|
||||
|
defineOptions({ name: 'HrPersonAbility' }) |
||||
|
|
||||
|
const message = useMessage() // 消息弹窗 |
||||
|
const { t } = useI18n() // 国际化 |
||||
|
|
||||
|
const route = useRoute() // 路由信息 |
||||
|
const routeName = ref() |
||||
|
routeName.value = route.name |
||||
|
const tableColumns = ref(HrPersonAbility.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: HrPersonAbilityApi.getHrPersonAbilityPage // 分页接口 |
||||
|
}) |
||||
|
|
||||
|
// 获得表格的各种操作 |
||||
|
const { getList, setSearchParams } = tableMethods |
||||
|
|
||||
|
// 列表头部按钮 |
||||
|
const HeadButttondata = [ |
||||
|
defaultButtons.defaultAddBtn({hasPermi:'mes:hrPersonAbility:create'}), // 新增 |
||||
|
defaultButtons.defaultImportBtn({hasPermi:'mes:hrPersonAbility:import'}), // 导入 |
||||
|
defaultButtons.defaultExportBtn({hasPermi:'mes:hrPersonAbility:export'}), // 导出 |
||||
|
defaultButtons.defaultFreshBtn(null), // 刷新 |
||||
|
defaultButtons.defaultFilterBtn(null), // 筛选 |
||||
|
defaultButtons.defaultSetBtn(null), // 设置 |
||||
|
// { |
||||
|
// label: '自定义扩展按钮', |
||||
|
// name: 'zdy', |
||||
|
// hide: false, |
||||
|
// type: 'primary', |
||||
|
// icon: 'Select', |
||||
|
// color: '' |
||||
|
// }, |
||||
|
] |
||||
|
|
||||
|
// 头部按钮事件 |
||||
|
const buttonBaseClick = (val, item) => { |
||||
|
if (val == 'add') { // 新增 |
||||
|
openForm('create') |
||||
|
} else if (val == 'import') { // 导入 |
||||
|
handleImport() |
||||
|
} else if (val == 'export') { // 导出 |
||||
|
handleExport() |
||||
|
} else if (val == 'refresh') { // 刷新 |
||||
|
getList() |
||||
|
} else if (val == 'filtrate') { // 筛选 |
||||
|
} else { // 其他按钮 |
||||
|
console.log('其他按钮', item) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// 列表-操作按钮 |
||||
|
const butttondata = [ |
||||
|
defaultButtons.mainListEditBtn({hasPermi:'mes:hrPersonAbility:update'}), // 编辑 |
||||
|
defaultButtons.mainListDeleteBtn({hasPermi:'mes:hrPersonAbility:delete'}), // 删除 |
||||
|
] |
||||
|
|
||||
|
// 列表-操作按钮事件 |
||||
|
const buttonTableClick = async (val, row) => { |
||||
|
if (val == 'edit') { // 编辑 |
||||
|
openForm('update', row) |
||||
|
} else if (val == 'delete') { // 删除 |
||||
|
handleDelete(row.id) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/** 添加/修改操作 */ |
||||
|
const basicFormRef = ref() |
||||
|
const openForm = (type: string, row?: any) => { |
||||
|
if(type == "update"){ |
||||
|
HrPersonAbility.allSchemas.formSchema.forEach((item) => { |
||||
|
if (item.field == 'personCode') { |
||||
|
item.componentProps.disabled = true |
||||
|
} |
||||
|
}) |
||||
|
}else{ |
||||
|
HrPersonAbility.allSchemas.formSchema.forEach((item) => { |
||||
|
if (item.field == 'personCode') { |
||||
|
item.componentProps.disabled = false |
||||
|
} |
||||
|
}) |
||||
|
} |
||||
|
basicFormRef.value.open(type, row) |
||||
|
} |
||||
|
|
||||
|
// form表单提交 |
||||
|
const formsSuccess = async (formType,data) => { |
||||
|
var isHave =HrPersonAbility.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 HrPersonAbilityApi.createHrPersonAbility(data) |
||||
|
message.success(t('common.createSuccess')) |
||||
|
} else { |
||||
|
await HrPersonAbilityApi.updateHrPersonAbility(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, 'basicHrPersonAbility') |
||||
|
} |
||||
|
|
||||
|
/** 删除按钮操作 */ |
||||
|
const handleDelete = async (id: number) => { |
||||
|
try { |
||||
|
// 删除的二次确认 |
||||
|
await message.delConfirm() |
||||
|
// 发起删除 |
||||
|
await HrPersonAbilityApi.deleteHrPersonAbility(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 HrPersonAbilityApi.exportHrPersonAbility(tableObject.params) |
||||
|
download.excel(data, '人员能力矩阵配置.xlsx') |
||||
|
} catch { |
||||
|
} finally { |
||||
|
exportLoading.value = false |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/** 导入 */ |
||||
|
const importFormRef = ref() |
||||
|
const handleImport = () => { |
||||
|
importFormRef.value.open() |
||||
|
} |
||||
|
// 导入附件弹窗所需的参数 |
||||
|
const importTemplateData = reactive({ |
||||
|
templateUrl: '', |
||||
|
templateTitle: '人员能力矩阵配置导入模版.xlsx' |
||||
|
}) |
||||
|
// 导入成功之后 |
||||
|
const importSuccess = () => { |
||||
|
getList() |
||||
|
} |
||||
|
|
||||
|
// 筛选提交 |
||||
|
const searchFormClick = (searchData) => { |
||||
|
tableObject.params = { |
||||
|
isSearch: true, |
||||
|
filters: searchData.filters |
||||
|
} |
||||
|
getList() // 刷新当前列表 |
||||
|
} |
||||
|
|
||||
|
/** 初始化 **/ |
||||
|
onMounted(async () => { |
||||
|
getList() |
||||
|
importTemplateData.templateUrl = await HrPersonAbilityApi.importTemplate() |
||||
|
}) |
||||
|
|
||||
|
</script> |
@ -0,0 +1,353 @@ |
|||||
|
<template> |
||||
|
<ContentWrap> |
||||
|
<!-- 搜索工作栏 --> |
||||
|
<Search :schema="Item.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" /> |
||||
|
</ContentWrap> |
||||
|
|
||||
|
<!-- 列表头部 --> |
||||
|
<TableHead |
||||
|
:HeadButttondata="HeadButttondata" |
||||
|
@button-base-click="buttonBaseClick" |
||||
|
:routeName="routeName" |
||||
|
@updataTableColumns="updataTableColumns" |
||||
|
@searchFormClick="searchFormClick" |
||||
|
:allSchemas="Item.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 #itemCode="{row}"> |
||||
|
<el-button type="primary" link @click="openDetail(row, '代码', row.itemCode)"> |
||||
|
<span>{{ row.itemCode }}</span> |
||||
|
</el-button> |
||||
|
</template> |
||||
|
<template #action="{ row }"> |
||||
|
<ButtonBase :Butttondata="butttondata" @button-base-click="buttonTableClick($event,row)" /> |
||||
|
</template> |
||||
|
</Table> |
||||
|
</ContentWrap> |
||||
|
|
||||
|
<!-- 表单弹窗:添加/修改 --> |
||||
|
<BasicForm |
||||
|
ref="basicFormRef" |
||||
|
@success="formsSuccess" |
||||
|
:rules="ItemRules" |
||||
|
:formAllSchemas="Item.allSchemas" |
||||
|
:apiUpdate="ItemApi.updateItem" |
||||
|
:apiCreate="ItemApi.createItem" |
||||
|
@searchTableSuccess="searchTableSuccess" |
||||
|
:isBusiness="false" |
||||
|
@onChange="onChangeQG" |
||||
|
/> |
||||
|
|
||||
|
<!-- 详情 --> |
||||
|
<Detail ref="detailRef" :isBasic="true" :allSchemas="Item.allSchemas" /> |
||||
|
|
||||
|
<!-- 导入 --> |
||||
|
<ImportForm ref="importFormRef" url="/mes/item/import" :importTemplateData="importTemplateData" @success="importSuccess" /> |
||||
|
</template> |
||||
|
|
||||
|
<script setup lang="ts"> |
||||
|
import download from '@/utils/download' |
||||
|
import { Item,ItemRules } from './item.data' |
||||
|
import * as ItemApi from '@/api/mes/item' |
||||
|
import * as defaultButtons from '@/utils/disposition/defaultButtons' |
||||
|
import TableHead from '@/components/TableHead/src/TableHead.vue' |
||||
|
import ImportForm from '@/components/ImportForm/src/ImportForm.vue' |
||||
|
import Detail from '@/components/Detail/src/Detail.vue' |
||||
|
|
||||
|
defineOptions({ name: 'QmsItem' }) |
||||
|
|
||||
|
const message = useMessage() // 消息弹窗 |
||||
|
const { t } = useI18n() // 国际化 |
||||
|
|
||||
|
const route = useRoute() // 路由信息 |
||||
|
const routeName = ref() |
||||
|
routeName.value = route.name |
||||
|
const tableColumns = ref(Item.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: ItemApi.getItemPage // 分页接口 |
||||
|
}) |
||||
|
|
||||
|
// 获得表格的各种操作 |
||||
|
const { getList, setSearchParams } = tableMethods |
||||
|
|
||||
|
// 列表头部按钮 |
||||
|
const HeadButttondata = [ |
||||
|
defaultButtons.defaultAddBtn({hasPermi:'mes:item:create'}), // 新增 |
||||
|
defaultButtons.defaultImportBtn({hasPermi:'mes:item:import'}), // 导入 |
||||
|
defaultButtons.defaultExportBtn({hasPermi:'mes:item:export'}), // 导出 |
||||
|
defaultButtons.defaultFreshBtn(null), // 刷新 |
||||
|
defaultButtons.defaultFilterBtn(null), // 筛选 |
||||
|
defaultButtons.defaultSetBtn(null), // 设置 |
||||
|
// { |
||||
|
// label: '自定义扩展按钮', |
||||
|
// name: 'zdy', |
||||
|
// hide: false, |
||||
|
// type: 'primary', |
||||
|
// icon: 'Select', |
||||
|
// color: '' |
||||
|
// }, |
||||
|
] |
||||
|
|
||||
|
// 头部按钮事件 |
||||
|
const buttonBaseClick = (val, item) => { |
||||
|
if (val == 'add') { // 新增 |
||||
|
openForm('create') |
||||
|
} else if (val == 'import') { // 导入 |
||||
|
handleImport() |
||||
|
} else if (val == 'export') { // 导出 |
||||
|
handleExport() |
||||
|
} else if (val == 'refresh') { // 刷新 |
||||
|
getList() |
||||
|
} else if (val == 'filtrate') { // 筛选 |
||||
|
} else { // 其他按钮 |
||||
|
console.log('其他按钮', item) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// 列表-操作按钮 |
||||
|
const butttondata = [ |
||||
|
defaultButtons.mainListEditBtn({hasPermi:'mes:item:update'}), // 编辑 |
||||
|
defaultButtons.mainListDeleteBtn({hasPermi:'mes:item:delete'}), // 删除 |
||||
|
] |
||||
|
|
||||
|
// 列表-操作按钮事件 |
||||
|
const buttonTableClick = async (val, row) => { |
||||
|
if (val == 'edit') { // 编辑 |
||||
|
openForm('update', row) |
||||
|
} else if (val == 'delete') { // 删除 |
||||
|
handleDelete(row.id) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/** 添加/修改操作 */ |
||||
|
const basicFormRef = ref() |
||||
|
const openForm = (type: string, row?: any) => { |
||||
|
if(type == "update"){ |
||||
|
Item.allSchemas.formSchema.forEach((item) => { |
||||
|
|
||||
|
if (item.field == 'itemCode') { |
||||
|
item.componentProps.disabled = true |
||||
|
} |
||||
|
if (item.field == 'itemType') { |
||||
|
item.componentProps.disabled = true |
||||
|
} |
||||
|
|
||||
|
if(row.dataType == 'NUMBER'){ |
||||
|
if (item.field == 'dataVerify') { |
||||
|
item.componentProps.disabled = false |
||||
|
} |
||||
|
if (item.field == 'dataStandvalue') { |
||||
|
item.componentProps.disabled = false |
||||
|
} |
||||
|
if (item.field == 'status') { |
||||
|
item.componentProps.disabled = true |
||||
|
} |
||||
|
} |
||||
|
if(row.dataType == 'SWITCH'){ |
||||
|
if (item.field == 'dataVerify') { |
||||
|
item.componentProps.disabled = true |
||||
|
} |
||||
|
if (item.field == 'dataStandvalue') { |
||||
|
item.componentProps.disabled = true |
||||
|
} |
||||
|
if (item.field == 'status') { |
||||
|
item.componentProps.disabled = false |
||||
|
} |
||||
|
} |
||||
|
if(row.dataType == 'TEXT'){ |
||||
|
if (item.field == 'dataVerify') { |
||||
|
item.componentProps.disabled = true |
||||
|
} |
||||
|
if (item.field == 'dataStandvalue') { |
||||
|
item.componentProps.disabled = true |
||||
|
} |
||||
|
if (item.field == 'status') { |
||||
|
item.componentProps.disabled = true |
||||
|
} |
||||
|
} |
||||
|
}) |
||||
|
}else{ |
||||
|
Item.allSchemas.formSchema.forEach((item) => { |
||||
|
if (item.field == 'itemCode') { |
||||
|
item.componentProps.disabled = false |
||||
|
} |
||||
|
if (item.field == 'itemType') { |
||||
|
item.componentProps.disabled = false |
||||
|
} |
||||
|
if (item.field == 'dataVerify') { |
||||
|
item.componentProps.disabled = false |
||||
|
} |
||||
|
if (item.field == 'dataStandvalue') { |
||||
|
item.componentProps.disabled = false |
||||
|
} |
||||
|
if (item.field == 'status') { |
||||
|
item.componentProps.disabled = false |
||||
|
} |
||||
|
}) |
||||
|
} |
||||
|
basicFormRef.value.open(type, row) |
||||
|
} |
||||
|
|
||||
|
// form表单提交 |
||||
|
const formsSuccess = async (formType,data) => { |
||||
|
var isHave =Item.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 ItemApi.createItem(data) |
||||
|
message.success(t('common.createSuccess')) |
||||
|
} else { |
||||
|
await ItemApi.updateItem(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, 'basicItem') |
||||
|
} |
||||
|
|
||||
|
/** 删除按钮操作 */ |
||||
|
const handleDelete = async (id: number) => { |
||||
|
try { |
||||
|
// 删除的二次确认 |
||||
|
await message.delConfirm() |
||||
|
// 发起删除 |
||||
|
await ItemApi.deleteItem(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 ItemApi.exportItem(tableObject.params) |
||||
|
download.excel(data, '质检项目定义.xlsx') |
||||
|
} catch { |
||||
|
} finally { |
||||
|
exportLoading.value = false |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/** 导入 */ |
||||
|
const importFormRef = ref() |
||||
|
const handleImport = () => { |
||||
|
importFormRef.value.open() |
||||
|
} |
||||
|
// 导入附件弹窗所需的参数 |
||||
|
const importTemplateData = reactive({ |
||||
|
templateUrl: '', |
||||
|
templateTitle: '质检项目定义导入模版.xlsx' |
||||
|
}) |
||||
|
// 导入成功之后 |
||||
|
const importSuccess = () => { |
||||
|
getList() |
||||
|
} |
||||
|
|
||||
|
// 筛选提交 |
||||
|
const searchFormClick = (searchData) => { |
||||
|
tableObject.params = { |
||||
|
isSearch: true, |
||||
|
filters: searchData.filters |
||||
|
} |
||||
|
getList() // 刷新当前列表 |
||||
|
} |
||||
|
|
||||
|
//数据类型切换 |
||||
|
const onChangeQG = (field, cur, item) => { |
||||
|
|
||||
|
console.log('cur'+cur) |
||||
|
|
||||
|
Item.allSchemas.formSchema.forEach((item) => { |
||||
|
if(cur == 'SWITCH'){ |
||||
|
if (item.field == 'dataVerify') { |
||||
|
item.componentProps.disabled = true |
||||
|
} |
||||
|
if (item.field == 'dataStandvalue') { |
||||
|
item.componentProps.disabled = true |
||||
|
} |
||||
|
if (item.field == 'status') { |
||||
|
item.componentProps.disabled = false |
||||
|
} |
||||
|
} |
||||
|
if(cur == 'TEXT'){ |
||||
|
if (item.field == 'dataVerify') { |
||||
|
item.componentProps.disabled = true |
||||
|
} |
||||
|
if (item.field == 'dataStandvalue') { |
||||
|
item.componentProps.disabled = true |
||||
|
} |
||||
|
if (item.field == 'status') { |
||||
|
item.componentProps.disabled = true |
||||
|
} |
||||
|
} |
||||
|
if(cur == 'NUMBER'){ |
||||
|
if (item.field == 'dataVerify') { |
||||
|
item.componentProps.disabled = false |
||||
|
} |
||||
|
if (item.field == 'dataStandvalue') { |
||||
|
item.componentProps.disabled = false |
||||
|
} |
||||
|
if (item.field == 'status') { |
||||
|
item.componentProps.disabled = true |
||||
|
} |
||||
|
} |
||||
|
}) |
||||
|
|
||||
|
|
||||
|
} |
||||
|
|
||||
|
|
||||
|
/** 初始化 **/ |
||||
|
onMounted(async () => { |
||||
|
getList() |
||||
|
importTemplateData.templateUrl = await ItemApi.importTemplate() |
||||
|
}) |
||||
|
|
||||
|
</script> |
@ -0,0 +1,203 @@ |
|||||
|
import type { CrudSchema } from '@/hooks/web/useCrudSchemas' |
||||
|
import { dateFormatter } from '@/utils/formatTime' |
||||
|
import * as QualitygroupApi from '@/api/mes/qualitygroup' |
||||
|
import { Qualitygroup } from '../qualitygroup/qualitygroup.data' |
||||
|
|
||||
|
// 表单校验
|
||||
|
export const ItemRules = reactive({ |
||||
|
concurrencyStamp: [required], |
||||
|
itemCode: [{ required: true, message: '请输入编码', trigger: 'blur' }], |
||||
|
itemType: [required], |
||||
|
dataType: [required] |
||||
|
}) |
||||
|
|
||||
|
export const Item = useCrudSchemas(reactive<CrudSchema[]>([ |
||||
|
{ |
||||
|
label: '删除时间', |
||||
|
field: 'deleteTime', |
||||
|
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: '主键', |
||||
|
field: 'id', |
||||
|
sort: 'custom', |
||||
|
isForm: false, |
||||
|
isTable: false, |
||||
|
isDetail:false |
||||
|
}, |
||||
|
|
||||
|
{ |
||||
|
label: '并发乐观锁', |
||||
|
field: 'concurrencyStamp', |
||||
|
sort: 'custom', |
||||
|
isSearch: false, |
||||
|
isTable: false, |
||||
|
isForm:false, |
||||
|
isDetail:false, |
||||
|
form: { |
||||
|
component: 'InputNumber', |
||||
|
value: 0 |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
label: '创建时间', |
||||
|
field: 'createTime', |
||||
|
sort: 'custom', |
||||
|
formatter: dateFormatter, |
||||
|
isSearch: false, |
||||
|
isTable: 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: '删除用户名', |
||||
|
field: 'deleter', |
||||
|
sort: 'custom', |
||||
|
isSearch: false, |
||||
|
isTable: false, |
||||
|
isForm: false, |
||||
|
isDetail:false |
||||
|
}, |
||||
|
{ |
||||
|
label: '位置ID', |
||||
|
field: 'siteId', |
||||
|
sort: 'custom', |
||||
|
isSearch: false, |
||||
|
isTable: false, |
||||
|
isForm: false, |
||||
|
isDetail:false, |
||||
|
form: { |
||||
|
component: 'InputNumber', |
||||
|
value: 0 |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
label: '项目编码', |
||||
|
field: 'itemCode', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
}, |
||||
|
{ |
||||
|
label: '项目名称', |
||||
|
field: 'itemName', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
}, |
||||
|
{ |
||||
|
label: '类别编码', |
||||
|
field: 'itemType', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
form: { |
||||
|
componentProps: { |
||||
|
isSearchList: true, // 开启查询弹窗
|
||||
|
searchTitle: '质检科目信息', // 查询弹窗标题
|
||||
|
searchAllSchemas: Qualitygroup.allSchemas, // 查询弹窗所需类
|
||||
|
searchField: 'code', // 查询弹窗赋值字段
|
||||
|
searchPage: QualitygroupApi.getQualitygroupPage, // 查询弹窗所需分页方法
|
||||
|
searchCondition: [{ |
||||
|
key: 'status', |
||||
|
value: '1', |
||||
|
action: '==' |
||||
|
}] |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '质检科目编码', |
||||
|
field: 'qmsClass', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
|
||||
|
}, |
||||
|
{ |
||||
|
label: '数据类型', |
||||
|
field: 'dataType', |
||||
|
sort: 'custom', |
||||
|
dictType: DICT_TYPE.QUALIFY_ITEM_DATA_TYPE, |
||||
|
dictClass: 'string', |
||||
|
isSearch: true, |
||||
|
}, |
||||
|
{ |
||||
|
label: '校验方式', |
||||
|
field: 'dataVerify', |
||||
|
sort: 'custom', |
||||
|
dictType: DICT_TYPE.QUALIFY_ITEM_VERIFY_MODE, |
||||
|
dictClass: 'string', |
||||
|
isSearch: true, |
||||
|
}, |
||||
|
{ |
||||
|
label: '数据参考值', |
||||
|
field: 'dataStandvalue', |
||||
|
sort: 'custom', |
||||
|
isSearch: false, |
||||
|
}, |
||||
|
{ |
||||
|
label: '数据录入说明', |
||||
|
field: 'dataDescripe', |
||||
|
sort: 'custom', |
||||
|
isSearch: false, |
||||
|
}, |
||||
|
{ |
||||
|
label: '操作', |
||||
|
field: 'action', |
||||
|
isForm: false, |
||||
|
table: { |
||||
|
width: 150, |
||||
|
fixed: 'right' |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '是否可用', |
||||
|
field: 'status', |
||||
|
sort: 'custom', |
||||
|
dictType: DICT_TYPE.QUALIFY_STATUS, |
||||
|
dictClass: 'string', |
||||
|
isSearch: true, |
||||
|
isTable: true, |
||||
|
isForm: true, |
||||
|
form: { |
||||
|
component: 'Switch', |
||||
|
value: '2', |
||||
|
componentProps: { |
||||
|
inactiveValue: '2', |
||||
|
activeValue: '1' |
||||
|
} |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
label: '备注', |
||||
|
field: 'remark', |
||||
|
sort: 'custom', |
||||
|
isSearch: false, |
||||
|
isTable: false |
||||
|
} |
||||
|
])) |
@ -0,0 +1,244 @@ |
|||||
|
<template> |
||||
|
<ContentWrap> |
||||
|
<!-- 搜索工作栏 --> |
||||
|
<Search :schema="Opersteps.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" /> |
||||
|
</ContentWrap> |
||||
|
|
||||
|
<!-- 列表头部 --> |
||||
|
<TableHead |
||||
|
:HeadButttondata="HeadButttondata" |
||||
|
@button-base-click="buttonBaseClick" |
||||
|
:routeName="routeName" |
||||
|
@updataTableColumns="updataTableColumns" |
||||
|
@searchFormClick="searchFormClick" |
||||
|
:allSchemas="Opersteps.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 #stepsCode="{row}"> |
||||
|
<el-button type="primary" link @click="openDetail(row, '代码', row.stepsCode)"> |
||||
|
<span>{{ row.stepsCode }}</span> |
||||
|
</el-button> |
||||
|
</template> |
||||
|
<template #action="{ row }"> |
||||
|
<ButtonBase :Butttondata="butttondata" @button-base-click="buttonTableClick($event,row)" /> |
||||
|
</template> |
||||
|
</Table> |
||||
|
</ContentWrap> |
||||
|
|
||||
|
<!-- 表单弹窗:添加/修改 --> |
||||
|
<BasicForm |
||||
|
ref="basicFormRef" |
||||
|
@success="formsSuccess" |
||||
|
:rules="OperstepsRules" |
||||
|
:formAllSchemas="Opersteps.allSchemas" |
||||
|
:apiUpdate="OperstepsApi.updateOpersteps" |
||||
|
:apiCreate="OperstepsApi.createOpersteps" |
||||
|
@searchTableSuccess="searchTableSuccess" |
||||
|
:isBusiness="false" |
||||
|
/> |
||||
|
|
||||
|
<!-- 详情 --> |
||||
|
<Detail ref="detailRef" :isBasic="true" :allSchemas="Opersteps.allSchemas" /> |
||||
|
|
||||
|
<!-- 导入 --> |
||||
|
<ImportForm ref="importFormRef" url="/mes/opersteps/import" :importTemplateData="importTemplateData" @success="importSuccess" /> |
||||
|
</template> |
||||
|
|
||||
|
<script setup lang="ts"> |
||||
|
import download from '@/utils/download' |
||||
|
import { Opersteps,OperstepsRules } from './opersteps.data' |
||||
|
import * as OperstepsApi from '@/api/mes/opersteps' |
||||
|
import * as defaultButtons from '@/utils/disposition/defaultButtons' |
||||
|
import TableHead from '@/components/TableHead/src/TableHead.vue' |
||||
|
import ImportForm from '@/components/ImportForm/src/ImportForm.vue' |
||||
|
import Detail from '@/components/Detail/src/Detail.vue' |
||||
|
|
||||
|
defineOptions({ name: 'Opersteps' }) |
||||
|
|
||||
|
const message = useMessage() // 消息弹窗 |
||||
|
const { t } = useI18n() // 国际化 |
||||
|
|
||||
|
const route = useRoute() // 路由信息 |
||||
|
const routeName = ref() |
||||
|
routeName.value = route.name |
||||
|
const tableColumns = ref(Opersteps.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: OperstepsApi.getOperstepsPage // 分页接口 |
||||
|
}) |
||||
|
|
||||
|
// 获得表格的各种操作 |
||||
|
const { getList, setSearchParams } = tableMethods |
||||
|
|
||||
|
// 列表头部按钮 |
||||
|
const HeadButttondata = [ |
||||
|
defaultButtons.defaultAddBtn({hasPermi:'mes:opersteps:create'}), // 新增 |
||||
|
defaultButtons.defaultImportBtn({hasPermi:'mes:opersteps:import'}), // 导入 |
||||
|
defaultButtons.defaultExportBtn({hasPermi:'mes:opersteps:export'}), // 导出 |
||||
|
defaultButtons.defaultFreshBtn(null), // 刷新 |
||||
|
defaultButtons.defaultFilterBtn(null), // 筛选 |
||||
|
defaultButtons.defaultSetBtn(null), // 设置 |
||||
|
// { |
||||
|
// label: '自定义扩展按钮', |
||||
|
// name: 'zdy', |
||||
|
// hide: false, |
||||
|
// type: 'primary', |
||||
|
// icon: 'Select', |
||||
|
// color: '' |
||||
|
// }, |
||||
|
] |
||||
|
|
||||
|
// 头部按钮事件 |
||||
|
const buttonBaseClick = (val, item) => { |
||||
|
if (val == 'add') { // 新增 |
||||
|
openForm('create') |
||||
|
} else if (val == 'import') { // 导入 |
||||
|
handleImport() |
||||
|
} else if (val == 'export') { // 导出 |
||||
|
handleExport() |
||||
|
} else if (val == 'refresh') { // 刷新 |
||||
|
getList() |
||||
|
} else if (val == 'filtrate') { // 筛选 |
||||
|
} else { // 其他按钮 |
||||
|
console.log('其他按钮', item) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// 列表-操作按钮 |
||||
|
const butttondata = [ |
||||
|
defaultButtons.mainListEditBtn({hasPermi:'mes:opersteps:update'}), // 编辑 |
||||
|
defaultButtons.mainListDeleteBtn({hasPermi:'mes:opersteps:delete'}), // 删除 |
||||
|
] |
||||
|
|
||||
|
// 列表-操作按钮事件 |
||||
|
const buttonTableClick = async (val, row) => { |
||||
|
if (val == 'edit') { // 编辑 |
||||
|
openForm('update', row) |
||||
|
} else if (val == 'delete') { // 删除 |
||||
|
handleDelete(row.id) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/** 添加/修改操作 */ |
||||
|
const basicFormRef = ref() |
||||
|
const openForm = (type: string, row?: any) => { |
||||
|
basicFormRef.value.open(type, row) |
||||
|
} |
||||
|
|
||||
|
// form表单提交 |
||||
|
const formsSuccess = async (formType,data) => { |
||||
|
var isHave =Opersteps.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 OperstepsApi.createOpersteps(data) |
||||
|
message.success(t('common.createSuccess')) |
||||
|
} else { |
||||
|
await OperstepsApi.updateOpersteps(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, 'basicOpersteps') |
||||
|
} |
||||
|
|
||||
|
/** 删除按钮操作 */ |
||||
|
const handleDelete = async (id: number) => { |
||||
|
try { |
||||
|
// 删除的二次确认 |
||||
|
await message.delConfirm() |
||||
|
// 发起删除 |
||||
|
await OperstepsApi.deleteOpersteps(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 OperstepsApi.exportOpersteps(tableObject.params) |
||||
|
download.excel(data, 'MES操作步骤信息.xlsx') |
||||
|
} catch { |
||||
|
} finally { |
||||
|
exportLoading.value = false |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/** 导入 */ |
||||
|
const importFormRef = ref() |
||||
|
const handleImport = () => { |
||||
|
importFormRef.value.open() |
||||
|
} |
||||
|
// 导入附件弹窗所需的参数 |
||||
|
const importTemplateData = reactive({ |
||||
|
templateUrl: '', |
||||
|
templateTitle: 'MES操作步骤信息导入模版.xlsx' |
||||
|
}) |
||||
|
// 导入成功之后 |
||||
|
const importSuccess = () => { |
||||
|
getList() |
||||
|
} |
||||
|
|
||||
|
// 筛选提交 |
||||
|
const searchFormClick = (searchData) => { |
||||
|
tableObject.params = { |
||||
|
isSearch: true, |
||||
|
filters: searchData.filters |
||||
|
} |
||||
|
getList() // 刷新当前列表 |
||||
|
} |
||||
|
|
||||
|
/** 初始化 **/ |
||||
|
onMounted(async () => { |
||||
|
getList() |
||||
|
importTemplateData.templateUrl = await OperstepsApi.importTemplate() |
||||
|
}) |
||||
|
|
||||
|
</script> |
@ -0,0 +1,165 @@ |
|||||
|
import type { CrudSchema } from '@/hooks/web/useCrudSchemas' |
||||
|
import { dateFormatter } from '@/utils/formatTime' |
||||
|
import * as OperstepsTypeApi from '@/api/mes/operstepsType' |
||||
|
import { OperstepsType } from '../operstepsType/operstepsType.data' |
||||
|
|
||||
|
// 表单校验
|
||||
|
export const OperstepsRules = reactive({ |
||||
|
concurrencyStamp: [required], |
||||
|
}) |
||||
|
|
||||
|
export const Opersteps = useCrudSchemas(reactive<CrudSchema[]>([ |
||||
|
{ |
||||
|
label: '删除时间', |
||||
|
field: 'deleteTime', |
||||
|
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: '主键', |
||||
|
field: 'id', |
||||
|
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: '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')] |
||||
|
} |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
label: '删除用户名', |
||||
|
field: 'deleter', |
||||
|
sort: 'custom', |
||||
|
isSearch: false, |
||||
|
isTable: false, |
||||
|
isForm:false, |
||||
|
isDetail:false, |
||||
|
}, |
||||
|
{ |
||||
|
label: '位置ID', |
||||
|
field: 'siteId', |
||||
|
sort: 'custom', |
||||
|
isSearch: false, |
||||
|
isTable: false, |
||||
|
isForm:false, |
||||
|
isDetail:false, |
||||
|
form: { |
||||
|
component: 'InputNumber', |
||||
|
value: 0 |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
label: '步骤编码', |
||||
|
field: 'stepsCode', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
}, |
||||
|
{ |
||||
|
label: '步骤名称', |
||||
|
field: 'stepsName', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
}, |
||||
|
{ |
||||
|
label: '采集类型编码', |
||||
|
field: 'collectCode', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
form: { |
||||
|
componentProps: { |
||||
|
isSearchList: true, // 开启查询弹窗
|
||||
|
searchTitle: '操作步骤类型配置信息', // 查询弹窗标题
|
||||
|
searchAllSchemas: OperstepsType.allSchemas, // 查询弹窗所需类
|
||||
|
searchField: 'collectCode', // 查询弹窗赋值字段
|
||||
|
searchPage: OperstepsTypeApi.getOperstepsTypePage, // 查询弹窗所需分页方法
|
||||
|
searchCondition: [{ |
||||
|
key: 'status', |
||||
|
value: '1', |
||||
|
action: '==' |
||||
|
}] |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '状态', |
||||
|
field: 'status', |
||||
|
sort: 'custom', |
||||
|
dictType: DICT_TYPE.QUALIFY_STATUS, |
||||
|
dictClass: 'string', |
||||
|
isForm: true, |
||||
|
isSearch: true, |
||||
|
isTable: true, |
||||
|
form: { |
||||
|
component: 'Switch', |
||||
|
value: '2', |
||||
|
componentProps: { |
||||
|
inactiveValue: '2', |
||||
|
activeValue: '1' |
||||
|
} |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
label: '备注', |
||||
|
field: 'remark', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
}, |
||||
|
{ |
||||
|
label: '操作', |
||||
|
field: 'action', |
||||
|
isForm: false, |
||||
|
table: { |
||||
|
width: 150, |
||||
|
fixed: 'right' |
||||
|
} |
||||
|
} |
||||
|
])) |
@ -0,0 +1,244 @@ |
|||||
|
<template> |
||||
|
<ContentWrap> |
||||
|
<!-- 搜索工作栏 --> |
||||
|
<Search :schema="OperstepsType.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" /> |
||||
|
</ContentWrap> |
||||
|
|
||||
|
<!-- 列表头部 --> |
||||
|
<TableHead |
||||
|
:HeadButttondata="HeadButttondata" |
||||
|
@button-base-click="buttonBaseClick" |
||||
|
:routeName="routeName" |
||||
|
@updataTableColumns="updataTableColumns" |
||||
|
@searchFormClick="searchFormClick" |
||||
|
:allSchemas="OperstepsType.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 #collectCode="{row}"> |
||||
|
<el-button type="primary" link @click="openDetail(row, '代码', row.collectCode)"> |
||||
|
<span>{{ row.collectCode }}</span> |
||||
|
</el-button> |
||||
|
</template> |
||||
|
<template #action="{ row }"> |
||||
|
<ButtonBase :Butttondata="butttondata" @button-base-click="buttonTableClick($event,row)" /> |
||||
|
</template> |
||||
|
</Table> |
||||
|
</ContentWrap> |
||||
|
|
||||
|
<!-- 表单弹窗:添加/修改 --> |
||||
|
<BasicForm |
||||
|
ref="basicFormRef" |
||||
|
@success="formsSuccess" |
||||
|
:rules="OperstepsTypeRules" |
||||
|
:formAllSchemas="OperstepsType.allSchemas" |
||||
|
:apiUpdate="OperstepsTypeApi.updateOperstepsType" |
||||
|
:apiCreate="OperstepsTypeApi.createOperstepsType" |
||||
|
@searchTableSuccess="searchTableSuccess" |
||||
|
:isBusiness="false" |
||||
|
/> |
||||
|
|
||||
|
<!-- 详情 --> |
||||
|
<Detail ref="detailRef" :isBasic="true" :allSchemas="OperstepsType.allSchemas" /> |
||||
|
|
||||
|
<!-- 导入 --> |
||||
|
<ImportForm ref="importFormRef" url="/mes/opersteps-type/import" :importTemplateData="importTemplateData" @success="importSuccess" /> |
||||
|
</template> |
||||
|
|
||||
|
<script setup lang="ts"> |
||||
|
import download from '@/utils/download' |
||||
|
import { OperstepsType,OperstepsTypeRules } from './operstepsType.data' |
||||
|
import * as OperstepsTypeApi from '@/api/mes/operstepsType' |
||||
|
import * as defaultButtons from '@/utils/disposition/defaultButtons' |
||||
|
import TableHead from '@/components/TableHead/src/TableHead.vue' |
||||
|
import ImportForm from '@/components/ImportForm/src/ImportForm.vue' |
||||
|
import Detail from '@/components/Detail/src/Detail.vue' |
||||
|
|
||||
|
defineOptions({ name: 'OperstepsType' }) |
||||
|
|
||||
|
const message = useMessage() // 消息弹窗 |
||||
|
const { t } = useI18n() // 国际化 |
||||
|
|
||||
|
const route = useRoute() // 路由信息 |
||||
|
const routeName = ref() |
||||
|
routeName.value = route.name |
||||
|
const tableColumns = ref(OperstepsType.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: OperstepsTypeApi.getOperstepsTypePage // 分页接口 |
||||
|
}) |
||||
|
|
||||
|
// 获得表格的各种操作 |
||||
|
const { getList, setSearchParams } = tableMethods |
||||
|
|
||||
|
// 列表头部按钮 |
||||
|
const HeadButttondata = [ |
||||
|
defaultButtons.defaultAddBtn({hasPermi:'mes:operstepsType:create'}), // 新增 |
||||
|
defaultButtons.defaultImportBtn({hasPermi:'mes:operstepsType:import'}), // 导入 |
||||
|
defaultButtons.defaultExportBtn({hasPermi:'mes:operstepsType:export'}), // 导出 |
||||
|
defaultButtons.defaultFreshBtn(null), // 刷新 |
||||
|
defaultButtons.defaultFilterBtn(null), // 筛选 |
||||
|
defaultButtons.defaultSetBtn(null), // 设置 |
||||
|
// { |
||||
|
// label: '自定义扩展按钮', |
||||
|
// name: 'zdy', |
||||
|
// hide: false, |
||||
|
// type: 'primary', |
||||
|
// icon: 'Select', |
||||
|
// color: '' |
||||
|
// }, |
||||
|
] |
||||
|
|
||||
|
// 头部按钮事件 |
||||
|
const buttonBaseClick = (val, item) => { |
||||
|
if (val == 'add') { // 新增 |
||||
|
openForm('create') |
||||
|
} else if (val == 'import') { // 导入 |
||||
|
handleImport() |
||||
|
} else if (val == 'export') { // 导出 |
||||
|
handleExport() |
||||
|
} else if (val == 'refresh') { // 刷新 |
||||
|
getList() |
||||
|
} else if (val == 'filtrate') { // 筛选 |
||||
|
} else { // 其他按钮 |
||||
|
console.log('其他按钮', item) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// 列表-操作按钮 |
||||
|
const butttondata = [ |
||||
|
defaultButtons.mainListEditBtn({hasPermi:'mes:operstepsType:update'}), // 编辑 |
||||
|
defaultButtons.mainListDeleteBtn({hasPermi:'mes:operstepsType:delete'}), // 删除 |
||||
|
] |
||||
|
|
||||
|
// 列表-操作按钮事件 |
||||
|
const buttonTableClick = async (val, row) => { |
||||
|
if (val == 'edit') { // 编辑 |
||||
|
openForm('update', row) |
||||
|
} else if (val == 'delete') { // 删除 |
||||
|
handleDelete(row.id) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/** 添加/修改操作 */ |
||||
|
const basicFormRef = ref() |
||||
|
const openForm = (type: string, row?: any) => { |
||||
|
basicFormRef.value.open(type, row) |
||||
|
} |
||||
|
|
||||
|
// form表单提交 |
||||
|
const formsSuccess = async (formType,data) => { |
||||
|
var isHave =OperstepsType.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 OperstepsTypeApi.createOperstepsType(data) |
||||
|
message.success(t('common.createSuccess')) |
||||
|
} else { |
||||
|
await OperstepsTypeApi.updateOperstepsType(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, 'basicOperstepsType') |
||||
|
} |
||||
|
|
||||
|
/** 删除按钮操作 */ |
||||
|
const handleDelete = async (id: number) => { |
||||
|
try { |
||||
|
// 删除的二次确认 |
||||
|
await message.delConfirm() |
||||
|
// 发起删除 |
||||
|
await OperstepsTypeApi.deleteOperstepsType(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 OperstepsTypeApi.exportOperstepsType(tableObject.params) |
||||
|
download.excel(data, '操作步骤类型配置.xlsx') |
||||
|
} catch { |
||||
|
} finally { |
||||
|
exportLoading.value = false |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/** 导入 */ |
||||
|
const importFormRef = ref() |
||||
|
const handleImport = () => { |
||||
|
importFormRef.value.open() |
||||
|
} |
||||
|
// 导入附件弹窗所需的参数 |
||||
|
const importTemplateData = reactive({ |
||||
|
templateUrl: '', |
||||
|
templateTitle: '操作步骤类型配置导入模版.xlsx' |
||||
|
}) |
||||
|
// 导入成功之后 |
||||
|
const importSuccess = () => { |
||||
|
getList() |
||||
|
} |
||||
|
|
||||
|
// 筛选提交 |
||||
|
const searchFormClick = (searchData) => { |
||||
|
tableObject.params = { |
||||
|
isSearch: true, |
||||
|
filters: searchData.filters |
||||
|
} |
||||
|
getList() // 刷新当前列表 |
||||
|
} |
||||
|
|
||||
|
/** 初始化 **/ |
||||
|
onMounted(async () => { |
||||
|
getList() |
||||
|
importTemplateData.templateUrl = await OperstepsTypeApi.importTemplate() |
||||
|
}) |
||||
|
|
||||
|
</script> |
@ -0,0 +1,167 @@ |
|||||
|
import type { CrudSchema } from '@/hooks/web/useCrudSchemas' |
||||
|
import { dateFormatter } from '@/utils/formatTime' |
||||
|
|
||||
|
// 表单校验
|
||||
|
export const OperstepsTypeRules = reactive({ |
||||
|
collectCode: [required], |
||||
|
collectName: [required], |
||||
|
collectType: [required], |
||||
|
adpaterClass: [required], |
||||
|
argLsit: [required], |
||||
|
}) |
||||
|
|
||||
|
export const OperstepsType = useCrudSchemas(reactive<CrudSchema[]>([ |
||||
|
{ |
||||
|
label: '类型编码', |
||||
|
field: 'collectCode', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
}, |
||||
|
{ |
||||
|
label: '类型名称', |
||||
|
field: 'collectName', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
}, |
||||
|
{ |
||||
|
label: '采集方式', |
||||
|
field: 'collectType', |
||||
|
sort: 'custom', |
||||
|
dictType: DICT_TYPE.OPERSTEP_COLLECT_TYPE, |
||||
|
dictClass: 'string', |
||||
|
isSearch: true, |
||||
|
}, |
||||
|
{ |
||||
|
label: '适配器类名称', |
||||
|
field: 'adpaterClass', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
}, |
||||
|
{ |
||||
|
label: '参数列表', |
||||
|
field: 'argLsit', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
}, |
||||
|
{ |
||||
|
label: '删除时间', |
||||
|
field: 'deleteTime', |
||||
|
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: '主键', |
||||
|
field: 'id', |
||||
|
sort: 'custom', |
||||
|
isForm: false, |
||||
|
isTable: false, |
||||
|
isDetail:false |
||||
|
}, |
||||
|
{ |
||||
|
label: '并发乐观锁', |
||||
|
field: 'concurrencyStamp', |
||||
|
sort: 'custom', |
||||
|
isSearch: false, |
||||
|
isTable: false, |
||||
|
isForm:false, |
||||
|
isDetail:false, |
||||
|
form: { |
||||
|
component: 'InputNumber', |
||||
|
value: 0 |
||||
|
}, |
||||
|
}, |
||||
|
|
||||
|
{ |
||||
|
label: '创建时间', |
||||
|
field: 'createTime', |
||||
|
sort: 'custom', |
||||
|
formatter: dateFormatter, |
||||
|
isSearch: false, |
||||
|
isTable: 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: '删除用户名', |
||||
|
field: 'deleter', |
||||
|
sort: 'custom', |
||||
|
isSearch: false, |
||||
|
isTable: false, |
||||
|
isForm: false, |
||||
|
isDetail:false, |
||||
|
}, |
||||
|
{ |
||||
|
label: '位置ID', |
||||
|
field: 'siteId', |
||||
|
sort: 'custom', |
||||
|
isSearch: false, |
||||
|
isTable: false, |
||||
|
isForm: false, |
||||
|
isDetail:false, |
||||
|
form: { |
||||
|
component: 'InputNumber', |
||||
|
value: 0 |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
label: '状态', |
||||
|
field: 'status', |
||||
|
sort: 'custom', |
||||
|
dictType: DICT_TYPE.QUALIFY_STATUS, |
||||
|
dictClass: 'string', |
||||
|
isForm: true, |
||||
|
isSearch: true, |
||||
|
isTable: true, |
||||
|
form: { |
||||
|
component: 'Switch', |
||||
|
value: '2', |
||||
|
componentProps: { |
||||
|
inactiveValue: '2', |
||||
|
activeValue: '1' |
||||
|
} |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
label: '备注', |
||||
|
field: 'remark', |
||||
|
sort: 'custom', |
||||
|
isSearch: false, |
||||
|
isTable: false |
||||
|
}, |
||||
|
{ |
||||
|
label: '操作', |
||||
|
field: 'action', |
||||
|
isForm: false, |
||||
|
table: { |
||||
|
width: 150, |
||||
|
fixed: 'right' |
||||
|
} |
||||
|
} |
||||
|
])) |
@ -0,0 +1,459 @@ |
|||||
|
<template> |
||||
|
<Dialog |
||||
|
:title="dialogTitle" |
||||
|
v-model="dialogVisible" |
||||
|
:width="dialogWidth" |
||||
|
:close-on-click-modal="false" |
||||
|
> |
||||
|
<div style="max-height: 60vh;overflow-y: auto;"> |
||||
|
<Form |
||||
|
ref="formRef" |
||||
|
v-loading="formLoading" |
||||
|
:rules="rules" |
||||
|
:schema="formSchema" |
||||
|
:is-col="true" |
||||
|
@opensearchTable="opensearchTable" |
||||
|
@onChange="onChange" |
||||
|
@onBlur="onBlur" /> |
||||
|
</div> |
||||
|
<template #footer> |
||||
|
<ButtonBase :Butttondata="Butttondata" @button-base-click="buttonBaseClick" /> |
||||
|
</template> |
||||
|
</Dialog> |
||||
|
<SearchTable ref="searchTableRef" @searchTableSuccess="searchTableSuccess" /> |
||||
|
</template> |
||||
|
<script setup lang="ts"> |
||||
|
import { SearchTable } from '@/components/SearchTable' |
||||
|
import * as defaultButtons from '@/utils/disposition/defaultButtons' |
||||
|
import ButtonBase from '@/components/XButton/src/ButtonBase.vue' |
||||
|
|
||||
|
const props = defineProps({ |
||||
|
// 查询弹窗是否显示筛选按钮 |
||||
|
isSearchFilterButtonHide: { |
||||
|
type: Boolean, |
||||
|
default: false |
||||
|
}, |
||||
|
// 显示窗口宽度设置 |
||||
|
basicFormWidth: { |
||||
|
type: String, |
||||
|
default: '' |
||||
|
}, |
||||
|
// 是否显示TableForm 新增/删除按钮 |
||||
|
isShowButton: { |
||||
|
type: Boolean, |
||||
|
default: true |
||||
|
}, |
||||
|
// 是否显示tableForm 删除按钮 |
||||
|
isShowReduceButton: { |
||||
|
type: Boolean, |
||||
|
default: true |
||||
|
}, |
||||
|
// 校验rules |
||||
|
rules: { |
||||
|
type: Object, |
||||
|
required: true, |
||||
|
default: null |
||||
|
}, |
||||
|
// 表单,列表 相关信息 |
||||
|
formAllSchemas: { |
||||
|
type: Object, |
||||
|
required: true, |
||||
|
default: null |
||||
|
}, |
||||
|
// 列表 相关信息 |
||||
|
tableAllSchemas: { |
||||
|
type: Array, |
||||
|
required: true, |
||||
|
default: null |
||||
|
}, |
||||
|
// 列表数据 |
||||
|
tableData: { |
||||
|
type: Array, |
||||
|
required: true, |
||||
|
default: null |
||||
|
}, |
||||
|
tableFormRules: { |
||||
|
type: Array, |
||||
|
required: true, |
||||
|
default: null |
||||
|
}, |
||||
|
// 查询参数 |
||||
|
// searchTableParams: { |
||||
|
// type: Array, |
||||
|
// required: false, |
||||
|
// default: null |
||||
|
// }, |
||||
|
// API——Vo |
||||
|
apiVo: { |
||||
|
type: Object, |
||||
|
required: true, |
||||
|
default: null |
||||
|
}, |
||||
|
// API——创建 |
||||
|
apiCreate: { |
||||
|
type: Function, |
||||
|
required: true, |
||||
|
default: null |
||||
|
}, |
||||
|
// API——编辑 |
||||
|
apiUpdate: { |
||||
|
type: Function, |
||||
|
required: true, |
||||
|
default: null |
||||
|
}, |
||||
|
// 是否是业务表单(区分是不显示tableForm) |
||||
|
isBusiness: { |
||||
|
type: Boolean, |
||||
|
required: true, |
||||
|
default: true |
||||
|
}, |
||||
|
// 表单form |
||||
|
form: { |
||||
|
type: Object, |
||||
|
required: true, |
||||
|
default: null |
||||
|
}, |
||||
|
// 详情数据 |
||||
|
detailData: { |
||||
|
type: Object, |
||||
|
required: true, |
||||
|
default: null |
||||
|
}, |
||||
|
// // 主表参数 |
||||
|
// masterParmas: { |
||||
|
// type: Object, |
||||
|
// required: false, |
||||
|
// default: null |
||||
|
// }, |
||||
|
// 来源 countPlan盘点计划进入 |
||||
|
fromeWhere: { |
||||
|
type: String, |
||||
|
required: false, |
||||
|
default: '' |
||||
|
}, |
||||
|
// 盘点范围类型 |
||||
|
countScopeType: { |
||||
|
type: Array, |
||||
|
required: false, |
||||
|
default: null |
||||
|
}, |
||||
|
// 是否从详情进入 |
||||
|
isDetail: { |
||||
|
type: Boolean, |
||||
|
required: false, |
||||
|
default: false |
||||
|
}, |
||||
|
// 窗体底部按钮:保存,关闭 |
||||
|
isShowFooterButtton: { |
||||
|
type: Boolean, |
||||
|
required: false, |
||||
|
default: true |
||||
|
}, |
||||
|
// 明细数据长度校验 |
||||
|
tableFormDataLength: { |
||||
|
type: Boolean, |
||||
|
required: false, |
||||
|
default: true |
||||
|
} |
||||
|
}) |
||||
|
|
||||
|
const { t } = useI18n() // 国际化 |
||||
|
const message = useMessage() // 消息弹窗 |
||||
|
const dialogWidth = ref() |
||||
|
if (props.basicFormWidth) { |
||||
|
dialogWidth.value = props.basicFormWidth + '%' |
||||
|
} else { |
||||
|
dialogWidth.value = props.isBusiness ? '60%' : '40%' |
||||
|
} |
||||
|
|
||||
|
const dialogVisible = ref(false) // 弹窗的是否展示 |
||||
|
const dialogTitle = ref('') // 弹窗的标题 |
||||
|
const formLoading = ref(false) // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用 |
||||
|
const formType = ref('') // 表单的类型:create - 新增;update - 修改 |
||||
|
|
||||
|
const formRef = ref() // 表单 Ref |
||||
|
const formSchema = ref(props.formAllSchemas?.formSchema) |
||||
|
const searchFilterButtonHide=ref(props.isSearchFilterButtonHide) |
||||
|
|
||||
|
/** 弹层操作 */ |
||||
|
// formField form表单中的字段 |
||||
|
// searchField 查询列表中的字段 |
||||
|
// type 发起事件位置 type=tableForm 是明细中发起的 否则 为主表发起的 |
||||
|
// searchCondition 查询条件 |
||||
|
const searchTableRef = ref() |
||||
|
const opensearchTable = ( |
||||
|
formField, |
||||
|
searchField, |
||||
|
searchTitle, |
||||
|
searchAllSchemas, |
||||
|
searchPage, |
||||
|
searchCondition, |
||||
|
multiple, |
||||
|
type, |
||||
|
row |
||||
|
) => { |
||||
|
const _searchCondition = {} |
||||
|
// 判断查询条件中,是否存在指向主表的数据 |
||||
|
if (searchCondition && searchCondition.length > 0) { |
||||
|
// 转换筛选条件所需 |
||||
|
let filters: any[] = [] |
||||
|
for (var i=0; i< searchCondition.length; i++ ) { |
||||
|
// searchCondition.forEach((item) => { |
||||
|
// 查询条件为主表某字段,需要赋值主表数据,数据来源是详情的,赋值需要从row中获取 |
||||
|
if (searchCondition[i].isMainValue) { |
||||
|
_searchCondition[searchCondition[i].key] = formRef.value.formModel[searchCondition[i].value] |
||||
|
? formRef.value.formModel[searchCondition[i].value] |
||||
|
: props.detailData |
||||
|
? props.detailData[searchCondition[i].value] |
||||
|
: row |
||||
|
? row[searchCondition[i].value] |
||||
|
: '' |
||||
|
// 是否含有空参数情况 |
||||
|
let isNull = false |
||||
|
if (_searchCondition[searchCondition[i].key] == '' || _searchCondition[searchCondition[i].key] == undefined) { |
||||
|
isNull = true |
||||
|
} |
||||
|
if (isNull) { |
||||
|
message.warning(searchCondition[i].message?searchCondition[i].message:'前置条件未选择!') |
||||
|
return |
||||
|
} |
||||
|
} else { |
||||
|
// 扩展 转换为筛选条件进行查询 |
||||
|
if (searchCondition[i].isSearch) { |
||||
|
filters.push({ |
||||
|
action: searchCondition[i].action, |
||||
|
column: searchCondition[i].key, |
||||
|
value: searchCondition[i].value |
||||
|
}) |
||||
|
} else { |
||||
|
_searchCondition[searchCondition[i].key] = searchCondition[i].value |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
if (filters.length > 0) { |
||||
|
_searchCondition.isSearch = true |
||||
|
_searchCondition.filters = filters |
||||
|
} |
||||
|
} |
||||
|
const _searchTableTitle = searchTitle |
||||
|
const _searchTableAllSchemas = searchAllSchemas |
||||
|
const _searchTablePage = searchPage |
||||
|
searchTableRef.value.open( |
||||
|
_searchTableTitle, |
||||
|
_searchTableAllSchemas, |
||||
|
_searchTablePage, |
||||
|
formField, |
||||
|
searchField, |
||||
|
multiple, |
||||
|
type, |
||||
|
row, |
||||
|
_searchCondition, |
||||
|
false, |
||||
|
searchFilterButtonHide.value |
||||
|
) |
||||
|
} |
||||
|
// 弹层确定返回所选数据 |
||||
|
// val : 弹层列表row 数据 |
||||
|
const searchTableSuccess = (formField, searchField, val, type, row) => { |
||||
|
emit('searchTableSuccess', formField, searchField, val, formRef.value, type, row) |
||||
|
} |
||||
|
|
||||
|
/** 打开弹窗 */ |
||||
|
const open = async (type: string, row?: any, masterParmas?: any, titleName?: any) => { |
||||
|
dialogVisible.value = true |
||||
|
if (titleName) { |
||||
|
dialogTitle.value = t('action.' + titleName) |
||||
|
} else { |
||||
|
dialogTitle.value = t('action.' + type) |
||||
|
} |
||||
|
formType.value = type |
||||
|
resetForm() |
||||
|
// 修改时,设置数据 |
||||
|
// 如果是从主表的详情页面进图添加子表,需要添加masterId,number参数 |
||||
|
if (masterParmas) { |
||||
|
if (!row) { |
||||
|
row = { |
||||
|
masterId: masterParmas.masterId, |
||||
|
number: masterParmas.number |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
if (row?.id || row?.masterId) { |
||||
|
formLoading.value = true |
||||
|
try { |
||||
|
nextTick(() => { |
||||
|
formRef.value.setValues(row) |
||||
|
}) |
||||
|
} finally { |
||||
|
formLoading.value = false |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
defineExpose({ open, formRef, opensearchTable, dialogVisible, formLoading }) // 提供 open 方法,用于打开弹窗 |
||||
|
|
||||
|
/** 弹窗按钮 */ |
||||
|
let Butttondata:any = [] |
||||
|
if (props.isShowFooterButtton) { |
||||
|
Butttondata = [ |
||||
|
defaultButtons.formSaveBtn(null), // 保存 |
||||
|
defaultButtons.formCloseBtn(null) // 关闭 |
||||
|
] |
||||
|
} |
||||
|
|
||||
|
/** 按钮事件 */ |
||||
|
const buttonBaseClick = (val) => { |
||||
|
// 保存 |
||||
|
if (val == 'save') { |
||||
|
submitForm() |
||||
|
} |
||||
|
// 关闭 |
||||
|
else if (val == 'close') { |
||||
|
dialogVisible.value = false |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/** 提交表单 */ |
||||
|
// const emit = defineEmits(['success']) // 定义 success 事件,用于操作成功后的回调 |
||||
|
|
||||
|
const tableFormRef = ref() |
||||
|
const submitForm = async () => { |
||||
|
const elForm = unref(formRef)?.getElFormRef() |
||||
|
// 校验表单 |
||||
|
if (!elForm) return |
||||
|
const valid = await elForm.validate() |
||||
|
if (!valid) return |
||||
|
// 针对主子表 明细校验 |
||||
|
if (props.isBusiness) { |
||||
|
formLoading.value = true |
||||
|
if (formType.value == 'create') { |
||||
|
const validateForm = await tableFormRef.value.validateForm() |
||||
|
formRef.value.setValues({status:'1'}) |
||||
|
if (!validateForm && props.tableFormDataLength) { |
||||
|
if (props.tableData.length == 0) { |
||||
|
message.warning('请填写明细信息!') |
||||
|
formLoading.value = false |
||||
|
return |
||||
|
} |
||||
|
formLoading.value = false |
||||
|
return |
||||
|
} |
||||
|
// 主子表——提交请求 |
||||
|
try { |
||||
|
const data = unref(formRef)?.formModel |
||||
|
emit('submitForm', formType.value, data) |
||||
|
} finally { |
||||
|
} |
||||
|
} else { |
||||
|
// 编辑 |
||||
|
try { |
||||
|
const data = unref(formRef)?.formModel |
||||
|
emit('submitForm', formType.value, data) |
||||
|
} finally { |
||||
|
} |
||||
|
} |
||||
|
} else { |
||||
|
// 基础数据单表——提交请求 |
||||
|
formLoading.value = true |
||||
|
try { |
||||
|
const data = unref(formRef)?.formModel |
||||
|
emit('success', formType.value, data) |
||||
|
} finally { |
||||
|
formLoading.value = false |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/** 重置表单 */ |
||||
|
const resetForm = () => { |
||||
|
unref(formRef)?.resetFields() |
||||
|
} |
||||
|
|
||||
|
// 传递给父类 |
||||
|
const emit = defineEmits([ |
||||
|
'success', |
||||
|
'tableSelectionChange', |
||||
|
'tableFormSelectOnBlur', |
||||
|
'extendedButtonsClick', |
||||
|
'formSelectChange', |
||||
|
'formSelectvVisibleChange', |
||||
|
'tableSortChange', |
||||
|
'selectCallback', |
||||
|
'handleTableSelect', |
||||
|
'handleDeleteTable', |
||||
|
'handleAddTable', |
||||
|
'inpuFocus', |
||||
|
'searchTableSuccess', |
||||
|
'opensearchTable', |
||||
|
'submitForm', |
||||
|
'selectChange', |
||||
|
'selectChangeDetail', |
||||
|
'tableFormChange', |
||||
|
'buttonOperationClick', |
||||
|
'inputStringBlur', |
||||
|
'onChange', |
||||
|
'onBlur', |
||||
|
'inputNumberChange', |
||||
|
'formFormDateChange' |
||||
|
]) |
||||
|
|
||||
|
/** |
||||
|
* 监听改变事件 |
||||
|
* @param field 当前操作字段 |
||||
|
* @param cur 改变后值 |
||||
|
*/ |
||||
|
const onChange = (field, cur) => { |
||||
|
emit('onChange', field, cur) |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 监听失焦事件 |
||||
|
* @param field 当前操作字段 |
||||
|
* @param e |
||||
|
*/ |
||||
|
const onBlur = (field, e) => { |
||||
|
emit('onBlur', field, e) |
||||
|
} |
||||
|
</script> |
||||
|
<style lang="scss" scoped> |
||||
|
.table { |
||||
|
border: 1px solid #dedede; |
||||
|
border-radius: 8px; |
||||
|
padding: 10px; |
||||
|
width: calc(100% - 32px); |
||||
|
display: flex; |
||||
|
} |
||||
|
::v-deep(.el-table__body) { |
||||
|
padding: 10px 0px; |
||||
|
} |
||||
|
::v-deep(.el-table--default .el-table__cell) { |
||||
|
padding: 2px 0px; |
||||
|
border: none; |
||||
|
} |
||||
|
|
||||
|
::v-deep(.el-table td.el-table__cell .el-form-item__content) { |
||||
|
display: flex !important; |
||||
|
align-items: center !important; |
||||
|
justify-content: center !important; |
||||
|
} |
||||
|
::v-deep(.el-table td.el-table__cell div) { |
||||
|
overflow: visible; |
||||
|
} |
||||
|
|
||||
|
::v-deep(.el-icon) { |
||||
|
display: block; |
||||
|
}button |
||||
|
.button { |
||||
|
> div { |
||||
|
display: flex; |
||||
|
align-items: center; |
||||
|
justify-content: center; |
||||
|
cursor: pointer; |
||||
|
|
||||
|
> div { |
||||
|
margin-left: 6px; |
||||
|
text-decoration: underline; |
||||
|
color: #409eff; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
</style> |
@ -0,0 +1,237 @@ |
|||||
|
<template> |
||||
|
<div> |
||||
|
<el-drawer |
||||
|
v-model="isShowDrawer" |
||||
|
title="详情" |
||||
|
direction="rtl" |
||||
|
size="80%" |
||||
|
v-loading="detailLoading" |
||||
|
> |
||||
|
<template #header> |
||||
|
<div class="font-size-18px"> |
||||
|
{{ titleValueRef }} <span class="ml-20px font-size-16px">{{ titleNameRef }}</span> |
||||
|
</div> |
||||
|
</template> |
||||
|
<ContentWrap> |
||||
|
<Descriptions |
||||
|
:data="detailData" |
||||
|
labelClassName="label-class-name" |
||||
|
label-align="left" |
||||
|
direction="vertical" |
||||
|
:column="8" |
||||
|
:schema="allSchemas.detailSchema" |
||||
|
:columns="2" |
||||
|
width="200px" |
||||
|
/> |
||||
|
</ContentWrap> |
||||
|
|
||||
|
<el-tabs v-model="activeName" type="card" @tab-click="handleClick"> |
||||
|
<el-tab-pane label="工艺路线信息" name="processRouteInfo"> |
||||
|
<div class="mt-20px"> |
||||
|
<el-space :size="10" spacer="|"> |
||||
|
<span>名称:<el-tag v-if="processRouteInfoSchema.processrouteInfo!=null">{{ processRouteInfoSchema.processrouteInfo.processName}} </el-tag></span> |
||||
|
<span>编码:<el-tag v-if="processRouteInfoSchema.processrouteInfo!=null">{{ processRouteInfoSchema.processrouteInfo.processrouteCode}} </el-tag> </span> |
||||
|
<span>版本:<el-tag v-if="processRouteInfoSchema.processrouteInfo!=null">{{ processRouteInfoSchema.processrouteInfo.routeVersion}} </el-tag> </span> |
||||
|
</el-space> |
||||
|
<el-divider /> |
||||
|
<el-table |
||||
|
ref="tableRoute" |
||||
|
:data="nodeData" |
||||
|
:columns="nodeColumns" |
||||
|
border |
||||
|
stripe="true" |
||||
|
style="width: 100%" |
||||
|
> |
||||
|
<el-table-column prop="nodeSort" label="序号" align="center"/> |
||||
|
<el-table-column prop="preCode" label="前置工序" align="center"> |
||||
|
|
||||
|
<template #default="scope"> |
||||
|
<div style="display: flex; align-items: center"> |
||||
|
<el-tag |
||||
|
>{{ scope.row.preNodeName }}</el-tag |
||||
|
> |
||||
|
</div> |
||||
|
</template> |
||||
|
</el-table-column> |
||||
|
<el-table-column prop="processCode" label="当前工序" align="center" > |
||||
|
<template #default="scope"> |
||||
|
<div style="display: flex; align-items: center"> |
||||
|
<el-tag |
||||
|
>{{ scope.row.nodeName }}</el-tag |
||||
|
> |
||||
|
</div> |
||||
|
</template> |
||||
|
</el-table-column> |
||||
|
<el-table-column prop="nextCode" label="后置工序" align="center"> |
||||
|
<template #default="scope"> |
||||
|
<div style="display: flex; align-items: center"> |
||||
|
<el-tag |
||||
|
>{{ scope.row.nextNodeName }}</el-tag |
||||
|
> |
||||
|
</div> |
||||
|
</template> |
||||
|
</el-table-column> |
||||
|
</el-table> |
||||
|
</div> |
||||
|
</el-tab-pane> |
||||
|
<el-tab-pane label="BOM信息" name="bomInfo" |
||||
|
><div class="mt-20px"> |
||||
|
<el-table |
||||
|
ref="tableRoute" |
||||
|
:data="bomInfoSchemaData" |
||||
|
style="width: 100%" |
||||
|
> |
||||
|
<el-table-column prop="productItemCode" label="父物料代码" align="center" /> |
||||
|
<el-table-column prop="componentItemCode" label="子物料代码" align="center" /> |
||||
|
<el-table-column prop="componentUom" label="子物料计量单位" align="center" /> |
||||
|
<el-table-column prop="componentQty" label="子物料数量" align="center"/> |
||||
|
<el-table-column prop="version" label="版本" align="center" /> |
||||
|
</el-table> </div |
||||
|
></el-tab-pane> |
||||
|
<el-tab-pane label="班组人员信息" name="workTeamInfo" |
||||
|
><div class="mt-20px"> |
||||
|
<el-table |
||||
|
ref="tableRoute" |
||||
|
:data="workTeamInfoSchema" |
||||
|
style="width: 100%" |
||||
|
> |
||||
|
<el-table-column prop="id" label="ID" align="center" /> |
||||
|
<el-table-column prop="userName" label="人员工号" align="center" /> |
||||
|
<el-table-column prop="nickeName" label="显示名称" align="center" /> |
||||
|
<el-table-column prop="workGroup" label="所属班组" align="center" /> |
||||
|
<el-table-column prop="lineCode" label="所属产线" align="center" /> |
||||
|
<el-table-column prop="abliity" label="技能岗位" align="center" /> |
||||
|
</el-table> </div |
||||
|
></el-tab-pane> |
||||
|
<el-tab-pane label="设备信息" name="deviceInfo" |
||||
|
><div class="mt-20px"> |
||||
|
<el-table |
||||
|
ref="tableRoute" |
||||
|
:data="deviceInfoSchema" |
||||
|
style="width: 100%" |
||||
|
> |
||||
|
<el-table-column prop="productItemCode" label="设备编码" align="center" /> |
||||
|
<el-table-column prop="componentItemCode" label="设备名称" align="center" /> |
||||
|
<el-table-column prop="componentUom" label="所属车间" align="center" /> |
||||
|
<el-table-column prop="componentQty" label="所属产线" align="center"/> |
||||
|
<el-table-column prop="status" label="设备状态" align="center" /> |
||||
|
</el-table> </div |
||||
|
></el-tab-pane> |
||||
|
</el-tabs> |
||||
|
</el-drawer> |
||||
|
</div> |
||||
|
</template> |
||||
|
|
||||
|
<script lang="ts" setup> |
||||
|
import * as OrderDayApi from '@/api/mes/orderDay' |
||||
|
defineOptions({ name: 'orderDetail' }) |
||||
|
const message = useMessage() // 消息弹窗 |
||||
|
const { t } = useI18n() // 国际化 |
||||
|
const route = useRoute() // 路由信息 |
||||
|
const routeName = ref() |
||||
|
routeName.value = route.name |
||||
|
routeName.value = routeName.value.substring(0, routeName.value.length - 4) + 'Detail' |
||||
|
const activeName = ref('processRouteInfo') |
||||
|
const props = defineProps({ |
||||
|
allSchemas: { |
||||
|
type: Object, |
||||
|
required: true, |
||||
|
default: null |
||||
|
} |
||||
|
}) |
||||
|
const detailData = ref(props.allSchemas) |
||||
|
|
||||
|
const bomInfoSchemaData = ref( [{productItemCode:'----', |
||||
|
componentItemCode:'----', |
||||
|
componentUom:'----', |
||||
|
componentQty:'----', |
||||
|
version:'----'}]) |
||||
|
const workTeamInfoSchema = ref( [] ) |
||||
|
const deviceInfoSchema = ref([]) |
||||
|
const processRouteInfoSchema = ref({ |
||||
|
processrouteInfo: { processrouteCode: '', processName: '', routeVersion: '' }, |
||||
|
processrouteNodeDetailList: [] |
||||
|
}) |
||||
|
|
||||
|
const isShowDrawer = ref(false) |
||||
|
const detailLoading = ref(false) |
||||
|
const nodeColumns = ref([ |
||||
|
|
||||
|
{ |
||||
|
label: '序号', |
||||
|
field: 'nodeSort' |
||||
|
}, |
||||
|
{ |
||||
|
label: '当前工序', |
||||
|
field: 'processCode' |
||||
|
}, |
||||
|
{ |
||||
|
label: '前置工序', |
||||
|
field: 'preCode' |
||||
|
}, |
||||
|
{ |
||||
|
label: '后置工序', |
||||
|
field: 'nextCode' |
||||
|
} |
||||
|
]) |
||||
|
const nodeData = ref([{}]) |
||||
|
// Tabs当前选择 |
||||
|
const current = ref(0) |
||||
|
const handleClick = (item, index) => { |
||||
|
current.value = index |
||||
|
emit('changeTabs', item) |
||||
|
} |
||||
|
|
||||
|
/** 打开弹窗 */ |
||||
|
const formRef = ref() |
||||
|
const titleNameRef = ref() |
||||
|
const titleValueRef = ref() |
||||
|
const openDetail = async (row: any, titleName: any, titleValue: any, tableName: any) => { |
||||
|
titleNameRef.value = titleName |
||||
|
titleValueRef.value = titleValue |
||||
|
isShowDrawer.value = true |
||||
|
if (row) { |
||||
|
detailLoading.value = true |
||||
|
try { |
||||
|
detailData.value = row |
||||
|
getDetailData(row) |
||||
|
} finally { |
||||
|
detailLoading.value = false |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
defineExpose({ openDetail, formRef }) // 提供 open 方法,用于打开弹窗 |
||||
|
const getDetailData = async (row: any) => { |
||||
|
processRouteInfoSchema.value = await OrderDayApi.getProcessroutesDetail(row.processrouteCode) |
||||
|
let pam={code:row.standardBom.slice(0,row.standardBom.lastIndexOf('-')),version:row.standardBom.slice(row.standardBom.lastIndexOf('-')+1)} |
||||
|
//console.log(pam) |
||||
|
bomInfoSchemaData.value = await OrderDayApi.getPlanBom(pam) |
||||
|
nodeData.value = processRouteInfoSchema.value.processrouteNodeDetailList |
||||
|
|
||||
|
} |
||||
|
// 传递给父类 |
||||
|
const emit = defineEmits([ |
||||
|
'searchTableSuccessDetail', |
||||
|
'changeTabs', |
||||
|
'selectChangeDetail', |
||||
|
'detailOpenForm', |
||||
|
'tableFormButton', |
||||
|
'openImage', |
||||
|
'onBlur', |
||||
|
'detailBasicFormOnChange', |
||||
|
'formFormDateChange' |
||||
|
]) |
||||
|
|
||||
|
//监视属性 |
||||
|
watch() |
||||
|
</script> |
||||
|
<style lang="scss"> |
||||
|
.el-drawer__body { |
||||
|
background: #f5f5f5 !important; |
||||
|
} |
||||
|
|
||||
|
::v-deep(.label-class-name) { |
||||
|
color: #dedede; |
||||
|
} |
||||
|
</style> |
||||
|
<style scoped lang="scss"></style> |
@ -0,0 +1,332 @@ |
|||||
|
<template> |
||||
|
<Dialog |
||||
|
:title="dialogTitle" |
||||
|
v-model="dialogVisible" |
||||
|
:width="dialogWidth" |
||||
|
:close-on-click-modal="false" |
||||
|
> |
||||
|
<ContentWrap> |
||||
|
<Descriptions |
||||
|
:data="detailData" |
||||
|
labelClassName="label-class-name" |
||||
|
label-align="left" |
||||
|
direction="vertical" |
||||
|
:column="8" |
||||
|
:schema="allSchemas.detailSchema" |
||||
|
:columns="2" |
||||
|
width="200px" |
||||
|
/> |
||||
|
</ContentWrap> |
||||
|
<div style="height: 480px; overflow-y: auto"> |
||||
|
<el-tabs type="border-card" :active-name="activeName"> |
||||
|
<el-tab-pane label="调整工艺路线" name="process"> |
||||
|
<el-container> |
||||
|
<el-aside> |
||||
|
<el-card style="max-width: 480px"> |
||||
|
<template #header> |
||||
|
<div class="card-header"> |
||||
|
<span>原有工序</span> |
||||
|
</div> |
||||
|
</template> |
||||
|
<el-table :data="processData" ref="tableProcess" style="width: 100%; height: 80%"> |
||||
|
<el-table-column prop="name" label="工序名称"> |
||||
|
<template #default="scope"> |
||||
|
<el-button size="mini" text @click="userAddNode(scope.row)" style="width: 100%" |
||||
|
>{{ scope.row.name }}[{{ scope.row.code }}]</el-button |
||||
|
> |
||||
|
</template> |
||||
|
</el-table-column> |
||||
|
<el-table-column prop="code" label="工序编码" width="180" v-if="false" /> |
||||
|
</el-table> |
||||
|
</el-card> |
||||
|
</el-aside> |
||||
|
<el-main><div ref="graphContainer"></div></el-main> |
||||
|
<!-- <el-aside |
||||
|
><el-card style="max-width: 480px"> |
||||
|
<template #header> |
||||
|
<div class="card-header"> |
||||
|
<span>可选工序</span> |
||||
|
</div> |
||||
|
</template> |
||||
|
<p v-for="o in 4" :key="o" class="text item">{{ 'List item ' + o }}</p> |
||||
|
<template #footer>Footer content</template> |
||||
|
</el-card></el-aside |
||||
|
> --> |
||||
|
</el-container> |
||||
|
</el-tab-pane> |
||||
|
<el-tab-pane label="调整临时BOM" name="boms"> |
||||
|
<TableForm |
||||
|
ref="tableProcess" |
||||
|
:table-data="tableDataProcess" |
||||
|
:table-fields="tableColumnsProcess" |
||||
|
:loading="loading" |
||||
|
@handleAddTable="handleAddTable(tableDataProcess)" |
||||
|
@handle-delete-table="handleDeleteTable(item, index,tableDataProcess)" |
||||
|
/> |
||||
|
</el-tab-pane> |
||||
|
|
||||
|
<el-tab-pane label="调整可用设备" name="device" |
||||
|
><TableForm |
||||
|
ref="tableProcess" |
||||
|
:table-data="tableDataProcess" |
||||
|
:table-fields="tableColumnsProcess" |
||||
|
:loading="loading" |
||||
|
@handleAddTable="handleAddTable(tableDataProcess)" |
||||
|
@handle-delete-table="handleDeleteTable(item, index,tableDataProcess)" |
||||
|
/></el-tab-pane> |
||||
|
<el-tab-pane label="调整班组人员" name="worker" |
||||
|
><TableForm |
||||
|
ref="tableProcess" |
||||
|
:table-data="tableDataProcess" |
||||
|
:table-fields="tableColumnsProcess" |
||||
|
:loading="loading" |
||||
|
@handleAddTable="handleAddTable(tableDataProcess)" |
||||
|
@handle-delete-table="handleDeleteTable(item, index,tableDataProcess)" |
||||
|
/></el-tab-pane> |
||||
|
</el-tabs> |
||||
|
</div> |
||||
|
<template #footer> |
||||
|
<el-button @click="dialogVisible = false">发布计划</el-button> |
||||
|
</template> |
||||
|
</Dialog> |
||||
|
<!-- <SearchTable ref="searchTableRef" @searchTableSuccess="searchTableSuccess" /> --> |
||||
|
</template> |
||||
|
|
||||
|
<script lang="ts" setup> |
||||
|
defineOptions({ name: 'sechledDetail' }) |
||||
|
//import { dateFormatter } from '@/utils/formatTime' |
||||
|
import { |
||||
|
start_node, |
||||
|
end_node, |
||||
|
createGraph, |
||||
|
getNewNode |
||||
|
} from '@/views/mes/processroute/components/graphbase.data' |
||||
|
import * as ProcessrouteApi from '@/api/mes/processroute' |
||||
|
import { Graph } from '@antv/x6' |
||||
|
const graphContainer = ref<HTMLElement | null>(null) |
||||
|
const graph = ref<Graph>() |
||||
|
const message = useMessage() // 消息弹窗 |
||||
|
const { t } = useI18n() // 国际化 |
||||
|
const activeName = ref('process') |
||||
|
const loading = ref(true) |
||||
|
const processData=ref() |
||||
|
const props = defineProps({ |
||||
|
// 查询弹窗是否显示筛选按钮 |
||||
|
isSearchFilterButtonHide: { |
||||
|
type: Boolean, |
||||
|
default: false |
||||
|
}, |
||||
|
// 显示窗口宽度设置 |
||||
|
basicFormWidth: { |
||||
|
type: String, |
||||
|
default: '' |
||||
|
}, |
||||
|
|
||||
|
allSchemas: { |
||||
|
type: Object, |
||||
|
required: true, |
||||
|
default: null |
||||
|
} |
||||
|
}) |
||||
|
const detailData = ref(props.allSchemas) |
||||
|
const route = useRoute() // 路由信息 |
||||
|
const routeName = ref() |
||||
|
const tableDataProcess = ref([ |
||||
|
{ |
||||
|
type: '', |
||||
|
value: '' |
||||
|
} |
||||
|
]) |
||||
|
const tableColumnsProcess = ref([ |
||||
|
{ |
||||
|
label: '结束时间', |
||||
|
field: 'endTime', |
||||
|
sort: 'custom', |
||||
|
isReadonly: true, |
||||
|
form: { |
||||
|
component: 'TimePicker', |
||||
|
componentProps: { |
||||
|
type: 'time', |
||||
|
dateFormat: 'HH:mm' |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '生产模式', |
||||
|
field: 'taskMode', |
||||
|
width: '80px', |
||||
|
sort: 'custom', |
||||
|
dictType: 'mes_task_mode', |
||||
|
dictClass: 'string', |
||||
|
form: { |
||||
|
component: 'Select', |
||||
|
value: 'ASSIGN' |
||||
|
} |
||||
|
} |
||||
|
]) |
||||
|
|
||||
|
// 添加数据 |
||||
|
const handleAddTable = (name:any) => { |
||||
|
message.success('添加成功') |
||||
|
let tableFormKeys = { |
||||
|
type: '', |
||||
|
value: '' |
||||
|
} |
||||
|
name.push(JSON.parse(JSON.stringify(tableFormKeys))) |
||||
|
} |
||||
|
// 删除明细 |
||||
|
const handleDeleteTable = (item, index,name) => { |
||||
|
console.log(name) |
||||
|
name.splice(index, 1) |
||||
|
} |
||||
|
|
||||
|
routeName.value = route.name |
||||
|
routeName.value = routeName.value.substring(0, routeName.value.length - 4) + 'Detail' |
||||
|
//const updateKey = ref(0) |
||||
|
const dialogWidth = ref() |
||||
|
// if (props.basicFormWidth) { |
||||
|
// dialogWidth.value = props.basicFormWidth + '%' |
||||
|
// } else { |
||||
|
// dialogWidth.value = props.isBusiness ? '60%' : '40%' |
||||
|
// } |
||||
|
|
||||
|
const dialogVisible = ref(false) // 弹窗的是否展示 |
||||
|
const dialogTitle = ref('') // 弹窗的标题 |
||||
|
let graphJson = { |
||||
|
cells: [ |
||||
|
{ |
||||
|
position: { |
||||
|
x: 40, |
||||
|
y: 40 |
||||
|
}, |
||||
|
size: { |
||||
|
width: 100, |
||||
|
height: 40 |
||||
|
}, |
||||
|
attrs: { |
||||
|
text: { |
||||
|
text: 'Hello' |
||||
|
}, |
||||
|
body: { |
||||
|
stroke: '#8f8f8f', |
||||
|
strokeWidth: 1, |
||||
|
fill: '#fff', |
||||
|
rx: 6, |
||||
|
ry: 6 |
||||
|
} |
||||
|
}, |
||||
|
visible: true, |
||||
|
shape: 'rect', |
||||
|
id: 'adbc20c6-96e4-4792-9e5b-42df6066cff0', |
||||
|
zIndex: 1 |
||||
|
}, |
||||
|
{ |
||||
|
position: { |
||||
|
x: 240, |
||||
|
y: 180 |
||||
|
}, |
||||
|
size: { |
||||
|
width: 100, |
||||
|
height: 40 |
||||
|
}, |
||||
|
attrs: { |
||||
|
text: { |
||||
|
text: 'World' |
||||
|
}, |
||||
|
body: { |
||||
|
stroke: '#8f8f8f', |
||||
|
strokeWidth: 1, |
||||
|
fill: '#fff', |
||||
|
rx: 6, |
||||
|
ry: 6 |
||||
|
} |
||||
|
}, |
||||
|
visible: true, |
||||
|
shape: 'ellipse', |
||||
|
id: '9b1f1e94-a01f-4902-bfae-4e6e81029261', |
||||
|
zIndex: 2 |
||||
|
}, |
||||
|
{ |
||||
|
shape: 'edge', |
||||
|
attrs: { |
||||
|
line: { |
||||
|
stroke: '#8f8f8f', |
||||
|
strokeWidth: 1 |
||||
|
} |
||||
|
}, |
||||
|
id: '8fd50f13-22ba-41ff-b54a-eb6d8553c3d7', |
||||
|
source: { |
||||
|
cell: 'adbc20c6-96e4-4792-9e5b-42df6066cff0' |
||||
|
}, |
||||
|
target: { |
||||
|
cell: '9b1f1e94-a01f-4902-bfae-4e6e81029261' |
||||
|
}, |
||||
|
labels: [ |
||||
|
{ |
||||
|
attrs: { |
||||
|
label: { |
||||
|
text: 'X6' |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
], |
||||
|
zIndex: 3 |
||||
|
} |
||||
|
] |
||||
|
} |
||||
|
/** 打开弹窗 */ |
||||
|
const open = async (type: string, row?: any, titleName?: any) => { |
||||
|
dialogVisible.value = true |
||||
|
detailData.value = row |
||||
|
dialogWidth.value = props.basicFormWidth + '%' |
||||
|
//console.log(props.allSchemas) |
||||
|
//console.log(row) |
||||
|
if (titleName) { |
||||
|
dialogTitle.value = t('action.' + titleName) |
||||
|
} else { |
||||
|
dialogTitle.value = t('action.' + type) |
||||
|
} |
||||
|
nextTick(() => { |
||||
|
graph.value = createGraph(graphContainer.value as HTMLElement, false, dialogWidth.value-200, 320) |
||||
|
// graph.value.on('node:click', ({ e, x, y, node, view }) => { |
||||
|
// nodeClick(e, x, y, node, view) |
||||
|
// }) |
||||
|
graph.value?.fromJSON(graphJson.cells) |
||||
|
}) |
||||
|
} |
||||
|
|
||||
|
//添加节点 |
||||
|
const userAddNode = (row) => { |
||||
|
if (graph && graph.value != undefined) { |
||||
|
let node_template = getNewNode(row.code, row.name, row.code) |
||||
|
node_template.x = end_node.value.x - 100 |
||||
|
node_template.y = end_node.value.y + 100 |
||||
|
let noden = graph.value.addNode(node_template) |
||||
|
if (graph.value.getNodes().length == 1) { |
||||
|
let start = graph.value.addNode(start_node.value) |
||||
|
let end = graph.value.addNode(end_node.value) |
||||
|
graph.value.addEdge({ |
||||
|
id: 'startEdge', |
||||
|
source: start.id, // 源节点 ID |
||||
|
target: noden.id |
||||
|
}) |
||||
|
graph.value.addEdge({ |
||||
|
id: 'endEdge', |
||||
|
source: noden.id, // 源节点 ID |
||||
|
target: end.id |
||||
|
}) |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
defineExpose({ open }) // 提供 open 方法,用于打开弹窗 |
||||
|
</script> |
||||
|
<style lang="scss"> |
||||
|
.el-drawer__body { |
||||
|
background: #f5f5f5 !important; |
||||
|
} |
||||
|
|
||||
|
::v-deep(.label-class-name) { |
||||
|
color: #dedede; |
||||
|
} |
||||
|
</style> |
||||
|
<style scoped lang="scss"></style> |
@ -0,0 +1,331 @@ |
|||||
|
<template> |
||||
|
<ContentWrap> |
||||
|
<!-- 搜索工作栏 --> |
||||
|
<Search |
||||
|
:schema="OrderDay.allSchemas.searchSchema" |
||||
|
@search="setSearchParams" |
||||
|
@reset="setSearchParams" |
||||
|
/> |
||||
|
</ContentWrap> |
||||
|
|
||||
|
<!-- 列表头部 --> |
||||
|
<TableHead |
||||
|
:HeadButttondata="HeadButttondata" |
||||
|
@button-base-click="buttonBaseClick" |
||||
|
:routeName="routeName" |
||||
|
@updataTableColumns="updataTableColumns" |
||||
|
@searchFormClick="searchFormClick" |
||||
|
:allSchemas="OrderDay.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 #planNoDay="{ row }"> |
||||
|
<el-button type="primary" link @click="openDetail(row, '计划编码', row.planNoDay)"> |
||||
|
<span>{{ row.planNoDay }}</span> |
||||
|
</el-button> |
||||
|
</template> |
||||
|
<template #action="{ row }"> |
||||
|
<ButtonBase |
||||
|
:Butttondata="butttondata(row)" |
||||
|
@button-base-click="buttonTableClick($event, row)" |
||||
|
/> |
||||
|
</template> |
||||
|
</Table> |
||||
|
</ContentWrap> |
||||
|
|
||||
|
<!-- 表单弹窗:添加/修改 --> |
||||
|
<BasicFormV2 |
||||
|
ref="basicFormRef" |
||||
|
@success="formsSuccess" |
||||
|
:rules="OrderDayRules" |
||||
|
:formAllSchemas="OrderDay.allSchemas" |
||||
|
:apiUpdate="OrderDayApi.updateOrderDay" |
||||
|
:apiCreate="OrderDayApi.createOrderDay" |
||||
|
@searchTableSuccess="searchTableSuccess" |
||||
|
:isBusiness="false" |
||||
|
:isSearchFilterButtonHide="true" |
||||
|
/> |
||||
|
|
||||
|
<!-- 详情 --> |
||||
|
<orderDetail ref="detailRef" :all-schemas="OrderDay.allSchemas" /> |
||||
|
<scheduleDetail ref="scheduleDetailRef" :all-schemas="OrderDay.allSchemas" :basicFormWidth="75"/> |
||||
|
<!-- 导入 --> |
||||
|
<ImportForm |
||||
|
ref="importFormRef" |
||||
|
url="/mes/orderday/import" |
||||
|
:importTemplateData="importTemplateData" |
||||
|
@success="importSuccess" |
||||
|
/> |
||||
|
</template> |
||||
|
|
||||
|
<script setup lang="ts"> |
||||
|
import download from '@/utils/download' |
||||
|
import { OrderDay,OrderDayRules } from './orderDay.data' |
||||
|
import * as OrderDayApi from '@/api/mes/orderDay' |
||||
|
import BasicFormV2 from './components/BasicFormV2.vue' |
||||
|
import * as defaultButtons from '@/utils/disposition/defaultButtons' |
||||
|
import TableHead from '@/components/TableHead/src/TableHead.vue' |
||||
|
import ImportForm from '@/components/ImportForm/src/ImportForm.vue' |
||||
|
import orderDetail from './components/orderDetail.vue' |
||||
|
import scheduleDetail from './components/schedule.vue' |
||||
|
defineOptions({ name: 'MesOrderDay' }) |
||||
|
|
||||
|
const message = useMessage() // 消息弹窗 |
||||
|
const { t } = useI18n() // 国际化 |
||||
|
|
||||
|
const route = useRoute() // 路由信息 |
||||
|
const routeName = ref() |
||||
|
routeName.value = route.name |
||||
|
const tableColumns = ref(OrderDay.allSchemas.tableColumns) |
||||
|
const lineOptions=ref([]) |
||||
|
const processRouteOptions=ref([]) |
||||
|
const bomOptions=ref([]) |
||||
|
|
||||
|
//**获取 产品工艺路由列表 */ |
||||
|
const getProcessroutes = async (code: String) => { |
||||
|
processRouteOptions.value = await OrderDayApi.getProcessroutes(code) |
||||
|
OrderDay.allSchemas.formSchema.forEach(item => { |
||||
|
if (item.field == 'processrouteCode') { |
||||
|
console.log('processrouteCode',item.field) |
||||
|
item.componentProps.options = processRouteOptions.value |
||||
|
} |
||||
|
}) |
||||
|
} |
||||
|
//**获取 车间产线列表 */ |
||||
|
const getProductlines = async (code: String) => { |
||||
|
lineOptions.value = await OrderDayApi.getProductlines(code) |
||||
|
OrderDay.allSchemas.formSchema.forEach(item => { |
||||
|
if (item.field == 'lineCode') { |
||||
|
item.componentProps.options = lineOptions.value |
||||
|
} |
||||
|
}) |
||||
|
} |
||||
|
const getBoms = async (code: String) => { |
||||
|
bomOptions.value = await OrderDayApi.getBoms(code) |
||||
|
OrderDay.allSchemas.formSchema.forEach(item => { |
||||
|
if (item.field == 'standardBom') { |
||||
|
item.componentProps.options = bomOptions.value |
||||
|
} |
||||
|
}) |
||||
|
} |
||||
|
// 查询页面返回 |
||||
|
const searchTableSuccess = (formField, searchField, val, formRef) => { |
||||
|
nextTick(() => { |
||||
|
const setV = {} |
||||
|
setV[formField] = val[0][searchField] |
||||
|
formRef.setValues(setV) |
||||
|
if(formField=='productCode'){ |
||||
|
//formRef.setValues({standardBom:'bomddd'}) |
||||
|
getProcessroutes(val[0][searchField]) |
||||
|
getBoms(val[0][searchField]) |
||||
|
} |
||||
|
if(formField=='workroomCode'){ |
||||
|
getProductlines(val[0][searchField]) |
||||
|
} |
||||
|
|
||||
|
}) |
||||
|
|
||||
|
} |
||||
|
|
||||
|
// 字段设置 更新主列表字段 |
||||
|
const updataTableColumns = (val) => { |
||||
|
tableColumns.value = val |
||||
|
} |
||||
|
|
||||
|
const { tableObject, tableMethods } = useTable({ |
||||
|
getListApi: OrderDayApi.getOrderDayPage // 分页接口 |
||||
|
|
||||
|
}) |
||||
|
|
||||
|
// 获得表格的各种操作 |
||||
|
const { getList, setSearchParams } = tableMethods |
||||
|
|
||||
|
// 列表头部按钮 |
||||
|
const HeadButttondata = [ |
||||
|
defaultButtons.defaultAddBtn({hasPermi:'mes:orderDay:create'}), // 新增 |
||||
|
defaultButtons.defaultImportBtn({hasPermi:'mes:orderDay:import'}), // 导入 |
||||
|
defaultButtons.defaultExportBtn({hasPermi:'mes:orderDay:export'}), // 导出 |
||||
|
defaultButtons.defaultFreshBtn(null), // 刷新 |
||||
|
defaultButtons.defaultFilterBtn(null), // 筛选 |
||||
|
defaultButtons.defaultSetBtn(null), // 设置 |
||||
|
] |
||||
|
|
||||
|
// 头部按钮事件 |
||||
|
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) => { |
||||
|
//console.log('row',row) |
||||
|
if (val.indexOf(row.status) > -1) { |
||||
|
return false |
||||
|
} else { |
||||
|
return true |
||||
|
} |
||||
|
} |
||||
|
// 列表-操作按钮 |
||||
|
// 列表-操作按钮 |
||||
|
const butttondata = (row) => { |
||||
|
//console.log('row2',row) |
||||
|
return [ |
||||
|
defaultButtons.mainListEditBtn({ hide: isShowMainButton(row,['1']),hasPermi:'mes:orderDay:update'}), // 编辑 |
||||
|
defaultButtons.mainListDeleteBtn({ hide: isShowMainButton(row,['1']),hasPermi:'mes:orderDay:delete'}), // 删除 |
||||
|
defaultButtons.mainListHandleBtn({label: '发布', |
||||
|
name: 'publish', |
||||
|
hide: isShowMainButton(row,['1']), |
||||
|
type: 'warning', |
||||
|
icon: '', |
||||
|
color: '', |
||||
|
hasPermi: ''}), // |
||||
|
// defaultButtons.mainListHandleBtn({label: '发布', |
||||
|
// name: 'publish', |
||||
|
// hide: isShowMainButton(row,['2']), |
||||
|
// type: 'warning', |
||||
|
// icon: '', |
||||
|
// color: '', |
||||
|
// hasPermi: ''}), // 路由设置 |
||||
|
defaultButtons.mainListHandleBtn({label: '终止', |
||||
|
name: 'stopPlan', |
||||
|
hide: isShowMainButton(row,['1','2','3']), |
||||
|
type: 'warning', |
||||
|
icon: '', |
||||
|
color: '', |
||||
|
hasPermi: ''}), // 路由设置 |
||||
|
] |
||||
|
} |
||||
|
|
||||
|
|
||||
|
// 列表-操作按钮事件 |
||||
|
const buttonTableClick = async (val, row) => { |
||||
|
if (val == 'edit') { // 编辑 |
||||
|
openForm('update', row) |
||||
|
} else if (val == 'delete') { // 删除 |
||||
|
handleDelete(row.id) |
||||
|
} else if(val=='schedule'){ //发布计划 |
||||
|
openScheduledDetail( '发布计划', row,row.planNoDay) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/** 添加/修改操作 */ |
||||
|
const basicFormRef = ref() |
||||
|
const openForm = (type: string, row?: any) => { |
||||
|
basicFormRef.value.open(type, row) |
||||
|
} |
||||
|
|
||||
|
// form表单提交 |
||||
|
const formsSuccess = async (formType,data) => { |
||||
|
var isHave =OrderDay.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 OrderDayApi.createOrderDay(data) |
||||
|
message.success(t('common.createSuccess')) |
||||
|
} else { |
||||
|
await OrderDayApi.updateOrderDay(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, 'basicOrderDay') |
||||
|
} |
||||
|
/** 发布操作 */ |
||||
|
const scheduleDetailRef = ref() |
||||
|
const openScheduledDetail = (row: any, titleName: any, titleValue: any) => { |
||||
|
scheduleDetailRef.value.open(row, titleName, titleValue) |
||||
|
} |
||||
|
/** 删除按钮操作 */ |
||||
|
const handleDelete = async (id: number) => { |
||||
|
try { |
||||
|
// 删除的二次确认 |
||||
|
await message.delConfirm() |
||||
|
// 发起删除 |
||||
|
await OrderDayApi.deleteOrderDay(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 OrderDayApi.exportOrderDay(tableObject.params) |
||||
|
download.excel(data, '生产日计划.xlsx') |
||||
|
} catch { |
||||
|
} finally { |
||||
|
exportLoading.value = false |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/** 导入 */ |
||||
|
const importFormRef = ref() |
||||
|
const handleImport = () => { |
||||
|
importFormRef.value.open() |
||||
|
} |
||||
|
// 导入附件弹窗所需的参数 |
||||
|
const importTemplateData = reactive({ |
||||
|
templateUrl: '', |
||||
|
templateTitle: '生产日计划导入模版.xlsx' |
||||
|
}) |
||||
|
// 导入成功之后 |
||||
|
const importSuccess = () => { |
||||
|
getList() |
||||
|
} |
||||
|
|
||||
|
// 筛选提交 |
||||
|
const searchFormClick = (searchData) => { |
||||
|
tableObject.params = { |
||||
|
isSearch: true, |
||||
|
filters: searchData.filters |
||||
|
} |
||||
|
getList() // 刷新当前列表 |
||||
|
} |
||||
|
|
||||
|
/** 初始化 **/ |
||||
|
onMounted(async () => { |
||||
|
getList() |
||||
|
importTemplateData.templateUrl = await OrderDayApi.importTemplate() |
||||
|
}) |
||||
|
|
||||
|
</script> |
@ -0,0 +1,327 @@ |
|||||
|
import type { CrudSchema } from '@/hooks/web/useCrudSchemas' |
||||
|
import { dateFormatter } from '@/utils/formatTime' |
||||
|
import * as ItembasicApi from '@/api/wms/itembasic' |
||||
|
import { Itembasic } from '@/views/wms/basicDataManage/itemManage/itembasic/itembasic.data' |
||||
|
import * as WorkshopApi from '@/api/wms/workshop' |
||||
|
import { Workshop } from '@/views/wms/basicDataManage/factoryModeling/workshop/workshop.data' |
||||
|
import { on } from '@/utils/domUtils' |
||||
|
|
||||
|
// 表单校验
|
||||
|
export const OrderDayRules = reactive({ |
||||
|
planNoDay: [ |
||||
|
{ required: true, message: '请输入一个日计划编号', trigger: 'blur' } |
||||
|
], |
||||
|
planNoMonth: [ |
||||
|
{ required: true, message: '请输入一个月计划编号', trigger: 'blur' } |
||||
|
], |
||||
|
productCode: [ |
||||
|
{ required: true, message: '请选择一个产品', trigger: 'blur' } |
||||
|
], |
||||
|
workroomCode: [ |
||||
|
{ required: true, message: '请选择一个车间', trigger: 'blur' } |
||||
|
], |
||||
|
lineCode: [ |
||||
|
{ required: true, message: '请选择一个产线', trigger: 'blur' } |
||||
|
], |
||||
|
workMode: [ |
||||
|
{ required: true, message: '请选择工单生成方式', trigger: 'blur' } |
||||
|
], |
||||
|
startTime: [ |
||||
|
{ required: true, message: '请输入计划生产开始时间', trigger: 'blur' } |
||||
|
], |
||||
|
endTime: [ |
||||
|
{ required: true, message: '请输入计划生产完成时间', trigger: 'blur' } |
||||
|
], |
||||
|
planDate: [ |
||||
|
{ required: true, message: '请输入计划日期', trigger: 'blur' } |
||||
|
], |
||||
|
taskMode: [ |
||||
|
{ required: true, message: '请选择一个生产方式', trigger: 'blur' } |
||||
|
], |
||||
|
}) |
||||
|
|
||||
|
export const OrderDay = useCrudSchemas(reactive<CrudSchema[]>([ |
||||
|
{ |
||||
|
label: '主键', |
||||
|
field: 'id', |
||||
|
sort: 'custom', |
||||
|
isForm: false, |
||||
|
width: '60px', |
||||
|
}, |
||||
|
{ |
||||
|
label: '日计划单号', |
||||
|
field: 'planNoDay', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
required: true, |
||||
|
}, |
||||
|
{ |
||||
|
label: '月计划单号', |
||||
|
field: 'planNoMonth', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
required: false, |
||||
|
}, |
||||
|
{ |
||||
|
label: '状态', |
||||
|
field: 'status', |
||||
|
sort: 'custom', |
||||
|
isForm: false, |
||||
|
isTable: true, |
||||
|
isDetail:true, |
||||
|
isSearch: false, |
||||
|
width: '80px', |
||||
|
dictType: DICT_TYPE.MES_PLANDO_STATUS, |
||||
|
dictClass: 'string', |
||||
|
form: { |
||||
|
component: 'Select', |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
label: '产品编号', |
||||
|
field: 'productCode', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
required: true, |
||||
|
form: { |
||||
|
// labelMessage: '信息提示说明!!!',
|
||||
|
componentProps: { |
||||
|
isSearchList: true, // 开启查询弹窗
|
||||
|
searchListPlaceholder: '产品编码', // 输入框占位文本
|
||||
|
searchField: 'code', // 查询弹窗赋值字段
|
||||
|
searchTitle: '产品信息', // 查询弹窗标题
|
||||
|
searchAllSchemas: Itembasic.allSchemas, // 查询弹窗所需类
|
||||
|
searchPage: ItembasicApi.getItembasicPage, // 查询弹窗所需分页方法
|
||||
|
isHideFilterButton:true, |
||||
|
searchCondition: [{ |
||||
|
key: 'available', |
||||
|
value: 'TRUE', |
||||
|
isMainValue: false |
||||
|
}, |
||||
|
{ |
||||
|
key: 'type', |
||||
|
action: 'in', // 查询拼接条件
|
||||
|
isSearch: true, // 使用自定义拼接条件
|
||||
|
value: 'FG,SEMI',//,SEMI]
|
||||
|
isMainValue: false |
||||
|
}, |
||||
|
|
||||
|
] |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '车间编码', |
||||
|
field: 'workroomCode', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
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: true, |
||||
|
required: true, |
||||
|
form:{ |
||||
|
component:'Select', |
||||
|
componentProps:{ |
||||
|
options:[{lablel:'1',value:'1'}] |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '计划数量', |
||||
|
field: 'planCount', |
||||
|
sort: 'custom', |
||||
|
required: true, |
||||
|
form: { |
||||
|
component: 'InputNumber', |
||||
|
value: 1 |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
label: '工艺路线编码', |
||||
|
field: 'processrouteCode', |
||||
|
sort: 'custom', |
||||
|
form: { |
||||
|
component:'Select', |
||||
|
componentProps: { |
||||
|
options: [] |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '临时工艺', |
||||
|
field: 'tempProcessroute', |
||||
|
sort: 'custom', |
||||
|
width: '80px', |
||||
|
dictType: DICT_TYPE.TRUE_FALSE, |
||||
|
dictClass: 'string', |
||||
|
form: { |
||||
|
component: 'Switch', |
||||
|
value: 'TRUE', |
||||
|
componentProps: { |
||||
|
inactiveValue: 'FALSE', |
||||
|
activeValue: 'TRUE' |
||||
|
} |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
label: 'BOM编码', |
||||
|
field: 'standardBom', |
||||
|
sort: 'custom', |
||||
|
form: { |
||||
|
component:'Select', |
||||
|
componentProps: { |
||||
|
options: [{lablel:'bom',value:'bom'}] |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '替代BOM', |
||||
|
field: 'tempBom', |
||||
|
sort: 'custom', |
||||
|
width: '80px', |
||||
|
dictType: DICT_TYPE.TRUE_FALSE, |
||||
|
dictClass: 'string', |
||||
|
form: { |
||||
|
component: 'Switch', |
||||
|
value: 'TRUE', |
||||
|
componentProps: { |
||||
|
inactiveValue: 'FALSE', |
||||
|
activeValue: 'TRUE', |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '工单模式', |
||||
|
field: 'workMode', |
||||
|
width: '80px', |
||||
|
sort: 'custom', |
||||
|
dictType: DICT_TYPE.MES_WORKBILL_MODEL, |
||||
|
dictClass: 'string', |
||||
|
form: { |
||||
|
component: 'Select', |
||||
|
value: 'BATCH', |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
label: '计划日期', |
||||
|
field: 'planDate', |
||||
|
sort: 'custom', |
||||
|
formatter: dateFormatter, |
||||
|
isSearch: true, |
||||
|
search: { |
||||
|
component: 'DatePicker', |
||||
|
componentProps: { |
||||
|
type: 'date', |
||||
|
valueFormat: 'YYYY-MM-DD', |
||||
|
} |
||||
|
}, |
||||
|
form: { |
||||
|
component: 'DatePicker', |
||||
|
componentProps: { |
||||
|
type: 'date', |
||||
|
valueFormat: 'x' |
||||
|
} |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
label: '开始时间', |
||||
|
field: 'startTime', |
||||
|
sort: 'custom', |
||||
|
formatter: dateFormatter, |
||||
|
required: true, |
||||
|
form: { |
||||
|
component: 'TimePicker', |
||||
|
componentProps: { |
||||
|
type: 'time', |
||||
|
dateFormat: 'HH:mm', |
||||
|
//valueFormat: 'x',
|
||||
|
} |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
label: '结束时间', |
||||
|
field: 'endTime', |
||||
|
sort: 'custom', |
||||
|
formatter: dateFormatter, |
||||
|
isReadonly:true, |
||||
|
form: { |
||||
|
component: 'TimePicker', |
||||
|
componentProps: { |
||||
|
type: 'time', |
||||
|
dateFormat: 'HH:mm', |
||||
|
} |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
label: '生产模式', |
||||
|
field: 'taskMode', |
||||
|
width : '80px', |
||||
|
sort: 'custom', |
||||
|
dictType: DICT_TYPE.MES_TASK_MODE, |
||||
|
dictClass: 'string', |
||||
|
form: { |
||||
|
component: 'Select', |
||||
|
value:'ASSIGN' |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
label: '创建时间', |
||||
|
field: 'createTime', |
||||
|
sort: 'custom', |
||||
|
formatter: dateFormatter, |
||||
|
isSearch: true, |
||||
|
search: { |
||||
|
component: 'DatePicker', |
||||
|
componentProps: { |
||||
|
valueFormat: 'YYYY-MM-DD HH:mm:ss', |
||||
|
type: 'datetime', |
||||
|
defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')] |
||||
|
} |
||||
|
}, |
||||
|
isForm: false, |
||||
|
}, |
||||
|
{ |
||||
|
label: '创建者', |
||||
|
field: 'creator', |
||||
|
sort: 'custom', |
||||
|
isSearch: false, |
||||
|
isForm: false, |
||||
|
}, |
||||
|
{ |
||||
|
label: '备注', |
||||
|
field: 'remark', |
||||
|
sort: 'custom', |
||||
|
isSearch: false, |
||||
|
isTable:false, |
||||
|
}, |
||||
|
{ |
||||
|
label: '操作', |
||||
|
field: 'action', |
||||
|
isForm: false, |
||||
|
table: { |
||||
|
width: 200, |
||||
|
fixed: 'right' |
||||
|
} |
||||
|
} |
||||
|
])) |
@ -0,0 +1,245 @@ |
|||||
|
<template> |
||||
|
<ContentWrap> |
||||
|
<!-- 搜索工作栏 --> |
||||
|
<Search :schema="Qualityclass.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" /> |
||||
|
</ContentWrap> |
||||
|
|
||||
|
<!-- 列表头部 --> |
||||
|
<TableHead |
||||
|
:HeadButttondata="HeadButttondata" |
||||
|
@button-base-click="buttonBaseClick" |
||||
|
:routeName="routeName" |
||||
|
@updataTableColumns="updataTableColumns" |
||||
|
@searchFormClick="searchFormClick" |
||||
|
:allSchemas="Qualityclass.allSchemas" |
||||
|
/> |
||||
|
|
||||
|
<!-- 列表 --> |
||||
|
<ContentWrap> |
||||
|
<Table |
||||
|
:columns="tableColumns" |
||||
|
:data="tableObject.tableList" |
||||
|
:loading="tableObject.loading" |
||||
|
:pagination="{ |
||||
|
total: tableObject.total |
||||
|
}" |
||||
|
v-model:pageSize="tableObject.pageSize" |
||||
|
v-model:currentPage="tableObject.currentPage" |
||||
|
v-model:sort="tableObject.sort" |
||||
|
> |
||||
|
<template #code="{row}"> |
||||
|
<el-button type="primary" link @click="openDetail(row, '代码', row.code)"> |
||||
|
<span>{{ row.code }}</span> |
||||
|
</el-button> |
||||
|
</template> |
||||
|
<template #action="{ row }"> |
||||
|
<ButtonBase :Butttondata="butttondata" @button-base-click="buttonTableClick($event,row)" /> |
||||
|
</template> |
||||
|
</Table> |
||||
|
</ContentWrap> |
||||
|
|
||||
|
<!-- 表单弹窗:添加/修改 --> |
||||
|
<BasicForm |
||||
|
ref="basicFormRef" |
||||
|
@success="formsSuccess" |
||||
|
:rules="QualityclassRules" |
||||
|
:formAllSchemas="Qualityclass.allSchemas" |
||||
|
:apiUpdate="QualityclassApi.updateQualityclass" |
||||
|
:apiCreate="QualityclassApi.createQualityclass" |
||||
|
@searchTableSuccess="searchTableSuccess" |
||||
|
:isBusiness="false" |
||||
|
/> |
||||
|
|
||||
|
<!-- 详情 --> |
||||
|
<Detail ref="detailRef" :isBasic="true" :allSchemas="Qualityclass.allSchemas" /> |
||||
|
|
||||
|
<!-- 导入 --> |
||||
|
<ImportForm ref="importFormRef" url="/mes/qualityclass/import" :importTemplateData="importTemplateData" @success="importSuccess" /> |
||||
|
</template> |
||||
|
|
||||
|
<script setup lang="ts"> |
||||
|
import download from '@/utils/download' |
||||
|
import { Qualityclass,QualityclassRules } from './qualityclass.data' |
||||
|
import * as QualityclassApi from '@/api/mes/qualityclass' |
||||
|
import * as defaultButtons from '@/utils/disposition/defaultButtons' |
||||
|
import TableHead from '@/components/TableHead/src/TableHead.vue' |
||||
|
import ImportForm from '@/components/ImportForm/src/ImportForm.vue' |
||||
|
import Detail from '@/components/Detail/src/Detail.vue' |
||||
|
|
||||
|
defineOptions({ name: 'QmsQualityclass' }) |
||||
|
|
||||
|
const message = useMessage() // 消息弹窗 |
||||
|
const { t } = useI18n() // 国际化 |
||||
|
|
||||
|
const route = useRoute() // 路由信息 |
||||
|
const routeName = ref() |
||||
|
routeName.value = route.name |
||||
|
const tableColumns = ref(Qualityclass.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: QualityclassApi.getQualityclassPage // 分页接口 |
||||
|
}) |
||||
|
|
||||
|
// 获得表格的各种操作 |
||||
|
const { getList, setSearchParams } = tableMethods |
||||
|
|
||||
|
// 列表头部按钮 |
||||
|
const HeadButttondata = [ |
||||
|
defaultButtons.defaultAddBtn({hasPermi:'mes:qualityclass:create'}), // 新增 |
||||
|
defaultButtons.defaultImportBtn({hasPermi:'mes:qualityclass:import'}), // 导入 |
||||
|
defaultButtons.defaultExportBtn({hasPermi:'mes:qualityclass:export'}), // 导出 |
||||
|
defaultButtons.defaultFreshBtn(null), // 刷新 |
||||
|
defaultButtons.defaultFilterBtn(null), // 筛选 |
||||
|
defaultButtons.defaultSetBtn(null), // 设置 |
||||
|
// { |
||||
|
// label: '自定义扩展按钮', |
||||
|
// name: 'zdy', |
||||
|
// hide: false, |
||||
|
// type: 'primary', |
||||
|
// icon: 'Select', |
||||
|
// color: '' |
||||
|
// }, |
||||
|
] |
||||
|
|
||||
|
// 头部按钮事件 |
||||
|
const buttonBaseClick = (val, item) => { |
||||
|
if (val == 'add') { // 新增 |
||||
|
openForm('create') |
||||
|
} else if (val == 'import') { // 导入 |
||||
|
handleImport() |
||||
|
} else if (val == 'export') { // 导出 |
||||
|
handleExport() |
||||
|
} else if (val == 'refresh') { // 刷新 |
||||
|
getList() |
||||
|
} else if (val == 'filtrate') { // 筛选 |
||||
|
} else { // 其他按钮 |
||||
|
console.log('其他按钮', item) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// 列表-操作按钮 |
||||
|
const butttondata = [ |
||||
|
defaultButtons.mainListEditBtn({hasPermi:'mes:qualityclass:update'}), // 编辑 |
||||
|
defaultButtons.mainListDeleteBtn({hasPermi:'mes:qualityclass:delete'}), // 删除 |
||||
|
] |
||||
|
|
||||
|
// 列表-操作按钮事件 |
||||
|
const buttonTableClick = async (val, row) => { |
||||
|
if (val == 'edit') { // 编辑 |
||||
|
openForm('update', row) |
||||
|
} else if (val == 'delete') { // 删除 |
||||
|
handleDelete(row.id) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/** 添加/修改操作 */ |
||||
|
const basicFormRef = ref() |
||||
|
const openForm = (type: string, row?: any) => { |
||||
|
console.log(row) |
||||
|
basicFormRef.value.open(type, row) |
||||
|
} |
||||
|
|
||||
|
// form表单提交 |
||||
|
const formsSuccess = async (formType,data) => { |
||||
|
var isHave =Qualityclass.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 QualityclassApi.createQualityclass(data) |
||||
|
message.success(t('common.createSuccess')) |
||||
|
} else { |
||||
|
await QualityclassApi.updateQualityclass(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, 'basicQualityclass') |
||||
|
} |
||||
|
|
||||
|
/** 删除按钮操作 */ |
||||
|
const handleDelete = async (id: number) => { |
||||
|
try { |
||||
|
// 删除的二次确认 |
||||
|
await message.delConfirm() |
||||
|
// 发起删除 |
||||
|
await QualityclassApi.deleteQualityclass(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 QualityclassApi.exportQualityclass(tableObject.params) |
||||
|
download.excel(data, '质检类别.xlsx') |
||||
|
} catch { |
||||
|
} finally { |
||||
|
exportLoading.value = false |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/** 导入 */ |
||||
|
const importFormRef = ref() |
||||
|
const handleImport = () => { |
||||
|
importFormRef.value.open() |
||||
|
} |
||||
|
// 导入附件弹窗所需的参数 |
||||
|
const importTemplateData = reactive({ |
||||
|
templateUrl: '', |
||||
|
templateTitle: '质检类别导入模版.xlsx' |
||||
|
}) |
||||
|
// 导入成功之后 |
||||
|
const importSuccess = () => { |
||||
|
getList() |
||||
|
} |
||||
|
|
||||
|
// 筛选提交 |
||||
|
const searchFormClick = (searchData) => { |
||||
|
tableObject.params = { |
||||
|
isSearch: true, |
||||
|
filters: searchData.filters |
||||
|
} |
||||
|
getList() // 刷新当前列表 |
||||
|
} |
||||
|
|
||||
|
/** 初始化 **/ |
||||
|
onMounted(async () => { |
||||
|
getList() |
||||
|
importTemplateData.templateUrl = await QualityclassApi.importTemplate() |
||||
|
}) |
||||
|
|
||||
|
</script> |
@ -0,0 +1,152 @@ |
|||||
|
import type { CrudSchema } from '@/hooks/web/useCrudSchemas' |
||||
|
import { dateFormatter } from '@/utils/formatTime' |
||||
|
|
||||
|
// 表单校验
|
||||
|
export const QualityclassRules = reactive({ |
||||
|
concurrencyStamp: [required], |
||||
|
code: [{ required: true, message: '请输入代码', trigger: 'blur' }], |
||||
|
name: [required], |
||||
|
}) |
||||
|
|
||||
|
export const Qualityclass = useCrudSchemas(reactive<CrudSchema[]>([ |
||||
|
{ |
||||
|
label: '删除时间', |
||||
|
field: 'deleteTime', |
||||
|
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: '主键', |
||||
|
field: 'id', |
||||
|
sort: 'custom', |
||||
|
isForm: false, |
||||
|
isTable: false, |
||||
|
isDetail:false |
||||
|
}, |
||||
|
{ |
||||
|
label: '并发乐观锁', |
||||
|
field: 'concurrencyStamp', |
||||
|
sort: 'custom', |
||||
|
isSearch: false, |
||||
|
isTable: false, |
||||
|
isForm:false, |
||||
|
isDetail:false, |
||||
|
form: { |
||||
|
component: 'InputNumber', |
||||
|
value: 0 |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
label: '创建时间', |
||||
|
field: 'createTime', |
||||
|
sort: 'custom', |
||||
|
formatter: dateFormatter, |
||||
|
isSearch: false, |
||||
|
isTable: 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: '删除用户名', |
||||
|
field: 'deleter', |
||||
|
sort: 'custom', |
||||
|
isSearch: false, |
||||
|
isTable: false, |
||||
|
isForm: false, |
||||
|
isDetail:false |
||||
|
}, |
||||
|
{ |
||||
|
label: '位置ID', |
||||
|
field: 'siteId', |
||||
|
sort: 'custom', |
||||
|
isSearch: false, |
||||
|
isTable: false, |
||||
|
isForm: false, |
||||
|
isDetail:false, |
||||
|
form: { |
||||
|
component: 'InputNumber', |
||||
|
value: 0 |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
label: '编码', |
||||
|
field: 'code', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
}, |
||||
|
{ |
||||
|
label: '编码名称', |
||||
|
field: 'name', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
}, |
||||
|
{ |
||||
|
label: '分组类别', |
||||
|
field: 'groupCode', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
}, |
||||
|
{ |
||||
|
label: '状态', |
||||
|
field: 'status', |
||||
|
sort: 'custom', |
||||
|
dictType: DICT_TYPE.QUALIFY_STATUS, |
||||
|
dictClass: 'string', |
||||
|
isForm: true, |
||||
|
isSearch: true, |
||||
|
isTable: true, |
||||
|
form: { |
||||
|
component: 'Switch', |
||||
|
value: '2', |
||||
|
componentProps: { |
||||
|
inactiveValue: '2', |
||||
|
activeValue: '1' |
||||
|
} |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
label: '操作', |
||||
|
field: 'action', |
||||
|
isForm: false, |
||||
|
isDetail:false, |
||||
|
table: { |
||||
|
width: 150, |
||||
|
fixed: 'right' |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '备注', |
||||
|
field: 'remark', |
||||
|
sort: 'custom', |
||||
|
isSearch: false, |
||||
|
isTable: false |
||||
|
} |
||||
|
])) |
||||
|
|
@ -0,0 +1,297 @@ |
|||||
|
<template> |
||||
|
<ContentWrap> |
||||
|
<!-- 搜索工作栏 --> |
||||
|
<Search :schema="Qualityform.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" /> |
||||
|
</ContentWrap> |
||||
|
|
||||
|
<!-- 列表头部 --> |
||||
|
<TableHead |
||||
|
:HeadButttondata="HeadButttondata" |
||||
|
@button-base-click="buttonBaseClick" |
||||
|
:routeName="routeName" |
||||
|
@updataTableColumns="updataTableColumns" |
||||
|
@searchFormClick="searchFormClick" |
||||
|
:allSchemas="Qualityform.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 #formNo="{row}"> |
||||
|
<el-button type="primary" link @click="openDetail(row, '表单编号', row.formNo)"> |
||||
|
<span>{{ row.formNo }}</span> |
||||
|
</el-button> |
||||
|
</template> |
||||
|
<template #action="{ row }"> |
||||
|
<ButtonBase :Butttondata="butttondata" @button-base-click="buttonTableClick($event,row)" /> |
||||
|
</template> |
||||
|
</Table> |
||||
|
</ContentWrap> |
||||
|
|
||||
|
<!-- 表单弹窗:添加/修改 --> |
||||
|
<BasicForm |
||||
|
ref="basicFormRef" |
||||
|
@success="formsSuccess" |
||||
|
:rules="QualityformRules" |
||||
|
:formAllSchemas="Qualityform.allSchemas" |
||||
|
:apiUpdate="QualityformApi.updateQualityform" |
||||
|
:apiCreate="QualityformApi.createQualityform" |
||||
|
@searchTableSuccess="searchTableSuccess" |
||||
|
:isBusiness="false" |
||||
|
/> |
||||
|
|
||||
|
<!-- 详情 --> |
||||
|
<Detail ref="detailRef" |
||||
|
:isBasic="false" |
||||
|
:allSchemas="Qualityform.allSchemas" |
||||
|
:detailAllSchemas="QualityformDetail.allSchemas" |
||||
|
:detailAllSchemasRules="QualityformDetailRules" |
||||
|
:apiPage="QualityformDetailApi.getQualityformdetailPage" |
||||
|
:apiCreate="QualityformDetailApi.createQualityformdetail" |
||||
|
:apiUpdate="QualityformDetailApi.updateQualityformdetail" |
||||
|
:apiDelete="QualityformDetailApi.deleteQualityformdetail" |
||||
|
:detailButtonIsShowAdd="true" |
||||
|
:detailButtonIsShowEdit="true" |
||||
|
:detailButtonIsShowDelete="true" |
||||
|
@handleDeleteDetail="handleDeleteDetail" |
||||
|
@handleCreateDetail="handleCreateDetail" |
||||
|
@searchTableSuccessDetail="searchTableSuccessDetail" |
||||
|
:key="count" |
||||
|
/> |
||||
|
|
||||
|
<!-- 导入 --> |
||||
|
<ImportForm ref="importFormRef" url="/mes/qualityform/import" :importTemplateData="importTemplateData" @success="importSuccess" /> |
||||
|
</template> |
||||
|
|
||||
|
<script setup lang="ts"> |
||||
|
import download from '@/utils/download' |
||||
|
import { Qualityform,QualityformRules,QualityformDetail,QualityformDetailRules } from './qualityform.data' |
||||
|
import * as QualityformApi from '@/api/mes/qualityform' |
||||
|
import * as defaultButtons from '@/utils/disposition/defaultButtons' |
||||
|
import * as QualityformDetailApi from '@/api/mes/qualityformdetail' |
||||
|
import TableHead from '@/components/TableHead/src/TableHead.vue' |
||||
|
import ImportForm from '@/components/ImportForm/src/ImportForm.vue' |
||||
|
import Detail from '@/components/Detail/src/Detail.vue' |
||||
|
|
||||
|
defineOptions({ name: 'QmsQualityform' }) |
||||
|
|
||||
|
const message = useMessage() // 消息弹窗 |
||||
|
const { t } = useI18n() // 国际化 |
||||
|
|
||||
|
const route = useRoute() // 路由信息 |
||||
|
const routeName = ref() |
||||
|
routeName.value = route.name |
||||
|
const tableColumns = ref(Qualityform.allSchemas.tableColumns) |
||||
|
|
||||
|
// 主页面查询字典页面返回 |
||||
|
const searchTableSuccess = (formField, searchField, val, formRef) => { |
||||
|
nextTick(() => { |
||||
|
|
||||
|
const setV = {} |
||||
|
let result = ''; |
||||
|
//setV[formField] = val[0][searchField] |
||||
|
for (var i = 0; i < val.length; i++) { |
||||
|
//console.log(val[i].itemCode); // 输出每个元素到控制台 |
||||
|
result += val[i].itemCode + ','; |
||||
|
} |
||||
|
if(result.endsWith(',')){ |
||||
|
result = result.substring(0,result.length -1) |
||||
|
} |
||||
|
setV[formField] = result; |
||||
|
formRef.setValues(setV) |
||||
|
}) |
||||
|
} |
||||
|
|
||||
|
// 子页面查询字典页面返回 |
||||
|
const searchTableSuccessDetail = (formField, searchField, val, formRef ) => { |
||||
|
nextTick(() => { |
||||
|
const setV = {} |
||||
|
let result = ''; |
||||
|
for (var i = 0; i < val.length; i++) { |
||||
|
result += val[i].itemCode + ','; |
||||
|
} |
||||
|
if(result.endsWith(',')){ |
||||
|
result = result.substring(0,result.length -1) |
||||
|
} |
||||
|
setV[formField] = result; |
||||
|
formRef.setValues(setV) |
||||
|
}) |
||||
|
} |
||||
|
|
||||
|
// 字段设置 更新主列表字段wms |
||||
|
const updataTableColumns = (val) => { |
||||
|
tableColumns.value = val |
||||
|
} |
||||
|
|
||||
|
const { tableObject, tableMethods } = useTable({ |
||||
|
getListApi: QualityformApi.getQualityformPage // 分页接口 |
||||
|
}) |
||||
|
|
||||
|
// 获得表格的各种操作 |
||||
|
const { getList, setSearchParams } = tableMethods |
||||
|
|
||||
|
// 列表头部按钮 |
||||
|
const HeadButttondata = [ |
||||
|
defaultButtons.defaultAddBtn({hasPermi:'mes:qualityform:create'}), // 新增 |
||||
|
defaultButtons.defaultImportBtn({hasPermi:'mes:qualityform:import'}), // 导入 |
||||
|
defaultButtons.defaultExportBtn({hasPermi:'mes:qualityform:export'}), // 导出 |
||||
|
defaultButtons.defaultFreshBtn(null), // 刷新 |
||||
|
defaultButtons.defaultFilterBtn(null), // 筛选 |
||||
|
defaultButtons.defaultSetBtn(null), // 设置 |
||||
|
// { |
||||
|
// label: '自定义扩展按钮', |
||||
|
// name: 'zdy', |
||||
|
// hide: false, |
||||
|
// type: 'primary', |
||||
|
// icon: 'Select', |
||||
|
// color: '' |
||||
|
// }, |
||||
|
] |
||||
|
|
||||
|
// 头部按钮事件 |
||||
|
const buttonBaseClick = (val, item) => { |
||||
|
if (val == 'add') { // 新增 |
||||
|
openForm('create') |
||||
|
} else if (val == 'import') { // 导入 |
||||
|
handleImport() |
||||
|
} else if (val == 'export') { // 导出 |
||||
|
handleExport() |
||||
|
} else if (val == 'refresh') { // 刷新 |
||||
|
getList() |
||||
|
} else if (val == 'filtrate') { // 筛选 |
||||
|
} else { // 其他按钮 |
||||
|
console.log('其他按钮', item) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// 列表-操作按钮 |
||||
|
const butttondata = [ |
||||
|
defaultButtons.mainListEditBtn({hasPermi:'mes:qualityform:update'}), // 编辑 |
||||
|
defaultButtons.mainListDeleteBtn({hasPermi:'mes:qualityform:delete'}), // 删除 |
||||
|
] |
||||
|
|
||||
|
// 列表-操作按钮事件 |
||||
|
const buttonTableClick = async (val, row) => { |
||||
|
if (val == 'edit') { // 编辑 |
||||
|
openForm('update', row) |
||||
|
} else if (val == 'delete') { // 删除 |
||||
|
handleDelete(row.id) |
||||
|
} |
||||
|
} |
||||
|
const handleDeleteDetail = async()=>{ |
||||
|
getList() |
||||
|
|
||||
|
} |
||||
|
let count = ref(0) |
||||
|
const handleCreateDetail = async()=>{ |
||||
|
count.value++ |
||||
|
getList() |
||||
|
|
||||
|
} |
||||
|
/** 添加/修改操作 */ |
||||
|
const basicFormRef = ref() |
||||
|
const openForm = (type: string, row?: any) => { |
||||
|
basicFormRef.value.open(type, row) |
||||
|
} |
||||
|
|
||||
|
// form表单提交 |
||||
|
const formsSuccess = async (formType,data) => { |
||||
|
var isHave =Qualityform.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 QualityformApi.createQualityform(data) |
||||
|
message.success(t('common.createSuccess')) |
||||
|
} else { |
||||
|
await QualityformApi.updateQualityform(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, 'basicQualityform') |
||||
|
} |
||||
|
|
||||
|
/** 删除按钮操作 */ |
||||
|
const handleDelete = async (id: number) => { |
||||
|
try { |
||||
|
// 删除的二次确认 |
||||
|
await message.delConfirm() |
||||
|
// 发起删除 |
||||
|
await QualityformApi.deleteQualityform(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 QualityformApi.exportQualityform(tableObject.params) |
||||
|
download.excel(data, '质检表单.xlsx') |
||||
|
} catch { |
||||
|
} finally { |
||||
|
exportLoading.value = false |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
|
||||
|
/** 导入 */ |
||||
|
const importFormRef = ref() |
||||
|
const handleImport = () => { |
||||
|
importFormRef.value.open() |
||||
|
} |
||||
|
// 导入附件弹窗所需的参数 |
||||
|
const importTemplateData = reactive({ |
||||
|
templateUrl: '', |
||||
|
templateTitle: '质检表单导入模版.xlsx' |
||||
|
}) |
||||
|
// 导入成功之后 |
||||
|
const importSuccess = () => { |
||||
|
getList() |
||||
|
} |
||||
|
|
||||
|
// 筛选提交 |
||||
|
const searchFormClick = (searchData) => { |
||||
|
tableObject.params = { |
||||
|
isSearch: true, |
||||
|
filters: searchData.filters |
||||
|
} |
||||
|
getList() // 刷新当前列表 |
||||
|
} |
||||
|
|
||||
|
/** 初始化 **/ |
||||
|
onMounted(async () => { |
||||
|
getList() |
||||
|
importTemplateData.templateUrl = await QualityformApi.importTemplate() |
||||
|
}) |
||||
|
|
||||
|
</script> |
@ -0,0 +1,316 @@ |
|||||
|
import type { CrudSchema } from '@/hooks/web/useCrudSchemas' |
||||
|
import { dateFormatter } from '@/utils/formatTime' |
||||
|
import * as ItemApi from '@/api/mes/item' |
||||
|
import { Item } from '../item/item.data' |
||||
|
import * as QualitygroupApi from '@/api/mes/qualitygroup' |
||||
|
import { Qualitygroup } from '../qualitygroup/qualitygroup.data' |
||||
|
import { Detail } from '@/components/Detail' |
||||
|
|
||||
|
// 表单校验
|
||||
|
export const QualityformRules = reactive({ |
||||
|
formName: [required], |
||||
|
}) |
||||
|
|
||||
|
export const Qualityform = useCrudSchemas(reactive<CrudSchema[]>([ |
||||
|
{ |
||||
|
label: '删除时间', |
||||
|
field: 'deleteTime', |
||||
|
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: '主键', |
||||
|
field: 'id', |
||||
|
sort: 'custom', |
||||
|
isForm: false, |
||||
|
isTable: false, |
||||
|
isDetail:false |
||||
|
}, |
||||
|
|
||||
|
{ |
||||
|
label: '并发乐观锁', |
||||
|
field: 'concurrencyStamp', |
||||
|
sort: 'custom', |
||||
|
isSearch: false, |
||||
|
isTable: false, |
||||
|
isForm:false, |
||||
|
isDetail:false, |
||||
|
form: { |
||||
|
component: 'InputNumber', |
||||
|
value: 0 |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
label: '创建时间', |
||||
|
field: 'createTime', |
||||
|
sort: 'custom', |
||||
|
formatter: dateFormatter, |
||||
|
isSearch: false, |
||||
|
isTable: 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: '删除用户名', |
||||
|
field: 'deleter', |
||||
|
sort: 'custom', |
||||
|
isSearch: false, |
||||
|
isTable: false, |
||||
|
isForm: false, |
||||
|
isDetail:false |
||||
|
}, |
||||
|
{ |
||||
|
label: '位置ID', |
||||
|
field: 'siteId', |
||||
|
sort: 'custom', |
||||
|
isSearch: false, |
||||
|
isTable: false, |
||||
|
isForm: false, |
||||
|
isDetail:false, |
||||
|
form: { |
||||
|
component: 'InputNumber', |
||||
|
value: 0 |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
label: '表单编号', |
||||
|
field: 'formNo', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
isForm: false, |
||||
|
isDetail: true |
||||
|
}, |
||||
|
{ |
||||
|
label: '表单名称', |
||||
|
field: 'formName', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
}, |
||||
|
{ |
||||
|
label: '表单类别', |
||||
|
field: 'formType', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
|
||||
|
}, |
||||
|
{ |
||||
|
label: '质检项目编码', |
||||
|
field: 'itemCode', |
||||
|
sort: 'custom', |
||||
|
isDetail: true, |
||||
|
form: { |
||||
|
componentProps: { |
||||
|
isSearchList: true, // 开启查询弹窗
|
||||
|
searchTitle: '质检项目信息', // 查询弹窗标题
|
||||
|
searchAllSchemas: Item.allSchemas, // 查询弹窗所需类
|
||||
|
searchField: 'itemCode', // 查询弹窗赋值字段
|
||||
|
searchPage: ItemApi.getItemPage, // 查询弹窗所需分页方法
|
||||
|
multiple:true, |
||||
|
searchCondition: [{ |
||||
|
key: 'status', |
||||
|
value: '1', |
||||
|
action: '==', |
||||
|
isSearch: true, |
||||
|
isMainValue: false |
||||
|
}] |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '是否可用', |
||||
|
field: 'status', |
||||
|
sort: 'custom', |
||||
|
dictType: DICT_TYPE.QUALIFY_STATUS, |
||||
|
dictClass: 'string', |
||||
|
isSearch: true, |
||||
|
isTable: true, |
||||
|
isForm: true, |
||||
|
form: { |
||||
|
component: 'Switch', |
||||
|
value: '2', |
||||
|
componentProps: { |
||||
|
inactiveValue: '2', |
||||
|
activeValue: '1' |
||||
|
} |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
label: '备注', |
||||
|
field: 'remark', |
||||
|
sort: 'custom', |
||||
|
isSearch: false, |
||||
|
isTable: false, |
||||
|
}, |
||||
|
{ |
||||
|
label: '操作', |
||||
|
field: 'action', |
||||
|
isForm: false, |
||||
|
table: { |
||||
|
width: 150, |
||||
|
fixed: 'right' |
||||
|
} |
||||
|
} |
||||
|
])) |
||||
|
|
||||
|
|
||||
|
export const QualityformDetail = useCrudSchemas(reactive<CrudSchema[]>([ |
||||
|
{ |
||||
|
label: '表单编号', |
||||
|
field: 'formNo', |
||||
|
sort: 'custom', |
||||
|
isSearch: false, |
||||
|
isForm: false, |
||||
|
isDetail: false, |
||||
|
form: { |
||||
|
componentProps:{ |
||||
|
disabled:true |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '项目编码', |
||||
|
field: 'itemCode', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
isForm: true, |
||||
|
isDetail: true, |
||||
|
form: { |
||||
|
componentProps: { |
||||
|
isSearchList: true, // 开启查询弹窗
|
||||
|
searchTitle: '质检项目信息', // 查询弹窗标题
|
||||
|
searchAllSchemas: Item.allSchemas, // 查询弹窗所需类
|
||||
|
searchField: 'itemCode', // 查询弹窗赋值字段
|
||||
|
searchPage: ItemApi.getItemPage, // 查询弹窗所需分页方法
|
||||
|
multiple:true, |
||||
|
searchCondition: [{ |
||||
|
key: 'status', |
||||
|
value: '1', |
||||
|
action: '==' |
||||
|
}] |
||||
|
// searchCondition: [{
|
||||
|
// key:'formNo', // 查询列表中字段
|
||||
|
// value:'formNo', // 指主表某字段
|
||||
|
// //message: '请选择生产线信息!', // 当前置条件为空时 弹出信息提示
|
||||
|
// isMainValue: true // 表示查询条件是主表的字段的值
|
||||
|
// },
|
||||
|
// {
|
||||
|
// key:'status', // 查询列表中字段
|
||||
|
// value:'1', // 指查询具体值
|
||||
|
// isMainValue: false // 表示查询条件不是主表的字段的值
|
||||
|
// }
|
||||
|
// ]
|
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '项目名称', |
||||
|
field: 'itemName', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
isForm: false, |
||||
|
}, |
||||
|
{ |
||||
|
label: '类别编码', |
||||
|
field: 'itemType', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
isForm: false, |
||||
|
}, |
||||
|
{ |
||||
|
label: '质检科目编码', |
||||
|
field: 'qmsClass', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
isForm: false, |
||||
|
}, |
||||
|
{ |
||||
|
label: '数据类型', |
||||
|
field: 'dataType', |
||||
|
sort: 'custom', |
||||
|
dictType: DICT_TYPE.QUALIFY_ITEM_DATA_TYPE, |
||||
|
dictClass: 'string', |
||||
|
isSearch: true, |
||||
|
isForm: false, |
||||
|
}, |
||||
|
{ |
||||
|
label: '校验方式', |
||||
|
field: 'dataVerify', |
||||
|
sort: 'custom', |
||||
|
dictType: DICT_TYPE.QUALIFY_ITEM_VERIFY_MODE, |
||||
|
dictClass: 'string', |
||||
|
isSearch: true, |
||||
|
isForm: false, |
||||
|
}, |
||||
|
{ |
||||
|
label: '数据参考值', |
||||
|
field: 'dataStandvalue', |
||||
|
sort: 'custom', |
||||
|
isSearch: false, |
||||
|
isForm: false, |
||||
|
}, |
||||
|
{ |
||||
|
label: '数据录入说明', |
||||
|
field: 'dataDescripe', |
||||
|
sort: 'custom', |
||||
|
isSearch: false, |
||||
|
isForm: false, |
||||
|
}, |
||||
|
{ |
||||
|
label: '操作', |
||||
|
field: 'action', |
||||
|
isForm: false, |
||||
|
table: { |
||||
|
width: 150, |
||||
|
fixed: 'right' |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '是否可用', |
||||
|
field: 'status', |
||||
|
sort: 'custom', |
||||
|
dictType: DICT_TYPE.QUALIFY_STATUS, |
||||
|
dictClass: 'string', |
||||
|
isSearch: true, |
||||
|
isTable: true, |
||||
|
isForm: false, |
||||
|
}, |
||||
|
{ |
||||
|
label: '备注', |
||||
|
field: 'remark', |
||||
|
sort: 'custom', |
||||
|
isSearch: false, |
||||
|
isTable: true, |
||||
|
isForm: false, |
||||
|
} |
||||
|
])) |
||||
|
|
||||
|
export const QualityformDetailRules = reactive({ |
||||
|
itemCode: [required] |
||||
|
}) |
@ -0,0 +1,244 @@ |
|||||
|
<template> |
||||
|
<ContentWrap> |
||||
|
<!-- 搜索工作栏 --> |
||||
|
<Search :schema="Qualityformlog.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" /> |
||||
|
</ContentWrap> |
||||
|
|
||||
|
<!-- 列表头部 --> |
||||
|
<TableHead |
||||
|
:HeadButttondata="HeadButttondata" |
||||
|
@button-base-click="buttonBaseClick" |
||||
|
:routeName="routeName" |
||||
|
@updataTableColumns="updataTableColumns" |
||||
|
@searchFormClick="searchFormClick" |
||||
|
:allSchemas="Qualityformlog.allSchemas" |
||||
|
/> |
||||
|
|
||||
|
<!-- 列表 --> |
||||
|
<ContentWrap> |
||||
|
<Table |
||||
|
:columns="tableColumns" |
||||
|
:data="tableObject.tableList" |
||||
|
:loading="tableObject.loading" |
||||
|
:pagination="{ |
||||
|
total: tableObject.total |
||||
|
}" |
||||
|
v-model:pageSize="tableObject.pageSize" |
||||
|
v-model:currentPage="tableObject.currentPage" |
||||
|
v-model:sort="tableObject.sort" |
||||
|
> |
||||
|
<template #code="{row}"> |
||||
|
<el-button type="primary" link @click="openDetail(row, '代码', row.code)"> |
||||
|
<span>{{ row.code }}</span> |
||||
|
</el-button> |
||||
|
</template> |
||||
|
<template #action="{ row }"> |
||||
|
<ButtonBase :Butttondata="butttondata" @button-base-click="buttonTableClick($event,row)" /> |
||||
|
</template> |
||||
|
</Table> |
||||
|
</ContentWrap> |
||||
|
|
||||
|
<!-- 表单弹窗:添加/修改 --> |
||||
|
<BasicForm |
||||
|
ref="basicFormRef" |
||||
|
@success="formsSuccess" |
||||
|
:rules="QualityformlogRules" |
||||
|
:formAllSchemas="Qualityformlog.allSchemas" |
||||
|
:apiUpdate="QualityformlogApi.updateQualityformlog" |
||||
|
:apiCreate="QualityformlogApi.createQualityformlog" |
||||
|
@searchTableSuccess="searchTableSuccess" |
||||
|
:isBusiness="false" |
||||
|
/> |
||||
|
|
||||
|
<!-- 详情 --> |
||||
|
<Detail ref="detailRef" :isBasic="true" :allSchemas="Qualityformlog.allSchemas" /> |
||||
|
|
||||
|
<!-- 导入 --> |
||||
|
<ImportForm ref="importFormRef" url="/mes/qualityformlog/import" :importTemplateData="importTemplateData" @success="importSuccess" /> |
||||
|
</template> |
||||
|
|
||||
|
<script setup lang="ts"> |
||||
|
import download from '@/utils/download' |
||||
|
import { Qualityformlog,QualityformlogRules } from './qualityformlog.data' |
||||
|
import * as QualityformlogApi from '@/api/mes/qualityformlog' |
||||
|
import * as defaultButtons from '@/utils/disposition/defaultButtons' |
||||
|
import TableHead from '@/components/TableHead/src/TableHead.vue' |
||||
|
import ImportForm from '@/components/ImportForm/src/ImportForm.vue' |
||||
|
import Detail from '@/components/Detail/src/Detail.vue' |
||||
|
|
||||
|
defineOptions({ name: 'QmsQualityformlog' }) |
||||
|
|
||||
|
const message = useMessage() // 消息弹窗 |
||||
|
const { t } = useI18n() // 国际化 |
||||
|
|
||||
|
const route = useRoute() // 路由信息 |
||||
|
const routeName = ref() |
||||
|
routeName.value = route.name |
||||
|
const tableColumns = ref(Qualityformlog.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: QualityformlogApi.getQualityformlogPage // 分页接口 |
||||
|
}) |
||||
|
|
||||
|
// 获得表格的各种操作 |
||||
|
const { getList, setSearchParams } = tableMethods |
||||
|
|
||||
|
// 列表头部按钮 |
||||
|
const HeadButttondata = [ |
||||
|
//defaultButtons.defaultAddBtn({hasPermi:'mes:qualityformlog:create'}), // 新增 |
||||
|
//defaultButtons.defaultImportBtn({hasPermi:'mes:qualityformlog:import'}), // 导入 |
||||
|
defaultButtons.defaultExportBtn({hasPermi:'mes:qualityformlog:export'}), // 导出 |
||||
|
defaultButtons.defaultFreshBtn(null), // 刷新 |
||||
|
defaultButtons.defaultFilterBtn(null), // 筛选 |
||||
|
defaultButtons.defaultSetBtn(null), // 设置 |
||||
|
// { |
||||
|
// label: '自定义扩展按钮', |
||||
|
// name: 'zdy', |
||||
|
// hide: false, |
||||
|
// type: 'primary', |
||||
|
// icon: 'Select', |
||||
|
// color: '' |
||||
|
// }, |
||||
|
] |
||||
|
|
||||
|
// 头部按钮事件 |
||||
|
const buttonBaseClick = (val, item) => { |
||||
|
if (val == 'add') { // 新增 |
||||
|
openForm('create') |
||||
|
} else if (val == 'import') { // 导入 |
||||
|
handleImport() |
||||
|
} else if (val == 'export') { // 导出 |
||||
|
handleExport() |
||||
|
} else if (val == 'refresh') { // 刷新 |
||||
|
getList() |
||||
|
} else if (val == 'filtrate') { // 筛选 |
||||
|
} else { // 其他按钮 |
||||
|
console.log('其他按钮', item) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// 列表-操作按钮 |
||||
|
const butttondata = [ |
||||
|
defaultButtons.mainListEditBtn({hasPermi:'mes:qualityformlog:update'}), // 编辑 |
||||
|
defaultButtons.mainListDeleteBtn({hasPermi:'mes:qualityformlog:delete'}), // 删除 |
||||
|
] |
||||
|
|
||||
|
// 列表-操作按钮事件 |
||||
|
const buttonTableClick = async (val, row) => { |
||||
|
if (val == 'edit') { // 编辑 |
||||
|
openForm('update', row) |
||||
|
} else if (val == 'delete') { // 删除 |
||||
|
handleDelete(row.id) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/** 添加/修改操作 */ |
||||
|
const basicFormRef = ref() |
||||
|
const openForm = (type: string, row?: any) => { |
||||
|
basicFormRef.value.open(type, row) |
||||
|
} |
||||
|
|
||||
|
// form表单提交 |
||||
|
const formsSuccess = async (formType,data) => { |
||||
|
var isHave =Qualityformlog.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 QualityformlogApi.createQualityformlog(data) |
||||
|
message.success(t('common.createSuccess')) |
||||
|
} else { |
||||
|
await QualityformlogApi.updateQualityformlog(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, 'basicQualityformlog') |
||||
|
} |
||||
|
|
||||
|
/** 删除按钮操作 */ |
||||
|
const handleDelete = async (id: number) => { |
||||
|
try { |
||||
|
// 删除的二次确认 |
||||
|
await message.delConfirm() |
||||
|
// 发起删除 |
||||
|
await QualityformlogApi.deleteQualityformlog(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 QualityformlogApi.exportQualityformlog(tableObject.params) |
||||
|
download.excel(data, '质检表单日志.xlsx') |
||||
|
} catch { |
||||
|
} finally { |
||||
|
exportLoading.value = false |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/** 导入 */ |
||||
|
const importFormRef = ref() |
||||
|
const handleImport = () => { |
||||
|
importFormRef.value.open() |
||||
|
} |
||||
|
// 导入附件弹窗所需的参数 |
||||
|
const importTemplateData = reactive({ |
||||
|
templateUrl: '', |
||||
|
templateTitle: '质检表单日志导入模版.xlsx' |
||||
|
}) |
||||
|
// 导入成功之后 |
||||
|
const importSuccess = () => { |
||||
|
getList() |
||||
|
} |
||||
|
|
||||
|
// 筛选提交 |
||||
|
const searchFormClick = (searchData) => { |
||||
|
tableObject.params = { |
||||
|
isSearch: true, |
||||
|
filters: searchData.filters |
||||
|
} |
||||
|
getList() // 刷新当前列表 |
||||
|
} |
||||
|
|
||||
|
/** 初始化 **/ |
||||
|
onMounted(async () => { |
||||
|
getList() |
||||
|
importTemplateData.templateUrl = await QualityformlogApi.importTemplate() |
||||
|
}) |
||||
|
|
||||
|
</script> |
@ -0,0 +1,197 @@ |
|||||
|
import type { CrudSchema } from '@/hooks/web/useCrudSchemas' |
||||
|
import { dateFormatter } from '@/utils/formatTime' |
||||
|
|
||||
|
// 表单校验
|
||||
|
export const QualityformlogRules = reactive({ |
||||
|
concurrencyStamp: [required], |
||||
|
masterId: [required], |
||||
|
}) |
||||
|
|
||||
|
export const Qualityformlog = useCrudSchemas(reactive<CrudSchema[]>([ |
||||
|
{ |
||||
|
label: '删除时间', |
||||
|
field: 'deleteTime', |
||||
|
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: '主键', |
||||
|
field: 'id', |
||||
|
sort: 'custom', |
||||
|
isForm: false, |
||||
|
isTable: false, |
||||
|
isDetail:false |
||||
|
}, |
||||
|
{ |
||||
|
label: '状态', |
||||
|
field: 'status', |
||||
|
sort: 'custom', |
||||
|
isSearch: false, |
||||
|
isTable: false, |
||||
|
isForm:false, |
||||
|
isDetail:false, |
||||
|
form: { |
||||
|
component: 'Radio' |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
label: '并发乐观锁', |
||||
|
field: 'concurrencyStamp', |
||||
|
sort: 'custom', |
||||
|
isSearch: false, |
||||
|
isTable: false, |
||||
|
isForm:false, |
||||
|
isDetail:false, |
||||
|
form: { |
||||
|
component: 'InputNumber', |
||||
|
value: 0 |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
label: '备注', |
||||
|
field: 'remark', |
||||
|
sort: 'custom', |
||||
|
isSearch: false, |
||||
|
isTable: false, |
||||
|
isDetail:false, |
||||
|
}, |
||||
|
{ |
||||
|
label: '创建时间', |
||||
|
field: 'createTime', |
||||
|
sort: 'custom', |
||||
|
formatter: dateFormatter, |
||||
|
isSearch: false, |
||||
|
isTable: 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: '删除用户名', |
||||
|
field: 'deleter', |
||||
|
sort: 'custom', |
||||
|
isSearch: false, |
||||
|
isTable: false, |
||||
|
isForm: false, |
||||
|
isDetail:false |
||||
|
}, |
||||
|
{ |
||||
|
label: '位置ID', |
||||
|
field: 'siteId', |
||||
|
sort: 'custom', |
||||
|
isSearch: false, |
||||
|
isTable: false, |
||||
|
isForm: false, |
||||
|
isDetail:false, |
||||
|
form: { |
||||
|
component: 'InputNumber', |
||||
|
value: 0 |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
label: '主表编号', |
||||
|
field: 'masterId', |
||||
|
sort: 'custom', |
||||
|
isSearch: false, |
||||
|
isTable: false, |
||||
|
isForm: false, |
||||
|
isDetail:false, |
||||
|
form: { |
||||
|
component: 'InputNumber', |
||||
|
value: 0 |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
label: '表单编号', |
||||
|
field: 'formNo', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
}, |
||||
|
{ |
||||
|
label: '操作类型', |
||||
|
field: 'operation', |
||||
|
sort: 'custom', |
||||
|
dictType: DICT_TYPE.QUALIFY_FORM_OPERATION, |
||||
|
dictClass: 'string', |
||||
|
isSearch: true, |
||||
|
}, |
||||
|
{ |
||||
|
label: '操作人员', |
||||
|
field: 'operator', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
}, |
||||
|
{ |
||||
|
label: '操作内容', |
||||
|
field: 'operateContent', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
form: { |
||||
|
component: 'Editor', |
||||
|
componentProps: { |
||||
|
valueHtml: '', |
||||
|
height: 200 |
||||
|
} |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
label: '操作时间', |
||||
|
field: 'operateTime', |
||||
|
sort: 'custom', |
||||
|
formatter: dateFormatter, |
||||
|
isSearch: true, |
||||
|
search: { |
||||
|
component: 'DatePicker', |
||||
|
componentProps: { |
||||
|
valueFormat: 'YYYY-MM-DD HH:mm:ss', |
||||
|
type: 'daterange', |
||||
|
defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')] |
||||
|
} |
||||
|
}, |
||||
|
form: { |
||||
|
component: 'DatePicker', |
||||
|
componentProps: { |
||||
|
type: 'datetime', |
||||
|
valueFormat: 'x' |
||||
|
} |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
label: '操作', |
||||
|
field: 'action', |
||||
|
isSearch: false, |
||||
|
isTable: false, |
||||
|
isForm: false, |
||||
|
isDetail:false, |
||||
|
table: { |
||||
|
width: 150, |
||||
|
fixed: 'right' |
||||
|
} |
||||
|
} |
||||
|
])) |
@ -0,0 +1,244 @@ |
|||||
|
<template> |
||||
|
<ContentWrap> |
||||
|
<!-- 搜索工作栏 --> |
||||
|
<Search :schema="Qualitygroup.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" /> |
||||
|
</ContentWrap> |
||||
|
|
||||
|
<!-- 列表头部 --> |
||||
|
<TableHead |
||||
|
:HeadButttondata="HeadButttondata" |
||||
|
@button-base-click="buttonBaseClick" |
||||
|
:routeName="routeName" |
||||
|
@updataTableColumns="updataTableColumns" |
||||
|
@searchFormClick="searchFormClick" |
||||
|
:allSchemas="Qualitygroup.allSchemas" |
||||
|
/> |
||||
|
|
||||
|
<!-- 列表 --> |
||||
|
<ContentWrap> |
||||
|
<Table |
||||
|
:columns="tableColumns" |
||||
|
:data="tableObject.tableList" |
||||
|
:loading="tableObject.loading" |
||||
|
:pagination="{ |
||||
|
total: tableObject.total |
||||
|
}" |
||||
|
v-model:pageSize="tableObject.pageSize" |
||||
|
v-model:currentPage="tableObject.currentPage" |
||||
|
v-model:sort="tableObject.sort" |
||||
|
> |
||||
|
<template #code="{row}"> |
||||
|
<el-button type="primary" link @click="openDetail(row, '代码', row.code)"> |
||||
|
<span>{{ row.code }}</span> |
||||
|
</el-button> |
||||
|
</template> |
||||
|
<template #action="{ row }"> |
||||
|
<ButtonBase :Butttondata="butttondata" @button-base-click="buttonTableClick($event,row)" /> |
||||
|
</template> |
||||
|
</Table> |
||||
|
</ContentWrap> |
||||
|
|
||||
|
<!-- 表单弹窗:添加/修改 --> |
||||
|
<BasicForm |
||||
|
ref="basicFormRef" |
||||
|
@success="formsSuccess" |
||||
|
:rules="QualitygroupRules" |
||||
|
:formAllSchemas="Qualitygroup.allSchemas" |
||||
|
:apiUpdate="QualitygroupApi.updateQualitygroup" |
||||
|
:apiCreate="QualitygroupApi.createQualitygroup" |
||||
|
@searchTableSuccess="searchTableSuccess" |
||||
|
:isBusiness="false" |
||||
|
/> |
||||
|
|
||||
|
<!-- 详情 --> |
||||
|
<Detail ref="detailRef" :isBasic="true" :allSchemas="Qualitygroup.allSchemas" /> |
||||
|
|
||||
|
<!-- 导入 --> |
||||
|
<ImportForm ref="importFormRef" url="/mes/qualitygroup/import" :importTemplateData="importTemplateData" @success="importSuccess" /> |
||||
|
</template> |
||||
|
|
||||
|
<script setup lang="ts"> |
||||
|
import download from '@/utils/download' |
||||
|
import { Qualitygroup,QualitygroupRules } from './qualitygroup.data' |
||||
|
import * as QualitygroupApi from '@/api/mes/qualitygroup' |
||||
|
import * as defaultButtons from '@/utils/disposition/defaultButtons' |
||||
|
import TableHead from '@/components/TableHead/src/TableHead.vue' |
||||
|
import ImportForm from '@/components/ImportForm/src/ImportForm.vue' |
||||
|
import Detail from '@/components/Detail/src/Detail.vue' |
||||
|
|
||||
|
defineOptions({ name: 'QmsQualitygroup' }) |
||||
|
|
||||
|
const message = useMessage() // 消息弹窗 |
||||
|
const { t } = useI18n() // 国际化 |
||||
|
|
||||
|
const route = useRoute() // 路由信息 |
||||
|
const routeName = ref() |
||||
|
routeName.value = route.name |
||||
|
const tableColumns = ref(Qualitygroup.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: QualitygroupApi.getQualitygroupPage // 分页接口 |
||||
|
}) |
||||
|
|
||||
|
// 获得表格的各种操作 |
||||
|
const { getList, setSearchParams } = tableMethods |
||||
|
|
||||
|
// 列表头部按钮 |
||||
|
const HeadButttondata = [ |
||||
|
defaultButtons.defaultAddBtn({hasPermi:'mes:qualitygroup:create'}), // 新增 |
||||
|
defaultButtons.defaultImportBtn({hasPermi:'mes:qualitygroup:import'}), // 导入 |
||||
|
defaultButtons.defaultExportBtn({hasPermi:'mes:qualitygroup:export'}), // 导出 |
||||
|
defaultButtons.defaultFreshBtn(null), // 刷新 |
||||
|
defaultButtons.defaultFilterBtn(null), // 筛选 |
||||
|
defaultButtons.defaultSetBtn(null), // 设置 |
||||
|
// { |
||||
|
// label: '自定义扩展按钮', |
||||
|
// name: 'zdy', |
||||
|
// hide: false, |
||||
|
// type: 'primary', |
||||
|
// icon: 'Select', |
||||
|
// color: '' |
||||
|
// }, |
||||
|
] |
||||
|
|
||||
|
// 头部按钮事件 |
||||
|
const buttonBaseClick = (val, item) => { |
||||
|
if (val == 'add') { // 新增 |
||||
|
openForm('create') |
||||
|
} else if (val == 'import') { // 导入 |
||||
|
handleImport() |
||||
|
} else if (val == 'export') { // 导出 |
||||
|
handleExport() |
||||
|
} else if (val == 'refresh') { // 刷新 |
||||
|
getList() |
||||
|
} else if (val == 'filtrate') { // 筛选 |
||||
|
} else { // 其他按钮 |
||||
|
console.log('其他按钮', item) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// 列表-操作按钮 |
||||
|
const butttondata = [ |
||||
|
defaultButtons.mainListEditBtn({hasPermi:'mes:qualitygroup:update'}), // 编辑 |
||||
|
defaultButtons.mainListDeleteBtn({hasPermi:'mes:qualitygroup:delete'}), // 删除 |
||||
|
] |
||||
|
|
||||
|
// 列表-操作按钮事件 |
||||
|
const buttonTableClick = async (val, row) => { |
||||
|
if (val == 'edit') { // 编辑 |
||||
|
openForm('update', row) |
||||
|
} else if (val == 'delete') { // 删除 |
||||
|
handleDelete(row.id) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/** 添加/修改操作 */ |
||||
|
const basicFormRef = ref() |
||||
|
const openForm = (type: string, row?: any) => { |
||||
|
basicFormRef.value.open(type, row) |
||||
|
} |
||||
|
|
||||
|
// form表单提交 |
||||
|
const formsSuccess = async (formType,data) => { |
||||
|
var isHave =Qualitygroup.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 QualitygroupApi.createQualitygroup(data) |
||||
|
message.success(t('common.createSuccess')) |
||||
|
} else { |
||||
|
await QualitygroupApi.updateQualitygroup(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, 'basicQualitygroup') |
||||
|
} |
||||
|
|
||||
|
/** 删除按钮操作 */ |
||||
|
const handleDelete = async (id: number) => { |
||||
|
try { |
||||
|
// 删除的二次确认 |
||||
|
await message.delConfirm() |
||||
|
// 发起删除 |
||||
|
await QualitygroupApi.deleteQualitygroup(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 QualitygroupApi.exportQualitygroup(tableObject.params) |
||||
|
download.excel(data, '质检分组.xlsx') |
||||
|
} catch { |
||||
|
} finally { |
||||
|
exportLoading.value = false |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/** 导入 */ |
||||
|
const importFormRef = ref() |
||||
|
const handleImport = () => { |
||||
|
importFormRef.value.open() |
||||
|
} |
||||
|
// 导入附件弹窗所需的参数 |
||||
|
const importTemplateData = reactive({ |
||||
|
templateUrl: '', |
||||
|
templateTitle: '质检分组导入模版.xlsx' |
||||
|
}) |
||||
|
// 导入成功之后 |
||||
|
const importSuccess = () => { |
||||
|
getList() |
||||
|
} |
||||
|
|
||||
|
// 筛选提交 |
||||
|
const searchFormClick = (searchData) => { |
||||
|
tableObject.params = { |
||||
|
isSearch: true, |
||||
|
filters: searchData.filters |
||||
|
} |
||||
|
getList() // 刷新当前列表 |
||||
|
} |
||||
|
|
||||
|
/** 初始化 **/ |
||||
|
onMounted(async () => { |
||||
|
getList() |
||||
|
importTemplateData.templateUrl = await QualitygroupApi.importTemplate() |
||||
|
}) |
||||
|
|
||||
|
</script> |
@ -0,0 +1,151 @@ |
|||||
|
import type { CrudSchema } from '@/hooks/web/useCrudSchemas' |
||||
|
import { dateFormatter } from '@/utils/formatTime' |
||||
|
|
||||
|
// 表单校验
|
||||
|
export const QualitygroupRules = reactive({ |
||||
|
concurrencyStamp: [required], |
||||
|
code: [required], |
||||
|
name: [required], |
||||
|
}) |
||||
|
|
||||
|
export const Qualitygroup = useCrudSchemas(reactive<CrudSchema[]>([ |
||||
|
{ |
||||
|
label: '删除时间', |
||||
|
field: 'deleteTime', |
||||
|
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: '主键', |
||||
|
field: 'id', |
||||
|
sort: 'custom', |
||||
|
isForm: false, |
||||
|
isTable: false, |
||||
|
isDetail:false |
||||
|
}, |
||||
|
{ |
||||
|
label: '并发乐观锁', |
||||
|
field: 'concurrencyStamp', |
||||
|
sort: 'custom', |
||||
|
isSearch: false, |
||||
|
isTable: false, |
||||
|
isForm:false, |
||||
|
isDetail:false, |
||||
|
form: { |
||||
|
component: 'InputNumber', |
||||
|
value: 0 |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
label: '创建时间', |
||||
|
field: 'createTime', |
||||
|
sort: 'custom', |
||||
|
formatter: dateFormatter, |
||||
|
isSearch: false, |
||||
|
isTable: 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: '删除用户名', |
||||
|
field: 'deleter', |
||||
|
sort: 'custom', |
||||
|
isSearch: false, |
||||
|
isTable: false, |
||||
|
isForm: false, |
||||
|
isDetail:false |
||||
|
}, |
||||
|
{ |
||||
|
label: '位置ID', |
||||
|
field: 'siteId', |
||||
|
sort: 'custom', |
||||
|
isSearch: false, |
||||
|
isTable: false, |
||||
|
isForm: false, |
||||
|
isDetail:false, |
||||
|
form: { |
||||
|
component: 'InputNumber', |
||||
|
value: 0 |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
label: '编码', |
||||
|
field: 'code', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
}, |
||||
|
{ |
||||
|
label: '编码名称', |
||||
|
field: 'name', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
}, |
||||
|
{ |
||||
|
label: '分组类别', |
||||
|
field: 'groupCode', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
}, |
||||
|
{ |
||||
|
label: '状态', |
||||
|
field: 'status', |
||||
|
sort: 'custom', |
||||
|
dictType: DICT_TYPE.QUALIFY_STATUS, |
||||
|
dictClass: 'string', |
||||
|
isForm: true, |
||||
|
isSearch: true, |
||||
|
isTable: true, |
||||
|
form: { |
||||
|
component: 'Switch', |
||||
|
value: '2', |
||||
|
componentProps: { |
||||
|
inactiveValue: '2', |
||||
|
activeValue: '1' |
||||
|
} |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
label: '操作', |
||||
|
field: 'action', |
||||
|
isForm: false, |
||||
|
isDetail:false, |
||||
|
table: { |
||||
|
width: 150, |
||||
|
fixed: 'right' |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '备注', |
||||
|
field: 'remark', |
||||
|
sort: 'custom', |
||||
|
isSearch: false, |
||||
|
isTable: false |
||||
|
} |
||||
|
])) |
@ -0,0 +1,258 @@ |
|||||
|
<template> |
||||
|
<ContentWrap> |
||||
|
<!-- 搜索工作栏 --> |
||||
|
<Search :schema="ReworkSingle.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" /> |
||||
|
</ContentWrap> |
||||
|
|
||||
|
<!-- 列表头部 --> |
||||
|
<TableHead |
||||
|
:HeadButttondata="HeadButttondata" |
||||
|
@button-base-click="buttonBaseClick" |
||||
|
:routeName="routeName" |
||||
|
@updataTableColumns="updataTableColumns" |
||||
|
@searchFormClick="searchFormClick" |
||||
|
:allSchemas="ReworkSingle.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 #reworkbillNo="{row}"> |
||||
|
<el-button type="primary" link @click="openDetail(row, '单据号', row.reworkbillNo)"> |
||||
|
<span>{{ row.reworkbillNo }}</span> |
||||
|
</el-button> |
||||
|
</template> |
||||
|
<template #action="{ row }"> |
||||
|
<ButtonBase :Butttondata="butttondata" @button-base-click="buttonTableClick($event,row)" /> |
||||
|
</template> |
||||
|
</Table> |
||||
|
</ContentWrap> |
||||
|
|
||||
|
<!-- 表单弹窗:添加/修改 --> |
||||
|
<BasicForm |
||||
|
ref="basicFormRef" |
||||
|
@success="formsSuccess" |
||||
|
:rules="ReworkSingleRules" |
||||
|
:formAllSchemas="ReworkSingle.allSchemas" |
||||
|
:apiUpdate="ReworkSingleApi.updateReworkSingle" |
||||
|
:apiCreate="ReworkSingleApi.createReworkSingle" |
||||
|
@searchTableSuccess="searchTableSuccess" |
||||
|
:isBusiness="false" |
||||
|
/> |
||||
|
|
||||
|
<!-- 详情 --> |
||||
|
<Detail ref="detailRef" :isBasic="true" :allSchemas="ReworkSingle.allSchemas" /> |
||||
|
|
||||
|
<!-- 导入 --> |
||||
|
<ImportForm ref="importFormRef" url="/mes/rework-single/import" :importTemplateData="importTemplateData" @success="importSuccess" /> |
||||
|
</template> |
||||
|
|
||||
|
<script setup lang="ts"> |
||||
|
import download from '@/utils/download' |
||||
|
import { ReworkSingle,ReworkSingleRules } from './reworkSingle.data' |
||||
|
import * as ReworkSingleApi from '@/api/mes/reworkSingle' |
||||
|
import * as defaultButtons from '@/utils/disposition/defaultButtons' |
||||
|
import TableHead from '@/components/TableHead/src/TableHead.vue' |
||||
|
import ImportForm from '@/components/ImportForm/src/ImportForm.vue' |
||||
|
import Detail from '@/components/Detail/src/Detail.vue' |
||||
|
|
||||
|
defineOptions({ name: 'MesReworkSingle' }) |
||||
|
|
||||
|
const message = useMessage() // 消息弹窗 |
||||
|
const { t } = useI18n() // 国际化 |
||||
|
|
||||
|
const route = useRoute() // 路由信息 |
||||
|
const routeName = ref() |
||||
|
routeName.value = route.name |
||||
|
const tableColumns = ref(ReworkSingle.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: ReworkSingleApi.getReworkSinglePage // 分页接口 |
||||
|
}) |
||||
|
|
||||
|
// 获得表格的各种操作 |
||||
|
const { getList, setSearchParams } = tableMethods |
||||
|
|
||||
|
// 列表头部按钮 |
||||
|
const HeadButttondata = [ |
||||
|
defaultButtons.defaultAddBtn({hasPermi:'mes:reworkSingle:create'}), // 新增 |
||||
|
//defaultButtons.defaultImportBtn({hasPermi:'mes:reworkSingle:import'}), // 导入 |
||||
|
defaultButtons.defaultExportBtn({hasPermi:'mes:reworkSingle:export'}), // 导出 |
||||
|
defaultButtons.defaultFreshBtn(null), // 刷新 |
||||
|
defaultButtons.defaultFilterBtn(null), // 筛选 |
||||
|
defaultButtons.defaultSetBtn(null), // 设置 |
||||
|
// { |
||||
|
// label: '自定义扩展按钮', |
||||
|
// name: 'zdy', |
||||
|
// hide: false, |
||||
|
// type: 'primary', |
||||
|
// icon: 'Select', |
||||
|
// color: '' |
||||
|
// }, |
||||
|
] |
||||
|
|
||||
|
// 头部按钮事件 |
||||
|
const buttonBaseClick = (val, item) => { |
||||
|
if (val == 'add') { // 新增 |
||||
|
openForm('create') |
||||
|
} else if (val == 'import') { // 导入 |
||||
|
handleImport() |
||||
|
} else if (val == 'export') { // 导出 |
||||
|
handleExport() |
||||
|
} else if (val == 'refresh') { // 刷新 |
||||
|
getList() |
||||
|
} else if (val == 'filtrate') { // 筛选 |
||||
|
} else { // 其他按钮 |
||||
|
console.log('其他按钮', item) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// 列表-操作按钮 |
||||
|
const butttondata = [ |
||||
|
defaultButtons.mainListEditBtn({hasPermi:'mes:reworkSingle:update'}), // 编辑 |
||||
|
defaultButtons.mainListDeleteBtn({hasPermi:'mes:reworkSingle:delete'}), // 删除 |
||||
|
] |
||||
|
|
||||
|
// 列表-操作按钮事件 |
||||
|
const buttonTableClick = async (val, row) => { |
||||
|
if (val == 'edit') { // 编辑 |
||||
|
openForm('update', row) |
||||
|
} else if (val == 'delete') { // 删除 |
||||
|
handleDelete(row.id) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/** 添加/修改操作 */ |
||||
|
const basicFormRef = ref() |
||||
|
const openForm = (type: string, row?: any) => { |
||||
|
if(type == "create"){ |
||||
|
ReworkSingle.allSchemas.formSchema.forEach((item) => { |
||||
|
if(item.field == 'status'){ |
||||
|
item.value = '1'; |
||||
|
item.componentProps.disabled = true |
||||
|
} |
||||
|
}) |
||||
|
}else{ |
||||
|
ReworkSingle.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 =ReworkSingle.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 ReworkSingleApi.createReworkSingle(data) |
||||
|
message.success(t('common.createSuccess')) |
||||
|
} else { |
||||
|
await ReworkSingleApi.updateReworkSingle(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, 'basicReworkSingle') |
||||
|
} |
||||
|
|
||||
|
/** 删除按钮操作 */ |
||||
|
const handleDelete = async (id: number) => { |
||||
|
try { |
||||
|
// 删除的二次确认 |
||||
|
await message.delConfirm() |
||||
|
// 发起删除 |
||||
|
await ReworkSingleApi.deleteReworkSingle(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 ReworkSingleApi.exportReworkSingle(tableObject.params) |
||||
|
download.excel(data, '返工登记单件.xlsx') |
||||
|
} catch { |
||||
|
} finally { |
||||
|
exportLoading.value = false |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/** 导入 */ |
||||
|
const importFormRef = ref() |
||||
|
const handleImport = () => { |
||||
|
importFormRef.value.open() |
||||
|
} |
||||
|
// 导入附件弹窗所需的参数 |
||||
|
const importTemplateData = reactive({ |
||||
|
templateUrl: '', |
||||
|
templateTitle: '返工登记单件导入模版.xlsx' |
||||
|
}) |
||||
|
// 导入成功之后 |
||||
|
const importSuccess = () => { |
||||
|
getList() |
||||
|
} |
||||
|
|
||||
|
// 筛选提交 |
||||
|
const searchFormClick = (searchData) => { |
||||
|
tableObject.params = { |
||||
|
isSearch: true, |
||||
|
filters: searchData.filters |
||||
|
} |
||||
|
getList() // 刷新当前列表 |
||||
|
} |
||||
|
|
||||
|
/** 初始化 **/ |
||||
|
onMounted(async () => { |
||||
|
getList() |
||||
|
importTemplateData.templateUrl = await ReworkSingleApi.importTemplate() |
||||
|
}) |
||||
|
|
||||
|
</script> |
@ -0,0 +1,219 @@ |
|||||
|
import type { CrudSchema } from '@/hooks/web/useCrudSchemas' |
||||
|
import { dateFormatter } from '@/utils/formatTime' |
||||
|
import * as ItembasicApi from '@/api/wms/itembasic' |
||||
|
import { Itembasic } from '@/views/wms/basicDataManage/itemManage/itembasic/itembasic.data' |
||||
|
|
||||
|
// 表单校验
|
||||
|
export const ReworkSingleRules = reactive({ |
||||
|
reworkType: [required], |
||||
|
productionCode:[required], |
||||
|
replaceFlag:[required], |
||||
|
status:[required], |
||||
|
}) |
||||
|
|
||||
|
export const ReworkSingle = useCrudSchemas(reactive<CrudSchema[]>([ |
||||
|
{ |
||||
|
label: '删除时间', |
||||
|
field: 'deleteTime', |
||||
|
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: '主键', |
||||
|
field: 'id', |
||||
|
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: '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')] |
||||
|
} |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
label: '删除用户名', |
||||
|
field: 'deleter', |
||||
|
sort: 'custom', |
||||
|
isSearch: false, |
||||
|
isTable: false, |
||||
|
isForm:false, |
||||
|
isDetail:false, |
||||
|
}, |
||||
|
{ |
||||
|
label: '位置ID', |
||||
|
field: 'siteId', |
||||
|
sort: 'custom', |
||||
|
isSearch: false, |
||||
|
isTable: false, |
||||
|
isForm:false, |
||||
|
isDetail:false, |
||||
|
form: { |
||||
|
component: 'InputNumber', |
||||
|
value: 0 |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
label: '单据号', |
||||
|
field: 'reworkbillNo', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
isForm: false, |
||||
|
isDetail: true |
||||
|
}, |
||||
|
{ |
||||
|
label: '工作类型', |
||||
|
field: 'reworkType', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
dictType: DICT_TYPE.REWORK_TYPE, |
||||
|
dictClass: 'string', |
||||
|
}, |
||||
|
{ |
||||
|
label: '产品编码', |
||||
|
field: 'productionCode', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
form: { |
||||
|
componentProps: { |
||||
|
isSearchList: true, // 开启查询弹窗
|
||||
|
searchTitle: '产品编码', // 查询弹窗标题
|
||||
|
searchAllSchemas: Itembasic.allSchemas, // 查询弹窗所需类
|
||||
|
searchField: 'code', // 查询弹窗赋值字段
|
||||
|
searchPage: ItembasicApi.getItembasicPage, // 查询弹窗所需分页方法
|
||||
|
searchCondition: [{ |
||||
|
key: 'available', |
||||
|
value: 'TRUE', |
||||
|
isMainValue: false |
||||
|
}, |
||||
|
{ |
||||
|
key: 'type', |
||||
|
action: 'in', // 查询拼接条件
|
||||
|
isSearch: true, // 使用自定义拼接条件
|
||||
|
value: 'BCP,CCP',//,SEMI]
|
||||
|
isMainValue: false |
||||
|
}] |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '返修动作', |
||||
|
field: 'reworkAction', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
}, |
||||
|
{ |
||||
|
label: '是否有替换件', |
||||
|
field: 'replaceFlag', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
dictType: DICT_TYPE.REWORK_REPLACE_FLAG, |
||||
|
dictClass: 'string', |
||||
|
}, |
||||
|
{ |
||||
|
label: '返修人员', |
||||
|
field: 'reworkPersoncode', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
}, |
||||
|
{ |
||||
|
label: '返修时间', |
||||
|
field: 'reworkTime', |
||||
|
sort: 'custom', |
||||
|
formatter: dateFormatter, |
||||
|
isSearch: true, |
||||
|
search: { |
||||
|
component: 'DatePicker', |
||||
|
componentProps: { |
||||
|
valueFormat: 'YYYY-MM-DD HH:mm:ss', |
||||
|
type: 'daterange', |
||||
|
defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')] |
||||
|
} |
||||
|
}, |
||||
|
form: { |
||||
|
component: 'DatePicker', |
||||
|
componentProps: { |
||||
|
type: 'datetime', |
||||
|
valueFormat: 'x' |
||||
|
} |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
label: '返修结果', |
||||
|
field: 'reworkResult', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
}, |
||||
|
|
||||
|
{ |
||||
|
label: '状态', |
||||
|
field: 'status', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
dictType: DICT_TYPE.REWORK_STATUS, |
||||
|
dictClass: 'string', |
||||
|
}, |
||||
|
{ |
||||
|
label: '备注', |
||||
|
field: 'remark', |
||||
|
sort: 'custom', |
||||
|
isSearch: false, |
||||
|
isTable: false, |
||||
|
}, |
||||
|
{ |
||||
|
label: '操作', |
||||
|
field: 'action', |
||||
|
isForm: false, |
||||
|
table: { |
||||
|
width: 150, |
||||
|
fixed: 'right' |
||||
|
} |
||||
|
} |
||||
|
])) |
@ -0,0 +1,332 @@ |
|||||
|
import type { CrudSchema } from '@/hooks/web/useCrudSchemas' |
||||
|
import { dateFormatter } from '@/utils/formatTime' |
||||
|
|
||||
|
// 表单校验
|
||||
|
export const AqlRules = reactive({ |
||||
|
sampleProgCode: [required], |
||||
|
inspectionQualification: [required], |
||||
|
sampleCharacterCode: [required], |
||||
|
sampleSize: [required], |
||||
|
available: [required], |
||||
|
}) |
||||
|
|
||||
|
export const Aql = useCrudSchemas(reactive<CrudSchema[]>([ |
||||
|
{ |
||||
|
label: 'id', |
||||
|
field: 'id', |
||||
|
sort: 'custom', |
||||
|
isTable: false, |
||||
|
isForm: false, |
||||
|
}, |
||||
|
{ |
||||
|
label: '编码', |
||||
|
field: 'sampleProgCode', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
}, |
||||
|
{ |
||||
|
label: '检验严格性', |
||||
|
field: 'inspectionQualification', |
||||
|
sort: 'custom', |
||||
|
dictType: DICT_TYPE.INSPECTION_SEVERITY, |
||||
|
dictClass: 'string', // 默认都是字符串类型其他暂不考虑
|
||||
|
isSearch: true, |
||||
|
form: { |
||||
|
component: 'SelectV2' |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
label: '样本字码', |
||||
|
field: 'sampleCharacterCode', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
}, |
||||
|
{ |
||||
|
label: '样本量', |
||||
|
field: 'sampleSize', |
||||
|
sort: 'custom', |
||||
|
}, |
||||
|
{ |
||||
|
label: 'A0_010', |
||||
|
field: 'a0010', |
||||
|
sort: 'custom', |
||||
|
}, |
||||
|
{ |
||||
|
label: 'R0_010', |
||||
|
field: 'r0010', |
||||
|
sort: 'custom', |
||||
|
}, |
||||
|
{ |
||||
|
label: 'A0_015', |
||||
|
field: 'a0015', |
||||
|
sort: 'custom', |
||||
|
}, |
||||
|
{ |
||||
|
label: 'R0_015', |
||||
|
field: 'r0015', |
||||
|
sort: 'custom', |
||||
|
}, |
||||
|
{ |
||||
|
label: 'A0_025', |
||||
|
field: 'a0025', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
}, |
||||
|
{ |
||||
|
label: 'R0_025', |
||||
|
field: 'r0025', |
||||
|
sort: 'custom', |
||||
|
}, |
||||
|
{ |
||||
|
label: 'A0_040', |
||||
|
field: 'a0040', |
||||
|
sort: 'custom', |
||||
|
}, |
||||
|
{ |
||||
|
label: 'R0_040', |
||||
|
field: 'r0040', |
||||
|
sort: 'custom', |
||||
|
}, |
||||
|
{ |
||||
|
label: 'A0_065', |
||||
|
field: 'a0065', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
}, |
||||
|
{ |
||||
|
label: 'R0_065', |
||||
|
field: 'r0065', |
||||
|
sort: 'custom', |
||||
|
}, |
||||
|
{ |
||||
|
label: 'A0_10', |
||||
|
field: 'a010', |
||||
|
sort: 'custom', |
||||
|
}, |
||||
|
{ |
||||
|
label: 'R0_10', |
||||
|
field: 'r010', |
||||
|
sort: 'custom', |
||||
|
}, |
||||
|
{ |
||||
|
label: 'A0_15', |
||||
|
field: 'a015', |
||||
|
sort: 'custom', |
||||
|
}, |
||||
|
{ |
||||
|
label: 'R0_15', |
||||
|
field: 'r015', |
||||
|
sort: 'custom', |
||||
|
}, |
||||
|
{ |
||||
|
label: 'A0_25', |
||||
|
field: 'a025', |
||||
|
sort: 'custom', |
||||
|
}, |
||||
|
{ |
||||
|
label: 'R0_25', |
||||
|
field: 'r025', |
||||
|
sort: 'custom', |
||||
|
}, |
||||
|
{ |
||||
|
label: 'A0_40', |
||||
|
field: 'a040', |
||||
|
sort: 'custom', |
||||
|
}, |
||||
|
{ |
||||
|
label: 'R0_40', |
||||
|
field: 'r040', |
||||
|
sort: 'custom', |
||||
|
}, |
||||
|
{ |
||||
|
label: 'A0_65', |
||||
|
field: 'a065', |
||||
|
sort: 'custom', |
||||
|
}, |
||||
|
{ |
||||
|
label: 'R0_65', |
||||
|
field: 'r065', |
||||
|
sort: 'custom', |
||||
|
}, |
||||
|
{ |
||||
|
label: 'A1_0', |
||||
|
field: 'a10', |
||||
|
sort: 'custom', |
||||
|
}, |
||||
|
{ |
||||
|
label: 'R1_0', |
||||
|
field: 'r10', |
||||
|
sort: 'custom', |
||||
|
}, |
||||
|
{ |
||||
|
label: 'A1_5', |
||||
|
field: 'a15', |
||||
|
sort: 'custom', |
||||
|
}, |
||||
|
{ |
||||
|
label: 'R1_5', |
||||
|
field: 'r15', |
||||
|
sort: 'custom', |
||||
|
}, |
||||
|
{ |
||||
|
label: 'A2_5', |
||||
|
field: 'a25', |
||||
|
sort: 'custom', |
||||
|
}, |
||||
|
{ |
||||
|
label: 'R2_5', |
||||
|
field: 'r25', |
||||
|
sort: 'custom', |
||||
|
}, |
||||
|
{ |
||||
|
label: 'A4_0', |
||||
|
field: 'a40', |
||||
|
sort: 'custom', |
||||
|
}, |
||||
|
{ |
||||
|
label: 'R4_0', |
||||
|
field: 'r40', |
||||
|
sort: 'custom', |
||||
|
}, |
||||
|
{ |
||||
|
label: 'A6_5', |
||||
|
field: 'a65', |
||||
|
sort: 'custom', |
||||
|
}, |
||||
|
{ |
||||
|
label: 'R6_5', |
||||
|
field: 'r65', |
||||
|
sort: 'custom', |
||||
|
}, |
||||
|
{ |
||||
|
label: 'A10', |
||||
|
field: 'a10', |
||||
|
sort: 'custom', |
||||
|
}, |
||||
|
{ |
||||
|
label: 'R10', |
||||
|
field: 'r10', |
||||
|
sort: 'custom', |
||||
|
}, |
||||
|
{ |
||||
|
label: 'A15', |
||||
|
field: 'a15', |
||||
|
sort: 'custom', |
||||
|
}, |
||||
|
{ |
||||
|
label: 'R15', |
||||
|
field: 'r15', |
||||
|
sort: 'custom', |
||||
|
}, |
||||
|
{ |
||||
|
label: 'A25', |
||||
|
field: 'a25', |
||||
|
sort: 'custom', |
||||
|
}, |
||||
|
{ |
||||
|
label: 'R25', |
||||
|
field: 'r25', |
||||
|
sort: 'custom', |
||||
|
}, |
||||
|
{ |
||||
|
label: 'A40', |
||||
|
field: 'a40', |
||||
|
sort: 'custom', |
||||
|
}, |
||||
|
{ |
||||
|
label: 'R40', |
||||
|
field: 'r40', |
||||
|
sort: 'custom', |
||||
|
}, |
||||
|
{ |
||||
|
label: 'A65', |
||||
|
field: 'a65', |
||||
|
sort: 'custom', |
||||
|
}, |
||||
|
{ |
||||
|
label: 'R65', |
||||
|
field: 'r65', |
||||
|
sort: 'custom', |
||||
|
}, |
||||
|
{ |
||||
|
label: 'A100', |
||||
|
field: 'a100', |
||||
|
sort: 'custom', |
||||
|
}, |
||||
|
{ |
||||
|
label: 'R100', |
||||
|
field: 'r100', |
||||
|
sort: 'custom', |
||||
|
}, |
||||
|
{ |
||||
|
label: 'A150', |
||||
|
field: 'a150', |
||||
|
sort: 'custom', |
||||
|
}, |
||||
|
{ |
||||
|
label: 'R150', |
||||
|
field: 'r150', |
||||
|
sort: 'custom', |
||||
|
}, |
||||
|
{ |
||||
|
label: 'A250', |
||||
|
field: 'a250', |
||||
|
sort: 'custom', |
||||
|
}, |
||||
|
{ |
||||
|
label: 'R250', |
||||
|
field: 'r250', |
||||
|
sort: 'custom', |
||||
|
}, |
||||
|
{ |
||||
|
label: 'A400', |
||||
|
field: 'a400', |
||||
|
sort: 'custom', |
||||
|
}, |
||||
|
{ |
||||
|
label: 'R400', |
||||
|
field: 'r400', |
||||
|
sort: 'custom', |
||||
|
}, |
||||
|
{ |
||||
|
label: 'A650', |
||||
|
field: 'a650', |
||||
|
sort: 'custom', |
||||
|
}, |
||||
|
{ |
||||
|
label: 'R650', |
||||
|
field: 'r650', |
||||
|
sort: 'custom', |
||||
|
}, |
||||
|
{ |
||||
|
label: 'A1000', |
||||
|
field: 'a1000', |
||||
|
sort: 'custom', |
||||
|
}, |
||||
|
{ |
||||
|
label: 'R1000', |
||||
|
field: 'r1000', |
||||
|
sort: 'custom', |
||||
|
}, |
||||
|
{ |
||||
|
label: '是否可用', |
||||
|
field: 'available', |
||||
|
sort: 'custom', |
||||
|
}, |
||||
|
{ |
||||
|
label: '创建时间', |
||||
|
field: 'createTime', |
||||
|
sort: 'custom', |
||||
|
formatter: dateFormatter, |
||||
|
isForm: false, |
||||
|
}, |
||||
|
{ |
||||
|
label: '操作', |
||||
|
field: 'action', |
||||
|
isForm: false, |
||||
|
table: { |
||||
|
width: 150, |
||||
|
fixed: 'right' |
||||
|
} |
||||
|
} |
||||
|
])) |
@ -0,0 +1,244 @@ |
|||||
|
<template> |
||||
|
<ContentWrap> |
||||
|
<!-- 搜索工作栏 --> |
||||
|
<Search :schema="Aql.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" /> |
||||
|
</ContentWrap> |
||||
|
|
||||
|
<!-- 列表头部 --> |
||||
|
<TableHead |
||||
|
:HeadButttondata="HeadButttondata" |
||||
|
@button-base-click="buttonBaseClick" |
||||
|
:routeName="routeName" |
||||
|
@updataTableColumns="updataTableColumns" |
||||
|
@searchFormClick="searchFormClick" |
||||
|
:allSchemas="Aql.allSchemas" |
||||
|
/> |
||||
|
|
||||
|
<!-- 列表 --> |
||||
|
<ContentWrap> |
||||
|
<Table |
||||
|
:columns="tableColumns" |
||||
|
:data="tableObject.tableList" |
||||
|
:loading="tableObject.loading" |
||||
|
:pagination="{ |
||||
|
total: tableObject.total |
||||
|
}" |
||||
|
v-model:pageSize="tableObject.pageSize" |
||||
|
v-model:currentPage="tableObject.currentPage" |
||||
|
v-model:sort="tableObject.sort" |
||||
|
> |
||||
|
<template #code="{row}"> |
||||
|
<el-button type="primary" link @click="openDetail(row, '代码', row.code)"> |
||||
|
<span>{{ row.code }}</span> |
||||
|
</el-button> |
||||
|
</template> |
||||
|
<template #action="{ row }"> |
||||
|
<ButtonBase :Butttondata="butttondata" @button-base-click="buttonTableClick($event,row)" /> |
||||
|
</template> |
||||
|
</Table> |
||||
|
</ContentWrap> |
||||
|
|
||||
|
<!-- 表单弹窗:添加/修改 --> |
||||
|
<BasicForm |
||||
|
ref="basicFormRef" |
||||
|
@success="formsSuccess" |
||||
|
:rules="AqlRules" |
||||
|
:formAllSchemas="Aql.allSchemas" |
||||
|
:apiUpdate="AqlApi.updateAql" |
||||
|
:apiCreate="AqlApi.createAql" |
||||
|
@searchTableSuccess="searchTableSuccess" |
||||
|
:isBusiness="false" |
||||
|
/> |
||||
|
|
||||
|
<!-- 详情 --> |
||||
|
<Detail ref="detailRef" :isBasic="true" :allSchemas="Aql.allSchemas" /> |
||||
|
|
||||
|
<!-- 导入 --> |
||||
|
<ImportForm ref="importFormRef" url="/qms/aql/import" :importTemplateData="importTemplateData" @success="importSuccess" /> |
||||
|
</template> |
||||
|
|
||||
|
<script setup lang="ts"> |
||||
|
import download from '@/utils/download' |
||||
|
import { Aql,AqlRules } from './aql.data' |
||||
|
import * as AqlApi from '@/api/qms/aql' |
||||
|
import * as defaultButtons from '@/utils/disposition/defaultButtons' |
||||
|
import TableHead from '@/components/TableHead/src/TableHead.vue' |
||||
|
import ImportForm from '@/components/ImportForm/src/ImportForm.vue' |
||||
|
import Detail from '@/components/Detail/src/Detail.vue' |
||||
|
|
||||
|
defineOptions({ name: 'Aql' }) |
||||
|
|
||||
|
const message = useMessage() // 消息弹窗 |
||||
|
const { t } = useI18n() // 国际化 |
||||
|
|
||||
|
const route = useRoute() // 路由信息 |
||||
|
const routeName = ref() |
||||
|
routeName.value = route.name |
||||
|
const tableColumns = ref(Aql.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: AqlApi.getAqlPage // 分页接口 |
||||
|
}) |
||||
|
|
||||
|
// 获得表格的各种操作 |
||||
|
const { getList, setSearchParams } = tableMethods |
||||
|
|
||||
|
// 列表头部按钮 |
||||
|
const HeadButttondata = [ |
||||
|
defaultButtons.defaultAddBtn({hasPermi:'wms:aql:create'}), // 新增 |
||||
|
defaultButtons.defaultImportBtn({hasPermi:'wms:aql:import'}), // 导入 |
||||
|
defaultButtons.defaultExportBtn({hasPermi:'wms:aql:export'}), // 导出 |
||||
|
defaultButtons.defaultFreshBtn(null), // 刷新 |
||||
|
defaultButtons.defaultFilterBtn(null), // 筛选 |
||||
|
defaultButtons.defaultSetBtn(null), // 设置 |
||||
|
// { |
||||
|
// label: '自定义扩展按钮', |
||||
|
// name: 'zdy', |
||||
|
// hide: false, |
||||
|
// type: 'primary', |
||||
|
// icon: 'Select', |
||||
|
// color: '' |
||||
|
// }, |
||||
|
] |
||||
|
|
||||
|
// 头部按钮事件 |
||||
|
const buttonBaseClick = (val, item) => { |
||||
|
if (val == 'add') { // 新增 |
||||
|
openForm('create') |
||||
|
} else if (val == 'import') { // 导入 |
||||
|
handleImport() |
||||
|
} else if (val == 'export') { // 导出 |
||||
|
handleExport() |
||||
|
} else if (val == 'refresh') { // 刷新 |
||||
|
getList() |
||||
|
} else if (val == 'filtrate') { // 筛选 |
||||
|
} else { // 其他按钮 |
||||
|
console.log('其他按钮', item) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// 列表-操作按钮 |
||||
|
const butttondata = [ |
||||
|
defaultButtons.mainListEditBtn({hasPermi:'wms:aql:update'}), // 编辑 |
||||
|
defaultButtons.mainListDeleteBtn({hasPermi:'wms:aql:delete'}), // 删除 |
||||
|
] |
||||
|
|
||||
|
// 列表-操作按钮事件 |
||||
|
const buttonTableClick = async (val, row) => { |
||||
|
if (val == 'edit') { // 编辑 |
||||
|
openForm('update', row) |
||||
|
} else if (val == 'delete') { // 删除 |
||||
|
handleDelete(row.id) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/** 添加/修改操作 */ |
||||
|
const basicFormRef = ref() |
||||
|
const openForm = (type: string, row?: any) => { |
||||
|
basicFormRef.value.open(type, row) |
||||
|
} |
||||
|
|
||||
|
// form表单提交 |
||||
|
const formsSuccess = async (formType,data) => { |
||||
|
var isHave =Aql.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 AqlApi.createAql(data) |
||||
|
message.success(t('common.createSuccess')) |
||||
|
} else { |
||||
|
await AqlApi.updateAql(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, 'basicAql') |
||||
|
} |
||||
|
|
||||
|
/** 删除按钮操作 */ |
||||
|
const handleDelete = async (id: number) => { |
||||
|
try { |
||||
|
// 删除的二次确认 |
||||
|
await message.delConfirm() |
||||
|
// 发起删除 |
||||
|
await AqlApi.deleteAql(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 AqlApi.exportAql(tableObject.params) |
||||
|
download.excel(data, 'aql.xlsx') |
||||
|
} catch { |
||||
|
} finally { |
||||
|
exportLoading.value = false |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/** 导入 */ |
||||
|
const importFormRef = ref() |
||||
|
const handleImport = () => { |
||||
|
importFormRef.value.open() |
||||
|
} |
||||
|
// 导入附件弹窗所需的参数 |
||||
|
const importTemplateData = reactive({ |
||||
|
templateUrl: '', |
||||
|
templateTitle: 'aql导入模版.xlsx' |
||||
|
}) |
||||
|
// 导入成功之后 |
||||
|
const importSuccess = () => { |
||||
|
getList() |
||||
|
} |
||||
|
|
||||
|
// 筛选提交 |
||||
|
const searchFormClick = (searchData) => { |
||||
|
tableObject.params = { |
||||
|
isSearch: true, |
||||
|
filters: searchData.filters |
||||
|
} |
||||
|
getList() // 刷新当前列表 |
||||
|
} |
||||
|
|
||||
|
/** 初始化 **/ |
||||
|
onMounted(async () => { |
||||
|
getList() |
||||
|
importTemplateData.templateUrl = await AqlApi.importTemplate() |
||||
|
}) |
||||
|
|
||||
|
</script> |
@ -0,0 +1,304 @@ |
|||||
|
<template> |
||||
|
<Dialog |
||||
|
:title="dialogTitle" |
||||
|
v-model="dialogVisible" |
||||
|
:width="dialogWidth" |
||||
|
:close-on-click-modal="false" |
||||
|
:vLoading="formLoading" |
||||
|
> |
||||
|
<div style="max-height: 60vh; overflow-y: auto; padding: 0px 20px"> |
||||
|
<Form ref="formRefMain" :schema="formAllSchemasMain" :is-col="true" /> |
||||
|
<div class="tab-pane"> |
||||
|
<div class="left"> |
||||
|
<div class="plus"> |
||||
|
<Icon icon="ep:plus" size="14" color="black" @click="addProcess" |
||||
|
/></div> |
||||
|
|
||||
|
<div class="left-list" v-for="(item, index) in data.list" :key="index"> |
||||
|
<div class="left-item" :class="chooseIndex == index ? 'active' : ''"> |
||||
|
<el-input |
||||
|
v-model="item.description" |
||||
|
style="width: 120px; margin: 0px 10px" |
||||
|
v-if="item.isEdit" |
||||
|
placeholder="请输入工序名称" |
||||
|
/> |
||||
|
<div class="name" v-else @click="chooseItem(item, index)">{{ item.description }}</div> |
||||
|
<Icon |
||||
|
icon="ep:select" |
||||
|
class="mr-5px ml-5px" |
||||
|
v-if="item.isEdit" |
||||
|
@click="editName(item)" |
||||
|
/> |
||||
|
<Icon icon="ep:edit" class="mr-5px ml-5px" v-else @click="editName(item)" /> |
||||
|
<Icon icon="ep:close" class="mr-5px" @click="delProcess(index)" /> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div class="right"> |
||||
|
<div class="small-title">检验工序</div> |
||||
|
<Form |
||||
|
ref="formRefProcess" |
||||
|
:schema="formAllSchemasProcess" |
||||
|
:is-col="true" |
||||
|
labelWidth="150px" |
||||
|
/> |
||||
|
<div class="small-title">检验特性</div> |
||||
|
<Form |
||||
|
ref="formRefFeatures" |
||||
|
:schema="formAllSchemasFeatures" |
||||
|
:is-col="true" |
||||
|
labelWidth="150px" |
||||
|
/> |
||||
|
</div> |
||||
|
</div> |
||||
|
<!-- <el-tabs |
||||
|
v-model="editableTabsValue" |
||||
|
editable |
||||
|
class="demo-tabs" |
||||
|
@edit="handleTabsEdit" |
||||
|
type="border-card" |
||||
|
tab-position="left" |
||||
|
> |
||||
|
<el-tab-pane |
||||
|
v-for="item in editableTabs" |
||||
|
:key="item.name" |
||||
|
:label="item.title" |
||||
|
:name="item.name" |
||||
|
> |
||||
|
<template #label> |
||||
|
<span class="custom-tabs-label"> |
||||
|
<el-icon><calendar /></el-icon> |
||||
|
<span>Route</span> |
||||
|
</span> |
||||
|
</template> |
||||
|
<div class="small-title">检验工序</div> |
||||
|
<Form |
||||
|
ref="formRefProcess" |
||||
|
:schema="formAllSchemasProcess" |
||||
|
:is-col="true" |
||||
|
labelWidth="150px" |
||||
|
/> |
||||
|
<div class="small-title">检验特性</div> |
||||
|
<Form |
||||
|
ref="formRefFeatures" |
||||
|
:schema="formAllSchemasFeatures" |
||||
|
:is-col="true" |
||||
|
labelWidth="150px" |
||||
|
/> |
||||
|
</el-tab-pane> |
||||
|
</el-tabs> --> |
||||
|
</div> |
||||
|
<template #footer> |
||||
|
<ButtonBase :Butttondata="Butttondata" @button-base-click="buttonBaseClick" /> |
||||
|
</template> |
||||
|
</Dialog> |
||||
|
</template> |
||||
|
|
||||
|
<script setup lang="ts"> |
||||
|
import * as defaultButtons from '@/utils/disposition/defaultButtons' |
||||
|
import { json } from 'stream/consumers' |
||||
|
const props = defineProps({ |
||||
|
// 显示窗口宽度设置 |
||||
|
basicFormWidth: { |
||||
|
type: String, |
||||
|
default: '' |
||||
|
}, |
||||
|
// 检验特性表单,列表 相关信息 |
||||
|
formAllSchemasFeatures: { |
||||
|
type: Object, |
||||
|
required: true, |
||||
|
default: null |
||||
|
}, |
||||
|
// 检验工序表单,列表 相关信息 |
||||
|
formAllSchemasProcess: { |
||||
|
type: Object, |
||||
|
required: true, |
||||
|
default: null |
||||
|
}, |
||||
|
// 检验模板表单,列表 相关信息 |
||||
|
formAllSchemasMain: { |
||||
|
type: Object, |
||||
|
required: true, |
||||
|
default: null |
||||
|
}, |
||||
|
// 底部按钮集合 |
||||
|
footButttondata: { |
||||
|
type: Array, |
||||
|
required: false, |
||||
|
default: null |
||||
|
} |
||||
|
}) |
||||
|
const { t } = useI18n() // 国际化 |
||||
|
|
||||
|
const dialogVisible = ref(true) // 弹窗的是否展示 |
||||
|
const dialogTitle = ref('') // 弹窗的标题 |
||||
|
const formLoading = ref(false) // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用 |
||||
|
const formType = ref('') // 表单的类型:create - 新增;update - 修改 |
||||
|
const dialogWidth = ref() |
||||
|
const form = reactive({ |
||||
|
name: '', |
||||
|
region: '', |
||||
|
date1: '', |
||||
|
date2: '', |
||||
|
delivery: false, |
||||
|
type: [], |
||||
|
resource: '', |
||||
|
desc: '' |
||||
|
}) |
||||
|
const chooseIndex = ref(0) |
||||
|
const formAllSchemasFeatures = ref(props.formAllSchemasFeatures?.formSchema) |
||||
|
const formAllSchemasProcess = ref(props.formAllSchemasProcess?.formSchema) |
||||
|
const formAllSchemasMain = ref(props.formAllSchemasMain?.formSchema) |
||||
|
|
||||
|
const formRefMain = ref('') |
||||
|
const formRefProcess = ref('') |
||||
|
const formRefFeatures = ref('') |
||||
|
|
||||
|
const onSubmit = () => { |
||||
|
console.log('submit!') |
||||
|
} |
||||
|
if (props.basicFormWidth) { |
||||
|
dialogWidth.value = props.basicFormWidth + '%' |
||||
|
} else { |
||||
|
dialogWidth.value = props.isBusiness ? '60%' : '40%' |
||||
|
} |
||||
|
/** 打开弹窗 */ |
||||
|
const open = async (type: string, row?: any, masterParmas?: any, titleName?: any) => { |
||||
|
dialogVisible.value = true |
||||
|
if (titleName) { |
||||
|
dialogTitle.value = t('action.' + titleName) |
||||
|
} else { |
||||
|
dialogTitle.value = t('action.' + type) |
||||
|
} |
||||
|
try { |
||||
|
nextTick(() => { |
||||
|
formRefMain.value.setValues(data.value) |
||||
|
formRefProcess.value.setValues(data.value.list[0]) |
||||
|
}) |
||||
|
} finally { |
||||
|
formLoading.value = false |
||||
|
} |
||||
|
} |
||||
|
defineExpose({ open, dialogVisible, formLoading }) // 提供 open 方法,用于打开弹窗 |
||||
|
|
||||
|
const data = ref({ |
||||
|
code: '', |
||||
|
description: '', |
||||
|
version: '', |
||||
|
list: [ |
||||
|
{ |
||||
|
description: '哈哈哈', |
||||
|
code: '', |
||||
|
sequenceCode: '' |
||||
|
}, |
||||
|
{ |
||||
|
description: '呵呵呵', |
||||
|
isEdit: false, |
||||
|
code: '555', |
||||
|
sequenceCode: '6666' |
||||
|
}, |
||||
|
{ |
||||
|
description: '哈呵呵', |
||||
|
isEdit: false |
||||
|
} |
||||
|
] |
||||
|
}) |
||||
|
|
||||
|
/** 弹窗按钮 */ |
||||
|
let Butttondata: any = [] |
||||
|
if (props.footButttondata) { |
||||
|
Butttondata = props.footButttondata |
||||
|
} else { |
||||
|
Butttondata = [ |
||||
|
defaultButtons.formSaveBtn(null), // 保存 |
||||
|
defaultButtons.formCloseBtn(null) // 关闭 |
||||
|
] |
||||
|
} |
||||
|
// 编辑名字 |
||||
|
const editName = (item) => { |
||||
|
if(!item.description){ |
||||
|
p |
||||
|
return; |
||||
|
} |
||||
|
item.isEdit = !item.isEdit |
||||
|
} |
||||
|
// 添加工序 |
||||
|
const addProcess = () => { |
||||
|
data.value.list.push({ |
||||
|
name: '哈哈哈', |
||||
|
isEdit: true |
||||
|
}) |
||||
|
} |
||||
|
// 删除工序 |
||||
|
const delProcess = (index) => { |
||||
|
data.value.list.splice(index, 1) |
||||
|
} |
||||
|
|
||||
|
const chooseItem = (item, index) => { |
||||
|
const data1 = JSON.parse(JSON.stringify(unref(formRefProcess)?.formModel)) |
||||
|
data.value.list.forEach((element,index) => { |
||||
|
if (element.code == data1.code) { |
||||
|
data.value.list[index] =JSON.parse(JSON.stringify( data1)) |
||||
|
} |
||||
|
}) |
||||
|
chooseIndex.value = index |
||||
|
formRefProcess.value.setValues(item) |
||||
|
} |
||||
|
</script> |
||||
|
<style lang="scss" scoped> |
||||
|
.small-title { |
||||
|
font-weight: bold; |
||||
|
padding: 0px 10px 10px; |
||||
|
color: #1a8bfc; |
||||
|
font-size: 16px; |
||||
|
} |
||||
|
.el-tabs--left .el-tabs__header.is-left { |
||||
|
min-height: 700px !important; |
||||
|
} |
||||
|
.tab-pane { |
||||
|
border: 1px solid #dcdfe6; |
||||
|
display: flex; |
||||
|
.left { |
||||
|
background: #f5f7fa; |
||||
|
width: 200px; |
||||
|
border-right: 1px solid #dcdfe6; |
||||
|
position: relative; |
||||
|
.plus { |
||||
|
position: absolute; |
||||
|
right: 0px; |
||||
|
border: 1px solid #dcdfe6; |
||||
|
display: flex; |
||||
|
align-items: center; |
||||
|
justify-content: center; |
||||
|
padding: 2px; |
||||
|
top: 8px; |
||||
|
border-radius: 4px; |
||||
|
cursor: pointer; |
||||
|
} |
||||
|
.left-item { |
||||
|
display: flex; |
||||
|
align-items: center; |
||||
|
height: 36px; |
||||
|
margin-bottom: 10px; |
||||
|
cursor: pointer; |
||||
|
|
||||
|
.name { |
||||
|
width: 120px; |
||||
|
overflow: hidden; |
||||
|
padding: 0px 10px; |
||||
|
height: 36px; |
||||
|
text-overflow: ellipsis; |
||||
|
white-space: nowrap; |
||||
|
line-height: 36px; |
||||
|
} |
||||
|
} |
||||
|
.active { |
||||
|
background: white; |
||||
|
} |
||||
|
} |
||||
|
.right { |
||||
|
flex: 1; |
||||
|
padding: 20px; |
||||
|
} |
||||
|
} |
||||
|
</style> |
@ -0,0 +1,330 @@ |
|||||
|
import type { CrudSchema } from '@/hooks/web/useCrudSchemas' |
||||
|
import { dateFormatter } from '@/utils/formatTime' |
||||
|
import * as AreaApi from '@/api/wms/areabasic' |
||||
|
import { Area } from '@/views/wms/basicDataManage/factoryModeling/areabasic/areabasic.data' |
||||
|
import * as LocationApi from '@/api/wms/location' |
||||
|
import { Location } from '@/views/wms/basicDataManage/factoryModeling/location/location.data' |
||||
|
import * as InspectionProcessPageApi from '@/api/qms/inspectionTemplate' |
||||
|
// const inspectionProcessPage = await InspectionProcessPageApi.getInspectionProcessPage()
|
||||
|
|
||||
|
// 表单校验
|
||||
|
export const AgvLocationrelationRules = reactive({ |
||||
|
positionCode: [ |
||||
|
{ required: true, message: '请填写AGV点位', trigger: 'change' } |
||||
|
], |
||||
|
positionArea: [ |
||||
|
{ required: true, message: '请填写AGV库区', trigger: 'change' } |
||||
|
], |
||||
|
wmsArea: [ |
||||
|
{ required: true, message: '请填写WMS库区', trigger: 'change' } |
||||
|
], |
||||
|
wmsPosition: [ |
||||
|
{ required: true, message: '请填写WMS库位', trigger: 'change' } |
||||
|
] |
||||
|
}) |
||||
|
|
||||
|
export const AgvLocationrelation = useCrudSchemas(reactive<CrudSchema[]>([ |
||||
|
{ |
||||
|
label: '单据号', |
||||
|
field: 'reqCode', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
isForm: false, |
||||
|
}, |
||||
|
{ |
||||
|
label: 'AGV点位', |
||||
|
field: 'positionCode', |
||||
|
sort: 'custom', |
||||
|
isSearch: false, |
||||
|
}, |
||||
|
{ |
||||
|
label: 'AGV库区', |
||||
|
field: 'positionArea', |
||||
|
sort: 'custom', |
||||
|
isSearch: false, |
||||
|
}, |
||||
|
{ |
||||
|
label: 'WMS库区', |
||||
|
field: 'wmsArea', |
||||
|
sort: 'custom', |
||||
|
isSearch: false, |
||||
|
form: { |
||||
|
// labelMessage: '信息提示说明!!!',
|
||||
|
componentProps: { |
||||
|
isSearchList: true, // 开启查询弹窗
|
||||
|
searchListPlaceholder: '请选择库区代码', // 输入框占位文本
|
||||
|
searchField: 'code', // 查询弹窗赋值字段
|
||||
|
searchTitle: '库区信息', // 查询弹窗标题
|
||||
|
searchAllSchemas: Area.allSchemas, // 查询弹窗所需类
|
||||
|
searchPage: AreaApi.getAreaPage, // 查询弹窗所需分页方法
|
||||
|
searchCondition: [{ |
||||
|
key: 'available', |
||||
|
value: 'TRUE', |
||||
|
isMainValue: false |
||||
|
}] |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: 'WMS库位', |
||||
|
field: 'wmsPosition', |
||||
|
sort: 'custom', |
||||
|
table: { |
||||
|
width: 150 |
||||
|
}, |
||||
|
form: { |
||||
|
// labelMessage: '信息提示说明!!!',
|
||||
|
componentProps: { |
||||
|
isSearchList: true, // 开启查询弹窗
|
||||
|
searchListPlaceholder: '请选择库位代码', // 输入框占位文本
|
||||
|
searchField: 'code', // 查询弹窗赋值字段
|
||||
|
searchTitle: '库位信息', // 查询弹窗标题
|
||||
|
searchAllSchemas: Location.allSchemas, // 查询弹窗所需类
|
||||
|
searchPage: LocationApi.getLocationPage, // 查询弹窗所需分页方法
|
||||
|
searchCondition: [{ |
||||
|
key: 'available', |
||||
|
value: 'TRUE', |
||||
|
isMainValue: false |
||||
|
}, |
||||
|
{ |
||||
|
key: 'areaCode', |
||||
|
value: "wmsArea", |
||||
|
message: '请选择库区代码!', |
||||
|
isMainValue: true |
||||
|
}] |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '是否可用', |
||||
|
field: 'available', |
||||
|
dictType: DICT_TYPE.TRUE_FALSE, |
||||
|
dictClass: 'string', |
||||
|
isTable: true, |
||||
|
isSearch: false, |
||||
|
sort: 'custom', |
||||
|
table: { |
||||
|
width: 150 |
||||
|
}, |
||||
|
form: { |
||||
|
component: 'Switch', |
||||
|
value: 'TRUE', |
||||
|
componentProps: { |
||||
|
inactiveValue: 'FALSE', |
||||
|
activeValue: 'TRUE' |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '创建时间', |
||||
|
field: 'createTime', |
||||
|
sort: 'custom', |
||||
|
formatter: dateFormatter, |
||||
|
isSearch: true, |
||||
|
search: { |
||||
|
component: 'DatePicker', |
||||
|
componentProps: { |
||||
|
valueFormat: 'YYYY-MM-DD HH:mm:ss', |
||||
|
type: 'daterange', |
||||
|
defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')] |
||||
|
} |
||||
|
}, |
||||
|
detail: { |
||||
|
dateFormat: 'YYYY-MM-DD HH:mm:ss' |
||||
|
}, |
||||
|
isForm: false, |
||||
|
}, |
||||
|
{ |
||||
|
label: '备注', |
||||
|
field: 'remark', |
||||
|
sort: 'custom', |
||||
|
isSearch: false, |
||||
|
}, |
||||
|
{ |
||||
|
label: '操作', |
||||
|
field: 'action', |
||||
|
isForm: false, |
||||
|
isDetail: false, |
||||
|
table: { |
||||
|
width: 150, |
||||
|
fixed: 'right' |
||||
|
} |
||||
|
} |
||||
|
])) |
||||
|
|
||||
|
export const InspectionTemplateMain = useCrudSchemas(reactive<CrudSchema[]>([ |
||||
|
{ |
||||
|
label: '编码', |
||||
|
field: 'code', |
||||
|
sort: 'custom', |
||||
|
form:{ |
||||
|
componentProps:{ |
||||
|
disabled:true, |
||||
|
placeholder:'系统自动获取' |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '描述', |
||||
|
field: 'description', |
||||
|
sort: 'custom', |
||||
|
},{ |
||||
|
label: '版本', |
||||
|
field: 'version', |
||||
|
sort: 'custom', |
||||
|
} |
||||
|
])) |
||||
|
export const InspectionTemplateProcess = useCrudSchemas(reactive<CrudSchema[]>([ |
||||
|
{ |
||||
|
label: '编码', |
||||
|
field: 'code', |
||||
|
sort: 'custom', |
||||
|
form:{ |
||||
|
componentProps:{ |
||||
|
disabled:true, |
||||
|
placeholder:'系统自动获取' |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '描述', |
||||
|
field: 'description', |
||||
|
sort: 'custom', |
||||
|
isForm:false |
||||
|
},{ |
||||
|
label: '检验方案模板编码', |
||||
|
field: 'inspectionCode', |
||||
|
sort: 'custom', |
||||
|
},{ |
||||
|
label: '顺序号', |
||||
|
field: 'sequenceCode', |
||||
|
},{ |
||||
|
label: '检验特性编码', |
||||
|
field: 'inspectionCharCode', |
||||
|
sort: 'custom', |
||||
|
form:{ |
||||
|
component:'Select', |
||||
|
// api: () => inspectionProcessPage,
|
||||
|
// componentProps:{
|
||||
|
// optionsAlias: {
|
||||
|
// labelField: 'name',
|
||||
|
// valueField: 'id'
|
||||
|
// }
|
||||
|
// }
|
||||
|
} |
||||
|
// form: {
|
||||
|
// value: userDept.id,
|
||||
|
// component: 'Select',
|
||||
|
// api: () => userDeptArray,
|
||||
|
// componentProps: {
|
||||
|
// disabled: true,
|
||||
|
// optionsAlias: {
|
||||
|
// labelField: 'name',
|
||||
|
// valueField: 'id'
|
||||
|
// }
|
||||
|
// }
|
||||
|
// }
|
||||
|
} |
||||
|
])) |
||||
|
export const InspectionTemplateFeatures= useCrudSchemas(reactive<CrudSchema[]>([ |
||||
|
{ |
||||
|
label: '编码', |
||||
|
field: 'code', |
||||
|
sort: 'custom', |
||||
|
form:{ |
||||
|
componentProps:{ |
||||
|
disabled:true, |
||||
|
placeholder:'系统自动获取' |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '描述', |
||||
|
field: 'describe', |
||||
|
sort: 'custom', |
||||
|
},{ |
||||
|
label: '检验方法编码', |
||||
|
field: 'inspectionMethodCode', |
||||
|
sort: 'custom', |
||||
|
form:{ |
||||
|
component:'Select' |
||||
|
} |
||||
|
},{ |
||||
|
label: '采样过程编码', |
||||
|
field: 'dynamicUpdateCode', |
||||
|
sort: 'custom', |
||||
|
form:{ |
||||
|
component:'Select' |
||||
|
} |
||||
|
},{ |
||||
|
label: '动态修改规则编码', |
||||
|
field: 'inspectionMethod', |
||||
|
sort: 'custom', |
||||
|
form:{ |
||||
|
component:'Select' |
||||
|
} |
||||
|
},{ |
||||
|
label: '是否允许修改特征值', |
||||
|
field: 'isCanUpdate', |
||||
|
sort: 'custom', |
||||
|
form:{ |
||||
|
component:'Select' |
||||
|
} |
||||
|
},{ |
||||
|
label: '是否破坏性检验', |
||||
|
field: 'isDestructionInspection', |
||||
|
sort: 'custom', |
||||
|
form:{ |
||||
|
component:'Select' |
||||
|
} |
||||
|
},{ |
||||
|
label: '结果录入方式', |
||||
|
field: 'resultEntryMethod', |
||||
|
sort: 'custom', |
||||
|
form:{ |
||||
|
component:'Select' |
||||
|
} |
||||
|
},{ |
||||
|
label: '特征类型', |
||||
|
field: 'featureType', |
||||
|
sort: 'custom', |
||||
|
form:{ |
||||
|
component:'Select' |
||||
|
} |
||||
|
},{ |
||||
|
label: '是否设定上限', |
||||
|
field: 'quantifyIsCapping', |
||||
|
sort: 'custom', |
||||
|
},{ |
||||
|
label: '是否设定下限', |
||||
|
field: 'quantifyIsLowlimit', |
||||
|
sort: 'custom', |
||||
|
},{ |
||||
|
label: '目标值', |
||||
|
field: 'quantifyTarget', |
||||
|
sort: 'custom', |
||||
|
},{ |
||||
|
label: '上限值', |
||||
|
field: 'quantifyCapping', |
||||
|
sort: 'custom', |
||||
|
},{ |
||||
|
label: '下限值', |
||||
|
field: 'quantifyLowlimit', |
||||
|
sort: 'custom', |
||||
|
},{ |
||||
|
label: '计量单位', |
||||
|
field: 'quantifyUom', |
||||
|
sort: 'custom', |
||||
|
},{ |
||||
|
label: '小数位', |
||||
|
field: 'quantifyDecimal', |
||||
|
sort: 'custom', |
||||
|
},{ |
||||
|
label: '选择集编码', |
||||
|
field: 'quantifyQuantifyCode', |
||||
|
sort: 'custom', |
||||
|
form:{ |
||||
|
component:'Select' |
||||
|
} |
||||
|
} |
||||
|
])) |
@ -0,0 +1,289 @@ |
|||||
|
<template> |
||||
|
<ContentWrap> |
||||
|
<!-- 搜索工作栏 --> |
||||
|
<Search :schema="InspectionJobMain.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" /> |
||||
|
</ContentWrap> |
||||
|
|
||||
|
<!-- 列表头部 --> |
||||
|
<TableHead :HeadButttondata="HeadButttondata" @button-base-click="buttonBaseClick" :routeName="routeName" |
||||
|
@updataTableColumns="updataTableColumns" @searchFormClick="searchFormClick" |
||||
|
:allSchemas="InspectionJobMain.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="InspectionJobMainRules" |
||||
|
:formAllSchemas="InspectionJobMain.allSchemas" :tableAllSchemas="InspectionJobDetail.allSchemas" |
||||
|
:tableFormRules="InspectionJobDetailRules" :tableData="tableData" |
||||
|
:apiUpdate="InspectionJobMainApi.updateInspectionJobMain" :apiCreate="InspectionJobMainApi.createInspectionJobMain" |
||||
|
:isBusiness="true" @handleAddTable="handleAddTable" @handleDeleteTable="handleDeleteTable" |
||||
|
@searchTableSuccess="searchTableSuccess" @submitForm="submitForm" /> |
||||
|
|
||||
|
<!-- 详情 --> |
||||
|
<Detail ref="detailRef" :isBasic="false" :allSchemas="InspectionJobMain.allSchemas" |
||||
|
:detailAllSchemas="InspectionJobDetail.allSchemas" :detailAllSchemasRules="InspectionJobDetailRules" |
||||
|
:apiCreate="InspectionJobDetailApi.createInspectionJobDetail" |
||||
|
:apiUpdate="InspectionJobDetailApi.updateInspectionJobDetail" |
||||
|
:apiPage="InspectionJobDetailApi.getInspectionJobDetailPage" |
||||
|
:apiDelete="InspectionJobDetailApi.deleteInspectionJobDetail" @searchTableSuccessDetail="searchTableSuccessDetail" |
||||
|
:isShowAddBtn="false" :detailButtonIsShow="true" /> |
||||
|
|
||||
|
<!-- 导入 --> |
||||
|
<ImportForm ref="importFormRef" url="/wms/purchase-main/import" :importTemplateData="importTemplateData" |
||||
|
@success="importSuccess" :isShowOut="true" :updateIsDisable="true" :coverIsDisable="true" :mode="2" /> |
||||
|
</template> |
||||
|
|
||||
|
<script setup lang="ts"> |
||||
|
import download from '@/utils/download' |
||||
|
import { InspectionJobMain, InspectionJobMainRules, InspectionJobDetail, InspectionJobDetailRules } from './inspectionJobMain.data' |
||||
|
import * as InspectionJobMainApi from '@/api/qms/inspectionJob/inspectionJobMain' |
||||
|
import * as InspectionJobDetailApi from '@/api/qms/inspectionJob/inspectionJobDetail' |
||||
|
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: 'InspectionJobMain' }) |
||||
|
|
||||
|
const message = useMessage() // 消息弹窗 |
||||
|
const { t } = useI18n() // 国际化 |
||||
|
const route = useRoute() // 路由信息 |
||||
|
const routeName = ref() |
||||
|
routeName.value = route.name |
||||
|
const tableColumns = ref(InspectionJobMain.allSchemas.tableColumns) |
||||
|
|
||||
|
// 字段设置 更新主列表字段 |
||||
|
const updataTableColumns = (val) => { |
||||
|
tableColumns.value = val |
||||
|
} |
||||
|
|
||||
|
// 查询页面返回 |
||||
|
const searchTableSuccess = (formField, searchField, val, formRef, type, row) => { |
||||
|
nextTick(async () => { |
||||
|
if (type == 'tableForm') { |
||||
|
// 明细查询页赋值 |
||||
|
row[formField] = val[0][searchField] |
||||
|
row['itemNumber'] = val[0]['number'] |
||||
|
row['itemName'] = val[0]['name'] |
||||
|
row['uom'] = val[0]['uom'] |
||||
|
row['isRadeIn'] = val[0]['isRadeIn'] |
||||
|
row['available'] = val[0]['available'] |
||||
|
} else { |
||||
|
const setV = {} |
||||
|
setV[formField] = val[0][searchField] |
||||
|
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: InspectionJobMainApi.getInspectionJobMainPage // 分页接口 |
||||
|
}) |
||||
|
|
||||
|
// 获得表格的各种操作 |
||||
|
const { getList, setSearchParams } = tableMethods |
||||
|
|
||||
|
// 列表头部按钮 |
||||
|
const HeadButttondata = [ |
||||
|
defaultButtons.defaultAddBtn(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.status) > -1) { |
||||
|
return false |
||||
|
} else { |
||||
|
return true |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// 列表-操作按钮 |
||||
|
const butttondata = (row) => { |
||||
|
return [ |
||||
|
// defaultButtons.mainListOrderCOMPLETEBtn({ hide: isShowMainButton(row, ['INCOMPLETE']) }), // 完成 |
||||
|
// defaultButtons.mainListEditBtn(null), // 编辑 |
||||
|
// defaultButtons.mainListDeleteBtn(null), // 删除 |
||||
|
] |
||||
|
} |
||||
|
|
||||
|
// 列表-操作按钮事件 |
||||
|
const buttonTableClick = async (val, row) => { |
||||
|
if (val == 'edit') { // 编辑 |
||||
|
openForm('update', row) |
||||
|
} |
||||
|
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, 'basicInspectionJobMain') |
||||
|
} |
||||
|
|
||||
|
/** 删除按钮操作 */ |
||||
|
const handleDelete = async (id : number) => { |
||||
|
try { |
||||
|
// 删除的二次确认 |
||||
|
await message.delConfirm() |
||||
|
// 发起删除 |
||||
|
await InspectionJobMainApi.deleteInspectionJobMain(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 InspectionJobMainApi.exportInspectionJobMain(tableObject.params) |
||||
|
download.excel(data, '备件申领记录主.xlsx') |
||||
|
} catch { |
||||
|
} finally { |
||||
|
exportLoading.value = false |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* tableForm方法 |
||||
|
*/ |
||||
|
const tableFormKeys = {} |
||||
|
InspectionJobDetail.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 InspectionJobMainApi.createInspectionJobMain(data) |
||||
|
message.success(t('common.createSuccess')) |
||||
|
} else { |
||||
|
await InspectionJobMainApi.updateInspectionJobMain(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 InspectionJobMainApi.importTemplate() |
||||
|
}) |
||||
|
</script> |
@ -0,0 +1,329 @@ |
|||||
|
import type { CrudSchema } from '@/hooks/web/useCrudSchemas' |
||||
|
import { dateFormatter2 } from '@/utils/formatTime' |
||||
|
import { validateHanset, validateEmail } from '@/utils/validator' |
||||
|
import { dateFormatter } from '@/utils/formatTime' |
||||
|
const { t } = useI18n() // 国际化
|
||||
|
|
||||
|
/** |
||||
|
* @returns {Array} 备件申请主表 |
||||
|
*/ |
||||
|
export const InspectionJobMain = useCrudSchemas(reactive<CrudSchema[]>([ |
||||
|
{ |
||||
|
label: '编码', |
||||
|
field: 'number', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
}, |
||||
|
{ |
||||
|
label: '申请编码', |
||||
|
field: 'inspectionCode', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
}, |
||||
|
{ |
||||
|
label: '供应商编码', |
||||
|
field: 'supplierCode', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
}, |
||||
|
{ |
||||
|
label: '物料编码', |
||||
|
field: 'materialCode', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
}, |
||||
|
{ |
||||
|
label: '物料批次', |
||||
|
field: 'materialBatch', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
}, |
||||
|
{ |
||||
|
label: '订单号', |
||||
|
field: 'orderCode', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
}, |
||||
|
{ |
||||
|
label: '订单行', |
||||
|
field: 'orderRow', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
form: { |
||||
|
component: 'InputNumber', |
||||
|
value: 0 |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
label: '凭证号', |
||||
|
field: 'certificateCode', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
}, |
||||
|
{ |
||||
|
label: '凭证行', |
||||
|
field: 'certificateRow', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
form: { |
||||
|
component: 'InputNumber', |
||||
|
value: 0 |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
label: '检验方案编码', |
||||
|
field: 'inspectionSchemeCode', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
}, |
||||
|
{ |
||||
|
label: '检验方案Json', |
||||
|
field: 'inspectionSchemeJson', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
}, |
||||
|
{ |
||||
|
label: '检验批次', |
||||
|
field: 'inspectionBatch', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
}, |
||||
|
{ |
||||
|
label: '检验批数量', |
||||
|
field: 'inspectionBatchAmount', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
}, |
||||
|
{ |
||||
|
label: '采样总数量', |
||||
|
field: 'sampleTatalAmount', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
}, |
||||
|
{ |
||||
|
label: '检验类型', |
||||
|
field: 'inspectionType', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
form: { |
||||
|
component: 'SelectV2' |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
label: '检验批来源', |
||||
|
field: 'inspectionBatchSource', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
}, |
||||
|
{ |
||||
|
label: '检验阶段', |
||||
|
field: 'inspectionStage', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
form: { |
||||
|
component: 'InputNumber', |
||||
|
value: 0 |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
label: '检验严格性', |
||||
|
field: 'inspectionStringency', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
}, |
||||
|
{ |
||||
|
label: '检验任务包装列表', |
||||
|
field: 'inspectionTaskPackageCode', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
}, |
||||
|
{ |
||||
|
label: '检验任务工序列表', |
||||
|
field: 'inspectionTaskProcessCode', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
}, |
||||
|
{ |
||||
|
label: '计划开始时间', |
||||
|
field: 'planStartTime', |
||||
|
sort: 'custom', |
||||
|
formatter: dateFormatter, |
||||
|
isSearch: true, |
||||
|
search: { |
||||
|
component: 'DatePicker', |
||||
|
componentProps: { |
||||
|
valueFormat: 'YYYY-MM-DD HH:mm:ss', |
||||
|
type: 'daterange', |
||||
|
defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')] |
||||
|
} |
||||
|
}, |
||||
|
form: { |
||||
|
component: 'DatePicker', |
||||
|
componentProps: { |
||||
|
type: 'datetime', |
||||
|
valueFormat: 'x' |
||||
|
} |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
label: '计划结束时间', |
||||
|
field: 'planEndTime', |
||||
|
sort: 'custom', |
||||
|
formatter: dateFormatter, |
||||
|
isSearch: true, |
||||
|
search: { |
||||
|
component: 'DatePicker', |
||||
|
componentProps: { |
||||
|
valueFormat: 'YYYY-MM-DD HH:mm:ss', |
||||
|
type: 'daterange', |
||||
|
defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')] |
||||
|
} |
||||
|
}, |
||||
|
form: { |
||||
|
component: 'DatePicker', |
||||
|
componentProps: { |
||||
|
type: 'datetime', |
||||
|
valueFormat: 'x' |
||||
|
} |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
label: '检验水平', |
||||
|
field: 'inspectionLevel', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
}, |
||||
|
{ |
||||
|
label: 'AQL值', |
||||
|
field: 'aqlValue', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
}, |
||||
|
{ |
||||
|
label: '是否可用', |
||||
|
field: 'available', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
}, |
||||
|
{ |
||||
|
label: '操作', |
||||
|
field: 'action', |
||||
|
isDetail: false, |
||||
|
isForm: false, |
||||
|
table: { |
||||
|
width: 200, |
||||
|
fixed: 'right' |
||||
|
} |
||||
|
} |
||||
|
])) |
||||
|
|
||||
|
//表单校验
|
||||
|
export const InspectionJobMainRules = reactive({ |
||||
|
number: [required], |
||||
|
inspectionCode: [required], |
||||
|
supplierCode: [required], |
||||
|
materialCode: [required], |
||||
|
materialBatch: [required], |
||||
|
orderCode: [required], |
||||
|
certificateRow: [required], |
||||
|
inspectionSchemeCode: [required], |
||||
|
inspectionSchemeJson: [required], |
||||
|
inspectionBatch: [required], |
||||
|
inspectionBatchAmount: [required], |
||||
|
sampleTatalAmount: [required], |
||||
|
inspectionType: [required], |
||||
|
inspectionBatchSource: [required], |
||||
|
inspectionStage: [required], |
||||
|
inspectionStringency: [required], |
||||
|
inspectionLevel: [required], |
||||
|
available: [required], |
||||
|
}) |
||||
|
|
||||
|
/** |
||||
|
* @returns {Array} 备件申请子表 |
||||
|
*/ |
||||
|
export const InspectionJobDetail = useCrudSchemas(reactive<CrudSchema[]>([ |
||||
|
{ |
||||
|
label: 'id', |
||||
|
field: 'id', |
||||
|
sort: 'custom', |
||||
|
isTable: false, |
||||
|
isSearch: true, |
||||
|
isForm: false, |
||||
|
}, |
||||
|
{ |
||||
|
label: '单据号', |
||||
|
field: 'number', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
}, |
||||
|
{ |
||||
|
label: '主表ID', |
||||
|
field: 'masterId', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
form: { |
||||
|
component: 'InputNumber', |
||||
|
value: 0 |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
label: '任务编码', |
||||
|
field: 'taskCode', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
}, |
||||
|
{ |
||||
|
label: '工序编码', |
||||
|
field: 'processCode', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
}, |
||||
|
{ |
||||
|
label: '工序描述', |
||||
|
field: 'processDescribe', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
}, |
||||
|
{ |
||||
|
label: '顺序号', |
||||
|
field: 'sequenceCode', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
form: { |
||||
|
component: 'InputNumber', |
||||
|
value: 0 |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
label: '检验特性编号', |
||||
|
field: 'inspectionFeatureCode', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
}, |
||||
|
{ |
||||
|
label: '是否可用', |
||||
|
field: 'available', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
}, |
||||
|
{ |
||||
|
label: '操作', |
||||
|
field: 'action', |
||||
|
isDetail: false, |
||||
|
isForm: false, |
||||
|
table: { |
||||
|
width: 150, |
||||
|
fixed: 'right' |
||||
|
}, |
||||
|
isTableForm: false, |
||||
|
} |
||||
|
])) |
||||
|
|
||||
|
//表单校验
|
||||
|
export const InspectionJobDetailRules = reactive({ |
||||
|
taskCode: [required], |
||||
|
processCode: [required], |
||||
|
sequenceCode: [required], |
||||
|
available: [required], |
||||
|
}) |
@ -0,0 +1,244 @@ |
|||||
|
<template> |
||||
|
<ContentWrap> |
||||
|
<!-- 搜索工作栏 --> |
||||
|
<Search :schema="InspectionMain.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" /> |
||||
|
</ContentWrap> |
||||
|
|
||||
|
<!-- 列表头部 --> |
||||
|
<TableHead |
||||
|
:HeadButttondata="HeadButttondata" |
||||
|
@button-base-click="buttonBaseClick" |
||||
|
:routeName="routeName" |
||||
|
@updataTableColumns="updataTableColumns" |
||||
|
@searchFormClick="searchFormClick" |
||||
|
:allSchemas="InspectionMain.allSchemas" |
||||
|
/> |
||||
|
|
||||
|
<!-- 列表 --> |
||||
|
<ContentWrap> |
||||
|
<Table |
||||
|
:columns="tableColumns" |
||||
|
:data="tableObject.tableList" |
||||
|
:loading="tableObject.loading" |
||||
|
:pagination="{ |
||||
|
total: tableObject.total |
||||
|
}" |
||||
|
v-model:pageSize="tableObject.pageSize" |
||||
|
v-model:currentPage="tableObject.currentPage" |
||||
|
v-model:sort="tableObject.sort" |
||||
|
> |
||||
|
<template #code="{row}"> |
||||
|
<el-button type="primary" link @click="openDetail(row, '代码', row.code)"> |
||||
|
<span>{{ row.code }}</span> |
||||
|
</el-button> |
||||
|
</template> |
||||
|
<template #action="{ row }"> |
||||
|
<ButtonBase :Butttondata="butttondata" @button-base-click="buttonTableClick($event,row)" /> |
||||
|
</template> |
||||
|
</Table> |
||||
|
</ContentWrap> |
||||
|
|
||||
|
<!-- 表单弹窗:添加/修改 --> |
||||
|
<BasicForm |
||||
|
ref="basicFormRef" |
||||
|
@success="formsSuccess" |
||||
|
:rules="InspectionMainRules" |
||||
|
:formAllSchemas="InspectionMain.allSchemas" |
||||
|
:apiUpdate="InspectionMainApi.updateInspectionMain" |
||||
|
:apiCreate="InspectionMainApi.createInspectionMain" |
||||
|
@searchTableSuccess="searchTableSuccess" |
||||
|
:isBusiness="false" |
||||
|
/> |
||||
|
|
||||
|
<!-- 详情 --> |
||||
|
<Detail ref="detailRef" :isBasic="true" :allSchemas="InspectionMain.allSchemas" /> |
||||
|
|
||||
|
<!-- 导入 --> |
||||
|
<ImportForm ref="importFormRef" url="/request/inspection-main/import" :importTemplateData="importTemplateData" @success="importSuccess" /> |
||||
|
</template> |
||||
|
|
||||
|
<script setup lang="ts"> |
||||
|
import download from '@/utils/download' |
||||
|
import { InspectionMain,InspectionMainRules } from './inspectionMain.data' |
||||
|
import * as InspectionMainApi from '@/api/qms/inspectionRequest' |
||||
|
import * as defaultButtons from '@/utils/disposition/defaultButtons' |
||||
|
import TableHead from '@/components/TableHead/src/TableHead.vue' |
||||
|
import ImportForm from '@/components/ImportForm/src/ImportForm.vue' |
||||
|
import Detail from '@/components/Detail/src/Detail.vue' |
||||
|
|
||||
|
defineOptions({ name: 'InspectionMain' }) |
||||
|
|
||||
|
const message = useMessage() // 消息弹窗 |
||||
|
const { t } = useI18n() // 国际化 |
||||
|
|
||||
|
const route = useRoute() // 路由信息 |
||||
|
const routeName = ref() |
||||
|
routeName.value = route.name |
||||
|
const tableColumns = ref(InspectionMain.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: InspectionMainApi.getInspectionMainPage // 分页接口 |
||||
|
}) |
||||
|
|
||||
|
// 获得表格的各种操作 |
||||
|
const { getList, setSearchParams } = tableMethods |
||||
|
|
||||
|
// 列表头部按钮 |
||||
|
const HeadButttondata = [ |
||||
|
defaultButtons.defaultAddBtn({hasPermi:'wms:inspectionMain:create'}), // 新增 |
||||
|
defaultButtons.defaultImportBtn({hasPermi:'wms:inspectionMain:import'}), // 导入 |
||||
|
defaultButtons.defaultExportBtn({hasPermi:'wms:inspectionMain:export'}), // 导出 |
||||
|
defaultButtons.defaultFreshBtn(null), // 刷新 |
||||
|
defaultButtons.defaultFilterBtn(null), // 筛选 |
||||
|
defaultButtons.defaultSetBtn(null), // 设置 |
||||
|
// { |
||||
|
// label: '自定义扩展按钮', |
||||
|
// name: 'zdy', |
||||
|
// hide: false, |
||||
|
// type: 'primary', |
||||
|
// icon: 'Select', |
||||
|
// color: '' |
||||
|
// }, |
||||
|
] |
||||
|
|
||||
|
// 头部按钮事件 |
||||
|
const buttonBaseClick = (val, item) => { |
||||
|
if (val == 'add') { // 新增 |
||||
|
openForm('create') |
||||
|
} else if (val == 'import') { // 导入 |
||||
|
handleImport() |
||||
|
} else if (val == 'export') { // 导出 |
||||
|
handleExport() |
||||
|
} else if (val == 'refresh') { // 刷新 |
||||
|
getList() |
||||
|
} else if (val == 'filtrate') { // 筛选 |
||||
|
} else { // 其他按钮 |
||||
|
console.log('其他按钮', item) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// 列表-操作按钮 |
||||
|
const butttondata = [ |
||||
|
defaultButtons.mainListEditBtn({hasPermi:'wms:inspectionMain:update'}), // 编辑 |
||||
|
defaultButtons.mainListDeleteBtn({hasPermi:'wms:inspectionMain:delete'}), // 删除 |
||||
|
] |
||||
|
|
||||
|
// 列表-操作按钮事件 |
||||
|
const buttonTableClick = async (val, row) => { |
||||
|
if (val == 'edit') { // 编辑 |
||||
|
openForm('update', row) |
||||
|
} else if (val == 'delete') { // 删除 |
||||
|
handleDelete(row.id) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/** 添加/修改操作 */ |
||||
|
const basicFormRef = ref() |
||||
|
const openForm = (type: string, row?: any) => { |
||||
|
basicFormRef.value.open(type, row) |
||||
|
} |
||||
|
|
||||
|
// form表单提交 |
||||
|
const formsSuccess = async (formType,data) => { |
||||
|
var isHave =InspectionMain.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 InspectionMainApi.createInspectionMain(data) |
||||
|
message.success(t('common.createSuccess')) |
||||
|
} else { |
||||
|
await InspectionMainApi.updateInspectionMain(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, 'basicInspectionMain') |
||||
|
} |
||||
|
|
||||
|
/** 删除按钮操作 */ |
||||
|
const handleDelete = async (id: number) => { |
||||
|
try { |
||||
|
// 删除的二次确认 |
||||
|
await message.delConfirm() |
||||
|
// 发起删除 |
||||
|
await InspectionMainApi.deleteInspectionMain(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 InspectionMainApi.exportInspectionMain(tableObject.params) |
||||
|
download.excel(data, '检验申请.xlsx') |
||||
|
} catch { |
||||
|
} finally { |
||||
|
exportLoading.value = false |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/** 导入 */ |
||||
|
const importFormRef = ref() |
||||
|
const handleImport = () => { |
||||
|
importFormRef.value.open() |
||||
|
} |
||||
|
// 导入附件弹窗所需的参数 |
||||
|
const importTemplateData = reactive({ |
||||
|
templateUrl: '', |
||||
|
templateTitle: '检验申请导入模版.xlsx' |
||||
|
}) |
||||
|
// 导入成功之后 |
||||
|
const importSuccess = () => { |
||||
|
getList() |
||||
|
} |
||||
|
|
||||
|
// 筛选提交 |
||||
|
const searchFormClick = (searchData) => { |
||||
|
tableObject.params = { |
||||
|
isSearch: true, |
||||
|
filters: searchData.filters |
||||
|
} |
||||
|
getList() // 刷新当前列表 |
||||
|
} |
||||
|
|
||||
|
/** 初始化 **/ |
||||
|
onMounted(async () => { |
||||
|
getList() |
||||
|
importTemplateData.templateUrl = await InspectionMainApi.importTemplate() |
||||
|
}) |
||||
|
|
||||
|
</script> |
@ -0,0 +1,239 @@ |
|||||
|
import type { CrudSchema } from '@/hooks/web/useCrudSchemas' |
||||
|
import { dateFormatter } from '@/utils/formatTime' |
||||
|
|
||||
|
// 表单校验
|
||||
|
export const InspectionMainRules = reactive({ |
||||
|
number: [required], |
||||
|
applicationDate: [required], |
||||
|
applicationTime: [required], |
||||
|
supplierCode: [required], |
||||
|
materialCode: [required], |
||||
|
batch: [required], |
||||
|
referenceOrderCode: [required], |
||||
|
referenceOrderRow: [required], |
||||
|
inspectionSchemeCode: [required], |
||||
|
inspectionStageCode: [required], |
||||
|
inspectionLevel: [required], |
||||
|
available: [required], |
||||
|
}) |
||||
|
|
||||
|
export const InspectionMain = useCrudSchemas(reactive<CrudSchema[]>([ |
||||
|
|
||||
|
{ |
||||
|
label: '编码', |
||||
|
field: 'number', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
}, |
||||
|
{ |
||||
|
label: '申请日期', |
||||
|
field: 'applicationDate', |
||||
|
sort: 'custom', |
||||
|
formatter: dateFormatter, |
||||
|
isSearch: true, |
||||
|
search: { |
||||
|
component: 'DatePicker', |
||||
|
componentProps: { |
||||
|
valueFormat: 'YYYY-MM-DD HH:mm:ss', |
||||
|
type: 'daterange', |
||||
|
defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')] |
||||
|
} |
||||
|
}, |
||||
|
form: { |
||||
|
component: 'DatePicker', |
||||
|
componentProps: { |
||||
|
type: 'datetime', |
||||
|
valueFormat: 'x' |
||||
|
} |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
label: '申请时间', |
||||
|
field: 'applicationTime', |
||||
|
sort: 'custom', |
||||
|
formatter: dateFormatter, |
||||
|
isSearch: true, |
||||
|
search: { |
||||
|
component: 'DatePicker', |
||||
|
componentProps: { |
||||
|
valueFormat: 'YYYY-MM-DD HH:mm:ss', |
||||
|
type: 'daterange', |
||||
|
defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')] |
||||
|
} |
||||
|
}, |
||||
|
form: { |
||||
|
component: 'DatePicker', |
||||
|
componentProps: { |
||||
|
type: 'datetime', |
||||
|
valueFormat: 'x' |
||||
|
} |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
label: '要求开始时间', |
||||
|
field: 'requestStartTime', |
||||
|
sort: 'custom', |
||||
|
formatter: dateFormatter, |
||||
|
isSearch: true, |
||||
|
search: { |
||||
|
component: 'DatePicker', |
||||
|
componentProps: { |
||||
|
valueFormat: 'YYYY-MM-DD HH:mm:ss', |
||||
|
type: 'daterange', |
||||
|
defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')] |
||||
|
} |
||||
|
}, |
||||
|
form: { |
||||
|
component: 'DatePicker', |
||||
|
componentProps: { |
||||
|
type: 'datetime', |
||||
|
valueFormat: 'x' |
||||
|
} |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
label: '要求结束时间', |
||||
|
field: 'requestEndTime', |
||||
|
sort: 'custom', |
||||
|
formatter: dateFormatter, |
||||
|
isSearch: true, |
||||
|
search: { |
||||
|
component: 'DatePicker', |
||||
|
componentProps: { |
||||
|
valueFormat: 'YYYY-MM-DD HH:mm:ss', |
||||
|
type: 'daterange', |
||||
|
defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')] |
||||
|
} |
||||
|
}, |
||||
|
form: { |
||||
|
component: 'DatePicker', |
||||
|
componentProps: { |
||||
|
type: 'datetime', |
||||
|
valueFormat: 'x' |
||||
|
} |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
label: '完成时间', |
||||
|
field: 'finishTime', |
||||
|
sort: 'custom', |
||||
|
formatter: dateFormatter, |
||||
|
isSearch: true, |
||||
|
search: { |
||||
|
component: 'DatePicker', |
||||
|
componentProps: { |
||||
|
valueFormat: 'YYYY-MM-DD HH:mm:ss', |
||||
|
type: 'daterange', |
||||
|
defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')] |
||||
|
} |
||||
|
}, |
||||
|
form: { |
||||
|
component: 'DatePicker', |
||||
|
componentProps: { |
||||
|
type: 'datetime', |
||||
|
valueFormat: 'x' |
||||
|
} |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
label: '供应商编码', |
||||
|
field: 'supplierCode', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
}, |
||||
|
{ |
||||
|
label: '物料编码', |
||||
|
field: 'materialCode', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
}, |
||||
|
{ |
||||
|
label: '批次', |
||||
|
field: 'batch', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
}, |
||||
|
{ |
||||
|
label: '待检数量', |
||||
|
field: 'requestInspectionNum', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
}, |
||||
|
{ |
||||
|
label: '参考订单号', |
||||
|
field: 'referenceOrderCode', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
}, |
||||
|
{ |
||||
|
label: '参考订单行', |
||||
|
field: 'referenceOrderRow', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
form: { |
||||
|
component: 'InputNumber', |
||||
|
value: 0 |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
label: '参考凭证号', |
||||
|
field: 'referenceCertificateCode', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
}, |
||||
|
{ |
||||
|
label: '参考凭证行', |
||||
|
field: 'referenceCertificateRow', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
form: { |
||||
|
component: 'InputNumber', |
||||
|
value: 0 |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
label: '检验方案编码', |
||||
|
field: 'inspectionSchemeCode', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
}, |
||||
|
{ |
||||
|
label: '检验阶段', |
||||
|
field: 'inspectionStageCode', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
}, |
||||
|
{ |
||||
|
label: '检验申请包装列表', |
||||
|
field: 'applicationPackageCode', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
}, |
||||
|
{ |
||||
|
label: '检验水平', |
||||
|
field: 'inspectionLevel', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
}, |
||||
|
{ |
||||
|
label: 'AQL值', |
||||
|
field: 'aqlValue', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
}, |
||||
|
{ |
||||
|
label: '是否可用', |
||||
|
field: 'available', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
}, |
||||
|
{ |
||||
|
label: '操作', |
||||
|
field: 'action', |
||||
|
isForm: false, |
||||
|
table: { |
||||
|
width: 150, |
||||
|
fixed: 'right' |
||||
|
} |
||||
|
} |
||||
|
])) |
@ -0,0 +1,244 @@ |
|||||
|
<template> |
||||
|
<ContentWrap> |
||||
|
<!-- 搜索工作栏 --> |
||||
|
<Search :schema="InspectionMethod.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" /> |
||||
|
</ContentWrap> |
||||
|
|
||||
|
<!-- 列表头部 --> |
||||
|
<TableHead |
||||
|
:HeadButttondata="HeadButttondata" |
||||
|
@button-base-click="buttonBaseClick" |
||||
|
:routeName="routeName" |
||||
|
@updataTableColumns="updataTableColumns" |
||||
|
@searchFormClick="searchFormClick" |
||||
|
:allSchemas="InspectionMethod.allSchemas" |
||||
|
/> |
||||
|
|
||||
|
<!-- 列表 --> |
||||
|
<ContentWrap> |
||||
|
<Table |
||||
|
:columns="tableColumns" |
||||
|
:data="tableObject.tableList" |
||||
|
:loading="tableObject.loading" |
||||
|
:pagination="{ |
||||
|
total: tableObject.total |
||||
|
}" |
||||
|
v-model:pageSize="tableObject.pageSize" |
||||
|
v-model:currentPage="tableObject.currentPage" |
||||
|
v-model:sort="tableObject.sort" |
||||
|
> |
||||
|
<template #code="{row}"> |
||||
|
<el-button type="primary" link @click="openDetail(row, '代码', row.code)"> |
||||
|
<span>{{ row.code }}</span> |
||||
|
</el-button> |
||||
|
</template> |
||||
|
<template #action="{ row }"> |
||||
|
<ButtonBase :Butttondata="butttondata" @button-base-click="buttonTableClick($event,row)" /> |
||||
|
</template> |
||||
|
</Table> |
||||
|
</ContentWrap> |
||||
|
|
||||
|
<!-- 表单弹窗:添加/修改 --> |
||||
|
<BasicForm |
||||
|
ref="basicFormRef" |
||||
|
@success="formsSuccess" |
||||
|
:rules="InspectionMethodRules" |
||||
|
:formAllSchemas="InspectionMethod.allSchemas" |
||||
|
:apiUpdate="InspectionMethodApi.updateInspectionMethod" |
||||
|
:apiCreate="InspectionMethodApi.createInspectionMethod" |
||||
|
@searchTableSuccess="searchTableSuccess" |
||||
|
:isBusiness="false" |
||||
|
/> |
||||
|
|
||||
|
<!-- 详情 --> |
||||
|
<Detail ref="detailRef" :isBasic="true" :allSchemas="InspectionMethod.allSchemas" /> |
||||
|
|
||||
|
<!-- 导入 --> |
||||
|
<ImportForm ref="importFormRef" url="/qms/inspection-method/import" :importTemplateData="importTemplateData" @success="importSuccess" /> |
||||
|
</template> |
||||
|
|
||||
|
<script setup lang="ts"> |
||||
|
import download from '@/utils/download' |
||||
|
import { InspectionMethod,InspectionMethodRules } from './inspectionMethod.data' |
||||
|
import * as InspectionMethodApi from '@/api/qms/inspectionMethod' |
||||
|
import * as defaultButtons from '@/utils/disposition/defaultButtons' |
||||
|
import TableHead from '@/components/TableHead/src/TableHead.vue' |
||||
|
import ImportForm from '@/components/ImportForm/src/ImportForm.vue' |
||||
|
import Detail from '@/components/Detail/src/Detail.vue' |
||||
|
|
||||
|
defineOptions({ name: 'InspectionMethod' }) |
||||
|
|
||||
|
const message = useMessage() // 消息弹窗 |
||||
|
const { t } = useI18n() // 国际化 |
||||
|
|
||||
|
const route = useRoute() // 路由信息 |
||||
|
const routeName = ref() |
||||
|
routeName.value = route.name |
||||
|
const tableColumns = ref(InspectionMethod.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: InspectionMethodApi.getInspectionMethodPage // 分页接口 |
||||
|
}) |
||||
|
|
||||
|
// 获得表格的各种操作 |
||||
|
const { getList, setSearchParams } = tableMethods |
||||
|
|
||||
|
// 列表头部按钮 |
||||
|
const HeadButttondata = [ |
||||
|
defaultButtons.defaultAddBtn({hasPermi:'wms:inspectionMethod:create'}), // 新增 |
||||
|
defaultButtons.defaultImportBtn({hasPermi:'wms:inspectionMethod:import'}), // 导入 |
||||
|
defaultButtons.defaultExportBtn({hasPermi:'wms:inspectionMethod:export'}), // 导出 |
||||
|
defaultButtons.defaultFreshBtn(null), // 刷新 |
||||
|
defaultButtons.defaultFilterBtn(null), // 筛选 |
||||
|
defaultButtons.defaultSetBtn(null), // 设置 |
||||
|
// { |
||||
|
// label: '自定义扩展按钮', |
||||
|
// name: 'zdy', |
||||
|
// hide: false, |
||||
|
// type: 'primary', |
||||
|
// icon: 'Select', |
||||
|
// color: '' |
||||
|
// }, |
||||
|
] |
||||
|
|
||||
|
// 头部按钮事件 |
||||
|
const buttonBaseClick = (val, item) => { |
||||
|
if (val == 'add') { // 新增 |
||||
|
openForm('create') |
||||
|
} else if (val == 'import') { // 导入 |
||||
|
handleImport() |
||||
|
} else if (val == 'export') { // 导出 |
||||
|
handleExport() |
||||
|
} else if (val == 'refresh') { // 刷新 |
||||
|
getList() |
||||
|
} else if (val == 'filtrate') { // 筛选 |
||||
|
} else { // 其他按钮 |
||||
|
console.log('其他按钮', item) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// 列表-操作按钮 |
||||
|
const butttondata = [ |
||||
|
defaultButtons.mainListEditBtn({hasPermi:'wms:inspectionMethod:update'}), // 编辑 |
||||
|
defaultButtons.mainListDeleteBtn({hasPermi:'wms:inspectionMethod:delete'}), // 删除 |
||||
|
] |
||||
|
|
||||
|
// 列表-操作按钮事件 |
||||
|
const buttonTableClick = async (val, row) => { |
||||
|
if (val == 'edit') { // 编辑 |
||||
|
openForm('update', row) |
||||
|
} else if (val == 'delete') { // 删除 |
||||
|
handleDelete(row.id) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/** 添加/修改操作 */ |
||||
|
const basicFormRef = ref() |
||||
|
const openForm = (type: string, row?: any) => { |
||||
|
basicFormRef.value.open(type, row) |
||||
|
} |
||||
|
|
||||
|
// form表单提交 |
||||
|
const formsSuccess = async (formType,data) => { |
||||
|
var isHave =InspectionMethod.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 InspectionMethodApi.createInspectionMethod(data) |
||||
|
message.success(t('common.createSuccess')) |
||||
|
} else { |
||||
|
await InspectionMethodApi.updateInspectionMethod(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, 'basicInspectionMethod') |
||||
|
} |
||||
|
|
||||
|
/** 删除按钮操作 */ |
||||
|
const handleDelete = async (id: number) => { |
||||
|
try { |
||||
|
// 删除的二次确认 |
||||
|
await message.delConfirm() |
||||
|
// 发起删除 |
||||
|
await InspectionMethodApi.deleteInspectionMethod(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 InspectionMethodApi.exportInspectionMethod(tableObject.params) |
||||
|
download.excel(data, '检验方法.xlsx') |
||||
|
} catch { |
||||
|
} finally { |
||||
|
exportLoading.value = false |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/** 导入 */ |
||||
|
const importFormRef = ref() |
||||
|
const handleImport = () => { |
||||
|
importFormRef.value.open() |
||||
|
} |
||||
|
// 导入附件弹窗所需的参数 |
||||
|
const importTemplateData = reactive({ |
||||
|
templateUrl: '', |
||||
|
templateTitle: '检验方法导入模版.xlsx' |
||||
|
}) |
||||
|
// 导入成功之后 |
||||
|
const importSuccess = () => { |
||||
|
getList() |
||||
|
} |
||||
|
|
||||
|
// 筛选提交 |
||||
|
const searchFormClick = (searchData) => { |
||||
|
tableObject.params = { |
||||
|
isSearch: true, |
||||
|
filters: searchData.filters |
||||
|
} |
||||
|
getList() // 刷新当前列表 |
||||
|
} |
||||
|
|
||||
|
/** 初始化 **/ |
||||
|
onMounted(async () => { |
||||
|
getList() |
||||
|
importTemplateData.templateUrl = await InspectionMethodApi.importTemplate() |
||||
|
}) |
||||
|
|
||||
|
</script> |
@ -0,0 +1,75 @@ |
|||||
|
import type { CrudSchema } from '@/hooks/web/useCrudSchemas' |
||||
|
import { dateFormatter } from '@/utils/formatTime' |
||||
|
|
||||
|
// 表单校验
|
||||
|
export const InspectionMethodRules = reactive({ |
||||
|
code: [required], |
||||
|
status: [required], |
||||
|
available: [required], |
||||
|
}) |
||||
|
|
||||
|
export const InspectionMethod = useCrudSchemas(reactive<CrudSchema[]>([ |
||||
|
{ |
||||
|
label: 'id', |
||||
|
field: 'id', |
||||
|
sort: 'custom', |
||||
|
isTable: false, |
||||
|
isForm: false, |
||||
|
}, |
||||
|
{ |
||||
|
label: '编码', |
||||
|
field: 'code', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
}, |
||||
|
{ |
||||
|
label: '描述', |
||||
|
field: 'describe', |
||||
|
sort: 'custom', |
||||
|
}, |
||||
|
{ |
||||
|
label: '版本', |
||||
|
field: 'version', |
||||
|
sort: 'custom', |
||||
|
}, |
||||
|
{ |
||||
|
label: '状态', |
||||
|
field: 'status', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
form: { |
||||
|
component: 'Radio' |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
label: '操作指导', |
||||
|
field: 'operationGuidance', |
||||
|
sort: 'custom', |
||||
|
}, |
||||
|
{ |
||||
|
label: '视频地址', |
||||
|
field: 'videoAddress', |
||||
|
sort: 'custom', |
||||
|
}, |
||||
|
{ |
||||
|
label: '是否可用', |
||||
|
field: 'available', |
||||
|
sort: 'custom', |
||||
|
}, |
||||
|
{ |
||||
|
label: '创建时间', |
||||
|
field: 'createTime', |
||||
|
sort: 'custom', |
||||
|
formatter: dateFormatter, |
||||
|
isForm: false, |
||||
|
}, |
||||
|
{ |
||||
|
label: '操作', |
||||
|
field: 'action', |
||||
|
isForm: false, |
||||
|
table: { |
||||
|
width: 150, |
||||
|
fixed: 'right' |
||||
|
} |
||||
|
} |
||||
|
])) |
@ -0,0 +1,244 @@ |
|||||
|
<template> |
||||
|
<ContentWrap> |
||||
|
<!-- 搜索工作栏 --> |
||||
|
<Search :schema="SampleCode.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" /> |
||||
|
</ContentWrap> |
||||
|
|
||||
|
<!-- 列表头部 --> |
||||
|
<TableHead |
||||
|
:HeadButttondata="HeadButttondata" |
||||
|
@button-base-click="buttonBaseClick" |
||||
|
:routeName="routeName" |
||||
|
@updataTableColumns="updataTableColumns" |
||||
|
@searchFormClick="searchFormClick" |
||||
|
:allSchemas="SampleCode.allSchemas" |
||||
|
/> |
||||
|
|
||||
|
<!-- 列表 --> |
||||
|
<ContentWrap> |
||||
|
<Table |
||||
|
:columns="tableColumns" |
||||
|
:data="tableObject.tableList" |
||||
|
:loading="tableObject.loading" |
||||
|
:pagination="{ |
||||
|
total: tableObject.total |
||||
|
}" |
||||
|
v-model:pageSize="tableObject.pageSize" |
||||
|
v-model:currentPage="tableObject.currentPage" |
||||
|
v-model:sort="tableObject.sort" |
||||
|
> |
||||
|
<template #code="{row}"> |
||||
|
<el-button type="primary" link @click="openDetail(row, '代码', row.code)"> |
||||
|
<span>{{ row.code }}</span> |
||||
|
</el-button> |
||||
|
</template> |
||||
|
<template #action="{ row }"> |
||||
|
<ButtonBase :Butttondata="butttondata" @button-base-click="buttonTableClick($event,row)" /> |
||||
|
</template> |
||||
|
</Table> |
||||
|
</ContentWrap> |
||||
|
|
||||
|
<!-- 表单弹窗:添加/修改 --> |
||||
|
<BasicForm |
||||
|
ref="basicFormRef" |
||||
|
@success="formsSuccess" |
||||
|
:rules="SampleCodeRules" |
||||
|
:formAllSchemas="SampleCode.allSchemas" |
||||
|
:apiUpdate="SampleCodeApi.updateSampleCode" |
||||
|
:apiCreate="SampleCodeApi.createSampleCode" |
||||
|
@searchTableSuccess="searchTableSuccess" |
||||
|
:isBusiness="false" |
||||
|
/> |
||||
|
|
||||
|
<!-- 详情 --> |
||||
|
<Detail ref="detailRef" :isBasic="true" :allSchemas="SampleCode.allSchemas" /> |
||||
|
|
||||
|
<!-- 导入 --> |
||||
|
<ImportForm ref="importFormRef" url="/qms/sample-code/import" :importTemplateData="importTemplateData" @success="importSuccess" /> |
||||
|
</template> |
||||
|
|
||||
|
<script setup lang="ts"> |
||||
|
import download from '@/utils/download' |
||||
|
import { SampleCode,SampleCodeRules } from './sampleCode.data' |
||||
|
import * as SampleCodeApi from '@/api/qms/sampleCode' |
||||
|
import * as defaultButtons from '@/utils/disposition/defaultButtons' |
||||
|
import TableHead from '@/components/TableHead/src/TableHead.vue' |
||||
|
import ImportForm from '@/components/ImportForm/src/ImportForm.vue' |
||||
|
import Detail from '@/components/Detail/src/Detail.vue' |
||||
|
|
||||
|
defineOptions({ name: 'SampleCode' }) |
||||
|
|
||||
|
const message = useMessage() // 消息弹窗 |
||||
|
const { t } = useI18n() // 国际化 |
||||
|
|
||||
|
const route = useRoute() // 路由信息 |
||||
|
const routeName = ref() |
||||
|
routeName.value = route.name |
||||
|
const tableColumns = ref(SampleCode.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: SampleCodeApi.getSampleCodePage // 分页接口 |
||||
|
}) |
||||
|
|
||||
|
// 获得表格的各种操作 |
||||
|
const { getList, setSearchParams } = tableMethods |
||||
|
|
||||
|
// 列表头部按钮 |
||||
|
const HeadButttondata = [ |
||||
|
defaultButtons.defaultAddBtn({hasPermi:'wms:sampleCode:create'}), // 新增 |
||||
|
defaultButtons.defaultImportBtn({hasPermi:'wms:sampleCode:import'}), // 导入 |
||||
|
defaultButtons.defaultExportBtn({hasPermi:'wms:sampleCode:export'}), // 导出 |
||||
|
defaultButtons.defaultFreshBtn(null), // 刷新 |
||||
|
defaultButtons.defaultFilterBtn(null), // 筛选 |
||||
|
defaultButtons.defaultSetBtn(null), // 设置 |
||||
|
// { |
||||
|
// label: '自定义扩展按钮', |
||||
|
// name: 'zdy', |
||||
|
// hide: false, |
||||
|
// type: 'primary', |
||||
|
// icon: 'Select', |
||||
|
// color: '' |
||||
|
// }, |
||||
|
] |
||||
|
|
||||
|
// 头部按钮事件 |
||||
|
const buttonBaseClick = (val, item) => { |
||||
|
if (val == 'add') { // 新增 |
||||
|
openForm('create') |
||||
|
} else if (val == 'import') { // 导入 |
||||
|
handleImport() |
||||
|
} else if (val == 'export') { // 导出 |
||||
|
handleExport() |
||||
|
} else if (val == 'refresh') { // 刷新 |
||||
|
getList() |
||||
|
} else if (val == 'filtrate') { // 筛选 |
||||
|
} else { // 其他按钮 |
||||
|
console.log('其他按钮', item) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// 列表-操作按钮 |
||||
|
const butttondata = [ |
||||
|
defaultButtons.mainListEditBtn({hasPermi:'wms:sampleCode:update'}), // 编辑 |
||||
|
defaultButtons.mainListDeleteBtn({hasPermi:'wms:sampleCode:delete'}), // 删除 |
||||
|
] |
||||
|
|
||||
|
// 列表-操作按钮事件 |
||||
|
const buttonTableClick = async (val, row) => { |
||||
|
if (val == 'edit') { // 编辑 |
||||
|
openForm('update', row) |
||||
|
} else if (val == 'delete') { // 删除 |
||||
|
handleDelete(row.id) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/** 添加/修改操作 */ |
||||
|
const basicFormRef = ref() |
||||
|
const openForm = (type: string, row?: any) => { |
||||
|
basicFormRef.value.open(type, row) |
||||
|
} |
||||
|
|
||||
|
// form表单提交 |
||||
|
const formsSuccess = async (formType,data) => { |
||||
|
var isHave =SampleCode.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 SampleCodeApi.createSampleCode(data) |
||||
|
message.success(t('common.createSuccess')) |
||||
|
} else { |
||||
|
await SampleCodeApi.updateSampleCode(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, 'basicSampleCode') |
||||
|
} |
||||
|
|
||||
|
/** 删除按钮操作 */ |
||||
|
const handleDelete = async (id: number) => { |
||||
|
try { |
||||
|
// 删除的二次确认 |
||||
|
await message.delConfirm() |
||||
|
// 发起删除 |
||||
|
await SampleCodeApi.deleteSampleCode(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 SampleCodeApi.exportSampleCode(tableObject.params) |
||||
|
download.excel(data, '样本字码.xlsx') |
||||
|
} catch { |
||||
|
} finally { |
||||
|
exportLoading.value = false |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/** 导入 */ |
||||
|
const importFormRef = ref() |
||||
|
const handleImport = () => { |
||||
|
importFormRef.value.open() |
||||
|
} |
||||
|
// 导入附件弹窗所需的参数 |
||||
|
const importTemplateData = reactive({ |
||||
|
templateUrl: '', |
||||
|
templateTitle: '样本字码导入模版.xlsx' |
||||
|
}) |
||||
|
// 导入成功之后 |
||||
|
const importSuccess = () => { |
||||
|
getList() |
||||
|
} |
||||
|
|
||||
|
// 筛选提交 |
||||
|
const searchFormClick = (searchData) => { |
||||
|
tableObject.params = { |
||||
|
isSearch: true, |
||||
|
filters: searchData.filters |
||||
|
} |
||||
|
getList() // 刷新当前列表 |
||||
|
} |
||||
|
|
||||
|
/** 初始化 **/ |
||||
|
onMounted(async () => { |
||||
|
getList() |
||||
|
importTemplateData.templateUrl = await SampleCodeApi.importTemplate() |
||||
|
}) |
||||
|
|
||||
|
</script> |
@ -0,0 +1,101 @@ |
|||||
|
import type { CrudSchema } from '@/hooks/web/useCrudSchemas' |
||||
|
import { dateFormatter } from '@/utils/formatTime' |
||||
|
|
||||
|
// 表单校验
|
||||
|
export const SampleCodeRules = reactive({ |
||||
|
code: [required], |
||||
|
batchUpperLimiting: [required], |
||||
|
available: [required], |
||||
|
}) |
||||
|
|
||||
|
export const SampleCode = useCrudSchemas(reactive<CrudSchema[]>([ |
||||
|
{ |
||||
|
label: 'id', |
||||
|
field: 'id', |
||||
|
sort: 'custom', |
||||
|
isTable: false, |
||||
|
isForm: false, |
||||
|
}, |
||||
|
{ |
||||
|
label: '采样方案编码', |
||||
|
field: 'code', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
}, |
||||
|
{ |
||||
|
label: '批量下限', |
||||
|
field: 'batchLow limiting', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
form: { |
||||
|
component: 'InputNumber', |
||||
|
value: 0 |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
label: '批量上限', |
||||
|
field: 'batchUpperLimiting', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
form: { |
||||
|
component: 'InputNumber', |
||||
|
value: 0 |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
label: 's1', |
||||
|
field: 's1', |
||||
|
sort: 'custom', |
||||
|
}, |
||||
|
{ |
||||
|
label: 's2', |
||||
|
field: 's2', |
||||
|
sort: 'custom', |
||||
|
}, |
||||
|
{ |
||||
|
label: 's3', |
||||
|
field: 's3', |
||||
|
sort: 'custom', |
||||
|
}, |
||||
|
{ |
||||
|
label: 's4', |
||||
|
field: 's4', |
||||
|
sort: 'custom', |
||||
|
}, |
||||
|
{ |
||||
|
label: 'g1', |
||||
|
field: 'g1', |
||||
|
sort: 'custom', |
||||
|
}, |
||||
|
{ |
||||
|
label: 'g2', |
||||
|
field: 'g2', |
||||
|
sort: 'custom', |
||||
|
}, |
||||
|
{ |
||||
|
label: 'g3', |
||||
|
field: 'g3', |
||||
|
sort: 'custom', |
||||
|
}, |
||||
|
{ |
||||
|
label: '是否可用', |
||||
|
field: 'available', |
||||
|
sort: 'custom', |
||||
|
}, |
||||
|
{ |
||||
|
label: '创建时间', |
||||
|
field: 'createTime', |
||||
|
sort: 'custom', |
||||
|
formatter: dateFormatter, |
||||
|
isForm: false, |
||||
|
}, |
||||
|
{ |
||||
|
label: '操作', |
||||
|
field: 'action', |
||||
|
isForm: false, |
||||
|
table: { |
||||
|
width: 150, |
||||
|
fixed: 'right' |
||||
|
} |
||||
|
} |
||||
|
])) |
@ -0,0 +1,244 @@ |
|||||
|
<template> |
||||
|
<ContentWrap> |
||||
|
<!-- 搜索工作栏 --> |
||||
|
<Search :schema="SamplingScheme.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" /> |
||||
|
</ContentWrap> |
||||
|
|
||||
|
<!-- 列表头部 --> |
||||
|
<TableHead |
||||
|
:HeadButttondata="HeadButttondata" |
||||
|
@button-base-click="buttonBaseClick" |
||||
|
:routeName="routeName" |
||||
|
@updataTableColumns="updataTableColumns" |
||||
|
@searchFormClick="searchFormClick" |
||||
|
:allSchemas="SamplingScheme.allSchemas" |
||||
|
/> |
||||
|
|
||||
|
<!-- 列表 --> |
||||
|
<ContentWrap> |
||||
|
<Table |
||||
|
:columns="tableColumns" |
||||
|
:data="tableObject.tableList" |
||||
|
:loading="tableObject.loading" |
||||
|
:pagination="{ |
||||
|
total: tableObject.total |
||||
|
}" |
||||
|
v-model:pageSize="tableObject.pageSize" |
||||
|
v-model:currentPage="tableObject.currentPage" |
||||
|
v-model:sort="tableObject.sort" |
||||
|
> |
||||
|
<template #code="{row}"> |
||||
|
<el-button type="primary" link @click="openDetail(row, '代码', row.code)"> |
||||
|
<span>{{ row.code }}</span> |
||||
|
</el-button> |
||||
|
</template> |
||||
|
<template #action="{ row }"> |
||||
|
<ButtonBase :Butttondata="butttondata" @button-base-click="buttonTableClick($event,row)" /> |
||||
|
</template> |
||||
|
</Table> |
||||
|
</ContentWrap> |
||||
|
|
||||
|
<!-- 表单弹窗:添加/修改 --> |
||||
|
<BasicForm |
||||
|
ref="basicFormRef" |
||||
|
@success="formsSuccess" |
||||
|
:rules="SamplingSchemeRules" |
||||
|
:formAllSchemas="SamplingScheme.allSchemas" |
||||
|
:apiUpdate="SamplingSchemeApi.updateSamplingScheme" |
||||
|
:apiCreate="SamplingSchemeApi.createSamplingScheme" |
||||
|
@searchTableSuccess="searchTableSuccess" |
||||
|
:isBusiness="false" |
||||
|
/> |
||||
|
|
||||
|
<!-- 详情 --> |
||||
|
<Detail ref="detailRef" :isBasic="true" :allSchemas="SamplingScheme.allSchemas" /> |
||||
|
|
||||
|
<!-- 导入 --> |
||||
|
<ImportForm ref="importFormRef" url="/qms/sampling-scheme/import" :importTemplateData="importTemplateData" @success="importSuccess" /> |
||||
|
</template> |
||||
|
|
||||
|
<script setup lang="ts"> |
||||
|
import download from '@/utils/download' |
||||
|
import { SamplingScheme,SamplingSchemeRules } from './samplingScheme.data' |
||||
|
import * as SamplingSchemeApi from '@/api/qms/samplingScheme' |
||||
|
import * as defaultButtons from '@/utils/disposition/defaultButtons' |
||||
|
import TableHead from '@/components/TableHead/src/TableHead.vue' |
||||
|
import ImportForm from '@/components/ImportForm/src/ImportForm.vue' |
||||
|
import Detail from '@/components/Detail/src/Detail.vue' |
||||
|
|
||||
|
defineOptions({ name: 'SamplingScheme' }) |
||||
|
|
||||
|
const message = useMessage() // 消息弹窗 |
||||
|
const { t } = useI18n() // 国际化 |
||||
|
|
||||
|
const route = useRoute() // 路由信息 |
||||
|
const routeName = ref() |
||||
|
routeName.value = route.name |
||||
|
const tableColumns = ref(SamplingScheme.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: SamplingSchemeApi.getSamplingSchemePage // 分页接口 |
||||
|
}) |
||||
|
|
||||
|
// 获得表格的各种操作 |
||||
|
const { getList, setSearchParams } = tableMethods |
||||
|
|
||||
|
// 列表头部按钮 |
||||
|
const HeadButttondata = [ |
||||
|
defaultButtons.defaultAddBtn({hasPermi:'wms:samplingScheme:create'}), // 新增 |
||||
|
defaultButtons.defaultImportBtn({hasPermi:'wms:samplingScheme:import'}), // 导入 |
||||
|
defaultButtons.defaultExportBtn({hasPermi:'wms:samplingScheme:export'}), // 导出 |
||||
|
defaultButtons.defaultFreshBtn(null), // 刷新 |
||||
|
defaultButtons.defaultFilterBtn(null), // 筛选 |
||||
|
defaultButtons.defaultSetBtn(null), // 设置 |
||||
|
// { |
||||
|
// label: '自定义扩展按钮', |
||||
|
// name: 'zdy', |
||||
|
// hide: false, |
||||
|
// type: 'primary', |
||||
|
// icon: 'Select', |
||||
|
// color: '' |
||||
|
// }, |
||||
|
] |
||||
|
|
||||
|
// 头部按钮事件 |
||||
|
const buttonBaseClick = (val, item) => { |
||||
|
if (val == 'add') { // 新增 |
||||
|
openForm('create') |
||||
|
} else if (val == 'import') { // 导入 |
||||
|
handleImport() |
||||
|
} else if (val == 'export') { // 导出 |
||||
|
handleExport() |
||||
|
} else if (val == 'refresh') { // 刷新 |
||||
|
getList() |
||||
|
} else if (val == 'filtrate') { // 筛选 |
||||
|
} else { // 其他按钮 |
||||
|
console.log('其他按钮', item) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// 列表-操作按钮 |
||||
|
const butttondata = [ |
||||
|
defaultButtons.mainListEditBtn({hasPermi:'wms:samplingScheme:update'}), // 编辑 |
||||
|
defaultButtons.mainListDeleteBtn({hasPermi:'wms:samplingScheme:delete'}), // 删除 |
||||
|
] |
||||
|
|
||||
|
// 列表-操作按钮事件 |
||||
|
const buttonTableClick = async (val, row) => { |
||||
|
if (val == 'edit') { // 编辑 |
||||
|
openForm('update', row) |
||||
|
} else if (val == 'delete') { // 删除 |
||||
|
handleDelete(row.id) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/** 添加/修改操作 */ |
||||
|
const basicFormRef = ref() |
||||
|
const openForm = (type: string, row?: any) => { |
||||
|
basicFormRef.value.open(type, row) |
||||
|
} |
||||
|
|
||||
|
// form表单提交 |
||||
|
const formsSuccess = async (formType,data) => { |
||||
|
var isHave =SamplingScheme.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 SamplingSchemeApi.createSamplingScheme(data) |
||||
|
message.success(t('common.createSuccess')) |
||||
|
} else { |
||||
|
await SamplingSchemeApi.updateSamplingScheme(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, 'basicSamplingScheme') |
||||
|
} |
||||
|
|
||||
|
/** 删除按钮操作 */ |
||||
|
const handleDelete = async (id: number) => { |
||||
|
try { |
||||
|
// 删除的二次确认 |
||||
|
await message.delConfirm() |
||||
|
// 发起删除 |
||||
|
await SamplingSchemeApi.deleteSamplingScheme(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 SamplingSchemeApi.exportSamplingScheme(tableObject.params) |
||||
|
download.excel(data, '采样方案.xlsx') |
||||
|
} catch { |
||||
|
} finally { |
||||
|
exportLoading.value = false |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/** 导入 */ |
||||
|
const importFormRef = ref() |
||||
|
const handleImport = () => { |
||||
|
importFormRef.value.open() |
||||
|
} |
||||
|
// 导入附件弹窗所需的参数 |
||||
|
const importTemplateData = reactive({ |
||||
|
templateUrl: '', |
||||
|
templateTitle: '采样方案导入模版.xlsx' |
||||
|
}) |
||||
|
// 导入成功之后 |
||||
|
const importSuccess = () => { |
||||
|
getList() |
||||
|
} |
||||
|
|
||||
|
// 筛选提交 |
||||
|
const searchFormClick = (searchData) => { |
||||
|
tableObject.params = { |
||||
|
isSearch: true, |
||||
|
filters: searchData.filters |
||||
|
} |
||||
|
getList() // 刷新当前列表 |
||||
|
} |
||||
|
|
||||
|
/** 初始化 **/ |
||||
|
onMounted(async () => { |
||||
|
getList() |
||||
|
importTemplateData.templateUrl = await SamplingSchemeApi.importTemplate() |
||||
|
}) |
||||
|
|
||||
|
</script> |
@ -0,0 +1,61 @@ |
|||||
|
import type { CrudSchema } from '@/hooks/web/useCrudSchemas' |
||||
|
import { dateFormatter } from '@/utils/formatTime' |
||||
|
|
||||
|
// 表单校验
|
||||
|
export const SamplingSchemeRules = reactive({ |
||||
|
code: [required], |
||||
|
status: [required], |
||||
|
available: [required], |
||||
|
}) |
||||
|
|
||||
|
export const SamplingScheme = useCrudSchemas(reactive<CrudSchema[]>([ |
||||
|
{ |
||||
|
label: 'id', |
||||
|
field: 'id', |
||||
|
sort: 'custom', |
||||
|
isTable: false, |
||||
|
isForm: false, |
||||
|
}, |
||||
|
{ |
||||
|
label: '编码', |
||||
|
field: 'code', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
}, |
||||
|
{ |
||||
|
label: '描述', |
||||
|
field: 'describe', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
}, |
||||
|
{ |
||||
|
label: '状态', |
||||
|
field: 'status', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
form: { |
||||
|
component: 'Radio' |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
label: '是否可用', |
||||
|
field: 'available', |
||||
|
sort: 'custom', |
||||
|
}, |
||||
|
{ |
||||
|
label: '创建时间', |
||||
|
field: 'createTime', |
||||
|
sort: 'custom', |
||||
|
formatter: dateFormatter, |
||||
|
isForm: false, |
||||
|
}, |
||||
|
{ |
||||
|
label: '操作', |
||||
|
field: 'action', |
||||
|
isForm: false, |
||||
|
table: { |
||||
|
width: 150, |
||||
|
fixed: 'right' |
||||
|
} |
||||
|
} |
||||
|
])) |
Loading…
Reference in new issue