Browse Source

完善车辆销售台账--增加下载

master
yunuo970428 2 years ago
parent
commit
64c53c2763
  1. 9
      anrui-scm/anrui-scm-ui/src/api/cheliang/cheliangxiaoshou.js
  2. 63
      anrui-scm/anrui-scm-ui/src/views/cheliang/cheliangxiaoshou/cheliangxiaoshouguanli.vue

9
anrui-scm/anrui-scm-ui/src/api/cheliang/cheliangxiaoshou.js

@ -18,3 +18,12 @@ export function fetcBySid(sid) {
})
}
// 下载
export function createPdf(data) {
return request({
url: '/scm/v1/scmapplyinboundquery/createPdf',
method: 'post',
params: data
})
}

63
anrui-scm/anrui-scm-ui/src/views/cheliang/cheliangxiaoshou/cheliangxiaoshouguanli.vue

@ -63,8 +63,9 @@
<div class="">
<el-table :key="tableKey" v-loading="listLoading" :data="list" border style="width: 100%;">
<el-table-column width="60" label="序号" type="index" :index="indexMethod" align="center"/>
<el-table-column label="操作" width="80" align="center">
<el-table-column label="操作" width="180" align="center">
<template slot-scope="scope">
<el-button type="primary" size="mini" @click="handleDownLoad(scope.row)">下载</el-button>
<el-button type="primary" size="mini" @click="toInfo(scope.row)">查看</el-button>
</template>
</el-table-column>
@ -186,19 +187,41 @@
</div>
</div>
</div>
<el-dialog center :visible.sync="dialogVisible" width="40%">
<el-form class="formadd">
<el-row style="border-top: 1px solid #E0E3EB">
<el-col :span="4" class="tleftb">
<span>打印机类型</span>
</el-col>
<el-col :span="20">
<el-form-item>
<el-radio-group v-model="print">
<el-radio label="针孔式打印机">针孔式打印机</el-radio>
<el-radio label="喷墨式打印机">喷墨式打印机</el-radio>
</el-radio-group>
</el-form-item>
</el-col>
</el-row>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button size="small" type="primary" @click="handleConfirm">确定</el-button>
<el-button size="small" @click="dialogVisible = false">取消</el-button>
</span>
</el-dialog>
<chelaingxiaoshouInfo v-show="viewState == 2" ref="divInfo" @doback="resetState"/>
<vehicleconfiguration v-show="viewState == 3" ref="divPeizhi" @doback="resetState"/>
</div>
</template>
<script>
import { pagerList } from '@/api/cheliang/cheliangxiaoshou'
import { pagerList, createPdf } from '@/api/cheliang/cheliangxiaoshou'
import Pagination from '@/components/pagination'
import pageye from '@/components/pagination/pageye'
import ButtonBar from '@/components/ButtonBar'
import { typeValues, getOrgSidByPath, selectOrgList, selectOrgByLevel } from '@/api/cheliang/dictcommons'
import chelaingxiaoshouInfo from './chelaingxiaoshouInfo'
import vehicleconfiguration from '@/views/cheliang/cheliangtaizhang/relation/vehicleconfiguration'
import { getStorage } from '@/utils/auth'
export default {
name: 'cheliangxiaoshou',
@ -213,6 +236,9 @@ export default {
return {
btndisabled: false,
viewState: 1,
dialogVisible: false,
printSid: '',
print: '',
btnList: [
{
type: 'info',
@ -358,6 +384,39 @@ export default {
const choosetItem = this.org_list.filter((item) => item.orgDeptSid === value)
this.staff_list = choosetItem[0].staffinfoVoList
},
handleDownLoad(row) {
this.printSid = row.sid
this.print = ''
this.dialogVisible = true
},
handleConfirm() {
createPdf({ xsckdSid: this.printSid, printerType: this.print }).then((resp) => {
if (resp.success && resp.data.pdfPath !== '') {
var xhr = new XMLHttpRequest()
xhr.open('GET', process.env.VUE_APP_BASE_API + '/base/file/download?filePath=' + resp.data.pdfPath + '&outFileName=' + '销售出库单', true)
xhr.setRequestHeader('token', getStorage())
xhr.responseType = 'blob'
xhr.onload = function(e) {
//
var blob = this.response
var filename = '销售出库单.pdf'
var a = document.createElement('a')
// blob.type="application/octet-stream";
// url
var url = URL.createObjectURL(blob)
a.href = url
a.download = filename
a.click()
// URL
window.URL.revokeObjectURL(url)
}
//
xhr.send()
this.dialogVisible = false
this.printSid = ''
}
})
},
toInfo(row) {
this.viewState = 2
this.$refs['divInfo'].showInfo(row)

Loading…
Cancel
Save