Merge remote-tracking branch 'origin/master'
# Conflicts:
# src/views/system/point/index.vue
| | |
| | | "clipboard": "2.0.8", |
| | | "core-js": "3.25.3", |
| | | "echarts": "5.4.0", |
| | | "echarts-gl": "^2.0.9", |
| | | "element-ui": "2.15.14", |
| | | "file-saver": "2.0.5", |
| | | "fuse.js": "6.4.3", |
New file |
| | |
| | | import request from '@/utils/request' |
| | | |
| | | // 查询地域列表 |
| | | export function listRegion(query) { |
| | | return request({ |
| | | url: '/region/page', |
| | | method: 'post', |
| | | data: query |
| | | }) |
| | | } |
| | | |
| | | // 查询地域详细 |
| | | export function getRegion(id) { |
| | | return request({ |
| | | url: '/region/' + id, |
| | | method: 'get' |
| | | }) |
| | | } |
| | | |
| | | // 新增地域 |
| | | export function addRegion(data) { |
| | | return request({ |
| | | url: '/region', |
| | | method: 'post', |
| | | data: data |
| | | }) |
| | | } |
| | | |
| | | // 修改地域 |
| | | export function updateRegion(data) { |
| | | return request({ |
| | | url: '/region', |
| | | method: 'put', |
| | | data: data |
| | | }) |
| | | } |
| | | |
| | | // 删除地域 |
| | | export function delRegion(id) { |
| | | return request({ |
| | | url: '/region/' + id, |
| | | method: 'delete' |
| | | }) |
| | | } |
| | | |
| | | // 获取区县列表 |
| | | export function getCountyList() { |
| | | return request({ |
| | | url: '/region/counties', |
| | | method: 'get' |
| | | }) |
| | | } |
| | | |
| | | // 获取区县级联选择 |
| | | export function getCascader() { |
| | | return request({ |
| | | url: '/region/cascader', |
| | | method: 'get' |
| | | }) |
| | | } |
| | | |
New file |
| | |
| | | <template> |
| | | <div class="hola-container"> |
| | | <div class="hola-content" ref="hola"></div> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | import * as echarts from 'echarts'; |
| | | let holaChart = null; |
| | | |
| | | const config = { |
| | | tooltip: { |
| | | trigger: 'item' |
| | | }, |
| | | legend: { |
| | | top: '5%', |
| | | left: 'center' |
| | | }, |
| | | series: [ |
| | | { |
| | | type: 'pie', |
| | | radius: ['40%', '70%'], |
| | | avoidLabelOverlap: false, |
| | | itemStyle: { |
| | | borderRadius: 10, |
| | | borderColor: '#fff', |
| | | borderWidth: 2 |
| | | }, |
| | | label: { |
| | | show: false, |
| | | position: 'center' |
| | | }, |
| | | emphasis: { |
| | | label: { |
| | | show: false, |
| | | fontSize: 40, |
| | | fontWeight: 'bold' |
| | | } |
| | | }, |
| | | labelLine: { |
| | | show: false |
| | | }, |
| | | data: [] |
| | | } |
| | | ] |
| | | } |
| | | |
| | | const nameList = { |
| | | data1: '工单数', |
| | | data2: '恢复数', |
| | | data3: '待恢复数', |
| | | data4: '产生违约事项数', |
| | | data5: '产生违约责任数', |
| | | } |
| | | export default { |
| | | props: { |
| | | activeData: { |
| | | type: Object, |
| | | default: () => { }, |
| | | } |
| | | }, |
| | | data() { |
| | | return { |
| | | |
| | | } |
| | | }, |
| | | methods: { |
| | | changeConfig(data) { |
| | | if (data) { |
| | | let temp = []; |
| | | Object.keys(data).filter(key => key !== 'name').forEach(key => { |
| | | temp.push({ |
| | | name: nameList[key], |
| | | value: data[key] |
| | | }); |
| | | }); |
| | | config.series[0].data = temp; |
| | | holaChart.setOption(config, true); |
| | | } |
| | | |
| | | } |
| | | }, |
| | | watch: { |
| | | activeData: { |
| | | handler(newVal, oldVal) { |
| | | this.$nextTick(() => { |
| | | this.changeConfig(newVal); |
| | | }) |
| | | }, |
| | | immediate: true, |
| | | } |
| | | }, |
| | | mounted() { |
| | | holaChart = echarts.init(this.$refs.hola); |
| | | holaChart.setOption(config, true); |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style lang="scss" scoped> |
| | | .hola-container { |
| | | width: 100%; |
| | | height: 100%; |
| | | |
| | | .hola-content { |
| | | width: 100%; |
| | | height: 100%; |
| | | } |
| | | } |
| | | </style> |
New file |
| | |
| | | <template> |
| | | <div class="data-container"> |
| | | <div class="data-content"> |
| | | <div class="icon-item" v-for="item, index in dataList" :style="{ backgroundColor: iconList[index].color }" |
| | | :key="item.id"> |
| | | <div class="icon-container"> |
| | | <i :class="iconList[index].icon" class="icon-font"></i> |
| | | </div> |
| | | <div class="data-info"> |
| | | <div class="data-num">{{ item.value }}</div> |
| | | <div class="data-lable">{{ item.name }}</div> |
| | | </div> |
| | | </div> |
| | | |
| | | </div> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | |
| | | const nameList = { |
| | | data1: '工单数', |
| | | data2: '恢复数', |
| | | data3: '待恢复数', |
| | | data4: '产生违约事项数', |
| | | data5: '产生违约责任数', |
| | | } |
| | | |
| | | |
| | | export default { |
| | | props: { |
| | | activeData: { |
| | | type: Object, |
| | | default: () => { return { name: '自贡市', data1: 0, data2: 0, data3: 0, data4: 0, data5: 0 } }, |
| | | } |
| | | }, |
| | | data() { |
| | | return { |
| | | dataList: [], |
| | | iconList: [ |
| | | { icon: 'el-icon-tickets', color: '#7868d9' }, |
| | | { icon: 'el-icon-s-claim', color: '#3eba45' }, |
| | | { icon: 'el-icon-edit', color: '#3da7f8' }, |
| | | { icon: 'el-icon-warning', color: '#ffbe40' }, |
| | | { icon: 'el-icon-error', color: '#fe640d' }, |
| | | ] |
| | | } |
| | | }, |
| | | methods: { |
| | | formatData(data) { |
| | | if (data) { |
| | | let temp = []; |
| | | Object.keys(data).filter(key => key !== 'name').forEach((key, index) => { |
| | | temp.push({ |
| | | id: index + 1, |
| | | name: nameList[key], |
| | | value: data[key] |
| | | }); |
| | | }); |
| | | this.dataList = temp; |
| | | } |
| | | |
| | | } |
| | | }, |
| | | watch: { |
| | | activeData: { |
| | | handler(newVal, oldVal) { |
| | | this.$nextTick(() => { |
| | | this.formatData(newVal); |
| | | }) |
| | | }, |
| | | immediate: true, |
| | | } |
| | | }, |
| | | } |
| | | </script> |
| | | |
| | | <style lang="scss" scoped> |
| | | .data-container { |
| | | height: 100%; |
| | | } |
| | | |
| | | .data-content { |
| | | height: 100%; |
| | | display: flex; |
| | | flex-direction: column; |
| | | justify-content: space-around; |
| | | } |
| | | |
| | | .icon-item { |
| | | display: flex; |
| | | border-radius: 10px; |
| | | align-items: center; |
| | | padding: 10px 10px; |
| | | } |
| | | |
| | | .icon-container { |
| | | display: flex; |
| | | justify-content: center; |
| | | align-items: center; |
| | | border-radius: 8px; |
| | | margin-right: 10px; |
| | | |
| | | .icon-font { |
| | | font-size: 34px; |
| | | color: #fff; |
| | | } |
| | | } |
| | | |
| | | .data-info { |
| | | display: flex; |
| | | height: 100%; |
| | | flex-direction: column; |
| | | justify-content: center; |
| | | text-align: left; |
| | | color: #fff; |
| | | |
| | | .data-num { |
| | | font-size: 30px; |
| | | } |
| | | |
| | | .data-lable { |
| | | font-size: 16px; |
| | | text-indent: 3px; |
| | | } |
| | | } |
| | | </style> |
New file |
| | |
| | | <template> |
| | | <div class="map-container"> |
| | | <div ref="map" class="map-style"></div> |
| | | </div> |
| | | |
| | | </template> |
| | | |
| | | <script> |
| | | import * as echarts from 'echarts'; |
| | | import 'echarts-gl'; |
| | | import mapData from '@/assets/map/dujiangyan.json'; |
| | | echarts.registerMap('dujiangyan', mapData); |
| | | console.log(mapData); |
| | | let mapChart = null; |
| | | let tempName = ''; |
| | | const mapConfig = { |
| | | series: [{ |
| | | map: "dujiangyan", //注册地图的名字 |
| | | type: "map3D", |
| | | bottom: 0, |
| | | left: 0, |
| | | top: 0, |
| | | right: 0, |
| | | itemStyle: { |
| | | color: "#4189f2", // 背景 |
| | | opacity: 1, //透明度 |
| | | borderWidth: 1.5, // 边框宽度 |
| | | borderColor: "#fff", // 边框颜色 |
| | | fontSize: 16, // |
| | | }, |
| | | |
| | | // 标签 |
| | | label: { |
| | | show: true, |
| | | color: "#fff", //地图初始化区域字体颜色 |
| | | fontSize: 18, |
| | | }, |
| | | // 控制器 |
| | | viewControl: { |
| | | beta: 82, |
| | | alpha: 90, |
| | | distance: 180, |
| | | maxBeta: 180 |
| | | }, |
| | | // 鼠标移入时样式 |
| | | emphasis: { |
| | | itemStyle: { |
| | | color: "#F63545" |
| | | } |
| | | }, |
| | | |
| | | // 数据 |
| | | data: mapData.features.map((item) => { |
| | | return { |
| | | name: item.properties.name, |
| | | itemStyle: { |
| | | color: "#4189f2" |
| | | } |
| | | } |
| | | }), |
| | | } |
| | | ] |
| | | |
| | | }; |
| | | export default { |
| | | name: 'DataMap', |
| | | data() { |
| | | return { |
| | | |
| | | } |
| | | }, |
| | | components: { |
| | | }, |
| | | methods: { |
| | | filterData(name) { |
| | | this.initConfig(); |
| | | let temp = mapConfig.series[0].data.find(item => item.name === name); |
| | | temp.itemStyle.color = '#F63545'; |
| | | mapChart.setOption(mapConfig, true); |
| | | this.$emit('filterData', name); |
| | | }, |
| | | initConfig() { |
| | | mapConfig.series[0].data.forEach(item => { |
| | | item.itemStyle.color = '#4189f2'; |
| | | }); |
| | | } |
| | | }, |
| | | mounted() { |
| | | mapChart = echarts.init(this.$refs.map); |
| | | mapChart.setOption(mapConfig, true); |
| | | mapChart.on('click', (params) => { |
| | | if (tempName === params.name) { |
| | | tempName = ''; |
| | | this.initConfig(); |
| | | mapChart.setOption(mapConfig, true); |
| | | this.$emit('filterData', ''); |
| | | } else { |
| | | tempName = params.name; |
| | | this.filterData(params.name); |
| | | } |
| | | }) |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style lang="scss" scoped> |
| | | .map-container { |
| | | width: 100%; |
| | | height: 100%; |
| | | |
| | | .map-style { |
| | | width: 100%; |
| | | height: 100%; |
| | | } |
| | | } |
| | | </style> |
New file |
| | |
| | | <template> |
| | | <el-card class="data-container" :body-style="{ height: '100%' }"> |
| | | <el-row :gutter="40" style="height: 100%;"> |
| | | <el-col :span="12" style="height: 100%;"> |
| | | <data-hola></data-hola> |
| | | </el-col> |
| | | <el-col :span="12" style="height: 100%;"> |
| | | <data-icon></data-icon> |
| | | </el-col> |
| | | </el-row> |
| | | </el-card> |
| | | </template> |
| | | |
| | | <script> |
| | | import DataIcon from './data-icon.vue'; |
| | | import DataHola from './data-hola.vue'; |
| | | export default { |
| | | components: { |
| | | DataIcon, |
| | | DataHola, |
| | | }, |
| | | } |
| | | </script> |
| | | |
| | | <style lang="scss" scoped> |
| | | .data-container { |
| | | width: 100%; |
| | | aspect-ratio: 6/3; |
| | | } |
| | | </style> |
| | |
| | | <h1 class="title">运维报表</h1> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="20" class="data-plane"> |
| | | <el-col :xs='24' :md="6" :xl="{ span: '4-8' }" :sm="12" v-for="item, index in dataList" :key="item.id"> |
| | | <div class="col-content"> |
| | | <el-card> |
| | | <el-row type="flex" align="middle" justify="space-between"> |
| | | <el-col :xl="8" :lg="8" :md="10" :sm="8" :xs="6"> |
| | | <div class="icon-container" :style="{ backgroundColor: iconList[index].color }"> |
| | | <i :class="iconList[index].icon" class="icon-font"></i> |
| | | </div> |
| | | </el-col> |
| | | <el-col :xl="14" :lg="14" :md="12" :sm="14" :xs="16"> |
| | | <div class="data-info"> |
| | | <div class="data-num">{{ item.num }}</div> |
| | | <div class="data-lable">{{ item.type }}</div> |
| | | </div> |
| | | </el-col> |
| | | </el-row> |
| | | </el-card> |
| | | </div> |
| | | </el-col> |
| | | |
| | | </el-row> |
| | | |
| | | <el-card class="map-wrapper"> |
| | | <el-row :gutter="40" class="data-plane" style="height: 100%;"> |
| | | <el-col :xs='24' :md="24" :sm="24" :lg="12" :xl="6" style="height: 100%;"> |
| | | <data-icon :activeData="activeData"></data-icon> |
| | | </el-col> |
| | | <el-col :xs='24' :md="24" :sm="24" :lg="12" :xl="12" style="height: 100%;"> |
| | | <data-map @filterData="filterData"></data-map> |
| | | </el-col> |
| | | <el-col :xs='24' :md="24" :sm="24" :lg="12" :xl="6" style="height: 100%;"> |
| | | <data-hola :activeData="activeData"></data-hola> |
| | | </el-col> |
| | | </el-row> |
| | | </el-card> |
| | | |
| | | </div> |
| | | |
| | | </template> |
| | | |
| | | <script> |
| | | // import DataPlane from './components/data-plane.vue'; |
| | | |
| | | import DataMap from './components/data-map.vue'; |
| | | import DataIcon from './components/data-icon.vue'; |
| | | import DataHola from './components/data-hola.vue'; |
| | | |
| | | export default { |
| | | name: 'DataView', |
| | | components: { |
| | | DataMap, |
| | | DataIcon, |
| | | DataHola, |
| | | // DataPlane |
| | | }, |
| | | data() { |
| | | return { |
| | | dataList: [ |
| | |
| | | { icon: 'el-icon-edit', color: '#3da7f8' }, |
| | | { icon: 'el-icon-warning', color: '#ffbe40' }, |
| | | { icon: 'el-icon-error', color: '#fe640d' }, |
| | | ] |
| | | ], |
| | | totalList: [ |
| | | { |
| | | "name": "虹口乡", |
| | | "data1": 3, |
| | | "data2": 82, |
| | | "data3": 5, |
| | | "data4": 95, |
| | | "data5": 50 |
| | | }, |
| | | { |
| | | "name": "玉堂镇", |
| | | "data1": 1, |
| | | "data2": 94, |
| | | "data3": 38, |
| | | "data4": 60, |
| | | "data5": 87 |
| | | }, |
| | | { |
| | | "name": "崇义镇", |
| | | "data1": 15, |
| | | "data2": 57, |
| | | "data3": 81, |
| | | "data4": 77, |
| | | "data5": 85 |
| | | }, |
| | | { |
| | | "name": "龙池镇", |
| | | "data1": 8, |
| | | "data2": 7, |
| | | "data3": 60, |
| | | "data4": 77, |
| | | "data5": 43 |
| | | }, |
| | | { |
| | | "name": "中兴镇", |
| | | "data1": 40, |
| | | "data2": 75, |
| | | "data3": 50, |
| | | "data4": 69, |
| | | "data5": 79 |
| | | }, |
| | | { |
| | | "name": "蒲阳镇", |
| | | "data1": 68, |
| | | "data2": 38, |
| | | "data3": 27, |
| | | "data4": 43, |
| | | "data5": 95 |
| | | }, |
| | | { |
| | | "name": "大观镇", |
| | | "data1": 52, |
| | | "data2": 9, |
| | | "data3": 74, |
| | | "data4": 40, |
| | | "data5": 82 |
| | | }, |
| | | { |
| | | "name": "幸福镇", |
| | | "data1": 52, |
| | | "data2": 10, |
| | | "data3": 26, |
| | | "data4": 70, |
| | | "data5": 61 |
| | | }, |
| | | { |
| | | "name": "天马镇", |
| | | "data1": 66, |
| | | "data2": 44, |
| | | "data3": 77, |
| | | "data4": 68, |
| | | "data5": 51 |
| | | }, |
| | | { |
| | | "name": "安龙镇", |
| | | "data1": 80, |
| | | "data2": 77, |
| | | "data3": 84, |
| | | "data4": 79, |
| | | "data5": 47 |
| | | }, |
| | | { |
| | | "name": "聚源镇", |
| | | "data1": 85, |
| | | "data2": 78, |
| | | "data3": 12, |
| | | "data4": 37, |
| | | "data5": 32 |
| | | }, |
| | | { |
| | | "name": "胥家镇", |
| | | "data1": 91, |
| | | "data2": 76, |
| | | "data3": 30, |
| | | "data4": 47, |
| | | "data5": 28 |
| | | }, |
| | | { |
| | | "name": "向峨乡", |
| | | "data1": 32, |
| | | "data2": 41, |
| | | "data3": 45, |
| | | "data4": 60, |
| | | "data5": 54 |
| | | }, |
| | | { |
| | | "name": "柳街镇", |
| | | "data1": 8, |
| | | "data2": 80, |
| | | "data3": 4, |
| | | "data4": 14, |
| | | "data5": 20 |
| | | }, |
| | | { |
| | | "name": "紫坪铺镇", |
| | | "data1": 1, |
| | | "data2": 88, |
| | | "data3": 41, |
| | | "data4": 21, |
| | | "data5": 88 |
| | | }, |
| | | { |
| | | "name": "灌口镇", |
| | | "data1": 85, |
| | | "data2": 72, |
| | | "data3": 79, |
| | | "data4": 27, |
| | | "data5": 42 |
| | | }, |
| | | { |
| | | "name": "青城山镇", |
| | | "data1": 77, |
| | | "data2": 1, |
| | | "data3": 33, |
| | | "data4": 92, |
| | | "data5": 45 |
| | | }, |
| | | { |
| | | "name": "滨江街道", |
| | | "data1": 82, |
| | | "data2": 43, |
| | | "data3": 9, |
| | | "data4": 34, |
| | | "data5": 96 |
| | | }, |
| | | { |
| | | "name": "翠月湖镇", |
| | | "data1": 30, |
| | | "data2": 41, |
| | | "data3": 80, |
| | | "data4": 9, |
| | | "data5": 53 |
| | | }, |
| | | { |
| | | "name": "石羊镇", |
| | | "data1": 9, |
| | | "data2": 15, |
| | | "data3": 24, |
| | | "data4": 92, |
| | | "data5": 37 |
| | | } |
| | | ], |
| | | activeData: {name: '自贡市', data1: 0, data2: 0, data3: 0, data4: 0, data5:0} |
| | | } |
| | | }, |
| | | methods: { |
| | | filterData(name) { |
| | | if (name) { |
| | | this.activeData = this.totalList.find(item => item.name === name); |
| | | } else { |
| | | this.countTotal(); |
| | | } |
| | | }, |
| | | countTotal() { |
| | | let data = {}; |
| | | this.totalList.forEach((item) => { |
| | | Object.keys(item).forEach((key) => { |
| | | data[key] = data[key] ? data[key] + item[key] : item[key]; |
| | | }); |
| | | }); |
| | | data.name = '自贡市'; |
| | | this.activeData = data; |
| | | } |
| | | }, |
| | | created() { |
| | | this.countTotal(); |
| | | } |
| | | } |
| | | </script> |
| | |
| | | .data-container { |
| | | margin-bottom: 20px; |
| | | } |
| | | |
| | | .title { |
| | | text-align: left; |
| | | } |
| | |
| | | margin-bottom: 10px; |
| | | } |
| | | |
| | | .icon-container { |
| | | display: flex; |
| | | justify-content: center; |
| | | align-items: center; |
| | | border-radius: 8px; |
| | | .map-wrapper { |
| | | // background-color: rgb(48, 65, 86); |
| | | |
| | | .icon-font { |
| | | font-size: 30px; |
| | | color: #fff; |
| | | } |
| | | } |
| | | |
| | | .data-info { |
| | | display: flex; |
| | | height: 100%; |
| | | flex-direction: column; |
| | | justify-content: center; |
| | | text-align: left; |
| | | |
| | | .data-num { |
| | | font-size: 32px; |
| | | } |
| | | |
| | | .data-lable { |
| | | font-size: 16px; |
| | | text-indent: 3px; |
| | | } |
| | | .data-plane { |
| | | aspect-ratio: 6/2; |
| | | } |
| | | |
| | | @media screen and (min-width: 1200px) { |
| | |
| | | |
| | | <!-- 添加运维点位对话框 --> |
| | | <el-dialog :title="title" :visible.sync="open" width="900px" append-to-body> |
| | | <el-form ref="form" :model="tempForm" :rules="rules" label-width="120px"> |
| | | <el-form-item label="点位名称" prop="pointName"> |
| | | <el-input v-model="tempForm.pointName" placeholder="请输入点位名称" /> |
| | | </el-form-item> |
| | | <el-form-item label="运维单位" prop="unitId"> |
| | | <el-select v-model="tempForm.unitId" placeholder="运维单位"> |
| | | <el-option |
| | | v-for="item in unitList" |
| | | :key="item.id" |
| | | :label="item.value" |
| | | :value="item.id"> |
| | | </el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="点位时区" prop="timezone"> |
| | | <el-date-picker |
| | | @change="dateChange" |
| | | v-model="tempForm.timezone" |
| | | type="daterange" |
| | | align="right" |
| | | unlink-panels |
| | | range-separator="至" |
| | | start-placeholder="开始日期" |
| | | end-placeholder="结束日期" |
| | | > |
| | | </el-date-picker> |
| | | </el-form-item> |
| | | <el-form-item> |
| | | <div style="display: flex;flex-direction: row-reverse"> |
| | | <el-button @click="nextAdd" type="primary" plain>继续添加</el-button> |
| | | </div> |
| | | </el-form-item> |
| | | <div class="point-row" v-for="(point,index) in tempFormList"> |
| | | <div class="row-item"> |
| | | <el-input :disabled="editingIndex!==index" v-model="point.pointName" placeholder="点位名称"></el-input> |
| | | </div> |
| | | <div class="row-item"> |
| | | <el-select :disabled="editingIndex!==index" v-model="point.unitId" placeholder="运维单位"> |
| | | <el-option |
| | | v-for="item in unitList" |
| | | :key="item.id" |
| | | :label="item.value" |
| | | :value="item.id"> |
| | | </el-option> |
| | | </el-select> |
| | | </div> |
| | | <div class="row-item"> |
| | | <el-date-picker |
| | | :disabled="editingIndex!==index" |
| | | v-model="point.timezone" |
| | | type="daterange" |
| | | align="right" |
| | | unlink-panels |
| | | range-separator="至" |
| | | start-placeholder="开始日期" |
| | | end-placeholder="结束日期" |
| | | > |
| | | </el-date-picker> |
| | | </div> |
| | | <div class="row-item"> |
| | | <el-button v-show="editingIndex!==index" @click="editPointItem(index)" type="danger" size="small" plain>修改</el-button> |
| | | <el-button v-show="editingIndex===index" @click="editFinishItem(index)" type="success" size="small" plain>完成</el-button> |
| | | </div> |
| | | </div> |
| | | </el-form> |
| | | <div slot="footer" class="dialog-footer"> |
| | | <el-button type="primary" @click="submitForm">确 定</el-button> |
| | | <el-button @click="cancel">取 消</el-button> |
| | | </div> |
| | | </el-dialog> |
| | | |
| | | <!-- 修改运维点位对话框 --> |
| | | <el-dialog :title="title" :visible.sync="editOpen" width="500px" append-to-body> |
| | | <el-form ref="form" :model="form" :rules="rules" label-width="120px"> |
| | | <el-form-item label="点位名称" prop="pointName"> |
| | | <el-input v-model="form.pointName" placeholder="请输入点位名称" /> |
| | | </el-form-item> |
| | | <el-form-item label="运维单位" prop="unitId"> |
| | | <el-select v-model="form.unitId" placeholder="运维单位"> |
| | | <el-select :disabled="title === '修改运维点位'" v-model="form.unitId" placeholder="运维单位"> |
| | | <el-option |
| | | v-for="item in unitList" |
| | | :key="item.id" |
| | |
| | | </el-form-item> |
| | | <el-form-item label="点位时区" prop="timezone"> |
| | | <el-date-picker |
| | | :disabled="title === '修改运维点位'" |
| | | @change="dateChange" |
| | | v-model="form.timezone" |
| | | type="daterange" |
| | |
| | | > |
| | | </el-date-picker> |
| | | </el-form-item> |
| | | <el-form-item> |
| | | <div style="display: flex;flex-direction: row-reverse"> |
| | | <el-button @click="nextAdd" type="primary" plain>添加点位</el-button> |
| | | </div> |
| | | </el-form-item> |
| | | <el-row style="min-height: 200px;max-height: 400px; overflow-y: auto"> |
| | | <el-col class="col-item" v-for="(point) in tempFormList" :span="8"> |
| | | <div style="margin-right: 5px"> |
| | | <el-cascader v-model="point.region" :options="regionList" placeholder="请选择区域" :show-all-levels="false"></el-cascader> |
| | | </div> |
| | | <div v-if="title === '修改运维点位'"> |
| | | <el-button @click="removeRegion(point)" type="danger" icon="el-icon-delete" circle></el-button> |
| | | </div> |
| | | </el-col> |
| | | </el-row> |
| | | </el-form> |
| | | <div slot="footer" class="dialog-footer"> |
| | | <el-button type="primary" @click="submitForm">确 定</el-button> |
| | | <el-button @click="updateCancel">取 消</el-button> |
| | | <el-button @click="cancel">取 消</el-button> |
| | | </div> |
| | | </el-dialog> |
| | | |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | import { listPoint, getPoint, delPoint, addPoint, addPointBatch, updatePoint } from "@/api/platform/point"; |
| | | import { unitSelect } from "@/api/platform/unit"; |
| | | import { getCascader } from '../../../api/platform/region' |
| | | |
| | | export default { |
| | | name: "Point", |
| | | data() { |
| | | return { |
| | | regionList: [], |
| | | // 正在修改第几个 |
| | | editingIndex: null, |
| | | // 遮罩层 |
| | |
| | | created() { |
| | | this.getList(); |
| | | this.getUnitSelect(); |
| | | this.getCascader(); |
| | | }, |
| | | methods: { |
| | | removeRegion(item) { |
| | | this.tempFormList = this.tempFormList.filter(data => data !== item) |
| | | }, |
| | | // 获取区县级联 |
| | | getCascader() { |
| | | getCascader().then(res => { |
| | | this.regionList = res.data; |
| | | }) |
| | | }, |
| | | // 点位项修改完成 |
| | | editFinishItem(index) { |
| | | this.editingIndex = null; |
| | |
| | | }, |
| | | // 继续添加点位 |
| | | nextAdd() { |
| | | this.formList.push(this.tempForm); |
| | | this.tempFormList.push(this.tempForm); |
| | | this.tempForm = {}; |
| | | let item = {} |
| | | // this.formList.push(item); |
| | | this.tempFormList.push(item); |
| | | }, |
| | | getUnitSelect() { |
| | | // 运维单位下拉列表 |
| | |
| | | remark: null, |
| | | createTime: null, |
| | | updateTime: null, |
| | | deleted: null |
| | | deleted: null, |
| | | pointDetail: "" |
| | | }; |
| | | this.resetForm("form"); |
| | | }, |
| | |
| | | // 多选框选中数据 |
| | | handleSelectionChange(selection) { |
| | | this.ids = selection.map(item => item.id) |
| | | this.single = selection.length!==1 |
| | | this.single = selection.length !== 1 |
| | | this.multiple = !selection.length |
| | | }, |
| | | /** 新增按钮操作 */ |
| | |
| | | getPoint(id).then(response => { |
| | | this.form = response.data; |
| | | this.form.timezone = [this.form.startTime, this.form.endTime] |
| | | this.editOpen = true; |
| | | if (this.form.pointDetail) { |
| | | this.tempFormList = JSON.parse(this.form.pointDetail) |
| | | } |
| | | this.open = true; |
| | | this.title = "修改运维点位"; |
| | | }); |
| | | }, |
| | | /** 提交按钮 */ |
| | | submitForm() { |
| | | if (this.formList.length > 0) { |
| | | // 批量增加 |
| | | if (this.formList.every(item => !item.hasOwnProperty("id"))) { |
| | | addPointBatch(this.formList).then(response => { |
| | | this.$modal.msgSuccess("新增成功"); |
| | | this.open = false; |
| | | // 重置 |
| | | this.tempForm = {}; |
| | | this.tempFormList = []; |
| | | this.formList = []; |
| | | this.getList(); |
| | | }); |
| | | } |
| | | }else { |
| | | if (this.form.id != null) { |
| | | updatePoint(this.form).then(response => { |
| | | this.$modal.msgSuccess("修改成功"); |
| | | this.editOpen = false; |
| | | this.getList(); |
| | | }); |
| | | } else { |
| | | addPoint(this.form).then(response => { |
| | | this.$modal.msgSuccess("新增成功"); |
| | | this.open = false; |
| | | this.getList(); |
| | | }); |
| | | } |
| | | if (this.tempFormList) { |
| | | this.form.pointDetail = JSON.stringify(this.tempFormList) |
| | | } |
| | | if (this.form.id != null) { |
| | | updatePoint(this.form).then(response => { |
| | | this.$modal.msgSuccess("修改成功"); |
| | | this.open = false; |
| | | this.getList(); |
| | | }); |
| | | } else { |
| | | addPoint(this.form).then(response => { |
| | | this.$modal.msgSuccess("新增成功"); |
| | | this.open = false; |
| | | this.reset() |
| | | this.getList(); |
| | | }); |
| | | } |
| | | }, |
| | | /** 删除按钮操作 */ |
| | |
| | | }).then(() => { |
| | | this.getList(); |
| | | this.$modal.msgSuccess("删除成功"); |
| | | }).catch(() => {}); |
| | | }).catch(() => { |
| | | }); |
| | | }, |
| | | /** 导出按钮操作 */ |
| | | handleExport() { |
| | |
| | | </script> |
| | | |
| | | <style scoped> |
| | | .point-row { |
| | | .col-item { |
| | | margin: 5px 0; |
| | | display: flex; |
| | | flex-direction: row; |
| | | align-content: center; |
| | | justify-content: center; |
| | | align-items: center; |
| | | } |
| | | .row-item { |
| | | margin-right: 5px; |
| | | } |
| | | .row-item:nth-last-child { |
| | | margin-right: 0; |
| | | } |
| | | </style> |
New file |
| | |
| | | <template> |
| | | <div class="app-container"> |
| | | <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px"> |
| | | <el-form-item label="地方全称" prop="fullName"> |
| | | <el-input |
| | | v-model="queryParams.fullName" |
| | | placeholder="请输入地方全称" |
| | | clearable |
| | | @clear="handleQuery" |
| | | @keyup.enter.native="handleQuery" |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item label="地方简称" prop="simpleName"> |
| | | <el-input |
| | | v-model="queryParams.simpleName" |
| | | placeholder="请输入地方简称" |
| | | clearable |
| | | @clear="handleQuery" |
| | | @keyup.enter.native="handleQuery" |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item label="区县" prop="county"> |
| | | <el-select v-model="queryParams.parentId" clearable @change="handleQuery" placeholder="请选择区县"> |
| | | <el-option v-for="item in countyList" :label="item.value" :value="item.id" :key="item.id"/> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="地方级别" prop="county"> |
| | | <el-select v-model="queryParams.regionLevel" clearable @change="handleQuery" placeholder="请选择区县"> |
| | | <el-option label="市" value="city" /> |
| | | <el-option label="区县" value="county" /> |
| | | <el-option label="街道" value="street" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item> |
| | | <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button> |
| | | <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button> |
| | | </el-form-item> |
| | | </el-form> |
| | | |
| | | <el-row :gutter="10" class="mb8"> |
| | | <el-col :span="1.5"> |
| | | <el-button |
| | | type="primary" |
| | | plain |
| | | icon="el-icon-plus" |
| | | size="mini" |
| | | @click="handleAdd" |
| | | v-hasPermi="['system:region:add']" |
| | | >新增</el-button> |
| | | </el-col> |
| | | <el-col :span="1.5"> |
| | | <el-button |
| | | type="success" |
| | | plain |
| | | icon="el-icon-edit" |
| | | size="mini" |
| | | :disabled="single" |
| | | @click="handleUpdate" |
| | | v-hasPermi="['system:region:edit']" |
| | | >修改</el-button> |
| | | </el-col> |
| | | <el-col :span="1.5"> |
| | | <el-button |
| | | type="danger" |
| | | plain |
| | | icon="el-icon-delete" |
| | | size="mini" |
| | | :disabled="multiple" |
| | | @click="handleDelete" |
| | | v-hasPermi="['system:region:remove']" |
| | | >删除</el-button> |
| | | </el-col> |
| | | <el-col :span="1.5"> |
| | | <el-button |
| | | type="warning" |
| | | plain |
| | | icon="el-icon-download" |
| | | size="mini" |
| | | @click="handleExport" |
| | | v-hasPermi="['system:region:export']" |
| | | >导出</el-button> |
| | | </el-col> |
| | | <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> |
| | | </el-row> |
| | | |
| | | <el-table v-loading="loading" |
| | | :data="regionList" |
| | | row-key="id" |
| | | border |
| | | default-expand-all |
| | | :tree-props="{children: 'children', hasChildren: 'hasChildren'}" |
| | | @selection-change="handleSelectionChange"> |
| | | <el-table-column type="selection" width="55" align="center" /> |
| | | <el-table-column label="区域全称" align="center" prop="fullName" /> |
| | | <el-table-column label="区域简称" align="center" prop="simpleName" /> |
| | | <el-table-column label="地域级别" align="center"> |
| | | <template slot-scope="scope"> |
| | | <el-tag :type="typeByLevel(scope.row.regionLevel)" size="medium">{{ scope.row.regionLevel }}</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="市" align="center" prop="city" /> |
| | | <el-table-column label="区县" align="center" prop="county" /> |
| | | <el-table-column label="操作" align="center" class-name="small-padding fixed-width"> |
| | | <template slot-scope="scope"> |
| | | <el-button |
| | | size="mini" |
| | | type="text" |
| | | icon="el-icon-edit" |
| | | @click="handleUpdate(scope.row)" |
| | | v-hasPermi="['system:region:edit']" |
| | | >修改</el-button> |
| | | <el-button |
| | | size="mini" |
| | | type="text" |
| | | icon="el-icon-delete" |
| | | @click="handleDelete(scope.row)" |
| | | v-hasPermi="['system:region:remove']" |
| | | >删除</el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | |
| | | <pagination |
| | | v-show="total>0" |
| | | :total="total" |
| | | :page.sync="queryParams.pageNum" |
| | | :limit.sync="queryParams.pageSize" |
| | | @pagination="getList" |
| | | /> |
| | | |
| | | <!-- 添加或修改地域对话框 --> |
| | | <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body> |
| | | <el-form ref="form" :model="form" :rules="rules" label-width="80px"> |
| | | <el-form-item label="市" prop="city"> |
| | | <el-input v-model="form.city" disabled /> |
| | | </el-form-item> |
| | | <el-form-item label="区县" prop="county"> |
| | | <el-select v-model="form.parentId" @change="changeCounty" placeholder="请选择区县"> |
| | | <el-option v-for="item in countyList" :label="item.value" :value="item.id" :key="item.id"/> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="地方全称" prop="fullName"> |
| | | <el-input v-model="form.fullName" type="textarea" placeholder="请输入地方全称" /> |
| | | </el-form-item> |
| | | <el-form-item label="地方简称" prop="simpleName"> |
| | | <el-input v-model="form.simpleName" placeholder="请输入地方简称" /> |
| | | </el-form-item> |
| | | </el-form> |
| | | <div slot="footer" class="dialog-footer"> |
| | | <el-button type="primary" @click="submitForm">确 定</el-button> |
| | | <el-button @click="cancel">取 消</el-button> |
| | | </div> |
| | | </el-dialog> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | import { listRegion, getRegion, delRegion, addRegion, updateRegion, getCountyList } from "@/api/platform/region"; |
| | | |
| | | export default { |
| | | name: "Region", |
| | | data() { |
| | | return { |
| | | // 区县列表 |
| | | countyList: [], |
| | | // 遮罩层 |
| | | loading: true, |
| | | // 选中数组 |
| | | ids: [], |
| | | // 非单个禁用 |
| | | single: true, |
| | | // 非多个禁用 |
| | | multiple: true, |
| | | // 显示搜索条件 |
| | | showSearch: true, |
| | | // 总条数 |
| | | total: 0, |
| | | // 地域表格数据 |
| | | regionList: [], |
| | | // 弹出层标题 |
| | | title: "", |
| | | // 是否显示弹出层 |
| | | open: false, |
| | | // 父级id时间范围 |
| | | daterangeCreateTime: [], |
| | | // 查询参数 |
| | | queryParams: { |
| | | pageNum: 1, |
| | | pageSize: 10, |
| | | fullName: null, |
| | | simpleName: null, |
| | | regionLevel: null, |
| | | parentId: null, |
| | | }, |
| | | // 表单参数 |
| | | form: { |
| | | id: null, |
| | | fullName: null, |
| | | simpleName: null, |
| | | regionLevel: null, |
| | | city: "自贡市", |
| | | county: null, |
| | | parentId: null, |
| | | createTime: null, |
| | | updateTime: null, |
| | | deleted: null |
| | | }, |
| | | // 表单校验 |
| | | rules: { |
| | | fullName: [ |
| | | { required: true, message: "区域全称不能为空", trigger: "blur" } |
| | | ], |
| | | simpleName: [ |
| | | { required: true, message: "区域简称不能为空", trigger: "blur" } |
| | | ], |
| | | countyId: [ |
| | | { required: true, message: "请选择区县", trigger: "change" } |
| | | ], |
| | | } |
| | | }; |
| | | }, |
| | | created() { |
| | | this.getList(); |
| | | this.getCountyList(); |
| | | }, |
| | | methods: { |
| | | typeByLevel(level) { |
| | | if (level === "市") { |
| | | return "danger" |
| | | } |
| | | if (level === "区县") { |
| | | return "success" |
| | | } |
| | | }, |
| | | //改变区县时,修改parentId |
| | | changeCounty(value) { |
| | | this.form.county = this.countyList.filter(item => item.id === value)[0].value |
| | | }, |
| | | // 获取区县列表 |
| | | getCountyList() { |
| | | getCountyList().then(res => { |
| | | this.countyList = res.data; |
| | | }) |
| | | }, |
| | | /** 查询地域列表 */ |
| | | getList() { |
| | | this.loading = true; |
| | | this.queryParams.params = {}; |
| | | if (null != this.daterangeCreateTime && '' != this.daterangeCreateTime) { |
| | | this.queryParams.params["beginCreateTime"] = this.daterangeCreateTime[0]; |
| | | this.queryParams.params["endCreateTime"] = this.daterangeCreateTime[1]; |
| | | } |
| | | listRegion(this.queryParams).then(response => { |
| | | this.regionList = response.data; |
| | | this.total = response.total; |
| | | this.loading = false; |
| | | }); |
| | | }, |
| | | // 取消按钮 |
| | | cancel() { |
| | | this.open = false; |
| | | this.reset(); |
| | | }, |
| | | // 表单重置 |
| | | reset() { |
| | | this.form = { |
| | | id: null, |
| | | fullName: null, |
| | | simpleName: null, |
| | | regionLevel: null, |
| | | city: "自贡市", |
| | | county: null, |
| | | parentId: null, |
| | | createTime: null, |
| | | updateTime: null, |
| | | deleted: null |
| | | }; |
| | | this.resetForm("form"); |
| | | }, |
| | | /** 搜索按钮操作 */ |
| | | handleQuery() { |
| | | this.queryParams.pageNum = 1; |
| | | this.getList(); |
| | | }, |
| | | /** 重置按钮操作 */ |
| | | resetQuery() { |
| | | this.daterangeCreateTime = []; |
| | | this.resetForm("queryForm"); |
| | | this.handleQuery(); |
| | | }, |
| | | // 多选框选中数据 |
| | | handleSelectionChange(selection) { |
| | | this.ids = selection.map(item => item.id) |
| | | this.single = selection.length!==1 |
| | | this.multiple = !selection.length |
| | | }, |
| | | /** 新增按钮操作 */ |
| | | handleAdd() { |
| | | this.reset(); |
| | | this.open = true; |
| | | this.title = "添加地域"; |
| | | }, |
| | | /** 修改按钮操作 */ |
| | | handleUpdate(row) { |
| | | this.reset(); |
| | | const id = row.id || this.ids |
| | | getRegion(id).then(response => { |
| | | this.form = response.data; |
| | | this.open = true; |
| | | this.title = "修改地域"; |
| | | }); |
| | | }, |
| | | /** 提交按钮 */ |
| | | submitForm() { |
| | | this.$refs["form"].validate(valid => { |
| | | if (valid) { |
| | | if (this.form.id != null) { |
| | | updateRegion(this.form).then(response => { |
| | | this.$modal.msgSuccess("修改成功"); |
| | | this.open = false; |
| | | this.getList(); |
| | | }); |
| | | } else { |
| | | addRegion(this.form).then(response => { |
| | | this.$modal.msgSuccess("新增成功"); |
| | | this.open = false; |
| | | this.getList(); |
| | | }); |
| | | } |
| | | } |
| | | }); |
| | | }, |
| | | /** 删除按钮操作 */ |
| | | handleDelete(row) { |
| | | const ids = row.id || this.ids; |
| | | this.$modal.confirm('是否确认删除地域编号为"' + ids + '"的数据项?').then(function() { |
| | | return delRegion(ids); |
| | | }).then(() => { |
| | | this.getList(); |
| | | this.$modal.msgSuccess("删除成功"); |
| | | }).catch(() => {}); |
| | | }, |
| | | /** 导出按钮操作 */ |
| | | handleExport() { |
| | | this.download('system/region/export', { |
| | | ...this.queryParams |
| | | }, `region_${new Date().getTime()}.xlsx`) |
| | | } |
| | | } |
| | | }; |
| | | </script> |