Compare commits
25 Commits
6613137a83
...
ac43d1a57d
| Author | SHA1 | Date |
|---|---|---|
|
|
ac43d1a57d | |
|
|
37d0342a59 | |
|
|
5f7500734a | |
|
|
7f0f3ae1db | |
|
|
66367d5a8b | |
|
|
470e9d206d | |
|
|
c6dd96a225 | |
|
|
fd55ae920d | |
|
|
9d1ed0c651 | |
|
|
f4bbe2c71d | |
|
|
dabb028f3e | |
|
|
a09621f9cb | |
|
|
5927453973 | |
|
|
b65fb597a3 | |
|
|
2b53d052ea | |
|
|
a05c35e1db | |
|
|
698050eb3d | |
|
|
947e8ad260 | |
|
|
930b4edccd | |
|
|
0b62a65019 | |
|
|
a560632df9 | |
|
|
6e7a671ec0 | |
|
|
09cfeb75d5 | |
|
|
ae1138c59f | |
|
|
192709831c |
|
|
@ -16,6 +16,7 @@ import {
|
||||||
CodeTable_GetForms_Responses_Model,
|
CodeTable_GetForms_Responses_Model,
|
||||||
getTableList_Model,
|
getTableList_Model,
|
||||||
CodeTable_ImportTable_Responses_Model,
|
CodeTable_ImportTable_Responses_Model,
|
||||||
|
ShpLayerSourceLoadPage_Model,
|
||||||
} from './model/formSchemeModel';
|
} from './model/formSchemeModel';
|
||||||
import { defHttp } from '@/utils/http/axios';
|
import { defHttp } from '@/utils/http/axios';
|
||||||
|
|
||||||
|
|
@ -76,6 +77,10 @@ enum Api {
|
||||||
AddTable = '/api/DbTable/AddTable',
|
AddTable = '/api/DbTable/AddTable',
|
||||||
// 创建字段
|
// 创建字段
|
||||||
AddColumn = '/api/DbTable/AddColumn',
|
AddColumn = '/api/DbTable/AddColumn',
|
||||||
|
// 地图组件-图层列表
|
||||||
|
ShpLayerSourceLoadPage = '/api/ShpLayerSource/LoadPage',
|
||||||
|
// 地图组件-图层列表-图层选择后-查找字段名
|
||||||
|
GetTableAndViewColumnList = '/api/CodeTable/GetTableAndViewColumnList',
|
||||||
}
|
}
|
||||||
|
|
||||||
// 字典 FormSort
|
// 字典 FormSort
|
||||||
|
|
@ -258,6 +263,17 @@ export function AddTable(params) {
|
||||||
isPrimarykey: 0,
|
isPrimarykey: 0,
|
||||||
decimalDigits: 0,
|
decimalDigits: 0,
|
||||||
});
|
});
|
||||||
|
params.dbColumnInfoList.push({
|
||||||
|
tableName: params.tableName,
|
||||||
|
dbColumnName: 'geomLabelField',
|
||||||
|
dataType: 'varchar',
|
||||||
|
length: 200,
|
||||||
|
columnDescription: '地图组件-标注字段',
|
||||||
|
isNullable: 0,
|
||||||
|
isIdentity: 0,
|
||||||
|
isPrimarykey: 0,
|
||||||
|
decimalDigits: 0,
|
||||||
|
});
|
||||||
return defHttp.post({
|
return defHttp.post({
|
||||||
url: Api.AddTable + '?dbCode=' + params.dbCode,
|
url: Api.AddTable + '?dbCode=' + params.dbCode,
|
||||||
params,
|
params,
|
||||||
|
|
@ -265,7 +281,6 @@ export function AddTable(params) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// 创建字段
|
// 创建字段
|
||||||
|
|
||||||
export function AddColumn(params) {
|
export function AddColumn(params) {
|
||||||
return defHttp.post({
|
return defHttp.post({
|
||||||
url: Api.AddColumn,
|
url: Api.AddColumn,
|
||||||
|
|
@ -273,6 +288,21 @@ export function AddColumn(params) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 地图组件-图层列表
|
||||||
|
export function ShpLayerSourceLoadPage() {
|
||||||
|
return defHttp.get<ShpLayerSourceLoadPage_Model>({
|
||||||
|
url: Api.ShpLayerSourceLoadPage,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 地图组件-图层列表-图层选择后-查找字段名
|
||||||
|
export function GetTableAndViewColumnList(params) {
|
||||||
|
return defHttp.get<CodeTable_GetForms_Responses_Model>({
|
||||||
|
url: Api.GetTableAndViewColumnList,
|
||||||
|
params,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// 获取表单分页数据 【先不写】
|
// 获取表单分页数据 【先不写】
|
||||||
export function functionGetFormDataPage(params: AccountParams) {
|
export function functionGetFormDataPage(params: AccountParams) {
|
||||||
return defHttp.post<FromSchemandAndInfoModel>({
|
return defHttp.post<FromSchemandAndInfoModel>({
|
||||||
|
|
|
||||||
|
|
@ -220,3 +220,16 @@ export type CodeTable_GetForms_Responses_Model = {
|
||||||
db_codetable: db_codetable_Model;
|
db_codetable: db_codetable_Model;
|
||||||
db_codecolumnsList: db_codecolumnsList_Model;
|
db_codecolumnsList: db_codecolumnsList_Model;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// 地图组件-图层列表
|
||||||
|
export interface ShpLayerSourceLoadPage {
|
||||||
|
id: string;
|
||||||
|
name: string;
|
||||||
|
description: string;
|
||||||
|
type: number;
|
||||||
|
image: string;
|
||||||
|
createTime: string;
|
||||||
|
createId: string;
|
||||||
|
relationTable: string;
|
||||||
|
}
|
||||||
|
export type ShpLayerSourceLoadPage_Model = BasicFetchResult<ShpLayerSourceLoadPage>;
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -23,7 +23,6 @@
|
||||||
zoom: 8,
|
zoom: 8,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
// 展示的图层列表
|
// 展示的图层列表
|
||||||
const layers = reactive([
|
const layers = reactive([
|
||||||
{
|
{
|
||||||
|
|
@ -106,16 +105,18 @@
|
||||||
// const feature = "POLYGON ((118.54774514802972 35.80786133598188, 118.54515277045988 35.79816597053564, 118.55919536113471 35.80085134034624, 118.56021460056033 35.80462789316549, 118.5595188628206 35.80695604583504, 118.5580066425723 35.80815336506183, 118.54774514802972 35.80786133598188))"
|
// const feature = "POLYGON ((118.54774514802972 35.80786133598188, 118.54515277045988 35.79816597053564, 118.55919536113471 35.80085134034624, 118.56021460056033 35.80462789316549, 118.5595188628206 35.80695604583504, 118.5580066425723 35.80815336506183, 118.54774514802972 35.80786133598188))"
|
||||||
|
|
||||||
|
|
||||||
let drawFeatures = [{
|
let drawFeatures = [
|
||||||
"columnName": "mapgeom",
|
{
|
||||||
"value": "POLYGON ((118.55901684631719 35.8045110934671, 118.55946931550466 35.80449259041045, 118.55946551324392 35.80463444717644, 118.559024450841 35.80464061486234, 118.55901684631719 35.8045110934671))"
|
"columnName": "mapgeom",
|
||||||
}, {
|
"value": "POLYGON ((118.55901684631719 35.8045110934671, 118.55946931550466 35.80449259041045, 118.55946551324392 35.80463444717644, 118.559024450841 35.80464061486234, 118.55901684631719 35.8045110934671))"
|
||||||
"columnName": "mapgeom",
|
}, {
|
||||||
"value": "POLYGON ((118.5591119028685 35.804344565958516, 118.5594579087177 35.804344565958516, 118.55945410645693 35.80424279914757, 118.55910049608158 35.80423663146167, 118.5591119028685 35.804344565958516))"
|
"columnName": "mapgeom",
|
||||||
}, {
|
"value": "POLYGON ((118.5591119028685 35.804344565958516, 118.5594579087177 35.804344565958516, 118.55945410645693 35.80424279914757, 118.55910049608158 35.80423663146167, 118.5591119028685 35.804344565958516))"
|
||||||
"columnName": "mapgeom",
|
}, {
|
||||||
"value": "POLYGON ((118.55922520818172 35.8049069756666, 118.5594647506927 35.80490080800186, 118.55945714616884 35.80477128705068, 118.55921380139475 35.804783622380114, 118.55922520818172 35.8049069756666))"
|
"columnName": "mapgeom",
|
||||||
}];
|
"value": "POLYGON ((118.55922520818172 35.8049069756666, 118.5594647506927 35.80490080800186, 118.55945714616884 35.80477128705068, 118.55921380139475 35.804783622380114, 118.55922520818172 35.8049069756666))"
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
|
||||||
// 绘图完成返回geom
|
// 绘图完成返回geom
|
||||||
|
|
|
||||||
|
|
@ -21,38 +21,48 @@
|
||||||
<template #addonAfter><PercentageOutlined /></template>
|
<template #addonAfter><PercentageOutlined /></template>
|
||||||
</a-input-number>
|
</a-input-number>
|
||||||
</FormItem>
|
</FormItem>
|
||||||
<!-- <FormItem label="选择图层">
|
<FormItem label="选择图层">
|
||||||
<a-select
|
<a-select
|
||||||
v-model:value="formConfig.currentItem.mapSetData.chooseLayer"
|
v-model:value="formConfig.currentItem.mapSetData.chooseLayer"
|
||||||
:options="options"
|
:options="shpLayerSourceOptions"
|
||||||
mode="tags"
|
|
||||||
size="middle"
|
size="middle"
|
||||||
placeholder="请选择图层"
|
placeholder="请选择图层"
|
||||||
|
@change="handleChangeDataTable"
|
||||||
/>
|
/>
|
||||||
</FormItem>
|
</FormItem>
|
||||||
<FormItem label="图层字段解析">
|
<FormItem label="图层字段解析">
|
||||||
<FormItem label="GID字段">
|
<FormItem label="图层数据表">
|
||||||
<a-input
|
<a-input
|
||||||
v-model:value="formConfig.currentItem.mapSetData.layerFields.gidField"
|
v-model:value="formConfig.currentItem.mapSetData.layerFields.dataTable"
|
||||||
placeholder="请输入GID字段"
|
placeholder="请输入图层数据表"
|
||||||
/>
|
disabled="false"
|
||||||
</FormItem> -->
|
|
||||||
<FormItem label="标注字段">
|
|
||||||
<a-select
|
|
||||||
v-model:value="formConfig.currentItem.mapSetData.layerFields.labelField"
|
|
||||||
:options="formConfig.currentItem.mapSetData.layerFields.labelFieldOptions"
|
|
||||||
size="middle"
|
|
||||||
placeholder="请选择标注字段"
|
|
||||||
/>
|
|
||||||
</FormItem>
|
|
||||||
<!--
|
|
||||||
<FormItem label="geom字段">
|
|
||||||
<a-input
|
|
||||||
v-model:value="formConfig.currentItem.mapSetData.layerFields.geomField"
|
|
||||||
placeholder="请输入geom字段"
|
|
||||||
/>
|
/>
|
||||||
</FormItem>
|
</FormItem>
|
||||||
</FormItem> -->
|
<FormItem label="GID字段">
|
||||||
|
<a-select
|
||||||
|
v-model:value="formConfig.currentItem.mapSetData.layerFields.gidField"
|
||||||
|
:options="formConfig.currentItem.mapSetData.layerFields.labelFieldOptions"
|
||||||
|
size="middle"
|
||||||
|
placeholder="请选择GID字段"
|
||||||
|
/>
|
||||||
|
</FormItem>
|
||||||
|
<FormItem label="名称字段标注">
|
||||||
|
<a-select
|
||||||
|
v-model:value="formConfig.currentItem.mapSetData.layerFields.labelField"
|
||||||
|
:options="formConfig.currentItem.mapSetData.layerFields.labelFieldOptions"
|
||||||
|
size="middle"
|
||||||
|
placeholder="请选择名称字段标注"
|
||||||
|
/>
|
||||||
|
</FormItem>
|
||||||
|
<FormItem label="Geom字段">
|
||||||
|
<a-select
|
||||||
|
v-model:value="formConfig.currentItem.mapSetData.layerFields.geomField"
|
||||||
|
:options="formConfig.currentItem.mapSetData.layerFields.labelFieldOptions"
|
||||||
|
size="middle"
|
||||||
|
placeholder="请选择Geom字段"
|
||||||
|
/>
|
||||||
|
</FormItem>
|
||||||
|
</FormItem>
|
||||||
<FormItem label="是否允许添加图斑">
|
<FormItem label="是否允许添加图斑">
|
||||||
<Switch v-model:checked="formConfig.currentItem.mapSetData.isAllowAddPolygon" />
|
<Switch v-model:checked="formConfig.currentItem.mapSetData.isAllowAddPolygon" />
|
||||||
</FormItem>
|
</FormItem>
|
||||||
|
|
@ -124,7 +134,7 @@
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script lang="ts" setup name="FormItemProps">
|
<script lang="ts" setup name="FormItemProps">
|
||||||
import { computed, watch } from 'vue';
|
import { ref, computed, watch, inject } from 'vue';
|
||||||
import {
|
import {
|
||||||
baseFormItemControlAttrs,
|
baseFormItemControlAttrs,
|
||||||
baseFormItemProps,
|
baseFormItemProps,
|
||||||
|
|
@ -132,15 +142,25 @@
|
||||||
advanceFormItemColProps,
|
advanceFormItemColProps,
|
||||||
} from '../../VFormDesign/config/formItemPropsConfig';
|
} from '../../VFormDesign/config/formItemPropsConfig';
|
||||||
|
|
||||||
import { Empty, Input, Form, FormItem, Switch, Checkbox, Col, SelectProps } from 'ant-design-vue';
|
|
||||||
import { PercentageOutlined } from '@ant-design/icons-vue';
|
import { PercentageOutlined } from '@ant-design/icons-vue';
|
||||||
import RuleProps from './RuleProps.vue';
|
import RuleProps from './RuleProps.vue';
|
||||||
import { useFormDesignState } from '../../../hooks/useFormDesignState';
|
import { useFormDesignState } from '../../../hooks/useFormDesignState';
|
||||||
import { isArray } from 'lodash-es';
|
import { isArray } from 'lodash-es';
|
||||||
|
import { ShpLayerSourceLoadPage, GetTableAndViewColumnList } from '@/api/demo/formScheme';
|
||||||
|
|
||||||
const { formConfig } = useFormDesignState();
|
const { formConfig } = useFormDesignState();
|
||||||
|
|
||||||
const options = [...Array(25)].map((_, i) => ({ value: (i + 10).toString(36) + (i + 1) }));
|
let shpLayerSourceOptions: any = ref([]);
|
||||||
|
let dbcode = ref();
|
||||||
|
const handleNextStepsData = inject('handleNextStepsData');
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => handleNextStepsData,
|
||||||
|
(newVal: any) => {
|
||||||
|
dbcode.value = newVal?.value?.info?.DbCode;
|
||||||
|
},
|
||||||
|
{ deep: true, immediate: true },
|
||||||
|
);
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => formConfig.value,
|
() => formConfig.value,
|
||||||
|
|
@ -151,19 +171,26 @@
|
||||||
formConfig.value.currentItem.itemProps.labelCol || {};
|
formConfig.value.currentItem.itemProps.labelCol || {};
|
||||||
formConfig.value.currentItem.itemProps.wrapperCol =
|
formConfig.value.currentItem.itemProps.wrapperCol =
|
||||||
formConfig.value.currentItem.itemProps.wrapperCol || {};
|
formConfig.value.currentItem.itemProps.wrapperCol || {};
|
||||||
if (formConfig.value.currentItem.field == 'MapGeom') {
|
if (formConfig.value.currentItem.field === 'MapGeom') {
|
||||||
|
// 地图组件
|
||||||
formConfig.value.currentItem.mapSetData = formConfig.value.currentItem.mapSetData || {
|
formConfig.value.currentItem.mapSetData = formConfig.value.currentItem.mapSetData || {
|
||||||
width: 100,
|
width: 100,
|
||||||
|
chooseLayer: '',
|
||||||
layerFields: {},
|
layerFields: {},
|
||||||
isAllowAddPolygon: false,
|
isAllowAddPolygon: false,
|
||||||
isAllowEditPolygon: false,
|
isAllowEditPolygon: false,
|
||||||
isEnablePostionJump: false,
|
isEnablePostionJump: false,
|
||||||
};
|
};
|
||||||
|
// 选择图层
|
||||||
|
if (shpLayerSourceOptions.value.length == 0) {
|
||||||
|
getShpLayerSourceOptions();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{ deep: true, immediate: true },
|
{ deep: true, immediate: true },
|
||||||
);
|
);
|
||||||
|
|
||||||
const showProps = (exclude: string[] | undefined) => {
|
const showProps = (exclude: string[] | undefined) => {
|
||||||
if (!exclude) {
|
if (!exclude) {
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -176,4 +203,53 @@
|
||||||
return showProps(item.exclude);
|
return showProps(item.exclude);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// 选择图层
|
||||||
|
async function getShpLayerSourceOptions() {
|
||||||
|
let options: any = await ShpLayerSourceLoadPage();
|
||||||
|
shpLayerSourceOptions.value = [];
|
||||||
|
options.items.forEach((e) => {
|
||||||
|
shpLayerSourceOptions.value.push({ label: e.name, value: e.relationTable });
|
||||||
|
});
|
||||||
|
}
|
||||||
|
// 选择图层-图层数据表
|
||||||
|
function handleChangeDataTable(table) {
|
||||||
|
formConfig.value.currentItem.mapSetData.layerFields.dataTable = table;
|
||||||
|
if (table) {
|
||||||
|
getShpLayerSource(table);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 图层数据表-GID字段/名称字段标注/Geom字段
|
||||||
|
async function getShpLayerSource(table) {
|
||||||
|
if (formConfig.value.currentItem.field === 'MapGeom') {
|
||||||
|
let querys: any = {
|
||||||
|
dbCode: dbcode.value,
|
||||||
|
tableName: table,
|
||||||
|
};
|
||||||
|
const obj: any = await GetTableAndViewColumnList(querys);
|
||||||
|
let labelFieldOptions: any = [];
|
||||||
|
if (obj.length > 0) {
|
||||||
|
obj.forEach((e) => {
|
||||||
|
labelFieldOptions.push({ label: e.column_name, value: e.column_name });
|
||||||
|
});
|
||||||
|
// GID字段/名称字段标注/Geom字段 下拉选项
|
||||||
|
formConfig.value.currentItem.mapSetData.layerFields.labelFieldOptions = labelFieldOptions;
|
||||||
|
// GID字段
|
||||||
|
formConfig.value.currentItem.mapSetData.layerFields.gidField = obj[0].column_name;
|
||||||
|
// Geom字段
|
||||||
|
formConfig.value.currentItem.mapSetData.layerFields.geomField = obj[1].column_name;
|
||||||
|
// 名称字段标注
|
||||||
|
formConfig.value.currentItem.mapSetData.layerFields.labelField = obj[2].column_name;
|
||||||
|
} else {
|
||||||
|
// GID字段/名称字段标注/Geom字段 下拉选项
|
||||||
|
formConfig.value.currentItem.mapSetData.layerFields.labelFieldOptions = [];
|
||||||
|
// GID字段
|
||||||
|
formConfig.value.currentItem.mapSetData.layerFields.gidField = '';
|
||||||
|
// Geom字段
|
||||||
|
formConfig.value.currentItem.mapSetData.layerFields.geomField = '';
|
||||||
|
// 名称字段标注
|
||||||
|
formConfig.value.currentItem.mapSetData.layerFields.labelField = '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
|
||||||
|
|
@ -168,14 +168,14 @@ export const baseComponentCommonAttrs: Omit<IBaseFormAttrs, 'tag'>[] = [
|
||||||
'Cascader',
|
'Cascader',
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
// {
|
||||||
name: 'style',
|
// name: 'style',
|
||||||
label: '样式',
|
// label: '样式',
|
||||||
component: 'Input',
|
// component: 'Input',
|
||||||
componentProps: {
|
// componentProps: {
|
||||||
placeholder: '请输入样式',
|
// placeholder: '请输入样式',
|
||||||
},
|
// },
|
||||||
},
|
// },
|
||||||
{
|
{
|
||||||
name: 'open',
|
name: 'open',
|
||||||
label: '一直展开下拉菜单',
|
label: '一直展开下拉菜单',
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,8 @@ declare type Value = [number, number] | number;
|
||||||
* 图层字段
|
* 图层字段
|
||||||
*/
|
*/
|
||||||
export interface LayerFields {
|
export interface LayerFields {
|
||||||
|
// 图层数据表
|
||||||
|
dataTable?: string;
|
||||||
// GID字段
|
// GID字段
|
||||||
gidField?: string;
|
gidField?: string;
|
||||||
// 标注字段
|
// 标注字段
|
||||||
|
|
|
||||||
|
|
@ -1,22 +1,22 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="show-form-modal" style="width: 100%;">
|
<div class="show-form-modal" style="width: 100%;">
|
||||||
<div class="title">
|
<div class="title">
|
||||||
<div>{{ getTitle }}</div>
|
<div class="close-button"><ArrowLeftOutlined @click="closeModal"/></div>
|
||||||
<div class="close-button"><CloseCircleOutlined @click="closeModal"/></div>
|
<div style="margin-right:30px;font-size: 25px;">{{ getTitle }}</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-content">
|
<div class="form-content">
|
||||||
<BasicForm ref="myDataBaseFormRef" @register="registerForm" v-if="formModalVisible" />
|
<BasicForm ref="myDataBaseFormRef" @register="registerForm" v-if="formModalVisible" />
|
||||||
<div class="footer-button" v-if="!isDetail">
|
</div>
|
||||||
<a-button style="margin-right: 20px;" @click="closeModal">取消</a-button>
|
<div class="footer-button" v-if="!isDetail">
|
||||||
<a-button type="primary" @click="ModalSureClick">确认</a-button>
|
<a-button style="margin-right: 20px;" @click="closeModal">取消</a-button>
|
||||||
</div>
|
<a-button type="primary" @click="ModalSureClick">确认</a-button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { defineEmits, defineProps, ref, onMounted, unref, reactive, toRaw } from "vue"
|
import { defineEmits, defineProps, ref, onMounted, unref, reactive, toRaw } from "vue"
|
||||||
import { CloseCircleOutlined } from '@ant-design/icons-vue'
|
import { ArrowLeftOutlined } from '@ant-design/icons-vue'
|
||||||
import { BasicForm, useForm } from '@/components/Form';
|
import { BasicForm, useForm } from '@/components/Form';
|
||||||
import { FormSchema } from '@/components/Table';
|
import { FormSchema } from '@/components/Table';
|
||||||
import { create, saveDraft } from '@/api/sys/WFProcess';
|
import { create, saveDraft } from '@/api/sys/WFProcess';
|
||||||
|
|
@ -63,7 +63,6 @@ function generateUniqueDigits(length: number): number[] {
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
const data = props.showFormModalData
|
const data = props.showFormModalData
|
||||||
console.log(1111111,data)
|
|
||||||
isUpdate.value = !!data?.isUpdate;
|
isUpdate.value = !!data?.isUpdate;
|
||||||
isDetail.value = !!data?.isDetail;
|
isDetail.value = !!data?.isDetail;
|
||||||
data.tab.forEach((item) => {
|
data.tab.forEach((item) => {
|
||||||
|
|
@ -107,7 +106,6 @@ onMounted(() => {
|
||||||
});
|
});
|
||||||
}, 100);
|
}, 100);
|
||||||
} else {
|
} else {
|
||||||
console.log('rrreeeeccc');
|
|
||||||
myDataBaseFormRef.value && resetFields();
|
myDataBaseFormRef.value && resetFields();
|
||||||
}
|
}
|
||||||
addQuery.value = [];
|
addQuery.value = [];
|
||||||
|
|
@ -119,7 +117,6 @@ onMounted(() => {
|
||||||
value: generateUniqueDigits(20).join(''),
|
value: generateUniqueDigits(20).join(''),
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
console.log('addQuery', addQuery);
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
@ -131,15 +128,12 @@ async function ModalSureClick() {
|
||||||
let mapGeomList = toRaw(props.mapgemoList).map(item => {
|
let mapGeomList = toRaw(props.mapgemoList).map(item => {
|
||||||
return item.value
|
return item.value
|
||||||
})
|
})
|
||||||
console.log('mapGeomList',mapGeomList)
|
|
||||||
query.MapGeom = mapGeomList.join(";")
|
query.MapGeom = mapGeomList.join(";")
|
||||||
console.log('query', query);
|
|
||||||
let params: any = {
|
let params: any = {
|
||||||
schemeId: primaryQuery.value.id,
|
schemeId: primaryQuery.value.id,
|
||||||
isUpdate: isUpdate.value,
|
isUpdate: isUpdate.value,
|
||||||
pkey: primaryQuery.value.key,
|
pkey: primaryQuery.value.key,
|
||||||
};
|
};
|
||||||
console.log('params', params);
|
|
||||||
if (unref(isUpdate)) {
|
if (unref(isUpdate)) {
|
||||||
params.pkeyValue = primaryQuery.value.keyValue;
|
params.pkeyValue = primaryQuery.value.keyValue;
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -153,8 +147,6 @@ async function ModalSureClick() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
params.data = JSON.stringify(query);
|
params.data = JSON.stringify(query);
|
||||||
console.log('query222', query);
|
|
||||||
console.log('params222', params);
|
|
||||||
const data = await saveFormsData(params);
|
const data = await saveFormsData(params);
|
||||||
if (data) {
|
if (data) {
|
||||||
emits('success');
|
emits('success');
|
||||||
|
|
@ -218,15 +210,17 @@ async function handleCreateFlow(processId) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.form-content{
|
.form-content{
|
||||||
padding: 25px;
|
padding: 25px 25px 0px 25px;
|
||||||
height: calc(100% - 50px);
|
height: calc(100% - 97px);
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
.footer-button{
|
overflow: auto;
|
||||||
display: flex;
|
margin-bottom: 15px;
|
||||||
justify-content: flex-end;
|
}
|
||||||
}
|
.footer-button{
|
||||||
|
display: flex;
|
||||||
|
justify-content: flex-end;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@
|
||||||
@select="handleSelect"
|
@select="handleSelect"
|
||||||
/>
|
/>
|
||||||
<div style="display: flex;width:100%;">
|
<div style="display: flex;width:100%;">
|
||||||
<div class="table-container" :style="`${haveMap? 'width:50%;':'width:100%'}`">
|
<div 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">
|
||||||
<template #toolbar>
|
<template #toolbar>
|
||||||
<div v-for="(item, index) in btnArr" :key="index">
|
<div v-for="(item, index) in btnArr" :key="index">
|
||||||
|
|
@ -29,7 +29,7 @@
|
||||||
<ShowFormModal v-if="openShowFormModal" :showFormModalData="showFormModalData" :mapgemoList="mapgemoList"
|
<ShowFormModal v-if="openShowFormModal" :showFormModalData="showFormModalData" :mapgemoList="mapgemoList"
|
||||||
@closeShowFormModal="closeShowFormModal" @success="submitsuccess"/>
|
@closeShowFormModal="closeShowFormModal" @success="submitsuccess"/>
|
||||||
</div>
|
</div>
|
||||||
<div v-if="haveMap" style="width:50%;height:calc(100vh - 78px) ">
|
<div v-if="haveMap" class="form-call-showMap" :style="`width:${mapSetData.width}%;height:calc(100vh - 78px) `">
|
||||||
<MapboxMap
|
<MapboxMap
|
||||||
:layers="layers"
|
:layers="layers"
|
||||||
:location="location"
|
:location="location"
|
||||||
|
|
@ -58,7 +58,7 @@
|
||||||
</PageWrapper>
|
</PageWrapper>
|
||||||
</template>
|
</template>
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { onMounted, ref, nextTick, unref, h, reactive } from 'vue';
|
import { onMounted, ref, nextTick, unref, h, reactive, defineAsyncComponent } from 'vue';
|
||||||
import { useRoute } from 'vue-router';
|
import { useRoute } from 'vue-router';
|
||||||
import { BasicTable, useTable, BasicColumn, FormSchema } from '@/components/Table';
|
import { BasicTable, useTable, BasicColumn, FormSchema } from '@/components/Table';
|
||||||
import { BasicTree, TreeItem, TreeActionItem, TreeActionType } from '@/components/Tree';
|
import { BasicTree, TreeItem, TreeActionItem, TreeActionType } from '@/components/Tree';
|
||||||
|
|
@ -71,9 +71,13 @@
|
||||||
import { useMessage } from '@/hooks/web/useMessage';
|
import { useMessage } from '@/hooks/web/useMessage';
|
||||||
import CallModal from './CallModal.vue';
|
import CallModal from './CallModal.vue';
|
||||||
import CreateFlow from './CreateFlow.vue';
|
import CreateFlow from './CreateFlow.vue';
|
||||||
import MapboxMap from '@/components/MapboxMaps/MapComponent.vue'
|
// import MapboxMap from '@/components/MapboxMaps/MapComponent.vue'
|
||||||
import ShowFormModal from './ShowFormModal/index.vue';
|
import ShowFormModal from './ShowFormModal/index.vue';
|
||||||
|
|
||||||
|
const MapboxMap = defineAsyncComponent(() =>
|
||||||
|
import('@/components/MapboxMaps/MapComponent.vue')
|
||||||
|
)
|
||||||
|
|
||||||
const { createConfirm, createMessage } = useMessage();
|
const { createConfirm, createMessage } = useMessage();
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const btnArr: any = [
|
const btnArr: any = [
|
||||||
|
|
@ -82,6 +86,9 @@
|
||||||
{ label: '删除', prop: 'Delete', class: 'error' },
|
{ label: '删除', prop: 'Delete', class: 'error' },
|
||||||
{ label: '详情', prop: 'Details', class: 'default' },
|
{ label: '详情', prop: 'Details', class: 'default' },
|
||||||
];
|
];
|
||||||
|
const mapSetData = ref({
|
||||||
|
width:100
|
||||||
|
})
|
||||||
const mapgemoList = ref([])
|
const mapgemoList = ref([])
|
||||||
const MapboxComponent = ref()
|
const MapboxComponent = ref()
|
||||||
const openShowFormModal = ref(false)
|
const openShowFormModal = ref(false)
|
||||||
|
|
@ -362,10 +369,8 @@
|
||||||
if (rows.length > 0) {
|
if (rows.length > 0) {
|
||||||
query.value.keyValue = rows[0][str.value];
|
query.value.keyValue = rows[0][str.value];
|
||||||
}
|
}
|
||||||
console.log('btnList',btnList.value)
|
|
||||||
switch (status) {
|
switch (status) {
|
||||||
case 'Add':
|
case 'Add':
|
||||||
console.log(btnList.valueField);
|
|
||||||
btnList.value.forEach((element) => {
|
btnList.value.forEach((element) => {
|
||||||
if (element.prop === 'Add' && element.isWFlow) {
|
if (element.prop === 'Add' && element.isWFlow) {
|
||||||
flowCode.value = element.wFlowCode;
|
flowCode.value = element.wFlowCode;
|
||||||
|
|
@ -384,10 +389,7 @@
|
||||||
showFormModalData.value = toProps
|
showFormModalData.value = toProps
|
||||||
openShowFormModal.value = true
|
openShowFormModal.value = true
|
||||||
mapgemoList.value = []
|
mapgemoList.value = []
|
||||||
// const feature = "POLYGON ((118.54774514802972 35.80786133598188, 118.54515277045988 35.79816597053564, 118.55919536113471 35.80085134034624, 118.56021460056033 35.80462789316549, 118.5595188628206 35.80695604583504, 118.5580066425723 35.80815336506183, 118.54774514802972 35.80786133598188))"
|
mapSetData.value.isAllowAddPolygon && MapboxComponent.value.handlerDraw()
|
||||||
// MapboxComponent.value.handlerDraw(feature)
|
|
||||||
// MapboxComponent.value.handlerLocation([118.54774514802972,35.80786133598188]);
|
|
||||||
MapboxComponent.value.handlerDraw()
|
|
||||||
}else{
|
}else{
|
||||||
openModal(true, toProps);
|
openModal(true, toProps);
|
||||||
}
|
}
|
||||||
|
|
@ -419,8 +421,7 @@
|
||||||
if(haveMap.value){
|
if(haveMap.value){
|
||||||
showFormModalData.value = toProps
|
showFormModalData.value = toProps
|
||||||
openShowFormModal.value = true
|
openShowFormModal.value = true
|
||||||
MapboxComponent.value.handlerDraw(mapgemoList.value)
|
MapboxComponent.value.handlerDraw(mapgemoList.value,mapSetData.value.isAllowEditPolygon)
|
||||||
console.log(mapgemoList.value)
|
|
||||||
}else{
|
}else{
|
||||||
openModal(true, toProps);
|
openModal(true, toProps);
|
||||||
}
|
}
|
||||||
|
|
@ -468,8 +469,7 @@
|
||||||
if(haveMap.value){
|
if(haveMap.value){
|
||||||
showFormModalData.value = toProps
|
showFormModalData.value = toProps
|
||||||
openShowFormModal.value = true
|
openShowFormModal.value = true
|
||||||
MapboxComponent.value.handlerDraw(mapgemoList.value)
|
MapboxComponent.value.handlerDraw(mapgemoList.value,false)
|
||||||
// MapboxComponent.value.handlerLocation([1113.640352364387,35.8665000676054])
|
|
||||||
}else{
|
}else{
|
||||||
openModal(true, toProps);
|
openModal(true, toProps);
|
||||||
}
|
}
|
||||||
|
|
@ -496,17 +496,32 @@
|
||||||
};
|
};
|
||||||
getFormsDesignData(params).then((res: Recordable) => {
|
getFormsDesignData(params).then((res: Recordable) => {
|
||||||
let columnObj = JSON.parse(res.entity.scheme);
|
let columnObj = JSON.parse(res.entity.scheme);
|
||||||
console.log(columnObj,'columnObj');
|
|
||||||
let formObj = JSON.parse(res.formScheme.scheme);
|
let formObj = JSON.parse(res.formScheme.scheme);
|
||||||
|
|
||||||
// TODO 判断是否有地图
|
// TODO 判断是否有地图
|
||||||
haveMap.value = formObj.formInfo.schemas.findIndex(item => item.field === "MapGeom") !== -1
|
let mapgeomData = formObj.formInfo.schemas.find(item => item.field === "MapGeom")
|
||||||
|
haveMap.value = mapgeomData !== undefined
|
||||||
console.log(formObj,'formObj');
|
if(haveMap.value){
|
||||||
|
mapSetData.value = mapgeomData.mapSetData || { isAllowAddPolygon: false,
|
||||||
|
isAllowEditPolygon: false,
|
||||||
|
isEnablePostionJump: false,
|
||||||
|
width: 50,
|
||||||
|
layerFields: {},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// todo 修改赋值
|
||||||
|
// mapSetData.value = {
|
||||||
|
// width: 50,
|
||||||
|
// // 可否添加图斑
|
||||||
|
// isAllowAddPolygon: true,
|
||||||
|
// // 可否编辑图斑
|
||||||
|
// isAllowEditPolygon: true,
|
||||||
|
// // 可否跳转到图斑
|
||||||
|
// isEnablePostionJump: true,
|
||||||
|
// layerFields: {},
|
||||||
|
// }
|
||||||
paramsId.value = res.formScheme.id;
|
paramsId.value = res.formScheme.id;
|
||||||
console.log(paramsId.value,'paramsId');
|
|
||||||
btnList.value = columnObj.table.btns;
|
btnList.value = columnObj.table.btns;
|
||||||
console.log(btnList.value,'btnList');
|
|
||||||
if (columnObj.table.columns) {
|
if (columnObj.table.columns) {
|
||||||
columnObj.table.columns.forEach((item) => {
|
columnObj.table.columns.forEach((item) => {
|
||||||
callColumns.push({
|
callColumns.push({
|
||||||
|
|
@ -543,7 +558,6 @@
|
||||||
nextTick(() => {
|
nextTick(() => {
|
||||||
unref(asyncExpandTreeRef)?.expandAll(true);
|
unref(asyncExpandTreeRef)?.expandAll(true);
|
||||||
});
|
});
|
||||||
console.log(formConfig.value,'formConfig')
|
|
||||||
formConfig.value.schemas = formObj.formInfo.schemas;
|
formConfig.value.schemas = formObj.formInfo.schemas;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -562,10 +576,10 @@
|
||||||
});
|
});
|
||||||
const closeShowFormModal = () => {
|
const closeShowFormModal = () => {
|
||||||
openShowFormModal.value = false
|
openShowFormModal.value = false
|
||||||
|
MapboxComponent.value.handlerCancleDraw()
|
||||||
}
|
}
|
||||||
const handRowClick = (record) => {
|
const handRowClick = (record) => {
|
||||||
if(!haveMap.value) return
|
if(!haveMap.value) return
|
||||||
console.log('record',record)
|
|
||||||
let keyValue = null
|
let keyValue = null
|
||||||
Object.keys(record).forEach(key => {
|
Object.keys(record).forEach(key => {
|
||||||
if(key.indexOf('guid') !== -1){
|
if(key.indexOf('guid') !== -1){
|
||||||
|
|
@ -578,23 +592,21 @@
|
||||||
keyValue,
|
keyValue,
|
||||||
}
|
}
|
||||||
getFormData(params).then(res => {
|
getFormData(params).then(res => {
|
||||||
console.log('res',res)
|
|
||||||
mapgemoList.value = []
|
mapgemoList.value = []
|
||||||
res.forEach(item => {
|
res.forEach(item => {
|
||||||
if(item.columnName === "mapgeom"){
|
if(item.columnName === "mapgeom"){
|
||||||
mapgemoList.value.push(item)
|
mapgemoList.value.push(item)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
// console.log('mapgemoList', mapgemoList.value)
|
if(mapgemoList.value.length > 0 && mapSetData.value.isEnablePostionJump){
|
||||||
// let mapData = mapgemoList.value.join(' ')
|
let jumpDataString = mapgemoList.value[0].value
|
||||||
// let data = "POLYGON ((118.52211538509077 35.882871898529494, 118.5243438435118 35.8822923130291, 118.52360102403814 35.88070959877732, 118.52153763661282 35.881021683278426, 118.52211538509077 35.882871898529494))"
|
let jumpDataList = jumpDataString.replace(/[A-Z|(|)]/g, "").split(" ")
|
||||||
// if(mapgemoList.value.length > 0){
|
if(jumpDataString.slice(0,5) === 'POINT'){
|
||||||
// let aaa = mapgemoList.value[0]
|
MapboxComponent.value.handlerLocation([jumpDataList[0],jumpDataList[1]])
|
||||||
// console.log('aaaa',aaa)
|
}else{
|
||||||
// let dataList = mapgemoList.value[0].value.replace(/[A-Z|(|)]/g, "").split(" ")
|
MapboxComponent.value.handlerLocation([jumpDataList[0],jumpDataList[1].split(',')[0]])
|
||||||
// MapboxComponent.value.handlerDraw(mapgemoList.value)
|
}
|
||||||
// MapboxComponent.value.handlerLocation([dataList[1],dataList[2]]);
|
}
|
||||||
// }
|
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
console.log('err',err)
|
console.log('err',err)
|
||||||
})
|
})
|
||||||
|
|
@ -639,4 +651,16 @@
|
||||||
.table-container{
|
.table-container{
|
||||||
position:relative;
|
position:relative;
|
||||||
}
|
}
|
||||||
|
.form-call-table{
|
||||||
|
.ant-form{
|
||||||
|
.ant-form-item-control-input-content{
|
||||||
|
display:flex;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.form-call-showMap{
|
||||||
|
width:100%;
|
||||||
|
background-color: #fff;
|
||||||
|
z-index: 1;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
||||||
|
|
@ -51,6 +51,7 @@
|
||||||
:modalFormVerison="modalFormVerison"
|
:modalFormVerison="modalFormVerison"
|
||||||
:editData="editData"
|
:editData="editData"
|
||||||
:isEdit="isEdit"
|
:isEdit="isEdit"
|
||||||
|
:formVerison_now="formVerison_now"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
<template>
|
<template>
|
||||||
<PageWrapper dense contentFullHeight fixedHeight contentClass="flex">
|
<PageWrapper dense contentFullHeight fixedHeight contentClass="flex">
|
||||||
<div class="m-2 mr-0 w-1/4 xl:w-1/5 overflow-hidden bg-white">
|
<div class="m-2 mr-0 w-1/4 xl:w-1/5 bg-white tree">
|
||||||
<BasicTree
|
<BasicTree
|
||||||
ref="columnsTreeRef"
|
ref="columnsTreeRef"
|
||||||
title="列字段"
|
title="列字段"
|
||||||
|
|
@ -44,6 +44,7 @@
|
||||||
size="small"
|
size="small"
|
||||||
v-model:value="record.align"
|
v-model:value="record.align"
|
||||||
:options="alignOptions"
|
:options="alignOptions"
|
||||||
|
style="width: 100%"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
@ -120,3 +121,10 @@
|
||||||
fetch();
|
fetch();
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<style lang="less" scoped>
|
||||||
|
.tree {
|
||||||
|
overflow: auto;
|
||||||
|
height: calc(100vh - 120px);
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
|
||||||
|
|
@ -3,10 +3,10 @@ import { BasicColumn } from '@/components/Table';
|
||||||
// 步骤一:基本配置 scheme 部分 添加数据库表(请先选择数据库)
|
// 步骤一:基本配置 scheme 部分 添加数据库表(请先选择数据库)
|
||||||
export function columns(): BasicColumn[] {
|
export function columns(): BasicColumn[] {
|
||||||
return [
|
return [
|
||||||
{ title: '列名', dataIndex: 'label', width: '400' },
|
{ title: '列名', dataIndex: 'label', width: 150 },
|
||||||
{ title: '宽度', dataIndex: 'width', width: '120', align: 'center' },
|
{ title: '宽度', dataIndex: 'width', width: 120, align: 'center' },
|
||||||
{ title: '自适应宽度', dataIndex: 'isMinWidth', width: '100', align: 'center' },
|
{ title: '自适应宽度', dataIndex: 'isMinWidth', width: 100, align: 'center' },
|
||||||
{ title: '对齐', dataIndex: 'align', width: '100', align: 'center' },
|
{ title: '对齐', dataIndex: 'align', width: 100, align: 'center' },
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
<template>
|
<template>
|
||||||
<div :class="prefixCls">
|
<div :class="prefixCls">
|
||||||
<PageWrapper dense contentFullHeight fixedHeight contentClass="flex">
|
<PageWrapper dense contentFullHeight fixedHeight contentClass="flex">
|
||||||
<div class="m-2 mr-0 w-1/4 xl:w-1/5 overflow-hidden">
|
<div class="m-2 mr-0 w-1/4 xl:w-1/5 tree">
|
||||||
<lrPanel title="列表关联字段">
|
<lrPanel title="列表关联字段">
|
||||||
<a-radio-group v-bind="attrs" v-model:value="config.left.colField" size="large">
|
<a-radio-group v-bind="attrs" v-model:value="config.left.colField" size="large">
|
||||||
<template v-for="item in colslist" :key="`${item.value}`">
|
<template v-for="item in colslist" :key="`${item.value}`">
|
||||||
|
|
@ -145,7 +145,7 @@
|
||||||
const labelCol = { span: 4 };
|
const labelCol = { span: 4 };
|
||||||
const wrapperCol = { span: 20 };
|
const wrapperCol = { span: 20 };
|
||||||
// config
|
// config
|
||||||
const config = inject('formConfig');
|
const config: any = inject('formConfig');
|
||||||
// message
|
// message
|
||||||
const { createMessage } = useMessage();
|
const { createMessage } = useMessage();
|
||||||
|
|
||||||
|
|
@ -174,7 +174,7 @@
|
||||||
label: { required: true, message: '请输入选项名', trigger: 'null' },
|
label: { required: true, message: '请输入选项名', trigger: 'null' },
|
||||||
value: { required: true, message: '请输入选项值', trigger: 'null' },
|
value: { required: true, message: '请输入选项值', trigger: 'null' },
|
||||||
};
|
};
|
||||||
let pData = undefined;
|
let pData: any = undefined;
|
||||||
|
|
||||||
// 静态数据树
|
// 静态数据树
|
||||||
const treeOptions = ref<TreeItem[]>([]);
|
const treeOptions = ref<TreeItem[]>([]);
|
||||||
|
|
@ -202,7 +202,7 @@
|
||||||
});
|
});
|
||||||
// 获取树
|
// 获取树
|
||||||
const staticDataTreeRef = ref<Nullable<TreeActionType>>(null);
|
const staticDataTreeRef = ref<Nullable<TreeActionType>>(null);
|
||||||
function getTree() {
|
function getTree(): any {
|
||||||
return unref(staticDataTreeRef);
|
return unref(staticDataTreeRef);
|
||||||
}
|
}
|
||||||
// 开启弹窗
|
// 开启弹窗
|
||||||
|
|
@ -219,7 +219,7 @@
|
||||||
// 子节点添加弹窗
|
// 子节点添加弹窗
|
||||||
function handleNodeAdd(data) {
|
function handleNodeAdd(data) {
|
||||||
pData = data;
|
pData = data;
|
||||||
dialogTitle = `添加【${data.label}】的子选项`;
|
dialogTitle = `添加子选项`;
|
||||||
dialogVisible.value = true;
|
dialogVisible.value = true;
|
||||||
}
|
}
|
||||||
// 子节点添加
|
// 子节点添加
|
||||||
|
|
@ -270,9 +270,9 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
// 数据字典
|
// 数据字典
|
||||||
const dataCodes = ref<TreeItem[]>([]);
|
const dataCodes: any = ref<TreeItem[]>([]);
|
||||||
const dataSourceOptions = [];
|
const dataSourceOptions: any = [];
|
||||||
const myColNameList = ref([]);
|
const myColNameList: any = ref([]);
|
||||||
|
|
||||||
async function fetch() {
|
async function fetch() {
|
||||||
// 静态数据
|
// 静态数据
|
||||||
|
|
@ -285,7 +285,7 @@
|
||||||
|
|
||||||
// 远端数据-数据源
|
// 远端数据-数据源
|
||||||
async function setdataSourceOptions() {
|
async function setdataSourceOptions() {
|
||||||
const loadDataBaseInfo = await fun_LoadDataBaseInfo();
|
const loadDataBaseInfo: any = await fun_LoadDataBaseInfo({});
|
||||||
if (loadDataBaseInfo.items) {
|
if (loadDataBaseInfo.items) {
|
||||||
loadDataBaseInfo.items.forEach((item) => {
|
loadDataBaseInfo.items.forEach((item) => {
|
||||||
dataSourceOptions.push({ value: item.code, label: item.name });
|
dataSourceOptions.push({ value: item.code, label: item.name });
|
||||||
|
|
@ -295,7 +295,7 @@
|
||||||
|
|
||||||
// 远端数据-关联字段、显示字段、id字段、pid字段
|
// 远端数据-关联字段、显示字段、id字段、pid字段
|
||||||
async function handleDataSourceChange() {
|
async function handleDataSourceChange() {
|
||||||
let dataColName = await fun_GetDataColName({ code: config.left.dataCode });
|
let dataColName: any = await fun_GetDataColName({ code: config.left.dataCode });
|
||||||
dataColName.forEach((element) => {
|
dataColName.forEach((element) => {
|
||||||
myColNameList.value.push({ value: element, label: element });
|
myColNameList.value.push({ value: element, label: element });
|
||||||
});
|
});
|
||||||
|
|
@ -327,4 +327,9 @@
|
||||||
height: 100%;
|
height: 100%;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.tree {
|
||||||
|
overflow: auto;
|
||||||
|
height: calc(100vh - 60px);
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
<template>
|
<template>
|
||||||
<PageWrapper dense contentFullHeight fixedHeight contentClass="flex">
|
<PageWrapper dense contentFullHeight fixedHeight contentClass="flex">
|
||||||
<div class="m-2 mr-0 w-1/4 xl:w-1/4 overflow-hidden">
|
<div class="m-2 mr-0 w-1/4 xl:w-1/4 bg-white tree">
|
||||||
<BasicTree
|
<BasicTree
|
||||||
ref="querysTreeRef"
|
ref="querysTreeRef"
|
||||||
title="查询字段"
|
title="查询字段"
|
||||||
|
|
@ -37,7 +37,7 @@
|
||||||
import { ref, inject, defineProps, PropType, watch, onMounted, unref, nextTick } from 'vue';
|
import { ref, inject, defineProps, PropType, watch, onMounted, unref, nextTick } from 'vue';
|
||||||
import { BasicTable, useTable } from '@/components/Table';
|
import { BasicTable, useTable } from '@/components/Table';
|
||||||
import { PageWrapper } from '@/components/Page';
|
import { PageWrapper } from '@/components/Page';
|
||||||
import { BasicTree } from '@/components/Tree';
|
import { BasicTree, TreeActionType } from '@/components/Tree';
|
||||||
|
|
||||||
import { querys } from './config.data';
|
import { querys } from './config.data';
|
||||||
|
|
||||||
|
|
@ -54,7 +54,7 @@
|
||||||
});
|
});
|
||||||
|
|
||||||
// config
|
// config
|
||||||
const config = inject('formConfig');
|
const config: any = inject('formConfig');
|
||||||
const querysData = ref(config.table.querys);
|
const querysData = ref(config.table.querys);
|
||||||
// 展开全部
|
// 展开全部
|
||||||
const querysTreeRef = ref<Nullable<TreeActionType>>(null);
|
const querysTreeRef = ref<Nullable<TreeActionType>>(null);
|
||||||
|
|
@ -102,3 +102,10 @@
|
||||||
fetch();
|
fetch();
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<style lang="less" scoped>
|
||||||
|
.tree {
|
||||||
|
overflow: auto;
|
||||||
|
height: calc(100vh - 120px);
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,7 @@
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { ref, provide, defineExpose, watch, defineProps } from 'vue';
|
import { ref, provide, defineExpose, watch, defineProps } from 'vue';
|
||||||
|
import { cloneDeep } from 'lodash-es';
|
||||||
import WebcodeLayout from './config/layout.vue';
|
import WebcodeLayout from './config/layout.vue';
|
||||||
import webcodeLefttree from './config/leftTree.vue';
|
import webcodeLefttree from './config/leftTree.vue';
|
||||||
import webcodeColumns from './config/columns.vue';
|
import webcodeColumns from './config/columns.vue';
|
||||||
|
|
@ -43,6 +44,10 @@
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: () => false,
|
default: () => false,
|
||||||
},
|
},
|
||||||
|
formVerison_now: {
|
||||||
|
type: String,
|
||||||
|
default: () => '',
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
|
|
@ -93,7 +98,7 @@
|
||||||
'StrengthMeter',
|
'StrengthMeter',
|
||||||
];
|
];
|
||||||
|
|
||||||
const config: any = ref({
|
const config_backups: any = {
|
||||||
layoutType: 1,
|
layoutType: 1,
|
||||||
queryType: 1,
|
queryType: 1,
|
||||||
left: {
|
left: {
|
||||||
|
|
@ -172,7 +177,9 @@
|
||||||
sort: 5,
|
sort: 5,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
});
|
};
|
||||||
|
const config: any = ref();
|
||||||
|
config.value = cloneDeep(config_backups);
|
||||||
|
|
||||||
const formScheme: any = ref('');
|
const formScheme: any = ref('');
|
||||||
|
|
||||||
|
|
@ -194,11 +201,6 @@
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const colunmsMap = {};
|
|
||||||
columns.forEach((item) => {
|
|
||||||
colunmsMap[item.field] = item;
|
|
||||||
});
|
|
||||||
|
|
||||||
// 左侧树形设置
|
// 左侧树形设置
|
||||||
colslist.value = columns.map((t) => {
|
colslist.value = columns.map((t) => {
|
||||||
return { value: t.field, label: t.label };
|
return { value: t.field, label: t.label };
|
||||||
|
|
@ -246,7 +248,7 @@
|
||||||
if (
|
if (
|
||||||
(typeof props.editData.record.formVerison == 'string'
|
(typeof props.editData.record.formVerison == 'string'
|
||||||
? props.editData.record.formVerison
|
? props.editData.record.formVerison
|
||||||
: props.editData.record.formVerison.value) === formVerison
|
: props.editData.record.formVerison.value) === props.formVerison_now
|
||||||
) {
|
) {
|
||||||
const editDataScheme = JSON.parse(props.editData.record.scheme);
|
const editDataScheme = JSON.parse(props.editData.record.scheme);
|
||||||
|
|
||||||
|
|
@ -256,29 +258,62 @@
|
||||||
config.value.queryType = editDataScheme.queryType;
|
config.value.queryType = editDataScheme.queryType;
|
||||||
// 左边树
|
// 左边树
|
||||||
config.value.left = editDataScheme.left;
|
config.value.left = editDataScheme.left;
|
||||||
|
// 常用按钮-树
|
||||||
|
btnsTree.value.forEach((tree1, index) => {
|
||||||
|
editDataScheme.table.btns.forEach((tree2) => {
|
||||||
|
if (tree1.id === tree2.id) {
|
||||||
|
btnsTree.value[index] = tree2;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
// 列表设置-表
|
// 列表设置-表
|
||||||
config.value.table.columns = editDataScheme.table.columns;
|
config.value.table.columns = editDataScheme.table.columns;
|
||||||
// 查询设置-表
|
// 查询设置-表
|
||||||
config.value.table.querys = editDataScheme.table.querys;
|
config.value.table.querys = editDataScheme.table.querys;
|
||||||
// 常用按钮-表
|
// 常用按钮-表
|
||||||
config.value.table.btns = editDataScheme.table.btns;
|
config.value.table.btns = editDataScheme.table.btns;
|
||||||
|
|
||||||
|
setCheckedKeys();
|
||||||
|
} else {
|
||||||
|
defaultConfig();
|
||||||
|
setCheckedKeys();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// 列表设置-表
|
defaultConfig();
|
||||||
config.value.table.columns = columnsTree.value[0].children;
|
setCheckedKeys();
|
||||||
// 查询设置-表
|
|
||||||
config.value.table.querys = queryTree.value[0].children;
|
|
||||||
// 常用按钮-表
|
|
||||||
config.value.table.btns = btnsTree.value;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 设置预选的单选项
|
pageActiveName = 'tab01';
|
||||||
|
}
|
||||||
|
|
||||||
|
function defaultConfig() {
|
||||||
|
// 布局
|
||||||
|
config.value.layoutType = 1;
|
||||||
|
// 左侧-父子树:默认为[]
|
||||||
|
colslist.value = [];
|
||||||
|
// 常用按钮-树
|
||||||
|
btnsTree.value = cloneDeep(config_backups).btns;
|
||||||
|
// 列表设置-表
|
||||||
|
config.value.table.columns = columnsTree.value[0].children;
|
||||||
|
// 查询设置-表
|
||||||
|
config.value.table.querys = queryTree.value[0].children;
|
||||||
|
// 常用按钮-表
|
||||||
|
config.value.table.btns = btnsTree.value;
|
||||||
|
}
|
||||||
|
|
||||||
|
function setCheckedKeys() {
|
||||||
|
// 列表设置-树-选项
|
||||||
|
columnsCheckedKeys.value = [];
|
||||||
config.value.table.columns.forEach((t: any) => {
|
config.value.table.columns.forEach((t: any) => {
|
||||||
columnsCheckedKeys.value.push(t.key);
|
columnsCheckedKeys.value.push(t.key);
|
||||||
});
|
});
|
||||||
|
// 查询设置-树-选项
|
||||||
|
queryCheckedKeys.value = [];
|
||||||
config.value.table.querys.forEach((t: any) => {
|
config.value.table.querys.forEach((t: any) => {
|
||||||
queryCheckedKeys.value.push(t.key);
|
queryCheckedKeys.value.push(t.key);
|
||||||
});
|
});
|
||||||
|
// 常用按钮-树-选项
|
||||||
|
btnsCheckedKeys.value = [];
|
||||||
config.value.table.btns.forEach((t: any) => {
|
config.value.table.btns.forEach((t: any) => {
|
||||||
btnsCheckedKeys.value.push(t.id);
|
btnsCheckedKeys.value.push(t.id);
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -56,6 +56,7 @@
|
||||||
<AutomaticModal
|
<AutomaticModal
|
||||||
@register="automaticModal"
|
@register="automaticModal"
|
||||||
:isAddVisible="isAddVisible"
|
:isAddVisible="isAddVisible"
|
||||||
|
:isStageClick="isStageClick"
|
||||||
@automatic-modal-submitsuccess="automaticModalSubmitsuccess"
|
@automatic-modal-submitsuccess="automaticModalSubmitsuccess"
|
||||||
/>
|
/>
|
||||||
</BasicModal>
|
</BasicModal>
|
||||||
|
|
@ -75,6 +76,7 @@
|
||||||
editFormDesignData,
|
editFormDesignData,
|
||||||
getOutKeyList,
|
getOutKeyList,
|
||||||
} from '@/api/formdesign/index';
|
} from '@/api/formdesign/index';
|
||||||
|
import { functionGetForm } from '@/api/demo/formScheme';
|
||||||
|
|
||||||
defineOptions({ name: 'FormModal' });
|
defineOptions({ name: 'FormModal' });
|
||||||
|
|
||||||
|
|
@ -83,6 +85,9 @@
|
||||||
|
|
||||||
let formScheme: any = ref({ info: {}, scheme: {} });
|
let formScheme: any = ref({ info: {}, scheme: {} });
|
||||||
|
|
||||||
|
let formScheme_id = '';
|
||||||
|
let formScheme_type = '';
|
||||||
|
|
||||||
let saveFormDatas: any = ref({});
|
let saveFormDatas: any = ref({});
|
||||||
const primaryKey: any = ref();
|
const primaryKey: any = ref();
|
||||||
provide(
|
provide(
|
||||||
|
|
@ -93,15 +98,33 @@
|
||||||
'thisFormType',
|
'thisFormType',
|
||||||
computed(() => saveFormDatas.value),
|
computed(() => saveFormDatas.value),
|
||||||
);
|
);
|
||||||
|
async function getTableColumnData(schems) {
|
||||||
function designSendGrandson(value) {
|
var arr: any = [];
|
||||||
|
for (var i = 0; i < schems.db.length; i++) {
|
||||||
|
let params = {
|
||||||
|
dbCode: schems.dbCode,
|
||||||
|
tableNames: schems.db[i].name,
|
||||||
|
};
|
||||||
|
await getOutKeyList(params).then((res: Recordable) => {
|
||||||
|
console.log(res);
|
||||||
|
if (res.length > 0) {
|
||||||
|
arr.push({
|
||||||
|
name: schems.db[i].name,
|
||||||
|
data: res[0].db_codecolumnsList,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return arr;
|
||||||
|
}
|
||||||
|
async function designSendGrandson(value) {
|
||||||
let designTab = JSON.parse(value);
|
let designTab = JSON.parse(value);
|
||||||
let schems = saveFormDatas.value.scheme.scheme
|
let schems = saveFormDatas.value.scheme.scheme
|
||||||
? JSON.parse(saveFormDatas.value.scheme.scheme)
|
? JSON.parse(saveFormDatas.value.scheme.scheme)
|
||||||
: JSON.parse(
|
: JSON.parse(
|
||||||
'{"db":[{"name":"form_scheme","type":"main"}],"rdb":[],"dbCode":"hcsystemdb","formInfo":{"schemas":[]},"primaryKey":"Id"}',
|
'{"db":[{"name":"form_scheme","type":"main"}],"rdb":[],"dbCode":"hcsystemdb","formInfo":{"schemas":[]},"primaryKey":"Id"}',
|
||||||
);
|
);
|
||||||
|
let tableData = await getTableColumnData(schems);
|
||||||
let tabArr: any = [];
|
let tabArr: any = [];
|
||||||
let tabLabelArr: any = [];
|
let tabLabelArr: any = [];
|
||||||
designTab.schemas.forEach((item) => {
|
designTab.schemas.forEach((item) => {
|
||||||
|
|
@ -109,17 +132,12 @@
|
||||||
item.defaultValue = item.componentProps.defaultValue;
|
item.defaultValue = item.componentProps.defaultValue;
|
||||||
}
|
}
|
||||||
if (item.componentProps.fieldName) {
|
if (item.componentProps.fieldName) {
|
||||||
let params = {
|
tableData.forEach((element) => {
|
||||||
dbCode: schems.dbCode,
|
if (element.name == item.componentProps.dataTable) {
|
||||||
tableNames: item.componentProps.dataTable,
|
var currentIndex = element.data.findIndex(
|
||||||
};
|
(childItem) => childItem.dbColumnName === item.componentProps.fieldName,
|
||||||
getOutKeyList(params).then((res: Recordable) => {
|
);
|
||||||
if (res.length > 0) {
|
item.csType = element.data[currentIndex].csType;
|
||||||
res[0].db_codecolumnsList.forEach((val) => {
|
|
||||||
if (item.componentProps.fieldName == val.dbColumnName) {
|
|
||||||
item.csType = val.csType;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -130,9 +148,12 @@
|
||||||
});
|
});
|
||||||
schems.primaryKey = primaryKey.value;
|
schems.primaryKey = primaryKey.value;
|
||||||
schems.formInfo = designTab;
|
schems.formInfo = designTab;
|
||||||
|
|
||||||
// 表结构配置
|
// 表结构配置
|
||||||
|
tableCallBack(schems, tabArr, tabLabelArr);
|
||||||
|
}
|
||||||
|
function tableCallBack(schems, tabArr, tabLabelArr) {
|
||||||
if (saveFormDatas.value.info.formType == 2 && !isStageClick.value) {
|
if (saveFormDatas.value.info.formType == 2 && !isStageClick.value) {
|
||||||
|
// 自动建表+保存
|
||||||
if (isAddVisible.value) {
|
if (isAddVisible.value) {
|
||||||
schems.db.push({
|
schems.db.push({
|
||||||
name: 'table' + new Date().getTime(),
|
name: 'table' + new Date().getTime(),
|
||||||
|
|
@ -144,16 +165,34 @@
|
||||||
saveFormDatas.value.scheme.scheme = JSON.stringify(schems);
|
saveFormDatas.value.scheme.scheme = JSON.stringify(schems);
|
||||||
openModal(true, { saveFormDatas: saveFormDatas.value });
|
openModal(true, { saveFormDatas: saveFormDatas.value });
|
||||||
} else if (saveFormDatas.value.info.formType == 2 && isStageClick.value) {
|
} else if (saveFormDatas.value.info.formType == 2 && isStageClick.value) {
|
||||||
setTimeout(() => {
|
// 自动建表+暂存
|
||||||
saveFormDatas.value.scheme.scheme = JSON.stringify(schems);
|
setTimeout(async () => {
|
||||||
submitSaveClick();
|
if (isAddVisible.value) {
|
||||||
|
schems.db = [];
|
||||||
|
schems.db.push({
|
||||||
|
name: 'table' + new Date().getTime(),
|
||||||
|
type: 'main',
|
||||||
|
tableName: 'table' + new Date().getTime(),
|
||||||
|
description: '',
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
formScheme_id = formScheme_id ? formScheme_id : saveFormDatas.value.info.id;
|
||||||
|
let query: any = { id: formScheme_id };
|
||||||
|
let result: any = await functionGetForm(query);
|
||||||
|
let result_json = JSON.parse(result.scheme.scheme);
|
||||||
|
schems.db = result_json.db;
|
||||||
|
}
|
||||||
|
// saveFormDatas.value.scheme.scheme = JSON.stringify(schems);
|
||||||
|
console.log('自动建表暂存');
|
||||||
|
submitSaveClick(schems);
|
||||||
}, 500);
|
}, 500);
|
||||||
} else if (tabArr.includes(undefined)) {
|
} else if (tabArr.includes(undefined)) {
|
||||||
message.warning('请' + tabLabelArr[0] + '绑定数据表字段!', 2);
|
message.warning('请' + tabLabelArr[0] + '绑定数据表字段!', 2);
|
||||||
} else {
|
} else {
|
||||||
|
console.log('正常提交');
|
||||||
|
// saveFormDatas.value.scheme.scheme = JSON.stringify(schems);
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
saveFormDatas.value.scheme.scheme = JSON.stringify(schems);
|
submitSaveClick(schems);
|
||||||
submitSaveClick();
|
|
||||||
}, 500);
|
}, 500);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -165,7 +204,10 @@
|
||||||
stepsCurrent.value = 0;
|
stepsCurrent.value = 0;
|
||||||
isSubmitClick.value = false;
|
isSubmitClick.value = false;
|
||||||
isStageClick.value = false;
|
isStageClick.value = false;
|
||||||
|
|
||||||
if (data.id) {
|
if (data.id) {
|
||||||
|
formScheme_id = data.id;
|
||||||
|
formScheme_type = data.type;
|
||||||
editCreateUserName = data.createUserName;
|
editCreateUserName = data.createUserName;
|
||||||
isAddVisible.value = false;
|
isAddVisible.value = false;
|
||||||
getBaseConfigList({ id: data.id }).then((res: Recordable) => {
|
getBaseConfigList({ id: data.id }).then((res: Recordable) => {
|
||||||
|
|
@ -190,7 +232,7 @@
|
||||||
|
|
||||||
function automaticModalSubmitsuccess(value) {
|
function automaticModalSubmitsuccess(value) {
|
||||||
saveFormDatas.value = value;
|
saveFormDatas.value = value;
|
||||||
submitSaveClick();
|
submitSaveClick(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
let stepsCurrent = ref();
|
let stepsCurrent = ref();
|
||||||
|
|
@ -366,7 +408,10 @@
|
||||||
function designformback() {
|
function designformback() {
|
||||||
isSubmitClick.value = false;
|
isSubmitClick.value = false;
|
||||||
}
|
}
|
||||||
function submitSaveClick() {
|
function submitSaveClick(schems) {
|
||||||
|
if (schems) {
|
||||||
|
saveFormDatas.value.scheme.scheme = JSON.stringify(schems);
|
||||||
|
}
|
||||||
if (!saveFormDatas.value.info.type) {
|
if (!saveFormDatas.value.info.type) {
|
||||||
isStageClick.value = false;
|
isStageClick.value = false;
|
||||||
isSubmitClick.value = false;
|
isSubmitClick.value = false;
|
||||||
|
|
@ -376,6 +421,10 @@
|
||||||
info: saveFormDatas.value.info,
|
info: saveFormDatas.value.info,
|
||||||
scheme: saveFormDatas.value.scheme,
|
scheme: saveFormDatas.value.scheme,
|
||||||
};
|
};
|
||||||
|
// 草稿状态下暂存,再暂存还是草稿状态
|
||||||
|
if (isStageClick.value && param.info.type == 2) {
|
||||||
|
param.scheme.type = formScheme_type ? formScheme_type : 2;
|
||||||
|
}
|
||||||
if (isAddVisible.value) {
|
if (isAddVisible.value) {
|
||||||
addFormDesignData(param).then((res: Recordable) => {
|
addFormDesignData(param).then((res: Recordable) => {
|
||||||
if (!isStageClick.value) {
|
if (!isStageClick.value) {
|
||||||
|
|
|
||||||
|
|
@ -22,15 +22,15 @@
|
||||||
</template>
|
</template>
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { onMounted, ref, h, nextTick, unref } from 'vue';
|
import { onMounted, ref, h, nextTick, unref } from 'vue';
|
||||||
import { BasicTree, TreeItem, TreeActionItem } from '@/components/Tree';
|
import { BasicTree, TreeItem, TreeActionItem, TreeActionType } from '@/components/Tree';
|
||||||
import { functionLoadFormSort, functionDeleteFormSort } from '@/api/demo/formScheme';
|
import { functionLoadFormSort, functionDeleteFormSort } from '@/api/demo/formScheme';
|
||||||
import { PlusOutlined, FormOutlined, DeleteOutlined } from '@ant-design/icons-vue';
|
import { PlusOutlined, FormOutlined, DeleteOutlined } from '@ant-design/icons-vue';
|
||||||
import { BasicModal, useModal } from '@/components/Modal';
|
import { BasicModal, useModal } from '@/components/Modal';
|
||||||
import { router } from '@/router';
|
import { router } from '@/router';
|
||||||
|
|
||||||
defineOptions({ name: 'FormSchemeTree' });
|
defineOptions({ name: 'FormSchemeTree' });
|
||||||
const emit = defineEmits(['select']);
|
const emit = defineEmits(['select', 'add', 'edit']);
|
||||||
let selectNode = ref('');
|
let selectNode: any = ref('');
|
||||||
|
|
||||||
// 删除的弹窗
|
// 删除的弹窗
|
||||||
const [register, { closeModal, openModal }] = useModal();
|
const [register, { closeModal, openModal }] = useModal();
|
||||||
|
|
@ -40,14 +40,15 @@
|
||||||
|
|
||||||
// 删除的弹窗的方法
|
// 删除的弹窗的方法
|
||||||
async function handleDelete() {
|
async function handleDelete() {
|
||||||
var query = { id: selectNode.value.itemDetailId };
|
let query: any = { id: selectNode.value.itemDetailId };
|
||||||
await functionDeleteFormSort(query);
|
await functionDeleteFormSort(query);
|
||||||
closeModal();
|
closeModal();
|
||||||
}
|
}
|
||||||
|
|
||||||
// 树分类获取
|
// 树分类获取
|
||||||
async function fetch() {
|
async function fetch() {
|
||||||
treeData.value = (await functionLoadFormSort()) as unknown as TreeItem[];
|
let query: any = {};
|
||||||
|
treeData.value = (await functionLoadFormSort(query)) as unknown as TreeItem[];
|
||||||
treeData.value = treeData.value.map((item) => ({
|
treeData.value = treeData.value.map((item) => ({
|
||||||
...item,
|
...item,
|
||||||
title: item.itemName,
|
title: item.itemName,
|
||||||
|
|
@ -61,9 +62,9 @@
|
||||||
function handleSelect(keys) {
|
function handleSelect(keys) {
|
||||||
emit('select', keys[0]);
|
emit('select', keys[0]);
|
||||||
}
|
}
|
||||||
const btnList = router.currentRoute.value.meta.elements;
|
const btnList: any = router.currentRoute.value.meta.elements;
|
||||||
const actionList: TreeActionItem[] = [];
|
const actionList: TreeActionItem[] = [];
|
||||||
btnList.forEach((element) => {
|
btnList?.forEach((element) => {
|
||||||
if (element.domId == 'btnAdd') {
|
if (element.domId == 'btnAdd') {
|
||||||
actionList.push({
|
actionList.push({
|
||||||
render: (node) => {
|
render: (node) => {
|
||||||
|
|
|
||||||
|
|
@ -180,9 +180,9 @@ export const formSchema: FormSchema[] = [
|
||||||
labelField: 'text',
|
labelField: 'text',
|
||||||
valueField: 'value',
|
valueField: 'value',
|
||||||
async: true,
|
async: true,
|
||||||
onChange: (e, v) => {
|
// onChange: (e, v) => {
|
||||||
console.log('ApiTreeSelect====>:', e, v);
|
// console.log('ApiTreeSelect====>:', e, v);
|
||||||
},
|
// },
|
||||||
onLoadData: ({ treeData, resolve, treeNode }) => {
|
onLoadData: ({ treeData, resolve, treeNode }) => {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
const children: Recordable[] = [];
|
const children: Recordable[] = [];
|
||||||
|
|
|
||||||
|
|
@ -137,12 +137,15 @@
|
||||||
}
|
}
|
||||||
// 表名和备注
|
// 表名和备注
|
||||||
let scheme = JSON.parse(data.saveFormDatas.scheme.scheme);
|
let scheme = JSON.parse(data.saveFormDatas.scheme.scheme);
|
||||||
tableInfo.value.tableName = scheme.db[0].tableName;
|
|
||||||
|
tableInfo.value.tableName = scheme.db[0].tableName ? scheme.db[0].tableName : scheme.db[0].name;
|
||||||
tableInfo.value.description = scheme.db[0].description;
|
tableInfo.value.description = scheme.db[0].description;
|
||||||
tableInfo.value.dbCode = data.saveFormDatas.info.DbCode;
|
tableInfo.value.dbCode = data.saveFormDatas.info.DbCode;
|
||||||
|
|
||||||
// 制作表格
|
// 制作表格
|
||||||
let schemas = scheme.formInfo.schemas;
|
let schemas = scheme.formInfo.schemas;
|
||||||
tableInfo.value.dbColumnInfoList = [];
|
tableInfo.value.dbColumnInfoList = [];
|
||||||
|
|
||||||
schemas.forEach((item: any) => {
|
schemas.forEach((item: any) => {
|
||||||
if (!item.component.includes(componentArray)) {
|
if (!item.component.includes(componentArray)) {
|
||||||
if (fieldArray.includes(item.field)) {
|
if (fieldArray.includes(item.field)) {
|
||||||
|
|
@ -159,6 +162,23 @@
|
||||||
tableInfo.value.dbColumnInfoList.push(temp);
|
tableInfo.value.dbColumnInfoList.push(temp);
|
||||||
item.dbColumnInfo = temp;
|
item.dbColumnInfo = temp;
|
||||||
|
|
||||||
|
// 编辑-添加新的行
|
||||||
|
dbColumnInfo_new.value.push(temp);
|
||||||
|
dbColumnInfo_new_list.push(temp.dbColumnName + temp.columnDescription);
|
||||||
|
item.componentProps.dataTable = tableInfo.value.tableName;
|
||||||
|
item.componentProps.fieldName = temp.dbColumnName;
|
||||||
|
} else if (item.dbColumnInfo.dbColumnName != item.component + item.field) {
|
||||||
|
// 复制按钮产生的组件
|
||||||
|
// 初始默认值
|
||||||
|
let temp = cloneDeep(dbColumnInfo);
|
||||||
|
temp.tableName = tableInfo.value.tableName;
|
||||||
|
temp.dbColumnName = item.component + item.field;
|
||||||
|
temp.length = 200;
|
||||||
|
temp.dataType = 'varchar';
|
||||||
|
temp.columnDescription = item.label;
|
||||||
|
tableInfo.value.dbColumnInfoList.push(temp);
|
||||||
|
item.dbColumnInfo = temp;
|
||||||
|
|
||||||
// 编辑-添加新的行
|
// 编辑-添加新的行
|
||||||
dbColumnInfo_new.value.push(temp);
|
dbColumnInfo_new.value.push(temp);
|
||||||
dbColumnInfo_new_list.push(temp.dbColumnName + temp.columnDescription);
|
dbColumnInfo_new_list.push(temp.dbColumnName + temp.columnDescription);
|
||||||
|
|
@ -186,6 +206,8 @@
|
||||||
async function submit() {
|
async function submit() {
|
||||||
if (props.isAddVisible) {
|
if (props.isAddVisible) {
|
||||||
await AddTable(tableInfo.value);
|
await AddTable(tableInfo.value);
|
||||||
|
} else if (dbColumnInfo_new_list.length == tableInfo.value.dbColumnInfoList.length) {
|
||||||
|
await AddTable(tableInfo.value);
|
||||||
} else if (dbColumnInfo_new.value) {
|
} else if (dbColumnInfo_new.value) {
|
||||||
dbColumnInfo_new.value.forEach(async (item) => {
|
dbColumnInfo_new.value.forEach(async (item) => {
|
||||||
await AddColumn(item);
|
await AddColumn(item);
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,9 @@
|
||||||
<a-tab-pane key="form" tab="表单信息" v-if="formVisble">
|
<a-tab-pane key="form" tab="表单信息" v-if="formVisble">
|
||||||
<FormViewer ref="formBoxRef" :formConfig="formConfig" v-if="formVisble" />
|
<FormViewer ref="formBoxRef" :formConfig="formConfig" v-if="formVisble" />
|
||||||
</a-tab-pane>
|
</a-tab-pane>
|
||||||
|
<a-tab-pane key="form" tab="系统表单信息" v-if="formUrlVisble">
|
||||||
|
<AsyncComponent ref="pcForm" />
|
||||||
|
</a-tab-pane>
|
||||||
<a-tab-pane key="flow" tab="流程信息" force-render>
|
<a-tab-pane key="flow" tab="流程信息" force-render>
|
||||||
<div class="process-design" :style="'display: flex; height:' + designerData.height">
|
<div class="process-design" :style="'display: flex; height:' + designerData.height">
|
||||||
<process-viewer :key="`designer-${code}`" :xml="flowContent" v-if="processVisble" />
|
<process-viewer :key="`designer-${code}`" :xml="flowContent" v-if="processVisble" />
|
||||||
|
|
@ -65,7 +68,7 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { h, ref, reactive, onBeforeMount } from 'vue';
|
import { h, ref, reactive, onBeforeMount, defineAsyncComponent } from 'vue';
|
||||||
import { ProcessViewer } from '@/components/ProcessViewer/index';
|
import { ProcessViewer } from '@/components/ProcessViewer/index';
|
||||||
import { PageWrapper } from '@/components/Page';
|
import { PageWrapper } from '@/components/Page';
|
||||||
import { FormViewer } from '@/components/FormViewer';
|
import { FormViewer } from '@/components/FormViewer';
|
||||||
|
|
@ -89,12 +92,15 @@
|
||||||
const labelCol = { span: 7 };
|
const labelCol = { span: 7 };
|
||||||
const wrapperCol = { span: 13 };
|
const wrapperCol = { span: 13 };
|
||||||
const formVisble = ref(false);
|
const formVisble = ref(false);
|
||||||
|
const formUrlVisble = ref(false);
|
||||||
const processVisble = ref(false);
|
const processVisble = ref(false);
|
||||||
|
const AsyncComponent = ref();
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
code: String,
|
code: String,
|
||||||
});
|
});
|
||||||
const emit = defineEmits(['closeModel']);
|
const emit = defineEmits(['closeModel']);
|
||||||
const keyValue = ref('');
|
const keyValue = ref('');
|
||||||
|
const pcForm = ref();
|
||||||
// 表单数据
|
// 表单数据
|
||||||
const formConfig = ref<IFormConfig>({
|
const formConfig = ref<IFormConfig>({
|
||||||
// 表单配置
|
// 表单配置
|
||||||
|
|
@ -150,15 +156,36 @@
|
||||||
let wfData = content.wfData;
|
let wfData = content.wfData;
|
||||||
const currentNode = wfData.find((t) => t.type == 'bpmn:StartEvent');
|
const currentNode = wfData.find((t) => t.type == 'bpmn:StartEvent');
|
||||||
if (currentNode.authFields.length > 0) {
|
if (currentNode.authFields.length > 0) {
|
||||||
|
// 有自定义表单时
|
||||||
formVisble.value = true;
|
formVisble.value = true;
|
||||||
|
} else if (currentNode.formUrl) {
|
||||||
|
// 有PC系统表单时
|
||||||
|
formUrlVisble.value = true;
|
||||||
|
let url = '../../..' + currentNode.formUrl + '.vue';
|
||||||
|
// AsyncComponent.value = defineAsyncComponent(() => import(url));
|
||||||
|
AsyncComponent.value = defineAsyncComponent({
|
||||||
|
// 加载函数
|
||||||
|
loader: () => import(url),
|
||||||
|
// 展示加载组件前的延迟时间,默认为200ms,注:这里如果设置的时间过短,会有闪烁的效果
|
||||||
|
delay: 200,
|
||||||
|
// 如果提供了一个timeout时间限制,并且超时了,也会展示这里的报错组件
|
||||||
|
// 设置加载超时时间为3000毫秒
|
||||||
|
timeout: 3000,
|
||||||
|
onError: function () {
|
||||||
|
createMessage.error('无法加载系统表单,请查看流程配置是否正确!');
|
||||||
|
},
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
|
// 无表单时
|
||||||
processVisble.value = true;
|
processVisble.value = true;
|
||||||
activeName.value = 'flow';
|
activeName.value = 'flow';
|
||||||
}
|
}
|
||||||
|
|
||||||
formConfig.value = currentNode.authFields;
|
formConfig.value = currentNode.authFields;
|
||||||
designerData.formCurrentNode = currentNode;
|
designerData.formCurrentNode = currentNode;
|
||||||
getFormHistory();
|
getFormHistory();
|
||||||
}
|
}
|
||||||
|
|
||||||
async function getDelegateUsers() {
|
async function getDelegateUsers() {
|
||||||
const data = await getLoadMyUserList({
|
const data = await getLoadMyUserList({
|
||||||
code: props.code,
|
code: props.code,
|
||||||
|
|
@ -226,6 +253,11 @@
|
||||||
activeName.value = 'form';
|
activeName.value = 'form';
|
||||||
return;
|
return;
|
||||||
});
|
});
|
||||||
|
} else if (formUrlVisble.value) {
|
||||||
|
//有系统表单,先存系统表单
|
||||||
|
const funName = 'handleSubmit';
|
||||||
|
pcForm.value[funName]();
|
||||||
|
// handleCreateFlow(processId);
|
||||||
} else {
|
} else {
|
||||||
handleCreateFlow(processId);
|
handleCreateFlow(processId);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,50 @@
|
||||||
|
<template>
|
||||||
|
<BasicForm @register="registerForm" />
|
||||||
|
</template>
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { BasicForm, useForm } from '@/components/Form';
|
||||||
|
import { useMessage } from '@/hooks/web/useMessage';
|
||||||
|
|
||||||
|
const { createMessage } = useMessage();
|
||||||
|
|
||||||
|
const [registerForm, { resetFields, setFieldsValue, validate }] = useForm({
|
||||||
|
labelWidth: 100,
|
||||||
|
baseColProps: { span: 24 },
|
||||||
|
schemas: [
|
||||||
|
{
|
||||||
|
field: 'id',
|
||||||
|
label: '角色名称',
|
||||||
|
required: true,
|
||||||
|
component: 'Input',
|
||||||
|
ifShow: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'name',
|
||||||
|
label: '角色名称',
|
||||||
|
required: true,
|
||||||
|
component: 'Input',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'status',
|
||||||
|
label: '状态',
|
||||||
|
component: 'RadioButtonGroup',
|
||||||
|
defaultValue: 0,
|
||||||
|
componentProps: {
|
||||||
|
options: [
|
||||||
|
{ label: '启用', value: 0 },
|
||||||
|
{ label: '停用', value: 1 },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
showActionButtonGroup: false,
|
||||||
|
});
|
||||||
|
|
||||||
|
async function handleSubmit() {
|
||||||
|
const values = await validate();
|
||||||
|
console.log(values);
|
||||||
|
}
|
||||||
|
defineExpose({
|
||||||
|
handleSubmit,
|
||||||
|
});
|
||||||
|
</script>
|
||||||
Loading…
Reference in New Issue