|
@@ -2,7 +2,7 @@
|
|
|
<div class='m-container'>
|
|
|
<h2>合作单位</h2>
|
|
|
<div class="m-core">
|
|
|
- <div @click="teachingStatus = true" class='newBand'>新建</div>
|
|
|
+ <div @click="openTeaching('create')" class='newBand'>新建</div>
|
|
|
<!-- 搜索类型 -->
|
|
|
<!-- <el-form :inline="true"
|
|
|
class="searchForm"
|
|
@@ -31,26 +31,27 @@
|
|
|
<!-- 列表 -->
|
|
|
<div class="tableWrap">
|
|
|
<el-table :data='tableList'>
|
|
|
- <el-table-column align='center'
|
|
|
+ <el-table-column align='center' prop='id'
|
|
|
label="单位编号">
|
|
|
</el-table-column>
|
|
|
- <el-table-column align='center'
|
|
|
+ <el-table-column align='center' prop='name'
|
|
|
label="单位名称">
|
|
|
</el-table-column>
|
|
|
- <el-table-column align='center'
|
|
|
+ <el-table-column align='center' prop='linkman'
|
|
|
label="联系人">
|
|
|
</el-table-column>
|
|
|
- <el-table-column align='center'
|
|
|
+ <el-table-column align='center' prop='job'
|
|
|
label="职位">
|
|
|
</el-table-column>
|
|
|
- <el-table-column align='center'
|
|
|
+ <el-table-column align='center' prop='mobileNo'
|
|
|
label="手机号">
|
|
|
</el-table-column>
|
|
|
<el-table-column align='center'
|
|
|
- label="上课地点">
|
|
|
- </el-table-column>
|
|
|
- <el-table-column align='center'
|
|
|
- label="操作">
|
|
|
+ label="操作" width='100'>
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-button @click="openTeaching('update', scope.row)" type="text">修改</el-button>
|
|
|
+ <el-button @click="onDelete(scope.row)" type="text">删除</el-button>
|
|
|
+ </template>
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
|
<pagination :total="pageInfo.total"
|
|
@@ -61,24 +62,19 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
- <el-dialog title="添加合作单位" :visible.sync="teachingStatus" width="500px">
|
|
|
+ <el-dialog :title="formTitle[formActionTitle]" :visible.sync="teachingStatus" 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="username" :label-width="formLabelWidth">
|
|
|
- <el-input v-model="form.username" autocomplete="off"></el-input>
|
|
|
+ <el-form-item label="联系人" prop="linkman" :label-width="formLabelWidth">
|
|
|
+ <el-input v-model="form.linkman" autocomplete="off"></el-input>
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="职位" prop="position" :label-width="formLabelWidth">
|
|
|
- <el-input v-model="form.position" autocomplete="off"></el-input>
|
|
|
+ <el-form-item label="职位" prop="job" :label-width="formLabelWidth">
|
|
|
+ <el-input v-model="form.job" autocomplete="off"></el-input>
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="手机号" prop="phone" :label-width="formLabelWidth">
|
|
|
- <el-input v-model="form.phone" 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-input>
|
|
|
+ <el-form-item label="手机号" prop="mobileNo" :label-width="formLabelWidth">
|
|
|
+ <el-input v-model.number="form.mobileNo" autocomplete="off"></el-input>
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
|
<span slot="footer" class="dialog-footer">
|
|
@@ -86,16 +82,12 @@
|
|
|
<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-amap>
|
|
|
- </el-dialog>
|
|
|
</div>
|
|
|
</template>
|
|
|
<script>
|
|
|
import pagination from '@/components/Pagination/index'
|
|
|
+import { cooperationOrganAdd, cooperationOrganUpdate, queryPage } from '@/api/systemManage'
|
|
|
+import store from '@/store'
|
|
|
export default {
|
|
|
components: { pagination },
|
|
|
name: 'adminManager',
|
|
@@ -114,47 +106,72 @@ export default {
|
|
|
page_size: [10, 20, 40, 50] // 选择限制显示条数
|
|
|
},
|
|
|
teachingStatus: false, // 添加教学点
|
|
|
+ formActionTitle: 'create',
|
|
|
+ formTitle: {
|
|
|
+ create: '添加合作单位',
|
|
|
+ update: '修改合作单位'
|
|
|
+ },
|
|
|
formLabelWidth: '100px',
|
|
|
- addressDetail: {},
|
|
|
form: {
|
|
|
+ id: null,
|
|
|
name: null, // 教学点名称
|
|
|
- username: null, // 来源
|
|
|
- position: null, // 费用
|
|
|
- address: null, // 上课地点
|
|
|
- phone: null, // 合作单位
|
|
|
+ linkman: null, // 来源
|
|
|
+ job: null, // 费用
|
|
|
+ mobileNo: null, // 合作单位
|
|
|
+ organId: store.getters.organ
|
|
|
},
|
|
|
rules: {
|
|
|
name: [{ required: true, message: '请输入教学点名称', trigger: 'blur' }],
|
|
|
- username: [{required: true, message: '请输入联系人', trigger: 'blur'}],
|
|
|
- position: [{ required: true, message: '请输入职位', trigger: 'blur'}],
|
|
|
- address: [{required: true, message: '请选择上课地点', trigger: 'blur'}],
|
|
|
- phone: [
|
|
|
+ linkman: [{required: true, message: '请输入联系人', trigger: 'blur'}],
|
|
|
+ job: [{ required: true, message: '请输入职位', trigger: 'blur'}],
|
|
|
+ mobileNo: [
|
|
|
{required: true, message: '请输入手机号', trigger: 'blur'},
|
|
|
- { type: 'number', message: '手机号必须为数字', min: 11, max: 11}
|
|
|
+ { type: 'number', message: '手机号必须为数字'}
|
|
|
]
|
|
|
},
|
|
|
- addressMessage: true,
|
|
|
- mapStatus: false,
|
|
|
- zoom: 16,
|
|
|
- center: [114.34371, 30.55939],
|
|
|
- markers: [],
|
|
|
- plugin: [],
|
|
|
- searchOption: {
|
|
|
- city: '',
|
|
|
- citylimit: true,
|
|
|
- pageSize: 1, // 单页显示结果条数
|
|
|
- pageIndex: 1, // 页码
|
|
|
- autoFitView: true // 是否自动调整地图视野使绘制的 Marker点都处于视口的可见范围
|
|
|
- }
|
|
|
+
|
|
|
}
|
|
|
},
|
|
|
+ mounted() {
|
|
|
+ // console.log(store.getters.organ)
|
|
|
+ this.getList()
|
|
|
+ },
|
|
|
methods: {
|
|
|
+ onDelete(rows) {
|
|
|
+
|
|
|
+ },
|
|
|
onTeachingSubmit(formName) { // 添加数据
|
|
|
this.$refs[formName].validate((valid) => {
|
|
|
if (valid) {
|
|
|
- alert('submit!');
|
|
|
+ if(this.formActionTitle == 'create') {
|
|
|
+ cooperationOrganAdd(this.form).then(res => {
|
|
|
+ if(res.code == 200) {
|
|
|
+ this.$message({
|
|
|
+ message: '添加成功',
|
|
|
+ type: 'success'
|
|
|
+ })
|
|
|
+ this.teachingStatus = false
|
|
|
+ this.getList()
|
|
|
+ } else {
|
|
|
+ this.$message.error(res.msg)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ } else if(this.formActionTitle == 'update') {
|
|
|
+ cooperationOrganUpdate(this.form).then(res => {
|
|
|
+ // console.log(res)
|
|
|
+ if(res.code == 200) {
|
|
|
+ this.$message({
|
|
|
+ message: '修改成功',
|
|
|
+ type: 'success'
|
|
|
+ })
|
|
|
+ this.teachingStatus = false
|
|
|
+ this.getList()
|
|
|
+ } else {
|
|
|
+ this.$message.error(res.msg)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
} else {
|
|
|
- console.log('error submit!!');
|
|
|
return false;
|
|
|
}
|
|
|
})
|
|
@@ -163,55 +180,49 @@ export default {
|
|
|
this.teachingStatus = false
|
|
|
this.$refs[formName].clearValidate()
|
|
|
},
|
|
|
- addMap() { //
|
|
|
- this.mapStatus = true
|
|
|
- let poi = this.addressDetail
|
|
|
- // 获取经纬度
|
|
|
- if(poi.lnglat) {
|
|
|
- this.markers = []
|
|
|
- this.center = [poi.lnglat.lng, poi.lnglat.lat];
|
|
|
- this.markers.push([poi.lnglat.lng, poi.lnglat.lat])
|
|
|
- }
|
|
|
- },
|
|
|
- onSearchResult(pois) { // 搜索出来的Marker
|
|
|
- let latSum = 0
|
|
|
- let lngSum = 0
|
|
|
- if (pois.length > 0) {
|
|
|
- pois.forEach(poi => {
|
|
|
- let {lng, lat} = poi;
|
|
|
- lngSum += lng;
|
|
|
- latSum += lat;
|
|
|
- this.markers.push([poi.lng, poi.lat]);
|
|
|
- });
|
|
|
- let center = {
|
|
|
- lng: lngSum / pois.length,
|
|
|
- lat: latSum / pois.length
|
|
|
- };
|
|
|
- this.center = [center.lng, center.lat];
|
|
|
- }
|
|
|
+ getList() {
|
|
|
+ queryPage({
|
|
|
+ organId: this.form.organId
|
|
|
+ }).then(res => {
|
|
|
+ if(res.code == 200 && res.data) {
|
|
|
+ this.tableList = res.data.rows
|
|
|
+ }
|
|
|
+
|
|
|
+ })
|
|
|
},
|
|
|
- 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
|
|
|
- that.addressDetail = result.regeocode
|
|
|
- that.form.address = result.regeocode.formattedAddress
|
|
|
- that.mapStatus = false
|
|
|
- that.addressMessage = false
|
|
|
- } else {
|
|
|
- that.$message.error('请重新选择地址')
|
|
|
- }
|
|
|
- })
|
|
|
+ openTeaching(type, rows) {
|
|
|
+ this.teachingStatus = true
|
|
|
+ this.formActionTitle = type
|
|
|
+
|
|
|
+ // 修改的时候赋值
|
|
|
+ if(type == 'update') {
|
|
|
+ this.form = {
|
|
|
+ id: rows.id,
|
|
|
+ name: rows.name, // 教学点名称
|
|
|
+ linkman: rows.linkman, // 来源
|
|
|
+ job: rows.job, // 费用
|
|
|
+ mobileNo: rows.mobileNo ? Number(rows.mobileNo) : null, // 合作单位
|
|
|
}
|
|
|
}
|
|
|
- },
|
|
|
- getList () { }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
</script>
|
|
|
<style lang="scss">
|
|
|
+.el-input-group__append, .el-button--primary {
|
|
|
+ background: #14928a;
|
|
|
+ border-color: #14928a;
|
|
|
+ color: #fff;
|
|
|
+ &:hover, &:active {
|
|
|
+ background: #14928a;
|
|
|
+ border-color: #14928a;
|
|
|
+ color: #FFF;
|
|
|
+ }
|
|
|
+}
|
|
|
+.el-vue-search-box-container {
|
|
|
+ position: absolute !important;
|
|
|
+ left: 10px;
|
|
|
+ margin-top: 10px;
|
|
|
+ z-index: 99999 !important;
|
|
|
+}
|
|
|
</style>
|