Compare commits
2 Commits
34c9eaf1bb
...
77c7262978
| Author | SHA1 | Date |
|---|---|---|
|
|
77c7262978 | |
|
|
02f0ad9461 |
|
|
@ -246,7 +246,7 @@
|
|||
if (data && data[0]) {
|
||||
data[0].db_codecolumnsList.forEach((item) => {
|
||||
arr.push({
|
||||
label: item.dbColumnName,
|
||||
label: item.dbColumnName + '(' + item.description + ')',
|
||||
value: item.dbColumnName,
|
||||
csType: item.csType,
|
||||
});
|
||||
|
|
|
|||
|
|
@ -90,14 +90,16 @@ export function toLine(str: string) {
|
|||
export function formItemsForEach(array: IVFormComponent[], cb: (item: IVFormComponent) => void) {
|
||||
if (!isArray(array)) return;
|
||||
const traverse = (schemas: IVFormComponent[]) => {
|
||||
schemas.forEach((formItem: IVFormComponent) => {
|
||||
if (['Grid'].includes(formItem.component)) {
|
||||
// 栅格布局
|
||||
formItem.columns?.forEach((item) => traverse(item.children));
|
||||
} else {
|
||||
cb(formItem);
|
||||
}
|
||||
});
|
||||
if (schemas) {
|
||||
schemas.forEach((formItem: IVFormComponent) => {
|
||||
if (['Grid'].includes(formItem.component)) {
|
||||
// 栅格布局
|
||||
formItem.columns?.forEach((item) => traverse(item.children));
|
||||
} else {
|
||||
cb(formItem);
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
traverse(array);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@
|
|||
class="table-container form-call-table"
|
||||
:style="`${haveMap ? `width:${100 - mapSetData.width}%;` : 'width:100%'}`"
|
||||
>
|
||||
<BasicTable @register="registerTable" @row-click="handRowClick">
|
||||
<BasicTable @register="registerTable" @row-click="handRowClick" :searchInfo="searchInfo">
|
||||
<template #toolbar>
|
||||
<div v-for="(item, index) in btnArr" :key="index">
|
||||
<a-button :type="item.class" @click="handleClickForm(item.prop)">{{
|
||||
|
|
@ -98,7 +98,7 @@
|
|||
// import MapboxMap from '@/components/MapboxMaps/MapComponent.vue'
|
||||
import ShowFormModal from './ShowFormModal/index.vue';
|
||||
import { v4 as uuidv4 } from 'uuid';
|
||||
import { cardNestStructure } from '@/views/demo/onlineform/util.ts'
|
||||
import { cardNestStructure } from '@/views/demo/onlineform/util.ts';
|
||||
|
||||
const MapboxMap = defineAsyncComponent(() => import('@/components/MapboxMaps/MapComponent.vue'));
|
||||
|
||||
|
|
@ -124,11 +124,11 @@
|
|||
const treeVisible: any = ref(false);
|
||||
const paramsId: any = ref();
|
||||
const designData: any = ref();
|
||||
const searchValue: any = ref();
|
||||
const searchInfo: any = ref({});
|
||||
const addParamsArr: any = ref([]);
|
||||
const paramsCode = route.query.code;
|
||||
const callColumns: BasicColumn[] = [];
|
||||
const searchFormSchema: FormSchema[] = ref([]);
|
||||
const searchFormSchema: FormSchema[] = [];
|
||||
const btnList: any = ref([]);
|
||||
const treeData = ref<TreeItem[]>([]);
|
||||
const asyncExpandTreeRef = ref<Nullable<TreeActionType>>(null);
|
||||
|
|
@ -137,8 +137,8 @@
|
|||
const flowCode = ref(''); //流程code
|
||||
const flowFormData = ref({}); //编辑时表单的数据
|
||||
const isUpdate = ref(false); //是否是编辑
|
||||
const infoUseSubTableData = ref()
|
||||
const infoUseMainTableData = ref({})
|
||||
const infoUseSubTableData = ref();
|
||||
const infoUseMainTableData = ref({});
|
||||
// 展示的图层列表
|
||||
const layers = reactive([
|
||||
{
|
||||
|
|
@ -182,7 +182,7 @@
|
|||
// 图层定位数据
|
||||
const location = reactive([118.556717, 35.80391]);
|
||||
if (paramsCode == '数据统计') {
|
||||
searchFormSchema.value = [
|
||||
searchFormSchema = [
|
||||
{
|
||||
field: 'typeid',
|
||||
component: 'ApiSelect',
|
||||
|
|
@ -231,7 +231,7 @@
|
|||
},
|
||||
];
|
||||
} else if (paramsCode == '数据审核') {
|
||||
searchFormSchema.value = [
|
||||
searchFormSchema = [
|
||||
{
|
||||
field: 'typeid',
|
||||
component: 'ApiSelect',
|
||||
|
|
@ -299,15 +299,20 @@
|
|||
showTableSetting: true,
|
||||
bordered: true,
|
||||
beforeFetch: (data) => {
|
||||
console.log('item.key', data)
|
||||
// 接口请求前 参数处理
|
||||
const querys = JSON.parse(JSON.stringify(data));
|
||||
console.log('1111', querys)
|
||||
delete querys.page;
|
||||
delete querys.limit;
|
||||
console.log('querys', querys)
|
||||
var temp = {
|
||||
id: paramsId.value,
|
||||
paginationInputDto: {
|
||||
page: data.page,
|
||||
rows: data.limit,
|
||||
keyWord: data.key,
|
||||
},
|
||||
queryJson: searchValue.value,
|
||||
queryJson: JSON.stringify(querys),
|
||||
};
|
||||
return temp;
|
||||
},
|
||||
|
|
@ -576,7 +581,7 @@
|
|||
const rel = selected.node.dataRef;
|
||||
const obj: any = {};
|
||||
obj[rel.key] = rel.value;
|
||||
searchValue.value = JSON.stringify(obj);
|
||||
searchInfo.value = JSON.stringify(obj);
|
||||
reload();
|
||||
}
|
||||
|
||||
|
|
@ -589,8 +594,8 @@
|
|||
let formObj = JSON.parse(res.formScheme.scheme);
|
||||
console.log('formObj', formObj);
|
||||
// 将card嵌套起来
|
||||
formObj.formInfo.tabList = cardNestStructure(formObj.formInfo.tabList)
|
||||
if (formObj.formInfo.tabList && formObj.formInfo.tabList.length > 1) {
|
||||
formObj.formInfo.tabList = cardNestStructure(formObj.formInfo.tabList);
|
||||
const arr: any = [];
|
||||
formObj.formInfo.tabList.forEach((item, index) => {
|
||||
arr.push({
|
||||
|
|
@ -633,7 +638,7 @@
|
|||
layerFields: {},
|
||||
};
|
||||
}
|
||||
console.log('columnObj', columnObj)
|
||||
console.log('columnObj', columnObj);
|
||||
paramsId.value = res.formScheme.id;
|
||||
btnList.value = columnObj.table.btns;
|
||||
if (columnObj.table.columns) {
|
||||
|
|
@ -644,6 +649,16 @@
|
|||
});
|
||||
});
|
||||
}
|
||||
if (columnObj.table.querys) {
|
||||
columnObj.table.querys.forEach((item) => {
|
||||
searchFormSchema.push({
|
||||
field: item.key,
|
||||
component: item.type || 'Input',
|
||||
label: item.label,
|
||||
colProps: { span: 6 },
|
||||
});
|
||||
});
|
||||
}
|
||||
callColumns.forEach((item) => {
|
||||
formObj.formInfo.schemas.forEach((val) => {
|
||||
if (item.dataIndex == val.field && val.componentProps.options) {
|
||||
|
|
@ -731,9 +746,9 @@
|
|||
key: uuidv4(),
|
||||
};
|
||||
});
|
||||
res[mainTableName].forEach(item => {
|
||||
infoUseMainTableData.value = {...infoUseMainTableData.value, ...item}
|
||||
})
|
||||
res[mainTableName].forEach((item) => {
|
||||
infoUseMainTableData.value = { ...infoUseMainTableData.value, ...item };
|
||||
});
|
||||
})
|
||||
.catch((err) => {
|
||||
console.log('err', err);
|
||||
|
|
|
|||
|
|
@ -271,7 +271,7 @@
|
|||
!['Upload', 'Uploadimg', 'Password', 'Timerange', 'Datetimerange'].includes(t.component),
|
||||
)
|
||||
.map((t) => {
|
||||
return { key: t.field, label: t.label };
|
||||
return { key: t.field, label: t.label, type: t.component };
|
||||
});
|
||||
|
||||
// 常用按钮-树
|
||||
|
|
|
|||
|
|
@ -117,31 +117,32 @@
|
|||
return arr;
|
||||
}
|
||||
const changeCardStructure = (data) => {
|
||||
let result = []
|
||||
data.forEach(item => {
|
||||
if(item.component === "Tabs"){
|
||||
item.componentProps.options = changeCardStructure(item.componentProps.options)
|
||||
}else if(item.children){
|
||||
item.children = changeCardStructure(item.children)
|
||||
}else{
|
||||
if(["Grid","Card"].includes(item.component)){
|
||||
item.columns[0].children= changeCardStructure(item.columns[0].children)
|
||||
if(item.component === 'Card'){
|
||||
item.columns[0].children.forEach(childItem => {
|
||||
if(childItem.pfield){
|
||||
result.push(childItem)
|
||||
}else{
|
||||
result.push({...childItem, ptype: "card", pfield: item.field})
|
||||
}
|
||||
})
|
||||
|
||||
let result = [];
|
||||
if (data && data.length > 1) {
|
||||
data.forEach((item) => {
|
||||
if (item.component === 'Tabs') {
|
||||
item.componentProps.options = changeCardStructure(item.componentProps.options);
|
||||
} else if (item.children) {
|
||||
item.children = changeCardStructure(item.children);
|
||||
} else {
|
||||
if (['Grid', 'Card'].includes(item.component)) {
|
||||
item.columns[0].children = changeCardStructure(item.columns[0].children);
|
||||
if (item.component === 'Card' && item.columns[0].children) {
|
||||
item.columns[0].children.forEach((childItem) => {
|
||||
if (childItem.pfield) {
|
||||
result.push(childItem);
|
||||
} else {
|
||||
result.push({ ...childItem, ptype: 'card', pfield: item.field });
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
result.push(item)
|
||||
})
|
||||
return result
|
||||
}
|
||||
result.push(item);
|
||||
});
|
||||
return result;
|
||||
}
|
||||
};
|
||||
async function designSendGrandson(value) {
|
||||
let designTab = JSON.parse(value);
|
||||
let schems = saveFormDatas.value.scheme.scheme
|
||||
|
|
@ -177,9 +178,19 @@
|
|||
if (item.type == 'subTable') {
|
||||
item.columns = changeCloums(item.columns, tableData);
|
||||
}
|
||||
tabArr.push(item.componentProps.fieldName);
|
||||
if (!item.componentProps.fieldName) {
|
||||
tabLabelArr.push(item.label);
|
||||
if (
|
||||
item.component != 'CardGroup' &&
|
||||
item.component != 'Grid' &&
|
||||
item.component != 'MapGeom' &&
|
||||
item.component != 'Divider' &&
|
||||
item.component != 'Slider' &&
|
||||
item.component != 'Card' &&
|
||||
item.component != 'Location'
|
||||
) {
|
||||
tabArr.push(item.componentProps.fieldName);
|
||||
if (!item.componentProps.fieldName) {
|
||||
tabLabelArr.push(item.label);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
item.componentProps.options.forEach((val) => {
|
||||
|
|
@ -201,16 +212,26 @@
|
|||
if (list.type == 'subTable') {
|
||||
list.columns = changeCloums(list.columns, tableData);
|
||||
}
|
||||
tabArr.push(list.componentProps.fieldName);
|
||||
if (!list.componentProps.fieldName) {
|
||||
tabLabelArr.push(list.label);
|
||||
if (
|
||||
list.component != 'CardGroup' &&
|
||||
list.component != 'Grid' &&
|
||||
list.component != 'MapGeom' &&
|
||||
list.component != 'Divider' &&
|
||||
list.component != 'Slider' &&
|
||||
list.component != 'Card' &&
|
||||
list.component != 'Location'
|
||||
) {
|
||||
tabArr.push(list.componentProps.fieldName);
|
||||
if (!list.componentProps.fieldName) {
|
||||
tabLabelArr.push(list.label);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
// 将Card的孩子改成和Card同级别
|
||||
designTab.schemas = changeCardStructure(designTab.schemas)
|
||||
designTab.schemas = changeCardStructure(designTab.schemas);
|
||||
let tabList: any = [];
|
||||
if (designTab.schemas.length > 1) {
|
||||
tabList.push({
|
||||
|
|
@ -428,8 +449,8 @@
|
|||
} else {
|
||||
//编辑
|
||||
let schems = JSON.parse(saveFormDatas.value.scheme.scheme);
|
||||
// 将Card同级嵌套起来
|
||||
schems.formInfo.tabList = cardNestStructure(schems.formInfo.tabList)
|
||||
// 将Card同级嵌套起来
|
||||
schems.formInfo.tabList = cardNestStructure(schems.formInfo.tabList);
|
||||
schems.db = arr;
|
||||
(schems.rdb = data.connect || []), (saveFormDatas.value.info.category = data.form.category);
|
||||
saveFormDatas.value.info.description = data.form.description;
|
||||
|
|
@ -445,33 +466,33 @@
|
|||
}
|
||||
|
||||
const cardNestStructure = (data) => {
|
||||
let childList = {}
|
||||
let result = []
|
||||
data.forEach(item => {
|
||||
if(item.schemas){
|
||||
item.schemas = cardNestStructure(item.schemas)
|
||||
result.push(item)
|
||||
}else if(item.ptype){
|
||||
let pushItem = {}
|
||||
Object.keys(item).forEach(key => {
|
||||
if(key !== 'ptype' && key !== 'pfield'){
|
||||
pushItem[key] = item[key]
|
||||
let childList = {};
|
||||
let result = [];
|
||||
data.forEach((item) => {
|
||||
if (item.schemas) {
|
||||
item.schemas = cardNestStructure(item.schemas);
|
||||
result.push(item);
|
||||
} else if (item.ptype) {
|
||||
let pushItem = {};
|
||||
Object.keys(item).forEach((key) => {
|
||||
if (key !== 'ptype' && key !== 'pfield') {
|
||||
pushItem[key] = item[key];
|
||||
}
|
||||
})
|
||||
if(childList[item.pfield]){
|
||||
childList[item.pfield].push(pushItem)
|
||||
}else{
|
||||
childList[item.pfield] = [pushItem]
|
||||
});
|
||||
if (childList[item.pfield]) {
|
||||
childList[item.pfield].push(pushItem);
|
||||
} else {
|
||||
childList[item.pfield] = [pushItem];
|
||||
}
|
||||
}else if(item.component === 'Card'){
|
||||
item.columns[0].children = childList[item.field]
|
||||
result.push(item)
|
||||
}else{
|
||||
result.push(item)
|
||||
} else if (item.component === 'Card') {
|
||||
item.columns[0].children = childList[item.field];
|
||||
result.push(item);
|
||||
} else {
|
||||
result.push(item);
|
||||
}
|
||||
})
|
||||
return result
|
||||
}
|
||||
});
|
||||
return result;
|
||||
};
|
||||
// 自动建表返回后,保存数据
|
||||
function automaticFormDataBack(data) {
|
||||
if (isStageClick.value && stepsCurrent.value === 0) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue