accessQualificationInfo.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500
  1. <!-- 准入资格申请详情 -->
  2. <template>
  3. <view id="accessQualificationInfo" v-show="showType">
  4. <view class="user-info-box">
  5. <view class="user-info-box-min">
  6. <view>实验室:</view>
  7. <view>{{newData.labSecurityApply.subName}}{{newData.labSecurityApply.roomNum?'('+newData.labSecurityApply.roomNum+')':''}}</view>
  8. </view>
  9. <view class="user-info-box-min">
  10. <view>申请人:</view>
  11. <view>{{newData.labSecurityApply.userName}}</view>
  12. </view>
  13. <view class="user-info-box-min" style="flex-direction: column;">
  14. <view>申请时限:</view>
  15. <view>{{newData.labSecurityApply.validBeginTime}}至{{newData.labSecurityApply.validEndTime}}</view>
  16. </view>
  17. <view class="user-info-box-min">
  18. <view>申请备注:</view>
  19. <view>{{newData.labSecurityApply.applyCause==null?'':newData.labSecurityApply.applyCause}}</view>
  20. </view>
  21. </view>
  22. <view class="user-info-box" style="margin-bottom:20rpx;">
  23. <view class="user-info-box_title">
  24. <view style="color: red;">*</view>身份信息:
  25. </view>
  26. <view class="user-info-box-min">
  27. <view>申请人:</view>
  28. <view>{{newData.sysUser.userName}}</view>
  29. </view>
  30. <view class="user-info-box-min">
  31. <view>联系电话:</view>
  32. <view>{{newData.sysUser.mobile}}</view>
  33. </view>
  34. <view class="user-info-box-min">
  35. <view>学号:</view>
  36. <view>{{newData.sysUser.account}}</view>
  37. </view>
  38. <!-- <view class="user-info-box-min">
  39. <view>物理卡号:</view>
  40. <view>{{newData.sysUser.cardNum}}</view>
  41. </view> -->
  42. <view class="user-info-box-min" v-if="newData.sysUser.gradeName">
  43. <view>班级:</view>
  44. <view>{{newData.sysUser.gradeName}}</view>
  45. </view>
  46. <view class="user-info-box-min" v-if="newData.sysUser.tutorUserName">
  47. <view>导师:</view>
  48. <view>{{newData.sysUser.tutorUserName}}</view>
  49. </view>
  50. </view>
  51. <view v-for="(item,index) in newData.listTemp" :key="index" style="overflow: hidden;">
  52. <view class="word-box" v-if="item.materialType==1">
  53. <view class="word-box-title">{{item.materialName}}</view>
  54. <view class="word-box-min" v-for="(minItem,minIndex) in item.upList" :key="minIndex"
  55. @click="lookItem(minItem)">
  56. <img :src="imagesUrl('commonality/icon_pdf.png')" v-if="minItem.type == 'pdf'">
  57. <img :src="imagesUrl('commonality/icon_word.png')"
  58. v-if="minItem.type == 'doc' || minItem.type == 'docx'">
  59. <img :src="baseUrl+minItem.url"
  60. v-if="minItem.type == 'png' || minItem.type == 'jpg' || minItem.type == 'jpeg' || minItem.type == 'gif'">
  61. <view>{{minItem.name}}</view>
  62. </view>
  63. </view>
  64. </view>
  65. <view class="bottom-button-box" v-if="newData.labSecurityApply.auditStatus == 0">
  66. <view @click="goReviewFailed">驳回</view>
  67. <view @click="accessButtonClick">审核通过</view>
  68. </view>
  69. </view>
  70. </template>
  71. <script>
  72. import {
  73. config
  74. } from '@/api/request/config.js'
  75. import {
  76. laboratoryAppletGetApplyDetails,
  77. laboratoryAppletEditApp
  78. } from '@/pages_manage/api/index.js'
  79. export default {
  80. data() {
  81. return {
  82. baseUrl: config.base_url,
  83. pageType: false,
  84. //获取数据
  85. subjectData: {},
  86. newData: {},
  87. itemData: {},
  88. type: 0,
  89. applyId: '',
  90. showType:false,
  91. }
  92. },
  93. onLoad(option) {
  94. let self = this;
  95. if (!uni.getStorageSync('token')) {
  96. uni.setStorageSync('manageCation', option.item)
  97. uni.redirectTo({
  98. url: '/pages/views/login/login',
  99. });
  100. }else{
  101. if(uni.getStorageSync('manageCation')){
  102. uni.removeStorageSync('manageCation');
  103. }
  104. this.infoData = JSON.parse(decodeURIComponent(option.item));
  105. this.applyId = JSON.parse(decodeURIComponent(option.item)).applyId;
  106. this.laboratoryAppletGetApplyDetails();
  107. //修改页面title
  108. uni.setNavigationBarTitle({
  109. title: this.infoData.auditStatus == 0 ? '待审核' : (this.infoData.auditStatus == 1 ? '未通过' : (this
  110. .infoData.auditStatus == 2 ? '已通过' : ''))
  111. });
  112. }
  113. },
  114. onShow() {
  115. },
  116. methods: {
  117. //审核按钮
  118. accessButtonClick() {
  119. let self = this;
  120. uni.showModal({
  121. content: '确认审核吗?',
  122. cancelColor: "#999",
  123. confirmColor: "#0183FA",
  124. success: function(res) {
  125. if (res.confirm) {
  126. self.laboratoryAppletEditApp();
  127. } else if (res.cancel) {}
  128. }
  129. });
  130. },
  131. //审核接口
  132. async laboratoryAppletEditApp() {
  133. let obj = {
  134. applyId: this.newData.labSecurityApply.applyId,
  135. auditStatus: 2,
  136. };
  137. const {
  138. data
  139. } = await laboratoryAppletEditApp(obj)
  140. if (data.code == 200) {
  141. uni.showToast({
  142. title: '审核成功',
  143. icon: "none",
  144. mask: true,
  145. duration: 2000
  146. });
  147. let homeType = false;
  148. let list = getCurrentPages();
  149. if(list[1]){
  150. homeType = true;
  151. }
  152. // for(let i=0;i<list.length;i++){
  153. // if(list[i].route.indexOf('home') != -1){
  154. // homeType = true;
  155. // }
  156. // }
  157. if(homeType){
  158. setTimeout(function() {
  159. uni.navigateBack();
  160. }, 2000);
  161. }else{
  162. setTimeout(function() {
  163. uni.reLaunch({
  164. url: '/pages_manage/views/accessQualification/accessQualification',
  165. });
  166. }, 2000);
  167. }
  168. }
  169. },
  170. lookItem(minItem) {
  171. let self = this;
  172. if (minItem.type == 'png' || minItem.type == 'jpg' || minItem.type == 'jpeg' || minItem.type == 'gif') {
  173. //查看图片
  174. uni.previewImage({
  175. urls: [self.baseUrl + minItem.url], //需要预览的图片http链接列表,多张的时候,url直接写在后面就行了
  176. current: '', // 当前显示图片的http链接,默认是第一个
  177. success: function(res) {},
  178. fail: function(res) {},
  179. complete: function(res) {},
  180. })
  181. } else if (minItem.type == 'pdf' || minItem.type == 'doc' || minItem.type == 'docx') {
  182. uni.showLoading({
  183. title: '下载中'
  184. });
  185. console.log(self.baseUrl + '/' + minItem.name)
  186. console.log(minItem.url)
  187. //下载文档
  188. uni.downloadFile({
  189. url: self.baseUrl+minItem.url,
  190. header: {
  191. Authorization: uni.getStorageSync('token')
  192. },
  193. success: function(res) {
  194. const fileManager = wx.getFileSystemManager()
  195. const filePath = wx.env.USER_DATA_PATH + '/' + minItem.name
  196. fileManager.saveFile({
  197. tempFilePath: res.tempFilePath,
  198. filePath,
  199. success: () => {
  200. uni.hideLoading();
  201. wx.openDocument({
  202. filePath: filePath,
  203. showMenu: true,
  204. fileType: minItem.type
  205. })
  206. },
  207. fail: function(res) {
  208. uni.hideLoading();
  209. uni.showToast({
  210. title: '下载失败',
  211. icon: "none",
  212. mask: true,
  213. duration: 2000
  214. });
  215. }
  216. })
  217. },
  218. fail: function(res) {
  219. uni.hideLoading();
  220. uni.showToast({
  221. title: '下载失败',
  222. icon: "none",
  223. mask: true,
  224. duration: 2000
  225. });
  226. }
  227. })
  228. }
  229. },
  230. goReviewFailed() {
  231. let obj = {
  232. applyId: this.newData.labSecurityApply.applyId,
  233. rejectCause: this.newData.listTemp,
  234. }
  235. uni.navigateTo({
  236. url: '/pages_manage/views/accessQualification/approve?item=' + encodeURIComponent(JSON.stringify(
  237. obj))
  238. })
  239. },
  240. //查看图片
  241. lockImg(list) {
  242. if (!list[0]) {
  243. return
  244. }
  245. uni.previewImage({
  246. urls: list, //需要预览的图片http链接列表,多张的时候,url直接写在后面就行了
  247. current: '', // 当前显示图片的http链接,默认是第一个
  248. success: function(res) {},
  249. fail: function(res) {},
  250. complete: function(res) {},
  251. })
  252. },
  253. //审核信息详情
  254. async laboratoryAppletGetApplyDetails() {
  255. const {
  256. data
  257. } = await laboratoryAppletGetApplyDetails({
  258. applyId: this.applyId
  259. })
  260. if (data.code == 200) {
  261. let self = this;
  262. //判断链接跳转逻辑
  263. let homeType = false;
  264. let list = getCurrentPages();
  265. if(list[1]){
  266. homeType = true;
  267. }
  268. // for(let i=0;i<list.length;i++){
  269. // if(list[i].route.indexOf('home') != -1){
  270. // homeType = true;
  271. // }
  272. // }
  273. if(!homeType){
  274. if(data.data.labSecurityApply.auditStatus != 0){
  275. uni.showToast({
  276. title: '该申请已审核!',
  277. icon: "none",
  278. mask: true,
  279. duration: 2000
  280. });
  281. setTimeout(function() {
  282. uni.reLaunch({
  283. url: '/pages_manage/views/accessQualification/accessQualification',
  284. });
  285. }, 2000);
  286. return
  287. }
  288. }
  289. let dataList = [];
  290. for (let i = 0; i < data.data.listTemp.length; i++) {
  291. if (data.data.listTemp[i].materialType == 2 && data.data.listTemp[i].materialType == 2) {
  292. dataList.unshift(data.data.listTemp[i]);
  293. }
  294. }
  295. for (let i = 0; i < data.data.listTemp.length; i++) {
  296. if (data.data.listTemp[i].materialType == 1) {
  297. dataList.push(data.data.listTemp[i]);
  298. }
  299. }
  300. for (let i = 0; i < data.data.listTemp.length; i++) {
  301. if (data.data.listTemp[i].materialType == 2 && data.data.listTemp[i].materialType == 1) {
  302. dataList.unshift(data.data.listTemp[i]);
  303. }
  304. }
  305. this.$set(data.data, 'listTemp', dataList);
  306. let newList = [];
  307. for (let i = 0; i < data.data.listTemp.length; i++) {
  308. if (data.data.listTemp[i].materialType == 1) {
  309. let maxList = [];
  310. for (let o = 0; o < data.data.listTemp[i].listMr.length; o++) {
  311. let bigList = data.data.listTemp[i].listMr[o].dataUrl.split(',');
  312. for (let x = 0; x < bigList.length; x++) {
  313. if (bigList[x]) {
  314. let minList = bigList[x].split(';');
  315. let typeList = minList[0].split('.');
  316. let obj = {
  317. name: minList[0],
  318. url: minList[1],
  319. type: typeList[1],
  320. };
  321. maxList.push(obj);
  322. }
  323. }
  324. }
  325. data.data.listTemp[i].upList = maxList;
  326. let obj = {};
  327. if (maxList.length > 0) {
  328. obj = {
  329. forIndex: 0,
  330. url: self.baseUrl + maxList[0].url
  331. }
  332. }
  333. newList.push(obj);
  334. } else {
  335. let obj = {
  336. forIndex: "",
  337. url: ""
  338. }
  339. newList.push(obj);
  340. }
  341. }
  342. this.$set(this, 'newData', data.data)
  343. this.$set(this, 'showType', true)
  344. }
  345. },
  346. }
  347. }
  348. </script>
  349. <style lang="stylus" scoped>
  350. #accessQualificationInfo {
  351. height: 100%;
  352. overflow-y scroll;
  353. .user-info-box {
  354. background #fff;
  355. border-radius: 20rpx;
  356. margin: 20rpx 20rpx 0;
  357. padding: 20rpx 0;
  358. .user-info-box_title {
  359. font-size: 30rpx;
  360. font-family: PingFang SC;
  361. font-weight: 500;
  362. color: #333333;
  363. line-height: 30rpx;
  364. margin-left: 24rpx;
  365. margin-bottom:10px;
  366. >view {
  367. display inline-block;
  368. }
  369. }
  370. .user-info-box-min {
  371. margin: 0 26rpx;
  372. display flex;
  373. view {
  374. line-height: 66rpx;
  375. font-size: 28rpx;
  376. }
  377. view:nth-child(1) {
  378. width: 140rpx;
  379. color: #999;
  380. }
  381. view:nth-child(2) {
  382. flex: 1;
  383. text-align right;
  384. color: #333;
  385. }
  386. }
  387. }
  388. .user-card-box {
  389. background #fff;
  390. border-radius: 20rpx;
  391. margin: 0 20rpx 20rpx;
  392. padding: 20rpx 0;
  393. .user-card-title {
  394. padding-left: 24rpx;
  395. font-size: 30rpx;
  396. font-weight: 700;
  397. margin-bottom: 20rpx;
  398. }
  399. .user-card-text {
  400. line-height: 66rpx;
  401. font-size: 28rpx;
  402. color: #999;
  403. padding: 0 24rpx;
  404. }
  405. }
  406. .img-box {
  407. background #fff;
  408. border-radius: 20rpx;
  409. margin: 0 20rpx 20rpx;
  410. padding: 20rpx 0;
  411. .img-title {
  412. padding-left: 24rpx;
  413. font-size: 30rpx;
  414. font-weight: 700;
  415. margin-bottom: 20rpx;
  416. }
  417. img {
  418. display block;
  419. width: 640rpx;
  420. margin: 0 auto 10rpx;
  421. }
  422. }
  423. .word-box {
  424. background #fff;
  425. border-radius: 20rpx;
  426. margin: 0 20rpx 20rpx;
  427. padding: 20rpx 0;
  428. .word-box-title {
  429. padding-left: 24rpx;
  430. font-size: 30rpx;
  431. font-weight: 700;
  432. margin-bottom: 20rpx;
  433. }
  434. .word-box-min {
  435. display flex;
  436. margin: 0 20rpx 20rpx;
  437. img {
  438. height: 60rpx;
  439. width: 60rpx;
  440. }
  441. view {
  442. margin-left: 20rpx;
  443. line-height: 60rpx;
  444. }
  445. }
  446. }
  447. .bottom-button-box {
  448. display flex;
  449. width: 650rpx;
  450. margin: 40rpx auto;
  451. view {
  452. height: 100rpx;
  453. text-align center;
  454. line-height: 100rpx;
  455. color: #fff;
  456. width: 325rpx;
  457. }
  458. view:nth-child(1) {
  459. background: linear-gradient(-45deg, #FA9901, #F28E26);
  460. border-radius: 50rpx 0 0 50rpx;
  461. }
  462. view:nth-child(2) {
  463. background: linear-gradient(-35deg, #309CFF, #0183FA);
  464. border-radius: 0 50rpx 50rpx 0;
  465. }
  466. }
  467. }
  468. </style>