144 lines
7.0 KiB
JavaScript
144 lines
7.0 KiB
JavaScript
|
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
|
|||
|
|
|||
|
var Controller = {
|
|||
|
index: function () {
|
|||
|
// 初始化表格参数配置
|
|||
|
Table.api.init({
|
|||
|
extend: {
|
|||
|
index_url: 'school/classes/evaluate/index' + location.search,
|
|||
|
add_url: 'school/classes/evaluate/add',
|
|||
|
edit_url: 'school/classes/evaluate/edit',
|
|||
|
del_url: 'school/classes/evaluate/del',
|
|||
|
multi_url: 'school/classes/evaluate/multi',
|
|||
|
import_url: 'school/classes/evaluate/import',
|
|||
|
table: 'school_classes_evaluate',
|
|||
|
}
|
|||
|
});
|
|||
|
|
|||
|
var table = $("#table");
|
|||
|
|
|||
|
// 初始化表格
|
|||
|
table.bootstrapTable({
|
|||
|
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
|||
|
pk: 'id',
|
|||
|
sortName: 'weigh',
|
|||
|
columns: [
|
|||
|
[
|
|||
|
{checkbox: true},
|
|||
|
{field: 'id', title: __('Id')},
|
|||
|
{field: 'user_id', title: __('User_id')},
|
|||
|
{field: 'classes_lib_id', title: __('Classes_lib_id')},
|
|||
|
{field: 'classes_order_id', title: __('Classes_order_id')},
|
|||
|
{field: 'manystore_id', title: __('Manystore_id')},
|
|||
|
{field: 'shop_id', title: __('Shop_id')},
|
|||
|
{field: 'teacher_id', title: __('Teacher_id')},
|
|||
|
{field: 'image', title: __('Image'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
|
|||
|
{field: 'nickname', title: __('Nickname'), operate: 'LIKE'},
|
|||
|
{field: 'classes_star', title: __('Classes_star'), operate:'BETWEEN'},
|
|||
|
{field: 'teacher_star', title: __('Teacher_star'), operate:'BETWEEN'},
|
|||
|
{field: 'shop_star', title: __('Shop_star'), operate:'BETWEEN'},
|
|||
|
{field: 'evaluate_time', title: __('Evaluate_time')},
|
|||
|
{field: 'status', title: __('Status'), searchList: {"1":__('Status 1'),"2":__('Status 2')}, formatter: Table.api.formatter.status},
|
|||
|
{field: 'top', title: __('Top'), searchList: {"0":__('Top 0'),"1":__('Top 1')}, formatter: Table.api.formatter.normal},
|
|||
|
{field: 'weigh', title: __('Weigh'), operate: false},
|
|||
|
{field: 'createtime', title: __('Createtime')},
|
|||
|
{field: 'updatetime', title: __('Updatetime')},
|
|||
|
{field: 'user.nickname', title: __('User.nickname'), operate: 'LIKE'},
|
|||
|
{field: 'user.realname', title: __('User.realname'), operate: 'LIKE'},
|
|||
|
{field: 'user.mobile', title: __('User.mobile'), operate: 'LIKE'},
|
|||
|
{field: 'user.avatar', title: __('User.avatar'), operate: 'LIKE', events: Table.api.events.image, formatter: Table.api.formatter.image},
|
|||
|
{field: 'schoolclasseslib.title', title: __('Schoolclasseslib.title'), operate: 'LIKE'},
|
|||
|
{field: 'schoolclasseslib.headimage', title: __('Schoolclasseslib.headimage'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
|
|||
|
{field: 'schoolclassesorder.order_no', title: __('Schoolclassesorder.order_no'), operate: 'LIKE'},
|
|||
|
{field: 'manystore.nickname', title: __('Manystore.nickname'), operate: 'LIKE'},
|
|||
|
{field: 'manystoreshop.name', title: __('Manystoreshop.name'), operate: 'LIKE'},
|
|||
|
{field: 'manystoreshop.logo', title: __('Manystoreshop.logo'), operate: 'LIKE'},
|
|||
|
{field: 'schoolteacher.name', title: __('Schoolteacher.name'), operate: 'LIKE'},
|
|||
|
{field: 'schoolteacher.head_image', title: __('Schoolteacher.head_image'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
|
|||
|
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
|
|||
|
]
|
|||
|
]
|
|||
|
});
|
|||
|
|
|||
|
// 为表格绑定事件
|
|||
|
Table.api.bindevent(table);
|
|||
|
},
|
|||
|
add: function () {
|
|||
|
Controller.api.bindevent();
|
|||
|
},
|
|||
|
edit: function () {
|
|||
|
Controller.api.bindevent();
|
|||
|
},
|
|||
|
api: {
|
|||
|
bindevent: function () {
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
$("#c-classes_order_id").data("params", function (obj) {
|
|||
|
//obj为SelectPage对象
|
|||
|
return {custom: {shop_id: $("#c-shop_id").val(),classes_lib_id: $("#c-classes_lib_id").val()}};
|
|||
|
});
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
//老师必须是上面机构中的
|
|||
|
$("#c-teacher_id").data("params", function (obj) {
|
|||
|
//obj为SelectPage对象
|
|||
|
return {custom: {shop_id: $("#c-shop_id").val(),classes_lib_id: $("#c-classes_lib_id").val()}};
|
|||
|
});
|
|||
|
|
|||
|
$("#c-classes_lib_id").data("params", function (obj) {
|
|||
|
//obj为SelectPage对象
|
|||
|
return {custom: {shop_id: $("#c-shop_id").val()}};
|
|||
|
});
|
|||
|
|
|||
|
//机构清除老师也要清除
|
|||
|
$("#c-shop_id").change(function () {
|
|||
|
$("#c-teacher_id").selectPageClear();
|
|||
|
$("#c-classes_lib_id").selectPageClear();
|
|||
|
$("#c-classes_order_id").selectPageClear();
|
|||
|
});
|
|||
|
|
|||
|
$("#c-classes_lib_id").change(function () {
|
|||
|
$("#c-teacher_id").selectPageClear();
|
|||
|
$("#c-classes_order_id").selectPageClear();
|
|||
|
});
|
|||
|
|
|||
|
$("#c-user_id").change(function () {
|
|||
|
console.log(this);
|
|||
|
});
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
$(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 ids = $(this).attr('data-id');
|
|||
|
var area = ['98%','98%'];
|
|||
|
var options = {
|
|||
|
shadeClose: false,
|
|||
|
shade: [0.3, '#393D49'],
|
|||
|
area: area,
|
|||
|
callback:function(ret){//回调方法,需要在本页面Controller中增加方法监听且调用Fast.api.close(ret)传递结果;
|
|||
|
Fast.api.close(ret);
|
|||
|
}
|
|||
|
};
|
|||
|
Fast.api.open(url,title,options);
|
|||
|
});
|
|||
|
|
|||
|
|
|||
|
|
|||
|
Form.api.bindevent($("form[role=form]"));
|
|||
|
}
|
|||
|
}
|
|||
|
};
|
|||
|
return Controller;
|
|||
|
});
|