156 lines
4.6 KiB
JavaScript
156 lines
4.6 KiB
JavaScript
import { BaseApi } from '../baseApi';
|
||
import { http } from '../../utils/request';
|
||
|
||
// ==================== 证书模板管理 ====================
|
||
|
||
/**
|
||
* 上传DOC模板
|
||
* @param {FormData} formData - 表单数据
|
||
* @param {File} formData.templatefile - 模板文件 (Word文档)
|
||
* @returns {Promise<{
|
||
* templateId: number,
|
||
* templateUrl: string,
|
||
* detectedPlaceholders: Array<{
|
||
* placeholderKey: string,
|
||
* placeholderType: string,
|
||
* isValid: boolean,
|
||
* validationMessage: string,
|
||
* suggestedDisplayName: string
|
||
* }>,
|
||
* totalPlaceholders: number,
|
||
* validPlaceholders: number
|
||
* }>}
|
||
*/
|
||
export const certificatetemplateUploaddoctemplatePost = (formData) => {
|
||
return http.post('/certificatetemplate/uploaddoctemplate', formData, {
|
||
headers: {
|
||
'Content-Type': 'multipart/form-data'
|
||
}
|
||
});
|
||
};
|
||
|
||
/**
|
||
* 更新DOC模板
|
||
* @param {Object} data - 模板信息
|
||
* @param {number} data.id - 模板ID
|
||
* @param {number} data.version - 版本号
|
||
* @param {string} data.templateFile - 模板文件(Base64编码)
|
||
* @param {number} [data.width] - 宽度 (默认5000)
|
||
* @param {number} [data.height] - 高度 (默认5000)
|
||
* @param {boolean} [data.isActive] - 是否激活
|
||
* @returns {Promise<{
|
||
* templateId: number,
|
||
* templateUrl: string,
|
||
* detectedPlaceholders: Array<{
|
||
* placeholderKey: string,
|
||
* placeholderType: string,
|
||
* isValid: boolean,
|
||
* validationMessage: string,
|
||
* suggestedDisplayName: string
|
||
* }>,
|
||
* totalPlaceholders: number,
|
||
* validPlaceholders: number
|
||
* }>}
|
||
*/
|
||
export const certificatetemplateDoctemplatePut = (data) => {
|
||
return http.put('/certificatetemplate/doctemplate', data);
|
||
};
|
||
|
||
/**
|
||
* 获取模板详情
|
||
* @param {Object} data - 请求参数
|
||
* @param {number} data.id - 模板ID
|
||
* @returns {Promise<{
|
||
* id: number,
|
||
* version: number,
|
||
* templateType: string,
|
||
* docxTemplateUrl: string,
|
||
* isActive: boolean,
|
||
* status: string,
|
||
* createdTime: string,
|
||
* placeholders: Array<{
|
||
* id: number,
|
||
* templateId: number,
|
||
* placeholderKey: string,
|
||
* displayName: string,
|
||
* placeholderType: string,
|
||
* defaultValue: string,
|
||
* isRequired: boolean,
|
||
* validationRule: string,
|
||
* description: string,
|
||
* sort: number
|
||
* }>
|
||
* }>}
|
||
*/
|
||
export const certificatetemplateGet = (data) => {
|
||
return http.get('/certificatetemplate', { params: data });
|
||
};
|
||
|
||
/**
|
||
* 检测DOC模板占位符
|
||
* @param {Object} data - 请求参数
|
||
* @param {string} data.templateFile - 模板文件(Base64编码)
|
||
* @returns {Promise<{
|
||
* placeholders: Array<{
|
||
* placeholderKey: string,
|
||
* placeholderType: string,
|
||
* isValid: boolean,
|
||
* validationMessage: string,
|
||
* suggestedDisplayName: string
|
||
* }>,
|
||
* totalCount: number,
|
||
* validCount: number,
|
||
* invalidCount: number
|
||
* }>}
|
||
*/
|
||
export const certificatetemplateDetectplaceholdersPost = (data) => {
|
||
return http.post('/certificatetemplate/detectplaceholders', data);
|
||
};
|
||
|
||
/**
|
||
* 保存占位符配置
|
||
* @param {Object} data - 占位符配置
|
||
* @param {number} data.templateId - 模板ID
|
||
* @param {Array<Object>} data.placeholders - 占位符列表
|
||
* @param {string} data.placeholders[].placeholderKey - 占位符键名
|
||
* @param {string} data.placeholders[].displayName - 显示名称
|
||
* @param {string} data.placeholders[].placeholderType - 占位符类型 (Text, Number, Date, Image等)
|
||
* @param {string} [data.placeholders[].defaultValue] - 默认值
|
||
* @param {boolean} data.placeholders[].isRequired - 是否必填
|
||
* @param {string} [data.placeholders[].validationRule] - 验证规则
|
||
* @param {string} [data.placeholders[].description] - 描述说明
|
||
* @param {number} data.placeholders[].sort - 排序
|
||
*/
|
||
export const certificatetemplateSaveplaceholdersPost = (data) => {
|
||
return http.post('/certificatetemplate/saveplaceholders', data);
|
||
};
|
||
|
||
/**
|
||
* 获取模板占位符列表
|
||
* @param {Object} data - 请求参数
|
||
* @param {number} data.id - 模板ID
|
||
* @returns {Promise<Array<{
|
||
* id: number,
|
||
* templateId: number,
|
||
* placeholderKey: string,
|
||
* displayName: string,
|
||
* placeholderType: string,
|
||
* defaultValue: string,
|
||
* isRequired: boolean,
|
||
* validationRule: string,
|
||
* description: string,
|
||
* sort: number
|
||
* }>>}
|
||
*/
|
||
export const certificatetemplateTemplateplaceholdersGet = (data) => {
|
||
return http.get('/certificatetemplate/templateplaceholders', { params: data });
|
||
};
|
||
|
||
/**
|
||
* 删除模板(支持批量)
|
||
* @param {Object} data - 删除参数
|
||
* @param {Array<number>} data.ids - 模板ID数组
|
||
*/
|
||
export const certificatetemplateTemplateDelete = (data) => {
|
||
return http.delete('/certificatetemplate/template', { data });
|
||
}; |