|
@@ -31,7 +31,6 @@ function getExprInfo (field) {
|
|
|
*/
|
|
|
function customColDisplay () {
|
|
|
const defaultSetting = [
|
|
|
- { title: '签约合同', fields: ['deal_qty', 'deal_tp'], visible: true },
|
|
|
{ title: '本期计量合同', fields: ['contract_qty', 'contract_tp'], visible: true },
|
|
|
{ title: '本期数量变更', fields: ['qc_qty', 'qc_tp', 'qc_bgl'], visible: true },
|
|
|
{ title: '本期完成计量', fields: ['gather_qty', 'gather_tp'], visible: true },
|
|
@@ -43,11 +42,18 @@ function customColDisplay () {
|
|
|
{ title: '备注', fields: ['memo'], visible: true },
|
|
|
{ title: '总额计量', fields: ['is_tp'], visible: true},
|
|
|
];
|
|
|
- if (checkTzMeasureType()) {
|
|
|
- defaultSetting.splice(0, 1);
|
|
|
+ if (!checkTzMeasureType()) {
|
|
|
+ defaultSetting.unshift({ title: '签约合同', fields: ['deal_qty', 'deal_tp'], visible: true }, { title: '台账', fields: ['quantity', 'total_price'], visible: true});
|
|
|
}
|
|
|
const settingStr = Cookies.get(ckColSetting);
|
|
|
- return settingStr ? JSON.parse(settingStr) : defaultSetting;
|
|
|
+ if (settingStr) {
|
|
|
+ const customSetting = JSON.parse(settingStr);
|
|
|
+ for (const ds of defaultSetting) {
|
|
|
+ const cs = customSetting.find(x => {return x.title === ds.title});
|
|
|
+ if (cs) ds.visible = cs.visible;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return defaultSetting;
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -168,6 +174,44 @@ function getDaglText(data) {
|
|
|
|
|
|
|
|
|
$(document).ready(() => {
|
|
|
+ const exportExcelSetting = {
|
|
|
+ cols: [
|
|
|
+ {title: '项目节编号', colSpan: '1', rowSpan: '2', field: 'code', hAlign: 0, width: 145, formatter: '@', cellType: 'tree'},
|
|
|
+ {title: '清单编号', colSpan: '1', rowSpan: '2', field: 'b_code', hAlign: 0, width: 70, formatter: '@'},
|
|
|
+ {title: '计量单元', colSpan: '1', rowSpan: '2', field: 'pos_code', hAlign: 0, width: 70, formatter: '@'},
|
|
|
+ {title: '名称', colSpan: '1', rowSpan: '2', field: 'name', hAlign: 0, width: 185, formatter: '@'},
|
|
|
+ {title: '单位', colSpan: '1', rowSpan: '2', field: 'unit', hAlign: 1, width: 60, formatter: '@', cellType: 'unit'},
|
|
|
+ {title: '单价', colSpan: '1', rowSpan: '2', field: 'unit_price', hAlign: 2, width: 60, type: 'Number'},
|
|
|
+ {title: '台账|数量', colSpan: '2|1', rowSpan: '1|1', field: 'quantity', hAlign: 2, width: 60, type: 'Number'},
|
|
|
+ {title: '|金额', colSpan: '|1', rowSpan: '|1', field: 'total_price', hAlign: 2, width: 60, type: 'Number'},
|
|
|
+ {title: '本期合同计量|数量', colSpan: '2|1', rowSpan: '1|1', field: 'contract_qty', hAlign: 2, width: 60, type: 'Number'},
|
|
|
+ {title: '|金额', colSpan: '|1', rowSpan: '|1', field: 'contract_tp', hAlign: 2, width: 60, type: 'Number'},
|
|
|
+ {title: '本期数量变更|数量', colSpan: '2|1', rowSpan: '1|1', field: 'qc_qty', hAlign: 2, width: 60, type: 'Number'},
|
|
|
+ {title: '|金额', colSpan: '|1', rowSpan: '|1', field: 'qc_tp', hAlign: 2, width: 60, type: 'Number'},
|
|
|
+ {title: '本期完成计量|数量', colSpan: '2|1', rowSpan: '1|1', field: 'gather_qty', hAlign: 2, width: 60, type: 'Number'},
|
|
|
+ {title: '|金额', colSpan: '|1', rowSpan: '|1', field: 'gather_tp', hAlign: 2, width: 60, type: 'Number'},
|
|
|
+ {title: '截止本期合同计量|数量', colSpan: '2|1', rowSpan: '1|1', field: 'end_contract_qty', hAlign: 2, width: 60, type: 'Number'},
|
|
|
+ {title: '|金额', colSpan: '|1', rowSpan: '|1', field: 'end_contract_tp', hAlign: 2, width: 60, type: 'Number'},
|
|
|
+ {title: '截止本期数量变更|数量', colSpan: '2|1', rowSpan: '1|1', field: 'end_qc_qty', hAlign: 2, width: 60, type: 'Number'},
|
|
|
+ {title: '|金额', colSpan: '|1', rowSpan: '|1', field: 'end_qc_tp', hAlign: 2, width: 60, type: 'Number'},
|
|
|
+ {title: '截止本期完成计量|数量', colSpan: '3|1', rowSpan: '1|1', field: 'end_gather_qty', hAlign: 2, width: 60, type: 'Number'},
|
|
|
+ {title: '|金额', colSpan: '|1', rowSpan: '|1', field: 'end_gather_tp', hAlign: 2, width: 60, type: 'Number'},
|
|
|
+ {title: '|完成率(%)', colSpan: '|1', rowSpan: '|1', field: 'end_gather_percent', hAlign: 2, width: 80, type: 'Number'},
|
|
|
+ {title: '合同|项目节数量1', colSpan: '2|1', rowSpan: '1|1', field: 'deal_dgn_qty1', hAlign: 2, width: 60, type: 'Number'},
|
|
|
+ {title: '|项目节数量2', colSpan: '|1', rowSpan: '|1', field: 'deal_dgn_qty2', hAlign: 2, width: 60, type: 'Number'},
|
|
|
+ {title: '变更|项目节数量1', colSpan: '2|1', rowSpan: '1|1', field: 'c_dgn_qty1', hAlign: 2, width: 60, type: 'Number'},
|
|
|
+ {title: '|项目节数量2', colSpan: '|1', rowSpan: '|1', field: 'c_dgn_qty2', hAlign: 2, width: 60, type: 'Number'},
|
|
|
+ {title: '经济指标', colSpan: '1', rowSpan: '2', field: 'final_dgn_price', hAlign: 2, width: 60, type: 'Number'},
|
|
|
+ {title: '本期批注', colSpan: '1', rowSpan: '2', field: 'postil', hAlign: 0, width: 100, formatter: '@', cellType: 'autoTip'},
|
|
|
+ {title: '图(册)号', colSpan: '1', rowSpan: '2', field: 'drawing_code', hAlign: 0, width: 80, formatter: '@'},
|
|
|
+ {title: '备注', colSpan: '1', rowSpan: '2', field: 'memo', hAlign: 0, width: 100, formatter: '@', cellType: 'ellipsisAutoTip'},
|
|
|
+ ],
|
|
|
+ headRows: 2,
|
|
|
+ headRowHeight: [25, 25],
|
|
|
+ defaultRowHeight: 21,
|
|
|
+ headerFont: 'bold 10px 微软雅黑',
|
|
|
+ font: '10px 微软雅黑'
|
|
|
+ };
|
|
|
let detail, searchLedger, checkedChanges;
|
|
|
const checkOption = {
|
|
|
sibling: { enable: 0 },
|
|
@@ -555,13 +599,18 @@ $(document).ready(() => {
|
|
|
};
|
|
|
const ratioCol = ledgerSpreadSetting.cols.find(x => {return x.field === 'end_gather_percent' || x.field === 'end_correct_percent'});
|
|
|
ratioCol.field = tenderInfo.display.stage.correct ? 'end_correct_percent' : 'end_gather_percent';
|
|
|
- ledgerSpreadSetting.imageClick = function (data) {
|
|
|
- if (data.children && data.children.length > 0 || data.lock) return;
|
|
|
+ ledgerSpreadSetting.imageClick = function (data, hitinfo) {
|
|
|
+ const col = hitinfo.sheet.zh_setting.cols[hitinfo.col];
|
|
|
+ if (col.field === 'dagl') {
|
|
|
+ data.dagl_url && window.open(data.dagl_url);
|
|
|
+ } else if (col.field === 'qc_qty') {
|
|
|
+ if (data.children && data.children.length > 0 || data.lock) return;
|
|
|
|
|
|
- const nodePos = stagePos.getLedgerPos(data.id);
|
|
|
- if (nodePos && nodePos.length > 0) return;
|
|
|
+ const nodePos = stagePos.getLedgerPos(data.id);
|
|
|
+ if (nodePos && nodePos.length > 0) return;
|
|
|
|
|
|
- changesObj.loadChanges({bills: data});
|
|
|
+ changesObj.loadChanges({bills: data});
|
|
|
+ }
|
|
|
};
|
|
|
ledgerSpreadSetting.dgnUpFields = ['deal_dgn_qty1', 'deal_dgn_qty2', 'c_dgn_qty1', 'c_dgn_qty2'];
|
|
|
ledgerSpreadSetting.getColor = function (sheet, data, row, col, defaultColor) {
|
|
@@ -604,6 +653,15 @@ $(document).ready(() => {
|
|
|
sjsSettingObj.setFxTreeStyle(ledgerSpreadSetting, sjsSettingObj.FxTreeStyle.jz);
|
|
|
sjsSettingObj.setPropValue(ledgerSpreadSetting, ['gxby'], 'getValue', getGxbyText);
|
|
|
sjsSettingObj.setPropValue(ledgerSpreadSetting, ['dagl'], 'getValue', getDaglText);
|
|
|
+ const lDaglCol = _.find(ledgerSpreadSetting.cols, {field: 'dagl'});
|
|
|
+ if (lDaglCol) {
|
|
|
+ lDaglCol.getValue = getDaglText;
|
|
|
+ lDaglCol.cellType = 'activeImageBtn';
|
|
|
+ lDaglCol.normalImg = '#rela-file-icon';
|
|
|
+ lDaglCol.indent = 5;
|
|
|
+ lDaglCol.imgAlign = 2;
|
|
|
+ lDaglCol.showImage = function (data) { return data && data.dagl_url; }
|
|
|
+ }
|
|
|
if (thousandth) sjsSettingObj.setTpThousandthFormat(ledgerSpreadSetting);
|
|
|
ledgerSpreadSetting.headColWidth = [50];
|
|
|
ledgerSpreadSetting.rowHeader = [
|
|
@@ -656,10 +714,15 @@ $(document).ready(() => {
|
|
|
spCol.showImage = function (data) {
|
|
|
return data !== undefined && data !== null;
|
|
|
};
|
|
|
- posSpreadSetting.imageClick = function (data) {
|
|
|
- const node = SpreadJsObj.getSelectObject(slSpread.getActiveSheet());
|
|
|
- if (node.lock) return;
|
|
|
- changesObj.loadChanges({bills: node, pos: data});
|
|
|
+ posSpreadSetting.imageClick = function (data, hitinfo) {
|
|
|
+ const col = hitinfo.sheet.zh_setting.cols[hitinfo.col];
|
|
|
+ if (col.field === 'dagl') {
|
|
|
+ data.dagl_url && window.open(data.dagl_url);
|
|
|
+ } else if (col.field === 'qc_qty') {
|
|
|
+ const node = SpreadJsObj.getSelectObject(slSpread.getActiveSheet());
|
|
|
+ if (node.lock) return;
|
|
|
+ changesObj.loadChanges({bills: node, pos: data});
|
|
|
+ }
|
|
|
};
|
|
|
posSpreadSetting.getColor = function (sheet, data, row, col, defaultColor) {
|
|
|
if (data) {
|
|
@@ -683,6 +746,15 @@ $(document).ready(() => {
|
|
|
if (thousandth) sjsSettingObj.setTpThousandthFormat(posSpreadSetting);
|
|
|
sjsSettingObj.setPropValue(posSpreadSetting, ['gxby'], 'getValue', getGxbyText);
|
|
|
sjsSettingObj.setPropValue(posSpreadSetting, ['dagl'], 'getValue', getDaglText);
|
|
|
+ const pDaglCol = _.find(posSpreadSetting.cols, {field: 'dagl'});
|
|
|
+ if (pDaglCol) {
|
|
|
+ pDaglCol.getValue = getDaglText;
|
|
|
+ pDaglCol.cellType = 'activeImageBtn';
|
|
|
+ pDaglCol.normalImg = '#rela-file-icon';
|
|
|
+ pDaglCol.indent = 5;
|
|
|
+ pDaglCol.imgAlign = 2;
|
|
|
+ pDaglCol.showImage = function (data) { return data && data.dagl_url; }
|
|
|
+ }
|
|
|
SpreadJsObj.initSheet(spSpread.getActiveSheet(), posSpreadSetting);
|
|
|
|
|
|
const billsTag = $.billsTag({
|
|
@@ -1224,6 +1296,45 @@ $(document).ready(() => {
|
|
|
stagePosSpreadObj.loadCurPosData();
|
|
|
$('#calc-by-ratio').modal('hide');
|
|
|
});
|
|
|
+ },
|
|
|
+ exportExcel: function (filename, nodes) {
|
|
|
+ const exportNodesData = function (data, nodes) {
|
|
|
+ for (const node of nodes) {
|
|
|
+ data.push({
|
|
|
+ code: node.code, b_code: node.b_code, name: node.name, unit: node.unit,
|
|
|
+ unit_price: node.unit_price, quantity: node.quantity, total_price: node.total_price,
|
|
|
+ contract_qty: node.contract_qty, contract_tp: node.contract_tp,
|
|
|
+ qc_qty: node.qc_qty, qc_tp: node.qc_tp,
|
|
|
+ gather_qty: node.gather_qty, gather_tp: node.gather_tp,
|
|
|
+ end_contract_qty: node.end_contract_qty, end_contract_tp: node.end_contract_tp,
|
|
|
+ end_qc_qty: node.end_qc_qty, end_qc_tp: node.end_qc_tp,
|
|
|
+ end_gather_qty: node.end_gather_qty, end_gather_tp: node.end_gather_tp, end_gather_percent: node.end_gather_percent,
|
|
|
+ deal_dgn_qty1: node.deal_dgn_qty1, deal_dgn_qty2: node.deal_dgn_qty2,
|
|
|
+ c_dgn_qty1: node.c_dgn_qty1, c_dgn_qty2: node.c_dgn_qty2,
|
|
|
+ final_dgn_price: node.final_dgn_price,
|
|
|
+ postil: node.postil, drawing_code: node.drawing_code, memo: node.memo,
|
|
|
+ });
|
|
|
+ if (node.children && node.children.length > 0) {
|
|
|
+ exportNodesData(data, node.children);
|
|
|
+ } else {
|
|
|
+ const posRange = stagePos.getLedgerPos(node.id);
|
|
|
+ if (posRange && posRange.length > 0) {
|
|
|
+ for (const [i, p] of posRange.entries()) {
|
|
|
+ data.push({
|
|
|
+ pos_code: (i + 1) + '', name: p.name,
|
|
|
+ quantity: p.quantity,
|
|
|
+ contract_qty: p.contract_qty, qc_qty: p.qc_qty, gather_qty: p.gather_qty,
|
|
|
+ end_contract_qty: p.end_contract_qty, end_qc_qty: p.end_qc_qty, end_gather_qty: p.end_gather_qty,
|
|
|
+ drawing_code: p.drawing_code, memo: p.memo, postil: p.postil,
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ };
|
|
|
+ const data = [];
|
|
|
+ exportNodesData(data, nodes ? nodes : stageTree.children);
|
|
|
+ SpreadExcelObj.exportSimpleXlsxSheet(exportExcelSetting, data, filename);
|
|
|
}
|
|
|
};
|
|
|
slSpread.bind(spreadNS.Events.EditEnded, stageTreeSpreadObj.editEnded);
|
|
@@ -1283,11 +1394,10 @@ $(document).ready(() => {
|
|
|
});
|
|
|
}
|
|
|
stageTreeSpreadObj.loadExprToInput(slSpread.getActiveSheet());
|
|
|
- let addTagShare = true;
|
|
|
+ const addTag = newTag({ledgerSheet: slSpread.getActiveSheet(), billsTag});
|
|
|
$.contextMenu({
|
|
|
selector: '#stage-ledger',
|
|
|
build: function ($trigger, e) {
|
|
|
- addTagShare = true;
|
|
|
const target = SpreadJsObj.safeRightClickSelection($trigger, e, slSpread);
|
|
|
return target.hitTestType === spreadNS.SheetArea.viewport || target.hitTestType === spreadNS.SheetArea.rowHeader;
|
|
|
},
|
|
@@ -1324,82 +1434,30 @@ $(document).ready(() => {
|
|
|
}
|
|
|
},
|
|
|
},
|
|
|
+ tagSpr: '----',
|
|
|
tag: {
|
|
|
name: '书签',
|
|
|
- items: {
|
|
|
- tagShare: {
|
|
|
- name: '参与人可见',
|
|
|
- type: 'checkbox',
|
|
|
- selected: true,
|
|
|
- events: {
|
|
|
- change: function () {
|
|
|
- addTagShare = this.checked;
|
|
|
- }
|
|
|
- }
|
|
|
- },
|
|
|
- tagSpr: '--------------',
|
|
|
- tagPrimary: {
|
|
|
- icon: 'fa-tag text-primary mt-2 mb-2',
|
|
|
- name: '靛青',
|
|
|
- callback: function (key, opt, menu, e) {
|
|
|
- const node = SpreadJsObj.getSelectObject(slSpread.getActiveSheet());
|
|
|
- postData(window.location.pathname + '/tag', {add: { color: '#007bff', lid: node.id, share: addTagShare }}, function (data) {
|
|
|
- if (data.add) data.add.node = node;
|
|
|
- billsTag.updateDatasAndShow(data);
|
|
|
- SpreadJsObj.repaintNodesRowHeader(slSpread.getActiveSheet(), node);
|
|
|
- });
|
|
|
- },
|
|
|
- },
|
|
|
- tagSuccess: {
|
|
|
- icon: 'fa-tag text-success mt-2 mb-2',
|
|
|
- name: '果绿',
|
|
|
- callback: function (key, opt) {
|
|
|
- const node = SpreadJsObj.getSelectObject(slSpread.getActiveSheet());
|
|
|
- postData(window.location.pathname + '/tag', {add: { color: '#28a745', lid: node.id, share: addTagShare }}, function (data) {
|
|
|
- if (data.add) data.add.node = node;
|
|
|
- billsTag.updateDatasAndShow(data);
|
|
|
- SpreadJsObj.repaintNodesRowHeader(slSpread.getActiveSheet(), node);
|
|
|
- });
|
|
|
- },
|
|
|
- },
|
|
|
- tagDanger: {
|
|
|
- icon: 'fa-tag text-danger mt-2 mb-2',
|
|
|
- name: '朱砂',
|
|
|
- callback: function (key, opt) {
|
|
|
- const node = SpreadJsObj.getSelectObject(slSpread.getActiveSheet());
|
|
|
- postData(window.location.pathname + '/tag', {add: { color: '#dc3545', lid: node.id, share: addTagShare }}, function (data) {
|
|
|
- if (data.add) data.add.node = node;
|
|
|
- billsTag.updateDatasAndShow(data);
|
|
|
- SpreadJsObj.repaintNodesRowHeader(slSpread.getActiveSheet(), node);
|
|
|
- });
|
|
|
- },
|
|
|
- },
|
|
|
- tagWarning: {
|
|
|
- icon: 'fa-tag text-warning mt-2 mb-2',
|
|
|
- name: '姜黄',
|
|
|
- callback: function (key, opt) {
|
|
|
- const node = SpreadJsObj.getSelectObject(slSpread.getActiveSheet());
|
|
|
- postData(window.location.pathname + '/tag', {add: { color: '#da9500', lid: node.id, share: addTagShare }}, function (data) {
|
|
|
- if (data.add) data.add.node = node;
|
|
|
- billsTag.updateDatasAndShow(data);
|
|
|
- SpreadJsObj.repaintNodesRowHeader(slSpread.getActiveSheet(), node);
|
|
|
- });
|
|
|
- },
|
|
|
- },
|
|
|
- tagInfo: {
|
|
|
- icon: 'fa-tag text-info mt-2 mb-2',
|
|
|
- name: '天蓝',
|
|
|
- callback: function (key, opt) {
|
|
|
- const node = SpreadJsObj.getSelectObject(slSpread.getActiveSheet());
|
|
|
- postData(window.location.pathname + '/tag', {add: { color: '#17a2b8', lid: node.id, share: addTagShare }}, function (data) {
|
|
|
- if (data.add) data.add.node = node;
|
|
|
- billsTag.updateDatasAndShow(data);
|
|
|
- SpreadJsObj.repaintNodesRowHeader(slSpread.getActiveSheet(), node);
|
|
|
- });
|
|
|
- },
|
|
|
- }
|
|
|
+ callback: function (key, opt, menu, e) {
|
|
|
+ const node = SpreadJsObj.getSelectObject(slSpread.getActiveSheet());
|
|
|
+ addTag.do(node);
|
|
|
},
|
|
|
+ disabled: function (key, opt) {
|
|
|
+ const node = SpreadJsObj.getSelectObject(slSpread.getActiveSheet());
|
|
|
+ return !node;
|
|
|
+ }
|
|
|
},
|
|
|
+ exportSpr: '----',
|
|
|
+ exportSelectNodeXlsx: {
|
|
|
+ name: '导出选中节点至Excel',
|
|
|
+ callback: function (key, opt, menu, e) {
|
|
|
+ const node = SpreadJsObj.getSelectObject(slSpread.getActiveSheet());
|
|
|
+ stageTreeSpreadObj.exportExcel($('.sidebar-title').attr('data-original-title') + `计量台账(${node.name || ''}).xlsx`, [node]);
|
|
|
+ },
|
|
|
+ disabled: function (key, opt) {
|
|
|
+ const node = SpreadJsObj.getSelectObject(slSpread.getActiveSheet());
|
|
|
+ return !node;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
});
|
|
|
|
|
@@ -1833,6 +1891,10 @@ $(document).ready(() => {
|
|
|
if (stageTree.pwd.length > 0) $('#cooperationCount').parent().show();
|
|
|
reloadCooperationHtml();
|
|
|
}
|
|
|
+ for (const t of result.tags) {
|
|
|
+ t.node = stageTree.datas.find(x => {return x.id === t.lid});
|
|
|
+ }
|
|
|
+ billsTag.loadDatas(result.tags);
|
|
|
// 加载部位明细
|
|
|
stagePos.loadDatas(result.posData);
|
|
|
stagePos.calculateAll();
|
|
@@ -1844,10 +1906,6 @@ $(document).ready(() => {
|
|
|
stageIm.init(stage, imType, tenderInfo.decimal);
|
|
|
stageIm.loadData(result.ledgerData, result.posData, result.detailData, result.changeData);
|
|
|
|
|
|
- for (const t of result.tags) {
|
|
|
- t.node = stageTree.datas.find(x => {return x.id === t.lid});
|
|
|
- }
|
|
|
- billsTag.loadDatas(result.tags);
|
|
|
errorList.loadHisErrorData();
|
|
|
checkList.loadHisCheckData();
|
|
|
}, null, true);
|
|
@@ -2874,6 +2932,39 @@ $(document).ready(() => {
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
+ function upload(formData) {
|
|
|
+ if (formData.length < 1) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ postDataWithFile(window.location.pathname + '/detail/add-img', formData, function (result) {
|
|
|
+ const html = [];
|
|
|
+ html.push('<div class="img-item">');
|
|
|
+ html.push('<div class="img-bar">');
|
|
|
+ html.push('<a href="javascript: void(0);" class="text-danger" title="删除"><i class="fa fa-remove" style="font-size: 24px"></i></a>');
|
|
|
+ html.push('</div>');
|
|
|
+ html.push('<div class="focus" style="width:100%; height:100%"><img src="', '/' + result, '" id="draggable" style="width:100%; height:100%"></div>');
|
|
|
+ html.push('</div>');
|
|
|
+ $('.img-view').append(html.join(''));
|
|
|
+ $('.img-bar').click(removeImageItem);
|
|
|
+ setdraggrable();
|
|
|
+ $('#upload-img-file').val('');
|
|
|
+ });
|
|
|
+ }
|
|
|
+ function dragFile(e) {
|
|
|
+ var file = null,
|
|
|
+ data = e.dataTransfer.types;
|
|
|
+ for (var i = 0; i < data.length; i += 1) {
|
|
|
+ if (data[i] === 'Files') {
|
|
|
+ file = e.dataTransfer.files; //获取文件
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (file && file[0].type.indexOf('image') !== -1) {
|
|
|
+ var formData = new FormData();
|
|
|
+ formData.append('file', file[0]); //上传单个文件的添加方式
|
|
|
+ upload(formData); //upload 异步上传
|
|
|
+ }
|
|
|
+ }
|
|
|
// 移动图片
|
|
|
const moveImageItem = function (ev) {
|
|
|
const item = this;
|
|
@@ -2934,6 +3025,42 @@ $(document).ready(() => {
|
|
|
$('#upload-img').click(function () {
|
|
|
$('#upload-img-file').trigger('click');
|
|
|
});
|
|
|
+ // 拖拽上传
|
|
|
+ //拖拽上传文件
|
|
|
+ const dragbox = document.querySelector('#upload-img');
|
|
|
+ dragbox.addEventListener('dragover', function(e) {
|
|
|
+ e.preventDefault(); // 必须阻止默认事件
|
|
|
+ }, false);
|
|
|
+ dragbox.addEventListener('drop', function(e) {
|
|
|
+ e.preventDefault(); // 阻止默认事件
|
|
|
+ dragFile(e);
|
|
|
+ }, false);
|
|
|
+ //拖拽上传文件
|
|
|
+ const dragbox2 = document.querySelector('.img-view');
|
|
|
+ dragbox2.addEventListener('dragover', function(e) {
|
|
|
+ e.preventDefault(); // 必须阻止默认事件
|
|
|
+ }, false);
|
|
|
+ dragbox2.addEventListener('drop', function(e) {
|
|
|
+ e.preventDefault(); // 阻止默认事件
|
|
|
+ dragFile(e);
|
|
|
+ }, false);
|
|
|
+ // 粘贴上传
|
|
|
+ $(".img-view").on('paste', function(ev) {
|
|
|
+ let file = null;
|
|
|
+ const data = (event.clipboardData || window.clipboardData).items;
|
|
|
+ for (let i = 0; i < data.length; i += 1) {
|
|
|
+ if ((data[i].kind == 'file') && (data[i].type.match('^image/'))) {
|
|
|
+ file = data[i].getAsFile(); //读取图片文件
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (file) {
|
|
|
+ const formData = new FormData();
|
|
|
+ formData.append('file', file); //上传单个文件的添加方式
|
|
|
+ upload(formData); //异步上传文件
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
$('#upload-img-file').change(function () {
|
|
|
const file = this.files[0];
|
|
|
const ext = file.name.toLowerCase().split('.').splice(-1)[0];
|
|
@@ -2945,19 +3072,7 @@ $(document).ready(() => {
|
|
|
if ($(this).val()) {
|
|
|
const formData = new FormData();
|
|
|
formData.append('file', this.files[0]);
|
|
|
- postDataWithFile(window.location.pathname + '/detail/add-img', formData, function (result) {
|
|
|
- const html = [];
|
|
|
- html.push('<div class="img-item">');
|
|
|
- html.push('<div class="img-bar">');
|
|
|
- html.push('<a href="javascript: void(0);" class="text-danger" title="删除"><i class="fa fa-remove" style="font-size: 24px"></i></a>');
|
|
|
- html.push('</div>');
|
|
|
- html.push('<div class="focus" style="width:100%; height:100%"><img src="', '/' + result, '" id="draggable" style="width:100%; height:100%"></div>');
|
|
|
- html.push('</div>');
|
|
|
- $('.img-view').append(html.join(''));
|
|
|
- $('.img-bar').click(removeImageItem);
|
|
|
- setdraggrable();
|
|
|
- $('#upload-img-file').val('');
|
|
|
- });
|
|
|
+ upload(formData);
|
|
|
}
|
|
|
});
|
|
|
|
|
@@ -3187,15 +3302,26 @@ $(document).ready(() => {
|
|
|
this.changeSheet = this.changeSpread.getActiveSheet();
|
|
|
SpreadJsObj.initSheet(this.changeSheet, this.changeSpreadSetting);
|
|
|
|
|
|
+ const getTipText = function (data) {
|
|
|
+ if (!data) return '';
|
|
|
+
|
|
|
+ const tips = [];
|
|
|
+ if (data.xmj_dwgc) tips.push(data.xmj_dwgc);
|
|
|
+ if (data.xmj_fbgc) tips.push(data.xmj_fbgc);
|
|
|
+ if (data.xmj_fxgc) tips.push(data.xmj_fxgc);
|
|
|
+ if (data.xmj_jldy) tips.push(data.xmj_jldy);
|
|
|
+ return tips.join('-');
|
|
|
+ };
|
|
|
+
|
|
|
this.changeBillsSpreadSetting = {
|
|
|
cols: [
|
|
|
- {title: '清单编号', colSpan: '1', rowSpan: '1', field: 'code', hAlign: 0, width: 80, formatter: '@'},
|
|
|
- {title: '名称', colSpan: '1', rowSpan: '1', field: 'name', hAlign: 0, width: 150, type: 'Number'},
|
|
|
- {title: '单位', colSpan: '1', rowSpan: '1', field: 'unit', hAlign: 1, width: 50, formatter: '@'},
|
|
|
- {title: '单价', colSpan: '1', rowSpan: '1', field: 'unit_price', hAlign: 2, width: 60, type: 'Number'},
|
|
|
- {title: '数量', colSpan: '1', rowSpan: '1', field: 'qty', hAlign: 2, width: 60, formatter: '@'},
|
|
|
- {title: '金额', colSpan: '1', rowSpan: '1', field: 'tp', hAlign: 2, width: 60, formatter: '@'},
|
|
|
- {title: '变更部位', colSpan: '1', rowSpan: '1', field: 'bwmx', hAlign: 0, width: 100, formatter: '@'},
|
|
|
+ {title: '清单编号', colSpan: '1', rowSpan: '1', field: 'code', hAlign: 0, width: 80, formatter: '@', cellType: 'tip', getTip: getTipText},
|
|
|
+ {title: '名称', colSpan: '1', rowSpan: '1', field: 'name', hAlign: 0, width: 150, type: 'Number', cellType: 'tip', getTip: getTipText},
|
|
|
+ {title: '单位', colSpan: '1', rowSpan: '1', field: 'unit', hAlign: 1, width: 50, formatter: '@', cellType: 'tip', getTip: getTipText},
|
|
|
+ {title: '单价', colSpan: '1', rowSpan: '1', field: 'unit_price', hAlign: 2, width: 60, type: 'Number', cellType: 'tip', getTip: getTipText},
|
|
|
+ {title: '数量', colSpan: '1', rowSpan: '1', field: 'qty', hAlign: 2, width: 60, formatter: '@', cellType: 'tip', getTip: getTipText},
|
|
|
+ {title: '金额', colSpan: '1', rowSpan: '1', field: 'tp', hAlign: 2, width: 60, formatter: '@', cellType: 'tip', getTip: getTipText},
|
|
|
+ {title: '变更部位', colSpan: '1', rowSpan: '1', field: 'bwmx', hAlign: 0, width: 100, formatter: '@', cellType: 'tip', getTip: getTipText},
|
|
|
],
|
|
|
emptyRows: 0,
|
|
|
headRows: 1,
|
|
@@ -3862,75 +3988,7 @@ $(document).ready(() => {
|
|
|
});
|
|
|
|
|
|
$('#exportExcel').click(function () {
|
|
|
- const data = [];
|
|
|
- const setting = {
|
|
|
- cols: [
|
|
|
- {title: '项目节编号', colSpan: '1', rowSpan: '2', field: 'code', hAlign: 0, width: 145, formatter: '@', cellType: 'tree'},
|
|
|
- {title: '清单编号', colSpan: '1', rowSpan: '2', field: 'b_code', hAlign: 0, width: 70, formatter: '@'},
|
|
|
- {title: '计量单元', colSpan: '1', rowSpan: '2', field: 'pos_code', hAlign: 0, width: 70, formatter: '@'},
|
|
|
- {title: '名称', colSpan: '1', rowSpan: '2', field: 'name', hAlign: 0, width: 185, formatter: '@'},
|
|
|
- {title: '单位', colSpan: '1', rowSpan: '2', field: 'unit', hAlign: 1, width: 60, formatter: '@', cellType: 'unit'},
|
|
|
- {title: '单价', colSpan: '1', rowSpan: '2', field: 'unit_price', hAlign: 2, width: 60, type: 'Number'},
|
|
|
- {title: '台账|数量', colSpan: '2|1', rowSpan: '1|1', field: 'quantity', hAlign: 2, width: 60, type: 'Number'},
|
|
|
- {title: '|金额', colSpan: '|1', rowSpan: '|1', field: 'total_price', hAlign: 2, width: 60, type: 'Number'},
|
|
|
- {title: '本期合同计量|数量', colSpan: '2|1', rowSpan: '1|1', field: 'contract_qty', hAlign: 2, width: 60, type: 'Number'},
|
|
|
- {title: '|金额', colSpan: '|1', rowSpan: '|1', field: 'contract_tp', hAlign: 2, width: 60, type: 'Number'},
|
|
|
- {title: '本期数量变更|数量', colSpan: '2|1', rowSpan: '1|1', field: 'qc_qty', hAlign: 2, width: 60, type: 'Number'},
|
|
|
- {title: '|金额', colSpan: '|1', rowSpan: '|1', field: 'qc_tp', hAlign: 2, width: 60, type: 'Number'},
|
|
|
- {title: '本期完成计量|数量', colSpan: '2|1', rowSpan: '1|1', field: 'gather_qty', hAlign: 2, width: 60, type: 'Number'},
|
|
|
- {title: '|金额', colSpan: '|1', rowSpan: '|1', field: 'gather_tp', hAlign: 2, width: 60, type: 'Number'},
|
|
|
- {title: '截止本期合同计量|数量', colSpan: '2|1', rowSpan: '1|1', field: 'end_contract_qty', hAlign: 2, width: 60, type: 'Number'},
|
|
|
- {title: '|金额', colSpan: '|1', rowSpan: '|1', field: 'end_contract_tp', hAlign: 2, width: 60, type: 'Number'},
|
|
|
- {title: '截止本期数量变更|数量', colSpan: '2|1', rowSpan: '1|1', field: 'end_qc_qty', hAlign: 2, width: 60, type: 'Number'},
|
|
|
- {title: '|金额', colSpan: '|1', rowSpan: '|1', field: 'end_qc_tp', hAlign: 2, width: 60, type: 'Number'},
|
|
|
- {title: '截止本期完成计量|数量', colSpan: '3|1', rowSpan: '1|1', field: 'end_gather_qty', hAlign: 2, width: 60, type: 'Number'},
|
|
|
- {title: '|金额', colSpan: '|1', rowSpan: '|1', field: 'end_gather_tp', hAlign: 2, width: 60, type: 'Number'},
|
|
|
- {title: '|完成率(%)', colSpan: '|1', rowSpan: '|1', field: 'end_gather_percent', hAlign: 2, width: 80, type: 'Number'},
|
|
|
- {title: '合同|项目节数量1', colSpan: '2|1', rowSpan: '1|1', field: 'deal_dgn_qty1', hAlign: 2, width: 60, type: 'Number'},
|
|
|
- {title: '|项目节数量2', colSpan: '|1', rowSpan: '|1', field: 'deal_dgn_qty2', hAlign: 2, width: 60, type: 'Number'},
|
|
|
- {title: '变更|项目节数量1', colSpan: '2|1', rowSpan: '1|1', field: 'c_dgn_qty1', hAlign: 2, width: 60, type: 'Number'},
|
|
|
- {title: '|项目节数量2', colSpan: '|1', rowSpan: '|1', field: 'c_dgn_qty2', hAlign: 2, width: 60, type: 'Number'},
|
|
|
- {title: '经济指标', colSpan: '1', rowSpan: '2', field: 'final_dgn_price', hAlign: 2, width: 60, type: 'Number'},
|
|
|
- {title: '本期批注', colSpan: '1', rowSpan: '2', field: 'postil', hAlign: 0, width: 100, formatter: '@', cellType: 'autoTip'},
|
|
|
- {title: '图(册)号', colSpan: '1', rowSpan: '2', field: 'drawing_code', hAlign: 0, width: 80, formatter: '@'},
|
|
|
- {title: '备注', colSpan: '1', rowSpan: '2', field: 'memo', hAlign: 0, width: 100, formatter: '@', cellType: 'ellipsisAutoTip'},
|
|
|
- ],
|
|
|
- headRows: 2,
|
|
|
- headRowHeight: [25, 25],
|
|
|
- defaultRowHeight: 21,
|
|
|
- headerFont: 'bold 10px 微软雅黑',
|
|
|
- font: '10px 微软雅黑'
|
|
|
- };
|
|
|
- for (const node of stageTree.nodes) {
|
|
|
- data.push({
|
|
|
- code: node.code, b_code: node.b_code, name: node.name, unit: node.unit,
|
|
|
- unit_price: node.unit_price, quantity: node.quantity, total_price: node.total_price,
|
|
|
- contract_qty: node.contract_qty, contract_tp: node.contract_tp,
|
|
|
- qc_qty: node.qc_qty, qc_tp: node.qc_tp,
|
|
|
- gather_qty: node.gather_qty, gather_tp: node.gather_tp,
|
|
|
- end_contract_qty: node.end_contract_qty, end_contract_tp: node.end_contract_tp,
|
|
|
- end_qc_qty: node.end_qc_qty, end_qc_tp: node.end_qc_tp,
|
|
|
- end_gather_qty: node.end_gather_qty, end_gather_tp: node.end_gather_tp, end_gather_percent: node.end_gather_percent,
|
|
|
- deal_dgn_qty1: node.deal_dgn_qty1, deal_dgn_qty2: node.deal_dgn_qty2,
|
|
|
- c_dgn_qty1: node.c_dgn_qty1, c_dgn_qty2: node.c_dgn_qty2,
|
|
|
- final_dgn_price: node.final_dgn_price,
|
|
|
- postil: node.postil, drawing_code: node.drawing_code, memo: node.memo,
|
|
|
- });
|
|
|
- const posRange = stagePos.getLedgerPos(node.id);
|
|
|
- if (posRange && posRange.length > 0) {
|
|
|
- for (const [i, p] of posRange.entries()) {
|
|
|
- data.push({
|
|
|
- pos_code: (i + 1) + '', name: p.name,
|
|
|
- quantity: p.quantity,
|
|
|
- contract_qty: p.contract_qty, qc_qty: p.qc_qty, gather_qty: p.gather_qty,
|
|
|
- end_contract_qty: p.end_contract_qty, end_qc_qty: p.end_qc_qty, end_gather_qty: p.end_gather_qty,
|
|
|
- drawing_code: p.drawing_code, memo: p.memo
|
|
|
- });
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- SpreadExcelObj.exportSimpleXlsxSheet(setting, data, $('.sidebar-title').attr('data-original-title') + "计量台账.xlsx");
|
|
|
+ stageTreeSpreadObj.exportExcel($('.sidebar-title').attr('data-original-title') + "计量台账.xlsx", stageTree.children);
|
|
|
});
|
|
|
|
|
|
$('#cbr-check-all').click(function () {
|