This commit is contained in:
PQZ 2024-10-12 17:43:59 +08:00
parent ff1d7088ef
commit 75c1a042e1
2 changed files with 15 additions and 23 deletions

View File

@ -46,12 +46,12 @@ export function setTicketsPaid(data){
})
}
// 打印导出
export function setTicketsPrint(data){
export function print(id) {
return request({
url: preUrl + "/print",
method: 'post',
data
url: preUrl + "/print/" + id,
method: 'get'
})
}

View File

@ -99,7 +99,7 @@
<dict-tag :type="DICT_TYPE.REPAIR_TICKETS_STATUS" v-model="scope.row.ticketsStatus"/>
</template>
</el-table-column>
<el-table-column label="操作" fixed="right" align="center" width="180">
<el-table-column label="操作" fixed="right" align="center" width="230">
<template slot-scope="scope">
<el-button size="mini" type="text" icon="el-icon-view" @click="handleShow(scope.row)"
>查看
@ -115,7 +115,7 @@
@click="handleVoid(scope.row)"
>作废
</el-button>
<el-button v-if="TicketType !== 'tv'" size="mini" type="text" icon="el-icon-print"
<el-button size="mini" type="text" icon="el-icon-printer"
@click="handlePrint(scope.row)"
>打印
</el-button>
@ -149,7 +149,7 @@
</template>
<script>
import { setTicketsVoid, setTicketsPaid, setTicketsPrint } from '@/api/repair/tickets/Tickets'
import {setTicketsVoid, setTicketsPaid, setTicketsPrint} from '@/api/repair/tickets/Tickets'
import TicketsShow from "@/views/repair/tickets/Components/TicketsShow.vue";
export default {
@ -200,22 +200,14 @@ export default {
} catch {
}
},
async handlePrint(row) {
//console.log('Handling print for:', row);
this.$confirm('确认打印吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
}).then(async () => {
const response = await this.$http.post('/repair/tickets/print', row);
console.log('Print request data:', row); //
//
const fileUrl = response.data.url; //
window.open(fileUrl); // ,
}).catch(() => {
});
/**
* 打印
*/
async handlePrint(row) {
// window.location.href = process.env.VUE_APP_BASE_API + '/admin-api/repair/tickets/print/'+row.id;
window.open(process.env.VUE_APP_BASE_API + '/admin-api/repair/tickets/print/'+row.id)
},
async doPrint(data) {
try {
await setTicketsPrint(data)