|
@@ -9,6 +9,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'selectpage'], functi
|
|
|
add_url: 'intention/add',
|
|
|
edit_url: 'intention/edit',
|
|
|
del_url: 'intention/del',
|
|
|
+ follow_url: 'intention/follow',
|
|
|
multi_url: 'intention/multi',
|
|
|
table: 'intention',
|
|
|
}
|
|
@@ -32,9 +33,10 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'selectpage'], functi
|
|
|
return row.usr_depart;
|
|
|
}},
|
|
|
{field: 'created_at', title: '创建时间', operate:'RANGE', addclass:'datetimerange', searchable: false},
|
|
|
- {field: 'operate', title: __('Operate'),
|
|
|
- table: table, events: Table.api.events.operate,
|
|
|
- formatter: Table.api.formatter.operate,
|
|
|
+ {field: 'operate', title: __('Operate'),searchable: false,
|
|
|
+ table: table,
|
|
|
+ events: Controller.api.events.operate,
|
|
|
+ formatter: Controller.api.formatter.operate
|
|
|
}
|
|
|
]
|
|
|
]
|
|
@@ -62,9 +64,139 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'selectpage'], functi
|
|
|
edit: function () {
|
|
|
Controller.api.bindevent();
|
|
|
},
|
|
|
+ follow: function () {
|
|
|
+ Controller.api.bindevent();
|
|
|
+ },
|
|
|
api: {
|
|
|
bindevent: function () {
|
|
|
Form.api.bindevent($("form[role=form]"));
|
|
|
+ },
|
|
|
+ formatter:{
|
|
|
+ operate: function (value, row, index) {
|
|
|
+ var table = this.table;
|
|
|
+ // 操作配置
|
|
|
+ var options = table ? table.bootstrapTable('getOptions') : {};
|
|
|
+ // 默认按钮组
|
|
|
+ var buttons = $.extend([], this.buttons || []);
|
|
|
+ switch (row.status){
|
|
|
+ case 0: //保护中
|
|
|
+ buttons.push({text: '放弃', classname: 'btn btn-xs btn-danger btn-giveup'});
|
|
|
+ buttons.push({text:'跟进', classname: 'btn btn-xs btn-info btn-follow'});
|
|
|
+ buttons.push({text:'修改', classname: 'btn btn-xs btn-primary btn-editone'});
|
|
|
+ buttons.push({text:'详情', classname: 'btn btn-xs btn-warning btn-detail'});
|
|
|
+ buttons.push({
|
|
|
+ name: 'del',
|
|
|
+ icon: 'fa fa-trash',
|
|
|
+ title: __('Del'),
|
|
|
+ extend: 'data-toggle="tooltip"',
|
|
|
+ classname: 'btn btn-xs btn-danger btn-delone'
|
|
|
+ });
|
|
|
+ break;
|
|
|
+ case 1:
|
|
|
+ buttons.push({text:'详情', classname: 'btn btn-xs btn-warning btn-detail'});
|
|
|
+ break;
|
|
|
+ case 2:
|
|
|
+ buttons.push({text:'修改', classname: 'btn btn-xs btn-primary btn-editone'});
|
|
|
+ buttons.push({text:'详情', classname: 'btn btn-xs btn-warning btn-detail'});
|
|
|
+ break;
|
|
|
+ case 4:
|
|
|
+ buttons.push({text:'详情', classname: 'btn btn-xs btn-warning btn-detail'});
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
+ return Table.api.buttonlink(this, buttons, value, row, index, 'operate');
|
|
|
+ },
|
|
|
+
|
|
|
+ },
|
|
|
+ events:{
|
|
|
+ operate: {
|
|
|
+ // 放弃
|
|
|
+ 'click .btn-giveup': function(e, value, row) {
|
|
|
+ Layer.confirm('您确定放弃吗?',function (index) {
|
|
|
+ var id = row.id;
|
|
|
+ $.ajax({
|
|
|
+ url: 'intention/giveup',
|
|
|
+ type: 'post',
|
|
|
+ data: { id:id },
|
|
|
+ dataType: 'json',
|
|
|
+ success: function success(res) {
|
|
|
+ Layer.close(index);
|
|
|
+ if(res.code == 1){
|
|
|
+ Toastr.success(res.msg);
|
|
|
+ $('.btn-refresh').click();
|
|
|
+ } else {
|
|
|
+ Toastr.error(res.msg);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ });
|
|
|
+ },
|
|
|
+ // 跟进
|
|
|
+ 'click .btn-follow': function (e, value, row) {
|
|
|
+ e.stopPropagation();
|
|
|
+ e.preventDefault();
|
|
|
+ var options = $(this).closest('table').bootstrapTable('getOptions');
|
|
|
+ var open = Fast.api.open(options.extend.follow_url + (options.extend.follow_url.match(/(\?|&)+/) ? "&ids=" : "/ids/") + row[options.pk], __('Follow'), {
|
|
|
+ title: '跟进',
|
|
|
+ maxmin: false
|
|
|
+ });
|
|
|
+ },
|
|
|
+ // 修改
|
|
|
+ 'click .btn-editone': function clickBtnEditone(e, value, row, index) {
|
|
|
+ e.stopPropagation();
|
|
|
+ e.preventDefault();
|
|
|
+ var options = $(this).closest('table').bootstrapTable('getOptions');
|
|
|
+ var open = Fast.api.open(options.extend.edit_url + (options.extend.edit_url.match(/(\?|&)+/) ? "&ids=" : "/ids/") + row[options.pk], __('Edit'), {
|
|
|
+ title: '修改',
|
|
|
+ maxmin: false
|
|
|
+ });
|
|
|
+ },
|
|
|
+
|
|
|
+ 'click .btn-detail': function clickBtnEditone(e, value, row, index) {
|
|
|
+ var html = '<table class="table table-striped table-bordered table-hover">';
|
|
|
+ html += '<tr><td>公司名称</td><td>'+ row.unit_name +'</td></tr>';
|
|
|
+ html += '<tr><td>联系人</td><td>'+ row.contacts +'</td></tr>';
|
|
|
+ html += '<tr><td>手机</td><td>'+ row.phone +'</td></tr>';
|
|
|
+ html += '<tr><td>固定电话</td><td>'+ row.fixed_phone +'</td></tr>';
|
|
|
+ html += '<tr><td>地址</td><td>'+ row.address +'</td></tr>';
|
|
|
+ html += '<tr><td>联系人职位</td><td>'+ row.con_position +'</td></tr>';
|
|
|
+ html += '<tr><td>单位性质</td><td>'+ row.unit_type +'</td></tr>';
|
|
|
+ html += '<tr><td>人数</td><td>'+ row.number +'</td></tr>';
|
|
|
+ html += '<tr><td>单价</td><td>'+ row.price +'</td></tr>';
|
|
|
+ html += '<tr><td>备注</td><td>'+ row.remark +'</td></tr>';
|
|
|
+ html += '<tr><td>操作人</td><td>'+ row.usr_nickname +'</td></tr>';
|
|
|
+ html += '<tr><td>操作人部门</td><td>'+ row.usr_depart +'</td></tr>';
|
|
|
+ html += '</table>';
|
|
|
+ Layer.open({
|
|
|
+ content : html,
|
|
|
+ area : ['500px'],
|
|
|
+ })
|
|
|
+ },
|
|
|
+
|
|
|
+ 'click .btn-delone': function (e, value, row, index) {
|
|
|
+ e.stopPropagation();
|
|
|
+ e.preventDefault();
|
|
|
+ var that = this;
|
|
|
+ var top = $(that).offset().top - $(window).scrollTop();
|
|
|
+ var left = $(that).offset().left - $(window).scrollLeft() - 260;
|
|
|
+ if (top + 154 > $(window).height()) {
|
|
|
+ top = top - 154;
|
|
|
+ }
|
|
|
+ if ($(window).width() < 480) {
|
|
|
+ top = left = undefined;
|
|
|
+ }
|
|
|
+ Layer.confirm(
|
|
|
+ __('Are you sure you want to delete this item?'),
|
|
|
+ {icon: 3, title: __('Warning'), offset: [top, left], shadeClose: true},
|
|
|
+ function (index) {
|
|
|
+ var table = $(that).closest('table');
|
|
|
+ var options = table.bootstrapTable('getOptions');
|
|
|
+ Table.api.multi("del", row[options.pk], table, that);
|
|
|
+ Layer.close(index);
|
|
|
+ }
|
|
|
+ );
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
};
|