listPage.vue 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374
  1. <!-- 权限申请列表 -->
  2. <template>
  3. <view class="permissionApplyListPage">
  4. <view class="top-picker-box">
  5. <picker @change="typeChange" :value="typeIndex" :range="typeList" :range-key="'label'">
  6. <view class="picker-p check-picker-p">
  7. {{typeList[typeIndex].label}}
  8. </view>
  9. </picker>
  10. </view>
  11. <scroll-view scroll-y @scrolltolower="scrollGet" class="for-max-box">
  12. <view class="for-box" v-for="(item,index) in dataList" :key="index">
  13. <view class="title-p">{{item.subName}}({{item.roomNum}})</view>
  14. <view class="text-p">{{item.deptName}} - {{item.buildName}}</view>
  15. <view class="text-p">申请权限类型:{{item.perm}}</view>
  16. <view class="text-p">申请人:{{item.userName}}({{item.userNum}})</view>
  17. <view class="text-p">申请时间:{{item.submitTime}}</view>
  18. <view class="text-p" v-if="item.status!=0&&item.approveBy">审核人:{{item.approveBy}}</view>
  19. <view class="text-p" v-if="item.status!=0&&item.approveTime">审核时间:{{item.approveTime}}</view>
  20. <view class="position-p" :class="item.status==2?'colorB':'colorA'">{{item.status==0?'待审批':(item.status==1?'审批通过':(item.status==2?'驳回':''))}}</view>
  21. <view class="button-p-1" v-if="item.status==0&&hazardousWasteUserType==1" @click="throughButton(item)">通过</view>
  22. <view class="button-p-2" v-if="item.status==0&&hazardousWasteUserType==1" @click="rejectionButton(1,item)">驳回</view>
  23. </view>
  24. <view class="get-null-box" v-if="getDataType">暂无更多数据</view>
  25. </scroll-view>
  26. <view v-if="hazardousWasteUserType == 0" class="add-button" @click="goPage()">新申请</view>
  27. <view class="shade-max-big-box" v-if="dialogType">
  28. <view class="shade-null-1" @click="rejectionButton(2)"></view>
  29. <view class="shade-big-box">
  30. <view class="shade-title-p">驳回申请</view>
  31. <textarea class="textarea" placeholder="请输入驳回原因及说明"
  32. maxlength="100" v-model="dialogText"></textarea>
  33. <view class="shade-button-box">
  34. <view @click="dialogButton(1)">取消</view>
  35. <view @click="dialogButton(2)">驳回</view>
  36. </view>
  37. </view>
  38. <view class="shade-null-2" @click="rejectionButton(2)"></view>
  39. </view>
  40. </view>
  41. </template>
  42. <script>
  43. import {
  44. parseTime
  45. } from '@/component/public.js'
  46. import {
  47. hwmsAppRegisterApprovalApplyList,
  48. hwmsAppRegisterApprovalApply,
  49. } from '@/pages_hazardousWasteRecycling/api/index.js'
  50. export default {
  51. data() {
  52. return {
  53. hazardousWasteUserType:uni.getStorageSync('hazardousWasteUserType'),
  54. typeList:[
  55. { value: "", label: "全部" },
  56. { value: "0", label: "待审批" },
  57. { value: "1", label: "已通过" },
  58. { value: "2", label: "驳回" },
  59. ],
  60. // 查询参数
  61. getDataType: false,
  62. queryParams: {
  63. page: 1,
  64. pageSize: 10,
  65. status:1,
  66. },
  67. typeIndex:0,
  68. total: 0,
  69. dataList: [],
  70. dialogData:{},
  71. dialogType:false,
  72. dialogText:'',
  73. }
  74. },
  75. onLoad(option) {
  76. },
  77. onShow() {
  78. this.getList();
  79. },
  80. mounted() {
  81. },
  82. methods: {
  83. //滚动加载事件
  84. scrollGet() {
  85. let self = this;
  86. if (self.total / self.queryParams.pageSize <= self.queryParams.page) {
  87. this.$set(this, 'getDataType', true);
  88. } else {
  89. this.queryParams.page += 1;
  90. this.$nextTick(() => {
  91. this.getList();
  92. })
  93. }
  94. },
  95. //获取实验室列表
  96. async getList() {
  97. let self = this;
  98. let obj = JSON.parse(JSON.stringify(this.queryParams));
  99. obj.type = this.hazardousWasteUserType == 1?'2':'1'
  100. const {
  101. data
  102. } = await hwmsAppRegisterApprovalApplyList(obj);
  103. if (data.code == 200) {
  104. for(let i=0;i<data.data.records.length;i++){
  105. data.data.records[i].approveTime = parseTime(data.data.records[i].approveTime, "{y}-{m}-{d} {h}:{i}:{s}");
  106. data.data.records[i].submitTime = parseTime(data.data.records[i].submitTime, "{y}-{m}-{d} {h}:{i}:{s}");
  107. }
  108. if(self.queryParams.page == 1){
  109. this.$set(this, 'dataList', data.data.records);
  110. this.$set(this, 'total', data.data.total);
  111. if (data.data.total / self.queryParams.pageSize <= self.queryParams.page) {
  112. this.$set(this, 'getDataType', true);
  113. }
  114. }else{
  115. this.$set(this, 'dataList', [...this.dataList, ...data.data.records]);
  116. this.$set(this, 'total', data.data.total);
  117. if (data.data.total / self.queryParams.pageSize <= self.queryParams.page) {
  118. this.$set(this, 'getDataType', true);
  119. }
  120. }
  121. }
  122. },
  123. //选择器
  124. typeChange(e){
  125. this.$set(this.queryParams,'status',this.typeList[e.detail.value].value);
  126. this.$set(this,'typeIndex',e.detail.value);
  127. this.$set(this.queryParams, 'page', 1);
  128. this.$set(this, 'dataList', []);
  129. this.$set(this, 'getDataType', true);
  130. this.getList();
  131. },
  132. //通过
  133. throughButton(item){
  134. let self = this;
  135. this.$set(this,'dialogData',item);
  136. uni.showModal({
  137. content: '是否确认通过?',
  138. cancelColor: "#999",
  139. confirmColor: "#0183FA",
  140. success: function(res) {
  141. if (res.confirm) {
  142. self.hwmsAppRegisterApprovalApply(1);
  143. } else if (res.cancel) {}
  144. }
  145. });
  146. },
  147. //驳回
  148. rejectionButton(type,item){
  149. if(type == 1){
  150. this.$set(this,'dialogData',item);
  151. this.$set(this,'dialogText','');
  152. this.$set(this,'dialogType',true);
  153. }else{
  154. this.$set(this,'dialogType',false);
  155. }
  156. },
  157. //弹窗按钮
  158. dialogButton(type){
  159. if(type == 1){
  160. this.hwmsAppRegisterApprovalApply(1);
  161. }else if(type == 2){
  162. if(!this.dialogText){
  163. uni.showToast({
  164. title: '请输入备注',
  165. icon: "none",
  166. mask: true,
  167. duration: 2000
  168. });
  169. return
  170. }
  171. this.hwmsAppRegisterApprovalApply(2);
  172. }
  173. },
  174. async hwmsAppRegisterApprovalApply(type){
  175. let self = this;
  176. let obj = {
  177. id:this.dialogData.id,
  178. status:type,
  179. };
  180. if(type == 2){
  181. obj.rejectReason = this.dialogText;
  182. }
  183. const {
  184. data
  185. } = await hwmsAppRegisterApprovalApply(obj)
  186. if (data.code == 200) {
  187. for(let i=0;i<self.dataList.length;i++){
  188. if(self.dialogData.id == self.dataList[i].id){
  189. self.dataList[i].status = type;
  190. }
  191. }
  192. uni.showToast({
  193. title: '提交成功',
  194. icon: "none",
  195. mask: true,
  196. duration: 2000
  197. });
  198. this.$set(this,'dialogType',false);
  199. }
  200. },
  201. goPage(){
  202. uni.navigateTo({
  203. url: "/pages_hazardousWasteRecycling/views/permissionApply/addPage",
  204. });
  205. },
  206. },
  207. }
  208. </script>
  209. <style lang="stylus" scoped>
  210. .permissionApplyListPage{
  211. height: 100%;
  212. display flex;
  213. flex-direction column;
  214. .get-null-box {
  215. height: 100rpx;
  216. line-height: 100rpx;
  217. color: #999;
  218. text-align center;
  219. }
  220. .top-picker-box{
  221. .picker-p{
  222. border:1px solid #dedede;
  223. background-color: #fff;
  224. margin:20rpx 20rpx;
  225. padding:0 40rpx;
  226. line-height:60rpx;
  227. border-radius:10rpx;
  228. color:#999;
  229. }
  230. .check-picker-p{
  231. color:#333;
  232. }
  233. }
  234. .for-max-box{
  235. flex: 1;
  236. overflow-y scroll;
  237. padding:0 20rpx;
  238. .for-box{
  239. background-color: #fff;
  240. border-radius:10rpx;
  241. border:1rpx solid #dedede;
  242. width:666rpx;
  243. overflow: hidden;
  244. margin-bottom:20rpx;
  245. padding:20rpx;
  246. position: relative;
  247. view{
  248. font-size:30rpx;
  249. line-height:50rpx;
  250. }
  251. .title-p{
  252. font-weight:700;
  253. }
  254. .text-p{
  255. }
  256. .position-p{
  257. position: absolute;
  258. top:20rpx;
  259. right:20rpx;
  260. width:140rpx;
  261. text-align: center;
  262. }
  263. .colorA{
  264. color:#0183FA;
  265. }
  266. .colorB{
  267. color:#FF6A6A;
  268. }
  269. .button-p-1{
  270. position: absolute;
  271. bottom:120rpx;
  272. right:20rpx;
  273. background-color: #0183FA;
  274. border: 1rpx solid #0183FA;
  275. border-radius:10rpx;
  276. text-align: center;
  277. height:60rpx;
  278. line-height:58rpx;
  279. width:140rpx;
  280. color:#fff;
  281. }
  282. .button-p-2{
  283. position: absolute;
  284. bottom:20rpx;
  285. right:20rpx;
  286. background-color: #fff;
  287. border: 1rpx solid #FF6A6A;
  288. border-radius:10rpx;
  289. text-align: center;
  290. height:60rpx;
  291. line-height:58rpx;
  292. width:140rpx;
  293. color:#FF6A6A;
  294. }
  295. }
  296. }
  297. .add-button{
  298. width:650rpx;
  299. height:80rpx;
  300. margin:30rpx 50rpx 40rpx;
  301. line-height:80rpx;
  302. color:#fff;
  303. background-color: #0183FA;
  304. text-align: center;
  305. border-radius:10rpx;
  306. }
  307. .shade-max-big-box{
  308. position: fixed;
  309. height:100%;
  310. width:100%;
  311. background-color: rgba(0,0,0,0.5);
  312. display: flex;
  313. flex-direction: column;
  314. overflow: hidden
  315. .shade-null-1{
  316. flex:3;
  317. }
  318. .shade-null-2{
  319. flex:5;
  320. }
  321. .shade-big-box{
  322. width: 550rpx;
  323. margin: 0 auto;
  324. // height:500rpx;
  325. background-color: #fff;
  326. border-radius:10rpx;
  327. overflow: hidden;
  328. .shade-title-p{
  329. text-align: center;
  330. font-size: 34rpx;
  331. color: #0183fa;
  332. border-bottom: 1rpx solid #dedede;
  333. line-height: 80rpx;
  334. }
  335. .textarea{
  336. width: 450rpx;
  337. height: 200rpx;
  338. margin: 40rpx auto;
  339. border:1rpx solid #dededede;
  340. border-radius:10rpx;
  341. padding:20rpx;
  342. }
  343. .shade-button-box{
  344. display: flex;
  345. view:nth-child(1){
  346. flex:1;
  347. border-top:1px solid #dedede;
  348. background-color: #FFF;
  349. color:#0183FA;
  350. text-align: center;
  351. line-height:58rpx;
  352. height:60rpx;
  353. width:100rpx;
  354. }
  355. view:nth-child(2){
  356. flex:1;
  357. border:1px solid #0183FA;
  358. background-color: #0183FA;
  359. color:#fff;
  360. text-align: center;
  361. line-height:58rpx;
  362. height:60rpx;
  363. width:100rpx;
  364. }
  365. }
  366. }
  367. }
  368. }
  369. </style>