From 8364b57559ba25847099f8905d2b74a023277eff Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=BB=95=E5=B5=A9?= <17854119262@163.com>
Date: Mon, 24 Jun 2024 17:49:57 +0800
Subject: [PATCH] =?UTF-8?q?=E8=A1=A8=E5=8D=95=E8=B0=83=E7=94=A8-=E7=A9=BF?=
=?UTF-8?q?=E6=A2=AD=E6=A1=86=E6=9F=A5=E8=AF=A2=E3=80=81=E6=B7=BB=E5=8A=A0?=
=?UTF-8?q?=E3=80=81=E7=BC=96=E8=BE=91bug=E4=BF=AE=E6=AD=A3?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/components/Form/src/BasicForm.vue | 6 ++
.../components/VFormItem/index.vue | 58 +++++------
.../demo/form-design/core/formItemConfig.ts | 2 +-
.../demo/onlineform/formCall/CallModal.vue | 73 +++++++++-----
src/views/demo/onlineform/formCall/index.vue | 97 ++++++++++++-------
.../onlineform/formModule/modalDesign.vue | 13 +--
6 files changed, 152 insertions(+), 97 deletions(-)
diff --git a/src/components/Form/src/BasicForm.vue b/src/components/Form/src/BasicForm.vue
index e509b6b2..4147cd53 100644
--- a/src/components/Form/src/BasicForm.vue
+++ b/src/components/Form/src/BasicForm.vue
@@ -131,6 +131,9 @@
componentProps = {},
isHandleDateDefaultValue = true,
} = schema;
+ // if (component == 'Transfer') {
+ // formModel[schema.field] = schema.componentProps.targetKeys;
+ // }
// handle date type
if (
isHandleDateDefaultValue &&
@@ -272,6 +275,9 @@
}
function setFormModel(key: string, value: any, schema: FormSchema) {
+ if (schema.component == 'Transfer') {
+ schema.componentProps.targetKeys = value;
+ }
formModel[key] = value;
emit('field-value-change', key, value);
// TODO 优化验证,这里如果是autoLink=false手动关联的情况下才会再次触发此函数
diff --git a/src/views/demo/form-design/components/VFormItem/index.vue b/src/views/demo/form-design/components/VFormItem/index.vue
index ebe14bfc..509c2a3c 100644
--- a/src/views/demo/form-design/components/VFormItem/index.vue
+++ b/src/views/demo/form-design/components/VFormItem/index.vue
@@ -53,19 +53,19 @@
{{ schema.label }}
-
+
-
+
+ :options="selectUseOptions ? schema.componentProps.options : showSelectDictionaryList"
+ :defaultValue="schema.defaultValue"
+ >
{
const { colProps = {} } = props.schema;
return colProps;
});
const selectUseOptions = computed(() => {
- if(props.schema.dataType === undefined || props.schema.dataType === '1'){
- return true
- }else{
- return false
+ if (props.schema.dataType === undefined || props.schema.dataType === '1') {
+ return true;
+ } else {
+ return false;
}
- })
- const showSelectDictionaryList = computed(() => onlineFormDesignStore.getSelectOption(props.schema.field))
+ });
+ const showSelectDictionaryList = computed(() =>
+ onlineFormDesignStore.getSelectOption(props.schema.field),
+ );
const formItemProps = computed(() => {
const { formConfig } = unref(props);
let { field, required, rules, labelCol, wrapperCol } = unref(props.schema);
@@ -283,10 +285,10 @@
};
// 穿梭框-查找
const transferSearch = (dir: string, value: string) => {};
- // 穿梭框-选中
- const transferSelectChange = (sourceSelectedKeys: string[], targetSelectedKeys: string[]) => {
- props.schema.componentProps.selectedKeys = sourceSelectedKeys.concat(targetSelectedKeys);
- };
+ // // 穿梭框-选中
+ // const transferSelectChange = (sourceSelectedKeys: string[], targetSelectedKeys: string[]) => {
+ // props.schema.componentProps.selectedKeys = sourceSelectedKeys.concat(targetSelectedKeys);
+ // };
return {
...toRefs(state),
componentItem,
@@ -300,7 +302,7 @@
showSelectDictionaryList,
transferChange,
transferSearch,
- transferSelectChange,
+ // transferSelectChange,
};
},
});
diff --git a/src/views/demo/form-design/core/formItemConfig.ts b/src/views/demo/form-design/core/formItemConfig.ts
index 749dece1..cac2b215 100644
--- a/src/views/demo/form-design/core/formItemConfig.ts
+++ b/src/views/demo/form-design/core/formItemConfig.ts
@@ -387,7 +387,7 @@ export const commonComponents: IVFormComponent[] = [
},
],
targetKeys: [],
- selectedKeys: [],
+ // selectedKeys: [],
},
},
];
diff --git a/src/views/demo/onlineform/formCall/CallModal.vue b/src/views/demo/onlineform/formCall/CallModal.vue
index daedd398..6ac0ff21 100644
--- a/src/views/demo/onlineform/formCall/CallModal.vue
+++ b/src/views/demo/onlineform/formCall/CallModal.vue
@@ -32,7 +32,12 @@
-
+
@@ -120,7 +125,7 @@
-
+
@@ -176,7 +181,7 @@
const scrollValue = ref();
const cardLayout = ref([]);
const createOrModifyList = ref([]);
- const createOrModifyData = ref({})
+ const createOrModifyData = ref({});
// 按钮
const buttonLayout = ref([]);
// 脚本
@@ -224,9 +229,9 @@
const arr: FormSchema[] = [];
data.tab.forEach((item) => {
if (item.field == 'Tabs') {
- let arrayLength = item.componentProps.options.length
- for(let i = 0; i < arrayLength; i++){
- createOrModifyList.value.push([])
+ let arrayLength = item.componentProps.options.length;
+ for (let i = 0; i < arrayLength; i++) {
+ createOrModifyList.value.push([]);
}
item.componentProps.options.forEach((val, index) => {
val.children.forEach((opt) => {
@@ -255,6 +260,12 @@
if (['createuser', 'createtime', 'modifyuser', 'modifytime'].includes(opt.type)) {
createOrModifyList.value[index].push(opt);
}
+ if (opt.component === 'Transfer') {
+ opt.componentProps.render = (item) => `${item.title} ${item.description}`;
+ opt.componentProps.targetKeys = JSON.parse(
+ data.record[item.field]?.replace(/\r\n/g, ''),
+ );
+ }
subTableColumns.value = [
{
dataIndex: 'setting',
@@ -370,6 +381,12 @@
if (['createuser', 'createtime', 'modifyuser', 'modifytime'].includes(item.type)) {
createOrModifyList.value.push(item);
}
+ if (item.component === 'Transfer') {
+ item.componentProps.render = (item) => `${item.title} ${item.description}`;
+ item.componentProps.targetKeys = JSON.parse(
+ data.record[item.field]?.replace(/\r\n/g, ''),
+ );
+ }
subTableColumns.value = [
{
dataIndex: 'setting',
@@ -414,11 +431,11 @@
}
if (unref(isUpdate) && !unref(isDetail)) {
getTitle.value = '编辑';
- Object.keys(data.infoUseMainTableData).forEach(itemKey => {
- if(itemKey.indexOf('_time_') !== -1 || itemKey.indexOf('_user_') !== -1){
- createOrModifyData.value[itemKey] = data.infoUseMainTableData[itemKey]
- }
- })
+ Object.keys(data.infoUseMainTableData).forEach((itemKey) => {
+ if (itemKey.indexOf('_time_') !== -1 || itemKey.indexOf('_user_') !== -1) {
+ createOrModifyData.value[itemKey] = data.infoUseMainTableData[itemKey];
+ }
+ });
data.btnList.forEach((element) => {
if (element.prop === 'Edit' && element.isWFlow) {
flowCode.value = element.wFlowCode;
@@ -447,11 +464,11 @@
}
if (!unref(isUpdate) && unref(isDetail)) {
getTitle.value = '详情';
- Object.keys(data.infoUseMainTableData).forEach(itemKey => {
- if(itemKey.indexOf('_time_') !== -1 || itemKey.indexOf('_user_') !== -1){
- createOrModifyData.value[itemKey] = data.infoUseMainTableData[itemKey]
- }
- })
+ Object.keys(data.infoUseMainTableData).forEach((itemKey) => {
+ if (itemKey.indexOf('_time_') !== -1 || itemKey.indexOf('_user_') !== -1) {
+ createOrModifyData.value[itemKey] = data.infoUseMainTableData[itemKey];
+ }
+ });
let isTabs = false;
data.tab = changeCardStructure(data.tab);
data.tab.forEach((itemComponent) => {
@@ -563,7 +580,7 @@
updateSchema(columns);
resetFields();
}, 100);
- if(!isDetail.value){
+ if (!isDetail.value) {
const obj = await validate();
setTimeout(() => {
setFieldsValue(obj);
@@ -609,21 +626,25 @@
try {
let values = await validate();
// 将老创建人创建时间赋值
- values = {...values, ...createOrModifyData.value}
+ values = { ...values, ...createOrModifyData.value };
// 添加校验后脚本
let cardValueList = Object.values(cardValues.value);
cardValueList.forEach((item) => {
values = { ...values, ...item };
});
- Object.keys(values).forEach(itemKey => {
- if(!isUpdate.value){
- if(itemKey.indexOf('_time_') !== -1) values[itemKey] = dayjs().format('YYYY-MM-DD HH:mm:ss')
- if(itemKey.indexOf('_user_') !== -1) values[itemKey] = localStorage.getItem('fireUserLoginName')
- }else{
- if(itemKey.indexOf('_modify_time') !== -1) values[itemKey] = dayjs().format('YYYY-MM-DD HH:mm:ss')
- if(itemKey.indexOf('_modify_user') !== -1) values[itemKey] = localStorage.getItem('fireUserLoginName')
+ Object.keys(values).forEach((itemKey) => {
+ if (!isUpdate.value) {
+ if (itemKey.indexOf('_time_') !== -1)
+ values[itemKey] = dayjs().format('YYYY-MM-DD HH:mm:ss');
+ if (itemKey.indexOf('_user_') !== -1)
+ values[itemKey] = localStorage.getItem('fireUserLoginName');
+ } else {
+ if (itemKey.indexOf('_modify_time') !== -1)
+ values[itemKey] = dayjs().format('YYYY-MM-DD HH:mm:ss');
+ if (itemKey.indexOf('_modify_user') !== -1)
+ values[itemKey] = localStorage.getItem('fireUserLoginName');
}
- })
+ });
codeClickFunction('afterValidateForm', afterValidateForm.value);
console.log('values', values);
let query = values;
diff --git a/src/views/demo/onlineform/formCall/index.vue b/src/views/demo/onlineform/formCall/index.vue
index 8849fda1..869664c8 100644
--- a/src/views/demo/onlineform/formCall/index.vue
+++ b/src/views/demo/onlineform/formCall/index.vue
@@ -29,7 +29,11 @@
-
+
{{ dataModification(column, record) }}
@@ -86,7 +90,13 @@
-
+
@@ -136,7 +146,7 @@
import { v4 as uuidv4 } from 'uuid';
import { changeCardStructure, cardNestStructure } from '@/views/demo/onlineform/util.ts';
import { useFormCallStore } from '@/store/modules/formCall.ts';
- import ImportModal from './ImportModal/index.vue'
+ import ImportModal from './ImportModal/index.vue';
const MapboxMap = defineAsyncComponent(() => import('@/components/MapboxMaps/MapComponent.vue'));
const mapFormShow = ref(false);
const mapFormData = ref