This commit is contained in:
赵旭 2024-08-29 22:20:40 +08:00
parent fa71d15e1e
commit 834020e7e8
7 changed files with 598 additions and 2 deletions

View File

@ -0,0 +1,10 @@
import request from '@/utils/request'
// 查询省市区详细
export function getClient() {
return request({
url: '/province/region/tree',
method: 'get'
})
}

View 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", // WebKey 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>

View File

@ -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:"",

View File

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

View File

@ -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:"",

View File

@ -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'
})
}

View 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>