From 7511aabd38c12152d5b7764d52c2290ff13fd4fe Mon Sep 17 00:00:00 2001 From: songguoqiang <765017469@qq.com> Date: Thu, 16 Nov 2023 19:19:31 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E7=AE=A1=E7=90=86=E6=A8=A1?= =?UTF-8?q?=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/spc/itembasic/index.ts | 4 +- src/api/spc/project/index.ts | 56 ++ src/api/spc/typeitem/index.ts | 57 ++ src/components/BasicForm/src/BasicForm.vue | 18 +- src/hooks/web/useTable.ts | 3 + src/utils/dict.ts | 1 + src/views/spc/itembasic/index.vue | 48 +- src/views/spc/itembasic/itembasic.data.ts | 812 +++++++++++---------- src/views/spc/project/index.vue | 255 +++++++ src/views/spc/project/project.data.ts | 133 ++++ src/views/spc/typeitem/index.vue | 258 +++++++ src/views/spc/typeitem/typeItem.data.ts | 124 ++++ 12 files changed, 1358 insertions(+), 411 deletions(-) create mode 100644 src/api/spc/project/index.ts create mode 100644 src/api/spc/typeitem/index.ts create mode 100644 src/views/spc/project/index.vue create mode 100644 src/views/spc/project/project.data.ts create mode 100644 src/views/spc/typeitem/index.vue create mode 100644 src/views/spc/typeitem/typeItem.data.ts diff --git a/src/api/spc/itembasic/index.ts b/src/api/spc/itembasic/index.ts index 2e0fe48..c040c09 100644 --- a/src/api/spc/itembasic/index.ts +++ b/src/api/spc/itembasic/index.ts @@ -38,8 +38,9 @@ export interface ItembasicVO { // 查询物品基本信息列表 export const getItembasicPage = async (params) => { if (params.isSearch) { - delete params.isSearch const data = {...params} + delete params.isSearch + return await request.post({ url: '/spc/itembasic/senior', data }) } else { return await request.get({ url: `/spc/itembasic/page`, params }) @@ -53,6 +54,7 @@ export const getItembasic = async (id: number) => { // 新增物品基本信息 export const createItembasic = async (data: ItembasicVO) => { + return await request.post({ url: `/spc/itembasic/create`, data }) } diff --git a/src/api/spc/project/index.ts b/src/api/spc/project/index.ts new file mode 100644 index 0000000..4a11efc --- /dev/null +++ b/src/api/spc/project/index.ts @@ -0,0 +1,56 @@ +import request from '@/config/axios' + +export interface ProjectVO { + code: string + name: string + status: string + desc: string + available: string + remark: string + deletionTime: Date + deleterId: string + extraProperties: string + concurrencyStamp: string + siteId: string +} + +// 查询项目维护基本信息列表 +export const getProjectPage = async (params) => { + if (params.isSearch) { + delete params.isSearch + const data = {...params} + return await request.post({ url: '/spc/project/senior', data }) + } else { + return await request.get({ url: `/spc/project/page`, params }) + } +} + +// 查询项目维护基本信息详情 +export const getProject = async (id: number) => { + return await request.get({ url: `/spc/project/get?id=` + id }) +} + +// 新增项目维护基本信息 +export const createProject = async (data: ProjectVO) => { + return await request.post({ url: `/spc/project/create`, data }) +} + +// 修改项目维护基本信息 +export const updateProject = async (data: ProjectVO) => { + return await request.put({ url: `/spc/project/update`, data }) +} + +// 删除项目维护基本信息 +export const deleteProject = async (id: number) => { + return await request.delete({ url: `/spc/project/delete?id=` + id }) +} + +// 导出项目维护基本信息 Excel +export const exportProject = async (params) => { + return await request.download({ url: `/spc/project/export-excel`, params }) +} + +// 下载导入模板 +export const importTemplate = () => { + return request.download({ url: '/spc/project/get-import-template' }) +} \ No newline at end of file diff --git a/src/api/spc/typeitem/index.ts b/src/api/spc/typeitem/index.ts new file mode 100644 index 0000000..2f5e981 --- /dev/null +++ b/src/api/spc/typeitem/index.ts @@ -0,0 +1,57 @@ +import request from '@/config/axios' + +export interface TypeItemVO { + type: string + name: string + status: string + typeValue: string + userGroupCode: string + available: string + remark: string + deletionTime: Date + deleterId: string + concurrencyStamp: string + upperValue: number + lowerValue: number +} + +// 查询物品检测类型与检测项目关联列表 +export const getTypeItemPage = async (params) => { + if (params.isSearch) { + delete params.isSearch + const data = {...params} + return await request.post({ url: '/spc/type-item/senior', data }) + } else { + return await request.get({ url: `/spc/type-item/page`, params }) + } +} + +// 查询物品检测类型与检测项目关联详情 +export const getTypeItem = async (id: number) => { + return await request.get({ url: `/spc/type-item/get?id=` + id }) +} + +// 新增物品检测类型与检测项目关联 +export const createTypeItem = async (data: TypeItemVO) => { + return await request.post({ url: `/spc/type-item/create`, data }) +} + +// 修改物品检测类型与检测项目关联 +export const updateTypeItem = async (data: TypeItemVO) => { + return await request.put({ url: `/spc/type-item/update`, data }) +} + +// 删除物品检测类型与检测项目关联 +export const deleteTypeItem = async (id: number) => { + return await request.delete({ url: `/spc/type-item/delete?id=` + id }) +} + +// 导出物品检测类型与检测项目关联 Excel +export const exportTypeItem = async (params) => { + return await request.download({ url: `/spc/type-item/export-excel`, params }) +} + +// 下载导入模板 +export const importTemplate = () => { + return request.download({ url: '/spc/type-item/get-import-template' }) +} \ No newline at end of file diff --git a/src/components/BasicForm/src/BasicForm.vue b/src/components/BasicForm/src/BasicForm.vue index 26def83..a39623d 100644 --- a/src/components/BasicForm/src/BasicForm.vue +++ b/src/components/BasicForm/src/BasicForm.vue @@ -151,6 +151,8 @@ const searchTableSuccess = (formField,searchField, val, type, row) => { emit('searchTableSuccess', formField, searchField, val, formRef.value, type, row ) } + + /** 打开弹窗 */ const open = async (type: string, row?: any, masterParmas?: any) => { dialogVisible.value = true @@ -232,22 +234,8 @@ const submitForm = async () => { // 基础数据单表——提交请求 formLoading.value = true try { - // const data = unref(formRef)?.formModel as ItempackagingApi.ItempackagingVO const data = unref(formRef)?.formModel - // if(props.masterParmas.masterId){ - // data.masterId = props.masterParmas.masterId - // data.number = props.masterParmas.number - // } - if (formType.value === 'create') { - await props.apiCreate(data) - message.success(t('common.createSuccess')) - } else { - await props.apiUpdate(data) - message.success(t('common.updateSuccess')) - } - dialogVisible.value = false - // 发送操作成功的事件 - emit('success') + emit('success',formType.value,data) } finally { formLoading.value = false } diff --git a/src/hooks/web/useTable.ts b/src/hooks/web/useTable.ts index 5ff8a51..34248f9 100644 --- a/src/hooks/web/useTable.ts +++ b/src/hooks/web/useTable.ts @@ -173,6 +173,9 @@ export const useTable = (config?: UseTableConfig) => { pageNo: 1, ...data }) + // 查询/重置时,删除筛选相关属性 + delete tableObject.params.filters + delete tableObject.params.isSearch // 页码不等于1时更新页码重新获取数据,页码等于1时重新获取数据 if (tableObject.currentPage !== 1) { tableObject.currentPage = 1 diff --git a/src/utils/dict.ts b/src/utils/dict.ts index 48718c9..8f3c79f 100644 --- a/src/utils/dict.ts +++ b/src/utils/dict.ts @@ -191,6 +191,7 @@ export enum DICT_TYPE { ITEM_GROUP = 'item_group', // 物品分组 ITEM_CATEGORY = 'Item_category', // 物品种类 ITEM_COLOR = 'item_color', // 物品颜色 + ITEMBASIC_TYPE= 'itembasic_type', // 物料检测类型 ITEM_CONFIGURATION = 'item_configuration', // 物品配置 EQ_LEVEL = 'eq_level', // 质量等级 CURRENCY = 'currency', // 货币 diff --git a/src/views/spc/itembasic/index.vue b/src/views/spc/itembasic/index.vue index ec46ca6..92cfd25 100644 --- a/src/views/spc/itembasic/index.vue +++ b/src/views/spc/itembasic/index.vue @@ -5,6 +5,10 @@ + + + + - @@ -42,7 +41,6 @@ - + @@ -100,10 +99,10 @@ const { getList, setSearchParams } = tableMethods // 列表头部按钮 const HeadButttondata = [ defaultButtons.defaultAddBtn(null), // 新增 - defaultButtons.defaultImportBtn(null), // 导入 - defaultButtons.defaultExportBtn(null), // 导出 + // defaultButtons.defaultImportBtn(null), // 导入 + // defaultButtons.defaultExportBtn(null), // 导出 defaultButtons.defaultFreshBtn(null), // 刷新 - //defaultButtons.defaultFilterBtn(null), // 筛选 + // defaultButtons.defaultFilterBtn(null), // 筛选 defaultButtons.defaultSetBtn(null), // 设置 // { // label: '自定义扩展按钮', @@ -117,7 +116,6 @@ const HeadButttondata = [ // 头部按钮事件 const buttonBaseClick = (val, item) => { - console.log(val) if (val == 'add') { // 新增 openForm('create') } else if (val == 'import') { // 导入 @@ -142,10 +140,8 @@ const butttondata = [ const buttonTableClick = async (val, row) => { console.info(row) if (val == 'edit') { // 编辑 - console.info("编辑",row) openForm('update', row) } else if (val == 'delete') { // 删除 - console.info("编辑",row) handleDelete(row.id) } } @@ -153,6 +149,9 @@ const buttonTableClick = async (val, row) => { /** 添加/修改操作 */ const basicFormRef = ref() const openForm = (type: string, row?: any) => { + // if(type=='update'){ + // row.color = row.color.split(','); + // } basicFormRef.value.open(type, row) } @@ -184,6 +183,29 @@ const handleDelete = async (id: number) => { } catch {} } +const formsSuccess = async (formType,data) => { + var isHave =Itembasic.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 ItembasicApi.createItembasic(data) + message.success(t('common.createSuccess')) + } else { + await ItembasicApi.updateItembasic(data) + message.success(t('common.updateSuccess')) + } + basicFormRef.value.dialogVisible = false + getList() +} + /** 导出按钮操作 */ const exportLoading = ref(false) // 导出的加载中 const handleExport = async () => { diff --git a/src/views/spc/itembasic/itembasic.data.ts b/src/views/spc/itembasic/itembasic.data.ts index 7b35f53..cf2400e 100644 --- a/src/views/spc/itembasic/itembasic.data.ts +++ b/src/views/spc/itembasic/itembasic.data.ts @@ -1,258 +1,298 @@ import type { CrudSchema } from '@/hooks/web/useCrudSchemas' import { dateFormatter } from '@/utils/formatTime' +import {Project } from '@/views/spc/project/project.data' +import * as ProjectApi from '@/api/spc/project/index' const { t } = useI18n() // 国际化 /** * @returns {Array} 基础物料信息 */ export const Itembasic = useCrudSchemas(reactive([ - { - label: '代码', - field: 'code', + { + label: '项目编码', + field: 'projcetCode',//传第给后端字段名称 sort: 'custom', - isSearch: true, table: { width: 150, fixed: 'left' }, - // tableForm:{ - // minWidth:200, - // sortable:false - // } - }, - { - label: '名称', - field: 'name', - sort: 'custom', - isSearch: true, - table: { - width: 150 - }, - }, - { - label: '描述1', - field: 'desc1', - sort: 'custom', - table: { - width: 150 - } , - // isTableForm:false - }, - { - label: '描述2', - field: 'desc2', - sort: 'custom', - table: { - width: 150 - } , - }, - { - label: '状态', - field: 'status', - sort: 'custom', - dictType: DICT_TYPE.ITEM_STATUS, - dictClass: 'string', - isForm: true, - isSearch: true, - isTable: true, - table: { - width: 100 - } , form: { - component: 'Switch', - value: 'ENABLE', + // labelMessage: '信息提示说明!!!', componentProps: { - inactiveValue: 'DISABLE', - activeValue: 'ENABLE' + isSearchList: true, // 开启查询弹窗 + searchListPlaceholder: '请选择项目编码', // 输入框占位文本 + searchField: 'code', // 查询弹窗赋值字段 + searchTitle: '项目信息', // 查询弹窗标题 + searchAllSchemas: Project.allSchemas, // 查询弹窗所需类 + searchPage: ProjectApi.getProjectPage // 查询弹窗所需分页方法 } - }, - }, - { - label: '计量单位', - field: 'uom', - sort: 'custom', - dictType: DICT_TYPE.UOM, - dictClass: 'string', - isSearch: true, - isTable: true, - table: { - width: 120 - } , + } }, - { - label: '替代计量单位', - field: 'altUom', + { + label: '项目名称', + field: 'projectName', sort: 'custom', - dictType: DICT_TYPE.UOM, - dictClass: 'string', - isTable: true, + isSearch: false, + isForm:false, table: { - width: 150 - } , - }, - { - label: '是否标包', - field: 'isStdPack', - sort: 'custom', - dictType: DICT_TYPE.TRUE_FALSE, - dictClass: 'string', - // colorType: 'danger', - isTable: true, - table: { - width: 120 - }, - form: { - component: 'Switch', - value: 'TRUE', - componentProps: { - inactiveValue: 'FALSE', - activeValue: 'TRUE' - } + width: 'auto', + fixed: 'left' }, + // tableForm:{ - // width: 180, - // type:'Radio', + // minWidth:200, + // sortable:false // } }, - { - label: '可采购', - field: 'enableBuy', - sort: 'custom', - dictType: DICT_TYPE.TRUE_FALSE, - dictClass: 'string', - isTable: true, - table: { - width: 100 - }, - form: { - component: 'Switch', - value: 'TRUE', - componentProps: { - inactiveValue: 'FALSE', - activeValue: 'TRUE' - } - }, - }, - { - label: '可制造', - field: 'enableMake', - sort: 'custom', - dictType: DICT_TYPE.TRUE_FALSE, - dictClass: 'string', - isTable: true, - table: { - width: 100 - } , - form: { - component: 'Switch', - value: 'TRUE', - componentProps: { - inactiveValue: 'FALSE', - activeValue: 'TRUE' - } - }, - }, - { - label: '可委外加工', - field: 'enableOutsourcing', - sort: 'custom', - dictType: DICT_TYPE.TRUE_FALSE, - dictClass: 'string', - isTable: true, - table: { - width: 120 - } , - form: { - component: 'Switch', - value: 'TRUE', - componentProps: { - inactiveValue: 'FALSE', - activeValue: 'TRUE' - } - }, - }, - { - label: '回收件', - field: 'isRecycled', - sort: 'custom', - dictType: DICT_TYPE.TRUE_FALSE, - dictClass: 'string', - isTable: true, - table: { - width: 100 - }, - form: { - component: 'Switch', - value: 'TRUE', - componentProps: { - inactiveValue: 'FALSE', - activeValue: 'TRUE' - } - }, - }, - { - label: '虚零件', - field: 'isPhantom', + + + { + label: '编号', + field: 'code', sort: 'custom', - dictType: DICT_TYPE.TRUE_FALSE, - dictClass: 'string', - isTable: true, + isSearch: true, table: { - width: 100 - } , - form: { - component: 'Switch', - value: 'TRUE', - componentProps: { - inactiveValue: 'FALSE', - activeValue: 'TRUE' - } + width: 'auto', + fixed: 'left' }, + // tableForm:{ + // minWidth:200, + // sortable:false + // } }, - { - label: 'ABC类', - field: 'abcClass', - sort: 'custom', - dictType: DICT_TYPE.ABC_CLASS, - dictClass: 'string', - isTable: true, - table: { - width: 100 - } , - }, - { - label: '类型', - field: 'type', - sort: 'custom', - dictType: DICT_TYPE.ITEM_TYPE, - dictClass: 'string', - isTable: true, - table: { - width: 100 - } , - }, - { - label: '种类', - field: 'category', - sort: 'custom', - dictType: DICT_TYPE.ITEM_CATEGORY, - dictClass: 'string', - isTable: true, - table: { - width: 100 - } , - }, - { - label: '分组', - field: 'itemGroup', + { + label: '名称', + field: 'name', sort: 'custom', - dictType: DICT_TYPE.ITEM_GROUP, - dictClass: 'string', - isTable: true, - table: { - width: 100 - } , + isSearch: true, + // table: { + // width: 150 + // }, }, + // { + // label: '描述1', + // field: 'desc1', + // sort: 'custom', + // table: { + // width: 150 + // } , + // // isTableForm:false + // }, + // { + // label: '描述2', + // field: 'desc2', + // sort: 'custom', + // table: { + // width: 150 + // } , + // }, + // { + // label: '状态', + // field: 'status', + // sort: 'custom', + // dictType: DICT_TYPE.ITEM_STATUS, + // dictClass: 'string', + // isForm: true, + // isSearch: true, + // isTable: true, + // table: { + // width: 100 + // } , + // form: { + // component: 'Switch', + // value: 'ENABLE', + // componentProps: { + // inactiveValue: 'DISABLE', + // activeValue: 'ENABLE' + // } + // }, + // }, + // { + // label: '计量单位', + // field: 'uom', + // sort: 'custom', + // dictType: DICT_TYPE.UOM, + // dictClass: 'string', + // isSearch: true, + // isTable: true, + // table: { + // width: 120 + // } , + // }, + // { + // label: '替代计量单位', + // field: 'altUom', + // sort: 'custom', + // dictType: DICT_TYPE.UOM, + // dictClass: 'string', + // isTable: true, + // table: { + // width: 150 + // } , + // }, + // { + // label: '是否标包', + // field: 'isStdPack', + // sort: 'custom', + // dictType: DICT_TYPE.TRUE_FALSE, + // dictClass: 'string', + // // colorType: 'danger', + // isTable: true, + // table: { + // width: 120 + // }, + // form: { + // component: 'Switch', + // value: 'TRUE', + // componentProps: { + // inactiveValue: 'FALSE', + // activeValue: 'TRUE' + // } + // }, + // // tableForm:{ + // // width: 180, + // // type:'Radio', + // // } + // }, + // { + // label: '可采购', + // field: 'enableBuy', + // sort: 'custom', + // dictType: DICT_TYPE.TRUE_FALSE, + // dictClass: 'string', + // isTable: true, + // table: { + // width: 100 + // }, + // form: { + // component: 'Switch', + // value: 'TRUE', + // componentProps: { + // inactiveValue: 'FALSE', + // activeValue: 'TRUE' + // } + // }, + // }, + // { + // label: '可制造', + // field: 'enableMake', + // sort: 'custom', + // dictType: DICT_TYPE.TRUE_FALSE, + // dictClass: 'string', + // isTable: true, + // table: { + // width: 100 + // } , + // form: { + // component: 'Switch', + // value: 'TRUE', + // componentProps: { + // inactiveValue: 'FALSE', + // activeValue: 'TRUE' + // } + // }, + // }, + // { + // label: '可委外加工', + // field: 'enableOutsourcing', + // sort: 'custom', + // dictType: DICT_TYPE.TRUE_FALSE, + // dictClass: 'string', + // isTable: true, + // table: { + // width: 120 + // } , + // form: { + // component: 'Switch', + // value: 'TRUE', + // componentProps: { + // inactiveValue: 'FALSE', + // activeValue: 'TRUE' + // } + // }, + // }, + // { + // label: '回收件', + // field: 'isRecycled', + // sort: 'custom', + // dictType: DICT_TYPE.TRUE_FALSE, + // dictClass: 'string', + // isTable: true, + // table: { + // width: 100 + // }, + // form: { + // component: 'Switch', + // value: 'TRUE', + // componentProps: { + // inactiveValue: 'FALSE', + // activeValue: 'TRUE' + // } + // }, + // }, + // { + // label: '虚零件', + // field: 'isPhantom', + // sort: 'custom', + // dictType: DICT_TYPE.TRUE_FALSE, + // dictClass: 'string', + // isTable: true, + // table: { + // width: 100 + // } , + // form: { + // component: 'Switch', + // value: 'TRUE', + // componentProps: { + // inactiveValue: 'FALSE', + // activeValue: 'TRUE' + // } + // }, + // }, + // { + // label: 'ABC类', + // field: 'abcClass', + // sort: 'custom', + // dictType: DICT_TYPE.ABC_CLASS, + // dictClass: 'string', + // isTable: true, + // table: { + // width: 100 + // } , + // }, + // { + // label: '类型', + // field: 'type', + // sort: 'custom', + // dictType: DICT_TYPE.ITEM_TYPE, + // dictClass: 'string', + // isTable: true, + // table: { + // width: 100 + // } , + // }, + // { + // label: '种类', + // field: 'category', + // sort: 'custom', + // dictType: DICT_TYPE.ITEM_CATEGORY, + // dictClass: 'string', + // isTable: true, + // table: { + // width: 100 + // } , + // }, + // { + // label: '分组', + // field: 'itemGroup', + // sort: 'custom', + // dictType: DICT_TYPE.ITEM_GROUP, + // dictClass: 'string', + // isTable: true, + // table: { + // width: 100 + // } , + // }, { label: '颜色', field: 'color', @@ -260,54 +300,61 @@ export const Itembasic = useCrudSchemas(reactive([ dictType: DICT_TYPE.ITEM_COLOR, dictClass: 'string', isTable: true, - table: { - width: 100 - } , - }, - { - label: '配置', - field: 'configuration', - sort: 'custom', - dictType: DICT_TYPE.ITEM_CONFIGURATION, - dictClass: 'string', - isTable: true, - table: { - width: 100 - } , - }, - { - label: '项目', - field: 'project', - sort: 'custom', - table: { - width: 100 - } , - }, - { - label: '质量等级', - field: 'eqLevel', - sort: 'custom', - dictType: DICT_TYPE.EQ_LEVEL, - dictClass: 'string', - isTable: true, - table: { - width: 120 - } , - }, - { - label: '有效天数', - field: 'validityDays', - sort: 'custom', - table: { - width: 120 - }, + // table: { + // width: 100 + // } , form: { - component: 'InputNumber', + component: 'Select', componentProps: { - min: 0 + // inactiveValue: 'DISABLE', + // activeValue: 'ENABLE', } }, }, + // { + // label: '配置', + // field: 'configuration', + // sort: 'custom', + // dictType: DICT_TYPE.ITEM_CONFIGURATION, + // dictClass: 'string', + // isTable: true, + // table: { + // width: 100 + // } , + // }, + // { + // label: '项目', + // field: 'project', + // sort: 'custom', + // table: { + // width: 100 + // } , + // }, + // { + // label: '质量等级', + // field: 'eqLevel', + // sort: 'custom', + // dictType: DICT_TYPE.EQ_LEVEL, + // dictClass: 'string', + // isTable: true, + // table: { + // width: 120 + // } , + // }, + // { + // label: '有效天数', + // field: 'validityDays', + // sort: 'custom', + // table: { + // width: 120 + // }, + // form: { + // component: 'InputNumber', + // componentProps: { + // min: 0 + // } + // }, + // }, { label: '是否可用', field: 'available', @@ -326,56 +373,56 @@ export const Itembasic = useCrudSchemas(reactive([ activeValue: 'TRUE' } }, - }, - { - label: '生效时间', - field: 'activeTime', - sort: 'custom', - isTable: true, - formatter: dateFormatter, - detail: { - dateFormat: 'YYYY-MM-DD HH:mm:ss' - }, - table: { - width: 180 - } , - form: { - component: 'DatePicker', - componentProps: { - style: {width:'100%'}, - type: 'datetime', - dateFormat: 'YYYY-MM-DD HH:mm:ss', - valueFormat: 'x', - } - }, - // tableForm:{ - // width: 200, - // type:'FormDateTime', - // } - }, - { - label: '失效时间', - field: 'expireTime', - sort: 'custom', - isTable: true, - formatter: dateFormatter, - detail: { - dateFormat: 'YYYY-MM-DD HH:mm:ss' - }, - table: { - width: 180 - } , - form: { - component: 'DatePicker', - componentProps: { - style: {width:'100%'}, - type: 'datetime', - dateFormat: 'YYYY-MM-DD HH:mm:ss', - valueFormat: 'x', - } - }, - }, - { +}, + // { + // label: '生效时间', + // field: 'activeTime', + // sort: 'custom', + // isTable: true, + // formatter: dateFormatter, + // detail: { + // dateFormat: 'YYYY-MM-DD HH:mm:ss' + // }, + // table: { + // width: 180 + // } , + // form: { + // component: 'DatePicker', + // componentProps: { + // style: {width:'100%'}, + // type: 'datetime', + // dateFormat: 'YYYY-MM-DD HH:mm:ss', + // valueFormat: 'x', + // } + // }, + // // tableForm:{ + // // width: 200, + // // type:'FormDateTime', + // // } + // }, + // { + // label: '失效时间', + // field: 'expireTime', + // sort: 'custom', + // isTable: true, + // formatter: dateFormatter, + // detail: { + // dateFormat: 'YYYY-MM-DD HH:mm:ss' + // }, + // table: { + // width: 180 + // } , + // form: { + // component: 'DatePicker', + // componentProps: { + // style: {width:'100%'}, + // type: 'datetime', + // dateFormat: 'YYYY-MM-DD HH:mm:ss', + // valueFormat: 'x', + // } + // }, + // }, + { label: '创建时间', field: 'createTime', sort: 'custom', @@ -424,67 +471,68 @@ export const rules = reactive({ name: [ { required: true, message: '请输入名称', trigger: 'blur' } ], - status: [ - { required: true, message: '请选择状态', trigger: 'change' } - ], - uom: [ - { required: true, message: '请选择计量单位', trigger: 'change' } - ], - altUom: [ - { required: true, message: '请选择替代计量单位', trigger: 'change' } - ], - isStdPack: [ - { required: true, message: '请选择是否标包', trigger: 'change' } - ], - enableBuy: [ - { required: true, message: '请选择是否可采购', trigger: 'change' } - ], - enableMake: [ - { required: true, message: '请选择是否可制造', trigger: 'change' } - ], - enableOutsourcing: [ - { required: true, message: '请选择是否可委外加工', trigger: 'change' } - ], - isRecycled: [ - { required: true, message: '请选择回收件', trigger: 'change' } - ], - isPhantom: [ - { required: true, message: '请选择虚零件', trigger: 'change' } - ], - abcClass: [ - { required: true, message: '请选择ABC类', trigger: 'change' } - ], - type: [ - { required: true, message: '请选择类型', trigger: 'change' } - ], - category: [ - { required: true, message: '请选择种类', trigger: 'change' } - ], - itemGroup: [ - { required: true, message: '请选择分组', trigger: 'change' } - ], - color: [ - { required: true, message: '请选择颜色', trigger: 'change' } - ], - configuration: [ - { required: true, message: '请选择配置', trigger: 'change' } - ], - project: [ - { required: true, message: '请输入项目', trigger: 'blur' } - ], - eqLevel: [ - { required: true, message: '请选择质量等级', trigger: 'change' } - ], - validityDays: [ - { required: true, message: '请输入有效天数', trigger: 'change' } - ], - available: [ - { required: true, message: '请选择是否可用', trigger: 'change' } - ], - activeTime: [ - { required: true, message: '请输入生效时间', trigger: 'change' } - ], - expireTime: [ - { required: true, message: '请输入失效时间', trigger: 'change' } - ], + + projcetCode: [ + { required: true, message: '请选择项目编码', trigger: 'change' } + ], + // uom: [ + // { required: true, message: '请选择计量单位', trigger: 'change' } + // ], + // altUom: [ + // { required: true, message: '请选择替代计量单位', trigger: 'change' } + // ], + // isStdPack: [ + // { required: true, message: '请选择是否标包', trigger: 'change' } + // ], + // enableBuy: [ + // { required: true, message: '请选择是否可采购', trigger: 'change' } + // ], + // enableMake: [ + // { required: true, message: '请选择是否可制造', trigger: 'change' } + // ], + // enableOutsourcing: [ + // { required: true, message: '请选择是否可委外加工', trigger: 'change' } + // ], + // isRecycled: [ + // { required: true, message: '请选择回收件', trigger: 'change' } + // ], + // isPhantom: [ + // { required: true, message: '请选择虚零件', trigger: 'change' } + // ], + // abcClass: [ + // { required: true, message: '请选择ABC类', trigger: 'change' } + // ], + // type: [ + // { required: true, message: '请选择类型', trigger: 'change' } + // ], + // category: [ + // { required: true, message: '请选择种类', trigger: 'change' } + // ], + // itemGroup: [ + // { required: true, message: '请选择分组', trigger: 'change' } + // ], + // color: [ + // { required: true, message: '请选择颜色', trigger: 'change' } + // ], + // configuration: [ + // { required: true, message: '请选择配置', trigger: 'change' } + // ], + // project: [ + // { required: true, message: '请输入项目', trigger: 'blur' } + // ], + // eqLevel: [ + // { required: true, message: '请选择质量等级', trigger: 'change' } + // ], + // validityDays: [ + // { required: true, message: '请输入有效天数', trigger: 'change' } + // ], + // available: [ + // { required: true, message: '请选择是否可用', trigger: 'change' } + // ], + // activeTime: [ + // { required: true, message: '请输入生效时间', trigger: 'change' } + // ], + // expireTime: [ + // { required: true, message: '请输入失效时间', trigger: 'change' } + }) \ No newline at end of file diff --git a/src/views/spc/project/index.vue b/src/views/spc/project/index.vue new file mode 100644 index 0000000..8d1b0f6 --- /dev/null +++ b/src/views/spc/project/index.vue @@ -0,0 +1,255 @@ + + + diff --git a/src/views/spc/project/project.data.ts b/src/views/spc/project/project.data.ts new file mode 100644 index 0000000..e13bbca --- /dev/null +++ b/src/views/spc/project/project.data.ts @@ -0,0 +1,133 @@ +import type { CrudSchema } from '@/hooks/web/useCrudSchemas' +import { dateFormatter } from '@/utils/formatTime' + +// 表单校验 +export const ProjectRules = reactive({ + code: [required] +}) + +export const Project = useCrudSchemas(reactive([ + { + label: '项目编号', + field: 'code', + sort: 'custom', + isSearch: true + }, + { + label: '项目名称', + field: 'name', + sort: 'custom', + isSearch: true + }, + // { + // label: '状态', + // field: 'status', + // sort: 'custom', + // isSearch: true, + // form: { + // component: 'Radio' + // } + // }, + { + label: '描述', + field: 'descs', + sort: 'custom', + isSearch: false, + isTable:false + }, + // { + // label: '是否可用', + // field: 'available', + // sort: 'custom', + // isSearch: true + // }, + { + label: '备注', + field: 'remark', + sort: 'custom', + isSearch: false, + isTable:false + }, + { + label: '创建时间', + field: 'createTime', + sort: 'custom', + formatter: dateFormatter, + isSearch: false, + isForm:false, + search: { + component: 'DatePicker', + componentProps: { + valueFormat: 'YYYY-MM-DD HH:mm:ss', + type: 'daterange', + defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')] + } + } + }, + { + label: '删除时间', + field: 'deletionTime', + sort: 'custom', + formatter: dateFormatter, + isSearch: false, + isTable:false, + isForm: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: '删除者ID', + field: 'deleterId', + sort: 'custom', + isSearch: false, + isTable:false, + isForm:false + }, + { + label: '扩展属性', + field: 'extraProperties', + sort: 'custom', + isSearch: false, + isTable:false, + isForm:false + }, + { + label: '并发乐观锁', + field: 'concurrencyStamp', + sort: 'custom', + isSearch: false, + isTable:false, + isForm:false + }, + { + label: '地点ID', + field: 'siteId', + sort: 'custom', + isSearch: false, + isTable:false, + isForm:false + }, + { + label: '操作', + field: 'action', + isForm: false, + table: { + width: 150, + fixed: 'right' + } + } +])) diff --git a/src/views/spc/typeitem/index.vue b/src/views/spc/typeitem/index.vue new file mode 100644 index 0000000..0f9614d --- /dev/null +++ b/src/views/spc/typeitem/index.vue @@ -0,0 +1,258 @@ + + + diff --git a/src/views/spc/typeitem/typeItem.data.ts b/src/views/spc/typeitem/typeItem.data.ts new file mode 100644 index 0000000..aa89abd --- /dev/null +++ b/src/views/spc/typeitem/typeItem.data.ts @@ -0,0 +1,124 @@ +import type { CrudSchema } from '@/hooks/web/useCrudSchemas' +import { dateFormatter } from '@/utils/formatTime' + +// 表单校验 +export const TypeItemRules = reactive({ + type: [required], + name: [required], + typeValue: [required], + available: [required] +}) + +export const TypeItem = useCrudSchemas(reactive([ + { + label:'代码', + field:'type', + sort: 'custom', + isSearch: true, + table: { + width: 'auto', + fixed: 'left' + }, + }, + { + label: '名称', + field: 'name', + sort: 'custom', + isSearch: true + }, + // { + // label: '状态', + // field: 'status', + // sort: 'custom', + // isSearch: false, + // form: { + // component: 'Radio' + // } + // }, + { + label: '检测类型', + field: 'typeValue', + sort: 'custom', + dictType: DICT_TYPE.ITEMBASIC_TYPE, + dictClass: 'string', // 默认都是字符串类型其他暂不考虑 + isSearch: true, + + }, + { + label: '是否可用', + field: 'available', + sort: 'custom', + dictType: DICT_TYPE.TRUE_FALSE, + dictClass: 'string', + isTable: true, + table: { + width: 120 + }, + form: { + component: 'Switch', + value: 'TRUE', + componentProps: { + inactiveValue: 'FALSE', + activeValue: 'TRUE' + } + }, +}, +{ + label: '创建者', + field: 'creator', + isForm: false, + isTable: false +}, + { + label: '备注', + field: 'remark', + sort: 'custom', + isSearch: false, + isTable:false + }, + { + label: '创建时间', + field: 'createTime', + sort: 'custom', + formatter: dateFormatter, + isSearch: 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: 'upperValue', + sort: 'custom', + isSearch: false, + form: { + component: 'InputNumber', + value: 0 + } + }, + { + label: '下限值', + field: 'lowerValue', + sort: 'custom', + isSearch: false, + form: { + component: 'InputNumber', + value: 0 + } + }, + { + label: '操作', + field: 'action', + isForm: false, + table: { + width: 150, + fixed: 'right' + } + } +]))