From 0cbc7c78492a530354321337366fa7d6af419f89 Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@163.com>
Date: 星期三, 23 三月 2022 09:42:56 +0800
Subject: [PATCH] #杰克缝纫机立库 【整合订单主档与明细档】
---
src/main/webapp/static/js/user/user.js | 185 ++++++++++++++++------------------------------
1 files changed, 64 insertions(+), 121 deletions(-)
diff --git a/src/main/webapp/static/js/user/user.js b/src/main/webapp/static/js/user/user.js
index 0d07fcf..ecb99fd 100644
--- a/src/main/webapp/static/js/user/user.js
+++ b/src/main/webapp/static/js/user/user.js
@@ -1,4 +1,5 @@
var pageCurr;
+var tableData;
layui.use(['table','laydate', 'form'], function(){
var table = layui.table;
var $ = layui.jquery;
@@ -23,12 +24,12 @@
// ,{field: 'hostName', align: 'center',title: '鎺堟潈鍟嗘埛'}
,{field: 'mobile', align: 'center',title: '璐﹀彿'}
,{field: 'username', align: 'center',title: '鍚嶇О'}
- ,{field: 'password', align: 'center',title: '瀵嗙爜'}
+ // ,{field: 'password', align: 'center',title: '瀵嗙爜'}
,{field: 'roleName', align: 'center',title: '瑙掕壊'}
// ,{field: 'createTime$', align: 'center',title: '娉ㄥ唽鏃堕棿'}
- ,{field: 'status$', align: 'center',title: '鐘舵��'}
+ ,{field: 'status$', align: 'center',title: '鐘舵��', templet: '#statusTpl', width: 120, unresize: true}
- ,{fixed: 'right', title:'鎿嶄綔', align: 'center', toolbar: '#operate', width:100}
+ ,{fixed: 'right', title:'鎿嶄綔', align: 'center', toolbar: '#operate', width:170}
]],
request: {
pageName: 'curr',
@@ -49,10 +50,21 @@
if (res.code === 403) {
top.location.href = baseUrl+"/";
}
+ tableData = table.cache.user;
pageCurr=curr;
limit();
}
});
+
+ // 淇敼鐘舵��
+ form.on('switch(statusSwitch)', function (obj) {
+ var index = obj.othis.parents('tr').attr("data-index");
+ var data = tableData[index];
+ data[this.name] = obj.elem.checked?1:0;
+ http.post(baseUrl+"/user/edit/auth", {id: data.id, status: data[this.name]}, function (res) {
+ layer.msg(res.msg);
+ })
+ })
// 鐩戝惉鎺掑簭浜嬩欢
table.on('sort(user)', function (obj) {
@@ -71,6 +83,7 @@
if (res.code === 403) {
top.location.href = baseUrl+"/";
}
+ tableData = table.cache.user;
pageCurr=curr;
limit();
}
@@ -86,7 +99,7 @@
type: 2,
title: '鏂板',
maxmin: true,
- area: [top.detailWidth, top.detailHeight],
+ area: ['30%', top.detailHeight],
shadeClose: true,
content: 'user_detail.html',
success: function(layero, index){
@@ -94,14 +107,6 @@
layer.iframeAuto(index);layer.style(index, {top: (($(window).height()-layer.getChildFrame('#data-detail', index).height())/3)+"px"});
}
});
- break;
- case 'refreshData':
- tableIns.reload({
- page: {
- curr: pageCurr
- }
- });
- limit();
break;
case 'deleteData':
var data = checkStatus.data;
@@ -178,34 +183,17 @@
table.on('tool(user)', function(obj){
var data = obj.data;
switch (obj.event) {
- // 璇︽儏
- case 'detail':
- layer.open({
- type: 2,
- title: '璇︽儏',
- maxmin: true,
- area: [top.detailWidth, top.detailHeight],
- shadeClose: false,
- content: 'user_detail.html',
- success: function(layero, index){
- setFormVal(layer.getChildFrame('#detail', index), data);
- top.convertDisabled(layer.getChildFrame('#data-detail :input', index), true);
- layer.getChildFrame('#data-detail-submit,#prompt', index).hide();
- layer.iframeAuto(index);layer.style(index, {top: (($(window).height()-layer.getChildFrame('#data-detail', index).height())/3)+"px"});
- layero.find('iframe')[0].contentWindow.layui.form.render('select');
- }
- });
- break;
// 缂栬緫
case 'edit':
layer.open({
type: 2,
title: '淇敼',
maxmin: true,
- area: [top.detailWidth, top.detailHeight],
+ area: ['30%', top.detailHeight],
shadeClose: true,
content: 'user_detail.html',
success: function(layero, index){
+ layer.getChildFrame('#password', index).parent().parent().hide();
setFormVal(layer.getChildFrame('#detail', index), data);
top.convertDisabled(layer.getChildFrame('#data-detail :input', index), false);
layer.iframeAuto(index);layer.style(index, {top: (($(window).height()-layer.getChildFrame('#data-detail', index).height())/3)+"px"});
@@ -213,76 +201,21 @@
}
});
break;
- case 'Role':
- var param = top.reObject(data).roleId;
- if (param === undefined) {
- layer.msg("鏃犳暟鎹�");
- } else {
- layer.open({
- type: 2,
- title: '璇︽儏',
- maxmin: true,
- area: [top.detailHeight, top.detailWidth],
- shadeClose: false,
- content: '../role/role_detail.html',
- success: function(layero, index){
- $.ajax({
- url: baseUrl+"/role/"+ param +"/auth",
- headers: {'token': localStorage.getItem('token')},
- method: 'GET',
- success: function (res) {
- if (res.code === 200){
- setFormVal(layer.getChildFrame('#detail', index), res.data);
- top.convertDisabled(layer.getChildFrame('#data-detail :input', index), true);
- layer.getChildFrame('#data-detail-submit,#prompt', index).hide();
- layer.iframeAuto(index);layer.style(index, {top: (($(window).height()-layer.getChildFrame('#data-detail', index).height())/3)+"px"});
- layero.find('iframe')[0].contentWindow.layui.form.render('select');
- } else if (res.code === 403){
- parent.location.href = "/";
- }else {
- layer.msg(res.msg)
- }
- }
- })
- }
- });
- }
- break;
- case 'Host':
- var param = top.reObject(data).hostId;
- if (param === undefined) {
- layer.msg("鏃犳暟鎹�");
- } else {
- layer.open({
- type: 2,
- title: '璇︽儏',
- maxmin: true,
- area: [top.detailHeight, top.detailWidth],
- shadeClose: false,
- content: '../host/host_detail.html',
- success: function(layero, index){
- $.ajax({
- url: baseUrl+"/host/"+ param +"/auth",
- headers: {'token': localStorage.getItem('token')},
- method: 'GET',
- success: function (res) {
- if (res.code === 200){
- setFormVal(layer.getChildFrame('#detail', index), res.data);
- top.convertDisabled(layer.getChildFrame('#data-detail :input', index), true);
- layer.getChildFrame('#data-detail-submit,#prompt', index).hide();
- layer.iframeAuto(index);
- layer.style(index, {top: (($(window).height()-layer.getChildFrame('#data-detail', index).height())/3)+"px"});
- layero.find('iframe')[0].contentWindow.layui.form.render('select');
- } else if (res.code === 403){
- parent.location.href = "/";
- }else {
- layer.msg(res.msg)
- }
- }
- })
- }
- });
- }
+ // 閲嶇疆瀵嗙爜
+ case 'resetPwd':
+ layer.open({
+ type: 1,
+ title: '閲嶇疆瀵嗙爜',
+ offset: '150px',
+ area: ['360px'],
+ shade: 0.1,
+ shadeClose: true,
+ content: $("#resetpwd-window"),
+ success: function(layero, index){
+ layer.iframeAuto(index);
+ $('#resetUserId').val(data.id);
+ }
+ });
break;
}
});
@@ -297,7 +230,7 @@
hostId: $('#hostId').val(),
username: $('#username').val(),
mobile: $('#mobile').val(),
- password: $('#password').val(),
+ password: hex_md5($('#password').val()),
roleId: $('#roleId').val(),
createTime: top.strToDate($('#createTime\\$').val()),
status: $('#status').val(),
@@ -311,7 +244,7 @@
success: function (res) {
if (res.code === 200){
parent.layer.closeAll();
- tableReload(true);
+ parent.$(".layui-laypage-btn")[0].click();
$("#data-detail :input").each(function () {
$(this).val("");
});
@@ -348,6 +281,33 @@
,type: 'datetime'
,range: true
});
+
+ // 閲嶇疆瀵嗙爜
+ form.on('submit(savePwd)', function (data) {
+ $.ajax({
+ url: baseUrl+"/user/edit/auth",
+ headers: {'token': localStorage.getItem('token')},
+ data: {
+ id: data.field.resetUserId,
+ password: hex_md5(data.field.resetPassword)
+ },
+ method: 'POST',
+ success: function (res) {
+ if (res.code === 200){
+ layer.closeAll();
+ layer.msg("閲嶇疆瀵嗙爜鎴愬姛");
+ } else if (res.code === 403){
+ top.location.href = baseUrl+"/";
+ }else {
+ layer.msg(res.msg)
+ }
+ }
+ })
+ })
+
+ $('#cancel').click(function () {
+ layer.closeAll();
+ })
});
// 鍏抽棴鍔ㄤ綔
@@ -369,6 +329,7 @@
if (res.code === 403) {
top.location.href = baseUrl+"/";
}
+ tableData = table.cache.user;
pageCurr=curr;
if (res.data.length === 0 && count !== 0) {
tableIns.reload({
@@ -388,24 +349,6 @@
for (var val in data) {
el.find(":input[id='" + val + "']").val(data[val]);
}
-}
-
-function clearFormVal(el) {
- $(':input', el)
- .val('')
- .removeAttr('checked')
- .removeAttr('selected');
-}
-
-function detailScreen(index) {
- var detail = layer.getChildFrame('#data-detail', index);
- var height = detail.height()+60;
- if (height > ($(window).height()*0.9)) {
- height = ($(window).height()*0.9);
- }
- layer.style(index, {
- height: height +'px'
- });
}
$('body').keydown(function () {
--
Gitblit v1.9.1