756 lines
38 KiB
JavaScript
756 lines
38 KiB
JavaScript
define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'editable'], function ($, undefined, Backend, Table, Form, undefined) {
|
|
|
|
var Controller = {
|
|
index: function () {
|
|
// 初始化表格参数配置
|
|
Table.api.init({
|
|
extend: {
|
|
index_url: 'user4s/user/index' + location.search,
|
|
add_url: 'user4s/user/add',
|
|
edit_url: 'user4s/user/edit',
|
|
del_url: 'user4s/user/del',
|
|
multi_url: 'user4s/user/multi',
|
|
import_url: 'user4s/user/import',
|
|
sms_url: 'user4s/user/sms',
|
|
table: 'user4s_user',
|
|
}
|
|
});
|
|
|
|
var table = $("#table");
|
|
|
|
// 初始化表格
|
|
table.bootstrapTable({
|
|
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
|
pk: 'id',
|
|
sortName: 'id',
|
|
fixedColumns: true,
|
|
fixedRightNumber: 1,
|
|
showToggle: false,
|
|
columns: [
|
|
[
|
|
{ checkbox: true },
|
|
{field: 'id', title: __('会员ID'), operate:false},
|
|
{ field: 'name', title: __('Name'), operate: 'LIKE',editable:true },
|
|
{ field: 'tel', title: __('Tel'), operate: 'LIKE' ,editable:true},
|
|
{ field: 'cardid', title: __('身份证号'), operate: '=',visible:false,editable:true },
|
|
|
|
// {
|
|
// field: 'category_id', title: __('Category_id'), searchList: $.getJSON("user4s/category/searchlist"), formatter: function (value, row, index) {
|
|
// return row['category']['name'];
|
|
// }
|
|
// },
|
|
// {
|
|
// field: 'level_id', title: __('Level_id'), searchList: $.getJSON("user4s/level/searchlist"), formatter: function (value, row, index) {
|
|
// return row['level']['name'];
|
|
// }
|
|
// },
|
|
{
|
|
field: 'category.name', title: __('Category_id'), searchList: $.getJSON("user4s/category/searchlist"),
|
|
// editable: {
|
|
// type: 'select',
|
|
// autotext: true,
|
|
// inputclass: '',
|
|
// pk: 'value',
|
|
// source: "user4s/category/list"
|
|
// }
|
|
},
|
|
{ field: 'level.name', title: __('Level_id'), searchList: $.getJSON("user4s/level/searchlist") },
|
|
{ field: 'balance', title: __('Balance'), operate: false},
|
|
{ field: 'integral', title: __('Integral'), operate: false },
|
|
//{field: 'city', title: __('City'), operate: 'LIKE'},
|
|
{ field: 'buydate', title: __('Buydate'), operate: 'BETWEEN', addclass: 'datetimepicker',data: 'data-date-format="YYYY-MM-DD",data-date-use-current="true"', autocomplete: false },
|
|
{ field: 'carno', title: __('Carno'), operate: false ,editable:true},
|
|
{ field: 'frameno', title: __('车架号'), operate: 'LIKE',visible:false,editable:true},
|
|
{ field: 'model', title: __('Model'), operate: false ,editable:true},
|
|
{ field: 'color', title: __('Color'), operate: false ,editable:true},
|
|
{ field: 'inscom', title: __('保险公司'), operate: false, visible: false },
|
|
{field: 'instype', title: __('保险类型'), operate: false,visible:false},
|
|
{ field: 'insdate', title: __('Insdate'), operate: 'BETWEEN', addclass: 'datetimepicker',data: 'data-date-format="YYYY-MM-DD",data-date-use-current="true"', autocomplete: false },
|
|
//{field: 'tags', title: __('Tags'), operate: 'LIKE', formatter: Table.api.formatter.flag},
|
|
{field: 'description', title: __('Description'), operate:false},
|
|
{
|
|
field: 'admin_id', title: __('Admin_id'), operate: false,visible:false, formatter: function (value, row, index) {
|
|
return row['fuzheren'];
|
|
}
|
|
},
|
|
//{ field: 'createtime', title: __('Createtime'), operate: false, addclass: 'datetimerange', autocomplete: false, formatter: Table.api.formatter.datetime,datetimeFormat:'YYYY-MM-DD'},
|
|
//{field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
|
|
{ field: 'status', title: __('Status'), operate: false,searchList: { "0": __('Status 0'), "1": __('Status 1') }, formatter: Table.api.formatter.status },
|
|
|
|
//{ field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate },
|
|
{
|
|
field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate,
|
|
buttons: [
|
|
{
|
|
name: 'recharge',
|
|
text: __('充值消费'),
|
|
title: __('充值消费'),
|
|
classname: 'btn btn-xs btn-danger btn-dialog',
|
|
icon: 'fa fa-cny',
|
|
url: 'user4s/user/recharge',
|
|
extend: 'data-area=\'["1000px","800px"]\'',
|
|
callback: function (data) {
|
|
Layer.alert("接收到回传数据:" + JSON.stringify(data), { title: "回传数据" });
|
|
},
|
|
visible: function (row) {
|
|
//返回true时按钮显示,返回false隐藏
|
|
return true;
|
|
}
|
|
},
|
|
{
|
|
name: 'rechargelog',
|
|
text: __('消费记录'),
|
|
title: __('消费记录'),
|
|
classname: 'btn btn-xs btn-warning btn-dialog',
|
|
icon: 'fa fa-calendar-check-o',
|
|
url: 'user4s/log/index?user4s_id={id}',
|
|
extend: 'data-area=\'["1000px","800px"]\'',
|
|
},
|
|
{
|
|
name: 'visit',
|
|
text: __('回访单'),
|
|
title: function(row){
|
|
return row.name +'-的回访单'
|
|
},
|
|
classname: 'btn btn-xs btn-info btn-addtabs',
|
|
icon: 'fa fa-comments-o fa-fw',
|
|
url: 'user4s/visit/index?user4s_id={id}&status=0',
|
|
extend: 'data-area=\'["1000px","800px"]\'',
|
|
},
|
|
// {
|
|
// name: 'addtabs',
|
|
// text: __('日志'),
|
|
// title: __('订单任务日志'),
|
|
// classname: 'btn btn-xs btn-info btn-addtabs',
|
|
// icon: 'fa fa-list-ol',
|
|
// url: 'soft_log/?ids={row.id}&ref=addtabs'
|
|
// }
|
|
],
|
|
formatter: Table.api.formatter.operate
|
|
}
|
|
]
|
|
],
|
|
|
|
});
|
|
|
|
|
|
//当表格数据加载完成时
|
|
// //点击跳转
|
|
$(document).on("click", ".btn-sms", function () {
|
|
var ids = Table.api.selectedids(table);
|
|
var title = $(this).data("original-title") || $(this).attr("title");
|
|
var url = $.fn.bootstrapTable.defaults.extend.sms_url+'?ids='+ids.join(',');
|
|
var options = {
|
|
shadeclose: false,
|
|
area: $(this).data("data-area"),
|
|
title: title,
|
|
callback:function(data){
|
|
console.log(data);
|
|
|
|
}
|
|
};
|
|
//Fast.api.open(url, '发送短信');
|
|
Fast.api.open(url,title ,options);
|
|
});
|
|
// table.on('Table.api.events.operate', function (e, data) {
|
|
// //这里可以获取从服务端获取的JSON数据
|
|
// console.log(data);
|
|
// console.log(e);
|
|
// });
|
|
// 为表格绑定事件
|
|
Table.api.bindevent(table);
|
|
},
|
|
sms: function(){
|
|
Form.api.bindevent($("form[role=form]"), function (data, ret) {
|
|
console.log('OK', data);
|
|
if (data.success == data.total) {
|
|
Fast.api.close(data);//这里是重点
|
|
return true;
|
|
} else {
|
|
$("#sms_status").html('');
|
|
data.status.forEach((item, index, arr) => {
|
|
var html = $("#sms_status").html();
|
|
if (item.code == 0) {
|
|
html = html + '<span class="label label-warning" style="margin-right: 0.2em;">'+item.name+'('+item.msg+')</span>';
|
|
} else {
|
|
html = html + '<span class="label label-info" style="margin-right: 0.2em;">' + item.name + '(' + item.msg + ')</span>';
|
|
}
|
|
|
|
$("#sms_status").html(html);
|
|
return false;
|
|
})
|
|
}
|
|
}, function (data, ret) {
|
|
console.log('error',data);
|
|
Fast.api.close(data);
|
|
});
|
|
},
|
|
recyclebin: function () {
|
|
// 初始化表格参数配置
|
|
Table.api.init({
|
|
extend: {
|
|
'dragsort_url': ''
|
|
}
|
|
});
|
|
|
|
var table = $("#table");
|
|
|
|
// 初始化表格
|
|
table.bootstrapTable({
|
|
url: 'user4s/user/recyclebin' + location.search,
|
|
pk: 'id',
|
|
sortName: 'id',
|
|
columns: [
|
|
[
|
|
{ checkbox: true },
|
|
{ field: 'id', title: __('Id') },
|
|
{ field: 'name', title: __('Name'), align: 'left' },
|
|
{
|
|
field: 'deletetime',
|
|
title: __('Deletetime'),
|
|
operate: 'RANGE',
|
|
addclass: 'datetimerange',
|
|
formatter: Table.api.formatter.datetime
|
|
},
|
|
{
|
|
field: 'operate',
|
|
width: '130px',
|
|
title: __('Operate'),
|
|
table: table,
|
|
events: Table.api.events.operate,
|
|
buttons: [
|
|
{
|
|
name: 'Restore',
|
|
text: __('Restore'),
|
|
classname: 'btn btn-xs btn-info btn-ajax btn-restoreit',
|
|
icon: 'fa fa-rotate-left',
|
|
url: 'user4s/user/restore',
|
|
refresh: true
|
|
},
|
|
{
|
|
name: 'Destroy',
|
|
text: __('Destroy'),
|
|
classname: 'btn btn-xs btn-danger btn-ajax btn-destroyit',
|
|
icon: 'fa fa-times',
|
|
url: 'user4s/user/destroy',
|
|
refresh: true
|
|
}
|
|
],
|
|
formatter: Table.api.formatter.operate
|
|
}
|
|
]
|
|
]
|
|
});
|
|
|
|
// 为表格绑定事件
|
|
Table.api.bindevent(table);
|
|
},
|
|
add: function () {
|
|
$('#c-balance').on('change', function () {
|
|
var balance = $(this).val();
|
|
$.ajax({
|
|
url: "user4s/level/calculate",
|
|
type: "POST", //Use "PUT" for HTTP PUT methods
|
|
dataType: 'json',
|
|
data: {
|
|
balance: balance,
|
|
},
|
|
success: function (data, textStatus, jqXHR) {
|
|
console.log(data);
|
|
if (data.code == 1) {
|
|
if (data.data.integral > 0) {
|
|
$('#c-integral').val(data.data.integral);
|
|
}
|
|
if (data.data.level_id > 0) {
|
|
$('#c-level_id').val(data.data.level_id);
|
|
$('#c-level_id').selectPageRefresh();
|
|
}
|
|
}
|
|
},
|
|
})
|
|
|
|
});
|
|
Controller.api.bindevent();
|
|
},
|
|
edit: function () {
|
|
Controller.api.bindevent();
|
|
},
|
|
recharge: function () {
|
|
$('#c-balance').on('change', function () {
|
|
var start = $('#start-balance').val();
|
|
var balance = $(this).val();
|
|
if (parseFloat(balance) > 0) {
|
|
$('#c-description').val("系统后台充值余额" + balance + "元");
|
|
}
|
|
if (parseFloat(balance) < 0) {
|
|
$('#c-description').val("系统后台手动扣除余额" + balance + "元");
|
|
}
|
|
$.ajax({
|
|
url: "user4s/level/calculate",
|
|
type: "POST", //Use "PUT" for HTTP PUT methods
|
|
dataType: 'json',
|
|
data: {
|
|
start:parseFloat(start),
|
|
balance: parseFloat(balance),
|
|
},
|
|
success: function (data, textStatus, jqXHR) {
|
|
console.log(data);
|
|
if (data.code == 1) {
|
|
if (data.data.integral > -1) {
|
|
$('#c-integral').val(data.data.integral);
|
|
}
|
|
if (data.data.level_id > 0) {
|
|
$('#c-level_id').val(data.data.level_id);
|
|
$('#c-level_id').selectPageRefresh();
|
|
}
|
|
}
|
|
},
|
|
})
|
|
|
|
});
|
|
Controller.api.bindevent();
|
|
},
|
|
expireins: function () {
|
|
// 初始化表格参数配置
|
|
Table.api.init({
|
|
extend: {
|
|
index_url: 'user4s/user/expireins' + location.search,
|
|
sms_url: 'user4s/user/sms',
|
|
table: 'user4s_user',
|
|
}
|
|
});
|
|
|
|
var table = $("#table");
|
|
//当表格数据加载完成时
|
|
table.on('load-success.bs.table', function (e, data) {
|
|
//这里可以获取从服务端获取的JSON数据
|
|
console.log(data);
|
|
//这里我们手动设置底部的值
|
|
$("#start_date").val(data.extend.start_date);
|
|
$("#end_date").val(data.extend.end_date);
|
|
});
|
|
require(['bootstrap-datetimepicker'], function () {
|
|
var options = {
|
|
format: 'MM-DD',
|
|
icons: {
|
|
time: 'fa fa-clock-o',
|
|
date: 'fa fa-calendar',
|
|
up: 'fa fa-chevron-up',
|
|
down: 'fa fa-chevron-down',
|
|
previous: 'fa fa-chevron-left',
|
|
next: 'fa fa-chevron-right',
|
|
today: 'fa fa-history',
|
|
clear: 'fa fa-trash',
|
|
close: 'fa fa-remove'
|
|
},
|
|
showTodayButton: true,
|
|
showClose: true
|
|
};
|
|
var dchage = function (e) {
|
|
var start_date = $("#start_date").val();
|
|
var end_date = $("#end_date").val();
|
|
table.bootstrapTable('refresh', { query: { start_date: start_date, end_date: end_date } });
|
|
};
|
|
$('#start_date').parent().css('position', 'relative');
|
|
$("#start_date").datetimepicker(options).on('dp.change', function (e) {
|
|
var start_date = $("#start_date").val();
|
|
var end_date = $("#end_date").val();
|
|
table.bootstrapTable('refresh', { query: { start_date: start_date,end_date:end_date } });
|
|
});
|
|
$('#end_date').parent().css('position', 'relative');
|
|
$("#end_date").datetimepicker(options).on('dp.change', function (e) {
|
|
var start_date = $("#start_date").val();
|
|
var end_date = $("#end_date").val();
|
|
table.bootstrapTable('refresh', { query: { start_date: start_date,end_date:end_date } });
|
|
});
|
|
});
|
|
// 初始化表格
|
|
table.bootstrapTable({
|
|
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
|
pk: 'id',
|
|
sortName: 'id',
|
|
fixedColumns: true,
|
|
fixedRightNumber: 1,
|
|
showToggle: false,
|
|
//maintainSelected: true,
|
|
columns: [
|
|
[
|
|
{ checkbox: true },
|
|
//{field: 'id', title: __('Id'), operate:false},
|
|
{ field: 'name', title: __('Name'), operate: 'LIKE' },
|
|
{ field: 'tel', title: __('Tel'), operate: 'LIKE' },
|
|
//{ field: 'balance', title: __('Balance'), operate: false},
|
|
//{ field: 'integral', title: __('Integral'), operate: false },
|
|
{ field: 'buydate', title: __('Buydate'), operate: false},
|
|
{ field: 'carno', title: __('Carno'), operate: 'LIKE' },
|
|
{ field: 'frameno', title: __('车架号'), operate: 'LIKE' },
|
|
{ field: 'model', title: __('Model'), operate: false },
|
|
{ field: 'color', title: __('Color'), operate: false },
|
|
|
|
{ field: 'inscom', title: __('Inscom'), operate: 'LIKE' },
|
|
{field: 'instype', title: __('Instype'), operate: 'LIKE'},
|
|
{ field: 'insdate', title: __('Insdate'), operate: false, addclass: 'datetimepicker',data: 'data-date-format="YYYY-MM-DD",data-date-use-current="true"', autocomplete: false },
|
|
// {
|
|
// field: 'admin_id', title: __('Admin_id'), operate: false, formatter: function (value, row, index) {
|
|
// return row['fuzheren'];
|
|
// }
|
|
// },
|
|
{
|
|
field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate,
|
|
buttons: [
|
|
{
|
|
name: 'instip',
|
|
text: __('提醒'),
|
|
title: __('提醒'),
|
|
classname: 'btn btn-xs btn-success btn-ajax',
|
|
icon: 'fa fa-bell-o',
|
|
url: 'user4s/user/instip?ids={ids}',
|
|
confirm:"确认本次续保时间内已提醒过用户了吗?",
|
|
extend: 'data-area=\'["1000px","800px"]\'',
|
|
success: function (data,ret) {
|
|
//Layer.alert(ret.msg, { title: "保险临期提醒" });
|
|
table.bootstrapTable('refresh');
|
|
},
|
|
error: function (data, ret) {
|
|
console.log(data, ret);
|
|
Layer.alert(ret.msg);
|
|
return false;
|
|
},
|
|
visible: function (row) {
|
|
if (row.instip == 0) {
|
|
return true;
|
|
} else {
|
|
return false;
|
|
}
|
|
}
|
|
},
|
|
{
|
|
name: 'instip',
|
|
text: __('取消提醒'),
|
|
title: __('取消提醒'),
|
|
classname: 'btn btn-xs btn-success btn-ajax',
|
|
icon: 'fa fa-bell-slash-o',
|
|
url: 'user4s/user/instipno?ids={ids}',
|
|
confirm:"取消本次续保时间内的提醒状态吗?",
|
|
extend: 'data-area=\'["1000px","800px"]\'',
|
|
success: function (data,ret) {
|
|
//Layer.alert(ret.msg, { title: "保险临期提醒" });
|
|
table.bootstrapTable('refresh');
|
|
},
|
|
error: function (data, ret) {
|
|
console.log(data, ret);
|
|
Layer.alert(ret.msg);
|
|
return false;
|
|
},
|
|
visible: function (row) {
|
|
if (row.instip == 0) {
|
|
return false;
|
|
} else {
|
|
return true;
|
|
}
|
|
}
|
|
},
|
|
{
|
|
name: 'renewal',
|
|
text: __('续保'),
|
|
title: __('续保'),
|
|
classname: 'btn btn-xs btn-danger btn-dialog',
|
|
icon: 'fa fa-dashboard',
|
|
url: 'user4s/user/renewal',
|
|
extend: 'data-area=\'["1000px","800px"]\'',
|
|
callback: function (data) {
|
|
Layer.alert("接收到回传数据:" + JSON.stringify(data), { title: "回传数据" });
|
|
},
|
|
visible: function (row) {
|
|
//返回true时按钮显示,返回false隐藏
|
|
return true;
|
|
}
|
|
},
|
|
{
|
|
name: 'inslog',
|
|
text: __('续保记录'),
|
|
title: __('续保记录'),
|
|
classname: 'btn btn-xs btn-warning btn-dialog',
|
|
icon: 'fa fa-calendar-check-o',
|
|
url: 'user4s/inslog/index?user4s_id={id}',
|
|
extend: 'data-area=\'["1000px","800px"]\'',
|
|
},
|
|
],
|
|
formatter: Table.api.formatter.operate
|
|
}
|
|
]
|
|
],
|
|
|
|
});
|
|
$(document).on("click", ".btn-sms", function () {
|
|
var ids = Table.api.selectedids(table);
|
|
var title = $(this).data("original-title") || $(this).attr("title");
|
|
var url = $.fn.bootstrapTable.defaults.extend.sms_url+'?ids='+ids.join(',');
|
|
var options = {
|
|
shadeclose: false,
|
|
area: $(this).data("data-area"),
|
|
title: title,
|
|
callback:function(data){
|
|
console.log(data);
|
|
|
|
}
|
|
};
|
|
//Fast.api.open(url, '发送短信');
|
|
Fast.api.open(url,title ,options);
|
|
});
|
|
// 为表格绑定事件
|
|
Table.api.bindevent(table);
|
|
},
|
|
renewal: function () {
|
|
Controller.api.bindevent();
|
|
},
|
|
birthday: function () {
|
|
// 初始化表格参数配置
|
|
Table.api.init({
|
|
extend: {
|
|
index_url: 'user4s/user/birthday' + location.search,
|
|
sms_url: 'user4s/user/sms',
|
|
table: 'user4s_user',
|
|
}
|
|
});
|
|
|
|
var table = $("#table");
|
|
//当表格数据加载完成时
|
|
table.on('load-success.bs.table', function (e, data) {
|
|
//这里可以获取从服务端获取的JSON数据
|
|
console.log(data);
|
|
//这里我们手动设置底部的值
|
|
$("#start_date").text(data.extend.start_date);
|
|
$("#m-birthday").val(data.extend.start_date);
|
|
//$("#birthday").datetimepicker();
|
|
require(['bootstrap-datetimepicker'], function () {
|
|
var options = {
|
|
format: 'YYYY-MM-DD HH:mm:ss',
|
|
icons: {
|
|
time: 'fa fa-clock-o',
|
|
date: 'fa fa-calendar',
|
|
up: 'fa fa-chevron-up',
|
|
down: 'fa fa-chevron-down',
|
|
previous: 'fa fa-chevron-left',
|
|
next: 'fa fa-chevron-right',
|
|
today: 'fa fa-history',
|
|
clear: 'fa fa-trash',
|
|
close: 'fa fa-remove'
|
|
},
|
|
showTodayButton: true,
|
|
showClose: true
|
|
};
|
|
$('#m-birthday').parent().css('position', 'relative');
|
|
$("#m-birthday").datetimepicker(options).on('dp.change', function (e) {
|
|
var birthday = $("#m-birthday").val();
|
|
//console.log(e);
|
|
//console.log(birthday);
|
|
table.bootstrapTable('refresh', {query: {birthday: birthday}});
|
|
//$(this, document).trigger("changed");
|
|
|
|
});
|
|
// $('.search',$("form[role=form]")).parent().css('position', 'relative');
|
|
// $('.search',$("form[role=form]")).datetimepicker(options);
|
|
});
|
|
|
|
});
|
|
// 初始化表格
|
|
table.bootstrapTable({
|
|
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
|
pk: 'id',
|
|
sortName: 'id',
|
|
fixedColumns: true,
|
|
fixedRightNumber: 1,
|
|
showToggle: false,
|
|
// searchFormVisible: true,
|
|
// searchFormTemplate: 'customformtpl',
|
|
maintainSelected: true,
|
|
columns: [
|
|
[
|
|
{ checkbox: true },
|
|
//{field: 'id', title: __('Id'), operate:false},
|
|
{ field: 'name', title: __('Name'), operate: 'LIKE' },
|
|
{ field: 'tel', title: __('Tel'), operate: 'LIKE' },
|
|
{ field: 'birthday', title: __('生日'), operate: false, addclass: 'datetimepicker',data: 'data-date-format="MM-DD",data-date-use-current="true"', autocomplete: false},
|
|
{ field: 'cardid', title: __('Cardid'), operate: 'LIKE' },
|
|
{ field: 'buydate', title: __('Buydate'), operate: false},
|
|
{ field: 'carno', title: __('Carno'), operate: 'LIKE' },
|
|
{ field: 'model', title: __('Model'), operate: false },
|
|
{ field: 'color', title: __('Color'), operate: false },
|
|
|
|
{ field: 'inscom', title: __('Inscom'), operate: false },
|
|
{field: 'instype', title: __('Instype'), operate: false},
|
|
{ field: 'insdate', title: __('Insdate'), operate: false, addclass: 'datetimepicker',data: 'data-date-format="YYYY-MM-DD",data-date-use-current="true"', autocomplete: false },
|
|
{
|
|
field: 'admin_id', title: __('Admin_id'), operate: false, formatter: function (value, row, index) {
|
|
return row['fuzheren'];
|
|
}
|
|
},
|
|
// {
|
|
// field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate,
|
|
// buttons: [
|
|
// {
|
|
// name: 'renewal',
|
|
// text: __('续保'),
|
|
// title: __('续保'),
|
|
// classname: 'btn btn-xs btn-danger btn-dialog',
|
|
// icon: 'fa fa-dashboard',
|
|
// url: 'user4s/user/renewal',
|
|
// extend: 'data-area=\'["1000px","800px"]\'',
|
|
// callback: function (data) {
|
|
// Layer.alert("接收到回传数据:" + JSON.stringify(data), { title: "回传数据" });
|
|
// },
|
|
// visible: function (row) {
|
|
// //返回true时按钮显示,返回false隐藏
|
|
// return true;
|
|
// }
|
|
// },
|
|
// {
|
|
// name: 'inslog',
|
|
// text: __('续保记录'),
|
|
// title: __('续保记录'),
|
|
// classname: 'btn btn-xs btn-warning btn-dialog',
|
|
// icon: 'fa fa-calendar-check-o',
|
|
// url: 'user4s/inslog/index?user4s_id={id}',
|
|
// extend: 'data-area=\'["1000px","800px"]\'',
|
|
// },
|
|
// ],
|
|
// formatter: Table.api.formatter.operate
|
|
// }
|
|
]
|
|
],
|
|
|
|
});
|
|
$(document).on("click", ".btn-sms", function () {
|
|
var ids = Table.api.selectedids(table);
|
|
var title = $(this).data("original-title") || $(this).attr("title");
|
|
var url = $.fn.bootstrapTable.defaults.extend.sms_url+'?ids='+ids.join(',');
|
|
var options = {
|
|
shadeclose: false,
|
|
area: $(this).data("data-area"),
|
|
title: title,
|
|
callback:function(data){
|
|
console.log(data);
|
|
|
|
}
|
|
};
|
|
//Fast.api.open(url, '发送短信');
|
|
Fast.api.open(url,title ,options);
|
|
});
|
|
// 为表格绑定事件
|
|
Table.api.bindevent(table);
|
|
},
|
|
excel: function() {
|
|
function reset() {
|
|
$("#step").val(0);
|
|
$("#import").addClass("disabled");
|
|
if ($("#c-row").val() && $("#selecthead_type select").val() && $("#selectable select").val() && $("#c-rowpath").val()) {
|
|
Toastr.success('开始预览结果');
|
|
// $("#submit").trigger("click");
|
|
|
|
Fast.api.ajax({
|
|
url: 'import/log/preview',
|
|
data: $("form[role=form]").serialize(),
|
|
dataType: 'json',
|
|
}, function(data) {
|
|
console.log(data)
|
|
let columns = data.field
|
|
let xlsdata = data.data
|
|
let tableField = data.fieldArr
|
|
var select = ""
|
|
if (xlsdata.length) {
|
|
$("#step").val(1);
|
|
$("#import").removeClass("disabled");
|
|
// Toastr.success("与狼");
|
|
}
|
|
$.each(tableField, function(i, item) {
|
|
select += "<option class=>" + i + "</option>"
|
|
});
|
|
html = "<tr>"
|
|
$.each(columns, function(i, item) {
|
|
html += "<th class=" + item.class + ">" + item.field + "</th>"
|
|
|
|
});
|
|
html += "</tr>"
|
|
html += "<tr>"
|
|
$.each(columns, function(i, item) {
|
|
if (item.class != "success") html += "<td><select id=setop class='form-control' name=row[set][" + i + "]><option class=>请选择</option>" + select + "</select></td>"
|
|
else html += "<td class=success></td>"
|
|
});
|
|
html += "</tr>"
|
|
$.each(xlsdata, function(i, item) {
|
|
html += "<tr>"
|
|
$.each(columns, function(i, f) {
|
|
html += "<td class=" + f.class + ">" + item[f.field] + "</td>"
|
|
|
|
});
|
|
|
|
html += "</tr>"
|
|
|
|
});
|
|
|
|
$("#tableset").html(html)
|
|
}, function() {
|
|
return false;
|
|
});
|
|
}
|
|
}
|
|
|
|
$("#selectable select").on("change", function() {
|
|
$("#c-newtable").val('')
|
|
reset()
|
|
})
|
|
$("#c-newtable").on("change", function() {
|
|
$("#selectable select").val("");
|
|
reset()
|
|
})
|
|
$("#c-row").on("change", function() {
|
|
reset()
|
|
})
|
|
$("#c-rowpath").on("change", function() {
|
|
reset()
|
|
})
|
|
$("#selecthead_type select").on("change", function() {
|
|
reset()
|
|
})
|
|
$("#import").on("click", function() {
|
|
$("#submit").trigger("click");
|
|
})
|
|
Controller.api.bindevent();
|
|
},
|
|
api: {
|
|
bindevent: function (table) {
|
|
Form.api.bindevent($("form[role=form]"));
|
|
},
|
|
// events: {
|
|
// operate: {
|
|
// '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(
|
|
// __('22222222222222222?'),
|
|
// {icon: 3, title: __('Warning'), offset: [top, left], shadeClose: true, btn: [__('OK'), __('Cancel')]},
|
|
// function (index) {
|
|
// var table = $(that).closest('table');
|
|
// var options = table.bootstrapTable('getOptions');
|
|
// Table.api.multi("del", row[options.pk], table, that);
|
|
// Layer.close(index);
|
|
// }
|
|
// );
|
|
// }
|
|
// }
|
|
// }
|
|
}
|
|
};
|
|
return Controller;
|
|
});
|