|
@@ -8,36 +8,13 @@
|
|
|
* @version
|
|
|
*/
|
|
|
|
|
|
-function loadContent(data) {
|
|
|
- const html = [];
|
|
|
- html.push('<div name="auditContent" class="card my-3">');
|
|
|
- html.push('<div class="card-body">');
|
|
|
- html.push('<table class="table table-sm table-bordered mb-2">');
|
|
|
- console.log(data);
|
|
|
- console.log(data.rela_bills);
|
|
|
- const bills = JSON.parse(data.rela_bills);
|
|
|
- console.log(bills);
|
|
|
- for (const b of bills) {
|
|
|
- html.push('<tr bid=' + b.ledger_id + '>');
|
|
|
- const code = b.code ? b.code : b.b_code;
|
|
|
- html.push('<td>' + code + '</td>');
|
|
|
- html.push('<td>' + b.name + '</td>');
|
|
|
- html.push('</tr>');
|
|
|
- }
|
|
|
- html.push('</table>');
|
|
|
- html.push('<p>'+ data.content +'</p>');
|
|
|
- html.push('<span class="text-muted">' + data.in_time.toLocaleString() + '</span>');
|
|
|
- html.push('</div>');
|
|
|
- html.push('</div>');
|
|
|
- $('#opinion>div.sjs-height-2').append(html.join(''));
|
|
|
+function getTenderId() {
|
|
|
+ return window.location.pathname.split('/')[2];
|
|
|
}
|
|
|
|
|
|
-function loadContents(data) {
|
|
|
- $('div[name=auditContent]').remove();
|
|
|
- for (const d of data) {
|
|
|
- loadContent(d);
|
|
|
- }
|
|
|
-};
|
|
|
+function checkTzMeasureType () {
|
|
|
+ return tender.measure_type === measureType.tz.value;
|
|
|
+}
|
|
|
|
|
|
$(document).ready(() => {
|
|
|
autoFlashHeight();
|
|
@@ -48,14 +25,47 @@ $(document).ready(() => {
|
|
|
order: 'order',
|
|
|
level: 'level',
|
|
|
rootId: -1,
|
|
|
- keys: ['id', 'tender_id', 'ledger_id']
|
|
|
+ keys: ['id', 'tender_id', 'ledger_id'],
|
|
|
+ preUrl: '/ledger'
|
|
|
});
|
|
|
ledgerTree.loadDatas(ledger);
|
|
|
SpreadJsObj.initSheet(ledgerSpread.getActiveSheet(), ledgerSpreadSetting);
|
|
|
SpreadJsObj.loadSheetData(ledgerSpread.getActiveSheet(), 'tree', ledgerTree);
|
|
|
|
|
|
+ // 初始化 部位明细
|
|
|
+ const pos = new PosData({
|
|
|
+ id: 'id', masterId: 'lid',
|
|
|
+ });
|
|
|
+ const posSpread = SpreadJsObj.createNewSpread($('#pos-spread')[0]);
|
|
|
+
|
|
|
+ // 台账模式加载部位明细数据
|
|
|
+ if (checkTzMeasureType()) {
|
|
|
+ SpreadJsObj.initSheet(posSpread.getActiveSheet(), posSpreadSetting);
|
|
|
+ postData('/api/tender/' + getTenderId() + '/pos', null, function (data) {
|
|
|
+ pos.loadDatas(data);
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ ledgerSpread.bind(GC.Spread.Sheets.Events.SelectionChanged, function (e, info) {
|
|
|
+ const sheet = ledgerSpread.getActiveSheet();
|
|
|
+ let node;
|
|
|
+ if (!sheet || !sheet.zh_tree) {
|
|
|
+ node = null;
|
|
|
+ } else {
|
|
|
+ const sel = sheet.getSelections()[0];
|
|
|
+ node = sheet.zh_tree.nodes[sel.row];
|
|
|
+ }
|
|
|
+
|
|
|
+ if (node) {
|
|
|
+ const posData = pos.masterRange[itemsPre + node.id] || [];
|
|
|
+ SpreadJsObj.loadSheetData(posSpread.getActiveSheet(), 'data', posData);
|
|
|
+ } else {
|
|
|
+ SpreadJsObj.loadSheetData(posSpread.getActiveSheet(), 'data', []);
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
let dealBills;
|
|
|
- // 展开收起标准清单
|
|
|
+ // 展开收起 签约清单|清单意见
|
|
|
$('a', '.side-menu').bind('click', function () {
|
|
|
const tab = $(this), tabPanel = $(tab.attr('content'));
|
|
|
const showSideTools = function (show) {
|
|
@@ -66,7 +76,7 @@ $(document).ready(() => {
|
|
|
$('.c-body.col-8').removeClass('col-8').addClass('col-12');
|
|
|
$('.c-body.col-4').removeClass('col-4').addClass('col-0').hide();
|
|
|
}
|
|
|
- }
|
|
|
+ };
|
|
|
if (!tab.hasClass('active')) {
|
|
|
$('a', '#side-menu').removeClass('active');
|
|
|
tab.addClass('active');
|
|
@@ -76,13 +86,16 @@ $(document).ready(() => {
|
|
|
if (tab.attr('content') === '#deal-bills' && !dealBills) {
|
|
|
dealBills = new DealBills($('#deal-bills-spread')[0], {
|
|
|
cols: [
|
|
|
- {title: '清单编号', field: 'code', width: 120, readOnly: true},
|
|
|
- {title: '名称', field: 'name', width: 230, readOnly: true},
|
|
|
- {title: '单位', field: 'unit', width: 50, readOnly: true},
|
|
|
+ {title: '清单编号', field: 'code', width: 120, formatter: '@', readOnly: true},
|
|
|
+ {title: '名称', field: 'name', width: 230, formatter: '@', readOnly: true},
|
|
|
+ {title: '单位', field: 'unit', width: 50, formatter: '@', readOnly: true},
|
|
|
{title: '单价', field: 'unit_price', width: 50, readOnly: true},
|
|
|
{title: '数量', field: 'quantity', width: 50, readOnly: true},
|
|
|
],
|
|
|
emptyRows: 0,
|
|
|
+ headRows: 1,
|
|
|
+ headRowHeight: [40],
|
|
|
+ defaultRowHeight: 21,
|
|
|
});
|
|
|
dealBills.loadData();
|
|
|
}
|
|
@@ -96,7 +109,7 @@ $(document).ready(() => {
|
|
|
class DealBills {
|
|
|
constructor (obj, spreadSetting) {
|
|
|
this.obj = obj;
|
|
|
- this.url = '/deal';
|
|
|
+ this.url = '/api/tender/' + getTenderId() + '/deal';
|
|
|
this.spreadSetting = spreadSetting;
|
|
|
this.spread = SpreadJsObj.createNewSpread(this.obj);
|
|
|
SpreadJsObj.initSheet(this.spread.getActiveSheet(), this.spreadSetting);
|
|
@@ -108,81 +121,4 @@ $(document).ready(() => {
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- // 右键菜单
|
|
|
- $.contextMenu({
|
|
|
- selector: '#ledger-spread',
|
|
|
- build: function ($trigger, e) {
|
|
|
- const target = SpreadJsObj.safeRightClickSelection($trigger, e, ledgerSpread);
|
|
|
- return target.hitTestType === GC.Spread.Sheets.SheetArea.viewport || target.hitTestType === GC.Spread.Sheets.SheetArea.rowHeader;
|
|
|
- },
|
|
|
- items: {
|
|
|
- 'addRelaBills': {
|
|
|
- name: '添加至“清单意见”',
|
|
|
- icon: 'fa-sign-in',
|
|
|
- callback: function (key, opt) {
|
|
|
- const sheet = ledgerSpread.getActiveSheet();
|
|
|
- const selection = sheet.getSelections();
|
|
|
- const row = selection[0].row;
|
|
|
- const select = ledgerTree.nodes[row];
|
|
|
- const exist = $('tr[bid=' + select.ledger_id +']', '#rela_bills').length > 0;
|
|
|
- if (!exist) {
|
|
|
- const html = [];
|
|
|
- html.push('<tr bid=' + select.ledger_id + '>');
|
|
|
- html.push('<td>');
|
|
|
- html.push(select.code && select.code !== '' ? select.code : select.b_code);
|
|
|
- html.push('</td>');
|
|
|
- html.push('<td>' + select.name + '</td>');
|
|
|
- html.push('<td><a href="javascript: void(0);">移除</a></td>');
|
|
|
- html.push('</tr>');
|
|
|
- $('#rela_bills').append(html.join(''));
|
|
|
- }
|
|
|
- $('#billsHint').hide();
|
|
|
-
|
|
|
- if ($('tr[bid]', '#rela_bills').length === 1) {
|
|
|
- $('a', '#rela_bills').bind('click', function () {
|
|
|
- $(this).parent().parent().remove();
|
|
|
- if ($('tr[bid]', '#rela_bills').length === 0) {
|
|
|
- $('#billsHint').show();
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
- },
|
|
|
- visible: function(key, opt){
|
|
|
- const sheet = ledgerSpread.getActiveSheet();
|
|
|
- const selection = sheet.getSelections();
|
|
|
- const row = selection[0].row;
|
|
|
- const select = ledgerTree.nodes[row];
|
|
|
- return select;
|
|
|
- }
|
|
|
- },
|
|
|
- }
|
|
|
- });
|
|
|
- $('textarea').bind('input propertychange', function () {
|
|
|
- if ($(this).val().length > 0) {
|
|
|
- $('#opinionHint').hide();
|
|
|
- } else {
|
|
|
- $('#opinionHint').show();
|
|
|
- }
|
|
|
- });
|
|
|
- $('#addContent').click(function () {
|
|
|
- const bills = [];
|
|
|
- for (const tr of $('#rela_bills>tr')) {
|
|
|
- bills.push($(tr).attr('bid'));
|
|
|
- }
|
|
|
- const data = {
|
|
|
- opinion: $('#content').val(),
|
|
|
- bills,
|
|
|
- };
|
|
|
- postData('/ledger/audit/addContent', data, (data) => {
|
|
|
- $('legend', '#opinion').text(userName + ' 清单意见');
|
|
|
- loadContents(data);
|
|
|
- });
|
|
|
- });
|
|
|
- $('select').change(function () {
|
|
|
- postData('/ledger/audit/getContent', {audit_id: parseInt($(this).val())}, (data) => {
|
|
|
- $('legend', '#opinion').text($(this).find('option:selected').text() + ' 清单意见');
|
|
|
- loadContents(data);
|
|
|
- });
|
|
|
- });
|
|
|
});
|