功能优化
This commit is contained in:
parent
efbb633d10
commit
bf95e96325
|
|
@ -8,9 +8,9 @@
|
|||
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
|
||||
<title><%= webpackConfig.name %></title>
|
||||
<!--[if lt IE 11]><script>window.location.href='/html/ie.html';</script><![endif]-->
|
||||
<script async src="https://api.map.baidu.com/api?v=2.0&ak=cClgLBaLgGUdQDilX9dGvieL"></script>
|
||||
<script src="https://api.map.baidu.com/api?type=webgl&v=2.0&ak=cClgLBaLgGUdQDilX9dGvieL"></script>
|
||||
<script type="text/javascript" src="//api.map.baidu.com/library/TrackAnimation/src/TrackAnimation_min.js"></script>
|
||||
<!-- <script async src="https://api.map.baidu.com/api?v=2.0&ak=cClgLBaLgGUdQDilX9dGvieL"></script>-->
|
||||
<!-- <script src="https://api.map.baidu.com/api?type=webgl&v=2.0&ak=cClgLBaLgGUdQDilX9dGvieL"></script>-->
|
||||
<!-- <script type="text/javascript" src="//api.map.baidu.com/library/TrackAnimation/src/TrackAnimation_min.js"></script>-->
|
||||
<style>
|
||||
html,
|
||||
body,
|
||||
|
|
|
|||
|
|
@ -35,13 +35,13 @@
|
|||
>新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport"
|
||||
>导出</el-button>
|
||||
</el-col>
|
||||
<el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport"
|
||||
>导出</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="info" plain icon="el-icon-upload2" size="mini" @click="handleImport" v-hasPermi="['system:org:import']"
|
||||
>导入</el-button>
|
||||
</el-col>
|
||||
<el-button type="info" plain icon="el-icon-upload2" size="mini" @click="handleImport" v-hasPermi="['system:org:import']"
|
||||
>导入</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="info"
|
||||
|
|
@ -105,36 +105,6 @@
|
|||
|
||||
<!-- 添加或修改部门对话框 -->
|
||||
<el-dialog :title="title" :visible.sync="open" width="600px" append-to-body>
|
||||
|
||||
<!-- 内层对话框 选择地图 -->
|
||||
<el-dialog
|
||||
width="70%"
|
||||
title="选择地图"
|
||||
:visible.sync="innerVisible"
|
||||
v-if="innerVisible"
|
||||
append-to-body
|
||||
>
|
||||
<el-row class="search-container">
|
||||
<el-input
|
||||
clearable
|
||||
placeholder="请输入地址"
|
||||
v-model="searchAddress"
|
||||
@keyup.enter.native="onSearchAddress"
|
||||
/>
|
||||
<el-button
|
||||
type="primary"
|
||||
style="width: 120px"
|
||||
@click="onSearchAddress"
|
||||
>搜索</el-button
|
||||
>
|
||||
</el-row>
|
||||
<div
|
||||
id="map-container"
|
||||
style="height: 550px; background-color: #bfc"
|
||||
>
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="100px">
|
||||
<el-row>
|
||||
<el-col :span="24" v-if="form.parentId !== 0">
|
||||
|
|
@ -222,23 +192,8 @@
|
|||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="24">
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="handleProjectAddress"
|
||||
>选择位置</el-button>
|
||||
</el-form-item>
|
||||
<el-form-item label="经度" prop="lon">
|
||||
<el-input disabled v-model="form.lon" />
|
||||
</el-form-item>
|
||||
<el-form-item label="纬度" prop="lat">
|
||||
<el-input disabled v-model="form.lat" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="位置" prop="address">
|
||||
<el-input
|
||||
v-model="form.address"
|
||||
disabled
|
||||
style="width: 60%"
|
||||
/>
|
||||
<el-input v-model="form.address" placeholder="请输入位置" maxlength="50"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
|
@ -253,8 +208,8 @@
|
|||
<!-- 导入对话框 -->
|
||||
<el-dialog :title="upload.title" :visible.sync="upload.open" width="400px" append-to-body>
|
||||
<el-upload ref="upload" :limit="1" accept=".xlsx, .xls" :headers="upload.headers"
|
||||
:action="upload.url + '?updateSupport=' + upload.updateSupport" :disabled="upload.isUploading"
|
||||
:on-progress="handleFileUploadProgress" :on-success="handleFileSuccess" :auto-upload="false" drag>
|
||||
:action="upload.url + '?updateSupport=' + upload.updateSupport" :disabled="upload.isUploading"
|
||||
:on-progress="handleFileUploadProgress" :on-success="handleFileSuccess" :auto-upload="false" drag>
|
||||
<i class="el-icon-upload"></i>
|
||||
<div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
|
||||
<div class="el-upload__tip text-center" slot="tip">
|
||||
|
|
@ -263,7 +218,7 @@
|
|||
</div> -->
|
||||
<span>仅允许导入xls、xlsx格式文件。</span>
|
||||
<el-link type="primary" :underline="false" style="font-size:12px;vertical-align: baseline;"
|
||||
@click="importTemplate">下载模板</el-link>
|
||||
@click="importTemplate">下载模板</el-link>
|
||||
</div>
|
||||
</el-upload>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
|
|
@ -289,9 +244,6 @@ export default {
|
|||
components: { Treeselect },
|
||||
data() {
|
||||
return {
|
||||
innerVisible: false,
|
||||
map: null,
|
||||
searchAddress: '',
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 显示搜索条件
|
||||
|
|
@ -318,37 +270,33 @@ export default {
|
|||
isDepartmentList:[{id:'0',name:'否'},{id:'1',name:'是'}],
|
||||
provinceList:["北京","上海","天津","重庆","河北","山西","内蒙古","辽宁","吉林","黑龙江","江苏","浙江","安徽","福建","江西","山东","河南","湖北","湖南","广东","广西","海南","四川","贵州","云南","西藏","陕西","甘肃","宁夏","青海","新疆","香港","澳门","台湾"],
|
||||
// 表单参数
|
||||
form: {
|
||||
lon: '',
|
||||
lat: '',
|
||||
address: '',
|
||||
},
|
||||
form: {},
|
||||
// 表单校验
|
||||
rules: {
|
||||
parentId: [
|
||||
{ required: true, message: "上级部门不能为空", trigger: "blur" }
|
||||
],
|
||||
orgName: [
|
||||
{ required: true, message: "部门名称不能为空", trigger: "blur" }
|
||||
],
|
||||
orgHeadUserIdList: [
|
||||
{ required: true, message: "部门负责人不能为空", trigger: "blur" }
|
||||
],
|
||||
attendanceUserId: [
|
||||
{ required: true, message: "考勤员不能为空", trigger: "blur" }
|
||||
],
|
||||
province: [
|
||||
{ required: true, message: "省份不能为空", trigger: "blur" }
|
||||
],
|
||||
isProvince: [
|
||||
{ required: true, message: "省内外不能为空", trigger: "blur" }
|
||||
],
|
||||
isDepartment: [
|
||||
{ required: true, message: "是否项目部不能为空", trigger: "blur" }
|
||||
],
|
||||
address: [
|
||||
{ required: true, message: "位置不能为空", trigger: "blur" }
|
||||
]
|
||||
parentId: [
|
||||
{ required: true, message: "上级部门不能为空", trigger: "blur" }
|
||||
],
|
||||
orgName: [
|
||||
{ required: true, message: "部门名称不能为空", trigger: "blur" }
|
||||
],
|
||||
orgHeadUserIdList: [
|
||||
{ required: true, message: "部门负责人不能为空", trigger: "blur" }
|
||||
],
|
||||
attendanceUserId: [
|
||||
{ required: true, message: "考勤员不能为空", trigger: "blur" }
|
||||
],
|
||||
province: [
|
||||
{ required: true, message: "省份不能为空", trigger: "blur" }
|
||||
],
|
||||
isProvince: [
|
||||
{ required: true, message: "省内外不能为空", trigger: "blur" }
|
||||
],
|
||||
isDepartment: [
|
||||
{ required: true, message: "是否项目部不能为空", trigger: "blur" }
|
||||
],
|
||||
address: [
|
||||
{ required: true, message: "位置不能为空", trigger: "blur" }
|
||||
]
|
||||
},
|
||||
// 导入参数
|
||||
upload: {
|
||||
|
|
@ -499,8 +447,8 @@ export default {
|
|||
/** 导出按钮操作 */
|
||||
handleExport() {
|
||||
exportOrg(this.queryParams).then(res => {
|
||||
downloadFile({ fileName: `组织架构_${new Date().getTime()}.xlsx`, fileData: res, fileType: 'application/vnd.ms-excel;charset=utf-8' })
|
||||
})
|
||||
downloadFile({ fileName: `组织架构_${new Date().getTime()}.xlsx`, fileData: res, fileType: 'application/vnd.ms-excel;charset=utf-8' })
|
||||
})
|
||||
},
|
||||
/** 导入按钮操作 */
|
||||
handleImport() {
|
||||
|
|
@ -528,89 +476,7 @@ export default {
|
|||
// 提交上传文件
|
||||
submitFileForm() {
|
||||
this.$refs.upload.submit();
|
||||
},
|
||||
/** 选择工程地址 */
|
||||
handleProjectAddress() {
|
||||
const this_ = this;
|
||||
this.searchAddress = '';
|
||||
this.innerVisible = true;
|
||||
|
||||
this.$nextTick(() => {
|
||||
this_.map = new BMapGL.Map('map-container'); // 创建地图实例
|
||||
let point;
|
||||
if (this_.form.lon != null && this_.form.lon !== '' && this_.form.lat != null && this_.form.lat !== '') {
|
||||
console.log(this_.form.lat, this_.form.lon);
|
||||
point = new BMapGL.Point(this_.form.lon, this_.form.lat);
|
||||
let marker = new BMapGL.Marker(point); // 创建标点
|
||||
this_.map.addOverlay(marker);
|
||||
} else {
|
||||
point = new BMapGL.Point(117.13805, 31.8734); // 创建点坐标
|
||||
}
|
||||
|
||||
this_.map.centerAndZoom(point, 12); // 初始化地图,设置中心点坐标和地图级别
|
||||
this_.map.enableScrollWheelZoom(true); // 启用滚轮放大缩小
|
||||
|
||||
// 禁用不必要的功能
|
||||
// this_.map.disableDragging(); // 禁用拖拽
|
||||
this_.map.disableDoubleClickZoom(); // 禁用双击缩放
|
||||
this_.map.disablePinchToZoom(); // 禁用多点触控缩放
|
||||
this_.map.disableKeyboard(); // 禁用键盘操作
|
||||
|
||||
var geoc = new BMapGL.Geocoder();
|
||||
|
||||
this_.map.addEventListener('click', function (e) {
|
||||
var pt = e.latlng;
|
||||
geoc.getLocation(pt, function (res) {
|
||||
var addComp = res.addressComponents;
|
||||
this_.form.address = `${addComp.province}${addComp.city}${addComp.district}${addComp.street}${addComp.streetNumber}`;
|
||||
this_.form.lon = e.latlng.lng;
|
||||
this_.form.lat = e.latlng.lat;
|
||||
});
|
||||
this_.map.clearOverlays();
|
||||
point = new BMapGL.Point(e.latlng.lng, e.latlng.lat);
|
||||
let marker = new BMapGL.Marker(point); // 创建标点
|
||||
this_.map.addOverlay(marker);
|
||||
});
|
||||
});
|
||||
},
|
||||
/* 搜索 */
|
||||
onSearchAddress() {
|
||||
|
||||
// 创建地址
|
||||
const myGeo = new BMapGL.Geocoder()
|
||||
const _this = this
|
||||
myGeo.getPoint(
|
||||
this.searchAddress,
|
||||
function (point) {
|
||||
if (point) {
|
||||
_this.map.clearOverlays()
|
||||
const { lng, lat } = point
|
||||
|
||||
_this.map.centerAndZoom(point, 16)
|
||||
_this.map.addOverlay(
|
||||
new BMapGL.Marker(point, {
|
||||
title: _this.searchAddress,
|
||||
}),
|
||||
)
|
||||
// 根据坐标得到地址描述
|
||||
myGeo.getLocation(
|
||||
new BMapGL.Point(lng, lat),
|
||||
function (result) {
|
||||
if (result) {
|
||||
let addComp = result.addressComponents
|
||||
_this.form.address = `${addComp.province}${addComp.city}${addComp.district}${addComp.street}${addComp.streetNumber}`
|
||||
_this.form.lon = lng
|
||||
_this.form.lat = lat
|
||||
}
|
||||
},
|
||||
)
|
||||
} else {
|
||||
this.$message.error('您输入的地址有误,请重新输入')
|
||||
}
|
||||
},
|
||||
'中国',
|
||||
)
|
||||
},
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
|
|
|||
Loading…
Reference in New Issue