Browse Source

ss

shibei_master
dai 4 years ago
parent
commit
fae02aa3c2
  1. 543
      src/views/modules/communityService/shzz/cpts/edit.vue
  2. 551
      src/views/modules/communityService/shzz/index.vue

543
src/views/modules/communityService/shzz/cpts/edit.vue

@ -0,0 +1,543 @@
<template>
<div>
<div>
<div v-show="!propertyFormShow">
<el-form ref="ref_form"
:inline="true"
:model="dataForm"
:rules="dataRule"
:disabled="formType === 'detail'"
class="form">
<el-form-item label="所属组织"
label-width="150px"
style="display: block">
<span>{{ dataForm.agencyName }}</span>
</el-form-item>
<el-form-item label="所属网格"
prop="gridId"
label-width="150px"
style="display: block">
<el-select class="item_width_1"
v-model="dataForm.gridId"
placeholder="请选择"
clearable>
<el-option v-for="item in gridList"
:key="item.gridId"
:label="item.gridName"
:value="item.gridId">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="小区名称"
prop="neighborHoodName"
label-width="150px"
style="display: block">
<el-input class="item_width_1"
maxlength="50"
show-word-limit
placeholder="请输入小区名称"
v-model="dataForm.neighborHoodName">
</el-input>
</el-form-item>
<el-form-item label="关联物业"
prop="propertyId"
label-width="150px"
style="display: block">
<el-select class="item_width_2"
v-model="dataForm.propertyId"
placeholder="请选择"
filterable
clearable>
<el-option v-for="item in propertyList"
:key="item.propertyId"
:label="item.propertyName"
:value="item.propertyId">
</el-option>
</el-select>
<el-button style="margin-left: 10px"
type="primary"
size="small"
@click="handleAddProperty">添加物业</el-button>
</el-form-item>
<el-form-item label="详细地址"
prop="address"
label-width="150px"
style="display: block">
<el-input class="item_width_1"
maxlength="50"
show-word-limit
placeholder="请输入详细地址"
v-model="dataForm.address">
</el-input>
</el-form-item>
<el-form-item label="备注"
prop="remark"
label-width="150px"
style="display: block">
<el-input class="item_width_1"
type="textarea"
maxlength="500"
show-word-limit
:rows="3"
placeholder="请输入备注,不超过500字"
v-model="dataForm.remark"></el-input>
</el-form-item>
<el-form-item label="位置坐标"
prop="longitude"
label-width="150px"
style="display: block">
<div style="width:500px">
<el-input class="item_width_4"
maxlength="50"
placeholder="请输入关键字"
v-model="keyWords">
</el-input>
<el-button style="margin-left: 10px"
type="primary"
size="small"
@click="handleSearchMap">查询</el-button>
<div id="app"
class="div_map"></div>
<div style="margin-top: 10px">
<span>经度</span>
<el-input class="item_width_3"
maxlength="50"
placeholder="请输入经度"
v-model="dataForm.longitude">
</el-input>
<span style="margin-left: 20px">纬度</span>
<el-input class="item_width_3"
maxlength="50"
placeholder="请输入纬度"
v-model="dataForm.latitude">
</el-input>
</div>
</div>
</el-form-item>
</el-form>
</div>
<div v-show="propertyFormShow">
<el-form :inline="false"
:model="propertyForm"
:rules="propertyRule"
class="form">
<el-form-item label="物业名称"
prop="name"
label-width="150px"
style="display: block">
<el-input class="item_width_1"
maxlength="10"
placeholder="请输入小区名称"
v-model="propertyForm.name">
</el-input>
</el-form-item>
</el-form>
</div>
</div>
<div class="div_btn">
<el-button @click="handleCancle"> </el-button>
<el-button v-if="formType != 'detail'"
type="primary"
:disabled="btnDisable"
@click="handleComfirm"> </el-button>
</div>
</div>
</template>
<script>
import { mapGetters } from 'vuex'
import { Loading } from 'element-ui' // Loading
import { requestPost } from '@/js/dai/request'
var map
var search
var markers
var infoWindowList
let loading //
export default {
data () {
return {
formType: 'add', // addeditdetail
gridList: [],
propertyList: [],
btnDisable: false,
neighborHoodId: '', //ID
dataForm: {
neighborHoodName: '', // 50
agencyId: '', // ID
agencyName: '',
gridId: '', //ID
propertyId: '', //
address: '', //
remark: '', //500
location: '', //
longitude: '', //
latitude: '' //
},
propertyFormShow: false,
propertyForm: {
name: ''
},
keyWords: '',
agencyObj: {}
}
},
components: {},
mounted () {
this.initMap()
},
methods: {
// init
initMap () {
//
var center = new window.TMap.LatLng(36.0722275, 120.38945519)
// map TMap.Map()
map = new window.TMap.Map(document.getElementById('app'), {
center: center, //
zoom: 17.2, //
pitch: 43.5, //
rotation: 45 //
})
search = new window.TMap.service.Search({ pageSize: 10 })
//
markers = new TMap.MultiMarker({
map: map,
geometries: []
})
infoWindowList = Array(10)
//
map.on('panend', () => {
this.handleMoveCenter()
})
this.handleMoveCenter()
},
setMarker (lat, lng) {
markers.setGeometries([])
markers.add([
{
id: '4',
styleId: 'marker',
position: new TMap.LatLng(lat, lng),
properties: {
title: 'marker4'
}
}
])
},
handleSearchMap () {
infoWindowList.forEach((infoWindow) => {
infoWindow.close()
})
infoWindowList.length = 0
markers.setGeometries([])
//
search
.searchRectangle({
keyword: this.keyWords,
bounds: map.getBounds()
})
.then((result) => {
let { data } = result
if (Array.isArray(data) && data.length > 0) {
const {
location: { lat, lng }
} = data[0]
map.setCenter(new TMap.LatLng(lat, lng))
this.setMarker(lat, lng)
this.dataForm.latitude = lat
this.dataForm.longitude = lng
} else {
this.$message.error('未检索到相关位置坐标')
}
})
},
handleMoveCenter () {
//
const center = map.getCenter()
const lat = center.getLat()
const lng = center.getLng()
this.dataForm.latitude = lat
this.dataForm.longitude = lng
this.setMarker(lat, lng)
},
async initForm (type, row, agencyObj) {
this.$refs.ref_form.resetFields();
this.agencyObj = agencyObj
// debugger
map.setCenter(new TMap.LatLng(agencyObj.latitude, agencyObj.longitude))
this.formType = type
if (row) {
this.dataForm = JSON.parse(JSON.stringify(row))
this.neighborHoodId = this.dataForm.neighborHoodId
}
await this.loadAgency()
await this.loadGrid()
await this.loadProperty()
},
//
async loadAgency () {
const url = '/epmetuser/customerstaff/staffbasicinfo'
let params = {}
const { data, code, msg } = await requestPost(url, params)
if (code === 0) {
this.dataForm.agencyId = data.agencyId
this.dataForm.agencyName = data.agencyName
} else {
this.$message.error(msg)
}
},
//
async loadGrid () {
const url = '/gov/org/grid/allgridsnopermission '
// const url = "https://epmet-dev.elinkservice.cn:7082/api/apimock-v2/95518686fa128a53f64c678906848062/gov/org/grid/allgrids"
let params = {
agencyId: this.dataForm.agencyId
}
const { data, code, msg } = await requestPost(url, params)
if (code === 0) {
this.gridList = data
} else {
this.$message.error(msg)
}
},
//
async loadProperty () {
const url = '/gov/org/propertymanagement/list'
// const url = "http://yapi.elinkservice.cn/mock/245/gov/org/propertymanagement/list"
let params = {}
const { data, code, msg } = await requestPost(url, params)
if (code === 0) {
this.propertyList = data
} else {
this.$message.error(msg)
}
},
handleAddProperty () {
this.propertyForm.name = ''
this.propertyFormShow = true
},
async handleComfirm () {
if (this.propertyFormShow) {
this.addProperty()
} else {
this.btnDisable = true
setTimeout(() => {
this.btnDisable = false
}, 10000)
this.$refs['ref_form'].validate((valid, messageObj) => {
if (!valid) {
app.util.validateRule(messageObj)
this.btnDisable = false
} else {
this.addCommunity()
}
})
}
},
async addCommunity () {
let url = ''
if (this.formType === 'add') {
url = '/gov/org/neighborhood/neighborhoodadd'
// url = "http://yapi.elinkservice.cn/mock/245/gov/org/neighborhood/neighborhoodadd"
} else {
url = '/gov/org/neighborhood/neighborhoodupdate'
this.dataForm.neighborHoodId = this.neighborHoodId
}
const { data, code, msg } = await requestPost(url, this.dataForm)
if (code === 0) {
this.$message({
type: 'success',
message: '添加小区成功'
})
this.resetData()
this.$emit('dialogOk')
this.btnDisable = false
} else {
this.btnDisable = false
this.$message.error(msg)
}
},
async addProperty () {
if (!this.propertyForm.name || this.propertyForm.name === '') {
this.$message({
type: 'error',
message: '物业名称不能为空'
})
return false
}
const url = '/gov/org/propertymanagement/add'
// const url = "http://yapi.elinkservice.cn/mock/245/gov/org/propertymanagement/add"
let params = {
name: this.propertyForm.name
}
const { data, code, msg } = await requestPost(url, params)
if (code === 0) {
this.$message({
type: 'success',
message: '操作成功'
})
this.dataForm.propertyId = data.propertyId
this.propertyForm.name = ''
this.propertyFormShow = false
this.loadProperty()
} else {
this.$message.error(msg)
}
},
handleCancle () {
if (this.propertyFormShow) {
this.propertyForm.name = ''
this.propertyFormShow = false
} else {
this.resetData()
this.$emit('dialogCancle')
}
},
resetData () {
this.keyWords = ''
this.neighborHoodId = '' //ID
this.dataForm = {
neighborHoodName: '', // 50
agencyId: '', // ID
agencyName: '',
gridId: '', //ID
propertyId: '', //
address: '', //
remark: '', //500
location: '', //
longitude: '', //
latitude: '' //
}
this.propertyFormShow = false
},
//
startLoading () {
loading = Loading.service({
lock: true, //
text: '正在加载……', //
background: 'rgba(0,0,0,.7)' //
})
},
//
endLoading () {
// clearTimeout(timer);
if (loading) {
loading.close()
}
}
},
computed: {
dataRule () {
return {
neighborHoodName: [
{ required: true, message: '小区名称不能为空', trigger: 'blur' },
{
min: 1,
max: 50,
message: '小区名称长度在 1 到 50个字符',
trigger: 'blur'
}
],
agencyId: [
{ required: true, message: '所属组织不能为空', trigger: 'blur' }
],
gridId: [
{ required: true, message: '所属网格不能为空', trigger: 'blur' }
],
address: [
{ required: true, message: '详细地址不能为空', trigger: 'blur' }
],
longitude: [
{ required: true, message: '坐标不能为空', trigger: 'blur' }
]
}
},
propertyRule () {
name: [
{ required: true, message: '物业名称不能为空', trigger: 'blur' }
// { min: 1, max: 50, message: ' 1 50', trigger: 'blur' }
]
}
},
props: {}
}
</script>
<style scoped>
.item_width_1 {
width: 500px;
}
.item_width_2 {
width: 400px;
}
.item_width_3 {
margin-left: 10px;
width: 200px;
}
.item_width_4 {
width: 200px;
}
.div_map {
margin-top: 10px;
}
.div_btn {
display: flex;
justify-content: flex-end;
}
.el-tabs {
margin: 0 20px;
}
.el-upload__tip {
color: rgb(155, 155, 155);
margin: 0;
}
.form {
margin-top: 30px;
}
</style>
<style>
.el-dialog__body {
padding: 0 10px 20px !important;
}
</style>

551
src/views/modules/communityService/shzz/index.vue

@ -0,0 +1,551 @@
<template>
<div>
<div class="resi-container">
<el-card class="resi-card">
<el-row class="resi-row-box" :class="openSearch && 'resi-row-more'">
<el-row class="resi-row" :gutter="20">
<el-col :span="8">
<div class="resi-cell">
<div class="resi-cell-label">组织名称</div>
<div class="resi-cell-value" :class="'resi-cell-value-radio'">
<el-input
v-model="fmData.societyName"
class="resi-cell-input"
size="small"
clearable
placeholder="请输入"
>
</el-input>
</div>
</div>
</el-col>
<el-col :span="8">
<div class="resi-cell">
<div class="resi-cell-label">负责人</div>
<div class="resi-cell-value" :class="'resi-cell-value-radio'">
<el-input
v-model="fmData.personInCharge"
class="resi-cell-input"
size="small"
clearable
placeholder="请输入"
>
</el-input>
</div>
</div>
</el-col>
<el-col :span="8">
<div class="resi-cell">
<div class="resi-cell-label">联系电话</div>
<div class="resi-cell-value" :class="'resi-cell-value-radio'">
<el-input
v-model="fmData.mobile"
class="resi-cell-input"
size="small"
clearable
placeholder="请输入"
>
</el-input>
</div>
</div>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<div class="resi-cell">
<div class="resi-cell-label">服务时间</div>
<div class="resi-cell-value" :class="'resi-cell-value-radio'">
<el-date-picker
v-model="fmData.serviceTime"
type="daterange"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
value-format="yyyy-MM-dd"
>
</el-date-picker>
</div>
</div>
</el-col>
</el-row>
</el-row>
<el-row class="resi-search">
<el-col :span="24">
<el-button type="primary" size="small" @click="handleSearch"
>查询</el-button
>
</el-col>
</el-row>
</el-card>
</div>
<el-card class="resi-card-table">
<div class="resi-row-btn">
<el-button type="success" size="small" @click="handleAdd"
>新增</el-button
>
<el-button @click="handleRu" type="warning" size="small"
>excel导入</el-button
>
<el-button @click="handleChu" type="danger" size="small"
>excel导出</el-button
>
</div>
<el-table
:data="tableData"
border
style="width: 100%"
class="resi-table"
:max-height="maxTableHeight"
>
<el-table-column label="序号" type="index" align="center" width="50" />
<el-table-column prop="societyName" label="社会组织名称">
</el-table-column>
<el-table-column prop="serviceMatters" label="服务事项">
</el-table-column>
<el-table-column prop="personInCharge" label="负责人">
</el-table-column>
<el-table-column prop="mobile" label="负责人电话"> </el-table-column>
<el-table-column prop="serviceTime" label="服务时间"> </el-table-column>
<el-table-column fixed="right" label="操作" align="center" width="120">
<template slot-scope="scope">
<el-button
@click="handleWatch(scope.row, scope.$index)"
type="text"
size="small"
>查看</el-button
>
<el-button
@click="handleEdit(scope.row)"
type="text"
size="small"
style="margin-right: 10px; color: #00a7a9"
>编辑</el-button
>
<el-popconfirm
title="删除之后无法回复,确认删除?"
@onConfirm="handleDel(scope.row, scope.$index)"
@confirm="handleDel(scope.row, scope.$index)"
>
<el-button
slot="reference"
type="text"
size="small"
style="color: #d51010"
>删除</el-button
>
</el-popconfirm>
</template>
</el-table-column>
</el-table>
<div>
<el-pagination
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page.sync="pageNo"
:page-sizes="[20, 50, 100, 200]"
:page-size="parseInt(pageSize)"
layout="sizes, prev, pager, next"
:total="total"
>
</el-pagination>
</div>
</el-card>
<!-- 修改弹出框 -->
<el-dialog
:visible.sync="formShow"
:close-on-click-modal="false"
:close-on-press-escape="false"
:title="formTitle"
width="850px"
top="5vh"
@closed="handleClose"
>
<edit-form
ref="ref_form"
@dialogCancle="handleClose"
@dialogOk="handleEditSuccess"
></edit-form>
</el-dialog>
</div>
</template>
<script>
import { requestPost } from "@/js/dai/request";
import nextTick from "dai-js/tools/nextTick";
import { mapGetters } from "vuex";
import editForm from "./cpts/edit";
export default {
components: { editForm },
data() {
return {
openSearch: false,
formShow: false,
formTitle: "",
formShow: false,
pageNo: 1,
pageSize: window.localStorage.getItem("pageSize") || 20,
total: 1,
tableData: [
{
societyName: "亿联科技",
personInCharge: "嘻嘻",
serviceMatters: "1111111111111",
mobile: "13512345678",
serviceTime: "2001-1-1至2022-2-2",
},
{
societyName: "亿联科技",
personInCharge: "嘻嘻",
serviceMatters: "1111111111111",
mobile: "13512345678",
serviceTime: "2001-1-1至2022-2-2",
},
{
societyName: "亿联科技",
personInCharge: "嘻嘻",
serviceMatters: "1111111111111",
mobile: "13512345678",
serviceTime: "2001-1-1至2022-2-2",
},
{
societyName: "亿联科技",
personInCharge: "嘻嘻",
serviceMatters: "1111111111111",
mobile: "13512345678",
serviceTime: "2001-1-1至2022-2-2",
},
{
societyName: "亿联科技",
personInCharge: "嘻嘻",
serviceMatters: "1111111111111",
mobile: "13512345678",
serviceTime: "2001-1-1至2022-2-2",
},
{
societyName: "亿联科技",
personInCharge: "嘻嘻",
serviceMatters: "1111111111111",
mobile: "13512345678",
serviceTime: "2001-1-1至2022-2-2",
},
{
societyName: "亿联科技",
personInCharge: "嘻嘻",
serviceMatters: "1111111111111",
mobile: "13512345678",
serviceTime: "2001-1-1至2022-2-2",
},
{
societyName: "亿联科技",
personInCharge: "嘻嘻",
serviceMatters: "1111111111111",
mobile: "13512345678",
serviceTime: "2001-1-1至2022-2-2",
},
{
societyName: "亿联科技",
personInCharge: "嘻嘻",
serviceMatters: "1111111111111",
mobile: "13512345678",
serviceTime: "2001-1-1至2022-2-2",
},
{
societyName: "亿联科技",
personInCharge: "嘻嘻",
serviceMatters: "1111111111111",
mobile: "13512345678",
serviceTime: "2001-1-1至2022-2-2",
},
{
societyName: "亿联科技",
personInCharge: "嘻嘻",
serviceMatters: "1111111111111",
mobile: "13512345678",
serviceTime: "2001-1-1至2022-2-2",
},
{
societyName: "亿联科技",
personInCharge: "嘻嘻",
serviceMatters: "1111111111111",
mobile: "13512345678",
serviceTime: "2001-1-1至2022-2-2",
},
{
societyName: "亿联科技",
personInCharge: "嘻嘻",
serviceMatters: "1111111111111",
mobile: "13512345678",
serviceTime: "2001-1-1至2022-2-2",
},
{
societyName: "亿联科技",
personInCharge: "嘻嘻",
serviceMatters: "1111111111111",
mobile: "13512345678",
serviceTime: "2001-1-1至2022-2-2",
},
{
societyName: "亿联科技",
personInCharge: "嘻嘻",
serviceMatters: "1111111111111",
mobile: "13512345678",
serviceTime: "2001-1-1至2022-2-2",
},
{
societyName: "亿联科技",
personInCharge: "嘻嘻",
serviceMatters: "1111111111111",
mobile: "13512345678",
serviceTime: "2001-1-1至2022-2-2",
},
{
societyName: "亿联科技",
personInCharge: "嘻嘻",
serviceMatters: "1111111111111",
mobile: "13512345678",
serviceTime: "2001-1-1至2022-2-2",
},
],
fmData: {
societyName: "",
personInCharge: "",
mobile: "",
serviceStartTime: "",
serviceEndTime: "",
serviceTime: "",
},
};
},
computed: {
maxTableHeight() {
return this.clientHeight - 450;
},
...mapGetters(["clientHeight"]),
},
watch: {
"fmData.serviceTime": function (val) {
if (Array.isArray(val) && val.length == 2) {
this.fmData.serviceStartTime = val[0];
this.fmData.serviceEndTime = val[1];
}
},
},
mounted() {
this.getTableData();
},
methods: {
handleSizeChange(val) {
console.log(`每页 ${val}`);
this.pageSize = val;
window.localStorage.setItem("pageSize", val);
this.getTableData();
},
handleCurrentChange(val) {
console.log(`当前页: ${val}`);
this.pageNo = val;
this.getTableData();
},
handleClose() {
this.formShow = false;
},
handleSearch(val) {
console.log(this.fmData);
this.pageNo = 1;
this.getTableData();
},
handleAdd() {
this.formShow = true;
},
handleRu() {},
handleChu() {},
handleWatch(rowData, rowIndex) {
console.log(rowData, rowIndex);
this.formShow = true;
},
handleEdit(rowData, rowIndex) {
this.formShow = true;
},
handleEditSuccess() {
this.handleClose();
this.getTableData();
},
async handleDel(rowData, rowIndex) {
console.log(rowData, rowIndex);
const url = "/heart/societyorg/del";
const { tableData } = this;
const { data, code, msg } = await requestPost(url, {
societyId: tableData[rowIndex].societyId,
});
if (code === 0) {
this.$message.success("删除成功!");
this.getTableData();
} else {
this.$message.success("操作失败!");
}
},
async getTableData() {
const url = "/heart/societyorg/getlist";
const { pageSize, pageNo, fmData } = this;
const { data, code, msg } = await requestPost(url, {
pageSize,
pageNo,
...fmData,
});
if (code === 0) {
console.log("列表请求成功!!!!!!!!!!!!!!");
this.total = data.total;
this.tableData = data.list.map((item) => {
item.serviceTime = item.serviceStartTime + "至" + item.serviceEndTime;
return item;
});
} else {
}
},
},
};
</script>
<style lang="scss" scoped>
.tabs-other-info {
.el-tabs__item {
// width: 50px;
height: 20px;
box-sizing: border-box;
margin-right: 7px;
padding: 0 10px !important;
font-size: 8px;
font-weight: 500;
color: #666666;
line-height: 20px;
background: #ebecf1;
border-radius: 2px;
}
.el-tabs__nav-wrap::after,
.el-tabs__active-bar {
display: none;
}
.el-tabs__nav-next,
.el-tabs__nav-prev {
line-height: 20px;
}
}
.resi-card-table {
margin-top: 20px;
}
.resi-row-btn {
margin-bottom: 13px;
}
.resi-other {
width: 100%;
display: flex;
.resi-other-title {
width: 100px;
box-sizing: border-box;
margin-bottom: 10px;
// padding: 6px 12px 0 0;
font-size: 16px;
font-weight: 500;
color: #333;
text-align: center;
}
.tabs-other-info {
// padding-left: 60px;
}
}
.resi-btns {
margin-top: 20px;
text-align: center;
}
.resi-container .resi-card {
position: relative;
overflow: visible;
}
.resi-down {
position: absolute;
left: 50%;
bottom: -10px;
display: flex;
justify-content: center;
align-items: center;
width: 46px;
height: 12px;
box-sizing: border-box;
margin-left: -23rpx;
cursor: pointer;
background: #ffffff;
border-radius: 0 0 10px 10px;
img {
display: block;
}
}
.resi-row-box {
height: 104px;
overflow: hidden;
transition: height 0.5s;
}
.resi-row-more {
height: max-content;
transition: height 0.5s;
}
.resi-row {
margin-bottom: 20px;
}
.resi-search {
.el-col {
text-align: right;
}
}
.resi-cell {
display: flex;
align-items: center;
.resi-cell-label {
width: 70px;
box-sizing: border-box;
margin-right: 15px;
text-align: right;
// line-height: 32;
}
.resi-cell-value-radio {
display: flex;
align-items: center;
min-height: 32px;
}
.resi-cell-input {
width: 180px;
}
.resi-cell-select {
width: 180px;
box-sizing: border-box;
margin-right: 10px;
&-middle {
width: 130px;
}
&-small {
width: 88px;
}
}
.resi-cell-select:last-child {
margin-right: 0;
}
}
</style>
Loading…
Cancel
Save