From 1935956fe126fd85ece0229b80bcd77eedb42c2b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=A4=9C=E7=AC=99=E6=AD=8C?= <2277317060@qq.com>
Date: Mon, 10 Feb 2025 19:12:35 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=A1=A8=E5=8D=95=E6=9E=84?=
=?UTF-8?q?=E5=BB=BA?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/views/tool/draggable/elements/hw-form.vue | 2 +
.../tool/draggable/elements/hw-table.vue | 53 +++++++++++++
src/views/tool/draggable/formBoard.vue | 6 +-
src/views/tool/draggable/index.vue | 29 ++++++-
src/views/tool/draggable/nest.vue | 3 +-
.../option/functionDialog/getPageData.vue | 2 +-
.../option/functionDialog/request.vue | 78 ++++++++++++++++++-
.../option/functionDialog/setPageData.vue | 8 +-
.../tool/draggable/option/functionType.vue | 16 ++--
.../tool/draggable/option/optionForm.vue | 12 ++-
.../draggable/viewElements/hw-form-view.vue | 31 +++++---
.../draggable/viewElements/hw-input-view.vue | 8 +-
.../draggable/viewElements/hw-table-view.vue | 25 ++++++
13 files changed, 238 insertions(+), 35 deletions(-)
create mode 100644 src/views/tool/draggable/elements/hw-table.vue
create mode 100644 src/views/tool/draggable/viewElements/hw-table-view.vue
diff --git a/src/views/tool/draggable/elements/hw-form.vue b/src/views/tool/draggable/elements/hw-form.vue
index c30e44a..9b3a369 100644
--- a/src/views/tool/draggable/elements/hw-form.vue
+++ b/src/views/tool/draggable/elements/hw-form.vue
@@ -1,11 +1,13 @@
+
+
+
+
diff --git a/src/views/tool/draggable/formBoard.vue b/src/views/tool/draggable/formBoard.vue
index 3903224..e87e223 100644
--- a/src/views/tool/draggable/formBoard.vue
+++ b/src/views/tool/draggable/formBoard.vue
@@ -1,12 +1,14 @@
@@ -16,7 +18,6 @@ export default {
- {{ formData }}
@@ -30,6 +31,7 @@ const props = defineProps({
const { widgetList } = toRefs(props);
const formData = ref({ pageVariable: {} });
+provide('globalFormData', formData);
const formDataOperation = {
get: (key) => {
return formData.value.pageVariable[key];
diff --git a/src/views/tool/draggable/index.vue b/src/views/tool/draggable/index.vue
index fdf0014..3ba05d4 100644
--- a/src/views/tool/draggable/index.vue
+++ b/src/views/tool/draggable/index.vue
@@ -5,6 +5,7 @@
+ 表单组件
@@ -12,6 +13,14 @@
+ 数据展示组件
+
+
+
+
+
Config
@@ -92,11 +101,16 @@ const dragList = [
name: '表单',
labelWidth: '120px',
formData: {},
+ isInLine: false,
isReset: false,
isResetBottom: false,
isSubmitBottom: true,
submitBottomName: '提交',
resetBottomName: '重置',
+ isPagination: true,
+ total: 'total',
+ pageNum: 'pageNum',
+ pageSize: 'pageSize',
submitFunction: ''
},
tasks: [],
@@ -133,6 +147,19 @@ const dragList = [
},
{ type: 'hw-slider', isContainer: false, options: { name: '滑块', step: 2, showStops: true }, name: '滑块', id: 6 }
];
+const dragViewList = [
+ {
+ type: 'hw-table',
+ isContainer: false,
+ options: {
+ name: '表格',
+ thTdMap: { planId: '字段planId', dispatchCode: '字段dispatchCode', materialName: '字段materialName' },
+ dataKey: ''
+ },
+ name: '表格',
+ id: 101
+ }
+];
function removeItemByUuid(arr, uuid) {
arr.forEach((item, index) => {
@@ -214,7 +241,7 @@ const viewForm = () => {
.option-box {
width: 400px;
display: inline-block;
- user-select: none;
+ //user-select: none;
vertical-align: top;
margin: 8px;
border: 1px solid #ccc;
diff --git a/src/views/tool/draggable/nest.vue b/src/views/tool/draggable/nest.vue
index c80d1e1..9cee513 100644
--- a/src/views/tool/draggable/nest.vue
+++ b/src/views/tool/draggable/nest.vue
@@ -1,11 +1,13 @@
-
-
-
-
+
+
{{ options.submitBottomName }}
{{ options.resetBottomName }}
+
+
@@ -37,15 +43,22 @@ const props = defineProps({
const { options, tasks, formData } = toRefs(props);
const formDataOperation = inject('formDataOperation');
+const localData = ref({});
onBeforeMount(() => {
formData.value[options.value.key || ('form-' + options.value.uuid)] = {};
});
-const onSubmit = () => {
+const onSubmit = async () => {
try {
- const submitFunction = new Function('formData', 'request','formDataOperation', options.value.submitFunction);
- submitFunction(formData.value[options.value.key || ('form-' + options.value.uuid)], request,formDataOperation);
+ const fun = () => {
+ return `return async ()=>{
+ ${options.value.submitFunction}
+ }`;
+ };
+ const submitFunction = new Function('formData', 'request', 'formDataOperation', 'localData', fun());
+ await submitFunction(formData.value[options.value.key || ('form-' + options.value.uuid)], request, formDataOperation, localData.value)();
+ console.log();
} catch (e) {
console.log(e);
}
diff --git a/src/views/tool/draggable/viewElements/hw-input-view.vue b/src/views/tool/draggable/viewElements/hw-input-view.vue
index 877fc2d..78705ec 100644
--- a/src/views/tool/draggable/viewElements/hw-input-view.vue
+++ b/src/views/tool/draggable/viewElements/hw-input-view.vue
@@ -1,9 +1,7 @@
-
-
-
-
-
+
+
+
+
+
+
+