lyfO_o
2022-06-09 44d7a737dc0d63ad1dd7c52d45fc2233d1950173
src/views/delayHiddenDangerRectification/rectificationDelayHiddenDanger.vue
@@ -274,32 +274,38 @@
                                    <el-table-column
                                        prop="date"
                                        label="步骤"
                                        type="index"
                                        align="center"
                                        width="60">
                                       >
                                    </el-table-column>
                                    <el-table-column
                                        prop="realname"
                                        label="操作人"
                                        align="center"
                                        width="138">
                                        >
                                    </el-table-column>
                                    <el-table-column
                                        prop="create_time"
                                        label="处理时间"
                                        align="center"
                                        width="200">
                                        >
                                    </el-table-column>
                                    <el-table-column
                                        prop="city"
                                        label="审批意见"
                                        align="center"
                                        width="260">
                                        >
                                        <template slot-scope="scope">
                                            <span size="medium">{{ scope.row.content }}</span>
                                            <a v-for="item in scope.row.realFileName"
                                               :href="scope.row.url+'/'+item">
                                                {{ item.split("fileName=")[1] }}
                                            </a>
                                            <span v-for="item in scope.row.realFileName">
                                                <el-link  type="primary" @click="downloadFile(subFile(item))">
                                                    {{subFile(item)}}
                                                </el-link>
                                            </span>
<!--                                            <a v-for="item in scope.row.realFileName"-->
<!--                                               :href="scope.row.url+'/'+item">-->
<!--                                                {{ item.split("fileName=")[1] }}-->
<!--                                            </a>-->
                                        </template>
                                    </el-table-column>
                                    <el-table-column
@@ -315,7 +321,7 @@
                </el-form>
                <el-form :model="sendData" :rules="rules" ref="sendData" label-width="150px" class="demo-ruleForm"
                         style="margin: 0 14% 0 16%;">
                    >
                    <el-row>
                        <el-col :span="22">
                            <el-form-item label="发送流程" prop="name">
@@ -396,6 +402,7 @@
<script>
import Titlename from "../../components/Titlename/index.vue";
import {sendDangerNext, getDangerDetails, getWfRecordList} from "@/api/sgyhpczl/recheckCancellationNumber";
import {downloadFile} from "@/api/sgyhpczl/fileUtils";
export default {
    components: {Titlename},
@@ -516,7 +523,40 @@
            this.$router.push({
                path: "/delayHiddenDangerRectification"
            })
        }
        },
        subFile(fileName){
            return  fileName.substring(fileName.indexOf("fileName=")+9)
        },
        downloadFile(path){
            let params = {
                type: 0,
                fileName: path,
            };
            downloadFile(params).then((res) => {
                if(res.data.type=='text/json'){
                    const reader  = new FileReader();
                    reader.readAsText(res.data, 'utf-8');
                    reader.onload = e => {
                        this.$message({
                            type: "error",
                            message: JSON.parse(reader.result).msg,
                            duration: 3000,
                        });
                    }
                } else {
                    let blob = new Blob([res.data], {type: 'application/octet-stream'})
                    console.log(blob)
                    let blobUrl = window.URL.createObjectURL(blob)
                    let downloadElement = document.createElement('a')
                    downloadElement.href = blobUrl
                    downloadElement.download = path
                    document.body.appendChild(downloadElement)
                    downloadElement.click()
                    document.body.removeChild(downloadElement)
                    window.URL.revokeObjectURL(blobUrl)
                }
            });
        },
    }
}
</script>