|
@ -17,13 +17,15 @@ |
|
|
</template> |
|
|
</template> |
|
|
<template v-slot:rightButtonGroup> |
|
|
<template v-slot:rightButtonGroup> |
|
|
<div class="archives-handler-btn"> |
|
|
<div class="archives-handler-btn"> |
|
|
<el-button class="part-btn iconfont" type="primary" :disabled="crud.selections.length !== 1" @click="getPrintData"><svg-icon icon-class="print" class="svg-arc-style" />打印目录</el-button> |
|
|
|
|
|
|
|
|
<el-button :loading="codeLoading" class="warehousing-btn iconfont" type="primary" :disabled="crud.selections.length === 0" @click="onPrint(crud.selections)"><svg-icon icon-class="print" class="svg-arc-style" />批量打印条形码</el-button> |
|
|
|
|
|
<el-button :loading="contentLoading" class="part-btn iconfont" type="primary" :disabled="crud.selections.length !== 1" @click="getPrintData"><svg-icon icon-class="print" class="svg-arc-style" />打印目录</el-button> |
|
|
<el-button class="packing-btn iconfont icon-chaihe-fanbai" type="primary" :disabled="crud.selections.length === 0" @click="openCase(crud.selections)">拆盒</el-button> |
|
|
<el-button class="packing-btn iconfont icon-chaihe-fanbai" type="primary" :disabled="crud.selections.length === 0" @click="openCase(crud.selections)">拆盒</el-button> |
|
|
<el-button class="binding-btn iconfont icon-bangding-fanbai" type="primary" :disabled="crud.selections.length !== 1" @click="bindingTag(crud.selections)">绑定标签</el-button> |
|
|
<el-button class="binding-btn iconfont icon-bangding-fanbai" type="primary" :disabled="crud.selections.length !== 1" @click="bindingTag(crud.selections)">绑定标签</el-button> |
|
|
</div> |
|
|
</div> |
|
|
</template> |
|
|
</template> |
|
|
</crudOperation> |
|
|
</crudOperation> |
|
|
</div> |
|
|
</div> |
|
|
|
|
|
|
|
|
<!-- <div class="app-container container-wrap"> --> |
|
|
<!-- <div class="app-container container-wrap"> --> |
|
|
<span class="right-top-line" /> |
|
|
<span class="right-top-line" /> |
|
|
<span class="left-bottom-line" /> |
|
|
<span class="left-bottom-line" /> |
|
@ -111,12 +113,20 @@ |
|
|
</el-table> |
|
|
</el-table> |
|
|
</div> |
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
<div ref="printDiv" style="display: none;"> |
|
|
|
|
|
<div v-for="item in selectedRows" :key="item.barcode" style="page-break-after:always; margin-top: 8px; margin-left: 20px;"> |
|
|
|
|
|
<div> |
|
|
|
|
|
<img :src="item.barcode | creatBarCode(item.barcode, item.title)" style="border: 1px solid #000; width: 160px;"> |
|
|
|
|
|
</div> |
|
|
|
|
|
</div> |
|
|
|
|
|
</div> |
|
|
|
|
|
<iframe ref="printIframe" frameborder="0" scrolling="no" style="margin: 0px;padding: 0px;width: 0px;height: 0px;" /> |
|
|
</div> |
|
|
</div> |
|
|
</template> |
|
|
</template> |
|
|
|
|
|
|
|
|
<script> |
|
|
<script> |
|
|
import caseCrudMethod from '@/api/archivesManage/caseManage' |
|
|
import caseCrudMethod from '@/api/archivesManage/caseManage' |
|
|
import { del } from '@/api/archivesManage/caseManage' |
|
|
|
|
|
|
|
|
import { del, printCaseBarcode } from '@/api/archivesManage/caseManage' |
|
|
import BindingTagDlg from '@/views/components/BindingTagDlg' |
|
|
import BindingTagDlg from '@/views/components/BindingTagDlg' |
|
|
import eForm from './module/form' |
|
|
import eForm from './module/form' |
|
|
import openCaseDlg from './module/openCaseDlg' |
|
|
import openCaseDlg from './module/openCaseDlg' |
|
@ -126,6 +136,7 @@ import rrOperation from '@crud/RR.operation' |
|
|
import pagination from '@crud/Pagination' |
|
|
import pagination from '@crud/Pagination' |
|
|
import detailDialog from './module/detailDialog' |
|
|
import detailDialog from './module/detailDialog' |
|
|
|
|
|
|
|
|
|
|
|
import JsBarcode from 'jsbarcode' |
|
|
import html2canvas from 'html2canvas' |
|
|
import html2canvas from 'html2canvas' |
|
|
import printJS from 'print-js' |
|
|
import printJS from 'print-js' |
|
|
export default { |
|
|
export default { |
|
@ -142,6 +153,27 @@ export default { |
|
|
case 3: |
|
|
case 3: |
|
|
return '待出' |
|
|
return '待出' |
|
|
} |
|
|
} |
|
|
|
|
|
}, |
|
|
|
|
|
creatBarCode(barCodeData, codePrintData, barCodeText) { |
|
|
|
|
|
// console.log('触发条码生成事件') |
|
|
|
|
|
console.log('codePrintData', codePrintData) |
|
|
|
|
|
console.log('barCodeText', barCodeText) |
|
|
|
|
|
const canvas = document.createElement('canvas') |
|
|
|
|
|
// 'fantasy', // 设置文本的字体 |
|
|
|
|
|
JsBarcode(canvas, barCodeData, { |
|
|
|
|
|
format: 'CODE128', |
|
|
|
|
|
displayValue: true, |
|
|
|
|
|
text: barCodeText, |
|
|
|
|
|
fontOptions: 'bold', // 使文字加粗体或变斜体 |
|
|
|
|
|
font: 'arial', |
|
|
|
|
|
margin: 15, |
|
|
|
|
|
height: 120, |
|
|
|
|
|
width: 5, |
|
|
|
|
|
fontSize: 36, |
|
|
|
|
|
textMargin: 6, |
|
|
|
|
|
textPosition: 'top' |
|
|
|
|
|
}) |
|
|
|
|
|
return canvas.toDataURL('image/png') |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
components: { eForm, crudOperation, rrOperation, pagination, BindingTagDlg, openCaseDlg, detailDialog }, |
|
|
components: { eForm, crudOperation, rrOperation, pagination, BindingTagDlg, openCaseDlg, detailDialog }, |
|
@ -164,7 +196,11 @@ export default { |
|
|
}, |
|
|
}, |
|
|
data() { |
|
|
data() { |
|
|
return { |
|
|
return { |
|
|
|
|
|
codeLoading: false, |
|
|
|
|
|
selectedRows: [], |
|
|
|
|
|
codePrintData: [], |
|
|
isHidden: false, |
|
|
isHidden: false, |
|
|
|
|
|
contentLoading: false, |
|
|
printData: [], |
|
|
printData: [], |
|
|
permission: { |
|
|
permission: { |
|
|
add: ['admin', 'caseManage:add'], |
|
|
add: ['admin', 'caseManage:add'], |
|
@ -214,11 +250,48 @@ export default { |
|
|
] |
|
|
] |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
mounted() { |
|
|
mounted() { |
|
|
}, |
|
|
}, |
|
|
methods: { |
|
|
methods: { |
|
|
// 打印 |
|
|
|
|
|
|
|
|
// 打印条码 |
|
|
|
|
|
onPrint(data) { |
|
|
|
|
|
this.codeLoading = true |
|
|
|
|
|
const params = data.map(item => { |
|
|
|
|
|
return item.id |
|
|
|
|
|
}) |
|
|
|
|
|
printCaseBarcode(params).then(res => { |
|
|
|
|
|
if (res && res.length !== 0) { |
|
|
|
|
|
this.selectedRows = res |
|
|
|
|
|
} else { |
|
|
|
|
|
this.selectedRows = [] |
|
|
|
|
|
this.$message({ |
|
|
|
|
|
message: '无相关可打印条码数据!', |
|
|
|
|
|
type: 'warning' |
|
|
|
|
|
}) |
|
|
|
|
|
} |
|
|
|
|
|
this.$nextTick(() => { |
|
|
|
|
|
this.codePrintData.count = this.selectedRows.length |
|
|
|
|
|
var printIframe = this.$refs.printIframe |
|
|
|
|
|
var html = this.$refs.printDiv.innerHTML |
|
|
|
|
|
printIframe.setAttribute('srcdoc', html) |
|
|
|
|
|
printIframe.onload = function() { |
|
|
|
|
|
console.log(printIframe.contentWindow) |
|
|
|
|
|
// 去掉iframe里面的dom的body的padding margin的默认数值 |
|
|
|
|
|
printIframe.contentWindow.document.body.style.padding = '0px' |
|
|
|
|
|
printIframe.contentWindow.document.body.style.margin = '0px' |
|
|
|
|
|
// 开始打印 |
|
|
|
|
|
printIframe.contentWindow.focus() |
|
|
|
|
|
printIframe.contentWindow.print() |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
this.crud.refresh() |
|
|
|
|
|
this.codeLoading = false |
|
|
|
|
|
}) |
|
|
|
|
|
}, |
|
|
|
|
|
// 打印目录 |
|
|
getPrintData() { |
|
|
getPrintData() { |
|
|
|
|
|
this.contentLoading = true |
|
|
const params = { |
|
|
const params = { |
|
|
caseId: this.crud.selections[0].id |
|
|
caseId: this.crud.selections[0].id |
|
|
} |
|
|
} |
|
@ -231,6 +304,7 @@ export default { |
|
|
this.printFn() |
|
|
this.printFn() |
|
|
this.isHidden = false |
|
|
this.isHidden = false |
|
|
}) |
|
|
}) |
|
|
|
|
|
this.contentLoading = false |
|
|
}) |
|
|
}) |
|
|
}, |
|
|
}, |
|
|
printFn() { |
|
|
printFn() { |
|
|