/**
|
* 行程录音管理管理初始化
|
*/
|
var TOrderTape = {
|
id: "TOrderTapeTable", //表格id
|
seItem: null, //选中的条目
|
table: null,
|
layerIndex: -1
|
};
|
|
/**
|
* 初始化表格的列
|
*/
|
TOrderTape.initColumn = function () {
|
return [
|
{field: 'selectItem', radio: false},
|
{title: '主键id', field: 'id', visible: false, align: 'center', valign: 'middle'},
|
{title: '添加时间', field: 'insertTime', visible: true, align: 'center', valign: 'middle',width:'10%',
|
formatter: function (value, row) {
|
var btn = "";
|
if(row.insertTime != '' && row.insertTime != null) {
|
var time = row.insertTime.replace(" ",'<br>');
|
btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="' + row.insertTime + '" onfocus="TUser.tooltip()">' + time + '</p>']
|
}
|
return btn;
|
}
|
},
|
{title: '过期时间', field: 'afterTime', visible: true, align: 'center', valign: 'middle',
|
formatter: function (value, row) {
|
var btn = "";
|
if(row.afterTime != '' && row.afterTime != null) {
|
var time = row.afterTime.replace(" ",'<br>');
|
btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="' + row.afterTime + '" onfocus="TUser.tooltip()">' + time + '</p>']
|
}
|
return btn;
|
}
|
},
|
{title: '文件名', field: 'fileName', visible: true, align: 'center', valign: 'middle',width:'10%',
|
formatter: function (value, row) {
|
var btn = "";
|
if(row.fileName != '' && row.fileName != null) {
|
btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="' + row.fileName + '" onfocus="TUser.tooltip()">' + row.fileName + '</p>']
|
}
|
return btn;
|
}
|
},
|
{title: '文件格式', field: 'fileFormat', visible: false, align: 'center', valign: 'middle'},
|
{title: '文件大小', field: 'fileSize', visible: true, align: 'center', valign: 'middle',
|
formatter: function (value, row) {
|
var btn = "";
|
if(row.fileSize != '' && row.fileSize != null) {
|
btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="' + row.fileSize + '" onfocus="TUser.tooltip()">' + row.fileSize + "mb" + '</p>']
|
}
|
return btn;
|
}
|
},
|
{title: '关联订单', field: 'orderNum', visible: true, align: 'center', valign: 'middle',width:'10%',
|
formatter: function (value, row) {
|
var btn = "";
|
if(row.orderNum != '' && row.orderNum != null) {
|
btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="' + row.orderNum + '" onfocus="TUser.tooltip()">' + row.orderNum + '</p>']
|
}
|
return btn;
|
}
|
},
|
{title: '状态', field: 'state', visible: true, align: 'center', valign: 'middle',width:'10%',
|
formatter: function (value, row) {
|
var btn = "";
|
if(row.state != '' && row.state != null) {
|
if(row.state == 1){
|
btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="' + row.state + '" onfocus="TUser.tooltip()"> 未过期 </p>']
|
}else {
|
btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;color: red" title="' + row.state + '" onfocus="TUser.tooltip()"> 已过期 </p>']
|
}
|
}
|
return btn;
|
}
|
},
|
{title: '操作', visible: true, align: 'center', valign: 'middle',width:'16%',
|
formatter: function (value, row) {
|
if(row.state == 1) {
|
return '<a href="#" onclick="TOrderTape.orderDetail('+row.orderId+','+row.orderType+')" style="color:cornflowerblue">查看订单</a>' +' ' +
|
'<a href="#" onclick="TOrderTape.playAudio('+row.id+')" style="color:cornflowerblue">播放录音</a>' +' ' +
|
'<a href="#" onclick="TOrderTape.delete('+row.id+')" style="color:cornflowerblue">删除</a>'
|
}else {
|
return '<a href="#" onclick="TOrderTape.orderDetail('+row.orderId+','+row.orderType+')" style="color:cornflowerblue">查看订单</a>' +' ' +
|
'<a href="#" onclick="TOrderTape.delete('+row.id+')" style="color:cornflowerblue">删除</a>'
|
}
|
}
|
}
|
];
|
};
|
|
/**
|
* 检查是否选中
|
*/
|
TOrderTape.check = function () {
|
var selected = $('#' + this.id).bootstrapTable('getSelections');
|
if(selected.length == 0){
|
Feng.info("请先选中表格中的某一记录!");
|
return false;
|
}else{
|
TOrderTape.seItem = selected[0];
|
return true;
|
}
|
};
|
|
TOrderTape.playAudio = function (id) {
|
var ajax = new $ax(Feng.ctxPath + "/tOrderTape/getDetailById", function (data) {
|
console.log(data.data)
|
var audio = document.getElementById('recording');
|
audio.setAttribute("src", data.data.fileLink);
|
if (audio.paused) {
|
audio.play(); // 播放录音
|
} else {
|
audio.pause(); // 如果正在播放,则暂停
|
}
|
}, function (data) {
|
console.log(data);
|
});
|
ajax.set("tOrderTapeId", id);
|
ajax.start();
|
};
|
|
/**
|
* 打开查看订单详情
|
*/
|
TOrderTape.orderDetail = function (id,orderType) {
|
if(orderType == 1){
|
console.log("专车订单详情");
|
var index = layer.open({
|
type: 2,
|
title: '专车订单详情',
|
area: ['100%', '100%'], //宽高
|
fix: false, //不固定
|
maxmin: true,
|
content: Feng.ctxPath + '/tOrderPrivateCar/tOrderPrivateCar_orderDetail/' + id
|
});
|
this.layerIndex = index;
|
}else if(orderType == 3){
|
console.log("跨城出行订单详情");
|
var index = layer.open({
|
type: 2,
|
title: '跨城出行订单详情',
|
area: ['100%', '100%'], //宽高
|
fix: false, //不固定
|
maxmin: true,
|
content: Feng.ctxPath + '/tOrderCrossCity/tOrderCrossCity_detail/' + id
|
});
|
this.layerIndex = index;
|
}else {
|
console.log("接送机订单详情");
|
var index = layer.open({
|
type: 2,
|
title: '接送机订单详情',
|
area: ['100%', '100%'], //宽高
|
fix: false, //不固定
|
maxmin: true,
|
content: Feng.ctxPath + '/tOrderTransfer/tOrderTransfer_orderDetail/' + id
|
});
|
this.layerIndex = index;
|
}
|
};
|
|
/**
|
* 删除行程录音管理
|
*/
|
TOrderTape.delete = function (id, nickname) {
|
if (nickname == "" || nickname == null || nickname == undefined){
|
nickname = "该录音";
|
}else{
|
nickname = "【"+nickname+"】";
|
}
|
swal({
|
title: "您是否确认删除"+ nickname + "?",
|
text: "请谨慎操作,删除后数据无法恢复!",
|
type: "warning",
|
showCancelButton: true,
|
confirmButtonColor: "#DD6B55",
|
confirmButtonText: "删除",
|
closeOnConfirm: true
|
}, function () {
|
var ajax = new $ax(Feng.ctxPath + "/tOrderTape/delete", function (data) {
|
swal("删除成功", "您已经删除了" + nickname + "。", "success");
|
TOrderTape.table.refresh();
|
}, function (data) {
|
swal("删除失败", data.responseJSON.message + "!", "warning");
|
});
|
ajax.set("tOrderTapeId", id);
|
ajax.start();
|
});
|
};
|
|
/**
|
* 批量删除行程录音管理
|
*/
|
TOrderTape.deleteBatch = function () {
|
var selected = $('#' + this.id).bootstrapTable('getSelections');
|
var ids = '';
|
if (selected.length > 0) {
|
for (var i = 0; i < selected.length; i++) {
|
ids += selected[i]['id'] + ",";
|
}
|
ids = ids.substring(0, ids.length - 1);
|
}
|
console.log(ids);
|
if(this.check()){
|
var nickname = TOrderTape.seItem.name;
|
if (nickname == "" || nickname == null || nickname == undefined){
|
nickname = "该录音";
|
}else{
|
nickname = "【"+nickname+"】";
|
}
|
swal({
|
title: "您是否确认删除"+ nickname + "?",
|
text: "请谨慎操作,删除后数据无法恢复!",
|
type: "warning",
|
showCancelButton: true,
|
confirmButtonColor: "#DD6B55",
|
confirmButtonText: "删除",
|
closeOnConfirm: true
|
}, function () {
|
var ajax = new $ax(Feng.ctxPath + "/tOrderTape/deleteBatch", function (data) {
|
swal("删除成功", "您已经删除了" + nickname + "。", "success");
|
TOrderTape.table.refresh();
|
}, function (data) {
|
swal("删除失败", data.responseJSON.message + "!", "warning");
|
});
|
ajax.set("tOrderTapeIds", ids);
|
ajax.start();
|
});
|
}
|
};
|
|
/**
|
* 查询行程录音管理列表
|
*/
|
TOrderTape.search = function () {
|
var queryData = {};
|
queryData['createTime'] = $("#createTime").val();
|
queryData['fileName'] = $("#fileName").val();
|
queryData['orderNum'] = $("#orderNum").val();
|
queryData['state'] = $("#state").val();
|
TOrderTape.table.refresh({query: queryData});
|
};
|
|
TOrderTape.resetSearch = function () {
|
$("#createTime").val("");
|
$("#fileName").val("");
|
$("#orderNum").val("");
|
$("#state").val("");
|
TOrderTape.search();
|
};
|
|
$(function () {
|
var defaultColunms = TOrderTape.initColumn();
|
var table = new BSTable(TOrderTape.id, "/tOrderTape/list", defaultColunms);
|
table.setPaginationType("server");
|
TOrderTape.table = table.init();
|
});
|