提交 0cbb3677 编写于 作者: W weizhiqiang

商品规格变化以及商品选择按钮监听代码公共化

上级 1cc43eb6
......@@ -165,7 +165,7 @@ function calculatedTotalPrice() {
layui.define(["jquery"], function(exports) {
var jQuery = layui.jquery;
(function($) {
//数量变化,税率变化
// 数量变化,税率变化
$("body").on("input", ".rkNum, .unitPrice, .amountOfMoney, .taxRate, .taxMoney, .taxUnitPrice, .taxLastMoney", function() {
if($(this).attr("class").replace("layui-input change-input ", "") != showTdByEdit){
showTdByEdit = $(this).attr("class").replace("layui-input change-input ", "");
......@@ -183,7 +183,7 @@ layui.define(["jquery"], function(exports) {
calculatedTotalPrice();
});
//优惠率变化
// 优惠率变化
$("body").on("input", "#discount", function() {
//获取价格合计
var taxLastMoneyPrice = parseFloat(isNull($("#taxLastMoneyPrice").html()) ? 0 : $("#taxLastMoneyPrice").html());
......@@ -207,7 +207,7 @@ layui.define(["jquery"], function(exports) {
$("#changeAmount").val((taxLastMoneyPrice - (taxLastMoneyPrice * discount / 100)).toFixed(2));
});
//优惠金额变化
// 优惠金额变化
$("body").on("input", "#discountMoney", function() {
//获取价格合计
var taxLastMoneyPrice = parseFloat(isNull($("#taxLastMoneyPrice").html()) ? 0 : $("#taxLastMoneyPrice").html());
......@@ -231,7 +231,7 @@ layui.define(["jquery"], function(exports) {
$("#changeAmount").val((taxLastMoneyPrice - discountMoney).toFixed(2));
});
//本次付款变化
// 本次付款变化
$("body").on("input", "#changeAmount", function() {
//获取优惠后的金额
var discountLastMoney = parseFloat(isNull($("#discountLastMoney").html()) ? 0 : $("#discountLastMoney").html());
......@@ -246,10 +246,11 @@ layui.define(["jquery"], function(exports) {
//输出欠款金额
$("#arrears").html((discountLastMoney - changeAmount).toFixed(2));
});
})(jQuery);
});
//判断选中的商品是否也在数组中
// 判断选中的商品是否也在数组中
function inTableDataArrayByAssetarId(materialId, unitId, array) {
var isIn = false;
$.each(array, function(i, item) {
......
......@@ -72,4 +72,66 @@ function getStockAjaxByDepotAndNormsId(normsIds, depotId, callBack) {
callBack(json);
}
}});
}
\ No newline at end of file
}
/**
* 商品规格加载变化事件
*
* @param form 表单对象
*/
function mUnitChangeEvent(form) {
// 商品规格加载变化事件
form.on('select(selectUnitProperty)', function(data) {
var thisRowValue = data.value;
var thisRowKey = data.elem.id.replace("mUnitId", "").toString();
// 当前当前行选中的商品信息
if (!isNull(thisRowValue)) {
var product = allChooseProduct["tr" + thisRowKey];
$.each(product.unitList, function (j, bean) {
if (thisRowValue == bean.id) {
var rkNum = parseInt($("#rkNum" + thisRowKey).val());
// 设置单价和金额
$("#unitPrice" + thisRowKey).val(bean.estimatePurchasePrice.toFixed(2));
$("#amountOfMoney" + thisRowKey).val((rkNum * parseFloat(bean.estimatePurchasePrice)).toFixed(2));
return false;
}
});
} else {
// 重置单价以及金额为空
$("#unitPrice" + thisRowKey).val("0.00");
$("#amountOfMoney" + thisRowKey).val("0.00");
}
var depotId = isNull($("#depotId").val()) ? "" : $("#depotId").val();
// 加载库存
loadTockByDepotAndMUnit(thisRowKey, depotId);
// 计算价格
calculatedTotalPrice();
});
}
/**
* 初始化商品选择的监听事件
*
* @param form 表单对象
* @param callback 回调函数
*/
function initChooseProductBtnEnent (form, callback) {
$("body").on("click", ".chooseProductBtn", function (e) {
var trId = $(this).parent().parent().attr("trcusid");
erpOrderUtil.openMaterialChooseChoosePage(function (chooseProductMation) {
// 获取表格行号
var thisRowKey = trId.replace("tr", "");
// 表格商品名称赋值
$("#materialId" + thisRowKey.toString()).val(chooseProductMation.productName + "(" + chooseProductMation.productModel + ")");
// 表格单位赋值
$("#mUnitId" + thisRowKey.toString()).html(getDataUseHandlebars(selOption, {rows: chooseProductMation.unitList}));
form.render('select');
if (typeof callback == "function") {
callback(trId, chooseProductMation);
}
// 计算价格
calculatedTotalPrice();
});
});
}
......@@ -68,40 +68,17 @@ layui.config({
// 设置根据某列变化的颜色
$("." + showTdByEdit).parent().css({'background-color': '#e6e6e6'});
},
form: form
form: form,
minData: 1
});
// 加载动态表单
dsFormUtil.loadPageByCode("dsFormShow", sysDsFormWithCodeType["purchaseOrder"]["code"], null);
matchingLanguage();
// 商品规格加载变化事件
form.on('select(selectUnitProperty)', function(data) {
var thisRowValue = data.value;
var thisRowKey = data.elem.id.replace("mUnitId", "").toString();
// 当前当前行选中的商品信息
if (!isNull(thisRowValue)) {
var product = allChooseProduct["tr" + thisRowKey];
$.each(product.unitList, function (j, bean) {
if (thisRowValue == bean.id) {
var rkNum = parseInt($("#rkNum" + thisRowKey).val());
// 设置单价和金额
$("#unitPrice" + thisRowKey).val(bean.estimatePurchasePrice.toFixed(2));
$("#amountOfMoney" + thisRowKey).val((rkNum * parseFloat(bean.estimatePurchasePrice)).toFixed(2));
return false;
}
});
} else {
// 重置单价以及金额为空
$("#unitPrice" + thisRowKey).val("0.00");
$("#amountOfMoney" + thisRowKey).val("0.00");
}
// 加载库存
loadTockByDepotAndMUnit(thisRowKey, "");
// 计算价格
calculatedTotalPrice();
});
// 商品规格加载变化事件
mUnitChangeEvent(form);
// 保存为草稿
form.on('submit(formAddBean)', function(data) {
......@@ -190,22 +167,9 @@ layui.config({
});
});
// 商品选择
$("body").on("click", ".chooseProductBtn", function (e) {
var trId = $(this).parent().parent().attr("trcusid");
erpOrderUtil.openMaterialChooseChoosePage(function (chooseProductMation) {
// 获取表格行号
var thisRowKey = trId.replace("tr", "");
// 商品赋值
allChooseProduct[trId] = chooseProductMation;
// 表格商品名称赋值
$("#materialId" + thisRowKey.toString()).val(chooseProductMation.productName + "(" + chooseProductMation.productModel + ")");
// 表格单位赋值
$("#mUnitId" + thisRowKey.toString()).html(getDataUseHandlebars(selOption, {rows: chooseProductMation.unitList}));
form.render('select');
//计算价格
calculatedTotalPrice();
});
initChooseProductBtnEnent(form, function(trId, chooseProductMation) {
// 商品赋值
allChooseProduct[trId] = chooseProductMation;
});
// 生产计划单选择
......
......@@ -136,37 +136,13 @@ layui.config({
// 设置根据某列变化的颜色
$("." + showTdByEdit).parent().css({'background-color': '#e6e6e6'});
},
form: form
form: form,
minData: 1
});
}
//商品规格加载变化事件
form.on('select(selectUnitProperty)', function(data) {
var thisRowValue = data.value;
var thisRowKey = data.elem.id.replace("mUnitId", "").toString();
// 当前当前行选中的商品信息
if (!isNull(thisRowValue)) {
var product = allChooseProduct["tr" + thisRowKey];
$.each(product.unitList, function (j, bean) {
if (thisRowValue == bean.id) {
var rkNum = parseInt($("#rkNum" + thisRowKey).val());
// 设置单价和金额
$("#unitPrice" + thisRowKey).val(bean.estimatePurchasePrice.toFixed(2));
$("#amountOfMoney" + thisRowKey).val((rkNum * parseFloat(bean.estimatePurchasePrice)).toFixed(2));
return false;
}
});
} else {
// 重置单价以及金额为空
$("#unitPrice" + thisRowKey).val("0.00");
$("#amountOfMoney" + thisRowKey).val("0.00");
}
// 加载库存
loadTockByDepotAndMUnit(thisRowKey, "");
// 计算价格
calculatedTotalPrice();
});
// 商品规格加载变化事件
mUnitChangeEvent(form);
// 保存为草稿
form.on('submit(formEditBean)', function(data) {
......@@ -264,22 +240,9 @@ layui.config({
});
});
// 商品选择
$("body").on("click", ".chooseProductBtn", function (e) {
var trId = $(this).parent().parent().attr("trcusid");
erpOrderUtil.openMaterialChooseChoosePage(function (chooseProductMation) {
// 获取表格行号
var thisRowKey = trId.replace("tr", "");
// 商品赋值
allChooseProduct[trId] = chooseProductMation;
// 表格商品名称赋值
$("#materialId" + thisRowKey.toString()).val(chooseProductMation.productName + "(" + chooseProductMation.productModel + ")");
// 表格单位赋值
$("#mUnitId" + thisRowKey.toString()).html(getDataUseHandlebars(selOption, {rows: chooseProductMation.unitList}));
form.render('select');
//计算价格
calculatedTotalPrice();
});
initChooseProductBtnEnent(form, function(trId, chooseProductMation) {
// 商品赋值
allChooseProduct[trId] = chooseProductMation;
});
// 生产计划单选择
......
//根据那一列的值进行变化,默认根据数量
// 根据那一列的值进行变化,默认根据数量
var showTdByEdit = 'rkNum';
//表格的序号
var rowNum = 1;
// 兼容动态表单
var layedit, form;
......@@ -24,8 +22,7 @@ layui.config({
var inoutitemHtml = "";//支出项目
var usetableTemplate = $("#usetableTemplate").html(),
otherTemplate = $("#otherTemplate").html();
var otherTemplate = $("#otherTemplate").html();
var selOption = getFileContent('tpl/template/select-option.tpl');
//已经选择的商品集合key:表格的行trId,value:商品信息
var allChooseProduct = {};
......@@ -54,38 +51,43 @@ layui.config({
erpOrderUtil.getDepotList(function (json){
// 加载仓库数据
$("#depotId").html(getDataUseHandlebars(selOption, json));
// 初始化一行数据
addRow();
});
initTableChooseUtil.initTable({
id: "productList",
cols: [
{id: 'materialId', title: '商品(型号)', formType: 'chooseInput', width: '150', iconClassName: 'chooseProductBtn', verify: 'required'},
{id: 'mUnitId', title: '单位', formType: 'select', width: '50', verify: 'required', layFilter: 'selectUnitProperty'},
{id: 'currentTock', title: '库存', formType: 'detail', width: '80'},
{id: 'rkNum', title: '数量', formType: 'input', width: '80', className: 'change-input rkNum', verify: 'required|number', value: '1'},
{id: 'unitPrice', title: '单价', formType: 'input', width: '80', className: 'change-input unitPrice', verify: 'required|money'},
{id: 'amountOfMoney', title: '金额', formType: 'input', width: '80', className: 'change-input amountOfMoney', verify: 'required|money'},
{id: 'taxRate', title: '税率(%)', formType: 'input', width: '80', className: 'change-input taxRate', verify: 'required|double', value: '0.00'},
{id: 'taxMoney', title: '税额', formType: 'input', width: '80', className: 'change-input taxMoney', verify: 'required|money'},
{id: 'taxUnitPrice', title: '含税单价', formType: 'input', width: '80', className: 'change-input taxUnitPrice', verify: 'required|money'},
{id: 'taxLastMoney', title: '合计价税', formType: 'input', width: '80', className: 'change-input taxLastMoney', verify: 'required|money'},
{id: 'remark', title: '备注', formType: 'input', width: '100'}
],
deleteRowCallback: function (trcusid) {
delete allChooseProduct[trcusid];
// 计算价格
calculatedTotalPrice();
},
addRowCallback: function (trcusid) {
// 设置根据某列变化的颜色
$("." + showTdByEdit).parent().css({'background-color': '#e6e6e6'});
},
form: form,
minData: 1
});
// 加载动态表单
dsFormUtil.loadPageByCode("dsFormShow", sysDsFormWithCodeType["putIsPurchase"]["code"], null);
matchingLanguage();
//商品规格加载变化事件
form.on('select(selectUnitProperty)', function(data) {
var thisRowValue = data.value;
var thisRowNum = data.elem.id.replace("unitId", "");//获取当前行
//当前当前行选中的商品信息
if(!isNull(thisRowValue) && thisRowValue != '请选择') {
var product = allChooseProduct["tr" + thisRowNum.toString()];
$.each(product.unitList, function(j, bean) {
if(thisRowValue == bean.id){//获取规格
//获取当前行数量
var rkNum = parseInt($("#rkNum" + thisRowNum).val());
$("#unitPrice" + thisRowNum).val(bean.estimatePurchasePrice.toFixed(2));//单价
return false;
}
});
} else {
$("#unitPrice" + thisRowNum).val("0.00");//重置单价为空
}
//加载库存
loadTockByDepotAndMUnit(thisRowNum, $("#depotId").val());
//计算价格
calculatedTotalPrice();
});
// 商品规格加载变化事件
mUnitChangeEvent(form);
// 仓库变化事件
form.on('select(depotId)', function(data) {
......@@ -119,50 +121,37 @@ layui.config({
});
function saveData(subType, approvalId) {
//获取已选商品数据
var rowTr = $("#useTable tr");
if(rowTr.length == 0) {
winui.window.msg('请选择商品.', {icon: 2, time: 2000});
var result = initTableChooseUtil.getDataList('productList');
if (!result.checkResult) {
return false;
}
var tableData = new Array();
var noError = false; //循环遍历表格数据时,是否有其他错误信息
$.each(rowTr, function(i, item) {
var noError = false;
var tableData = [];
$.each(result.dataList, function(i, item) {
//获取行编号
var rowNum = $(item).attr("trcusid").replace("tr", "");
//表格数量对象
var rkNum = $("#rkNum" + rowNum);
if(parseInt(rkNum.val()) == 0) {
rkNum.addClass("layui-form-danger");
rkNum.focus();
var thisRowKey = item["trcusid"].replace("tr", "");
if (parseInt(item.rkNum) == 0) {
$("#rkNum" + thisRowKey).addClass("layui-form-danger");
$("#rkNum" + thisRowKey).focus();
winui.window.msg('数量不能为0', {icon: 2, time: 2000});
noError = true;
return false;
}
//商品对象
var product = allChooseProduct["tr" + rowNum.toString()];
if(inTableDataArrayByAssetarId(product.productId, $("#unitId" + rowNum).val(), tableData)) {
var product = allChooseProduct["tr" + thisRowKey];
if (inTableDataArrayByAssetarId(product.productId, item.mUnitId, tableData)) {
winui.window.msg('一张单中不允许出现相同单位的商品信息.', {icon: 2, time: 2000});
noError = true;
return false;
}
var row = {
depotId: $("#depotId").val(),
materialId: $("#materialId" + rowNum).val(),
mUnitId: $("#unitId" + rowNum).val(),
rkNum: rkNum.val(),
unitPrice: $("#unitPrice" + rowNum).val(),
taxRate: $("#taxRate" + rowNum).val(),
taxMoney: $("#taxMoney" + rowNum).val(),
taxUnitPrice: $("#taxUnitPrice" + rowNum).val(),
taxLastMoney: $("#taxLastMoney" + rowNum).val(),
remark: $("#remark" + rowNum).val()
};
tableData.push(row);
item["materialId"] = product.productId;
item["depotId"] = $("#depotId").val();
tableData.push(item);
});
if(noError) {
if (noError) {
return false;
}
//获取其他费用
var rowPriceTr = $("#otherPriceTable tr");
var tablePriceData = new Array();
......@@ -202,58 +191,6 @@ layui.config({
}
/*********************** 商品表格操作 start ****************************/
//新增行
$("body").on("click", "#addRow", function() {
addRow();
});
//删除行
$("body").on("click", "#deleteRow", function() {
deleteRow();
//计算价格
calculatedTotalPrice();
});
//新增行
function addRow() {
var par = {
id: "row" + rowNum.toString(), //checkbox的id
trId: "tr" + rowNum.toString(), //行的id
materialId: "materialId" + rowNum.toString(), //商品id
unitId: "unitId" + rowNum.toString(), //规格id
currentTock: "currentTock" + rowNum.toString(), //库存id
rkNum: "rkNum" + rowNum.toString(), //数量id
unitPrice: "unitPrice" + rowNum.toString(), //单价id
amountOfMoney: "amountOfMoney" + rowNum.toString(), //金额id
taxRate: "taxRate" + rowNum.toString(), //税率id
taxMoney: "taxMoney" + rowNum.toString(), //税额id
taxUnitPrice: "taxUnitPrice" + rowNum.toString(), //含税单价id
taxLastMoney: "taxLastMoney" + rowNum.toString(), //含税合计id
remark: "remark" + rowNum.toString() //备注id
};
$("#useTable").append(getDataUseHandlebars(usetableTemplate, par));
form.render();
rowNum++;
//设置根据某列变化的颜色
$("." + showTdByEdit).parent().css({'background-color': '#e6e6e6'});
}
//删除行
function deleteRow() {
var checkRow = $("#useTable input[type='checkbox'][name='tableCheckRow']:checked");
if(checkRow.length > 0) {
$.each(checkRow, function(i, item) {
//删除allChooseProduct已选择的商品信息
var trId = $(item).parent().parent().attr("trcusid");
allChooseProduct[trId] = undefined;
//移除界面上的信息
$(item).parent().parent().remove();
});
} else {
winui.window.msg('请选择要删除的行', {icon: 2, time: 2000});
}
}
// 供应商选择
$("body").on("click", "#supplierNameSel", function (e) {
sysSupplierUtil.openSysSupplierChoosePage(function (supplierMation){
......@@ -261,22 +198,9 @@ layui.config({
});
});
//商品选择
$("body").on("click", ".chooseProductBtn", function (e) {
var trId = $(this).parent().parent().attr("trcusid");
erpOrderUtil.openMaterialChooseChoosePage(function (chooseProductMation) {
//获取表格行号
var thisRowNum = trId.replace("tr", "");
//商品赋值
allChooseProduct[trId] = chooseProductMation;
//表格商品名称赋值
$("#materialId" + thisRowNum.toString()).val(allChooseProduct[trId].productName + "(" + allChooseProduct[trId].productModel + ")");
//表格单位赋值
$("#unitId" + thisRowNum.toString()).html(getDataUseHandlebars(selOption, {rows: allChooseProduct[trId].unitList}));
form.render('select');
//计算价格
calculatedTotalPrice();
});
initChooseProductBtnEnent(form, function(trId, chooseProductMation) {
// 商品赋值
allChooseProduct[trId] = chooseProductMation;
});
/*********************** 商品表格操作 end ****************************/
......
......@@ -35,8 +35,8 @@
</div>
<div class="layui-form-item layui-col-xs12">
<label class="layui-form-label">列表项<i class="red">*</i></label>
<div class="layui-input-block">
<div class="winui-toolbar">
<div class="layui-input-block" id="productList">
<!--todo 待验证删除<div class="winui-toolbar">
<div class="winui-tool" style="text-align: left;">
<button id="addRow" class="winui-toolbtn" type="button"><i class="fa fa-plus" aria-hidden="true"></i>新增行</button>
<button id="deleteRow" class="winui-toolbtn" type="button"><i class="fa fa-trash-o" aria-hidden="true"></i>删除行</button>
......@@ -61,7 +61,7 @@
</thead>
<tbody id="useTable" class="insurance-table">
</tbody>
</table>
</table>-->
</div>
</div>
<div class="layui-form-item layui-col-xs3">
......@@ -164,7 +164,7 @@
</form>
</div>
<!-- usetableTemplate -->
<!-- todo 待验证删除 usetableTemplate
<script type="text/x-handlebars-template" id="usetableTemplate">
<tr trcusid="{{trId}}">
<td><input type="checkbox" rowId="{{id}}" lay-filter="checkboxProperty" name="tableCheckRow"/></td>
......@@ -183,7 +183,7 @@
<td><input type="text" class="layui-input change-input taxLastMoney" id="{{taxLastMoney}}" win-verify="required|money"/></td>
<td><input type="text" class="layui-input" id="{{remark}}"/></td>
</tr>
</script>
</script> -->
<!-- otherTemplate -->
<script type="text/x-handlebars-template" id="otherTemplate">
......
......@@ -6,43 +6,43 @@ var erpOrderUtil = {
* @param {} data
* @return {}
*/
getErpDetailUrl: function(data){
getErpDetailUrl: function(data) {
var url = "";
if(data.subType == 1){//采购入库---入库
if (data.subType == 1) {//采购入库---入库
url = "../../tpl/purchaseput/purchaseputdetails.html";
}else if(data.subType == 4){//其他入库---入库
} else if (data.subType == 4) {//其他入库---入库
url = "../../tpl/otherwarehous/otherwarehousdetails.html";
}else if(data.subType == 2){//销售退货---入库
} else if (data.subType == 2) {//销售退货---入库
url = "../../tpl/salesreturns/salesReturnsDetails.html";
}else if(data.subType == 6){//采购退货---出库
} else if (data.subType == 6) {//采购退货---出库
url = "../../tpl/purchasereturns/purchasereturnsdetails.html";
}else if(data.subType == 9){//其他出库---出库
} else if (data.subType == 9) {//其他出库---出库
url = "../../tpl/otheroutlets/otheroutletsdetails.html";
}else if(data.subType == 5){//销售出库---出库
} else if (data.subType == 5) {//销售出库---出库
url = "../../tpl/salesoutlet/salesoutletdetails.html";
}else if(data.subType == 8){//零售出库---出库
} else if (data.subType == 8) {//零售出库---出库
url = "../../tpl/retailoutlet/retailoutletdetails.html";
}else if(data.subType == 3){//零售退货---入库
} else if (data.subType == 3) {//零售退货---入库
url = "../../tpl/retailreturns/retailReturnsDetails.html";
}else if(data.subType == 12){//拆分单---其他,一进一出
} else if (data.subType == 12) {//拆分单---其他,一进一出
url = "../../tpl/splitlist/splitlistdetails.html";
}else if(data.subType == 13){//组装单---其他,一进一出
} else if (data.subType == 13) {//组装单---其他,一进一出
url = "../../tpl/assemblysheet/assemblysheetdetails.html";
}else if(data.subType == 14){//调拨单---其他,一进一出
} else if (data.subType == 14) {//调拨单---其他,一进一出
url = "../../tpl/allocation/allocationdetails.html";
}else if(data.subType == 15){//验收入库单
} else if (data.subType == 15) {//验收入库单
url = "";
}else if(data.subType == 16){//加工单
} else if (data.subType == 16) {//加工单
url = "../../tpl/erpMachin/erpMachinDetails.html";
}else if(data.subType == 17){//工序验收单
} else if (data.subType == 17) {//工序验收单
url = "";
}else if(data.subType == 18){//生产计划单
} else if (data.subType == 18) {//生产计划单
url = "../../tpl/erpProduction/erpProductionDetail.html";
}else if(data.subType == 19){//领料单
} else if (data.subType == 19) {//领料单
url = "../../tpl/erpPick/erpRequisitionDetails.html";
}else if(data.subType == 20){//补料单
} else if (data.subType == 20) {//补料单
url = "../../tpl/erpPick/erpPatchDetails.html";
}else if(data.subType == 21){//退料单
} else if (data.subType == 21) {//退料单
url = "../../tpl/erpPick/erpReturnDetails.html";
}
return url;
......@@ -54,17 +54,17 @@ var erpOrderUtil = {
* @param orderType 订单类型
* @returns {string} 1需要审核;2不需要审核
*/
getSubmitTypeByOrderType: function (orderType){
getSubmitTypeByOrderType: function (orderType) {
// 1需要审核;2不需要审核
var submitType = "";
AjaxPostUtil.request({url: flowableBasePath + "erpcommon004", params: {orderType: orderType}, method: "GET", type: 'json', callback: function(json) {
submitType = json.bean.needExamine;
}, async: false});
if(submitType == 1){
if (submitType == 1) {
$(".submitTypeIsOne").show();
$(".submitTypeIsTwo").hide();
}else if(submitType == 2){
} else if (submitType == 2) {
$(".submitTypeIsOne").hide();
$(".submitTypeIsTwo").show();
}
......@@ -77,16 +77,16 @@ var erpOrderUtil = {
* @param submitType 单据提交类型 1需要审核;2不需要审核
* @param state 单据状态
*/
orderEditPageSetBtnBySubmitType: function(submitType, state){
if(submitType == 1){
if(state == 0 || state == 3 || state == 5){
orderEditPageSetBtnBySubmitType: function(submitType, state) {
if (submitType == 1) {
if (state == 0 || state == 3 || state == 5) {
$(".formEditBean").removeClass("layui-hide");
$(".formSubOneBean").removeClass("layui-hide");
} else if(state == 1){
} else if (state == 1) {
$(".save").removeClass("layui-hide");
}
}else if(submitType == 2){
if(state != 1){
} else if (submitType == 2) {
if (state != 1) {
$(".formEditBean").removeClass("layui-hide");
$(".formSubTwoBean").removeClass("layui-hide");
}
......@@ -99,11 +99,11 @@ var erpOrderUtil = {
* @param id 订单id
* @param orderType 单据类型
*/
deleteOrderMation: function (id, orderType, callback){
deleteOrderMation: function (id, orderType, callback) {
layer.confirm(systemLanguage["com.skyeye.deleteOperationMsg"][languageType], {icon: 3, title: systemLanguage["com.skyeye.deleteOperation"][languageType]}, function(index) {
AjaxPostUtil.request({url: flowableBasePath + "erpcommon005", params: {rowId: id, orderType: orderType}, method: "DELETE", type: 'json', callback: function(json) {
winui.window.msg(systemLanguage["com.skyeye.deleteOperationSuccessMsg"][languageType], {icon: 1, time: 2000});
if(typeof(callback) == "function") {
if (typeof (callback) == "function") {
callback();
}
}});
......@@ -118,9 +118,9 @@ var erpOrderUtil = {
* @param submitType 单据提交类型 1.走工作流提交 2.直接提交
* @param pageUrl 该地址为activitiNameKey.json的key
*/
submitOrderMation: function (id, orderType, submitType, pageUrl, callback){
submitOrderMation: function (id, orderType, submitType, pageUrl, callback) {
layer.confirm('确认要提交吗?', { icon: 3, title: '提交操作' }, function (index) {
if(submitType == 1){
if (submitType == 1) {
activitiUtil.startProcess(pageUrl, function (approvalId) {
erpOrderUtil.submitOrderMationToData(id, orderType, approvalId, callback);
});
......@@ -130,7 +130,7 @@ var erpOrderUtil = {
});
},
submitOrderMationToData: function (id, orderType, approvalId, callback){
submitOrderMationToData: function (id, orderType, approvalId, callback) {
var params = {
rowId: id,
orderType: orderType,
......@@ -138,7 +138,7 @@ var erpOrderUtil = {
};
AjaxPostUtil.request({url: flowableBasePath + "erpcommon006", params: params, method: "PUT", type: 'json', callback: function(json) {
winui.window.msg("提交成功。", {icon: 1, time: 2000});
if(typeof(callback) == "function") {
if (typeof (callback) == "function") {
callback();
}
}});
......@@ -150,7 +150,7 @@ var erpOrderUtil = {
* @param processInstanceId 流程实例id
* @param orderType 单据类型
*/
revokeOrderMation: function (processInstanceId, orderType, callback){
revokeOrderMation: function (processInstanceId, orderType, callback) {
layer.confirm('确认要撤销吗?', { icon: 3, title: '撤销操作' }, function (index) {
var params = {
processInstanceId: processInstanceId,
......@@ -158,7 +158,7 @@ var erpOrderUtil = {
};
AjaxPostUtil.request({url: flowableBasePath + "erpcommon003", params: params, type: 'json', method: "PUT", callback: function(json) {
winui.window.msg("撤销成功。", {icon: 1, time: 2000});
if(typeof(callback) == "function") {
if (typeof(callback) == "function") {
callback();
}
}});
......@@ -171,19 +171,19 @@ var erpOrderUtil = {
* @param data
* @returns {string}
*/
getSubmitTypeName: function (data){
if(data.submitType == 1){
getSubmitTypeName: function (data) {
if (data.submitType == 1) {
return '工作流审批';
} else if(data.submitType == 2){
} else if (data.submitType == 2) {
return '自主提交';
}
return '';
},
getProcessInstanceIdBySubmitType: function (data){
if(data.submitType == 1){
getProcessInstanceIdBySubmitType: function (data) {
if (data.submitType == 1) {
return '<a lay-event="activitiProcessDetails" class="notice-title-click">' + data.processInstanceId + '</a>';
} else if(data.submitType == 2){
} else if (data.submitType == 2) {
return '不涉及';
}
return '';
......@@ -196,7 +196,7 @@ var erpOrderUtil = {
*/
getDepotList: function (callback){
AjaxPostUtil.request({url: flowableBasePath + "storehouse008", params: {}, type: 'json', method: "GET", callback: function(json) {
if(typeof(callback) == "function") {
if (typeof(callback) == "function") {
callback(json);
}
}, async: false});
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册