staffHome.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428
  1. <!--
  2. * @Author: your name
  3. * @Date: 2021-11-29 14:37:54
  4. * @LastEditTime: 2022-02-28 17:13:19
  5. * @LastEditors: Please set LastEditors
  6. * @Description: 角色管理
  7. * @FilePath: \Foshan4A2.0\src\views\authorityManagement\components\authorityRole.vue
  8. -->
  9. <template>
  10. <div class="authorityRoleHome">
  11. <!--状态和搜索-->
  12. <div style="justify-content: flex-end;" class="authority-head flex">
  13. <Search @getSearchData="getSearchData" @clearSearchData="clearSearchData" :isSlot="true">
  14. <button v-is="['officerlist_btn_add_officer']" @click="addRole" class="btnAdd">新增</button>
  15. </Search>
  16. </div>
  17. <!--列表-->
  18. <div class="role-content scrollbar">
  19. <template v-if="arrs.length">
  20. <el-row v-infinite-scroll="load" :infinite-scroll-distance="20" infinite-scroll-disabled="disabled" :gutter="24">
  21. <el-col :span="6" v-for="(item,index) in arrs" class="account-left-content-teams" :key="index">
  22. <div class="team">
  23. <div class="list">
  24. <div class="flex info">
  25. <div class="info-avoutr">
  26. <div class="msg flex-wrap">
  27. <p :title="item.OfficerName" class="name">{{item.OfficerName}}</p>
  28. <div v-is="['officerlist_btn_edit']" @click="editRole(item)" class="cap cap-edit"></div>
  29. </div>
  30. </div>
  31. <div v-is="['officerlist_btn_del_officer']" class="info-close">
  32. <i @click="checkRemove(item,index)" class="icon el-icon-close"></i>
  33. </div>
  34. </div>
  35. <div class="flex time">
  36. <div class="time-msg flex1">所属组织:<span :title="item.OrganName" class="glr">{{item.OrganName}}</span></div>
  37. </div>
  38. <div class="flex ip">
  39. <div style="margin-right:20px;" class="ip-msg flex1">登录名:<span :title="item.LoginName" class="glr">{{item.LoginName}}</span></div>
  40. <div class="time-info flex1">职务名称:<span :title="item.JobName" class="glr">{{item.JobName ? item.JobName : '暂无'}}</span></div>
  41. <!-- <div class="ip-info flex1">是否有副岗:<span class="glr">{{item.HasDepJob == 1 ? '是':'否'}}</span></div> -->
  42. </div>
  43. <div class="power ip">权限:<span class="glr">{{item.AuthCount}}</span></div>
  44. <div class="flex details">
  45. <div class="details-msg">
  46. 状态:<span :class="item.Status == 1 ? 'success' : 'error'">{{item.Status == 1 ? '启用' : '停用'}}</span>
  47. </div>
  48. <div v-is="['officerlist_btn_state_swatch']" class="details-info">
  49. <el-switch v-model="item.isauto" @change="handleChange(item)" active-color="#6F81BC">
  50. </el-switch>
  51. </div>
  52. </div>
  53. </div>
  54. </div>
  55. </el-col>
  56. </el-row>
  57. <template v-if="total > 1">
  58. <p class="center" v-if="loading">加载中...</p>
  59. <p class="center" v-if="noMore">没有更多数据了~</p>
  60. </template>
  61. </template>
  62. <template v-else>
  63. <el-empty description="暂无数据"></el-empty>
  64. </template>
  65. </div>
  66. <!--删除弹框-->
  67. <Dialog :flag="flag">
  68. <div class="airportInfoDialog">
  69. <div class="title">删除职员</div>
  70. <div class="content">是否确认删除{{ title }}?</div>
  71. <div class="foot right t30">
  72. <el-button size="medium" class="r24" @click="remove" type="danger">删除</el-button>
  73. <el-button size="medium" @click="flag = false">取消</el-button>
  74. </div>
  75. </div>
  76. </Dialog>
  77. </div>
  78. </template>
  79. <script>
  80. import Search from '@/layout/components/Search'
  81. import Dialog from '@/layout/components/Dialog'
  82. import roleData from '../minixs/roleData'
  83. import { staffStart } from '@/api/postInterface'
  84. import { GetOfficerListByOrganId } from '@/api/jobApi'
  85. export default {
  86. name: 'AuthorityRole',
  87. components: { Search, Dialog },
  88. mixins: [roleData],
  89. data () {
  90. return {
  91. arrs: [], //卡片数据
  92. arrsCopy: [],
  93. flag: false,
  94. title: '',
  95. index: null,
  96. keyWords: '',
  97. pageNum: 1,
  98. PageSize: 20,
  99. loading: false,
  100. keyWords: '',
  101. total: null,
  102. search: null,
  103. num: null
  104. }
  105. },
  106. created () {
  107. const { OrganId, orgType, keyWords } = this.$route.query;
  108. if (OrganId && orgType == 'org') {
  109. this.OrganId = OrganId;
  110. this.orgType = orgType;
  111. this.getJobListByOrgan(OrganId);
  112. } else {
  113. if (keyWords) {
  114. this.keyWords = keyWords;
  115. }
  116. this.gueryRole({
  117. QueryName: this.keyWords,
  118. PageSize: this.PageSize,
  119. PageIndex: this.pageNum
  120. });
  121. }
  122. },
  123. computed: {
  124. noMore () {
  125. return this.pageNum >= this.total
  126. },
  127. disabled () {
  128. return this.loading || this.noMore
  129. }
  130. },
  131. methods: {
  132. //根据组织查询职员
  133. async getJobListByOrgan (OrganId) {
  134. try {
  135. const res = await GetOfficerListByOrganId({
  136. OrganId: OrganId
  137. });
  138. if (res.code === 0) {
  139. const datas = res.returnData
  140. this.arrs = datas
  141. } else {
  142. this.$message.error(res.message)
  143. }
  144. } catch (error) {
  145. console.log('出错了', error)
  146. }
  147. },
  148. //删除
  149. checkRemove (item, num) {
  150. this.flag = true
  151. this.index = item
  152. this.title = item.OfficerName
  153. this.num = num
  154. },
  155. //确认删除
  156. remove () {
  157. this.deleteRole(this.index.OfficerId, this.num)
  158. },
  159. //职员新增
  160. addRole () {
  161. this.$router.push('/staff/staffAdd')
  162. },
  163. //职员编辑
  164. editRole (item) {
  165. this.$router.push({ path: '/staff/staffEdit', query: { OfficerId: item.OfficerId, Status: item.Status } })
  166. },
  167. //查询
  168. getSearchData (val) {
  169. this.arrs = []
  170. this.dataList = []
  171. this.pageNum = 1
  172. this.keyWords = val
  173. this.gueryRole({
  174. QueryName: val,
  175. PageSize: this.PageSize,
  176. PageIndex: this.pageNum
  177. })
  178. },
  179. //清除查询
  180. clearSearchData () {
  181. this.arrs = []
  182. this.dataList = []
  183. this.pageNum = 1
  184. this.keyWords = ''
  185. this.gueryRole({
  186. QueryName: this.keyWords,
  187. PageSize: this.PageSize,
  188. PageIndex: this.pageNum
  189. })
  190. },
  191. //状态变更
  192. async handleChange (item) {
  193. try {
  194. const { OfficerId, isauto } = item
  195. const Status = isauto ? 1 : 0
  196. const res = await staffStart({
  197. OfficerId: OfficerId,
  198. Status: Status
  199. })
  200. if (res.code === 0) {
  201. this.$message.success(res.message)
  202. this.arrs.forEach(item => {
  203. if (item.OfficerId == OfficerId) {
  204. item.isauto = isauto
  205. item.Status = Status
  206. }
  207. })
  208. } else {
  209. this.$message.error(res.message)
  210. }
  211. } catch (error) {
  212. console.log('出错了', error)
  213. }
  214. },
  215. //滚动加载数据
  216. load () {
  217. this.pageNum += 1
  218. this.gueryRole({
  219. QueryName: this.keyWords,
  220. PageSize: this.PageSize,
  221. PageIndex: this.pageNum
  222. })
  223. }
  224. }
  225. }
  226. </script>
  227. <style lang="scss" scoped>
  228. .authorityRoleHome {
  229. padding: 0 64px;
  230. }
  231. .authority-head {
  232. position: fixed;
  233. width: 100%;
  234. padding: 32px 64px;
  235. padding-left: 156px;
  236. left: 0;
  237. display: flex;
  238. flex-direction: row;
  239. justify-content: space-between;
  240. background: #f5f7fa;
  241. z-index: 100;
  242. line-height: 48px;
  243. .status {
  244. & > div {
  245. margin-right: 28px;
  246. .icon {
  247. width: 16px;
  248. height: 16px;
  249. background: #6f81bc;
  250. border-radius: 2px;
  251. display: inline-block;
  252. vertical-align: middle;
  253. margin-right: 10px;
  254. position: relative;
  255. top: -2px;
  256. }
  257. &:last-child {
  258. margin-right: 0;
  259. }
  260. }
  261. .status2 {
  262. .icon {
  263. background: #cfd6e2;
  264. }
  265. }
  266. }
  267. }
  268. .role-content {
  269. padding-top: 115px;
  270. height: 84vh;
  271. overflow-y: auto;
  272. overflow-x: hidden;
  273. .el-col-lg-5-5 {
  274. width: 20%;
  275. }
  276. .account-left-content-teams {
  277. position: relative;
  278. margin-bottom: 24px;
  279. .info-close {
  280. cursor: pointer;
  281. .icon {
  282. color: #303133;
  283. font-weight: 600;
  284. }
  285. }
  286. .list {
  287. .info {
  288. line-height: normal;
  289. margin-bottom: 19px;
  290. .name {
  291. font-size: 16px;
  292. font-weight: bold;
  293. }
  294. .cap {
  295. width: 24px;
  296. height: 24px;
  297. display: inline-block;
  298. background-repeat: no-repeat;
  299. background-size: cover;
  300. transition: all 0.3s;
  301. margin-left: 16px;
  302. cursor: pointer;
  303. &:first-child {
  304. margin-right: 0;
  305. }
  306. }
  307. .cap-plus {
  308. background-image: url("../../../assets/status/ic_plus.png");
  309. &:hover {
  310. background-image: url("../../../assets/status/ic_plus_hovar.png");
  311. }
  312. }
  313. .cap-edit {
  314. background-image: url("../../../assets/status/ic_edit.png");
  315. &:hover {
  316. background-image: url("../../../assets/status/ic_edit_hovar.png");
  317. }
  318. }
  319. .cap-sub {
  320. background-image: url("../../../assets/status/ic_subordinate.png");
  321. &:hover {
  322. background-image: url("../../../assets/status/ic_subordinate_hovar.png");
  323. }
  324. }
  325. }
  326. }
  327. .team {
  328. background: #fff;
  329. border-radius: 5%;
  330. box-shadow: 0px 6px 7px 0px rgba(0, 0, 0, 0.06);
  331. overflow: hidden;
  332. .bg {
  333. height: 4px;
  334. background: #6f81bc;
  335. }
  336. .status1 {
  337. background: #6f81bc;
  338. }
  339. .status2 {
  340. background: #cfd6e2;
  341. }
  342. }
  343. .list {
  344. padding: 31px 24px 22px 32px;
  345. position: relative;
  346. min-width: 264px;
  347. .info {
  348. margin-bottom: 19px;
  349. .info-avoutr {
  350. display: flex;
  351. .avoutr {
  352. width: 40px;
  353. height: 40px;
  354. border-radius: 50%;
  355. background: #303133;
  356. img {
  357. max-width: 100%;
  358. }
  359. }
  360. .msg {
  361. p {
  362. margin: 0;
  363. padding: 0;
  364. height: 20px;
  365. line-height: 20px;
  366. }
  367. .name {
  368. font-weight: bold;
  369. color: #303133;
  370. font-size: 18px;
  371. max-width: 180px;
  372. white-space: nowrap;
  373. text-overflow: ellipsis;
  374. overflow: hidden;
  375. }
  376. .cap {
  377. position: relative;
  378. top: -3px;
  379. }
  380. .group {
  381. font-size: 14px;
  382. font-family: Microsoft YaHei;
  383. font-weight: 400;
  384. color: #303133;
  385. }
  386. }
  387. }
  388. .icon {
  389. font-size: 16px;
  390. cursor: pointer;
  391. }
  392. }
  393. .time,
  394. .ip {
  395. height: 16px;
  396. line-height: 16px;
  397. font-size: 16px;
  398. .glr {
  399. color: #909399;
  400. display: inline-block;
  401. // max-width: 60px;
  402. overflow: hidden;
  403. position: relative;
  404. white-space: nowrap;
  405. top: 4px;
  406. text-overflow: ellipsis;
  407. }
  408. }
  409. .ip {
  410. margin-top: 14px;
  411. margin-bottom: 14px;
  412. }
  413. .details {
  414. height: 24px;
  415. line-height: 24px;
  416. .success {
  417. color: #6f80bc;
  418. }
  419. .error {
  420. color: #f25555;
  421. }
  422. }
  423. }
  424. }
  425. }
  426. </style>