managementList.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625
  1. <template>
  2. <view>
  3. <u-navbar title="授权管理" title-color="#101010" :is-back="isback" >
  4. <view slot="right" v-if="list.length"
  5. @click="deleteShow=!deleteShow">
  6. <img v-if="deleteShow==true" src="@/assets/img/arcoDesign-select-all.svg" alt="" />
  7. <span v-else style="color: red;" >删除</span>
  8. <!-- <img src="@/assets/img/riLine-list-settings-line.svg" alt="" /> -->
  9. </view>
  10. </u-navbar>
  11. <view class="search-box">
  12. <u-search @custom="getAuthorizedUserList(true)"
  13. placeholder="搜索授权用户" bg-color="#f2f4f6" height="80" :show-action="true" v-model="keyword">
  14. </u-search>
  15. </view>
  16. <view class="member-list-main">
  17. <!-- 列表 -->
  18. <view class="member-list">
  19. <checkbox-group @change="checkboxChange">
  20. <view class="item-info" v-for="(item,i) in list" :key="i" >
  21. <!-- <view class="photo">
  22. <img src="@/assets/img/PEokWS2@3x.png" alt="" />
  23. </view> -->
  24. <view class="item" >
  25. <view class="infos">
  26. <view class="name">
  27. {{item.name}}
  28. </view>
  29. <view class="tel">
  30. {{item.phone}}
  31. </view>
  32. </view>
  33. <view class="button" @click="getAuthorizedUserDetails(item.id),userName=item.name" v-if="!deleteShow">
  34. 权限管理
  35. </view>
  36. <!-- 单选框 -->
  37. <view class="radio-box" v-if="deleteShow">
  38. <checkbox :value="item.id"></checkbox>
  39. </view>
  40. </view>
  41. </view>
  42. </checkbox-group>
  43. </view>
  44. <u-divider :isnone="list.length==0"
  45. nonetext="暂无记录" border-color="#CFD2D5">
  46. 已经到底了</u-divider>
  47. </view>
  48. <view class="bottom">
  49. <view class="button qr-code"
  50. @click="gotoUrl('/pages/managementList/authorizedQRCode')"
  51. >
  52. <img src="@/assets/img/riLine-qr-code-line 1.svg" alt="" /> 授权二维码
  53. </view>
  54. <view class="button list-button" @click="gotoUrl('/pages/managementList/applicantsList')" >
  55. <img src="@/assets/img/riLine-contacts-line.svg" alt="" /> 申请人列表
  56. <view class="bot" v-if="approvalListNum">
  57. {{approvalListNum}}
  58. </view>
  59. </view>
  60. </view>
  61. <!-- 删除 -->
  62. <view class="delete" v-if="deleteShow" @click="deletePopupQuery">
  63. <view class="icon">
  64. <img src="@/assets/img/riLine-delete-bin-7-line 1.svg" alt="" />
  65. </view>
  66. <view class="text">
  67. 删除
  68. </view>
  69. </view>
  70. <!-- 删除确认弹框 -->
  71. <u-popup v-model="deletePopup" mode="bottom" border-radius="12">
  72. <view class="popup">
  73. <view class="headline">
  74. 删除人员
  75. </view>
  76. <view class="hint">
  77. 要删除选中的人员吗?
  78. </view>
  79. <view class="btn-box">
  80. <view class="cancel" @click="deletePopup=false">
  81. 取消
  82. </view>
  83. <view class="confirm" @click="deletePopupApi" >
  84. 确认删除
  85. </view>
  86. </view>
  87. </view>
  88. </u-popup>
  89. <!-- 人员权限管理 -->
  90. <view>
  91. <u-popup v-model="show" mode="bottom">
  92. <view class="popup2" >
  93. <view class="title">
  94. {{userName}}-权限管理
  95. </view>
  96. <scroll-view scroll-y="true" style="height: 600rpx;" >
  97. <u-checkbox-group style=" width: 100%;" @change="checkboxGroupChange">
  98. <view class="content">
  99. <view class="item" v-for="(item,i) in meterList" >
  100. <view class="item-title">
  101. {{item.name}}
  102. </view>
  103. <view class="item-radio">
  104. <!-- <label class="radio">
  105. <radio value="" /><text></text>
  106. </label> -->
  107. <u-checkbox
  108. v-model="item.checked"
  109. :name="item.id"
  110. ></u-checkbox>
  111. </view>
  112. </view>
  113. </view>
  114. </u-checkbox-group>
  115. <u-divider border-color="#CFD2D5">
  116. 已经到底了</u-divider>
  117. </scroll-view>
  118. <view class="popup-bottom">
  119. <view class="button cancel" @click="show=false">
  120. 取消
  121. </view>
  122. <view class="button save" @click="submitBtn()" >
  123. 保存
  124. </view>
  125. </view>
  126. </view>
  127. </u-popup>
  128. </view>
  129. </view>
  130. </template>
  131. <script>
  132. import * as API from '@/apis/pagejs/managementList.js'
  133. export default {
  134. data() {
  135. return {
  136. keyword:"",
  137. deleteShow:false,
  138. deletePopup:false,
  139. deleteIds: "",
  140. pageIndex: 1,
  141. recordsTotal: 0,
  142. show:false,
  143. list:[],
  144. approvalListNum:0,
  145. meterList:[],
  146. meterListIn:[],
  147. userId:"",
  148. userName:"",
  149. isback:false,
  150. }
  151. },
  152. onLoad(op){
  153. if(op.isback){
  154. this.isback=op.isback
  155. }
  156. },
  157. onReady() {
  158. //this.getAuthorizedUserList()
  159. },
  160. onShow() {
  161. this.getAuthorizedUserList(true)
  162. this.getApprovalList()
  163. },
  164. onReachBottom() {
  165. if (this.list.length < this.recordsTotal) {
  166. this.myLoadmore();
  167. }
  168. },
  169. methods: {
  170. deletePopupQuery() {
  171. if (this.deleteIds != '') {
  172. this.deletePopup = true
  173. } else {
  174. uni.showToast({
  175. title: "请至少勾选一项",
  176. icon: "none"
  177. })
  178. }
  179. },
  180. deletePopupApi() {
  181. uni.showLoading({
  182. title: "加载中",
  183. mask: true,
  184. })
  185. API.authorizedUserDelete({
  186. userIds: this.deleteIds
  187. }).then((response) => {
  188. uni.hideLoading();
  189. this.deletePopup = false
  190. this.deleteShow = false
  191. this.deleteIds = ""
  192. this.getAuthorizedUserList(true)
  193. }).catch(error => {
  194. uni.showToast({
  195. title: error,
  196. icon: "none"
  197. })
  198. })
  199. },
  200. checkboxChange(e) {
  201. var sz = e.detail.value;
  202. console.log(sz)
  203. this.deleteIds = sz.join()
  204. },
  205. submitBtn(){
  206. uni.showLoading({
  207. title: "加载中",
  208. mask: true,
  209. })
  210. var meterIds="";
  211. if(this.meterListIn.length){
  212. meterIds=this.meterListIn.join()
  213. }
  214. API.authorizedUserSave({
  215. userId:this.userId,
  216. meterIds:meterIds,
  217. }).then((res) => {
  218. //this.userId=id;
  219. uni.hideLoading();
  220. //this.meterList=res.data.meterList;
  221. this.show=false
  222. uni.showModal({
  223. title:"提示",
  224. content:"设置成功",
  225. showCancel:false,
  226. })
  227. }).catch(error => {
  228. uni.showToast({
  229. title: error,
  230. icon: "none"
  231. })
  232. })
  233. },
  234. checkboxGroupChange(e){
  235. console.log(e)
  236. this.meterListIn=e
  237. },
  238. getAuthorizedUserDetails(id) {
  239. uni.showLoading({
  240. title: "加载中",
  241. mask: true,
  242. })
  243. API.authorizedUserDetails({
  244. userId:id,
  245. }).then((res) => {
  246. this.userId=id;
  247. uni.hideLoading();
  248. this.meterList=res.data.meterList;
  249. this.show=true
  250. this.meterListIn=[]
  251. for(var i in this.meterList){
  252. var obj=this.meterList[i]
  253. if(obj.checked){
  254. this.meterListIn.push(obj.id)
  255. }
  256. }
  257. }).catch(error => {
  258. uni.showToast({
  259. title: error,
  260. icon: "none"
  261. })
  262. })
  263. },
  264. myLoadmore() {
  265. this.pageIndex += 1;
  266. this.getAuthorizedUserList();
  267. },
  268. getAuthorizedUserList(bl) {
  269. uni.showLoading({
  270. title: "加载中",
  271. mask: true,
  272. })
  273. if (bl) {
  274. this.list = [];
  275. this.pageIndex = 1;
  276. }
  277. API.authorizedUserList({
  278. pageIndex:this.pageIndex,
  279. pageSize:20,
  280. nameOrPhone:this.keyword
  281. }).then((res) => {
  282. uni.hideLoading();
  283. this.list = [
  284. ...this.list,
  285. ...res.data.data
  286. ];
  287. this.recordsTotal = res.data.recordsTotal;
  288. }).catch(error => {
  289. uni.showToast({
  290. title: error,
  291. icon: "none"
  292. })
  293. })
  294. },
  295. getApprovalList() {
  296. API.approvalList({
  297. status:0
  298. }).then((res) => {
  299. this.approvalListNum= res.data.recordsTotal;
  300. }).catch(error => {
  301. uni.showToast({
  302. title: error,
  303. icon: "none"
  304. })
  305. })
  306. },
  307. }
  308. }
  309. </script>
  310. <style>
  311. page{
  312. padding-bottom: 100px;
  313. }
  314. </style>
  315. <style lang="scss" scoped>
  316. /deep/.u-slot-right {
  317. padding-right: 32rpx;
  318. padding-left: 16rpx;
  319. line-height: 30px;
  320. background-color: #fff;
  321. img {
  322. width: 48rpx;
  323. height: 48rpx;
  324. vertical-align: middle;
  325. }
  326. }
  327. .search-box {
  328. padding: 16rpx 32rpx;
  329. position: sticky;
  330. top: 88rpx;
  331. z-index: 999;
  332. background-color: rgba(255,255,255,1);
  333. /deep/.u-content {
  334. border-radius: 8px !important;
  335. }
  336. ;
  337. /deep/.u-search {
  338. position: relative
  339. }
  340. ;
  341. /deep/.u-action {
  342. width: 96rpx;
  343. line-height: 56rpx;
  344. border-radius: 4px;
  345. background-color: rgba(22, 119, 255, 1);
  346. color: rgba(255, 255, 255, 1);
  347. text-align: center;
  348. z-index: 9999;
  349. position: absolute;
  350. right: 12rpx;
  351. }
  352. }
  353. .member-list-main{
  354. padding-bottom: 120rpx ;
  355. }
  356. // 列表
  357. .member-list{
  358. background: #fff;
  359. .item-info{
  360. padding: 32rpx 0;
  361. margin: 0 32rpx;
  362. border-bottom: 1px solid rgba(244,244,244,1);;
  363. border-bottom: 1px solid #f4f4f4;
  364. }
  365. .item{
  366. display: flex;
  367. align-items: center;
  368. }
  369. .photo{
  370. img{
  371. width: 80rpx;
  372. height: 80rpx;
  373. border-radius: 50px;
  374. }
  375. }
  376. .infos{
  377. margin-left: 16rpx;
  378. .name{
  379. color: rgba(51,51,51,1);
  380. font-size: 32rpx;
  381. }
  382. .tel{
  383. color: rgba(119,119,119,1);
  384. font-size: 24rpx;
  385. margin-top: 4rpx;
  386. }
  387. }
  388. .button{
  389. width: 144rpx;
  390. height: 56rpx;
  391. line-height: 56rpx;
  392. border-radius: 50px;
  393. background-color: rgba(22,119,255,1);
  394. color: rgba(255,255,255,1);
  395. text-align: center;
  396. margin-left: auto;
  397. }
  398. .radio-box{
  399. margin-left: auto;
  400. }
  401. }
  402. .bottom{
  403. position: fixed;
  404. left: 0;
  405. right: 0;
  406. bottom: 0;
  407. background-color: #fff;
  408. padding: 20rpx 32rpx;
  409. display: flex;
  410. justify-content: space-between;
  411. img{
  412. width: 40rpx;
  413. height: 40rpx;
  414. margin-right: 8rpx;
  415. }
  416. .button{
  417. width: 328rpx;
  418. height: 80rpx;
  419. line-height: 80rpx;
  420. border-radius: 4px;
  421. font-size: 32rpx;
  422. text-align: center;
  423. display: flex;
  424. align-items: center;
  425. justify-content: center;
  426. }
  427. .qr-code{
  428. background-color: rgba(22,119,255,1);
  429. color: rgba(255,255,255,1);
  430. }
  431. .list-button{
  432. background-color: rgba(222,225,228,1);
  433. color: rgba(51,51,51,1);
  434. position: relative;
  435. }
  436. .bot{
  437. width: 40rpx;
  438. height: 40rpx;
  439. line-height: 40rpx;
  440. border-radius: 10px;
  441. background-color: rgba(244,60,50,1);
  442. color: rgba(255,255,255,1);
  443. font-size: 24rpx;
  444. text-align: center;
  445. position: absolute;
  446. top: -10rpx;
  447. right:-10rpx;
  448. }
  449. }
  450. // 删除
  451. .delete {
  452. position: fixed;
  453. left: 0;
  454. right: 0;
  455. bottom: 0;
  456. background-color: #fff;
  457. display: flex;
  458. flex-direction: column;
  459. align-items: center;
  460. justify-content: center;
  461. height: 120rpx;
  462. img {
  463. width: 48rpx;
  464. height: 48rpx;
  465. }
  466. .text {
  467. color: rgba(51, 51, 51, 1);
  468. font-size: 20rpx;
  469. }
  470. }
  471. .popup {
  472. padding: 32rpx;
  473. text-align: center;
  474. .headline {
  475. color: rgba(16, 16, 16, 1);
  476. font-size: 36rpx;
  477. font-weight: bold;
  478. }
  479. .hint {
  480. color: rgba(16, 16, 16, 1);
  481. font-size: 32rpx;
  482. margin-top: 40rpx;
  483. }
  484. .btn-box {
  485. margin-top: 82rpx;
  486. display: flex;
  487. justify-content: space-between;
  488. .cancel {
  489. width: 328rpx;
  490. line-height: 80rpx;
  491. border-radius: 4px;
  492. background-color: rgba(222, 225, 228, 1);
  493. color: rgba(51, 51, 51, 1);
  494. font-size: 32rpx;
  495. }
  496. .confirm {
  497. width: 328rpx;
  498. line-height: 80rpx;
  499. border-radius: 4px;
  500. background-color: rgba(255, 68, 68, 1);
  501. color: rgba(255, 255, 255, 1);
  502. font-size: 32rpx;
  503. }
  504. }
  505. }
  506. // 人员权限管理
  507. .popup2{
  508. padding: 32rpx 0;
  509. .title{
  510. color: rgba(16,16,16,1);
  511. font-size: 36rpx;
  512. font-weight: bold;
  513. text-align: center;
  514. }
  515. .content{
  516. width: 100%;
  517. margin-bottom: 24rpx;
  518. .item{
  519. display: flex;
  520. align-items: center;
  521. justify-content: space-between;
  522. padding: 28rpx 30rpx;
  523. border-bottom: 1px solid rgba(245,245,245,1);
  524. }
  525. }
  526. .popup-bottom{
  527. display: flex;
  528. justify-content: space-between;
  529. padding: 0 32rpx;
  530. .button{
  531. width: 328rpx;
  532. height: 80rpx;
  533. line-height: 80rpx;
  534. border-radius: 4px;
  535. font-size: 32rpx;
  536. text-align: center;
  537. }
  538. .cancel{
  539. background-color: rgba(222,225,228,1);
  540. color: rgba(51,51,51,1);
  541. }
  542. .save{
  543. background-color: rgba(22,119,255,1);
  544. color: rgba(255,255,255,1);
  545. }
  546. }
  547. }
  548. </style>