|
@@ -314,7 +314,6 @@ $(document).ready(() => {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
const folderObj = new FolderObj();
|
|
const folderObj = new FolderObj();
|
|
|
- folderObj.loadData(folderList);
|
|
|
|
|
class TemplateObj {
|
|
class TemplateObj {
|
|
|
constructor() {
|
|
constructor() {
|
|
|
this.spread = SpreadJsObj.createNewSpread($('#template-spread')[0]);
|
|
this.spread = SpreadJsObj.createNewSpread($('#template-spread')[0]);
|
|
@@ -322,7 +321,8 @@ $(document).ready(() => {
|
|
|
this.data = createAncillaryGcl({ id: 'id', masterId: 'folder_id', sort: [['create_time', 'desc']] });
|
|
this.data = createAncillaryGcl({ id: 'id', masterId: 'folder_id', sort: [['create_time', 'desc']] });
|
|
|
this.templateSpreadSetting = {
|
|
this.templateSpreadSetting = {
|
|
|
cols: [
|
|
cols: [
|
|
|
- {title: '名称', colSpan: '1', rowSpan: '1', field: 'name', hAlign: 0, width: 240, formatter: '@'},
|
|
|
|
|
|
|
+ {title: '选择', colSpan: '1', rowSpan: '1', field: 'selected', hAlign: 1, width: 35, readOnly: true, cellType: "checkbox"},
|
|
|
|
|
+ {title: '名称', colSpan: '1', rowSpan: '1', field: 'name', hAlign: 0, width: 210, formatter: '@'},
|
|
|
{title: '创建人', colSpan: '1', rowSpan: '1', field: 'user_name', hAlign: 1, width: 80, formatter: '@', readOnly: true},
|
|
{title: '创建人', colSpan: '1', rowSpan: '1', field: 'user_name', hAlign: 1, width: 80, formatter: '@', readOnly: true},
|
|
|
],
|
|
],
|
|
|
emptyRows: 0,
|
|
emptyRows: 0,
|
|
@@ -362,6 +362,7 @@ $(document).ready(() => {
|
|
|
this.spread.bind(spreadNS.Events.EditStarting, this.editStarting);
|
|
this.spread.bind(spreadNS.Events.EditStarting, this.editStarting);
|
|
|
this.spread.bind(spreadNS.Events.EditEnded, this.editEnded);
|
|
this.spread.bind(spreadNS.Events.EditEnded, this.editEnded);
|
|
|
this.spread.bind(spreadNS.Events.ClipboardPasting, this.clipboardPasting);
|
|
this.spread.bind(spreadNS.Events.ClipboardPasting, this.clipboardPasting);
|
|
|
|
|
+ this.spread.bind(spreadNS.Events.ButtonClicked, this.buttonClicked);
|
|
|
SpreadJsObj.addDeleteBind(this.spread, this.deletePress);
|
|
SpreadJsObj.addDeleteBind(this.spread, this.deletePress);
|
|
|
}
|
|
}
|
|
|
initOtherEvent() {
|
|
initOtherEvent() {
|
|
@@ -526,9 +527,40 @@ $(document).ready(() => {
|
|
|
clipboardPasting(e, info) {
|
|
clipboardPasting(e, info) {
|
|
|
info.cancel = true;
|
|
info.cancel = true;
|
|
|
}
|
|
}
|
|
|
|
|
+ import(){
|
|
|
|
|
+ if (!this.folder) {
|
|
|
|
|
+ toastr.warning('请先选择要导入模板的分类');
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ BaseImportFile.show({
|
|
|
|
|
+ validList: ['.ctdp'],
|
|
|
|
|
+ url: `/template/ctd/load?batch=1&folder_id=${encodeURIComponent(this.folder.id)}`,
|
|
|
|
|
+ afterImport: function(result) {
|
|
|
|
|
+ templateObj.data.updateDatas({ add: result.add });
|
|
|
|
|
+ templateObj.refreshSheet();
|
|
|
|
|
+ templateObj.loadTemplate();
|
|
|
|
|
+ },
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+ export() {
|
|
|
|
|
+ this.sheet.endEdit();
|
|
|
|
|
+ const ids = this.sheet.zh_data.filter(item => item.selected).map(item => item.id);
|
|
|
|
|
+ if (!ids.length) {
|
|
|
|
|
+ toastr.warning('请先勾选要导出的模板');
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ window.open(`/template/ctd?tids=${encodeURIComponent(JSON.stringify(ids))}`);
|
|
|
|
|
+ }
|
|
|
|
|
+ buttonClicked(e, info) {
|
|
|
|
|
+ const col = info.sheet.zh_setting.cols[info.col];
|
|
|
|
|
+ if (col.field !== 'selected') return;
|
|
|
|
|
+ const template = info.sheet.zh_data[info.row];
|
|
|
|
|
+ if (!template) return;
|
|
|
|
|
+ template.selected = !template.selected;
|
|
|
|
|
+ SpreadJsObj.reloadColData(info.sheet, info.col);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
const templateObj = new TemplateObj();
|
|
const templateObj = new TemplateObj();
|
|
|
- templateObj.loadData(templateList);
|
|
|
|
|
|
|
|
|
|
class TemplateDetailObj {
|
|
class TemplateDetailObj {
|
|
|
constructor() {
|
|
constructor() {
|
|
@@ -873,6 +905,8 @@ $(document).ready(() => {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
const detailObj = new TemplateDetailObj();
|
|
const detailObj = new TemplateDetailObj();
|
|
|
|
|
+ folderObj.loadData(folderList);
|
|
|
|
|
+ templateObj.loadData(templateList);
|
|
|
|
|
|
|
|
$('#preview').click(function() {
|
|
$('#preview').click(function() {
|
|
|
const data = { type: 'posCalc', col_set: detailObj.getCurrentColSet() };
|
|
const data = { type: 'posCalc', col_set: detailObj.getCurrentColSet() };
|
|
@@ -901,6 +935,13 @@ $(document).ready(() => {
|
|
|
$('#import').click(function() {
|
|
$('#import').click(function() {
|
|
|
detailObj.import();
|
|
detailObj.import();
|
|
|
});
|
|
});
|
|
|
|
|
+ $('#batch-export').click(function() {
|
|
|
|
|
+ templateObj.export();
|
|
|
|
|
+ });
|
|
|
|
|
+ $('#batch-import').click(function() {
|
|
|
|
|
+ templateObj.import();
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
|
|
|
$('#rela-no-folder').on('show.bs.modal', function() {
|
|
$('#rela-no-folder').on('show.bs.modal', function() {
|
|
|
const html = [];
|
|
const html = [];
|