diff --git a/package.json b/package.json index c7e26457e..be1ba3e08 100644 --- a/package.json +++ b/package.json @@ -60,6 +60,7 @@ "xml-js": "^1.6.11" }, "devDependencies": { + "@babel/plugin-proposal-optional-chaining": "^7.21.0", "@commitlint/cli": "^17.7.1", "@commitlint/config-conventional": "^17.7.0", "@iconify/json": "^2.2.119", diff --git a/src/api/qms/counter/index.ts b/src/api/qms/counter/index.ts index ee346e189..3a75b8163 100644 --- a/src/api/qms/counter/index.ts +++ b/src/api/qms/counter/index.ts @@ -4,7 +4,6 @@ export interface CounterVO { id: number itemCode: string testTypeCode: string - workingCode: boolean supplierCode: string qualifiedTimes: number lastQualifiedBatch: string diff --git a/src/components/BasicForm/src/BasicFormQmsCode.vue b/src/components/BasicForm/src/BasicFormQmsCode.vue new file mode 100644 index 000000000..03ef9e308 --- /dev/null +++ b/src/components/BasicForm/src/BasicFormQmsCode.vue @@ -0,0 +1,696 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/components/BasicForm/src/BasicFormQms.vue b/src/components/BasicForm/src/BasicFormQmsNumber.vue similarity index 100% rename from src/components/BasicForm/src/BasicFormQms.vue rename to src/components/BasicForm/src/BasicFormQmsNumber.vue diff --git a/src/components/Detail/src/DetailQmsCode.vue b/src/components/Detail/src/DetailQmsCode.vue new file mode 100644 index 000000000..3f393da07 --- /dev/null +++ b/src/components/Detail/src/DetailQmsCode.vue @@ -0,0 +1,846 @@ + + + + + + {{ titleValueRef }} {{ titleNameRef }} + + + + + + + + + + + + + + + + + + + + {{ item }} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/components/Detail/src/DetailQms.vue b/src/components/Detail/src/DetailQmsNumber.vue similarity index 99% rename from src/components/Detail/src/DetailQms.vue rename to src/components/Detail/src/DetailQmsNumber.vue index 443d33ccc..424b6c479 100644 --- a/src/components/Detail/src/DetailQms.vue +++ b/src/components/Detail/src/DetailQmsNumber.vue @@ -121,7 +121,7 @@ - ([ sort: 'custom', isSearch: true }, - { - label: '工序编码', - field: 'workingCode', - sort: 'custom', - isSearch: true, - }, { label: '供应商编码', field: 'supplierCode', @@ -120,13 +114,13 @@ export const Counter = useCrudSchemas(reactive([ sort: 'custom', isSearch: false, }, - { - label: '操作', - field: 'action', - isForm: false, - table: { - width: 150, - fixed: 'right' - } - } + // { + // label: '操作', + // field: 'action', + // isForm: false, + // table: { + // width: 150, + // fixed: 'right' + // } + // } ])) diff --git a/src/views/qms/basicDataManage/dynamicRule/dynamicRule.data.ts b/src/views/qms/basicDataManage/dynamicRule/dynamicRule.data.ts index 213df1979..9fb81f8c4 100644 --- a/src/views/qms/basicDataManage/dynamicRule/dynamicRule.data.ts +++ b/src/views/qms/basicDataManage/dynamicRule/dynamicRule.data.ts @@ -69,6 +69,9 @@ export const InspectionStage = useCrudSchemas(reactive([ form: { component: 'InputNumber', value: 0 + }, + tableForm: { + type: 'InputNumber', } }, { @@ -79,6 +82,9 @@ export const InspectionStage = useCrudSchemas(reactive([ form: { component: 'InputNumber', value: 0 + }, + tableForm: { + type: 'InputNumber', } }, { @@ -89,6 +95,9 @@ export const InspectionStage = useCrudSchemas(reactive([ form: { component: 'InputNumber', value: 0 + }, + tableForm: { + type: 'InputNumber', } }, { @@ -99,6 +108,9 @@ export const InspectionStage = useCrudSchemas(reactive([ form: { component: 'InputNumber', value: 0 + }, + tableForm: { + type: 'InputNumber', } }, { @@ -112,7 +124,11 @@ export const InspectionStage = useCrudSchemas(reactive([ form: { component: 'Switch', value:true - } + }, + tableForm: { + type: 'Switch', + default: true + }, }, { label: '是否略过检验', @@ -125,6 +141,10 @@ export const InspectionStage = useCrudSchemas(reactive([ form: { component: 'Switch', value:true + }, + tableForm: { + type: 'Switch', + default: true } }, { @@ -137,6 +157,9 @@ export const InspectionStage = useCrudSchemas(reactive([ form: { component: 'Select' }, + tableForm: { + type: 'Select' + }, }, { label: '操作', diff --git a/src/views/qms/basicDataManage/dynamicRule/index.vue b/src/views/qms/basicDataManage/dynamicRule/index.vue index 5b9c4a306..47c7b192a 100644 --- a/src/views/qms/basicDataManage/dynamicRule/index.vue +++ b/src/views/qms/basicDataManage/dynamicRule/index.vue @@ -59,7 +59,7 @@ /> - + @@ -89,6 +90,7 @@ import * as DynamicRuleApi from '@/api/qms/dynamicRule' import * as InspectionStageApi from '@/api/qms/inspectionStage' import * as defaultButtons from '@/utils/disposition/defaultButtons' +import UploadFile from '@/components/UploadFile/src/UploadFile.vue' // import TableHead from '@/components/TableHead/src/TableHead.vue' // import ImportForm from '@/components/ImportForm/src/ImportForm.vue' // import Detail from '@/components/Detail/src/Detail.vue' diff --git a/src/views/qms/basicDataManage/selectedProject/selectedProject.data.ts b/src/views/qms/basicDataManage/selectedProject/selectedProject.data.ts index 29d9820d7..32e9e0f5f 100644 --- a/src/views/qms/basicDataManage/selectedProject/selectedProject.data.ts +++ b/src/views/qms/basicDataManage/selectedProject/selectedProject.data.ts @@ -1,5 +1,13 @@ import type { CrudSchema } from '@/hooks/web/useCrudSchemas' import { dateFormatter } from '@/utils/formatTime' +import * as DictTypeApi from '@/api/system/dict/dict.type' +const dictTypeList = await DictTypeApi.getSimpleDictTypeList() +const dictTypeListData = dictTypeList.map(item => { + return { + label: item.name, + value: item.type + } +}) // 表单校验 export const SelectedProjectRules = reactive({ @@ -11,113 +19,81 @@ export const SelectedProjectRules = reactive({ }) export const SelectedProject = useCrudSchemas(reactive([ - { - label: 'id', - field: 'id', - sort: 'custom', - isForm: false - }, + { label: '编码', field: 'code', sort: 'custom', + isTableForm: false, isSearch: true }, { - label: '字典编码', + label: '字典', field: 'dictionaryCode', sort: 'custom', - isSearch: true - }, - { - label: '字典项值', - field: 'dictionaryValue', - sort: 'custom', - isSearch: true - }, - { - label: '评估代码', - field: 'estimateCode', - sort: 'custom', - isSearch: true - }, - { - label: '缺陷级别', - field: 'defectLevel', - sort: 'custom', - isSearch: true - }, - { - label: '是否可用', - field: 'available', - sort: 'custom', - isSearch: true - }, - { - label: '创建时间', - field: 'createTime', - sort: 'custom', - formatter: dateFormatter, isSearch: true, - search: { - component: 'DatePicker', + tableForm: { + type: 'Select', + initOptions: dictTypeListData, + }, + form: { + component: 'Select', + api: dictTypeListData, componentProps: { - valueFormat: 'YYYY-MM-DD HH:mm:ss', - type: 'daterange', - defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')] + options: dictTypeListData, + optionsAlias: { + labelField: 'label', + valueField: 'value' + } } - }, - isForm: false + } }, { - label: '删除时间', - field: 'deletionTime', + label: '字典项值', + field: 'dictionaryValue', 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')] - } + tableForm: { + type: 'Select', }, form: { - component: 'DatePicker', + component: 'Select', componentProps: { - type: 'datetime', - valueFormat: 'x' + options: dictTypeListData, + optionsAlias: { + labelField: 'label', + valueField: 'value' + } } } }, { - label: '删除者ID', - field: 'deleterId', - sort: 'custom', - isSearch: true - }, - { - label: '扩展属性', - field: 'extraProperties', - sort: 'custom', - isSearch: true - }, - { - label: '并发乐观锁', - field: 'concurrencyStamp', + label: '评估代码', + field: 'estimateCode', sort: 'custom', isSearch: true, + dictType: DICT_TYPE.DICTIONARY_CLASS, + dictClass: 'string', + tableForm: { + type: 'Select', + }, form: { - component: 'InputNumber', - value: 0 + component: 'Select', } }, { - label: '地点ID', - field: 'siteId', + label: '缺陷级别', + field: 'defectLevel', sort: 'custom', - isSearch: true + isSearch: true, + dictType: DICT_TYPE.DEFECT_LEVEL, + dictClass: 'string', + tableForm: { + type: 'Select', + }, + form: { + component: 'Select', + } }, { label: '操作', @@ -126,6 +102,9 @@ export const SelectedProject = useCrudSchemas(reactive([ table: { width: 150, fixed: 'right' - } + }, + isTableForm: false, } ])) + + diff --git a/src/views/qms/basicDataManage/selectedSet/index.vue b/src/views/qms/basicDataManage/selectedSet/index.vue index 4b96d3710..f4513d891 100644 --- a/src/views/qms/basicDataManage/selectedSet/index.vue +++ b/src/views/qms/basicDataManage/selectedSet/index.vue @@ -44,14 +44,40 @@ @success="formsSuccess" :rules="SelectedSetRules" :formAllSchemas="SelectedSet.allSchemas" + :tableAllSchemas="SelectedProject.allSchemas" + :tableFormRules="SelectedProjectRules" + :tableData="tableData" :apiUpdate="SelectedSetApi.updateSelectedSet" :apiCreate="SelectedSetApi.createSelectedSet" @searchTableSuccess="searchTableSuccess" :isBusiness="false" + @onChange="onChange" + @handleAddTable="handleAddTable" + @handleDeleteTable="handleDeleteTable" + @submitForm="submitForm" + :isSearchTableItem="true" + @formSelectChange="formSelectChange" /> - + @@ -62,9 +88,13 @@ import download from '@/utils/download' import { SelectedSet,SelectedSetRules } from './selectedSet.data' import * as SelectedSetApi from '@/api/qms/selectedSet' 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' +import { SelectedProject,SelectedProjectRules } from '../selectedProject/selectedProject.data' +import * as SelectedProjectApi from '@/api/qms/selectedProject' +import * as DictDataApi from '@/api/system/dict/dict.data' +import component from 'virtual:svg-icons-register' +// 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: 'SelectedSet' }) @@ -72,7 +102,9 @@ const message = useMessage() // 消息弹窗 const { t } = useI18n() // 国际化 const route = useRoute() // 路由信息 +const tableData = ref([]) const routeName = ref() +const selectDictType = ref() routeName.value = route.name const tableColumns = ref(SelectedSet.allSchemas.tableColumns) @@ -99,9 +131,9 @@ const { getList, setSearchParams } = tableMethods // 列表头部按钮 const HeadButttondata = [ - defaultButtons.defaultAddBtn({hasPermi:'wms:selectedSet:create'}), // 新增 - defaultButtons.defaultImportBtn({hasPermi:'wms:selectedSet:import'}), // 导入 - defaultButtons.defaultExportBtn({hasPermi:'wms:selectedSet:export'}), // 导出 + defaultButtons.defaultAddBtn({hasPermi:'qms:selected-set:query'}), // 新增 + // defaultButtons.defaultImportBtn({hasPermi:'qms:selected-set:import'}), // 导入 + // defaultButtons.defaultExportBtn({hasPermi:'qms:selected-set:export'}), // 导出 defaultButtons.defaultFreshBtn(null), // 刷新 defaultButtons.defaultFilterBtn(null), // 筛选 defaultButtons.defaultSetBtn(null), // 设置 @@ -133,8 +165,8 @@ const buttonBaseClick = (val, item) => { // 列表-操作按钮 const butttondata = [ - defaultButtons.mainListEditBtn({hasPermi:'wms:selectedSet:update'}), // 编辑 - defaultButtons.mainListDeleteBtn({hasPermi:'wms:selectedSet:delete'}), // 删除 + defaultButtons.mainListEditBtn({hasPermi:'qms:selected-set:update'}), // 编辑 + defaultButtons.mainListDeleteBtn({hasPermi:'qms:selected-set:delete'}), // 删除 ] // 列表-操作按钮事件 @@ -149,6 +181,7 @@ const buttonTableClick = async (val, row) => { /** 添加/修改操作 */ const basicFormRef = ref() const openForm = (type: string, row?: any) => { + tableData.value = [] basicFormRef.value.open(type, row) } @@ -179,6 +212,7 @@ const formsSuccess = async (formType,data) => { /** 详情操作 */ const detailRef = ref() const openDetail = (row: any, titleName: any, titleValue: any) => { + selectDictType.value = row.classification detailRef.value.openDetail(row, titleName, titleValue, 'basicSelectedSet') } @@ -235,6 +269,79 @@ const searchFormClick = (searchData) => { getList() // 刷新当前列表 } + +const tableFormKeys = {} +SelectedProject.allSchemas.tableFormColumns.forEach((item) => { + tableFormKeys[item.field] = item.default ? item.default : '' +}) + +// 添加明细 +const handleAddTable = () => { + tableData.value.push(JSON.parse(JSON.stringify(tableFormKeys))) +} +// 删除明细 +const handleDeleteTable = (item, index) => { + tableData.value.splice(index, 1) +} + + +// 主子数据 提交 +const submitForm = async (formType, data) => { + data.selectedProjectDOList = tableData.value// 拼接子表数据参数 + console.log(data.subList) + try { + if (formType === 'create') { + await SelectedSetApi.createSelectedSet(data) + message.success(t('common.createSuccess')) + } else { + await SelectedSetApi.updateSelectedSet(data) + message.success(t('common.updateSuccess')) + } + basicFormRef.value.dialogVisible = false + // 刷新当前列表 + getList() + } finally { + basicFormRef.value.formLoading = false + } +} + +const detailValidate = (data) => { + let tag = true; + return tag +} + +const detailOpenForm = (type, row, masterParmas) => { + // if(selectDictType.value){ + + // } + if(type='create'){ + + } +} + + + +const detailBasiFormOnChange = (field,val) => { + console.log(field) + console.log(val) + if(field == 'dictionaryCode'){ + DictDataApi.queryByDictType(val).then(res => { + SelectedProject.allSchemas.formSchema.find(item => { + return item.field == 'dictionaryValue' + }).componentProps.options = res.map(item=>{ + return { + value: item.value, + label: item.label + } + }) + }) + } +} + +const formSelectChange = (a,b,c,d) => { + console.log(111) +} + /** 初始化 **/ onMounted(async () => { getList() diff --git a/src/views/qms/basicDataManage/selectedSet/selectedSet.data.ts b/src/views/qms/basicDataManage/selectedSet/selectedSet.data.ts index dc66ae5d9..e4e1d6f0d 100644 --- a/src/views/qms/basicDataManage/selectedSet/selectedSet.data.ts +++ b/src/views/qms/basicDataManage/selectedSet/selectedSet.data.ts @@ -1,24 +1,22 @@ import type { CrudSchema } from '@/hooks/web/useCrudSchemas' -import { dateFormatter } from '@/utils/formatTime' +import * as DictTypeApi from '@/api/system/dict/dict.type' + // 表单校验 export const SelectedSetRules = reactive({ + description: [required], code: [required], available: [required], concurrencyStamp: [required] }) export const SelectedSet = useCrudSchemas(reactive([ - { - label: 'id', - field: 'id', - sort: 'custom', - isForm: false - }, + { label: '编码', field: 'code', sort: 'custom', + isForm: false, isSearch: true }, { @@ -31,80 +29,13 @@ export const SelectedSet = useCrudSchemas(reactive([ label: '分类', field: 'classification', sort: 'custom', - isSearch: true - }, - { - label: '是否可用', - field: 'available', - sort: 'custom', - isSearch: true - }, - { - label: '创建时间', - field: 'createTime', - 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')] - } - }, - isForm: false - }, - { - label: '删除时间', - field: 'deletionTime', - 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' - } + dictType: DICT_TYPE.EVALUATION_CODE, + dictClass: 'string', + tableForm: { + type: 'Select', } }, - { - label: '删除者ID', - field: 'deleterId', - sort: 'custom', - isSearch: true - }, - { - label: '扩展属性', - field: 'extraProperties', - sort: 'custom', - isSearch: true - }, - { - label: '并发乐观锁', - field: 'concurrencyStamp', - sort: 'custom', - isSearch: true, - form: { - component: 'InputNumber', - value: 0 - } - }, - { - label: '地点ID', - field: 'siteId', - sort: 'custom', - isSearch: true - }, { label: '操作', field: 'action',