徐景良 2024-06-08 08:34:56 +08:00
commit c29319fd54
24 changed files with 375 additions and 363 deletions

View File

@ -1,10 +1,20 @@
<template>
<div>
<div style="display:flex;margin-bottom:10px">
{{ tableData.label }}
<div style="margin-left:10px">
<a-radio-group v-model:value="noTitleKey" :options="tableData.componentProps.options" @change="onTabChange($event,tableData.field)"/>
</div>
</div>
<!-- <a-card
style="width: 100%"
v-for="(item,index) in tableData.componentProps.options"
:key="index"
v-show="noTitleKey === item.value"
:title="item.label"
> -->
<a-card
style="width: 100%"
:tab-list="tabListNoTitle"
:active-tab-key="noTitleKey"
@tabChange="(key) => onTabChange(key)"
>
<BasicForm ref="cardRef" @register="registerForm" @change="changeForm" />
<template v-if="Object.keys(childItem).length > 0">
@ -89,12 +99,12 @@
parentValue: element.field,
...childElement,
show: index == 0 ? true : false,
index: index,
index: element.value,
});
if (childElement.component == 'CardGroup') {
childGourp.value.push({
...childElement,
index: index,
index: element.value,
});
}
if (['createuser', 'modifyuser'].includes(childElement.type)) {
@ -115,8 +125,9 @@
setTimeout(() => {
resetFields();
}, 10);
const onTabChange = (value: string) => {
const onTabChange = (event, field) => {
let value = event.target.value
subTableDataStore.setOneGroupData(field, value)
noTitleKey.value = value;
var currentIndex = (childGourp.value || []).findIndex((element) => element.index === value);
console.log(currentIndex);

View File

@ -6,7 +6,7 @@
<BasicForm ref="myDataBaseFormRef" @register="registerForm" />
<subTable ref="subTableRef" :data="subTableColumns[index]" :tabsKey="tabsKey" />
<CardGourp
v-if="cardGroupData.length > 0"
v-if="cardGroupData.length > 0 && cardGroupData[index]"
:data="cardGroupData[index]"
:formData="cardGourpFormData"
:parentValue="cardGroupData[index].field"
@ -122,7 +122,9 @@
labelWidth: 100,
schemas: formColumns,
showActionButtonGroup: false,
baseColProps: { lg: 24, md: 24 },
actionColOptions: {
span: 24,
},
});
async function getFormHistory() {
console.log('getFormHistory');
@ -148,7 +150,6 @@
multiterm: '',
});
tabElement.schemas.forEach((element) => {
console.log(element);
if (element.field == props.formRelationId) {
keyValue.value = element.componentProps.fieldName;
getFormDetail();
@ -220,9 +221,25 @@
}
//
if (element.component === 'CardGroup') {
console.log(element);
cardGroupData.value.push({
...element,
if(cardGroupData.value.length !== index){
cardGroupData.value.push(null)
}
cardGroupData.value.push(element);
// cardGroupData.value.push({
// ...element,
// });
}
//
if (element.component === 'Grid' && element.label === '栅格布局') {
element.columns.forEach((itemColumn) => {
itemColumn.children.forEach((itemColumnChild) => {
itemColumnChild.colProps.span = itemColumn.span;
formColumns.push({
parentValue: index,
...itemColumnChild,
show: index == 0 ? true : false,
});
});
});
}
formColumns.push({
@ -310,6 +327,7 @@
}
console.log(obj);
cardGourpFormData.value = obj;
subTableDataStore.setGroupData(obj)
FieldsValue.value = obj;
setFieldsValue({
...obj,

View File

@ -6,7 +6,7 @@
:data-source="tableData"
:pagination="false"
:scroll="scrollValue"
>
>
<!-- v-if="props.data.multiterm" -->
<template #headerCell="{ column, record }">
<template v-if="column.key === 'setting'">
@ -37,6 +37,7 @@
import { subTableStore } from '@/store/modules/subTable';
import { useMessage } from '@/hooks/web/useMessage';
import { BasicForm, useForm } from '@/components/Form';
import dayjs from 'dayjs';
const { createMessage } = useMessage();
const subTableDataStore = subTableStore();
@ -60,6 +61,8 @@
default: '',
},
});
const nowTime = ref(dayjs().format('YYYY-MM-DD HH:mm:ss'));
const userName = localStorage.getItem('fireUserLoginName');
const [registerForm, { getFieldsValue, setFieldsValue, updateSchema, resetFields, validate }] =
useForm({
labelWidth: 100,
@ -76,8 +79,10 @@
});
});
props.data.child.forEach((element) => {
console.log(element);
if (element.component != 'InputGuid') {
if (
!['createuser', 'modifyuser', 'createtime', 'modifytime'].includes(element.type) &&
element.component != 'InputGuid'
) {
columns.value.push({
...element,
});
@ -103,6 +108,10 @@
props.data.child.map((item) => {
if (item.component == 'InputGuid') {
emptyItem[item.field] = keyValue;
} else if (item.type == 'createuser' || item.type == 'modifyuser') {
emptyItem[item.field] = userName;
} else if (item.type == 'createtime' || item.type == 'modifytime') {
emptyItem[item.field] = nowTime.value;
} else {
emptyItem[item.field] = '';
}
@ -113,13 +122,12 @@
tableData.value = tableData.value.filter((item) => item.key != record.key);
};
function getData() {
console.log(tableData.value);
return tableData.value;
}
defineExpose({
getData,
});
function changeData(){
console.log(tableData.value)
function changeData() {
console.log(tableData.value);
}
</script>

View File

@ -323,8 +323,6 @@
//
async function custmerformVerisonChange(val, isChange) {
let obj;
console.log(val);
console.log(data.formVerisons);
data.formVerisons.forEach((element) => {
if (element.id == val) {
obj = element;
@ -334,17 +332,16 @@
}
function loadFormScheme(strScheme, isChange) {
const scheme = JSON.parse(strScheme);
console.log(scheme);
const fields: any[] = [];
const rfields: {
label?: string;
value?: string;
}[] = [];
scheme.formInfo.tabList = cardNestStructure(scheme.formInfo.tabList);
console.log(scheme.formInfo.tabList);
scheme.formInfo.tabList.forEach((tabElement) => {
tabElement.schemas.forEach(
(element: { label?: string; field?: string; component: any; itemProps: any }) => {
console.log(element);
if (['InputGuid'].includes(element.component)) {
rfields.push({
label: element.label,
@ -352,7 +349,6 @@
value: element.field,
});
}
if (
![
'Divider',
@ -415,6 +411,7 @@
});
});
} else if (['Card'].includes(element.component)) {
console.log(3);
element.columns.forEach((child) => {
child.children.forEach((t) => {
fields.push({
@ -440,6 +437,14 @@
obj.fieldName = element.componentProps.fieldName;
fields.push(obj);
} else if (['CardGroup'].includes(element.component)) {
let obj: any = element;
obj.required = element.itemProps.required;
// obj.componentProps.disabled = false;
obj.disabled = true;
obj.ifShow = true;
obj.fieldName = element.componentProps.fieldName;
obj.label = `卡片组-${element.label}`;
fields.push(obj);
element.componentProps.options.forEach((optionsElement) => {
optionsElement.children.forEach((childrenElement) => {
let obj: any = childrenElement;
@ -447,6 +452,7 @@
// obj.componentProps.disabled = false;
obj.disabled = true;
obj.ifShow = true;
obj.label = `${optionsElement.label} - ${childrenElement.label}`;
obj.fieldName = childrenElement.componentProps.fieldName;
fields.push(obj);
});
@ -455,7 +461,6 @@
},
);
});
console.log(fields);
data.formRelations = rfields;
if (isChange) {
node.value.authFields = fields;

View File

@ -67,6 +67,12 @@
]"
/>
</a-form-item>
<a-form-item label="审核栏标题">
<a-input v-model:value="node.auditTitle" placeholder="请输入" />
</a-form-item>
<a-form-item label="审核内容名称">
<a-input v-model:value="node.auditName" placeholder="请输入" />
</a-form-item>
</a-collapse-panel>
<a-collapse-panel key="2" header="审核人员设置">
<a-space>
@ -994,6 +1000,14 @@
obj.fieldName = element.componentProps.fieldName;
fields.push(obj);
} else if (['CardGroup'].includes(element.component)) {
let obj: any = element;
obj.required = element.itemProps.required;
// obj.componentProps.disabled = false;
obj.disabled = true;
obj.ifShow = true;
obj.fieldName = element.componentProps.fieldName;
obj.label = `卡片组-${element.label}`;
fields.push(obj);
element.componentProps.options.forEach((optionsElement) => {
optionsElement.children.forEach((childrenElement) => {
let obj: any = childrenElement;
@ -1001,6 +1015,7 @@
// obj.componentProps.disabled = false;
obj.disabled = true;
obj.ifShow = true;
obj.label = `${optionsElement.label} - ${childrenElement.label}`;
obj.fieldName = childrenElement.componentProps.fieldName;
fields.push(obj);
});

View File

@ -32,6 +32,10 @@ export const subTableStore = defineStore({
}
}
},
setOneGroupData (key,data){
this.groupData[key] = data
console.log(this.groupData)
},
clearGoupData() {
this.groupData = {};
},

View File

@ -150,5 +150,7 @@
<style lang="less" scoped>
.v-form-model {
overflow: hidden;
width: 96%;
margin-left: 2%;
}
</style>

View File

@ -108,7 +108,7 @@
'Cascader',
'AutoComplete',
'Tabs',
'CardGroup'
'CardGroup',
].includes(formConfig.currentItem.component)
"
>
@ -132,13 +132,14 @@
title="按钮点击脚本"
:height="500"
:width="1000"
:useWrapper="false"
@ok="handleSubmit"
>
<div style="display: flex">
<div calss="propsScript" style="width: 50%">
<div class="w-1/2 xl:w-1/2" style="overflow: auto; height: calc(100%)">
<a-textarea v-model:value="formContent" :rows="29" />
</div>
<div calss="propsScript" style="width: 50%">
<div class="w-1/2 xl:w-1/2" style="overflow: auto; height: calc(100%)">
<a-alert message="脚本参数说明,只支持ES5语法兼容小程序" type="warning">
<template #description>
<div v-html="description"></div>
@ -504,11 +505,3 @@
},
});
</script>
<style scoped>
.propsScript {
width: 50%;
overflow: auto;
height: calc(100%);
}
</style>

View File

@ -11,61 +11,14 @@
layout="vertical"
description="图斑控件"
>
<FormItem label="图斑宽度">
<a-input-number
v-model:value="formConfig.currentItem.mapSetData.width"
placeholder="请输入图斑宽度"
:min="1"
:max="100"
>
<template #addonAfter><PercentageOutlined /></template>
</a-input-number>
</FormItem>
<FormItem label="选择图层">
<FormItem label="选择空间数据表">
<a-select
v-model:value="formConfig.currentItem.mapSetData.chooseLayer"
:options="shpLayerSourceOptions"
size="middle"
placeholder="请选择图层"
@change="handleChangeDataTable"
placeholder="请选择空间数据表"
/>
</FormItem>
<FormItem label="图层字段解析">
<FormItem label="图层数据表">
<a-input
v-model:value="formConfig.currentItem.mapSetData.layerFields.dataTable"
placeholder="请输入图层数据表"
disabled="false"
/>
</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="是否允许添加图斑">
<Switch v-model:checked="formConfig.currentItem.mapSetData.isAllowAddPolygon" />
</FormItem>
<FormItem label="是否允许编辑图斑">
<Switch v-model:checked="formConfig.currentItem.mapSetData.isAllowEditPolygon" />
</FormItem>
@ -204,7 +157,9 @@
import RuleProps from './RuleProps.vue';
import { useFormDesignState } from '../../../hooks/useFormDesignState';
import { isArray } from 'lodash-es';
import { ShpLayerSourceLoadPage, GetTableAndViewColumnList } from '@/api/demo/formScheme';
// api
// import { loadTableRecordInfo } from '@/api/database/index';
import { ShpLayerSourceLoadPage } from '@/api/demo/formScheme';
const { formConfig } = useFormDesignState();
@ -232,12 +187,9 @@
if (formConfig.value.currentItem.field === 'MapGeom') {
//
formConfig.value.currentItem.mapSetData = formConfig.value.currentItem.mapSetData || {
width: 50,
chooseLayer: '',
layerFields: {},
isAllowAddPolygon: true,
isAllowEditPolygon: true,
isEnablePostionJump: true,
isAllowEditPolygon: false,
isEnablePostionJump: false,
};
//
if (shpLayerSourceOptions.value.length == 0) {
@ -264,50 +216,12 @@
//
async function getShpLayerSourceOptions() {
// let options: any = await loadTableRecordInfo({});
let options: any = await ShpLayerSourceLoadPage();
shpLayerSourceOptions.value = [];
options.items.forEach((e) => {
// shpLayerSourceOptions.value.push({ label: e.tableName, value: e.tableName });
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>

View File

@ -114,10 +114,10 @@
@ok="handleSubmit"
>
<div style="display: flex">
<div calss="propsScript" style="width: 50%">
<div class="w-1/2 xl:w-1/2" style="overflow: auto; height: calc(100%)">
<a-textarea v-model:value="formContent" :rows="29" />
</div>
<div calss="propsScript" style="width: 50%">
<div class="w-1/2 xl:w-1/2" style="overflow: auto; height: calc(100%)">
<a-alert message="脚本参数说明" type="warning">
<template #description>
<div v-html="description"></div>
@ -250,11 +250,3 @@
return flag;
}
</script>
<style scoped>
.propsScript {
width: 50%;
overflow: auto;
height: calc(100%);
}
</style>

View File

@ -42,9 +42,12 @@ export interface MapComponent {
isShowMap?: boolean;
layers?: any[];
baseLayers?: any[];
mode?:string;
angle?:number;
center?:string,
mode?: string;
angle?: number;
center?: string;
chooseLayer?: string;
isAllowEditPolygon?: boolean;
isEnablePostionJump?: boolean;
}
/**

View File

@ -224,6 +224,11 @@
}
itemColumnChild.colProps.span = itemColumn.span;
arr.push(itemColumnChild);
// arr.push({
// parentValue: index,
// ...itemColumnChild,
// show: index == 0 ? true : false,
// });
val.children.push(itemColumnChild);
});
});
@ -233,7 +238,15 @@
if (index == 0) {
opt.itemProps.hidden = false;
}
arr.push(opt);
if (opt.ptype !== 'gridlayout') {
arr.push(opt);
// arr.push({
// parentValue: index,
// ...opt,
// show: index == 0 ? true : false,
// });
}
formColumns.value = arr;
});
});
@ -258,7 +271,9 @@
});
});
} else {
arr.push(item);
if (item.ptype !== 'gridlayout') {
arr.push(item);
}
}
formColumns.value = arr;
if (item.component === 'Card') {
@ -383,7 +398,7 @@
}
});
function tabsChange(e) {
async function tabsChange(e) {
const columns: FormSchema[] = [];
tabsColumns.value.forEach((item) => {
item.children.forEach((val) => {
@ -393,13 +408,18 @@
tabsColumns.value[e].children.forEach((item) => {
item.itemProps.hidden = false;
});
// formColumns.value.forEach((element) => {
// element.show = false;
// if (element.parentValue == e) {
// element.show = true;
// }
// });
tabsColumns.value.forEach((item) => {
item.children.forEach((val) => {
columns.push(val);
});
});
const obj = getFieldsValue();
const obj = await validate();
setTimeout(() => {
updateSchema(columns);
resetFields();

View File

@ -262,13 +262,13 @@
showTableSetting: true,
bordered: true,
beforeFetch: (data) => {
console.log('item.key', data)
console.log('item.key', data);
//
const querys = JSON.parse(JSON.stringify(data));
console.log('1111', querys)
console.log('1111', querys);
delete querys.page;
delete querys.limit;
console.log('querys', querys)
console.log('querys', querys);
var temp = {
id: paramsId.value,
paginationInputDto: {
@ -448,7 +448,7 @@
return createMessage.warn('请选择一条数据进行编辑');
}
console.log("rowsrows",rows);
console.log('rowsrows', rows);
btnList.value.forEach((element) => {
if (element.prop === 'Edit' && element.isWFlow) {
flowCode.value = element.wFlowCode;
@ -473,8 +473,8 @@
if (haveMap.value) {
showFormModalData.value = toProps;
openShowFormModal.value = true;
console.log("mapgemoList",mapgemoList);
console.log("mapSetData",mapSetData);
console.log('mapgemoList', mapgemoList);
console.log('mapSetData', mapSetData);
MapboxComponent.value.handlerDraw(
mapgemoList.value,
mapSetData.value.isAllowEditPolygon,
@ -616,12 +616,24 @@
}
if (columnObj.table.querys) {
columnObj.table.querys.forEach((item) => {
searchFormSchema.push({
field: item.key,
component: item.type || 'Input',
label: item.label,
colProps: { span: 6 },
});
if (item.options) {
searchFormSchema.push({
field: item.key,
component: item.type || 'Input',
label: item.label,
colProps: { span: 6 },
componentProps: {
options: item.options,
},
});
} else {
searchFormSchema.push({
field: item.key,
component: item.type || 'Input',
label: item.label,
colProps: { span: 6 },
});
}
});
}
callColumns.forEach((item) => {
@ -693,8 +705,9 @@
key: designData.value.primaryKey,
keyValue,
};
getFormData(params).then((res) => {
console.log("res111",res);
getFormData(params)
.then((res) => {
console.log('res111', res);
let childTableName = designData.value.db.find((item) => item.type === 'chlid').name;
let mainTableName = designData.value.db.find((item) => item.type === 'main').name;
let subTableData = res[childTableName].map((item) => {
@ -714,12 +727,10 @@
};
});
res[mainTableName].forEach(item => {
infoUseMainTableData.value = {...infoUseMainTableData.value, ...item}
})
mapgemoList.value = formData.value
res[mainTableName].forEach((item) => {
infoUseMainTableData.value = { ...infoUseMainTableData.value, ...item };
});
mapgemoList.value = formData.value;
})
.catch((err) => {
console.log('err', err);

View File

@ -220,18 +220,14 @@
formScheme.value.formInfo.tabList.forEach((item, index) => {
item.schemas.forEach((val) => {
if (val.columns) {
console.log('val', val);
val.columns.forEach((col) => {
col.children.forEach((chil) => {
arr.push(chil);
});
});
} else {
arr.push(val);
}
});
});
console.log('item.columns', arr);
formScheme.value.formInfo.schemas = arr;
}
if (formScheme.value.formInfo.tabList && formScheme.value.formInfo.tabList.length == 1) {
@ -243,8 +239,6 @@
arr.push(chil);
});
});
} else {
arr.push(item);
}
});
formScheme.value.formInfo.schemas = arr;
@ -283,7 +277,16 @@
!['Upload', 'Uploadimg', 'Password', 'Timerange', 'Datetimerange'].includes(t.component),
)
.map((t) => {
return { key: t.field, label: t.label, type: t.component };
if (t.componentProps.options) {
return {
key: t.field,
label: t.label,
type: t.component,
options: t.componentProps.options,
};
} else {
return { key: t.field, label: t.label, type: t.component };
}
});
// -

View File

@ -158,10 +158,16 @@
if (scheme.formInfo.tabList && scheme.formInfo.tabList.length > 1) {
const arr: any = [];
scheme.formInfo.tabList.forEach((item, index) => {
const rowArr: any = [];
item.schemas.forEach((col) => {
if (col.ptype !== 'gridlayout') {
rowArr.push(col);
}
});
arr.push({
label: item.text,
value: index + 1,
children: item.schemas,
children: rowArr,
});
});
scheme.formInfo.schemas = [
@ -183,7 +189,13 @@
];
}
if (scheme.formInfo.tabList && scheme.formInfo.tabList.length == 1) {
scheme.formInfo.schemas = scheme.formInfo.tabList[0].schemas;
const arr: any = [];
scheme.formInfo.tabList[0].schemas.forEach((item) => {
if (item.ptype !== 'gridlayout') {
arr.push(item);
}
});
scheme.formInfo.schemas = arr;
}
delete scheme.formInfo.tabList;
formConfig.value.schemas = scheme.formInfo.schemas;

View File

@ -132,18 +132,22 @@
}
});
item.componentProps.options = [];
} else if (item.component === 'Grid' && item.label === '栅格布局') {
item.columns = changeCardStructure(item.columns);
item.columns.forEach((childItem) => {
childItem.children.forEach((col) => {
result.push({ ...col, ptype: 'gridlayout', pfield: item.field });
});
});
} else if (item.children && !item.field) {
item.children = changeCardStructure(item.children);
} else if (item.children && item.field.indexOf('use_card') === -1) {
item.children = changeCardStructure(item.children);
item.children = [];
} else {
if (['Grid', 'Card'].includes(item.component)) {
if (['Card'].includes(item.component)) {
item.columns[0].children = changeCardStructure(item.columns[0].children);
if (
(item.component === 'Card' || item.component === 'Grid') &&
item.columns[0].children
) {
if (item.component === 'Card' && item.columns[0].children) {
item.columns[0].children.forEach((childItem) => {
if (childItem.pfield) {
result.push(childItem);
@ -168,8 +172,8 @@
result.push(item);
});
return result;
}else{
return data
} else {
return data;
}
};
async function designSendGrandson(value) {
@ -522,7 +526,7 @@
} else if (item.component === 'CardGroup') {
item.componentProps.options = childList[item.field] || [];
result.push(item);
} else if (item.component === 'Card' || item.component === 'Grid') {
} else if (item.component === 'Card') {
item.columns[0].children = childList[item.field] || [];
result.push(item);
} else if (item.field.indexOf('use_card') !== -1) {

View File

@ -7,11 +7,6 @@ export const graphicaltableColumns: BasicColumn[] = [
dataIndex: 'tableName',
width: 200,
},
{
title: '类型',
dataIndex: 'type',
width: 200,
},
{
title: '行数据',
dataIndex: 'columnJson',

View File

@ -10,9 +10,6 @@
<a-button type="primary" @click="handleAdd"></a-button>
</template>
<template #bodyCell="{ column, record }">
<template v-if="column.key === 'type'">
{{ record.type ? '空间类型' : '非空间类型' }}
</template>
<template v-if="column.key === 'action'">
<TableAction
:actions="[
@ -22,12 +19,6 @@
handleView(record);
},
},
{
label: '编辑',
onClick: () => {
handleEdit(record);
},
},
]"
/>
</template>
@ -99,16 +90,6 @@
record,
});
}
// -
function handleEdit(record) {
isUpdate.value = true;
isDetail.value = false;
openModal(true, {
isUpdate,
isDetail,
record,
});
}
// -
function submit() {

View File

@ -10,7 +10,7 @@
:draggable="false"
:title="getTitle"
:useWrapper="true"
:width="700"
:width="900"
@ok="handleOk"
>
<div class="box-container">
@ -20,13 +20,9 @@
</div>
</div>
<BasicTable class="w-3/4 xl:w-5/5" @register="registerTable">
<template #toolbar>
<a-button type="primary" @click="handleAdd" v-if="!isDetail"> </a-button>
<!-- <a-button type="success" @click="handleSubmit"> </a-button> -->
</template>
<template #bodyCell="{ column, record }">
<template v-if="column.key === 'name' && !isDetail">
<a-input v-model:value="record.name" placeholder="请输入字段名" />
<a-input v-model:value="record.name" placeholder="请输入字段名" :disabled="true" />
</template>
<template v-if="column.key === 'type' && !isDetail">
<a-select
@ -35,29 +31,14 @@
placeholder="请选择"
v-model:value="record.type"
:options="codesTypeArr"
:disabled="true"
/>
</template>
<template v-if="column.key === 'type' && isDetail">
{{ getCodesTypeArrByType(record.type) }}
</template>
<template v-if="column.key === 'explanation' && !isDetail">
<a-input
v-model:value="record.explanation"
placeholder="请输入备注,备注内不能含有英文字符的,和:"
/>
</template>
<template v-if="column.key === 'action' && (!record.isOldColumn || !isUpdate)">
<TableAction
:actions="[
{
label: '删除',
color: 'error',
onClick: () => {
handleDelete(record);
},
},
]"
/>
<a-input v-model:value="record.explanation" placeholder="不能含有英文字符的,和:" />
</template>
</template>
</BasicTable>
@ -66,8 +47,8 @@
<script lang="ts" setup>
import { ref, onMounted, defineEmits } from 'vue';
import { BasicModal, useModalInner } from '@/components/Modal';
import { BasicTable, useTable, TableAction } from '@/components/Table';
import { columns, columns_isDetail } from './modal.data';
import { BasicTable, useTable } from '@/components/Table';
import { columns } from './modal.data';
import { useMessage } from '@/hooks/web/useMessage';
// api
import { createPicTable, updateTable } from '@/api/database/index';
@ -81,7 +62,6 @@
//
const isDetail = ref(false);
const tableName: any = ref('');
const tableColumns: any = ref([]);
const codesTypeArr: any = ref([
{ label: 'varchar', value: 'varchar' },
{ label: 'int', value: 'int' },
@ -98,7 +78,7 @@
if (!data.record) {
tableName.value = null;
setTableData([]);
handleAdd();
handleAdd_geom();
reload();
} else {
//
@ -119,18 +99,12 @@
setTableData(arr);
reload();
}
//
if (isDetail.value) {
tableColumns.value = columns_isDetail;
} else {
tableColumns.value = columns;
}
});
//
const [registerTable, { reload, setTableData, getDataSource }] = useTable({
rowKey: '',
columns: tableColumns,
columns,
formConfig: {
labelWidth: 120,
},
@ -144,50 +118,68 @@
},
});
//
function handleAdd() {
function handleAdd_geom() {
let viesObj: any = getDataSource() || [];
viesObj.push({ name: '', type: '', explanation: '', length: 255, id: new Date().getTime() });
viesObj.push(
{
name: 'gid',
type: 'varchar',
explanation: '',
length: 255,
id: new Date().getTime(),
},
{
name: 'geom',
type: 'geometry(GEOMETRY)',
explanation: '',
length: 255,
id: new Date().getTime(),
},
);
setTableData(viesObj);
reload();
}
//
function handleDelete(record: Recordable) {
let arr = getDataSource();
let newArr: any = [];
arr.forEach((item) => {
if (item.id !== record.id) {
newArr.push(item);
}
});
setTableData(newArr);
reload();
}
//
function handleOk() {
//
if (!tableName.value) {
createMessage.warn('表名是必填项!');
return;
}
//
if (!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(tableName.value)) {
createMessage.warn('表名不符合数据库表名的命名规则!');
return;
}
let arr = getDataSource();
// console.log('record', arr);
let newArr: any = [];
let flag = true;
arr.forEach((item) => {
if (
item.explanation &&
(item.explanation.indexOf(':') > -1 || item.explanation.indexOf(',') > -1)
) {
createMessage.warn('备注内不能含有英文字符的,和:');
flag = false;
}
newArr.push({
name: item.name,
type: item.type,
explanation: item.explanation,
if (arr) {
arr.forEach((item) => {
// ,:
if (
item.explanation &&
(item.explanation.indexOf(':') > -1 || item.explanation.indexOf(',') > -1)
) {
createMessage.warn('备注内不能含有英文字符的,和:');
flag = false;
}
});
});
}
//
if (flag) {
let newArr: any = [];
arr.forEach((item) => {
newArr.push({
name: item.name,
type: item.type,
explanation: item.explanation,
});
});
const param: any = {
tableName: tableName.value,
tableInfos: newArr,
};
console.log('param', param);
// console.log('param', param);
if (isUpdate.value) {
updateTable(param).then((res: Recordable) => {
console.log('res', res);

View File

@ -16,27 +16,4 @@ export const columns: BasicColumn[] = [
dataIndex: 'explanation',
key: 'explanation',
},
{
title: '操作',
dataIndex: 'action',
key: 'action',
},
];
export const columns_isDetail: BasicColumn[] = [
{
title: '字段名',
dataIndex: 'name',
key: 'name',
},
{
title: '类型',
dataIndex: 'type',
key: 'type',
},
{
title: '备注',
dataIndex: 'explanation',
key: 'explanation',
},
];

View File

@ -148,7 +148,7 @@
title: '',
});
const rules = reactive({
title: [{ required: true, message: '请选择流程标题', trigger: 'blur' }],
title: [{ required: true, message: '请填写流程标题', trigger: 'blur' }],
userId: [{ required: true, message: '请选择流程发起人', trigger: 'blur' }],
});
function changeActive(activeKey) {
@ -163,6 +163,8 @@
let content = JSON.parse(data.scheme.content);
let wfData = content.wfData;
const currentNode = wfData.find((t) => t.type == 'bpmn:StartEvent');
console.log(currentNode);
designerData.isCustmerTitle = currentNode.isCustmerTitle;
if (currentNode.authFields.length > 0) {
//
formVisble.value = true;
@ -202,33 +204,52 @@
designerData.delegateUsers = data;
}
async function handleSaveDraft() {
var processId = buildGUID();
var commit = {
schemeId: designerData.formCurrentNode.formVerison,
pkey: keyValue.value,
pkeyValue: processId,
};
var querys = {
schemeCode: designerData.isDraft ? '' : props.code,
userId: formData.userId,
title: formData.title,
processId: processId,
InstanceInfo: JSON.stringify(commit),
ParentNodeId: props.ParentNodeId,
ParentTaskId: props.ParentTaskId,
ParentProcessId: props.ParentProcessId,
};
if (props.ParentNodeId) {
querys.isChild = 1;
}
const data = await saveDraft(querys);
querys.schemeCode = '';
designerData.isDraft = true;
if (data) {
closePreview();
return createMessage.success('保存草稿成功');
let values;
if (designerData.isCustmerTitle) {
values = await formRef.value
.validate()
.then(() => {
return true;
})
.catch((error: ValidateErrorEntity<FormState>) => {
console.log('error', error);
processVisble.value = true;
activeName.value = 'flow';
return false;
});
} else {
return createMessage.error('保存草稿失败');
values = true;
}
console.log(values);
if (values) {
var processId = buildGUID();
var commit = {
schemeId: designerData.formCurrentNode.formVerison,
pkey: keyValue.value,
pkeyValue: processId,
};
var querys = {
schemeCode: designerData.isDraft ? '' : props.code,
userId: formData.userId,
title: formData.title,
processId: processId,
InstanceInfo: JSON.stringify(commit),
ParentNodeId: props.ParentNodeId,
ParentTaskId: props.ParentTaskId,
ParentProcessId: props.ParentProcessId,
};
if (props.ParentNodeId) {
querys.isChild = 1;
}
const data = await saveDraft(querys);
querys.schemeCode = '';
designerData.isDraft = true;
if (data) {
closePreview();
return createMessage.success('保存草稿成功');
} else {
return createMessage.error('保存草稿失败');
}
}
}
function handleSubmit() {
@ -278,35 +299,54 @@
}
}
async function handleCreateFlow(processId) {
var commit = {
schemeId: designerData.formCurrentNode.formVerison,
pkey: keyValue.value,
pkeyValue: processId,
};
var querys = {
schemeCode: designerData.isDraft ? '' : props.code,
userId: formData.userId,
title: formData.title,
processId: processId,
InstanceInfo: JSON.stringify(commit),
ParentNodeId: props.ParentNodeId,
ParentTaskId: props.ParentTaskId,
ParentProcessId: props.ParentProcessId,
};
if (props.ParentNodeId) {
querys.isChild = 1;
}
if (!designerData.isDraft) {
await saveDraft(querys);
querys.schemeCode = '';
designerData.isDraft = true;
}
const data = await create(querys);
if (data) {
closePreview();
return createMessage.success('发起流程成功');
let values;
if (designerData.isCustmerTitle) {
values = await formRef.value
.validate()
.then(() => {
return true;
})
.catch((error: ValidateErrorEntity<FormState>) => {
console.log('error', error);
processVisble.value = true;
activeName.value = 'flow';
return false;
});
} else {
return createMessage.error('发起流程失败');
values = true;
}
console.log(values);
if (values) {
var commit = {
schemeId: designerData.formCurrentNode.formVerison,
pkey: keyValue.value,
pkeyValue: processId,
};
var querys = {
schemeCode: designerData.isDraft ? '' : props.code,
userId: formData.userId,
title: formData.title,
processId: processId,
InstanceInfo: JSON.stringify(commit),
ParentNodeId: props.ParentNodeId,
ParentTaskId: props.ParentTaskId,
ParentProcessId: props.ParentProcessId,
};
if (props.ParentNodeId) {
querys.isChild = 1;
}
if (!designerData.isDraft) {
await saveDraft(querys);
querys.schemeCode = '';
designerData.isDraft = true;
}
const data = await create(querys);
if (data) {
closePreview();
return createMessage.success('发起流程成功');
} else {
return createMessage.error('发起流程失败');
}
}
}
async function getFormHistory() {

View File

@ -1,7 +1,7 @@
<template>
<ScrollContainer>
<div ref="wrapperRef" :class="prefixCls">
<Tabs tab-position="left" :tabBarStyle="tabBarStyle">
<Tabs tab-position="left" :tabBarStyle="tabBarStyle" v-model:activeKey="component">
<template v-for="item in settingList" :key="item.key">
<TabPane :tab="item.name">
<div :style="'display: flex; height:' + data.height">
@ -19,6 +19,7 @@
import { Tabs } from 'ant-design-vue';
import { ScrollContainer } from '@/components/Container';
import { settingList } from './data';
import { useRoute } from 'vue-router';
import {
CreateFlow,
UncompletedTask,
@ -29,6 +30,8 @@
DelegateTask,
} from './page';
const route = useRoute();
const component = route.query.component;
const TabPane = Tabs.TabPane;
const tabs = {
CreateFlow,

View File

@ -64,7 +64,7 @@
<!-- <a-divider type="vertical" /> -->
<a-layout-sider v-if="props.isRead == 0">
<a-tabs v-model:activeKey="auditName">
<a-tab-pane key="audit" tab="审批栏">
<a-tab-pane key="audit" :tab="auditTitleVal">
<div class="approval-column">
<a-form
ref="formRef"
@ -74,10 +74,7 @@
:label-col="labelCol"
:wrapper-col="wrapperCol"
>
<a-form-item
:label="designerData.isCreateAgain ? '备注' : '审批意见'"
name="des"
/>
<a-form-item :label="auditNameVal" />
<a-form-item label="">
<a-textarea
v-model:value="formData.des"
@ -234,6 +231,8 @@
});
const activeName = ref('form');
const auditName = ref('audit');
const auditTitleVal = ref('审批栏');
const auditNameVal = ref('审批意见');
function changeActive(activeKey) {
if (activeKey == 'flow') {
processVisble.value = true;
@ -262,6 +261,16 @@
console.log(wfData);
const auditNode = wfData.find((t) => t.id == data.task.unitId);
console.log(auditNode);
if (auditNode.auditTitle) {
auditTitleVal.value = auditNode.auditTitle;
}
if (designerData.isCreateAgain) {
auditNameVal.value = '备注';
} else {
if (auditNode.auditName) {
auditNameVal.value = auditNode.auditName;
}
}
let currentNode;
if (auditNode.isInherit) {
currentNode = wfData.find((t) => t.type == 'bpmn:StartEvent');
@ -495,10 +504,10 @@
async function handleBtnClick(btn) {
const instanceInfo = JSON.parse(designerData.process.instanceInfo);
//
const data = await validateForm();
if (!data) {
return;
}
// const data = await validateForm();
// if (!data) {
// return;
// }
//
if (formVisble.value) {
var querys = {

View File

@ -24,7 +24,7 @@
v-if="formVisble"
/>
</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">
<process-viewer
v-if="processVisble"