提交 3a5b9b6a 编写于 作者: 刘英杰's avatar 刘英杰

值班管理pc

上级 1dde1b52
......@@ -329,7 +329,6 @@
// dept_name:'测',
// watch_hour_time:'2023-8-1',
},
rulesDutyDataInput: {
key_name: [{type: 'string', required: true, message: '姓名或工号不能为空!', trigger: 'blur'}],
watch_date: [{type: 'string', required: true, message: '值班日期不能为空!', trigger: 'change'}],
......@@ -360,7 +359,6 @@
watch_hour_id: [{type: 'string', required: true, message: '值班时段不能为空!', trigger: 'change'}],
watchtypeid: [{type: 'string', required: true, message: '值班校区不能为空!', trigger: 'change'}],
dept_id: [{type: 'string', required: true, message: '值班部门不能为空!', trigger: 'change'}],
},
addDutyLoading: true,
addDuty: false,
......@@ -540,7 +538,7 @@
await this.getWatchList()
this.dutyModelImportModal = false
}
return false
},
dutyModelFormatError(file, fileList) {
......
......@@ -83,7 +83,8 @@
</ButtonGroup>
</template>
<Table :columns="column" :data="data" @on-select="radioSelection" @on-select-cancel="cancelSelection"
<Table :columns="column" :data="data" :loading="loading" @on-select="radioSelection"
@on-select-cancel="cancelSelection"
@on-select-all="allSelection" @on-select-all-cancel="cancelSelectionAll">
<template #sign_set="{row}">
<Switch @on-change="switchButton(row)" :value="!row.sign_set" true-color="#22d86e">
......@@ -199,6 +200,7 @@
data() {
//这里存放数据",
return {
loading: false,
signArray: [],
buttonLoding: false,
selectList: [],
......@@ -505,7 +507,7 @@
},
async GetSignRecordList() {
this.$Spin.show()
this.loading = true
let data = {
"dep_id": this.selectObject.dept_idSearch,
"key_name": this.selectObject.key_nameSearch,
......@@ -526,7 +528,7 @@
this.data = res.response.data
this.total = res.response.data_count
this.publicMessage(res)
this.$Spin.hide()
this.loading = false
console.log("🚀🚀🚀,", res)
},
......
......@@ -14,6 +14,16 @@ import Cookies from 'js-cookie';
Vue.use(VueRouter);
function getUrlKey(name) {
return (
decodeURIComponent(
(new RegExp("[?|&]" + name + "=" + "([^&;]+?)(&|#|;|$)").exec(
location.href
) || [, ""])[1].replace(/\+/g, "%20")
) || null
);
}
// 导出路由 在 main.js 里使用
const router = new VueRouter({
routes,
......@@ -25,6 +35,15 @@ const router = new VueRouter({
* 路由拦截
* 权限验证
*/
function getUrlKey(name) {
return (
decodeURIComponent(
(new RegExp("[?|&]" + name + "=" + "([^&;]+?)(&|#|;|$)").exec(
location.href
) || [, ""])[1].replace(/\+/g, "%20")
) || null
);
}
router.beforeEach(async (to, from, next) => {
console.log(to)
......@@ -33,22 +52,16 @@ router.beforeEach(async (to, from, next) => {
if (to.matched.some(_ => _.meta.auth)) {
// 这里依据 token 判断是否登录,可视情况修改
const token = util.cookies.get('token');
if (token && token !== 'undefined') {
next();
} else {
const token = Cookies.get('token');
const urlKey = getUrlKey('token');
if (urlKey) {
await store.dispatch('admin/account/ascLogin', {
"token": token
"token": urlKey
}, {root: true});
next();
// 没有登录的时候跳转到登录界面
// 携带上登陆成功之后需要跳转的页面完整路径
// next({
// name: 'login',
// query: {
// redirect: to.fullPath
// }
// });
} else if (token) {
next();
} else {
next({name: '403'});
}
} else {
// 不需要身份校验 直接通过
......
......@@ -34,9 +34,7 @@ export default {
name: '403',
})
} else if (res.response.access_token.token_content) {
console.log(res, '单点登录获取得token');
// 设置 cookie 一定要存 uuid 和 token 两个 cookie
// 整个系统依赖这两个数据进行校验和存储
// uuid 是用户身份唯一标识 用户注册的时候确定 并且不可改变 不可重复
......@@ -49,20 +47,21 @@ export default {
await api.GetTokenInfo().then(async res => { // 这个接口是解析单点返回的token(admin_token) 获取到用户信息 且每次请求都会带上此token(admin_token) 在请求拦截中配置
// console.log("GetTokenInfo方法获取用户信息",res.response);
util.cookies.set('userinfo', res.response);
resolve()
// store 赋值
// await dispatch('admin/user/set', res.response, { root: true });
// await dispatch('load', { loadOpenedTabs: Setting.page.loadOpenedTabs });
// 获取动态菜单
if (Setting.dynamicMenu) await dispatch('admin/menu/getMenuList', false, {root: true});
let Role = '管理员'
let split = res.response.role[0].split('"')
if (split.indexOf(Role) !== -1) {
resolve()
} else {
router.push({
name: '403',
})
}
// let Role = '管理员'
// let split = res.response.role[0].split('"')
// if (split.indexOf(Role) !== -1) {
// resolve()
// } else {
// router.push({
// name: '403',
// })
// }
})
......
Markdown 格式
0% or
您添加了 0 人 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册 或