|
@@ -545,9 +545,7 @@ const importFromJson = () => {
|
|
//从服务器获取模板
|
|
//从服务器获取模板
|
|
const importFromJsonServer = async (itemId) => {
|
|
const importFromJsonServer = async (itemId) => {
|
|
try {
|
|
try {
|
|
- const url = new URL(process.env.TEMPLATE_API_URL + 'template');
|
|
|
|
- url.searchParams.append('name', itemId);
|
|
|
|
- const response = await fetch(url, {
|
|
|
|
|
|
+ const response = await fetch(process.env.TEMPLATE_API_URL + `template?name=${itemId}`, {
|
|
headers: {
|
|
headers: {
|
|
'Content-Type': 'application/json'
|
|
'Content-Type': 'application/json'
|
|
}
|
|
}
|
|
@@ -575,12 +573,12 @@ let search = ref('')
|
|
const searchTemplate = async () => {
|
|
const searchTemplate = async () => {
|
|
const url = window.location.href
|
|
const url = window.location.href
|
|
const uuid = getQueryParams(url)
|
|
const uuid = getQueryParams(url)
|
|
- console.log(uuid.uuid)
|
|
|
|
- try {
|
|
|
|
- const url = new URL(process.env.TEMPLATE_API_URL + 'search');
|
|
|
|
- url.searchParams.append('name', search.value);
|
|
|
|
- url.searchParams.append('uuid', uuid.uuid);
|
|
|
|
- const response = await fetch(url, {
|
|
|
|
|
|
+ if (uuid.uuid!=undefined){
|
|
|
|
+ try {
|
|
|
|
+ // const url = new URL(process.env.TEMPLATE_API_URL + 'search');
|
|
|
|
+ // url.searchParams.append('name', search.value);
|
|
|
|
+ // url.searchParams.append('uuid', uuid.uuid);
|
|
|
|
+ const response = await fetch(process.env.TEMPLATE_API_URL + `search?name=${search.value}&uuid=${uuid.uuid}`, {
|
|
headers: {
|
|
headers: {
|
|
'Content-Type': 'application/json',
|
|
'Content-Type': 'application/json',
|
|
}
|
|
}
|
|
@@ -601,6 +599,10 @@ const searchTemplate = async () => {
|
|
} catch (error) {
|
|
} catch (error) {
|
|
ElNotification.warning('系统出错')
|
|
ElNotification.warning('系统出错')
|
|
}
|
|
}
|
|
|
|
+ }else{
|
|
|
|
+ ElNotification.warning('缺少必要参数')
|
|
|
|
+ }
|
|
|
|
+
|
|
}
|
|
}
|
|
//删除
|
|
//删除
|
|
const DeleteeFromJsonServer = async (itemId) => {
|
|
const DeleteeFromJsonServer = async (itemId) => {
|
|
@@ -610,12 +612,10 @@ const DeleteeFromJsonServer = async (itemId) => {
|
|
type: 'warning',
|
|
type: 'warning',
|
|
}).then(async () => {
|
|
}).then(async () => {
|
|
try {
|
|
try {
|
|
- const urls = window.location.href
|
|
|
|
- const uuid = getQueryParams(urls)
|
|
|
|
- const url = new URL(process.env.TEMPLATE_API_URL + 'template');
|
|
|
|
- url.searchParams.append('name', itemId);
|
|
|
|
- url.searchParams.append('uuid', uuid.uuid);
|
|
|
|
- const response = await fetch(url, {
|
|
|
|
|
|
+ // const urls = window.location.href
|
|
|
|
+ // const uuid = getQueryParams(urls)
|
|
|
|
+ // url.searchParams.append('uuid', uuid.uuid);
|
|
|
|
+ const response = await fetch(process.env.TEMPLATE_API_URL + `template?name=${itemId}`, {
|
|
method: 'DELETE',
|
|
method: 'DELETE',
|
|
headers: {
|
|
headers: {
|
|
'Content-Type': 'application/json'
|
|
'Content-Type': 'application/json'
|
|
@@ -770,7 +770,7 @@ const templateItems = async () => {
|
|
ElNotification.success(jsonData.message)
|
|
ElNotification.success(jsonData.message)
|
|
search.value = null
|
|
search.value = null
|
|
} else {
|
|
} else {
|
|
- ElNotification.warning('文件不存在')
|
|
|
|
|
|
+ ElNotification.warning('当前模板为空')
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|