74 lines
3.4 KiB
JavaScript
Executable File
74 lines
3.4 KiB
JavaScript
Executable File
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
|
|
|
|
var Controller = {
|
|
index: function () {
|
|
// 初始化表格参数配置
|
|
Table.api.init({
|
|
extend: {
|
|
index_url: 'firm/index' + location.search,
|
|
add_url: 'firm/add',
|
|
edit_url: 'firm/edit',
|
|
del_url: 'firm/del',
|
|
multi_url: 'firm/multi',
|
|
import_url: 'firm/import',
|
|
table: 'firm',
|
|
}
|
|
});
|
|
|
|
var table = $("#table");
|
|
|
|
// 初始化表格
|
|
table.bootstrapTable({
|
|
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
|
pk: 'id',
|
|
sortName: 'id',
|
|
columns: [
|
|
[
|
|
{checkbox: true},
|
|
{field: 'id', title: __('Id')},
|
|
{field: 'name', title: __('Name'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
|
|
{field: 'full_name', title: __('Full_name'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
|
|
{field: 'address', title: __('Address'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
|
|
{field: 'aicustomerservice_ids', title: __('Aicustomerservice_ids'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
|
|
{field: 'create_time', title: __('Create_time'), 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,
|
|
buttons: [
|
|
{
|
|
name: 'importBasic',
|
|
text: '导入基础管理',
|
|
title: '导入基础管理',
|
|
confirm:'确定导入【基础管理】中的【大类,客户来源,职务,到店项目,标签,模版内容】吗?',
|
|
classname: 'btn btn-xs btn-primary btn-ajax',
|
|
icon: 'fa fa-list',
|
|
url: 'firm/importBasic',
|
|
success: function (row) {
|
|
if (row.code == 200) {
|
|
Layer.msg("导入成功");
|
|
} else {
|
|
Layer.msg(row.msg);
|
|
}
|
|
}
|
|
},
|
|
]}
|
|
]
|
|
]
|
|
});
|
|
|
|
// 为表格绑定事件
|
|
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;
|
|
});
|