Browse Source

党组织管理

origin/feature/monitoring
zhangyongzhangyong 4 years ago
parent
commit
f81b91fac9
  1. 52
      src/views/modules/sys/address-check.vue
  2. 255
      src/views/modules/sys/map-select.vue
  3. 358
      src/views/modules/sys/partyorg-add-or-update.vue
  4. 67
      src/views/modules/sys/partyorg.vue

52
src/views/modules/sys/address-check.vue

@ -0,0 +1,52 @@
<template>
<el-dialog
:visible.sync="visible"
title="地址确认"
:append-to-body="true"
:modal-append-to-body="false"
:close-on-click-modal="false"
:close-on-press-escape="false"
>
<el-form :model="dataForm" :label-width="$i18n.locale === 'en-US' ? '180px' : '140px'">
<el-form-item label="地址:">
<div>{{dataForm.address}}</div>
</el-form-item>
<el-form-item label="经度:">
<div>{{dataForm.longitude}}</div>
</el-form-item>
<el-form-item label="纬度:">
<div>{{dataForm.latitude}}</div>
</el-form-item>
</el-form>
<template slot="footer">
<el-button @click="checkOk()" type="primary">{{$t("confirm")}}</el-button>
</template>
</el-dialog>
</template>
<script>
export default {
data () {
return {
visible: false,
dataForm: {
address: '',
longitude: 0,//
latitude: 0,//
city: ''
}
}
},
methods: {
init (dataForm) {
this.visible = true
this.$nextTick(() => {
this.dataForm = dataForm
})
},
checkOk () {
this.$emit('checkOk', true)
this.visible = false
}
}
}
</script>

255
src/views/modules/sys/map-select.vue

@ -0,0 +1,255 @@
<template>
<div :close-on-click-modal="false" :close-on-press-escape="false">
<el-form
:inline="true"
:model="dataForm"
:label-width="$i18n.locale === 'en-US' ? '120px' : '120px'"
>
<el-row>
<el-form-item label="定位地点:" prop="address">
<el-input v-model="dataForm.address" type="text" clearable style="width:400px"></el-input>&emsp;
<el-button type="primary" @click="searchKeyword()">搜索</el-button>
</el-form-item>
</el-row>
<el-row>
<el-form-item label=" " prop="map">
<div>
<div id="container" style="width:500px;height:400px;"></div>
</div>
</el-form-item>
</el-row>
</el-form>
<address-check v-if="addressCheckVisible" ref="addressCheck" v-on:checkOk="checkOk"></address-check>
</div>
</template>
<script>
import jsonp from 'jsonp'
import AddressCheck from './address-check'
var searchService
export default {
name: 'maps',
data () {
return {
dataForm: {
address: '',
longitude: 0, //
latitude: 0, //
city: '',
type: 1,
radius: 200
},
visible: false,
addressCheckVisible: false
}
},
methods: {
init (type, radius) {
this.visible = true
this.dataForm.address = ''
this.dataForm.type = type
this.dataForm.radius = radius
this.getMyLocation()
console.log('this.dataForm.longitude')
console.log(this.dataForm.longitude)
},
getAddress (lat, lng) {
this.dataForm.longitude = lng
this.dataForm.latitude = lat
var url3 =
'https://apis.map.qq.com/ws/geocoder/v1/?location=' +
lat +
',' +
lng +
'&key=MQFBZ-LTWW6-R7XSK-MFXUQ-DVSIE-BGB4M&output=jsonp'
jsonp(url3, null, (err, data) => {
if (err) {
console.log(err)
}
console.log(data)
this.dataForm.address = data.result.address
})
},
getMyLocation () {
var geolocation = new qq.maps.Geolocation(
'MQFBZ-LTWW6-R7XSK-MFXUQ-DVSIE-BGB4M',
'e家党群-管理端'
)
geolocation.getIpLocation(this.showPosition, this.showErr)
},
showPosition (position) {
console.log(position)
this.dataForm.latitude = position.lat
this.dataForm.longitude = position.lng
this.dataForm.city = position.city
this.getAddress(position.lat,position.lng)
this.setMap()
},
showErr () {
console.log('定位失败')
this.getMyLocation() // 使
},
setMap () {
const that = this
var markerList = []
var radiusList = []
// map qq.maps.Map()
//
var myLatlng = new qq.maps.LatLng(
this.dataForm.latitude,
this.dataForm.longitude
)
//
var zoom = this.capacity()
var myOptions = {
zoom: zoom, //
center: myLatlng, //
mapTypeId: qq.maps.MapTypeId.ROADMAP // MapType
}
// dom
var map = new qq.maps.Map(
document.getElementById('container'),
myOptions
)
//
var radius = new qq.maps.Circle({
center: new qq.maps.LatLng(
this.dataForm.latitude,
this.dataForm.longitude
),
radius: this.dataForm.radius,
map: map
})
radiusList.push(radius)
var marker = new qq.maps.Marker({
position: myLatlng,
map: map
})
qq.maps.event.addListener(marker,'click',function (event) {
that.addressCheckHandle()
})
markerList.push(marker)
//
qq.maps.event.addListener(map, 'click', function (event) {
that.cleanMarkRadius(markerList, radiusList)
that.getAddress(event.latLng.lat, event.latLng.lng)
var myLatlng = new qq.maps.LatLng(event.latLng.lat, event.latLng.lng)
map.setCenter(myLatlng)
var marker = new qq.maps.Marker({
position: event.latLng,
map: map
})
//
var radius = new qq.maps.Circle({
center: new qq.maps.LatLng(event.latLng.lat, event.latLng.lng),
radius: that.dataForm.radius,
map: map
})
radiusList.push(radius)
markerList.push(marker)
qq.maps.event.addListener(map, 'click', function (event) {
that.cleanMarkRadius(markerList, radiusList)
})
qq.maps.event.addListener(marker, 'click', function (event) {
that.addressCheckHandle()
})
})
//
searchService = new qq.maps.SearchService({
complete: function (result) {
var pois = result.detail.pois
if (pois == null || pois.length <= 0) {
alert('未找到地址!')
that.getAddress(that.dataForm.latitude, that.dataForm.longitude)
return
}
map.setCenter(pois[0].latLng)
that.getAddress(pois[0].latLng.lat, pois[0].latLng.lng)
var marker = new qq.maps.Marker({
map: map,
position: pois[0].latLng
})
//
var radius = new qq.maps.Circle({
center: new qq.maps.LatLng(pois[0].latLng.lat, pois[0].latLng.lng),
radius: that.dataForm.radius,
map: map
})
radiusList.push(radius)
markerList.push(marker)
that.cleanMarkRadius(markerList, radiusList)
qq.maps.event.addListener(marker, 'click', function (event) {
that.addressCheckHandle()
})
}
})
},
searchKeyword () {
searchService.setLocation(this.dataForm.city)
searchService.search(this.dataForm.address)
},
addressCheckHandle () {
if (this.dataForm.address === '' || !(this.dataForm.latitude > 0)) {
alert('请选择地址!')
return
}
this.addressCheckVisible = true
this.$nextTick(() => {
this.$refs.addressCheck.init(this.dataForm)
})
},
checkOk (checkOk) {
if (checkOk) {
this.$emit('position', this.dataForm)
this.visible = false
}
},
cleanMarkRadius (markerList, radiusList) {
if (markerList) {
if (markerList.length > 1) {
for (var i4 = 0; i4 < markerList.length - 1; i4++) {
markerList[i4].setMap(null)
}
} else {
for (var i3 = 0; i3 < markerList.length; i3++) {
markerList[i3].setMap(null)
}
}
}
if (radiusList) {
if (radiusList.length > 1) {
for (var i2 = 0; i2 < radiusList.length - 1; i2++) {
radiusList[i2].setMap(null)
}
} else {
for (var i1 = 0; i1 < markerList.length; i1++) {
radiusList[i1].setMap(null)
}
}
}
},
capacity () {
if (this.dataForm.radius > 0 && this.dataForm.radius <= 25) {
return 18
} else if (this.dataForm.radius > 25 && this.dataForm.radius <= 50) {
return 17
} else if (this.dataForm.radius > 50 && this.dataForm.radius <= 100) {
return 16
} else if (this.dataForm.radius > 100 && this.dataForm.radius <= 200) {
return 15
} else if (this.dataForm.radius > 200 && this.dataForm.radius <= 500) {
return 14
} else if (this.dataForm.radius > 500 && this.dataForm.radius <= 1000) {
return 13
} else if (this.dataForm.radius > 1000 && this.dataForm.radius <= 2000) {
return 12
} else if (this.dataForm.radius > 2000 && this.dataForm.radius <= 5000) {
return 11
}
}
},
components: {
AddressCheck
}
}
</script>

358
src/views/modules/sys/partyorg-add-or-update.vue

@ -0,0 +1,358 @@
<template>
<el-dialog :visible.sync="visible" :title="!dataForm.id ? $t('add') : $t('update')" :close-on-click-modal="false" :close-on-press-escape="false">
<el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmitHandle()" :label-width="$i18n.locale === 'en-US' ? '140px' : '100px'">
<el-form-item label="所属组织" prop="deptId">
<el-cascader v-model="dataForm.allDeptIdArr"
:options="options"
ref="org"
:props="{ checkStrictly: true }"
@change="allDeptIdsChangeHandle"
style="width: 100%"
show-overflow-tooltip
clearable>
</el-cascader>
</el-form-item>
<el-form-item label="党组织类型" prop="typeCode">
<el-select v-model="dataForm.typeCode" clearable
placeholder="请选择" style="width: 100%">
<el-option v-for="item in orgTypeOptions"
:key="item.tagValue"
:label="item.tagName"
:value="item.tagValue">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="党组织名称" prop="partyOrgName">
<el-input v-model="dataForm.partyOrgName" placeholder="党组织名称(20字以内)" maxlength="20" show-word-limit></el-input>
</el-form-item>
<el-form-item label="党组织介绍" prop="introduction">
<el-input v-model="dataForm.introduction" type="textarea" autosize maxlength="500" show-word-limit placeholder="党组织介(500字以内)"></el-input>
</el-form-item>
<el-form-item label="两委干部" prop="twoCommittees">
<el-input v-model="dataForm.twoCommittees" placeholder="两委干部" maxlength="100" show-word-limit></el-input>
</el-form-item>
<el-form-item label="党员数量" prop="partyMemberNum">
<el-input-number v-model="dataForm.partyMemberNum" :min="0" :max="999990000"></el-input-number>
</el-form-item>
<el-form-item label="经度" prop="longitude">
<el-input v-model="dataForm.longitude" :disabled = "true" placeholder="经度" style="width: 82%"></el-input>&emsp;
<el-button type="primary"
@click="mapSelectHandle(2)">地图选择</el-button>
</el-form-item>
<el-form-item label="纬度" prop="latitude">
<el-input v-model="dataForm.latitude" :disabled = "true" placeholder="纬度"></el-input>
</el-form-item>
</el-form>
<template slot="footer">
<el-button @click="visible = false">{{ $t('cancel') }}</el-button>
<el-button type="primary" @click="dataFormSubmitHandle()">{{ $t('confirm') }}</el-button>
</template>
<map-select v-if="mapSelectVisible"
ref="mapSelect"
v-on:position="position"></map-select>
</el-dialog>
</template>
<script>
import debounce from 'lodash/debounce'
import MapSelect from './map-select'
export default {
data () {
return {
visible: false,
dataForm: {
id: '',
partyOrgName: '',
introduction: '',
twoCommittees: '',
partyMemberNum: '',
longitude: '',
latitude: '',
deptName: '',
deptId: '',
typeCode: '',
allDeptIdArr: []
},
orgTypeOptions: [],
options: [],
mapSelectVisible: false
}
},
computed: {
dataRule () {
return {
partyOrgName: [
{ required: true, message: this.$t('validate.required'), trigger: 'blur' }
],
twoCommittees: [
{ required: true, message: this.$t('validate.required'), trigger: 'blur' }
],
partyMemberNum: [
{ required: true, message: this.$t('validate.required'), trigger: 'blur' }
],
longitude: [
{ required: true, message: this.$t('validate.required'), trigger: 'blur' }
],
latitude: [
{ required: true, message: this.$t('validate.required'), trigger: 'blur' }
],
deptId: [
{ required: true, message: this.$t('validate.required'), trigger: 'blur' }
],
typeCode: [
{ required: true, message: this.$t('validate.required'), trigger: 'blur' }
]
}
}
},
components: {
MapSelect
},
methods: {
init () {
this.visible = true
this.getOrgTypeOptions()
this.getOptions()
this.$nextTick(() => {
this.$refs['dataForm'].resetFields()
if (this.dataForm.id) {
this.getInfo()
}
})
},
//
getOrgTypeOptions () {
this.$http
.get(`/sys/partyorgtype/getPartyOrgType`)
.then(({ data: res }) => {
if (res.code !== 0) {
return this.$message.error(res.msg)
}
this.orgTypeOptions = res.data
})
.catch(() => { })
},
//
getOptions () {
this.$http.get(`/sys/user/deptOptions/getByLoginUser`).then(({ data: res }) => {
if (res.code !== 0) {
return this.$message.error(res.msg)
}
this.options = res.data.options
}).catch(() => { })
},
allDeptIdsChangeHandle (value, selectedData) {
this.dataForm.deptName = this.$refs['org'].getCheckedNodes()[0].label
this.dataForm.deptId = this.$refs['org'].getCheckedNodes()[0].value
},
//
position (position) {
// this.dataForm.actAddress = position.address
this.dataForm.latitude = position.latitude
this.dataForm.longitude = position.longitude
this.mapSelectVisible = false
},
mapSelectHandle (type) {
this.mapSelectVisible = true
this.$nextTick(() => {
this.$refs.mapSelect.init(type, 200)
})
},
//
getInfo () {
this.$http.get(`/sys/partyorg/${this.dataForm.id}`).then(({ data: res }) => {
if (res.code !== 0) {
return this.$message.error(res.msg)
}
this.dataForm = {
...this.dataForm,
...res.data
}
}).catch(() => {})
},
//
dataFormSubmitHandle: debounce(function () {
this.$refs['dataForm'].validate((valid) => {
if (!valid) {
return false
}
this.$http[!this.dataForm.id ? 'post' : 'put']('/sys/partyorg/', this.dataForm).then(({ data: res }) => {
if (res.code !== 0) {
return this.$message.error(res.msg)
}
this.$message({
message: this.$t('prompt.success'),
type: 'success',
duration: 500,
onClose: () => {
this.visible = false
this.$emit('refreshDataList')
}
})
}).catch(() => {})
})
}, 1000, { 'leading': true, 'trailing': false })
}
}
</script>
<style>
.avatar-uploader .el-upload {
border: 1px dashed #d9d9d9;
border-radius: 6px;
cursor: pointer;
position: relative;
overflow: hidden;
}
.avatar-uploader .el-upload:hover {
border-color: #409eff;
}
.avatar-uploader-icon {
font-size: 28px;
color: #8c939d;
width: 178px;
height: 178px;
line-height: 178px;
text-align: center;
}
.avatar {
width: 178px;
height: 178px;
display: block;
}
</style>
<style lang="scss">
.project-handle {
.el-timeline {
padding-left: 9px;
font-size: 13px;
}
.el-textarea {
width: 600px !important;
}
.el-input {
width: 600px !important;
}
}
.el-form-item__label {
font-weight: bold;
}
</style>
<style lang="scss" scoped>
.project-handle {
width: 100%;
height: calc(100vh - 120px);
background: #ffffff;
box-sizing: border-box;
padding: 10px;
.project-detail {
width: 100%;
height: 49%;
border: 2px solid #ccc;
box-sizing: border-box;
padding: 10px;
padding-top: 20px;
float: left;
margin-bottom: 1%;
position: relative;
.project-detail-tip {
position: absolute;
top: 0;
left: 0;
width: 80px;
height: 30px;
line-height: 30px;
color: #ffffff;
background: #4ac38b;
text-align: center;
}
.el-form {
width: 58%;
height: 100%;
float: left;
overflow-y: auto;
&::-webkit-scrollbar {
width: 5px;
height: 1px;
}
&::-webkit-scrollbar-thumb {
border-radius: 5px;
background: #ccc;
}
&::-webkit-scrollbar-track {
border-radius: 10px;
background: #fff;
}
}
.container {
width: 40%;
height: 100%;
float: right;
.location {
height: 30px;
line-height: 30px;
}
#map {
width: 100%;
height: calc(100% - 30px);
}
}
}
.project-progress {
width: 20%;
height: 100%;
float: right;
border: 2px solid #ccc;
box-sizing: border-box;
margin-left: 1%;
padding-top: 20px;
overflow-y: auto;
&::-webkit-scrollbar {
width: 5px;
height: 1px;
}
&::-webkit-scrollbar-thumb {
border-radius: 5px;
background: #aaa;
}
&::-webkit-scrollbar-track {
border-radius: 10px;
background: #ccc;
}
}
.handle-operation {
padding-top: 30px;
box-sizing: border-box;
width: 100%;
height: 49%;
box-sizing: border-box;
border: 2px solid #ccc;
float: left;
position: relative;
overflow-y: auto;
&::-webkit-scrollbar {
width: 5px;
height: 1px;
}
&::-webkit-scrollbar-thumb {
border-radius: 5px;
background: #aaa;
}
&::-webkit-scrollbar-track {
border-radius: 10px;
background: #ccc;
}
.handle-operation-tip {
position: absolute;
top: 0;
left: 0;
width: 80px;
height: 30px;
line-height: 30px;
color: #ffffff;
background: #ff7600;
text-align: center;
}
}
}
</style>

67
src/views/modules/sys/partyorg.vue

@ -0,0 +1,67 @@
<template>
<el-card shadow="never" class="aui-card--fill">
<div class="mod-sys__partyorg}">
<el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
<el-form-item>
<el-input v-model="dataForm.id" placeholder="id" clearable></el-input>
</el-form-item>
<el-form-item>
<el-button @click="getDataList()">{{ $t('query') }}</el-button>
</el-form-item>
<el-form-item>
<el-button v-if="$hasPermission('sys:partyorg:save')" type="primary" @click="addOrUpdateHandle()">{{ $t('add') }}</el-button>
</el-form-item>
<el-form-item>
<el-button v-if="$hasPermission('sys:partyorg:delete')" type="danger" @click="deleteHandle()">{{ $t('deleteBatch') }}</el-button>
</el-form-item>
</el-form>
<el-table v-loading="dataListLoading" :data="dataList" border @selection-change="dataListSelectionChangeHandle" style="width: 100%;">
<el-table-column type="selection" header-align="center" align="center" width="50"></el-table-column>
<el-table-column prop="allDeptNames" label="所属组织" header-align="center" align="center"></el-table-column>
<el-table-column prop="partyOrgName" label="党组织名称" header-align="center" align="center"></el-table-column>
<el-table-column prop="typeName" label="党组织类型" header-align="center" align="center"></el-table-column>
<el-table-column :label="$t('handle')" fixed="right" header-align="center" align="center" width="150">
<template slot-scope="scope">
<el-button v-if="$hasPermission('sys:partyorg:update')" type="text" size="small" @click="addOrUpdateHandle(scope.row.id)">{{ $t('update') }}</el-button>
<el-button v-if="$hasPermission('sys:partyorg:delete')" type="text" size="small" @click="deleteHandle(scope.row.id)">{{ $t('delete') }}</el-button>
</template>
</el-table-column>
</el-table>
<el-pagination
:current-page="page"
:page-sizes="[10, 20, 50, 100]"
:page-size="limit"
:total="total"
layout="total, sizes, prev, pager, next, jumper"
@size-change="pageSizeChangeHandle"
@current-change="pageCurrentChangeHandle">
</el-pagination>
<!-- 弹窗, 新增 / 修改 -->
<add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update>
</div>
</el-card>
</template>
<script>
import mixinViewModule from '@/mixins/view-module'
import AddOrUpdate from './partyorg-add-or-update'
export default {
mixins: [mixinViewModule],
data () {
return {
mixinViewModuleOptions: {
getDataListURL: '/sys/partyorg/page',
getDataListIsPage: true,
deleteURL: '/sys/partyorg',
deleteIsBatch: true
},
dataForm: {
id: ''
}
}
},
components: {
AddOrUpdate
}
}
</script>
Loading…
Cancel
Save