|
@@ -86,6 +86,7 @@ import {useRoute, useRouter} from 'vue-router'
|
|
|
import {buildFileUrl} from '@/utils'
|
|
import {buildFileUrl} from '@/utils'
|
|
|
import {DynamicTbApi} from '@/api/pressure2/dynamictb'
|
|
import {DynamicTbApi} from '@/api/pressure2/dynamictb'
|
|
|
import {DynamicTbInsApi} from '@/api/pressure2/dynamictbins'
|
|
import {DynamicTbInsApi} from '@/api/pressure2/dynamictbins'
|
|
|
|
|
+import {getSimpleDictDataList} from '@/api/system/dict/dict.data'
|
|
|
import axios from 'axios'
|
|
import axios from 'axios'
|
|
|
|
|
|
|
|
const route = useRoute()
|
|
const route = useRoute()
|
|
@@ -222,6 +223,8 @@ const fetchTemplateData = async () => {
|
|
|
let properties = {}; //bindingPathSchema.properties;
|
|
let properties = {}; //bindingPathSchema.properties;
|
|
|
let bindingPathName = [];
|
|
let bindingPathName = [];
|
|
|
let schemaSources = await getTbCols();
|
|
let schemaSources = await getTbCols();
|
|
|
|
|
+ // 获取字典数据,供组合框使用
|
|
|
|
|
+ const dictDataList = await getSimpleDictDataList();
|
|
|
|
|
|
|
|
schemaSources?.forEach(element => {
|
|
schemaSources?.forEach(element => {
|
|
|
if (element.colValType == 5){
|
|
if (element.colValType == 5){
|
|
@@ -247,7 +250,48 @@ const fetchTemplateData = async () => {
|
|
|
dataFieldType: 'checkbox',
|
|
dataFieldType: 'checkbox',
|
|
|
type: 'string'
|
|
type: 'string'
|
|
|
}
|
|
}
|
|
|
- }else {
|
|
|
|
|
|
|
+ } else if (element.colValType == 7) {
|
|
|
|
|
+ // 下拉字典
|
|
|
|
|
+ let items = {
|
|
|
|
|
+ type: 'array',
|
|
|
|
|
+ properties: {}
|
|
|
|
|
+ }
|
|
|
|
|
+ // 根据备注中的字典 code,从字典数据中获取下拉选项
|
|
|
|
|
+ const dictCode = element.note
|
|
|
|
|
+ const matchedDict = (dictDataList || []).filter(item => item.dictType === dictCode)
|
|
|
|
|
+
|
|
|
|
|
+ matchedDict.forEach(dict => {
|
|
|
|
|
+ items.properties[dict.label] = {
|
|
|
|
|
+ type: 'string',
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+
|
|
|
|
|
+ properties[element.colCode] = {
|
|
|
|
|
+ dataFieldType: 'combox',
|
|
|
|
|
+ type: 'string',
|
|
|
|
|
+ items: items,
|
|
|
|
|
+ }
|
|
|
|
|
+ } else if (element.colValType == 8) {
|
|
|
|
|
+ // 下拉选项
|
|
|
|
|
+ let items = {
|
|
|
|
|
+ type: 'array',
|
|
|
|
|
+ properties: {}
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ element.note.split(',').forEach(dict => {
|
|
|
|
|
+ items.properties[dict.label] = {
|
|
|
|
|
+ type: 'string',
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+ console.log(items);
|
|
|
|
|
+
|
|
|
|
|
+ properties[element.colCode] = {
|
|
|
|
|
+ dataFieldType: 'combox',
|
|
|
|
|
+ type: 'string',
|
|
|
|
|
+ items: items,
|
|
|
|
|
+ }
|
|
|
|
|
+ } else {
|
|
|
properties[element.colCode] = {
|
|
properties[element.colCode] = {
|
|
|
dataFieldType: 'text',
|
|
dataFieldType: 'text',
|
|
|
type: 'string'
|
|
type: 'string'
|
|
@@ -263,6 +307,7 @@ const fetchTemplateData = async () => {
|
|
|
}
|
|
}
|
|
|
)
|
|
)
|
|
|
});
|
|
});
|
|
|
|
|
+ spread.options.allowDynamicArray = true;
|
|
|
bindingPathSchema.properties = properties;
|
|
bindingPathSchema.properties = properties;
|
|
|
spreadDesignerRef.value.setDefaultSchema(JSON.stringify(bindingPathSchema), JSON.stringify(bindingPathName))
|
|
spreadDesignerRef.value.setDefaultSchema(JSON.stringify(bindingPathSchema), JSON.stringify(bindingPathName))
|
|
|
|
|
|