diff --git a/src/api/system/dict/dict.type.ts b/src/api/system/dict/dict.type.ts
index ed2969f11..d88c889ed 100644
--- a/src/api/system/dict/dict.type.ts
+++ b/src/api/system/dict/dict.type.ts
@@ -42,3 +42,13 @@ export const deleteDictType = (id: number) => {
export const exportDictType = (params) => {
return request.get({ url: '/system/dict-type/export', params })
}
+
+
+// 查询字典列表
+export const getDictTypeAndData = (classes: string | null) => {
+ let url = '/system/dict-type/list-all-data-all';
+ if (classes !== null) {
+ url += `?classes=${classes}`;
+ }
+ return request.get({ url });
+}
\ No newline at end of file
diff --git a/src/components/Detail/src/DetailQmsCode.vue b/src/components/Detail/src/DetailQmsCode.vue
index 3f393da07..3a54e68e0 100644
--- a/src/components/Detail/src/DetailQmsCode.vue
+++ b/src/components/Detail/src/DetailQmsCode.vue
@@ -699,6 +699,7 @@ const openForm = async (type: string, row?: number) => {
}
// form 提交
const submitForm = async (formType, data) => {
+ debugger
try {
// 子表新增编辑校验 如果业务需要子表提交校验 需在主页详情组件添加 detailValidate 参数及方法
const rs = (await props.detailValidate) ? await props.detailValidate(data) : true
@@ -797,7 +798,7 @@ const openImage=(item)=>{
* @param cur 改变后值
*/
const detailBasicFormOnChange = (field, cur) => {
- emit('detailBasicFormOnChange', field, cur)
+ emit('detailBasicFormOnChange', field, cur,formRef.value.formRef)
}
/**
diff --git a/src/components/TableForm/src/TableForm.vue b/src/components/TableForm/src/TableForm.vue
index 38dd76825..5d25c1d81 100644
--- a/src/components/TableForm/src/TableForm.vue
+++ b/src/components/TableForm/src/TableForm.vue
@@ -126,6 +126,39 @@
:key="op.value" />
+
+
+
+
+
+
+
+
{
- return {
- label: item.name,
- value: item.type
- }
+
+const optionsList = await DictTypeApi.getDictTypeAndData('inspection')
+optionsList.forEach(element => {
+ element.options = element.dictDataRespVOList.map(item => {
+ return {
+ value: element.type + "-%%%-" + item.value,
+ label: element.name + "-" + item.label
+ }
+ })
})
// 表单校验
export const SelectedProjectRules = reactive({
code: [required],
- dictionaryCode: [required],
- dictionaryValue: [required],
- available: [required],
- concurrencyStamp: [required]
+ dictionaryTypeAndCode: [required],
+ estimateCode: [required],
+ defectLevel: [required],
})
export const SelectedProject = useCrudSchemas(reactive([
@@ -28,51 +30,64 @@ export const SelectedProject = useCrudSchemas(reactive([
isSearch: true
},
{
- label: '字典',
- field: 'dictionaryCode',
+ label: '字典及字典项',
+ field: 'dictionaryTypeAndCode',
sort: 'custom',
- isSearch: true,
+ formatter: (_: Recordable, __: TableColumn, cellValue: boolean) => {
+ return optionsList.find(item => item.options.some(option => option.value === cellValue))?.options.find(option => option.value === cellValue)?.label
+ },
+ isSearch: false,
+ isDetail: false,
+ isTable: true,
+ isForm: true,
tableForm: {
- type: 'Select',
- initOptions: dictTypeListData,
+ type: 'SelectGroup',
+ initOptions: optionsList
},
form: {
component: 'Select',
- api: dictTypeListData,
componentProps: {
- options: dictTypeListData,
- optionsAlias: {
- labelField: 'label',
- valueField: 'value'
- }
+ options: optionsList
}
- }
+ },
+
+ },
+ {
+ label: '字典',
+ field: 'dictionaryCode',
+ sort: 'custom',
+ isSearch: false,
+ isTableForm: false,
+ isDetail: false,
+ isTable: false,
+ isForm: false,
},
{
- label: '字典项值',
+ label: '字典项',
field: 'dictionaryValue',
sort: 'custom',
- isSearch: true,
- tableForm: {
- type: 'Select',
- },
- form: {
- component: 'Select',
- componentProps: {
- options: dictTypeListData,
- optionsAlias: {
- labelField: 'label',
- valueField: 'value'
- }
- }
- }
+ isSearch: false,
+ isTableForm: false,
+ isDetail: false,
+ isTable: false,
+ isForm: false,
+ },
+ {
+ label: '字典名称',
+ field: 'dictionaryLabel',
+ sort: 'custom',
+ isSearch: false,
+ isTableForm: false,
+ isDetail: false,
+ isTable: false,
+ isForm: false,
},
{
label: '评估代码',
field: 'estimateCode',
sort: 'custom',
isSearch: true,
- dictType: DICT_TYPE.DICTIONARY_CLASS,
+ dictType: DICT_TYPE.EVALUATION_CODE,
dictClass: 'string',
tableForm: {
type: 'Select',
diff --git a/src/views/qms/basicDataManage/selectedSet/index.vue b/src/views/qms/basicDataManage/selectedSet/index.vue
index f4513d891..7e6bc2a31 100644
--- a/src/views/qms/basicDataManage/selectedSet/index.vue
+++ b/src/views/qms/basicDataManage/selectedSet/index.vue
@@ -50,7 +50,7 @@
:apiUpdate="SelectedSetApi.updateSelectedSet"
:apiCreate="SelectedSetApi.createSelectedSet"
@searchTableSuccess="searchTableSuccess"
- :isBusiness="false"
+ :isBusiness="true"
@onChange="onChange"
@handleAddTable="handleAddTable"
@handleDeleteTable="handleDeleteTable"
@@ -92,6 +92,7 @@ import { SelectedProject,SelectedProjectRules } from '../selectedProject/selecte
import * as SelectedProjectApi from '@/api/qms/selectedProject'
import * as DictDataApi from '@/api/system/dict/dict.data'
import component from 'virtual:svg-icons-register'
+import * as DictTypeApi from '@/api/system/dict/dict.type'
// import TableHead from '@/components/TableHead/src/TableHead.vue'
// import ImportForm from '@/components/ImportForm/src/ImportForm.vue'
// import Detail from '@/components/Detail/src/Detail.vue'
@@ -105,9 +106,11 @@ const route = useRoute() // 路由信息
const tableData = ref([])
const routeName = ref()
const selectDictType = ref()
+const optionsList = ref()
routeName.value = route.name
const tableColumns = ref(SelectedSet.allSchemas.tableColumns)
+
// 查询页面返回
const searchTableSuccess = (formField, searchField, val, formRef) => {
nextTick(() => {
@@ -287,7 +290,21 @@ const handleDeleteTable = (item, index) => {
// 主子数据 提交
const submitForm = async (formType, data) => {
+
data.selectedProjectDOList = tableData.value// 拼接子表数据参数
+ data.selectedProjectDOList = data.selectedProjectDOList.map(item => {
+ // 按照 '-%%%-'' 拆分 dictionaryCode
+ const [dictionaryCode, dictionaryValue] = item.dictionaryTypeAndCode.split('-%%%-');
+ const dictionary = optionsList.value.find(temp => temp.options.some(option => option.value === item.dictionaryTypeAndCode))
+ const dictionaryLabel = dictionary?.options.find(option => option.value === item.dictionaryTypeAndCode)?.label
+ // 返回一个新对象,包含拆分后的 dictionaryCode 和 dictionaryValue,以及原始项中的其他属性
+ return {
+ ...item,
+ dictionaryCode,
+ dictionaryValue,
+ dictionaryLabel
+ };
+ });
console.log(data.subList)
try {
if (formType === 'create') {
@@ -321,20 +338,21 @@ const detailOpenForm = (type, row, masterParmas) => {
-const detailBasiFormOnChange = (field,val) => {
+const detailBasiFormOnChange = (field,val,detailFormRef) => {
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
- }
+ console.log(33,detailFormRef)
+ if(field == 'dictionaryTypeAndCode'){
+ // 按照 '-%%%-'' 拆分 dictionaryCode
+ const [dictionaryCode, dictionaryValue] = val.split('-%%%-');
+ const dictionary = optionsList.value.find(temp => temp.options.some(option => option.value === val))
+ const dictionaryLabel = dictionary?.options.find(option => option.value === val)?.label
+ const setV = {}
+ setV['dictionaryLabel'] = dictionaryLabel
+ setV['dictionaryCode'] = dictionaryCode
+ setV['dictionaryValue'] = dictionaryValue
+ nextTick(() => {
+ detailFormRef.setValues(setV)
})
- })
}
}
@@ -342,9 +360,24 @@ const formSelectChange = (a,b,c,d) => {
console.log(111)
}
+const getDicDetails = ()=>{
+ DictTypeApi.getDictTypeAndData('inspection').then(res=>{
+ res.forEach(element => {
+ element.options = element.dictDataRespVOList.map(item => {
+ return {
+ value: element.type + "-%%%-" + item.value,
+ label: element.name + "-" + item.label
+ }
+ })
+ })
+ optionsList.value = res
+ })
+}
+
/** 初始化 **/
onMounted(async () => {
getList()
+ getDicDetails()
importTemplateData.templateUrl = await SelectedSetApi.importTemplate()
})
diff --git a/src/views/qms/basicDataManage/selectedSet/selectedSet.data.ts b/src/views/qms/basicDataManage/selectedSet/selectedSet.data.ts
index e4e1d6f0d..a6db09237 100644
--- a/src/views/qms/basicDataManage/selectedSet/selectedSet.data.ts
+++ b/src/views/qms/basicDataManage/selectedSet/selectedSet.data.ts
@@ -25,17 +25,6 @@ export const SelectedSet = useCrudSchemas(reactive([
sort: 'custom',
isSearch: true
},
- {
- label: '分类',
- field: 'classification',
- sort: 'custom',
- isSearch: true,
- dictType: DICT_TYPE.EVALUATION_CODE,
- dictClass: 'string',
- tableForm: {
- type: 'Select',
- }
- },
{
label: '操作',
field: 'action',
@@ -43,6 +32,8 @@ export const SelectedSet = useCrudSchemas(reactive([
table: {
width: 150,
fixed: 'right'
- }
+ },
+ isTableForm: false,
+ isDetail: false
}
]))
diff --git a/src/views/system/dict/DictTypeForm.vue b/src/views/system/dict/DictTypeForm.vue
index 5e416d785..b8caa504f 100644
--- a/src/views/system/dict/DictTypeForm.vue
+++ b/src/views/system/dict/DictTypeForm.vue
@@ -17,6 +17,19 @@
placeholder="请输入参数名称"
/>
+
+
+
+
+