37 lines
1.2 KiB
JavaScript

'use strict';
const MainService = require('../../main');
class printTemplateService extends MainService {
constructor(ctx) {
super(ctx);
const _noNeedLogin = '';
const _noNeedRight = 'list,save,listTemplatesByType';
const _noNeedLog = '*';
const _noNeedAuth = 'list,save,listTemplatesByType';
this.systemInit(_noNeedLogin, _noNeedRight, _noNeedLog, _noNeedAuth);
}
async list(data) {
const { service } = this;
const result = await service.systems.setting.printTemplate.getTree();
return this.success('ok', { presetTree: result, code: 200 });
}
async save(data) {
console.log('接收到保存请求:', data);
const { service } = this;
const result = await service.systems.setting.printTemplate.save(data);
return this.success('ok', result);
}
async listTemplatesByType(data) {
const { service } = this;
console.log('接收到根据业务类型查询模板请求:', data);
const { businessType } = data;
if(!businessType){
throw new Error('缺少业务类型参数');
}
const list = await service.systems.setting.printTemplate.listTemplatesByType(businessType);
return this.success('ok', { data: list, code: 200 });
}
}
module.exports = printTemplateService;