|
|
@@ -14,19 +14,22 @@ $(document).ready(() => {
|
|
|
constructor() {
|
|
|
this.cacheKey = 'zh.subProjProgressColSet';
|
|
|
this.colSetDatas = [
|
|
|
- { id: 1, pid: -1, level: 1, order: 1, is_leaf: 0, full_path: '1', name: '成果编制', field: '', show: 1},
|
|
|
+ { id: 14, pid: -1, level: 1, order: 1, is_leaf: 1, full_path: '14', name: '序号', field: 'code', show: 1, readOnly: 1, },
|
|
|
+ { id: 15, pid: -1, level: 1, order: 2, is_leaf: 1, full_path: '15', name: '阶段/项目名称', field: 'name', show: 1, readOnly: 1, },
|
|
|
+ { id: 1, pid: -1, level: 1, order: 3, is_leaf: 0, full_path: '1', name: '成果编制', field: '', show: 1},
|
|
|
{ id: 2, pid: 1, level: 2, order: 1, is_leaf: 1, full_path: '1-2', name: '进度', field: 'edit_progress', show: 1},
|
|
|
{ id: 3, pid: 1, level: 2, order: 2, is_leaf: 1, full_path: '1-3', name: '日期', field: 'edit_date', show: 1},
|
|
|
{ id: 4, pid: 1, level: 2, order: 3, is_leaf: 1, full_path: '1-4', name: '部门', field: 'edit_department', show: 1},
|
|
|
- { id: 5, pid: -1, level: 1, order: 2, is_leaf: 0, full_path: '5', name: '报审情况', field: '', show: 1},
|
|
|
+ { id: 5, pid: -1, level: 1, order: 4, is_leaf: 0, full_path: '5', name: '报审情况', field: '', show: 1},
|
|
|
{ id: 6, pid: 5, level: 2, order: 1, is_leaf: 1, full_path: '5-6', name: '进度', field: 'submit_progress', show: 1},
|
|
|
{ id: 7, pid: 5, level: 2, order: 2, is_leaf: 1, full_path: '5-7', name: '日期', field: 'submit_date', show: 1},
|
|
|
{ id: 8, pid: 5, level: 2, order: 3, is_leaf: 1, full_path: '5-8', name: '部门', field: 'submit_department', show: 1},
|
|
|
- { id: 9, pid: -1, level: 1, order: 3, is_leaf: 0, full_path: '9', name: '批复情况', field: '', show: 1},
|
|
|
+ { id: 9, pid: -1, level: 1, order: 5, is_leaf: 0, full_path: '9', name: '批复情况', field: '', show: 1},
|
|
|
{ id: 10, pid: 9, level: 2, order: 1, is_leaf: 1, full_path: '9-10', name: '进度', field: 'reply_progress', show: 1},
|
|
|
{ id: 11, pid: 9, level: 2, order: 2, is_leaf: 1, full_path: '9-11', name: '日期', field: 'reply_date', show: 1},
|
|
|
{ id: 12, pid: 9, level: 2, order: 3, is_leaf: 1, full_path: '9-12', name: '部门', field: 'reply_department', show: 1},
|
|
|
{ id: 13, pid: 9, level: 2, order: 4, is_leaf: 1, full_path: '9-13', name: '文号', field: 'reply_code', show: 1},
|
|
|
+ { id: 16, pid: -1, level: 1, order: 6, is_leaf: 1, full_path: '16', name: '备注', field: 'memo', show: 1, readOnly: 1, },
|
|
|
];
|
|
|
this.cache = this.colSetDatas.filter(x => { return x.field; }).map(x => { return {field: x.field, show: x.show}; });
|
|
|
this.tree = createNewPathTree('ledger', { id: 'id', pid: 'pid', order: 'order', level: 'level', isLeaf: 'is_leaf', fullPath: 'full_path', rootId: -1 });
|
|
|
@@ -35,20 +38,25 @@ $(document).ready(() => {
|
|
|
if (cacheStr) this.cache = JSON.parse(cacheStr);
|
|
|
}
|
|
|
reInitTreeData() {
|
|
|
+ const self = this;
|
|
|
this.tree.nodes.forEach(x => {
|
|
|
if (!x.field) return;
|
|
|
- const csd = this.cache.find(d => { return x.field === d.field; });
|
|
|
- if (csd) x.show = csd.show;
|
|
|
+ const csd = self.cache.find(d => { return x.field === d.field; });
|
|
|
+ if (csd) x.show = csd.show ? true : false;
|
|
|
});
|
|
|
this.tree.nodes.forEach(x => {
|
|
|
if (!x.children || x.children.length === 0) return;
|
|
|
- x.show = x.children.filter(c => { return !!c.show; }).length > 0 ? 1 : 0;
|
|
|
- })
|
|
|
+ x.show = x.children.filter(c => { return !!c.show; }).length > 0 ? true : false;
|
|
|
+ });
|
|
|
}
|
|
|
spreadButtonClick(e, info) {
|
|
|
if (!info.sheet.zh_setting) return;
|
|
|
|
|
|
const select = SpreadJsObj.getSelectObject(info.sheet);
|
|
|
+ if (select.readOnly) {
|
|
|
+ SpreadJsObj.reLoadRowData(info.sheet, info.row, 1);
|
|
|
+ return;
|
|
|
+ }
|
|
|
const col = info.sheet.zh_setting.cols[info.col];
|
|
|
if (col.field !== 'show') return;
|
|
|
if (info.sheet.isEditing()) info.sheet.endEdit(true);
|
|
|
@@ -78,11 +86,18 @@ $(document).ready(() => {
|
|
|
headerFont: '12px 微软雅黑',
|
|
|
font: '12px 微软雅黑',
|
|
|
readOnly: true,
|
|
|
+ getColor: function(sheet, data, row, col, defaultColor) {
|
|
|
+ return data && data.readOnly ? spreadColor.common.invalid : defaultColor;
|
|
|
+ }
|
|
|
});
|
|
|
$('#spp-col-set').on('shown.bs.modal', function() {
|
|
|
spread.refresh();
|
|
|
});
|
|
|
- spread.bind(spreadNS.Events.ButtonClicked, this.spreadButtonClick)
|
|
|
+ spread.bind(spreadNS.Events.ButtonClicked, this.spreadButtonClick);
|
|
|
+ spread.bind(spreadNS.Events.EditStarting, function(e, info) {
|
|
|
+ const select = SpreadJsObj.getSelectObject(info.sheet);
|
|
|
+ info.cancel = !select || !!select.readOnly;
|
|
|
+ })
|
|
|
}
|
|
|
SpreadJsObj.loadSheetData(this.sheet, SpreadJsObj.DataType.Tree, this.tree, true);
|
|
|
}
|
|
|
@@ -97,8 +112,8 @@ $(document).ready(() => {
|
|
|
setLocalCache(this.cacheKey, JSON.stringify(this.cache));
|
|
|
}
|
|
|
show() {
|
|
|
- this.initSpread();
|
|
|
this.reInitTreeData();
|
|
|
+ this.initSpread();
|
|
|
$('#spp-col-set').modal('show');
|
|
|
}
|
|
|
}
|