|
@@ -10,6 +10,7 @@ import { Plus, Search, Upload } from '@element-plus/icons-vue';
|
|
|
import * as api from '../api';
|
|
|
import type { UploadInstance, UploadRawFile } from 'element-plus';
|
|
|
import { ElMessage, FormInstance, FormRules, genFileId } from 'element-plus';
|
|
|
+import { SUCCESS_CODE, WARNING_CODE } from '/@/utils/requestCode';
|
|
|
|
|
|
interface DataItem {
|
|
|
id: number;
|
|
@@ -25,11 +26,9 @@ interface DataItem {
|
|
|
creator: number;
|
|
|
isEditing: boolean; // 添加isEditing字段
|
|
|
popConfirmVisible: boolean; // 添加popConfirmVisible字段
|
|
|
- tempSearchTermType: string;
|
|
|
+ tempSearchTermType: string; // 添加tempSearchTermType字段
|
|
|
}
|
|
|
|
|
|
-const SUCCESS_CODE = 2000;
|
|
|
-const WARNING_CODE = 2001;
|
|
|
const currentDate = new Date().toISOString().split('T')[0];
|
|
|
|
|
|
const tableLoading = ref(false);
|
|
@@ -74,7 +73,7 @@ async function addSearchTerm() {
|
|
|
handleResponse(response);
|
|
|
if (response.code === SUCCESS_CODE) await fetchSearchTermList();
|
|
|
} catch (error) {
|
|
|
- console.error('error:', error);
|
|
|
+ console.error('==Error==', error);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -93,7 +92,7 @@ async function handleDelete(row: any) {
|
|
|
ElMessage.error('删除失败');
|
|
|
}
|
|
|
} catch (error) {
|
|
|
- console.log('error:', error);
|
|
|
+ console.error('==Error==', error);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -119,7 +118,7 @@ async function fetchSearchTermList() {
|
|
|
tempSearchTermType: item.searchTerm_type,
|
|
|
}));
|
|
|
} catch (error) {
|
|
|
- console.log('error:', error);
|
|
|
+ console.error('==Error==', error);
|
|
|
} finally {
|
|
|
tableLoading.value = false;
|
|
|
}
|
|
@@ -144,7 +143,7 @@ async function updateSearchTerm(row: any) {
|
|
|
ElMessage.error('更新失败');
|
|
|
}
|
|
|
} catch (error) {
|
|
|
- console.log('error:', error);
|
|
|
+ console.error('==Error==', error);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -166,7 +165,7 @@ async function updateSearchTermType(row: any) {
|
|
|
ElMessage.error('更新失败');
|
|
|
}
|
|
|
} catch (error) {
|
|
|
- console.log('error:', error);
|
|
|
+ console.error('==Error==', error);
|
|
|
} finally {
|
|
|
row.popConfirmVisible = false;
|
|
|
}
|
|
@@ -183,7 +182,7 @@ function showPopConfirm(row: any) {
|
|
|
function cancelUpdate(row: any) {
|
|
|
row.popConfirmVisible = false;
|
|
|
row.searchTerm_type = row.tempSearchTermType;
|
|
|
- ElMessage.warning({ message: '已取消修改', plain: true });
|
|
|
+ ElMessage.warning({ message: '修改已取消', plain: true });
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -254,13 +253,9 @@ function checkSearchTermType(rule: any, value: any, callback: any) {
|
|
|
function submitForm(formEl: FormInstance | undefined) {
|
|
|
if (!formEl) return;
|
|
|
formEl.validate((valid) => {
|
|
|
- if (valid) {
|
|
|
- dialogVisible.value = false;
|
|
|
- addSearchTerm();
|
|
|
- formEl.resetFields();
|
|
|
- } else {
|
|
|
- console.log('error submit!');
|
|
|
- }
|
|
|
+ if (valid) dialogVisible.value = false;
|
|
|
+ addSearchTerm();
|
|
|
+ formEl.resetFields();
|
|
|
});
|
|
|
}
|
|
|
|
|
@@ -281,7 +276,7 @@ async function handleCustomUpload(uploadRequest: any) {
|
|
|
handleResponse(response);
|
|
|
uploadRequest.onSuccess(response); // 通知 el-upload 上传成功
|
|
|
} catch (error) {
|
|
|
- console.log('error:', error);
|
|
|
+ console.log('==Error==', error);
|
|
|
uploadRequest.onError(error);
|
|
|
}
|
|
|
}
|
|
@@ -316,6 +311,7 @@ function handleResponse(response: any) {
|
|
|
<template>
|
|
|
<div>
|
|
|
<el-card v-loading="tableLoading" body-style="background-color: #f7f7f7;">
|
|
|
+ <!-- 筛选 -->
|
|
|
<el-card body-class="flex justify-between gap-3.5" shadow="hover" style="border: none; margin-bottom: 10px">
|
|
|
<div class="flex gap-7">
|
|
|
<div>
|