|
@@ -264,6 +264,8 @@
|
|
|
<!-- 文件列表 -->
|
|
|
<el-dialog v-model="filelist" title="文件列表" :width="800">
|
|
|
<el-switch v-model="filetype" size="small" active-text="文件" inactive-text="模板" @click="templateItems" />
|
|
|
+ <el-input v-model="search" style="width: 150px; margin-right: 10px" placeholder="请输入文件名"
|
|
|
+ clearable></el-input>
|
|
|
<div class="demo-image">
|
|
|
<div v-for="name in names" :key="name.id" class="block">
|
|
|
<span class="demonstration">{{ name[1].id }}</span>
|
|
@@ -317,9 +319,6 @@ import {
|
|
|
import Contextmenu from './components/Contextmenu.vue'
|
|
|
import { fontFamilyList, fontSizeList } from './constants'
|
|
|
import { ElMessage } from 'element-plus'
|
|
|
-const currentInstance = getCurrentInstance();
|
|
|
-const showOtherComponent = ref(false);
|
|
|
-const { axios } = currentInstance.appContext.config.globalProperties;
|
|
|
// 当前操作类型
|
|
|
const currentType = ref('selection')
|
|
|
const saveFileName = ref('')
|
|
@@ -551,12 +550,18 @@ const importFromJsonServer = async (itemId) => {
|
|
|
filelist.value=false
|
|
|
ElNotification.success('导入成功')
|
|
|
} catch (error) {
|
|
|
+ ElNotification.success('导入失败')
|
|
|
console.log(error)
|
|
|
}
|
|
|
}
|
|
|
//删除
|
|
|
const DeleteeFromJsonServer = async (itemId) => {
|
|
|
- try {
|
|
|
+ ElMessageBox.confirm('确定删除吗?', '提示', {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning',
|
|
|
+ }).then(async () => {
|
|
|
+ try {
|
|
|
const url = new URL('http://localhost:8080/api/template');
|
|
|
url.searchParams.append('name', itemId);
|
|
|
const response = await fetch(url, {
|
|
@@ -566,15 +571,12 @@ const DeleteeFromJsonServer = async (itemId) => {
|
|
|
}
|
|
|
})
|
|
|
if (!response.ok) throw new Error('Failed to fetch JSON data')
|
|
|
- const jsonData = await response.json()
|
|
|
- const jsonObject = JSON.parse(jsonData.data)
|
|
|
- console.log(jsonObject.data)
|
|
|
- app.setData(jsonObject.data)
|
|
|
- filelist.value=false
|
|
|
- ElNotification.success('导入成功')
|
|
|
+ templateItems()
|
|
|
+ ElNotification.success('删除成功')
|
|
|
} catch (error) {
|
|
|
- console.log(error)
|
|
|
+ ElNotification.warning('删除失败',error)
|
|
|
}
|
|
|
+ })
|
|
|
}
|
|
|
// 导出
|
|
|
const handleExportCommand = type => {
|
|
@@ -628,6 +630,7 @@ const save = async () => {
|
|
|
})
|
|
|
if (!response.ok) throw new Error('Failed to fetch JSON data')
|
|
|
ElNotification.success('保存成功')
|
|
|
+ saveJson.value=false
|
|
|
} catch (error) {
|
|
|
console.log(error)
|
|
|
}
|
|
@@ -643,7 +646,7 @@ const templateItems = async () => {
|
|
|
type: filetype.value,
|
|
|
};
|
|
|
|
|
|
- const defaultUrl = 'https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg'; // 替换为实际的默认URL
|
|
|
+ const defaultUrl = 'https://erp.baozhida.cn/assets/icon-91f5d92f.png'; // 替换为实际的默认URL
|
|
|
|
|
|
try {
|
|
|
const response = await fetch('http://localhost:8080/api/template', {
|