staffHome.vue 12 KB

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