Merge branch 'main' of http://123.132.248.154:10000/HC_YFZX/CaiYuanYiTiHua
commit
c7dddbd5be
|
|
@ -12,9 +12,9 @@ VITE_BUILD_COMPRESS = 'none'
|
|||
|
||||
# Basic interface address SPA
|
||||
#财源
|
||||
VITE_GLOB_API_URL=http://192.168.10.102:9500
|
||||
#VITE_GLOB_API_URL=http://192.168.10.102:9500
|
||||
#基础框架
|
||||
#VITE_GLOB_API_URL=http://192.168.10.102:9023
|
||||
VITE_GLOB_API_URL=http://192.168.10.102:9023
|
||||
|
||||
# File upload address, optional
|
||||
# It can be forwarded by nginx or write the actual address directly
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
<template>
|
||||
<div class="my-form-viewer">
|
||||
{{ formColumns }}
|
||||
<template v-if="tabsColumns.length > 1">
|
||||
<a-tabs style="width: 100%" @change="tabsChange">
|
||||
<a-tab-pane v-for="(colItem, index) in tabsColumns" :tab="colItem.label" :key="index">
|
||||
|
|
@ -112,7 +111,16 @@
|
|||
|
||||
const keyValue = ref('');
|
||||
const FieldsValue = ref({});
|
||||
const [registerForm, { getFieldsValue, setFieldsValue, updateSchema, resetFields, validate }] =
|
||||
useForm({
|
||||
labelWidth: 100,
|
||||
schemas: formColumns,
|
||||
showActionButtonGroup: false,
|
||||
baseColProps: { lg: 24, md: 24 },
|
||||
});
|
||||
async function getFormHistory() {
|
||||
console.log('getFormHistory');
|
||||
|
||||
const data = await LoadFormScheme({
|
||||
schemeId: props.formVerison,
|
||||
});
|
||||
|
|
@ -122,11 +130,13 @@
|
|||
console.log(props.formConfig);
|
||||
console.log("subTableColumns",subTableColumns)
|
||||
subTableDB.value = scheme.db;
|
||||
let disDetail = false;
|
||||
scheme.formInfo.tabList.forEach((tabElement, index) => {
|
||||
tabElement.schemas.forEach((element) => {
|
||||
if (element.field == props.formRelationId) {
|
||||
keyValue.value = element.componentProps.fieldName;
|
||||
getFormDetail();
|
||||
disDetail = true;
|
||||
}
|
||||
//流程设置的表单显示和编辑与表单做关联
|
||||
props.formConfig.forEach((configElement) => {
|
||||
|
|
@ -213,11 +223,22 @@
|
|||
}
|
||||
});
|
||||
formModalVisible.value = true;
|
||||
resetFields();
|
||||
setTimeout(() => {
|
||||
resetFields();
|
||||
console.log(props.flowFormData);
|
||||
if (!disDetail) {
|
||||
console.log('赋值赋值');
|
||||
if (props.flowFormData) {
|
||||
setFieldsValue(props.flowFormData);
|
||||
}
|
||||
}
|
||||
}, 10);
|
||||
scrollValue.value = { x: (subTableColumns.value.length - 1) * 140, y: 400 };
|
||||
}
|
||||
}
|
||||
async function tabsChange(e) {
|
||||
console.log('tabsChange');
|
||||
|
||||
formColumns.forEach((element) => {
|
||||
element.show = false;
|
||||
if (element.parentValue == e) {
|
||||
|
|
@ -227,7 +248,6 @@
|
|||
// 切换时保存值
|
||||
const values = await validate();
|
||||
console.log(values);
|
||||
console.log(Object.keys(FieldsValue.value));
|
||||
if (Object.keys(FieldsValue.value).length == 0) {
|
||||
FieldsValue.value = values;
|
||||
}
|
||||
|
|
@ -247,14 +267,9 @@
|
|||
});
|
||||
console.log(FieldsValue.value);
|
||||
}
|
||||
const [registerForm, { getFieldsValue, setFieldsValue, updateSchema, resetFields, validate }] =
|
||||
useForm({
|
||||
labelWidth: 100,
|
||||
schemas: formColumns,
|
||||
showActionButtonGroup: false,
|
||||
baseColProps: { lg: 24, md: 24 },
|
||||
});
|
||||
|
||||
async function getFormDetail() {
|
||||
console.log('getFormDetail');
|
||||
var instance = JSON.parse(props.instanceInfo);
|
||||
const querys = {
|
||||
id: props.formVerison,
|
||||
|
|
@ -283,28 +298,18 @@
|
|||
}
|
||||
async function getForm() {
|
||||
try {
|
||||
console.log(getFieldsValue());
|
||||
const values = await validate();
|
||||
console.log(values);
|
||||
console.log(FieldsValue.value);
|
||||
for (const key in values) {
|
||||
for (const fieKey in FieldsValue.value) {
|
||||
if (key == fieKey) {
|
||||
if (values[key] != undefined) {
|
||||
FieldsValue.value[key] = values[key];
|
||||
values[key] = FieldsValue.value[key];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
console.log(values);
|
||||
console.log(FieldsValue.value);
|
||||
let saveSubTableList = [];
|
||||
let query;
|
||||
if (Object.keys(FieldsValue.value).length == 0) {
|
||||
query = values;
|
||||
} else {
|
||||
query = FieldsValue.value;
|
||||
}
|
||||
let query = values;
|
||||
console.log(query);
|
||||
subTableList.value.forEach((item) => {
|
||||
let emptyObj = {};
|
||||
|
|
@ -327,12 +332,11 @@
|
|||
getForm,
|
||||
});
|
||||
onMounted(() => {
|
||||
if (props.flowFormData) {
|
||||
FieldsValue.value = props.flowFormData;
|
||||
}
|
||||
if (props.formVerison) {
|
||||
getFormHistory();
|
||||
} else {
|
||||
setFieldsValue({
|
||||
...props.flowFormData,
|
||||
});
|
||||
}
|
||||
});
|
||||
const addListItem = () => {
|
||||
|
|
|
|||
|
|
@ -71,13 +71,14 @@
|
|||
<a-radio-button value="1" @click="handlePostClick(false)">岗位</a-radio-button>
|
||||
<a-radio-button value="2" @click="handleRoleClick(false)">角色</a-radio-button>
|
||||
<a-radio-button value="3" @click="handleAccountClick(false)">用户</a-radio-button>
|
||||
<a-radio-button value="3" @click="handleLevelClick(false)">上下级</a-radio-button>
|
||||
<a-radio-button value="3" @click="handleNodeAuditorClick(false)"
|
||||
<a-radio-button value="4" @click="handleLevelClick(false)">上下级</a-radio-button>
|
||||
<a-radio-button value="5" @click="handleNodeAuditorClick(false)"
|
||||
>节点执行人</a-radio-button
|
||||
>
|
||||
<a-radio-button value="3" @click="handleAuditorSqlClick(false)"
|
||||
<a-radio-button value="6" @click="handleAuditorSqlClick(false)"
|
||||
>表字段</a-radio-button
|
||||
>
|
||||
<a-radio-button value="7" @click="handleSQLClick(false)">执行SQL</a-radio-button>
|
||||
</a-radio-group>
|
||||
</a-space>
|
||||
<a-table
|
||||
|
|
@ -486,6 +487,15 @@
|
|||
>
|
||||
<SelectForm ref="formRef" />
|
||||
</a-modal>
|
||||
<a-modal
|
||||
width="40%"
|
||||
v-model:open="data.SQLOpen"
|
||||
title="添加SQL"
|
||||
@ok="executeSQLHandleOk"
|
||||
:destroyOnClose="true"
|
||||
>
|
||||
<ExecuteSQL ref="executeSQLRef" />
|
||||
</a-modal>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
|
@ -494,7 +504,7 @@
|
|||
import { SelectPos } from '@/components/SelectPos/index';
|
||||
import { SelectRole } from '@/components/SelectRole/index';
|
||||
import { SelectAccount } from '@/components/SelectAccount/index';
|
||||
import { AuditorLevel, AuditorSql, AuditorNode } from './page';
|
||||
import { AuditorLevel, AuditorSql, AuditorNode, ExecuteSQL } from './page';
|
||||
import { DeleteOutlined, PlusOutlined } from '@ant-design/icons-vue';
|
||||
import { flowStore } from '@/store/modules/flow';
|
||||
import { SelectForm } from '@/components/SelectForm/index';
|
||||
|
|
@ -601,6 +611,7 @@
|
|||
formOpen: false,
|
||||
formVerisons: [],
|
||||
formName: '',
|
||||
SQLOpen: false,
|
||||
});
|
||||
|
||||
watch(
|
||||
|
|
@ -642,6 +653,8 @@
|
|||
return '节点';
|
||||
case '6':
|
||||
return '表字段';
|
||||
case '7':
|
||||
return 'SQL';
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -669,10 +682,14 @@
|
|||
node.value.lookUsers = node.value.lookUsers.concat(addData2);
|
||||
updateWfData('lookUsers');
|
||||
} else {
|
||||
let addData = selectData.filter(
|
||||
(t) => node.value.auditUsers.findIndex((t2) => t2.id == t.id && t2.type == t.type) == -1,
|
||||
);
|
||||
node.value.auditUsers = node.value.auditUsers.concat(addData);
|
||||
if (selectData.type == 7) {
|
||||
node.value.auditUsers.push(selectData);
|
||||
} else {
|
||||
let addData = selectData.filter(
|
||||
(t) => node.value.auditUsers.findIndex((t2) => t2.id == t.id && t2.type == t.type) == -1,
|
||||
);
|
||||
node.value.auditUsers = node.value.auditUsers.concat(addData);
|
||||
}
|
||||
updateWfData('auditUsers');
|
||||
}
|
||||
}
|
||||
|
|
@ -739,6 +756,22 @@
|
|||
data.nodeOpen = false;
|
||||
}
|
||||
}
|
||||
// 执行SQL
|
||||
const executeSQLRef = ref<any>();
|
||||
|
||||
function handleSQLClick(isLooker) {
|
||||
nodeId.value = node.value.id;
|
||||
data.isLooker = isLooker;
|
||||
data.SQLOpen = true;
|
||||
}
|
||||
function executeSQLHandleOk() {
|
||||
executeSQLRef.value.validateForm();
|
||||
let obj = executeSQLRef.value.getForm();
|
||||
if (obj.Sql != '') {
|
||||
addTableData(obj);
|
||||
data.SQLOpen = false;
|
||||
}
|
||||
}
|
||||
|
||||
// 数据表字段选择
|
||||
const sqlRef = ref<any>();
|
||||
|
|
@ -889,7 +922,6 @@
|
|||
obj.fieldName = element.componentProps.fieldName;
|
||||
fields.push(obj);
|
||||
} else if (['Grid'].includes(element.component) || element.type == 'subTable') {
|
||||
console.log('gridtable');
|
||||
fields.push({
|
||||
field: `${element.field}_add`,
|
||||
label: `${element.label || '表格'}-添加按钮`,
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
export { default as AuditorLevel } from './src/auditorLevel.vue';
|
||||
export { default as AuditorSql } from './src/auditorSql.vue';
|
||||
export { default as AuditorNode } from './src/auditorNode.vue';
|
||||
export { default as ExecuteSQL } from './src/executeSQL.vue';
|
||||
|
|
|
|||
|
|
@ -0,0 +1,56 @@
|
|||
<template>
|
||||
<div class="l-from-body">
|
||||
<a-form
|
||||
ref="formRef"
|
||||
:rules="data.rules"
|
||||
:model="data.formData"
|
||||
labelAlign="left"
|
||||
:label-col="labelCol"
|
||||
:wrapper-col="wrapperCol"
|
||||
>
|
||||
<a-form-item label="SQL语句" name="Sql">
|
||||
<a-textarea v-model:value="data.formData.Sql" placeholder="SQL语句" :rows="4" />
|
||||
</a-form-item>
|
||||
</a-form>
|
||||
</div>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import { reactive, ref } from 'vue';
|
||||
|
||||
const formRef = ref<any>();
|
||||
const labelCol = { span: 7 };
|
||||
const wrapperCol = { span: 17 };
|
||||
const data = reactive({
|
||||
formData: {
|
||||
Sql: '',
|
||||
type: '7',
|
||||
},
|
||||
rules: {
|
||||
Sql: [{ required: true, message: '请输入SQL语句' }],
|
||||
},
|
||||
});
|
||||
function validateForm() {
|
||||
formRef.value
|
||||
.validate()
|
||||
.then(async () => {
|
||||
return true;
|
||||
})
|
||||
.catch(async () => {
|
||||
return false;
|
||||
});
|
||||
}
|
||||
function getForm() {
|
||||
let rows = data.formData;
|
||||
rows.name = data.formData.Sql;
|
||||
return rows;
|
||||
}
|
||||
defineExpose({
|
||||
getForm,
|
||||
validateForm,
|
||||
});
|
||||
</script>
|
||||
<style scoped>
|
||||
.l-from-body {
|
||||
padding: 10px;
|
||||
}
|
||||
</style>
|
||||
|
|
@ -94,7 +94,7 @@
|
|||
/>
|
||||
</FormItem>
|
||||
<FormItem label="脚本" v-if="['Button'].includes(formConfig.currentItem.component)">
|
||||
<a-button type="primary" size="mini" @click="handleButtonClick"> 点击脚本 </a-button>
|
||||
<a-button size="mini" @click="handleButtonClick"> 点击脚本 </a-button>
|
||||
</FormItem>
|
||||
|
||||
<FormItem
|
||||
|
|
@ -283,9 +283,9 @@
|
|||
watch(
|
||||
() => formConfig.value.currentItem?.field,
|
||||
(_newValue, oldValue) => {
|
||||
currentIndex.value = formConfig.value.schemas.findIndex(
|
||||
(element) => element.field === formConfig.value.currentItem.field,
|
||||
);
|
||||
// currentIndex.value = formConfig.value.schemas.findIndex(
|
||||
// (element) => element.field === formConfig.value.currentItem.field,
|
||||
// );
|
||||
formConfig.value.schemas &&
|
||||
formItemsForEach(formConfig.value.schemas, (item) => {
|
||||
if (item.link) {
|
||||
|
|
@ -310,9 +310,9 @@
|
|||
() => formConfig.value.currentItem && formConfig.value.currentItem.component,
|
||||
() => {
|
||||
// console.log(formConfig.value);
|
||||
currentIndex.value = formConfig.value.schemas.findIndex(
|
||||
(element) => element.field === formConfig.value.currentItem.field,
|
||||
);
|
||||
// currentIndex.value = formConfig.value.schemas.findIndex(
|
||||
// (element) => element.field === formConfig.value.currentItem.field,
|
||||
// );
|
||||
allOptions.value = [];
|
||||
baseComponentControlAttrs.forEach((item) => {
|
||||
item.category = 'control';
|
||||
|
|
@ -378,7 +378,8 @@
|
|||
let arr = allOptions.value.filter((item) => {
|
||||
return item.category == 'input';
|
||||
});
|
||||
|
||||
console.log(arr);
|
||||
console.log(currentIndex.value);
|
||||
arr.forEach((item) => {
|
||||
if (item.name == 'dataTable') {
|
||||
if (currentIndex.value == -1) {
|
||||
|
|
|
|||
|
|
@ -76,7 +76,6 @@
|
|||
<a-space direction="vertical">
|
||||
<a-button
|
||||
v-model:value="formConfig.beforeSetData"
|
||||
type="primary"
|
||||
size="mini"
|
||||
@click="handleBtnClick('beforeSetData')"
|
||||
>
|
||||
|
|
@ -84,7 +83,6 @@
|
|||
</a-button>
|
||||
<a-button
|
||||
v-model:value="formConfig.afterValidateForm"
|
||||
type="primary"
|
||||
size="mini"
|
||||
@click="handleBtnClick('afterValidateForm')"
|
||||
>
|
||||
|
|
@ -92,7 +90,6 @@
|
|||
</a-button>
|
||||
<a-button
|
||||
v-model:value="formConfig.afterSaveEvent"
|
||||
type="primary"
|
||||
size="mini"
|
||||
@click="handleBtnClick('afterSaveEvent')"
|
||||
>
|
||||
|
|
@ -100,7 +97,6 @@
|
|||
</a-button>
|
||||
<a-button
|
||||
v-model:value="formConfig.changeDataEvent"
|
||||
type="primary"
|
||||
size="mini"
|
||||
@click="handleBtnClick('changeDataEvent')"
|
||||
>
|
||||
|
|
@ -209,11 +205,9 @@
|
|||
}
|
||||
// 脚本窗口提交
|
||||
function handleSubmit() {
|
||||
if (formContent.value.indexOf('=>') != -1) {
|
||||
// 表示是老版本,提示其修改为新的版本
|
||||
message.warning('脚本没有更新为最新的版本!');
|
||||
if (!checkChinese(formContent.value)) {
|
||||
message.warning('脚本的代码部分不能含有中文字符!');
|
||||
return;
|
||||
// } else if() {
|
||||
}
|
||||
if (btnClickEvent_now) {
|
||||
if (btnClickEvent_now == 'beforeSetData') {
|
||||
|
|
@ -228,6 +222,33 @@
|
|||
}
|
||||
closeModal();
|
||||
}
|
||||
|
||||
function checkChinese(str) {
|
||||
// 分割字符串为多行
|
||||
const lines = str.split('\n');
|
||||
let flag = true;
|
||||
|
||||
// 遍历每一行
|
||||
for (const line of lines) {
|
||||
// 先检查并移除console.log及其后的内容
|
||||
const consoleIndex = line.indexOf('console.log');
|
||||
let partToCheck = line;
|
||||
if (consoleIndex !== -1) {
|
||||
partToCheck = line.substring(0, consoleIndex).trim(); // 移除console.log及其后的内容,并去掉前导空格
|
||||
}
|
||||
|
||||
// 再检查'//'
|
||||
const commentIndex = partToCheck.indexOf('//');
|
||||
// 如果有'//',检查'//'前的部分并去掉前导空格;如果没有,保留原部分
|
||||
partToCheck =
|
||||
commentIndex !== -1 ? partToCheck.substring(0, commentIndex).trim() : partToCheck;
|
||||
// 代码部分不能含有中文字符
|
||||
if (!/[\u4e00-\u9fa5]/.test(partToCheck)) {
|
||||
flag = false;
|
||||
}
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
|
|
|||
|
|
@ -14,7 +14,12 @@
|
|||
<template v-if="tabsColumns.length > 1">
|
||||
<a-tabs style="width: 100%" @change="tabsChange">
|
||||
<a-tab-pane v-for="(colItem, index) in tabsColumns" :tab="colItem.label" :key="index">
|
||||
<BasicForm ref="myDataBaseFormRef" @register="registerForm" />
|
||||
<BasicForm
|
||||
ref="myDataBaseFormRef"
|
||||
@register="registerForm"
|
||||
@click="codeClickFunction('beforeSetData', beforeSetData)"
|
||||
@change="codeClickFunction('changeDataEvent', changeDataEvent)"
|
||||
/>
|
||||
</a-tab-pane>
|
||||
</a-tabs>
|
||||
</template>
|
||||
|
|
@ -23,6 +28,8 @@
|
|||
ref="myDataBaseFormRef"
|
||||
@register="registerForm"
|
||||
v-if="formModalVisible && tabsColumns.length < 1"
|
||||
@click="codeClickFunction('beforeSetData', beforeSetData)"
|
||||
@change="codeClickFunction('changeDataEvent', changeDataEvent)"
|
||||
/>
|
||||
<template v-for="(item, index) in cardLayout" :key="index">
|
||||
<a-row style="width: 100%">
|
||||
|
|
@ -44,6 +51,20 @@
|
|||
</a-col>
|
||||
</a-row>
|
||||
</template>
|
||||
<template v-for="(item, index) in buttonLayout" :key="index">
|
||||
<a-row style="width: 100%">
|
||||
<a-col :span="item?.colProps?.span || 24" style="padding: 10px">
|
||||
<a-button
|
||||
:type="item.componentProps.type"
|
||||
:shape="item.componentProps.shape"
|
||||
:size="item.componentProps.size"
|
||||
@click="codeClickFunction('codeClick', item.componentProps.clickCode)"
|
||||
>
|
||||
{{ item.label }}
|
||||
</a-button>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</template>
|
||||
<a-table
|
||||
class="sub-table"
|
||||
:columns="subTableColumns"
|
||||
|
|
@ -86,6 +107,7 @@
|
|||
import { v4 as uuidv4 } from 'uuid';
|
||||
import FormItem from './ShowFormModal/FormItem/index.vue';
|
||||
import CallModalFormItem from './CallModalFormItem/index.vue';
|
||||
|
||||
// import FormRender from '@/views/demo/form-design/components/VFormCreate/components/FormRender.vue';
|
||||
|
||||
const emit = defineEmits(['success']);
|
||||
|
|
@ -112,8 +134,21 @@
|
|||
const scrollValue = ref();
|
||||
const cardLayout = ref([]);
|
||||
const createOrModifyList = ref([]);
|
||||
// 按钮
|
||||
const buttonLayout = ref([]);
|
||||
// 脚本
|
||||
const beforeSetData = ref('');
|
||||
const afterValidateForm = ref('');
|
||||
const afterSaveEvent = ref('');
|
||||
const changeDataEvent = ref('');
|
||||
const [registerModal, { setModalProps, closeModal }] = useModalInner((data: any) => {
|
||||
console.log('daaaaa', data);
|
||||
// 脚本
|
||||
beforeSetData.value = data?.beforeSetData;
|
||||
afterValidateForm.value = data?.afterValidateForm;
|
||||
afterSaveEvent.value = data?.afterSaveEvent;
|
||||
changeDataEvent.value = data?.changeDataEvent;
|
||||
|
||||
isUpdate.value = !!data?.isUpdate;
|
||||
isDetail.value = !!data?.isDetail;
|
||||
const arr: FormSchema[] = [];
|
||||
|
|
@ -133,6 +168,9 @@
|
|||
if (opt.component === 'Card') {
|
||||
cardLayout.value.push(opt);
|
||||
}
|
||||
if (opt.component === 'Button') {
|
||||
buttonLayout.value.push(opt);
|
||||
}
|
||||
if (['createuser', 'createtime', 'modifyuser', 'modifytime'].includes(opt.type)) {
|
||||
createOrModifyList.value.push(opt);
|
||||
}
|
||||
|
|
@ -163,6 +201,20 @@
|
|||
scrollValue.value = { x: (subTableColumns.value.length - 1) * 140, y: 300 };
|
||||
subTableData.value = tableData;
|
||||
}
|
||||
if (opt.columns) {
|
||||
opt.columns.forEach((itemColumn) => {
|
||||
itemColumn.children.forEach((itemColumnChild) => {
|
||||
console.log('itemColumnChild', itemColumnChild);
|
||||
itemColumnChild.itemProps.hidden = true;
|
||||
if (index == 0) {
|
||||
itemColumnChild.itemProps.hidden = false;
|
||||
}
|
||||
arr.push(itemColumnChild);
|
||||
val.children.push(itemColumnChild);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
opt.itemProps.hidden = true;
|
||||
if (index == 0) {
|
||||
opt.itemProps.hidden = false;
|
||||
|
|
@ -173,6 +225,7 @@
|
|||
});
|
||||
tabsColumns.value = item.componentProps.options;
|
||||
console.log('tabsColumns', tabsColumns.value);
|
||||
console.log('formColumns', formColumns.value);
|
||||
} else {
|
||||
if (item.rules !== undefined) {
|
||||
let myString = item.rules[0].pattern;
|
||||
|
|
@ -188,6 +241,9 @@
|
|||
if (item.component === 'Card') {
|
||||
cardLayout.value.push(item);
|
||||
}
|
||||
if (item.component === 'Button') {
|
||||
buttonLayout.value.push(item);
|
||||
}
|
||||
if (['createuser', 'createtime', 'modifyuser', 'modifytime'].includes(item.type)) {
|
||||
createOrModifyList.value.push(item);
|
||||
}
|
||||
|
|
@ -272,14 +328,14 @@
|
|||
console.log('eee', e);
|
||||
console.log('tabsColumns', tabsColumns);
|
||||
const columns: FormSchema[] = [];
|
||||
// tabsColumns.value.forEach((item) => {
|
||||
// item.children.forEach((val) => {
|
||||
// val.itemProps.hidden = true;
|
||||
// });
|
||||
// });
|
||||
// tabsColumns.value[e].children.forEach((item) => {
|
||||
// item.itemProps.hidden = false;
|
||||
// });
|
||||
tabsColumns.value.forEach((item) => {
|
||||
item.children.forEach((val) => {
|
||||
val.itemProps.hidden = true;
|
||||
});
|
||||
});
|
||||
tabsColumns.value[e].children.forEach((item) => {
|
||||
item.itemProps.hidden = false;
|
||||
});
|
||||
tabsColumns.value.forEach((item) => {
|
||||
item.children.forEach((val) => {
|
||||
columns.push(val);
|
||||
|
|
@ -287,10 +343,16 @@
|
|||
});
|
||||
console.log('columns', columns);
|
||||
console.log('formColumns', formColumns);
|
||||
const obj = getFieldsValue();
|
||||
console.log('values', getFieldsValue());
|
||||
// resetFields();
|
||||
setTimeout(() => {
|
||||
updateSchema(columns);
|
||||
console.log('values', getFieldsValue());
|
||||
resetFields();
|
||||
}, 100);
|
||||
setTimeout(() => {
|
||||
setFieldsValue(obj);
|
||||
}, 500);
|
||||
}
|
||||
function generateUniqueDigits(length: number): number[] {
|
||||
const digits = new Set<number>();
|
||||
|
|
@ -328,18 +390,20 @@
|
|||
async function ModalSureClick() {
|
||||
try {
|
||||
const values = await validate();
|
||||
// 添加校验后脚本
|
||||
codeClickFunction('afterValidateForm', afterValidateForm.value);
|
||||
console.log('values', values);
|
||||
let query = values;
|
||||
let saveSubTableList = [];
|
||||
// subTableList.value.forEach((item) => {
|
||||
// let emptyObj = {};
|
||||
// for (const key in item) {
|
||||
// if (key === 'key') continue;
|
||||
// emptyObj[key] = item[key];
|
||||
// }
|
||||
// saveSubTableList.push(emptyObj);
|
||||
// });
|
||||
// query[subTableId.value] = JSON.stringify(saveSubTableList);
|
||||
subTableList.value.forEach((item) => {
|
||||
let emptyObj = {};
|
||||
for (const key in item) {
|
||||
if (key === 'key') continue;
|
||||
emptyObj[key] = item[key];
|
||||
}
|
||||
saveSubTableList.push(emptyObj);
|
||||
});
|
||||
query[subTableId.value] = JSON.stringify(saveSubTableList);
|
||||
let params: any = {
|
||||
schemeId: primaryQuery.value.id,
|
||||
isUpdate: isUpdate.value,
|
||||
|
|
@ -376,6 +440,9 @@
|
|||
}
|
||||
} finally {
|
||||
setModalProps({ confirmLoading: false });
|
||||
// 添加保存后脚本
|
||||
codeClickFunction('afterSaveEvent', afterSaveEvent.value);
|
||||
closeFunc();
|
||||
}
|
||||
}
|
||||
async function handleCreateFlow(processId) {
|
||||
|
|
@ -399,7 +466,37 @@
|
|||
return createMessage.error('保存草稿失败');
|
||||
}
|
||||
}
|
||||
// 脚本执行方法
|
||||
async function codeClickFunction(code, codeClick) {
|
||||
try {
|
||||
// 动态导入utils模块
|
||||
const { utils } = await import('./utils');
|
||||
eval(codeClick);
|
||||
} catch (e) {
|
||||
switch (code) {
|
||||
case 'codeClick':
|
||||
createMessage.success('【按钮组件脚本】错误:' + e);
|
||||
break;
|
||||
case 'beforeSetData':
|
||||
createMessage.success('【添加赋值前脚本】错误:' + e);
|
||||
break;
|
||||
case 'afterValidateForm':
|
||||
createMessage.success('【添加校验后脚本】错误:' + e);
|
||||
break;
|
||||
case 'afterSaveEvent':
|
||||
createMessage.success('【添加保存后脚本】错误:' + e);
|
||||
break;
|
||||
case 'changeDataEvent':
|
||||
createMessage.success('【添加数据改变脚本】错误:' + e);
|
||||
break;
|
||||
default:
|
||||
createMessage.success('【未知脚本】错误:' + e);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
const closeFunc = () => {
|
||||
buttonLayout.value = [];
|
||||
cardLayout.value = [];
|
||||
createOrModifyList.value = [];
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -320,7 +320,7 @@
|
|||
let chlidKey: any = ref();
|
||||
if (val.type === 'chlid') {
|
||||
getOutKeyList(params).then((res: Recordable) => {
|
||||
console.log('ressss', res)
|
||||
console.log('ressss', res);
|
||||
if (res[0]) {
|
||||
res[0].db_codecolumnsList.forEach((item) => {
|
||||
if (item.isPrimaryKey == 1) {
|
||||
|
|
@ -331,9 +331,9 @@
|
|||
});
|
||||
}
|
||||
setTimeout(() => {
|
||||
console.log('chlidKey', chlidKey.value)
|
||||
console.log('chlidKey', chlidKey.value);
|
||||
}, 500);
|
||||
|
||||
|
||||
if (rel.formInfo.schemas.length > 1) {
|
||||
rel.formInfo.schemas.forEach((item) => {
|
||||
if (
|
||||
|
|
@ -407,6 +407,10 @@
|
|||
},
|
||||
activeKey: 1,
|
||||
status: 'Add',
|
||||
beforeSetData: '',
|
||||
afterValidateForm: '',
|
||||
afterSaveEvent: '',
|
||||
changeDataEvent: '',
|
||||
});
|
||||
|
||||
const handleClickForm = (status) => {
|
||||
|
|
@ -430,7 +434,7 @@
|
|||
if (rows.length > 0) {
|
||||
query.value.keyValue = rows[0][str.value];
|
||||
}
|
||||
console.log('config', config)
|
||||
console.log('config', config);
|
||||
switch (status) {
|
||||
case 'Add':
|
||||
btnList.value.forEach((element) => {
|
||||
|
|
@ -447,6 +451,10 @@
|
|||
query: query.value,
|
||||
addParams: addParamsArr.value,
|
||||
btnList: btnList.value,
|
||||
beforeSetData: config.beforeSetData,
|
||||
afterValidateForm: config.afterValidateForm,
|
||||
afterSaveEvent: config.afterSaveEvent,
|
||||
changeDataEvent: config.changeDataEvent,
|
||||
};
|
||||
if (haveMap.value) {
|
||||
showFormModalData.value = toProps;
|
||||
|
|
@ -481,6 +489,10 @@
|
|||
recordChildren: formData.value,
|
||||
query: query.value,
|
||||
btnList: btnList.value,
|
||||
beforeSetData: config.beforeSetData,
|
||||
afterValidateForm: config.afterValidateForm,
|
||||
afterSaveEvent: config.afterSaveEvent,
|
||||
changeDataEvent: config.changeDataEvent,
|
||||
};
|
||||
if (haveMap.value) {
|
||||
showFormModalData.value = toProps;
|
||||
|
|
@ -609,6 +621,7 @@
|
|||
layerFields: {},
|
||||
};
|
||||
}
|
||||
console.log('columnObj', columnObj)
|
||||
paramsId.value = res.formScheme.id;
|
||||
btnList.value = columnObj.table.btns;
|
||||
if (columnObj.table.columns) {
|
||||
|
|
@ -648,6 +661,11 @@
|
|||
unref(asyncExpandTreeRef)?.expandAll(true);
|
||||
});
|
||||
formConfig.value.schemas = formObj.formInfo.schemas;
|
||||
// 表单脚本
|
||||
formConfig.value.beforeSetData = formObj.formInfo.beforeSetData;
|
||||
formConfig.value.afterValidateForm = formObj.formInfo.afterValidateForm;
|
||||
formConfig.value.afterSaveEvent = formObj.formInfo.afterSaveEvent;
|
||||
formConfig.value.changeDataEvent = formObj.formInfo.changeDataEvent;
|
||||
});
|
||||
}
|
||||
//弹窗确定后返回调用
|
||||
|
|
|
|||
|
|
@ -0,0 +1,9 @@
|
|||
// utils.ts
|
||||
export const utils = {
|
||||
add: function add(a: number, b: number): number {
|
||||
return a + b;
|
||||
},
|
||||
subtract: function subtract(a: number, b: number): number {
|
||||
return a - b;
|
||||
},
|
||||
};
|
||||
|
|
@ -213,9 +213,19 @@
|
|||
const arr: any = [];
|
||||
formScheme.value.formInfo.tabList.forEach((item, index) => {
|
||||
item.schemas.forEach((val) => {
|
||||
arr.push(val);
|
||||
if (val.type == 'subTable' && 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) {
|
||||
|
|
|
|||
|
|
@ -154,6 +154,7 @@
|
|||
let query: any = { keyValue: record.schemeId };
|
||||
const preview: any = await functionGetPreviewForm(query);
|
||||
let scheme = JSON.parse(preview.scheme);
|
||||
console.log('scheme1111', scheme);
|
||||
if (scheme.formInfo.tabList && scheme.formInfo.tabList.length > 1) {
|
||||
const arr: any = [];
|
||||
scheme.formInfo.tabList.forEach((item, index) => {
|
||||
|
|
|
|||
|
|
@ -126,6 +126,7 @@
|
|||
let tableData = await getTableColumnData(schems);
|
||||
let tabArr: any = [];
|
||||
let tabLabelArr: any = [];
|
||||
console.log('beforedesignTab', designTab);
|
||||
designTab.schemas.forEach((item) => {
|
||||
if (item.component !== 'Tabs') {
|
||||
if (item.componentProps.defaultValue) {
|
||||
|
|
@ -167,7 +168,7 @@
|
|||
}
|
||||
// 设计子表给里面的控件增加csType字段
|
||||
if (list.type == 'subTable') {
|
||||
list.columns = changeCloums(item.columns, tableData);
|
||||
list.columns = changeCloums(list.columns, tableData);
|
||||
}
|
||||
tabArr.push(list.componentProps.fieldName);
|
||||
if (!list.componentProps.fieldName) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue