From b3592d108b8d3823908db190b57aaf85c24d4496 Mon Sep 17 00:00:00 2001 From: wintel Date: Sat, 20 Jul 2024 20:56:43 +0800 Subject: [PATCH] =?UTF-8?q?=E6=95=B0=E6=8D=AE=E6=9D=83=E9=99=90=E3=80=81?= =?UTF-8?q?=E5=AE=9A=E6=97=B6=E4=BB=BB=E5=8A=A1=E5=8E=BBvue?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Views/DataPrivilegeRules/index.cshtml | 18 +++--- OpenAuth.Mvc/Views/OpenJobs/index.cshtml | 16 ++--- .../wwwroot/userJs/dataprivilegerules.js | 59 +++++++----------- OpenAuth.Mvc/wwwroot/userJs/openjobs.js | 60 +++++++------------ OpenAuth.Mvc/wwwroot/userJs/orgs.js | 2 +- 5 files changed, 60 insertions(+), 95 deletions(-) diff --git a/OpenAuth.Mvc/Views/DataPrivilegeRules/index.cshtml b/OpenAuth.Mvc/Views/DataPrivilegeRules/index.cshtml index acf3ff98..de8252b1 100644 --- a/OpenAuth.Mvc/Views/DataPrivilegeRules/index.cshtml +++ b/OpenAuth.Mvc/Views/DataPrivilegeRules/index.cshtml @@ -25,47 +25,47 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/OpenAuth.Mvc/Views/OpenJobs/index.cshtml b/OpenAuth.Mvc/Views/OpenJobs/index.cshtml index e4f7c8a7..a6f2fa5f 100644 --- a/OpenAuth.Mvc/Views/OpenJobs/index.cshtml +++ b/OpenAuth.Mvc/Views/OpenJobs/index.cshtml @@ -42,12 +42,12 @@ - + diff --git a/OpenAuth.Mvc/wwwroot/userJs/dataprivilegerules.js b/OpenAuth.Mvc/wwwroot/userJs/dataprivilegerules.js index 0580f35d..a8e25a2f 100644 --- a/OpenAuth.Mvc/wwwroot/userJs/dataprivilegerules.js +++ b/OpenAuth.Mvc/wwwroot/userJs/dataprivilegerules.js @@ -1,6 +1,6 @@ layui.config({ base: "/js/" -}).use(['form', 'vue', 'ztree', 'layer', 'jquery', 'table', 'droptree', 'openauth', 'utils'], function () { +}).use(['form', 'ztree', 'layer', 'jquery', 'table', 'droptree', 'openauth', 'utils'], function () { var form = layui.form, layer = layui.layer, $ = layui.jquery; @@ -10,6 +10,15 @@ $("#menus").loadMenus("DataPrivilegeRule"); + var initVal = { //初始化的值 + Id: '', + SourceCode: '', + SubSourceCode: '', + Description: '', + SortNo: '', + PrivilegeRules: '', + Enable: 0, + } //加载表头 $.getJSON('/DataPrivilegeRules/Load', @@ -56,9 +65,7 @@ //添加(编辑)对话框 var editDlg = function () { - var vm; - var update = false; //是否为更新 - var show = function (data) { + var show = function (update, data) { var title = update ? "编辑信息" : "添加"; layer.open({ title: title, @@ -66,32 +73,12 @@ type: 1, content: $('#divEdit'), success: function () { - if(vm == undefined){ - vm = new Vue({ - el: "#formEdit", - data(){ - return { - tmp:data //使用一个tmp封装一下,后面可以直接用vm.tmp赋值 - } - }, - watch:{ - tmp(val){ - this.$nextTick(function () { - form.render(); //刷新select等 - layui.droptree("/Applications/GetList", "#AppName", "#AppId", false); - - }) - } - }, - mounted(){ - form.render(); - layui.droptree("/Applications/GetList", "#AppName", "#AppId", false); - - } - }); - }else{ - vm.tmp = Object.assign({}, vm.tmp,data) - } + layui.droptree("/Applications/GetList", "#AppName", "#AppId",false); + if (data == undefined) { + form.val("formEdit", initVal); + } else { + form.val("formEdit", data); + } }, end: mainList }); @@ -112,15 +99,11 @@ }); } return { - add: function () { //弹出添加 - update = false; - show({ - Id: '' - }); + add: function() { //弹出添加 + show(false); }, - update: function (data) { //弹出编辑框 - update = true; - show(data); + update: function(data) { //弹出编辑框 + show(true,data); } }; }(); diff --git a/OpenAuth.Mvc/wwwroot/userJs/openjobs.js b/OpenAuth.Mvc/wwwroot/userJs/openjobs.js index b6a2d19f..8a13301e 100644 --- a/OpenAuth.Mvc/wwwroot/userJs/openjobs.js +++ b/OpenAuth.Mvc/wwwroot/userJs/openjobs.js @@ -1,6 +1,6 @@ -layui.config({ +layui.config({ base: "/js/" -}).use(['form', 'vue', 'ztree', 'layer', 'jquery', 'table', 'droptree', 'openauth', 'utils'], function () { +}).use(['form', 'ztree', 'layer', 'jquery', 'table', 'droptree', 'openauth', 'utils'], function () { var form = layui.form, layer = layui.layer, $ = layui.jquery; @@ -10,6 +10,15 @@ $("#menus").loadMenus("OpenJob"); + var initVal = { //初始化的值 + Id: '', + JobName: '', + JobCall: '', + JobCallParams: '', + Cron: '', + Remark: '' + } + //主列表加载,可反复调用进行刷新 var config = {}; //table的参数,如搜索key,点击tree的id var mainList = function(options) { @@ -29,9 +38,7 @@ //添加(编辑)对话框 var editDlg = function () { - var vm; - var update = false; //是否为更新 - var show = function (data) { + var show = function (update, data) { var title = update ? "编辑信息" : "添加"; layer.open({ title: title, @@ -39,32 +46,11 @@ type: 1, content: $('#divEdit'), success: function () { - if(vm == undefined){ - vm = new Vue({ - el: "#formEdit", - data(){ - return { - tmp:data //使用一个tmp封装一下,后面可以直接用vm.tmp赋值 - } - }, - watch:{ - tmp(val){ - this.$nextTick(function () { - form.render(); //刷新select等 - layui.droptree("/Applications/GetList", "#AppName", "#AppId", false); - - }) - } - }, - mounted(){ - form.render(); - layui.droptree("/Applications/GetList", "#AppName", "#AppId", false); - - } - }); - }else{ - vm.tmp = Object.assign({}, vm.tmp,data) - } + if (data == undefined) { + form.val("formEdit", initVal); + } else { + form.val("formEdit", data); + } }, end: mainList }); @@ -85,15 +71,11 @@ }); } return { - add: function () { //弹出添加 - update = false; - show({ - Id: '' - }); + add: function() { //弹出添加 + show(false); }, - update: function (data) { //弹出编辑框 - update = true; - show(data); + update: function(data) { //弹出编辑框 + show(true,data); } }; }(); diff --git a/OpenAuth.Mvc/wwwroot/userJs/orgs.js b/OpenAuth.Mvc/wwwroot/userJs/orgs.js index 459e3252..12c78741 100644 --- a/OpenAuth.Mvc/wwwroot/userJs/orgs.js +++ b/OpenAuth.Mvc/wwwroot/userJs/orgs.js @@ -1,6 +1,6 @@ layui.config({ base: "/js/" -}).use(['form','vue', 'ztree', 'layer', 'jquery', 'table','droptree','openauth','utils'], function () { +}).use(['form', 'ztree', 'layer', 'jquery', 'table','droptree','openauth','utils'], function () { var form = layui.form, layer = layui.layer, $ = layui.jquery;