|
@@ -28,6 +28,7 @@ function transExpr(expr) {
|
|
|
return $.trim(expr).replace('\t', '').replace('=', '').replace('%', '/100');
|
|
|
}
|
|
|
const copyBlockTag = 'zh.calc.copyBlock';
|
|
|
+const dskCompilation = 'zh.calc.dskCompilation';
|
|
|
const checkOption = {
|
|
|
sibling: { enable: 1 },
|
|
|
empty_code: { enable: 1 },
|
|
@@ -2432,6 +2433,487 @@ $(document).ready(() => {
|
|
|
selectedBackColor: '#fffacd',
|
|
|
});
|
|
|
|
|
|
+ class Jlzf {
|
|
|
+ constructor (selector, spreadSetting) {
|
|
|
+ const self = this;
|
|
|
+ this.loaded = false;
|
|
|
+ this.obj = $(selector);
|
|
|
+ const relaSelect = {
|
|
|
+ showLevel: `cb-${spreadSetting.stdType}-sl`,
|
|
|
+ searchText: `cb-${spreadSetting.stdType}-st`,
|
|
|
+ searchResult: `cb-${spreadSetting.stdType}-sr`,
|
|
|
+ searchPre: `cb-${spreadSetting.stdType}-sp`,
|
|
|
+ searchNext: `cb-${spreadSetting.stdType}-sn`,
|
|
|
+ searchClose: `cb-${spreadSetting.stdType}-sc`,
|
|
|
+ };
|
|
|
+ this.obj.html(
|
|
|
+ '<div class="sjs-bar d-flex">\n' +
|
|
|
+ ' <div class="ml-1">\n' +
|
|
|
+ ' <div class="px-2 border-primary border-1 d-flex">\n' +
|
|
|
+ ' <div class="d-inline-block">\n' +
|
|
|
+ ' <div class="input-group input-group-sm mr-1">' +
|
|
|
+ ` <input type="text" class="form-control" placeholder="输入编号/名称查找" id="${relaSelect.searchText}">\n` +
|
|
|
+ ` <div class="input-group-append" ><span class="input-group-text" id="${relaSelect.searchResult}">结果:0</span></div>\n` +
|
|
|
+ ' <div class="input-group-append" >\n' +
|
|
|
+ ` <button class="btn btn-outline-secondary" type="button" title="上一个" id="${relaSelect.searchPre}"><i class="fa fa-angle-double-left"></i></button>\n` +
|
|
|
+ ` <button class="btn btn-outline-secondary" type="button" title="下一个" id="${relaSelect.searchNext}"><i class="fa fa-angle-double-right"></i></button>\n` +
|
|
|
+ ' </div>\n' +
|
|
|
+ ' </div>\n' +
|
|
|
+ ' </div>\n' +
|
|
|
+ ` <div class="d-inline-block"><button class="btn btn-light text-danger btn-sm ml-1" type="button" id="${relaSelect.searchClose}"><i class="fa fa-remove"></i></button></div>\n` +
|
|
|
+ ' </div>\n' +
|
|
|
+ ' </div>' +
|
|
|
+ '</div>\n' +
|
|
|
+ `<div id="cb-${spreadSetting.stdType}-spread" class="cb-${spreadSetting.stdType}-sh"></div>\n`
|
|
|
+ );
|
|
|
+ autoFlashHeight();
|
|
|
+ const sh = `.cb-${spreadSetting.stdType}-sh`;
|
|
|
+ function getObjHeight(select) {
|
|
|
+ return select.length > 0 ? select.height() : 0;
|
|
|
+ }
|
|
|
+ const cHeader = getObjHeight($(".c-header"));
|
|
|
+ $(sh).height($(window).height()-cHeader-getObjHeight($('.sjs-bar', sh.parentNode))-getObjHeight($('.sjs-bottom', sh.parentNode))-92+55-30);
|
|
|
+ // this.url = '/tender/' + window.location.pathname.split('/')[2] + '/deal';
|
|
|
+ this.spreadSetting = spreadSetting;
|
|
|
+ this.spread = SpreadJsObj.createNewSpread($(`#cb-${spreadSetting.stdType}-spread`)[0]);
|
|
|
+ const searchSheet = this.spread.getActiveSheet();
|
|
|
+ SpreadJsObj.initSheet(searchSheet, this.spreadSetting);
|
|
|
+ if (!readOnly) {
|
|
|
+ this.spread.bind(spreadNS.Events.CellDoubleClick, function (e, info) {
|
|
|
+ const dealSheet = info.sheet;
|
|
|
+ const mainSheet = billsSheet;
|
|
|
+
|
|
|
+ const dealBills = SpreadJsObj.getSelectObject(dealSheet);
|
|
|
+ if (!dealBills) { return; }
|
|
|
+ const mainTree = mainSheet.zh_tree;
|
|
|
+ const mainNode = SpreadJsObj.getSelectObject(mainSheet);
|
|
|
+ if (!mainNode || !mainTree) { return; }
|
|
|
+
|
|
|
+ if (mainNode.code && mainNode.code !== '' && !mainTree.isLeafXmj(mainNode)) {
|
|
|
+ toastr.warning('非最底层项目下,不应添加节点');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (mainNode.settle_status === settleStatus.finish) {
|
|
|
+ toastr.warning('已结算节点下,不应添加签约清单');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ postData(window.location.pathname + '/update', {
|
|
|
+ postType: 'add-deal',
|
|
|
+ postData: {
|
|
|
+ id: mainNode.ledger_id,
|
|
|
+ type: mainNode.code ? 'child' : 'next',
|
|
|
+ dealBills: {
|
|
|
+ b_code: dealBills.b_code, code: dealBills.code, name: dealBills.name, unit: dealBills.unit,
|
|
|
+ unit_price: dealBills.unit_price,
|
|
|
+ }
|
|
|
+ },
|
|
|
+ }, function (result) {
|
|
|
+ const refreshData = mainTree.loadPostData(result);
|
|
|
+ billsTreeSpreadObj.refreshTree(mainSheet, refreshData);
|
|
|
+ const sel = mainSheet.getSelections()[0];
|
|
|
+ if (sel && refreshData.create[0]) {
|
|
|
+ mainSheet.setSelection(mainTree.nodes.indexOf(refreshData.create[0]), sel.col, sel.rowCount, sel.colCount);
|
|
|
+ SpreadJsObj.reloadRowsBackColor(mainSheet, [sel.row, mainTree.nodes.indexOf(refreshData.create[0])]);
|
|
|
+ }
|
|
|
+ billsTreeSpreadObj.refreshOperationValid(mainSheet);
|
|
|
+ billsSpread.focus();
|
|
|
+ posSpreadObj.loadCurPosData();
|
|
|
+ });
|
|
|
+ });
|
|
|
+ }
|
|
|
+ SpreadJsObj.forbiddenSpreadContextMenu(selector, this.spread);
|
|
|
+ const searchObj = {
|
|
|
+ result: [],
|
|
|
+ cur: 0,
|
|
|
+ searchStdNode: function() {
|
|
|
+ const keyword = $(`#${relaSelect.searchText}`).val();
|
|
|
+ const sortData = SpreadJsObj.getSortData(searchSheet);
|
|
|
+ searchObj.result = keyword ? sortData.filter(x => {
|
|
|
+ return (x.code && x.code.indexOf(keyword) >= 0) || (x.b_code && x.b_code.indexOf(keyword) >= 0) || (x.name && x.name.indexOf(keyword) >= 0);
|
|
|
+ }) : [];
|
|
|
+ $(`#${relaSelect.searchResult}`)[0].innerText = `结果:${searchObj.result.length}`;
|
|
|
+ searchObj.cur = 0;
|
|
|
+ if (searchObj.result.length > 0) {
|
|
|
+ SpreadJsObj.locateData(searchSheet, searchObj.result[searchObj.cur]);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ searchPre: function () {
|
|
|
+ if (searchObj.result.length === 0) return;
|
|
|
+ searchObj.cur = searchObj.cur === 0 ? searchObj.result.length - 1 : this.cur - 1;
|
|
|
+ SpreadJsObj.locateData(searchSheet, searchObj.result[searchObj.cur]);
|
|
|
+ },
|
|
|
+ searchNext: function () {
|
|
|
+ if (searchObj.result.length === 0) return;
|
|
|
+ searchObj.cur = searchObj.cur === searchObj.result.length - 1 ? 0 : searchObj.cur + 1;
|
|
|
+ SpreadJsObj.locateData(searchSheet, searchObj.result[searchObj.cur]);
|
|
|
+ },
|
|
|
+ clear: function () {
|
|
|
+ $(`#${relaSelect.searchText}`).val('');
|
|
|
+ $(`#${relaSelect.searchResult}`)[0].innerText = `结果:${0}`;
|
|
|
+ searchObj.result = [];
|
|
|
+ searchObj.cur = 0;
|
|
|
+ }
|
|
|
+ };
|
|
|
+ $(`#${relaSelect.searchText}`).change(searchObj.searchStdNode);
|
|
|
+ $(`#${relaSelect.searchPre}`).click(function (e) {
|
|
|
+ searchObj.searchPre();
|
|
|
+ e.stopPropagation();
|
|
|
+ });
|
|
|
+ $(`#${relaSelect.searchNext}`).click(function (e) {
|
|
|
+ searchObj.searchNext();
|
|
|
+ e.stopPropagation();
|
|
|
+ });
|
|
|
+ $(`#${relaSelect.searchClose}`).click(function (e) {
|
|
|
+ searchObj.clear();
|
|
|
+ e.stopPropagation();
|
|
|
+ });
|
|
|
+ };
|
|
|
+ loadData (callback) {
|
|
|
+ if (this.loaded) {
|
|
|
+ if (callback) callback();
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ const self = this;
|
|
|
+ const data = billsTree.nodes.filter(node => node.ccid !== undefined && node.ccid !== '');
|
|
|
+ SpreadJsObj.loadSheetData(self.spread.getActiveSheet(), 'data', data);
|
|
|
+ self.loaded = true;
|
|
|
+ if (callback) callback();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ const jlzfBills = new Jlzf('#jlzf-spread', {
|
|
|
+ cols: [
|
|
|
+ {title: '项目节编号', field: 'code', hAlign: 0, width: 85, formatter: '@'},
|
|
|
+ {title: '清单编号', field: 'b_code', hAlign: 0, width: 85, formatter: '@'},
|
|
|
+ {title: '名称', field: 'name', hAlign: 0, width: 150, formatter: '@'},
|
|
|
+ {title: '单位', field: 'unit', hAlign: 1, width: 50, formatter: '@'},
|
|
|
+ {title: '单价', field: 'unit_price', hAlign: 2, width: 50},
|
|
|
+ ],
|
|
|
+ emptyRows: 0,
|
|
|
+ headRows: 1,
|
|
|
+ headRowHeight: [32],
|
|
|
+ headColWidth: [30],
|
|
|
+ defaultRowHeight: 21,
|
|
|
+ headerFont: '12px 微软雅黑',
|
|
|
+ font: '12px 微软雅黑',
|
|
|
+ selectedBackColor: '#fffacd',
|
|
|
+ readOnly: true,
|
|
|
+ stdType: 'jlzf',
|
|
|
+ });
|
|
|
+
|
|
|
+ class Dsk {
|
|
|
+ constructor (selector, spreadSetting) {
|
|
|
+ const self = this;
|
|
|
+ this.loaded = false;
|
|
|
+ this.obj = $(selector);
|
|
|
+ const dskProjectHtml = spreadSetting.libs.map(l => {
|
|
|
+ return `<option value="${l.pid}" ${spreadSetting.select_lib === l.pid ? 'selected' : ''}>${l.name}</option>`;
|
|
|
+ });
|
|
|
+ const relaSelect = {
|
|
|
+ showLevel: `cb-${spreadSetting.stdType}-sl`,
|
|
|
+ searchText: `cb-${spreadSetting.stdType}-st`,
|
|
|
+ searchResult: `cb-${spreadSetting.stdType}-sr`,
|
|
|
+ searchPre: `cb-${spreadSetting.stdType}-sp`,
|
|
|
+ searchNext: `cb-${spreadSetting.stdType}-sn`,
|
|
|
+ searchClose: `cb-${spreadSetting.stdType}-sc`,
|
|
|
+ };
|
|
|
+ this.obj.html(
|
|
|
+ '<div class="sjs-bar d-flex">\n' +
|
|
|
+ ` <div class="input-group input-group-sm pr-1"><select class="form-control form-control-sm col-auto" id="change-dsk-project">${dskProjectHtml.join('')}</select></div>\n` +
|
|
|
+ ` <div class="input-group input-group-sm pr-1"><select class="form-control form-control-sm col-auto" id="change-dsk-project-tree"></select></div>\n` +
|
|
|
+ ' <div class="ml-1">\n' +
|
|
|
+ ' <div class="dropdown">\n' +
|
|
|
+ ' <button class="btn btn-sm btn-outline-secondary dropdown-toggle" type="button" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">\n' +
|
|
|
+ ' <i class="fa fa-search"></i>\n' +
|
|
|
+ ' </button>\n' +
|
|
|
+ ' <div class="dropdown-menu dropdown-menu-right">\n' +
|
|
|
+ ' <div class="px-2 border-primary border-1 d-flex" style="width: 300px">\n' +
|
|
|
+ ' <div class="d-inline-block">\n' +
|
|
|
+ ' <div class="input-group input-group-sm mr-1">' +
|
|
|
+ ` <input type="text" class="form-control" placeholder="输入编号/名称查找" id="${relaSelect.searchText}">\n` +
|
|
|
+ ` <div class="input-group-append" ><span class="input-group-text" id="${relaSelect.searchResult}">结果:0</span></div>\n` +
|
|
|
+ ' <div class="input-group-append" >\n' +
|
|
|
+ ` <button class="btn btn-outline-secondary" type="button" title="上一个" id="${relaSelect.searchPre}"><i class="fa fa-angle-double-left"></i></button>\n` +
|
|
|
+ ` <button class="btn btn-outline-secondary" type="button" title="下一个" id="${relaSelect.searchNext}"><i class="fa fa-angle-double-right"></i></button>\n` +
|
|
|
+ ' </div>\n' +
|
|
|
+ ' </div>\n' +
|
|
|
+ ' </div>\n' +
|
|
|
+ ` <div class="d-inline-block"><button class="btn btn-light text-danger btn-sm ml-1" type="button" id="${relaSelect.searchClose}"><i class="fa fa-remove"></i></button></div>\n` +
|
|
|
+ ' </div>\n' +
|
|
|
+ ' </div>\n' +
|
|
|
+ ' </div>\n' +
|
|
|
+ ' </div>' +
|
|
|
+ '</div>\n' +
|
|
|
+ `<div id="cb-${spreadSetting.stdType}-spread" class="cb-${spreadSetting.stdType}-sh"></div>\n`
|
|
|
+ );
|
|
|
+ autoFlashHeight();
|
|
|
+ const sh = `.cb-${spreadSetting.stdType}-sh`;
|
|
|
+ function getObjHeight(select) {
|
|
|
+ return select.length > 0 ? select.height() : 0;
|
|
|
+ }
|
|
|
+ const cHeader = getObjHeight($(".c-header"));
|
|
|
+ $(sh).height($(window).height()-cHeader-getObjHeight($('.sjs-bar', sh.parentNode))-getObjHeight($('.sjs-bottom', sh.parentNode))-92+55-30);
|
|
|
+ // this.url = '/tender/' + window.location.pathname.split('/')[2] + '/deal';
|
|
|
+ this.spreadSetting = spreadSetting;
|
|
|
+ this.spread = SpreadJsObj.createNewSpread($(`#cb-${spreadSetting.stdType}-spread`)[0]);
|
|
|
+ const searchSheet = this.spread.getActiveSheet();
|
|
|
+ SpreadJsObj.initSheet(searchSheet, this.spreadSetting);
|
|
|
+ if (!readOnly) {
|
|
|
+ this.spread.bind(spreadNS.Events.CellDoubleClick, function (e, info) {
|
|
|
+ const dealSheet = info.sheet;
|
|
|
+ const mainSheet = billsSheet;
|
|
|
+
|
|
|
+ const dealBills = SpreadJsObj.getSelectObject(dealSheet);
|
|
|
+ if (!dealBills) { return; }
|
|
|
+ const mainTree = mainSheet.zh_tree;
|
|
|
+ const mainNode = SpreadJsObj.getSelectObject(mainSheet);
|
|
|
+ if (!mainNode || !mainTree) { return; }
|
|
|
+
|
|
|
+ if (mainNode.code && mainNode.code !== '' && !mainTree.isLeafXmj(mainNode)) {
|
|
|
+ toastr.warning('非最底层项目下,不应添加节点');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (mainNode.settle_status === settleStatus.finish) {
|
|
|
+ toastr.warning('已结算节点下,不应添加签约清单');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ const is_bill = dealBills.kind === 4;
|
|
|
+ const oneBills = {
|
|
|
+ b_code: is_bill ? dealBills.code : null, code: !is_bill ? dealBills.code : null, name: dealBills.name, unit: dealBills.unit,
|
|
|
+ unit_price: is_bill ? dealBills.unitPrice : null, quantity: is_bill ? dealBills.quantity : null, total_price: is_bill ? dealBills.totalPrice : null,
|
|
|
+ sgfh_qty: is_bill ? dealBills.quantity : null, sgfh_tp: is_bill ? dealBills.totalPrice : null,
|
|
|
+ };
|
|
|
+ postData(window.location.pathname + '/update', {
|
|
|
+ postType: 'add-deal',
|
|
|
+ postData: {
|
|
|
+ id: mainNode.ledger_id,
|
|
|
+ type: mainNode.code ? 'child' : 'next',
|
|
|
+ dealBills: oneBills,
|
|
|
+ },
|
|
|
+ }, function (result) {
|
|
|
+ const refreshData = mainTree.loadPostData(result);
|
|
|
+ billsTreeSpreadObj.refreshTree(mainSheet, refreshData);
|
|
|
+ const sel = mainSheet.getSelections()[0];
|
|
|
+ if (sel && refreshData.create[0]) {
|
|
|
+ mainSheet.setSelection(mainTree.nodes.indexOf(refreshData.create[0]), sel.col, sel.rowCount, sel.colCount);
|
|
|
+ SpreadJsObj.reloadRowsBackColor(mainSheet, [sel.row, mainTree.nodes.indexOf(refreshData.create[0])]);
|
|
|
+ }
|
|
|
+ billsTreeSpreadObj.refreshOperationValid(mainSheet);
|
|
|
+ billsSpread.focus();
|
|
|
+ posSpreadObj.loadCurPosData();
|
|
|
+ });
|
|
|
+ });
|
|
|
+ }
|
|
|
+ SpreadJsObj.forbiddenSpreadContextMenu(selector, this.spread);
|
|
|
+ const searchObj = {
|
|
|
+ result: [],
|
|
|
+ cur: 0,
|
|
|
+ searchStdNode: function() {
|
|
|
+ const keyword = $(`#${relaSelect.searchText}`).val();
|
|
|
+ searchObj.result = keyword ? dskProjectBills2Tree.tenderTree.nodes.filter(x => {
|
|
|
+ return x.code.indexOf(keyword) >= 0 || x.name.indexOf(keyword) >= 0;
|
|
|
+ }) : [];
|
|
|
+ // searchObj.result = [];
|
|
|
+ // for (const x of pathTree.nodes) {
|
|
|
+ // if (x.code.indexOf(keyword) >= 0 || x.b_code.indexOf(keyword) >= 0 || x.name.indexOf(keyword) >= 0) {
|
|
|
+ // searchObj.result.push(x);
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ $(`#${relaSelect.searchResult}`)[0].innerText = `结果:${searchObj.result.length}`;
|
|
|
+ searchObj.cur = 0;
|
|
|
+ if (searchObj.result.length > 0) {
|
|
|
+ SpreadJsObj.locateTreeNode(searchSheet, dskProjectBills2Tree.tenderTree.getNodeKey(searchObj.result[searchObj.cur]));
|
|
|
+ }
|
|
|
+ },
|
|
|
+ searchPre: function () {
|
|
|
+ if (searchObj.result.length === 0) return;
|
|
|
+ searchObj.cur = searchObj.cur === 0 ? searchObj.result.length - 1 : this.cur - 1;
|
|
|
+ SpreadJsObj.locateTreeNode(searchSheet, dskProjectBills2Tree.tenderTree.getNodeKey(searchObj.result[searchObj.cur]), true);
|
|
|
+ },
|
|
|
+ searchNext: function () {
|
|
|
+ if (searchObj.result.length === 0) return;
|
|
|
+ searchObj.cur = searchObj.cur === searchObj.result.length - 1 ? 0 : searchObj.cur + 1;
|
|
|
+ SpreadJsObj.locateTreeNode(searchSheet, dskProjectBills2Tree.tenderTree.getNodeKey(searchObj.result[searchObj.cur]), true);
|
|
|
+ },
|
|
|
+ clear: function () {
|
|
|
+ $(`#${relaSelect.searchText}`).val('');
|
|
|
+ $(`#${relaSelect.searchResult}`)[0].innerText = `结果:${0}`;
|
|
|
+ searchObj.result = [];
|
|
|
+ searchObj.cur = 0;
|
|
|
+ }
|
|
|
+ };
|
|
|
+ $(`#${relaSelect.searchText}`).change(searchObj.searchStdNode);
|
|
|
+ $(`#${relaSelect.searchPre}`).click(function (e) {
|
|
|
+ searchObj.searchPre();
|
|
|
+ e.stopPropagation();
|
|
|
+ });
|
|
|
+ $(`#${relaSelect.searchNext}`).click(function (e) {
|
|
|
+ searchObj.searchNext();
|
|
|
+ e.stopPropagation();
|
|
|
+ });
|
|
|
+ $(`#${relaSelect.searchClose}`).click(function (e) {
|
|
|
+ searchObj.clear();
|
|
|
+ e.stopPropagation();
|
|
|
+ });
|
|
|
+ };
|
|
|
+ loadData (callback) {
|
|
|
+ if (this.loaded) {
|
|
|
+ if (callback) callback();
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ const self = this;
|
|
|
+ if (dskAccountData && dskAccountData.select_project) {
|
|
|
+ self.loaded = true;
|
|
|
+ changeDskProject(dskAccountData.select_project);
|
|
|
+ } else {
|
|
|
+ SpreadJsObj.loadSheetData(self.spread.getActiveSheet(), 'data', []);
|
|
|
+ self.loaded = true;
|
|
|
+ }
|
|
|
+ if (callback) callback();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ $('body').on('change', '#change-dsk-project', function () {
|
|
|
+ const pid = $(this).val();
|
|
|
+ changeDskProject(pid);
|
|
|
+ });
|
|
|
+
|
|
|
+ $('body').on('change', '#change-dsk-project-tree', function () {
|
|
|
+ const treeId = $(this).val();
|
|
|
+ const projectInfo = _.find(dskProjects, { pid: dskAccountData.select_project });
|
|
|
+ changeDskProjectTree(projectInfo, treeId);
|
|
|
+ });
|
|
|
+
|
|
|
+ function setDskProjectTreeSelect(trees) {
|
|
|
+ let html = '';
|
|
|
+ for (const tree of trees) {
|
|
|
+ html += `<option value="${tree.ID}" ${tree.ID === dskAccountData.select_tree ? 'selected' : ''}>${tree.name}</option>`;
|
|
|
+ }
|
|
|
+ $('#change-dsk-project-tree').html(html);
|
|
|
+ }
|
|
|
+
|
|
|
+ function changeDskProject(pid) {
|
|
|
+ const projectInfo = _.find(dskProjects, { pid });
|
|
|
+ if (!projectInfo) {
|
|
|
+ dskAccountData.select_project = null;
|
|
|
+ dskAccountData.select_tree = null;
|
|
|
+ SpreadJsObj.loadSheetData(dskBills.spread.getActiveSheet(), SpreadJsObj.DataType.Tree, []);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ postData('/profile/dsk/api', { type: 'project_tree', tid: window.location.pathname.split('/')[2], compilationId: projectInfo.compilationId, projectId: projectInfo.pid }, function (datas) {
|
|
|
+ const trees = _.filter(datas, x => x.type === 4);
|
|
|
+ dskAccountData.select_project = projectInfo.pid;
|
|
|
+ setDskProjectTreeSelect(trees);
|
|
|
+ changeDskProjectTree(projectInfo, trees.length > 0 ? trees[0].ID : null);
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ function changeDskProjectTree(projectInfo, treeId) {
|
|
|
+ dskAccountData.select_tree = treeId;
|
|
|
+ if (!treeId) {
|
|
|
+ SpreadJsObj.loadSheetData(dskBills.spread.getActiveSheet(), SpreadJsObj.DataType.Tree, []);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ postData('/profile/dsk/api', { type: 'project_bills', tid: window.location.pathname.split('/')[2], compilationId: projectInfo.compilationId, treeId }, function (result) {
|
|
|
+ const tree = dskProjectBills2Tree.convert(result);
|
|
|
+ console.log(tree);
|
|
|
+ SpreadJsObj.loadSheetData(dskBills.spread.getActiveSheet(), SpreadJsObj.DataType.Tree, tree);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ const dskBills = new Dsk('#dsk-spread', {
|
|
|
+ cols: [
|
|
|
+ {title: '编号', field: 'code', hAlign: 0, width: 150, formatter: '@', cellType: 'tree'},
|
|
|
+ {title: '名称', field: 'name', hAlign: 0, width: 100, formatter: '@'},
|
|
|
+ {title: '单位', field: 'unit', hAlign: 1, width: 50, formatter: '@'},
|
|
|
+ {title: '单价', field: 'unitPrice', hAlign: 2, width: 80, formatter: '@'},
|
|
|
+ {title: '数量', field: 'quantity', hAlign: 2, width: 80, formatter: '@'},
|
|
|
+ ],
|
|
|
+ emptyRows: 0,
|
|
|
+ headRows: 1,
|
|
|
+ headRowHeight: [32],
|
|
|
+ headColWidth: [30],
|
|
|
+ defaultRowHeight: 21,
|
|
|
+ headerFont: '12px 微软雅黑',
|
|
|
+ font: '12px 微软雅黑',
|
|
|
+ selectedBackColor: '#fffacd',
|
|
|
+ readOnly: true,
|
|
|
+ stdType: 'dsk',
|
|
|
+ libs: dskProjects,
|
|
|
+ select_lib: dskAccountData.select_project ? dskAccountData.select_project : null,
|
|
|
+ });
|
|
|
+
|
|
|
+ const dskProjectBills2Tree = (function () {
|
|
|
+ const treeSetting = {
|
|
|
+ id: 'dpb_id',
|
|
|
+ pid: 'dpb_pid',
|
|
|
+ order: 'seq',
|
|
|
+ level: 'level',
|
|
|
+ rootId: '-1',
|
|
|
+ fullPath: 'full_path',
|
|
|
+ };
|
|
|
+ const tenderTree = createNewPathTree('gather', treeSetting);
|
|
|
+
|
|
|
+ function setChildrenNode(node, dxs, files, tenders) {
|
|
|
+ const dxchildren = _.filter(dxs, { parentID: node.bid });
|
|
|
+ const children = _.filter(files, { parentID: node.bid });
|
|
|
+ const tenderChildren = _.filter(tenders, { parentID: node.bid });
|
|
|
+ const checkChildren = _.orderBy([...dxchildren, ...children, ...tenderChildren], ['seq', 'asc']);
|
|
|
+ for (const t of checkChildren) {
|
|
|
+ const child = {
|
|
|
+ bid: t.ID,
|
|
|
+ parentID: t.parentID,
|
|
|
+ name: t.name,
|
|
|
+ kind: t.kind,
|
|
|
+ code: t.code,
|
|
|
+ quantity: t.quantity,
|
|
|
+ quantity2: t.quantity2,
|
|
|
+ unit: t.unit,
|
|
|
+ unitPrice: t.unitPrice,
|
|
|
+ totalPrice: t.totalPrice,
|
|
|
+ formulaCode: t.formulaCode,
|
|
|
+ flag: t.flag,
|
|
|
+ remark: t.remark,
|
|
|
+ };
|
|
|
+ tenderTree.addNode(child, node);
|
|
|
+ setChildrenNode(child, dxs, files, tenders);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ function convert (projects) {
|
|
|
+ tenderTree.clearDatas();
|
|
|
+
|
|
|
+ // 区分文件夹及项目
|
|
|
+ const topLevel = _.orderBy(_.filter(projects, { parentID: '-1' }), ['seq', 'asc']);
|
|
|
+ const dxs = _.filter(projects, { kind: 1 });
|
|
|
+ const files = _.filter(projects, { kind: 4 });
|
|
|
+ const tenders = _.filter(projects, { kind: 8 });
|
|
|
+
|
|
|
+ for (const t of topLevel) {
|
|
|
+ const node = {
|
|
|
+ bid: t.ID,
|
|
|
+ parentID: t.parentID,
|
|
|
+ name: t.name,
|
|
|
+ kind: t.kind,
|
|
|
+ code: t.code,
|
|
|
+ quantity: t.quantity,
|
|
|
+ quantity2: t.quantity2,
|
|
|
+ unit: t.unit,
|
|
|
+ unitPrice: t.unitPrice,
|
|
|
+ totalPrice: t.totalPrice,
|
|
|
+ formulaCode: t.formulaCode,
|
|
|
+ flag: t.flag,
|
|
|
+ remark: t.remark,
|
|
|
+ };
|
|
|
+ tenderTree.addNode(node, null);
|
|
|
+ setChildrenNode(node, dxs, files, tenders);
|
|
|
+ }
|
|
|
+ tenderTree.sortTreeNode(true);
|
|
|
+ return tenderTree;
|
|
|
+ }
|
|
|
+ return { tenderTree, convert }
|
|
|
+ })();
|
|
|
+
|
|
|
$.divResizer({
|
|
|
select: '#revise-right-spr',
|
|
|
callback: function () {
|
|
@@ -2444,6 +2926,8 @@ $(document).ready(() => {
|
|
|
if (errorList) errorList.spread.refresh();
|
|
|
if (checkList) checkList.spread.refresh();
|
|
|
if (sumLoadMiss) sumLoadMiss.spread.refresh();
|
|
|
+ if (jlzfBills) jlzfBills.spread.refresh();
|
|
|
+ if (dskBills) dskBills.spread.refresh();
|
|
|
}
|
|
|
});
|
|
|
$.subMenu({
|
|
@@ -2469,6 +2953,8 @@ $(document).ready(() => {
|
|
|
if (errorList) errorList.spread.refresh();
|
|
|
if (checkList) checkList.spread.refresh();
|
|
|
if (sumLoadMiss) sumLoadMiss.spread.refresh();
|
|
|
+ if (jlzfBills) jlzfBills.spread.refresh();
|
|
|
+ if (dskBills) dskBills.spread.refresh();
|
|
|
}
|
|
|
});
|
|
|
|
|
@@ -2677,6 +3163,20 @@ $(document).ready(() => {
|
|
|
checkList.spread.refresh();
|
|
|
} else if (tab.attr('content') === '#sum-load-miss') {
|
|
|
sumLoadMiss.spread.refresh();
|
|
|
+ } else if (tab.attr('content') === '#dsk-list') {
|
|
|
+ const dskActiveTab = $('#dsk-tab a[class*="active"]').attr('href');
|
|
|
+ $(dskActiveTab).addClass('active');
|
|
|
+ if (dskActiveTab === '#jlzf-spread') {
|
|
|
+ $('#get-dsk-btn').hide();
|
|
|
+ $('#get-dsk-bills-btn').hide();
|
|
|
+ jlzfBills.loadData();
|
|
|
+ jlzfBills.spread.refresh();
|
|
|
+ } else if (dskActiveTab === '#dsk-spread') {
|
|
|
+ $('#get-dsk-btn').show();
|
|
|
+ $('#get-dsk-bills-btn').show();
|
|
|
+ dskBills.loadData();
|
|
|
+ dskBills.spread.refresh();
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
else {// 收起工具栏
|
|
@@ -2688,6 +3188,23 @@ $(document).ready(() => {
|
|
|
if (posSpread) posSpread.refresh();
|
|
|
});
|
|
|
|
|
|
+ // 新增清单切换tab
|
|
|
+ $('#dsk-tab a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
|
|
|
+ e.preventDefault();
|
|
|
+ const dskActiveTab = $(this).attr('href');
|
|
|
+ if (dskActiveTab === '#jlzf-spread') {
|
|
|
+ $('#get-dsk-btn').hide();
|
|
|
+ $('#get-dsk-bills-btn').hide();
|
|
|
+ jlzfBills.loadData();
|
|
|
+ jlzfBills.spread.refresh();
|
|
|
+ } else if (dskActiveTab === '#dsk-spread') {
|
|
|
+ $('#get-dsk-btn').show();
|
|
|
+ $('#get-dsk-bills-btn').show();
|
|
|
+ dskBills.loadData();
|
|
|
+ dskBills.spread.refresh();
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
// 显示层次
|
|
|
(function (select, sheet) {
|
|
|
$(select).click(function () {
|
|
@@ -2750,5 +3267,300 @@ $(document).ready(() => {
|
|
|
});
|
|
|
});
|
|
|
});
|
|
|
+ if (isYb) {
|
|
|
+ let compilationList = [];
|
|
|
+ $('#get-dsk-btn').click(function () {
|
|
|
+ // 判断是否已绑定dsk用户
|
|
|
+ postData('/profile/dsk/api', { type: 'hadbind' }, function (result) {
|
|
|
+ console.log(result);
|
|
|
+ if (result === 1) {
|
|
|
+ $('#error-dsk .modal-body').find('h5').eq(0).show();
|
|
|
+ $('#error-dsk .modal-body').find('h5').eq(1).hide();
|
|
|
+ $('#error-dsk').modal('show');
|
|
|
+ $('#error-dsk .modal-footer').find('a').eq(0).text('绑定手机');
|
|
|
+ } else if (result === 2) {
|
|
|
+ $('#error-dsk .modal-body').find('h5').eq(1).show();
|
|
|
+ $('#error-dsk .modal-body').find('h5').eq(0).hide();
|
|
|
+ $('#error-dsk').modal('show');
|
|
|
+ $('#error-dsk .modal-footer').find('a').eq(0).text('注册账号');
|
|
|
+ } else {
|
|
|
+ postData('/profile/dsk/api', { type: 'compilation', getProject: 1, compilationId: getLocalCache(dskCompilation) }, function (result) {
|
|
|
+ let html = '';
|
|
|
+ for (const data of result.compilation) {
|
|
|
+ html += `<option value="${data.ID}" ${result.select_compilation === data.ID ? 'selected' : ''}>${data.name}</option>`;
|
|
|
+ }
|
|
|
+ compilationList = result.compilation;
|
|
|
+ console.log(compilationList);
|
|
|
+ $('#dsk-compilation-list').html(html);
|
|
|
+ $('#add-dsk').modal('show');
|
|
|
+ setLocalCache(dskCompilation, result.select_compilation);
|
|
|
+ makeDskProjectSjsHtml(result.project);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ })
|
|
|
+ });
|
|
|
+ $('#get-dsk-bills-btn').click(function () {
|
|
|
+ const projectInfo = _.find(dskProjects, { pid: dskAccountData.select_project });
|
|
|
+ changeDskProjectTree(projectInfo, dskAccountData.select_tree);
|
|
|
+ });
|
|
|
+
|
|
|
+ $('body').on('change', '#dsk-compilation-list', function () {
|
|
|
+ const compilationId = $(this).val();
|
|
|
+ setLocalCache(dskCompilation, compilationId);
|
|
|
+ dskProjectSpreadObj.refreshSourceTree();
|
|
|
+ });
|
|
|
+
|
|
|
+ $('.hide-dsk-modal').click(function () {
|
|
|
+ $('#error-dsk').modal('hide');
|
|
|
+ });
|
|
|
+ let dp = false;
|
|
|
+ let gsObj = {
|
|
|
+ setting: null,
|
|
|
+
|
|
|
+ gsSheet: null,
|
|
|
+ grSheet: null,
|
|
|
+
|
|
|
+ tenderSourceTree: null,
|
|
|
+ grArray: dskProjects ? dskProjects : [],
|
|
|
+ orgSelect: null,
|
|
|
+ };
|
|
|
+ function makeDskProjectSjsHtml(datas) {
|
|
|
+ if (!dp) {
|
|
|
+ initDskProjectTree();
|
|
|
+ dp = true;
|
|
|
+ }
|
|
|
+ gsObj.tenderSourceTree = dskProject2Tree.convert(datas);
|
|
|
+ SpreadJsObj.loadSheetData(gsObj.gsSheet, SpreadJsObj.DataType.Tree, gsObj.tenderSourceTree);
|
|
|
+ SpreadJsObj.loadSheetData(gsObj.grSheet, SpreadJsObj.DataType.Data, gsObj.grArray);
|
|
|
+ if (datas.length === 0) {
|
|
|
+ $('#show-project-0').show();
|
|
|
+ } else {
|
|
|
+ $('#show-project-0').hide();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ const dskProjectSpreadObj = {
|
|
|
+ _addTender: function (tender) {
|
|
|
+ const gr = gsObj.grArray.find(function (x) {
|
|
|
+ return x.pid === tender.pid;
|
|
|
+ });
|
|
|
+ const c_id = getLocalCache(dskCompilation);
|
|
|
+ const t = {pid: tender.pid, name: tender.name, compilationId: c_id, compilationName: _.find(compilationList, { ID: c_id }).name };
|
|
|
+ if (!gr) gsObj.grArray.push(t);
|
|
|
+ return t;
|
|
|
+ },
|
|
|
+ _removeTender: function (tender) {
|
|
|
+ const gri = gsObj.grArray.findIndex(function (x, i, arr) {
|
|
|
+ return x.pid === tender.pid;
|
|
|
+ });
|
|
|
+ if (gri >= 0) gsObj.grArray.splice(gri, 1);
|
|
|
+ },
|
|
|
+ reloadResultData: function () {
|
|
|
+ SpreadJsObj.reLoadSheetData(gsObj.grSheet);
|
|
|
+ },
|
|
|
+ refreshSourceTree: function () {
|
|
|
+ const c_id = getLocalCache(dskCompilation);
|
|
|
+ if (c_id) {
|
|
|
+ postData('/profile/dsk/api', { type: 'project', compilationId: c_id }, function (result) {
|
|
|
+ makeDskProjectSjsHtml(result);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ },
|
|
|
+ gsButtonClicked: function (e, info) {
|
|
|
+ if (!info.sheet.zh_setting) return;
|
|
|
+
|
|
|
+ const col = info.sheet.zh_setting.cols[info.col];
|
|
|
+ if (col.field !== 'selected') return;
|
|
|
+
|
|
|
+ const node = SpreadJsObj.getSelectObject(info.sheet);
|
|
|
+ node.selected = !node.selected;
|
|
|
+ if (node.children && node.children.length > 0) {
|
|
|
+ const posterity = gsObj.tenderSourceTree.getPosterity(node);
|
|
|
+ for (const p of posterity) {
|
|
|
+ p.selected = node.selected;
|
|
|
+ if ((!p.children || p.children.length === 0) && p.type === 2){
|
|
|
+ if (p.selected) {
|
|
|
+ dskProjectSpreadObj._addTender(p);
|
|
|
+ } else {
|
|
|
+ dskProjectSpreadObj._removeTender(p);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ SpreadJsObj.reLoadRowData(info.sheet, info.row, posterity.length + 1);
|
|
|
+ } else if (node.type === 2) {
|
|
|
+ if (node.selected) {
|
|
|
+ dskProjectSpreadObj._addTender(node);
|
|
|
+ } else {
|
|
|
+ dskProjectSpreadObj._removeTender(node);
|
|
|
+ }
|
|
|
+ SpreadJsObj.reLoadRowData(info.sheet, info.row, 1);
|
|
|
+ }
|
|
|
+ dskProjectSpreadObj.reloadResultData();
|
|
|
+ },
|
|
|
+ deleteGr: function () {
|
|
|
+ if (gsObj.grArray.length === 0) return;
|
|
|
+ if (gsObj.grSheet.getSelections().length === 0) return;
|
|
|
+ const selections = gsObj.grSheet.getSelections();
|
|
|
+ const sel = selections ? selections[0] : gsObj.grSheet.getSelections()[0];
|
|
|
+ const row = sel && sel.row !== undefined ? sel.row : -1;
|
|
|
+ if (row === -1 || sel.row + sel.rowCount > gsObj.grArray.length) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ const delList = [];
|
|
|
+ for (let r = 0; r < sel.rowCount; r++) {
|
|
|
+ const select = gsObj.grArray[row + r];
|
|
|
+ delList.push(select);
|
|
|
+ }
|
|
|
+ _.pullAll(gsObj.grArray, delList);
|
|
|
+ dskProjectSpreadObj.reloadResultData();
|
|
|
+ dskProjectSpreadObj.refreshSourceTree();
|
|
|
+ },
|
|
|
+ };
|
|
|
+
|
|
|
+ const initDskProjectTree = function () {
|
|
|
+ const gsSpread = SpreadJsObj.createNewSpread($('#dsk-project-source-spread')[0]);
|
|
|
+ gsObj.gsSheet = gsSpread.getActiveSheet();
|
|
|
+ const gsSpreadSetting = {
|
|
|
+ cols: [
|
|
|
+ {title: '选择', field: 'selected', hAlign: 1, width: 40, formatter: '@', cellType: 'checkbox', readOnly: true,},
|
|
|
+ {title: '名称', field: 'name', hAlign: 0, width: 350, formatter: '@', readOnly: true, folderCell: true, cellType: 'tree'},
|
|
|
+ ],
|
|
|
+ emptyRows: 0,
|
|
|
+ headRows: 1,
|
|
|
+ headRowHeight: [32],
|
|
|
+ defaultRowHeight: 21,
|
|
|
+ headerFont: '12px 微软雅黑',
|
|
|
+ font: '12px 微软雅黑',
|
|
|
+ headColWidth: [0],
|
|
|
+ selectedBackColor: '#fffacd',
|
|
|
+ };
|
|
|
+ SpreadJsObj.initSheet(gsObj.gsSheet, gsSpreadSetting);
|
|
|
+ gsSpread.bind(spreadNS.Events.ButtonClicked, dskProjectSpreadObj.gsButtonClicked);
|
|
|
+
|
|
|
+ const grSpread = SpreadJsObj.createNewSpread($('#dsk-project-result-spread')[0]);
|
|
|
+ gsObj.grSheet = grSpread.getActiveSheet();
|
|
|
+ const grSpreadSetting = {
|
|
|
+ cols: [
|
|
|
+ {title: '名称', colSpan: '1', rowSpan: '1', field: 'name', hAlign: 0, width: 250, formatter: '@', readOnly: true},
|
|
|
+ {title: '所属编办', colSpan: '1', rowSpan: '1', field: 'compilationName', hAlign: 0, width: 150, formatter: '@', readOnly: true},
|
|
|
+ ],
|
|
|
+ emptyRows: 0,
|
|
|
+ headRows: 1,
|
|
|
+ headRowHeight: [32],
|
|
|
+ defaultRowHeight: 21,
|
|
|
+ headerFont: '12px 微软雅黑',
|
|
|
+ font: '12px 微软雅黑',
|
|
|
+ headColWidth: []
|
|
|
+ };
|
|
|
+ SpreadJsObj.initSheet(gsObj.grSheet, grSpreadSetting);
|
|
|
+
|
|
|
+ // 右键删除已选项目
|
|
|
+ const gsContextMenuOptions = {
|
|
|
+ selector: '#dsk-project-result-spread',
|
|
|
+ build: function ($trigger, e) {
|
|
|
+ const target = SpreadJsObj.safeRightClickSelection($trigger, e, grSpread);
|
|
|
+ return target.hitTestType === spreadNS.SheetArea.viewport || target.hitTestType === spreadNS.SheetArea.rowHeader;
|
|
|
+ },
|
|
|
+ items: {
|
|
|
+ delete: {
|
|
|
+ name: '删除',
|
|
|
+ icon: 'fa-remove',
|
|
|
+ callback: function (key, opt) {
|
|
|
+ dskProjectSpreadObj.deleteGr();
|
|
|
+ },
|
|
|
+ disabled: function (key, opt) {
|
|
|
+ const selection = gsObj.grSheet.getSelections();
|
|
|
+ const sel = selection ? selection[0] : gsObj.grSheet.getSelections()[0];
|
|
|
+ const row = sel && sel.row !== undefined ? sel.row : -1;
|
|
|
+ if (row === -1 || sel.row + sel.rowCount > gsObj.grArray.length) {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ }
|
|
|
+ };
|
|
|
+ $.contextMenu(gsContextMenuOptions);
|
|
|
+
|
|
|
+ $('#add-dsk').bind('shown.bs.modal', function () {
|
|
|
+ if (gsSpread) gsSpread.refresh();
|
|
|
+ if (grSpread) grSpread.refresh();
|
|
|
+ });
|
|
|
+ };
|
|
|
+
|
|
|
+ const dskProject2Tree = (function () {
|
|
|
+ const treeSetting = {
|
|
|
+ id: 'tmt_id',
|
|
|
+ pid: 'tmt_pid',
|
|
|
+ order: 'seq',
|
|
|
+ level: 'level',
|
|
|
+ rootId: '-1',
|
|
|
+ fullPath: 'full_path',
|
|
|
+ };
|
|
|
+ const tenderTree = createNewPathTree('gather', treeSetting);
|
|
|
+
|
|
|
+ function setChildrenNode(node, files, tenders) {
|
|
|
+ const children = _.filter(files, { parentID: node.pid });
|
|
|
+ const tenderChildren = _.filter(tenders, { parentID: node.pid });
|
|
|
+ const checkChildren = _.orderBy([...children, ...tenderChildren], ['seq', 'asc']);
|
|
|
+ for (const c of checkChildren) {
|
|
|
+ const child = {
|
|
|
+ pid: c.ID,
|
|
|
+ parentID: c.parentID,
|
|
|
+ name: c.name,
|
|
|
+ type: c.type,
|
|
|
+ selected: _.findIndex(gsObj.grArray, { pid: c.ID }) >= 0
|
|
|
+ };
|
|
|
+ tenderTree.addNode(child, node);
|
|
|
+ if (c.type === 1) setChildrenNode(child, files, tenders);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ function convert (projects) {
|
|
|
+ tenderTree.clearDatas();
|
|
|
+
|
|
|
+ // 区分文件夹及项目
|
|
|
+ const topLevel = _.orderBy(_.filter(projects, { parentID: '-1' }), ['seq', 'asc']);
|
|
|
+ const files = _.filter(projects, { type: 1 });
|
|
|
+ const tenders = _.filter(projects, { type: 2 });
|
|
|
+
|
|
|
+ for (const t of topLevel) {
|
|
|
+ const node = {
|
|
|
+ pid: t.ID,
|
|
|
+ parentID: t.parentID,
|
|
|
+ name: t.name,
|
|
|
+ type: t.type,
|
|
|
+ selected: t.type === 2 ? _.findIndex(gsObj.grArray, { pid: t.ID }) >= 0 : false,
|
|
|
+ };
|
|
|
+ tenderTree.addNode(node, null);
|
|
|
+ if (t.type === 1) setChildrenNode(node, files, tenders);
|
|
|
+ }
|
|
|
+ tenderTree.sortTreeNode(true);
|
|
|
+ return tenderTree;
|
|
|
+ }
|
|
|
+ return { tenderTree, convert }
|
|
|
+ })();
|
|
|
+
|
|
|
+ $('#set-dsk-project').click(function () {
|
|
|
+ postData('/profile/dsk/api', { type: 'save_projects', tid: window.location.pathname.split('/')[2], project_list: gsObj.grArray }, function (result) {
|
|
|
+ // dskAccountData.select_project = result;
|
|
|
+ dskProjects = gsObj.grArray;
|
|
|
+ if (dskAccountData.select_project !== result) {
|
|
|
+ dskAccountData.select_project = result;
|
|
|
+ changeDskProject(result);
|
|
|
+ dskBills.spread.refresh();
|
|
|
+ }
|
|
|
+ setDskProjectSelect(gsObj.grArray);
|
|
|
+ $('#add-dsk').modal('hide');
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
+ function setDskProjectSelect(projects) {
|
|
|
+ let html = '';
|
|
|
+ for (const project of projects) {
|
|
|
+ html += `<option value="${project.pid}" ${project.pid === dskAccountData.select_project ? 'selected' : ''}>${project.name}</option>`;
|
|
|
+ }
|
|
|
+ $('#change-dsk-project').html(html);
|
|
|
+ }
|
|
|
+ }
|
|
|
});
|
|
|
|