From a58991853da61dc51f49eea80c72f2a80bf4ac92 Mon Sep 17 00:00:00 2001 From: wenc000 <450292408@qq.com> Date: Fri, 31 Jan 2020 23:05:00 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E5=8A=A8=E6=80=81=E8=A1=A8?= =?UTF-8?q?=E5=8D=95=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../templates/dynamic/config/form/save.html | 99 +++++++++------ .../templates/dynamic/config/form/update.html | 115 +++++++++++------- 2 files changed, 136 insertions(+), 78 deletions(-) diff --git a/cloud-common-plugin-dynamic/src/main/resources/templates/dynamic/config/form/save.html b/cloud-common-plugin-dynamic/src/main/resources/templates/dynamic/config/form/save.html index cc3d08b..bd76285 100644 --- a/cloud-common-plugin-dynamic/src/main/resources/templates/dynamic/config/form/save.html +++ b/cloud-common-plugin-dynamic/src/main/resources/templates/dynamic/config/form/save.html @@ -67,9 +67,9 @@ - - - + + + @@ -108,39 +108,45 @@
-
- -
- +
+
+ +
+ +
-
- -
- - + -
- -
- +
+
+ +
+ +
-
-
- -
- +
+ +
+ +
@@ -230,13 +236,38 @@ } }); form.on('select(fieldType)', function(data) { + // 联表 if(data.value === 'leftJoin' || data.value === 'innerJoin' || data.value === 'rightJoin') { $('#normalFieldBox').hide(); $('#joinFieldBox').show(); - } else { - $('#joinFieldBox').hide(); - $('#normalFieldBox').show(); + $('#fieldDefaultBox').hide(); + $('#verifyBox').hide(); + if($('#joinTable').val() != '') { + $('#joinFieldDetailBox').show(); + } else { + $('#joinFieldDetailBox').hide(); + } + return; } + $('#joinFieldBox').hide(); + $('#normalFieldBox').show(); + // 选择关联字典 + if(data.value === 'select' || data.value === 'checkbox' || data.value === 'radio') { + $('#dictionaryNameBox').show(); + return; + } + $('#dictionaryNameBox').hide(); + if(data.value === 'string') { + $('#verifyBox').show(); + $('#fieldDefaultBox').show(); + return; + } + $('#verifyBox').hide(); + if(data.value === 'number' || data.value === 'double') { + $('#fieldDefaultBox').show(); + return; + } + $('#fieldDefaultBox').hide(); }); $(document.body).on('click', '#dictionaryName', function() { top.dialog.tree({ diff --git a/cloud-common-plugin-dynamic/src/main/resources/templates/dynamic/config/form/update.html b/cloud-common-plugin-dynamic/src/main/resources/templates/dynamic/config/form/update.html index b0de938..cc15f8f 100644 --- a/cloud-common-plugin-dynamic/src/main/resources/templates/dynamic/config/form/update.html +++ b/cloud-common-plugin-dynamic/src/main/resources/templates/dynamic/config/form/update.html @@ -108,39 +108,45 @@
-
- -
- +
+
+ +
+ +
-
- -
- - + -
- -
- +
+
+ +
+ +
-
-
- -
- +
+ +
+ +
@@ -214,18 +220,10 @@ joinTableFormShow: data.joinTableFormShow }); form.render(null, 'dataForm'); - if(data.fieldType === 'leftJoin' || data.fieldType === 'innerJoin' || data.fieldType === 'rightJoin') { - $('#normalFieldBox').hide(); - $('#joinFieldBox').show(); - if($('#joinTable').val()) { - $('#joinFieldDetailBox').show(); - } - } else { - $('#joinFieldBox').hide(); - $('#normalFieldBox').show(); - } + + initFormItemShowHide(data.fieldType); }, function(code, data) { - top.DialogBox.msg(data.msg); + top.dialog.msg(data.msg); }, function() { loadLayerIndex = top.dialog.msg(top.dataMessage.loading, {icon: 16, time: 0, shade: 0.3}); }, function() { @@ -269,14 +267,43 @@ } } }); - form.on('select(fieldType)', function(data) { - if(data.value === 'leftJoin' || data.value === 'innerJoin' || data.value === 'rightJoin') { + // 显示或隐藏form表单元素 + function initFormItemShowHide(value) { + // 联表 + if(value === 'leftJoin' || value === 'innerJoin' || value === 'rightJoin') { $('#normalFieldBox').hide(); $('#joinFieldBox').show(); - } else { - $('#joinFieldBox').hide(); - $('#normalFieldBox').show(); + $('#fieldDefaultBox').hide(); + $('#verifyBox').hide(); + if($('#joinTable').val() != '') { + $('#joinFieldDetailBox').show(); + } else { + $('#joinFieldDetailBox').hide(); + } + return; } + $('#joinFieldBox').hide(); + $('#normalFieldBox').show(); + // 选择关联字典 + if(value === 'select' || value === 'checkbox' || value === 'radio') { + $('#dictionaryNameBox').show(); + return; + } + $('#dictionaryNameBox').hide(); + if(value === 'string') { + $('#verifyBox').show(); + $('#fieldDefaultBox').show(); + return; + } + $('#verifyBox').hide(); + if(value === 'number' || value === 'double') { + $('#fieldDefaultBox').show(); + return; + } + $('#fieldDefaultBox').hide(); + } + form.on('select(fieldType)', function(data) { + initFormItemShowHide(data.value); }); $(document.body).on('click', '#dictionaryName', function() { top.dialog.tree({