用户新增已注销状态
This commit is contained in:
@@ -17,6 +17,7 @@ namespace BaseOUDAL
|
||||
get
|
||||
{
|
||||
if (State == 0) return "正常";
|
||||
if (State == 2) return "已注销";
|
||||
return "禁用";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +1,22 @@
|
||||
using Dapper;
|
||||
using BaseOUDAL;
|
||||
using Dapper;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Mvc.Rendering;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Newtonsoft.Json;
|
||||
using Org.BouncyCastle.Asn1.Ocsp;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using YLErp.Abstract;
|
||||
using YLErp.BLL;
|
||||
using YLErp.DBModels;
|
||||
using YLErp.DBModels.Consts;
|
||||
using YLErp.Modules.DictionaryModule;
|
||||
using YLErp.Modules.SystemModule;
|
||||
using YLErp.Web.Models;
|
||||
|
||||
namespace YLErp.Web.Controllers
|
||||
{
|
||||
@@ -667,7 +678,7 @@ namespace YLErp.Web.Controllers
|
||||
r.Password = null;
|
||||
return View(r);
|
||||
}
|
||||
|
||||
|
||||
[MyAuthorize("系统管理-用户管理")]
|
||||
public ActionResult UserLevelView(int id)
|
||||
{
|
||||
@@ -852,6 +863,15 @@ namespace YLErp.Web.Controllers
|
||||
}
|
||||
}
|
||||
|
||||
public JsonResult accountDelete(int accountIds)
|
||||
{
|
||||
var r = basedb.SystemUsers.Find(accountIds);
|
||||
r.State = 2;
|
||||
basedb.SaveChanges();
|
||||
new SysUserService(CurUser).UpdateState(accountIds, 2);
|
||||
return JsonSuccess("注销账户成功", r);
|
||||
}
|
||||
|
||||
public JsonResult accountAble(int accountIds)
|
||||
{
|
||||
var r = basedb.SystemUsers.Find(accountIds);
|
||||
|
||||
@@ -169,7 +169,7 @@
|
||||
<div class="form-group col-md-6">
|
||||
<div class="row no-gutters">
|
||||
<label class="formlabel">状态</label>
|
||||
@Html.DropDownListFor(model => model.State, new SelectListItem[] { new SelectListItem { Text = "正常", Value = "0" }, new SelectListItem { Text = "禁用", Value = "1" } })
|
||||
@Html.DropDownListFor(model => model.State, new SelectListItem[] { new SelectListItem { Text = "正常", Value = "0" }, new SelectListItem { Text = "禁用", Value = "1" }, new SelectListItem { Text = "已注销", Value = "2" } })
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
};
|
||||
}
|
||||
|
||||
@section JS{
|
||||
@section JS {
|
||||
<script type="text/javascript">
|
||||
|
||||
var page = @Json.Serialize(pageObj);
|
||||
@@ -74,31 +74,27 @@
|
||||
return rowObject.StateDesc;
|
||||
}
|
||||
},
|
||||
{ name: '', label: "操作", index: '', width: 140, algin: 'center', formatter: showToolName },
|
||||
{ name: '', label: "操作", index: '', width: 200, algin: 'center', formatter: showToolName },
|
||||
{ name: '', label: "账号层级关系", index: '', width: 140, algin: 'center', formatter: showLevel },
|
||||
];
|
||||
function showToolName(cellValue, options, rowObject) {
|
||||
var html = "";
|
||||
if (page.isUserEdit && rowObject.StateDesc != "禁用") {
|
||||
if (page.isUserEdit && rowObject.StateDesc == "正常") {
|
||||
html += "<input type=\"button\" class=\"wentiEdit\" title='修改' onclick=\"modifyView('{0}')\" value=\"{1}\" />".template(rowObject.id, "修改");
|
||||
}
|
||||
else
|
||||
{
|
||||
html += "<input type=\"button\" class=\"wentiEdit\" title='修改' disabled='disabled'\" value=\"{1}\" />".template(rowObject.id, "修改");
|
||||
|
||||
}
|
||||
if (page.isUserState && (rowObject.LoginName.toLowerCase() != "supera" || page.isInitUser)) {
|
||||
if (rowObject.StateDesc == "禁用") {
|
||||
|
||||
html = html + "<input type=\"button\" class=\"wentiEdit\" title='启用' onclick=\"enable({0})\" value=\"{1}\" />".template(rowObject.id, "启用");
|
||||
} else {
|
||||
} else if (rowObject.StateDesc == "正常") {
|
||||
html = html + "<input type=\"button\" class=\"wentiEdit\" title='禁用' onclick=\"disable({0})\" value=\"{1}\" />".template(rowObject.id, "禁用");
|
||||
html += "<input type=\"button\" class=\"wentiEdit\" title='修改' onclick=\"deleteView('{0}')\" value=\"{1}\" />".template(rowObject.id, "注销");
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (rowObject.StateDesc == "禁用") {
|
||||
|
||||
html = html + "<input type=\"button\" class=\"wentiEdit\" title='启用' disabled='disabled'\" value=\"{1}\" />".template(rowObject.id, "启用");
|
||||
} else {
|
||||
} else if (rowObject.StateDesc == "正常") {
|
||||
html = html + "<input type=\"button\" class=\"wentiEdit\" title='禁用' disabled='disabled'\" value=\"{1}\" />".template(rowObject.id, "禁用");
|
||||
}
|
||||
}
|
||||
@@ -125,6 +121,13 @@
|
||||
function modifyView(id) {
|
||||
main.infopage("修改用户信息", './UserEdit/' + id);
|
||||
}
|
||||
|
||||
function deleteView(id) {
|
||||
main.confirmPost("确认注销用户? (该操作无法恢复!)", "/System/accountDelete", { accountIds: id }).done(function (data) {
|
||||
SearchClick(true);
|
||||
});
|
||||
}
|
||||
|
||||
function enable(id) {
|
||||
main.confirmPost("确认启用账号?", "/System/accountAble", { accountIds: id }).done(function (data) {
|
||||
SearchClick(true);
|
||||
@@ -153,11 +156,14 @@
|
||||
DepartmentIds: $("#Department").val() == null ? "" : $("#Department").val().join(",")
|
||||
});
|
||||
$('#listGrid').appendPostData({ UserGroup: $("#UserGroup").val()});
|
||||
if ($("#checkEnabled").prop("checked") && !$("#checkDisabled").prop("checked")) {
|
||||
if ($("#checkEnabled").prop("checked") ) {
|
||||
$('#listGrid').appendPostData({ State: 0 });
|
||||
} else if ($("#checkDisabled").prop("checked") && !$("#checkEnabled").prop("checked")) {
|
||||
} else if ($("#checkDisabled").prop("checked") ) {
|
||||
$('#listGrid').appendPostData({ State: 1 });
|
||||
} else {
|
||||
} else if ($("#checkDeleted").prop("checked") ) {
|
||||
$('#listGrid').appendPostData({ State: 2 });
|
||||
}
|
||||
else {
|
||||
$('#listGrid').appendPostData({ State: null });
|
||||
}
|
||||
if (typeof (isSearchclick) != "undefined" && isSearchclick) {
|
||||
@@ -173,6 +179,7 @@
|
||||
$("#Department").ResetAceDropDown();
|
||||
$("#checkEnabled").prop("checked",false);
|
||||
$("#checkDisabled").prop("checked",false);
|
||||
$("#checkDeleted").prop("checked",false);
|
||||
SearchClick(true);
|
||||
}
|
||||
|
||||
@@ -221,6 +228,7 @@
|
||||
$("#Department").ResetAceDropDown();
|
||||
$("#checkEnabled").prop("checked",false);
|
||||
$("#checkDisabled").prop("checked",false);
|
||||
$("#checkDeleted").prop("checked",false);
|
||||
|
||||
var flag = false;
|
||||
if (window.tdSelectionInfo.searchParamId === "State") {
|
||||
@@ -231,6 +239,10 @@
|
||||
$("#checkDisabled").prop("checked", true);
|
||||
flag = true;
|
||||
}
|
||||
else if (window.tdSelectionInfo.text === "已注销") {
|
||||
$("#checkDeleted").prop("checked", true);
|
||||
flag = true;
|
||||
}
|
||||
} else {
|
||||
$("#" + window.tdSelectionInfo.searchParamId).find("option").each(function() {
|
||||
if (this.text == window.tdSelectionInfo.text) {
|
||||
@@ -277,6 +289,7 @@
|
||||
@Html.MyAceDropdownInput("Department", "所属部门", GlobalData.GetAllDepartements())
|
||||
状态:<input type="checkbox" id="checkEnabled" />正常
|
||||
<input type="checkbox" id="checkDisabled" />禁用
|
||||
<input type="checkbox" id="checkDeleted" />已注销
|
||||
@MyControls.Btn("筛选", "return(SearchClick(true));")
|
||||
@if (pageObj.isUserAdd)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user