采购和收入导入功能调整

dev_2.0.2
‘wangjiuyun 2024-12-20 11:01:17 +08:00
parent 010e81c32f
commit 2fdccaa30c
4 changed files with 83 additions and 23 deletions

View File

@ -764,14 +764,14 @@ function bindChangeableInput() {
$(".input-changeable-tax-rate").change(function () { $(".input-changeable-tax-rate").change(function () {
var taxRate = f2($(this).val()); var taxRate = f2($(this).val());
var rowVal = $(this).parent().parent().find(".input-changeable-total-tax-include").val() var rowVal = $(this).parent().parent().find(".input-changeable-total-tax-include").val()
$(this).parent().parent().find(".input-changeable-total-tax-exclude").val(f2Fixed(rowVal * (1 - (taxRate / 100)))); $(this).parent().parent().find(".input-changeable-total-tax-exclude").val(f2Fixed(rowVal / (1 + (taxRate / 100))));
$(this).parent().parent().find(".input-changeable-total-tax").val(f2Fixed(rowVal * (taxRate / 100))); $(this).parent().parent().find(".input-changeable-total-tax").val(f2Fixed(rowVal * (taxRate / 100)));
}); });
// 不含税金额改变 // 不含税金额改变
$(".input-changeable-total-tax-include").change(function () { $(".input-changeable-total-tax-include").change(function () {
var rowVal = f2($(this).val()); var rowVal = f2($(this).val());
var taxRate = $(this).parent().parent().find(".input-changeable-tax-rate").val() var taxRate = $(this).parent().parent().find(".input-changeable-tax-rate").val()
$(this).parent().parent().find(".input-changeable-total-tax-exclude").val(f2Fixed(rowVal * (1 - (taxRate / 100)))); $(this).parent().parent().find(".input-changeable-total-tax-exclude").val(f2Fixed(rowVal / (1 + (taxRate / 100))));
$(this).parent().parent().find(".input-changeable-total-tax").val(f2Fixed(rowVal * (taxRate / 100))); $(this).parent().parent().find(".input-changeable-total-tax").val(f2Fixed(rowVal * (taxRate / 100)));
}); });
} }

View File

@ -169,14 +169,14 @@ $(function () {
/** /**
* 采购成本增加一行 * 采购成本增加一行
*/ */
function appendTrCost() { function appendTrCost(dataRow) {
//console.log(SELECT_TYPE_CATEGORY_DATA); //console.log(SELECT_TYPE_CATEGORY_DATA);
var options = '<option value="xxxx" disabled selected>--请选择--</option>\r\n'; var options = '<option value="xxxx" disabled selected>--请选择--</option>\r\n';
SELECT_TYPE_CATEGORY_DATA.forEach(function (e) { SELECT_TYPE_CATEGORY_DATA.forEach(function (e) {
options += '<option value="' + e.id + '">' + e.name + '</option>\r\n'; options += '<option value="' + e.id + '">' + e.name + '</option>\r\n';
}); });
var template = '<tr>' + var template = '<tr class="costaddtr">' +
'<td width="60px"><input type="text" class="am-modal-prompt-input am-modal-prompt-input-cost input-budget-num" readonly></td>' + '<td width="60px"><input type="text" class="am-modal-prompt-input am-modal-prompt-input-cost input-budget-num" readonly></td>' +
'<td width="70px"><select style="float: left;" class="am-modal-prompt-input am-modal-prompt-input-cost am-modal-prompt-input-cost-type">' + '<td width="70px"><select style="float: left;" class="am-modal-prompt-input am-modal-prompt-input-cost am-modal-prompt-input-cost-type">' +
'<option value="xxxx" disabled selected>--请选择--</option>' + '<option value="xxxx" disabled selected>--请选择--</option>' +
@ -196,8 +196,8 @@ function appendTrCost() {
'<td width="100px"><input type="text" class="am-modal-prompt-input am-modal-prompt-input-cost input-changeable-total-tax-include input-changeable-total-tax-include-cost"></td>' + '<td width="100px"><input type="text" class="am-modal-prompt-input am-modal-prompt-input-cost input-changeable-total-tax-include input-changeable-total-tax-include-cost"></td>' +
'<td width="100px"><input type="text" class="am-modal-prompt-input am-modal-prompt-input-cost input-changeable-total-tax-exclude input-changeable-total-tax-exclude-cost" readonly></td>' + '<td width="100px"><input type="text" class="am-modal-prompt-input am-modal-prompt-input-cost input-changeable-total-tax-exclude input-changeable-total-tax-exclude-cost" readonly></td>' +
'<td width="100px"><input type="text" class="am-modal-prompt-input am-modal-prompt-input-cost input-changeable-total-tax input-changeable-total-tax-cost" readonly></td>' + '<td width="100px"><input type="text" class="am-modal-prompt-input am-modal-prompt-input-cost input-changeable-total-tax input-changeable-total-tax-cost" readonly></td>' +
'<td width="100px"><input type="text" class="am-modal-prompt-input am-modal-prompt-input-cost" ></td>\n' + '<td width="100px"><input type="text" class="am-modal-prompt-input am-modal-prompt-input-cost am-modal-prompt-input-cost-contractParty" ></td>\n' +
'<td width="100px"><input type="text" class="am-modal-prompt-input am-modal-prompt-input-cost" ></td>\n' + '<td width="100px"><input type="text" class="am-modal-prompt-input am-modal-prompt-input-cost am-modal-prompt-input-cost-remark" ></td>\n' +
'<td width="60px"><button type="button" style="margin-top: 10px" class="am-btn am-btn-danger am-btn-xs am-round am-modal-line-delete"><span class="am-icon-minus"></span></button></td>' + '<td width="60px"><button type="button" style="margin-top: 10px" class="am-btn am-btn-danger am-btn-xs am-round am-modal-line-delete"><span class="am-icon-minus"></span></button></td>' +
'</tr>'; '</tr>';
@ -220,6 +220,9 @@ function appendTrCost() {
if ($('#costTable').find('tbody') && $('#costTable').find('tbody')[0]) { if ($('#costTable').find('tbody') && $('#costTable').find('tbody')[0]) {
$('#costTable').find('tbody')[0].scrollTop = $('#costTable').find('tbody')[0].scrollHeight $('#costTable').find('tbody')[0].scrollTop = $('#costTable').find('tbody')[0].scrollHeight
} }
if(dataRow.type){
initRowDataCost(dataRow)
}
} }
/** /**
@ -476,5 +479,25 @@ function initTypeCategory(params, data) {
// console.log(SELECT_TYPE_CATEGORY_MAP_DATA); // console.log(SELECT_TYPE_CATEGORY_MAP_DATA);
// console.log(SELECT_TYPE_CATEGORY_DATA); // console.log(SELECT_TYPE_CATEGORY_DATA);
// console.log(SELECT_CATEGORY_TYPE_MAP_DATA); // console.log(SELECT_CATEGORY_TYPE_MAP_DATA);
}
function initRowDataCost(data){
$('#costTable tbody .costaddtr:last').find('.am-modal-prompt-input-cost-type').val(data.type)
if(data.category!='华智产品'&&data.category!='华三产品'&&data.category!='汇智产品' ){
$('#costTable tbody .costaddtr:last').find('.input-changeable-tax-rate-cost-select').val('自定义')
$('#costTable tbody .costaddtr:last').find('.input-changeable-tax-rate-cost-select')
$('#costTable tbody .costaddtr:last').find('.input-changeable-tax-rate-cost-name').val(data.category)
$('#costTable tbody .costaddtr:last').find('.input-changeable-tax-rate-cost-name').trigger('change')
}else{
$('#costTable tbody .costaddtr:last').find('.input-changeable-tax-rate-cost-select').val(data.category)
}
$('#costTable tbody .costaddtr:last').find('.input-changeable-tax-rate-cost').val(data.taxRate)
$('#costTable tbody .costaddtr:last').find('.input-changeable-total-tax-include-cost').val(data.totalTaxInclude)
$('#costTable tbody .costaddtr:last').find('.input-changeable-total-tax-exclude-cost').val(data.totalTaxExclude)
$('#costTable tbody .costaddtr:last').find('.input-changeable-total-tax-cost').val(data.totalTax)
$('#costTable tbody .costaddtr:last').find('.am-modal-prompt-input-cost-contractParty').val(data.contractParty)
$('#costTable tbody .costaddtr:last').find('.am-modal-prompt-input-cost-remark').val(data.remark)
$('#costTable tbody .costaddtr:last').find('.input-changeable-total-tax-include-cost').trigger('change')
} }

View File

@ -157,8 +157,8 @@ function updateIncomeData(data, returnData) {
/** /**
* 收入明细增加一行 * 收入明细增加一行
*/ */
function appendTrIncome() { function appendTrIncome(dataRow) {
var template = '<tr>\n' + var template = '<tr class="incomeaddtr">\n' +
' <td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-income input-budget-num" readonly></td>\n' + ' <td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-income input-budget-num" readonly></td>\n' +
' <td width="100px">\n' + ' <td width="100px">\n' +
' <select style="float: left;" class="am-modal-prompt-input am-modal-prompt-input-income am-modal-prompt-input-income-type">\n' + ' <select style="float: left;" class="am-modal-prompt-input am-modal-prompt-input-income am-modal-prompt-input-income-type">\n' +
@ -192,6 +192,9 @@ function appendTrIncome() {
if ($('#incomeTable').find('tbody') && $('#incomeTable').find('tbody')[0]) { if ($('#incomeTable').find('tbody') && $('#incomeTable').find('tbody')[0]) {
$('#incomeTable').find('tbody')[0].scrollTop = $('#incomeTable').find('tbody')[0].scrollHeight $('#incomeTable').find('tbody')[0].scrollTop = $('#incomeTable').find('tbody')[0].scrollHeight
} }
if(dataRow.type){
initRowData(dataRow)
}
} }
/** /**
@ -261,6 +264,22 @@ function bindTypeSelectChangeIncome() {
nameSelect.attr("style", "display:block"); nameSelect.attr("style", "display:block");
nameInput.attr("type", "hidden"); nameInput.attr("type", "hidden");
}) })
}
function initRowData(data){
$('#incomeTable tbody .incomeaddtr:last').find('.am-modal-prompt-input-income-type').val(data.type)
if(data.name!='华智产品'&&data.name!='华三产品'&&data.name!='汇智产品' ){
$('#incomeTable tbody .incomeaddtr:last').find('.input-changeable-tax-rate-income-select').val('自定义')
$('#incomeTable tbody .incomeaddtr:last').find('.input-changeable-tax-rate-income-select')
$('#incomeTable tbody .incomeaddtr:last').find('.input-changeable-tax-rate-income-name').val(data.name)
$('#incomeTable tbody .incomeaddtr').last().find('.input-changeable-tax-rate-income-select').trigger('change')
}else{
$('#incomeTable tbody .incomeaddtr:last').find('.input-changeable-tax-rate-income-select').val(data.name)
}
$('#incomeTable tbody .incomeaddtr:last').find('.input-changeable-tax-rate-income').val(data.taxRate)
$('#incomeTable tbody .incomeaddtr:last').find('.input-changeable-total-tax-include-income').val(data.totalTaxInclude)
$('#incomeTable tbody .incomeaddtr:last').find('.input-changeable-total-tax-exclude-income').val(data.totalTaxExclude)
$('#incomeTable tbody .incomeaddtr:last').find('.input-changeable-total-tax-income').val(data.totalTax)
$('#incomeTable tbody .incomeaddtr:last').find('.input-changeable-total-tax-include-income').trigger('change')
} }

View File

@ -908,10 +908,11 @@
<button type="button" id="bt_import" class="am-btn am-btn-default"> <button type="button" id="bt_import" class="am-btn am-btn-default">
<span class="am-icon-archive"></span> <span class="am-icon-archive"></span>
批量导入 批量导入
<input id="doc-form-file" type="file" name="file"
onChange="ajaxUploadFile('doc-form-file','${base}/project/batchIncomeImport?id=' + ${project.id})">
</button> </button>
<input id="doc-form-file" type="file" name="file" </div>
onChange="ajaxUploadFile('doc-form-file','${base}/project/batchIncomeImport?id=' + ${project.id})">
</div>
<button type="button" class="am-btn am-btn-default" <button type="button" class="am-btn am-btn-default"
onclick="location.href='${base}/project/incomeTemplate'"> onclick="location.href='${base}/project/incomeTemplate'">
@ -1131,10 +1132,11 @@
<button type="button" id="bt_import" class="am-btn am-btn-default"> <button type="button" id="bt_import" class="am-btn am-btn-default">
<span class="am-icon-archive"></span> <span class="am-icon-archive"></span>
批量导入 批量导入
<input id="doc-form-file2" type="file" name="file"
onChange="ajaxUploadFile2('doc-form-file2','${base}/project/batchCostImport?id=' + ${project.id})">
</button> </button>
<input id="doc-form-file2" type="file" name="file" </div>
onChange="ajaxUploadFile2('doc-form-file2','${base}/project/batchCostImport?id=' + ${project.id})">
</div>
<button type="button" class="am-btn am-btn-default" <button type="button" class="am-btn am-btn-default"
onclick="location.href='${base}/project/costTemplate'"> onclick="location.href='${base}/project/costTemplate'">
@ -2410,16 +2412,21 @@
fileElementId: id,// file标签的id fileElementId: id,// file标签的id
dataType: 'json',// 返回数据的类型 dataType: 'json',// 返回数据的类型
success: function (data, status) { success: function (data, status) {
console.log("--------success---------" , data)
// if($('#modal')){ // if($('#modal')){
// $('#modal').modal('close'); // $('#modal').modal('close');
// $('#span-'+id).html("导入完成"); // $('#span-'+id).html("导入完成");
// } // }
if (data.status == 0) { if (data.status == 0) {
var list = data.data; var list = [...data.data.successList.map((ele)=> {
ele.result = ele.name + '(成功)'
return ele
}),...data.data.errorList.map((ele)=> {
ele.result = ele.name + '(失败)'
return ele
})];
var content = ''; var content = '';
$.each(list, function (i, r) { $.each(list, function (i, r) {
content += (i + 1) + '、' + r + '<br>'; content += (i + 1) + '、' + r.result + '<br>';
}); });
console.log('---> ' + content); console.log('---> ' + content);
parent.layer.open({ parent.layer.open({
@ -2429,13 +2436,16 @@
} else { } else {
parent.layer.msg(data.msg); parent.layer.msg(data.msg);
} }
data.data.successList.forEach((ele)=>{
appendTrIncome(ele)
window.location.reload(); })
// window.location.reload();
$("#" + id).val(""); $("#" + id).val("");
}, },
error: function (data, status, e) { error: function (data, status, e) {
console.log("--------error---------" + data) console.log("--------error---------" + data)
layer.alert("-----------------" + data); // layer.alert("-----------------" + data);
// if ($('#modal')) { // if ($('#modal')) {
// $('#modal').modal('close'); // $('#modal').modal('close');
// } // }
@ -2456,16 +2466,22 @@
fileElementId: id,// file标签的id fileElementId: id,// file标签的id
dataType: 'json',// 返回数据的类型 dataType: 'json',// 返回数据的类型
success: function (data, status) { success: function (data, status) {
console.log("--------success---------" + data) console.log("--------success---------" ,JSON.stringify(data.data))
// if($('#modal')){ // if($('#modal')){
// $('#modal').modal('close'); // $('#modal').modal('close');
// $('#span-'+id).html("导入完成"); // $('#span-'+id).html("导入完成");
// } // }
if (data.status == 0) { if (data.status == 0) {
var list = data.data; var list = [...data.data.successList.map((ele)=> {
ele.result = ele.category + '(成功)'
return ele
}),...data.data.errorList.map((ele)=> {
ele.result = ele.category + '(失败)'
return ele
})];
var content = ''; var content = '';
$.each(list, function (i, r) { $.each(list, function (i, r) {
content += (i + 1) + '、' + r + '<br>'; content += (i + 1) + '、' + r.result + '<br>';
}); });
console.log('---> ' + content); console.log('---> ' + content);
parent.layer.open({ parent.layer.open({
@ -2475,8 +2491,10 @@
} else { } else {
parent.layer.msg(data.msg); parent.layer.msg(data.msg);
} }
data.data.successList.forEach((ele)=>{
appendTrCost(ele)
window.location.reload(); })
$("#" + id).val(""); $("#" + id).val("");
}, },
error: function (data, status, e) { error: function (data, status, e) {