diff --git a/src/utils/index.js b/src/utils/index.js
index 4830c04..e6ab18d 100644
--- a/src/utils/index.js
+++ b/src/utils/index.js
@@ -1,117 +1,177 @@
-/**
- * Created by PanJiaChen on 16/11/18.
- */
-
-/**
- * Parse the time to string
- * @param {(Object|string|number)} time
- * @param {string} cFormat
- * @returns {string | null}
- */
-export function parseTime(time, cFormat) {
- if (arguments.length === 0 || !time) {
- return null
- }
- const format = cFormat || '{y}-{m}-{d} {h}:{i}:{s}'
- let date
- if (typeof time === 'object') {
- date = time
- } else {
- if ((typeof time === 'string')) {
- if ((/^[0-9]+$/.test(time))) {
- // support "1548221490638"
- time = parseInt(time)
- } else {
- // support safari
- // https://stackoverflow.com/questions/4310953/invalid-date-in-safari
- time = time.replace(new RegExp(/-/gm), '/')
- }
- }
-
- if ((typeof time === 'number') && (time.toString().length === 10)) {
- time = time * 1000
- }
- date = new Date(time)
- }
- const formatObj = {
- y: date.getFullYear(),
- m: date.getMonth() + 1,
- d: date.getDate(),
- h: date.getHours(),
- i: date.getMinutes(),
- s: date.getSeconds(),
- a: date.getDay()
- }
- const time_str = format.replace(/{([ymdhisa])+}/g, (result, key) => {
- const value = formatObj[key]
- // Note: getDay() returns 0 on Sunday
- if (key === 'a') { return ['日', '一', '二', '三', '四', '五', '六'][value ] }
- return value.toString().padStart(2, '0')
- })
- return time_str
-}
-
-/**
- * @param {number} time
- * @param {string} option
- * @returns {string}
- */
-export function formatTime(time, option) {
- if (('' + time).length === 10) {
- time = parseInt(time) * 1000
- } else {
- time = +time
- }
- const d = new Date(time)
- const now = Date.now()
-
- const diff = (now - d) / 1000
-
- if (diff < 30) {
- return '刚刚'
- } else if (diff < 3600) {
- // less 1 hour
- return Math.ceil(diff / 60) + '分钟前'
- } else if (diff < 3600 * 24) {
- return Math.ceil(diff / 3600) + '小时前'
- } else if (diff < 3600 * 24 * 2) {
- return '1天前'
- }
- if (option) {
- return parseTime(time, option)
- } else {
- return (
- d.getMonth() +
- 1 +
- '月' +
- d.getDate() +
- '日' +
- d.getHours() +
- '时' +
- d.getMinutes() +
- '分'
- )
- }
-}
-
-/**
- * @param {string} url
- * @returns {Object}
- */
-export function param2Obj(url) {
- const search = decodeURIComponent(url.split('?')[1]).replace(/\+/g, ' ')
- if (!search) {
- return {}
- }
- const obj = {}
- const searchArr = search.split('&')
- searchArr.forEach(v => {
- const index = v.indexOf('=')
- if (index !== -1) {
- const name = v.substring(0, index)
- const val = v.substring(index + 1, v.length)
- obj[name] = val
- }
- })
- return obj
+/**
+ * Created by PanJiaChen on 16/11/18.
+ */
+
+/**
+ * Parse the time to string
+ * @param {(Object|string|number)} time
+ * @param {string} cFormat
+ * @returns {string | null}
+ */
+export function parseTime(time, cFormat) {
+ if (arguments.length === 0 || !time) {
+ return null
+ }
+ const format = cFormat || '{y}-{m}-{d} {h}:{i}:{s}'
+ let date
+ if (typeof time === 'object') {
+ date = time
+ } else {
+ if ((typeof time === 'string')) {
+ if ((/^[0-9]+$/.test(time))) {
+ // support "1548221490638"
+ time = parseInt(time)
+ } else {
+ // support safari
+ // https://stackoverflow.com/questions/4310953/invalid-date-in-safari
+ time = time.replace(new RegExp(/-/gm), '/')
+ }
+ }
+
+ if ((typeof time === 'number') && (time.toString().length === 10)) {
+ time = time * 1000
+ }
+ date = new Date(time)
+ }
+ const formatObj = {
+ y: date.getFullYear(),
+ m: date.getMonth() + 1,
+ d: date.getDate(),
+ h: date.getHours(),
+ i: date.getMinutes(),
+ s: date.getSeconds(),
+ a: date.getDay()
+ }
+ const time_str = format.replace(/{([ymdhisa])+}/g, (result, key) => {
+ const value = formatObj[key]
+ // Note: getDay() returns 0 on Sunday
+ if (key === 'a') {
+ return ['日', '一', '二', '三', '四', '五', '六'][value]
+ }
+ return value.toString().padStart(2, '0')
+ })
+ return time_str
+}
+
+/**
+ * @param {number} time
+ * @param {string} option
+ * @returns {string}
+ */
+export function formatTime(time, option) {
+ if (('' + time).length === 10) {
+ time = parseInt(time) * 1000
+ } else {
+ time = +time
+ }
+ const d = new Date(time)
+ const now = Date.now()
+
+ const diff = (now - d) / 1000
+
+ if (diff < 30) {
+ return '刚刚'
+ } else if (diff < 3600) {
+ // less 1 hour
+ return Math.ceil(diff / 60) + '分钟前'
+ } else if (diff < 3600 * 24) {
+ return Math.ceil(diff / 3600) + '小时前'
+ } else if (diff < 3600 * 24 * 2) {
+ return '1天前'
+ }
+ if (option) {
+ return parseTime(time, option)
+ } else {
+ return (
+ d.getMonth() +
+ 1 +
+ '月' +
+ d.getDate() +
+ '日' +
+ d.getHours() +
+ '时' +
+ d.getMinutes() +
+ '分'
+ )
+ }
+}
+
+// 获取当前月份的第一天
+
+export function getCurrentMonthFirst() {
+ const date = new Date();
+
+ date.setDate(1);
+
+ var month = parseInt(date.getMonth() + 1);
+
+ var day = date.getDate();
+
+ if (month < 10) {
+ month = '0' + month
+
+ }
+
+ if (day < 10) {
+ day = '0' + day
+
+ }
+
+ return date.getFullYear() + '-' + month + '-' + day;
+
+}
+
+// 获取当前月份的最后一天
+
+export function getCurrentMonthLast() {
+ const date = new Date();
+
+ var currentMonth = date.getMonth();
+
+ var nextMonth = ++currentMonth;
+
+ var nextMonthFirstDay = new Date(date.getFullYear(), nextMonth, 1);
+
+ var oneDay = 1000 * 60 * 60 * 24;
+
+ var lastTime = new Date(nextMonthFirstDay - oneDay);
+
+ var month = parseInt(lastTime.getMonth() + 1);
+
+ var day = lastTime.getDate();
+
+ if (month < 10) {
+ month = '0' + month
+
+ }
+
+ if (day < 10) {
+ day = '0' + day
+
+ }
+
+ return date.getFullYear() + '-' + month + '-' + day;
+
+}
+
+/**
+ * @param {string} url
+ * @returns {Object}
+ */
+export function param2Obj(url) {
+ const search = decodeURIComponent(url.split('?')[1]).replace(/\+/g, ' ')
+ if (!search) {
+ return {}
+ }
+ const obj = {}
+ const searchArr = search.split('&')
+ searchArr.forEach(v => {
+ const index = v.indexOf('=')
+ if (index !== -1) {
+ const name = v.substring(0, index)
+ const val = v.substring(index + 1, v.length)
+ obj[name] = val
+ }
+ })
+ return obj
}
diff --git a/src/views/rain/inspection/components/maps.vue b/src/views/rain/inspection/components/maps.vue
index b7f96c4..ad1c3b9 100644
--- a/src/views/rain/inspection/components/maps.vue
+++ b/src/views/rain/inspection/components/maps.vue
@@ -205,7 +205,7 @@ export default {
roadloading: false,
mapdatesearch:"",
selects: {
-
+
},
};
@@ -294,7 +294,6 @@ export default {
this.singleclick()
// this.map.layer2.setVisible(false)
-
},
diff --git a/src/views/rain/inspection/inspection.vue b/src/views/rain/inspection/inspection.vue
index 7faa1fe..f445513 100644
--- a/src/views/rain/inspection/inspection.vue
+++ b/src/views/rain/inspection/inspection.vue
@@ -50,7 +50,7 @@
-
+
@@ -507,6 +507,8 @@
listall({
page: 1,
page_size: 9999999,
+ start_date:getCurrentMonthFirst(),
+ end_date:getCurrentMonthLast(),
...search
}).then(response => {
for (var m of response.data) {
diff --git a/src/views/rain/maintain/maintain.vue b/src/views/rain/maintain/maintain.vue
index bc51602..baf35ba 100644
--- a/src/views/rain/maintain/maintain.vue
+++ b/src/views/rain/maintain/maintain.vue
@@ -46,7 +46,7 @@
-
+
@@ -221,7 +221,8 @@
import editCirculation from '@/views/rain/maintain/components/editCirculation'
import editMire from '@/views/rain/maintain/components/editMire'
import AvueMap from 'avue-plugin-map'
- import maps from '@/views/rain/maintain/components/maps'
+ import maps from '@/views/rain/maintain/components/maps'
+ import {getCurrentMonthFirst,getCurrentMonthLast} from "@/utils/index"
export default {
components: {
@@ -539,12 +540,27 @@
listmain({
page: 1,
page_size: 9999999,
+ start_date:getCurrentMonthFirst(),
+ end_date:getCurrentMonthLast(),
...search
}).then(response => {
for (var m of response.data) {
- this.mapArr.push([
- m.longitude,m.latitude,m.address,m.id,m.old_type
- ])
+ if(m.help_discharge_info){
+ this.mapArr.push([
+ m.help_discharge_info.longitude,m.help_discharge_info.latitude,m.help_discharge_info.address,m.id,m.old_type
+ ])
+ }
+ if(m.circulation_info){
+ this.mapArr.push([
+ m.circulation_info.longitude,m.circulation_info.latitude,m.circulation_info.address,m.id,m.old_type
+ ])
+ }
+ if(m.mire_info){
+ this.mapArr.push([
+ m.mire_info.longitude,m.mire_info.latitude,m.mire_info.address,m.id,m.old_type
+ ])
+ }
+
}
this.$refs.maps.showSearch = false
this.$refs.maps.pointArr = this.mapArr