| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203 |
- <template>
- <view class="container">
- <cu-custom bgColor="bg-luohu" :isBack="true">
- <block slot="backText">返回</block>
- <block slot="content">检测报告</block>
- </cu-custom>
- <view class="box" v-if="reportList.length > 0">
- <view class="sinList" v-for="(item,index) in reportList" :key="index">
- <view class="title">报告编号:{{item.bao_gao_bian_hao_}}</view>
- <view class="title">样品编号:{{item.yang_pin_bian_hao}}</view>
- <view class="title">报告名称:<text style="color: #7349ff;">{{item.FILE_NAME_ || ''}}</text></view>
- <view class="title">样品名称:{{item.yang_pin_ming_che}}</view>
- <!-- <view class="title">联系人:{{item.wei_tuo_lian_xi_r}}</view> -->
- <view class="title">报告状态:<text style="color: #7349ff;">{{item.zhuang_tai_}}</text></view>
- <view class="title" style="color: #ff9900;" v-if="item.zhuang_tai_ == '待审核' && item.EXT_ == 'docx'">
- <u-icon name="question-circle-fill" class="u-m-r-5"></u-icon>该报告是docx格式,需要下载才能预览
- </view>
- <view class="btn">
- <view>
- <u-button type="warning" size="mini" @click="goDe(item.id_)" style="margin-right: 10rpx;"
- v-if="item.zhuang_tai_ == '待编制' || item.zhuang_tai_ == '待审核'">修改信息</u-button>
- <u-button type="warning" size="mini" @click="goto(item.id_,'1')"
- v-if="item.zhuang_tai_ == '待审核' && item.EXT_ != 'docx'">预览报告</u-button>
- <u-button type="warning" size="mini" @click="goto(item.id_,'2')" style="margin-right: 10rpx;"
- v-if="item.zhuang_tai_ == '已完成'">查看报告</u-button>
- <u-button type="primary" size="mini"
- v-if="(item.zhuang_tai_ == '已完成') || (item.shi_fou_guo_shen_ == '已编制')"
- @click="geDownload(item.bao_gao_pdf_,item.FILE_NAME_, item.EXT_)">
- 下载报告</u-button>
- </view>
- </view>
- </view>
- </view>
- <view v-else>
- <uni-card is-full :is-shadow="false">
- <text class="">暂无报告</text>
- </uni-card>
- </view>
- <u-popup v-model="show" mode="bottom" closeable>
- <apply ref="apply" :id="id" v-if="show" @saveSuccees='saveSuccees'></apply>
- </u-popup>
- </view>
- </template>
- <script>
- import md5 from "@/common/util/md5.js"
- import http from "@/common/service/http.js"
- import {
- ACCESS_TOKEN,
- USER_NAME,
- USER_INFO
- } from "@/common/util/constants"
- import apply from './apply.vue'
- export default {
- components: {
- apply
- },
- data() {
- return {
- id: '',
- yangPinBianHao: '',
- reportList: [],
- userid: '',
- time: '',
- show: false
- }
- },
- onLoad(option) {
- if (option.id) {
- this.yangPinBianHao = option.id
- this.getList(option.id)
- }
- },
- created() {
- this.getInit()
- },
- methods: {
- getInit() {
- let info = uni.getStorageSync(USER_INFO);
- if (info.employee.id) {
- this.userid = info.employee.id || ''
- }
- var nowDate = new Date((new Date).getTime() + 8 * 60 * 60 * 1000)
- var time = nowDate.toJSON().split('T').join(' ').substr(0, 19)
- this.time = time
- },
- /*
- 根据样品编号查询报告礼拜
- */
- getList(id) {
- uni.showLoading({
- mask: true,
- title: 'loading'
- });
- //'${id}'
- let sql =
- `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`
- let requestData = this.$sig(sql)
- this.$http.post("/ibps/business/v3/sys/universal/inputSqlSelectData", requestData).then(res => {
- if (res.data.state == 200) {
- const data = res.data.variables.data
- this.reportList = data
- uni.hideLoading()
- }
- })
- },
- /*
- 跳转页面在线查看文档页面
- */
- goto(id, type) {
- uni.navigateTo({ // 跳转页面
- url: "/pages/fileView/fileView?id=" + id + '&type=' + type
- })
- },
- //下载
- // getDe(id, item) {
- // uni.showLoading({
- // title: '下载中',
- // mask: true
- // })
- // let sql =
- // `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}'`
- // let requestData = this.$sig(sql)
- // this.$http.post("/ibps/business/v3/sys/universal/inputSqlSelectData", requestData).then(res => {
- // if (res.data.state == 200) {
- // const data = res.data.variables.data[0]
- // this.geDownload(data.bao_gao_pdf_, data.FILE_NAME_, data.EXT_)
- // }
- // })
- // },
- geDownload(id, item, type) {
- uni.showLoading({
- title: '下载中',
- mask: true
- })
- let requestData = {
- attachmentId: id
- }
- this.$http.get(`/ibps/platform/v3/file/download?attachmentId=${id}`, {
- responseType: 'arraybuffer'
- }).then(res => {
- const blob = new Blob([
- res.data
- ], {
- type: 'application/octet-stream'
- })
- const url = window.URL.createObjectURL(blob)
- const link = document.createElement('a')
- link.style.display = 'none'
- link.href = url
- link.setAttribute('download', item + '.' + type)
- document.body.appendChild(link)
- link.click()
- window.URL.revokeObjectURL(link.href)
- document.body.removeChild(link)
- uni.hideLoading()
- })
- },
- goDe(id) {
- this.id = id
- this.show = true
- },
- saveSuccees() {
- this.show = false
- this.reportList = []
- this.getList(this.yangPinBianHao)
- },
- /*
- md5加密
- */
- sig(sql) {
- let rul = (sql.length + 9) * 12 * 3 + 168
- let salt = "JinYuanXinTong"
- return md5(rul + '' + salt)
- },
- }
- }
- </script>
- <style lang="scss" scoped>
- .box {
- padding: 20rpx;
- .sinList {
- padding: 20rpx;
- margin-bottom: 20rpx;
- width: 100%;
- background: #fff;
- .title {
- line-height: 48rpx;
- }
- .btn {
- display: flex;
- justify-content: flex-end;
- }
- }
- }
- </style>
|