From 60da5bb6db72be7d2ec74c97ea5ecd8291d6ec5d Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@63.com>
Date: 星期二, 22 十一月 2022 15:28:18 +0800
Subject: [PATCH] #

---
 src/main/webapp/views/planType/planType.html |   69 +++++++++++++++++++++++++++++++++-
 1 files changed, 66 insertions(+), 3 deletions(-)

diff --git a/src/main/webapp/views/planType/planType.html b/src/main/webapp/views/planType/planType.html
index 7f671e0..d48f46a 100644
--- a/src/main/webapp/views/planType/planType.html
+++ b/src/main/webapp/views/planType/planType.html
@@ -7,6 +7,10 @@
     <title>寮圭獥瀹炰緥</title>
     <link rel="stylesheet" href="../../static/layui/css/layui.css" media="all">
     <link rel="stylesheet" href="../../static/css/admin.css?v=318" media="all">
+
+    <link rel="stylesheet" href="../../static/layui/lay/modules/formDesigner/cron.css" />
+    <link rel="stylesheet" href="../../static/layui/lay/modules/formDesigner/labelGeneration.css" />
+    <link rel="stylesheet" href="../../static/layui/lay/modules/formDesigner/formDesigner.css" />
     <!--[if lt IE 9]>
     <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
     <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
@@ -108,26 +112,40 @@
 
 <!-- 琛ㄦ牸鎿嶄綔鍒� -->
 <script type="text/html" id="eDialogTbBar">
+    <a class="layui-btn layui-btn-sm" lay-event="form"><i class="layui-icon">&#xe63c;</i>琛ㄥ崟</a>
     <a class="layui-btn layui-btn-sm layui-btn-primary" lay-event="edit"><i class="layui-icon">&#xe642;</i>淇敼</a>
     <a class="layui-btn layui-btn-sm layui-btn-danger" lay-event="delete"><i class="layui-icon">&#xe640;</i>鍒犻櫎</a>
 </script>
 
+<!-- 琛ㄥ崟寮圭獥 -->
+<script type="text/html" id="formEditDialog">
+    <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閮ㄥ垎 -->
 <script type="text/javascript" src="../../static/js/jquery/jquery-3.3.1.min.js"></script>
 <script type="text/javascript" src="../../static/layui/layui.js" charset="utf-8"></script>
 <script type="text/javascript" src="../../static/js/common.js" charset="utf-8"></script>
 <script type="text/javascript" src="../../static/js/cool.js" charset="utf-8"></script>
+<script type="text/javascript" src="../../static/layui/lay/modules/formDesigner/Sortable/Sortable.js"></script>
+<script type="text/javascript" src="../../static/layui/lay/modules/formDesigner/htmlformat.js"></script>
+<script type="text/javascript" src="../../static/layui/lay/modules/formDesigner/jsformat.js"></script>
 <script>
     layui.config({
         base: baseUrl + "/static/layui/lay/modules/"
-    }).use(['table','laydate', 'form', 'util', 'admin'], function(){
+    }).use(['table','laydate', 'form', 'util', 'admin', 'formDesigner'], function(){
         var $ = layui.jquery;
         var layer = layui.layer;
         var admin = layui.admin;
         var form = layui.form;
         var table = layui.table;
         var laydate = layui.laydate;
+        var formDesigner = layui.formDesigner;
 
         // 娣诲姞
         $('#eDialogAddBtn').click(function () {
@@ -138,7 +156,7 @@
         var insTb = table.render({
             elem: '#planTypeTable',
             headers: {token: localStorage.getItem('token')},
-            url: baseUrl+'/planType/list/auth',
+            url: baseUrl+'/planType/page/auth',
             page: true,
             limit: 16,
             limits: [16, 30, 50, 100, 200, 500],
@@ -184,7 +202,52 @@
         // 宸ュ叿鏉$偣鍑讳簨浠�
         table.on('tool(planTypeTable)', function (obj) {
             var data = obj.data;
-            if (obj.event === 'delete') {
+            if (obj.event === 'form') {
+                admin.open({
+                    type: 1,
+                    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: formData,
+                            elem:'#formDesigner'
+                        });
+                        form.on('submit(forEditSubmit)', function () {
+                            console.log(formDesIdx.getHtmlData());
+                            let loadIndex = layer.load(2);
+                            $.ajax({
+                                url: baseUrl+"/planType/update/auth",
+                                headers: {'token': localStorage.getItem('token')},
+                                data: {
+                                    id: data.id,
+                                    data: JSON.stringify(formDesIdx.getData()),
+                                    html: formDesIdx.getHtmlData()
+                                },
+                                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') {
                 var ids = [data.id];
                 doDel({ids: ids});
             } else if (obj.event === 'edit') {

--
Gitblit v1.9.1