|
@@ -46,7 +46,7 @@ $(document).ready(() => {
|
|
|
for (const ggd in gclGatherData) {
|
|
|
gclGatherData[ggd].code = gclGatherData[ggd].b_code;
|
|
|
}
|
|
|
- // console.log(gclGatherData);
|
|
|
+ console.log(gclGatherData);
|
|
|
// 数组去重
|
|
|
for (const db of gclGatherData) {
|
|
|
const exist_index = dealBillList.findIndex(function (item) {
|
|
@@ -57,6 +57,7 @@ $(document).ready(() => {
|
|
|
}
|
|
|
}
|
|
|
const changeListData = gclGatherData.concat(dealBillList).sort(sortByCode);
|
|
|
+ console.log(changeListData);
|
|
|
// 先加载台账数据
|
|
|
let listHtml = '';
|
|
|
let list_index = 1;
|
|
@@ -217,6 +218,7 @@ $(document).ready(() => {
|
|
|
$('.title-main').removeClass('bg-warning');
|
|
|
$('#back-change-list').val($('#change-list').val());
|
|
|
$('#back-change-whitelist').val($('#change-whitelist').val());
|
|
|
+ back_changeInfo = changeInfo;
|
|
|
} else {
|
|
|
toastr.error(result.msg);
|
|
|
}
|
|
@@ -229,6 +231,7 @@ $(document).ready(() => {
|
|
|
$('.title-main').removeClass('bg-warning');
|
|
|
$('#change-list').val($('#back-change-list').val());
|
|
|
$('#change-whitelist').val($('#back-change-whitelist').val());
|
|
|
+ changeFormRemake();
|
|
|
tableDataRemake(changeListData);
|
|
|
// 重新绘制table
|
|
|
maketablelist();
|
|
@@ -545,6 +548,28 @@ $(document).ready(() => {
|
|
|
$('input[name="code"]').val(code);
|
|
|
});
|
|
|
|
|
|
+ // 记录变更信息操作
|
|
|
+ $('body').on('valuechange', '#change_form input[type="text"]', function (e, previous) {
|
|
|
+ changeInfo[$(this).attr('name')] = $(this).val();
|
|
|
+ judgeChange();
|
|
|
+ });
|
|
|
+ $('body').on('valuechange', '#change_form textarea', function (e, previous) {
|
|
|
+ changeInfo[$(this).attr('name')] = $(this).val();
|
|
|
+ judgeChange();
|
|
|
+ });
|
|
|
+ $('body').on('change', '#change_form select', function (e, previous) {
|
|
|
+ changeInfo[$(this).attr('name')] = $(this).val();
|
|
|
+ judgeChange();
|
|
|
+ });
|
|
|
+ $('body').on('click', '#change_form input[type="radio"]', function (e, previous) {
|
|
|
+ changeInfo[$(this).attr('name')] = $(this).val();
|
|
|
+ judgeChange();
|
|
|
+ });
|
|
|
+ $('body').on('click', '#change_form input[type="checkbox"]', function (e, previous) {
|
|
|
+ console.log($(this).val());
|
|
|
+ console.log($(this).attr('name'));
|
|
|
+ });
|
|
|
+
|
|
|
});
|
|
|
|
|
|
function tableDataRemake(changeListData) {
|
|
@@ -554,11 +579,18 @@ function tableDataRemake(changeListData) {
|
|
|
$('#code-list').html('');
|
|
|
// 根据已添加的清单显示
|
|
|
const changeList = $('#change-list').val().split('^_^');
|
|
|
- console.log(changeList);
|
|
|
if (changeList.length > 0 && changeList[0]) {
|
|
|
for (const cl of changeList) {
|
|
|
const clinfo = cl.split(';');
|
|
|
- const listinfo = changeListData[clinfo[8] - 1];
|
|
|
+ // console.log(clinfo);
|
|
|
+ const listinfo = changeListData.find(function (item) {
|
|
|
+ return item.b_code === clinfo[0] && item.name === clinfo[1] && item.unit_price === parseFloat(clinfo[4])
|
|
|
+ });
|
|
|
+ // if (listinfo === undefined) {
|
|
|
+ // toastr.warning('台账清单列表已不存在'+ clinfo[0] +',故删除之');
|
|
|
+ // continue;
|
|
|
+ // }
|
|
|
+ // console.log(listinfo);
|
|
|
$('#table-list-select tr[data-index="'+ clinfo[8] +'"]').addClass('table-success');
|
|
|
let pushbwmx = '0;0';
|
|
|
if (listinfo.leafXmjs !== undefined) {
|
|
@@ -581,6 +613,25 @@ function tableDataRemake(changeListData) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+function changeFormRemake() {
|
|
|
+ changeInfo = back_changeInfo;
|
|
|
+ $('#change_form input[name="code"]').val(changeInfo.code);
|
|
|
+ $('#change_form input[name="name"]').val(changeInfo.name);
|
|
|
+ $('#change_form input[name="peg"]').val(changeInfo.peg);
|
|
|
+ $('#change_form input[name="org_name"]').val(changeInfo.org_name);
|
|
|
+ $('#change_form input[name="org_code"]').val(changeInfo.org_code);
|
|
|
+ $('#change_form input[name="new_name"]').val(changeInfo.new_name);
|
|
|
+ $('#change_form input[name="new_code"]').val(changeInfo.new_code);
|
|
|
+ $('#change_form textarea[name="content"]').val(changeInfo.content);
|
|
|
+ $('#change_form textarea[name="basis"]').val(changeInfo.basis);
|
|
|
+ $('#change_form textarea[name="memo"]').val(changeInfo.memo);
|
|
|
+ $('#change_form select[name="type"]').val(changeInfo.type);
|
|
|
+ $('#change_form select[name="class"]').val(changeInfo.class);
|
|
|
+ $('#change_form select[name="quality"]').val(changeInfo.quality);
|
|
|
+ $('#change_form select[name="company"]').val(changeInfo.company);
|
|
|
+ $('#change_form input[name="charge"][value="'+ changeInfo.charge +'"]').prop('checked', true);
|
|
|
+}
|
|
|
+
|
|
|
//判断元素是否在数组中,相当于php的in_array();
|
|
|
function in_array(arr, obj) {
|
|
|
let i = arr.length;
|
|
@@ -794,6 +845,11 @@ function judgeChange() {
|
|
|
if ($('#change-whitelist').val() !== $('#back-change-whitelist').val()) {
|
|
|
change = true;
|
|
|
}
|
|
|
+ console.log(changeInfo);
|
|
|
+ console.log(back_changeInfo);
|
|
|
+ if (!isObjEqual(changeInfo, back_changeInfo)) {
|
|
|
+ change = true;
|
|
|
+ }
|
|
|
if (change) {
|
|
|
$('#show-save-btn').show();
|
|
|
$('.title-main').addClass('bg-warning');
|
|
@@ -802,3 +858,18 @@ function judgeChange() {
|
|
|
$('.title-main').removeClass('bg-warning');
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+function isObjEqual(o1,o2){
|
|
|
+ var props1 = Object.getOwnPropertyNames(o1);
|
|
|
+ var props2 = Object.getOwnPropertyNames(o2);
|
|
|
+ if (props1.length != props2.length) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ for (var i = 0,max = props1.length; i < max; i++) {
|
|
|
+ var propName = props1[i];
|
|
|
+ if (o1[propName] !== o2[propName]) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return true;
|
|
|
+}
|