123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450 |
- <!--
- * @Author: your name
- * @Date: 2021-11-29 14:37:54
- * @LastEditTime: 2022-03-18 10:27:34
- * @LastEditors: your name
- * @Description: 角色管理
- * @FilePath: \Foshan4A2.0\src\views\authorityManagement\components\authorityRole.vue
- -->
- <template>
- <div class="authorityRoleHome">
- <!--状态和搜索-->
- <div style="justify-content: flex-end;" class="authority-head flex">
- <Search @getSearchData="getSearchData" @clearSearchData="clearSearchData" :isSlot="true">
- <button v-is="['officerlist_btn_add_officer']" @click="addRole" class="btnAdd">新增</button>
- </Search>
- </div>
- <!--列表-->
- <template v-if="arrs.length">
- <div class="role-content">
- <div class="scrollbar" v-infinite-scroll="load" :infinite-scroll-distance="20" infinite-scroll-disabled="disabled">
- <el-row :gutter="24">
- <el-col :span="6" v-for="(item,index) in arrs" class="account-left-content-teams" :key="index">
- <div class="team">
- <div class="list">
- <div class="flex info">
- <div class="info-avoutr">
- <div class="msg flex-wrap">
- <p :title="item.OfficerName" class="name">{{item.OfficerName}}</p>
- <div v-is="['officerlist_btn_edit']" @click="editRole(item)" class="cap cap-edit"></div>
- </div>
- </div>
- <div v-is="['officerlist_btn_del_officer']" class="info-close">
- <i @click="checkRemove(item,index)" class="icon el-icon-close"></i>
- </div>
- </div>
- <template v-if="doesJobShow">
- <div class="flex ip">
- <div class="time-info flex1">职务名称:<span :title="item.JobName" class="glr">{{item.JobName ? item.JobName : '暂无'}}</span></div>
- <!-- <div class="ip-info flex1">是否有副岗:<span class="glr">{{item.HasDepJob == 1 ? '是':'否'}}</span></div> -->
- </div>
- </template>
- <div class="flex time">
- <div class="time-msg flex1">所属组织:<span :title="item.OrganName" class="glr">{{item.OrganName}}</span></div>
- </div>
- <div class="flex ip">
- <div class="ip-msg flex1">登录名:<span :title="item.LoginName" class="glr">{{item.LoginName}}</span></div>
- <div style="margin-right:20px;" class="power">权限:<span class="glr">{{item.AuthCount}}</span></div>
- </div>
- <div class="flex details">
- <div class="details-msg">
- 状态:<span :class="item.Status == 1 ? 'success' : 'error'">{{item.Status == 1 ? '启用' : '停用'}}</span>
- </div>
- <div v-is="['officerlist_btn_state_switch']" class="details-info">
- <el-switch v-model="item.isauto" @change="handleChange(item)" active-color="#6F81BC">
- </el-switch>
- </div>
- </div>
- </div>
- </div>
- </el-col>
- </el-row>
- <template v-if="total > 1">
- <p class="center" v-if="loading">加载中...</p>
- <p class="center" v-if="noMore">没有更多数据了~</p>
- </template>
- </div>
- </div>
- </template>
- <template v-else>
- <el-empty description="暂无数据"></el-empty>
- </template>
- <!--删除弹框-->
- <Dialog :flag="flag">
- <div class="airportInfoDialog">
- <div class="title">删除职员</div>
- <div class="content">是否确认删除{{ title }}?</div>
- <div class="foot right t30">
- <el-button size="medium" class="r24" @click="remove" type="danger">删除</el-button>
- <el-button size="medium" @click="flag = false">取消</el-button>
- </div>
- </div>
- </Dialog>
- </div>
- </template>
- <script>
- import Search from '@/layout/components/Search'
- import Dialog from '@/layout/components/Dialog'
- import roleData from '../minixs/roleData'
- import { staffStart } from '@/api/postInterface'
- import { GetOfficerListByOrganId } from '@/api/jobApi'
- export default {
- name: 'AuthorityRole',
- components: { Search, Dialog },
- mixins: [roleData],
- data () {
- return {
- arrs: [], //卡片数据
- arrsCopy: [],
- flag: false,
- title: '',
- index: null,
- keyWords: '',
- pageNum: 1,
- PageSize: 20,
- loading: false,
- keyWords: '',
- total: null,
- search: null,
- num: null
- }
- },
- created () {
- const { OrganId, orgType, keyWords } = this.$route.query;
- if (OrganId && orgType == 'org') {
- this.OrganId = OrganId;
- this.orgType = orgType;
- this.getJobListByOrgan(OrganId);
- } else {
- if (keyWords) {
- this.keyWords = keyWords;
- }
- this.gueryRole({
- QueryName: this.keyWords,
- PageSize: this.PageSize,
- PageIndex: this.pageNum
- });
- }
- },
- computed: {
- noMore () {
- return this.pageNum >= this.total
- },
- disabled () {
- return this.loading || this.noMore
- }
- },
- methods: {
- //根据组织查询职员
- async getJobListByOrgan (OrganId) {
- try {
- const res = await GetOfficerListByOrganId({
- OrganId: OrganId
- });
- if (res.code === 0) {
- const datas = res.returnData.map(item => {
- item.isauto = item.Status == 1
- return item
- })
- this.arrs = datas
- this.pageNum = this.total = Math.ceil(datas.length / this.PageSize)
- } else {
- this.$message.error(res.message)
- }
- } catch (error) {
- console.log('出错了', error)
- }
- },
- //删除
- checkRemove (item, num) {
- this.flag = true
- this.index = item
- this.title = item.OfficerName
- this.num = num
- },
- //确认删除
- remove () {
- this.deleteRole(this.index.OfficerId, this.num)
- },
- //职员新增
- addRole () {
- this.$router.push('/staff/staffAdd')
- },
- //职员编辑
- editRole (item) {
- this.$router.push({ path: '/staff/staffEdit', query: { OfficerId: item.OfficerId, Status: item.Status } })
- },
- //查询
- getSearchData (val) {
- if (val) {
- this.$router.replace({ path: '/staff', query: { keyWords: val } })
- } else if (this.$route.query) {
- this.$router.replace('/staff')
- }
- this.arrs = []
- this.dataList = []
- this.pageNum = 1
- this.keyWords = val
- this.gueryRole({
- QueryName: val,
- PageSize: this.PageSize,
- PageIndex: this.pageNum
- })
- },
- //清除查询
- clearSearchData () {
- this.$router.replace('/staff')
- this.arrs = []
- this.dataList = []
- this.pageNum = 1
- this.keyWords = ''
- this.gueryRole({
- QueryName: this.keyWords,
- PageSize: this.PageSize,
- PageIndex: this.pageNum
- })
- },
- //状态变更
- async handleChange (item) {
- try {
- const { OfficerId, isauto } = item
- const Status = isauto ? 1 : 0
- const res = await staffStart({
- OfficerId: OfficerId,
- Status: Status
- })
- if (res.code === 0) {
- this.$message.success(res.message)
- this.arrs.forEach(item => {
- if (item.OfficerId == OfficerId) {
- item.isauto = isauto
- item.Status = Status
- }
- })
- } else {
- this.$message.error(res.message)
- }
- } catch (error) {
- console.log('出错了', error)
- }
- },
- //滚动加载数据
- load () {
- this.pageNum += 1
- this.gueryRole({
- QueryName: this.keyWords,
- PageSize: this.PageSize,
- PageIndex: this.pageNum
- })
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .authorityRoleHome {
- padding: 0 64px;
- }
- .authority-head {
- position: fixed;
- width: 100%;
- padding: 32px 64px;
- padding-left: 156px;
- left: 0;
- display: flex;
- flex-direction: row;
- justify-content: space-between;
- background: #f5f7fa;
- z-index: 100;
- line-height: 48px;
- .status {
- & > div {
- margin-right: 28px;
- .icon {
- width: 16px;
- height: 16px;
- background: #6f81bc;
- border-radius: 2px;
- display: inline-block;
- vertical-align: middle;
- margin-right: 10px;
- position: relative;
- top: -2px;
- }
- &:last-child {
- margin-right: 0;
- }
- }
- .status2 {
- .icon {
- background: #cfd6e2;
- }
- }
- }
- }
- .role-content {
- padding-top: 112px;
- height: calc(100vh - 144px);
- .scrollbar {
- height: 100%;
- overflow-y: auto;
- overflow-x: hidden;
- > p {
- margin: 0;
- }
- }
- .el-col-lg-5-5 {
- width: 20%;
- }
- .account-left-content-teams {
- position: relative;
- margin-bottom: 24px;
- .info-close {
- cursor: pointer;
- .icon {
- color: #303133;
- font-weight: 600;
- }
- }
- .list {
- .info {
- line-height: normal;
- margin-bottom: 19px;
- .name {
- font-size: 16px;
- font-weight: bold;
- }
- .cap {
- width: 24px;
- height: 24px;
- display: inline-block;
- background-repeat: no-repeat;
- background-size: cover;
- transition: all 0.3s;
- margin-left: 16px;
- cursor: pointer;
- &:first-child {
- margin-right: 0;
- }
- }
- .cap-plus {
- background-image: url("../../../assets/status/ic_plus.png");
- &:hover {
- background-image: url("../../../assets/status/ic_plus_hovar.png");
- }
- }
- .cap-edit {
- background-image: url("../../../assets/status/ic_edit.png");
- &:hover {
- background-image: url("../../../assets/status/ic_edit_hovar.png");
- }
- }
- .cap-sub {
- background-image: url("../../../assets/status/ic_subordinate.png");
- &:hover {
- background-image: url("../../../assets/status/ic_subordinate_hovar.png");
- }
- }
- }
- }
- .team {
- background: #fff;
- border-radius: 5%;
- box-shadow: 0px 6px 7px 0px rgba(0, 0, 0, 0.06);
- overflow: hidden;
- .bg {
- height: 4px;
- background: #6f81bc;
- }
- .status1 {
- background: #6f81bc;
- }
- .status2 {
- background: #cfd6e2;
- }
- }
- .list {
- padding: 31px 24px 22px 32px;
- position: relative;
- min-width: 264px;
- .info {
- margin-bottom: 19px;
- .info-avoutr {
- display: flex;
- .avoutr {
- width: 40px;
- height: 40px;
- border-radius: 50%;
- background: #303133;
- img {
- max-width: 100%;
- }
- }
- .msg {
- p {
- margin: 0;
- padding: 0;
- height: 20px;
- line-height: 20px;
- }
- .name {
- font-weight: bold;
- color: #303133;
- font-size: 18px;
- max-width: 180px;
- white-space: nowrap;
- text-overflow: ellipsis;
- overflow: hidden;
- }
- .cap {
- position: relative;
- top: -3px;
- }
- .group {
- font-size: 14px;
- font-family: Microsoft YaHei;
- font-weight: 400;
- color: #303133;
- }
- }
- }
- .icon {
- font-size: 16px;
- cursor: pointer;
- }
- }
- .time,
- .ip {
- height: 16px;
- line-height: 16px;
- font-size: 16px;
- .glr {
- color: #909399;
- display: inline-block;
- // max-width: 60px;
- overflow: hidden;
- position: relative;
- white-space: nowrap;
- top: 4px;
- text-overflow: ellipsis;
- }
- }
- .ip {
- margin-top: 14px;
- margin-bottom: 14px;
- }
- .details {
- height: 24px;
- line-height: 24px;
- .success {
- color: #6f80bc;
- }
- .error {
- color: #f25555;
- }
- }
- }
- }
- }
- </style>
|