|
@@ -69,64 +69,65 @@ const sjsSettingObj = (function () {
|
|
|
if (col) col[prop] = value;
|
|
|
}
|
|
|
};
|
|
|
- const set3FCols = function (cols, rela) {
|
|
|
+ const setRelaCols = function(cols, rela, fun) {
|
|
|
for (const r of rela) {
|
|
|
const col = _.find(cols, {field: r.field});
|
|
|
- if (col) {
|
|
|
- col.getValue = r.getValue;
|
|
|
- col.cellType = 'imageBtn';
|
|
|
- col.normalImg = '#rela-file-icon';
|
|
|
- col.indent = 12;
|
|
|
- col.imgAlign = 2;
|
|
|
- col.showImage = function (data) { return data && data[r.url_field]; }
|
|
|
- }
|
|
|
+ if (!col) continue;
|
|
|
+ fun(col, r);
|
|
|
}
|
|
|
};
|
|
|
+ const set3FCols = function (cols, rela) {
|
|
|
+ setRelaCols(cols, rela, function(col, r) {
|
|
|
+ col.getValue = r.getValue;
|
|
|
+ col.cellType = 'imageBtn';
|
|
|
+ col.normalImg = '#rela-file-icon';
|
|
|
+ col.indent = 12;
|
|
|
+ col.imgAlign = 2;
|
|
|
+ col.showImage = function (data) { return data && data[r.url_field]; }
|
|
|
+ });
|
|
|
+ };
|
|
|
const setQcCols = function (cols, rela){
|
|
|
- for (const r of rela) {
|
|
|
- const col = _.find(cols, {field: r.field});
|
|
|
- if (!col) continue;
|
|
|
-
|
|
|
+ setRelaCols(cols, rela, function(col, r) {
|
|
|
col.readOnly = true;
|
|
|
col.cellType = 'activeImageBtn';
|
|
|
col.normalImg = '#ellipsis-icon';
|
|
|
col.indent = 5;
|
|
|
col.showImage = r.showImage;
|
|
|
- }
|
|
|
+ });
|
|
|
};
|
|
|
const setOrgPriceCol = function (cols, rela) {
|
|
|
- for (const r of rela) {
|
|
|
- const col = _.find(cols, {field: r.field});
|
|
|
- if (col) {
|
|
|
- col.getValue = function (data) { return data.contract_pc_tp || data.qc_pc_tp || data.pc_tp ? data.org_price : null; };
|
|
|
- }
|
|
|
- }
|
|
|
+ setRelaCols(cols, rela, function(col, r) {
|
|
|
+ col.getValue = function (data) { return data.contract_pc_tp || data.qc_pc_tp || data.pc_tp ? data.org_price : null; };
|
|
|
+ });
|
|
|
};
|
|
|
const setNodeTypeCol = function (cols, rela) {
|
|
|
- for (const r of rela) {
|
|
|
- const col = _.find(cols, {field: r.field});
|
|
|
- if (col) {
|
|
|
- col.comboItems = nodeType;
|
|
|
- col.cellType = 'specCombo';
|
|
|
- col.comboEdit = function (sheet, data) {
|
|
|
- if (!data) return false;
|
|
|
+ setRelaCols(cols, rela, function(col, r) {
|
|
|
+ col.comboItems = nodeType;
|
|
|
+ col.cellType = 'specCombo';
|
|
|
+ col.comboEdit = function (sheet, data) {
|
|
|
+ if (!data) return false;
|
|
|
|
|
|
- const tree = sheet.zh_tree;
|
|
|
- if (!tree) return false;
|
|
|
+ const tree = sheet.zh_tree;
|
|
|
+ if (!tree) return false;
|
|
|
|
|
|
- const parent = tree.getParent(data);
|
|
|
- if (!parent) return false;
|
|
|
+ const parent = tree.getParent(data);
|
|
|
+ if (!parent) return false;
|
|
|
|
|
|
- return true;
|
|
|
- // const topParent = tree.getTopParent(data);
|
|
|
- // return [1, 5].indexOf(topParent.node_type) >= 0;
|
|
|
- };
|
|
|
- }
|
|
|
- }
|
|
|
+ return true;
|
|
|
+ // const topParent = tree.getTopParent(data);
|
|
|
+ // return [1, 5].indexOf(topParent.node_type) >= 0;
|
|
|
+ };
|
|
|
+ });
|
|
|
+ };
|
|
|
+ const setIsTpCol = function(cols, rela) {
|
|
|
+ setRelaCols(cols, rela, function(col, r) {
|
|
|
+ col.headerCellType = 'tip';
|
|
|
+ col.getHeaderTip = function() { return '可用单位:元、总额、台、个、处、月 、棵、套、组、辆'; };
|
|
|
+ });
|
|
|
};
|
|
|
return {
|
|
|
setFxTreeStyle, FxTreeStyle, setGridSelectStyle,
|
|
|
setTpThousandthFormat, setThousandthFormat, setTpColsThousandthFormat,
|
|
|
- setPropValue, set3FCols, setQcCols, setOrgPriceCol, setNodeTypeCol,
|
|
|
+ setPropValue, set3FCols, setQcCols, setOrgPriceCol, setNodeTypeCol, setIsTpCol,
|
|
|
};
|
|
|
})();
|