Compare commits
17 Commits
main
...
4bd5797772
| Author | SHA1 | Date | |
|---|---|---|---|
| 4bd5797772 | |||
| 927e2ebc4c | |||
| b020976ace | |||
| 3d9a5f399e | |||
| 186bfcdcd7 | |||
| bbf953f47a | |||
| 473aa04ea4 | |||
| 2698e2c2cf | |||
| f8d73b1ddb | |||
| af5894dd5a | |||
| 716b383a87 | |||
| aeaf68307f | |||
| 2d7470c133 | |||
| e0f8d6c574 | |||
| 2694a0c905 | |||
| a66092dea0 | |||
| 5ccdeaff58 |
@@ -2,7 +2,7 @@ ENV = 'dev'
|
||||
|
||||
VITE_APP_API_BASEURL =https://dev.ow.f2b211.com/admapi/v1
|
||||
#前端回显图片之类的地址
|
||||
VITE_APP_API_BASE_UPLOAD_URL =https://dev.ow.f2b211.com/
|
||||
VITE_APP_API_BASE_UPLOAD_URL =https://dev.ow.f2b211.com
|
||||
# 本地环境
|
||||
VITE_USER_NODE_ENV = development
|
||||
|
||||
|
||||
47
index.html
47
index.html
@@ -103,51 +103,6 @@
|
||||
}
|
||||
</script>
|
||||
<script type="module" src="/src/main.ts"></script>
|
||||
<script>
|
||||
// let gwUser = JSON.parse(localStorage.getItem("gw-user"));
|
||||
|
||||
// if (gwUser) {
|
||||
// const { phpToken, refreshToken } = gwUser;
|
||||
// function offline() {
|
||||
// const pathurl = localStorage.getItem("baseUrl") + `uc/offline`;
|
||||
// fetch(pathurl, {
|
||||
// method: "POST",
|
||||
// credentials: "include",
|
||||
// keepalive: true,
|
||||
// headers: {
|
||||
// Authorization: phpToken,
|
||||
// "Refresh-Authorization": refreshToken
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
// window.onbeforeunload = function (e) {
|
||||
// offline();
|
||||
// };
|
||||
// var ua = window.navigator.userAgent.toLowerCase();
|
||||
// var rkn =
|
||||
// /\b(opera|chrome|webkit|safari|msie|firefox|gecko|qqbrowser|edg)\b(\s*(version|rv:|\/)*(\d+(\.\d+)*))?/g;
|
||||
// window.addEventListener("mouseover", function () {
|
||||
// window.removeEventListener("beforeunload", offline, true);
|
||||
// ua.replace(rkn, function (match, type, all, rv, version) {
|
||||
// if (type == "chrome" && parseInt(version) <= 86) {
|
||||
// window.removeEventListener("unload", offline, true);
|
||||
// }
|
||||
// });
|
||||
// });
|
||||
|
||||
// window.addEventListener("mouseout", function () {
|
||||
// window.addEventListener("beforeunload", offline, true);
|
||||
// ua.replace(rkn, function (match, type, all, rv, version) {
|
||||
// if (type == "qqbrowser" || type == "edg" || (type == "chrome" && parseInt(version) <= 86)) {
|
||||
// window.addEventListener("unload", offline, true);
|
||||
// }
|
||||
// });
|
||||
// });
|
||||
// if (window.location.pathnam !== "/login") {
|
||||
// window.removeEventListener("beforeunload", offline);
|
||||
// window.removeEventListener("unload", offline);
|
||||
// }
|
||||
// }
|
||||
</script>
|
||||
<script></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
// import { useUserStore } from "@/stores/modules/user";
|
||||
// const userStore: any = useUserStore();
|
||||
import { reactive, ref, computed } from "vue";
|
||||
|
||||
import { useTheme } from "@/hooks/useTheme";
|
||||
@@ -26,4 +28,11 @@ const assemblySize = computed(() => globalStore.assemblySize);
|
||||
|
||||
// element button config
|
||||
const buttonConfig = reactive({ autoInsertSpace: false });
|
||||
// watch(
|
||||
// () => userStore.languageType,
|
||||
// (newVal: any) => {
|
||||
// console.log(newVal, "=======newVal=======");
|
||||
// window.location.reload();
|
||||
// }
|
||||
// );
|
||||
</script>
|
||||
|
||||
@@ -6,7 +6,7 @@ import { showFullScreenLoading, tryHideFullScreenLoading } from "@/config/servic
|
||||
import { ElMessage } from "element-plus";
|
||||
import { ResultData } from "@/api/interface";
|
||||
import { ResultEnum } from "@/enums/httpEnum";
|
||||
import { checkStatus } from "./helper/checkStatus";
|
||||
// import { checkStatus } from "./helper/checkStatus";
|
||||
import { useUserStore } from "@/stores/modules/user";
|
||||
import router from "@/routers";
|
||||
//获取导出表格name
|
||||
@@ -14,8 +14,10 @@ const getDispositionName = (response: any) => {
|
||||
//导出表格,从content-disposition获取表格的名称 只有导出服务端才会返回该字段
|
||||
const contentDisposition = response.headers["content-disposition"];
|
||||
if (contentDisposition) {
|
||||
let contentDispositionClone = decodeURIComponent(contentDisposition);
|
||||
console.log(contentDispositionClone);
|
||||
// 解析 Content-Disposition 以提取文件名
|
||||
const filenameMatch = contentDisposition.match(/filename=(.*)/i);
|
||||
const filenameMatch = contentDispositionClone.match(/filename=(.*)/i);
|
||||
if (filenameMatch && filenameMatch[1]) {
|
||||
let filename = filenameMatch[1].trim();
|
||||
localStorage.setItem("filename", filename);
|
||||
@@ -54,7 +56,7 @@ class RequestHttp {
|
||||
// 当前请求不需要显示 loading,在 api 服务中通过指定的第三个参数: { noLoading: true } 来控制
|
||||
config.noLoading || showFullScreenLoading();
|
||||
if (config.headers && typeof config.headers.set === "function") {
|
||||
config.headers.set("Authorization", "Bearer" + " " + userStore.token);
|
||||
config.headers.set("Authorization", userStore.token);
|
||||
}
|
||||
return config;
|
||||
},
|
||||
@@ -73,6 +75,15 @@ class RequestHttp {
|
||||
tryHideFullScreenLoading();
|
||||
//获取导出表格名称
|
||||
getDispositionName(response);
|
||||
// 获取响应头中的 Authorization 信息
|
||||
const authorization = response.headers["authorization"];
|
||||
if (authorization) {
|
||||
// 可以在这里更新用户的 token 信息
|
||||
const userStore = useUserStore();
|
||||
userStore.setToken(authorization);
|
||||
return data;
|
||||
}
|
||||
|
||||
//0正常,1非正常
|
||||
if (data.code == 1) {
|
||||
ElMessage.error(data.msg);
|
||||
@@ -94,7 +105,7 @@ class RequestHttp {
|
||||
// 根据服务器响应的错误状态码,做不同的处理
|
||||
if (response) {
|
||||
console.log("error-走到了这里", response.status);
|
||||
checkStatus(response.status, response.data);
|
||||
// checkStatus(response.status, response.data);
|
||||
}
|
||||
// 服务器结果都没有返回(可能服务器错误可能客户端断网),断网处理:可以跳转到断网页面
|
||||
if (!window.navigator.onLine) router.replace("/500");
|
||||
|
||||
@@ -5,6 +5,10 @@ const ARTICLE_CATEGORY = `/article/category`;
|
||||
export const getArticleClassListApi = (params: any) => {
|
||||
return http.get<any>(`${ARTICLE_CATEGORY}/index`, params);
|
||||
};
|
||||
//文章分类下拉框
|
||||
export const getArticleClassApi = () => {
|
||||
return http.get<any>(`/article/categorys`);
|
||||
};
|
||||
//文章分类新增
|
||||
export const getArticleClassAddSaveApi = (params: any) => {
|
||||
return http.post<any>(`${ARTICLE_CATEGORY}/save`, params);
|
||||
@@ -15,12 +19,13 @@ export const getArticleClassDelApi = (params: any) => {
|
||||
};
|
||||
//文章分类更新(用于编辑后)
|
||||
export const getArticleClassEditUpApi = (params: any) => {
|
||||
const { id, name, sort, is_show, seo_title, seo_keywords, seo_desc } = params;
|
||||
const { id, name, sort, is_show, pid, seo_title, seo_keywords, seo_desc } = params;
|
||||
|
||||
return http.put<any>(`/article/category/update/${id}`, {
|
||||
name,
|
||||
sort,
|
||||
is_show,
|
||||
pid,
|
||||
seo_title,
|
||||
seo_keywords,
|
||||
seo_desc
|
||||
@@ -30,3 +35,7 @@ export const getArticleClassEditUpApi = (params: any) => {
|
||||
export const getArticleClassDetailsApi = (params: any) => {
|
||||
return http.get<any>(`${ARTICLE_CATEGORY}/read/${params}`);
|
||||
};
|
||||
export const getArticleClassSortApi = (params: any) => {
|
||||
const { id, sort } = params;
|
||||
return http.post<any>(`${ARTICLE_CATEGORY}/sort/${id}`, { sort });
|
||||
};
|
||||
|
||||
@@ -6,7 +6,6 @@ export const getBannerListApi = (params: any) => {
|
||||
};
|
||||
//新增
|
||||
export const getBannerListSaveApi = (params: any) => {
|
||||
console.log("1232323");
|
||||
return http.post<any>(`${B}/save`, params, {
|
||||
headers: {
|
||||
"Content-Type": "application/x-www-form-urlencoded"
|
||||
@@ -37,3 +36,7 @@ export const getBannerListExportApi = (params: any) => {
|
||||
responseType: "arraybuffer"
|
||||
});
|
||||
};
|
||||
//分类
|
||||
export const getBannerClassListApi = (params?: any) => {
|
||||
return http.get<any>(`/banner/list`, params); //v1/banner/list
|
||||
};
|
||||
|
||||
@@ -26,6 +26,6 @@ export const getCategorySortApi = (params: any) => {
|
||||
return http.post<any>(`${ATT_C}/sort/${params.id}`, { sort: params.sort });
|
||||
};
|
||||
//下载分类下拉列表
|
||||
export const getCategorysApi = () => {
|
||||
return http.get<any>(`/attachment/categorys`);
|
||||
export const getCategorysApi = (params?: any) => {
|
||||
return http.get<any>(`/attachment/tree`, params);
|
||||
};
|
||||
|
||||
@@ -16,7 +16,6 @@ export const getProductAttrDelApi = (params: any) => {
|
||||
// 产品属性更新
|
||||
export const getProductAttrUpApi = (params: any) => {
|
||||
const { id } = params;
|
||||
|
||||
return http.put<any>(`${PRODUCT_ATTR}/update/${id}`, params);
|
||||
};
|
||||
//产品属性新增
|
||||
|
||||
@@ -23,3 +23,12 @@ export const getProductBuypassUpdateApi = (params: any) => {
|
||||
const { id, param } = params;
|
||||
return http.put<any>(`${PRODUCT_BUYPASS}/update/${id}`, param);
|
||||
};
|
||||
|
||||
//新增
|
||||
export const getProductBuypassListSaveApi = (params: any) => {
|
||||
return http.post<any>(`${PRODUCT_BUYPASS}/save`, params, {
|
||||
headers: {
|
||||
"Content-Type": "application/x-www-form-urlencoded"
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
@@ -36,3 +36,7 @@ export const getProductListSortApi = (params: any) => {
|
||||
const { id, sort } = params;
|
||||
return http.post<any>(`${PRODUCT}/sort/${id}`, { sort });
|
||||
};
|
||||
// 产品分类
|
||||
export const getProductCategoryListApi = (params?: any) => {
|
||||
return http.get<any>(`/product/categorys`, params);
|
||||
};
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import http from "@/api";
|
||||
const VIDEO_CATEGORY = `video/category`;
|
||||
// 视频分类分页列表
|
||||
export const getVideoClassListApi = (params: any) => {
|
||||
export const getVideoClassListApi = (params?: any) => {
|
||||
return http.get<any>(`${VIDEO_CATEGORY}/index`, params);
|
||||
};
|
||||
//视频分类详情
|
||||
|
||||
@@ -26,3 +26,7 @@ export const getVideoListExportApi = (params: any) => {
|
||||
responseType: "arraybuffer"
|
||||
});
|
||||
};
|
||||
//视频分类
|
||||
export const getVideoClassListApi = (params?: any) => {
|
||||
return http.get<any>(`/video/categorys`, params);
|
||||
};
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
:max="9999"
|
||||
:controls="true"
|
||||
style="width: 125px"
|
||||
v-model.trim="scope.row[item.prop]"
|
||||
v-model="scope.row[item.prop]"
|
||||
:disabled="tableData[scope.$index].disabled"
|
||||
:placeholder="item.placeholder"
|
||||
:maxlength="item.maxLength"
|
||||
@@ -46,7 +46,7 @@
|
||||
<template #default="scope" v-if="item.formType === 'input'">
|
||||
<el-input
|
||||
:style="item.width ? item.width : 'width:200px'"
|
||||
v-model.trim="scope.row[item.prop]"
|
||||
v-model="scope.row[item.prop]"
|
||||
:disabled="tableData[scope.$index].disabled"
|
||||
:placeholder="item.placeholder"
|
||||
:maxlength="item.maxLength"
|
||||
@@ -58,7 +58,7 @@
|
||||
<template #default="scope" v-if="item.formType === 'selectRemote'">
|
||||
<el-select
|
||||
:style="item.width ? item.width : 'width:200px'"
|
||||
v-model.trim="scope.row[item.prop]"
|
||||
v-model="scope.row[item.prop]"
|
||||
:placeholder="item.placeholder"
|
||||
clearable
|
||||
remote
|
||||
|
||||
@@ -83,7 +83,7 @@
|
||||
|
||||
<script setup lang="ts" name="ProTable">
|
||||
// /watch
|
||||
import { ref, provide, onMounted, watch } from "vue";
|
||||
import { ref, provide, onMounted } from "vue";
|
||||
import { ElTable } from "element-plus";
|
||||
import { useTable } from "@/hooks/useTable";
|
||||
import { useSelection } from "@/hooks/useSelection";
|
||||
@@ -93,6 +93,8 @@ import SearchForm from "@/components/SearchForm/index.vue";
|
||||
import Pagination from "./components/Pagination.vue";
|
||||
import ColSetting from "./components/ColSetting.vue";
|
||||
import TableColumn from "./components/TableColumn.vue";
|
||||
// import { useUserStore } from "@/stores/modules/user";
|
||||
// const userStore = useUserStore();
|
||||
const $router = useRouter();
|
||||
const routeName: any = ref($router.currentRoute.value.name);
|
||||
export interface ProTableProps {
|
||||
@@ -157,7 +159,7 @@ onMounted(() => props.requestAuto && getTableList());
|
||||
// 监听页面 initParam 改化,重新获取表格数据
|
||||
// watch(() => props.initParam, getTableList, { deep: true });
|
||||
// 监听页面 orgCode 改化,重新获取表格数据
|
||||
watch(() => props.orgCode, getTableList, { deep: true });
|
||||
// watch(() => userStore.languageType, getTableList, { deep: true });
|
||||
// 接收 columns 并设置为响应式
|
||||
const tableColumns = ref<ColumnProps[]>(props.columns);
|
||||
|
||||
@@ -195,7 +197,12 @@ const colRef = ref();
|
||||
const colSetting = tableColumns.value!.filter(
|
||||
item => !["selection", "index", "expand"].includes(item.type!) && item.prop !== "operation" && item.isShow
|
||||
);
|
||||
|
||||
// watch(
|
||||
// () => userStore.languageType,
|
||||
// (newVal: any) => {
|
||||
// console.log(newVal, "=newVal=");
|
||||
// }
|
||||
// );
|
||||
// 暴露给父组件的参数和方法(外部需要什么,都可以从这里暴露出去)
|
||||
defineExpose({
|
||||
element: tableRef,
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<el-input
|
||||
:placeholder="item.placeholder"
|
||||
:maxlength="item.maxlength || 255"
|
||||
v-model.trim="_searchParam[`${item.prop}`]"
|
||||
v-model="_searchParam[`${item.prop}`]"
|
||||
style="width: 224px"
|
||||
@input="handleInput(item)"
|
||||
@keyup.enter="search"
|
||||
@@ -81,7 +81,7 @@
|
||||
<!-- 双 -->
|
||||
<template v-if="item.type === 'inputs'">
|
||||
<el-input
|
||||
v-model.trim="_searchParam[`${item.startProp}`]"
|
||||
v-model="_searchParam[`${item.startProp}`]"
|
||||
:placeholder="item.startPlaceholder"
|
||||
:disabled="item.disabled"
|
||||
maxlength="255"
|
||||
@@ -91,7 +91,7 @@
|
||||
</el-input>
|
||||
<span style="margin: 0 3px">-</span>
|
||||
<el-input
|
||||
v-model.trim="_searchParam[`${item.endProp}`]"
|
||||
v-model="_searchParam[`${item.endProp}`]"
|
||||
:placeholder="item.endPlaceholder"
|
||||
:disabled="item.disabled"
|
||||
maxlength="255"
|
||||
@@ -130,7 +130,7 @@
|
||||
</el-select>
|
||||
|
||||
<el-input
|
||||
v-model.trim="_searchParam[`${item.startProp}`]"
|
||||
v-model="_searchParam[`${item.startProp}`]"
|
||||
:placeholder="item.startPlaceholder"
|
||||
:disabled="item.disabled"
|
||||
maxlength="255"
|
||||
@@ -140,7 +140,7 @@
|
||||
</el-input>
|
||||
<span style="margin: 0 3px">-</span>
|
||||
<el-input
|
||||
v-model.trim="_searchParam[`${item.endProp}`]"
|
||||
v-model="_searchParam[`${item.endProp}`]"
|
||||
:placeholder="item.endPlaceholder"
|
||||
:disabled="item.disabled"
|
||||
maxlength="255"
|
||||
@@ -189,7 +189,7 @@ const handlePicker = (item: any) => {
|
||||
if (Array.isArray(_searchParam.value[prop]) && _searchParam.value[prop].length > 0) {
|
||||
let _date: any = cloneDeep(_searchParam.value[prop]);
|
||||
_date[0] = _date[0] + " " + "00:00:00";
|
||||
_date[1] = _date[1] + " " + "00:00:00";
|
||||
_date[1] = _date[1] + " " + "23:59:59";
|
||||
_searchParam.value[item.startDate] = _date.join(",");
|
||||
} else {
|
||||
_searchParam.value[item.startDate] = "";
|
||||
|
||||
@@ -56,7 +56,7 @@ import { ElNotification, formContextKey, formItemContextKey } from "element-plus
|
||||
import type { UploadProps, UploadRequestOptions } from "element-plus";
|
||||
|
||||
interface UploadFileProps {
|
||||
imageUrl: string; // 图片地址 ==> 必传
|
||||
imageUrl: any; // 图片地址 ==> 必传
|
||||
api?: (params: any) => Promise<any>; // 上传图片的 api 方法,一般项目上传都是同一个 api 方法,在组件里直接引入即可 ==> 非必传
|
||||
drag?: boolean; // 是否支持拖拽上传 ==> 非必传(默认为 true)
|
||||
disabled?: boolean; // 是否禁用上传组件 ==> 非必传(默认为 false)
|
||||
@@ -102,7 +102,7 @@ const formItemContext = inject(formItemContextKey, void 0);
|
||||
const self_disabled = computed(() => {
|
||||
return props.disabled || formContext?.disabled;
|
||||
});
|
||||
const h = import.meta.env.VITE_APP_API_BASE_UPLOAD_URL;
|
||||
import { h } from "@/utils/url";
|
||||
/**
|
||||
* @description 图片上传
|
||||
* @param options upload 所有配置项
|
||||
|
||||
@@ -75,7 +75,11 @@ const $router = useRouter();
|
||||
const routerValueName: string = $router.currentRoute.value.name as string;
|
||||
const routerObj: any = {
|
||||
articleEditIndex: "article",
|
||||
productEditIndex: "product"
|
||||
productEditIndex: "product",
|
||||
bannerListIndex: "banner",
|
||||
downloadListIndex: "download",
|
||||
videoListIndex: "video",
|
||||
QAListIndex: "QA"
|
||||
};
|
||||
const routerName = ref(routerObj[routerValueName]);
|
||||
// 获取 el-form 组件上下文
|
||||
@@ -88,7 +92,7 @@ const self_disabled = computed(() => {
|
||||
});
|
||||
|
||||
const _fileList = ref<UploadUserFile[]>(props.fileList);
|
||||
const h = import.meta.env.VITE_APP_API_BASE_UPLOAD_URL;
|
||||
import { h } from "@/utils/url";
|
||||
// 监听 props.fileList 列表默认值改变
|
||||
watch(
|
||||
() => props.fileList,
|
||||
|
||||
@@ -9,13 +9,15 @@
|
||||
:show-file-list="false"
|
||||
:http-request="handleHttpUpload"
|
||||
:before-upload="beforeUpload"
|
||||
:on-success="uploadSuccess"
|
||||
:on-error="uploadError"
|
||||
:on-exceed="handleExceed"
|
||||
:limit="1"
|
||||
:accept="fileType.join(',')"
|
||||
ref="upload"
|
||||
>
|
||||
<!-- :on-success="uploadSuccess" -->
|
||||
<!-- disabled -->
|
||||
<el-input v-model="videoShowUrl" style="width: 414px" @click.stop @input="handleInput" disabled>
|
||||
<el-input v-model="videoShowUrl" style="width: 414px" @click.stop @input="handleInput">
|
||||
<template #prepend
|
||||
><el-icon :size="20" style="cursor: pointer"><FolderAdd /></el-icon
|
||||
></template>
|
||||
@@ -33,11 +35,12 @@ import { FolderAdd } from "@element-plus/icons-vue";
|
||||
import { ref, computed, inject } from "vue";
|
||||
import { generateUUID } from "@/utils";
|
||||
import { uploadVideo } from "@/api/modules/upload";
|
||||
import { genFileId } from "element-plus";
|
||||
import { ElNotification, formContextKey, formItemContextKey } from "element-plus";
|
||||
import type { UploadProps, UploadRequestOptions } from "element-plus";
|
||||
|
||||
import type { UploadProps, UploadRawFile, UploadInstance } from "element-plus";
|
||||
//UploadRequestOptions
|
||||
interface UploadFileProps {
|
||||
videoUrl: string; // 图片地址 ==> 必传
|
||||
videoUrl: any; // 图片地址 ==> 必传
|
||||
api?: (params: any) => Promise<any>; // 上传图片的 api 方法,一般项目上传都是同一个 api 方法,在组件里直接引入即可 ==> 非必传
|
||||
width?: string;
|
||||
disabled?: boolean; // 是否禁用上传组件 ==> 非必传(默认为 false)
|
||||
@@ -45,7 +48,7 @@ interface UploadFileProps {
|
||||
fileType?: any[]; //视频类型限制 ==> 非必传(默认为[".mp4", ".avi", ".mov"])
|
||||
borderRadius?: string; // 组件边框圆角 ==> 非必传(默认为 8px)
|
||||
}
|
||||
const videoShowUrl = ref(null);
|
||||
const videoShowUrl = ref<any>(null);
|
||||
// 接受父组件参数
|
||||
const props = withDefaults(defineProps<UploadFileProps>(), {
|
||||
videoUrl: "",
|
||||
@@ -60,13 +63,16 @@ const routerValueName: string = $router.currentRoute.value.name as string;
|
||||
const routerObj: any = {
|
||||
articleEditIndex: "article",
|
||||
productEditIndex: "product",
|
||||
videoListIndex: "video"
|
||||
bannerListIndex: "banner",
|
||||
downloadListIndex: "download",
|
||||
videoListIndex: "video",
|
||||
QAListIndex: "QA"
|
||||
};
|
||||
const routerName = ref(routerObj[routerValueName]);
|
||||
|
||||
// 生成组件唯一id
|
||||
const uuid = ref("id-" + generateUUID());
|
||||
|
||||
const upload = ref<UploadInstance>();
|
||||
// 获取 el-form 组件上下文
|
||||
const formContext = inject(formContextKey, void 0);
|
||||
// 获取 el-form-item 组件上下文
|
||||
@@ -83,22 +89,45 @@ interface UploadEmits {
|
||||
(e: "update:videoUrl", value: string): void;
|
||||
}
|
||||
const emit = defineEmits<UploadEmits>();
|
||||
const handleHttpUpload = async (options: UploadRequestOptions) => {
|
||||
const handleHttpUpload = async (options: any) => {
|
||||
let formData = new FormData();
|
||||
formData.append("video", options.file);
|
||||
try {
|
||||
const api = props.api ?? uploadVideo;
|
||||
const { data } = await api(formData, routerName.value);
|
||||
emit("update:videoUrl", data.path);
|
||||
// 调用 el-form 内部的校验方法(可自动校验)
|
||||
formItemContext?.prop && formContext?.validateField([formItemContext.prop as string]);
|
||||
if (data.path) {
|
||||
ElNotification({
|
||||
title: "温馨提示",
|
||||
message: "视频上传成功!",
|
||||
type: "success"
|
||||
});
|
||||
emit("update:videoUrl", data.path);
|
||||
// 调用 el-form 内部的校验方法(可自动校验)
|
||||
formItemContext?.prop && formContext?.validateField([formItemContext.prop as string]);
|
||||
} else {
|
||||
videoShowUrl.value = "";
|
||||
emit("update:videoUrl", "");
|
||||
}
|
||||
} catch (error) {
|
||||
videoShowUrl.value = "";
|
||||
emit("update:videoUrl", "");
|
||||
if (!error) {
|
||||
return;
|
||||
}
|
||||
options.onError(error as any);
|
||||
}
|
||||
};
|
||||
|
||||
const handleExceed: UploadProps["onExceed"] = files => {
|
||||
upload.value!.clearFiles();
|
||||
const file = files[0] as UploadRawFile;
|
||||
file.uid = genFileId();
|
||||
let options: any = {
|
||||
file
|
||||
};
|
||||
handleHttpUpload(options);
|
||||
};
|
||||
const handleInput = () => {
|
||||
console.log("会触发吗");
|
||||
emit("update:videoUrl", videoShowUrl.value);
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -128,13 +157,13 @@ const beforeUpload: UploadProps["beforeUpload"] = rawFile => {
|
||||
/**
|
||||
* @description 视频上传成功
|
||||
* */
|
||||
const uploadSuccess = () => {
|
||||
ElNotification({
|
||||
title: "温馨提示",
|
||||
message: "视频上传成功!",
|
||||
type: "success"
|
||||
});
|
||||
};
|
||||
// const uploadSuccess = () => {
|
||||
// ElNotification({
|
||||
// title: "温馨提示",
|
||||
// message: "视频上传成功!",
|
||||
// type: "success"
|
||||
// });
|
||||
// };
|
||||
|
||||
/**
|
||||
* @description 视频上传错误
|
||||
@@ -149,7 +178,9 @@ const uploadError = () => {
|
||||
watch(
|
||||
() => props.videoUrl,
|
||||
(newVal: any) => {
|
||||
videoShowUrl.value = newVal;
|
||||
if (newVal) {
|
||||
videoShowUrl.value = newVal;
|
||||
}
|
||||
}
|
||||
);
|
||||
</script>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<Toolbar v-if="!hideToolBar" class="editor-toolbar" :editor="editorRef" :default-config="toolbarConfig" :mode="mode" />
|
||||
<Editor
|
||||
v-model="valueHtml"
|
||||
class="editor-content'"
|
||||
class="editor-content"
|
||||
:style="{ height }"
|
||||
:mode="mode"
|
||||
:default-config="editorConfig"
|
||||
@@ -32,7 +32,11 @@ const $router = useRouter();
|
||||
const routerValueName: string = $router.currentRoute.value.name as string;
|
||||
const routerObj: any = {
|
||||
articleEditIndex: "article",
|
||||
productEditIndex: "product"
|
||||
productEditIndex: "product",
|
||||
bannerListIndex: "banner",
|
||||
downloadListIndex: "download",
|
||||
videoListIndex: "video",
|
||||
QAListIndex: "QA"
|
||||
};
|
||||
const routerName = ref(routerObj[routerValueName]);
|
||||
// 接收父组件参数,并设置默认值
|
||||
@@ -108,7 +112,8 @@ props.editorConfig.MENU_CONF!["uploadImage"] = {
|
||||
const result = await uploadImg(formData, routerName.value);
|
||||
if (result?.code === 0) {
|
||||
const { data } = result;
|
||||
insertFn(import.meta.env.VITE_APP_API_BASE_UPLOAD_URL + data.url);
|
||||
console.log(data, "==============data====================");
|
||||
insertFn(import.meta.env.VITE_APP_API_BASE_UPLOAD_URL + data.path);
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
<el-input
|
||||
style="width: 440px"
|
||||
:placeholder="item.placeholder"
|
||||
v-model.trim="_ruleForm[`${item.prop}`]"
|
||||
v-model="_ruleForm[`${item.prop}`]"
|
||||
clearable
|
||||
:disabled="item.disabled"
|
||||
@blur="handleInputBlur"
|
||||
@@ -22,7 +22,7 @@
|
||||
<template v-if="item.type === 'inputSelect'">
|
||||
<el-input
|
||||
:placeholder="item.placeholder"
|
||||
v-model.trim="_ruleForm[`${item.prop}`]"
|
||||
v-model="_ruleForm[`${item.prop}`]"
|
||||
clearable
|
||||
:disabled="item.disabled"
|
||||
@blur="handleInputBlur"
|
||||
@@ -42,7 +42,7 @@
|
||||
<template v-if="item.type === 'inputButton'">
|
||||
<el-input
|
||||
:placeholder="item.placeholder"
|
||||
v-model.trim="_ruleForm[`${item.prop}`]"
|
||||
v-model="_ruleForm[`${item.prop}`]"
|
||||
clearable
|
||||
:disabled="item.disabled"
|
||||
>
|
||||
@@ -56,7 +56,7 @@
|
||||
:min="1"
|
||||
:max="9999"
|
||||
:controls="true"
|
||||
v-model.trim="_ruleForm[`${item.prop}`]"
|
||||
v-model="_ruleForm[`${item.prop}`]"
|
||||
:disabled="item.disabled"
|
||||
:placeholder="item.placeholder"
|
||||
:maxlength="item.maxLength"
|
||||
@@ -92,8 +92,9 @@
|
||||
:placeholder="item.placeholder"
|
||||
clearable
|
||||
:disabled="item.disabled"
|
||||
format="YYYY/MM/DD hh:mm:ss"
|
||||
value-format="YYYY-MM-DD hh:mm:ss"
|
||||
format="YYYY-MM-DD HH:mm:ss"
|
||||
date-format="MMM DD, YYYY"
|
||||
time-format="HH:mm"
|
||||
/>
|
||||
</template>
|
||||
<template v-if="item.type === 'radio'">
|
||||
@@ -107,7 +108,17 @@
|
||||
>
|
||||
</el-radio-group>
|
||||
</template>
|
||||
|
||||
<!-- <template v-if="item.type === 'radio1'">
|
||||
<el-radio-group v-model="_ruleForm[`${item.prop}`]">
|
||||
<el-radio
|
||||
:value="option.value"
|
||||
:label="option.value"
|
||||
v-for="(option, optionIndex) in item.options"
|
||||
:key="optionIndex"
|
||||
>{{ option.label }}</el-radio
|
||||
>
|
||||
</el-radio-group>
|
||||
</template> -->
|
||||
<template v-if="item.type === 'upImg'">
|
||||
<UploadImg v-model:image-url="_ruleForm[`${item.prop}`]">
|
||||
<template #tip>
|
||||
@@ -123,7 +134,13 @@
|
||||
<UploadVideo width="440px" v-model:video-url="_ruleForm[`${item.prop}`]"> </UploadVideo>
|
||||
</template>
|
||||
<template v-if="item.type === 'select'">
|
||||
<el-select style="width: 240px" v-model="_ruleForm[`${item.prop}`]" :placeholder="item.placeholder" clearable>
|
||||
<el-select
|
||||
style="width: 240px"
|
||||
v-model="_ruleForm[`${item.prop}`]"
|
||||
:placeholder="item.placeholder"
|
||||
clearable
|
||||
@change="handleSelectChange(_ruleForm[`${item.prop}`], item.prop)"
|
||||
>
|
||||
<el-option
|
||||
:label="option.label"
|
||||
:value="option.value"
|
||||
@@ -141,7 +158,8 @@
|
||||
:render-after-expand="false"
|
||||
show-checkbox
|
||||
check-strictly
|
||||
@change="handleSelectChange(_ruleForm[`${item.prop}`])"
|
||||
@change="handleSelectChange(_ruleForm[`${item.prop}`], item.prop)"
|
||||
style="max-width: 240px"
|
||||
/>
|
||||
</template>
|
||||
<template v-if="item.type === 'treeSelects'">
|
||||
@@ -159,6 +177,9 @@
|
||||
<template v-if="item.type === 'treeSelectInput'">
|
||||
<slot />
|
||||
</template>
|
||||
<template v-if="item.type === 'WangEditor'">
|
||||
<WangEditor v-model:value="_ruleForm[`${item.prop}`]" />
|
||||
</template>
|
||||
</el-form-item>
|
||||
</template>
|
||||
</el-form>
|
||||
@@ -201,8 +222,8 @@ const handleInputButtonClick = () => {
|
||||
const handleInputBlur = () => {
|
||||
emits("handleInputBlurEmits");
|
||||
};
|
||||
const handleSelectChange = (params: any) => {
|
||||
emits("handleSelectChangeEmits", { id: params });
|
||||
const handleSelectChange = (params: any, prop: any) => {
|
||||
emits("handleSelectChangeEmits", { id: params, prop });
|
||||
};
|
||||
// const handleTreesSelectChange = (params: any) => {
|
||||
// emits("handleTreesSelectChangeEmits", params);
|
||||
|
||||
@@ -42,27 +42,28 @@ import { ref } from "vue";
|
||||
import { logoutApi } from "@/api/modules/login";
|
||||
import { useMsg } from "@/hooks/useMsg";
|
||||
import { useUserStore } from "@/stores/modules/user";
|
||||
|
||||
import { ElMessageBox } from "element-plus";
|
||||
import { outLogin } from "@/utils/outLogin";
|
||||
//getLanguageCutoverApi
|
||||
import { getLanguageListApi, getLanguageCutoverApi } from "@/api/modules/global";
|
||||
const userStore: any = useUserStore();
|
||||
|
||||
const userStore = useUserStore();
|
||||
document.cookie = `lang=zh_cn`;
|
||||
const langs = ref<any>([]);
|
||||
const name = ref("");
|
||||
//站点列表
|
||||
|
||||
// 站点列表
|
||||
const getLanguageList = async () => {
|
||||
const result = await getLanguageListApi();
|
||||
if (result?.code === 0) {
|
||||
const { data } = result;
|
||||
langs.value = data;
|
||||
getLanguageCutover(data[0]?.id);
|
||||
let id = userStore?.languageType ? userStore?.languageType : data[0]?.id;
|
||||
getLanguageCutover(id);
|
||||
}
|
||||
};
|
||||
getLanguageList();
|
||||
//站点切换接口
|
||||
|
||||
// 站点切换接口
|
||||
const getLanguageCutover = async (id: any) => {
|
||||
const result = await getLanguageCutoverApi(id);
|
||||
if (result?.code === 0) {
|
||||
@@ -73,10 +74,12 @@ const getLanguageCutover = async (id: any) => {
|
||||
name.value = names[0]?.country_name;
|
||||
}
|
||||
};
|
||||
//站点切换事件
|
||||
|
||||
// 站点切换事件
|
||||
const handleCommand = (val: string) => {
|
||||
getLanguageCutover(val);
|
||||
};
|
||||
|
||||
// 退出登录
|
||||
const logout = () => {
|
||||
ElMessageBox.confirm("您是否确认重新登录?", "温馨提示", {
|
||||
@@ -84,7 +87,7 @@ const logout = () => {
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
}).then(async () => {
|
||||
//1.退出登录
|
||||
// 1. 退出登录
|
||||
const result: any = await logoutApi();
|
||||
if (result?.code === 0) {
|
||||
outLogin();
|
||||
|
||||
@@ -32,6 +32,7 @@ const { keepAliveName } = storeToRefs(keepAliveStore);
|
||||
const isRouterShow = ref(true);
|
||||
const refreshCurrentPage = (val: boolean) => {
|
||||
isRouterShow.value = val;
|
||||
keepAliveStore.setKeepAliveName([]);
|
||||
};
|
||||
|
||||
provide("refresh", refreshCurrentPage);
|
||||
|
||||
@@ -34,30 +34,38 @@ import { useTabsStore } from "@/stores/modules/tabs";
|
||||
import { useGlobalStore } from "@/stores/modules/global";
|
||||
import { useKeepAliveStore } from "@/stores/modules/keepAlive";
|
||||
import { useRoute, useRouter } from "vue-router";
|
||||
// import { initCache } from "./init/init";
|
||||
import { useUserStore } from "@/stores/modules/user";
|
||||
const userStore = useUserStore();
|
||||
|
||||
// import { useMsg } from "@/hooks/useMsg";
|
||||
const route = useRoute();
|
||||
const router = useRouter();
|
||||
const tabStore = useTabsStore();
|
||||
const globalStore = useGlobalStore();
|
||||
const keepAliveStore = useKeepAliveStore();
|
||||
|
||||
// // refresh current page
|
||||
// const refreshCurrentPage: Function = inject("refresh") as Function;
|
||||
|
||||
// const refresh = async () => {
|
||||
// // initCache(data);
|
||||
// setTimeout(() => {
|
||||
// keepAliveStore.removeKeepAliveName(route.name as string);
|
||||
// refreshCurrentPage(false);
|
||||
// nextTick(() => {
|
||||
// keepAliveStore.addKeepAliveName(route.name as string);
|
||||
// refreshCurrentPage(true);
|
||||
// });
|
||||
// }, 300);
|
||||
// };
|
||||
// refresh current page
|
||||
const refreshCurrentPage: Function = inject("refresh") as Function;
|
||||
|
||||
const refresh = async () => {
|
||||
// initCache(data);
|
||||
setTimeout(() => {
|
||||
keepAliveStore.removeKeepAliveName(route.name as string);
|
||||
refreshCurrentPage(false);
|
||||
nextTick(() => {
|
||||
keepAliveStore.addKeepAliveName(route.name as string);
|
||||
refreshCurrentPage(true);
|
||||
});
|
||||
}, 300);
|
||||
};
|
||||
watch(
|
||||
() => userStore.languageType,
|
||||
(newVal: any) => {
|
||||
if (!newVal) {
|
||||
return;
|
||||
}
|
||||
refresh();
|
||||
}
|
||||
);
|
||||
// maximize current page
|
||||
const maximize = () => {
|
||||
globalStore.setGlobalState("maximize", true);
|
||||
|
||||
@@ -31,6 +31,7 @@ import { useTabsStore } from "@/stores/modules/tabs";
|
||||
import { useAuthStore } from "@/stores/modules/auth";
|
||||
import { useKeepAliveStore } from "@/stores/modules/keepAlive";
|
||||
import { TabsPaneContext, TabPaneName } from "element-plus";
|
||||
|
||||
import MoreButton from "./components/MoreButton.vue";
|
||||
|
||||
const route = useRoute();
|
||||
@@ -55,9 +56,6 @@ watch(
|
||||
() => {
|
||||
if (route.meta.isFull) return;
|
||||
tabsMenuValue.value = route.fullPath;
|
||||
// const TITLES_OBJ = {
|
||||
// "/articleManagement/list/edit?type=add": "添加文章"
|
||||
// };
|
||||
let title: any = route.query.title ? route.query.title : route.meta.title;
|
||||
const tabsParams = {
|
||||
icon: route.meta.icon as string,
|
||||
|
||||
@@ -268,3 +268,6 @@
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.el-message__wrapper {
|
||||
z-index: 9999; /* 一个较大的值,确保在抽屉之上 */
|
||||
}
|
||||
|
||||
1
src/utils/url.ts
Normal file
1
src/utils/url.ts
Normal file
@@ -0,0 +1 @@
|
||||
export const h = import.meta.env.VITE_APP_API_BASE_UPLOAD_URL;
|
||||
@@ -20,7 +20,7 @@
|
||||
|
||||
<el-tab-pane label="问答详细" name="third">
|
||||
<div style="width: 1280px; margin: 0 auto">
|
||||
<WangEditor v-model:value="dataStore.value" />
|
||||
<WangEditor v-model:value="dataStore.editRuleForm.answer" />
|
||||
</div>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
@@ -40,7 +40,7 @@ const $route = useRoute();
|
||||
const activeName = ref("basicInfo");
|
||||
//数据集合
|
||||
const dataStore = reactive<any>({
|
||||
value: "",
|
||||
// value: "",
|
||||
editRuleForm: cloneDeep(EDIT_RULE_FORM),
|
||||
editFormData: cloneDeep(EDIT_FORM_DATA),
|
||||
rules: RULES
|
||||
@@ -58,12 +58,14 @@ const getQAListDetails = async () => {
|
||||
const { data } = result;
|
||||
//这里是传给基本信息组件的表单数据
|
||||
dataStore.editRuleForm = cloneDeep(data);
|
||||
dataStore.value = data.answer;
|
||||
}
|
||||
};
|
||||
getQAListDetails();
|
||||
|
||||
//更新
|
||||
const getQAListEditUp = async () => {
|
||||
// dataStore.editRuleForm.answer = dataStore.value;
|
||||
const result: any = await getQAListEditUpApi(dataStore.editRuleForm);
|
||||
if (result?.code === 0) {
|
||||
useMsg("success", result?.msg);
|
||||
@@ -72,6 +74,7 @@ const getQAListEditUp = async () => {
|
||||
};
|
||||
//新增 getQAListSaveApi
|
||||
const getQAListSave = async () => {
|
||||
// dataStore.editRuleForm.answer = dataStore.value;
|
||||
const result: any = await getQAListSaveApi(dataStore.editRuleForm);
|
||||
if (result?.code === 0) {
|
||||
useMsg("success", result?.msg);
|
||||
@@ -88,6 +91,10 @@ const handleReset = () => {
|
||||
const resetFields = () => {
|
||||
if (!formRef.value!.ruleFormRef) return;
|
||||
formRef!.value!.ruleFormRef.resetFields();
|
||||
for (let key in dataStore.editRuleForm) {
|
||||
dataStore.editRuleForm[key] = "";
|
||||
}
|
||||
// dataStore.value = "";
|
||||
};
|
||||
|
||||
const handleSubmit = () => {
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
<el-input v-model="scope.row.sort" @blur="handleBlur(scope.row)" @input="handleInput(scope.row)"></el-input>
|
||||
</template>
|
||||
<template #image="scope">
|
||||
<el-image :src="h + scope.row.image" style="width: 60px; height: 60px" />
|
||||
<el-image :src="scope.row.image ? h + scope.row.image : ''" style="width: 60px; height: 60px" />
|
||||
</template>
|
||||
|
||||
<template #operation="scope">
|
||||
@@ -28,7 +28,7 @@
|
||||
|
||||
<script setup lang="ts" name="QAListIndex">
|
||||
import ProTable from "@/components/ProTable/index.vue";
|
||||
const h = import.meta.env.VITE_APP_API_BASE_UPLOAD_URL;
|
||||
import { h } from "@/utils/url";
|
||||
import { useMsg } from "@/hooks/useMsg";
|
||||
import { integerRexg } from "@/utils/regexp/index";
|
||||
import { messageBox } from "@/utils/messageBox";
|
||||
|
||||
@@ -46,34 +46,20 @@ export const EDIT_FORM_DATA: FormItem[] = [
|
||||
value: 0
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
prop: "pid",
|
||||
placeholder: "请选择",
|
||||
type: "treeSelect",
|
||||
label: "所属分类: ",
|
||||
options: []
|
||||
}
|
||||
|
||||
// {
|
||||
// prop: "seo_title",
|
||||
// placeholder: "请输入",
|
||||
// type: "input",
|
||||
// label: "SEO标题: "
|
||||
// },
|
||||
// {
|
||||
// prop: "seo_keywords",
|
||||
// placeholder: "请输入",
|
||||
// type: "input",
|
||||
// label: "SEO关键词: "
|
||||
// },
|
||||
// {
|
||||
// prop: "seo_desc",
|
||||
// placeholder: "请输入",
|
||||
// type: "input",
|
||||
// label: "SEO描述: "
|
||||
// }
|
||||
];
|
||||
export const EDIT_RULE_FORM = {
|
||||
is_show: 1,
|
||||
seo_desc: "",
|
||||
seo_keywords: "",
|
||||
seo_title: "",
|
||||
sort: 1,
|
||||
name: ""
|
||||
name: "",
|
||||
pid: 0
|
||||
};
|
||||
// editRuleForm: {},
|
||||
//editFormData: [],
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
export const RULES = {
|
||||
name: [{ required: true, message: "文章分类名称不能为空 ! ", trigger: "blur" }],
|
||||
sort: [{ required: true, message: "文章分类排序不能为空 ! ", trigger: "blur" }]
|
||||
sort: [{ required: true, message: "文章分类排序不能为空 ! ", trigger: "blur" }],
|
||||
pid: [{ required: true, message: "所属分类不能为空 ! ", trigger: "blur" }]
|
||||
};
|
||||
|
||||
@@ -26,6 +26,6 @@ export const FORM_DATA: FormItem[] = [
|
||||
];
|
||||
|
||||
export const RULE_FORM = {
|
||||
page: 1,
|
||||
size: 50
|
||||
// page: 1,
|
||||
// size: 50
|
||||
};
|
||||
|
||||
@@ -32,7 +32,5 @@ export const COLUMNS = [
|
||||
render: (scope: RenderScope<any>): VNode | string | any => {
|
||||
return YES_OR_NO[scope.row.is_show];
|
||||
}
|
||||
},
|
||||
|
||||
{ prop: "operation", label: "操作", fixed: "right", width: 300 }
|
||||
}
|
||||
];
|
||||
|
||||
@@ -4,24 +4,45 @@
|
||||
<div style="padding-bottom: 16px">
|
||||
<el-button type="primary" @click="handleAdd"> 添加 </el-button>
|
||||
</div>
|
||||
<ProTable
|
||||
ref="proTableRef"
|
||||
:formData="dataStore.formData"
|
||||
:columns="dataStore.columns"
|
||||
:request-api="getArticleClassListApi"
|
||||
:init-param="dataStore.initParam"
|
||||
>
|
||||
<template #operation="scope">
|
||||
<el-button
|
||||
size="small"
|
||||
v-for="(item, index) in dataStore.btns"
|
||||
:key="index"
|
||||
:type="item.btnType"
|
||||
@click="handleBtnClick(item.type, scope.row)"
|
||||
>{{ item.name }}</el-button
|
||||
>
|
||||
</template>
|
||||
</ProTable>
|
||||
<div class="card table-main">
|
||||
<SearchForm :search="search" :reset="reset" :formData="dataStore.formData" :search-param="dataStore.ruleForm" />
|
||||
<el-table
|
||||
:data="dataStore.tableData"
|
||||
style="width: 100%; margin-bottom: 20px; font-size: 14px"
|
||||
row-key="id"
|
||||
border
|
||||
default-expand-all
|
||||
>
|
||||
<el-table-column prop="id" label="id" />
|
||||
<el-table-column prop="name" label="分类名称" />
|
||||
<el-table-column prop="sort" label="分类排序">
|
||||
<template #default="{ row }">
|
||||
<div @click.stop="">
|
||||
<el-input v-model="row.sort" @blur="handleBlur(row)" @input="handleInput(row)" />
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="is_show" label="是否显示">
|
||||
<template #default="{ row }">
|
||||
{{ row.is_show === 1 ? "✔️" : "❌" }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<!-- <template #default="scope"> -->
|
||||
<el-table-column label="操作" :width="240">
|
||||
<template #default="scope">
|
||||
<el-button
|
||||
size="small"
|
||||
v-for="(item, index) in dataStore.btns"
|
||||
:key="index"
|
||||
:type="item.btnType"
|
||||
@click="handleBtnClick(item.type, scope.row)"
|
||||
>{{ item.name }}</el-button
|
||||
>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
|
||||
<el-drawer
|
||||
v-model="dataStore.visible"
|
||||
:show-close="true"
|
||||
@@ -40,6 +61,7 @@
|
||||
:formData="dataStore.editFormData"
|
||||
:rules="dataStore.rules"
|
||||
ref="formRef"
|
||||
@handleSelectChangeEmits="handleSelectChangeEmits"
|
||||
/>
|
||||
</div>
|
||||
<template #footer>
|
||||
@@ -54,7 +76,8 @@
|
||||
|
||||
<script setup lang="ts" name="articleClassListIndex">
|
||||
import rulesForm from "@/components/rulesForm/index.vue";
|
||||
import ProTable from "@/components/ProTable/index.vue";
|
||||
import { integerRexg } from "@/utils/regexp/index";
|
||||
// import ProTable from "@/components/ProTable/index.vue";
|
||||
import { messageBox } from "@/utils/messageBox";
|
||||
import { useMsg } from "@/hooks/useMsg";
|
||||
//列表接口
|
||||
@@ -63,14 +86,15 @@ import {
|
||||
getArticleClassAddSaveApi,
|
||||
getArticleClassDelApi,
|
||||
getArticleClassEditUpApi,
|
||||
getArticleClassDetailsApi
|
||||
getArticleClassDetailsApi,
|
||||
getArticleClassApi,
|
||||
getArticleClassSortApi
|
||||
} from "@/api/modules/articleClass";
|
||||
//深拷贝方法
|
||||
import { cloneDeep } from "lodash-es";
|
||||
//表格和搜索條件
|
||||
import { RULE_FORM, FORM_DATA, COLUMNS, EDIT_FORM_DATA, EDIT_RULE_FORM, RULES, BTNS } from "./constant/index";
|
||||
// 获取 ProTable 元素,调用其获取刷新数据方法(还能获取到当前查询参数,方便导出携带参数)
|
||||
const proTableRef = ref<any>(null);
|
||||
|
||||
const formRef: any = ref(null);
|
||||
const $router = useRouter();
|
||||
// 数据源
|
||||
@@ -85,9 +109,71 @@ const dataStore = reactive<any>({
|
||||
formData: FORM_DATA, //搜索配置项
|
||||
visible: false,
|
||||
btns: BTNS,
|
||||
tableData: [],
|
||||
selectRow: {} //当前选择的row
|
||||
});
|
||||
const getArticleClassSort = async (row: any) => {
|
||||
const result = await getArticleClassSortApi(row);
|
||||
if (result?.code === 0) {
|
||||
useMsg("success", result?.msg);
|
||||
getArticleClassList();
|
||||
}
|
||||
};
|
||||
//排序input框失焦
|
||||
const handleBlur = (row: any) => {
|
||||
getArticleClassSort(row);
|
||||
};
|
||||
//
|
||||
const handleInput = (row: any) => {
|
||||
row.sort = integerRexg(row.sort);
|
||||
};
|
||||
|
||||
const search = () => {
|
||||
getArticleClassList();
|
||||
};
|
||||
const reset = () => {
|
||||
for (let key in dataStore.ruleForm) {
|
||||
dataStore.ruleForm[key] = "";
|
||||
}
|
||||
getArticleClassList();
|
||||
};
|
||||
|
||||
const addLabelValue = (arr: any) => {
|
||||
return arr.map((item: any) => {
|
||||
// 为当前对象添加 label 和 value 属性
|
||||
const newItem = { ...item };
|
||||
newItem.label = newItem.name;
|
||||
newItem.value = newItem.id;
|
||||
|
||||
// 如果有子对象,递归调用 addLabelValue 处理子对象
|
||||
if (newItem.children && Array.isArray(newItem.children)) {
|
||||
newItem.children = addLabelValue(newItem.children);
|
||||
}
|
||||
return newItem;
|
||||
});
|
||||
};
|
||||
|
||||
const handleSelectChangeEmits = (params: any) => {
|
||||
const { id } = params;
|
||||
dataStore.editRuleForm.pid = id;
|
||||
};
|
||||
|
||||
const getArticleClass = async () => {
|
||||
const result = await getArticleClassApi();
|
||||
if (result?.code === 0) {
|
||||
dataStore.editFormData[3].options = addLabelValue(result?.data);
|
||||
dataStore.editFormData[3].options.unshift({ value: 0, label: "无" });
|
||||
console.log(result?.data);
|
||||
}
|
||||
};
|
||||
getArticleClass();
|
||||
const getArticleClassList = async () => {
|
||||
const result = await getArticleClassListApi(dataStore.ruleForm);
|
||||
if (result?.code === 0) {
|
||||
dataStore.tableData = result?.data;
|
||||
}
|
||||
};
|
||||
getArticleClassList();
|
||||
//新增文章接口
|
||||
const getArticleClassAddSave = async () => {
|
||||
const result = await getArticleClassAddSaveApi(dataStore.editRuleForm);
|
||||
@@ -96,18 +182,20 @@ const getArticleClassAddSave = async () => {
|
||||
useMsg("success", msg);
|
||||
dataStore.visible = false;
|
||||
dataStore.editRuleForm = cloneDeep(EDIT_RULE_FORM);
|
||||
proTableRef?.value?.getTableList();
|
||||
getArticleClassList();
|
||||
}
|
||||
};
|
||||
//文章编辑
|
||||
const getArticleClassUpEdit = async () => {
|
||||
console.log("编辑");
|
||||
const result = await getArticleClassEditUpApi(dataStore.editRuleForm);
|
||||
const { msg, code } = result;
|
||||
|
||||
if (code === 0) {
|
||||
useMsg("success", msg);
|
||||
dataStore.visible = false;
|
||||
proTableRef?.value?.getTableList();
|
||||
dataStore.editRuleForm = cloneDeep(EDIT_RULE_FORM);
|
||||
getArticleClassList();
|
||||
}
|
||||
};
|
||||
//删除文章
|
||||
@@ -117,7 +205,7 @@ const getArticleClassDel = (row: any) => {
|
||||
const { msg, code } = result;
|
||||
if (code === 0) {
|
||||
useMsg("success", msg);
|
||||
proTableRef?.value?.getTableList();
|
||||
getArticleClassList();
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -141,12 +229,16 @@ const resetFields = () => {
|
||||
};
|
||||
//抽屉重置
|
||||
const handleResetClick = () => {
|
||||
resetFields();
|
||||
getArticleClassDetails(dataStore.selectRow);
|
||||
if (dataStore.title == "添加文章分类") {
|
||||
resetFields();
|
||||
} else {
|
||||
getArticleClassDetails(dataStore.selectRow);
|
||||
}
|
||||
};
|
||||
|
||||
//添加
|
||||
const handleAdd = () => {
|
||||
dataStore.title = "添加文章分类";
|
||||
dataStore.visible = true;
|
||||
};
|
||||
//弹窗关闭钩子
|
||||
|
||||
@@ -27,9 +27,9 @@ export const EDIT_FORM_DATA: FormItem[] = [
|
||||
},
|
||||
|
||||
{
|
||||
prop: "category_id",
|
||||
prop: "category_id1",
|
||||
placeholder: "请选择",
|
||||
type: "treeSelect",
|
||||
type: "select",
|
||||
label: "文章分类: ",
|
||||
options: []
|
||||
},
|
||||
@@ -55,6 +55,22 @@ export const EDIT_FORM_DATA: FormItem[] = [
|
||||
}
|
||||
]
|
||||
},
|
||||
// {
|
||||
// prop: "is_show1",
|
||||
// placeholder: "",
|
||||
// type: "radio",
|
||||
// label: "是否启用: ",
|
||||
// options: [
|
||||
// {
|
||||
// label: "是",
|
||||
// value: 1
|
||||
// },
|
||||
// {
|
||||
// label: "否",
|
||||
// value: 0
|
||||
// }
|
||||
// ]
|
||||
// },
|
||||
{
|
||||
prop: "link",
|
||||
placeholder: "请输入",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
export const RULES = {
|
||||
title: [{ required: true, message: "文章名称不能为空 ! ", trigger: "blur" }],
|
||||
category_id: [{ required: true, message: "文章分类不能为空 ! ", trigger: "change" }],
|
||||
category_id1: [{ required: true, message: "文章分类不能为空 ! ", trigger: "change" }],
|
||||
sort: [{ required: true, message: "文章排序不能为空 ! ", trigger: "blur" }]
|
||||
};
|
||||
|
||||
@@ -27,7 +27,7 @@ export const FORM_DATA: FormItem[] = [
|
||||
{
|
||||
prop: "category_id",
|
||||
placeholder: "请选择",
|
||||
type: "treeSelect",
|
||||
type: "select",
|
||||
isArray: true,
|
||||
label: "文章分类: ",
|
||||
options: []
|
||||
@@ -38,7 +38,7 @@ export const FORM_DATA: FormItem[] = [
|
||||
options: [],
|
||||
startPlaceholder: "开始日期",
|
||||
endPlaceholder: "结束日期",
|
||||
startDate: "created_at",
|
||||
startDate: "release_time",
|
||||
// endDate: "createEndDate",
|
||||
label: "发布时间: "
|
||||
}
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
//import { RenderScope } from "@/components/ProTable/interface";
|
||||
import { RenderScope } from "@/components/ProTable/interface";
|
||||
const YES_OR_NO: any = {
|
||||
1: "✔️",
|
||||
0: "❌"
|
||||
};
|
||||
export const COLUMNS = [
|
||||
{
|
||||
align: "center",
|
||||
@@ -32,7 +36,10 @@ export const COLUMNS = [
|
||||
{
|
||||
align: "left",
|
||||
label: "首页推荐",
|
||||
prop: "recommend"
|
||||
prop: "recommend",
|
||||
render: (scope: RenderScope<any>): VNode | string | any => {
|
||||
return YES_OR_NO[scope.row.recommend];
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
:formData="dataStore.editFormData"
|
||||
:rules="dataStore.rules"
|
||||
ref="formRef"
|
||||
@handleSelectChangeEmits="handleSelectChangeEmits"
|
||||
/>
|
||||
</el-tab-pane>
|
||||
|
||||
@@ -54,17 +55,10 @@ const dataStore = reactive<any>({
|
||||
editRuleForm: cloneDeep(EDIT_RULE_FORM),
|
||||
editFormData: cloneDeep(EDIT_FORM_DATA) //抽屉表单配置项
|
||||
});
|
||||
//新增
|
||||
const getArticleListAddSave = async () => {
|
||||
const result = await getArticleListAddSaveApi(dataStore.editRuleForm);
|
||||
if (result.code === 0) {
|
||||
const { msg } = result;
|
||||
useMsg("success", msg);
|
||||
}
|
||||
};
|
||||
|
||||
//文章分类
|
||||
const getArticleClassData = async () => {
|
||||
const result = await getArticleClassDataApi();
|
||||
const result = await getArticleClassDataApi({ is_show: 1 });
|
||||
if (result?.code === 0) {
|
||||
const { data } = result;
|
||||
dataStore.editFormData[1].options = useSearchInfoArray(data);
|
||||
@@ -87,10 +81,52 @@ const getArticleListDetails = async () => {
|
||||
const { data } = result;
|
||||
dataStore.editRuleForm = data;
|
||||
console.log(data);
|
||||
|
||||
let is = dataStore.editFormData[1].options.some((item: any) => {
|
||||
console.log(item.id);
|
||||
console.log(dataStore.editRuleForm.category_id);
|
||||
return item.value == dataStore.editRuleForm.category_id;
|
||||
});
|
||||
dataStore.editRuleForm.category_id1 = is ? dataStore.editRuleForm.category_id : dataStore.editRuleForm.category_name;
|
||||
}
|
||||
};
|
||||
const handleSelectChangeEmits = (value: any) => {
|
||||
console.log(value, "=======value========");
|
||||
if (value?.prop === "category_id1") {
|
||||
dataStore.editRuleForm.category_id = value.id;
|
||||
}
|
||||
};
|
||||
const convertDateFormat = (dateString: any) => {
|
||||
const date = new Date(dateString);
|
||||
const year = date.getFullYear();
|
||||
const month = String(date.getMonth() + 1).padStart(2, "0");
|
||||
const day = String(date.getDate()).padStart(2, "0");
|
||||
const hours = String(date.getHours()).padStart(2, "0");
|
||||
const minutes = String(date.getMinutes()).padStart(2, "0");
|
||||
const seconds = String(date.getSeconds()).padStart(2, "0");
|
||||
|
||||
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
|
||||
};
|
||||
//新增
|
||||
const getArticleListAddSave = async () => {
|
||||
if (dataStore.editRuleForm.release_time) {
|
||||
dataStore.editRuleForm.release_time = convertDateFormat(dataStore.editRuleForm.release_time);
|
||||
} else {
|
||||
dataStore.editRuleForm.release_time = null;
|
||||
}
|
||||
const result = await getArticleListAddSaveApi(dataStore.editRuleForm);
|
||||
if (result.code === 0) {
|
||||
const { msg } = result;
|
||||
useMsg("success", msg);
|
||||
}
|
||||
};
|
||||
//更新
|
||||
const getArticleListUp = async () => {
|
||||
if (dataStore.editRuleForm.release_time) {
|
||||
dataStore.editRuleForm.release_time = convertDateFormat(dataStore.editRuleForm.release_time);
|
||||
} else {
|
||||
dataStore.editRuleForm.release_time = null;
|
||||
}
|
||||
const result = await getArticleListUpApi({ id: $route.query.id, ...dataStore.editRuleForm });
|
||||
|
||||
if (result?.code === 0) {
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
:init-param="dataStore.initParam"
|
||||
>
|
||||
<template #image="scope">
|
||||
<el-image :src="h + scope.row.image" style="width: 60px; height: 60px" />
|
||||
<el-image :src="scope.row.image ? h + scope.row.image : '--'" style="width: 60px; height: 60px" />
|
||||
</template>
|
||||
<template #enabled="scope">
|
||||
<el-tag type="success" effect="dark">{{ scope.row.enabled === 1 ? "启用" : "禁用" }}</el-tag>
|
||||
@@ -44,7 +44,7 @@ import { cloneDeep } from "lodash-es";
|
||||
//表格和搜索條件
|
||||
import { RULE_FORM, FORM_DATA, COLUMNS } from "./constant/index";
|
||||
//图片地址
|
||||
const h = import.meta.env.VITE_APP_API_BASE_UPLOAD_URL;
|
||||
import { h } from "@/utils/url";
|
||||
// 获取 ProTable 元素,调用其获取刷新数据方法(还能获取到当前查询参数,方便导出携带参数)
|
||||
const proTableRef = ref<any>(null);
|
||||
const $router = useRouter();
|
||||
@@ -80,7 +80,10 @@ const handleAdd = (type: any) => {
|
||||
|
||||
//导出接口
|
||||
const getArticleListExport = async () => {
|
||||
const result = await getArticleListExportApi(dataStore.ruleForm);
|
||||
const result = await getArticleListExportApi({
|
||||
...proTableRef?.value?.searchParam,
|
||||
...proTableRef?.value?.pageable
|
||||
});
|
||||
await useExport(result);
|
||||
};
|
||||
//导出
|
||||
|
||||
@@ -50,12 +50,12 @@ export const COLUMNS = [
|
||||
width: 160
|
||||
},
|
||||
|
||||
{
|
||||
align: "center",
|
||||
label: "状态",
|
||||
prop: "status",
|
||||
width: 80
|
||||
},
|
||||
// {
|
||||
// align: "center",
|
||||
// label: "状态",
|
||||
// prop: "status",
|
||||
// width: 80
|
||||
// },
|
||||
|
||||
{ prop: "operation", label: "操作", fixed: "right", width: 200 }
|
||||
];
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
:init-param="dataStore.initParam"
|
||||
>
|
||||
<template #image="scope">
|
||||
<el-image :src="h + scope.row.image" style="width: 60px; height: 60px" />
|
||||
<el-image :src="scope.row.image ? h + scope.row.image : ''" style="width: 60px; height: 60px" />
|
||||
</template>
|
||||
|
||||
<template #status="scope">
|
||||
@@ -28,7 +28,7 @@ import ProTable from "@/components/ProTable/index.vue";
|
||||
import { messageBox } from "@/utils/messageBox";
|
||||
import { useMsg } from "@/hooks/useMsg";
|
||||
import { useSearchInfoArray } from "@/hooks/useSearch";
|
||||
const h = import.meta.env.VITE_APP_API_BASE_UPLOAD_URL;
|
||||
import { h } from "@/utils/url";
|
||||
//列表接口
|
||||
import { getArticleTrashListApi, getArticleTrashDelApi, getArticleTrashRestoreApi } from "@/api/modules/articleRecycle";
|
||||
import { getArticleClassDataApi } from "@/api/modules/articleList";
|
||||
|
||||
@@ -1,136 +0,0 @@
|
||||
interface FormItem {
|
||||
prop: string;
|
||||
label?: string;
|
||||
placeholder?: string;
|
||||
type: string;
|
||||
isCopy?: boolean;
|
||||
optionProps?: any;
|
||||
startPlaceholder?: string;
|
||||
endPlaceholder?: string;
|
||||
options?: any;
|
||||
isArray?: boolean;
|
||||
startDate?: string; //开始时间(传入后台需要的参数)
|
||||
endDate?: string; //结束时间(传入后台需要的参数)
|
||||
startProp?: string;
|
||||
endProp?: string;
|
||||
isInteger?: boolean;
|
||||
disabled?: boolean;
|
||||
fileList?: any;
|
||||
prompt?: any;
|
||||
}
|
||||
export const EDIT_FORM_DATA: FormItem[] = [
|
||||
{
|
||||
prop: "videoName",
|
||||
placeholder: "请输入",
|
||||
type: "input",
|
||||
label: "下载名称: "
|
||||
},
|
||||
|
||||
{
|
||||
prop: "videoType",
|
||||
placeholder: "请选择",
|
||||
type: "treeSelect",
|
||||
label: "下载分类: ",
|
||||
options: [
|
||||
{
|
||||
value: "1",
|
||||
label: "Level one 1",
|
||||
children: [
|
||||
{
|
||||
value: "1-1",
|
||||
label: "Level two 1-1",
|
||||
children: [
|
||||
{
|
||||
value: "1-1-1",
|
||||
label: "Level three 1-1-1"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
prop: "videoSort",
|
||||
placeholder: "请输入",
|
||||
type: "input",
|
||||
label: "下载排序: "
|
||||
},
|
||||
{
|
||||
prop: "recommend",
|
||||
placeholder: "请输入",
|
||||
type: "radio",
|
||||
label: "首页推荐: ",
|
||||
options: [
|
||||
{
|
||||
label: "是",
|
||||
value: "是"
|
||||
},
|
||||
{
|
||||
label: "否",
|
||||
value: "否"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
prop: "imgUrl",
|
||||
type: "upImg",
|
||||
label: "下载图片: ",
|
||||
prompt: "图片尺寸320x320"
|
||||
},
|
||||
{
|
||||
prop: "table",
|
||||
type: "table",
|
||||
label: "下载文件: "
|
||||
},
|
||||
{
|
||||
prop: "videoDescribe",
|
||||
placeholder: "请输入",
|
||||
type: "input",
|
||||
label: "适合型号: "
|
||||
},
|
||||
{
|
||||
prop: "videoDescribe",
|
||||
placeholder: "请输入",
|
||||
type: "input",
|
||||
label: "支持系统: "
|
||||
},
|
||||
{
|
||||
prop: "videoDescribe",
|
||||
placeholder: "请输入",
|
||||
type: "input",
|
||||
label: "文件格式: "
|
||||
},
|
||||
|
||||
{
|
||||
prop: "SEOTitle",
|
||||
placeholder: "请输入",
|
||||
type: "input",
|
||||
label: "SEO标题: "
|
||||
},
|
||||
{
|
||||
prop: "SEOKeywords",
|
||||
placeholder: "请输入",
|
||||
type: "input",
|
||||
label: "SEO关键词: "
|
||||
},
|
||||
{
|
||||
prop: "SEODescribe",
|
||||
placeholder: "请输入",
|
||||
type: "input",
|
||||
label: "SEO描述: "
|
||||
}
|
||||
];
|
||||
export const EDIT_RULE_FORM = {
|
||||
videoName: "",
|
||||
videoType: "",
|
||||
videoSort: 1,
|
||||
recommend: "",
|
||||
videoDescribe: "",
|
||||
link: "",
|
||||
SEOTitle: "",
|
||||
SEOKeywords: "",
|
||||
SEODescribe: ""
|
||||
};
|
||||
// editRuleForm: {},
|
||||
//editFormData: [],
|
||||
@@ -1,5 +1,4 @@
|
||||
import { FORM_DATA, RULE_FORM } from "./search";
|
||||
import { COLUMNS } from "./table";
|
||||
import { RULES } from "./rules";
|
||||
import { EDIT_FORM_DATA, EDIT_RULE_FORM } from "./edit";
|
||||
export { FORM_DATA, RULE_FORM, COLUMNS, EDIT_FORM_DATA, EDIT_RULE_FORM, RULES };
|
||||
export { FORM_DATA, RULE_FORM, COLUMNS, RULES };
|
||||
|
||||
@@ -11,9 +11,9 @@
|
||||
:request-api="getArticleRemarkListApi"
|
||||
:init-param="dataStore.initParam"
|
||||
>
|
||||
<template #image="scope">
|
||||
<el-image :src="h + scope.row.image" style="width: 60px; height: 60px" />
|
||||
</template>
|
||||
<!-- <template #image="scope">
|
||||
<el-image :src="scope.row.image ? h + scope.row.image : ''" style="width: 60px; height: 60px" />
|
||||
</template> -->
|
||||
<template #is_audited="scope">
|
||||
<el-tag :type="scope.row.is_audited ? 'success' : 'danger'" effect="dark">{{
|
||||
scope.row.is_audited ? "已审核" : "待审核"
|
||||
@@ -34,7 +34,7 @@ import ProTable from "@/components/ProTable/index.vue";
|
||||
import { messageBox } from "@/utils/messageBox";
|
||||
import { useMsg } from "@/hooks/useMsg";
|
||||
import { useExport } from "@/hooks/useExport";
|
||||
const h = import.meta.env.VITE_APP_API_BASE_UPLOAD_URL;
|
||||
// import { h } from "@/utils/url";
|
||||
//列表接口
|
||||
|
||||
import {
|
||||
@@ -61,7 +61,10 @@ const dataStore = reactive<any>({
|
||||
});
|
||||
//导出
|
||||
const getArticleRemarkExport = async () => {
|
||||
const result = await getArticleRemarkExportApi(dataStore.ruleForm);
|
||||
const result = await getArticleRemarkExportApi({
|
||||
...proTableRef?.value?.searchParam,
|
||||
...proTableRef?.value?.pageable
|
||||
});
|
||||
await useExport(result);
|
||||
};
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
:init-param="dataStore.initParam"
|
||||
>
|
||||
<template #image="scope">
|
||||
<el-image :src="h + scope.row.image" style="width: 60px; height: 60px" />
|
||||
<el-image :src="scope.row.image ? h + scope.row.image : ''" style="width: 60px; height: 60px" />
|
||||
</template>
|
||||
<template #status="scope">
|
||||
<el-tag type="success" effect="dark">{{ scope.row.status }}</el-tag>
|
||||
@@ -42,6 +42,7 @@
|
||||
ref="formRef"
|
||||
/>
|
||||
</div>
|
||||
<!-- @handleRadioGroupEmits="handleRadioGroupEmits" -->
|
||||
<template #footer>
|
||||
<div style="flex: auto">
|
||||
<el-button @click="handleResetClick">重置</el-button>
|
||||
@@ -57,7 +58,7 @@ import ProTable from "@/components/ProTable/index.vue";
|
||||
import rulesForm from "@/components/rulesForm/index.vue";
|
||||
import { messageBox } from "@/utils/messageBox";
|
||||
import { useMsg } from "@/hooks/useMsg";
|
||||
const h = import.meta.env.VITE_APP_API_BASE_UPLOAD_URL;
|
||||
import { h } from "@/utils/url";
|
||||
//列表接口
|
||||
import {
|
||||
getBannerClassListApi,
|
||||
@@ -99,6 +100,18 @@ const handleConfirmClick = () => {
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
// const handleRadioGroupEmits = (value: any) => {
|
||||
// // if (value === "image") {
|
||||
// // dataStore.editFormData = EDIT_FORM_DATA;
|
||||
// // dataStore.rules = RULES;
|
||||
// // } else {
|
||||
// // dataStore.editFormData = EDIT_FORM_DATA1;
|
||||
// // dataStore.rules = RULES1;
|
||||
// // }
|
||||
// console.log(value, "=========value============");
|
||||
// };
|
||||
|
||||
//重置验证状态
|
||||
const resetFields = () => {
|
||||
if (!formRef.value!.ruleFormRef) return;
|
||||
|
||||
@@ -49,6 +49,22 @@ export const EDIT_FORM_DATA: FormItem[] = [
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
prop: "status",
|
||||
placeholder: "",
|
||||
type: "radio",
|
||||
label: "是否启用: ",
|
||||
options: [
|
||||
{
|
||||
label: "是",
|
||||
value: 1
|
||||
},
|
||||
{
|
||||
label: "否",
|
||||
value: -1
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
prop: "image",
|
||||
type: "upImg",
|
||||
@@ -60,13 +76,16 @@ export const EDIT_FORM_DATA: FormItem[] = [
|
||||
placeholder: "请选择",
|
||||
type: "select",
|
||||
label: "Banner分类: ",
|
||||
options: [
|
||||
{
|
||||
value: "1",
|
||||
label: "Level one 1"
|
||||
}
|
||||
]
|
||||
options: []
|
||||
},
|
||||
{
|
||||
prop: "rel_prod_cate_id",
|
||||
placeholder: "请选择",
|
||||
type: "treeSelect",
|
||||
label: "相关分类: ",
|
||||
options: []
|
||||
},
|
||||
|
||||
{
|
||||
prop: "sort",
|
||||
placeholder: "请输入",
|
||||
@@ -86,7 +105,7 @@ export const EDIT_FORM_DATA: FormItem[] = [
|
||||
{
|
||||
prop: "desc",
|
||||
placeholder: "请输入",
|
||||
type: "textarea",
|
||||
type: "WangEditor",
|
||||
label: "Banner描述: "
|
||||
},
|
||||
{
|
||||
@@ -126,6 +145,22 @@ export const EDIT_FORM_DATA1: FormItem[] = [
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
prop: "status",
|
||||
placeholder: "",
|
||||
type: "radio",
|
||||
label: "是否启用: ",
|
||||
options: [
|
||||
{
|
||||
label: "是",
|
||||
value: 1
|
||||
},
|
||||
{
|
||||
label: "否",
|
||||
value: 0
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
prop: "image",
|
||||
type: "upImg",
|
||||
@@ -137,12 +172,7 @@ export const EDIT_FORM_DATA1: FormItem[] = [
|
||||
placeholder: "请选择",
|
||||
type: "select",
|
||||
label: "Banner分类: ",
|
||||
options: [
|
||||
{
|
||||
value: "1",
|
||||
label: "Level one 1"
|
||||
}
|
||||
]
|
||||
options: []
|
||||
},
|
||||
{
|
||||
prop: "sort",
|
||||
@@ -150,15 +180,15 @@ export const EDIT_FORM_DATA1: FormItem[] = [
|
||||
type: "inputNumber",
|
||||
label: "Banner排序: "
|
||||
},
|
||||
{
|
||||
prop: "link",
|
||||
placeholder: "请输入",
|
||||
type: "inputSelect",
|
||||
label: "链接地址: ",
|
||||
placeholder1: "请选择",
|
||||
prop1: "link_type",
|
||||
options: []
|
||||
},
|
||||
// {
|
||||
// prop: "link",
|
||||
// placeholder: "请输入",
|
||||
// type: "inputSelect",
|
||||
// label: "链接地址: ",
|
||||
// placeholder1: "请选择",
|
||||
// prop1: "link_type",
|
||||
// options: []
|
||||
// },
|
||||
{
|
||||
prop: "video",
|
||||
type: "video",
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
export const RULES = {
|
||||
title: [{ required: true, message: "Banner名称不能为空 ! ", trigger: "blur" }],
|
||||
type: [{ required: true, message: "前台显示不能为空 ! ", trigger: "change" }],
|
||||
image: [{ required: true, message: "Banner图片不能为空 ! ", trigger: "change" }],
|
||||
// image: [{ required: true, message: "Banner图片不能为空 ! ", trigger: "change" }],
|
||||
banner_id: [{ required: true, message: "Banner分类不能为空 ! ", trigger: "change" }],
|
||||
sort: [{ required: true, message: "排序不能为空 ! ", trigger: "change" }]
|
||||
};
|
||||
|
||||
@@ -33,6 +33,11 @@ export const COLUMNS = [
|
||||
label: "添加时间",
|
||||
prop: "created_at"
|
||||
},
|
||||
|
||||
{
|
||||
align: "center",
|
||||
label: "状态",
|
||||
prop: "status",
|
||||
width: 80
|
||||
},
|
||||
{ prop: "operation", label: "操作", fixed: "right", width: 200 }
|
||||
];
|
||||
|
||||
@@ -12,11 +12,16 @@
|
||||
:init-param="dataStore.initParam"
|
||||
>
|
||||
<template #image="scope">
|
||||
<el-image :src="h + scope.row.image" style="width: 60px; height: 60px" />
|
||||
<el-image :src="scope.row.image ? h + scope.row.image : ''" style="width: 60px; height: 60px" />
|
||||
</template>
|
||||
<template #sort="scope">
|
||||
<el-input v-model="scope.row.sort" @blur="handleBlur(scope.row)" @input="handleInput(scope.row)"></el-input>
|
||||
</template>
|
||||
<template #status="scope">
|
||||
<el-tag :type="scope.row.status === 1 ? 'success' : 'danger'" effect="dark">{{
|
||||
scope.row.status === 1 ? "启用" : "禁用"
|
||||
}}</el-tag>
|
||||
</template>
|
||||
<template #operation="scope">
|
||||
<el-button size="small" type="primary" @click="getBannerRead(scope.row.id)">编辑</el-button>
|
||||
<el-button size="small" type="danger" @click="getBannerDel(scope.row.id)">删除</el-button>
|
||||
@@ -25,7 +30,7 @@
|
||||
<el-drawer
|
||||
v-model="dataStore.visible"
|
||||
:show-close="true"
|
||||
:size="640"
|
||||
:size="980"
|
||||
:close-on-click-modal="false"
|
||||
:close-on-press-escape="false"
|
||||
:before-close="handleBeforeClone"
|
||||
@@ -42,7 +47,7 @@
|
||||
ref="formRef"
|
||||
@handleRadioGroupEmits="handleRadioGroupEmits"
|
||||
>
|
||||
<el-input v-model.trim="dataStore.editRuleForm.link" clearable style="width: 440px">
|
||||
<el-input v-model="dataStore.editRuleForm.link" clearable style="width: 440px">
|
||||
<template #append>
|
||||
<el-tree-select
|
||||
lazy
|
||||
@@ -57,7 +62,6 @@
|
||||
@check="handleCheck"
|
||||
placeholder="请选择"
|
||||
style="padding: 0"
|
||||
@visible-change="visibleChange"
|
||||
/>
|
||||
</template>
|
||||
</el-input>
|
||||
@@ -80,8 +84,9 @@ import { messageBox } from "@/utils/messageBox";
|
||||
import { useMsg } from "@/hooks/useMsg";
|
||||
import { useExport } from "@/hooks/useExport";
|
||||
import { integerRexg } from "@/utils/regexp/index";
|
||||
import { getProductCategoryListApi } from "@/api/modules/productList";
|
||||
// 图片地址
|
||||
const h = import.meta.env.VITE_APP_API_BASE_UPLOAD_URL;
|
||||
import { h } from "@/utils/url";
|
||||
// 列表接口
|
||||
import {
|
||||
getBannerListApi,
|
||||
@@ -90,9 +95,10 @@ import {
|
||||
getBannerListSortApi,
|
||||
getBannerUpApi,
|
||||
getBannerListSaveApi,
|
||||
getBannerListExportApi
|
||||
getBannerListExportApi,
|
||||
getBannerClassListApi
|
||||
} from "@/api/modules/banner";
|
||||
import { getBannerClassListApi } from "@/api/modules/bannerClass";
|
||||
// import { getBannerClassListApi } from "@/api/modules/bannerClass";
|
||||
import { getSystemUrlsApi } from "@/api/modules/home";
|
||||
// 深拷贝方法
|
||||
import { cloneDeep } from "lodash-es";
|
||||
@@ -113,7 +119,7 @@ const dataStore = reactive<any>({
|
||||
formData: FORM_DATA, // 搜索配置项 dataStore.formData
|
||||
visible: false,
|
||||
data: [],
|
||||
is: false
|
||||
isFirstRequest: true
|
||||
});
|
||||
|
||||
const selectedNodes = ref(null);
|
||||
@@ -126,11 +132,29 @@ const treeProps = {
|
||||
label: "label",
|
||||
value: "value"
|
||||
};
|
||||
const visibleChange = (is: any) => {
|
||||
dataStore.is = is;
|
||||
if (dataStore.is) {
|
||||
const addLabelValue = (arr: any) => {
|
||||
return arr.map((item: any) => {
|
||||
// 为当前对象添加 label 和 value 属性
|
||||
const newItem = { ...item };
|
||||
newItem.label = newItem.name;
|
||||
newItem.value = newItem.id;
|
||||
|
||||
// 如果有子对象,递归调用 addLabelValue 处理子对象
|
||||
if (newItem.children && Array.isArray(newItem.children)) {
|
||||
newItem.children = addLabelValue(newItem.children);
|
||||
}
|
||||
return newItem;
|
||||
});
|
||||
};
|
||||
//产品分类(后端大佬说直接掉列表接口)
|
||||
const getProductCategoryList = async () => {
|
||||
const result = await getProductCategoryListApi();
|
||||
if (result?.code === 0) {
|
||||
let dataClone: any = cloneDeep(result?.data);
|
||||
dataStore.editFormData[6].options = addLabelValue(dataClone);
|
||||
}
|
||||
};
|
||||
|
||||
const buildTree = (data: any, outerLinkTo: any = "") => {
|
||||
return data.map((item: any) => {
|
||||
const { name, id, url, data: childData = [], children: nestedChildren = [] } = item;
|
||||
@@ -149,15 +173,30 @@ const buildTree = (data: any, outerLinkTo: any = "") => {
|
||||
};
|
||||
});
|
||||
};
|
||||
let isFirstRequest = true;
|
||||
// let isFirstRequest = true;
|
||||
const handleRadioGroupEmits = (value: any) => {
|
||||
if (value === "video") {
|
||||
dataStore.editFormData = EDIT_FORM_DATA1;
|
||||
dataStore.rules = RULES1;
|
||||
getBannerClassEditList();
|
||||
}
|
||||
|
||||
if (value === "image") {
|
||||
dataStore.isFirstRequest = true;
|
||||
dataStore.editFormData = EDIT_FORM_DATA;
|
||||
dataStore.rules = RULES;
|
||||
getBannerClassEditList();
|
||||
}
|
||||
};
|
||||
|
||||
const getSystemUrls = async (node: any, resolve: any) => {
|
||||
//第一次请求
|
||||
if (isFirstRequest) {
|
||||
if (dataStore.isFirstRequest) {
|
||||
const result = await getSystemUrlsApi();
|
||||
if (result?.code === 0) {
|
||||
const children = buildTree(result?.data);
|
||||
resolve(children);
|
||||
isFirstRequest = false;
|
||||
dataStore.isFirstRequest = false;
|
||||
}
|
||||
} else {
|
||||
//第二次请求
|
||||
@@ -176,6 +215,15 @@ const getSystemUrls = async (node: any, resolve: any) => {
|
||||
}
|
||||
}
|
||||
};
|
||||
const setImgOrVideo = () => {
|
||||
if (dataStore.editRuleForm.type === "image") {
|
||||
dataStore.editFormData = EDIT_FORM_DATA;
|
||||
}
|
||||
if (dataStore.editRuleForm.type === "video") {
|
||||
dataStore.editFormData = EDIT_FORM_DATA1;
|
||||
}
|
||||
getBannerClassEditList();
|
||||
};
|
||||
// 详情
|
||||
const getBannerRead = async (id: any) => {
|
||||
dataStore.title = "编辑Banner";
|
||||
@@ -183,8 +231,13 @@ const getBannerRead = async (id: any) => {
|
||||
const result = await getBannerReadApi(id);
|
||||
if (result?.code === 0) {
|
||||
dataStore.editRuleForm = result?.data;
|
||||
setImgOrVideo();
|
||||
getProductCategoryList();
|
||||
if (dataStore.editRuleForm.link && dataStore.editRuleForm.link_to) {
|
||||
let { id, name, link } = dataStore.editRuleForm.link_echo_data;
|
||||
if (!id || !name || !link) {
|
||||
return;
|
||||
}
|
||||
let obj: any = {
|
||||
label: name, // 确保这里的name是你想要显示的文本
|
||||
value: `${dataStore.editRuleForm.link_to}` + "/" + `${id}` + "/" + `${name}`,
|
||||
@@ -212,42 +265,53 @@ const handleCheck = (checkedNodes: any, values: any) => {
|
||||
|
||||
// 更新
|
||||
const getBannerUp = async () => {
|
||||
if (dataStore.editRuleForm.type === "video") {
|
||||
dataStore.editRuleForm.link_to = "";
|
||||
dataStore.editRuleForm.link = "";
|
||||
}
|
||||
if (dataStore.editRuleForm.type === "image") {
|
||||
dataStore.editRuleForm.video = "";
|
||||
}
|
||||
const result = await getBannerUpApi(dataStore.editRuleForm);
|
||||
if (result?.code === 0) {
|
||||
dataStore.visible = false;
|
||||
dataStore.editRuleForm = cloneDeep(EDIT_RULE_FORM);
|
||||
formRef!.value!.ruleFormRef.resetFields();
|
||||
proTableRef?.value?.getTableList();
|
||||
dataStore.isFirstRequest = true;
|
||||
}
|
||||
};
|
||||
|
||||
// 分类
|
||||
const getBannerClassList = async () => {
|
||||
const result = await getBannerClassListApi({ page: 1, size: 500 });
|
||||
//详情里的分类
|
||||
const getBannerClassEditList = async () => {
|
||||
const result = await getBannerClassListApi();
|
||||
if (result?.code === 0) {
|
||||
let arr: any = [];
|
||||
result?.data?.data?.forEach((item: any) => {
|
||||
result?.data?.forEach((item: any) => {
|
||||
arr.push({ value: item.id, label: item.name });
|
||||
});
|
||||
dataStore.formData[1].options = arr;
|
||||
dataStore.editFormData[4].options = arr;
|
||||
dataStore.editFormData[5].options = arr;
|
||||
}
|
||||
};
|
||||
getBannerClassList();
|
||||
// 新增 getBannerListSave
|
||||
getBannerClassEditList();
|
||||
// 新增
|
||||
const getBannerListSave = async () => {
|
||||
const result = await getBannerListSaveApi(dataStore.editRuleForm);
|
||||
if (result?.code === 0) {
|
||||
dataStore.visible = false;
|
||||
dataStore.editRuleForm = cloneDeep(EDIT_RULE_FORM);
|
||||
useMsg("success", result?.msg);
|
||||
dataStore.isFirstRequest = true;
|
||||
formRef!.value!.ruleFormRef.resetFields();
|
||||
proTableRef?.value?.getTableList();
|
||||
}
|
||||
};
|
||||
// 导出接口
|
||||
const getArticleListExport = async () => {
|
||||
const result = await getBannerListExportApi(dataStore.ruleForm);
|
||||
const result = await getBannerListExportApi({
|
||||
...proTableRef?.value?.searchParam,
|
||||
...proTableRef?.value?.pageable
|
||||
});
|
||||
await useExport(result);
|
||||
};
|
||||
// 导出
|
||||
@@ -284,23 +348,18 @@ const handleResetClick = () => {
|
||||
const handleAdd = () => {
|
||||
dataStore.title = "添加Banner";
|
||||
dataStore.visible = true;
|
||||
getBannerClassEditList();
|
||||
// getBannerClassList();
|
||||
getProductCategoryList();
|
||||
};
|
||||
// 抽屉关闭前的钩子
|
||||
const handleBeforeClone = () => {
|
||||
dataStore.editRuleForm = cloneDeep(EDIT_RULE_FORM);
|
||||
resetFields();
|
||||
dataStore.visible = false;
|
||||
dataStore.isFirstRequest = true;
|
||||
};
|
||||
|
||||
const handleRadioGroupEmits = (value: any) => {
|
||||
if (value === "image") {
|
||||
dataStore.editFormData = EDIT_FORM_DATA;
|
||||
dataStore.rules = RULES;
|
||||
} else {
|
||||
dataStore.editFormData = EDIT_FORM_DATA1;
|
||||
dataStore.rules = RULES1;
|
||||
}
|
||||
};
|
||||
// 删除
|
||||
const getBannerDel = async (id: any) => {
|
||||
messageBox("你确定要删除?", async () => {
|
||||
|
||||
@@ -22,7 +22,7 @@ export const EDIT_FORM_DATA: FormItem[] = [
|
||||
prop: "name",
|
||||
placeholder: "请输入",
|
||||
type: "input",
|
||||
label: "文章分类名称: "
|
||||
label: "下载分类名称: "
|
||||
},
|
||||
|
||||
{
|
||||
@@ -46,6 +46,13 @@ export const EDIT_FORM_DATA: FormItem[] = [
|
||||
value: 0
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
prop: "pid",
|
||||
placeholder: "请选择",
|
||||
type: "treeSelect",
|
||||
label: "所属分类: ",
|
||||
options: []
|
||||
}
|
||||
];
|
||||
export const EDIT_RULE_FORM = {
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
export const RULES = {
|
||||
name: [{ required: true, message: "文章分类名称不能为空 ! ", trigger: "blur" }],
|
||||
sort: [{ required: true, message: "下载分类排序不能为空 ! ", trigger: "blur" }]
|
||||
sort: [{ required: true, message: "下载分类排序不能为空 ! ", trigger: "blur" }],
|
||||
pid: [{ required: true, message: "所属分类不能为空 ! ", trigger: "change" }]
|
||||
};
|
||||
|
||||
@@ -4,65 +4,78 @@
|
||||
<div style="padding-bottom: 16px">
|
||||
<el-button type="primary" @click="handleAdd"> 添加分类 </el-button>
|
||||
</div>
|
||||
<ProTable
|
||||
ref="proTableRef"
|
||||
:formData="dataStore.formData"
|
||||
:columns="dataStore.columns"
|
||||
:request-api="getCategoryListApi"
|
||||
:init-param="dataStore.initParam"
|
||||
>
|
||||
<template #image="scope">
|
||||
<el-image :src="h + scope.row.image" style="width: 60px; height: 60px" />
|
||||
</template>
|
||||
<template #status="scope">
|
||||
<el-tag type="success" effect="dark">{{ scope.row.status }}</el-tag>
|
||||
</template>
|
||||
<template #sort="scope">
|
||||
<el-input v-model="scope.row.sort" @blur="handleBlur(scope.row)" @input="handleInput(scope.row)"></el-input>
|
||||
</template>
|
||||
<template #operation="scope">
|
||||
<el-button size="small" type="primary" @click="handleBtnClick('编辑', scope.row)">编辑</el-button>
|
||||
<el-button size="small" type="primary" @click="handleBtnClick('添加', scope.row)">添加下载</el-button>
|
||||
<el-button size="small" type="danger" @click="handleBtnClick('删除', scope.row)">删除</el-button>
|
||||
</template>
|
||||
</ProTable>
|
||||
<el-drawer
|
||||
v-model="dataStore.visible"
|
||||
:show-close="true"
|
||||
:size="600"
|
||||
:close-on-click-modal="false"
|
||||
:close-on-press-escape="false"
|
||||
:before-close="handleBeforeClone"
|
||||
destroy-on-close
|
||||
>
|
||||
<template #header="{ titleId, titleClass }">
|
||||
<h4 :id="titleId" :class="titleClass">{{ dataStore.title }}</h4>
|
||||
</template>
|
||||
<div>
|
||||
<rulesForm
|
||||
:ruleForm="dataStore.editRuleForm"
|
||||
:formData="dataStore.editFormData"
|
||||
:rules="dataStore.rules"
|
||||
ref="formRef"
|
||||
/>
|
||||
</div>
|
||||
<template #footer>
|
||||
<div style="flex: auto">
|
||||
<el-button @click="handleResetClick">重置</el-button>
|
||||
<el-button type="primary" @click="handleConfirmClick">确认</el-button>
|
||||
|
||||
<div class="card table-main">
|
||||
<SearchForm :search="search" :reset="reset" :formData="dataStore.formData" :search-param="dataStore.ruleForm" />
|
||||
<el-table
|
||||
:data="dataStore.tableData"
|
||||
style="width: 100%; margin-bottom: 20px; font-size: 14px"
|
||||
row-key="id"
|
||||
border
|
||||
default-expand-all
|
||||
>
|
||||
<el-table-column prop="id" label="id" />
|
||||
<el-table-column prop="name" label="下载分类名称" />
|
||||
<el-table-column prop="sort" label="下载分类排序">
|
||||
<template #default="{ row }">
|
||||
<div @click.stop="">
|
||||
<el-input v-model="row.sort" @blur="handleBlur(row)" @input="handleInput(row)" />
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="is_show" label="是否显示">
|
||||
<template #default="{ row }">
|
||||
{{ row.is_show === 1 ? "✔️" : "❌" }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" :width="350">
|
||||
<template #default="scope">
|
||||
<el-button size="small" type="primary" @click="handleBtnClick('编辑', scope.row)">编辑</el-button>
|
||||
<el-button size="small" type="primary" @click="handleBtnClick('添加', scope.row)">添加下载</el-button>
|
||||
<el-button size="small" type="danger" @click="handleBtnClick('删除', scope.row)">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<el-drawer
|
||||
v-model="dataStore.visible"
|
||||
:show-close="true"
|
||||
:size="600"
|
||||
:close-on-click-modal="false"
|
||||
:close-on-press-escape="false"
|
||||
:before-close="handleBeforeClone"
|
||||
destroy-on-close
|
||||
>
|
||||
<template #header="{ titleId, titleClass }">
|
||||
<h4 :id="titleId" :class="titleClass">{{ dataStore.title }}</h4>
|
||||
</template>
|
||||
<div>
|
||||
<rulesForm
|
||||
:ruleForm="dataStore.editRuleForm"
|
||||
:formData="dataStore.editFormData"
|
||||
:rules="dataStore.rules"
|
||||
ref="formRef"
|
||||
@handleSelectChangeEmits="handleSelectChangeEmits"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
</el-drawer>
|
||||
<template #footer>
|
||||
<div style="flex: auto">
|
||||
<el-button @click="handleResetClick">重置</el-button>
|
||||
<el-button type="primary" @click="handleConfirmClick">确认</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-drawer>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="downloadClassListIndex">
|
||||
import ProTable from "@/components/ProTable/index.vue";
|
||||
// import ProTable from "@/components/ProTable/index.vue";
|
||||
import rulesForm from "@/components/rulesForm/index.vue";
|
||||
import { messageBox } from "@/utils/messageBox";
|
||||
import { useMsg } from "@/hooks/useMsg";
|
||||
import { integerRexg } from "@/utils/regexp/index";
|
||||
const h = import.meta.env.VITE_APP_API_BASE_UPLOAD_URL;
|
||||
// import { h } from "@/utils/url";
|
||||
//列表接口
|
||||
import {
|
||||
getCategoryListApi,
|
||||
@@ -70,14 +83,14 @@ import {
|
||||
getCategorySortApi,
|
||||
getCategorySaveApi,
|
||||
getCategoryReadApi,
|
||||
getCategoryUpdateApi
|
||||
getCategoryUpdateApi,
|
||||
getCategorysApi
|
||||
} from "@/api/modules/downloadClass";
|
||||
//深拷贝方法
|
||||
import { cloneDeep } from "lodash-es";
|
||||
//表格和搜索條件
|
||||
import { RULE_FORM, FORM_DATA, COLUMNS, EDIT_FORM_DATA, EDIT_RULE_FORM, RULES } from "./constant/index";
|
||||
// 获取 ProTable 元素,调用其获取刷新数据方法(还能获取到当前查询参数,方便导出携带参数)
|
||||
const proTableRef = ref<any>(null);
|
||||
|
||||
const formRef: any = ref(null);
|
||||
const $router = useRouter();
|
||||
// 数据源
|
||||
@@ -89,11 +102,57 @@ const dataStore = reactive<any>({
|
||||
editFormData: cloneDeep(EDIT_FORM_DATA), //抽屉表单配置项
|
||||
initParam: cloneDeep(RULE_FORM), // 初始化搜索条件|重置搜索条件
|
||||
ruleForm: cloneDeep(RULE_FORM), // 搜索參數
|
||||
formData: FORM_DATA, //搜索配置项
|
||||
formData: FORM_DATA, //搜索配置项 ruleForm formData
|
||||
visible: false,
|
||||
tableData: [],
|
||||
selectRow: {} //当前选择的row
|
||||
});
|
||||
const getCategoryList = async () => {
|
||||
const result = await getCategoryListApi(dataStore.ruleForm);
|
||||
if (result?.code === 0) {
|
||||
dataStore.tableData = result?.data;
|
||||
}
|
||||
};
|
||||
getCategoryList();
|
||||
//search reset
|
||||
const search = () => {
|
||||
getCategoryList();
|
||||
};
|
||||
const reset = () => {
|
||||
for (let key in dataStore.ruleForm) {
|
||||
dataStore.ruleForm[key] = "";
|
||||
}
|
||||
getCategoryList();
|
||||
};
|
||||
|
||||
const handleSelectChangeEmits = (params: any) => {
|
||||
const { id } = params;
|
||||
dataStore.editRuleForm.pid = id;
|
||||
};
|
||||
|
||||
const addLabelValue = (arr: any) => {
|
||||
return arr.map((item: any) => {
|
||||
// 为当前对象添加 label 和 value 属性
|
||||
const newItem = { ...item };
|
||||
newItem.label = newItem.name;
|
||||
newItem.value = newItem.id;
|
||||
|
||||
// 如果有子对象,递归调用 addLabelValue 处理子对象
|
||||
if (newItem.children && Array.isArray(newItem.children)) {
|
||||
newItem.children = addLabelValue(newItem.children);
|
||||
}
|
||||
return newItem;
|
||||
});
|
||||
};
|
||||
//分类下拉
|
||||
const getCategorys = async () => {
|
||||
const result = await getCategorysApi();
|
||||
if (result?.code === 0) {
|
||||
dataStore.editFormData[3].options = addLabelValue(result?.data);
|
||||
dataStore.editFormData[3].options.unshift({ value: 0, label: "无" });
|
||||
}
|
||||
};
|
||||
getCategorys();
|
||||
//抽屉确认
|
||||
const handleConfirmClick = () => {
|
||||
if (!formRef.value!.ruleFormRef) return;
|
||||
@@ -156,7 +215,7 @@ const getCategoryUpdate = async () => {
|
||||
useMsg("success", result?.msg);
|
||||
dataStore.visible = false;
|
||||
dataStore.editRuleForm = cloneDeep(EDIT_RULE_FORM);
|
||||
proTableRef?.value?.getTableList();
|
||||
getCategoryList();
|
||||
}
|
||||
};
|
||||
//详情
|
||||
@@ -173,7 +232,7 @@ const getCategorySave = async () => {
|
||||
useMsg("success", result?.msg);
|
||||
dataStore.visible = false;
|
||||
dataStore.editRuleForm = cloneDeep(EDIT_RULE_FORM);
|
||||
proTableRef?.value?.getTableList();
|
||||
getCategoryList();
|
||||
}
|
||||
};
|
||||
//删除
|
||||
@@ -183,7 +242,7 @@ const getCategoryDel = (id: any) => {
|
||||
if (result?.code === 0) {
|
||||
const { msg } = result;
|
||||
useMsg("success", msg);
|
||||
proTableRef?.value?.getTableList();
|
||||
getCategoryList();
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -200,7 +259,7 @@ const getCategorySort = async (row: any) => {
|
||||
const result = await getCategorySortApi({ id: row.id, sort: row.sort });
|
||||
useMsg("success", result?.msg);
|
||||
if (result?.code === 0) {
|
||||
proTableRef?.value?.getTableList();
|
||||
getCategoryList();
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
@@ -27,9 +27,9 @@ export const EDIT_FORM_DATA: FormItem[] = [
|
||||
},
|
||||
|
||||
{
|
||||
prop: "category_id",
|
||||
prop: "category_id1",
|
||||
placeholder: "请选择",
|
||||
type: "select",
|
||||
type: "treeSelect",
|
||||
label: "下载分类: ",
|
||||
options: []
|
||||
},
|
||||
@@ -55,6 +55,22 @@ export const EDIT_FORM_DATA: FormItem[] = [
|
||||
}
|
||||
]
|
||||
},
|
||||
// {
|
||||
// prop: "is_show1",
|
||||
// placeholder: "",
|
||||
// type: "radio",
|
||||
// label: "是否启动: ",
|
||||
// options: [
|
||||
// {
|
||||
// label: "是",
|
||||
// value: 1
|
||||
// },
|
||||
// {
|
||||
// label: "否",
|
||||
// value: 0
|
||||
// }
|
||||
// ]
|
||||
// },
|
||||
{
|
||||
prop: "image",
|
||||
type: "upImg",
|
||||
@@ -106,6 +122,8 @@ export const EDIT_TABLE_DATA = [
|
||||
file_ext: "" //文件格式
|
||||
}
|
||||
];
|
||||
export const EDIT_RULE_FORM = {};
|
||||
export const EDIT_RULE_FORM = {
|
||||
sort: 1
|
||||
};
|
||||
// editRuleForm: {},
|
||||
//editFormData: [],
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
export const RULES = {
|
||||
name: [{ required: true, message: "下载名称不能为空 ! ", trigger: "blur" }],
|
||||
category_id: [{ required: true, message: "下载分类不能为空 ! ", trigger: "blur" }],
|
||||
category_id1: [{ required: true, message: "下载分类不能为空 ! ", trigger: "blur" }],
|
||||
sort: [{ required: true, message: "下载排序不能为空 ! ", trigger: "blur" }]
|
||||
};
|
||||
|
||||
@@ -27,7 +27,7 @@ export const FORM_DATA: FormItem[] = [
|
||||
{
|
||||
prop: "category_id",
|
||||
placeholder: "请选择",
|
||||
type: "select",
|
||||
type: "treeSelect",
|
||||
isArray: true,
|
||||
label: "下载分类: ",
|
||||
options: []
|
||||
|
||||
@@ -48,12 +48,12 @@ export const COLUMNS = [
|
||||
prop: "created_at"
|
||||
},
|
||||
|
||||
{
|
||||
align: "center",
|
||||
label: "状态",
|
||||
prop: "status",
|
||||
width: 80
|
||||
},
|
||||
// {
|
||||
// align: "center",
|
||||
// label: "状态",
|
||||
// prop: "status",
|
||||
// width: 80
|
||||
// },
|
||||
|
||||
{ prop: "operation", label: "操作", fixed: "right", width: 200 }
|
||||
];
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
:formData="dataStore.editFormData"
|
||||
:rules="dataStore.rules"
|
||||
ref="formRef"
|
||||
@handleSelectChangeEmits="handleSelectChangeEmits"
|
||||
>
|
||||
<el-button type="primary" size="small" style="margin-bottom: 10px" @click="handleEditAdd">添加行</el-button>
|
||||
<FormTable :columns="dataStore.editColumns" :tableData="dataStore.editTableData" :height="200">
|
||||
@@ -228,24 +229,43 @@ const getAttachmentRead = async () => {
|
||||
if (result?.code === 0) {
|
||||
dataStore.editRuleForm = result?.data;
|
||||
dataStore.editTableData = result?.data.attach;
|
||||
|
||||
let is = dataStore.editFormData[1].options.some((item: any) => {
|
||||
console.log(item.id);
|
||||
console.log(dataStore.editRuleForm.category_id);
|
||||
return item.value == dataStore.editRuleForm.category_id;
|
||||
});
|
||||
dataStore.editRuleForm.category_id1 = is ? dataStore.editRuleForm.category_id : dataStore.editRuleForm.category_name;
|
||||
}
|
||||
};
|
||||
getAttachmentRead();
|
||||
const handleSelectChangeEmits = (value: any) => {
|
||||
if (value.prop === "category_id1") {
|
||||
dataStore.editRuleForm.category_id = value.id;
|
||||
}
|
||||
};
|
||||
|
||||
const addLabelValue = (arr: any) => {
|
||||
return arr.map((item: any) => {
|
||||
// 为当前对象添加 label 和 value 属性
|
||||
const newItem = { ...item };
|
||||
newItem.label = newItem.name;
|
||||
newItem.value = newItem.id;
|
||||
|
||||
// 如果有子对象,递归调用 addLabelValue 处理子对象
|
||||
if (newItem.children && Array.isArray(newItem.children)) {
|
||||
newItem.children = addLabelValue(newItem.children);
|
||||
}
|
||||
return newItem;
|
||||
});
|
||||
};
|
||||
|
||||
//分类
|
||||
const getCategorys = async () => {
|
||||
const result = await getCategorysApi();
|
||||
const result = await getCategorysApi({ is_show: 1 });
|
||||
|
||||
if (result?.code === 0) {
|
||||
let arr: any[] = [];
|
||||
result?.data?.forEach((item: any) => {
|
||||
let obj = {
|
||||
value: item.id,
|
||||
label: item.name
|
||||
};
|
||||
arr.push(obj);
|
||||
});
|
||||
dataStore.editFormData[1].options = arr;
|
||||
dataStore.editFormData[1].options = addLabelValue(result?.data);
|
||||
}
|
||||
};
|
||||
getCategorys();
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
:init-param="dataStore.initParam"
|
||||
>
|
||||
<template #image="scope">
|
||||
<el-image :src="h + scope.row.image" style="width: 60px; height: 60px" />
|
||||
<el-image :src="scope.row.image ? h + scope.row.image : ''" style="width: 60px; height: 60px" />
|
||||
</template>
|
||||
<template #status="scope">
|
||||
<el-tag :type="scope.row.status === 1 ? 'success' : 'danger'" effect="dark">{{
|
||||
@@ -49,7 +49,7 @@ const proTableRef = ref<any>(null);
|
||||
const $router = useRouter();
|
||||
|
||||
//图片地址
|
||||
const h = import.meta.env.VITE_APP_API_BASE_UPLOAD_URL;
|
||||
import { h } from "@/utils/url";
|
||||
// 数据源
|
||||
const dataStore = reactive<any>({
|
||||
editTableData: cloneDeep(EDIT_TABLE_DATA), //添加|编辑里的表格数据
|
||||
@@ -150,20 +150,36 @@ const handleBlur = (row: any) => {
|
||||
const handleInput = (row: any) => {
|
||||
row.sort = integerRexg(row.sort);
|
||||
};
|
||||
|
||||
const addLabelValue = (arr: any) => {
|
||||
return arr.map((item: any) => {
|
||||
// 为当前对象添加 label 和 value 属性
|
||||
const newItem = { ...item };
|
||||
newItem.label = newItem.name;
|
||||
newItem.value = newItem.id;
|
||||
|
||||
// 如果有子对象,递归调用 addLabelValue 处理子对象
|
||||
if (newItem.children && Array.isArray(newItem.children)) {
|
||||
newItem.children = addLabelValue(newItem.children);
|
||||
}
|
||||
return newItem;
|
||||
});
|
||||
};
|
||||
|
||||
const getCategorys = async () => {
|
||||
const result = await getCategorysApi();
|
||||
|
||||
if (result?.code === 0) {
|
||||
let arr: any[] = [];
|
||||
result?.data?.forEach((item: any) => {
|
||||
let obj = {
|
||||
value: item.id,
|
||||
label: item.name
|
||||
};
|
||||
arr.push(obj);
|
||||
});
|
||||
// let arr: any[] = [];
|
||||
// result?.data?.forEach((item: any) => {
|
||||
// let obj = {
|
||||
// value: item.id,
|
||||
// label: item.name
|
||||
// };
|
||||
// arr.push(obj);
|
||||
// });
|
||||
|
||||
dataStore.formData[1].options = arr;
|
||||
dataStore.formData[1].options = addLabelValue(result?.data);
|
||||
}
|
||||
};
|
||||
getCategorys();
|
||||
|
||||
@@ -49,12 +49,12 @@ export const COLUMNS = [
|
||||
prop: "created_at"
|
||||
},
|
||||
|
||||
{
|
||||
align: "center",
|
||||
label: "状态",
|
||||
prop: "status",
|
||||
width: 80
|
||||
},
|
||||
// {
|
||||
// align: "center",
|
||||
// label: "状态",
|
||||
// prop: "status",
|
||||
// width: 80
|
||||
// },
|
||||
|
||||
{ prop: "operation", label: "操作", fixed: "right", width: 200 }
|
||||
];
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
:init-param="dataStore.initParam"
|
||||
>
|
||||
<template #image="scope">
|
||||
<el-image :src="h + scope.row.image" style="width: 60px; height: 60px" />
|
||||
<el-image :src="scope.row.image ? h + scope.row.image : ''" style="width: 60px; height: 60px" />
|
||||
</template>
|
||||
<template #status="scope">
|
||||
<el-tag type="danger" effect="dark">{{ scope.row.status ? "删除" : "删除" }}</el-tag>
|
||||
@@ -37,7 +37,7 @@ import { RULE_FORM, FORM_DATA, COLUMNS } from "./constant/index";
|
||||
// 获取 ProTable 元素,调用其获取刷新数据方法(还能获取到当前查询参数,方便导出携带参数)
|
||||
const proTableRef = ref<any>(null);
|
||||
//图片地址
|
||||
const h = import.meta.env.VITE_APP_API_BASE_UPLOAD_URL;
|
||||
import { h } from "@/utils/url";
|
||||
// 数据源
|
||||
const dataStore = reactive<any>({
|
||||
columns: COLUMNS, //列表配置项
|
||||
@@ -47,7 +47,7 @@ const dataStore = reactive<any>({
|
||||
});
|
||||
//分类列表
|
||||
const getCategorys = async () => {
|
||||
const result = await getCategorysApi();
|
||||
const result = await getCategorysApi({ is_show: 0 });
|
||||
|
||||
if (result?.code === 0) {
|
||||
let arr: any[] = [];
|
||||
|
||||
@@ -40,7 +40,10 @@ const handleExport = () => {
|
||||
};
|
||||
//导出
|
||||
const getMenusLisExport = async () => {
|
||||
const result = await getAgentListExportApi(dataStore.ruleForm);
|
||||
const result = await getAgentListExportApi({
|
||||
...proTableRef?.value?.searchParam,
|
||||
...proTableRef?.value?.pageable
|
||||
});
|
||||
await useExport(result);
|
||||
};
|
||||
const getAgentTypesList = async () => {
|
||||
|
||||
@@ -40,7 +40,10 @@ const handleExport = () => {
|
||||
};
|
||||
//导出
|
||||
const getMenusLisExport = async () => {
|
||||
const result = await getLeaveMsgListExportApi(dataStore.ruleForm);
|
||||
const result = await getLeaveMsgListExportApi({
|
||||
...proTableRef?.value?.searchParam,
|
||||
...proTableRef?.value?.pageable
|
||||
});
|
||||
await useExport(result);
|
||||
};
|
||||
</script>
|
||||
|
||||
@@ -14,10 +14,10 @@
|
||||
|
||||
<script setup lang="ts" name="feedbackProductIndex">
|
||||
import ProTable from "@/components/ProTable/index.vue";
|
||||
|
||||
// const $router = useRouter();
|
||||
//列表接口
|
||||
import { getProductListApi } from "@/api/modules/product";
|
||||
// import { getCountryListApi } from "@/api/modules/global";
|
||||
|
||||
// import { useUserStore } from "@/stores/modules/user";
|
||||
// const userStore: any = useUserStore();
|
||||
//深拷贝方法
|
||||
@@ -32,36 +32,15 @@ const dataStore = reactive<any>({
|
||||
initParam: cloneDeep(RULE_FORM), // 初始化搜索条件|重置搜索条件
|
||||
ruleForm: cloneDeep(RULE_FORM), // 搜索參數
|
||||
formData: FORM_DATA //搜索配置项
|
||||
// ZH: [],
|
||||
// EN: []
|
||||
});
|
||||
|
||||
// const getCountryList = async () => {
|
||||
// const result = await getCountryListApi();
|
||||
|
||||
// if (result?.code === 0) {
|
||||
// dataStore.ZH = [];
|
||||
// dataStore.EN = [];
|
||||
// result?.data.forEach((item: any) => {
|
||||
// dataStore.ZH.push({
|
||||
// label: item.name,
|
||||
// value: item.id
|
||||
// });
|
||||
// dataStore.EN.push({
|
||||
// label: item.name,
|
||||
// value: item.id
|
||||
// });
|
||||
// });
|
||||
// dataStore.formData[1].options = userStore.languageType === 1 ? dataStore.ZH : dataStore.EN;
|
||||
// }
|
||||
// };
|
||||
// getCountryList();
|
||||
// watch(
|
||||
// () => userStore.languageType,
|
||||
// (newVal: any) => {
|
||||
// dataStore.formData[1].options = newVal === 1 ? dataStore.ZH : dataStore.EN;
|
||||
// },
|
||||
// { deep: true, immediate: true }
|
||||
// console.log(newVal, "=======newVal=======");
|
||||
// // window.location.reload();
|
||||
// $router.go(0);
|
||||
// }
|
||||
// );
|
||||
</script>
|
||||
|
||||
|
||||
@@ -19,6 +19,8 @@
|
||||
<script setup lang="ts" name="feedbackContactIndex">
|
||||
import ProTable from "@/components/ProTable/index.vue";
|
||||
import { useExport } from "@/hooks/useExport";
|
||||
// import { useUserStore } from "@/stores/modules/user";
|
||||
// const userStore: any = useUserStore();
|
||||
//列表接口
|
||||
import { getBPListExportApi, getBPListApi, getBPInterestedListApi } from "@/api/modules/purchase";
|
||||
//深拷贝方法
|
||||
@@ -40,7 +42,10 @@ const handleExport = () => {
|
||||
};
|
||||
//导出
|
||||
const getBPListExport = async () => {
|
||||
const result = await getBPListExportApi(dataStore.ruleForm);
|
||||
const result = await getBPListExportApi({
|
||||
...proTableRef?.value?.searchParam,
|
||||
...proTableRef?.value?.pageable
|
||||
});
|
||||
await useExport(result);
|
||||
};
|
||||
//
|
||||
@@ -55,10 +60,18 @@ const getBPInterestedList = async () => {
|
||||
});
|
||||
});
|
||||
dataStore.formData[1].options = arr;
|
||||
console.log(result?.data, "=======data========");
|
||||
}
|
||||
};
|
||||
getBPInterestedList();
|
||||
// watch(
|
||||
// () => userStore.languageType,
|
||||
// (newVal: any) => {
|
||||
// console.log(newVal);
|
||||
|
||||
// getBPInterestedList();
|
||||
// },
|
||||
// { deep: true, immediate: true }
|
||||
// );
|
||||
</script>
|
||||
|
||||
<style scoped></style>
|
||||
|
||||
@@ -268,7 +268,7 @@ const setUserData = (data: any) => {
|
||||
const { username, uid, token, avatar } = data;
|
||||
console.log();
|
||||
// 设置token
|
||||
userStore.setToken(token);
|
||||
userStore.setToken("Bearer" + " " + token);
|
||||
userStore.setUid(uid);
|
||||
userStore.setNickname(username);
|
||||
userStore.setAvatar(avatar);
|
||||
|
||||
@@ -105,6 +105,10 @@ const getProductAttrUp = async () => {
|
||||
if (obj.prop_name) {
|
||||
dataStore.editRuleForm.props.push(obj);
|
||||
}
|
||||
|
||||
let dataClone = cloneDeep(dataStore.editRuleForm.props);
|
||||
let props = JSON.stringify([...dataClone]);
|
||||
dataStore.editRuleForm.props = props;
|
||||
const result = await getProductAttrUpApi(dataStore.editRuleForm);
|
||||
if (result?.code === 0) {
|
||||
useMsg("success", result?.msg);
|
||||
|
||||
@@ -154,7 +154,10 @@ const getArticleCategorySave = async (params: any) => {
|
||||
};
|
||||
|
||||
const handleSelectChangeEmits = (value: any) => {
|
||||
dataStore.ruleForm.pid = value.id;
|
||||
console.log(value, "===============value1111111============");
|
||||
if (value.prop === "pid") {
|
||||
dataStore.ruleForm.pid = value.id;
|
||||
}
|
||||
};
|
||||
const handleTreesSelectChangeEmits = (value: any) => {
|
||||
console.log(value, "=========value=========");
|
||||
|
||||
@@ -14,9 +14,6 @@
|
||||
:request-api="getProductBuypassListApi"
|
||||
:init-param="dataStore.initParam"
|
||||
>
|
||||
<template #imgUrl="scope">
|
||||
<el-image :src="scope.row.imgUrl" style="width: 60px; height: 60px" />
|
||||
</template>
|
||||
<template #status="scope">
|
||||
<el-tag type="success" effect="dark">{{ scope.row.status }}</el-tag>
|
||||
</template>
|
||||
@@ -63,6 +60,7 @@ import { useUserStore } from "@/stores/modules/user";
|
||||
//列表接口
|
||||
// getProductBuypassListImportApi
|
||||
import {
|
||||
getProductBuypassListSaveApi,
|
||||
getProductBuypassListApi,
|
||||
getProductPlatformsListApi,
|
||||
getProductBuypassListExportApi,
|
||||
@@ -92,53 +90,24 @@ const dataStore = reactive<any>({
|
||||
ruleForm: cloneDeep(RULE_FORM), // 搜索參數
|
||||
formData: FORM_DATA //搜索配置项
|
||||
});
|
||||
|
||||
//添加
|
||||
const getProductBuypassListSave = async (params: any) => {
|
||||
const result = await getProductBuypassListSaveApi(params);
|
||||
if (result?.code === 0) {
|
||||
useMsg("success", result?.msg);
|
||||
// proTableRef?.value?.getTableList();
|
||||
// console.log(result?.data);
|
||||
}
|
||||
};
|
||||
//更新
|
||||
const getProductBuypassUpdate = async (params: any) => {
|
||||
const result = await getProductBuypassUpdateApi(params);
|
||||
if (result?.code === 0) {
|
||||
console.log(result?.data);
|
||||
} else {
|
||||
useMsg("success", result?.msg);
|
||||
// console.log(result?.data);
|
||||
}
|
||||
};
|
||||
// const handleChange=()=>{
|
||||
|
||||
// }
|
||||
|
||||
// const up=(it: any, scope: any, itIndex: any)=>{
|
||||
// const { link, platform_name, link_id } = it;
|
||||
// let is = scope.row.rowspan.some((item: any, index: number) => {
|
||||
// if (index !== itIndex && item.platform_name === platform_name) {
|
||||
// return true;
|
||||
// }
|
||||
// });
|
||||
// if (is) {
|
||||
// useMsg("warning", "同型号平台不能重复 !");
|
||||
// return;
|
||||
// }
|
||||
// if (!platform_name) {
|
||||
// useMsg("warning", "平台不能为空 !");
|
||||
// return;
|
||||
// }
|
||||
// if (!link) {
|
||||
// useMsg("warning", "链接不能为空 !");
|
||||
// return;
|
||||
// }
|
||||
// //获取ID
|
||||
// let platform_id: any = null;
|
||||
// dataStore.options.forEach((item: any) => {
|
||||
// if (item.platform === platform_name) {
|
||||
// platform_id = item.id;
|
||||
// }
|
||||
// });
|
||||
// getProductBuypassUpdate({
|
||||
// id: link_id,
|
||||
// param: {
|
||||
// platform_id,
|
||||
// link
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
//输入框失焦
|
||||
const handleInputOrChange = (it: any, scope: any, itIndex: any) => {
|
||||
const { link, platform_name, link_id } = it;
|
||||
@@ -166,13 +135,24 @@ const handleInputOrChange = (it: any, scope: any, itIndex: any) => {
|
||||
platform_id = item.id;
|
||||
}
|
||||
});
|
||||
getProductBuypassUpdate({
|
||||
id: link_id,
|
||||
param: {
|
||||
|
||||
//添加
|
||||
if (!link_id) {
|
||||
getProductBuypassListSave({
|
||||
product_id: scope.row.id,
|
||||
platform_id,
|
||||
link
|
||||
}
|
||||
});
|
||||
});
|
||||
} else {
|
||||
// 更新
|
||||
getProductBuypassUpdate({
|
||||
id: link_id,
|
||||
param: {
|
||||
platform_id,
|
||||
link
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
//平台
|
||||
const getProductPlatformsList = async () => {
|
||||
@@ -195,7 +175,10 @@ const handleExport = () => {
|
||||
|
||||
//导出接口
|
||||
const getProductBuypassListExport = async () => {
|
||||
const result = await getProductBuypassListExportApi(dataStore.ruleForm);
|
||||
const result = await getProductBuypassListExportApi({
|
||||
...proTableRef?.value?.searchParam,
|
||||
...proTableRef?.value?.pageable
|
||||
});
|
||||
await useExport(result);
|
||||
};
|
||||
|
||||
|
||||
@@ -16,16 +16,22 @@
|
||||
|
||||
<el-tree-select
|
||||
clearable
|
||||
v-model="_ruleFormParam.category_id"
|
||||
v-model="_ruleFormParam.category_id1"
|
||||
:data="options"
|
||||
:render-after-expand="false"
|
||||
show-checkbox
|
||||
check-strictly
|
||||
@change="handleTreeChange()"
|
||||
/>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="产品参数">
|
||||
<el-input v-model="_ruleFormParam.params" style="width: 440px" />
|
||||
<el-input
|
||||
v-model="_ruleFormParam.params"
|
||||
style="width: 440px"
|
||||
type="textarea"
|
||||
:autosize="{ minRows: 10, maxRows: 20 }"
|
||||
/>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="产品排序" style="width: 440px" required>
|
||||
@@ -35,7 +41,7 @@
|
||||
:min="1"
|
||||
:max="9999"
|
||||
:controls="true"
|
||||
v-model.trim="_ruleFormParam.sort"
|
||||
v-model="_ruleFormParam.sort"
|
||||
step-strictly
|
||||
:step="1"
|
||||
controls-position="right"
|
||||
@@ -53,17 +59,22 @@
|
||||
<el-radio :value="0" :label="0">否</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="是否推荐" style="width: 440px">
|
||||
<el-form-item label="热门" style="width: 440px">
|
||||
<el-radio-group v-model="_ruleFormParam.is_hot">
|
||||
<el-radio :value="1" :label="1">是</el-radio>
|
||||
<el-radio :value="0" :label="0">否</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
|
||||
<!-- <el-form-item label="是否启用" style="width: 440px">
|
||||
<el-radio-group v-model="_ruleFormParam.status">
|
||||
<el-radio :value="1" :label="1">是</el-radio>
|
||||
<el-radio :value="0" :label="0">否</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item> -->
|
||||
<el-form-item label="SEO标题">
|
||||
<el-input v-model="_ruleFormParam.seo_title" style="width: 440px" />
|
||||
</el-form-item>
|
||||
<el-form-item label="SEO关键字">
|
||||
<el-form-item label="SEO关键词">
|
||||
<el-input v-model="_ruleFormParam.seo_keywords" style="width: 440px" />
|
||||
</el-form-item>
|
||||
<el-form-item label="SEO描述">
|
||||
@@ -90,6 +101,11 @@ const reset = () => {
|
||||
};
|
||||
|
||||
let _ruleFormParam: any = computed(() => props.data);
|
||||
|
||||
const handleTreeChange = () => {
|
||||
_ruleFormParam.value.category_id = _ruleFormParam.value.category_id1;
|
||||
};
|
||||
|
||||
// 暴露给父组件的参数和方法(外部需要什么,都可以从这里暴露出去)
|
||||
defineExpose({
|
||||
ruleForm: _ruleFormParam,
|
||||
|
||||
@@ -108,6 +108,24 @@ export const BASIC_INFO_FORM_DATA: FormItem[] = [
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
// {
|
||||
// prop: "is_show1",
|
||||
// placeholder: "",
|
||||
// type: "radio",
|
||||
// label: "是否启用: ",
|
||||
// options: [
|
||||
// {
|
||||
// label: "是",
|
||||
// value: 1
|
||||
// },
|
||||
// {
|
||||
// label: "否",
|
||||
// value: -1
|
||||
// }
|
||||
// ]
|
||||
// },
|
||||
|
||||
{
|
||||
prop: "seo_title",
|
||||
placeholder: "请输入",
|
||||
@@ -118,7 +136,7 @@ export const BASIC_INFO_FORM_DATA: FormItem[] = [
|
||||
prop: "seo_keyword",
|
||||
placeholder: "请输入",
|
||||
type: "input",
|
||||
label: "SEO关键字: "
|
||||
label: "SEO关键词: "
|
||||
},
|
||||
{
|
||||
prop: "seo_desc",
|
||||
|
||||
@@ -14,12 +14,12 @@
|
||||
<el-tab-pane label="图片信息" name="imgInfo">
|
||||
<imgInfo :imgInfoData="dataStore.imgInfoData" ref="imgInfoRef" :attrList="dataStore.attrList" />
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="详细内容" name="third">
|
||||
<el-tab-pane label="产品详情" name="third">
|
||||
<div style="width: 1280px; margin: 0 auto">
|
||||
<WangEditor v-model:value="dataStore.detail" />
|
||||
</div>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="相关信息及下载" name="related">
|
||||
<el-tab-pane label="相关信息" name="related">
|
||||
<!-- <related ref="relatedRef" :data="dataStore.related" /> -->
|
||||
<div style="margin-bottom: 16px">
|
||||
<el-button type="primary" size="small" @click="handleRelatedAdd()">添加行</el-button>
|
||||
@@ -43,8 +43,13 @@
|
||||
<script setup lang="ts" name="productEditIndex">
|
||||
import { ref, reactive } from "vue";
|
||||
//getProductAttrsApi
|
||||
import { getProductDetailsApi, getProductListApi, getProductAttrsListApi } from "@/api/modules/productList";
|
||||
import { getProductCategoryListApi } from "@/api/modules/productClass";
|
||||
import {
|
||||
getProductDetailsApi,
|
||||
getProductListApi,
|
||||
getProductAttrsListApi,
|
||||
getProductCategoryListApi
|
||||
} from "@/api/modules/productList";
|
||||
// import { getProductCategoryListApi } from "@/api/modules/productClass";
|
||||
import { RELATED_INFO_COLUMNS } from "./constant/related";
|
||||
import { cloneDeep, debounce } from "lodash-es";
|
||||
import { messageBox } from "@/utils/messageBox";
|
||||
@@ -123,7 +128,7 @@ const getProductList = async (query: any) => {
|
||||
|
||||
//产品分类(后端大佬说直接掉列表接口)
|
||||
const getProductCategoryList = async () => {
|
||||
const result = await getProductCategoryListApi({ page: 1, size: 500 });
|
||||
const result = await getProductCategoryListApi({ is_show: 1 });
|
||||
if (result?.code === 0) {
|
||||
let dataClone: any = cloneDeep(result?.data);
|
||||
dataStore.options = addLabelValue(dataClone);
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
:init-param="dataStore.initParam"
|
||||
>
|
||||
<template #cover_image="scope">
|
||||
<el-image :src="h + scope.row.cover_image" style="width: 60px; height: 60px" />
|
||||
<el-image :src="scope.row.cover_image ? h + scope.row.cover_image : ''" style="width: 60px; height: 60px" />
|
||||
</template>
|
||||
<template #status="scope">
|
||||
<el-tag effect="dark" :type="scope.row.status === 1 ? 'success' : 'danger'">{{
|
||||
@@ -52,16 +52,17 @@ import ProTable from "@/components/ProTable/index.vue";
|
||||
import { integerRexg } from "@/utils/regexp/index";
|
||||
import { useMsg } from "@/hooks/useMsg";
|
||||
import { useExport } from "@/hooks/useExport";
|
||||
const h = import.meta.env.VITE_APP_API_BASE_UPLOAD_URL;
|
||||
import { h } from "@/utils/url";
|
||||
//列表接口
|
||||
//getProductDelApi
|
||||
import {
|
||||
getProductListApi,
|
||||
getProductUpOrShelvesApi,
|
||||
getProductListSortApi,
|
||||
getProductListExportApi
|
||||
getProductListExportApi,
|
||||
getProductCategoryListApi
|
||||
} from "@/api/modules/productList";
|
||||
import { getProductCategoryListApi } from "@/api/modules/productClass";
|
||||
// import { getProductCategoryListApi } from "@/api/modules/productClass";
|
||||
import { addLabelValue } from "./utils/common/addLabelValue";
|
||||
|
||||
//深拷贝方法
|
||||
@@ -85,7 +86,10 @@ const handleExport = () => {
|
||||
};
|
||||
//导出接口
|
||||
const getProductListExport = async () => {
|
||||
const result = await getProductListExportApi(dataStore.ruleForm);
|
||||
const result = await getProductListExportApi({
|
||||
...proTableRef?.value?.searchParam,
|
||||
...proTableRef?.value?.pageable
|
||||
});
|
||||
await useExport(result);
|
||||
};
|
||||
//上下架
|
||||
@@ -109,7 +113,7 @@ const getProductListSort = async (row: any) => {
|
||||
|
||||
//产品分类(后端大佬说直接掉列表接口)
|
||||
const getProductCategoryList = async () => {
|
||||
const result = await getProductCategoryListApi({ page: 1, size: 500 });
|
||||
const result = await getProductCategoryListApi();
|
||||
if (result?.code === 0) {
|
||||
let dataClone: any = cloneDeep(result?.data);
|
||||
dataStore.formData[2].options = addLabelValue(dataClone);
|
||||
@@ -128,9 +132,6 @@ const handleInput = (row: any) => {
|
||||
|
||||
//按钮点击事件
|
||||
const handleBtnClick = (type: any, row: any) => {
|
||||
// if (type === "删除") {
|
||||
// // getProductDel(row.id);
|
||||
// }
|
||||
//添加SUK和删除暂时无法操作
|
||||
if (type == "添加SUK" || type === "删除") {
|
||||
return false;
|
||||
|
||||
@@ -1,13 +1,33 @@
|
||||
import { cloneDeep } from "lodash-es";
|
||||
|
||||
const hasIdRecursive = (data: any, targetId: any) => {
|
||||
for (let i = 0; i < data.length; i++) {
|
||||
const item = data[i];
|
||||
if (item.id === targetId) {
|
||||
return true;
|
||||
}
|
||||
if (item.children && item.children.length > 0) {
|
||||
if (hasIdRecursive(item.children, targetId)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
//将参数分离
|
||||
export const initDetailParams = (dataStore: any, data: any) => {
|
||||
let is = hasIdRecursive(dataStore.options, data.category_id);
|
||||
//基本信息
|
||||
dataStore.basicInfoRuleForm = cloneDeep({
|
||||
name: data.name,
|
||||
short_name: data.short_name,
|
||||
spu: data.spu,
|
||||
is: is,
|
||||
category_id1: is ? data.category_id : data.category_name,
|
||||
category_id: data.category_id,
|
||||
params: data.category_id,
|
||||
category_name: data.category_name,
|
||||
params: data.params,
|
||||
sort: data.sort,
|
||||
is_show: data.is_show,
|
||||
is_new: data.is_new,
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
:init-param="dataStore.initParam"
|
||||
>
|
||||
<template #image="scope">
|
||||
<el-image :src="h + scope.row.image" style="width: 60px; height: 60px" />
|
||||
<el-image :src="scope.row.image ? h + scope.row.image : ''" style="width: 60px; height: 60px" />
|
||||
</template>
|
||||
<template #status="scope">
|
||||
<el-tag type="danger" effect="dark"> {{ scope.row.status === 1 ? "删除" : "删除" }}</el-tag>
|
||||
@@ -26,7 +26,7 @@
|
||||
<script setup lang="ts" name="productRecycleIndex">
|
||||
import ProTable from "@/components/ProTable/index.vue";
|
||||
import { messageBox } from "@/utils/messageBox";
|
||||
const h = import.meta.env.VITE_APP_API_BASE_UPLOAD_URL;
|
||||
import { h } from "@/utils/url";
|
||||
//列表接口
|
||||
import { getProductTrashListApi, getProductTrashDelApi, getProductTrashRestoreApi } from "@/api/modules/productRecycle";
|
||||
//深拷贝方法
|
||||
|
||||
@@ -4,7 +4,6 @@ const YES_OR_NO: any = {
|
||||
0: "❌"
|
||||
};
|
||||
export const COLUMNS = [
|
||||
{ type: "selection", fixed: "left", width: 40 },
|
||||
{
|
||||
align: "center",
|
||||
fixed: true,
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
:init-param="dataStore.initParam"
|
||||
>
|
||||
<template #image="scope">
|
||||
<el-image :src="h + scope.row.image" style="width: 60px; height: 60px" />
|
||||
<el-image :src="scope.row.image ? h + scope.row.image : ''" style="width: 60px; height: 60px" />
|
||||
</template>
|
||||
<template #status="scope">
|
||||
<el-tag type="success" effect="dark">{{ scope.row.status }}</el-tag>
|
||||
@@ -72,7 +72,7 @@ import {
|
||||
} from "@/api/modules/videoClass";
|
||||
//深拷贝方法
|
||||
import { cloneDeep } from "lodash-es";
|
||||
const h = import.meta.env.VITE_APP_API_BASE_UPLOAD_URL;
|
||||
import { h } from "@/utils/url";
|
||||
//表格和搜索條件
|
||||
import { RULE_FORM, FORM_DATA, COLUMNS, EDIT_FORM_DATA, EDIT_RULE_FORM, RULES } from "./constant/index";
|
||||
// 获取 ProTable 元素,调用其获取刷新数据方法(还能获取到当前查询参数,方便导出携带参数)
|
||||
|
||||
@@ -26,7 +26,7 @@ export const EDIT_FORM_DATA: FormItem[] = [
|
||||
},
|
||||
|
||||
{
|
||||
prop: "category_id",
|
||||
prop: "category_id1",
|
||||
placeholder: "请选择",
|
||||
type: "select",
|
||||
label: "视频分类: ",
|
||||
@@ -54,6 +54,22 @@ export const EDIT_FORM_DATA: FormItem[] = [
|
||||
}
|
||||
]
|
||||
},
|
||||
// {
|
||||
// prop: "is_show1",
|
||||
// placeholder: "",
|
||||
// type: "radio",
|
||||
// label: "是否启动: ",
|
||||
// options: [
|
||||
// {
|
||||
// label: "是",
|
||||
// value: 1
|
||||
// },
|
||||
// {
|
||||
// label: "否",
|
||||
// value: 0
|
||||
// }
|
||||
// ]
|
||||
// },
|
||||
{
|
||||
prop: "desc",
|
||||
placeholder: "请输入",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
export const RULES = {
|
||||
name: [{ required: true, message: "视频名称不能为空 ! ", trigger: "blur" }],
|
||||
category_id: [{ required: true, message: "视频分类不能为空 ! ", trigger: "blur" }],
|
||||
category_id1: [{ required: true, message: "视频分类不能为空 ! ", trigger: "blur" }],
|
||||
sort: [{ required: true, message: "视频排序不能为空 ! ", trigger: "blur" }]
|
||||
};
|
||||
|
||||
@@ -48,12 +48,12 @@ export const COLUMNS = [
|
||||
prop: "created_at"
|
||||
},
|
||||
|
||||
{
|
||||
align: "center",
|
||||
label: "状态",
|
||||
prop: "status",
|
||||
width: 80
|
||||
},
|
||||
// {
|
||||
// align: "center",
|
||||
// label: "状态",
|
||||
// prop: "status",
|
||||
// width: 80
|
||||
// },
|
||||
|
||||
{ prop: "operation", label: "操作", fixed: "right", width: 200 }
|
||||
];
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
:init-param="dataStore.initParam"
|
||||
>
|
||||
<template #image="scope">
|
||||
<el-image :src="h + scope.row.image" style="width: 60px; height: 60px" />
|
||||
<el-image :src="scope.row.image ? h + scope.row.image : ''" style="width: 60px; height: 60px" />
|
||||
</template>
|
||||
<template #status="scope">
|
||||
<el-tag :type="scope.row.status === 1 ? 'success' : 'danger'" effect="dark">{{
|
||||
@@ -43,6 +43,7 @@
|
||||
:formData="dataStore.editFormData"
|
||||
:rules="dataStore.rules"
|
||||
ref="formRef"
|
||||
@handleSelectChangeEmits="handleSelectChangeEmits"
|
||||
>
|
||||
</rulesForm>
|
||||
</div>
|
||||
@@ -69,9 +70,10 @@ import {
|
||||
getVideoListDelApi,
|
||||
getVideoReadApi,
|
||||
getVideoUpdateApi,
|
||||
getVideoSaveApi
|
||||
getVideoSaveApi,
|
||||
getVideoClassListApi
|
||||
} from "@/api/modules/videoList";
|
||||
import { getVideoClassListApi } from "@/api/modules/videoClass";
|
||||
// import { getVideoClassListApi } from "@/api/modules/videoClass";
|
||||
//深拷贝方法
|
||||
import { cloneDeep } from "lodash-es";
|
||||
//表格和搜索條件
|
||||
@@ -81,7 +83,7 @@ import { useExport } from "@/hooks/useExport";
|
||||
const proTableRef = ref<any>(null);
|
||||
const formRef: any = ref(null);
|
||||
//图片地址
|
||||
const h = import.meta.env.VITE_APP_API_BASE_UPLOAD_URL;
|
||||
import { h } from "@/utils/url";
|
||||
// 数据源
|
||||
const dataStore = reactive<any>({
|
||||
title: "添加视频",
|
||||
@@ -124,22 +126,41 @@ const handleResetClick = () => {
|
||||
|
||||
//视频分类接口
|
||||
const getVideoClassList = async () => {
|
||||
const result = await getVideoClassListApi({ page: 1, size: 500 });
|
||||
const result = await getVideoClassListApi();
|
||||
if (result?.code === 0) {
|
||||
let arr: any[] = [];
|
||||
if (result?.data?.data?.length) {
|
||||
result?.data?.data?.forEach((item: any) => {
|
||||
if (result?.data?.length) {
|
||||
result?.data?.forEach((item: any) => {
|
||||
let obj = {
|
||||
value: item.id,
|
||||
label: item.name
|
||||
};
|
||||
arr.push(obj);
|
||||
});
|
||||
dataStore.formData[1].options = dataStore.editFormData[1].options = arr;
|
||||
dataStore.formData[1].options = arr;
|
||||
}
|
||||
}
|
||||
};
|
||||
getVideoClassList();
|
||||
|
||||
const getVideoClassEditList = async () => {
|
||||
const result = await getVideoClassListApi({ is_show: 1 });
|
||||
if (result?.code === 0) {
|
||||
let arr: any[] = [];
|
||||
if (result?.data?.length) {
|
||||
result?.data?.forEach((item: any) => {
|
||||
let obj = {
|
||||
value: item.id,
|
||||
label: item.name
|
||||
};
|
||||
arr.push(obj);
|
||||
});
|
||||
dataStore.editFormData[1].options = arr;
|
||||
}
|
||||
}
|
||||
};
|
||||
getVideoClassEditList();
|
||||
|
||||
//添加
|
||||
const handleAdd = () => {
|
||||
dataStore.visible = true;
|
||||
@@ -156,8 +177,22 @@ const getVideoRead = async (id: any) => {
|
||||
const result = await getVideoReadApi(id);
|
||||
if (result?.code === 0) {
|
||||
dataStore.editRuleForm = result?.data;
|
||||
let is = dataStore.editFormData[1].options.some((item: any) => {
|
||||
console.log(item.id);
|
||||
console.log(dataStore.editRuleForm.category_id);
|
||||
return item.value == dataStore.editRuleForm.category_id;
|
||||
});
|
||||
dataStore.editRuleForm.category_id1 = is ? dataStore.editRuleForm.category_id : dataStore.editRuleForm.category_name;
|
||||
}
|
||||
};
|
||||
|
||||
const handleSelectChangeEmits = (value: any) => {
|
||||
console.log(value, "========value=33========");
|
||||
if (value.prop === "category_id1") {
|
||||
dataStore.editRuleForm.category_id = value.id;
|
||||
}
|
||||
};
|
||||
|
||||
//保存
|
||||
const getVideoSave = async () => {
|
||||
const result = await getVideoSaveApi(dataStore.editRuleForm);
|
||||
@@ -166,6 +201,7 @@ const getVideoSave = async () => {
|
||||
useMsg("success", msg);
|
||||
dataStore.visible = false;
|
||||
dataStore.editRuleForm = cloneDeep(EDIT_RULE_FORM);
|
||||
proTableRef?.value?.getTableList();
|
||||
}
|
||||
};
|
||||
//更新
|
||||
@@ -176,11 +212,15 @@ const getVideoUpdate = async () => {
|
||||
useMsg("success", msg);
|
||||
dataStore.visible = false;
|
||||
dataStore.editRuleForm = cloneDeep(EDIT_RULE_FORM);
|
||||
proTableRef?.value?.getTableList();
|
||||
}
|
||||
};
|
||||
//导出接口
|
||||
const getProductListExport = async () => {
|
||||
const result = await getVideoListExportApi(dataStore.ruleForm);
|
||||
const result = await getVideoListExportApi({
|
||||
...proTableRef?.value?.searchParam,
|
||||
...proTableRef?.value?.pageable
|
||||
});
|
||||
await useExport(result);
|
||||
};
|
||||
//删除
|
||||
|
||||
@@ -49,12 +49,12 @@ export const COLUMNS = [
|
||||
prop: "created_at"
|
||||
},
|
||||
|
||||
{
|
||||
align: "center",
|
||||
label: "状态",
|
||||
prop: "status",
|
||||
width: 80
|
||||
},
|
||||
// {
|
||||
// align: "center",
|
||||
// label: "状态",
|
||||
// prop: "status",
|
||||
// width: 80
|
||||
// },
|
||||
|
||||
{ prop: "operation", label: "操作", fixed: "right", width: 200 }
|
||||
];
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
:init-param="dataStore.initParam"
|
||||
>
|
||||
<template #image="scope">
|
||||
<el-image :src="h + scope.row.image" style="width: 60px; height: 60px" />
|
||||
<el-image :src="scope.row.image ? h + scope.row.image : ''" style="width: 60px; height: 60px" />
|
||||
</template>
|
||||
|
||||
<template #status="scope">
|
||||
@@ -36,7 +36,7 @@ import { cloneDeep } from "lodash-es";
|
||||
//表格和搜索條件
|
||||
import { RULE_FORM, FORM_DATA, COLUMNS } from "./constant/index";
|
||||
//图片地址
|
||||
const h = import.meta.env.VITE_APP_API_BASE_UPLOAD_URL;
|
||||
import { h } from "@/utils/url";
|
||||
// 获取 ProTable 元素,调用其获取刷新数据方法(还能获取到当前查询参数,方便导出携带参数)
|
||||
const proTableRef = ref<any>(null);
|
||||
// 数据源
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
:init-param="dataStore.initParam"
|
||||
>
|
||||
<template #image="scope">
|
||||
<el-image :src="h + scope.row.image" style="width: 60px; height: 60px" />
|
||||
<el-image :src="scope.row.image ? h + scope.row.image : ''" style="width: 60px; height: 60px" />
|
||||
</template>
|
||||
<template #status="scope">
|
||||
<el-tag type="success" effect="dark">{{ scope.row.status }}</el-tag>
|
||||
@@ -57,7 +57,7 @@
|
||||
import rulesForm from "@/components/rulesForm/index.vue";
|
||||
import ProTable from "@/components/ProTable/index.vue";
|
||||
// import RecursiveForm from "./components/RecursiveForm";
|
||||
const h = import.meta.env.VITE_APP_API_BASE_UPLOAD_URL;
|
||||
import { h } from "@/utils/url";
|
||||
import { messageBox } from "@/utils/messageBox";
|
||||
import { useMsg } from "@/hooks/useMsg";
|
||||
//列表接口
|
||||
|
||||
@@ -292,7 +292,7 @@ const getMenusLisSave = async () => {
|
||||
};
|
||||
//导出
|
||||
const getMenusLisExport = async () => {
|
||||
const result = await getMenusLisExportApi(dataStore.ruleForm);
|
||||
const result = await getMenusLisExportApi(dataStore.searchParam);
|
||||
await useExport(result);
|
||||
};
|
||||
|
||||
@@ -321,8 +321,11 @@ const reset = () => {
|
||||
getMenusList();
|
||||
};
|
||||
const handleSelectChangeEmits = (value: any) => {
|
||||
dataStore.editRuleForm.pid = value.id;
|
||||
console.log(value, "==========value=========");
|
||||
if (value.prop === "pid") {
|
||||
dataStore.editRuleForm.pid = value.id;
|
||||
}
|
||||
|
||||
console.log(value, "==========value===323232======");
|
||||
};
|
||||
</script>
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@
|
||||
ref="formRef"
|
||||
@handleSelectChangeEmits="handleSelectChangeEmits"
|
||||
>
|
||||
<el-input v-model.trim="dataStore.editRuleForm.link" clearable style="width: 440px">
|
||||
<el-input v-model="dataStore.editRuleForm.link" clearable style="width: 440px">
|
||||
<template #append>
|
||||
<el-tree-select
|
||||
lazy
|
||||
@@ -129,6 +129,7 @@ const dataStore = reactive<any>({
|
||||
searchFormData: FORM_DATA, //搜索配置项
|
||||
visible: false,
|
||||
data: [],
|
||||
isFirstRequest: true,
|
||||
selectRow: {} //当前选择的row
|
||||
});
|
||||
const selectedNodes = ref(null);
|
||||
@@ -139,8 +140,8 @@ const treeProps = {
|
||||
label: "label",
|
||||
value: "value"
|
||||
};
|
||||
//用于判断模块地址请求是不是第一次
|
||||
let isFirstRequest = true;
|
||||
// //用于判断模块地址请求是不是第一次
|
||||
// let isFirstRequest = true;
|
||||
const buildTree = (data: any, outerLinkTo: any = "") => {
|
||||
return data.map((item: any) => {
|
||||
const { name, id, url, data: childData = [], children: nestedChildren = [] } = item;
|
||||
@@ -161,13 +162,13 @@ const buildTree = (data: any, outerLinkTo: any = "") => {
|
||||
};
|
||||
const getSystemUrls = async (node: any, resolve: any) => {
|
||||
//第一次请求
|
||||
if (isFirstRequest) {
|
||||
if (dataStore.isFirstRequest) {
|
||||
const result = await getSystemUrlsApi();
|
||||
if (result?.code === 0) {
|
||||
const children = buildTree(result?.data);
|
||||
dataStore.data = children;
|
||||
resolve(children);
|
||||
isFirstRequest = false;
|
||||
dataStore.isFirstRequest = false;
|
||||
}
|
||||
} else {
|
||||
//第二次请求
|
||||
@@ -208,6 +209,9 @@ const getItemsRead = async (id: any) => {
|
||||
dataStore.editRuleForm = result?.data;
|
||||
if (dataStore.editRuleForm.link && dataStore.editRuleForm.link_to) {
|
||||
let { id, name, link } = dataStore.editRuleForm.link_echo_data;
|
||||
if (!id || !name || !link) {
|
||||
return;
|
||||
}
|
||||
let obj: any = {
|
||||
label: name, // 确保这里的name是你想要显示的文本
|
||||
value: `${dataStore.editRuleForm.link_to}` + "/" + `${id}` + "/" + `${name}`,
|
||||
@@ -297,9 +301,14 @@ const getItemsSave = async () => {
|
||||
dataStore.visible = false;
|
||||
resetForm();
|
||||
getItemsList();
|
||||
dataStore.isFirstRequest = true;
|
||||
}
|
||||
};
|
||||
const handleSelectChangeEmits = (params: any) => {
|
||||
console.log("123232", params);
|
||||
if (params.prop === "nav_id") {
|
||||
return;
|
||||
}
|
||||
dataStore.editRuleForm.pid = params?.id;
|
||||
};
|
||||
//更新
|
||||
@@ -311,6 +320,7 @@ const getItemsListEditUp = async () => {
|
||||
dataStore.visible = false;
|
||||
resetForm();
|
||||
getItemsList();
|
||||
dataStore.isFirstRequest = true;
|
||||
}
|
||||
};
|
||||
//抽屉确认
|
||||
@@ -336,7 +346,6 @@ const handleResetClick = () => {
|
||||
if (dataStore.title === "编辑导航") {
|
||||
getItemsRead(dataStore.editRuleForm.id);
|
||||
} else {
|
||||
console.log("走到了这里");
|
||||
resetFields();
|
||||
}
|
||||
};
|
||||
@@ -353,6 +362,7 @@ const handleBeforeClone = () => {
|
||||
resetForm();
|
||||
resetFields();
|
||||
dataStore.visible = false;
|
||||
dataStore.isFirstRequest = true;
|
||||
};
|
||||
|
||||
const search = () => {
|
||||
@@ -362,6 +372,7 @@ const reset = () => {
|
||||
dataStore.searchParam.name = "";
|
||||
dataStore.searchParam.nav_id = "";
|
||||
dataStore.searchParam.Time = "";
|
||||
dataStore.searchParam.pid = "";
|
||||
getItemsList();
|
||||
};
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user