From c1c4db6170a51f809862ff94393f0612f72645ec Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@163.com>
Date: 星期四, 17 十一月 2022 21:11:42 +0800
Subject: [PATCH] #

---
 src/main/webapp/views/planType/planType.html |   48 ++++++++++++++++++++++++++++++++++++++----------
 1 files changed, 38 insertions(+), 10 deletions(-)

diff --git a/src/main/webapp/views/planType/planType.html b/src/main/webapp/views/planType/planType.html
index 26d777e..aa86ebb 100644
--- a/src/main/webapp/views/planType/planType.html
+++ b/src/main/webapp/views/planType/planType.html
@@ -119,14 +119,12 @@
 
 <!-- 琛ㄥ崟寮圭獥 -->
 <script type="text/html" id="formEditDialog">
-    <form id="formDes" lay-filter="formDes" class="layui-form layui-row" style="height: 100%">
-        <div style="height: 90%; width: 100%;" id="formDesigner"></div>
-        <hr>
-        <div class="layui-form-item text-right" style="padding-right: 25px">
-            <button class="layui-btn" lay-filter="editSubmit" lay-submit>淇濆瓨</button>
-            <button class="layui-btn layui-btn-primary" type="button" ew-event="closeDialog">鍙栨秷</button>
-        </div>
-    </form>
+    <div style="height: 90%; width: 100%;" id="formDesigner"></div>
+    <hr>
+    <div class="layui-form-item text-right" style="padding-right: 25px">
+        <button class="layui-btn" lay-filter="forEditSubmit" lay-submit>淇濆瓨</button>
+        <button class="layui-btn layui-btn-primary" type="button" ew-event="closeDialog">鍙栨秷</button>
+    </div>
 </script>
 
 <!-- js閮ㄥ垎 -->
@@ -207,14 +205,44 @@
             if (obj.event === 'form') {
                 admin.open({
                     type: 1,
-                    area: ['98%', '90%'],
+                    area: ['95%', '90%'],
                     offset: 'auto',
+                    title: '琛ㄥ崟璁捐',
                     content: $('#formEditDialog').html(),
                     success: function (layero, dIndex) {
+                        let formData = [];
+                        if (data.data) {
+                            formData = eval(data.data);
+                        }
                         let formDesIdx = formDesigner.render({
-                            data: [],
+                            data: formData,
                             elem:'#formDesigner'
                         });
+                        form.on('submit(forEditSubmit)', function () {
+                            var loadIndex = layer.load(2);
+                            $.ajax({
+                                url: baseUrl+"/planType/update/auth",
+                                headers: {'token': localStorage.getItem('token')},
+                                data: {
+                                    id: data.id,
+                                    data: JSON.stringify(formDesIdx.getData())
+                                },
+                                method: 'POST',
+                                success: function (res) {
+                                    layer.close(loadIndex);
+                                    if (res.code === 200){
+                                        layer.close(dIndex);
+                                        layer.msg(res.msg, {icon: 1});
+                                        $(".layui-laypage-btn")[0].click();
+                                    } else if (res.code === 403){
+                                        top.location.href = baseUrl+"/";
+                                    }else {
+                                        layer.msg(res.msg, {icon: 2});
+                                    }
+                                }
+                            })
+                            return false;
+                        })
                     }
                 })
             } else if (obj.event === 'delete') {

--
Gitblit v1.9.1