gaojs
8 months ago
32 changed files with 5229 additions and 1 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,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,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,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' |
|||
} |
|||
} |
|||
])) |
Loading…
Reference in new issue