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({ return request({
url: preUrl + "/print", url: preUrl + "/print/" + id,
method: 'post', method: 'get'
data
}) })
} }

View File

@ -99,7 +99,7 @@
<dict-tag :type="DICT_TYPE.REPAIR_TICKETS_STATUS" v-model="scope.row.ticketsStatus"/> <dict-tag :type="DICT_TYPE.REPAIR_TICKETS_STATUS" v-model="scope.row.ticketsStatus"/>
</template> </template>
</el-table-column> </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"> <template slot-scope="scope">
<el-button size="mini" type="text" icon="el-icon-view" @click="handleShow(scope.row)" <el-button size="mini" type="text" icon="el-icon-view" @click="handleShow(scope.row)"
>查看 >查看
@ -115,7 +115,7 @@
@click="handleVoid(scope.row)" @click="handleVoid(scope.row)"
>作废 >作废
</el-button> </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)" @click="handlePrint(scope.row)"
>打印 >打印
</el-button> </el-button>
@ -149,7 +149,7 @@
</template> </template>
<script> <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"; import TicketsShow from "@/views/repair/tickets/Components/TicketsShow.vue";
export default { export default {
@ -200,22 +200,14 @@ export default {
} catch { } catch {
} }
}, },
/**
async handlePrint(row) { * 打印
//console.log('Handling print for:', row); */
this.$confirm('确认打印吗?', '提示', { async handlePrint(row) {
confirmButtonText: '确定', // window.location.href = process.env.VUE_APP_BASE_API + '/admin-api/repair/tickets/print/'+row.id;
cancelButtonText: '取消', window.open(process.env.VUE_APP_BASE_API + '/admin-api/repair/tickets/print/'+row.id)
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 doPrint(data) { async doPrint(data) {
try { try {
await setTicketsPrint(data) await setTicketsPrint(data)