123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162 |
- define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
- var Controller = {
- index: function () {
- // 初始化表格参数配置
- Table.api.init({
- extend: {
- index_url: 'maintain/index' + location.search,
- add_url: 'maintain/add',
- edit_url: 'maintain/edit',
- // del_url: 'maintain/del',
- multi_url: 'maintain/multi',
- import_url: 'maintain/import',
- table: 'maintain',
- }
- });
- var table = $("#table");
- // 初始化表格
- table.bootstrapTable({
- url: $.fn.bootstrapTable.defaults.extend.index_url,
- pk: 'id',
- sortName: 'id',
- fixedColumns: true,
- fixedRightNumber: 1,
- columns: [
- [
- {checkbox: true},
- {field: 'id', title: __('Id')},
- {field: 'orderno', title: __('Orderno'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
- {field: 'company_id', title: __('Company_id')},
- {field: 'company.companyname', title: __('Company.companyname'), operate: 'LIKE'},
- {field: 'user_id', title: __('User_id')},
- {field: 'user.nickname', title: __('User.nickname'), operate: 'LIKE'},
- {field: 'user.mobile', title: __('User.mobile'), operate: 'LIKE'},
- // {field: 'uc_id', title: __('Uc_id')},
- {field: 'usercompany.projectname', title: __('Usercompany.projectname'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
- {field: 'price', title: __('Price'), operate: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: 'info', title: __('Info'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
- {field: 'mobile', title: __('Mobile'), 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: 'status', title: __('Status'), searchList: {"0":__('Status 0'),"2":__('Status 2'),"20":__('Status 20'),"22":__('Status 22'),"30":__('Status 30'),"40":__('Status 40'),"50":__('Status 50'),"60":__('Status 60'),"70":__('Status 70'),"80":__('Status 80'),"90":__('Status 90'),"92":__('Status 92'),"100":__('Status 100')}, formatter: Table.api.formatter.status},
- // {field: 'canceltime', title: __('Canceltime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
- {field: 'finishtime', title: __('Finishtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
- {field: 'baojia_confirmtime', title: __('Baojia_confirmtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
- {field: 'worker_id', title: __('Worker_id')},
- {field: 'worker.truename', title: __('Worker.truename'), operate: 'LIKE'},
- {field: 'worker.mobile', title: __('Worker.mobile'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
- // {field: 'cailiao_time', title: __('Cailiao_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
- // {field: 'lingqu_time', title: __('Lingqu_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
- // {field: 'lingqu_images', title: __('Lingqu_images'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.images},
- {field: 'shangmen_time', title: __('Shangmen_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
- {field: 'weixiu_times', title: __('Weixiu_times')},
- // {field: 'weixiu_id', title: __('Weixiu_id')},
- {field: 'wancheng_time', title: __('Wancheng_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
- // {field: 'eva_info', title: __('Eva_info'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
- // {field: 'eva_time', title: __('Eva_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
- {field: 'eva_score', title: __('Eva_score')},
- {field: 'operate', title: __('Operate'), table: table,
- buttons:[
- {
- name:'showinfo',
- text:'查看导出',
- title:'查看导出',
- icon:'fa fa-exclamation-circle',
- classname:'btn btn-xs btn-info btn-dialog btn-jindu',
- url:'maintain/showinfo/id/{ids}?dialog=1',
- target:'_self',
- },
- {
- name:'jindu',
- text:'进度',
- title:'进度',
- icon:'fa fa-exclamation-circle',
- classname:'btn btn-xs btn-info btn-dialog btn-jindu',
- url:'maintainjindu/index/order_id/{ids}?dialog=1',
- target:'_self',
- },
- {
- name:'cailiao',
- text:'材料',
- title:'材料',
- icon:'fa fa-exclamation-circle',
- classname:'btn btn-xs btn-info btn-dialog btn-cailiao',
- url:'maintaincailiao/index/order_id/{ids}?dialog=1',
- target:'_self',
- },
- {
- name:'baojia',
- text:'报价',
- title:'报价',
- icon:'fa fa-exclamation-circle',
- classname:'btn btn-xs btn-info btn-dialog btn-baojia',
- url:'maintainbaojia/index/order_id/{ids}?dialog=1',
- target:'_self',
- },
- /*{
- name:'zhipai',
- text:'总部指派',
- title:'总部指派',
- icon:'fa fa-exclamation-circle',
- classname:'btn btn-xs btn-info btn-dialog btn-baojia',
- url:'maintain/zhipai/id/{ids}?dialog=1',
- target:'_self',
- hidden:function(row){
- //0,20,22,30,40
- if(row.status == 0 || row.status == 20 || row.status == 22 || row.status == 30 || row.status == 40){
- return false;
- }
- return true;
- }
- },*/
- ],
- events: Table.api.events.operate, formatter: Table.api.formatter.operate}
- ]
- ],
- onLoadSuccess:function(){
- // 这里就是数据渲染结束后的回调函数
- $(".btn-jindu").data("area", ['80%','80%']);
- $(".btn-cailiao").data("area", ['80%','80%']);
- $(".btn-baojia").data("area", ['80%','80%']);
- }
- });
- // 为表格绑定事件
- Table.api.bindevent(table);
- },
- showinfo: function () {
- Controller.api.bindevent();
- },
- add: function () {
- Controller.api.bindevent();
- },
- edit: function () {
- Controller.api.bindevent();
- },
- zhipai: function () {
- Controller.api.bindevent();
- },
- api: {
- bindevent: function () {
- Form.api.bindevent($("form[role=form]"));
- }
- }
- };
- return Controller;
- });
- //打印ctrl+P
- function printPage() {
- window.print();
- }
|