bug
This commit is contained in:
parent
fa71d15e1e
commit
834020e7e8
10
src/views/components/map/api.js
Normal file
10
src/views/components/map/api.js
Normal file
@ -0,0 +1,10 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 查询省市区详细
|
||||
export function getClient() {
|
||||
return request({
|
||||
url: '/province/region/tree',
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
224
src/views/components/map/mapComponent.vue
Normal file
224
src/views/components/map/mapComponent.vue
Normal file
@ -0,0 +1,224 @@
|
||||
<template>
|
||||
<div>
|
||||
<div style="margin: 20px 0px" ref="pform">
|
||||
<div style="display: flex">
|
||||
<p style="margin-right: 34px">省市区</p>
|
||||
<el-cascader
|
||||
v-model="inputInfo"
|
||||
:options="options"
|
||||
clearable
|
||||
style="margin-top: 8px"
|
||||
@change="changeOption"></el-cascader>
|
||||
</div>
|
||||
<div style="display: flex">
|
||||
<p style="margin-right: 20px;">选择区域</p>
|
||||
<div id="container" class="container" clearable style="margin-top: 15px"></div>
|
||||
</div>
|
||||
</div>
|
||||
<p>详细地址:<el-input v-model="form.address"
|
||||
placeholder="请输入内容"
|
||||
style="width: 50%"
|
||||
@change="getLngLat"
|
||||
></el-input></p>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import AMapLoader from "@amap/amap-jsapi-loader";
|
||||
import {getClient} from "./api";
|
||||
|
||||
export default {
|
||||
props:['pform'],
|
||||
data(){
|
||||
return {
|
||||
// 地图实例
|
||||
map: null,
|
||||
polygons: [],
|
||||
// 标记点
|
||||
marker: "",
|
||||
// 地址逆解析
|
||||
geoCoder: null,
|
||||
// 搜索提示
|
||||
AutoComplete: null,
|
||||
// 搜索关键字
|
||||
keywords: "",
|
||||
// 位置信息
|
||||
form: {
|
||||
lng: "",
|
||||
lat: "",
|
||||
address: "",
|
||||
adcode: "", //地区编码
|
||||
},
|
||||
// 搜索节流阀
|
||||
loading: false,
|
||||
// 搜索提示信息
|
||||
options: [],
|
||||
option:{
|
||||
value:'',
|
||||
label:'',
|
||||
children:[],
|
||||
},
|
||||
district:'',
|
||||
inputInfo:'',
|
||||
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.form = this.pform;
|
||||
this.getOption();
|
||||
},
|
||||
mounted() {
|
||||
},
|
||||
methods:{
|
||||
pasVal(){
|
||||
this.$emit('pform', this.form); // 触发custom-event事件并传递参数
|
||||
// this.$refs.pform.pasVal()
|
||||
},
|
||||
changeOption(val){
|
||||
this.remoteMethod(val[2]);
|
||||
},
|
||||
getOption(){
|
||||
let _this = this;
|
||||
getClient().then(response => {
|
||||
_this.options = response.data.list;
|
||||
})
|
||||
},
|
||||
initAMap() {
|
||||
let _this = this;
|
||||
AMapLoader.load({
|
||||
key: "7cb5679301662c2e8162eec22719b316", // 申请好的Web端开发者Key,首次调用 load 时必填
|
||||
version: "2.0", // 指定要加载的 JSAPI 的版本,缺省时默认为 1.4.15
|
||||
plugins: ["AMap.Geocoder", "AMap.AutoComplete","AMap.DistrictSearch"], // 需要使用的的插件列表,如比例尺'AMap.Scale'等
|
||||
}).then((AMap) => {
|
||||
this.map = new AMap.Map("container", {
|
||||
viewMode: "2D", //是否为3D地图模式
|
||||
zoom: 16, //初始化地图级别
|
||||
center: [_this.form.lng, _this.form.lat], //初始化地图中心点位置
|
||||
});
|
||||
// console.log(this.map.center)
|
||||
//地址逆解析插件
|
||||
this.geoCoder = new AMap.Geocoder({
|
||||
city: "010", //城市设为北京,默认:“全国”
|
||||
radius: 1000, //范围,默认:500
|
||||
});
|
||||
// 搜索提示插件
|
||||
this.AutoComplete = new AMap.AutoComplete({ city: "全国" });
|
||||
//点击获取经纬度;
|
||||
this.map.on("click", (e) => {
|
||||
console.log(e,'108')
|
||||
// 获取经纬度
|
||||
this.form.lng = e.lnglat.lng;
|
||||
this.form.lat = e.lnglat.lat;
|
||||
// 清除点
|
||||
this.removeMarker();
|
||||
// 标记点
|
||||
this.setMapMarker();
|
||||
});
|
||||
}).catch(() => {});
|
||||
},
|
||||
// 标记点
|
||||
setMapMarker() {
|
||||
// 自动适应显示想显示的范围区域
|
||||
this.map.setFitView();
|
||||
this.marker = new AMap.Marker({
|
||||
map: this.map,
|
||||
position: [this.form.lng, this.form.lat],
|
||||
});
|
||||
// 逆解析地址
|
||||
this.toGeoCoder();
|
||||
this.map.setFitView();
|
||||
this.map.add(this.marker);
|
||||
},
|
||||
// 清除点
|
||||
removeMarker() {
|
||||
if (this.marker) {
|
||||
this.map.remove(this.marker);
|
||||
}
|
||||
},
|
||||
// 逆解析地址
|
||||
toGeoCoder() {
|
||||
|
||||
let lnglat = [this.form.lng, this.form.lat];
|
||||
this.geoCoder.getAddress(lnglat, (status, result) => {
|
||||
console.log(status,result,143)
|
||||
if (status === "complete" && result.regeocode) {
|
||||
this.form.address = result.regeocode.formattedAddress;
|
||||
|
||||
this.pasVal()
|
||||
}
|
||||
});
|
||||
},
|
||||
// 搜索
|
||||
remoteMethod(query) {
|
||||
let _this = this;
|
||||
if (query !== "") {
|
||||
this.loading = true;
|
||||
setTimeout(() => {
|
||||
this.loading = false;
|
||||
// this.AutoComplete.search(query, (status, result) => {
|
||||
// console.log(result.tips);
|
||||
// });
|
||||
var opts = {
|
||||
subdistrict: 0, //返回下一级行政区
|
||||
extensions: "all", //返回行政区边界坐标组等具体信息
|
||||
level: "city" //查询行政级别为 市
|
||||
};
|
||||
this.district = new AMap.DistrictSearch(opts); //行政区查询插件
|
||||
//进入就显示整个国家范围
|
||||
this.district.search(query, function(status, result) {
|
||||
_this.form.lng = result.districtList[0].center.lng
|
||||
_this.form.lat = result.districtList[0].center.lat
|
||||
_this.toGeoCoder();
|
||||
_this.pasVal();
|
||||
_this.initAMap();
|
||||
});
|
||||
}, 200);
|
||||
} else {
|
||||
// this.form = this.pform;
|
||||
this.initAMap();
|
||||
}
|
||||
},
|
||||
getLngLat(){
|
||||
let _this = this;
|
||||
const geocoder = new AMap.Geocoder()
|
||||
// 地址反向查经纬度,cName: 当前选中城市
|
||||
geocoder.getLocation(this.form.address, (status, result) => {
|
||||
if (status === 'complete' && result.info === 'OK') {
|
||||
// 经纬度
|
||||
_this.form.lng = result.geocodes[0].location.lng
|
||||
_this.form.lat = result.geocodes[0].location.lat
|
||||
_this.toGeoCoder();
|
||||
_this.pasVal();
|
||||
_this.initAMap();
|
||||
} else {
|
||||
this.$modal.msgError("定位失败");
|
||||
}
|
||||
})
|
||||
},
|
||||
// 选中提示
|
||||
currentSelect(val) {
|
||||
// 清空时不执行后面代码
|
||||
if (!val) {
|
||||
return;
|
||||
}
|
||||
this.form = {
|
||||
lng: val.location.lng,
|
||||
lat: val.location.lat,
|
||||
address: val.district + val.address,
|
||||
adcode: val.adcode,
|
||||
};
|
||||
// 清除点
|
||||
this.removeMarker();
|
||||
// 标记点
|
||||
this.setMapMarker();
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.container {
|
||||
width: 500px;
|
||||
height: 300px;
|
||||
}
|
||||
</style>
|
@ -112,9 +112,11 @@
|
||||
|
||||
<script>
|
||||
import { listDynamic, getDynamic, delDynamic, addDynamic, updateDynamic } from "./api/dynamic";
|
||||
import editor from '@/components/Editor/index.vue'
|
||||
|
||||
export default {
|
||||
name: "Dynamic",
|
||||
components: {editor},
|
||||
data() {
|
||||
return {
|
||||
viewContent:"",
|
||||
|
@ -53,7 +53,7 @@
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="类型" align="center" prop="fileType">
|
||||
<template slot-scope="scope">
|
||||
<dict-tag ::type="DICT_TYPE.File_type" :value="scope.row.fileType"/>
|
||||
<dict-tag :type="DICT_TYPE.File_type" :value="scope.row.fileType"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="上传PDF" align="center" prop="fileAddress" />
|
||||
|
@ -103,9 +103,10 @@
|
||||
|
||||
<script>
|
||||
import { listNews, getNews, delNews, addNews, updateNews } from "./api/news";
|
||||
|
||||
import editor from '@/components/Editor/index.vue'
|
||||
export default {
|
||||
name: "News",
|
||||
components: {editor},
|
||||
data() {
|
||||
return {
|
||||
viewContent:"",
|
||||
|
@ -0,0 +1,52 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 查询驾校信息列表
|
||||
export function listSchoolInfo(query) {
|
||||
return request({
|
||||
url: '/drivingSchool/system/schoolInfo/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询驾校信息详细
|
||||
export function getSchoolInfo(id) {
|
||||
return request({
|
||||
url: '/drivingSchool/system/schoolInfo/' + id,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 根据机构id查询驾校信息详细
|
||||
export function getSchoolInfoByDeptId() {
|
||||
return request({
|
||||
url: '/drivingSchool/system/schoolInfo/getSchoolInfoByDeptId',
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 新增驾校信息
|
||||
export function addSchoolInfo(data) {
|
||||
return request({
|
||||
url: '/drivingSchool/system/schoolInfo',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改驾校信息
|
||||
export function updateSchoolInfo(data) {
|
||||
return request({
|
||||
url: '/drivingSchool/system/schoolInfo',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除驾校信息
|
||||
export function delSchoolInfo(id) {
|
||||
return request({
|
||||
url: '/drivingSchool/system/schoolInfo/' + id,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
307
src/views/drivingSchool/schoolInfoConfig/index.vue
Normal file
307
src/views/drivingSchool/schoolInfoConfig/index.vue
Normal file
@ -0,0 +1,307 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="120px">
|
||||
<el-form-item label="驾校名称" prop="schoolName">
|
||||
<el-input v-model="form.schoolName" placeholder="请输入驾校名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="驾校封面图" prop="photo">
|
||||
<image-upload v-model="form.photo"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="营业开始时间" prop="businessStartTime">
|
||||
<el-time-select
|
||||
placeholder="起始时间"
|
||||
v-model="form.businessStartTime"
|
||||
:picker-options="{
|
||||
start: '08:30',
|
||||
step: '00:15',
|
||||
end: '18:30'
|
||||
}">
|
||||
</el-time-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="营业结束时间" prop="businessEndTime">
|
||||
<el-time-select
|
||||
placeholder="结束时间"
|
||||
v-model="form.businessEndTime"
|
||||
:picker-options="{
|
||||
start: '08:30',
|
||||
step: '00:15',
|
||||
end: '18:30',
|
||||
minTime: businessStartTime
|
||||
}">
|
||||
</el-time-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="驾校负责人" prop="leaderName">
|
||||
<el-input v-model="form.leaderName" placeholder="请输入驾校负责人" />
|
||||
</el-form-item>
|
||||
<el-form-item label="联系方式" prop="phone">
|
||||
<el-input v-model="form.phone" placeholder="请输入联系方式" />
|
||||
</el-form-item>
|
||||
<map-componment style="margin-left: 35px" :pform="mapForm" ref="mapRef" @pform="getForm"></map-componment>
|
||||
<!-- <p>详细地址:<el-input v-model="form.address"-->
|
||||
<!-- placeholder="请输入内容"-->
|
||||
<!-- style="width: 50%"-->
|
||||
<!-- @change="getLngLat"-->
|
||||
<!-- ></el-input></p>-->
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="yesitis">确 定</el-button>
|
||||
</div>
|
||||
<!-- 添加或修改电梯品牌对话框 -->
|
||||
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
|
||||
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
listSchoolInfo,
|
||||
getSchoolInfo,
|
||||
delSchoolInfo,
|
||||
addSchoolInfo,
|
||||
updateSchoolInfo,
|
||||
getSchoolInfoByDeptId
|
||||
} from "./api/schoolInfoConfig";
|
||||
import mapComponment from "@/views/components/map/mapComponent.vue";
|
||||
export default {
|
||||
props:['pform'],
|
||||
name: "schoolInfoConfig",
|
||||
components:{
|
||||
mapComponment
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
// 位置信息
|
||||
mapForm: {
|
||||
lng: "116.9645",
|
||||
lat: "36.975",
|
||||
address: "",
|
||||
adcode: "", //地区编码
|
||||
},
|
||||
businessStartTime: null,
|
||||
businessEndTime: null,
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 选中数组
|
||||
ids: [],
|
||||
// 非单个禁用
|
||||
single: true,
|
||||
// 非多个禁用
|
||||
multiple: true,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 驾校信息表格数据
|
||||
schoolInfoList: [],
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
deptId: null,
|
||||
schoolName: null,
|
||||
input: null,
|
||||
sort: null,
|
||||
phone: null,
|
||||
region: this.$refs.mapRef?.inputInfo,
|
||||
photo: null,
|
||||
address: null,
|
||||
businessStartTime: null,
|
||||
businessEndTime: null,
|
||||
},
|
||||
// 表单参数
|
||||
form: {
|
||||
businessStartTime: null,
|
||||
businessEndTime: null,
|
||||
},
|
||||
// 表单校验
|
||||
rules: {
|
||||
schoolName: [
|
||||
{ required: true, message: "驾校名称不能为空", trigger: "blur" }
|
||||
],
|
||||
phone: [
|
||||
{ required: true, message: "联系方式不能为空", trigger: "blur" },
|
||||
],
|
||||
leaderName: [
|
||||
{ required: true, message: "驾校负责人不能为空", trigger: "blur" }
|
||||
],
|
||||
sort: [
|
||||
{ required: true, message: "显示排序不能为空", trigger: "blur" }
|
||||
],
|
||||
}
|
||||
};
|
||||
},
|
||||
|
||||
created() {
|
||||
this.getList();
|
||||
},
|
||||
mounted() {
|
||||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
busChange(data){
|
||||
console.log(data,'业务变化')
|
||||
//处理新增
|
||||
for (let i = 0; i < data.length; i++) {
|
||||
let flag ='0'
|
||||
for (let j = 0; j < this.form.priceDtoList.length; j++) {
|
||||
if (data[i]== this.form.priceDtoList[j].serviceId){
|
||||
flag = '1'
|
||||
}
|
||||
}
|
||||
if (flag=='0'){
|
||||
console.log(data[i],i,'199')
|
||||
//就需要追加进去这个业务
|
||||
this.elevTypeDict.forEach(it=>{
|
||||
if (it.dictValue==data[i]){
|
||||
let item ={
|
||||
serviceId:it.dictValue,
|
||||
serviceName:it.dictLabel,
|
||||
priceStart:0,
|
||||
priceEnd:0
|
||||
}
|
||||
this.form.priceDtoList.push(item)
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
}
|
||||
//处理删除
|
||||
for (let i = 0; i < this.form.priceDtoList.length; i++) {
|
||||
let flag = '0'
|
||||
for (let j = 0; j < data.length; j++) {
|
||||
if (data[i] == this.form.priceDtoList[j].serviceId) {
|
||||
flag = '1'
|
||||
}
|
||||
}
|
||||
if (flag=='0'){
|
||||
//就删除这个业务
|
||||
|
||||
this.form.priceDtoList.splice(i,1)
|
||||
}
|
||||
}
|
||||
},
|
||||
getForm(data){
|
||||
|
||||
if (data != undefined){
|
||||
this.mapForm = data;
|
||||
|
||||
this.form.address = this.mapForm.address
|
||||
this.form.lgt = this.mapForm.lng
|
||||
this.form.lat = this.mapForm.lat
|
||||
}
|
||||
},
|
||||
/** 查询电梯品牌列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
getSchoolInfoByDeptId().then(res => {
|
||||
if (res.data){
|
||||
this.form = res.data;
|
||||
this.mapForm.lat = this.form.lat;
|
||||
this.mapForm.lng = this.form.lgt;
|
||||
this.mapForm.address = this.form.address;
|
||||
}
|
||||
this.$refs.mapRef.initAMap();
|
||||
console.log(this.mapForm)
|
||||
this.loading = false;
|
||||
})
|
||||
},
|
||||
async yesitis(){
|
||||
this.form.region = String(this.$refs.mapRef.inputInfo)
|
||||
// this.form.region = this.$refs.mapRef.inputInfo.repeat(/\[|]/g,'')
|
||||
|
||||
await updateSchoolInfo(this.form).then(res=>{
|
||||
this.$modal.msgSuccess("保存成功");
|
||||
this.getList()
|
||||
})
|
||||
|
||||
},
|
||||
// 取消按钮
|
||||
cancel() {
|
||||
this.open = false;
|
||||
this.reset();
|
||||
},
|
||||
// 表单重置
|
||||
reset() {
|
||||
this.form = {
|
||||
id: null,
|
||||
deptId: null,
|
||||
schoolName: null,
|
||||
leaderName: null,
|
||||
phone: null,
|
||||
photo: null,
|
||||
region: this.$refs.mapRef.inputInfo,
|
||||
address: null,
|
||||
lat: null,
|
||||
lgt: null,
|
||||
businessStartTime: null,
|
||||
businessEndTime: null,
|
||||
createTime: null,
|
||||
createBy: null,
|
||||
updateTime: null,
|
||||
updateBy: null
|
||||
};
|
||||
this.resetForm("form");
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNum = 1;
|
||||
this.getList();
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.resetForm("queryForm");
|
||||
this.handleQuery();
|
||||
},
|
||||
// 多选框选中数据
|
||||
handleSelectionChange(selection) {
|
||||
this.ids = selection.map(item => item.id)
|
||||
this.single = selection.length!==1
|
||||
this.multiple = !selection.length
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
this.reset();
|
||||
const id = row.id || this.ids
|
||||
getElevBrand(id).then(response => {
|
||||
this.form = response.data;
|
||||
this.open = true;
|
||||
this.title = "修改电梯品牌";
|
||||
});
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm() {
|
||||
this.$refs["form"].validate(valid => {
|
||||
if (valid) {
|
||||
if (!this.form.lat){
|
||||
this.$message.warning("请选择位置信息")
|
||||
return
|
||||
}
|
||||
if (!this.form.brandAdress){
|
||||
this.$message.warning("请填写详细位置")
|
||||
return
|
||||
}
|
||||
if (this.form.id != null) {
|
||||
updateElevBrand(this.form).then(response => {
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
} else {
|
||||
addElevBrand(this.form).then(response => {
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
Loading…
Reference in New Issue
Block a user