Compare commits
12 Commits
16bc099987
...
2f110d5e8d
Author | SHA1 | Date | |
---|---|---|---|
![]() |
2f110d5e8d | ||
![]() |
430553412c | ||
![]() |
ca02a903ce | ||
![]() |
91f4cd1487 | ||
![]() |
3ad716ba12 | ||
![]() |
027772c637 | ||
![]() |
c206a82e52 | ||
![]() |
71164b0cd5 | ||
![]() |
b525a67a09 | ||
![]() |
e3478d84bb | ||
![]() |
29db490914 | ||
![]() |
d0207e5a08 |
@ -50,14 +50,16 @@ const getVersion = computed(() => {
|
||||
// @ts-ignore
|
||||
if ((Local.get('version') && Local.get('version') !== __NEXT_VERSION__) || !Local.get('version')) isVersion = true;
|
||||
}
|
||||
return isVersion;
|
||||
// return isVersion;
|
||||
return false;
|
||||
});
|
||||
// 隐藏广告
|
||||
const hideSponsors = computed(() => {
|
||||
const path = route.path;
|
||||
console.log(path === '/login' || path === '/article/content');
|
||||
|
||||
return path === '/login' || path === '/article/content';
|
||||
// return path === '/login' || path === '/article/content';
|
||||
return true;
|
||||
});
|
||||
// 获取全局组件大小
|
||||
const getGlobalComponentSize = computed(() => {
|
||||
|
23
src/api/download/index.ts
Normal file
23
src/api/download/index.ts
Normal file
@ -0,0 +1,23 @@
|
||||
import axios from "axios";
|
||||
|
||||
const downloadPhoto = (imgSrc:any) => {
|
||||
axios({
|
||||
url: imgSrc,
|
||||
method: 'get',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
responseType: 'blob',
|
||||
}).then(res => {
|
||||
const url = window.URL.createObjectURL(res.data);
|
||||
const a = document.createElement('a');
|
||||
a.href = url;
|
||||
a.download = '下载图片.jpg';
|
||||
document.body.appendChild(a);
|
||||
a.click();
|
||||
document.body.removeChild(a);
|
||||
window.URL.revokeObjectURL(url);
|
||||
}).catch(error => {
|
||||
console.error('Download error:', error);
|
||||
});
|
||||
};
|
||||
|
||||
export { downloadPhoto };
|
@ -26,6 +26,13 @@ export function labelApi() {
|
||||
return request({
|
||||
url: baseUrlHost + '/cpLabel',
|
||||
method: 'get',
|
||||
params,
|
||||
});
|
||||
},
|
||||
getLabelListAll: (params: object) => {
|
||||
return request({
|
||||
url: baseUrlHost + '/cpLabel/all',
|
||||
method: 'get',
|
||||
params,
|
||||
});
|
||||
},
|
||||
|
51
src/api/role/index.ts
Normal file
51
src/api/role/index.ts
Normal file
@ -0,0 +1,51 @@
|
||||
import request from '/@/utils/request';
|
||||
import { baseUrlHost } from '../baseUrlHost';
|
||||
|
||||
/**
|
||||
* (不建议写成 request.post(xxx),因为这样 post 时,无法 params 与 data 同时传参)
|
||||
* 注意在写get请求时,参数是params,而不是data,要标注好
|
||||
*
|
||||
* 登录api接口集合
|
||||
* @method getRoleList 获取角色列表
|
||||
* @method deleteRole 删除角色
|
||||
* @method saveRole 保存角色
|
||||
* @method updateRole 更新角色
|
||||
* @method getRoleDetail 查询单个角色
|
||||
*/
|
||||
|
||||
export function RoleApi() {
|
||||
return {
|
||||
getRoleList: () => {
|
||||
return request({
|
||||
url: baseUrlHost + '/acGroup',
|
||||
method: 'get',
|
||||
});
|
||||
},
|
||||
deleteRole: (id: Number) => {
|
||||
return request({
|
||||
url: baseUrlHost + `/acGroup/${id}`,
|
||||
method: 'delete',
|
||||
});
|
||||
},
|
||||
getRoleDetail: (id: Number) => {
|
||||
return request({
|
||||
url: baseUrlHost + `/acGroup/${id}`,
|
||||
method: 'get',
|
||||
});
|
||||
},
|
||||
saveRole: (data: object) => {
|
||||
return request({
|
||||
url: baseUrlHost + '/acGroup',
|
||||
method: 'post',
|
||||
data,
|
||||
})
|
||||
},
|
||||
updateRole: (data: object) => {
|
||||
return request({
|
||||
url: baseUrlHost + '/acGroup',
|
||||
method: 'put',
|
||||
data,
|
||||
})
|
||||
},
|
||||
};
|
||||
}
|
BIN
src/assets/图片2.png
Normal file
BIN
src/assets/图片2.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 209 KiB |
BIN
src/assets/头像.png
Normal file
BIN
src/assets/头像.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 83 KiB |
@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<div class="layout-logo" v-if="setShowLogo" @click="onThemeConfigChange">
|
||||
<img :src="themeConfig.logoMini||logoMini" class="layout-logo-medium-img" />
|
||||
<span>{{ themeConfig.globalTitle }}</span>
|
||||
<!-- <span>{{ themeConfig.globalTitle }}</span> -->
|
||||
</div>
|
||||
<div class="layout-logo-size" v-else @click="onThemeConfigChange">
|
||||
<img :src="themeConfig.logoMini||logoMini" class="layout-logo-size-img" />
|
||||
|
@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<div class="layout-navbars-breadcrumb-user pr15" :style="{ flex: layoutUserFlexNum }">
|
||||
<el-dropdown :show-timeout="70" :hide-timeout="50" trigger="click" @command="onComponentSizeChange">
|
||||
<!-- <el-dropdown :show-timeout="70" :hide-timeout="50" trigger="click" @command="onComponentSizeChange">
|
||||
<div class="layout-navbars-breadcrumb-user-icon">
|
||||
<i class="iconfont icon-ziti" :title="$t('message.user.title0')"></i>
|
||||
</div>
|
||||
@ -11,8 +11,8 @@
|
||||
<el-dropdown-item command="small" :disabled="state.disabledSize === 'small'">{{ $t('message.user.dropdownSmall') }}</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</template>
|
||||
</el-dropdown>
|
||||
<el-dropdown :show-timeout="70" :hide-timeout="50" trigger="click" @command="onLanguageChange">
|
||||
</el-dropdown> -->
|
||||
<!-- <el-dropdown :show-timeout="70" :hide-timeout="50" trigger="click" @command="onLanguageChange">
|
||||
<div class="layout-navbars-breadcrumb-user-icon">
|
||||
<i
|
||||
class="iconfont"
|
||||
@ -27,22 +27,22 @@
|
||||
<el-dropdown-item command="zh-tw" :disabled="state.disabledI18n === 'zh-tw'">繁體中文</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</template>
|
||||
</el-dropdown>
|
||||
<div class="layout-navbars-breadcrumb-user-icon" @click="onSearchClick">
|
||||
</el-dropdown> -->
|
||||
<!-- <div class="layout-navbars-breadcrumb-user-icon" @click="onSearchClick">
|
||||
<el-icon :title="$t('message.user.title2')">
|
||||
<ele-Search />
|
||||
</el-icon>
|
||||
</div>
|
||||
<div class="layout-navbars-breadcrumb-user-icon" @click="onLayoutSetingClick">
|
||||
</div> -->
|
||||
<!-- <div class="layout-navbars-breadcrumb-user-icon" @click="onLayoutSetingClick">
|
||||
<i class="icon-skin iconfont" :title="$t('message.user.title3')"></i>
|
||||
</div>
|
||||
<div class="layout-navbars-breadcrumb-user-icon" ref="userNewsBadgeRef" v-click-outside="onUserNewsClick">
|
||||
</div> -->
|
||||
<!-- <div class="layout-navbars-breadcrumb-user-icon" ref="userNewsBadgeRef" v-click-outside="onUserNewsClick">
|
||||
<el-badge :is-dot="true">
|
||||
<el-icon :title="$t('message.user.title4')">
|
||||
<ele-Bell />
|
||||
</el-icon>
|
||||
</el-badge>
|
||||
</div>
|
||||
</div> -->
|
||||
<el-popover
|
||||
ref="userNewsRef"
|
||||
:virtual-ref="userNewsBadgeRef"
|
||||
|
@ -1,6 +1,8 @@
|
||||
import { defineStore } from 'pinia';
|
||||
import Cookies from 'js-cookie';
|
||||
import { Session } from '/@/utils/storage';
|
||||
import admin from '/@/assets/图片2.png';
|
||||
import user from '/@/assets/头像.png';
|
||||
|
||||
/**
|
||||
* 用户信息
|
||||
@ -52,13 +54,16 @@ export const useUserInfo = defineStore('userInfo', {
|
||||
defaultRoles = testRoles;
|
||||
defaultAuthBtnList = testAuthBtnList;
|
||||
}
|
||||
// 图片基本路径
|
||||
// const viteUrl = import.meta.env.VITE_API_URL;
|
||||
|
||||
// 用户信息模拟数据
|
||||
const userInfos = {
|
||||
userName: userName,
|
||||
photo:
|
||||
userName === 'admin'
|
||||
? 'https://img2.baidu.com/it/u=1978192862,2048448374&fm=253&fmt=auto&app=138&f=JPEG?w=504&h=500'
|
||||
: 'https://img2.baidu.com/it/u=2370931438,70387529&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=500',
|
||||
? admin
|
||||
: user,
|
||||
time: new Date().getTime(),
|
||||
roles: defaultRoles,
|
||||
authBtnList: defaultAuthBtnList,
|
||||
|
@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<div class="system-dept-container layout-padding">
|
||||
<el-card shadow="hover" class="layout-padding-auto">
|
||||
<div class="system-dept-search mb15">
|
||||
<!-- <div class="system-dept-search mb15">
|
||||
<span>名称:</span>
|
||||
<el-input size="default" placeholder="请输入" v-model="state.tableData.param.name" class="ml10" style="max-width: 250px;margin-right: 20px;"> </el-input>
|
||||
<el-button @click="getTableData" size="default" type="primary" class="ml10" style="margin-right: 15px;">
|
||||
@ -15,30 +15,51 @@
|
||||
<ele-RefreshRight />
|
||||
</el-icon>
|
||||
重置
|
||||
</el-button>
|
||||
<el-button @click="switchDrawer(0)" size="default" type="primary" class="ml10">
|
||||
</el-button> -->
|
||||
<!-- <el-button @click="switchDrawer(0)" size="default" type="primary" class="ml10">
|
||||
<el-icon>
|
||||
<ele-FolderAdd />
|
||||
</el-icon>
|
||||
新增轮播图
|
||||
</el-button>
|
||||
</div>
|
||||
<el-table :data="state.tableData.data" v-loading="state.tableData.loading" style="width: 100%">
|
||||
<el-table-column prop="name" label="轮播图名称" show-overflow-tooltip width="350px"></el-table-column>
|
||||
<el-table-column label="跳转链接" show-overflow-tooltip width="350px" align="center">
|
||||
</el-button> -->
|
||||
<!-- </div> -->
|
||||
<el-table :data="state.tableData.data" v-loading="state.tableData.loading" style="width: 100%;" class="custom-table">
|
||||
<el-table-column prop="name" label="轮播图名称" show-overflow-tooltip width="210px"></el-table-column>
|
||||
<el-table-column label="素材" width="350px" align="center">
|
||||
<template #default="scope">
|
||||
<a :href="jpgFormatter(scope.row)">{{ jpgFormatter(scope.row) }}</a>
|
||||
<el-image :src="encodeURI(viteUrl+scope.row.path)" />
|
||||
<!-- <a :href="jpgFormatter(scope.row)">{{ jpgFormatter(scope.row) }}</a> -->
|
||||
<!-- <el-button @click="jpgJump(scope.row)" text type="primary">{{ jpgFormatter(scope.row) }}</el-button> -->
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="orderNum" label="排序号" sortable show-overflow-tooltip width="350px" align="center"></el-table-column>
|
||||
<el-table-column prop="createtime" label="创建时间" :formatter="dateFormatter" show-overflow-tooltip width="350px" align="center"></el-table-column>
|
||||
<el-table-column label="跳转地址" show-overflow-tooltip width="350px" align="center">
|
||||
<template #default="scope">
|
||||
<!-- <a :href="jpgFormatter(scope.row)">{{ jpgFormatter(scope.row) }}</a> -->
|
||||
<el-button @click="jpgJump(scope.row)" text type="primary">{{ scope.row.url }}</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="orderNum" label="排序号" sortable show-overflow-tooltip width="150px" align="center"></el-table-column>
|
||||
<el-table-column prop="createtime" label="创建时间" :formatter="dateFormatter" show-overflow-tooltip width="250px" align="center"></el-table-column>
|
||||
<el-table-column label="操作" width="300" align="center">
|
||||
<template #default="scope">
|
||||
<el-button size="small" text type="primary" @click="switchDrawer(scope.row.id,1)">编辑</el-button>
|
||||
<el-button size="small" text type="primary" @click="deleteBanner(scope.row.id)">删除</el-button>
|
||||
<el-button size="small" text type="primary" @click="switchDrawer(scope.row.id,1)">
|
||||
<el-icon>
|
||||
<ele-EditPen/>
|
||||
</el-icon>
|
||||
</el-button>
|
||||
<el-button size="small" text type="primary" @click="deleteBanner(scope.row.id)">
|
||||
<el-icon>
|
||||
<ele-Delete/>
|
||||
</el-icon>
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<div class="add-banner" @click="switchDrawer(0)">
|
||||
+ 添加banner
|
||||
</div>
|
||||
|
||||
<!-- 新增或编辑弹窗 -->
|
||||
<el-drawer
|
||||
v-model="dialog"
|
||||
@ -92,8 +113,8 @@
|
||||
<img :src="dialogImageUrl" style="width: 100%" alt="Preview Image" />
|
||||
</el-dialog>
|
||||
</el-form-item>
|
||||
<el-form-item label="跳转链接:" prop="path">
|
||||
<el-input v-model="state.formData.path" />
|
||||
<el-form-item label="跳转链接:" prop="url">
|
||||
<el-input v-model="state.formData.url" />
|
||||
</el-form-item>
|
||||
<el-form-item label="排序号:" prop="orderNum">
|
||||
<el-input v-model.number="state.formData.orderNum" />
|
||||
@ -108,7 +129,7 @@
|
||||
</div>
|
||||
</el-drawer>
|
||||
<!-- 分页器 -->
|
||||
<el-pagination
|
||||
<!-- <el-pagination
|
||||
@size-change="onHandleSizeChange"
|
||||
@current-change="onHandleCurrentChange"
|
||||
class="mt15"
|
||||
@ -120,7 +141,7 @@
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
:total="state.tableData.total"
|
||||
>
|
||||
</el-pagination>
|
||||
</el-pagination> -->
|
||||
</el-card>
|
||||
</div>
|
||||
</template>
|
||||
@ -152,6 +173,7 @@ const state = reactive({
|
||||
fileList: [],
|
||||
name:"",
|
||||
path:"",
|
||||
url: '',
|
||||
orderNum: "",
|
||||
loading: false
|
||||
},
|
||||
@ -193,18 +215,20 @@ const getTableData = async() => {
|
||||
};
|
||||
|
||||
// 重置
|
||||
const reset = () =>{
|
||||
state.tableData.param = {
|
||||
name: '',
|
||||
current: 1,
|
||||
size: 10,
|
||||
}
|
||||
getTableData();
|
||||
}
|
||||
// const reset = () =>{
|
||||
// state.tableData.param = {
|
||||
// name: '',
|
||||
// current: 1,
|
||||
// size: 10,
|
||||
// }
|
||||
// getTableData();
|
||||
// }
|
||||
|
||||
// 图片基本路径
|
||||
const viteUrl = import.meta.env.VITE_API_URL;
|
||||
|
||||
|
||||
|
||||
// 图片链接格式化
|
||||
const jpgFormatter = (row: any) => {
|
||||
console.log("44444444444",row);
|
||||
@ -221,7 +245,26 @@ const jpgFormatter = (row: any) => {
|
||||
newPath = newPath.includes('http://localhost:8888/') ? newPath : viteUrl + newPath
|
||||
console.log("22222222222222222",newPath);
|
||||
return `${newPath}`;
|
||||
}
|
||||
// window.open(newPath);
|
||||
};
|
||||
|
||||
//轮播图跳转
|
||||
const jpgJump = (row:any) =>{
|
||||
// console.log("44444444444",row);
|
||||
// let newPath;
|
||||
// if (row?.data) {
|
||||
// newPath = row.data.path.replaceAll('\\', '/')
|
||||
// console.log("11111111111",newPath);
|
||||
|
||||
// } else {
|
||||
// newPath = row.path.replaceAll('\\\\', '/')
|
||||
// console.log("333333333333",newPath);
|
||||
|
||||
// }
|
||||
// newPath = newPath.includes('http://localhost:8888/') ? newPath : viteUrl + newPath
|
||||
// console.log("22222222222222222",newPath);
|
||||
window.open(row.url);
|
||||
};
|
||||
|
||||
// 日期格式化
|
||||
const dateFormatter = (row: any, column: TableColumnCtx<String>) => {
|
||||
@ -230,16 +273,16 @@ const dateFormatter = (row: any, column: TableColumnCtx<String>) => {
|
||||
}
|
||||
|
||||
// 分页改变
|
||||
const onHandleSizeChange = (val: number) => {
|
||||
state.tableData.param.size = val;
|
||||
getTableData();
|
||||
};
|
||||
// const onHandleSizeChange = (val: number) => {
|
||||
// state.tableData.param.size = val;
|
||||
// getTableData();
|
||||
// };
|
||||
|
||||
// 分页改变
|
||||
const onHandleCurrentChange = (val: number) => {
|
||||
state.tableData.param.current = val;
|
||||
getTableData();
|
||||
};
|
||||
// // 分页改变
|
||||
// const onHandleCurrentChange = (val: number) => {
|
||||
// state.tableData.param.current = val;
|
||||
// getTableData();
|
||||
// };
|
||||
// #endregion
|
||||
|
||||
// #region
|
||||
@ -297,8 +340,8 @@ const handleChange: UploadProps['onChange'] = async (file: uploadFile, uploadFil
|
||||
console.log("result", res);
|
||||
console.log("state.formData", state.formData);
|
||||
if(res?.success){
|
||||
state.formData.url = jpgFormatter(res);
|
||||
state.formData.path = jpgFormatter(res);
|
||||
// state.formData.url = jpgFormatter(res);
|
||||
state.formData.path = res.data.path;
|
||||
ElMessage({
|
||||
message: '图片上传成功!',
|
||||
type: 'success',
|
||||
@ -454,17 +497,73 @@ onMounted(() => {
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
|
||||
.add-banner {
|
||||
width: 100%; // 让按钮的宽度与表格的行一样
|
||||
margin: 16px 0;
|
||||
text-align: center;
|
||||
color: #409eff;
|
||||
cursor: pointer;
|
||||
font-size: 16px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
height: 100px; // 与表格行高度一致
|
||||
border: 2px dashed #dcdfe6;
|
||||
border-radius: 8px;
|
||||
}
|
||||
|
||||
|
||||
.system-dept-container {
|
||||
:deep(.el-card__body) {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
flex: 1;
|
||||
overflow: auto;
|
||||
overflow-y: auto;
|
||||
max-height: 1000px; // 固定最大高度
|
||||
padding: 20px;
|
||||
|
||||
.el-table {
|
||||
flex: 1;
|
||||
width: 100%;
|
||||
table-layout: fixed; // 表格均分布局
|
||||
}
|
||||
|
||||
// .el-table th, .el-table td {
|
||||
// text-align: center;
|
||||
// padding: 12px 8px;
|
||||
// word-break: break-all;
|
||||
// }
|
||||
}
|
||||
};
|
||||
|
||||
::v-deep .el-image {
|
||||
width: 250px; // 固定图片宽度
|
||||
height: 150px; // 固定图片高度
|
||||
object-fit: cover; // 图片居中剪裁
|
||||
display: block;
|
||||
}
|
||||
|
||||
img[alt="加载失败"] {
|
||||
content: url('path_to_placeholder_image.png'); // 加载失败时显示占位图片
|
||||
width: 250px; // 确保占位图片大小一致
|
||||
height: 100px;
|
||||
}
|
||||
|
||||
::v-deep .el-table__body{
|
||||
width: 100% !important;
|
||||
}
|
||||
|
||||
::v-deep .el-table__body-wrapper .el-table__row {
|
||||
margin-bottom: 10px; // 增加底部间距,让卡片分隔更明显
|
||||
border: 1px solid #dcdfe6; // 更宽的边框,使其明显
|
||||
border-radius: 8px; // 圆角
|
||||
box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15); // 更强的阴影
|
||||
background-color: #fff;
|
||||
overflow: hidden; // 确保内容被边框包裹住
|
||||
}
|
||||
|
||||
|
||||
::v-deep .el-drawer .el-drawer__header {
|
||||
margin: 15px 0 20px 0!important;
|
||||
border-bottom: 0!important;
|
||||
|
@ -18,6 +18,23 @@
|
||||
添加标签
|
||||
</el-button>
|
||||
</div>
|
||||
<!-- <el-tree
|
||||
:data="treeData"
|
||||
:props="defaultProps"
|
||||
node-key="id"
|
||||
default-expand-all
|
||||
:highlight-current="true"
|
||||
@node-click="handleNodeClick"
|
||||
>
|
||||
<span class="custom-tree-node" slot-scope="{ node, data }">
|
||||
<span>{{ data.name }}</span>
|
||||
<span>
|
||||
<el-button size="mini" type="text" @click="toShowDetail(data.id)">查看详情</el-button>
|
||||
<el-button size="mini" type="text" @click="toEditArticle(data.id)">编辑</el-button>
|
||||
<el-button size="mini" type="text" @click="deleteArticle(data.id)">删除</el-button>
|
||||
</span>
|
||||
</span>
|
||||
</el-tree> -->
|
||||
<el-table :data="state.tableData.data" v-loading="state.tableData.loading" style="width: 100%" :header-cell-style="{ backgroundColor: '#fafafa', height: '40px' }">
|
||||
<el-table-column prop="moduleName" label="模块名称" show-overflow-tooltip></el-table-column>
|
||||
<el-table-column prop="parentName" label="父标签" show-overflow-tooltip></el-table-column>
|
||||
@ -72,6 +89,11 @@ const addLabelDialogRef = ref();
|
||||
const editLabelDialog = defineAsyncComponent(() => import('/@/views/label/editDialog.vue'));
|
||||
const editLabelDialogRef = ref();
|
||||
|
||||
interface Tree {
|
||||
label: string
|
||||
children?: Tree[]
|
||||
}
|
||||
|
||||
// 表格数据
|
||||
const state = reactive({
|
||||
tableData: {
|
||||
@ -93,6 +115,13 @@ const moduleList = ref([]);
|
||||
// 标签列表
|
||||
const labelList = ref([]);
|
||||
|
||||
//增加树形节点
|
||||
const treeData = ref([]);
|
||||
const defaultProps = {
|
||||
children: 'children',
|
||||
label: 'name'
|
||||
};
|
||||
|
||||
// 引入 api 请求接口
|
||||
const labelapi = labelApi();
|
||||
|
||||
@ -119,6 +148,7 @@ const getTableData = async() => {
|
||||
if(res?.success){
|
||||
state.tableData.data = res.data.records;
|
||||
state.tableData.total = res.data.total;
|
||||
buildTreeData();
|
||||
}else{
|
||||
ElMessage.error('标签列表获取失败!');
|
||||
}
|
||||
@ -128,6 +158,27 @@ const getTableData = async() => {
|
||||
}
|
||||
};
|
||||
|
||||
const buildTreeData = () => {
|
||||
const moduleMap = {};
|
||||
|
||||
// 准备模块节点
|
||||
state.tableData.data.forEach(item => {
|
||||
if (!moduleMap[item.moduleName]) {
|
||||
moduleMap[item.moduleName] = {
|
||||
name: item.moduleName,
|
||||
children: []
|
||||
};
|
||||
}
|
||||
moduleMap[item.moduleName].children.push({ ...item });
|
||||
});
|
||||
|
||||
treeData.value = Object.values(moduleMap);
|
||||
console.log(treeData.value); // 检查结构
|
||||
};
|
||||
|
||||
const handleNodeClick = (data: Tree) => {
|
||||
console.log(data)
|
||||
}
|
||||
|
||||
// 模块选择
|
||||
const handleChangeModule = async(val: any) => {
|
||||
@ -147,24 +198,6 @@ const handleChangeModule = async(val: any) => {
|
||||
}
|
||||
};
|
||||
|
||||
// // 模块选择
|
||||
// const handleChangeModule = async(val) => {
|
||||
// try {
|
||||
// if (!val) {
|
||||
// labelList.value = [];
|
||||
// state.tableData.data = [];
|
||||
// state.tableData.total = 0;
|
||||
// return;
|
||||
// }
|
||||
// const op = moduleList.value.find(item => item.moduleName === val);
|
||||
// if (op) {
|
||||
// state.tableData.param.moduleid = op.id;
|
||||
// await getTableData();
|
||||
// }
|
||||
// } catch (error) {
|
||||
// ElMessage.error('标签列表获取失败!');
|
||||
// }
|
||||
// }
|
||||
|
||||
// 重置
|
||||
const reset = (index = 0) =>{
|
||||
@ -250,63 +283,6 @@ onMounted(() => {
|
||||
getTableData();
|
||||
});
|
||||
|
||||
// const totalData = ref([]); // 用于存储所有数据
|
||||
|
||||
// // 获取模块列表
|
||||
// const getModuleList = async () => {
|
||||
// try {
|
||||
// let res = await labelapi.getModuleList();
|
||||
// if (res?.success) {
|
||||
// moduleList.value = res.data;
|
||||
// await getAllData(); // 获取所有模块对应的数据
|
||||
// } else {
|
||||
// ElMessage.error('模块列表获取失败!');
|
||||
// }
|
||||
// } catch (error) {
|
||||
// ElMessage.error('模块列表获取失败!');
|
||||
// }
|
||||
// };
|
||||
|
||||
// // 获取所有模块的数据
|
||||
// const getAllData = async () => {
|
||||
// try {
|
||||
// const requests = moduleList.value.map(module => labelapi.getLabelList({ moduleid: module.id, current: 1, size: 10 })); // 请求所有模块数据
|
||||
// const results = await Promise.all(requests);
|
||||
|
||||
// totalData.value = results
|
||||
// .filter(res => res?.success) // 过滤成功的请求
|
||||
// .flatMap(res => res.data.records || []); // 合并所有数据
|
||||
|
||||
// state.tableData.total = totalData.value.length;
|
||||
// updatePageData(); // 更新到当前页显示的数据
|
||||
// } catch (error) {
|
||||
// ElMessage.error('标签列表获取失败!');
|
||||
// } finally {
|
||||
// state.tableData.loading = false;
|
||||
// }
|
||||
// };
|
||||
|
||||
// // 根据当前页和每页大小更新数据显示
|
||||
// const updatePageData = () => {
|
||||
// const start = (state.tableData.param.current - 1) * state.tableData.param.size;
|
||||
// const end = start + state.tableData.param.size;
|
||||
// state.tableData.data = totalData.value.slice(start, end);
|
||||
// };
|
||||
|
||||
// // 分页改变
|
||||
// const onHandleSizeChange = (val) => {
|
||||
// state.tableData.param.size = val;
|
||||
// updatePageData(); // 更新显示的数据
|
||||
// };
|
||||
|
||||
// const onHandleCurrentChange = (val) => {
|
||||
// state.tableData.param.current = val;
|
||||
// updatePageData(); // 更新显示的数据
|
||||
// };
|
||||
|
||||
// onMounted(() => {
|
||||
// getModuleList();
|
||||
// });
|
||||
|
||||
</script>
|
||||
|
||||
@ -317,7 +293,7 @@ onMounted(() => {
|
||||
flex-direction: column;
|
||||
flex: 1;
|
||||
overflow: auto;
|
||||
.el-table {
|
||||
.el-tree {
|
||||
flex: 1;
|
||||
}
|
||||
}
|
||||
|
@ -1,13 +1,13 @@
|
||||
<template>
|
||||
<div class="login-container flex">
|
||||
<div class="login-left">
|
||||
<div class="login-left-logo">
|
||||
<!-- <div class="login-left-logo">
|
||||
<img :src="logoMini" />
|
||||
<div class="login-left-logo-text">
|
||||
<span>{{ getThemeConfig.globalViceTitle }}</span>
|
||||
<span>{{ getThemeConfig.globalTitle }}</span>
|
||||
<span class="login-left-logo-text-msg">{{ getThemeConfig.globalViceTitleMsg }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div> -->
|
||||
<div class="login-left-img">
|
||||
<img :src="loginMain" />
|
||||
</div>
|
||||
@ -18,7 +18,7 @@
|
||||
<span class="login-right-warp-one"></span>
|
||||
<span class="login-right-warp-two"></span>
|
||||
<div class="login-right-warp-mian">
|
||||
<div class="login-right-warp-main-title">{{ getThemeConfig.globalTitle }} 欢迎您!</div>
|
||||
<div class="login-right-warp-main-title">{{ getThemeConfig.globalTitle }}</div>
|
||||
<div class="login-right-warp-main-form">
|
||||
<div v-if="!state.isScan">
|
||||
<el-tabs v-model="state.tabsActiveName">
|
||||
@ -30,11 +30,11 @@
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
</div>
|
||||
<Scan v-if="state.isScan" />
|
||||
<!-- <Scan v-if="state.isScan" />
|
||||
<div class="login-content-main-sacn" @click="state.isScan = !state.isScan">
|
||||
<i class="iconfont" :class="state.isScan ? 'icon-diannao1' : 'icon-barcode-qr'"></i>
|
||||
<div class="login-content-main-sacn-delta"></div>
|
||||
</div>
|
||||
</div> -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -7,7 +7,7 @@
|
||||
<div class="personal-user">
|
||||
<div class="personal-user-left">
|
||||
<el-upload class="h100 personal-user-left-upload" action="https://jsonplaceholder.typicode.com/posts/" multiple :limit="1">
|
||||
<img src="https://img2.baidu.com/it/u=1978192862,2048448374&fm=253&fmt=auto&app=138&f=JPEG?w=504&h=500" />
|
||||
<img src="../../assets/图片2.png" />
|
||||
</el-upload>
|
||||
</div>
|
||||
<div class="personal-user-right">
|
||||
@ -206,6 +206,8 @@ const state = reactive<PersonalState>({
|
||||
const currentTime = computed(() => {
|
||||
return formatAxis(new Date());
|
||||
});
|
||||
// 图片基本路径
|
||||
const viteUrl = import.meta.env.VITE_API_URL;
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
|
@ -43,16 +43,40 @@
|
||||
</div>
|
||||
<el-table :data="state.tableData.data" v-loading="state.tableData.loading" style="width: 100%">
|
||||
<el-table-column type="selection" width="55" />
|
||||
<el-table-column prop="name" label="图片名称" show-overflow-tooltip width="250px"></el-table-column>
|
||||
<el-table-column prop="moduleName" label="模块" show-overflow-tooltip width="250px" align="center"></el-table-column>
|
||||
<el-table-column prop="labelName" label="标签" show-overflow-tooltip width="250px" align="center"></el-table-column>
|
||||
<el-table-column prop="uploadName" label="上传者" show-overflow-tooltip width="250px" align="center"></el-table-column>
|
||||
<el-table-column prop="createtime" label="创建时间" :formatter="dateFormatter" show-overflow-tooltip width="350px" align="center"></el-table-column>
|
||||
<el-table-column label="操作" width="300" align="center">
|
||||
<el-table-column prop="name" label="图片名称" show-overflow-tooltip width="180px"></el-table-column>
|
||||
<el-table-column label="素材" width="300px" align="center">
|
||||
<template #default="scope">
|
||||
<el-button size="small" text type="primary" @click="switchDrawer(2,scope.row.id)">查看</el-button>
|
||||
<el-button size="small" text type="primary" @click="switchDrawer(1,scope.row.id)">编辑</el-button>
|
||||
<el-button size="small" text type="primary" @click="deleteBanner(scope.row.id)">删除</el-button>
|
||||
<el-image :src="jpgFormatter(scope.row)" />
|
||||
<!-- <a :href="jpgFormatter(scope.row)">{{ jpgFormatter(scope.row) }}</a> -->
|
||||
<!-- <el-button @click="jpgJump(scope.row)" text type="primary">{{ jpgFormatter(scope.row) }}</el-button> -->
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="moduleName" label="模块" show-overflow-tooltip width="200px" align="center"></el-table-column>
|
||||
<el-table-column prop="labelName" label="标签" show-overflow-tooltip width="200px" align="center"></el-table-column>
|
||||
<el-table-column prop="uploadName" label="上传者" show-overflow-tooltip width="200px" align="center"></el-table-column>
|
||||
<el-table-column prop="createtime" label="创建时间" :formatter="dateFormatter" show-overflow-tooltip width="200px" align="center"></el-table-column>
|
||||
<el-table-column label="操作" width="250" align="center">
|
||||
<template #default="scope">
|
||||
<el-button text type="primary" @click="switchDrawer(2,scope.row.id)">
|
||||
<el-icon>
|
||||
<ele-View />
|
||||
</el-icon>
|
||||
</el-button>
|
||||
<el-button text type="primary" @click="switchDrawer(1,scope.row.id)">
|
||||
<el-icon>
|
||||
<ele-Edit />
|
||||
</el-icon>
|
||||
</el-button>
|
||||
<el-button text type="primary" @click="download(scope.row)">
|
||||
<el-icon>
|
||||
<ele-Download />
|
||||
</el-icon>
|
||||
</el-button>
|
||||
<el-button text type="primary" @click="deleteBanner(scope.row.id)">
|
||||
<el-icon>
|
||||
<ele-Delete />
|
||||
</el-icon>
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
@ -70,7 +94,7 @@
|
||||
style="max-width: 85%"
|
||||
:model="state.formData"
|
||||
:rules="state.rules"
|
||||
label-width="100px"
|
||||
label-width="110px"
|
||||
class="demo-ruleForm"
|
||||
:size="formSize"
|
||||
status-icon
|
||||
@ -164,6 +188,7 @@ import { Delete, Download, Plus, ZoomIn } from '@element-plus/icons-vue'
|
||||
import type { ComponentSize, FormInstance, FormRules, UploadFile, UploadProps, UploadUserFile } from 'element-plus'
|
||||
import { baseUrlHost } from '../../api/baseUrlHost';
|
||||
import { photosApi } from '/@/api/photos';
|
||||
import { downloadPhoto } from '../../api/download';
|
||||
|
||||
const router = useRouter();
|
||||
|
||||
@ -280,19 +305,19 @@ const viteUrl = import.meta.env.VITE_API_URL;
|
||||
|
||||
// 图片链接格式化
|
||||
const jpgFormatter = (row: any) => {
|
||||
console.log("44444444444",row);
|
||||
// console.log("44444444444",row);
|
||||
let newPath;
|
||||
if (row?.data) {
|
||||
newPath = row.data.path.replaceAll('\\', '/')
|
||||
console.log("11111111111",newPath);
|
||||
// console.log("11111111111",newPath);
|
||||
|
||||
} else {
|
||||
newPath = row.path.replaceAll('\\\\', '/')
|
||||
console.log("333333333333",newPath);
|
||||
// console.log("333333333333",newPath);
|
||||
|
||||
}
|
||||
newPath = newPath.includes('http://8.138.171.103/') ? newPath : 'http://8.138.171.103/' + newPath
|
||||
console.log("22222222222222222",newPath);
|
||||
// console.log("22222222222222222",newPath);
|
||||
return `${newPath}`;
|
||||
}
|
||||
|
||||
@ -431,7 +456,39 @@ const handleRemove = (file: UploadFile, uploadFiles) => {
|
||||
state.formData.path = "";
|
||||
uploadDisabled.value = false;
|
||||
|
||||
};
|
||||
|
||||
//下载图片
|
||||
const download = async(row:any) =>{
|
||||
state.formData.loading = true;
|
||||
// console.log("44444444444",row);
|
||||
let newPath;
|
||||
if (row?.data) {
|
||||
newPath = row.data.path.replaceAll('\\', '/')
|
||||
// console.log("11111111111",newPath);
|
||||
|
||||
} else {
|
||||
newPath = row.path.replaceAll('\\\\', '/')
|
||||
// console.log("333333333333",newPath);
|
||||
|
||||
}
|
||||
newPath = newPath.includes('http://localhost:8888/') ? newPath : viteUrl + newPath
|
||||
// console.log("22222222222222222",newPath);
|
||||
try{
|
||||
await downloadPhoto(newPath);
|
||||
|
||||
ElMessage({
|
||||
message: '图片下载成功!',
|
||||
type: 'success',
|
||||
});
|
||||
}catch(error){
|
||||
console.error(error);
|
||||
ElMessage.error('图片下载失败!')
|
||||
}finally{
|
||||
state.formData.loading = false;
|
||||
}
|
||||
};
|
||||
|
||||
// 删除图片
|
||||
const deleteBanner = (id: number) => {
|
||||
ElMessageBox.confirm('确定要删除该图片吗?', '提示', {
|
||||
@ -537,7 +594,15 @@ onMounted(() => {
|
||||
flex: 1;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
::v-deep .el-image {
|
||||
width: 250px; // 固定图片宽度
|
||||
height: 150px; // 固定图片高度
|
||||
object-fit: cover; // 图片居中剪裁
|
||||
display: block;
|
||||
}
|
||||
|
||||
::v-deep .el-drawer .el-drawer__header {
|
||||
margin: 15px 0 20px 0!important;
|
||||
border-bottom: 0!important;
|
||||
|
@ -5,7 +5,7 @@
|
||||
<el-row :gutter="35">
|
||||
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
|
||||
<el-form-item label="角色名称">
|
||||
<el-input v-model="state.ruleForm.roleName" placeholder="请输入角色名称" clearable></el-input>
|
||||
<el-input v-model="state.ruleForm.name" placeholder="请输入角色名称" clearable></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
|
||||
@ -15,22 +15,22 @@
|
||||
<span>角色标识</span>
|
||||
</el-tooltip>
|
||||
</template>
|
||||
<el-input v-model="state.ruleForm.roleSign" placeholder="请输入角色标识" clearable></el-input>
|
||||
<el-input v-model="state.ruleForm.acgroup" placeholder="请输入角色标识" clearable></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
|
||||
<el-form-item label="排序">
|
||||
<el-input-number v-model="state.ruleForm.sort" :min="0" :max="999" controls-position="right" placeholder="请输入排序" class="w100" />
|
||||
<el-input-number v-model="state.ruleForm.id" :min="0" :max="999" controls-position="right" placeholder="请输入排序" class="w100" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
|
||||
<el-form-item label="角色状态">
|
||||
<el-switch v-model="state.ruleForm.status" inline-prompt active-text="启" inactive-text="禁"></el-switch>
|
||||
<el-switch v-model="state.ruleForm.state" inline-prompt active-text="启" inactive-text="禁"></el-switch>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20">
|
||||
<el-form-item label="角色描述">
|
||||
<el-input v-model="state.ruleForm.describe" type="textarea" placeholder="请输入角色描述" maxlength="150"></el-input>
|
||||
<el-input v-model="state.ruleForm.description" type="textarea" placeholder="请输入角色描述" maxlength="150"></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20">
|
||||
@ -54,17 +54,17 @@
|
||||
import { reactive, ref } from 'vue';
|
||||
|
||||
// 定义子组件向父组件传值/事件
|
||||
const emit = defineEmits(['refresh']);
|
||||
const emit = defineEmits(['reset']);
|
||||
|
||||
// 定义变量内容
|
||||
const roleDialogFormRef = ref();
|
||||
const state = reactive({
|
||||
ruleForm: {
|
||||
roleName: '', // 角色名称
|
||||
roleSign: '', // 角色标识
|
||||
sort: 0, // 排序
|
||||
status: true, // 角色状态
|
||||
describe: '', // 角色描述
|
||||
name: '', // 角色名称
|
||||
acgroup: '', // 角色标识
|
||||
id: 0, // 排序
|
||||
state: true, // 角色状态
|
||||
description: '', // 角色描述
|
||||
},
|
||||
menuData: [] as TreeType[],
|
||||
menuProps: {
|
||||
@ -80,7 +80,7 @@ const state = reactive({
|
||||
});
|
||||
|
||||
// 打开弹窗
|
||||
const openDialog = (type: string, row: RowRoleType) => {
|
||||
const openDialog = (type: string, row: any) => {
|
||||
if (type === 'edit') {
|
||||
state.ruleForm = row;
|
||||
state.dialog.title = '修改角色';
|
||||
@ -107,7 +107,7 @@ const onCancel = () => {
|
||||
// 提交
|
||||
const onSubmit = () => {
|
||||
closeDialog();
|
||||
emit('refresh');
|
||||
emit('reset');
|
||||
// if (state.dialog.type === 'add') { }
|
||||
};
|
||||
// 获取菜单结构数据
|
||||
|
@ -18,23 +18,23 @@
|
||||
</div>
|
||||
<el-table :data="state.tableData.data" v-loading="state.tableData.loading" style="width: 100%">
|
||||
<el-table-column type="index" label="序号" width="60" />
|
||||
<el-table-column prop="roleName" label="角色名称" show-overflow-tooltip></el-table-column>
|
||||
<el-table-column prop="roleSign" label="角色标识" show-overflow-tooltip></el-table-column>
|
||||
<el-table-column prop="sort" label="排序" show-overflow-tooltip></el-table-column>
|
||||
<el-table-column prop="status" label="角色状态" show-overflow-tooltip>
|
||||
<el-table-column prop="name" label="角色名称" show-overflow-tooltip></el-table-column>
|
||||
<el-table-column prop="acgroup" label="角色标识" show-overflow-tooltip></el-table-column>
|
||||
<el-table-column prop="id" label="排序" show-overflow-tooltip></el-table-column>
|
||||
<el-table-column prop="state" label="角色状态" show-overflow-tooltip>
|
||||
<template #default="scope">
|
||||
<el-tag type="success" v-if="scope.row.status">启用</el-tag>
|
||||
<el-tag type="success" v-if="scope.row.state">启用</el-tag>
|
||||
<el-tag type="info" v-else>禁用</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="describe" label="角色描述" show-overflow-tooltip></el-table-column>
|
||||
<el-table-column prop="createTime" label="创建时间" show-overflow-tooltip></el-table-column>
|
||||
<el-table-column prop="description" label="角色描述" show-overflow-tooltip></el-table-column>
|
||||
<el-table-column prop="createtime" label="创建时间" :formatter="dateFormatter" show-overflow-tooltip></el-table-column>
|
||||
<el-table-column label="操作" width="100">
|
||||
<template #default="scope">
|
||||
<el-button :disabled="scope.row.roleName === '超级管理员'" size="small" text type="primary" @click="onOpenEditRole('edit', scope.row)"
|
||||
<el-button :disabled="scope.row.name === '管理员'" size="small" text type="primary" @click="onOpenEditRole('edit', scope.row)"
|
||||
>修改</el-button
|
||||
>
|
||||
<el-button :disabled="scope.row.roleName === '超级管理员'" size="small" text type="primary" @click="onRowDel(scope.row)">删除</el-button>
|
||||
<el-button :disabled="scope.row.name === '管理员'" size="small" text type="primary" @click="onRowDel(scope.row)">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
@ -52,17 +52,20 @@
|
||||
>
|
||||
</el-pagination>
|
||||
</div>
|
||||
<RoleDialog ref="roleDialogRef" @refresh="getTableData()" />
|
||||
<RoleDialog ref="roleDialogRef" @reset="reset" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="systemRole">
|
||||
import { defineAsyncComponent, reactive, onMounted, ref } from 'vue';
|
||||
import { ElMessageBox, ElMessage } from 'element-plus';
|
||||
import { ElMessageBox, ElMessage,TableColumnCtx } from 'element-plus';
|
||||
import { RoleApi } from '/@/api/role';
|
||||
|
||||
// 引入组件
|
||||
const RoleDialog = defineAsyncComponent(() => import('/@/views/usermanage/role/dialog.vue'));
|
||||
|
||||
const roleapi = RoleApi();
|
||||
|
||||
// 定义变量内容
|
||||
const roleDialogRef = ref();
|
||||
const state = reactive<SysRoleState>({
|
||||
@ -78,24 +81,39 @@ const state = reactive<SysRoleState>({
|
||||
},
|
||||
});
|
||||
// 初始化表格数据
|
||||
const getTableData = () => {
|
||||
const getTableData = async() => {
|
||||
state.tableData.loading = true;
|
||||
const data = [];
|
||||
for (let i = 0; i < 20; i++) {
|
||||
data.push({
|
||||
roleName: i === 0 ? '超级管理员' : '普通用户',
|
||||
roleSign: i === 0 ? 'admin' : 'common',
|
||||
describe: `测试角色${i + 1}`,
|
||||
sort: i,
|
||||
status: true,
|
||||
createTime: new Date().toLocaleString(),
|
||||
});
|
||||
// const data = [];
|
||||
// for (let i = 0; i < 20; i++) {
|
||||
// data.push({
|
||||
// roleName: i === 0 ? '超级管理员' : '普通用户',
|
||||
// roleSign: i === 0 ? 'admin' : 'common',
|
||||
// describe: `测试角色${i + 1}`,
|
||||
// sort: i,
|
||||
// status: true,
|
||||
// createTime: new Date().toLocaleString(),
|
||||
// });
|
||||
// }
|
||||
// state.tableData.data = data;
|
||||
// state.tableData.total = state.tableData.data.length;
|
||||
|
||||
try{
|
||||
const res = await roleapi.getRoleList(state.tableData.param);
|
||||
// console.log(res.data);
|
||||
if(res?.success){
|
||||
state.tableData.data = res.data.records;
|
||||
state.tableData.total = res.data.total;
|
||||
// console.log(state.tableData.data);
|
||||
}else{
|
||||
ElMessage.error('角色列表获取失败!');
|
||||
}
|
||||
state.tableData.data = data;
|
||||
state.tableData.total = state.tableData.data.length;
|
||||
}catch(error){
|
||||
console.error(error);
|
||||
}finally{
|
||||
setTimeout(() => {
|
||||
state.tableData.loading = false;
|
||||
}, 500);
|
||||
}
|
||||
};
|
||||
// 打开新增角色弹窗
|
||||
const onOpenAddRole = (type: string) => {
|
||||
@ -106,18 +124,49 @@ const onOpenEditRole = (type: string, row: Object) => {
|
||||
roleDialogRef.value.openDialog(type, row);
|
||||
};
|
||||
// 删除角色
|
||||
const onRowDel = (row: RowRoleType) => {
|
||||
ElMessageBox.confirm(`此操作将永久删除角色名称:“${row.roleName}”,是否继续?`, '提示', {
|
||||
const onRowDel = (row: any) => {
|
||||
ElMessageBox.confirm(`此操作将永久删除角色名称:“${row.name}”,是否继续?`, '提示', {
|
||||
confirmButtonText: '确认',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning',
|
||||
})
|
||||
.then(() => {
|
||||
getTableData();
|
||||
ElMessage.success('删除成功');
|
||||
.then(async() => {
|
||||
// getTableData();
|
||||
// ElMessage.success('删除成功');
|
||||
try{
|
||||
state.tableData.loading = true;
|
||||
const res = await roleapi.deleteRole(row.id);
|
||||
if(res?.success){
|
||||
reset();
|
||||
ElMessage.success('角色删除成功!');
|
||||
|
||||
} else ElMessage.error('角色删除失败!');
|
||||
}catch(error){
|
||||
ElMessage.error('处理失败!');
|
||||
}finally{
|
||||
state.tableData.loading = false;
|
||||
}
|
||||
})
|
||||
.catch(() => {});
|
||||
};
|
||||
|
||||
// 重置
|
||||
const reset = (index = 0) =>{
|
||||
state.tableData.param = {
|
||||
// moduleid:moduleList.value
|
||||
pageNum: index ? state.tableData.param.pageNum : 1,
|
||||
pageSize: 10,
|
||||
},
|
||||
console.log(index,state.tableData.param);
|
||||
getTableData();
|
||||
};
|
||||
|
||||
|
||||
// 日期格式化
|
||||
const dateFormatter = (row: any, column: TableColumnCtx<String>) => {
|
||||
let date = new Date(row.createtime);
|
||||
return `${date.getFullYear()}-${date.getMonth() + 1}-${date.getDate()}`;
|
||||
};
|
||||
|
||||
// 分页改变
|
||||
const onHandleSizeChange = (val: number) => {
|
||||
state.tableData.param.pageSize = val;
|
||||
|
Loading…
Reference in New Issue
Block a user