mahao
8 months ago
26 changed files with 3309 additions and 21 deletions
@ -0,0 +1,56 @@ |
|||
import request from '@/config/axios' |
|||
|
|||
export interface AbilityInfoVO { |
|||
deleteTime: Date |
|||
id: number |
|||
status: string |
|||
concurrencyStamp: number |
|||
remark: string |
|||
deleter: string |
|||
siteId: number |
|||
ablityCode: string |
|||
ablityName: string |
|||
trainMinHours: number |
|||
operMinHours: number |
|||
} |
|||
|
|||
// 查询能力矩阵信息列表
|
|||
export const getAbilityInfoPage = async (params) => { |
|||
if (params.isSearch) { |
|||
delete params.isSearch |
|||
const data = {...params} |
|||
return await request.post({ url: '/mes/ability-info/senior', data }) |
|||
} else { |
|||
return await request.get({ url: `/mes/ability-info/page`, params }) |
|||
} |
|||
} |
|||
|
|||
// 查询能力矩阵信息详情
|
|||
export const getAbilityInfo = async (id: number) => { |
|||
return await request.get({ url: `/mes/ability-info/get?id=` + id }) |
|||
} |
|||
|
|||
// 新增能力矩阵信息
|
|||
export const createAbilityInfo = async (data: AbilityInfoVO) => { |
|||
return await request.post({ url: `/mes/ability-info/create`, data }) |
|||
} |
|||
|
|||
// 修改能力矩阵信息
|
|||
export const updateAbilityInfo = async (data: AbilityInfoVO) => { |
|||
return await request.put({ url: `/mes/ability-info/update`, data }) |
|||
} |
|||
|
|||
// 删除能力矩阵信息
|
|||
export const deleteAbilityInfo = async (id: number) => { |
|||
return await request.delete({ url: `/mes/ability-info/delete?id=` + id }) |
|||
} |
|||
|
|||
// 导出能力矩阵信息 Excel
|
|||
export const exportAbilityInfo = async (params) => { |
|||
return await request.download({ url: `/mes/ability-info/export-excel`, params }) |
|||
} |
|||
|
|||
// 下载用户导入模板
|
|||
export const importTemplate = () => { |
|||
return request.download({ url: '/mes/ability-info/get-import-template' }) |
|||
} |
@ -0,0 +1,58 @@ |
|||
import request from '@/config/axios' |
|||
|
|||
export interface HrPersonAbilityVO { |
|||
deleteTime: Date |
|||
id: number |
|||
status: string |
|||
concurrencyStamp: number |
|||
remark: string |
|||
deleter: string |
|||
siteId: number |
|||
personId: number |
|||
personCode: string |
|||
ablityCode: string |
|||
ablityLevel: number |
|||
studyDuration: number |
|||
workDuration: number |
|||
} |
|||
|
|||
// 查询人员能力矩阵配置列表
|
|||
export const getHrPersonAbilityPage = async (params) => { |
|||
if (params.isSearch) { |
|||
delete params.isSearch |
|||
const data = {...params} |
|||
return await request.post({ url: '/mes/hr-person-ability/senior', data }) |
|||
} else { |
|||
return await request.get({ url: `/mes/hr-person-ability/page`, params }) |
|||
} |
|||
} |
|||
|
|||
// 查询人员能力矩阵配置详情
|
|||
export const getHrPersonAbility = async (id: number) => { |
|||
return await request.get({ url: `/mes/hr-person-ability/get?id=` + id }) |
|||
} |
|||
|
|||
// 新增人员能力矩阵配置
|
|||
export const createHrPersonAbility = async (data: HrPersonAbilityVO) => { |
|||
return await request.post({ url: `/mes/hr-person-ability/create`, data }) |
|||
} |
|||
|
|||
// 修改人员能力矩阵配置
|
|||
export const updateHrPersonAbility = async (data: HrPersonAbilityVO) => { |
|||
return await request.put({ url: `/mes/hr-person-ability/update`, data }) |
|||
} |
|||
|
|||
// 删除人员能力矩阵配置
|
|||
export const deleteHrPersonAbility = async (id: number) => { |
|||
return await request.delete({ url: `/mes/hr-person-ability/delete?id=` + id }) |
|||
} |
|||
|
|||
// 导出人员能力矩阵配置 Excel
|
|||
export const exportHrPersonAbility = async (params) => { |
|||
return await request.download({ url: `/mes/hr-person-ability/export-excel`, params }) |
|||
} |
|||
|
|||
// 下载用户导入模板
|
|||
export const importTemplate = () => { |
|||
return request.download({ url: '/mes/hr-person-ability/get-import-template' }) |
|||
} |
@ -0,0 +1,57 @@ |
|||
import request from '@/config/axios' |
|||
|
|||
export interface OperstepsTypeVO { |
|||
collectCode: string |
|||
collectName: string |
|||
collectType: string |
|||
adpaterClass: string |
|||
argLsit: string |
|||
deleteTime: Date |
|||
id: number |
|||
status: string |
|||
concurrencyStamp: number |
|||
remark: string |
|||
deleter: string |
|||
siteId: number |
|||
} |
|||
|
|||
// 查询操作步骤类型配置列表
|
|||
export const getOperstepsTypePage = async (params) => { |
|||
if (params.isSearch) { |
|||
delete params.isSearch |
|||
const data = {...params} |
|||
return await request.post({ url: '/mes/opersteps-type/senior', data }) |
|||
} else { |
|||
return await request.get({ url: `/mes/opersteps-type/page`, params }) |
|||
} |
|||
} |
|||
|
|||
// 查询操作步骤类型配置详情
|
|||
export const getOperstepsType = async (id: number) => { |
|||
return await request.get({ url: `/mes/opersteps-type/get?id=` + id }) |
|||
} |
|||
|
|||
// 新增操作步骤类型配置
|
|||
export const createOperstepsType = async (data: OperstepsTypeVO) => { |
|||
return await request.post({ url: `/mes/opersteps-type/create`, data }) |
|||
} |
|||
|
|||
// 修改操作步骤类型配置
|
|||
export const updateOperstepsType = async (data: OperstepsTypeVO) => { |
|||
return await request.put({ url: `/mes/opersteps-type/update`, data }) |
|||
} |
|||
|
|||
// 删除操作步骤类型配置
|
|||
export const deleteOperstepsType = async (id: number) => { |
|||
return await request.delete({ url: `/mes/opersteps-type/delete?id=` + id }) |
|||
} |
|||
|
|||
// 导出操作步骤类型配置 Excel
|
|||
export const exportOperstepsType = async (params) => { |
|||
return await request.download({ url: `/mes/opersteps-type/export-excel`, params }) |
|||
} |
|||
|
|||
// 下载用户导入模板
|
|||
export const importTemplate = () => { |
|||
return request.download({ url: '/mes/opersteps-type/get-import-template' }) |
|||
} |
@ -0,0 +1,55 @@ |
|||
import request from '@/config/axios' |
|||
|
|||
export interface 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: '/qms/qualityform/senior', data }) |
|||
} else { |
|||
return await request.get({ url: `/qms/qualityform/page`, params }) |
|||
} |
|||
} |
|||
|
|||
// 查询质检表单详情
|
|||
export const getQualityform = async (id: number) => { |
|||
return await request.get({ url: `/qms/qualityform/get?id=` + id }) |
|||
} |
|||
|
|||
// 新增质检表单
|
|||
export const createQualityform = async (data: QualityformVO) => { |
|||
return await request.post({ url: `/qms/qualityform/create`, data }) |
|||
} |
|||
|
|||
// 修改质检表单
|
|||
export const updateQualityform = async (data: QualityformVO) => { |
|||
return await request.put({ url: `/qms/qualityform/update`, data }) |
|||
} |
|||
|
|||
// 删除质检表单
|
|||
export const deleteQualityform = async (id: number) => { |
|||
return await request.delete({ url: `/qms/qualityform/delete?id=` + id }) |
|||
} |
|||
|
|||
// 导出质检表单 Excel
|
|||
export const exportQualityform = async (params) => { |
|||
return await request.download({ url: `/qms/qualityform/export-excel`, params }) |
|||
} |
|||
|
|||
// 下载用户导入模板
|
|||
export const importTemplate = () => { |
|||
return request.download({ url: '/qms/qualityform/get-import-template' }) |
|||
} |
@ -0,0 +1,61 @@ |
|||
import request from '@/config/axios' |
|||
|
|||
export interface QualityformdetailVO { |
|||
deleteTime: Date |
|||
id: number |
|||
status: string |
|||
concurrencyStamp: number |
|||
remark: string |
|||
deleter: string |
|||
siteId: number |
|||
formNo: string |
|||
itemCode: string |
|||
itemName: string |
|||
itemType: string |
|||
qmsClass: string |
|||
dataType: string |
|||
dataVerify: string |
|||
dataStandvalue: string |
|||
dataDescripe: string |
|||
} |
|||
|
|||
// 查询质检表单子表列表
|
|||
export const getQualityformdetailPage = async (params) => { |
|||
if (params.isSearch) { |
|||
delete params.isSearch |
|||
const data = {...params} |
|||
return await request.post({ url: '/qms/qualityformdetail/senior', data }) |
|||
} else { |
|||
return await request.get({ url: `/qms/qualityformdetail/page`, params }) |
|||
} |
|||
} |
|||
|
|||
// 查询质检表单子表详情
|
|||
export const getQualityformdetail = async (id: number) => { |
|||
return await request.get({ url: `/qms/qualityformdetail/get?id=` + id }) |
|||
} |
|||
|
|||
// 新增质检表单子表
|
|||
export const createQualityformdetail = async (data: QualityformdetailVO) => { |
|||
return await request.post({ url: `/qms/qualityformdetail/create`, data }) |
|||
} |
|||
|
|||
// 修改质检表单子表
|
|||
export const updateQualityformdetail = async (data: QualityformdetailVO) => { |
|||
return await request.put({ url: `/qms/qualityformdetail/update`, data }) |
|||
} |
|||
|
|||
// 删除质检表单子表
|
|||
export const deleteQualityformdetail = async (id: number) => { |
|||
return await request.delete({ url: `/qms/qualityformdetail/delete?id=` + id }) |
|||
} |
|||
|
|||
// 导出质检表单子表 Excel
|
|||
export const exportQualityformdetail = async (params) => { |
|||
return await request.download({ url: `/qms/qualityformdetail/export-excel`, params }) |
|||
} |
|||
|
|||
// 下载用户导入模板
|
|||
export const importTemplate = () => { |
|||
return request.download({ url: '/qms/qualityformdetail/get-import-template' }) |
|||
} |
@ -0,0 +1,58 @@ |
|||
import request from '@/config/axios' |
|||
|
|||
export interface QualityformlogVO { |
|||
deleteTime: Date |
|||
id: number |
|||
status: string |
|||
concurrencyStamp: number |
|||
remark: string |
|||
deleter: string |
|||
siteId: number |
|||
masterId: number |
|||
formNo: string |
|||
operation: string |
|||
operator: string |
|||
operateContent: string |
|||
operateTime: Date |
|||
} |
|||
|
|||
// 查询质检表单日志列表
|
|||
export const getQualityformlogPage = async (params) => { |
|||
if (params.isSearch) { |
|||
delete params.isSearch |
|||
const data = {...params} |
|||
return await request.post({ url: '/qms/qualityformlog/senior', data }) |
|||
} else { |
|||
return await request.get({ url: `/qms/qualityformlog/page`, params }) |
|||
} |
|||
} |
|||
|
|||
// 查询质检表单日志详情
|
|||
export const getQualityformlog = async (id: number) => { |
|||
return await request.get({ url: `/qms/qualityformlog/get?id=` + id }) |
|||
} |
|||
|
|||
// 新增质检表单日志
|
|||
export const createQualityformlog = async (data: QualityformlogVO) => { |
|||
return await request.post({ url: `/qms/qualityformlog/create`, data }) |
|||
} |
|||
|
|||
// 修改质检表单日志
|
|||
export const updateQualityformlog = async (data: QualityformlogVO) => { |
|||
return await request.put({ url: `/qms/qualityformlog/update`, data }) |
|||
} |
|||
|
|||
// 删除质检表单日志
|
|||
export const deleteQualityformlog = async (id: number) => { |
|||
return await request.delete({ url: `/qms/qualityformlog/delete?id=` + id }) |
|||
} |
|||
|
|||
// 导出质检表单日志 Excel
|
|||
export const exportQualityformlog = async (params) => { |
|||
return await request.download({ url: `/qms/qualityformlog/export-excel`, params }) |
|||
} |
|||
|
|||
// 下载用户导入模板
|
|||
export const importTemplate = () => { |
|||
return request.download({ url: '/qms/qualityformlog/get-import-template' }) |
|||
} |
@ -0,0 +1,55 @@ |
|||
import request from '@/config/axios' |
|||
|
|||
export interface QualitygroupVO { |
|||
deleteTime: Date |
|||
id: number |
|||
status: string |
|||
concurrencyStamp: number |
|||
remark: string |
|||
deleter: string |
|||
siteId: number |
|||
code: string |
|||
name: string |
|||
groupCode: string |
|||
} |
|||
|
|||
// 查询质检分组列表
|
|||
export const getQualitygroupPage = async (params) => { |
|||
if (params.isSearch) { |
|||
delete params.isSearch |
|||
const data = {...params} |
|||
return await request.post({ url: '/qms/qualitygroup/senior', data }) |
|||
} else { |
|||
return await request.get({ url: `/qms/qualitygroup/page`, params }) |
|||
} |
|||
} |
|||
|
|||
// 查询质检分组详情
|
|||
export const getQualitygroup = async (id: number) => { |
|||
return await request.get({ url: `/qms/qualitygroup/get?id=` + id }) |
|||
} |
|||
|
|||
// 新增质检分组
|
|||
export const createQualitygroup = async (data: QualitygroupVO) => { |
|||
return await request.post({ url: `/qms/qualitygroup/create`, data }) |
|||
} |
|||
|
|||
// 修改质检分组
|
|||
export const updateQualitygroup = async (data: QualitygroupVO) => { |
|||
return await request.put({ url: `/qms/qualitygroup/update`, data }) |
|||
} |
|||
|
|||
// 删除质检分组
|
|||
export const deleteQualitygroup = async (id: number) => { |
|||
return await request.delete({ url: `/qms/qualitygroup/delete?id=` + id }) |
|||
} |
|||
|
|||
// 导出质检分组 Excel
|
|||
export const exportQualitygroup = async (params) => { |
|||
return await request.download({ url: `/qms/qualitygroup/export-excel`, params }) |
|||
} |
|||
|
|||
// 下载用户导入模板
|
|||
export const importTemplate = () => { |
|||
return request.download({ url: '/qms/qualitygroup/get-import-template' }) |
|||
} |
@ -0,0 +1,172 @@ |
|||
import type { CrudSchema } from '@/hooks/web/useCrudSchemas' |
|||
import { dateFormatter } from '@/utils/formatTime' |
|||
|
|||
// 表单校验
|
|||
export const AbilityInfoRules = reactive({ |
|||
ablityCode: [required], |
|||
ablityName: [required], |
|||
trainMinHours: [required], |
|||
operMinHours: [required], |
|||
}) |
|||
|
|||
export const AbilityInfo = useCrudSchemas(reactive<CrudSchema[]>([ |
|||
{ |
|||
label: '删除时间', |
|||
field: 'deleteTime', |
|||
sort: 'custom', |
|||
formatter: dateFormatter, |
|||
isSearch: false, |
|||
isTable: false, |
|||
isForm:false, |
|||
isDetail:false, |
|||
search: { |
|||
component: 'DatePicker', |
|||
componentProps: { |
|||
valueFormat: 'YYYY-MM-DD HH:mm:ss', |
|||
type: 'daterange', |
|||
defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')] |
|||
} |
|||
}, |
|||
form: { |
|||
component: 'DatePicker', |
|||
componentProps: { |
|||
type: 'datetime', |
|||
valueFormat: 'x' |
|||
} |
|||
}, |
|||
}, |
|||
{ |
|||
label: '主键', |
|||
field: 'id', |
|||
sort: 'custom', |
|||
isForm: false, |
|||
isTable: false, |
|||
isDetail:false, |
|||
}, |
|||
{ |
|||
label: '并发乐观锁', |
|||
field: 'concurrencyStamp', |
|||
sort: 'custom', |
|||
isSearch: false, |
|||
isTable: false, |
|||
isForm:false, |
|||
isDetail:false, |
|||
form: { |
|||
component: 'InputNumber', |
|||
value: 0 |
|||
}, |
|||
}, |
|||
|
|||
{ |
|||
label: '创建时间', |
|||
field: 'createTime', |
|||
sort: 'custom', |
|||
formatter: dateFormatter, |
|||
isSearch: false, |
|||
isTable: false, |
|||
isDetail:false, |
|||
search: { |
|||
component: 'DatePicker', |
|||
componentProps: { |
|||
valueFormat: 'YYYY-MM-DD HH:mm:ss', |
|||
type: 'daterange', |
|||
defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')] |
|||
} |
|||
}, |
|||
isForm: false, |
|||
}, |
|||
{ |
|||
label: '删除用户名', |
|||
field: 'deleter', |
|||
sort: 'custom', |
|||
isSearch: false, |
|||
isTable: false, |
|||
isForm: false, |
|||
isDetail:false |
|||
}, |
|||
{ |
|||
label: '位置ID', |
|||
field: 'siteId', |
|||
sort: 'custom', |
|||
isSearch: false, |
|||
isTable: false, |
|||
isForm: false, |
|||
isDetail:false, |
|||
form: { |
|||
component: 'InputNumber', |
|||
value: 0 |
|||
}, |
|||
}, |
|||
{ |
|||
label: '技能编号', |
|||
field: 'ablityCode', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
}, |
|||
{ |
|||
label: '技能名称', |
|||
field: 'ablityName', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
}, |
|||
{ |
|||
label: '要求培训时长', |
|||
field: 'trainMinHours', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
form: { |
|||
component: 'InputNumber', |
|||
componentProps: { |
|||
min: 0, |
|||
precision: 1 |
|||
} |
|||
} |
|||
}, |
|||
{ |
|||
label: '操作时长', |
|||
field: 'operMinHours', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
form: { |
|||
component: 'InputNumber', |
|||
componentProps: { |
|||
min: 0, |
|||
precision: 1 |
|||
} |
|||
} |
|||
}, |
|||
{ |
|||
label: '备注', |
|||
field: 'remark', |
|||
sort: 'custom', |
|||
isSearch: false, |
|||
isTable: false |
|||
}, |
|||
{ |
|||
label: '状态', |
|||
field: 'status', |
|||
sort: 'custom', |
|||
dictType: DICT_TYPE.QUALIFY_STATUS, |
|||
dictClass: 'string', |
|||
isForm: true, |
|||
isSearch: true, |
|||
isTable: true, |
|||
form: { |
|||
component: 'Switch', |
|||
value: '2', |
|||
componentProps: { |
|||
inactiveValue: '2', |
|||
activeValue: '1' |
|||
} |
|||
}, |
|||
}, |
|||
{ |
|||
label: '操作', |
|||
field: 'action', |
|||
isForm: false, |
|||
table: { |
|||
width: 150, |
|||
fixed: 'right' |
|||
} |
|||
} |
|||
])) |
@ -0,0 +1,244 @@ |
|||
<template> |
|||
<ContentWrap> |
|||
<!-- 搜索工作栏 --> |
|||
<Search :schema="AbilityInfo.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" /> |
|||
</ContentWrap> |
|||
|
|||
<!-- 列表头部 --> |
|||
<TableHead |
|||
:HeadButttondata="HeadButttondata" |
|||
@button-base-click="buttonBaseClick" |
|||
:routeName="routeName" |
|||
@updataTableColumns="updataTableColumns" |
|||
@searchFormClick="searchFormClick" |
|||
:allSchemas="AbilityInfo.allSchemas" |
|||
/> |
|||
|
|||
<!-- 列表 --> |
|||
<ContentWrap> |
|||
<Table |
|||
:columns="tableColumns" |
|||
:data="tableObject.tableList" |
|||
:loading="tableObject.loading" |
|||
:pagination="{ |
|||
total: tableObject.total |
|||
}" |
|||
v-model:pageSize="tableObject.pageSize" |
|||
v-model:currentPage="tableObject.currentPage" |
|||
v-model:sort="tableObject.sort" |
|||
> |
|||
<template #ablityCode="{row}"> |
|||
<el-button type="primary" link @click="openDetail(row, '代码', row.ablityCode)"> |
|||
<span>{{ row.ablityCode }}</span> |
|||
</el-button> |
|||
</template> |
|||
<template #action="{ row }"> |
|||
<ButtonBase :Butttondata="butttondata" @button-base-click="buttonTableClick($event,row)" /> |
|||
</template> |
|||
</Table> |
|||
</ContentWrap> |
|||
|
|||
<!-- 表单弹窗:添加/修改 --> |
|||
<BasicForm |
|||
ref="basicFormRef" |
|||
@success="formsSuccess" |
|||
:rules="AbilityInfoRules" |
|||
:formAllSchemas="AbilityInfo.allSchemas" |
|||
:apiUpdate="AbilityInfoApi.updateAbilityInfo" |
|||
:apiCreate="AbilityInfoApi.createAbilityInfo" |
|||
@searchTableSuccess="searchTableSuccess" |
|||
:isBusiness="false" |
|||
/> |
|||
|
|||
<!-- 详情 --> |
|||
<Detail ref="detailRef" :isBasic="true" :allSchemas="AbilityInfo.allSchemas" /> |
|||
|
|||
<!-- 导入 --> |
|||
<ImportForm ref="importFormRef" url="/mes/ability-info/import" :importTemplateData="importTemplateData" @success="importSuccess" /> |
|||
</template> |
|||
|
|||
<script setup lang="ts"> |
|||
import download from '@/utils/download' |
|||
import { AbilityInfo,AbilityInfoRules } from './abilityInfo.data' |
|||
import * as AbilityInfoApi from '@/api/mes/abilityInfo' |
|||
import * as defaultButtons from '@/utils/disposition/defaultButtons' |
|||
import TableHead from '@/components/TableHead/src/TableHead.vue' |
|||
import ImportForm from '@/components/ImportForm/src/ImportForm.vue' |
|||
import Detail from '@/components/Detail/src/Detail.vue' |
|||
|
|||
defineOptions({ name: 'AbilityInfo' }) |
|||
|
|||
const message = useMessage() // 消息弹窗 |
|||
const { t } = useI18n() // 国际化 |
|||
|
|||
const route = useRoute() // 路由信息 |
|||
const routeName = ref() |
|||
routeName.value = route.name |
|||
const tableColumns = ref(AbilityInfo.allSchemas.tableColumns) |
|||
|
|||
// 查询页面返回 |
|||
const searchTableSuccess = (formField, searchField, val, formRef) => { |
|||
nextTick(() => { |
|||
const setV = {} |
|||
setV[formField] = val[0][searchField] |
|||
formRef.setValues(setV) |
|||
}) |
|||
} |
|||
|
|||
// 字段设置 更新主列表字段 |
|||
const updataTableColumns = (val) => { |
|||
tableColumns.value = val |
|||
} |
|||
|
|||
const { tableObject, tableMethods } = useTable({ |
|||
getListApi: AbilityInfoApi.getAbilityInfoPage // 分页接口 |
|||
}) |
|||
|
|||
// 获得表格的各种操作 |
|||
const { getList, setSearchParams } = tableMethods |
|||
|
|||
// 列表头部按钮 |
|||
const HeadButttondata = [ |
|||
defaultButtons.defaultAddBtn({hasPermi:'mes:abilityInfo:create'}), // 新增 |
|||
defaultButtons.defaultImportBtn({hasPermi:'mes:abilityInfo:import'}), // 导入 |
|||
defaultButtons.defaultExportBtn({hasPermi:'mes:abilityInfo:export'}), // 导出 |
|||
defaultButtons.defaultFreshBtn(null), // 刷新 |
|||
defaultButtons.defaultFilterBtn(null), // 筛选 |
|||
defaultButtons.defaultSetBtn(null), // 设置 |
|||
// { |
|||
// label: '自定义扩展按钮', |
|||
// name: 'zdy', |
|||
// hide: false, |
|||
// type: 'primary', |
|||
// icon: 'Select', |
|||
// color: '' |
|||
// }, |
|||
] |
|||
|
|||
// 头部按钮事件 |
|||
const buttonBaseClick = (val, item) => { |
|||
if (val == 'add') { // 新增 |
|||
openForm('create') |
|||
} else if (val == 'import') { // 导入 |
|||
handleImport() |
|||
} else if (val == 'export') { // 导出 |
|||
handleExport() |
|||
} else if (val == 'refresh') { // 刷新 |
|||
getList() |
|||
} else if (val == 'filtrate') { // 筛选 |
|||
} else { // 其他按钮 |
|||
console.log('其他按钮', item) |
|||
} |
|||
} |
|||
|
|||
// 列表-操作按钮 |
|||
const butttondata = [ |
|||
defaultButtons.mainListEditBtn({hasPermi:'mes:abilityInfo:update'}), // 编辑 |
|||
defaultButtons.mainListDeleteBtn({hasPermi:'mes:abilityInfo:delete'}), // 删除 |
|||
] |
|||
|
|||
// 列表-操作按钮事件 |
|||
const buttonTableClick = async (val, row) => { |
|||
if (val == 'edit') { // 编辑 |
|||
openForm('update', row) |
|||
} else if (val == 'delete') { // 删除 |
|||
handleDelete(row.id) |
|||
} |
|||
} |
|||
|
|||
/** 添加/修改操作 */ |
|||
const basicFormRef = ref() |
|||
const openForm = (type: string, row?: any) => { |
|||
basicFormRef.value.open(type, row) |
|||
} |
|||
|
|||
// form表单提交 |
|||
const formsSuccess = async (formType,data) => { |
|||
var isHave =AbilityInfo.allSchemas.formSchema.some(function (item) { |
|||
return item.field === 'activeTime' || item.field === 'expireTime'; |
|||
}); |
|||
if(isHave){ |
|||
if(data.activeTime && data.expireTime && data.activeTime >=data.expireTime){ |
|||
message.error('失效时间要大于生效时间') |
|||
return; |
|||
} |
|||
} |
|||
if(data.activeTime==0)data.activeTime = null; |
|||
if(data.expireTime==0)data.expireTime = null; |
|||
if (formType === 'create') { |
|||
await AbilityInfoApi.createAbilityInfo(data) |
|||
message.success(t('common.createSuccess')) |
|||
} else { |
|||
await AbilityInfoApi.updateAbilityInfo(data) |
|||
message.success(t('common.updateSuccess')) |
|||
} |
|||
basicFormRef.value.dialogVisible = false |
|||
getList() |
|||
} |
|||
|
|||
/** 详情操作 */ |
|||
const detailRef = ref() |
|||
const openDetail = (row: any, titleName: any, titleValue: any) => { |
|||
detailRef.value.openDetail(row, titleName, titleValue, 'basicAbilityInfo') |
|||
} |
|||
|
|||
/** 删除按钮操作 */ |
|||
const handleDelete = async (id: number) => { |
|||
try { |
|||
// 删除的二次确认 |
|||
await message.delConfirm() |
|||
// 发起删除 |
|||
await AbilityInfoApi.deleteAbilityInfo(id) |
|||
message.success(t('common.delSuccess')) |
|||
// 刷新列表 |
|||
await getList() |
|||
} catch {} |
|||
} |
|||
|
|||
/** 导出按钮操作 */ |
|||
const exportLoading = ref(false) // 导出的加载中 |
|||
const handleExport = async () => { |
|||
try { |
|||
// 导出的二次确认 |
|||
await message.exportConfirm() |
|||
// 发起导出 |
|||
exportLoading.value = true |
|||
const data = await AbilityInfoApi.exportAbilityInfo(tableObject.params) |
|||
download.excel(data, '能力矩阵信息.xlsx') |
|||
} catch { |
|||
} finally { |
|||
exportLoading.value = false |
|||
} |
|||
} |
|||
|
|||
/** 导入 */ |
|||
const importFormRef = ref() |
|||
const handleImport = () => { |
|||
importFormRef.value.open() |
|||
} |
|||
// 导入附件弹窗所需的参数 |
|||
const importTemplateData = reactive({ |
|||
templateUrl: '', |
|||
templateTitle: '能力矩阵信息导入模版.xlsx' |
|||
}) |
|||
// 导入成功之后 |
|||
const importSuccess = () => { |
|||
getList() |
|||
} |
|||
|
|||
// 筛选提交 |
|||
const searchFormClick = (searchData) => { |
|||
tableObject.params = { |
|||
isSearch: true, |
|||
filters: searchData.filters |
|||
} |
|||
getList() // 刷新当前列表 |
|||
} |
|||
|
|||
/** 初始化 **/ |
|||
onMounted(async () => { |
|||
getList() |
|||
importTemplateData.templateUrl = await AbilityInfoApi.importTemplate() |
|||
}) |
|||
|
|||
</script> |
@ -0,0 +1,210 @@ |
|||
import type { CrudSchema } from '@/hooks/web/useCrudSchemas' |
|||
import { dateFormatter } from '@/utils/formatTime' |
|||
import * as AbilityInfoApi from '@/api/mes/abilityInfo' |
|||
import { AbilityInfo } from '../abilityInfo/abilityInfo.data' |
|||
|
|||
|
|||
// 表单校验
|
|||
export const HrPersonAbilityRules = reactive({ |
|||
ablityCode: [required], |
|||
personCode: [required], |
|||
|
|||
}) |
|||
|
|||
export const HrPersonAbility = useCrudSchemas(reactive<CrudSchema[]>([ |
|||
{ |
|||
label: '删除时间', |
|||
field: 'deleteTime', |
|||
sort: 'custom', |
|||
formatter: dateFormatter, |
|||
isSearch: false, |
|||
isTable: false, |
|||
isForm:false, |
|||
isDetail:false, |
|||
search: { |
|||
component: 'DatePicker', |
|||
componentProps: { |
|||
valueFormat: 'YYYY-MM-DD HH:mm:ss', |
|||
type: 'daterange', |
|||
defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')] |
|||
} |
|||
}, |
|||
form: { |
|||
component: 'DatePicker', |
|||
componentProps: { |
|||
type: 'datetime', |
|||
valueFormat: 'x' |
|||
} |
|||
}, |
|||
}, |
|||
{ |
|||
label: '主键', |
|||
field: 'id', |
|||
sort: 'custom', |
|||
isForm: false, |
|||
isTable: false, |
|||
isDetail:false |
|||
}, |
|||
{ |
|||
label: '并发乐观锁', |
|||
field: 'concurrencyStamp', |
|||
sort: 'custom', |
|||
isSearch: false, |
|||
isTable: false, |
|||
isForm:false, |
|||
isDetail:false, |
|||
form: { |
|||
component: 'InputNumber', |
|||
value: 0 |
|||
}, |
|||
}, |
|||
{ |
|||
label: '创建时间', |
|||
field: 'createTime', |
|||
sort: 'custom', |
|||
formatter: dateFormatter, |
|||
isSearch: false, |
|||
isTable: false, |
|||
isDetail:false, |
|||
search: { |
|||
component: 'DatePicker', |
|||
componentProps: { |
|||
valueFormat: 'YYYY-MM-DD HH:mm:ss', |
|||
type: 'daterange', |
|||
defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')] |
|||
} |
|||
}, |
|||
isForm: false, |
|||
}, |
|||
{ |
|||
label: '删除用户名', |
|||
field: 'deleter', |
|||
sort: 'custom', |
|||
isSearch: false, |
|||
isTable: false, |
|||
isForm: false, |
|||
isDetail:false, |
|||
}, |
|||
{ |
|||
label: '位置ID', |
|||
field: 'siteId', |
|||
sort: 'custom', |
|||
isSearch: false, |
|||
isTable: false, |
|||
isForm: false, |
|||
isDetail:false, |
|||
form: { |
|||
component: 'InputNumber', |
|||
value: 0 |
|||
}, |
|||
}, |
|||
{ |
|||
label: '人员ID', |
|||
field: 'personId', |
|||
sort: 'custom', |
|||
isSearch: false, |
|||
isTable: false, |
|||
isForm: false, |
|||
isDetail:false, |
|||
form: { |
|||
component: 'InputNumber', |
|||
value: 0 |
|||
}, |
|||
}, |
|||
{ |
|||
label: '人员工号', |
|||
field: 'personCode', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
}, |
|||
{ |
|||
label: '能力编号', |
|||
field: 'ablityCode', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
form: { |
|||
componentProps: { |
|||
isSearchList: true, // 开启查询弹窗
|
|||
searchTitle: '能力矩阵信息', // 查询弹窗标题
|
|||
searchAllSchemas: AbilityInfo.allSchemas, // 查询弹窗所需类
|
|||
searchField: 'ablityCode', // 查询弹窗赋值字段
|
|||
searchPage: AbilityInfoApi.getAbilityInfoPage, // 查询弹窗所需分页方法
|
|||
searchCondition: [{ |
|||
key: 'status', |
|||
value: '1', |
|||
action: '==' |
|||
}] |
|||
} |
|||
} |
|||
}, |
|||
{ |
|||
label: '能力等级', |
|||
field: 'ablityLevel', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
form: { |
|||
component: 'InputNumber', |
|||
value: 0 |
|||
}, |
|||
}, |
|||
{ |
|||
label: '学习累计时长', |
|||
field: 'studyDuration', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
form: { |
|||
component: 'InputNumber', |
|||
componentProps: { |
|||
min: 0, |
|||
precision: 1 |
|||
} |
|||
}, |
|||
}, |
|||
{ |
|||
label: '工作累计时长', |
|||
field: 'workDuration', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
form: { |
|||
component: 'InputNumber', |
|||
componentProps: { |
|||
min: 0, |
|||
precision: 1 |
|||
} |
|||
}, |
|||
}, |
|||
{ |
|||
label: '备注', |
|||
field: 'remark', |
|||
sort: 'custom', |
|||
isSearch: false, |
|||
isTable: false |
|||
}, |
|||
{ |
|||
label: '状态', |
|||
field: 'status', |
|||
sort: 'custom', |
|||
dictType: DICT_TYPE.QUALIFY_STATUS, |
|||
dictClass: 'string', |
|||
isForm: true, |
|||
isSearch: true, |
|||
isTable: true, |
|||
form: { |
|||
component: 'Switch', |
|||
value: '2', |
|||
componentProps: { |
|||
inactiveValue: '2', |
|||
activeValue: '1' |
|||
} |
|||
}, |
|||
}, |
|||
{ |
|||
label: '操作', |
|||
field: 'action', |
|||
isForm: false, |
|||
table: { |
|||
width: 150, |
|||
fixed: 'right' |
|||
} |
|||
} |
|||
])) |
@ -0,0 +1,257 @@ |
|||
<template> |
|||
<ContentWrap> |
|||
<!-- 搜索工作栏 --> |
|||
<Search :schema="HrPersonAbility.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" /> |
|||
</ContentWrap> |
|||
|
|||
<!-- 列表头部 --> |
|||
<TableHead |
|||
:HeadButttondata="HeadButttondata" |
|||
@button-base-click="buttonBaseClick" |
|||
:routeName="routeName" |
|||
@updataTableColumns="updataTableColumns" |
|||
@searchFormClick="searchFormClick" |
|||
:allSchemas="HrPersonAbility.allSchemas" |
|||
/> |
|||
|
|||
<!-- 列表 --> |
|||
<ContentWrap> |
|||
<Table |
|||
:columns="tableColumns" |
|||
:data="tableObject.tableList" |
|||
:loading="tableObject.loading" |
|||
:pagination="{ |
|||
total: tableObject.total |
|||
}" |
|||
v-model:pageSize="tableObject.pageSize" |
|||
v-model:currentPage="tableObject.currentPage" |
|||
v-model:sort="tableObject.sort" |
|||
> |
|||
<template #personCode="{row}"> |
|||
<el-button type="primary" link @click="openDetail(row, '代码', row.personCode)"> |
|||
<span>{{ row.personCode }}</span> |
|||
</el-button> |
|||
</template> |
|||
<template #action="{ row }"> |
|||
<ButtonBase :Butttondata="butttondata" @button-base-click="buttonTableClick($event,row)" /> |
|||
</template> |
|||
</Table> |
|||
</ContentWrap> |
|||
|
|||
<!-- 表单弹窗:添加/修改 --> |
|||
<BasicForm |
|||
ref="basicFormRef" |
|||
@success="formsSuccess" |
|||
:rules="HrPersonAbilityRules" |
|||
:formAllSchemas="HrPersonAbility.allSchemas" |
|||
:apiUpdate="HrPersonAbilityApi.updateHrPersonAbility" |
|||
:apiCreate="HrPersonAbilityApi.createHrPersonAbility" |
|||
@searchTableSuccess="searchTableSuccess" |
|||
:isBusiness="false" |
|||
/> |
|||
|
|||
<!-- 详情 --> |
|||
<Detail ref="detailRef" :isBasic="true" :allSchemas="HrPersonAbility.allSchemas" /> |
|||
|
|||
<!-- 导入 --> |
|||
<ImportForm ref="importFormRef" url="/mes/hr-person-ability/import" :importTemplateData="importTemplateData" @success="importSuccess" /> |
|||
</template> |
|||
|
|||
<script setup lang="ts"> |
|||
import download from '@/utils/download' |
|||
import { HrPersonAbility,HrPersonAbilityRules } from './hrPersonAbility.data' |
|||
import * as HrPersonAbilityApi from '@/api/mes/hrPersonAbility' |
|||
import * as defaultButtons from '@/utils/disposition/defaultButtons' |
|||
import TableHead from '@/components/TableHead/src/TableHead.vue' |
|||
import ImportForm from '@/components/ImportForm/src/ImportForm.vue' |
|||
import Detail from '@/components/Detail/src/Detail.vue' |
|||
|
|||
defineOptions({ name: 'HrPersonAbility' }) |
|||
|
|||
const message = useMessage() // 消息弹窗 |
|||
const { t } = useI18n() // 国际化 |
|||
|
|||
const route = useRoute() // 路由信息 |
|||
const routeName = ref() |
|||
routeName.value = route.name |
|||
const tableColumns = ref(HrPersonAbility.allSchemas.tableColumns) |
|||
|
|||
// 查询页面返回 |
|||
const searchTableSuccess = (formField, searchField, val, formRef) => { |
|||
nextTick(() => { |
|||
const setV = {} |
|||
setV[formField] = val[0][searchField] |
|||
formRef.setValues(setV) |
|||
}) |
|||
} |
|||
|
|||
// 字段设置 更新主列表字段 |
|||
const updataTableColumns = (val) => { |
|||
tableColumns.value = val |
|||
} |
|||
|
|||
const { tableObject, tableMethods } = useTable({ |
|||
getListApi: HrPersonAbilityApi.getHrPersonAbilityPage // 分页接口 |
|||
}) |
|||
|
|||
// 获得表格的各种操作 |
|||
const { getList, setSearchParams } = tableMethods |
|||
|
|||
// 列表头部按钮 |
|||
const HeadButttondata = [ |
|||
defaultButtons.defaultAddBtn({hasPermi:'mes:hrPersonAbility:create'}), // 新增 |
|||
defaultButtons.defaultImportBtn({hasPermi:'mes:hrPersonAbility:import'}), // 导入 |
|||
defaultButtons.defaultExportBtn({hasPermi:'mes:hrPersonAbility:export'}), // 导出 |
|||
defaultButtons.defaultFreshBtn(null), // 刷新 |
|||
defaultButtons.defaultFilterBtn(null), // 筛选 |
|||
defaultButtons.defaultSetBtn(null), // 设置 |
|||
// { |
|||
// label: '自定义扩展按钮', |
|||
// name: 'zdy', |
|||
// hide: false, |
|||
// type: 'primary', |
|||
// icon: 'Select', |
|||
// color: '' |
|||
// }, |
|||
] |
|||
|
|||
// 头部按钮事件 |
|||
const buttonBaseClick = (val, item) => { |
|||
if (val == 'add') { // 新增 |
|||
openForm('create') |
|||
} else if (val == 'import') { // 导入 |
|||
handleImport() |
|||
} else if (val == 'export') { // 导出 |
|||
handleExport() |
|||
} else if (val == 'refresh') { // 刷新 |
|||
getList() |
|||
} else if (val == 'filtrate') { // 筛选 |
|||
} else { // 其他按钮 |
|||
console.log('其他按钮', item) |
|||
} |
|||
} |
|||
|
|||
// 列表-操作按钮 |
|||
const butttondata = [ |
|||
defaultButtons.mainListEditBtn({hasPermi:'mes:hrPersonAbility:update'}), // 编辑 |
|||
defaultButtons.mainListDeleteBtn({hasPermi:'mes:hrPersonAbility:delete'}), // 删除 |
|||
] |
|||
|
|||
// 列表-操作按钮事件 |
|||
const buttonTableClick = async (val, row) => { |
|||
if (val == 'edit') { // 编辑 |
|||
openForm('update', row) |
|||
} else if (val == 'delete') { // 删除 |
|||
handleDelete(row.id) |
|||
} |
|||
} |
|||
|
|||
/** 添加/修改操作 */ |
|||
const basicFormRef = ref() |
|||
const openForm = (type: string, row?: any) => { |
|||
if(type == "update"){ |
|||
HrPersonAbility.allSchemas.formSchema.forEach((item) => { |
|||
if (item.field == 'personCode') { |
|||
item.componentProps.disabled = true |
|||
} |
|||
}) |
|||
}else{ |
|||
HrPersonAbility.allSchemas.formSchema.forEach((item) => { |
|||
if (item.field == 'personCode') { |
|||
item.componentProps.disabled = false |
|||
} |
|||
}) |
|||
} |
|||
basicFormRef.value.open(type, row) |
|||
} |
|||
|
|||
// form表单提交 |
|||
const formsSuccess = async (formType,data) => { |
|||
var isHave =HrPersonAbility.allSchemas.formSchema.some(function (item) { |
|||
return item.field === 'activeTime' || item.field === 'expireTime'; |
|||
}); |
|||
if(isHave){ |
|||
if(data.activeTime && data.expireTime && data.activeTime >=data.expireTime){ |
|||
message.error('失效时间要大于生效时间') |
|||
return; |
|||
} |
|||
} |
|||
if(data.activeTime==0)data.activeTime = null; |
|||
if(data.expireTime==0)data.expireTime = null; |
|||
if (formType === 'create') { |
|||
await HrPersonAbilityApi.createHrPersonAbility(data) |
|||
message.success(t('common.createSuccess')) |
|||
} else { |
|||
await HrPersonAbilityApi.updateHrPersonAbility(data) |
|||
message.success(t('common.updateSuccess')) |
|||
} |
|||
basicFormRef.value.dialogVisible = false |
|||
getList() |
|||
} |
|||
|
|||
/** 详情操作 */ |
|||
const detailRef = ref() |
|||
const openDetail = (row: any, titleName: any, titleValue: any) => { |
|||
detailRef.value.openDetail(row, titleName, titleValue, 'basicHrPersonAbility') |
|||
} |
|||
|
|||
/** 删除按钮操作 */ |
|||
const handleDelete = async (id: number) => { |
|||
try { |
|||
// 删除的二次确认 |
|||
await message.delConfirm() |
|||
// 发起删除 |
|||
await HrPersonAbilityApi.deleteHrPersonAbility(id) |
|||
message.success(t('common.delSuccess')) |
|||
// 刷新列表 |
|||
await getList() |
|||
} catch {} |
|||
} |
|||
|
|||
/** 导出按钮操作 */ |
|||
const exportLoading = ref(false) // 导出的加载中 |
|||
const handleExport = async () => { |
|||
try { |
|||
// 导出的二次确认 |
|||
await message.exportConfirm() |
|||
// 发起导出 |
|||
exportLoading.value = true |
|||
const data = await HrPersonAbilityApi.exportHrPersonAbility(tableObject.params) |
|||
download.excel(data, '人员能力矩阵配置.xlsx') |
|||
} catch { |
|||
} finally { |
|||
exportLoading.value = false |
|||
} |
|||
} |
|||
|
|||
/** 导入 */ |
|||
const importFormRef = ref() |
|||
const handleImport = () => { |
|||
importFormRef.value.open() |
|||
} |
|||
// 导入附件弹窗所需的参数 |
|||
const importTemplateData = reactive({ |
|||
templateUrl: '', |
|||
templateTitle: '人员能力矩阵配置导入模版.xlsx' |
|||
}) |
|||
// 导入成功之后 |
|||
const importSuccess = () => { |
|||
getList() |
|||
} |
|||
|
|||
// 筛选提交 |
|||
const searchFormClick = (searchData) => { |
|||
tableObject.params = { |
|||
isSearch: true, |
|||
filters: searchData.filters |
|||
} |
|||
getList() // 刷新当前列表 |
|||
} |
|||
|
|||
/** 初始化 **/ |
|||
onMounted(async () => { |
|||
getList() |
|||
importTemplateData.templateUrl = await HrPersonAbilityApi.importTemplate() |
|||
}) |
|||
|
|||
</script> |
@ -0,0 +1,244 @@ |
|||
<template> |
|||
<ContentWrap> |
|||
<!-- 搜索工作栏 --> |
|||
<Search :schema="OperstepsType.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" /> |
|||
</ContentWrap> |
|||
|
|||
<!-- 列表头部 --> |
|||
<TableHead |
|||
:HeadButttondata="HeadButttondata" |
|||
@button-base-click="buttonBaseClick" |
|||
:routeName="routeName" |
|||
@updataTableColumns="updataTableColumns" |
|||
@searchFormClick="searchFormClick" |
|||
:allSchemas="OperstepsType.allSchemas" |
|||
/> |
|||
|
|||
<!-- 列表 --> |
|||
<ContentWrap> |
|||
<Table |
|||
:columns="tableColumns" |
|||
:data="tableObject.tableList" |
|||
:loading="tableObject.loading" |
|||
:pagination="{ |
|||
total: tableObject.total |
|||
}" |
|||
v-model:pageSize="tableObject.pageSize" |
|||
v-model:currentPage="tableObject.currentPage" |
|||
v-model:sort="tableObject.sort" |
|||
> |
|||
<template #collectCode="{row}"> |
|||
<el-button type="primary" link @click="openDetail(row, '代码', row.collectCode)"> |
|||
<span>{{ row.collectCode }}</span> |
|||
</el-button> |
|||
</template> |
|||
<template #action="{ row }"> |
|||
<ButtonBase :Butttondata="butttondata" @button-base-click="buttonTableClick($event,row)" /> |
|||
</template> |
|||
</Table> |
|||
</ContentWrap> |
|||
|
|||
<!-- 表单弹窗:添加/修改 --> |
|||
<BasicForm |
|||
ref="basicFormRef" |
|||
@success="formsSuccess" |
|||
:rules="OperstepsTypeRules" |
|||
:formAllSchemas="OperstepsType.allSchemas" |
|||
:apiUpdate="OperstepsTypeApi.updateOperstepsType" |
|||
:apiCreate="OperstepsTypeApi.createOperstepsType" |
|||
@searchTableSuccess="searchTableSuccess" |
|||
:isBusiness="false" |
|||
/> |
|||
|
|||
<!-- 详情 --> |
|||
<Detail ref="detailRef" :isBasic="true" :allSchemas="OperstepsType.allSchemas" /> |
|||
|
|||
<!-- 导入 --> |
|||
<ImportForm ref="importFormRef" url="/mes/opersteps-type/import" :importTemplateData="importTemplateData" @success="importSuccess" /> |
|||
</template> |
|||
|
|||
<script setup lang="ts"> |
|||
import download from '@/utils/download' |
|||
import { OperstepsType,OperstepsTypeRules } from './operstepsType.data' |
|||
import * as OperstepsTypeApi from '@/api/mes/operstepsType' |
|||
import * as defaultButtons from '@/utils/disposition/defaultButtons' |
|||
import TableHead from '@/components/TableHead/src/TableHead.vue' |
|||
import ImportForm from '@/components/ImportForm/src/ImportForm.vue' |
|||
import Detail from '@/components/Detail/src/Detail.vue' |
|||
|
|||
defineOptions({ name: 'OperstepsType' }) |
|||
|
|||
const message = useMessage() // 消息弹窗 |
|||
const { t } = useI18n() // 国际化 |
|||
|
|||
const route = useRoute() // 路由信息 |
|||
const routeName = ref() |
|||
routeName.value = route.name |
|||
const tableColumns = ref(OperstepsType.allSchemas.tableColumns) |
|||
|
|||
// 查询页面返回 |
|||
const searchTableSuccess = (formField, searchField, val, formRef) => { |
|||
nextTick(() => { |
|||
const setV = {} |
|||
setV[formField] = val[0][searchField] |
|||
formRef.setValues(setV) |
|||
}) |
|||
} |
|||
|
|||
// 字段设置 更新主列表字段 |
|||
const updataTableColumns = (val) => { |
|||
tableColumns.value = val |
|||
} |
|||
|
|||
const { tableObject, tableMethods } = useTable({ |
|||
getListApi: OperstepsTypeApi.getOperstepsTypePage // 分页接口 |
|||
}) |
|||
|
|||
// 获得表格的各种操作 |
|||
const { getList, setSearchParams } = tableMethods |
|||
|
|||
// 列表头部按钮 |
|||
const HeadButttondata = [ |
|||
defaultButtons.defaultAddBtn({hasPermi:'mes:operstepsType:create'}), // 新增 |
|||
defaultButtons.defaultImportBtn({hasPermi:'mes:operstepsType:import'}), // 导入 |
|||
defaultButtons.defaultExportBtn({hasPermi:'mes:operstepsType:export'}), // 导出 |
|||
defaultButtons.defaultFreshBtn(null), // 刷新 |
|||
defaultButtons.defaultFilterBtn(null), // 筛选 |
|||
defaultButtons.defaultSetBtn(null), // 设置 |
|||
// { |
|||
// label: '自定义扩展按钮', |
|||
// name: 'zdy', |
|||
// hide: false, |
|||
// type: 'primary', |
|||
// icon: 'Select', |
|||
// color: '' |
|||
// }, |
|||
] |
|||
|
|||
// 头部按钮事件 |
|||
const buttonBaseClick = (val, item) => { |
|||
if (val == 'add') { // 新增 |
|||
openForm('create') |
|||
} else if (val == 'import') { // 导入 |
|||
handleImport() |
|||
} else if (val == 'export') { // 导出 |
|||
handleExport() |
|||
} else if (val == 'refresh') { // 刷新 |
|||
getList() |
|||
} else if (val == 'filtrate') { // 筛选 |
|||
} else { // 其他按钮 |
|||
console.log('其他按钮', item) |
|||
} |
|||
} |
|||
|
|||
// 列表-操作按钮 |
|||
const butttondata = [ |
|||
defaultButtons.mainListEditBtn({hasPermi:'mes:operstepsType:update'}), // 编辑 |
|||
defaultButtons.mainListDeleteBtn({hasPermi:'mes:operstepsType:delete'}), // 删除 |
|||
] |
|||
|
|||
// 列表-操作按钮事件 |
|||
const buttonTableClick = async (val, row) => { |
|||
if (val == 'edit') { // 编辑 |
|||
openForm('update', row) |
|||
} else if (val == 'delete') { // 删除 |
|||
handleDelete(row.id) |
|||
} |
|||
} |
|||
|
|||
/** 添加/修改操作 */ |
|||
const basicFormRef = ref() |
|||
const openForm = (type: string, row?: any) => { |
|||
basicFormRef.value.open(type, row) |
|||
} |
|||
|
|||
// form表单提交 |
|||
const formsSuccess = async (formType,data) => { |
|||
var isHave =OperstepsType.allSchemas.formSchema.some(function (item) { |
|||
return item.field === 'activeTime' || item.field === 'expireTime'; |
|||
}); |
|||
if(isHave){ |
|||
if(data.activeTime && data.expireTime && data.activeTime >=data.expireTime){ |
|||
message.error('失效时间要大于生效时间') |
|||
return; |
|||
} |
|||
} |
|||
if(data.activeTime==0)data.activeTime = null; |
|||
if(data.expireTime==0)data.expireTime = null; |
|||
if (formType === 'create') { |
|||
await OperstepsTypeApi.createOperstepsType(data) |
|||
message.success(t('common.createSuccess')) |
|||
} else { |
|||
await OperstepsTypeApi.updateOperstepsType(data) |
|||
message.success(t('common.updateSuccess')) |
|||
} |
|||
basicFormRef.value.dialogVisible = false |
|||
getList() |
|||
} |
|||
|
|||
/** 详情操作 */ |
|||
const detailRef = ref() |
|||
const openDetail = (row: any, titleName: any, titleValue: any) => { |
|||
detailRef.value.openDetail(row, titleName, titleValue, 'basicOperstepsType') |
|||
} |
|||
|
|||
/** 删除按钮操作 */ |
|||
const handleDelete = async (id: number) => { |
|||
try { |
|||
// 删除的二次确认 |
|||
await message.delConfirm() |
|||
// 发起删除 |
|||
await OperstepsTypeApi.deleteOperstepsType(id) |
|||
message.success(t('common.delSuccess')) |
|||
// 刷新列表 |
|||
await getList() |
|||
} catch {} |
|||
} |
|||
|
|||
/** 导出按钮操作 */ |
|||
const exportLoading = ref(false) // 导出的加载中 |
|||
const handleExport = async () => { |
|||
try { |
|||
// 导出的二次确认 |
|||
await message.exportConfirm() |
|||
// 发起导出 |
|||
exportLoading.value = true |
|||
const data = await OperstepsTypeApi.exportOperstepsType(tableObject.params) |
|||
download.excel(data, '操作步骤类型配置.xlsx') |
|||
} catch { |
|||
} finally { |
|||
exportLoading.value = false |
|||
} |
|||
} |
|||
|
|||
/** 导入 */ |
|||
const importFormRef = ref() |
|||
const handleImport = () => { |
|||
importFormRef.value.open() |
|||
} |
|||
// 导入附件弹窗所需的参数 |
|||
const importTemplateData = reactive({ |
|||
templateUrl: '', |
|||
templateTitle: '操作步骤类型配置导入模版.xlsx' |
|||
}) |
|||
// 导入成功之后 |
|||
const importSuccess = () => { |
|||
getList() |
|||
} |
|||
|
|||
// 筛选提交 |
|||
const searchFormClick = (searchData) => { |
|||
tableObject.params = { |
|||
isSearch: true, |
|||
filters: searchData.filters |
|||
} |
|||
getList() // 刷新当前列表 |
|||
} |
|||
|
|||
/** 初始化 **/ |
|||
onMounted(async () => { |
|||
getList() |
|||
importTemplateData.templateUrl = await OperstepsTypeApi.importTemplate() |
|||
}) |
|||
|
|||
</script> |
@ -0,0 +1,167 @@ |
|||
import type { CrudSchema } from '@/hooks/web/useCrudSchemas' |
|||
import { dateFormatter } from '@/utils/formatTime' |
|||
|
|||
// 表单校验
|
|||
export const OperstepsTypeRules = reactive({ |
|||
collectCode: [required], |
|||
collectName: [required], |
|||
collectType: [required], |
|||
adpaterClass: [required], |
|||
argLsit: [required], |
|||
}) |
|||
|
|||
export const OperstepsType = useCrudSchemas(reactive<CrudSchema[]>([ |
|||
{ |
|||
label: '类型编码', |
|||
field: 'collectCode', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
}, |
|||
{ |
|||
label: '类型名称', |
|||
field: 'collectName', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
}, |
|||
{ |
|||
label: '采集方式', |
|||
field: 'collectType', |
|||
sort: 'custom', |
|||
dictType: DICT_TYPE.OPERSTEP_COLLECT_TYPE, |
|||
dictClass: 'string', |
|||
isSearch: true, |
|||
}, |
|||
{ |
|||
label: '适配器类名称', |
|||
field: 'adpaterClass', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
}, |
|||
{ |
|||
label: '参数列表', |
|||
field: 'argLsit', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
}, |
|||
{ |
|||
label: '删除时间', |
|||
field: 'deleteTime', |
|||
sort: 'custom', |
|||
formatter: dateFormatter, |
|||
isSearch: false, |
|||
isTable: false, |
|||
isForm:false, |
|||
isDetail:false, |
|||
search: { |
|||
component: 'DatePicker', |
|||
componentProps: { |
|||
valueFormat: 'YYYY-MM-DD HH:mm:ss', |
|||
type: 'daterange', |
|||
defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')] |
|||
} |
|||
}, |
|||
form: { |
|||
component: 'DatePicker', |
|||
componentProps: { |
|||
type: 'datetime', |
|||
valueFormat: 'x' |
|||
} |
|||
}, |
|||
}, |
|||
{ |
|||
label: '主键', |
|||
field: 'id', |
|||
sort: 'custom', |
|||
isForm: false, |
|||
isTable: false, |
|||
isDetail:false |
|||
}, |
|||
{ |
|||
label: '并发乐观锁', |
|||
field: 'concurrencyStamp', |
|||
sort: 'custom', |
|||
isSearch: false, |
|||
isTable: false, |
|||
isForm:false, |
|||
isDetail:false, |
|||
form: { |
|||
component: 'InputNumber', |
|||
value: 0 |
|||
}, |
|||
}, |
|||
|
|||
{ |
|||
label: '创建时间', |
|||
field: 'createTime', |
|||
sort: 'custom', |
|||
formatter: dateFormatter, |
|||
isSearch: false, |
|||
isTable: false, |
|||
isDetail:false, |
|||
search: { |
|||
component: 'DatePicker', |
|||
componentProps: { |
|||
valueFormat: 'YYYY-MM-DD HH:mm:ss', |
|||
type: 'daterange', |
|||
defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')] |
|||
} |
|||
}, |
|||
isForm: false, |
|||
}, |
|||
{ |
|||
label: '删除用户名', |
|||
field: 'deleter', |
|||
sort: 'custom', |
|||
isSearch: false, |
|||
isTable: false, |
|||
isForm: false, |
|||
isDetail:false, |
|||
}, |
|||
{ |
|||
label: '位置ID', |
|||
field: 'siteId', |
|||
sort: 'custom', |
|||
isSearch: false, |
|||
isTable: false, |
|||
isForm: false, |
|||
isDetail:false, |
|||
form: { |
|||
component: 'InputNumber', |
|||
value: 0 |
|||
}, |
|||
}, |
|||
{ |
|||
label: '状态', |
|||
field: 'status', |
|||
sort: 'custom', |
|||
dictType: DICT_TYPE.QUALIFY_STATUS, |
|||
dictClass: 'string', |
|||
isForm: true, |
|||
isSearch: true, |
|||
isTable: true, |
|||
form: { |
|||
component: 'Switch', |
|||
value: '2', |
|||
componentProps: { |
|||
inactiveValue: '2', |
|||
activeValue: '1' |
|||
} |
|||
}, |
|||
}, |
|||
{ |
|||
label: '备注', |
|||
field: 'remark', |
|||
sort: 'custom', |
|||
isSearch: false, |
|||
isTable: false |
|||
}, |
|||
{ |
|||
label: '操作', |
|||
field: 'action', |
|||
isForm: false, |
|||
table: { |
|||
width: 150, |
|||
fixed: 'right' |
|||
} |
|||
} |
|||
])) |
@ -0,0 +1,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="/qms/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/qms/qualityform' |
|||
import * as defaultButtons from '@/utils/disposition/defaultButtons' |
|||
import * as QualityformDetailApi from '@/api/qms/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:'qms:qualityform:create'}), // 新增 |
|||
defaultButtons.defaultImportBtn({hasPermi:'qms:qualityform:import'}), // 导入 |
|||
defaultButtons.defaultExportBtn({hasPermi:'qms: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:'qms:qualityform:update'}), // 编辑 |
|||
defaultButtons.mainListDeleteBtn({hasPermi:'qms:qualityform:delete'}), // 删除 |
|||
] |
|||
|
|||
// 列表-操作按钮事件 |
|||
const buttonTableClick = async (val, row) => { |
|||
if (val == 'edit') { // 编辑 |
|||
openForm('update', row) |
|||
} else if (val == 'delete') { // 删除 |
|||
handleDelete(row.id) |
|||
} |
|||
} |
|||
const handleDeleteDetail = async()=>{ |
|||
getList() |
|||
|
|||
} |
|||
let count = ref(0) |
|||
const handleCreateDetail = async()=>{ |
|||
count.value++ |
|||
getList() |
|||
|
|||
} |
|||
/** 添加/修改操作 */ |
|||
const basicFormRef = ref() |
|||
const openForm = (type: string, row?: any) => { |
|||
basicFormRef.value.open(type, row) |
|||
} |
|||
|
|||
// form表单提交 |
|||
const formsSuccess = async (formType,data) => { |
|||
var isHave =Qualityform.allSchemas.formSchema.some(function (item) { |
|||
return item.field === 'activeTime' || item.field === 'expireTime'; |
|||
}); |
|||
if(isHave){ |
|||
if(data.activeTime && data.expireTime && data.activeTime >=data.expireTime){ |
|||
message.error('失效时间要大于生效时间') |
|||
return; |
|||
} |
|||
} |
|||
if(data.activeTime==0)data.activeTime = null; |
|||
if(data.expireTime==0)data.expireTime = null; |
|||
if (formType === 'create') { |
|||
await QualityformApi.createQualityform(data) |
|||
message.success(t('common.createSuccess')) |
|||
} else { |
|||
await QualityformApi.updateQualityform(data) |
|||
message.success(t('common.updateSuccess')) |
|||
} |
|||
basicFormRef.value.dialogVisible = false |
|||
getList() |
|||
} |
|||
|
|||
/** 详情操作 */ |
|||
const detailRef = ref() |
|||
const openDetail = (row: any, titleName: any, titleValue: any) => { |
|||
detailRef.value.openDetail(row, titleName, titleValue, 'basicQualityform') |
|||
} |
|||
|
|||
/** 删除按钮操作 */ |
|||
const handleDelete = async (id: number) => { |
|||
try { |
|||
// 删除的二次确认 |
|||
await message.delConfirm() |
|||
// 发起删除 |
|||
await QualityformApi.deleteQualityform(id) |
|||
message.success(t('common.delSuccess')) |
|||
// 刷新列表 |
|||
await getList() |
|||
} catch {} |
|||
} |
|||
|
|||
/** 导出按钮操作 */ |
|||
const exportLoading = ref(false) // 导出的加载中 |
|||
const handleExport = async () => { |
|||
try { |
|||
// 导出的二次确认 |
|||
await message.exportConfirm() |
|||
// 发起导出 |
|||
exportLoading.value = true |
|||
const data = await QualityformApi.exportQualityform(tableObject.params) |
|||
download.excel(data, '质检表单.xlsx') |
|||
} catch { |
|||
} finally { |
|||
exportLoading.value = false |
|||
} |
|||
} |
|||
|
|||
|
|||
/** 导入 */ |
|||
const importFormRef = ref() |
|||
const handleImport = () => { |
|||
importFormRef.value.open() |
|||
} |
|||
// 导入附件弹窗所需的参数 |
|||
const importTemplateData = reactive({ |
|||
templateUrl: '', |
|||
templateTitle: '质检表单导入模版.xlsx' |
|||
}) |
|||
// 导入成功之后 |
|||
const importSuccess = () => { |
|||
getList() |
|||
} |
|||
|
|||
// 筛选提交 |
|||
const searchFormClick = (searchData) => { |
|||
tableObject.params = { |
|||
isSearch: true, |
|||
filters: searchData.filters |
|||
} |
|||
getList() // 刷新当前列表 |
|||
} |
|||
|
|||
/** 初始化 **/ |
|||
onMounted(async () => { |
|||
getList() |
|||
importTemplateData.templateUrl = await QualityformApi.importTemplate() |
|||
}) |
|||
|
|||
</script> |
@ -0,0 +1,316 @@ |
|||
import type { CrudSchema } from '@/hooks/web/useCrudSchemas' |
|||
import { dateFormatter } from '@/utils/formatTime' |
|||
import * as ItemApi from '@/api/qms/item' |
|||
import { Item } from '../item/item.data' |
|||
import * as QualitygroupApi from '@/api/qms/qualitygroup' |
|||
import { Qualitygroup } from '../qualitygroup/qualitygroup.data' |
|||
import { Detail } from '@/components/Detail' |
|||
|
|||
// 表单校验
|
|||
export const QualityformRules = reactive({ |
|||
formName: [required], |
|||
}) |
|||
|
|||
export const Qualityform = useCrudSchemas(reactive<CrudSchema[]>([ |
|||
{ |
|||
label: '删除时间', |
|||
field: 'deleteTime', |
|||
sort: 'custom', |
|||
formatter: dateFormatter, |
|||
isSearch: false, |
|||
isTable: false, |
|||
isForm:false, |
|||
isDetail:false, |
|||
search: { |
|||
component: 'DatePicker', |
|||
componentProps: { |
|||
valueFormat: 'YYYY-MM-DD HH:mm:ss', |
|||
type: 'daterange', |
|||
defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')] |
|||
} |
|||
}, |
|||
form: { |
|||
component: 'DatePicker', |
|||
componentProps: { |
|||
type: 'datetime', |
|||
valueFormat: 'x' |
|||
} |
|||
}, |
|||
}, |
|||
{ |
|||
label: '主键', |
|||
field: 'id', |
|||
sort: 'custom', |
|||
isForm: false, |
|||
isTable: false, |
|||
isDetail:false |
|||
}, |
|||
|
|||
{ |
|||
label: '并发乐观锁', |
|||
field: 'concurrencyStamp', |
|||
sort: 'custom', |
|||
isSearch: false, |
|||
isTable: false, |
|||
isForm:false, |
|||
isDetail:false, |
|||
form: { |
|||
component: 'InputNumber', |
|||
value: 0 |
|||
}, |
|||
}, |
|||
{ |
|||
label: '创建时间', |
|||
field: 'createTime', |
|||
sort: 'custom', |
|||
formatter: dateFormatter, |
|||
isSearch: false, |
|||
isTable: false, |
|||
isDetail:false, |
|||
search: { |
|||
component: 'DatePicker', |
|||
componentProps: { |
|||
valueFormat: 'YYYY-MM-DD HH:mm:ss', |
|||
type: 'daterange', |
|||
defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')] |
|||
} |
|||
}, |
|||
isForm: false, |
|||
}, |
|||
{ |
|||
label: '删除用户名', |
|||
field: 'deleter', |
|||
sort: 'custom', |
|||
isSearch: false, |
|||
isTable: false, |
|||
isForm: false, |
|||
isDetail:false |
|||
}, |
|||
{ |
|||
label: '位置ID', |
|||
field: 'siteId', |
|||
sort: 'custom', |
|||
isSearch: false, |
|||
isTable: false, |
|||
isForm: false, |
|||
isDetail:false, |
|||
form: { |
|||
component: 'InputNumber', |
|||
value: 0 |
|||
}, |
|||
}, |
|||
{ |
|||
label: '表单编号', |
|||
field: 'formNo', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
isForm: false, |
|||
isDetail: true |
|||
}, |
|||
{ |
|||
label: '表单名称', |
|||
field: 'formName', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
}, |
|||
{ |
|||
label: '表单类别', |
|||
field: 'formType', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
|
|||
}, |
|||
{ |
|||
label: '质检项目编码', |
|||
field: 'itemCode', |
|||
sort: 'custom', |
|||
isDetail: true, |
|||
form: { |
|||
componentProps: { |
|||
isSearchList: true, // 开启查询弹窗
|
|||
searchTitle: '质检项目信息', // 查询弹窗标题
|
|||
searchAllSchemas: Item.allSchemas, // 查询弹窗所需类
|
|||
searchField: 'itemCode', // 查询弹窗赋值字段
|
|||
searchPage: ItemApi.getItemPage, // 查询弹窗所需分页方法
|
|||
multiple:true, |
|||
searchCondition: [{ |
|||
key: 'status', |
|||
value: '1', |
|||
action: '==', |
|||
isSearch: true, |
|||
isMainValue: false |
|||
}] |
|||
} |
|||
} |
|||
}, |
|||
{ |
|||
label: '是否可用', |
|||
field: 'status', |
|||
sort: 'custom', |
|||
dictType: DICT_TYPE.QUALIFY_STATUS, |
|||
dictClass: 'string', |
|||
isSearch: true, |
|||
isTable: true, |
|||
isForm: true, |
|||
form: { |
|||
component: 'Switch', |
|||
value: '2', |
|||
componentProps: { |
|||
inactiveValue: '2', |
|||
activeValue: '1' |
|||
} |
|||
}, |
|||
}, |
|||
{ |
|||
label: '备注', |
|||
field: 'remark', |
|||
sort: 'custom', |
|||
isSearch: false, |
|||
isTable: false, |
|||
}, |
|||
{ |
|||
label: '操作', |
|||
field: 'action', |
|||
isForm: false, |
|||
table: { |
|||
width: 150, |
|||
fixed: 'right' |
|||
} |
|||
} |
|||
])) |
|||
|
|||
|
|||
export const QualityformDetail = useCrudSchemas(reactive<CrudSchema[]>([ |
|||
{ |
|||
label: '表单编号', |
|||
field: 'formNo', |
|||
sort: 'custom', |
|||
isSearch: false, |
|||
isForm: false, |
|||
isDetail: false, |
|||
form: { |
|||
componentProps:{ |
|||
disabled:true |
|||
} |
|||
} |
|||
}, |
|||
{ |
|||
label: '项目编码', |
|||
field: 'itemCode', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
isForm: true, |
|||
isDetail: true, |
|||
form: { |
|||
componentProps: { |
|||
isSearchList: true, // 开启查询弹窗
|
|||
searchTitle: '质检项目信息', // 查询弹窗标题
|
|||
searchAllSchemas: Item.allSchemas, // 查询弹窗所需类
|
|||
searchField: 'itemCode', // 查询弹窗赋值字段
|
|||
searchPage: ItemApi.getItemPage, // 查询弹窗所需分页方法
|
|||
multiple:true, |
|||
searchCondition: [{ |
|||
key: 'status', |
|||
value: '1', |
|||
action: '==' |
|||
}] |
|||
// searchCondition: [{
|
|||
// key:'formNo', // 查询列表中字段
|
|||
// value:'formNo', // 指主表某字段
|
|||
// //message: '请选择生产线信息!', // 当前置条件为空时 弹出信息提示
|
|||
// isMainValue: true // 表示查询条件是主表的字段的值
|
|||
// },
|
|||
// {
|
|||
// key:'status', // 查询列表中字段
|
|||
// value:'1', // 指查询具体值
|
|||
// isMainValue: false // 表示查询条件不是主表的字段的值
|
|||
// }
|
|||
// ]
|
|||
} |
|||
} |
|||
}, |
|||
{ |
|||
label: '项目名称', |
|||
field: 'itemName', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
isForm: false, |
|||
}, |
|||
{ |
|||
label: '类别编码', |
|||
field: 'itemType', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
isForm: false, |
|||
}, |
|||
{ |
|||
label: '质检科目编码', |
|||
field: 'qmsClass', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
isForm: false, |
|||
}, |
|||
{ |
|||
label: '数据类型', |
|||
field: 'dataType', |
|||
sort: 'custom', |
|||
dictType: DICT_TYPE.QUALIFY_ITEM_DATA_TYPE, |
|||
dictClass: 'string', |
|||
isSearch: true, |
|||
isForm: false, |
|||
}, |
|||
{ |
|||
label: '校验方式', |
|||
field: 'dataVerify', |
|||
sort: 'custom', |
|||
dictType: DICT_TYPE.QUALIFY_ITEM_VERIFY_MODE, |
|||
dictClass: 'string', |
|||
isSearch: true, |
|||
isForm: false, |
|||
}, |
|||
{ |
|||
label: '数据参考值', |
|||
field: 'dataStandvalue', |
|||
sort: 'custom', |
|||
isSearch: false, |
|||
isForm: false, |
|||
}, |
|||
{ |
|||
label: '数据录入说明', |
|||
field: 'dataDescripe', |
|||
sort: 'custom', |
|||
isSearch: false, |
|||
isForm: false, |
|||
}, |
|||
{ |
|||
label: '操作', |
|||
field: 'action', |
|||
isForm: false, |
|||
table: { |
|||
width: 150, |
|||
fixed: 'right' |
|||
} |
|||
}, |
|||
{ |
|||
label: '是否可用', |
|||
field: 'status', |
|||
sort: 'custom', |
|||
dictType: DICT_TYPE.QUALIFY_STATUS, |
|||
dictClass: 'string', |
|||
isSearch: true, |
|||
isTable: true, |
|||
isForm: false, |
|||
}, |
|||
{ |
|||
label: '备注', |
|||
field: 'remark', |
|||
sort: 'custom', |
|||
isSearch: false, |
|||
isTable: true, |
|||
isForm: false, |
|||
} |
|||
])) |
|||
|
|||
export const QualityformDetailRules = reactive({ |
|||
itemCode: [required] |
|||
}) |
@ -0,0 +1,244 @@ |
|||
<template> |
|||
<ContentWrap> |
|||
<!-- 搜索工作栏 --> |
|||
<Search :schema="Qualityformlog.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" /> |
|||
</ContentWrap> |
|||
|
|||
<!-- 列表头部 --> |
|||
<TableHead |
|||
:HeadButttondata="HeadButttondata" |
|||
@button-base-click="buttonBaseClick" |
|||
:routeName="routeName" |
|||
@updataTableColumns="updataTableColumns" |
|||
@searchFormClick="searchFormClick" |
|||
:allSchemas="Qualityformlog.allSchemas" |
|||
/> |
|||
|
|||
<!-- 列表 --> |
|||
<ContentWrap> |
|||
<Table |
|||
:columns="tableColumns" |
|||
:data="tableObject.tableList" |
|||
:loading="tableObject.loading" |
|||
:pagination="{ |
|||
total: tableObject.total |
|||
}" |
|||
v-model:pageSize="tableObject.pageSize" |
|||
v-model:currentPage="tableObject.currentPage" |
|||
v-model:sort="tableObject.sort" |
|||
> |
|||
<template #code="{row}"> |
|||
<el-button type="primary" link @click="openDetail(row, '代码', row.code)"> |
|||
<span>{{ row.code }}</span> |
|||
</el-button> |
|||
</template> |
|||
<template #action="{ row }"> |
|||
<ButtonBase :Butttondata="butttondata" @button-base-click="buttonTableClick($event,row)" /> |
|||
</template> |
|||
</Table> |
|||
</ContentWrap> |
|||
|
|||
<!-- 表单弹窗:添加/修改 --> |
|||
<BasicForm |
|||
ref="basicFormRef" |
|||
@success="formsSuccess" |
|||
:rules="QualityformlogRules" |
|||
:formAllSchemas="Qualityformlog.allSchemas" |
|||
:apiUpdate="QualityformlogApi.updateQualityformlog" |
|||
:apiCreate="QualityformlogApi.createQualityformlog" |
|||
@searchTableSuccess="searchTableSuccess" |
|||
:isBusiness="false" |
|||
/> |
|||
|
|||
<!-- 详情 --> |
|||
<Detail ref="detailRef" :isBasic="true" :allSchemas="Qualityformlog.allSchemas" /> |
|||
|
|||
<!-- 导入 --> |
|||
<ImportForm ref="importFormRef" url="/qms/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/qms/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:'qms:qualityformlog:create'}), // 新增 |
|||
//defaultButtons.defaultImportBtn({hasPermi:'qms:qualityformlog:import'}), // 导入 |
|||
defaultButtons.defaultExportBtn({hasPermi:'qms: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:'qms:qualityformlog:update'}), // 编辑 |
|||
defaultButtons.mainListDeleteBtn({hasPermi:'qms:qualityformlog:delete'}), // 删除 |
|||
] |
|||
|
|||
// 列表-操作按钮事件 |
|||
const buttonTableClick = async (val, row) => { |
|||
if (val == 'edit') { // 编辑 |
|||
openForm('update', row) |
|||
} else if (val == 'delete') { // 删除 |
|||
handleDelete(row.id) |
|||
} |
|||
} |
|||
|
|||
/** 添加/修改操作 */ |
|||
const basicFormRef = ref() |
|||
const openForm = (type: string, row?: any) => { |
|||
basicFormRef.value.open(type, row) |
|||
} |
|||
|
|||
// form表单提交 |
|||
const formsSuccess = async (formType,data) => { |
|||
var isHave =Qualityformlog.allSchemas.formSchema.some(function (item) { |
|||
return item.field === 'activeTime' || item.field === 'expireTime'; |
|||
}); |
|||
if(isHave){ |
|||
if(data.activeTime && data.expireTime && data.activeTime >=data.expireTime){ |
|||
message.error('失效时间要大于生效时间') |
|||
return; |
|||
} |
|||
} |
|||
if(data.activeTime==0)data.activeTime = null; |
|||
if(data.expireTime==0)data.expireTime = null; |
|||
if (formType === 'create') { |
|||
await QualityformlogApi.createQualityformlog(data) |
|||
message.success(t('common.createSuccess')) |
|||
} else { |
|||
await QualityformlogApi.updateQualityformlog(data) |
|||
message.success(t('common.updateSuccess')) |
|||
} |
|||
basicFormRef.value.dialogVisible = false |
|||
getList() |
|||
} |
|||
|
|||
/** 详情操作 */ |
|||
const detailRef = ref() |
|||
const openDetail = (row: any, titleName: any, titleValue: any) => { |
|||
detailRef.value.openDetail(row, titleName, titleValue, 'basicQualityformlog') |
|||
} |
|||
|
|||
/** 删除按钮操作 */ |
|||
const handleDelete = async (id: number) => { |
|||
try { |
|||
// 删除的二次确认 |
|||
await message.delConfirm() |
|||
// 发起删除 |
|||
await QualityformlogApi.deleteQualityformlog(id) |
|||
message.success(t('common.delSuccess')) |
|||
// 刷新列表 |
|||
await getList() |
|||
} catch {} |
|||
} |
|||
|
|||
/** 导出按钮操作 */ |
|||
const exportLoading = ref(false) // 导出的加载中 |
|||
const handleExport = async () => { |
|||
try { |
|||
// 导出的二次确认 |
|||
await message.exportConfirm() |
|||
// 发起导出 |
|||
exportLoading.value = true |
|||
const data = await QualityformlogApi.exportQualityformlog(tableObject.params) |
|||
download.excel(data, '质检表单日志.xlsx') |
|||
} catch { |
|||
} finally { |
|||
exportLoading.value = false |
|||
} |
|||
} |
|||
|
|||
/** 导入 */ |
|||
const importFormRef = ref() |
|||
const handleImport = () => { |
|||
importFormRef.value.open() |
|||
} |
|||
// 导入附件弹窗所需的参数 |
|||
const importTemplateData = reactive({ |
|||
templateUrl: '', |
|||
templateTitle: '质检表单日志导入模版.xlsx' |
|||
}) |
|||
// 导入成功之后 |
|||
const importSuccess = () => { |
|||
getList() |
|||
} |
|||
|
|||
// 筛选提交 |
|||
const searchFormClick = (searchData) => { |
|||
tableObject.params = { |
|||
isSearch: true, |
|||
filters: searchData.filters |
|||
} |
|||
getList() // 刷新当前列表 |
|||
} |
|||
|
|||
/** 初始化 **/ |
|||
onMounted(async () => { |
|||
getList() |
|||
importTemplateData.templateUrl = await QualityformlogApi.importTemplate() |
|||
}) |
|||
|
|||
</script> |
@ -0,0 +1,194 @@ |
|||
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: true, |
|||
form: { |
|||
component: 'InputNumber', |
|||
value: 0 |
|||
}, |
|||
}, |
|||
{ |
|||
label: '表单编号', |
|||
field: 'formNo', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
}, |
|||
{ |
|||
label: '操作类型', |
|||
field: 'operation', |
|||
sort: 'custom', |
|||
dictType: DICT_TYPE.QUALIFY_FORM_OPERATION, |
|||
dictClass: 'string', |
|||
isSearch: true, |
|||
}, |
|||
{ |
|||
label: '操作人员', |
|||
field: 'operator', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
}, |
|||
{ |
|||
label: '操作内容', |
|||
field: 'operateContent', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
form: { |
|||
component: 'Editor', |
|||
componentProps: { |
|||
valueHtml: '', |
|||
height: 200 |
|||
} |
|||
}, |
|||
}, |
|||
{ |
|||
label: '操作时间', |
|||
field: 'operateTime', |
|||
sort: 'custom', |
|||
formatter: dateFormatter, |
|||
isSearch: true, |
|||
search: { |
|||
component: 'DatePicker', |
|||
componentProps: { |
|||
valueFormat: 'YYYY-MM-DD HH:mm:ss', |
|||
type: 'daterange', |
|||
defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')] |
|||
} |
|||
}, |
|||
form: { |
|||
component: 'DatePicker', |
|||
componentProps: { |
|||
type: 'datetime', |
|||
valueFormat: 'x' |
|||
} |
|||
}, |
|||
}, |
|||
{ |
|||
label: '操作', |
|||
field: 'action', |
|||
isSearch: false, |
|||
isTable: false, |
|||
isForm: false, |
|||
isDetail:false, |
|||
table: { |
|||
width: 150, |
|||
fixed: 'right' |
|||
} |
|||
} |
|||
])) |
@ -0,0 +1,244 @@ |
|||
<template> |
|||
<ContentWrap> |
|||
<!-- 搜索工作栏 --> |
|||
<Search :schema="Qualitygroup.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" /> |
|||
</ContentWrap> |
|||
|
|||
<!-- 列表头部 --> |
|||
<TableHead |
|||
:HeadButttondata="HeadButttondata" |
|||
@button-base-click="buttonBaseClick" |
|||
:routeName="routeName" |
|||
@updataTableColumns="updataTableColumns" |
|||
@searchFormClick="searchFormClick" |
|||
:allSchemas="Qualitygroup.allSchemas" |
|||
/> |
|||
|
|||
<!-- 列表 --> |
|||
<ContentWrap> |
|||
<Table |
|||
:columns="tableColumns" |
|||
:data="tableObject.tableList" |
|||
:loading="tableObject.loading" |
|||
:pagination="{ |
|||
total: tableObject.total |
|||
}" |
|||
v-model:pageSize="tableObject.pageSize" |
|||
v-model:currentPage="tableObject.currentPage" |
|||
v-model:sort="tableObject.sort" |
|||
> |
|||
<template #code="{row}"> |
|||
<el-button type="primary" link @click="openDetail(row, '代码', row.code)"> |
|||
<span>{{ row.code }}</span> |
|||
</el-button> |
|||
</template> |
|||
<template #action="{ row }"> |
|||
<ButtonBase :Butttondata="butttondata" @button-base-click="buttonTableClick($event,row)" /> |
|||
</template> |
|||
</Table> |
|||
</ContentWrap> |
|||
|
|||
<!-- 表单弹窗:添加/修改 --> |
|||
<BasicForm |
|||
ref="basicFormRef" |
|||
@success="formsSuccess" |
|||
:rules="QualitygroupRules" |
|||
:formAllSchemas="Qualitygroup.allSchemas" |
|||
:apiUpdate="QualitygroupApi.updateQualitygroup" |
|||
:apiCreate="QualitygroupApi.createQualitygroup" |
|||
@searchTableSuccess="searchTableSuccess" |
|||
:isBusiness="false" |
|||
/> |
|||
|
|||
<!-- 详情 --> |
|||
<Detail ref="detailRef" :isBasic="true" :allSchemas="Qualitygroup.allSchemas" /> |
|||
|
|||
<!-- 导入 --> |
|||
<ImportForm ref="importFormRef" url="/qms/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/qms/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:'qms:qualitygroup:create'}), // 新增 |
|||
defaultButtons.defaultImportBtn({hasPermi:'qms:qualitygroup:import'}), // 导入 |
|||
defaultButtons.defaultExportBtn({hasPermi:'qms: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:'qms:qualitygroup:update'}), // 编辑 |
|||
defaultButtons.mainListDeleteBtn({hasPermi:'qms:qualitygroup:delete'}), // 删除 |
|||
] |
|||
|
|||
// 列表-操作按钮事件 |
|||
const buttonTableClick = async (val, row) => { |
|||
if (val == 'edit') { // 编辑 |
|||
openForm('update', row) |
|||
} else if (val == 'delete') { // 删除 |
|||
handleDelete(row.id) |
|||
} |
|||
} |
|||
|
|||
/** 添加/修改操作 */ |
|||
const basicFormRef = ref() |
|||
const openForm = (type: string, row?: any) => { |
|||
basicFormRef.value.open(type, row) |
|||
} |
|||
|
|||
// form表单提交 |
|||
const formsSuccess = async (formType,data) => { |
|||
var isHave =Qualitygroup.allSchemas.formSchema.some(function (item) { |
|||
return item.field === 'activeTime' || item.field === 'expireTime'; |
|||
}); |
|||
if(isHave){ |
|||
if(data.activeTime && data.expireTime && data.activeTime >=data.expireTime){ |
|||
message.error('失效时间要大于生效时间') |
|||
return; |
|||
} |
|||
} |
|||
if(data.activeTime==0)data.activeTime = null; |
|||
if(data.expireTime==0)data.expireTime = null; |
|||
if (formType === 'create') { |
|||
await QualitygroupApi.createQualitygroup(data) |
|||
message.success(t('common.createSuccess')) |
|||
} else { |
|||
await QualitygroupApi.updateQualitygroup(data) |
|||
message.success(t('common.updateSuccess')) |
|||
} |
|||
basicFormRef.value.dialogVisible = false |
|||
getList() |
|||
} |
|||
|
|||
/** 详情操作 */ |
|||
const detailRef = ref() |
|||
const openDetail = (row: any, titleName: any, titleValue: any) => { |
|||
detailRef.value.openDetail(row, titleName, titleValue, 'basicQualitygroup') |
|||
} |
|||
|
|||
/** 删除按钮操作 */ |
|||
const handleDelete = async (id: number) => { |
|||
try { |
|||
// 删除的二次确认 |
|||
await message.delConfirm() |
|||
// 发起删除 |
|||
await QualitygroupApi.deleteQualitygroup(id) |
|||
message.success(t('common.delSuccess')) |
|||
// 刷新列表 |
|||
await getList() |
|||
} catch {} |
|||
} |
|||
|
|||
/** 导出按钮操作 */ |
|||
const exportLoading = ref(false) // 导出的加载中 |
|||
const handleExport = async () => { |
|||
try { |
|||
// 导出的二次确认 |
|||
await message.exportConfirm() |
|||
// 发起导出 |
|||
exportLoading.value = true |
|||
const data = await QualitygroupApi.exportQualitygroup(tableObject.params) |
|||
download.excel(data, '质检分组.xlsx') |
|||
} catch { |
|||
} finally { |
|||
exportLoading.value = false |
|||
} |
|||
} |
|||
|
|||
/** 导入 */ |
|||
const importFormRef = ref() |
|||
const handleImport = () => { |
|||
importFormRef.value.open() |
|||
} |
|||
// 导入附件弹窗所需的参数 |
|||
const importTemplateData = reactive({ |
|||
templateUrl: '', |
|||
templateTitle: '质检分组导入模版.xlsx' |
|||
}) |
|||
// 导入成功之后 |
|||
const importSuccess = () => { |
|||
getList() |
|||
} |
|||
|
|||
// 筛选提交 |
|||
const searchFormClick = (searchData) => { |
|||
tableObject.params = { |
|||
isSearch: true, |
|||
filters: searchData.filters |
|||
} |
|||
getList() // 刷新当前列表 |
|||
} |
|||
|
|||
/** 初始化 **/ |
|||
onMounted(async () => { |
|||
getList() |
|||
importTemplateData.templateUrl = await QualitygroupApi.importTemplate() |
|||
}) |
|||
|
|||
</script> |
@ -0,0 +1,151 @@ |
|||
import type { CrudSchema } from '@/hooks/web/useCrudSchemas' |
|||
import { dateFormatter } from '@/utils/formatTime' |
|||
|
|||
// 表单校验
|
|||
export const QualitygroupRules = reactive({ |
|||
concurrencyStamp: [required], |
|||
code: [required], |
|||
name: [required], |
|||
}) |
|||
|
|||
export const Qualitygroup = useCrudSchemas(reactive<CrudSchema[]>([ |
|||
{ |
|||
label: '删除时间', |
|||
field: 'deleteTime', |
|||
sort: 'custom', |
|||
formatter: dateFormatter, |
|||
isSearch: false, |
|||
isTable: false, |
|||
isForm:false, |
|||
isDetail:false, |
|||
search: { |
|||
component: 'DatePicker', |
|||
componentProps: { |
|||
valueFormat: 'YYYY-MM-DD HH:mm:ss', |
|||
type: 'daterange', |
|||
defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')] |
|||
} |
|||
}, |
|||
form: { |
|||
component: 'DatePicker', |
|||
componentProps: { |
|||
type: 'datetime', |
|||
valueFormat: 'x' |
|||
} |
|||
}, |
|||
}, |
|||
{ |
|||
label: '主键', |
|||
field: 'id', |
|||
sort: 'custom', |
|||
isForm: false, |
|||
isTable: false, |
|||
isDetail:false |
|||
}, |
|||
{ |
|||
label: '并发乐观锁', |
|||
field: 'concurrencyStamp', |
|||
sort: 'custom', |
|||
isSearch: false, |
|||
isTable: false, |
|||
isForm:false, |
|||
isDetail:false, |
|||
form: { |
|||
component: 'InputNumber', |
|||
value: 0 |
|||
}, |
|||
}, |
|||
{ |
|||
label: '创建时间', |
|||
field: 'createTime', |
|||
sort: 'custom', |
|||
formatter: dateFormatter, |
|||
isSearch: false, |
|||
isTable: false, |
|||
isDetail:false, |
|||
search: { |
|||
component: 'DatePicker', |
|||
componentProps: { |
|||
valueFormat: 'YYYY-MM-DD HH:mm:ss', |
|||
type: 'daterange', |
|||
defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')] |
|||
} |
|||
}, |
|||
isForm: false, |
|||
}, |
|||
{ |
|||
label: '删除用户名', |
|||
field: 'deleter', |
|||
sort: 'custom', |
|||
isSearch: false, |
|||
isTable: false, |
|||
isForm: false, |
|||
isDetail:false |
|||
}, |
|||
{ |
|||
label: '位置ID', |
|||
field: 'siteId', |
|||
sort: 'custom', |
|||
isSearch: false, |
|||
isTable: false, |
|||
isForm: false, |
|||
isDetail:false, |
|||
form: { |
|||
component: 'InputNumber', |
|||
value: 0 |
|||
}, |
|||
}, |
|||
{ |
|||
label: '编码', |
|||
field: 'code', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
}, |
|||
{ |
|||
label: '编码名称', |
|||
field: 'name', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
}, |
|||
{ |
|||
label: '分组类别', |
|||
field: 'groupCode', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
}, |
|||
{ |
|||
label: '状态', |
|||
field: 'status', |
|||
sort: 'custom', |
|||
dictType: DICT_TYPE.QUALIFY_STATUS, |
|||
dictClass: 'string', |
|||
isForm: true, |
|||
isSearch: true, |
|||
isTable: true, |
|||
form: { |
|||
component: 'Switch', |
|||
value: '2', |
|||
componentProps: { |
|||
inactiveValue: '2', |
|||
activeValue: '1' |
|||
} |
|||
}, |
|||
}, |
|||
{ |
|||
label: '操作', |
|||
field: 'action', |
|||
isForm: false, |
|||
isDetail:false, |
|||
table: { |
|||
width: 150, |
|||
fixed: 'right' |
|||
} |
|||
}, |
|||
{ |
|||
label: '备注', |
|||
field: 'remark', |
|||
sort: 'custom', |
|||
isSearch: false, |
|||
isTable: false |
|||
} |
|||
])) |
Loading…
Reference in new issue