//当前节点 入库质检
var layer;
var form;
var table;
var upload;
var page = 1;
var limit = 14;
var recordData = null;
var snapData;//系统抓拍对象信息
var timerWeight;
var img1, img2, img3;// 页面中的图片上传名称
$(function() {
layui.use([ 'layer', 'laydate', 'form', 'table', 'util', 'upload'], function() {
var util = layui.util;
upload = layui.upload;
layer = layui.layer;
form = layui.form;
table = layui.table;
var laydate = layui.laydate;
laydate.render({
elem : '#start',
theme : '#7b8e9f',
value : startTime
});
laydate.render({
elem : '#end',
theme : '#7b8e9f',
value : endTime
});
laydate.render({
elem : '#foodYear',
theme : '#7b8e9f',
type : 'year'
});
//上传
upload.render({
elem: '#kccz-r-btn1',
url: '../file/update-file', //上传接口
size: 4*1024, //限制文件大小,单位KB, 最大上传4MB
accept : 'images',
before: function(obj){
var plateNum = $("#plateNum").val();
this.data={"plateNum":plateNum,"type":"1"};//携带参数
//预读本地文件示例,不支持ie8
obj.preview(function(index, file, result){
$('#kccz-r-img1').attr('src', result); //图片链接(base64)
});
},
done: function(res){
//如果上传失败
if(res.code > 0){
layer.msg("图片上传失败!");
}
//上传成功
img1 = res.msg;
layer.msg("图片上传成功!");
//console.log(img1);
}
});
upload.render({
elem: '#kccz-r-btn2',
url: '../file/update-file', //上传接口
size: 4*1024, //限制文件大小,单位KB, 最大上传4MB
accept : 'images',
before: function(obj){
var plateNum = $("#plateNum").val();
this.data={"plateNum":plateNum,"type":"1"};//携带参数
//预读本地文件示例,不支持ie8
obj.preview(function(index, file, result){
$('#kccz-r-img2').attr('src', result); //图片链接(base64)
});
},
done: function(res){
//如果上传失败
if(res.code > 0){
layer.msg("图片上传失败!");
}
//上传成功
img2 = res.msg;
layer.msg("图片上传成功!");
// console.log(img2);
}
});
upload.render({
elem: '#kccz-r-btn3',
url: '../file/update-file', //上传接口
size: 4*1024, //限制文件大小,单位KB, 最大上传4MB
accept : 'images',
before: function(obj){
var plateNum = $("#plateNum").val();
this.data={"plateNum":plateNum}; //携带参数
//预读本地文件示例,不支持ie8
obj.preview(function(index, file, result){
$('#kccz-r-img3').attr('src', result); //图片链接(base64)
});
},
done: function(res){
//如果上传失败
if(res.code > 0){
layer.msg("图片上传失败!");
}
//上传成功
img3 = res.msg;
layer.msg("图片上传成功!");
}
});
// 监听行工具事件
table.on('tool(tableData)', function(obj) {
if (obj.event === 'edit') {
//展示弹窗
afreshGetData(obj);
}
});
// 右下角添加固定信息
util.fixbar({
bar1: true,
css: {
right: 10,
bottom: 20
},
bgcolor: '#53adce',
click: function (type) {
if (type === 'bar1') {
layer.closeAll();
layer.open({
type: 2,
title: false,
shadeClose: true,
shade: 0.3,
closeBtn: 2,
area: ['1000px', '640px'],
content: '../../basic/inout/inout-progress?type=' + type + "&t=" + Math.random()
});
}
}
});
// 监听仓库选择,选择后自动调用仓库的粮品种和产地信息
form.on('select(select_depotId)', function(obj) {
updateFoodVarietyByDepot(obj.value);
});
// 初始化表单数据
renderTable();
});
//显示称重弹窗流程
showProgress();
// 监听比例值填写
$(".per").blur(function () {
deAutoByPer();
});
// 监听比例值填写
$(".weight").blur(function () {
deAutoByWeight();
});
//初始化WebSocket
initWS(deptId, bizType, progress, userId);
});
window.onload = function () {
// 加载视频
initVideo(lprDto, snapDto1, snapDto2);
};
//根据条件查询数据
function flushData() {
var index = layer.load();
var param = form.val("form-param");
table.reload('tableData', {
url : "../../basic/inout/page-inout-data",
where : param
});
$("thead tr").css({
"border-bottom" : "2px solid #53adce",
"background" : "#eff4f6"
});
layer.close(index);
}
//表单清空
function resetForm() {
$("#form-param")[0].reset();
form.render();
}
// 渲染表单数据
function renderTable() {
var param = form.val("form-param");
// 清空数据
$("#tableData").empty();
table.render({
elem : '#tableData',
url : '../../basic/inout/page-inout-data',
page : true,
limit : limit,
even : true,
method : 'POST',
contentType : "application/json;charset=UTF-8",
cols : [ [{type:'numbers',
title:'序号'
}, {
field : 'id',
title : '单据号',
width : '13%',
style : 'color: #f67d06;font-weight: bold'
}, {
field : 'plateNum',
title : '车牌',
width : '11%',
style : 'font-weight: bold'
}, {
field : 'customerName',
title : '往来单位'
}, {
field : 'foodVariety',
title : '品种',
width : '10%',
templet : function(item) {
var result = item.foodVariety;
$.each(listFoodVariety, function(index, data) {
if (item.foodVariety == data.code) {
result = data.name;
return true;
}
});
return result == null ? "" : result;
}
}, {
field : 'depotId',
title : '装卸仓库',
width : '10%',
templet : function(item) {
var result = item.depotId;
$.each(listDepot, function(index, data) {
if (item.depotId == data.id) {
result = data.name;
return true;
}
});
return result == null ? "" : result;
}
}, {
field : 'progress',
title : '流程进度',
width : '10%',
style : 'font-weight: bold',
templet : function(item) {
return INOUT_PROGRESS_MSG(item.progress);
}
}, {
field : 'registerTime',
title : '登记时间',
width : '14%'
}, {
field : '',
title : '操作',
width : '9%',
toolbar : "#barControl"
} ] ],
where : param,
parseData : function(res) {
if ("0000" == res.code) {
return {
"code" : "0",
"msg" : res.msg,
"count" : res.data.total,
"data" : res.data.records
}
} else {
return {
"code" : "1",
"msg" : res.msg
}
}
}
});
$("thead tr").css({
"border-bottom" : "2px solid #53adce",
"background" : "#eff4f6"
});
}
/*-----------------------弹窗显示渲染-开始------------------------------*/
//操作前,重新流水数据当前信息
function afreshGetData(obj) {
var index = layer.load();
recordData = null;
var data = obj.data;
var param = {
userId: data.userId,
plateNum: data.plateNum,
id: data.id
};
$.ajax({
type: "POST",
url: "../../basic/inout/inout-query",
dataType: "json",
contentType: "application/json;charset=UTF-8",
data: JSON.stringify(param),
success: function (result) {
if (result.code != "0000") {
layer.alert("请刷新页面后,重新操作!!");
} else {
recordData = result.data;
showWindows(recordData.progress);
}
layer.close(index);
},
error: function () {
layer.close(index);
layer.alert("请刷新页面后,重新操作!!");
}
});
}
//显示流程操作弹窗
function showWindows(progress) {
console.log(progress);
if(progress == 'WEIGHT_FULL' || progress == 'WEIGHT_EMPTY'){
//称重操作弹窗
var pro = '满车称重';
if(progress == 'WEIGHT_EMPTY'){
pro = '空车称重';
}
updateEditAndProgress();
flushPage();
layer.open({
type : 1,
title : "入库" + pro + " - 单号:" + recordData.id,
area : [ '1200px', '720px' ],
closeBtn: 1,
shade : 0,
scrollbar: 0,
content : $('#weightDetail'),
offset:['25px','70px']
});
}else if(progress == 'HANDLE'){
//值仓操作弹窗
form.val("form-handle", recordData);
form.render();
layer.open({
type : 1,
title : "入库值仓 - 单号:" + recordData.id,
area : [ '1200px', '720px' ],
closeBtn: 1,
shade : 0,
scrollbar: 0,
content : $('#handleDetail'),
offset:['25px','70px']
});
} else {
layer.alert("请到对应页面进行操作!!!");
}
}
//称重弹窗中流程环节显示
function showProgress() {
if (!inoutProgress) {
return;
}
if (inoutProgress.indexOf("REGISTER") == -1) {
$("#progress-register").css("display", "none");
}
if (inoutProgress.indexOf("CHECK") == -1) {
$("#progress-check").css("display", "none");
}
if (inoutProgress.indexOf("WEIGHT_FULL") == -1) {
$("#progress-fullWeight").css("display", "none");
}
if (inoutProgress.indexOf("HANDLE") == -1) {
$("#progress-hand").css("display", "none");
}
if (inoutProgress.indexOf("WEIGHT_EMPTY") == -1) {
$("#progress-emptyWeight").css("display", "none");
}
if (inoutProgress.indexOf("PAY") == -1) {
$("#progress-pay").css("display", "none");
}
if (inoutProgress.indexOf("CARD_BACK") == -1) {
$("#progress-cardBack").css("display", "none");
}
}
//称重弹窗中更新流程节点
function updateEditAndProgress() {
if (recordData) {
if (InoutProgress.WEIGHT_EMPTY == recordData.progress) {
$("#emptyWeight").removeClass("rkbk-search-input");
$("#emptyWeight").attr("disabled", false);
$("#progress-hand").addClass("active");
$("#progress-emptyWeight").addClass("active");
$("#fullWeight").addClass("rkbk-search-input");
$("#fullWeight").attr("disabled", true);
}
if (InoutProgress.WEIGHT_FULL == recordData.progress) {
$("#fullWeight").removeClass("rkbk-search-input");
$("#fullWeight").attr("disabled", false);
$("#progress-hand").removeClass("active");
$("#progress-emptyWeight").removeClass("active");
$("#emptyWeight").addClass("rkbk-search-input");
$("#emptyWeight").attr("disabled", true);
}
} else {
$("#fullWeight").addClass("rkbk-search-input");
$("#fullWeight").attr("disabled", true);
$("#emptyWeight").addClass("rkbk-search-input");
$("#emptyWeight").attr("disabled", true);
$("#progress-hand").removeClass("active");
$("#progress-emptyWeight").removeClass("active");
}
}
/*-----------------------弹窗显示渲染-结束------------------------------*/
/*-----------------------称重操作-开始------------------------------*/
//自动连接地磅信息,2.5秒获取一次地磅重量信息
function timerGetWeight() {
clearInterval(timerWeight);
timerWeight = setInterval(function () {
flushWeight();
}, 2500);
}
//发送请求获取称重数据
function flushWeight() {
$.ajax({
type: "GET",
async: true,
timeout: 2000,
url: "http://127.0.0.1:9111/WEIGHT",
data: {},
dataType: "jsonp",
jsonp: "callback",
jsonpCallback: "jsonpCallback",
success: function (json) {
var data = json.content;
if(!data) data = 0.0;
weightDto.weight = data;
$("#weightValue").html(data + "KG");
$("#img_scale_statule").attr("src", "../../static/images/icon-gree.png");
},
error: function () {
weightDto.weight = 0.0;
$("#weightValue").html("0.0KG");
$("#img_scale_statule").attr("src", "../../static/images/icon-red.png");
}
});
}
//点击称重
function weight() {
// 没有业务数据不可执行
if (!recordData) {
layer.alert("没有查询到业务数据,执行被拒绝!!");
return;
}
// 如果是空车称重
if (InoutProgress.WEIGHT_EMPTY == recordData.progress) {
form.val("form-weight", {
emptyWeight: weightDto.weight
});
}
// 如果是满车称重
if (InoutProgress.WEIGHT_FULL == recordData.progress) {
form.val("form-weight", {
fullWeight: weightDto.weight
});
}
form.render();
snapData == null;
//点击称重时候自动抓拍数据
layer.msg("系统自动抓拍保留记录……");
snapData = {
companyId: companyId,
deptId: deptId,
bizTag: recordData.progress,
bizType: bizType,
plateNum: recordData.plateNum + "-" + recordData.carNum,
id1: (null != lprDto) ? lprDto.id : null,
id2: (null != snapDto1) ? snapDto1.id : null,
id3: (null != snapDto2) ? snapDto2.id : null
};
console.log(snapData);
//当前AJAX服务为同步服务,返回数据包装照片信息
var index = layer.load();
$.ajax({
sync: false,
type: "POST",
url: "../../basic/inout/snap-img",
dataType: "json",
contentType: "application/json;charset=UTF-8",
data: JSON.stringify(snapData),
success: function (result) {
layer.close(index);
if (result.code != "0000") {
layer.alert(result.msg);
} else {
snapData = result.data;
}
},
error: function () {
layer.close(index);
layer.msg("后台调用截图失败,请重新尝试!!");
}
});
//二次称重后,自动调用下自动计算
if (InoutProgress.WEIGHT_EMPTY == recordData.progress) {
deAutoByPer();
}
flushBtn("btn-weight");
}
// 自动计算,注意:出库水分是 +,入库水分需要 -
function deAutoByPer() {
var curData = form.val("form-weight");
var netWeight = 0, deImpurity = 0, deWet = 0, deSum = 0, settleWeight = 0;
if (curData.fullWeight == 0 || curData.emptyWeight == 0) {
return;
}
// 计算净重
netWeight = curData.fullWeight - curData.emptyWeight;
if (netWeight <= 0) {
layer.msg("净重小于等于0,当前计算不正确!");
return;
}
//水分扣重和杂质扣重
var checkItems = recordData.checkItems;
if (checkItems) {
var deBase = 0, multiple = 0;
$.each(checkItems, function (index, checkItem) {
if (!checkItem.value) return;//跳出本次循环
if (null == checkItem.ruleNum) return;//没有配置规则 不处理
if (null == checkItem.ruleReduce) return;//跳出本次循环
//水分扣重
if (CHECK_ST.C01 == checkItem.standardId) {
deBase = Number(curData.wet) - checkItem.upperLimit;
if (deBase == 0) return;
multiple = parseInt(deBase / checkItem.ruleNum);//倍数
if (deBase > 0) {//扣重正数
deWet = (netWeight * multiple * checkItem.ruleReduce / 100.00).toFixed(0);
}
}
//杂质只扣不补
if (CHECK_ST.C02 == checkItem.standardId) {
deBase = Number(curData.impurity) - checkItem.upperLimit;
if (deBase == 0) return;
multiple = parseInt(deBase / checkItem.ruleNum);
if (deBase > 0) {//扣重
deImpurity = (netWeight * multiple * checkItem.ruleReduce / 100.00).toFixed(0);
}
}
});
}
// 总扣重,水分不计入
deSum = Number(deImpurity) + Number(curData.deOther) + Number(curData.deHandle) + Number(deWet);
deSum = deSum.toFixed(0);
// 结算净重
settleWeight = Number(netWeight) - Number(deSum);
settleWeight = settleWeight.toFixed(0);
form.val("form-weight", {
netWeight: netWeight,
deImpurity: deImpurity,
deWet: deWet,
deSum: deSum,
settleWeight: settleWeight
});
form.render();
}
// 自动计算
function deAutoByWeight() {
var curData = form.val("form-weight");
var netWeight = 0, deSum = 0, settleWeight = 0;
if (curData.fullWeight == 0 || curData.emptyWeight == 0) {
return;
}
//净重
netWeight = curData.fullWeight - curData.emptyWeight;
if (netWeight <= 0) {
layer.msg("净重小于等于0,当前计算不正确!");
return;
}
// 总扣重= 杂质扣重 + 不完善扣重 + 其他扣重 + 值仓扣重 + 包装扣重
deSum = Number(curData.deImpurity)
+ Number(curData.deOther) + Number(curData.deHandle);
deSum = deSum.toFixed(0);
// 结算净重
settleWeight = Number(netWeight) - Number(deSum);
settleWeight = settleWeight.toFixed(0);
form.val("form-weight", {
netWeight: netWeight,
deSum: deSum,
settleWeight: settleWeight
});
form.render();
}
//根据当前操作的按钮ID更新其他按钮状态
function flushBtn(btnId) {
if ("btn-weight" == btnId) {// 称重后可以点击完成称重
$("#btn-submit").removeClass("layui-btn-disabled");
$("#btn-submit").attr("disabled", false);
}
if ("btn-submit" == btnId) {
$("#btn-submit").addClass("layui-btn-disabled");
$("#btn-submit").attr("disabled", true);
flushData();
if (InoutProgress.WEIGHT_FULL == recordData.progress) {// 如果是满车称重,则直接当前节点完成
layer.closeAll();
} else {
// 完成称重后控制按钮
$("#btn-weight").addClass("layui-btn-disabled");
$("#btn-weight").attr("disabled", true);
$("#btn-printBill").removeClass("layui-btn-disabled");
$("#btn-printBill").attr("disabled", false);
addDisabled();
}
}
if ("btn-printBill" == btnId) {// 打印过磅单,说明业务完成
$("#btn-weight").removeClass("layui-btn-disabled");
$("#btn-weight").attr("disabled", false);
$("#btn-submit").addClass("layui-btn-disabled");
$("#btn-submit").attr("disabled", true);
$("#btn-printBill").addClass("layui-btn-disabled");
$("#btn-printBill").attr("disabled", true);
layer.closeAll();
flushData();
}
}
//更改扣重信息框不可编辑
function addDisabled() {
//杂质
$("#impurity").attr("disabled", true);
$("#deImpurity").attr("disabled", true);
//水分
$("#wet").attr("disabled", true);
$("#deWet").attr("disabled", true);
//值仓
$("#deHandle").attr("disabled", true);
//其他
$("#deOther").attr("disabled", true);
}
//恢复扣重信息框编辑状态
function delDisabled() {
//杂质
$("#impurity").attr("disabled", false);
$("#deImpurity").attr("disabled", false);
//水分
$("#wet").attr("disabled", false);
$("#deWet").attr("disabled", false);
//值仓
$("#deHandle").attr("disabled", false);
//其他
$("#deOther").attr("disabled", false);
}
// 点击打印,系统判断是否已经执行完成,如果已经完成,直接打印,如果未完成则先执行完成
function printBill() {
if (!recordData) {
layer.alert("没有获取到业务数据,不支持打印!");
return;
}
// 从后台获取模版并打印
var data = form.val("form-weight");
// 合并更新當前编辑数据
Object.assign(recordData, data);
printBillStep2();
};
// 点击打印,先执行系统默认执行完成卡回收
function printBillStep2() {
var index = layer.load();
$.ajax({
type: "POST",
url: "../../basic/inout-report/inout-bill-weight",
dataType: "json",
contentType: "application/json;charset=UTF-8",
data: JSON.stringify(recordData),
success: function (result) {
layer.close(index);
if (result.code != "0000") {
layer.msg(result.msg);
} else {
layer.msg("开始渲染打印单……");
printWeight(result.data);
// 刷新按钮
flushBtn("btn-printBill");
}
},
error: function () {
layer.close(index);
layer.msg("获取打印模版失败,请联系管理员查看原因!!");
}
});
};
//完成称重
function submitWeight() {
if (null == recordData) {
notify("没有数据可以提交", null);
return;
}
var data = form.val("form-weight");
if (!data.depotId) {
notify("装卸仓库必须填写", null);
return;
}
// 校验-入库满车称重
if (InoutProgress.WEIGHT_FULL == recordData.progress) {
if (data.fullWeight <= 0.0) {
notify("满车称重信息必填", null);
return;
}
if (!data.customerName) {
notify("往来单位信息必填", null);
return;
}
if (!data.depotId) {
notify("仓库信息必填", null);
return;
}
} else {
if (data.emptyWeight <= 0.0) {
notify("空车称重信息必填", null);
return;
}
if (!data.foodVariety) {
notify("粮食品种必填", null);
return;
}
if (!data.settleWeight || data.settleWeight <= 0.0) {
notify("扣重后净信息不正确,请核实计算", null);
return;
}
}
// 合并更新當前编辑数据
Object.assign(recordData, data);
// 获取照片
var files = [{
fileName: snapData.fileName1
}, {
fileName: snapData.fileName2
}, {
fileName: snapData.fileName3
}];
recordData.files = files;
var index = layer.load();
$.ajax({
type: "POST",
url: "../../basic/inout/inout-next-step",
dataType: "json",
contentType: "application/json;charset=UTF-8",
data: JSON.stringify(recordData),
success: function (result) {
if (result.code != "0000") {
notify(result.msg, result.data);
} else {
clearInterval(timerWeight);
layer.alert("数据提交成功!!");
// 更新按钮显示
flushBtn("btn-submit");
}
layer.close(index);
},
error: function () {
layer.close(index);
layer.alert("提交失败,请重新尝试!!");
}
});
}
//重新称重时,表单不清空,按钮重置
function flushPage() {
weightDto.weight = 0.0;
$("#weightValue").html("0.0KG");
$("#img_scale_statule").attr("src", "../../static/images/icon-red.png");
timerGetWeight();
$("#btn-weight").removeClass("layui-btn-disabled");
$("#btn-weight").attr("disabled", false);
$("#btn-submit").addClass("layui-btn-disabled");
$("#btn-submit").attr("disabled", true);
$("#btn-printBill").addClass("layui-btn-disabled");
$("#btn-printBill").attr("disabled", true);
//扣重信息框恢复为可编辑
delDisabled();
//表单数据重置
form.val("form-weight", recordData);
form.render();
}
//根据选择的仓库信息,更新粮食品种
function updateFoodVarietyByDepot(selectId) {
var selectDepot;
$.each(listDepot, function (index, data) {
if (data.id === selectId) {
selectDepot = data;
return false;
}
});
if (selectDepot) {
console.log(selectDepot.noticeId);
form.val("form-weight", {
noticeId: selectDepot.noticeId
});
form.render();
}
}
/*-----------------------称重操作-结束------------------------------*/
/*-----------------------值仓操作-开始------------------------------*/
//值仓提交
function submitHandle() {
if (null == recordData) {
layer.alert("没有数据可以提交!!!");
return;
}
var index = layer.load();
var data = form.val("form-handle");
// 合并更新當前编辑数据
Object.assign(recordData, data);
// 获取图片名称
recordData.files = [{
fileName: img1
}, {
fileName: img2
}, {
fileName: img3
}];
console.log(recordData);
$.ajax({
type : "POST",
url : "../../basic/inout/inout-next-step",
dataType : "json",
contentType : "application/json;charset=UTF-8",
data : JSON.stringify(recordData),
success : function(result) {
if (result.code != "0000") {
layer.alert("提交失败,请重新尝试!!");
} else {
layer.alert("值仓完成!!");
layer.closeAll();
flushData();
}
layer.close(index);
},
error : function() {
layer.close(index);
layer.alert("提交失败,请重新尝试!!");
}
});
}
// ---------------------------往来单位操作--开始 -------------------//
// 弹出往来单位下拉框
function showCustomer() {
var index = layer.load();
// 渲染往来单位列表
table.render({
elem: '#tableCustomer',
url: '../../basic/inout/list-in-customer',
page: false,
// skin : "nob",
// size : 'sm',
toolbar: '#toolbarCustomer',
even: true,
method: 'POST',
contentType: "application/json;charset=UTF-8",
cols: [[{
field: 'id',
title: '编码'
},{
field: 'name',
title: '名称'
}, {
field: 'cardId',
title: '身份证'
}]],
parseData: function (res) {
if ("0000" == res.code) {
return {
"code": "0",
"msg": res.msg,
"data": res.data
}
} else {
return {
"code": "1",
"msg": res.msg
}
}
},
done: function (res) {
layer.close(index);
}
});
//双击显示选中数据
table.on('rowDouble(tableCustomer)', function (obj) {
var data = obj.data;
// 赋值
form.val("form-weight", {
customerId: data.id,
customerName: data.name
});
// 关闭
layer.close(index2);
});
// 弹出对话框
var index2 = layer.open({
type: 1,
title: "选择往来单位",
area: ['600px', '600px'],
shade: 0,
content: $('#listCustomer'),
btn: 0,
btn: ['取消'],
yes: function () {
layer.close(index2);
},
closeBtn: 0
});
}
// 刷新往来单位数据
function flushCustomer() {
var key = $("#key").val();
var param = {
type: type,
key: key,
start: recordData == null ? null : recordData.registerTime
};
table.reload('tableCustomer', {
url: "../../basic/inout/list-in-customer",
where: param,
done: function (res) {
if (key) {
$("#key").val(key);
}
}
});
}
// 新增客户信息
function addCustomer() {
layer.closeAll();
layer.open({
type: 1,
title: "新增客户",
area: ['500px', '450px'],
shade: 0,
content: $('#addCustomer'),
btn: 0,
btn: ['确定', '取消'],
yes: function () {
var newCustomer = form.val("form-addCustomer");
newCustomer.type = type;
newCustomer.deptId = deptId;
var index = layer.load();
$.ajax({
type: "POST",
url: "../../basic/inout/add-customer",
dataType: "json",
contentType: "application/json;charset=UTF-8",
data: JSON.stringify(newCustomer),
success: function (result) {
if (result.code != "0000") {
layer.msg(result.msg);
layer.close(index);
} else {
// 赋值
form.val("form-data", {
customerId: newCustomer.id,
customerName: newCustomer.name
});
layer.closeAll();
}
},
error: function () {
layer.close(index);
layer.msg("后台执行异常,请联系系统管理员!");
}
});
},
btn2: function () {
layer.closeAll();
},
closeBtn: 0
});
}
// ---------------------------往来单位操作--结束-------------------//
/**
* 弹出提醒框
* @param msg 提醒信息
* @param data 数据信息,可能为空
*/
function notify(msg, data) {
if (data) {
//赋值
$("#resultMsg").text(msg);
$("#resultUserName").text(data.userName);
$("#resultPlateNum").text(data.plateNum);
if ("IN" == data.type) {
$("#resultType").text("入库-" + INOUT_PROGRESS_MSG(data.progress));
} else {
$("#resultType").text("出库-" + INOUT_PROGRESS_MSG(data.progress));
}
$("#resultIntelCard").text(data.intelCard);
layer.open({
type: 1,
offset: ['150px', '200px'],
area: '450px;',
shade: 0.8,
id: 'dialog_notify_info',
btn: ['确定'],
content: $('#dialog-from-notify'),
yes: function (index) {
layer.closeAll();
}
});
} else {
layer.alert(msg, {offset: ['300px', '300px']});
}
};