reportList.vue 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  1. <template>
  2. <view class="container">
  3. <cu-custom bgColor="bg-luohu" :isBack="true">
  4. <block slot="backText">返回</block>
  5. <block slot="content">检测报告</block>
  6. </cu-custom>
  7. <view class="box" v-if="reportList.length > 0">
  8. <view class="sinList" v-for="(item,index) in reportList" :key="index">
  9. <view class="title">报告编号:{{item.bao_gao_bian_hao_}}</view>
  10. <view class="title">样品编号:{{item.yang_pin_bian_hao}}</view>
  11. <view class="title">样品名称:{{item.yang_pin_ming_che}}</view>
  12. <view class="title">联系人:{{item.wei_tuo_lian_xi_r}}</view>
  13. <view class="title">报告状态:<text style="color: #7349ff;">{{item.zhuang_tai_}}</text></view>
  14. <view class="btn">
  15. <view>
  16. <u-button type="warning" size="mini" @click="goDe(item.id_)" style="margin-right: 10rpx;"
  17. v-if="item.zhuang_tai_ == '待编制' || item.zhuang_tai_ == '待审核'">修改信息</u-button>
  18. <u-button type="warning" size="mini" @click="goto(item.id_,'1')"
  19. v-if="item.zhuang_tai_ == '待编制' || item.zhuang_tai_ == '待审核'">预览报告</u-button>
  20. <u-button type="warning" size="mini" @click="goto(item.id_,'2')" style="margin-right: 10rpx;"
  21. v-if="item.zhuang_tai_ == '待发放' || item.zhuang_tai_ == '已完成'">查看报告</u-button>
  22. <u-button type="primary" size="mini" v-if="item.zhuang_tai_ == '已完成'"
  23. @click="getDe(item.id_,item)">
  24. 下载报告</u-button>
  25. </view>
  26. </view>
  27. </view>
  28. </view>
  29. <view v-else>
  30. <uni-card is-full :is-shadow="false">
  31. <text class="">暂无报告</text>
  32. </uni-card>
  33. </view>
  34. <u-popup v-model="show" mode="bottom" closeable>
  35. <apply ref="apply" :id="id" v-if="show" @saveSuccees='saveSuccees'></apply>
  36. </u-popup>
  37. </view>
  38. </template>
  39. <script>
  40. import md5 from "@/common/util/md5.js"
  41. import http from "@/common/service/http.js"
  42. import {
  43. ACCESS_TOKEN,
  44. USER_NAME,
  45. USER_INFO
  46. } from "@/common/util/constants"
  47. import apply from './apply.vue'
  48. export default {
  49. components: {
  50. apply
  51. },
  52. data() {
  53. return {
  54. id: '',
  55. reportList: [],
  56. userid: '',
  57. time: '',
  58. show: false
  59. }
  60. },
  61. onLoad(option) {
  62. console.log(option)
  63. if (option.id) {
  64. this.id = option.id
  65. this.getList(option.id)
  66. }
  67. },
  68. created() {
  69. this.getInit()
  70. },
  71. methods: {
  72. getInit() {
  73. let info = uni.getStorageSync(USER_INFO);
  74. if (info.employee.id) {
  75. this.userid = info.employee.id || ''
  76. }
  77. var nowDate = new Date((new Date).getTime() + 8 * 60 * 60 * 1000)
  78. var time = nowDate.toJSON().split('T').join(' ').substr(0, 19)
  79. this.time = time
  80. },
  81. /*
  82. 根据委托单id查询报告礼拜
  83. */
  84. getList(id) {
  85. uni.showLoading({
  86. mask: true,
  87. title: 'loading'
  88. });
  89. //'${id}'
  90. let sql =
  91. `select * from t_lhjcbgb where wei_tuo_id_= '${id}' ORDER BY create_time_ desc`
  92. let requestData = this.$sig(sql)
  93. this.$http.post("/ibps/business/v3/sys/universal/inputSqlSelectData", requestData).then(res => {
  94. if (res.data.state == 200) {
  95. const data = res.data.variables.data
  96. this.reportList = data
  97. uni.hideLoading()
  98. }
  99. })
  100. },
  101. /*
  102. 跳转页面在线查看文档页面
  103. */
  104. goto(id, type) {
  105. uni.navigateTo({ // 跳转页面
  106. url: "/pages/fileView/fileView?id=" + id + '&type=' + type
  107. })
  108. },
  109. //下载
  110. getDe(id) {
  111. let access_token = uni.getStorageSync('Access-Token')
  112. console.log(access_token)
  113. let sql =
  114. `select FILE_PATH_ from ibps_file_attachment WHERE id_ = (SELECT bao_gao_pdf_ FROM t_lhjcbgb WHERE id_ = '${id}')`
  115. let requestData = this.$sig(sql)
  116. this.$http.post("/ibps/business/v3/sys/universal/inputSqlSelectData", requestData).then(res => {
  117. if (res.data.state == 200) {
  118. const data = res.data.variables.data[0]
  119. let url =
  120. http.apiHosp + data.FILE_PATH_
  121. //电脑下载
  122. let a = document.createElement('a')
  123. a.target = '_black'
  124. a.download = this.time + '检测报告'
  125. a.style.display = 'none'
  126. // 生成的base64编码
  127. a.href = url
  128. document.body.appendChild(a)
  129. a.click()
  130. document.body.removeChild(a)
  131. //手机下载
  132. // var iframe = document.createElement('iframe');
  133. // iframe.style.display = '_black';
  134. // iframe.src = "javascript: '<script>location.href=\"" + url + "\"<\/script>'";
  135. // document.getElementsByTagName('body')[0].appendChild(iframe);
  136. }
  137. })
  138. },
  139. goDe(id) {
  140. this.id = id
  141. this.show = true
  142. },
  143. saveSuccees() {
  144. this.reportList = []
  145. this.getDe(this.id)
  146. },
  147. /*
  148. md5加密
  149. */
  150. sig(sql) {
  151. let rul = (sql.length + 9) * 12 * 3 + 168
  152. let salt = "JinYuanXinTong"
  153. return md5(rul + '' + salt)
  154. },
  155. }
  156. }
  157. </script>
  158. <style lang="scss" scoped>
  159. .box {
  160. padding: 20rpx;
  161. .sinList {
  162. padding: 20rpx;
  163. margin-bottom: 20rpx;
  164. width: 100%;
  165. background: #fff;
  166. .title {
  167. line-height: 48rpx;
  168. }
  169. .btn {
  170. display: flex;
  171. justify-content: flex-end;
  172. }
  173. }
  174. }
  175. </style>