{ | |||||
// 使用 IntelliSense 了解相关属性。 | |||||
// 悬停以查看现有属性的描述。 | |||||
// 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387 | |||||
"version": "0.2.0", | |||||
"configurations": [ | |||||
{ | |||||
"type": "pwa-chrome", | |||||
"request": "launch", | |||||
"name": "Launch Chrome against localhost", | |||||
"url": "http://localhost:8080", | |||||
"webRoot": "${workspaceFolder}" | |||||
} | |||||
] | |||||
} |
/* 一般用作项目的全局配置 */ | |||||
export const config = { | |||||
onLineState: true | |||||
}; |
{ | { | ||||
"name": "etc-project", | |||||
"name": "etcProject", | |||||
"version": "0.0.0", | "version": "0.0.0", | ||||
"lockfileVersion": 2, | "lockfileVersion": 2, | ||||
"requires": true, | "requires": true, |
<template> | <template> | ||||
<div class="as-gravity-center as-radius-5px" @mouseup="onmouseup" style="background-color:#FFFFFF; | <div class="as-gravity-center as-radius-5px" @mouseup="onmouseup" style="background-color:#FFFFFF; | ||||
padding: 15px 10px 15px 10px;width:340px;box-shadow: 0px 0px 5px #999999;"> | padding: 15px 10px 15px 10px;width:340px;box-shadow: 0px 0px 5px #999999;"> | ||||
<!-- <img src="http://localhost:2222/slide_img_four.jpg" style="height: 200px;width: 300px;"> | |||||
<img src="http://localhost:2222/slide_img_three.jpg" style="height: 200px;width: 300px;"> --> | |||||
<!-- <img src="http://localhost:2222/slide_img_four.jpg" style="height: 200px;width: 300px;"> --> | |||||
<div :style="`width: ${totalWidth}px;`"> | <div :style="`width: ${totalWidth}px;`"> | ||||
<!-- 文字提示 --> | <!-- 文字提示 --> | ||||
<div class="as-gravity-center-start" style="display:flex;margin-bottom: 10px;"> | <div class="as-gravity-center-start" style="display:flex;margin-bottom: 10px;"> | ||||
</template> | </template> | ||||
<script> | <script> | ||||
import SlideImgThreePng from '@/assets/image/slide_img_three.png'; | |||||
import SlideImgThreePng from '@/assets/image/three.jpg'; | |||||
//md开撸第二版 | //md开撸第二版 | ||||
export default { | export default { | ||||
props: { | props: { |
/* 全局配置项 */ | |||||
export const system = { | |||||
//在线模式 | |||||
onLineState: true, | |||||
} |
<!-- 分页组件 --> | <!-- 分页组件 --> | ||||
<el-pagination v-if="false" :page-size="20" :pager-count="11" layout="prev, pager, next" :total="1000" /> | <el-pagination v-if="false" :page-size="20" :pager-count="11" layout="prev, pager, next" :total="1000" /> | ||||
<!-- 对话框 --> | <!-- 对话框 --> | ||||
<el-dialog v-model="dialogFormVisible" width="40%" | |||||
<el-dialog v-model="dialogFormVisible" width="40%" @close="cancel" | |||||
:title="tableFrom.titleDialog ? tableFrom.titleDialog : `${title}`"> | :title="tableFrom.titleDialog ? tableFrom.titleDialog : `${title}`"> | ||||
<!-- 是否自定义Dialog --> | <!-- 是否自定义Dialog --> | ||||
<div v-if="tableFrom.dialogCustom"> | <div v-if="tableFrom.dialogCustom"> | ||||
'submit', | 'submit', | ||||
'handleEdit', | 'handleEdit', | ||||
'handleDelete', | 'handleDelete', | ||||
'cancel' | |||||
]) | ]) | ||||
// 声明props | // 声明props | ||||
const props = defineProps({ | const props = defineProps({ | ||||
//取消 | //取消 | ||||
const cancel = () => { | const cancel = () => { | ||||
emit('cancel') //弹窗关闭 | |||||
reset() | |||||
dialogFormVisible.value = false | dialogFormVisible.value = false | ||||
} | } | ||||
/* | /* | ||||
title:string; 页面标题,通常必选。 | title:string; 页面标题,通常必选。 | ||||
icon?:string; 图标,一般配合菜单使用。 | icon?:string; 图标,一般配合菜单使用。 | ||||
order?:number; 菜单排序。 | order?:number; 菜单排序。 | ||||
frameUrl?:string; 嵌套外链。 | frameUrl?:string; 嵌套外链。 | ||||
*/ | */ | ||||
import { getCurrentInstance } from 'vue' | |||||
export function getMenuData(proxy: any, callback: any, lose: any) { | |||||
// const { | |||||
// proxy | |||||
// }: any = getCurrentInstance(); | |||||
proxy.$request.get('menu/findAll', {}, | |||||
{ baseURL: 'http://localhost:8081/' }).then((res: any) => { | |||||
callback(res.data) | |||||
}).catch((error: any) => { | |||||
lose(error) | |||||
}) | |||||
} | |||||
export const list = [ | export const list = [ | ||||
{ | { | ||||
id: 1, | |||||
title: '基础信息查询服务', | title: '基础信息查询服务', | ||||
path: 'home', | path: 'home', | ||||
icon: 'Notification', | icon: 'Notification', | ||||
children: [{ | children: [{ | ||||
id: 2, | |||||
title: '用户信息查询及变更服务', | title: '用户信息查询及变更服务', | ||||
path: 'userQueryChange', | path: 'userQueryChange', | ||||
icon: 'User', | icon: 'User', | ||||
children: [] | children: [] | ||||
}, { | }, { | ||||
id: 3, | |||||
title: '车辆信息查询及变更服务', | title: '车辆信息查询及变更服务', | ||||
path: 'vehicleEnquirChange', | path: 'vehicleEnquirChange', | ||||
icon: 'Van', | icon: 'Van', | ||||
children: [] | children: [] | ||||
}, { | }, { | ||||
id: 4, | |||||
title: '签约信息查询服务', | title: '签约信息查询服务', | ||||
path: 'signingQuery', | path: 'signingQuery', | ||||
icon: 'Tickets', | icon: 'Tickets', | ||||
children: [] | children: [] | ||||
}, { | }, { | ||||
id: 5, | |||||
title: '卡片信息查询服务', | title: '卡片信息查询服务', | ||||
path: 'cardQueries', | path: 'cardQueries', | ||||
icon: 'Postcard', | icon: 'Postcard', | ||||
children: [] | children: [] | ||||
}, { | }, { | ||||
id: 6, | |||||
title: 'OBU信息查询服务', | title: 'OBU信息查询服务', | ||||
path: 'OBUQuery', | path: 'OBUQuery', | ||||
icon: 'Link', | icon: 'Link', | ||||
}] | }] | ||||
}, | }, | ||||
{ | { | ||||
id: 7, | |||||
title: '通行流水查询服务', | title: '通行流水查询服务', | ||||
path: 'trafficFlow', | path: 'trafficFlow', | ||||
icon: 'Promotion', | icon: 'Promotion', | ||||
children: [] | children: [] | ||||
}, { | }, { | ||||
id: 8, | |||||
title: '黑名单查询服务', | title: '黑名单查询服务', | ||||
path: 'blacklistQuery', | path: 'blacklistQuery', | ||||
icon: 'Opportunity', | icon: 'Opportunity', | ||||
children: [] | children: [] | ||||
}, { | }, { | ||||
id: 9, | |||||
title: '卡签售后服务', | title: '卡签售后服务', | ||||
path: 'home', | path: 'home', | ||||
icon: 'Postcard', | icon: 'Postcard', | ||||
children: [{ | children: [{ | ||||
id: 10, | |||||
title: '卡签补办服务', | title: '卡签补办服务', | ||||
path: 'cardFillDo', | path: 'cardFillDo', | ||||
icon: 'Postcard', | icon: 'Postcard', | ||||
children: [] | children: [] | ||||
}, { | }, { | ||||
id: 11, | |||||
title: '卡签续期服务', | title: '卡签续期服务', | ||||
icon: 'Postcard', | icon: 'Postcard', | ||||
path: 'cardRenewal', | path: 'cardRenewal', | ||||
children: [] | children: [] | ||||
}, { | }, { | ||||
id: 12, | |||||
icon: 'Postcard', | icon: 'Postcard', | ||||
title: '主动挂起(解除)服务', | title: '主动挂起(解除)服务', | ||||
path: 'initiativeHangUp', | path: 'initiativeHangUp', | ||||
children: [] | children: [] | ||||
}, { | }, { | ||||
id: 13, | |||||
icon: 'Postcard', | icon: 'Postcard', | ||||
title: '被动挂起(解除)服务', | title: '被动挂起(解除)服务', | ||||
path: 'passivityHangUp', | path: 'passivityHangUp', | ||||
children: [] | children: [] | ||||
}, { | }, { | ||||
id: 14, | |||||
icon: 'Postcard', | icon: 'Postcard', | ||||
title: '卡签注销', | title: '卡签注销', | ||||
path: 'TABActivate', | path: 'TABActivate', | ||||
children: [] | children: [] | ||||
}] | }] | ||||
}, { | }, { | ||||
id: 15, | |||||
title: '储值卡资金服务', | title: '储值卡资金服务', | ||||
path: 'home', | path: 'home', | ||||
icon: 'CreditCard', | icon: 'CreditCard', | ||||
children: [{ | children: [{ | ||||
id: 16, | |||||
title: '对公账户注册审核服务', | title: '对公账户注册审核服务', | ||||
path: 'corporateaccountManage', | path: 'corporateaccountManage', | ||||
icon: 'Collection', | icon: 'Collection', | ||||
children: [] | children: [] | ||||
}, { | }, { | ||||
id: 17, | |||||
title: '充值及圈存服务', | title: '充值及圈存服务', | ||||
path: 'home', | path: 'home', | ||||
icon: 'CopyDocument', | icon: 'CopyDocument', | ||||
children: [{ | children: [{ | ||||
id: 18, | |||||
title: '储值卡充值服务(修复)[圈存]', | title: '储值卡充值服务(修复)[圈存]', | ||||
path: 'cardrechargefix', | path: 'cardrechargefix', | ||||
icon: 'Notebook', | icon: 'Notebook', | ||||
children: [] | children: [] | ||||
}, { | }, { | ||||
id: 19, | |||||
title: '对公账户打款充值服务', | title: '对公账户打款充值服务', | ||||
icon: 'Plus', | icon: 'Plus', | ||||
path: 'advancepaymentaccount', | path: 'advancepaymentaccount', | ||||
children: [] | children: [] | ||||
}] | }] | ||||
}, { | }, { | ||||
id: 20, | |||||
title: '注销退费服务', | title: '注销退费服务', | ||||
icon: 'Scissor', | icon: 'Scissor', | ||||
path: 'cardrefundcostManage', | path: 'cardrefundcostManage', | ||||
children: [] | children: [] | ||||
}, { | }, { | ||||
id: 21, | |||||
title: '补卡额及补交服务', | title: '补卡额及补交服务', | ||||
path: 'home', | path: 'home', | ||||
icon: 'Connection', | icon: 'Connection', | ||||
children: [{ | children: [{ | ||||
id: 22, | |||||
title: '储值卡-补卡额服务', | title: '储值卡-补卡额服务', | ||||
icon: 'Tickets', | icon: 'Tickets', | ||||
path: 'supplyCardBalance', | path: 'supplyCardBalance', | ||||
children: [] | children: [] | ||||
}, { | }, { | ||||
id: 23, | |||||
title: '储值卡-补交服务', | title: '储值卡-补交服务', | ||||
icon: 'Box', | icon: 'Box', | ||||
path: 'addsupplyCardBalance', | path: 'addsupplyCardBalance', | ||||
}] | }] | ||||
}] | }] | ||||
}, { | }, { | ||||
id: 24, | |||||
title: '系统管理', | title: '系统管理', | ||||
icon: 'Notification', | icon: 'Notification', | ||||
children: [{ | children: [{ | ||||
id: 25, | |||||
title: '菜单管理', | title: '菜单管理', | ||||
path: 'menu', | path: 'menu', | ||||
icon: 'Expand', | icon: 'Expand', | ||||
children: [] | children: [] | ||||
},{ | |||||
}, { | |||||
id: 26, | |||||
title: '用户管理', | title: '用户管理', | ||||
path: 'user', | path: 'user', | ||||
icon: 'User', | icon: 'User', | ||||
children: [] | children: [] | ||||
},{ | |||||
}, { | |||||
id: 27, | |||||
title: '角色管理', | title: '角色管理', | ||||
path: 'role', | path: 'role', | ||||
icon: 'UserFilled', | icon: 'UserFilled', | ||||
children: [] | children: [] | ||||
},{ | |||||
}, { | |||||
id: 28, | |||||
title: '部门管理', | title: '部门管理', | ||||
path: 'department', | path: 'department', | ||||
icon: 'HomeFilled', | icon: 'HomeFilled', |
<template> | <template> | ||||
<template v-for="item in list" :key="item.path"> | |||||
<template v-for="item in list" :key="item.id"> | |||||
<!-- 父级菜单 --> | <!-- 父级菜单 --> | ||||
<el-sub-menu | <el-sub-menu | ||||
v-if="item.children && item.children.length > 0" | v-if="item.children && item.children.length > 0" |
<!-- 菜单主体部分 height="100%" --> | <!-- 菜单主体部分 height="100%" --> | ||||
<div class="as-border-width" style="height: 100%; background-color: #ffffff"> | <div class="as-border-width" style="height: 100%; background-color: #ffffff"> | ||||
<el-scrollbar max-height="90%"> | |||||
<el-scrollbar max-height="90%" wrap-class="scrollbar-wrapper"> | |||||
<el-menu :default-active="menuIndex.menuIndex" mode="vertical" :router="false" @select="select" | <el-menu :default-active="menuIndex.menuIndex" mode="vertical" :router="false" @select="select" | ||||
:collapse="!menuStart.menuIsExpansion" class="el-menu-vertical-demo"> | :collapse="!menuStart.menuIsExpansion" class="el-menu-vertical-demo"> | ||||
<sidebar-item :list="list" /> | |||||
<sidebar-item :list="itemMenuData" /> | |||||
</el-menu> | </el-menu> | ||||
</el-scrollbar> | </el-scrollbar> | ||||
</div> | </div> | ||||
<!-- 头部 height: 8%;--> | <!-- 头部 height: 8%;--> | ||||
<div style="background-color: #ffffff; padding: 10px 0px 10px 0px"> | <div style="background-color: #ffffff; padding: 10px 0px 10px 0px"> | ||||
<!-- 选项卡 --> | <!-- 选项卡 --> | ||||
<tab-container> </tab-container> | |||||
<tab-container></tab-container> | |||||
<!-- 主体内容页面 --> | <!-- 主体内容页面 --> | ||||
<router-view name="key"></router-view> | |||||
<!-- <router-view name="key"></router-view> --> | |||||
<!-- 路由缓存 https://blog.csdn.net/kDevelop/article/details/122036896 --> | <!-- 路由缓存 https://blog.csdn.net/kDevelop/article/details/122036896 --> | ||||
<!-- <router-view name="key" v-slot="{ Component }"> | |||||
<keep-alive style="height:100vh"> | |||||
<component :is="Component" /> | |||||
</keep-alive> | |||||
</router-view> --> | |||||
<router-view name="key" v-slot="{ Component }"> | |||||
<!-- style="height:100vh" --> | |||||
<keep-alive> | |||||
<component :is="Component" /> | |||||
</keep-alive> | |||||
</router-view> | |||||
</div> | </div> | ||||
</div> | </div> | ||||
</el-scrollbar> | </el-scrollbar> | ||||
import BgTwo from '@/assets/video/homeBg.mp4' //视频资源 | import BgTwo from '@/assets/video/homeBg.mp4' //视频资源 | ||||
import $store from '@/store/index' // 引入vuex | import $store from '@/store/index' // 引入vuex | ||||
import $storeTab from '@/store/tabValue' //引入tab vuex | import $storeTab from '@/store/tabValue' //引入tab vuex | ||||
import { list } from '@/data/menuData' | |||||
import { ref, reactive, onMounted } from 'vue' | |||||
import { list, getMenuData } from '@/data/menuData' | |||||
import { ref, reactive, onMounted, getCurrentInstance } from 'vue' | |||||
import { useRouter } from 'vue-router' | import { useRouter } from 'vue-router' | ||||
const bgVideo = BgTwo | const bgVideo = BgTwo | ||||
//默认菜单为打开状态 | //默认菜单为打开状态 | ||||
let menuStart = ref($store.state.data) | let menuStart = ref($store.state.data) | ||||
let menuIndex = ref($storeTab.state.editableTabsValue) | let menuIndex = ref($storeTab.state.editableTabsValue) | ||||
let itemMenuData = ref(list) | |||||
const { | |||||
proxy | |||||
}: any = getCurrentInstance(); | |||||
//获取菜单数据 | |||||
getMenuData(proxy, (res: any) => { | |||||
itemMenuData.value = res | |||||
}, (err: any) => { }) | |||||
//处理刷新页面重置问题 | //处理刷新页面重置问题 | ||||
onMounted(() => { | onMounted(() => { | ||||
const newTab = sessionStorage.getItem('newTab') | const newTab = sessionStorage.getItem('newTab') | ||||
type: 1, | type: 1, | ||||
data: dataTabs, | data: dataTabs, | ||||
} | } | ||||
console.log(dataTabs); | |||||
$storeTab.dispatch('addTab', value) | $storeTab.dispatch('addTab', value) | ||||
$storeTab.dispatch('updateETV', 1 + '') | $storeTab.dispatch('updateETV', 1 + '') | ||||
$storeTab.dispatch('updateMI', `${dataTabs.title},${dataTabs.path}`) | $storeTab.dispatch('updateMI', `${dataTabs.title},${dataTabs.path}`) | ||||
}) | }) | ||||
} | } | ||||
sessionStorage.removeItem('newTab') | sessionStorage.removeItem('newTab') | ||||
//监听页面卸载(关闭)或刷新 | |||||
// window.addEventListener('beforeunload', () => beforeunloadHandler()) | |||||
// window.addEventListener('unload', () => unloadHandler()) | |||||
}) | }) | ||||
//返回首页 | //返回首页 | ||||
.bg-theme { | .bg-theme { | ||||
background-color: $test-color; | background-color: $test-color; | ||||
} | } | ||||
/* 去除进度条圆角 */ | |||||
::v-deep .el-progress-bar__outer { | |||||
border-radius: 0; | |||||
} | |||||
::v-deep .el-progress-bar__inner { | |||||
border-radius: 0; | |||||
} | |||||
</style> | </style> |
import { isValidKey } from '@/utils/utils' | import { isValidKey } from '@/utils/utils' | ||||
//请求 | //请求 | ||||
import * as request from '@/api/index' | import * as request from '@/api/index' | ||||
//全局配置 | |||||
import { system } from '@/config' | |||||
//导出表格 | //导出表格 | ||||
//import JsonExcel from 'vue-json-excel' | //import JsonExcel from 'vue-json-excel' | ||||
//app.component('downloadExcel', JsonExcel) | //app.component('downloadExcel', JsonExcel) | ||||
//全局注册请求 | //全局注册请求 | ||||
app.config.globalProperties.$request = request; | app.config.globalProperties.$request = request; | ||||
app.config.globalProperties.$system = system; | |||||
app.use(router) | app.use(router) | ||||
.use(Fragment.Plugin) | .use(Fragment.Plugin) | ||||
.use(ElementPlus, { // 使用element-plus | .use(ElementPlus, { // 使用element-plus |
import { createRouter, createWebHashHistory, RouteRecordRaw } from 'vue-router' | import { createRouter, createWebHashHistory, RouteRecordRaw } from 'vue-router' | ||||
import Cookies from 'js-cookie' | import Cookies from 'js-cookie' | ||||
import { nextTick, getCurrentInstance } from 'vue'; | |||||
//菜单数据处理 | |||||
function backMenu() { | |||||
const { | |||||
proxy | |||||
}: any = getCurrentInstance(); | |||||
proxy.$request.post('/menu/list', {}, { | |||||
baseURL: 'http://localhost:8081/' | |||||
}).then((res: any) => { | |||||
console.log(res.data); | |||||
res.data.forEach((item: any) => { | |||||
const menu = { | |||||
path: '/views/home', | |||||
name: 'home', | |||||
meta: { title: '主页', isAuth: true }, //用户自定内容 | |||||
components: { | |||||
key: () => import('@/views/system/home/Home.vue'), | |||||
}, | |||||
} | |||||
}); | |||||
}).catch((err: any) => { | |||||
console.log(err, '====456'); | |||||
}) | |||||
} | |||||
// component: () => import('') 异步加载 | // component: () => import('') 异步加载 | ||||
const routes: RouteRecordRaw[] = [ | const routes: RouteRecordRaw[] = [ | ||||
{ | { | ||||
path: '/', | |||||
name: 'Login', | |||||
component: () => import('@/views/system/login/Login.vue'), | |||||
path: '/', //路由地址 | |||||
name: 'Login', //路由名称 | |||||
component: () => import('@/views/system/login/Login.vue'),//路由页面 | |||||
}, | }, | ||||
{ | { | ||||
path: '/404', | path: '/404', | ||||
name: '404', | name: '404', | ||||
component: () => import('@/views/features/404.vue'), | component: () => import('@/views/features/404.vue'), | ||||
}, | }, | ||||
{ | { | ||||
path: '/layout/index', | path: '/layout/index', | ||||
name: 'Layout', | name: 'Layout', | ||||
//新增前置路由首位 | //新增前置路由首位 | ||||
router.beforeEach((to, from, next) => { | router.beforeEach((to, from, next) => { | ||||
console.log(to.path, to, from); | |||||
if (to.name) { | if (to.name) { | ||||
if (to.meta.isAuth) { //是否需要验证权限 | if (to.meta.isAuth) { //是否需要验证权限 | ||||
if (Cookies.get('token')) { | if (Cookies.get('token')) { | ||||
next() //继续往下 | |||||
nextTick(() => { | |||||
next() //继续往下 | |||||
}) | |||||
} else { | } else { | ||||
next({ name: 'Login' }); //没登录,跳转到login页 | next({ name: 'Login' }); //没登录,跳转到login页 | ||||
} | } | ||||
} else { | } else { | ||||
next() //继续往下 | |||||
nextTick(() => { | |||||
next() //继续往下 | |||||
}) | |||||
} | } | ||||
} else { //页面不存在 | } else { //页面不存在 | ||||
next({ name: '404' }); | next({ name: '404' }); | ||||
} | } | ||||
}) | }) | ||||
export default router | export default router |
}, | }, | ||||
//更新ETV | //更新ETV | ||||
UpdateETV(state, value) { | UpdateETV(state, value) { | ||||
console.log(value); | |||||
state.editableTabsValue.index = value; | state.editableTabsValue.index = value; | ||||
}, | }, | ||||
//更新MI | //更新MI |
</script> | </script> | ||||
<style scoped> | <style scoped> | ||||
/*数字文本框文本对齐方式 */ | /*数字文本框文本对齐方式 */ | ||||
/deep/ .el-input-number .el-input__inner { | |||||
::v-deep .el-input-number .el-input__inner { | |||||
text-align: left; | text-align: left; | ||||
} | } | ||||
/deep/.el-range-editor.el-input__inner { | |||||
::v-deep .el-range-editor.el-input__inner { | |||||
display: inline-flex; | display: inline-flex; | ||||
align-items: center; | align-items: center; | ||||
padding: 3px 10px; | padding: 3px 10px; |
</script> | </script> | ||||
<style scoped> | <style scoped> | ||||
/*数字文本框文本对齐方式 */ | /*数字文本框文本对齐方式 */ | ||||
/deep/ .el-input-number .el-input__inner { | |||||
::v-deep .el-input-number .el-input__inner { | |||||
text-align: left; | text-align: left; | ||||
} | } | ||||
/deep/.el-range-editor.el-input__inner { | |||||
::v-deep .el-range-editor.el-input__inner { | |||||
display: inline-flex; | display: inline-flex; | ||||
align-items: center; | align-items: center; | ||||
padding: 3px 10px; | padding: 3px 10px; |
Lock | Lock | ||||
} from '@element-plus/icons-vue' | } from '@element-plus/icons-vue' | ||||
import Cookies from 'js-cookie' | import Cookies from 'js-cookie' | ||||
import SlideImgThreePng from '@/assets/image/slide_img_three.png'; | |||||
import SlideImgThreePng from '@/assets/image/three.jpg'; | |||||
//@ts-ignore 引入滑块组件 | //@ts-ignore 引入滑块组件 | ||||
import SlidingBlockVerifyTwo from '@/components/SlidingBlockVerifyTwo/SlidingBlockVerifyTwo.vue' | import SlidingBlockVerifyTwo from '@/components/SlidingBlockVerifyTwo/SlidingBlockVerifyTwo.vue' | ||||
const slidingBlock = reactive({ | const slidingBlock = reactive({ | ||||
marginTop: 100, //10-150 | marginTop: 100, //10-150 | ||||
marginLeft: 100, //80-220 | marginLeft: 100, //80-220 | ||||
bgImg: "http://localhost:2222/滑块/one.jpg" | |||||
// bgImg: "http://localhost:2222/slide_img_three.jpg" | |||||
// bgImg: "http://localhost:2222/slide_img_four.jpg" | |||||
bgImg: SlideImgThreePng | |||||
}) | }) | ||||
const refresh = () => { | const refresh = () => { | ||||
proxy.$request.post('initialValue', {}, { | proxy.$request.post('initialValue', {}, { | ||||
baseURL: 'http://localhost:8081/' | baseURL: 'http://localhost:8081/' | ||||
}).then((res: any) => { | }).then((res: any) => { | ||||
console.log(res.data); | |||||
slidingBlock.marginTop = res.data.coordinateX | slidingBlock.marginTop = res.data.coordinateX | ||||
slidingBlock.marginLeft = res.data.coordinateY | slidingBlock.marginLeft = res.data.coordinateY | ||||
slidingBlock.bgImg = res.data.background | slidingBlock.bgImg = res.data.background |
<template> | <template> | ||||
<crud-template :home-data="field" :tableData="list"> | |||||
<crud-template v-if="itemStart" ref="crud" :home-data="field" :tableData="initMenuData" @cancel="cancel" | |||||
@submit="submit" @handleEdit="handleEdit"> | |||||
<template #search="{ searchCondition }"> | <template #search="{ searchCondition }"> | ||||
<el-input v-model="searchCondition.fileTwo" clearable placeholder="输入名称或邮箱名称" style="width: 200px;" /> | <el-input v-model="searchCondition.fileTwo" clearable placeholder="输入名称或邮箱名称" style="width: 200px;" /> | ||||
<div> | <div> | ||||
start-placeholder="开始日期" end-placeholder="结束日期" style="margin: 0 10px 0 10px;" /> | start-placeholder="开始日期" end-placeholder="结束日期" style="margin: 0 10px 0 10px;" /> | ||||
</div> | </div> | ||||
</template> | </template> | ||||
<template #dialog> | |||||
<el-form :model="item" ref="ruleFormRef" :rules="rules"> | |||||
<el-form-item class="as-bold" :label-width="labelWidth" label="菜单类型"> | |||||
<el-radio-group v-model="item.menuType" @change="change"> | |||||
<el-radio-button :label="0"> | |||||
目录 | |||||
</el-radio-button> | |||||
<el-radio-button :label="1"> | |||||
菜单 | |||||
</el-radio-button> | |||||
</el-radio-group> | |||||
</el-form-item> | |||||
<el-form-item class="as-bold" :label-width="labelWidth" :label="`${menuTitle}图标`"> | |||||
<div style="width: 100%"> | |||||
<el-input v-model="item.menuIoc" placeholder="请输入图标名称"></el-input> | |||||
</div> | |||||
</el-form-item> | |||||
<el-form-item class="as-bold" :label-width="labelWidth" :label="`${menuTitle}标题`" prop="menuTitle"> | |||||
<div style="width: 100%"> | |||||
<el-input v-model="item.menuTitle" :placeholder="`请输入${menuTitle}标题`"></el-input> | |||||
</div> | |||||
</el-form-item> | |||||
<el-form-item v-if="item.menuType === 1" class="as-bold" :label-width="labelWidth" label="路由地址" prop="menuUrl"> | |||||
<div style="width: 100%"> | |||||
<el-input v-model="item.menuUrl" placeholder="请输入路由地址"></el-input> | |||||
</div> | |||||
</el-form-item> | |||||
<div class="as-layout-horizontal"> | |||||
<el-form-item class="as-bold" :label-width="labelWidth" label="页面名称" prop="menuName"> | |||||
<div style="width: 100%"> | |||||
<el-input v-model="item.menuName" placeholder="请输入页面名称"></el-input> | |||||
</div> | |||||
</el-form-item> | |||||
<el-form-item class="as-bold" :label-width="labelWidth" :label="`${menuTitle}排序`"> | |||||
<div v-show="false"> | |||||
{{ item.menuSort = Number(item.menuSort) }} | |||||
</div> | |||||
<el-input-number :min="0" class="el-input-number" v-model="item.menuSort" style="width: 100%;" | |||||
controls-position="right"> | |||||
</el-input-number> | |||||
</el-form-item> | |||||
</div> | |||||
<el-form-item class="as-bold" :label-width="labelWidth" label="上级类目" prop="menuFatherId"> | |||||
<el-tree-select v-if="item.menuType === 0" check-strictly :props="props" :data="itemMenuData" | |||||
v-model="item.menuFatherId" style="width: 100%;" /> | |||||
<el-tree-select v-else check-strictly :props="props" :data="initMenuData" v-model="item.menuFatherId" | |||||
style="width: 100%;" /> | |||||
</el-form-item> | |||||
</el-form> | |||||
</template> | |||||
</crud-template> | </crud-template> | ||||
</template> | </template> | ||||
<script lang="ts" setup> | <script lang="ts" setup> | ||||
// @ts-ignore crudFrom模板 | // @ts-ignore crudFrom模板 | ||||
import CrudTemplate from "@/crud/index.vue" | import CrudTemplate from "@/crud/index.vue" | ||||
import { | import { | ||||
list | |||||
list, | |||||
getMenuData | |||||
} from '@/data/menuData' | } from '@/data/menuData' | ||||
import { | |||||
ElNotification | |||||
} from 'element-plus' | |||||
import { nextTick, ref, reactive, getCurrentInstance, toRaw } from 'vue' | |||||
const { | |||||
proxy | |||||
}: any = getCurrentInstance(); | |||||
const labelWidth = '80px' | |||||
let initMenuData = ref(list) | |||||
let itemMenuData = ref([ | |||||
{ | |||||
title: '顶级类目', | |||||
id: 0, | |||||
children: [] | |||||
} | |||||
]) | |||||
let itemStart = ref(true) | |||||
const props = { | |||||
label: 'title', | |||||
value: 'id', | |||||
children: 'children' | |||||
} | |||||
const menuTitle = ref('目录') | |||||
const initItem = { | |||||
menuType: 0, | |||||
menuName: '', | |||||
menuTitle: '', | |||||
menuPath: '', | |||||
menuIoc: '', | |||||
menuSort: 0, | |||||
menuFatherId: '', | |||||
menuUrl: '', | |||||
} | |||||
//表单校验 | |||||
const crud: any = ref() | |||||
const ruleFormRef: any = ref() | |||||
const rules = reactive({ | |||||
menuTitle: [{ required: true, message: '请输入菜单标题', trigger: 'blur' }], | |||||
menuName: [{ required: true, message: '请输入菜单路径', trigger: 'blur' }], | |||||
menuUrl: [{ required: true, message: '请输入路由地址', trigger: 'blur' }], | |||||
menuFatherId: [{ required: true, message: '请选择上级类目', trigger: 'blur' }], | |||||
}) | |||||
let item: any = ref(initItem) | |||||
function initData() { | |||||
//获取菜单数据 | |||||
getMenuData(proxy,(res: any) => { | |||||
itemMenuData.value[0].children = res | |||||
initMenuData.value = res | |||||
itemStart.value = false | |||||
nextTick(() => { | |||||
itemStart.value = true | |||||
}) | |||||
}, (err: any) => { }) | |||||
} | |||||
//初始化数据 | |||||
initData() | |||||
//数据变化监听 | |||||
const change = (value: any) => { | |||||
item.value.menuFatherId = '' | |||||
menuTitle.value = value === 0 ? '目录' : '菜单' | |||||
} | |||||
//关闭弹窗 | |||||
const cancel = () => { | |||||
ruleFormRef.value.resetFields(); //重置提示 | |||||
item.value = JSON.parse(JSON.stringify(initItem)) //清空数据 | |||||
crud.value.reset() | |||||
} | |||||
//表单编辑按钮 | |||||
const handleEdit = (idx: any, row: any) => { | |||||
const data = toRaw(row); | |||||
//数据适配器 | |||||
item.value = { | |||||
id: data.id, | |||||
menuType: data.type, | |||||
menuName: data.path, | |||||
menuTitle: data.title, | |||||
menuPath: data.name, //页面路径 | |||||
menuIoc: data.icon, | |||||
menuSort: data.menuSort ? data.menuSort : 0, | |||||
menuFatherId: data.fatherId, | |||||
menuUrl: data.url, //路由路径 | |||||
} | |||||
} | |||||
const submit = () => { | |||||
console.log(crud.value.title); | |||||
ruleFormRef.value.validate((valid: any, fields: any) => { | |||||
if (valid) { | |||||
const url = crud.value.title === '添加' ? '/menu/add' : '/menu/update' | |||||
proxy.$request.post(url, item.value, { | |||||
baseURL: 'http://localhost:8081/' | |||||
}).then((res: any) => { | |||||
item.value = JSON.parse(JSON.stringify(initItem)) | |||||
crud.value.reset() | |||||
ElNotification({ | |||||
title: '提示', | |||||
message: `${crud.value.title}成功!`, | |||||
type: 'success', | |||||
}) | |||||
nextTick(() => { | |||||
initData() | |||||
}) | |||||
}).catch((err: any) => { | |||||
ElNotification({ | |||||
title: '提示', | |||||
message: `${crud.value.title}失败!`, | |||||
type: 'error', | |||||
}) | |||||
}) | |||||
} else { | |||||
return false | |||||
} | |||||
}) | |||||
} | |||||
const field = { | const field = { | ||||
rowKey: 'title', | |||||
rowKey: 'id', //展开数据的主键(关键) | |||||
searchShow: true, | searchShow: true, | ||||
crudShow: true, | crudShow: true, | ||||
dialogCustom: true, | |||||
field: [{ | field: [{ | ||||
prop: 'title', | prop: 'title', | ||||
label: '菜单标题', | label: '菜单标题', | ||||
} | } | ||||
</script> | </script> | ||||
<style scoped> | <style scoped> | ||||
/deep/.el-range-editor.el-input__inner { | |||||
::v-deep .el-range-editor.el-input__inner { | |||||
display: inline-flex; | |||||
align-items: center; | |||||
padding: 3px 10px; | |||||
height: 33px; | |||||
width: 300px; | |||||
} | |||||
/*数字文本框文本对齐方式 */ | |||||
::v-deep .el-input-number .el-input__inner { | |||||
text-align: left; | |||||
} | |||||
::v-deep .el-range-editor.el-input__inner { | |||||
display: inline-flex; | display: inline-flex; | ||||
align-items: center; | align-items: center; | ||||
padding: 3px 10px; | padding: 3px 10px; |
</script> | </script> | ||||
<style scoped> | <style scoped> | ||||
/deep/.el-range-editor.el-input__inner { | |||||
::v-deep .el-range-editor.el-input__inner { | |||||
display: inline-flex; | display: inline-flex; | ||||
align-items: center; | align-items: center; | ||||
padding: 3px 10px; | padding: 3px 10px; |
</script> | </script> | ||||
<style scoped> | <style scoped> | ||||
/deep/.el-range-editor.el-input__inner { | |||||
::v-deep .el-range-editor.el-input__inner { | |||||
display: inline-flex; | display: inline-flex; | ||||
align-items: center; | align-items: center; | ||||
padding: 3px 10px; | padding: 3px 10px; |