Browse Source

修改扫码登录

dev
超级管理员 3 years ago
parent
commit
4fc7e4d324
  1. 2
      .env.production
  2. 2
      src/App.vue
  3. 9
      src/api/systemaccredit/systemapi.js
  4. 2
      src/permission.js
  5. 4
      src/utils/request.js
  6. 3
      src/utils/requestFile.js
  7. 4
      src/views/ce/index.vue
  8. 382
      src/views/login/wxLogin - 副本.vue
  9. 40
      src/views/login/wxLogin.vue
  10. 2
      src/views/permission/permissionSetting.vue
  11. 185
      src/views/purview/postpower.vue
  12. 209
      src/views/purview/postpower_black1.vue

2
.env.production

@ -4,4 +4,4 @@ ENV = 'production'
# base api # base api
VUE_APP_BASE_API = 'http://ginadmin.hxgk.group/api' VUE_APP_BASE_API = 'http://ginadmin.hxgk.group/api'
VUE_APP_BASE_API1 = 'http://ginadmin.hxgk.group/hrapi' VUE_APP_BASE_API1 = 'http://ginadmin.hxgk.group/hrapi'
VUE_APP_BASE_API2 = 'http://ginadmin.hxgk.group/fileapi' VUE_APP_BASE_API2 = 'http://ginadmin.hxgk.group/kpiapi'

2
src/App.vue

@ -46,7 +46,7 @@ export default {
window.addEventListener('hashchange',()=>{ window.addEventListener('hashchange',()=>{
var currentPath = window.location.hash.slice(1); // var currentPath = window.location.hash.slice(1); //
console.log('动态跳转------------->',currentPath)
if(this.$router.path !== currentPath){ if(this.$router.path !== currentPath){
console.log('动态跳转') console.log('动态跳转')
// this.$router.push(currentPath); // // this.$router.push(currentPath); //

9
src/api/systemaccredit/systemapi.js

@ -17,3 +17,12 @@ export const getSystemMenuThree = (data) => {
data: data data: data
}) })
} }
//编辑权限
export const editPower = (data) => {
return request({
url: '/powerpc/edit_power_new',
method: 'post',
data: data
})
}

2
src/permission.js

@ -13,7 +13,7 @@ const whiteList = ['/login'] // no redirect whitelist
router.beforeEach(async(to, from, next) => { router.beforeEach(async(to, from, next) => {
// start progress bar // start progress bar
NProgress.start() NProgress.start()
console.log("路由拦截---->",to)
// set page title // set page title
document.title = getPageTitle(to.meta.title) document.title = getPageTitle(to.meta.title)

4
src/utils/request.js

@ -58,7 +58,7 @@ service.interceptors.response.use(
*/ */
response => { response => {
const res = response.data const res = response.data
console.log("res.code") console.log("res.code---------->")
console.log(res.code) console.log(res.code)
// if the custom code is not 20000, it is judged as an error. // if the custom code is not 20000, it is judged as an error.
if (res.code !== 0) { if (res.code !== 0) {
@ -90,7 +90,7 @@ service.interceptors.response.use(
// return Promise.reject(Error).catch(Error=>{console.log(Error)}) // return Promise.reject(Error).catch(Error=>{console.log(Error)})
// return Promise.reject(new Error(res.msg || 'Error')) // return Promise.reject(new Error(res.msg || 'Error'))
} else { } else {
console.log("成功") console.log("成功---->",res)
return res return res
} }
}, },

3
src/utils/requestFile.js

@ -70,7 +70,8 @@ service.interceptors.response.use(
}) })
}) })
} }
return Promise.reject(new Error(res.msg || 'Error')) // return Promise.reject(new Error(res.msg || 'Error'))
return res
} else { } else {
return res return res
} }

4
src/views/ce/index.vue

@ -14,7 +14,7 @@ import { scancode } from '@/api/user'
} }
}, },
async created () { async created () {
console.log(this.$route.query) console.log("this.$route.query--->",this.$route.query)
setToken(this.$route.query.token) setToken(this.$route.query.token)
setKey(this.$route.query.key) setKey(this.$route.query.key)
this.$store.commit('user/setToken', this.$route.query.token) this.$store.commit('user/setToken', this.$route.query.token)
@ -35,7 +35,7 @@ import { scancode } from '@/api/user'
this.$store.commit('user/setUserInfo', res.data.userinfo) this.$store.commit('user/setUserInfo', res.data.userinfo)
this.$store.commit('user/setToken', res.data.token) this.$store.commit('user/setToken', res.data.token)
this.$store.commit('user/setKey', res.data.key) this.$store.commit('user/setKey', res.data.key)
console.log(JSON.parse(sessionStorage.getItem('userinfo'))) console.log("userinfo----------------->",JSON.parse(sessionStorage.getItem('userinfo')))
// this.$store.state. // this.$store.state.
this.$router.push('/') this.$router.push('/')
// this.$router.push('/') // this.$router.push('/')

382
src/views/login/wxLogin - 副本.vue

@ -0,0 +1,382 @@
<template>
<div id="userLayout">
<div class="login_panle">
<div class="login_panle_form" v-show="loginCard==1">
<div class="login_panle_form_title">
<!-- <img
class="login_panle_form_title_logo"
:src="$GIN_VUE_ADMIN.appLogo"
alt
/> -->
<p class="login_panle_form_title_p">恒信高科后台管理系统</p>
</div>
<el-form
ref="loginForm"
:model="loginForm"
:rules="rules"
@keyup.native.enter="submitForm"
>
<el-form-item prop="username">
<el-input v-model="loginForm.username" placeholder="请输入用户名">
<template #suffix>
<i class="el-input__icon el-icon-user" />
</template>
</el-input>
</el-form-item>
<el-form-item prop="password">
<el-input
v-model="loginForm.password"
:type="lock === 'lock' ? 'password' : 'text'"
placeholder="请输入密码"
>
<template #suffix>
<i
:class="'el-input__icon el-icon-' + lock"
@click="changeLock"
/>
</template>
</el-input>
</el-form-item>
<el-form-item style="position: relative" prop="captcha">
<el-input
v-model="loginForm.captcha"
name="logVerify"
placeholder="请输入验证码"
style="width: 60%"
/>
<div class="vPic">
<img
v-if="picPath"
:src="picPath"
alt="请输入验证码"
@click="loginVerify()"
/>
</div>
</el-form-item>
<el-form-item>
<el-button
type="primary"
style="width: 46%; margin-left: 25%"
@click="submitForm"
> </el-button
>
</el-form-item>
<el-row :gutter="20">
<el-col :span="12" style="text-align: center;color: #0082EF;" @click.native="loginType(1)">
账号登录
</el-col>
<el-col :span="12" style="text-align: center;color: #0082EF;" @click.native="loginType(2)">
扫码登录
</el-col>
</el-row>
</el-form>
</div>
<div class="login_panle_form" v-show="loginCard==2">
<div class="login_panle_form_title">
<!-- <img
class="login_panle_form_title_logo"
:src="$GIN_VUE_ADMIN.appLogo"
alt
/> -->
<p class="login_panle_form_title_p">恒信高科后台管理系统</p>
</div>
<div id="weChat" style="margin-left: 13px;"></div>
<el-row :gutter="20">
<el-col :span="12" style="text-align: center;color: #0082EF;" @click.native="loginType(1)">
账号登录
</el-col>
<el-col :span="12" style="text-align: center;color: #0082EF;" @click.native="loginType(2)">
扫码登录
</el-col>
</el-row>
<!-- <el-button type="primary" round @click="qyWx">授权</el-button> -->
</div>
<div class="login_panle_right" />
</div>
</div>
</template>
<script>
import { getToken, setToken, removeToken,setKey } from '@/utils/auth'
import { mapActions } from 'vuex'
import { captcha,mylogin,mysystemlogin,scancodelogin } from '@/api/user'
export default {
name: 'Login',
data() {
const checkUsername = (rule, value, callback) => {
if (value.length < 5) {
return callback(new Error('请输入正确的用户名'))
} else {
callback()
}
}
const checkPassword = (rule, value, callback) => {
if (value.length < 6) {
return callback(new Error('请输入正确的密码'))
} else {
callback()
}
}
return {
loginCard:2,
redirect: undefined,
curYear: 0,
lock: 'lock',
loginForm: {
username: '',
password: '',
captcha: '',
captchaId: ''
},
rules: {
username: [{ required: true, message: '请输入工号',trigger: 'blur' }],
password: [{ validator: checkPassword, trigger: 'blur' }],
captcha: [{ required: true, message: '请输入验证码', trigger: 'blur' },
{
min: 5,
max: 6,
message: '验证码格式不正确',
trigger: 'blur',
}]
},
logVerify: '',
picPath: ''
}
},
created() {
this.getWeChat()
this.loginVerify()
this.curYear = new Date().getFullYear()
},
watch: {
$route: {
handler: function(route) {
const query = route.query
if (query) {
this.redirect = query.redirect
this.otherQuery = this.getOtherQuery(query)
}
},
immediate: true
}
},
methods: {
...mapActions('user', ['myLoginIn']),
getWeChat () {
// js
const s = document.createElement('script')
s.type = 'text/javascript'
s.src = 'http://rescdn.qqmail.com/node/ww/wwopenmng/js/sso/wwLogin-1.0.0.js'
const wxElement = document.body.appendChild(s)
//
wxElement.onload = function () {
window.WwLogin({
id: 'weChat', // id
appid: 'ww02f310301953277a', // appid wx*******
agentid: '1000008', // agentid wx*******
scope: 'snsapi_login', //
redirect_uri: 'https%3A%2F%2Fwww.hxgk.group%2Fjumpapiurl%2Fscancode', // urlweChatBack
state: Math.ceil(Math.random() * 1000), // session
style: 'black', // "black""white"
href: '' // cssurlhttps
})
}
},
loginType(a){
console.log("aaa")
if (a==1) {
this.loginCard=1
}
if (a==2) {
this.loginCard=2
}
},
async checkInit() {
const res = await checkDB()
if (res.code === 0) {
if (res.data?.needInit) {
this.$store.commit('user/NeedInit')
this.$router.push({ name: 'Init' })
} else {
this.$message({
type: 'info',
message: '已配置数据库信息,无法初始化'
})
}
}
},
// async login() {
// return await this.myLoginIn(this.loginForm)
// },
qyWx(){
window.location.href="https://open.weixin.qq.com/connect/oauth2/authorize?appid=ww02f310301953277a&redirect_uri=https%3A%2F%2Fwww.hxgk.group%2Fjumpapiurl%2Fscancode%3Fcontroll%3Dshiyan%26id%3D123456%26num%3D654321&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect"
},
async submitForm() {
this.$refs.loginForm.validate(async(v) => {
if (v) {
// const flag = await this.login()
const res = await scancodelogin(this.loginForm)
if (res.code === 0) {
setToken(res.data.token)
setKey(res.data.key)
console.log("res.data.userinfo")
console.log(res.data.userinfo)
// this.$store.commit('saveCurrDbSource',this.db)
sessionStorage.setItem('userinfo',JSON.stringify(res.data.userinfo));
this.$store.commit('user/setUserInfo', res.data.userinfo)
this.$store.commit('user/setToken', res.data.token)
this.$store.commit('user/setKey', res.data.key)
console.log("this.$store.state.user.token")
console.log(this.$store.state.user.token)
console.log("this.$store.state.user.userInfo")
console.log(this.$store.state.user.userInfo)
console.log("this.$store.state.user.key")
console.log(this.$store.state.user.key)
// this.$store.state.
this.$router.push('/')
// this.$router.push('/')
this.loading = false
}
} else {
this.$message({
type: 'error',
message: '请正确填写登录信息',
showClose: true
})
this.loginVerify()
return false
}
})
},
getOtherQuery(query) {
return Object.keys(query).reduce((acc, cur) => {
if (cur !== 'redirect') {
acc[cur] = query[cur]
}
return acc
}, {})
},
changeLock() {
this.lock = this.lock === 'lock' ? 'unlock' : 'lock'
},
loginVerify() {
captcha({}).then((ele) => {
this.picPath = ele.data.picPath
this.loginForm.captchaId = ele.data.captchaId
})
}
}
}
</script>
<style lang="scss" scoped>
#userLayout {
margin: 0;
padding: 0;
//background-image: url("@/assets/login_background.jpg");
// background-image: url("../assets/login_background.jpg");
background-image: url("../../assets/404_images/login_background.jpg");
background-size: cover;
width: 100%;
height: 100%;
position: relative;
.login_panle {
position: absolute;
top: 3vh;
left: 2vw;
width: 96vw;
height: 94vh;
background-color: rgba(255, 255, 255, .8);
backdrop-filter: blur(5px);
border-radius: 10px;
display: flex;
align-items: center;
justify-content: space-evenly;
.login_panle_right {
// background-image: url("../assets/login_left.svg");
background-image: url("../../assets/404_images/login_left.svg");
background-size: cover;
width: 40%;
height: 60%;
float: right !important;
}
.login_panle_form {
width: 420px;
background-color: #fff;
padding: 40px 40px 40px 40px;
border-radius: 10px;
box-shadow: 2px 3px 7px rgba(0, 0, 0, .2);
.login_panle_form_title {
display: flex;
align-items: center;
margin: 30px 0;
.login_panle_form_title_logo {
width: 90px;
height: 72px;
}
.login_panle_form_title_p {
font-size: 30px;
padding-left: 20px;
}
}
.vPic {
width: 33%;
height: 38px;
float: right !important;
background: #ccc;
img {
width: 100%;
height: 100%;
cursor: pointer;
vertical-align: middle;
}
}
}
.login_panle_foot {
position: absolute;
bottom: 20px;
.links {
display: flex;
align-items: center;
justify-content: space-between;
.link-icon {
width: 30px;
height: 30px;
}
}
.copyright {
color: #777777;
margin-top: 5px;
}
}
}
}
//
@media (max-width: 750px) {
.login_panle_right {
display: none;
}
.login_panle {
width: 100vw;
height: 100vh;
top: 0;
left: 0;
}
.login_panle_form {
width: 100%;
}
}
/*
powerBy : bypanghu@163.com
*/
</style>

40
src/views/login/wxLogin.vue

@ -145,7 +145,8 @@ export default {
} }
}, },
created() { created() {
this.getWeChat() // this.getWeChat()
this.getNewWeChatLogin()
this.loginVerify() this.loginVerify()
this.curYear = new Date().getFullYear() this.curYear = new Date().getFullYear()
}, },
@ -267,7 +268,44 @@ export default {
this.picPath = ele.data.picPath this.picPath = ele.data.picPath
this.loginForm.captchaId = ele.data.captchaId this.loginForm.captchaId = ele.data.captchaId
}) })
},
//
getNewWeChatLogin () {
// js
const s = document.createElement('script')
s.type = 'text/javascript'
// s.src = 'http://rescdn.qqmail.com/node/ww/wwopenmng/js/sso/wwLogin-1.0.0.js'
s.src = 'http://wwcdn.weixin.qq.com/node/wework/wwopen/js/wwLogin-1.2.7.js?v=1.2.7'
const wxElement = document.body.appendChild(s)
//
wxElement.onload = function () {
// window.WwLogin({
// id: 'weChat', // id
// appid: 'ww02f310301953277a', // appid wx*******
// agentid: '1000036', // agentid wx*******
// scope: 'snsapi_login', //
// redirect_uri: 'https%3A%2F%2Fkpi.hxgk.group%2Fjumpapiurl%2Fscancode', // urlweChatBack
// state: Math.ceil(Math.random() * 1000), // session
// style: 'black', // "black""white"
// href: '' // cssurlhttps
// })
var wwLogin = new WwLogin({
"id": "weChat",
"appid": "ww02f310301953277a",
"agentid": "1000036",
"redirect_uri": "https%3A%2F%2Fkpi.hxgk.group%2Fkpiapi%2Fbase%2Fscan_qrcode_callback%3Fvisit%3Dpc",
"state": Math.ceil(Math.random() * 1000),
"href": "",
"lang": "zh",
});
window.wwLogin
} }
},
} }
} }

2
src/views/permission/permissionSetting.vue

@ -42,7 +42,7 @@
<div class="tabletop" style="width:180px;border: 1px solid #DCDFE6;padding: 5px;height: 48px;padding: 12px 0;font-weight: 500;text-overflow: ellipsis;text-align: left;color: #909399;font-size: 14px;padding-left: 10px;"> <div class="tabletop" style="width:180px;border: 1px solid #DCDFE6;padding: 5px;height: 48px;padding: 12px 0;font-weight: 500;text-overflow: ellipsis;text-align: left;color: #909399;font-size: 14px;padding-left: 10px;">
<el-checkbox v-model="checked">全选</el-checkbox> <el-checkbox v-model="checked">全选</el-checkbox>
</div> </div>
<div v-for="(iteam,index) in tableData" style="width:180px;border: 0.5px solid #DCDFE6;height: 104px;font-weight: 500;text-overflow: ellipsis;text-align: left;font-size: 14px;padding-left: 10px;padding: 12px 5px;line-height: 4.15;padding-left: 10px;"> <div v-for="(iteam,index) in tableData" style="width:180px;border: 0.5px solid #DCDFE6;height: 104px;font-weight: 500;text-overflow: ellipsis;text-align: left;font-size: 14px;padding-left: 10px;padding: 12px 5px;line-height: 4.15;padding-left: 10px;" :key="index">
<el-checkbox v-model="checked">{{iteam.name}}</el-checkbox> <el-checkbox v-model="checked">{{iteam.name}}</el-checkbox>
</div> </div>
</div> </div>

185
src/views/purview/postpower.vue

@ -28,7 +28,20 @@
</div> </div>
</el-col> </el-col>
</el-row> </el-row>
<el-scrollbar style="max-height:95%"> <el-row>
<el-col :span="24" class="xxCard">
<el-radio-group v-model="viewRange" size="small">
<el-radio-button label="1">本岗位</el-radio-button>
<el-radio-button label="2">本部门</el-radio-button>
<el-radio-button label="3">本分部</el-radio-button>
<el-radio-button label="4" disabled>指定行政组织</el-radio-button>
<el-radio-button label="5">所有</el-radio-button>
</el-radio-group>
</el-col>
</el-row>
<el-scrollbar style="max-height:90%">
<el-table <el-table
:data="systemMenuList" :data="systemMenuList"
@ -39,21 +52,23 @@
:tree-props="{children: 'child', hasChildren: 'hasChildren'}"> :tree-props="{children: 'child', hasChildren: 'hasChildren'}">
<el-table-column <el-table-column
label="菜单名称" label="菜单名称"
width="180"> >
<template slot-scope="scope"> <template slot-scope="{ row }">
<el-checkbox v-model="scope.row.istrue" :label="scope.row.name"></el-checkbox> <el-checkbox v-model="row.istrue" :label="row.name" @change="menuSelect(row)"></el-checkbox>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
label="操作" label="操作"
> >
<template slot-scope="scope"> <template slot-scope="{ row }">
<el-checkbox v-model="mItem.istrue" v-for="(mItem,mIndex) in scope.row.menuOperation" :label="mItem.name" :key="mIndex"></el-checkbox> <el-checkbox v-model="mItem.istrue" v-for="(mItem,mIndex) in row.menuOperation" :label="mItem.name" :key="mIndex" @change="menuOperationSelect(row,mItem)"></el-checkbox>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<div style="margin: 2px 0 20px 0;">
<el-button type="primary" :loading="buttonLoading" @click="subewport">确定授权</el-button> <el-button type="primary" :loading="buttonLoading" @click="subewport">确定授权</el-button>
</div>
</el-scrollbar> </el-scrollbar>
</el-main> </el-main>
@ -62,11 +77,13 @@
<script>//systemaccredit <script>//systemaccredit
import { govthree, positionlist } from "@/api/personnel/post"; // import { govthree, positionlist } from "@/api/personnel/post"; //
import { getsystemlist,getSystemMenuThree } from "@/api/systemaccredit/systemapi"; // import { getsystemlist,getSystemMenuThree,editPower } from "@/api/systemaccredit/systemapi"; //
import { MessageBox, Message } from 'element-ui'
// //
export default { export default {
data () { data () {
return { return {
viewRange:2, //
buttonLoading:false, buttonLoading:false,
choiceSystem:'kpi', choiceSystem:'kpi',
systemList:[], systemList:[],
@ -129,6 +146,7 @@ export default {
}, },
// //
clickPost(val){ clickPost(val){
console.log("选择职务-----》",val)
this.orgAndPost.postId = val.id; this.orgAndPost.postId = val.id;
this.getAboutSystemMenu() this.getAboutSystemMenu()
}, },
@ -136,7 +154,8 @@ export default {
// //
systemChange(val){ systemChange(val){
console.log("选择系统-----》",val) console.log("选择系统-----》",val)
this.orgAndPost.choiceSystem = val
this.getAboutSystemMenu()
}, },
// //
async getAboutSystemMenu(){ async getAboutSystemMenu(){
@ -148,15 +167,156 @@ export default {
const res = await getSystemMenuThree(from); const res = await getSystemMenuThree(from);
console.log("系统菜单树-----》",res) console.log("系统菜单树-----》",res)
res.data.forEach(item =>{ res.data.forEach(item =>{
console.log("系统菜单树-----》",item) // console.log("-----",item)
}) })
this.systemMenuList = res.data; this.systemMenuList = res.data;
}, },
// //
subewport(){ async subewport(){
this.buttonLoading = true this.buttonLoading = true
console.log("提交授权-----》",this.systemMenuList) console.log("提交授权-----》",this.systemMenuList)
const from = {
systemname: this.choiceSystem,
ordid:this.orgAndPost.orgId.toString(),
postid:this.orgAndPost.postId.toString(),
level:this.viewRange,
power:this.systemMenuList
};
const res = await editPower(from);
console.log("系统菜单树-----》",res)
if (res.code != 0){
this.buttonLoading = false
}else{
Message({
message: res.msg || 'success',
type: 'success',
duration: 5 * 1000
})
this.buttonLoading = false
this.orgAndPost.orgId = ""
this.orgAndPost.postId = ""
this.viewRange = 2
this.postList = []
this.systemInit(); //
}
},
//
menuSelect(val){
// console.log("-----",val)
if(val.menuOperation){
val.menuOperation.forEach(item =>{
item.istrue = val.istrue
})
}
if(val.child){
this.menuSunDigui(val.child,val.istrue)
}
if(val.parentid != "0"){
this.menuParentDigui(val.parentid,val.istrue)
}
},
//
menuSunDigui(childList,enterClick){
if(childList){
childList.forEach(cItem=>{
cItem.istrue = enterClick
if(cItem.menuOperation){
cItem.menuOperation.forEach(cmitem =>{
cmitem.istrue = enterClick
})
}
this.menuSunDigui(cItem.child,enterClick)
})
}else{
return
} }
},
//
menuParentDigui(parentId,enterClick){
// console.log("===>",parentId,enterClick);
if (parentId == "0") return;
if(enterClick == true){
}
let listAry = this.getParentId(this.systemMenuList,parentId,enterClick)
// console.log("==list==>",listAry);
},
getParentId(list,id,enterClick) {
for (let i in list) {
// console.log("==1==>",list[i].id,id);
if(list[i].id===id){
if(enterClick == true){
list[i].istrue = enterClick
}else{
if(list[i].child){
let falseNum = 0
list[i].child.forEach(lcItem =>{
if(lcItem.istrue){
falseNum++
}
})
if(falseNum <=0){
list[i].istrue = enterClick
}
}else{
list[i].istrue = enterClick
}
}
// console.log("==2==>",list[i],id);
return [list[i]]
}
if(list[i].child!=null){
let node = this.getParentId(list[i].child,id,enterClick);
if(node!==undefined){
if(enterClick == true){
list[i].istrue = enterClick
}else{
if(list[i].child){
let falseNum = 0
list[i].child.forEach(lcItem =>{
if(lcItem.istrue){
falseNum++
}
})
if(falseNum <=0){
list[i].istrue = enterClick
}
}else{
list[i].istrue = enterClick
}
}
// console.log("==3==>",list[i],id);
return node.concat(list[i])
}
}
}
},
//
menuOperationSelect(val,mation){
if (mation.istrue){
val.istrue = mation.istrue
}else{
var jiBuqian = 0
val.menuOperation.forEach(item =>{
if(!item.istrue){
jiBuqian++;
}
})
if(jiBuqian == val.menuOperation.length){
val.istrue = false
}
}
let listAry = this.getParentId(this.systemMenuList,val.parentid,mation.istrue)
}
}, },
} }
</script> </script>
@ -186,4 +346,7 @@ export default {
overflow-y: auto; overflow-y: auto;
overflow: scroll; overflow: scroll;
} }
.xxCard{
padding: 10px 0;
}
</style> </style>

209
src/views/purview/postpower_black1.vue

@ -0,0 +1,209 @@
<template>
<el-container>
<!-- 行政组织级 -->
<el-aside width="220px">
<el-scrollbar >
<el-tree style="margin-top:10px"
:data="orglist"
:props="treeStruct"
@node-click="clickOrg"
></el-tree>
</el-scrollbar>
</el-aside>
<el-aside width="200px">
<el-tree style="margin-top:10px"
:data="postList"
:props="treeStruct"
@node-click="clickPost"
></el-tree>
</el-aside>
<el-main>
<!--头部系统页面-->
<el-row>
<el-col :span="24">
<div>
<el-radio-group v-model="choiceSystem" size="medium" @change="systemChange">
<el-radio-button :label="sysItem.coder" v-for="(sysItem,sysIndex) in systemList" :key="sysIndex">{{sysItem.title}}</el-radio-button>
</el-radio-group>
</div>301200
</el-col>
</el-row>
<el-scrollbar style="max-height:95%">
<el-table
:data="systemMenuList"
style="width: 100%;margin-bottom: 20px;"
row-key="id"
border
default-expand-all
:tree-props="{children: 'child', hasChildren: 'hasChildren'}">
<el-table-column
label="菜单名称"
width="180">
<template slot-scope="{ row }">
<el-checkbox v-model="row.istrue" :label="row.name" @change="menuSelect(row)"></el-checkbox>
</template>
</el-table-column>
<el-table-column
label="操作"
>
<template slot-scope="{ row }">
<el-checkbox v-model="mItem.istrue" v-for="(mItem,mIndex) in row.menuOperation" :label="mItem.name" :key="mIndex" @change="menuOperationSelect(row,mItem)"></el-checkbox>
</template>
</el-table-column>
</el-table>
<el-button type="primary" :loading="buttonLoading" @click="subewport">确定授权</el-button>
</el-scrollbar>
</el-main>
</el-container>
</template>
<script>//systemaccredit
import { govthree, positionlist } from "@/api/personnel/post"; //
import { getsystemlist,getSystemMenuThree } from "@/api/systemaccredit/systemapi"; //
//
export default {
data () {
return {
isIndeterminate:{},
isIndeterminates:{},
buttonLoading:false,
choiceSystem:'kpi',
systemList:[],
//
orgAndPost:{
orgId:0,
postId:0
},
//
treeStruct: {
children: "child",
label: "name",
},
orglist:[], //
postList:[], //
systemMenuList:[], //
}
},
created() {
//
this.getOrgThree(); //
this.systemInit(); //
},
methods: {
//
async systemInit(){
const from = {
page: 1,
pagesize: 100000,
};
const res = await getsystemlist(from);
console.log("初始话要授权的系统----》",res.data)
this.systemList = res.data.list
if(res.data.list.length > 0){
this.choiceSystem = res.data.list[0].coder
}
this.getAboutSystemMenu(); //
},
//
async getOrgThree(){
const res = await govthree();
this.orglist = res.data
},
//
clickOrg(val){
this.getPost(val.id);
this.orgAndPost.orgId = val.id;
},
//
async getPost(val) {
const from = {
organization: val.toString(),
page: 1,
pagesize: 10,
};
const res = await positionlist(from);
this.postList = res.data.list;
},
//
clickPost(val){
this.orgAndPost.postId = val.id;
this.getAboutSystemMenu()
},
//
//
systemChange(val){
console.log("选择系统-----》",val)
},
//
async getAboutSystemMenu(){
const from = {
name: this.choiceSystem,
ordid:this.orgAndPost.orgId.toString(),
postid:this.orgAndPost.postId.toString(),
};
const res = await getSystemMenuThree(from);
console.log("系统菜单树-----》",res)
res.data.forEach(item =>{
console.log("系统菜单树-----》",item)
})
this.systemMenuList = res.data;
},
//
subewport(){
this.buttonLoading = true
console.log("提交授权-----》",this.systemMenuList)
},
//
menuSelect(val){
console.log("菜单级操作-----》",val)
console.log("菜单级操作-----》",JSON.stringify(this.isIndeterminate))
},
//
menuOperationSelect(val,mation){
console.log("按钮级操作-----》",val,mation)
// this.isIndeterminate[val.parentid] = mation.istrue
// this.isIndeterminates[mation.parentid] = mation.istrue
val.istrue = mation.istrue
console.log("按钮级操作--1---》",val.istrue,mation.istrue,this.isIndeterminate,this.isIndeterminates)
}
},
}
</script>
<style>
.el-aside {
text-align: center;
height: calc(103% - 2px);
overflow: hidden;
overflow-y: auto;
overflow-x: hidden;
border-right: 1px solid rgb(220, 223, 230);
margin: 2px 0 0 0;
padding-bottom: 10px;
}
.el-main{
height: 105%;
}
.el-container {
height:calc(100% - 50px);
overflow: hidden;
}
.el-scrollbar {
height: 100%;
}
.el-scrollbar__wrap {
overflow: hidden;
overflow-y: auto;
overflow: scroll;
}
</style>
Loading…
Cancel
Save