listPage.vue 9.4 KB

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