|
@@ -3,31 +3,37 @@
|
|
<h3 class="toolbar">
|
|
<h3 class="toolbar">
|
|
<div class="tool">
|
|
<div class="tool">
|
|
<el-button type="primary" plain icon="el-icon-download" size="mini" @click="handleDownloadBatch">批量下载</el-button>
|
|
<el-button type="primary" plain icon="el-icon-download" size="mini" @click="handleDownloadBatch">批量下载</el-button>
|
|
- <el-button type="primary" plain icon="el-icon-download" size="mini" @click="handlePrint">一键打印</el-button>
|
|
|
|
|
|
+ <el-button type="primary" plain icon="el-icon-download" size="mini" v-print="'print'">一键打印</el-button>
|
|
|
|
+ <!-- <button v-print="'#printArea'"></button> -->
|
|
</div>
|
|
</div>
|
|
</h3>
|
|
</h3>
|
|
- <el-table v-loading="loading" :data="list" border @selection-change="handleSelectionChange" style="width: 100%" @select-all="selectAll">
|
|
|
|
- <el-table-column type="selection" width="55"></el-table-column>
|
|
|
|
- <el-table-column label="序号" type="index" width="50" align="center"></el-table-column>
|
|
|
|
- <el-table-column label="文件名称" prop="fileName" align="center"></el-table-column>
|
|
|
|
- <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
|
|
|
- <template slot-scope="scope">
|
|
|
|
- <el-button type="text" @click="handleView(scope.row)">查看</el-button>
|
|
|
|
- <el-button type="text" @click="handleDownload(scope.row)">下载</el-button>
|
|
|
|
- </template>
|
|
|
|
- </el-table-column>
|
|
|
|
- </el-table>
|
|
|
|
- <pagination
|
|
|
|
- v-show="total>0"
|
|
|
|
- :total="total"
|
|
|
|
- :page.sync="queryParams.pageNum"
|
|
|
|
- :limit.sync="queryParams.pageSize"
|
|
|
|
- @pagination="getList"/>
|
|
|
|
|
|
+ <div id="printArea">
|
|
|
|
+ <el-table v-loading="loading" :data="list" border @selection-change="handleSelectionChange" style="width: 100%" width="100%">
|
|
|
|
+ <el-table-column type="selection" width="55"></el-table-column>
|
|
|
|
+ <el-table-column label="序号" type="index" width="50" align="center"></el-table-column>
|
|
|
|
+ <el-table-column label="文件名称" prop="fileName" align="center"></el-table-column>
|
|
|
|
+ <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
|
|
|
+ <template slot-scope="scope">
|
|
|
|
+ <el-button type="text" @click="handleView(scope.row)">查看</el-button>
|
|
|
|
+ <el-button type="text" @click="handleDownload(scope.row)">下载</el-button>
|
|
|
|
+ <el-button type="text" @click="handlePrint(scope.row)">打印</el-button>
|
|
|
|
+ </template>
|
|
|
|
+ </el-table-column>
|
|
|
|
+ </el-table>
|
|
|
|
+ <pagination
|
|
|
|
+ v-show="total>0"
|
|
|
|
+ :total="total"
|
|
|
|
+ :page.sync="queryParams.pageNum"
|
|
|
|
+ :limit.sync="queryParams.pageSize"
|
|
|
|
+ @pagination="getList"/>
|
|
|
|
+ </div>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script>
|
|
<script>
|
|
import {getEnclosureApi,deleteEnclosureApi,getProjectInfoApi,getProjectInfoCommonApi} from '@/api/enterprise/project/project'
|
|
import {getEnclosureApi,deleteEnclosureApi,getProjectInfoApi,getProjectInfoCommonApi} from '@/api/enterprise/project/project'
|
|
|
|
+ // 先导入getLodop方法
|
|
|
|
+ import { getLodop } from "@/plugins/lodopFuncs"
|
|
export default {
|
|
export default {
|
|
props: {
|
|
props: {
|
|
finEnclosure: {
|
|
finEnclosure: {
|
|
@@ -49,6 +55,29 @@
|
|
queryParams: {
|
|
queryParams: {
|
|
pageNum: 1,
|
|
pageNum: 1,
|
|
pageSize: 10
|
|
pageSize: 10
|
|
|
|
+ },
|
|
|
|
+ print: {
|
|
|
|
+ // id: 'printArea',
|
|
|
|
+ popTitle: '', // 打印配置页上方的标题
|
|
|
|
+ extraHead: '<meta http-equiv="Content-Language"content="zh-cn"/>,<style> #printMe { height: auto !important; } <style>', // 最上方的头部文字,附加在head标签上的额外标签,使用逗号分割
|
|
|
|
+ preview: true, // 是否启动预览模式,默认是false
|
|
|
|
+ previewTitle: '预览的标题', // 打印预览的标题
|
|
|
|
+ previewPrintBtnLabel: '预览结束,开始打印', // 打印预览的标题下方的按钮文本,点击可进入打印
|
|
|
|
+ zIndex: 20002, // 预览窗口的z-index,默认是20002,最好比默认值更高
|
|
|
|
+ // previewBeforeOpenCallback () { console.log('正在加载预览窗口!'); console.log(this.msg) }, // 预览窗口打开之前的callback
|
|
|
|
+ // previewOpenCallback () { console.log('已经加载完预览窗口,预览打开了!') }, // 预览窗口打开时的callback
|
|
|
|
+ // beforeOpenCallback () { console.log('开始打印之前!') }, // 开始打印之前的callback
|
|
|
|
+ // openCallback () { console.log('执行打印了!') }, // 调用打印时的callback
|
|
|
|
+ // closeCallback () { console.log('关闭了打印工具!') }, // 关闭打印的callback(无法区分确认or取消)
|
|
|
|
+ // clickMounted () { console.log('点击v-print绑定的按钮了!') },
|
|
|
|
+ url: 'http://124.232.146.72:7015/api/profile/upload/88a09dbc8e2f4a6096e6ea3dc934ba77.xls', // 打印指定的URL,确保同源策略相同
|
|
|
|
+ // asyncUrl (reslove) {
|
|
|
|
+ // setTimeout(() => {
|
|
|
|
+ // reslove('http://124.232.146.72:7015/api/profile/upload/88a09dbc8e2f4a6096e6ea3dc934ba77.xls')
|
|
|
|
+ // }, 2000)
|
|
|
|
+ // },
|
|
|
|
+ // standard: '',
|
|
|
|
+ // extarCss: ''
|
|
}
|
|
}
|
|
};
|
|
};
|
|
},
|
|
},
|
|
@@ -57,6 +86,24 @@
|
|
this.getData()
|
|
this.getData()
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
|
|
+ // 获取打印机列表
|
|
|
|
+ getPrintList() {
|
|
|
|
+ let LODOP = getLodop();
|
|
|
|
+ if (!LODOP)return
|
|
|
|
+ // 获取打印机个数
|
|
|
|
+ let count = LODOP.GET_PRINTER_COUNT()
|
|
|
|
+ let printValue = LODOP.GET_PRINTER_NAME(-1) //获取默认打印机
|
|
|
|
+ this.printList = Array(count).fill(null).map((...args) => {
|
|
|
|
+ if (printValue === LODOP.GET_PRINTER_NAME(args[1])){
|
|
|
|
+ this.printDefault = args[1]
|
|
|
|
+ }
|
|
|
|
+ return {
|
|
|
|
+ value: args[1], // args[1]为数组索引
|
|
|
|
+ label: LODOP.GET_PRINTER_NAME(args[1]) // 获取打印机名称
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+
|
|
|
|
+ },
|
|
getData() {
|
|
getData() {
|
|
getProjectInfoCommonApi(this.id).then(res => {
|
|
getProjectInfoCommonApi(this.id).then(res => {
|
|
this.info = res.data.finProject || {}
|
|
this.info = res.data.finProject || {}
|
|
@@ -111,13 +158,6 @@
|
|
this.$modal.msgSuccess("删除成功");
|
|
this.$modal.msgSuccess("删除成功");
|
|
})
|
|
})
|
|
},
|
|
},
|
|
- // 取消全选
|
|
|
|
- selectAll(selection) {
|
|
|
|
- if (selection.length == 0) {
|
|
|
|
- let list = this.selectedList.filter(item => !this.list.some(ele => ele.id === item.id));
|
|
|
|
- this.selectionList = list;
|
|
|
|
- }
|
|
|
|
- },
|
|
|
|
handleSelectionChange(val) {
|
|
handleSelectionChange(val) {
|
|
this.selectionList = val;
|
|
this.selectionList = val;
|
|
if(this.selectionList.length > 0) {
|
|
if(this.selectionList.length > 0) {
|
|
@@ -130,9 +170,39 @@
|
|
this.ids = ''
|
|
this.ids = ''
|
|
}
|
|
}
|
|
},
|
|
},
|
|
- handlePrint() {
|
|
|
|
-
|
|
|
|
|
|
+ handlePrint(row) {
|
|
|
|
+ this.getPrintData(row.url)
|
|
},
|
|
},
|
|
|
|
+ // 获取面单信息数组数据
|
|
|
|
+ async getPrintData(url) {
|
|
|
|
+ if(url) {
|
|
|
|
+ this.printUrlList = url.split(';')
|
|
|
|
+ this.printInfo()
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ // 打印面单
|
|
|
|
+ async printInfo() {
|
|
|
|
+ for await (const item of this.printUrlList) {
|
|
|
|
+ this.printEveryItem(item)
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ // 打印每项
|
|
|
|
+ printEveryItem(item) {
|
|
|
|
+ let self = this;
|
|
|
|
+ let LODOP = getLodop(); //调用getLodop获取LODOP对象
|
|
|
|
+ return new Promise(function (resolve) {
|
|
|
|
+ setTimeout(() => {
|
|
|
|
+ // LODOP.PRINT_INIT("");
|
|
|
|
+ let strStyleCSS = `<style type='text/css' rel='stylesheet'>.img1{display:block;margin:10px;width:360;height:360}</style>`
|
|
|
|
+ let html = `<head>${strStyleCSS}</head><body><div class='print-card'>
|
|
|
|
+ <img src=${item} class='img1' />
|
|
|
|
+ </div><body>`
|
|
|
|
+ LODOP.ADD_PRINT_HTM(0,0,380,380,html);
|
|
|
|
+ LODOP.SET_PRINT_PAGESIZE(1,1000,1000,"");
|
|
|
|
+ LODOP.PRINT();
|
|
|
|
+ }, 1000);
|
|
|
|
+ });
|
|
|
|
+ },
|
|
handleDownloadBatch() {
|
|
handleDownloadBatch() {
|
|
if(this.selectionList.length <=0) {
|
|
if(this.selectionList.length <=0) {
|
|
this.$message.error('请选择要下载的数据');
|
|
this.$message.error('请选择要下载的数据');
|