DiverseYouthNightSchool/public/assets/js/manystore/school/classes/evaluate.js

163 lines
7.8 KiB
JavaScript
Raw Normal View History

2024-12-11 19:03:47 +08:00
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},
2024-12-11 19:03:47 +08:00
{field: 'id', title: __('Id')},
2024-12-11 19:03:47 +08:00
{field: 'image', title: __('Image'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
{field: 'nickname', title: __('Nickname'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
2024-12-11 19:03:47 +08:00
{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: 'message_text', title: __('Message_text'), operate:'BETWEEN'},
{field: 'evaluate_time', title: __('Evaluate_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
2024-12-11 19:03:47 +08:00
{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: 'user_id', title: __('User_id')},
2024-12-11 19:03:47 +08:00
{field: 'user.nickname', title: __('User.nickname'), operate: 'LIKE'},
{field: 'user.realname', title: __('User.realname'),visible:false, operate: 'LIKE'},
{field: 'user.mobile', title: __('User.mobile'),visible:false, operate: 'LIKE'},
{field: 'user.avatar', title: __('User.avatar'),visible:false, operate: 'LIKE', events: Table.api.events.image, formatter: Table.api.formatter.image},
2024-12-11 19:03:47 +08:00
{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},
2024-12-11 19:03:47 +08:00
{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: 'manystoreshop.name', title: __('Manystoreshop.name'), operate: 'LIKE'},
{field: 'classes_lib_id', title: __('Classes_lib_id'),visible:false},
{field: 'classes_order_id', title: __('Classes_order_id'),visible:false},
{field: 'manystore_id', title: __('Manystore_id'),visible:false},
{field: 'shop_id', title: __('Shop_id'),visible:false},
{field: 'teacher_id', title: __('Teacher_id'),visible:false},
{field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
{field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
{field: 'schoolclassesorder.order_no',visible:false, title: __('Schoolclassesorder.order_no'), operate: 'LIKE'},
{field: 'manystore.nickname',visible:false, title: __('Manystore.nickname'), operate: 'LIKE'},
{field: 'manystoreshop.logo',visible:false, title: __('Manystoreshop.logo'), operate: 'LIKE'},
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
2024-12-11 19:03:47 +08:00
]
]
});
// 为表格绑定事件
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(),user_id: $("#c-user_id").val()}};
2024-12-11 19:03:47 +08:00
});
//老师必须是上面机构中的
$("#c-teacher_id").data("params", function (obj) {
//obj为SelectPage对象
return {custom: {shop_id: $("#c-shop_id").val()}};
2024-12-11 19:03:47 +08:00
});
$("#c-classes_lib_id").data("params", function (obj) {
//obj为SelectPage对象
return {custom: {shop_id: $("#c-shop_id").val(),teacher_id: $("#c-teacher_id").val()}};
2024-12-11 19:03:47 +08:00
});
//机构清除老师也要清除
$("#c-shop_id").change(function () {
$("#c-teacher_id").selectPageClear();
$("#c-classes_lib_id").selectPageClear();
$("#c-classes_order_id").selectPageClear();
});
$("#c-teacher_id").change(function () {
$("#c-classes_lib_id").selectPageClear();
$("#c-classes_order_id").selectPageClear();
});
2024-12-11 19:03:47 +08:00
$("#c-classes_lib_id").change(function () {
$("#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;
});