applicantsList.vue 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487
  1. <template>
  2. <view>
  3. <u-navbar title="申请人列表" title-color="#101010">
  4. </u-navbar>
  5. <view class="search-box">
  6. <u-search @custom="getApprovalList(true)"
  7. placeholder="搜索授权用户" bg-color="#f2f4f6" height="80" :show-action="true" v-model="keyword">
  8. </u-search>
  9. </view>
  10. <!-- 列表 -->
  11. <view class="member-list">
  12. <view class="item-info" v-for="(item,i) in list" @click="infoBtn(item)" >
  13. <view class="item" >
  14. <view class="infos">
  15. <view class="name">
  16. {{item.createByName}}
  17. </view>
  18. <view class="tel-time">
  19. <span class="tel" >{{item.createByPhone}}</span>
  20. </view>
  21. </view>
  22. <!-- 通过 -->
  23. <view class="infos2" v-if="item.status==0">
  24. <view class="pass" @click="switchBtnApi(item,1)" >
  25. 通过
  26. </view>
  27. <view class="passNo" @click="switchBtnApi(item,2)" >
  28. 拒绝
  29. </view>
  30. </view>
  31. <!-- 已通过 -->
  32. <view class="passed" v-else >
  33. {{item.statusN}}
  34. </view>
  35. </view>
  36. <view >
  37. <view class="remark" style="width: 100%;" >
  38. <textarea style="background-color: #f5f5f5;height: 100rpx;width: 90%;padding: 20rpx;border-radius: 5px;margin: 20rpx;font-size: 28rpx;" v-model="item.vmodelremark" disabled >
  39. </textarea>
  40. </view>
  41. </view>
  42. </view>
  43. </view>
  44. <u-divider :isnone="list.length==0"
  45. nonetext="暂无记录" border-color="#CFD2D5">
  46. 已经到底了</u-divider>
  47. <u-popup v-model="show" mode="bottom">
  48. <view class="popup2" >
  49. <view class="title">
  50. {{userName}}-权限管理
  51. <view class="title2">返回上一页面可继续分配权限</view>
  52. </view>
  53. <scroll-view scroll-y="true" style="height: 600rpx;" >
  54. <u-checkbox-group style=" width: 100%;" @change="checkboxGroupChange">
  55. <view class="content">
  56. <view class="item" v-for="(item,i) in meterList" >
  57. <view class="item-title">
  58. {{item.name}}
  59. </view>
  60. <view class="item-radio">
  61. <!-- <label class="radio">
  62. <radio value="" /><text></text>
  63. </label> -->
  64. <u-checkbox
  65. v-model="item.checked"
  66. :name="item.id"
  67. ></u-checkbox>
  68. </view>
  69. </view>
  70. </view>
  71. </u-checkbox-group>
  72. <u-divider border-color="#CFD2D5">
  73. 已经到底了</u-divider>
  74. </scroll-view>
  75. <view class="popup-bottom">
  76. <view class="button cancel" @click="show=false">
  77. 取消
  78. </view>
  79. <view class="button save" @click="submitBtn()" >
  80. 保存
  81. </view>
  82. </view>
  83. </view>
  84. </u-popup>
  85. </view>
  86. </template>
  87. <script>
  88. import * as API from '@/apis/pagejs/managementList.js'
  89. export default {
  90. data() {
  91. return {
  92. keyword:"",
  93. pass:false,
  94. pageIndex: 1,
  95. recordsTotal: 0,
  96. list:[],
  97. meterList:[],
  98. meterListIn:[],
  99. userId:"",
  100. userName:"",
  101. show:false,
  102. }
  103. },
  104. onReady() {
  105. this.getApprovalList()
  106. },
  107. onReachBottom() {
  108. if (this.list.length < this.recordsTotal) {
  109. this.myLoadmore();
  110. }
  111. },
  112. methods: {
  113. infoBtn(item){
  114. if(0){
  115. //测试用
  116. this.getAuthorizedUserDetails(item.createBy)
  117. }
  118. if(item.status==1){
  119. uni.showToast({
  120. title: "返回上一页面可分配权限",
  121. icon: "none"
  122. })
  123. }
  124. },
  125. vmodelremark(item){
  126. var remark=(item.informationTitle?'申请授权:'+item.informationTitle:'')+
  127. (item.remark?'\n申请备注:'+item.remark:'')
  128. item.vmodelremark=remark
  129. },
  130. submitBtn(){
  131. uni.showLoading({
  132. title: "加载中",
  133. mask: true,
  134. })
  135. var meterIds="";
  136. if(this.meterListIn.length){
  137. meterIds=this.meterListIn.join()
  138. }
  139. API.authorizedUserSave({
  140. userId:this.userId,
  141. meterIds:meterIds,
  142. }).then((res) => {
  143. //this.userId=id;
  144. uni.hideLoading();
  145. //this.meterList=res.data.meterList;
  146. this.show=false
  147. uni.showModal({
  148. title:"提示",
  149. content:"设置成功",
  150. showCancel:false,
  151. })
  152. }).catch(error => {
  153. uni.showToast({
  154. title: error,
  155. icon: "none"
  156. })
  157. })
  158. },
  159. checkboxGroupChange(e){
  160. console.log(e)
  161. this.meterListIn=e
  162. },
  163. getAuthorizedUserDetails(id) {
  164. uni.showLoading({
  165. title: "加载中",
  166. mask: true,
  167. })
  168. API.authorizedUserDetails({
  169. userId:id,
  170. }).then((res) => {
  171. this.userId=id;
  172. uni.hideLoading();
  173. this.meterList=res.data.meterList;
  174. this.show=true
  175. this.meterListIn=[]
  176. for(var i in this.meterList){
  177. var obj=this.meterList[i]
  178. if(obj.checked){
  179. this.meterListIn.push(obj.id)
  180. }
  181. }
  182. }).catch(error => {
  183. uni.showToast({
  184. title: error,
  185. icon: "none"
  186. })
  187. })
  188. },
  189. switchBtnApiMethod(node,key){
  190. uni.showLoading({
  191. title: "加载中",
  192. mask: true,
  193. })
  194. API.approvalNext({
  195. id:node.id,
  196. status:key
  197. }).then((res) => {
  198. uni.hideLoading();
  199. if(key==1){
  200. this.getAuthorizedUserDetails(node.createBy)
  201. this.userName=node.createByName
  202. }
  203. this.getApprovalList(true)
  204. }).catch(error => {
  205. uni.showToast({
  206. title: error,
  207. icon: "none"
  208. })
  209. })
  210. },
  211. switchBtnApi(node,key){
  212. uni.showModal({
  213. confirmColor:`${key==1?'#3CC51F':'red'}`,
  214. confirmText:`${key==1?'通过':'拒绝'}`,
  215. content: `确认是否要"${key==1?'通过':'拒绝'}"${node.createByName}`,
  216. title: "提示",
  217. success:res=> {
  218. if(res.confirm){
  219. this.switchBtnApiMethod(node,key);
  220. }
  221. }
  222. })
  223. console.log(node,key)
  224. },
  225. myLoadmore() {
  226. this.pageIndex += 1;
  227. this.getApprovalList();
  228. },
  229. getApprovalList(bl) {
  230. uni.showLoading({
  231. title: "加载中",
  232. mask: true,
  233. })
  234. if (bl) {
  235. this.list = [];
  236. this.pageIndex = 1;
  237. }
  238. API.approvalList({
  239. pageIndex:this.pageIndex,
  240. pageSize:20,
  241. nameOrPhone:this.keyword
  242. }).then((res) => {
  243. uni.hideLoading();
  244. this.list = [
  245. ...this.list,
  246. ...res.data.data
  247. ];
  248. for(var i in this.list){
  249. var obj=this.list[i]
  250. this.vmodelremark(obj)
  251. }
  252. this.recordsTotal = res.data.recordsTotal;
  253. }).catch(error => {
  254. uni.showToast({
  255. title: error,
  256. icon: "none"
  257. })
  258. })
  259. },
  260. }
  261. }
  262. </script>
  263. <style>
  264. </style>
  265. <style lang="scss" scoped>
  266. .search-box {
  267. padding: 16rpx 32rpx;
  268. position: sticky;
  269. top: 88rpx;
  270. z-index: 999;
  271. background-color: rgba(255,255,255,1);
  272. /deep/.u-content {
  273. border-radius: 8px !important;
  274. }
  275. ;
  276. /deep/.u-search {
  277. position: relative
  278. }
  279. ;
  280. /deep/.u-action {
  281. width: 96rpx;
  282. line-height: 56rpx;
  283. border-radius: 4px;
  284. background-color: rgba(22, 119, 255, 1);
  285. color: rgba(255, 255, 255, 1);
  286. text-align: center;
  287. z-index: 9999;
  288. position: absolute;
  289. right: 12rpx;
  290. }
  291. }
  292. // 列表
  293. .member-list{
  294. background: #fff;
  295. .item-info{
  296. padding: 32rpx 0;
  297. margin: 0 32rpx;
  298. border-bottom: 1px solid rgba(244,244,244,1);;
  299. border-bottom: 1px solid #f4f4f4;
  300. }
  301. .item{
  302. display: flex;
  303. align-items: center;
  304. justify-content: space-between;
  305. }
  306. .photo{
  307. img{
  308. width: 80rpx;
  309. height: 80rpx;
  310. border-radius: 50px;
  311. }
  312. }
  313. .infos2{
  314. display: flex;
  315. align-items: center;
  316. justify-content: space-between;
  317. }
  318. .infos{
  319. margin-left: 16rpx;
  320. .name{
  321. color: rgba(51,51,51,1);
  322. font-size: 32rpx;
  323. }
  324. .tel-time{
  325. font-size: 24rpx;
  326. margin-top: 4rpx;
  327. .tel{
  328. color: rgba(119,119,119,1);
  329. }
  330. .time{
  331. color: #999999;
  332. margin-left: 16rpx;
  333. }
  334. }
  335. }
  336. .pass{
  337. width: 120rpx;
  338. height: 56rpx;
  339. line-height: 56rpx;
  340. border-radius: 50px;
  341. background-color: rgba(0,185,98,1);
  342. color: rgba(255,255,255,1);
  343. text-align: center;
  344. margin-left: auto;
  345. }
  346. .passNo{
  347. width: 120rpx;
  348. height: 56rpx;
  349. line-height: 56rpx;
  350. border-radius: 50px;
  351. background-color: #CCCCCC ;
  352. color: rgba(255,255,255,1);
  353. text-align: center;
  354. margin-left: 20rpx;
  355. }
  356. .passed{
  357. margin-left: auto;
  358. color: rgba(153,153,153,1);
  359. }
  360. }
  361. // 人员权限管理
  362. .popup2{
  363. padding: 32rpx 0;
  364. .title{
  365. color: rgba(16,16,16,1);
  366. font-size: 36rpx;
  367. font-weight: bold;
  368. text-align: center;
  369. }
  370. .title2{
  371. color: red;
  372. font-size: 32rpx;
  373. font-weight: 400;
  374. text-align: center;
  375. }
  376. .content{
  377. width: 100%;
  378. margin-bottom: 24rpx;
  379. .item{
  380. display: flex;
  381. align-items: center;
  382. justify-content: space-between;
  383. padding: 28rpx 30rpx;
  384. border-bottom: 1px solid rgba(245,245,245,1);
  385. }
  386. }
  387. .popup-bottom{
  388. display: flex;
  389. justify-content: space-between;
  390. padding: 0 32rpx;
  391. .button{
  392. width: 328rpx;
  393. height: 80rpx;
  394. line-height: 80rpx;
  395. border-radius: 4px;
  396. font-size: 32rpx;
  397. text-align: center;
  398. }
  399. .cancel{
  400. background-color: rgba(222,225,228,1);
  401. color: rgba(51,51,51,1);
  402. }
  403. .save{
  404. background-color: rgba(22,119,255,1);
  405. color: rgba(255,255,255,1);
  406. }
  407. }
  408. }
  409. </style>