reportList.vue 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  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">报告名称:<text style="color: #7349ff;">{{item.FILE_NAME_ || ''}}</text></view>
  13. <view class="title">版本号:<text style="color: #7349ff;">{{item.run_qian_lu_jing_ || ''}}</text></view>
  14. <view class="title">报告类别:{{item.bao_gao_lei_bie_}}</view>
  15. <view class="title">报告类型:{{item.bao_gao_lei_xing_}}</view>
  16. <!-- <view class="title">联系人:{{item.wei_tuo_lian_xi_r}}</view> -->
  17. <view class="title">报告状态:<text style="color: #7349ff;">{{item.zhuang_tai_}}</text></view>
  18. <view class="title" style="color: #ff9900;" v-if="item.zhuang_tai_ == '待审核' && item.EXT_ == 'docx'">
  19. <u-icon name="question-circle-fill" class="u-m-r-5"></u-icon>该报告是docx格式,需要下载才能预览
  20. </view>
  21. <view class="btn">
  22. <view>
  23. <!-- <u-button type="warning" size="mini" @click="goDe(item.id_)" v-if="item.zhuang_tai_ == '待编制' || item.zhuang_tai_ == '待审核'">修改信息</u-button> -->
  24. <u-button type="warning" size="mini" @click="goto(item.id_,'1')" style="margin-left: 10rpx;" v-if="(item.zhuang_tai_ == '待审核' || item.zhuang_tai_ == '待审批') && item.EXT_ != 'docx'">预览报告</u-button>
  25. <u-button type="warning" size="mini" @click="goto(item.id_,'2')" style="margin-left: 10rpx;" v-if="item.zhuang_tai_ == '已完成'">查看报告</u-button>
  26. <u-button type="primary" size="mini" @click="geDownload(item.bao_gao_pdf_,item.FILE_NAME_, item.EXT_)" style="margin-left: 10rpx;" v-if="(item.zhuang_tai_ == '已完成') || (item.shi_fou_guo_shen_ == '已编制') || (item.zhuang_tai_ == '待审批') || (item.zhuang_tai_ == '待审核')">
  27. 下载报告</u-button>
  28. </view>
  29. </view>
  30. </view>
  31. </view>
  32. <view v-else>
  33. <uni-card is-full :is-shadow="false">
  34. <text class="">暂无报告</text>
  35. </uni-card>
  36. </view>
  37. <u-popup v-model="show" mode="bottom" closeable>
  38. <apply ref="apply" :id="id" v-if="show" @saveSuccees='saveSuccees'></apply>
  39. </u-popup>
  40. </view>
  41. </template>
  42. <script>
  43. import md5 from "@/common/util/md5.js"
  44. import http from "@/common/service/http.js"
  45. import {
  46. ACCESS_TOKEN,
  47. USER_NAME,
  48. USER_INFO
  49. } from "@/common/util/constants"
  50. import apply from './apply.vue'
  51. export default {
  52. components: {
  53. apply
  54. },
  55. data() {
  56. return {
  57. id: '',
  58. yangPinBianHao: '',
  59. reportList: [],
  60. userid: '',
  61. time: '',
  62. show: false
  63. }
  64. },
  65. onLoad(option) {
  66. if (option.id) {
  67. this.yangPinBianHao = option.id
  68. this.getList(option.id)
  69. }
  70. },
  71. created() {
  72. this.getInit()
  73. },
  74. methods: {
  75. getInit() {
  76. let info = uni.getStorageSync(USER_INFO);
  77. if (info.employee.id) {
  78. this.userid = info.employee.id || ''
  79. }
  80. var nowDate = new Date((new Date).getTime() + 8 * 60 * 60 * 1000)
  81. var time = nowDate.toJSON().split('T').join(' ').substr(0, 19)
  82. this.time = time
  83. },
  84. /*
  85. 根据样品编号查询报告礼拜
  86. */
  87. getList(id) {
  88. uni.showLoading({
  89. mask: true,
  90. title: 'loading'
  91. });
  92. //'${id}'
  93. let sql =
  94. `select a.*,b.FILE_NAME_,b.EXT_ from t_lhjcbgb a left join ibps_file_attachment b on a.bao_gao_pdf_ = b.id_ where a.yang_pin_bian_hao = '${id}' ORDER BY a.create_time_ desc`
  95. let requestData = this.$sig(sql)
  96. this.$http.post("/ibps/business/v3/sys/universal/inputSqlSelectData", requestData).then(res => {
  97. if (res.data.state == 200) {
  98. const data = res.data.variables.data
  99. this.reportList = data
  100. uni.hideLoading()
  101. }
  102. })
  103. },
  104. /*
  105. 跳转页面在线查看文档页面
  106. */
  107. goto(id, type) {
  108. uni.navigateTo({ // 跳转页面
  109. url: "/pages/fileView/fileView?id=" + id + '&type=' + type
  110. })
  111. },
  112. //下载
  113. // getDe(id, item) {
  114. // uni.showLoading({
  115. // title: '下载中',
  116. // mask: true
  117. // })
  118. // let sql =
  119. // `select a.bao_gao_pdf_,b.FILE_NAME_,b.EXT_ FROM t_lhjcbgb a left join ibps_file_attachment b on a.bao_gao_pdf_ = b.id_ WHERE a.id_ = '${id}'`
  120. // let requestData = this.$sig(sql)
  121. // this.$http.post("/ibps/business/v3/sys/universal/inputSqlSelectData", requestData).then(res => {
  122. // if (res.data.state == 200) {
  123. // const data = res.data.variables.data[0]
  124. // this.geDownload(data.bao_gao_pdf_, data.FILE_NAME_, data.EXT_)
  125. // }
  126. // })
  127. // },
  128. geDownload(id, item, type) {
  129. uni.showLoading({
  130. title: '下载中',
  131. mask: true
  132. })
  133. let requestData = {
  134. attachmentId: id
  135. }
  136. this.$http.get(`/ibps/platform/v3/file/download?attachmentId=${id}`, {
  137. responseType: 'arraybuffer'
  138. }).then(res => {
  139. const blob = new Blob([
  140. res.data
  141. ], {
  142. type: 'application/octet-stream'
  143. })
  144. const url = window.URL.createObjectURL(blob)
  145. const link = document.createElement('a')
  146. link.style.display = 'none'
  147. link.href = url
  148. link.setAttribute('download', item + '.' + type)
  149. document.body.appendChild(link)
  150. link.click()
  151. window.URL.revokeObjectURL(link.href)
  152. document.body.removeChild(link)
  153. uni.hideLoading()
  154. })
  155. },
  156. goDe(id) {
  157. this.id = id
  158. this.show = true
  159. },
  160. saveSuccees() {
  161. this.show = false
  162. this.reportList = []
  163. this.getList(this.yangPinBianHao)
  164. },
  165. /*
  166. md5加密
  167. */
  168. sig(sql) {
  169. let rul = (sql.length + 9) * 12 * 3 + 168
  170. let salt = "JinYuanXinTong"
  171. return md5(rul + '' + salt)
  172. },
  173. }
  174. }
  175. </script>
  176. <style lang="scss" scoped>
  177. .box {
  178. padding: 20rpx;
  179. .sinList {
  180. padding: 20rpx;
  181. margin-bottom: 20rpx;
  182. width: 100%;
  183. background: #fff;
  184. .title {
  185. line-height: 48rpx;
  186. }
  187. .btn {
  188. display: flex;
  189. justify-content: flex-end;
  190. }
  191. }
  192. }
  193. </style>