tijian_tieying/web/dccdc/Views/InfectionWX/OpenUserList.cshtml
2025-02-20 12:14:39 +08:00

243 lines
10 KiB
Plaintext
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

@{
ViewBag.Title = "艾防关注微信列表";
}
<table class="t1" style="width:100%">
<tr>
<td class="ltd" style="width:100px">昵称:</td>
<td class="rtd" style="width:160px"><input type="text" class="l-text" style="width:140px" id="nc" /></td>
<td class="ltd" style="width:100px">备注:</td>
<td class="rtd" style="width:160px"><input type="text" class="l-text" style="width:140px" id="bz" /></td>
<td class="rtd"><input type="button" value="查询" class="l-button" id="cx" /></td>
</tr>
</table>
<div id="gzList"></div>
<div id="bzuser" style="display:none">
<table class="t1" style="width:300px">
<tr>
<td class="ltd" style="width:100px">备注:</td>
<td class="rtd"><input id="xgbz" class="l-text" /></td>
</tr>
</table>
<input type="hidden" id="openid" />
</div>
<div id="adminuser" style="display:none">
<table class="t1" style="width:300px">
<tr>
<td class="ltd" style="width:100px">用户状态:</td>
<td class="rtd">
<select id="usertype">
<option value="0">普通用户</option>
<option value="1">管理员</option>
</select>
</td>
</tr>
<tr>
<td class="ltd" style="width:100px">OA名称</td>
<td class="rtd">
@Html.DropDownList("OAList", ViewBag.OAList as IEnumerable<SelectListItem>, new { id = "oa_id" })
</td>
</tr>
</table>
<input type="hidden" id="openid" />
</div>
@section scripts{
<script type="text/javascript" src="@Url.Content("~/Scripts/public.js")"></script>
<script type="text/javascript">
function init() {
liger.get("gzList").reload()
$("#gzList").ligerDateEditor();
openf.close();
}
$(function () {
$("#gzList").ligerGrid({
title: "关注微信列表", parms: {}, url: "@Url.Action("getOpenUserList")",
columns: [
{ name: "openid", display: "微信ID", width: 220, align: "left" },
{
name: "subscribe", display: "关注状态", width: 80, align: "left", render: function (r, i, v) {
if(v==1)
{
return "关注中";
}
else
{
return "不再关注";
}
}
},
{ name: "nickname", display: "昵称", width: 200, align: "left" }
, { name: "language", display: "语言", width: 100, align: "left" }
, { name: "city", display: "城市", width: 100, align: "left" }
, { name: "province", display: "省份", width: 100, align: "left" }
, { name: "country", display: "国家", width: 100, align: "left" }
, { name: "subscribe_time", display: "关注时间", width: 100, align: "left", render: function (r, i, v) { return formatTime(v * 1000) } }
, {
name: "state", display: "状态", width: 100, align: "left" ,render: function (r, i, v) {
if (v == 0) {
return "未添加";
}
else {
return "已添加";
}
}
},
{
name: "type", display: "用户类型", width: 100, align: "left", render: function (r, i, v) {
if (v == 1) {
return "管理员";
}
else {
return "普通用户";
}
}
},
{ name: "oa_trueName", display: "OA用户", width: 100, align: "left" },
{ name: "remark", display: "备注", width: 100, align: "left" }
], width: "98%",
height: "100%",
rownumbers: true,
usePager: true,
heightDiff: -20,
delayLoad: true, toolbar: {
items: [
{ text: '添加', click: add, icon: 'add' },
{ line: true },
{ text: '备注', click: edit, icon: 'modify' },
{ line: true },
{ text: '管理员', click: beadmin, icon: 'modify' }
]
}
});
$("#cx").bind("click", function () {
liger.get("gzList").set("parms", { nc: $("#nc").val(), bz: $("#bz").val() });
liger.get("gzList").set("page", 1);
liger.get("gzList").reload();
});
});
//添加
function add(item) {
var r = liger.get("gzList").getSelectedRow();
if (!r) {
$.ligerDialog.warn("请选择要添加的用户!");
return;
}
var state = r.state;
if (state >= 1) {
$.ligerDialog.warn("该用户信息已添加!");
return;
}
var id = r.id;
openf = $.ligerDialog.open({
url: "@Url.Action("addOpenUserInfoQuery")?id=" + id,
title: item.text,
width: 800,
height: 450
});
}
function edit(item)
{
if(item.text=="备注")
{
var r = liger.get("gzList").getSelectedRow();
if (!r)
{
$.ligerDialog.warn("请选择要备注的用户!");
return;
}
$("#xgbz").val(r.remark);
$("#openid").val(r.openid);
$.ligerDialog.open({
title: "设置关注备注", width: 320, height: 120, target: $("#bzuser"), buttons: [{
text: "确定", onclick: function (item, dialg) {
$.ajax({
url: "@Url.Action("remark")", type: "post", dataType: "json", data: {openid:$("#openid").val(), bz: $("#xgbz").val() },
success: function (data) {
$.ligerDialog.closeWaitting();
$.ligerDialog.alert(data.Message);
if(data.State==1)
{
liger.get("gzList").reload();
dialg.hidden();
}
},
beforeSend: function () {
$.ligerDialog.waitting("正在设置备注,请稍后……");
},
error: function (e) {
$.ligerDialog.warn(e.responseText);
}
});
}
}, { text: "取消", onclick: function (item, dialg) { dialg.hidden(); } }]
})
}
}
function beadmin(item)
{
if(item.text=="管理员")
{
var r = liger.get("gzList").getSelectedRow();
if (!r)
{
$.ligerDialog.warn("请选择要变更的用户!");
return;
}
$("#usertype").val(r.type);
if ($("#usertype").val() == '1') {
$("#oa_id").val(r.oa_id);
$("#oa_id").attr("disabled", false)
}
else if ($("#usertype").val() == '0') {
$("#oa_id").val(r.oa_id);
$("#oa_id").attr("disabled", "disabled").css("background-color", "#EEEEEE;");
}
$.ligerDialog.open({
title: "设置管理员", width: 320, height: 120, target: $("#adminuser"), buttons: [{
text: "确定", onclick: function (item, dialg) {
$.ajax({
url: "@Url.Action("userState")", type: "post", dataType: "json", data: { id: r.id, type: $("#usertype").val(), oaId: $("#oa_id").val() },
success: function (data) {
$.ligerDialog.closeWaitting();
$.ligerDialog.alert(data.Message);
if (data.State == 1) {
liger.get("gzList").reload();
dialg.hidden();
}
},
beforeSend: function () {
$.ligerDialog.waitting("正在设置管理员,请稍后……");
},
error: function (e) {
$.ligerDialog.warn(e.responseText);
}
});
}
}, { text: "取消", onclick: function (item, dialg) { dialg.hidden(); } }],
});
}
}
$("#usertype").change(function () {
var type = $("#usertype").val();
if (type == "0") {
$("#oa_id").attr("disabled", "disabled").css("background-color", "#EEEEEE;");
}
if (type == "1") {
$("#oa_id").attr("disabled", false);
}
});
</script>
}