|
@@ -40,6 +40,9 @@
|
|
|
<ElButton type="primary" size="small" @click="pause(row)" v-if="row.status === 'pending'">
|
|
<ElButton type="primary" size="small" @click="pause(row)" v-if="row.status === 'pending'">
|
|
|
暂停
|
|
暂停
|
|
|
</ElButton>
|
|
</ElButton>
|
|
|
|
|
+ <ElButton type="primary" size="small" @click="receipt(row)" v-if="row.status === 'completed'">
|
|
|
|
|
+ 回执
|
|
|
|
|
+ </ElButton>
|
|
|
<ElButton type="danger" size="small" @click="del(row)" v-if="row.status === 'idle'">删除</ElButton>
|
|
<ElButton type="danger" size="small" @click="del(row)" v-if="row.status === 'idle'">删除</ElButton>
|
|
|
</template>
|
|
</template>
|
|
|
</ElTableColumn>
|
|
</ElTableColumn>
|
|
@@ -242,6 +245,25 @@ async function pause(row) {
|
|
|
await http.post(`/task/${row.id}/pause`)
|
|
await http.post(`/task/${row.id}/pause`)
|
|
|
table.value.refresh()
|
|
table.value.refresh()
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+async function receipt(row) {
|
|
|
|
|
+ try {
|
|
|
|
|
+ const response = await http.post(`/task/item/${row.id}/receipt`, {
|
|
|
|
|
+ responseType: 'blob', // 重要:指定响应类型为blob,以便处理二进制文件
|
|
|
|
|
+ });
|
|
|
|
|
+ // 处理成功响应,触发文件下载
|
|
|
|
|
+ const url = window.URL.createObjectURL(new Blob([response.data]));
|
|
|
|
|
+ const link = document.createElement('a');
|
|
|
|
|
+ link.href = url;
|
|
|
|
|
+ link.setAttribute('download', `${row.name}_回执.xlsx`);
|
|
|
|
|
+ document.body.appendChild(link);
|
|
|
|
|
+ link.click();
|
|
|
|
|
+ document.body.removeChild(link);
|
|
|
|
|
+ } catch (error) {
|
|
|
|
|
+ console.error('Error receipt:', error)
|
|
|
|
|
+ ElMessage.error('获取回执错误,请稍后再试.')
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
</script>
|
|
</script>
|
|
|
<style lang="less" scoped>
|
|
<style lang="less" scoped>
|
|
|
.tip {
|
|
.tip {
|