flx:提交批量下载二维码 方案台账|施工机具管理

This commit is contained in:
X_Rian 2024-09-10 17:39:17 +08:00
parent 09bdf6a912
commit 59215b14fe
3 changed files with 190 additions and 39 deletions

View File

@ -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);
// 文明施工
// 分页列表查询现场会、曝光栏、专题活动信息

View File

@ -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 = []
}

View File

@ -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",
//base64new 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>