This commit is contained in:
qsh
2023-03-21 00:53:28 +08:00
parent 953377e655
commit 955687d473
171 changed files with 7149 additions and 7341 deletions

View File

@@ -28,9 +28,9 @@
<el-form-item>
<el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button>
<el-button type="primary" icon="el-icon-plus" @click="handleAdd" v-hasPermi="['sch:classType:add']">新增</el-button>
<el-button type="danger" icon="el-icon-delete" @click="handleDelete" :disabled="multiple" v-hasPermi="['sch:classType:remove']">删除</el-button>
<el-button type="primary" icon="el-icon-copy" @click="handleClone" :disabled="multiple" v-hasPermi="['sch:classType:clone']">克隆</el-button>
<el-button v-hasPermi="['sch:classType:add']" type="primary" icon="el-icon-plus" @click="handleAdd">新增</el-button>
<el-button v-hasPermi="['sch:classType:remove']" type="danger" icon="el-icon-delete" :disabled="multiple" @click="handleDelete">删除</el-button>
<el-button v-hasPermi="['sch:classType:clone']" type="primary" icon="el-icon-copy" :disabled="multiple" @click="handleClone">克隆</el-button>
</el-form-item>
</el-form>
@@ -190,15 +190,9 @@
</template>
<script>
import {
getClassTypeTableList,
updateClassType,
insertClassType,
deleteClassType,
cloneClassType
} from '@/api/sch/classType'
import { validateMoney } from '@/utils/validate'
import { getMapData } from '@/api/sch/place'
import { getClassTypeTableList, updateClassType, insertClassType, deleteClassType, cloneClassType } from '@/api/sch/classType';
import { validateMoney } from '@/utils/validate';
import { getMapData } from '@/api/sch/place';
export default {
name: 'Classtype',
@@ -211,7 +205,7 @@ export default {
typeName: undefined,
status: undefined,
schoolId: this.$store.getters.schoolId,
licenseType: undefined,
licenseType: undefined
},
loading: {
tableLoading: false,
@@ -228,24 +222,24 @@ export default {
typeName: {
required: true,
message: '班型名称不为空',
trigger: 'blur',
trigger: 'blur'
},
originalPrice: {
required: true,
validator: validateMoney,
trigger: 'blur',
trigger: 'blur'
},
currentPrice: {
required: true,
validator: validateMoney,
trigger: 'blur',
trigger: 'blur'
},
minPrice: { required: true, validator: validateMoney, trigger: 'blur' },
placeIds: {
required: true,
message: '场地不为空',
trigger: 'change',
},
trigger: 'change'
}
},
schoolOption: [],
placeOption: [],
@@ -254,59 +248,55 @@ export default {
single: true,
cloneOpen: false,
clonForm: {}
}
};
},
created() {
this.getDicts('sys_normal_disable').then((response) => {
this.statusOptions = response.data
})
this.statusOptions = response.data;
});
this.getDicts('license_type').then((response) => {
this.licenseTypeOption = response.data
})
this._getSchoolTree()
this.getPageList()
this.licenseTypeOption = response.data;
});
this._getSchoolTree();
this.getPageList();
this.deptId = this.$store.getters.schoolId
this.deptId = this.$store.getters.schoolId;
},
methods: {
// 搜索
handleQuery() {
this.queryParams.page = 1
this.getPageList()
this.queryParams.page = 1;
this.getPageList();
},
getPageList() {
this.loading.tableLoading = true
this.loading.tableLoading = true;
const params = {
...this.queryParams,
schoolId:
this.selectNodes.length > 0 ? this.selectNodes[0].id : undefined,
placeId:
this.selectNodes.length == 2 ? this.selectNodes[1].id : undefined,
}
this.tableDataList = []
getClassTypeTableList(params).then(
(response) => {
this.tableDataList = response.rows
this.total = response.total
this.loading.tableLoading = false
}
)
schoolId: this.selectNodes.length > 0 ? this.selectNodes[0].id : undefined,
placeId: this.selectNodes.length == 2 ? this.selectNodes[1].id : undefined
};
this.tableDataList = [];
getClassTypeTableList(params).then((response) => {
this.tableDataList = response.rows;
this.total = response.total;
this.loading.tableLoading = false;
});
},
// 重置搜索
resetQuery() {
this.queryParams.typeName = ''
this.queryParams.status = undefined
this.queryParams.schoolId = undefined
this.queryParams.placeId = undefined
this.queryParams.licenseType = undefined
this.handleQuery()
this.queryParams.typeName = '';
this.queryParams.status = undefined;
this.queryParams.schoolId = undefined;
this.queryParams.placeId = undefined;
this.queryParams.licenseType = undefined;
this.handleQuery();
},
// 查询驾校
_getSchoolTree() {
getMapData().then((resp) => {
if (resp.code == 200) {
let sList = resp.data.schoolList.filter((item) => item.showInMap)
const pList = resp.data.placeList.filter((item) => item.showInMap)
let sList = resp.data.schoolList.filter((item) => item.showInMap);
const pList = resp.data.placeList.filter((item) => item.showInMap);
sList = sList.map((item) => ({
id: item.schoolId,
label: item.schoolName,
@@ -316,22 +306,22 @@ export default {
.map((place) => ({
id: place.placeId,
label: place.name,
level: 2,
})),
}))
this.schoolOption = sList
this.placeOption = resp.data.placeList
level: 2
}))
}));
this.schoolOption = sList;
this.placeOption = resp.data.placeList;
}
})
});
},
// 新增
handleAdd() {
if (this.selectNodes.length < 1) {
this.msgError('请选择左侧驾校或场地')
return
this.msgError('请选择左侧驾校或场地');
return;
}
this.resetForm('modalForm')
this.modalVisible = true
this.resetForm('modalForm');
this.modalVisible = true;
this.modalForm = {
typeName: '',
status: '0',
@@ -347,96 +337,90 @@ export default {
enterMinPrice: undefined,
companyMinPrice: undefined,
employeeMinPrice: undefined
}
};
if (this.selectNodes.length > 1) {
this.$set(this.modalForm, "placeId", this.selectNodes[1].id);
this.$set(this.modalForm, "placeName", this.selectNodes[1].name);
this.$set(this.modalForm, 'placeId', this.selectNodes[1].id);
this.$set(this.modalForm, 'placeName', this.selectNodes[1].name);
}
},
// 编辑
handleUpdate(listItem) {
this.resetForm('modalForm')
this.resetForm('modalForm');
this.modalForm = {
...listItem
}
};
if (listItem.placeId) {
this.$set(
this.modalForm,
"placeName",
this.placeOption.find(item => item.placeId == listItem.placeId).name
);
this.$set(this.modalForm, 'placeName', this.placeOption.find((item) => item.placeId == listItem.placeId).name);
}
this.modalVisible = true
this.modalVisible = true;
},
// 模态框保存
handleSave() {
this.$refs.modalForm.validate((valid) => {
if (valid) {
this.loading.modalSaveLoading = true
this.loading.modalSaveLoading = true;
if (this.modalForm.typeId) {
updateClassType(this.modalForm).then((resp) => {
if (resp.code === 200) {
this.$message.success('修改成功')
this.modalVisible = false
this.loading.modalSaveLoading = false
this.getPageList()
this.$message.success('修改成功');
this.modalVisible = false;
this.loading.modalSaveLoading = false;
this.getPageList();
} else {
this.$message.error('修改失败:' + resp.message)
this.loading.modalSaveLoading = false
this.$message.error('修改失败:' + resp.message);
this.loading.modalSaveLoading = false;
}
})
});
} else {
if (!this.modalForm.schoolId) {
this.$set(this.modalForm, 'schoolId', this.$store.getters.schoolId)
this.$set(this.modalForm, 'schoolId', this.$store.getters.schoolId);
}
insertClassType(this.modalForm).then((resp) => {
if (resp.code === 200) {
this.$message.success('新增成功')
this.modalVisible = false
this.loading.modalSaveLoading = false
this.getPageList()
this.$message.success('新增成功');
this.modalVisible = false;
this.loading.modalSaveLoading = false;
this.getPageList();
} else {
this.$message.error('新增失败:' + resp.message)
this.loading.modalSaveLoading = false
this.$message.error('新增失败:' + resp.message);
this.loading.modalSaveLoading = false;
}
})
});
}
}
})
});
},
// 字典状态字典翻译
statusFormat(row, column) {
return this.selectDictLabel(this.statusOptions, row.status)
return this.selectDictLabel(this.statusOptions, row.status);
},
// 字典状态字典翻译
placeFormat(row, column) {
if (row.placeId) {
return this.placeOption.length > 0
? this.placeOption.find((item) => item.placeId == row.placeId).name
: ''
return this.placeOption.length > 0 ? this.placeOption.find((item) => item.placeId == row.placeId).name : '';
}
},
// 字典状态字典翻译
licenseTypeFormat(row, column) {
return this.selectDictLabel(this.licenseTypeOption, row.licenseType)
return this.selectDictLabel(this.licenseTypeOption, row.licenseType);
},
handleNodeClick(data, node) {
if (data.level === 1) {
this.selectNodes = [{ id: data.id, name: data.label }]
this.selectNodes = [{ id: data.id, name: data.label }];
} else {
this.selectNodes = [
{ id: node.parent.data.id, name: node.parent.data.label },
{ id: data.id, name: data.label },
]
{ id: data.id, name: data.label }
];
}
this.handleQuery()
this.handleQuery();
},
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map(item => item.typeId);
this.nos = selection.map(item => item.productNo);
this.ids = selection.map((item) => item.typeId);
this.nos = selection.map((item) => item.productNo);
this.single = selection.length != 1;
this.multiple = !selection.length;
},
@@ -444,48 +428,43 @@ export default {
handleDelete(item) {
const typeId = item.typeId || this.ids;
this.$confirm(
'是否确认删除?',
'警告',
{
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
}
)
this.$confirm('是否确认删除?', '警告', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
})
.then((res) => {
deleteClassType(typeId).then((resp) => {
if (resp.code === 200) {
this.$message.success('删除成功')
this.getPageList()
this.$message.success('删除成功');
this.getPageList();
}
})
});
})
.catch(function () { })
.catch(function () {});
},
handleClone() {
this.cloneOpen = true;
this.clonForm = {
typeIds: this.ids,
placeIds: undefined
}
};
},
cloneSave() {
this.$refs.clonForm.validate((valid) => {
if (valid) {
this.loading.cloneLoading = true
this.loading.cloneLoading = true;
cloneClassType(this.clonForm).then((resp) => {
if (resp.code === 200) {
this.$message.success('克隆成功')
this.cloneOpen = false
this.getPageList()
this.$message.success('克隆成功');
this.cloneOpen = false;
this.getPageList();
}
this.loading.cloneLoading = false
})
this.loading.cloneLoading = false;
});
}
})
});
}
},
}
}
};
</script>

View File

@@ -1,23 +1,23 @@
<template>
<el-dialog title="驾校信息" :close-on-click-modal="false" append-to-body :visible.sync="visible" width="600px" @close="closeDialog">
<div>
<el-form :model="dialogForm" :rules="dataRule" label-position="top" ref="dialogForm" @keyup.enter.native="dialogFormSubmit()">
<el-form ref="dialogForm" :model="dialogForm" :rules="dataRule" label-position="top" @keyup.enter.native="dialogFormSubmit()">
<el-form-item label="驾校名称" prop="schoolName">
<el-input v-model="dialogForm.schoolName" maxlength="100" placeholder="请输入" clearable></el-input>
<el-input v-model="dialogForm.schoolName" maxlength="100" placeholder="请输入" clearable />
</el-form-item>
<el-form-item label="负责人" prop="leader">
<el-input v-model="dialogForm.leader" maxlength="100" placeholder="请输入" clearable></el-input>
<el-input v-model="dialogForm.leader" maxlength="100" placeholder="请输入" clearable />
</el-form-item>
<el-form-item label="联系方式" prop="phone">
<el-input v-model="dialogForm.phone" maxlength="11" placeholder="请输入" clearable></el-input>
<el-input v-model="dialogForm.phone" maxlength="11" placeholder="请输入" clearable />
</el-form-item>
<el-form-item label="状态" prop="status">
<el-radio-group v-model="dialogForm.status">
<el-radio v-for="dict in dict.type.sys_normal_disable" :key="dict.value" :label="dict.value">{{dict.label}}</el-radio>
<el-radio v-for="dict in dict.type.sys_normal_disable" :key="dict.value" :label="dict.value">{{ dict.label }}</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model="dialogForm.remark" maxlength="300" placeholder="请输入" clearable></el-input>
<el-input v-model="dialogForm.remark" maxlength="300" placeholder="请输入" clearable />
</el-form-item>
</el-form>
@@ -25,22 +25,19 @@
</div>
<span slot="footer" class="dialog-footer">
<el-button plain @click="(visible=false)">取消</el-button>
<el-button type="primary" v-jclick :disabled="!canSubmit" @click="dialogFormSubmit()">确定</el-button>
<el-button v-jclick type="primary" :disabled="!canSubmit" @click="dialogFormSubmit()">确定</el-button>
</span>
</el-dialog>
</template>
<script>
import api from '@/api/sch/school';
import { mapGetters } from 'vuex';
export default {
dicts: ['sys_normal_disable'],
props: {
},
computed: {
...mapGetters(['userInfo'])
},
props: {},
data() {
return {
visible: false,
@@ -59,7 +56,9 @@ export default {
}
};
},
created() { },
computed: {
...mapGetters(['userInfo'])
},
methods: {
init(info = undefined) {
// debugger
@@ -79,7 +78,7 @@ export default {
leader: undefined,
phone: undefined,
remark: undefined
}
};
},
closeDialog() {
this.$emit('update:dialogVisible', false);
@@ -121,10 +120,8 @@ export default {
});
}
}
})
},
});
}
}
};
</script>
</script>

View File

@@ -1,3 +1,4 @@
<template>
<div class="amap-page-container">
<div id="map" class="amap-cavans" />
@@ -13,10 +14,10 @@
<el-card :body-style="{ padding: '10px' }">
<div slot="header" class="clearfix">
<div class="map-card-title">{{ school.schoolName }}</div>
<el-switch v-model="school.showInMap" class="add-icon" active-text="展示" inactive-text="隐藏" @change="changeSchoolStatus(school)" v-hasPermi="['sch:place:edit']" />
<el-switch v-model="school.showInMap" v-hasPermi="['sch:place:edit']" class="add-icon" active-text="展示" inactive-text="隐藏" @change="changeSchoolStatus(school)" />
</div>
<el-button @click="handleClickSchool(school)">{{ `数据管理(${getCount(school.schoolId)})` }}</el-button>
<el-tooltip content="新增场地" placement="left" effect="dark" v-hasPermi="['sch:place:add']">
<el-tooltip v-hasPermi="['sch:place:add']" content="新增场地" placement="left" effect="dark">
<el-button icon="el-icon-plus" class="add-place-btn" @click="handleInsertPlace(school.schoolId)" />
</el-tooltip>
</el-card>
@@ -64,7 +65,7 @@
<el-form-item label="旗子颜色" prop="flagColor">
<el-radio-group v-model="placeForm.flagColor">
<el-radio v-for="(item, index) in colorOptions" :key="index" :label="item">
<img :src="require(`@/assets/images/place/flag_${item}.png`)" width="20px" />
<img :src="require(`@/assets/images/place/flag_${item}.png`)" width="20px">
</el-radio>
</el-radio-group>
</el-form-item>
@@ -96,7 +97,7 @@
<el-input v-model="placeForm.remark" placeholder="输入备注" type="textarea" :autosize="{ minRows: 2, maxRows: 4}" />
</el-form-item>
<el-form-item style="text-align:right;">
<el-button type="primary" @click="onSubmit" v-hasPermi="['sch:place:edit']">保存</el-button>
<el-button v-hasPermi="['sch:place:edit']" type="primary" @click="onSubmit">保存</el-button>
<el-button @click="closePlaceDialog">取消</el-button>
</el-form-item>
</el-form>
@@ -125,12 +126,12 @@
<el-table-column prop="area" label="所属区域" width="110" />
<el-table-column label="展示" width="100">
<template slot-scope="scope">
<el-switch v-model="scope.row.showInMap" @change="changePlaceStatus(scope.row)" v-hasPermi="['sch:place:edit']" />
<el-switch v-model="scope.row.showInMap" v-hasPermi="['sch:place:edit']" @change="changePlaceStatus(scope.row)" />
</template>
</el-table-column>
<el-table-column label="操作" width="100">
<template slot-scope="scope">
<el-tooltip content="编辑" placement="top" effect="dark" v-hasPermi="['sch:place:edit']">
<el-tooltip v-hasPermi="['sch:place:edit']" content="编辑" placement="top" effect="dark">
<el-button icon="el-icon-edit" type="primary" style="padding: 4px 8px;" @click="handleEditPlace(scope.row)" />
</el-tooltip>
</template>
@@ -142,9 +143,9 @@
<i v-if="isPointing" class="el-icon-s-flag circle" :style="{ transform: 'translate3D(' + tipPostion.x +'px,' + tipPostion.y + 'px, 0)' }" />
</div>
</template>
<!-- eslint-disable no-undef -->
<script>
import { getMapData, savePlace, updateSchoolStatus } from '@/api/sch/place'
import { getMapData, savePlace, updateSchoolStatus } from '@/api/sch/place';
export default {
name: 'Place',
data() {
@@ -166,13 +167,13 @@ export default {
address: undefined,
remark: undefined,
phone: undefined,
flagColor: 'red',
flagColor: 'red'
},
colorOptions: ['red', 'yellow', 'blue', 'green', 'purple', 'black'],
mapHelpText: '',
tipPostion: {
x: 0,
y: 0,
y: 0
},
geocoder: null,
locationMarker: null,
@@ -185,8 +186,8 @@ export default {
schoolList: [],
currentdeptId: undefined,
placeMarkerList: [],
areaOptions: [],
}
areaOptions: []
};
},
computed: {
placeTableData: function () {
@@ -195,149 +196,123 @@ export default {
return (
dataNews.schoolId === this.currentdeptId &&
Object.keys(dataNews).some((key) => {
return (
String(dataNews[key]).toLowerCase().indexOf(this.tableSearch) >
-1
)
return String(dataNews[key]).toLowerCase().indexOf(this.tableSearch) > -1;
})
)
})
);
});
}
return this.tableData.filter(
(dataNews) => dataNews.schoolId === this.currentdeptId
)
},
return this.tableData.filter((dataNews) => dataNews.schoolId === this.currentdeptId);
}
},
mounted() {
this.initMap()
this.initMap();
this.getDicts('dm_area').then((response) => {
this.areaOptions = response.data
})
this.areaOptions = response.data;
});
},
methods: {
initMap() {
window.onLoad = () => {
this.aMap = new AMap.Map('map', {
zoom: this.zomm,
zooms: [8, 18],
})
zooms: [8, 18]
});
// 监听缩放
this.aMap.on('zoomend', () => {
this.zomm = this.aMap.getZoom()
this.$message('当前缩放等级:' + this.zomm)
})
this.zomm = this.aMap.getZoom();
this.$message('当前缩放等级:' + this.zomm);
});
// 监听点击
this.aMap.on('click', (ev) => {
if (this.isPointing) {
this.placeForm.lat = ev.lnglat.lat
this.placeForm.lng = ev.lnglat.lng
this.regeoCode()
this.placeForm.lat = ev.lnglat.lat;
this.placeForm.lng = ev.lnglat.lng;
this.regeoCode();
if (this.selectMarker) {
this.selectMarker.setPosition([
this.placeForm.lng,
this.placeForm.lat,
])
this.selectMarker.setPosition([this.placeForm.lng, this.placeForm.lat]);
} else {
this.locationMarker.setPosition([
this.placeForm.lng,
this.placeForm.lat,
])
this.aMap.add(this.locationMarker)
this.locationMarker.setPosition([this.placeForm.lng, this.placeForm.lat]);
this.aMap.add(this.locationMarker);
}
this.isPointing = false
this.isPointing = false;
}
})
});
// 监听移动
this.aMap.on('mousemove', (ev) => {
if (this.isRanging) {
this.mapHelpText =
'左键单击选点,双击/右键单击完成选点,再次点击测距按钮可退出测距模式,并清除测距结果'
this.mapHelpText = '左键单击选点,双击/右键单击完成选点,再次点击测距按钮可退出测距模式,并清除测距结果';
this.tipPostion = {
x: ev.pixel.x,
y: ev.pixel.y,
}
y: ev.pixel.y
};
} else if (this.isPointing) {
this.mapHelpText = '点击地图添加标注'
this.mapHelpText = '点击地图添加标注';
this.tipPostion = {
x: ev.pixel.x,
y: ev.pixel.y,
}
y: ev.pixel.y
};
}
})
});
// 添加地图插件
AMap.plugin(
[
'AMap.Scale',
'AMap.Geolocation',
'AMap.MouseTool',
'AMap.PlaceSearch',
'AMap.Autocomplete',
'AMap.Geocoder',
],
() => {
this.aMap.addControl(new AMap.Scale())
const geoLoca = new AMap.Geolocation({
showButton: false,
})
this.aMapLocation = geoLoca
this.aMap.addControl(geoLoca)
this.aMouseTool = new AMap.MouseTool(this.aMap)
const auto = new AMap.Autocomplete({
input: 'search', // 前端搜索框
})
this.placeSearch = new AMap.PlaceSearch({
map: this.aMap,
})
AMap.event.addListener(auto, 'select', this.select)
this.geocoder = new AMap.Geocoder()
this.locationMarker = new AMap.Marker({
icon: require(`@/assets/images/place/flag_red.png`),
})
}
)
this.getPageData()
}
this.importMap()
AMap.plugin(['AMap.Scale', 'AMap.Geolocation', 'AMap.MouseTool', 'AMap.PlaceSearch', 'AMap.Autocomplete', 'AMap.Geocoder'], () => {
this.aMap.addControl(new AMap.Scale());
const geoLoca = new AMap.Geolocation({
showButton: false
});
this.aMapLocation = geoLoca;
this.aMap.addControl(geoLoca);
this.aMouseTool = new AMap.MouseTool(this.aMap);
const auto = new AMap.Autocomplete({
input: 'search' // 前端搜索框
});
this.placeSearch = new AMap.PlaceSearch({
map: this.aMap
});
AMap.event.addListener(auto, 'select', this.select);
this.geocoder = new AMap.Geocoder();
this.locationMarker = new AMap.Marker({
icon: require(`@/assets/images/place/flag_red.png`)
});
});
this.getPageData();
};
this.importMap();
},
// 导入地图
importMap() {
const url =
'https://webapi.amap.com/maps?v=1.4.15&key=124646b0e6076de9d801400f833ac986&callback=onLoad'
var jsapi = document.createElement('script')
jsapi.charset = 'utf-8'
jsapi.src = url
document.head.appendChild(jsapi)
const url = 'https://webapi.amap.com/maps?v=1.4.15&key=124646b0e6076de9d801400f833ac986&callback=onLoad';
var jsapi = document.createElement('script');
jsapi.charset = 'utf-8';
jsapi.src = url;
document.head.appendChild(jsapi);
},
toggleSchool() {
this.showSchool = !this.showSchool
this.showSchool = !this.showSchool;
},
// 经纬度 -> 地址
regeoCode() {
this.geocoder.getAddress(
[this.placeForm.lng, this.placeForm.lat],
(status, result) => {
if (status === 'complete' && result.regeocode) {
this.placeForm.address = result.regeocode.formattedAddress
} else {
console.log('根据经纬度查询地址失败')
}
this.geocoder.getAddress([this.placeForm.lng, this.placeForm.lat], (status, result) => {
if (status === 'complete' && result.regeocode) {
this.placeForm.address = result.regeocode.formattedAddress;
} else {
console.log('根据经纬度查询地址失败');
}
)
});
},
// 定位
geolocation() {
this.aMapLocation.getCurrentPosition()
this.aMapLocation.getCurrentPosition();
},
// 测距
ranging() {
this.isPointing = false
this.isRanging = !this.isRanging
this.isPointing = false;
this.isRanging = !this.isRanging;
if (this.isRanging) {
this.aMap.setDefaultCursor('crosshair')
this.drawLine()
this.aMap.setDefaultCursor('crosshair');
this.drawLine();
} else {
this.aMap.setDefaultCursor('default')
this.aMouseTool.close(true)
this.aMap.setDefaultCursor('default');
this.aMouseTool.close(true);
}
},
// 画线
@@ -348,76 +323,76 @@ export default {
icon: new AMap.Icon({
size: new AMap.Size(19, 31), // 图标大小
imageSize: new AMap.Size(19, 31),
image: 'https://webapi.amap.com/theme/v1.3/markers/b/start.png',
}),
image: 'https://webapi.amap.com/theme/v1.3/markers/b/start.png'
})
},
endMarkerOptions: {
// 可缺省
icon: new AMap.Icon({
size: new AMap.Size(19, 31), // 图标大小
imageSize: new AMap.Size(19, 31),
image: 'https://webapi.amap.com/theme/v1.3/markers/b/end.png',
image: 'https://webapi.amap.com/theme/v1.3/markers/b/end.png'
}),
offset: new AMap.Pixel(-9, -31),
offset: new AMap.Pixel(-9, -31)
},
midMarkerOptions: {
// 可缺省
icon: new AMap.Icon({
size: new AMap.Size(19, 31), // 图标大小
imageSize: new AMap.Size(19, 31),
image: 'https://webapi.amap.com/theme/v1.3/markers/b/mid.png',
image: 'https://webapi.amap.com/theme/v1.3/markers/b/mid.png'
}),
offset: new AMap.Pixel(-9, -31),
offset: new AMap.Pixel(-9, -31)
},
lineOptions: {
// 可缺省
strokeStyle: 'solid',
strokeColor: '#FF33FF',
strokeOpacity: 1,
strokeWeight: 2,
strokeWeight: 2
},
tmpLineOptions: {
strokeStyle: 'dashed',
strokeColor: '#FF33FF',
strokeOpacity: 1,
strokeWeight: 2,
},
})
strokeWeight: 2
}
});
},
// 选择查询结果
select(e) {
this.placeSearch.setCity(e.poi.adcode)
this.placeSearch.search(e.poi.name) // 关键字查询查询
this.placeSearch.setCity(e.poi.adcode);
this.placeSearch.search(e.poi.name); // 关键字查询查询
},
// 查询按钮/回车事件
submitSearch() {
this.placeSearch.search(this.searchBody)
this.placeSearch.search(this.searchBody);
},
// 缩放
bigger() {
this.zomm++
this.aMap.setZoom(this.zomm)
this.zomm++;
this.aMap.setZoom(this.zomm);
},
smaller() {
this.zomm--
this.aMap.setZoom(this.zomm)
this.zomm--;
this.aMap.setZoom(this.zomm);
},
// 点击数据管理
handleClickSchool(item) {
this.placeListDialogShow = true
this.placeListDialogTitle = `数据管理 [${item.schoolName}]`
this.currentdeptId = item.schoolId
this.placeListDialogShow = true;
this.placeListDialogTitle = `数据管理 [${item.schoolName}]`;
this.currentdeptId = item.schoolId;
},
// 新增场地
handleInsertPlace(schoolId) {
if (this.selectMarker) {
this.selectMarker.setAnimation('AMAP_ANIMATION_NONE')
this.selectMarker = null
this.selectMarker.setAnimation('AMAP_ANIMATION_NONE');
this.selectMarker = null;
}
this.placeDialogShow = true
this.aMap.setDefaultCursor('default')
this.isRanging = false
this.placeDialogShow = true;
this.aMap.setDefaultCursor('default');
this.isRanging = false;
this.placeForm = {
lat: undefined,
lng: undefined,
@@ -427,44 +402,41 @@ export default {
phone: undefined,
schoolId: schoolId,
showInMap: true,
flagColor: 'red',
}
flagColor: 'red'
};
},
// 编辑场地
handleEditPlace(item) {
this.placeDialogShow = true
this.aMap.setDefaultCursor('default')
this.placeDialogShow = true;
this.aMap.setDefaultCursor('default');
if (this.selectMarker) {
this.selectMarker.setAnimation('AMAP_ANIMATION_NONE')
this.selectMarker.setAnimation('AMAP_ANIMATION_NONE');
}
this.isRanging = false
this.placeForm = Object.assign({}, item)
this.selectMarker = this.placeMarkerList.filter(
(marker) => marker.getExtData().placeId === item.placeId
)[0]
this.selectMarker &&
this.selectMarker.setAnimation('AMAP_ANIMATION_BOUNCE')
this.aMap.setCenter([item.lng, item.lat])
this.isRanging = false;
this.placeForm = Object.assign({}, item);
this.selectMarker = this.placeMarkerList.filter((marker) => marker.getExtData().placeId === item.placeId)[0];
this.selectMarker && this.selectMarker.setAnimation('AMAP_ANIMATION_BOUNCE');
this.aMap.setCenter([item.lng, item.lat]);
},
getPoint() {
this.isPointing = !this.isPointing
this.isPointing = !this.isPointing;
},
// 保存
async onSubmit() {
// 保存接口
if (this.checkPlaceFormValidate()) {
// 先访问接口返回id插入placeForm
const resp = await savePlace(this.placeForm)
const resp = await savePlace(this.placeForm);
if (resp.code != 200) {
return
return;
} else {
this.$message.success('操作成功');
}
if (!this.placeForm.placeId && resp.data) {
this.$set(this.placeForm, 'placeId', resp.data)
this.$set(this.placeForm, 'placeId', resp.data);
}
// 移除选点用 的标记
this.aMap.remove(this.locationMarker)
this.aMap.remove(this.locationMarker);
// 根据form创建新marker 并添加到地图上
const tmpMarker = new AMap.Marker({
map: this.aMap,
@@ -472,108 +444,102 @@ export default {
icon: require(`@/assets/images/place/flag_${this.placeForm.flagColor}.png`),
label: {
content: this.placeForm.name,
direction: 'right',
direction: 'right'
},
extData: this.placeForm,
})
extData: this.placeForm
});
// 新marker事件
tmpMarker.on('click', this.handleClickMarker)
tmpMarker.on('click', this.handleClickMarker);
// 如果当前选择的marker点存在编辑
if (this.selectMarker) {
// 地图上 移除选择的点
this.aMap.remove(this.selectMarker)
this.selectMarker = null
this.aMap.remove(this.selectMarker);
this.selectMarker = null;
}
// 关闭场地弹窗
this.placeDialogShow = false
this.isPointing = false
this.placeDialogShow = false;
this.isPointing = false;
// 场地列表 移除原列表中操作的场地数据
const tmpArr = this.tableData.filter(
(item) => item.placeId !== this.placeForm.placeId
)
const tmpArr = this.tableData.filter((item) => item.placeId !== this.placeForm.placeId);
// 新增新的场地
tmpArr.push(this.placeForm)
tmpArr.push(this.placeForm);
// 重置场地数组
this.tableData = tmpArr
this.tableData = tmpArr;
// 地图marker列表 移除操作的原marker 添加新marker进数组
const tmpArr1 = this.placeMarkerList.filter(
(item) => item.getExtData().placeId !== this.placeForm.placeId
)
tmpArr1.push(tmpMarker)
this.placeMarkerList = tmpArr1
const tmpArr1 = this.placeMarkerList.filter((item) => item.getExtData().placeId !== this.placeForm.placeId);
tmpArr1.push(tmpMarker);
this.placeMarkerList = tmpArr1;
}
},
checkPlaceFormValidate() {
const valid = []
const valid = [];
if (!this.placeForm.name) {
valid.push('名称')
valid.push('名称');
}
if (!this.placeForm.address) {
valid.push('地址')
valid.push('地址');
}
if (!this.placeForm.lng) {
valid.push('经度')
valid.push('经度');
}
if (!this.placeForm.lat) {
valid.push('纬度')
valid.push('纬度');
}
if (!this.placeForm.phone) {
valid.push('电话')
valid.push('电话');
}
if (valid.length == 0) {
return true
return true;
} else {
this.$message.error(`请将以下填写完整: ${valid.join(',')}`)
return false
this.$message.error(`请将以下填写完整: ${valid.join(',')}`);
return false;
}
},
// 关闭场地弹窗
closePlaceDialog() {
this.placeDialogShow = false
this.isPointing = false
this.aMap.remove(this.locationMarker)
this.placeDialogShow = false;
this.isPointing = false;
this.aMap.remove(this.locationMarker);
if (this.selectMarker) {
this.selectMarker.setAnimation('AMAP_ANIMATION_NONE')
this.selectMarker = null
this.selectMarker.setAnimation('AMAP_ANIMATION_NONE');
this.selectMarker = null;
}
},
handleClickMarker(ev) {
if (this.selectMarker) {
this.selectMarker.setAnimation('AMAP_ANIMATION_NONE')
this.selectMarker.setAnimation('AMAP_ANIMATION_NONE');
}
this.placeForm = ev.target.getExtData()
this.placeDialogShow = true
ev.target.setAnimation('AMAP_ANIMATION_BOUNCE')
this.selectMarker = ev.target
this.placeForm = ev.target.getExtData();
this.placeDialogShow = true;
ev.target.setAnimation('AMAP_ANIMATION_BOUNCE');
this.selectMarker = ev.target;
},
getPageData() {
getMapData().then((resp) => {
if (resp.code == 200) {
this.schoolList = resp.data.schoolList
this.tableData = resp.data.placeList
this.currentdeptId = this.schoolList[0].schoolId
this.createMarkersInMap()
this.schoolList = resp.data.schoolList;
this.tableData = resp.data.placeList;
this.currentdeptId = this.schoolList[0].schoolId;
this.createMarkersInMap();
}
})
});
},
getCount(schoolId) {
return this.tableData.filter((item) => item.schoolId === schoolId).length
return this.tableData.filter((item) => item.schoolId === schoolId).length;
},
// 重置markers
resetMarkers() {
this.aMap.clearMap()
this.createMarkersInMap()
this.aMap.clearMap();
this.createMarkersInMap();
},
// 生成markers
createMarkersInMap() {
for (let i = 0; i < this.tableData.length; i++) {
const element = this.tableData[i]
const tempSchool = this.schoolList.filter(
(item) => item.schoolId === element.schoolId
)[0]
const element = this.tableData[i];
const tempSchool = this.schoolList.filter((item) => item.schoolId === element.schoolId)[0];
if (!tempSchool.showInMap || !element.showInMap) {
continue
continue;
}
const tmpMarker = new AMap.Marker({
map: this.aMap,
@@ -581,12 +547,12 @@ export default {
icon: require(`@/assets/images/place/flag_${element.flagColor}.png`),
label: {
content: element.name,
direction: 'right',
direction: 'right'
},
extData: element,
})
tmpMarker.on('click', this.handleClickMarker)
this.placeMarkerList.push(tmpMarker)
extData: element
});
tmpMarker.on('click', this.handleClickMarker);
this.placeMarkerList.push(tmpMarker);
}
},
// 修改驾校状态
@@ -597,19 +563,19 @@ export default {
this.$message.success('操作成功');
// this.aMap.clearMap()
// this.getPageData()
this.resetMarkers()
this.resetMarkers();
}
})
});
},
// 修改场地状态
async changePlaceStatus(item) {
const resp = await savePlace(item)
const resp = await savePlace(item);
if (resp.code == 200) {
this.resetMarkers()
this.resetMarkers();
}
},
},
}
}
}
};
</script>
<style scoped>
@@ -642,7 +608,7 @@ export default {
height: 100%;
}
/deep/ .el-card__header {
::v-deep .el-card__header {
padding: 10px 15px;
}
@@ -700,7 +666,7 @@ export default {
color: #409eff;
}
/deep/.place-dialog {
::v-deep .place-dialog {
position: absolute;
left: 20px;
top: 60px;
@@ -765,8 +731,7 @@ export default {
.actived-school {
border: 2px solid #409eff !important;
}
/deep/ .el-radio__label {
::v-deep .el-radio__label {
vertical-align: middle;
}
</style>

View File

@@ -9,7 +9,7 @@
<el-form-item>
<el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button>
<el-button type="primary" icon="el-icon-plus" @click="addOrUpdateHandle(undefined)" v-hasPermi="['sch:school:add']">新增</el-button>
<el-button v-hasPermi="['sch:school:add']" type="primary" icon="el-icon-plus" @click="addOrUpdateHandle(undefined)">新增</el-button>
<!-- <el-button type="danger" icon="el-icon-delete" @click="handleDelete" :disabled="multiple" v-hasPermi="['sch:school:remove']">删除</el-button> -->
</el-form-item>
</el-form>
@@ -38,14 +38,13 @@
<pagination :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize" @pagination="getPageList" />
<!-- 驾校弹框 -->
<school-form v-if="dialogVisible" :dialogVisible="dialogVisible" ref="dialogForm" @refreshDataList="getPageList" />
<school-form v-if="dialogVisible" ref="dialogForm" :dialog-visible="dialogVisible" @refreshDataList="getPageList" />
</div>
</template>
<script>
import schoolForm from './components/schoolForm.vue'
import schoolApi from '@/api/sch/school'
import { appendFile } from 'fs'
import schoolForm from './components/schoolForm.vue';
import schoolApi from '@/api/sch/school';
export default {
name: 'School',
@@ -64,23 +63,22 @@ export default {
loading: {
tableLoading: false
},
dialogVisible: false,
}
dialogVisible: false
};
},
created() {
//页面初始化加载
this.getPageList()
// 页面初始化加载
this.getPageList();
},
methods: {
//查询列表数据
// 查询列表数据
getPageList() {
schoolApi.pageList(this.queryParams).then(resp => {
if (resp.code == 200) {
this.tableDataList = resp.rows
this.total = resp.total
schoolApi.pageList(this.queryParams).then((resp) => {
if (resp.code === 200) {
this.tableDataList = resp.rows;
this.total = resp.total;
}
})
});
},
/** 搜索按钮操作 */
handleQuery() {
@@ -89,33 +87,36 @@ export default {
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.resetForm('queryForm');
this.queryParams = {
schoolName: undefined,
pageNum: 1,
pageSize: 10
},
this.handleQuery();
};
this.handleQuery();
},
//新增和修改操作
// 新增和修改操作
addOrUpdateHandle(item) {
this.dialogVisible = true;
this.$nextTick(() => {
this.$refs.dialogForm.init(item);
});
},
//删除操作
// 删除操作
handleDelete(item) {
this.$modal.confirm('删除驾校信息,同时会删除该驾校下的场地信息和班型信息,是否确认名称为"' + item.schoolName + '"的数据项?').then(function () {
return schoolApi.delete(item.schoolId);
}).then((resp) => {
if (resp.code == 200) {
this.getPageList();
this.$modal.msgSuccess("删除成功");
}
}).catch(() => { });
},
},
}
</script>
this.$modal
.confirm('删除驾校信息,同时会删除该驾校下的场地信息和班型信息,是否确认名称为"' + item.schoolName + '"的数据项?')
.then(function () {
return schoolApi.delete(item.schoolId);
})
.then((resp) => {
if (resp.code === 200) {
this.getPageList();
this.$modal.msgSuccess('删除成功');
}
})
.catch(() => {});
}
}
};
</script>