|
|
|
@ -186,13 +186,13 @@
|
|
|
|
|
|
|
|
|
|
<!-- 打印模块 --> |
|
|
|
|
<el-dialog title="二维码" :visible.sync="isShow" width="780px" v-model="isShow"> |
|
|
|
|
<div> |
|
|
|
|
<div ref="tableRef"> |
|
|
|
|
<div v-html="html"></div> |
|
|
|
|
</div> |
|
|
|
|
<span slot="footer" class="dialog-footer"> |
|
|
|
|
<el-button type="primary" @click="printTemplate">打 印</el-button> |
|
|
|
|
<el-button type="primary" @click="isShow = false">确 定</el-button> |
|
|
|
|
<el-button @click="isShow = false">取 消</el-button> |
|
|
|
|
<el-button type="primary" @click="handleExport">导 出</el-button> |
|
|
|
|
<el-button @click="isShow = false">关 闭</el-button> |
|
|
|
|
</span> |
|
|
|
|
</el-dialog> |
|
|
|
|
</div> |
|
|
|
@ -313,8 +313,9 @@ import { getVehicleList } from '@/api/basicdata/basicdataVehicle';
|
|
|
|
|
import { getDriverList } from '@/api/basicdata/basicdataDriverArtery'; |
|
|
|
|
import print from '@/utils/print'; |
|
|
|
|
import { getBillLadingExport } from '@/api/distribution/distrilbutionBillLading'; |
|
|
|
|
import { downloadXls } from '@/utils/util'; |
|
|
|
|
import { downloadXls, getObjType } from '@/utils/util'; |
|
|
|
|
import { ElMessage, ElMessageBox } from 'element-plus'; |
|
|
|
|
import * as XLSX from 'xlsx'; |
|
|
|
|
export default { |
|
|
|
|
data() { |
|
|
|
|
return { |
|
|
|
@ -1312,6 +1313,68 @@ export default {
|
|
|
|
|
printTemplate() { |
|
|
|
|
print(); |
|
|
|
|
}, |
|
|
|
|
/** 导出 */ |
|
|
|
|
handleExport() { |
|
|
|
|
console.log('this.$refs.tableRef :>> ', this.$refs.tableRef); |
|
|
|
|
|
|
|
|
|
const table = this.$refs.tableRef; |
|
|
|
|
|
|
|
|
|
/* 将表格转换为 Workbook 对象 */ |
|
|
|
|
const wb = XLSX.utils.table_to_book(table); |
|
|
|
|
|
|
|
|
|
console.log('wb :>> ', wb); |
|
|
|
|
|
|
|
|
|
wb.Sheets.Sheet1; |
|
|
|
|
|
|
|
|
|
//单元格外侧框线 |
|
|
|
|
const borderAll = { |
|
|
|
|
top: { |
|
|
|
|
style: 'thin', |
|
|
|
|
}, |
|
|
|
|
bottom: { |
|
|
|
|
style: 'thin', |
|
|
|
|
}, |
|
|
|
|
left: { |
|
|
|
|
style: 'thin', |
|
|
|
|
}, |
|
|
|
|
right: { |
|
|
|
|
style: 'thin', |
|
|
|
|
}, |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
for (const key in wb.Sheets.Sheet1) { |
|
|
|
|
const item = wb.Sheets.Sheet1[key]; |
|
|
|
|
|
|
|
|
|
const type = getObjType(item); |
|
|
|
|
|
|
|
|
|
console.log('type :>> ', type); |
|
|
|
|
|
|
|
|
|
if (type !== 'object') continue; |
|
|
|
|
|
|
|
|
|
item.s = { |
|
|
|
|
border: borderAll, |
|
|
|
|
font: { |
|
|
|
|
// name: "微软雅黑", |
|
|
|
|
// sz: 16, |
|
|
|
|
color: { rgb: '000000' }, |
|
|
|
|
bold: true, |
|
|
|
|
italic: false, |
|
|
|
|
underline: false, |
|
|
|
|
}, |
|
|
|
|
fill: { |
|
|
|
|
fgColor: { rgb: 'C5D9F1' }, |
|
|
|
|
}, |
|
|
|
|
alignment: { |
|
|
|
|
horizontal: 'center', |
|
|
|
|
vertical: 'center', |
|
|
|
|
wrapText: false, // 自动换行 |
|
|
|
|
}, |
|
|
|
|
}; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/* 导出 Workbook 到 Excel 文件 */ |
|
|
|
|
XLSX.writeFile(wb, 'data.xlsx'); |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
}; |
|
|
|
|
</script> |
|
|
|
|