This commit is contained in:
linfso 2024-07-05 13:23:12 +08:00
parent 14b072b6d2
commit 8476b5a79d
11 changed files with 252 additions and 97 deletions

View File

@ -1,6 +1,6 @@
{
"name": "xd-vue-pdf",
"version": "1.0.0",
"version": "1.0.1",
"description": "vue.js pdf viewer",
"main": "src/vuePdfNoSss.vue",
"scripts": {},

View File

@ -6,15 +6,16 @@ export default function() {
this.fetch = function(query) {
// delete require.cache[require.resolve('./buffer-loader!pdfjs-dist-sign/cmaps/'+query.name+'.bcmap')];
return import('./buffer-loader!pdfjs-dist/cmaps/'+query.name+'.bcmap' /* webpackChunkName: "noprefetch-[request]" */)
.then(function(bcmap) {
delete require.cache[require.resolve('./buffer-loader!pdfjs-dist-sign/cmaps/'+query.name+'.bcmap')];
return {
cMapData: bcmap.default,
compressionType: CMapCompressionType.BINARY,
};
});
}
};

View File

@ -106,7 +106,7 @@
"vuex": "3.6.0",
"watermark-dom": "2.3.0",
"xd-pdf": "./libs/XdPdf",
"xd-vue-pdf": "file:libs/XdVuePdf",
"xd-vue-pdf": "./libs/XdVuePdf",
"xlsx": "^0.17.5"
},
"devDependencies": {

View File

@ -30,7 +30,14 @@ import { listSimpleAction } from "@/api/system/sysActionStats";
export default {
name: 'HeaderSearch',
// mixins: [setHeight],
props: {
refreshId: {
type: String,
},
},
data() {
return {
createdId:'0',
visible: false,
@ -51,6 +58,9 @@ watch: {
routes() {
this.searchPool = this.generateRoutes(this.routes)
},
refreshId() {
this.initQuickActionList();
},
searchPool(list) {
this.initFuse(list)
},
@ -72,6 +82,7 @@ methods: {
pageNum: 1,
pageSize: 20
};
// console.log("===>search3==>",queryParams)
listSimpleAction(queryParams).then(response => {
this.quickActionList = response.rows;
});

View File

@ -31,12 +31,16 @@
</div>
<div class="tools">
<div style="width:100%;text-align: right;">
<!-- <el-button title="" type="primary" v-if="isA4" @click="showSinglePage(1)">切换单页</el-button> -->
<!-- <el-button title="" type="primary" v-else @click="showA4Page(1)">切换A4</el-button> -->
<el-button title="" type="primary" icon="el-icon-download" size="mini" style="padding: 5px 10px;" @click="downPDF">下载</el-button>
<el-button title="" type="primary" icon="el-icon-printer" size="mini" style="padding: 5px 10px;" @click="printPDF">打印</el-button>
</div>
</div>
</div>
<div style="min-height:1600px;margin: 0 auto;overflow: auto;">
<!-- <el-scrollbar>
<div style="min-height:600px;margin: 0 auto;overflow: auto;"> -->
<div class="pdf-wrapper">
<pdf
:src="currentPdfUrl"
@ -46,12 +50,15 @@
ref="pdf"
></pdf>
</div>
<!-- </div> -->
<!-- </el-scrollbar> -->
</div>
</div>
</div>
</template>
<script>
import printJS from 'print-js'
// npm i pdfjs-dist@2.5.207
// npm i vue-pdf@4.2.0
import pdf from 'xd-vue-pdf'
@ -62,6 +69,9 @@ export default {
pdfList:{
type: Array,
},
printOrderList:{
type: Array,
},
startPage: {
type: Number,
default: 1
@ -79,14 +89,17 @@ export default {
loadPdfUrl:null,
// 单页模式
sortPrintOrderList:this.printOrderList,
cacheFileList:this.pdfList,
isA4:false,
page: 1,
currentPage: 1,
pageCount: this.pdfList.length,
// A4 模式
singlePageCount:1,
cacheA4FileList:[],
thisPageCount:1,
scale: 25,
preScale: 25,
@ -110,36 +123,79 @@ export default {
},
watch: {
pdfList(){
// 按照给定的数据排序
this.cacheFileList=this.pdfList;
this.initA4List();
this.showFirstFile();
},
thisPageCount(value) {
this.doScale(25);
if(this.isA4){
this.doScale(75);
}else{
this.doScale(25);
}
},
isLoadComplete(newVal,oldVal){
// let newTmpList = this.cacheFileList.sort((one, two) => {
// return one.seqNo - two.seqNo;
// });
// this.cacheFileList=newTmpList
// that.pdfList=newTmpList;
console.log("===isLoadComplete that.cacheFileList====>",this.cacheFileList);
this.showSinglePage(1);
if(this.isA4){
this.showA4Page(1);
}else{
this.showSinglePage(1);
}
}
},
mounted() {
this.initA4List();
this.showFirstFile();
window.addEventListener('mousewheel', this.handleScroll, { passive: false })
},
methods: {
initA4List(){
this.cacheA4FileList=[];
const newList = Object.assign([], this.pdfList);
if(newList&&newList.length>4){
let spliteArr = (array = [], subGroupLength = 0) => {
let index = 0;
const newArray = [];
while (index < array.length) {
newArray.push(array.slice(index, index += subGroupLength));
}
return newArray;
}
const subPdfList=spliteArr(newList, 4);
for (let i=0; i < subPdfList.length;i++){
let fileItem={
"billCode":"page-"+(i+1),
"pdfUrl":null,
"childreen":subPdfList[i]
}
this.cacheA4FileList.push(fileItem);
}
}else{
let fileItem={
"billCode":"page-"+1,
"pdfUrl":null,
"childreen":newList
}
this.cacheA4FileList.push(fileItem);
}
},
showFirstFile(){
this.scale=25;
this.preScale=25;
this.pageCount=this.cacheFileList.length;
setTimeout( this.showSinglePage(1),2000);
if(this.isA4){
this.scale=75;
this.preScale=75;
this.pageCount=this.cacheA4FileList.length;
setTimeout( this.showA4Page(this.cacheA4FileList.length),3000);
}else{
this.scale=25;
this.preScale=25;
this.pageCount=this.cacheFileList.length;
setTimeout( this.showSinglePage(1),2000);
}
this.resetCountKey++;
},
@ -160,12 +216,16 @@ export default {
},
onPageLoaded(currentPage){
// console.log("====>onPageLoaded==>currentPage:",currentPage)
// this.doScale(25);
// this.currentPage=1;
if(this.isA4){
// this.page = 1;
// this.doScale(75);
}else{
// this.currentPage=1;
// this.page = 1;
// this.doScale(20);
}
},
doScale(val){
@ -199,21 +259,62 @@ export default {
}
},
prePage() {
let fileNo = this.currentPage - 1
if (fileNo < 1) return
this.currentPage = fileNo
this.showSinglePage(this.currentPage)
if(!this.isA4){
let fileNo = this.currentPage - 1
if (fileNo < 1) return
this.currentPage = fileNo
this.showSinglePage(this.currentPage)
}
else{
let fileNo = this.currentPage - 1
if (fileNo < 1) return
this.currentPage = fileNo
this.showA4Page(this.currentPage)
}
},
nextPage() {
let fileNo = this.currentPage + 1
if (fileNo > this.pageCount) return
this.currentPage = fileNo
this.showSinglePage(this.currentPage)
if(!this.isA4){
let fileNo = this.currentPage + 1
if (fileNo > this.pageCount) return
this.currentPage = fileNo
this.showSinglePage(this.currentPage)
}
else{
let fileNo = this.currentPage + 1
if (fileNo > this.pageCount) return
this.currentPage = fileNo
this.showA4Page(this.currentPage)
}
},
// 下载
downPDF() {
// 下载所有预览的PDF文件
if(this.cacheFileList&&this.cacheFileList.length>0){
if(this.isA4){
if(this.cacheA4FileList&&this.cacheA4FileList.length>0){
this.cacheA4FileList.forEach(async item=>{
if(!item.pdfUrl){
let thisSubList=item.childreen;
let needGenList=[];
for(let j=0;j<thisSubList.length;j++){
needGenList.push(thisSubList[j].pdfBase64)
}
item.pdfUrl=await this.pdfUtils.mergePdfToA4(needGenList);
this.downPdfFile(item.pdfUrl);
}else{
this.downPdfFile(item.pdfUrl);
}
});
}
}else{
if(this.cacheFileList&&this.cacheFileList.length>0){
// this.cacheFileList.forEach( item=>{
// if(!item.pdfUrl){
// item.pdfUrl = this.pdfUtils.getBlobUrl(item.pdfBase64);
// }
// this.downPdfFile(item.billCode,item.pdfUrl);
// });
this.$prompt('请输入保存文件名', "提示", {
confirmButtonText: "确定",
@ -240,6 +341,7 @@ export default {
}
}
},
downPdfFile(pdfUrl){
@ -274,27 +376,60 @@ export default {
},
// 打印
printPDF() {
this.$emit("onPrint");
if(this.isA4){
printJS(this.loadPdfUrl);
}else{
this.$emit("onPrint");
}
},
showSinglePage(page){
this.isA4 = false;
if(!page || Object.is(page, NaN)){
page=1;
}
this.pageCount=this.cacheFileList.length;
const thisPage=this.cacheFileList[page-1];
const pdfBase64 = thisPage.pdfBase64;
if(!thisPage.pdfUrl){
}
const pdfBase64 = thisPage.pdfBase64;
this.loadPdfUrl = this.pdfUtils.getBlobUrl(pdfBase64);
console.log("===isLoadComplete that.cacheFileList====>",this.cacheFileList);
this.doScale(25);
this.doScale(20);
this.resetCountKey++;
},
async showA4Page(page){
this.isA4 = true
if(!page || Object.is(page, NaN)){
page=1;
}
if(!this.cacheA4FileList || this.cacheA4FileList.length==0){
return;
}
const loadingInstance = this.$loading({
text: '正在生成A4预览...'
})
this.pageCount=this.cacheA4FileList.length;
// 分页生成文件,只渲染第一页
let thisSubList=this.cacheA4FileList[1].childreen;
let needGenList=[];
for(let j=0;j<thisSubList.length;j++){
needGenList.push(thisSubList[j].pdfBase64)
}
let pdfUrl=await this.pdfUtils.mergePdfToA4(needGenList);
if(pdfUrl){
loadingInstance.close();
this.cacheA4FileList[page-1].pdfUrl=pdfUrl;
this.loadPdfUrl=this.cacheA4FileList[page-1].pdfUrl;
}
this.resetCountKey++;
},
}

View File

@ -506,7 +506,10 @@ export default {
dragColumn: {
update: function (el, binding, vnode) {
var oDiv = el;
vnode.context.setHeaderSortable();
vnode.context.$nextTick(() => {
vnode.context.setHeaderSortable();
})
}
}
},
@ -839,31 +842,33 @@ export default {
this.$nextTick(function () {
const wrapperTr = document.querySelector('#'+that.tableId+' .el-table__header-wrapper > table > thead > tr');
// console.log("===>wrapperTr==>",wrapperTr);
Sortable.create(wrapperTr, {
animation: 100,
delay: 50,
dragClass: "dragClass",
ghostClass: "ghostClass",
chosenClass: "chosenClass",
onStart: () => {
},
// 结束拖动事件
onEnd: ({ newIndex, oldIndex }) => {
let arr = that.storageList;
const currCol = arr.splice(oldIndex-1, 1)[0];
arr.splice(newIndex-1, 0, currCol);
if(wrapperTr){
Sortable.create(wrapperTr, {
animation: 100,
delay: 50,
dragClass: "dragClass",
ghostClass: "ghostClass",
chosenClass: "chosenClass",
onStart: () => {
},
// 结束拖动事件
onEnd: ({ newIndex, oldIndex }) => {
let arr = that.storageList;
const currCol = arr.splice(oldIndex-1, 1)[0];
arr.splice(newIndex-1, 0, currCol);
that.storageList = arr;
that.updateTable();
// this.refreshKeyId=Math.random().toString(36).substring(3,10);
that.storageList = arr;
that.updateTable();
// this.refreshKeyId=Math.random().toString(36).substring(3,10);
// const currCol = vnode.context.storageList.splice(oldIndex-1, 1)[0];
// vnode.context.storageList.splice(newIndex-1, 0, currCol);
// vnode.context.updateTable();
},
// const currCol = vnode.context.storageList.splice(oldIndex-1, 1)[0];
// vnode.context.storageList.splice(newIndex-1, 0, currCol);
// vnode.context.updateTable();
},
});
});
}
})
},
handleSelectCurrentColumn(){
@ -1103,7 +1108,9 @@ export default {
:deep .seled{
background-color: #d9ecff7d !important;
// background-color: #d9ecff7d !important;
background-color: #51dd397d !important;
color: black;
font-weight: 600;
}

View File

@ -37,7 +37,7 @@
:persistent="false"
@show="refreshId=Math.random().toString(36).substring(3,10)"
>
<search3 id="header-search" :key="refreshId"/>
<search3 id="header-search" :refreshId="refreshId"/>
<span slot="reference">
<i class="icon iconfont icon-icon_menhukuaijiecaidan" ></i>
</span>

View File

@ -371,16 +371,17 @@
that.showCounter++;
}
else if(code == 800){
// 全部获取完成
// console.log("===全部获取完成1====>");
console.log("===全部获取完成ADV====>");
// let newTmpList = that.pdfList.sort((one, two) => {
// return one.seqNo - two.seqNo;
// });
// that.pdfList=newTmpList;
// if(!that.openPdfView && that.showCounter==0){
// that.openPdfView = true;
// }
that.isLoadComplete=true;
}

View File

@ -94,9 +94,9 @@ export default {
},
methods: {
sortByScanDate(obj1, obj2) {
let val1 = obj1.scanDate
let val2 = obj2.scanDate
return val1 - val2
let val1 = new Date(obj1.scanDate)
let val2 = new Date(obj2.scanDate)
return val1.getTime() - val2.getTime()
},
getList() {
this.loading = true;

View File

@ -443,6 +443,7 @@
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item :label="$t('体积重量')" prop="volumeWeight" label-width="70px">
<el-input v-model="form.volumeWeight" placeholder="" disabled>
@ -458,6 +459,15 @@
</el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item :label="$t('货值')" prop="realValue" label-width="70px" >
<div style="">
<el-input v-model="form.realValue" style="text-align: right;width: 120px" placeholder="货值" >
<span slot="suffix">(USD)</span>
</el-input>
</div>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item :label="$t('包装类型')" prop="packType" label-width="70px"">
<el-select multiple="" v-model="form.packType" placeholder="">
@ -507,7 +517,8 @@
</el-col>
<el-col :span="24">
<el-form-item :label="$t('运单备注')" prop="remark" label-width="70px">
<el-input v-model="form.remark" type="textarea" placeholder="" />
<el-input v-model="form.remark" type="textarea" placeholder="" maxlength="150"
show-word-limit />
</el-form-item>
</el-col>
</el-row>
@ -666,7 +677,7 @@
<el-input v-else v-model="form.freight" disabled placeholder="" > </el-input>
</el-form-item>
<el-form-item :label="$t('费用备注')" prop="feeRemark" label-width="70px">
<el-input v-model="form.feeRemark" type="textarea" maxlength="300"
<el-input v-model="form.feeRemark" type="textarea" maxlength="150"
show-word-limit placeholder="" >
</el-input>
</el-form-item>
@ -1712,6 +1723,7 @@ methods: {
expr=expr.replace("d",row.addWeightPrice);
expr=expr.replace("w",this.form.settlementWeight);
console.log("===>eval(expr):",eval(expr));
row.realFee=parseFloat(eval(expr)).toFixed(2);
console.log("===>row.calcExp==>expr==>row.realFee:",row.calcExp,expr,row.realFee);
@ -1797,11 +1809,15 @@ methods: {
let calcFeeType=this.form.calcFeeType;
if(calcFeeType==3){
calcFeeType=1;
// calcFeeType=1;
// 不要重算费用
return;
}
let postData={
productType: this.form.productType,
customerCode: this.form.customerCode,

View File

@ -21,12 +21,12 @@
</el-col>
<el-form-item label="状态" prop="processStatus">
<el-select clearable="" v-model="queryParams.processStatus" placeholder="请选择">
<el-select clearable v-model="queryParams.params.processStatus" placeholder="请选择">
<el-option label="未确认" :value="1"></el-option>
<el-option label="已确认" :value="2"></el-option>
<el-option label="中心已审核" :value="2"></el-option>
<el-option label="网点驳回" :value="2"></el-option>
<el-option label="中心驳回" :value="2"></el-option>
<el-option label="中心已审核" :value="3"></el-option>
<el-option label="网点驳回" :value="4"></el-option>
<el-option label="中心驳回" :value="5"></el-option>
</el-select>
</el-form-item>
<!-- <el-form-item label="修改项目" prop="applyType">
@ -271,6 +271,9 @@ export default {
centerConfirmNote: null,
remark: null,
delFlag: null,
params:{
processStatus:null,
}
},
};
},
@ -281,28 +284,9 @@ export default {
/** 查询运单调整申请列表 */
getList() {
this.loading = true;
this.queryParams.params = {};
if (null != this.daterangeApplyDate && '' != this.daterangeApplyDate) {
this.queryParams.params["beginApplyDate"] = this.daterangeApplyDate[0];
this.queryParams.params["endApplyDate"] = this.daterangeApplyDate[1];
}
if (null != this.daterangeDestConfirmDate && '' != this.daterangeDestConfirmDate) {
this.queryParams.params["beginDestConfirmDate"] = this.daterangeDestConfirmDate[0];
this.queryParams.params["endDestConfirmDate"] = this.daterangeDestConfirmDate[1];
}
if (null != this.daterangeCenterConfirmDate && '' != this.daterangeCenterConfirmDate) {
this.queryParams.params["beginCenterConfirmDate"] = this.daterangeCenterConfirmDate[0];
this.queryParams.params["endCenterConfirmDate"] = this.daterangeCenterConfirmDate[1];
}
if (null != this.daterangeCreateTime && '' != this.daterangeCreateTime) {
this.queryParams.params["beginCreateTime"] = this.daterangeCreateTime[0];
this.queryParams.params["endCreateTime"] = this.daterangeCreateTime[1];
}
if (null != this.daterangeUpdateTime && '' != this.daterangeUpdateTime) {
this.queryParams.params["beginUpdateTime"] = this.daterangeUpdateTime[0];
this.queryParams.params["endUpdateTime"] = this.daterangeUpdateTime[1];
}
listEmisWaybillAjustApply(this.addDateRange(this.queryParams, this.dateTimeRange)).then(response => {
this.queryParams.applySiteCode=this.$store.getters.ownerSiteCode;
this.queryParams=this.addDateRange(this.queryParams, this.dateTimeRange,'applyDate');
listEmisWaybillAjustApply(this.queryParams).then(response => {
this.emisWaybillAjustApplyList = response.rows;
this.total = response.total;
this.loading = false;