作者 niuyongqing

管理员模块

<?php
/**
* Created by PhpStorm.
* User: Administrator
* Date: 2020/6/24
* Time: 15:30
*/
<!DOCTYPE html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd">
<html>
<head>
<meta charset="UTF-8">
<title>管理员列表</title>
<link rel="stylesheet" type="text/css" href="/assets/common/css/themes/gray/easyui.css" />
<link rel="stylesheet" type="text/css" href="/assets/common/css/themes/gray/menu.css" />
<link rel="stylesheet" type="text/css" href="/assets/common/css/themes/icon.css" />
<link rel="stylesheet" type="text/css" href="/assets/web/css/jitnry.css" />
<link rel="stylesheet" type="text/css" href="/assets/web/css/common_car.css" />
<script type="text/javascript" src="/assets/common/js/jquery.min.1.9.4.js"></script>
<script type="text/javascript" src="/assets/common/js/jquery.easyui.min.1.9.4.js"></script>
<script type="text/javascript" src="/assets/common/js/jquery.cookie.1.4.1.js"></script>
<!-- 插件调用 --->
<script type="text/javascript" src="/assets/common/js/datagrid-detailview.js"></script>
<script type="text/javascript" src="/assets/common/locale/easyui-lang-zh_CN.js"></script>
<!-- 基础 JS 调用 -->
<script type="text/javascript" src="/assets/web/js/src/easyui.base.js"></script>
<script type="text/javascript" src="/assets/web/js/src/allCity.js"></script>
<style>
#fm>div {
width: 100%;
display: flex;
justify-content: space-around;
margin: 10px 0;
}
#fm>div input{
width: 180px;
}
</style>
</head>
<body style="margin-bottom: 54px;">
<div class="easyui-layout" data-options="fit:true">
<div data-options="split:false,region:'west',collapsible:true,footer:'#win_base_org_form_footer'" title="管理员列表" id="saveBox" style="width:100%;">
<div class="easyui-panel" style="width:100%;max-width:100%;padding: 5px 5px">
<div style="margin-bottom:5px;">
<a id="name_add_but" href="#" data-options="iconCls:'icon-add'" class="my_but" style="vertical-align: middle;">新增</a>
</div>
</div>
<table id="dg" style="width: 100%; height: 100%"
data-options="rownumbers:true,singleSelect:true,pagination:true,toolbar:'#tb'">
namespace app\products\controller;
use app\web\controller\BaseController;
</table>
use think\Db;
use think\Request;
<div id="tb" style="padding:5px;height:auto">
<div>
推送结果:
<input class="easyui-combobox" style="width:125px" name="materialname" id="materialname"
data-options="valueField:'id',
textField:'text',
data:
[{ 'id':0,
'text':'全部' ,
selected:true
},{ 'id':1,
'text':'成功' ,
},{
'id':2,
'text':'失败'
}] ,panelHeight:'auto'
"/>
地区:
<input class="easyui-combobox" style="width:125px" name="type" id="new_type"
data-options="valueField:'id',
textField:'text',
data:
[
{ 'id':0,
'text':'全部' ,
selected:true
},{ 'id':1,
'text':'湖南省内' ,
},{ 'id':2,
'text':'湖南省外' ,
}] ,panelHeight:'auto'
"/>
起始时间: <input class="easyui-datebox" id='start' name='start' style="width:180px">
截止时间: <input class="easyui-datebox" id='end' name='end' style="width:180px">
<!-- 电话: <input class="easyui-numberbox" type="text" id='phone' name='phone'>-->
<a href="#" class="easyui-linkbutton" id="search_buttn" iconCls="icon-search">搜索</a>
<a id="derive_btn" href="/products/fu_ji_tong/to_excel" class="easyui-linkbutton" style="height:28px" data-options="iconCls:'icon-undo'">导出</a>
</div>
</div>
</div>
</div>
class Role extends BaseController
{
public function user_management(){
<div id="win" class="easyui-dialog" title="提示" style="width: 800px; padding: 10px 20px; height: auto" closed="true" buttons="#dlg-buttons">
<form id="fm" name="frm" method="post" style="margin-top: 20px; margin-left: 20px;">
<table style="padding: 10px 20px;" cellspacing="10">
<tr>
<td>登录账号:</td>
<td><input class="easyui-textbox" type="text" name="username" id="username" /></td>
<input class="easyui-textbox" id="user_id" name="user_id" type="hidden">
</tr>
<tr>
<td>登录密码:</td>
<td><input class="easyui-textbox" type="text" name="password" id="password" /></td>
</tr>
<tr>
<td>用户名称:</td>
<td><input class="easyui-textbox" type="text" name="name" id="name" /></td>
</tr>
<tr>
<td>性别:</td>
<td><input id="statusId" name="sex" class="easyui-switchbutton" data-options="onText:'男',offText:'女'" style="height:30px"></td>
</tr>
<tr>
<td>电话:</td>
<td><input class="easyui-textbox" type="text" name="phone" id="phone" /></td>
</tr>
<tr>
<td>所属机构:</td>
<td>
<input id="cc1" name="mechanism" class="easyui-combobox" data-options="
valueField: 'id',
textField: 'mechanismName',
url: '/products/role/getMechanism',
onSelect: function(rec){
var url = '/products/role/getDepartment?id='+rec.id;
$('#cc2').combobox('reload', url);
var url1 = '/products/role/generateNumber?id='+rec.id;
$('#personalNumber').textbox('reload', url1);
}">
return $this->fetch();
}
//获取用户列表
public function getUsers(){
//$org_id = session('organization.org_id');
$list= Db::table('sos_user_role')->select()->toArray();
$type=['','试用期','正式员工','已离职'];
foreach($list as $key=>$val ){
$list[$key]['sex']=$val['sex'] == 1? '男' : '女';
//所属机构
if($val['mechanism'] != 0){
$mechanism= Db::table('sos_user_mechanism')->field('mechanismName')->where('id',$val['mechanism'])->find();
}
$list[$key]['mechanism']=$val['mechanism'] == 0? '男' : $mechanism['mechanismName'];
//所属部门
if($val['department'] != 0){
$department= Db::table('sos_user_department')->field('departmentName')->where('id',$val['department'])->find();
}
$list[$key]['department']=$val['department'] == 0? '男' : $department['departmentName'];
$list[$key]['status']=$type[$val['status']];
</td>
</tr>
<tr>
<td>所属部门:</td>
<td><input id="cc2" class="easyui-combobox" name="department" data-options="valueField:'id',textField:'departmentName'"></td>
</tr>
<tr>
<td>个人编号:</td>
<td><input class="easyui-textbox" type="text" name="personalNumber" id="personalNumber" data-options="valueField:'id',textField:'departmentName'"/></td>
</tr>
<tr>
<td>入职时间:</td>
<td><input class="easyui-datebox" name="entryTime" id="entryTime" /></td>
</tr>
<tr>
<td>离职时间:</td>
<td><input class="easyui-datebox" name="quitTime" id="quitTime" /></td>
</tr>
<tr>
<td>当前状态:</td>
<td><input class="easyui-combobox" style="width:160px" name="status" id="status"
data-options="valueField:'id',
textField:'text',
data:
[{ 'id':0,
'text':'请选择' ,
selected:true
},{ 'id':1,
'text':'试用期' ,
},{ 'id':2,
'text':'正式员工' ,
},{
'id':3,
'text':'已离职'
}] ,panelHeight:'auto'
"/></td>
</tr>
$list[$key]['entryTime']=date('Y-m-d H:i:s',$val['entryTime']);
$list[$key]['quitTime']=$val['quitTime'] == ''? '' : date('Y-m-d H:i:s',$val['entryTime']);
<div id="dlg-buttons" style="display: block">
<a id="confirm" href="javascript:void(0)" class="easyui-linkbutton c6" iconcls="icon-ok" onclick="submitForm()" style="width: 90px">提交</a>
<a href="javascript:void(0)" class="easyui-linkbutton" iconcls="icon-cancel" onclick="javascript:$('#win').dialog('close')" style="width: 90px">取消</a>
</div>
}
</table>
</form>
</div>
$result["total"] =count($list);
$result['rows']=$list;
echo json_encode($result);
}
// 添加用户
</body>
<tbody id="html_table"></tbody>
<script type="text/javascript" src="/assets/web/js/src/common_fu.js"></script>
public function store(Request $request)
{
$data = $request->post();
<script>
$validate = new UserValidate();
$err_msg = $validate->scene("add")->check($data);
//下拉框搜索
init_datagrid('/products/role/getUsers', 0);
if ($err_msg) {
return json($this->renderError($validate->getError()));
//下拉框搜索
$('#search_buttn').bind('click', function() {
var _data = $('#dg').data('datagrid'); // 拿到datagrid初始化的数据缓存
if(_data && _data.options){
_data.options.pageNumber = 1; // 修改缓存
}
$.data($('#dg')[0], 'datagrid', _data); // 把修改写回去
$res = json_decode(curlPost($this->getUrl('add'), $data),true);
if ($res['code'] == self::SUCCESS_CODE) {
return json($this->renderSuccess());
var result=$('#materialname').combobox('getValue');
var new_type=$('#new_type').combobox('getValue');
var start = $("#start").val();
var end = $("#end").val();
var phone = $("#phone").val();
if(phone.length>0){
if(phone.length!=11){
$.messager.alert('检索手机号','手机号格式错误,请重新输入');
return false;
}
}
var result = {
result,
new_type,
start,
end,
phone
}
// console.log(result);return false;
init_datagrid('/products/role/getUsers', result);
});
return json($res);
function init_datagrid(data_url, res) {
//表头字段
var arr_columns = dg_columns();
$("#dg").datagrid({
rownumbers:true,
singleSelect:true,
pagination:true,
url:data_url,
queryParams: res,
method:'post',
columns: [arr_columns],
loadMsg: '正在加载数据',
emptyMsg: '列表为空',
});
}
function dg_columns() {
var arr = new Array();
arr.push({
field: 'username',
title: '登录账号',
width: 120,
align: 'center'
});
arr.push({
field: 'name',
title: '用户名称',
width: 80,
align: 'center'
});
arr.push({
field: 'sex',
title: '性别',
width: 80,
align: 'center'
});
arr.push({
field: 'phone',
title: '电话',
width: 150,
align: 'center'
});
arr.push({
field: 'mechanism',
title: '所属机构',
width: 200,
align: 'center'
});
arr.push({
field: 'department',
title: '所属部门',
width: 150,
align: 'center'
});
arr.push({
field: 'personalNumber',
title: '人员编号',
width: 200,
align: 'center'
});
arr.push({
field: 'status',
title: '当前状态',
width: 150,
align: 'center'
});
arr.push({
field: 'entryTime',
title: '入职时间',
width: 200,
align: 'center'
});
arr.push({
field: 'quitTime',
title: '离职时间',
width: 200,
align: 'center'
});
arr.push({
field: 'id',
title: '操作',
width: 90,
align: 'center',
formatter:formatOper
});
// console.log(arr)
return arr;
}
//操作框
function formatOper(val, row, index) {
return '<a href="javascript:void(0)" onclick="showUser(' + val + ')">编辑</a>';
}
//修改用户
public function edit(Request $request){
$data = $request->post();
if($data['id']){
$data['uid'] = $data['id'];
}
$validate = new UserValidate();
$err_msg = $validate->scene("update")->check($data);
//添加
$('#name_add_but').linkbutton({
onClick: function () {
if ($err_msg) {
return json($this->renderError($validate->getError()));
addFile();
}
});
function addFile(){
$('#win').dialog({
title: '新增',
width: 800,
height: "auto",
top:20,
closed: false,//显示对话框
cache: false,
modal: true
});
}
//修改
function showUser(row){
if(row){
// alert(row);
var id=row;
var result = {
id
}
$("#win").dialog("open").dialog("setTitle","人员信息修改");
$res = json_decode(curlPost($this->getUrl('edit'), $data),true);
//ajax请求数据
$.ajax({
type: "post",
data: result,
async: false,
url: "/products/role/getUsers",
success: function(data) {
var arr = JSON.parse(data);
if ($res['code'] == self::SUCCESS_CODE) {
return json($this->renderSuccess());
}
console.log(arr.rows[0]);
return json($res);
$('#user_id').textbox('setValue',arr.rows[0].user_id);
}
//删除用户
public function del(Request $request){
$data = $request->get();
$('#username').textbox('setValue',arr.rows[0].username);
$('#password').textbox('setValue',arr.rows[0].password);
$('#name').textbox('setValue',arr.rows[0].name);
$('#personalNumber').textbox('setValue',arr.rows[0].personalNumber);
//
if(arr.rows[0].sex == "男") {
$('#statusId').switchbutton('check');
}else {
$('#statusId').switchbutton('uncheck');
}
$('#phone').textbox('setValue',arr.rows[0].phone);
$('#entryTime').textbox('setValue',arr.rows[0].entryTime);
$('#quitTime').textbox('setValue',arr.rows[0].quitTime);
if (empty($data['id']) && $data['id'] !== 0) {
return json($this->renderError("删除失败!"));
}
$res = json_decode(curlPost($this->getUrl("del"),['uid'=>$data['id']]),true);
$('#materialname').combobox('setValue', $('#materialname option')[2].value);
if ($res['code'] != self::SUCCESS_CODE) {
return json($res);
},
error:function(data){
console.log(data)
}
});
}
}
return json($this->renderSuccess());
function submitForm(){
$('#fm').form('submit', {
url:'/products/role/user_add',
onSubmit: function(){
console.log($(this))
// do some check
// return false to prevent submit;
},
success:function(data){
console.log(data);
return false;
var arr = JSON.parse(data);
$.messager.alert("提示", arr.msg);
$('#dg').datagrid('reload');
// console.log(data);
//$.messager.alert('',msg);
//console.log(data);
//alert(data)
}
});
$('#win').dialog({
closed: true, // 隱藏列表
});
}
}
\ No newline at end of file
</script>
</html>
\ No newline at end of file
... ...
... ... @@ -2,334 +2,306 @@
<html>
<head>
<meta charset="UTF-8">
<title>管理员列表</title>
<title>SOS信息综合管理系统</title>
<link rel="stylesheet" type="text/css" href="/assets/common/css/themes/gray/easyui.css" />
<link rel="stylesheet" type="text/css" href="/assets/common/css/themes/gray/menu.css" />
<link rel="stylesheet" type="text/css" href="/assets/common/css/themes/gray/menu.css" />
<link rel="stylesheet" type="text/css" href="/assets/common/css/themes/icon.css" />
<link rel="stylesheet" type="text/css" href="/assets/web/css/jitnry.css" />
<link rel="stylesheet" type="text/css" href="/assets/web/css/common_car.css" />
<link rel="stylesheet" type="text/css" href="/assets/web/css/jitnry.css" />
<script type="text/javascript" src="/assets/common/js/jquery.min.1.9.4.js"></script>
<script type="text/javascript" src="/assets/common/js/jquery.easyui.min.1.9.4.js"></script>
<script type="text/javascript" src="/assets/common/js/jquery.easyui.min.1.9.4.js"></script>
<script type="text/javascript" src="/assets/common/js/jquery.cookie.1.4.1.js"></script>
<!-- 插件调用 --->
<script type="text/javascript" src="/assets/common/js/datagrid-detailview.js"></script>
<script type="text/javascript" src="/assets/common/locale/easyui-lang-zh_CN.js"></script>
<!-- 基础 JS 调用 -->
<script type="text/javascript" src="/assets/web/js/src/easyui.base.js"></script>
<script type="text/javascript" src="/assets/web/js/src/allCity.js"></script>
<style>
#fm>div {
width: 100%;
display: flex;
justify-content: space-around;
margin: 10px 0;
}
#fm>div input{
width: 180px;
}
</style>
</head>
<body style="margin-bottom: 54px;">
<div class="easyui-layout" data-options="fit:true">
<div data-options="split:false,region:'west',collapsible:true,footer:'#win_base_org_form_footer'" title="管理员列表" id="saveBox" style="width:100%;">
<table id="dg" style="width: 100%; height: 100%"
data-options="rownumbers:true,singleSelect:true,pagination:true,toolbar:'#tb'">
</table>
<div id="tb" style="padding:5px;height:auto">
<div>
推送结果:
<input class="easyui-combobox" style="width:125px" name="materialname" id="materialname"
data-options="valueField:'id',
textField:'text',
data:
[{ 'id':0,
'text':'全部' ,
selected:true
},{ 'id':1,
'text':'成功' ,
},{
'id':2,
'text':'失败'
}] ,panelHeight:'auto'
"/>
地区:
<input class="easyui-combobox" style="width:125px" name="type" id="new_type"
data-options="valueField:'id',
textField:'text',
data:
[
{ 'id':0,
'text':'全部' ,
selected:true
},{ 'id':1,
'text':'湖南省内' ,
},{ 'id':2,
'text':'湖南省外' ,
}] ,panelHeight:'auto'
"/>
起始时间: <input class="easyui-datebox" id='start' name='start' style="width:180px">
截止时间: <input class="easyui-datebox" id='end' name='end' style="width:180px">
电话: <input class="easyui-numberbox" type="text" id='phone' name='phone'>
<a href="#" class="easyui-linkbutton" id="search_buttn" iconCls="icon-search">搜索</a>
<a id="derive_btn" href="/products/fu_ji_tong/to_excel" class="easyui-linkbutton" style="height:28px" data-options="iconCls:'icon-undo'">导出</a>
</div>
</div>
</div>
</div>
<div id="win" class="easyui-dialog" title="提示" style="width: 800px; padding: 10px 20px; height: auto" closed="true" buttons="#dlg-buttons">
<form id="fm" name="frm" method="post" style="margin-top: 20px; margin-left: 20px;">
<table style="padding: 10px 20px;" cellspacing="10">
<tr>
<td>登录账号:</td>
<td><input class="easyui-textbox" type="text" name="name" id="old_name" /></td>
<input class="easyui-textbox" id="prize_id" name="prize_id" type="hidden">
</tr>
<tr>
<td>登录密码:</td>
<td><input class="easyui-textbox" type="text" name="name" id="old_name" /></td>
</tr>
<tr>
<td>用户名称:</td>
<td><input class="easyui-textbox" type="text" name="name" id="old_name" /></td>
</tr>
<tr>
<td>个人编号:</td>
<td><input class="easyui-textbox" type="number" name="probability" id="old_probability" /></td>
</tr>
<tr>
<td>性别:</td>
<td><input class="easyui-textbox" type="text" name="name" id="old_name" /></td>
</tr>
<tr>
<td>电话:</td>
<td><input class="easyui-textbox" type="text" name="name" id="old_name" /></td>
</tr>
<tr>
<td>所属机构:</td>
<td><input class="easyui-textbox" type="number" name="number" id="old_number" /></td>
</tr>
<tr>
<td>所属部门:</td>
<td><input class="easyui-textbox" type="number" name="probability" id="old_probability" /></td>
</tr>
<tr>
<td>入职时间:</td>
<td><input class="easyui-textbox" type="number" name="probability" id="old_probability" /></td>
</tr>
<tr>
<td>离职时间:</td>
<td><input class="easyui-textbox" type="number" name="probability" id="old_probability" /></td>
</tr>
<tr>
<td>当前状态:</td>
<td><input class="easyui-textbox" type="number" name="probability" id="old_probability" /></td>
</tr>
<!-- 插件调用 --->
<script type="text/javascript" src="/assets/common/js/datagrid-detailview.js"></script>
<script type="text/javascript" src="/assets/common/locale/easyui-lang-zh_CN.js"></script>
<!-- 基础 JS 调用 -->
<script type="text/javascript" src="/assets/web/js/src/easyui.base.js"></script>
<script type="text/javascript" src="/assets/web/js/src/common.menu.js"></script>
<div id="dlg-buttons" style="display: block">
<a id="confirm" href="javascript:void(0)" class="easyui-linkbutton c6" iconcls="icon-ok" onclick="submitForm()" style="width: 90px">提交</a>
<a href="javascript:void(0)" class="easyui-linkbutton" iconcls="icon-cancel" onclick="javascript:$('#win').dialog('close')" style="width: 90px">取消</a>
</div>
<script type="text/javascript">
var oltTarget, logTarget, logGridTarget;
var num = 0;
var iCount;
$(function () {
oltTarget = $("#operation_log_txt");
logTarget = $("#operation_log");
logGridTarget = $("#operation_log_grid");
/* 获得窗口大小 */
function onResize() {
logTarget.window({
left:$(window).width() - 705,
top:$(window).height() - 425,
closed:true
});
};
window.onresize = onResize;
onResize();
</table>
</form>
</div>
/*
$(document).unbind('.commoditygrid').bind('mousedown.commoditygrid', function(e){
var p = $(e.target).closest('table.datagrid-btable,div.combo-panel');
if (p.length) { return; }
});
*/
</body>
<tbody id="html_table"></tbody>
<script type="text/javascript" src="/assets/web/js/src/common_fu.js"></script>
// $('#main_tabs').tabs('update', {
// tab: $('#main_tabs').tabs('getTab', 0),
// options: {
// id: 'ClientIndex',
// title: '客户管理'
// }
// });
<script>
// $('#main_iframe').attr('src','__MODEL__/client/client_list_main');
//下拉框搜索
init_datagrid('/products/role/getUsers', 0);
//下拉框搜索
//首页默认展示
$('#main_tabs').tabs('update', {
tab: $('#main_tabs').tabs('getTab', 0),
options: {
id: 'ClientIndex',
title: '人员管理'
}
});
$('#search_buttn').bind('click', function() {
$('#main_iframe').attr('src','__MODEL__/role/index');
var _data = $('#dg').data('datagrid'); // 拿到datagrid初始化的数据缓存
if(_data && _data.options){
_data.options.pageNumber = 1; // 修改缓存
}
$.data($('#dg')[0], 'datagrid', _data); // 把修改写回去
var result=$('#materialname').combobox('getValue');
var new_type=$('#new_type').combobox('getValue');
var start = $("#start").val();
var end = $("#end").val();
var phone = $("#phone").val();
if(phone.length>0){
if(phone.length!=11){
$.messager.alert('检索手机号','手机号格式错误,请重新输入');
return false;
}
}
var result = {
result,
new_type,
start,
end,
phone
}
// console.log(result);return false;
init_datagrid('/products/role/getUsers', result);
});
$.h.index.setOperateInfo(null, false);
function init_datagrid(data_url, res) {
//表头字段
var arr_columns = dg_columns();
$("#dg").datagrid({
rownumbers:true,
singleSelect:true,
pagination:true,
url:data_url,
queryParams: res,
method:'post',
columns: [arr_columns],
loadMsg: '正在加载数据',
emptyMsg: '列表为空',
});
}
function dg_columns() {
var arr = new Array();
arr.push({
field: 'username',
title: '登录账号',
width: 120,
align: 'center'
});
arr.push({
field: 'name',
title: '用户名称',
width: 80,
align: 'center'
});
arr.push({
field: 'sex',
title: '性别',
width: 80,
align: 'center'
});
arr.push({
field: 'phone',
title: '电话',
width: 150,
align: 'center'
});
arr.push({
field: 'mechanism',
title: '所属机构',
width: 200,
align: 'center'
});
arr.push({
field: 'department',
title: '所属部门',
width: 150,
align: 'center'
});
arr.push({
field: 'personalNumber',
title: '人员编号',
width: 200,
align: 'center'
});
arr.push({
field: 'status',
title: '当前状态',
width: 150,
align: 'center'
});
arr.push({
field: 'entryTime',
title: '入职时间',
width: 200,
align: 'center'
$("<div class=\"datagrid-mask\"></div>").css({
display: "none",
position: "absolute",
width: "100%",
height: "100%"
}).appendTo("#Loading");
$("<div class=\"loading\"></div>").html("<div><img src='/assets/web/img/loading.gif' style='width:80px;height:80px;'></div><div style='font-size:12px;color:#666;'>正在加载主框架数据……</div>").css({
position: "relative",
left: $(window).width() / 2 - $(window).width() * 0.1,
top: $(window).height() / 2 - 100,
width: $(window).width() * 0.2
}).appendTo("#Loading").css({display: "block"});
setTimeout(function () {
$("#Loading").fadeOut("normal", function () {
$(this).remove();
});
}, 800)
});
arr.push({
field: 'quitTime',
title: '离职时间',
width: 200,
align: 'center'
});
arr.push({
field: 'id',
title: '操作',
width: 90,
align: 'center',
formatter:formatOper
});
// console.log(arr)
return arr;
}
//操作框
function formatOper(val, row, index) {
return '<a href="javascript:void(0)" onclick="showUser(' + val + ')">编辑</a>';
}
//修改
function showUser(row){
$("#win").dialog("open").dialog("setTitle","员工信息修改");
return false;
$("[switchbuttonName='111']").switchbutton("uncheck");
//var row = $("#dg").datagrid("getSelected");//取得选中行
if(row){
// alert(row);
var id=row;
var result = {
id
}
$("#win").dialog("open").dialog("setTitle","修改奖项");
//ajax请求数据
$.ajax({
type: "post",
data: result,
async: false,
url: "/products/prize/prize_list",
success: function(data) {
var arr = JSON.parse(data);
$.h.index = {
refresh : function(e) {
var objMainTabs = $('#main_tabs');
var objMainTabsOptions = objMainTabs.tabs('getSelected').panel('options');
if (objMainTabs.tabs('getTabIndex',objMainTabs.tabs('getSelected')) == 0) {
$('#main_iframe').attr('src',$('#main_iframe').attr('src'));
return;
}
objMainTabs.tabs('update', {
tab: objMainTabs.tabs('getSelected'),
options: {
title: objMainTabsOptions.title,
href: objMainTabsOptions.href
}
});
objMainTabs.tabs('getSelected').panel('refresh');
},
onCloseAll : function() {
var objTabs = $('#main_tabs');
var mTabs = objTabs.tabs('tabs');
for (var i = 0; i < mTabs.length; i++) {
if (i == 0) continue;
objTabs.tabs("close", i);
}
},
sendMainMsg : function(msg) {
if ($("#main_msg").is(":hidden")) {
$('#main_msg').html(msg);
var mainMsgWidth = $('#main_msg').width() / 2;
$('#main_msg').offset({top:0,left:((document.documentElement.clientWidth || document.body.clientWidth) / 2 - mainMsgWidth)});
$('#main_msg').show();
} else {
$('#main_msg').html('');
$('#main_msg').offset({top:0,left:0});
$('#main_msg').hide();
}
},
/**
* 如果 info 为 null 并且 b 为 false,只读取数组中第一条记录并显示
* 如果 info 不是 null 并且 b 为 false,只显示信息,不写入数组中
* 如果 info 不是 null 并且 b 为 true,显示信息,并写入数组中
*/
setOperateInfo : function(info, b) {
if (info == null || b) {
var mCookieData = $.cookie('SysOperateInfo');
if (!mCookieData) {
mCookieData = '[]';
}
mCookieData = JSON.parse(mCookieData);
$('#prize_id').textbox('setValue',arr.rows[0].id);
$('#old_name').textbox('setValue',arr.rows[0].name);
$('#old_number').textbox('setValue',arr.rows[0].number);
$('#old_probability').textbox('setValue',arr.rows[0].probability);
if (mCookieData.length >= 10) {
mCookieData.splice(9, 1);
}
/* 为 true 时,写入 Cookie */
if (b) {
info.id = mCookieData.length;
mCookieData.unshift(info);
$.cookie('SysOperateInfo',JSON.stringify(mCookieData));
}
if (info == null) {
if (mCookieData.length == 0) return;
info = mCookieData[0];
}
if(arr.rows[0].display == "已发布") {
$('#statusId').switchbutton('check');
}else {
$('#statusId').switchbutton('uncheck');
if (!logTarget.window('options').closed) {
logGridTarget.datagrid('loadData', mCookieData);
}
$('#imghead').attr("src",arr.rows[0].img);
//$('#imghead1').attr("src",arr.rows[0].url);
}
$('#img111').textbox('setValue',arr.rows[0].img);
// $('#img222').textbox('setValue',arr.rows[0].url);
var strHtml = '<strong>【{R_Module}】【{R_Operate}】:</strong>{R_Content}';
strHtml = strHtml.replace('{R_Module}',info.module).replace('{R_Operate}',info.operate).replace('{R_Content}',info.content);
$(oltTarget.children()[0]).html(strHtml);
clearInterval(iCount);
if (info.icon == 'hr-warn' || info.icon == 'hr-error') {
},
error:function(data){
console.log(data)
this.sendMainMsg(strHtml);
iCount = window.setInterval(txtTwinkle, 1300);
}
});
//结束
// $("#am").form("load",row);
// url = '__URL__/save?id='+row.id;//为update方法准备访问url,注意是全局变量
if (!$(oltTarget.children()[1]).hasClass(info.icon)) {
strHtml = "l-btn-icon " + info.icon;
$(oltTarget.children()[1]).attr("class","l-btn-icon " + info.icon);
}
}
};
function txtTwinkle() {
num++;
if (num == 6) {
num = 0;
$.h.index.sendMainMsg(null);
clearInterval(iCount);
} else {
setTimeout("oltTarget.css('color','blue')",500);
setTimeout("oltTarget.css('color','#000')",800);
}
}
}
</script>
</head>
<body>
<div id='Loading' style="position:absolute;z-index:1000;top:0px;left:0px;width:100%;height:100%;background-color:#fff;text-align:center;"></div>
<div class="easyui-layout" data-options="fit:true">
<div data-options="region:'north',border:false" style="display:flex;justify-content:space-between;height:60px;line-height:60px;overflow:hidden;background-image:linear-gradient(90deg, #dee, #fff);">
<div style="display:flex;align-items:center;">
<div slot="header-logo" style="float:left;width:180px;">
<img src="/assets/web/img/Logo.png" style="margin-left: 20px;height: 30px;">
</div>
</div>
<div style="display:flex;align-items:center;margin-right:5px;">
<a href="/web/index/loginout" class="easyui-menubutton">退出</a>
</div>
<div id="main_msg" style="display:none;position:absolute;top:0;left:50%;transform:translate(-50%,0);height:40px;line-height:30px;font-size:14px;color:#fff;padding:5px 20px;border-radius:0 0 .5em .5em;background-color:rgba(0,0,0,0.5)">~~这是一条提示消息~~</div>
</div>
<div data-options="region:'west',split:true,hideCollapsedContent:false,collapsed:false,title:'菜单',dataType:'json'" style="width:180px;min-width:160px;">
<div class="easyui-menu" data-options="inline:true,fit:true,itemHeight:40" style="border:0px;">
<!-- <div data-options="iconCls:'icon-cancel'">-->
<!-- <span>客户管理</span>-->
<!-- <div style="width:180px;">-->
<!-- <div data-options="iconCls:'icon-clear'"><b>客户管理</b></div>-->
<!-- <div data-options="iconCls:'icon-edit'">客户导入</div>-->
<!-- <div data-options="iconCls:'icon-remove'">客户调配</div>-->
<!-- <div data-options="iconCls:'icon-save'">数据处理</div>-->
<!-- <div class="menu-sep"></div>-->
<!-- <div data-options="iconCls:'icon-cut'">招聘管理</div>-->
<!-- <div data-options="iconCls:'icon-ok'">下发回收</div>-->
<!-- <div data-options="iconCls:'icon-no'">故障报修</div>-->
<!-- </div>-->
<!-- </div>-->
<!-- <div class="menu-selected" data-options="iconCls:'hr-loading'">-->
<!-- <span>我的助手</span>-->
<!-- <div style="width:180px;">-->
<!-- <div><b>我的消息</b></div>-->
<!-- <div>消息提醒</div>-->
<!-- <div>通话记录</div>-->
<!-- <div>未接来电</div>-->
<!-- <div>公告管理</div>-->
<!-- <div>通讯录</div>-->
<!-- <div>个人设置</div>-->
<!-- <div>帮助向导</div>-->
<!-- </div>-->
<!-- </div>-->
<!---->
<div data-options="iconCls:'icon-reload'">
<span>转盘抽奖</span>
<div style="width:180px;">
<div onclick="$.h.menu.onMenuTurnPrizeManage();"><b>奖项列表</b></div>
<div onclick="$.h.menu.onMenuTurnPrizeUserManage();"><b>用户列表</b></div>
<div onclick="$.h.menu.onMenuTurnPrizeRuleManage();"><b>规则设置</b></div>
</div>
</div>
<div data-options="iconCls:'icon-reload'">
<span>抽奖管理</span>
<div style="width:180px;">
<div onclick="$.h.menu.onMenuPrizeManage();"><b>奖项列表</b></div>
<div onclick="$.h.menu.onMenuPrizeUserManage();"><b>用户列表</b></div>
<div onclick="$.h.menu.onMenuPrizeRuleManage();"><b>规则设置</b></div>
</div>
</div>
<div data-options="iconCls:'icon-reload'">
<span>产品管理</span>
<div style="width:180px;">
<div onclick="$.h.menu.onMenuProductManage();"><b>产品列表</b></div>
<div onclick="$.h.menu.onMenuProductOrderManage();"><b>订单列表</b></div>
</div>
</div>
<div data-options="iconCls:'icon-reload'">
<span>获客管理</span>
<div style="width:180px;">
<div onclick="$.h.menu.onMenuFuJiTongManage();"><b>客户列表</b></div>
</div>
</div>
</script>
<div data-options="iconCls:'icon-reload'">
<span>管理员</span>
<div style="width:180px;">
<div onclick="$.h.menu.onMenuRoleManage();"><b>人员管理</b></div>
<div onclick="$.h.menu.onMenuMechanismManage();"><b>机构管理</b></div>
</div>
</div>
<div data-options="iconCls:'icon-reload'">
<span>二级菜单</span>
<div style="width:180px;">
<div onclick="$.h.menu.onMenuDepartmentManage();"><b>部门管理</b></div>
<div onclick="$.h.menu.onMenuPersonnelManage();"><b>人员管理</b></div>
</div>
</div>
<div data-options="iconCls:'icon-reload'">
<span>编号规则</span>
<div style="width:180px;">
<div onclick="$.h.menu.onMenuNumberManage();"><b>编号列表</b></div>
</div>
</div>
</div>
</div>
<div data-options="region:'center',border:false" style="overflow:hidden;">
<div id="main_tabs" class="easyui-tabs" data-options="fit:true,border:true,tools:'#tab-tools',tabWidth:120">
<div style="overflow:hidden;padding:4px;">
<iframe id="main_iframe" style="width:100%;height:100%;border:0px;overflow:hidden;"></iframe>
</div>
</div>
<div id="tab-tools" style="border-right:0px;">
<a class="easyui-linkbutton" data-options="plain:true,iconCls:'icon-clear',onClick:$.h.index.onCloseAll" title="关闭所有"></a>
<a class="easyui-linkbutton" data-options="plain:true,iconCls:'icon-reload',onClick:$.h.index.refresh" title="刷新当前"></a>
</div>
</div>
<div data-options="region:'east',split:true,hideCollapsedContent:false,collapsed:true,title:'快捷',dataType:'json',href:'/web/index/quick_menu'" style="width:100px;min-width:100px;"></div>
</div>
</body>
</html>
\ No newline at end of file
... ...