- 删除 Addon 相关控制器、模型、语言包和视图文件 - 新增服务类型支持一口价属性配置 - 新增系统监控、用户资料、订单评价等后端管理页面 - 新增数据库表结构及索引优化脚本 - 更新应用版本号至 1.0.44 - 更新小程序应用标识 - 完善 .gitignore 配置
104 行
4.7 KiB
JavaScript
104 行
4.7 KiB
JavaScript
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
|
|
|
|
var Controller = {
|
|
index: function () {
|
|
// 初始化表格参数配置
|
|
Table.api.init({
|
|
extend: {
|
|
index_url: 'skill_dict/index' + location.search,
|
|
add_url: 'skill_dict/add',
|
|
edit_url: 'skill_dict/edit',
|
|
del_url: 'skill_dict/del',
|
|
multi_url: 'skill_dict/multi',
|
|
table: 'skill_dict',
|
|
}
|
|
});
|
|
|
|
var table = $("#table");
|
|
|
|
// 初始化表格
|
|
table.bootstrapTable({
|
|
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
|
pk: 'id',
|
|
sortName: 'weigh',
|
|
sortOrder: 'desc',
|
|
columns: [
|
|
[
|
|
{checkbox: true},
|
|
{field: 'id', title: 'ID', sortable: true},
|
|
{field: 'category_id', title: '分类ID', visible: false, operate: '='},
|
|
{
|
|
field: 'category',
|
|
title: '所属分类',
|
|
searchList: {
|
|
"安装维修": '安装维修',
|
|
"建筑装修": '建筑装修',
|
|
"物流运输": '物流运输',
|
|
"汽车服务": '汽车服务',
|
|
"家政服务": '家政服务',
|
|
"便民服务": '便民服务',
|
|
"其他技能": '其他技能'
|
|
},
|
|
formatter: function (val) {
|
|
var colorMap = {
|
|
"安装维修": 'primary',
|
|
"建筑装修": 'success',
|
|
"物流运输": 'info',
|
|
"汽车服务": 'warning',
|
|
"家政服务": 'danger',
|
|
"便民服务": 'default',
|
|
"其他技能": 'default'
|
|
};
|
|
return '<span class="label label-' + (colorMap[val] || 'default') + '">' + val + '</span>';
|
|
}
|
|
},
|
|
{field: 'name', title: '技能名称', operate: 'LIKE'},
|
|
{
|
|
field: 'source',
|
|
title: '字典来源',
|
|
searchList: {"system": '系统预置', "custom": '师傅自定义'},
|
|
formatter: function (val) {
|
|
if (val === 'custom') {
|
|
return '<span class="label label-warning"><i class="fa fa-user"></i> 师傅自定义</span>';
|
|
}
|
|
return '<span class="label label-success"><i class="fa fa-cogs"></i> 系统预置</span>';
|
|
}
|
|
},
|
|
{field: 'master.realname', title: '提交师傅', operate: 'LIKE', formatter: function (val) { return val || '-'; }},
|
|
{field: 'weigh', title: '排序权重', sortable: true},
|
|
{
|
|
field: 'status',
|
|
title: '启用状态',
|
|
searchList: {"normal": '正常启用', "hidden": '隐藏停用'},
|
|
formatter: Table.api.formatter.status
|
|
},
|
|
{field: 'createtime', title: '添加时间', operate: 'RANGE', addclass: 'datetimerange', autocomplete: false, formatter: Table.api.formatter.datetime},
|
|
{
|
|
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 () {
|
|
Form.api.bindevent($("form[role=form]"));
|
|
}
|
|
}
|
|
};
|
|
return Controller;
|
|
});
|