flx:提交批量下载二维码 方案台账|施工机具管理
This commit is contained in:
parent
09bdf6a912
commit
59215b14fe
@ -176,6 +176,9 @@ export const setConstructionPlanLedgerDelete = data => post('/xmgl/constructionP
|
||||
export const getConstructionPlanLedgerSetPage = data => get('/xmgl/constructionPlanLedgerSet/page', data);
|
||||
// 保存施工方案台账设置列表信息
|
||||
export const setConstructionPlanLedgerSaveList = data => post('/xmgl/constructionPlanLedgerSet/saveList', data);
|
||||
// 下载施工设备机具图片信息
|
||||
export const downloadConstructionPlanLedgerImage = data => post('/xmgl/constructionPlanLedger/downloadPicInfo', data);
|
||||
|
||||
|
||||
// 文明施工
|
||||
// 分页列表查询现场会、曝光栏、专题活动信息
|
||||
|
||||
@ -587,6 +587,16 @@ export default {
|
||||
watch: {
|
||||
classificationName(val) {
|
||||
this.$refs.tree.filter(val)
|
||||
},
|
||||
dialogFormVisible: {
|
||||
handler(val) {
|
||||
if (val) {
|
||||
this.$nextTick(() => {
|
||||
// 设置树状选中样式
|
||||
this.$refs.tree.setCurrentKey(this.checkedNodeData.id)
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
@ -659,11 +669,11 @@ export default {
|
||||
document.body.appendChild(iframe);
|
||||
iframe.contentDocument.write(printContentHtml);
|
||||
iframe.contentDocument.close();
|
||||
iframe.onload = function(){ //解决图片显示不了的问题
|
||||
iframe.onload = function () { //解决图片显示不了的问题
|
||||
iframe.contentWindow.print();
|
||||
document.body.removeChild(iframe);
|
||||
};
|
||||
|
||||
|
||||
},
|
||||
//生成 二维码
|
||||
bindQRCode(id) {
|
||||
@ -687,7 +697,7 @@ export default {
|
||||
},
|
||||
// 批量打印
|
||||
bulkPrint() {
|
||||
downloadConstructionEquipmentCheckFile(1)
|
||||
this.downloadConstructionEquipmentCheckFile(1)
|
||||
},
|
||||
downloadConstructionEquipmentCheckFile(type) {
|
||||
const ids = type == 1 ? this.downloadPicInfoList.map((item) => item.id).join(",") : this.detailId;
|
||||
@ -733,6 +743,10 @@ export default {
|
||||
}, ...res.result];
|
||||
this.getCheckedNode(this.listData[0]);
|
||||
}
|
||||
this.$nextTick(() => {
|
||||
// todo 在这里设置
|
||||
this.$refs.tree.setCurrentKey(this.listData[0].id)
|
||||
})
|
||||
} else {
|
||||
this.listData = []
|
||||
}
|
||||
|
||||
@ -64,11 +64,14 @@
|
||||
<el-button type="primary" @click="dialogPoint(1)">
|
||||
新增
|
||||
</el-button>
|
||||
<el-button type="primary" @click="bulkPrint()">批量打印</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
<div>
|
||||
<el-table class="tables" :data="pointList">
|
||||
<el-table class="tables" :data="pointList" @selection-change="handleSelectionChangeTable">
|
||||
<el-table-column align="center" type="selection" width="55">
|
||||
</el-table-column>
|
||||
<el-table-column type="index" width="50" align="center"
|
||||
:label="$t('message.personnelPosition.beaconManage.table.index')"></el-table-column>
|
||||
<el-table-column width="120" prop="deviceUnitName" label="装置/单元工程" align="center"></el-table-column>
|
||||
@ -81,9 +84,12 @@
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column width="120" prop="projectGroupName" label="区域项目组" align="center"></el-table-column>
|
||||
<el-table-column width="120" prop="supervisingUnitName" label="工程监理单位" align="center"></el-table-column>
|
||||
<el-table-column width="120" prop="epcContractorName" label="工程承包商" align="center"></el-table-column>
|
||||
<el-table-column width="120" prop="constructionUnitName" label="工程分包商" align="center"></el-table-column>
|
||||
<el-table-column width="120" prop="supervisingUnitName" label="工程监理单位"
|
||||
align="center"></el-table-column>
|
||||
<el-table-column width="120" prop="epcContractorName" label="工程承包商"
|
||||
align="center"></el-table-column>
|
||||
<el-table-column width="120" prop="constructionUnitName" label="工程分包商"
|
||||
align="center"></el-table-column>
|
||||
<!-- <el-table-column width="150" prop="technicalDocumentType" label="技术文件类型" align="center">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ scope.row.technicalDocumentType ?
|
||||
@ -101,29 +107,32 @@
|
||||
" align="center">
|
||||
<template slot-scope="scope">
|
||||
<div class="operation-style">
|
||||
<div class="operationText" v-if="scope.row.isReview == 1" @click="dialogPoint(4, scope.row)">
|
||||
<div class="operationText" v-if="scope.row.isReview == 1"
|
||||
@click="dialogPoint(4, scope.row)">
|
||||
<img src="@/assets/images/tableIcon/preview.png" width="15px" height="15px" />
|
||||
<span>预览</span>
|
||||
</div>
|
||||
<el-button class="m-0" v-if="scope.row.isReview == 1" @click.native.prevent="downloadFn(scope.row)" type="text"
|
||||
size="small">
|
||||
<el-button class="m-0" v-if="scope.row.isReview == 1"
|
||||
@click.native.prevent="downloadFn(scope.row)" type="text" size="small">
|
||||
<i class="el-icon-download"></i>
|
||||
下载
|
||||
</el-button>
|
||||
<div class="operationText" v-if="scope.row.isReview == 1" @click="dialogPoint(2, scope.row)">
|
||||
<div class="operationText" v-if="scope.row.isReview == 1"
|
||||
@click="dialogPoint(2, scope.row)">
|
||||
<img src="@/assets/images/tableIcon/qrcode.png" width="15px" height="15px" />
|
||||
<span>二维码</span>
|
||||
</div>
|
||||
<el-button class="m-0" v-if="scope.row.isReview == 1" @click.native.prevent="dialogPoint(3, scope.row)" type="text"
|
||||
size="small">
|
||||
<el-button class="m-0" v-if="scope.row.isReview == 1"
|
||||
@click.native.prevent="dialogPoint(3, scope.row)" type="text" size="small">
|
||||
<i class="el-icon-setting"></i>
|
||||
设置
|
||||
</el-button>
|
||||
<el-button class="m-0" v-if="scope.row.isReview == 1" @click.native.prevent="dialogPoint(5, scope.row)" type="text"
|
||||
size="small">
|
||||
<el-button class="m-0" v-if="scope.row.isReview == 1"
|
||||
@click.native.prevent="dialogPoint(5, scope.row)" type="text" size="small">
|
||||
<i class="el-icon-edit"></i> 编辑
|
||||
</el-button>
|
||||
<el-button class="m-0" v-if="scope.row.isReview == 1" @click.stop="deleteRow(scope.row)" type="text" size="small">
|
||||
<el-button class="m-0" v-if="scope.row.isReview == 1" @click.stop="deleteRow(scope.row)"
|
||||
type="text" size="small">
|
||||
<i class="el-icon-delete"></i>
|
||||
删除
|
||||
</el-button>
|
||||
@ -139,8 +148,8 @@
|
||||
</div>
|
||||
</div>
|
||||
<!-- 新增 -->
|
||||
<el-dialog :destroy-on-close="true" :modal-append-to-body="false" :title="cardDialogTitle" :visible.sync="cardDialog" :width="dialogType == 3 ? '900px' : '667px'"
|
||||
:before-close="handleClose">
|
||||
<el-dialog :destroy-on-close="true" :modal-append-to-body="false" :title="cardDialogTitle"
|
||||
:visible.sync="cardDialog" :width="dialogType == 3 ? '900px' : '667px'" :before-close="handleClose">
|
||||
<div class="dialog_content" v-if="dialogType == 1 || dialogType == 5">
|
||||
<el-form size="medium" :model="cardForm" ref="cardForm" :rules="rules" label-width="125px"
|
||||
class="dialogFormBox">
|
||||
@ -233,6 +242,9 @@
|
||||
</div>
|
||||
<div class="dialog_content" v-else-if="dialogType == 2">
|
||||
<div id="qrcode" ref="qrCodeDiv"></div>
|
||||
<div style="display: none" id="qrCodeDiv2">
|
||||
<img width="100%" height="400" :src="equipmentBgImg" alt="">
|
||||
</div>
|
||||
<el-button style="margin-top: 20px" type="primary" @click="printBtn()" size="medium">打印方案二维码
|
||||
</el-button>
|
||||
<!-- <el-image
|
||||
@ -367,10 +379,11 @@
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<el-pagination class="pagerBox" @size-change="handleSizeChangeStaff" @current-change="handleCurrentChangeStaff"
|
||||
:current-page="personnelInfo.pageNo" :page-sizes="$store.state.PAGESIZRS"
|
||||
:page-size="personnelInfo.pageSize" layout="total, sizes, prev, pager, next"
|
||||
:total="Number(personnelInfo.total)" background></el-pagination>
|
||||
<el-pagination class="pagerBox" @size-change="handleSizeChangeStaff"
|
||||
@current-change="handleCurrentChangeStaff" :current-page="personnelInfo.pageNo"
|
||||
:page-sizes="$store.state.PAGESIZRS" :page-size="personnelInfo.pageSize"
|
||||
layout="total, sizes, prev, pager, next" :total="Number(personnelInfo.total)"
|
||||
background></el-pagination>
|
||||
</div>
|
||||
<div class="dialog-footer">
|
||||
<el-button class="cancleBtn" @click="handleClose" icon="el-icon-circle-close" size="medium">{{
|
||||
@ -386,6 +399,22 @@
|
||||
</iframe>
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
||||
<!-- 添加卡片弹框 -->
|
||||
<el-dialog :destroy-on-close="true" :modal-append-to-body="false" title="" :visible.sync="cardDialog2"
|
||||
width="900px">
|
||||
<div class="dialog_content">
|
||||
<div class="percentage_title">
|
||||
{{ this.percentageTitle }}
|
||||
</div>
|
||||
<el-progress style="width: 100%" :percentage="percentage"></el-progress>
|
||||
<!-- <div class="dialog-footer">
|
||||
<el-button type="primary" icon="el-icon-circle-check" @click="getProgress" size="medium">{{
|
||||
$t("message.personnelPosition.determine") }}
|
||||
</el-button>
|
||||
</div> -->
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@ -403,7 +432,8 @@ import {
|
||||
setConstructionPlanLedgerEdit,
|
||||
setConstructionPlanLedgerDelete,
|
||||
getConstructionPlanLedgerSetPage,
|
||||
setConstructionPlanLedgerSaveList
|
||||
setConstructionPlanLedgerSaveList,
|
||||
downloadConstructionPlanLedgerImage
|
||||
} from "@/assets/js/api/project";
|
||||
import { getCooperatorListApi } from "@/assets/js/api/cooperationUnit";
|
||||
import { isJSON } from "@/util/nowDate/index";
|
||||
@ -412,6 +442,11 @@ import { encode } from 'js-base64'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
percentage: 0,
|
||||
percentageTitle: "正在下载中,请稍后",
|
||||
cardDialog2: false,
|
||||
equipmentBgImg: "",
|
||||
|
||||
isloading: false,
|
||||
cardDialog: false,
|
||||
current: 0,
|
||||
@ -544,6 +579,7 @@ export default {
|
||||
supervisingUnitList: [], // 当前项目组下的监理单位
|
||||
epcContractorList: [], // 当前项目组下的承包商
|
||||
constructionUnitList: [], // 当前epc承包商下的施工承包商
|
||||
downloadPicInfoList: [], // 下载图片列表
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
@ -552,6 +588,86 @@ export default {
|
||||
},
|
||||
//列表加载
|
||||
methods: {
|
||||
// 批量打印
|
||||
bulkPrint() {
|
||||
this.downloadConstructionEquipmentCheckFile(1)
|
||||
},
|
||||
downloadConstructionEquipmentCheckFile(type, row) {
|
||||
const ids = type == 1 ? this.downloadPicInfoList.map((item) => item.id).join(",") : row.id;
|
||||
downloadConstructionPlanLedgerImage({
|
||||
projectSn: this.projectSn,
|
||||
ids: ids,
|
||||
}).then((res) => {
|
||||
if (res.code == 200) {
|
||||
const url = res.result.file.includes("http://") ? res.result.file : this.$store.state.FILEURL + res.result.file;
|
||||
if (type == 1) {
|
||||
this.getProgress(url);
|
||||
this.cardDialog2 = true;
|
||||
} else {
|
||||
this.equipmentBgImg = url;
|
||||
}
|
||||
} else {
|
||||
this.$message.error(res.msg);
|
||||
}
|
||||
});
|
||||
},
|
||||
handleSelectionChangeTable(selection) {
|
||||
this.downloadPicInfoList = selection;
|
||||
console.log(selection);
|
||||
},
|
||||
getProgress(rowUrl) {
|
||||
//进度条恢复为 0
|
||||
this.percentage = 0;
|
||||
// return
|
||||
//发起请求
|
||||
this.$http({
|
||||
//下载文件的远端地址。
|
||||
url: rowUrl,
|
||||
//请求方式 get post。
|
||||
method: "get",
|
||||
//设置返回数据类型为base64的数据,这样才可以被new Blob() 解析。
|
||||
responseType: "blob",
|
||||
//请求参数 get-->params post-->data 。
|
||||
params: {},
|
||||
//xml返回数据的钩子函数,可以用来获取数据的进度 具体可查看axios的官网
|
||||
onDownloadProgress: (progressEvent) => {
|
||||
//progressEvent.loaded 下载文件的当前大小
|
||||
//progressEvent.total 下载文件的总大小 如果后端没有返回 请让他加上!
|
||||
let progressBar = Math.round(progressEvent.loaded / progressEvent.total * 100);
|
||||
//接收进度为99%的时候需要留一点前端编译的时间
|
||||
if (progressBar >= 99) {
|
||||
this.percentage = 99;
|
||||
this.percentageTitle = '下载完成,文件正在编译。';
|
||||
} else {
|
||||
this.percentage = progressBar;
|
||||
this.percentageTitle = '正在下载,请耐心等待...';
|
||||
}
|
||||
}
|
||||
}).then(res => {
|
||||
//当前定义res.message 出现的时候说明后端文件返回出现了问题 不然应该直接是个文件流
|
||||
if (res.status != 200) {
|
||||
this.percentageTitle = '下载失败,请重试。';
|
||||
return
|
||||
}
|
||||
console.log(res.data)
|
||||
// return;
|
||||
// 创建一个下载链接
|
||||
const url = window.URL.createObjectURL(res.data);
|
||||
// 创建一个<a>元素
|
||||
const link = document.createElement("a");
|
||||
link.href = url;
|
||||
link.download = "方案台账二维码"; // 指定下载文件的文件名
|
||||
// 模拟点击下载链接
|
||||
document.body.appendChild(link);
|
||||
link.click();
|
||||
document.body.removeChild(link);
|
||||
// 释放URL对象
|
||||
window.URL.revokeObjectURL(url);
|
||||
this.percentageTitle = '下载完成';
|
||||
//编译文件完成后,进度条展示为100%100
|
||||
this.percentage = 100;
|
||||
})
|
||||
},
|
||||
// 全选
|
||||
handleCheckAllChange(isChecked, selectType) {
|
||||
// console.log(isChecked, selectType);
|
||||
@ -662,8 +778,8 @@ export default {
|
||||
this.pageNo = val;
|
||||
this.loadCardData();
|
||||
},
|
||||
//查看条数
|
||||
handleSizeChangeStaff(val) {
|
||||
//查看条数
|
||||
handleSizeChangeStaff(val) {
|
||||
this.personnelInfo.pageSize = val;
|
||||
this.constructionPlanLedgerSetPage();
|
||||
},
|
||||
@ -759,6 +875,7 @@ export default {
|
||||
this.$nextTick(() => {
|
||||
this.bindQRCode(row.id);
|
||||
});
|
||||
this.downloadConstructionEquipmentCheckFile(2, row);
|
||||
this.cardDialogTitle = "二维码详情";
|
||||
} else if (dialogType == 3) {
|
||||
const flag = document.getElementById("qrcode");
|
||||
@ -877,18 +994,29 @@ export default {
|
||||
});
|
||||
},
|
||||
printBtn() {
|
||||
// setTimeout(() => {
|
||||
// console.log(this.$refs["qrCodeDiv"].innerHTML)
|
||||
// },100)
|
||||
const printContentHtml = document.getElementById("qrCodeDiv2").innerHTML;
|
||||
// console.log(printContentHtml);
|
||||
const iframe = document.createElement("iframe");
|
||||
// iframe.setAttribute(
|
||||
// "style",
|
||||
// "position:absolute;width:0px;height:0px;left:-500px;top:-500px;"
|
||||
// );
|
||||
document.body.appendChild(iframe);
|
||||
iframe.contentDocument.write(printContentHtml);
|
||||
iframe.contentDocument.close();
|
||||
iframe.onload = function () { //解决图片显示不了的问题
|
||||
iframe.contentWindow.print();
|
||||
document.body.removeChild(iframe);
|
||||
};
|
||||
// qrCode
|
||||
setTimeout(() => {
|
||||
let printDemo = this.$refs["qrCodeDiv"].innerHTML;
|
||||
console.log(printDemo);
|
||||
window.document.body.innerHTML = printDemo;
|
||||
//没有图片直接打印
|
||||
window.print();
|
||||
window.location.reload();
|
||||
}, 100);
|
||||
// setTimeout(() => {
|
||||
// let printDemo = this.$refs["qrCodeDiv"].innerHTML;
|
||||
// console.log(printDemo);
|
||||
// window.document.body.innerHTML = printDemo;
|
||||
// //没有图片直接打印
|
||||
// window.print();
|
||||
// window.location.reload();
|
||||
// }, 100);
|
||||
},
|
||||
handleExceed() {
|
||||
this.$message.warning("文件超出最大限制,请删除上份文件!");
|
||||
@ -987,7 +1115,7 @@ export default {
|
||||
},
|
||||
computed: {
|
||||
dateRange() {
|
||||
const { preview, download, qrcode, isAuthorize, isModified,isView, isDeleted } = this
|
||||
const { preview, download, qrcode, isAuthorize, isModified, isView, isDeleted } = this
|
||||
return {
|
||||
preview: preview.selectionData,
|
||||
download: download.selectionData,
|
||||
@ -1019,12 +1147,19 @@ export default {
|
||||
</script>
|
||||
|
||||
<style scoped lang="less">
|
||||
.percentage_title {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
padding: 10px 0;
|
||||
}
|
||||
.tables {
|
||||
min-height: inherit;
|
||||
}
|
||||
|
||||
/deep/ .el-table__fixed-right {
|
||||
height: 100% !important;
|
||||
}
|
||||
|
||||
.dialog_content {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
@ -1191,5 +1326,4 @@ export default {
|
||||
/*设置lable高度,与input高度一样*/
|
||||
line-height: 16px !important;
|
||||
/*设置行高为label高度的一半(有n行就是label高度的1/n)*/
|
||||
}
|
||||
</style>
|
||||
}</style>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user