|
@@ -1,165 +1,73 @@
|
|
|
<template>
|
|
|
<!-- 地图打印 -->
|
|
|
- <div class="print-container">
|
|
|
- <div class="print-setting">
|
|
|
- <el-collapse v-model="activeNames" accordion @change="handleChange">
|
|
|
- <el-collapse-item title="基本信息" name="1">
|
|
|
- <el-row>
|
|
|
- <el-col :span="24">
|
|
|
- <el-row>
|
|
|
- <el-col :span="5">打印图层:</el-col>
|
|
|
- <el-col :span="19">
|
|
|
- <el-select v-model="selectLayers" multiple value-key="layerUrl" size="small" placeholder="选择打印图层" @change="selectLayer"
|
|
|
- style="width:100%">
|
|
|
- <el-option-group v-for="group in layersOptions" :key="group.label" :label="group.label">
|
|
|
- <el-option v-for="item in group.options" :key="item.layerUrl" :label="item.label" :value="item"></el-option>
|
|
|
- </el-option-group>
|
|
|
- </el-select>
|
|
|
- </el-col>
|
|
|
- </el-row>
|
|
|
- </el-col>
|
|
|
- <el-col :span="24">
|
|
|
- <el-row>
|
|
|
- <el-col :span="5">布局模板:</el-col>
|
|
|
- <el-col :span="19">
|
|
|
- <el-select v-model="mapPrintPraram.template" size="small" placeholder="选择打印模板" style="width:100%">
|
|
|
- <el-option v-for="(item,index) in printTemplates" :key="index" :label="item" :value="item"></el-option>
|
|
|
- </el-select>
|
|
|
- </el-col>
|
|
|
- </el-row>
|
|
|
- </el-col>
|
|
|
- <el-col :span="24">
|
|
|
- <el-row>
|
|
|
- <el-col :span="5">标题:</el-col>
|
|
|
- <el-col :span="19">
|
|
|
- <el-input v-model="mapPrintPraram.title" size="small" placeholder="输入地图标题"></el-input>
|
|
|
- </el-col>
|
|
|
- </el-row>
|
|
|
- </el-col>
|
|
|
- <el-col :span="24">
|
|
|
- <el-row>
|
|
|
- <el-col :span="5">副标题:</el-col>
|
|
|
- <el-col :span="19">
|
|
|
- <el-input v-model="mapPrintPraram.subTitle" size="small" placeholder="输入地图副标题"></el-input>
|
|
|
- </el-col>
|
|
|
- </el-row>
|
|
|
- </el-col>
|
|
|
- <el-col :span="24">
|
|
|
- <el-row>
|
|
|
- <el-col :span="5">版权信息:</el-col>
|
|
|
- <el-col :span="19">
|
|
|
- <el-input v-model="mapPrintPraram.copyrightInfo" size="small" placeholder="输入版权信息"></el-input>
|
|
|
- </el-col>
|
|
|
- </el-row>
|
|
|
- </el-col>
|
|
|
- <el-col :span="24">
|
|
|
- <el-row>
|
|
|
- <el-col :span="5">作者:</el-col>
|
|
|
- <el-col :span="19">
|
|
|
- <el-input v-model="mapPrintPraram.author" size="small" placeholder="输入作者名称"></el-input>
|
|
|
- </el-col>
|
|
|
- </el-row>
|
|
|
- </el-col>
|
|
|
- </el-row>
|
|
|
- </el-collapse-item>
|
|
|
- <el-collapse-item title="附图" name="2">
|
|
|
- <el-row>
|
|
|
- <el-col :span="24">
|
|
|
- <el-row>
|
|
|
- <el-col :span="5">比例尺:</el-col>
|
|
|
- <el-col :span="19">
|
|
|
- <el-input v-model="mapPrintPraram.scale" size="small" placeholder="小地图比例尺" :readonly="true"></el-input>
|
|
|
- </el-col>
|
|
|
- </el-row>
|
|
|
- </el-col>
|
|
|
- <el-col :span="24">
|
|
|
- <el-row>
|
|
|
- <el-col :span="5">中心点:</el-col>
|
|
|
- <el-col :span="19">
|
|
|
- <el-input v-model="mapPrintPraram.mapCenterPoint" size="small" placeholder="地图中心点" :readonly="true"></el-input>
|
|
|
- </el-col>
|
|
|
- </el-row>
|
|
|
- </el-col>
|
|
|
- </el-row>
|
|
|
- </el-collapse-item>
|
|
|
- <el-collapse-item title="比例尺" name="3">
|
|
|
- <el-row>
|
|
|
- <el-col :span="24">
|
|
|
- <el-row>
|
|
|
- <el-col :span="5">文本:</el-col>
|
|
|
- <el-col :span="19">
|
|
|
- <el-input v-model="mapPrintPraram.scaleText" size="small" placeholder="输入比例尺文本"></el-input>
|
|
|
- </el-col>
|
|
|
- </el-row>
|
|
|
- </el-col>
|
|
|
- <el-col :span="24">
|
|
|
- <el-row>
|
|
|
- <el-col :span="5">样式:</el-col>
|
|
|
- <el-col :span="19">
|
|
|
- <el-select v-model="mapPrintPraram.scaleStyle" size="small" placeholder="选择比例尺样式" style="width:100%">
|
|
|
- <el-option label="line" value="LINE"></el-option>
|
|
|
- <el-option label="bar" value="BAR"></el-option>
|
|
|
- <!-- <el-option label="bar_sub" value="BAR_SUB"></el-option> -->
|
|
|
- </el-select>
|
|
|
- </el-col>
|
|
|
- </el-row>
|
|
|
- </el-col>
|
|
|
- <el-col :span="24">
|
|
|
- <el-row>
|
|
|
- <el-col :span="5">段数:</el-col>
|
|
|
- <el-col :span="19">
|
|
|
- <el-input v-model="mapPrintPraram.intervals" size="small" placeholder="输入比例尺段数"></el-input>
|
|
|
- </el-col>
|
|
|
- </el-row>
|
|
|
- </el-col>
|
|
|
- <el-col :span="24">
|
|
|
- <el-row>
|
|
|
- <el-col :span="5">单位:</el-col>
|
|
|
- <el-col :span="19">
|
|
|
- <el-select v-model="mapPrintPraram.scaleUnit" size="small" placeholder="选择比例尺单位" style="width:100%">
|
|
|
- <el-option label="米" value="METER"></el-option>
|
|
|
- <!-- <el-option label="英里" value="FOOT"></el-option>
|
|
|
+ <div class="panel-container">
|
|
|
+ <div class="op-box">
|
|
|
+ <el-form label-width="auto">
|
|
|
+ <div class="item-head" style="margin-top:0">基本信息</div>
|
|
|
+ <el-form-item label="打印图层" style="margin:0">
|
|
|
+ <el-select v-model="selectLayers" multiple value-key="layerUrl" size="small" placeholder="选择打印图层" @change="selectLayer"
|
|
|
+ style="width:100%">
|
|
|
+ <el-option-group v-for="group in layersOptions" :key="group.label" :label="group.label">
|
|
|
+ <el-option v-for="item in group.options" :key="item.layerUrl" :label="item.label" :value="item"></el-option>
|
|
|
+ </el-option-group>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="布局模板">
|
|
|
+ <el-select v-model="mapPrintPraram.template" size="small" placeholder="选择打印模板" style="width:100%">
|
|
|
+ <el-option v-for="(item,index) in printTemplates" :key="index" :label="item" :value="item"></el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="标题">
|
|
|
+ <el-input v-model="mapPrintPraram.title" size="small" placeholder="输入地图标题"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="副标题">
|
|
|
+ <el-input v-model="mapPrintPraram.subTitle" size="small" placeholder="输入地图副标题"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="版权信息">
|
|
|
+ <el-input v-model="mapPrintPraram.copyrightInfo" size="small" placeholder="输入版权信息"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="作者">
|
|
|
+ <el-input v-model="mapPrintPraram.author" size="small" placeholder="输入作者名称"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ <div class="item-head">比例尺</div>
|
|
|
+ <el-form-item label="文本">
|
|
|
+ <el-input v-model="mapPrintPraram.scaleText" size="small" placeholder="输入比例尺文本"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="样式">
|
|
|
+ <el-select v-model="mapPrintPraram.scaleStyle" size="small" placeholder="选择比例尺样式" style="width:100%">
|
|
|
+ <el-option label="线状(line)" value="LINE"></el-option>
|
|
|
+ <el-option label="条状(bar)" value="BAR"></el-option>
|
|
|
+ <!-- <el-option label="bar_sub" value="BAR_SUB"></el-option> -->
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="段数">
|
|
|
+ <!-- <el-input v-model="mapPrintPraram.intervals" size="small" placeholder="输入比例尺段数"></el-input> -->
|
|
|
+ <el-input-number size="small" v-model="mapPrintPraram.intervals" placeholder="输入比例尺段数" controls-position="right" :step="1"
|
|
|
+ :min="3" :max="10" style="width:100%" @blur="intervalsChange"></el-input-number>
|
|
|
+ </el-input-number>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="单位">
|
|
|
+ <el-select v-model="mapPrintPraram.scaleUnit" size="small" placeholder="选择比例尺单位" style="width:100%">
|
|
|
+ <el-option label="米" value="METER"></el-option>
|
|
|
+ <!-- <el-option label="英里" value="FOOT"></el-option>
|
|
|
<el-option label="度" value="DEGREES"></el-option> -->
|
|
|
- </el-select>
|
|
|
- </el-col>
|
|
|
- </el-row>
|
|
|
- </el-col>
|
|
|
- </el-row>
|
|
|
- </el-collapse-item>
|
|
|
- <el-collapse-item title="导出选项" name="4">
|
|
|
- <el-row>
|
|
|
- <el-col :span="24">
|
|
|
- <el-row>
|
|
|
- <el-col :span="5">格式:</el-col>
|
|
|
- <el-col :span="19">
|
|
|
- <el-select v-model="mapPrintPraram.exportFormat" size="small" placeholder="选择导出格式" style="width:100%">
|
|
|
- <el-option label="PDF" value="PDF"></el-option>
|
|
|
- <el-option label="PNG" value="PNG"></el-option>
|
|
|
- </el-select>
|
|
|
- </el-col>
|
|
|
- </el-row>
|
|
|
- </el-col>
|
|
|
- <el-col :span="24">
|
|
|
- <el-row>
|
|
|
- <el-col :span="5">DPI:</el-col>
|
|
|
- <el-col :span="19">
|
|
|
- <el-input v-model="mapPrintPraram.exportDpi" size="small" placeholder="输入分辩率"></el-input>
|
|
|
- </el-col>
|
|
|
- </el-row>
|
|
|
- </el-col>
|
|
|
- <el-col :span="24">
|
|
|
- <el-row>
|
|
|
- <el-col :span="5">比例尺:</el-col>
|
|
|
- <el-col :span="19">
|
|
|
- <el-input v-model="mapPrintPraram.exportScale" size="small" placeholder="导出比例尺" :readonly="true"></el-input>
|
|
|
- </el-col>
|
|
|
- </el-row>
|
|
|
- </el-col>
|
|
|
- </el-row>
|
|
|
- </el-collapse-item>
|
|
|
- </el-collapse>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <div class="item-head">导出选项</div>
|
|
|
+ <el-form-item label="格式">
|
|
|
+ <el-select v-model="mapPrintPraram.exportFormat" size="small" placeholder="选择导出格式" style="width:100%">
|
|
|
+ <el-option label="PDF" value="PDF"></el-option>
|
|
|
+ <el-option label="PNG" value="PNG"></el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="分辨率">
|
|
|
+ <!-- <el-input v-model="mapPrintPraram.exportDpi" size="small" placeholder="输入分辩率"></el-input> -->
|
|
|
+ <el-input-number size="small" v-model="mapPrintPraram.exportDpi" placeholder="输入分辩率" controls-position="right" :step="10"
|
|
|
+ :min="96" :max="496" style="width:100%" @blur="dpiChange"></el-input-number>
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
</div>
|
|
|
- <div class="print-button">
|
|
|
+ <div class="op-box">
|
|
|
<el-button type="primary" style="width:100%" size="small" @click="printMap" :loading="printStatus">
|
|
|
<span v-if="printStatus==false">打印</span>
|
|
|
<span v-else>正在打印中…</span>
|
|
@@ -253,7 +161,8 @@ export default {
|
|
|
// 获取打印模板信息
|
|
|
this.webPrintingJobService.getLayoutTemplates(e => {
|
|
|
e.result.forEach(item => {
|
|
|
- this.printTemplates.push(item.templateName)
|
|
|
+ if (item.templateName != 'A4_landscape_v2' && item.templateName != 'A3_mapcornermarks')
|
|
|
+ this.printTemplates.push(item.templateName)
|
|
|
})
|
|
|
})
|
|
|
// 初始化图层选项
|
|
@@ -280,7 +189,7 @@ export default {
|
|
|
*/
|
|
|
printMap() {
|
|
|
this.printStatus = true // 执行状态
|
|
|
- console.log("参数:", this.mapPrintPraram)
|
|
|
+ console.log("参数:", this.mapPrintPraram.mapCenterPoint)
|
|
|
let params = new SuperMap.WebPrintingJobParameters({
|
|
|
"layoutOptions": {
|
|
|
"templateName": this.mapPrintPraram.template,
|
|
@@ -302,7 +211,10 @@ export default {
|
|
|
"customItems": this.mapPrintPraram.legendItems
|
|
|
},
|
|
|
"littleMapOptions": {
|
|
|
- "center": { "x": this.mapPrintPraram.mapCenterPoint.split(',')[0], "y": this.mapPrintPraram.mapCenterPoint.split(',')[1] },
|
|
|
+ "center": {
|
|
|
+ "x": this.mapPrintPraram.mapCenterPoint.split(',')[0],
|
|
|
+ "y": this.mapPrintPraram.mapCenterPoint.split(',')[1]
|
|
|
+ },
|
|
|
// "scale": this.mapPrintPraram.scale,
|
|
|
"layers": this.mapPrintPraram.layers
|
|
|
}
|
|
@@ -316,7 +228,10 @@ export default {
|
|
|
"value": {
|
|
|
"maxScale": "1:144447.927",
|
|
|
"level": this.mapPrintPraram.zoom,
|
|
|
- "center": { "x": this.mapPrintPraram.mapCenterPoint.split(',')[0], "y": this.mapPrintPraram.mapCenterPoint.split(',')[1] },
|
|
|
+ "center": {
|
|
|
+ "x": this.mapPrintPraram.mapCenterPoint.split(',')[0],
|
|
|
+ "y": this.mapPrintPraram.mapCenterPoint.split(',')[1]
|
|
|
+ },
|
|
|
"layers": this.mapPrintPraram.layers,
|
|
|
"description": "",
|
|
|
"projection": "EPSG:4326",
|
|
@@ -327,6 +242,7 @@ export default {
|
|
|
}
|
|
|
|
|
|
})
|
|
|
+ console.log("校验参数", params)
|
|
|
//校验参数
|
|
|
this.filterEmptyData(params)
|
|
|
|
|
@@ -367,45 +283,27 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * 比例尺段数
|
|
|
+ */
|
|
|
+ intervalsChange() {
|
|
|
+ if (!this.mapPrintPraram.intervals) {
|
|
|
+ this.mapPrintPraram.intervals = 3
|
|
|
+ }
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * dpi分辨率
|
|
|
+ */
|
|
|
+ dpiChange(val, oldVal) {
|
|
|
+ if (!this.mapPrintPraram.exportDpi) {
|
|
|
+ this.mapPrintPraram.exportDpi = 96
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
-.print-container {
|
|
|
- width: 100%;
|
|
|
- height: 100%;
|
|
|
- box-sizing: border-box;
|
|
|
- padding: 10px !important;
|
|
|
- .print-setting {
|
|
|
- width: 100%;
|
|
|
- height: 90%;
|
|
|
- overflow-y: auto;
|
|
|
- >>> .el-collapse-item__header {
|
|
|
- font-size: 14px;
|
|
|
- font-weight: 600;
|
|
|
- }
|
|
|
- >>> .el-collapse-item__content {
|
|
|
- padding-bottom: 0px !important;
|
|
|
- }
|
|
|
- >>> .el-row {
|
|
|
- font-size: 14px;
|
|
|
- font-family: Source Han Sans CN;
|
|
|
- font-weight: 400;
|
|
|
- line-height: 32px;
|
|
|
- margin-bottom: 15px;
|
|
|
- .el-col {
|
|
|
- text-align: right;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- .print-button {
|
|
|
- width: 100%;
|
|
|
- height: 10%;
|
|
|
- >>> .el-button {
|
|
|
- margin-top: 10px;
|
|
|
- }
|
|
|
- }
|
|
|
-}
|
|
|
+@import './css.scss';
|
|
|
</style>
|