staffHome.vue 12 KB

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