|
@@ -8,14 +8,9 @@
|
|
|
</div>
|
|
|
</template>
|
|
|
<!-- 同屏对比主题 -->
|
|
|
- <div
|
|
|
- class="ssc_main"
|
|
|
- id="doPrint"
|
|
|
- ref="doPrint"
|
|
|
- :style="{ height: !subMitStatus ? 'calc(100vh - 190px)' : 'calc(100vh - 310px)' }"
|
|
|
- >
|
|
|
+ <div class="ssc_main" :style="{ height: !subMitStatus ? 'calc(100vh - 190px)' : 'calc(100vh - 310px)' }">
|
|
|
<!-- 地图列表 -->
|
|
|
- <div class="ssc_main_mapList">
|
|
|
+ <div class="ssc_main_mapList" id="doPrint" ref="doPrint">
|
|
|
<div
|
|
|
class="ssc_main_mapList_showList"
|
|
|
:id="'map' + index"
|
|
@@ -35,7 +30,7 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
<!-- 底图列表 -->
|
|
|
- <div class="ssc_main_aimapList" v-show="!subMitStatus">
|
|
|
+ <div class="ssc_main_aimapList">
|
|
|
<span>地图底图(最多选择6个) </span>
|
|
|
<div>
|
|
|
已选择<span class="checkLength">{{ checkedCities.length }}</span
|
|
@@ -55,14 +50,14 @@
|
|
|
</div>
|
|
|
<!-- 底部文本域 -->
|
|
|
<div id="textareaBox" v-if="subMitStatus">
|
|
|
- <div class="textareaTitle">描述记录</div>
|
|
|
+ <div class="textareaTitle">描述记录:</div>
|
|
|
<el-input type="textarea" :autosize="{ minRows: 3, maxRows: 4 }" placeholder="请输入内容" v-model="textarea1"> </el-input>
|
|
|
</div>
|
|
|
<!-- 打印区域 -->
|
|
|
<div id="imgBox">
|
|
|
<span>基本农田被侵占</span>
|
|
|
<img src="" id="imgOut" style="width: 1240px; background-repeat: no-repeat; background-size: 100% 100%" />
|
|
|
- <span><div>描述记录</div></span>
|
|
|
+ <span><div>描述记录:</div></span>
|
|
|
<div>{{ textarea1 }}</div>
|
|
|
</div>
|
|
|
<span slot="footer" class="dialog-footer">
|
|
@@ -88,6 +83,8 @@ export default {
|
|
|
// 同屏对比弹窗显示状态
|
|
|
dialogVisible: false,
|
|
|
checkedCities: [],
|
|
|
+ // 定时器暂存
|
|
|
+ interval: "",
|
|
|
// 地图暂存显示变量
|
|
|
centerZoom: {},
|
|
|
mouseIndex: -1,
|
|
@@ -240,23 +237,36 @@ export default {
|
|
|
},
|
|
|
// 同屏对比取消
|
|
|
clearDialogVisible() {
|
|
|
- // 返回上级
|
|
|
- if (this.subMitStatus) {
|
|
|
- this.subMitStatus = !this.subMitStatus;
|
|
|
+ if (this.interval) {
|
|
|
+ this.$message.info("取消打印!");
|
|
|
+ this.clearDiyInterval();
|
|
|
} else {
|
|
|
- // 关闭弹窗
|
|
|
- this.dialogVisible = false;
|
|
|
- // 修改父级菜单变量(弹窗显示状态和显示底部菜单)
|
|
|
- this.$emit("changeShowBottomMenusStatus", true);
|
|
|
+ // 返回上级
|
|
|
+ if (this.subMitStatus) {
|
|
|
+ this.subMitStatus = !this.subMitStatus;
|
|
|
+ } else {
|
|
|
+ // 关闭弹窗
|
|
|
+ this.dialogVisible = false;
|
|
|
+ // 修改父级菜单变量(弹窗显示状态和显示底部菜单)
|
|
|
+ this.$emit("changeShowBottomMenusStatus", true);
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
// 同屏对比表单提交
|
|
|
subMitDialogVisible() {
|
|
|
- if (!this.subMitStatus) {
|
|
|
- this.subMitStatus = !this.subMitStatus;
|
|
|
+ if (this.interval) {
|
|
|
+ this.$message.info("正在打印,请稍后操作!");
|
|
|
} else {
|
|
|
- // 出现新的弹窗并截图当前地图,以及文本域
|
|
|
- this.cutDiv();
|
|
|
+ if (!this.subMitStatus) {
|
|
|
+ if (this.checkedCities.length < 2) {
|
|
|
+ this.$message.info("请至少选择两个地图底图!");
|
|
|
+ } else {
|
|
|
+ this.subMitStatus = !this.subMitStatus;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ // 出现新的弹窗并截图当前地图,以及文本域
|
|
|
+ this.cutDiv();
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
// div转图片
|
|
@@ -274,9 +284,21 @@ export default {
|
|
|
html2canvas(this.$refs.doPrint, ops).then(canvas => {
|
|
|
document.getElementById("imgOut").setAttribute("src", canvas.toDataURL("image/png"));
|
|
|
});
|
|
|
- setTimeout(() =>{
|
|
|
- that.doPrint();
|
|
|
- },300);
|
|
|
+
|
|
|
+ this.interval = setInterval(() => {
|
|
|
+ if ($("#imgOut").attr("src")) {
|
|
|
+ that.clearDiyInterval();
|
|
|
+ setTimeout(() => {
|
|
|
+ that.doPrint();
|
|
|
+ }, 500);
|
|
|
+ }
|
|
|
+ }, 500);
|
|
|
+ },
|
|
|
+ clearDiyInterval() {
|
|
|
+ let that = this;
|
|
|
+ // 先销毁定时器
|
|
|
+ clearInterval(that.interval);
|
|
|
+ that.interval = "";
|
|
|
},
|
|
|
// div打印(iframe的方式为最优)
|
|
|
doPrint() {
|
|
@@ -325,7 +347,7 @@ export default {
|
|
|
bottom: 0;
|
|
|
}
|
|
|
&_mapList {
|
|
|
- width: 100%;
|
|
|
+ width: calc(100% - 20rem);
|
|
|
height: 100%;
|
|
|
display: flex;
|
|
|
flex-wrap: wrap;
|
|
@@ -359,23 +381,19 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
&_aimapList {
|
|
|
- position: absolute;
|
|
|
- z-index: 999;
|
|
|
- right: 0;
|
|
|
width: 20rem;
|
|
|
height: 100%;
|
|
|
font-size: 20px;
|
|
|
color: #fff;
|
|
|
padding: 10px;
|
|
|
box-sizing: border-box;
|
|
|
- border: 1px solid #ccc;
|
|
|
background: #002645 !important;
|
|
|
.checkLength {
|
|
|
font-size: 24px;
|
|
|
color: #74ffff;
|
|
|
}
|
|
|
#mapCheckBox {
|
|
|
- height: calc(100% - 4rem);
|
|
|
+ height: calc(100% - 58px);
|
|
|
width: 100%;
|
|
|
overflow-x: hidden;
|
|
|
overflow-y: auto;
|