feat: 🚀 文章分类添加图片

This commit is contained in:
2025-07-18 15:05:07 +08:00
parent fd0aaee998
commit f867f50114
13 changed files with 83 additions and 465 deletions

Binary file not shown.

BIN
dist.zip Normal file

Binary file not shown.

View File

@@ -19,7 +19,7 @@ export const getArticleClassDelApi = (params: any) => {
}; };
//文章分类更新(用于编辑后) //文章分类更新(用于编辑后)
export const getArticleClassEditUpApi = (params: any) => { export const getArticleClassEditUpApi = (params: any) => {
const { id, name, sort, is_show, pid, seo_title, seo_keywords, seo_desc } = params; const { id, name, sort, is_show, pid, seo_title, seo_keywords, seo_desc, icon } = params;
return http.put<any>(`/article/category/update/${id}`, { return http.put<any>(`/article/category/update/${id}`, {
name, name,
@@ -28,7 +28,8 @@ export const getArticleClassEditUpApi = (params: any) => {
pid, pid,
seo_title, seo_title,
seo_keywords, seo_keywords,
seo_desc seo_desc,
icon
}); });
}; };
//文章分类详情(用于编辑) //文章分类详情(用于编辑)

117
src/auto-import.d.ts vendored
View File

@@ -4,67 +4,66 @@
// Generated by unplugin-auto-import // Generated by unplugin-auto-import
export {} export {}
declare global { declare global {
const EffectScope: typeof import('vue')['EffectScope'] const EffectScope: typeof import("vue")["EffectScope"];
const ElNotification: typeof import('element-plus/es')['ElNotification'] const computed: typeof import("vue")["computed"];
const computed: typeof import('vue')['computed'] const createApp: typeof import("vue")["createApp"];
const createApp: typeof import('vue')['createApp'] const customRef: typeof import("vue")["customRef"];
const customRef: typeof import('vue')['customRef'] const defineAsyncComponent: typeof import("vue")["defineAsyncComponent"];
const defineAsyncComponent: typeof import('vue')['defineAsyncComponent'] const defineComponent: typeof import("vue")["defineComponent"];
const defineComponent: typeof import('vue')['defineComponent'] const effectScope: typeof import("vue")["effectScope"];
const effectScope: typeof import('vue')['effectScope'] const getCurrentInstance: typeof import("vue")["getCurrentInstance"];
const getCurrentInstance: typeof import('vue')['getCurrentInstance'] const getCurrentScope: typeof import("vue")["getCurrentScope"];
const getCurrentScope: typeof import('vue')['getCurrentScope'] const h: typeof import("vue")["h"];
const h: typeof import('vue')['h'] const inject: typeof import("vue")["inject"];
const inject: typeof import('vue')['inject'] const isProxy: typeof import("vue")["isProxy"];
const isProxy: typeof import('vue')['isProxy'] const isReactive: typeof import("vue")["isReactive"];
const isReactive: typeof import('vue')['isReactive'] const isReadonly: typeof import("vue")["isReadonly"];
const isReadonly: typeof import('vue')['isReadonly'] const isRef: typeof import("vue")["isRef"];
const isRef: typeof import('vue')['isRef'] const markRaw: typeof import("vue")["markRaw"];
const markRaw: typeof import('vue')['markRaw'] const nextTick: typeof import("vue")["nextTick"];
const nextTick: typeof import('vue')['nextTick'] const onActivated: typeof import("vue")["onActivated"];
const onActivated: typeof import('vue')['onActivated'] const onBeforeMount: typeof import("vue")["onBeforeMount"];
const onBeforeMount: typeof import('vue')['onBeforeMount'] const onBeforeRouteLeave: typeof import("vue-router")["onBeforeRouteLeave"];
const onBeforeRouteLeave: typeof import('vue-router')['onBeforeRouteLeave'] const onBeforeRouteUpdate: typeof import("vue-router")["onBeforeRouteUpdate"];
const onBeforeRouteUpdate: typeof import('vue-router')['onBeforeRouteUpdate'] const onBeforeUnmount: typeof import("vue")["onBeforeUnmount"];
const onBeforeUnmount: typeof import('vue')['onBeforeUnmount'] const onBeforeUpdate: typeof import("vue")["onBeforeUpdate"];
const onBeforeUpdate: typeof import('vue')['onBeforeUpdate'] const onDeactivated: typeof import("vue")["onDeactivated"];
const onDeactivated: typeof import('vue')['onDeactivated'] const onErrorCaptured: typeof import("vue")["onErrorCaptured"];
const onErrorCaptured: typeof import('vue')['onErrorCaptured'] const onMounted: typeof import("vue")["onMounted"];
const onMounted: typeof import('vue')['onMounted'] const onRenderTracked: typeof import("vue")["onRenderTracked"];
const onRenderTracked: typeof import('vue')['onRenderTracked'] const onRenderTriggered: typeof import("vue")["onRenderTriggered"];
const onRenderTriggered: typeof import('vue')['onRenderTriggered'] const onScopeDispose: typeof import("vue")["onScopeDispose"];
const onScopeDispose: typeof import('vue')['onScopeDispose'] const onServerPrefetch: typeof import("vue")["onServerPrefetch"];
const onServerPrefetch: typeof import('vue')['onServerPrefetch'] const onUnmounted: typeof import("vue")["onUnmounted"];
const onUnmounted: typeof import('vue')['onUnmounted'] const onUpdated: typeof import("vue")["onUpdated"];
const onUpdated: typeof import('vue')['onUpdated'] const provide: typeof import("vue")["provide"];
const provide: typeof import('vue')['provide'] const reactive: typeof import("vue")["reactive"];
const reactive: typeof import('vue')['reactive'] const readonly: typeof import("vue")["readonly"];
const readonly: typeof import('vue')['readonly'] const ref: typeof import("vue")["ref"];
const ref: typeof import('vue')['ref'] const resolveComponent: typeof import("vue")["resolveComponent"];
const resolveComponent: typeof import('vue')['resolveComponent'] const shallowReactive: typeof import("vue")["shallowReactive"];
const shallowReactive: typeof import('vue')['shallowReactive'] const shallowReadonly: typeof import("vue")["shallowReadonly"];
const shallowReadonly: typeof import('vue')['shallowReadonly'] const shallowRef: typeof import("vue")["shallowRef"];
const shallowRef: typeof import('vue')['shallowRef'] const toRaw: typeof import("vue")["toRaw"];
const toRaw: typeof import('vue')['toRaw'] const toRef: typeof import("vue")["toRef"];
const toRef: typeof import('vue')['toRef'] const toRefs: typeof import("vue")["toRefs"];
const toRefs: typeof import('vue')['toRefs'] const toValue: typeof import("vue")["toValue"];
const toValue: typeof import('vue')['toValue'] const triggerRef: typeof import("vue")["triggerRef"];
const triggerRef: typeof import('vue')['triggerRef'] const unref: typeof import("vue")["unref"];
const unref: typeof import('vue')['unref'] const useAttrs: typeof import("vue")["useAttrs"];
const useAttrs: typeof import('vue')['useAttrs'] const useCssModule: typeof import("vue")["useCssModule"];
const useCssModule: typeof import('vue')['useCssModule'] const useCssVars: typeof import("vue")["useCssVars"];
const useCssVars: typeof import('vue')['useCssVars'] const useLink: typeof import("vue-router")["useLink"];
const useLink: typeof import('vue-router')['useLink'] const useRoute: typeof import("vue-router")["useRoute"];
const useRoute: typeof import('vue-router')['useRoute'] const useRouter: typeof import("vue-router")["useRouter"];
const useRouter: typeof import('vue-router')['useRouter'] const useSlots: typeof import("vue")["useSlots"];
const useSlots: typeof import('vue')['useSlots'] const watch: typeof import("vue")["watch"];
const watch: typeof import('vue')['watch'] const watchEffect: typeof import("vue")["watchEffect"];
const watchEffect: typeof import('vue')['watchEffect'] const watchPostEffect: typeof import("vue")["watchPostEffect"];
const watchPostEffect: typeof import('vue')['watchPostEffect'] const watchSyncEffect: typeof import("vue")["watchSyncEffect"];
const watchSyncEffect: typeof import('vue')['watchSyncEffect']
} }
// for type re-export // for type re-export
declare global { declare global {
// @ts-ignore // @ts-ignore
export type { Component, ComponentPublicInstance, ComputedRef, InjectionKey, PropType, Ref, VNode } from 'vue' export type { Component, ComponentPublicInstance, ComputedRef, InjectionKey, PropType, Ref, VNode } from "vue";
} }

View File

@@ -108,7 +108,7 @@ const options = reactive({
["blockquote", "code-block"], // 引用 代码块 ["blockquote", "code-block"], // 引用 代码块
[{ list: "ordered" }, { list: "bullet" }], // 有序、无序列表 [{ list: "ordered" }, { list: "bullet" }], // 有序、无序列表
[{ indent: "-1" }, { indent: "+1" }], // 缩进 [{ indent: "-1" }, { indent: "+1" }], // 缩进
[{ size: ["small", false, "large", "huge"] }], // 字体大小 [{ size: fontSizeStyle.whitelist }], // 字体大小
[{ header: [1, 2, 3, 4, 5, 6, false] }], // 标题 [{ header: [1, 2, 3, 4, 5, 6, false] }], // 标题
[{ color: [] }, { background: [] }], // 字体颜色、字体背景颜色 [{ color: [] }, { background: [] }], // 字体颜色、字体背景颜色
[{ align: [] }], // 对齐方式 [{ align: [] }], // 对齐方式

View File

@@ -1,260 +0,0 @@
<template>
<el-upload
:id="uuid"
action="#"
:multiple="true"
:show-file-list="false"
:http-request="() => {}"
:before-upload="() => false"
@change="handleFileChange"
class="editor-img-uploader"
accept=".jpeg,.jpg,.png,.gif"
>
<i ref="uploadRef" class="Plus editor-img-uploader"></i>
</el-upload>
<input
type="file"
accept="video/*"
name="file"
ref="uploadFileVideo"
id="uploadFileVideo"
@change="handleVideoUpload"
style="width: 0; height: 0; cursor: pointer; opacity: 0"
/>
<div class="editor">
<QuillEditor
id="editorId"
ref="myQuillEditor"
v-model:content="editorContent"
contentType="html"
@update:content="onContentChange"
:options="options"
/>
</div>
</template>
<script setup name="Editor">
import { QuillEditor, Quill } from "@vueup/vue-quill";
import "@vueup/vue-quill/dist/vue-quill.snow.css";
import { getCurrentInstance, reactive, ref, toRaw, computed, onMounted } from "vue";
import { generateUUID } from "@/utils";
import { h } from "@/utils/url";
import { routerObj } from "./utils.js";
import { titleConfig } from "./titleConfig.js";
import { uploadVideo, uploadImg } from "@/api/modules/upload";
// 字体配置
let fontSizeStyle = Quill.import("attributors/style/size");
fontSizeStyle.whitelist = ["12px", "14px", "16px", "18px", "20px", "22px", "24px", "26px", "28px", "30px", "32px"];
Quill.register(fontSizeStyle, true);
// 自定义模块
import ImageBlot from "./quill-image";
import Video from "./quill-video";
Quill.register(Video);
Quill.register(ImageBlot);
// 路由相关
const $router = useRouter();
const routerValueName = $router.currentRoute.value.name;
const routerName = ref(routerObj[routerValueName]);
// 核心:上传队列 + 临时去重集合
const uploadQueue = ref([]);
const isProcessing = ref(false);
const uuid = ref(generateUUID());
const tempProcessedFiles = ref(new Set());
// 编辑器基础
const { proxy } = getCurrentInstance();
const emit = defineEmits(["update:content", "handleRichTextContentChange"]);
const uploadFileVideo = ref(null);
const myQuillEditor = ref(null);
const oldContent = ref("");
// Props
const props = defineProps({
content: { type: String, default: "" },
readOnly: { type: Boolean, default: false },
fileSizeLimit: { type: Number, default: 10 }
});
// 内容双向绑定
const editorContent = computed({
get: () => props.content,
set: val => emit("update:content", val)
});
// 编辑器配置
const options = reactive({
theme: "snow",
modules: {
toolbar: {
container: [
["bold", "italic", "underline", "strike"],
["blockquote", "code-block"],
[{ list: "ordered" }, { list: "bullet" }],
[{ indent: "-1" }, { indent: "+1" }],
[{ size: fontSizeStyle.whitelist }],
[{ header: [1, 2, 3, 4, 5, 6, false] }],
[{ color: [] }, { background: [] }],
[{ align: [] }],
["clean"],
["link", "image", "video"]
],
handlers: {
image: () => proxy.$refs.uploadRef.click(),
video: () => document.querySelector("#uploadFileVideo")?.click()
}
}
},
placeholder: "请输入内容...",
readOnly: props.readOnly
});
// 处理文件选择(关键修改:记录原始顺序)
const handleFileChange = (file, fileList) => {
if (!fileList.length) return;
const rawEditor = toRaw(myQuillEditor.value);
const quill = rawEditor?.getQuill();
if (!quill) return;
// 生成文件唯一标识
const getFileKey = file => `${file.name}-${file.size}-${file.lastModified}`;
// 过滤重复文件
const newFiles = fileList.filter(item => {
const file = item.raw;
const key = getFileKey(file);
if (tempProcessedFiles.value.has(key)) {
console.log(`跳过重复文件: ${file.name}`);
return false;
}
if (!validateFile(file)) return false;
tempProcessedFiles.value.add(key);
return true;
});
if (!newFiles.length) return;
// 获取初始光标位置(所有图片将按顺序插入此位置之后)
const baseCursorIndex = quill.selection.savedRange?.index || quill.getLength();
// 按用户选择顺序添加到队列(关键修改:使用原始索引)
newFiles.forEach((item, index) => {
uploadQueue.value.push({
file: item.raw,
originalIndex: index, // 记录用户选择的原始顺序
baseCursorIndex // 所有图片共享同一个基础位置
});
});
if (!isProcessing.value) {
processQueue();
}
};
// 文件校验
const validateFile = file => {
const isImage = file.type.startsWith("image/");
if (!isImage) {
alert("请上传图片文件");
return false;
}
const fileSizeMB = file.size / 1024 / 1024;
if (fileSizeMB > props.fileSizeLimit) {
alert(`文件 ${file.name} 大小超过 ${props.fileSizeLimit} MB`);
return false;
}
return true;
};
// 处理上传队列(关键修改:按原始顺序插入)
const processQueue = async () => {
if (isProcessing.value || uploadQueue.value.length === 0) return;
isProcessing.value = true;
const { file, originalIndex, baseCursorIndex } = uploadQueue.value[0];
try {
const formData = new FormData();
formData.append("image", file);
const result = await uploadImg(formData, routerName.value);
if (result?.code === 0) {
const rawEditor = toRaw(myQuillEditor.value);
const quill = rawEditor.getQuill();
// 关键修改:计算正确的插入位置(基于原始顺序和基础位置)
const insertPosition = baseCursorIndex + originalIndex;
quill.insertEmbed(insertPosition, "image", {
url: h + result.data.path,
id: generateUUID()
});
// 不更新光标位置,确保后续图片按原始顺序插入
// quill.setSelection(insertPosition + 1);
}
} catch (error) {
console.error(`文件 ${file.name} 上传失败:`, error);
} finally {
uploadQueue.value.shift();
if (uploadQueue.value.length === 0) {
tempProcessedFiles.value.clear();
}
isProcessing.value = false;
processQueue();
}
};
// 视频上传
const handleVideoUpload = async evt => {
if (evt.target.files.length === 0) return;
const file = evt.target.files[0];
const formData = new FormData();
formData.append("video", file);
try {
const rawEditor = toRaw(myQuillEditor.value);
const quill = rawEditor.getQuill();
const cursorIndex = quill.selection.savedRange?.index || 0;
const { data } = await uploadVideo(formData);
quill.insertEmbed(cursorIndex, "video", {
url: h + data.path,
id: generateUUID()
});
quill.setSelection(cursorIndex + 1);
} catch (error) {
console.error("视频上传失败:", error);
} finally {
evt.target.value = "";
}
};
// 内容变化监听
const onContentChange = content => {
emit("handleRichTextContentChange", content);
};
// 初始化标题提示
const initTitle = () => {
for (const item of titleConfig.value) {
const tip = document.querySelector(`.ql-toolbar ${item.Choice}`);
if (tip) tip.setAttribute("title", item.title);
}
};
onMounted(() => {
initTitle();
oldContent.value = props.content;
});
</script>
<style lang="scss">
@import "./index.scss";
</style>

View File

@@ -1,10 +0,0 @@
//lineHeight.js
import Quill from "quill";
const Parchment = Quill.import("parchment");
class lineHeightAttributor extends Parchment.Attributor.Style {}
const lineHeightStyle = new lineHeightAttributor("lineHeight", "line-height", {
scope: Parchment.Scope.INLINE,
whitelist: ["1", "2", "3", "4", "5"]
});
export { lineHeightStyle };

View File

@@ -1,124 +0,0 @@
// 自定义字体大小模块,支持预设选项和输入框
export class CustomFontSize {
constructor(quill, options) {
this.quill = quill;
this.options = options;
// 创建工具栏容器
const container = quill.getModule("toolbar").container;
// 创建字体大小选择器
this.selector = document.createElement("select");
this.selector.classList.add("ql-size");
// 添加预设选项
options.presets.forEach(size => {
if (size === false) {
// 添加分隔线
const option = document.createElement("option");
option.disabled = true;
option.innerHTML = "──────────";
this.selector.appendChild(option);
} else {
// 添加预设大小选项
const option = document.createElement("option");
option.value = size;
option.innerHTML = this.getSizeLabel(size);
this.selector.appendChild(option);
}
});
// 添加自定义输入选项
const inputOption = document.createElement("option");
inputOption.value = "custom";
inputOption.innerHTML = "自定义";
this.selector.appendChild(inputOption);
// 创建自定义输入框
this.input = document.createElement("input");
this.input.type = "number";
this.input.placeholder = "输入字号";
this.input.min = 1;
this.input.style.width = "50px";
this.input.style.display = "none"; // 默认隐藏
// 将选择器和输入框添加到工具栏
container.appendChild(this.selector);
container.appendChild(this.input);
// 绑定事件
this.selector.addEventListener("change", this.onSelectChange.bind(this));
this.input.addEventListener("change", this.onInputChange.bind(this));
this.quill.on("text-change", this.update.bind(this));
// 初始化
this.update();
}
// 获取大小标签
getSizeLabel(size) {
const labels = {
small: "小",
normal: "正常",
large: "大",
huge: "超大"
};
return labels[size] || size;
}
// 选择器变更事件
onSelectChange() {
const value = this.selector.value;
if (value === "custom") {
// 显示输入框
this.input.style.display = "inline-block";
this.input.focus();
} else {
// 隐藏输入框并应用选择的大小
this.input.style.display = "none";
this.quill.format("size", value);
}
}
// 输入框变更事件
onInputChange() {
const value = this.input.value;
if (value) {
this.quill.format("size", `${value}px`);
}
// 选择"自定义"选项,保持输入框显示
this.selector.value = "custom";
}
// 更新当前选中状态
update() {
const selection = this.quill.getSelection();
if (selection) {
const [format] = this.quill.getFormat(selection.index, 1);
const size = format.size;
if (size && size.endsWith("px")) {
const sizeValue = size.replace("px", "");
this.input.value = sizeValue;
// 如果是预设值,选中对应的选项
if (this.options.presets.includes(size)) {
this.selector.value = size;
this.input.style.display = "none";
} else {
// 否则选中"自定义"并显示输入框
this.selector.value = "custom";
this.input.style.display = "inline-block";
}
} else {
// 没有选中的大小,重置为默认
this.selector.value = "normal";
this.input.style.display = "none";
}
}
}
}
// // 注册自定义模块
// Quill.register("modules/customFontSize", CustomFontSize);

View File

@@ -271,5 +271,5 @@
white-space: nowrap; white-space: nowrap;
} }
.el-message__wrapper { .el-message__wrapper {
z-index: 9999 !important; /* 一个较大的值,确保在抽屉之上 */ z-index: 3000 !important; /* 一个较大的值,确保在抽屉之上 */
} }

View File

@@ -53,13 +53,19 @@ export const EDIT_FORM_DATA: FormItem[] = [
type: "treeSelect", type: "treeSelect",
label: "所属分类: ", label: "所属分类: ",
options: [] options: []
},
{
prop: "icon",
type: "upImg",
label: "图片: "
} }
]; ];
export const EDIT_RULE_FORM = { export const EDIT_RULE_FORM = {
is_show: 1, is_show: 1,
sort: 1, sort: 0,
name: "", name: "",
pid: 0 pid: 0,
icon: ""
}; };
// editRuleForm: {}, // editRuleForm: {},
//editFormData: [], //editFormData: [],

View File

@@ -76,6 +76,7 @@
<script setup lang="ts" name="articleClassListIndex"> <script setup lang="ts" name="articleClassListIndex">
import rulesForm from "@/components/rulesForm/index.vue"; import rulesForm from "@/components/rulesForm/index.vue";
import SearchForm from "@/components/SearchForm/index.vue";
import { integerRexg } from "@/utils/regexp/index"; import { integerRexg } from "@/utils/regexp/index";
import { addLabelValue } from "@/utils/addLabelValue"; import { addLabelValue } from "@/utils/addLabelValue";
import { h } from "@/utils/url"; import { h } from "@/utils/url";
@@ -174,7 +175,6 @@ const getArticleClassAddSave = async () => {
}; };
//文章编辑 //文章编辑
const getArticleClassUpEdit = async () => { const getArticleClassUpEdit = async () => {
console.log("编辑");
const result = await getArticleClassEditUpApi(dataStore.editRuleForm); const result = await getArticleClassEditUpApi(dataStore.editRuleForm);
const { msg, code } = result; const { msg, code } = result;

View File

@@ -121,6 +121,7 @@ const dataStore = reactive<any>({
formData: FORM_DATA, // 搜索配置项 dataStore.formData formData: FORM_DATA, // 搜索配置项 dataStore.formData
visible: false, visible: false,
data: [], data: [],
type: "image",
isFirstRequest: true isFirstRequest: true
}); });
@@ -140,6 +141,7 @@ const getProductCategoryList = async () => {
const result = await getProductCategoryListApi(); const result = await getProductCategoryListApi();
if (result?.code === 0) { if (result?.code === 0) {
let dataClone: any = cloneDeep(result?.data); let dataClone: any = cloneDeep(result?.data);
console.log(dataClone, "=dataClone=");
dataStore.editFormData[7].options = addLabelValue(dataClone); dataStore.editFormData[7].options = addLabelValue(dataClone);
} }
}; };
@@ -164,6 +166,7 @@ const buildTree = (data: any, outerLinkTo: any = "") => {
}; };
// let isFirstRequest = true; // let isFirstRequest = true;
const handleRadioGroupEmits = (value: any) => { const handleRadioGroupEmits = (value: any) => {
dataStore.type = value;
if (value === "video") { if (value === "video") {
dataStore.editFormData = EDIT_FORM_DATA1; dataStore.editFormData = EDIT_FORM_DATA1;
dataStore.rules = RULES1; dataStore.rules = RULES1;
@@ -205,6 +208,7 @@ const getSystemUrls = async (node: any, resolve: any) => {
} }
}; };
const setImgOrVideo = (result: any) => { const setImgOrVideo = (result: any) => {
dataStore.type = result?.data?.type;
if (result?.data?.type === "image") { if (result?.data?.type === "image") {
dataStore.editFormData = cloneDeep(EDIT_FORM_DATA); dataStore.editFormData = cloneDeep(EDIT_FORM_DATA);
} }
@@ -224,7 +228,7 @@ const getBannerRead = async (id: any) => {
if (result?.code === 0) { if (result?.code === 0) {
setImgOrVideo(result); setImgOrVideo(result);
getProductCategoryList(); getProductCategoryList();
if (!result?.data?.desc) { if (result?.data?.type === "image" && !result?.data?.desc) {
formRef?.value?.editorRef[0]?.clearEditor(); formRef?.value?.editorRef[0]?.clearEditor();
} }
nextTick(() => { nextTick(() => {
@@ -251,6 +255,7 @@ const getBannerRead = async (id: any) => {
}; };
const handleCheck = (checkedNodes: any, values: any) => { const handleCheck = (checkedNodes: any, values: any) => {
const { checkedKeys } = values; const { checkedKeys } = values;
console.log(checkedKeys, "=checkedKeys=");
if (checkedKeys.length) { if (checkedKeys.length) {
dataStore.editRuleForm.link = checkedNodes.url; dataStore.editRuleForm.link = checkedNodes.url;
dataStore.editRuleForm.link_to = checkedNodes.link_to; dataStore.editRuleForm.link_to = checkedNodes.link_to;
@@ -333,7 +338,9 @@ const handleConfirmClick = () => {
const resetFields = () => { const resetFields = () => {
if (!formRef.value!.ruleFormRef) return; if (!formRef.value!.ruleFormRef) return;
formRef!.value!.ruleFormRef.resetFields(); formRef!.value!.ruleFormRef.resetFields();
if (dataStore.type === "image") {
formRef?.value?.editorRef[0]?.clearEditor(); formRef?.value?.editorRef[0]?.clearEditor();
}
}; };
// 抽屉重置 // 抽屉重置
const handleResetClick = () => { const handleResetClick = () => {

View File

@@ -61,7 +61,7 @@ const $route = useRoute();
import { getCategorysApi } from "@/api/modules/downloadClass"; import { getCategorysApi } from "@/api/modules/downloadClass";
import { recursiveCompare } from "@/utils/recursiveCompare"; import { recursiveCompare } from "@/utils/recursiveCompare";
import { addLabelValue } from "@/utils/addLabelValue"; import { addLabelValue } from "@/utils/addLabelValue";
import { ElNotification } from "element-plus";
//深拷贝方法 //深拷贝方法
import { cloneDeep } from "lodash-es"; import { cloneDeep } from "lodash-es";
import { import {
@@ -156,7 +156,6 @@ const excelUploadSuccess = (response: any, row: any) => {
if (response?.code === 0) { if (response?.code === 0) {
row.file_path = response.data.path; // 假设后端返回的文件路径在 data.path 中 row.file_path = response.data.path; // 假设后端返回的文件路径在 data.path 中
} }
console.log(row, "====row========");
ElNotification({ ElNotification({
title: "温馨提示", title: "温馨提示",
message: `文件上传成功!`, message: `文件上传成功!`,