打印导出工单(前端)

This commit is contained in:
lzttt 2024-10-12 12:41:38 +08:00
parent 32241a7d73
commit f73f87119d
2 changed files with 39 additions and 1 deletions

View File

@ -46,6 +46,15 @@ export function setTicketsPaid(data){
})
}
// 打印导出
export function setTicketsPrint(data){
return request({
url: preUrl + "/print",
method: 'post',
data
})
}
// 新增客户、车辆信息
export function updateCustomerAndCar(data){
return request({

View File

@ -115,6 +115,10 @@
@click="handleVoid(scope.row)"
>作废
</el-button>
<el-button v-if="TicketType !== 'tv'" size="mini" type="text" icon="el-icon-print"
@click="handlePrint(scope.row)"
>打印
</el-button>
</template>
</el-table-column>
</el-table>
@ -145,7 +149,7 @@
</template>
<script>
import {setTicketsVoid, setTicketsPaid} 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 {
@ -196,6 +200,31 @@ 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 doPrint(data) {
try {
await setTicketsPrint(data)
this.$modal.msgSuccess("导出打印成功")
this.$emit("setPrint")
} catch {
}
},
handlePaid(row) {
this.$prompt('结算备注', '提示', {
confirmButtonText: '确定',