Showing
1 changed file
with
9 additions
and
7 deletions
@@ -3,6 +3,7 @@ layui.define(['table', 'form', 'laydate', 'common', 'sessions', 'xmSelect', 'lay | @@ -3,6 +3,7 @@ layui.define(['table', 'form', 'laydate', 'common', 'sessions', 'xmSelect', 'lay | ||
3 | var $ = layui.$; | 3 | var $ = layui.$; |
4 | var form = layui.form; | 4 | var form = layui.form; |
5 | var common = layui.common; | 5 | var common = layui.common; |
6 | + var admin = layui.admin; | ||
6 | var table = layui.table; | 7 | var table = layui.table; |
7 | //对外暴露的接口 | 8 | //对外暴露的接口 |
8 | exports('reportSelectAdd', function (data) { | 9 | exports('reportSelectAdd', function (data) { |
@@ -12,7 +13,10 @@ layui.define(['table', 'form', 'laydate', 'common', 'sessions', 'xmSelect', 'lay | @@ -12,7 +13,10 @@ layui.define(['table', 'form', 'laydate', 'common', 'sessions', 'xmSelect', 'lay | ||
12 | form.render(); | 13 | form.render(); |
13 | if (id) { | 14 | if (id) { |
14 | var url = common.domainName + '/inspection-report/report/select/findByIds'; | 15 | var url = common.domainName + '/inspection-report/report/select/findByIds'; |
15 | - $.get(url, {'id': id, 'access_token': accessToken}, function (res) { | 16 | + admin.req({ |
17 | + url: url, | ||
18 | + data: {'id': id} | ||
19 | + }).done(function (res) { | ||
16 | if (res.object) { | 20 | if (res.object) { |
17 | let data = res.object; | 21 | let data = res.object; |
18 | var $form = $("#reportSelectAddForm"); | 22 | var $form = $("#reportSelectAddForm"); |
@@ -67,12 +71,12 @@ layui.define(['table', 'form', 'laydate', 'common', 'sessions', 'xmSelect', 'lay | @@ -67,12 +71,12 @@ layui.define(['table', 'form', 'laydate', 'common', 'sessions', 'xmSelect', 'lay | ||
67 | form.on('submit(reportSelect-add-submit)', function (data) { | 71 | form.on('submit(reportSelect-add-submit)', function (data) { |
68 | var bean = data.field; | 72 | var bean = data.field; |
69 | var loading = layer.load(2); | 73 | var loading = layer.load(2); |
70 | - $.ajax({ | 74 | + admin.req({ |
71 | type: 'post', | 75 | type: 'post', |
72 | - url: common.domainName + '/inspection-report/report/select/saveOrUpdate?access_token=' + accessToken, | 76 | + url: common.domainName + '/inspection-report/report/select/saveOrUpdate', |
73 | contentType: "application/json; charset=utf-8", | 77 | contentType: "application/json; charset=utf-8", |
74 | - data: JSON.stringify(bean), | ||
75 | - success: function (res) { | 78 | + data: JSON.stringify(bean) |
79 | + }).done(function (res) { | ||
76 | layer.close(loading); | 80 | layer.close(loading); |
77 | layer.msg('保存成功', { | 81 | layer.msg('保存成功', { |
78 | offset: '15px' | 82 | offset: '15px' |
@@ -82,9 +86,7 @@ layui.define(['table', 'form', 'laydate', 'common', 'sessions', 'xmSelect', 'lay | @@ -82,9 +86,7 @@ layui.define(['table', 'form', 'laydate', 'common', 'sessions', 'xmSelect', 'lay | ||
82 | layer.closeAll(); | 86 | layer.closeAll(); |
83 | table.reload('reportSelect_table', {}); | 87 | table.reload('reportSelect_table', {}); |
84 | }) | 88 | }) |
85 | - } | ||
86 | }); | 89 | }); |
87 | - | ||
88 | }) | 90 | }) |
89 | 91 | ||
90 | }); | 92 | }); |
-
Please register or login to post a comment