lyfO_o
2022-06-09 44d7a737dc0d63ad1dd7c52d45fc2233d1950173
src/views/dangerDetails/dnagerDetails.vue
@@ -260,6 +260,59 @@
                        </el-col>
                    </el-row>
                    <el-row>
                        <el-col :span="22">
                            <el-form-item label="流程信息" prop="name">
                                <!--                                <el-input v-model="ruleForm.name" class="multiline" :disabled="true"></el-input>-->
                                <el-table
                                    :data="tableData"
                                    border
                                    style="width: 100%">
                                    <el-table-column
                                        prop="date"
                                        label="步骤"
                                        type="index"
                                        align="center"
                                        >
                                    </el-table-column>
                                    <el-table-column
                                        prop="realname"
                                        label="操作人"
                                        align="center"
                                        >
                                    </el-table-column>
                                    <el-table-column
                                        prop="create_time"
                                        label="处理时间"
                                        align="center"
                                        >
                                    </el-table-column>
                                    <el-table-column
                                        prop="city"
                                        label="审批意见"
                                        align="center"
                                        >
                                        <template slot-scope="scope">
                                            <span size="medium">{{ scope.row.content }}</span>
                                            <span v-for="item in scope.row.realFileName">
                                                <el-link  type="primary" @click="downloadFile(subFile(item))">
                                                    {{subFile(item)}}
                                                </el-link>
                                            </span>
                                        </template>
                                    </el-table-column>
                                    <el-table-column
                                        prop="ispass"
                                        label="流程信息"
                                        align="center"
                                        width="170">
                                    </el-table-column>
                                </el-table>
                            </el-form-item>
                        </el-col>
                    </el-row>
                    <el-row>
                        <el-col :span="22">
@@ -279,6 +332,8 @@
<script>
    import Titlename from "../../components/Titlename/index.vue";
    import {sendDangerNext, getDangerDetails, getWfRecordList} from "@/api/sgyhpczl/recheckCancellationNumber";
    import {downloadFile} from "@/api/sgyhpczl/fileUtils";
    import {self_info} from "../../api/sgyhpczl/hiddenDangerManagement";
    export default {
        components: {Titlename},
@@ -328,18 +383,34 @@
        },
        methods: {
            getDangerDetails() {
                getDangerDetails(this.$route.query.id).then(res => {
                    var data = res.data;
                    if (data.ok) {
                        this.ruleForm = data.data;
                        this.ruleForm.url = process.env.BASE_API;
                        this.ruleForm.callback_branch= data.data.check_main_branch
                        //this.ruleForm.ispass=0
                        this.sendDataForm.id = this.ruleForm.id
                    } else {
                        this.$message({type: 'error', message: "数据查询失败,请重试!", duration: 3000})
                    }
                })
                if(this.$route.query.route!=null && this.$route.query.route == '/hiddenDangerManagement'){
                    self_info(this.$route.query.id).then(res => {
                        var data = res.data;
                        if (data.ok) {
                            this.ruleForm = data.data;
                            this.ruleForm.url = process.env.BASE_API;
                            this.ruleForm.callback_branch= data.data.check_main_branch
                            //this.ruleForm.ispass=0
                            this.sendDataForm.id = this.ruleForm.id
                        } else {
                            this.$message({type: 'error', message: "数据查询失败,请重试!", duration: 3000})
                        }
                    })
                }else{
                    getDangerDetails(this.$route.query.id).then(res => {
                        var data = res.data;
                        if (data.ok) {
                            this.ruleForm = data.data;
                            this.ruleForm.url = process.env.BASE_API;
                            this.ruleForm.callback_branch= data.data.check_main_branch
                            //this.ruleForm.ispass=0
                            this.sendDataForm.id = this.ruleForm.id
                        } else {
                            this.$message({type: 'error', message: "数据查询失败,请重试!", duration: 3000})
                        }
                    })
                }
            },
            getWfRecordList() {
                getWfRecordList(this.$route.query.id).then(res => {
@@ -404,10 +475,49 @@
                }
            },
            close(){
                this.$router.push({
                    path:"/hiddenDangerRectification"
                })
            }
                if(this.$route.query.route!=null && this.$route.query.route!=''){
                    this.$router.push({
                        path: this.$route.query.route
                    })
                }else{
                    this.$router.push({
                        path:"/hiddenDangerRectification"
                    })
                }
            },
            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>