DiverseYouthNightSchool/public/assets/js/backend/user/user.js

294 lines
13 KiB
JavaScript
Raw Normal View History

2024-11-04 10:49:10 +08:00
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
var Controller = {
index: function () {
// 初始化表格参数配置
Table.api.init({
extend: {
index_url: 'user/user/index',
add_url: 'user/user/add',
edit_url: 'user/user/edit',
del_url: 'user/user/del',
multi_url: 'user/user/multi',
table: 'user',
}
});
var table = $("#table");
// 初始化表格
table.bootstrapTable({
url: $.fn.bootstrapTable.defaults.extend.index_url,
pk: 'id',
sortName: 'user.id',
2024-12-18 09:37:26 +08:00
fixedColumns: true,
fixedRightNumber: 1,
2024-11-04 10:49:10 +08:00
columns: [
[
{checkbox: true},
2024-12-18 09:37:26 +08:00
{field: 'id', title: __('Id'), sortable: true},
{field: 'group.name', title: __('Group')},
{field: 'username', title: __('Username'), operate: 'LIKE'},
{field: 'nickname', title: __('Nickname'), operate: 'LIKE'},
{field: 'realname', title: __('真实姓名'), operate: 'LIKE'},
{field: 'work', title: __('职业'), operate: 'LIKE'},
{field: 'email', title: __('Email'), operate: 'LIKE'},
{field: 'mobile', title: __('Mobile'), operate: 'LIKE'},
{field: 'avatar', title: __('Avatar'), events: Table.api.events.image, formatter: Table.api.formatter.image, operate: false},
{field: 'level', title: __('Level'), operate: 'BETWEEN', sortable: true},
{field: 'gender', title: __('Gender'), visible: false, searchList: {1: __('Male'), 0: __('Female')}},
{field: 'score', title: __('Score'), operate: 'BETWEEN', sortable: true},
{field: 'successions', title: __('Successions'), visible: false, operate: 'BETWEEN', sortable: true},
{field: 'maxsuccessions', title: __('Maxsuccessions'), visible: false, operate: 'BETWEEN', sortable: true},
{field: 'logintime', title: __('Logintime'), formatter: Table.api.formatter.datetime, operate: 'RANGE', addclass: 'datetimerange', sortable: true},
{field: 'loginip', title: __('Loginip'), formatter: Table.api.formatter.search},
{field: 'jointime', title: __('Jointime'), formatter: Table.api.formatter.datetime, operate: 'RANGE', addclass: 'datetimerange', sortable: true},
{field: 'joinip', title: __('Joinip'), formatter: Table.api.formatter.search},
{field: 'status', title: __('Status'), formatter: Table.api.formatter.status, searchList: {normal: __('Normal'), hidden: __('Hidden')}},
{field: 'operate', title: __('Operate'), table: table , buttons: [
{
name: 'user_auth',
2024-12-18 09:37:26 +08:00
text: __('设置成机构认证'),
title: __('设置成机构认证'),
classname: 'btn btn-dialog',
2024-12-19 17:30:50 +08:00
icon: 'fa fa-bank',
2024-12-18 09:37:26 +08:00
dropdown : '更多',
url: manystore_url,
callback: function (data) {
},
// visible: function (row) {
// return row.status == '2'||row.status == '3';
// }
},
{
name: 'user_auth',
text: __('设置成机构授权'),
title: __('设置成机构授权'),
classname: 'btn btn-dialog',
2024-12-19 17:30:50 +08:00
icon: 'fa fa-bitbucket',
2024-12-18 09:37:26 +08:00
dropdown : '更多',
url: user_auth_url,
callback: function (data) {
},
// visible: function (row) {
// return row.status == '2'||row.status == '3';
// }
},
2024-12-18 09:37:26 +08:00
{
name: 'teacher',
2024-12-18 09:37:26 +08:00
text: __('设置成老师'),
title: __('设置成老师'),
classname: 'btn btn-dialog',
icon: 'fa fa-user',
2024-12-18 09:37:26 +08:00
dropdown : '更多',
url: teacher_url,
callback: function (data) {
},
// visible: function (row) {
// return row.status == '2'||row.status == '3';
// }
},
2024-12-18 09:37:26 +08:00
{
name: 'verification',
2024-12-18 09:37:26 +08:00
text: __('设置成核销员'),
title: __('设置成核销员'),
classname: 'btn btn-dialog',
icon: 'fa fa-user',
2024-12-18 09:37:26 +08:00
dropdown : '更多',
url: verification_url,
callback: function (data) {
},
// visible: function (row) {
// return row.status == '2'||row.status == '3';
// }
},
{
name: 'third',
text: __('三方账号信息'),
title: __('三方账号信息'),
2024-12-18 09:37:26 +08:00
classname: 'btn btn-dialog',
icon: 'fa fa-user',
2024-12-18 09:37:26 +08:00
dropdown : '更多',
url: third_url,
callback: function (data) {
},
// visible: function (row) {
// return row.status == '2'||row.status == '3';
// }
},
{
name: 'classes_order',
text: __('课程购买单'),
title: __('课程购买单'),
2024-12-18 09:37:26 +08:00
classname: 'btn btn-dialog',
icon: 'fa fa-cart-arrow-down',
2024-12-18 09:37:26 +08:00
dropdown : '更多',
url: classes_order_url,
callback: function (data) {
},
// visible: function (row) {
// return row.status == '2'||row.status == '3';
// }
},
2024-12-18 09:37:26 +08:00
{
name: 'classes_hourorder',
text: __('课时预约单'),
title: __('课时预约单'),
2024-12-18 09:37:26 +08:00
classname: 'btn btn-dialog',
icon: 'fa fa-calendar',
2024-12-18 09:37:26 +08:00
dropdown : '更多',
url: classes_hourorder_url,
callback: function (data) {
},
// visible: function (row) {
// return row.status == '2'||row.status == '3';
// }
},
{
name: 'evaluate',
text: __('查看用户评价'),
title: __('查看用户评价'),
classname: 'btn btn-dialog',
icon: 'fa fa-handshake-o',
dropdown : '更多',
url: evaluate_url,
callback: function (data) {
},
// visible: function (row) {
// return row.classes_evaluate_id;
// }
},
2024-12-19 17:30:50 +08:00
{
name: 'attachment',
text: __('查看用户上传图片'),
title: __('查看用户上传图片'),
classname: 'btn btn-dialog',
icon: 'fa fa-file-picture-o',
dropdown : '更多',
url: attachment_url,
callback: function (data) {
},
// visible: function (row) {
// return row.classes_evaluate_id;
// }
},
], events: Table.api.events.operate, formatter: Table.api.formatter.operate},
2024-12-18 09:37:26 +08:00
// {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
2024-11-04 10:49:10 +08:00
]
]
});
// 为表格绑定事件
Table.api.bindevent(table);
/**
* 发放y预约订单
* cc
* 2020年8月5日
*/
$(document).on('click', '.btn-changeuser', function (event) {
var url = $(this).attr('data-url');
if(!url) return false;
var title = $(this).attr('title');
var width = $(this).attr('data-width');
var height = $(this).attr('data-height');
var area = [$(window).width() > 800 ? (width?width:'800px') : '95%', $(window).height() > 600 ? (height?height:'600px') : '95%'];
var options = {
shadeClose: false,
shade: [0.3, '#393D49'],
area: area,
callback:function(ret){//回调方法需要在本页面Controller中增加方法监听且调用Fast.api.close(ret)传递结果;
}
};
Fast.api.open(url,title,options);
});
2024-11-04 10:49:10 +08:00
},
add: function () {
Controller.api.bindevent();
},
edit: function () {
Controller.api.bindevent();
},
changeuser: function(){
$("#changeuser").on('click', function() {
$("#changeuser-form").attr("action",'user/user/changeuser').submit();
});
Controller.api.bindevent();
},
2024-11-04 10:49:10 +08:00
api: {
bindevent: function () {
Form.api.bindevent($("form[role=form]"));
}
}
};
var third_url = function (row,dom) {
return 'third/index?user_id='+row.id;
}
//classes_order_url
var classes_order_url = function (row,dom) {
return 'school/classes/order/order/index?user_id='+row.id;
}
//classes_hourorder_url
var classes_hourorder_url = function (row,dom) {
return 'school/classes/hourorder/order/index?user_id='+row.id;
}
var user_auth_url = function (row,dom) {
return 'manystore/user_auth/index?user_id='+row.id;
}
var teacher_url = function (row,dom) {
return 'school/classes/teacher/index?user_id='+row.id;
}
var verification_url = function (row,dom) {
return 'school/classes/verification/index?user_id='+row.id;
}
2024-12-18 09:37:26 +08:00
var manystore_url = function (row,dom) {
return 'manystore/index/index?user_id='+row.id;
}
var evaluate_url= function (row,dom) {
return 'school/classes/evaluate/index?user_id='+row.id;
}
2024-12-19 17:30:50 +08:00
var attachment_url = function (row,dom) {
return 'general/attachment/index?user_id='+row.id;
}
2024-11-04 10:49:10 +08:00
return Controller;
});