fix: 字库设置

This commit is contained in:
taojinlong 2024-08-29 16:10:12 +08:00
parent 558c0762f5
commit 69dd20b7de
4 changed files with 15 additions and 13 deletions

View File

@ -14,6 +14,7 @@ import jakarta.annotation.Resource;
import jakarta.servlet.http.HttpServletResponse;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Component;
import org.springframework.web.multipart.MultipartFile;
@ -91,7 +92,9 @@ public class FontManage {
CoreFont coreFont = coreFontMapper.selectById(id);
if (coreFont != null) {
coreFontMapper.deleteById(id);
FileUtils.deleteFile(path + coreFont.getFileTransName());
if (StringUtils.isNotEmpty(coreFont.getFileTransName())) {
FileUtils.deleteFile(path + coreFont.getFileTransName());
}
}
}
@ -152,6 +155,9 @@ public class FontManage {
FontDto fontDto = new FontDto();
try {
String filename = file.getOriginalFilename();
if (StringUtils.isEmpty(filename) || !filename.endsWith(".ttf")) {
DEException.throwException("非法格式的文件!");
}
String suffix = filename.substring(filename.lastIndexOf(".") + 1);
String filePath = path + fileNameUUID + "." + suffix;
File f = new File(filePath);

View File

@ -13,12 +13,13 @@ const upload = ref()
const uploadExcel = () => {
const formData = new FormData()
formData.append('file', state.fileList.raw)
ruleForm.fileName = state.fileList.raw.name
loading.value = true
return uploadFontFile(formData)
.then(res => {
ruleForm.size = res.data.size
ruleForm.sizeType = res.data.sizeType
ruleForm.fileTransName = res.data.fileTransName
ruleForm.fileName = state.fileList.raw.name
upload.value?.clearFiles()
loading.value = false
})
@ -142,7 +143,7 @@ const confirm = () => {
<FontInfo
@del="fontDel"
v-show="state.fileList"
:size="ruleForm.size + ruleForm.sizeType"
:size="ruleForm.size + ' ' + ruleForm.sizeType"
:name="ruleForm.fileName"
></FontInfo>
<el-upload

View File

@ -104,15 +104,8 @@ const exportFormRules = {
}
]
}
const computedFiledList = computed(() => {
return allFields.reduce((pre, next) => {
if (next.id !== '-1') {
pre[next.id] = next
}
return pre
}, {})
})
provide('filedList', computedFiledList)
const datasetTableFiled = ref([])
provide('filedList', datasetTableFiled)
const nickName = ref('')
const router = useRouter()
@ -342,6 +335,7 @@ const exportDataset = () => {
showExport.value = true
exportForm.value.name = nodeInfo.name
exportForm.value.expressionTree = ''
console.log(computedFiledList)
nextTick(() => {
rowAuth.value.init({})
rowAuth.value.relationList = []
@ -461,6 +455,7 @@ const handleClick = (tabName: TabPaneName) => {
getDatasetPreview(nodeInfo.id)
.then(res => {
allFields = (res?.allFields as unknown as Field[]) || []
datasetTableFiled.value = allFields
columnsPreview = generateColumns((res?.data?.fields as Field[]) || [])
dataPreview = (res?.data?.data as Array<{}>) || []
columns.value = columnsPreview

View File

@ -600,7 +600,7 @@ const apiObjRules = {
const setActiveName = val => {
gridData.value = val.fields
activeParamsName.value = val.name
activeParamsName.value = val.serialNumber
activeParamsID.value = val.serialNumber
}
const paramsObjRef = ref()