123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126 |
- define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
- var Controller = {
- index : function () {
- // 初始化表格参数配置
- Table.api.init({
- extend : {
- index_url : 'qingdongams/workorder/financial/index',
- detail_url : 'qingdongams/workorder/workorder/detail',
- multi_url : 'qingdongams/workorder/financial/multi',
- table : 'workorder',
- }
- });
- var table = $("#table");
- // 初始化表格
- table.bootstrapTable({
- url : $.fn.bootstrapTable.defaults.extend.index_url,
- pk : 'id',
- sortName : 'id',
- fixedColumns : true,
- fixedNumber : 2,
- columns : [
- [
- {field: 'workorder_number', title: '工单编号', operate: 'like'},
- {
- field: 'title', title: '工单标题', fixedColumns: true, formatter: function (value, row, index) {
- return "<a href='javascript:void(0);' data-id='" + row.id + "' class='show-detail'>" + value + "</a>";
- }, operate: 'like'
- },
- {field: 'workorder_type', title: '工单类型', operate: 'like'},
- {
- field: 'status', title: '工单状态', formatter: Table.api.formatter.status,
- searchList: { 1: '待处理', 2: '处理中', 3: '已完成',9:"已撤销"}
- },
- {
- field: 'process', title: '工单进程', formatter: Table.api.formatter.status,
- searchList: {0: '已提交', 1: '备货中', 2: '备货完成', 3: '到访/录入物流信息',4:"待支付", 9: '已送达'}
- },
- {field : 'customer', title : '客户名称', formatter : function (value, row, index) {
- if(!value){
- return '';
- }
- return "<a href='javascript:void(0);' data-id='" + row.customer_id + "' class='show-customer'>" + value.name + "</a>";
- },operate:false},
- {field: 'contacts', title: '联系人', formatter : function (value, row, index) {
- if(!value){
- return '';
- }
- return value.name ;
- },operate:false},
- {field: 'createtime', title: '创建时间', operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.date},
- {field: 'end_time', title: '结束时间', operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime},
- {field: 'results', title: '结果说明', operate: false},
- ]
- ],
- pagination : true,
- search : false,
- commonSearch : true,
- searchFormVisible : true,
- //显示导出按钮
- showExport: false,
- onLoadSuccess:function(){
- }
- });
- $(document).on('click', '.show-detail', function (data) {
- var area = [$(window).width() > 1200 ? '1200px' : '95%', $(window).height() > 800 ? '800px' : '95%'];
- var options = {
- shadeClose : false,
- shade : [0.3, '#393D49'],
- area : area,
- callback : function (value) {
- //在回调函数里可以调用你的业务代码实现前端的各种逻辑和效果
- console.log(value);
- }
- };
- Fast.api.open($.fn.bootstrapTable.defaults.extend.detail_url + "?ids=" + $(this).data('id'), '工单详情', options);
- });
- $(document).on('click', '.show-customer', function (data) {
- var area = [$(window).width() > 1200 ? '1200px' : '95%', $(window).height() > 800 ? '800px' : '95%'];
- var options = {
- shadeClose : false,
- shade : [0.3, '#393D49'],
- area : area,
- callback : function (value) {
- //在回调函数里可以调用你的业务代码实现前端的各种逻辑和效果
- console.log(value);
- }
- };
- Fast.api.open("qingdongams/customer/customer/detail?ids=" + $(this).data('id'), '客户详情', options);
- });
- // 为表格绑定事件
- Table.api.bindevent(table);
- },
- add : function () {
- Controller.api.bindevent();
- },
- change : function () {
- Controller.api.bindevent();
- },
- batch_change : function () {
- Controller.api.bindevent();
- },
- detail : function () {
- // 初始化表格参数配置
- Table.api.init({});
- Controller.api.bindevent();
- },
- api : {
- bindevent : function () {
- Form.api.bindevent($("form[role=form]"), function(data, ret){
- //这里是表单提交处理成功后的回调函数,接收来自php的返回数据
- Fast.api.close(data);//这里是重点
- });
- }
- }
- };
- return Controller;
- });
|