数据权限、定时任务去vue

This commit is contained in:
wintel 2024-07-20 20:56:43 +08:00
parent c417859da7
commit b3592d108b
5 changed files with 60 additions and 95 deletions

View File

@ -25,47 +25,47 @@
<!--添加/编辑窗口-->
<div id="divEdit" style="display: none">
<form class="layui-form" action="" id="formEdit">
<input type="hidden" name="Id" v-model="Id"/>
<form class="layui-form" action="" id="formEdit" lay-filter="formEdit">
<input type="hidden" name="Id" />
<div class="layui-form-item">
<label class="layui-form-label">资源标识</label>
<div class="layui-input-block">
<input type="text" name="SourceCode" v-model="SourceCode" required lay-verify="required"
<input type="text" name="SourceCode" required lay-verify="required"
placeholder="即模块标识比如Resource" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">二级标识</label>
<div class="layui-input-block">
<input type="text" name="SubSourceCode" v-model="SubSourceCode" required lay-verify="required"
<input type="text" name="SubSourceCode" required lay-verify="required"
placeholder="二级资源标识" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">权限描述</label>
<div class="layui-input-block">
<input type="text" name="Description" v-model="Description" required lay-verify="required"
<input type="text" name="Description" required lay-verify="required"
placeholder="权限描述" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">排序号</label>
<div class="layui-input-block">
<input type="text" name="SortNo" v-model="SortNo" required lay-verify="required"
<input type="text" name="SortNo" required lay-verify="required"
placeholder="1" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">权限规则</label>
<div class="layui-input-block">
<input type="text" name="PrivilegeRules" v-model="PrivilegeRules" required lay-verify="required"
<input type="text" name="PrivilegeRules" required lay-verify="required"
placeholder="这个界面太复杂,请查看企业版效果" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">是否可用</label>
<div class="layui-input-block">
<input type="checkbox" name="Enable" v-model="Enable" lay-skin="switch" value="1">
<input type="checkbox" name="Enable" lay-skin="switch" value="1">
</div>
</div>
@ -80,4 +80,4 @@
</div>
<script type="text/javascript" src="/layui/layui.js"></script>
<script type="text/javascript" src="/userJs/dataprivilegerules.js"></script>
<script type="text/javascript" src="/userJs/dataprivilegerules.js?v3"></script>

View File

@ -42,12 +42,12 @@
<!--添加/编辑窗口-->
<div id="divEdit" style="display: none">
<form class="layui-form" action="" id="formEdit">
<input type="hidden" name="Id" v-model="tmp.Id" />
<form class="layui-form" action="" id="formEdit" lay-filter="formEdit">
<input type="hidden" name="Id" />
<div class="layui-form-item">
<label class="layui-form-label">任务名称</label>
<div class="layui-input-block">
<input type="text" name="JobName" v-model="tmp.JobName" required lay-verify="required"
<input type="text" name="JobName" required lay-verify="required"
placeholder="任务名称" autocomplete="off" class="layui-input">
</div>
</div>
@ -55,21 +55,21 @@
<div class="layui-form-item">
<label class="layui-form-label">任务地址</label>
<div class="layui-input-block">
<input type="text" name="JobCall" v-model="tmp.JobCall" required lay-verify="required"
<input type="text" name="JobCall" required lay-verify="required"
placeholder="任务地址" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">任务参数</label>
<div class="layui-input-block">
<input type="text" name="JobCallParams" v-model="tmp.JobCallParams"
<input type="text" name="JobCallParams"
placeholder="任务参数JSON格式" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">CRON表达式</label>
<div class="layui-input-block">
<input type="text" name="Cron" v-model="tmp.Cron" required lay-verify="required"
<input type="text" name="Cron" required lay-verify="required"
placeholder="CRON表达式" autocomplete="off" class="layui-input">
</div>
</div>
@ -77,7 +77,7 @@
<div class="layui-form-item">
<label class="layui-form-label">备注</label>
<div class="layui-input-block">
<input type="text" name="Remark" v-model="tmp.Remark"
<input type="text" name="Remark"
placeholder="备注" autocomplete="off" class="layui-input">
</div>
</div>
@ -92,6 +92,6 @@
</div>
<script type="text/javascript" src="/layui/layui.js"></script>
<script type="text/javascript" src="/userJs/openjobs.js"></script>
<script type="text/javascript" src="/userJs/openjobs.js?v3"></script>

View File

@ -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);
}
};
}();

View File

@ -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);
}
};
}();

View File

@ -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;