From e63bb49d3df6d4469660c2914411ea44403e6271 Mon Sep 17 00:00:00 2001
From: weizhiqiang <598748873@qq.com>
Date: Sun, 14 Aug 2022 15:26:22 +0800
Subject: [PATCH] =?UTF-8?q?=E3=80=90ERP=E3=80=91=E5=85=B6=E4=BB=96?=
=?UTF-8?q?=E5=87=BA=E5=BA=93=E5=8D=95=E6=95=B4=E6=94=B9=E5=AE=8C=E6=88=90?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../js/otheroutlets/otheroutletsadd.js | 200 +++++---------
.../js/otheroutlets/otheroutletsedit.js | 246 +++++++-----------
.../template/js/purchaseput/purchaseputadd.js | 3 -
.../js/purchaseput/purchaseputedit.js | 5 +-
.../tpl/otheroutlets/otheroutletsadd.html | 56 +---
.../tpl/otheroutlets/otheroutletsedit.html | 54 +---
6 files changed, 159 insertions(+), 405 deletions(-)
diff --git a/erp/src/main/resources/template/js/otheroutlets/otheroutletsadd.js b/erp/src/main/resources/template/js/otheroutlets/otheroutletsadd.js
index 33292d881..537c18902 100644
--- a/erp/src/main/resources/template/js/otheroutlets/otheroutletsadd.js
+++ b/erp/src/main/resources/template/js/otheroutlets/otheroutletsadd.js
@@ -1,10 +1,8 @@
-//已经选择的客户信息
+// 已经选择的客户信息
var customerMation = {};
-//根据那一列的值进行变化,默认根据数量
+// 根据那一列的值进行变化,默认根据数量
var showTdByEdit = 'rkNum';
-//表格的序号
-var rowNum = 1;
// 兼容动态表单
var layedit, form;
@@ -24,9 +22,8 @@ layui.config({
layedit = layui.layedit,
form = layui.form;
- var usetableTemplate = $("#usetableTemplate").html();
var selOption = getFileContent('tpl/template/select-option.tpl');
- //已经选择的商品集合key:表格的行trId,value:商品信息
+ // 已经选择的商品集合key:表格的行trId,value:商品信息
var allChooseProduct = {};
// 获取单据提交类型
@@ -39,47 +36,54 @@ layui.config({
// 初始化账户
systemCommonUtil.getSysAccountListByType(function (json) {
- // 加载账户数据
$("#accountId").html(getDataUseHandlebars(selOption, json));
});
// 初始化仓库
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["outIsOthers"]["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.salePrice.toFixed(2));//单价
- $("#amountOfMoney" + thisRowNum).val((rkNum * parseFloat(bean.salePrice)).toFixed(2));//金额
- return false;
- }
- });
- } else {
- $("#unitPrice" + thisRowNum).val("0.00");//重置单价为空
- $("#amountOfMoney" + thisRowNum).val("0.00");//重置金额为空
- }
- //加载库存
- loadTockByDepotAndMUnit(thisRowNum, $("#depotId").val());
- //计算价格
- calculatedTotalPrice();
+ // 商品规格加载变化事件
+ mUnitChangeEvent(form, allChooseProduct, "salePrice");
+
+ // 仓库变化事件
+ form.on('select(depotId)', function(data) {
+ loadMaterialDepotStockByDepotId(data.value);
});
// 保存为草稿
@@ -109,59 +113,41 @@ layui.config({
});
function saveData(subType, approvalId) {
- if(isNull(customerMation.id)){
- winui.window.msg('请选择客户.', {icon: 2, time: 2000});
+ var result = initTableChooseUtil.getDataList('productList');
+ if (!result.checkResult) {
return false;
}
- //获取已选商品数据
- var rowTr = $("#useTable tr");
- if(rowTr.length == 0) {
- winui.window.msg('请选择商品.', {icon: 2, time: 2000});
- 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;
}
- if(parseInt(rkNum.val()) > parseInt($("#currentTock" + rowNum).html())){
- rkNum.addClass("layui-form-danger");
- rkNum.focus();
+ if (parseInt(item.rkNum) > parseInt($("#currentTock" + thisRowKey).html())) {
+ $("#rkNum" + thisRowKey).addClass("layui-form-danger");
+ $("#rkNum" + thisRowKey).focus();
winui.window.msg('超过库存数量.', {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;
}
@@ -186,59 +172,7 @@ layui.config({
}});
}
- //新增行
- $("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", "#customMationSel", function (e) {
_openNewWindows({
url: "../../tpl/customermanage/customerChoose.html",
@@ -250,22 +184,10 @@ 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;
});
$("body").on("click", "#cancle", function() {
diff --git a/erp/src/main/resources/template/js/otheroutlets/otheroutletsedit.js b/erp/src/main/resources/template/js/otheroutlets/otheroutletsedit.js
index e1968b641..cffbe506f 100644
--- a/erp/src/main/resources/template/js/otheroutlets/otheroutletsedit.js
+++ b/erp/src/main/resources/template/js/otheroutlets/otheroutletsedit.js
@@ -1,10 +1,8 @@
-//已经选择的客户信息
+// 已经选择的客户信息
var customerMation = {};
-//根据那一列的值进行变化,默认根据数量
+// 根据那一列的值进行变化,默认根据数量
var showTdByEdit = 'rkNum';
-//表格的序号
-var rowNum = 1;
// 兼容动态表单
var layedit, form;
@@ -24,7 +22,6 @@ layui.config({
layedit = layui.layedit,
form = layui.form;
- var usetableTemplate = $("#usetableTemplate").html();
var selOption = getFileContent('tpl/template/select-option.tpl');
//已经选择的商品集合key:表格的行trId,value:商品信息
var allChooseProduct = {};
@@ -37,13 +34,11 @@ layui.config({
// 初始化账户
systemCommonUtil.getSysAccountListByType(function (json) {
- // 加载账户数据
$("#accountId").html(getDataUseHandlebars(selOption, json));
});
// 初始化仓库
erpOrderUtil.getDepotList(function (json){
- // 加载仓库数据
$("#depotId").html(getDataUseHandlebars(selOption, json));
// 渲染数据到页面
initDataToShow();
@@ -73,30 +68,34 @@ layui.config({
$("#discountLastMoney").html(json.bean.discountLastMoney.toFixed(2));
$("#changeAmount").val(json.bean.changeAmount.toFixed(2));
$("#arrears").html(json.bean.arrears.toFixed(2));
- //渲染列表项
- $.each(json.bean.norms, function(i, item){
- addRow();
- if(i == 0){
+
+ initTable();
+
+ // 回显商品列表
+ initTableChooseUtil.deleteAllRow('productList');
+ $.each(json.bean.norms, function(i, item) {
+ if (i == 0) {
$("#depotId").val(item.depotId);
}
- //将规格所属的商品信息加入到对象中存储
- allChooseProduct["tr" + (rowNum - 1)] = item.product;
- //单位回显
- $("#unitId" + (rowNum - 1)).html(getDataUseHandlebars(selOption, {rows: item.product.unitList}));
- $("#unitId" + (rowNum - 1)).val(item.mUnitId);
- //商品回显
- $("#materialId" + (rowNum - 1)).val(item.product.productName + "(" + item.product.productModel + ")");
- //库存回显
- $("#currentTock" + (rowNum - 1)).html(item.currentTock);
- //数量回显
- $("#rkNum" + (rowNum - 1)).val(item.operNum);
- $("#unitPrice" + (rowNum - 1)).val(item.unitPrice.toFixed(2));
- $("#amountOfMoney" + (rowNum - 1)).val(item.allPrice.toFixed(2));
- $("#taxRate" + (rowNum - 1)).val(item.taxRate.toFixed(2));
- $("#taxMoney" + (rowNum - 1)).val(item.taxMoney.toFixed(2));
- $("#taxUnitPrice" + (rowNum - 1)).val(item.taxUnitPrice.toFixed(2));
- $("#taxLastMoney" + (rowNum - 1)).val(item.taxLastMoney.toFixed(2));
- $("#remark" + (rowNum - 1)).val(item.remark);
+ var params = {
+ "materialId": item.product.productName + "(" + item.product.productModel + ")",
+ "mUnitId": {
+ "html": getDataUseHandlebars(selOption, {rows: item.product.unitList}),
+ "value": item.mUnitId
+ },
+ "currentTock": item.currentTock,
+ "rkNum": item.operNum,
+ "unitPrice": item.unitPrice.toFixed(2),
+ "amountOfMoney": item.allPrice.toFixed(2),
+ "taxRate": item.taxRate.toFixed(2),
+ "taxMoney": item.taxMoney.toFixed(2),
+ "taxUnitPrice": item.taxUnitPrice.toFixed(2),
+ "taxLastMoney": item.taxLastMoney.toFixed(2),
+ "remark": item.remark
+ };
+ var trcusid = initTableChooseUtil.resetData('productList', params);
+ // 将规格所属的商品信息加入到对象中存储
+ allChooseProduct[trcusid] = item.product;
});
erpOrderUtil.orderEditPageSetBtnBySubmitType(submitType, json.bean.state);
@@ -111,31 +110,44 @@ layui.config({
}});
}
- //商品规格加载变化事件
- 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.salePrice.toFixed(2));//单价
- $("#amountOfMoney" + thisRowNum).val((rkNum * parseFloat(bean.salePrice)).toFixed(2));//金额
- return false;
- }
- });
- } else {
- $("#unitPrice" + thisRowNum).val("0.00");//重置单价为空
- $("#amountOfMoney" + thisRowNum).val("0.00");//重置金额为空
- }
+ function initTable() {
+ // 商品
+ 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'});
+ calculatedTotalPrice();
+ },
+ form: form,
+ minData: 1
+ });
+ }
+
+ // 商品规格加载变化事件
+ mUnitChangeEvent(form, allChooseProduct, "estimatePurchasePrice");
- //加载库存
- loadTockByDepotAndMUnit(thisRowNum, $("#depotId").val());
- //计算价格
- calculatedTotalPrice();
+ // 仓库变化事件
+ form.on('select(depotId)', function(data) {
+ loadMaterialDepotStockByDepotId(data.value);
});
// 保存为草稿
@@ -173,59 +185,41 @@ layui.config({
});
function saveData(subType, approvalId) {
- if(isNull(customerMation.id)){
- winui.window.msg('请选择客户.', {icon: 2, time: 2000});
+ var result = initTableChooseUtil.getDataList('productList');
+ if (!result.checkResult) {
return false;
}
- //获取已选商品数据
- var rowTr = $("#useTable tr");
- if(rowTr.length == 0) {
- winui.window.msg('请选择商品.', {icon: 2, time: 2000});
- 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;
}
- if(parseInt(rkNum.val()) > parseInt($("#currentTock" + rowNum).html())){
- rkNum.addClass("layui-form-danger");
- rkNum.focus();
+ if (parseInt(item.rkNum) > parseInt($("#currentTock" + thisRowKey).html())) {
+ $("#rkNum" + thisRowKey).addClass("layui-form-danger");
+ $("#rkNum" + thisRowKey).focus();
winui.window.msg('超过库存数量.', {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;
}
@@ -251,59 +245,7 @@ layui.config({
}});
}
- //新增行
- $("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", "#customMationSel", function (e) {
_openNewWindows({
url: "../../tpl/customermanage/customerChoose.html",
@@ -315,22 +257,10 @@ 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;
});
$("body").on("click", "#cancle", function() {
diff --git a/erp/src/main/resources/template/js/purchaseput/purchaseputadd.js b/erp/src/main/resources/template/js/purchaseput/purchaseputadd.js
index 7ba849572..37776d521 100644
--- a/erp/src/main/resources/template/js/purchaseput/purchaseputadd.js
+++ b/erp/src/main/resources/template/js/purchaseput/purchaseputadd.js
@@ -36,19 +36,16 @@ layui.config({
// 初始化账户
systemCommonUtil.getSysAccountListByType(function (json) {
- // 加载账户数据
$("#accountId").html(getDataUseHandlebars(selOption, json));
});
// 初始化支出项目
systemCommonUtil.getSysInoutitemListByType(2, function (json) {
- // 加载支出项目
inoutitemHtml = getDataUseHandlebars(selOption, json);
});
// 初始化仓库
erpOrderUtil.getDepotList(function (json){
- // 加载仓库数据
$("#depotId").html(getDataUseHandlebars(selOption, json));
});
diff --git a/erp/src/main/resources/template/js/purchaseput/purchaseputedit.js b/erp/src/main/resources/template/js/purchaseput/purchaseputedit.js
index 2984403f4..1f8acab4a 100644
--- a/erp/src/main/resources/template/js/purchaseput/purchaseputedit.js
+++ b/erp/src/main/resources/template/js/purchaseput/purchaseputedit.js
@@ -34,25 +34,22 @@ layui.config({
// 初始化账户
systemCommonUtil.getSysAccountListByType(function (json) {
- // 加载账户数据
$("#accountId").html(getDataUseHandlebars(selOption, json));
});
// 初始化支出项目
systemCommonUtil.getSysInoutitemListByType(2, function (json) {
- // 加载支出项目
inoutitemHtml = getDataUseHandlebars(selOption, json);
});
// 初始化仓库
erpOrderUtil.getDepotList(function (json){
- // 加载仓库数据
$("#depotId").html(getDataUseHandlebars(selOption, json));
// 初始化回显数据
initDataShow();
});
- //初始化回显数据
+ // 初始化回显数据
function initDataShow(){
AjaxPostUtil.request({url: flowableBasePath + "purchaseput003", params: {rowId: parent.rowId}, type: 'json', method: "GET", callback: function(json) {
submitType = json.bean.submitType;
diff --git a/erp/src/main/resources/template/tpl/otheroutlets/otheroutletsadd.html b/erp/src/main/resources/template/tpl/otheroutlets/otheroutletsadd.html
index f635e6c2b..4e422f4cf 100644
--- a/erp/src/main/resources/template/tpl/otheroutlets/otheroutletsadd.html
+++ b/erp/src/main/resources/template/tpl/otheroutlets/otheroutletsadd.html
@@ -12,7 +12,7 @@
@@ -25,40 +25,15 @@
-
-
-
-
+
diff --git a/erp/src/main/resources/template/tpl/otheroutlets/otheroutletsedit.html b/erp/src/main/resources/template/tpl/otheroutlets/otheroutletsedit.html
index ba7a5881b..1807e174c 100644
--- a/erp/src/main/resources/template/tpl/otheroutlets/otheroutletsedit.html
+++ b/erp/src/main/resources/template/tpl/otheroutlets/otheroutletsedit.html
@@ -12,7 +12,7 @@
@@ -25,40 +25,15 @@