This commit is contained in:
commit
09fd705032
|
|
@ -7,7 +7,7 @@ layui.use(['table', 'layer', 'laydate', 'jquery', 'form'], function () {
|
||||||
table = layui.table;
|
table = layui.table;
|
||||||
laydate = layui.laydate;
|
laydate = layui.laydate;
|
||||||
form = layui.form;
|
form = layui.form;
|
||||||
if ($.inArray('sysCompanyManage:add', pers) < 0) {
|
if (pers && $.inArray('sysCompanyManage:add', pers) < 0) {
|
||||||
var addDiv=document.getElementById('addDiv');
|
var addDiv=document.getElementById('addDiv');
|
||||||
if(addDiv){
|
if(addDiv){
|
||||||
document.getElementById('addDiv').remove();
|
document.getElementById('addDiv').remove();
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ layui.use(['table', 'layer', 'laydate', 'jquery', 'form'], function () {
|
||||||
table = layui.table;
|
table = layui.table;
|
||||||
laydate = layui.laydate;
|
laydate = layui.laydate;
|
||||||
form = layui.form;
|
form = layui.form;
|
||||||
if ($.inArray('sysProjectContent:add', pers) < 0) {
|
if (pers && $.inArray('sysProjectContent:add', pers) < 0) {
|
||||||
var addDiv=document.getElementById('addDiv');
|
var addDiv=document.getElementById('addDiv');
|
||||||
if(addDiv){
|
if(addDiv){
|
||||||
document.getElementById('addDiv').remove();
|
document.getElementById('addDiv').remove();
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ layui.use(['table', 'layer', 'laydate', 'jquery', 'form'], function () {
|
||||||
table = layui.table;
|
table = layui.table;
|
||||||
laydate = layui.laydate;
|
laydate = layui.laydate;
|
||||||
form = layui.form;
|
form = layui.form;
|
||||||
if ($.inArray('sysMsgContent:add', pers) < 0) {
|
if (pers && $.inArray('sysMsgContent:add', pers) < 0) {
|
||||||
var addDiv=document.getElementById('addDiv');
|
var addDiv=document.getElementById('addDiv');
|
||||||
if(addDiv){
|
if(addDiv){
|
||||||
document.getElementById('addDiv').remove();
|
document.getElementById('addDiv').remove();
|
||||||
|
|
|
||||||
88
js/jq.js
88
js/jq.js
|
|
@ -1,4 +1,13 @@
|
||||||
|
var pagesPathNew = getContextPathNew();
|
||||||
|
|
||||||
|
function getContextPathNew() {
|
||||||
|
var pathName = document.location.pathname;
|
||||||
|
var index = pathName.substr(1).indexOf("/");
|
||||||
|
var result = pathName.substr(0, index + 1);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
$.ajaxSetup({
|
$.ajaxSetup({
|
||||||
|
<<<<<<< .mine
|
||||||
cache : false,
|
cache : false,
|
||||||
headers : {
|
headers : {
|
||||||
"token" : localStorage.getItem("token")
|
"token" : localStorage.getItem("token")
|
||||||
|
|
@ -20,32 +29,67 @@ $.ajaxSetup({
|
||||||
layer.msg('系统错误:' + message);
|
layer.msg('系统错误:' + message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
=======
|
||||||
|
cache: false,
|
||||||
|
headers: {
|
||||||
|
token: localStorage.getItem("token"),
|
||||||
|
},
|
||||||
|
error: function (xhr, textStatus, errorThrown) {
|
||||||
|
var msg = xhr.responseText;
|
||||||
|
var response = JSON.parse(msg);
|
||||||
|
var code = response.code;
|
||||||
|
var message = response.message;
|
||||||
|
if (code == 400) {
|
||||||
|
layer.msg(message);
|
||||||
|
} else if (code == 401) {
|
||||||
|
localStorage.removeItem("token");
|
||||||
|
// location.href = "/hnbcbackstage/login.html";
|
||||||
|
location.href = pagesPathNew + "/login.html";
|
||||||
|
} else if (code == 403) {
|
||||||
|
console.log("未授权:" + message);
|
||||||
|
layer.msg("未授权");
|
||||||
|
} else if (code == 500) {
|
||||||
|
layer.msg("系统错误:" + message);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
>>>>>>> .theirs
|
||||||
});
|
});
|
||||||
|
|
||||||
function buttonDel(data, permission, pers){
|
function buttonDel(data, permission, pers) {
|
||||||
if(permission != ""){
|
if (permission != "") {
|
||||||
if ($.inArray(permission, pers) < 0) {
|
if ($.inArray(permission, pers) < 0) {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var btn = $("<button class='layui-btn layui-btn-xs' title='删除' onclick='del(\"" + data +"\")'><i class='layui-icon'></i></button>");
|
var btn = $(
|
||||||
return btn.prop("outerHTML");
|
"<button class='layui-btn layui-btn-xs' title='删除' onclick='del(\"" +
|
||||||
|
data +
|
||||||
|
"\")'><i class='layui-icon'></i></button>"
|
||||||
|
);
|
||||||
|
return btn.prop("outerHTML");
|
||||||
}
|
}
|
||||||
|
|
||||||
function buttonEdit(href, permission, pers){
|
function buttonEdit(href, permission, pers) {
|
||||||
if(permission != ""){
|
if (permission != "") {
|
||||||
if ($.inArray(permission, pers) < 0) {
|
if ($.inArray(permission, pers) < 0) {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var btn = $("<button class='layui-btn layui-btn-xs' title='编辑' onclick='window.location=\"" + href +"\"'><i class='layui-icon'></i></button>");
|
var btn = $(
|
||||||
return btn.prop("outerHTML");
|
"<button class='layui-btn layui-btn-xs' title='编辑' onclick='window.location=\"" +
|
||||||
|
href +
|
||||||
|
"\"'><i class='layui-icon'></i></button>"
|
||||||
|
);
|
||||||
|
return btn.prop("outerHTML");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function deleteCurrentTab() {
|
||||||
function deleteCurrentTab(){
|
var lay_id = $(parent.document)
|
||||||
var lay_id = $(parent.document).find("ul.layui-tab-title").children("li.layui-this").attr("lay-id");
|
.find("ul.layui-tab-title")
|
||||||
parent.active.tabDelete(lay_id);
|
.children("li.layui-this")
|
||||||
|
.attr("lay-id");
|
||||||
|
parent.active.tabDelete(lay_id);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
11
js/main.js
11
js/main.js
|
|
@ -6,8 +6,13 @@ function initMenu() {
|
||||||
async: false,
|
async: false,
|
||||||
success: function (data) {
|
success: function (data) {
|
||||||
if (!$.isArray(data)) {
|
if (!$.isArray(data)) {
|
||||||
|
<<<<<<< .mine
|
||||||
//
|
//
|
||||||
location.href = contentPath+'/login.html';
|
location.href = contentPath+'/login.html';
|
||||||
|
=======
|
||||||
|
// location.href = ctxPath + "/login.html";
|
||||||
|
location.href = pagesPath + "/login.html";
|
||||||
|
>>>>>>> .theirs
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var menu = $("#menu");
|
var menu = $("#menu");
|
||||||
|
|
@ -106,7 +111,13 @@ function logout() {
|
||||||
url: ctxPath + "/logout",
|
url: ctxPath + "/logout",
|
||||||
success: function (data) {
|
success: function (data) {
|
||||||
localStorage.removeItem("token");
|
localStorage.removeItem("token");
|
||||||
|
<<<<<<< .mine
|
||||||
location.href = contentPath+'/login.html';
|
location.href = contentPath+'/login.html';
|
||||||
|
|
||||||
|
=======
|
||||||
|
// location.href = ctxPath + "/login.html";
|
||||||
|
location.href = pagesPath + "/login.html";
|
||||||
|
>>>>>>> .theirs
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,11 @@ function checkPermission() {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type : 'get',
|
type : 'get',
|
||||||
url : ctxPath + '/permissions/owns',
|
url : ctxPath + '/permissions/owns',
|
||||||
|
<<<<<<< .mine
|
||||||
|
|
||||||
|
=======
|
||||||
|
// contentType : "application/json; charset=utf-8",
|
||||||
|
>>>>>>> .theirs
|
||||||
async : false,
|
async : false,
|
||||||
success : function(data) {
|
success : function(data) {
|
||||||
pers = data;
|
pers = data;
|
||||||
|
|
|
||||||
|
|
@ -1,150 +1,159 @@
|
||||||
var startWorkFiles = {};
|
var startWorkFiles = {};
|
||||||
var table
|
var table;
|
||||||
var form
|
var form;
|
||||||
var upload
|
var upload;
|
||||||
var example = null;
|
var example = null;
|
||||||
var pers = null;
|
var pers = null;
|
||||||
// 设置全局变量以保存选中行信息
|
// 设置全局变量以保存选中行信息
|
||||||
let ids = new Array();
|
let ids = new Array();
|
||||||
$(function () {
|
$(function () {
|
||||||
layui.use(['layer','form','table','upload'], function () {
|
layui.use(["layer", "form", "table", "upload"], function () {
|
||||||
var layer = layui.layer;
|
var layer = layui.layer;
|
||||||
form = layui.form;
|
form = layui.form;
|
||||||
table = layui.table;
|
table = layui.table;
|
||||||
upload = layui.upload;
|
upload = layui.upload;
|
||||||
|
|
||||||
init(table,form,'');
|
init(table, form, "");
|
||||||
|
|
||||||
var uploadIns = upload.render({
|
var uploadIns = upload.render({
|
||||||
elem: '#importBt', //绑定元素
|
elem: "#importBt", //绑定元素
|
||||||
url: ctxPath + "/ma/sendoff/import",
|
url: ctxPath + "/ma/sendoff/import",
|
||||||
accept: 'file', //允许上传的文件类型
|
accept: "file", //允许上传的文件类型
|
||||||
exts: 'xlsx|xls',
|
exts: "xlsx|xls",
|
||||||
auto: true, //是否自动上传
|
auto: true, //是否自动上传
|
||||||
multiple: false, //是否支持多文件上传
|
multiple: false, //是否支持多文件上传
|
||||||
choose: function(obj){ //选择文件后的回调函数
|
choose: function (obj) {
|
||||||
|
//选择文件后的回调函数
|
||||||
},
|
},
|
||||||
before:function(){
|
before: function () {
|
||||||
layer.msg('数据导入中,请稍等。。。', {
|
layer.msg("数据导入中,请稍等。。。", {
|
||||||
icon: 4
|
icon: 4,
|
||||||
});
|
});
|
||||||
this.data = {
|
this.data = {
|
||||||
"fileType": "sendoff"
|
fileType: "sendoff",
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
done: function(res, index, upload){ //上传完毕的回调函数
|
done: function (res, index, upload) {
|
||||||
|
//上传完毕的回调函数
|
||||||
layer.closeAll("loading");
|
layer.closeAll("loading");
|
||||||
if (res.code == 200){
|
if (res.code == 200) {
|
||||||
layer.msg('导入成功', {icon: 1, time: 2000},function () {
|
layer.msg("导入成功", { icon: 1, time: 2000 }, function () {
|
||||||
table.reload('layuiTable');
|
table.reload("layuiTable");
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
layer.msg(res.msg,{icon:2})
|
layer.msg(res.msg, { icon: 2 });
|
||||||
}
|
}
|
||||||
|
},
|
||||||
}
|
error: function () {
|
||||||
,error: function(){
|
|
||||||
layer.closeAll("loading");
|
layer.closeAll("loading");
|
||||||
console.log("请求异常回调");
|
console.log("请求异常回调");
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#searchBt").click(function () {
|
$("#searchBt").click(function () {
|
||||||
var keyWord = $("#keyWord").val();
|
var keyWord = $("#keyWord").val();
|
||||||
// var title = $("#title").val();
|
// var title = $("#title").val();
|
||||||
init(table,form,keyWord)
|
init(table, form, keyWord);
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#resetBt").click(function () {
|
$("#resetBt").click(function () {
|
||||||
var keyWord = ''
|
var keyWord = "";
|
||||||
$("#keyWord").val("");
|
$("#keyWord").val("");
|
||||||
// $("#title").val("");
|
// $("#title").val("");
|
||||||
layui.form.render('select');
|
layui.form.render("select");
|
||||||
init(table,form,keyWord)
|
init(table, form, keyWord);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
pers = checkPermission();
|
pers = checkPermission();
|
||||||
})
|
});
|
||||||
|
|
||||||
|
function init(table, form, keyWord) {
|
||||||
function init(table,form,keyWord) {
|
|
||||||
table.render({
|
table.render({
|
||||||
elem: '#layuiTable'
|
elem: "#layuiTable",
|
||||||
,url: ctxPath + "/ma/sendoff/list?keyWord="+keyWord
|
url: ctxPath + "/ma/sendoff/list?keyWord=" + keyWord,
|
||||||
,method:'post'
|
method: "post",
|
||||||
,cols: [[
|
cols: [
|
||||||
{type: 'checkbox', fixed: 'left'}
|
[
|
||||||
, { field: 'ID', title: '序号',width:'3%', sort: true, type:'numbers'}
|
{ type: "checkbox", fixed: "left" },
|
||||||
, { field: 'cxPzTime', title: '冲销凭证日期',align:'center'}
|
{
|
||||||
, { field: 'cxPzCode', title: '冲销凭证号',align:'center'}
|
field: "ID",
|
||||||
, { field: 'maCode', title: '物料号',align:'center'}
|
title: "序号",
|
||||||
, { field: 'maName', title: '物料名称',align:'center'}
|
width: "3%",
|
||||||
, { field: 'fhPzCode', title: '发货凭证号',align:'center'}
|
sort: true,
|
||||||
, {field:'right', title: '操作',toolbar:"#barDemo",align:'center'}
|
type: "numbers",
|
||||||
]]
|
},
|
||||||
,limits: [5,10,20,50,100,500] //一页选择显示3,5或10条数据
|
{ field: "cxPzTime", title: "冲销凭证日期", align: "center" },
|
||||||
, limit: 10 //一页显示5条数据
|
{ field: "cxPzCode", title: "冲销凭证号", align: "center" },
|
||||||
, response: {
|
{ field: "maCode", title: "物料号", align: "center" },
|
||||||
statusCode: 200 //规定成功的状态码,默认:0
|
{ field: "maName", title: "物料名称", align: "center" },
|
||||||
}
|
{ field: "fhPzCode", title: "发货凭证号", align: "center" },
|
||||||
, parseData: function (res) { //将原始数据解析成 table 组件所规定的数据,res为从url中get到的数据
|
{
|
||||||
|
field: "right",
|
||||||
|
title: "操作",
|
||||||
|
toolbar: "#barDemo",
|
||||||
|
align: "center",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
],
|
||||||
|
limits: [5, 10, 20, 50, 100, 500], //一页选择显示3,5或10条数据
|
||||||
|
limit: 10, //一页显示5条数据
|
||||||
|
response: {
|
||||||
|
statusCode: 200, //规定成功的状态码,默认:0
|
||||||
|
},
|
||||||
|
parseData: function (res) {
|
||||||
|
//将原始数据解析成 table 组件所规定的数据,res为从url中get到的数据
|
||||||
let result;
|
let result;
|
||||||
if (res.count > 0) {
|
if (res.count > 0) {
|
||||||
if (this.page.curr) {
|
if (this.page.curr) {
|
||||||
result = res.data.slice(this.limit * (this.page.curr - 1), this.limit * this.page.curr);
|
result = res.data.slice(
|
||||||
|
this.limit * (this.page.curr - 1),
|
||||||
|
this.limit * this.page.curr
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
result = res.data.slice(0, this.limit);
|
result = res.data.slice(0, this.limit);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
"code": res.code, //解析接口状态
|
code: res.code, //解析接口状态
|
||||||
"msg": res.msg, //解析提示文本
|
msg: res.msg, //解析提示文本
|
||||||
"count": res.count, //解析数据长度
|
count: res.count, //解析数据长度
|
||||||
"data": result //解析数据列表
|
data: result, //解析数据列表
|
||||||
};
|
};
|
||||||
}
|
},
|
||||||
,id: 'layuiTable'
|
id: "layuiTable",
|
||||||
,page: true //开启分页
|
page: true, //开启分页
|
||||||
,height: 600
|
height: 600,
|
||||||
});
|
});
|
||||||
|
|
||||||
table.on('tool(contact)', function(obj){
|
table.on("tool(contact)", function (obj) {
|
||||||
var data = obj.data;
|
var data = obj.data;
|
||||||
if(obj.event === 'del'){
|
if (obj.event === "del") {
|
||||||
del(data.id);
|
del(data.id);
|
||||||
} else if(obj.event === 'edit'){
|
} else if (obj.event === "edit") {
|
||||||
edit(data.id);
|
edit(data.id);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增
|
* 新增
|
||||||
*/
|
*/
|
||||||
function add(){
|
function add() {
|
||||||
localStorage.setItem('type','1')
|
localStorage.setItem("type", "1");
|
||||||
var index = layer.open({
|
var index = layer.open({
|
||||||
title: '新增',
|
title: "新增",
|
||||||
type: 2,
|
type: 2,
|
||||||
content: './child/sendoffAddForm.html',
|
content: "./child/sendoffAddForm.html",
|
||||||
area: ['80%', '70%'],
|
area: ["80%", "70%"],
|
||||||
maxmin: false,
|
maxmin: false,
|
||||||
btn:['确定 ','取消'],
|
btn: ["确定 ", "取消"],
|
||||||
yes:function(index,layero){
|
yes: function (index, layero) {
|
||||||
var formSubmit=layer.getChildFrame('form', index);
|
var formSubmit = layer.getChildFrame("form", index);
|
||||||
var submited = formSubmit.find('button')[0];
|
var submited = formSubmit.find("button")[0];
|
||||||
// 触发点击事件,会对表单进行验证,验证成功则提交表单,失败则返回错误信息
|
// 触发点击事件,会对表单进行验证,验证成功则提交表单,失败则返回错误信息
|
||||||
submited.click();
|
submited.click();
|
||||||
},
|
},
|
||||||
btn2:function(index,layero){
|
btn2: function (index, layero) {},
|
||||||
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -152,137 +161,137 @@ function add(){
|
||||||
* 修改
|
* 修改
|
||||||
* */
|
* */
|
||||||
function edit(id) {
|
function edit(id) {
|
||||||
localStorage.setItem('type','2')
|
localStorage.setItem("type", "2");
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: 'post',
|
type: "post",
|
||||||
url: ctxPath + '/ma/sendoff/getById',
|
url: ctxPath + "/ma/sendoff/getById",
|
||||||
data: {
|
data: {
|
||||||
"id":id
|
id: id,
|
||||||
},
|
},
|
||||||
dataType: 'text',
|
dataType: "text",
|
||||||
success: function (data) {
|
success: function (data) {
|
||||||
var height = '80%';
|
var height = "80%";
|
||||||
var width = '70%';
|
var width = "70%";
|
||||||
var index = layer.open({
|
var index = layer.open({
|
||||||
title: '修改',
|
title: "修改",
|
||||||
type: 2,
|
type: 2,
|
||||||
content: './child/sendoffForm.html',
|
content: "./child/sendoffForm.html",
|
||||||
area: [width, height],
|
area: [width, height],
|
||||||
maxmin: false,
|
maxmin: false,
|
||||||
btn:['确定 ','取消'],
|
btn: ["确定 ", "取消"],
|
||||||
success:function(layero,index){
|
success: function (layero, index) {
|
||||||
var myIframe = window[layero.find('iframe')[0]['name']];
|
var myIframe = window[layero.find("iframe")[0]["name"]];
|
||||||
var fnc = myIframe.setData(data); //aaa()为子页面的方法
|
var fnc = myIframe.setData(data); //aaa()为子页面的方法
|
||||||
},
|
},
|
||||||
yes:function(index,layero){
|
yes: function (index, layero) {
|
||||||
var formSubmit=layer.getChildFrame('form', index);
|
var formSubmit = layer.getChildFrame("form", index);
|
||||||
var submited = formSubmit.find('button')[0];
|
var submited = formSubmit.find("button")[0];
|
||||||
// 触发点击事件,会对表单进行验证,验证成功则提交表单,失败则返回错误信息
|
// 触发点击事件,会对表单进行验证,验证成功则提交表单,失败则返回错误信息
|
||||||
submited.click();
|
submited.click();
|
||||||
},
|
},
|
||||||
btn2:function(index,layero){
|
btn2: function (index, layero) {},
|
||||||
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除
|
* 删除
|
||||||
* */
|
* */
|
||||||
function del(id) {
|
function del(id) {
|
||||||
layer.confirm("确定删除吗?",function () {
|
layer.confirm("确定删除吗?", function () {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: 'post',
|
type: "post",
|
||||||
url: ctxPath + '/ma/sendoff/delete',
|
url: ctxPath + "/ma/sendoff/delete",
|
||||||
data: {
|
data: {
|
||||||
"id":id
|
id: id,
|
||||||
},
|
},
|
||||||
success: function (data) {
|
success: function (data) {
|
||||||
if(data.code == 200){
|
if (data.code == 200) {
|
||||||
layer.alert('删除成功', {icon: 1},()=>{
|
layer.alert("删除成功", { icon: 1 }, () => {
|
||||||
location.reload();
|
location.reload();
|
||||||
});
|
});
|
||||||
}else{
|
} else {
|
||||||
layer.alert('删除失败', {icon: 2});
|
layer.alert("删除失败", { icon: 2 });
|
||||||
}
|
}
|
||||||
|
},
|
||||||
}
|
});
|
||||||
})
|
});
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getData(day) {
|
||||||
function getData(day){
|
var today = new Date();
|
||||||
var today=new Date()
|
var targetday = today.getTime() + 1000 * 60 * 60 * 24 * day;
|
||||||
var targetday=today.getTime() +1000*60*60*24* day
|
today.setTime(targetday);
|
||||||
today.setTime(targetday)
|
var tYear = today.getFullYear();
|
||||||
var tYear=today.getFullYear()
|
var tMonth = today.getMonth();
|
||||||
var tMonth=today.getMonth()
|
var tDate = today.getDate();
|
||||||
var tDate=today.getDate()
|
tMonth = this.doHandMonth(tMonth + 1);
|
||||||
tMonth=this.doHandMonth(tMonth+1)
|
tDate = this.doHandMonth(tDate);
|
||||||
tDate=this.doHandMonth(tDate)
|
return tYear + "-" + tMonth + "-" + tDate;
|
||||||
return tYear +"-" + tMonth+"-"+tDate
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function doHandMonth(month) {
|
||||||
function doHandMonth(month){
|
var m = month;
|
||||||
var m=month
|
if (month.toString().length == 1) {
|
||||||
if(month.toString().length==1){
|
m = "0" + month;
|
||||||
m="0"+month
|
|
||||||
}
|
}
|
||||||
return m
|
return m;
|
||||||
}
|
}
|
||||||
|
|
||||||
function batchDeleteBtn(){
|
function batchDeleteBtn() {
|
||||||
var selectData = layui.table.checkStatus('layuiTable').data;
|
var selectData = layui.table.checkStatus("layuiTable").data;
|
||||||
console.log(selectData);
|
console.log(selectData);
|
||||||
let ids = [];
|
let ids = [];
|
||||||
for (let i = 0; i < selectData.length; i++){
|
for (let i = 0; i < selectData.length; i++) {
|
||||||
ids.push(selectData[i].id)
|
ids.push(selectData[i].id);
|
||||||
}
|
}
|
||||||
console.log(ids);
|
console.log(ids);
|
||||||
if(ids.toString() == ''){
|
if (ids.toString() == "") {
|
||||||
return layer.alert('请选择需要删除的数据',{icon: 0});
|
return layer.alert("请选择需要删除的数据", { icon: 0 });
|
||||||
}else{
|
} else {
|
||||||
layer.confirm("确定删除所选 "+ids.length+" 条数据吗?",function () {
|
layer.confirm(
|
||||||
$.ajax({
|
"确定删除所选 " + ids.length + " 条数据吗?",
|
||||||
type: 'delete',
|
function () {
|
||||||
url: ctxPath + '/ma/sendoff/' + ids.toString(),
|
$.ajax({
|
||||||
success: function (data) {
|
type: "delete",
|
||||||
if(data.code == 200){
|
url: ctxPath + "/ma/sendoff/" + ids.toString(),
|
||||||
layer.msg('删除成功', {icon: 1},function () {
|
success: function (data) {
|
||||||
table.reload('layuiTable');
|
if (data.code == 200) {
|
||||||
});
|
layer.msg("删除成功", { icon: 1 }, function () {
|
||||||
}else{
|
table.reload("layuiTable");
|
||||||
layer.alert('删除失败', {icon: 2});
|
});
|
||||||
}
|
} else {
|
||||||
|
layer.alert("删除失败", { icon: 2 });
|
||||||
}
|
}
|
||||||
})
|
},
|
||||||
})
|
});
|
||||||
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function exportData() {
|
function exportData() {
|
||||||
var index = layer.msg('数据导出中,请稍等。。。', {
|
var index = layer.msg("数据导出中,请稍等。。。", {
|
||||||
icon: 4
|
icon: 4,
|
||||||
});
|
});
|
||||||
var token = localStorage.getItem("token");
|
var token = localStorage.getItem("token");
|
||||||
var djCode = $("#djCode").val();
|
var djCode = $("#djCode").val();
|
||||||
var maCode = $("#maCode").val();
|
var maCode = $("#maCode").val();
|
||||||
var param = {
|
var param = {
|
||||||
djCode:djCode,
|
djCode: djCode,
|
||||||
maCode:maCode
|
maCode: maCode,
|
||||||
}
|
};
|
||||||
var url = ctxPath + "/ma/sendoff/export?param=" + encodeURIComponent(JSON.stringify(param));
|
var url =
|
||||||
|
ctxPath +
|
||||||
|
"/ma/sendoff/export?param=" +
|
||||||
|
encodeURIComponent(JSON.stringify(param));
|
||||||
var xhr = new XMLHttpRequest();
|
var xhr = new XMLHttpRequest();
|
||||||
xhr.open("get", url, true);
|
xhr.open("get", url, true);
|
||||||
//设置xhr请求的超时时间
|
//设置xhr请求的超时时间
|
||||||
xhr.timeout = 100000;
|
xhr.timeout = 100000;
|
||||||
//设置响应返回的数据格式
|
//设置响应返回的数据格式
|
||||||
xhr.responseType = "blob"; // 转换流
|
xhr.responseType = "blob"; // 转换流
|
||||||
xhr.setRequestHeader("token", token);
|
xhr.setRequestHeader("token", token);
|
||||||
//构造表单数据
|
//构造表单数据
|
||||||
xhr.onload = function () {
|
xhr.onload = function () {
|
||||||
|
|
@ -295,9 +304,25 @@ function exportData() {
|
||||||
a.download = "发货冲销对应表-导出.xlsx"; // 文件名
|
a.download = "发货冲销对应表-导出.xlsx"; // 文件名
|
||||||
} else if (this.status === 401) {
|
} else if (this.status === 401) {
|
||||||
localStorage.removeItem("token");
|
localStorage.removeItem("token");
|
||||||
|
<<<<<<< .mine
|
||||||
layer.msg('用户登录过期,请重新登录', {icon: 5, time: 2000}, function () {
|
layer.msg('用户登录过期,请重新登录', {icon: 5, time: 2000}, function () {
|
||||||
location.href = contentPath+'/login.html';
|
location.href = contentPath+'/login.html';
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
=======
|
||||||
|
layer.msg(
|
||||||
|
"用户登录过期,请重新登录",
|
||||||
|
{ icon: 5, time: 2000 },
|
||||||
|
function () {
|
||||||
|
// location.href = ctxPath + '/login.html';
|
||||||
|
location.href = pagesPath + "/login.html";
|
||||||
|
}
|
||||||
|
);
|
||||||
|
>>>>>>> .theirs
|
||||||
}
|
}
|
||||||
a.click();
|
a.click();
|
||||||
window.URL.revokeObjectURL(url);
|
window.URL.revokeObjectURL(url);
|
||||||
|
|
@ -307,6 +332,8 @@ function exportData() {
|
||||||
|
|
||||||
function downloadFile() {
|
function downloadFile() {
|
||||||
var token = localStorage.getItem("token");
|
var token = localStorage.getItem("token");
|
||||||
window.location.href = ctxPath + "/download/download?filename=发货冲销对应表-导入模板.xlsx&token=" + token;
|
window.location.href =
|
||||||
|
ctxPath +
|
||||||
|
"/download/download?filename=发货冲销对应表-导入模板.xlsx&token=" +
|
||||||
|
token;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
const token = localStorage.getItem("token");
|
||||||
layui.config({
|
layui.config({
|
||||||
base: '../../js/layuiModules/', // 第三方模块所在目录
|
base: '../../js/layuiModules/', // 第三方模块所在目录
|
||||||
version: 'v1.6.4' // 插件版本号
|
version: 'v1.6.4' // 插件版本号
|
||||||
|
|
@ -414,6 +415,26 @@ function getFileList() {
|
||||||
},
|
},
|
||||||
toolbar: "#toolbar"
|
toolbar: "#toolbar"
|
||||||
});
|
});
|
||||||
|
|
||||||
|
//监听工具条
|
||||||
|
table.on('tool(fileDemo)', function (obj) {
|
||||||
|
var data = obj.data; //当前行数据
|
||||||
|
var fileName = data.fileName;
|
||||||
|
var filePath = data.filePath;
|
||||||
|
var rowIndex = obj.index;
|
||||||
|
var layEvent = obj.event; //当前点击的事件名
|
||||||
|
if (layEvent === 'download') {
|
||||||
|
downloads(fileName,filePath)
|
||||||
|
}
|
||||||
|
if (layEvent === 'del') {
|
||||||
|
var index = layer.confirm('确定要删除吗?', {
|
||||||
|
btn : [ '确定', '取消' ]
|
||||||
|
}, function() {
|
||||||
|
layer.close(index);
|
||||||
|
ajaxCommonMethod('/proProgress/delById',{'id': data.id},"删除成功","删除失败");
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function layerOpenFormForSecond(title, contentUrl) {
|
function layerOpenFormForSecond(title, contentUrl) {
|
||||||
|
|
@ -520,4 +541,49 @@ function reloadTip(tip,message,type){
|
||||||
type: type,
|
type: type,
|
||||||
message: message
|
message: message
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function downloads(fileName,filePath){
|
||||||
|
const url = ctxPath + `/proProgress/download?filePath=${encodeURIComponent(filePath)}` +`&token=`+token;
|
||||||
|
fetch(url)
|
||||||
|
.then(response => {
|
||||||
|
if (!response.ok) throw new Error('下载失败');
|
||||||
|
return response.blob();
|
||||||
|
})
|
||||||
|
.then(blob => {
|
||||||
|
const downloadUrl = window.URL.createObjectURL(blob);
|
||||||
|
const link = document.createElement('a');
|
||||||
|
link.href = downloadUrl;
|
||||||
|
link.download = fileName; // 设置下载时显示的文件名
|
||||||
|
document.body.appendChild(link);
|
||||||
|
link.click();
|
||||||
|
document.body.removeChild(link);
|
||||||
|
window.URL.revokeObjectURL(downloadUrl); // 释放内存
|
||||||
|
})
|
||||||
|
.catch(error => {
|
||||||
|
console.error('文件下载出错:', error);
|
||||||
|
alert('下载失败,请重试');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function ajaxCommonMethod(url,data,success,error){
|
||||||
|
$.ajax({
|
||||||
|
type: 'POST',
|
||||||
|
async: false, // 默认异步true,false表示同步
|
||||||
|
url: ctxPath + url,// 请求地址
|
||||||
|
contentType: "application/x-www-form-urlencoded",
|
||||||
|
dataType: 'json', // 服务器返回数据类型
|
||||||
|
data: data, //获取提交的表单字段
|
||||||
|
success: function (data) {
|
||||||
|
var resMsg = data.resMsg;
|
||||||
|
if ("数据获取成功" == resMsg) {
|
||||||
|
reloadTip("删除",success,'success');
|
||||||
|
setTimeout(function(){
|
||||||
|
getFileList();
|
||||||
|
}, 2000);
|
||||||
|
}else {
|
||||||
|
reloadTip("删除",error,"error");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -1,11 +1,13 @@
|
||||||
// var ctxPath = getContextPath();
|
// var ctxPath = getContextPath();
|
||||||
let contentPath="/czl-web"
|
let contentPath="/czl-web"
|
||||||
|
var pagesPath = getContextPath();
|
||||||
|
|
||||||
|
<<<<<<< .mine
|
||||||
let host=window.location.host;
|
let host=window.location.host;
|
||||||
let ctxPath;
|
let ctxPath;
|
||||||
console.log(window.location.protocol)
|
console.log(window.location.protocol)
|
||||||
ctxPath=window.location.protocol+"//"+host+"/czl";
|
ctxPath=window.location.protocol+"//"+host+"/czl";
|
||||||
//本地
|
//±¾µØ
|
||||||
ctxPath = window.location.protocol+"//192.168.0.14:42880/czl";
|
ctxPath = window.location.protocol+"//192.168.0.14:42880/czl";
|
||||||
|
|
||||||
// function getContextPath() {
|
// function getContextPath() {
|
||||||
|
|
@ -14,3 +16,18 @@ ctxPath = window.location.protocol+"//192.168.0.14:42880/czl";
|
||||||
// var result = pathName.substr(0, index + 1);
|
// var result = pathName.substr(0, index + 1);
|
||||||
// return result;
|
// return result;
|
||||||
// }
|
// }
|
||||||
|
=======
|
||||||
|
function getContextPath() {
|
||||||
|
var pathName = document.location.pathname;
|
||||||
|
var index = pathName.substr(1).indexOf("/");
|
||||||
|
var result = pathName.substr(0, index + 1);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
>>>>>>> .theirs
|
||||||
|
|
|
||||||
22
login.html
22
login.html
|
|
@ -135,7 +135,13 @@
|
||||||
url: ctxPath + '/users/current?token=' + token,
|
url: ctxPath + '/users/current?token=' + token,
|
||||||
success: function (data) {
|
success: function (data) {
|
||||||
localStorage.setItem("userId", data.id);
|
localStorage.setItem("userId", data.id);
|
||||||
|
<<<<<<< .mine
|
||||||
window.location.href=contentPath+"/index.html";
|
window.location.href=contentPath+"/index.html";
|
||||||
|
|
||||||
|
=======
|
||||||
|
// location.href = ctxPath + '/index.html';
|
||||||
|
location.href = pagesPath + '/index.html';
|
||||||
|
>>>>>>> .theirs
|
||||||
},
|
},
|
||||||
error: function (xhr, textStatus, errorThrown) {
|
error: function (xhr, textStatus, errorThrown) {
|
||||||
var msg = xhr.responseText;
|
var msg = xhr.responseText;
|
||||||
|
|
@ -156,8 +162,13 @@
|
||||||
//请求方式
|
//请求方式
|
||||||
type: "GET",
|
type: "GET",
|
||||||
//请求的媒体类型
|
//请求的媒体类型
|
||||||
|
<<<<<<< .mine
|
||||||
// contentType: "application/json;charset=UTF-8",
|
// contentType: "application/json;charset=UTF-8",
|
||||||
|
|
||||||
|
=======
|
||||||
|
// contentType: "application/json;charset=UTF-8",
|
||||||
|
|
||||||
|
>>>>>>> .theirs
|
||||||
//请求地址
|
//请求地址
|
||||||
url: url,
|
url: url,
|
||||||
//请求成功
|
//请求成功
|
||||||
|
|
@ -217,13 +228,24 @@
|
||||||
time: 3000,
|
time: 3000,
|
||||||
area: ['350px', '70px']
|
area: ['350px', '70px']
|
||||||
}, function () {
|
}, function () {
|
||||||
|
<<<<<<< .mine
|
||||||
// location.href = ctxPath + '/index.html';
|
// location.href = ctxPath + '/index.html';
|
||||||
window.location.href=contentPath+"/index.html";
|
window.location.href=contentPath+"/index.html";
|
||||||
//location.href = '/index.html';
|
//location.href = '/index.html';
|
||||||
|
=======
|
||||||
|
location.href = pagesPath + '/index.html';
|
||||||
|
// location.href = 'http://127.0.0.1:5502/index.html';
|
||||||
|
|
||||||
|
>>>>>>> .theirs
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
<<<<<<< .mine
|
||||||
// location.href = ctxPath + '/index.html';
|
// location.href = ctxPath + '/index.html';
|
||||||
window.location.href=contentPath+"/index.html";
|
window.location.href=contentPath+"/index.html";
|
||||||
|
=======
|
||||||
|
location.href = pagesPath + '/index.html';
|
||||||
|
// location.href = 'http://127.0.0.1:5502/index.html';
|
||||||
|
>>>>>>> .theirs
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
error: function (xhr, textStatus, errorThrown) {
|
error: function (xhr, textStatus, errorThrown) {
|
||||||
|
|
|
||||||
|
|
@ -1,80 +1,80 @@
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
|
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<link rel="stylesheet" type="text/css" media="screen" href="../../css/bootstrap.min.css">
|
<link rel="stylesheet" type="text/css" media="screen" href="../../css/bootstrap.min.css">
|
||||||
<link rel="stylesheet" type="text/css" media="screen" href="../../css/font-awesome/css/font-awesome.css">
|
<link rel="stylesheet" type="text/css" media="screen" href="../../css/font-awesome/css/font-awesome.css">
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
|
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
|
||||||
<form class="form-horizontal" onsubmit="return false" id="form">
|
<form class="form-horizontal" onsubmit="return false" id="form">
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="col-md-2 control-label">上级菜单</label>
|
<label class="col-md-2 control-label">上级菜单</label>
|
||||||
<div class="col-md-10">
|
<div class="col-md-10">
|
||||||
<select id="parentId" name="parentId" class="form-control input-sm"></select>
|
<select id="parentId" name="parentId" class="form-control input-sm"></select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="col-md-2 control-label">名称</label>
|
<label class="col-md-2 control-label">名称</label>
|
||||||
<div class="col-md-10">
|
<div class="col-md-10">
|
||||||
<input class="form-control" placeholder="名称" type="text" name="name" id="name"
|
<input class="form-control" placeholder="名称" type="text" name="name" id="name"
|
||||||
data-bv-notempty="true"
|
data-bv-notempty="true" data-bv-notempty-message="名称 不能为空">
|
||||||
data-bv-notempty-message="名称 不能为空">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="form-group">
|
|
||||||
<label class="col-md-2 control-label">样式</label>
|
|
||||||
<div class="col-md-10">
|
|
||||||
<button onclick="selectCss()" class="btn btn-primary">选择</button>
|
|
||||||
<input type="hidden" name="css" id="css" /><i id="cssImg" class="fa"></i>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label class="col-md-2 control-label">链接</label>
|
|
||||||
<div class="col-md-10">
|
|
||||||
<input class="form-control" placeholder="链接" name="href" id="href"/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label class="col-md-2 control-label">类型</label>
|
|
||||||
<div class="col-md-10">
|
|
||||||
<select name="type" class="form-control input-sm">
|
|
||||||
<option value="1">菜单</option>
|
|
||||||
<option value="2">按钮</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label class="col-md-2 control-label">权限</label>
|
|
||||||
<div class="col-md-10">
|
|
||||||
<input class="form-control" placeholder="权限" name="permission" id="permission" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label class="col-md-2 control-label">排序</label>
|
|
||||||
<div class="col-md-10">
|
|
||||||
<input class="form-control" placeholder="排序" name="sort" id="sort" type="number" value="100"
|
|
||||||
data-bv-notempty="true"
|
|
||||||
data-bv-notempty-message="排序 不能为空">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="form-actions">
|
|
||||||
<div class="row" align="center">
|
|
||||||
<div class="col-md-12">
|
|
||||||
<button class="btn btn-primary" onclick="location.href='menuList.html'">返回</button>
|
|
||||||
<button class="btn btn-primary" type="submit" onclick="add()">
|
|
||||||
<i class="fa fa-save"></i> 保存
|
|
||||||
</button>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
|
|
||||||
</fieldset>
|
<div class="form-group">
|
||||||
</form>
|
<label class="col-md-2 control-label">样式</label>
|
||||||
</div>
|
<div class="col-md-10">
|
||||||
|
<button onclick="selectCss()" class="btn btn-primary">选择</button>
|
||||||
|
<input type="hidden" name="css" id="css" /><i id="cssImg" class="fa"></i>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-md-2 control-label">链接</label>
|
||||||
|
<div class="col-md-10">
|
||||||
|
<input class="form-control" placeholder="链接" name="href" id="href" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-md-2 control-label">类型</label>
|
||||||
|
<div class="col-md-10">
|
||||||
|
<select name="type" class="form-control input-sm">
|
||||||
|
<option value="1">菜单</option>
|
||||||
|
<option value="2">按钮</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-md-2 control-label">权限</label>
|
||||||
|
<div class="col-md-10">
|
||||||
|
<input class="form-control" placeholder="权限" name="permission" id="permission" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-md-2 control-label">排序</label>
|
||||||
|
<div class="col-md-10">
|
||||||
|
<input class="form-control" placeholder="排序" name="sort" id="sort" type="number" value="100"
|
||||||
|
data-bv-notempty="true" data-bv-notempty-message="排序 不能为空">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-actions">
|
||||||
|
<div class="row" align="center">
|
||||||
|
<div class="col-md-12">
|
||||||
|
<button class="btn btn-primary" onclick="location.href='menuList.html'">返回</button>
|
||||||
|
<button class="btn btn-primary" type="submit" onclick="add()">
|
||||||
|
<i class="fa fa-save"></i> 保存
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</fieldset>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
|
||||||
<script type="text/javascript" src="../../js/jquery/jquery-3.6.0.js"></script>
|
<script type="text/javascript" src="../../js/jquery/jquery-3.6.0.js"></script>
|
||||||
<script type="text/javascript" src="../../js/jq.js"></script>
|
<script type="text/javascript" src="../../js/jq.js"></script>
|
||||||
|
|
@ -84,46 +84,48 @@
|
||||||
<script type="text/javascript" src="../../layui/layui.js"></script>
|
<script type="text/javascript" src="../../layui/layui.js"></script>
|
||||||
<script type="text/javascript" src="../../js/publicJs.js"></script>
|
<script type="text/javascript" src="../../js/publicJs.js"></script>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
layui.use('layer', function(){
|
layui.use('layer', function () {
|
||||||
var layer = layui.layer;
|
var layer = layui.layer;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
initParentMenuSelect();
|
initParentMenuSelect();
|
||||||
|
|
||||||
function add() {
|
function add() {
|
||||||
$('#form').bootstrapValidator();
|
$('#form').bootstrapValidator();
|
||||||
var bootstrapValidator = $("#form").data('bootstrapValidator');
|
var bootstrapValidator = $("#form").data('bootstrapValidator');
|
||||||
bootstrapValidator.validate();
|
bootstrapValidator.validate();
|
||||||
if(!bootstrapValidator.isValid()){
|
if (!bootstrapValidator.isValid()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var formdata = $("#form").serializeObject();
|
var formdata = $("#form").serializeObject();
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type : 'post',
|
type: 'post',
|
||||||
url : ctxPath + '/permissions',
|
url: ctxPath + '/permissions',
|
||||||
contentType: "application/json; charset=utf-8",
|
contentType: "application/json; charset=utf-8",
|
||||||
data : JSON.stringify(formdata),
|
data: JSON.stringify(formdata),
|
||||||
success : function(data) {
|
success: function (data) {
|
||||||
layer.msg("添加成功", {shift: -1, time: 1000}, function(){
|
layer.msg("添加成功", { shift: -1, time: 1000 }, function () {
|
||||||
location.href = ctxPath + "/pages/menu/menuList.html";
|
// location.href = ctxPath + "/pages/menu/menuList.html";
|
||||||
});
|
location.href = pagesPath + "/pages/menu/menuList.html";
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function selectCss(){
|
function selectCss() {
|
||||||
layer.open({
|
layer.open({
|
||||||
type: 2,
|
type: 2,
|
||||||
title: "样式",
|
title: "样式",
|
||||||
area: ['800px', '400px'],
|
area: ['800px', '400px'],
|
||||||
maxmin: true,
|
maxmin: true,
|
||||||
shadeClose: true,
|
shadeClose: true,
|
||||||
content: ['icon.html']
|
content: ['icon.html']
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
|
|
@ -1,81 +1,81 @@
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
|
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<link rel="stylesheet" type="text/css" media="screen" href="../../css/bootstrap.min.css">
|
<link rel="stylesheet" type="text/css" media="screen" href="../../css/bootstrap.min.css">
|
||||||
<link rel="stylesheet" type="text/css" media="screen" href="../../css/font-awesome/css/font-awesome.css">
|
<link rel="stylesheet" type="text/css" media="screen" href="../../css/font-awesome/css/font-awesome.css">
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
|
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
|
||||||
<form class="form-horizontal" onsubmit="return false" id="form">
|
<form class="form-horizontal" onsubmit="return false" id="form">
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<input type="hidden" id="id" name="id">
|
<input type="hidden" id="id" name="id">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="col-md-2 control-label">上级菜单</label>
|
<label class="col-md-2 control-label">上级菜单</label>
|
||||||
<div class="col-md-10">
|
<div class="col-md-10">
|
||||||
<select id="parentId" name="parentId" class="form-control input-sm"></select>
|
<select id="parentId" name="parentId" class="form-control input-sm"></select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="col-md-2 control-label">名称</label>
|
<label class="col-md-2 control-label">名称</label>
|
||||||
<div class="col-md-10">
|
<div class="col-md-10">
|
||||||
<input class="form-control" placeholder="名称" type="text" name="name" id="name"
|
<input class="form-control" placeholder="名称" type="text" name="name" id="name"
|
||||||
data-bv-notempty="true"
|
data-bv-notempty="true" data-bv-notempty-message="名称 不能为空">
|
||||||
data-bv-notempty-message="名称 不能为空">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="form-group">
|
|
||||||
<label class="col-md-2 control-label">样式</label>
|
|
||||||
<div class="col-md-10">
|
|
||||||
<button onclick="selectCss()" class="btn btn-primary">选择</button>
|
|
||||||
<input type="hidden" name="css" id="css" /><i id="cssImg" class="fa"></i>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label class="col-md-2 control-label">链接</label>
|
|
||||||
<div class="col-md-10">
|
|
||||||
<input class="form-control" placeholder="链接" name="href" id="href"/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label class="col-md-2 control-label">类型</label>
|
|
||||||
<div class="col-md-10">
|
|
||||||
<select name="type" class="form-control input-sm" id="type">
|
|
||||||
<option value="1">菜单</option>
|
|
||||||
<option value="2">按钮</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label class="col-md-2 control-label">权限</label>
|
|
||||||
<div class="col-md-10">
|
|
||||||
<input class="form-control" placeholder="权限" name="permission" id="permission" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label class="col-md-2 control-label">排序</label>
|
|
||||||
<div class="col-md-10">
|
|
||||||
<input class="form-control" placeholder="排序" name="sort" id="sort" type="number"
|
|
||||||
data-bv-notempty="true"
|
|
||||||
data-bv-notempty-message="排序 不能为空">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="form-actions">
|
|
||||||
<div class="row" align="center">
|
|
||||||
<div class="col-md-12">
|
|
||||||
<button class="btn btn-primary" onclick="location.href='menuList.html'">返回</button>
|
|
||||||
<button class="btn btn-primary" type="submit" onclick="update()">
|
|
||||||
<i class="fa fa-save"></i> 保存
|
|
||||||
</button>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
|
|
||||||
</fieldset>
|
<div class="form-group">
|
||||||
</form>
|
<label class="col-md-2 control-label">样式</label>
|
||||||
</div>
|
<div class="col-md-10">
|
||||||
|
<button onclick="selectCss()" class="btn btn-primary">选择</button>
|
||||||
|
<input type="hidden" name="css" id="css" /><i id="cssImg" class="fa"></i>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-md-2 control-label">链接</label>
|
||||||
|
<div class="col-md-10">
|
||||||
|
<input class="form-control" placeholder="链接" name="href" id="href" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-md-2 control-label">类型</label>
|
||||||
|
<div class="col-md-10">
|
||||||
|
<select name="type" class="form-control input-sm" id="type">
|
||||||
|
<option value="1">菜单</option>
|
||||||
|
<option value="2">按钮</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-md-2 control-label">权限</label>
|
||||||
|
<div class="col-md-10">
|
||||||
|
<input class="form-control" placeholder="权限" name="permission" id="permission" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-md-2 control-label">排序</label>
|
||||||
|
<div class="col-md-10">
|
||||||
|
<input class="form-control" placeholder="排序" name="sort" id="sort" type="number"
|
||||||
|
data-bv-notempty="true" data-bv-notempty-message="排序 不能为空">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-actions">
|
||||||
|
<div class="row" align="center">
|
||||||
|
<div class="col-md-12">
|
||||||
|
<button class="btn btn-primary" onclick="location.href='menuList.html'">返回</button>
|
||||||
|
<button class="btn btn-primary" type="submit" onclick="update()">
|
||||||
|
<i class="fa fa-save"></i> 保存
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</fieldset>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
|
||||||
<script type="text/javascript" src="../../js/jquery/jquery-3.6.0.js"></script>
|
<script type="text/javascript" src="../../js/jquery/jquery-3.6.0.js"></script>
|
||||||
<script type="text/javascript" src="../../js/jq.js"></script>
|
<script type="text/javascript" src="../../js/jq.js"></script>
|
||||||
|
|
@ -85,80 +85,82 @@
|
||||||
<script type="text/javascript" src="../../layui/layui.js"></script>
|
<script type="text/javascript" src="../../layui/layui.js"></script>
|
||||||
<script type="text/javascript" src="../../js/publicJs.js"></script>
|
<script type="text/javascript" src="../../js/publicJs.js"></script>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
layui.use('layer', function(){
|
layui.use('layer', function () {
|
||||||
var layer = layui.layer;
|
var layer = layui.layer;
|
||||||
});
|
});
|
||||||
|
|
||||||
initParentMenuSelect();
|
initParentMenuSelect();
|
||||||
var id = getUrlParam("id");
|
var id = getUrlParam("id");
|
||||||
initData();
|
initData();
|
||||||
|
|
||||||
function initData(){
|
function initData() {
|
||||||
if(id != ""){
|
if (id != "") {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type : 'get',
|
type: 'get',
|
||||||
url : ctxPath + '/permissions/'+id,
|
url: ctxPath + '/permissions/' + id,
|
||||||
async : false,
|
async: false,
|
||||||
success : function(data) {
|
success: function (data) {
|
||||||
$("#id").val(data.id);
|
$("#id").val(data.id);
|
||||||
$("#parentId").val(data.parentId);
|
$("#parentId").val(data.parentId);
|
||||||
$("#name").val(data.name);
|
$("#name").val(data.name);
|
||||||
var css = data.css;
|
var css = data.css;
|
||||||
$("#css").val(css);
|
$("#css").val(css);
|
||||||
$("#href").val(data.href);
|
$("#href").val(data.href);
|
||||||
$("#type").val(data.type);
|
$("#type").val(data.type);
|
||||||
$("#permission").val(data.permission);
|
$("#permission").val(data.permission);
|
||||||
$("#sort").val(data.sort);
|
$("#sort").val(data.sort);
|
||||||
|
|
||||||
if(css != ""){
|
if (css != "") {
|
||||||
$("#cssImg").addClass("fa");
|
$("#cssImg").addClass("fa");
|
||||||
$("#cssImg").addClass(css);
|
$("#cssImg").addClass(css);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
});
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function selectCss(){
|
|
||||||
layer.open({
|
|
||||||
type: 2,
|
|
||||||
title: "样式",
|
|
||||||
area: ['800px', '400px'],
|
|
||||||
maxmin: true,
|
|
||||||
shadeClose: true,
|
|
||||||
content: ['icon.html']
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function update() {
|
|
||||||
if($("#parentId").val() == id){
|
|
||||||
layer.msg("父级菜单不能是自己");
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function selectCss() {
|
||||||
|
layer.open({
|
||||||
|
type: 2,
|
||||||
|
title: "样式",
|
||||||
|
area: ['800px', '400px'],
|
||||||
|
maxmin: true,
|
||||||
|
shadeClose: true,
|
||||||
|
content: ['icon.html']
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function update() {
|
||||||
|
if ($("#parentId").val() == id) {
|
||||||
|
layer.msg("父级菜单不能是自己");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
$('#form').bootstrapValidator();
|
$('#form').bootstrapValidator();
|
||||||
var bootstrapValidator = $("#form").data('bootstrapValidator');
|
var bootstrapValidator = $("#form").data('bootstrapValidator');
|
||||||
bootstrapValidator.validate();
|
bootstrapValidator.validate();
|
||||||
if(!bootstrapValidator.isValid()){
|
if (!bootstrapValidator.isValid()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var formdata = $("#form").serializeObject();
|
var formdata = $("#form").serializeObject();
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type : 'put',
|
type: 'put',
|
||||||
url : ctxPath + '/permissions/',
|
url: ctxPath + '/permissions/',
|
||||||
contentType: "application/json; charset=utf-8",
|
contentType: "application/json; charset=utf-8",
|
||||||
data : JSON.stringify(formdata),
|
data: JSON.stringify(formdata),
|
||||||
success : function(data) {
|
success: function (data) {
|
||||||
layer.msg("修改成功", {shift: -1, time: 1000}, function(){
|
layer.msg("修改成功", { shift: -1, time: 1000 }, function () {
|
||||||
location.href = ctxPath + "/pages/menu/menuList.html";
|
// location.href = ctxPath + "/pages/menu/menuList.html";
|
||||||
});
|
location.href = pagesPath + "/pages/menu/menuList.html";
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
|
|
@ -54,7 +54,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<script src="../../js/jquery/jquery.min.js"></script>
|
<script src="../../js/jquery/jquery-3.2.0.min.js"></script>
|
||||||
<script src="../../layui-v2.8.18/layui/layui.js"></script>
|
<script src="../../layui-v2.8.18/layui/layui.js"></script>
|
||||||
<script type="text/javascript" src="../../js/publicJs.js"></script>
|
<script type="text/javascript" src="../../js/publicJs.js"></script>
|
||||||
<script type="text/javascript" src="../../js/jq.js"></script>
|
<script type="text/javascript" src="../../js/jq.js"></script>
|
||||||
|
|
|
||||||
|
|
@ -1,88 +1,88 @@
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
|
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<link rel="stylesheet" type="text/css" media="screen" href="../../css/bootstrap.min.css">
|
<link rel="stylesheet" type="text/css" media="screen" href="../../css/bootstrap.min.css">
|
||||||
<link rel="stylesheet" type="text/css" media="screen" href="../../layui/css/layui.css">
|
<link rel="stylesheet" type="text/css" media="screen" href="../../layui/css/layui.css">
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
|
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
|
||||||
<form class="form-horizontal" onsubmit="return false" id="form">
|
<form class="form-horizontal" onsubmit="return false" id="form">
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="col-md-2 control-label">用户名</label>
|
<label class="col-md-2 control-label">用户名</label>
|
||||||
<div class="col-md-10">
|
<div class="col-md-10">
|
||||||
<input class="form-control" placeholder="用户名" type="text" name="username"
|
<input class="form-control" placeholder="用户名" type="text" name="username"
|
||||||
data-bv-notempty="true"
|
data-bv-notempty="true" data-bv-notempty-message="用户名 不能为空">
|
||||||
data-bv-notempty-message="用户名 不能为空">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="form-group">
|
|
||||||
<label class="col-md-2 control-label">密码</label>
|
|
||||||
<div class="col-md-10">
|
|
||||||
<input class="form-control" placeholder="密码" type="text" value="88888888" name="password"
|
|
||||||
data-bv-notempty="true"
|
|
||||||
data-bv-notempty-message="密码 不能为空">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label class="col-md-2 control-label">昵称</label>
|
|
||||||
<div class="col-md-10">
|
|
||||||
<input class="form-control" placeholder="昵称" type="text" name="nickname">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label class="col-md-2 control-label">手机号</label>
|
|
||||||
<div class="col-md-10">
|
|
||||||
<input class="form-control" placeholder="手机号" type="text" maxlength="11" name="phone">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label class="col-md-2 control-label">电话</label>
|
|
||||||
<div class="col-md-10">
|
|
||||||
<input class="form-control" placeholder="电话" type="text" maxlength="20" name="telephone">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label class="col-md-2 control-label">邮箱</label>
|
|
||||||
<div class="col-md-10">
|
|
||||||
<input class="form-control" placeholder="邮箱" type="text" maxlength="50" name="email">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label class="col-md-2 control-label">生日</label>
|
|
||||||
<div class="col-xs-2">
|
|
||||||
<input type="text" class="form-control" placeholder="生日" id="birthday" name='birthday'>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label class="col-md-2 control-label">性别</label>
|
|
||||||
<div class="col-md-10" style="width: 100px">
|
|
||||||
<select class="form-control input-sm" name="sex" id="sex">
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label class="col-md-2 control-label">角色</label>
|
|
||||||
<div class="checkbox" id="roles">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="form-actions">
|
|
||||||
<div class="row" align="center">
|
|
||||||
<div class="col-md-12">
|
|
||||||
<button class="btn btn-primary" onclick="location.href='userList.html'">返回</button>
|
|
||||||
<button class="btn btn-primary" type="submit" onclick="add()">
|
|
||||||
<i class="fa fa-save"></i> 保存
|
|
||||||
</button>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
|
|
||||||
</fieldset>
|
<div class="form-group">
|
||||||
</form>
|
<label class="col-md-2 control-label">密码</label>
|
||||||
</div>
|
<div class="col-md-10">
|
||||||
|
<input class="form-control" placeholder="密码" type="text" value="88888888" name="password"
|
||||||
|
data-bv-notempty="true" data-bv-notempty-message="密码 不能为空">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-md-2 control-label">昵称</label>
|
||||||
|
<div class="col-md-10">
|
||||||
|
<input class="form-control" placeholder="昵称" type="text" name="nickname">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-md-2 control-label">手机号</label>
|
||||||
|
<div class="col-md-10">
|
||||||
|
<input class="form-control" placeholder="手机号" type="text" maxlength="11" name="phone">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-md-2 control-label">电话</label>
|
||||||
|
<div class="col-md-10">
|
||||||
|
<input class="form-control" placeholder="电话" type="text" maxlength="20" name="telephone">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-md-2 control-label">邮箱</label>
|
||||||
|
<div class="col-md-10">
|
||||||
|
<input class="form-control" placeholder="邮箱" type="text" maxlength="50" name="email">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-md-2 control-label">生日</label>
|
||||||
|
<div class="col-xs-2">
|
||||||
|
<input type="text" class="form-control" placeholder="生日" id="birthday" name='birthday'>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-md-2 control-label">性别</label>
|
||||||
|
<div class="col-md-10" style="width: 100px">
|
||||||
|
<select class="form-control input-sm" name="sex" id="sex">
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-md-2 control-label">角色</label>
|
||||||
|
<div class="checkbox" id="roles">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-actions">
|
||||||
|
<div class="row" align="center">
|
||||||
|
<div class="col-md-12">
|
||||||
|
<button class="btn btn-primary" onclick="location.href='userList.html'">返回</button>
|
||||||
|
<button class="btn btn-primary" type="submit" onclick="add()">
|
||||||
|
<i class="fa fa-save"></i> 保存
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</fieldset>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
<script type="text/javascript" src="../../js/publicJs.js"></script>
|
<script type="text/javascript" src="../../js/publicJs.js"></script>
|
||||||
<script type="text/javascript" src="../../js/jquery/jquery-3.6.0.js"></script>
|
<script type="text/javascript" src="../../js/jquery/jquery-3.6.0.js"></script>
|
||||||
<script type="text/javascript" src="../../js/jq.js"></script>
|
<script type="text/javascript" src="../../js/jq.js"></script>
|
||||||
|
|
@ -92,42 +92,44 @@
|
||||||
<script type="text/javascript" src="../../layui/layui.js"></script>
|
<script type="text/javascript" src="../../layui/layui.js"></script>
|
||||||
<script type="text/javascript" src="../../js/dict.js"></script>
|
<script type="text/javascript" src="../../js/dict.js"></script>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
layui.use(['layer','laydate'], function(){
|
layui.use(['layer', 'laydate'], function () {
|
||||||
var layer = layui.layer;
|
var layer = layui.layer;
|
||||||
var laydate = layui.laydate;
|
var laydate = layui.laydate;
|
||||||
laydate.render({
|
laydate.render({
|
||||||
elem: '#birthday'
|
elem: '#birthday'
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
showDictSelect("sex", "sex");
|
showDictSelect("sex", "sex");
|
||||||
initRoles();
|
initRoles();
|
||||||
|
|
||||||
$('#form').bootstrapValidator();
|
$('#form').bootstrapValidator();
|
||||||
|
|
||||||
function add() {
|
function add() {
|
||||||
var bootstrapValidator = $("#form").data('bootstrapValidator');
|
var bootstrapValidator = $("#form").data('bootstrapValidator');
|
||||||
bootstrapValidator.validate();
|
bootstrapValidator.validate();
|
||||||
if(!bootstrapValidator.isValid()){
|
if (!bootstrapValidator.isValid()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var formdata = $("#form").serializeObject();
|
var formdata = $("#form").serializeObject();
|
||||||
formdata.roleIds = getCheckedRoleIds();
|
formdata.roleIds = getCheckedRoleIds();
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type : 'post',
|
type: 'post',
|
||||||
url : ctxPath + '/users',
|
url: ctxPath + '/users',
|
||||||
contentType: "application/json; charset=utf-8",
|
contentType: "application/json; charset=utf-8",
|
||||||
data : JSON.stringify(formdata),
|
data: JSON.stringify(formdata),
|
||||||
success : function(data) {
|
success: function (data) {
|
||||||
layer.msg("添加成功", {shift: -1, time: 1000}, function(){
|
layer.msg("添加成功", { shift: -1, time: 1000 }, function () {
|
||||||
location.href = ctxPath + "/pages/user/userList.html";
|
// location.href = ctxPath + "/pages/user/userList.html";
|
||||||
});
|
location.href = pagesPath + "/pages/user/userList.html";
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
|
|
@ -1,85 +1,90 @@
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
|
||||||
<meta charset="UTF-8">
|
|
||||||
<link rel="stylesheet" type="text/css" media="screen" href="../../css/bootstrap.min.css">
|
|
||||||
<link rel="stylesheet" type="text/css" media="screen" href="../../layui/css/layui.css">
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
|
|
||||||
<form class="form-horizontal" onsubmit="return false" id="form">
|
|
||||||
<fieldset>
|
|
||||||
<input type="hidden" id="id" name="id">
|
|
||||||
<div class="form-group">
|
|
||||||
<label class="col-md-2 control-label">用户名</label>
|
|
||||||
<div class="col-md-10">
|
|
||||||
<input class="form-control" placeholder="用户名" type="text" name="username" id="username" readonly="readonly">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label class="col-md-2 control-label">昵称</label>
|
|
||||||
<div class="col-md-10">
|
|
||||||
<input class="form-control" placeholder="昵称" type="text" name="nickname" id="nickname">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label class="col-md-2 control-label">手机号</label>
|
|
||||||
<div class="col-md-10">
|
|
||||||
<input class="form-control" placeholder="手机号" type="text" maxlength="11" name="phone" id="phone">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label class="col-md-2 control-label">电话</label>
|
|
||||||
<div class="col-md-10">
|
|
||||||
<input class="form-control" placeholder="电话" type="text" maxlength="20" name="telephone" id="telephone">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label class="col-md-2 control-label">邮箱</label>
|
|
||||||
<div class="col-md-10">
|
|
||||||
<input class="form-control" placeholder="邮箱" type="text" maxlength="50" name="email" id="email">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label class="col-md-2 control-label">生日</label>
|
|
||||||
<div class="col-xs-2">
|
|
||||||
<input type="text" class="form-control" placeholder="生日" id="birthday" name='birthday'>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label class="col-md-2 control-label">性别</label>
|
|
||||||
<div class="col-md-10" style="width: 100px">
|
|
||||||
<select class="form-control input-sm" name="sex" id="sex">
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label class="col-md-2 control-label">状态</label>
|
|
||||||
<div class="col-md-10" style="width: 100px">
|
|
||||||
<select class="form-control input-sm" name="status" id="status">
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label class="col-md-2 control-label">角色</label>
|
|
||||||
<div class="checkbox" id="roles">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="form-actions">
|
<head>
|
||||||
<div class="row" align="center">
|
<meta charset="UTF-8">
|
||||||
<div class="col-md-12">
|
<link rel="stylesheet" type="text/css" media="screen" href="../../css/bootstrap.min.css">
|
||||||
<button class="btn btn-primary" onclick="location.href='userList.html'">返回</button>
|
<link rel="stylesheet" type="text/css" media="screen" href="../../layui/css/layui.css">
|
||||||
<button class="btn btn-primary" type="submit" onclick="update()">
|
</head>
|
||||||
<i class="fa fa-save"></i> 保存
|
|
||||||
</button>
|
<body>
|
||||||
|
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
|
||||||
|
<form class="form-horizontal" onsubmit="return false" id="form">
|
||||||
|
<fieldset>
|
||||||
|
<input type="hidden" id="id" name="id">
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-md-2 control-label">用户名</label>
|
||||||
|
<div class="col-md-10">
|
||||||
|
<input class="form-control" placeholder="用户名" type="text" name="username" id="username"
|
||||||
|
readonly="readonly">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-md-2 control-label">昵称</label>
|
||||||
|
<div class="col-md-10">
|
||||||
|
<input class="form-control" placeholder="昵称" type="text" name="nickname" id="nickname">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-md-2 control-label">手机号</label>
|
||||||
|
<div class="col-md-10">
|
||||||
|
<input class="form-control" placeholder="手机号" type="text" maxlength="11" name="phone"
|
||||||
|
id="phone">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-md-2 control-label">电话</label>
|
||||||
|
<div class="col-md-10">
|
||||||
|
<input class="form-control" placeholder="电话" type="text" maxlength="20" name="telephone"
|
||||||
|
id="telephone">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-md-2 control-label">邮箱</label>
|
||||||
|
<div class="col-md-10">
|
||||||
|
<input class="form-control" placeholder="邮箱" type="text" maxlength="50" name="email" id="email">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-md-2 control-label">生日</label>
|
||||||
|
<div class="col-xs-2">
|
||||||
|
<input type="text" class="form-control" placeholder="生日" id="birthday" name='birthday'>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-md-2 control-label">性别</label>
|
||||||
|
<div class="col-md-10" style="width: 100px">
|
||||||
|
<select class="form-control input-sm" name="sex" id="sex">
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-md-2 control-label">状态</label>
|
||||||
|
<div class="col-md-10" style="width: 100px">
|
||||||
|
<select class="form-control input-sm" name="status" id="status">
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-md-2 control-label">角色</label>
|
||||||
|
<div class="checkbox" id="roles">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
|
|
||||||
</fieldset>
|
<div class="form-actions">
|
||||||
</form>
|
<div class="row" align="center">
|
||||||
</div>
|
<div class="col-md-12">
|
||||||
|
<button class="btn btn-primary" onclick="location.href='userList.html'">返回</button>
|
||||||
|
<button class="btn btn-primary" type="submit" onclick="update()">
|
||||||
|
<i class="fa fa-save"></i> 保存
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</fieldset>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
<script type="text/javascript" src="../../js/jquery/jquery-3.6.0.js"></script>
|
<script type="text/javascript" src="../../js/jquery/jquery-3.6.0.js"></script>
|
||||||
<script type="text/javascript" src="../../js/jq.js"></script>
|
<script type="text/javascript" src="../../js/jq.js"></script>
|
||||||
<script type="text/javascript" src="../../js/plugin/bootstrapvalidator/bootstrapValidator.min.js"></script>
|
<script type="text/javascript" src="../../js/plugin/bootstrapvalidator/bootstrapValidator.min.js"></script>
|
||||||
|
|
@ -87,72 +92,74 @@
|
||||||
<script type="text/javascript" src="../../js/my/roles/role.js"></script>
|
<script type="text/javascript" src="../../js/my/roles/role.js"></script>
|
||||||
<script type="text/javascript" src="../../layui/layui.js"></script>
|
<script type="text/javascript" src="../../layui/layui.js"></script>
|
||||||
<script type="text/javascript" src="../../js/dict.js"></script>
|
<script type="text/javascript" src="../../js/dict.js"></script>
|
||||||
<script type="text/javascript" src="../../js/publicJs.js"></script>
|
<script type="text/javascript" src="../../js/publicJs.js"></script>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
layui.use(['layer','laydate'], function(){
|
layui.use(['layer', 'laydate'], function () {
|
||||||
var layer = layui.layer;
|
var layer = layui.layer;
|
||||||
var laydate = layui.laydate;
|
var laydate = layui.laydate;
|
||||||
laydate.render({
|
laydate.render({
|
||||||
elem: '#birthday'
|
elem: '#birthday'
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
showDictSelect("sex", "sex");
|
|
||||||
showDictSelect("status", "userStatus");
|
|
||||||
|
|
||||||
initRoles();
|
|
||||||
|
|
||||||
initData();
|
|
||||||
|
|
||||||
function initData(){
|
|
||||||
var id = getUrlParam("id");
|
|
||||||
if(id != ""){
|
|
||||||
$.ajax({
|
|
||||||
type : 'get',
|
|
||||||
url : ctxPath + '/users/'+id,
|
|
||||||
async : false,
|
|
||||||
success : function(data) {
|
|
||||||
$("#id").val(data.id);
|
|
||||||
$("#username").val(data.username);
|
|
||||||
$("#nickname").val(data.nickname);
|
|
||||||
$("#phone").val(data.phone);
|
|
||||||
$("#telephone").val(data.telephone);
|
|
||||||
$("#email").val(data.email);
|
|
||||||
$("#birthday").val(data.birthday);
|
|
||||||
$("#sex").val(data.sex);
|
|
||||||
$("#status").val(data.status);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
});
|
||||||
initRoleDatas(id);
|
|
||||||
|
showDictSelect("sex", "sex");
|
||||||
|
showDictSelect("status", "userStatus");
|
||||||
|
|
||||||
|
initRoles();
|
||||||
|
|
||||||
|
initData();
|
||||||
|
|
||||||
|
function initData() {
|
||||||
|
var id = getUrlParam("id");
|
||||||
|
if (id != "") {
|
||||||
|
$.ajax({
|
||||||
|
type: 'get',
|
||||||
|
url: ctxPath + '/users/' + id,
|
||||||
|
async: false,
|
||||||
|
success: function (data) {
|
||||||
|
$("#id").val(data.id);
|
||||||
|
$("#username").val(data.username);
|
||||||
|
$("#nickname").val(data.nickname);
|
||||||
|
$("#phone").val(data.phone);
|
||||||
|
$("#telephone").val(data.telephone);
|
||||||
|
$("#email").val(data.email);
|
||||||
|
$("#birthday").val(data.birthday);
|
||||||
|
$("#sex").val(data.sex);
|
||||||
|
$("#status").val(data.status);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
initRoleDatas(id);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
$('#form').bootstrapValidator();
|
$('#form').bootstrapValidator();
|
||||||
|
|
||||||
function update() {
|
function update() {
|
||||||
var bootstrapValidator = $("#form").data('bootstrapValidator');
|
var bootstrapValidator = $("#form").data('bootstrapValidator');
|
||||||
bootstrapValidator.validate();
|
bootstrapValidator.validate();
|
||||||
if(!bootstrapValidator.isValid()){
|
if (!bootstrapValidator.isValid()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var formdata = $("#form").serializeObject();
|
var formdata = $("#form").serializeObject();
|
||||||
formdata.roleIds = getCheckedRoleIds();
|
formdata.roleIds = getCheckedRoleIds();
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type : 'put',
|
type: 'put',
|
||||||
url : ctxPath + '/users',
|
url: ctxPath + '/users',
|
||||||
contentType: "application/json; charset=utf-8",
|
contentType: "application/json; charset=utf-8",
|
||||||
data : JSON.stringify(formdata),
|
data: JSON.stringify(formdata),
|
||||||
success : function(data) {
|
success: function (data) {
|
||||||
layer.msg("修改成功", {shift: -1, time: 1000}, function(){
|
layer.msg("修改成功", { shift: -1, time: 1000 }, function () {
|
||||||
location.href = ctxPath + "/pages/user/userList.html";
|
// location.href = ctxPath + "/pages/user/userList.html";
|
||||||
});
|
location.href = pagesPath + "/pages/user/userList.html";
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
Loading…
Reference in New Issue