|
@@ -2,7 +2,8 @@
|
|
|
<div class='m-container'>
|
|
|
<h2>分部教学点</h2>
|
|
|
<div class="m-core">
|
|
|
- <div @click="teachingStatus = true" class='newBand'>新建</div>
|
|
|
+ <div @click="teachingStatus = true"
|
|
|
+ class='newBand'>新建</div>
|
|
|
<!-- 搜索类型 -->
|
|
|
<!-- <el-form :inline="true"
|
|
|
class="searchForm"
|
|
@@ -32,11 +33,14 @@
|
|
|
<!-- 列表 -->
|
|
|
<div class="tableWrap">
|
|
|
<el-table :data='tableList'>
|
|
|
- <el-table-column align='center' width="55" prop="id"
|
|
|
+ <el-table-column align='center'
|
|
|
+ width="55"
|
|
|
+ prop="id"
|
|
|
label="编号">
|
|
|
</el-table-column>
|
|
|
- <el-table-column align='center' prop="name"
|
|
|
- label="教学点名称">
|
|
|
+ <el-table-column align='center'
|
|
|
+ prop="name"
|
|
|
+ label="教学点名称">
|
|
|
</el-table-column>
|
|
|
<el-table-column align='center'
|
|
|
label="教学点来源"
|
|
@@ -49,20 +53,26 @@
|
|
|
label="费用">
|
|
|
<template slot-scope="scope">
|
|
|
{{ scope.row.cooperationOrganId ? '免费' : scope.row.remark }}
|
|
|
- </template>
|
|
|
+ </template>
|
|
|
</el-table-column>
|
|
|
<el-table-column align='center'
|
|
|
label="上课地点详情">
|
|
|
<template slot-scope="scope">
|
|
|
{{ scope.row.address.split(',').join('') }}
|
|
|
- </template>
|
|
|
+ </template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column align='center' prop="delFlag"
|
|
|
+ <el-table-column align='center'
|
|
|
+ prop="delFlag"
|
|
|
label="状态">
|
|
|
<template slot-scope="scope">
|
|
|
- <el-tag effect="dark" type="danger" v-if="scope.row.delFlag == 2" key="delFlag"> 停用</el-tag>
|
|
|
- <el-tag effect="dark" v-else key="delFlag">启用</el-tag>
|
|
|
- </template>
|
|
|
+ <el-tag effect="dark"
|
|
|
+ type="danger"
|
|
|
+ v-if="scope.row.delFlag == 2"
|
|
|
+ key="delFlag"> 停用</el-tag>
|
|
|
+ <el-tag effect="dark"
|
|
|
+ v-else
|
|
|
+ key="delFlag">启用</el-tag>
|
|
|
+ </template>
|
|
|
</el-table-column>
|
|
|
<el-table-column align='center'
|
|
|
label="课酬补贴">
|
|
@@ -73,10 +83,16 @@
|
|
|
<el-table-column align='center'
|
|
|
label="操作">
|
|
|
<template slot-scope="scope">
|
|
|
- <el-button @click="openTeaching('update', scope.row)" type="text">修改</el-button>
|
|
|
- <el-button v-if="scope.row.delFlag == 0" @click="onUpdateSubmit(scope.row, 2)" type="text">停用</el-button>
|
|
|
- <el-button v-if="scope.row.delFlag == 2" @click="onUpdateSubmit(scope.row, 0)" type="text">启用</el-button>
|
|
|
- <el-button @click="onUpdateSubmit(scope.row, 1)" type="text">删除</el-button>
|
|
|
+ <el-button @click="openTeaching('update', scope.row)"
|
|
|
+ type="text">修改</el-button>
|
|
|
+ <el-button v-if="scope.row.delFlag == 0"
|
|
|
+ @click="onUpdateSubmit(scope.row, 2)"
|
|
|
+ type="text">停用</el-button>
|
|
|
+ <el-button v-if="scope.row.delFlag == 2"
|
|
|
+ @click="onUpdateSubmit(scope.row, 0)"
|
|
|
+ type="text">启用</el-button>
|
|
|
+ <el-button @click="onUpdateSubmit(scope.row, 1)"
|
|
|
+ type="text">删除</el-button>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
@@ -88,44 +104,89 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
- <el-dialog :title="formTitle[formActionTitle]" :visible.sync="teachingStatus" @close="onFormClose('ruleForm')" width="500px">
|
|
|
- <el-form :model="form" :rules="rules" ref="ruleForm">
|
|
|
- <el-form-item label="教学点名称" prop="name" :label-width="formLabelWidth">
|
|
|
- <el-input v-model="form.name" autocomplete="off"></el-input>
|
|
|
+ <el-dialog :title="formTitle[formActionTitle]"
|
|
|
+ :visible.sync="teachingStatus"
|
|
|
+ @close="onFormClose('ruleForm')"
|
|
|
+ width="500px">
|
|
|
+ <el-form :model="form"
|
|
|
+ :rules="rules"
|
|
|
+ ref="ruleForm">
|
|
|
+ <el-form-item label="教学点名称"
|
|
|
+ prop="name"
|
|
|
+ :label-width="formLabelWidth">
|
|
|
+ <el-input v-model="form.name"
|
|
|
+ autocomplete="off"></el-input>
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="教学点来源" prop="source" :label-width="formLabelWidth">
|
|
|
+ <el-form-item label="教学点来源"
|
|
|
+ prop="source"
|
|
|
+ :label-width="formLabelWidth">
|
|
|
<el-select v-model="form.source">
|
|
|
- <el-option label="合作单位" value="1"></el-option>
|
|
|
- <el-option label="租赁" value="2"></el-option>
|
|
|
+ <el-option label="合作单位"
|
|
|
+ value="1"></el-option>
|
|
|
+ <el-option label="租赁"
|
|
|
+ value="2"></el-option>
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
- <el-form-item v-if="form.source == 1" prop="cooperationOrganId" label="合作单位" :label-width="formLabelWidth">
|
|
|
+ <el-form-item v-if="form.source == 1"
|
|
|
+ prop="cooperationOrganId"
|
|
|
+ label="合作单位"
|
|
|
+ :label-width="formLabelWidth">
|
|
|
<el-select v-model="form.cooperationOrganId">
|
|
|
- <el-option v-for="item in breachList" :key="item.value"
|
|
|
- :label="item.label" :value="item.value"></el-option>
|
|
|
+ <el-option v-for="item in breachList"
|
|
|
+ :key="item.value"
|
|
|
+ :label="item.label"
|
|
|
+ :value="item.value"></el-option>
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
- <el-form-item v-if="form.source == 2" prop="remark" label="费用" :label-width="formLabelWidth">
|
|
|
- <el-input v-model="form.remark" autocomplete="off"></el-input>
|
|
|
+ <el-form-item v-if="form.source == 2"
|
|
|
+ prop="remark"
|
|
|
+ label="费用"
|
|
|
+ :label-width="formLabelWidth">
|
|
|
+ <el-input v-model="form.remark"
|
|
|
+ autocomplete="off"></el-input>
|
|
|
</el-form-item>
|
|
|
- <el-form-item prop="address" :show-message="addressMessage" label="上课地点" :label-width="formLabelWidth">
|
|
|
- <el-input class="text-address" v-model="form.address" :disabled="true">
|
|
|
- <el-button slot="append" @click="addMap" type="primary" icon="el-icon-plus">选择</el-button>
|
|
|
+ <el-form-item prop="address"
|
|
|
+ :show-message="addressMessage"
|
|
|
+ label="上课地点"
|
|
|
+ :label-width="formLabelWidth">
|
|
|
+ <el-input class="text-address"
|
|
|
+ v-model="form.address"
|
|
|
+ :disabled="true">
|
|
|
+ <el-button slot="append"
|
|
|
+ @click="addMap"
|
|
|
+ type="primary"
|
|
|
+ icon="el-icon-plus">选择</el-button>
|
|
|
</el-input>
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="课酬补贴" prop="subsidy" :label-width="formLabelWidth">
|
|
|
- <el-input v-model.number="form.subsidy" type="number" autocomplete="off"></el-input>
|
|
|
+ <el-form-item label="课酬补贴"
|
|
|
+ prop="subsidy"
|
|
|
+ :label-width="formLabelWidth">
|
|
|
+ <el-input v-model.number="form.subsidy"
|
|
|
+ type="number"
|
|
|
+ autocomplete="off"></el-input>
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
|
- <span slot="footer" class="dialog-footer">
|
|
|
+ <span slot="footer"
|
|
|
+ class="dialog-footer">
|
|
|
<el-button @click="onTeachingCancel('ruleForm')">取 消</el-button>
|
|
|
- <el-button type="primary" @click="onTeachingSubmit('ruleForm')">确 定</el-button>
|
|
|
+ <el-button type="primary"
|
|
|
+ @click="onTeachingSubmit('ruleForm')">确 定</el-button>
|
|
|
</span>
|
|
|
</el-dialog>
|
|
|
- <el-dialog title="选择地图" custom-class="map-container" :visible.sync="mapStatus" width="800px">
|
|
|
- <el-amap-search-box class="search-box" :search-option="searchOption" :on-search-result="onSearchResult"></el-amap-search-box>
|
|
|
- <el-amap :zoom="zoom" :plugin="plugin" :center="center">
|
|
|
- <el-amap-marker :events="markerEvents()" v-for="(marker, index) in markers" :key="index" :position="marker" ></el-amap-marker>
|
|
|
+ <el-dialog title="选择地图"
|
|
|
+ custom-class="map-container"
|
|
|
+ :visible.sync="mapStatus"
|
|
|
+ width="800px">
|
|
|
+ <el-amap-search-box class="search-box"
|
|
|
+ :search-option="searchOption"
|
|
|
+ :on-search-result="onSearchResult"></el-amap-search-box>
|
|
|
+ <el-amap :zoom="zoom"
|
|
|
+ :plugin="plugin"
|
|
|
+ :center="center">
|
|
|
+ <el-amap-marker :events="markerEvents()"
|
|
|
+ v-for="(marker, index) in markers"
|
|
|
+ :key="index"
|
|
|
+ :position="marker"></el-amap-marker>
|
|
|
</el-amap>
|
|
|
</el-dialog>
|
|
|
</div>
|
|
@@ -134,24 +195,24 @@
|
|
|
import pagination from '@/components/Pagination/index'
|
|
|
// 地图
|
|
|
(function () {
|
|
|
-let func = EventTarget.prototype.addEventListener;
|
|
|
-let supportsPassive = false
|
|
|
-try {
|
|
|
- let opts = Object.defineProperty({}, 'passive', {
|
|
|
- get: function() {
|
|
|
- supportsPassive = true;
|
|
|
- }
|
|
|
- })
|
|
|
- document.addEventListener("testPassive", null, opts);
|
|
|
- document.removeEventListener('testPassive', null, opts);
|
|
|
-} catch(e) {}
|
|
|
+ let func = EventTarget.prototype.addEventListener;
|
|
|
+ let supportsPassive = false
|
|
|
+ try {
|
|
|
+ let opts = Object.defineProperty({}, 'passive', {
|
|
|
+ get: function () {
|
|
|
+ supportsPassive = true;
|
|
|
+ }
|
|
|
+ })
|
|
|
+ document.addEventListener("testPassive", null, opts);
|
|
|
+ document.removeEventListener('testPassive', null, opts);
|
|
|
+ } catch (e) { }
|
|
|
|
|
|
-EventTarget.prototype.addEventListener = function (type, fn, capture) {
|
|
|
- this.func = func;
|
|
|
- capture = capture instanceof Object ? capture : {};
|
|
|
- capture.passive = supportsPassive;
|
|
|
- this.func(type, fn, capture);
|
|
|
-};
|
|
|
+ EventTarget.prototype.addEventListener = function (type, fn, capture) {
|
|
|
+ this.func = func;
|
|
|
+ capture = capture instanceof Object ? capture : {};
|
|
|
+ capture.passive = supportsPassive;
|
|
|
+ this.func(type, fn, capture);
|
|
|
+ };
|
|
|
}());
|
|
|
import { schoolQueryPage, schoolAdd, schoolUpdate, queryByOrganId, schoolDel } from '@/api/systemManage'
|
|
|
import store from '@/store'
|
|
@@ -192,11 +253,11 @@ export default {
|
|
|
},
|
|
|
rules: {
|
|
|
name: [{ required: true, message: '请输入教学点名称', trigger: 'blur' }],
|
|
|
- source: [{required: true, message: '请选择教学点来源', trigger: 'change'}],
|
|
|
- remark: [{ required: true, message: '请输入教学点名称', trigger: 'blur'}],
|
|
|
- address: [{required: true, message: '请选择上课地点', trigger: 'blur'}],
|
|
|
- cooperationOrganId: [{required: true, message: '请选择合作单位', trigger: 'change'}],
|
|
|
- subsidy: [{ type: 'number', message: '课酬补贴只能为数字', trigger: 'blur'}]
|
|
|
+ source: [{ required: true, message: '请选择教学点来源', trigger: 'change' }],
|
|
|
+ remark: [{ required: true, message: '请输入教学点名称', trigger: 'blur' }],
|
|
|
+ address: [{ required: true, message: '请选择上课地点', trigger: 'blur' }],
|
|
|
+ cooperationOrganId: [{ required: true, message: '请选择合作单位', trigger: 'change' }],
|
|
|
+ subsidy: [{ type: 'number', message: '课酬补贴只能为数字', trigger: 'blur' }]
|
|
|
},
|
|
|
addressMessage: true,
|
|
|
mapStatus: false,
|
|
@@ -205,28 +266,28 @@ export default {
|
|
|
markers: [],
|
|
|
plugin: [],
|
|
|
searchOption: {
|
|
|
- city: '',
|
|
|
- citylimit: true,
|
|
|
- pageSize: 1, // 单页显示结果条数
|
|
|
- pageIndex: 1, // 页码
|
|
|
- autoFitView: true // 是否自动调整地图视野使绘制的 Marker点都处于视口的可见范围
|
|
|
+ city: '',
|
|
|
+ citylimit: true,
|
|
|
+ pageSize: 1, // 单页显示结果条数
|
|
|
+ pageIndex: 1, // 页码
|
|
|
+ autoFitView: true // 是否自动调整地图视野使绘制的 Marker点都处于视口的可见范围
|
|
|
},
|
|
|
breachList: [], // 分部列表
|
|
|
}
|
|
|
},
|
|
|
- mounted() {
|
|
|
+ mounted () {
|
|
|
this.getList()
|
|
|
this.getBreachList()
|
|
|
},
|
|
|
methods: {
|
|
|
- onTeachingSubmit(formName) { // 添加数据
|
|
|
+ onTeachingSubmit (formName) { // 添加数据
|
|
|
this.$refs[formName].validate((valid) => {
|
|
|
if (valid) {
|
|
|
this.form.address = this.addressDetail.address
|
|
|
this.form.longitudeLatitude = this.addressDetail.poi
|
|
|
- if(this.formActionTitle == 'create') {
|
|
|
+ if (this.formActionTitle == 'create') {
|
|
|
schoolAdd(this.form).then(res => {
|
|
|
- if(res.code == 200) {
|
|
|
+ if (res.code == 200) {
|
|
|
this.$message({
|
|
|
message: '添加成功',
|
|
|
type: 'success'
|
|
@@ -237,9 +298,9 @@ export default {
|
|
|
this.$message.error(res.msg)
|
|
|
}
|
|
|
})
|
|
|
- } else if(this.formActionTitle == 'update') {
|
|
|
+ } else if (this.formActionTitle == 'update') {
|
|
|
schoolUpdate(this.form).then(res => {
|
|
|
- if(res.code == 200) {
|
|
|
+ if (res.code == 200) {
|
|
|
this.$message({
|
|
|
message: '修改成功',
|
|
|
type: 'success'
|
|
@@ -256,26 +317,26 @@ export default {
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
- onTeachingCancel(formName) {
|
|
|
+ onTeachingCancel (formName) {
|
|
|
this.teachingStatus = false
|
|
|
this.$refs[formName].clearValidate()
|
|
|
},
|
|
|
- addMap() { //
|
|
|
+ addMap () { //
|
|
|
this.mapStatus = true
|
|
|
let poi = this.addressDetail.poi
|
|
|
// 获取经纬度
|
|
|
- if(poi) {
|
|
|
+ if (poi) {
|
|
|
this.markers = []
|
|
|
this.center = [poi.split(',')[0], poi.split(',')[1]];
|
|
|
this.markers.push([poi.split(',')[0], poi.split(',')[1]])
|
|
|
}
|
|
|
},
|
|
|
- onSearchResult(pois) { // 搜索出来的Marker
|
|
|
+ onSearchResult (pois) { // 搜索出来的Marker
|
|
|
let latSum = 0
|
|
|
let lngSum = 0
|
|
|
if (pois.length > 0) {
|
|
|
pois.forEach(poi => {
|
|
|
- let {lng, lat} = poi;
|
|
|
+ let { lng, lat } = poi;
|
|
|
lngSum += lng;
|
|
|
latSum += lat;
|
|
|
this.markers.push([poi.lng, poi.lat]);
|
|
@@ -287,59 +348,59 @@ export default {
|
|
|
this.center = [center.lng, center.lat];
|
|
|
}
|
|
|
},
|
|
|
- markerEvents() { // marker 事件添加
|
|
|
+ markerEvents () { // marker 事件添加
|
|
|
let that = this
|
|
|
return {
|
|
|
click: (e) => {
|
|
|
let geocoder = new AMap.Geocoder()
|
|
|
- geocoder.getAddress(e.lnglat, function(status, result) {
|
|
|
- if(status === 'complete' && result.regeocode) {
|
|
|
- result.regeocode.lnglat = e.lnglat
|
|
|
- let ct = result.regeocode.addressComponent
|
|
|
- that.addressDetail = {
|
|
|
- address: ct.province + ',' + ct.city + ',' + ct.district + ','+ ct.township + ct.street + ct.streetNumber,
|
|
|
- poi: e.lnglat.lng + ',' + e.lnglat.lat
|
|
|
- }
|
|
|
- that.form.address = result.regeocode.formattedAddress
|
|
|
- that.mapStatus = false
|
|
|
- that.addressMessage = false
|
|
|
+ geocoder.getAddress(e.lnglat, function (status, result) {
|
|
|
+ if (status === 'complete' && result.regeocode) {
|
|
|
+ result.regeocode.lnglat = e.lnglat
|
|
|
+ let ct = result.regeocode.addressComponent
|
|
|
+ that.addressDetail = {
|
|
|
+ address: ct.province + ',' + ct.city + ',' + ct.district + ',' + ct.township + ct.street + ct.streetNumber,
|
|
|
+ poi: e.lnglat.lng + ',' + e.lnglat.lat
|
|
|
+ }
|
|
|
+ that.form.address = result.regeocode.formattedAddress
|
|
|
+ that.mapStatus = false
|
|
|
+ that.addressMessage = false
|
|
|
} else {
|
|
|
- that.$message.error('请重新选择地址')
|
|
|
+ that.$message.error('请重新选择地址')
|
|
|
}
|
|
|
})
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
- getList() {
|
|
|
+ getList () {
|
|
|
schoolQueryPage({
|
|
|
organId: this.form.organId,
|
|
|
rows: this.pageInfo.limit,
|
|
|
page: this.pageInfo.page
|
|
|
}).then(res => {
|
|
|
- if(res.code == 200 && res.data) {
|
|
|
+ if (res.code == 200 && res.data) {
|
|
|
this.tableList = res.data.rows
|
|
|
this.pageInfo.total = res.data.total
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
- getBreachList() { // 获取分部列表
|
|
|
+ getBreachList () { // 获取分部列表
|
|
|
queryByOrganId({
|
|
|
organId: this.form.organId
|
|
|
}).then(res => {
|
|
|
- if(res.code == 200) {
|
|
|
+ if (res.code == 200) {
|
|
|
// 判断是否有数据
|
|
|
- if(!res.data && res.data.length <= 0) return
|
|
|
+ if (!res.data && res.data.length <= 0) return
|
|
|
res.data.forEach(r => {
|
|
|
this.breachList.push({
|
|
|
value: r.id,
|
|
|
label: r.name
|
|
|
})
|
|
|
})
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
- openTeaching(type, row) {
|
|
|
+ openTeaching (type, row) {
|
|
|
// 重置数据
|
|
|
this.form = {
|
|
|
id: null,
|
|
@@ -351,7 +412,7 @@ export default {
|
|
|
this.teachingStatus = true
|
|
|
this.formActionTitle = type
|
|
|
// 修改的时候赋值
|
|
|
- if(type == 'update') {
|
|
|
+ if (type == 'update') {
|
|
|
this.addressDetail = {
|
|
|
address: row.address,
|
|
|
poi: row.longitudeLatitude
|
|
@@ -368,14 +429,14 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
- onFormClose(formName) { // 关闭弹窗重置验证
|
|
|
+ onFormClose (formName) { // 关闭弹窗重置验证
|
|
|
this.$refs[formName].clearValidate()
|
|
|
},
|
|
|
- filterOrgan(val) {
|
|
|
+ filterOrgan (val) {
|
|
|
let result = ''
|
|
|
- if(val.cooperationOrganId) {
|
|
|
+ if (val.cooperationOrganId) {
|
|
|
this.breachList.forEach(res => {
|
|
|
- if(res.value == val.cooperationOrganId) {
|
|
|
+ if (res.value == val.cooperationOrganId) {
|
|
|
result = res.label
|
|
|
}
|
|
|
})
|
|
@@ -384,11 +445,11 @@ export default {
|
|
|
}
|
|
|
return result
|
|
|
},
|
|
|
- onUpdateSubmit(row, type) {
|
|
|
+ onUpdateSubmit (row, type) {
|
|
|
let msg
|
|
|
- if(type == 2) {
|
|
|
+ if (type == 2) {
|
|
|
msg = '停用'
|
|
|
- } else if(type == 0) {
|
|
|
+ } else if (type == 0) {
|
|
|
msg = '启用'
|
|
|
} else {
|
|
|
msg = '删除'
|
|
@@ -402,13 +463,13 @@ export default {
|
|
|
id: row.id,
|
|
|
delFlag: type
|
|
|
}).then(res => {
|
|
|
- if(res.code == 200) {
|
|
|
+ if (res.code == 200) {
|
|
|
this.$message({
|
|
|
message: '修改成功',
|
|
|
type: 'success'
|
|
|
})
|
|
|
this.teachingStatus = false
|
|
|
- if(type == 2 || type == 0) {
|
|
|
+ if (type == 2 || type == 0) {
|
|
|
row.delFlag = type
|
|
|
} else {
|
|
|
this.getList()
|
|
@@ -439,14 +500,17 @@ export default {
|
|
|
padding: 0;
|
|
|
}
|
|
|
}
|
|
|
-.el-input-group__append, .el-button--primary {
|
|
|
+.el-input-group__append,
|
|
|
+.el-button--primary {
|
|
|
background: #14928a;
|
|
|
border-color: #14928a;
|
|
|
color: #fff;
|
|
|
- &:hover, &:active, &:focus {
|
|
|
+ &:hover,
|
|
|
+ &:active,
|
|
|
+ &:focus {
|
|
|
background: #14928a;
|
|
|
border-color: #14928a;
|
|
|
- color: #FFF;
|
|
|
+ color: #fff;
|
|
|
}
|
|
|
}
|
|
|
.el-vue-search-box-container {
|
|
@@ -455,5 +519,4 @@ export default {
|
|
|
margin-top: 10px;
|
|
|
z-index: 99999 !important;
|
|
|
}
|
|
|
-
|
|
|
</style>
|