From d339355ee4801f639ce67ffabf23399955f810f2 Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@63.com>
Date: 星期一, 21 十一月 2022 14:10:41 +0800
Subject: [PATCH] #

---
 src/main/webapp/static/js/plan/plan.js |   39 +++++++++++++++++++++++++++++++++++----
 1 files changed, 35 insertions(+), 4 deletions(-)

diff --git a/src/main/webapp/static/js/plan/plan.js b/src/main/webapp/static/js/plan/plan.js
index f3c86f9..d3beded 100644
--- a/src/main/webapp/static/js/plan/plan.js
+++ b/src/main/webapp/static/js/plan/plan.js
@@ -196,7 +196,7 @@
     $("#planAddBtn").click(function () {
         let loadIndex = layer.load(2);
         $.ajax({
-            url: baseUrl+"/planType/list/auth",
+            url: baseUrl+"/planType/list/radio/auth",
             headers: {'token': localStorage.getItem('token')},
             method: 'POST',
             success: function (res) {
@@ -207,10 +207,41 @@
                         title: '鏂板缓鍞墠瑙勫垝鐢宠鍗�',
                         content: $('#addDialogPre').html(),
                         success: function (layero, dIndex) {
-                            element.init();
-                            form.render();
+                            let template = Handlebars.compile($('#planTypeTpl').html());
+                            $('#planTypeBox').html(template({list: res.data.map(function (d) {
+                                    return {
+                                        id: d.id,
+                                        name: d.name,
+                                        checked: d.checked
+                                    }
+                                })})
+                            );
+                            element.init();form.render();
                             layer.close(loadIndex);
-                            console.log(res.data);
+
+                            form.on('submit(planTypeSubmit)', function (data) {
+                                // var loadIndex = layer.load(2);
+                                // $.ajax({
+                                //     url: baseUrl+"/plan/"+(mData?'update':'add')+"/auth",
+                                //     headers: {'token': localStorage.getItem('token')},
+                                //     data: data.field,
+                                //     method: 'POST',
+                                //     success: function (res) {
+                                //         layer.close(loadIndex);
+                                //         if (res.code === 200){
+                                //             layer.close(dIndex);
+                                //             layer.msg(res.msg, {icon: 1});
+                                //             tableReload();
+                                //         } else if (res.code === 403){
+                                //             top.location.href = baseUrl+"/";
+                                //         }else {
+                                //             layer.msg(res.msg, {icon: 2});
+                                //         }
+                                //     }
+                                // })
+                                alert(data.field.planType);
+                                return false;
+                            });
                         }
                     })
                 } else if (res.code === 403){

--
Gitblit v1.9.1