wujianwei
2025-08-18 d2afd43a81204ba0a7d7bd3b269565a9f3158be4
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
<script lang="ts" setup>
import { reactive, ref, toRefs, watch, nextTick } from "vue";
import { BaseEntityInterface, PageQueryInterface } from "@/utils/globalInterface";
import { usePagePlus } from "@/hooks/usePagePlus";
import { getToken } from "@/utils/auth";
 
// import { listDzInoutOrder } from "@/api/dz/dzInoutOrder";
import useCurrentInstance from "@/utils/useCurrentInstance"; import { ElTable, ElTableColumn } from 'element-plus'
const { proxy } = useCurrentInstance();
 
interface DzInoutOrderI extends BaseEntityInterface {
    id?: number,
    no?: string,
    sasStockNo?: string,
    entryNo?: string,
    bondInvtId?: number,
    bondInvtNo?: string,
    releaseId?: number,
    releaseNo?: string,
    areainOriactNo?: string,
    areainEtpsNo?: string,
    areainEtpsNm?: string,
    areainEtpsSccd?: string,
    masterCuscd?: string,
    stockTypecd?: string,
    businessTypecd?: string,
    rltSasStockNo?: string,
    dclEr?: string,
    dclEtpsNo?: string,
    dclEtpsNm?: string,
    dclEtpsSccd?: string,
    inputCode?: string,
    inputSccd?: string,
    inputName?: string,
    etpsPreentNo?: string,
    packageQty?: string,
    grossWt?: string,
    netWt?: string,
    packType?: string,
    eportReplaceMark?: number,
    mtpckEndprdType?: string,
    enterpriseName?: string,
    stockDate?: string,
    tradeType?: number,
    conveyanceId?: number,
    conveyanceNo?: string,
    conveyanceName?: string,
    enterId?: number,
    deleted?: number,
}
const props = defineProps({
    flowParams: Array,
    flowParamsShow: {
        type: Boolean,
        default: false
    },
    fileNameIshow: {
        type: Boolean,
        default: false
    },
})
console.log(props);
 
const { } =
    proxy.useDict();
 
 
const stockTypecdFormat = (row: any) => {
    return proxy.selectDictLabel(sy_dz_account_book_status.value, row.stockTypecd);
}
 
const data = reactive({
    orderSelection: <DzInoutOrderI[]>[],
    queryParams: <DzInoutOrderI & PageQueryInterface>{ pageNum: 1, pageSize: 10 },
    rules: {},
})
const { queryParams, rules, orderSelection } = toRefs(data);
const currentRow = ref()
const emit = defineEmits(['affirm'])
const {
    pageF, tableData, getList,
    handleQuery, resetQuery,
} = usePagePlus({
    title: '流程日志',
    queryParams: queryParams.value,
    // getListApi: listDzInoutOrder,
    resetQueryFunc: () => {
    },
 
})
 
 
const multipleTableRef = ref<InstanceType<typeof ElTable>>()
/**
 * 确定
 */
const affirmQuery = () => {
 
}
let newArray = ref<any>()
const openModel = () => {
    pageF.drawerOpen = true;
}
 
 
const closeModel = () => {
    pageF.drawerOpen = false;
}
 
 
// getList()
const download_qr_code = (row: string) => {
   downloadFile(row.fileName);
}
const baseURL = import.meta.env.VITE_APP_BASE_API
 
// 创建一个点击事件触发下载
function downloadFile(row: any) {
    // 文件下载地址
    const fileUrl = baseURL + "/common/download/resource?resource=" + encodeURI(row);
    // 设置请求头
    const headers = new Headers();
    headers.append('Authorization', 'Bearer ' + getToken()); // 设置授权头,替换YourAccessToken为实际的访问令牌
    // 发起 Fetch 请求
    fetch(fileUrl, {
        method: 'GET',
        headers: headers,
    })
        .then(response => response.blob())
        .then(blob => {
            // 创建一个虚拟的链接元素,模拟点击下载
            const link = document.createElement('a');
            link.href = window.URL.createObjectURL(blob);
            link.download = row; // 设置下载文件名,替换filename.ext为实际的文件名和扩展名
            document.body.appendChild(link);
            // 模拟点击
            link.click();
 
            // 移除虚拟链接元素
            document.body.removeChild(link);
        })
        .catch(error => console.error('下载失败:', error));
}
defineExpose({
    openModel,
})
</script>
<template>
    <el-dialog v-model="pageF.drawerOpen" title="流程日志" append-to-body width="1000px">
        <div class="app-container" style="padding-top: 0;">
            <el-table ref="multipleTableRef" :data="props.flowParams">
                <el-table-column align="center" label="处理时间" prop="createTime" />
                <el-table-column align="center" label="处理人员" prop="createBy" />
                <el-table-column align="center" label="附件下载" prop="fileName">
                    <template #default="scope">
                        <el-link v-if="scope.row.fileName" type="primary" :underline="false"
                            @click="download_qr_code(scope.row)">
                            {{scope.row.fileName}}
                        </el-link>
                        <span v-else>无附件</span>
                    </template>
                </el-table-column>
                <el-table-column align="center" label="节点描述" prop="operation" show-overflow-tooltip="true" />
            </el-table>
            <!-- <pagination style="position: relative;" v-show="pageF.total > 0" v-model:limit="queryParams.pageSize"
                v-model:page="queryParams.pageNum" :total="pageF.total" @pagination="getList" /> -->
        </div>
 
        <div class="dialog-footer" style="text-align: right">
            <el-button @click="closeModel">关闭</el-button>
        </div>
    </el-dialog>
</template>
 
 
 
<style scoped></style>