123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192 |
- /*
- * @Author: yukai
- * @Date: 2023-04-26 12:25:56
- * @LastEditors: Please set LastEditors
- * @LastEditTime: 2023-09-11 13:36:02
- * @Description: 请填写简介
- */
- define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
- var Controller = {
- index: function () {
- // 初始化表格参数配置
- Table.api.init({
- extend: {
- index_url: 'qingdongams/customer/contract/index1',
- detail_url : 'qingdongams/customer/contract/detail',
- del_url: '',
- table: 'customer',
- }
- });
- var table = $("#table");
- // 初始化表格
- table.bootstrapTable({
- url: $.fn.bootstrapTable.defaults.extend.index_url,
- sortName: 'id',
- columns: [
- [
- {
- field: 'num', title: '合同编号', fixedColumns: true, formatter: function (value, row, index) {
- if (value == '') {
- value = '无';
- }
- return "<a href='javascript:void(0);' data-id='" + row.id + "' class='show-detail'>" + value + "</a>";
- }, operate: 'like'
- },
- {
- field: 'name', title: '合同名称', fixedColumns: true, formatter: function (value, row, index) {
- if (value == '') {
- value = '无';
- }
- return value;
- }, operate: false
- }
- ,
- { field: 'contract_status', title: '合同状态', operate: '=', searchList: { 0: '进行中', 1: '已完成', 2: '已作废' }, formatter: Table.api.formatter.status },
- { field: 'end_time', title: '合同结束时间', operate: 'RANGE', addclass: 'datetimerange', formatter: Table.api.formatter.datetime },
- ]
- ],
- search: false,
- pagination: false,
- //启用普通表单搜索
- commonSearch: false,
- searchFormVisible: false,
- onLoadSuccess: function () {
- // 这里就是数据渲染结束后的回调函数
- $('.fixed-table-toolbar').hide();
- $('.btn-editone').html('编辑');
- $('.fa-pencil').remove();
- $('.btn-delone').html('删除');
- $('.fa-trash').remove();
- $('.btn-editone').removeClass('btn-success')
- $('.btn-editone').removeClass('btn')
- $('.btn-delone').removeClass('btn')
- $('.btn-delone').removeClass('btn-danger')
- }
- });
- $(document).on('click', '.show-detail', function (data) {
- var area = ['95%', '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);
- })
- // 为表格绑定事件
- Table.api.bindevent(table);
-
- var table1 = $("#table1");
- // 初始化表格
- table1.bootstrapTable({
- url: "qingdongams/workorder/workorder/index1",
- sortName: 'id',
- columns: [
- [
- { field: 'workorder_type', title: '工单类型', operate: 'like' },
- { field: 'workorder_number', title: '工单编号', operate: 'like' },
- {
- field: 'status', title: '工单状态', formatter: Table.api.formatter.status,
- searchList: { 1: '待处理', 2: '处理中', 3: '已完成', 9: "已撤销" }
- },
- {
- field: 'title', title: '任务名称', fixedColumns: true, formatter: function (value, row, index) {
- return "<a href='javascript:void(0);' data-id='" + row.id + "' class='show-workdetail'>" + value + "</a>";
- }, operate: 'like'
- },
- { field: 'createtime', title: '通知时间', operate: 'RANGE', addclass: 'datetimerange', formatter: Table.api.formatter.date },
-
-
-
- { field: 'expected_end_time', title: '完成时间', operate: 'RANGE', addclass: 'datetimerange', formatter: Table.api.formatter.datetime },
- ]
- ],
- search: false,
- pagination: false,
- //启用普通表单搜索
- commonSearch: false,
- searchFormVisible: false,
- onLoadSuccess: function () {
- // 这里就是数据渲染结束后的回调函数
- $('.fixed-table-toolbar').hide();
- $('.btn-editone').html('编辑');
- $('.fa-pencil').remove();
- $('.btn-delone').html('删除');
- $('.fa-trash').remove();
- $('.btn-editone').removeClass('btn-success')
- $('.btn-editone').removeClass('btn')
- $('.btn-delone').removeClass('btn')
- $('.btn-delone').removeClass('btn-danger')
- }
- });
- $(document).on('click', '.show-detail', function (data) {
- var area = ['95%', '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-workdetail', function (data) {
- var area = ['95%', '95%'];
- var options = {
- shadeClose : false,
- shade : [0.3, '#393D49'],
- area : area,
- callback : function (value) {
- //在回调函数里可以调用你的业务代码实现前端的各种逻辑和效果
- console.log(value);
- }
- };
- Fast.api.open("qingdongams/workorder/workorder/detail?ids=" + $(this).data('id'), '工单', options);
- })
- // 为表格绑定事件
- Table.api.bindevent(table1);
- },
- edit: function () {
- Controller.api.bindevent();
- },
- api: {
- bindevent: function () {
-
-
- Form.api.bindevent($("form[role=form]"));
- },
- formatter: {
- title: function (value, row, index) {
- value = value.toString().replace(/(&|&)nbsp;/g, ' ');
- return value;
- },
- },
- }
- };
- return Controller;
- });
|