reserveDetail.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695
  1. <template>
  2. <view class="reserve-detail-page">
  3. <view v-if="message.status == 7" class="look-huizhi" @click="preview(1)">
  4. 回执
  5. </view>
  6. <view class="box u-skeleton">
  7. <u-skeleton :loading="loading" :animation="true"></u-skeleton>
  8. <view class="msg-top">
  9. <text style="font-size: 15px;font-weight: bold;color: #333333;">
  10. <text v-if="message.template == 1">正常上班时间</text>
  11. <text v-if="message.template == 2">非正常上班时间</text>
  12. <text v-if="message.template == 3">信息技术学院教师</text>
  13. </text>
  14. <text style="font-size: 12px;font-weight: 400;color: #FFAD33;" @click="lookOpenCheckStep">
  15. <text class="status-text" v-if="message.status == 7">{{message.status_text}}</text>
  16. <text class="status-text-loading"
  17. v-if="message.status == 1 ||message.status == 2 ||message.status == 5 ||message.status == 3">{{message.status_text}}</text>
  18. <text class="status-text-fail"
  19. v-if="message.status == 6 || message.status == 8 || message.status == 4">{{message.status_text}}</text>
  20. <text class="status-text-fail" v-if="message.status == 0">{{message.status_text}}</text>
  21. </text>
  22. </view>
  23. <view class="msg-center">
  24. <text>申请人:{{message.applicant_name}} {{message.applicant_mobile}}</text>
  25. <text>部门:{{message.branch? message.branch.name:'--'}}(科室:{{message.department}})</text>
  26. <text>使用人数:{{message.use_people_nums}}人</text>
  27. <text>开放实验室信息:</text>
  28. <table style="padding: 5px 0px;">
  29. <tr class="u-tr">
  30. <th class="u-th room_name">实验室</th>
  31. <th class="u-th">申请时间</th>
  32. <!-- <th class="u-th">周次</th> -->
  33. <!-- <th class="u-th">星期</th> -->
  34. <th class="u-th">节次</th>
  35. </tr>
  36. <tr class="u-tr" v-for="(item,index) in use_data" :key="index" width="100%">
  37. <td class="u-td room_name"><text>{{item.room_name}}</text></td>
  38. <td class="u-td">{{item.day}}</td>
  39. <!-- <td class="u-td">第{{item.week}}周</td> -->
  40. <!-- <td class="u-td">{{item.week_index}}</td> -->
  41. <td class="u-td">{{item.time_name}}</td>
  42. </tr>
  43. </table>
  44. <view style="display: flex;flex-wrap: wrap;align-items: center;">
  45. <text style="padding-top: 0;">申请原因:</text>
  46. <view class="miaoshu">
  47. <u-parse :html="message.use_reason"></u-parse>
  48. </view>
  49. </view>
  50. <text>使用需求:</text>
  51. </view>
  52. <view class="miaoshu">
  53. <u-parse :html="message.use_need!=null ? message.use_need : ''"></u-parse>
  54. </view>
  55. <view class="file" @click="preview(2)">
  56. <u-icon name="file-text-fill" size="30" color="#333333"></u-icon>附件:<text
  57. style="color: #3665FF;">{{message.status != 1 ? '申请文件' : '待上传'}}</text>
  58. </view>
  59. <view style="margin: 10px;width: 100%;">
  60. <u-button type="primary" size="mini" @click='downLoad'>
  61. <u-icon name="download"></u-icon>下载实验室开放预约申请表
  62. </u-button>
  63. </view>
  64. <block v-if="message.status == 2 || message.status == 3">
  65. <view v-if="$transformAuth('100101') || $transformAuth('100102')" class="btn-btm">
  66. <view class="left" @click="refuseShow = true"
  67. v-if="$transformAuth('100101') && $transformAuth('100102')">
  68. <text>审核失败</text>
  69. </view>
  70. <view class="left" @click="checkFalse(1,true)"
  71. v-if="$transformAuth('100101') && !$transformAuth('100102') && message.status==3">
  72. <text>审核失败</text>
  73. </view>
  74. <view class="left" @click="checkFalse(2,true)"
  75. v-if="$transformAuth('100102') && !$transformAuth('100101') && message.status==2">
  76. <text>审核失败</text>
  77. </view>
  78. <view class="right" @click="show = true"
  79. v-if="$transformAuth('100101') && $transformAuth('100102')">
  80. <text>审核通过</text>
  81. </view>
  82. <view class="right" @click="tongguo(1)"
  83. v-if="$transformAuth('100101') && !$transformAuth('100102')">
  84. <text>审核通过</text>
  85. </view>
  86. <view class="right" @click="tongguo(2)"
  87. v-if="$transformAuth('100102') && !$transformAuth('100101')">
  88. <text>审核通过</text>
  89. </view>
  90. </view>
  91. </block>
  92. <view class="btn-btm" v-if="message.status == 1">
  93. <view class="right" style="width: 327px;margin: 0 auto;" @click="upload">
  94. <text>上传实验室开放申请单</text>
  95. </view>
  96. </view>
  97. <view class="pop-bj" v-show="refuseShow"></view>
  98. <view class="pop" v-if="refuseShow">
  99. <image src="/static/image/record/laba.png" mode="" style="width: 91px;height: 68px;margin-top: -45px;">
  100. </image>
  101. <text class="txt2" style="width: 80%;"
  102. v-if="$transformAuth('100101') && $transformAuth('100102')">请选择审核类型</text>
  103. <view class="prop-text" style="width: 80%;" v-if="$transformAuth('100101') && $transformAuth('100102')">
  104. <u-radio-group v-model="type" @change="radioGroupChange">
  105. <u-radio @change="radioChange" v-for="(item, index) in list" :key="index" :name="item.id">
  106. {{item.name}}
  107. </u-radio>
  108. </u-radio-group>
  109. </view>
  110. <textarea name="" id="" cols="30" rows="10" v-model="value" placeholder="请输入驳回原因" class="miaoshu"
  111. style="width: 87%;"></textarea>
  112. <view class="pop-btn">
  113. <view @click="refuseShow=false,value=''" style="background: #F5F5F5;color: #333333;"
  114. custom-style="style">
  115. <text>取消</text>
  116. </view>
  117. <view style="background: #3665FF;color: #fff;" @click="checkFalse(type)">
  118. <text>确定</text>
  119. </view>
  120. </view>
  121. </view>
  122. <view class="pop-bj" v-show="show"></view>
  123. <view class="pop" v-if="show">
  124. <image src="/static/image/record/laba.png" mode="" style="width: 91px;height: 68px;margin-top: -45px;">
  125. </image>
  126. <text class="txt2" style="width: 80%;">请选择审核类型</text>
  127. <view class="prop-text" style="width: 80%;">
  128. <u-radio-group v-model="type" @change="radioGroupChange">
  129. <u-radio @change="radioChange" v-for="(item, index) in list" :key="index" :name="item.id">
  130. {{item.name}}
  131. </u-radio>
  132. </u-radio-group>
  133. </view>
  134. <view class="upload-huizhi" v-if="type !== 2">
  135. <u-upload max-count="6" ref="uUpload" :action="action" :form-data='uploadData'
  136. @on-success="uploadSuccess" @on-remove="handleRemove" @on-error="uploadError"></u-upload>
  137. </view>
  138. <view class="pop-btn">
  139. <view @click="show=false" style="background: #F5F5F5;color: #333333;">
  140. <text>取消</text>
  141. </view>
  142. <view style="background: #3665FF;color: #fff;" @click="tongguo(type)">
  143. <text>确定</text>
  144. </view>
  145. </view>
  146. </view>
  147. </view>
  148. </view>
  149. </template>
  150. <script>
  151. export default {
  152. data() {
  153. return {
  154. show: false,
  155. refuseShow: false,
  156. message: '',
  157. id: '',
  158. arr: [],
  159. pics: [],
  160. detailPics: [],
  161. use_data: '',
  162. type: 2, //停调课类型、1停课,2调课
  163. list: [{
  164. id: 2,
  165. name: '实验中心审核'
  166. }, {
  167. id: 1,
  168. name: '院系审核'
  169. }, {
  170. id: 3,
  171. name: '全部角色'
  172. }],
  173. value: '',
  174. loading: true,
  175. action: '',
  176. fileList: [],
  177. uploadData: {
  178. file_type: 'file',
  179. type: 'receipt'
  180. },
  181. }
  182. },
  183. methods: {
  184. //文件上传失败
  185. uploadError() {
  186. this.fileList = []
  187. this.$message.error('文件上传失败,请重新上传')
  188. },
  189. //文件上传成功
  190. uploadSuccess(response, file, lists) {
  191. // this.fileList.push(response.data)
  192. console.log(lists, '文件上传成功')
  193. this.fileList = lists
  194. },
  195. //移除已上传的文件
  196. handleRemove(file, lists) {
  197. console.log(lists, '文件上传成功')
  198. this.fileList = lists
  199. },
  200. //查看开放预约审核进度
  201. lookOpenCheckStep() {
  202. let item = this.message
  203. uni.navigateTo({
  204. url: '/pages/index/openCheckStep?id=' + item.id + '&time=' + item.created_at + '&enlength=' +
  205. item.enclosure.length + '&apply_name=' +
  206. (item.admin ? item.admin.name : '--')
  207. })
  208. },
  209. downLoad() {
  210. this.$u.get('/lab/open-appointment/down-print?id=' + this.message.id).then(res => {
  211. console.log(this.$u.http.config, '-----')
  212. uni.downloadFile({
  213. url: this.$u.http.config.downloadUrl + res.data.url,
  214. success: (res) => {
  215. if (res.statusCode === 200) {
  216. console.log('下载成功');
  217. }
  218. console.log(res.tempFilePath);
  219. uni.saveFile({
  220. tempFilePath: res.tempFilePath,
  221. success(e) {
  222. uni.openDocument({
  223. filePath: e.savedFilePath,
  224. showMenu: true, //showMenu是否显示右上角菜单
  225. fail: (e) => {
  226. uni.showToast({
  227. title: `打开失败` + e
  228. })
  229. }
  230. })
  231. },
  232. fail: (e) => {
  233. uni.showToast({
  234. title: '文件下载失败',
  235. icon: "none",
  236. })
  237. }
  238. });
  239. },
  240. fail: (e) => {
  241. uni.showToast({
  242. title: '文件下载失败',
  243. icon: "none",
  244. })
  245. }
  246. });
  247. })
  248. },
  249. uploadimg: function(data) {
  250. uni.showLoading({
  251. title: '上传图片中...',
  252. mask: true,
  253. })
  254. var that = this,
  255. i = data.i ? data.i : 0,
  256. success = data.success ? data.success : 0,
  257. fail = data.fail ? data.fail : 0;
  258. uni.uploadFile({
  259. url: data.url,
  260. filePath: data.path[i],
  261. name: 'file',
  262. formData: {
  263. file_type: 'img',
  264. type: 'enclosure'
  265. },
  266. success: (resp) => {
  267. uni.hideLoading();
  268. success++;
  269. var str = resp.data //返回的结果,可能不同项目结果不一样
  270. var pic = JSON.parse(str);
  271. var pic_name = pic.data.id;
  272. var detailPics = that.detailPics;
  273. detailPics.push(pic_name)
  274. that.detailPics = detailPics
  275. },
  276. fail: (res) => {
  277. fail++;
  278. },
  279. complete: () => {
  280. i++;
  281. if (i == data.path.length) { //当图片传完时,停止调用
  282. console.log(that.detailPics)
  283. that.$u.post('/lab/open-appointment/upload-print', {
  284. id: that.message.id,
  285. enclosure: that.detailPics
  286. }).then(res => {
  287. console.log(res)
  288. that.detail()
  289. })
  290. } else { //若图片还没有传完,则继续调用函数
  291. data.i = i;
  292. data.success = success;
  293. data.fail = fail;
  294. that.uploadimg(data); //递归,回调自己
  295. }
  296. }
  297. });
  298. },
  299. upload() {
  300. var that = this;
  301. wx.chooseImage({
  302. count: 2, // 最多可以选择的图片张数,默认9
  303. sizeType: ['original', 'compressed'], // original 原图,compressed 压缩图,默认二者都有
  304. sourceType: ['album', 'camera'], // album 从相册选图,camera 使用相机,默认二者都有
  305. success: function(res) {
  306. var imgs = res.tempFilePaths;
  307. for (var i = 0; i < imgs.length; i++) {
  308. that.pics.push(imgs[i])
  309. }
  310. console.log(that.pics)
  311. that.uploadimg({
  312. url: that.$u.http.config.baseUrl + '/common/upload', //这里是你图片上传的接口
  313. path: that.pics, //这里是选取的图片的地址数组
  314. });
  315. },
  316. })
  317. },
  318. preview(type) {
  319. console.log('ppppp')
  320. var arr = [];
  321. if (type == 1) {
  322. //回执
  323. var path = this.message.receipt_resource;
  324. for (var i = 0; i < path.length; i++) {
  325. arr = arr.concat(path[i].url)
  326. }
  327. }
  328. if (type == 2) {
  329. var path = this.message.enclosure_resource;
  330. for (var i = 0; i < path.length; i++) {
  331. arr = arr.concat(path[i].url)
  332. }
  333. }
  334. uni.previewImage({
  335. current: arr[0], // 当前显示图片的http链接,将点击图片的索引数指定好
  336. urls: arr // 需要预览的图片http链接列表
  337. })
  338. },
  339. detail() {
  340. this.$u.get('/lab/open-appointment/info/' + this.id).then(res => {
  341. console.log(res)
  342. var data = res.data.use_data;
  343. for (var i = 0; i < data.length; i++) {
  344. if (data[i].week_index == 0) {
  345. data[i].week_index = '星期一'
  346. }
  347. if (data[i].week_index == 1) {
  348. data[i].week_index = '星期二'
  349. }
  350. if (data[i].week_index == 2) {
  351. data[i].week_index = '星期三'
  352. }
  353. if (data[i].week_index == 3) {
  354. data[i].week_index = '星期四'
  355. }
  356. if (data[i].week_index == 4) {
  357. data[i].week_index = '星期五'
  358. }
  359. if (data[i].week_index == 5) {
  360. data[i].week_index = '星期六'
  361. }
  362. if (data[i].week_index == 6) {
  363. data[i].week_index = '星期日'
  364. }
  365. }
  366. this.message = res.data;
  367. this.use_data = data;
  368. this.loading = false;
  369. })
  370. },
  371. radioGroupChange(e) {
  372. console.log(e)
  373. },
  374. radioChange(e) {
  375. //单选按钮事件
  376. },
  377. tongguo(type) {
  378. let arr = []
  379. this.fileList.map(item => {
  380. arr.push(item.response.data.id)
  381. })
  382. //确定审核
  383. if (type == '') {
  384. this.$u.toast('请选择审核类型')
  385. } else if (this.fileList.length == 0 && type !== 2) {
  386. this.$u.toast('请上传回执!')
  387. } else {
  388. var data = {
  389. id: this.message.id,
  390. check_status: 1,
  391. type: type,
  392. receipt: arr
  393. }
  394. this.$u.post('/lab/open-appointment/check', data).then(res => {
  395. console.log(res)
  396. this.$u.toast('审核成功');
  397. this.show = false;
  398. this.detail()
  399. })
  400. }
  401. },
  402. checkFalse(type, status) {
  403. this.type = type
  404. if (status) {
  405. this.refuseShow = true
  406. return
  407. }
  408. if (!this.type) {
  409. this.$u.toast('请选择审核类型')
  410. } else if (this.value == '') {
  411. this.$u.toast('请填写驳回原因')
  412. } else {
  413. var data = {
  414. id: this.message.id,
  415. check_status: 2,
  416. type: type,
  417. check_result: this.value
  418. }
  419. this.$u.post('/lab/open-appointment/check', data).then(res => {
  420. console.log(res)
  421. this.$u.toast('审核成功');
  422. this.refuseShow = false;
  423. this.detail()
  424. })
  425. }
  426. },
  427. },
  428. onLoad(options) {
  429. this.action = this.$u.http.config.baseUrl + '/common/upload'
  430. this.id = options.id
  431. this.detail()
  432. }
  433. }
  434. </script>
  435. <style lang="scss" scoped>
  436. .look-huizhi {
  437. position: fixed;
  438. height: 50px;
  439. width: 50px;
  440. bottom: 70px;
  441. text-align: center;
  442. right: 15px;
  443. background-color: #3665FF;
  444. color: #fff;
  445. line-height: 50px;
  446. z-index: 9;
  447. border-radius: 50%;
  448. }
  449. .upload-huizhi {
  450. padding: 0 15px;
  451. margin-top: 15px;
  452. // margin-bottom: 5px;
  453. width: 100%;
  454. }
  455. .reserve-detail-page {
  456. padding-bottom: 80px;
  457. }
  458. .box {
  459. padding: 12px 16px;
  460. box-sizing: border-box;
  461. display: flex;
  462. flex-direction: column;
  463. align-items: center;
  464. min-height: 100vh;
  465. position: relative;
  466. .msg-top {
  467. width: 100%;
  468. display: flex;
  469. align-items: center;
  470. justify-content: space-between;
  471. padding-bottom: 7px;
  472. }
  473. .msg-center {
  474. display: flex;
  475. flex-direction: column;
  476. justify-content: space-between;
  477. font-size: 13px;
  478. color: #333;
  479. font-weight: 400;
  480. width: 100%;
  481. text {
  482. padding-top: 5px;
  483. }
  484. }
  485. .miaoshu {
  486. min-height: 100px;
  487. background: #F8F8F8;
  488. border-radius: 8px 8px 8px 8px;
  489. opacity: 1;
  490. padding: 12px;
  491. box-sizing: border-box;
  492. margin-top: 8px;
  493. font-size: 14px;
  494. font-weight: 400;
  495. color: #666;
  496. width: 100%;
  497. }
  498. .file {
  499. margin-top: 12px;
  500. display: flex;
  501. align-items: center;
  502. font-size: 14px;
  503. width: 100%;
  504. }
  505. .btn-btm {
  506. position: fixed;
  507. padding: 5px 0;
  508. bottom: 0;
  509. width: 100%;
  510. display: flex;
  511. align-items: center;
  512. justify-content: center;
  513. z-index: 1;
  514. background-color: #FFFFFF;
  515. view {
  516. width: 150px;
  517. height: 44px;
  518. border-radius: 22px 22px 22px 22px;
  519. opacity: 1;
  520. font-size: 16px;
  521. font-weight: 400;
  522. display: flex;
  523. align-items: center;
  524. justify-content: center;
  525. }
  526. .left {
  527. box-sizing: border-box;
  528. border: 1px solid #3665FF;
  529. color: #3665FF;
  530. margin-right: 15px;
  531. background: rgba(54, 101, 255, 0.15);
  532. }
  533. .right {
  534. color: #FFFFFF;
  535. background: #3665FF;
  536. }
  537. }
  538. .pop-bj {
  539. width: 100vw;
  540. height: 100vh;
  541. background: #000000;
  542. opacity: 0.6;
  543. z-index: 1;
  544. position: fixed;
  545. top: 0;
  546. left: 0;
  547. }
  548. .pop {
  549. width: 327px;
  550. background: #FFFFFF;
  551. padding: 10px 0px;
  552. border-radius: 12px 12px 12px 12px;
  553. opacity: 1;
  554. position: fixed;
  555. transform: translate(-50%, -50%);
  556. background: white;
  557. z-index: 2;
  558. top: 50%;
  559. left: 50%;
  560. display: flex;
  561. flex-direction: column;
  562. align-items: center;
  563. .txt1 {
  564. font-size: 18px;
  565. font-weight: bold;
  566. color: #333;
  567. padding-top: 16px;
  568. }
  569. .txt2 {
  570. padding: 16px 0px;
  571. font-size: 16px;
  572. color: #333;
  573. font-weight: 400;
  574. }
  575. .pop-btn {
  576. margin-top: 24px;
  577. width: 84%;
  578. display: flex;
  579. align-items: center;
  580. justify-content: space-between;
  581. view {
  582. display: flex;
  583. align-items: center;
  584. justify-content: center;
  585. width: 130px;
  586. height: 44px;
  587. font-size: 16px;
  588. font-weight: bold;
  589. border-radius: 22px 22px 22px 22px;
  590. opacity: 1;
  591. }
  592. }
  593. }
  594. .prop-text {
  595. flex: 1;
  596. }
  597. }
  598. .status-text {
  599. font-size: 12px;
  600. font-weight: 400;
  601. color: #13ce66;
  602. }
  603. .status-text-loading {
  604. font-size: 12px;
  605. font-weight: 400;
  606. color: #ffba00;
  607. }
  608. .status-text-fail {
  609. font-size: 12px;
  610. font-weight: 400;
  611. color: #ff4d4f;
  612. }
  613. .u-tr {
  614. display: flex;
  615. align-items: center;
  616. width: 100%;
  617. border: 1px solid #ccc;
  618. border-bottom: none;
  619. border-right: none;
  620. .u-th {
  621. width: 25%;
  622. display: flex;
  623. align-items: center;
  624. justify-content: center;
  625. border-right: 1px solid #ccc;
  626. height: 30px;
  627. background: #f6f6f6;
  628. overflow: hidden;
  629. }
  630. .u-td {
  631. width: 25%;
  632. display: flex;
  633. align-items: center;
  634. justify-content: center;
  635. border-right: 1px solid #ccc;
  636. height: 30px;
  637. overflow: hidden;
  638. }
  639. .room_name {
  640. width: 50%;
  641. text {
  642. width: 100%;
  643. overflow: hidden;
  644. text-overflow: ellipsis;
  645. white-space: nowrap;
  646. text-align: center;
  647. }
  648. }
  649. }
  650. .u-tr:last-child {
  651. border-bottom: 1px solid #ccc;
  652. }
  653. </style>