rectifyInfo.vue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. <template>
  2. <view class="content">
  3. <u-navbar back-text="返回" title="隐患整改清单" back-icon-color="#ffffff" :back-text-style="{color: '#ffffff'}" title-color="#ffffff"
  4. :background="{backgroundColor: mainColor}" :border-bottom="false"></u-navbar>
  5. <view class="handle-box">
  6. <text class="handle-button" @click="goToAutographForm" v-if="form.signState == 1">签字</text>
  7. <text class="handle-button" @click="downloadPDF">下载</text>
  8. </view>
  9. <u-image width="100%" mode="widthFix" :src="'data:image/png;base64,' + item.pic" v-for="(item, index) in contractInfo"
  10. :key="index"></u-image>
  11. <view class="handle-fix-box">
  12. <u-button type="primary" :ripple="true" :custom-style="customStyle" @click="submitRectify()" :disabled="form.signState != 1">已签阅</u-button>
  13. </view>
  14. <u-top-tips ref="uTips" :navbar-height="statusBarHeight + navbarHeight"></u-top-tips>
  15. </view>
  16. </template>
  17. <script>
  18. var context = null
  19. import {
  20. mapGetters
  21. } from 'vuex'
  22. const NET = require('@/utils/request')
  23. const API = require('@/config/api')
  24. export default {
  25. computed: {
  26. ...mapGetters([
  27. 'mainColor',
  28. 'customStyle',
  29. ])
  30. },
  31. data() {
  32. return {
  33. statusBarHeight: uni.getSystemInfoSync().statusBarHeight,
  34. navbarHeight: 44,
  35. form: {
  36. tenantId: '',
  37. assetId: '',
  38. taskId: '',
  39. signState: '',
  40. },
  41. contractInfo: [],
  42. }
  43. },
  44. onLoad(options) {
  45. this.form.tenantId = options.tenantId
  46. this.form.assetId = options.assetId
  47. this.form.taskId = options.taskId
  48. this.form.signState = options.signState
  49. this.getContractInfo()
  50. },
  51. onShow() {},
  52. methods: {
  53. // 获取数据
  54. getContractInfo(parentName, sex) {
  55. NET.request(API.getDangerInfo + this.form.taskId, {}, 'GET').then(res => {
  56. this.contractInfo = res.data
  57. }).catch(error => {
  58. this.$refs.uTips.show({
  59. title: error.message,
  60. type: 'warning',
  61. })
  62. })
  63. },
  64. // 跳转签字表单
  65. goToAutographForm() {
  66. uni.navigateTo({
  67. url: '/pagesHandle/autographForm?taskId=' + this.form.taskId
  68. });
  69. },
  70. // 下载PDF
  71. downloadPDF() {
  72. NET.request(API.downloadPDF + this.form.taskId, {}, 'GET').then(res => {
  73. uni.downloadFile({
  74. url: res.data,
  75. header: {
  76. Authorization: 'Bearer ' + uni.getStorageSync('token')
  77. },
  78. success: (res1) => {
  79. uni.saveFile({
  80. tempFilePath: res1.tempFilePath,
  81. success: (res2) => {
  82. uni.getSavedFileList({
  83. success: (res3) => {
  84. // this.$refs.uTips.show({
  85. // title: res3.fileList.length,
  86. // type: 'success',
  87. // })
  88. }
  89. });
  90. uni.openDocument({
  91. filePath: res2.savedFilePath,
  92. success: (res3) => {
  93. this.$refs.uTips.show({
  94. title: '下载成功',
  95. type: 'success',
  96. })
  97. }
  98. });D
  99. },
  100. });
  101. }
  102. });
  103. }).catch(error => {
  104. this.$refs.uTips.show({
  105. title: error.message,
  106. type: 'warning',
  107. })
  108. })
  109. },
  110. // 已签阅
  111. submitRectify() {
  112. uni.navigateTo({
  113. url: '/pagesHandle/autographForm?taskId=' + this.form.taskId
  114. });
  115. return false
  116. NET.request(API.submitRectifyForm, {}, 'POST').then(res => {
  117. this.$refs.uTips.show({
  118. title: '签阅成功',
  119. type: 'success',
  120. })
  121. setTimeout(() => {
  122. uni.reLaunch({
  123. url: '/pages/index/index'
  124. })
  125. }, 1000)
  126. }).catch(error => {
  127. this.$refs.uTips.show({
  128. title: error.message,
  129. type: 'warning',
  130. })
  131. })
  132. }
  133. },
  134. }
  135. </script>
  136. <style>
  137. page {
  138. width: 100%;
  139. height: 100%;
  140. }
  141. </style>
  142. <style lang="scss" scoped>
  143. @import "@/static/css/themes.scss";
  144. .content {
  145. width: 100%;
  146. height: 100vh;
  147. float: left;
  148. padding: 0px 15px 60px 15px;
  149. box-sizing: border-box;
  150. .handle-box {
  151. width: calc(100% + 30px);
  152. margin-left: -15px;
  153. padding: 0px 15px;
  154. height: 30px;
  155. background-color: $mainColor;
  156. text-align: right;
  157. .handle-button {
  158. color: #FFFFFF;
  159. font-size: 14px;
  160. line-height: 30px;
  161. margin-left: 16px;
  162. }
  163. }
  164. }
  165. </style>