Browse Source

MES下增加QMS模块

master_hella_20240701
gaojs 8 months ago
parent
commit
72adb38494
  1. 56
      src/api/mes/abilityInfo/index.ts
  2. 58
      src/api/mes/hrPersonAbility/index.ts
  3. 61
      src/api/mes/item/index.ts
  4. 55
      src/api/mes/opersteps/index.ts
  5. 57
      src/api/mes/operstepsType/index.ts
  6. 55
      src/api/mes/qualityclass/index.ts
  7. 55
      src/api/mes/qualityform/index.ts
  8. 61
      src/api/mes/qualityformdetail/index.ts
  9. 58
      src/api/mes/qualityformlog/index.ts
  10. 55
      src/api/mes/qualitygroup/index.ts
  11. 60
      src/api/mes/reworkSingle/index.ts
  12. 17
      src/utils/dict.ts
  13. 172
      src/views/mes/abilityInfo/abilityInfo.data.ts
  14. 244
      src/views/mes/abilityInfo/index.vue
  15. 210
      src/views/mes/hrPersonAbility/hrPersonAbility.data.ts
  16. 257
      src/views/mes/hrPersonAbility/index.vue
  17. 353
      src/views/mes/item/index.vue
  18. 203
      src/views/mes/item/item.data.ts
  19. 244
      src/views/mes/opersteps/index.vue
  20. 165
      src/views/mes/opersteps/opersteps.data.ts
  21. 244
      src/views/mes/operstepsType/index.vue
  22. 167
      src/views/mes/operstepsType/operstepsType.data.ts
  23. 245
      src/views/mes/qualityclass/index.vue
  24. 152
      src/views/mes/qualityclass/qualityclass.data.ts
  25. 297
      src/views/mes/qualityform/index.vue
  26. 316
      src/views/mes/qualityform/qualityform.data.ts
  27. 244
      src/views/mes/qualityformlog/index.vue
  28. 197
      src/views/mes/qualityformlog/qualityformlog.data.ts
  29. 244
      src/views/mes/qualitygroup/index.vue
  30. 151
      src/views/mes/qualitygroup/qualitygroup.data.ts
  31. 258
      src/views/mes/reworkSingle/index.vue
  32. 219
      src/views/mes/reworkSingle/reworkSingle.data.ts

56
src/api/mes/abilityInfo/index.ts

@ -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' })
}

58
src/api/mes/hrPersonAbility/index.ts

@ -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' })
}

61
src/api/mes/item/index.ts

@ -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' })
}

55
src/api/mes/opersteps/index.ts

@ -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' })
}

57
src/api/mes/operstepsType/index.ts

@ -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' })
}

55
src/api/mes/qualityclass/index.ts

@ -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' })
}

55
src/api/mes/qualityform/index.ts

@ -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' })
}

61
src/api/mes/qualityformdetail/index.ts

@ -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' })
}

58
src/api/mes/qualityformlog/index.ts

@ -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' })
}

55
src/api/mes/qualitygroup/index.ts

@ -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' })
}

60
src/api/mes/reworkSingle/index.ts

@ -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' })
}

17
src/utils/dict.ts

@ -279,12 +279,27 @@ export enum DICT_TYPE {
PLAN_PRODUCTION_TYPE = "plan_production_type", // 生产计划类型
DELIVER_TYPE="deliver_type",//发货类型
BILL_TYPE="bill_type", // 发票类型
// ========== 业务 - mes ==========
MESDO_STATUS= 'mes_do_status', // 工单执行状态
MES_WORKBILL_MODEL='mes_workbill_model',// 工单模式 单工单(根据产品数量生成多个工单)、批量工单(一个产品一个工单)
MES_TASK_MODE='mes_task_mode', //生产模式 派工方式、领工方式
MES_PLANDO_STATUS='mes_plando_status', //计划执行状
//========== mes-QMS ==========
//========== QMS ==========
SAMPLING_TYPE = "sampling_type", // 取样类型
EVALUATION_MODE = "evaluation_mode", // 评估模式
// ========== 业务 - mes -gaojs ==========
QUALIFY_STATUS = 'qualify_status',//质检状态
QUALIFY_ITEM_DATA_TYPE='qualify_item_data_type',//质检项目数据类型
QUALIFY_ITEM_VERIFY_MODE='qualify_item_verify_mode',//质检项目校验方式
QUALIFY_FORM_OPERATION='qualify_form_operation',//质检表单操作
OPERSTEP_COLLECT_TYPE='operstep_collect_type',//操作步骤采集方式
REWORK_TYPE='rework_type',//工作类型:返工登记、返修登记
REWORK_STATUS='rework_status',//返工返修状态:待返修,返修中,返修完成
REWORK_REPLACE_FLAG='rework_replace_flag',//是否有替换件
}

172
src/views/mes/abilityInfo/abilityInfo.data.ts

@ -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'
}
}
]))

244
src/views/mes/abilityInfo/index.vue

@ -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>

210
src/views/mes/hrPersonAbility/hrPersonAbility.data.ts

@ -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'
}
}
]))

257
src/views/mes/hrPersonAbility/index.vue

@ -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>

353
src/views/mes/item/index.vue

@ -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>

203
src/views/mes/item/item.data.ts

@ -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
}
]))

244
src/views/mes/opersteps/index.vue

@ -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>

165
src/views/mes/opersteps/opersteps.data.ts

@ -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'
}
}
]))

244
src/views/mes/operstepsType/index.vue

@ -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>

167
src/views/mes/operstepsType/operstepsType.data.ts

@ -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'
}
}
]))

245
src/views/mes/qualityclass/index.vue

@ -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>

152
src/views/mes/qualityclass/qualityclass.data.ts

@ -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
}
]))

297
src/views/mes/qualityform/index.vue

@ -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>

316
src/views/mes/qualityform/qualityform.data.ts

@ -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]
})

244
src/views/mes/qualityformlog/index.vue

@ -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>

197
src/views/mes/qualityformlog/qualityformlog.data.ts

@ -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'
}
}
]))

244
src/views/mes/qualitygroup/index.vue

@ -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>

151
src/views/mes/qualitygroup/qualitygroup.data.ts

@ -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
}
]))

258
src/views/mes/reworkSingle/index.vue

@ -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>

219
src/views/mes/reworkSingle/reworkSingle.data.ts

@ -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…
Cancel
Save