|
@@ -116,6 +116,7 @@ $(document).ready(() => {
|
|
|
const xmjs = [];
|
|
|
if (data && data.id) {
|
|
|
xmjs.push({
|
|
|
+ deal_id: data.id,
|
|
|
cid: '',
|
|
|
is_change: _.findIndex(changeList, { lid: data.id }) !== -1 ? 1 : 0,
|
|
|
code: '',
|
|
@@ -129,6 +130,8 @@ $(document).ready(() => {
|
|
|
} else if (data && data.leafXmjs) {
|
|
|
for (const leaf of data.leafXmjs) {
|
|
|
xmjs.push({
|
|
|
+ gcl_id: leaf.gcl_id,
|
|
|
+ mx_id: leaf.mx_id || '',
|
|
|
is_change: _.findIndex(changeList, { gcl_id: leaf.gcl_id, mx_id: leaf.mx_id || '' }) !== -1 ? 1 : 0,
|
|
|
cid: leaf.cid || '',
|
|
|
code: leaf.code,
|
|
@@ -147,6 +150,7 @@ $(document).ready(() => {
|
|
|
selectionChanged: function (e, info) {
|
|
|
const data = SpreadJsObj.getSelectObject(info.sheet);
|
|
|
gclSpreadObj.resetXmjSpread(data);
|
|
|
+ xmjSearch.searchAndLocate($('#xmj-keyword').val());
|
|
|
}
|
|
|
};
|
|
|
|
|
@@ -188,7 +192,151 @@ $(document).ready(() => {
|
|
|
readOnly: {
|
|
|
isChangeList: function (data) {
|
|
|
if (!data) return true;
|
|
|
- return !readOnly;
|
|
|
+ return readOnly;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
+ const xmjSpreadObj = {
|
|
|
+ buttonClicked: function (e, info) {
|
|
|
+ if (info.sheet.zh_setting) {
|
|
|
+ const select = SpreadJsObj.getSelectObject(info.sheet);
|
|
|
+ const col = info.sheet.zh_setting.cols[info.col];
|
|
|
+ if (col.field === 'is_change') {
|
|
|
+ if (xmjCol.readOnly.isChangeList(select)) {
|
|
|
+ info.sheet.setValue(info.row, info.col, !select || !select.is_change ? 0 : 1);
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if (info.sheet.isEditing()) {
|
|
|
+ info.sheet.endEdit(true);
|
|
|
+ }
|
|
|
+ const is_change = info.sheet.getValue(info.row, info.col) ? 1 : 0;
|
|
|
+ let gclIndex = -1;
|
|
|
+ let gclInfo = null;
|
|
|
+ if (select.deal_id) {
|
|
|
+ gclInfo = _.find(changeListData, function (item) {
|
|
|
+ return item.id && item.id === select.deal_id; });
|
|
|
+ gclIndex =_.findIndex(changeListData, function (item) {
|
|
|
+ return item.id && item.id === select.deal_id; });
|
|
|
+ } else {
|
|
|
+ gclInfo = _.find(changeListData, function (item) {
|
|
|
+ return item.leafXmjs && _.find(item.leafXmjs, function (item2) {
|
|
|
+ return item2.gcl_id === select.gcl_id && (item2.mx_id === undefined || item2.mx_id === select.mx_id) });
|
|
|
+ });
|
|
|
+ gclIndex = _.findIndex(changeListData, function (item) {
|
|
|
+ return item.leafXmjs && _.find(item.leafXmjs, function (item2) {
|
|
|
+ return item2.gcl_id === select.gcl_id && (item2.mx_id === undefined || item2.mx_id === select.mx_id) });
|
|
|
+ });
|
|
|
+ }
|
|
|
+ console.log(gclIndex);
|
|
|
+ if (!gclInfo) {
|
|
|
+ info.sheet.setValue(info.row, info.col, 0);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (is_change) {
|
|
|
+ const oldCInfo = select.deal_id ? _.find(oldChangeList, { lid: select.deal_id }) : _.find(oldChangeList, { gcl_id: select.gcl_id, mx_id: select.mx_id });
|
|
|
+ const data = {};
|
|
|
+ if (oldCInfo) {
|
|
|
+ data.detail = oldCInfo.detail;
|
|
|
+ data.camount = oldCInfo.camount;
|
|
|
+ data.spamount = oldCInfo.spamount;
|
|
|
+ data.is_valuation = oldCInfo.is_valuation;
|
|
|
+ data.delimit = oldCInfo.delimit;
|
|
|
+ }
|
|
|
+ if (select.deal_id) {
|
|
|
+ const newData = {
|
|
|
+ lid: select.deal_id,
|
|
|
+ code: gclInfo.code,
|
|
|
+ name: gclInfo.name,
|
|
|
+ unit: gclInfo.unit,
|
|
|
+ unit_price: gclInfo.unit_price,
|
|
|
+ oamount: gclInfo.quantity ? parseFloat(gclInfo.quantity) : 0,
|
|
|
+ oamount2: oldCInfo ? oldCInfo.oamount2 : gclInfo.quantity ? parseFloat(gclInfo.quantity) : 0,
|
|
|
+ bwmx: '',
|
|
|
+ xmj_code: '',
|
|
|
+ xmj_jldy: '',
|
|
|
+ xmj_dwgc: '',
|
|
|
+ xmj_fbgc: '',
|
|
|
+ xmj_fxgc: '',
|
|
|
+ gcl_id: '',
|
|
|
+ mx_id: '',
|
|
|
+ }
|
|
|
+ _.assign(data, newData);
|
|
|
+ } else {
|
|
|
+ const xmjInfo = _.find(gclInfo.leafXmjs, function (item) {
|
|
|
+ return item.gcl_id === select.gcl_id && (item.mx_id === undefined || item.mx_id === select.mx_id);
|
|
|
+ });
|
|
|
+ const newData = {
|
|
|
+ lid: select.gcl_id,
|
|
|
+ code: gclInfo.b_code,
|
|
|
+ name: gclInfo.name,
|
|
|
+ unit: gclInfo.unit,
|
|
|
+ unit_price: gclInfo.unit_price,
|
|
|
+ oamount: xmjInfo.quantity,
|
|
|
+ oamount2: oldCInfo ? oldCInfo.oamount2 : xmjInfo.quantity,
|
|
|
+ bwmx: xmjInfo.bwmx || xmjInfo.jldy || '',
|
|
|
+ xmj_code: xmjInfo.code || '',
|
|
|
+ xmj_jldy: xmjInfo.jldy || '',
|
|
|
+ xmj_dwgc: xmjInfo.dwgc || '',
|
|
|
+ xmj_fbgc: xmjInfo.fbgc || '',
|
|
|
+ xmj_fxgc: xmjInfo.fxgc || '',
|
|
|
+ gcl_id: select.gcl_id,
|
|
|
+ mx_id: select.mx_id,
|
|
|
+ }
|
|
|
+ _.assign(data, newData);
|
|
|
+ }
|
|
|
+ console.log(data);
|
|
|
+ // 更新至服务器
|
|
|
+ postData('/tender/' + window.location.pathname.split('/')[2] + '/change/' + window.location.pathname.split('/')[4] + '/information/save', {
|
|
|
+ type: 'add-change-list',
|
|
|
+ postData: [data]
|
|
|
+ }, function (result) {
|
|
|
+ changeList = result.changeList;
|
|
|
+ select.is_change = 1;
|
|
|
+ changeListData[gclIndex].is_change = 1;
|
|
|
+ SpreadJsObj.reLoadRowData(gclSpreadSheet, gclIndex);
|
|
|
+ }, function () {
|
|
|
+ info.sheet.setValue(info.row, info.col, 0);
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ const cInfo = select.deal_id ? _.find(changeList, { lid: select.deal_id }) : _.find(changeList, { gcl_id: select.gcl_id, mx_id: select.mx_id });
|
|
|
+ if (_.find(changeUsedData, {cbid: cInfo.id})) {
|
|
|
+ toastr.warning('该清单已被使用,无法取消变更');
|
|
|
+ info.sheet.setValue(info.row, info.col, 1);
|
|
|
+ return
|
|
|
+ } else if (checkIsSettle(cInfo)) {
|
|
|
+ toastr.warning('该清单已结算,无法取消变更');
|
|
|
+ info.sheet.setValue(info.row, info.col, 1);
|
|
|
+ return
|
|
|
+ } else {
|
|
|
+ postData('/tender/' + window.location.pathname.split('/')[2] + '/change/' + window.location.pathname.split('/')[4] + '/information/save', {
|
|
|
+ type: 'del-change-list',
|
|
|
+ ids: [cInfo.id],
|
|
|
+ postData: null
|
|
|
+ }, function (result) {
|
|
|
+ changeList = result.changeList;
|
|
|
+ select.is_change = 0;
|
|
|
+ if (select.deal_id) {
|
|
|
+ changeListData[gclIndex].is_change = 0;
|
|
|
+ SpreadJsObj.reLoadRowData(gclSpreadSheet, gclIndex);
|
|
|
+ } else {
|
|
|
+ let isChange = false;
|
|
|
+ gclInfo.leafXmjs.forEach(function (item) {
|
|
|
+ if (item.gcl_id === select.gcl_id && (item.mx_id === undefined || item.mx_id === select.mx_id) && item.is_change) {
|
|
|
+ isChange = true;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ if (!isChange) {
|
|
|
+ changeListData[gclIndex].is_change = 0;
|
|
|
+ SpreadJsObj.reLoadRowData(gclSpreadSheet, gclIndex);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }, function () {
|
|
|
+ info.sheet.setValue(info.row, info.col, 1);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
};
|
|
@@ -202,6 +350,7 @@ $(document).ready(() => {
|
|
|
const xmjSpreadSheet = xmjSpread.getActiveSheet();
|
|
|
sjsSettingObj.setGridSelectStyle(gclSpreadSetting);
|
|
|
SpreadJsObj.initSheet(gclSpreadSheet, gclSpreadSetting);
|
|
|
+ sjsSettingObj.setGridSelectStyle(xmjSpreadSetting);
|
|
|
SpreadJsObj.initSpreadSettingEvents(xmjSpreadSetting, xmjCol);
|
|
|
SpreadJsObj.initSheet(xmjSpreadSheet, xmjSpreadSetting);
|
|
|
postData(preUrl + '/defaultBills', { from: 'batch' }, function (result) {
|
|
@@ -261,6 +410,14 @@ $(document).ready(() => {
|
|
|
gclSpreadObj.resetXmjSpread(SpreadJsObj.getSelectObject(gclSpreadSheet));
|
|
|
});
|
|
|
gclSpread.bind(spreadNS.Events.SelectionChanged, gclSpreadObj.selectionChanged);
|
|
|
+ xmjSpread.bind(spreadNS.Events.ButtonClicked, xmjSpreadObj.buttonClicked)
|
|
|
+
|
|
|
+ const xmjSearch = $.xmjSearch({
|
|
|
+ selector: '#xmj-search',
|
|
|
+ searchSpread: xmjSpread,
|
|
|
+ searchRangeStr: '输入项目节编号、细目、计量单元查找',
|
|
|
+
|
|
|
+ });
|
|
|
|
|
|
$.divResizer({
|
|
|
select: '#revise-right-spr',
|
|
@@ -362,289 +519,6 @@ $(document).ready(() => {
|
|
|
gclSpread.refresh();
|
|
|
xmjSpread.refresh();
|
|
|
});
|
|
|
-
|
|
|
- // 回车提交
|
|
|
- $('#list-input').on('keypress', function () {
|
|
|
- if(window.event.keyCode === 13) {
|
|
|
- $(this).blur();
|
|
|
- }
|
|
|
- });
|
|
|
- $('#list-input').on('blur', function () {
|
|
|
- const select = parseInt($('#select-list').val());
|
|
|
- const value = _.trim($(this).val());
|
|
|
- const valueList = _.slice(_.without(_.uniq(_.replace(_.replace(value, /\'|\"/g, ''), /\t/g, ' ').split(' ')), ''), 0, 10);
|
|
|
- // console.log(valueList);
|
|
|
- // 判断是否存在多个分词,以换行或空格分隔,多个则显示左侧菜单
|
|
|
- if (value !== '' && valueList.length > 1) {
|
|
|
- if (_.without(_.uniq(value.split(' ')), '').length > 10) {
|
|
|
- toastr.warning('最多筛选以空格分割的前10个不重复关键词');
|
|
|
- }
|
|
|
- $('#table-list').addClass('col-9').removeClass('col-12');
|
|
|
- $('#table-list').siblings('.col-3').show();
|
|
|
- $('#list-search-keyword').html('<tr data-keyword="" class="text-white bg-primary"><td class="border-primary">全部</td></tr>');
|
|
|
- for (const v of valueList) {
|
|
|
- $('#list-search-keyword').append(`<tr data-keyword="${v}" class=""><td>${v}</td></tr>`);
|
|
|
- }
|
|
|
- $('#list-input').val(valueList.join(' '));
|
|
|
- } else {
|
|
|
- $('#table-list').addClass('col-12').removeClass('col-9');
|
|
|
- $('#table-list').siblings('.col-3').hide();
|
|
|
- $('#list-search-keyword').html('<tr data-keyword="" class="text-white bg-primary border-primary"><td class="border-primary">全部</td></tr>');
|
|
|
- }
|
|
|
- let showListData = changeListData;
|
|
|
- if (select === 1 && value !== '') {
|
|
|
- $(this).siblings('a').show();
|
|
|
- showListData = _.filter(changeListData, function (c) {
|
|
|
- let flag = false;
|
|
|
- if (c.cid) {
|
|
|
- for(const v of valueList) {
|
|
|
- if ((c.code && c.code.indexOf(v) !== -1) || (c.name && c.name.indexOf(v) !== -1)) {
|
|
|
- flag = true;
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- return flag;
|
|
|
- // return ((c.code && c.code.indexOf(value) !== -1) || (c.name && c.name.indexOf(value) !== -1)) && c.cid;
|
|
|
- });
|
|
|
- } else if (select === 1 && value === '') {
|
|
|
- $(this).siblings('a').hide();
|
|
|
- showListData = _.filter(changeListData, function (c) {
|
|
|
- return c.cid;
|
|
|
- });
|
|
|
- } else if (value !== '') {
|
|
|
- $(this).siblings('a').show();
|
|
|
- showListData = _.filter(changeListData, function (c) {
|
|
|
- let flag = false;
|
|
|
- for(const v of valueList) {
|
|
|
- if ((c.code && c.code.indexOf(v) !== -1) || (c.name && c.name.indexOf(v) !== -1)) {
|
|
|
- flag = true;
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
- return flag;
|
|
|
- // return (c.code && c.code.indexOf(value) !== -1) || (c.name && c.name.indexOf(value) !== -1);
|
|
|
- });
|
|
|
- } else {
|
|
|
- $(this).siblings('a').hide();
|
|
|
- }
|
|
|
- makeListTable(changeListData, showListData);
|
|
|
- $('#table-list-select tr').removeClass('table-warning');
|
|
|
- $('#code-input').val('');
|
|
|
- $('#code-input').siblings('a').hide();
|
|
|
- $('#code-list').html('');
|
|
|
- $('#code-select-all').prop('checked', false);
|
|
|
- });
|
|
|
- // 双击编辑搜索值
|
|
|
- $('body').on('dblclick', '#list-search-keyword tr', function () {
|
|
|
- if ($(this).attr('data-keyword') !== '') {
|
|
|
- $(this).children('td').html(`<input class="form-control form-control-sm" value="">`);
|
|
|
- $(this).find('input').focus();
|
|
|
- $(this).find('input').val($(this).attr('data-keyword'));
|
|
|
- }
|
|
|
- });
|
|
|
- // 光标离开
|
|
|
- $('body').on('blur', '#list-search-keyword tr td input', function () {
|
|
|
- let val = $(this).val();
|
|
|
- const oldVal = $(this).parents('tr').attr('data-keyword');
|
|
|
- if (_.trim(val) === '') {
|
|
|
- toastr.warning('不能为空');
|
|
|
- val = oldVal;
|
|
|
- } else if (_.trim(val) === oldVal) {
|
|
|
- val = oldVal;
|
|
|
- } else {
|
|
|
- const value = _.trim($('#list-input').val());
|
|
|
- const valueList = _.slice(_.without(_.uniq(_.replace(value, /\t/g, ' ').split(' ')), ''), 0, 10);
|
|
|
- // console.log(_.indexOf(valueList, oldVal), valueList, val, oldVal);
|
|
|
- if (_.indexOf(valueList, val) !== -1) {
|
|
|
- toastr.warning('已存在相同的检索词');
|
|
|
- val = oldVal;
|
|
|
- }
|
|
|
- valueList.splice(_.indexOf(valueList, oldVal), 1, val);
|
|
|
- $('#list-input').val(valueList.join(' '));
|
|
|
- const select = parseInt($('#select-list').val());
|
|
|
- const showListData = _.filter(changeListData, function (c) {
|
|
|
- return ((c.code && c.code.indexOf(val) !== -1) || (c.name && c.name.indexOf(val) !== -1)) && (select === 1 ? c.cid : 1);
|
|
|
- });
|
|
|
- makeListTable(changeListData, showListData);
|
|
|
- $('#table-list-select tr').removeClass('table-warning');
|
|
|
- $('#code-input').val('');
|
|
|
- $('#code-input').siblings('a').hide();
|
|
|
- $('#code-list').html('');
|
|
|
- $('#code-select-all').prop('checked', false);
|
|
|
- }
|
|
|
- $(this).parents('tr').attr('data-keyword', val);
|
|
|
- $(this).parents('td').html(`${val}`);
|
|
|
- });
|
|
|
- $('body').on('keypress', '#list-search-keyword tr td input', function () {
|
|
|
- if(window.event.keyCode === 13) {
|
|
|
- $(this).blur();
|
|
|
- }
|
|
|
- });
|
|
|
- $("#addlist").draggable({ handle: '.modal-header, .modal-footer'});
|
|
|
- // 检索关键字切换
|
|
|
- $('body').on('click', '#list-search-keyword tr', function () {
|
|
|
- if (!$(this).hasClass('bg-primary')) {
|
|
|
- const keyword = $(this).attr('data-keyword');
|
|
|
- $(this).siblings().removeClass('text-white bg-primary');
|
|
|
- $(this).siblings().children('td').removeClass('border-primary');
|
|
|
- $(this).addClass('text-white bg-primary');
|
|
|
- $(this).children('td').addClass('border-primary');
|
|
|
- if (keyword === '') {
|
|
|
- $('#list-input').blur();
|
|
|
- } else {
|
|
|
- const select = parseInt($('#select-list').val());
|
|
|
- const showListData = _.filter(changeListData, function (c) {
|
|
|
- return ((c.code && c.code.indexOf(keyword) !== -1) || (c.name && c.name.indexOf(keyword) !== -1)) && (select === 1 ? c.cid : 1);
|
|
|
- });
|
|
|
- makeListTable(changeListData, showListData);
|
|
|
- $('#table-list-select tr').removeClass('table-warning');
|
|
|
- $('#code-input').val('');
|
|
|
- $('#code-input').siblings('a').hide();
|
|
|
- $('#code-list').html('');
|
|
|
- $('#code-select-all').prop('checked', false);
|
|
|
- }
|
|
|
- }
|
|
|
- });
|
|
|
- // 回车提交
|
|
|
- $('#code-input').on('keypress', function () {
|
|
|
- if(window.event.keyCode === 13) {
|
|
|
- $(this).blur();
|
|
|
- }
|
|
|
- });
|
|
|
- $('#code-input').on('blur', function () {
|
|
|
- const value = $(this).val();
|
|
|
- if (value !== '') {
|
|
|
- $(this).siblings('a').show();
|
|
|
- } else {
|
|
|
- $(this).siblings('a').hide();
|
|
|
- }
|
|
|
- makeCodeTable($(this).val());
|
|
|
- checkSelectAll();
|
|
|
- });
|
|
|
-
|
|
|
- $('.remove-btn').on('click', function () {
|
|
|
- $(this).hide();
|
|
|
- $(this).siblings('input').val('');
|
|
|
- if ($(this).data('btn') === 'list') {
|
|
|
- const select = parseInt($('#select-list').val());
|
|
|
- let showListData = changeListData;
|
|
|
- if (select === 1) {
|
|
|
- showListData = _.filter(changeListData, function (c) {
|
|
|
- return c.cid;
|
|
|
- });
|
|
|
- }
|
|
|
- makeListTable(changeListData, showListData);
|
|
|
- $('#table-list-select tr').removeClass('table-warning');
|
|
|
- $('#code-list').html('');
|
|
|
- $('#table-list').addClass('col-12').removeClass('col-9');
|
|
|
- $('#table-list').siblings('.col-3').hide();
|
|
|
- $('#list-search-keyword').html('');
|
|
|
- $('#list-search-keyword').siblings('a').addClass('active');
|
|
|
- } else {
|
|
|
- makeCodeTable();
|
|
|
- }
|
|
|
- checkSelectAll();
|
|
|
- });
|
|
|
- // 全选及取消
|
|
|
- $('#code-select-all').click(function () {
|
|
|
- // 全选checkbox
|
|
|
- let index = $('#code-list').attr('data-index');
|
|
|
- if (index) {
|
|
|
- if ($(this).is(':checked')){
|
|
|
- $('#code-list tr').each(function () {
|
|
|
- if ($(this).css('display') !== 'none' && $(this).find('input').prop('disabled') !== true) {
|
|
|
- $(this).find('input').prop('checked', true);
|
|
|
- }
|
|
|
- })
|
|
|
- } else {
|
|
|
- $('#code-list tr').each(function () {
|
|
|
- if ($(this).css('display') !== 'none' && $(this).find('input').prop('disabled') !== true) {
|
|
|
- $(this).find('input').prop('checked', false);
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
- // 判断还有无选中项目节编号
|
|
|
- if ($('#code-list input').is(':checked')) {
|
|
|
- // 去除部分data-detail值
|
|
|
- let data_bwmx = [];
|
|
|
- let data_charu = [];
|
|
|
- $('#code-list input:checked').each(function () {
|
|
|
- const tr = $(this).parents('tr');
|
|
|
- const length = tr.children('td').length;
|
|
|
- const gcl_id = tr.attr('gcl_id');
|
|
|
- const mx_id = tr.attr('mx_id');
|
|
|
- const bwmx = length === 9 ?
|
|
|
- tr.children('td').eq(1).text() + '!_!' +
|
|
|
- tr.children('td').eq(2).text() + '!_!' +
|
|
|
- tr.children('td').eq(3).text() + '!_!' +
|
|
|
- tr.children('td').eq(4).text() + '!_!' +
|
|
|
- tr.children('td').eq(5).text() + '!_!' + gcl_id + '!_!' + mx_id + '!_!' +
|
|
|
- (tr.children('td').eq(6).text() !== '' ? tr.children('td').eq(6).text() : tr.children('td').eq(2).text()) : '0';
|
|
|
- const quantity = tr.attr('quantity');
|
|
|
- const de_qu = bwmx + '*;*' + quantity;
|
|
|
- data_bwmx.push(de_qu);
|
|
|
- if (changeOrder && $(this).prop('disabled') !== true) {
|
|
|
- data_charu.push(de_qu);
|
|
|
- }
|
|
|
- });
|
|
|
- data_bwmx = data_bwmx.join('$#$');
|
|
|
- $('#table-list-select tr[data-index="' + index + '"]').attr('data-bwmx', data_bwmx);
|
|
|
- if (changeOrder) {
|
|
|
- data_charu = data_charu.join('$#$');
|
|
|
- $('#table-list-select tr[data-index="' + index + '"]').attr('data-charu', data_charu);
|
|
|
- }
|
|
|
- $('#table-list-select tr[data-index="' + index + '"]').addClass('table-success');
|
|
|
- } else {
|
|
|
- $('#table-list-select tr[data-index="' + index + '"]').removeClass('table-success');
|
|
|
- $('#table-list-select tr[data-index="' + index + '"]').attr('data-bwmx', '');
|
|
|
- if (changeOrder) {
|
|
|
- $('#table-list-select tr[data-index="' + index + '"]').attr('data-charu', '');
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- });
|
|
|
- // 选中所有新增部位/清单
|
|
|
- $('#select-all-revise').click(function() {
|
|
|
- const qtySpr = '*;*', infoSpr = '!_!', recSpr = '$#$';
|
|
|
- const gclTr = $('#table-list-select tr');
|
|
|
- for (const tr of gclTr) {
|
|
|
- const lid = $(tr).data('lid');
|
|
|
- let gcl = _.find(gclGatherData, function (item) {
|
|
|
- return item.leafXmjs && item.leafXmjs[0].gcl_id === lid;
|
|
|
- });
|
|
|
- if (!gcl) gcl = gclGatherData[$(this).data('gcl')];
|
|
|
- if (!gcl || !gcl.cid) continue;
|
|
|
-
|
|
|
- let data_bwmx = [];
|
|
|
- if ($(tr).attr('data-bwmx') !== '') {
|
|
|
- data_bwmx = $(tr).attr('data-bwmx').split(recSpr);
|
|
|
- data_bwmx = data_bwmx.filter(x => {
|
|
|
- const rec = x.split(qtySpr);
|
|
|
- const info = rec[0].split(infoSpr);
|
|
|
- if (info.length < 8) return true;
|
|
|
-
|
|
|
- const leaf = gcl.leafXmjs.find(lx => { return lx.mx_id === info[6]});
|
|
|
- return !leaf || !leaf.cid || leaf.ccid !== window.location.pathname.split('/')[4];
|
|
|
- });
|
|
|
- }
|
|
|
- let hasNew = false;
|
|
|
- for (const [index, leaf] of gcl.leafXmjs.entries()) {
|
|
|
- if (!leaf.cid || leaf.ccid !== window.location.pathname.split('/')[4]) continue;
|
|
|
- const bwmx = [leaf.code, leaf.jldy || '', leaf.dwgc || '', leaf.fbgc || '', leaf.fxgc || '', leaf.gcl_id, leaf.mx_id, leaf.bwmx || leaf.jldy || ''];
|
|
|
- const de_qu = bwmx.join(infoSpr) + qtySpr + (leaf.quantity || 0);
|
|
|
- if (data_bwmx.indexOf(de_qu) < 0) data_bwmx.push(de_qu);
|
|
|
- hasNew = true;
|
|
|
- }
|
|
|
- if (hasNew) $(tr).attr('data-bwmx', data_bwmx.join(recSpr)).addClass('table-success');
|
|
|
- }
|
|
|
-
|
|
|
- // 触发点击当前清单,重载当前全部部位
|
|
|
- const dataIndex = $('#code-list').attr('data-index');
|
|
|
- if (dataIndex) {
|
|
|
- $(`tr[data-index=${dataIndex}]`).trigger('click');
|
|
|
- }
|
|
|
- });
|
|
|
});
|
|
|
function checkSelectAll() {
|
|
|
let check = $('#code-list tr').length > 0 ? true : false;
|
|
@@ -675,3 +549,11 @@ function findDecimal(unit) {
|
|
|
}
|
|
|
return value;
|
|
|
}
|
|
|
+// 判断是否是已结算清单
|
|
|
+function checkIsSettle(data) {
|
|
|
+ const info = data.mx_id ? _.find(settlePos, { lid: data.gcl_id, pid: data.mx_id }) : _.find(settleBills, { lid: data.gcl_id });
|
|
|
+ if (info && info.settle_status && info.settle_status === settleStatus.finish) {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+}
|