Browse Source

丰富的

master
mahao 8 months ago
parent
commit
8826d28ef2
  1. 56
      src/api/mes/abilityInfo/index.ts
  2. 58
      src/api/mes/hrPersonAbility/index.ts
  3. 57
      src/api/mes/operstepsType/index.ts
  4. 1
      src/api/qms/item/index.ts
  5. 55
      src/api/qms/qualityform/index.ts
  6. 61
      src/api/qms/qualityformdetail/index.ts
  7. 58
      src/api/qms/qualityformlog/index.ts
  8. 55
      src/api/qms/qualitygroup/index.ts
  9. 15
      src/components/Detail/src/Detail.vue
  10. 2
      src/components/SearchTable/src/SearchTable.vue
  11. 8
      src/utils/dict.ts
  12. 172
      src/views/mes/abilityInfo/abilityInfo.data.ts
  13. 244
      src/views/mes/abilityInfo/index.vue
  14. 210
      src/views/mes/hrPersonAbility/hrPersonAbility.data.ts
  15. 257
      src/views/mes/hrPersonAbility/index.vue
  16. 244
      src/views/mes/operstepsType/index.vue
  17. 167
      src/views/mes/operstepsType/operstepsType.data.ts
  18. 115
      src/views/qms/item/index.vue
  19. 43
      src/views/qms/item/item.data.ts
  20. 6
      src/views/qms/qualityclass/qualityclass.data.ts
  21. 297
      src/views/qms/qualityform/index.vue
  22. 316
      src/views/qms/qualityform/qualityform.data.ts
  23. 244
      src/views/qms/qualityformlog/index.vue
  24. 194
      src/views/qms/qualityformlog/qualityformlog.data.ts
  25. 244
      src/views/qms/qualitygroup/index.vue
  26. 151
      src/views/qms/qualitygroup/qualitygroup.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' })
}

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

1
src/api/qms/item/index.ts

@ -20,6 +20,7 @@ export interface ItemVO {
// 查询质检项目定义列表
export const getItemPage = async (params) => {
console.log(params);
if (params.isSearch) {
delete params.isSearch
const data = {...params}

55
src/api/qms/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: '/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' })
}

61
src/api/qms/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: '/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' })
}

58
src/api/qms/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: '/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' })
}

55
src/api/qms/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: '/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' })
}

15
src/components/Detail/src/Detail.vue

@ -420,9 +420,7 @@ const openDetail = async (row: any, titleName: any, titleValue: any, tableName:
if (props.detailButtonIsShowAdd) {
//
detailButtonAdd = [
defaultButtons.defaultAddBtn({
hide: isShowMainButton(row, ['1'])
})
defaultButtons.defaultAddBtn(null)
]
}
HeadButttondata.value = [...detailButtonFilter,...detailButtonAdd]
@ -551,6 +549,8 @@ const openForm = async (type: string, row?: number) => {
}
// form
const submitForm = async (formType, data) => {
console.log(formType);
console.log(data);
try {
// detailValidate
const rs = (await props.detailValidate) ? await props.detailValidate(data) : true
@ -565,6 +565,9 @@ const submitForm = async (formType, data) => {
formRef.value.dialogVisible = false
//
await getList()
emit('handleCreateDetail')
updateKey.value += 1
} finally {
formRef.value.formLoading = false
@ -583,7 +586,9 @@ const emit = defineEmits([
'detailOpenForm',
'tableFormButton',
'openImage',
'detailBasicFormOnChange'
'detailBasicFormOnChange',
'handleDeleteDetail',
'handleCreateDetail'
])
/** 删除按钮操作 */
const handleDelete = async (id: number) => {
@ -597,6 +602,8 @@ const handleDelete = async (id: number) => {
message.success(t('common.delSuccess'))
//
await getList()
emit('handleDeleteDetail')
updateKey.value += 1
} catch {}
}

2
src/components/SearchTable/src/SearchTable.vue

@ -95,13 +95,13 @@ const open = (titleName: any, allSchemas: any,getApiPage: any, formField: any, s
getListRef.value = getList
getList()
}
//
const searchFormClick = (searchData) => {
// console.log(99, rowRef.value)
// console.log(100, searchData)
// console.log(101, searchConditionRef.value)
// 20240104 searchData.filters
console.log(888,searchConditionRef.value)
if (searchConditionRef.value) {
Object.keys(searchConditionRef.value).forEach(key => {
if (searchData.filters) {

8
src/utils/dict.ts

@ -279,6 +279,10 @@ export enum DICT_TYPE {
// ========== 业务 - QMS ==========
QUALIFY_STATUS = 'qualify_status'
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',//质检表单操作
// ========== 业务 - MES ==========
OPERSTEP_COLLECT_TYPE='operstep_collect_type',//操作步骤采集方式
}

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>

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

115
src/views/qms/item/index.vue

@ -27,9 +27,9 @@
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>
<template #itemCode="{row}">
<el-button type="primary" link @click="openDetail(row, '代码', row.itemCode)">
<span>{{ row.itemCode }}</span>
</el-button>
</template>
<template #action="{ row }">
@ -48,6 +48,7 @@
:apiCreate="ItemApi.createItem"
@searchTableSuccess="searchTableSuccess"
:isBusiness="false"
@onChange="onChangeQG"
/>
<!-- 详情 -->
@ -149,6 +150,69 @@ const buttonTableClick = async (val, row) => {
/** 添加/修改操作 */
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)
}
@ -235,6 +299,51 @@ const searchFormClick = (searchData) => {
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()

43
src/views/qms/item/item.data.ts

@ -1,9 +1,14 @@
import type { CrudSchema } from '@/hooks/web/useCrudSchemas'
import { dateFormatter } from '@/utils/formatTime'
import * as QualitygroupApi from '@/api/qms/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[]>([
@ -111,29 +116,42 @@ export const Item = useCrudSchemas(reactive<CrudSchema[]>([
field: 'itemType',
sort: 'custom',
isSearch: true,
form: {
component: 'SelectV2'
},
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,
form: {
component: 'SelectV2'
},
},
{
label: '校验方式',
field: 'dataVerify',
sort: 'custom',
dictType: DICT_TYPE.QUALIFY_ITEM_VERIFY_MODE,
dictClass: 'string',
isSearch: true,
},
{
@ -158,12 +176,21 @@ export const Item = useCrudSchemas(reactive<CrudSchema[]>([
}
},
{
label: '状态',
label: '是否可用',
field: 'status',
sort: 'custom',
dictType: DICT_TYPE.QUALIFY_STATUS,
dictClass: 'string',
isSearch: true,
isTable: true,
isForm: true,
form: {
component: 'Radio'
component: 'Switch',
value: '2',
componentProps: {
inactiveValue: '2',
activeValue: '1'
}
},
},
{

6
src/views/qms/qualityclass/qualityclass.data.ts

@ -124,10 +124,10 @@ export const Qualityclass = useCrudSchemas(reactive<CrudSchema[]>([
isTable: true,
form: {
component: 'Switch',
value: 'ENABLE',
value: '2',
componentProps: {
inactiveValue: 'DISABLE',
activeValue: 'ENABLE'
inactiveValue: '2',
activeValue: '1'
}
},
},

297
src/views/qms/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="/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>

316
src/views/qms/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/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]
})

244
src/views/qms/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="/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>

194
src/views/qms/qualityformlog/qualityformlog.data.ts

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

244
src/views/qms/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="/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>

151
src/views/qms/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
}
]))
Loading…
Cancel
Save