|
|
@@ -26,7 +26,7 @@
|
|
|
cols: [
|
|
|
{title: '名称', colSpan: '1', rowSpan: '1', field: 'name', hAlign: 0, width: 145, formatter: '@'},
|
|
|
{title: '创建人', colSpan: '1', rowSpan: '1', field: 'user_name', hAlign: 1, width: 70, formatter: '@', readOnly: true},
|
|
|
- {title: '创建时间', colSpan: '1', rowSpan: '1', field: 'create_time', hAlign: 1, width: 80, formatter: '@', getValue: function(data) { return moment(data.create_time).format('YYYY-HH-DD')}, readOnly: true},
|
|
|
+ {title: '创建时间', colSpan: '1', rowSpan: '1', field: 'create_time', hAlign: 1, width: 80, formatter: '@', getValue: function(data) { return moment(data.create_time).format('YYYY-MM-DD')}, readOnly: true},
|
|
|
{title: '来源', colSpan: '1', rowSpan: '1', field: 'source', hAlign: 0, width: 200, formatter: '@', readOnly: true},
|
|
|
],
|
|
|
emptyRows: 0,
|
|
|
@@ -53,7 +53,7 @@
|
|
|
},
|
|
|
disabled: function() {
|
|
|
const node = SpreadJsObj.getSelectObject(tempSheet);
|
|
|
- return node.create_user_id === userID;
|
|
|
+ return node.create_user_id !== userID;
|
|
|
},
|
|
|
},
|
|
|
apply: {
|
|
|
@@ -66,7 +66,31 @@
|
|
|
visible: function() {
|
|
|
return !!setting.applyTemplate;
|
|
|
}
|
|
|
- }
|
|
|
+ },
|
|
|
+ share: {
|
|
|
+ name: '共享',
|
|
|
+ icon: 'fa-link',
|
|
|
+ callback: function() {
|
|
|
+ const node = SpreadJsObj.getSelectObject(tempSheet);
|
|
|
+ shareTemplate(node, true);
|
|
|
+ },
|
|
|
+ visible: function() {
|
|
|
+ const node = SpreadJsObj.getSelectObject(tempSheet);
|
|
|
+ return node.create_user_id === userID && !node.is_share;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ keep: {
|
|
|
+ name: '取消共享',
|
|
|
+ icon: 'fa-unlink',
|
|
|
+ callback: function() {
|
|
|
+ const node = SpreadJsObj.getSelectObject(tempSheet);
|
|
|
+ shareTemplate(node, false);
|
|
|
+ },
|
|
|
+ visible: function() {
|
|
|
+ const node = SpreadJsObj.getSelectObject(tempSheet);
|
|
|
+ return node.create_user_id === userID && !!node.is_share;
|
|
|
+ }
|
|
|
+ },
|
|
|
}
|
|
|
});
|
|
|
$('#temp-search').click(function() {
|
|
|
@@ -108,6 +132,11 @@
|
|
|
}
|
|
|
SpreadJsObj.refreshTreeRowVisible(tempSheet);
|
|
|
};
|
|
|
+ const shareTemplate = function(template, share) {
|
|
|
+ postData('/template/ledger/save', { update: { id: template.id, is_share: share ? 1 : 0 } }, function(result) {
|
|
|
+ template.is_share = result.update.is_share;
|
|
|
+ });
|
|
|
+ };
|
|
|
const loadDatas = function (datas) {
|
|
|
templateList = datas;
|
|
|
SpreadJsObj.loadSheetData(tempSheet, SpreadJsObj.DataType.Data, templateList);
|