diff --git a/config/index.js b/config/index.js index 8abd37a..19b33b1 100644 --- a/config/index.js +++ b/config/index.js @@ -69,7 +69,7 @@ * then assetsPublicPath should be set to "/bar/". * In most cases please use '/' !!! */ - assetsPublicPath: '/', + assetsPublicPath: '/toilet/', /** * Source Maps diff --git a/config/index.js b/config/index.js index 8abd37a..19b33b1 100644 --- a/config/index.js +++ b/config/index.js @@ -69,7 +69,7 @@ * then assetsPublicPath should be set to "/bar/". * In most cases please use '/' !!! */ - assetsPublicPath: '/', + assetsPublicPath: '/toilet/', /** * Source Maps diff --git a/package.json b/package.json index 45f055f..9f3a3eb 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "echarts": "^4.2.1", "element-ui": "2.13.0", "event-source-polyfill": "^1.0.5", + "file-saver": "^2.0.5", "js-cookie": "2.2.0", "jsencrypt": "^3.0.0-rc.1", "leaflet": "^1.7.1", @@ -33,7 +34,9 @@ "vue-amap": "^0.5.9", "vue-baidu-map": "^0.21.22", "vue-router": "3.0.1", - "vuex": "3.0.1" + "vue2-leaflet": "^2.7.0", + "vuex": "3.0.1", + "xlsx": "^0.17.0" }, "devDependencies": { "autoprefixer": "8.5.0", diff --git a/config/index.js b/config/index.js index 8abd37a..19b33b1 100644 --- a/config/index.js +++ b/config/index.js @@ -69,7 +69,7 @@ * then assetsPublicPath should be set to "/bar/". * In most cases please use '/' !!! */ - assetsPublicPath: '/', + assetsPublicPath: '/toilet/', /** * Source Maps diff --git a/package.json b/package.json index 45f055f..9f3a3eb 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "echarts": "^4.2.1", "element-ui": "2.13.0", "event-source-polyfill": "^1.0.5", + "file-saver": "^2.0.5", "js-cookie": "2.2.0", "jsencrypt": "^3.0.0-rc.1", "leaflet": "^1.7.1", @@ -33,7 +34,9 @@ "vue-amap": "^0.5.9", "vue-baidu-map": "^0.21.22", "vue-router": "3.0.1", - "vuex": "3.0.1" + "vue2-leaflet": "^2.7.0", + "vuex": "3.0.1", + "xlsx": "^0.17.0" }, "devDependencies": { "autoprefixer": "8.5.0", diff --git a/src/api/common.js b/src/api/common.js index 87c582b..7804714 100644 --- a/src/api/common.js +++ b/src/api/common.js @@ -2,10 +2,14 @@ * 常用接口 */ import request from '@/utils/request' +import Vue from 'vue' + // 模板下载 export function downloadTemplate(fileName) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath return request({ - url: 'template/download', + url: lampPath + 'template/download', method: 'get', params: { filename: fileName @@ -19,7 +23,7 @@ const param = new FormData() param.append('file', fileobj.file) return request({ - url: 'imageUpload', + url: 'fileUpload', method: 'post', headers: { 'Content-Type': 'multipart/form-data' }, data: param diff --git a/config/index.js b/config/index.js index 8abd37a..19b33b1 100644 --- a/config/index.js +++ b/config/index.js @@ -69,7 +69,7 @@ * then assetsPublicPath should be set to "/bar/". * In most cases please use '/' !!! */ - assetsPublicPath: '/', + assetsPublicPath: '/toilet/', /** * Source Maps diff --git a/package.json b/package.json index 45f055f..9f3a3eb 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "echarts": "^4.2.1", "element-ui": "2.13.0", "event-source-polyfill": "^1.0.5", + "file-saver": "^2.0.5", "js-cookie": "2.2.0", "jsencrypt": "^3.0.0-rc.1", "leaflet": "^1.7.1", @@ -33,7 +34,9 @@ "vue-amap": "^0.5.9", "vue-baidu-map": "^0.21.22", "vue-router": "3.0.1", - "vuex": "3.0.1" + "vue2-leaflet": "^2.7.0", + "vuex": "3.0.1", + "xlsx": "^0.17.0" }, "devDependencies": { "autoprefixer": "8.5.0", diff --git a/src/api/common.js b/src/api/common.js index 87c582b..7804714 100644 --- a/src/api/common.js +++ b/src/api/common.js @@ -2,10 +2,14 @@ * 常用接口 */ import request from '@/utils/request' +import Vue from 'vue' + // 模板下载 export function downloadTemplate(fileName) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath return request({ - url: 'template/download', + url: lampPath + 'template/download', method: 'get', params: { filename: fileName @@ -19,7 +23,7 @@ const param = new FormData() param.append('file', fileobj.file) return request({ - url: 'imageUpload', + url: 'fileUpload', method: 'post', headers: { 'Content-Type': 'multipart/form-data' }, data: param diff --git a/src/api/sanitation/statistics.js b/src/api/sanitation/statistics.js new file mode 100644 index 0000000..ffeac18 --- /dev/null +++ b/src/api/sanitation/statistics.js @@ -0,0 +1,22 @@ + +/** + * 考核统计接口 + */ +import request from '@/utils/request' +// 公厕保洁次数统计 +export function getToiletJobCount(params) { + return request({ + url: '/sanitation/statistic/toilet/jobCount', + method: 'get', + params + }) +} + +// 公厕评分统计 +export function getToiletEvaluation(params) { + return request({ + url: '/sanitation/toiletEvaluation/statistics', + method: 'get', + params + }) +} diff --git a/config/index.js b/config/index.js index 8abd37a..19b33b1 100644 --- a/config/index.js +++ b/config/index.js @@ -69,7 +69,7 @@ * then assetsPublicPath should be set to "/bar/". * In most cases please use '/' !!! */ - assetsPublicPath: '/', + assetsPublicPath: '/toilet/', /** * Source Maps diff --git a/package.json b/package.json index 45f055f..9f3a3eb 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "echarts": "^4.2.1", "element-ui": "2.13.0", "event-source-polyfill": "^1.0.5", + "file-saver": "^2.0.5", "js-cookie": "2.2.0", "jsencrypt": "^3.0.0-rc.1", "leaflet": "^1.7.1", @@ -33,7 +34,9 @@ "vue-amap": "^0.5.9", "vue-baidu-map": "^0.21.22", "vue-router": "3.0.1", - "vuex": "3.0.1" + "vue2-leaflet": "^2.7.0", + "vuex": "3.0.1", + "xlsx": "^0.17.0" }, "devDependencies": { "autoprefixer": "8.5.0", diff --git a/src/api/common.js b/src/api/common.js index 87c582b..7804714 100644 --- a/src/api/common.js +++ b/src/api/common.js @@ -2,10 +2,14 @@ * 常用接口 */ import request from '@/utils/request' +import Vue from 'vue' + // 模板下载 export function downloadTemplate(fileName) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath return request({ - url: 'template/download', + url: lampPath + 'template/download', method: 'get', params: { filename: fileName @@ -19,7 +23,7 @@ const param = new FormData() param.append('file', fileobj.file) return request({ - url: 'imageUpload', + url: 'fileUpload', method: 'post', headers: { 'Content-Type': 'multipart/form-data' }, data: param diff --git a/src/api/sanitation/statistics.js b/src/api/sanitation/statistics.js new file mode 100644 index 0000000..ffeac18 --- /dev/null +++ b/src/api/sanitation/statistics.js @@ -0,0 +1,22 @@ + +/** + * 考核统计接口 + */ +import request from '@/utils/request' +// 公厕保洁次数统计 +export function getToiletJobCount(params) { + return request({ + url: '/sanitation/statistic/toilet/jobCount', + method: 'get', + params + }) +} + +// 公厕评分统计 +export function getToiletEvaluation(params) { + return request({ + url: '/sanitation/toiletEvaluation/statistics', + method: 'get', + params + }) +} diff --git a/src/api/sanitation/toilet.js b/src/api/sanitation/toilet.js new file mode 100644 index 0000000..11affd4 --- /dev/null +++ b/src/api/sanitation/toilet.js @@ -0,0 +1,133 @@ +/** + * 公厕管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' +// 公厕查询 +export function getToiletListPage(params) { + return request({ + url: '/sanitation/toilet/listPage', + method: 'get', + params + }) +} +// 公厕查询 +export function getToiletList(pid) { + return request({ + url: '/sanitation/toilet/list', + method: 'get', + params: { + pid: pid + } + }) +} + +// 添加公厕 +export function addToilet(params) { + return request({ + url: '/sanitation/toilet/add', + method: 'post', + params + }) +} +// 修改公厕机构 +export function updateToilet(params) { + return request({ + url: '/sanitation/toilet/update', + method: 'post', + params + }) +} +// 删除公厕机构 +export function delToilet(ids) { + return request({ + url: '/sanitation/toilet/delete', + method: 'post', + params: { + ids + }, + paramsSerializer: params => { + return qs.stringify(params, { indices: false }) + } + }) +} + +// 公厕基本信息详情 +export function getToiletInfoDetail(id) { + return request({ + url: '/sanitation/toilet/detail?toiletId=' + id, + method: 'get' + }) +} + +// 某公厕保洁记录 +export function getRecordsByToilet(params) { + return request({ + url: '/sanitation/toilet/jobRecord/detail', + method: 'get', + params + }) +} + +// 某公厕平均评分 +export function getScoreByToilet(params) { + return request({ + url: '/sanitation/toiletEvaluation/detailScore', + method: 'get', + params + }) +} + +// 某公厕评分列表 +export function getScoreListByToilet(params) { + return request({ + url: '/sanitation/toiletEvaluation/list', + method: 'get', + params + }) +} + + +// 批量导入 +export function batchImportToilet(fileobj) { + const param = new FormData() + param.append('file', fileobj) + return request({ + url: '/sanitation/toilet/import', + method: 'post', + headers: { 'Content-Type': 'multipart/form-data' }, + data: param + }) +} +// 批量导出 +export function batchExportToilet(params, config) { + return request({ + url: '/sanitation/toilet/export', + method: 'get', + timeout: 120000, + params, + ...config, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 公厕保洁记录查询 +export function getToiletJobRecords(params) { + return request({ + url: '/sanitation/toilet/jobRecord', + method: 'get', + params + }) +} + +// 批量导出 +export function batchExportToiletJobRecords(params, config) { + return request({ + url: '/sanitation/toilet/exportJobRecord', + method: 'get', + timeout: 120000, + params, + ...config, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} diff --git a/config/index.js b/config/index.js index 8abd37a..19b33b1 100644 --- a/config/index.js +++ b/config/index.js @@ -69,7 +69,7 @@ * then assetsPublicPath should be set to "/bar/". * In most cases please use '/' !!! */ - assetsPublicPath: '/', + assetsPublicPath: '/toilet/', /** * Source Maps diff --git a/package.json b/package.json index 45f055f..9f3a3eb 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "echarts": "^4.2.1", "element-ui": "2.13.0", "event-source-polyfill": "^1.0.5", + "file-saver": "^2.0.5", "js-cookie": "2.2.0", "jsencrypt": "^3.0.0-rc.1", "leaflet": "^1.7.1", @@ -33,7 +34,9 @@ "vue-amap": "^0.5.9", "vue-baidu-map": "^0.21.22", "vue-router": "3.0.1", - "vuex": "3.0.1" + "vue2-leaflet": "^2.7.0", + "vuex": "3.0.1", + "xlsx": "^0.17.0" }, "devDependencies": { "autoprefixer": "8.5.0", diff --git a/src/api/common.js b/src/api/common.js index 87c582b..7804714 100644 --- a/src/api/common.js +++ b/src/api/common.js @@ -2,10 +2,14 @@ * 常用接口 */ import request from '@/utils/request' +import Vue from 'vue' + // 模板下载 export function downloadTemplate(fileName) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath return request({ - url: 'template/download', + url: lampPath + 'template/download', method: 'get', params: { filename: fileName @@ -19,7 +23,7 @@ const param = new FormData() param.append('file', fileobj.file) return request({ - url: 'imageUpload', + url: 'fileUpload', method: 'post', headers: { 'Content-Type': 'multipart/form-data' }, data: param diff --git a/src/api/sanitation/statistics.js b/src/api/sanitation/statistics.js new file mode 100644 index 0000000..ffeac18 --- /dev/null +++ b/src/api/sanitation/statistics.js @@ -0,0 +1,22 @@ + +/** + * 考核统计接口 + */ +import request from '@/utils/request' +// 公厕保洁次数统计 +export function getToiletJobCount(params) { + return request({ + url: '/sanitation/statistic/toilet/jobCount', + method: 'get', + params + }) +} + +// 公厕评分统计 +export function getToiletEvaluation(params) { + return request({ + url: '/sanitation/toiletEvaluation/statistics', + method: 'get', + params + }) +} diff --git a/src/api/sanitation/toilet.js b/src/api/sanitation/toilet.js new file mode 100644 index 0000000..11affd4 --- /dev/null +++ b/src/api/sanitation/toilet.js @@ -0,0 +1,133 @@ +/** + * 公厕管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' +// 公厕查询 +export function getToiletListPage(params) { + return request({ + url: '/sanitation/toilet/listPage', + method: 'get', + params + }) +} +// 公厕查询 +export function getToiletList(pid) { + return request({ + url: '/sanitation/toilet/list', + method: 'get', + params: { + pid: pid + } + }) +} + +// 添加公厕 +export function addToilet(params) { + return request({ + url: '/sanitation/toilet/add', + method: 'post', + params + }) +} +// 修改公厕机构 +export function updateToilet(params) { + return request({ + url: '/sanitation/toilet/update', + method: 'post', + params + }) +} +// 删除公厕机构 +export function delToilet(ids) { + return request({ + url: '/sanitation/toilet/delete', + method: 'post', + params: { + ids + }, + paramsSerializer: params => { + return qs.stringify(params, { indices: false }) + } + }) +} + +// 公厕基本信息详情 +export function getToiletInfoDetail(id) { + return request({ + url: '/sanitation/toilet/detail?toiletId=' + id, + method: 'get' + }) +} + +// 某公厕保洁记录 +export function getRecordsByToilet(params) { + return request({ + url: '/sanitation/toilet/jobRecord/detail', + method: 'get', + params + }) +} + +// 某公厕平均评分 +export function getScoreByToilet(params) { + return request({ + url: '/sanitation/toiletEvaluation/detailScore', + method: 'get', + params + }) +} + +// 某公厕评分列表 +export function getScoreListByToilet(params) { + return request({ + url: '/sanitation/toiletEvaluation/list', + method: 'get', + params + }) +} + + +// 批量导入 +export function batchImportToilet(fileobj) { + const param = new FormData() + param.append('file', fileobj) + return request({ + url: '/sanitation/toilet/import', + method: 'post', + headers: { 'Content-Type': 'multipart/form-data' }, + data: param + }) +} +// 批量导出 +export function batchExportToilet(params, config) { + return request({ + url: '/sanitation/toilet/export', + method: 'get', + timeout: 120000, + params, + ...config, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 公厕保洁记录查询 +export function getToiletJobRecords(params) { + return request({ + url: '/sanitation/toilet/jobRecord', + method: 'get', + params + }) +} + +// 批量导出 +export function batchExportToiletJobRecords(params, config) { + return request({ + url: '/sanitation/toilet/exportJobRecord', + method: 'get', + timeout: 120000, + params, + ...config, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} diff --git a/src/api/system/alarm.js b/src/api/system/alarm.js new file mode 100644 index 0000000..1c3a7ab --- /dev/null +++ b/src/api/system/alarm.js @@ -0,0 +1,62 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' + +// 获取当前报警列表 +export function getAlarmNowList(params) { + return request({ + url: '/alarm/listNowPage', + method: 'get', + params + }) +} + +// 获取当前报警列表 +export function getAlarmHistoryList(params) { + return request({ + url: '/alarm/listHisPage', + method: 'get', + params + }) +} + + +// 批量消警 +export function clearAll(params) { + return request({ + url: '/alarm/allClear', + method: 'get', + params + }) +} + +// 消警 +export function clearAlarm(params) { + return request({ + url: '/alarm/cancel', + method: 'get', + params + }) +} + +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 设置报警阈值 +export function setThresh(params) { + return request({ + url: '/alarm/resetAlarmRule', + method: 'post', + params + }) +} diff --git a/config/index.js b/config/index.js index 8abd37a..19b33b1 100644 --- a/config/index.js +++ b/config/index.js @@ -69,7 +69,7 @@ * then assetsPublicPath should be set to "/bar/". * In most cases please use '/' !!! */ - assetsPublicPath: '/', + assetsPublicPath: '/toilet/', /** * Source Maps diff --git a/package.json b/package.json index 45f055f..9f3a3eb 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "echarts": "^4.2.1", "element-ui": "2.13.0", "event-source-polyfill": "^1.0.5", + "file-saver": "^2.0.5", "js-cookie": "2.2.0", "jsencrypt": "^3.0.0-rc.1", "leaflet": "^1.7.1", @@ -33,7 +34,9 @@ "vue-amap": "^0.5.9", "vue-baidu-map": "^0.21.22", "vue-router": "3.0.1", - "vuex": "3.0.1" + "vue2-leaflet": "^2.7.0", + "vuex": "3.0.1", + "xlsx": "^0.17.0" }, "devDependencies": { "autoprefixer": "8.5.0", diff --git a/src/api/common.js b/src/api/common.js index 87c582b..7804714 100644 --- a/src/api/common.js +++ b/src/api/common.js @@ -2,10 +2,14 @@ * 常用接口 */ import request from '@/utils/request' +import Vue from 'vue' + // 模板下载 export function downloadTemplate(fileName) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath return request({ - url: 'template/download', + url: lampPath + 'template/download', method: 'get', params: { filename: fileName @@ -19,7 +23,7 @@ const param = new FormData() param.append('file', fileobj.file) return request({ - url: 'imageUpload', + url: 'fileUpload', method: 'post', headers: { 'Content-Type': 'multipart/form-data' }, data: param diff --git a/src/api/sanitation/statistics.js b/src/api/sanitation/statistics.js new file mode 100644 index 0000000..ffeac18 --- /dev/null +++ b/src/api/sanitation/statistics.js @@ -0,0 +1,22 @@ + +/** + * 考核统计接口 + */ +import request from '@/utils/request' +// 公厕保洁次数统计 +export function getToiletJobCount(params) { + return request({ + url: '/sanitation/statistic/toilet/jobCount', + method: 'get', + params + }) +} + +// 公厕评分统计 +export function getToiletEvaluation(params) { + return request({ + url: '/sanitation/toiletEvaluation/statistics', + method: 'get', + params + }) +} diff --git a/src/api/sanitation/toilet.js b/src/api/sanitation/toilet.js new file mode 100644 index 0000000..11affd4 --- /dev/null +++ b/src/api/sanitation/toilet.js @@ -0,0 +1,133 @@ +/** + * 公厕管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' +// 公厕查询 +export function getToiletListPage(params) { + return request({ + url: '/sanitation/toilet/listPage', + method: 'get', + params + }) +} +// 公厕查询 +export function getToiletList(pid) { + return request({ + url: '/sanitation/toilet/list', + method: 'get', + params: { + pid: pid + } + }) +} + +// 添加公厕 +export function addToilet(params) { + return request({ + url: '/sanitation/toilet/add', + method: 'post', + params + }) +} +// 修改公厕机构 +export function updateToilet(params) { + return request({ + url: '/sanitation/toilet/update', + method: 'post', + params + }) +} +// 删除公厕机构 +export function delToilet(ids) { + return request({ + url: '/sanitation/toilet/delete', + method: 'post', + params: { + ids + }, + paramsSerializer: params => { + return qs.stringify(params, { indices: false }) + } + }) +} + +// 公厕基本信息详情 +export function getToiletInfoDetail(id) { + return request({ + url: '/sanitation/toilet/detail?toiletId=' + id, + method: 'get' + }) +} + +// 某公厕保洁记录 +export function getRecordsByToilet(params) { + return request({ + url: '/sanitation/toilet/jobRecord/detail', + method: 'get', + params + }) +} + +// 某公厕平均评分 +export function getScoreByToilet(params) { + return request({ + url: '/sanitation/toiletEvaluation/detailScore', + method: 'get', + params + }) +} + +// 某公厕评分列表 +export function getScoreListByToilet(params) { + return request({ + url: '/sanitation/toiletEvaluation/list', + method: 'get', + params + }) +} + + +// 批量导入 +export function batchImportToilet(fileobj) { + const param = new FormData() + param.append('file', fileobj) + return request({ + url: '/sanitation/toilet/import', + method: 'post', + headers: { 'Content-Type': 'multipart/form-data' }, + data: param + }) +} +// 批量导出 +export function batchExportToilet(params, config) { + return request({ + url: '/sanitation/toilet/export', + method: 'get', + timeout: 120000, + params, + ...config, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 公厕保洁记录查询 +export function getToiletJobRecords(params) { + return request({ + url: '/sanitation/toilet/jobRecord', + method: 'get', + params + }) +} + +// 批量导出 +export function batchExportToiletJobRecords(params, config) { + return request({ + url: '/sanitation/toilet/exportJobRecord', + method: 'get', + timeout: 120000, + params, + ...config, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} diff --git a/src/api/system/alarm.js b/src/api/system/alarm.js new file mode 100644 index 0000000..1c3a7ab --- /dev/null +++ b/src/api/system/alarm.js @@ -0,0 +1,62 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' + +// 获取当前报警列表 +export function getAlarmNowList(params) { + return request({ + url: '/alarm/listNowPage', + method: 'get', + params + }) +} + +// 获取当前报警列表 +export function getAlarmHistoryList(params) { + return request({ + url: '/alarm/listHisPage', + method: 'get', + params + }) +} + + +// 批量消警 +export function clearAll(params) { + return request({ + url: '/alarm/allClear', + method: 'get', + params + }) +} + +// 消警 +export function clearAlarm(params) { + return request({ + url: '/alarm/cancel', + method: 'get', + params + }) +} + +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 设置报警阈值 +export function setThresh(params) { + return request({ + url: '/alarm/resetAlarmRule', + method: 'post', + params + }) +} diff --git a/src/api/system/bridge.js b/src/api/system/bridge.js new file mode 100644 index 0000000..e8a4108 --- /dev/null +++ b/src/api/system/bridge.js @@ -0,0 +1,80 @@ +/** + * 桥梁管理接口 + */ +import request from '@/utils/request' + +// 获取桥梁详情 +export function getDetail(id) { + return request({ + url: '/bridge/detail', + method: 'get', + params: { + id: id + } + }) +} + +export function updateBridge(params) { + return request({ + url: '/bridge/update', + method: 'post', + params + }) +} +// 批量导出 +export function exportRecords(params) { + return request({ + url: 'device/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +export function getContentList(params) { + return request({ + url: 'maintain/contentByType', + method: 'get', + params: { + type: params + } + }) +} +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 编辑 +export function editRecord(params) { + return request({ + url: 'maintain/update', + method: 'post', + params + }) +} +// 新增 +export function addRecord(params) { + return request({ + url: 'maintain/add', + method: 'post', + params + }) +} +// 删除 +export function delRecord(id) { + return request({ + url: 'maintain/delete', + method: 'post', + params: { + id: id + } + }) +} diff --git a/config/index.js b/config/index.js index 8abd37a..19b33b1 100644 --- a/config/index.js +++ b/config/index.js @@ -69,7 +69,7 @@ * then assetsPublicPath should be set to "/bar/". * In most cases please use '/' !!! */ - assetsPublicPath: '/', + assetsPublicPath: '/toilet/', /** * Source Maps diff --git a/package.json b/package.json index 45f055f..9f3a3eb 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "echarts": "^4.2.1", "element-ui": "2.13.0", "event-source-polyfill": "^1.0.5", + "file-saver": "^2.0.5", "js-cookie": "2.2.0", "jsencrypt": "^3.0.0-rc.1", "leaflet": "^1.7.1", @@ -33,7 +34,9 @@ "vue-amap": "^0.5.9", "vue-baidu-map": "^0.21.22", "vue-router": "3.0.1", - "vuex": "3.0.1" + "vue2-leaflet": "^2.7.0", + "vuex": "3.0.1", + "xlsx": "^0.17.0" }, "devDependencies": { "autoprefixer": "8.5.0", diff --git a/src/api/common.js b/src/api/common.js index 87c582b..7804714 100644 --- a/src/api/common.js +++ b/src/api/common.js @@ -2,10 +2,14 @@ * 常用接口 */ import request from '@/utils/request' +import Vue from 'vue' + // 模板下载 export function downloadTemplate(fileName) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath return request({ - url: 'template/download', + url: lampPath + 'template/download', method: 'get', params: { filename: fileName @@ -19,7 +23,7 @@ const param = new FormData() param.append('file', fileobj.file) return request({ - url: 'imageUpload', + url: 'fileUpload', method: 'post', headers: { 'Content-Type': 'multipart/form-data' }, data: param diff --git a/src/api/sanitation/statistics.js b/src/api/sanitation/statistics.js new file mode 100644 index 0000000..ffeac18 --- /dev/null +++ b/src/api/sanitation/statistics.js @@ -0,0 +1,22 @@ + +/** + * 考核统计接口 + */ +import request from '@/utils/request' +// 公厕保洁次数统计 +export function getToiletJobCount(params) { + return request({ + url: '/sanitation/statistic/toilet/jobCount', + method: 'get', + params + }) +} + +// 公厕评分统计 +export function getToiletEvaluation(params) { + return request({ + url: '/sanitation/toiletEvaluation/statistics', + method: 'get', + params + }) +} diff --git a/src/api/sanitation/toilet.js b/src/api/sanitation/toilet.js new file mode 100644 index 0000000..11affd4 --- /dev/null +++ b/src/api/sanitation/toilet.js @@ -0,0 +1,133 @@ +/** + * 公厕管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' +// 公厕查询 +export function getToiletListPage(params) { + return request({ + url: '/sanitation/toilet/listPage', + method: 'get', + params + }) +} +// 公厕查询 +export function getToiletList(pid) { + return request({ + url: '/sanitation/toilet/list', + method: 'get', + params: { + pid: pid + } + }) +} + +// 添加公厕 +export function addToilet(params) { + return request({ + url: '/sanitation/toilet/add', + method: 'post', + params + }) +} +// 修改公厕机构 +export function updateToilet(params) { + return request({ + url: '/sanitation/toilet/update', + method: 'post', + params + }) +} +// 删除公厕机构 +export function delToilet(ids) { + return request({ + url: '/sanitation/toilet/delete', + method: 'post', + params: { + ids + }, + paramsSerializer: params => { + return qs.stringify(params, { indices: false }) + } + }) +} + +// 公厕基本信息详情 +export function getToiletInfoDetail(id) { + return request({ + url: '/sanitation/toilet/detail?toiletId=' + id, + method: 'get' + }) +} + +// 某公厕保洁记录 +export function getRecordsByToilet(params) { + return request({ + url: '/sanitation/toilet/jobRecord/detail', + method: 'get', + params + }) +} + +// 某公厕平均评分 +export function getScoreByToilet(params) { + return request({ + url: '/sanitation/toiletEvaluation/detailScore', + method: 'get', + params + }) +} + +// 某公厕评分列表 +export function getScoreListByToilet(params) { + return request({ + url: '/sanitation/toiletEvaluation/list', + method: 'get', + params + }) +} + + +// 批量导入 +export function batchImportToilet(fileobj) { + const param = new FormData() + param.append('file', fileobj) + return request({ + url: '/sanitation/toilet/import', + method: 'post', + headers: { 'Content-Type': 'multipart/form-data' }, + data: param + }) +} +// 批量导出 +export function batchExportToilet(params, config) { + return request({ + url: '/sanitation/toilet/export', + method: 'get', + timeout: 120000, + params, + ...config, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 公厕保洁记录查询 +export function getToiletJobRecords(params) { + return request({ + url: '/sanitation/toilet/jobRecord', + method: 'get', + params + }) +} + +// 批量导出 +export function batchExportToiletJobRecords(params, config) { + return request({ + url: '/sanitation/toilet/exportJobRecord', + method: 'get', + timeout: 120000, + params, + ...config, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} diff --git a/src/api/system/alarm.js b/src/api/system/alarm.js new file mode 100644 index 0000000..1c3a7ab --- /dev/null +++ b/src/api/system/alarm.js @@ -0,0 +1,62 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' + +// 获取当前报警列表 +export function getAlarmNowList(params) { + return request({ + url: '/alarm/listNowPage', + method: 'get', + params + }) +} + +// 获取当前报警列表 +export function getAlarmHistoryList(params) { + return request({ + url: '/alarm/listHisPage', + method: 'get', + params + }) +} + + +// 批量消警 +export function clearAll(params) { + return request({ + url: '/alarm/allClear', + method: 'get', + params + }) +} + +// 消警 +export function clearAlarm(params) { + return request({ + url: '/alarm/cancel', + method: 'get', + params + }) +} + +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 设置报警阈值 +export function setThresh(params) { + return request({ + url: '/alarm/resetAlarmRule', + method: 'post', + params + }) +} diff --git a/src/api/system/bridge.js b/src/api/system/bridge.js new file mode 100644 index 0000000..e8a4108 --- /dev/null +++ b/src/api/system/bridge.js @@ -0,0 +1,80 @@ +/** + * 桥梁管理接口 + */ +import request from '@/utils/request' + +// 获取桥梁详情 +export function getDetail(id) { + return request({ + url: '/bridge/detail', + method: 'get', + params: { + id: id + } + }) +} + +export function updateBridge(params) { + return request({ + url: '/bridge/update', + method: 'post', + params + }) +} +// 批量导出 +export function exportRecords(params) { + return request({ + url: 'device/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +export function getContentList(params) { + return request({ + url: 'maintain/contentByType', + method: 'get', + params: { + type: params + } + }) +} +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 编辑 +export function editRecord(params) { + return request({ + url: 'maintain/update', + method: 'post', + params + }) +} +// 新增 +export function addRecord(params) { + return request({ + url: 'maintain/add', + method: 'post', + params + }) +} +// 删除 +export function delRecord(id) { + return request({ + url: 'maintain/delete', + method: 'post', + params: { + id: id + } + }) +} diff --git a/src/api/system/data.js b/src/api/system/data.js new file mode 100644 index 0000000..4c95db5 --- /dev/null +++ b/src/api/system/data.js @@ -0,0 +1,63 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' + +// 获取当前报警列表 +export function getHistoryList(params) { + return request({ + url: '/data/hisListPage', + method: 'get', + params + }) +} + +// 获取当前报警列表 +export function getHistory(params) { + return request({ + url: '/data/hisList', + method: 'get', + params + }) +} + + + +// 批量消警 +export function clearAll(params) { + return request({ + url: '/alarm/allClear', + method: 'get', + params + }) +} + +// 消警 +export function clearAlarm(params) { + return request({ + url: '/alarm/cancel', + method: 'get', + params + }) +} + +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 设置报警阈值 +export function setThresh(params) { + return request({ + url: '/alarm/resetAlarmRule', + method: 'post', + params + }) +} diff --git a/config/index.js b/config/index.js index 8abd37a..19b33b1 100644 --- a/config/index.js +++ b/config/index.js @@ -69,7 +69,7 @@ * then assetsPublicPath should be set to "/bar/". * In most cases please use '/' !!! */ - assetsPublicPath: '/', + assetsPublicPath: '/toilet/', /** * Source Maps diff --git a/package.json b/package.json index 45f055f..9f3a3eb 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "echarts": "^4.2.1", "element-ui": "2.13.0", "event-source-polyfill": "^1.0.5", + "file-saver": "^2.0.5", "js-cookie": "2.2.0", "jsencrypt": "^3.0.0-rc.1", "leaflet": "^1.7.1", @@ -33,7 +34,9 @@ "vue-amap": "^0.5.9", "vue-baidu-map": "^0.21.22", "vue-router": "3.0.1", - "vuex": "3.0.1" + "vue2-leaflet": "^2.7.0", + "vuex": "3.0.1", + "xlsx": "^0.17.0" }, "devDependencies": { "autoprefixer": "8.5.0", diff --git a/src/api/common.js b/src/api/common.js index 87c582b..7804714 100644 --- a/src/api/common.js +++ b/src/api/common.js @@ -2,10 +2,14 @@ * 常用接口 */ import request from '@/utils/request' +import Vue from 'vue' + // 模板下载 export function downloadTemplate(fileName) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath return request({ - url: 'template/download', + url: lampPath + 'template/download', method: 'get', params: { filename: fileName @@ -19,7 +23,7 @@ const param = new FormData() param.append('file', fileobj.file) return request({ - url: 'imageUpload', + url: 'fileUpload', method: 'post', headers: { 'Content-Type': 'multipart/form-data' }, data: param diff --git a/src/api/sanitation/statistics.js b/src/api/sanitation/statistics.js new file mode 100644 index 0000000..ffeac18 --- /dev/null +++ b/src/api/sanitation/statistics.js @@ -0,0 +1,22 @@ + +/** + * 考核统计接口 + */ +import request from '@/utils/request' +// 公厕保洁次数统计 +export function getToiletJobCount(params) { + return request({ + url: '/sanitation/statistic/toilet/jobCount', + method: 'get', + params + }) +} + +// 公厕评分统计 +export function getToiletEvaluation(params) { + return request({ + url: '/sanitation/toiletEvaluation/statistics', + method: 'get', + params + }) +} diff --git a/src/api/sanitation/toilet.js b/src/api/sanitation/toilet.js new file mode 100644 index 0000000..11affd4 --- /dev/null +++ b/src/api/sanitation/toilet.js @@ -0,0 +1,133 @@ +/** + * 公厕管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' +// 公厕查询 +export function getToiletListPage(params) { + return request({ + url: '/sanitation/toilet/listPage', + method: 'get', + params + }) +} +// 公厕查询 +export function getToiletList(pid) { + return request({ + url: '/sanitation/toilet/list', + method: 'get', + params: { + pid: pid + } + }) +} + +// 添加公厕 +export function addToilet(params) { + return request({ + url: '/sanitation/toilet/add', + method: 'post', + params + }) +} +// 修改公厕机构 +export function updateToilet(params) { + return request({ + url: '/sanitation/toilet/update', + method: 'post', + params + }) +} +// 删除公厕机构 +export function delToilet(ids) { + return request({ + url: '/sanitation/toilet/delete', + method: 'post', + params: { + ids + }, + paramsSerializer: params => { + return qs.stringify(params, { indices: false }) + } + }) +} + +// 公厕基本信息详情 +export function getToiletInfoDetail(id) { + return request({ + url: '/sanitation/toilet/detail?toiletId=' + id, + method: 'get' + }) +} + +// 某公厕保洁记录 +export function getRecordsByToilet(params) { + return request({ + url: '/sanitation/toilet/jobRecord/detail', + method: 'get', + params + }) +} + +// 某公厕平均评分 +export function getScoreByToilet(params) { + return request({ + url: '/sanitation/toiletEvaluation/detailScore', + method: 'get', + params + }) +} + +// 某公厕评分列表 +export function getScoreListByToilet(params) { + return request({ + url: '/sanitation/toiletEvaluation/list', + method: 'get', + params + }) +} + + +// 批量导入 +export function batchImportToilet(fileobj) { + const param = new FormData() + param.append('file', fileobj) + return request({ + url: '/sanitation/toilet/import', + method: 'post', + headers: { 'Content-Type': 'multipart/form-data' }, + data: param + }) +} +// 批量导出 +export function batchExportToilet(params, config) { + return request({ + url: '/sanitation/toilet/export', + method: 'get', + timeout: 120000, + params, + ...config, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 公厕保洁记录查询 +export function getToiletJobRecords(params) { + return request({ + url: '/sanitation/toilet/jobRecord', + method: 'get', + params + }) +} + +// 批量导出 +export function batchExportToiletJobRecords(params, config) { + return request({ + url: '/sanitation/toilet/exportJobRecord', + method: 'get', + timeout: 120000, + params, + ...config, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} diff --git a/src/api/system/alarm.js b/src/api/system/alarm.js new file mode 100644 index 0000000..1c3a7ab --- /dev/null +++ b/src/api/system/alarm.js @@ -0,0 +1,62 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' + +// 获取当前报警列表 +export function getAlarmNowList(params) { + return request({ + url: '/alarm/listNowPage', + method: 'get', + params + }) +} + +// 获取当前报警列表 +export function getAlarmHistoryList(params) { + return request({ + url: '/alarm/listHisPage', + method: 'get', + params + }) +} + + +// 批量消警 +export function clearAll(params) { + return request({ + url: '/alarm/allClear', + method: 'get', + params + }) +} + +// 消警 +export function clearAlarm(params) { + return request({ + url: '/alarm/cancel', + method: 'get', + params + }) +} + +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 设置报警阈值 +export function setThresh(params) { + return request({ + url: '/alarm/resetAlarmRule', + method: 'post', + params + }) +} diff --git a/src/api/system/bridge.js b/src/api/system/bridge.js new file mode 100644 index 0000000..e8a4108 --- /dev/null +++ b/src/api/system/bridge.js @@ -0,0 +1,80 @@ +/** + * 桥梁管理接口 + */ +import request from '@/utils/request' + +// 获取桥梁详情 +export function getDetail(id) { + return request({ + url: '/bridge/detail', + method: 'get', + params: { + id: id + } + }) +} + +export function updateBridge(params) { + return request({ + url: '/bridge/update', + method: 'post', + params + }) +} +// 批量导出 +export function exportRecords(params) { + return request({ + url: 'device/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +export function getContentList(params) { + return request({ + url: 'maintain/contentByType', + method: 'get', + params: { + type: params + } + }) +} +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 编辑 +export function editRecord(params) { + return request({ + url: 'maintain/update', + method: 'post', + params + }) +} +// 新增 +export function addRecord(params) { + return request({ + url: 'maintain/add', + method: 'post', + params + }) +} +// 删除 +export function delRecord(id) { + return request({ + url: 'maintain/delete', + method: 'post', + params: { + id: id + } + }) +} diff --git a/src/api/system/data.js b/src/api/system/data.js new file mode 100644 index 0000000..4c95db5 --- /dev/null +++ b/src/api/system/data.js @@ -0,0 +1,63 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' + +// 获取当前报警列表 +export function getHistoryList(params) { + return request({ + url: '/data/hisListPage', + method: 'get', + params + }) +} + +// 获取当前报警列表 +export function getHistory(params) { + return request({ + url: '/data/hisList', + method: 'get', + params + }) +} + + + +// 批量消警 +export function clearAll(params) { + return request({ + url: '/alarm/allClear', + method: 'get', + params + }) +} + +// 消警 +export function clearAlarm(params) { + return request({ + url: '/alarm/cancel', + method: 'get', + params + }) +} + +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 设置报警阈值 +export function setThresh(params) { + return request({ + url: '/alarm/resetAlarmRule', + method: 'post', + params + }) +} diff --git a/src/api/system/order.js b/src/api/system/order.js new file mode 100644 index 0000000..7007c50 --- /dev/null +++ b/src/api/system/order.js @@ -0,0 +1,71 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +// import qs from 'qs' + +// 获取当前报警列表 +export function getRecordList(params) { + return request({ + url: '/maintain/listPage', + method: 'get', + params + }) +} +// 批量导出 +export function exportRecords(params) { + return request({ + url: 'device/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +export function getContentList(params) { + return request({ + url: 'maintain/contentByType', + method: 'get', + params: { + type: params + } + }) +} +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 编辑 +export function editRecord(params) { + return request({ + url: 'maintain/update', + method: 'post', + params + }) +} +// 新增 +export function addRecord(params) { + return request({ + url: 'maintain/add', + method: 'post', + params + }) +} +// 删除 +export function delRecord(id) { + return request({ + url: 'maintain/delete', + method: 'post', + params: { + bridgeMaintenanceId: id + } + }) +} diff --git a/config/index.js b/config/index.js index 8abd37a..19b33b1 100644 --- a/config/index.js +++ b/config/index.js @@ -69,7 +69,7 @@ * then assetsPublicPath should be set to "/bar/". * In most cases please use '/' !!! */ - assetsPublicPath: '/', + assetsPublicPath: '/toilet/', /** * Source Maps diff --git a/package.json b/package.json index 45f055f..9f3a3eb 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "echarts": "^4.2.1", "element-ui": "2.13.0", "event-source-polyfill": "^1.0.5", + "file-saver": "^2.0.5", "js-cookie": "2.2.0", "jsencrypt": "^3.0.0-rc.1", "leaflet": "^1.7.1", @@ -33,7 +34,9 @@ "vue-amap": "^0.5.9", "vue-baidu-map": "^0.21.22", "vue-router": "3.0.1", - "vuex": "3.0.1" + "vue2-leaflet": "^2.7.0", + "vuex": "3.0.1", + "xlsx": "^0.17.0" }, "devDependencies": { "autoprefixer": "8.5.0", diff --git a/src/api/common.js b/src/api/common.js index 87c582b..7804714 100644 --- a/src/api/common.js +++ b/src/api/common.js @@ -2,10 +2,14 @@ * 常用接口 */ import request from '@/utils/request' +import Vue from 'vue' + // 模板下载 export function downloadTemplate(fileName) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath return request({ - url: 'template/download', + url: lampPath + 'template/download', method: 'get', params: { filename: fileName @@ -19,7 +23,7 @@ const param = new FormData() param.append('file', fileobj.file) return request({ - url: 'imageUpload', + url: 'fileUpload', method: 'post', headers: { 'Content-Type': 'multipart/form-data' }, data: param diff --git a/src/api/sanitation/statistics.js b/src/api/sanitation/statistics.js new file mode 100644 index 0000000..ffeac18 --- /dev/null +++ b/src/api/sanitation/statistics.js @@ -0,0 +1,22 @@ + +/** + * 考核统计接口 + */ +import request from '@/utils/request' +// 公厕保洁次数统计 +export function getToiletJobCount(params) { + return request({ + url: '/sanitation/statistic/toilet/jobCount', + method: 'get', + params + }) +} + +// 公厕评分统计 +export function getToiletEvaluation(params) { + return request({ + url: '/sanitation/toiletEvaluation/statistics', + method: 'get', + params + }) +} diff --git a/src/api/sanitation/toilet.js b/src/api/sanitation/toilet.js new file mode 100644 index 0000000..11affd4 --- /dev/null +++ b/src/api/sanitation/toilet.js @@ -0,0 +1,133 @@ +/** + * 公厕管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' +// 公厕查询 +export function getToiletListPage(params) { + return request({ + url: '/sanitation/toilet/listPage', + method: 'get', + params + }) +} +// 公厕查询 +export function getToiletList(pid) { + return request({ + url: '/sanitation/toilet/list', + method: 'get', + params: { + pid: pid + } + }) +} + +// 添加公厕 +export function addToilet(params) { + return request({ + url: '/sanitation/toilet/add', + method: 'post', + params + }) +} +// 修改公厕机构 +export function updateToilet(params) { + return request({ + url: '/sanitation/toilet/update', + method: 'post', + params + }) +} +// 删除公厕机构 +export function delToilet(ids) { + return request({ + url: '/sanitation/toilet/delete', + method: 'post', + params: { + ids + }, + paramsSerializer: params => { + return qs.stringify(params, { indices: false }) + } + }) +} + +// 公厕基本信息详情 +export function getToiletInfoDetail(id) { + return request({ + url: '/sanitation/toilet/detail?toiletId=' + id, + method: 'get' + }) +} + +// 某公厕保洁记录 +export function getRecordsByToilet(params) { + return request({ + url: '/sanitation/toilet/jobRecord/detail', + method: 'get', + params + }) +} + +// 某公厕平均评分 +export function getScoreByToilet(params) { + return request({ + url: '/sanitation/toiletEvaluation/detailScore', + method: 'get', + params + }) +} + +// 某公厕评分列表 +export function getScoreListByToilet(params) { + return request({ + url: '/sanitation/toiletEvaluation/list', + method: 'get', + params + }) +} + + +// 批量导入 +export function batchImportToilet(fileobj) { + const param = new FormData() + param.append('file', fileobj) + return request({ + url: '/sanitation/toilet/import', + method: 'post', + headers: { 'Content-Type': 'multipart/form-data' }, + data: param + }) +} +// 批量导出 +export function batchExportToilet(params, config) { + return request({ + url: '/sanitation/toilet/export', + method: 'get', + timeout: 120000, + params, + ...config, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 公厕保洁记录查询 +export function getToiletJobRecords(params) { + return request({ + url: '/sanitation/toilet/jobRecord', + method: 'get', + params + }) +} + +// 批量导出 +export function batchExportToiletJobRecords(params, config) { + return request({ + url: '/sanitation/toilet/exportJobRecord', + method: 'get', + timeout: 120000, + params, + ...config, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} diff --git a/src/api/system/alarm.js b/src/api/system/alarm.js new file mode 100644 index 0000000..1c3a7ab --- /dev/null +++ b/src/api/system/alarm.js @@ -0,0 +1,62 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' + +// 获取当前报警列表 +export function getAlarmNowList(params) { + return request({ + url: '/alarm/listNowPage', + method: 'get', + params + }) +} + +// 获取当前报警列表 +export function getAlarmHistoryList(params) { + return request({ + url: '/alarm/listHisPage', + method: 'get', + params + }) +} + + +// 批量消警 +export function clearAll(params) { + return request({ + url: '/alarm/allClear', + method: 'get', + params + }) +} + +// 消警 +export function clearAlarm(params) { + return request({ + url: '/alarm/cancel', + method: 'get', + params + }) +} + +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 设置报警阈值 +export function setThresh(params) { + return request({ + url: '/alarm/resetAlarmRule', + method: 'post', + params + }) +} diff --git a/src/api/system/bridge.js b/src/api/system/bridge.js new file mode 100644 index 0000000..e8a4108 --- /dev/null +++ b/src/api/system/bridge.js @@ -0,0 +1,80 @@ +/** + * 桥梁管理接口 + */ +import request from '@/utils/request' + +// 获取桥梁详情 +export function getDetail(id) { + return request({ + url: '/bridge/detail', + method: 'get', + params: { + id: id + } + }) +} + +export function updateBridge(params) { + return request({ + url: '/bridge/update', + method: 'post', + params + }) +} +// 批量导出 +export function exportRecords(params) { + return request({ + url: 'device/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +export function getContentList(params) { + return request({ + url: 'maintain/contentByType', + method: 'get', + params: { + type: params + } + }) +} +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 编辑 +export function editRecord(params) { + return request({ + url: 'maintain/update', + method: 'post', + params + }) +} +// 新增 +export function addRecord(params) { + return request({ + url: 'maintain/add', + method: 'post', + params + }) +} +// 删除 +export function delRecord(id) { + return request({ + url: 'maintain/delete', + method: 'post', + params: { + id: id + } + }) +} diff --git a/src/api/system/data.js b/src/api/system/data.js new file mode 100644 index 0000000..4c95db5 --- /dev/null +++ b/src/api/system/data.js @@ -0,0 +1,63 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' + +// 获取当前报警列表 +export function getHistoryList(params) { + return request({ + url: '/data/hisListPage', + method: 'get', + params + }) +} + +// 获取当前报警列表 +export function getHistory(params) { + return request({ + url: '/data/hisList', + method: 'get', + params + }) +} + + + +// 批量消警 +export function clearAll(params) { + return request({ + url: '/alarm/allClear', + method: 'get', + params + }) +} + +// 消警 +export function clearAlarm(params) { + return request({ + url: '/alarm/cancel', + method: 'get', + params + }) +} + +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 设置报警阈值 +export function setThresh(params) { + return request({ + url: '/alarm/resetAlarmRule', + method: 'post', + params + }) +} diff --git a/src/api/system/order.js b/src/api/system/order.js new file mode 100644 index 0000000..7007c50 --- /dev/null +++ b/src/api/system/order.js @@ -0,0 +1,71 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +// import qs from 'qs' + +// 获取当前报警列表 +export function getRecordList(params) { + return request({ + url: '/maintain/listPage', + method: 'get', + params + }) +} +// 批量导出 +export function exportRecords(params) { + return request({ + url: 'device/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +export function getContentList(params) { + return request({ + url: 'maintain/contentByType', + method: 'get', + params: { + type: params + } + }) +} +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 编辑 +export function editRecord(params) { + return request({ + url: 'maintain/update', + method: 'post', + params + }) +} +// 新增 +export function addRecord(params) { + return request({ + url: 'maintain/add', + method: 'post', + params + }) +} +// 删除 +export function delRecord(id) { + return request({ + url: 'maintain/delete', + method: 'post', + params: { + bridgeMaintenanceId: id + } + }) +} diff --git a/src/api/system/overview.js b/src/api/system/overview.js new file mode 100644 index 0000000..bca50cc --- /dev/null +++ b/src/api/system/overview.js @@ -0,0 +1,109 @@ +import request from '@/utils/request' +import qs from "qs" +import Vue from 'vue' + +// 路灯状态统计 +export function getLampStatus() { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampStatus', + method: 'get' + }) +} + +// 路灯总览列表 +export function getLampList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampList', + method: 'get', + params + }) +} + +// 路灯详情 +export function getlampDetail(lampId) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampDetail', + method: 'get', + params: { + lampId: lampId + } + }) +} + +// 回路列表 +export function getCircuitList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/circuitList', + method: 'get', + params + }) +} + +// 灯箱列表 +export function getLampBoxList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampBoxList', + method: 'get', + params + }) +} +// 灯箱详情 +export function getLampBoxDetail(lampBoxId) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampBoxDetail', + method: 'get', + params: { + lampBoxId: lampBoxId + } + }) +} + +// 报警总览列表 +export function getAlarmList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/alarmList', + method: 'get', + params + }) +} + +// 报警详情 +export function getAlarmDetail(alarmId) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/alarmDetail', + method: 'get', + params: { + alarmId: alarmId + } + }) +} + +// 路灯控制 +export function lampControl(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampControl', + method: 'post', + params, + paramsSerializer: params => { + return qs.stringify(params, { indices: false }) + } + }) +} diff --git a/config/index.js b/config/index.js index 8abd37a..19b33b1 100644 --- a/config/index.js +++ b/config/index.js @@ -69,7 +69,7 @@ * then assetsPublicPath should be set to "/bar/". * In most cases please use '/' !!! */ - assetsPublicPath: '/', + assetsPublicPath: '/toilet/', /** * Source Maps diff --git a/package.json b/package.json index 45f055f..9f3a3eb 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "echarts": "^4.2.1", "element-ui": "2.13.0", "event-source-polyfill": "^1.0.5", + "file-saver": "^2.0.5", "js-cookie": "2.2.0", "jsencrypt": "^3.0.0-rc.1", "leaflet": "^1.7.1", @@ -33,7 +34,9 @@ "vue-amap": "^0.5.9", "vue-baidu-map": "^0.21.22", "vue-router": "3.0.1", - "vuex": "3.0.1" + "vue2-leaflet": "^2.7.0", + "vuex": "3.0.1", + "xlsx": "^0.17.0" }, "devDependencies": { "autoprefixer": "8.5.0", diff --git a/src/api/common.js b/src/api/common.js index 87c582b..7804714 100644 --- a/src/api/common.js +++ b/src/api/common.js @@ -2,10 +2,14 @@ * 常用接口 */ import request from '@/utils/request' +import Vue from 'vue' + // 模板下载 export function downloadTemplate(fileName) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath return request({ - url: 'template/download', + url: lampPath + 'template/download', method: 'get', params: { filename: fileName @@ -19,7 +23,7 @@ const param = new FormData() param.append('file', fileobj.file) return request({ - url: 'imageUpload', + url: 'fileUpload', method: 'post', headers: { 'Content-Type': 'multipart/form-data' }, data: param diff --git a/src/api/sanitation/statistics.js b/src/api/sanitation/statistics.js new file mode 100644 index 0000000..ffeac18 --- /dev/null +++ b/src/api/sanitation/statistics.js @@ -0,0 +1,22 @@ + +/** + * 考核统计接口 + */ +import request from '@/utils/request' +// 公厕保洁次数统计 +export function getToiletJobCount(params) { + return request({ + url: '/sanitation/statistic/toilet/jobCount', + method: 'get', + params + }) +} + +// 公厕评分统计 +export function getToiletEvaluation(params) { + return request({ + url: '/sanitation/toiletEvaluation/statistics', + method: 'get', + params + }) +} diff --git a/src/api/sanitation/toilet.js b/src/api/sanitation/toilet.js new file mode 100644 index 0000000..11affd4 --- /dev/null +++ b/src/api/sanitation/toilet.js @@ -0,0 +1,133 @@ +/** + * 公厕管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' +// 公厕查询 +export function getToiletListPage(params) { + return request({ + url: '/sanitation/toilet/listPage', + method: 'get', + params + }) +} +// 公厕查询 +export function getToiletList(pid) { + return request({ + url: '/sanitation/toilet/list', + method: 'get', + params: { + pid: pid + } + }) +} + +// 添加公厕 +export function addToilet(params) { + return request({ + url: '/sanitation/toilet/add', + method: 'post', + params + }) +} +// 修改公厕机构 +export function updateToilet(params) { + return request({ + url: '/sanitation/toilet/update', + method: 'post', + params + }) +} +// 删除公厕机构 +export function delToilet(ids) { + return request({ + url: '/sanitation/toilet/delete', + method: 'post', + params: { + ids + }, + paramsSerializer: params => { + return qs.stringify(params, { indices: false }) + } + }) +} + +// 公厕基本信息详情 +export function getToiletInfoDetail(id) { + return request({ + url: '/sanitation/toilet/detail?toiletId=' + id, + method: 'get' + }) +} + +// 某公厕保洁记录 +export function getRecordsByToilet(params) { + return request({ + url: '/sanitation/toilet/jobRecord/detail', + method: 'get', + params + }) +} + +// 某公厕平均评分 +export function getScoreByToilet(params) { + return request({ + url: '/sanitation/toiletEvaluation/detailScore', + method: 'get', + params + }) +} + +// 某公厕评分列表 +export function getScoreListByToilet(params) { + return request({ + url: '/sanitation/toiletEvaluation/list', + method: 'get', + params + }) +} + + +// 批量导入 +export function batchImportToilet(fileobj) { + const param = new FormData() + param.append('file', fileobj) + return request({ + url: '/sanitation/toilet/import', + method: 'post', + headers: { 'Content-Type': 'multipart/form-data' }, + data: param + }) +} +// 批量导出 +export function batchExportToilet(params, config) { + return request({ + url: '/sanitation/toilet/export', + method: 'get', + timeout: 120000, + params, + ...config, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 公厕保洁记录查询 +export function getToiletJobRecords(params) { + return request({ + url: '/sanitation/toilet/jobRecord', + method: 'get', + params + }) +} + +// 批量导出 +export function batchExportToiletJobRecords(params, config) { + return request({ + url: '/sanitation/toilet/exportJobRecord', + method: 'get', + timeout: 120000, + params, + ...config, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} diff --git a/src/api/system/alarm.js b/src/api/system/alarm.js new file mode 100644 index 0000000..1c3a7ab --- /dev/null +++ b/src/api/system/alarm.js @@ -0,0 +1,62 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' + +// 获取当前报警列表 +export function getAlarmNowList(params) { + return request({ + url: '/alarm/listNowPage', + method: 'get', + params + }) +} + +// 获取当前报警列表 +export function getAlarmHistoryList(params) { + return request({ + url: '/alarm/listHisPage', + method: 'get', + params + }) +} + + +// 批量消警 +export function clearAll(params) { + return request({ + url: '/alarm/allClear', + method: 'get', + params + }) +} + +// 消警 +export function clearAlarm(params) { + return request({ + url: '/alarm/cancel', + method: 'get', + params + }) +} + +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 设置报警阈值 +export function setThresh(params) { + return request({ + url: '/alarm/resetAlarmRule', + method: 'post', + params + }) +} diff --git a/src/api/system/bridge.js b/src/api/system/bridge.js new file mode 100644 index 0000000..e8a4108 --- /dev/null +++ b/src/api/system/bridge.js @@ -0,0 +1,80 @@ +/** + * 桥梁管理接口 + */ +import request from '@/utils/request' + +// 获取桥梁详情 +export function getDetail(id) { + return request({ + url: '/bridge/detail', + method: 'get', + params: { + id: id + } + }) +} + +export function updateBridge(params) { + return request({ + url: '/bridge/update', + method: 'post', + params + }) +} +// 批量导出 +export function exportRecords(params) { + return request({ + url: 'device/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +export function getContentList(params) { + return request({ + url: 'maintain/contentByType', + method: 'get', + params: { + type: params + } + }) +} +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 编辑 +export function editRecord(params) { + return request({ + url: 'maintain/update', + method: 'post', + params + }) +} +// 新增 +export function addRecord(params) { + return request({ + url: 'maintain/add', + method: 'post', + params + }) +} +// 删除 +export function delRecord(id) { + return request({ + url: 'maintain/delete', + method: 'post', + params: { + id: id + } + }) +} diff --git a/src/api/system/data.js b/src/api/system/data.js new file mode 100644 index 0000000..4c95db5 --- /dev/null +++ b/src/api/system/data.js @@ -0,0 +1,63 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' + +// 获取当前报警列表 +export function getHistoryList(params) { + return request({ + url: '/data/hisListPage', + method: 'get', + params + }) +} + +// 获取当前报警列表 +export function getHistory(params) { + return request({ + url: '/data/hisList', + method: 'get', + params + }) +} + + + +// 批量消警 +export function clearAll(params) { + return request({ + url: '/alarm/allClear', + method: 'get', + params + }) +} + +// 消警 +export function clearAlarm(params) { + return request({ + url: '/alarm/cancel', + method: 'get', + params + }) +} + +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 设置报警阈值 +export function setThresh(params) { + return request({ + url: '/alarm/resetAlarmRule', + method: 'post', + params + }) +} diff --git a/src/api/system/order.js b/src/api/system/order.js new file mode 100644 index 0000000..7007c50 --- /dev/null +++ b/src/api/system/order.js @@ -0,0 +1,71 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +// import qs from 'qs' + +// 获取当前报警列表 +export function getRecordList(params) { + return request({ + url: '/maintain/listPage', + method: 'get', + params + }) +} +// 批量导出 +export function exportRecords(params) { + return request({ + url: 'device/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +export function getContentList(params) { + return request({ + url: 'maintain/contentByType', + method: 'get', + params: { + type: params + } + }) +} +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 编辑 +export function editRecord(params) { + return request({ + url: 'maintain/update', + method: 'post', + params + }) +} +// 新增 +export function addRecord(params) { + return request({ + url: 'maintain/add', + method: 'post', + params + }) +} +// 删除 +export function delRecord(id) { + return request({ + url: 'maintain/delete', + method: 'post', + params: { + bridgeMaintenanceId: id + } + }) +} diff --git a/src/api/system/overview.js b/src/api/system/overview.js new file mode 100644 index 0000000..bca50cc --- /dev/null +++ b/src/api/system/overview.js @@ -0,0 +1,109 @@ +import request from '@/utils/request' +import qs from "qs" +import Vue from 'vue' + +// 路灯状态统计 +export function getLampStatus() { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampStatus', + method: 'get' + }) +} + +// 路灯总览列表 +export function getLampList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampList', + method: 'get', + params + }) +} + +// 路灯详情 +export function getlampDetail(lampId) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampDetail', + method: 'get', + params: { + lampId: lampId + } + }) +} + +// 回路列表 +export function getCircuitList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/circuitList', + method: 'get', + params + }) +} + +// 灯箱列表 +export function getLampBoxList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampBoxList', + method: 'get', + params + }) +} +// 灯箱详情 +export function getLampBoxDetail(lampBoxId) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampBoxDetail', + method: 'get', + params: { + lampBoxId: lampBoxId + } + }) +} + +// 报警总览列表 +export function getAlarmList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/alarmList', + method: 'get', + params + }) +} + +// 报警详情 +export function getAlarmDetail(alarmId) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/alarmDetail', + method: 'get', + params: { + alarmId: alarmId + } + }) +} + +// 路灯控制 +export function lampControl(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampControl', + method: 'post', + params, + paramsSerializer: params => { + return qs.stringify(params, { indices: false }) + } + }) +} diff --git a/src/api/system/rule.js b/src/api/system/rule.js new file mode 100644 index 0000000..76c6b2d --- /dev/null +++ b/src/api/system/rule.js @@ -0,0 +1,59 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +// import qs from 'qs' + +// 获取当前报警列表 +export function getRuleList() { + return request({ + url: 'rule/listPage', + method: 'get' + }) +} +export function getContentList(params) { + return request({ + url: 'maintain/contentByType', + method: 'get', + params: { + type: params + } + }) +} +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 编辑 +export function editRecord(params) { + return request({ + url: 'maintain/update', + method: 'post', + params + }) +} +// 新增 +export function addRecord(params) { + return request({ + url: 'maintain/add', + method: 'post', + params + }) +} +// 删除 +export function delRecord(id) { + return request({ + url: 'maintain/delete', + method: 'post', + params: { + id: id + } + }) +} diff --git a/config/index.js b/config/index.js index 8abd37a..19b33b1 100644 --- a/config/index.js +++ b/config/index.js @@ -69,7 +69,7 @@ * then assetsPublicPath should be set to "/bar/". * In most cases please use '/' !!! */ - assetsPublicPath: '/', + assetsPublicPath: '/toilet/', /** * Source Maps diff --git a/package.json b/package.json index 45f055f..9f3a3eb 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "echarts": "^4.2.1", "element-ui": "2.13.0", "event-source-polyfill": "^1.0.5", + "file-saver": "^2.0.5", "js-cookie": "2.2.0", "jsencrypt": "^3.0.0-rc.1", "leaflet": "^1.7.1", @@ -33,7 +34,9 @@ "vue-amap": "^0.5.9", "vue-baidu-map": "^0.21.22", "vue-router": "3.0.1", - "vuex": "3.0.1" + "vue2-leaflet": "^2.7.0", + "vuex": "3.0.1", + "xlsx": "^0.17.0" }, "devDependencies": { "autoprefixer": "8.5.0", diff --git a/src/api/common.js b/src/api/common.js index 87c582b..7804714 100644 --- a/src/api/common.js +++ b/src/api/common.js @@ -2,10 +2,14 @@ * 常用接口 */ import request from '@/utils/request' +import Vue from 'vue' + // 模板下载 export function downloadTemplate(fileName) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath return request({ - url: 'template/download', + url: lampPath + 'template/download', method: 'get', params: { filename: fileName @@ -19,7 +23,7 @@ const param = new FormData() param.append('file', fileobj.file) return request({ - url: 'imageUpload', + url: 'fileUpload', method: 'post', headers: { 'Content-Type': 'multipart/form-data' }, data: param diff --git a/src/api/sanitation/statistics.js b/src/api/sanitation/statistics.js new file mode 100644 index 0000000..ffeac18 --- /dev/null +++ b/src/api/sanitation/statistics.js @@ -0,0 +1,22 @@ + +/** + * 考核统计接口 + */ +import request from '@/utils/request' +// 公厕保洁次数统计 +export function getToiletJobCount(params) { + return request({ + url: '/sanitation/statistic/toilet/jobCount', + method: 'get', + params + }) +} + +// 公厕评分统计 +export function getToiletEvaluation(params) { + return request({ + url: '/sanitation/toiletEvaluation/statistics', + method: 'get', + params + }) +} diff --git a/src/api/sanitation/toilet.js b/src/api/sanitation/toilet.js new file mode 100644 index 0000000..11affd4 --- /dev/null +++ b/src/api/sanitation/toilet.js @@ -0,0 +1,133 @@ +/** + * 公厕管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' +// 公厕查询 +export function getToiletListPage(params) { + return request({ + url: '/sanitation/toilet/listPage', + method: 'get', + params + }) +} +// 公厕查询 +export function getToiletList(pid) { + return request({ + url: '/sanitation/toilet/list', + method: 'get', + params: { + pid: pid + } + }) +} + +// 添加公厕 +export function addToilet(params) { + return request({ + url: '/sanitation/toilet/add', + method: 'post', + params + }) +} +// 修改公厕机构 +export function updateToilet(params) { + return request({ + url: '/sanitation/toilet/update', + method: 'post', + params + }) +} +// 删除公厕机构 +export function delToilet(ids) { + return request({ + url: '/sanitation/toilet/delete', + method: 'post', + params: { + ids + }, + paramsSerializer: params => { + return qs.stringify(params, { indices: false }) + } + }) +} + +// 公厕基本信息详情 +export function getToiletInfoDetail(id) { + return request({ + url: '/sanitation/toilet/detail?toiletId=' + id, + method: 'get' + }) +} + +// 某公厕保洁记录 +export function getRecordsByToilet(params) { + return request({ + url: '/sanitation/toilet/jobRecord/detail', + method: 'get', + params + }) +} + +// 某公厕平均评分 +export function getScoreByToilet(params) { + return request({ + url: '/sanitation/toiletEvaluation/detailScore', + method: 'get', + params + }) +} + +// 某公厕评分列表 +export function getScoreListByToilet(params) { + return request({ + url: '/sanitation/toiletEvaluation/list', + method: 'get', + params + }) +} + + +// 批量导入 +export function batchImportToilet(fileobj) { + const param = new FormData() + param.append('file', fileobj) + return request({ + url: '/sanitation/toilet/import', + method: 'post', + headers: { 'Content-Type': 'multipart/form-data' }, + data: param + }) +} +// 批量导出 +export function batchExportToilet(params, config) { + return request({ + url: '/sanitation/toilet/export', + method: 'get', + timeout: 120000, + params, + ...config, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 公厕保洁记录查询 +export function getToiletJobRecords(params) { + return request({ + url: '/sanitation/toilet/jobRecord', + method: 'get', + params + }) +} + +// 批量导出 +export function batchExportToiletJobRecords(params, config) { + return request({ + url: '/sanitation/toilet/exportJobRecord', + method: 'get', + timeout: 120000, + params, + ...config, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} diff --git a/src/api/system/alarm.js b/src/api/system/alarm.js new file mode 100644 index 0000000..1c3a7ab --- /dev/null +++ b/src/api/system/alarm.js @@ -0,0 +1,62 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' + +// 获取当前报警列表 +export function getAlarmNowList(params) { + return request({ + url: '/alarm/listNowPage', + method: 'get', + params + }) +} + +// 获取当前报警列表 +export function getAlarmHistoryList(params) { + return request({ + url: '/alarm/listHisPage', + method: 'get', + params + }) +} + + +// 批量消警 +export function clearAll(params) { + return request({ + url: '/alarm/allClear', + method: 'get', + params + }) +} + +// 消警 +export function clearAlarm(params) { + return request({ + url: '/alarm/cancel', + method: 'get', + params + }) +} + +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 设置报警阈值 +export function setThresh(params) { + return request({ + url: '/alarm/resetAlarmRule', + method: 'post', + params + }) +} diff --git a/src/api/system/bridge.js b/src/api/system/bridge.js new file mode 100644 index 0000000..e8a4108 --- /dev/null +++ b/src/api/system/bridge.js @@ -0,0 +1,80 @@ +/** + * 桥梁管理接口 + */ +import request from '@/utils/request' + +// 获取桥梁详情 +export function getDetail(id) { + return request({ + url: '/bridge/detail', + method: 'get', + params: { + id: id + } + }) +} + +export function updateBridge(params) { + return request({ + url: '/bridge/update', + method: 'post', + params + }) +} +// 批量导出 +export function exportRecords(params) { + return request({ + url: 'device/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +export function getContentList(params) { + return request({ + url: 'maintain/contentByType', + method: 'get', + params: { + type: params + } + }) +} +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 编辑 +export function editRecord(params) { + return request({ + url: 'maintain/update', + method: 'post', + params + }) +} +// 新增 +export function addRecord(params) { + return request({ + url: 'maintain/add', + method: 'post', + params + }) +} +// 删除 +export function delRecord(id) { + return request({ + url: 'maintain/delete', + method: 'post', + params: { + id: id + } + }) +} diff --git a/src/api/system/data.js b/src/api/system/data.js new file mode 100644 index 0000000..4c95db5 --- /dev/null +++ b/src/api/system/data.js @@ -0,0 +1,63 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' + +// 获取当前报警列表 +export function getHistoryList(params) { + return request({ + url: '/data/hisListPage', + method: 'get', + params + }) +} + +// 获取当前报警列表 +export function getHistory(params) { + return request({ + url: '/data/hisList', + method: 'get', + params + }) +} + + + +// 批量消警 +export function clearAll(params) { + return request({ + url: '/alarm/allClear', + method: 'get', + params + }) +} + +// 消警 +export function clearAlarm(params) { + return request({ + url: '/alarm/cancel', + method: 'get', + params + }) +} + +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 设置报警阈值 +export function setThresh(params) { + return request({ + url: '/alarm/resetAlarmRule', + method: 'post', + params + }) +} diff --git a/src/api/system/order.js b/src/api/system/order.js new file mode 100644 index 0000000..7007c50 --- /dev/null +++ b/src/api/system/order.js @@ -0,0 +1,71 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +// import qs from 'qs' + +// 获取当前报警列表 +export function getRecordList(params) { + return request({ + url: '/maintain/listPage', + method: 'get', + params + }) +} +// 批量导出 +export function exportRecords(params) { + return request({ + url: 'device/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +export function getContentList(params) { + return request({ + url: 'maintain/contentByType', + method: 'get', + params: { + type: params + } + }) +} +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 编辑 +export function editRecord(params) { + return request({ + url: 'maintain/update', + method: 'post', + params + }) +} +// 新增 +export function addRecord(params) { + return request({ + url: 'maintain/add', + method: 'post', + params + }) +} +// 删除 +export function delRecord(id) { + return request({ + url: 'maintain/delete', + method: 'post', + params: { + bridgeMaintenanceId: id + } + }) +} diff --git a/src/api/system/overview.js b/src/api/system/overview.js new file mode 100644 index 0000000..bca50cc --- /dev/null +++ b/src/api/system/overview.js @@ -0,0 +1,109 @@ +import request from '@/utils/request' +import qs from "qs" +import Vue from 'vue' + +// 路灯状态统计 +export function getLampStatus() { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampStatus', + method: 'get' + }) +} + +// 路灯总览列表 +export function getLampList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampList', + method: 'get', + params + }) +} + +// 路灯详情 +export function getlampDetail(lampId) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampDetail', + method: 'get', + params: { + lampId: lampId + } + }) +} + +// 回路列表 +export function getCircuitList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/circuitList', + method: 'get', + params + }) +} + +// 灯箱列表 +export function getLampBoxList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampBoxList', + method: 'get', + params + }) +} +// 灯箱详情 +export function getLampBoxDetail(lampBoxId) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampBoxDetail', + method: 'get', + params: { + lampBoxId: lampBoxId + } + }) +} + +// 报警总览列表 +export function getAlarmList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/alarmList', + method: 'get', + params + }) +} + +// 报警详情 +export function getAlarmDetail(alarmId) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/alarmDetail', + method: 'get', + params: { + alarmId: alarmId + } + }) +} + +// 路灯控制 +export function lampControl(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampControl', + method: 'post', + params, + paramsSerializer: params => { + return qs.stringify(params, { indices: false }) + } + }) +} diff --git a/src/api/system/rule.js b/src/api/system/rule.js new file mode 100644 index 0000000..76c6b2d --- /dev/null +++ b/src/api/system/rule.js @@ -0,0 +1,59 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +// import qs from 'qs' + +// 获取当前报警列表 +export function getRuleList() { + return request({ + url: 'rule/listPage', + method: 'get' + }) +} +export function getContentList(params) { + return request({ + url: 'maintain/contentByType', + method: 'get', + params: { + type: params + } + }) +} +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 编辑 +export function editRecord(params) { + return request({ + url: 'maintain/update', + method: 'post', + params + }) +} +// 新增 +export function addRecord(params) { + return request({ + url: 'maintain/add', + method: 'post', + params + }) +} +// 删除 +export function delRecord(id) { + return request({ + url: 'maintain/delete', + method: 'post', + params: { + id: id + } + }) +} diff --git a/src/api/system/statistics.js b/src/api/system/statistics.js new file mode 100644 index 0000000..b25efe9 --- /dev/null +++ b/src/api/system/statistics.js @@ -0,0 +1,23 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +// import qs from 'qs' + +// +export function countByToilet(params) { + return request({ + url: '/sanitation/toiletStatistic/jobStaticByToilet', + method: 'get', + params + }) +} + +export function countByDay(params) { + return request({ + url: '/sanitation/toiletStatistic/jobStaticByDate', + method: 'get', + params + }) +} + diff --git a/config/index.js b/config/index.js index 8abd37a..19b33b1 100644 --- a/config/index.js +++ b/config/index.js @@ -69,7 +69,7 @@ * then assetsPublicPath should be set to "/bar/". * In most cases please use '/' !!! */ - assetsPublicPath: '/', + assetsPublicPath: '/toilet/', /** * Source Maps diff --git a/package.json b/package.json index 45f055f..9f3a3eb 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "echarts": "^4.2.1", "element-ui": "2.13.0", "event-source-polyfill": "^1.0.5", + "file-saver": "^2.0.5", "js-cookie": "2.2.0", "jsencrypt": "^3.0.0-rc.1", "leaflet": "^1.7.1", @@ -33,7 +34,9 @@ "vue-amap": "^0.5.9", "vue-baidu-map": "^0.21.22", "vue-router": "3.0.1", - "vuex": "3.0.1" + "vue2-leaflet": "^2.7.0", + "vuex": "3.0.1", + "xlsx": "^0.17.0" }, "devDependencies": { "autoprefixer": "8.5.0", diff --git a/src/api/common.js b/src/api/common.js index 87c582b..7804714 100644 --- a/src/api/common.js +++ b/src/api/common.js @@ -2,10 +2,14 @@ * 常用接口 */ import request from '@/utils/request' +import Vue from 'vue' + // 模板下载 export function downloadTemplate(fileName) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath return request({ - url: 'template/download', + url: lampPath + 'template/download', method: 'get', params: { filename: fileName @@ -19,7 +23,7 @@ const param = new FormData() param.append('file', fileobj.file) return request({ - url: 'imageUpload', + url: 'fileUpload', method: 'post', headers: { 'Content-Type': 'multipart/form-data' }, data: param diff --git a/src/api/sanitation/statistics.js b/src/api/sanitation/statistics.js new file mode 100644 index 0000000..ffeac18 --- /dev/null +++ b/src/api/sanitation/statistics.js @@ -0,0 +1,22 @@ + +/** + * 考核统计接口 + */ +import request from '@/utils/request' +// 公厕保洁次数统计 +export function getToiletJobCount(params) { + return request({ + url: '/sanitation/statistic/toilet/jobCount', + method: 'get', + params + }) +} + +// 公厕评分统计 +export function getToiletEvaluation(params) { + return request({ + url: '/sanitation/toiletEvaluation/statistics', + method: 'get', + params + }) +} diff --git a/src/api/sanitation/toilet.js b/src/api/sanitation/toilet.js new file mode 100644 index 0000000..11affd4 --- /dev/null +++ b/src/api/sanitation/toilet.js @@ -0,0 +1,133 @@ +/** + * 公厕管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' +// 公厕查询 +export function getToiletListPage(params) { + return request({ + url: '/sanitation/toilet/listPage', + method: 'get', + params + }) +} +// 公厕查询 +export function getToiletList(pid) { + return request({ + url: '/sanitation/toilet/list', + method: 'get', + params: { + pid: pid + } + }) +} + +// 添加公厕 +export function addToilet(params) { + return request({ + url: '/sanitation/toilet/add', + method: 'post', + params + }) +} +// 修改公厕机构 +export function updateToilet(params) { + return request({ + url: '/sanitation/toilet/update', + method: 'post', + params + }) +} +// 删除公厕机构 +export function delToilet(ids) { + return request({ + url: '/sanitation/toilet/delete', + method: 'post', + params: { + ids + }, + paramsSerializer: params => { + return qs.stringify(params, { indices: false }) + } + }) +} + +// 公厕基本信息详情 +export function getToiletInfoDetail(id) { + return request({ + url: '/sanitation/toilet/detail?toiletId=' + id, + method: 'get' + }) +} + +// 某公厕保洁记录 +export function getRecordsByToilet(params) { + return request({ + url: '/sanitation/toilet/jobRecord/detail', + method: 'get', + params + }) +} + +// 某公厕平均评分 +export function getScoreByToilet(params) { + return request({ + url: '/sanitation/toiletEvaluation/detailScore', + method: 'get', + params + }) +} + +// 某公厕评分列表 +export function getScoreListByToilet(params) { + return request({ + url: '/sanitation/toiletEvaluation/list', + method: 'get', + params + }) +} + + +// 批量导入 +export function batchImportToilet(fileobj) { + const param = new FormData() + param.append('file', fileobj) + return request({ + url: '/sanitation/toilet/import', + method: 'post', + headers: { 'Content-Type': 'multipart/form-data' }, + data: param + }) +} +// 批量导出 +export function batchExportToilet(params, config) { + return request({ + url: '/sanitation/toilet/export', + method: 'get', + timeout: 120000, + params, + ...config, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 公厕保洁记录查询 +export function getToiletJobRecords(params) { + return request({ + url: '/sanitation/toilet/jobRecord', + method: 'get', + params + }) +} + +// 批量导出 +export function batchExportToiletJobRecords(params, config) { + return request({ + url: '/sanitation/toilet/exportJobRecord', + method: 'get', + timeout: 120000, + params, + ...config, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} diff --git a/src/api/system/alarm.js b/src/api/system/alarm.js new file mode 100644 index 0000000..1c3a7ab --- /dev/null +++ b/src/api/system/alarm.js @@ -0,0 +1,62 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' + +// 获取当前报警列表 +export function getAlarmNowList(params) { + return request({ + url: '/alarm/listNowPage', + method: 'get', + params + }) +} + +// 获取当前报警列表 +export function getAlarmHistoryList(params) { + return request({ + url: '/alarm/listHisPage', + method: 'get', + params + }) +} + + +// 批量消警 +export function clearAll(params) { + return request({ + url: '/alarm/allClear', + method: 'get', + params + }) +} + +// 消警 +export function clearAlarm(params) { + return request({ + url: '/alarm/cancel', + method: 'get', + params + }) +} + +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 设置报警阈值 +export function setThresh(params) { + return request({ + url: '/alarm/resetAlarmRule', + method: 'post', + params + }) +} diff --git a/src/api/system/bridge.js b/src/api/system/bridge.js new file mode 100644 index 0000000..e8a4108 --- /dev/null +++ b/src/api/system/bridge.js @@ -0,0 +1,80 @@ +/** + * 桥梁管理接口 + */ +import request from '@/utils/request' + +// 获取桥梁详情 +export function getDetail(id) { + return request({ + url: '/bridge/detail', + method: 'get', + params: { + id: id + } + }) +} + +export function updateBridge(params) { + return request({ + url: '/bridge/update', + method: 'post', + params + }) +} +// 批量导出 +export function exportRecords(params) { + return request({ + url: 'device/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +export function getContentList(params) { + return request({ + url: 'maintain/contentByType', + method: 'get', + params: { + type: params + } + }) +} +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 编辑 +export function editRecord(params) { + return request({ + url: 'maintain/update', + method: 'post', + params + }) +} +// 新增 +export function addRecord(params) { + return request({ + url: 'maintain/add', + method: 'post', + params + }) +} +// 删除 +export function delRecord(id) { + return request({ + url: 'maintain/delete', + method: 'post', + params: { + id: id + } + }) +} diff --git a/src/api/system/data.js b/src/api/system/data.js new file mode 100644 index 0000000..4c95db5 --- /dev/null +++ b/src/api/system/data.js @@ -0,0 +1,63 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' + +// 获取当前报警列表 +export function getHistoryList(params) { + return request({ + url: '/data/hisListPage', + method: 'get', + params + }) +} + +// 获取当前报警列表 +export function getHistory(params) { + return request({ + url: '/data/hisList', + method: 'get', + params + }) +} + + + +// 批量消警 +export function clearAll(params) { + return request({ + url: '/alarm/allClear', + method: 'get', + params + }) +} + +// 消警 +export function clearAlarm(params) { + return request({ + url: '/alarm/cancel', + method: 'get', + params + }) +} + +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 设置报警阈值 +export function setThresh(params) { + return request({ + url: '/alarm/resetAlarmRule', + method: 'post', + params + }) +} diff --git a/src/api/system/order.js b/src/api/system/order.js new file mode 100644 index 0000000..7007c50 --- /dev/null +++ b/src/api/system/order.js @@ -0,0 +1,71 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +// import qs from 'qs' + +// 获取当前报警列表 +export function getRecordList(params) { + return request({ + url: '/maintain/listPage', + method: 'get', + params + }) +} +// 批量导出 +export function exportRecords(params) { + return request({ + url: 'device/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +export function getContentList(params) { + return request({ + url: 'maintain/contentByType', + method: 'get', + params: { + type: params + } + }) +} +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 编辑 +export function editRecord(params) { + return request({ + url: 'maintain/update', + method: 'post', + params + }) +} +// 新增 +export function addRecord(params) { + return request({ + url: 'maintain/add', + method: 'post', + params + }) +} +// 删除 +export function delRecord(id) { + return request({ + url: 'maintain/delete', + method: 'post', + params: { + bridgeMaintenanceId: id + } + }) +} diff --git a/src/api/system/overview.js b/src/api/system/overview.js new file mode 100644 index 0000000..bca50cc --- /dev/null +++ b/src/api/system/overview.js @@ -0,0 +1,109 @@ +import request from '@/utils/request' +import qs from "qs" +import Vue from 'vue' + +// 路灯状态统计 +export function getLampStatus() { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampStatus', + method: 'get' + }) +} + +// 路灯总览列表 +export function getLampList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampList', + method: 'get', + params + }) +} + +// 路灯详情 +export function getlampDetail(lampId) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampDetail', + method: 'get', + params: { + lampId: lampId + } + }) +} + +// 回路列表 +export function getCircuitList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/circuitList', + method: 'get', + params + }) +} + +// 灯箱列表 +export function getLampBoxList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampBoxList', + method: 'get', + params + }) +} +// 灯箱详情 +export function getLampBoxDetail(lampBoxId) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampBoxDetail', + method: 'get', + params: { + lampBoxId: lampBoxId + } + }) +} + +// 报警总览列表 +export function getAlarmList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/alarmList', + method: 'get', + params + }) +} + +// 报警详情 +export function getAlarmDetail(alarmId) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/alarmDetail', + method: 'get', + params: { + alarmId: alarmId + } + }) +} + +// 路灯控制 +export function lampControl(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampControl', + method: 'post', + params, + paramsSerializer: params => { + return qs.stringify(params, { indices: false }) + } + }) +} diff --git a/src/api/system/rule.js b/src/api/system/rule.js new file mode 100644 index 0000000..76c6b2d --- /dev/null +++ b/src/api/system/rule.js @@ -0,0 +1,59 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +// import qs from 'qs' + +// 获取当前报警列表 +export function getRuleList() { + return request({ + url: 'rule/listPage', + method: 'get' + }) +} +export function getContentList(params) { + return request({ + url: 'maintain/contentByType', + method: 'get', + params: { + type: params + } + }) +} +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 编辑 +export function editRecord(params) { + return request({ + url: 'maintain/update', + method: 'post', + params + }) +} +// 新增 +export function addRecord(params) { + return request({ + url: 'maintain/add', + method: 'post', + params + }) +} +// 删除 +export function delRecord(id) { + return request({ + url: 'maintain/delete', + method: 'post', + params: { + id: id + } + }) +} diff --git a/src/api/system/statistics.js b/src/api/system/statistics.js new file mode 100644 index 0000000..b25efe9 --- /dev/null +++ b/src/api/system/statistics.js @@ -0,0 +1,23 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +// import qs from 'qs' + +// +export function countByToilet(params) { + return request({ + url: '/sanitation/toiletStatistic/jobStaticByToilet', + method: 'get', + params + }) +} + +export function countByDay(params) { + return request({ + url: '/sanitation/toiletStatistic/jobStaticByDate', + method: 'get', + params + }) +} + diff --git a/src/assets/global_images/icon-position.png b/src/assets/global_images/icon-position.png new file mode 100644 index 0000000..7444038 --- /dev/null +++ b/src/assets/global_images/icon-position.png Binary files differ diff --git a/config/index.js b/config/index.js index 8abd37a..19b33b1 100644 --- a/config/index.js +++ b/config/index.js @@ -69,7 +69,7 @@ * then assetsPublicPath should be set to "/bar/". * In most cases please use '/' !!! */ - assetsPublicPath: '/', + assetsPublicPath: '/toilet/', /** * Source Maps diff --git a/package.json b/package.json index 45f055f..9f3a3eb 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "echarts": "^4.2.1", "element-ui": "2.13.0", "event-source-polyfill": "^1.0.5", + "file-saver": "^2.0.5", "js-cookie": "2.2.0", "jsencrypt": "^3.0.0-rc.1", "leaflet": "^1.7.1", @@ -33,7 +34,9 @@ "vue-amap": "^0.5.9", "vue-baidu-map": "^0.21.22", "vue-router": "3.0.1", - "vuex": "3.0.1" + "vue2-leaflet": "^2.7.0", + "vuex": "3.0.1", + "xlsx": "^0.17.0" }, "devDependencies": { "autoprefixer": "8.5.0", diff --git a/src/api/common.js b/src/api/common.js index 87c582b..7804714 100644 --- a/src/api/common.js +++ b/src/api/common.js @@ -2,10 +2,14 @@ * 常用接口 */ import request from '@/utils/request' +import Vue from 'vue' + // 模板下载 export function downloadTemplate(fileName) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath return request({ - url: 'template/download', + url: lampPath + 'template/download', method: 'get', params: { filename: fileName @@ -19,7 +23,7 @@ const param = new FormData() param.append('file', fileobj.file) return request({ - url: 'imageUpload', + url: 'fileUpload', method: 'post', headers: { 'Content-Type': 'multipart/form-data' }, data: param diff --git a/src/api/sanitation/statistics.js b/src/api/sanitation/statistics.js new file mode 100644 index 0000000..ffeac18 --- /dev/null +++ b/src/api/sanitation/statistics.js @@ -0,0 +1,22 @@ + +/** + * 考核统计接口 + */ +import request from '@/utils/request' +// 公厕保洁次数统计 +export function getToiletJobCount(params) { + return request({ + url: '/sanitation/statistic/toilet/jobCount', + method: 'get', + params + }) +} + +// 公厕评分统计 +export function getToiletEvaluation(params) { + return request({ + url: '/sanitation/toiletEvaluation/statistics', + method: 'get', + params + }) +} diff --git a/src/api/sanitation/toilet.js b/src/api/sanitation/toilet.js new file mode 100644 index 0000000..11affd4 --- /dev/null +++ b/src/api/sanitation/toilet.js @@ -0,0 +1,133 @@ +/** + * 公厕管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' +// 公厕查询 +export function getToiletListPage(params) { + return request({ + url: '/sanitation/toilet/listPage', + method: 'get', + params + }) +} +// 公厕查询 +export function getToiletList(pid) { + return request({ + url: '/sanitation/toilet/list', + method: 'get', + params: { + pid: pid + } + }) +} + +// 添加公厕 +export function addToilet(params) { + return request({ + url: '/sanitation/toilet/add', + method: 'post', + params + }) +} +// 修改公厕机构 +export function updateToilet(params) { + return request({ + url: '/sanitation/toilet/update', + method: 'post', + params + }) +} +// 删除公厕机构 +export function delToilet(ids) { + return request({ + url: '/sanitation/toilet/delete', + method: 'post', + params: { + ids + }, + paramsSerializer: params => { + return qs.stringify(params, { indices: false }) + } + }) +} + +// 公厕基本信息详情 +export function getToiletInfoDetail(id) { + return request({ + url: '/sanitation/toilet/detail?toiletId=' + id, + method: 'get' + }) +} + +// 某公厕保洁记录 +export function getRecordsByToilet(params) { + return request({ + url: '/sanitation/toilet/jobRecord/detail', + method: 'get', + params + }) +} + +// 某公厕平均评分 +export function getScoreByToilet(params) { + return request({ + url: '/sanitation/toiletEvaluation/detailScore', + method: 'get', + params + }) +} + +// 某公厕评分列表 +export function getScoreListByToilet(params) { + return request({ + url: '/sanitation/toiletEvaluation/list', + method: 'get', + params + }) +} + + +// 批量导入 +export function batchImportToilet(fileobj) { + const param = new FormData() + param.append('file', fileobj) + return request({ + url: '/sanitation/toilet/import', + method: 'post', + headers: { 'Content-Type': 'multipart/form-data' }, + data: param + }) +} +// 批量导出 +export function batchExportToilet(params, config) { + return request({ + url: '/sanitation/toilet/export', + method: 'get', + timeout: 120000, + params, + ...config, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 公厕保洁记录查询 +export function getToiletJobRecords(params) { + return request({ + url: '/sanitation/toilet/jobRecord', + method: 'get', + params + }) +} + +// 批量导出 +export function batchExportToiletJobRecords(params, config) { + return request({ + url: '/sanitation/toilet/exportJobRecord', + method: 'get', + timeout: 120000, + params, + ...config, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} diff --git a/src/api/system/alarm.js b/src/api/system/alarm.js new file mode 100644 index 0000000..1c3a7ab --- /dev/null +++ b/src/api/system/alarm.js @@ -0,0 +1,62 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' + +// 获取当前报警列表 +export function getAlarmNowList(params) { + return request({ + url: '/alarm/listNowPage', + method: 'get', + params + }) +} + +// 获取当前报警列表 +export function getAlarmHistoryList(params) { + return request({ + url: '/alarm/listHisPage', + method: 'get', + params + }) +} + + +// 批量消警 +export function clearAll(params) { + return request({ + url: '/alarm/allClear', + method: 'get', + params + }) +} + +// 消警 +export function clearAlarm(params) { + return request({ + url: '/alarm/cancel', + method: 'get', + params + }) +} + +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 设置报警阈值 +export function setThresh(params) { + return request({ + url: '/alarm/resetAlarmRule', + method: 'post', + params + }) +} diff --git a/src/api/system/bridge.js b/src/api/system/bridge.js new file mode 100644 index 0000000..e8a4108 --- /dev/null +++ b/src/api/system/bridge.js @@ -0,0 +1,80 @@ +/** + * 桥梁管理接口 + */ +import request from '@/utils/request' + +// 获取桥梁详情 +export function getDetail(id) { + return request({ + url: '/bridge/detail', + method: 'get', + params: { + id: id + } + }) +} + +export function updateBridge(params) { + return request({ + url: '/bridge/update', + method: 'post', + params + }) +} +// 批量导出 +export function exportRecords(params) { + return request({ + url: 'device/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +export function getContentList(params) { + return request({ + url: 'maintain/contentByType', + method: 'get', + params: { + type: params + } + }) +} +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 编辑 +export function editRecord(params) { + return request({ + url: 'maintain/update', + method: 'post', + params + }) +} +// 新增 +export function addRecord(params) { + return request({ + url: 'maintain/add', + method: 'post', + params + }) +} +// 删除 +export function delRecord(id) { + return request({ + url: 'maintain/delete', + method: 'post', + params: { + id: id + } + }) +} diff --git a/src/api/system/data.js b/src/api/system/data.js new file mode 100644 index 0000000..4c95db5 --- /dev/null +++ b/src/api/system/data.js @@ -0,0 +1,63 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' + +// 获取当前报警列表 +export function getHistoryList(params) { + return request({ + url: '/data/hisListPage', + method: 'get', + params + }) +} + +// 获取当前报警列表 +export function getHistory(params) { + return request({ + url: '/data/hisList', + method: 'get', + params + }) +} + + + +// 批量消警 +export function clearAll(params) { + return request({ + url: '/alarm/allClear', + method: 'get', + params + }) +} + +// 消警 +export function clearAlarm(params) { + return request({ + url: '/alarm/cancel', + method: 'get', + params + }) +} + +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 设置报警阈值 +export function setThresh(params) { + return request({ + url: '/alarm/resetAlarmRule', + method: 'post', + params + }) +} diff --git a/src/api/system/order.js b/src/api/system/order.js new file mode 100644 index 0000000..7007c50 --- /dev/null +++ b/src/api/system/order.js @@ -0,0 +1,71 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +// import qs from 'qs' + +// 获取当前报警列表 +export function getRecordList(params) { + return request({ + url: '/maintain/listPage', + method: 'get', + params + }) +} +// 批量导出 +export function exportRecords(params) { + return request({ + url: 'device/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +export function getContentList(params) { + return request({ + url: 'maintain/contentByType', + method: 'get', + params: { + type: params + } + }) +} +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 编辑 +export function editRecord(params) { + return request({ + url: 'maintain/update', + method: 'post', + params + }) +} +// 新增 +export function addRecord(params) { + return request({ + url: 'maintain/add', + method: 'post', + params + }) +} +// 删除 +export function delRecord(id) { + return request({ + url: 'maintain/delete', + method: 'post', + params: { + bridgeMaintenanceId: id + } + }) +} diff --git a/src/api/system/overview.js b/src/api/system/overview.js new file mode 100644 index 0000000..bca50cc --- /dev/null +++ b/src/api/system/overview.js @@ -0,0 +1,109 @@ +import request from '@/utils/request' +import qs from "qs" +import Vue from 'vue' + +// 路灯状态统计 +export function getLampStatus() { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampStatus', + method: 'get' + }) +} + +// 路灯总览列表 +export function getLampList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampList', + method: 'get', + params + }) +} + +// 路灯详情 +export function getlampDetail(lampId) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampDetail', + method: 'get', + params: { + lampId: lampId + } + }) +} + +// 回路列表 +export function getCircuitList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/circuitList', + method: 'get', + params + }) +} + +// 灯箱列表 +export function getLampBoxList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampBoxList', + method: 'get', + params + }) +} +// 灯箱详情 +export function getLampBoxDetail(lampBoxId) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampBoxDetail', + method: 'get', + params: { + lampBoxId: lampBoxId + } + }) +} + +// 报警总览列表 +export function getAlarmList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/alarmList', + method: 'get', + params + }) +} + +// 报警详情 +export function getAlarmDetail(alarmId) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/alarmDetail', + method: 'get', + params: { + alarmId: alarmId + } + }) +} + +// 路灯控制 +export function lampControl(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampControl', + method: 'post', + params, + paramsSerializer: params => { + return qs.stringify(params, { indices: false }) + } + }) +} diff --git a/src/api/system/rule.js b/src/api/system/rule.js new file mode 100644 index 0000000..76c6b2d --- /dev/null +++ b/src/api/system/rule.js @@ -0,0 +1,59 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +// import qs from 'qs' + +// 获取当前报警列表 +export function getRuleList() { + return request({ + url: 'rule/listPage', + method: 'get' + }) +} +export function getContentList(params) { + return request({ + url: 'maintain/contentByType', + method: 'get', + params: { + type: params + } + }) +} +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 编辑 +export function editRecord(params) { + return request({ + url: 'maintain/update', + method: 'post', + params + }) +} +// 新增 +export function addRecord(params) { + return request({ + url: 'maintain/add', + method: 'post', + params + }) +} +// 删除 +export function delRecord(id) { + return request({ + url: 'maintain/delete', + method: 'post', + params: { + id: id + } + }) +} diff --git a/src/api/system/statistics.js b/src/api/system/statistics.js new file mode 100644 index 0000000..b25efe9 --- /dev/null +++ b/src/api/system/statistics.js @@ -0,0 +1,23 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +// import qs from 'qs' + +// +export function countByToilet(params) { + return request({ + url: '/sanitation/toiletStatistic/jobStaticByToilet', + method: 'get', + params + }) +} + +export function countByDay(params) { + return request({ + url: '/sanitation/toiletStatistic/jobStaticByDate', + method: 'get', + params + }) +} + diff --git a/src/assets/global_images/icon-position.png b/src/assets/global_images/icon-position.png new file mode 100644 index 0000000..7444038 --- /dev/null +++ b/src/assets/global_images/icon-position.png Binary files differ diff --git a/src/assets/global_images/location_green.png b/src/assets/global_images/location_green.png new file mode 100644 index 0000000..aa8be65 --- /dev/null +++ b/src/assets/global_images/location_green.png Binary files differ diff --git a/config/index.js b/config/index.js index 8abd37a..19b33b1 100644 --- a/config/index.js +++ b/config/index.js @@ -69,7 +69,7 @@ * then assetsPublicPath should be set to "/bar/". * In most cases please use '/' !!! */ - assetsPublicPath: '/', + assetsPublicPath: '/toilet/', /** * Source Maps diff --git a/package.json b/package.json index 45f055f..9f3a3eb 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "echarts": "^4.2.1", "element-ui": "2.13.0", "event-source-polyfill": "^1.0.5", + "file-saver": "^2.0.5", "js-cookie": "2.2.0", "jsencrypt": "^3.0.0-rc.1", "leaflet": "^1.7.1", @@ -33,7 +34,9 @@ "vue-amap": "^0.5.9", "vue-baidu-map": "^0.21.22", "vue-router": "3.0.1", - "vuex": "3.0.1" + "vue2-leaflet": "^2.7.0", + "vuex": "3.0.1", + "xlsx": "^0.17.0" }, "devDependencies": { "autoprefixer": "8.5.0", diff --git a/src/api/common.js b/src/api/common.js index 87c582b..7804714 100644 --- a/src/api/common.js +++ b/src/api/common.js @@ -2,10 +2,14 @@ * 常用接口 */ import request from '@/utils/request' +import Vue from 'vue' + // 模板下载 export function downloadTemplate(fileName) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath return request({ - url: 'template/download', + url: lampPath + 'template/download', method: 'get', params: { filename: fileName @@ -19,7 +23,7 @@ const param = new FormData() param.append('file', fileobj.file) return request({ - url: 'imageUpload', + url: 'fileUpload', method: 'post', headers: { 'Content-Type': 'multipart/form-data' }, data: param diff --git a/src/api/sanitation/statistics.js b/src/api/sanitation/statistics.js new file mode 100644 index 0000000..ffeac18 --- /dev/null +++ b/src/api/sanitation/statistics.js @@ -0,0 +1,22 @@ + +/** + * 考核统计接口 + */ +import request from '@/utils/request' +// 公厕保洁次数统计 +export function getToiletJobCount(params) { + return request({ + url: '/sanitation/statistic/toilet/jobCount', + method: 'get', + params + }) +} + +// 公厕评分统计 +export function getToiletEvaluation(params) { + return request({ + url: '/sanitation/toiletEvaluation/statistics', + method: 'get', + params + }) +} diff --git a/src/api/sanitation/toilet.js b/src/api/sanitation/toilet.js new file mode 100644 index 0000000..11affd4 --- /dev/null +++ b/src/api/sanitation/toilet.js @@ -0,0 +1,133 @@ +/** + * 公厕管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' +// 公厕查询 +export function getToiletListPage(params) { + return request({ + url: '/sanitation/toilet/listPage', + method: 'get', + params + }) +} +// 公厕查询 +export function getToiletList(pid) { + return request({ + url: '/sanitation/toilet/list', + method: 'get', + params: { + pid: pid + } + }) +} + +// 添加公厕 +export function addToilet(params) { + return request({ + url: '/sanitation/toilet/add', + method: 'post', + params + }) +} +// 修改公厕机构 +export function updateToilet(params) { + return request({ + url: '/sanitation/toilet/update', + method: 'post', + params + }) +} +// 删除公厕机构 +export function delToilet(ids) { + return request({ + url: '/sanitation/toilet/delete', + method: 'post', + params: { + ids + }, + paramsSerializer: params => { + return qs.stringify(params, { indices: false }) + } + }) +} + +// 公厕基本信息详情 +export function getToiletInfoDetail(id) { + return request({ + url: '/sanitation/toilet/detail?toiletId=' + id, + method: 'get' + }) +} + +// 某公厕保洁记录 +export function getRecordsByToilet(params) { + return request({ + url: '/sanitation/toilet/jobRecord/detail', + method: 'get', + params + }) +} + +// 某公厕平均评分 +export function getScoreByToilet(params) { + return request({ + url: '/sanitation/toiletEvaluation/detailScore', + method: 'get', + params + }) +} + +// 某公厕评分列表 +export function getScoreListByToilet(params) { + return request({ + url: '/sanitation/toiletEvaluation/list', + method: 'get', + params + }) +} + + +// 批量导入 +export function batchImportToilet(fileobj) { + const param = new FormData() + param.append('file', fileobj) + return request({ + url: '/sanitation/toilet/import', + method: 'post', + headers: { 'Content-Type': 'multipart/form-data' }, + data: param + }) +} +// 批量导出 +export function batchExportToilet(params, config) { + return request({ + url: '/sanitation/toilet/export', + method: 'get', + timeout: 120000, + params, + ...config, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 公厕保洁记录查询 +export function getToiletJobRecords(params) { + return request({ + url: '/sanitation/toilet/jobRecord', + method: 'get', + params + }) +} + +// 批量导出 +export function batchExportToiletJobRecords(params, config) { + return request({ + url: '/sanitation/toilet/exportJobRecord', + method: 'get', + timeout: 120000, + params, + ...config, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} diff --git a/src/api/system/alarm.js b/src/api/system/alarm.js new file mode 100644 index 0000000..1c3a7ab --- /dev/null +++ b/src/api/system/alarm.js @@ -0,0 +1,62 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' + +// 获取当前报警列表 +export function getAlarmNowList(params) { + return request({ + url: '/alarm/listNowPage', + method: 'get', + params + }) +} + +// 获取当前报警列表 +export function getAlarmHistoryList(params) { + return request({ + url: '/alarm/listHisPage', + method: 'get', + params + }) +} + + +// 批量消警 +export function clearAll(params) { + return request({ + url: '/alarm/allClear', + method: 'get', + params + }) +} + +// 消警 +export function clearAlarm(params) { + return request({ + url: '/alarm/cancel', + method: 'get', + params + }) +} + +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 设置报警阈值 +export function setThresh(params) { + return request({ + url: '/alarm/resetAlarmRule', + method: 'post', + params + }) +} diff --git a/src/api/system/bridge.js b/src/api/system/bridge.js new file mode 100644 index 0000000..e8a4108 --- /dev/null +++ b/src/api/system/bridge.js @@ -0,0 +1,80 @@ +/** + * 桥梁管理接口 + */ +import request from '@/utils/request' + +// 获取桥梁详情 +export function getDetail(id) { + return request({ + url: '/bridge/detail', + method: 'get', + params: { + id: id + } + }) +} + +export function updateBridge(params) { + return request({ + url: '/bridge/update', + method: 'post', + params + }) +} +// 批量导出 +export function exportRecords(params) { + return request({ + url: 'device/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +export function getContentList(params) { + return request({ + url: 'maintain/contentByType', + method: 'get', + params: { + type: params + } + }) +} +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 编辑 +export function editRecord(params) { + return request({ + url: 'maintain/update', + method: 'post', + params + }) +} +// 新增 +export function addRecord(params) { + return request({ + url: 'maintain/add', + method: 'post', + params + }) +} +// 删除 +export function delRecord(id) { + return request({ + url: 'maintain/delete', + method: 'post', + params: { + id: id + } + }) +} diff --git a/src/api/system/data.js b/src/api/system/data.js new file mode 100644 index 0000000..4c95db5 --- /dev/null +++ b/src/api/system/data.js @@ -0,0 +1,63 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' + +// 获取当前报警列表 +export function getHistoryList(params) { + return request({ + url: '/data/hisListPage', + method: 'get', + params + }) +} + +// 获取当前报警列表 +export function getHistory(params) { + return request({ + url: '/data/hisList', + method: 'get', + params + }) +} + + + +// 批量消警 +export function clearAll(params) { + return request({ + url: '/alarm/allClear', + method: 'get', + params + }) +} + +// 消警 +export function clearAlarm(params) { + return request({ + url: '/alarm/cancel', + method: 'get', + params + }) +} + +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 设置报警阈值 +export function setThresh(params) { + return request({ + url: '/alarm/resetAlarmRule', + method: 'post', + params + }) +} diff --git a/src/api/system/order.js b/src/api/system/order.js new file mode 100644 index 0000000..7007c50 --- /dev/null +++ b/src/api/system/order.js @@ -0,0 +1,71 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +// import qs from 'qs' + +// 获取当前报警列表 +export function getRecordList(params) { + return request({ + url: '/maintain/listPage', + method: 'get', + params + }) +} +// 批量导出 +export function exportRecords(params) { + return request({ + url: 'device/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +export function getContentList(params) { + return request({ + url: 'maintain/contentByType', + method: 'get', + params: { + type: params + } + }) +} +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 编辑 +export function editRecord(params) { + return request({ + url: 'maintain/update', + method: 'post', + params + }) +} +// 新增 +export function addRecord(params) { + return request({ + url: 'maintain/add', + method: 'post', + params + }) +} +// 删除 +export function delRecord(id) { + return request({ + url: 'maintain/delete', + method: 'post', + params: { + bridgeMaintenanceId: id + } + }) +} diff --git a/src/api/system/overview.js b/src/api/system/overview.js new file mode 100644 index 0000000..bca50cc --- /dev/null +++ b/src/api/system/overview.js @@ -0,0 +1,109 @@ +import request from '@/utils/request' +import qs from "qs" +import Vue from 'vue' + +// 路灯状态统计 +export function getLampStatus() { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampStatus', + method: 'get' + }) +} + +// 路灯总览列表 +export function getLampList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampList', + method: 'get', + params + }) +} + +// 路灯详情 +export function getlampDetail(lampId) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampDetail', + method: 'get', + params: { + lampId: lampId + } + }) +} + +// 回路列表 +export function getCircuitList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/circuitList', + method: 'get', + params + }) +} + +// 灯箱列表 +export function getLampBoxList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampBoxList', + method: 'get', + params + }) +} +// 灯箱详情 +export function getLampBoxDetail(lampBoxId) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampBoxDetail', + method: 'get', + params: { + lampBoxId: lampBoxId + } + }) +} + +// 报警总览列表 +export function getAlarmList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/alarmList', + method: 'get', + params + }) +} + +// 报警详情 +export function getAlarmDetail(alarmId) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/alarmDetail', + method: 'get', + params: { + alarmId: alarmId + } + }) +} + +// 路灯控制 +export function lampControl(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampControl', + method: 'post', + params, + paramsSerializer: params => { + return qs.stringify(params, { indices: false }) + } + }) +} diff --git a/src/api/system/rule.js b/src/api/system/rule.js new file mode 100644 index 0000000..76c6b2d --- /dev/null +++ b/src/api/system/rule.js @@ -0,0 +1,59 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +// import qs from 'qs' + +// 获取当前报警列表 +export function getRuleList() { + return request({ + url: 'rule/listPage', + method: 'get' + }) +} +export function getContentList(params) { + return request({ + url: 'maintain/contentByType', + method: 'get', + params: { + type: params + } + }) +} +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 编辑 +export function editRecord(params) { + return request({ + url: 'maintain/update', + method: 'post', + params + }) +} +// 新增 +export function addRecord(params) { + return request({ + url: 'maintain/add', + method: 'post', + params + }) +} +// 删除 +export function delRecord(id) { + return request({ + url: 'maintain/delete', + method: 'post', + params: { + id: id + } + }) +} diff --git a/src/api/system/statistics.js b/src/api/system/statistics.js new file mode 100644 index 0000000..b25efe9 --- /dev/null +++ b/src/api/system/statistics.js @@ -0,0 +1,23 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +// import qs from 'qs' + +// +export function countByToilet(params) { + return request({ + url: '/sanitation/toiletStatistic/jobStaticByToilet', + method: 'get', + params + }) +} + +export function countByDay(params) { + return request({ + url: '/sanitation/toiletStatistic/jobStaticByDate', + method: 'get', + params + }) +} + diff --git a/src/assets/global_images/icon-position.png b/src/assets/global_images/icon-position.png new file mode 100644 index 0000000..7444038 --- /dev/null +++ b/src/assets/global_images/icon-position.png Binary files differ diff --git a/src/assets/global_images/location_green.png b/src/assets/global_images/location_green.png new file mode 100644 index 0000000..aa8be65 --- /dev/null +++ b/src/assets/global_images/location_green.png Binary files differ diff --git a/src/assets/global_images/location_red.png b/src/assets/global_images/location_red.png new file mode 100644 index 0000000..2be8c3d --- /dev/null +++ b/src/assets/global_images/location_red.png Binary files differ diff --git a/config/index.js b/config/index.js index 8abd37a..19b33b1 100644 --- a/config/index.js +++ b/config/index.js @@ -69,7 +69,7 @@ * then assetsPublicPath should be set to "/bar/". * In most cases please use '/' !!! */ - assetsPublicPath: '/', + assetsPublicPath: '/toilet/', /** * Source Maps diff --git a/package.json b/package.json index 45f055f..9f3a3eb 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "echarts": "^4.2.1", "element-ui": "2.13.0", "event-source-polyfill": "^1.0.5", + "file-saver": "^2.0.5", "js-cookie": "2.2.0", "jsencrypt": "^3.0.0-rc.1", "leaflet": "^1.7.1", @@ -33,7 +34,9 @@ "vue-amap": "^0.5.9", "vue-baidu-map": "^0.21.22", "vue-router": "3.0.1", - "vuex": "3.0.1" + "vue2-leaflet": "^2.7.0", + "vuex": "3.0.1", + "xlsx": "^0.17.0" }, "devDependencies": { "autoprefixer": "8.5.0", diff --git a/src/api/common.js b/src/api/common.js index 87c582b..7804714 100644 --- a/src/api/common.js +++ b/src/api/common.js @@ -2,10 +2,14 @@ * 常用接口 */ import request from '@/utils/request' +import Vue from 'vue' + // 模板下载 export function downloadTemplate(fileName) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath return request({ - url: 'template/download', + url: lampPath + 'template/download', method: 'get', params: { filename: fileName @@ -19,7 +23,7 @@ const param = new FormData() param.append('file', fileobj.file) return request({ - url: 'imageUpload', + url: 'fileUpload', method: 'post', headers: { 'Content-Type': 'multipart/form-data' }, data: param diff --git a/src/api/sanitation/statistics.js b/src/api/sanitation/statistics.js new file mode 100644 index 0000000..ffeac18 --- /dev/null +++ b/src/api/sanitation/statistics.js @@ -0,0 +1,22 @@ + +/** + * 考核统计接口 + */ +import request from '@/utils/request' +// 公厕保洁次数统计 +export function getToiletJobCount(params) { + return request({ + url: '/sanitation/statistic/toilet/jobCount', + method: 'get', + params + }) +} + +// 公厕评分统计 +export function getToiletEvaluation(params) { + return request({ + url: '/sanitation/toiletEvaluation/statistics', + method: 'get', + params + }) +} diff --git a/src/api/sanitation/toilet.js b/src/api/sanitation/toilet.js new file mode 100644 index 0000000..11affd4 --- /dev/null +++ b/src/api/sanitation/toilet.js @@ -0,0 +1,133 @@ +/** + * 公厕管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' +// 公厕查询 +export function getToiletListPage(params) { + return request({ + url: '/sanitation/toilet/listPage', + method: 'get', + params + }) +} +// 公厕查询 +export function getToiletList(pid) { + return request({ + url: '/sanitation/toilet/list', + method: 'get', + params: { + pid: pid + } + }) +} + +// 添加公厕 +export function addToilet(params) { + return request({ + url: '/sanitation/toilet/add', + method: 'post', + params + }) +} +// 修改公厕机构 +export function updateToilet(params) { + return request({ + url: '/sanitation/toilet/update', + method: 'post', + params + }) +} +// 删除公厕机构 +export function delToilet(ids) { + return request({ + url: '/sanitation/toilet/delete', + method: 'post', + params: { + ids + }, + paramsSerializer: params => { + return qs.stringify(params, { indices: false }) + } + }) +} + +// 公厕基本信息详情 +export function getToiletInfoDetail(id) { + return request({ + url: '/sanitation/toilet/detail?toiletId=' + id, + method: 'get' + }) +} + +// 某公厕保洁记录 +export function getRecordsByToilet(params) { + return request({ + url: '/sanitation/toilet/jobRecord/detail', + method: 'get', + params + }) +} + +// 某公厕平均评分 +export function getScoreByToilet(params) { + return request({ + url: '/sanitation/toiletEvaluation/detailScore', + method: 'get', + params + }) +} + +// 某公厕评分列表 +export function getScoreListByToilet(params) { + return request({ + url: '/sanitation/toiletEvaluation/list', + method: 'get', + params + }) +} + + +// 批量导入 +export function batchImportToilet(fileobj) { + const param = new FormData() + param.append('file', fileobj) + return request({ + url: '/sanitation/toilet/import', + method: 'post', + headers: { 'Content-Type': 'multipart/form-data' }, + data: param + }) +} +// 批量导出 +export function batchExportToilet(params, config) { + return request({ + url: '/sanitation/toilet/export', + method: 'get', + timeout: 120000, + params, + ...config, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 公厕保洁记录查询 +export function getToiletJobRecords(params) { + return request({ + url: '/sanitation/toilet/jobRecord', + method: 'get', + params + }) +} + +// 批量导出 +export function batchExportToiletJobRecords(params, config) { + return request({ + url: '/sanitation/toilet/exportJobRecord', + method: 'get', + timeout: 120000, + params, + ...config, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} diff --git a/src/api/system/alarm.js b/src/api/system/alarm.js new file mode 100644 index 0000000..1c3a7ab --- /dev/null +++ b/src/api/system/alarm.js @@ -0,0 +1,62 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' + +// 获取当前报警列表 +export function getAlarmNowList(params) { + return request({ + url: '/alarm/listNowPage', + method: 'get', + params + }) +} + +// 获取当前报警列表 +export function getAlarmHistoryList(params) { + return request({ + url: '/alarm/listHisPage', + method: 'get', + params + }) +} + + +// 批量消警 +export function clearAll(params) { + return request({ + url: '/alarm/allClear', + method: 'get', + params + }) +} + +// 消警 +export function clearAlarm(params) { + return request({ + url: '/alarm/cancel', + method: 'get', + params + }) +} + +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 设置报警阈值 +export function setThresh(params) { + return request({ + url: '/alarm/resetAlarmRule', + method: 'post', + params + }) +} diff --git a/src/api/system/bridge.js b/src/api/system/bridge.js new file mode 100644 index 0000000..e8a4108 --- /dev/null +++ b/src/api/system/bridge.js @@ -0,0 +1,80 @@ +/** + * 桥梁管理接口 + */ +import request from '@/utils/request' + +// 获取桥梁详情 +export function getDetail(id) { + return request({ + url: '/bridge/detail', + method: 'get', + params: { + id: id + } + }) +} + +export function updateBridge(params) { + return request({ + url: '/bridge/update', + method: 'post', + params + }) +} +// 批量导出 +export function exportRecords(params) { + return request({ + url: 'device/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +export function getContentList(params) { + return request({ + url: 'maintain/contentByType', + method: 'get', + params: { + type: params + } + }) +} +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 编辑 +export function editRecord(params) { + return request({ + url: 'maintain/update', + method: 'post', + params + }) +} +// 新增 +export function addRecord(params) { + return request({ + url: 'maintain/add', + method: 'post', + params + }) +} +// 删除 +export function delRecord(id) { + return request({ + url: 'maintain/delete', + method: 'post', + params: { + id: id + } + }) +} diff --git a/src/api/system/data.js b/src/api/system/data.js new file mode 100644 index 0000000..4c95db5 --- /dev/null +++ b/src/api/system/data.js @@ -0,0 +1,63 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' + +// 获取当前报警列表 +export function getHistoryList(params) { + return request({ + url: '/data/hisListPage', + method: 'get', + params + }) +} + +// 获取当前报警列表 +export function getHistory(params) { + return request({ + url: '/data/hisList', + method: 'get', + params + }) +} + + + +// 批量消警 +export function clearAll(params) { + return request({ + url: '/alarm/allClear', + method: 'get', + params + }) +} + +// 消警 +export function clearAlarm(params) { + return request({ + url: '/alarm/cancel', + method: 'get', + params + }) +} + +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 设置报警阈值 +export function setThresh(params) { + return request({ + url: '/alarm/resetAlarmRule', + method: 'post', + params + }) +} diff --git a/src/api/system/order.js b/src/api/system/order.js new file mode 100644 index 0000000..7007c50 --- /dev/null +++ b/src/api/system/order.js @@ -0,0 +1,71 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +// import qs from 'qs' + +// 获取当前报警列表 +export function getRecordList(params) { + return request({ + url: '/maintain/listPage', + method: 'get', + params + }) +} +// 批量导出 +export function exportRecords(params) { + return request({ + url: 'device/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +export function getContentList(params) { + return request({ + url: 'maintain/contentByType', + method: 'get', + params: { + type: params + } + }) +} +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 编辑 +export function editRecord(params) { + return request({ + url: 'maintain/update', + method: 'post', + params + }) +} +// 新增 +export function addRecord(params) { + return request({ + url: 'maintain/add', + method: 'post', + params + }) +} +// 删除 +export function delRecord(id) { + return request({ + url: 'maintain/delete', + method: 'post', + params: { + bridgeMaintenanceId: id + } + }) +} diff --git a/src/api/system/overview.js b/src/api/system/overview.js new file mode 100644 index 0000000..bca50cc --- /dev/null +++ b/src/api/system/overview.js @@ -0,0 +1,109 @@ +import request from '@/utils/request' +import qs from "qs" +import Vue from 'vue' + +// 路灯状态统计 +export function getLampStatus() { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampStatus', + method: 'get' + }) +} + +// 路灯总览列表 +export function getLampList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampList', + method: 'get', + params + }) +} + +// 路灯详情 +export function getlampDetail(lampId) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampDetail', + method: 'get', + params: { + lampId: lampId + } + }) +} + +// 回路列表 +export function getCircuitList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/circuitList', + method: 'get', + params + }) +} + +// 灯箱列表 +export function getLampBoxList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampBoxList', + method: 'get', + params + }) +} +// 灯箱详情 +export function getLampBoxDetail(lampBoxId) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampBoxDetail', + method: 'get', + params: { + lampBoxId: lampBoxId + } + }) +} + +// 报警总览列表 +export function getAlarmList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/alarmList', + method: 'get', + params + }) +} + +// 报警详情 +export function getAlarmDetail(alarmId) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/alarmDetail', + method: 'get', + params: { + alarmId: alarmId + } + }) +} + +// 路灯控制 +export function lampControl(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampControl', + method: 'post', + params, + paramsSerializer: params => { + return qs.stringify(params, { indices: false }) + } + }) +} diff --git a/src/api/system/rule.js b/src/api/system/rule.js new file mode 100644 index 0000000..76c6b2d --- /dev/null +++ b/src/api/system/rule.js @@ -0,0 +1,59 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +// import qs from 'qs' + +// 获取当前报警列表 +export function getRuleList() { + return request({ + url: 'rule/listPage', + method: 'get' + }) +} +export function getContentList(params) { + return request({ + url: 'maintain/contentByType', + method: 'get', + params: { + type: params + } + }) +} +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 编辑 +export function editRecord(params) { + return request({ + url: 'maintain/update', + method: 'post', + params + }) +} +// 新增 +export function addRecord(params) { + return request({ + url: 'maintain/add', + method: 'post', + params + }) +} +// 删除 +export function delRecord(id) { + return request({ + url: 'maintain/delete', + method: 'post', + params: { + id: id + } + }) +} diff --git a/src/api/system/statistics.js b/src/api/system/statistics.js new file mode 100644 index 0000000..b25efe9 --- /dev/null +++ b/src/api/system/statistics.js @@ -0,0 +1,23 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +// import qs from 'qs' + +// +export function countByToilet(params) { + return request({ + url: '/sanitation/toiletStatistic/jobStaticByToilet', + method: 'get', + params + }) +} + +export function countByDay(params) { + return request({ + url: '/sanitation/toiletStatistic/jobStaticByDate', + method: 'get', + params + }) +} + diff --git a/src/assets/global_images/icon-position.png b/src/assets/global_images/icon-position.png new file mode 100644 index 0000000..7444038 --- /dev/null +++ b/src/assets/global_images/icon-position.png Binary files differ diff --git a/src/assets/global_images/location_green.png b/src/assets/global_images/location_green.png new file mode 100644 index 0000000..aa8be65 --- /dev/null +++ b/src/assets/global_images/location_green.png Binary files differ diff --git a/src/assets/global_images/location_red.png b/src/assets/global_images/location_red.png new file mode 100644 index 0000000..2be8c3d --- /dev/null +++ b/src/assets/global_images/location_red.png Binary files differ diff --git a/src/assets/global_images/location_yellow.png b/src/assets/global_images/location_yellow.png new file mode 100644 index 0000000..5ab6f4d --- /dev/null +++ b/src/assets/global_images/location_yellow.png Binary files differ diff --git a/config/index.js b/config/index.js index 8abd37a..19b33b1 100644 --- a/config/index.js +++ b/config/index.js @@ -69,7 +69,7 @@ * then assetsPublicPath should be set to "/bar/". * In most cases please use '/' !!! */ - assetsPublicPath: '/', + assetsPublicPath: '/toilet/', /** * Source Maps diff --git a/package.json b/package.json index 45f055f..9f3a3eb 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "echarts": "^4.2.1", "element-ui": "2.13.0", "event-source-polyfill": "^1.0.5", + "file-saver": "^2.0.5", "js-cookie": "2.2.0", "jsencrypt": "^3.0.0-rc.1", "leaflet": "^1.7.1", @@ -33,7 +34,9 @@ "vue-amap": "^0.5.9", "vue-baidu-map": "^0.21.22", "vue-router": "3.0.1", - "vuex": "3.0.1" + "vue2-leaflet": "^2.7.0", + "vuex": "3.0.1", + "xlsx": "^0.17.0" }, "devDependencies": { "autoprefixer": "8.5.0", diff --git a/src/api/common.js b/src/api/common.js index 87c582b..7804714 100644 --- a/src/api/common.js +++ b/src/api/common.js @@ -2,10 +2,14 @@ * 常用接口 */ import request from '@/utils/request' +import Vue from 'vue' + // 模板下载 export function downloadTemplate(fileName) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath return request({ - url: 'template/download', + url: lampPath + 'template/download', method: 'get', params: { filename: fileName @@ -19,7 +23,7 @@ const param = new FormData() param.append('file', fileobj.file) return request({ - url: 'imageUpload', + url: 'fileUpload', method: 'post', headers: { 'Content-Type': 'multipart/form-data' }, data: param diff --git a/src/api/sanitation/statistics.js b/src/api/sanitation/statistics.js new file mode 100644 index 0000000..ffeac18 --- /dev/null +++ b/src/api/sanitation/statistics.js @@ -0,0 +1,22 @@ + +/** + * 考核统计接口 + */ +import request from '@/utils/request' +// 公厕保洁次数统计 +export function getToiletJobCount(params) { + return request({ + url: '/sanitation/statistic/toilet/jobCount', + method: 'get', + params + }) +} + +// 公厕评分统计 +export function getToiletEvaluation(params) { + return request({ + url: '/sanitation/toiletEvaluation/statistics', + method: 'get', + params + }) +} diff --git a/src/api/sanitation/toilet.js b/src/api/sanitation/toilet.js new file mode 100644 index 0000000..11affd4 --- /dev/null +++ b/src/api/sanitation/toilet.js @@ -0,0 +1,133 @@ +/** + * 公厕管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' +// 公厕查询 +export function getToiletListPage(params) { + return request({ + url: '/sanitation/toilet/listPage', + method: 'get', + params + }) +} +// 公厕查询 +export function getToiletList(pid) { + return request({ + url: '/sanitation/toilet/list', + method: 'get', + params: { + pid: pid + } + }) +} + +// 添加公厕 +export function addToilet(params) { + return request({ + url: '/sanitation/toilet/add', + method: 'post', + params + }) +} +// 修改公厕机构 +export function updateToilet(params) { + return request({ + url: '/sanitation/toilet/update', + method: 'post', + params + }) +} +// 删除公厕机构 +export function delToilet(ids) { + return request({ + url: '/sanitation/toilet/delete', + method: 'post', + params: { + ids + }, + paramsSerializer: params => { + return qs.stringify(params, { indices: false }) + } + }) +} + +// 公厕基本信息详情 +export function getToiletInfoDetail(id) { + return request({ + url: '/sanitation/toilet/detail?toiletId=' + id, + method: 'get' + }) +} + +// 某公厕保洁记录 +export function getRecordsByToilet(params) { + return request({ + url: '/sanitation/toilet/jobRecord/detail', + method: 'get', + params + }) +} + +// 某公厕平均评分 +export function getScoreByToilet(params) { + return request({ + url: '/sanitation/toiletEvaluation/detailScore', + method: 'get', + params + }) +} + +// 某公厕评分列表 +export function getScoreListByToilet(params) { + return request({ + url: '/sanitation/toiletEvaluation/list', + method: 'get', + params + }) +} + + +// 批量导入 +export function batchImportToilet(fileobj) { + const param = new FormData() + param.append('file', fileobj) + return request({ + url: '/sanitation/toilet/import', + method: 'post', + headers: { 'Content-Type': 'multipart/form-data' }, + data: param + }) +} +// 批量导出 +export function batchExportToilet(params, config) { + return request({ + url: '/sanitation/toilet/export', + method: 'get', + timeout: 120000, + params, + ...config, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 公厕保洁记录查询 +export function getToiletJobRecords(params) { + return request({ + url: '/sanitation/toilet/jobRecord', + method: 'get', + params + }) +} + +// 批量导出 +export function batchExportToiletJobRecords(params, config) { + return request({ + url: '/sanitation/toilet/exportJobRecord', + method: 'get', + timeout: 120000, + params, + ...config, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} diff --git a/src/api/system/alarm.js b/src/api/system/alarm.js new file mode 100644 index 0000000..1c3a7ab --- /dev/null +++ b/src/api/system/alarm.js @@ -0,0 +1,62 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' + +// 获取当前报警列表 +export function getAlarmNowList(params) { + return request({ + url: '/alarm/listNowPage', + method: 'get', + params + }) +} + +// 获取当前报警列表 +export function getAlarmHistoryList(params) { + return request({ + url: '/alarm/listHisPage', + method: 'get', + params + }) +} + + +// 批量消警 +export function clearAll(params) { + return request({ + url: '/alarm/allClear', + method: 'get', + params + }) +} + +// 消警 +export function clearAlarm(params) { + return request({ + url: '/alarm/cancel', + method: 'get', + params + }) +} + +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 设置报警阈值 +export function setThresh(params) { + return request({ + url: '/alarm/resetAlarmRule', + method: 'post', + params + }) +} diff --git a/src/api/system/bridge.js b/src/api/system/bridge.js new file mode 100644 index 0000000..e8a4108 --- /dev/null +++ b/src/api/system/bridge.js @@ -0,0 +1,80 @@ +/** + * 桥梁管理接口 + */ +import request from '@/utils/request' + +// 获取桥梁详情 +export function getDetail(id) { + return request({ + url: '/bridge/detail', + method: 'get', + params: { + id: id + } + }) +} + +export function updateBridge(params) { + return request({ + url: '/bridge/update', + method: 'post', + params + }) +} +// 批量导出 +export function exportRecords(params) { + return request({ + url: 'device/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +export function getContentList(params) { + return request({ + url: 'maintain/contentByType', + method: 'get', + params: { + type: params + } + }) +} +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 编辑 +export function editRecord(params) { + return request({ + url: 'maintain/update', + method: 'post', + params + }) +} +// 新增 +export function addRecord(params) { + return request({ + url: 'maintain/add', + method: 'post', + params + }) +} +// 删除 +export function delRecord(id) { + return request({ + url: 'maintain/delete', + method: 'post', + params: { + id: id + } + }) +} diff --git a/src/api/system/data.js b/src/api/system/data.js new file mode 100644 index 0000000..4c95db5 --- /dev/null +++ b/src/api/system/data.js @@ -0,0 +1,63 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' + +// 获取当前报警列表 +export function getHistoryList(params) { + return request({ + url: '/data/hisListPage', + method: 'get', + params + }) +} + +// 获取当前报警列表 +export function getHistory(params) { + return request({ + url: '/data/hisList', + method: 'get', + params + }) +} + + + +// 批量消警 +export function clearAll(params) { + return request({ + url: '/alarm/allClear', + method: 'get', + params + }) +} + +// 消警 +export function clearAlarm(params) { + return request({ + url: '/alarm/cancel', + method: 'get', + params + }) +} + +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 设置报警阈值 +export function setThresh(params) { + return request({ + url: '/alarm/resetAlarmRule', + method: 'post', + params + }) +} diff --git a/src/api/system/order.js b/src/api/system/order.js new file mode 100644 index 0000000..7007c50 --- /dev/null +++ b/src/api/system/order.js @@ -0,0 +1,71 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +// import qs from 'qs' + +// 获取当前报警列表 +export function getRecordList(params) { + return request({ + url: '/maintain/listPage', + method: 'get', + params + }) +} +// 批量导出 +export function exportRecords(params) { + return request({ + url: 'device/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +export function getContentList(params) { + return request({ + url: 'maintain/contentByType', + method: 'get', + params: { + type: params + } + }) +} +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 编辑 +export function editRecord(params) { + return request({ + url: 'maintain/update', + method: 'post', + params + }) +} +// 新增 +export function addRecord(params) { + return request({ + url: 'maintain/add', + method: 'post', + params + }) +} +// 删除 +export function delRecord(id) { + return request({ + url: 'maintain/delete', + method: 'post', + params: { + bridgeMaintenanceId: id + } + }) +} diff --git a/src/api/system/overview.js b/src/api/system/overview.js new file mode 100644 index 0000000..bca50cc --- /dev/null +++ b/src/api/system/overview.js @@ -0,0 +1,109 @@ +import request from '@/utils/request' +import qs from "qs" +import Vue from 'vue' + +// 路灯状态统计 +export function getLampStatus() { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampStatus', + method: 'get' + }) +} + +// 路灯总览列表 +export function getLampList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampList', + method: 'get', + params + }) +} + +// 路灯详情 +export function getlampDetail(lampId) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampDetail', + method: 'get', + params: { + lampId: lampId + } + }) +} + +// 回路列表 +export function getCircuitList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/circuitList', + method: 'get', + params + }) +} + +// 灯箱列表 +export function getLampBoxList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampBoxList', + method: 'get', + params + }) +} +// 灯箱详情 +export function getLampBoxDetail(lampBoxId) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampBoxDetail', + method: 'get', + params: { + lampBoxId: lampBoxId + } + }) +} + +// 报警总览列表 +export function getAlarmList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/alarmList', + method: 'get', + params + }) +} + +// 报警详情 +export function getAlarmDetail(alarmId) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/alarmDetail', + method: 'get', + params: { + alarmId: alarmId + } + }) +} + +// 路灯控制 +export function lampControl(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampControl', + method: 'post', + params, + paramsSerializer: params => { + return qs.stringify(params, { indices: false }) + } + }) +} diff --git a/src/api/system/rule.js b/src/api/system/rule.js new file mode 100644 index 0000000..76c6b2d --- /dev/null +++ b/src/api/system/rule.js @@ -0,0 +1,59 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +// import qs from 'qs' + +// 获取当前报警列表 +export function getRuleList() { + return request({ + url: 'rule/listPage', + method: 'get' + }) +} +export function getContentList(params) { + return request({ + url: 'maintain/contentByType', + method: 'get', + params: { + type: params + } + }) +} +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 编辑 +export function editRecord(params) { + return request({ + url: 'maintain/update', + method: 'post', + params + }) +} +// 新增 +export function addRecord(params) { + return request({ + url: 'maintain/add', + method: 'post', + params + }) +} +// 删除 +export function delRecord(id) { + return request({ + url: 'maintain/delete', + method: 'post', + params: { + id: id + } + }) +} diff --git a/src/api/system/statistics.js b/src/api/system/statistics.js new file mode 100644 index 0000000..b25efe9 --- /dev/null +++ b/src/api/system/statistics.js @@ -0,0 +1,23 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +// import qs from 'qs' + +// +export function countByToilet(params) { + return request({ + url: '/sanitation/toiletStatistic/jobStaticByToilet', + method: 'get', + params + }) +} + +export function countByDay(params) { + return request({ + url: '/sanitation/toiletStatistic/jobStaticByDate', + method: 'get', + params + }) +} + diff --git a/src/assets/global_images/icon-position.png b/src/assets/global_images/icon-position.png new file mode 100644 index 0000000..7444038 --- /dev/null +++ b/src/assets/global_images/icon-position.png Binary files differ diff --git a/src/assets/global_images/location_green.png b/src/assets/global_images/location_green.png new file mode 100644 index 0000000..aa8be65 --- /dev/null +++ b/src/assets/global_images/location_green.png Binary files differ diff --git a/src/assets/global_images/location_red.png b/src/assets/global_images/location_red.png new file mode 100644 index 0000000..2be8c3d --- /dev/null +++ b/src/assets/global_images/location_red.png Binary files differ diff --git a/src/assets/global_images/location_yellow.png b/src/assets/global_images/location_yellow.png new file mode 100644 index 0000000..5ab6f4d --- /dev/null +++ b/src/assets/global_images/location_yellow.png Binary files differ diff --git a/src/assets/global_images/toilet-position.png b/src/assets/global_images/toilet-position.png new file mode 100644 index 0000000..7db6d9a --- /dev/null +++ b/src/assets/global_images/toilet-position.png Binary files differ diff --git a/config/index.js b/config/index.js index 8abd37a..19b33b1 100644 --- a/config/index.js +++ b/config/index.js @@ -69,7 +69,7 @@ * then assetsPublicPath should be set to "/bar/". * In most cases please use '/' !!! */ - assetsPublicPath: '/', + assetsPublicPath: '/toilet/', /** * Source Maps diff --git a/package.json b/package.json index 45f055f..9f3a3eb 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "echarts": "^4.2.1", "element-ui": "2.13.0", "event-source-polyfill": "^1.0.5", + "file-saver": "^2.0.5", "js-cookie": "2.2.0", "jsencrypt": "^3.0.0-rc.1", "leaflet": "^1.7.1", @@ -33,7 +34,9 @@ "vue-amap": "^0.5.9", "vue-baidu-map": "^0.21.22", "vue-router": "3.0.1", - "vuex": "3.0.1" + "vue2-leaflet": "^2.7.0", + "vuex": "3.0.1", + "xlsx": "^0.17.0" }, "devDependencies": { "autoprefixer": "8.5.0", diff --git a/src/api/common.js b/src/api/common.js index 87c582b..7804714 100644 --- a/src/api/common.js +++ b/src/api/common.js @@ -2,10 +2,14 @@ * 常用接口 */ import request from '@/utils/request' +import Vue from 'vue' + // 模板下载 export function downloadTemplate(fileName) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath return request({ - url: 'template/download', + url: lampPath + 'template/download', method: 'get', params: { filename: fileName @@ -19,7 +23,7 @@ const param = new FormData() param.append('file', fileobj.file) return request({ - url: 'imageUpload', + url: 'fileUpload', method: 'post', headers: { 'Content-Type': 'multipart/form-data' }, data: param diff --git a/src/api/sanitation/statistics.js b/src/api/sanitation/statistics.js new file mode 100644 index 0000000..ffeac18 --- /dev/null +++ b/src/api/sanitation/statistics.js @@ -0,0 +1,22 @@ + +/** + * 考核统计接口 + */ +import request from '@/utils/request' +// 公厕保洁次数统计 +export function getToiletJobCount(params) { + return request({ + url: '/sanitation/statistic/toilet/jobCount', + method: 'get', + params + }) +} + +// 公厕评分统计 +export function getToiletEvaluation(params) { + return request({ + url: '/sanitation/toiletEvaluation/statistics', + method: 'get', + params + }) +} diff --git a/src/api/sanitation/toilet.js b/src/api/sanitation/toilet.js new file mode 100644 index 0000000..11affd4 --- /dev/null +++ b/src/api/sanitation/toilet.js @@ -0,0 +1,133 @@ +/** + * 公厕管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' +// 公厕查询 +export function getToiletListPage(params) { + return request({ + url: '/sanitation/toilet/listPage', + method: 'get', + params + }) +} +// 公厕查询 +export function getToiletList(pid) { + return request({ + url: '/sanitation/toilet/list', + method: 'get', + params: { + pid: pid + } + }) +} + +// 添加公厕 +export function addToilet(params) { + return request({ + url: '/sanitation/toilet/add', + method: 'post', + params + }) +} +// 修改公厕机构 +export function updateToilet(params) { + return request({ + url: '/sanitation/toilet/update', + method: 'post', + params + }) +} +// 删除公厕机构 +export function delToilet(ids) { + return request({ + url: '/sanitation/toilet/delete', + method: 'post', + params: { + ids + }, + paramsSerializer: params => { + return qs.stringify(params, { indices: false }) + } + }) +} + +// 公厕基本信息详情 +export function getToiletInfoDetail(id) { + return request({ + url: '/sanitation/toilet/detail?toiletId=' + id, + method: 'get' + }) +} + +// 某公厕保洁记录 +export function getRecordsByToilet(params) { + return request({ + url: '/sanitation/toilet/jobRecord/detail', + method: 'get', + params + }) +} + +// 某公厕平均评分 +export function getScoreByToilet(params) { + return request({ + url: '/sanitation/toiletEvaluation/detailScore', + method: 'get', + params + }) +} + +// 某公厕评分列表 +export function getScoreListByToilet(params) { + return request({ + url: '/sanitation/toiletEvaluation/list', + method: 'get', + params + }) +} + + +// 批量导入 +export function batchImportToilet(fileobj) { + const param = new FormData() + param.append('file', fileobj) + return request({ + url: '/sanitation/toilet/import', + method: 'post', + headers: { 'Content-Type': 'multipart/form-data' }, + data: param + }) +} +// 批量导出 +export function batchExportToilet(params, config) { + return request({ + url: '/sanitation/toilet/export', + method: 'get', + timeout: 120000, + params, + ...config, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 公厕保洁记录查询 +export function getToiletJobRecords(params) { + return request({ + url: '/sanitation/toilet/jobRecord', + method: 'get', + params + }) +} + +// 批量导出 +export function batchExportToiletJobRecords(params, config) { + return request({ + url: '/sanitation/toilet/exportJobRecord', + method: 'get', + timeout: 120000, + params, + ...config, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} diff --git a/src/api/system/alarm.js b/src/api/system/alarm.js new file mode 100644 index 0000000..1c3a7ab --- /dev/null +++ b/src/api/system/alarm.js @@ -0,0 +1,62 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' + +// 获取当前报警列表 +export function getAlarmNowList(params) { + return request({ + url: '/alarm/listNowPage', + method: 'get', + params + }) +} + +// 获取当前报警列表 +export function getAlarmHistoryList(params) { + return request({ + url: '/alarm/listHisPage', + method: 'get', + params + }) +} + + +// 批量消警 +export function clearAll(params) { + return request({ + url: '/alarm/allClear', + method: 'get', + params + }) +} + +// 消警 +export function clearAlarm(params) { + return request({ + url: '/alarm/cancel', + method: 'get', + params + }) +} + +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 设置报警阈值 +export function setThresh(params) { + return request({ + url: '/alarm/resetAlarmRule', + method: 'post', + params + }) +} diff --git a/src/api/system/bridge.js b/src/api/system/bridge.js new file mode 100644 index 0000000..e8a4108 --- /dev/null +++ b/src/api/system/bridge.js @@ -0,0 +1,80 @@ +/** + * 桥梁管理接口 + */ +import request from '@/utils/request' + +// 获取桥梁详情 +export function getDetail(id) { + return request({ + url: '/bridge/detail', + method: 'get', + params: { + id: id + } + }) +} + +export function updateBridge(params) { + return request({ + url: '/bridge/update', + method: 'post', + params + }) +} +// 批量导出 +export function exportRecords(params) { + return request({ + url: 'device/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +export function getContentList(params) { + return request({ + url: 'maintain/contentByType', + method: 'get', + params: { + type: params + } + }) +} +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 编辑 +export function editRecord(params) { + return request({ + url: 'maintain/update', + method: 'post', + params + }) +} +// 新增 +export function addRecord(params) { + return request({ + url: 'maintain/add', + method: 'post', + params + }) +} +// 删除 +export function delRecord(id) { + return request({ + url: 'maintain/delete', + method: 'post', + params: { + id: id + } + }) +} diff --git a/src/api/system/data.js b/src/api/system/data.js new file mode 100644 index 0000000..4c95db5 --- /dev/null +++ b/src/api/system/data.js @@ -0,0 +1,63 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' + +// 获取当前报警列表 +export function getHistoryList(params) { + return request({ + url: '/data/hisListPage', + method: 'get', + params + }) +} + +// 获取当前报警列表 +export function getHistory(params) { + return request({ + url: '/data/hisList', + method: 'get', + params + }) +} + + + +// 批量消警 +export function clearAll(params) { + return request({ + url: '/alarm/allClear', + method: 'get', + params + }) +} + +// 消警 +export function clearAlarm(params) { + return request({ + url: '/alarm/cancel', + method: 'get', + params + }) +} + +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 设置报警阈值 +export function setThresh(params) { + return request({ + url: '/alarm/resetAlarmRule', + method: 'post', + params + }) +} diff --git a/src/api/system/order.js b/src/api/system/order.js new file mode 100644 index 0000000..7007c50 --- /dev/null +++ b/src/api/system/order.js @@ -0,0 +1,71 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +// import qs from 'qs' + +// 获取当前报警列表 +export function getRecordList(params) { + return request({ + url: '/maintain/listPage', + method: 'get', + params + }) +} +// 批量导出 +export function exportRecords(params) { + return request({ + url: 'device/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +export function getContentList(params) { + return request({ + url: 'maintain/contentByType', + method: 'get', + params: { + type: params + } + }) +} +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 编辑 +export function editRecord(params) { + return request({ + url: 'maintain/update', + method: 'post', + params + }) +} +// 新增 +export function addRecord(params) { + return request({ + url: 'maintain/add', + method: 'post', + params + }) +} +// 删除 +export function delRecord(id) { + return request({ + url: 'maintain/delete', + method: 'post', + params: { + bridgeMaintenanceId: id + } + }) +} diff --git a/src/api/system/overview.js b/src/api/system/overview.js new file mode 100644 index 0000000..bca50cc --- /dev/null +++ b/src/api/system/overview.js @@ -0,0 +1,109 @@ +import request from '@/utils/request' +import qs from "qs" +import Vue from 'vue' + +// 路灯状态统计 +export function getLampStatus() { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampStatus', + method: 'get' + }) +} + +// 路灯总览列表 +export function getLampList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampList', + method: 'get', + params + }) +} + +// 路灯详情 +export function getlampDetail(lampId) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampDetail', + method: 'get', + params: { + lampId: lampId + } + }) +} + +// 回路列表 +export function getCircuitList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/circuitList', + method: 'get', + params + }) +} + +// 灯箱列表 +export function getLampBoxList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampBoxList', + method: 'get', + params + }) +} +// 灯箱详情 +export function getLampBoxDetail(lampBoxId) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampBoxDetail', + method: 'get', + params: { + lampBoxId: lampBoxId + } + }) +} + +// 报警总览列表 +export function getAlarmList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/alarmList', + method: 'get', + params + }) +} + +// 报警详情 +export function getAlarmDetail(alarmId) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/alarmDetail', + method: 'get', + params: { + alarmId: alarmId + } + }) +} + +// 路灯控制 +export function lampControl(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampControl', + method: 'post', + params, + paramsSerializer: params => { + return qs.stringify(params, { indices: false }) + } + }) +} diff --git a/src/api/system/rule.js b/src/api/system/rule.js new file mode 100644 index 0000000..76c6b2d --- /dev/null +++ b/src/api/system/rule.js @@ -0,0 +1,59 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +// import qs from 'qs' + +// 获取当前报警列表 +export function getRuleList() { + return request({ + url: 'rule/listPage', + method: 'get' + }) +} +export function getContentList(params) { + return request({ + url: 'maintain/contentByType', + method: 'get', + params: { + type: params + } + }) +} +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 编辑 +export function editRecord(params) { + return request({ + url: 'maintain/update', + method: 'post', + params + }) +} +// 新增 +export function addRecord(params) { + return request({ + url: 'maintain/add', + method: 'post', + params + }) +} +// 删除 +export function delRecord(id) { + return request({ + url: 'maintain/delete', + method: 'post', + params: { + id: id + } + }) +} diff --git a/src/api/system/statistics.js b/src/api/system/statistics.js new file mode 100644 index 0000000..b25efe9 --- /dev/null +++ b/src/api/system/statistics.js @@ -0,0 +1,23 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +// import qs from 'qs' + +// +export function countByToilet(params) { + return request({ + url: '/sanitation/toiletStatistic/jobStaticByToilet', + method: 'get', + params + }) +} + +export function countByDay(params) { + return request({ + url: '/sanitation/toiletStatistic/jobStaticByDate', + method: 'get', + params + }) +} + diff --git a/src/assets/global_images/icon-position.png b/src/assets/global_images/icon-position.png new file mode 100644 index 0000000..7444038 --- /dev/null +++ b/src/assets/global_images/icon-position.png Binary files differ diff --git a/src/assets/global_images/location_green.png b/src/assets/global_images/location_green.png new file mode 100644 index 0000000..aa8be65 --- /dev/null +++ b/src/assets/global_images/location_green.png Binary files differ diff --git a/src/assets/global_images/location_red.png b/src/assets/global_images/location_red.png new file mode 100644 index 0000000..2be8c3d --- /dev/null +++ b/src/assets/global_images/location_red.png Binary files differ diff --git a/src/assets/global_images/location_yellow.png b/src/assets/global_images/location_yellow.png new file mode 100644 index 0000000..5ab6f4d --- /dev/null +++ b/src/assets/global_images/location_yellow.png Binary files differ diff --git a/src/assets/global_images/toilet-position.png b/src/assets/global_images/toilet-position.png new file mode 100644 index 0000000..7db6d9a --- /dev/null +++ b/src/assets/global_images/toilet-position.png Binary files differ diff --git a/src/assets/global_images/toilet.png b/src/assets/global_images/toilet.png new file mode 100644 index 0000000..6d9fc05 --- /dev/null +++ b/src/assets/global_images/toilet.png Binary files differ diff --git a/config/index.js b/config/index.js index 8abd37a..19b33b1 100644 --- a/config/index.js +++ b/config/index.js @@ -69,7 +69,7 @@ * then assetsPublicPath should be set to "/bar/". * In most cases please use '/' !!! */ - assetsPublicPath: '/', + assetsPublicPath: '/toilet/', /** * Source Maps diff --git a/package.json b/package.json index 45f055f..9f3a3eb 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "echarts": "^4.2.1", "element-ui": "2.13.0", "event-source-polyfill": "^1.0.5", + "file-saver": "^2.0.5", "js-cookie": "2.2.0", "jsencrypt": "^3.0.0-rc.1", "leaflet": "^1.7.1", @@ -33,7 +34,9 @@ "vue-amap": "^0.5.9", "vue-baidu-map": "^0.21.22", "vue-router": "3.0.1", - "vuex": "3.0.1" + "vue2-leaflet": "^2.7.0", + "vuex": "3.0.1", + "xlsx": "^0.17.0" }, "devDependencies": { "autoprefixer": "8.5.0", diff --git a/src/api/common.js b/src/api/common.js index 87c582b..7804714 100644 --- a/src/api/common.js +++ b/src/api/common.js @@ -2,10 +2,14 @@ * 常用接口 */ import request from '@/utils/request' +import Vue from 'vue' + // 模板下载 export function downloadTemplate(fileName) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath return request({ - url: 'template/download', + url: lampPath + 'template/download', method: 'get', params: { filename: fileName @@ -19,7 +23,7 @@ const param = new FormData() param.append('file', fileobj.file) return request({ - url: 'imageUpload', + url: 'fileUpload', method: 'post', headers: { 'Content-Type': 'multipart/form-data' }, data: param diff --git a/src/api/sanitation/statistics.js b/src/api/sanitation/statistics.js new file mode 100644 index 0000000..ffeac18 --- /dev/null +++ b/src/api/sanitation/statistics.js @@ -0,0 +1,22 @@ + +/** + * 考核统计接口 + */ +import request from '@/utils/request' +// 公厕保洁次数统计 +export function getToiletJobCount(params) { + return request({ + url: '/sanitation/statistic/toilet/jobCount', + method: 'get', + params + }) +} + +// 公厕评分统计 +export function getToiletEvaluation(params) { + return request({ + url: '/sanitation/toiletEvaluation/statistics', + method: 'get', + params + }) +} diff --git a/src/api/sanitation/toilet.js b/src/api/sanitation/toilet.js new file mode 100644 index 0000000..11affd4 --- /dev/null +++ b/src/api/sanitation/toilet.js @@ -0,0 +1,133 @@ +/** + * 公厕管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' +// 公厕查询 +export function getToiletListPage(params) { + return request({ + url: '/sanitation/toilet/listPage', + method: 'get', + params + }) +} +// 公厕查询 +export function getToiletList(pid) { + return request({ + url: '/sanitation/toilet/list', + method: 'get', + params: { + pid: pid + } + }) +} + +// 添加公厕 +export function addToilet(params) { + return request({ + url: '/sanitation/toilet/add', + method: 'post', + params + }) +} +// 修改公厕机构 +export function updateToilet(params) { + return request({ + url: '/sanitation/toilet/update', + method: 'post', + params + }) +} +// 删除公厕机构 +export function delToilet(ids) { + return request({ + url: '/sanitation/toilet/delete', + method: 'post', + params: { + ids + }, + paramsSerializer: params => { + return qs.stringify(params, { indices: false }) + } + }) +} + +// 公厕基本信息详情 +export function getToiletInfoDetail(id) { + return request({ + url: '/sanitation/toilet/detail?toiletId=' + id, + method: 'get' + }) +} + +// 某公厕保洁记录 +export function getRecordsByToilet(params) { + return request({ + url: '/sanitation/toilet/jobRecord/detail', + method: 'get', + params + }) +} + +// 某公厕平均评分 +export function getScoreByToilet(params) { + return request({ + url: '/sanitation/toiletEvaluation/detailScore', + method: 'get', + params + }) +} + +// 某公厕评分列表 +export function getScoreListByToilet(params) { + return request({ + url: '/sanitation/toiletEvaluation/list', + method: 'get', + params + }) +} + + +// 批量导入 +export function batchImportToilet(fileobj) { + const param = new FormData() + param.append('file', fileobj) + return request({ + url: '/sanitation/toilet/import', + method: 'post', + headers: { 'Content-Type': 'multipart/form-data' }, + data: param + }) +} +// 批量导出 +export function batchExportToilet(params, config) { + return request({ + url: '/sanitation/toilet/export', + method: 'get', + timeout: 120000, + params, + ...config, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 公厕保洁记录查询 +export function getToiletJobRecords(params) { + return request({ + url: '/sanitation/toilet/jobRecord', + method: 'get', + params + }) +} + +// 批量导出 +export function batchExportToiletJobRecords(params, config) { + return request({ + url: '/sanitation/toilet/exportJobRecord', + method: 'get', + timeout: 120000, + params, + ...config, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} diff --git a/src/api/system/alarm.js b/src/api/system/alarm.js new file mode 100644 index 0000000..1c3a7ab --- /dev/null +++ b/src/api/system/alarm.js @@ -0,0 +1,62 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' + +// 获取当前报警列表 +export function getAlarmNowList(params) { + return request({ + url: '/alarm/listNowPage', + method: 'get', + params + }) +} + +// 获取当前报警列表 +export function getAlarmHistoryList(params) { + return request({ + url: '/alarm/listHisPage', + method: 'get', + params + }) +} + + +// 批量消警 +export function clearAll(params) { + return request({ + url: '/alarm/allClear', + method: 'get', + params + }) +} + +// 消警 +export function clearAlarm(params) { + return request({ + url: '/alarm/cancel', + method: 'get', + params + }) +} + +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 设置报警阈值 +export function setThresh(params) { + return request({ + url: '/alarm/resetAlarmRule', + method: 'post', + params + }) +} diff --git a/src/api/system/bridge.js b/src/api/system/bridge.js new file mode 100644 index 0000000..e8a4108 --- /dev/null +++ b/src/api/system/bridge.js @@ -0,0 +1,80 @@ +/** + * 桥梁管理接口 + */ +import request from '@/utils/request' + +// 获取桥梁详情 +export function getDetail(id) { + return request({ + url: '/bridge/detail', + method: 'get', + params: { + id: id + } + }) +} + +export function updateBridge(params) { + return request({ + url: '/bridge/update', + method: 'post', + params + }) +} +// 批量导出 +export function exportRecords(params) { + return request({ + url: 'device/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +export function getContentList(params) { + return request({ + url: 'maintain/contentByType', + method: 'get', + params: { + type: params + } + }) +} +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 编辑 +export function editRecord(params) { + return request({ + url: 'maintain/update', + method: 'post', + params + }) +} +// 新增 +export function addRecord(params) { + return request({ + url: 'maintain/add', + method: 'post', + params + }) +} +// 删除 +export function delRecord(id) { + return request({ + url: 'maintain/delete', + method: 'post', + params: { + id: id + } + }) +} diff --git a/src/api/system/data.js b/src/api/system/data.js new file mode 100644 index 0000000..4c95db5 --- /dev/null +++ b/src/api/system/data.js @@ -0,0 +1,63 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' + +// 获取当前报警列表 +export function getHistoryList(params) { + return request({ + url: '/data/hisListPage', + method: 'get', + params + }) +} + +// 获取当前报警列表 +export function getHistory(params) { + return request({ + url: '/data/hisList', + method: 'get', + params + }) +} + + + +// 批量消警 +export function clearAll(params) { + return request({ + url: '/alarm/allClear', + method: 'get', + params + }) +} + +// 消警 +export function clearAlarm(params) { + return request({ + url: '/alarm/cancel', + method: 'get', + params + }) +} + +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 设置报警阈值 +export function setThresh(params) { + return request({ + url: '/alarm/resetAlarmRule', + method: 'post', + params + }) +} diff --git a/src/api/system/order.js b/src/api/system/order.js new file mode 100644 index 0000000..7007c50 --- /dev/null +++ b/src/api/system/order.js @@ -0,0 +1,71 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +// import qs from 'qs' + +// 获取当前报警列表 +export function getRecordList(params) { + return request({ + url: '/maintain/listPage', + method: 'get', + params + }) +} +// 批量导出 +export function exportRecords(params) { + return request({ + url: 'device/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +export function getContentList(params) { + return request({ + url: 'maintain/contentByType', + method: 'get', + params: { + type: params + } + }) +} +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 编辑 +export function editRecord(params) { + return request({ + url: 'maintain/update', + method: 'post', + params + }) +} +// 新增 +export function addRecord(params) { + return request({ + url: 'maintain/add', + method: 'post', + params + }) +} +// 删除 +export function delRecord(id) { + return request({ + url: 'maintain/delete', + method: 'post', + params: { + bridgeMaintenanceId: id + } + }) +} diff --git a/src/api/system/overview.js b/src/api/system/overview.js new file mode 100644 index 0000000..bca50cc --- /dev/null +++ b/src/api/system/overview.js @@ -0,0 +1,109 @@ +import request from '@/utils/request' +import qs from "qs" +import Vue from 'vue' + +// 路灯状态统计 +export function getLampStatus() { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampStatus', + method: 'get' + }) +} + +// 路灯总览列表 +export function getLampList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampList', + method: 'get', + params + }) +} + +// 路灯详情 +export function getlampDetail(lampId) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampDetail', + method: 'get', + params: { + lampId: lampId + } + }) +} + +// 回路列表 +export function getCircuitList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/circuitList', + method: 'get', + params + }) +} + +// 灯箱列表 +export function getLampBoxList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampBoxList', + method: 'get', + params + }) +} +// 灯箱详情 +export function getLampBoxDetail(lampBoxId) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampBoxDetail', + method: 'get', + params: { + lampBoxId: lampBoxId + } + }) +} + +// 报警总览列表 +export function getAlarmList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/alarmList', + method: 'get', + params + }) +} + +// 报警详情 +export function getAlarmDetail(alarmId) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/alarmDetail', + method: 'get', + params: { + alarmId: alarmId + } + }) +} + +// 路灯控制 +export function lampControl(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampControl', + method: 'post', + params, + paramsSerializer: params => { + return qs.stringify(params, { indices: false }) + } + }) +} diff --git a/src/api/system/rule.js b/src/api/system/rule.js new file mode 100644 index 0000000..76c6b2d --- /dev/null +++ b/src/api/system/rule.js @@ -0,0 +1,59 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +// import qs from 'qs' + +// 获取当前报警列表 +export function getRuleList() { + return request({ + url: 'rule/listPage', + method: 'get' + }) +} +export function getContentList(params) { + return request({ + url: 'maintain/contentByType', + method: 'get', + params: { + type: params + } + }) +} +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 编辑 +export function editRecord(params) { + return request({ + url: 'maintain/update', + method: 'post', + params + }) +} +// 新增 +export function addRecord(params) { + return request({ + url: 'maintain/add', + method: 'post', + params + }) +} +// 删除 +export function delRecord(id) { + return request({ + url: 'maintain/delete', + method: 'post', + params: { + id: id + } + }) +} diff --git a/src/api/system/statistics.js b/src/api/system/statistics.js new file mode 100644 index 0000000..b25efe9 --- /dev/null +++ b/src/api/system/statistics.js @@ -0,0 +1,23 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +// import qs from 'qs' + +// +export function countByToilet(params) { + return request({ + url: '/sanitation/toiletStatistic/jobStaticByToilet', + method: 'get', + params + }) +} + +export function countByDay(params) { + return request({ + url: '/sanitation/toiletStatistic/jobStaticByDate', + method: 'get', + params + }) +} + diff --git a/src/assets/global_images/icon-position.png b/src/assets/global_images/icon-position.png new file mode 100644 index 0000000..7444038 --- /dev/null +++ b/src/assets/global_images/icon-position.png Binary files differ diff --git a/src/assets/global_images/location_green.png b/src/assets/global_images/location_green.png new file mode 100644 index 0000000..aa8be65 --- /dev/null +++ b/src/assets/global_images/location_green.png Binary files differ diff --git a/src/assets/global_images/location_red.png b/src/assets/global_images/location_red.png new file mode 100644 index 0000000..2be8c3d --- /dev/null +++ b/src/assets/global_images/location_red.png Binary files differ diff --git a/src/assets/global_images/location_yellow.png b/src/assets/global_images/location_yellow.png new file mode 100644 index 0000000..5ab6f4d --- /dev/null +++ b/src/assets/global_images/location_yellow.png Binary files differ diff --git a/src/assets/global_images/toilet-position.png b/src/assets/global_images/toilet-position.png new file mode 100644 index 0000000..7db6d9a --- /dev/null +++ b/src/assets/global_images/toilet-position.png Binary files differ diff --git a/src/assets/global_images/toilet.png b/src/assets/global_images/toilet.png new file mode 100644 index 0000000..6d9fc05 --- /dev/null +++ b/src/assets/global_images/toilet.png Binary files differ diff --git a/src/assets/global_images/toiletPhoto.png b/src/assets/global_images/toiletPhoto.png new file mode 100644 index 0000000..15d08e2 --- /dev/null +++ b/src/assets/global_images/toiletPhoto.png Binary files differ diff --git a/config/index.js b/config/index.js index 8abd37a..19b33b1 100644 --- a/config/index.js +++ b/config/index.js @@ -69,7 +69,7 @@ * then assetsPublicPath should be set to "/bar/". * In most cases please use '/' !!! */ - assetsPublicPath: '/', + assetsPublicPath: '/toilet/', /** * Source Maps diff --git a/package.json b/package.json index 45f055f..9f3a3eb 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "echarts": "^4.2.1", "element-ui": "2.13.0", "event-source-polyfill": "^1.0.5", + "file-saver": "^2.0.5", "js-cookie": "2.2.0", "jsencrypt": "^3.0.0-rc.1", "leaflet": "^1.7.1", @@ -33,7 +34,9 @@ "vue-amap": "^0.5.9", "vue-baidu-map": "^0.21.22", "vue-router": "3.0.1", - "vuex": "3.0.1" + "vue2-leaflet": "^2.7.0", + "vuex": "3.0.1", + "xlsx": "^0.17.0" }, "devDependencies": { "autoprefixer": "8.5.0", diff --git a/src/api/common.js b/src/api/common.js index 87c582b..7804714 100644 --- a/src/api/common.js +++ b/src/api/common.js @@ -2,10 +2,14 @@ * 常用接口 */ import request from '@/utils/request' +import Vue from 'vue' + // 模板下载 export function downloadTemplate(fileName) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath return request({ - url: 'template/download', + url: lampPath + 'template/download', method: 'get', params: { filename: fileName @@ -19,7 +23,7 @@ const param = new FormData() param.append('file', fileobj.file) return request({ - url: 'imageUpload', + url: 'fileUpload', method: 'post', headers: { 'Content-Type': 'multipart/form-data' }, data: param diff --git a/src/api/sanitation/statistics.js b/src/api/sanitation/statistics.js new file mode 100644 index 0000000..ffeac18 --- /dev/null +++ b/src/api/sanitation/statistics.js @@ -0,0 +1,22 @@ + +/** + * 考核统计接口 + */ +import request from '@/utils/request' +// 公厕保洁次数统计 +export function getToiletJobCount(params) { + return request({ + url: '/sanitation/statistic/toilet/jobCount', + method: 'get', + params + }) +} + +// 公厕评分统计 +export function getToiletEvaluation(params) { + return request({ + url: '/sanitation/toiletEvaluation/statistics', + method: 'get', + params + }) +} diff --git a/src/api/sanitation/toilet.js b/src/api/sanitation/toilet.js new file mode 100644 index 0000000..11affd4 --- /dev/null +++ b/src/api/sanitation/toilet.js @@ -0,0 +1,133 @@ +/** + * 公厕管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' +// 公厕查询 +export function getToiletListPage(params) { + return request({ + url: '/sanitation/toilet/listPage', + method: 'get', + params + }) +} +// 公厕查询 +export function getToiletList(pid) { + return request({ + url: '/sanitation/toilet/list', + method: 'get', + params: { + pid: pid + } + }) +} + +// 添加公厕 +export function addToilet(params) { + return request({ + url: '/sanitation/toilet/add', + method: 'post', + params + }) +} +// 修改公厕机构 +export function updateToilet(params) { + return request({ + url: '/sanitation/toilet/update', + method: 'post', + params + }) +} +// 删除公厕机构 +export function delToilet(ids) { + return request({ + url: '/sanitation/toilet/delete', + method: 'post', + params: { + ids + }, + paramsSerializer: params => { + return qs.stringify(params, { indices: false }) + } + }) +} + +// 公厕基本信息详情 +export function getToiletInfoDetail(id) { + return request({ + url: '/sanitation/toilet/detail?toiletId=' + id, + method: 'get' + }) +} + +// 某公厕保洁记录 +export function getRecordsByToilet(params) { + return request({ + url: '/sanitation/toilet/jobRecord/detail', + method: 'get', + params + }) +} + +// 某公厕平均评分 +export function getScoreByToilet(params) { + return request({ + url: '/sanitation/toiletEvaluation/detailScore', + method: 'get', + params + }) +} + +// 某公厕评分列表 +export function getScoreListByToilet(params) { + return request({ + url: '/sanitation/toiletEvaluation/list', + method: 'get', + params + }) +} + + +// 批量导入 +export function batchImportToilet(fileobj) { + const param = new FormData() + param.append('file', fileobj) + return request({ + url: '/sanitation/toilet/import', + method: 'post', + headers: { 'Content-Type': 'multipart/form-data' }, + data: param + }) +} +// 批量导出 +export function batchExportToilet(params, config) { + return request({ + url: '/sanitation/toilet/export', + method: 'get', + timeout: 120000, + params, + ...config, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 公厕保洁记录查询 +export function getToiletJobRecords(params) { + return request({ + url: '/sanitation/toilet/jobRecord', + method: 'get', + params + }) +} + +// 批量导出 +export function batchExportToiletJobRecords(params, config) { + return request({ + url: '/sanitation/toilet/exportJobRecord', + method: 'get', + timeout: 120000, + params, + ...config, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} diff --git a/src/api/system/alarm.js b/src/api/system/alarm.js new file mode 100644 index 0000000..1c3a7ab --- /dev/null +++ b/src/api/system/alarm.js @@ -0,0 +1,62 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' + +// 获取当前报警列表 +export function getAlarmNowList(params) { + return request({ + url: '/alarm/listNowPage', + method: 'get', + params + }) +} + +// 获取当前报警列表 +export function getAlarmHistoryList(params) { + return request({ + url: '/alarm/listHisPage', + method: 'get', + params + }) +} + + +// 批量消警 +export function clearAll(params) { + return request({ + url: '/alarm/allClear', + method: 'get', + params + }) +} + +// 消警 +export function clearAlarm(params) { + return request({ + url: '/alarm/cancel', + method: 'get', + params + }) +} + +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 设置报警阈值 +export function setThresh(params) { + return request({ + url: '/alarm/resetAlarmRule', + method: 'post', + params + }) +} diff --git a/src/api/system/bridge.js b/src/api/system/bridge.js new file mode 100644 index 0000000..e8a4108 --- /dev/null +++ b/src/api/system/bridge.js @@ -0,0 +1,80 @@ +/** + * 桥梁管理接口 + */ +import request from '@/utils/request' + +// 获取桥梁详情 +export function getDetail(id) { + return request({ + url: '/bridge/detail', + method: 'get', + params: { + id: id + } + }) +} + +export function updateBridge(params) { + return request({ + url: '/bridge/update', + method: 'post', + params + }) +} +// 批量导出 +export function exportRecords(params) { + return request({ + url: 'device/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +export function getContentList(params) { + return request({ + url: 'maintain/contentByType', + method: 'get', + params: { + type: params + } + }) +} +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 编辑 +export function editRecord(params) { + return request({ + url: 'maintain/update', + method: 'post', + params + }) +} +// 新增 +export function addRecord(params) { + return request({ + url: 'maintain/add', + method: 'post', + params + }) +} +// 删除 +export function delRecord(id) { + return request({ + url: 'maintain/delete', + method: 'post', + params: { + id: id + } + }) +} diff --git a/src/api/system/data.js b/src/api/system/data.js new file mode 100644 index 0000000..4c95db5 --- /dev/null +++ b/src/api/system/data.js @@ -0,0 +1,63 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' + +// 获取当前报警列表 +export function getHistoryList(params) { + return request({ + url: '/data/hisListPage', + method: 'get', + params + }) +} + +// 获取当前报警列表 +export function getHistory(params) { + return request({ + url: '/data/hisList', + method: 'get', + params + }) +} + + + +// 批量消警 +export function clearAll(params) { + return request({ + url: '/alarm/allClear', + method: 'get', + params + }) +} + +// 消警 +export function clearAlarm(params) { + return request({ + url: '/alarm/cancel', + method: 'get', + params + }) +} + +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 设置报警阈值 +export function setThresh(params) { + return request({ + url: '/alarm/resetAlarmRule', + method: 'post', + params + }) +} diff --git a/src/api/system/order.js b/src/api/system/order.js new file mode 100644 index 0000000..7007c50 --- /dev/null +++ b/src/api/system/order.js @@ -0,0 +1,71 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +// import qs from 'qs' + +// 获取当前报警列表 +export function getRecordList(params) { + return request({ + url: '/maintain/listPage', + method: 'get', + params + }) +} +// 批量导出 +export function exportRecords(params) { + return request({ + url: 'device/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +export function getContentList(params) { + return request({ + url: 'maintain/contentByType', + method: 'get', + params: { + type: params + } + }) +} +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 编辑 +export function editRecord(params) { + return request({ + url: 'maintain/update', + method: 'post', + params + }) +} +// 新增 +export function addRecord(params) { + return request({ + url: 'maintain/add', + method: 'post', + params + }) +} +// 删除 +export function delRecord(id) { + return request({ + url: 'maintain/delete', + method: 'post', + params: { + bridgeMaintenanceId: id + } + }) +} diff --git a/src/api/system/overview.js b/src/api/system/overview.js new file mode 100644 index 0000000..bca50cc --- /dev/null +++ b/src/api/system/overview.js @@ -0,0 +1,109 @@ +import request from '@/utils/request' +import qs from "qs" +import Vue from 'vue' + +// 路灯状态统计 +export function getLampStatus() { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampStatus', + method: 'get' + }) +} + +// 路灯总览列表 +export function getLampList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampList', + method: 'get', + params + }) +} + +// 路灯详情 +export function getlampDetail(lampId) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampDetail', + method: 'get', + params: { + lampId: lampId + } + }) +} + +// 回路列表 +export function getCircuitList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/circuitList', + method: 'get', + params + }) +} + +// 灯箱列表 +export function getLampBoxList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampBoxList', + method: 'get', + params + }) +} +// 灯箱详情 +export function getLampBoxDetail(lampBoxId) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampBoxDetail', + method: 'get', + params: { + lampBoxId: lampBoxId + } + }) +} + +// 报警总览列表 +export function getAlarmList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/alarmList', + method: 'get', + params + }) +} + +// 报警详情 +export function getAlarmDetail(alarmId) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/alarmDetail', + method: 'get', + params: { + alarmId: alarmId + } + }) +} + +// 路灯控制 +export function lampControl(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampControl', + method: 'post', + params, + paramsSerializer: params => { + return qs.stringify(params, { indices: false }) + } + }) +} diff --git a/src/api/system/rule.js b/src/api/system/rule.js new file mode 100644 index 0000000..76c6b2d --- /dev/null +++ b/src/api/system/rule.js @@ -0,0 +1,59 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +// import qs from 'qs' + +// 获取当前报警列表 +export function getRuleList() { + return request({ + url: 'rule/listPage', + method: 'get' + }) +} +export function getContentList(params) { + return request({ + url: 'maintain/contentByType', + method: 'get', + params: { + type: params + } + }) +} +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 编辑 +export function editRecord(params) { + return request({ + url: 'maintain/update', + method: 'post', + params + }) +} +// 新增 +export function addRecord(params) { + return request({ + url: 'maintain/add', + method: 'post', + params + }) +} +// 删除 +export function delRecord(id) { + return request({ + url: 'maintain/delete', + method: 'post', + params: { + id: id + } + }) +} diff --git a/src/api/system/statistics.js b/src/api/system/statistics.js new file mode 100644 index 0000000..b25efe9 --- /dev/null +++ b/src/api/system/statistics.js @@ -0,0 +1,23 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +// import qs from 'qs' + +// +export function countByToilet(params) { + return request({ + url: '/sanitation/toiletStatistic/jobStaticByToilet', + method: 'get', + params + }) +} + +export function countByDay(params) { + return request({ + url: '/sanitation/toiletStatistic/jobStaticByDate', + method: 'get', + params + }) +} + diff --git a/src/assets/global_images/icon-position.png b/src/assets/global_images/icon-position.png new file mode 100644 index 0000000..7444038 --- /dev/null +++ b/src/assets/global_images/icon-position.png Binary files differ diff --git a/src/assets/global_images/location_green.png b/src/assets/global_images/location_green.png new file mode 100644 index 0000000..aa8be65 --- /dev/null +++ b/src/assets/global_images/location_green.png Binary files differ diff --git a/src/assets/global_images/location_red.png b/src/assets/global_images/location_red.png new file mode 100644 index 0000000..2be8c3d --- /dev/null +++ b/src/assets/global_images/location_red.png Binary files differ diff --git a/src/assets/global_images/location_yellow.png b/src/assets/global_images/location_yellow.png new file mode 100644 index 0000000..5ab6f4d --- /dev/null +++ b/src/assets/global_images/location_yellow.png Binary files differ diff --git a/src/assets/global_images/toilet-position.png b/src/assets/global_images/toilet-position.png new file mode 100644 index 0000000..7db6d9a --- /dev/null +++ b/src/assets/global_images/toilet-position.png Binary files differ diff --git a/src/assets/global_images/toilet.png b/src/assets/global_images/toilet.png new file mode 100644 index 0000000..6d9fc05 --- /dev/null +++ b/src/assets/global_images/toilet.png Binary files differ diff --git a/src/assets/global_images/toiletPhoto.png b/src/assets/global_images/toiletPhoto.png new file mode 100644 index 0000000..15d08e2 --- /dev/null +++ b/src/assets/global_images/toiletPhoto.png Binary files differ diff --git a/src/components/DownloadTemplate/index.vue b/src/components/DownloadTemplate/index.vue index 8ded2cd..7807cac 100644 --- a/src/components/DownloadTemplate/index.vue +++ b/src/components/DownloadTemplate/index.vue @@ -47,8 +47,8 @@ diff --git a/config/index.js b/config/index.js index 8abd37a..19b33b1 100644 --- a/config/index.js +++ b/config/index.js @@ -69,7 +69,7 @@ * then assetsPublicPath should be set to "/bar/". * In most cases please use '/' !!! */ - assetsPublicPath: '/', + assetsPublicPath: '/toilet/', /** * Source Maps diff --git a/package.json b/package.json index 45f055f..9f3a3eb 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "echarts": "^4.2.1", "element-ui": "2.13.0", "event-source-polyfill": "^1.0.5", + "file-saver": "^2.0.5", "js-cookie": "2.2.0", "jsencrypt": "^3.0.0-rc.1", "leaflet": "^1.7.1", @@ -33,7 +34,9 @@ "vue-amap": "^0.5.9", "vue-baidu-map": "^0.21.22", "vue-router": "3.0.1", - "vuex": "3.0.1" + "vue2-leaflet": "^2.7.0", + "vuex": "3.0.1", + "xlsx": "^0.17.0" }, "devDependencies": { "autoprefixer": "8.5.0", diff --git a/src/api/common.js b/src/api/common.js index 87c582b..7804714 100644 --- a/src/api/common.js +++ b/src/api/common.js @@ -2,10 +2,14 @@ * 常用接口 */ import request from '@/utils/request' +import Vue from 'vue' + // 模板下载 export function downloadTemplate(fileName) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath return request({ - url: 'template/download', + url: lampPath + 'template/download', method: 'get', params: { filename: fileName @@ -19,7 +23,7 @@ const param = new FormData() param.append('file', fileobj.file) return request({ - url: 'imageUpload', + url: 'fileUpload', method: 'post', headers: { 'Content-Type': 'multipart/form-data' }, data: param diff --git a/src/api/sanitation/statistics.js b/src/api/sanitation/statistics.js new file mode 100644 index 0000000..ffeac18 --- /dev/null +++ b/src/api/sanitation/statistics.js @@ -0,0 +1,22 @@ + +/** + * 考核统计接口 + */ +import request from '@/utils/request' +// 公厕保洁次数统计 +export function getToiletJobCount(params) { + return request({ + url: '/sanitation/statistic/toilet/jobCount', + method: 'get', + params + }) +} + +// 公厕评分统计 +export function getToiletEvaluation(params) { + return request({ + url: '/sanitation/toiletEvaluation/statistics', + method: 'get', + params + }) +} diff --git a/src/api/sanitation/toilet.js b/src/api/sanitation/toilet.js new file mode 100644 index 0000000..11affd4 --- /dev/null +++ b/src/api/sanitation/toilet.js @@ -0,0 +1,133 @@ +/** + * 公厕管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' +// 公厕查询 +export function getToiletListPage(params) { + return request({ + url: '/sanitation/toilet/listPage', + method: 'get', + params + }) +} +// 公厕查询 +export function getToiletList(pid) { + return request({ + url: '/sanitation/toilet/list', + method: 'get', + params: { + pid: pid + } + }) +} + +// 添加公厕 +export function addToilet(params) { + return request({ + url: '/sanitation/toilet/add', + method: 'post', + params + }) +} +// 修改公厕机构 +export function updateToilet(params) { + return request({ + url: '/sanitation/toilet/update', + method: 'post', + params + }) +} +// 删除公厕机构 +export function delToilet(ids) { + return request({ + url: '/sanitation/toilet/delete', + method: 'post', + params: { + ids + }, + paramsSerializer: params => { + return qs.stringify(params, { indices: false }) + } + }) +} + +// 公厕基本信息详情 +export function getToiletInfoDetail(id) { + return request({ + url: '/sanitation/toilet/detail?toiletId=' + id, + method: 'get' + }) +} + +// 某公厕保洁记录 +export function getRecordsByToilet(params) { + return request({ + url: '/sanitation/toilet/jobRecord/detail', + method: 'get', + params + }) +} + +// 某公厕平均评分 +export function getScoreByToilet(params) { + return request({ + url: '/sanitation/toiletEvaluation/detailScore', + method: 'get', + params + }) +} + +// 某公厕评分列表 +export function getScoreListByToilet(params) { + return request({ + url: '/sanitation/toiletEvaluation/list', + method: 'get', + params + }) +} + + +// 批量导入 +export function batchImportToilet(fileobj) { + const param = new FormData() + param.append('file', fileobj) + return request({ + url: '/sanitation/toilet/import', + method: 'post', + headers: { 'Content-Type': 'multipart/form-data' }, + data: param + }) +} +// 批量导出 +export function batchExportToilet(params, config) { + return request({ + url: '/sanitation/toilet/export', + method: 'get', + timeout: 120000, + params, + ...config, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 公厕保洁记录查询 +export function getToiletJobRecords(params) { + return request({ + url: '/sanitation/toilet/jobRecord', + method: 'get', + params + }) +} + +// 批量导出 +export function batchExportToiletJobRecords(params, config) { + return request({ + url: '/sanitation/toilet/exportJobRecord', + method: 'get', + timeout: 120000, + params, + ...config, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} diff --git a/src/api/system/alarm.js b/src/api/system/alarm.js new file mode 100644 index 0000000..1c3a7ab --- /dev/null +++ b/src/api/system/alarm.js @@ -0,0 +1,62 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' + +// 获取当前报警列表 +export function getAlarmNowList(params) { + return request({ + url: '/alarm/listNowPage', + method: 'get', + params + }) +} + +// 获取当前报警列表 +export function getAlarmHistoryList(params) { + return request({ + url: '/alarm/listHisPage', + method: 'get', + params + }) +} + + +// 批量消警 +export function clearAll(params) { + return request({ + url: '/alarm/allClear', + method: 'get', + params + }) +} + +// 消警 +export function clearAlarm(params) { + return request({ + url: '/alarm/cancel', + method: 'get', + params + }) +} + +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 设置报警阈值 +export function setThresh(params) { + return request({ + url: '/alarm/resetAlarmRule', + method: 'post', + params + }) +} diff --git a/src/api/system/bridge.js b/src/api/system/bridge.js new file mode 100644 index 0000000..e8a4108 --- /dev/null +++ b/src/api/system/bridge.js @@ -0,0 +1,80 @@ +/** + * 桥梁管理接口 + */ +import request from '@/utils/request' + +// 获取桥梁详情 +export function getDetail(id) { + return request({ + url: '/bridge/detail', + method: 'get', + params: { + id: id + } + }) +} + +export function updateBridge(params) { + return request({ + url: '/bridge/update', + method: 'post', + params + }) +} +// 批量导出 +export function exportRecords(params) { + return request({ + url: 'device/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +export function getContentList(params) { + return request({ + url: 'maintain/contentByType', + method: 'get', + params: { + type: params + } + }) +} +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 编辑 +export function editRecord(params) { + return request({ + url: 'maintain/update', + method: 'post', + params + }) +} +// 新增 +export function addRecord(params) { + return request({ + url: 'maintain/add', + method: 'post', + params + }) +} +// 删除 +export function delRecord(id) { + return request({ + url: 'maintain/delete', + method: 'post', + params: { + id: id + } + }) +} diff --git a/src/api/system/data.js b/src/api/system/data.js new file mode 100644 index 0000000..4c95db5 --- /dev/null +++ b/src/api/system/data.js @@ -0,0 +1,63 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' + +// 获取当前报警列表 +export function getHistoryList(params) { + return request({ + url: '/data/hisListPage', + method: 'get', + params + }) +} + +// 获取当前报警列表 +export function getHistory(params) { + return request({ + url: '/data/hisList', + method: 'get', + params + }) +} + + + +// 批量消警 +export function clearAll(params) { + return request({ + url: '/alarm/allClear', + method: 'get', + params + }) +} + +// 消警 +export function clearAlarm(params) { + return request({ + url: '/alarm/cancel', + method: 'get', + params + }) +} + +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 设置报警阈值 +export function setThresh(params) { + return request({ + url: '/alarm/resetAlarmRule', + method: 'post', + params + }) +} diff --git a/src/api/system/order.js b/src/api/system/order.js new file mode 100644 index 0000000..7007c50 --- /dev/null +++ b/src/api/system/order.js @@ -0,0 +1,71 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +// import qs from 'qs' + +// 获取当前报警列表 +export function getRecordList(params) { + return request({ + url: '/maintain/listPage', + method: 'get', + params + }) +} +// 批量导出 +export function exportRecords(params) { + return request({ + url: 'device/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +export function getContentList(params) { + return request({ + url: 'maintain/contentByType', + method: 'get', + params: { + type: params + } + }) +} +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 编辑 +export function editRecord(params) { + return request({ + url: 'maintain/update', + method: 'post', + params + }) +} +// 新增 +export function addRecord(params) { + return request({ + url: 'maintain/add', + method: 'post', + params + }) +} +// 删除 +export function delRecord(id) { + return request({ + url: 'maintain/delete', + method: 'post', + params: { + bridgeMaintenanceId: id + } + }) +} diff --git a/src/api/system/overview.js b/src/api/system/overview.js new file mode 100644 index 0000000..bca50cc --- /dev/null +++ b/src/api/system/overview.js @@ -0,0 +1,109 @@ +import request from '@/utils/request' +import qs from "qs" +import Vue from 'vue' + +// 路灯状态统计 +export function getLampStatus() { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampStatus', + method: 'get' + }) +} + +// 路灯总览列表 +export function getLampList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampList', + method: 'get', + params + }) +} + +// 路灯详情 +export function getlampDetail(lampId) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampDetail', + method: 'get', + params: { + lampId: lampId + } + }) +} + +// 回路列表 +export function getCircuitList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/circuitList', + method: 'get', + params + }) +} + +// 灯箱列表 +export function getLampBoxList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampBoxList', + method: 'get', + params + }) +} +// 灯箱详情 +export function getLampBoxDetail(lampBoxId) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampBoxDetail', + method: 'get', + params: { + lampBoxId: lampBoxId + } + }) +} + +// 报警总览列表 +export function getAlarmList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/alarmList', + method: 'get', + params + }) +} + +// 报警详情 +export function getAlarmDetail(alarmId) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/alarmDetail', + method: 'get', + params: { + alarmId: alarmId + } + }) +} + +// 路灯控制 +export function lampControl(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampControl', + method: 'post', + params, + paramsSerializer: params => { + return qs.stringify(params, { indices: false }) + } + }) +} diff --git a/src/api/system/rule.js b/src/api/system/rule.js new file mode 100644 index 0000000..76c6b2d --- /dev/null +++ b/src/api/system/rule.js @@ -0,0 +1,59 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +// import qs from 'qs' + +// 获取当前报警列表 +export function getRuleList() { + return request({ + url: 'rule/listPage', + method: 'get' + }) +} +export function getContentList(params) { + return request({ + url: 'maintain/contentByType', + method: 'get', + params: { + type: params + } + }) +} +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 编辑 +export function editRecord(params) { + return request({ + url: 'maintain/update', + method: 'post', + params + }) +} +// 新增 +export function addRecord(params) { + return request({ + url: 'maintain/add', + method: 'post', + params + }) +} +// 删除 +export function delRecord(id) { + return request({ + url: 'maintain/delete', + method: 'post', + params: { + id: id + } + }) +} diff --git a/src/api/system/statistics.js b/src/api/system/statistics.js new file mode 100644 index 0000000..b25efe9 --- /dev/null +++ b/src/api/system/statistics.js @@ -0,0 +1,23 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +// import qs from 'qs' + +// +export function countByToilet(params) { + return request({ + url: '/sanitation/toiletStatistic/jobStaticByToilet', + method: 'get', + params + }) +} + +export function countByDay(params) { + return request({ + url: '/sanitation/toiletStatistic/jobStaticByDate', + method: 'get', + params + }) +} + diff --git a/src/assets/global_images/icon-position.png b/src/assets/global_images/icon-position.png new file mode 100644 index 0000000..7444038 --- /dev/null +++ b/src/assets/global_images/icon-position.png Binary files differ diff --git a/src/assets/global_images/location_green.png b/src/assets/global_images/location_green.png new file mode 100644 index 0000000..aa8be65 --- /dev/null +++ b/src/assets/global_images/location_green.png Binary files differ diff --git a/src/assets/global_images/location_red.png b/src/assets/global_images/location_red.png new file mode 100644 index 0000000..2be8c3d --- /dev/null +++ b/src/assets/global_images/location_red.png Binary files differ diff --git a/src/assets/global_images/location_yellow.png b/src/assets/global_images/location_yellow.png new file mode 100644 index 0000000..5ab6f4d --- /dev/null +++ b/src/assets/global_images/location_yellow.png Binary files differ diff --git a/src/assets/global_images/toilet-position.png b/src/assets/global_images/toilet-position.png new file mode 100644 index 0000000..7db6d9a --- /dev/null +++ b/src/assets/global_images/toilet-position.png Binary files differ diff --git a/src/assets/global_images/toilet.png b/src/assets/global_images/toilet.png new file mode 100644 index 0000000..6d9fc05 --- /dev/null +++ b/src/assets/global_images/toilet.png Binary files differ diff --git a/src/assets/global_images/toiletPhoto.png b/src/assets/global_images/toiletPhoto.png new file mode 100644 index 0000000..15d08e2 --- /dev/null +++ b/src/assets/global_images/toiletPhoto.png Binary files differ diff --git a/src/components/DownloadTemplate/index.vue b/src/components/DownloadTemplate/index.vue index 8ded2cd..7807cac 100644 --- a/src/components/DownloadTemplate/index.vue +++ b/src/components/DownloadTemplate/index.vue @@ -47,8 +47,8 @@ diff --git a/src/components/NormalTable/index.vue b/src/components/NormalTable/index.vue index 5077bef..04d322d 100644 --- a/src/components/NormalTable/index.vue +++ b/src/components/NormalTable/index.vue @@ -79,7 +79,7 @@ -
+
{ + return qs.stringify(params, { indices: false }) + } + }) +} + +// 公厕基本信息详情 +export function getToiletInfoDetail(id) { + return request({ + url: '/sanitation/toilet/detail?toiletId=' + id, + method: 'get' + }) +} + +// 某公厕保洁记录 +export function getRecordsByToilet(params) { + return request({ + url: '/sanitation/toilet/jobRecord/detail', + method: 'get', + params + }) +} + +// 某公厕平均评分 +export function getScoreByToilet(params) { + return request({ + url: '/sanitation/toiletEvaluation/detailScore', + method: 'get', + params + }) +} + +// 某公厕评分列表 +export function getScoreListByToilet(params) { + return request({ + url: '/sanitation/toiletEvaluation/list', + method: 'get', + params + }) +} + + +// 批量导入 +export function batchImportToilet(fileobj) { + const param = new FormData() + param.append('file', fileobj) + return request({ + url: '/sanitation/toilet/import', + method: 'post', + headers: { 'Content-Type': 'multipart/form-data' }, + data: param + }) +} +// 批量导出 +export function batchExportToilet(params, config) { + return request({ + url: '/sanitation/toilet/export', + method: 'get', + timeout: 120000, + params, + ...config, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 公厕保洁记录查询 +export function getToiletJobRecords(params) { + return request({ + url: '/sanitation/toilet/jobRecord', + method: 'get', + params + }) +} + +// 批量导出 +export function batchExportToiletJobRecords(params, config) { + return request({ + url: '/sanitation/toilet/exportJobRecord', + method: 'get', + timeout: 120000, + params, + ...config, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} diff --git a/src/api/system/alarm.js b/src/api/system/alarm.js new file mode 100644 index 0000000..1c3a7ab --- /dev/null +++ b/src/api/system/alarm.js @@ -0,0 +1,62 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' + +// 获取当前报警列表 +export function getAlarmNowList(params) { + return request({ + url: '/alarm/listNowPage', + method: 'get', + params + }) +} + +// 获取当前报警列表 +export function getAlarmHistoryList(params) { + return request({ + url: '/alarm/listHisPage', + method: 'get', + params + }) +} + + +// 批量消警 +export function clearAll(params) { + return request({ + url: '/alarm/allClear', + method: 'get', + params + }) +} + +// 消警 +export function clearAlarm(params) { + return request({ + url: '/alarm/cancel', + method: 'get', + params + }) +} + +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 设置报警阈值 +export function setThresh(params) { + return request({ + url: '/alarm/resetAlarmRule', + method: 'post', + params + }) +} diff --git a/src/api/system/bridge.js b/src/api/system/bridge.js new file mode 100644 index 0000000..e8a4108 --- /dev/null +++ b/src/api/system/bridge.js @@ -0,0 +1,80 @@ +/** + * 桥梁管理接口 + */ +import request from '@/utils/request' + +// 获取桥梁详情 +export function getDetail(id) { + return request({ + url: '/bridge/detail', + method: 'get', + params: { + id: id + } + }) +} + +export function updateBridge(params) { + return request({ + url: '/bridge/update', + method: 'post', + params + }) +} +// 批量导出 +export function exportRecords(params) { + return request({ + url: 'device/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +export function getContentList(params) { + return request({ + url: 'maintain/contentByType', + method: 'get', + params: { + type: params + } + }) +} +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 编辑 +export function editRecord(params) { + return request({ + url: 'maintain/update', + method: 'post', + params + }) +} +// 新增 +export function addRecord(params) { + return request({ + url: 'maintain/add', + method: 'post', + params + }) +} +// 删除 +export function delRecord(id) { + return request({ + url: 'maintain/delete', + method: 'post', + params: { + id: id + } + }) +} diff --git a/src/api/system/data.js b/src/api/system/data.js new file mode 100644 index 0000000..4c95db5 --- /dev/null +++ b/src/api/system/data.js @@ -0,0 +1,63 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' + +// 获取当前报警列表 +export function getHistoryList(params) { + return request({ + url: '/data/hisListPage', + method: 'get', + params + }) +} + +// 获取当前报警列表 +export function getHistory(params) { + return request({ + url: '/data/hisList', + method: 'get', + params + }) +} + + + +// 批量消警 +export function clearAll(params) { + return request({ + url: '/alarm/allClear', + method: 'get', + params + }) +} + +// 消警 +export function clearAlarm(params) { + return request({ + url: '/alarm/cancel', + method: 'get', + params + }) +} + +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 设置报警阈值 +export function setThresh(params) { + return request({ + url: '/alarm/resetAlarmRule', + method: 'post', + params + }) +} diff --git a/src/api/system/order.js b/src/api/system/order.js new file mode 100644 index 0000000..7007c50 --- /dev/null +++ b/src/api/system/order.js @@ -0,0 +1,71 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +// import qs from 'qs' + +// 获取当前报警列表 +export function getRecordList(params) { + return request({ + url: '/maintain/listPage', + method: 'get', + params + }) +} +// 批量导出 +export function exportRecords(params) { + return request({ + url: 'device/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +export function getContentList(params) { + return request({ + url: 'maintain/contentByType', + method: 'get', + params: { + type: params + } + }) +} +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 编辑 +export function editRecord(params) { + return request({ + url: 'maintain/update', + method: 'post', + params + }) +} +// 新增 +export function addRecord(params) { + return request({ + url: 'maintain/add', + method: 'post', + params + }) +} +// 删除 +export function delRecord(id) { + return request({ + url: 'maintain/delete', + method: 'post', + params: { + bridgeMaintenanceId: id + } + }) +} diff --git a/src/api/system/overview.js b/src/api/system/overview.js new file mode 100644 index 0000000..bca50cc --- /dev/null +++ b/src/api/system/overview.js @@ -0,0 +1,109 @@ +import request from '@/utils/request' +import qs from "qs" +import Vue from 'vue' + +// 路灯状态统计 +export function getLampStatus() { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampStatus', + method: 'get' + }) +} + +// 路灯总览列表 +export function getLampList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampList', + method: 'get', + params + }) +} + +// 路灯详情 +export function getlampDetail(lampId) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampDetail', + method: 'get', + params: { + lampId: lampId + } + }) +} + +// 回路列表 +export function getCircuitList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/circuitList', + method: 'get', + params + }) +} + +// 灯箱列表 +export function getLampBoxList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampBoxList', + method: 'get', + params + }) +} +// 灯箱详情 +export function getLampBoxDetail(lampBoxId) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampBoxDetail', + method: 'get', + params: { + lampBoxId: lampBoxId + } + }) +} + +// 报警总览列表 +export function getAlarmList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/alarmList', + method: 'get', + params + }) +} + +// 报警详情 +export function getAlarmDetail(alarmId) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/alarmDetail', + method: 'get', + params: { + alarmId: alarmId + } + }) +} + +// 路灯控制 +export function lampControl(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampControl', + method: 'post', + params, + paramsSerializer: params => { + return qs.stringify(params, { indices: false }) + } + }) +} diff --git a/src/api/system/rule.js b/src/api/system/rule.js new file mode 100644 index 0000000..76c6b2d --- /dev/null +++ b/src/api/system/rule.js @@ -0,0 +1,59 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +// import qs from 'qs' + +// 获取当前报警列表 +export function getRuleList() { + return request({ + url: 'rule/listPage', + method: 'get' + }) +} +export function getContentList(params) { + return request({ + url: 'maintain/contentByType', + method: 'get', + params: { + type: params + } + }) +} +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 编辑 +export function editRecord(params) { + return request({ + url: 'maintain/update', + method: 'post', + params + }) +} +// 新增 +export function addRecord(params) { + return request({ + url: 'maintain/add', + method: 'post', + params + }) +} +// 删除 +export function delRecord(id) { + return request({ + url: 'maintain/delete', + method: 'post', + params: { + id: id + } + }) +} diff --git a/src/api/system/statistics.js b/src/api/system/statistics.js new file mode 100644 index 0000000..b25efe9 --- /dev/null +++ b/src/api/system/statistics.js @@ -0,0 +1,23 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +// import qs from 'qs' + +// +export function countByToilet(params) { + return request({ + url: '/sanitation/toiletStatistic/jobStaticByToilet', + method: 'get', + params + }) +} + +export function countByDay(params) { + return request({ + url: '/sanitation/toiletStatistic/jobStaticByDate', + method: 'get', + params + }) +} + diff --git a/src/assets/global_images/icon-position.png b/src/assets/global_images/icon-position.png new file mode 100644 index 0000000..7444038 --- /dev/null +++ b/src/assets/global_images/icon-position.png Binary files differ diff --git a/src/assets/global_images/location_green.png b/src/assets/global_images/location_green.png new file mode 100644 index 0000000..aa8be65 --- /dev/null +++ b/src/assets/global_images/location_green.png Binary files differ diff --git a/src/assets/global_images/location_red.png b/src/assets/global_images/location_red.png new file mode 100644 index 0000000..2be8c3d --- /dev/null +++ b/src/assets/global_images/location_red.png Binary files differ diff --git a/src/assets/global_images/location_yellow.png b/src/assets/global_images/location_yellow.png new file mode 100644 index 0000000..5ab6f4d --- /dev/null +++ b/src/assets/global_images/location_yellow.png Binary files differ diff --git a/src/assets/global_images/toilet-position.png b/src/assets/global_images/toilet-position.png new file mode 100644 index 0000000..7db6d9a --- /dev/null +++ b/src/assets/global_images/toilet-position.png Binary files differ diff --git a/src/assets/global_images/toilet.png b/src/assets/global_images/toilet.png new file mode 100644 index 0000000..6d9fc05 --- /dev/null +++ b/src/assets/global_images/toilet.png Binary files differ diff --git a/src/assets/global_images/toiletPhoto.png b/src/assets/global_images/toiletPhoto.png new file mode 100644 index 0000000..15d08e2 --- /dev/null +++ b/src/assets/global_images/toiletPhoto.png Binary files differ diff --git a/src/components/DownloadTemplate/index.vue b/src/components/DownloadTemplate/index.vue index 8ded2cd..7807cac 100644 --- a/src/components/DownloadTemplate/index.vue +++ b/src/components/DownloadTemplate/index.vue @@ -47,8 +47,8 @@ diff --git a/src/components/NormalTable/index.vue b/src/components/NormalTable/index.vue index 5077bef..04d322d 100644 --- a/src/components/NormalTable/index.vue +++ b/src/components/NormalTable/index.vue @@ -79,7 +79,7 @@
-
+
{ + return qs.stringify(params, { indices: false }) + } + }) +} + +// 公厕基本信息详情 +export function getToiletInfoDetail(id) { + return request({ + url: '/sanitation/toilet/detail?toiletId=' + id, + method: 'get' + }) +} + +// 某公厕保洁记录 +export function getRecordsByToilet(params) { + return request({ + url: '/sanitation/toilet/jobRecord/detail', + method: 'get', + params + }) +} + +// 某公厕平均评分 +export function getScoreByToilet(params) { + return request({ + url: '/sanitation/toiletEvaluation/detailScore', + method: 'get', + params + }) +} + +// 某公厕评分列表 +export function getScoreListByToilet(params) { + return request({ + url: '/sanitation/toiletEvaluation/list', + method: 'get', + params + }) +} + + +// 批量导入 +export function batchImportToilet(fileobj) { + const param = new FormData() + param.append('file', fileobj) + return request({ + url: '/sanitation/toilet/import', + method: 'post', + headers: { 'Content-Type': 'multipart/form-data' }, + data: param + }) +} +// 批量导出 +export function batchExportToilet(params, config) { + return request({ + url: '/sanitation/toilet/export', + method: 'get', + timeout: 120000, + params, + ...config, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 公厕保洁记录查询 +export function getToiletJobRecords(params) { + return request({ + url: '/sanitation/toilet/jobRecord', + method: 'get', + params + }) +} + +// 批量导出 +export function batchExportToiletJobRecords(params, config) { + return request({ + url: '/sanitation/toilet/exportJobRecord', + method: 'get', + timeout: 120000, + params, + ...config, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} diff --git a/src/api/system/alarm.js b/src/api/system/alarm.js new file mode 100644 index 0000000..1c3a7ab --- /dev/null +++ b/src/api/system/alarm.js @@ -0,0 +1,62 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' + +// 获取当前报警列表 +export function getAlarmNowList(params) { + return request({ + url: '/alarm/listNowPage', + method: 'get', + params + }) +} + +// 获取当前报警列表 +export function getAlarmHistoryList(params) { + return request({ + url: '/alarm/listHisPage', + method: 'get', + params + }) +} + + +// 批量消警 +export function clearAll(params) { + return request({ + url: '/alarm/allClear', + method: 'get', + params + }) +} + +// 消警 +export function clearAlarm(params) { + return request({ + url: '/alarm/cancel', + method: 'get', + params + }) +} + +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 设置报警阈值 +export function setThresh(params) { + return request({ + url: '/alarm/resetAlarmRule', + method: 'post', + params + }) +} diff --git a/src/api/system/bridge.js b/src/api/system/bridge.js new file mode 100644 index 0000000..e8a4108 --- /dev/null +++ b/src/api/system/bridge.js @@ -0,0 +1,80 @@ +/** + * 桥梁管理接口 + */ +import request from '@/utils/request' + +// 获取桥梁详情 +export function getDetail(id) { + return request({ + url: '/bridge/detail', + method: 'get', + params: { + id: id + } + }) +} + +export function updateBridge(params) { + return request({ + url: '/bridge/update', + method: 'post', + params + }) +} +// 批量导出 +export function exportRecords(params) { + return request({ + url: 'device/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +export function getContentList(params) { + return request({ + url: 'maintain/contentByType', + method: 'get', + params: { + type: params + } + }) +} +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 编辑 +export function editRecord(params) { + return request({ + url: 'maintain/update', + method: 'post', + params + }) +} +// 新增 +export function addRecord(params) { + return request({ + url: 'maintain/add', + method: 'post', + params + }) +} +// 删除 +export function delRecord(id) { + return request({ + url: 'maintain/delete', + method: 'post', + params: { + id: id + } + }) +} diff --git a/src/api/system/data.js b/src/api/system/data.js new file mode 100644 index 0000000..4c95db5 --- /dev/null +++ b/src/api/system/data.js @@ -0,0 +1,63 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' + +// 获取当前报警列表 +export function getHistoryList(params) { + return request({ + url: '/data/hisListPage', + method: 'get', + params + }) +} + +// 获取当前报警列表 +export function getHistory(params) { + return request({ + url: '/data/hisList', + method: 'get', + params + }) +} + + + +// 批量消警 +export function clearAll(params) { + return request({ + url: '/alarm/allClear', + method: 'get', + params + }) +} + +// 消警 +export function clearAlarm(params) { + return request({ + url: '/alarm/cancel', + method: 'get', + params + }) +} + +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 设置报警阈值 +export function setThresh(params) { + return request({ + url: '/alarm/resetAlarmRule', + method: 'post', + params + }) +} diff --git a/src/api/system/order.js b/src/api/system/order.js new file mode 100644 index 0000000..7007c50 --- /dev/null +++ b/src/api/system/order.js @@ -0,0 +1,71 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +// import qs from 'qs' + +// 获取当前报警列表 +export function getRecordList(params) { + return request({ + url: '/maintain/listPage', + method: 'get', + params + }) +} +// 批量导出 +export function exportRecords(params) { + return request({ + url: 'device/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +export function getContentList(params) { + return request({ + url: 'maintain/contentByType', + method: 'get', + params: { + type: params + } + }) +} +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 编辑 +export function editRecord(params) { + return request({ + url: 'maintain/update', + method: 'post', + params + }) +} +// 新增 +export function addRecord(params) { + return request({ + url: 'maintain/add', + method: 'post', + params + }) +} +// 删除 +export function delRecord(id) { + return request({ + url: 'maintain/delete', + method: 'post', + params: { + bridgeMaintenanceId: id + } + }) +} diff --git a/src/api/system/overview.js b/src/api/system/overview.js new file mode 100644 index 0000000..bca50cc --- /dev/null +++ b/src/api/system/overview.js @@ -0,0 +1,109 @@ +import request from '@/utils/request' +import qs from "qs" +import Vue from 'vue' + +// 路灯状态统计 +export function getLampStatus() { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampStatus', + method: 'get' + }) +} + +// 路灯总览列表 +export function getLampList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampList', + method: 'get', + params + }) +} + +// 路灯详情 +export function getlampDetail(lampId) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampDetail', + method: 'get', + params: { + lampId: lampId + } + }) +} + +// 回路列表 +export function getCircuitList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/circuitList', + method: 'get', + params + }) +} + +// 灯箱列表 +export function getLampBoxList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampBoxList', + method: 'get', + params + }) +} +// 灯箱详情 +export function getLampBoxDetail(lampBoxId) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampBoxDetail', + method: 'get', + params: { + lampBoxId: lampBoxId + } + }) +} + +// 报警总览列表 +export function getAlarmList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/alarmList', + method: 'get', + params + }) +} + +// 报警详情 +export function getAlarmDetail(alarmId) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/alarmDetail', + method: 'get', + params: { + alarmId: alarmId + } + }) +} + +// 路灯控制 +export function lampControl(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampControl', + method: 'post', + params, + paramsSerializer: params => { + return qs.stringify(params, { indices: false }) + } + }) +} diff --git a/src/api/system/rule.js b/src/api/system/rule.js new file mode 100644 index 0000000..76c6b2d --- /dev/null +++ b/src/api/system/rule.js @@ -0,0 +1,59 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +// import qs from 'qs' + +// 获取当前报警列表 +export function getRuleList() { + return request({ + url: 'rule/listPage', + method: 'get' + }) +} +export function getContentList(params) { + return request({ + url: 'maintain/contentByType', + method: 'get', + params: { + type: params + } + }) +} +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 编辑 +export function editRecord(params) { + return request({ + url: 'maintain/update', + method: 'post', + params + }) +} +// 新增 +export function addRecord(params) { + return request({ + url: 'maintain/add', + method: 'post', + params + }) +} +// 删除 +export function delRecord(id) { + return request({ + url: 'maintain/delete', + method: 'post', + params: { + id: id + } + }) +} diff --git a/src/api/system/statistics.js b/src/api/system/statistics.js new file mode 100644 index 0000000..b25efe9 --- /dev/null +++ b/src/api/system/statistics.js @@ -0,0 +1,23 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +// import qs from 'qs' + +// +export function countByToilet(params) { + return request({ + url: '/sanitation/toiletStatistic/jobStaticByToilet', + method: 'get', + params + }) +} + +export function countByDay(params) { + return request({ + url: '/sanitation/toiletStatistic/jobStaticByDate', + method: 'get', + params + }) +} + diff --git a/src/assets/global_images/icon-position.png b/src/assets/global_images/icon-position.png new file mode 100644 index 0000000..7444038 --- /dev/null +++ b/src/assets/global_images/icon-position.png Binary files differ diff --git a/src/assets/global_images/location_green.png b/src/assets/global_images/location_green.png new file mode 100644 index 0000000..aa8be65 --- /dev/null +++ b/src/assets/global_images/location_green.png Binary files differ diff --git a/src/assets/global_images/location_red.png b/src/assets/global_images/location_red.png new file mode 100644 index 0000000..2be8c3d --- /dev/null +++ b/src/assets/global_images/location_red.png Binary files differ diff --git a/src/assets/global_images/location_yellow.png b/src/assets/global_images/location_yellow.png new file mode 100644 index 0000000..5ab6f4d --- /dev/null +++ b/src/assets/global_images/location_yellow.png Binary files differ diff --git a/src/assets/global_images/toilet-position.png b/src/assets/global_images/toilet-position.png new file mode 100644 index 0000000..7db6d9a --- /dev/null +++ b/src/assets/global_images/toilet-position.png Binary files differ diff --git a/src/assets/global_images/toilet.png b/src/assets/global_images/toilet.png new file mode 100644 index 0000000..6d9fc05 --- /dev/null +++ b/src/assets/global_images/toilet.png Binary files differ diff --git a/src/assets/global_images/toiletPhoto.png b/src/assets/global_images/toiletPhoto.png new file mode 100644 index 0000000..15d08e2 --- /dev/null +++ b/src/assets/global_images/toiletPhoto.png Binary files differ diff --git a/src/components/DownloadTemplate/index.vue b/src/components/DownloadTemplate/index.vue index 8ded2cd..7807cac 100644 --- a/src/components/DownloadTemplate/index.vue +++ b/src/components/DownloadTemplate/index.vue @@ -47,8 +47,8 @@ diff --git a/src/components/NormalTable/index.vue b/src/components/NormalTable/index.vue index 5077bef..04d322d 100644 --- a/src/components/NormalTable/index.vue +++ b/src/components/NormalTable/index.vue @@ -79,7 +79,7 @@
-
+
Object.assign(obj, { [key]: this[key] }), {}), + on: events.reduce((obj, key) => Object.assign(obj, { [key]: this.transmitEvent }), {}) + }) + } + this.props = [...extraProps, ...props.filter(prop => exceptProps.indexOf(prop))] + } +} + +export default prop => new Mixin(prop) diff --git a/config/index.js b/config/index.js index 8abd37a..19b33b1 100644 --- a/config/index.js +++ b/config/index.js @@ -69,7 +69,7 @@ * then assetsPublicPath should be set to "/bar/". * In most cases please use '/' !!! */ - assetsPublicPath: '/', + assetsPublicPath: '/toilet/', /** * Source Maps diff --git a/package.json b/package.json index 45f055f..9f3a3eb 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "echarts": "^4.2.1", "element-ui": "2.13.0", "event-source-polyfill": "^1.0.5", + "file-saver": "^2.0.5", "js-cookie": "2.2.0", "jsencrypt": "^3.0.0-rc.1", "leaflet": "^1.7.1", @@ -33,7 +34,9 @@ "vue-amap": "^0.5.9", "vue-baidu-map": "^0.21.22", "vue-router": "3.0.1", - "vuex": "3.0.1" + "vue2-leaflet": "^2.7.0", + "vuex": "3.0.1", + "xlsx": "^0.17.0" }, "devDependencies": { "autoprefixer": "8.5.0", diff --git a/src/api/common.js b/src/api/common.js index 87c582b..7804714 100644 --- a/src/api/common.js +++ b/src/api/common.js @@ -2,10 +2,14 @@ * 常用接口 */ import request from '@/utils/request' +import Vue from 'vue' + // 模板下载 export function downloadTemplate(fileName) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath return request({ - url: 'template/download', + url: lampPath + 'template/download', method: 'get', params: { filename: fileName @@ -19,7 +23,7 @@ const param = new FormData() param.append('file', fileobj.file) return request({ - url: 'imageUpload', + url: 'fileUpload', method: 'post', headers: { 'Content-Type': 'multipart/form-data' }, data: param diff --git a/src/api/sanitation/statistics.js b/src/api/sanitation/statistics.js new file mode 100644 index 0000000..ffeac18 --- /dev/null +++ b/src/api/sanitation/statistics.js @@ -0,0 +1,22 @@ + +/** + * 考核统计接口 + */ +import request from '@/utils/request' +// 公厕保洁次数统计 +export function getToiletJobCount(params) { + return request({ + url: '/sanitation/statistic/toilet/jobCount', + method: 'get', + params + }) +} + +// 公厕评分统计 +export function getToiletEvaluation(params) { + return request({ + url: '/sanitation/toiletEvaluation/statistics', + method: 'get', + params + }) +} diff --git a/src/api/sanitation/toilet.js b/src/api/sanitation/toilet.js new file mode 100644 index 0000000..11affd4 --- /dev/null +++ b/src/api/sanitation/toilet.js @@ -0,0 +1,133 @@ +/** + * 公厕管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' +// 公厕查询 +export function getToiletListPage(params) { + return request({ + url: '/sanitation/toilet/listPage', + method: 'get', + params + }) +} +// 公厕查询 +export function getToiletList(pid) { + return request({ + url: '/sanitation/toilet/list', + method: 'get', + params: { + pid: pid + } + }) +} + +// 添加公厕 +export function addToilet(params) { + return request({ + url: '/sanitation/toilet/add', + method: 'post', + params + }) +} +// 修改公厕机构 +export function updateToilet(params) { + return request({ + url: '/sanitation/toilet/update', + method: 'post', + params + }) +} +// 删除公厕机构 +export function delToilet(ids) { + return request({ + url: '/sanitation/toilet/delete', + method: 'post', + params: { + ids + }, + paramsSerializer: params => { + return qs.stringify(params, { indices: false }) + } + }) +} + +// 公厕基本信息详情 +export function getToiletInfoDetail(id) { + return request({ + url: '/sanitation/toilet/detail?toiletId=' + id, + method: 'get' + }) +} + +// 某公厕保洁记录 +export function getRecordsByToilet(params) { + return request({ + url: '/sanitation/toilet/jobRecord/detail', + method: 'get', + params + }) +} + +// 某公厕平均评分 +export function getScoreByToilet(params) { + return request({ + url: '/sanitation/toiletEvaluation/detailScore', + method: 'get', + params + }) +} + +// 某公厕评分列表 +export function getScoreListByToilet(params) { + return request({ + url: '/sanitation/toiletEvaluation/list', + method: 'get', + params + }) +} + + +// 批量导入 +export function batchImportToilet(fileobj) { + const param = new FormData() + param.append('file', fileobj) + return request({ + url: '/sanitation/toilet/import', + method: 'post', + headers: { 'Content-Type': 'multipart/form-data' }, + data: param + }) +} +// 批量导出 +export function batchExportToilet(params, config) { + return request({ + url: '/sanitation/toilet/export', + method: 'get', + timeout: 120000, + params, + ...config, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 公厕保洁记录查询 +export function getToiletJobRecords(params) { + return request({ + url: '/sanitation/toilet/jobRecord', + method: 'get', + params + }) +} + +// 批量导出 +export function batchExportToiletJobRecords(params, config) { + return request({ + url: '/sanitation/toilet/exportJobRecord', + method: 'get', + timeout: 120000, + params, + ...config, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} diff --git a/src/api/system/alarm.js b/src/api/system/alarm.js new file mode 100644 index 0000000..1c3a7ab --- /dev/null +++ b/src/api/system/alarm.js @@ -0,0 +1,62 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' + +// 获取当前报警列表 +export function getAlarmNowList(params) { + return request({ + url: '/alarm/listNowPage', + method: 'get', + params + }) +} + +// 获取当前报警列表 +export function getAlarmHistoryList(params) { + return request({ + url: '/alarm/listHisPage', + method: 'get', + params + }) +} + + +// 批量消警 +export function clearAll(params) { + return request({ + url: '/alarm/allClear', + method: 'get', + params + }) +} + +// 消警 +export function clearAlarm(params) { + return request({ + url: '/alarm/cancel', + method: 'get', + params + }) +} + +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 设置报警阈值 +export function setThresh(params) { + return request({ + url: '/alarm/resetAlarmRule', + method: 'post', + params + }) +} diff --git a/src/api/system/bridge.js b/src/api/system/bridge.js new file mode 100644 index 0000000..e8a4108 --- /dev/null +++ b/src/api/system/bridge.js @@ -0,0 +1,80 @@ +/** + * 桥梁管理接口 + */ +import request from '@/utils/request' + +// 获取桥梁详情 +export function getDetail(id) { + return request({ + url: '/bridge/detail', + method: 'get', + params: { + id: id + } + }) +} + +export function updateBridge(params) { + return request({ + url: '/bridge/update', + method: 'post', + params + }) +} +// 批量导出 +export function exportRecords(params) { + return request({ + url: 'device/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +export function getContentList(params) { + return request({ + url: 'maintain/contentByType', + method: 'get', + params: { + type: params + } + }) +} +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 编辑 +export function editRecord(params) { + return request({ + url: 'maintain/update', + method: 'post', + params + }) +} +// 新增 +export function addRecord(params) { + return request({ + url: 'maintain/add', + method: 'post', + params + }) +} +// 删除 +export function delRecord(id) { + return request({ + url: 'maintain/delete', + method: 'post', + params: { + id: id + } + }) +} diff --git a/src/api/system/data.js b/src/api/system/data.js new file mode 100644 index 0000000..4c95db5 --- /dev/null +++ b/src/api/system/data.js @@ -0,0 +1,63 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' + +// 获取当前报警列表 +export function getHistoryList(params) { + return request({ + url: '/data/hisListPage', + method: 'get', + params + }) +} + +// 获取当前报警列表 +export function getHistory(params) { + return request({ + url: '/data/hisList', + method: 'get', + params + }) +} + + + +// 批量消警 +export function clearAll(params) { + return request({ + url: '/alarm/allClear', + method: 'get', + params + }) +} + +// 消警 +export function clearAlarm(params) { + return request({ + url: '/alarm/cancel', + method: 'get', + params + }) +} + +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 设置报警阈值 +export function setThresh(params) { + return request({ + url: '/alarm/resetAlarmRule', + method: 'post', + params + }) +} diff --git a/src/api/system/order.js b/src/api/system/order.js new file mode 100644 index 0000000..7007c50 --- /dev/null +++ b/src/api/system/order.js @@ -0,0 +1,71 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +// import qs from 'qs' + +// 获取当前报警列表 +export function getRecordList(params) { + return request({ + url: '/maintain/listPage', + method: 'get', + params + }) +} +// 批量导出 +export function exportRecords(params) { + return request({ + url: 'device/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +export function getContentList(params) { + return request({ + url: 'maintain/contentByType', + method: 'get', + params: { + type: params + } + }) +} +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 编辑 +export function editRecord(params) { + return request({ + url: 'maintain/update', + method: 'post', + params + }) +} +// 新增 +export function addRecord(params) { + return request({ + url: 'maintain/add', + method: 'post', + params + }) +} +// 删除 +export function delRecord(id) { + return request({ + url: 'maintain/delete', + method: 'post', + params: { + bridgeMaintenanceId: id + } + }) +} diff --git a/src/api/system/overview.js b/src/api/system/overview.js new file mode 100644 index 0000000..bca50cc --- /dev/null +++ b/src/api/system/overview.js @@ -0,0 +1,109 @@ +import request from '@/utils/request' +import qs from "qs" +import Vue from 'vue' + +// 路灯状态统计 +export function getLampStatus() { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampStatus', + method: 'get' + }) +} + +// 路灯总览列表 +export function getLampList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampList', + method: 'get', + params + }) +} + +// 路灯详情 +export function getlampDetail(lampId) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampDetail', + method: 'get', + params: { + lampId: lampId + } + }) +} + +// 回路列表 +export function getCircuitList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/circuitList', + method: 'get', + params + }) +} + +// 灯箱列表 +export function getLampBoxList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampBoxList', + method: 'get', + params + }) +} +// 灯箱详情 +export function getLampBoxDetail(lampBoxId) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampBoxDetail', + method: 'get', + params: { + lampBoxId: lampBoxId + } + }) +} + +// 报警总览列表 +export function getAlarmList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/alarmList', + method: 'get', + params + }) +} + +// 报警详情 +export function getAlarmDetail(alarmId) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/alarmDetail', + method: 'get', + params: { + alarmId: alarmId + } + }) +} + +// 路灯控制 +export function lampControl(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampControl', + method: 'post', + params, + paramsSerializer: params => { + return qs.stringify(params, { indices: false }) + } + }) +} diff --git a/src/api/system/rule.js b/src/api/system/rule.js new file mode 100644 index 0000000..76c6b2d --- /dev/null +++ b/src/api/system/rule.js @@ -0,0 +1,59 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +// import qs from 'qs' + +// 获取当前报警列表 +export function getRuleList() { + return request({ + url: 'rule/listPage', + method: 'get' + }) +} +export function getContentList(params) { + return request({ + url: 'maintain/contentByType', + method: 'get', + params: { + type: params + } + }) +} +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 编辑 +export function editRecord(params) { + return request({ + url: 'maintain/update', + method: 'post', + params + }) +} +// 新增 +export function addRecord(params) { + return request({ + url: 'maintain/add', + method: 'post', + params + }) +} +// 删除 +export function delRecord(id) { + return request({ + url: 'maintain/delete', + method: 'post', + params: { + id: id + } + }) +} diff --git a/src/api/system/statistics.js b/src/api/system/statistics.js new file mode 100644 index 0000000..b25efe9 --- /dev/null +++ b/src/api/system/statistics.js @@ -0,0 +1,23 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +// import qs from 'qs' + +// +export function countByToilet(params) { + return request({ + url: '/sanitation/toiletStatistic/jobStaticByToilet', + method: 'get', + params + }) +} + +export function countByDay(params) { + return request({ + url: '/sanitation/toiletStatistic/jobStaticByDate', + method: 'get', + params + }) +} + diff --git a/src/assets/global_images/icon-position.png b/src/assets/global_images/icon-position.png new file mode 100644 index 0000000..7444038 --- /dev/null +++ b/src/assets/global_images/icon-position.png Binary files differ diff --git a/src/assets/global_images/location_green.png b/src/assets/global_images/location_green.png new file mode 100644 index 0000000..aa8be65 --- /dev/null +++ b/src/assets/global_images/location_green.png Binary files differ diff --git a/src/assets/global_images/location_red.png b/src/assets/global_images/location_red.png new file mode 100644 index 0000000..2be8c3d --- /dev/null +++ b/src/assets/global_images/location_red.png Binary files differ diff --git a/src/assets/global_images/location_yellow.png b/src/assets/global_images/location_yellow.png new file mode 100644 index 0000000..5ab6f4d --- /dev/null +++ b/src/assets/global_images/location_yellow.png Binary files differ diff --git a/src/assets/global_images/toilet-position.png b/src/assets/global_images/toilet-position.png new file mode 100644 index 0000000..7db6d9a --- /dev/null +++ b/src/assets/global_images/toilet-position.png Binary files differ diff --git a/src/assets/global_images/toilet.png b/src/assets/global_images/toilet.png new file mode 100644 index 0000000..6d9fc05 --- /dev/null +++ b/src/assets/global_images/toilet.png Binary files differ diff --git a/src/assets/global_images/toiletPhoto.png b/src/assets/global_images/toiletPhoto.png new file mode 100644 index 0000000..15d08e2 --- /dev/null +++ b/src/assets/global_images/toiletPhoto.png Binary files differ diff --git a/src/components/DownloadTemplate/index.vue b/src/components/DownloadTemplate/index.vue index 8ded2cd..7807cac 100644 --- a/src/components/DownloadTemplate/index.vue +++ b/src/components/DownloadTemplate/index.vue @@ -47,8 +47,8 @@ diff --git a/src/components/NormalTable/index.vue b/src/components/NormalTable/index.vue index 5077bef..04d322d 100644 --- a/src/components/NormalTable/index.vue +++ b/src/components/NormalTable/index.vue @@ -79,7 +79,7 @@
-
+
Object.assign(obj, { [key]: this[key] }), {}), + on: events.reduce((obj, key) => Object.assign(obj, { [key]: this.transmitEvent }), {}) + }) + } + this.props = [...extraProps, ...props.filter(prop => exceptProps.indexOf(prop))] + } +} + +export default prop => new Mixin(prop) diff --git a/src/components/mapWindow/base/mixins/common.js b/src/components/mapWindow/base/mixins/common.js new file mode 100644 index 0000000..2fd1a28 --- /dev/null +++ b/src/components/mapWindow/base/mixins/common.js @@ -0,0 +1,82 @@ +const types = { + map: { + unload: 'clearMap' + }, + control: { + unload: 'removeControl' + }, + layer: { + unload: 'removeLayer' + }, + features: { + unload: 'removeFeatures' + }, + listener: { + unload: 'removeListener' + } +} + +const getParent = $component => ($component.abstract || $component.$el === $component.$children[0].$el) ? getParent($component.$parent) : $component + +function destroyInstance () { + const { unload, renderByParent, $parent } = this + if (renderByParent) { + $parent.reload() + } + unload() +} + +class Mixin { + constructor (prop) { + this.methods = { + ready () { + const $parent = getParent(this.$parent) + const map = this.map = $parent.map + this.load() + this.$emit('ready', { + map + }) + }, + transmitEvent (e) { + this.$emit(e.type.replace(/^on/, ''), e) + }, + reload () { + this && this.$nextTick(() => { + this.unload() + this.$nextTick(this.load) + }) + }, + unload () { + const { map, originInstance } = this + try { + switch (prop.type) { + case 'search': + return originInstance.clearResults() + case 'autoComplete': + case 'lushu': + return originInstance.dispose() + case 'markerClusterer': + return originInstance.clearMarkers() + default: + map[types[prop.type].unload](originInstance) + } + } catch (e) {} + } + } + this.computed = { + renderByParent () { + return this.$parent.preventChildrenRender + } + } + this.mounted = function () { + console.log('common mounted') + const $parent = getParent(this.$parent) + const map = $parent.map + const { ready } = this + console.log(map) + map ? ready() : $parent.$on('onload', ready) + } + } +} + +export default type => new Mixin({ type }) diff --git a/config/index.js b/config/index.js index 8abd37a..19b33b1 100644 --- a/config/index.js +++ b/config/index.js @@ -69,7 +69,7 @@ * then assetsPublicPath should be set to "/bar/". * In most cases please use '/' !!! */ - assetsPublicPath: '/', + assetsPublicPath: '/toilet/', /** * Source Maps diff --git a/package.json b/package.json index 45f055f..9f3a3eb 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "echarts": "^4.2.1", "element-ui": "2.13.0", "event-source-polyfill": "^1.0.5", + "file-saver": "^2.0.5", "js-cookie": "2.2.0", "jsencrypt": "^3.0.0-rc.1", "leaflet": "^1.7.1", @@ -33,7 +34,9 @@ "vue-amap": "^0.5.9", "vue-baidu-map": "^0.21.22", "vue-router": "3.0.1", - "vuex": "3.0.1" + "vue2-leaflet": "^2.7.0", + "vuex": "3.0.1", + "xlsx": "^0.17.0" }, "devDependencies": { "autoprefixer": "8.5.0", diff --git a/src/api/common.js b/src/api/common.js index 87c582b..7804714 100644 --- a/src/api/common.js +++ b/src/api/common.js @@ -2,10 +2,14 @@ * 常用接口 */ import request from '@/utils/request' +import Vue from 'vue' + // 模板下载 export function downloadTemplate(fileName) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath return request({ - url: 'template/download', + url: lampPath + 'template/download', method: 'get', params: { filename: fileName @@ -19,7 +23,7 @@ const param = new FormData() param.append('file', fileobj.file) return request({ - url: 'imageUpload', + url: 'fileUpload', method: 'post', headers: { 'Content-Type': 'multipart/form-data' }, data: param diff --git a/src/api/sanitation/statistics.js b/src/api/sanitation/statistics.js new file mode 100644 index 0000000..ffeac18 --- /dev/null +++ b/src/api/sanitation/statistics.js @@ -0,0 +1,22 @@ + +/** + * 考核统计接口 + */ +import request from '@/utils/request' +// 公厕保洁次数统计 +export function getToiletJobCount(params) { + return request({ + url: '/sanitation/statistic/toilet/jobCount', + method: 'get', + params + }) +} + +// 公厕评分统计 +export function getToiletEvaluation(params) { + return request({ + url: '/sanitation/toiletEvaluation/statistics', + method: 'get', + params + }) +} diff --git a/src/api/sanitation/toilet.js b/src/api/sanitation/toilet.js new file mode 100644 index 0000000..11affd4 --- /dev/null +++ b/src/api/sanitation/toilet.js @@ -0,0 +1,133 @@ +/** + * 公厕管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' +// 公厕查询 +export function getToiletListPage(params) { + return request({ + url: '/sanitation/toilet/listPage', + method: 'get', + params + }) +} +// 公厕查询 +export function getToiletList(pid) { + return request({ + url: '/sanitation/toilet/list', + method: 'get', + params: { + pid: pid + } + }) +} + +// 添加公厕 +export function addToilet(params) { + return request({ + url: '/sanitation/toilet/add', + method: 'post', + params + }) +} +// 修改公厕机构 +export function updateToilet(params) { + return request({ + url: '/sanitation/toilet/update', + method: 'post', + params + }) +} +// 删除公厕机构 +export function delToilet(ids) { + return request({ + url: '/sanitation/toilet/delete', + method: 'post', + params: { + ids + }, + paramsSerializer: params => { + return qs.stringify(params, { indices: false }) + } + }) +} + +// 公厕基本信息详情 +export function getToiletInfoDetail(id) { + return request({ + url: '/sanitation/toilet/detail?toiletId=' + id, + method: 'get' + }) +} + +// 某公厕保洁记录 +export function getRecordsByToilet(params) { + return request({ + url: '/sanitation/toilet/jobRecord/detail', + method: 'get', + params + }) +} + +// 某公厕平均评分 +export function getScoreByToilet(params) { + return request({ + url: '/sanitation/toiletEvaluation/detailScore', + method: 'get', + params + }) +} + +// 某公厕评分列表 +export function getScoreListByToilet(params) { + return request({ + url: '/sanitation/toiletEvaluation/list', + method: 'get', + params + }) +} + + +// 批量导入 +export function batchImportToilet(fileobj) { + const param = new FormData() + param.append('file', fileobj) + return request({ + url: '/sanitation/toilet/import', + method: 'post', + headers: { 'Content-Type': 'multipart/form-data' }, + data: param + }) +} +// 批量导出 +export function batchExportToilet(params, config) { + return request({ + url: '/sanitation/toilet/export', + method: 'get', + timeout: 120000, + params, + ...config, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 公厕保洁记录查询 +export function getToiletJobRecords(params) { + return request({ + url: '/sanitation/toilet/jobRecord', + method: 'get', + params + }) +} + +// 批量导出 +export function batchExportToiletJobRecords(params, config) { + return request({ + url: '/sanitation/toilet/exportJobRecord', + method: 'get', + timeout: 120000, + params, + ...config, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} diff --git a/src/api/system/alarm.js b/src/api/system/alarm.js new file mode 100644 index 0000000..1c3a7ab --- /dev/null +++ b/src/api/system/alarm.js @@ -0,0 +1,62 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' + +// 获取当前报警列表 +export function getAlarmNowList(params) { + return request({ + url: '/alarm/listNowPage', + method: 'get', + params + }) +} + +// 获取当前报警列表 +export function getAlarmHistoryList(params) { + return request({ + url: '/alarm/listHisPage', + method: 'get', + params + }) +} + + +// 批量消警 +export function clearAll(params) { + return request({ + url: '/alarm/allClear', + method: 'get', + params + }) +} + +// 消警 +export function clearAlarm(params) { + return request({ + url: '/alarm/cancel', + method: 'get', + params + }) +} + +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 设置报警阈值 +export function setThresh(params) { + return request({ + url: '/alarm/resetAlarmRule', + method: 'post', + params + }) +} diff --git a/src/api/system/bridge.js b/src/api/system/bridge.js new file mode 100644 index 0000000..e8a4108 --- /dev/null +++ b/src/api/system/bridge.js @@ -0,0 +1,80 @@ +/** + * 桥梁管理接口 + */ +import request from '@/utils/request' + +// 获取桥梁详情 +export function getDetail(id) { + return request({ + url: '/bridge/detail', + method: 'get', + params: { + id: id + } + }) +} + +export function updateBridge(params) { + return request({ + url: '/bridge/update', + method: 'post', + params + }) +} +// 批量导出 +export function exportRecords(params) { + return request({ + url: 'device/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +export function getContentList(params) { + return request({ + url: 'maintain/contentByType', + method: 'get', + params: { + type: params + } + }) +} +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 编辑 +export function editRecord(params) { + return request({ + url: 'maintain/update', + method: 'post', + params + }) +} +// 新增 +export function addRecord(params) { + return request({ + url: 'maintain/add', + method: 'post', + params + }) +} +// 删除 +export function delRecord(id) { + return request({ + url: 'maintain/delete', + method: 'post', + params: { + id: id + } + }) +} diff --git a/src/api/system/data.js b/src/api/system/data.js new file mode 100644 index 0000000..4c95db5 --- /dev/null +++ b/src/api/system/data.js @@ -0,0 +1,63 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' + +// 获取当前报警列表 +export function getHistoryList(params) { + return request({ + url: '/data/hisListPage', + method: 'get', + params + }) +} + +// 获取当前报警列表 +export function getHistory(params) { + return request({ + url: '/data/hisList', + method: 'get', + params + }) +} + + + +// 批量消警 +export function clearAll(params) { + return request({ + url: '/alarm/allClear', + method: 'get', + params + }) +} + +// 消警 +export function clearAlarm(params) { + return request({ + url: '/alarm/cancel', + method: 'get', + params + }) +} + +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 设置报警阈值 +export function setThresh(params) { + return request({ + url: '/alarm/resetAlarmRule', + method: 'post', + params + }) +} diff --git a/src/api/system/order.js b/src/api/system/order.js new file mode 100644 index 0000000..7007c50 --- /dev/null +++ b/src/api/system/order.js @@ -0,0 +1,71 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +// import qs from 'qs' + +// 获取当前报警列表 +export function getRecordList(params) { + return request({ + url: '/maintain/listPage', + method: 'get', + params + }) +} +// 批量导出 +export function exportRecords(params) { + return request({ + url: 'device/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +export function getContentList(params) { + return request({ + url: 'maintain/contentByType', + method: 'get', + params: { + type: params + } + }) +} +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 编辑 +export function editRecord(params) { + return request({ + url: 'maintain/update', + method: 'post', + params + }) +} +// 新增 +export function addRecord(params) { + return request({ + url: 'maintain/add', + method: 'post', + params + }) +} +// 删除 +export function delRecord(id) { + return request({ + url: 'maintain/delete', + method: 'post', + params: { + bridgeMaintenanceId: id + } + }) +} diff --git a/src/api/system/overview.js b/src/api/system/overview.js new file mode 100644 index 0000000..bca50cc --- /dev/null +++ b/src/api/system/overview.js @@ -0,0 +1,109 @@ +import request from '@/utils/request' +import qs from "qs" +import Vue from 'vue' + +// 路灯状态统计 +export function getLampStatus() { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampStatus', + method: 'get' + }) +} + +// 路灯总览列表 +export function getLampList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampList', + method: 'get', + params + }) +} + +// 路灯详情 +export function getlampDetail(lampId) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampDetail', + method: 'get', + params: { + lampId: lampId + } + }) +} + +// 回路列表 +export function getCircuitList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/circuitList', + method: 'get', + params + }) +} + +// 灯箱列表 +export function getLampBoxList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampBoxList', + method: 'get', + params + }) +} +// 灯箱详情 +export function getLampBoxDetail(lampBoxId) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampBoxDetail', + method: 'get', + params: { + lampBoxId: lampBoxId + } + }) +} + +// 报警总览列表 +export function getAlarmList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/alarmList', + method: 'get', + params + }) +} + +// 报警详情 +export function getAlarmDetail(alarmId) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/alarmDetail', + method: 'get', + params: { + alarmId: alarmId + } + }) +} + +// 路灯控制 +export function lampControl(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampControl', + method: 'post', + params, + paramsSerializer: params => { + return qs.stringify(params, { indices: false }) + } + }) +} diff --git a/src/api/system/rule.js b/src/api/system/rule.js new file mode 100644 index 0000000..76c6b2d --- /dev/null +++ b/src/api/system/rule.js @@ -0,0 +1,59 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +// import qs from 'qs' + +// 获取当前报警列表 +export function getRuleList() { + return request({ + url: 'rule/listPage', + method: 'get' + }) +} +export function getContentList(params) { + return request({ + url: 'maintain/contentByType', + method: 'get', + params: { + type: params + } + }) +} +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 编辑 +export function editRecord(params) { + return request({ + url: 'maintain/update', + method: 'post', + params + }) +} +// 新增 +export function addRecord(params) { + return request({ + url: 'maintain/add', + method: 'post', + params + }) +} +// 删除 +export function delRecord(id) { + return request({ + url: 'maintain/delete', + method: 'post', + params: { + id: id + } + }) +} diff --git a/src/api/system/statistics.js b/src/api/system/statistics.js new file mode 100644 index 0000000..b25efe9 --- /dev/null +++ b/src/api/system/statistics.js @@ -0,0 +1,23 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +// import qs from 'qs' + +// +export function countByToilet(params) { + return request({ + url: '/sanitation/toiletStatistic/jobStaticByToilet', + method: 'get', + params + }) +} + +export function countByDay(params) { + return request({ + url: '/sanitation/toiletStatistic/jobStaticByDate', + method: 'get', + params + }) +} + diff --git a/src/assets/global_images/icon-position.png b/src/assets/global_images/icon-position.png new file mode 100644 index 0000000..7444038 --- /dev/null +++ b/src/assets/global_images/icon-position.png Binary files differ diff --git a/src/assets/global_images/location_green.png b/src/assets/global_images/location_green.png new file mode 100644 index 0000000..aa8be65 --- /dev/null +++ b/src/assets/global_images/location_green.png Binary files differ diff --git a/src/assets/global_images/location_red.png b/src/assets/global_images/location_red.png new file mode 100644 index 0000000..2be8c3d --- /dev/null +++ b/src/assets/global_images/location_red.png Binary files differ diff --git a/src/assets/global_images/location_yellow.png b/src/assets/global_images/location_yellow.png new file mode 100644 index 0000000..5ab6f4d --- /dev/null +++ b/src/assets/global_images/location_yellow.png Binary files differ diff --git a/src/assets/global_images/toilet-position.png b/src/assets/global_images/toilet-position.png new file mode 100644 index 0000000..7db6d9a --- /dev/null +++ b/src/assets/global_images/toilet-position.png Binary files differ diff --git a/src/assets/global_images/toilet.png b/src/assets/global_images/toilet.png new file mode 100644 index 0000000..6d9fc05 --- /dev/null +++ b/src/assets/global_images/toilet.png Binary files differ diff --git a/src/assets/global_images/toiletPhoto.png b/src/assets/global_images/toiletPhoto.png new file mode 100644 index 0000000..15d08e2 --- /dev/null +++ b/src/assets/global_images/toiletPhoto.png Binary files differ diff --git a/src/components/DownloadTemplate/index.vue b/src/components/DownloadTemplate/index.vue index 8ded2cd..7807cac 100644 --- a/src/components/DownloadTemplate/index.vue +++ b/src/components/DownloadTemplate/index.vue @@ -47,8 +47,8 @@ diff --git a/src/components/NormalTable/index.vue b/src/components/NormalTable/index.vue index 5077bef..04d322d 100644 --- a/src/components/NormalTable/index.vue +++ b/src/components/NormalTable/index.vue @@ -79,7 +79,7 @@
-
+
Object.assign(obj, { [key]: this[key] }), {}), + on: events.reduce((obj, key) => Object.assign(obj, { [key]: this.transmitEvent }), {}) + }) + } + this.props = [...extraProps, ...props.filter(prop => exceptProps.indexOf(prop))] + } +} + +export default prop => new Mixin(prop) diff --git a/src/components/mapWindow/base/mixins/common.js b/src/components/mapWindow/base/mixins/common.js new file mode 100644 index 0000000..2fd1a28 --- /dev/null +++ b/src/components/mapWindow/base/mixins/common.js @@ -0,0 +1,82 @@ +const types = { + map: { + unload: 'clearMap' + }, + control: { + unload: 'removeControl' + }, + layer: { + unload: 'removeLayer' + }, + features: { + unload: 'removeFeatures' + }, + listener: { + unload: 'removeListener' + } +} + +const getParent = $component => ($component.abstract || $component.$el === $component.$children[0].$el) ? getParent($component.$parent) : $component + +function destroyInstance () { + const { unload, renderByParent, $parent } = this + if (renderByParent) { + $parent.reload() + } + unload() +} + +class Mixin { + constructor (prop) { + this.methods = { + ready () { + const $parent = getParent(this.$parent) + const map = this.map = $parent.map + this.load() + this.$emit('ready', { + map + }) + }, + transmitEvent (e) { + this.$emit(e.type.replace(/^on/, ''), e) + }, + reload () { + this && this.$nextTick(() => { + this.unload() + this.$nextTick(this.load) + }) + }, + unload () { + const { map, originInstance } = this + try { + switch (prop.type) { + case 'search': + return originInstance.clearResults() + case 'autoComplete': + case 'lushu': + return originInstance.dispose() + case 'markerClusterer': + return originInstance.clearMarkers() + default: + map[types[prop.type].unload](originInstance) + } + } catch (e) {} + } + } + this.computed = { + renderByParent () { + return this.$parent.preventChildrenRender + } + } + this.mounted = function () { + console.log('common mounted') + const $parent = getParent(this.$parent) + const map = $parent.map + const { ready } = this + console.log(map) + map ? ready() : $parent.$on('onload', ready) + } + } +} + +export default type => new Mixin({ type }) diff --git a/src/components/mapWindow/leafletMap.vue b/src/components/mapWindow/leafletMap.vue new file mode 100644 index 0000000..b753cc0 --- /dev/null +++ b/src/components/mapWindow/leafletMap.vue @@ -0,0 +1,143 @@ + + + + + + + diff --git a/config/index.js b/config/index.js index 8abd37a..19b33b1 100644 --- a/config/index.js +++ b/config/index.js @@ -69,7 +69,7 @@ * then assetsPublicPath should be set to "/bar/". * In most cases please use '/' !!! */ - assetsPublicPath: '/', + assetsPublicPath: '/toilet/', /** * Source Maps diff --git a/package.json b/package.json index 45f055f..9f3a3eb 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "echarts": "^4.2.1", "element-ui": "2.13.0", "event-source-polyfill": "^1.0.5", + "file-saver": "^2.0.5", "js-cookie": "2.2.0", "jsencrypt": "^3.0.0-rc.1", "leaflet": "^1.7.1", @@ -33,7 +34,9 @@ "vue-amap": "^0.5.9", "vue-baidu-map": "^0.21.22", "vue-router": "3.0.1", - "vuex": "3.0.1" + "vue2-leaflet": "^2.7.0", + "vuex": "3.0.1", + "xlsx": "^0.17.0" }, "devDependencies": { "autoprefixer": "8.5.0", diff --git a/src/api/common.js b/src/api/common.js index 87c582b..7804714 100644 --- a/src/api/common.js +++ b/src/api/common.js @@ -2,10 +2,14 @@ * 常用接口 */ import request from '@/utils/request' +import Vue from 'vue' + // 模板下载 export function downloadTemplate(fileName) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath return request({ - url: 'template/download', + url: lampPath + 'template/download', method: 'get', params: { filename: fileName @@ -19,7 +23,7 @@ const param = new FormData() param.append('file', fileobj.file) return request({ - url: 'imageUpload', + url: 'fileUpload', method: 'post', headers: { 'Content-Type': 'multipart/form-data' }, data: param diff --git a/src/api/sanitation/statistics.js b/src/api/sanitation/statistics.js new file mode 100644 index 0000000..ffeac18 --- /dev/null +++ b/src/api/sanitation/statistics.js @@ -0,0 +1,22 @@ + +/** + * 考核统计接口 + */ +import request from '@/utils/request' +// 公厕保洁次数统计 +export function getToiletJobCount(params) { + return request({ + url: '/sanitation/statistic/toilet/jobCount', + method: 'get', + params + }) +} + +// 公厕评分统计 +export function getToiletEvaluation(params) { + return request({ + url: '/sanitation/toiletEvaluation/statistics', + method: 'get', + params + }) +} diff --git a/src/api/sanitation/toilet.js b/src/api/sanitation/toilet.js new file mode 100644 index 0000000..11affd4 --- /dev/null +++ b/src/api/sanitation/toilet.js @@ -0,0 +1,133 @@ +/** + * 公厕管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' +// 公厕查询 +export function getToiletListPage(params) { + return request({ + url: '/sanitation/toilet/listPage', + method: 'get', + params + }) +} +// 公厕查询 +export function getToiletList(pid) { + return request({ + url: '/sanitation/toilet/list', + method: 'get', + params: { + pid: pid + } + }) +} + +// 添加公厕 +export function addToilet(params) { + return request({ + url: '/sanitation/toilet/add', + method: 'post', + params + }) +} +// 修改公厕机构 +export function updateToilet(params) { + return request({ + url: '/sanitation/toilet/update', + method: 'post', + params + }) +} +// 删除公厕机构 +export function delToilet(ids) { + return request({ + url: '/sanitation/toilet/delete', + method: 'post', + params: { + ids + }, + paramsSerializer: params => { + return qs.stringify(params, { indices: false }) + } + }) +} + +// 公厕基本信息详情 +export function getToiletInfoDetail(id) { + return request({ + url: '/sanitation/toilet/detail?toiletId=' + id, + method: 'get' + }) +} + +// 某公厕保洁记录 +export function getRecordsByToilet(params) { + return request({ + url: '/sanitation/toilet/jobRecord/detail', + method: 'get', + params + }) +} + +// 某公厕平均评分 +export function getScoreByToilet(params) { + return request({ + url: '/sanitation/toiletEvaluation/detailScore', + method: 'get', + params + }) +} + +// 某公厕评分列表 +export function getScoreListByToilet(params) { + return request({ + url: '/sanitation/toiletEvaluation/list', + method: 'get', + params + }) +} + + +// 批量导入 +export function batchImportToilet(fileobj) { + const param = new FormData() + param.append('file', fileobj) + return request({ + url: '/sanitation/toilet/import', + method: 'post', + headers: { 'Content-Type': 'multipart/form-data' }, + data: param + }) +} +// 批量导出 +export function batchExportToilet(params, config) { + return request({ + url: '/sanitation/toilet/export', + method: 'get', + timeout: 120000, + params, + ...config, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 公厕保洁记录查询 +export function getToiletJobRecords(params) { + return request({ + url: '/sanitation/toilet/jobRecord', + method: 'get', + params + }) +} + +// 批量导出 +export function batchExportToiletJobRecords(params, config) { + return request({ + url: '/sanitation/toilet/exportJobRecord', + method: 'get', + timeout: 120000, + params, + ...config, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} diff --git a/src/api/system/alarm.js b/src/api/system/alarm.js new file mode 100644 index 0000000..1c3a7ab --- /dev/null +++ b/src/api/system/alarm.js @@ -0,0 +1,62 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' + +// 获取当前报警列表 +export function getAlarmNowList(params) { + return request({ + url: '/alarm/listNowPage', + method: 'get', + params + }) +} + +// 获取当前报警列表 +export function getAlarmHistoryList(params) { + return request({ + url: '/alarm/listHisPage', + method: 'get', + params + }) +} + + +// 批量消警 +export function clearAll(params) { + return request({ + url: '/alarm/allClear', + method: 'get', + params + }) +} + +// 消警 +export function clearAlarm(params) { + return request({ + url: '/alarm/cancel', + method: 'get', + params + }) +} + +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 设置报警阈值 +export function setThresh(params) { + return request({ + url: '/alarm/resetAlarmRule', + method: 'post', + params + }) +} diff --git a/src/api/system/bridge.js b/src/api/system/bridge.js new file mode 100644 index 0000000..e8a4108 --- /dev/null +++ b/src/api/system/bridge.js @@ -0,0 +1,80 @@ +/** + * 桥梁管理接口 + */ +import request from '@/utils/request' + +// 获取桥梁详情 +export function getDetail(id) { + return request({ + url: '/bridge/detail', + method: 'get', + params: { + id: id + } + }) +} + +export function updateBridge(params) { + return request({ + url: '/bridge/update', + method: 'post', + params + }) +} +// 批量导出 +export function exportRecords(params) { + return request({ + url: 'device/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +export function getContentList(params) { + return request({ + url: 'maintain/contentByType', + method: 'get', + params: { + type: params + } + }) +} +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 编辑 +export function editRecord(params) { + return request({ + url: 'maintain/update', + method: 'post', + params + }) +} +// 新增 +export function addRecord(params) { + return request({ + url: 'maintain/add', + method: 'post', + params + }) +} +// 删除 +export function delRecord(id) { + return request({ + url: 'maintain/delete', + method: 'post', + params: { + id: id + } + }) +} diff --git a/src/api/system/data.js b/src/api/system/data.js new file mode 100644 index 0000000..4c95db5 --- /dev/null +++ b/src/api/system/data.js @@ -0,0 +1,63 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' + +// 获取当前报警列表 +export function getHistoryList(params) { + return request({ + url: '/data/hisListPage', + method: 'get', + params + }) +} + +// 获取当前报警列表 +export function getHistory(params) { + return request({ + url: '/data/hisList', + method: 'get', + params + }) +} + + + +// 批量消警 +export function clearAll(params) { + return request({ + url: '/alarm/allClear', + method: 'get', + params + }) +} + +// 消警 +export function clearAlarm(params) { + return request({ + url: '/alarm/cancel', + method: 'get', + params + }) +} + +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 设置报警阈值 +export function setThresh(params) { + return request({ + url: '/alarm/resetAlarmRule', + method: 'post', + params + }) +} diff --git a/src/api/system/order.js b/src/api/system/order.js new file mode 100644 index 0000000..7007c50 --- /dev/null +++ b/src/api/system/order.js @@ -0,0 +1,71 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +// import qs from 'qs' + +// 获取当前报警列表 +export function getRecordList(params) { + return request({ + url: '/maintain/listPage', + method: 'get', + params + }) +} +// 批量导出 +export function exportRecords(params) { + return request({ + url: 'device/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +export function getContentList(params) { + return request({ + url: 'maintain/contentByType', + method: 'get', + params: { + type: params + } + }) +} +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 编辑 +export function editRecord(params) { + return request({ + url: 'maintain/update', + method: 'post', + params + }) +} +// 新增 +export function addRecord(params) { + return request({ + url: 'maintain/add', + method: 'post', + params + }) +} +// 删除 +export function delRecord(id) { + return request({ + url: 'maintain/delete', + method: 'post', + params: { + bridgeMaintenanceId: id + } + }) +} diff --git a/src/api/system/overview.js b/src/api/system/overview.js new file mode 100644 index 0000000..bca50cc --- /dev/null +++ b/src/api/system/overview.js @@ -0,0 +1,109 @@ +import request from '@/utils/request' +import qs from "qs" +import Vue from 'vue' + +// 路灯状态统计 +export function getLampStatus() { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampStatus', + method: 'get' + }) +} + +// 路灯总览列表 +export function getLampList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampList', + method: 'get', + params + }) +} + +// 路灯详情 +export function getlampDetail(lampId) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampDetail', + method: 'get', + params: { + lampId: lampId + } + }) +} + +// 回路列表 +export function getCircuitList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/circuitList', + method: 'get', + params + }) +} + +// 灯箱列表 +export function getLampBoxList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampBoxList', + method: 'get', + params + }) +} +// 灯箱详情 +export function getLampBoxDetail(lampBoxId) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampBoxDetail', + method: 'get', + params: { + lampBoxId: lampBoxId + } + }) +} + +// 报警总览列表 +export function getAlarmList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/alarmList', + method: 'get', + params + }) +} + +// 报警详情 +export function getAlarmDetail(alarmId) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/alarmDetail', + method: 'get', + params: { + alarmId: alarmId + } + }) +} + +// 路灯控制 +export function lampControl(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampControl', + method: 'post', + params, + paramsSerializer: params => { + return qs.stringify(params, { indices: false }) + } + }) +} diff --git a/src/api/system/rule.js b/src/api/system/rule.js new file mode 100644 index 0000000..76c6b2d --- /dev/null +++ b/src/api/system/rule.js @@ -0,0 +1,59 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +// import qs from 'qs' + +// 获取当前报警列表 +export function getRuleList() { + return request({ + url: 'rule/listPage', + method: 'get' + }) +} +export function getContentList(params) { + return request({ + url: 'maintain/contentByType', + method: 'get', + params: { + type: params + } + }) +} +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 编辑 +export function editRecord(params) { + return request({ + url: 'maintain/update', + method: 'post', + params + }) +} +// 新增 +export function addRecord(params) { + return request({ + url: 'maintain/add', + method: 'post', + params + }) +} +// 删除 +export function delRecord(id) { + return request({ + url: 'maintain/delete', + method: 'post', + params: { + id: id + } + }) +} diff --git a/src/api/system/statistics.js b/src/api/system/statistics.js new file mode 100644 index 0000000..b25efe9 --- /dev/null +++ b/src/api/system/statistics.js @@ -0,0 +1,23 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +// import qs from 'qs' + +// +export function countByToilet(params) { + return request({ + url: '/sanitation/toiletStatistic/jobStaticByToilet', + method: 'get', + params + }) +} + +export function countByDay(params) { + return request({ + url: '/sanitation/toiletStatistic/jobStaticByDate', + method: 'get', + params + }) +} + diff --git a/src/assets/global_images/icon-position.png b/src/assets/global_images/icon-position.png new file mode 100644 index 0000000..7444038 --- /dev/null +++ b/src/assets/global_images/icon-position.png Binary files differ diff --git a/src/assets/global_images/location_green.png b/src/assets/global_images/location_green.png new file mode 100644 index 0000000..aa8be65 --- /dev/null +++ b/src/assets/global_images/location_green.png Binary files differ diff --git a/src/assets/global_images/location_red.png b/src/assets/global_images/location_red.png new file mode 100644 index 0000000..2be8c3d --- /dev/null +++ b/src/assets/global_images/location_red.png Binary files differ diff --git a/src/assets/global_images/location_yellow.png b/src/assets/global_images/location_yellow.png new file mode 100644 index 0000000..5ab6f4d --- /dev/null +++ b/src/assets/global_images/location_yellow.png Binary files differ diff --git a/src/assets/global_images/toilet-position.png b/src/assets/global_images/toilet-position.png new file mode 100644 index 0000000..7db6d9a --- /dev/null +++ b/src/assets/global_images/toilet-position.png Binary files differ diff --git a/src/assets/global_images/toilet.png b/src/assets/global_images/toilet.png new file mode 100644 index 0000000..6d9fc05 --- /dev/null +++ b/src/assets/global_images/toilet.png Binary files differ diff --git a/src/assets/global_images/toiletPhoto.png b/src/assets/global_images/toiletPhoto.png new file mode 100644 index 0000000..15d08e2 --- /dev/null +++ b/src/assets/global_images/toiletPhoto.png Binary files differ diff --git a/src/components/DownloadTemplate/index.vue b/src/components/DownloadTemplate/index.vue index 8ded2cd..7807cac 100644 --- a/src/components/DownloadTemplate/index.vue +++ b/src/components/DownloadTemplate/index.vue @@ -47,8 +47,8 @@ diff --git a/src/components/NormalTable/index.vue b/src/components/NormalTable/index.vue index 5077bef..04d322d 100644 --- a/src/components/NormalTable/index.vue +++ b/src/components/NormalTable/index.vue @@ -79,7 +79,7 @@
-
+
Object.assign(obj, { [key]: this[key] }), {}), + on: events.reduce((obj, key) => Object.assign(obj, { [key]: this.transmitEvent }), {}) + }) + } + this.props = [...extraProps, ...props.filter(prop => exceptProps.indexOf(prop))] + } +} + +export default prop => new Mixin(prop) diff --git a/src/components/mapWindow/base/mixins/common.js b/src/components/mapWindow/base/mixins/common.js new file mode 100644 index 0000000..2fd1a28 --- /dev/null +++ b/src/components/mapWindow/base/mixins/common.js @@ -0,0 +1,82 @@ +const types = { + map: { + unload: 'clearMap' + }, + control: { + unload: 'removeControl' + }, + layer: { + unload: 'removeLayer' + }, + features: { + unload: 'removeFeatures' + }, + listener: { + unload: 'removeListener' + } +} + +const getParent = $component => ($component.abstract || $component.$el === $component.$children[0].$el) ? getParent($component.$parent) : $component + +function destroyInstance () { + const { unload, renderByParent, $parent } = this + if (renderByParent) { + $parent.reload() + } + unload() +} + +class Mixin { + constructor (prop) { + this.methods = { + ready () { + const $parent = getParent(this.$parent) + const map = this.map = $parent.map + this.load() + this.$emit('ready', { + map + }) + }, + transmitEvent (e) { + this.$emit(e.type.replace(/^on/, ''), e) + }, + reload () { + this && this.$nextTick(() => { + this.unload() + this.$nextTick(this.load) + }) + }, + unload () { + const { map, originInstance } = this + try { + switch (prop.type) { + case 'search': + return originInstance.clearResults() + case 'autoComplete': + case 'lushu': + return originInstance.dispose() + case 'markerClusterer': + return originInstance.clearMarkers() + default: + map[types[prop.type].unload](originInstance) + } + } catch (e) {} + } + } + this.computed = { + renderByParent () { + return this.$parent.preventChildrenRender + } + } + this.mounted = function () { + console.log('common mounted') + const $parent = getParent(this.$parent) + const map = $parent.map + const { ready } = this + console.log(map) + map ? ready() : $parent.$on('onload', ready) + } + } +} + +export default type => new Mixin({ type }) diff --git a/src/components/mapWindow/leafletMap.vue b/src/components/mapWindow/leafletMap.vue new file mode 100644 index 0000000..b753cc0 --- /dev/null +++ b/src/components/mapWindow/leafletMap.vue @@ -0,0 +1,143 @@ + + + + + + + diff --git a/src/components/mapWindow/mapWindow.vue b/src/components/mapWindow/mapWindow.vue new file mode 100644 index 0000000..9ced291 --- /dev/null +++ b/src/components/mapWindow/mapWindow.vue @@ -0,0 +1,46 @@ + + + + + + diff --git a/config/index.js b/config/index.js index 8abd37a..19b33b1 100644 --- a/config/index.js +++ b/config/index.js @@ -69,7 +69,7 @@ * then assetsPublicPath should be set to "/bar/". * In most cases please use '/' !!! */ - assetsPublicPath: '/', + assetsPublicPath: '/toilet/', /** * Source Maps diff --git a/package.json b/package.json index 45f055f..9f3a3eb 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "echarts": "^4.2.1", "element-ui": "2.13.0", "event-source-polyfill": "^1.0.5", + "file-saver": "^2.0.5", "js-cookie": "2.2.0", "jsencrypt": "^3.0.0-rc.1", "leaflet": "^1.7.1", @@ -33,7 +34,9 @@ "vue-amap": "^0.5.9", "vue-baidu-map": "^0.21.22", "vue-router": "3.0.1", - "vuex": "3.0.1" + "vue2-leaflet": "^2.7.0", + "vuex": "3.0.1", + "xlsx": "^0.17.0" }, "devDependencies": { "autoprefixer": "8.5.0", diff --git a/src/api/common.js b/src/api/common.js index 87c582b..7804714 100644 --- a/src/api/common.js +++ b/src/api/common.js @@ -2,10 +2,14 @@ * 常用接口 */ import request from '@/utils/request' +import Vue from 'vue' + // 模板下载 export function downloadTemplate(fileName) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath return request({ - url: 'template/download', + url: lampPath + 'template/download', method: 'get', params: { filename: fileName @@ -19,7 +23,7 @@ const param = new FormData() param.append('file', fileobj.file) return request({ - url: 'imageUpload', + url: 'fileUpload', method: 'post', headers: { 'Content-Type': 'multipart/form-data' }, data: param diff --git a/src/api/sanitation/statistics.js b/src/api/sanitation/statistics.js new file mode 100644 index 0000000..ffeac18 --- /dev/null +++ b/src/api/sanitation/statistics.js @@ -0,0 +1,22 @@ + +/** + * 考核统计接口 + */ +import request from '@/utils/request' +// 公厕保洁次数统计 +export function getToiletJobCount(params) { + return request({ + url: '/sanitation/statistic/toilet/jobCount', + method: 'get', + params + }) +} + +// 公厕评分统计 +export function getToiletEvaluation(params) { + return request({ + url: '/sanitation/toiletEvaluation/statistics', + method: 'get', + params + }) +} diff --git a/src/api/sanitation/toilet.js b/src/api/sanitation/toilet.js new file mode 100644 index 0000000..11affd4 --- /dev/null +++ b/src/api/sanitation/toilet.js @@ -0,0 +1,133 @@ +/** + * 公厕管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' +// 公厕查询 +export function getToiletListPage(params) { + return request({ + url: '/sanitation/toilet/listPage', + method: 'get', + params + }) +} +// 公厕查询 +export function getToiletList(pid) { + return request({ + url: '/sanitation/toilet/list', + method: 'get', + params: { + pid: pid + } + }) +} + +// 添加公厕 +export function addToilet(params) { + return request({ + url: '/sanitation/toilet/add', + method: 'post', + params + }) +} +// 修改公厕机构 +export function updateToilet(params) { + return request({ + url: '/sanitation/toilet/update', + method: 'post', + params + }) +} +// 删除公厕机构 +export function delToilet(ids) { + return request({ + url: '/sanitation/toilet/delete', + method: 'post', + params: { + ids + }, + paramsSerializer: params => { + return qs.stringify(params, { indices: false }) + } + }) +} + +// 公厕基本信息详情 +export function getToiletInfoDetail(id) { + return request({ + url: '/sanitation/toilet/detail?toiletId=' + id, + method: 'get' + }) +} + +// 某公厕保洁记录 +export function getRecordsByToilet(params) { + return request({ + url: '/sanitation/toilet/jobRecord/detail', + method: 'get', + params + }) +} + +// 某公厕平均评分 +export function getScoreByToilet(params) { + return request({ + url: '/sanitation/toiletEvaluation/detailScore', + method: 'get', + params + }) +} + +// 某公厕评分列表 +export function getScoreListByToilet(params) { + return request({ + url: '/sanitation/toiletEvaluation/list', + method: 'get', + params + }) +} + + +// 批量导入 +export function batchImportToilet(fileobj) { + const param = new FormData() + param.append('file', fileobj) + return request({ + url: '/sanitation/toilet/import', + method: 'post', + headers: { 'Content-Type': 'multipart/form-data' }, + data: param + }) +} +// 批量导出 +export function batchExportToilet(params, config) { + return request({ + url: '/sanitation/toilet/export', + method: 'get', + timeout: 120000, + params, + ...config, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 公厕保洁记录查询 +export function getToiletJobRecords(params) { + return request({ + url: '/sanitation/toilet/jobRecord', + method: 'get', + params + }) +} + +// 批量导出 +export function batchExportToiletJobRecords(params, config) { + return request({ + url: '/sanitation/toilet/exportJobRecord', + method: 'get', + timeout: 120000, + params, + ...config, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} diff --git a/src/api/system/alarm.js b/src/api/system/alarm.js new file mode 100644 index 0000000..1c3a7ab --- /dev/null +++ b/src/api/system/alarm.js @@ -0,0 +1,62 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' + +// 获取当前报警列表 +export function getAlarmNowList(params) { + return request({ + url: '/alarm/listNowPage', + method: 'get', + params + }) +} + +// 获取当前报警列表 +export function getAlarmHistoryList(params) { + return request({ + url: '/alarm/listHisPage', + method: 'get', + params + }) +} + + +// 批量消警 +export function clearAll(params) { + return request({ + url: '/alarm/allClear', + method: 'get', + params + }) +} + +// 消警 +export function clearAlarm(params) { + return request({ + url: '/alarm/cancel', + method: 'get', + params + }) +} + +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 设置报警阈值 +export function setThresh(params) { + return request({ + url: '/alarm/resetAlarmRule', + method: 'post', + params + }) +} diff --git a/src/api/system/bridge.js b/src/api/system/bridge.js new file mode 100644 index 0000000..e8a4108 --- /dev/null +++ b/src/api/system/bridge.js @@ -0,0 +1,80 @@ +/** + * 桥梁管理接口 + */ +import request from '@/utils/request' + +// 获取桥梁详情 +export function getDetail(id) { + return request({ + url: '/bridge/detail', + method: 'get', + params: { + id: id + } + }) +} + +export function updateBridge(params) { + return request({ + url: '/bridge/update', + method: 'post', + params + }) +} +// 批量导出 +export function exportRecords(params) { + return request({ + url: 'device/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +export function getContentList(params) { + return request({ + url: 'maintain/contentByType', + method: 'get', + params: { + type: params + } + }) +} +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 编辑 +export function editRecord(params) { + return request({ + url: 'maintain/update', + method: 'post', + params + }) +} +// 新增 +export function addRecord(params) { + return request({ + url: 'maintain/add', + method: 'post', + params + }) +} +// 删除 +export function delRecord(id) { + return request({ + url: 'maintain/delete', + method: 'post', + params: { + id: id + } + }) +} diff --git a/src/api/system/data.js b/src/api/system/data.js new file mode 100644 index 0000000..4c95db5 --- /dev/null +++ b/src/api/system/data.js @@ -0,0 +1,63 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' + +// 获取当前报警列表 +export function getHistoryList(params) { + return request({ + url: '/data/hisListPage', + method: 'get', + params + }) +} + +// 获取当前报警列表 +export function getHistory(params) { + return request({ + url: '/data/hisList', + method: 'get', + params + }) +} + + + +// 批量消警 +export function clearAll(params) { + return request({ + url: '/alarm/allClear', + method: 'get', + params + }) +} + +// 消警 +export function clearAlarm(params) { + return request({ + url: '/alarm/cancel', + method: 'get', + params + }) +} + +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 设置报警阈值 +export function setThresh(params) { + return request({ + url: '/alarm/resetAlarmRule', + method: 'post', + params + }) +} diff --git a/src/api/system/order.js b/src/api/system/order.js new file mode 100644 index 0000000..7007c50 --- /dev/null +++ b/src/api/system/order.js @@ -0,0 +1,71 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +// import qs from 'qs' + +// 获取当前报警列表 +export function getRecordList(params) { + return request({ + url: '/maintain/listPage', + method: 'get', + params + }) +} +// 批量导出 +export function exportRecords(params) { + return request({ + url: 'device/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +export function getContentList(params) { + return request({ + url: 'maintain/contentByType', + method: 'get', + params: { + type: params + } + }) +} +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 编辑 +export function editRecord(params) { + return request({ + url: 'maintain/update', + method: 'post', + params + }) +} +// 新增 +export function addRecord(params) { + return request({ + url: 'maintain/add', + method: 'post', + params + }) +} +// 删除 +export function delRecord(id) { + return request({ + url: 'maintain/delete', + method: 'post', + params: { + bridgeMaintenanceId: id + } + }) +} diff --git a/src/api/system/overview.js b/src/api/system/overview.js new file mode 100644 index 0000000..bca50cc --- /dev/null +++ b/src/api/system/overview.js @@ -0,0 +1,109 @@ +import request from '@/utils/request' +import qs from "qs" +import Vue from 'vue' + +// 路灯状态统计 +export function getLampStatus() { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampStatus', + method: 'get' + }) +} + +// 路灯总览列表 +export function getLampList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampList', + method: 'get', + params + }) +} + +// 路灯详情 +export function getlampDetail(lampId) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampDetail', + method: 'get', + params: { + lampId: lampId + } + }) +} + +// 回路列表 +export function getCircuitList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/circuitList', + method: 'get', + params + }) +} + +// 灯箱列表 +export function getLampBoxList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampBoxList', + method: 'get', + params + }) +} +// 灯箱详情 +export function getLampBoxDetail(lampBoxId) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampBoxDetail', + method: 'get', + params: { + lampBoxId: lampBoxId + } + }) +} + +// 报警总览列表 +export function getAlarmList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/alarmList', + method: 'get', + params + }) +} + +// 报警详情 +export function getAlarmDetail(alarmId) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/alarmDetail', + method: 'get', + params: { + alarmId: alarmId + } + }) +} + +// 路灯控制 +export function lampControl(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampControl', + method: 'post', + params, + paramsSerializer: params => { + return qs.stringify(params, { indices: false }) + } + }) +} diff --git a/src/api/system/rule.js b/src/api/system/rule.js new file mode 100644 index 0000000..76c6b2d --- /dev/null +++ b/src/api/system/rule.js @@ -0,0 +1,59 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +// import qs from 'qs' + +// 获取当前报警列表 +export function getRuleList() { + return request({ + url: 'rule/listPage', + method: 'get' + }) +} +export function getContentList(params) { + return request({ + url: 'maintain/contentByType', + method: 'get', + params: { + type: params + } + }) +} +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 编辑 +export function editRecord(params) { + return request({ + url: 'maintain/update', + method: 'post', + params + }) +} +// 新增 +export function addRecord(params) { + return request({ + url: 'maintain/add', + method: 'post', + params + }) +} +// 删除 +export function delRecord(id) { + return request({ + url: 'maintain/delete', + method: 'post', + params: { + id: id + } + }) +} diff --git a/src/api/system/statistics.js b/src/api/system/statistics.js new file mode 100644 index 0000000..b25efe9 --- /dev/null +++ b/src/api/system/statistics.js @@ -0,0 +1,23 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +// import qs from 'qs' + +// +export function countByToilet(params) { + return request({ + url: '/sanitation/toiletStatistic/jobStaticByToilet', + method: 'get', + params + }) +} + +export function countByDay(params) { + return request({ + url: '/sanitation/toiletStatistic/jobStaticByDate', + method: 'get', + params + }) +} + diff --git a/src/assets/global_images/icon-position.png b/src/assets/global_images/icon-position.png new file mode 100644 index 0000000..7444038 --- /dev/null +++ b/src/assets/global_images/icon-position.png Binary files differ diff --git a/src/assets/global_images/location_green.png b/src/assets/global_images/location_green.png new file mode 100644 index 0000000..aa8be65 --- /dev/null +++ b/src/assets/global_images/location_green.png Binary files differ diff --git a/src/assets/global_images/location_red.png b/src/assets/global_images/location_red.png new file mode 100644 index 0000000..2be8c3d --- /dev/null +++ b/src/assets/global_images/location_red.png Binary files differ diff --git a/src/assets/global_images/location_yellow.png b/src/assets/global_images/location_yellow.png new file mode 100644 index 0000000..5ab6f4d --- /dev/null +++ b/src/assets/global_images/location_yellow.png Binary files differ diff --git a/src/assets/global_images/toilet-position.png b/src/assets/global_images/toilet-position.png new file mode 100644 index 0000000..7db6d9a --- /dev/null +++ b/src/assets/global_images/toilet-position.png Binary files differ diff --git a/src/assets/global_images/toilet.png b/src/assets/global_images/toilet.png new file mode 100644 index 0000000..6d9fc05 --- /dev/null +++ b/src/assets/global_images/toilet.png Binary files differ diff --git a/src/assets/global_images/toiletPhoto.png b/src/assets/global_images/toiletPhoto.png new file mode 100644 index 0000000..15d08e2 --- /dev/null +++ b/src/assets/global_images/toiletPhoto.png Binary files differ diff --git a/src/components/DownloadTemplate/index.vue b/src/components/DownloadTemplate/index.vue index 8ded2cd..7807cac 100644 --- a/src/components/DownloadTemplate/index.vue +++ b/src/components/DownloadTemplate/index.vue @@ -47,8 +47,8 @@ diff --git a/src/components/NormalTable/index.vue b/src/components/NormalTable/index.vue index 5077bef..04d322d 100644 --- a/src/components/NormalTable/index.vue +++ b/src/components/NormalTable/index.vue @@ -79,7 +79,7 @@
-
+
Object.assign(obj, { [key]: this[key] }), {}), + on: events.reduce((obj, key) => Object.assign(obj, { [key]: this.transmitEvent }), {}) + }) + } + this.props = [...extraProps, ...props.filter(prop => exceptProps.indexOf(prop))] + } +} + +export default prop => new Mixin(prop) diff --git a/src/components/mapWindow/base/mixins/common.js b/src/components/mapWindow/base/mixins/common.js new file mode 100644 index 0000000..2fd1a28 --- /dev/null +++ b/src/components/mapWindow/base/mixins/common.js @@ -0,0 +1,82 @@ +const types = { + map: { + unload: 'clearMap' + }, + control: { + unload: 'removeControl' + }, + layer: { + unload: 'removeLayer' + }, + features: { + unload: 'removeFeatures' + }, + listener: { + unload: 'removeListener' + } +} + +const getParent = $component => ($component.abstract || $component.$el === $component.$children[0].$el) ? getParent($component.$parent) : $component + +function destroyInstance () { + const { unload, renderByParent, $parent } = this + if (renderByParent) { + $parent.reload() + } + unload() +} + +class Mixin { + constructor (prop) { + this.methods = { + ready () { + const $parent = getParent(this.$parent) + const map = this.map = $parent.map + this.load() + this.$emit('ready', { + map + }) + }, + transmitEvent (e) { + this.$emit(e.type.replace(/^on/, ''), e) + }, + reload () { + this && this.$nextTick(() => { + this.unload() + this.$nextTick(this.load) + }) + }, + unload () { + const { map, originInstance } = this + try { + switch (prop.type) { + case 'search': + return originInstance.clearResults() + case 'autoComplete': + case 'lushu': + return originInstance.dispose() + case 'markerClusterer': + return originInstance.clearMarkers() + default: + map[types[prop.type].unload](originInstance) + } + } catch (e) {} + } + } + this.computed = { + renderByParent () { + return this.$parent.preventChildrenRender + } + } + this.mounted = function () { + console.log('common mounted') + const $parent = getParent(this.$parent) + const map = $parent.map + const { ready } = this + console.log(map) + map ? ready() : $parent.$on('onload', ready) + } + } +} + +export default type => new Mixin({ type }) diff --git a/src/components/mapWindow/leafletMap.vue b/src/components/mapWindow/leafletMap.vue new file mode 100644 index 0000000..b753cc0 --- /dev/null +++ b/src/components/mapWindow/leafletMap.vue @@ -0,0 +1,143 @@ + + + + + + + diff --git a/src/components/mapWindow/mapWindow.vue b/src/components/mapWindow/mapWindow.vue new file mode 100644 index 0000000..9ced291 --- /dev/null +++ b/src/components/mapWindow/mapWindow.vue @@ -0,0 +1,46 @@ + + + + + + diff --git a/src/icons/svg/bridge.svg b/src/icons/svg/bridge.svg new file mode 100644 index 0000000..1a0336f --- /dev/null +++ b/src/icons/svg/bridge.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/config/index.js b/config/index.js index 8abd37a..19b33b1 100644 --- a/config/index.js +++ b/config/index.js @@ -69,7 +69,7 @@ * then assetsPublicPath should be set to "/bar/". * In most cases please use '/' !!! */ - assetsPublicPath: '/', + assetsPublicPath: '/toilet/', /** * Source Maps diff --git a/package.json b/package.json index 45f055f..9f3a3eb 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "echarts": "^4.2.1", "element-ui": "2.13.0", "event-source-polyfill": "^1.0.5", + "file-saver": "^2.0.5", "js-cookie": "2.2.0", "jsencrypt": "^3.0.0-rc.1", "leaflet": "^1.7.1", @@ -33,7 +34,9 @@ "vue-amap": "^0.5.9", "vue-baidu-map": "^0.21.22", "vue-router": "3.0.1", - "vuex": "3.0.1" + "vue2-leaflet": "^2.7.0", + "vuex": "3.0.1", + "xlsx": "^0.17.0" }, "devDependencies": { "autoprefixer": "8.5.0", diff --git a/src/api/common.js b/src/api/common.js index 87c582b..7804714 100644 --- a/src/api/common.js +++ b/src/api/common.js @@ -2,10 +2,14 @@ * 常用接口 */ import request from '@/utils/request' +import Vue from 'vue' + // 模板下载 export function downloadTemplate(fileName) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath return request({ - url: 'template/download', + url: lampPath + 'template/download', method: 'get', params: { filename: fileName @@ -19,7 +23,7 @@ const param = new FormData() param.append('file', fileobj.file) return request({ - url: 'imageUpload', + url: 'fileUpload', method: 'post', headers: { 'Content-Type': 'multipart/form-data' }, data: param diff --git a/src/api/sanitation/statistics.js b/src/api/sanitation/statistics.js new file mode 100644 index 0000000..ffeac18 --- /dev/null +++ b/src/api/sanitation/statistics.js @@ -0,0 +1,22 @@ + +/** + * 考核统计接口 + */ +import request from '@/utils/request' +// 公厕保洁次数统计 +export function getToiletJobCount(params) { + return request({ + url: '/sanitation/statistic/toilet/jobCount', + method: 'get', + params + }) +} + +// 公厕评分统计 +export function getToiletEvaluation(params) { + return request({ + url: '/sanitation/toiletEvaluation/statistics', + method: 'get', + params + }) +} diff --git a/src/api/sanitation/toilet.js b/src/api/sanitation/toilet.js new file mode 100644 index 0000000..11affd4 --- /dev/null +++ b/src/api/sanitation/toilet.js @@ -0,0 +1,133 @@ +/** + * 公厕管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' +// 公厕查询 +export function getToiletListPage(params) { + return request({ + url: '/sanitation/toilet/listPage', + method: 'get', + params + }) +} +// 公厕查询 +export function getToiletList(pid) { + return request({ + url: '/sanitation/toilet/list', + method: 'get', + params: { + pid: pid + } + }) +} + +// 添加公厕 +export function addToilet(params) { + return request({ + url: '/sanitation/toilet/add', + method: 'post', + params + }) +} +// 修改公厕机构 +export function updateToilet(params) { + return request({ + url: '/sanitation/toilet/update', + method: 'post', + params + }) +} +// 删除公厕机构 +export function delToilet(ids) { + return request({ + url: '/sanitation/toilet/delete', + method: 'post', + params: { + ids + }, + paramsSerializer: params => { + return qs.stringify(params, { indices: false }) + } + }) +} + +// 公厕基本信息详情 +export function getToiletInfoDetail(id) { + return request({ + url: '/sanitation/toilet/detail?toiletId=' + id, + method: 'get' + }) +} + +// 某公厕保洁记录 +export function getRecordsByToilet(params) { + return request({ + url: '/sanitation/toilet/jobRecord/detail', + method: 'get', + params + }) +} + +// 某公厕平均评分 +export function getScoreByToilet(params) { + return request({ + url: '/sanitation/toiletEvaluation/detailScore', + method: 'get', + params + }) +} + +// 某公厕评分列表 +export function getScoreListByToilet(params) { + return request({ + url: '/sanitation/toiletEvaluation/list', + method: 'get', + params + }) +} + + +// 批量导入 +export function batchImportToilet(fileobj) { + const param = new FormData() + param.append('file', fileobj) + return request({ + url: '/sanitation/toilet/import', + method: 'post', + headers: { 'Content-Type': 'multipart/form-data' }, + data: param + }) +} +// 批量导出 +export function batchExportToilet(params, config) { + return request({ + url: '/sanitation/toilet/export', + method: 'get', + timeout: 120000, + params, + ...config, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 公厕保洁记录查询 +export function getToiletJobRecords(params) { + return request({ + url: '/sanitation/toilet/jobRecord', + method: 'get', + params + }) +} + +// 批量导出 +export function batchExportToiletJobRecords(params, config) { + return request({ + url: '/sanitation/toilet/exportJobRecord', + method: 'get', + timeout: 120000, + params, + ...config, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} diff --git a/src/api/system/alarm.js b/src/api/system/alarm.js new file mode 100644 index 0000000..1c3a7ab --- /dev/null +++ b/src/api/system/alarm.js @@ -0,0 +1,62 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' + +// 获取当前报警列表 +export function getAlarmNowList(params) { + return request({ + url: '/alarm/listNowPage', + method: 'get', + params + }) +} + +// 获取当前报警列表 +export function getAlarmHistoryList(params) { + return request({ + url: '/alarm/listHisPage', + method: 'get', + params + }) +} + + +// 批量消警 +export function clearAll(params) { + return request({ + url: '/alarm/allClear', + method: 'get', + params + }) +} + +// 消警 +export function clearAlarm(params) { + return request({ + url: '/alarm/cancel', + method: 'get', + params + }) +} + +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 设置报警阈值 +export function setThresh(params) { + return request({ + url: '/alarm/resetAlarmRule', + method: 'post', + params + }) +} diff --git a/src/api/system/bridge.js b/src/api/system/bridge.js new file mode 100644 index 0000000..e8a4108 --- /dev/null +++ b/src/api/system/bridge.js @@ -0,0 +1,80 @@ +/** + * 桥梁管理接口 + */ +import request from '@/utils/request' + +// 获取桥梁详情 +export function getDetail(id) { + return request({ + url: '/bridge/detail', + method: 'get', + params: { + id: id + } + }) +} + +export function updateBridge(params) { + return request({ + url: '/bridge/update', + method: 'post', + params + }) +} +// 批量导出 +export function exportRecords(params) { + return request({ + url: 'device/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +export function getContentList(params) { + return request({ + url: 'maintain/contentByType', + method: 'get', + params: { + type: params + } + }) +} +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 编辑 +export function editRecord(params) { + return request({ + url: 'maintain/update', + method: 'post', + params + }) +} +// 新增 +export function addRecord(params) { + return request({ + url: 'maintain/add', + method: 'post', + params + }) +} +// 删除 +export function delRecord(id) { + return request({ + url: 'maintain/delete', + method: 'post', + params: { + id: id + } + }) +} diff --git a/src/api/system/data.js b/src/api/system/data.js new file mode 100644 index 0000000..4c95db5 --- /dev/null +++ b/src/api/system/data.js @@ -0,0 +1,63 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' + +// 获取当前报警列表 +export function getHistoryList(params) { + return request({ + url: '/data/hisListPage', + method: 'get', + params + }) +} + +// 获取当前报警列表 +export function getHistory(params) { + return request({ + url: '/data/hisList', + method: 'get', + params + }) +} + + + +// 批量消警 +export function clearAll(params) { + return request({ + url: '/alarm/allClear', + method: 'get', + params + }) +} + +// 消警 +export function clearAlarm(params) { + return request({ + url: '/alarm/cancel', + method: 'get', + params + }) +} + +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 设置报警阈值 +export function setThresh(params) { + return request({ + url: '/alarm/resetAlarmRule', + method: 'post', + params + }) +} diff --git a/src/api/system/order.js b/src/api/system/order.js new file mode 100644 index 0000000..7007c50 --- /dev/null +++ b/src/api/system/order.js @@ -0,0 +1,71 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +// import qs from 'qs' + +// 获取当前报警列表 +export function getRecordList(params) { + return request({ + url: '/maintain/listPage', + method: 'get', + params + }) +} +// 批量导出 +export function exportRecords(params) { + return request({ + url: 'device/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +export function getContentList(params) { + return request({ + url: 'maintain/contentByType', + method: 'get', + params: { + type: params + } + }) +} +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 编辑 +export function editRecord(params) { + return request({ + url: 'maintain/update', + method: 'post', + params + }) +} +// 新增 +export function addRecord(params) { + return request({ + url: 'maintain/add', + method: 'post', + params + }) +} +// 删除 +export function delRecord(id) { + return request({ + url: 'maintain/delete', + method: 'post', + params: { + bridgeMaintenanceId: id + } + }) +} diff --git a/src/api/system/overview.js b/src/api/system/overview.js new file mode 100644 index 0000000..bca50cc --- /dev/null +++ b/src/api/system/overview.js @@ -0,0 +1,109 @@ +import request from '@/utils/request' +import qs from "qs" +import Vue from 'vue' + +// 路灯状态统计 +export function getLampStatus() { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampStatus', + method: 'get' + }) +} + +// 路灯总览列表 +export function getLampList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampList', + method: 'get', + params + }) +} + +// 路灯详情 +export function getlampDetail(lampId) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampDetail', + method: 'get', + params: { + lampId: lampId + } + }) +} + +// 回路列表 +export function getCircuitList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/circuitList', + method: 'get', + params + }) +} + +// 灯箱列表 +export function getLampBoxList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampBoxList', + method: 'get', + params + }) +} +// 灯箱详情 +export function getLampBoxDetail(lampBoxId) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampBoxDetail', + method: 'get', + params: { + lampBoxId: lampBoxId + } + }) +} + +// 报警总览列表 +export function getAlarmList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/alarmList', + method: 'get', + params + }) +} + +// 报警详情 +export function getAlarmDetail(alarmId) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/alarmDetail', + method: 'get', + params: { + alarmId: alarmId + } + }) +} + +// 路灯控制 +export function lampControl(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampControl', + method: 'post', + params, + paramsSerializer: params => { + return qs.stringify(params, { indices: false }) + } + }) +} diff --git a/src/api/system/rule.js b/src/api/system/rule.js new file mode 100644 index 0000000..76c6b2d --- /dev/null +++ b/src/api/system/rule.js @@ -0,0 +1,59 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +// import qs from 'qs' + +// 获取当前报警列表 +export function getRuleList() { + return request({ + url: 'rule/listPage', + method: 'get' + }) +} +export function getContentList(params) { + return request({ + url: 'maintain/contentByType', + method: 'get', + params: { + type: params + } + }) +} +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 编辑 +export function editRecord(params) { + return request({ + url: 'maintain/update', + method: 'post', + params + }) +} +// 新增 +export function addRecord(params) { + return request({ + url: 'maintain/add', + method: 'post', + params + }) +} +// 删除 +export function delRecord(id) { + return request({ + url: 'maintain/delete', + method: 'post', + params: { + id: id + } + }) +} diff --git a/src/api/system/statistics.js b/src/api/system/statistics.js new file mode 100644 index 0000000..b25efe9 --- /dev/null +++ b/src/api/system/statistics.js @@ -0,0 +1,23 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +// import qs from 'qs' + +// +export function countByToilet(params) { + return request({ + url: '/sanitation/toiletStatistic/jobStaticByToilet', + method: 'get', + params + }) +} + +export function countByDay(params) { + return request({ + url: '/sanitation/toiletStatistic/jobStaticByDate', + method: 'get', + params + }) +} + diff --git a/src/assets/global_images/icon-position.png b/src/assets/global_images/icon-position.png new file mode 100644 index 0000000..7444038 --- /dev/null +++ b/src/assets/global_images/icon-position.png Binary files differ diff --git a/src/assets/global_images/location_green.png b/src/assets/global_images/location_green.png new file mode 100644 index 0000000..aa8be65 --- /dev/null +++ b/src/assets/global_images/location_green.png Binary files differ diff --git a/src/assets/global_images/location_red.png b/src/assets/global_images/location_red.png new file mode 100644 index 0000000..2be8c3d --- /dev/null +++ b/src/assets/global_images/location_red.png Binary files differ diff --git a/src/assets/global_images/location_yellow.png b/src/assets/global_images/location_yellow.png new file mode 100644 index 0000000..5ab6f4d --- /dev/null +++ b/src/assets/global_images/location_yellow.png Binary files differ diff --git a/src/assets/global_images/toilet-position.png b/src/assets/global_images/toilet-position.png new file mode 100644 index 0000000..7db6d9a --- /dev/null +++ b/src/assets/global_images/toilet-position.png Binary files differ diff --git a/src/assets/global_images/toilet.png b/src/assets/global_images/toilet.png new file mode 100644 index 0000000..6d9fc05 --- /dev/null +++ b/src/assets/global_images/toilet.png Binary files differ diff --git a/src/assets/global_images/toiletPhoto.png b/src/assets/global_images/toiletPhoto.png new file mode 100644 index 0000000..15d08e2 --- /dev/null +++ b/src/assets/global_images/toiletPhoto.png Binary files differ diff --git a/src/components/DownloadTemplate/index.vue b/src/components/DownloadTemplate/index.vue index 8ded2cd..7807cac 100644 --- a/src/components/DownloadTemplate/index.vue +++ b/src/components/DownloadTemplate/index.vue @@ -47,8 +47,8 @@ diff --git a/src/components/NormalTable/index.vue b/src/components/NormalTable/index.vue index 5077bef..04d322d 100644 --- a/src/components/NormalTable/index.vue +++ b/src/components/NormalTable/index.vue @@ -79,7 +79,7 @@
-
+
Object.assign(obj, { [key]: this[key] }), {}), + on: events.reduce((obj, key) => Object.assign(obj, { [key]: this.transmitEvent }), {}) + }) + } + this.props = [...extraProps, ...props.filter(prop => exceptProps.indexOf(prop))] + } +} + +export default prop => new Mixin(prop) diff --git a/src/components/mapWindow/base/mixins/common.js b/src/components/mapWindow/base/mixins/common.js new file mode 100644 index 0000000..2fd1a28 --- /dev/null +++ b/src/components/mapWindow/base/mixins/common.js @@ -0,0 +1,82 @@ +const types = { + map: { + unload: 'clearMap' + }, + control: { + unload: 'removeControl' + }, + layer: { + unload: 'removeLayer' + }, + features: { + unload: 'removeFeatures' + }, + listener: { + unload: 'removeListener' + } +} + +const getParent = $component => ($component.abstract || $component.$el === $component.$children[0].$el) ? getParent($component.$parent) : $component + +function destroyInstance () { + const { unload, renderByParent, $parent } = this + if (renderByParent) { + $parent.reload() + } + unload() +} + +class Mixin { + constructor (prop) { + this.methods = { + ready () { + const $parent = getParent(this.$parent) + const map = this.map = $parent.map + this.load() + this.$emit('ready', { + map + }) + }, + transmitEvent (e) { + this.$emit(e.type.replace(/^on/, ''), e) + }, + reload () { + this && this.$nextTick(() => { + this.unload() + this.$nextTick(this.load) + }) + }, + unload () { + const { map, originInstance } = this + try { + switch (prop.type) { + case 'search': + return originInstance.clearResults() + case 'autoComplete': + case 'lushu': + return originInstance.dispose() + case 'markerClusterer': + return originInstance.clearMarkers() + default: + map[types[prop.type].unload](originInstance) + } + } catch (e) {} + } + } + this.computed = { + renderByParent () { + return this.$parent.preventChildrenRender + } + } + this.mounted = function () { + console.log('common mounted') + const $parent = getParent(this.$parent) + const map = $parent.map + const { ready } = this + console.log(map) + map ? ready() : $parent.$on('onload', ready) + } + } +} + +export default type => new Mixin({ type }) diff --git a/src/components/mapWindow/leafletMap.vue b/src/components/mapWindow/leafletMap.vue new file mode 100644 index 0000000..b753cc0 --- /dev/null +++ b/src/components/mapWindow/leafletMap.vue @@ -0,0 +1,143 @@ + + + + + + + diff --git a/src/components/mapWindow/mapWindow.vue b/src/components/mapWindow/mapWindow.vue new file mode 100644 index 0000000..9ced291 --- /dev/null +++ b/src/components/mapWindow/mapWindow.vue @@ -0,0 +1,46 @@ + + + + + + diff --git a/src/icons/svg/bridge.svg b/src/icons/svg/bridge.svg new file mode 100644 index 0000000..1a0336f --- /dev/null +++ b/src/icons/svg/bridge.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/icons/svg/toilet.svg b/src/icons/svg/toilet.svg new file mode 100644 index 0000000..9d8e765 --- /dev/null +++ b/src/icons/svg/toilet.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/config/index.js b/config/index.js index 8abd37a..19b33b1 100644 --- a/config/index.js +++ b/config/index.js @@ -69,7 +69,7 @@ * then assetsPublicPath should be set to "/bar/". * In most cases please use '/' !!! */ - assetsPublicPath: '/', + assetsPublicPath: '/toilet/', /** * Source Maps diff --git a/package.json b/package.json index 45f055f..9f3a3eb 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "echarts": "^4.2.1", "element-ui": "2.13.0", "event-source-polyfill": "^1.0.5", + "file-saver": "^2.0.5", "js-cookie": "2.2.0", "jsencrypt": "^3.0.0-rc.1", "leaflet": "^1.7.1", @@ -33,7 +34,9 @@ "vue-amap": "^0.5.9", "vue-baidu-map": "^0.21.22", "vue-router": "3.0.1", - "vuex": "3.0.1" + "vue2-leaflet": "^2.7.0", + "vuex": "3.0.1", + "xlsx": "^0.17.0" }, "devDependencies": { "autoprefixer": "8.5.0", diff --git a/src/api/common.js b/src/api/common.js index 87c582b..7804714 100644 --- a/src/api/common.js +++ b/src/api/common.js @@ -2,10 +2,14 @@ * 常用接口 */ import request from '@/utils/request' +import Vue from 'vue' + // 模板下载 export function downloadTemplate(fileName) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath return request({ - url: 'template/download', + url: lampPath + 'template/download', method: 'get', params: { filename: fileName @@ -19,7 +23,7 @@ const param = new FormData() param.append('file', fileobj.file) return request({ - url: 'imageUpload', + url: 'fileUpload', method: 'post', headers: { 'Content-Type': 'multipart/form-data' }, data: param diff --git a/src/api/sanitation/statistics.js b/src/api/sanitation/statistics.js new file mode 100644 index 0000000..ffeac18 --- /dev/null +++ b/src/api/sanitation/statistics.js @@ -0,0 +1,22 @@ + +/** + * 考核统计接口 + */ +import request from '@/utils/request' +// 公厕保洁次数统计 +export function getToiletJobCount(params) { + return request({ + url: '/sanitation/statistic/toilet/jobCount', + method: 'get', + params + }) +} + +// 公厕评分统计 +export function getToiletEvaluation(params) { + return request({ + url: '/sanitation/toiletEvaluation/statistics', + method: 'get', + params + }) +} diff --git a/src/api/sanitation/toilet.js b/src/api/sanitation/toilet.js new file mode 100644 index 0000000..11affd4 --- /dev/null +++ b/src/api/sanitation/toilet.js @@ -0,0 +1,133 @@ +/** + * 公厕管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' +// 公厕查询 +export function getToiletListPage(params) { + return request({ + url: '/sanitation/toilet/listPage', + method: 'get', + params + }) +} +// 公厕查询 +export function getToiletList(pid) { + return request({ + url: '/sanitation/toilet/list', + method: 'get', + params: { + pid: pid + } + }) +} + +// 添加公厕 +export function addToilet(params) { + return request({ + url: '/sanitation/toilet/add', + method: 'post', + params + }) +} +// 修改公厕机构 +export function updateToilet(params) { + return request({ + url: '/sanitation/toilet/update', + method: 'post', + params + }) +} +// 删除公厕机构 +export function delToilet(ids) { + return request({ + url: '/sanitation/toilet/delete', + method: 'post', + params: { + ids + }, + paramsSerializer: params => { + return qs.stringify(params, { indices: false }) + } + }) +} + +// 公厕基本信息详情 +export function getToiletInfoDetail(id) { + return request({ + url: '/sanitation/toilet/detail?toiletId=' + id, + method: 'get' + }) +} + +// 某公厕保洁记录 +export function getRecordsByToilet(params) { + return request({ + url: '/sanitation/toilet/jobRecord/detail', + method: 'get', + params + }) +} + +// 某公厕平均评分 +export function getScoreByToilet(params) { + return request({ + url: '/sanitation/toiletEvaluation/detailScore', + method: 'get', + params + }) +} + +// 某公厕评分列表 +export function getScoreListByToilet(params) { + return request({ + url: '/sanitation/toiletEvaluation/list', + method: 'get', + params + }) +} + + +// 批量导入 +export function batchImportToilet(fileobj) { + const param = new FormData() + param.append('file', fileobj) + return request({ + url: '/sanitation/toilet/import', + method: 'post', + headers: { 'Content-Type': 'multipart/form-data' }, + data: param + }) +} +// 批量导出 +export function batchExportToilet(params, config) { + return request({ + url: '/sanitation/toilet/export', + method: 'get', + timeout: 120000, + params, + ...config, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 公厕保洁记录查询 +export function getToiletJobRecords(params) { + return request({ + url: '/sanitation/toilet/jobRecord', + method: 'get', + params + }) +} + +// 批量导出 +export function batchExportToiletJobRecords(params, config) { + return request({ + url: '/sanitation/toilet/exportJobRecord', + method: 'get', + timeout: 120000, + params, + ...config, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} diff --git a/src/api/system/alarm.js b/src/api/system/alarm.js new file mode 100644 index 0000000..1c3a7ab --- /dev/null +++ b/src/api/system/alarm.js @@ -0,0 +1,62 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' + +// 获取当前报警列表 +export function getAlarmNowList(params) { + return request({ + url: '/alarm/listNowPage', + method: 'get', + params + }) +} + +// 获取当前报警列表 +export function getAlarmHistoryList(params) { + return request({ + url: '/alarm/listHisPage', + method: 'get', + params + }) +} + + +// 批量消警 +export function clearAll(params) { + return request({ + url: '/alarm/allClear', + method: 'get', + params + }) +} + +// 消警 +export function clearAlarm(params) { + return request({ + url: '/alarm/cancel', + method: 'get', + params + }) +} + +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 设置报警阈值 +export function setThresh(params) { + return request({ + url: '/alarm/resetAlarmRule', + method: 'post', + params + }) +} diff --git a/src/api/system/bridge.js b/src/api/system/bridge.js new file mode 100644 index 0000000..e8a4108 --- /dev/null +++ b/src/api/system/bridge.js @@ -0,0 +1,80 @@ +/** + * 桥梁管理接口 + */ +import request from '@/utils/request' + +// 获取桥梁详情 +export function getDetail(id) { + return request({ + url: '/bridge/detail', + method: 'get', + params: { + id: id + } + }) +} + +export function updateBridge(params) { + return request({ + url: '/bridge/update', + method: 'post', + params + }) +} +// 批量导出 +export function exportRecords(params) { + return request({ + url: 'device/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +export function getContentList(params) { + return request({ + url: 'maintain/contentByType', + method: 'get', + params: { + type: params + } + }) +} +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 编辑 +export function editRecord(params) { + return request({ + url: 'maintain/update', + method: 'post', + params + }) +} +// 新增 +export function addRecord(params) { + return request({ + url: 'maintain/add', + method: 'post', + params + }) +} +// 删除 +export function delRecord(id) { + return request({ + url: 'maintain/delete', + method: 'post', + params: { + id: id + } + }) +} diff --git a/src/api/system/data.js b/src/api/system/data.js new file mode 100644 index 0000000..4c95db5 --- /dev/null +++ b/src/api/system/data.js @@ -0,0 +1,63 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' + +// 获取当前报警列表 +export function getHistoryList(params) { + return request({ + url: '/data/hisListPage', + method: 'get', + params + }) +} + +// 获取当前报警列表 +export function getHistory(params) { + return request({ + url: '/data/hisList', + method: 'get', + params + }) +} + + + +// 批量消警 +export function clearAll(params) { + return request({ + url: '/alarm/allClear', + method: 'get', + params + }) +} + +// 消警 +export function clearAlarm(params) { + return request({ + url: '/alarm/cancel', + method: 'get', + params + }) +} + +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 设置报警阈值 +export function setThresh(params) { + return request({ + url: '/alarm/resetAlarmRule', + method: 'post', + params + }) +} diff --git a/src/api/system/order.js b/src/api/system/order.js new file mode 100644 index 0000000..7007c50 --- /dev/null +++ b/src/api/system/order.js @@ -0,0 +1,71 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +// import qs from 'qs' + +// 获取当前报警列表 +export function getRecordList(params) { + return request({ + url: '/maintain/listPage', + method: 'get', + params + }) +} +// 批量导出 +export function exportRecords(params) { + return request({ + url: 'device/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +export function getContentList(params) { + return request({ + url: 'maintain/contentByType', + method: 'get', + params: { + type: params + } + }) +} +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 编辑 +export function editRecord(params) { + return request({ + url: 'maintain/update', + method: 'post', + params + }) +} +// 新增 +export function addRecord(params) { + return request({ + url: 'maintain/add', + method: 'post', + params + }) +} +// 删除 +export function delRecord(id) { + return request({ + url: 'maintain/delete', + method: 'post', + params: { + bridgeMaintenanceId: id + } + }) +} diff --git a/src/api/system/overview.js b/src/api/system/overview.js new file mode 100644 index 0000000..bca50cc --- /dev/null +++ b/src/api/system/overview.js @@ -0,0 +1,109 @@ +import request from '@/utils/request' +import qs from "qs" +import Vue from 'vue' + +// 路灯状态统计 +export function getLampStatus() { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampStatus', + method: 'get' + }) +} + +// 路灯总览列表 +export function getLampList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampList', + method: 'get', + params + }) +} + +// 路灯详情 +export function getlampDetail(lampId) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampDetail', + method: 'get', + params: { + lampId: lampId + } + }) +} + +// 回路列表 +export function getCircuitList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/circuitList', + method: 'get', + params + }) +} + +// 灯箱列表 +export function getLampBoxList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampBoxList', + method: 'get', + params + }) +} +// 灯箱详情 +export function getLampBoxDetail(lampBoxId) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampBoxDetail', + method: 'get', + params: { + lampBoxId: lampBoxId + } + }) +} + +// 报警总览列表 +export function getAlarmList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/alarmList', + method: 'get', + params + }) +} + +// 报警详情 +export function getAlarmDetail(alarmId) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/alarmDetail', + method: 'get', + params: { + alarmId: alarmId + } + }) +} + +// 路灯控制 +export function lampControl(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampControl', + method: 'post', + params, + paramsSerializer: params => { + return qs.stringify(params, { indices: false }) + } + }) +} diff --git a/src/api/system/rule.js b/src/api/system/rule.js new file mode 100644 index 0000000..76c6b2d --- /dev/null +++ b/src/api/system/rule.js @@ -0,0 +1,59 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +// import qs from 'qs' + +// 获取当前报警列表 +export function getRuleList() { + return request({ + url: 'rule/listPage', + method: 'get' + }) +} +export function getContentList(params) { + return request({ + url: 'maintain/contentByType', + method: 'get', + params: { + type: params + } + }) +} +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 编辑 +export function editRecord(params) { + return request({ + url: 'maintain/update', + method: 'post', + params + }) +} +// 新增 +export function addRecord(params) { + return request({ + url: 'maintain/add', + method: 'post', + params + }) +} +// 删除 +export function delRecord(id) { + return request({ + url: 'maintain/delete', + method: 'post', + params: { + id: id + } + }) +} diff --git a/src/api/system/statistics.js b/src/api/system/statistics.js new file mode 100644 index 0000000..b25efe9 --- /dev/null +++ b/src/api/system/statistics.js @@ -0,0 +1,23 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +// import qs from 'qs' + +// +export function countByToilet(params) { + return request({ + url: '/sanitation/toiletStatistic/jobStaticByToilet', + method: 'get', + params + }) +} + +export function countByDay(params) { + return request({ + url: '/sanitation/toiletStatistic/jobStaticByDate', + method: 'get', + params + }) +} + diff --git a/src/assets/global_images/icon-position.png b/src/assets/global_images/icon-position.png new file mode 100644 index 0000000..7444038 --- /dev/null +++ b/src/assets/global_images/icon-position.png Binary files differ diff --git a/src/assets/global_images/location_green.png b/src/assets/global_images/location_green.png new file mode 100644 index 0000000..aa8be65 --- /dev/null +++ b/src/assets/global_images/location_green.png Binary files differ diff --git a/src/assets/global_images/location_red.png b/src/assets/global_images/location_red.png new file mode 100644 index 0000000..2be8c3d --- /dev/null +++ b/src/assets/global_images/location_red.png Binary files differ diff --git a/src/assets/global_images/location_yellow.png b/src/assets/global_images/location_yellow.png new file mode 100644 index 0000000..5ab6f4d --- /dev/null +++ b/src/assets/global_images/location_yellow.png Binary files differ diff --git a/src/assets/global_images/toilet-position.png b/src/assets/global_images/toilet-position.png new file mode 100644 index 0000000..7db6d9a --- /dev/null +++ b/src/assets/global_images/toilet-position.png Binary files differ diff --git a/src/assets/global_images/toilet.png b/src/assets/global_images/toilet.png new file mode 100644 index 0000000..6d9fc05 --- /dev/null +++ b/src/assets/global_images/toilet.png Binary files differ diff --git a/src/assets/global_images/toiletPhoto.png b/src/assets/global_images/toiletPhoto.png new file mode 100644 index 0000000..15d08e2 --- /dev/null +++ b/src/assets/global_images/toiletPhoto.png Binary files differ diff --git a/src/components/DownloadTemplate/index.vue b/src/components/DownloadTemplate/index.vue index 8ded2cd..7807cac 100644 --- a/src/components/DownloadTemplate/index.vue +++ b/src/components/DownloadTemplate/index.vue @@ -47,8 +47,8 @@ diff --git a/src/components/NormalTable/index.vue b/src/components/NormalTable/index.vue index 5077bef..04d322d 100644 --- a/src/components/NormalTable/index.vue +++ b/src/components/NormalTable/index.vue @@ -79,7 +79,7 @@
-
+
Object.assign(obj, { [key]: this[key] }), {}), + on: events.reduce((obj, key) => Object.assign(obj, { [key]: this.transmitEvent }), {}) + }) + } + this.props = [...extraProps, ...props.filter(prop => exceptProps.indexOf(prop))] + } +} + +export default prop => new Mixin(prop) diff --git a/src/components/mapWindow/base/mixins/common.js b/src/components/mapWindow/base/mixins/common.js new file mode 100644 index 0000000..2fd1a28 --- /dev/null +++ b/src/components/mapWindow/base/mixins/common.js @@ -0,0 +1,82 @@ +const types = { + map: { + unload: 'clearMap' + }, + control: { + unload: 'removeControl' + }, + layer: { + unload: 'removeLayer' + }, + features: { + unload: 'removeFeatures' + }, + listener: { + unload: 'removeListener' + } +} + +const getParent = $component => ($component.abstract || $component.$el === $component.$children[0].$el) ? getParent($component.$parent) : $component + +function destroyInstance () { + const { unload, renderByParent, $parent } = this + if (renderByParent) { + $parent.reload() + } + unload() +} + +class Mixin { + constructor (prop) { + this.methods = { + ready () { + const $parent = getParent(this.$parent) + const map = this.map = $parent.map + this.load() + this.$emit('ready', { + map + }) + }, + transmitEvent (e) { + this.$emit(e.type.replace(/^on/, ''), e) + }, + reload () { + this && this.$nextTick(() => { + this.unload() + this.$nextTick(this.load) + }) + }, + unload () { + const { map, originInstance } = this + try { + switch (prop.type) { + case 'search': + return originInstance.clearResults() + case 'autoComplete': + case 'lushu': + return originInstance.dispose() + case 'markerClusterer': + return originInstance.clearMarkers() + default: + map[types[prop.type].unload](originInstance) + } + } catch (e) {} + } + } + this.computed = { + renderByParent () { + return this.$parent.preventChildrenRender + } + } + this.mounted = function () { + console.log('common mounted') + const $parent = getParent(this.$parent) + const map = $parent.map + const { ready } = this + console.log(map) + map ? ready() : $parent.$on('onload', ready) + } + } +} + +export default type => new Mixin({ type }) diff --git a/src/components/mapWindow/leafletMap.vue b/src/components/mapWindow/leafletMap.vue new file mode 100644 index 0000000..b753cc0 --- /dev/null +++ b/src/components/mapWindow/leafletMap.vue @@ -0,0 +1,143 @@ + + + + + + + diff --git a/src/components/mapWindow/mapWindow.vue b/src/components/mapWindow/mapWindow.vue new file mode 100644 index 0000000..9ced291 --- /dev/null +++ b/src/components/mapWindow/mapWindow.vue @@ -0,0 +1,46 @@ + + + + + + diff --git a/src/icons/svg/bridge.svg b/src/icons/svg/bridge.svg new file mode 100644 index 0000000..1a0336f --- /dev/null +++ b/src/icons/svg/bridge.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/icons/svg/toilet.svg b/src/icons/svg/toilet.svg new file mode 100644 index 0000000..9d8e765 --- /dev/null +++ b/src/icons/svg/toilet.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/main.js b/src/main.js index f2d105d..3e4074e 100644 --- a/src/main.js +++ b/src/main.js @@ -18,6 +18,9 @@ // echart // import echarts from 'echarts' // Vue.prototype.$echarts = echarts +// 引入v-charts +import VCharts from 'v-charts' +Vue.use(VCharts) // 将自动注册所有组件为全局组件 // import dataV from '@jiaminghi/data-view' @@ -35,9 +38,19 @@ Vue.component('search-item', SearchItem) // 加载leaflet的css +// import 'leaflet/dist/leaflet.css' +// import 'leaflet-draw/dist/leaflet.draw.css' +import L from 'leaflet' import 'leaflet/dist/leaflet.css' -import 'leaflet-draw/dist/leaflet.draw.css' +Vue.config.productionTip = false +Vue.L = Vue.prototype.$L = L +delete L.Icon.Default.prototype._getIconUrl +L.Icon.Default.mergeOptions({ + iconRetinaUrl: require('leaflet/dist/images/marker-icon-2x.png'), + iconUrl: require('leaflet/dist/images/marker-icon.png'), + shadowUrl: require('leaflet/dist/images/marker-shadow.png') +}) /** * This project originally used easy-mock to simulate data, * but its official service is very unstable, diff --git a/config/index.js b/config/index.js index 8abd37a..19b33b1 100644 --- a/config/index.js +++ b/config/index.js @@ -69,7 +69,7 @@ * then assetsPublicPath should be set to "/bar/". * In most cases please use '/' !!! */ - assetsPublicPath: '/', + assetsPublicPath: '/toilet/', /** * Source Maps diff --git a/package.json b/package.json index 45f055f..9f3a3eb 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "echarts": "^4.2.1", "element-ui": "2.13.0", "event-source-polyfill": "^1.0.5", + "file-saver": "^2.0.5", "js-cookie": "2.2.0", "jsencrypt": "^3.0.0-rc.1", "leaflet": "^1.7.1", @@ -33,7 +34,9 @@ "vue-amap": "^0.5.9", "vue-baidu-map": "^0.21.22", "vue-router": "3.0.1", - "vuex": "3.0.1" + "vue2-leaflet": "^2.7.0", + "vuex": "3.0.1", + "xlsx": "^0.17.0" }, "devDependencies": { "autoprefixer": "8.5.0", diff --git a/src/api/common.js b/src/api/common.js index 87c582b..7804714 100644 --- a/src/api/common.js +++ b/src/api/common.js @@ -2,10 +2,14 @@ * 常用接口 */ import request from '@/utils/request' +import Vue from 'vue' + // 模板下载 export function downloadTemplate(fileName) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath return request({ - url: 'template/download', + url: lampPath + 'template/download', method: 'get', params: { filename: fileName @@ -19,7 +23,7 @@ const param = new FormData() param.append('file', fileobj.file) return request({ - url: 'imageUpload', + url: 'fileUpload', method: 'post', headers: { 'Content-Type': 'multipart/form-data' }, data: param diff --git a/src/api/sanitation/statistics.js b/src/api/sanitation/statistics.js new file mode 100644 index 0000000..ffeac18 --- /dev/null +++ b/src/api/sanitation/statistics.js @@ -0,0 +1,22 @@ + +/** + * 考核统计接口 + */ +import request from '@/utils/request' +// 公厕保洁次数统计 +export function getToiletJobCount(params) { + return request({ + url: '/sanitation/statistic/toilet/jobCount', + method: 'get', + params + }) +} + +// 公厕评分统计 +export function getToiletEvaluation(params) { + return request({ + url: '/sanitation/toiletEvaluation/statistics', + method: 'get', + params + }) +} diff --git a/src/api/sanitation/toilet.js b/src/api/sanitation/toilet.js new file mode 100644 index 0000000..11affd4 --- /dev/null +++ b/src/api/sanitation/toilet.js @@ -0,0 +1,133 @@ +/** + * 公厕管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' +// 公厕查询 +export function getToiletListPage(params) { + return request({ + url: '/sanitation/toilet/listPage', + method: 'get', + params + }) +} +// 公厕查询 +export function getToiletList(pid) { + return request({ + url: '/sanitation/toilet/list', + method: 'get', + params: { + pid: pid + } + }) +} + +// 添加公厕 +export function addToilet(params) { + return request({ + url: '/sanitation/toilet/add', + method: 'post', + params + }) +} +// 修改公厕机构 +export function updateToilet(params) { + return request({ + url: '/sanitation/toilet/update', + method: 'post', + params + }) +} +// 删除公厕机构 +export function delToilet(ids) { + return request({ + url: '/sanitation/toilet/delete', + method: 'post', + params: { + ids + }, + paramsSerializer: params => { + return qs.stringify(params, { indices: false }) + } + }) +} + +// 公厕基本信息详情 +export function getToiletInfoDetail(id) { + return request({ + url: '/sanitation/toilet/detail?toiletId=' + id, + method: 'get' + }) +} + +// 某公厕保洁记录 +export function getRecordsByToilet(params) { + return request({ + url: '/sanitation/toilet/jobRecord/detail', + method: 'get', + params + }) +} + +// 某公厕平均评分 +export function getScoreByToilet(params) { + return request({ + url: '/sanitation/toiletEvaluation/detailScore', + method: 'get', + params + }) +} + +// 某公厕评分列表 +export function getScoreListByToilet(params) { + return request({ + url: '/sanitation/toiletEvaluation/list', + method: 'get', + params + }) +} + + +// 批量导入 +export function batchImportToilet(fileobj) { + const param = new FormData() + param.append('file', fileobj) + return request({ + url: '/sanitation/toilet/import', + method: 'post', + headers: { 'Content-Type': 'multipart/form-data' }, + data: param + }) +} +// 批量导出 +export function batchExportToilet(params, config) { + return request({ + url: '/sanitation/toilet/export', + method: 'get', + timeout: 120000, + params, + ...config, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 公厕保洁记录查询 +export function getToiletJobRecords(params) { + return request({ + url: '/sanitation/toilet/jobRecord', + method: 'get', + params + }) +} + +// 批量导出 +export function batchExportToiletJobRecords(params, config) { + return request({ + url: '/sanitation/toilet/exportJobRecord', + method: 'get', + timeout: 120000, + params, + ...config, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} diff --git a/src/api/system/alarm.js b/src/api/system/alarm.js new file mode 100644 index 0000000..1c3a7ab --- /dev/null +++ b/src/api/system/alarm.js @@ -0,0 +1,62 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' + +// 获取当前报警列表 +export function getAlarmNowList(params) { + return request({ + url: '/alarm/listNowPage', + method: 'get', + params + }) +} + +// 获取当前报警列表 +export function getAlarmHistoryList(params) { + return request({ + url: '/alarm/listHisPage', + method: 'get', + params + }) +} + + +// 批量消警 +export function clearAll(params) { + return request({ + url: '/alarm/allClear', + method: 'get', + params + }) +} + +// 消警 +export function clearAlarm(params) { + return request({ + url: '/alarm/cancel', + method: 'get', + params + }) +} + +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 设置报警阈值 +export function setThresh(params) { + return request({ + url: '/alarm/resetAlarmRule', + method: 'post', + params + }) +} diff --git a/src/api/system/bridge.js b/src/api/system/bridge.js new file mode 100644 index 0000000..e8a4108 --- /dev/null +++ b/src/api/system/bridge.js @@ -0,0 +1,80 @@ +/** + * 桥梁管理接口 + */ +import request from '@/utils/request' + +// 获取桥梁详情 +export function getDetail(id) { + return request({ + url: '/bridge/detail', + method: 'get', + params: { + id: id + } + }) +} + +export function updateBridge(params) { + return request({ + url: '/bridge/update', + method: 'post', + params + }) +} +// 批量导出 +export function exportRecords(params) { + return request({ + url: 'device/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +export function getContentList(params) { + return request({ + url: 'maintain/contentByType', + method: 'get', + params: { + type: params + } + }) +} +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 编辑 +export function editRecord(params) { + return request({ + url: 'maintain/update', + method: 'post', + params + }) +} +// 新增 +export function addRecord(params) { + return request({ + url: 'maintain/add', + method: 'post', + params + }) +} +// 删除 +export function delRecord(id) { + return request({ + url: 'maintain/delete', + method: 'post', + params: { + id: id + } + }) +} diff --git a/src/api/system/data.js b/src/api/system/data.js new file mode 100644 index 0000000..4c95db5 --- /dev/null +++ b/src/api/system/data.js @@ -0,0 +1,63 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' + +// 获取当前报警列表 +export function getHistoryList(params) { + return request({ + url: '/data/hisListPage', + method: 'get', + params + }) +} + +// 获取当前报警列表 +export function getHistory(params) { + return request({ + url: '/data/hisList', + method: 'get', + params + }) +} + + + +// 批量消警 +export function clearAll(params) { + return request({ + url: '/alarm/allClear', + method: 'get', + params + }) +} + +// 消警 +export function clearAlarm(params) { + return request({ + url: '/alarm/cancel', + method: 'get', + params + }) +} + +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 设置报警阈值 +export function setThresh(params) { + return request({ + url: '/alarm/resetAlarmRule', + method: 'post', + params + }) +} diff --git a/src/api/system/order.js b/src/api/system/order.js new file mode 100644 index 0000000..7007c50 --- /dev/null +++ b/src/api/system/order.js @@ -0,0 +1,71 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +// import qs from 'qs' + +// 获取当前报警列表 +export function getRecordList(params) { + return request({ + url: '/maintain/listPage', + method: 'get', + params + }) +} +// 批量导出 +export function exportRecords(params) { + return request({ + url: 'device/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +export function getContentList(params) { + return request({ + url: 'maintain/contentByType', + method: 'get', + params: { + type: params + } + }) +} +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 编辑 +export function editRecord(params) { + return request({ + url: 'maintain/update', + method: 'post', + params + }) +} +// 新增 +export function addRecord(params) { + return request({ + url: 'maintain/add', + method: 'post', + params + }) +} +// 删除 +export function delRecord(id) { + return request({ + url: 'maintain/delete', + method: 'post', + params: { + bridgeMaintenanceId: id + } + }) +} diff --git a/src/api/system/overview.js b/src/api/system/overview.js new file mode 100644 index 0000000..bca50cc --- /dev/null +++ b/src/api/system/overview.js @@ -0,0 +1,109 @@ +import request from '@/utils/request' +import qs from "qs" +import Vue from 'vue' + +// 路灯状态统计 +export function getLampStatus() { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampStatus', + method: 'get' + }) +} + +// 路灯总览列表 +export function getLampList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampList', + method: 'get', + params + }) +} + +// 路灯详情 +export function getlampDetail(lampId) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampDetail', + method: 'get', + params: { + lampId: lampId + } + }) +} + +// 回路列表 +export function getCircuitList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/circuitList', + method: 'get', + params + }) +} + +// 灯箱列表 +export function getLampBoxList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampBoxList', + method: 'get', + params + }) +} +// 灯箱详情 +export function getLampBoxDetail(lampBoxId) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampBoxDetail', + method: 'get', + params: { + lampBoxId: lampBoxId + } + }) +} + +// 报警总览列表 +export function getAlarmList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/alarmList', + method: 'get', + params + }) +} + +// 报警详情 +export function getAlarmDetail(alarmId) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/alarmDetail', + method: 'get', + params: { + alarmId: alarmId + } + }) +} + +// 路灯控制 +export function lampControl(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampControl', + method: 'post', + params, + paramsSerializer: params => { + return qs.stringify(params, { indices: false }) + } + }) +} diff --git a/src/api/system/rule.js b/src/api/system/rule.js new file mode 100644 index 0000000..76c6b2d --- /dev/null +++ b/src/api/system/rule.js @@ -0,0 +1,59 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +// import qs from 'qs' + +// 获取当前报警列表 +export function getRuleList() { + return request({ + url: 'rule/listPage', + method: 'get' + }) +} +export function getContentList(params) { + return request({ + url: 'maintain/contentByType', + method: 'get', + params: { + type: params + } + }) +} +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 编辑 +export function editRecord(params) { + return request({ + url: 'maintain/update', + method: 'post', + params + }) +} +// 新增 +export function addRecord(params) { + return request({ + url: 'maintain/add', + method: 'post', + params + }) +} +// 删除 +export function delRecord(id) { + return request({ + url: 'maintain/delete', + method: 'post', + params: { + id: id + } + }) +} diff --git a/src/api/system/statistics.js b/src/api/system/statistics.js new file mode 100644 index 0000000..b25efe9 --- /dev/null +++ b/src/api/system/statistics.js @@ -0,0 +1,23 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +// import qs from 'qs' + +// +export function countByToilet(params) { + return request({ + url: '/sanitation/toiletStatistic/jobStaticByToilet', + method: 'get', + params + }) +} + +export function countByDay(params) { + return request({ + url: '/sanitation/toiletStatistic/jobStaticByDate', + method: 'get', + params + }) +} + diff --git a/src/assets/global_images/icon-position.png b/src/assets/global_images/icon-position.png new file mode 100644 index 0000000..7444038 --- /dev/null +++ b/src/assets/global_images/icon-position.png Binary files differ diff --git a/src/assets/global_images/location_green.png b/src/assets/global_images/location_green.png new file mode 100644 index 0000000..aa8be65 --- /dev/null +++ b/src/assets/global_images/location_green.png Binary files differ diff --git a/src/assets/global_images/location_red.png b/src/assets/global_images/location_red.png new file mode 100644 index 0000000..2be8c3d --- /dev/null +++ b/src/assets/global_images/location_red.png Binary files differ diff --git a/src/assets/global_images/location_yellow.png b/src/assets/global_images/location_yellow.png new file mode 100644 index 0000000..5ab6f4d --- /dev/null +++ b/src/assets/global_images/location_yellow.png Binary files differ diff --git a/src/assets/global_images/toilet-position.png b/src/assets/global_images/toilet-position.png new file mode 100644 index 0000000..7db6d9a --- /dev/null +++ b/src/assets/global_images/toilet-position.png Binary files differ diff --git a/src/assets/global_images/toilet.png b/src/assets/global_images/toilet.png new file mode 100644 index 0000000..6d9fc05 --- /dev/null +++ b/src/assets/global_images/toilet.png Binary files differ diff --git a/src/assets/global_images/toiletPhoto.png b/src/assets/global_images/toiletPhoto.png new file mode 100644 index 0000000..15d08e2 --- /dev/null +++ b/src/assets/global_images/toiletPhoto.png Binary files differ diff --git a/src/components/DownloadTemplate/index.vue b/src/components/DownloadTemplate/index.vue index 8ded2cd..7807cac 100644 --- a/src/components/DownloadTemplate/index.vue +++ b/src/components/DownloadTemplate/index.vue @@ -47,8 +47,8 @@ diff --git a/src/components/NormalTable/index.vue b/src/components/NormalTable/index.vue index 5077bef..04d322d 100644 --- a/src/components/NormalTable/index.vue +++ b/src/components/NormalTable/index.vue @@ -79,7 +79,7 @@
-
+
Object.assign(obj, { [key]: this[key] }), {}), + on: events.reduce((obj, key) => Object.assign(obj, { [key]: this.transmitEvent }), {}) + }) + } + this.props = [...extraProps, ...props.filter(prop => exceptProps.indexOf(prop))] + } +} + +export default prop => new Mixin(prop) diff --git a/src/components/mapWindow/base/mixins/common.js b/src/components/mapWindow/base/mixins/common.js new file mode 100644 index 0000000..2fd1a28 --- /dev/null +++ b/src/components/mapWindow/base/mixins/common.js @@ -0,0 +1,82 @@ +const types = { + map: { + unload: 'clearMap' + }, + control: { + unload: 'removeControl' + }, + layer: { + unload: 'removeLayer' + }, + features: { + unload: 'removeFeatures' + }, + listener: { + unload: 'removeListener' + } +} + +const getParent = $component => ($component.abstract || $component.$el === $component.$children[0].$el) ? getParent($component.$parent) : $component + +function destroyInstance () { + const { unload, renderByParent, $parent } = this + if (renderByParent) { + $parent.reload() + } + unload() +} + +class Mixin { + constructor (prop) { + this.methods = { + ready () { + const $parent = getParent(this.$parent) + const map = this.map = $parent.map + this.load() + this.$emit('ready', { + map + }) + }, + transmitEvent (e) { + this.$emit(e.type.replace(/^on/, ''), e) + }, + reload () { + this && this.$nextTick(() => { + this.unload() + this.$nextTick(this.load) + }) + }, + unload () { + const { map, originInstance } = this + try { + switch (prop.type) { + case 'search': + return originInstance.clearResults() + case 'autoComplete': + case 'lushu': + return originInstance.dispose() + case 'markerClusterer': + return originInstance.clearMarkers() + default: + map[types[prop.type].unload](originInstance) + } + } catch (e) {} + } + } + this.computed = { + renderByParent () { + return this.$parent.preventChildrenRender + } + } + this.mounted = function () { + console.log('common mounted') + const $parent = getParent(this.$parent) + const map = $parent.map + const { ready } = this + console.log(map) + map ? ready() : $parent.$on('onload', ready) + } + } +} + +export default type => new Mixin({ type }) diff --git a/src/components/mapWindow/leafletMap.vue b/src/components/mapWindow/leafletMap.vue new file mode 100644 index 0000000..b753cc0 --- /dev/null +++ b/src/components/mapWindow/leafletMap.vue @@ -0,0 +1,143 @@ + + + + + + + diff --git a/src/components/mapWindow/mapWindow.vue b/src/components/mapWindow/mapWindow.vue new file mode 100644 index 0000000..9ced291 --- /dev/null +++ b/src/components/mapWindow/mapWindow.vue @@ -0,0 +1,46 @@ + + + + + + diff --git a/src/icons/svg/bridge.svg b/src/icons/svg/bridge.svg new file mode 100644 index 0000000..1a0336f --- /dev/null +++ b/src/icons/svg/bridge.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/icons/svg/toilet.svg b/src/icons/svg/toilet.svg new file mode 100644 index 0000000..9d8e765 --- /dev/null +++ b/src/icons/svg/toilet.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/main.js b/src/main.js index f2d105d..3e4074e 100644 --- a/src/main.js +++ b/src/main.js @@ -18,6 +18,9 @@ // echart // import echarts from 'echarts' // Vue.prototype.$echarts = echarts +// 引入v-charts +import VCharts from 'v-charts' +Vue.use(VCharts) // 将自动注册所有组件为全局组件 // import dataV from '@jiaminghi/data-view' @@ -35,9 +38,19 @@ Vue.component('search-item', SearchItem) // 加载leaflet的css +// import 'leaflet/dist/leaflet.css' +// import 'leaflet-draw/dist/leaflet.draw.css' +import L from 'leaflet' import 'leaflet/dist/leaflet.css' -import 'leaflet-draw/dist/leaflet.draw.css' +Vue.config.productionTip = false +Vue.L = Vue.prototype.$L = L +delete L.Icon.Default.prototype._getIconUrl +L.Icon.Default.mergeOptions({ + iconRetinaUrl: require('leaflet/dist/images/marker-icon-2x.png'), + iconUrl: require('leaflet/dist/images/marker-icon.png'), + shadowUrl: require('leaflet/dist/images/marker-shadow.png') +}) /** * This project originally used easy-mock to simulate data, * but its official service is very unstable, diff --git a/src/permission.js b/src/permission.js index dc6b2f8..809ca86 100644 --- a/src/permission.js +++ b/src/permission.js @@ -25,8 +25,8 @@ store.dispatch('GetInfo').then(res => { // 拉取用户信息 // 设置当前子系统为基础资源子系统 const currentSys = { - code: 'baseResourse', - name: '基础资源子系统' + code: 'toliet', + name: '公共厕所管理系统' } // 将当前系统信息保存在localStorage中 store.commit('SET_SYSTEM', currentSys) diff --git a/config/index.js b/config/index.js index 8abd37a..19b33b1 100644 --- a/config/index.js +++ b/config/index.js @@ -69,7 +69,7 @@ * then assetsPublicPath should be set to "/bar/". * In most cases please use '/' !!! */ - assetsPublicPath: '/', + assetsPublicPath: '/toilet/', /** * Source Maps diff --git a/package.json b/package.json index 45f055f..9f3a3eb 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "echarts": "^4.2.1", "element-ui": "2.13.0", "event-source-polyfill": "^1.0.5", + "file-saver": "^2.0.5", "js-cookie": "2.2.0", "jsencrypt": "^3.0.0-rc.1", "leaflet": "^1.7.1", @@ -33,7 +34,9 @@ "vue-amap": "^0.5.9", "vue-baidu-map": "^0.21.22", "vue-router": "3.0.1", - "vuex": "3.0.1" + "vue2-leaflet": "^2.7.0", + "vuex": "3.0.1", + "xlsx": "^0.17.0" }, "devDependencies": { "autoprefixer": "8.5.0", diff --git a/src/api/common.js b/src/api/common.js index 87c582b..7804714 100644 --- a/src/api/common.js +++ b/src/api/common.js @@ -2,10 +2,14 @@ * 常用接口 */ import request from '@/utils/request' +import Vue from 'vue' + // 模板下载 export function downloadTemplate(fileName) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath return request({ - url: 'template/download', + url: lampPath + 'template/download', method: 'get', params: { filename: fileName @@ -19,7 +23,7 @@ const param = new FormData() param.append('file', fileobj.file) return request({ - url: 'imageUpload', + url: 'fileUpload', method: 'post', headers: { 'Content-Type': 'multipart/form-data' }, data: param diff --git a/src/api/sanitation/statistics.js b/src/api/sanitation/statistics.js new file mode 100644 index 0000000..ffeac18 --- /dev/null +++ b/src/api/sanitation/statistics.js @@ -0,0 +1,22 @@ + +/** + * 考核统计接口 + */ +import request from '@/utils/request' +// 公厕保洁次数统计 +export function getToiletJobCount(params) { + return request({ + url: '/sanitation/statistic/toilet/jobCount', + method: 'get', + params + }) +} + +// 公厕评分统计 +export function getToiletEvaluation(params) { + return request({ + url: '/sanitation/toiletEvaluation/statistics', + method: 'get', + params + }) +} diff --git a/src/api/sanitation/toilet.js b/src/api/sanitation/toilet.js new file mode 100644 index 0000000..11affd4 --- /dev/null +++ b/src/api/sanitation/toilet.js @@ -0,0 +1,133 @@ +/** + * 公厕管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' +// 公厕查询 +export function getToiletListPage(params) { + return request({ + url: '/sanitation/toilet/listPage', + method: 'get', + params + }) +} +// 公厕查询 +export function getToiletList(pid) { + return request({ + url: '/sanitation/toilet/list', + method: 'get', + params: { + pid: pid + } + }) +} + +// 添加公厕 +export function addToilet(params) { + return request({ + url: '/sanitation/toilet/add', + method: 'post', + params + }) +} +// 修改公厕机构 +export function updateToilet(params) { + return request({ + url: '/sanitation/toilet/update', + method: 'post', + params + }) +} +// 删除公厕机构 +export function delToilet(ids) { + return request({ + url: '/sanitation/toilet/delete', + method: 'post', + params: { + ids + }, + paramsSerializer: params => { + return qs.stringify(params, { indices: false }) + } + }) +} + +// 公厕基本信息详情 +export function getToiletInfoDetail(id) { + return request({ + url: '/sanitation/toilet/detail?toiletId=' + id, + method: 'get' + }) +} + +// 某公厕保洁记录 +export function getRecordsByToilet(params) { + return request({ + url: '/sanitation/toilet/jobRecord/detail', + method: 'get', + params + }) +} + +// 某公厕平均评分 +export function getScoreByToilet(params) { + return request({ + url: '/sanitation/toiletEvaluation/detailScore', + method: 'get', + params + }) +} + +// 某公厕评分列表 +export function getScoreListByToilet(params) { + return request({ + url: '/sanitation/toiletEvaluation/list', + method: 'get', + params + }) +} + + +// 批量导入 +export function batchImportToilet(fileobj) { + const param = new FormData() + param.append('file', fileobj) + return request({ + url: '/sanitation/toilet/import', + method: 'post', + headers: { 'Content-Type': 'multipart/form-data' }, + data: param + }) +} +// 批量导出 +export function batchExportToilet(params, config) { + return request({ + url: '/sanitation/toilet/export', + method: 'get', + timeout: 120000, + params, + ...config, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 公厕保洁记录查询 +export function getToiletJobRecords(params) { + return request({ + url: '/sanitation/toilet/jobRecord', + method: 'get', + params + }) +} + +// 批量导出 +export function batchExportToiletJobRecords(params, config) { + return request({ + url: '/sanitation/toilet/exportJobRecord', + method: 'get', + timeout: 120000, + params, + ...config, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} diff --git a/src/api/system/alarm.js b/src/api/system/alarm.js new file mode 100644 index 0000000..1c3a7ab --- /dev/null +++ b/src/api/system/alarm.js @@ -0,0 +1,62 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' + +// 获取当前报警列表 +export function getAlarmNowList(params) { + return request({ + url: '/alarm/listNowPage', + method: 'get', + params + }) +} + +// 获取当前报警列表 +export function getAlarmHistoryList(params) { + return request({ + url: '/alarm/listHisPage', + method: 'get', + params + }) +} + + +// 批量消警 +export function clearAll(params) { + return request({ + url: '/alarm/allClear', + method: 'get', + params + }) +} + +// 消警 +export function clearAlarm(params) { + return request({ + url: '/alarm/cancel', + method: 'get', + params + }) +} + +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 设置报警阈值 +export function setThresh(params) { + return request({ + url: '/alarm/resetAlarmRule', + method: 'post', + params + }) +} diff --git a/src/api/system/bridge.js b/src/api/system/bridge.js new file mode 100644 index 0000000..e8a4108 --- /dev/null +++ b/src/api/system/bridge.js @@ -0,0 +1,80 @@ +/** + * 桥梁管理接口 + */ +import request from '@/utils/request' + +// 获取桥梁详情 +export function getDetail(id) { + return request({ + url: '/bridge/detail', + method: 'get', + params: { + id: id + } + }) +} + +export function updateBridge(params) { + return request({ + url: '/bridge/update', + method: 'post', + params + }) +} +// 批量导出 +export function exportRecords(params) { + return request({ + url: 'device/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +export function getContentList(params) { + return request({ + url: 'maintain/contentByType', + method: 'get', + params: { + type: params + } + }) +} +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 编辑 +export function editRecord(params) { + return request({ + url: 'maintain/update', + method: 'post', + params + }) +} +// 新增 +export function addRecord(params) { + return request({ + url: 'maintain/add', + method: 'post', + params + }) +} +// 删除 +export function delRecord(id) { + return request({ + url: 'maintain/delete', + method: 'post', + params: { + id: id + } + }) +} diff --git a/src/api/system/data.js b/src/api/system/data.js new file mode 100644 index 0000000..4c95db5 --- /dev/null +++ b/src/api/system/data.js @@ -0,0 +1,63 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' + +// 获取当前报警列表 +export function getHistoryList(params) { + return request({ + url: '/data/hisListPage', + method: 'get', + params + }) +} + +// 获取当前报警列表 +export function getHistory(params) { + return request({ + url: '/data/hisList', + method: 'get', + params + }) +} + + + +// 批量消警 +export function clearAll(params) { + return request({ + url: '/alarm/allClear', + method: 'get', + params + }) +} + +// 消警 +export function clearAlarm(params) { + return request({ + url: '/alarm/cancel', + method: 'get', + params + }) +} + +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 设置报警阈值 +export function setThresh(params) { + return request({ + url: '/alarm/resetAlarmRule', + method: 'post', + params + }) +} diff --git a/src/api/system/order.js b/src/api/system/order.js new file mode 100644 index 0000000..7007c50 --- /dev/null +++ b/src/api/system/order.js @@ -0,0 +1,71 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +// import qs from 'qs' + +// 获取当前报警列表 +export function getRecordList(params) { + return request({ + url: '/maintain/listPage', + method: 'get', + params + }) +} +// 批量导出 +export function exportRecords(params) { + return request({ + url: 'device/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +export function getContentList(params) { + return request({ + url: 'maintain/contentByType', + method: 'get', + params: { + type: params + } + }) +} +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 编辑 +export function editRecord(params) { + return request({ + url: 'maintain/update', + method: 'post', + params + }) +} +// 新增 +export function addRecord(params) { + return request({ + url: 'maintain/add', + method: 'post', + params + }) +} +// 删除 +export function delRecord(id) { + return request({ + url: 'maintain/delete', + method: 'post', + params: { + bridgeMaintenanceId: id + } + }) +} diff --git a/src/api/system/overview.js b/src/api/system/overview.js new file mode 100644 index 0000000..bca50cc --- /dev/null +++ b/src/api/system/overview.js @@ -0,0 +1,109 @@ +import request from '@/utils/request' +import qs from "qs" +import Vue from 'vue' + +// 路灯状态统计 +export function getLampStatus() { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampStatus', + method: 'get' + }) +} + +// 路灯总览列表 +export function getLampList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampList', + method: 'get', + params + }) +} + +// 路灯详情 +export function getlampDetail(lampId) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampDetail', + method: 'get', + params: { + lampId: lampId + } + }) +} + +// 回路列表 +export function getCircuitList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/circuitList', + method: 'get', + params + }) +} + +// 灯箱列表 +export function getLampBoxList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampBoxList', + method: 'get', + params + }) +} +// 灯箱详情 +export function getLampBoxDetail(lampBoxId) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampBoxDetail', + method: 'get', + params: { + lampBoxId: lampBoxId + } + }) +} + +// 报警总览列表 +export function getAlarmList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/alarmList', + method: 'get', + params + }) +} + +// 报警详情 +export function getAlarmDetail(alarmId) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/alarmDetail', + method: 'get', + params: { + alarmId: alarmId + } + }) +} + +// 路灯控制 +export function lampControl(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampControl', + method: 'post', + params, + paramsSerializer: params => { + return qs.stringify(params, { indices: false }) + } + }) +} diff --git a/src/api/system/rule.js b/src/api/system/rule.js new file mode 100644 index 0000000..76c6b2d --- /dev/null +++ b/src/api/system/rule.js @@ -0,0 +1,59 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +// import qs from 'qs' + +// 获取当前报警列表 +export function getRuleList() { + return request({ + url: 'rule/listPage', + method: 'get' + }) +} +export function getContentList(params) { + return request({ + url: 'maintain/contentByType', + method: 'get', + params: { + type: params + } + }) +} +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 编辑 +export function editRecord(params) { + return request({ + url: 'maintain/update', + method: 'post', + params + }) +} +// 新增 +export function addRecord(params) { + return request({ + url: 'maintain/add', + method: 'post', + params + }) +} +// 删除 +export function delRecord(id) { + return request({ + url: 'maintain/delete', + method: 'post', + params: { + id: id + } + }) +} diff --git a/src/api/system/statistics.js b/src/api/system/statistics.js new file mode 100644 index 0000000..b25efe9 --- /dev/null +++ b/src/api/system/statistics.js @@ -0,0 +1,23 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +// import qs from 'qs' + +// +export function countByToilet(params) { + return request({ + url: '/sanitation/toiletStatistic/jobStaticByToilet', + method: 'get', + params + }) +} + +export function countByDay(params) { + return request({ + url: '/sanitation/toiletStatistic/jobStaticByDate', + method: 'get', + params + }) +} + diff --git a/src/assets/global_images/icon-position.png b/src/assets/global_images/icon-position.png new file mode 100644 index 0000000..7444038 --- /dev/null +++ b/src/assets/global_images/icon-position.png Binary files differ diff --git a/src/assets/global_images/location_green.png b/src/assets/global_images/location_green.png new file mode 100644 index 0000000..aa8be65 --- /dev/null +++ b/src/assets/global_images/location_green.png Binary files differ diff --git a/src/assets/global_images/location_red.png b/src/assets/global_images/location_red.png new file mode 100644 index 0000000..2be8c3d --- /dev/null +++ b/src/assets/global_images/location_red.png Binary files differ diff --git a/src/assets/global_images/location_yellow.png b/src/assets/global_images/location_yellow.png new file mode 100644 index 0000000..5ab6f4d --- /dev/null +++ b/src/assets/global_images/location_yellow.png Binary files differ diff --git a/src/assets/global_images/toilet-position.png b/src/assets/global_images/toilet-position.png new file mode 100644 index 0000000..7db6d9a --- /dev/null +++ b/src/assets/global_images/toilet-position.png Binary files differ diff --git a/src/assets/global_images/toilet.png b/src/assets/global_images/toilet.png new file mode 100644 index 0000000..6d9fc05 --- /dev/null +++ b/src/assets/global_images/toilet.png Binary files differ diff --git a/src/assets/global_images/toiletPhoto.png b/src/assets/global_images/toiletPhoto.png new file mode 100644 index 0000000..15d08e2 --- /dev/null +++ b/src/assets/global_images/toiletPhoto.png Binary files differ diff --git a/src/components/DownloadTemplate/index.vue b/src/components/DownloadTemplate/index.vue index 8ded2cd..7807cac 100644 --- a/src/components/DownloadTemplate/index.vue +++ b/src/components/DownloadTemplate/index.vue @@ -47,8 +47,8 @@ diff --git a/src/components/NormalTable/index.vue b/src/components/NormalTable/index.vue index 5077bef..04d322d 100644 --- a/src/components/NormalTable/index.vue +++ b/src/components/NormalTable/index.vue @@ -79,7 +79,7 @@
-
+
Object.assign(obj, { [key]: this[key] }), {}), + on: events.reduce((obj, key) => Object.assign(obj, { [key]: this.transmitEvent }), {}) + }) + } + this.props = [...extraProps, ...props.filter(prop => exceptProps.indexOf(prop))] + } +} + +export default prop => new Mixin(prop) diff --git a/src/components/mapWindow/base/mixins/common.js b/src/components/mapWindow/base/mixins/common.js new file mode 100644 index 0000000..2fd1a28 --- /dev/null +++ b/src/components/mapWindow/base/mixins/common.js @@ -0,0 +1,82 @@ +const types = { + map: { + unload: 'clearMap' + }, + control: { + unload: 'removeControl' + }, + layer: { + unload: 'removeLayer' + }, + features: { + unload: 'removeFeatures' + }, + listener: { + unload: 'removeListener' + } +} + +const getParent = $component => ($component.abstract || $component.$el === $component.$children[0].$el) ? getParent($component.$parent) : $component + +function destroyInstance () { + const { unload, renderByParent, $parent } = this + if (renderByParent) { + $parent.reload() + } + unload() +} + +class Mixin { + constructor (prop) { + this.methods = { + ready () { + const $parent = getParent(this.$parent) + const map = this.map = $parent.map + this.load() + this.$emit('ready', { + map + }) + }, + transmitEvent (e) { + this.$emit(e.type.replace(/^on/, ''), e) + }, + reload () { + this && this.$nextTick(() => { + this.unload() + this.$nextTick(this.load) + }) + }, + unload () { + const { map, originInstance } = this + try { + switch (prop.type) { + case 'search': + return originInstance.clearResults() + case 'autoComplete': + case 'lushu': + return originInstance.dispose() + case 'markerClusterer': + return originInstance.clearMarkers() + default: + map[types[prop.type].unload](originInstance) + } + } catch (e) {} + } + } + this.computed = { + renderByParent () { + return this.$parent.preventChildrenRender + } + } + this.mounted = function () { + console.log('common mounted') + const $parent = getParent(this.$parent) + const map = $parent.map + const { ready } = this + console.log(map) + map ? ready() : $parent.$on('onload', ready) + } + } +} + +export default type => new Mixin({ type }) diff --git a/src/components/mapWindow/leafletMap.vue b/src/components/mapWindow/leafletMap.vue new file mode 100644 index 0000000..b753cc0 --- /dev/null +++ b/src/components/mapWindow/leafletMap.vue @@ -0,0 +1,143 @@ + + + + + + + diff --git a/src/components/mapWindow/mapWindow.vue b/src/components/mapWindow/mapWindow.vue new file mode 100644 index 0000000..9ced291 --- /dev/null +++ b/src/components/mapWindow/mapWindow.vue @@ -0,0 +1,46 @@ + + + + + + diff --git a/src/icons/svg/bridge.svg b/src/icons/svg/bridge.svg new file mode 100644 index 0000000..1a0336f --- /dev/null +++ b/src/icons/svg/bridge.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/icons/svg/toilet.svg b/src/icons/svg/toilet.svg new file mode 100644 index 0000000..9d8e765 --- /dev/null +++ b/src/icons/svg/toilet.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/main.js b/src/main.js index f2d105d..3e4074e 100644 --- a/src/main.js +++ b/src/main.js @@ -18,6 +18,9 @@ // echart // import echarts from 'echarts' // Vue.prototype.$echarts = echarts +// 引入v-charts +import VCharts from 'v-charts' +Vue.use(VCharts) // 将自动注册所有组件为全局组件 // import dataV from '@jiaminghi/data-view' @@ -35,9 +38,19 @@ Vue.component('search-item', SearchItem) // 加载leaflet的css +// import 'leaflet/dist/leaflet.css' +// import 'leaflet-draw/dist/leaflet.draw.css' +import L from 'leaflet' import 'leaflet/dist/leaflet.css' -import 'leaflet-draw/dist/leaflet.draw.css' +Vue.config.productionTip = false +Vue.L = Vue.prototype.$L = L +delete L.Icon.Default.prototype._getIconUrl +L.Icon.Default.mergeOptions({ + iconRetinaUrl: require('leaflet/dist/images/marker-icon-2x.png'), + iconUrl: require('leaflet/dist/images/marker-icon.png'), + shadowUrl: require('leaflet/dist/images/marker-shadow.png') +}) /** * This project originally used easy-mock to simulate data, * but its official service is very unstable, diff --git a/src/permission.js b/src/permission.js index dc6b2f8..809ca86 100644 --- a/src/permission.js +++ b/src/permission.js @@ -25,8 +25,8 @@ store.dispatch('GetInfo').then(res => { // 拉取用户信息 // 设置当前子系统为基础资源子系统 const currentSys = { - code: 'baseResourse', - name: '基础资源子系统' + code: 'toliet', + name: '公共厕所管理系统' } // 将当前系统信息保存在localStorage中 store.commit('SET_SYSTEM', currentSys) diff --git a/src/router/index.js b/src/router/index.js index 39c295c..d23076d 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -8,8 +8,11 @@ /* Layout */ import Layout from '@/layout/Layout' +import { toiletRouters } from './modules/toilet' +import { workRouters } from './modules/work' +import { statisticsRouters } from './modules/statistics' +import { ruleRouters } from './modules/rule' import { systemRouters } from './modules/system' -import { exampleRouters } from './modules/example' /** * hidden: true if `hidden:true` will not show in the sidebar(default is false) @@ -40,11 +43,12 @@ ] }, // 登录页面 - { path: '/login', component: () => import('@/views/login/index'), hidden: true }, + { path: '/login', component: () => import('@/views/login/index_2'), hidden: true }, // 404错误页面 { path: '/404', component: () => import('@/views/errorPage/404'), hidden: true }, // 401 错误页面 - { path: '/401', component: () => import('@/views/errorPage/401'), hidden: true } + { path: '/401', component: () => import('@/views/errorPage/401'), hidden: true }, + { path: '/', redirect: '/toiletList', hidden: true } ] // 实例化vue的时候直挂载constantRouter export default new Router({ @@ -56,7 +60,10 @@ // 异步挂载路由 // 动态需要根据权限加载的路由表 export const asyncRouterMap = [ - ...exampleRouters, - ...systemRouters, + ...toiletRouters, + ...workRouters, + ...statisticsRouters, + ...ruleRouters, + // ...systemRouters, { path: '*', redirect: '/404', hidden: true } ] diff --git a/config/index.js b/config/index.js index 8abd37a..19b33b1 100644 --- a/config/index.js +++ b/config/index.js @@ -69,7 +69,7 @@ * then assetsPublicPath should be set to "/bar/". * In most cases please use '/' !!! */ - assetsPublicPath: '/', + assetsPublicPath: '/toilet/', /** * Source Maps diff --git a/package.json b/package.json index 45f055f..9f3a3eb 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "echarts": "^4.2.1", "element-ui": "2.13.0", "event-source-polyfill": "^1.0.5", + "file-saver": "^2.0.5", "js-cookie": "2.2.0", "jsencrypt": "^3.0.0-rc.1", "leaflet": "^1.7.1", @@ -33,7 +34,9 @@ "vue-amap": "^0.5.9", "vue-baidu-map": "^0.21.22", "vue-router": "3.0.1", - "vuex": "3.0.1" + "vue2-leaflet": "^2.7.0", + "vuex": "3.0.1", + "xlsx": "^0.17.0" }, "devDependencies": { "autoprefixer": "8.5.0", diff --git a/src/api/common.js b/src/api/common.js index 87c582b..7804714 100644 --- a/src/api/common.js +++ b/src/api/common.js @@ -2,10 +2,14 @@ * 常用接口 */ import request from '@/utils/request' +import Vue from 'vue' + // 模板下载 export function downloadTemplate(fileName) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath return request({ - url: 'template/download', + url: lampPath + 'template/download', method: 'get', params: { filename: fileName @@ -19,7 +23,7 @@ const param = new FormData() param.append('file', fileobj.file) return request({ - url: 'imageUpload', + url: 'fileUpload', method: 'post', headers: { 'Content-Type': 'multipart/form-data' }, data: param diff --git a/src/api/sanitation/statistics.js b/src/api/sanitation/statistics.js new file mode 100644 index 0000000..ffeac18 --- /dev/null +++ b/src/api/sanitation/statistics.js @@ -0,0 +1,22 @@ + +/** + * 考核统计接口 + */ +import request from '@/utils/request' +// 公厕保洁次数统计 +export function getToiletJobCount(params) { + return request({ + url: '/sanitation/statistic/toilet/jobCount', + method: 'get', + params + }) +} + +// 公厕评分统计 +export function getToiletEvaluation(params) { + return request({ + url: '/sanitation/toiletEvaluation/statistics', + method: 'get', + params + }) +} diff --git a/src/api/sanitation/toilet.js b/src/api/sanitation/toilet.js new file mode 100644 index 0000000..11affd4 --- /dev/null +++ b/src/api/sanitation/toilet.js @@ -0,0 +1,133 @@ +/** + * 公厕管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' +// 公厕查询 +export function getToiletListPage(params) { + return request({ + url: '/sanitation/toilet/listPage', + method: 'get', + params + }) +} +// 公厕查询 +export function getToiletList(pid) { + return request({ + url: '/sanitation/toilet/list', + method: 'get', + params: { + pid: pid + } + }) +} + +// 添加公厕 +export function addToilet(params) { + return request({ + url: '/sanitation/toilet/add', + method: 'post', + params + }) +} +// 修改公厕机构 +export function updateToilet(params) { + return request({ + url: '/sanitation/toilet/update', + method: 'post', + params + }) +} +// 删除公厕机构 +export function delToilet(ids) { + return request({ + url: '/sanitation/toilet/delete', + method: 'post', + params: { + ids + }, + paramsSerializer: params => { + return qs.stringify(params, { indices: false }) + } + }) +} + +// 公厕基本信息详情 +export function getToiletInfoDetail(id) { + return request({ + url: '/sanitation/toilet/detail?toiletId=' + id, + method: 'get' + }) +} + +// 某公厕保洁记录 +export function getRecordsByToilet(params) { + return request({ + url: '/sanitation/toilet/jobRecord/detail', + method: 'get', + params + }) +} + +// 某公厕平均评分 +export function getScoreByToilet(params) { + return request({ + url: '/sanitation/toiletEvaluation/detailScore', + method: 'get', + params + }) +} + +// 某公厕评分列表 +export function getScoreListByToilet(params) { + return request({ + url: '/sanitation/toiletEvaluation/list', + method: 'get', + params + }) +} + + +// 批量导入 +export function batchImportToilet(fileobj) { + const param = new FormData() + param.append('file', fileobj) + return request({ + url: '/sanitation/toilet/import', + method: 'post', + headers: { 'Content-Type': 'multipart/form-data' }, + data: param + }) +} +// 批量导出 +export function batchExportToilet(params, config) { + return request({ + url: '/sanitation/toilet/export', + method: 'get', + timeout: 120000, + params, + ...config, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 公厕保洁记录查询 +export function getToiletJobRecords(params) { + return request({ + url: '/sanitation/toilet/jobRecord', + method: 'get', + params + }) +} + +// 批量导出 +export function batchExportToiletJobRecords(params, config) { + return request({ + url: '/sanitation/toilet/exportJobRecord', + method: 'get', + timeout: 120000, + params, + ...config, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} diff --git a/src/api/system/alarm.js b/src/api/system/alarm.js new file mode 100644 index 0000000..1c3a7ab --- /dev/null +++ b/src/api/system/alarm.js @@ -0,0 +1,62 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' + +// 获取当前报警列表 +export function getAlarmNowList(params) { + return request({ + url: '/alarm/listNowPage', + method: 'get', + params + }) +} + +// 获取当前报警列表 +export function getAlarmHistoryList(params) { + return request({ + url: '/alarm/listHisPage', + method: 'get', + params + }) +} + + +// 批量消警 +export function clearAll(params) { + return request({ + url: '/alarm/allClear', + method: 'get', + params + }) +} + +// 消警 +export function clearAlarm(params) { + return request({ + url: '/alarm/cancel', + method: 'get', + params + }) +} + +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 设置报警阈值 +export function setThresh(params) { + return request({ + url: '/alarm/resetAlarmRule', + method: 'post', + params + }) +} diff --git a/src/api/system/bridge.js b/src/api/system/bridge.js new file mode 100644 index 0000000..e8a4108 --- /dev/null +++ b/src/api/system/bridge.js @@ -0,0 +1,80 @@ +/** + * 桥梁管理接口 + */ +import request from '@/utils/request' + +// 获取桥梁详情 +export function getDetail(id) { + return request({ + url: '/bridge/detail', + method: 'get', + params: { + id: id + } + }) +} + +export function updateBridge(params) { + return request({ + url: '/bridge/update', + method: 'post', + params + }) +} +// 批量导出 +export function exportRecords(params) { + return request({ + url: 'device/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +export function getContentList(params) { + return request({ + url: 'maintain/contentByType', + method: 'get', + params: { + type: params + } + }) +} +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 编辑 +export function editRecord(params) { + return request({ + url: 'maintain/update', + method: 'post', + params + }) +} +// 新增 +export function addRecord(params) { + return request({ + url: 'maintain/add', + method: 'post', + params + }) +} +// 删除 +export function delRecord(id) { + return request({ + url: 'maintain/delete', + method: 'post', + params: { + id: id + } + }) +} diff --git a/src/api/system/data.js b/src/api/system/data.js new file mode 100644 index 0000000..4c95db5 --- /dev/null +++ b/src/api/system/data.js @@ -0,0 +1,63 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' + +// 获取当前报警列表 +export function getHistoryList(params) { + return request({ + url: '/data/hisListPage', + method: 'get', + params + }) +} + +// 获取当前报警列表 +export function getHistory(params) { + return request({ + url: '/data/hisList', + method: 'get', + params + }) +} + + + +// 批量消警 +export function clearAll(params) { + return request({ + url: '/alarm/allClear', + method: 'get', + params + }) +} + +// 消警 +export function clearAlarm(params) { + return request({ + url: '/alarm/cancel', + method: 'get', + params + }) +} + +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 设置报警阈值 +export function setThresh(params) { + return request({ + url: '/alarm/resetAlarmRule', + method: 'post', + params + }) +} diff --git a/src/api/system/order.js b/src/api/system/order.js new file mode 100644 index 0000000..7007c50 --- /dev/null +++ b/src/api/system/order.js @@ -0,0 +1,71 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +// import qs from 'qs' + +// 获取当前报警列表 +export function getRecordList(params) { + return request({ + url: '/maintain/listPage', + method: 'get', + params + }) +} +// 批量导出 +export function exportRecords(params) { + return request({ + url: 'device/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +export function getContentList(params) { + return request({ + url: 'maintain/contentByType', + method: 'get', + params: { + type: params + } + }) +} +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 编辑 +export function editRecord(params) { + return request({ + url: 'maintain/update', + method: 'post', + params + }) +} +// 新增 +export function addRecord(params) { + return request({ + url: 'maintain/add', + method: 'post', + params + }) +} +// 删除 +export function delRecord(id) { + return request({ + url: 'maintain/delete', + method: 'post', + params: { + bridgeMaintenanceId: id + } + }) +} diff --git a/src/api/system/overview.js b/src/api/system/overview.js new file mode 100644 index 0000000..bca50cc --- /dev/null +++ b/src/api/system/overview.js @@ -0,0 +1,109 @@ +import request from '@/utils/request' +import qs from "qs" +import Vue from 'vue' + +// 路灯状态统计 +export function getLampStatus() { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampStatus', + method: 'get' + }) +} + +// 路灯总览列表 +export function getLampList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampList', + method: 'get', + params + }) +} + +// 路灯详情 +export function getlampDetail(lampId) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampDetail', + method: 'get', + params: { + lampId: lampId + } + }) +} + +// 回路列表 +export function getCircuitList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/circuitList', + method: 'get', + params + }) +} + +// 灯箱列表 +export function getLampBoxList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampBoxList', + method: 'get', + params + }) +} +// 灯箱详情 +export function getLampBoxDetail(lampBoxId) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampBoxDetail', + method: 'get', + params: { + lampBoxId: lampBoxId + } + }) +} + +// 报警总览列表 +export function getAlarmList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/alarmList', + method: 'get', + params + }) +} + +// 报警详情 +export function getAlarmDetail(alarmId) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/alarmDetail', + method: 'get', + params: { + alarmId: alarmId + } + }) +} + +// 路灯控制 +export function lampControl(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampControl', + method: 'post', + params, + paramsSerializer: params => { + return qs.stringify(params, { indices: false }) + } + }) +} diff --git a/src/api/system/rule.js b/src/api/system/rule.js new file mode 100644 index 0000000..76c6b2d --- /dev/null +++ b/src/api/system/rule.js @@ -0,0 +1,59 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +// import qs from 'qs' + +// 获取当前报警列表 +export function getRuleList() { + return request({ + url: 'rule/listPage', + method: 'get' + }) +} +export function getContentList(params) { + return request({ + url: 'maintain/contentByType', + method: 'get', + params: { + type: params + } + }) +} +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 编辑 +export function editRecord(params) { + return request({ + url: 'maintain/update', + method: 'post', + params + }) +} +// 新增 +export function addRecord(params) { + return request({ + url: 'maintain/add', + method: 'post', + params + }) +} +// 删除 +export function delRecord(id) { + return request({ + url: 'maintain/delete', + method: 'post', + params: { + id: id + } + }) +} diff --git a/src/api/system/statistics.js b/src/api/system/statistics.js new file mode 100644 index 0000000..b25efe9 --- /dev/null +++ b/src/api/system/statistics.js @@ -0,0 +1,23 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +// import qs from 'qs' + +// +export function countByToilet(params) { + return request({ + url: '/sanitation/toiletStatistic/jobStaticByToilet', + method: 'get', + params + }) +} + +export function countByDay(params) { + return request({ + url: '/sanitation/toiletStatistic/jobStaticByDate', + method: 'get', + params + }) +} + diff --git a/src/assets/global_images/icon-position.png b/src/assets/global_images/icon-position.png new file mode 100644 index 0000000..7444038 --- /dev/null +++ b/src/assets/global_images/icon-position.png Binary files differ diff --git a/src/assets/global_images/location_green.png b/src/assets/global_images/location_green.png new file mode 100644 index 0000000..aa8be65 --- /dev/null +++ b/src/assets/global_images/location_green.png Binary files differ diff --git a/src/assets/global_images/location_red.png b/src/assets/global_images/location_red.png new file mode 100644 index 0000000..2be8c3d --- /dev/null +++ b/src/assets/global_images/location_red.png Binary files differ diff --git a/src/assets/global_images/location_yellow.png b/src/assets/global_images/location_yellow.png new file mode 100644 index 0000000..5ab6f4d --- /dev/null +++ b/src/assets/global_images/location_yellow.png Binary files differ diff --git a/src/assets/global_images/toilet-position.png b/src/assets/global_images/toilet-position.png new file mode 100644 index 0000000..7db6d9a --- /dev/null +++ b/src/assets/global_images/toilet-position.png Binary files differ diff --git a/src/assets/global_images/toilet.png b/src/assets/global_images/toilet.png new file mode 100644 index 0000000..6d9fc05 --- /dev/null +++ b/src/assets/global_images/toilet.png Binary files differ diff --git a/src/assets/global_images/toiletPhoto.png b/src/assets/global_images/toiletPhoto.png new file mode 100644 index 0000000..15d08e2 --- /dev/null +++ b/src/assets/global_images/toiletPhoto.png Binary files differ diff --git a/src/components/DownloadTemplate/index.vue b/src/components/DownloadTemplate/index.vue index 8ded2cd..7807cac 100644 --- a/src/components/DownloadTemplate/index.vue +++ b/src/components/DownloadTemplate/index.vue @@ -47,8 +47,8 @@ diff --git a/src/components/NormalTable/index.vue b/src/components/NormalTable/index.vue index 5077bef..04d322d 100644 --- a/src/components/NormalTable/index.vue +++ b/src/components/NormalTable/index.vue @@ -79,7 +79,7 @@
-
+
Object.assign(obj, { [key]: this[key] }), {}), + on: events.reduce((obj, key) => Object.assign(obj, { [key]: this.transmitEvent }), {}) + }) + } + this.props = [...extraProps, ...props.filter(prop => exceptProps.indexOf(prop))] + } +} + +export default prop => new Mixin(prop) diff --git a/src/components/mapWindow/base/mixins/common.js b/src/components/mapWindow/base/mixins/common.js new file mode 100644 index 0000000..2fd1a28 --- /dev/null +++ b/src/components/mapWindow/base/mixins/common.js @@ -0,0 +1,82 @@ +const types = { + map: { + unload: 'clearMap' + }, + control: { + unload: 'removeControl' + }, + layer: { + unload: 'removeLayer' + }, + features: { + unload: 'removeFeatures' + }, + listener: { + unload: 'removeListener' + } +} + +const getParent = $component => ($component.abstract || $component.$el === $component.$children[0].$el) ? getParent($component.$parent) : $component + +function destroyInstance () { + const { unload, renderByParent, $parent } = this + if (renderByParent) { + $parent.reload() + } + unload() +} + +class Mixin { + constructor (prop) { + this.methods = { + ready () { + const $parent = getParent(this.$parent) + const map = this.map = $parent.map + this.load() + this.$emit('ready', { + map + }) + }, + transmitEvent (e) { + this.$emit(e.type.replace(/^on/, ''), e) + }, + reload () { + this && this.$nextTick(() => { + this.unload() + this.$nextTick(this.load) + }) + }, + unload () { + const { map, originInstance } = this + try { + switch (prop.type) { + case 'search': + return originInstance.clearResults() + case 'autoComplete': + case 'lushu': + return originInstance.dispose() + case 'markerClusterer': + return originInstance.clearMarkers() + default: + map[types[prop.type].unload](originInstance) + } + } catch (e) {} + } + } + this.computed = { + renderByParent () { + return this.$parent.preventChildrenRender + } + } + this.mounted = function () { + console.log('common mounted') + const $parent = getParent(this.$parent) + const map = $parent.map + const { ready } = this + console.log(map) + map ? ready() : $parent.$on('onload', ready) + } + } +} + +export default type => new Mixin({ type }) diff --git a/src/components/mapWindow/leafletMap.vue b/src/components/mapWindow/leafletMap.vue new file mode 100644 index 0000000..b753cc0 --- /dev/null +++ b/src/components/mapWindow/leafletMap.vue @@ -0,0 +1,143 @@ + + + + + + + diff --git a/src/components/mapWindow/mapWindow.vue b/src/components/mapWindow/mapWindow.vue new file mode 100644 index 0000000..9ced291 --- /dev/null +++ b/src/components/mapWindow/mapWindow.vue @@ -0,0 +1,46 @@ + + + + + + diff --git a/src/icons/svg/bridge.svg b/src/icons/svg/bridge.svg new file mode 100644 index 0000000..1a0336f --- /dev/null +++ b/src/icons/svg/bridge.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/icons/svg/toilet.svg b/src/icons/svg/toilet.svg new file mode 100644 index 0000000..9d8e765 --- /dev/null +++ b/src/icons/svg/toilet.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/main.js b/src/main.js index f2d105d..3e4074e 100644 --- a/src/main.js +++ b/src/main.js @@ -18,6 +18,9 @@ // echart // import echarts from 'echarts' // Vue.prototype.$echarts = echarts +// 引入v-charts +import VCharts from 'v-charts' +Vue.use(VCharts) // 将自动注册所有组件为全局组件 // import dataV from '@jiaminghi/data-view' @@ -35,9 +38,19 @@ Vue.component('search-item', SearchItem) // 加载leaflet的css +// import 'leaflet/dist/leaflet.css' +// import 'leaflet-draw/dist/leaflet.draw.css' +import L from 'leaflet' import 'leaflet/dist/leaflet.css' -import 'leaflet-draw/dist/leaflet.draw.css' +Vue.config.productionTip = false +Vue.L = Vue.prototype.$L = L +delete L.Icon.Default.prototype._getIconUrl +L.Icon.Default.mergeOptions({ + iconRetinaUrl: require('leaflet/dist/images/marker-icon-2x.png'), + iconUrl: require('leaflet/dist/images/marker-icon.png'), + shadowUrl: require('leaflet/dist/images/marker-shadow.png') +}) /** * This project originally used easy-mock to simulate data, * but its official service is very unstable, diff --git a/src/permission.js b/src/permission.js index dc6b2f8..809ca86 100644 --- a/src/permission.js +++ b/src/permission.js @@ -25,8 +25,8 @@ store.dispatch('GetInfo').then(res => { // 拉取用户信息 // 设置当前子系统为基础资源子系统 const currentSys = { - code: 'baseResourse', - name: '基础资源子系统' + code: 'toliet', + name: '公共厕所管理系统' } // 将当前系统信息保存在localStorage中 store.commit('SET_SYSTEM', currentSys) diff --git a/src/router/index.js b/src/router/index.js index 39c295c..d23076d 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -8,8 +8,11 @@ /* Layout */ import Layout from '@/layout/Layout' +import { toiletRouters } from './modules/toilet' +import { workRouters } from './modules/work' +import { statisticsRouters } from './modules/statistics' +import { ruleRouters } from './modules/rule' import { systemRouters } from './modules/system' -import { exampleRouters } from './modules/example' /** * hidden: true if `hidden:true` will not show in the sidebar(default is false) @@ -40,11 +43,12 @@ ] }, // 登录页面 - { path: '/login', component: () => import('@/views/login/index'), hidden: true }, + { path: '/login', component: () => import('@/views/login/index_2'), hidden: true }, // 404错误页面 { path: '/404', component: () => import('@/views/errorPage/404'), hidden: true }, // 401 错误页面 - { path: '/401', component: () => import('@/views/errorPage/401'), hidden: true } + { path: '/401', component: () => import('@/views/errorPage/401'), hidden: true }, + { path: '/', redirect: '/toiletList', hidden: true } ] // 实例化vue的时候直挂载constantRouter export default new Router({ @@ -56,7 +60,10 @@ // 异步挂载路由 // 动态需要根据权限加载的路由表 export const asyncRouterMap = [ - ...exampleRouters, - ...systemRouters, + ...toiletRouters, + ...workRouters, + ...statisticsRouters, + ...ruleRouters, + // ...systemRouters, { path: '*', redirect: '/404', hidden: true } ] diff --git a/src/router/modules/rule.js b/src/router/modules/rule.js new file mode 100644 index 0000000..51e0283 --- /dev/null +++ b/src/router/modules/rule.js @@ -0,0 +1,24 @@ +/* Layout */ +import Layout from '@/layout/Layout' + +export const ruleRouters = [ + { + path: 'rule', + component: Layout, + redirect: '/rule', + name: 'Rule', + meta: { + title: '规章制度', + icon: 'icon-config', // 图标 + permission: ['/rule']// 权限名称 + }, + children: [ + { + path: '/rule', + name: 'Rule', + component: () => import('@/views/rule/listRule'), + meta: { title: '规章制度', icon: 'function', permission: ['/rule'] } + } + ] + } +] diff --git a/config/index.js b/config/index.js index 8abd37a..19b33b1 100644 --- a/config/index.js +++ b/config/index.js @@ -69,7 +69,7 @@ * then assetsPublicPath should be set to "/bar/". * In most cases please use '/' !!! */ - assetsPublicPath: '/', + assetsPublicPath: '/toilet/', /** * Source Maps diff --git a/package.json b/package.json index 45f055f..9f3a3eb 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "echarts": "^4.2.1", "element-ui": "2.13.0", "event-source-polyfill": "^1.0.5", + "file-saver": "^2.0.5", "js-cookie": "2.2.0", "jsencrypt": "^3.0.0-rc.1", "leaflet": "^1.7.1", @@ -33,7 +34,9 @@ "vue-amap": "^0.5.9", "vue-baidu-map": "^0.21.22", "vue-router": "3.0.1", - "vuex": "3.0.1" + "vue2-leaflet": "^2.7.0", + "vuex": "3.0.1", + "xlsx": "^0.17.0" }, "devDependencies": { "autoprefixer": "8.5.0", diff --git a/src/api/common.js b/src/api/common.js index 87c582b..7804714 100644 --- a/src/api/common.js +++ b/src/api/common.js @@ -2,10 +2,14 @@ * 常用接口 */ import request from '@/utils/request' +import Vue from 'vue' + // 模板下载 export function downloadTemplate(fileName) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath return request({ - url: 'template/download', + url: lampPath + 'template/download', method: 'get', params: { filename: fileName @@ -19,7 +23,7 @@ const param = new FormData() param.append('file', fileobj.file) return request({ - url: 'imageUpload', + url: 'fileUpload', method: 'post', headers: { 'Content-Type': 'multipart/form-data' }, data: param diff --git a/src/api/sanitation/statistics.js b/src/api/sanitation/statistics.js new file mode 100644 index 0000000..ffeac18 --- /dev/null +++ b/src/api/sanitation/statistics.js @@ -0,0 +1,22 @@ + +/** + * 考核统计接口 + */ +import request from '@/utils/request' +// 公厕保洁次数统计 +export function getToiletJobCount(params) { + return request({ + url: '/sanitation/statistic/toilet/jobCount', + method: 'get', + params + }) +} + +// 公厕评分统计 +export function getToiletEvaluation(params) { + return request({ + url: '/sanitation/toiletEvaluation/statistics', + method: 'get', + params + }) +} diff --git a/src/api/sanitation/toilet.js b/src/api/sanitation/toilet.js new file mode 100644 index 0000000..11affd4 --- /dev/null +++ b/src/api/sanitation/toilet.js @@ -0,0 +1,133 @@ +/** + * 公厕管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' +// 公厕查询 +export function getToiletListPage(params) { + return request({ + url: '/sanitation/toilet/listPage', + method: 'get', + params + }) +} +// 公厕查询 +export function getToiletList(pid) { + return request({ + url: '/sanitation/toilet/list', + method: 'get', + params: { + pid: pid + } + }) +} + +// 添加公厕 +export function addToilet(params) { + return request({ + url: '/sanitation/toilet/add', + method: 'post', + params + }) +} +// 修改公厕机构 +export function updateToilet(params) { + return request({ + url: '/sanitation/toilet/update', + method: 'post', + params + }) +} +// 删除公厕机构 +export function delToilet(ids) { + return request({ + url: '/sanitation/toilet/delete', + method: 'post', + params: { + ids + }, + paramsSerializer: params => { + return qs.stringify(params, { indices: false }) + } + }) +} + +// 公厕基本信息详情 +export function getToiletInfoDetail(id) { + return request({ + url: '/sanitation/toilet/detail?toiletId=' + id, + method: 'get' + }) +} + +// 某公厕保洁记录 +export function getRecordsByToilet(params) { + return request({ + url: '/sanitation/toilet/jobRecord/detail', + method: 'get', + params + }) +} + +// 某公厕平均评分 +export function getScoreByToilet(params) { + return request({ + url: '/sanitation/toiletEvaluation/detailScore', + method: 'get', + params + }) +} + +// 某公厕评分列表 +export function getScoreListByToilet(params) { + return request({ + url: '/sanitation/toiletEvaluation/list', + method: 'get', + params + }) +} + + +// 批量导入 +export function batchImportToilet(fileobj) { + const param = new FormData() + param.append('file', fileobj) + return request({ + url: '/sanitation/toilet/import', + method: 'post', + headers: { 'Content-Type': 'multipart/form-data' }, + data: param + }) +} +// 批量导出 +export function batchExportToilet(params, config) { + return request({ + url: '/sanitation/toilet/export', + method: 'get', + timeout: 120000, + params, + ...config, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 公厕保洁记录查询 +export function getToiletJobRecords(params) { + return request({ + url: '/sanitation/toilet/jobRecord', + method: 'get', + params + }) +} + +// 批量导出 +export function batchExportToiletJobRecords(params, config) { + return request({ + url: '/sanitation/toilet/exportJobRecord', + method: 'get', + timeout: 120000, + params, + ...config, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} diff --git a/src/api/system/alarm.js b/src/api/system/alarm.js new file mode 100644 index 0000000..1c3a7ab --- /dev/null +++ b/src/api/system/alarm.js @@ -0,0 +1,62 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' + +// 获取当前报警列表 +export function getAlarmNowList(params) { + return request({ + url: '/alarm/listNowPage', + method: 'get', + params + }) +} + +// 获取当前报警列表 +export function getAlarmHistoryList(params) { + return request({ + url: '/alarm/listHisPage', + method: 'get', + params + }) +} + + +// 批量消警 +export function clearAll(params) { + return request({ + url: '/alarm/allClear', + method: 'get', + params + }) +} + +// 消警 +export function clearAlarm(params) { + return request({ + url: '/alarm/cancel', + method: 'get', + params + }) +} + +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 设置报警阈值 +export function setThresh(params) { + return request({ + url: '/alarm/resetAlarmRule', + method: 'post', + params + }) +} diff --git a/src/api/system/bridge.js b/src/api/system/bridge.js new file mode 100644 index 0000000..e8a4108 --- /dev/null +++ b/src/api/system/bridge.js @@ -0,0 +1,80 @@ +/** + * 桥梁管理接口 + */ +import request from '@/utils/request' + +// 获取桥梁详情 +export function getDetail(id) { + return request({ + url: '/bridge/detail', + method: 'get', + params: { + id: id + } + }) +} + +export function updateBridge(params) { + return request({ + url: '/bridge/update', + method: 'post', + params + }) +} +// 批量导出 +export function exportRecords(params) { + return request({ + url: 'device/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +export function getContentList(params) { + return request({ + url: 'maintain/contentByType', + method: 'get', + params: { + type: params + } + }) +} +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 编辑 +export function editRecord(params) { + return request({ + url: 'maintain/update', + method: 'post', + params + }) +} +// 新增 +export function addRecord(params) { + return request({ + url: 'maintain/add', + method: 'post', + params + }) +} +// 删除 +export function delRecord(id) { + return request({ + url: 'maintain/delete', + method: 'post', + params: { + id: id + } + }) +} diff --git a/src/api/system/data.js b/src/api/system/data.js new file mode 100644 index 0000000..4c95db5 --- /dev/null +++ b/src/api/system/data.js @@ -0,0 +1,63 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' + +// 获取当前报警列表 +export function getHistoryList(params) { + return request({ + url: '/data/hisListPage', + method: 'get', + params + }) +} + +// 获取当前报警列表 +export function getHistory(params) { + return request({ + url: '/data/hisList', + method: 'get', + params + }) +} + + + +// 批量消警 +export function clearAll(params) { + return request({ + url: '/alarm/allClear', + method: 'get', + params + }) +} + +// 消警 +export function clearAlarm(params) { + return request({ + url: '/alarm/cancel', + method: 'get', + params + }) +} + +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 设置报警阈值 +export function setThresh(params) { + return request({ + url: '/alarm/resetAlarmRule', + method: 'post', + params + }) +} diff --git a/src/api/system/order.js b/src/api/system/order.js new file mode 100644 index 0000000..7007c50 --- /dev/null +++ b/src/api/system/order.js @@ -0,0 +1,71 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +// import qs from 'qs' + +// 获取当前报警列表 +export function getRecordList(params) { + return request({ + url: '/maintain/listPage', + method: 'get', + params + }) +} +// 批量导出 +export function exportRecords(params) { + return request({ + url: 'device/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +export function getContentList(params) { + return request({ + url: 'maintain/contentByType', + method: 'get', + params: { + type: params + } + }) +} +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 编辑 +export function editRecord(params) { + return request({ + url: 'maintain/update', + method: 'post', + params + }) +} +// 新增 +export function addRecord(params) { + return request({ + url: 'maintain/add', + method: 'post', + params + }) +} +// 删除 +export function delRecord(id) { + return request({ + url: 'maintain/delete', + method: 'post', + params: { + bridgeMaintenanceId: id + } + }) +} diff --git a/src/api/system/overview.js b/src/api/system/overview.js new file mode 100644 index 0000000..bca50cc --- /dev/null +++ b/src/api/system/overview.js @@ -0,0 +1,109 @@ +import request from '@/utils/request' +import qs from "qs" +import Vue from 'vue' + +// 路灯状态统计 +export function getLampStatus() { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampStatus', + method: 'get' + }) +} + +// 路灯总览列表 +export function getLampList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampList', + method: 'get', + params + }) +} + +// 路灯详情 +export function getlampDetail(lampId) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampDetail', + method: 'get', + params: { + lampId: lampId + } + }) +} + +// 回路列表 +export function getCircuitList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/circuitList', + method: 'get', + params + }) +} + +// 灯箱列表 +export function getLampBoxList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampBoxList', + method: 'get', + params + }) +} +// 灯箱详情 +export function getLampBoxDetail(lampBoxId) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampBoxDetail', + method: 'get', + params: { + lampBoxId: lampBoxId + } + }) +} + +// 报警总览列表 +export function getAlarmList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/alarmList', + method: 'get', + params + }) +} + +// 报警详情 +export function getAlarmDetail(alarmId) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/alarmDetail', + method: 'get', + params: { + alarmId: alarmId + } + }) +} + +// 路灯控制 +export function lampControl(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampControl', + method: 'post', + params, + paramsSerializer: params => { + return qs.stringify(params, { indices: false }) + } + }) +} diff --git a/src/api/system/rule.js b/src/api/system/rule.js new file mode 100644 index 0000000..76c6b2d --- /dev/null +++ b/src/api/system/rule.js @@ -0,0 +1,59 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +// import qs from 'qs' + +// 获取当前报警列表 +export function getRuleList() { + return request({ + url: 'rule/listPage', + method: 'get' + }) +} +export function getContentList(params) { + return request({ + url: 'maintain/contentByType', + method: 'get', + params: { + type: params + } + }) +} +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 编辑 +export function editRecord(params) { + return request({ + url: 'maintain/update', + method: 'post', + params + }) +} +// 新增 +export function addRecord(params) { + return request({ + url: 'maintain/add', + method: 'post', + params + }) +} +// 删除 +export function delRecord(id) { + return request({ + url: 'maintain/delete', + method: 'post', + params: { + id: id + } + }) +} diff --git a/src/api/system/statistics.js b/src/api/system/statistics.js new file mode 100644 index 0000000..b25efe9 --- /dev/null +++ b/src/api/system/statistics.js @@ -0,0 +1,23 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +// import qs from 'qs' + +// +export function countByToilet(params) { + return request({ + url: '/sanitation/toiletStatistic/jobStaticByToilet', + method: 'get', + params + }) +} + +export function countByDay(params) { + return request({ + url: '/sanitation/toiletStatistic/jobStaticByDate', + method: 'get', + params + }) +} + diff --git a/src/assets/global_images/icon-position.png b/src/assets/global_images/icon-position.png new file mode 100644 index 0000000..7444038 --- /dev/null +++ b/src/assets/global_images/icon-position.png Binary files differ diff --git a/src/assets/global_images/location_green.png b/src/assets/global_images/location_green.png new file mode 100644 index 0000000..aa8be65 --- /dev/null +++ b/src/assets/global_images/location_green.png Binary files differ diff --git a/src/assets/global_images/location_red.png b/src/assets/global_images/location_red.png new file mode 100644 index 0000000..2be8c3d --- /dev/null +++ b/src/assets/global_images/location_red.png Binary files differ diff --git a/src/assets/global_images/location_yellow.png b/src/assets/global_images/location_yellow.png new file mode 100644 index 0000000..5ab6f4d --- /dev/null +++ b/src/assets/global_images/location_yellow.png Binary files differ diff --git a/src/assets/global_images/toilet-position.png b/src/assets/global_images/toilet-position.png new file mode 100644 index 0000000..7db6d9a --- /dev/null +++ b/src/assets/global_images/toilet-position.png Binary files differ diff --git a/src/assets/global_images/toilet.png b/src/assets/global_images/toilet.png new file mode 100644 index 0000000..6d9fc05 --- /dev/null +++ b/src/assets/global_images/toilet.png Binary files differ diff --git a/src/assets/global_images/toiletPhoto.png b/src/assets/global_images/toiletPhoto.png new file mode 100644 index 0000000..15d08e2 --- /dev/null +++ b/src/assets/global_images/toiletPhoto.png Binary files differ diff --git a/src/components/DownloadTemplate/index.vue b/src/components/DownloadTemplate/index.vue index 8ded2cd..7807cac 100644 --- a/src/components/DownloadTemplate/index.vue +++ b/src/components/DownloadTemplate/index.vue @@ -47,8 +47,8 @@ diff --git a/src/components/NormalTable/index.vue b/src/components/NormalTable/index.vue index 5077bef..04d322d 100644 --- a/src/components/NormalTable/index.vue +++ b/src/components/NormalTable/index.vue @@ -79,7 +79,7 @@
-
+
Object.assign(obj, { [key]: this[key] }), {}), + on: events.reduce((obj, key) => Object.assign(obj, { [key]: this.transmitEvent }), {}) + }) + } + this.props = [...extraProps, ...props.filter(prop => exceptProps.indexOf(prop))] + } +} + +export default prop => new Mixin(prop) diff --git a/src/components/mapWindow/base/mixins/common.js b/src/components/mapWindow/base/mixins/common.js new file mode 100644 index 0000000..2fd1a28 --- /dev/null +++ b/src/components/mapWindow/base/mixins/common.js @@ -0,0 +1,82 @@ +const types = { + map: { + unload: 'clearMap' + }, + control: { + unload: 'removeControl' + }, + layer: { + unload: 'removeLayer' + }, + features: { + unload: 'removeFeatures' + }, + listener: { + unload: 'removeListener' + } +} + +const getParent = $component => ($component.abstract || $component.$el === $component.$children[0].$el) ? getParent($component.$parent) : $component + +function destroyInstance () { + const { unload, renderByParent, $parent } = this + if (renderByParent) { + $parent.reload() + } + unload() +} + +class Mixin { + constructor (prop) { + this.methods = { + ready () { + const $parent = getParent(this.$parent) + const map = this.map = $parent.map + this.load() + this.$emit('ready', { + map + }) + }, + transmitEvent (e) { + this.$emit(e.type.replace(/^on/, ''), e) + }, + reload () { + this && this.$nextTick(() => { + this.unload() + this.$nextTick(this.load) + }) + }, + unload () { + const { map, originInstance } = this + try { + switch (prop.type) { + case 'search': + return originInstance.clearResults() + case 'autoComplete': + case 'lushu': + return originInstance.dispose() + case 'markerClusterer': + return originInstance.clearMarkers() + default: + map[types[prop.type].unload](originInstance) + } + } catch (e) {} + } + } + this.computed = { + renderByParent () { + return this.$parent.preventChildrenRender + } + } + this.mounted = function () { + console.log('common mounted') + const $parent = getParent(this.$parent) + const map = $parent.map + const { ready } = this + console.log(map) + map ? ready() : $parent.$on('onload', ready) + } + } +} + +export default type => new Mixin({ type }) diff --git a/src/components/mapWindow/leafletMap.vue b/src/components/mapWindow/leafletMap.vue new file mode 100644 index 0000000..b753cc0 --- /dev/null +++ b/src/components/mapWindow/leafletMap.vue @@ -0,0 +1,143 @@ + + + + + + + diff --git a/src/components/mapWindow/mapWindow.vue b/src/components/mapWindow/mapWindow.vue new file mode 100644 index 0000000..9ced291 --- /dev/null +++ b/src/components/mapWindow/mapWindow.vue @@ -0,0 +1,46 @@ + + + + + + diff --git a/src/icons/svg/bridge.svg b/src/icons/svg/bridge.svg new file mode 100644 index 0000000..1a0336f --- /dev/null +++ b/src/icons/svg/bridge.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/icons/svg/toilet.svg b/src/icons/svg/toilet.svg new file mode 100644 index 0000000..9d8e765 --- /dev/null +++ b/src/icons/svg/toilet.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/main.js b/src/main.js index f2d105d..3e4074e 100644 --- a/src/main.js +++ b/src/main.js @@ -18,6 +18,9 @@ // echart // import echarts from 'echarts' // Vue.prototype.$echarts = echarts +// 引入v-charts +import VCharts from 'v-charts' +Vue.use(VCharts) // 将自动注册所有组件为全局组件 // import dataV from '@jiaminghi/data-view' @@ -35,9 +38,19 @@ Vue.component('search-item', SearchItem) // 加载leaflet的css +// import 'leaflet/dist/leaflet.css' +// import 'leaflet-draw/dist/leaflet.draw.css' +import L from 'leaflet' import 'leaflet/dist/leaflet.css' -import 'leaflet-draw/dist/leaflet.draw.css' +Vue.config.productionTip = false +Vue.L = Vue.prototype.$L = L +delete L.Icon.Default.prototype._getIconUrl +L.Icon.Default.mergeOptions({ + iconRetinaUrl: require('leaflet/dist/images/marker-icon-2x.png'), + iconUrl: require('leaflet/dist/images/marker-icon.png'), + shadowUrl: require('leaflet/dist/images/marker-shadow.png') +}) /** * This project originally used easy-mock to simulate data, * but its official service is very unstable, diff --git a/src/permission.js b/src/permission.js index dc6b2f8..809ca86 100644 --- a/src/permission.js +++ b/src/permission.js @@ -25,8 +25,8 @@ store.dispatch('GetInfo').then(res => { // 拉取用户信息 // 设置当前子系统为基础资源子系统 const currentSys = { - code: 'baseResourse', - name: '基础资源子系统' + code: 'toliet', + name: '公共厕所管理系统' } // 将当前系统信息保存在localStorage中 store.commit('SET_SYSTEM', currentSys) diff --git a/src/router/index.js b/src/router/index.js index 39c295c..d23076d 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -8,8 +8,11 @@ /* Layout */ import Layout from '@/layout/Layout' +import { toiletRouters } from './modules/toilet' +import { workRouters } from './modules/work' +import { statisticsRouters } from './modules/statistics' +import { ruleRouters } from './modules/rule' import { systemRouters } from './modules/system' -import { exampleRouters } from './modules/example' /** * hidden: true if `hidden:true` will not show in the sidebar(default is false) @@ -40,11 +43,12 @@ ] }, // 登录页面 - { path: '/login', component: () => import('@/views/login/index'), hidden: true }, + { path: '/login', component: () => import('@/views/login/index_2'), hidden: true }, // 404错误页面 { path: '/404', component: () => import('@/views/errorPage/404'), hidden: true }, // 401 错误页面 - { path: '/401', component: () => import('@/views/errorPage/401'), hidden: true } + { path: '/401', component: () => import('@/views/errorPage/401'), hidden: true }, + { path: '/', redirect: '/toiletList', hidden: true } ] // 实例化vue的时候直挂载constantRouter export default new Router({ @@ -56,7 +60,10 @@ // 异步挂载路由 // 动态需要根据权限加载的路由表 export const asyncRouterMap = [ - ...exampleRouters, - ...systemRouters, + ...toiletRouters, + ...workRouters, + ...statisticsRouters, + ...ruleRouters, + // ...systemRouters, { path: '*', redirect: '/404', hidden: true } ] diff --git a/src/router/modules/rule.js b/src/router/modules/rule.js new file mode 100644 index 0000000..51e0283 --- /dev/null +++ b/src/router/modules/rule.js @@ -0,0 +1,24 @@ +/* Layout */ +import Layout from '@/layout/Layout' + +export const ruleRouters = [ + { + path: 'rule', + component: Layout, + redirect: '/rule', + name: 'Rule', + meta: { + title: '规章制度', + icon: 'icon-config', // 图标 + permission: ['/rule']// 权限名称 + }, + children: [ + { + path: '/rule', + name: 'Rule', + component: () => import('@/views/rule/listRule'), + meta: { title: '规章制度', icon: 'function', permission: ['/rule'] } + } + ] + } +] diff --git a/src/router/modules/statistics.js b/src/router/modules/statistics.js new file mode 100644 index 0000000..fb9cbea --- /dev/null +++ b/src/router/modules/statistics.js @@ -0,0 +1,30 @@ +/* Layout */ +import Layout from '@/layout/Layout' + +export const statisticsRouters = [ + { + path: 'statisticsToilet', + component: Layout, + redirect: '/workStatistics', + name: 'StatisticsToilet', + meta: { + title: '作业统计', + icon: 'icon-config', // 图标 + permission: ['/statisticsToilet']// 权限名称 + }, + children: [ + { + path: '/workStatistics', + name: 'WorkStatistics', + component: () => import('@/views/statistics/toiletAssessment'), + meta: { title: '作业统计', icon: '', permission: ['/toilet/workStatistics'] } + }, + { + path: '/evaluationStatistics', + name: 'EvaluationStatistics', + component: () => import('@/views/statistics/evaluationAssessment'), + meta: { title: '评价统计', icon: '', permission: ['/toilet/evaluationStatistics'] } + } + ] + } +] diff --git a/config/index.js b/config/index.js index 8abd37a..19b33b1 100644 --- a/config/index.js +++ b/config/index.js @@ -69,7 +69,7 @@ * then assetsPublicPath should be set to "/bar/". * In most cases please use '/' !!! */ - assetsPublicPath: '/', + assetsPublicPath: '/toilet/', /** * Source Maps diff --git a/package.json b/package.json index 45f055f..9f3a3eb 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "echarts": "^4.2.1", "element-ui": "2.13.0", "event-source-polyfill": "^1.0.5", + "file-saver": "^2.0.5", "js-cookie": "2.2.0", "jsencrypt": "^3.0.0-rc.1", "leaflet": "^1.7.1", @@ -33,7 +34,9 @@ "vue-amap": "^0.5.9", "vue-baidu-map": "^0.21.22", "vue-router": "3.0.1", - "vuex": "3.0.1" + "vue2-leaflet": "^2.7.0", + "vuex": "3.0.1", + "xlsx": "^0.17.0" }, "devDependencies": { "autoprefixer": "8.5.0", diff --git a/src/api/common.js b/src/api/common.js index 87c582b..7804714 100644 --- a/src/api/common.js +++ b/src/api/common.js @@ -2,10 +2,14 @@ * 常用接口 */ import request from '@/utils/request' +import Vue from 'vue' + // 模板下载 export function downloadTemplate(fileName) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath return request({ - url: 'template/download', + url: lampPath + 'template/download', method: 'get', params: { filename: fileName @@ -19,7 +23,7 @@ const param = new FormData() param.append('file', fileobj.file) return request({ - url: 'imageUpload', + url: 'fileUpload', method: 'post', headers: { 'Content-Type': 'multipart/form-data' }, data: param diff --git a/src/api/sanitation/statistics.js b/src/api/sanitation/statistics.js new file mode 100644 index 0000000..ffeac18 --- /dev/null +++ b/src/api/sanitation/statistics.js @@ -0,0 +1,22 @@ + +/** + * 考核统计接口 + */ +import request from '@/utils/request' +// 公厕保洁次数统计 +export function getToiletJobCount(params) { + return request({ + url: '/sanitation/statistic/toilet/jobCount', + method: 'get', + params + }) +} + +// 公厕评分统计 +export function getToiletEvaluation(params) { + return request({ + url: '/sanitation/toiletEvaluation/statistics', + method: 'get', + params + }) +} diff --git a/src/api/sanitation/toilet.js b/src/api/sanitation/toilet.js new file mode 100644 index 0000000..11affd4 --- /dev/null +++ b/src/api/sanitation/toilet.js @@ -0,0 +1,133 @@ +/** + * 公厕管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' +// 公厕查询 +export function getToiletListPage(params) { + return request({ + url: '/sanitation/toilet/listPage', + method: 'get', + params + }) +} +// 公厕查询 +export function getToiletList(pid) { + return request({ + url: '/sanitation/toilet/list', + method: 'get', + params: { + pid: pid + } + }) +} + +// 添加公厕 +export function addToilet(params) { + return request({ + url: '/sanitation/toilet/add', + method: 'post', + params + }) +} +// 修改公厕机构 +export function updateToilet(params) { + return request({ + url: '/sanitation/toilet/update', + method: 'post', + params + }) +} +// 删除公厕机构 +export function delToilet(ids) { + return request({ + url: '/sanitation/toilet/delete', + method: 'post', + params: { + ids + }, + paramsSerializer: params => { + return qs.stringify(params, { indices: false }) + } + }) +} + +// 公厕基本信息详情 +export function getToiletInfoDetail(id) { + return request({ + url: '/sanitation/toilet/detail?toiletId=' + id, + method: 'get' + }) +} + +// 某公厕保洁记录 +export function getRecordsByToilet(params) { + return request({ + url: '/sanitation/toilet/jobRecord/detail', + method: 'get', + params + }) +} + +// 某公厕平均评分 +export function getScoreByToilet(params) { + return request({ + url: '/sanitation/toiletEvaluation/detailScore', + method: 'get', + params + }) +} + +// 某公厕评分列表 +export function getScoreListByToilet(params) { + return request({ + url: '/sanitation/toiletEvaluation/list', + method: 'get', + params + }) +} + + +// 批量导入 +export function batchImportToilet(fileobj) { + const param = new FormData() + param.append('file', fileobj) + return request({ + url: '/sanitation/toilet/import', + method: 'post', + headers: { 'Content-Type': 'multipart/form-data' }, + data: param + }) +} +// 批量导出 +export function batchExportToilet(params, config) { + return request({ + url: '/sanitation/toilet/export', + method: 'get', + timeout: 120000, + params, + ...config, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 公厕保洁记录查询 +export function getToiletJobRecords(params) { + return request({ + url: '/sanitation/toilet/jobRecord', + method: 'get', + params + }) +} + +// 批量导出 +export function batchExportToiletJobRecords(params, config) { + return request({ + url: '/sanitation/toilet/exportJobRecord', + method: 'get', + timeout: 120000, + params, + ...config, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} diff --git a/src/api/system/alarm.js b/src/api/system/alarm.js new file mode 100644 index 0000000..1c3a7ab --- /dev/null +++ b/src/api/system/alarm.js @@ -0,0 +1,62 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' + +// 获取当前报警列表 +export function getAlarmNowList(params) { + return request({ + url: '/alarm/listNowPage', + method: 'get', + params + }) +} + +// 获取当前报警列表 +export function getAlarmHistoryList(params) { + return request({ + url: '/alarm/listHisPage', + method: 'get', + params + }) +} + + +// 批量消警 +export function clearAll(params) { + return request({ + url: '/alarm/allClear', + method: 'get', + params + }) +} + +// 消警 +export function clearAlarm(params) { + return request({ + url: '/alarm/cancel', + method: 'get', + params + }) +} + +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 设置报警阈值 +export function setThresh(params) { + return request({ + url: '/alarm/resetAlarmRule', + method: 'post', + params + }) +} diff --git a/src/api/system/bridge.js b/src/api/system/bridge.js new file mode 100644 index 0000000..e8a4108 --- /dev/null +++ b/src/api/system/bridge.js @@ -0,0 +1,80 @@ +/** + * 桥梁管理接口 + */ +import request from '@/utils/request' + +// 获取桥梁详情 +export function getDetail(id) { + return request({ + url: '/bridge/detail', + method: 'get', + params: { + id: id + } + }) +} + +export function updateBridge(params) { + return request({ + url: '/bridge/update', + method: 'post', + params + }) +} +// 批量导出 +export function exportRecords(params) { + return request({ + url: 'device/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +export function getContentList(params) { + return request({ + url: 'maintain/contentByType', + method: 'get', + params: { + type: params + } + }) +} +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 编辑 +export function editRecord(params) { + return request({ + url: 'maintain/update', + method: 'post', + params + }) +} +// 新增 +export function addRecord(params) { + return request({ + url: 'maintain/add', + method: 'post', + params + }) +} +// 删除 +export function delRecord(id) { + return request({ + url: 'maintain/delete', + method: 'post', + params: { + id: id + } + }) +} diff --git a/src/api/system/data.js b/src/api/system/data.js new file mode 100644 index 0000000..4c95db5 --- /dev/null +++ b/src/api/system/data.js @@ -0,0 +1,63 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' + +// 获取当前报警列表 +export function getHistoryList(params) { + return request({ + url: '/data/hisListPage', + method: 'get', + params + }) +} + +// 获取当前报警列表 +export function getHistory(params) { + return request({ + url: '/data/hisList', + method: 'get', + params + }) +} + + + +// 批量消警 +export function clearAll(params) { + return request({ + url: '/alarm/allClear', + method: 'get', + params + }) +} + +// 消警 +export function clearAlarm(params) { + return request({ + url: '/alarm/cancel', + method: 'get', + params + }) +} + +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 设置报警阈值 +export function setThresh(params) { + return request({ + url: '/alarm/resetAlarmRule', + method: 'post', + params + }) +} diff --git a/src/api/system/order.js b/src/api/system/order.js new file mode 100644 index 0000000..7007c50 --- /dev/null +++ b/src/api/system/order.js @@ -0,0 +1,71 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +// import qs from 'qs' + +// 获取当前报警列表 +export function getRecordList(params) { + return request({ + url: '/maintain/listPage', + method: 'get', + params + }) +} +// 批量导出 +export function exportRecords(params) { + return request({ + url: 'device/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +export function getContentList(params) { + return request({ + url: 'maintain/contentByType', + method: 'get', + params: { + type: params + } + }) +} +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 编辑 +export function editRecord(params) { + return request({ + url: 'maintain/update', + method: 'post', + params + }) +} +// 新增 +export function addRecord(params) { + return request({ + url: 'maintain/add', + method: 'post', + params + }) +} +// 删除 +export function delRecord(id) { + return request({ + url: 'maintain/delete', + method: 'post', + params: { + bridgeMaintenanceId: id + } + }) +} diff --git a/src/api/system/overview.js b/src/api/system/overview.js new file mode 100644 index 0000000..bca50cc --- /dev/null +++ b/src/api/system/overview.js @@ -0,0 +1,109 @@ +import request from '@/utils/request' +import qs from "qs" +import Vue from 'vue' + +// 路灯状态统计 +export function getLampStatus() { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampStatus', + method: 'get' + }) +} + +// 路灯总览列表 +export function getLampList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampList', + method: 'get', + params + }) +} + +// 路灯详情 +export function getlampDetail(lampId) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampDetail', + method: 'get', + params: { + lampId: lampId + } + }) +} + +// 回路列表 +export function getCircuitList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/circuitList', + method: 'get', + params + }) +} + +// 灯箱列表 +export function getLampBoxList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampBoxList', + method: 'get', + params + }) +} +// 灯箱详情 +export function getLampBoxDetail(lampBoxId) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampBoxDetail', + method: 'get', + params: { + lampBoxId: lampBoxId + } + }) +} + +// 报警总览列表 +export function getAlarmList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/alarmList', + method: 'get', + params + }) +} + +// 报警详情 +export function getAlarmDetail(alarmId) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/alarmDetail', + method: 'get', + params: { + alarmId: alarmId + } + }) +} + +// 路灯控制 +export function lampControl(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampControl', + method: 'post', + params, + paramsSerializer: params => { + return qs.stringify(params, { indices: false }) + } + }) +} diff --git a/src/api/system/rule.js b/src/api/system/rule.js new file mode 100644 index 0000000..76c6b2d --- /dev/null +++ b/src/api/system/rule.js @@ -0,0 +1,59 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +// import qs from 'qs' + +// 获取当前报警列表 +export function getRuleList() { + return request({ + url: 'rule/listPage', + method: 'get' + }) +} +export function getContentList(params) { + return request({ + url: 'maintain/contentByType', + method: 'get', + params: { + type: params + } + }) +} +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 编辑 +export function editRecord(params) { + return request({ + url: 'maintain/update', + method: 'post', + params + }) +} +// 新增 +export function addRecord(params) { + return request({ + url: 'maintain/add', + method: 'post', + params + }) +} +// 删除 +export function delRecord(id) { + return request({ + url: 'maintain/delete', + method: 'post', + params: { + id: id + } + }) +} diff --git a/src/api/system/statistics.js b/src/api/system/statistics.js new file mode 100644 index 0000000..b25efe9 --- /dev/null +++ b/src/api/system/statistics.js @@ -0,0 +1,23 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +// import qs from 'qs' + +// +export function countByToilet(params) { + return request({ + url: '/sanitation/toiletStatistic/jobStaticByToilet', + method: 'get', + params + }) +} + +export function countByDay(params) { + return request({ + url: '/sanitation/toiletStatistic/jobStaticByDate', + method: 'get', + params + }) +} + diff --git a/src/assets/global_images/icon-position.png b/src/assets/global_images/icon-position.png new file mode 100644 index 0000000..7444038 --- /dev/null +++ b/src/assets/global_images/icon-position.png Binary files differ diff --git a/src/assets/global_images/location_green.png b/src/assets/global_images/location_green.png new file mode 100644 index 0000000..aa8be65 --- /dev/null +++ b/src/assets/global_images/location_green.png Binary files differ diff --git a/src/assets/global_images/location_red.png b/src/assets/global_images/location_red.png new file mode 100644 index 0000000..2be8c3d --- /dev/null +++ b/src/assets/global_images/location_red.png Binary files differ diff --git a/src/assets/global_images/location_yellow.png b/src/assets/global_images/location_yellow.png new file mode 100644 index 0000000..5ab6f4d --- /dev/null +++ b/src/assets/global_images/location_yellow.png Binary files differ diff --git a/src/assets/global_images/toilet-position.png b/src/assets/global_images/toilet-position.png new file mode 100644 index 0000000..7db6d9a --- /dev/null +++ b/src/assets/global_images/toilet-position.png Binary files differ diff --git a/src/assets/global_images/toilet.png b/src/assets/global_images/toilet.png new file mode 100644 index 0000000..6d9fc05 --- /dev/null +++ b/src/assets/global_images/toilet.png Binary files differ diff --git a/src/assets/global_images/toiletPhoto.png b/src/assets/global_images/toiletPhoto.png new file mode 100644 index 0000000..15d08e2 --- /dev/null +++ b/src/assets/global_images/toiletPhoto.png Binary files differ diff --git a/src/components/DownloadTemplate/index.vue b/src/components/DownloadTemplate/index.vue index 8ded2cd..7807cac 100644 --- a/src/components/DownloadTemplate/index.vue +++ b/src/components/DownloadTemplate/index.vue @@ -47,8 +47,8 @@ diff --git a/src/components/NormalTable/index.vue b/src/components/NormalTable/index.vue index 5077bef..04d322d 100644 --- a/src/components/NormalTable/index.vue +++ b/src/components/NormalTable/index.vue @@ -79,7 +79,7 @@
-
+
Object.assign(obj, { [key]: this[key] }), {}), + on: events.reduce((obj, key) => Object.assign(obj, { [key]: this.transmitEvent }), {}) + }) + } + this.props = [...extraProps, ...props.filter(prop => exceptProps.indexOf(prop))] + } +} + +export default prop => new Mixin(prop) diff --git a/src/components/mapWindow/base/mixins/common.js b/src/components/mapWindow/base/mixins/common.js new file mode 100644 index 0000000..2fd1a28 --- /dev/null +++ b/src/components/mapWindow/base/mixins/common.js @@ -0,0 +1,82 @@ +const types = { + map: { + unload: 'clearMap' + }, + control: { + unload: 'removeControl' + }, + layer: { + unload: 'removeLayer' + }, + features: { + unload: 'removeFeatures' + }, + listener: { + unload: 'removeListener' + } +} + +const getParent = $component => ($component.abstract || $component.$el === $component.$children[0].$el) ? getParent($component.$parent) : $component + +function destroyInstance () { + const { unload, renderByParent, $parent } = this + if (renderByParent) { + $parent.reload() + } + unload() +} + +class Mixin { + constructor (prop) { + this.methods = { + ready () { + const $parent = getParent(this.$parent) + const map = this.map = $parent.map + this.load() + this.$emit('ready', { + map + }) + }, + transmitEvent (e) { + this.$emit(e.type.replace(/^on/, ''), e) + }, + reload () { + this && this.$nextTick(() => { + this.unload() + this.$nextTick(this.load) + }) + }, + unload () { + const { map, originInstance } = this + try { + switch (prop.type) { + case 'search': + return originInstance.clearResults() + case 'autoComplete': + case 'lushu': + return originInstance.dispose() + case 'markerClusterer': + return originInstance.clearMarkers() + default: + map[types[prop.type].unload](originInstance) + } + } catch (e) {} + } + } + this.computed = { + renderByParent () { + return this.$parent.preventChildrenRender + } + } + this.mounted = function () { + console.log('common mounted') + const $parent = getParent(this.$parent) + const map = $parent.map + const { ready } = this + console.log(map) + map ? ready() : $parent.$on('onload', ready) + } + } +} + +export default type => new Mixin({ type }) diff --git a/src/components/mapWindow/leafletMap.vue b/src/components/mapWindow/leafletMap.vue new file mode 100644 index 0000000..b753cc0 --- /dev/null +++ b/src/components/mapWindow/leafletMap.vue @@ -0,0 +1,143 @@ + + + + + + + diff --git a/src/components/mapWindow/mapWindow.vue b/src/components/mapWindow/mapWindow.vue new file mode 100644 index 0000000..9ced291 --- /dev/null +++ b/src/components/mapWindow/mapWindow.vue @@ -0,0 +1,46 @@ + + + + + + diff --git a/src/icons/svg/bridge.svg b/src/icons/svg/bridge.svg new file mode 100644 index 0000000..1a0336f --- /dev/null +++ b/src/icons/svg/bridge.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/icons/svg/toilet.svg b/src/icons/svg/toilet.svg new file mode 100644 index 0000000..9d8e765 --- /dev/null +++ b/src/icons/svg/toilet.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/main.js b/src/main.js index f2d105d..3e4074e 100644 --- a/src/main.js +++ b/src/main.js @@ -18,6 +18,9 @@ // echart // import echarts from 'echarts' // Vue.prototype.$echarts = echarts +// 引入v-charts +import VCharts from 'v-charts' +Vue.use(VCharts) // 将自动注册所有组件为全局组件 // import dataV from '@jiaminghi/data-view' @@ -35,9 +38,19 @@ Vue.component('search-item', SearchItem) // 加载leaflet的css +// import 'leaflet/dist/leaflet.css' +// import 'leaflet-draw/dist/leaflet.draw.css' +import L from 'leaflet' import 'leaflet/dist/leaflet.css' -import 'leaflet-draw/dist/leaflet.draw.css' +Vue.config.productionTip = false +Vue.L = Vue.prototype.$L = L +delete L.Icon.Default.prototype._getIconUrl +L.Icon.Default.mergeOptions({ + iconRetinaUrl: require('leaflet/dist/images/marker-icon-2x.png'), + iconUrl: require('leaflet/dist/images/marker-icon.png'), + shadowUrl: require('leaflet/dist/images/marker-shadow.png') +}) /** * This project originally used easy-mock to simulate data, * but its official service is very unstable, diff --git a/src/permission.js b/src/permission.js index dc6b2f8..809ca86 100644 --- a/src/permission.js +++ b/src/permission.js @@ -25,8 +25,8 @@ store.dispatch('GetInfo').then(res => { // 拉取用户信息 // 设置当前子系统为基础资源子系统 const currentSys = { - code: 'baseResourse', - name: '基础资源子系统' + code: 'toliet', + name: '公共厕所管理系统' } // 将当前系统信息保存在localStorage中 store.commit('SET_SYSTEM', currentSys) diff --git a/src/router/index.js b/src/router/index.js index 39c295c..d23076d 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -8,8 +8,11 @@ /* Layout */ import Layout from '@/layout/Layout' +import { toiletRouters } from './modules/toilet' +import { workRouters } from './modules/work' +import { statisticsRouters } from './modules/statistics' +import { ruleRouters } from './modules/rule' import { systemRouters } from './modules/system' -import { exampleRouters } from './modules/example' /** * hidden: true if `hidden:true` will not show in the sidebar(default is false) @@ -40,11 +43,12 @@ ] }, // 登录页面 - { path: '/login', component: () => import('@/views/login/index'), hidden: true }, + { path: '/login', component: () => import('@/views/login/index_2'), hidden: true }, // 404错误页面 { path: '/404', component: () => import('@/views/errorPage/404'), hidden: true }, // 401 错误页面 - { path: '/401', component: () => import('@/views/errorPage/401'), hidden: true } + { path: '/401', component: () => import('@/views/errorPage/401'), hidden: true }, + { path: '/', redirect: '/toiletList', hidden: true } ] // 实例化vue的时候直挂载constantRouter export default new Router({ @@ -56,7 +60,10 @@ // 异步挂载路由 // 动态需要根据权限加载的路由表 export const asyncRouterMap = [ - ...exampleRouters, - ...systemRouters, + ...toiletRouters, + ...workRouters, + ...statisticsRouters, + ...ruleRouters, + // ...systemRouters, { path: '*', redirect: '/404', hidden: true } ] diff --git a/src/router/modules/rule.js b/src/router/modules/rule.js new file mode 100644 index 0000000..51e0283 --- /dev/null +++ b/src/router/modules/rule.js @@ -0,0 +1,24 @@ +/* Layout */ +import Layout from '@/layout/Layout' + +export const ruleRouters = [ + { + path: 'rule', + component: Layout, + redirect: '/rule', + name: 'Rule', + meta: { + title: '规章制度', + icon: 'icon-config', // 图标 + permission: ['/rule']// 权限名称 + }, + children: [ + { + path: '/rule', + name: 'Rule', + component: () => import('@/views/rule/listRule'), + meta: { title: '规章制度', icon: 'function', permission: ['/rule'] } + } + ] + } +] diff --git a/src/router/modules/statistics.js b/src/router/modules/statistics.js new file mode 100644 index 0000000..fb9cbea --- /dev/null +++ b/src/router/modules/statistics.js @@ -0,0 +1,30 @@ +/* Layout */ +import Layout from '@/layout/Layout' + +export const statisticsRouters = [ + { + path: 'statisticsToilet', + component: Layout, + redirect: '/workStatistics', + name: 'StatisticsToilet', + meta: { + title: '作业统计', + icon: 'icon-config', // 图标 + permission: ['/statisticsToilet']// 权限名称 + }, + children: [ + { + path: '/workStatistics', + name: 'WorkStatistics', + component: () => import('@/views/statistics/toiletAssessment'), + meta: { title: '作业统计', icon: '', permission: ['/toilet/workStatistics'] } + }, + { + path: '/evaluationStatistics', + name: 'EvaluationStatistics', + component: () => import('@/views/statistics/evaluationAssessment'), + meta: { title: '评价统计', icon: '', permission: ['/toilet/evaluationStatistics'] } + } + ] + } +] diff --git a/src/router/modules/toilet.js b/src/router/modules/toilet.js new file mode 100644 index 0000000..b221a0e --- /dev/null +++ b/src/router/modules/toilet.js @@ -0,0 +1,30 @@ +/* Layout */ +import Layout from '@/layout/Layout' + +export const toiletRouters = [ + { + path: 'toiletManage', + component: Layout, + redirect: '/toiletManage', + name: 'ToiletManage', + meta: { + title: '公厕管理', + icon: 'icon-config', // 图标 + permission: ['/toiletManage']// 权限名称 + }, + children: [ + { + path: '/toiletList', + name: 'ToiletList', + component: () => import('@/views/toiletManage/toiletList'), + meta: { title: '公厕台帐管理', icon: 'function', permission: ['/toiletList'] } + }, + { + path: '/toiletMap', + name: 'ToiletMap', + component: () => import('@/views/overview/overview'), + meta: { title: '地图总览', icon: 'function', permission: ['/toiletMap'] } + } + ] + } +] diff --git a/config/index.js b/config/index.js index 8abd37a..19b33b1 100644 --- a/config/index.js +++ b/config/index.js @@ -69,7 +69,7 @@ * then assetsPublicPath should be set to "/bar/". * In most cases please use '/' !!! */ - assetsPublicPath: '/', + assetsPublicPath: '/toilet/', /** * Source Maps diff --git a/package.json b/package.json index 45f055f..9f3a3eb 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "echarts": "^4.2.1", "element-ui": "2.13.0", "event-source-polyfill": "^1.0.5", + "file-saver": "^2.0.5", "js-cookie": "2.2.0", "jsencrypt": "^3.0.0-rc.1", "leaflet": "^1.7.1", @@ -33,7 +34,9 @@ "vue-amap": "^0.5.9", "vue-baidu-map": "^0.21.22", "vue-router": "3.0.1", - "vuex": "3.0.1" + "vue2-leaflet": "^2.7.0", + "vuex": "3.0.1", + "xlsx": "^0.17.0" }, "devDependencies": { "autoprefixer": "8.5.0", diff --git a/src/api/common.js b/src/api/common.js index 87c582b..7804714 100644 --- a/src/api/common.js +++ b/src/api/common.js @@ -2,10 +2,14 @@ * 常用接口 */ import request from '@/utils/request' +import Vue from 'vue' + // 模板下载 export function downloadTemplate(fileName) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath return request({ - url: 'template/download', + url: lampPath + 'template/download', method: 'get', params: { filename: fileName @@ -19,7 +23,7 @@ const param = new FormData() param.append('file', fileobj.file) return request({ - url: 'imageUpload', + url: 'fileUpload', method: 'post', headers: { 'Content-Type': 'multipart/form-data' }, data: param diff --git a/src/api/sanitation/statistics.js b/src/api/sanitation/statistics.js new file mode 100644 index 0000000..ffeac18 --- /dev/null +++ b/src/api/sanitation/statistics.js @@ -0,0 +1,22 @@ + +/** + * 考核统计接口 + */ +import request from '@/utils/request' +// 公厕保洁次数统计 +export function getToiletJobCount(params) { + return request({ + url: '/sanitation/statistic/toilet/jobCount', + method: 'get', + params + }) +} + +// 公厕评分统计 +export function getToiletEvaluation(params) { + return request({ + url: '/sanitation/toiletEvaluation/statistics', + method: 'get', + params + }) +} diff --git a/src/api/sanitation/toilet.js b/src/api/sanitation/toilet.js new file mode 100644 index 0000000..11affd4 --- /dev/null +++ b/src/api/sanitation/toilet.js @@ -0,0 +1,133 @@ +/** + * 公厕管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' +// 公厕查询 +export function getToiletListPage(params) { + return request({ + url: '/sanitation/toilet/listPage', + method: 'get', + params + }) +} +// 公厕查询 +export function getToiletList(pid) { + return request({ + url: '/sanitation/toilet/list', + method: 'get', + params: { + pid: pid + } + }) +} + +// 添加公厕 +export function addToilet(params) { + return request({ + url: '/sanitation/toilet/add', + method: 'post', + params + }) +} +// 修改公厕机构 +export function updateToilet(params) { + return request({ + url: '/sanitation/toilet/update', + method: 'post', + params + }) +} +// 删除公厕机构 +export function delToilet(ids) { + return request({ + url: '/sanitation/toilet/delete', + method: 'post', + params: { + ids + }, + paramsSerializer: params => { + return qs.stringify(params, { indices: false }) + } + }) +} + +// 公厕基本信息详情 +export function getToiletInfoDetail(id) { + return request({ + url: '/sanitation/toilet/detail?toiletId=' + id, + method: 'get' + }) +} + +// 某公厕保洁记录 +export function getRecordsByToilet(params) { + return request({ + url: '/sanitation/toilet/jobRecord/detail', + method: 'get', + params + }) +} + +// 某公厕平均评分 +export function getScoreByToilet(params) { + return request({ + url: '/sanitation/toiletEvaluation/detailScore', + method: 'get', + params + }) +} + +// 某公厕评分列表 +export function getScoreListByToilet(params) { + return request({ + url: '/sanitation/toiletEvaluation/list', + method: 'get', + params + }) +} + + +// 批量导入 +export function batchImportToilet(fileobj) { + const param = new FormData() + param.append('file', fileobj) + return request({ + url: '/sanitation/toilet/import', + method: 'post', + headers: { 'Content-Type': 'multipart/form-data' }, + data: param + }) +} +// 批量导出 +export function batchExportToilet(params, config) { + return request({ + url: '/sanitation/toilet/export', + method: 'get', + timeout: 120000, + params, + ...config, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 公厕保洁记录查询 +export function getToiletJobRecords(params) { + return request({ + url: '/sanitation/toilet/jobRecord', + method: 'get', + params + }) +} + +// 批量导出 +export function batchExportToiletJobRecords(params, config) { + return request({ + url: '/sanitation/toilet/exportJobRecord', + method: 'get', + timeout: 120000, + params, + ...config, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} diff --git a/src/api/system/alarm.js b/src/api/system/alarm.js new file mode 100644 index 0000000..1c3a7ab --- /dev/null +++ b/src/api/system/alarm.js @@ -0,0 +1,62 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' + +// 获取当前报警列表 +export function getAlarmNowList(params) { + return request({ + url: '/alarm/listNowPage', + method: 'get', + params + }) +} + +// 获取当前报警列表 +export function getAlarmHistoryList(params) { + return request({ + url: '/alarm/listHisPage', + method: 'get', + params + }) +} + + +// 批量消警 +export function clearAll(params) { + return request({ + url: '/alarm/allClear', + method: 'get', + params + }) +} + +// 消警 +export function clearAlarm(params) { + return request({ + url: '/alarm/cancel', + method: 'get', + params + }) +} + +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 设置报警阈值 +export function setThresh(params) { + return request({ + url: '/alarm/resetAlarmRule', + method: 'post', + params + }) +} diff --git a/src/api/system/bridge.js b/src/api/system/bridge.js new file mode 100644 index 0000000..e8a4108 --- /dev/null +++ b/src/api/system/bridge.js @@ -0,0 +1,80 @@ +/** + * 桥梁管理接口 + */ +import request from '@/utils/request' + +// 获取桥梁详情 +export function getDetail(id) { + return request({ + url: '/bridge/detail', + method: 'get', + params: { + id: id + } + }) +} + +export function updateBridge(params) { + return request({ + url: '/bridge/update', + method: 'post', + params + }) +} +// 批量导出 +export function exportRecords(params) { + return request({ + url: 'device/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +export function getContentList(params) { + return request({ + url: 'maintain/contentByType', + method: 'get', + params: { + type: params + } + }) +} +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 编辑 +export function editRecord(params) { + return request({ + url: 'maintain/update', + method: 'post', + params + }) +} +// 新增 +export function addRecord(params) { + return request({ + url: 'maintain/add', + method: 'post', + params + }) +} +// 删除 +export function delRecord(id) { + return request({ + url: 'maintain/delete', + method: 'post', + params: { + id: id + } + }) +} diff --git a/src/api/system/data.js b/src/api/system/data.js new file mode 100644 index 0000000..4c95db5 --- /dev/null +++ b/src/api/system/data.js @@ -0,0 +1,63 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' + +// 获取当前报警列表 +export function getHistoryList(params) { + return request({ + url: '/data/hisListPage', + method: 'get', + params + }) +} + +// 获取当前报警列表 +export function getHistory(params) { + return request({ + url: '/data/hisList', + method: 'get', + params + }) +} + + + +// 批量消警 +export function clearAll(params) { + return request({ + url: '/alarm/allClear', + method: 'get', + params + }) +} + +// 消警 +export function clearAlarm(params) { + return request({ + url: '/alarm/cancel', + method: 'get', + params + }) +} + +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 设置报警阈值 +export function setThresh(params) { + return request({ + url: '/alarm/resetAlarmRule', + method: 'post', + params + }) +} diff --git a/src/api/system/order.js b/src/api/system/order.js new file mode 100644 index 0000000..7007c50 --- /dev/null +++ b/src/api/system/order.js @@ -0,0 +1,71 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +// import qs from 'qs' + +// 获取当前报警列表 +export function getRecordList(params) { + return request({ + url: '/maintain/listPage', + method: 'get', + params + }) +} +// 批量导出 +export function exportRecords(params) { + return request({ + url: 'device/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +export function getContentList(params) { + return request({ + url: 'maintain/contentByType', + method: 'get', + params: { + type: params + } + }) +} +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 编辑 +export function editRecord(params) { + return request({ + url: 'maintain/update', + method: 'post', + params + }) +} +// 新增 +export function addRecord(params) { + return request({ + url: 'maintain/add', + method: 'post', + params + }) +} +// 删除 +export function delRecord(id) { + return request({ + url: 'maintain/delete', + method: 'post', + params: { + bridgeMaintenanceId: id + } + }) +} diff --git a/src/api/system/overview.js b/src/api/system/overview.js new file mode 100644 index 0000000..bca50cc --- /dev/null +++ b/src/api/system/overview.js @@ -0,0 +1,109 @@ +import request from '@/utils/request' +import qs from "qs" +import Vue from 'vue' + +// 路灯状态统计 +export function getLampStatus() { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampStatus', + method: 'get' + }) +} + +// 路灯总览列表 +export function getLampList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampList', + method: 'get', + params + }) +} + +// 路灯详情 +export function getlampDetail(lampId) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampDetail', + method: 'get', + params: { + lampId: lampId + } + }) +} + +// 回路列表 +export function getCircuitList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/circuitList', + method: 'get', + params + }) +} + +// 灯箱列表 +export function getLampBoxList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampBoxList', + method: 'get', + params + }) +} +// 灯箱详情 +export function getLampBoxDetail(lampBoxId) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampBoxDetail', + method: 'get', + params: { + lampBoxId: lampBoxId + } + }) +} + +// 报警总览列表 +export function getAlarmList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/alarmList', + method: 'get', + params + }) +} + +// 报警详情 +export function getAlarmDetail(alarmId) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/alarmDetail', + method: 'get', + params: { + alarmId: alarmId + } + }) +} + +// 路灯控制 +export function lampControl(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampControl', + method: 'post', + params, + paramsSerializer: params => { + return qs.stringify(params, { indices: false }) + } + }) +} diff --git a/src/api/system/rule.js b/src/api/system/rule.js new file mode 100644 index 0000000..76c6b2d --- /dev/null +++ b/src/api/system/rule.js @@ -0,0 +1,59 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +// import qs from 'qs' + +// 获取当前报警列表 +export function getRuleList() { + return request({ + url: 'rule/listPage', + method: 'get' + }) +} +export function getContentList(params) { + return request({ + url: 'maintain/contentByType', + method: 'get', + params: { + type: params + } + }) +} +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 编辑 +export function editRecord(params) { + return request({ + url: 'maintain/update', + method: 'post', + params + }) +} +// 新增 +export function addRecord(params) { + return request({ + url: 'maintain/add', + method: 'post', + params + }) +} +// 删除 +export function delRecord(id) { + return request({ + url: 'maintain/delete', + method: 'post', + params: { + id: id + } + }) +} diff --git a/src/api/system/statistics.js b/src/api/system/statistics.js new file mode 100644 index 0000000..b25efe9 --- /dev/null +++ b/src/api/system/statistics.js @@ -0,0 +1,23 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +// import qs from 'qs' + +// +export function countByToilet(params) { + return request({ + url: '/sanitation/toiletStatistic/jobStaticByToilet', + method: 'get', + params + }) +} + +export function countByDay(params) { + return request({ + url: '/sanitation/toiletStatistic/jobStaticByDate', + method: 'get', + params + }) +} + diff --git a/src/assets/global_images/icon-position.png b/src/assets/global_images/icon-position.png new file mode 100644 index 0000000..7444038 --- /dev/null +++ b/src/assets/global_images/icon-position.png Binary files differ diff --git a/src/assets/global_images/location_green.png b/src/assets/global_images/location_green.png new file mode 100644 index 0000000..aa8be65 --- /dev/null +++ b/src/assets/global_images/location_green.png Binary files differ diff --git a/src/assets/global_images/location_red.png b/src/assets/global_images/location_red.png new file mode 100644 index 0000000..2be8c3d --- /dev/null +++ b/src/assets/global_images/location_red.png Binary files differ diff --git a/src/assets/global_images/location_yellow.png b/src/assets/global_images/location_yellow.png new file mode 100644 index 0000000..5ab6f4d --- /dev/null +++ b/src/assets/global_images/location_yellow.png Binary files differ diff --git a/src/assets/global_images/toilet-position.png b/src/assets/global_images/toilet-position.png new file mode 100644 index 0000000..7db6d9a --- /dev/null +++ b/src/assets/global_images/toilet-position.png Binary files differ diff --git a/src/assets/global_images/toilet.png b/src/assets/global_images/toilet.png new file mode 100644 index 0000000..6d9fc05 --- /dev/null +++ b/src/assets/global_images/toilet.png Binary files differ diff --git a/src/assets/global_images/toiletPhoto.png b/src/assets/global_images/toiletPhoto.png new file mode 100644 index 0000000..15d08e2 --- /dev/null +++ b/src/assets/global_images/toiletPhoto.png Binary files differ diff --git a/src/components/DownloadTemplate/index.vue b/src/components/DownloadTemplate/index.vue index 8ded2cd..7807cac 100644 --- a/src/components/DownloadTemplate/index.vue +++ b/src/components/DownloadTemplate/index.vue @@ -47,8 +47,8 @@ diff --git a/src/components/NormalTable/index.vue b/src/components/NormalTable/index.vue index 5077bef..04d322d 100644 --- a/src/components/NormalTable/index.vue +++ b/src/components/NormalTable/index.vue @@ -79,7 +79,7 @@
-
+
Object.assign(obj, { [key]: this[key] }), {}), + on: events.reduce((obj, key) => Object.assign(obj, { [key]: this.transmitEvent }), {}) + }) + } + this.props = [...extraProps, ...props.filter(prop => exceptProps.indexOf(prop))] + } +} + +export default prop => new Mixin(prop) diff --git a/src/components/mapWindow/base/mixins/common.js b/src/components/mapWindow/base/mixins/common.js new file mode 100644 index 0000000..2fd1a28 --- /dev/null +++ b/src/components/mapWindow/base/mixins/common.js @@ -0,0 +1,82 @@ +const types = { + map: { + unload: 'clearMap' + }, + control: { + unload: 'removeControl' + }, + layer: { + unload: 'removeLayer' + }, + features: { + unload: 'removeFeatures' + }, + listener: { + unload: 'removeListener' + } +} + +const getParent = $component => ($component.abstract || $component.$el === $component.$children[0].$el) ? getParent($component.$parent) : $component + +function destroyInstance () { + const { unload, renderByParent, $parent } = this + if (renderByParent) { + $parent.reload() + } + unload() +} + +class Mixin { + constructor (prop) { + this.methods = { + ready () { + const $parent = getParent(this.$parent) + const map = this.map = $parent.map + this.load() + this.$emit('ready', { + map + }) + }, + transmitEvent (e) { + this.$emit(e.type.replace(/^on/, ''), e) + }, + reload () { + this && this.$nextTick(() => { + this.unload() + this.$nextTick(this.load) + }) + }, + unload () { + const { map, originInstance } = this + try { + switch (prop.type) { + case 'search': + return originInstance.clearResults() + case 'autoComplete': + case 'lushu': + return originInstance.dispose() + case 'markerClusterer': + return originInstance.clearMarkers() + default: + map[types[prop.type].unload](originInstance) + } + } catch (e) {} + } + } + this.computed = { + renderByParent () { + return this.$parent.preventChildrenRender + } + } + this.mounted = function () { + console.log('common mounted') + const $parent = getParent(this.$parent) + const map = $parent.map + const { ready } = this + console.log(map) + map ? ready() : $parent.$on('onload', ready) + } + } +} + +export default type => new Mixin({ type }) diff --git a/src/components/mapWindow/leafletMap.vue b/src/components/mapWindow/leafletMap.vue new file mode 100644 index 0000000..b753cc0 --- /dev/null +++ b/src/components/mapWindow/leafletMap.vue @@ -0,0 +1,143 @@ + + + + + + + diff --git a/src/components/mapWindow/mapWindow.vue b/src/components/mapWindow/mapWindow.vue new file mode 100644 index 0000000..9ced291 --- /dev/null +++ b/src/components/mapWindow/mapWindow.vue @@ -0,0 +1,46 @@ + + + + + + diff --git a/src/icons/svg/bridge.svg b/src/icons/svg/bridge.svg new file mode 100644 index 0000000..1a0336f --- /dev/null +++ b/src/icons/svg/bridge.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/icons/svg/toilet.svg b/src/icons/svg/toilet.svg new file mode 100644 index 0000000..9d8e765 --- /dev/null +++ b/src/icons/svg/toilet.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/main.js b/src/main.js index f2d105d..3e4074e 100644 --- a/src/main.js +++ b/src/main.js @@ -18,6 +18,9 @@ // echart // import echarts from 'echarts' // Vue.prototype.$echarts = echarts +// 引入v-charts +import VCharts from 'v-charts' +Vue.use(VCharts) // 将自动注册所有组件为全局组件 // import dataV from '@jiaminghi/data-view' @@ -35,9 +38,19 @@ Vue.component('search-item', SearchItem) // 加载leaflet的css +// import 'leaflet/dist/leaflet.css' +// import 'leaflet-draw/dist/leaflet.draw.css' +import L from 'leaflet' import 'leaflet/dist/leaflet.css' -import 'leaflet-draw/dist/leaflet.draw.css' +Vue.config.productionTip = false +Vue.L = Vue.prototype.$L = L +delete L.Icon.Default.prototype._getIconUrl +L.Icon.Default.mergeOptions({ + iconRetinaUrl: require('leaflet/dist/images/marker-icon-2x.png'), + iconUrl: require('leaflet/dist/images/marker-icon.png'), + shadowUrl: require('leaflet/dist/images/marker-shadow.png') +}) /** * This project originally used easy-mock to simulate data, * but its official service is very unstable, diff --git a/src/permission.js b/src/permission.js index dc6b2f8..809ca86 100644 --- a/src/permission.js +++ b/src/permission.js @@ -25,8 +25,8 @@ store.dispatch('GetInfo').then(res => { // 拉取用户信息 // 设置当前子系统为基础资源子系统 const currentSys = { - code: 'baseResourse', - name: '基础资源子系统' + code: 'toliet', + name: '公共厕所管理系统' } // 将当前系统信息保存在localStorage中 store.commit('SET_SYSTEM', currentSys) diff --git a/src/router/index.js b/src/router/index.js index 39c295c..d23076d 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -8,8 +8,11 @@ /* Layout */ import Layout from '@/layout/Layout' +import { toiletRouters } from './modules/toilet' +import { workRouters } from './modules/work' +import { statisticsRouters } from './modules/statistics' +import { ruleRouters } from './modules/rule' import { systemRouters } from './modules/system' -import { exampleRouters } from './modules/example' /** * hidden: true if `hidden:true` will not show in the sidebar(default is false) @@ -40,11 +43,12 @@ ] }, // 登录页面 - { path: '/login', component: () => import('@/views/login/index'), hidden: true }, + { path: '/login', component: () => import('@/views/login/index_2'), hidden: true }, // 404错误页面 { path: '/404', component: () => import('@/views/errorPage/404'), hidden: true }, // 401 错误页面 - { path: '/401', component: () => import('@/views/errorPage/401'), hidden: true } + { path: '/401', component: () => import('@/views/errorPage/401'), hidden: true }, + { path: '/', redirect: '/toiletList', hidden: true } ] // 实例化vue的时候直挂载constantRouter export default new Router({ @@ -56,7 +60,10 @@ // 异步挂载路由 // 动态需要根据权限加载的路由表 export const asyncRouterMap = [ - ...exampleRouters, - ...systemRouters, + ...toiletRouters, + ...workRouters, + ...statisticsRouters, + ...ruleRouters, + // ...systemRouters, { path: '*', redirect: '/404', hidden: true } ] diff --git a/src/router/modules/rule.js b/src/router/modules/rule.js new file mode 100644 index 0000000..51e0283 --- /dev/null +++ b/src/router/modules/rule.js @@ -0,0 +1,24 @@ +/* Layout */ +import Layout from '@/layout/Layout' + +export const ruleRouters = [ + { + path: 'rule', + component: Layout, + redirect: '/rule', + name: 'Rule', + meta: { + title: '规章制度', + icon: 'icon-config', // 图标 + permission: ['/rule']// 权限名称 + }, + children: [ + { + path: '/rule', + name: 'Rule', + component: () => import('@/views/rule/listRule'), + meta: { title: '规章制度', icon: 'function', permission: ['/rule'] } + } + ] + } +] diff --git a/src/router/modules/statistics.js b/src/router/modules/statistics.js new file mode 100644 index 0000000..fb9cbea --- /dev/null +++ b/src/router/modules/statistics.js @@ -0,0 +1,30 @@ +/* Layout */ +import Layout from '@/layout/Layout' + +export const statisticsRouters = [ + { + path: 'statisticsToilet', + component: Layout, + redirect: '/workStatistics', + name: 'StatisticsToilet', + meta: { + title: '作业统计', + icon: 'icon-config', // 图标 + permission: ['/statisticsToilet']// 权限名称 + }, + children: [ + { + path: '/workStatistics', + name: 'WorkStatistics', + component: () => import('@/views/statistics/toiletAssessment'), + meta: { title: '作业统计', icon: '', permission: ['/toilet/workStatistics'] } + }, + { + path: '/evaluationStatistics', + name: 'EvaluationStatistics', + component: () => import('@/views/statistics/evaluationAssessment'), + meta: { title: '评价统计', icon: '', permission: ['/toilet/evaluationStatistics'] } + } + ] + } +] diff --git a/src/router/modules/toilet.js b/src/router/modules/toilet.js new file mode 100644 index 0000000..b221a0e --- /dev/null +++ b/src/router/modules/toilet.js @@ -0,0 +1,30 @@ +/* Layout */ +import Layout from '@/layout/Layout' + +export const toiletRouters = [ + { + path: 'toiletManage', + component: Layout, + redirect: '/toiletManage', + name: 'ToiletManage', + meta: { + title: '公厕管理', + icon: 'icon-config', // 图标 + permission: ['/toiletManage']// 权限名称 + }, + children: [ + { + path: '/toiletList', + name: 'ToiletList', + component: () => import('@/views/toiletManage/toiletList'), + meta: { title: '公厕台帐管理', icon: 'function', permission: ['/toiletList'] } + }, + { + path: '/toiletMap', + name: 'ToiletMap', + component: () => import('@/views/overview/overview'), + meta: { title: '地图总览', icon: 'function', permission: ['/toiletMap'] } + } + ] + } +] diff --git a/src/router/modules/work.js b/src/router/modules/work.js new file mode 100644 index 0000000..5e0759f --- /dev/null +++ b/src/router/modules/work.js @@ -0,0 +1,24 @@ +/* Layout */ +import Layout from '@/layout/Layout' + +export const workRouters = [ + { + path: 'toiletWork', + component: Layout, + redirect: '/toiletManage', + name: 'toiletWork', + meta: { + title: '作业管理', + icon: 'icon-config', // 图标 + permission: ['/toiletWork']// 权限名称 + }, + children: [ + { + path: '/toiletWork', + name: 'ToiletWork', + component: () => import('@/views/toiletClean/toiletCleanList'), + meta: { title: '作业管理', icon: 'function', permission: ['/toiletWork'] } + } + ] + } +] diff --git a/config/index.js b/config/index.js index 8abd37a..19b33b1 100644 --- a/config/index.js +++ b/config/index.js @@ -69,7 +69,7 @@ * then assetsPublicPath should be set to "/bar/". * In most cases please use '/' !!! */ - assetsPublicPath: '/', + assetsPublicPath: '/toilet/', /** * Source Maps diff --git a/package.json b/package.json index 45f055f..9f3a3eb 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "echarts": "^4.2.1", "element-ui": "2.13.0", "event-source-polyfill": "^1.0.5", + "file-saver": "^2.0.5", "js-cookie": "2.2.0", "jsencrypt": "^3.0.0-rc.1", "leaflet": "^1.7.1", @@ -33,7 +34,9 @@ "vue-amap": "^0.5.9", "vue-baidu-map": "^0.21.22", "vue-router": "3.0.1", - "vuex": "3.0.1" + "vue2-leaflet": "^2.7.0", + "vuex": "3.0.1", + "xlsx": "^0.17.0" }, "devDependencies": { "autoprefixer": "8.5.0", diff --git a/src/api/common.js b/src/api/common.js index 87c582b..7804714 100644 --- a/src/api/common.js +++ b/src/api/common.js @@ -2,10 +2,14 @@ * 常用接口 */ import request from '@/utils/request' +import Vue from 'vue' + // 模板下载 export function downloadTemplate(fileName) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath return request({ - url: 'template/download', + url: lampPath + 'template/download', method: 'get', params: { filename: fileName @@ -19,7 +23,7 @@ const param = new FormData() param.append('file', fileobj.file) return request({ - url: 'imageUpload', + url: 'fileUpload', method: 'post', headers: { 'Content-Type': 'multipart/form-data' }, data: param diff --git a/src/api/sanitation/statistics.js b/src/api/sanitation/statistics.js new file mode 100644 index 0000000..ffeac18 --- /dev/null +++ b/src/api/sanitation/statistics.js @@ -0,0 +1,22 @@ + +/** + * 考核统计接口 + */ +import request from '@/utils/request' +// 公厕保洁次数统计 +export function getToiletJobCount(params) { + return request({ + url: '/sanitation/statistic/toilet/jobCount', + method: 'get', + params + }) +} + +// 公厕评分统计 +export function getToiletEvaluation(params) { + return request({ + url: '/sanitation/toiletEvaluation/statistics', + method: 'get', + params + }) +} diff --git a/src/api/sanitation/toilet.js b/src/api/sanitation/toilet.js new file mode 100644 index 0000000..11affd4 --- /dev/null +++ b/src/api/sanitation/toilet.js @@ -0,0 +1,133 @@ +/** + * 公厕管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' +// 公厕查询 +export function getToiletListPage(params) { + return request({ + url: '/sanitation/toilet/listPage', + method: 'get', + params + }) +} +// 公厕查询 +export function getToiletList(pid) { + return request({ + url: '/sanitation/toilet/list', + method: 'get', + params: { + pid: pid + } + }) +} + +// 添加公厕 +export function addToilet(params) { + return request({ + url: '/sanitation/toilet/add', + method: 'post', + params + }) +} +// 修改公厕机构 +export function updateToilet(params) { + return request({ + url: '/sanitation/toilet/update', + method: 'post', + params + }) +} +// 删除公厕机构 +export function delToilet(ids) { + return request({ + url: '/sanitation/toilet/delete', + method: 'post', + params: { + ids + }, + paramsSerializer: params => { + return qs.stringify(params, { indices: false }) + } + }) +} + +// 公厕基本信息详情 +export function getToiletInfoDetail(id) { + return request({ + url: '/sanitation/toilet/detail?toiletId=' + id, + method: 'get' + }) +} + +// 某公厕保洁记录 +export function getRecordsByToilet(params) { + return request({ + url: '/sanitation/toilet/jobRecord/detail', + method: 'get', + params + }) +} + +// 某公厕平均评分 +export function getScoreByToilet(params) { + return request({ + url: '/sanitation/toiletEvaluation/detailScore', + method: 'get', + params + }) +} + +// 某公厕评分列表 +export function getScoreListByToilet(params) { + return request({ + url: '/sanitation/toiletEvaluation/list', + method: 'get', + params + }) +} + + +// 批量导入 +export function batchImportToilet(fileobj) { + const param = new FormData() + param.append('file', fileobj) + return request({ + url: '/sanitation/toilet/import', + method: 'post', + headers: { 'Content-Type': 'multipart/form-data' }, + data: param + }) +} +// 批量导出 +export function batchExportToilet(params, config) { + return request({ + url: '/sanitation/toilet/export', + method: 'get', + timeout: 120000, + params, + ...config, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 公厕保洁记录查询 +export function getToiletJobRecords(params) { + return request({ + url: '/sanitation/toilet/jobRecord', + method: 'get', + params + }) +} + +// 批量导出 +export function batchExportToiletJobRecords(params, config) { + return request({ + url: '/sanitation/toilet/exportJobRecord', + method: 'get', + timeout: 120000, + params, + ...config, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} diff --git a/src/api/system/alarm.js b/src/api/system/alarm.js new file mode 100644 index 0000000..1c3a7ab --- /dev/null +++ b/src/api/system/alarm.js @@ -0,0 +1,62 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' + +// 获取当前报警列表 +export function getAlarmNowList(params) { + return request({ + url: '/alarm/listNowPage', + method: 'get', + params + }) +} + +// 获取当前报警列表 +export function getAlarmHistoryList(params) { + return request({ + url: '/alarm/listHisPage', + method: 'get', + params + }) +} + + +// 批量消警 +export function clearAll(params) { + return request({ + url: '/alarm/allClear', + method: 'get', + params + }) +} + +// 消警 +export function clearAlarm(params) { + return request({ + url: '/alarm/cancel', + method: 'get', + params + }) +} + +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 设置报警阈值 +export function setThresh(params) { + return request({ + url: '/alarm/resetAlarmRule', + method: 'post', + params + }) +} diff --git a/src/api/system/bridge.js b/src/api/system/bridge.js new file mode 100644 index 0000000..e8a4108 --- /dev/null +++ b/src/api/system/bridge.js @@ -0,0 +1,80 @@ +/** + * 桥梁管理接口 + */ +import request from '@/utils/request' + +// 获取桥梁详情 +export function getDetail(id) { + return request({ + url: '/bridge/detail', + method: 'get', + params: { + id: id + } + }) +} + +export function updateBridge(params) { + return request({ + url: '/bridge/update', + method: 'post', + params + }) +} +// 批量导出 +export function exportRecords(params) { + return request({ + url: 'device/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +export function getContentList(params) { + return request({ + url: 'maintain/contentByType', + method: 'get', + params: { + type: params + } + }) +} +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 编辑 +export function editRecord(params) { + return request({ + url: 'maintain/update', + method: 'post', + params + }) +} +// 新增 +export function addRecord(params) { + return request({ + url: 'maintain/add', + method: 'post', + params + }) +} +// 删除 +export function delRecord(id) { + return request({ + url: 'maintain/delete', + method: 'post', + params: { + id: id + } + }) +} diff --git a/src/api/system/data.js b/src/api/system/data.js new file mode 100644 index 0000000..4c95db5 --- /dev/null +++ b/src/api/system/data.js @@ -0,0 +1,63 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' + +// 获取当前报警列表 +export function getHistoryList(params) { + return request({ + url: '/data/hisListPage', + method: 'get', + params + }) +} + +// 获取当前报警列表 +export function getHistory(params) { + return request({ + url: '/data/hisList', + method: 'get', + params + }) +} + + + +// 批量消警 +export function clearAll(params) { + return request({ + url: '/alarm/allClear', + method: 'get', + params + }) +} + +// 消警 +export function clearAlarm(params) { + return request({ + url: '/alarm/cancel', + method: 'get', + params + }) +} + +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 设置报警阈值 +export function setThresh(params) { + return request({ + url: '/alarm/resetAlarmRule', + method: 'post', + params + }) +} diff --git a/src/api/system/order.js b/src/api/system/order.js new file mode 100644 index 0000000..7007c50 --- /dev/null +++ b/src/api/system/order.js @@ -0,0 +1,71 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +// import qs from 'qs' + +// 获取当前报警列表 +export function getRecordList(params) { + return request({ + url: '/maintain/listPage', + method: 'get', + params + }) +} +// 批量导出 +export function exportRecords(params) { + return request({ + url: 'device/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +export function getContentList(params) { + return request({ + url: 'maintain/contentByType', + method: 'get', + params: { + type: params + } + }) +} +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 编辑 +export function editRecord(params) { + return request({ + url: 'maintain/update', + method: 'post', + params + }) +} +// 新增 +export function addRecord(params) { + return request({ + url: 'maintain/add', + method: 'post', + params + }) +} +// 删除 +export function delRecord(id) { + return request({ + url: 'maintain/delete', + method: 'post', + params: { + bridgeMaintenanceId: id + } + }) +} diff --git a/src/api/system/overview.js b/src/api/system/overview.js new file mode 100644 index 0000000..bca50cc --- /dev/null +++ b/src/api/system/overview.js @@ -0,0 +1,109 @@ +import request from '@/utils/request' +import qs from "qs" +import Vue from 'vue' + +// 路灯状态统计 +export function getLampStatus() { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampStatus', + method: 'get' + }) +} + +// 路灯总览列表 +export function getLampList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampList', + method: 'get', + params + }) +} + +// 路灯详情 +export function getlampDetail(lampId) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampDetail', + method: 'get', + params: { + lampId: lampId + } + }) +} + +// 回路列表 +export function getCircuitList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/circuitList', + method: 'get', + params + }) +} + +// 灯箱列表 +export function getLampBoxList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampBoxList', + method: 'get', + params + }) +} +// 灯箱详情 +export function getLampBoxDetail(lampBoxId) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampBoxDetail', + method: 'get', + params: { + lampBoxId: lampBoxId + } + }) +} + +// 报警总览列表 +export function getAlarmList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/alarmList', + method: 'get', + params + }) +} + +// 报警详情 +export function getAlarmDetail(alarmId) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/alarmDetail', + method: 'get', + params: { + alarmId: alarmId + } + }) +} + +// 路灯控制 +export function lampControl(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampControl', + method: 'post', + params, + paramsSerializer: params => { + return qs.stringify(params, { indices: false }) + } + }) +} diff --git a/src/api/system/rule.js b/src/api/system/rule.js new file mode 100644 index 0000000..76c6b2d --- /dev/null +++ b/src/api/system/rule.js @@ -0,0 +1,59 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +// import qs from 'qs' + +// 获取当前报警列表 +export function getRuleList() { + return request({ + url: 'rule/listPage', + method: 'get' + }) +} +export function getContentList(params) { + return request({ + url: 'maintain/contentByType', + method: 'get', + params: { + type: params + } + }) +} +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 编辑 +export function editRecord(params) { + return request({ + url: 'maintain/update', + method: 'post', + params + }) +} +// 新增 +export function addRecord(params) { + return request({ + url: 'maintain/add', + method: 'post', + params + }) +} +// 删除 +export function delRecord(id) { + return request({ + url: 'maintain/delete', + method: 'post', + params: { + id: id + } + }) +} diff --git a/src/api/system/statistics.js b/src/api/system/statistics.js new file mode 100644 index 0000000..b25efe9 --- /dev/null +++ b/src/api/system/statistics.js @@ -0,0 +1,23 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +// import qs from 'qs' + +// +export function countByToilet(params) { + return request({ + url: '/sanitation/toiletStatistic/jobStaticByToilet', + method: 'get', + params + }) +} + +export function countByDay(params) { + return request({ + url: '/sanitation/toiletStatistic/jobStaticByDate', + method: 'get', + params + }) +} + diff --git a/src/assets/global_images/icon-position.png b/src/assets/global_images/icon-position.png new file mode 100644 index 0000000..7444038 --- /dev/null +++ b/src/assets/global_images/icon-position.png Binary files differ diff --git a/src/assets/global_images/location_green.png b/src/assets/global_images/location_green.png new file mode 100644 index 0000000..aa8be65 --- /dev/null +++ b/src/assets/global_images/location_green.png Binary files differ diff --git a/src/assets/global_images/location_red.png b/src/assets/global_images/location_red.png new file mode 100644 index 0000000..2be8c3d --- /dev/null +++ b/src/assets/global_images/location_red.png Binary files differ diff --git a/src/assets/global_images/location_yellow.png b/src/assets/global_images/location_yellow.png new file mode 100644 index 0000000..5ab6f4d --- /dev/null +++ b/src/assets/global_images/location_yellow.png Binary files differ diff --git a/src/assets/global_images/toilet-position.png b/src/assets/global_images/toilet-position.png new file mode 100644 index 0000000..7db6d9a --- /dev/null +++ b/src/assets/global_images/toilet-position.png Binary files differ diff --git a/src/assets/global_images/toilet.png b/src/assets/global_images/toilet.png new file mode 100644 index 0000000..6d9fc05 --- /dev/null +++ b/src/assets/global_images/toilet.png Binary files differ diff --git a/src/assets/global_images/toiletPhoto.png b/src/assets/global_images/toiletPhoto.png new file mode 100644 index 0000000..15d08e2 --- /dev/null +++ b/src/assets/global_images/toiletPhoto.png Binary files differ diff --git a/src/components/DownloadTemplate/index.vue b/src/components/DownloadTemplate/index.vue index 8ded2cd..7807cac 100644 --- a/src/components/DownloadTemplate/index.vue +++ b/src/components/DownloadTemplate/index.vue @@ -47,8 +47,8 @@ diff --git a/src/components/NormalTable/index.vue b/src/components/NormalTable/index.vue index 5077bef..04d322d 100644 --- a/src/components/NormalTable/index.vue +++ b/src/components/NormalTable/index.vue @@ -79,7 +79,7 @@
-
+
Object.assign(obj, { [key]: this[key] }), {}), + on: events.reduce((obj, key) => Object.assign(obj, { [key]: this.transmitEvent }), {}) + }) + } + this.props = [...extraProps, ...props.filter(prop => exceptProps.indexOf(prop))] + } +} + +export default prop => new Mixin(prop) diff --git a/src/components/mapWindow/base/mixins/common.js b/src/components/mapWindow/base/mixins/common.js new file mode 100644 index 0000000..2fd1a28 --- /dev/null +++ b/src/components/mapWindow/base/mixins/common.js @@ -0,0 +1,82 @@ +const types = { + map: { + unload: 'clearMap' + }, + control: { + unload: 'removeControl' + }, + layer: { + unload: 'removeLayer' + }, + features: { + unload: 'removeFeatures' + }, + listener: { + unload: 'removeListener' + } +} + +const getParent = $component => ($component.abstract || $component.$el === $component.$children[0].$el) ? getParent($component.$parent) : $component + +function destroyInstance () { + const { unload, renderByParent, $parent } = this + if (renderByParent) { + $parent.reload() + } + unload() +} + +class Mixin { + constructor (prop) { + this.methods = { + ready () { + const $parent = getParent(this.$parent) + const map = this.map = $parent.map + this.load() + this.$emit('ready', { + map + }) + }, + transmitEvent (e) { + this.$emit(e.type.replace(/^on/, ''), e) + }, + reload () { + this && this.$nextTick(() => { + this.unload() + this.$nextTick(this.load) + }) + }, + unload () { + const { map, originInstance } = this + try { + switch (prop.type) { + case 'search': + return originInstance.clearResults() + case 'autoComplete': + case 'lushu': + return originInstance.dispose() + case 'markerClusterer': + return originInstance.clearMarkers() + default: + map[types[prop.type].unload](originInstance) + } + } catch (e) {} + } + } + this.computed = { + renderByParent () { + return this.$parent.preventChildrenRender + } + } + this.mounted = function () { + console.log('common mounted') + const $parent = getParent(this.$parent) + const map = $parent.map + const { ready } = this + console.log(map) + map ? ready() : $parent.$on('onload', ready) + } + } +} + +export default type => new Mixin({ type }) diff --git a/src/components/mapWindow/leafletMap.vue b/src/components/mapWindow/leafletMap.vue new file mode 100644 index 0000000..b753cc0 --- /dev/null +++ b/src/components/mapWindow/leafletMap.vue @@ -0,0 +1,143 @@ + + + + + + + diff --git a/src/components/mapWindow/mapWindow.vue b/src/components/mapWindow/mapWindow.vue new file mode 100644 index 0000000..9ced291 --- /dev/null +++ b/src/components/mapWindow/mapWindow.vue @@ -0,0 +1,46 @@ + + + + + + diff --git a/src/icons/svg/bridge.svg b/src/icons/svg/bridge.svg new file mode 100644 index 0000000..1a0336f --- /dev/null +++ b/src/icons/svg/bridge.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/icons/svg/toilet.svg b/src/icons/svg/toilet.svg new file mode 100644 index 0000000..9d8e765 --- /dev/null +++ b/src/icons/svg/toilet.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/main.js b/src/main.js index f2d105d..3e4074e 100644 --- a/src/main.js +++ b/src/main.js @@ -18,6 +18,9 @@ // echart // import echarts from 'echarts' // Vue.prototype.$echarts = echarts +// 引入v-charts +import VCharts from 'v-charts' +Vue.use(VCharts) // 将自动注册所有组件为全局组件 // import dataV from '@jiaminghi/data-view' @@ -35,9 +38,19 @@ Vue.component('search-item', SearchItem) // 加载leaflet的css +// import 'leaflet/dist/leaflet.css' +// import 'leaflet-draw/dist/leaflet.draw.css' +import L from 'leaflet' import 'leaflet/dist/leaflet.css' -import 'leaflet-draw/dist/leaflet.draw.css' +Vue.config.productionTip = false +Vue.L = Vue.prototype.$L = L +delete L.Icon.Default.prototype._getIconUrl +L.Icon.Default.mergeOptions({ + iconRetinaUrl: require('leaflet/dist/images/marker-icon-2x.png'), + iconUrl: require('leaflet/dist/images/marker-icon.png'), + shadowUrl: require('leaflet/dist/images/marker-shadow.png') +}) /** * This project originally used easy-mock to simulate data, * but its official service is very unstable, diff --git a/src/permission.js b/src/permission.js index dc6b2f8..809ca86 100644 --- a/src/permission.js +++ b/src/permission.js @@ -25,8 +25,8 @@ store.dispatch('GetInfo').then(res => { // 拉取用户信息 // 设置当前子系统为基础资源子系统 const currentSys = { - code: 'baseResourse', - name: '基础资源子系统' + code: 'toliet', + name: '公共厕所管理系统' } // 将当前系统信息保存在localStorage中 store.commit('SET_SYSTEM', currentSys) diff --git a/src/router/index.js b/src/router/index.js index 39c295c..d23076d 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -8,8 +8,11 @@ /* Layout */ import Layout from '@/layout/Layout' +import { toiletRouters } from './modules/toilet' +import { workRouters } from './modules/work' +import { statisticsRouters } from './modules/statistics' +import { ruleRouters } from './modules/rule' import { systemRouters } from './modules/system' -import { exampleRouters } from './modules/example' /** * hidden: true if `hidden:true` will not show in the sidebar(default is false) @@ -40,11 +43,12 @@ ] }, // 登录页面 - { path: '/login', component: () => import('@/views/login/index'), hidden: true }, + { path: '/login', component: () => import('@/views/login/index_2'), hidden: true }, // 404错误页面 { path: '/404', component: () => import('@/views/errorPage/404'), hidden: true }, // 401 错误页面 - { path: '/401', component: () => import('@/views/errorPage/401'), hidden: true } + { path: '/401', component: () => import('@/views/errorPage/401'), hidden: true }, + { path: '/', redirect: '/toiletList', hidden: true } ] // 实例化vue的时候直挂载constantRouter export default new Router({ @@ -56,7 +60,10 @@ // 异步挂载路由 // 动态需要根据权限加载的路由表 export const asyncRouterMap = [ - ...exampleRouters, - ...systemRouters, + ...toiletRouters, + ...workRouters, + ...statisticsRouters, + ...ruleRouters, + // ...systemRouters, { path: '*', redirect: '/404', hidden: true } ] diff --git a/src/router/modules/rule.js b/src/router/modules/rule.js new file mode 100644 index 0000000..51e0283 --- /dev/null +++ b/src/router/modules/rule.js @@ -0,0 +1,24 @@ +/* Layout */ +import Layout from '@/layout/Layout' + +export const ruleRouters = [ + { + path: 'rule', + component: Layout, + redirect: '/rule', + name: 'Rule', + meta: { + title: '规章制度', + icon: 'icon-config', // 图标 + permission: ['/rule']// 权限名称 + }, + children: [ + { + path: '/rule', + name: 'Rule', + component: () => import('@/views/rule/listRule'), + meta: { title: '规章制度', icon: 'function', permission: ['/rule'] } + } + ] + } +] diff --git a/src/router/modules/statistics.js b/src/router/modules/statistics.js new file mode 100644 index 0000000..fb9cbea --- /dev/null +++ b/src/router/modules/statistics.js @@ -0,0 +1,30 @@ +/* Layout */ +import Layout from '@/layout/Layout' + +export const statisticsRouters = [ + { + path: 'statisticsToilet', + component: Layout, + redirect: '/workStatistics', + name: 'StatisticsToilet', + meta: { + title: '作业统计', + icon: 'icon-config', // 图标 + permission: ['/statisticsToilet']// 权限名称 + }, + children: [ + { + path: '/workStatistics', + name: 'WorkStatistics', + component: () => import('@/views/statistics/toiletAssessment'), + meta: { title: '作业统计', icon: '', permission: ['/toilet/workStatistics'] } + }, + { + path: '/evaluationStatistics', + name: 'EvaluationStatistics', + component: () => import('@/views/statistics/evaluationAssessment'), + meta: { title: '评价统计', icon: '', permission: ['/toilet/evaluationStatistics'] } + } + ] + } +] diff --git a/src/router/modules/toilet.js b/src/router/modules/toilet.js new file mode 100644 index 0000000..b221a0e --- /dev/null +++ b/src/router/modules/toilet.js @@ -0,0 +1,30 @@ +/* Layout */ +import Layout from '@/layout/Layout' + +export const toiletRouters = [ + { + path: 'toiletManage', + component: Layout, + redirect: '/toiletManage', + name: 'ToiletManage', + meta: { + title: '公厕管理', + icon: 'icon-config', // 图标 + permission: ['/toiletManage']// 权限名称 + }, + children: [ + { + path: '/toiletList', + name: 'ToiletList', + component: () => import('@/views/toiletManage/toiletList'), + meta: { title: '公厕台帐管理', icon: 'function', permission: ['/toiletList'] } + }, + { + path: '/toiletMap', + name: 'ToiletMap', + component: () => import('@/views/overview/overview'), + meta: { title: '地图总览', icon: 'function', permission: ['/toiletMap'] } + } + ] + } +] diff --git a/src/router/modules/work.js b/src/router/modules/work.js new file mode 100644 index 0000000..5e0759f --- /dev/null +++ b/src/router/modules/work.js @@ -0,0 +1,24 @@ +/* Layout */ +import Layout from '@/layout/Layout' + +export const workRouters = [ + { + path: 'toiletWork', + component: Layout, + redirect: '/toiletManage', + name: 'toiletWork', + meta: { + title: '作业管理', + icon: 'icon-config', // 图标 + permission: ['/toiletWork']// 权限名称 + }, + children: [ + { + path: '/toiletWork', + name: 'ToiletWork', + component: () => import('@/views/toiletClean/toiletCleanList'), + meta: { title: '作业管理', icon: 'function', permission: ['/toiletWork'] } + } + ] + } +] diff --git a/src/settings.js b/src/settings.js index b568ce0..b8159bf 100644 --- a/src/settings.js +++ b/src/settings.js @@ -3,7 +3,7 @@ * @type {boolean} true | false * @description 是否显示设置按钮 */ - showSettings: true, + showSettings: false, /** * @type {boolean} true | false diff --git a/config/index.js b/config/index.js index 8abd37a..19b33b1 100644 --- a/config/index.js +++ b/config/index.js @@ -69,7 +69,7 @@ * then assetsPublicPath should be set to "/bar/". * In most cases please use '/' !!! */ - assetsPublicPath: '/', + assetsPublicPath: '/toilet/', /** * Source Maps diff --git a/package.json b/package.json index 45f055f..9f3a3eb 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "echarts": "^4.2.1", "element-ui": "2.13.0", "event-source-polyfill": "^1.0.5", + "file-saver": "^2.0.5", "js-cookie": "2.2.0", "jsencrypt": "^3.0.0-rc.1", "leaflet": "^1.7.1", @@ -33,7 +34,9 @@ "vue-amap": "^0.5.9", "vue-baidu-map": "^0.21.22", "vue-router": "3.0.1", - "vuex": "3.0.1" + "vue2-leaflet": "^2.7.0", + "vuex": "3.0.1", + "xlsx": "^0.17.0" }, "devDependencies": { "autoprefixer": "8.5.0", diff --git a/src/api/common.js b/src/api/common.js index 87c582b..7804714 100644 --- a/src/api/common.js +++ b/src/api/common.js @@ -2,10 +2,14 @@ * 常用接口 */ import request from '@/utils/request' +import Vue from 'vue' + // 模板下载 export function downloadTemplate(fileName) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath return request({ - url: 'template/download', + url: lampPath + 'template/download', method: 'get', params: { filename: fileName @@ -19,7 +23,7 @@ const param = new FormData() param.append('file', fileobj.file) return request({ - url: 'imageUpload', + url: 'fileUpload', method: 'post', headers: { 'Content-Type': 'multipart/form-data' }, data: param diff --git a/src/api/sanitation/statistics.js b/src/api/sanitation/statistics.js new file mode 100644 index 0000000..ffeac18 --- /dev/null +++ b/src/api/sanitation/statistics.js @@ -0,0 +1,22 @@ + +/** + * 考核统计接口 + */ +import request from '@/utils/request' +// 公厕保洁次数统计 +export function getToiletJobCount(params) { + return request({ + url: '/sanitation/statistic/toilet/jobCount', + method: 'get', + params + }) +} + +// 公厕评分统计 +export function getToiletEvaluation(params) { + return request({ + url: '/sanitation/toiletEvaluation/statistics', + method: 'get', + params + }) +} diff --git a/src/api/sanitation/toilet.js b/src/api/sanitation/toilet.js new file mode 100644 index 0000000..11affd4 --- /dev/null +++ b/src/api/sanitation/toilet.js @@ -0,0 +1,133 @@ +/** + * 公厕管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' +// 公厕查询 +export function getToiletListPage(params) { + return request({ + url: '/sanitation/toilet/listPage', + method: 'get', + params + }) +} +// 公厕查询 +export function getToiletList(pid) { + return request({ + url: '/sanitation/toilet/list', + method: 'get', + params: { + pid: pid + } + }) +} + +// 添加公厕 +export function addToilet(params) { + return request({ + url: '/sanitation/toilet/add', + method: 'post', + params + }) +} +// 修改公厕机构 +export function updateToilet(params) { + return request({ + url: '/sanitation/toilet/update', + method: 'post', + params + }) +} +// 删除公厕机构 +export function delToilet(ids) { + return request({ + url: '/sanitation/toilet/delete', + method: 'post', + params: { + ids + }, + paramsSerializer: params => { + return qs.stringify(params, { indices: false }) + } + }) +} + +// 公厕基本信息详情 +export function getToiletInfoDetail(id) { + return request({ + url: '/sanitation/toilet/detail?toiletId=' + id, + method: 'get' + }) +} + +// 某公厕保洁记录 +export function getRecordsByToilet(params) { + return request({ + url: '/sanitation/toilet/jobRecord/detail', + method: 'get', + params + }) +} + +// 某公厕平均评分 +export function getScoreByToilet(params) { + return request({ + url: '/sanitation/toiletEvaluation/detailScore', + method: 'get', + params + }) +} + +// 某公厕评分列表 +export function getScoreListByToilet(params) { + return request({ + url: '/sanitation/toiletEvaluation/list', + method: 'get', + params + }) +} + + +// 批量导入 +export function batchImportToilet(fileobj) { + const param = new FormData() + param.append('file', fileobj) + return request({ + url: '/sanitation/toilet/import', + method: 'post', + headers: { 'Content-Type': 'multipart/form-data' }, + data: param + }) +} +// 批量导出 +export function batchExportToilet(params, config) { + return request({ + url: '/sanitation/toilet/export', + method: 'get', + timeout: 120000, + params, + ...config, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 公厕保洁记录查询 +export function getToiletJobRecords(params) { + return request({ + url: '/sanitation/toilet/jobRecord', + method: 'get', + params + }) +} + +// 批量导出 +export function batchExportToiletJobRecords(params, config) { + return request({ + url: '/sanitation/toilet/exportJobRecord', + method: 'get', + timeout: 120000, + params, + ...config, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} diff --git a/src/api/system/alarm.js b/src/api/system/alarm.js new file mode 100644 index 0000000..1c3a7ab --- /dev/null +++ b/src/api/system/alarm.js @@ -0,0 +1,62 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' + +// 获取当前报警列表 +export function getAlarmNowList(params) { + return request({ + url: '/alarm/listNowPage', + method: 'get', + params + }) +} + +// 获取当前报警列表 +export function getAlarmHistoryList(params) { + return request({ + url: '/alarm/listHisPage', + method: 'get', + params + }) +} + + +// 批量消警 +export function clearAll(params) { + return request({ + url: '/alarm/allClear', + method: 'get', + params + }) +} + +// 消警 +export function clearAlarm(params) { + return request({ + url: '/alarm/cancel', + method: 'get', + params + }) +} + +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 设置报警阈值 +export function setThresh(params) { + return request({ + url: '/alarm/resetAlarmRule', + method: 'post', + params + }) +} diff --git a/src/api/system/bridge.js b/src/api/system/bridge.js new file mode 100644 index 0000000..e8a4108 --- /dev/null +++ b/src/api/system/bridge.js @@ -0,0 +1,80 @@ +/** + * 桥梁管理接口 + */ +import request from '@/utils/request' + +// 获取桥梁详情 +export function getDetail(id) { + return request({ + url: '/bridge/detail', + method: 'get', + params: { + id: id + } + }) +} + +export function updateBridge(params) { + return request({ + url: '/bridge/update', + method: 'post', + params + }) +} +// 批量导出 +export function exportRecords(params) { + return request({ + url: 'device/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +export function getContentList(params) { + return request({ + url: 'maintain/contentByType', + method: 'get', + params: { + type: params + } + }) +} +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 编辑 +export function editRecord(params) { + return request({ + url: 'maintain/update', + method: 'post', + params + }) +} +// 新增 +export function addRecord(params) { + return request({ + url: 'maintain/add', + method: 'post', + params + }) +} +// 删除 +export function delRecord(id) { + return request({ + url: 'maintain/delete', + method: 'post', + params: { + id: id + } + }) +} diff --git a/src/api/system/data.js b/src/api/system/data.js new file mode 100644 index 0000000..4c95db5 --- /dev/null +++ b/src/api/system/data.js @@ -0,0 +1,63 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' + +// 获取当前报警列表 +export function getHistoryList(params) { + return request({ + url: '/data/hisListPage', + method: 'get', + params + }) +} + +// 获取当前报警列表 +export function getHistory(params) { + return request({ + url: '/data/hisList', + method: 'get', + params + }) +} + + + +// 批量消警 +export function clearAll(params) { + return request({ + url: '/alarm/allClear', + method: 'get', + params + }) +} + +// 消警 +export function clearAlarm(params) { + return request({ + url: '/alarm/cancel', + method: 'get', + params + }) +} + +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 设置报警阈值 +export function setThresh(params) { + return request({ + url: '/alarm/resetAlarmRule', + method: 'post', + params + }) +} diff --git a/src/api/system/order.js b/src/api/system/order.js new file mode 100644 index 0000000..7007c50 --- /dev/null +++ b/src/api/system/order.js @@ -0,0 +1,71 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +// import qs from 'qs' + +// 获取当前报警列表 +export function getRecordList(params) { + return request({ + url: '/maintain/listPage', + method: 'get', + params + }) +} +// 批量导出 +export function exportRecords(params) { + return request({ + url: 'device/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +export function getContentList(params) { + return request({ + url: 'maintain/contentByType', + method: 'get', + params: { + type: params + } + }) +} +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 编辑 +export function editRecord(params) { + return request({ + url: 'maintain/update', + method: 'post', + params + }) +} +// 新增 +export function addRecord(params) { + return request({ + url: 'maintain/add', + method: 'post', + params + }) +} +// 删除 +export function delRecord(id) { + return request({ + url: 'maintain/delete', + method: 'post', + params: { + bridgeMaintenanceId: id + } + }) +} diff --git a/src/api/system/overview.js b/src/api/system/overview.js new file mode 100644 index 0000000..bca50cc --- /dev/null +++ b/src/api/system/overview.js @@ -0,0 +1,109 @@ +import request from '@/utils/request' +import qs from "qs" +import Vue from 'vue' + +// 路灯状态统计 +export function getLampStatus() { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampStatus', + method: 'get' + }) +} + +// 路灯总览列表 +export function getLampList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampList', + method: 'get', + params + }) +} + +// 路灯详情 +export function getlampDetail(lampId) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampDetail', + method: 'get', + params: { + lampId: lampId + } + }) +} + +// 回路列表 +export function getCircuitList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/circuitList', + method: 'get', + params + }) +} + +// 灯箱列表 +export function getLampBoxList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampBoxList', + method: 'get', + params + }) +} +// 灯箱详情 +export function getLampBoxDetail(lampBoxId) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampBoxDetail', + method: 'get', + params: { + lampBoxId: lampBoxId + } + }) +} + +// 报警总览列表 +export function getAlarmList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/alarmList', + method: 'get', + params + }) +} + +// 报警详情 +export function getAlarmDetail(alarmId) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/alarmDetail', + method: 'get', + params: { + alarmId: alarmId + } + }) +} + +// 路灯控制 +export function lampControl(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampControl', + method: 'post', + params, + paramsSerializer: params => { + return qs.stringify(params, { indices: false }) + } + }) +} diff --git a/src/api/system/rule.js b/src/api/system/rule.js new file mode 100644 index 0000000..76c6b2d --- /dev/null +++ b/src/api/system/rule.js @@ -0,0 +1,59 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +// import qs from 'qs' + +// 获取当前报警列表 +export function getRuleList() { + return request({ + url: 'rule/listPage', + method: 'get' + }) +} +export function getContentList(params) { + return request({ + url: 'maintain/contentByType', + method: 'get', + params: { + type: params + } + }) +} +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 编辑 +export function editRecord(params) { + return request({ + url: 'maintain/update', + method: 'post', + params + }) +} +// 新增 +export function addRecord(params) { + return request({ + url: 'maintain/add', + method: 'post', + params + }) +} +// 删除 +export function delRecord(id) { + return request({ + url: 'maintain/delete', + method: 'post', + params: { + id: id + } + }) +} diff --git a/src/api/system/statistics.js b/src/api/system/statistics.js new file mode 100644 index 0000000..b25efe9 --- /dev/null +++ b/src/api/system/statistics.js @@ -0,0 +1,23 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +// import qs from 'qs' + +// +export function countByToilet(params) { + return request({ + url: '/sanitation/toiletStatistic/jobStaticByToilet', + method: 'get', + params + }) +} + +export function countByDay(params) { + return request({ + url: '/sanitation/toiletStatistic/jobStaticByDate', + method: 'get', + params + }) +} + diff --git a/src/assets/global_images/icon-position.png b/src/assets/global_images/icon-position.png new file mode 100644 index 0000000..7444038 --- /dev/null +++ b/src/assets/global_images/icon-position.png Binary files differ diff --git a/src/assets/global_images/location_green.png b/src/assets/global_images/location_green.png new file mode 100644 index 0000000..aa8be65 --- /dev/null +++ b/src/assets/global_images/location_green.png Binary files differ diff --git a/src/assets/global_images/location_red.png b/src/assets/global_images/location_red.png new file mode 100644 index 0000000..2be8c3d --- /dev/null +++ b/src/assets/global_images/location_red.png Binary files differ diff --git a/src/assets/global_images/location_yellow.png b/src/assets/global_images/location_yellow.png new file mode 100644 index 0000000..5ab6f4d --- /dev/null +++ b/src/assets/global_images/location_yellow.png Binary files differ diff --git a/src/assets/global_images/toilet-position.png b/src/assets/global_images/toilet-position.png new file mode 100644 index 0000000..7db6d9a --- /dev/null +++ b/src/assets/global_images/toilet-position.png Binary files differ diff --git a/src/assets/global_images/toilet.png b/src/assets/global_images/toilet.png new file mode 100644 index 0000000..6d9fc05 --- /dev/null +++ b/src/assets/global_images/toilet.png Binary files differ diff --git a/src/assets/global_images/toiletPhoto.png b/src/assets/global_images/toiletPhoto.png new file mode 100644 index 0000000..15d08e2 --- /dev/null +++ b/src/assets/global_images/toiletPhoto.png Binary files differ diff --git a/src/components/DownloadTemplate/index.vue b/src/components/DownloadTemplate/index.vue index 8ded2cd..7807cac 100644 --- a/src/components/DownloadTemplate/index.vue +++ b/src/components/DownloadTemplate/index.vue @@ -47,8 +47,8 @@ diff --git a/src/components/NormalTable/index.vue b/src/components/NormalTable/index.vue index 5077bef..04d322d 100644 --- a/src/components/NormalTable/index.vue +++ b/src/components/NormalTable/index.vue @@ -79,7 +79,7 @@
-
+
Object.assign(obj, { [key]: this[key] }), {}), + on: events.reduce((obj, key) => Object.assign(obj, { [key]: this.transmitEvent }), {}) + }) + } + this.props = [...extraProps, ...props.filter(prop => exceptProps.indexOf(prop))] + } +} + +export default prop => new Mixin(prop) diff --git a/src/components/mapWindow/base/mixins/common.js b/src/components/mapWindow/base/mixins/common.js new file mode 100644 index 0000000..2fd1a28 --- /dev/null +++ b/src/components/mapWindow/base/mixins/common.js @@ -0,0 +1,82 @@ +const types = { + map: { + unload: 'clearMap' + }, + control: { + unload: 'removeControl' + }, + layer: { + unload: 'removeLayer' + }, + features: { + unload: 'removeFeatures' + }, + listener: { + unload: 'removeListener' + } +} + +const getParent = $component => ($component.abstract || $component.$el === $component.$children[0].$el) ? getParent($component.$parent) : $component + +function destroyInstance () { + const { unload, renderByParent, $parent } = this + if (renderByParent) { + $parent.reload() + } + unload() +} + +class Mixin { + constructor (prop) { + this.methods = { + ready () { + const $parent = getParent(this.$parent) + const map = this.map = $parent.map + this.load() + this.$emit('ready', { + map + }) + }, + transmitEvent (e) { + this.$emit(e.type.replace(/^on/, ''), e) + }, + reload () { + this && this.$nextTick(() => { + this.unload() + this.$nextTick(this.load) + }) + }, + unload () { + const { map, originInstance } = this + try { + switch (prop.type) { + case 'search': + return originInstance.clearResults() + case 'autoComplete': + case 'lushu': + return originInstance.dispose() + case 'markerClusterer': + return originInstance.clearMarkers() + default: + map[types[prop.type].unload](originInstance) + } + } catch (e) {} + } + } + this.computed = { + renderByParent () { + return this.$parent.preventChildrenRender + } + } + this.mounted = function () { + console.log('common mounted') + const $parent = getParent(this.$parent) + const map = $parent.map + const { ready } = this + console.log(map) + map ? ready() : $parent.$on('onload', ready) + } + } +} + +export default type => new Mixin({ type }) diff --git a/src/components/mapWindow/leafletMap.vue b/src/components/mapWindow/leafletMap.vue new file mode 100644 index 0000000..b753cc0 --- /dev/null +++ b/src/components/mapWindow/leafletMap.vue @@ -0,0 +1,143 @@ + + + + + + + diff --git a/src/components/mapWindow/mapWindow.vue b/src/components/mapWindow/mapWindow.vue new file mode 100644 index 0000000..9ced291 --- /dev/null +++ b/src/components/mapWindow/mapWindow.vue @@ -0,0 +1,46 @@ + + + + + + diff --git a/src/icons/svg/bridge.svg b/src/icons/svg/bridge.svg new file mode 100644 index 0000000..1a0336f --- /dev/null +++ b/src/icons/svg/bridge.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/icons/svg/toilet.svg b/src/icons/svg/toilet.svg new file mode 100644 index 0000000..9d8e765 --- /dev/null +++ b/src/icons/svg/toilet.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/main.js b/src/main.js index f2d105d..3e4074e 100644 --- a/src/main.js +++ b/src/main.js @@ -18,6 +18,9 @@ // echart // import echarts from 'echarts' // Vue.prototype.$echarts = echarts +// 引入v-charts +import VCharts from 'v-charts' +Vue.use(VCharts) // 将自动注册所有组件为全局组件 // import dataV from '@jiaminghi/data-view' @@ -35,9 +38,19 @@ Vue.component('search-item', SearchItem) // 加载leaflet的css +// import 'leaflet/dist/leaflet.css' +// import 'leaflet-draw/dist/leaflet.draw.css' +import L from 'leaflet' import 'leaflet/dist/leaflet.css' -import 'leaflet-draw/dist/leaflet.draw.css' +Vue.config.productionTip = false +Vue.L = Vue.prototype.$L = L +delete L.Icon.Default.prototype._getIconUrl +L.Icon.Default.mergeOptions({ + iconRetinaUrl: require('leaflet/dist/images/marker-icon-2x.png'), + iconUrl: require('leaflet/dist/images/marker-icon.png'), + shadowUrl: require('leaflet/dist/images/marker-shadow.png') +}) /** * This project originally used easy-mock to simulate data, * but its official service is very unstable, diff --git a/src/permission.js b/src/permission.js index dc6b2f8..809ca86 100644 --- a/src/permission.js +++ b/src/permission.js @@ -25,8 +25,8 @@ store.dispatch('GetInfo').then(res => { // 拉取用户信息 // 设置当前子系统为基础资源子系统 const currentSys = { - code: 'baseResourse', - name: '基础资源子系统' + code: 'toliet', + name: '公共厕所管理系统' } // 将当前系统信息保存在localStorage中 store.commit('SET_SYSTEM', currentSys) diff --git a/src/router/index.js b/src/router/index.js index 39c295c..d23076d 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -8,8 +8,11 @@ /* Layout */ import Layout from '@/layout/Layout' +import { toiletRouters } from './modules/toilet' +import { workRouters } from './modules/work' +import { statisticsRouters } from './modules/statistics' +import { ruleRouters } from './modules/rule' import { systemRouters } from './modules/system' -import { exampleRouters } from './modules/example' /** * hidden: true if `hidden:true` will not show in the sidebar(default is false) @@ -40,11 +43,12 @@ ] }, // 登录页面 - { path: '/login', component: () => import('@/views/login/index'), hidden: true }, + { path: '/login', component: () => import('@/views/login/index_2'), hidden: true }, // 404错误页面 { path: '/404', component: () => import('@/views/errorPage/404'), hidden: true }, // 401 错误页面 - { path: '/401', component: () => import('@/views/errorPage/401'), hidden: true } + { path: '/401', component: () => import('@/views/errorPage/401'), hidden: true }, + { path: '/', redirect: '/toiletList', hidden: true } ] // 实例化vue的时候直挂载constantRouter export default new Router({ @@ -56,7 +60,10 @@ // 异步挂载路由 // 动态需要根据权限加载的路由表 export const asyncRouterMap = [ - ...exampleRouters, - ...systemRouters, + ...toiletRouters, + ...workRouters, + ...statisticsRouters, + ...ruleRouters, + // ...systemRouters, { path: '*', redirect: '/404', hidden: true } ] diff --git a/src/router/modules/rule.js b/src/router/modules/rule.js new file mode 100644 index 0000000..51e0283 --- /dev/null +++ b/src/router/modules/rule.js @@ -0,0 +1,24 @@ +/* Layout */ +import Layout from '@/layout/Layout' + +export const ruleRouters = [ + { + path: 'rule', + component: Layout, + redirect: '/rule', + name: 'Rule', + meta: { + title: '规章制度', + icon: 'icon-config', // 图标 + permission: ['/rule']// 权限名称 + }, + children: [ + { + path: '/rule', + name: 'Rule', + component: () => import('@/views/rule/listRule'), + meta: { title: '规章制度', icon: 'function', permission: ['/rule'] } + } + ] + } +] diff --git a/src/router/modules/statistics.js b/src/router/modules/statistics.js new file mode 100644 index 0000000..fb9cbea --- /dev/null +++ b/src/router/modules/statistics.js @@ -0,0 +1,30 @@ +/* Layout */ +import Layout from '@/layout/Layout' + +export const statisticsRouters = [ + { + path: 'statisticsToilet', + component: Layout, + redirect: '/workStatistics', + name: 'StatisticsToilet', + meta: { + title: '作业统计', + icon: 'icon-config', // 图标 + permission: ['/statisticsToilet']// 权限名称 + }, + children: [ + { + path: '/workStatistics', + name: 'WorkStatistics', + component: () => import('@/views/statistics/toiletAssessment'), + meta: { title: '作业统计', icon: '', permission: ['/toilet/workStatistics'] } + }, + { + path: '/evaluationStatistics', + name: 'EvaluationStatistics', + component: () => import('@/views/statistics/evaluationAssessment'), + meta: { title: '评价统计', icon: '', permission: ['/toilet/evaluationStatistics'] } + } + ] + } +] diff --git a/src/router/modules/toilet.js b/src/router/modules/toilet.js new file mode 100644 index 0000000..b221a0e --- /dev/null +++ b/src/router/modules/toilet.js @@ -0,0 +1,30 @@ +/* Layout */ +import Layout from '@/layout/Layout' + +export const toiletRouters = [ + { + path: 'toiletManage', + component: Layout, + redirect: '/toiletManage', + name: 'ToiletManage', + meta: { + title: '公厕管理', + icon: 'icon-config', // 图标 + permission: ['/toiletManage']// 权限名称 + }, + children: [ + { + path: '/toiletList', + name: 'ToiletList', + component: () => import('@/views/toiletManage/toiletList'), + meta: { title: '公厕台帐管理', icon: 'function', permission: ['/toiletList'] } + }, + { + path: '/toiletMap', + name: 'ToiletMap', + component: () => import('@/views/overview/overview'), + meta: { title: '地图总览', icon: 'function', permission: ['/toiletMap'] } + } + ] + } +] diff --git a/src/router/modules/work.js b/src/router/modules/work.js new file mode 100644 index 0000000..5e0759f --- /dev/null +++ b/src/router/modules/work.js @@ -0,0 +1,24 @@ +/* Layout */ +import Layout from '@/layout/Layout' + +export const workRouters = [ + { + path: 'toiletWork', + component: Layout, + redirect: '/toiletManage', + name: 'toiletWork', + meta: { + title: '作业管理', + icon: 'icon-config', // 图标 + permission: ['/toiletWork']// 权限名称 + }, + children: [ + { + path: '/toiletWork', + name: 'ToiletWork', + component: () => import('@/views/toiletClean/toiletCleanList'), + meta: { title: '作业管理', icon: 'function', permission: ['/toiletWork'] } + } + ] + } +] diff --git a/src/settings.js b/src/settings.js index b568ce0..b8159bf 100644 --- a/src/settings.js +++ b/src/settings.js @@ -3,7 +3,7 @@ * @type {boolean} true | false * @description 是否显示设置按钮 */ - showSettings: true, + showSettings: false, /** * @type {boolean} true | false diff --git a/src/store/modules/permission.js b/src/store/modules/permission.js index a0cb8cf..3ab50d5 100644 --- a/src/store/modules/permission.js +++ b/src/store/modules/permission.js @@ -120,17 +120,23 @@ }) }, // 获取用户权限 - GetMenus({ commit, state }) { - console.log('in store.permission.js:GetMenus:') + GetMenus({ commit, state }, currentSystem) { + // console.log('in store.permission.js:GetMenus:') + console.log('获取' + currentSystem.name + '的菜单') + const params = { + parentCode: currentSystem.code // 传入该子系统的code,获取子系统的权限 + } return new Promise((resolve, reject) => { - getMenus(state.token).then(response => { // 处理返回值 + // 此处获取用户所有权限 + getMenus(params).then(response => { // 处理返回值 const data = response.data const menus = [] // 仅菜单 const btns = [] // 非菜单 if (data.menus && data.menus.length > 0) { - commit('SET_MENUS', data.menus) - for (const menu of data.menus) { // 遍历菜单,获取所有的权限项 - if (menu.ismenu === '1') { // 将是菜单的放入menus + const allmenus = [...data.menus] + commit('SET_MENUS', allmenus) + for (const menu of allmenus) { // 遍历菜单,获取所有的权限项 + if (menu.resourceType === '02' || menu.resourceType === '03') { // 将是菜单的放入menus const menu_tmp = {} menu_tmp.url = menu.url menu_tmp.icon = menu.icon @@ -142,11 +148,11 @@ btn_tmp.name = menu.name btn_tmp.icon = menu.icon btns.push(btn_tmp) - // console.log(menu.url) } } // 过滤路由表 - const accessedRouters = filterAsyncRouter(asyncRouterMap, menus) + let accessedRouters = filterAsyncRouter(asyncRouterMap, menus) + // accessedRouters = filterRedirect(accessedRouters) commit('SET_BTNS', btns) commit('SET_ROUTERS', accessedRouters) resolve(response) diff --git a/config/index.js b/config/index.js index 8abd37a..19b33b1 100644 --- a/config/index.js +++ b/config/index.js @@ -69,7 +69,7 @@ * then assetsPublicPath should be set to "/bar/". * In most cases please use '/' !!! */ - assetsPublicPath: '/', + assetsPublicPath: '/toilet/', /** * Source Maps diff --git a/package.json b/package.json index 45f055f..9f3a3eb 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "echarts": "^4.2.1", "element-ui": "2.13.0", "event-source-polyfill": "^1.0.5", + "file-saver": "^2.0.5", "js-cookie": "2.2.0", "jsencrypt": "^3.0.0-rc.1", "leaflet": "^1.7.1", @@ -33,7 +34,9 @@ "vue-amap": "^0.5.9", "vue-baidu-map": "^0.21.22", "vue-router": "3.0.1", - "vuex": "3.0.1" + "vue2-leaflet": "^2.7.0", + "vuex": "3.0.1", + "xlsx": "^0.17.0" }, "devDependencies": { "autoprefixer": "8.5.0", diff --git a/src/api/common.js b/src/api/common.js index 87c582b..7804714 100644 --- a/src/api/common.js +++ b/src/api/common.js @@ -2,10 +2,14 @@ * 常用接口 */ import request from '@/utils/request' +import Vue from 'vue' + // 模板下载 export function downloadTemplate(fileName) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath return request({ - url: 'template/download', + url: lampPath + 'template/download', method: 'get', params: { filename: fileName @@ -19,7 +23,7 @@ const param = new FormData() param.append('file', fileobj.file) return request({ - url: 'imageUpload', + url: 'fileUpload', method: 'post', headers: { 'Content-Type': 'multipart/form-data' }, data: param diff --git a/src/api/sanitation/statistics.js b/src/api/sanitation/statistics.js new file mode 100644 index 0000000..ffeac18 --- /dev/null +++ b/src/api/sanitation/statistics.js @@ -0,0 +1,22 @@ + +/** + * 考核统计接口 + */ +import request from '@/utils/request' +// 公厕保洁次数统计 +export function getToiletJobCount(params) { + return request({ + url: '/sanitation/statistic/toilet/jobCount', + method: 'get', + params + }) +} + +// 公厕评分统计 +export function getToiletEvaluation(params) { + return request({ + url: '/sanitation/toiletEvaluation/statistics', + method: 'get', + params + }) +} diff --git a/src/api/sanitation/toilet.js b/src/api/sanitation/toilet.js new file mode 100644 index 0000000..11affd4 --- /dev/null +++ b/src/api/sanitation/toilet.js @@ -0,0 +1,133 @@ +/** + * 公厕管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' +// 公厕查询 +export function getToiletListPage(params) { + return request({ + url: '/sanitation/toilet/listPage', + method: 'get', + params + }) +} +// 公厕查询 +export function getToiletList(pid) { + return request({ + url: '/sanitation/toilet/list', + method: 'get', + params: { + pid: pid + } + }) +} + +// 添加公厕 +export function addToilet(params) { + return request({ + url: '/sanitation/toilet/add', + method: 'post', + params + }) +} +// 修改公厕机构 +export function updateToilet(params) { + return request({ + url: '/sanitation/toilet/update', + method: 'post', + params + }) +} +// 删除公厕机构 +export function delToilet(ids) { + return request({ + url: '/sanitation/toilet/delete', + method: 'post', + params: { + ids + }, + paramsSerializer: params => { + return qs.stringify(params, { indices: false }) + } + }) +} + +// 公厕基本信息详情 +export function getToiletInfoDetail(id) { + return request({ + url: '/sanitation/toilet/detail?toiletId=' + id, + method: 'get' + }) +} + +// 某公厕保洁记录 +export function getRecordsByToilet(params) { + return request({ + url: '/sanitation/toilet/jobRecord/detail', + method: 'get', + params + }) +} + +// 某公厕平均评分 +export function getScoreByToilet(params) { + return request({ + url: '/sanitation/toiletEvaluation/detailScore', + method: 'get', + params + }) +} + +// 某公厕评分列表 +export function getScoreListByToilet(params) { + return request({ + url: '/sanitation/toiletEvaluation/list', + method: 'get', + params + }) +} + + +// 批量导入 +export function batchImportToilet(fileobj) { + const param = new FormData() + param.append('file', fileobj) + return request({ + url: '/sanitation/toilet/import', + method: 'post', + headers: { 'Content-Type': 'multipart/form-data' }, + data: param + }) +} +// 批量导出 +export function batchExportToilet(params, config) { + return request({ + url: '/sanitation/toilet/export', + method: 'get', + timeout: 120000, + params, + ...config, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 公厕保洁记录查询 +export function getToiletJobRecords(params) { + return request({ + url: '/sanitation/toilet/jobRecord', + method: 'get', + params + }) +} + +// 批量导出 +export function batchExportToiletJobRecords(params, config) { + return request({ + url: '/sanitation/toilet/exportJobRecord', + method: 'get', + timeout: 120000, + params, + ...config, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} diff --git a/src/api/system/alarm.js b/src/api/system/alarm.js new file mode 100644 index 0000000..1c3a7ab --- /dev/null +++ b/src/api/system/alarm.js @@ -0,0 +1,62 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' + +// 获取当前报警列表 +export function getAlarmNowList(params) { + return request({ + url: '/alarm/listNowPage', + method: 'get', + params + }) +} + +// 获取当前报警列表 +export function getAlarmHistoryList(params) { + return request({ + url: '/alarm/listHisPage', + method: 'get', + params + }) +} + + +// 批量消警 +export function clearAll(params) { + return request({ + url: '/alarm/allClear', + method: 'get', + params + }) +} + +// 消警 +export function clearAlarm(params) { + return request({ + url: '/alarm/cancel', + method: 'get', + params + }) +} + +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 设置报警阈值 +export function setThresh(params) { + return request({ + url: '/alarm/resetAlarmRule', + method: 'post', + params + }) +} diff --git a/src/api/system/bridge.js b/src/api/system/bridge.js new file mode 100644 index 0000000..e8a4108 --- /dev/null +++ b/src/api/system/bridge.js @@ -0,0 +1,80 @@ +/** + * 桥梁管理接口 + */ +import request from '@/utils/request' + +// 获取桥梁详情 +export function getDetail(id) { + return request({ + url: '/bridge/detail', + method: 'get', + params: { + id: id + } + }) +} + +export function updateBridge(params) { + return request({ + url: '/bridge/update', + method: 'post', + params + }) +} +// 批量导出 +export function exportRecords(params) { + return request({ + url: 'device/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +export function getContentList(params) { + return request({ + url: 'maintain/contentByType', + method: 'get', + params: { + type: params + } + }) +} +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 编辑 +export function editRecord(params) { + return request({ + url: 'maintain/update', + method: 'post', + params + }) +} +// 新增 +export function addRecord(params) { + return request({ + url: 'maintain/add', + method: 'post', + params + }) +} +// 删除 +export function delRecord(id) { + return request({ + url: 'maintain/delete', + method: 'post', + params: { + id: id + } + }) +} diff --git a/src/api/system/data.js b/src/api/system/data.js new file mode 100644 index 0000000..4c95db5 --- /dev/null +++ b/src/api/system/data.js @@ -0,0 +1,63 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' + +// 获取当前报警列表 +export function getHistoryList(params) { + return request({ + url: '/data/hisListPage', + method: 'get', + params + }) +} + +// 获取当前报警列表 +export function getHistory(params) { + return request({ + url: '/data/hisList', + method: 'get', + params + }) +} + + + +// 批量消警 +export function clearAll(params) { + return request({ + url: '/alarm/allClear', + method: 'get', + params + }) +} + +// 消警 +export function clearAlarm(params) { + return request({ + url: '/alarm/cancel', + method: 'get', + params + }) +} + +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 设置报警阈值 +export function setThresh(params) { + return request({ + url: '/alarm/resetAlarmRule', + method: 'post', + params + }) +} diff --git a/src/api/system/order.js b/src/api/system/order.js new file mode 100644 index 0000000..7007c50 --- /dev/null +++ b/src/api/system/order.js @@ -0,0 +1,71 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +// import qs from 'qs' + +// 获取当前报警列表 +export function getRecordList(params) { + return request({ + url: '/maintain/listPage', + method: 'get', + params + }) +} +// 批量导出 +export function exportRecords(params) { + return request({ + url: 'device/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +export function getContentList(params) { + return request({ + url: 'maintain/contentByType', + method: 'get', + params: { + type: params + } + }) +} +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 编辑 +export function editRecord(params) { + return request({ + url: 'maintain/update', + method: 'post', + params + }) +} +// 新增 +export function addRecord(params) { + return request({ + url: 'maintain/add', + method: 'post', + params + }) +} +// 删除 +export function delRecord(id) { + return request({ + url: 'maintain/delete', + method: 'post', + params: { + bridgeMaintenanceId: id + } + }) +} diff --git a/src/api/system/overview.js b/src/api/system/overview.js new file mode 100644 index 0000000..bca50cc --- /dev/null +++ b/src/api/system/overview.js @@ -0,0 +1,109 @@ +import request from '@/utils/request' +import qs from "qs" +import Vue from 'vue' + +// 路灯状态统计 +export function getLampStatus() { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampStatus', + method: 'get' + }) +} + +// 路灯总览列表 +export function getLampList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampList', + method: 'get', + params + }) +} + +// 路灯详情 +export function getlampDetail(lampId) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampDetail', + method: 'get', + params: { + lampId: lampId + } + }) +} + +// 回路列表 +export function getCircuitList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/circuitList', + method: 'get', + params + }) +} + +// 灯箱列表 +export function getLampBoxList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampBoxList', + method: 'get', + params + }) +} +// 灯箱详情 +export function getLampBoxDetail(lampBoxId) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampBoxDetail', + method: 'get', + params: { + lampBoxId: lampBoxId + } + }) +} + +// 报警总览列表 +export function getAlarmList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/alarmList', + method: 'get', + params + }) +} + +// 报警详情 +export function getAlarmDetail(alarmId) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/alarmDetail', + method: 'get', + params: { + alarmId: alarmId + } + }) +} + +// 路灯控制 +export function lampControl(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampControl', + method: 'post', + params, + paramsSerializer: params => { + return qs.stringify(params, { indices: false }) + } + }) +} diff --git a/src/api/system/rule.js b/src/api/system/rule.js new file mode 100644 index 0000000..76c6b2d --- /dev/null +++ b/src/api/system/rule.js @@ -0,0 +1,59 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +// import qs from 'qs' + +// 获取当前报警列表 +export function getRuleList() { + return request({ + url: 'rule/listPage', + method: 'get' + }) +} +export function getContentList(params) { + return request({ + url: 'maintain/contentByType', + method: 'get', + params: { + type: params + } + }) +} +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 编辑 +export function editRecord(params) { + return request({ + url: 'maintain/update', + method: 'post', + params + }) +} +// 新增 +export function addRecord(params) { + return request({ + url: 'maintain/add', + method: 'post', + params + }) +} +// 删除 +export function delRecord(id) { + return request({ + url: 'maintain/delete', + method: 'post', + params: { + id: id + } + }) +} diff --git a/src/api/system/statistics.js b/src/api/system/statistics.js new file mode 100644 index 0000000..b25efe9 --- /dev/null +++ b/src/api/system/statistics.js @@ -0,0 +1,23 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +// import qs from 'qs' + +// +export function countByToilet(params) { + return request({ + url: '/sanitation/toiletStatistic/jobStaticByToilet', + method: 'get', + params + }) +} + +export function countByDay(params) { + return request({ + url: '/sanitation/toiletStatistic/jobStaticByDate', + method: 'get', + params + }) +} + diff --git a/src/assets/global_images/icon-position.png b/src/assets/global_images/icon-position.png new file mode 100644 index 0000000..7444038 --- /dev/null +++ b/src/assets/global_images/icon-position.png Binary files differ diff --git a/src/assets/global_images/location_green.png b/src/assets/global_images/location_green.png new file mode 100644 index 0000000..aa8be65 --- /dev/null +++ b/src/assets/global_images/location_green.png Binary files differ diff --git a/src/assets/global_images/location_red.png b/src/assets/global_images/location_red.png new file mode 100644 index 0000000..2be8c3d --- /dev/null +++ b/src/assets/global_images/location_red.png Binary files differ diff --git a/src/assets/global_images/location_yellow.png b/src/assets/global_images/location_yellow.png new file mode 100644 index 0000000..5ab6f4d --- /dev/null +++ b/src/assets/global_images/location_yellow.png Binary files differ diff --git a/src/assets/global_images/toilet-position.png b/src/assets/global_images/toilet-position.png new file mode 100644 index 0000000..7db6d9a --- /dev/null +++ b/src/assets/global_images/toilet-position.png Binary files differ diff --git a/src/assets/global_images/toilet.png b/src/assets/global_images/toilet.png new file mode 100644 index 0000000..6d9fc05 --- /dev/null +++ b/src/assets/global_images/toilet.png Binary files differ diff --git a/src/assets/global_images/toiletPhoto.png b/src/assets/global_images/toiletPhoto.png new file mode 100644 index 0000000..15d08e2 --- /dev/null +++ b/src/assets/global_images/toiletPhoto.png Binary files differ diff --git a/src/components/DownloadTemplate/index.vue b/src/components/DownloadTemplate/index.vue index 8ded2cd..7807cac 100644 --- a/src/components/DownloadTemplate/index.vue +++ b/src/components/DownloadTemplate/index.vue @@ -47,8 +47,8 @@ diff --git a/src/components/NormalTable/index.vue b/src/components/NormalTable/index.vue index 5077bef..04d322d 100644 --- a/src/components/NormalTable/index.vue +++ b/src/components/NormalTable/index.vue @@ -79,7 +79,7 @@
-
+
Object.assign(obj, { [key]: this[key] }), {}), + on: events.reduce((obj, key) => Object.assign(obj, { [key]: this.transmitEvent }), {}) + }) + } + this.props = [...extraProps, ...props.filter(prop => exceptProps.indexOf(prop))] + } +} + +export default prop => new Mixin(prop) diff --git a/src/components/mapWindow/base/mixins/common.js b/src/components/mapWindow/base/mixins/common.js new file mode 100644 index 0000000..2fd1a28 --- /dev/null +++ b/src/components/mapWindow/base/mixins/common.js @@ -0,0 +1,82 @@ +const types = { + map: { + unload: 'clearMap' + }, + control: { + unload: 'removeControl' + }, + layer: { + unload: 'removeLayer' + }, + features: { + unload: 'removeFeatures' + }, + listener: { + unload: 'removeListener' + } +} + +const getParent = $component => ($component.abstract || $component.$el === $component.$children[0].$el) ? getParent($component.$parent) : $component + +function destroyInstance () { + const { unload, renderByParent, $parent } = this + if (renderByParent) { + $parent.reload() + } + unload() +} + +class Mixin { + constructor (prop) { + this.methods = { + ready () { + const $parent = getParent(this.$parent) + const map = this.map = $parent.map + this.load() + this.$emit('ready', { + map + }) + }, + transmitEvent (e) { + this.$emit(e.type.replace(/^on/, ''), e) + }, + reload () { + this && this.$nextTick(() => { + this.unload() + this.$nextTick(this.load) + }) + }, + unload () { + const { map, originInstance } = this + try { + switch (prop.type) { + case 'search': + return originInstance.clearResults() + case 'autoComplete': + case 'lushu': + return originInstance.dispose() + case 'markerClusterer': + return originInstance.clearMarkers() + default: + map[types[prop.type].unload](originInstance) + } + } catch (e) {} + } + } + this.computed = { + renderByParent () { + return this.$parent.preventChildrenRender + } + } + this.mounted = function () { + console.log('common mounted') + const $parent = getParent(this.$parent) + const map = $parent.map + const { ready } = this + console.log(map) + map ? ready() : $parent.$on('onload', ready) + } + } +} + +export default type => new Mixin({ type }) diff --git a/src/components/mapWindow/leafletMap.vue b/src/components/mapWindow/leafletMap.vue new file mode 100644 index 0000000..b753cc0 --- /dev/null +++ b/src/components/mapWindow/leafletMap.vue @@ -0,0 +1,143 @@ + + + + + + + diff --git a/src/components/mapWindow/mapWindow.vue b/src/components/mapWindow/mapWindow.vue new file mode 100644 index 0000000..9ced291 --- /dev/null +++ b/src/components/mapWindow/mapWindow.vue @@ -0,0 +1,46 @@ + + + + + + diff --git a/src/icons/svg/bridge.svg b/src/icons/svg/bridge.svg new file mode 100644 index 0000000..1a0336f --- /dev/null +++ b/src/icons/svg/bridge.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/icons/svg/toilet.svg b/src/icons/svg/toilet.svg new file mode 100644 index 0000000..9d8e765 --- /dev/null +++ b/src/icons/svg/toilet.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/main.js b/src/main.js index f2d105d..3e4074e 100644 --- a/src/main.js +++ b/src/main.js @@ -18,6 +18,9 @@ // echart // import echarts from 'echarts' // Vue.prototype.$echarts = echarts +// 引入v-charts +import VCharts from 'v-charts' +Vue.use(VCharts) // 将自动注册所有组件为全局组件 // import dataV from '@jiaminghi/data-view' @@ -35,9 +38,19 @@ Vue.component('search-item', SearchItem) // 加载leaflet的css +// import 'leaflet/dist/leaflet.css' +// import 'leaflet-draw/dist/leaflet.draw.css' +import L from 'leaflet' import 'leaflet/dist/leaflet.css' -import 'leaflet-draw/dist/leaflet.draw.css' +Vue.config.productionTip = false +Vue.L = Vue.prototype.$L = L +delete L.Icon.Default.prototype._getIconUrl +L.Icon.Default.mergeOptions({ + iconRetinaUrl: require('leaflet/dist/images/marker-icon-2x.png'), + iconUrl: require('leaflet/dist/images/marker-icon.png'), + shadowUrl: require('leaflet/dist/images/marker-shadow.png') +}) /** * This project originally used easy-mock to simulate data, * but its official service is very unstable, diff --git a/src/permission.js b/src/permission.js index dc6b2f8..809ca86 100644 --- a/src/permission.js +++ b/src/permission.js @@ -25,8 +25,8 @@ store.dispatch('GetInfo').then(res => { // 拉取用户信息 // 设置当前子系统为基础资源子系统 const currentSys = { - code: 'baseResourse', - name: '基础资源子系统' + code: 'toliet', + name: '公共厕所管理系统' } // 将当前系统信息保存在localStorage中 store.commit('SET_SYSTEM', currentSys) diff --git a/src/router/index.js b/src/router/index.js index 39c295c..d23076d 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -8,8 +8,11 @@ /* Layout */ import Layout from '@/layout/Layout' +import { toiletRouters } from './modules/toilet' +import { workRouters } from './modules/work' +import { statisticsRouters } from './modules/statistics' +import { ruleRouters } from './modules/rule' import { systemRouters } from './modules/system' -import { exampleRouters } from './modules/example' /** * hidden: true if `hidden:true` will not show in the sidebar(default is false) @@ -40,11 +43,12 @@ ] }, // 登录页面 - { path: '/login', component: () => import('@/views/login/index'), hidden: true }, + { path: '/login', component: () => import('@/views/login/index_2'), hidden: true }, // 404错误页面 { path: '/404', component: () => import('@/views/errorPage/404'), hidden: true }, // 401 错误页面 - { path: '/401', component: () => import('@/views/errorPage/401'), hidden: true } + { path: '/401', component: () => import('@/views/errorPage/401'), hidden: true }, + { path: '/', redirect: '/toiletList', hidden: true } ] // 实例化vue的时候直挂载constantRouter export default new Router({ @@ -56,7 +60,10 @@ // 异步挂载路由 // 动态需要根据权限加载的路由表 export const asyncRouterMap = [ - ...exampleRouters, - ...systemRouters, + ...toiletRouters, + ...workRouters, + ...statisticsRouters, + ...ruleRouters, + // ...systemRouters, { path: '*', redirect: '/404', hidden: true } ] diff --git a/src/router/modules/rule.js b/src/router/modules/rule.js new file mode 100644 index 0000000..51e0283 --- /dev/null +++ b/src/router/modules/rule.js @@ -0,0 +1,24 @@ +/* Layout */ +import Layout from '@/layout/Layout' + +export const ruleRouters = [ + { + path: 'rule', + component: Layout, + redirect: '/rule', + name: 'Rule', + meta: { + title: '规章制度', + icon: 'icon-config', // 图标 + permission: ['/rule']// 权限名称 + }, + children: [ + { + path: '/rule', + name: 'Rule', + component: () => import('@/views/rule/listRule'), + meta: { title: '规章制度', icon: 'function', permission: ['/rule'] } + } + ] + } +] diff --git a/src/router/modules/statistics.js b/src/router/modules/statistics.js new file mode 100644 index 0000000..fb9cbea --- /dev/null +++ b/src/router/modules/statistics.js @@ -0,0 +1,30 @@ +/* Layout */ +import Layout from '@/layout/Layout' + +export const statisticsRouters = [ + { + path: 'statisticsToilet', + component: Layout, + redirect: '/workStatistics', + name: 'StatisticsToilet', + meta: { + title: '作业统计', + icon: 'icon-config', // 图标 + permission: ['/statisticsToilet']// 权限名称 + }, + children: [ + { + path: '/workStatistics', + name: 'WorkStatistics', + component: () => import('@/views/statistics/toiletAssessment'), + meta: { title: '作业统计', icon: '', permission: ['/toilet/workStatistics'] } + }, + { + path: '/evaluationStatistics', + name: 'EvaluationStatistics', + component: () => import('@/views/statistics/evaluationAssessment'), + meta: { title: '评价统计', icon: '', permission: ['/toilet/evaluationStatistics'] } + } + ] + } +] diff --git a/src/router/modules/toilet.js b/src/router/modules/toilet.js new file mode 100644 index 0000000..b221a0e --- /dev/null +++ b/src/router/modules/toilet.js @@ -0,0 +1,30 @@ +/* Layout */ +import Layout from '@/layout/Layout' + +export const toiletRouters = [ + { + path: 'toiletManage', + component: Layout, + redirect: '/toiletManage', + name: 'ToiletManage', + meta: { + title: '公厕管理', + icon: 'icon-config', // 图标 + permission: ['/toiletManage']// 权限名称 + }, + children: [ + { + path: '/toiletList', + name: 'ToiletList', + component: () => import('@/views/toiletManage/toiletList'), + meta: { title: '公厕台帐管理', icon: 'function', permission: ['/toiletList'] } + }, + { + path: '/toiletMap', + name: 'ToiletMap', + component: () => import('@/views/overview/overview'), + meta: { title: '地图总览', icon: 'function', permission: ['/toiletMap'] } + } + ] + } +] diff --git a/src/router/modules/work.js b/src/router/modules/work.js new file mode 100644 index 0000000..5e0759f --- /dev/null +++ b/src/router/modules/work.js @@ -0,0 +1,24 @@ +/* Layout */ +import Layout from '@/layout/Layout' + +export const workRouters = [ + { + path: 'toiletWork', + component: Layout, + redirect: '/toiletManage', + name: 'toiletWork', + meta: { + title: '作业管理', + icon: 'icon-config', // 图标 + permission: ['/toiletWork']// 权限名称 + }, + children: [ + { + path: '/toiletWork', + name: 'ToiletWork', + component: () => import('@/views/toiletClean/toiletCleanList'), + meta: { title: '作业管理', icon: 'function', permission: ['/toiletWork'] } + } + ] + } +] diff --git a/src/settings.js b/src/settings.js index b568ce0..b8159bf 100644 --- a/src/settings.js +++ b/src/settings.js @@ -3,7 +3,7 @@ * @type {boolean} true | false * @description 是否显示设置按钮 */ - showSettings: true, + showSettings: false, /** * @type {boolean} true | false diff --git a/src/store/modules/permission.js b/src/store/modules/permission.js index a0cb8cf..3ab50d5 100644 --- a/src/store/modules/permission.js +++ b/src/store/modules/permission.js @@ -120,17 +120,23 @@ }) }, // 获取用户权限 - GetMenus({ commit, state }) { - console.log('in store.permission.js:GetMenus:') + GetMenus({ commit, state }, currentSystem) { + // console.log('in store.permission.js:GetMenus:') + console.log('获取' + currentSystem.name + '的菜单') + const params = { + parentCode: currentSystem.code // 传入该子系统的code,获取子系统的权限 + } return new Promise((resolve, reject) => { - getMenus(state.token).then(response => { // 处理返回值 + // 此处获取用户所有权限 + getMenus(params).then(response => { // 处理返回值 const data = response.data const menus = [] // 仅菜单 const btns = [] // 非菜单 if (data.menus && data.menus.length > 0) { - commit('SET_MENUS', data.menus) - for (const menu of data.menus) { // 遍历菜单,获取所有的权限项 - if (menu.ismenu === '1') { // 将是菜单的放入menus + const allmenus = [...data.menus] + commit('SET_MENUS', allmenus) + for (const menu of allmenus) { // 遍历菜单,获取所有的权限项 + if (menu.resourceType === '02' || menu.resourceType === '03') { // 将是菜单的放入menus const menu_tmp = {} menu_tmp.url = menu.url menu_tmp.icon = menu.icon @@ -142,11 +148,11 @@ btn_tmp.name = menu.name btn_tmp.icon = menu.icon btns.push(btn_tmp) - // console.log(menu.url) } } // 过滤路由表 - const accessedRouters = filterAsyncRouter(asyncRouterMap, menus) + let accessedRouters = filterAsyncRouter(asyncRouterMap, menus) + // accessedRouters = filterRedirect(accessedRouters) commit('SET_BTNS', btns) commit('SET_ROUTERS', accessedRouters) resolve(response) diff --git a/src/utils/baseConfig.js b/src/utils/baseConfig.js index 1f4fa38..999593e 100644 --- a/src/utils/baseConfig.js +++ b/src/utils/baseConfig.js @@ -1,5 +1,5 @@ const project = { - title: '后台管理系统前端基础框架' + title: '路桥养护子系统' } export function getProject() { return project diff --git a/config/index.js b/config/index.js index 8abd37a..19b33b1 100644 --- a/config/index.js +++ b/config/index.js @@ -69,7 +69,7 @@ * then assetsPublicPath should be set to "/bar/". * In most cases please use '/' !!! */ - assetsPublicPath: '/', + assetsPublicPath: '/toilet/', /** * Source Maps diff --git a/package.json b/package.json index 45f055f..9f3a3eb 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "echarts": "^4.2.1", "element-ui": "2.13.0", "event-source-polyfill": "^1.0.5", + "file-saver": "^2.0.5", "js-cookie": "2.2.0", "jsencrypt": "^3.0.0-rc.1", "leaflet": "^1.7.1", @@ -33,7 +34,9 @@ "vue-amap": "^0.5.9", "vue-baidu-map": "^0.21.22", "vue-router": "3.0.1", - "vuex": "3.0.1" + "vue2-leaflet": "^2.7.0", + "vuex": "3.0.1", + "xlsx": "^0.17.0" }, "devDependencies": { "autoprefixer": "8.5.0", diff --git a/src/api/common.js b/src/api/common.js index 87c582b..7804714 100644 --- a/src/api/common.js +++ b/src/api/common.js @@ -2,10 +2,14 @@ * 常用接口 */ import request from '@/utils/request' +import Vue from 'vue' + // 模板下载 export function downloadTemplate(fileName) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath return request({ - url: 'template/download', + url: lampPath + 'template/download', method: 'get', params: { filename: fileName @@ -19,7 +23,7 @@ const param = new FormData() param.append('file', fileobj.file) return request({ - url: 'imageUpload', + url: 'fileUpload', method: 'post', headers: { 'Content-Type': 'multipart/form-data' }, data: param diff --git a/src/api/sanitation/statistics.js b/src/api/sanitation/statistics.js new file mode 100644 index 0000000..ffeac18 --- /dev/null +++ b/src/api/sanitation/statistics.js @@ -0,0 +1,22 @@ + +/** + * 考核统计接口 + */ +import request from '@/utils/request' +// 公厕保洁次数统计 +export function getToiletJobCount(params) { + return request({ + url: '/sanitation/statistic/toilet/jobCount', + method: 'get', + params + }) +} + +// 公厕评分统计 +export function getToiletEvaluation(params) { + return request({ + url: '/sanitation/toiletEvaluation/statistics', + method: 'get', + params + }) +} diff --git a/src/api/sanitation/toilet.js b/src/api/sanitation/toilet.js new file mode 100644 index 0000000..11affd4 --- /dev/null +++ b/src/api/sanitation/toilet.js @@ -0,0 +1,133 @@ +/** + * 公厕管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' +// 公厕查询 +export function getToiletListPage(params) { + return request({ + url: '/sanitation/toilet/listPage', + method: 'get', + params + }) +} +// 公厕查询 +export function getToiletList(pid) { + return request({ + url: '/sanitation/toilet/list', + method: 'get', + params: { + pid: pid + } + }) +} + +// 添加公厕 +export function addToilet(params) { + return request({ + url: '/sanitation/toilet/add', + method: 'post', + params + }) +} +// 修改公厕机构 +export function updateToilet(params) { + return request({ + url: '/sanitation/toilet/update', + method: 'post', + params + }) +} +// 删除公厕机构 +export function delToilet(ids) { + return request({ + url: '/sanitation/toilet/delete', + method: 'post', + params: { + ids + }, + paramsSerializer: params => { + return qs.stringify(params, { indices: false }) + } + }) +} + +// 公厕基本信息详情 +export function getToiletInfoDetail(id) { + return request({ + url: '/sanitation/toilet/detail?toiletId=' + id, + method: 'get' + }) +} + +// 某公厕保洁记录 +export function getRecordsByToilet(params) { + return request({ + url: '/sanitation/toilet/jobRecord/detail', + method: 'get', + params + }) +} + +// 某公厕平均评分 +export function getScoreByToilet(params) { + return request({ + url: '/sanitation/toiletEvaluation/detailScore', + method: 'get', + params + }) +} + +// 某公厕评分列表 +export function getScoreListByToilet(params) { + return request({ + url: '/sanitation/toiletEvaluation/list', + method: 'get', + params + }) +} + + +// 批量导入 +export function batchImportToilet(fileobj) { + const param = new FormData() + param.append('file', fileobj) + return request({ + url: '/sanitation/toilet/import', + method: 'post', + headers: { 'Content-Type': 'multipart/form-data' }, + data: param + }) +} +// 批量导出 +export function batchExportToilet(params, config) { + return request({ + url: '/sanitation/toilet/export', + method: 'get', + timeout: 120000, + params, + ...config, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 公厕保洁记录查询 +export function getToiletJobRecords(params) { + return request({ + url: '/sanitation/toilet/jobRecord', + method: 'get', + params + }) +} + +// 批量导出 +export function batchExportToiletJobRecords(params, config) { + return request({ + url: '/sanitation/toilet/exportJobRecord', + method: 'get', + timeout: 120000, + params, + ...config, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} diff --git a/src/api/system/alarm.js b/src/api/system/alarm.js new file mode 100644 index 0000000..1c3a7ab --- /dev/null +++ b/src/api/system/alarm.js @@ -0,0 +1,62 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' + +// 获取当前报警列表 +export function getAlarmNowList(params) { + return request({ + url: '/alarm/listNowPage', + method: 'get', + params + }) +} + +// 获取当前报警列表 +export function getAlarmHistoryList(params) { + return request({ + url: '/alarm/listHisPage', + method: 'get', + params + }) +} + + +// 批量消警 +export function clearAll(params) { + return request({ + url: '/alarm/allClear', + method: 'get', + params + }) +} + +// 消警 +export function clearAlarm(params) { + return request({ + url: '/alarm/cancel', + method: 'get', + params + }) +} + +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 设置报警阈值 +export function setThresh(params) { + return request({ + url: '/alarm/resetAlarmRule', + method: 'post', + params + }) +} diff --git a/src/api/system/bridge.js b/src/api/system/bridge.js new file mode 100644 index 0000000..e8a4108 --- /dev/null +++ b/src/api/system/bridge.js @@ -0,0 +1,80 @@ +/** + * 桥梁管理接口 + */ +import request from '@/utils/request' + +// 获取桥梁详情 +export function getDetail(id) { + return request({ + url: '/bridge/detail', + method: 'get', + params: { + id: id + } + }) +} + +export function updateBridge(params) { + return request({ + url: '/bridge/update', + method: 'post', + params + }) +} +// 批量导出 +export function exportRecords(params) { + return request({ + url: 'device/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +export function getContentList(params) { + return request({ + url: 'maintain/contentByType', + method: 'get', + params: { + type: params + } + }) +} +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 编辑 +export function editRecord(params) { + return request({ + url: 'maintain/update', + method: 'post', + params + }) +} +// 新增 +export function addRecord(params) { + return request({ + url: 'maintain/add', + method: 'post', + params + }) +} +// 删除 +export function delRecord(id) { + return request({ + url: 'maintain/delete', + method: 'post', + params: { + id: id + } + }) +} diff --git a/src/api/system/data.js b/src/api/system/data.js new file mode 100644 index 0000000..4c95db5 --- /dev/null +++ b/src/api/system/data.js @@ -0,0 +1,63 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' + +// 获取当前报警列表 +export function getHistoryList(params) { + return request({ + url: '/data/hisListPage', + method: 'get', + params + }) +} + +// 获取当前报警列表 +export function getHistory(params) { + return request({ + url: '/data/hisList', + method: 'get', + params + }) +} + + + +// 批量消警 +export function clearAll(params) { + return request({ + url: '/alarm/allClear', + method: 'get', + params + }) +} + +// 消警 +export function clearAlarm(params) { + return request({ + url: '/alarm/cancel', + method: 'get', + params + }) +} + +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 设置报警阈值 +export function setThresh(params) { + return request({ + url: '/alarm/resetAlarmRule', + method: 'post', + params + }) +} diff --git a/src/api/system/order.js b/src/api/system/order.js new file mode 100644 index 0000000..7007c50 --- /dev/null +++ b/src/api/system/order.js @@ -0,0 +1,71 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +// import qs from 'qs' + +// 获取当前报警列表 +export function getRecordList(params) { + return request({ + url: '/maintain/listPage', + method: 'get', + params + }) +} +// 批量导出 +export function exportRecords(params) { + return request({ + url: 'device/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +export function getContentList(params) { + return request({ + url: 'maintain/contentByType', + method: 'get', + params: { + type: params + } + }) +} +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 编辑 +export function editRecord(params) { + return request({ + url: 'maintain/update', + method: 'post', + params + }) +} +// 新增 +export function addRecord(params) { + return request({ + url: 'maintain/add', + method: 'post', + params + }) +} +// 删除 +export function delRecord(id) { + return request({ + url: 'maintain/delete', + method: 'post', + params: { + bridgeMaintenanceId: id + } + }) +} diff --git a/src/api/system/overview.js b/src/api/system/overview.js new file mode 100644 index 0000000..bca50cc --- /dev/null +++ b/src/api/system/overview.js @@ -0,0 +1,109 @@ +import request from '@/utils/request' +import qs from "qs" +import Vue from 'vue' + +// 路灯状态统计 +export function getLampStatus() { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampStatus', + method: 'get' + }) +} + +// 路灯总览列表 +export function getLampList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampList', + method: 'get', + params + }) +} + +// 路灯详情 +export function getlampDetail(lampId) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampDetail', + method: 'get', + params: { + lampId: lampId + } + }) +} + +// 回路列表 +export function getCircuitList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/circuitList', + method: 'get', + params + }) +} + +// 灯箱列表 +export function getLampBoxList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampBoxList', + method: 'get', + params + }) +} +// 灯箱详情 +export function getLampBoxDetail(lampBoxId) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampBoxDetail', + method: 'get', + params: { + lampBoxId: lampBoxId + } + }) +} + +// 报警总览列表 +export function getAlarmList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/alarmList', + method: 'get', + params + }) +} + +// 报警详情 +export function getAlarmDetail(alarmId) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/alarmDetail', + method: 'get', + params: { + alarmId: alarmId + } + }) +} + +// 路灯控制 +export function lampControl(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampControl', + method: 'post', + params, + paramsSerializer: params => { + return qs.stringify(params, { indices: false }) + } + }) +} diff --git a/src/api/system/rule.js b/src/api/system/rule.js new file mode 100644 index 0000000..76c6b2d --- /dev/null +++ b/src/api/system/rule.js @@ -0,0 +1,59 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +// import qs from 'qs' + +// 获取当前报警列表 +export function getRuleList() { + return request({ + url: 'rule/listPage', + method: 'get' + }) +} +export function getContentList(params) { + return request({ + url: 'maintain/contentByType', + method: 'get', + params: { + type: params + } + }) +} +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 编辑 +export function editRecord(params) { + return request({ + url: 'maintain/update', + method: 'post', + params + }) +} +// 新增 +export function addRecord(params) { + return request({ + url: 'maintain/add', + method: 'post', + params + }) +} +// 删除 +export function delRecord(id) { + return request({ + url: 'maintain/delete', + method: 'post', + params: { + id: id + } + }) +} diff --git a/src/api/system/statistics.js b/src/api/system/statistics.js new file mode 100644 index 0000000..b25efe9 --- /dev/null +++ b/src/api/system/statistics.js @@ -0,0 +1,23 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +// import qs from 'qs' + +// +export function countByToilet(params) { + return request({ + url: '/sanitation/toiletStatistic/jobStaticByToilet', + method: 'get', + params + }) +} + +export function countByDay(params) { + return request({ + url: '/sanitation/toiletStatistic/jobStaticByDate', + method: 'get', + params + }) +} + diff --git a/src/assets/global_images/icon-position.png b/src/assets/global_images/icon-position.png new file mode 100644 index 0000000..7444038 --- /dev/null +++ b/src/assets/global_images/icon-position.png Binary files differ diff --git a/src/assets/global_images/location_green.png b/src/assets/global_images/location_green.png new file mode 100644 index 0000000..aa8be65 --- /dev/null +++ b/src/assets/global_images/location_green.png Binary files differ diff --git a/src/assets/global_images/location_red.png b/src/assets/global_images/location_red.png new file mode 100644 index 0000000..2be8c3d --- /dev/null +++ b/src/assets/global_images/location_red.png Binary files differ diff --git a/src/assets/global_images/location_yellow.png b/src/assets/global_images/location_yellow.png new file mode 100644 index 0000000..5ab6f4d --- /dev/null +++ b/src/assets/global_images/location_yellow.png Binary files differ diff --git a/src/assets/global_images/toilet-position.png b/src/assets/global_images/toilet-position.png new file mode 100644 index 0000000..7db6d9a --- /dev/null +++ b/src/assets/global_images/toilet-position.png Binary files differ diff --git a/src/assets/global_images/toilet.png b/src/assets/global_images/toilet.png new file mode 100644 index 0000000..6d9fc05 --- /dev/null +++ b/src/assets/global_images/toilet.png Binary files differ diff --git a/src/assets/global_images/toiletPhoto.png b/src/assets/global_images/toiletPhoto.png new file mode 100644 index 0000000..15d08e2 --- /dev/null +++ b/src/assets/global_images/toiletPhoto.png Binary files differ diff --git a/src/components/DownloadTemplate/index.vue b/src/components/DownloadTemplate/index.vue index 8ded2cd..7807cac 100644 --- a/src/components/DownloadTemplate/index.vue +++ b/src/components/DownloadTemplate/index.vue @@ -47,8 +47,8 @@ diff --git a/src/components/NormalTable/index.vue b/src/components/NormalTable/index.vue index 5077bef..04d322d 100644 --- a/src/components/NormalTable/index.vue +++ b/src/components/NormalTable/index.vue @@ -79,7 +79,7 @@
-
+
Object.assign(obj, { [key]: this[key] }), {}), + on: events.reduce((obj, key) => Object.assign(obj, { [key]: this.transmitEvent }), {}) + }) + } + this.props = [...extraProps, ...props.filter(prop => exceptProps.indexOf(prop))] + } +} + +export default prop => new Mixin(prop) diff --git a/src/components/mapWindow/base/mixins/common.js b/src/components/mapWindow/base/mixins/common.js new file mode 100644 index 0000000..2fd1a28 --- /dev/null +++ b/src/components/mapWindow/base/mixins/common.js @@ -0,0 +1,82 @@ +const types = { + map: { + unload: 'clearMap' + }, + control: { + unload: 'removeControl' + }, + layer: { + unload: 'removeLayer' + }, + features: { + unload: 'removeFeatures' + }, + listener: { + unload: 'removeListener' + } +} + +const getParent = $component => ($component.abstract || $component.$el === $component.$children[0].$el) ? getParent($component.$parent) : $component + +function destroyInstance () { + const { unload, renderByParent, $parent } = this + if (renderByParent) { + $parent.reload() + } + unload() +} + +class Mixin { + constructor (prop) { + this.methods = { + ready () { + const $parent = getParent(this.$parent) + const map = this.map = $parent.map + this.load() + this.$emit('ready', { + map + }) + }, + transmitEvent (e) { + this.$emit(e.type.replace(/^on/, ''), e) + }, + reload () { + this && this.$nextTick(() => { + this.unload() + this.$nextTick(this.load) + }) + }, + unload () { + const { map, originInstance } = this + try { + switch (prop.type) { + case 'search': + return originInstance.clearResults() + case 'autoComplete': + case 'lushu': + return originInstance.dispose() + case 'markerClusterer': + return originInstance.clearMarkers() + default: + map[types[prop.type].unload](originInstance) + } + } catch (e) {} + } + } + this.computed = { + renderByParent () { + return this.$parent.preventChildrenRender + } + } + this.mounted = function () { + console.log('common mounted') + const $parent = getParent(this.$parent) + const map = $parent.map + const { ready } = this + console.log(map) + map ? ready() : $parent.$on('onload', ready) + } + } +} + +export default type => new Mixin({ type }) diff --git a/src/components/mapWindow/leafletMap.vue b/src/components/mapWindow/leafletMap.vue new file mode 100644 index 0000000..b753cc0 --- /dev/null +++ b/src/components/mapWindow/leafletMap.vue @@ -0,0 +1,143 @@ + + + + + + + diff --git a/src/components/mapWindow/mapWindow.vue b/src/components/mapWindow/mapWindow.vue new file mode 100644 index 0000000..9ced291 --- /dev/null +++ b/src/components/mapWindow/mapWindow.vue @@ -0,0 +1,46 @@ + + + + + + diff --git a/src/icons/svg/bridge.svg b/src/icons/svg/bridge.svg new file mode 100644 index 0000000..1a0336f --- /dev/null +++ b/src/icons/svg/bridge.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/icons/svg/toilet.svg b/src/icons/svg/toilet.svg new file mode 100644 index 0000000..9d8e765 --- /dev/null +++ b/src/icons/svg/toilet.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/main.js b/src/main.js index f2d105d..3e4074e 100644 --- a/src/main.js +++ b/src/main.js @@ -18,6 +18,9 @@ // echart // import echarts from 'echarts' // Vue.prototype.$echarts = echarts +// 引入v-charts +import VCharts from 'v-charts' +Vue.use(VCharts) // 将自动注册所有组件为全局组件 // import dataV from '@jiaminghi/data-view' @@ -35,9 +38,19 @@ Vue.component('search-item', SearchItem) // 加载leaflet的css +// import 'leaflet/dist/leaflet.css' +// import 'leaflet-draw/dist/leaflet.draw.css' +import L from 'leaflet' import 'leaflet/dist/leaflet.css' -import 'leaflet-draw/dist/leaflet.draw.css' +Vue.config.productionTip = false +Vue.L = Vue.prototype.$L = L +delete L.Icon.Default.prototype._getIconUrl +L.Icon.Default.mergeOptions({ + iconRetinaUrl: require('leaflet/dist/images/marker-icon-2x.png'), + iconUrl: require('leaflet/dist/images/marker-icon.png'), + shadowUrl: require('leaflet/dist/images/marker-shadow.png') +}) /** * This project originally used easy-mock to simulate data, * but its official service is very unstable, diff --git a/src/permission.js b/src/permission.js index dc6b2f8..809ca86 100644 --- a/src/permission.js +++ b/src/permission.js @@ -25,8 +25,8 @@ store.dispatch('GetInfo').then(res => { // 拉取用户信息 // 设置当前子系统为基础资源子系统 const currentSys = { - code: 'baseResourse', - name: '基础资源子系统' + code: 'toliet', + name: '公共厕所管理系统' } // 将当前系统信息保存在localStorage中 store.commit('SET_SYSTEM', currentSys) diff --git a/src/router/index.js b/src/router/index.js index 39c295c..d23076d 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -8,8 +8,11 @@ /* Layout */ import Layout from '@/layout/Layout' +import { toiletRouters } from './modules/toilet' +import { workRouters } from './modules/work' +import { statisticsRouters } from './modules/statistics' +import { ruleRouters } from './modules/rule' import { systemRouters } from './modules/system' -import { exampleRouters } from './modules/example' /** * hidden: true if `hidden:true` will not show in the sidebar(default is false) @@ -40,11 +43,12 @@ ] }, // 登录页面 - { path: '/login', component: () => import('@/views/login/index'), hidden: true }, + { path: '/login', component: () => import('@/views/login/index_2'), hidden: true }, // 404错误页面 { path: '/404', component: () => import('@/views/errorPage/404'), hidden: true }, // 401 错误页面 - { path: '/401', component: () => import('@/views/errorPage/401'), hidden: true } + { path: '/401', component: () => import('@/views/errorPage/401'), hidden: true }, + { path: '/', redirect: '/toiletList', hidden: true } ] // 实例化vue的时候直挂载constantRouter export default new Router({ @@ -56,7 +60,10 @@ // 异步挂载路由 // 动态需要根据权限加载的路由表 export const asyncRouterMap = [ - ...exampleRouters, - ...systemRouters, + ...toiletRouters, + ...workRouters, + ...statisticsRouters, + ...ruleRouters, + // ...systemRouters, { path: '*', redirect: '/404', hidden: true } ] diff --git a/src/router/modules/rule.js b/src/router/modules/rule.js new file mode 100644 index 0000000..51e0283 --- /dev/null +++ b/src/router/modules/rule.js @@ -0,0 +1,24 @@ +/* Layout */ +import Layout from '@/layout/Layout' + +export const ruleRouters = [ + { + path: 'rule', + component: Layout, + redirect: '/rule', + name: 'Rule', + meta: { + title: '规章制度', + icon: 'icon-config', // 图标 + permission: ['/rule']// 权限名称 + }, + children: [ + { + path: '/rule', + name: 'Rule', + component: () => import('@/views/rule/listRule'), + meta: { title: '规章制度', icon: 'function', permission: ['/rule'] } + } + ] + } +] diff --git a/src/router/modules/statistics.js b/src/router/modules/statistics.js new file mode 100644 index 0000000..fb9cbea --- /dev/null +++ b/src/router/modules/statistics.js @@ -0,0 +1,30 @@ +/* Layout */ +import Layout from '@/layout/Layout' + +export const statisticsRouters = [ + { + path: 'statisticsToilet', + component: Layout, + redirect: '/workStatistics', + name: 'StatisticsToilet', + meta: { + title: '作业统计', + icon: 'icon-config', // 图标 + permission: ['/statisticsToilet']// 权限名称 + }, + children: [ + { + path: '/workStatistics', + name: 'WorkStatistics', + component: () => import('@/views/statistics/toiletAssessment'), + meta: { title: '作业统计', icon: '', permission: ['/toilet/workStatistics'] } + }, + { + path: '/evaluationStatistics', + name: 'EvaluationStatistics', + component: () => import('@/views/statistics/evaluationAssessment'), + meta: { title: '评价统计', icon: '', permission: ['/toilet/evaluationStatistics'] } + } + ] + } +] diff --git a/src/router/modules/toilet.js b/src/router/modules/toilet.js new file mode 100644 index 0000000..b221a0e --- /dev/null +++ b/src/router/modules/toilet.js @@ -0,0 +1,30 @@ +/* Layout */ +import Layout from '@/layout/Layout' + +export const toiletRouters = [ + { + path: 'toiletManage', + component: Layout, + redirect: '/toiletManage', + name: 'ToiletManage', + meta: { + title: '公厕管理', + icon: 'icon-config', // 图标 + permission: ['/toiletManage']// 权限名称 + }, + children: [ + { + path: '/toiletList', + name: 'ToiletList', + component: () => import('@/views/toiletManage/toiletList'), + meta: { title: '公厕台帐管理', icon: 'function', permission: ['/toiletList'] } + }, + { + path: '/toiletMap', + name: 'ToiletMap', + component: () => import('@/views/overview/overview'), + meta: { title: '地图总览', icon: 'function', permission: ['/toiletMap'] } + } + ] + } +] diff --git a/src/router/modules/work.js b/src/router/modules/work.js new file mode 100644 index 0000000..5e0759f --- /dev/null +++ b/src/router/modules/work.js @@ -0,0 +1,24 @@ +/* Layout */ +import Layout from '@/layout/Layout' + +export const workRouters = [ + { + path: 'toiletWork', + component: Layout, + redirect: '/toiletManage', + name: 'toiletWork', + meta: { + title: '作业管理', + icon: 'icon-config', // 图标 + permission: ['/toiletWork']// 权限名称 + }, + children: [ + { + path: '/toiletWork', + name: 'ToiletWork', + component: () => import('@/views/toiletClean/toiletCleanList'), + meta: { title: '作业管理', icon: 'function', permission: ['/toiletWork'] } + } + ] + } +] diff --git a/src/settings.js b/src/settings.js index b568ce0..b8159bf 100644 --- a/src/settings.js +++ b/src/settings.js @@ -3,7 +3,7 @@ * @type {boolean} true | false * @description 是否显示设置按钮 */ - showSettings: true, + showSettings: false, /** * @type {boolean} true | false diff --git a/src/store/modules/permission.js b/src/store/modules/permission.js index a0cb8cf..3ab50d5 100644 --- a/src/store/modules/permission.js +++ b/src/store/modules/permission.js @@ -120,17 +120,23 @@ }) }, // 获取用户权限 - GetMenus({ commit, state }) { - console.log('in store.permission.js:GetMenus:') + GetMenus({ commit, state }, currentSystem) { + // console.log('in store.permission.js:GetMenus:') + console.log('获取' + currentSystem.name + '的菜单') + const params = { + parentCode: currentSystem.code // 传入该子系统的code,获取子系统的权限 + } return new Promise((resolve, reject) => { - getMenus(state.token).then(response => { // 处理返回值 + // 此处获取用户所有权限 + getMenus(params).then(response => { // 处理返回值 const data = response.data const menus = [] // 仅菜单 const btns = [] // 非菜单 if (data.menus && data.menus.length > 0) { - commit('SET_MENUS', data.menus) - for (const menu of data.menus) { // 遍历菜单,获取所有的权限项 - if (menu.ismenu === '1') { // 将是菜单的放入menus + const allmenus = [...data.menus] + commit('SET_MENUS', allmenus) + for (const menu of allmenus) { // 遍历菜单,获取所有的权限项 + if (menu.resourceType === '02' || menu.resourceType === '03') { // 将是菜单的放入menus const menu_tmp = {} menu_tmp.url = menu.url menu_tmp.icon = menu.icon @@ -142,11 +148,11 @@ btn_tmp.name = menu.name btn_tmp.icon = menu.icon btns.push(btn_tmp) - // console.log(menu.url) } } // 过滤路由表 - const accessedRouters = filterAsyncRouter(asyncRouterMap, menus) + let accessedRouters = filterAsyncRouter(asyncRouterMap, menus) + // accessedRouters = filterRedirect(accessedRouters) commit('SET_BTNS', btns) commit('SET_ROUTERS', accessedRouters) resolve(response) diff --git a/src/utils/baseConfig.js b/src/utils/baseConfig.js index 1f4fa38..999593e 100644 --- a/src/utils/baseConfig.js +++ b/src/utils/baseConfig.js @@ -1,5 +1,5 @@ const project = { - title: '后台管理系统前端基础框架' + title: '路桥养护子系统' } export function getProject() { return project diff --git a/src/utils/dateutils.js b/src/utils/dateutils.js index 868111a..5cd16af 100644 --- a/src/utils/dateutils.js +++ b/src/utils/dateutils.js @@ -15,15 +15,15 @@ return ct_month } -export function getLastWeek() { // 默认显示上周 +export function getLastWeek(fmt) { // 默认显示上周 const ct_month = new Date() ct_month.setTime(ct_month.getTime() - 3600 * 1000 * 24 * 7) - return ct_month + return ct_month.Format(fmt) } -export function getLastMonth() { // 默认显示上个月 +export function getLastMonth(fmt) { // 默认显示上个月 const ct_month = new Date() ct_month.setTime(ct_month.getTime() - 3600 * 1000 * 24 * 30) - return ct_month + return ct_month.Format(fmt) } // 对Date的扩展,将 Date 转化为指定格式的String diff --git a/config/index.js b/config/index.js index 8abd37a..19b33b1 100644 --- a/config/index.js +++ b/config/index.js @@ -69,7 +69,7 @@ * then assetsPublicPath should be set to "/bar/". * In most cases please use '/' !!! */ - assetsPublicPath: '/', + assetsPublicPath: '/toilet/', /** * Source Maps diff --git a/package.json b/package.json index 45f055f..9f3a3eb 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "echarts": "^4.2.1", "element-ui": "2.13.0", "event-source-polyfill": "^1.0.5", + "file-saver": "^2.0.5", "js-cookie": "2.2.0", "jsencrypt": "^3.0.0-rc.1", "leaflet": "^1.7.1", @@ -33,7 +34,9 @@ "vue-amap": "^0.5.9", "vue-baidu-map": "^0.21.22", "vue-router": "3.0.1", - "vuex": "3.0.1" + "vue2-leaflet": "^2.7.0", + "vuex": "3.0.1", + "xlsx": "^0.17.0" }, "devDependencies": { "autoprefixer": "8.5.0", diff --git a/src/api/common.js b/src/api/common.js index 87c582b..7804714 100644 --- a/src/api/common.js +++ b/src/api/common.js @@ -2,10 +2,14 @@ * 常用接口 */ import request from '@/utils/request' +import Vue from 'vue' + // 模板下载 export function downloadTemplate(fileName) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath return request({ - url: 'template/download', + url: lampPath + 'template/download', method: 'get', params: { filename: fileName @@ -19,7 +23,7 @@ const param = new FormData() param.append('file', fileobj.file) return request({ - url: 'imageUpload', + url: 'fileUpload', method: 'post', headers: { 'Content-Type': 'multipart/form-data' }, data: param diff --git a/src/api/sanitation/statistics.js b/src/api/sanitation/statistics.js new file mode 100644 index 0000000..ffeac18 --- /dev/null +++ b/src/api/sanitation/statistics.js @@ -0,0 +1,22 @@ + +/** + * 考核统计接口 + */ +import request from '@/utils/request' +// 公厕保洁次数统计 +export function getToiletJobCount(params) { + return request({ + url: '/sanitation/statistic/toilet/jobCount', + method: 'get', + params + }) +} + +// 公厕评分统计 +export function getToiletEvaluation(params) { + return request({ + url: '/sanitation/toiletEvaluation/statistics', + method: 'get', + params + }) +} diff --git a/src/api/sanitation/toilet.js b/src/api/sanitation/toilet.js new file mode 100644 index 0000000..11affd4 --- /dev/null +++ b/src/api/sanitation/toilet.js @@ -0,0 +1,133 @@ +/** + * 公厕管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' +// 公厕查询 +export function getToiletListPage(params) { + return request({ + url: '/sanitation/toilet/listPage', + method: 'get', + params + }) +} +// 公厕查询 +export function getToiletList(pid) { + return request({ + url: '/sanitation/toilet/list', + method: 'get', + params: { + pid: pid + } + }) +} + +// 添加公厕 +export function addToilet(params) { + return request({ + url: '/sanitation/toilet/add', + method: 'post', + params + }) +} +// 修改公厕机构 +export function updateToilet(params) { + return request({ + url: '/sanitation/toilet/update', + method: 'post', + params + }) +} +// 删除公厕机构 +export function delToilet(ids) { + return request({ + url: '/sanitation/toilet/delete', + method: 'post', + params: { + ids + }, + paramsSerializer: params => { + return qs.stringify(params, { indices: false }) + } + }) +} + +// 公厕基本信息详情 +export function getToiletInfoDetail(id) { + return request({ + url: '/sanitation/toilet/detail?toiletId=' + id, + method: 'get' + }) +} + +// 某公厕保洁记录 +export function getRecordsByToilet(params) { + return request({ + url: '/sanitation/toilet/jobRecord/detail', + method: 'get', + params + }) +} + +// 某公厕平均评分 +export function getScoreByToilet(params) { + return request({ + url: '/sanitation/toiletEvaluation/detailScore', + method: 'get', + params + }) +} + +// 某公厕评分列表 +export function getScoreListByToilet(params) { + return request({ + url: '/sanitation/toiletEvaluation/list', + method: 'get', + params + }) +} + + +// 批量导入 +export function batchImportToilet(fileobj) { + const param = new FormData() + param.append('file', fileobj) + return request({ + url: '/sanitation/toilet/import', + method: 'post', + headers: { 'Content-Type': 'multipart/form-data' }, + data: param + }) +} +// 批量导出 +export function batchExportToilet(params, config) { + return request({ + url: '/sanitation/toilet/export', + method: 'get', + timeout: 120000, + params, + ...config, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 公厕保洁记录查询 +export function getToiletJobRecords(params) { + return request({ + url: '/sanitation/toilet/jobRecord', + method: 'get', + params + }) +} + +// 批量导出 +export function batchExportToiletJobRecords(params, config) { + return request({ + url: '/sanitation/toilet/exportJobRecord', + method: 'get', + timeout: 120000, + params, + ...config, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} diff --git a/src/api/system/alarm.js b/src/api/system/alarm.js new file mode 100644 index 0000000..1c3a7ab --- /dev/null +++ b/src/api/system/alarm.js @@ -0,0 +1,62 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' + +// 获取当前报警列表 +export function getAlarmNowList(params) { + return request({ + url: '/alarm/listNowPage', + method: 'get', + params + }) +} + +// 获取当前报警列表 +export function getAlarmHistoryList(params) { + return request({ + url: '/alarm/listHisPage', + method: 'get', + params + }) +} + + +// 批量消警 +export function clearAll(params) { + return request({ + url: '/alarm/allClear', + method: 'get', + params + }) +} + +// 消警 +export function clearAlarm(params) { + return request({ + url: '/alarm/cancel', + method: 'get', + params + }) +} + +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 设置报警阈值 +export function setThresh(params) { + return request({ + url: '/alarm/resetAlarmRule', + method: 'post', + params + }) +} diff --git a/src/api/system/bridge.js b/src/api/system/bridge.js new file mode 100644 index 0000000..e8a4108 --- /dev/null +++ b/src/api/system/bridge.js @@ -0,0 +1,80 @@ +/** + * 桥梁管理接口 + */ +import request from '@/utils/request' + +// 获取桥梁详情 +export function getDetail(id) { + return request({ + url: '/bridge/detail', + method: 'get', + params: { + id: id + } + }) +} + +export function updateBridge(params) { + return request({ + url: '/bridge/update', + method: 'post', + params + }) +} +// 批量导出 +export function exportRecords(params) { + return request({ + url: 'device/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +export function getContentList(params) { + return request({ + url: 'maintain/contentByType', + method: 'get', + params: { + type: params + } + }) +} +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 编辑 +export function editRecord(params) { + return request({ + url: 'maintain/update', + method: 'post', + params + }) +} +// 新增 +export function addRecord(params) { + return request({ + url: 'maintain/add', + method: 'post', + params + }) +} +// 删除 +export function delRecord(id) { + return request({ + url: 'maintain/delete', + method: 'post', + params: { + id: id + } + }) +} diff --git a/src/api/system/data.js b/src/api/system/data.js new file mode 100644 index 0000000..4c95db5 --- /dev/null +++ b/src/api/system/data.js @@ -0,0 +1,63 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' + +// 获取当前报警列表 +export function getHistoryList(params) { + return request({ + url: '/data/hisListPage', + method: 'get', + params + }) +} + +// 获取当前报警列表 +export function getHistory(params) { + return request({ + url: '/data/hisList', + method: 'get', + params + }) +} + + + +// 批量消警 +export function clearAll(params) { + return request({ + url: '/alarm/allClear', + method: 'get', + params + }) +} + +// 消警 +export function clearAlarm(params) { + return request({ + url: '/alarm/cancel', + method: 'get', + params + }) +} + +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 设置报警阈值 +export function setThresh(params) { + return request({ + url: '/alarm/resetAlarmRule', + method: 'post', + params + }) +} diff --git a/src/api/system/order.js b/src/api/system/order.js new file mode 100644 index 0000000..7007c50 --- /dev/null +++ b/src/api/system/order.js @@ -0,0 +1,71 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +// import qs from 'qs' + +// 获取当前报警列表 +export function getRecordList(params) { + return request({ + url: '/maintain/listPage', + method: 'get', + params + }) +} +// 批量导出 +export function exportRecords(params) { + return request({ + url: 'device/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +export function getContentList(params) { + return request({ + url: 'maintain/contentByType', + method: 'get', + params: { + type: params + } + }) +} +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 编辑 +export function editRecord(params) { + return request({ + url: 'maintain/update', + method: 'post', + params + }) +} +// 新增 +export function addRecord(params) { + return request({ + url: 'maintain/add', + method: 'post', + params + }) +} +// 删除 +export function delRecord(id) { + return request({ + url: 'maintain/delete', + method: 'post', + params: { + bridgeMaintenanceId: id + } + }) +} diff --git a/src/api/system/overview.js b/src/api/system/overview.js new file mode 100644 index 0000000..bca50cc --- /dev/null +++ b/src/api/system/overview.js @@ -0,0 +1,109 @@ +import request from '@/utils/request' +import qs from "qs" +import Vue from 'vue' + +// 路灯状态统计 +export function getLampStatus() { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampStatus', + method: 'get' + }) +} + +// 路灯总览列表 +export function getLampList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampList', + method: 'get', + params + }) +} + +// 路灯详情 +export function getlampDetail(lampId) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampDetail', + method: 'get', + params: { + lampId: lampId + } + }) +} + +// 回路列表 +export function getCircuitList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/circuitList', + method: 'get', + params + }) +} + +// 灯箱列表 +export function getLampBoxList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampBoxList', + method: 'get', + params + }) +} +// 灯箱详情 +export function getLampBoxDetail(lampBoxId) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampBoxDetail', + method: 'get', + params: { + lampBoxId: lampBoxId + } + }) +} + +// 报警总览列表 +export function getAlarmList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/alarmList', + method: 'get', + params + }) +} + +// 报警详情 +export function getAlarmDetail(alarmId) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/alarmDetail', + method: 'get', + params: { + alarmId: alarmId + } + }) +} + +// 路灯控制 +export function lampControl(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampControl', + method: 'post', + params, + paramsSerializer: params => { + return qs.stringify(params, { indices: false }) + } + }) +} diff --git a/src/api/system/rule.js b/src/api/system/rule.js new file mode 100644 index 0000000..76c6b2d --- /dev/null +++ b/src/api/system/rule.js @@ -0,0 +1,59 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +// import qs from 'qs' + +// 获取当前报警列表 +export function getRuleList() { + return request({ + url: 'rule/listPage', + method: 'get' + }) +} +export function getContentList(params) { + return request({ + url: 'maintain/contentByType', + method: 'get', + params: { + type: params + } + }) +} +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 编辑 +export function editRecord(params) { + return request({ + url: 'maintain/update', + method: 'post', + params + }) +} +// 新增 +export function addRecord(params) { + return request({ + url: 'maintain/add', + method: 'post', + params + }) +} +// 删除 +export function delRecord(id) { + return request({ + url: 'maintain/delete', + method: 'post', + params: { + id: id + } + }) +} diff --git a/src/api/system/statistics.js b/src/api/system/statistics.js new file mode 100644 index 0000000..b25efe9 --- /dev/null +++ b/src/api/system/statistics.js @@ -0,0 +1,23 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +// import qs from 'qs' + +// +export function countByToilet(params) { + return request({ + url: '/sanitation/toiletStatistic/jobStaticByToilet', + method: 'get', + params + }) +} + +export function countByDay(params) { + return request({ + url: '/sanitation/toiletStatistic/jobStaticByDate', + method: 'get', + params + }) +} + diff --git a/src/assets/global_images/icon-position.png b/src/assets/global_images/icon-position.png new file mode 100644 index 0000000..7444038 --- /dev/null +++ b/src/assets/global_images/icon-position.png Binary files differ diff --git a/src/assets/global_images/location_green.png b/src/assets/global_images/location_green.png new file mode 100644 index 0000000..aa8be65 --- /dev/null +++ b/src/assets/global_images/location_green.png Binary files differ diff --git a/src/assets/global_images/location_red.png b/src/assets/global_images/location_red.png new file mode 100644 index 0000000..2be8c3d --- /dev/null +++ b/src/assets/global_images/location_red.png Binary files differ diff --git a/src/assets/global_images/location_yellow.png b/src/assets/global_images/location_yellow.png new file mode 100644 index 0000000..5ab6f4d --- /dev/null +++ b/src/assets/global_images/location_yellow.png Binary files differ diff --git a/src/assets/global_images/toilet-position.png b/src/assets/global_images/toilet-position.png new file mode 100644 index 0000000..7db6d9a --- /dev/null +++ b/src/assets/global_images/toilet-position.png Binary files differ diff --git a/src/assets/global_images/toilet.png b/src/assets/global_images/toilet.png new file mode 100644 index 0000000..6d9fc05 --- /dev/null +++ b/src/assets/global_images/toilet.png Binary files differ diff --git a/src/assets/global_images/toiletPhoto.png b/src/assets/global_images/toiletPhoto.png new file mode 100644 index 0000000..15d08e2 --- /dev/null +++ b/src/assets/global_images/toiletPhoto.png Binary files differ diff --git a/src/components/DownloadTemplate/index.vue b/src/components/DownloadTemplate/index.vue index 8ded2cd..7807cac 100644 --- a/src/components/DownloadTemplate/index.vue +++ b/src/components/DownloadTemplate/index.vue @@ -47,8 +47,8 @@ diff --git a/src/components/NormalTable/index.vue b/src/components/NormalTable/index.vue index 5077bef..04d322d 100644 --- a/src/components/NormalTable/index.vue +++ b/src/components/NormalTable/index.vue @@ -79,7 +79,7 @@
-
+
Object.assign(obj, { [key]: this[key] }), {}), + on: events.reduce((obj, key) => Object.assign(obj, { [key]: this.transmitEvent }), {}) + }) + } + this.props = [...extraProps, ...props.filter(prop => exceptProps.indexOf(prop))] + } +} + +export default prop => new Mixin(prop) diff --git a/src/components/mapWindow/base/mixins/common.js b/src/components/mapWindow/base/mixins/common.js new file mode 100644 index 0000000..2fd1a28 --- /dev/null +++ b/src/components/mapWindow/base/mixins/common.js @@ -0,0 +1,82 @@ +const types = { + map: { + unload: 'clearMap' + }, + control: { + unload: 'removeControl' + }, + layer: { + unload: 'removeLayer' + }, + features: { + unload: 'removeFeatures' + }, + listener: { + unload: 'removeListener' + } +} + +const getParent = $component => ($component.abstract || $component.$el === $component.$children[0].$el) ? getParent($component.$parent) : $component + +function destroyInstance () { + const { unload, renderByParent, $parent } = this + if (renderByParent) { + $parent.reload() + } + unload() +} + +class Mixin { + constructor (prop) { + this.methods = { + ready () { + const $parent = getParent(this.$parent) + const map = this.map = $parent.map + this.load() + this.$emit('ready', { + map + }) + }, + transmitEvent (e) { + this.$emit(e.type.replace(/^on/, ''), e) + }, + reload () { + this && this.$nextTick(() => { + this.unload() + this.$nextTick(this.load) + }) + }, + unload () { + const { map, originInstance } = this + try { + switch (prop.type) { + case 'search': + return originInstance.clearResults() + case 'autoComplete': + case 'lushu': + return originInstance.dispose() + case 'markerClusterer': + return originInstance.clearMarkers() + default: + map[types[prop.type].unload](originInstance) + } + } catch (e) {} + } + } + this.computed = { + renderByParent () { + return this.$parent.preventChildrenRender + } + } + this.mounted = function () { + console.log('common mounted') + const $parent = getParent(this.$parent) + const map = $parent.map + const { ready } = this + console.log(map) + map ? ready() : $parent.$on('onload', ready) + } + } +} + +export default type => new Mixin({ type }) diff --git a/src/components/mapWindow/leafletMap.vue b/src/components/mapWindow/leafletMap.vue new file mode 100644 index 0000000..b753cc0 --- /dev/null +++ b/src/components/mapWindow/leafletMap.vue @@ -0,0 +1,143 @@ + + + + + + + diff --git a/src/components/mapWindow/mapWindow.vue b/src/components/mapWindow/mapWindow.vue new file mode 100644 index 0000000..9ced291 --- /dev/null +++ b/src/components/mapWindow/mapWindow.vue @@ -0,0 +1,46 @@ + + + + + + diff --git a/src/icons/svg/bridge.svg b/src/icons/svg/bridge.svg new file mode 100644 index 0000000..1a0336f --- /dev/null +++ b/src/icons/svg/bridge.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/icons/svg/toilet.svg b/src/icons/svg/toilet.svg new file mode 100644 index 0000000..9d8e765 --- /dev/null +++ b/src/icons/svg/toilet.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/main.js b/src/main.js index f2d105d..3e4074e 100644 --- a/src/main.js +++ b/src/main.js @@ -18,6 +18,9 @@ // echart // import echarts from 'echarts' // Vue.prototype.$echarts = echarts +// 引入v-charts +import VCharts from 'v-charts' +Vue.use(VCharts) // 将自动注册所有组件为全局组件 // import dataV from '@jiaminghi/data-view' @@ -35,9 +38,19 @@ Vue.component('search-item', SearchItem) // 加载leaflet的css +// import 'leaflet/dist/leaflet.css' +// import 'leaflet-draw/dist/leaflet.draw.css' +import L from 'leaflet' import 'leaflet/dist/leaflet.css' -import 'leaflet-draw/dist/leaflet.draw.css' +Vue.config.productionTip = false +Vue.L = Vue.prototype.$L = L +delete L.Icon.Default.prototype._getIconUrl +L.Icon.Default.mergeOptions({ + iconRetinaUrl: require('leaflet/dist/images/marker-icon-2x.png'), + iconUrl: require('leaflet/dist/images/marker-icon.png'), + shadowUrl: require('leaflet/dist/images/marker-shadow.png') +}) /** * This project originally used easy-mock to simulate data, * but its official service is very unstable, diff --git a/src/permission.js b/src/permission.js index dc6b2f8..809ca86 100644 --- a/src/permission.js +++ b/src/permission.js @@ -25,8 +25,8 @@ store.dispatch('GetInfo').then(res => { // 拉取用户信息 // 设置当前子系统为基础资源子系统 const currentSys = { - code: 'baseResourse', - name: '基础资源子系统' + code: 'toliet', + name: '公共厕所管理系统' } // 将当前系统信息保存在localStorage中 store.commit('SET_SYSTEM', currentSys) diff --git a/src/router/index.js b/src/router/index.js index 39c295c..d23076d 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -8,8 +8,11 @@ /* Layout */ import Layout from '@/layout/Layout' +import { toiletRouters } from './modules/toilet' +import { workRouters } from './modules/work' +import { statisticsRouters } from './modules/statistics' +import { ruleRouters } from './modules/rule' import { systemRouters } from './modules/system' -import { exampleRouters } from './modules/example' /** * hidden: true if `hidden:true` will not show in the sidebar(default is false) @@ -40,11 +43,12 @@ ] }, // 登录页面 - { path: '/login', component: () => import('@/views/login/index'), hidden: true }, + { path: '/login', component: () => import('@/views/login/index_2'), hidden: true }, // 404错误页面 { path: '/404', component: () => import('@/views/errorPage/404'), hidden: true }, // 401 错误页面 - { path: '/401', component: () => import('@/views/errorPage/401'), hidden: true } + { path: '/401', component: () => import('@/views/errorPage/401'), hidden: true }, + { path: '/', redirect: '/toiletList', hidden: true } ] // 实例化vue的时候直挂载constantRouter export default new Router({ @@ -56,7 +60,10 @@ // 异步挂载路由 // 动态需要根据权限加载的路由表 export const asyncRouterMap = [ - ...exampleRouters, - ...systemRouters, + ...toiletRouters, + ...workRouters, + ...statisticsRouters, + ...ruleRouters, + // ...systemRouters, { path: '*', redirect: '/404', hidden: true } ] diff --git a/src/router/modules/rule.js b/src/router/modules/rule.js new file mode 100644 index 0000000..51e0283 --- /dev/null +++ b/src/router/modules/rule.js @@ -0,0 +1,24 @@ +/* Layout */ +import Layout from '@/layout/Layout' + +export const ruleRouters = [ + { + path: 'rule', + component: Layout, + redirect: '/rule', + name: 'Rule', + meta: { + title: '规章制度', + icon: 'icon-config', // 图标 + permission: ['/rule']// 权限名称 + }, + children: [ + { + path: '/rule', + name: 'Rule', + component: () => import('@/views/rule/listRule'), + meta: { title: '规章制度', icon: 'function', permission: ['/rule'] } + } + ] + } +] diff --git a/src/router/modules/statistics.js b/src/router/modules/statistics.js new file mode 100644 index 0000000..fb9cbea --- /dev/null +++ b/src/router/modules/statistics.js @@ -0,0 +1,30 @@ +/* Layout */ +import Layout from '@/layout/Layout' + +export const statisticsRouters = [ + { + path: 'statisticsToilet', + component: Layout, + redirect: '/workStatistics', + name: 'StatisticsToilet', + meta: { + title: '作业统计', + icon: 'icon-config', // 图标 + permission: ['/statisticsToilet']// 权限名称 + }, + children: [ + { + path: '/workStatistics', + name: 'WorkStatistics', + component: () => import('@/views/statistics/toiletAssessment'), + meta: { title: '作业统计', icon: '', permission: ['/toilet/workStatistics'] } + }, + { + path: '/evaluationStatistics', + name: 'EvaluationStatistics', + component: () => import('@/views/statistics/evaluationAssessment'), + meta: { title: '评价统计', icon: '', permission: ['/toilet/evaluationStatistics'] } + } + ] + } +] diff --git a/src/router/modules/toilet.js b/src/router/modules/toilet.js new file mode 100644 index 0000000..b221a0e --- /dev/null +++ b/src/router/modules/toilet.js @@ -0,0 +1,30 @@ +/* Layout */ +import Layout from '@/layout/Layout' + +export const toiletRouters = [ + { + path: 'toiletManage', + component: Layout, + redirect: '/toiletManage', + name: 'ToiletManage', + meta: { + title: '公厕管理', + icon: 'icon-config', // 图标 + permission: ['/toiletManage']// 权限名称 + }, + children: [ + { + path: '/toiletList', + name: 'ToiletList', + component: () => import('@/views/toiletManage/toiletList'), + meta: { title: '公厕台帐管理', icon: 'function', permission: ['/toiletList'] } + }, + { + path: '/toiletMap', + name: 'ToiletMap', + component: () => import('@/views/overview/overview'), + meta: { title: '地图总览', icon: 'function', permission: ['/toiletMap'] } + } + ] + } +] diff --git a/src/router/modules/work.js b/src/router/modules/work.js new file mode 100644 index 0000000..5e0759f --- /dev/null +++ b/src/router/modules/work.js @@ -0,0 +1,24 @@ +/* Layout */ +import Layout from '@/layout/Layout' + +export const workRouters = [ + { + path: 'toiletWork', + component: Layout, + redirect: '/toiletManage', + name: 'toiletWork', + meta: { + title: '作业管理', + icon: 'icon-config', // 图标 + permission: ['/toiletWork']// 权限名称 + }, + children: [ + { + path: '/toiletWork', + name: 'ToiletWork', + component: () => import('@/views/toiletClean/toiletCleanList'), + meta: { title: '作业管理', icon: 'function', permission: ['/toiletWork'] } + } + ] + } +] diff --git a/src/settings.js b/src/settings.js index b568ce0..b8159bf 100644 --- a/src/settings.js +++ b/src/settings.js @@ -3,7 +3,7 @@ * @type {boolean} true | false * @description 是否显示设置按钮 */ - showSettings: true, + showSettings: false, /** * @type {boolean} true | false diff --git a/src/store/modules/permission.js b/src/store/modules/permission.js index a0cb8cf..3ab50d5 100644 --- a/src/store/modules/permission.js +++ b/src/store/modules/permission.js @@ -120,17 +120,23 @@ }) }, // 获取用户权限 - GetMenus({ commit, state }) { - console.log('in store.permission.js:GetMenus:') + GetMenus({ commit, state }, currentSystem) { + // console.log('in store.permission.js:GetMenus:') + console.log('获取' + currentSystem.name + '的菜单') + const params = { + parentCode: currentSystem.code // 传入该子系统的code,获取子系统的权限 + } return new Promise((resolve, reject) => { - getMenus(state.token).then(response => { // 处理返回值 + // 此处获取用户所有权限 + getMenus(params).then(response => { // 处理返回值 const data = response.data const menus = [] // 仅菜单 const btns = [] // 非菜单 if (data.menus && data.menus.length > 0) { - commit('SET_MENUS', data.menus) - for (const menu of data.menus) { // 遍历菜单,获取所有的权限项 - if (menu.ismenu === '1') { // 将是菜单的放入menus + const allmenus = [...data.menus] + commit('SET_MENUS', allmenus) + for (const menu of allmenus) { // 遍历菜单,获取所有的权限项 + if (menu.resourceType === '02' || menu.resourceType === '03') { // 将是菜单的放入menus const menu_tmp = {} menu_tmp.url = menu.url menu_tmp.icon = menu.icon @@ -142,11 +148,11 @@ btn_tmp.name = menu.name btn_tmp.icon = menu.icon btns.push(btn_tmp) - // console.log(menu.url) } } // 过滤路由表 - const accessedRouters = filterAsyncRouter(asyncRouterMap, menus) + let accessedRouters = filterAsyncRouter(asyncRouterMap, menus) + // accessedRouters = filterRedirect(accessedRouters) commit('SET_BTNS', btns) commit('SET_ROUTERS', accessedRouters) resolve(response) diff --git a/src/utils/baseConfig.js b/src/utils/baseConfig.js index 1f4fa38..999593e 100644 --- a/src/utils/baseConfig.js +++ b/src/utils/baseConfig.js @@ -1,5 +1,5 @@ const project = { - title: '后台管理系统前端基础框架' + title: '路桥养护子系统' } export function getProject() { return project diff --git a/src/utils/dateutils.js b/src/utils/dateutils.js index 868111a..5cd16af 100644 --- a/src/utils/dateutils.js +++ b/src/utils/dateutils.js @@ -15,15 +15,15 @@ return ct_month } -export function getLastWeek() { // 默认显示上周 +export function getLastWeek(fmt) { // 默认显示上周 const ct_month = new Date() ct_month.setTime(ct_month.getTime() - 3600 * 1000 * 24 * 7) - return ct_month + return ct_month.Format(fmt) } -export function getLastMonth() { // 默认显示上个月 +export function getLastMonth(fmt) { // 默认显示上个月 const ct_month = new Date() ct_month.setTime(ct_month.getTime() - 3600 * 1000 * 24 * 30) - return ct_month + return ct_month.Format(fmt) } // 对Date的扩展,将 Date 转化为指定格式的String diff --git a/src/utils/exportutils.js b/src/utils/exportutils.js new file mode 100644 index 0000000..b5d0bcf --- /dev/null +++ b/src/utils/exportutils.js @@ -0,0 +1,19 @@ +/** + * 导出文件工具 + * @param blob 文件 + * @param fileName 导出文件名 + */ +export function exportFile(blob, fileName) { + if (window.navigator && window.navigator.msSaveOrOpenBlob) { + navigator.msSaveBlob(blob, fileName) + } else { + const downloadElement = document.createElement('a') + const href = window.URL.createObjectURL(blob) // 创建下载的链接 + downloadElement.href = href + downloadElement.download = fileName + document.body.appendChild(downloadElement) + downloadElement.click() // 点击下载 + document.body.removeChild(downloadElement) // 下载完成移除元素 + window.URL.revokeObjectURL(href) // 释放blob对象 + } +} diff --git a/config/index.js b/config/index.js index 8abd37a..19b33b1 100644 --- a/config/index.js +++ b/config/index.js @@ -69,7 +69,7 @@ * then assetsPublicPath should be set to "/bar/". * In most cases please use '/' !!! */ - assetsPublicPath: '/', + assetsPublicPath: '/toilet/', /** * Source Maps diff --git a/package.json b/package.json index 45f055f..9f3a3eb 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "echarts": "^4.2.1", "element-ui": "2.13.0", "event-source-polyfill": "^1.0.5", + "file-saver": "^2.0.5", "js-cookie": "2.2.0", "jsencrypt": "^3.0.0-rc.1", "leaflet": "^1.7.1", @@ -33,7 +34,9 @@ "vue-amap": "^0.5.9", "vue-baidu-map": "^0.21.22", "vue-router": "3.0.1", - "vuex": "3.0.1" + "vue2-leaflet": "^2.7.0", + "vuex": "3.0.1", + "xlsx": "^0.17.0" }, "devDependencies": { "autoprefixer": "8.5.0", diff --git a/src/api/common.js b/src/api/common.js index 87c582b..7804714 100644 --- a/src/api/common.js +++ b/src/api/common.js @@ -2,10 +2,14 @@ * 常用接口 */ import request from '@/utils/request' +import Vue from 'vue' + // 模板下载 export function downloadTemplate(fileName) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath return request({ - url: 'template/download', + url: lampPath + 'template/download', method: 'get', params: { filename: fileName @@ -19,7 +23,7 @@ const param = new FormData() param.append('file', fileobj.file) return request({ - url: 'imageUpload', + url: 'fileUpload', method: 'post', headers: { 'Content-Type': 'multipart/form-data' }, data: param diff --git a/src/api/sanitation/statistics.js b/src/api/sanitation/statistics.js new file mode 100644 index 0000000..ffeac18 --- /dev/null +++ b/src/api/sanitation/statistics.js @@ -0,0 +1,22 @@ + +/** + * 考核统计接口 + */ +import request from '@/utils/request' +// 公厕保洁次数统计 +export function getToiletJobCount(params) { + return request({ + url: '/sanitation/statistic/toilet/jobCount', + method: 'get', + params + }) +} + +// 公厕评分统计 +export function getToiletEvaluation(params) { + return request({ + url: '/sanitation/toiletEvaluation/statistics', + method: 'get', + params + }) +} diff --git a/src/api/sanitation/toilet.js b/src/api/sanitation/toilet.js new file mode 100644 index 0000000..11affd4 --- /dev/null +++ b/src/api/sanitation/toilet.js @@ -0,0 +1,133 @@ +/** + * 公厕管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' +// 公厕查询 +export function getToiletListPage(params) { + return request({ + url: '/sanitation/toilet/listPage', + method: 'get', + params + }) +} +// 公厕查询 +export function getToiletList(pid) { + return request({ + url: '/sanitation/toilet/list', + method: 'get', + params: { + pid: pid + } + }) +} + +// 添加公厕 +export function addToilet(params) { + return request({ + url: '/sanitation/toilet/add', + method: 'post', + params + }) +} +// 修改公厕机构 +export function updateToilet(params) { + return request({ + url: '/sanitation/toilet/update', + method: 'post', + params + }) +} +// 删除公厕机构 +export function delToilet(ids) { + return request({ + url: '/sanitation/toilet/delete', + method: 'post', + params: { + ids + }, + paramsSerializer: params => { + return qs.stringify(params, { indices: false }) + } + }) +} + +// 公厕基本信息详情 +export function getToiletInfoDetail(id) { + return request({ + url: '/sanitation/toilet/detail?toiletId=' + id, + method: 'get' + }) +} + +// 某公厕保洁记录 +export function getRecordsByToilet(params) { + return request({ + url: '/sanitation/toilet/jobRecord/detail', + method: 'get', + params + }) +} + +// 某公厕平均评分 +export function getScoreByToilet(params) { + return request({ + url: '/sanitation/toiletEvaluation/detailScore', + method: 'get', + params + }) +} + +// 某公厕评分列表 +export function getScoreListByToilet(params) { + return request({ + url: '/sanitation/toiletEvaluation/list', + method: 'get', + params + }) +} + + +// 批量导入 +export function batchImportToilet(fileobj) { + const param = new FormData() + param.append('file', fileobj) + return request({ + url: '/sanitation/toilet/import', + method: 'post', + headers: { 'Content-Type': 'multipart/form-data' }, + data: param + }) +} +// 批量导出 +export function batchExportToilet(params, config) { + return request({ + url: '/sanitation/toilet/export', + method: 'get', + timeout: 120000, + params, + ...config, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 公厕保洁记录查询 +export function getToiletJobRecords(params) { + return request({ + url: '/sanitation/toilet/jobRecord', + method: 'get', + params + }) +} + +// 批量导出 +export function batchExportToiletJobRecords(params, config) { + return request({ + url: '/sanitation/toilet/exportJobRecord', + method: 'get', + timeout: 120000, + params, + ...config, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} diff --git a/src/api/system/alarm.js b/src/api/system/alarm.js new file mode 100644 index 0000000..1c3a7ab --- /dev/null +++ b/src/api/system/alarm.js @@ -0,0 +1,62 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' + +// 获取当前报警列表 +export function getAlarmNowList(params) { + return request({ + url: '/alarm/listNowPage', + method: 'get', + params + }) +} + +// 获取当前报警列表 +export function getAlarmHistoryList(params) { + return request({ + url: '/alarm/listHisPage', + method: 'get', + params + }) +} + + +// 批量消警 +export function clearAll(params) { + return request({ + url: '/alarm/allClear', + method: 'get', + params + }) +} + +// 消警 +export function clearAlarm(params) { + return request({ + url: '/alarm/cancel', + method: 'get', + params + }) +} + +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 设置报警阈值 +export function setThresh(params) { + return request({ + url: '/alarm/resetAlarmRule', + method: 'post', + params + }) +} diff --git a/src/api/system/bridge.js b/src/api/system/bridge.js new file mode 100644 index 0000000..e8a4108 --- /dev/null +++ b/src/api/system/bridge.js @@ -0,0 +1,80 @@ +/** + * 桥梁管理接口 + */ +import request from '@/utils/request' + +// 获取桥梁详情 +export function getDetail(id) { + return request({ + url: '/bridge/detail', + method: 'get', + params: { + id: id + } + }) +} + +export function updateBridge(params) { + return request({ + url: '/bridge/update', + method: 'post', + params + }) +} +// 批量导出 +export function exportRecords(params) { + return request({ + url: 'device/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +export function getContentList(params) { + return request({ + url: 'maintain/contentByType', + method: 'get', + params: { + type: params + } + }) +} +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 编辑 +export function editRecord(params) { + return request({ + url: 'maintain/update', + method: 'post', + params + }) +} +// 新增 +export function addRecord(params) { + return request({ + url: 'maintain/add', + method: 'post', + params + }) +} +// 删除 +export function delRecord(id) { + return request({ + url: 'maintain/delete', + method: 'post', + params: { + id: id + } + }) +} diff --git a/src/api/system/data.js b/src/api/system/data.js new file mode 100644 index 0000000..4c95db5 --- /dev/null +++ b/src/api/system/data.js @@ -0,0 +1,63 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' + +// 获取当前报警列表 +export function getHistoryList(params) { + return request({ + url: '/data/hisListPage', + method: 'get', + params + }) +} + +// 获取当前报警列表 +export function getHistory(params) { + return request({ + url: '/data/hisList', + method: 'get', + params + }) +} + + + +// 批量消警 +export function clearAll(params) { + return request({ + url: '/alarm/allClear', + method: 'get', + params + }) +} + +// 消警 +export function clearAlarm(params) { + return request({ + url: '/alarm/cancel', + method: 'get', + params + }) +} + +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 设置报警阈值 +export function setThresh(params) { + return request({ + url: '/alarm/resetAlarmRule', + method: 'post', + params + }) +} diff --git a/src/api/system/order.js b/src/api/system/order.js new file mode 100644 index 0000000..7007c50 --- /dev/null +++ b/src/api/system/order.js @@ -0,0 +1,71 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +// import qs from 'qs' + +// 获取当前报警列表 +export function getRecordList(params) { + return request({ + url: '/maintain/listPage', + method: 'get', + params + }) +} +// 批量导出 +export function exportRecords(params) { + return request({ + url: 'device/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +export function getContentList(params) { + return request({ + url: 'maintain/contentByType', + method: 'get', + params: { + type: params + } + }) +} +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 编辑 +export function editRecord(params) { + return request({ + url: 'maintain/update', + method: 'post', + params + }) +} +// 新增 +export function addRecord(params) { + return request({ + url: 'maintain/add', + method: 'post', + params + }) +} +// 删除 +export function delRecord(id) { + return request({ + url: 'maintain/delete', + method: 'post', + params: { + bridgeMaintenanceId: id + } + }) +} diff --git a/src/api/system/overview.js b/src/api/system/overview.js new file mode 100644 index 0000000..bca50cc --- /dev/null +++ b/src/api/system/overview.js @@ -0,0 +1,109 @@ +import request from '@/utils/request' +import qs from "qs" +import Vue from 'vue' + +// 路灯状态统计 +export function getLampStatus() { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampStatus', + method: 'get' + }) +} + +// 路灯总览列表 +export function getLampList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampList', + method: 'get', + params + }) +} + +// 路灯详情 +export function getlampDetail(lampId) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampDetail', + method: 'get', + params: { + lampId: lampId + } + }) +} + +// 回路列表 +export function getCircuitList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/circuitList', + method: 'get', + params + }) +} + +// 灯箱列表 +export function getLampBoxList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampBoxList', + method: 'get', + params + }) +} +// 灯箱详情 +export function getLampBoxDetail(lampBoxId) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampBoxDetail', + method: 'get', + params: { + lampBoxId: lampBoxId + } + }) +} + +// 报警总览列表 +export function getAlarmList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/alarmList', + method: 'get', + params + }) +} + +// 报警详情 +export function getAlarmDetail(alarmId) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/alarmDetail', + method: 'get', + params: { + alarmId: alarmId + } + }) +} + +// 路灯控制 +export function lampControl(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampControl', + method: 'post', + params, + paramsSerializer: params => { + return qs.stringify(params, { indices: false }) + } + }) +} diff --git a/src/api/system/rule.js b/src/api/system/rule.js new file mode 100644 index 0000000..76c6b2d --- /dev/null +++ b/src/api/system/rule.js @@ -0,0 +1,59 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +// import qs from 'qs' + +// 获取当前报警列表 +export function getRuleList() { + return request({ + url: 'rule/listPage', + method: 'get' + }) +} +export function getContentList(params) { + return request({ + url: 'maintain/contentByType', + method: 'get', + params: { + type: params + } + }) +} +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 编辑 +export function editRecord(params) { + return request({ + url: 'maintain/update', + method: 'post', + params + }) +} +// 新增 +export function addRecord(params) { + return request({ + url: 'maintain/add', + method: 'post', + params + }) +} +// 删除 +export function delRecord(id) { + return request({ + url: 'maintain/delete', + method: 'post', + params: { + id: id + } + }) +} diff --git a/src/api/system/statistics.js b/src/api/system/statistics.js new file mode 100644 index 0000000..b25efe9 --- /dev/null +++ b/src/api/system/statistics.js @@ -0,0 +1,23 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +// import qs from 'qs' + +// +export function countByToilet(params) { + return request({ + url: '/sanitation/toiletStatistic/jobStaticByToilet', + method: 'get', + params + }) +} + +export function countByDay(params) { + return request({ + url: '/sanitation/toiletStatistic/jobStaticByDate', + method: 'get', + params + }) +} + diff --git a/src/assets/global_images/icon-position.png b/src/assets/global_images/icon-position.png new file mode 100644 index 0000000..7444038 --- /dev/null +++ b/src/assets/global_images/icon-position.png Binary files differ diff --git a/src/assets/global_images/location_green.png b/src/assets/global_images/location_green.png new file mode 100644 index 0000000..aa8be65 --- /dev/null +++ b/src/assets/global_images/location_green.png Binary files differ diff --git a/src/assets/global_images/location_red.png b/src/assets/global_images/location_red.png new file mode 100644 index 0000000..2be8c3d --- /dev/null +++ b/src/assets/global_images/location_red.png Binary files differ diff --git a/src/assets/global_images/location_yellow.png b/src/assets/global_images/location_yellow.png new file mode 100644 index 0000000..5ab6f4d --- /dev/null +++ b/src/assets/global_images/location_yellow.png Binary files differ diff --git a/src/assets/global_images/toilet-position.png b/src/assets/global_images/toilet-position.png new file mode 100644 index 0000000..7db6d9a --- /dev/null +++ b/src/assets/global_images/toilet-position.png Binary files differ diff --git a/src/assets/global_images/toilet.png b/src/assets/global_images/toilet.png new file mode 100644 index 0000000..6d9fc05 --- /dev/null +++ b/src/assets/global_images/toilet.png Binary files differ diff --git a/src/assets/global_images/toiletPhoto.png b/src/assets/global_images/toiletPhoto.png new file mode 100644 index 0000000..15d08e2 --- /dev/null +++ b/src/assets/global_images/toiletPhoto.png Binary files differ diff --git a/src/components/DownloadTemplate/index.vue b/src/components/DownloadTemplate/index.vue index 8ded2cd..7807cac 100644 --- a/src/components/DownloadTemplate/index.vue +++ b/src/components/DownloadTemplate/index.vue @@ -47,8 +47,8 @@ diff --git a/src/components/NormalTable/index.vue b/src/components/NormalTable/index.vue index 5077bef..04d322d 100644 --- a/src/components/NormalTable/index.vue +++ b/src/components/NormalTable/index.vue @@ -79,7 +79,7 @@
-
+
Object.assign(obj, { [key]: this[key] }), {}), + on: events.reduce((obj, key) => Object.assign(obj, { [key]: this.transmitEvent }), {}) + }) + } + this.props = [...extraProps, ...props.filter(prop => exceptProps.indexOf(prop))] + } +} + +export default prop => new Mixin(prop) diff --git a/src/components/mapWindow/base/mixins/common.js b/src/components/mapWindow/base/mixins/common.js new file mode 100644 index 0000000..2fd1a28 --- /dev/null +++ b/src/components/mapWindow/base/mixins/common.js @@ -0,0 +1,82 @@ +const types = { + map: { + unload: 'clearMap' + }, + control: { + unload: 'removeControl' + }, + layer: { + unload: 'removeLayer' + }, + features: { + unload: 'removeFeatures' + }, + listener: { + unload: 'removeListener' + } +} + +const getParent = $component => ($component.abstract || $component.$el === $component.$children[0].$el) ? getParent($component.$parent) : $component + +function destroyInstance () { + const { unload, renderByParent, $parent } = this + if (renderByParent) { + $parent.reload() + } + unload() +} + +class Mixin { + constructor (prop) { + this.methods = { + ready () { + const $parent = getParent(this.$parent) + const map = this.map = $parent.map + this.load() + this.$emit('ready', { + map + }) + }, + transmitEvent (e) { + this.$emit(e.type.replace(/^on/, ''), e) + }, + reload () { + this && this.$nextTick(() => { + this.unload() + this.$nextTick(this.load) + }) + }, + unload () { + const { map, originInstance } = this + try { + switch (prop.type) { + case 'search': + return originInstance.clearResults() + case 'autoComplete': + case 'lushu': + return originInstance.dispose() + case 'markerClusterer': + return originInstance.clearMarkers() + default: + map[types[prop.type].unload](originInstance) + } + } catch (e) {} + } + } + this.computed = { + renderByParent () { + return this.$parent.preventChildrenRender + } + } + this.mounted = function () { + console.log('common mounted') + const $parent = getParent(this.$parent) + const map = $parent.map + const { ready } = this + console.log(map) + map ? ready() : $parent.$on('onload', ready) + } + } +} + +export default type => new Mixin({ type }) diff --git a/src/components/mapWindow/leafletMap.vue b/src/components/mapWindow/leafletMap.vue new file mode 100644 index 0000000..b753cc0 --- /dev/null +++ b/src/components/mapWindow/leafletMap.vue @@ -0,0 +1,143 @@ + + + + + + + diff --git a/src/components/mapWindow/mapWindow.vue b/src/components/mapWindow/mapWindow.vue new file mode 100644 index 0000000..9ced291 --- /dev/null +++ b/src/components/mapWindow/mapWindow.vue @@ -0,0 +1,46 @@ + + + + + + diff --git a/src/icons/svg/bridge.svg b/src/icons/svg/bridge.svg new file mode 100644 index 0000000..1a0336f --- /dev/null +++ b/src/icons/svg/bridge.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/icons/svg/toilet.svg b/src/icons/svg/toilet.svg new file mode 100644 index 0000000..9d8e765 --- /dev/null +++ b/src/icons/svg/toilet.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/main.js b/src/main.js index f2d105d..3e4074e 100644 --- a/src/main.js +++ b/src/main.js @@ -18,6 +18,9 @@ // echart // import echarts from 'echarts' // Vue.prototype.$echarts = echarts +// 引入v-charts +import VCharts from 'v-charts' +Vue.use(VCharts) // 将自动注册所有组件为全局组件 // import dataV from '@jiaminghi/data-view' @@ -35,9 +38,19 @@ Vue.component('search-item', SearchItem) // 加载leaflet的css +// import 'leaflet/dist/leaflet.css' +// import 'leaflet-draw/dist/leaflet.draw.css' +import L from 'leaflet' import 'leaflet/dist/leaflet.css' -import 'leaflet-draw/dist/leaflet.draw.css' +Vue.config.productionTip = false +Vue.L = Vue.prototype.$L = L +delete L.Icon.Default.prototype._getIconUrl +L.Icon.Default.mergeOptions({ + iconRetinaUrl: require('leaflet/dist/images/marker-icon-2x.png'), + iconUrl: require('leaflet/dist/images/marker-icon.png'), + shadowUrl: require('leaflet/dist/images/marker-shadow.png') +}) /** * This project originally used easy-mock to simulate data, * but its official service is very unstable, diff --git a/src/permission.js b/src/permission.js index dc6b2f8..809ca86 100644 --- a/src/permission.js +++ b/src/permission.js @@ -25,8 +25,8 @@ store.dispatch('GetInfo').then(res => { // 拉取用户信息 // 设置当前子系统为基础资源子系统 const currentSys = { - code: 'baseResourse', - name: '基础资源子系统' + code: 'toliet', + name: '公共厕所管理系统' } // 将当前系统信息保存在localStorage中 store.commit('SET_SYSTEM', currentSys) diff --git a/src/router/index.js b/src/router/index.js index 39c295c..d23076d 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -8,8 +8,11 @@ /* Layout */ import Layout from '@/layout/Layout' +import { toiletRouters } from './modules/toilet' +import { workRouters } from './modules/work' +import { statisticsRouters } from './modules/statistics' +import { ruleRouters } from './modules/rule' import { systemRouters } from './modules/system' -import { exampleRouters } from './modules/example' /** * hidden: true if `hidden:true` will not show in the sidebar(default is false) @@ -40,11 +43,12 @@ ] }, // 登录页面 - { path: '/login', component: () => import('@/views/login/index'), hidden: true }, + { path: '/login', component: () => import('@/views/login/index_2'), hidden: true }, // 404错误页面 { path: '/404', component: () => import('@/views/errorPage/404'), hidden: true }, // 401 错误页面 - { path: '/401', component: () => import('@/views/errorPage/401'), hidden: true } + { path: '/401', component: () => import('@/views/errorPage/401'), hidden: true }, + { path: '/', redirect: '/toiletList', hidden: true } ] // 实例化vue的时候直挂载constantRouter export default new Router({ @@ -56,7 +60,10 @@ // 异步挂载路由 // 动态需要根据权限加载的路由表 export const asyncRouterMap = [ - ...exampleRouters, - ...systemRouters, + ...toiletRouters, + ...workRouters, + ...statisticsRouters, + ...ruleRouters, + // ...systemRouters, { path: '*', redirect: '/404', hidden: true } ] diff --git a/src/router/modules/rule.js b/src/router/modules/rule.js new file mode 100644 index 0000000..51e0283 --- /dev/null +++ b/src/router/modules/rule.js @@ -0,0 +1,24 @@ +/* Layout */ +import Layout from '@/layout/Layout' + +export const ruleRouters = [ + { + path: 'rule', + component: Layout, + redirect: '/rule', + name: 'Rule', + meta: { + title: '规章制度', + icon: 'icon-config', // 图标 + permission: ['/rule']// 权限名称 + }, + children: [ + { + path: '/rule', + name: 'Rule', + component: () => import('@/views/rule/listRule'), + meta: { title: '规章制度', icon: 'function', permission: ['/rule'] } + } + ] + } +] diff --git a/src/router/modules/statistics.js b/src/router/modules/statistics.js new file mode 100644 index 0000000..fb9cbea --- /dev/null +++ b/src/router/modules/statistics.js @@ -0,0 +1,30 @@ +/* Layout */ +import Layout from '@/layout/Layout' + +export const statisticsRouters = [ + { + path: 'statisticsToilet', + component: Layout, + redirect: '/workStatistics', + name: 'StatisticsToilet', + meta: { + title: '作业统计', + icon: 'icon-config', // 图标 + permission: ['/statisticsToilet']// 权限名称 + }, + children: [ + { + path: '/workStatistics', + name: 'WorkStatistics', + component: () => import('@/views/statistics/toiletAssessment'), + meta: { title: '作业统计', icon: '', permission: ['/toilet/workStatistics'] } + }, + { + path: '/evaluationStatistics', + name: 'EvaluationStatistics', + component: () => import('@/views/statistics/evaluationAssessment'), + meta: { title: '评价统计', icon: '', permission: ['/toilet/evaluationStatistics'] } + } + ] + } +] diff --git a/src/router/modules/toilet.js b/src/router/modules/toilet.js new file mode 100644 index 0000000..b221a0e --- /dev/null +++ b/src/router/modules/toilet.js @@ -0,0 +1,30 @@ +/* Layout */ +import Layout from '@/layout/Layout' + +export const toiletRouters = [ + { + path: 'toiletManage', + component: Layout, + redirect: '/toiletManage', + name: 'ToiletManage', + meta: { + title: '公厕管理', + icon: 'icon-config', // 图标 + permission: ['/toiletManage']// 权限名称 + }, + children: [ + { + path: '/toiletList', + name: 'ToiletList', + component: () => import('@/views/toiletManage/toiletList'), + meta: { title: '公厕台帐管理', icon: 'function', permission: ['/toiletList'] } + }, + { + path: '/toiletMap', + name: 'ToiletMap', + component: () => import('@/views/overview/overview'), + meta: { title: '地图总览', icon: 'function', permission: ['/toiletMap'] } + } + ] + } +] diff --git a/src/router/modules/work.js b/src/router/modules/work.js new file mode 100644 index 0000000..5e0759f --- /dev/null +++ b/src/router/modules/work.js @@ -0,0 +1,24 @@ +/* Layout */ +import Layout from '@/layout/Layout' + +export const workRouters = [ + { + path: 'toiletWork', + component: Layout, + redirect: '/toiletManage', + name: 'toiletWork', + meta: { + title: '作业管理', + icon: 'icon-config', // 图标 + permission: ['/toiletWork']// 权限名称 + }, + children: [ + { + path: '/toiletWork', + name: 'ToiletWork', + component: () => import('@/views/toiletClean/toiletCleanList'), + meta: { title: '作业管理', icon: 'function', permission: ['/toiletWork'] } + } + ] + } +] diff --git a/src/settings.js b/src/settings.js index b568ce0..b8159bf 100644 --- a/src/settings.js +++ b/src/settings.js @@ -3,7 +3,7 @@ * @type {boolean} true | false * @description 是否显示设置按钮 */ - showSettings: true, + showSettings: false, /** * @type {boolean} true | false diff --git a/src/store/modules/permission.js b/src/store/modules/permission.js index a0cb8cf..3ab50d5 100644 --- a/src/store/modules/permission.js +++ b/src/store/modules/permission.js @@ -120,17 +120,23 @@ }) }, // 获取用户权限 - GetMenus({ commit, state }) { - console.log('in store.permission.js:GetMenus:') + GetMenus({ commit, state }, currentSystem) { + // console.log('in store.permission.js:GetMenus:') + console.log('获取' + currentSystem.name + '的菜单') + const params = { + parentCode: currentSystem.code // 传入该子系统的code,获取子系统的权限 + } return new Promise((resolve, reject) => { - getMenus(state.token).then(response => { // 处理返回值 + // 此处获取用户所有权限 + getMenus(params).then(response => { // 处理返回值 const data = response.data const menus = [] // 仅菜单 const btns = [] // 非菜单 if (data.menus && data.menus.length > 0) { - commit('SET_MENUS', data.menus) - for (const menu of data.menus) { // 遍历菜单,获取所有的权限项 - if (menu.ismenu === '1') { // 将是菜单的放入menus + const allmenus = [...data.menus] + commit('SET_MENUS', allmenus) + for (const menu of allmenus) { // 遍历菜单,获取所有的权限项 + if (menu.resourceType === '02' || menu.resourceType === '03') { // 将是菜单的放入menus const menu_tmp = {} menu_tmp.url = menu.url menu_tmp.icon = menu.icon @@ -142,11 +148,11 @@ btn_tmp.name = menu.name btn_tmp.icon = menu.icon btns.push(btn_tmp) - // console.log(menu.url) } } // 过滤路由表 - const accessedRouters = filterAsyncRouter(asyncRouterMap, menus) + let accessedRouters = filterAsyncRouter(asyncRouterMap, menus) + // accessedRouters = filterRedirect(accessedRouters) commit('SET_BTNS', btns) commit('SET_ROUTERS', accessedRouters) resolve(response) diff --git a/src/utils/baseConfig.js b/src/utils/baseConfig.js index 1f4fa38..999593e 100644 --- a/src/utils/baseConfig.js +++ b/src/utils/baseConfig.js @@ -1,5 +1,5 @@ const project = { - title: '后台管理系统前端基础框架' + title: '路桥养护子系统' } export function getProject() { return project diff --git a/src/utils/dateutils.js b/src/utils/dateutils.js index 868111a..5cd16af 100644 --- a/src/utils/dateutils.js +++ b/src/utils/dateutils.js @@ -15,15 +15,15 @@ return ct_month } -export function getLastWeek() { // 默认显示上周 +export function getLastWeek(fmt) { // 默认显示上周 const ct_month = new Date() ct_month.setTime(ct_month.getTime() - 3600 * 1000 * 24 * 7) - return ct_month + return ct_month.Format(fmt) } -export function getLastMonth() { // 默认显示上个月 +export function getLastMonth(fmt) { // 默认显示上个月 const ct_month = new Date() ct_month.setTime(ct_month.getTime() - 3600 * 1000 * 24 * 30) - return ct_month + return ct_month.Format(fmt) } // 对Date的扩展,将 Date 转化为指定格式的String diff --git a/src/utils/exportutils.js b/src/utils/exportutils.js new file mode 100644 index 0000000..b5d0bcf --- /dev/null +++ b/src/utils/exportutils.js @@ -0,0 +1,19 @@ +/** + * 导出文件工具 + * @param blob 文件 + * @param fileName 导出文件名 + */ +export function exportFile(blob, fileName) { + if (window.navigator && window.navigator.msSaveOrOpenBlob) { + navigator.msSaveBlob(blob, fileName) + } else { + const downloadElement = document.createElement('a') + const href = window.URL.createObjectURL(blob) // 创建下载的链接 + downloadElement.href = href + downloadElement.download = fileName + document.body.appendChild(downloadElement) + downloadElement.click() // 点击下载 + document.body.removeChild(downloadElement) // 下载完成移除元素 + window.URL.revokeObjectURL(href) // 释放blob对象 + } +} diff --git a/src/utils/request.js b/src/utils/request.js index c88ea76..dc56e26 100644 --- a/src/utils/request.js +++ b/src/utils/request.js @@ -17,6 +17,13 @@ config.headers['token'] = getToken() // 让每个请求携带自定义token 请根据实际情况自行修改 console.log(config.headers['token']) } + // 在接口增加时间戳 + // if (config.method === 'get') { + config.params = { + _t: Date.parse(new Date()) / 1000, + ...config.params + } + // } return config }, error => { diff --git a/config/index.js b/config/index.js index 8abd37a..19b33b1 100644 --- a/config/index.js +++ b/config/index.js @@ -69,7 +69,7 @@ * then assetsPublicPath should be set to "/bar/". * In most cases please use '/' !!! */ - assetsPublicPath: '/', + assetsPublicPath: '/toilet/', /** * Source Maps diff --git a/package.json b/package.json index 45f055f..9f3a3eb 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "echarts": "^4.2.1", "element-ui": "2.13.0", "event-source-polyfill": "^1.0.5", + "file-saver": "^2.0.5", "js-cookie": "2.2.0", "jsencrypt": "^3.0.0-rc.1", "leaflet": "^1.7.1", @@ -33,7 +34,9 @@ "vue-amap": "^0.5.9", "vue-baidu-map": "^0.21.22", "vue-router": "3.0.1", - "vuex": "3.0.1" + "vue2-leaflet": "^2.7.0", + "vuex": "3.0.1", + "xlsx": "^0.17.0" }, "devDependencies": { "autoprefixer": "8.5.0", diff --git a/src/api/common.js b/src/api/common.js index 87c582b..7804714 100644 --- a/src/api/common.js +++ b/src/api/common.js @@ -2,10 +2,14 @@ * 常用接口 */ import request from '@/utils/request' +import Vue from 'vue' + // 模板下载 export function downloadTemplate(fileName) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath return request({ - url: 'template/download', + url: lampPath + 'template/download', method: 'get', params: { filename: fileName @@ -19,7 +23,7 @@ const param = new FormData() param.append('file', fileobj.file) return request({ - url: 'imageUpload', + url: 'fileUpload', method: 'post', headers: { 'Content-Type': 'multipart/form-data' }, data: param diff --git a/src/api/sanitation/statistics.js b/src/api/sanitation/statistics.js new file mode 100644 index 0000000..ffeac18 --- /dev/null +++ b/src/api/sanitation/statistics.js @@ -0,0 +1,22 @@ + +/** + * 考核统计接口 + */ +import request from '@/utils/request' +// 公厕保洁次数统计 +export function getToiletJobCount(params) { + return request({ + url: '/sanitation/statistic/toilet/jobCount', + method: 'get', + params + }) +} + +// 公厕评分统计 +export function getToiletEvaluation(params) { + return request({ + url: '/sanitation/toiletEvaluation/statistics', + method: 'get', + params + }) +} diff --git a/src/api/sanitation/toilet.js b/src/api/sanitation/toilet.js new file mode 100644 index 0000000..11affd4 --- /dev/null +++ b/src/api/sanitation/toilet.js @@ -0,0 +1,133 @@ +/** + * 公厕管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' +// 公厕查询 +export function getToiletListPage(params) { + return request({ + url: '/sanitation/toilet/listPage', + method: 'get', + params + }) +} +// 公厕查询 +export function getToiletList(pid) { + return request({ + url: '/sanitation/toilet/list', + method: 'get', + params: { + pid: pid + } + }) +} + +// 添加公厕 +export function addToilet(params) { + return request({ + url: '/sanitation/toilet/add', + method: 'post', + params + }) +} +// 修改公厕机构 +export function updateToilet(params) { + return request({ + url: '/sanitation/toilet/update', + method: 'post', + params + }) +} +// 删除公厕机构 +export function delToilet(ids) { + return request({ + url: '/sanitation/toilet/delete', + method: 'post', + params: { + ids + }, + paramsSerializer: params => { + return qs.stringify(params, { indices: false }) + } + }) +} + +// 公厕基本信息详情 +export function getToiletInfoDetail(id) { + return request({ + url: '/sanitation/toilet/detail?toiletId=' + id, + method: 'get' + }) +} + +// 某公厕保洁记录 +export function getRecordsByToilet(params) { + return request({ + url: '/sanitation/toilet/jobRecord/detail', + method: 'get', + params + }) +} + +// 某公厕平均评分 +export function getScoreByToilet(params) { + return request({ + url: '/sanitation/toiletEvaluation/detailScore', + method: 'get', + params + }) +} + +// 某公厕评分列表 +export function getScoreListByToilet(params) { + return request({ + url: '/sanitation/toiletEvaluation/list', + method: 'get', + params + }) +} + + +// 批量导入 +export function batchImportToilet(fileobj) { + const param = new FormData() + param.append('file', fileobj) + return request({ + url: '/sanitation/toilet/import', + method: 'post', + headers: { 'Content-Type': 'multipart/form-data' }, + data: param + }) +} +// 批量导出 +export function batchExportToilet(params, config) { + return request({ + url: '/sanitation/toilet/export', + method: 'get', + timeout: 120000, + params, + ...config, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 公厕保洁记录查询 +export function getToiletJobRecords(params) { + return request({ + url: '/sanitation/toilet/jobRecord', + method: 'get', + params + }) +} + +// 批量导出 +export function batchExportToiletJobRecords(params, config) { + return request({ + url: '/sanitation/toilet/exportJobRecord', + method: 'get', + timeout: 120000, + params, + ...config, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} diff --git a/src/api/system/alarm.js b/src/api/system/alarm.js new file mode 100644 index 0000000..1c3a7ab --- /dev/null +++ b/src/api/system/alarm.js @@ -0,0 +1,62 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' + +// 获取当前报警列表 +export function getAlarmNowList(params) { + return request({ + url: '/alarm/listNowPage', + method: 'get', + params + }) +} + +// 获取当前报警列表 +export function getAlarmHistoryList(params) { + return request({ + url: '/alarm/listHisPage', + method: 'get', + params + }) +} + + +// 批量消警 +export function clearAll(params) { + return request({ + url: '/alarm/allClear', + method: 'get', + params + }) +} + +// 消警 +export function clearAlarm(params) { + return request({ + url: '/alarm/cancel', + method: 'get', + params + }) +} + +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 设置报警阈值 +export function setThresh(params) { + return request({ + url: '/alarm/resetAlarmRule', + method: 'post', + params + }) +} diff --git a/src/api/system/bridge.js b/src/api/system/bridge.js new file mode 100644 index 0000000..e8a4108 --- /dev/null +++ b/src/api/system/bridge.js @@ -0,0 +1,80 @@ +/** + * 桥梁管理接口 + */ +import request from '@/utils/request' + +// 获取桥梁详情 +export function getDetail(id) { + return request({ + url: '/bridge/detail', + method: 'get', + params: { + id: id + } + }) +} + +export function updateBridge(params) { + return request({ + url: '/bridge/update', + method: 'post', + params + }) +} +// 批量导出 +export function exportRecords(params) { + return request({ + url: 'device/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +export function getContentList(params) { + return request({ + url: 'maintain/contentByType', + method: 'get', + params: { + type: params + } + }) +} +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 编辑 +export function editRecord(params) { + return request({ + url: 'maintain/update', + method: 'post', + params + }) +} +// 新增 +export function addRecord(params) { + return request({ + url: 'maintain/add', + method: 'post', + params + }) +} +// 删除 +export function delRecord(id) { + return request({ + url: 'maintain/delete', + method: 'post', + params: { + id: id + } + }) +} diff --git a/src/api/system/data.js b/src/api/system/data.js new file mode 100644 index 0000000..4c95db5 --- /dev/null +++ b/src/api/system/data.js @@ -0,0 +1,63 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' + +// 获取当前报警列表 +export function getHistoryList(params) { + return request({ + url: '/data/hisListPage', + method: 'get', + params + }) +} + +// 获取当前报警列表 +export function getHistory(params) { + return request({ + url: '/data/hisList', + method: 'get', + params + }) +} + + + +// 批量消警 +export function clearAll(params) { + return request({ + url: '/alarm/allClear', + method: 'get', + params + }) +} + +// 消警 +export function clearAlarm(params) { + return request({ + url: '/alarm/cancel', + method: 'get', + params + }) +} + +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 设置报警阈值 +export function setThresh(params) { + return request({ + url: '/alarm/resetAlarmRule', + method: 'post', + params + }) +} diff --git a/src/api/system/order.js b/src/api/system/order.js new file mode 100644 index 0000000..7007c50 --- /dev/null +++ b/src/api/system/order.js @@ -0,0 +1,71 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +// import qs from 'qs' + +// 获取当前报警列表 +export function getRecordList(params) { + return request({ + url: '/maintain/listPage', + method: 'get', + params + }) +} +// 批量导出 +export function exportRecords(params) { + return request({ + url: 'device/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +export function getContentList(params) { + return request({ + url: 'maintain/contentByType', + method: 'get', + params: { + type: params + } + }) +} +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 编辑 +export function editRecord(params) { + return request({ + url: 'maintain/update', + method: 'post', + params + }) +} +// 新增 +export function addRecord(params) { + return request({ + url: 'maintain/add', + method: 'post', + params + }) +} +// 删除 +export function delRecord(id) { + return request({ + url: 'maintain/delete', + method: 'post', + params: { + bridgeMaintenanceId: id + } + }) +} diff --git a/src/api/system/overview.js b/src/api/system/overview.js new file mode 100644 index 0000000..bca50cc --- /dev/null +++ b/src/api/system/overview.js @@ -0,0 +1,109 @@ +import request from '@/utils/request' +import qs from "qs" +import Vue from 'vue' + +// 路灯状态统计 +export function getLampStatus() { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampStatus', + method: 'get' + }) +} + +// 路灯总览列表 +export function getLampList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampList', + method: 'get', + params + }) +} + +// 路灯详情 +export function getlampDetail(lampId) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampDetail', + method: 'get', + params: { + lampId: lampId + } + }) +} + +// 回路列表 +export function getCircuitList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/circuitList', + method: 'get', + params + }) +} + +// 灯箱列表 +export function getLampBoxList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampBoxList', + method: 'get', + params + }) +} +// 灯箱详情 +export function getLampBoxDetail(lampBoxId) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampBoxDetail', + method: 'get', + params: { + lampBoxId: lampBoxId + } + }) +} + +// 报警总览列表 +export function getAlarmList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/alarmList', + method: 'get', + params + }) +} + +// 报警详情 +export function getAlarmDetail(alarmId) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/alarmDetail', + method: 'get', + params: { + alarmId: alarmId + } + }) +} + +// 路灯控制 +export function lampControl(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampControl', + method: 'post', + params, + paramsSerializer: params => { + return qs.stringify(params, { indices: false }) + } + }) +} diff --git a/src/api/system/rule.js b/src/api/system/rule.js new file mode 100644 index 0000000..76c6b2d --- /dev/null +++ b/src/api/system/rule.js @@ -0,0 +1,59 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +// import qs from 'qs' + +// 获取当前报警列表 +export function getRuleList() { + return request({ + url: 'rule/listPage', + method: 'get' + }) +} +export function getContentList(params) { + return request({ + url: 'maintain/contentByType', + method: 'get', + params: { + type: params + } + }) +} +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 编辑 +export function editRecord(params) { + return request({ + url: 'maintain/update', + method: 'post', + params + }) +} +// 新增 +export function addRecord(params) { + return request({ + url: 'maintain/add', + method: 'post', + params + }) +} +// 删除 +export function delRecord(id) { + return request({ + url: 'maintain/delete', + method: 'post', + params: { + id: id + } + }) +} diff --git a/src/api/system/statistics.js b/src/api/system/statistics.js new file mode 100644 index 0000000..b25efe9 --- /dev/null +++ b/src/api/system/statistics.js @@ -0,0 +1,23 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +// import qs from 'qs' + +// +export function countByToilet(params) { + return request({ + url: '/sanitation/toiletStatistic/jobStaticByToilet', + method: 'get', + params + }) +} + +export function countByDay(params) { + return request({ + url: '/sanitation/toiletStatistic/jobStaticByDate', + method: 'get', + params + }) +} + diff --git a/src/assets/global_images/icon-position.png b/src/assets/global_images/icon-position.png new file mode 100644 index 0000000..7444038 --- /dev/null +++ b/src/assets/global_images/icon-position.png Binary files differ diff --git a/src/assets/global_images/location_green.png b/src/assets/global_images/location_green.png new file mode 100644 index 0000000..aa8be65 --- /dev/null +++ b/src/assets/global_images/location_green.png Binary files differ diff --git a/src/assets/global_images/location_red.png b/src/assets/global_images/location_red.png new file mode 100644 index 0000000..2be8c3d --- /dev/null +++ b/src/assets/global_images/location_red.png Binary files differ diff --git a/src/assets/global_images/location_yellow.png b/src/assets/global_images/location_yellow.png new file mode 100644 index 0000000..5ab6f4d --- /dev/null +++ b/src/assets/global_images/location_yellow.png Binary files differ diff --git a/src/assets/global_images/toilet-position.png b/src/assets/global_images/toilet-position.png new file mode 100644 index 0000000..7db6d9a --- /dev/null +++ b/src/assets/global_images/toilet-position.png Binary files differ diff --git a/src/assets/global_images/toilet.png b/src/assets/global_images/toilet.png new file mode 100644 index 0000000..6d9fc05 --- /dev/null +++ b/src/assets/global_images/toilet.png Binary files differ diff --git a/src/assets/global_images/toiletPhoto.png b/src/assets/global_images/toiletPhoto.png new file mode 100644 index 0000000..15d08e2 --- /dev/null +++ b/src/assets/global_images/toiletPhoto.png Binary files differ diff --git a/src/components/DownloadTemplate/index.vue b/src/components/DownloadTemplate/index.vue index 8ded2cd..7807cac 100644 --- a/src/components/DownloadTemplate/index.vue +++ b/src/components/DownloadTemplate/index.vue @@ -47,8 +47,8 @@ diff --git a/src/components/NormalTable/index.vue b/src/components/NormalTable/index.vue index 5077bef..04d322d 100644 --- a/src/components/NormalTable/index.vue +++ b/src/components/NormalTable/index.vue @@ -79,7 +79,7 @@
-
+
Object.assign(obj, { [key]: this[key] }), {}), + on: events.reduce((obj, key) => Object.assign(obj, { [key]: this.transmitEvent }), {}) + }) + } + this.props = [...extraProps, ...props.filter(prop => exceptProps.indexOf(prop))] + } +} + +export default prop => new Mixin(prop) diff --git a/src/components/mapWindow/base/mixins/common.js b/src/components/mapWindow/base/mixins/common.js new file mode 100644 index 0000000..2fd1a28 --- /dev/null +++ b/src/components/mapWindow/base/mixins/common.js @@ -0,0 +1,82 @@ +const types = { + map: { + unload: 'clearMap' + }, + control: { + unload: 'removeControl' + }, + layer: { + unload: 'removeLayer' + }, + features: { + unload: 'removeFeatures' + }, + listener: { + unload: 'removeListener' + } +} + +const getParent = $component => ($component.abstract || $component.$el === $component.$children[0].$el) ? getParent($component.$parent) : $component + +function destroyInstance () { + const { unload, renderByParent, $parent } = this + if (renderByParent) { + $parent.reload() + } + unload() +} + +class Mixin { + constructor (prop) { + this.methods = { + ready () { + const $parent = getParent(this.$parent) + const map = this.map = $parent.map + this.load() + this.$emit('ready', { + map + }) + }, + transmitEvent (e) { + this.$emit(e.type.replace(/^on/, ''), e) + }, + reload () { + this && this.$nextTick(() => { + this.unload() + this.$nextTick(this.load) + }) + }, + unload () { + const { map, originInstance } = this + try { + switch (prop.type) { + case 'search': + return originInstance.clearResults() + case 'autoComplete': + case 'lushu': + return originInstance.dispose() + case 'markerClusterer': + return originInstance.clearMarkers() + default: + map[types[prop.type].unload](originInstance) + } + } catch (e) {} + } + } + this.computed = { + renderByParent () { + return this.$parent.preventChildrenRender + } + } + this.mounted = function () { + console.log('common mounted') + const $parent = getParent(this.$parent) + const map = $parent.map + const { ready } = this + console.log(map) + map ? ready() : $parent.$on('onload', ready) + } + } +} + +export default type => new Mixin({ type }) diff --git a/src/components/mapWindow/leafletMap.vue b/src/components/mapWindow/leafletMap.vue new file mode 100644 index 0000000..b753cc0 --- /dev/null +++ b/src/components/mapWindow/leafletMap.vue @@ -0,0 +1,143 @@ + + + + + + + diff --git a/src/components/mapWindow/mapWindow.vue b/src/components/mapWindow/mapWindow.vue new file mode 100644 index 0000000..9ced291 --- /dev/null +++ b/src/components/mapWindow/mapWindow.vue @@ -0,0 +1,46 @@ + + + + + + diff --git a/src/icons/svg/bridge.svg b/src/icons/svg/bridge.svg new file mode 100644 index 0000000..1a0336f --- /dev/null +++ b/src/icons/svg/bridge.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/icons/svg/toilet.svg b/src/icons/svg/toilet.svg new file mode 100644 index 0000000..9d8e765 --- /dev/null +++ b/src/icons/svg/toilet.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/main.js b/src/main.js index f2d105d..3e4074e 100644 --- a/src/main.js +++ b/src/main.js @@ -18,6 +18,9 @@ // echart // import echarts from 'echarts' // Vue.prototype.$echarts = echarts +// 引入v-charts +import VCharts from 'v-charts' +Vue.use(VCharts) // 将自动注册所有组件为全局组件 // import dataV from '@jiaminghi/data-view' @@ -35,9 +38,19 @@ Vue.component('search-item', SearchItem) // 加载leaflet的css +// import 'leaflet/dist/leaflet.css' +// import 'leaflet-draw/dist/leaflet.draw.css' +import L from 'leaflet' import 'leaflet/dist/leaflet.css' -import 'leaflet-draw/dist/leaflet.draw.css' +Vue.config.productionTip = false +Vue.L = Vue.prototype.$L = L +delete L.Icon.Default.prototype._getIconUrl +L.Icon.Default.mergeOptions({ + iconRetinaUrl: require('leaflet/dist/images/marker-icon-2x.png'), + iconUrl: require('leaflet/dist/images/marker-icon.png'), + shadowUrl: require('leaflet/dist/images/marker-shadow.png') +}) /** * This project originally used easy-mock to simulate data, * but its official service is very unstable, diff --git a/src/permission.js b/src/permission.js index dc6b2f8..809ca86 100644 --- a/src/permission.js +++ b/src/permission.js @@ -25,8 +25,8 @@ store.dispatch('GetInfo').then(res => { // 拉取用户信息 // 设置当前子系统为基础资源子系统 const currentSys = { - code: 'baseResourse', - name: '基础资源子系统' + code: 'toliet', + name: '公共厕所管理系统' } // 将当前系统信息保存在localStorage中 store.commit('SET_SYSTEM', currentSys) diff --git a/src/router/index.js b/src/router/index.js index 39c295c..d23076d 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -8,8 +8,11 @@ /* Layout */ import Layout from '@/layout/Layout' +import { toiletRouters } from './modules/toilet' +import { workRouters } from './modules/work' +import { statisticsRouters } from './modules/statistics' +import { ruleRouters } from './modules/rule' import { systemRouters } from './modules/system' -import { exampleRouters } from './modules/example' /** * hidden: true if `hidden:true` will not show in the sidebar(default is false) @@ -40,11 +43,12 @@ ] }, // 登录页面 - { path: '/login', component: () => import('@/views/login/index'), hidden: true }, + { path: '/login', component: () => import('@/views/login/index_2'), hidden: true }, // 404错误页面 { path: '/404', component: () => import('@/views/errorPage/404'), hidden: true }, // 401 错误页面 - { path: '/401', component: () => import('@/views/errorPage/401'), hidden: true } + { path: '/401', component: () => import('@/views/errorPage/401'), hidden: true }, + { path: '/', redirect: '/toiletList', hidden: true } ] // 实例化vue的时候直挂载constantRouter export default new Router({ @@ -56,7 +60,10 @@ // 异步挂载路由 // 动态需要根据权限加载的路由表 export const asyncRouterMap = [ - ...exampleRouters, - ...systemRouters, + ...toiletRouters, + ...workRouters, + ...statisticsRouters, + ...ruleRouters, + // ...systemRouters, { path: '*', redirect: '/404', hidden: true } ] diff --git a/src/router/modules/rule.js b/src/router/modules/rule.js new file mode 100644 index 0000000..51e0283 --- /dev/null +++ b/src/router/modules/rule.js @@ -0,0 +1,24 @@ +/* Layout */ +import Layout from '@/layout/Layout' + +export const ruleRouters = [ + { + path: 'rule', + component: Layout, + redirect: '/rule', + name: 'Rule', + meta: { + title: '规章制度', + icon: 'icon-config', // 图标 + permission: ['/rule']// 权限名称 + }, + children: [ + { + path: '/rule', + name: 'Rule', + component: () => import('@/views/rule/listRule'), + meta: { title: '规章制度', icon: 'function', permission: ['/rule'] } + } + ] + } +] diff --git a/src/router/modules/statistics.js b/src/router/modules/statistics.js new file mode 100644 index 0000000..fb9cbea --- /dev/null +++ b/src/router/modules/statistics.js @@ -0,0 +1,30 @@ +/* Layout */ +import Layout from '@/layout/Layout' + +export const statisticsRouters = [ + { + path: 'statisticsToilet', + component: Layout, + redirect: '/workStatistics', + name: 'StatisticsToilet', + meta: { + title: '作业统计', + icon: 'icon-config', // 图标 + permission: ['/statisticsToilet']// 权限名称 + }, + children: [ + { + path: '/workStatistics', + name: 'WorkStatistics', + component: () => import('@/views/statistics/toiletAssessment'), + meta: { title: '作业统计', icon: '', permission: ['/toilet/workStatistics'] } + }, + { + path: '/evaluationStatistics', + name: 'EvaluationStatistics', + component: () => import('@/views/statistics/evaluationAssessment'), + meta: { title: '评价统计', icon: '', permission: ['/toilet/evaluationStatistics'] } + } + ] + } +] diff --git a/src/router/modules/toilet.js b/src/router/modules/toilet.js new file mode 100644 index 0000000..b221a0e --- /dev/null +++ b/src/router/modules/toilet.js @@ -0,0 +1,30 @@ +/* Layout */ +import Layout from '@/layout/Layout' + +export const toiletRouters = [ + { + path: 'toiletManage', + component: Layout, + redirect: '/toiletManage', + name: 'ToiletManage', + meta: { + title: '公厕管理', + icon: 'icon-config', // 图标 + permission: ['/toiletManage']// 权限名称 + }, + children: [ + { + path: '/toiletList', + name: 'ToiletList', + component: () => import('@/views/toiletManage/toiletList'), + meta: { title: '公厕台帐管理', icon: 'function', permission: ['/toiletList'] } + }, + { + path: '/toiletMap', + name: 'ToiletMap', + component: () => import('@/views/overview/overview'), + meta: { title: '地图总览', icon: 'function', permission: ['/toiletMap'] } + } + ] + } +] diff --git a/src/router/modules/work.js b/src/router/modules/work.js new file mode 100644 index 0000000..5e0759f --- /dev/null +++ b/src/router/modules/work.js @@ -0,0 +1,24 @@ +/* Layout */ +import Layout from '@/layout/Layout' + +export const workRouters = [ + { + path: 'toiletWork', + component: Layout, + redirect: '/toiletManage', + name: 'toiletWork', + meta: { + title: '作业管理', + icon: 'icon-config', // 图标 + permission: ['/toiletWork']// 权限名称 + }, + children: [ + { + path: '/toiletWork', + name: 'ToiletWork', + component: () => import('@/views/toiletClean/toiletCleanList'), + meta: { title: '作业管理', icon: 'function', permission: ['/toiletWork'] } + } + ] + } +] diff --git a/src/settings.js b/src/settings.js index b568ce0..b8159bf 100644 --- a/src/settings.js +++ b/src/settings.js @@ -3,7 +3,7 @@ * @type {boolean} true | false * @description 是否显示设置按钮 */ - showSettings: true, + showSettings: false, /** * @type {boolean} true | false diff --git a/src/store/modules/permission.js b/src/store/modules/permission.js index a0cb8cf..3ab50d5 100644 --- a/src/store/modules/permission.js +++ b/src/store/modules/permission.js @@ -120,17 +120,23 @@ }) }, // 获取用户权限 - GetMenus({ commit, state }) { - console.log('in store.permission.js:GetMenus:') + GetMenus({ commit, state }, currentSystem) { + // console.log('in store.permission.js:GetMenus:') + console.log('获取' + currentSystem.name + '的菜单') + const params = { + parentCode: currentSystem.code // 传入该子系统的code,获取子系统的权限 + } return new Promise((resolve, reject) => { - getMenus(state.token).then(response => { // 处理返回值 + // 此处获取用户所有权限 + getMenus(params).then(response => { // 处理返回值 const data = response.data const menus = [] // 仅菜单 const btns = [] // 非菜单 if (data.menus && data.menus.length > 0) { - commit('SET_MENUS', data.menus) - for (const menu of data.menus) { // 遍历菜单,获取所有的权限项 - if (menu.ismenu === '1') { // 将是菜单的放入menus + const allmenus = [...data.menus] + commit('SET_MENUS', allmenus) + for (const menu of allmenus) { // 遍历菜单,获取所有的权限项 + if (menu.resourceType === '02' || menu.resourceType === '03') { // 将是菜单的放入menus const menu_tmp = {} menu_tmp.url = menu.url menu_tmp.icon = menu.icon @@ -142,11 +148,11 @@ btn_tmp.name = menu.name btn_tmp.icon = menu.icon btns.push(btn_tmp) - // console.log(menu.url) } } // 过滤路由表 - const accessedRouters = filterAsyncRouter(asyncRouterMap, menus) + let accessedRouters = filterAsyncRouter(asyncRouterMap, menus) + // accessedRouters = filterRedirect(accessedRouters) commit('SET_BTNS', btns) commit('SET_ROUTERS', accessedRouters) resolve(response) diff --git a/src/utils/baseConfig.js b/src/utils/baseConfig.js index 1f4fa38..999593e 100644 --- a/src/utils/baseConfig.js +++ b/src/utils/baseConfig.js @@ -1,5 +1,5 @@ const project = { - title: '后台管理系统前端基础框架' + title: '路桥养护子系统' } export function getProject() { return project diff --git a/src/utils/dateutils.js b/src/utils/dateutils.js index 868111a..5cd16af 100644 --- a/src/utils/dateutils.js +++ b/src/utils/dateutils.js @@ -15,15 +15,15 @@ return ct_month } -export function getLastWeek() { // 默认显示上周 +export function getLastWeek(fmt) { // 默认显示上周 const ct_month = new Date() ct_month.setTime(ct_month.getTime() - 3600 * 1000 * 24 * 7) - return ct_month + return ct_month.Format(fmt) } -export function getLastMonth() { // 默认显示上个月 +export function getLastMonth(fmt) { // 默认显示上个月 const ct_month = new Date() ct_month.setTime(ct_month.getTime() - 3600 * 1000 * 24 * 30) - return ct_month + return ct_month.Format(fmt) } // 对Date的扩展,将 Date 转化为指定格式的String diff --git a/src/utils/exportutils.js b/src/utils/exportutils.js new file mode 100644 index 0000000..b5d0bcf --- /dev/null +++ b/src/utils/exportutils.js @@ -0,0 +1,19 @@ +/** + * 导出文件工具 + * @param blob 文件 + * @param fileName 导出文件名 + */ +export function exportFile(blob, fileName) { + if (window.navigator && window.navigator.msSaveOrOpenBlob) { + navigator.msSaveBlob(blob, fileName) + } else { + const downloadElement = document.createElement('a') + const href = window.URL.createObjectURL(blob) // 创建下载的链接 + downloadElement.href = href + downloadElement.download = fileName + document.body.appendChild(downloadElement) + downloadElement.click() // 点击下载 + document.body.removeChild(downloadElement) // 下载完成移除元素 + window.URL.revokeObjectURL(href) // 释放blob对象 + } +} diff --git a/src/utils/request.js b/src/utils/request.js index c88ea76..dc56e26 100644 --- a/src/utils/request.js +++ b/src/utils/request.js @@ -17,6 +17,13 @@ config.headers['token'] = getToken() // 让每个请求携带自定义token 请根据实际情况自行修改 console.log(config.headers['token']) } + // 在接口增加时间戳 + // if (config.method === 'get') { + config.params = { + _t: Date.parse(new Date()) / 1000, + ...config.params + } + // } return config }, error => { diff --git a/src/views/mapViews/choosePointDialog.vue b/src/views/mapViews/choosePointDialog.vue new file mode 100644 index 0000000..c9dde8a --- /dev/null +++ b/src/views/mapViews/choosePointDialog.vue @@ -0,0 +1,105 @@ + + + + + diff --git a/config/index.js b/config/index.js index 8abd37a..19b33b1 100644 --- a/config/index.js +++ b/config/index.js @@ -69,7 +69,7 @@ * then assetsPublicPath should be set to "/bar/". * In most cases please use '/' !!! */ - assetsPublicPath: '/', + assetsPublicPath: '/toilet/', /** * Source Maps diff --git a/package.json b/package.json index 45f055f..9f3a3eb 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "echarts": "^4.2.1", "element-ui": "2.13.0", "event-source-polyfill": "^1.0.5", + "file-saver": "^2.0.5", "js-cookie": "2.2.0", "jsencrypt": "^3.0.0-rc.1", "leaflet": "^1.7.1", @@ -33,7 +34,9 @@ "vue-amap": "^0.5.9", "vue-baidu-map": "^0.21.22", "vue-router": "3.0.1", - "vuex": "3.0.1" + "vue2-leaflet": "^2.7.0", + "vuex": "3.0.1", + "xlsx": "^0.17.0" }, "devDependencies": { "autoprefixer": "8.5.0", diff --git a/src/api/common.js b/src/api/common.js index 87c582b..7804714 100644 --- a/src/api/common.js +++ b/src/api/common.js @@ -2,10 +2,14 @@ * 常用接口 */ import request from '@/utils/request' +import Vue from 'vue' + // 模板下载 export function downloadTemplate(fileName) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath return request({ - url: 'template/download', + url: lampPath + 'template/download', method: 'get', params: { filename: fileName @@ -19,7 +23,7 @@ const param = new FormData() param.append('file', fileobj.file) return request({ - url: 'imageUpload', + url: 'fileUpload', method: 'post', headers: { 'Content-Type': 'multipart/form-data' }, data: param diff --git a/src/api/sanitation/statistics.js b/src/api/sanitation/statistics.js new file mode 100644 index 0000000..ffeac18 --- /dev/null +++ b/src/api/sanitation/statistics.js @@ -0,0 +1,22 @@ + +/** + * 考核统计接口 + */ +import request from '@/utils/request' +// 公厕保洁次数统计 +export function getToiletJobCount(params) { + return request({ + url: '/sanitation/statistic/toilet/jobCount', + method: 'get', + params + }) +} + +// 公厕评分统计 +export function getToiletEvaluation(params) { + return request({ + url: '/sanitation/toiletEvaluation/statistics', + method: 'get', + params + }) +} diff --git a/src/api/sanitation/toilet.js b/src/api/sanitation/toilet.js new file mode 100644 index 0000000..11affd4 --- /dev/null +++ b/src/api/sanitation/toilet.js @@ -0,0 +1,133 @@ +/** + * 公厕管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' +// 公厕查询 +export function getToiletListPage(params) { + return request({ + url: '/sanitation/toilet/listPage', + method: 'get', + params + }) +} +// 公厕查询 +export function getToiletList(pid) { + return request({ + url: '/sanitation/toilet/list', + method: 'get', + params: { + pid: pid + } + }) +} + +// 添加公厕 +export function addToilet(params) { + return request({ + url: '/sanitation/toilet/add', + method: 'post', + params + }) +} +// 修改公厕机构 +export function updateToilet(params) { + return request({ + url: '/sanitation/toilet/update', + method: 'post', + params + }) +} +// 删除公厕机构 +export function delToilet(ids) { + return request({ + url: '/sanitation/toilet/delete', + method: 'post', + params: { + ids + }, + paramsSerializer: params => { + return qs.stringify(params, { indices: false }) + } + }) +} + +// 公厕基本信息详情 +export function getToiletInfoDetail(id) { + return request({ + url: '/sanitation/toilet/detail?toiletId=' + id, + method: 'get' + }) +} + +// 某公厕保洁记录 +export function getRecordsByToilet(params) { + return request({ + url: '/sanitation/toilet/jobRecord/detail', + method: 'get', + params + }) +} + +// 某公厕平均评分 +export function getScoreByToilet(params) { + return request({ + url: '/sanitation/toiletEvaluation/detailScore', + method: 'get', + params + }) +} + +// 某公厕评分列表 +export function getScoreListByToilet(params) { + return request({ + url: '/sanitation/toiletEvaluation/list', + method: 'get', + params + }) +} + + +// 批量导入 +export function batchImportToilet(fileobj) { + const param = new FormData() + param.append('file', fileobj) + return request({ + url: '/sanitation/toilet/import', + method: 'post', + headers: { 'Content-Type': 'multipart/form-data' }, + data: param + }) +} +// 批量导出 +export function batchExportToilet(params, config) { + return request({ + url: '/sanitation/toilet/export', + method: 'get', + timeout: 120000, + params, + ...config, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 公厕保洁记录查询 +export function getToiletJobRecords(params) { + return request({ + url: '/sanitation/toilet/jobRecord', + method: 'get', + params + }) +} + +// 批量导出 +export function batchExportToiletJobRecords(params, config) { + return request({ + url: '/sanitation/toilet/exportJobRecord', + method: 'get', + timeout: 120000, + params, + ...config, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} diff --git a/src/api/system/alarm.js b/src/api/system/alarm.js new file mode 100644 index 0000000..1c3a7ab --- /dev/null +++ b/src/api/system/alarm.js @@ -0,0 +1,62 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' + +// 获取当前报警列表 +export function getAlarmNowList(params) { + return request({ + url: '/alarm/listNowPage', + method: 'get', + params + }) +} + +// 获取当前报警列表 +export function getAlarmHistoryList(params) { + return request({ + url: '/alarm/listHisPage', + method: 'get', + params + }) +} + + +// 批量消警 +export function clearAll(params) { + return request({ + url: '/alarm/allClear', + method: 'get', + params + }) +} + +// 消警 +export function clearAlarm(params) { + return request({ + url: '/alarm/cancel', + method: 'get', + params + }) +} + +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 设置报警阈值 +export function setThresh(params) { + return request({ + url: '/alarm/resetAlarmRule', + method: 'post', + params + }) +} diff --git a/src/api/system/bridge.js b/src/api/system/bridge.js new file mode 100644 index 0000000..e8a4108 --- /dev/null +++ b/src/api/system/bridge.js @@ -0,0 +1,80 @@ +/** + * 桥梁管理接口 + */ +import request from '@/utils/request' + +// 获取桥梁详情 +export function getDetail(id) { + return request({ + url: '/bridge/detail', + method: 'get', + params: { + id: id + } + }) +} + +export function updateBridge(params) { + return request({ + url: '/bridge/update', + method: 'post', + params + }) +} +// 批量导出 +export function exportRecords(params) { + return request({ + url: 'device/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +export function getContentList(params) { + return request({ + url: 'maintain/contentByType', + method: 'get', + params: { + type: params + } + }) +} +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 编辑 +export function editRecord(params) { + return request({ + url: 'maintain/update', + method: 'post', + params + }) +} +// 新增 +export function addRecord(params) { + return request({ + url: 'maintain/add', + method: 'post', + params + }) +} +// 删除 +export function delRecord(id) { + return request({ + url: 'maintain/delete', + method: 'post', + params: { + id: id + } + }) +} diff --git a/src/api/system/data.js b/src/api/system/data.js new file mode 100644 index 0000000..4c95db5 --- /dev/null +++ b/src/api/system/data.js @@ -0,0 +1,63 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' + +// 获取当前报警列表 +export function getHistoryList(params) { + return request({ + url: '/data/hisListPage', + method: 'get', + params + }) +} + +// 获取当前报警列表 +export function getHistory(params) { + return request({ + url: '/data/hisList', + method: 'get', + params + }) +} + + + +// 批量消警 +export function clearAll(params) { + return request({ + url: '/alarm/allClear', + method: 'get', + params + }) +} + +// 消警 +export function clearAlarm(params) { + return request({ + url: '/alarm/cancel', + method: 'get', + params + }) +} + +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 设置报警阈值 +export function setThresh(params) { + return request({ + url: '/alarm/resetAlarmRule', + method: 'post', + params + }) +} diff --git a/src/api/system/order.js b/src/api/system/order.js new file mode 100644 index 0000000..7007c50 --- /dev/null +++ b/src/api/system/order.js @@ -0,0 +1,71 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +// import qs from 'qs' + +// 获取当前报警列表 +export function getRecordList(params) { + return request({ + url: '/maintain/listPage', + method: 'get', + params + }) +} +// 批量导出 +export function exportRecords(params) { + return request({ + url: 'device/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +export function getContentList(params) { + return request({ + url: 'maintain/contentByType', + method: 'get', + params: { + type: params + } + }) +} +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 编辑 +export function editRecord(params) { + return request({ + url: 'maintain/update', + method: 'post', + params + }) +} +// 新增 +export function addRecord(params) { + return request({ + url: 'maintain/add', + method: 'post', + params + }) +} +// 删除 +export function delRecord(id) { + return request({ + url: 'maintain/delete', + method: 'post', + params: { + bridgeMaintenanceId: id + } + }) +} diff --git a/src/api/system/overview.js b/src/api/system/overview.js new file mode 100644 index 0000000..bca50cc --- /dev/null +++ b/src/api/system/overview.js @@ -0,0 +1,109 @@ +import request from '@/utils/request' +import qs from "qs" +import Vue from 'vue' + +// 路灯状态统计 +export function getLampStatus() { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampStatus', + method: 'get' + }) +} + +// 路灯总览列表 +export function getLampList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampList', + method: 'get', + params + }) +} + +// 路灯详情 +export function getlampDetail(lampId) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampDetail', + method: 'get', + params: { + lampId: lampId + } + }) +} + +// 回路列表 +export function getCircuitList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/circuitList', + method: 'get', + params + }) +} + +// 灯箱列表 +export function getLampBoxList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampBoxList', + method: 'get', + params + }) +} +// 灯箱详情 +export function getLampBoxDetail(lampBoxId) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampBoxDetail', + method: 'get', + params: { + lampBoxId: lampBoxId + } + }) +} + +// 报警总览列表 +export function getAlarmList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/alarmList', + method: 'get', + params + }) +} + +// 报警详情 +export function getAlarmDetail(alarmId) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/alarmDetail', + method: 'get', + params: { + alarmId: alarmId + } + }) +} + +// 路灯控制 +export function lampControl(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampControl', + method: 'post', + params, + paramsSerializer: params => { + return qs.stringify(params, { indices: false }) + } + }) +} diff --git a/src/api/system/rule.js b/src/api/system/rule.js new file mode 100644 index 0000000..76c6b2d --- /dev/null +++ b/src/api/system/rule.js @@ -0,0 +1,59 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +// import qs from 'qs' + +// 获取当前报警列表 +export function getRuleList() { + return request({ + url: 'rule/listPage', + method: 'get' + }) +} +export function getContentList(params) { + return request({ + url: 'maintain/contentByType', + method: 'get', + params: { + type: params + } + }) +} +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 编辑 +export function editRecord(params) { + return request({ + url: 'maintain/update', + method: 'post', + params + }) +} +// 新增 +export function addRecord(params) { + return request({ + url: 'maintain/add', + method: 'post', + params + }) +} +// 删除 +export function delRecord(id) { + return request({ + url: 'maintain/delete', + method: 'post', + params: { + id: id + } + }) +} diff --git a/src/api/system/statistics.js b/src/api/system/statistics.js new file mode 100644 index 0000000..b25efe9 --- /dev/null +++ b/src/api/system/statistics.js @@ -0,0 +1,23 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +// import qs from 'qs' + +// +export function countByToilet(params) { + return request({ + url: '/sanitation/toiletStatistic/jobStaticByToilet', + method: 'get', + params + }) +} + +export function countByDay(params) { + return request({ + url: '/sanitation/toiletStatistic/jobStaticByDate', + method: 'get', + params + }) +} + diff --git a/src/assets/global_images/icon-position.png b/src/assets/global_images/icon-position.png new file mode 100644 index 0000000..7444038 --- /dev/null +++ b/src/assets/global_images/icon-position.png Binary files differ diff --git a/src/assets/global_images/location_green.png b/src/assets/global_images/location_green.png new file mode 100644 index 0000000..aa8be65 --- /dev/null +++ b/src/assets/global_images/location_green.png Binary files differ diff --git a/src/assets/global_images/location_red.png b/src/assets/global_images/location_red.png new file mode 100644 index 0000000..2be8c3d --- /dev/null +++ b/src/assets/global_images/location_red.png Binary files differ diff --git a/src/assets/global_images/location_yellow.png b/src/assets/global_images/location_yellow.png new file mode 100644 index 0000000..5ab6f4d --- /dev/null +++ b/src/assets/global_images/location_yellow.png Binary files differ diff --git a/src/assets/global_images/toilet-position.png b/src/assets/global_images/toilet-position.png new file mode 100644 index 0000000..7db6d9a --- /dev/null +++ b/src/assets/global_images/toilet-position.png Binary files differ diff --git a/src/assets/global_images/toilet.png b/src/assets/global_images/toilet.png new file mode 100644 index 0000000..6d9fc05 --- /dev/null +++ b/src/assets/global_images/toilet.png Binary files differ diff --git a/src/assets/global_images/toiletPhoto.png b/src/assets/global_images/toiletPhoto.png new file mode 100644 index 0000000..15d08e2 --- /dev/null +++ b/src/assets/global_images/toiletPhoto.png Binary files differ diff --git a/src/components/DownloadTemplate/index.vue b/src/components/DownloadTemplate/index.vue index 8ded2cd..7807cac 100644 --- a/src/components/DownloadTemplate/index.vue +++ b/src/components/DownloadTemplate/index.vue @@ -47,8 +47,8 @@ diff --git a/src/components/NormalTable/index.vue b/src/components/NormalTable/index.vue index 5077bef..04d322d 100644 --- a/src/components/NormalTable/index.vue +++ b/src/components/NormalTable/index.vue @@ -79,7 +79,7 @@
-
+
Object.assign(obj, { [key]: this[key] }), {}), + on: events.reduce((obj, key) => Object.assign(obj, { [key]: this.transmitEvent }), {}) + }) + } + this.props = [...extraProps, ...props.filter(prop => exceptProps.indexOf(prop))] + } +} + +export default prop => new Mixin(prop) diff --git a/src/components/mapWindow/base/mixins/common.js b/src/components/mapWindow/base/mixins/common.js new file mode 100644 index 0000000..2fd1a28 --- /dev/null +++ b/src/components/mapWindow/base/mixins/common.js @@ -0,0 +1,82 @@ +const types = { + map: { + unload: 'clearMap' + }, + control: { + unload: 'removeControl' + }, + layer: { + unload: 'removeLayer' + }, + features: { + unload: 'removeFeatures' + }, + listener: { + unload: 'removeListener' + } +} + +const getParent = $component => ($component.abstract || $component.$el === $component.$children[0].$el) ? getParent($component.$parent) : $component + +function destroyInstance () { + const { unload, renderByParent, $parent } = this + if (renderByParent) { + $parent.reload() + } + unload() +} + +class Mixin { + constructor (prop) { + this.methods = { + ready () { + const $parent = getParent(this.$parent) + const map = this.map = $parent.map + this.load() + this.$emit('ready', { + map + }) + }, + transmitEvent (e) { + this.$emit(e.type.replace(/^on/, ''), e) + }, + reload () { + this && this.$nextTick(() => { + this.unload() + this.$nextTick(this.load) + }) + }, + unload () { + const { map, originInstance } = this + try { + switch (prop.type) { + case 'search': + return originInstance.clearResults() + case 'autoComplete': + case 'lushu': + return originInstance.dispose() + case 'markerClusterer': + return originInstance.clearMarkers() + default: + map[types[prop.type].unload](originInstance) + } + } catch (e) {} + } + } + this.computed = { + renderByParent () { + return this.$parent.preventChildrenRender + } + } + this.mounted = function () { + console.log('common mounted') + const $parent = getParent(this.$parent) + const map = $parent.map + const { ready } = this + console.log(map) + map ? ready() : $parent.$on('onload', ready) + } + } +} + +export default type => new Mixin({ type }) diff --git a/src/components/mapWindow/leafletMap.vue b/src/components/mapWindow/leafletMap.vue new file mode 100644 index 0000000..b753cc0 --- /dev/null +++ b/src/components/mapWindow/leafletMap.vue @@ -0,0 +1,143 @@ + + + + + + + diff --git a/src/components/mapWindow/mapWindow.vue b/src/components/mapWindow/mapWindow.vue new file mode 100644 index 0000000..9ced291 --- /dev/null +++ b/src/components/mapWindow/mapWindow.vue @@ -0,0 +1,46 @@ + + + + + + diff --git a/src/icons/svg/bridge.svg b/src/icons/svg/bridge.svg new file mode 100644 index 0000000..1a0336f --- /dev/null +++ b/src/icons/svg/bridge.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/icons/svg/toilet.svg b/src/icons/svg/toilet.svg new file mode 100644 index 0000000..9d8e765 --- /dev/null +++ b/src/icons/svg/toilet.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/main.js b/src/main.js index f2d105d..3e4074e 100644 --- a/src/main.js +++ b/src/main.js @@ -18,6 +18,9 @@ // echart // import echarts from 'echarts' // Vue.prototype.$echarts = echarts +// 引入v-charts +import VCharts from 'v-charts' +Vue.use(VCharts) // 将自动注册所有组件为全局组件 // import dataV from '@jiaminghi/data-view' @@ -35,9 +38,19 @@ Vue.component('search-item', SearchItem) // 加载leaflet的css +// import 'leaflet/dist/leaflet.css' +// import 'leaflet-draw/dist/leaflet.draw.css' +import L from 'leaflet' import 'leaflet/dist/leaflet.css' -import 'leaflet-draw/dist/leaflet.draw.css' +Vue.config.productionTip = false +Vue.L = Vue.prototype.$L = L +delete L.Icon.Default.prototype._getIconUrl +L.Icon.Default.mergeOptions({ + iconRetinaUrl: require('leaflet/dist/images/marker-icon-2x.png'), + iconUrl: require('leaflet/dist/images/marker-icon.png'), + shadowUrl: require('leaflet/dist/images/marker-shadow.png') +}) /** * This project originally used easy-mock to simulate data, * but its official service is very unstable, diff --git a/src/permission.js b/src/permission.js index dc6b2f8..809ca86 100644 --- a/src/permission.js +++ b/src/permission.js @@ -25,8 +25,8 @@ store.dispatch('GetInfo').then(res => { // 拉取用户信息 // 设置当前子系统为基础资源子系统 const currentSys = { - code: 'baseResourse', - name: '基础资源子系统' + code: 'toliet', + name: '公共厕所管理系统' } // 将当前系统信息保存在localStorage中 store.commit('SET_SYSTEM', currentSys) diff --git a/src/router/index.js b/src/router/index.js index 39c295c..d23076d 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -8,8 +8,11 @@ /* Layout */ import Layout from '@/layout/Layout' +import { toiletRouters } from './modules/toilet' +import { workRouters } from './modules/work' +import { statisticsRouters } from './modules/statistics' +import { ruleRouters } from './modules/rule' import { systemRouters } from './modules/system' -import { exampleRouters } from './modules/example' /** * hidden: true if `hidden:true` will not show in the sidebar(default is false) @@ -40,11 +43,12 @@ ] }, // 登录页面 - { path: '/login', component: () => import('@/views/login/index'), hidden: true }, + { path: '/login', component: () => import('@/views/login/index_2'), hidden: true }, // 404错误页面 { path: '/404', component: () => import('@/views/errorPage/404'), hidden: true }, // 401 错误页面 - { path: '/401', component: () => import('@/views/errorPage/401'), hidden: true } + { path: '/401', component: () => import('@/views/errorPage/401'), hidden: true }, + { path: '/', redirect: '/toiletList', hidden: true } ] // 实例化vue的时候直挂载constantRouter export default new Router({ @@ -56,7 +60,10 @@ // 异步挂载路由 // 动态需要根据权限加载的路由表 export const asyncRouterMap = [ - ...exampleRouters, - ...systemRouters, + ...toiletRouters, + ...workRouters, + ...statisticsRouters, + ...ruleRouters, + // ...systemRouters, { path: '*', redirect: '/404', hidden: true } ] diff --git a/src/router/modules/rule.js b/src/router/modules/rule.js new file mode 100644 index 0000000..51e0283 --- /dev/null +++ b/src/router/modules/rule.js @@ -0,0 +1,24 @@ +/* Layout */ +import Layout from '@/layout/Layout' + +export const ruleRouters = [ + { + path: 'rule', + component: Layout, + redirect: '/rule', + name: 'Rule', + meta: { + title: '规章制度', + icon: 'icon-config', // 图标 + permission: ['/rule']// 权限名称 + }, + children: [ + { + path: '/rule', + name: 'Rule', + component: () => import('@/views/rule/listRule'), + meta: { title: '规章制度', icon: 'function', permission: ['/rule'] } + } + ] + } +] diff --git a/src/router/modules/statistics.js b/src/router/modules/statistics.js new file mode 100644 index 0000000..fb9cbea --- /dev/null +++ b/src/router/modules/statistics.js @@ -0,0 +1,30 @@ +/* Layout */ +import Layout from '@/layout/Layout' + +export const statisticsRouters = [ + { + path: 'statisticsToilet', + component: Layout, + redirect: '/workStatistics', + name: 'StatisticsToilet', + meta: { + title: '作业统计', + icon: 'icon-config', // 图标 + permission: ['/statisticsToilet']// 权限名称 + }, + children: [ + { + path: '/workStatistics', + name: 'WorkStatistics', + component: () => import('@/views/statistics/toiletAssessment'), + meta: { title: '作业统计', icon: '', permission: ['/toilet/workStatistics'] } + }, + { + path: '/evaluationStatistics', + name: 'EvaluationStatistics', + component: () => import('@/views/statistics/evaluationAssessment'), + meta: { title: '评价统计', icon: '', permission: ['/toilet/evaluationStatistics'] } + } + ] + } +] diff --git a/src/router/modules/toilet.js b/src/router/modules/toilet.js new file mode 100644 index 0000000..b221a0e --- /dev/null +++ b/src/router/modules/toilet.js @@ -0,0 +1,30 @@ +/* Layout */ +import Layout from '@/layout/Layout' + +export const toiletRouters = [ + { + path: 'toiletManage', + component: Layout, + redirect: '/toiletManage', + name: 'ToiletManage', + meta: { + title: '公厕管理', + icon: 'icon-config', // 图标 + permission: ['/toiletManage']// 权限名称 + }, + children: [ + { + path: '/toiletList', + name: 'ToiletList', + component: () => import('@/views/toiletManage/toiletList'), + meta: { title: '公厕台帐管理', icon: 'function', permission: ['/toiletList'] } + }, + { + path: '/toiletMap', + name: 'ToiletMap', + component: () => import('@/views/overview/overview'), + meta: { title: '地图总览', icon: 'function', permission: ['/toiletMap'] } + } + ] + } +] diff --git a/src/router/modules/work.js b/src/router/modules/work.js new file mode 100644 index 0000000..5e0759f --- /dev/null +++ b/src/router/modules/work.js @@ -0,0 +1,24 @@ +/* Layout */ +import Layout from '@/layout/Layout' + +export const workRouters = [ + { + path: 'toiletWork', + component: Layout, + redirect: '/toiletManage', + name: 'toiletWork', + meta: { + title: '作业管理', + icon: 'icon-config', // 图标 + permission: ['/toiletWork']// 权限名称 + }, + children: [ + { + path: '/toiletWork', + name: 'ToiletWork', + component: () => import('@/views/toiletClean/toiletCleanList'), + meta: { title: '作业管理', icon: 'function', permission: ['/toiletWork'] } + } + ] + } +] diff --git a/src/settings.js b/src/settings.js index b568ce0..b8159bf 100644 --- a/src/settings.js +++ b/src/settings.js @@ -3,7 +3,7 @@ * @type {boolean} true | false * @description 是否显示设置按钮 */ - showSettings: true, + showSettings: false, /** * @type {boolean} true | false diff --git a/src/store/modules/permission.js b/src/store/modules/permission.js index a0cb8cf..3ab50d5 100644 --- a/src/store/modules/permission.js +++ b/src/store/modules/permission.js @@ -120,17 +120,23 @@ }) }, // 获取用户权限 - GetMenus({ commit, state }) { - console.log('in store.permission.js:GetMenus:') + GetMenus({ commit, state }, currentSystem) { + // console.log('in store.permission.js:GetMenus:') + console.log('获取' + currentSystem.name + '的菜单') + const params = { + parentCode: currentSystem.code // 传入该子系统的code,获取子系统的权限 + } return new Promise((resolve, reject) => { - getMenus(state.token).then(response => { // 处理返回值 + // 此处获取用户所有权限 + getMenus(params).then(response => { // 处理返回值 const data = response.data const menus = [] // 仅菜单 const btns = [] // 非菜单 if (data.menus && data.menus.length > 0) { - commit('SET_MENUS', data.menus) - for (const menu of data.menus) { // 遍历菜单,获取所有的权限项 - if (menu.ismenu === '1') { // 将是菜单的放入menus + const allmenus = [...data.menus] + commit('SET_MENUS', allmenus) + for (const menu of allmenus) { // 遍历菜单,获取所有的权限项 + if (menu.resourceType === '02' || menu.resourceType === '03') { // 将是菜单的放入menus const menu_tmp = {} menu_tmp.url = menu.url menu_tmp.icon = menu.icon @@ -142,11 +148,11 @@ btn_tmp.name = menu.name btn_tmp.icon = menu.icon btns.push(btn_tmp) - // console.log(menu.url) } } // 过滤路由表 - const accessedRouters = filterAsyncRouter(asyncRouterMap, menus) + let accessedRouters = filterAsyncRouter(asyncRouterMap, menus) + // accessedRouters = filterRedirect(accessedRouters) commit('SET_BTNS', btns) commit('SET_ROUTERS', accessedRouters) resolve(response) diff --git a/src/utils/baseConfig.js b/src/utils/baseConfig.js index 1f4fa38..999593e 100644 --- a/src/utils/baseConfig.js +++ b/src/utils/baseConfig.js @@ -1,5 +1,5 @@ const project = { - title: '后台管理系统前端基础框架' + title: '路桥养护子系统' } export function getProject() { return project diff --git a/src/utils/dateutils.js b/src/utils/dateutils.js index 868111a..5cd16af 100644 --- a/src/utils/dateutils.js +++ b/src/utils/dateutils.js @@ -15,15 +15,15 @@ return ct_month } -export function getLastWeek() { // 默认显示上周 +export function getLastWeek(fmt) { // 默认显示上周 const ct_month = new Date() ct_month.setTime(ct_month.getTime() - 3600 * 1000 * 24 * 7) - return ct_month + return ct_month.Format(fmt) } -export function getLastMonth() { // 默认显示上个月 +export function getLastMonth(fmt) { // 默认显示上个月 const ct_month = new Date() ct_month.setTime(ct_month.getTime() - 3600 * 1000 * 24 * 30) - return ct_month + return ct_month.Format(fmt) } // 对Date的扩展,将 Date 转化为指定格式的String diff --git a/src/utils/exportutils.js b/src/utils/exportutils.js new file mode 100644 index 0000000..b5d0bcf --- /dev/null +++ b/src/utils/exportutils.js @@ -0,0 +1,19 @@ +/** + * 导出文件工具 + * @param blob 文件 + * @param fileName 导出文件名 + */ +export function exportFile(blob, fileName) { + if (window.navigator && window.navigator.msSaveOrOpenBlob) { + navigator.msSaveBlob(blob, fileName) + } else { + const downloadElement = document.createElement('a') + const href = window.URL.createObjectURL(blob) // 创建下载的链接 + downloadElement.href = href + downloadElement.download = fileName + document.body.appendChild(downloadElement) + downloadElement.click() // 点击下载 + document.body.removeChild(downloadElement) // 下载完成移除元素 + window.URL.revokeObjectURL(href) // 释放blob对象 + } +} diff --git a/src/utils/request.js b/src/utils/request.js index c88ea76..dc56e26 100644 --- a/src/utils/request.js +++ b/src/utils/request.js @@ -17,6 +17,13 @@ config.headers['token'] = getToken() // 让每个请求携带自定义token 请根据实际情况自行修改 console.log(config.headers['token']) } + // 在接口增加时间戳 + // if (config.method === 'get') { + config.params = { + _t: Date.parse(new Date()) / 1000, + ...config.params + } + // } return config }, error => { diff --git a/src/views/mapViews/choosePointDialog.vue b/src/views/mapViews/choosePointDialog.vue new file mode 100644 index 0000000..c9dde8a --- /dev/null +++ b/src/views/mapViews/choosePointDialog.vue @@ -0,0 +1,105 @@ + + + + + diff --git a/src/views/mapViews/mapView.vue b/src/views/mapViews/mapView.vue new file mode 100644 index 0000000..a18db88 --- /dev/null +++ b/src/views/mapViews/mapView.vue @@ -0,0 +1,73 @@ + + + + + diff --git a/config/index.js b/config/index.js index 8abd37a..19b33b1 100644 --- a/config/index.js +++ b/config/index.js @@ -69,7 +69,7 @@ * then assetsPublicPath should be set to "/bar/". * In most cases please use '/' !!! */ - assetsPublicPath: '/', + assetsPublicPath: '/toilet/', /** * Source Maps diff --git a/package.json b/package.json index 45f055f..9f3a3eb 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "echarts": "^4.2.1", "element-ui": "2.13.0", "event-source-polyfill": "^1.0.5", + "file-saver": "^2.0.5", "js-cookie": "2.2.0", "jsencrypt": "^3.0.0-rc.1", "leaflet": "^1.7.1", @@ -33,7 +34,9 @@ "vue-amap": "^0.5.9", "vue-baidu-map": "^0.21.22", "vue-router": "3.0.1", - "vuex": "3.0.1" + "vue2-leaflet": "^2.7.0", + "vuex": "3.0.1", + "xlsx": "^0.17.0" }, "devDependencies": { "autoprefixer": "8.5.0", diff --git a/src/api/common.js b/src/api/common.js index 87c582b..7804714 100644 --- a/src/api/common.js +++ b/src/api/common.js @@ -2,10 +2,14 @@ * 常用接口 */ import request from '@/utils/request' +import Vue from 'vue' + // 模板下载 export function downloadTemplate(fileName) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath return request({ - url: 'template/download', + url: lampPath + 'template/download', method: 'get', params: { filename: fileName @@ -19,7 +23,7 @@ const param = new FormData() param.append('file', fileobj.file) return request({ - url: 'imageUpload', + url: 'fileUpload', method: 'post', headers: { 'Content-Type': 'multipart/form-data' }, data: param diff --git a/src/api/sanitation/statistics.js b/src/api/sanitation/statistics.js new file mode 100644 index 0000000..ffeac18 --- /dev/null +++ b/src/api/sanitation/statistics.js @@ -0,0 +1,22 @@ + +/** + * 考核统计接口 + */ +import request from '@/utils/request' +// 公厕保洁次数统计 +export function getToiletJobCount(params) { + return request({ + url: '/sanitation/statistic/toilet/jobCount', + method: 'get', + params + }) +} + +// 公厕评分统计 +export function getToiletEvaluation(params) { + return request({ + url: '/sanitation/toiletEvaluation/statistics', + method: 'get', + params + }) +} diff --git a/src/api/sanitation/toilet.js b/src/api/sanitation/toilet.js new file mode 100644 index 0000000..11affd4 --- /dev/null +++ b/src/api/sanitation/toilet.js @@ -0,0 +1,133 @@ +/** + * 公厕管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' +// 公厕查询 +export function getToiletListPage(params) { + return request({ + url: '/sanitation/toilet/listPage', + method: 'get', + params + }) +} +// 公厕查询 +export function getToiletList(pid) { + return request({ + url: '/sanitation/toilet/list', + method: 'get', + params: { + pid: pid + } + }) +} + +// 添加公厕 +export function addToilet(params) { + return request({ + url: '/sanitation/toilet/add', + method: 'post', + params + }) +} +// 修改公厕机构 +export function updateToilet(params) { + return request({ + url: '/sanitation/toilet/update', + method: 'post', + params + }) +} +// 删除公厕机构 +export function delToilet(ids) { + return request({ + url: '/sanitation/toilet/delete', + method: 'post', + params: { + ids + }, + paramsSerializer: params => { + return qs.stringify(params, { indices: false }) + } + }) +} + +// 公厕基本信息详情 +export function getToiletInfoDetail(id) { + return request({ + url: '/sanitation/toilet/detail?toiletId=' + id, + method: 'get' + }) +} + +// 某公厕保洁记录 +export function getRecordsByToilet(params) { + return request({ + url: '/sanitation/toilet/jobRecord/detail', + method: 'get', + params + }) +} + +// 某公厕平均评分 +export function getScoreByToilet(params) { + return request({ + url: '/sanitation/toiletEvaluation/detailScore', + method: 'get', + params + }) +} + +// 某公厕评分列表 +export function getScoreListByToilet(params) { + return request({ + url: '/sanitation/toiletEvaluation/list', + method: 'get', + params + }) +} + + +// 批量导入 +export function batchImportToilet(fileobj) { + const param = new FormData() + param.append('file', fileobj) + return request({ + url: '/sanitation/toilet/import', + method: 'post', + headers: { 'Content-Type': 'multipart/form-data' }, + data: param + }) +} +// 批量导出 +export function batchExportToilet(params, config) { + return request({ + url: '/sanitation/toilet/export', + method: 'get', + timeout: 120000, + params, + ...config, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 公厕保洁记录查询 +export function getToiletJobRecords(params) { + return request({ + url: '/sanitation/toilet/jobRecord', + method: 'get', + params + }) +} + +// 批量导出 +export function batchExportToiletJobRecords(params, config) { + return request({ + url: '/sanitation/toilet/exportJobRecord', + method: 'get', + timeout: 120000, + params, + ...config, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} diff --git a/src/api/system/alarm.js b/src/api/system/alarm.js new file mode 100644 index 0000000..1c3a7ab --- /dev/null +++ b/src/api/system/alarm.js @@ -0,0 +1,62 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' + +// 获取当前报警列表 +export function getAlarmNowList(params) { + return request({ + url: '/alarm/listNowPage', + method: 'get', + params + }) +} + +// 获取当前报警列表 +export function getAlarmHistoryList(params) { + return request({ + url: '/alarm/listHisPage', + method: 'get', + params + }) +} + + +// 批量消警 +export function clearAll(params) { + return request({ + url: '/alarm/allClear', + method: 'get', + params + }) +} + +// 消警 +export function clearAlarm(params) { + return request({ + url: '/alarm/cancel', + method: 'get', + params + }) +} + +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 设置报警阈值 +export function setThresh(params) { + return request({ + url: '/alarm/resetAlarmRule', + method: 'post', + params + }) +} diff --git a/src/api/system/bridge.js b/src/api/system/bridge.js new file mode 100644 index 0000000..e8a4108 --- /dev/null +++ b/src/api/system/bridge.js @@ -0,0 +1,80 @@ +/** + * 桥梁管理接口 + */ +import request from '@/utils/request' + +// 获取桥梁详情 +export function getDetail(id) { + return request({ + url: '/bridge/detail', + method: 'get', + params: { + id: id + } + }) +} + +export function updateBridge(params) { + return request({ + url: '/bridge/update', + method: 'post', + params + }) +} +// 批量导出 +export function exportRecords(params) { + return request({ + url: 'device/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +export function getContentList(params) { + return request({ + url: 'maintain/contentByType', + method: 'get', + params: { + type: params + } + }) +} +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 编辑 +export function editRecord(params) { + return request({ + url: 'maintain/update', + method: 'post', + params + }) +} +// 新增 +export function addRecord(params) { + return request({ + url: 'maintain/add', + method: 'post', + params + }) +} +// 删除 +export function delRecord(id) { + return request({ + url: 'maintain/delete', + method: 'post', + params: { + id: id + } + }) +} diff --git a/src/api/system/data.js b/src/api/system/data.js new file mode 100644 index 0000000..4c95db5 --- /dev/null +++ b/src/api/system/data.js @@ -0,0 +1,63 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' + +// 获取当前报警列表 +export function getHistoryList(params) { + return request({ + url: '/data/hisListPage', + method: 'get', + params + }) +} + +// 获取当前报警列表 +export function getHistory(params) { + return request({ + url: '/data/hisList', + method: 'get', + params + }) +} + + + +// 批量消警 +export function clearAll(params) { + return request({ + url: '/alarm/allClear', + method: 'get', + params + }) +} + +// 消警 +export function clearAlarm(params) { + return request({ + url: '/alarm/cancel', + method: 'get', + params + }) +} + +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 设置报警阈值 +export function setThresh(params) { + return request({ + url: '/alarm/resetAlarmRule', + method: 'post', + params + }) +} diff --git a/src/api/system/order.js b/src/api/system/order.js new file mode 100644 index 0000000..7007c50 --- /dev/null +++ b/src/api/system/order.js @@ -0,0 +1,71 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +// import qs from 'qs' + +// 获取当前报警列表 +export function getRecordList(params) { + return request({ + url: '/maintain/listPage', + method: 'get', + params + }) +} +// 批量导出 +export function exportRecords(params) { + return request({ + url: 'device/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +export function getContentList(params) { + return request({ + url: 'maintain/contentByType', + method: 'get', + params: { + type: params + } + }) +} +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 编辑 +export function editRecord(params) { + return request({ + url: 'maintain/update', + method: 'post', + params + }) +} +// 新增 +export function addRecord(params) { + return request({ + url: 'maintain/add', + method: 'post', + params + }) +} +// 删除 +export function delRecord(id) { + return request({ + url: 'maintain/delete', + method: 'post', + params: { + bridgeMaintenanceId: id + } + }) +} diff --git a/src/api/system/overview.js b/src/api/system/overview.js new file mode 100644 index 0000000..bca50cc --- /dev/null +++ b/src/api/system/overview.js @@ -0,0 +1,109 @@ +import request from '@/utils/request' +import qs from "qs" +import Vue from 'vue' + +// 路灯状态统计 +export function getLampStatus() { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampStatus', + method: 'get' + }) +} + +// 路灯总览列表 +export function getLampList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampList', + method: 'get', + params + }) +} + +// 路灯详情 +export function getlampDetail(lampId) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampDetail', + method: 'get', + params: { + lampId: lampId + } + }) +} + +// 回路列表 +export function getCircuitList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/circuitList', + method: 'get', + params + }) +} + +// 灯箱列表 +export function getLampBoxList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampBoxList', + method: 'get', + params + }) +} +// 灯箱详情 +export function getLampBoxDetail(lampBoxId) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampBoxDetail', + method: 'get', + params: { + lampBoxId: lampBoxId + } + }) +} + +// 报警总览列表 +export function getAlarmList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/alarmList', + method: 'get', + params + }) +} + +// 报警详情 +export function getAlarmDetail(alarmId) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/alarmDetail', + method: 'get', + params: { + alarmId: alarmId + } + }) +} + +// 路灯控制 +export function lampControl(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampControl', + method: 'post', + params, + paramsSerializer: params => { + return qs.stringify(params, { indices: false }) + } + }) +} diff --git a/src/api/system/rule.js b/src/api/system/rule.js new file mode 100644 index 0000000..76c6b2d --- /dev/null +++ b/src/api/system/rule.js @@ -0,0 +1,59 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +// import qs from 'qs' + +// 获取当前报警列表 +export function getRuleList() { + return request({ + url: 'rule/listPage', + method: 'get' + }) +} +export function getContentList(params) { + return request({ + url: 'maintain/contentByType', + method: 'get', + params: { + type: params + } + }) +} +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 编辑 +export function editRecord(params) { + return request({ + url: 'maintain/update', + method: 'post', + params + }) +} +// 新增 +export function addRecord(params) { + return request({ + url: 'maintain/add', + method: 'post', + params + }) +} +// 删除 +export function delRecord(id) { + return request({ + url: 'maintain/delete', + method: 'post', + params: { + id: id + } + }) +} diff --git a/src/api/system/statistics.js b/src/api/system/statistics.js new file mode 100644 index 0000000..b25efe9 --- /dev/null +++ b/src/api/system/statistics.js @@ -0,0 +1,23 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +// import qs from 'qs' + +// +export function countByToilet(params) { + return request({ + url: '/sanitation/toiletStatistic/jobStaticByToilet', + method: 'get', + params + }) +} + +export function countByDay(params) { + return request({ + url: '/sanitation/toiletStatistic/jobStaticByDate', + method: 'get', + params + }) +} + diff --git a/src/assets/global_images/icon-position.png b/src/assets/global_images/icon-position.png new file mode 100644 index 0000000..7444038 --- /dev/null +++ b/src/assets/global_images/icon-position.png Binary files differ diff --git a/src/assets/global_images/location_green.png b/src/assets/global_images/location_green.png new file mode 100644 index 0000000..aa8be65 --- /dev/null +++ b/src/assets/global_images/location_green.png Binary files differ diff --git a/src/assets/global_images/location_red.png b/src/assets/global_images/location_red.png new file mode 100644 index 0000000..2be8c3d --- /dev/null +++ b/src/assets/global_images/location_red.png Binary files differ diff --git a/src/assets/global_images/location_yellow.png b/src/assets/global_images/location_yellow.png new file mode 100644 index 0000000..5ab6f4d --- /dev/null +++ b/src/assets/global_images/location_yellow.png Binary files differ diff --git a/src/assets/global_images/toilet-position.png b/src/assets/global_images/toilet-position.png new file mode 100644 index 0000000..7db6d9a --- /dev/null +++ b/src/assets/global_images/toilet-position.png Binary files differ diff --git a/src/assets/global_images/toilet.png b/src/assets/global_images/toilet.png new file mode 100644 index 0000000..6d9fc05 --- /dev/null +++ b/src/assets/global_images/toilet.png Binary files differ diff --git a/src/assets/global_images/toiletPhoto.png b/src/assets/global_images/toiletPhoto.png new file mode 100644 index 0000000..15d08e2 --- /dev/null +++ b/src/assets/global_images/toiletPhoto.png Binary files differ diff --git a/src/components/DownloadTemplate/index.vue b/src/components/DownloadTemplate/index.vue index 8ded2cd..7807cac 100644 --- a/src/components/DownloadTemplate/index.vue +++ b/src/components/DownloadTemplate/index.vue @@ -47,8 +47,8 @@ diff --git a/src/components/NormalTable/index.vue b/src/components/NormalTable/index.vue index 5077bef..04d322d 100644 --- a/src/components/NormalTable/index.vue +++ b/src/components/NormalTable/index.vue @@ -79,7 +79,7 @@
-
+
Object.assign(obj, { [key]: this[key] }), {}), + on: events.reduce((obj, key) => Object.assign(obj, { [key]: this.transmitEvent }), {}) + }) + } + this.props = [...extraProps, ...props.filter(prop => exceptProps.indexOf(prop))] + } +} + +export default prop => new Mixin(prop) diff --git a/src/components/mapWindow/base/mixins/common.js b/src/components/mapWindow/base/mixins/common.js new file mode 100644 index 0000000..2fd1a28 --- /dev/null +++ b/src/components/mapWindow/base/mixins/common.js @@ -0,0 +1,82 @@ +const types = { + map: { + unload: 'clearMap' + }, + control: { + unload: 'removeControl' + }, + layer: { + unload: 'removeLayer' + }, + features: { + unload: 'removeFeatures' + }, + listener: { + unload: 'removeListener' + } +} + +const getParent = $component => ($component.abstract || $component.$el === $component.$children[0].$el) ? getParent($component.$parent) : $component + +function destroyInstance () { + const { unload, renderByParent, $parent } = this + if (renderByParent) { + $parent.reload() + } + unload() +} + +class Mixin { + constructor (prop) { + this.methods = { + ready () { + const $parent = getParent(this.$parent) + const map = this.map = $parent.map + this.load() + this.$emit('ready', { + map + }) + }, + transmitEvent (e) { + this.$emit(e.type.replace(/^on/, ''), e) + }, + reload () { + this && this.$nextTick(() => { + this.unload() + this.$nextTick(this.load) + }) + }, + unload () { + const { map, originInstance } = this + try { + switch (prop.type) { + case 'search': + return originInstance.clearResults() + case 'autoComplete': + case 'lushu': + return originInstance.dispose() + case 'markerClusterer': + return originInstance.clearMarkers() + default: + map[types[prop.type].unload](originInstance) + } + } catch (e) {} + } + } + this.computed = { + renderByParent () { + return this.$parent.preventChildrenRender + } + } + this.mounted = function () { + console.log('common mounted') + const $parent = getParent(this.$parent) + const map = $parent.map + const { ready } = this + console.log(map) + map ? ready() : $parent.$on('onload', ready) + } + } +} + +export default type => new Mixin({ type }) diff --git a/src/components/mapWindow/leafletMap.vue b/src/components/mapWindow/leafletMap.vue new file mode 100644 index 0000000..b753cc0 --- /dev/null +++ b/src/components/mapWindow/leafletMap.vue @@ -0,0 +1,143 @@ + + + + + + + diff --git a/src/components/mapWindow/mapWindow.vue b/src/components/mapWindow/mapWindow.vue new file mode 100644 index 0000000..9ced291 --- /dev/null +++ b/src/components/mapWindow/mapWindow.vue @@ -0,0 +1,46 @@ + + + + + + diff --git a/src/icons/svg/bridge.svg b/src/icons/svg/bridge.svg new file mode 100644 index 0000000..1a0336f --- /dev/null +++ b/src/icons/svg/bridge.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/icons/svg/toilet.svg b/src/icons/svg/toilet.svg new file mode 100644 index 0000000..9d8e765 --- /dev/null +++ b/src/icons/svg/toilet.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/main.js b/src/main.js index f2d105d..3e4074e 100644 --- a/src/main.js +++ b/src/main.js @@ -18,6 +18,9 @@ // echart // import echarts from 'echarts' // Vue.prototype.$echarts = echarts +// 引入v-charts +import VCharts from 'v-charts' +Vue.use(VCharts) // 将自动注册所有组件为全局组件 // import dataV from '@jiaminghi/data-view' @@ -35,9 +38,19 @@ Vue.component('search-item', SearchItem) // 加载leaflet的css +// import 'leaflet/dist/leaflet.css' +// import 'leaflet-draw/dist/leaflet.draw.css' +import L from 'leaflet' import 'leaflet/dist/leaflet.css' -import 'leaflet-draw/dist/leaflet.draw.css' +Vue.config.productionTip = false +Vue.L = Vue.prototype.$L = L +delete L.Icon.Default.prototype._getIconUrl +L.Icon.Default.mergeOptions({ + iconRetinaUrl: require('leaflet/dist/images/marker-icon-2x.png'), + iconUrl: require('leaflet/dist/images/marker-icon.png'), + shadowUrl: require('leaflet/dist/images/marker-shadow.png') +}) /** * This project originally used easy-mock to simulate data, * but its official service is very unstable, diff --git a/src/permission.js b/src/permission.js index dc6b2f8..809ca86 100644 --- a/src/permission.js +++ b/src/permission.js @@ -25,8 +25,8 @@ store.dispatch('GetInfo').then(res => { // 拉取用户信息 // 设置当前子系统为基础资源子系统 const currentSys = { - code: 'baseResourse', - name: '基础资源子系统' + code: 'toliet', + name: '公共厕所管理系统' } // 将当前系统信息保存在localStorage中 store.commit('SET_SYSTEM', currentSys) diff --git a/src/router/index.js b/src/router/index.js index 39c295c..d23076d 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -8,8 +8,11 @@ /* Layout */ import Layout from '@/layout/Layout' +import { toiletRouters } from './modules/toilet' +import { workRouters } from './modules/work' +import { statisticsRouters } from './modules/statistics' +import { ruleRouters } from './modules/rule' import { systemRouters } from './modules/system' -import { exampleRouters } from './modules/example' /** * hidden: true if `hidden:true` will not show in the sidebar(default is false) @@ -40,11 +43,12 @@ ] }, // 登录页面 - { path: '/login', component: () => import('@/views/login/index'), hidden: true }, + { path: '/login', component: () => import('@/views/login/index_2'), hidden: true }, // 404错误页面 { path: '/404', component: () => import('@/views/errorPage/404'), hidden: true }, // 401 错误页面 - { path: '/401', component: () => import('@/views/errorPage/401'), hidden: true } + { path: '/401', component: () => import('@/views/errorPage/401'), hidden: true }, + { path: '/', redirect: '/toiletList', hidden: true } ] // 实例化vue的时候直挂载constantRouter export default new Router({ @@ -56,7 +60,10 @@ // 异步挂载路由 // 动态需要根据权限加载的路由表 export const asyncRouterMap = [ - ...exampleRouters, - ...systemRouters, + ...toiletRouters, + ...workRouters, + ...statisticsRouters, + ...ruleRouters, + // ...systemRouters, { path: '*', redirect: '/404', hidden: true } ] diff --git a/src/router/modules/rule.js b/src/router/modules/rule.js new file mode 100644 index 0000000..51e0283 --- /dev/null +++ b/src/router/modules/rule.js @@ -0,0 +1,24 @@ +/* Layout */ +import Layout from '@/layout/Layout' + +export const ruleRouters = [ + { + path: 'rule', + component: Layout, + redirect: '/rule', + name: 'Rule', + meta: { + title: '规章制度', + icon: 'icon-config', // 图标 + permission: ['/rule']// 权限名称 + }, + children: [ + { + path: '/rule', + name: 'Rule', + component: () => import('@/views/rule/listRule'), + meta: { title: '规章制度', icon: 'function', permission: ['/rule'] } + } + ] + } +] diff --git a/src/router/modules/statistics.js b/src/router/modules/statistics.js new file mode 100644 index 0000000..fb9cbea --- /dev/null +++ b/src/router/modules/statistics.js @@ -0,0 +1,30 @@ +/* Layout */ +import Layout from '@/layout/Layout' + +export const statisticsRouters = [ + { + path: 'statisticsToilet', + component: Layout, + redirect: '/workStatistics', + name: 'StatisticsToilet', + meta: { + title: '作业统计', + icon: 'icon-config', // 图标 + permission: ['/statisticsToilet']// 权限名称 + }, + children: [ + { + path: '/workStatistics', + name: 'WorkStatistics', + component: () => import('@/views/statistics/toiletAssessment'), + meta: { title: '作业统计', icon: '', permission: ['/toilet/workStatistics'] } + }, + { + path: '/evaluationStatistics', + name: 'EvaluationStatistics', + component: () => import('@/views/statistics/evaluationAssessment'), + meta: { title: '评价统计', icon: '', permission: ['/toilet/evaluationStatistics'] } + } + ] + } +] diff --git a/src/router/modules/toilet.js b/src/router/modules/toilet.js new file mode 100644 index 0000000..b221a0e --- /dev/null +++ b/src/router/modules/toilet.js @@ -0,0 +1,30 @@ +/* Layout */ +import Layout from '@/layout/Layout' + +export const toiletRouters = [ + { + path: 'toiletManage', + component: Layout, + redirect: '/toiletManage', + name: 'ToiletManage', + meta: { + title: '公厕管理', + icon: 'icon-config', // 图标 + permission: ['/toiletManage']// 权限名称 + }, + children: [ + { + path: '/toiletList', + name: 'ToiletList', + component: () => import('@/views/toiletManage/toiletList'), + meta: { title: '公厕台帐管理', icon: 'function', permission: ['/toiletList'] } + }, + { + path: '/toiletMap', + name: 'ToiletMap', + component: () => import('@/views/overview/overview'), + meta: { title: '地图总览', icon: 'function', permission: ['/toiletMap'] } + } + ] + } +] diff --git a/src/router/modules/work.js b/src/router/modules/work.js new file mode 100644 index 0000000..5e0759f --- /dev/null +++ b/src/router/modules/work.js @@ -0,0 +1,24 @@ +/* Layout */ +import Layout from '@/layout/Layout' + +export const workRouters = [ + { + path: 'toiletWork', + component: Layout, + redirect: '/toiletManage', + name: 'toiletWork', + meta: { + title: '作业管理', + icon: 'icon-config', // 图标 + permission: ['/toiletWork']// 权限名称 + }, + children: [ + { + path: '/toiletWork', + name: 'ToiletWork', + component: () => import('@/views/toiletClean/toiletCleanList'), + meta: { title: '作业管理', icon: 'function', permission: ['/toiletWork'] } + } + ] + } +] diff --git a/src/settings.js b/src/settings.js index b568ce0..b8159bf 100644 --- a/src/settings.js +++ b/src/settings.js @@ -3,7 +3,7 @@ * @type {boolean} true | false * @description 是否显示设置按钮 */ - showSettings: true, + showSettings: false, /** * @type {boolean} true | false diff --git a/src/store/modules/permission.js b/src/store/modules/permission.js index a0cb8cf..3ab50d5 100644 --- a/src/store/modules/permission.js +++ b/src/store/modules/permission.js @@ -120,17 +120,23 @@ }) }, // 获取用户权限 - GetMenus({ commit, state }) { - console.log('in store.permission.js:GetMenus:') + GetMenus({ commit, state }, currentSystem) { + // console.log('in store.permission.js:GetMenus:') + console.log('获取' + currentSystem.name + '的菜单') + const params = { + parentCode: currentSystem.code // 传入该子系统的code,获取子系统的权限 + } return new Promise((resolve, reject) => { - getMenus(state.token).then(response => { // 处理返回值 + // 此处获取用户所有权限 + getMenus(params).then(response => { // 处理返回值 const data = response.data const menus = [] // 仅菜单 const btns = [] // 非菜单 if (data.menus && data.menus.length > 0) { - commit('SET_MENUS', data.menus) - for (const menu of data.menus) { // 遍历菜单,获取所有的权限项 - if (menu.ismenu === '1') { // 将是菜单的放入menus + const allmenus = [...data.menus] + commit('SET_MENUS', allmenus) + for (const menu of allmenus) { // 遍历菜单,获取所有的权限项 + if (menu.resourceType === '02' || menu.resourceType === '03') { // 将是菜单的放入menus const menu_tmp = {} menu_tmp.url = menu.url menu_tmp.icon = menu.icon @@ -142,11 +148,11 @@ btn_tmp.name = menu.name btn_tmp.icon = menu.icon btns.push(btn_tmp) - // console.log(menu.url) } } // 过滤路由表 - const accessedRouters = filterAsyncRouter(asyncRouterMap, menus) + let accessedRouters = filterAsyncRouter(asyncRouterMap, menus) + // accessedRouters = filterRedirect(accessedRouters) commit('SET_BTNS', btns) commit('SET_ROUTERS', accessedRouters) resolve(response) diff --git a/src/utils/baseConfig.js b/src/utils/baseConfig.js index 1f4fa38..999593e 100644 --- a/src/utils/baseConfig.js +++ b/src/utils/baseConfig.js @@ -1,5 +1,5 @@ const project = { - title: '后台管理系统前端基础框架' + title: '路桥养护子系统' } export function getProject() { return project diff --git a/src/utils/dateutils.js b/src/utils/dateutils.js index 868111a..5cd16af 100644 --- a/src/utils/dateutils.js +++ b/src/utils/dateutils.js @@ -15,15 +15,15 @@ return ct_month } -export function getLastWeek() { // 默认显示上周 +export function getLastWeek(fmt) { // 默认显示上周 const ct_month = new Date() ct_month.setTime(ct_month.getTime() - 3600 * 1000 * 24 * 7) - return ct_month + return ct_month.Format(fmt) } -export function getLastMonth() { // 默认显示上个月 +export function getLastMonth(fmt) { // 默认显示上个月 const ct_month = new Date() ct_month.setTime(ct_month.getTime() - 3600 * 1000 * 24 * 30) - return ct_month + return ct_month.Format(fmt) } // 对Date的扩展,将 Date 转化为指定格式的String diff --git a/src/utils/exportutils.js b/src/utils/exportutils.js new file mode 100644 index 0000000..b5d0bcf --- /dev/null +++ b/src/utils/exportutils.js @@ -0,0 +1,19 @@ +/** + * 导出文件工具 + * @param blob 文件 + * @param fileName 导出文件名 + */ +export function exportFile(blob, fileName) { + if (window.navigator && window.navigator.msSaveOrOpenBlob) { + navigator.msSaveBlob(blob, fileName) + } else { + const downloadElement = document.createElement('a') + const href = window.URL.createObjectURL(blob) // 创建下载的链接 + downloadElement.href = href + downloadElement.download = fileName + document.body.appendChild(downloadElement) + downloadElement.click() // 点击下载 + document.body.removeChild(downloadElement) // 下载完成移除元素 + window.URL.revokeObjectURL(href) // 释放blob对象 + } +} diff --git a/src/utils/request.js b/src/utils/request.js index c88ea76..dc56e26 100644 --- a/src/utils/request.js +++ b/src/utils/request.js @@ -17,6 +17,13 @@ config.headers['token'] = getToken() // 让每个请求携带自定义token 请根据实际情况自行修改 console.log(config.headers['token']) } + // 在接口增加时间戳 + // if (config.method === 'get') { + config.params = { + _t: Date.parse(new Date()) / 1000, + ...config.params + } + // } return config }, error => { diff --git a/src/views/mapViews/choosePointDialog.vue b/src/views/mapViews/choosePointDialog.vue new file mode 100644 index 0000000..c9dde8a --- /dev/null +++ b/src/views/mapViews/choosePointDialog.vue @@ -0,0 +1,105 @@ + + + + + diff --git a/src/views/mapViews/mapView.vue b/src/views/mapViews/mapView.vue new file mode 100644 index 0000000..a18db88 --- /dev/null +++ b/src/views/mapViews/mapView.vue @@ -0,0 +1,73 @@ + + + + + diff --git a/src/views/order/editOrder.vue b/src/views/order/editOrder.vue new file mode 100644 index 0000000..4a5fd8a --- /dev/null +++ b/src/views/order/editOrder.vue @@ -0,0 +1,319 @@ + + + + + diff --git a/config/index.js b/config/index.js index 8abd37a..19b33b1 100644 --- a/config/index.js +++ b/config/index.js @@ -69,7 +69,7 @@ * then assetsPublicPath should be set to "/bar/". * In most cases please use '/' !!! */ - assetsPublicPath: '/', + assetsPublicPath: '/toilet/', /** * Source Maps diff --git a/package.json b/package.json index 45f055f..9f3a3eb 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "echarts": "^4.2.1", "element-ui": "2.13.0", "event-source-polyfill": "^1.0.5", + "file-saver": "^2.0.5", "js-cookie": "2.2.0", "jsencrypt": "^3.0.0-rc.1", "leaflet": "^1.7.1", @@ -33,7 +34,9 @@ "vue-amap": "^0.5.9", "vue-baidu-map": "^0.21.22", "vue-router": "3.0.1", - "vuex": "3.0.1" + "vue2-leaflet": "^2.7.0", + "vuex": "3.0.1", + "xlsx": "^0.17.0" }, "devDependencies": { "autoprefixer": "8.5.0", diff --git a/src/api/common.js b/src/api/common.js index 87c582b..7804714 100644 --- a/src/api/common.js +++ b/src/api/common.js @@ -2,10 +2,14 @@ * 常用接口 */ import request from '@/utils/request' +import Vue from 'vue' + // 模板下载 export function downloadTemplate(fileName) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath return request({ - url: 'template/download', + url: lampPath + 'template/download', method: 'get', params: { filename: fileName @@ -19,7 +23,7 @@ const param = new FormData() param.append('file', fileobj.file) return request({ - url: 'imageUpload', + url: 'fileUpload', method: 'post', headers: { 'Content-Type': 'multipart/form-data' }, data: param diff --git a/src/api/sanitation/statistics.js b/src/api/sanitation/statistics.js new file mode 100644 index 0000000..ffeac18 --- /dev/null +++ b/src/api/sanitation/statistics.js @@ -0,0 +1,22 @@ + +/** + * 考核统计接口 + */ +import request from '@/utils/request' +// 公厕保洁次数统计 +export function getToiletJobCount(params) { + return request({ + url: '/sanitation/statistic/toilet/jobCount', + method: 'get', + params + }) +} + +// 公厕评分统计 +export function getToiletEvaluation(params) { + return request({ + url: '/sanitation/toiletEvaluation/statistics', + method: 'get', + params + }) +} diff --git a/src/api/sanitation/toilet.js b/src/api/sanitation/toilet.js new file mode 100644 index 0000000..11affd4 --- /dev/null +++ b/src/api/sanitation/toilet.js @@ -0,0 +1,133 @@ +/** + * 公厕管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' +// 公厕查询 +export function getToiletListPage(params) { + return request({ + url: '/sanitation/toilet/listPage', + method: 'get', + params + }) +} +// 公厕查询 +export function getToiletList(pid) { + return request({ + url: '/sanitation/toilet/list', + method: 'get', + params: { + pid: pid + } + }) +} + +// 添加公厕 +export function addToilet(params) { + return request({ + url: '/sanitation/toilet/add', + method: 'post', + params + }) +} +// 修改公厕机构 +export function updateToilet(params) { + return request({ + url: '/sanitation/toilet/update', + method: 'post', + params + }) +} +// 删除公厕机构 +export function delToilet(ids) { + return request({ + url: '/sanitation/toilet/delete', + method: 'post', + params: { + ids + }, + paramsSerializer: params => { + return qs.stringify(params, { indices: false }) + } + }) +} + +// 公厕基本信息详情 +export function getToiletInfoDetail(id) { + return request({ + url: '/sanitation/toilet/detail?toiletId=' + id, + method: 'get' + }) +} + +// 某公厕保洁记录 +export function getRecordsByToilet(params) { + return request({ + url: '/sanitation/toilet/jobRecord/detail', + method: 'get', + params + }) +} + +// 某公厕平均评分 +export function getScoreByToilet(params) { + return request({ + url: '/sanitation/toiletEvaluation/detailScore', + method: 'get', + params + }) +} + +// 某公厕评分列表 +export function getScoreListByToilet(params) { + return request({ + url: '/sanitation/toiletEvaluation/list', + method: 'get', + params + }) +} + + +// 批量导入 +export function batchImportToilet(fileobj) { + const param = new FormData() + param.append('file', fileobj) + return request({ + url: '/sanitation/toilet/import', + method: 'post', + headers: { 'Content-Type': 'multipart/form-data' }, + data: param + }) +} +// 批量导出 +export function batchExportToilet(params, config) { + return request({ + url: '/sanitation/toilet/export', + method: 'get', + timeout: 120000, + params, + ...config, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 公厕保洁记录查询 +export function getToiletJobRecords(params) { + return request({ + url: '/sanitation/toilet/jobRecord', + method: 'get', + params + }) +} + +// 批量导出 +export function batchExportToiletJobRecords(params, config) { + return request({ + url: '/sanitation/toilet/exportJobRecord', + method: 'get', + timeout: 120000, + params, + ...config, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} diff --git a/src/api/system/alarm.js b/src/api/system/alarm.js new file mode 100644 index 0000000..1c3a7ab --- /dev/null +++ b/src/api/system/alarm.js @@ -0,0 +1,62 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' + +// 获取当前报警列表 +export function getAlarmNowList(params) { + return request({ + url: '/alarm/listNowPage', + method: 'get', + params + }) +} + +// 获取当前报警列表 +export function getAlarmHistoryList(params) { + return request({ + url: '/alarm/listHisPage', + method: 'get', + params + }) +} + + +// 批量消警 +export function clearAll(params) { + return request({ + url: '/alarm/allClear', + method: 'get', + params + }) +} + +// 消警 +export function clearAlarm(params) { + return request({ + url: '/alarm/cancel', + method: 'get', + params + }) +} + +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 设置报警阈值 +export function setThresh(params) { + return request({ + url: '/alarm/resetAlarmRule', + method: 'post', + params + }) +} diff --git a/src/api/system/bridge.js b/src/api/system/bridge.js new file mode 100644 index 0000000..e8a4108 --- /dev/null +++ b/src/api/system/bridge.js @@ -0,0 +1,80 @@ +/** + * 桥梁管理接口 + */ +import request from '@/utils/request' + +// 获取桥梁详情 +export function getDetail(id) { + return request({ + url: '/bridge/detail', + method: 'get', + params: { + id: id + } + }) +} + +export function updateBridge(params) { + return request({ + url: '/bridge/update', + method: 'post', + params + }) +} +// 批量导出 +export function exportRecords(params) { + return request({ + url: 'device/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +export function getContentList(params) { + return request({ + url: 'maintain/contentByType', + method: 'get', + params: { + type: params + } + }) +} +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 编辑 +export function editRecord(params) { + return request({ + url: 'maintain/update', + method: 'post', + params + }) +} +// 新增 +export function addRecord(params) { + return request({ + url: 'maintain/add', + method: 'post', + params + }) +} +// 删除 +export function delRecord(id) { + return request({ + url: 'maintain/delete', + method: 'post', + params: { + id: id + } + }) +} diff --git a/src/api/system/data.js b/src/api/system/data.js new file mode 100644 index 0000000..4c95db5 --- /dev/null +++ b/src/api/system/data.js @@ -0,0 +1,63 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' + +// 获取当前报警列表 +export function getHistoryList(params) { + return request({ + url: '/data/hisListPage', + method: 'get', + params + }) +} + +// 获取当前报警列表 +export function getHistory(params) { + return request({ + url: '/data/hisList', + method: 'get', + params + }) +} + + + +// 批量消警 +export function clearAll(params) { + return request({ + url: '/alarm/allClear', + method: 'get', + params + }) +} + +// 消警 +export function clearAlarm(params) { + return request({ + url: '/alarm/cancel', + method: 'get', + params + }) +} + +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 设置报警阈值 +export function setThresh(params) { + return request({ + url: '/alarm/resetAlarmRule', + method: 'post', + params + }) +} diff --git a/src/api/system/order.js b/src/api/system/order.js new file mode 100644 index 0000000..7007c50 --- /dev/null +++ b/src/api/system/order.js @@ -0,0 +1,71 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +// import qs from 'qs' + +// 获取当前报警列表 +export function getRecordList(params) { + return request({ + url: '/maintain/listPage', + method: 'get', + params + }) +} +// 批量导出 +export function exportRecords(params) { + return request({ + url: 'device/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +export function getContentList(params) { + return request({ + url: 'maintain/contentByType', + method: 'get', + params: { + type: params + } + }) +} +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 编辑 +export function editRecord(params) { + return request({ + url: 'maintain/update', + method: 'post', + params + }) +} +// 新增 +export function addRecord(params) { + return request({ + url: 'maintain/add', + method: 'post', + params + }) +} +// 删除 +export function delRecord(id) { + return request({ + url: 'maintain/delete', + method: 'post', + params: { + bridgeMaintenanceId: id + } + }) +} diff --git a/src/api/system/overview.js b/src/api/system/overview.js new file mode 100644 index 0000000..bca50cc --- /dev/null +++ b/src/api/system/overview.js @@ -0,0 +1,109 @@ +import request from '@/utils/request' +import qs from "qs" +import Vue from 'vue' + +// 路灯状态统计 +export function getLampStatus() { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampStatus', + method: 'get' + }) +} + +// 路灯总览列表 +export function getLampList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampList', + method: 'get', + params + }) +} + +// 路灯详情 +export function getlampDetail(lampId) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampDetail', + method: 'get', + params: { + lampId: lampId + } + }) +} + +// 回路列表 +export function getCircuitList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/circuitList', + method: 'get', + params + }) +} + +// 灯箱列表 +export function getLampBoxList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampBoxList', + method: 'get', + params + }) +} +// 灯箱详情 +export function getLampBoxDetail(lampBoxId) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampBoxDetail', + method: 'get', + params: { + lampBoxId: lampBoxId + } + }) +} + +// 报警总览列表 +export function getAlarmList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/alarmList', + method: 'get', + params + }) +} + +// 报警详情 +export function getAlarmDetail(alarmId) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/alarmDetail', + method: 'get', + params: { + alarmId: alarmId + } + }) +} + +// 路灯控制 +export function lampControl(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampControl', + method: 'post', + params, + paramsSerializer: params => { + return qs.stringify(params, { indices: false }) + } + }) +} diff --git a/src/api/system/rule.js b/src/api/system/rule.js new file mode 100644 index 0000000..76c6b2d --- /dev/null +++ b/src/api/system/rule.js @@ -0,0 +1,59 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +// import qs from 'qs' + +// 获取当前报警列表 +export function getRuleList() { + return request({ + url: 'rule/listPage', + method: 'get' + }) +} +export function getContentList(params) { + return request({ + url: 'maintain/contentByType', + method: 'get', + params: { + type: params + } + }) +} +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 编辑 +export function editRecord(params) { + return request({ + url: 'maintain/update', + method: 'post', + params + }) +} +// 新增 +export function addRecord(params) { + return request({ + url: 'maintain/add', + method: 'post', + params + }) +} +// 删除 +export function delRecord(id) { + return request({ + url: 'maintain/delete', + method: 'post', + params: { + id: id + } + }) +} diff --git a/src/api/system/statistics.js b/src/api/system/statistics.js new file mode 100644 index 0000000..b25efe9 --- /dev/null +++ b/src/api/system/statistics.js @@ -0,0 +1,23 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +// import qs from 'qs' + +// +export function countByToilet(params) { + return request({ + url: '/sanitation/toiletStatistic/jobStaticByToilet', + method: 'get', + params + }) +} + +export function countByDay(params) { + return request({ + url: '/sanitation/toiletStatistic/jobStaticByDate', + method: 'get', + params + }) +} + diff --git a/src/assets/global_images/icon-position.png b/src/assets/global_images/icon-position.png new file mode 100644 index 0000000..7444038 --- /dev/null +++ b/src/assets/global_images/icon-position.png Binary files differ diff --git a/src/assets/global_images/location_green.png b/src/assets/global_images/location_green.png new file mode 100644 index 0000000..aa8be65 --- /dev/null +++ b/src/assets/global_images/location_green.png Binary files differ diff --git a/src/assets/global_images/location_red.png b/src/assets/global_images/location_red.png new file mode 100644 index 0000000..2be8c3d --- /dev/null +++ b/src/assets/global_images/location_red.png Binary files differ diff --git a/src/assets/global_images/location_yellow.png b/src/assets/global_images/location_yellow.png new file mode 100644 index 0000000..5ab6f4d --- /dev/null +++ b/src/assets/global_images/location_yellow.png Binary files differ diff --git a/src/assets/global_images/toilet-position.png b/src/assets/global_images/toilet-position.png new file mode 100644 index 0000000..7db6d9a --- /dev/null +++ b/src/assets/global_images/toilet-position.png Binary files differ diff --git a/src/assets/global_images/toilet.png b/src/assets/global_images/toilet.png new file mode 100644 index 0000000..6d9fc05 --- /dev/null +++ b/src/assets/global_images/toilet.png Binary files differ diff --git a/src/assets/global_images/toiletPhoto.png b/src/assets/global_images/toiletPhoto.png new file mode 100644 index 0000000..15d08e2 --- /dev/null +++ b/src/assets/global_images/toiletPhoto.png Binary files differ diff --git a/src/components/DownloadTemplate/index.vue b/src/components/DownloadTemplate/index.vue index 8ded2cd..7807cac 100644 --- a/src/components/DownloadTemplate/index.vue +++ b/src/components/DownloadTemplate/index.vue @@ -47,8 +47,8 @@ diff --git a/src/components/NormalTable/index.vue b/src/components/NormalTable/index.vue index 5077bef..04d322d 100644 --- a/src/components/NormalTable/index.vue +++ b/src/components/NormalTable/index.vue @@ -79,7 +79,7 @@
-
+
Object.assign(obj, { [key]: this[key] }), {}), + on: events.reduce((obj, key) => Object.assign(obj, { [key]: this.transmitEvent }), {}) + }) + } + this.props = [...extraProps, ...props.filter(prop => exceptProps.indexOf(prop))] + } +} + +export default prop => new Mixin(prop) diff --git a/src/components/mapWindow/base/mixins/common.js b/src/components/mapWindow/base/mixins/common.js new file mode 100644 index 0000000..2fd1a28 --- /dev/null +++ b/src/components/mapWindow/base/mixins/common.js @@ -0,0 +1,82 @@ +const types = { + map: { + unload: 'clearMap' + }, + control: { + unload: 'removeControl' + }, + layer: { + unload: 'removeLayer' + }, + features: { + unload: 'removeFeatures' + }, + listener: { + unload: 'removeListener' + } +} + +const getParent = $component => ($component.abstract || $component.$el === $component.$children[0].$el) ? getParent($component.$parent) : $component + +function destroyInstance () { + const { unload, renderByParent, $parent } = this + if (renderByParent) { + $parent.reload() + } + unload() +} + +class Mixin { + constructor (prop) { + this.methods = { + ready () { + const $parent = getParent(this.$parent) + const map = this.map = $parent.map + this.load() + this.$emit('ready', { + map + }) + }, + transmitEvent (e) { + this.$emit(e.type.replace(/^on/, ''), e) + }, + reload () { + this && this.$nextTick(() => { + this.unload() + this.$nextTick(this.load) + }) + }, + unload () { + const { map, originInstance } = this + try { + switch (prop.type) { + case 'search': + return originInstance.clearResults() + case 'autoComplete': + case 'lushu': + return originInstance.dispose() + case 'markerClusterer': + return originInstance.clearMarkers() + default: + map[types[prop.type].unload](originInstance) + } + } catch (e) {} + } + } + this.computed = { + renderByParent () { + return this.$parent.preventChildrenRender + } + } + this.mounted = function () { + console.log('common mounted') + const $parent = getParent(this.$parent) + const map = $parent.map + const { ready } = this + console.log(map) + map ? ready() : $parent.$on('onload', ready) + } + } +} + +export default type => new Mixin({ type }) diff --git a/src/components/mapWindow/leafletMap.vue b/src/components/mapWindow/leafletMap.vue new file mode 100644 index 0000000..b753cc0 --- /dev/null +++ b/src/components/mapWindow/leafletMap.vue @@ -0,0 +1,143 @@ + + + + + + + diff --git a/src/components/mapWindow/mapWindow.vue b/src/components/mapWindow/mapWindow.vue new file mode 100644 index 0000000..9ced291 --- /dev/null +++ b/src/components/mapWindow/mapWindow.vue @@ -0,0 +1,46 @@ + + + + + + diff --git a/src/icons/svg/bridge.svg b/src/icons/svg/bridge.svg new file mode 100644 index 0000000..1a0336f --- /dev/null +++ b/src/icons/svg/bridge.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/icons/svg/toilet.svg b/src/icons/svg/toilet.svg new file mode 100644 index 0000000..9d8e765 --- /dev/null +++ b/src/icons/svg/toilet.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/main.js b/src/main.js index f2d105d..3e4074e 100644 --- a/src/main.js +++ b/src/main.js @@ -18,6 +18,9 @@ // echart // import echarts from 'echarts' // Vue.prototype.$echarts = echarts +// 引入v-charts +import VCharts from 'v-charts' +Vue.use(VCharts) // 将自动注册所有组件为全局组件 // import dataV from '@jiaminghi/data-view' @@ -35,9 +38,19 @@ Vue.component('search-item', SearchItem) // 加载leaflet的css +// import 'leaflet/dist/leaflet.css' +// import 'leaflet-draw/dist/leaflet.draw.css' +import L from 'leaflet' import 'leaflet/dist/leaflet.css' -import 'leaflet-draw/dist/leaflet.draw.css' +Vue.config.productionTip = false +Vue.L = Vue.prototype.$L = L +delete L.Icon.Default.prototype._getIconUrl +L.Icon.Default.mergeOptions({ + iconRetinaUrl: require('leaflet/dist/images/marker-icon-2x.png'), + iconUrl: require('leaflet/dist/images/marker-icon.png'), + shadowUrl: require('leaflet/dist/images/marker-shadow.png') +}) /** * This project originally used easy-mock to simulate data, * but its official service is very unstable, diff --git a/src/permission.js b/src/permission.js index dc6b2f8..809ca86 100644 --- a/src/permission.js +++ b/src/permission.js @@ -25,8 +25,8 @@ store.dispatch('GetInfo').then(res => { // 拉取用户信息 // 设置当前子系统为基础资源子系统 const currentSys = { - code: 'baseResourse', - name: '基础资源子系统' + code: 'toliet', + name: '公共厕所管理系统' } // 将当前系统信息保存在localStorage中 store.commit('SET_SYSTEM', currentSys) diff --git a/src/router/index.js b/src/router/index.js index 39c295c..d23076d 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -8,8 +8,11 @@ /* Layout */ import Layout from '@/layout/Layout' +import { toiletRouters } from './modules/toilet' +import { workRouters } from './modules/work' +import { statisticsRouters } from './modules/statistics' +import { ruleRouters } from './modules/rule' import { systemRouters } from './modules/system' -import { exampleRouters } from './modules/example' /** * hidden: true if `hidden:true` will not show in the sidebar(default is false) @@ -40,11 +43,12 @@ ] }, // 登录页面 - { path: '/login', component: () => import('@/views/login/index'), hidden: true }, + { path: '/login', component: () => import('@/views/login/index_2'), hidden: true }, // 404错误页面 { path: '/404', component: () => import('@/views/errorPage/404'), hidden: true }, // 401 错误页面 - { path: '/401', component: () => import('@/views/errorPage/401'), hidden: true } + { path: '/401', component: () => import('@/views/errorPage/401'), hidden: true }, + { path: '/', redirect: '/toiletList', hidden: true } ] // 实例化vue的时候直挂载constantRouter export default new Router({ @@ -56,7 +60,10 @@ // 异步挂载路由 // 动态需要根据权限加载的路由表 export const asyncRouterMap = [ - ...exampleRouters, - ...systemRouters, + ...toiletRouters, + ...workRouters, + ...statisticsRouters, + ...ruleRouters, + // ...systemRouters, { path: '*', redirect: '/404', hidden: true } ] diff --git a/src/router/modules/rule.js b/src/router/modules/rule.js new file mode 100644 index 0000000..51e0283 --- /dev/null +++ b/src/router/modules/rule.js @@ -0,0 +1,24 @@ +/* Layout */ +import Layout from '@/layout/Layout' + +export const ruleRouters = [ + { + path: 'rule', + component: Layout, + redirect: '/rule', + name: 'Rule', + meta: { + title: '规章制度', + icon: 'icon-config', // 图标 + permission: ['/rule']// 权限名称 + }, + children: [ + { + path: '/rule', + name: 'Rule', + component: () => import('@/views/rule/listRule'), + meta: { title: '规章制度', icon: 'function', permission: ['/rule'] } + } + ] + } +] diff --git a/src/router/modules/statistics.js b/src/router/modules/statistics.js new file mode 100644 index 0000000..fb9cbea --- /dev/null +++ b/src/router/modules/statistics.js @@ -0,0 +1,30 @@ +/* Layout */ +import Layout from '@/layout/Layout' + +export const statisticsRouters = [ + { + path: 'statisticsToilet', + component: Layout, + redirect: '/workStatistics', + name: 'StatisticsToilet', + meta: { + title: '作业统计', + icon: 'icon-config', // 图标 + permission: ['/statisticsToilet']// 权限名称 + }, + children: [ + { + path: '/workStatistics', + name: 'WorkStatistics', + component: () => import('@/views/statistics/toiletAssessment'), + meta: { title: '作业统计', icon: '', permission: ['/toilet/workStatistics'] } + }, + { + path: '/evaluationStatistics', + name: 'EvaluationStatistics', + component: () => import('@/views/statistics/evaluationAssessment'), + meta: { title: '评价统计', icon: '', permission: ['/toilet/evaluationStatistics'] } + } + ] + } +] diff --git a/src/router/modules/toilet.js b/src/router/modules/toilet.js new file mode 100644 index 0000000..b221a0e --- /dev/null +++ b/src/router/modules/toilet.js @@ -0,0 +1,30 @@ +/* Layout */ +import Layout from '@/layout/Layout' + +export const toiletRouters = [ + { + path: 'toiletManage', + component: Layout, + redirect: '/toiletManage', + name: 'ToiletManage', + meta: { + title: '公厕管理', + icon: 'icon-config', // 图标 + permission: ['/toiletManage']// 权限名称 + }, + children: [ + { + path: '/toiletList', + name: 'ToiletList', + component: () => import('@/views/toiletManage/toiletList'), + meta: { title: '公厕台帐管理', icon: 'function', permission: ['/toiletList'] } + }, + { + path: '/toiletMap', + name: 'ToiletMap', + component: () => import('@/views/overview/overview'), + meta: { title: '地图总览', icon: 'function', permission: ['/toiletMap'] } + } + ] + } +] diff --git a/src/router/modules/work.js b/src/router/modules/work.js new file mode 100644 index 0000000..5e0759f --- /dev/null +++ b/src/router/modules/work.js @@ -0,0 +1,24 @@ +/* Layout */ +import Layout from '@/layout/Layout' + +export const workRouters = [ + { + path: 'toiletWork', + component: Layout, + redirect: '/toiletManage', + name: 'toiletWork', + meta: { + title: '作业管理', + icon: 'icon-config', // 图标 + permission: ['/toiletWork']// 权限名称 + }, + children: [ + { + path: '/toiletWork', + name: 'ToiletWork', + component: () => import('@/views/toiletClean/toiletCleanList'), + meta: { title: '作业管理', icon: 'function', permission: ['/toiletWork'] } + } + ] + } +] diff --git a/src/settings.js b/src/settings.js index b568ce0..b8159bf 100644 --- a/src/settings.js +++ b/src/settings.js @@ -3,7 +3,7 @@ * @type {boolean} true | false * @description 是否显示设置按钮 */ - showSettings: true, + showSettings: false, /** * @type {boolean} true | false diff --git a/src/store/modules/permission.js b/src/store/modules/permission.js index a0cb8cf..3ab50d5 100644 --- a/src/store/modules/permission.js +++ b/src/store/modules/permission.js @@ -120,17 +120,23 @@ }) }, // 获取用户权限 - GetMenus({ commit, state }) { - console.log('in store.permission.js:GetMenus:') + GetMenus({ commit, state }, currentSystem) { + // console.log('in store.permission.js:GetMenus:') + console.log('获取' + currentSystem.name + '的菜单') + const params = { + parentCode: currentSystem.code // 传入该子系统的code,获取子系统的权限 + } return new Promise((resolve, reject) => { - getMenus(state.token).then(response => { // 处理返回值 + // 此处获取用户所有权限 + getMenus(params).then(response => { // 处理返回值 const data = response.data const menus = [] // 仅菜单 const btns = [] // 非菜单 if (data.menus && data.menus.length > 0) { - commit('SET_MENUS', data.menus) - for (const menu of data.menus) { // 遍历菜单,获取所有的权限项 - if (menu.ismenu === '1') { // 将是菜单的放入menus + const allmenus = [...data.menus] + commit('SET_MENUS', allmenus) + for (const menu of allmenus) { // 遍历菜单,获取所有的权限项 + if (menu.resourceType === '02' || menu.resourceType === '03') { // 将是菜单的放入menus const menu_tmp = {} menu_tmp.url = menu.url menu_tmp.icon = menu.icon @@ -142,11 +148,11 @@ btn_tmp.name = menu.name btn_tmp.icon = menu.icon btns.push(btn_tmp) - // console.log(menu.url) } } // 过滤路由表 - const accessedRouters = filterAsyncRouter(asyncRouterMap, menus) + let accessedRouters = filterAsyncRouter(asyncRouterMap, menus) + // accessedRouters = filterRedirect(accessedRouters) commit('SET_BTNS', btns) commit('SET_ROUTERS', accessedRouters) resolve(response) diff --git a/src/utils/baseConfig.js b/src/utils/baseConfig.js index 1f4fa38..999593e 100644 --- a/src/utils/baseConfig.js +++ b/src/utils/baseConfig.js @@ -1,5 +1,5 @@ const project = { - title: '后台管理系统前端基础框架' + title: '路桥养护子系统' } export function getProject() { return project diff --git a/src/utils/dateutils.js b/src/utils/dateutils.js index 868111a..5cd16af 100644 --- a/src/utils/dateutils.js +++ b/src/utils/dateutils.js @@ -15,15 +15,15 @@ return ct_month } -export function getLastWeek() { // 默认显示上周 +export function getLastWeek(fmt) { // 默认显示上周 const ct_month = new Date() ct_month.setTime(ct_month.getTime() - 3600 * 1000 * 24 * 7) - return ct_month + return ct_month.Format(fmt) } -export function getLastMonth() { // 默认显示上个月 +export function getLastMonth(fmt) { // 默认显示上个月 const ct_month = new Date() ct_month.setTime(ct_month.getTime() - 3600 * 1000 * 24 * 30) - return ct_month + return ct_month.Format(fmt) } // 对Date的扩展,将 Date 转化为指定格式的String diff --git a/src/utils/exportutils.js b/src/utils/exportutils.js new file mode 100644 index 0000000..b5d0bcf --- /dev/null +++ b/src/utils/exportutils.js @@ -0,0 +1,19 @@ +/** + * 导出文件工具 + * @param blob 文件 + * @param fileName 导出文件名 + */ +export function exportFile(blob, fileName) { + if (window.navigator && window.navigator.msSaveOrOpenBlob) { + navigator.msSaveBlob(blob, fileName) + } else { + const downloadElement = document.createElement('a') + const href = window.URL.createObjectURL(blob) // 创建下载的链接 + downloadElement.href = href + downloadElement.download = fileName + document.body.appendChild(downloadElement) + downloadElement.click() // 点击下载 + document.body.removeChild(downloadElement) // 下载完成移除元素 + window.URL.revokeObjectURL(href) // 释放blob对象 + } +} diff --git a/src/utils/request.js b/src/utils/request.js index c88ea76..dc56e26 100644 --- a/src/utils/request.js +++ b/src/utils/request.js @@ -17,6 +17,13 @@ config.headers['token'] = getToken() // 让每个请求携带自定义token 请根据实际情况自行修改 console.log(config.headers['token']) } + // 在接口增加时间戳 + // if (config.method === 'get') { + config.params = { + _t: Date.parse(new Date()) / 1000, + ...config.params + } + // } return config }, error => { diff --git a/src/views/mapViews/choosePointDialog.vue b/src/views/mapViews/choosePointDialog.vue new file mode 100644 index 0000000..c9dde8a --- /dev/null +++ b/src/views/mapViews/choosePointDialog.vue @@ -0,0 +1,105 @@ + + + + + diff --git a/src/views/mapViews/mapView.vue b/src/views/mapViews/mapView.vue new file mode 100644 index 0000000..a18db88 --- /dev/null +++ b/src/views/mapViews/mapView.vue @@ -0,0 +1,73 @@ + + + + + diff --git a/src/views/order/editOrder.vue b/src/views/order/editOrder.vue new file mode 100644 index 0000000..4a5fd8a --- /dev/null +++ b/src/views/order/editOrder.vue @@ -0,0 +1,319 @@ + + + + + diff --git a/src/views/order/listMaintainRecords.vue b/src/views/order/listMaintainRecords.vue new file mode 100644 index 0000000..2d4f682 --- /dev/null +++ b/src/views/order/listMaintainRecords.vue @@ -0,0 +1,327 @@ + + + + + diff --git a/config/index.js b/config/index.js index 8abd37a..19b33b1 100644 --- a/config/index.js +++ b/config/index.js @@ -69,7 +69,7 @@ * then assetsPublicPath should be set to "/bar/". * In most cases please use '/' !!! */ - assetsPublicPath: '/', + assetsPublicPath: '/toilet/', /** * Source Maps diff --git a/package.json b/package.json index 45f055f..9f3a3eb 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "echarts": "^4.2.1", "element-ui": "2.13.0", "event-source-polyfill": "^1.0.5", + "file-saver": "^2.0.5", "js-cookie": "2.2.0", "jsencrypt": "^3.0.0-rc.1", "leaflet": "^1.7.1", @@ -33,7 +34,9 @@ "vue-amap": "^0.5.9", "vue-baidu-map": "^0.21.22", "vue-router": "3.0.1", - "vuex": "3.0.1" + "vue2-leaflet": "^2.7.0", + "vuex": "3.0.1", + "xlsx": "^0.17.0" }, "devDependencies": { "autoprefixer": "8.5.0", diff --git a/src/api/common.js b/src/api/common.js index 87c582b..7804714 100644 --- a/src/api/common.js +++ b/src/api/common.js @@ -2,10 +2,14 @@ * 常用接口 */ import request from '@/utils/request' +import Vue from 'vue' + // 模板下载 export function downloadTemplate(fileName) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath return request({ - url: 'template/download', + url: lampPath + 'template/download', method: 'get', params: { filename: fileName @@ -19,7 +23,7 @@ const param = new FormData() param.append('file', fileobj.file) return request({ - url: 'imageUpload', + url: 'fileUpload', method: 'post', headers: { 'Content-Type': 'multipart/form-data' }, data: param diff --git a/src/api/sanitation/statistics.js b/src/api/sanitation/statistics.js new file mode 100644 index 0000000..ffeac18 --- /dev/null +++ b/src/api/sanitation/statistics.js @@ -0,0 +1,22 @@ + +/** + * 考核统计接口 + */ +import request from '@/utils/request' +// 公厕保洁次数统计 +export function getToiletJobCount(params) { + return request({ + url: '/sanitation/statistic/toilet/jobCount', + method: 'get', + params + }) +} + +// 公厕评分统计 +export function getToiletEvaluation(params) { + return request({ + url: '/sanitation/toiletEvaluation/statistics', + method: 'get', + params + }) +} diff --git a/src/api/sanitation/toilet.js b/src/api/sanitation/toilet.js new file mode 100644 index 0000000..11affd4 --- /dev/null +++ b/src/api/sanitation/toilet.js @@ -0,0 +1,133 @@ +/** + * 公厕管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' +// 公厕查询 +export function getToiletListPage(params) { + return request({ + url: '/sanitation/toilet/listPage', + method: 'get', + params + }) +} +// 公厕查询 +export function getToiletList(pid) { + return request({ + url: '/sanitation/toilet/list', + method: 'get', + params: { + pid: pid + } + }) +} + +// 添加公厕 +export function addToilet(params) { + return request({ + url: '/sanitation/toilet/add', + method: 'post', + params + }) +} +// 修改公厕机构 +export function updateToilet(params) { + return request({ + url: '/sanitation/toilet/update', + method: 'post', + params + }) +} +// 删除公厕机构 +export function delToilet(ids) { + return request({ + url: '/sanitation/toilet/delete', + method: 'post', + params: { + ids + }, + paramsSerializer: params => { + return qs.stringify(params, { indices: false }) + } + }) +} + +// 公厕基本信息详情 +export function getToiletInfoDetail(id) { + return request({ + url: '/sanitation/toilet/detail?toiletId=' + id, + method: 'get' + }) +} + +// 某公厕保洁记录 +export function getRecordsByToilet(params) { + return request({ + url: '/sanitation/toilet/jobRecord/detail', + method: 'get', + params + }) +} + +// 某公厕平均评分 +export function getScoreByToilet(params) { + return request({ + url: '/sanitation/toiletEvaluation/detailScore', + method: 'get', + params + }) +} + +// 某公厕评分列表 +export function getScoreListByToilet(params) { + return request({ + url: '/sanitation/toiletEvaluation/list', + method: 'get', + params + }) +} + + +// 批量导入 +export function batchImportToilet(fileobj) { + const param = new FormData() + param.append('file', fileobj) + return request({ + url: '/sanitation/toilet/import', + method: 'post', + headers: { 'Content-Type': 'multipart/form-data' }, + data: param + }) +} +// 批量导出 +export function batchExportToilet(params, config) { + return request({ + url: '/sanitation/toilet/export', + method: 'get', + timeout: 120000, + params, + ...config, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 公厕保洁记录查询 +export function getToiletJobRecords(params) { + return request({ + url: '/sanitation/toilet/jobRecord', + method: 'get', + params + }) +} + +// 批量导出 +export function batchExportToiletJobRecords(params, config) { + return request({ + url: '/sanitation/toilet/exportJobRecord', + method: 'get', + timeout: 120000, + params, + ...config, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} diff --git a/src/api/system/alarm.js b/src/api/system/alarm.js new file mode 100644 index 0000000..1c3a7ab --- /dev/null +++ b/src/api/system/alarm.js @@ -0,0 +1,62 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' + +// 获取当前报警列表 +export function getAlarmNowList(params) { + return request({ + url: '/alarm/listNowPage', + method: 'get', + params + }) +} + +// 获取当前报警列表 +export function getAlarmHistoryList(params) { + return request({ + url: '/alarm/listHisPage', + method: 'get', + params + }) +} + + +// 批量消警 +export function clearAll(params) { + return request({ + url: '/alarm/allClear', + method: 'get', + params + }) +} + +// 消警 +export function clearAlarm(params) { + return request({ + url: '/alarm/cancel', + method: 'get', + params + }) +} + +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 设置报警阈值 +export function setThresh(params) { + return request({ + url: '/alarm/resetAlarmRule', + method: 'post', + params + }) +} diff --git a/src/api/system/bridge.js b/src/api/system/bridge.js new file mode 100644 index 0000000..e8a4108 --- /dev/null +++ b/src/api/system/bridge.js @@ -0,0 +1,80 @@ +/** + * 桥梁管理接口 + */ +import request from '@/utils/request' + +// 获取桥梁详情 +export function getDetail(id) { + return request({ + url: '/bridge/detail', + method: 'get', + params: { + id: id + } + }) +} + +export function updateBridge(params) { + return request({ + url: '/bridge/update', + method: 'post', + params + }) +} +// 批量导出 +export function exportRecords(params) { + return request({ + url: 'device/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +export function getContentList(params) { + return request({ + url: 'maintain/contentByType', + method: 'get', + params: { + type: params + } + }) +} +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 编辑 +export function editRecord(params) { + return request({ + url: 'maintain/update', + method: 'post', + params + }) +} +// 新增 +export function addRecord(params) { + return request({ + url: 'maintain/add', + method: 'post', + params + }) +} +// 删除 +export function delRecord(id) { + return request({ + url: 'maintain/delete', + method: 'post', + params: { + id: id + } + }) +} diff --git a/src/api/system/data.js b/src/api/system/data.js new file mode 100644 index 0000000..4c95db5 --- /dev/null +++ b/src/api/system/data.js @@ -0,0 +1,63 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' + +// 获取当前报警列表 +export function getHistoryList(params) { + return request({ + url: '/data/hisListPage', + method: 'get', + params + }) +} + +// 获取当前报警列表 +export function getHistory(params) { + return request({ + url: '/data/hisList', + method: 'get', + params + }) +} + + + +// 批量消警 +export function clearAll(params) { + return request({ + url: '/alarm/allClear', + method: 'get', + params + }) +} + +// 消警 +export function clearAlarm(params) { + return request({ + url: '/alarm/cancel', + method: 'get', + params + }) +} + +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 设置报警阈值 +export function setThresh(params) { + return request({ + url: '/alarm/resetAlarmRule', + method: 'post', + params + }) +} diff --git a/src/api/system/order.js b/src/api/system/order.js new file mode 100644 index 0000000..7007c50 --- /dev/null +++ b/src/api/system/order.js @@ -0,0 +1,71 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +// import qs from 'qs' + +// 获取当前报警列表 +export function getRecordList(params) { + return request({ + url: '/maintain/listPage', + method: 'get', + params + }) +} +// 批量导出 +export function exportRecords(params) { + return request({ + url: 'device/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +export function getContentList(params) { + return request({ + url: 'maintain/contentByType', + method: 'get', + params: { + type: params + } + }) +} +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 编辑 +export function editRecord(params) { + return request({ + url: 'maintain/update', + method: 'post', + params + }) +} +// 新增 +export function addRecord(params) { + return request({ + url: 'maintain/add', + method: 'post', + params + }) +} +// 删除 +export function delRecord(id) { + return request({ + url: 'maintain/delete', + method: 'post', + params: { + bridgeMaintenanceId: id + } + }) +} diff --git a/src/api/system/overview.js b/src/api/system/overview.js new file mode 100644 index 0000000..bca50cc --- /dev/null +++ b/src/api/system/overview.js @@ -0,0 +1,109 @@ +import request from '@/utils/request' +import qs from "qs" +import Vue from 'vue' + +// 路灯状态统计 +export function getLampStatus() { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampStatus', + method: 'get' + }) +} + +// 路灯总览列表 +export function getLampList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampList', + method: 'get', + params + }) +} + +// 路灯详情 +export function getlampDetail(lampId) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampDetail', + method: 'get', + params: { + lampId: lampId + } + }) +} + +// 回路列表 +export function getCircuitList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/circuitList', + method: 'get', + params + }) +} + +// 灯箱列表 +export function getLampBoxList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampBoxList', + method: 'get', + params + }) +} +// 灯箱详情 +export function getLampBoxDetail(lampBoxId) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampBoxDetail', + method: 'get', + params: { + lampBoxId: lampBoxId + } + }) +} + +// 报警总览列表 +export function getAlarmList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/alarmList', + method: 'get', + params + }) +} + +// 报警详情 +export function getAlarmDetail(alarmId) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/alarmDetail', + method: 'get', + params: { + alarmId: alarmId + } + }) +} + +// 路灯控制 +export function lampControl(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampControl', + method: 'post', + params, + paramsSerializer: params => { + return qs.stringify(params, { indices: false }) + } + }) +} diff --git a/src/api/system/rule.js b/src/api/system/rule.js new file mode 100644 index 0000000..76c6b2d --- /dev/null +++ b/src/api/system/rule.js @@ -0,0 +1,59 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +// import qs from 'qs' + +// 获取当前报警列表 +export function getRuleList() { + return request({ + url: 'rule/listPage', + method: 'get' + }) +} +export function getContentList(params) { + return request({ + url: 'maintain/contentByType', + method: 'get', + params: { + type: params + } + }) +} +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 编辑 +export function editRecord(params) { + return request({ + url: 'maintain/update', + method: 'post', + params + }) +} +// 新增 +export function addRecord(params) { + return request({ + url: 'maintain/add', + method: 'post', + params + }) +} +// 删除 +export function delRecord(id) { + return request({ + url: 'maintain/delete', + method: 'post', + params: { + id: id + } + }) +} diff --git a/src/api/system/statistics.js b/src/api/system/statistics.js new file mode 100644 index 0000000..b25efe9 --- /dev/null +++ b/src/api/system/statistics.js @@ -0,0 +1,23 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +// import qs from 'qs' + +// +export function countByToilet(params) { + return request({ + url: '/sanitation/toiletStatistic/jobStaticByToilet', + method: 'get', + params + }) +} + +export function countByDay(params) { + return request({ + url: '/sanitation/toiletStatistic/jobStaticByDate', + method: 'get', + params + }) +} + diff --git a/src/assets/global_images/icon-position.png b/src/assets/global_images/icon-position.png new file mode 100644 index 0000000..7444038 --- /dev/null +++ b/src/assets/global_images/icon-position.png Binary files differ diff --git a/src/assets/global_images/location_green.png b/src/assets/global_images/location_green.png new file mode 100644 index 0000000..aa8be65 --- /dev/null +++ b/src/assets/global_images/location_green.png Binary files differ diff --git a/src/assets/global_images/location_red.png b/src/assets/global_images/location_red.png new file mode 100644 index 0000000..2be8c3d --- /dev/null +++ b/src/assets/global_images/location_red.png Binary files differ diff --git a/src/assets/global_images/location_yellow.png b/src/assets/global_images/location_yellow.png new file mode 100644 index 0000000..5ab6f4d --- /dev/null +++ b/src/assets/global_images/location_yellow.png Binary files differ diff --git a/src/assets/global_images/toilet-position.png b/src/assets/global_images/toilet-position.png new file mode 100644 index 0000000..7db6d9a --- /dev/null +++ b/src/assets/global_images/toilet-position.png Binary files differ diff --git a/src/assets/global_images/toilet.png b/src/assets/global_images/toilet.png new file mode 100644 index 0000000..6d9fc05 --- /dev/null +++ b/src/assets/global_images/toilet.png Binary files differ diff --git a/src/assets/global_images/toiletPhoto.png b/src/assets/global_images/toiletPhoto.png new file mode 100644 index 0000000..15d08e2 --- /dev/null +++ b/src/assets/global_images/toiletPhoto.png Binary files differ diff --git a/src/components/DownloadTemplate/index.vue b/src/components/DownloadTemplate/index.vue index 8ded2cd..7807cac 100644 --- a/src/components/DownloadTemplate/index.vue +++ b/src/components/DownloadTemplate/index.vue @@ -47,8 +47,8 @@ diff --git a/src/components/NormalTable/index.vue b/src/components/NormalTable/index.vue index 5077bef..04d322d 100644 --- a/src/components/NormalTable/index.vue +++ b/src/components/NormalTable/index.vue @@ -79,7 +79,7 @@
-
+
Object.assign(obj, { [key]: this[key] }), {}), + on: events.reduce((obj, key) => Object.assign(obj, { [key]: this.transmitEvent }), {}) + }) + } + this.props = [...extraProps, ...props.filter(prop => exceptProps.indexOf(prop))] + } +} + +export default prop => new Mixin(prop) diff --git a/src/components/mapWindow/base/mixins/common.js b/src/components/mapWindow/base/mixins/common.js new file mode 100644 index 0000000..2fd1a28 --- /dev/null +++ b/src/components/mapWindow/base/mixins/common.js @@ -0,0 +1,82 @@ +const types = { + map: { + unload: 'clearMap' + }, + control: { + unload: 'removeControl' + }, + layer: { + unload: 'removeLayer' + }, + features: { + unload: 'removeFeatures' + }, + listener: { + unload: 'removeListener' + } +} + +const getParent = $component => ($component.abstract || $component.$el === $component.$children[0].$el) ? getParent($component.$parent) : $component + +function destroyInstance () { + const { unload, renderByParent, $parent } = this + if (renderByParent) { + $parent.reload() + } + unload() +} + +class Mixin { + constructor (prop) { + this.methods = { + ready () { + const $parent = getParent(this.$parent) + const map = this.map = $parent.map + this.load() + this.$emit('ready', { + map + }) + }, + transmitEvent (e) { + this.$emit(e.type.replace(/^on/, ''), e) + }, + reload () { + this && this.$nextTick(() => { + this.unload() + this.$nextTick(this.load) + }) + }, + unload () { + const { map, originInstance } = this + try { + switch (prop.type) { + case 'search': + return originInstance.clearResults() + case 'autoComplete': + case 'lushu': + return originInstance.dispose() + case 'markerClusterer': + return originInstance.clearMarkers() + default: + map[types[prop.type].unload](originInstance) + } + } catch (e) {} + } + } + this.computed = { + renderByParent () { + return this.$parent.preventChildrenRender + } + } + this.mounted = function () { + console.log('common mounted') + const $parent = getParent(this.$parent) + const map = $parent.map + const { ready } = this + console.log(map) + map ? ready() : $parent.$on('onload', ready) + } + } +} + +export default type => new Mixin({ type }) diff --git a/src/components/mapWindow/leafletMap.vue b/src/components/mapWindow/leafletMap.vue new file mode 100644 index 0000000..b753cc0 --- /dev/null +++ b/src/components/mapWindow/leafletMap.vue @@ -0,0 +1,143 @@ + + + + + + + diff --git a/src/components/mapWindow/mapWindow.vue b/src/components/mapWindow/mapWindow.vue new file mode 100644 index 0000000..9ced291 --- /dev/null +++ b/src/components/mapWindow/mapWindow.vue @@ -0,0 +1,46 @@ + + + + + + diff --git a/src/icons/svg/bridge.svg b/src/icons/svg/bridge.svg new file mode 100644 index 0000000..1a0336f --- /dev/null +++ b/src/icons/svg/bridge.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/icons/svg/toilet.svg b/src/icons/svg/toilet.svg new file mode 100644 index 0000000..9d8e765 --- /dev/null +++ b/src/icons/svg/toilet.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/main.js b/src/main.js index f2d105d..3e4074e 100644 --- a/src/main.js +++ b/src/main.js @@ -18,6 +18,9 @@ // echart // import echarts from 'echarts' // Vue.prototype.$echarts = echarts +// 引入v-charts +import VCharts from 'v-charts' +Vue.use(VCharts) // 将自动注册所有组件为全局组件 // import dataV from '@jiaminghi/data-view' @@ -35,9 +38,19 @@ Vue.component('search-item', SearchItem) // 加载leaflet的css +// import 'leaflet/dist/leaflet.css' +// import 'leaflet-draw/dist/leaflet.draw.css' +import L from 'leaflet' import 'leaflet/dist/leaflet.css' -import 'leaflet-draw/dist/leaflet.draw.css' +Vue.config.productionTip = false +Vue.L = Vue.prototype.$L = L +delete L.Icon.Default.prototype._getIconUrl +L.Icon.Default.mergeOptions({ + iconRetinaUrl: require('leaflet/dist/images/marker-icon-2x.png'), + iconUrl: require('leaflet/dist/images/marker-icon.png'), + shadowUrl: require('leaflet/dist/images/marker-shadow.png') +}) /** * This project originally used easy-mock to simulate data, * but its official service is very unstable, diff --git a/src/permission.js b/src/permission.js index dc6b2f8..809ca86 100644 --- a/src/permission.js +++ b/src/permission.js @@ -25,8 +25,8 @@ store.dispatch('GetInfo').then(res => { // 拉取用户信息 // 设置当前子系统为基础资源子系统 const currentSys = { - code: 'baseResourse', - name: '基础资源子系统' + code: 'toliet', + name: '公共厕所管理系统' } // 将当前系统信息保存在localStorage中 store.commit('SET_SYSTEM', currentSys) diff --git a/src/router/index.js b/src/router/index.js index 39c295c..d23076d 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -8,8 +8,11 @@ /* Layout */ import Layout from '@/layout/Layout' +import { toiletRouters } from './modules/toilet' +import { workRouters } from './modules/work' +import { statisticsRouters } from './modules/statistics' +import { ruleRouters } from './modules/rule' import { systemRouters } from './modules/system' -import { exampleRouters } from './modules/example' /** * hidden: true if `hidden:true` will not show in the sidebar(default is false) @@ -40,11 +43,12 @@ ] }, // 登录页面 - { path: '/login', component: () => import('@/views/login/index'), hidden: true }, + { path: '/login', component: () => import('@/views/login/index_2'), hidden: true }, // 404错误页面 { path: '/404', component: () => import('@/views/errorPage/404'), hidden: true }, // 401 错误页面 - { path: '/401', component: () => import('@/views/errorPage/401'), hidden: true } + { path: '/401', component: () => import('@/views/errorPage/401'), hidden: true }, + { path: '/', redirect: '/toiletList', hidden: true } ] // 实例化vue的时候直挂载constantRouter export default new Router({ @@ -56,7 +60,10 @@ // 异步挂载路由 // 动态需要根据权限加载的路由表 export const asyncRouterMap = [ - ...exampleRouters, - ...systemRouters, + ...toiletRouters, + ...workRouters, + ...statisticsRouters, + ...ruleRouters, + // ...systemRouters, { path: '*', redirect: '/404', hidden: true } ] diff --git a/src/router/modules/rule.js b/src/router/modules/rule.js new file mode 100644 index 0000000..51e0283 --- /dev/null +++ b/src/router/modules/rule.js @@ -0,0 +1,24 @@ +/* Layout */ +import Layout from '@/layout/Layout' + +export const ruleRouters = [ + { + path: 'rule', + component: Layout, + redirect: '/rule', + name: 'Rule', + meta: { + title: '规章制度', + icon: 'icon-config', // 图标 + permission: ['/rule']// 权限名称 + }, + children: [ + { + path: '/rule', + name: 'Rule', + component: () => import('@/views/rule/listRule'), + meta: { title: '规章制度', icon: 'function', permission: ['/rule'] } + } + ] + } +] diff --git a/src/router/modules/statistics.js b/src/router/modules/statistics.js new file mode 100644 index 0000000..fb9cbea --- /dev/null +++ b/src/router/modules/statistics.js @@ -0,0 +1,30 @@ +/* Layout */ +import Layout from '@/layout/Layout' + +export const statisticsRouters = [ + { + path: 'statisticsToilet', + component: Layout, + redirect: '/workStatistics', + name: 'StatisticsToilet', + meta: { + title: '作业统计', + icon: 'icon-config', // 图标 + permission: ['/statisticsToilet']// 权限名称 + }, + children: [ + { + path: '/workStatistics', + name: 'WorkStatistics', + component: () => import('@/views/statistics/toiletAssessment'), + meta: { title: '作业统计', icon: '', permission: ['/toilet/workStatistics'] } + }, + { + path: '/evaluationStatistics', + name: 'EvaluationStatistics', + component: () => import('@/views/statistics/evaluationAssessment'), + meta: { title: '评价统计', icon: '', permission: ['/toilet/evaluationStatistics'] } + } + ] + } +] diff --git a/src/router/modules/toilet.js b/src/router/modules/toilet.js new file mode 100644 index 0000000..b221a0e --- /dev/null +++ b/src/router/modules/toilet.js @@ -0,0 +1,30 @@ +/* Layout */ +import Layout from '@/layout/Layout' + +export const toiletRouters = [ + { + path: 'toiletManage', + component: Layout, + redirect: '/toiletManage', + name: 'ToiletManage', + meta: { + title: '公厕管理', + icon: 'icon-config', // 图标 + permission: ['/toiletManage']// 权限名称 + }, + children: [ + { + path: '/toiletList', + name: 'ToiletList', + component: () => import('@/views/toiletManage/toiletList'), + meta: { title: '公厕台帐管理', icon: 'function', permission: ['/toiletList'] } + }, + { + path: '/toiletMap', + name: 'ToiletMap', + component: () => import('@/views/overview/overview'), + meta: { title: '地图总览', icon: 'function', permission: ['/toiletMap'] } + } + ] + } +] diff --git a/src/router/modules/work.js b/src/router/modules/work.js new file mode 100644 index 0000000..5e0759f --- /dev/null +++ b/src/router/modules/work.js @@ -0,0 +1,24 @@ +/* Layout */ +import Layout from '@/layout/Layout' + +export const workRouters = [ + { + path: 'toiletWork', + component: Layout, + redirect: '/toiletManage', + name: 'toiletWork', + meta: { + title: '作业管理', + icon: 'icon-config', // 图标 + permission: ['/toiletWork']// 权限名称 + }, + children: [ + { + path: '/toiletWork', + name: 'ToiletWork', + component: () => import('@/views/toiletClean/toiletCleanList'), + meta: { title: '作业管理', icon: 'function', permission: ['/toiletWork'] } + } + ] + } +] diff --git a/src/settings.js b/src/settings.js index b568ce0..b8159bf 100644 --- a/src/settings.js +++ b/src/settings.js @@ -3,7 +3,7 @@ * @type {boolean} true | false * @description 是否显示设置按钮 */ - showSettings: true, + showSettings: false, /** * @type {boolean} true | false diff --git a/src/store/modules/permission.js b/src/store/modules/permission.js index a0cb8cf..3ab50d5 100644 --- a/src/store/modules/permission.js +++ b/src/store/modules/permission.js @@ -120,17 +120,23 @@ }) }, // 获取用户权限 - GetMenus({ commit, state }) { - console.log('in store.permission.js:GetMenus:') + GetMenus({ commit, state }, currentSystem) { + // console.log('in store.permission.js:GetMenus:') + console.log('获取' + currentSystem.name + '的菜单') + const params = { + parentCode: currentSystem.code // 传入该子系统的code,获取子系统的权限 + } return new Promise((resolve, reject) => { - getMenus(state.token).then(response => { // 处理返回值 + // 此处获取用户所有权限 + getMenus(params).then(response => { // 处理返回值 const data = response.data const menus = [] // 仅菜单 const btns = [] // 非菜单 if (data.menus && data.menus.length > 0) { - commit('SET_MENUS', data.menus) - for (const menu of data.menus) { // 遍历菜单,获取所有的权限项 - if (menu.ismenu === '1') { // 将是菜单的放入menus + const allmenus = [...data.menus] + commit('SET_MENUS', allmenus) + for (const menu of allmenus) { // 遍历菜单,获取所有的权限项 + if (menu.resourceType === '02' || menu.resourceType === '03') { // 将是菜单的放入menus const menu_tmp = {} menu_tmp.url = menu.url menu_tmp.icon = menu.icon @@ -142,11 +148,11 @@ btn_tmp.name = menu.name btn_tmp.icon = menu.icon btns.push(btn_tmp) - // console.log(menu.url) } } // 过滤路由表 - const accessedRouters = filterAsyncRouter(asyncRouterMap, menus) + let accessedRouters = filterAsyncRouter(asyncRouterMap, menus) + // accessedRouters = filterRedirect(accessedRouters) commit('SET_BTNS', btns) commit('SET_ROUTERS', accessedRouters) resolve(response) diff --git a/src/utils/baseConfig.js b/src/utils/baseConfig.js index 1f4fa38..999593e 100644 --- a/src/utils/baseConfig.js +++ b/src/utils/baseConfig.js @@ -1,5 +1,5 @@ const project = { - title: '后台管理系统前端基础框架' + title: '路桥养护子系统' } export function getProject() { return project diff --git a/src/utils/dateutils.js b/src/utils/dateutils.js index 868111a..5cd16af 100644 --- a/src/utils/dateutils.js +++ b/src/utils/dateutils.js @@ -15,15 +15,15 @@ return ct_month } -export function getLastWeek() { // 默认显示上周 +export function getLastWeek(fmt) { // 默认显示上周 const ct_month = new Date() ct_month.setTime(ct_month.getTime() - 3600 * 1000 * 24 * 7) - return ct_month + return ct_month.Format(fmt) } -export function getLastMonth() { // 默认显示上个月 +export function getLastMonth(fmt) { // 默认显示上个月 const ct_month = new Date() ct_month.setTime(ct_month.getTime() - 3600 * 1000 * 24 * 30) - return ct_month + return ct_month.Format(fmt) } // 对Date的扩展,将 Date 转化为指定格式的String diff --git a/src/utils/exportutils.js b/src/utils/exportutils.js new file mode 100644 index 0000000..b5d0bcf --- /dev/null +++ b/src/utils/exportutils.js @@ -0,0 +1,19 @@ +/** + * 导出文件工具 + * @param blob 文件 + * @param fileName 导出文件名 + */ +export function exportFile(blob, fileName) { + if (window.navigator && window.navigator.msSaveOrOpenBlob) { + navigator.msSaveBlob(blob, fileName) + } else { + const downloadElement = document.createElement('a') + const href = window.URL.createObjectURL(blob) // 创建下载的链接 + downloadElement.href = href + downloadElement.download = fileName + document.body.appendChild(downloadElement) + downloadElement.click() // 点击下载 + document.body.removeChild(downloadElement) // 下载完成移除元素 + window.URL.revokeObjectURL(href) // 释放blob对象 + } +} diff --git a/src/utils/request.js b/src/utils/request.js index c88ea76..dc56e26 100644 --- a/src/utils/request.js +++ b/src/utils/request.js @@ -17,6 +17,13 @@ config.headers['token'] = getToken() // 让每个请求携带自定义token 请根据实际情况自行修改 console.log(config.headers['token']) } + // 在接口增加时间戳 + // if (config.method === 'get') { + config.params = { + _t: Date.parse(new Date()) / 1000, + ...config.params + } + // } return config }, error => { diff --git a/src/views/mapViews/choosePointDialog.vue b/src/views/mapViews/choosePointDialog.vue new file mode 100644 index 0000000..c9dde8a --- /dev/null +++ b/src/views/mapViews/choosePointDialog.vue @@ -0,0 +1,105 @@ + + + + + diff --git a/src/views/mapViews/mapView.vue b/src/views/mapViews/mapView.vue new file mode 100644 index 0000000..a18db88 --- /dev/null +++ b/src/views/mapViews/mapView.vue @@ -0,0 +1,73 @@ + + + + + diff --git a/src/views/order/editOrder.vue b/src/views/order/editOrder.vue new file mode 100644 index 0000000..4a5fd8a --- /dev/null +++ b/src/views/order/editOrder.vue @@ -0,0 +1,319 @@ + + + + + diff --git a/src/views/order/listMaintainRecords.vue b/src/views/order/listMaintainRecords.vue new file mode 100644 index 0000000..2d4f682 --- /dev/null +++ b/src/views/order/listMaintainRecords.vue @@ -0,0 +1,327 @@ + + + + + diff --git a/src/views/overview/overview.vue b/src/views/overview/overview.vue new file mode 100644 index 0000000..9525867 --- /dev/null +++ b/src/views/overview/overview.vue @@ -0,0 +1,285 @@ + + + + + diff --git a/config/index.js b/config/index.js index 8abd37a..19b33b1 100644 --- a/config/index.js +++ b/config/index.js @@ -69,7 +69,7 @@ * then assetsPublicPath should be set to "/bar/". * In most cases please use '/' !!! */ - assetsPublicPath: '/', + assetsPublicPath: '/toilet/', /** * Source Maps diff --git a/package.json b/package.json index 45f055f..9f3a3eb 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "echarts": "^4.2.1", "element-ui": "2.13.0", "event-source-polyfill": "^1.0.5", + "file-saver": "^2.0.5", "js-cookie": "2.2.0", "jsencrypt": "^3.0.0-rc.1", "leaflet": "^1.7.1", @@ -33,7 +34,9 @@ "vue-amap": "^0.5.9", "vue-baidu-map": "^0.21.22", "vue-router": "3.0.1", - "vuex": "3.0.1" + "vue2-leaflet": "^2.7.0", + "vuex": "3.0.1", + "xlsx": "^0.17.0" }, "devDependencies": { "autoprefixer": "8.5.0", diff --git a/src/api/common.js b/src/api/common.js index 87c582b..7804714 100644 --- a/src/api/common.js +++ b/src/api/common.js @@ -2,10 +2,14 @@ * 常用接口 */ import request from '@/utils/request' +import Vue from 'vue' + // 模板下载 export function downloadTemplate(fileName) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath return request({ - url: 'template/download', + url: lampPath + 'template/download', method: 'get', params: { filename: fileName @@ -19,7 +23,7 @@ const param = new FormData() param.append('file', fileobj.file) return request({ - url: 'imageUpload', + url: 'fileUpload', method: 'post', headers: { 'Content-Type': 'multipart/form-data' }, data: param diff --git a/src/api/sanitation/statistics.js b/src/api/sanitation/statistics.js new file mode 100644 index 0000000..ffeac18 --- /dev/null +++ b/src/api/sanitation/statistics.js @@ -0,0 +1,22 @@ + +/** + * 考核统计接口 + */ +import request from '@/utils/request' +// 公厕保洁次数统计 +export function getToiletJobCount(params) { + return request({ + url: '/sanitation/statistic/toilet/jobCount', + method: 'get', + params + }) +} + +// 公厕评分统计 +export function getToiletEvaluation(params) { + return request({ + url: '/sanitation/toiletEvaluation/statistics', + method: 'get', + params + }) +} diff --git a/src/api/sanitation/toilet.js b/src/api/sanitation/toilet.js new file mode 100644 index 0000000..11affd4 --- /dev/null +++ b/src/api/sanitation/toilet.js @@ -0,0 +1,133 @@ +/** + * 公厕管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' +// 公厕查询 +export function getToiletListPage(params) { + return request({ + url: '/sanitation/toilet/listPage', + method: 'get', + params + }) +} +// 公厕查询 +export function getToiletList(pid) { + return request({ + url: '/sanitation/toilet/list', + method: 'get', + params: { + pid: pid + } + }) +} + +// 添加公厕 +export function addToilet(params) { + return request({ + url: '/sanitation/toilet/add', + method: 'post', + params + }) +} +// 修改公厕机构 +export function updateToilet(params) { + return request({ + url: '/sanitation/toilet/update', + method: 'post', + params + }) +} +// 删除公厕机构 +export function delToilet(ids) { + return request({ + url: '/sanitation/toilet/delete', + method: 'post', + params: { + ids + }, + paramsSerializer: params => { + return qs.stringify(params, { indices: false }) + } + }) +} + +// 公厕基本信息详情 +export function getToiletInfoDetail(id) { + return request({ + url: '/sanitation/toilet/detail?toiletId=' + id, + method: 'get' + }) +} + +// 某公厕保洁记录 +export function getRecordsByToilet(params) { + return request({ + url: '/sanitation/toilet/jobRecord/detail', + method: 'get', + params + }) +} + +// 某公厕平均评分 +export function getScoreByToilet(params) { + return request({ + url: '/sanitation/toiletEvaluation/detailScore', + method: 'get', + params + }) +} + +// 某公厕评分列表 +export function getScoreListByToilet(params) { + return request({ + url: '/sanitation/toiletEvaluation/list', + method: 'get', + params + }) +} + + +// 批量导入 +export function batchImportToilet(fileobj) { + const param = new FormData() + param.append('file', fileobj) + return request({ + url: '/sanitation/toilet/import', + method: 'post', + headers: { 'Content-Type': 'multipart/form-data' }, + data: param + }) +} +// 批量导出 +export function batchExportToilet(params, config) { + return request({ + url: '/sanitation/toilet/export', + method: 'get', + timeout: 120000, + params, + ...config, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 公厕保洁记录查询 +export function getToiletJobRecords(params) { + return request({ + url: '/sanitation/toilet/jobRecord', + method: 'get', + params + }) +} + +// 批量导出 +export function batchExportToiletJobRecords(params, config) { + return request({ + url: '/sanitation/toilet/exportJobRecord', + method: 'get', + timeout: 120000, + params, + ...config, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} diff --git a/src/api/system/alarm.js b/src/api/system/alarm.js new file mode 100644 index 0000000..1c3a7ab --- /dev/null +++ b/src/api/system/alarm.js @@ -0,0 +1,62 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' + +// 获取当前报警列表 +export function getAlarmNowList(params) { + return request({ + url: '/alarm/listNowPage', + method: 'get', + params + }) +} + +// 获取当前报警列表 +export function getAlarmHistoryList(params) { + return request({ + url: '/alarm/listHisPage', + method: 'get', + params + }) +} + + +// 批量消警 +export function clearAll(params) { + return request({ + url: '/alarm/allClear', + method: 'get', + params + }) +} + +// 消警 +export function clearAlarm(params) { + return request({ + url: '/alarm/cancel', + method: 'get', + params + }) +} + +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 设置报警阈值 +export function setThresh(params) { + return request({ + url: '/alarm/resetAlarmRule', + method: 'post', + params + }) +} diff --git a/src/api/system/bridge.js b/src/api/system/bridge.js new file mode 100644 index 0000000..e8a4108 --- /dev/null +++ b/src/api/system/bridge.js @@ -0,0 +1,80 @@ +/** + * 桥梁管理接口 + */ +import request from '@/utils/request' + +// 获取桥梁详情 +export function getDetail(id) { + return request({ + url: '/bridge/detail', + method: 'get', + params: { + id: id + } + }) +} + +export function updateBridge(params) { + return request({ + url: '/bridge/update', + method: 'post', + params + }) +} +// 批量导出 +export function exportRecords(params) { + return request({ + url: 'device/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +export function getContentList(params) { + return request({ + url: 'maintain/contentByType', + method: 'get', + params: { + type: params + } + }) +} +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 编辑 +export function editRecord(params) { + return request({ + url: 'maintain/update', + method: 'post', + params + }) +} +// 新增 +export function addRecord(params) { + return request({ + url: 'maintain/add', + method: 'post', + params + }) +} +// 删除 +export function delRecord(id) { + return request({ + url: 'maintain/delete', + method: 'post', + params: { + id: id + } + }) +} diff --git a/src/api/system/data.js b/src/api/system/data.js new file mode 100644 index 0000000..4c95db5 --- /dev/null +++ b/src/api/system/data.js @@ -0,0 +1,63 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' + +// 获取当前报警列表 +export function getHistoryList(params) { + return request({ + url: '/data/hisListPage', + method: 'get', + params + }) +} + +// 获取当前报警列表 +export function getHistory(params) { + return request({ + url: '/data/hisList', + method: 'get', + params + }) +} + + + +// 批量消警 +export function clearAll(params) { + return request({ + url: '/alarm/allClear', + method: 'get', + params + }) +} + +// 消警 +export function clearAlarm(params) { + return request({ + url: '/alarm/cancel', + method: 'get', + params + }) +} + +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 设置报警阈值 +export function setThresh(params) { + return request({ + url: '/alarm/resetAlarmRule', + method: 'post', + params + }) +} diff --git a/src/api/system/order.js b/src/api/system/order.js new file mode 100644 index 0000000..7007c50 --- /dev/null +++ b/src/api/system/order.js @@ -0,0 +1,71 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +// import qs from 'qs' + +// 获取当前报警列表 +export function getRecordList(params) { + return request({ + url: '/maintain/listPage', + method: 'get', + params + }) +} +// 批量导出 +export function exportRecords(params) { + return request({ + url: 'device/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +export function getContentList(params) { + return request({ + url: 'maintain/contentByType', + method: 'get', + params: { + type: params + } + }) +} +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 编辑 +export function editRecord(params) { + return request({ + url: 'maintain/update', + method: 'post', + params + }) +} +// 新增 +export function addRecord(params) { + return request({ + url: 'maintain/add', + method: 'post', + params + }) +} +// 删除 +export function delRecord(id) { + return request({ + url: 'maintain/delete', + method: 'post', + params: { + bridgeMaintenanceId: id + } + }) +} diff --git a/src/api/system/overview.js b/src/api/system/overview.js new file mode 100644 index 0000000..bca50cc --- /dev/null +++ b/src/api/system/overview.js @@ -0,0 +1,109 @@ +import request from '@/utils/request' +import qs from "qs" +import Vue from 'vue' + +// 路灯状态统计 +export function getLampStatus() { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampStatus', + method: 'get' + }) +} + +// 路灯总览列表 +export function getLampList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampList', + method: 'get', + params + }) +} + +// 路灯详情 +export function getlampDetail(lampId) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampDetail', + method: 'get', + params: { + lampId: lampId + } + }) +} + +// 回路列表 +export function getCircuitList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/circuitList', + method: 'get', + params + }) +} + +// 灯箱列表 +export function getLampBoxList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampBoxList', + method: 'get', + params + }) +} +// 灯箱详情 +export function getLampBoxDetail(lampBoxId) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampBoxDetail', + method: 'get', + params: { + lampBoxId: lampBoxId + } + }) +} + +// 报警总览列表 +export function getAlarmList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/alarmList', + method: 'get', + params + }) +} + +// 报警详情 +export function getAlarmDetail(alarmId) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/alarmDetail', + method: 'get', + params: { + alarmId: alarmId + } + }) +} + +// 路灯控制 +export function lampControl(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampControl', + method: 'post', + params, + paramsSerializer: params => { + return qs.stringify(params, { indices: false }) + } + }) +} diff --git a/src/api/system/rule.js b/src/api/system/rule.js new file mode 100644 index 0000000..76c6b2d --- /dev/null +++ b/src/api/system/rule.js @@ -0,0 +1,59 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +// import qs from 'qs' + +// 获取当前报警列表 +export function getRuleList() { + return request({ + url: 'rule/listPage', + method: 'get' + }) +} +export function getContentList(params) { + return request({ + url: 'maintain/contentByType', + method: 'get', + params: { + type: params + } + }) +} +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 编辑 +export function editRecord(params) { + return request({ + url: 'maintain/update', + method: 'post', + params + }) +} +// 新增 +export function addRecord(params) { + return request({ + url: 'maintain/add', + method: 'post', + params + }) +} +// 删除 +export function delRecord(id) { + return request({ + url: 'maintain/delete', + method: 'post', + params: { + id: id + } + }) +} diff --git a/src/api/system/statistics.js b/src/api/system/statistics.js new file mode 100644 index 0000000..b25efe9 --- /dev/null +++ b/src/api/system/statistics.js @@ -0,0 +1,23 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +// import qs from 'qs' + +// +export function countByToilet(params) { + return request({ + url: '/sanitation/toiletStatistic/jobStaticByToilet', + method: 'get', + params + }) +} + +export function countByDay(params) { + return request({ + url: '/sanitation/toiletStatistic/jobStaticByDate', + method: 'get', + params + }) +} + diff --git a/src/assets/global_images/icon-position.png b/src/assets/global_images/icon-position.png new file mode 100644 index 0000000..7444038 --- /dev/null +++ b/src/assets/global_images/icon-position.png Binary files differ diff --git a/src/assets/global_images/location_green.png b/src/assets/global_images/location_green.png new file mode 100644 index 0000000..aa8be65 --- /dev/null +++ b/src/assets/global_images/location_green.png Binary files differ diff --git a/src/assets/global_images/location_red.png b/src/assets/global_images/location_red.png new file mode 100644 index 0000000..2be8c3d --- /dev/null +++ b/src/assets/global_images/location_red.png Binary files differ diff --git a/src/assets/global_images/location_yellow.png b/src/assets/global_images/location_yellow.png new file mode 100644 index 0000000..5ab6f4d --- /dev/null +++ b/src/assets/global_images/location_yellow.png Binary files differ diff --git a/src/assets/global_images/toilet-position.png b/src/assets/global_images/toilet-position.png new file mode 100644 index 0000000..7db6d9a --- /dev/null +++ b/src/assets/global_images/toilet-position.png Binary files differ diff --git a/src/assets/global_images/toilet.png b/src/assets/global_images/toilet.png new file mode 100644 index 0000000..6d9fc05 --- /dev/null +++ b/src/assets/global_images/toilet.png Binary files differ diff --git a/src/assets/global_images/toiletPhoto.png b/src/assets/global_images/toiletPhoto.png new file mode 100644 index 0000000..15d08e2 --- /dev/null +++ b/src/assets/global_images/toiletPhoto.png Binary files differ diff --git a/src/components/DownloadTemplate/index.vue b/src/components/DownloadTemplate/index.vue index 8ded2cd..7807cac 100644 --- a/src/components/DownloadTemplate/index.vue +++ b/src/components/DownloadTemplate/index.vue @@ -47,8 +47,8 @@ diff --git a/src/components/NormalTable/index.vue b/src/components/NormalTable/index.vue index 5077bef..04d322d 100644 --- a/src/components/NormalTable/index.vue +++ b/src/components/NormalTable/index.vue @@ -79,7 +79,7 @@
-
+
Object.assign(obj, { [key]: this[key] }), {}), + on: events.reduce((obj, key) => Object.assign(obj, { [key]: this.transmitEvent }), {}) + }) + } + this.props = [...extraProps, ...props.filter(prop => exceptProps.indexOf(prop))] + } +} + +export default prop => new Mixin(prop) diff --git a/src/components/mapWindow/base/mixins/common.js b/src/components/mapWindow/base/mixins/common.js new file mode 100644 index 0000000..2fd1a28 --- /dev/null +++ b/src/components/mapWindow/base/mixins/common.js @@ -0,0 +1,82 @@ +const types = { + map: { + unload: 'clearMap' + }, + control: { + unload: 'removeControl' + }, + layer: { + unload: 'removeLayer' + }, + features: { + unload: 'removeFeatures' + }, + listener: { + unload: 'removeListener' + } +} + +const getParent = $component => ($component.abstract || $component.$el === $component.$children[0].$el) ? getParent($component.$parent) : $component + +function destroyInstance () { + const { unload, renderByParent, $parent } = this + if (renderByParent) { + $parent.reload() + } + unload() +} + +class Mixin { + constructor (prop) { + this.methods = { + ready () { + const $parent = getParent(this.$parent) + const map = this.map = $parent.map + this.load() + this.$emit('ready', { + map + }) + }, + transmitEvent (e) { + this.$emit(e.type.replace(/^on/, ''), e) + }, + reload () { + this && this.$nextTick(() => { + this.unload() + this.$nextTick(this.load) + }) + }, + unload () { + const { map, originInstance } = this + try { + switch (prop.type) { + case 'search': + return originInstance.clearResults() + case 'autoComplete': + case 'lushu': + return originInstance.dispose() + case 'markerClusterer': + return originInstance.clearMarkers() + default: + map[types[prop.type].unload](originInstance) + } + } catch (e) {} + } + } + this.computed = { + renderByParent () { + return this.$parent.preventChildrenRender + } + } + this.mounted = function () { + console.log('common mounted') + const $parent = getParent(this.$parent) + const map = $parent.map + const { ready } = this + console.log(map) + map ? ready() : $parent.$on('onload', ready) + } + } +} + +export default type => new Mixin({ type }) diff --git a/src/components/mapWindow/leafletMap.vue b/src/components/mapWindow/leafletMap.vue new file mode 100644 index 0000000..b753cc0 --- /dev/null +++ b/src/components/mapWindow/leafletMap.vue @@ -0,0 +1,143 @@ + + + + + + + diff --git a/src/components/mapWindow/mapWindow.vue b/src/components/mapWindow/mapWindow.vue new file mode 100644 index 0000000..9ced291 --- /dev/null +++ b/src/components/mapWindow/mapWindow.vue @@ -0,0 +1,46 @@ + + + + + + diff --git a/src/icons/svg/bridge.svg b/src/icons/svg/bridge.svg new file mode 100644 index 0000000..1a0336f --- /dev/null +++ b/src/icons/svg/bridge.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/icons/svg/toilet.svg b/src/icons/svg/toilet.svg new file mode 100644 index 0000000..9d8e765 --- /dev/null +++ b/src/icons/svg/toilet.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/main.js b/src/main.js index f2d105d..3e4074e 100644 --- a/src/main.js +++ b/src/main.js @@ -18,6 +18,9 @@ // echart // import echarts from 'echarts' // Vue.prototype.$echarts = echarts +// 引入v-charts +import VCharts from 'v-charts' +Vue.use(VCharts) // 将自动注册所有组件为全局组件 // import dataV from '@jiaminghi/data-view' @@ -35,9 +38,19 @@ Vue.component('search-item', SearchItem) // 加载leaflet的css +// import 'leaflet/dist/leaflet.css' +// import 'leaflet-draw/dist/leaflet.draw.css' +import L from 'leaflet' import 'leaflet/dist/leaflet.css' -import 'leaflet-draw/dist/leaflet.draw.css' +Vue.config.productionTip = false +Vue.L = Vue.prototype.$L = L +delete L.Icon.Default.prototype._getIconUrl +L.Icon.Default.mergeOptions({ + iconRetinaUrl: require('leaflet/dist/images/marker-icon-2x.png'), + iconUrl: require('leaflet/dist/images/marker-icon.png'), + shadowUrl: require('leaflet/dist/images/marker-shadow.png') +}) /** * This project originally used easy-mock to simulate data, * but its official service is very unstable, diff --git a/src/permission.js b/src/permission.js index dc6b2f8..809ca86 100644 --- a/src/permission.js +++ b/src/permission.js @@ -25,8 +25,8 @@ store.dispatch('GetInfo').then(res => { // 拉取用户信息 // 设置当前子系统为基础资源子系统 const currentSys = { - code: 'baseResourse', - name: '基础资源子系统' + code: 'toliet', + name: '公共厕所管理系统' } // 将当前系统信息保存在localStorage中 store.commit('SET_SYSTEM', currentSys) diff --git a/src/router/index.js b/src/router/index.js index 39c295c..d23076d 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -8,8 +8,11 @@ /* Layout */ import Layout from '@/layout/Layout' +import { toiletRouters } from './modules/toilet' +import { workRouters } from './modules/work' +import { statisticsRouters } from './modules/statistics' +import { ruleRouters } from './modules/rule' import { systemRouters } from './modules/system' -import { exampleRouters } from './modules/example' /** * hidden: true if `hidden:true` will not show in the sidebar(default is false) @@ -40,11 +43,12 @@ ] }, // 登录页面 - { path: '/login', component: () => import('@/views/login/index'), hidden: true }, + { path: '/login', component: () => import('@/views/login/index_2'), hidden: true }, // 404错误页面 { path: '/404', component: () => import('@/views/errorPage/404'), hidden: true }, // 401 错误页面 - { path: '/401', component: () => import('@/views/errorPage/401'), hidden: true } + { path: '/401', component: () => import('@/views/errorPage/401'), hidden: true }, + { path: '/', redirect: '/toiletList', hidden: true } ] // 实例化vue的时候直挂载constantRouter export default new Router({ @@ -56,7 +60,10 @@ // 异步挂载路由 // 动态需要根据权限加载的路由表 export const asyncRouterMap = [ - ...exampleRouters, - ...systemRouters, + ...toiletRouters, + ...workRouters, + ...statisticsRouters, + ...ruleRouters, + // ...systemRouters, { path: '*', redirect: '/404', hidden: true } ] diff --git a/src/router/modules/rule.js b/src/router/modules/rule.js new file mode 100644 index 0000000..51e0283 --- /dev/null +++ b/src/router/modules/rule.js @@ -0,0 +1,24 @@ +/* Layout */ +import Layout from '@/layout/Layout' + +export const ruleRouters = [ + { + path: 'rule', + component: Layout, + redirect: '/rule', + name: 'Rule', + meta: { + title: '规章制度', + icon: 'icon-config', // 图标 + permission: ['/rule']// 权限名称 + }, + children: [ + { + path: '/rule', + name: 'Rule', + component: () => import('@/views/rule/listRule'), + meta: { title: '规章制度', icon: 'function', permission: ['/rule'] } + } + ] + } +] diff --git a/src/router/modules/statistics.js b/src/router/modules/statistics.js new file mode 100644 index 0000000..fb9cbea --- /dev/null +++ b/src/router/modules/statistics.js @@ -0,0 +1,30 @@ +/* Layout */ +import Layout from '@/layout/Layout' + +export const statisticsRouters = [ + { + path: 'statisticsToilet', + component: Layout, + redirect: '/workStatistics', + name: 'StatisticsToilet', + meta: { + title: '作业统计', + icon: 'icon-config', // 图标 + permission: ['/statisticsToilet']// 权限名称 + }, + children: [ + { + path: '/workStatistics', + name: 'WorkStatistics', + component: () => import('@/views/statistics/toiletAssessment'), + meta: { title: '作业统计', icon: '', permission: ['/toilet/workStatistics'] } + }, + { + path: '/evaluationStatistics', + name: 'EvaluationStatistics', + component: () => import('@/views/statistics/evaluationAssessment'), + meta: { title: '评价统计', icon: '', permission: ['/toilet/evaluationStatistics'] } + } + ] + } +] diff --git a/src/router/modules/toilet.js b/src/router/modules/toilet.js new file mode 100644 index 0000000..b221a0e --- /dev/null +++ b/src/router/modules/toilet.js @@ -0,0 +1,30 @@ +/* Layout */ +import Layout from '@/layout/Layout' + +export const toiletRouters = [ + { + path: 'toiletManage', + component: Layout, + redirect: '/toiletManage', + name: 'ToiletManage', + meta: { + title: '公厕管理', + icon: 'icon-config', // 图标 + permission: ['/toiletManage']// 权限名称 + }, + children: [ + { + path: '/toiletList', + name: 'ToiletList', + component: () => import('@/views/toiletManage/toiletList'), + meta: { title: '公厕台帐管理', icon: 'function', permission: ['/toiletList'] } + }, + { + path: '/toiletMap', + name: 'ToiletMap', + component: () => import('@/views/overview/overview'), + meta: { title: '地图总览', icon: 'function', permission: ['/toiletMap'] } + } + ] + } +] diff --git a/src/router/modules/work.js b/src/router/modules/work.js new file mode 100644 index 0000000..5e0759f --- /dev/null +++ b/src/router/modules/work.js @@ -0,0 +1,24 @@ +/* Layout */ +import Layout from '@/layout/Layout' + +export const workRouters = [ + { + path: 'toiletWork', + component: Layout, + redirect: '/toiletManage', + name: 'toiletWork', + meta: { + title: '作业管理', + icon: 'icon-config', // 图标 + permission: ['/toiletWork']// 权限名称 + }, + children: [ + { + path: '/toiletWork', + name: 'ToiletWork', + component: () => import('@/views/toiletClean/toiletCleanList'), + meta: { title: '作业管理', icon: 'function', permission: ['/toiletWork'] } + } + ] + } +] diff --git a/src/settings.js b/src/settings.js index b568ce0..b8159bf 100644 --- a/src/settings.js +++ b/src/settings.js @@ -3,7 +3,7 @@ * @type {boolean} true | false * @description 是否显示设置按钮 */ - showSettings: true, + showSettings: false, /** * @type {boolean} true | false diff --git a/src/store/modules/permission.js b/src/store/modules/permission.js index a0cb8cf..3ab50d5 100644 --- a/src/store/modules/permission.js +++ b/src/store/modules/permission.js @@ -120,17 +120,23 @@ }) }, // 获取用户权限 - GetMenus({ commit, state }) { - console.log('in store.permission.js:GetMenus:') + GetMenus({ commit, state }, currentSystem) { + // console.log('in store.permission.js:GetMenus:') + console.log('获取' + currentSystem.name + '的菜单') + const params = { + parentCode: currentSystem.code // 传入该子系统的code,获取子系统的权限 + } return new Promise((resolve, reject) => { - getMenus(state.token).then(response => { // 处理返回值 + // 此处获取用户所有权限 + getMenus(params).then(response => { // 处理返回值 const data = response.data const menus = [] // 仅菜单 const btns = [] // 非菜单 if (data.menus && data.menus.length > 0) { - commit('SET_MENUS', data.menus) - for (const menu of data.menus) { // 遍历菜单,获取所有的权限项 - if (menu.ismenu === '1') { // 将是菜单的放入menus + const allmenus = [...data.menus] + commit('SET_MENUS', allmenus) + for (const menu of allmenus) { // 遍历菜单,获取所有的权限项 + if (menu.resourceType === '02' || menu.resourceType === '03') { // 将是菜单的放入menus const menu_tmp = {} menu_tmp.url = menu.url menu_tmp.icon = menu.icon @@ -142,11 +148,11 @@ btn_tmp.name = menu.name btn_tmp.icon = menu.icon btns.push(btn_tmp) - // console.log(menu.url) } } // 过滤路由表 - const accessedRouters = filterAsyncRouter(asyncRouterMap, menus) + let accessedRouters = filterAsyncRouter(asyncRouterMap, menus) + // accessedRouters = filterRedirect(accessedRouters) commit('SET_BTNS', btns) commit('SET_ROUTERS', accessedRouters) resolve(response) diff --git a/src/utils/baseConfig.js b/src/utils/baseConfig.js index 1f4fa38..999593e 100644 --- a/src/utils/baseConfig.js +++ b/src/utils/baseConfig.js @@ -1,5 +1,5 @@ const project = { - title: '后台管理系统前端基础框架' + title: '路桥养护子系统' } export function getProject() { return project diff --git a/src/utils/dateutils.js b/src/utils/dateutils.js index 868111a..5cd16af 100644 --- a/src/utils/dateutils.js +++ b/src/utils/dateutils.js @@ -15,15 +15,15 @@ return ct_month } -export function getLastWeek() { // 默认显示上周 +export function getLastWeek(fmt) { // 默认显示上周 const ct_month = new Date() ct_month.setTime(ct_month.getTime() - 3600 * 1000 * 24 * 7) - return ct_month + return ct_month.Format(fmt) } -export function getLastMonth() { // 默认显示上个月 +export function getLastMonth(fmt) { // 默认显示上个月 const ct_month = new Date() ct_month.setTime(ct_month.getTime() - 3600 * 1000 * 24 * 30) - return ct_month + return ct_month.Format(fmt) } // 对Date的扩展,将 Date 转化为指定格式的String diff --git a/src/utils/exportutils.js b/src/utils/exportutils.js new file mode 100644 index 0000000..b5d0bcf --- /dev/null +++ b/src/utils/exportutils.js @@ -0,0 +1,19 @@ +/** + * 导出文件工具 + * @param blob 文件 + * @param fileName 导出文件名 + */ +export function exportFile(blob, fileName) { + if (window.navigator && window.navigator.msSaveOrOpenBlob) { + navigator.msSaveBlob(blob, fileName) + } else { + const downloadElement = document.createElement('a') + const href = window.URL.createObjectURL(blob) // 创建下载的链接 + downloadElement.href = href + downloadElement.download = fileName + document.body.appendChild(downloadElement) + downloadElement.click() // 点击下载 + document.body.removeChild(downloadElement) // 下载完成移除元素 + window.URL.revokeObjectURL(href) // 释放blob对象 + } +} diff --git a/src/utils/request.js b/src/utils/request.js index c88ea76..dc56e26 100644 --- a/src/utils/request.js +++ b/src/utils/request.js @@ -17,6 +17,13 @@ config.headers['token'] = getToken() // 让每个请求携带自定义token 请根据实际情况自行修改 console.log(config.headers['token']) } + // 在接口增加时间戳 + // if (config.method === 'get') { + config.params = { + _t: Date.parse(new Date()) / 1000, + ...config.params + } + // } return config }, error => { diff --git a/src/views/mapViews/choosePointDialog.vue b/src/views/mapViews/choosePointDialog.vue new file mode 100644 index 0000000..c9dde8a --- /dev/null +++ b/src/views/mapViews/choosePointDialog.vue @@ -0,0 +1,105 @@ + + + + + diff --git a/src/views/mapViews/mapView.vue b/src/views/mapViews/mapView.vue new file mode 100644 index 0000000..a18db88 --- /dev/null +++ b/src/views/mapViews/mapView.vue @@ -0,0 +1,73 @@ + + + + + diff --git a/src/views/order/editOrder.vue b/src/views/order/editOrder.vue new file mode 100644 index 0000000..4a5fd8a --- /dev/null +++ b/src/views/order/editOrder.vue @@ -0,0 +1,319 @@ + + + + + diff --git a/src/views/order/listMaintainRecords.vue b/src/views/order/listMaintainRecords.vue new file mode 100644 index 0000000..2d4f682 --- /dev/null +++ b/src/views/order/listMaintainRecords.vue @@ -0,0 +1,327 @@ + + + + + diff --git a/src/views/overview/overview.vue b/src/views/overview/overview.vue new file mode 100644 index 0000000..9525867 --- /dev/null +++ b/src/views/overview/overview.vue @@ -0,0 +1,285 @@ + + + + + diff --git a/src/views/overview/toiletDetailDialog.vue b/src/views/overview/toiletDetailDialog.vue new file mode 100644 index 0000000..2b3a511 --- /dev/null +++ b/src/views/overview/toiletDetailDialog.vue @@ -0,0 +1,263 @@ + + + + + + diff --git a/config/index.js b/config/index.js index 8abd37a..19b33b1 100644 --- a/config/index.js +++ b/config/index.js @@ -69,7 +69,7 @@ * then assetsPublicPath should be set to "/bar/". * In most cases please use '/' !!! */ - assetsPublicPath: '/', + assetsPublicPath: '/toilet/', /** * Source Maps diff --git a/package.json b/package.json index 45f055f..9f3a3eb 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "echarts": "^4.2.1", "element-ui": "2.13.0", "event-source-polyfill": "^1.0.5", + "file-saver": "^2.0.5", "js-cookie": "2.2.0", "jsencrypt": "^3.0.0-rc.1", "leaflet": "^1.7.1", @@ -33,7 +34,9 @@ "vue-amap": "^0.5.9", "vue-baidu-map": "^0.21.22", "vue-router": "3.0.1", - "vuex": "3.0.1" + "vue2-leaflet": "^2.7.0", + "vuex": "3.0.1", + "xlsx": "^0.17.0" }, "devDependencies": { "autoprefixer": "8.5.0", diff --git a/src/api/common.js b/src/api/common.js index 87c582b..7804714 100644 --- a/src/api/common.js +++ b/src/api/common.js @@ -2,10 +2,14 @@ * 常用接口 */ import request from '@/utils/request' +import Vue from 'vue' + // 模板下载 export function downloadTemplate(fileName) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath return request({ - url: 'template/download', + url: lampPath + 'template/download', method: 'get', params: { filename: fileName @@ -19,7 +23,7 @@ const param = new FormData() param.append('file', fileobj.file) return request({ - url: 'imageUpload', + url: 'fileUpload', method: 'post', headers: { 'Content-Type': 'multipart/form-data' }, data: param diff --git a/src/api/sanitation/statistics.js b/src/api/sanitation/statistics.js new file mode 100644 index 0000000..ffeac18 --- /dev/null +++ b/src/api/sanitation/statistics.js @@ -0,0 +1,22 @@ + +/** + * 考核统计接口 + */ +import request from '@/utils/request' +// 公厕保洁次数统计 +export function getToiletJobCount(params) { + return request({ + url: '/sanitation/statistic/toilet/jobCount', + method: 'get', + params + }) +} + +// 公厕评分统计 +export function getToiletEvaluation(params) { + return request({ + url: '/sanitation/toiletEvaluation/statistics', + method: 'get', + params + }) +} diff --git a/src/api/sanitation/toilet.js b/src/api/sanitation/toilet.js new file mode 100644 index 0000000..11affd4 --- /dev/null +++ b/src/api/sanitation/toilet.js @@ -0,0 +1,133 @@ +/** + * 公厕管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' +// 公厕查询 +export function getToiletListPage(params) { + return request({ + url: '/sanitation/toilet/listPage', + method: 'get', + params + }) +} +// 公厕查询 +export function getToiletList(pid) { + return request({ + url: '/sanitation/toilet/list', + method: 'get', + params: { + pid: pid + } + }) +} + +// 添加公厕 +export function addToilet(params) { + return request({ + url: '/sanitation/toilet/add', + method: 'post', + params + }) +} +// 修改公厕机构 +export function updateToilet(params) { + return request({ + url: '/sanitation/toilet/update', + method: 'post', + params + }) +} +// 删除公厕机构 +export function delToilet(ids) { + return request({ + url: '/sanitation/toilet/delete', + method: 'post', + params: { + ids + }, + paramsSerializer: params => { + return qs.stringify(params, { indices: false }) + } + }) +} + +// 公厕基本信息详情 +export function getToiletInfoDetail(id) { + return request({ + url: '/sanitation/toilet/detail?toiletId=' + id, + method: 'get' + }) +} + +// 某公厕保洁记录 +export function getRecordsByToilet(params) { + return request({ + url: '/sanitation/toilet/jobRecord/detail', + method: 'get', + params + }) +} + +// 某公厕平均评分 +export function getScoreByToilet(params) { + return request({ + url: '/sanitation/toiletEvaluation/detailScore', + method: 'get', + params + }) +} + +// 某公厕评分列表 +export function getScoreListByToilet(params) { + return request({ + url: '/sanitation/toiletEvaluation/list', + method: 'get', + params + }) +} + + +// 批量导入 +export function batchImportToilet(fileobj) { + const param = new FormData() + param.append('file', fileobj) + return request({ + url: '/sanitation/toilet/import', + method: 'post', + headers: { 'Content-Type': 'multipart/form-data' }, + data: param + }) +} +// 批量导出 +export function batchExportToilet(params, config) { + return request({ + url: '/sanitation/toilet/export', + method: 'get', + timeout: 120000, + params, + ...config, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 公厕保洁记录查询 +export function getToiletJobRecords(params) { + return request({ + url: '/sanitation/toilet/jobRecord', + method: 'get', + params + }) +} + +// 批量导出 +export function batchExportToiletJobRecords(params, config) { + return request({ + url: '/sanitation/toilet/exportJobRecord', + method: 'get', + timeout: 120000, + params, + ...config, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} diff --git a/src/api/system/alarm.js b/src/api/system/alarm.js new file mode 100644 index 0000000..1c3a7ab --- /dev/null +++ b/src/api/system/alarm.js @@ -0,0 +1,62 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' + +// 获取当前报警列表 +export function getAlarmNowList(params) { + return request({ + url: '/alarm/listNowPage', + method: 'get', + params + }) +} + +// 获取当前报警列表 +export function getAlarmHistoryList(params) { + return request({ + url: '/alarm/listHisPage', + method: 'get', + params + }) +} + + +// 批量消警 +export function clearAll(params) { + return request({ + url: '/alarm/allClear', + method: 'get', + params + }) +} + +// 消警 +export function clearAlarm(params) { + return request({ + url: '/alarm/cancel', + method: 'get', + params + }) +} + +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 设置报警阈值 +export function setThresh(params) { + return request({ + url: '/alarm/resetAlarmRule', + method: 'post', + params + }) +} diff --git a/src/api/system/bridge.js b/src/api/system/bridge.js new file mode 100644 index 0000000..e8a4108 --- /dev/null +++ b/src/api/system/bridge.js @@ -0,0 +1,80 @@ +/** + * 桥梁管理接口 + */ +import request from '@/utils/request' + +// 获取桥梁详情 +export function getDetail(id) { + return request({ + url: '/bridge/detail', + method: 'get', + params: { + id: id + } + }) +} + +export function updateBridge(params) { + return request({ + url: '/bridge/update', + method: 'post', + params + }) +} +// 批量导出 +export function exportRecords(params) { + return request({ + url: 'device/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +export function getContentList(params) { + return request({ + url: 'maintain/contentByType', + method: 'get', + params: { + type: params + } + }) +} +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 编辑 +export function editRecord(params) { + return request({ + url: 'maintain/update', + method: 'post', + params + }) +} +// 新增 +export function addRecord(params) { + return request({ + url: 'maintain/add', + method: 'post', + params + }) +} +// 删除 +export function delRecord(id) { + return request({ + url: 'maintain/delete', + method: 'post', + params: { + id: id + } + }) +} diff --git a/src/api/system/data.js b/src/api/system/data.js new file mode 100644 index 0000000..4c95db5 --- /dev/null +++ b/src/api/system/data.js @@ -0,0 +1,63 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' + +// 获取当前报警列表 +export function getHistoryList(params) { + return request({ + url: '/data/hisListPage', + method: 'get', + params + }) +} + +// 获取当前报警列表 +export function getHistory(params) { + return request({ + url: '/data/hisList', + method: 'get', + params + }) +} + + + +// 批量消警 +export function clearAll(params) { + return request({ + url: '/alarm/allClear', + method: 'get', + params + }) +} + +// 消警 +export function clearAlarm(params) { + return request({ + url: '/alarm/cancel', + method: 'get', + params + }) +} + +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 设置报警阈值 +export function setThresh(params) { + return request({ + url: '/alarm/resetAlarmRule', + method: 'post', + params + }) +} diff --git a/src/api/system/order.js b/src/api/system/order.js new file mode 100644 index 0000000..7007c50 --- /dev/null +++ b/src/api/system/order.js @@ -0,0 +1,71 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +// import qs from 'qs' + +// 获取当前报警列表 +export function getRecordList(params) { + return request({ + url: '/maintain/listPage', + method: 'get', + params + }) +} +// 批量导出 +export function exportRecords(params) { + return request({ + url: 'device/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +export function getContentList(params) { + return request({ + url: 'maintain/contentByType', + method: 'get', + params: { + type: params + } + }) +} +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 编辑 +export function editRecord(params) { + return request({ + url: 'maintain/update', + method: 'post', + params + }) +} +// 新增 +export function addRecord(params) { + return request({ + url: 'maintain/add', + method: 'post', + params + }) +} +// 删除 +export function delRecord(id) { + return request({ + url: 'maintain/delete', + method: 'post', + params: { + bridgeMaintenanceId: id + } + }) +} diff --git a/src/api/system/overview.js b/src/api/system/overview.js new file mode 100644 index 0000000..bca50cc --- /dev/null +++ b/src/api/system/overview.js @@ -0,0 +1,109 @@ +import request from '@/utils/request' +import qs from "qs" +import Vue from 'vue' + +// 路灯状态统计 +export function getLampStatus() { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampStatus', + method: 'get' + }) +} + +// 路灯总览列表 +export function getLampList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampList', + method: 'get', + params + }) +} + +// 路灯详情 +export function getlampDetail(lampId) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampDetail', + method: 'get', + params: { + lampId: lampId + } + }) +} + +// 回路列表 +export function getCircuitList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/circuitList', + method: 'get', + params + }) +} + +// 灯箱列表 +export function getLampBoxList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampBoxList', + method: 'get', + params + }) +} +// 灯箱详情 +export function getLampBoxDetail(lampBoxId) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampBoxDetail', + method: 'get', + params: { + lampBoxId: lampBoxId + } + }) +} + +// 报警总览列表 +export function getAlarmList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/alarmList', + method: 'get', + params + }) +} + +// 报警详情 +export function getAlarmDetail(alarmId) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/alarmDetail', + method: 'get', + params: { + alarmId: alarmId + } + }) +} + +// 路灯控制 +export function lampControl(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampControl', + method: 'post', + params, + paramsSerializer: params => { + return qs.stringify(params, { indices: false }) + } + }) +} diff --git a/src/api/system/rule.js b/src/api/system/rule.js new file mode 100644 index 0000000..76c6b2d --- /dev/null +++ b/src/api/system/rule.js @@ -0,0 +1,59 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +// import qs from 'qs' + +// 获取当前报警列表 +export function getRuleList() { + return request({ + url: 'rule/listPage', + method: 'get' + }) +} +export function getContentList(params) { + return request({ + url: 'maintain/contentByType', + method: 'get', + params: { + type: params + } + }) +} +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 编辑 +export function editRecord(params) { + return request({ + url: 'maintain/update', + method: 'post', + params + }) +} +// 新增 +export function addRecord(params) { + return request({ + url: 'maintain/add', + method: 'post', + params + }) +} +// 删除 +export function delRecord(id) { + return request({ + url: 'maintain/delete', + method: 'post', + params: { + id: id + } + }) +} diff --git a/src/api/system/statistics.js b/src/api/system/statistics.js new file mode 100644 index 0000000..b25efe9 --- /dev/null +++ b/src/api/system/statistics.js @@ -0,0 +1,23 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +// import qs from 'qs' + +// +export function countByToilet(params) { + return request({ + url: '/sanitation/toiletStatistic/jobStaticByToilet', + method: 'get', + params + }) +} + +export function countByDay(params) { + return request({ + url: '/sanitation/toiletStatistic/jobStaticByDate', + method: 'get', + params + }) +} + diff --git a/src/assets/global_images/icon-position.png b/src/assets/global_images/icon-position.png new file mode 100644 index 0000000..7444038 --- /dev/null +++ b/src/assets/global_images/icon-position.png Binary files differ diff --git a/src/assets/global_images/location_green.png b/src/assets/global_images/location_green.png new file mode 100644 index 0000000..aa8be65 --- /dev/null +++ b/src/assets/global_images/location_green.png Binary files differ diff --git a/src/assets/global_images/location_red.png b/src/assets/global_images/location_red.png new file mode 100644 index 0000000..2be8c3d --- /dev/null +++ b/src/assets/global_images/location_red.png Binary files differ diff --git a/src/assets/global_images/location_yellow.png b/src/assets/global_images/location_yellow.png new file mode 100644 index 0000000..5ab6f4d --- /dev/null +++ b/src/assets/global_images/location_yellow.png Binary files differ diff --git a/src/assets/global_images/toilet-position.png b/src/assets/global_images/toilet-position.png new file mode 100644 index 0000000..7db6d9a --- /dev/null +++ b/src/assets/global_images/toilet-position.png Binary files differ diff --git a/src/assets/global_images/toilet.png b/src/assets/global_images/toilet.png new file mode 100644 index 0000000..6d9fc05 --- /dev/null +++ b/src/assets/global_images/toilet.png Binary files differ diff --git a/src/assets/global_images/toiletPhoto.png b/src/assets/global_images/toiletPhoto.png new file mode 100644 index 0000000..15d08e2 --- /dev/null +++ b/src/assets/global_images/toiletPhoto.png Binary files differ diff --git a/src/components/DownloadTemplate/index.vue b/src/components/DownloadTemplate/index.vue index 8ded2cd..7807cac 100644 --- a/src/components/DownloadTemplate/index.vue +++ b/src/components/DownloadTemplate/index.vue @@ -47,8 +47,8 @@ diff --git a/src/components/NormalTable/index.vue b/src/components/NormalTable/index.vue index 5077bef..04d322d 100644 --- a/src/components/NormalTable/index.vue +++ b/src/components/NormalTable/index.vue @@ -79,7 +79,7 @@
-
+
Object.assign(obj, { [key]: this[key] }), {}), + on: events.reduce((obj, key) => Object.assign(obj, { [key]: this.transmitEvent }), {}) + }) + } + this.props = [...extraProps, ...props.filter(prop => exceptProps.indexOf(prop))] + } +} + +export default prop => new Mixin(prop) diff --git a/src/components/mapWindow/base/mixins/common.js b/src/components/mapWindow/base/mixins/common.js new file mode 100644 index 0000000..2fd1a28 --- /dev/null +++ b/src/components/mapWindow/base/mixins/common.js @@ -0,0 +1,82 @@ +const types = { + map: { + unload: 'clearMap' + }, + control: { + unload: 'removeControl' + }, + layer: { + unload: 'removeLayer' + }, + features: { + unload: 'removeFeatures' + }, + listener: { + unload: 'removeListener' + } +} + +const getParent = $component => ($component.abstract || $component.$el === $component.$children[0].$el) ? getParent($component.$parent) : $component + +function destroyInstance () { + const { unload, renderByParent, $parent } = this + if (renderByParent) { + $parent.reload() + } + unload() +} + +class Mixin { + constructor (prop) { + this.methods = { + ready () { + const $parent = getParent(this.$parent) + const map = this.map = $parent.map + this.load() + this.$emit('ready', { + map + }) + }, + transmitEvent (e) { + this.$emit(e.type.replace(/^on/, ''), e) + }, + reload () { + this && this.$nextTick(() => { + this.unload() + this.$nextTick(this.load) + }) + }, + unload () { + const { map, originInstance } = this + try { + switch (prop.type) { + case 'search': + return originInstance.clearResults() + case 'autoComplete': + case 'lushu': + return originInstance.dispose() + case 'markerClusterer': + return originInstance.clearMarkers() + default: + map[types[prop.type].unload](originInstance) + } + } catch (e) {} + } + } + this.computed = { + renderByParent () { + return this.$parent.preventChildrenRender + } + } + this.mounted = function () { + console.log('common mounted') + const $parent = getParent(this.$parent) + const map = $parent.map + const { ready } = this + console.log(map) + map ? ready() : $parent.$on('onload', ready) + } + } +} + +export default type => new Mixin({ type }) diff --git a/src/components/mapWindow/leafletMap.vue b/src/components/mapWindow/leafletMap.vue new file mode 100644 index 0000000..b753cc0 --- /dev/null +++ b/src/components/mapWindow/leafletMap.vue @@ -0,0 +1,143 @@ + + + + + + + diff --git a/src/components/mapWindow/mapWindow.vue b/src/components/mapWindow/mapWindow.vue new file mode 100644 index 0000000..9ced291 --- /dev/null +++ b/src/components/mapWindow/mapWindow.vue @@ -0,0 +1,46 @@ + + + + + + diff --git a/src/icons/svg/bridge.svg b/src/icons/svg/bridge.svg new file mode 100644 index 0000000..1a0336f --- /dev/null +++ b/src/icons/svg/bridge.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/icons/svg/toilet.svg b/src/icons/svg/toilet.svg new file mode 100644 index 0000000..9d8e765 --- /dev/null +++ b/src/icons/svg/toilet.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/main.js b/src/main.js index f2d105d..3e4074e 100644 --- a/src/main.js +++ b/src/main.js @@ -18,6 +18,9 @@ // echart // import echarts from 'echarts' // Vue.prototype.$echarts = echarts +// 引入v-charts +import VCharts from 'v-charts' +Vue.use(VCharts) // 将自动注册所有组件为全局组件 // import dataV from '@jiaminghi/data-view' @@ -35,9 +38,19 @@ Vue.component('search-item', SearchItem) // 加载leaflet的css +// import 'leaflet/dist/leaflet.css' +// import 'leaflet-draw/dist/leaflet.draw.css' +import L from 'leaflet' import 'leaflet/dist/leaflet.css' -import 'leaflet-draw/dist/leaflet.draw.css' +Vue.config.productionTip = false +Vue.L = Vue.prototype.$L = L +delete L.Icon.Default.prototype._getIconUrl +L.Icon.Default.mergeOptions({ + iconRetinaUrl: require('leaflet/dist/images/marker-icon-2x.png'), + iconUrl: require('leaflet/dist/images/marker-icon.png'), + shadowUrl: require('leaflet/dist/images/marker-shadow.png') +}) /** * This project originally used easy-mock to simulate data, * but its official service is very unstable, diff --git a/src/permission.js b/src/permission.js index dc6b2f8..809ca86 100644 --- a/src/permission.js +++ b/src/permission.js @@ -25,8 +25,8 @@ store.dispatch('GetInfo').then(res => { // 拉取用户信息 // 设置当前子系统为基础资源子系统 const currentSys = { - code: 'baseResourse', - name: '基础资源子系统' + code: 'toliet', + name: '公共厕所管理系统' } // 将当前系统信息保存在localStorage中 store.commit('SET_SYSTEM', currentSys) diff --git a/src/router/index.js b/src/router/index.js index 39c295c..d23076d 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -8,8 +8,11 @@ /* Layout */ import Layout from '@/layout/Layout' +import { toiletRouters } from './modules/toilet' +import { workRouters } from './modules/work' +import { statisticsRouters } from './modules/statistics' +import { ruleRouters } from './modules/rule' import { systemRouters } from './modules/system' -import { exampleRouters } from './modules/example' /** * hidden: true if `hidden:true` will not show in the sidebar(default is false) @@ -40,11 +43,12 @@ ] }, // 登录页面 - { path: '/login', component: () => import('@/views/login/index'), hidden: true }, + { path: '/login', component: () => import('@/views/login/index_2'), hidden: true }, // 404错误页面 { path: '/404', component: () => import('@/views/errorPage/404'), hidden: true }, // 401 错误页面 - { path: '/401', component: () => import('@/views/errorPage/401'), hidden: true } + { path: '/401', component: () => import('@/views/errorPage/401'), hidden: true }, + { path: '/', redirect: '/toiletList', hidden: true } ] // 实例化vue的时候直挂载constantRouter export default new Router({ @@ -56,7 +60,10 @@ // 异步挂载路由 // 动态需要根据权限加载的路由表 export const asyncRouterMap = [ - ...exampleRouters, - ...systemRouters, + ...toiletRouters, + ...workRouters, + ...statisticsRouters, + ...ruleRouters, + // ...systemRouters, { path: '*', redirect: '/404', hidden: true } ] diff --git a/src/router/modules/rule.js b/src/router/modules/rule.js new file mode 100644 index 0000000..51e0283 --- /dev/null +++ b/src/router/modules/rule.js @@ -0,0 +1,24 @@ +/* Layout */ +import Layout from '@/layout/Layout' + +export const ruleRouters = [ + { + path: 'rule', + component: Layout, + redirect: '/rule', + name: 'Rule', + meta: { + title: '规章制度', + icon: 'icon-config', // 图标 + permission: ['/rule']// 权限名称 + }, + children: [ + { + path: '/rule', + name: 'Rule', + component: () => import('@/views/rule/listRule'), + meta: { title: '规章制度', icon: 'function', permission: ['/rule'] } + } + ] + } +] diff --git a/src/router/modules/statistics.js b/src/router/modules/statistics.js new file mode 100644 index 0000000..fb9cbea --- /dev/null +++ b/src/router/modules/statistics.js @@ -0,0 +1,30 @@ +/* Layout */ +import Layout from '@/layout/Layout' + +export const statisticsRouters = [ + { + path: 'statisticsToilet', + component: Layout, + redirect: '/workStatistics', + name: 'StatisticsToilet', + meta: { + title: '作业统计', + icon: 'icon-config', // 图标 + permission: ['/statisticsToilet']// 权限名称 + }, + children: [ + { + path: '/workStatistics', + name: 'WorkStatistics', + component: () => import('@/views/statistics/toiletAssessment'), + meta: { title: '作业统计', icon: '', permission: ['/toilet/workStatistics'] } + }, + { + path: '/evaluationStatistics', + name: 'EvaluationStatistics', + component: () => import('@/views/statistics/evaluationAssessment'), + meta: { title: '评价统计', icon: '', permission: ['/toilet/evaluationStatistics'] } + } + ] + } +] diff --git a/src/router/modules/toilet.js b/src/router/modules/toilet.js new file mode 100644 index 0000000..b221a0e --- /dev/null +++ b/src/router/modules/toilet.js @@ -0,0 +1,30 @@ +/* Layout */ +import Layout from '@/layout/Layout' + +export const toiletRouters = [ + { + path: 'toiletManage', + component: Layout, + redirect: '/toiletManage', + name: 'ToiletManage', + meta: { + title: '公厕管理', + icon: 'icon-config', // 图标 + permission: ['/toiletManage']// 权限名称 + }, + children: [ + { + path: '/toiletList', + name: 'ToiletList', + component: () => import('@/views/toiletManage/toiletList'), + meta: { title: '公厕台帐管理', icon: 'function', permission: ['/toiletList'] } + }, + { + path: '/toiletMap', + name: 'ToiletMap', + component: () => import('@/views/overview/overview'), + meta: { title: '地图总览', icon: 'function', permission: ['/toiletMap'] } + } + ] + } +] diff --git a/src/router/modules/work.js b/src/router/modules/work.js new file mode 100644 index 0000000..5e0759f --- /dev/null +++ b/src/router/modules/work.js @@ -0,0 +1,24 @@ +/* Layout */ +import Layout from '@/layout/Layout' + +export const workRouters = [ + { + path: 'toiletWork', + component: Layout, + redirect: '/toiletManage', + name: 'toiletWork', + meta: { + title: '作业管理', + icon: 'icon-config', // 图标 + permission: ['/toiletWork']// 权限名称 + }, + children: [ + { + path: '/toiletWork', + name: 'ToiletWork', + component: () => import('@/views/toiletClean/toiletCleanList'), + meta: { title: '作业管理', icon: 'function', permission: ['/toiletWork'] } + } + ] + } +] diff --git a/src/settings.js b/src/settings.js index b568ce0..b8159bf 100644 --- a/src/settings.js +++ b/src/settings.js @@ -3,7 +3,7 @@ * @type {boolean} true | false * @description 是否显示设置按钮 */ - showSettings: true, + showSettings: false, /** * @type {boolean} true | false diff --git a/src/store/modules/permission.js b/src/store/modules/permission.js index a0cb8cf..3ab50d5 100644 --- a/src/store/modules/permission.js +++ b/src/store/modules/permission.js @@ -120,17 +120,23 @@ }) }, // 获取用户权限 - GetMenus({ commit, state }) { - console.log('in store.permission.js:GetMenus:') + GetMenus({ commit, state }, currentSystem) { + // console.log('in store.permission.js:GetMenus:') + console.log('获取' + currentSystem.name + '的菜单') + const params = { + parentCode: currentSystem.code // 传入该子系统的code,获取子系统的权限 + } return new Promise((resolve, reject) => { - getMenus(state.token).then(response => { // 处理返回值 + // 此处获取用户所有权限 + getMenus(params).then(response => { // 处理返回值 const data = response.data const menus = [] // 仅菜单 const btns = [] // 非菜单 if (data.menus && data.menus.length > 0) { - commit('SET_MENUS', data.menus) - for (const menu of data.menus) { // 遍历菜单,获取所有的权限项 - if (menu.ismenu === '1') { // 将是菜单的放入menus + const allmenus = [...data.menus] + commit('SET_MENUS', allmenus) + for (const menu of allmenus) { // 遍历菜单,获取所有的权限项 + if (menu.resourceType === '02' || menu.resourceType === '03') { // 将是菜单的放入menus const menu_tmp = {} menu_tmp.url = menu.url menu_tmp.icon = menu.icon @@ -142,11 +148,11 @@ btn_tmp.name = menu.name btn_tmp.icon = menu.icon btns.push(btn_tmp) - // console.log(menu.url) } } // 过滤路由表 - const accessedRouters = filterAsyncRouter(asyncRouterMap, menus) + let accessedRouters = filterAsyncRouter(asyncRouterMap, menus) + // accessedRouters = filterRedirect(accessedRouters) commit('SET_BTNS', btns) commit('SET_ROUTERS', accessedRouters) resolve(response) diff --git a/src/utils/baseConfig.js b/src/utils/baseConfig.js index 1f4fa38..999593e 100644 --- a/src/utils/baseConfig.js +++ b/src/utils/baseConfig.js @@ -1,5 +1,5 @@ const project = { - title: '后台管理系统前端基础框架' + title: '路桥养护子系统' } export function getProject() { return project diff --git a/src/utils/dateutils.js b/src/utils/dateutils.js index 868111a..5cd16af 100644 --- a/src/utils/dateutils.js +++ b/src/utils/dateutils.js @@ -15,15 +15,15 @@ return ct_month } -export function getLastWeek() { // 默认显示上周 +export function getLastWeek(fmt) { // 默认显示上周 const ct_month = new Date() ct_month.setTime(ct_month.getTime() - 3600 * 1000 * 24 * 7) - return ct_month + return ct_month.Format(fmt) } -export function getLastMonth() { // 默认显示上个月 +export function getLastMonth(fmt) { // 默认显示上个月 const ct_month = new Date() ct_month.setTime(ct_month.getTime() - 3600 * 1000 * 24 * 30) - return ct_month + return ct_month.Format(fmt) } // 对Date的扩展,将 Date 转化为指定格式的String diff --git a/src/utils/exportutils.js b/src/utils/exportutils.js new file mode 100644 index 0000000..b5d0bcf --- /dev/null +++ b/src/utils/exportutils.js @@ -0,0 +1,19 @@ +/** + * 导出文件工具 + * @param blob 文件 + * @param fileName 导出文件名 + */ +export function exportFile(blob, fileName) { + if (window.navigator && window.navigator.msSaveOrOpenBlob) { + navigator.msSaveBlob(blob, fileName) + } else { + const downloadElement = document.createElement('a') + const href = window.URL.createObjectURL(blob) // 创建下载的链接 + downloadElement.href = href + downloadElement.download = fileName + document.body.appendChild(downloadElement) + downloadElement.click() // 点击下载 + document.body.removeChild(downloadElement) // 下载完成移除元素 + window.URL.revokeObjectURL(href) // 释放blob对象 + } +} diff --git a/src/utils/request.js b/src/utils/request.js index c88ea76..dc56e26 100644 --- a/src/utils/request.js +++ b/src/utils/request.js @@ -17,6 +17,13 @@ config.headers['token'] = getToken() // 让每个请求携带自定义token 请根据实际情况自行修改 console.log(config.headers['token']) } + // 在接口增加时间戳 + // if (config.method === 'get') { + config.params = { + _t: Date.parse(new Date()) / 1000, + ...config.params + } + // } return config }, error => { diff --git a/src/views/mapViews/choosePointDialog.vue b/src/views/mapViews/choosePointDialog.vue new file mode 100644 index 0000000..c9dde8a --- /dev/null +++ b/src/views/mapViews/choosePointDialog.vue @@ -0,0 +1,105 @@ + + + + + diff --git a/src/views/mapViews/mapView.vue b/src/views/mapViews/mapView.vue new file mode 100644 index 0000000..a18db88 --- /dev/null +++ b/src/views/mapViews/mapView.vue @@ -0,0 +1,73 @@ + + + + + diff --git a/src/views/order/editOrder.vue b/src/views/order/editOrder.vue new file mode 100644 index 0000000..4a5fd8a --- /dev/null +++ b/src/views/order/editOrder.vue @@ -0,0 +1,319 @@ + + + + + diff --git a/src/views/order/listMaintainRecords.vue b/src/views/order/listMaintainRecords.vue new file mode 100644 index 0000000..2d4f682 --- /dev/null +++ b/src/views/order/listMaintainRecords.vue @@ -0,0 +1,327 @@ + + + + + diff --git a/src/views/overview/overview.vue b/src/views/overview/overview.vue new file mode 100644 index 0000000..9525867 --- /dev/null +++ b/src/views/overview/overview.vue @@ -0,0 +1,285 @@ + + + + + diff --git a/src/views/overview/toiletDetailDialog.vue b/src/views/overview/toiletDetailDialog.vue new file mode 100644 index 0000000..2b3a511 --- /dev/null +++ b/src/views/overview/toiletDetailDialog.vue @@ -0,0 +1,263 @@ + + + + + + diff --git a/src/views/overview/toiletLayer.vue b/src/views/overview/toiletLayer.vue new file mode 100644 index 0000000..d784323 --- /dev/null +++ b/src/views/overview/toiletLayer.vue @@ -0,0 +1,152 @@ + + + + + + diff --git a/config/index.js b/config/index.js index 8abd37a..19b33b1 100644 --- a/config/index.js +++ b/config/index.js @@ -69,7 +69,7 @@ * then assetsPublicPath should be set to "/bar/". * In most cases please use '/' !!! */ - assetsPublicPath: '/', + assetsPublicPath: '/toilet/', /** * Source Maps diff --git a/package.json b/package.json index 45f055f..9f3a3eb 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "echarts": "^4.2.1", "element-ui": "2.13.0", "event-source-polyfill": "^1.0.5", + "file-saver": "^2.0.5", "js-cookie": "2.2.0", "jsencrypt": "^3.0.0-rc.1", "leaflet": "^1.7.1", @@ -33,7 +34,9 @@ "vue-amap": "^0.5.9", "vue-baidu-map": "^0.21.22", "vue-router": "3.0.1", - "vuex": "3.0.1" + "vue2-leaflet": "^2.7.0", + "vuex": "3.0.1", + "xlsx": "^0.17.0" }, "devDependencies": { "autoprefixer": "8.5.0", diff --git a/src/api/common.js b/src/api/common.js index 87c582b..7804714 100644 --- a/src/api/common.js +++ b/src/api/common.js @@ -2,10 +2,14 @@ * 常用接口 */ import request from '@/utils/request' +import Vue from 'vue' + // 模板下载 export function downloadTemplate(fileName) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath return request({ - url: 'template/download', + url: lampPath + 'template/download', method: 'get', params: { filename: fileName @@ -19,7 +23,7 @@ const param = new FormData() param.append('file', fileobj.file) return request({ - url: 'imageUpload', + url: 'fileUpload', method: 'post', headers: { 'Content-Type': 'multipart/form-data' }, data: param diff --git a/src/api/sanitation/statistics.js b/src/api/sanitation/statistics.js new file mode 100644 index 0000000..ffeac18 --- /dev/null +++ b/src/api/sanitation/statistics.js @@ -0,0 +1,22 @@ + +/** + * 考核统计接口 + */ +import request from '@/utils/request' +// 公厕保洁次数统计 +export function getToiletJobCount(params) { + return request({ + url: '/sanitation/statistic/toilet/jobCount', + method: 'get', + params + }) +} + +// 公厕评分统计 +export function getToiletEvaluation(params) { + return request({ + url: '/sanitation/toiletEvaluation/statistics', + method: 'get', + params + }) +} diff --git a/src/api/sanitation/toilet.js b/src/api/sanitation/toilet.js new file mode 100644 index 0000000..11affd4 --- /dev/null +++ b/src/api/sanitation/toilet.js @@ -0,0 +1,133 @@ +/** + * 公厕管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' +// 公厕查询 +export function getToiletListPage(params) { + return request({ + url: '/sanitation/toilet/listPage', + method: 'get', + params + }) +} +// 公厕查询 +export function getToiletList(pid) { + return request({ + url: '/sanitation/toilet/list', + method: 'get', + params: { + pid: pid + } + }) +} + +// 添加公厕 +export function addToilet(params) { + return request({ + url: '/sanitation/toilet/add', + method: 'post', + params + }) +} +// 修改公厕机构 +export function updateToilet(params) { + return request({ + url: '/sanitation/toilet/update', + method: 'post', + params + }) +} +// 删除公厕机构 +export function delToilet(ids) { + return request({ + url: '/sanitation/toilet/delete', + method: 'post', + params: { + ids + }, + paramsSerializer: params => { + return qs.stringify(params, { indices: false }) + } + }) +} + +// 公厕基本信息详情 +export function getToiletInfoDetail(id) { + return request({ + url: '/sanitation/toilet/detail?toiletId=' + id, + method: 'get' + }) +} + +// 某公厕保洁记录 +export function getRecordsByToilet(params) { + return request({ + url: '/sanitation/toilet/jobRecord/detail', + method: 'get', + params + }) +} + +// 某公厕平均评分 +export function getScoreByToilet(params) { + return request({ + url: '/sanitation/toiletEvaluation/detailScore', + method: 'get', + params + }) +} + +// 某公厕评分列表 +export function getScoreListByToilet(params) { + return request({ + url: '/sanitation/toiletEvaluation/list', + method: 'get', + params + }) +} + + +// 批量导入 +export function batchImportToilet(fileobj) { + const param = new FormData() + param.append('file', fileobj) + return request({ + url: '/sanitation/toilet/import', + method: 'post', + headers: { 'Content-Type': 'multipart/form-data' }, + data: param + }) +} +// 批量导出 +export function batchExportToilet(params, config) { + return request({ + url: '/sanitation/toilet/export', + method: 'get', + timeout: 120000, + params, + ...config, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 公厕保洁记录查询 +export function getToiletJobRecords(params) { + return request({ + url: '/sanitation/toilet/jobRecord', + method: 'get', + params + }) +} + +// 批量导出 +export function batchExportToiletJobRecords(params, config) { + return request({ + url: '/sanitation/toilet/exportJobRecord', + method: 'get', + timeout: 120000, + params, + ...config, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} diff --git a/src/api/system/alarm.js b/src/api/system/alarm.js new file mode 100644 index 0000000..1c3a7ab --- /dev/null +++ b/src/api/system/alarm.js @@ -0,0 +1,62 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' + +// 获取当前报警列表 +export function getAlarmNowList(params) { + return request({ + url: '/alarm/listNowPage', + method: 'get', + params + }) +} + +// 获取当前报警列表 +export function getAlarmHistoryList(params) { + return request({ + url: '/alarm/listHisPage', + method: 'get', + params + }) +} + + +// 批量消警 +export function clearAll(params) { + return request({ + url: '/alarm/allClear', + method: 'get', + params + }) +} + +// 消警 +export function clearAlarm(params) { + return request({ + url: '/alarm/cancel', + method: 'get', + params + }) +} + +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 设置报警阈值 +export function setThresh(params) { + return request({ + url: '/alarm/resetAlarmRule', + method: 'post', + params + }) +} diff --git a/src/api/system/bridge.js b/src/api/system/bridge.js new file mode 100644 index 0000000..e8a4108 --- /dev/null +++ b/src/api/system/bridge.js @@ -0,0 +1,80 @@ +/** + * 桥梁管理接口 + */ +import request from '@/utils/request' + +// 获取桥梁详情 +export function getDetail(id) { + return request({ + url: '/bridge/detail', + method: 'get', + params: { + id: id + } + }) +} + +export function updateBridge(params) { + return request({ + url: '/bridge/update', + method: 'post', + params + }) +} +// 批量导出 +export function exportRecords(params) { + return request({ + url: 'device/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +export function getContentList(params) { + return request({ + url: 'maintain/contentByType', + method: 'get', + params: { + type: params + } + }) +} +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 编辑 +export function editRecord(params) { + return request({ + url: 'maintain/update', + method: 'post', + params + }) +} +// 新增 +export function addRecord(params) { + return request({ + url: 'maintain/add', + method: 'post', + params + }) +} +// 删除 +export function delRecord(id) { + return request({ + url: 'maintain/delete', + method: 'post', + params: { + id: id + } + }) +} diff --git a/src/api/system/data.js b/src/api/system/data.js new file mode 100644 index 0000000..4c95db5 --- /dev/null +++ b/src/api/system/data.js @@ -0,0 +1,63 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' + +// 获取当前报警列表 +export function getHistoryList(params) { + return request({ + url: '/data/hisListPage', + method: 'get', + params + }) +} + +// 获取当前报警列表 +export function getHistory(params) { + return request({ + url: '/data/hisList', + method: 'get', + params + }) +} + + + +// 批量消警 +export function clearAll(params) { + return request({ + url: '/alarm/allClear', + method: 'get', + params + }) +} + +// 消警 +export function clearAlarm(params) { + return request({ + url: '/alarm/cancel', + method: 'get', + params + }) +} + +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 设置报警阈值 +export function setThresh(params) { + return request({ + url: '/alarm/resetAlarmRule', + method: 'post', + params + }) +} diff --git a/src/api/system/order.js b/src/api/system/order.js new file mode 100644 index 0000000..7007c50 --- /dev/null +++ b/src/api/system/order.js @@ -0,0 +1,71 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +// import qs from 'qs' + +// 获取当前报警列表 +export function getRecordList(params) { + return request({ + url: '/maintain/listPage', + method: 'get', + params + }) +} +// 批量导出 +export function exportRecords(params) { + return request({ + url: 'device/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +export function getContentList(params) { + return request({ + url: 'maintain/contentByType', + method: 'get', + params: { + type: params + } + }) +} +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 编辑 +export function editRecord(params) { + return request({ + url: 'maintain/update', + method: 'post', + params + }) +} +// 新增 +export function addRecord(params) { + return request({ + url: 'maintain/add', + method: 'post', + params + }) +} +// 删除 +export function delRecord(id) { + return request({ + url: 'maintain/delete', + method: 'post', + params: { + bridgeMaintenanceId: id + } + }) +} diff --git a/src/api/system/overview.js b/src/api/system/overview.js new file mode 100644 index 0000000..bca50cc --- /dev/null +++ b/src/api/system/overview.js @@ -0,0 +1,109 @@ +import request from '@/utils/request' +import qs from "qs" +import Vue from 'vue' + +// 路灯状态统计 +export function getLampStatus() { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampStatus', + method: 'get' + }) +} + +// 路灯总览列表 +export function getLampList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampList', + method: 'get', + params + }) +} + +// 路灯详情 +export function getlampDetail(lampId) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampDetail', + method: 'get', + params: { + lampId: lampId + } + }) +} + +// 回路列表 +export function getCircuitList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/circuitList', + method: 'get', + params + }) +} + +// 灯箱列表 +export function getLampBoxList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampBoxList', + method: 'get', + params + }) +} +// 灯箱详情 +export function getLampBoxDetail(lampBoxId) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampBoxDetail', + method: 'get', + params: { + lampBoxId: lampBoxId + } + }) +} + +// 报警总览列表 +export function getAlarmList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/alarmList', + method: 'get', + params + }) +} + +// 报警详情 +export function getAlarmDetail(alarmId) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/alarmDetail', + method: 'get', + params: { + alarmId: alarmId + } + }) +} + +// 路灯控制 +export function lampControl(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampControl', + method: 'post', + params, + paramsSerializer: params => { + return qs.stringify(params, { indices: false }) + } + }) +} diff --git a/src/api/system/rule.js b/src/api/system/rule.js new file mode 100644 index 0000000..76c6b2d --- /dev/null +++ b/src/api/system/rule.js @@ -0,0 +1,59 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +// import qs from 'qs' + +// 获取当前报警列表 +export function getRuleList() { + return request({ + url: 'rule/listPage', + method: 'get' + }) +} +export function getContentList(params) { + return request({ + url: 'maintain/contentByType', + method: 'get', + params: { + type: params + } + }) +} +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 编辑 +export function editRecord(params) { + return request({ + url: 'maintain/update', + method: 'post', + params + }) +} +// 新增 +export function addRecord(params) { + return request({ + url: 'maintain/add', + method: 'post', + params + }) +} +// 删除 +export function delRecord(id) { + return request({ + url: 'maintain/delete', + method: 'post', + params: { + id: id + } + }) +} diff --git a/src/api/system/statistics.js b/src/api/system/statistics.js new file mode 100644 index 0000000..b25efe9 --- /dev/null +++ b/src/api/system/statistics.js @@ -0,0 +1,23 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +// import qs from 'qs' + +// +export function countByToilet(params) { + return request({ + url: '/sanitation/toiletStatistic/jobStaticByToilet', + method: 'get', + params + }) +} + +export function countByDay(params) { + return request({ + url: '/sanitation/toiletStatistic/jobStaticByDate', + method: 'get', + params + }) +} + diff --git a/src/assets/global_images/icon-position.png b/src/assets/global_images/icon-position.png new file mode 100644 index 0000000..7444038 --- /dev/null +++ b/src/assets/global_images/icon-position.png Binary files differ diff --git a/src/assets/global_images/location_green.png b/src/assets/global_images/location_green.png new file mode 100644 index 0000000..aa8be65 --- /dev/null +++ b/src/assets/global_images/location_green.png Binary files differ diff --git a/src/assets/global_images/location_red.png b/src/assets/global_images/location_red.png new file mode 100644 index 0000000..2be8c3d --- /dev/null +++ b/src/assets/global_images/location_red.png Binary files differ diff --git a/src/assets/global_images/location_yellow.png b/src/assets/global_images/location_yellow.png new file mode 100644 index 0000000..5ab6f4d --- /dev/null +++ b/src/assets/global_images/location_yellow.png Binary files differ diff --git a/src/assets/global_images/toilet-position.png b/src/assets/global_images/toilet-position.png new file mode 100644 index 0000000..7db6d9a --- /dev/null +++ b/src/assets/global_images/toilet-position.png Binary files differ diff --git a/src/assets/global_images/toilet.png b/src/assets/global_images/toilet.png new file mode 100644 index 0000000..6d9fc05 --- /dev/null +++ b/src/assets/global_images/toilet.png Binary files differ diff --git a/src/assets/global_images/toiletPhoto.png b/src/assets/global_images/toiletPhoto.png new file mode 100644 index 0000000..15d08e2 --- /dev/null +++ b/src/assets/global_images/toiletPhoto.png Binary files differ diff --git a/src/components/DownloadTemplate/index.vue b/src/components/DownloadTemplate/index.vue index 8ded2cd..7807cac 100644 --- a/src/components/DownloadTemplate/index.vue +++ b/src/components/DownloadTemplate/index.vue @@ -47,8 +47,8 @@ diff --git a/src/components/NormalTable/index.vue b/src/components/NormalTable/index.vue index 5077bef..04d322d 100644 --- a/src/components/NormalTable/index.vue +++ b/src/components/NormalTable/index.vue @@ -79,7 +79,7 @@
-
+
Object.assign(obj, { [key]: this[key] }), {}), + on: events.reduce((obj, key) => Object.assign(obj, { [key]: this.transmitEvent }), {}) + }) + } + this.props = [...extraProps, ...props.filter(prop => exceptProps.indexOf(prop))] + } +} + +export default prop => new Mixin(prop) diff --git a/src/components/mapWindow/base/mixins/common.js b/src/components/mapWindow/base/mixins/common.js new file mode 100644 index 0000000..2fd1a28 --- /dev/null +++ b/src/components/mapWindow/base/mixins/common.js @@ -0,0 +1,82 @@ +const types = { + map: { + unload: 'clearMap' + }, + control: { + unload: 'removeControl' + }, + layer: { + unload: 'removeLayer' + }, + features: { + unload: 'removeFeatures' + }, + listener: { + unload: 'removeListener' + } +} + +const getParent = $component => ($component.abstract || $component.$el === $component.$children[0].$el) ? getParent($component.$parent) : $component + +function destroyInstance () { + const { unload, renderByParent, $parent } = this + if (renderByParent) { + $parent.reload() + } + unload() +} + +class Mixin { + constructor (prop) { + this.methods = { + ready () { + const $parent = getParent(this.$parent) + const map = this.map = $parent.map + this.load() + this.$emit('ready', { + map + }) + }, + transmitEvent (e) { + this.$emit(e.type.replace(/^on/, ''), e) + }, + reload () { + this && this.$nextTick(() => { + this.unload() + this.$nextTick(this.load) + }) + }, + unload () { + const { map, originInstance } = this + try { + switch (prop.type) { + case 'search': + return originInstance.clearResults() + case 'autoComplete': + case 'lushu': + return originInstance.dispose() + case 'markerClusterer': + return originInstance.clearMarkers() + default: + map[types[prop.type].unload](originInstance) + } + } catch (e) {} + } + } + this.computed = { + renderByParent () { + return this.$parent.preventChildrenRender + } + } + this.mounted = function () { + console.log('common mounted') + const $parent = getParent(this.$parent) + const map = $parent.map + const { ready } = this + console.log(map) + map ? ready() : $parent.$on('onload', ready) + } + } +} + +export default type => new Mixin({ type }) diff --git a/src/components/mapWindow/leafletMap.vue b/src/components/mapWindow/leafletMap.vue new file mode 100644 index 0000000..b753cc0 --- /dev/null +++ b/src/components/mapWindow/leafletMap.vue @@ -0,0 +1,143 @@ + + + + + + + diff --git a/src/components/mapWindow/mapWindow.vue b/src/components/mapWindow/mapWindow.vue new file mode 100644 index 0000000..9ced291 --- /dev/null +++ b/src/components/mapWindow/mapWindow.vue @@ -0,0 +1,46 @@ + + + + + + diff --git a/src/icons/svg/bridge.svg b/src/icons/svg/bridge.svg new file mode 100644 index 0000000..1a0336f --- /dev/null +++ b/src/icons/svg/bridge.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/icons/svg/toilet.svg b/src/icons/svg/toilet.svg new file mode 100644 index 0000000..9d8e765 --- /dev/null +++ b/src/icons/svg/toilet.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/main.js b/src/main.js index f2d105d..3e4074e 100644 --- a/src/main.js +++ b/src/main.js @@ -18,6 +18,9 @@ // echart // import echarts from 'echarts' // Vue.prototype.$echarts = echarts +// 引入v-charts +import VCharts from 'v-charts' +Vue.use(VCharts) // 将自动注册所有组件为全局组件 // import dataV from '@jiaminghi/data-view' @@ -35,9 +38,19 @@ Vue.component('search-item', SearchItem) // 加载leaflet的css +// import 'leaflet/dist/leaflet.css' +// import 'leaflet-draw/dist/leaflet.draw.css' +import L from 'leaflet' import 'leaflet/dist/leaflet.css' -import 'leaflet-draw/dist/leaflet.draw.css' +Vue.config.productionTip = false +Vue.L = Vue.prototype.$L = L +delete L.Icon.Default.prototype._getIconUrl +L.Icon.Default.mergeOptions({ + iconRetinaUrl: require('leaflet/dist/images/marker-icon-2x.png'), + iconUrl: require('leaflet/dist/images/marker-icon.png'), + shadowUrl: require('leaflet/dist/images/marker-shadow.png') +}) /** * This project originally used easy-mock to simulate data, * but its official service is very unstable, diff --git a/src/permission.js b/src/permission.js index dc6b2f8..809ca86 100644 --- a/src/permission.js +++ b/src/permission.js @@ -25,8 +25,8 @@ store.dispatch('GetInfo').then(res => { // 拉取用户信息 // 设置当前子系统为基础资源子系统 const currentSys = { - code: 'baseResourse', - name: '基础资源子系统' + code: 'toliet', + name: '公共厕所管理系统' } // 将当前系统信息保存在localStorage中 store.commit('SET_SYSTEM', currentSys) diff --git a/src/router/index.js b/src/router/index.js index 39c295c..d23076d 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -8,8 +8,11 @@ /* Layout */ import Layout from '@/layout/Layout' +import { toiletRouters } from './modules/toilet' +import { workRouters } from './modules/work' +import { statisticsRouters } from './modules/statistics' +import { ruleRouters } from './modules/rule' import { systemRouters } from './modules/system' -import { exampleRouters } from './modules/example' /** * hidden: true if `hidden:true` will not show in the sidebar(default is false) @@ -40,11 +43,12 @@ ] }, // 登录页面 - { path: '/login', component: () => import('@/views/login/index'), hidden: true }, + { path: '/login', component: () => import('@/views/login/index_2'), hidden: true }, // 404错误页面 { path: '/404', component: () => import('@/views/errorPage/404'), hidden: true }, // 401 错误页面 - { path: '/401', component: () => import('@/views/errorPage/401'), hidden: true } + { path: '/401', component: () => import('@/views/errorPage/401'), hidden: true }, + { path: '/', redirect: '/toiletList', hidden: true } ] // 实例化vue的时候直挂载constantRouter export default new Router({ @@ -56,7 +60,10 @@ // 异步挂载路由 // 动态需要根据权限加载的路由表 export const asyncRouterMap = [ - ...exampleRouters, - ...systemRouters, + ...toiletRouters, + ...workRouters, + ...statisticsRouters, + ...ruleRouters, + // ...systemRouters, { path: '*', redirect: '/404', hidden: true } ] diff --git a/src/router/modules/rule.js b/src/router/modules/rule.js new file mode 100644 index 0000000..51e0283 --- /dev/null +++ b/src/router/modules/rule.js @@ -0,0 +1,24 @@ +/* Layout */ +import Layout from '@/layout/Layout' + +export const ruleRouters = [ + { + path: 'rule', + component: Layout, + redirect: '/rule', + name: 'Rule', + meta: { + title: '规章制度', + icon: 'icon-config', // 图标 + permission: ['/rule']// 权限名称 + }, + children: [ + { + path: '/rule', + name: 'Rule', + component: () => import('@/views/rule/listRule'), + meta: { title: '规章制度', icon: 'function', permission: ['/rule'] } + } + ] + } +] diff --git a/src/router/modules/statistics.js b/src/router/modules/statistics.js new file mode 100644 index 0000000..fb9cbea --- /dev/null +++ b/src/router/modules/statistics.js @@ -0,0 +1,30 @@ +/* Layout */ +import Layout from '@/layout/Layout' + +export const statisticsRouters = [ + { + path: 'statisticsToilet', + component: Layout, + redirect: '/workStatistics', + name: 'StatisticsToilet', + meta: { + title: '作业统计', + icon: 'icon-config', // 图标 + permission: ['/statisticsToilet']// 权限名称 + }, + children: [ + { + path: '/workStatistics', + name: 'WorkStatistics', + component: () => import('@/views/statistics/toiletAssessment'), + meta: { title: '作业统计', icon: '', permission: ['/toilet/workStatistics'] } + }, + { + path: '/evaluationStatistics', + name: 'EvaluationStatistics', + component: () => import('@/views/statistics/evaluationAssessment'), + meta: { title: '评价统计', icon: '', permission: ['/toilet/evaluationStatistics'] } + } + ] + } +] diff --git a/src/router/modules/toilet.js b/src/router/modules/toilet.js new file mode 100644 index 0000000..b221a0e --- /dev/null +++ b/src/router/modules/toilet.js @@ -0,0 +1,30 @@ +/* Layout */ +import Layout from '@/layout/Layout' + +export const toiletRouters = [ + { + path: 'toiletManage', + component: Layout, + redirect: '/toiletManage', + name: 'ToiletManage', + meta: { + title: '公厕管理', + icon: 'icon-config', // 图标 + permission: ['/toiletManage']// 权限名称 + }, + children: [ + { + path: '/toiletList', + name: 'ToiletList', + component: () => import('@/views/toiletManage/toiletList'), + meta: { title: '公厕台帐管理', icon: 'function', permission: ['/toiletList'] } + }, + { + path: '/toiletMap', + name: 'ToiletMap', + component: () => import('@/views/overview/overview'), + meta: { title: '地图总览', icon: 'function', permission: ['/toiletMap'] } + } + ] + } +] diff --git a/src/router/modules/work.js b/src/router/modules/work.js new file mode 100644 index 0000000..5e0759f --- /dev/null +++ b/src/router/modules/work.js @@ -0,0 +1,24 @@ +/* Layout */ +import Layout from '@/layout/Layout' + +export const workRouters = [ + { + path: 'toiletWork', + component: Layout, + redirect: '/toiletManage', + name: 'toiletWork', + meta: { + title: '作业管理', + icon: 'icon-config', // 图标 + permission: ['/toiletWork']// 权限名称 + }, + children: [ + { + path: '/toiletWork', + name: 'ToiletWork', + component: () => import('@/views/toiletClean/toiletCleanList'), + meta: { title: '作业管理', icon: 'function', permission: ['/toiletWork'] } + } + ] + } +] diff --git a/src/settings.js b/src/settings.js index b568ce0..b8159bf 100644 --- a/src/settings.js +++ b/src/settings.js @@ -3,7 +3,7 @@ * @type {boolean} true | false * @description 是否显示设置按钮 */ - showSettings: true, + showSettings: false, /** * @type {boolean} true | false diff --git a/src/store/modules/permission.js b/src/store/modules/permission.js index a0cb8cf..3ab50d5 100644 --- a/src/store/modules/permission.js +++ b/src/store/modules/permission.js @@ -120,17 +120,23 @@ }) }, // 获取用户权限 - GetMenus({ commit, state }) { - console.log('in store.permission.js:GetMenus:') + GetMenus({ commit, state }, currentSystem) { + // console.log('in store.permission.js:GetMenus:') + console.log('获取' + currentSystem.name + '的菜单') + const params = { + parentCode: currentSystem.code // 传入该子系统的code,获取子系统的权限 + } return new Promise((resolve, reject) => { - getMenus(state.token).then(response => { // 处理返回值 + // 此处获取用户所有权限 + getMenus(params).then(response => { // 处理返回值 const data = response.data const menus = [] // 仅菜单 const btns = [] // 非菜单 if (data.menus && data.menus.length > 0) { - commit('SET_MENUS', data.menus) - for (const menu of data.menus) { // 遍历菜单,获取所有的权限项 - if (menu.ismenu === '1') { // 将是菜单的放入menus + const allmenus = [...data.menus] + commit('SET_MENUS', allmenus) + for (const menu of allmenus) { // 遍历菜单,获取所有的权限项 + if (menu.resourceType === '02' || menu.resourceType === '03') { // 将是菜单的放入menus const menu_tmp = {} menu_tmp.url = menu.url menu_tmp.icon = menu.icon @@ -142,11 +148,11 @@ btn_tmp.name = menu.name btn_tmp.icon = menu.icon btns.push(btn_tmp) - // console.log(menu.url) } } // 过滤路由表 - const accessedRouters = filterAsyncRouter(asyncRouterMap, menus) + let accessedRouters = filterAsyncRouter(asyncRouterMap, menus) + // accessedRouters = filterRedirect(accessedRouters) commit('SET_BTNS', btns) commit('SET_ROUTERS', accessedRouters) resolve(response) diff --git a/src/utils/baseConfig.js b/src/utils/baseConfig.js index 1f4fa38..999593e 100644 --- a/src/utils/baseConfig.js +++ b/src/utils/baseConfig.js @@ -1,5 +1,5 @@ const project = { - title: '后台管理系统前端基础框架' + title: '路桥养护子系统' } export function getProject() { return project diff --git a/src/utils/dateutils.js b/src/utils/dateutils.js index 868111a..5cd16af 100644 --- a/src/utils/dateutils.js +++ b/src/utils/dateutils.js @@ -15,15 +15,15 @@ return ct_month } -export function getLastWeek() { // 默认显示上周 +export function getLastWeek(fmt) { // 默认显示上周 const ct_month = new Date() ct_month.setTime(ct_month.getTime() - 3600 * 1000 * 24 * 7) - return ct_month + return ct_month.Format(fmt) } -export function getLastMonth() { // 默认显示上个月 +export function getLastMonth(fmt) { // 默认显示上个月 const ct_month = new Date() ct_month.setTime(ct_month.getTime() - 3600 * 1000 * 24 * 30) - return ct_month + return ct_month.Format(fmt) } // 对Date的扩展,将 Date 转化为指定格式的String diff --git a/src/utils/exportutils.js b/src/utils/exportutils.js new file mode 100644 index 0000000..b5d0bcf --- /dev/null +++ b/src/utils/exportutils.js @@ -0,0 +1,19 @@ +/** + * 导出文件工具 + * @param blob 文件 + * @param fileName 导出文件名 + */ +export function exportFile(blob, fileName) { + if (window.navigator && window.navigator.msSaveOrOpenBlob) { + navigator.msSaveBlob(blob, fileName) + } else { + const downloadElement = document.createElement('a') + const href = window.URL.createObjectURL(blob) // 创建下载的链接 + downloadElement.href = href + downloadElement.download = fileName + document.body.appendChild(downloadElement) + downloadElement.click() // 点击下载 + document.body.removeChild(downloadElement) // 下载完成移除元素 + window.URL.revokeObjectURL(href) // 释放blob对象 + } +} diff --git a/src/utils/request.js b/src/utils/request.js index c88ea76..dc56e26 100644 --- a/src/utils/request.js +++ b/src/utils/request.js @@ -17,6 +17,13 @@ config.headers['token'] = getToken() // 让每个请求携带自定义token 请根据实际情况自行修改 console.log(config.headers['token']) } + // 在接口增加时间戳 + // if (config.method === 'get') { + config.params = { + _t: Date.parse(new Date()) / 1000, + ...config.params + } + // } return config }, error => { diff --git a/src/views/mapViews/choosePointDialog.vue b/src/views/mapViews/choosePointDialog.vue new file mode 100644 index 0000000..c9dde8a --- /dev/null +++ b/src/views/mapViews/choosePointDialog.vue @@ -0,0 +1,105 @@ + + + + + diff --git a/src/views/mapViews/mapView.vue b/src/views/mapViews/mapView.vue new file mode 100644 index 0000000..a18db88 --- /dev/null +++ b/src/views/mapViews/mapView.vue @@ -0,0 +1,73 @@ + + + + + diff --git a/src/views/order/editOrder.vue b/src/views/order/editOrder.vue new file mode 100644 index 0000000..4a5fd8a --- /dev/null +++ b/src/views/order/editOrder.vue @@ -0,0 +1,319 @@ + + + + + diff --git a/src/views/order/listMaintainRecords.vue b/src/views/order/listMaintainRecords.vue new file mode 100644 index 0000000..2d4f682 --- /dev/null +++ b/src/views/order/listMaintainRecords.vue @@ -0,0 +1,327 @@ + + + + + diff --git a/src/views/overview/overview.vue b/src/views/overview/overview.vue new file mode 100644 index 0000000..9525867 --- /dev/null +++ b/src/views/overview/overview.vue @@ -0,0 +1,285 @@ + + + + + diff --git a/src/views/overview/toiletDetailDialog.vue b/src/views/overview/toiletDetailDialog.vue new file mode 100644 index 0000000..2b3a511 --- /dev/null +++ b/src/views/overview/toiletDetailDialog.vue @@ -0,0 +1,263 @@ + + + + + + diff --git a/src/views/overview/toiletLayer.vue b/src/views/overview/toiletLayer.vue new file mode 100644 index 0000000..d784323 --- /dev/null +++ b/src/views/overview/toiletLayer.vue @@ -0,0 +1,152 @@ + + + + + + diff --git a/src/views/rule/listRule.vue b/src/views/rule/listRule.vue new file mode 100644 index 0000000..a19b9e4 --- /dev/null +++ b/src/views/rule/listRule.vue @@ -0,0 +1,157 @@ + + + + + diff --git a/config/index.js b/config/index.js index 8abd37a..19b33b1 100644 --- a/config/index.js +++ b/config/index.js @@ -69,7 +69,7 @@ * then assetsPublicPath should be set to "/bar/". * In most cases please use '/' !!! */ - assetsPublicPath: '/', + assetsPublicPath: '/toilet/', /** * Source Maps diff --git a/package.json b/package.json index 45f055f..9f3a3eb 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "echarts": "^4.2.1", "element-ui": "2.13.0", "event-source-polyfill": "^1.0.5", + "file-saver": "^2.0.5", "js-cookie": "2.2.0", "jsencrypt": "^3.0.0-rc.1", "leaflet": "^1.7.1", @@ -33,7 +34,9 @@ "vue-amap": "^0.5.9", "vue-baidu-map": "^0.21.22", "vue-router": "3.0.1", - "vuex": "3.0.1" + "vue2-leaflet": "^2.7.0", + "vuex": "3.0.1", + "xlsx": "^0.17.0" }, "devDependencies": { "autoprefixer": "8.5.0", diff --git a/src/api/common.js b/src/api/common.js index 87c582b..7804714 100644 --- a/src/api/common.js +++ b/src/api/common.js @@ -2,10 +2,14 @@ * 常用接口 */ import request from '@/utils/request' +import Vue from 'vue' + // 模板下载 export function downloadTemplate(fileName) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath return request({ - url: 'template/download', + url: lampPath + 'template/download', method: 'get', params: { filename: fileName @@ -19,7 +23,7 @@ const param = new FormData() param.append('file', fileobj.file) return request({ - url: 'imageUpload', + url: 'fileUpload', method: 'post', headers: { 'Content-Type': 'multipart/form-data' }, data: param diff --git a/src/api/sanitation/statistics.js b/src/api/sanitation/statistics.js new file mode 100644 index 0000000..ffeac18 --- /dev/null +++ b/src/api/sanitation/statistics.js @@ -0,0 +1,22 @@ + +/** + * 考核统计接口 + */ +import request from '@/utils/request' +// 公厕保洁次数统计 +export function getToiletJobCount(params) { + return request({ + url: '/sanitation/statistic/toilet/jobCount', + method: 'get', + params + }) +} + +// 公厕评分统计 +export function getToiletEvaluation(params) { + return request({ + url: '/sanitation/toiletEvaluation/statistics', + method: 'get', + params + }) +} diff --git a/src/api/sanitation/toilet.js b/src/api/sanitation/toilet.js new file mode 100644 index 0000000..11affd4 --- /dev/null +++ b/src/api/sanitation/toilet.js @@ -0,0 +1,133 @@ +/** + * 公厕管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' +// 公厕查询 +export function getToiletListPage(params) { + return request({ + url: '/sanitation/toilet/listPage', + method: 'get', + params + }) +} +// 公厕查询 +export function getToiletList(pid) { + return request({ + url: '/sanitation/toilet/list', + method: 'get', + params: { + pid: pid + } + }) +} + +// 添加公厕 +export function addToilet(params) { + return request({ + url: '/sanitation/toilet/add', + method: 'post', + params + }) +} +// 修改公厕机构 +export function updateToilet(params) { + return request({ + url: '/sanitation/toilet/update', + method: 'post', + params + }) +} +// 删除公厕机构 +export function delToilet(ids) { + return request({ + url: '/sanitation/toilet/delete', + method: 'post', + params: { + ids + }, + paramsSerializer: params => { + return qs.stringify(params, { indices: false }) + } + }) +} + +// 公厕基本信息详情 +export function getToiletInfoDetail(id) { + return request({ + url: '/sanitation/toilet/detail?toiletId=' + id, + method: 'get' + }) +} + +// 某公厕保洁记录 +export function getRecordsByToilet(params) { + return request({ + url: '/sanitation/toilet/jobRecord/detail', + method: 'get', + params + }) +} + +// 某公厕平均评分 +export function getScoreByToilet(params) { + return request({ + url: '/sanitation/toiletEvaluation/detailScore', + method: 'get', + params + }) +} + +// 某公厕评分列表 +export function getScoreListByToilet(params) { + return request({ + url: '/sanitation/toiletEvaluation/list', + method: 'get', + params + }) +} + + +// 批量导入 +export function batchImportToilet(fileobj) { + const param = new FormData() + param.append('file', fileobj) + return request({ + url: '/sanitation/toilet/import', + method: 'post', + headers: { 'Content-Type': 'multipart/form-data' }, + data: param + }) +} +// 批量导出 +export function batchExportToilet(params, config) { + return request({ + url: '/sanitation/toilet/export', + method: 'get', + timeout: 120000, + params, + ...config, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 公厕保洁记录查询 +export function getToiletJobRecords(params) { + return request({ + url: '/sanitation/toilet/jobRecord', + method: 'get', + params + }) +} + +// 批量导出 +export function batchExportToiletJobRecords(params, config) { + return request({ + url: '/sanitation/toilet/exportJobRecord', + method: 'get', + timeout: 120000, + params, + ...config, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} diff --git a/src/api/system/alarm.js b/src/api/system/alarm.js new file mode 100644 index 0000000..1c3a7ab --- /dev/null +++ b/src/api/system/alarm.js @@ -0,0 +1,62 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' + +// 获取当前报警列表 +export function getAlarmNowList(params) { + return request({ + url: '/alarm/listNowPage', + method: 'get', + params + }) +} + +// 获取当前报警列表 +export function getAlarmHistoryList(params) { + return request({ + url: '/alarm/listHisPage', + method: 'get', + params + }) +} + + +// 批量消警 +export function clearAll(params) { + return request({ + url: '/alarm/allClear', + method: 'get', + params + }) +} + +// 消警 +export function clearAlarm(params) { + return request({ + url: '/alarm/cancel', + method: 'get', + params + }) +} + +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 设置报警阈值 +export function setThresh(params) { + return request({ + url: '/alarm/resetAlarmRule', + method: 'post', + params + }) +} diff --git a/src/api/system/bridge.js b/src/api/system/bridge.js new file mode 100644 index 0000000..e8a4108 --- /dev/null +++ b/src/api/system/bridge.js @@ -0,0 +1,80 @@ +/** + * 桥梁管理接口 + */ +import request from '@/utils/request' + +// 获取桥梁详情 +export function getDetail(id) { + return request({ + url: '/bridge/detail', + method: 'get', + params: { + id: id + } + }) +} + +export function updateBridge(params) { + return request({ + url: '/bridge/update', + method: 'post', + params + }) +} +// 批量导出 +export function exportRecords(params) { + return request({ + url: 'device/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +export function getContentList(params) { + return request({ + url: 'maintain/contentByType', + method: 'get', + params: { + type: params + } + }) +} +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 编辑 +export function editRecord(params) { + return request({ + url: 'maintain/update', + method: 'post', + params + }) +} +// 新增 +export function addRecord(params) { + return request({ + url: 'maintain/add', + method: 'post', + params + }) +} +// 删除 +export function delRecord(id) { + return request({ + url: 'maintain/delete', + method: 'post', + params: { + id: id + } + }) +} diff --git a/src/api/system/data.js b/src/api/system/data.js new file mode 100644 index 0000000..4c95db5 --- /dev/null +++ b/src/api/system/data.js @@ -0,0 +1,63 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' + +// 获取当前报警列表 +export function getHistoryList(params) { + return request({ + url: '/data/hisListPage', + method: 'get', + params + }) +} + +// 获取当前报警列表 +export function getHistory(params) { + return request({ + url: '/data/hisList', + method: 'get', + params + }) +} + + + +// 批量消警 +export function clearAll(params) { + return request({ + url: '/alarm/allClear', + method: 'get', + params + }) +} + +// 消警 +export function clearAlarm(params) { + return request({ + url: '/alarm/cancel', + method: 'get', + params + }) +} + +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 设置报警阈值 +export function setThresh(params) { + return request({ + url: '/alarm/resetAlarmRule', + method: 'post', + params + }) +} diff --git a/src/api/system/order.js b/src/api/system/order.js new file mode 100644 index 0000000..7007c50 --- /dev/null +++ b/src/api/system/order.js @@ -0,0 +1,71 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +// import qs from 'qs' + +// 获取当前报警列表 +export function getRecordList(params) { + return request({ + url: '/maintain/listPage', + method: 'get', + params + }) +} +// 批量导出 +export function exportRecords(params) { + return request({ + url: 'device/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +export function getContentList(params) { + return request({ + url: 'maintain/contentByType', + method: 'get', + params: { + type: params + } + }) +} +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 编辑 +export function editRecord(params) { + return request({ + url: 'maintain/update', + method: 'post', + params + }) +} +// 新增 +export function addRecord(params) { + return request({ + url: 'maintain/add', + method: 'post', + params + }) +} +// 删除 +export function delRecord(id) { + return request({ + url: 'maintain/delete', + method: 'post', + params: { + bridgeMaintenanceId: id + } + }) +} diff --git a/src/api/system/overview.js b/src/api/system/overview.js new file mode 100644 index 0000000..bca50cc --- /dev/null +++ b/src/api/system/overview.js @@ -0,0 +1,109 @@ +import request from '@/utils/request' +import qs from "qs" +import Vue from 'vue' + +// 路灯状态统计 +export function getLampStatus() { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampStatus', + method: 'get' + }) +} + +// 路灯总览列表 +export function getLampList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampList', + method: 'get', + params + }) +} + +// 路灯详情 +export function getlampDetail(lampId) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampDetail', + method: 'get', + params: { + lampId: lampId + } + }) +} + +// 回路列表 +export function getCircuitList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/circuitList', + method: 'get', + params + }) +} + +// 灯箱列表 +export function getLampBoxList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampBoxList', + method: 'get', + params + }) +} +// 灯箱详情 +export function getLampBoxDetail(lampBoxId) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampBoxDetail', + method: 'get', + params: { + lampBoxId: lampBoxId + } + }) +} + +// 报警总览列表 +export function getAlarmList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/alarmList', + method: 'get', + params + }) +} + +// 报警详情 +export function getAlarmDetail(alarmId) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/alarmDetail', + method: 'get', + params: { + alarmId: alarmId + } + }) +} + +// 路灯控制 +export function lampControl(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampControl', + method: 'post', + params, + paramsSerializer: params => { + return qs.stringify(params, { indices: false }) + } + }) +} diff --git a/src/api/system/rule.js b/src/api/system/rule.js new file mode 100644 index 0000000..76c6b2d --- /dev/null +++ b/src/api/system/rule.js @@ -0,0 +1,59 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +// import qs from 'qs' + +// 获取当前报警列表 +export function getRuleList() { + return request({ + url: 'rule/listPage', + method: 'get' + }) +} +export function getContentList(params) { + return request({ + url: 'maintain/contentByType', + method: 'get', + params: { + type: params + } + }) +} +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 编辑 +export function editRecord(params) { + return request({ + url: 'maintain/update', + method: 'post', + params + }) +} +// 新增 +export function addRecord(params) { + return request({ + url: 'maintain/add', + method: 'post', + params + }) +} +// 删除 +export function delRecord(id) { + return request({ + url: 'maintain/delete', + method: 'post', + params: { + id: id + } + }) +} diff --git a/src/api/system/statistics.js b/src/api/system/statistics.js new file mode 100644 index 0000000..b25efe9 --- /dev/null +++ b/src/api/system/statistics.js @@ -0,0 +1,23 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +// import qs from 'qs' + +// +export function countByToilet(params) { + return request({ + url: '/sanitation/toiletStatistic/jobStaticByToilet', + method: 'get', + params + }) +} + +export function countByDay(params) { + return request({ + url: '/sanitation/toiletStatistic/jobStaticByDate', + method: 'get', + params + }) +} + diff --git a/src/assets/global_images/icon-position.png b/src/assets/global_images/icon-position.png new file mode 100644 index 0000000..7444038 --- /dev/null +++ b/src/assets/global_images/icon-position.png Binary files differ diff --git a/src/assets/global_images/location_green.png b/src/assets/global_images/location_green.png new file mode 100644 index 0000000..aa8be65 --- /dev/null +++ b/src/assets/global_images/location_green.png Binary files differ diff --git a/src/assets/global_images/location_red.png b/src/assets/global_images/location_red.png new file mode 100644 index 0000000..2be8c3d --- /dev/null +++ b/src/assets/global_images/location_red.png Binary files differ diff --git a/src/assets/global_images/location_yellow.png b/src/assets/global_images/location_yellow.png new file mode 100644 index 0000000..5ab6f4d --- /dev/null +++ b/src/assets/global_images/location_yellow.png Binary files differ diff --git a/src/assets/global_images/toilet-position.png b/src/assets/global_images/toilet-position.png new file mode 100644 index 0000000..7db6d9a --- /dev/null +++ b/src/assets/global_images/toilet-position.png Binary files differ diff --git a/src/assets/global_images/toilet.png b/src/assets/global_images/toilet.png new file mode 100644 index 0000000..6d9fc05 --- /dev/null +++ b/src/assets/global_images/toilet.png Binary files differ diff --git a/src/assets/global_images/toiletPhoto.png b/src/assets/global_images/toiletPhoto.png new file mode 100644 index 0000000..15d08e2 --- /dev/null +++ b/src/assets/global_images/toiletPhoto.png Binary files differ diff --git a/src/components/DownloadTemplate/index.vue b/src/components/DownloadTemplate/index.vue index 8ded2cd..7807cac 100644 --- a/src/components/DownloadTemplate/index.vue +++ b/src/components/DownloadTemplate/index.vue @@ -47,8 +47,8 @@ diff --git a/src/components/NormalTable/index.vue b/src/components/NormalTable/index.vue index 5077bef..04d322d 100644 --- a/src/components/NormalTable/index.vue +++ b/src/components/NormalTable/index.vue @@ -79,7 +79,7 @@
-
+
Object.assign(obj, { [key]: this[key] }), {}), + on: events.reduce((obj, key) => Object.assign(obj, { [key]: this.transmitEvent }), {}) + }) + } + this.props = [...extraProps, ...props.filter(prop => exceptProps.indexOf(prop))] + } +} + +export default prop => new Mixin(prop) diff --git a/src/components/mapWindow/base/mixins/common.js b/src/components/mapWindow/base/mixins/common.js new file mode 100644 index 0000000..2fd1a28 --- /dev/null +++ b/src/components/mapWindow/base/mixins/common.js @@ -0,0 +1,82 @@ +const types = { + map: { + unload: 'clearMap' + }, + control: { + unload: 'removeControl' + }, + layer: { + unload: 'removeLayer' + }, + features: { + unload: 'removeFeatures' + }, + listener: { + unload: 'removeListener' + } +} + +const getParent = $component => ($component.abstract || $component.$el === $component.$children[0].$el) ? getParent($component.$parent) : $component + +function destroyInstance () { + const { unload, renderByParent, $parent } = this + if (renderByParent) { + $parent.reload() + } + unload() +} + +class Mixin { + constructor (prop) { + this.methods = { + ready () { + const $parent = getParent(this.$parent) + const map = this.map = $parent.map + this.load() + this.$emit('ready', { + map + }) + }, + transmitEvent (e) { + this.$emit(e.type.replace(/^on/, ''), e) + }, + reload () { + this && this.$nextTick(() => { + this.unload() + this.$nextTick(this.load) + }) + }, + unload () { + const { map, originInstance } = this + try { + switch (prop.type) { + case 'search': + return originInstance.clearResults() + case 'autoComplete': + case 'lushu': + return originInstance.dispose() + case 'markerClusterer': + return originInstance.clearMarkers() + default: + map[types[prop.type].unload](originInstance) + } + } catch (e) {} + } + } + this.computed = { + renderByParent () { + return this.$parent.preventChildrenRender + } + } + this.mounted = function () { + console.log('common mounted') + const $parent = getParent(this.$parent) + const map = $parent.map + const { ready } = this + console.log(map) + map ? ready() : $parent.$on('onload', ready) + } + } +} + +export default type => new Mixin({ type }) diff --git a/src/components/mapWindow/leafletMap.vue b/src/components/mapWindow/leafletMap.vue new file mode 100644 index 0000000..b753cc0 --- /dev/null +++ b/src/components/mapWindow/leafletMap.vue @@ -0,0 +1,143 @@ + + + + + + + diff --git a/src/components/mapWindow/mapWindow.vue b/src/components/mapWindow/mapWindow.vue new file mode 100644 index 0000000..9ced291 --- /dev/null +++ b/src/components/mapWindow/mapWindow.vue @@ -0,0 +1,46 @@ + + + + + + diff --git a/src/icons/svg/bridge.svg b/src/icons/svg/bridge.svg new file mode 100644 index 0000000..1a0336f --- /dev/null +++ b/src/icons/svg/bridge.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/icons/svg/toilet.svg b/src/icons/svg/toilet.svg new file mode 100644 index 0000000..9d8e765 --- /dev/null +++ b/src/icons/svg/toilet.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/main.js b/src/main.js index f2d105d..3e4074e 100644 --- a/src/main.js +++ b/src/main.js @@ -18,6 +18,9 @@ // echart // import echarts from 'echarts' // Vue.prototype.$echarts = echarts +// 引入v-charts +import VCharts from 'v-charts' +Vue.use(VCharts) // 将自动注册所有组件为全局组件 // import dataV from '@jiaminghi/data-view' @@ -35,9 +38,19 @@ Vue.component('search-item', SearchItem) // 加载leaflet的css +// import 'leaflet/dist/leaflet.css' +// import 'leaflet-draw/dist/leaflet.draw.css' +import L from 'leaflet' import 'leaflet/dist/leaflet.css' -import 'leaflet-draw/dist/leaflet.draw.css' +Vue.config.productionTip = false +Vue.L = Vue.prototype.$L = L +delete L.Icon.Default.prototype._getIconUrl +L.Icon.Default.mergeOptions({ + iconRetinaUrl: require('leaflet/dist/images/marker-icon-2x.png'), + iconUrl: require('leaflet/dist/images/marker-icon.png'), + shadowUrl: require('leaflet/dist/images/marker-shadow.png') +}) /** * This project originally used easy-mock to simulate data, * but its official service is very unstable, diff --git a/src/permission.js b/src/permission.js index dc6b2f8..809ca86 100644 --- a/src/permission.js +++ b/src/permission.js @@ -25,8 +25,8 @@ store.dispatch('GetInfo').then(res => { // 拉取用户信息 // 设置当前子系统为基础资源子系统 const currentSys = { - code: 'baseResourse', - name: '基础资源子系统' + code: 'toliet', + name: '公共厕所管理系统' } // 将当前系统信息保存在localStorage中 store.commit('SET_SYSTEM', currentSys) diff --git a/src/router/index.js b/src/router/index.js index 39c295c..d23076d 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -8,8 +8,11 @@ /* Layout */ import Layout from '@/layout/Layout' +import { toiletRouters } from './modules/toilet' +import { workRouters } from './modules/work' +import { statisticsRouters } from './modules/statistics' +import { ruleRouters } from './modules/rule' import { systemRouters } from './modules/system' -import { exampleRouters } from './modules/example' /** * hidden: true if `hidden:true` will not show in the sidebar(default is false) @@ -40,11 +43,12 @@ ] }, // 登录页面 - { path: '/login', component: () => import('@/views/login/index'), hidden: true }, + { path: '/login', component: () => import('@/views/login/index_2'), hidden: true }, // 404错误页面 { path: '/404', component: () => import('@/views/errorPage/404'), hidden: true }, // 401 错误页面 - { path: '/401', component: () => import('@/views/errorPage/401'), hidden: true } + { path: '/401', component: () => import('@/views/errorPage/401'), hidden: true }, + { path: '/', redirect: '/toiletList', hidden: true } ] // 实例化vue的时候直挂载constantRouter export default new Router({ @@ -56,7 +60,10 @@ // 异步挂载路由 // 动态需要根据权限加载的路由表 export const asyncRouterMap = [ - ...exampleRouters, - ...systemRouters, + ...toiletRouters, + ...workRouters, + ...statisticsRouters, + ...ruleRouters, + // ...systemRouters, { path: '*', redirect: '/404', hidden: true } ] diff --git a/src/router/modules/rule.js b/src/router/modules/rule.js new file mode 100644 index 0000000..51e0283 --- /dev/null +++ b/src/router/modules/rule.js @@ -0,0 +1,24 @@ +/* Layout */ +import Layout from '@/layout/Layout' + +export const ruleRouters = [ + { + path: 'rule', + component: Layout, + redirect: '/rule', + name: 'Rule', + meta: { + title: '规章制度', + icon: 'icon-config', // 图标 + permission: ['/rule']// 权限名称 + }, + children: [ + { + path: '/rule', + name: 'Rule', + component: () => import('@/views/rule/listRule'), + meta: { title: '规章制度', icon: 'function', permission: ['/rule'] } + } + ] + } +] diff --git a/src/router/modules/statistics.js b/src/router/modules/statistics.js new file mode 100644 index 0000000..fb9cbea --- /dev/null +++ b/src/router/modules/statistics.js @@ -0,0 +1,30 @@ +/* Layout */ +import Layout from '@/layout/Layout' + +export const statisticsRouters = [ + { + path: 'statisticsToilet', + component: Layout, + redirect: '/workStatistics', + name: 'StatisticsToilet', + meta: { + title: '作业统计', + icon: 'icon-config', // 图标 + permission: ['/statisticsToilet']// 权限名称 + }, + children: [ + { + path: '/workStatistics', + name: 'WorkStatistics', + component: () => import('@/views/statistics/toiletAssessment'), + meta: { title: '作业统计', icon: '', permission: ['/toilet/workStatistics'] } + }, + { + path: '/evaluationStatistics', + name: 'EvaluationStatistics', + component: () => import('@/views/statistics/evaluationAssessment'), + meta: { title: '评价统计', icon: '', permission: ['/toilet/evaluationStatistics'] } + } + ] + } +] diff --git a/src/router/modules/toilet.js b/src/router/modules/toilet.js new file mode 100644 index 0000000..b221a0e --- /dev/null +++ b/src/router/modules/toilet.js @@ -0,0 +1,30 @@ +/* Layout */ +import Layout from '@/layout/Layout' + +export const toiletRouters = [ + { + path: 'toiletManage', + component: Layout, + redirect: '/toiletManage', + name: 'ToiletManage', + meta: { + title: '公厕管理', + icon: 'icon-config', // 图标 + permission: ['/toiletManage']// 权限名称 + }, + children: [ + { + path: '/toiletList', + name: 'ToiletList', + component: () => import('@/views/toiletManage/toiletList'), + meta: { title: '公厕台帐管理', icon: 'function', permission: ['/toiletList'] } + }, + { + path: '/toiletMap', + name: 'ToiletMap', + component: () => import('@/views/overview/overview'), + meta: { title: '地图总览', icon: 'function', permission: ['/toiletMap'] } + } + ] + } +] diff --git a/src/router/modules/work.js b/src/router/modules/work.js new file mode 100644 index 0000000..5e0759f --- /dev/null +++ b/src/router/modules/work.js @@ -0,0 +1,24 @@ +/* Layout */ +import Layout from '@/layout/Layout' + +export const workRouters = [ + { + path: 'toiletWork', + component: Layout, + redirect: '/toiletManage', + name: 'toiletWork', + meta: { + title: '作业管理', + icon: 'icon-config', // 图标 + permission: ['/toiletWork']// 权限名称 + }, + children: [ + { + path: '/toiletWork', + name: 'ToiletWork', + component: () => import('@/views/toiletClean/toiletCleanList'), + meta: { title: '作业管理', icon: 'function', permission: ['/toiletWork'] } + } + ] + } +] diff --git a/src/settings.js b/src/settings.js index b568ce0..b8159bf 100644 --- a/src/settings.js +++ b/src/settings.js @@ -3,7 +3,7 @@ * @type {boolean} true | false * @description 是否显示设置按钮 */ - showSettings: true, + showSettings: false, /** * @type {boolean} true | false diff --git a/src/store/modules/permission.js b/src/store/modules/permission.js index a0cb8cf..3ab50d5 100644 --- a/src/store/modules/permission.js +++ b/src/store/modules/permission.js @@ -120,17 +120,23 @@ }) }, // 获取用户权限 - GetMenus({ commit, state }) { - console.log('in store.permission.js:GetMenus:') + GetMenus({ commit, state }, currentSystem) { + // console.log('in store.permission.js:GetMenus:') + console.log('获取' + currentSystem.name + '的菜单') + const params = { + parentCode: currentSystem.code // 传入该子系统的code,获取子系统的权限 + } return new Promise((resolve, reject) => { - getMenus(state.token).then(response => { // 处理返回值 + // 此处获取用户所有权限 + getMenus(params).then(response => { // 处理返回值 const data = response.data const menus = [] // 仅菜单 const btns = [] // 非菜单 if (data.menus && data.menus.length > 0) { - commit('SET_MENUS', data.menus) - for (const menu of data.menus) { // 遍历菜单,获取所有的权限项 - if (menu.ismenu === '1') { // 将是菜单的放入menus + const allmenus = [...data.menus] + commit('SET_MENUS', allmenus) + for (const menu of allmenus) { // 遍历菜单,获取所有的权限项 + if (menu.resourceType === '02' || menu.resourceType === '03') { // 将是菜单的放入menus const menu_tmp = {} menu_tmp.url = menu.url menu_tmp.icon = menu.icon @@ -142,11 +148,11 @@ btn_tmp.name = menu.name btn_tmp.icon = menu.icon btns.push(btn_tmp) - // console.log(menu.url) } } // 过滤路由表 - const accessedRouters = filterAsyncRouter(asyncRouterMap, menus) + let accessedRouters = filterAsyncRouter(asyncRouterMap, menus) + // accessedRouters = filterRedirect(accessedRouters) commit('SET_BTNS', btns) commit('SET_ROUTERS', accessedRouters) resolve(response) diff --git a/src/utils/baseConfig.js b/src/utils/baseConfig.js index 1f4fa38..999593e 100644 --- a/src/utils/baseConfig.js +++ b/src/utils/baseConfig.js @@ -1,5 +1,5 @@ const project = { - title: '后台管理系统前端基础框架' + title: '路桥养护子系统' } export function getProject() { return project diff --git a/src/utils/dateutils.js b/src/utils/dateutils.js index 868111a..5cd16af 100644 --- a/src/utils/dateutils.js +++ b/src/utils/dateutils.js @@ -15,15 +15,15 @@ return ct_month } -export function getLastWeek() { // 默认显示上周 +export function getLastWeek(fmt) { // 默认显示上周 const ct_month = new Date() ct_month.setTime(ct_month.getTime() - 3600 * 1000 * 24 * 7) - return ct_month + return ct_month.Format(fmt) } -export function getLastMonth() { // 默认显示上个月 +export function getLastMonth(fmt) { // 默认显示上个月 const ct_month = new Date() ct_month.setTime(ct_month.getTime() - 3600 * 1000 * 24 * 30) - return ct_month + return ct_month.Format(fmt) } // 对Date的扩展,将 Date 转化为指定格式的String diff --git a/src/utils/exportutils.js b/src/utils/exportutils.js new file mode 100644 index 0000000..b5d0bcf --- /dev/null +++ b/src/utils/exportutils.js @@ -0,0 +1,19 @@ +/** + * 导出文件工具 + * @param blob 文件 + * @param fileName 导出文件名 + */ +export function exportFile(blob, fileName) { + if (window.navigator && window.navigator.msSaveOrOpenBlob) { + navigator.msSaveBlob(blob, fileName) + } else { + const downloadElement = document.createElement('a') + const href = window.URL.createObjectURL(blob) // 创建下载的链接 + downloadElement.href = href + downloadElement.download = fileName + document.body.appendChild(downloadElement) + downloadElement.click() // 点击下载 + document.body.removeChild(downloadElement) // 下载完成移除元素 + window.URL.revokeObjectURL(href) // 释放blob对象 + } +} diff --git a/src/utils/request.js b/src/utils/request.js index c88ea76..dc56e26 100644 --- a/src/utils/request.js +++ b/src/utils/request.js @@ -17,6 +17,13 @@ config.headers['token'] = getToken() // 让每个请求携带自定义token 请根据实际情况自行修改 console.log(config.headers['token']) } + // 在接口增加时间戳 + // if (config.method === 'get') { + config.params = { + _t: Date.parse(new Date()) / 1000, + ...config.params + } + // } return config }, error => { diff --git a/src/views/mapViews/choosePointDialog.vue b/src/views/mapViews/choosePointDialog.vue new file mode 100644 index 0000000..c9dde8a --- /dev/null +++ b/src/views/mapViews/choosePointDialog.vue @@ -0,0 +1,105 @@ + + + + + diff --git a/src/views/mapViews/mapView.vue b/src/views/mapViews/mapView.vue new file mode 100644 index 0000000..a18db88 --- /dev/null +++ b/src/views/mapViews/mapView.vue @@ -0,0 +1,73 @@ + + + + + diff --git a/src/views/order/editOrder.vue b/src/views/order/editOrder.vue new file mode 100644 index 0000000..4a5fd8a --- /dev/null +++ b/src/views/order/editOrder.vue @@ -0,0 +1,319 @@ + + + + + diff --git a/src/views/order/listMaintainRecords.vue b/src/views/order/listMaintainRecords.vue new file mode 100644 index 0000000..2d4f682 --- /dev/null +++ b/src/views/order/listMaintainRecords.vue @@ -0,0 +1,327 @@ + + + + + diff --git a/src/views/overview/overview.vue b/src/views/overview/overview.vue new file mode 100644 index 0000000..9525867 --- /dev/null +++ b/src/views/overview/overview.vue @@ -0,0 +1,285 @@ + + + + + diff --git a/src/views/overview/toiletDetailDialog.vue b/src/views/overview/toiletDetailDialog.vue new file mode 100644 index 0000000..2b3a511 --- /dev/null +++ b/src/views/overview/toiletDetailDialog.vue @@ -0,0 +1,263 @@ + + + + + + diff --git a/src/views/overview/toiletLayer.vue b/src/views/overview/toiletLayer.vue new file mode 100644 index 0000000..d784323 --- /dev/null +++ b/src/views/overview/toiletLayer.vue @@ -0,0 +1,152 @@ + + + + + + diff --git a/src/views/rule/listRule.vue b/src/views/rule/listRule.vue new file mode 100644 index 0000000..a19b9e4 --- /dev/null +++ b/src/views/rule/listRule.vue @@ -0,0 +1,157 @@ + + + + + diff --git a/src/views/statistics/barChart.vue b/src/views/statistics/barChart.vue new file mode 100644 index 0000000..d10eb38 --- /dev/null +++ b/src/views/statistics/barChart.vue @@ -0,0 +1,65 @@ + + + + + diff --git a/config/index.js b/config/index.js index 8abd37a..19b33b1 100644 --- a/config/index.js +++ b/config/index.js @@ -69,7 +69,7 @@ * then assetsPublicPath should be set to "/bar/". * In most cases please use '/' !!! */ - assetsPublicPath: '/', + assetsPublicPath: '/toilet/', /** * Source Maps diff --git a/package.json b/package.json index 45f055f..9f3a3eb 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "echarts": "^4.2.1", "element-ui": "2.13.0", "event-source-polyfill": "^1.0.5", + "file-saver": "^2.0.5", "js-cookie": "2.2.0", "jsencrypt": "^3.0.0-rc.1", "leaflet": "^1.7.1", @@ -33,7 +34,9 @@ "vue-amap": "^0.5.9", "vue-baidu-map": "^0.21.22", "vue-router": "3.0.1", - "vuex": "3.0.1" + "vue2-leaflet": "^2.7.0", + "vuex": "3.0.1", + "xlsx": "^0.17.0" }, "devDependencies": { "autoprefixer": "8.5.0", diff --git a/src/api/common.js b/src/api/common.js index 87c582b..7804714 100644 --- a/src/api/common.js +++ b/src/api/common.js @@ -2,10 +2,14 @@ * 常用接口 */ import request from '@/utils/request' +import Vue from 'vue' + // 模板下载 export function downloadTemplate(fileName) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath return request({ - url: 'template/download', + url: lampPath + 'template/download', method: 'get', params: { filename: fileName @@ -19,7 +23,7 @@ const param = new FormData() param.append('file', fileobj.file) return request({ - url: 'imageUpload', + url: 'fileUpload', method: 'post', headers: { 'Content-Type': 'multipart/form-data' }, data: param diff --git a/src/api/sanitation/statistics.js b/src/api/sanitation/statistics.js new file mode 100644 index 0000000..ffeac18 --- /dev/null +++ b/src/api/sanitation/statistics.js @@ -0,0 +1,22 @@ + +/** + * 考核统计接口 + */ +import request from '@/utils/request' +// 公厕保洁次数统计 +export function getToiletJobCount(params) { + return request({ + url: '/sanitation/statistic/toilet/jobCount', + method: 'get', + params + }) +} + +// 公厕评分统计 +export function getToiletEvaluation(params) { + return request({ + url: '/sanitation/toiletEvaluation/statistics', + method: 'get', + params + }) +} diff --git a/src/api/sanitation/toilet.js b/src/api/sanitation/toilet.js new file mode 100644 index 0000000..11affd4 --- /dev/null +++ b/src/api/sanitation/toilet.js @@ -0,0 +1,133 @@ +/** + * 公厕管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' +// 公厕查询 +export function getToiletListPage(params) { + return request({ + url: '/sanitation/toilet/listPage', + method: 'get', + params + }) +} +// 公厕查询 +export function getToiletList(pid) { + return request({ + url: '/sanitation/toilet/list', + method: 'get', + params: { + pid: pid + } + }) +} + +// 添加公厕 +export function addToilet(params) { + return request({ + url: '/sanitation/toilet/add', + method: 'post', + params + }) +} +// 修改公厕机构 +export function updateToilet(params) { + return request({ + url: '/sanitation/toilet/update', + method: 'post', + params + }) +} +// 删除公厕机构 +export function delToilet(ids) { + return request({ + url: '/sanitation/toilet/delete', + method: 'post', + params: { + ids + }, + paramsSerializer: params => { + return qs.stringify(params, { indices: false }) + } + }) +} + +// 公厕基本信息详情 +export function getToiletInfoDetail(id) { + return request({ + url: '/sanitation/toilet/detail?toiletId=' + id, + method: 'get' + }) +} + +// 某公厕保洁记录 +export function getRecordsByToilet(params) { + return request({ + url: '/sanitation/toilet/jobRecord/detail', + method: 'get', + params + }) +} + +// 某公厕平均评分 +export function getScoreByToilet(params) { + return request({ + url: '/sanitation/toiletEvaluation/detailScore', + method: 'get', + params + }) +} + +// 某公厕评分列表 +export function getScoreListByToilet(params) { + return request({ + url: '/sanitation/toiletEvaluation/list', + method: 'get', + params + }) +} + + +// 批量导入 +export function batchImportToilet(fileobj) { + const param = new FormData() + param.append('file', fileobj) + return request({ + url: '/sanitation/toilet/import', + method: 'post', + headers: { 'Content-Type': 'multipart/form-data' }, + data: param + }) +} +// 批量导出 +export function batchExportToilet(params, config) { + return request({ + url: '/sanitation/toilet/export', + method: 'get', + timeout: 120000, + params, + ...config, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 公厕保洁记录查询 +export function getToiletJobRecords(params) { + return request({ + url: '/sanitation/toilet/jobRecord', + method: 'get', + params + }) +} + +// 批量导出 +export function batchExportToiletJobRecords(params, config) { + return request({ + url: '/sanitation/toilet/exportJobRecord', + method: 'get', + timeout: 120000, + params, + ...config, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} diff --git a/src/api/system/alarm.js b/src/api/system/alarm.js new file mode 100644 index 0000000..1c3a7ab --- /dev/null +++ b/src/api/system/alarm.js @@ -0,0 +1,62 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' + +// 获取当前报警列表 +export function getAlarmNowList(params) { + return request({ + url: '/alarm/listNowPage', + method: 'get', + params + }) +} + +// 获取当前报警列表 +export function getAlarmHistoryList(params) { + return request({ + url: '/alarm/listHisPage', + method: 'get', + params + }) +} + + +// 批量消警 +export function clearAll(params) { + return request({ + url: '/alarm/allClear', + method: 'get', + params + }) +} + +// 消警 +export function clearAlarm(params) { + return request({ + url: '/alarm/cancel', + method: 'get', + params + }) +} + +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 设置报警阈值 +export function setThresh(params) { + return request({ + url: '/alarm/resetAlarmRule', + method: 'post', + params + }) +} diff --git a/src/api/system/bridge.js b/src/api/system/bridge.js new file mode 100644 index 0000000..e8a4108 --- /dev/null +++ b/src/api/system/bridge.js @@ -0,0 +1,80 @@ +/** + * 桥梁管理接口 + */ +import request from '@/utils/request' + +// 获取桥梁详情 +export function getDetail(id) { + return request({ + url: '/bridge/detail', + method: 'get', + params: { + id: id + } + }) +} + +export function updateBridge(params) { + return request({ + url: '/bridge/update', + method: 'post', + params + }) +} +// 批量导出 +export function exportRecords(params) { + return request({ + url: 'device/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +export function getContentList(params) { + return request({ + url: 'maintain/contentByType', + method: 'get', + params: { + type: params + } + }) +} +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 编辑 +export function editRecord(params) { + return request({ + url: 'maintain/update', + method: 'post', + params + }) +} +// 新增 +export function addRecord(params) { + return request({ + url: 'maintain/add', + method: 'post', + params + }) +} +// 删除 +export function delRecord(id) { + return request({ + url: 'maintain/delete', + method: 'post', + params: { + id: id + } + }) +} diff --git a/src/api/system/data.js b/src/api/system/data.js new file mode 100644 index 0000000..4c95db5 --- /dev/null +++ b/src/api/system/data.js @@ -0,0 +1,63 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' + +// 获取当前报警列表 +export function getHistoryList(params) { + return request({ + url: '/data/hisListPage', + method: 'get', + params + }) +} + +// 获取当前报警列表 +export function getHistory(params) { + return request({ + url: '/data/hisList', + method: 'get', + params + }) +} + + + +// 批量消警 +export function clearAll(params) { + return request({ + url: '/alarm/allClear', + method: 'get', + params + }) +} + +// 消警 +export function clearAlarm(params) { + return request({ + url: '/alarm/cancel', + method: 'get', + params + }) +} + +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 设置报警阈值 +export function setThresh(params) { + return request({ + url: '/alarm/resetAlarmRule', + method: 'post', + params + }) +} diff --git a/src/api/system/order.js b/src/api/system/order.js new file mode 100644 index 0000000..7007c50 --- /dev/null +++ b/src/api/system/order.js @@ -0,0 +1,71 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +// import qs from 'qs' + +// 获取当前报警列表 +export function getRecordList(params) { + return request({ + url: '/maintain/listPage', + method: 'get', + params + }) +} +// 批量导出 +export function exportRecords(params) { + return request({ + url: 'device/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +export function getContentList(params) { + return request({ + url: 'maintain/contentByType', + method: 'get', + params: { + type: params + } + }) +} +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 编辑 +export function editRecord(params) { + return request({ + url: 'maintain/update', + method: 'post', + params + }) +} +// 新增 +export function addRecord(params) { + return request({ + url: 'maintain/add', + method: 'post', + params + }) +} +// 删除 +export function delRecord(id) { + return request({ + url: 'maintain/delete', + method: 'post', + params: { + bridgeMaintenanceId: id + } + }) +} diff --git a/src/api/system/overview.js b/src/api/system/overview.js new file mode 100644 index 0000000..bca50cc --- /dev/null +++ b/src/api/system/overview.js @@ -0,0 +1,109 @@ +import request from '@/utils/request' +import qs from "qs" +import Vue from 'vue' + +// 路灯状态统计 +export function getLampStatus() { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampStatus', + method: 'get' + }) +} + +// 路灯总览列表 +export function getLampList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampList', + method: 'get', + params + }) +} + +// 路灯详情 +export function getlampDetail(lampId) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampDetail', + method: 'get', + params: { + lampId: lampId + } + }) +} + +// 回路列表 +export function getCircuitList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/circuitList', + method: 'get', + params + }) +} + +// 灯箱列表 +export function getLampBoxList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampBoxList', + method: 'get', + params + }) +} +// 灯箱详情 +export function getLampBoxDetail(lampBoxId) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampBoxDetail', + method: 'get', + params: { + lampBoxId: lampBoxId + } + }) +} + +// 报警总览列表 +export function getAlarmList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/alarmList', + method: 'get', + params + }) +} + +// 报警详情 +export function getAlarmDetail(alarmId) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/alarmDetail', + method: 'get', + params: { + alarmId: alarmId + } + }) +} + +// 路灯控制 +export function lampControl(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampControl', + method: 'post', + params, + paramsSerializer: params => { + return qs.stringify(params, { indices: false }) + } + }) +} diff --git a/src/api/system/rule.js b/src/api/system/rule.js new file mode 100644 index 0000000..76c6b2d --- /dev/null +++ b/src/api/system/rule.js @@ -0,0 +1,59 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +// import qs from 'qs' + +// 获取当前报警列表 +export function getRuleList() { + return request({ + url: 'rule/listPage', + method: 'get' + }) +} +export function getContentList(params) { + return request({ + url: 'maintain/contentByType', + method: 'get', + params: { + type: params + } + }) +} +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 编辑 +export function editRecord(params) { + return request({ + url: 'maintain/update', + method: 'post', + params + }) +} +// 新增 +export function addRecord(params) { + return request({ + url: 'maintain/add', + method: 'post', + params + }) +} +// 删除 +export function delRecord(id) { + return request({ + url: 'maintain/delete', + method: 'post', + params: { + id: id + } + }) +} diff --git a/src/api/system/statistics.js b/src/api/system/statistics.js new file mode 100644 index 0000000..b25efe9 --- /dev/null +++ b/src/api/system/statistics.js @@ -0,0 +1,23 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +// import qs from 'qs' + +// +export function countByToilet(params) { + return request({ + url: '/sanitation/toiletStatistic/jobStaticByToilet', + method: 'get', + params + }) +} + +export function countByDay(params) { + return request({ + url: '/sanitation/toiletStatistic/jobStaticByDate', + method: 'get', + params + }) +} + diff --git a/src/assets/global_images/icon-position.png b/src/assets/global_images/icon-position.png new file mode 100644 index 0000000..7444038 --- /dev/null +++ b/src/assets/global_images/icon-position.png Binary files differ diff --git a/src/assets/global_images/location_green.png b/src/assets/global_images/location_green.png new file mode 100644 index 0000000..aa8be65 --- /dev/null +++ b/src/assets/global_images/location_green.png Binary files differ diff --git a/src/assets/global_images/location_red.png b/src/assets/global_images/location_red.png new file mode 100644 index 0000000..2be8c3d --- /dev/null +++ b/src/assets/global_images/location_red.png Binary files differ diff --git a/src/assets/global_images/location_yellow.png b/src/assets/global_images/location_yellow.png new file mode 100644 index 0000000..5ab6f4d --- /dev/null +++ b/src/assets/global_images/location_yellow.png Binary files differ diff --git a/src/assets/global_images/toilet-position.png b/src/assets/global_images/toilet-position.png new file mode 100644 index 0000000..7db6d9a --- /dev/null +++ b/src/assets/global_images/toilet-position.png Binary files differ diff --git a/src/assets/global_images/toilet.png b/src/assets/global_images/toilet.png new file mode 100644 index 0000000..6d9fc05 --- /dev/null +++ b/src/assets/global_images/toilet.png Binary files differ diff --git a/src/assets/global_images/toiletPhoto.png b/src/assets/global_images/toiletPhoto.png new file mode 100644 index 0000000..15d08e2 --- /dev/null +++ b/src/assets/global_images/toiletPhoto.png Binary files differ diff --git a/src/components/DownloadTemplate/index.vue b/src/components/DownloadTemplate/index.vue index 8ded2cd..7807cac 100644 --- a/src/components/DownloadTemplate/index.vue +++ b/src/components/DownloadTemplate/index.vue @@ -47,8 +47,8 @@ diff --git a/src/components/NormalTable/index.vue b/src/components/NormalTable/index.vue index 5077bef..04d322d 100644 --- a/src/components/NormalTable/index.vue +++ b/src/components/NormalTable/index.vue @@ -79,7 +79,7 @@
-
+
Object.assign(obj, { [key]: this[key] }), {}), + on: events.reduce((obj, key) => Object.assign(obj, { [key]: this.transmitEvent }), {}) + }) + } + this.props = [...extraProps, ...props.filter(prop => exceptProps.indexOf(prop))] + } +} + +export default prop => new Mixin(prop) diff --git a/src/components/mapWindow/base/mixins/common.js b/src/components/mapWindow/base/mixins/common.js new file mode 100644 index 0000000..2fd1a28 --- /dev/null +++ b/src/components/mapWindow/base/mixins/common.js @@ -0,0 +1,82 @@ +const types = { + map: { + unload: 'clearMap' + }, + control: { + unload: 'removeControl' + }, + layer: { + unload: 'removeLayer' + }, + features: { + unload: 'removeFeatures' + }, + listener: { + unload: 'removeListener' + } +} + +const getParent = $component => ($component.abstract || $component.$el === $component.$children[0].$el) ? getParent($component.$parent) : $component + +function destroyInstance () { + const { unload, renderByParent, $parent } = this + if (renderByParent) { + $parent.reload() + } + unload() +} + +class Mixin { + constructor (prop) { + this.methods = { + ready () { + const $parent = getParent(this.$parent) + const map = this.map = $parent.map + this.load() + this.$emit('ready', { + map + }) + }, + transmitEvent (e) { + this.$emit(e.type.replace(/^on/, ''), e) + }, + reload () { + this && this.$nextTick(() => { + this.unload() + this.$nextTick(this.load) + }) + }, + unload () { + const { map, originInstance } = this + try { + switch (prop.type) { + case 'search': + return originInstance.clearResults() + case 'autoComplete': + case 'lushu': + return originInstance.dispose() + case 'markerClusterer': + return originInstance.clearMarkers() + default: + map[types[prop.type].unload](originInstance) + } + } catch (e) {} + } + } + this.computed = { + renderByParent () { + return this.$parent.preventChildrenRender + } + } + this.mounted = function () { + console.log('common mounted') + const $parent = getParent(this.$parent) + const map = $parent.map + const { ready } = this + console.log(map) + map ? ready() : $parent.$on('onload', ready) + } + } +} + +export default type => new Mixin({ type }) diff --git a/src/components/mapWindow/leafletMap.vue b/src/components/mapWindow/leafletMap.vue new file mode 100644 index 0000000..b753cc0 --- /dev/null +++ b/src/components/mapWindow/leafletMap.vue @@ -0,0 +1,143 @@ + + + + + + + diff --git a/src/components/mapWindow/mapWindow.vue b/src/components/mapWindow/mapWindow.vue new file mode 100644 index 0000000..9ced291 --- /dev/null +++ b/src/components/mapWindow/mapWindow.vue @@ -0,0 +1,46 @@ + + + + + + diff --git a/src/icons/svg/bridge.svg b/src/icons/svg/bridge.svg new file mode 100644 index 0000000..1a0336f --- /dev/null +++ b/src/icons/svg/bridge.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/icons/svg/toilet.svg b/src/icons/svg/toilet.svg new file mode 100644 index 0000000..9d8e765 --- /dev/null +++ b/src/icons/svg/toilet.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/main.js b/src/main.js index f2d105d..3e4074e 100644 --- a/src/main.js +++ b/src/main.js @@ -18,6 +18,9 @@ // echart // import echarts from 'echarts' // Vue.prototype.$echarts = echarts +// 引入v-charts +import VCharts from 'v-charts' +Vue.use(VCharts) // 将自动注册所有组件为全局组件 // import dataV from '@jiaminghi/data-view' @@ -35,9 +38,19 @@ Vue.component('search-item', SearchItem) // 加载leaflet的css +// import 'leaflet/dist/leaflet.css' +// import 'leaflet-draw/dist/leaflet.draw.css' +import L from 'leaflet' import 'leaflet/dist/leaflet.css' -import 'leaflet-draw/dist/leaflet.draw.css' +Vue.config.productionTip = false +Vue.L = Vue.prototype.$L = L +delete L.Icon.Default.prototype._getIconUrl +L.Icon.Default.mergeOptions({ + iconRetinaUrl: require('leaflet/dist/images/marker-icon-2x.png'), + iconUrl: require('leaflet/dist/images/marker-icon.png'), + shadowUrl: require('leaflet/dist/images/marker-shadow.png') +}) /** * This project originally used easy-mock to simulate data, * but its official service is very unstable, diff --git a/src/permission.js b/src/permission.js index dc6b2f8..809ca86 100644 --- a/src/permission.js +++ b/src/permission.js @@ -25,8 +25,8 @@ store.dispatch('GetInfo').then(res => { // 拉取用户信息 // 设置当前子系统为基础资源子系统 const currentSys = { - code: 'baseResourse', - name: '基础资源子系统' + code: 'toliet', + name: '公共厕所管理系统' } // 将当前系统信息保存在localStorage中 store.commit('SET_SYSTEM', currentSys) diff --git a/src/router/index.js b/src/router/index.js index 39c295c..d23076d 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -8,8 +8,11 @@ /* Layout */ import Layout from '@/layout/Layout' +import { toiletRouters } from './modules/toilet' +import { workRouters } from './modules/work' +import { statisticsRouters } from './modules/statistics' +import { ruleRouters } from './modules/rule' import { systemRouters } from './modules/system' -import { exampleRouters } from './modules/example' /** * hidden: true if `hidden:true` will not show in the sidebar(default is false) @@ -40,11 +43,12 @@ ] }, // 登录页面 - { path: '/login', component: () => import('@/views/login/index'), hidden: true }, + { path: '/login', component: () => import('@/views/login/index_2'), hidden: true }, // 404错误页面 { path: '/404', component: () => import('@/views/errorPage/404'), hidden: true }, // 401 错误页面 - { path: '/401', component: () => import('@/views/errorPage/401'), hidden: true } + { path: '/401', component: () => import('@/views/errorPage/401'), hidden: true }, + { path: '/', redirect: '/toiletList', hidden: true } ] // 实例化vue的时候直挂载constantRouter export default new Router({ @@ -56,7 +60,10 @@ // 异步挂载路由 // 动态需要根据权限加载的路由表 export const asyncRouterMap = [ - ...exampleRouters, - ...systemRouters, + ...toiletRouters, + ...workRouters, + ...statisticsRouters, + ...ruleRouters, + // ...systemRouters, { path: '*', redirect: '/404', hidden: true } ] diff --git a/src/router/modules/rule.js b/src/router/modules/rule.js new file mode 100644 index 0000000..51e0283 --- /dev/null +++ b/src/router/modules/rule.js @@ -0,0 +1,24 @@ +/* Layout */ +import Layout from '@/layout/Layout' + +export const ruleRouters = [ + { + path: 'rule', + component: Layout, + redirect: '/rule', + name: 'Rule', + meta: { + title: '规章制度', + icon: 'icon-config', // 图标 + permission: ['/rule']// 权限名称 + }, + children: [ + { + path: '/rule', + name: 'Rule', + component: () => import('@/views/rule/listRule'), + meta: { title: '规章制度', icon: 'function', permission: ['/rule'] } + } + ] + } +] diff --git a/src/router/modules/statistics.js b/src/router/modules/statistics.js new file mode 100644 index 0000000..fb9cbea --- /dev/null +++ b/src/router/modules/statistics.js @@ -0,0 +1,30 @@ +/* Layout */ +import Layout from '@/layout/Layout' + +export const statisticsRouters = [ + { + path: 'statisticsToilet', + component: Layout, + redirect: '/workStatistics', + name: 'StatisticsToilet', + meta: { + title: '作业统计', + icon: 'icon-config', // 图标 + permission: ['/statisticsToilet']// 权限名称 + }, + children: [ + { + path: '/workStatistics', + name: 'WorkStatistics', + component: () => import('@/views/statistics/toiletAssessment'), + meta: { title: '作业统计', icon: '', permission: ['/toilet/workStatistics'] } + }, + { + path: '/evaluationStatistics', + name: 'EvaluationStatistics', + component: () => import('@/views/statistics/evaluationAssessment'), + meta: { title: '评价统计', icon: '', permission: ['/toilet/evaluationStatistics'] } + } + ] + } +] diff --git a/src/router/modules/toilet.js b/src/router/modules/toilet.js new file mode 100644 index 0000000..b221a0e --- /dev/null +++ b/src/router/modules/toilet.js @@ -0,0 +1,30 @@ +/* Layout */ +import Layout from '@/layout/Layout' + +export const toiletRouters = [ + { + path: 'toiletManage', + component: Layout, + redirect: '/toiletManage', + name: 'ToiletManage', + meta: { + title: '公厕管理', + icon: 'icon-config', // 图标 + permission: ['/toiletManage']// 权限名称 + }, + children: [ + { + path: '/toiletList', + name: 'ToiletList', + component: () => import('@/views/toiletManage/toiletList'), + meta: { title: '公厕台帐管理', icon: 'function', permission: ['/toiletList'] } + }, + { + path: '/toiletMap', + name: 'ToiletMap', + component: () => import('@/views/overview/overview'), + meta: { title: '地图总览', icon: 'function', permission: ['/toiletMap'] } + } + ] + } +] diff --git a/src/router/modules/work.js b/src/router/modules/work.js new file mode 100644 index 0000000..5e0759f --- /dev/null +++ b/src/router/modules/work.js @@ -0,0 +1,24 @@ +/* Layout */ +import Layout from '@/layout/Layout' + +export const workRouters = [ + { + path: 'toiletWork', + component: Layout, + redirect: '/toiletManage', + name: 'toiletWork', + meta: { + title: '作业管理', + icon: 'icon-config', // 图标 + permission: ['/toiletWork']// 权限名称 + }, + children: [ + { + path: '/toiletWork', + name: 'ToiletWork', + component: () => import('@/views/toiletClean/toiletCleanList'), + meta: { title: '作业管理', icon: 'function', permission: ['/toiletWork'] } + } + ] + } +] diff --git a/src/settings.js b/src/settings.js index b568ce0..b8159bf 100644 --- a/src/settings.js +++ b/src/settings.js @@ -3,7 +3,7 @@ * @type {boolean} true | false * @description 是否显示设置按钮 */ - showSettings: true, + showSettings: false, /** * @type {boolean} true | false diff --git a/src/store/modules/permission.js b/src/store/modules/permission.js index a0cb8cf..3ab50d5 100644 --- a/src/store/modules/permission.js +++ b/src/store/modules/permission.js @@ -120,17 +120,23 @@ }) }, // 获取用户权限 - GetMenus({ commit, state }) { - console.log('in store.permission.js:GetMenus:') + GetMenus({ commit, state }, currentSystem) { + // console.log('in store.permission.js:GetMenus:') + console.log('获取' + currentSystem.name + '的菜单') + const params = { + parentCode: currentSystem.code // 传入该子系统的code,获取子系统的权限 + } return new Promise((resolve, reject) => { - getMenus(state.token).then(response => { // 处理返回值 + // 此处获取用户所有权限 + getMenus(params).then(response => { // 处理返回值 const data = response.data const menus = [] // 仅菜单 const btns = [] // 非菜单 if (data.menus && data.menus.length > 0) { - commit('SET_MENUS', data.menus) - for (const menu of data.menus) { // 遍历菜单,获取所有的权限项 - if (menu.ismenu === '1') { // 将是菜单的放入menus + const allmenus = [...data.menus] + commit('SET_MENUS', allmenus) + for (const menu of allmenus) { // 遍历菜单,获取所有的权限项 + if (menu.resourceType === '02' || menu.resourceType === '03') { // 将是菜单的放入menus const menu_tmp = {} menu_tmp.url = menu.url menu_tmp.icon = menu.icon @@ -142,11 +148,11 @@ btn_tmp.name = menu.name btn_tmp.icon = menu.icon btns.push(btn_tmp) - // console.log(menu.url) } } // 过滤路由表 - const accessedRouters = filterAsyncRouter(asyncRouterMap, menus) + let accessedRouters = filterAsyncRouter(asyncRouterMap, menus) + // accessedRouters = filterRedirect(accessedRouters) commit('SET_BTNS', btns) commit('SET_ROUTERS', accessedRouters) resolve(response) diff --git a/src/utils/baseConfig.js b/src/utils/baseConfig.js index 1f4fa38..999593e 100644 --- a/src/utils/baseConfig.js +++ b/src/utils/baseConfig.js @@ -1,5 +1,5 @@ const project = { - title: '后台管理系统前端基础框架' + title: '路桥养护子系统' } export function getProject() { return project diff --git a/src/utils/dateutils.js b/src/utils/dateutils.js index 868111a..5cd16af 100644 --- a/src/utils/dateutils.js +++ b/src/utils/dateutils.js @@ -15,15 +15,15 @@ return ct_month } -export function getLastWeek() { // 默认显示上周 +export function getLastWeek(fmt) { // 默认显示上周 const ct_month = new Date() ct_month.setTime(ct_month.getTime() - 3600 * 1000 * 24 * 7) - return ct_month + return ct_month.Format(fmt) } -export function getLastMonth() { // 默认显示上个月 +export function getLastMonth(fmt) { // 默认显示上个月 const ct_month = new Date() ct_month.setTime(ct_month.getTime() - 3600 * 1000 * 24 * 30) - return ct_month + return ct_month.Format(fmt) } // 对Date的扩展,将 Date 转化为指定格式的String diff --git a/src/utils/exportutils.js b/src/utils/exportutils.js new file mode 100644 index 0000000..b5d0bcf --- /dev/null +++ b/src/utils/exportutils.js @@ -0,0 +1,19 @@ +/** + * 导出文件工具 + * @param blob 文件 + * @param fileName 导出文件名 + */ +export function exportFile(blob, fileName) { + if (window.navigator && window.navigator.msSaveOrOpenBlob) { + navigator.msSaveBlob(blob, fileName) + } else { + const downloadElement = document.createElement('a') + const href = window.URL.createObjectURL(blob) // 创建下载的链接 + downloadElement.href = href + downloadElement.download = fileName + document.body.appendChild(downloadElement) + downloadElement.click() // 点击下载 + document.body.removeChild(downloadElement) // 下载完成移除元素 + window.URL.revokeObjectURL(href) // 释放blob对象 + } +} diff --git a/src/utils/request.js b/src/utils/request.js index c88ea76..dc56e26 100644 --- a/src/utils/request.js +++ b/src/utils/request.js @@ -17,6 +17,13 @@ config.headers['token'] = getToken() // 让每个请求携带自定义token 请根据实际情况自行修改 console.log(config.headers['token']) } + // 在接口增加时间戳 + // if (config.method === 'get') { + config.params = { + _t: Date.parse(new Date()) / 1000, + ...config.params + } + // } return config }, error => { diff --git a/src/views/mapViews/choosePointDialog.vue b/src/views/mapViews/choosePointDialog.vue new file mode 100644 index 0000000..c9dde8a --- /dev/null +++ b/src/views/mapViews/choosePointDialog.vue @@ -0,0 +1,105 @@ + + + + + diff --git a/src/views/mapViews/mapView.vue b/src/views/mapViews/mapView.vue new file mode 100644 index 0000000..a18db88 --- /dev/null +++ b/src/views/mapViews/mapView.vue @@ -0,0 +1,73 @@ + + + + + diff --git a/src/views/order/editOrder.vue b/src/views/order/editOrder.vue new file mode 100644 index 0000000..4a5fd8a --- /dev/null +++ b/src/views/order/editOrder.vue @@ -0,0 +1,319 @@ + + + + + diff --git a/src/views/order/listMaintainRecords.vue b/src/views/order/listMaintainRecords.vue new file mode 100644 index 0000000..2d4f682 --- /dev/null +++ b/src/views/order/listMaintainRecords.vue @@ -0,0 +1,327 @@ + + + + + diff --git a/src/views/overview/overview.vue b/src/views/overview/overview.vue new file mode 100644 index 0000000..9525867 --- /dev/null +++ b/src/views/overview/overview.vue @@ -0,0 +1,285 @@ + + + + + diff --git a/src/views/overview/toiletDetailDialog.vue b/src/views/overview/toiletDetailDialog.vue new file mode 100644 index 0000000..2b3a511 --- /dev/null +++ b/src/views/overview/toiletDetailDialog.vue @@ -0,0 +1,263 @@ + + + + + + diff --git a/src/views/overview/toiletLayer.vue b/src/views/overview/toiletLayer.vue new file mode 100644 index 0000000..d784323 --- /dev/null +++ b/src/views/overview/toiletLayer.vue @@ -0,0 +1,152 @@ + + + + + + diff --git a/src/views/rule/listRule.vue b/src/views/rule/listRule.vue new file mode 100644 index 0000000..a19b9e4 --- /dev/null +++ b/src/views/rule/listRule.vue @@ -0,0 +1,157 @@ + + + + + diff --git a/src/views/statistics/barChart.vue b/src/views/statistics/barChart.vue new file mode 100644 index 0000000..d10eb38 --- /dev/null +++ b/src/views/statistics/barChart.vue @@ -0,0 +1,65 @@ + + + + + diff --git a/src/views/statistics/components/evaluationListDialog.vue b/src/views/statistics/components/evaluationListDialog.vue new file mode 100644 index 0000000..1560772 --- /dev/null +++ b/src/views/statistics/components/evaluationListDialog.vue @@ -0,0 +1,100 @@ + + + + + + diff --git a/config/index.js b/config/index.js index 8abd37a..19b33b1 100644 --- a/config/index.js +++ b/config/index.js @@ -69,7 +69,7 @@ * then assetsPublicPath should be set to "/bar/". * In most cases please use '/' !!! */ - assetsPublicPath: '/', + assetsPublicPath: '/toilet/', /** * Source Maps diff --git a/package.json b/package.json index 45f055f..9f3a3eb 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "echarts": "^4.2.1", "element-ui": "2.13.0", "event-source-polyfill": "^1.0.5", + "file-saver": "^2.0.5", "js-cookie": "2.2.0", "jsencrypt": "^3.0.0-rc.1", "leaflet": "^1.7.1", @@ -33,7 +34,9 @@ "vue-amap": "^0.5.9", "vue-baidu-map": "^0.21.22", "vue-router": "3.0.1", - "vuex": "3.0.1" + "vue2-leaflet": "^2.7.0", + "vuex": "3.0.1", + "xlsx": "^0.17.0" }, "devDependencies": { "autoprefixer": "8.5.0", diff --git a/src/api/common.js b/src/api/common.js index 87c582b..7804714 100644 --- a/src/api/common.js +++ b/src/api/common.js @@ -2,10 +2,14 @@ * 常用接口 */ import request from '@/utils/request' +import Vue from 'vue' + // 模板下载 export function downloadTemplate(fileName) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath return request({ - url: 'template/download', + url: lampPath + 'template/download', method: 'get', params: { filename: fileName @@ -19,7 +23,7 @@ const param = new FormData() param.append('file', fileobj.file) return request({ - url: 'imageUpload', + url: 'fileUpload', method: 'post', headers: { 'Content-Type': 'multipart/form-data' }, data: param diff --git a/src/api/sanitation/statistics.js b/src/api/sanitation/statistics.js new file mode 100644 index 0000000..ffeac18 --- /dev/null +++ b/src/api/sanitation/statistics.js @@ -0,0 +1,22 @@ + +/** + * 考核统计接口 + */ +import request from '@/utils/request' +// 公厕保洁次数统计 +export function getToiletJobCount(params) { + return request({ + url: '/sanitation/statistic/toilet/jobCount', + method: 'get', + params + }) +} + +// 公厕评分统计 +export function getToiletEvaluation(params) { + return request({ + url: '/sanitation/toiletEvaluation/statistics', + method: 'get', + params + }) +} diff --git a/src/api/sanitation/toilet.js b/src/api/sanitation/toilet.js new file mode 100644 index 0000000..11affd4 --- /dev/null +++ b/src/api/sanitation/toilet.js @@ -0,0 +1,133 @@ +/** + * 公厕管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' +// 公厕查询 +export function getToiletListPage(params) { + return request({ + url: '/sanitation/toilet/listPage', + method: 'get', + params + }) +} +// 公厕查询 +export function getToiletList(pid) { + return request({ + url: '/sanitation/toilet/list', + method: 'get', + params: { + pid: pid + } + }) +} + +// 添加公厕 +export function addToilet(params) { + return request({ + url: '/sanitation/toilet/add', + method: 'post', + params + }) +} +// 修改公厕机构 +export function updateToilet(params) { + return request({ + url: '/sanitation/toilet/update', + method: 'post', + params + }) +} +// 删除公厕机构 +export function delToilet(ids) { + return request({ + url: '/sanitation/toilet/delete', + method: 'post', + params: { + ids + }, + paramsSerializer: params => { + return qs.stringify(params, { indices: false }) + } + }) +} + +// 公厕基本信息详情 +export function getToiletInfoDetail(id) { + return request({ + url: '/sanitation/toilet/detail?toiletId=' + id, + method: 'get' + }) +} + +// 某公厕保洁记录 +export function getRecordsByToilet(params) { + return request({ + url: '/sanitation/toilet/jobRecord/detail', + method: 'get', + params + }) +} + +// 某公厕平均评分 +export function getScoreByToilet(params) { + return request({ + url: '/sanitation/toiletEvaluation/detailScore', + method: 'get', + params + }) +} + +// 某公厕评分列表 +export function getScoreListByToilet(params) { + return request({ + url: '/sanitation/toiletEvaluation/list', + method: 'get', + params + }) +} + + +// 批量导入 +export function batchImportToilet(fileobj) { + const param = new FormData() + param.append('file', fileobj) + return request({ + url: '/sanitation/toilet/import', + method: 'post', + headers: { 'Content-Type': 'multipart/form-data' }, + data: param + }) +} +// 批量导出 +export function batchExportToilet(params, config) { + return request({ + url: '/sanitation/toilet/export', + method: 'get', + timeout: 120000, + params, + ...config, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 公厕保洁记录查询 +export function getToiletJobRecords(params) { + return request({ + url: '/sanitation/toilet/jobRecord', + method: 'get', + params + }) +} + +// 批量导出 +export function batchExportToiletJobRecords(params, config) { + return request({ + url: '/sanitation/toilet/exportJobRecord', + method: 'get', + timeout: 120000, + params, + ...config, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} diff --git a/src/api/system/alarm.js b/src/api/system/alarm.js new file mode 100644 index 0000000..1c3a7ab --- /dev/null +++ b/src/api/system/alarm.js @@ -0,0 +1,62 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' + +// 获取当前报警列表 +export function getAlarmNowList(params) { + return request({ + url: '/alarm/listNowPage', + method: 'get', + params + }) +} + +// 获取当前报警列表 +export function getAlarmHistoryList(params) { + return request({ + url: '/alarm/listHisPage', + method: 'get', + params + }) +} + + +// 批量消警 +export function clearAll(params) { + return request({ + url: '/alarm/allClear', + method: 'get', + params + }) +} + +// 消警 +export function clearAlarm(params) { + return request({ + url: '/alarm/cancel', + method: 'get', + params + }) +} + +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 设置报警阈值 +export function setThresh(params) { + return request({ + url: '/alarm/resetAlarmRule', + method: 'post', + params + }) +} diff --git a/src/api/system/bridge.js b/src/api/system/bridge.js new file mode 100644 index 0000000..e8a4108 --- /dev/null +++ b/src/api/system/bridge.js @@ -0,0 +1,80 @@ +/** + * 桥梁管理接口 + */ +import request from '@/utils/request' + +// 获取桥梁详情 +export function getDetail(id) { + return request({ + url: '/bridge/detail', + method: 'get', + params: { + id: id + } + }) +} + +export function updateBridge(params) { + return request({ + url: '/bridge/update', + method: 'post', + params + }) +} +// 批量导出 +export function exportRecords(params) { + return request({ + url: 'device/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +export function getContentList(params) { + return request({ + url: 'maintain/contentByType', + method: 'get', + params: { + type: params + } + }) +} +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 编辑 +export function editRecord(params) { + return request({ + url: 'maintain/update', + method: 'post', + params + }) +} +// 新增 +export function addRecord(params) { + return request({ + url: 'maintain/add', + method: 'post', + params + }) +} +// 删除 +export function delRecord(id) { + return request({ + url: 'maintain/delete', + method: 'post', + params: { + id: id + } + }) +} diff --git a/src/api/system/data.js b/src/api/system/data.js new file mode 100644 index 0000000..4c95db5 --- /dev/null +++ b/src/api/system/data.js @@ -0,0 +1,63 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' + +// 获取当前报警列表 +export function getHistoryList(params) { + return request({ + url: '/data/hisListPage', + method: 'get', + params + }) +} + +// 获取当前报警列表 +export function getHistory(params) { + return request({ + url: '/data/hisList', + method: 'get', + params + }) +} + + + +// 批量消警 +export function clearAll(params) { + return request({ + url: '/alarm/allClear', + method: 'get', + params + }) +} + +// 消警 +export function clearAlarm(params) { + return request({ + url: '/alarm/cancel', + method: 'get', + params + }) +} + +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 设置报警阈值 +export function setThresh(params) { + return request({ + url: '/alarm/resetAlarmRule', + method: 'post', + params + }) +} diff --git a/src/api/system/order.js b/src/api/system/order.js new file mode 100644 index 0000000..7007c50 --- /dev/null +++ b/src/api/system/order.js @@ -0,0 +1,71 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +// import qs from 'qs' + +// 获取当前报警列表 +export function getRecordList(params) { + return request({ + url: '/maintain/listPage', + method: 'get', + params + }) +} +// 批量导出 +export function exportRecords(params) { + return request({ + url: 'device/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +export function getContentList(params) { + return request({ + url: 'maintain/contentByType', + method: 'get', + params: { + type: params + } + }) +} +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 编辑 +export function editRecord(params) { + return request({ + url: 'maintain/update', + method: 'post', + params + }) +} +// 新增 +export function addRecord(params) { + return request({ + url: 'maintain/add', + method: 'post', + params + }) +} +// 删除 +export function delRecord(id) { + return request({ + url: 'maintain/delete', + method: 'post', + params: { + bridgeMaintenanceId: id + } + }) +} diff --git a/src/api/system/overview.js b/src/api/system/overview.js new file mode 100644 index 0000000..bca50cc --- /dev/null +++ b/src/api/system/overview.js @@ -0,0 +1,109 @@ +import request from '@/utils/request' +import qs from "qs" +import Vue from 'vue' + +// 路灯状态统计 +export function getLampStatus() { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampStatus', + method: 'get' + }) +} + +// 路灯总览列表 +export function getLampList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampList', + method: 'get', + params + }) +} + +// 路灯详情 +export function getlampDetail(lampId) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampDetail', + method: 'get', + params: { + lampId: lampId + } + }) +} + +// 回路列表 +export function getCircuitList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/circuitList', + method: 'get', + params + }) +} + +// 灯箱列表 +export function getLampBoxList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampBoxList', + method: 'get', + params + }) +} +// 灯箱详情 +export function getLampBoxDetail(lampBoxId) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampBoxDetail', + method: 'get', + params: { + lampBoxId: lampBoxId + } + }) +} + +// 报警总览列表 +export function getAlarmList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/alarmList', + method: 'get', + params + }) +} + +// 报警详情 +export function getAlarmDetail(alarmId) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/alarmDetail', + method: 'get', + params: { + alarmId: alarmId + } + }) +} + +// 路灯控制 +export function lampControl(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampControl', + method: 'post', + params, + paramsSerializer: params => { + return qs.stringify(params, { indices: false }) + } + }) +} diff --git a/src/api/system/rule.js b/src/api/system/rule.js new file mode 100644 index 0000000..76c6b2d --- /dev/null +++ b/src/api/system/rule.js @@ -0,0 +1,59 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +// import qs from 'qs' + +// 获取当前报警列表 +export function getRuleList() { + return request({ + url: 'rule/listPage', + method: 'get' + }) +} +export function getContentList(params) { + return request({ + url: 'maintain/contentByType', + method: 'get', + params: { + type: params + } + }) +} +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 编辑 +export function editRecord(params) { + return request({ + url: 'maintain/update', + method: 'post', + params + }) +} +// 新增 +export function addRecord(params) { + return request({ + url: 'maintain/add', + method: 'post', + params + }) +} +// 删除 +export function delRecord(id) { + return request({ + url: 'maintain/delete', + method: 'post', + params: { + id: id + } + }) +} diff --git a/src/api/system/statistics.js b/src/api/system/statistics.js new file mode 100644 index 0000000..b25efe9 --- /dev/null +++ b/src/api/system/statistics.js @@ -0,0 +1,23 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +// import qs from 'qs' + +// +export function countByToilet(params) { + return request({ + url: '/sanitation/toiletStatistic/jobStaticByToilet', + method: 'get', + params + }) +} + +export function countByDay(params) { + return request({ + url: '/sanitation/toiletStatistic/jobStaticByDate', + method: 'get', + params + }) +} + diff --git a/src/assets/global_images/icon-position.png b/src/assets/global_images/icon-position.png new file mode 100644 index 0000000..7444038 --- /dev/null +++ b/src/assets/global_images/icon-position.png Binary files differ diff --git a/src/assets/global_images/location_green.png b/src/assets/global_images/location_green.png new file mode 100644 index 0000000..aa8be65 --- /dev/null +++ b/src/assets/global_images/location_green.png Binary files differ diff --git a/src/assets/global_images/location_red.png b/src/assets/global_images/location_red.png new file mode 100644 index 0000000..2be8c3d --- /dev/null +++ b/src/assets/global_images/location_red.png Binary files differ diff --git a/src/assets/global_images/location_yellow.png b/src/assets/global_images/location_yellow.png new file mode 100644 index 0000000..5ab6f4d --- /dev/null +++ b/src/assets/global_images/location_yellow.png Binary files differ diff --git a/src/assets/global_images/toilet-position.png b/src/assets/global_images/toilet-position.png new file mode 100644 index 0000000..7db6d9a --- /dev/null +++ b/src/assets/global_images/toilet-position.png Binary files differ diff --git a/src/assets/global_images/toilet.png b/src/assets/global_images/toilet.png new file mode 100644 index 0000000..6d9fc05 --- /dev/null +++ b/src/assets/global_images/toilet.png Binary files differ diff --git a/src/assets/global_images/toiletPhoto.png b/src/assets/global_images/toiletPhoto.png new file mode 100644 index 0000000..15d08e2 --- /dev/null +++ b/src/assets/global_images/toiletPhoto.png Binary files differ diff --git a/src/components/DownloadTemplate/index.vue b/src/components/DownloadTemplate/index.vue index 8ded2cd..7807cac 100644 --- a/src/components/DownloadTemplate/index.vue +++ b/src/components/DownloadTemplate/index.vue @@ -47,8 +47,8 @@ diff --git a/src/components/NormalTable/index.vue b/src/components/NormalTable/index.vue index 5077bef..04d322d 100644 --- a/src/components/NormalTable/index.vue +++ b/src/components/NormalTable/index.vue @@ -79,7 +79,7 @@
-
+
Object.assign(obj, { [key]: this[key] }), {}), + on: events.reduce((obj, key) => Object.assign(obj, { [key]: this.transmitEvent }), {}) + }) + } + this.props = [...extraProps, ...props.filter(prop => exceptProps.indexOf(prop))] + } +} + +export default prop => new Mixin(prop) diff --git a/src/components/mapWindow/base/mixins/common.js b/src/components/mapWindow/base/mixins/common.js new file mode 100644 index 0000000..2fd1a28 --- /dev/null +++ b/src/components/mapWindow/base/mixins/common.js @@ -0,0 +1,82 @@ +const types = { + map: { + unload: 'clearMap' + }, + control: { + unload: 'removeControl' + }, + layer: { + unload: 'removeLayer' + }, + features: { + unload: 'removeFeatures' + }, + listener: { + unload: 'removeListener' + } +} + +const getParent = $component => ($component.abstract || $component.$el === $component.$children[0].$el) ? getParent($component.$parent) : $component + +function destroyInstance () { + const { unload, renderByParent, $parent } = this + if (renderByParent) { + $parent.reload() + } + unload() +} + +class Mixin { + constructor (prop) { + this.methods = { + ready () { + const $parent = getParent(this.$parent) + const map = this.map = $parent.map + this.load() + this.$emit('ready', { + map + }) + }, + transmitEvent (e) { + this.$emit(e.type.replace(/^on/, ''), e) + }, + reload () { + this && this.$nextTick(() => { + this.unload() + this.$nextTick(this.load) + }) + }, + unload () { + const { map, originInstance } = this + try { + switch (prop.type) { + case 'search': + return originInstance.clearResults() + case 'autoComplete': + case 'lushu': + return originInstance.dispose() + case 'markerClusterer': + return originInstance.clearMarkers() + default: + map[types[prop.type].unload](originInstance) + } + } catch (e) {} + } + } + this.computed = { + renderByParent () { + return this.$parent.preventChildrenRender + } + } + this.mounted = function () { + console.log('common mounted') + const $parent = getParent(this.$parent) + const map = $parent.map + const { ready } = this + console.log(map) + map ? ready() : $parent.$on('onload', ready) + } + } +} + +export default type => new Mixin({ type }) diff --git a/src/components/mapWindow/leafletMap.vue b/src/components/mapWindow/leafletMap.vue new file mode 100644 index 0000000..b753cc0 --- /dev/null +++ b/src/components/mapWindow/leafletMap.vue @@ -0,0 +1,143 @@ + + + + + + + diff --git a/src/components/mapWindow/mapWindow.vue b/src/components/mapWindow/mapWindow.vue new file mode 100644 index 0000000..9ced291 --- /dev/null +++ b/src/components/mapWindow/mapWindow.vue @@ -0,0 +1,46 @@ + + + + + + diff --git a/src/icons/svg/bridge.svg b/src/icons/svg/bridge.svg new file mode 100644 index 0000000..1a0336f --- /dev/null +++ b/src/icons/svg/bridge.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/icons/svg/toilet.svg b/src/icons/svg/toilet.svg new file mode 100644 index 0000000..9d8e765 --- /dev/null +++ b/src/icons/svg/toilet.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/main.js b/src/main.js index f2d105d..3e4074e 100644 --- a/src/main.js +++ b/src/main.js @@ -18,6 +18,9 @@ // echart // import echarts from 'echarts' // Vue.prototype.$echarts = echarts +// 引入v-charts +import VCharts from 'v-charts' +Vue.use(VCharts) // 将自动注册所有组件为全局组件 // import dataV from '@jiaminghi/data-view' @@ -35,9 +38,19 @@ Vue.component('search-item', SearchItem) // 加载leaflet的css +// import 'leaflet/dist/leaflet.css' +// import 'leaflet-draw/dist/leaflet.draw.css' +import L from 'leaflet' import 'leaflet/dist/leaflet.css' -import 'leaflet-draw/dist/leaflet.draw.css' +Vue.config.productionTip = false +Vue.L = Vue.prototype.$L = L +delete L.Icon.Default.prototype._getIconUrl +L.Icon.Default.mergeOptions({ + iconRetinaUrl: require('leaflet/dist/images/marker-icon-2x.png'), + iconUrl: require('leaflet/dist/images/marker-icon.png'), + shadowUrl: require('leaflet/dist/images/marker-shadow.png') +}) /** * This project originally used easy-mock to simulate data, * but its official service is very unstable, diff --git a/src/permission.js b/src/permission.js index dc6b2f8..809ca86 100644 --- a/src/permission.js +++ b/src/permission.js @@ -25,8 +25,8 @@ store.dispatch('GetInfo').then(res => { // 拉取用户信息 // 设置当前子系统为基础资源子系统 const currentSys = { - code: 'baseResourse', - name: '基础资源子系统' + code: 'toliet', + name: '公共厕所管理系统' } // 将当前系统信息保存在localStorage中 store.commit('SET_SYSTEM', currentSys) diff --git a/src/router/index.js b/src/router/index.js index 39c295c..d23076d 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -8,8 +8,11 @@ /* Layout */ import Layout from '@/layout/Layout' +import { toiletRouters } from './modules/toilet' +import { workRouters } from './modules/work' +import { statisticsRouters } from './modules/statistics' +import { ruleRouters } from './modules/rule' import { systemRouters } from './modules/system' -import { exampleRouters } from './modules/example' /** * hidden: true if `hidden:true` will not show in the sidebar(default is false) @@ -40,11 +43,12 @@ ] }, // 登录页面 - { path: '/login', component: () => import('@/views/login/index'), hidden: true }, + { path: '/login', component: () => import('@/views/login/index_2'), hidden: true }, // 404错误页面 { path: '/404', component: () => import('@/views/errorPage/404'), hidden: true }, // 401 错误页面 - { path: '/401', component: () => import('@/views/errorPage/401'), hidden: true } + { path: '/401', component: () => import('@/views/errorPage/401'), hidden: true }, + { path: '/', redirect: '/toiletList', hidden: true } ] // 实例化vue的时候直挂载constantRouter export default new Router({ @@ -56,7 +60,10 @@ // 异步挂载路由 // 动态需要根据权限加载的路由表 export const asyncRouterMap = [ - ...exampleRouters, - ...systemRouters, + ...toiletRouters, + ...workRouters, + ...statisticsRouters, + ...ruleRouters, + // ...systemRouters, { path: '*', redirect: '/404', hidden: true } ] diff --git a/src/router/modules/rule.js b/src/router/modules/rule.js new file mode 100644 index 0000000..51e0283 --- /dev/null +++ b/src/router/modules/rule.js @@ -0,0 +1,24 @@ +/* Layout */ +import Layout from '@/layout/Layout' + +export const ruleRouters = [ + { + path: 'rule', + component: Layout, + redirect: '/rule', + name: 'Rule', + meta: { + title: '规章制度', + icon: 'icon-config', // 图标 + permission: ['/rule']// 权限名称 + }, + children: [ + { + path: '/rule', + name: 'Rule', + component: () => import('@/views/rule/listRule'), + meta: { title: '规章制度', icon: 'function', permission: ['/rule'] } + } + ] + } +] diff --git a/src/router/modules/statistics.js b/src/router/modules/statistics.js new file mode 100644 index 0000000..fb9cbea --- /dev/null +++ b/src/router/modules/statistics.js @@ -0,0 +1,30 @@ +/* Layout */ +import Layout from '@/layout/Layout' + +export const statisticsRouters = [ + { + path: 'statisticsToilet', + component: Layout, + redirect: '/workStatistics', + name: 'StatisticsToilet', + meta: { + title: '作业统计', + icon: 'icon-config', // 图标 + permission: ['/statisticsToilet']// 权限名称 + }, + children: [ + { + path: '/workStatistics', + name: 'WorkStatistics', + component: () => import('@/views/statistics/toiletAssessment'), + meta: { title: '作业统计', icon: '', permission: ['/toilet/workStatistics'] } + }, + { + path: '/evaluationStatistics', + name: 'EvaluationStatistics', + component: () => import('@/views/statistics/evaluationAssessment'), + meta: { title: '评价统计', icon: '', permission: ['/toilet/evaluationStatistics'] } + } + ] + } +] diff --git a/src/router/modules/toilet.js b/src/router/modules/toilet.js new file mode 100644 index 0000000..b221a0e --- /dev/null +++ b/src/router/modules/toilet.js @@ -0,0 +1,30 @@ +/* Layout */ +import Layout from '@/layout/Layout' + +export const toiletRouters = [ + { + path: 'toiletManage', + component: Layout, + redirect: '/toiletManage', + name: 'ToiletManage', + meta: { + title: '公厕管理', + icon: 'icon-config', // 图标 + permission: ['/toiletManage']// 权限名称 + }, + children: [ + { + path: '/toiletList', + name: 'ToiletList', + component: () => import('@/views/toiletManage/toiletList'), + meta: { title: '公厕台帐管理', icon: 'function', permission: ['/toiletList'] } + }, + { + path: '/toiletMap', + name: 'ToiletMap', + component: () => import('@/views/overview/overview'), + meta: { title: '地图总览', icon: 'function', permission: ['/toiletMap'] } + } + ] + } +] diff --git a/src/router/modules/work.js b/src/router/modules/work.js new file mode 100644 index 0000000..5e0759f --- /dev/null +++ b/src/router/modules/work.js @@ -0,0 +1,24 @@ +/* Layout */ +import Layout from '@/layout/Layout' + +export const workRouters = [ + { + path: 'toiletWork', + component: Layout, + redirect: '/toiletManage', + name: 'toiletWork', + meta: { + title: '作业管理', + icon: 'icon-config', // 图标 + permission: ['/toiletWork']// 权限名称 + }, + children: [ + { + path: '/toiletWork', + name: 'ToiletWork', + component: () => import('@/views/toiletClean/toiletCleanList'), + meta: { title: '作业管理', icon: 'function', permission: ['/toiletWork'] } + } + ] + } +] diff --git a/src/settings.js b/src/settings.js index b568ce0..b8159bf 100644 --- a/src/settings.js +++ b/src/settings.js @@ -3,7 +3,7 @@ * @type {boolean} true | false * @description 是否显示设置按钮 */ - showSettings: true, + showSettings: false, /** * @type {boolean} true | false diff --git a/src/store/modules/permission.js b/src/store/modules/permission.js index a0cb8cf..3ab50d5 100644 --- a/src/store/modules/permission.js +++ b/src/store/modules/permission.js @@ -120,17 +120,23 @@ }) }, // 获取用户权限 - GetMenus({ commit, state }) { - console.log('in store.permission.js:GetMenus:') + GetMenus({ commit, state }, currentSystem) { + // console.log('in store.permission.js:GetMenus:') + console.log('获取' + currentSystem.name + '的菜单') + const params = { + parentCode: currentSystem.code // 传入该子系统的code,获取子系统的权限 + } return new Promise((resolve, reject) => { - getMenus(state.token).then(response => { // 处理返回值 + // 此处获取用户所有权限 + getMenus(params).then(response => { // 处理返回值 const data = response.data const menus = [] // 仅菜单 const btns = [] // 非菜单 if (data.menus && data.menus.length > 0) { - commit('SET_MENUS', data.menus) - for (const menu of data.menus) { // 遍历菜单,获取所有的权限项 - if (menu.ismenu === '1') { // 将是菜单的放入menus + const allmenus = [...data.menus] + commit('SET_MENUS', allmenus) + for (const menu of allmenus) { // 遍历菜单,获取所有的权限项 + if (menu.resourceType === '02' || menu.resourceType === '03') { // 将是菜单的放入menus const menu_tmp = {} menu_tmp.url = menu.url menu_tmp.icon = menu.icon @@ -142,11 +148,11 @@ btn_tmp.name = menu.name btn_tmp.icon = menu.icon btns.push(btn_tmp) - // console.log(menu.url) } } // 过滤路由表 - const accessedRouters = filterAsyncRouter(asyncRouterMap, menus) + let accessedRouters = filterAsyncRouter(asyncRouterMap, menus) + // accessedRouters = filterRedirect(accessedRouters) commit('SET_BTNS', btns) commit('SET_ROUTERS', accessedRouters) resolve(response) diff --git a/src/utils/baseConfig.js b/src/utils/baseConfig.js index 1f4fa38..999593e 100644 --- a/src/utils/baseConfig.js +++ b/src/utils/baseConfig.js @@ -1,5 +1,5 @@ const project = { - title: '后台管理系统前端基础框架' + title: '路桥养护子系统' } export function getProject() { return project diff --git a/src/utils/dateutils.js b/src/utils/dateutils.js index 868111a..5cd16af 100644 --- a/src/utils/dateutils.js +++ b/src/utils/dateutils.js @@ -15,15 +15,15 @@ return ct_month } -export function getLastWeek() { // 默认显示上周 +export function getLastWeek(fmt) { // 默认显示上周 const ct_month = new Date() ct_month.setTime(ct_month.getTime() - 3600 * 1000 * 24 * 7) - return ct_month + return ct_month.Format(fmt) } -export function getLastMonth() { // 默认显示上个月 +export function getLastMonth(fmt) { // 默认显示上个月 const ct_month = new Date() ct_month.setTime(ct_month.getTime() - 3600 * 1000 * 24 * 30) - return ct_month + return ct_month.Format(fmt) } // 对Date的扩展,将 Date 转化为指定格式的String diff --git a/src/utils/exportutils.js b/src/utils/exportutils.js new file mode 100644 index 0000000..b5d0bcf --- /dev/null +++ b/src/utils/exportutils.js @@ -0,0 +1,19 @@ +/** + * 导出文件工具 + * @param blob 文件 + * @param fileName 导出文件名 + */ +export function exportFile(blob, fileName) { + if (window.navigator && window.navigator.msSaveOrOpenBlob) { + navigator.msSaveBlob(blob, fileName) + } else { + const downloadElement = document.createElement('a') + const href = window.URL.createObjectURL(blob) // 创建下载的链接 + downloadElement.href = href + downloadElement.download = fileName + document.body.appendChild(downloadElement) + downloadElement.click() // 点击下载 + document.body.removeChild(downloadElement) // 下载完成移除元素 + window.URL.revokeObjectURL(href) // 释放blob对象 + } +} diff --git a/src/utils/request.js b/src/utils/request.js index c88ea76..dc56e26 100644 --- a/src/utils/request.js +++ b/src/utils/request.js @@ -17,6 +17,13 @@ config.headers['token'] = getToken() // 让每个请求携带自定义token 请根据实际情况自行修改 console.log(config.headers['token']) } + // 在接口增加时间戳 + // if (config.method === 'get') { + config.params = { + _t: Date.parse(new Date()) / 1000, + ...config.params + } + // } return config }, error => { diff --git a/src/views/mapViews/choosePointDialog.vue b/src/views/mapViews/choosePointDialog.vue new file mode 100644 index 0000000..c9dde8a --- /dev/null +++ b/src/views/mapViews/choosePointDialog.vue @@ -0,0 +1,105 @@ + + + + + diff --git a/src/views/mapViews/mapView.vue b/src/views/mapViews/mapView.vue new file mode 100644 index 0000000..a18db88 --- /dev/null +++ b/src/views/mapViews/mapView.vue @@ -0,0 +1,73 @@ + + + + + diff --git a/src/views/order/editOrder.vue b/src/views/order/editOrder.vue new file mode 100644 index 0000000..4a5fd8a --- /dev/null +++ b/src/views/order/editOrder.vue @@ -0,0 +1,319 @@ + + + + + diff --git a/src/views/order/listMaintainRecords.vue b/src/views/order/listMaintainRecords.vue new file mode 100644 index 0000000..2d4f682 --- /dev/null +++ b/src/views/order/listMaintainRecords.vue @@ -0,0 +1,327 @@ + + + + + diff --git a/src/views/overview/overview.vue b/src/views/overview/overview.vue new file mode 100644 index 0000000..9525867 --- /dev/null +++ b/src/views/overview/overview.vue @@ -0,0 +1,285 @@ + + + + + diff --git a/src/views/overview/toiletDetailDialog.vue b/src/views/overview/toiletDetailDialog.vue new file mode 100644 index 0000000..2b3a511 --- /dev/null +++ b/src/views/overview/toiletDetailDialog.vue @@ -0,0 +1,263 @@ + + + + + + diff --git a/src/views/overview/toiletLayer.vue b/src/views/overview/toiletLayer.vue new file mode 100644 index 0000000..d784323 --- /dev/null +++ b/src/views/overview/toiletLayer.vue @@ -0,0 +1,152 @@ + + + + + + diff --git a/src/views/rule/listRule.vue b/src/views/rule/listRule.vue new file mode 100644 index 0000000..a19b9e4 --- /dev/null +++ b/src/views/rule/listRule.vue @@ -0,0 +1,157 @@ + + + + + diff --git a/src/views/statistics/barChart.vue b/src/views/statistics/barChart.vue new file mode 100644 index 0000000..d10eb38 --- /dev/null +++ b/src/views/statistics/barChart.vue @@ -0,0 +1,65 @@ + + + + + diff --git a/src/views/statistics/components/evaluationListDialog.vue b/src/views/statistics/components/evaluationListDialog.vue new file mode 100644 index 0000000..1560772 --- /dev/null +++ b/src/views/statistics/components/evaluationListDialog.vue @@ -0,0 +1,100 @@ + + + + + + diff --git a/src/views/statistics/components/workChart.vue b/src/views/statistics/components/workChart.vue new file mode 100644 index 0000000..a891e0c --- /dev/null +++ b/src/views/statistics/components/workChart.vue @@ -0,0 +1,79 @@ + + + + + diff --git a/config/index.js b/config/index.js index 8abd37a..19b33b1 100644 --- a/config/index.js +++ b/config/index.js @@ -69,7 +69,7 @@ * then assetsPublicPath should be set to "/bar/". * In most cases please use '/' !!! */ - assetsPublicPath: '/', + assetsPublicPath: '/toilet/', /** * Source Maps diff --git a/package.json b/package.json index 45f055f..9f3a3eb 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "echarts": "^4.2.1", "element-ui": "2.13.0", "event-source-polyfill": "^1.0.5", + "file-saver": "^2.0.5", "js-cookie": "2.2.0", "jsencrypt": "^3.0.0-rc.1", "leaflet": "^1.7.1", @@ -33,7 +34,9 @@ "vue-amap": "^0.5.9", "vue-baidu-map": "^0.21.22", "vue-router": "3.0.1", - "vuex": "3.0.1" + "vue2-leaflet": "^2.7.0", + "vuex": "3.0.1", + "xlsx": "^0.17.0" }, "devDependencies": { "autoprefixer": "8.5.0", diff --git a/src/api/common.js b/src/api/common.js index 87c582b..7804714 100644 --- a/src/api/common.js +++ b/src/api/common.js @@ -2,10 +2,14 @@ * 常用接口 */ import request from '@/utils/request' +import Vue from 'vue' + // 模板下载 export function downloadTemplate(fileName) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath return request({ - url: 'template/download', + url: lampPath + 'template/download', method: 'get', params: { filename: fileName @@ -19,7 +23,7 @@ const param = new FormData() param.append('file', fileobj.file) return request({ - url: 'imageUpload', + url: 'fileUpload', method: 'post', headers: { 'Content-Type': 'multipart/form-data' }, data: param diff --git a/src/api/sanitation/statistics.js b/src/api/sanitation/statistics.js new file mode 100644 index 0000000..ffeac18 --- /dev/null +++ b/src/api/sanitation/statistics.js @@ -0,0 +1,22 @@ + +/** + * 考核统计接口 + */ +import request from '@/utils/request' +// 公厕保洁次数统计 +export function getToiletJobCount(params) { + return request({ + url: '/sanitation/statistic/toilet/jobCount', + method: 'get', + params + }) +} + +// 公厕评分统计 +export function getToiletEvaluation(params) { + return request({ + url: '/sanitation/toiletEvaluation/statistics', + method: 'get', + params + }) +} diff --git a/src/api/sanitation/toilet.js b/src/api/sanitation/toilet.js new file mode 100644 index 0000000..11affd4 --- /dev/null +++ b/src/api/sanitation/toilet.js @@ -0,0 +1,133 @@ +/** + * 公厕管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' +// 公厕查询 +export function getToiletListPage(params) { + return request({ + url: '/sanitation/toilet/listPage', + method: 'get', + params + }) +} +// 公厕查询 +export function getToiletList(pid) { + return request({ + url: '/sanitation/toilet/list', + method: 'get', + params: { + pid: pid + } + }) +} + +// 添加公厕 +export function addToilet(params) { + return request({ + url: '/sanitation/toilet/add', + method: 'post', + params + }) +} +// 修改公厕机构 +export function updateToilet(params) { + return request({ + url: '/sanitation/toilet/update', + method: 'post', + params + }) +} +// 删除公厕机构 +export function delToilet(ids) { + return request({ + url: '/sanitation/toilet/delete', + method: 'post', + params: { + ids + }, + paramsSerializer: params => { + return qs.stringify(params, { indices: false }) + } + }) +} + +// 公厕基本信息详情 +export function getToiletInfoDetail(id) { + return request({ + url: '/sanitation/toilet/detail?toiletId=' + id, + method: 'get' + }) +} + +// 某公厕保洁记录 +export function getRecordsByToilet(params) { + return request({ + url: '/sanitation/toilet/jobRecord/detail', + method: 'get', + params + }) +} + +// 某公厕平均评分 +export function getScoreByToilet(params) { + return request({ + url: '/sanitation/toiletEvaluation/detailScore', + method: 'get', + params + }) +} + +// 某公厕评分列表 +export function getScoreListByToilet(params) { + return request({ + url: '/sanitation/toiletEvaluation/list', + method: 'get', + params + }) +} + + +// 批量导入 +export function batchImportToilet(fileobj) { + const param = new FormData() + param.append('file', fileobj) + return request({ + url: '/sanitation/toilet/import', + method: 'post', + headers: { 'Content-Type': 'multipart/form-data' }, + data: param + }) +} +// 批量导出 +export function batchExportToilet(params, config) { + return request({ + url: '/sanitation/toilet/export', + method: 'get', + timeout: 120000, + params, + ...config, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 公厕保洁记录查询 +export function getToiletJobRecords(params) { + return request({ + url: '/sanitation/toilet/jobRecord', + method: 'get', + params + }) +} + +// 批量导出 +export function batchExportToiletJobRecords(params, config) { + return request({ + url: '/sanitation/toilet/exportJobRecord', + method: 'get', + timeout: 120000, + params, + ...config, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} diff --git a/src/api/system/alarm.js b/src/api/system/alarm.js new file mode 100644 index 0000000..1c3a7ab --- /dev/null +++ b/src/api/system/alarm.js @@ -0,0 +1,62 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' + +// 获取当前报警列表 +export function getAlarmNowList(params) { + return request({ + url: '/alarm/listNowPage', + method: 'get', + params + }) +} + +// 获取当前报警列表 +export function getAlarmHistoryList(params) { + return request({ + url: '/alarm/listHisPage', + method: 'get', + params + }) +} + + +// 批量消警 +export function clearAll(params) { + return request({ + url: '/alarm/allClear', + method: 'get', + params + }) +} + +// 消警 +export function clearAlarm(params) { + return request({ + url: '/alarm/cancel', + method: 'get', + params + }) +} + +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 设置报警阈值 +export function setThresh(params) { + return request({ + url: '/alarm/resetAlarmRule', + method: 'post', + params + }) +} diff --git a/src/api/system/bridge.js b/src/api/system/bridge.js new file mode 100644 index 0000000..e8a4108 --- /dev/null +++ b/src/api/system/bridge.js @@ -0,0 +1,80 @@ +/** + * 桥梁管理接口 + */ +import request from '@/utils/request' + +// 获取桥梁详情 +export function getDetail(id) { + return request({ + url: '/bridge/detail', + method: 'get', + params: { + id: id + } + }) +} + +export function updateBridge(params) { + return request({ + url: '/bridge/update', + method: 'post', + params + }) +} +// 批量导出 +export function exportRecords(params) { + return request({ + url: 'device/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +export function getContentList(params) { + return request({ + url: 'maintain/contentByType', + method: 'get', + params: { + type: params + } + }) +} +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 编辑 +export function editRecord(params) { + return request({ + url: 'maintain/update', + method: 'post', + params + }) +} +// 新增 +export function addRecord(params) { + return request({ + url: 'maintain/add', + method: 'post', + params + }) +} +// 删除 +export function delRecord(id) { + return request({ + url: 'maintain/delete', + method: 'post', + params: { + id: id + } + }) +} diff --git a/src/api/system/data.js b/src/api/system/data.js new file mode 100644 index 0000000..4c95db5 --- /dev/null +++ b/src/api/system/data.js @@ -0,0 +1,63 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' + +// 获取当前报警列表 +export function getHistoryList(params) { + return request({ + url: '/data/hisListPage', + method: 'get', + params + }) +} + +// 获取当前报警列表 +export function getHistory(params) { + return request({ + url: '/data/hisList', + method: 'get', + params + }) +} + + + +// 批量消警 +export function clearAll(params) { + return request({ + url: '/alarm/allClear', + method: 'get', + params + }) +} + +// 消警 +export function clearAlarm(params) { + return request({ + url: '/alarm/cancel', + method: 'get', + params + }) +} + +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 设置报警阈值 +export function setThresh(params) { + return request({ + url: '/alarm/resetAlarmRule', + method: 'post', + params + }) +} diff --git a/src/api/system/order.js b/src/api/system/order.js new file mode 100644 index 0000000..7007c50 --- /dev/null +++ b/src/api/system/order.js @@ -0,0 +1,71 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +// import qs from 'qs' + +// 获取当前报警列表 +export function getRecordList(params) { + return request({ + url: '/maintain/listPage', + method: 'get', + params + }) +} +// 批量导出 +export function exportRecords(params) { + return request({ + url: 'device/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +export function getContentList(params) { + return request({ + url: 'maintain/contentByType', + method: 'get', + params: { + type: params + } + }) +} +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 编辑 +export function editRecord(params) { + return request({ + url: 'maintain/update', + method: 'post', + params + }) +} +// 新增 +export function addRecord(params) { + return request({ + url: 'maintain/add', + method: 'post', + params + }) +} +// 删除 +export function delRecord(id) { + return request({ + url: 'maintain/delete', + method: 'post', + params: { + bridgeMaintenanceId: id + } + }) +} diff --git a/src/api/system/overview.js b/src/api/system/overview.js new file mode 100644 index 0000000..bca50cc --- /dev/null +++ b/src/api/system/overview.js @@ -0,0 +1,109 @@ +import request from '@/utils/request' +import qs from "qs" +import Vue from 'vue' + +// 路灯状态统计 +export function getLampStatus() { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampStatus', + method: 'get' + }) +} + +// 路灯总览列表 +export function getLampList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampList', + method: 'get', + params + }) +} + +// 路灯详情 +export function getlampDetail(lampId) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampDetail', + method: 'get', + params: { + lampId: lampId + } + }) +} + +// 回路列表 +export function getCircuitList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/circuitList', + method: 'get', + params + }) +} + +// 灯箱列表 +export function getLampBoxList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampBoxList', + method: 'get', + params + }) +} +// 灯箱详情 +export function getLampBoxDetail(lampBoxId) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampBoxDetail', + method: 'get', + params: { + lampBoxId: lampBoxId + } + }) +} + +// 报警总览列表 +export function getAlarmList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/alarmList', + method: 'get', + params + }) +} + +// 报警详情 +export function getAlarmDetail(alarmId) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/alarmDetail', + method: 'get', + params: { + alarmId: alarmId + } + }) +} + +// 路灯控制 +export function lampControl(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampControl', + method: 'post', + params, + paramsSerializer: params => { + return qs.stringify(params, { indices: false }) + } + }) +} diff --git a/src/api/system/rule.js b/src/api/system/rule.js new file mode 100644 index 0000000..76c6b2d --- /dev/null +++ b/src/api/system/rule.js @@ -0,0 +1,59 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +// import qs from 'qs' + +// 获取当前报警列表 +export function getRuleList() { + return request({ + url: 'rule/listPage', + method: 'get' + }) +} +export function getContentList(params) { + return request({ + url: 'maintain/contentByType', + method: 'get', + params: { + type: params + } + }) +} +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 编辑 +export function editRecord(params) { + return request({ + url: 'maintain/update', + method: 'post', + params + }) +} +// 新增 +export function addRecord(params) { + return request({ + url: 'maintain/add', + method: 'post', + params + }) +} +// 删除 +export function delRecord(id) { + return request({ + url: 'maintain/delete', + method: 'post', + params: { + id: id + } + }) +} diff --git a/src/api/system/statistics.js b/src/api/system/statistics.js new file mode 100644 index 0000000..b25efe9 --- /dev/null +++ b/src/api/system/statistics.js @@ -0,0 +1,23 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +// import qs from 'qs' + +// +export function countByToilet(params) { + return request({ + url: '/sanitation/toiletStatistic/jobStaticByToilet', + method: 'get', + params + }) +} + +export function countByDay(params) { + return request({ + url: '/sanitation/toiletStatistic/jobStaticByDate', + method: 'get', + params + }) +} + diff --git a/src/assets/global_images/icon-position.png b/src/assets/global_images/icon-position.png new file mode 100644 index 0000000..7444038 --- /dev/null +++ b/src/assets/global_images/icon-position.png Binary files differ diff --git a/src/assets/global_images/location_green.png b/src/assets/global_images/location_green.png new file mode 100644 index 0000000..aa8be65 --- /dev/null +++ b/src/assets/global_images/location_green.png Binary files differ diff --git a/src/assets/global_images/location_red.png b/src/assets/global_images/location_red.png new file mode 100644 index 0000000..2be8c3d --- /dev/null +++ b/src/assets/global_images/location_red.png Binary files differ diff --git a/src/assets/global_images/location_yellow.png b/src/assets/global_images/location_yellow.png new file mode 100644 index 0000000..5ab6f4d --- /dev/null +++ b/src/assets/global_images/location_yellow.png Binary files differ diff --git a/src/assets/global_images/toilet-position.png b/src/assets/global_images/toilet-position.png new file mode 100644 index 0000000..7db6d9a --- /dev/null +++ b/src/assets/global_images/toilet-position.png Binary files differ diff --git a/src/assets/global_images/toilet.png b/src/assets/global_images/toilet.png new file mode 100644 index 0000000..6d9fc05 --- /dev/null +++ b/src/assets/global_images/toilet.png Binary files differ diff --git a/src/assets/global_images/toiletPhoto.png b/src/assets/global_images/toiletPhoto.png new file mode 100644 index 0000000..15d08e2 --- /dev/null +++ b/src/assets/global_images/toiletPhoto.png Binary files differ diff --git a/src/components/DownloadTemplate/index.vue b/src/components/DownloadTemplate/index.vue index 8ded2cd..7807cac 100644 --- a/src/components/DownloadTemplate/index.vue +++ b/src/components/DownloadTemplate/index.vue @@ -47,8 +47,8 @@ diff --git a/src/components/NormalTable/index.vue b/src/components/NormalTable/index.vue index 5077bef..04d322d 100644 --- a/src/components/NormalTable/index.vue +++ b/src/components/NormalTable/index.vue @@ -79,7 +79,7 @@
-
+
Object.assign(obj, { [key]: this[key] }), {}), + on: events.reduce((obj, key) => Object.assign(obj, { [key]: this.transmitEvent }), {}) + }) + } + this.props = [...extraProps, ...props.filter(prop => exceptProps.indexOf(prop))] + } +} + +export default prop => new Mixin(prop) diff --git a/src/components/mapWindow/base/mixins/common.js b/src/components/mapWindow/base/mixins/common.js new file mode 100644 index 0000000..2fd1a28 --- /dev/null +++ b/src/components/mapWindow/base/mixins/common.js @@ -0,0 +1,82 @@ +const types = { + map: { + unload: 'clearMap' + }, + control: { + unload: 'removeControl' + }, + layer: { + unload: 'removeLayer' + }, + features: { + unload: 'removeFeatures' + }, + listener: { + unload: 'removeListener' + } +} + +const getParent = $component => ($component.abstract || $component.$el === $component.$children[0].$el) ? getParent($component.$parent) : $component + +function destroyInstance () { + const { unload, renderByParent, $parent } = this + if (renderByParent) { + $parent.reload() + } + unload() +} + +class Mixin { + constructor (prop) { + this.methods = { + ready () { + const $parent = getParent(this.$parent) + const map = this.map = $parent.map + this.load() + this.$emit('ready', { + map + }) + }, + transmitEvent (e) { + this.$emit(e.type.replace(/^on/, ''), e) + }, + reload () { + this && this.$nextTick(() => { + this.unload() + this.$nextTick(this.load) + }) + }, + unload () { + const { map, originInstance } = this + try { + switch (prop.type) { + case 'search': + return originInstance.clearResults() + case 'autoComplete': + case 'lushu': + return originInstance.dispose() + case 'markerClusterer': + return originInstance.clearMarkers() + default: + map[types[prop.type].unload](originInstance) + } + } catch (e) {} + } + } + this.computed = { + renderByParent () { + return this.$parent.preventChildrenRender + } + } + this.mounted = function () { + console.log('common mounted') + const $parent = getParent(this.$parent) + const map = $parent.map + const { ready } = this + console.log(map) + map ? ready() : $parent.$on('onload', ready) + } + } +} + +export default type => new Mixin({ type }) diff --git a/src/components/mapWindow/leafletMap.vue b/src/components/mapWindow/leafletMap.vue new file mode 100644 index 0000000..b753cc0 --- /dev/null +++ b/src/components/mapWindow/leafletMap.vue @@ -0,0 +1,143 @@ + + + + + + + diff --git a/src/components/mapWindow/mapWindow.vue b/src/components/mapWindow/mapWindow.vue new file mode 100644 index 0000000..9ced291 --- /dev/null +++ b/src/components/mapWindow/mapWindow.vue @@ -0,0 +1,46 @@ + + + + + + diff --git a/src/icons/svg/bridge.svg b/src/icons/svg/bridge.svg new file mode 100644 index 0000000..1a0336f --- /dev/null +++ b/src/icons/svg/bridge.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/icons/svg/toilet.svg b/src/icons/svg/toilet.svg new file mode 100644 index 0000000..9d8e765 --- /dev/null +++ b/src/icons/svg/toilet.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/main.js b/src/main.js index f2d105d..3e4074e 100644 --- a/src/main.js +++ b/src/main.js @@ -18,6 +18,9 @@ // echart // import echarts from 'echarts' // Vue.prototype.$echarts = echarts +// 引入v-charts +import VCharts from 'v-charts' +Vue.use(VCharts) // 将自动注册所有组件为全局组件 // import dataV from '@jiaminghi/data-view' @@ -35,9 +38,19 @@ Vue.component('search-item', SearchItem) // 加载leaflet的css +// import 'leaflet/dist/leaflet.css' +// import 'leaflet-draw/dist/leaflet.draw.css' +import L from 'leaflet' import 'leaflet/dist/leaflet.css' -import 'leaflet-draw/dist/leaflet.draw.css' +Vue.config.productionTip = false +Vue.L = Vue.prototype.$L = L +delete L.Icon.Default.prototype._getIconUrl +L.Icon.Default.mergeOptions({ + iconRetinaUrl: require('leaflet/dist/images/marker-icon-2x.png'), + iconUrl: require('leaflet/dist/images/marker-icon.png'), + shadowUrl: require('leaflet/dist/images/marker-shadow.png') +}) /** * This project originally used easy-mock to simulate data, * but its official service is very unstable, diff --git a/src/permission.js b/src/permission.js index dc6b2f8..809ca86 100644 --- a/src/permission.js +++ b/src/permission.js @@ -25,8 +25,8 @@ store.dispatch('GetInfo').then(res => { // 拉取用户信息 // 设置当前子系统为基础资源子系统 const currentSys = { - code: 'baseResourse', - name: '基础资源子系统' + code: 'toliet', + name: '公共厕所管理系统' } // 将当前系统信息保存在localStorage中 store.commit('SET_SYSTEM', currentSys) diff --git a/src/router/index.js b/src/router/index.js index 39c295c..d23076d 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -8,8 +8,11 @@ /* Layout */ import Layout from '@/layout/Layout' +import { toiletRouters } from './modules/toilet' +import { workRouters } from './modules/work' +import { statisticsRouters } from './modules/statistics' +import { ruleRouters } from './modules/rule' import { systemRouters } from './modules/system' -import { exampleRouters } from './modules/example' /** * hidden: true if `hidden:true` will not show in the sidebar(default is false) @@ -40,11 +43,12 @@ ] }, // 登录页面 - { path: '/login', component: () => import('@/views/login/index'), hidden: true }, + { path: '/login', component: () => import('@/views/login/index_2'), hidden: true }, // 404错误页面 { path: '/404', component: () => import('@/views/errorPage/404'), hidden: true }, // 401 错误页面 - { path: '/401', component: () => import('@/views/errorPage/401'), hidden: true } + { path: '/401', component: () => import('@/views/errorPage/401'), hidden: true }, + { path: '/', redirect: '/toiletList', hidden: true } ] // 实例化vue的时候直挂载constantRouter export default new Router({ @@ -56,7 +60,10 @@ // 异步挂载路由 // 动态需要根据权限加载的路由表 export const asyncRouterMap = [ - ...exampleRouters, - ...systemRouters, + ...toiletRouters, + ...workRouters, + ...statisticsRouters, + ...ruleRouters, + // ...systemRouters, { path: '*', redirect: '/404', hidden: true } ] diff --git a/src/router/modules/rule.js b/src/router/modules/rule.js new file mode 100644 index 0000000..51e0283 --- /dev/null +++ b/src/router/modules/rule.js @@ -0,0 +1,24 @@ +/* Layout */ +import Layout from '@/layout/Layout' + +export const ruleRouters = [ + { + path: 'rule', + component: Layout, + redirect: '/rule', + name: 'Rule', + meta: { + title: '规章制度', + icon: 'icon-config', // 图标 + permission: ['/rule']// 权限名称 + }, + children: [ + { + path: '/rule', + name: 'Rule', + component: () => import('@/views/rule/listRule'), + meta: { title: '规章制度', icon: 'function', permission: ['/rule'] } + } + ] + } +] diff --git a/src/router/modules/statistics.js b/src/router/modules/statistics.js new file mode 100644 index 0000000..fb9cbea --- /dev/null +++ b/src/router/modules/statistics.js @@ -0,0 +1,30 @@ +/* Layout */ +import Layout from '@/layout/Layout' + +export const statisticsRouters = [ + { + path: 'statisticsToilet', + component: Layout, + redirect: '/workStatistics', + name: 'StatisticsToilet', + meta: { + title: '作业统计', + icon: 'icon-config', // 图标 + permission: ['/statisticsToilet']// 权限名称 + }, + children: [ + { + path: '/workStatistics', + name: 'WorkStatistics', + component: () => import('@/views/statistics/toiletAssessment'), + meta: { title: '作业统计', icon: '', permission: ['/toilet/workStatistics'] } + }, + { + path: '/evaluationStatistics', + name: 'EvaluationStatistics', + component: () => import('@/views/statistics/evaluationAssessment'), + meta: { title: '评价统计', icon: '', permission: ['/toilet/evaluationStatistics'] } + } + ] + } +] diff --git a/src/router/modules/toilet.js b/src/router/modules/toilet.js new file mode 100644 index 0000000..b221a0e --- /dev/null +++ b/src/router/modules/toilet.js @@ -0,0 +1,30 @@ +/* Layout */ +import Layout from '@/layout/Layout' + +export const toiletRouters = [ + { + path: 'toiletManage', + component: Layout, + redirect: '/toiletManage', + name: 'ToiletManage', + meta: { + title: '公厕管理', + icon: 'icon-config', // 图标 + permission: ['/toiletManage']// 权限名称 + }, + children: [ + { + path: '/toiletList', + name: 'ToiletList', + component: () => import('@/views/toiletManage/toiletList'), + meta: { title: '公厕台帐管理', icon: 'function', permission: ['/toiletList'] } + }, + { + path: '/toiletMap', + name: 'ToiletMap', + component: () => import('@/views/overview/overview'), + meta: { title: '地图总览', icon: 'function', permission: ['/toiletMap'] } + } + ] + } +] diff --git a/src/router/modules/work.js b/src/router/modules/work.js new file mode 100644 index 0000000..5e0759f --- /dev/null +++ b/src/router/modules/work.js @@ -0,0 +1,24 @@ +/* Layout */ +import Layout from '@/layout/Layout' + +export const workRouters = [ + { + path: 'toiletWork', + component: Layout, + redirect: '/toiletManage', + name: 'toiletWork', + meta: { + title: '作业管理', + icon: 'icon-config', // 图标 + permission: ['/toiletWork']// 权限名称 + }, + children: [ + { + path: '/toiletWork', + name: 'ToiletWork', + component: () => import('@/views/toiletClean/toiletCleanList'), + meta: { title: '作业管理', icon: 'function', permission: ['/toiletWork'] } + } + ] + } +] diff --git a/src/settings.js b/src/settings.js index b568ce0..b8159bf 100644 --- a/src/settings.js +++ b/src/settings.js @@ -3,7 +3,7 @@ * @type {boolean} true | false * @description 是否显示设置按钮 */ - showSettings: true, + showSettings: false, /** * @type {boolean} true | false diff --git a/src/store/modules/permission.js b/src/store/modules/permission.js index a0cb8cf..3ab50d5 100644 --- a/src/store/modules/permission.js +++ b/src/store/modules/permission.js @@ -120,17 +120,23 @@ }) }, // 获取用户权限 - GetMenus({ commit, state }) { - console.log('in store.permission.js:GetMenus:') + GetMenus({ commit, state }, currentSystem) { + // console.log('in store.permission.js:GetMenus:') + console.log('获取' + currentSystem.name + '的菜单') + const params = { + parentCode: currentSystem.code // 传入该子系统的code,获取子系统的权限 + } return new Promise((resolve, reject) => { - getMenus(state.token).then(response => { // 处理返回值 + // 此处获取用户所有权限 + getMenus(params).then(response => { // 处理返回值 const data = response.data const menus = [] // 仅菜单 const btns = [] // 非菜单 if (data.menus && data.menus.length > 0) { - commit('SET_MENUS', data.menus) - for (const menu of data.menus) { // 遍历菜单,获取所有的权限项 - if (menu.ismenu === '1') { // 将是菜单的放入menus + const allmenus = [...data.menus] + commit('SET_MENUS', allmenus) + for (const menu of allmenus) { // 遍历菜单,获取所有的权限项 + if (menu.resourceType === '02' || menu.resourceType === '03') { // 将是菜单的放入menus const menu_tmp = {} menu_tmp.url = menu.url menu_tmp.icon = menu.icon @@ -142,11 +148,11 @@ btn_tmp.name = menu.name btn_tmp.icon = menu.icon btns.push(btn_tmp) - // console.log(menu.url) } } // 过滤路由表 - const accessedRouters = filterAsyncRouter(asyncRouterMap, menus) + let accessedRouters = filterAsyncRouter(asyncRouterMap, menus) + // accessedRouters = filterRedirect(accessedRouters) commit('SET_BTNS', btns) commit('SET_ROUTERS', accessedRouters) resolve(response) diff --git a/src/utils/baseConfig.js b/src/utils/baseConfig.js index 1f4fa38..999593e 100644 --- a/src/utils/baseConfig.js +++ b/src/utils/baseConfig.js @@ -1,5 +1,5 @@ const project = { - title: '后台管理系统前端基础框架' + title: '路桥养护子系统' } export function getProject() { return project diff --git a/src/utils/dateutils.js b/src/utils/dateutils.js index 868111a..5cd16af 100644 --- a/src/utils/dateutils.js +++ b/src/utils/dateutils.js @@ -15,15 +15,15 @@ return ct_month } -export function getLastWeek() { // 默认显示上周 +export function getLastWeek(fmt) { // 默认显示上周 const ct_month = new Date() ct_month.setTime(ct_month.getTime() - 3600 * 1000 * 24 * 7) - return ct_month + return ct_month.Format(fmt) } -export function getLastMonth() { // 默认显示上个月 +export function getLastMonth(fmt) { // 默认显示上个月 const ct_month = new Date() ct_month.setTime(ct_month.getTime() - 3600 * 1000 * 24 * 30) - return ct_month + return ct_month.Format(fmt) } // 对Date的扩展,将 Date 转化为指定格式的String diff --git a/src/utils/exportutils.js b/src/utils/exportutils.js new file mode 100644 index 0000000..b5d0bcf --- /dev/null +++ b/src/utils/exportutils.js @@ -0,0 +1,19 @@ +/** + * 导出文件工具 + * @param blob 文件 + * @param fileName 导出文件名 + */ +export function exportFile(blob, fileName) { + if (window.navigator && window.navigator.msSaveOrOpenBlob) { + navigator.msSaveBlob(blob, fileName) + } else { + const downloadElement = document.createElement('a') + const href = window.URL.createObjectURL(blob) // 创建下载的链接 + downloadElement.href = href + downloadElement.download = fileName + document.body.appendChild(downloadElement) + downloadElement.click() // 点击下载 + document.body.removeChild(downloadElement) // 下载完成移除元素 + window.URL.revokeObjectURL(href) // 释放blob对象 + } +} diff --git a/src/utils/request.js b/src/utils/request.js index c88ea76..dc56e26 100644 --- a/src/utils/request.js +++ b/src/utils/request.js @@ -17,6 +17,13 @@ config.headers['token'] = getToken() // 让每个请求携带自定义token 请根据实际情况自行修改 console.log(config.headers['token']) } + // 在接口增加时间戳 + // if (config.method === 'get') { + config.params = { + _t: Date.parse(new Date()) / 1000, + ...config.params + } + // } return config }, error => { diff --git a/src/views/mapViews/choosePointDialog.vue b/src/views/mapViews/choosePointDialog.vue new file mode 100644 index 0000000..c9dde8a --- /dev/null +++ b/src/views/mapViews/choosePointDialog.vue @@ -0,0 +1,105 @@ + + + + + diff --git a/src/views/mapViews/mapView.vue b/src/views/mapViews/mapView.vue new file mode 100644 index 0000000..a18db88 --- /dev/null +++ b/src/views/mapViews/mapView.vue @@ -0,0 +1,73 @@ + + + + + diff --git a/src/views/order/editOrder.vue b/src/views/order/editOrder.vue new file mode 100644 index 0000000..4a5fd8a --- /dev/null +++ b/src/views/order/editOrder.vue @@ -0,0 +1,319 @@ + + + + + diff --git a/src/views/order/listMaintainRecords.vue b/src/views/order/listMaintainRecords.vue new file mode 100644 index 0000000..2d4f682 --- /dev/null +++ b/src/views/order/listMaintainRecords.vue @@ -0,0 +1,327 @@ + + + + + diff --git a/src/views/overview/overview.vue b/src/views/overview/overview.vue new file mode 100644 index 0000000..9525867 --- /dev/null +++ b/src/views/overview/overview.vue @@ -0,0 +1,285 @@ + + + + + diff --git a/src/views/overview/toiletDetailDialog.vue b/src/views/overview/toiletDetailDialog.vue new file mode 100644 index 0000000..2b3a511 --- /dev/null +++ b/src/views/overview/toiletDetailDialog.vue @@ -0,0 +1,263 @@ + + + + + + diff --git a/src/views/overview/toiletLayer.vue b/src/views/overview/toiletLayer.vue new file mode 100644 index 0000000..d784323 --- /dev/null +++ b/src/views/overview/toiletLayer.vue @@ -0,0 +1,152 @@ + + + + + + diff --git a/src/views/rule/listRule.vue b/src/views/rule/listRule.vue new file mode 100644 index 0000000..a19b9e4 --- /dev/null +++ b/src/views/rule/listRule.vue @@ -0,0 +1,157 @@ + + + + + diff --git a/src/views/statistics/barChart.vue b/src/views/statistics/barChart.vue new file mode 100644 index 0000000..d10eb38 --- /dev/null +++ b/src/views/statistics/barChart.vue @@ -0,0 +1,65 @@ + + + + + diff --git a/src/views/statistics/components/evaluationListDialog.vue b/src/views/statistics/components/evaluationListDialog.vue new file mode 100644 index 0000000..1560772 --- /dev/null +++ b/src/views/statistics/components/evaluationListDialog.vue @@ -0,0 +1,100 @@ + + + + + + diff --git a/src/views/statistics/components/workChart.vue b/src/views/statistics/components/workChart.vue new file mode 100644 index 0000000..a891e0c --- /dev/null +++ b/src/views/statistics/components/workChart.vue @@ -0,0 +1,79 @@ + + + + + diff --git a/src/views/statistics/evaluationAssessment.vue b/src/views/statistics/evaluationAssessment.vue new file mode 100644 index 0000000..28dedc5 --- /dev/null +++ b/src/views/statistics/evaluationAssessment.vue @@ -0,0 +1,159 @@ + + + + + + diff --git a/config/index.js b/config/index.js index 8abd37a..19b33b1 100644 --- a/config/index.js +++ b/config/index.js @@ -69,7 +69,7 @@ * then assetsPublicPath should be set to "/bar/". * In most cases please use '/' !!! */ - assetsPublicPath: '/', + assetsPublicPath: '/toilet/', /** * Source Maps diff --git a/package.json b/package.json index 45f055f..9f3a3eb 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "echarts": "^4.2.1", "element-ui": "2.13.0", "event-source-polyfill": "^1.0.5", + "file-saver": "^2.0.5", "js-cookie": "2.2.0", "jsencrypt": "^3.0.0-rc.1", "leaflet": "^1.7.1", @@ -33,7 +34,9 @@ "vue-amap": "^0.5.9", "vue-baidu-map": "^0.21.22", "vue-router": "3.0.1", - "vuex": "3.0.1" + "vue2-leaflet": "^2.7.0", + "vuex": "3.0.1", + "xlsx": "^0.17.0" }, "devDependencies": { "autoprefixer": "8.5.0", diff --git a/src/api/common.js b/src/api/common.js index 87c582b..7804714 100644 --- a/src/api/common.js +++ b/src/api/common.js @@ -2,10 +2,14 @@ * 常用接口 */ import request from '@/utils/request' +import Vue from 'vue' + // 模板下载 export function downloadTemplate(fileName) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath return request({ - url: 'template/download', + url: lampPath + 'template/download', method: 'get', params: { filename: fileName @@ -19,7 +23,7 @@ const param = new FormData() param.append('file', fileobj.file) return request({ - url: 'imageUpload', + url: 'fileUpload', method: 'post', headers: { 'Content-Type': 'multipart/form-data' }, data: param diff --git a/src/api/sanitation/statistics.js b/src/api/sanitation/statistics.js new file mode 100644 index 0000000..ffeac18 --- /dev/null +++ b/src/api/sanitation/statistics.js @@ -0,0 +1,22 @@ + +/** + * 考核统计接口 + */ +import request from '@/utils/request' +// 公厕保洁次数统计 +export function getToiletJobCount(params) { + return request({ + url: '/sanitation/statistic/toilet/jobCount', + method: 'get', + params + }) +} + +// 公厕评分统计 +export function getToiletEvaluation(params) { + return request({ + url: '/sanitation/toiletEvaluation/statistics', + method: 'get', + params + }) +} diff --git a/src/api/sanitation/toilet.js b/src/api/sanitation/toilet.js new file mode 100644 index 0000000..11affd4 --- /dev/null +++ b/src/api/sanitation/toilet.js @@ -0,0 +1,133 @@ +/** + * 公厕管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' +// 公厕查询 +export function getToiletListPage(params) { + return request({ + url: '/sanitation/toilet/listPage', + method: 'get', + params + }) +} +// 公厕查询 +export function getToiletList(pid) { + return request({ + url: '/sanitation/toilet/list', + method: 'get', + params: { + pid: pid + } + }) +} + +// 添加公厕 +export function addToilet(params) { + return request({ + url: '/sanitation/toilet/add', + method: 'post', + params + }) +} +// 修改公厕机构 +export function updateToilet(params) { + return request({ + url: '/sanitation/toilet/update', + method: 'post', + params + }) +} +// 删除公厕机构 +export function delToilet(ids) { + return request({ + url: '/sanitation/toilet/delete', + method: 'post', + params: { + ids + }, + paramsSerializer: params => { + return qs.stringify(params, { indices: false }) + } + }) +} + +// 公厕基本信息详情 +export function getToiletInfoDetail(id) { + return request({ + url: '/sanitation/toilet/detail?toiletId=' + id, + method: 'get' + }) +} + +// 某公厕保洁记录 +export function getRecordsByToilet(params) { + return request({ + url: '/sanitation/toilet/jobRecord/detail', + method: 'get', + params + }) +} + +// 某公厕平均评分 +export function getScoreByToilet(params) { + return request({ + url: '/sanitation/toiletEvaluation/detailScore', + method: 'get', + params + }) +} + +// 某公厕评分列表 +export function getScoreListByToilet(params) { + return request({ + url: '/sanitation/toiletEvaluation/list', + method: 'get', + params + }) +} + + +// 批量导入 +export function batchImportToilet(fileobj) { + const param = new FormData() + param.append('file', fileobj) + return request({ + url: '/sanitation/toilet/import', + method: 'post', + headers: { 'Content-Type': 'multipart/form-data' }, + data: param + }) +} +// 批量导出 +export function batchExportToilet(params, config) { + return request({ + url: '/sanitation/toilet/export', + method: 'get', + timeout: 120000, + params, + ...config, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 公厕保洁记录查询 +export function getToiletJobRecords(params) { + return request({ + url: '/sanitation/toilet/jobRecord', + method: 'get', + params + }) +} + +// 批量导出 +export function batchExportToiletJobRecords(params, config) { + return request({ + url: '/sanitation/toilet/exportJobRecord', + method: 'get', + timeout: 120000, + params, + ...config, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} diff --git a/src/api/system/alarm.js b/src/api/system/alarm.js new file mode 100644 index 0000000..1c3a7ab --- /dev/null +++ b/src/api/system/alarm.js @@ -0,0 +1,62 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' + +// 获取当前报警列表 +export function getAlarmNowList(params) { + return request({ + url: '/alarm/listNowPage', + method: 'get', + params + }) +} + +// 获取当前报警列表 +export function getAlarmHistoryList(params) { + return request({ + url: '/alarm/listHisPage', + method: 'get', + params + }) +} + + +// 批量消警 +export function clearAll(params) { + return request({ + url: '/alarm/allClear', + method: 'get', + params + }) +} + +// 消警 +export function clearAlarm(params) { + return request({ + url: '/alarm/cancel', + method: 'get', + params + }) +} + +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 设置报警阈值 +export function setThresh(params) { + return request({ + url: '/alarm/resetAlarmRule', + method: 'post', + params + }) +} diff --git a/src/api/system/bridge.js b/src/api/system/bridge.js new file mode 100644 index 0000000..e8a4108 --- /dev/null +++ b/src/api/system/bridge.js @@ -0,0 +1,80 @@ +/** + * 桥梁管理接口 + */ +import request from '@/utils/request' + +// 获取桥梁详情 +export function getDetail(id) { + return request({ + url: '/bridge/detail', + method: 'get', + params: { + id: id + } + }) +} + +export function updateBridge(params) { + return request({ + url: '/bridge/update', + method: 'post', + params + }) +} +// 批量导出 +export function exportRecords(params) { + return request({ + url: 'device/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +export function getContentList(params) { + return request({ + url: 'maintain/contentByType', + method: 'get', + params: { + type: params + } + }) +} +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 编辑 +export function editRecord(params) { + return request({ + url: 'maintain/update', + method: 'post', + params + }) +} +// 新增 +export function addRecord(params) { + return request({ + url: 'maintain/add', + method: 'post', + params + }) +} +// 删除 +export function delRecord(id) { + return request({ + url: 'maintain/delete', + method: 'post', + params: { + id: id + } + }) +} diff --git a/src/api/system/data.js b/src/api/system/data.js new file mode 100644 index 0000000..4c95db5 --- /dev/null +++ b/src/api/system/data.js @@ -0,0 +1,63 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' + +// 获取当前报警列表 +export function getHistoryList(params) { + return request({ + url: '/data/hisListPage', + method: 'get', + params + }) +} + +// 获取当前报警列表 +export function getHistory(params) { + return request({ + url: '/data/hisList', + method: 'get', + params + }) +} + + + +// 批量消警 +export function clearAll(params) { + return request({ + url: '/alarm/allClear', + method: 'get', + params + }) +} + +// 消警 +export function clearAlarm(params) { + return request({ + url: '/alarm/cancel', + method: 'get', + params + }) +} + +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 设置报警阈值 +export function setThresh(params) { + return request({ + url: '/alarm/resetAlarmRule', + method: 'post', + params + }) +} diff --git a/src/api/system/order.js b/src/api/system/order.js new file mode 100644 index 0000000..7007c50 --- /dev/null +++ b/src/api/system/order.js @@ -0,0 +1,71 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +// import qs from 'qs' + +// 获取当前报警列表 +export function getRecordList(params) { + return request({ + url: '/maintain/listPage', + method: 'get', + params + }) +} +// 批量导出 +export function exportRecords(params) { + return request({ + url: 'device/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +export function getContentList(params) { + return request({ + url: 'maintain/contentByType', + method: 'get', + params: { + type: params + } + }) +} +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 编辑 +export function editRecord(params) { + return request({ + url: 'maintain/update', + method: 'post', + params + }) +} +// 新增 +export function addRecord(params) { + return request({ + url: 'maintain/add', + method: 'post', + params + }) +} +// 删除 +export function delRecord(id) { + return request({ + url: 'maintain/delete', + method: 'post', + params: { + bridgeMaintenanceId: id + } + }) +} diff --git a/src/api/system/overview.js b/src/api/system/overview.js new file mode 100644 index 0000000..bca50cc --- /dev/null +++ b/src/api/system/overview.js @@ -0,0 +1,109 @@ +import request from '@/utils/request' +import qs from "qs" +import Vue from 'vue' + +// 路灯状态统计 +export function getLampStatus() { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampStatus', + method: 'get' + }) +} + +// 路灯总览列表 +export function getLampList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampList', + method: 'get', + params + }) +} + +// 路灯详情 +export function getlampDetail(lampId) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampDetail', + method: 'get', + params: { + lampId: lampId + } + }) +} + +// 回路列表 +export function getCircuitList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/circuitList', + method: 'get', + params + }) +} + +// 灯箱列表 +export function getLampBoxList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampBoxList', + method: 'get', + params + }) +} +// 灯箱详情 +export function getLampBoxDetail(lampBoxId) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampBoxDetail', + method: 'get', + params: { + lampBoxId: lampBoxId + } + }) +} + +// 报警总览列表 +export function getAlarmList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/alarmList', + method: 'get', + params + }) +} + +// 报警详情 +export function getAlarmDetail(alarmId) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/alarmDetail', + method: 'get', + params: { + alarmId: alarmId + } + }) +} + +// 路灯控制 +export function lampControl(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampControl', + method: 'post', + params, + paramsSerializer: params => { + return qs.stringify(params, { indices: false }) + } + }) +} diff --git a/src/api/system/rule.js b/src/api/system/rule.js new file mode 100644 index 0000000..76c6b2d --- /dev/null +++ b/src/api/system/rule.js @@ -0,0 +1,59 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +// import qs from 'qs' + +// 获取当前报警列表 +export function getRuleList() { + return request({ + url: 'rule/listPage', + method: 'get' + }) +} +export function getContentList(params) { + return request({ + url: 'maintain/contentByType', + method: 'get', + params: { + type: params + } + }) +} +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 编辑 +export function editRecord(params) { + return request({ + url: 'maintain/update', + method: 'post', + params + }) +} +// 新增 +export function addRecord(params) { + return request({ + url: 'maintain/add', + method: 'post', + params + }) +} +// 删除 +export function delRecord(id) { + return request({ + url: 'maintain/delete', + method: 'post', + params: { + id: id + } + }) +} diff --git a/src/api/system/statistics.js b/src/api/system/statistics.js new file mode 100644 index 0000000..b25efe9 --- /dev/null +++ b/src/api/system/statistics.js @@ -0,0 +1,23 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +// import qs from 'qs' + +// +export function countByToilet(params) { + return request({ + url: '/sanitation/toiletStatistic/jobStaticByToilet', + method: 'get', + params + }) +} + +export function countByDay(params) { + return request({ + url: '/sanitation/toiletStatistic/jobStaticByDate', + method: 'get', + params + }) +} + diff --git a/src/assets/global_images/icon-position.png b/src/assets/global_images/icon-position.png new file mode 100644 index 0000000..7444038 --- /dev/null +++ b/src/assets/global_images/icon-position.png Binary files differ diff --git a/src/assets/global_images/location_green.png b/src/assets/global_images/location_green.png new file mode 100644 index 0000000..aa8be65 --- /dev/null +++ b/src/assets/global_images/location_green.png Binary files differ diff --git a/src/assets/global_images/location_red.png b/src/assets/global_images/location_red.png new file mode 100644 index 0000000..2be8c3d --- /dev/null +++ b/src/assets/global_images/location_red.png Binary files differ diff --git a/src/assets/global_images/location_yellow.png b/src/assets/global_images/location_yellow.png new file mode 100644 index 0000000..5ab6f4d --- /dev/null +++ b/src/assets/global_images/location_yellow.png Binary files differ diff --git a/src/assets/global_images/toilet-position.png b/src/assets/global_images/toilet-position.png new file mode 100644 index 0000000..7db6d9a --- /dev/null +++ b/src/assets/global_images/toilet-position.png Binary files differ diff --git a/src/assets/global_images/toilet.png b/src/assets/global_images/toilet.png new file mode 100644 index 0000000..6d9fc05 --- /dev/null +++ b/src/assets/global_images/toilet.png Binary files differ diff --git a/src/assets/global_images/toiletPhoto.png b/src/assets/global_images/toiletPhoto.png new file mode 100644 index 0000000..15d08e2 --- /dev/null +++ b/src/assets/global_images/toiletPhoto.png Binary files differ diff --git a/src/components/DownloadTemplate/index.vue b/src/components/DownloadTemplate/index.vue index 8ded2cd..7807cac 100644 --- a/src/components/DownloadTemplate/index.vue +++ b/src/components/DownloadTemplate/index.vue @@ -47,8 +47,8 @@ diff --git a/src/components/NormalTable/index.vue b/src/components/NormalTable/index.vue index 5077bef..04d322d 100644 --- a/src/components/NormalTable/index.vue +++ b/src/components/NormalTable/index.vue @@ -79,7 +79,7 @@
-
+
Object.assign(obj, { [key]: this[key] }), {}), + on: events.reduce((obj, key) => Object.assign(obj, { [key]: this.transmitEvent }), {}) + }) + } + this.props = [...extraProps, ...props.filter(prop => exceptProps.indexOf(prop))] + } +} + +export default prop => new Mixin(prop) diff --git a/src/components/mapWindow/base/mixins/common.js b/src/components/mapWindow/base/mixins/common.js new file mode 100644 index 0000000..2fd1a28 --- /dev/null +++ b/src/components/mapWindow/base/mixins/common.js @@ -0,0 +1,82 @@ +const types = { + map: { + unload: 'clearMap' + }, + control: { + unload: 'removeControl' + }, + layer: { + unload: 'removeLayer' + }, + features: { + unload: 'removeFeatures' + }, + listener: { + unload: 'removeListener' + } +} + +const getParent = $component => ($component.abstract || $component.$el === $component.$children[0].$el) ? getParent($component.$parent) : $component + +function destroyInstance () { + const { unload, renderByParent, $parent } = this + if (renderByParent) { + $parent.reload() + } + unload() +} + +class Mixin { + constructor (prop) { + this.methods = { + ready () { + const $parent = getParent(this.$parent) + const map = this.map = $parent.map + this.load() + this.$emit('ready', { + map + }) + }, + transmitEvent (e) { + this.$emit(e.type.replace(/^on/, ''), e) + }, + reload () { + this && this.$nextTick(() => { + this.unload() + this.$nextTick(this.load) + }) + }, + unload () { + const { map, originInstance } = this + try { + switch (prop.type) { + case 'search': + return originInstance.clearResults() + case 'autoComplete': + case 'lushu': + return originInstance.dispose() + case 'markerClusterer': + return originInstance.clearMarkers() + default: + map[types[prop.type].unload](originInstance) + } + } catch (e) {} + } + } + this.computed = { + renderByParent () { + return this.$parent.preventChildrenRender + } + } + this.mounted = function () { + console.log('common mounted') + const $parent = getParent(this.$parent) + const map = $parent.map + const { ready } = this + console.log(map) + map ? ready() : $parent.$on('onload', ready) + } + } +} + +export default type => new Mixin({ type }) diff --git a/src/components/mapWindow/leafletMap.vue b/src/components/mapWindow/leafletMap.vue new file mode 100644 index 0000000..b753cc0 --- /dev/null +++ b/src/components/mapWindow/leafletMap.vue @@ -0,0 +1,143 @@ + + + + + + + diff --git a/src/components/mapWindow/mapWindow.vue b/src/components/mapWindow/mapWindow.vue new file mode 100644 index 0000000..9ced291 --- /dev/null +++ b/src/components/mapWindow/mapWindow.vue @@ -0,0 +1,46 @@ + + + + + + diff --git a/src/icons/svg/bridge.svg b/src/icons/svg/bridge.svg new file mode 100644 index 0000000..1a0336f --- /dev/null +++ b/src/icons/svg/bridge.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/icons/svg/toilet.svg b/src/icons/svg/toilet.svg new file mode 100644 index 0000000..9d8e765 --- /dev/null +++ b/src/icons/svg/toilet.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/main.js b/src/main.js index f2d105d..3e4074e 100644 --- a/src/main.js +++ b/src/main.js @@ -18,6 +18,9 @@ // echart // import echarts from 'echarts' // Vue.prototype.$echarts = echarts +// 引入v-charts +import VCharts from 'v-charts' +Vue.use(VCharts) // 将自动注册所有组件为全局组件 // import dataV from '@jiaminghi/data-view' @@ -35,9 +38,19 @@ Vue.component('search-item', SearchItem) // 加载leaflet的css +// import 'leaflet/dist/leaflet.css' +// import 'leaflet-draw/dist/leaflet.draw.css' +import L from 'leaflet' import 'leaflet/dist/leaflet.css' -import 'leaflet-draw/dist/leaflet.draw.css' +Vue.config.productionTip = false +Vue.L = Vue.prototype.$L = L +delete L.Icon.Default.prototype._getIconUrl +L.Icon.Default.mergeOptions({ + iconRetinaUrl: require('leaflet/dist/images/marker-icon-2x.png'), + iconUrl: require('leaflet/dist/images/marker-icon.png'), + shadowUrl: require('leaflet/dist/images/marker-shadow.png') +}) /** * This project originally used easy-mock to simulate data, * but its official service is very unstable, diff --git a/src/permission.js b/src/permission.js index dc6b2f8..809ca86 100644 --- a/src/permission.js +++ b/src/permission.js @@ -25,8 +25,8 @@ store.dispatch('GetInfo').then(res => { // 拉取用户信息 // 设置当前子系统为基础资源子系统 const currentSys = { - code: 'baseResourse', - name: '基础资源子系统' + code: 'toliet', + name: '公共厕所管理系统' } // 将当前系统信息保存在localStorage中 store.commit('SET_SYSTEM', currentSys) diff --git a/src/router/index.js b/src/router/index.js index 39c295c..d23076d 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -8,8 +8,11 @@ /* Layout */ import Layout from '@/layout/Layout' +import { toiletRouters } from './modules/toilet' +import { workRouters } from './modules/work' +import { statisticsRouters } from './modules/statistics' +import { ruleRouters } from './modules/rule' import { systemRouters } from './modules/system' -import { exampleRouters } from './modules/example' /** * hidden: true if `hidden:true` will not show in the sidebar(default is false) @@ -40,11 +43,12 @@ ] }, // 登录页面 - { path: '/login', component: () => import('@/views/login/index'), hidden: true }, + { path: '/login', component: () => import('@/views/login/index_2'), hidden: true }, // 404错误页面 { path: '/404', component: () => import('@/views/errorPage/404'), hidden: true }, // 401 错误页面 - { path: '/401', component: () => import('@/views/errorPage/401'), hidden: true } + { path: '/401', component: () => import('@/views/errorPage/401'), hidden: true }, + { path: '/', redirect: '/toiletList', hidden: true } ] // 实例化vue的时候直挂载constantRouter export default new Router({ @@ -56,7 +60,10 @@ // 异步挂载路由 // 动态需要根据权限加载的路由表 export const asyncRouterMap = [ - ...exampleRouters, - ...systemRouters, + ...toiletRouters, + ...workRouters, + ...statisticsRouters, + ...ruleRouters, + // ...systemRouters, { path: '*', redirect: '/404', hidden: true } ] diff --git a/src/router/modules/rule.js b/src/router/modules/rule.js new file mode 100644 index 0000000..51e0283 --- /dev/null +++ b/src/router/modules/rule.js @@ -0,0 +1,24 @@ +/* Layout */ +import Layout from '@/layout/Layout' + +export const ruleRouters = [ + { + path: 'rule', + component: Layout, + redirect: '/rule', + name: 'Rule', + meta: { + title: '规章制度', + icon: 'icon-config', // 图标 + permission: ['/rule']// 权限名称 + }, + children: [ + { + path: '/rule', + name: 'Rule', + component: () => import('@/views/rule/listRule'), + meta: { title: '规章制度', icon: 'function', permission: ['/rule'] } + } + ] + } +] diff --git a/src/router/modules/statistics.js b/src/router/modules/statistics.js new file mode 100644 index 0000000..fb9cbea --- /dev/null +++ b/src/router/modules/statistics.js @@ -0,0 +1,30 @@ +/* Layout */ +import Layout from '@/layout/Layout' + +export const statisticsRouters = [ + { + path: 'statisticsToilet', + component: Layout, + redirect: '/workStatistics', + name: 'StatisticsToilet', + meta: { + title: '作业统计', + icon: 'icon-config', // 图标 + permission: ['/statisticsToilet']// 权限名称 + }, + children: [ + { + path: '/workStatistics', + name: 'WorkStatistics', + component: () => import('@/views/statistics/toiletAssessment'), + meta: { title: '作业统计', icon: '', permission: ['/toilet/workStatistics'] } + }, + { + path: '/evaluationStatistics', + name: 'EvaluationStatistics', + component: () => import('@/views/statistics/evaluationAssessment'), + meta: { title: '评价统计', icon: '', permission: ['/toilet/evaluationStatistics'] } + } + ] + } +] diff --git a/src/router/modules/toilet.js b/src/router/modules/toilet.js new file mode 100644 index 0000000..b221a0e --- /dev/null +++ b/src/router/modules/toilet.js @@ -0,0 +1,30 @@ +/* Layout */ +import Layout from '@/layout/Layout' + +export const toiletRouters = [ + { + path: 'toiletManage', + component: Layout, + redirect: '/toiletManage', + name: 'ToiletManage', + meta: { + title: '公厕管理', + icon: 'icon-config', // 图标 + permission: ['/toiletManage']// 权限名称 + }, + children: [ + { + path: '/toiletList', + name: 'ToiletList', + component: () => import('@/views/toiletManage/toiletList'), + meta: { title: '公厕台帐管理', icon: 'function', permission: ['/toiletList'] } + }, + { + path: '/toiletMap', + name: 'ToiletMap', + component: () => import('@/views/overview/overview'), + meta: { title: '地图总览', icon: 'function', permission: ['/toiletMap'] } + } + ] + } +] diff --git a/src/router/modules/work.js b/src/router/modules/work.js new file mode 100644 index 0000000..5e0759f --- /dev/null +++ b/src/router/modules/work.js @@ -0,0 +1,24 @@ +/* Layout */ +import Layout from '@/layout/Layout' + +export const workRouters = [ + { + path: 'toiletWork', + component: Layout, + redirect: '/toiletManage', + name: 'toiletWork', + meta: { + title: '作业管理', + icon: 'icon-config', // 图标 + permission: ['/toiletWork']// 权限名称 + }, + children: [ + { + path: '/toiletWork', + name: 'ToiletWork', + component: () => import('@/views/toiletClean/toiletCleanList'), + meta: { title: '作业管理', icon: 'function', permission: ['/toiletWork'] } + } + ] + } +] diff --git a/src/settings.js b/src/settings.js index b568ce0..b8159bf 100644 --- a/src/settings.js +++ b/src/settings.js @@ -3,7 +3,7 @@ * @type {boolean} true | false * @description 是否显示设置按钮 */ - showSettings: true, + showSettings: false, /** * @type {boolean} true | false diff --git a/src/store/modules/permission.js b/src/store/modules/permission.js index a0cb8cf..3ab50d5 100644 --- a/src/store/modules/permission.js +++ b/src/store/modules/permission.js @@ -120,17 +120,23 @@ }) }, // 获取用户权限 - GetMenus({ commit, state }) { - console.log('in store.permission.js:GetMenus:') + GetMenus({ commit, state }, currentSystem) { + // console.log('in store.permission.js:GetMenus:') + console.log('获取' + currentSystem.name + '的菜单') + const params = { + parentCode: currentSystem.code // 传入该子系统的code,获取子系统的权限 + } return new Promise((resolve, reject) => { - getMenus(state.token).then(response => { // 处理返回值 + // 此处获取用户所有权限 + getMenus(params).then(response => { // 处理返回值 const data = response.data const menus = [] // 仅菜单 const btns = [] // 非菜单 if (data.menus && data.menus.length > 0) { - commit('SET_MENUS', data.menus) - for (const menu of data.menus) { // 遍历菜单,获取所有的权限项 - if (menu.ismenu === '1') { // 将是菜单的放入menus + const allmenus = [...data.menus] + commit('SET_MENUS', allmenus) + for (const menu of allmenus) { // 遍历菜单,获取所有的权限项 + if (menu.resourceType === '02' || menu.resourceType === '03') { // 将是菜单的放入menus const menu_tmp = {} menu_tmp.url = menu.url menu_tmp.icon = menu.icon @@ -142,11 +148,11 @@ btn_tmp.name = menu.name btn_tmp.icon = menu.icon btns.push(btn_tmp) - // console.log(menu.url) } } // 过滤路由表 - const accessedRouters = filterAsyncRouter(asyncRouterMap, menus) + let accessedRouters = filterAsyncRouter(asyncRouterMap, menus) + // accessedRouters = filterRedirect(accessedRouters) commit('SET_BTNS', btns) commit('SET_ROUTERS', accessedRouters) resolve(response) diff --git a/src/utils/baseConfig.js b/src/utils/baseConfig.js index 1f4fa38..999593e 100644 --- a/src/utils/baseConfig.js +++ b/src/utils/baseConfig.js @@ -1,5 +1,5 @@ const project = { - title: '后台管理系统前端基础框架' + title: '路桥养护子系统' } export function getProject() { return project diff --git a/src/utils/dateutils.js b/src/utils/dateutils.js index 868111a..5cd16af 100644 --- a/src/utils/dateutils.js +++ b/src/utils/dateutils.js @@ -15,15 +15,15 @@ return ct_month } -export function getLastWeek() { // 默认显示上周 +export function getLastWeek(fmt) { // 默认显示上周 const ct_month = new Date() ct_month.setTime(ct_month.getTime() - 3600 * 1000 * 24 * 7) - return ct_month + return ct_month.Format(fmt) } -export function getLastMonth() { // 默认显示上个月 +export function getLastMonth(fmt) { // 默认显示上个月 const ct_month = new Date() ct_month.setTime(ct_month.getTime() - 3600 * 1000 * 24 * 30) - return ct_month + return ct_month.Format(fmt) } // 对Date的扩展,将 Date 转化为指定格式的String diff --git a/src/utils/exportutils.js b/src/utils/exportutils.js new file mode 100644 index 0000000..b5d0bcf --- /dev/null +++ b/src/utils/exportutils.js @@ -0,0 +1,19 @@ +/** + * 导出文件工具 + * @param blob 文件 + * @param fileName 导出文件名 + */ +export function exportFile(blob, fileName) { + if (window.navigator && window.navigator.msSaveOrOpenBlob) { + navigator.msSaveBlob(blob, fileName) + } else { + const downloadElement = document.createElement('a') + const href = window.URL.createObjectURL(blob) // 创建下载的链接 + downloadElement.href = href + downloadElement.download = fileName + document.body.appendChild(downloadElement) + downloadElement.click() // 点击下载 + document.body.removeChild(downloadElement) // 下载完成移除元素 + window.URL.revokeObjectURL(href) // 释放blob对象 + } +} diff --git a/src/utils/request.js b/src/utils/request.js index c88ea76..dc56e26 100644 --- a/src/utils/request.js +++ b/src/utils/request.js @@ -17,6 +17,13 @@ config.headers['token'] = getToken() // 让每个请求携带自定义token 请根据实际情况自行修改 console.log(config.headers['token']) } + // 在接口增加时间戳 + // if (config.method === 'get') { + config.params = { + _t: Date.parse(new Date()) / 1000, + ...config.params + } + // } return config }, error => { diff --git a/src/views/mapViews/choosePointDialog.vue b/src/views/mapViews/choosePointDialog.vue new file mode 100644 index 0000000..c9dde8a --- /dev/null +++ b/src/views/mapViews/choosePointDialog.vue @@ -0,0 +1,105 @@ + + + + + diff --git a/src/views/mapViews/mapView.vue b/src/views/mapViews/mapView.vue new file mode 100644 index 0000000..a18db88 --- /dev/null +++ b/src/views/mapViews/mapView.vue @@ -0,0 +1,73 @@ + + + + + diff --git a/src/views/order/editOrder.vue b/src/views/order/editOrder.vue new file mode 100644 index 0000000..4a5fd8a --- /dev/null +++ b/src/views/order/editOrder.vue @@ -0,0 +1,319 @@ + + + + + diff --git a/src/views/order/listMaintainRecords.vue b/src/views/order/listMaintainRecords.vue new file mode 100644 index 0000000..2d4f682 --- /dev/null +++ b/src/views/order/listMaintainRecords.vue @@ -0,0 +1,327 @@ + + + + + diff --git a/src/views/overview/overview.vue b/src/views/overview/overview.vue new file mode 100644 index 0000000..9525867 --- /dev/null +++ b/src/views/overview/overview.vue @@ -0,0 +1,285 @@ + + + + + diff --git a/src/views/overview/toiletDetailDialog.vue b/src/views/overview/toiletDetailDialog.vue new file mode 100644 index 0000000..2b3a511 --- /dev/null +++ b/src/views/overview/toiletDetailDialog.vue @@ -0,0 +1,263 @@ + + + + + + diff --git a/src/views/overview/toiletLayer.vue b/src/views/overview/toiletLayer.vue new file mode 100644 index 0000000..d784323 --- /dev/null +++ b/src/views/overview/toiletLayer.vue @@ -0,0 +1,152 @@ + + + + + + diff --git a/src/views/rule/listRule.vue b/src/views/rule/listRule.vue new file mode 100644 index 0000000..a19b9e4 --- /dev/null +++ b/src/views/rule/listRule.vue @@ -0,0 +1,157 @@ + + + + + diff --git a/src/views/statistics/barChart.vue b/src/views/statistics/barChart.vue new file mode 100644 index 0000000..d10eb38 --- /dev/null +++ b/src/views/statistics/barChart.vue @@ -0,0 +1,65 @@ + + + + + diff --git a/src/views/statistics/components/evaluationListDialog.vue b/src/views/statistics/components/evaluationListDialog.vue new file mode 100644 index 0000000..1560772 --- /dev/null +++ b/src/views/statistics/components/evaluationListDialog.vue @@ -0,0 +1,100 @@ + + + + + + diff --git a/src/views/statistics/components/workChart.vue b/src/views/statistics/components/workChart.vue new file mode 100644 index 0000000..a891e0c --- /dev/null +++ b/src/views/statistics/components/workChart.vue @@ -0,0 +1,79 @@ + + + + + diff --git a/src/views/statistics/evaluationAssessment.vue b/src/views/statistics/evaluationAssessment.vue new file mode 100644 index 0000000..28dedc5 --- /dev/null +++ b/src/views/statistics/evaluationAssessment.vue @@ -0,0 +1,159 @@ + + + + + + diff --git a/src/views/statistics/pieChart.vue b/src/views/statistics/pieChart.vue new file mode 100644 index 0000000..e4dd287 --- /dev/null +++ b/src/views/statistics/pieChart.vue @@ -0,0 +1,58 @@ + + + + + diff --git a/config/index.js b/config/index.js index 8abd37a..19b33b1 100644 --- a/config/index.js +++ b/config/index.js @@ -69,7 +69,7 @@ * then assetsPublicPath should be set to "/bar/". * In most cases please use '/' !!! */ - assetsPublicPath: '/', + assetsPublicPath: '/toilet/', /** * Source Maps diff --git a/package.json b/package.json index 45f055f..9f3a3eb 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "echarts": "^4.2.1", "element-ui": "2.13.0", "event-source-polyfill": "^1.0.5", + "file-saver": "^2.0.5", "js-cookie": "2.2.0", "jsencrypt": "^3.0.0-rc.1", "leaflet": "^1.7.1", @@ -33,7 +34,9 @@ "vue-amap": "^0.5.9", "vue-baidu-map": "^0.21.22", "vue-router": "3.0.1", - "vuex": "3.0.1" + "vue2-leaflet": "^2.7.0", + "vuex": "3.0.1", + "xlsx": "^0.17.0" }, "devDependencies": { "autoprefixer": "8.5.0", diff --git a/src/api/common.js b/src/api/common.js index 87c582b..7804714 100644 --- a/src/api/common.js +++ b/src/api/common.js @@ -2,10 +2,14 @@ * 常用接口 */ import request from '@/utils/request' +import Vue from 'vue' + // 模板下载 export function downloadTemplate(fileName) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath return request({ - url: 'template/download', + url: lampPath + 'template/download', method: 'get', params: { filename: fileName @@ -19,7 +23,7 @@ const param = new FormData() param.append('file', fileobj.file) return request({ - url: 'imageUpload', + url: 'fileUpload', method: 'post', headers: { 'Content-Type': 'multipart/form-data' }, data: param diff --git a/src/api/sanitation/statistics.js b/src/api/sanitation/statistics.js new file mode 100644 index 0000000..ffeac18 --- /dev/null +++ b/src/api/sanitation/statistics.js @@ -0,0 +1,22 @@ + +/** + * 考核统计接口 + */ +import request from '@/utils/request' +// 公厕保洁次数统计 +export function getToiletJobCount(params) { + return request({ + url: '/sanitation/statistic/toilet/jobCount', + method: 'get', + params + }) +} + +// 公厕评分统计 +export function getToiletEvaluation(params) { + return request({ + url: '/sanitation/toiletEvaluation/statistics', + method: 'get', + params + }) +} diff --git a/src/api/sanitation/toilet.js b/src/api/sanitation/toilet.js new file mode 100644 index 0000000..11affd4 --- /dev/null +++ b/src/api/sanitation/toilet.js @@ -0,0 +1,133 @@ +/** + * 公厕管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' +// 公厕查询 +export function getToiletListPage(params) { + return request({ + url: '/sanitation/toilet/listPage', + method: 'get', + params + }) +} +// 公厕查询 +export function getToiletList(pid) { + return request({ + url: '/sanitation/toilet/list', + method: 'get', + params: { + pid: pid + } + }) +} + +// 添加公厕 +export function addToilet(params) { + return request({ + url: '/sanitation/toilet/add', + method: 'post', + params + }) +} +// 修改公厕机构 +export function updateToilet(params) { + return request({ + url: '/sanitation/toilet/update', + method: 'post', + params + }) +} +// 删除公厕机构 +export function delToilet(ids) { + return request({ + url: '/sanitation/toilet/delete', + method: 'post', + params: { + ids + }, + paramsSerializer: params => { + return qs.stringify(params, { indices: false }) + } + }) +} + +// 公厕基本信息详情 +export function getToiletInfoDetail(id) { + return request({ + url: '/sanitation/toilet/detail?toiletId=' + id, + method: 'get' + }) +} + +// 某公厕保洁记录 +export function getRecordsByToilet(params) { + return request({ + url: '/sanitation/toilet/jobRecord/detail', + method: 'get', + params + }) +} + +// 某公厕平均评分 +export function getScoreByToilet(params) { + return request({ + url: '/sanitation/toiletEvaluation/detailScore', + method: 'get', + params + }) +} + +// 某公厕评分列表 +export function getScoreListByToilet(params) { + return request({ + url: '/sanitation/toiletEvaluation/list', + method: 'get', + params + }) +} + + +// 批量导入 +export function batchImportToilet(fileobj) { + const param = new FormData() + param.append('file', fileobj) + return request({ + url: '/sanitation/toilet/import', + method: 'post', + headers: { 'Content-Type': 'multipart/form-data' }, + data: param + }) +} +// 批量导出 +export function batchExportToilet(params, config) { + return request({ + url: '/sanitation/toilet/export', + method: 'get', + timeout: 120000, + params, + ...config, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 公厕保洁记录查询 +export function getToiletJobRecords(params) { + return request({ + url: '/sanitation/toilet/jobRecord', + method: 'get', + params + }) +} + +// 批量导出 +export function batchExportToiletJobRecords(params, config) { + return request({ + url: '/sanitation/toilet/exportJobRecord', + method: 'get', + timeout: 120000, + params, + ...config, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} diff --git a/src/api/system/alarm.js b/src/api/system/alarm.js new file mode 100644 index 0000000..1c3a7ab --- /dev/null +++ b/src/api/system/alarm.js @@ -0,0 +1,62 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' + +// 获取当前报警列表 +export function getAlarmNowList(params) { + return request({ + url: '/alarm/listNowPage', + method: 'get', + params + }) +} + +// 获取当前报警列表 +export function getAlarmHistoryList(params) { + return request({ + url: '/alarm/listHisPage', + method: 'get', + params + }) +} + + +// 批量消警 +export function clearAll(params) { + return request({ + url: '/alarm/allClear', + method: 'get', + params + }) +} + +// 消警 +export function clearAlarm(params) { + return request({ + url: '/alarm/cancel', + method: 'get', + params + }) +} + +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 设置报警阈值 +export function setThresh(params) { + return request({ + url: '/alarm/resetAlarmRule', + method: 'post', + params + }) +} diff --git a/src/api/system/bridge.js b/src/api/system/bridge.js new file mode 100644 index 0000000..e8a4108 --- /dev/null +++ b/src/api/system/bridge.js @@ -0,0 +1,80 @@ +/** + * 桥梁管理接口 + */ +import request from '@/utils/request' + +// 获取桥梁详情 +export function getDetail(id) { + return request({ + url: '/bridge/detail', + method: 'get', + params: { + id: id + } + }) +} + +export function updateBridge(params) { + return request({ + url: '/bridge/update', + method: 'post', + params + }) +} +// 批量导出 +export function exportRecords(params) { + return request({ + url: 'device/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +export function getContentList(params) { + return request({ + url: 'maintain/contentByType', + method: 'get', + params: { + type: params + } + }) +} +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 编辑 +export function editRecord(params) { + return request({ + url: 'maintain/update', + method: 'post', + params + }) +} +// 新增 +export function addRecord(params) { + return request({ + url: 'maintain/add', + method: 'post', + params + }) +} +// 删除 +export function delRecord(id) { + return request({ + url: 'maintain/delete', + method: 'post', + params: { + id: id + } + }) +} diff --git a/src/api/system/data.js b/src/api/system/data.js new file mode 100644 index 0000000..4c95db5 --- /dev/null +++ b/src/api/system/data.js @@ -0,0 +1,63 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' + +// 获取当前报警列表 +export function getHistoryList(params) { + return request({ + url: '/data/hisListPage', + method: 'get', + params + }) +} + +// 获取当前报警列表 +export function getHistory(params) { + return request({ + url: '/data/hisList', + method: 'get', + params + }) +} + + + +// 批量消警 +export function clearAll(params) { + return request({ + url: '/alarm/allClear', + method: 'get', + params + }) +} + +// 消警 +export function clearAlarm(params) { + return request({ + url: '/alarm/cancel', + method: 'get', + params + }) +} + +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 设置报警阈值 +export function setThresh(params) { + return request({ + url: '/alarm/resetAlarmRule', + method: 'post', + params + }) +} diff --git a/src/api/system/order.js b/src/api/system/order.js new file mode 100644 index 0000000..7007c50 --- /dev/null +++ b/src/api/system/order.js @@ -0,0 +1,71 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +// import qs from 'qs' + +// 获取当前报警列表 +export function getRecordList(params) { + return request({ + url: '/maintain/listPage', + method: 'get', + params + }) +} +// 批量导出 +export function exportRecords(params) { + return request({ + url: 'device/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +export function getContentList(params) { + return request({ + url: 'maintain/contentByType', + method: 'get', + params: { + type: params + } + }) +} +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 编辑 +export function editRecord(params) { + return request({ + url: 'maintain/update', + method: 'post', + params + }) +} +// 新增 +export function addRecord(params) { + return request({ + url: 'maintain/add', + method: 'post', + params + }) +} +// 删除 +export function delRecord(id) { + return request({ + url: 'maintain/delete', + method: 'post', + params: { + bridgeMaintenanceId: id + } + }) +} diff --git a/src/api/system/overview.js b/src/api/system/overview.js new file mode 100644 index 0000000..bca50cc --- /dev/null +++ b/src/api/system/overview.js @@ -0,0 +1,109 @@ +import request from '@/utils/request' +import qs from "qs" +import Vue from 'vue' + +// 路灯状态统计 +export function getLampStatus() { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampStatus', + method: 'get' + }) +} + +// 路灯总览列表 +export function getLampList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampList', + method: 'get', + params + }) +} + +// 路灯详情 +export function getlampDetail(lampId) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampDetail', + method: 'get', + params: { + lampId: lampId + } + }) +} + +// 回路列表 +export function getCircuitList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/circuitList', + method: 'get', + params + }) +} + +// 灯箱列表 +export function getLampBoxList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampBoxList', + method: 'get', + params + }) +} +// 灯箱详情 +export function getLampBoxDetail(lampBoxId) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampBoxDetail', + method: 'get', + params: { + lampBoxId: lampBoxId + } + }) +} + +// 报警总览列表 +export function getAlarmList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/alarmList', + method: 'get', + params + }) +} + +// 报警详情 +export function getAlarmDetail(alarmId) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/alarmDetail', + method: 'get', + params: { + alarmId: alarmId + } + }) +} + +// 路灯控制 +export function lampControl(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampControl', + method: 'post', + params, + paramsSerializer: params => { + return qs.stringify(params, { indices: false }) + } + }) +} diff --git a/src/api/system/rule.js b/src/api/system/rule.js new file mode 100644 index 0000000..76c6b2d --- /dev/null +++ b/src/api/system/rule.js @@ -0,0 +1,59 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +// import qs from 'qs' + +// 获取当前报警列表 +export function getRuleList() { + return request({ + url: 'rule/listPage', + method: 'get' + }) +} +export function getContentList(params) { + return request({ + url: 'maintain/contentByType', + method: 'get', + params: { + type: params + } + }) +} +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 编辑 +export function editRecord(params) { + return request({ + url: 'maintain/update', + method: 'post', + params + }) +} +// 新增 +export function addRecord(params) { + return request({ + url: 'maintain/add', + method: 'post', + params + }) +} +// 删除 +export function delRecord(id) { + return request({ + url: 'maintain/delete', + method: 'post', + params: { + id: id + } + }) +} diff --git a/src/api/system/statistics.js b/src/api/system/statistics.js new file mode 100644 index 0000000..b25efe9 --- /dev/null +++ b/src/api/system/statistics.js @@ -0,0 +1,23 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +// import qs from 'qs' + +// +export function countByToilet(params) { + return request({ + url: '/sanitation/toiletStatistic/jobStaticByToilet', + method: 'get', + params + }) +} + +export function countByDay(params) { + return request({ + url: '/sanitation/toiletStatistic/jobStaticByDate', + method: 'get', + params + }) +} + diff --git a/src/assets/global_images/icon-position.png b/src/assets/global_images/icon-position.png new file mode 100644 index 0000000..7444038 --- /dev/null +++ b/src/assets/global_images/icon-position.png Binary files differ diff --git a/src/assets/global_images/location_green.png b/src/assets/global_images/location_green.png new file mode 100644 index 0000000..aa8be65 --- /dev/null +++ b/src/assets/global_images/location_green.png Binary files differ diff --git a/src/assets/global_images/location_red.png b/src/assets/global_images/location_red.png new file mode 100644 index 0000000..2be8c3d --- /dev/null +++ b/src/assets/global_images/location_red.png Binary files differ diff --git a/src/assets/global_images/location_yellow.png b/src/assets/global_images/location_yellow.png new file mode 100644 index 0000000..5ab6f4d --- /dev/null +++ b/src/assets/global_images/location_yellow.png Binary files differ diff --git a/src/assets/global_images/toilet-position.png b/src/assets/global_images/toilet-position.png new file mode 100644 index 0000000..7db6d9a --- /dev/null +++ b/src/assets/global_images/toilet-position.png Binary files differ diff --git a/src/assets/global_images/toilet.png b/src/assets/global_images/toilet.png new file mode 100644 index 0000000..6d9fc05 --- /dev/null +++ b/src/assets/global_images/toilet.png Binary files differ diff --git a/src/assets/global_images/toiletPhoto.png b/src/assets/global_images/toiletPhoto.png new file mode 100644 index 0000000..15d08e2 --- /dev/null +++ b/src/assets/global_images/toiletPhoto.png Binary files differ diff --git a/src/components/DownloadTemplate/index.vue b/src/components/DownloadTemplate/index.vue index 8ded2cd..7807cac 100644 --- a/src/components/DownloadTemplate/index.vue +++ b/src/components/DownloadTemplate/index.vue @@ -47,8 +47,8 @@ diff --git a/src/components/NormalTable/index.vue b/src/components/NormalTable/index.vue index 5077bef..04d322d 100644 --- a/src/components/NormalTable/index.vue +++ b/src/components/NormalTable/index.vue @@ -79,7 +79,7 @@
-
+
Object.assign(obj, { [key]: this[key] }), {}), + on: events.reduce((obj, key) => Object.assign(obj, { [key]: this.transmitEvent }), {}) + }) + } + this.props = [...extraProps, ...props.filter(prop => exceptProps.indexOf(prop))] + } +} + +export default prop => new Mixin(prop) diff --git a/src/components/mapWindow/base/mixins/common.js b/src/components/mapWindow/base/mixins/common.js new file mode 100644 index 0000000..2fd1a28 --- /dev/null +++ b/src/components/mapWindow/base/mixins/common.js @@ -0,0 +1,82 @@ +const types = { + map: { + unload: 'clearMap' + }, + control: { + unload: 'removeControl' + }, + layer: { + unload: 'removeLayer' + }, + features: { + unload: 'removeFeatures' + }, + listener: { + unload: 'removeListener' + } +} + +const getParent = $component => ($component.abstract || $component.$el === $component.$children[0].$el) ? getParent($component.$parent) : $component + +function destroyInstance () { + const { unload, renderByParent, $parent } = this + if (renderByParent) { + $parent.reload() + } + unload() +} + +class Mixin { + constructor (prop) { + this.methods = { + ready () { + const $parent = getParent(this.$parent) + const map = this.map = $parent.map + this.load() + this.$emit('ready', { + map + }) + }, + transmitEvent (e) { + this.$emit(e.type.replace(/^on/, ''), e) + }, + reload () { + this && this.$nextTick(() => { + this.unload() + this.$nextTick(this.load) + }) + }, + unload () { + const { map, originInstance } = this + try { + switch (prop.type) { + case 'search': + return originInstance.clearResults() + case 'autoComplete': + case 'lushu': + return originInstance.dispose() + case 'markerClusterer': + return originInstance.clearMarkers() + default: + map[types[prop.type].unload](originInstance) + } + } catch (e) {} + } + } + this.computed = { + renderByParent () { + return this.$parent.preventChildrenRender + } + } + this.mounted = function () { + console.log('common mounted') + const $parent = getParent(this.$parent) + const map = $parent.map + const { ready } = this + console.log(map) + map ? ready() : $parent.$on('onload', ready) + } + } +} + +export default type => new Mixin({ type }) diff --git a/src/components/mapWindow/leafletMap.vue b/src/components/mapWindow/leafletMap.vue new file mode 100644 index 0000000..b753cc0 --- /dev/null +++ b/src/components/mapWindow/leafletMap.vue @@ -0,0 +1,143 @@ + + + + + + + diff --git a/src/components/mapWindow/mapWindow.vue b/src/components/mapWindow/mapWindow.vue new file mode 100644 index 0000000..9ced291 --- /dev/null +++ b/src/components/mapWindow/mapWindow.vue @@ -0,0 +1,46 @@ + + + + + + diff --git a/src/icons/svg/bridge.svg b/src/icons/svg/bridge.svg new file mode 100644 index 0000000..1a0336f --- /dev/null +++ b/src/icons/svg/bridge.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/icons/svg/toilet.svg b/src/icons/svg/toilet.svg new file mode 100644 index 0000000..9d8e765 --- /dev/null +++ b/src/icons/svg/toilet.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/main.js b/src/main.js index f2d105d..3e4074e 100644 --- a/src/main.js +++ b/src/main.js @@ -18,6 +18,9 @@ // echart // import echarts from 'echarts' // Vue.prototype.$echarts = echarts +// 引入v-charts +import VCharts from 'v-charts' +Vue.use(VCharts) // 将自动注册所有组件为全局组件 // import dataV from '@jiaminghi/data-view' @@ -35,9 +38,19 @@ Vue.component('search-item', SearchItem) // 加载leaflet的css +// import 'leaflet/dist/leaflet.css' +// import 'leaflet-draw/dist/leaflet.draw.css' +import L from 'leaflet' import 'leaflet/dist/leaflet.css' -import 'leaflet-draw/dist/leaflet.draw.css' +Vue.config.productionTip = false +Vue.L = Vue.prototype.$L = L +delete L.Icon.Default.prototype._getIconUrl +L.Icon.Default.mergeOptions({ + iconRetinaUrl: require('leaflet/dist/images/marker-icon-2x.png'), + iconUrl: require('leaflet/dist/images/marker-icon.png'), + shadowUrl: require('leaflet/dist/images/marker-shadow.png') +}) /** * This project originally used easy-mock to simulate data, * but its official service is very unstable, diff --git a/src/permission.js b/src/permission.js index dc6b2f8..809ca86 100644 --- a/src/permission.js +++ b/src/permission.js @@ -25,8 +25,8 @@ store.dispatch('GetInfo').then(res => { // 拉取用户信息 // 设置当前子系统为基础资源子系统 const currentSys = { - code: 'baseResourse', - name: '基础资源子系统' + code: 'toliet', + name: '公共厕所管理系统' } // 将当前系统信息保存在localStorage中 store.commit('SET_SYSTEM', currentSys) diff --git a/src/router/index.js b/src/router/index.js index 39c295c..d23076d 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -8,8 +8,11 @@ /* Layout */ import Layout from '@/layout/Layout' +import { toiletRouters } from './modules/toilet' +import { workRouters } from './modules/work' +import { statisticsRouters } from './modules/statistics' +import { ruleRouters } from './modules/rule' import { systemRouters } from './modules/system' -import { exampleRouters } from './modules/example' /** * hidden: true if `hidden:true` will not show in the sidebar(default is false) @@ -40,11 +43,12 @@ ] }, // 登录页面 - { path: '/login', component: () => import('@/views/login/index'), hidden: true }, + { path: '/login', component: () => import('@/views/login/index_2'), hidden: true }, // 404错误页面 { path: '/404', component: () => import('@/views/errorPage/404'), hidden: true }, // 401 错误页面 - { path: '/401', component: () => import('@/views/errorPage/401'), hidden: true } + { path: '/401', component: () => import('@/views/errorPage/401'), hidden: true }, + { path: '/', redirect: '/toiletList', hidden: true } ] // 实例化vue的时候直挂载constantRouter export default new Router({ @@ -56,7 +60,10 @@ // 异步挂载路由 // 动态需要根据权限加载的路由表 export const asyncRouterMap = [ - ...exampleRouters, - ...systemRouters, + ...toiletRouters, + ...workRouters, + ...statisticsRouters, + ...ruleRouters, + // ...systemRouters, { path: '*', redirect: '/404', hidden: true } ] diff --git a/src/router/modules/rule.js b/src/router/modules/rule.js new file mode 100644 index 0000000..51e0283 --- /dev/null +++ b/src/router/modules/rule.js @@ -0,0 +1,24 @@ +/* Layout */ +import Layout from '@/layout/Layout' + +export const ruleRouters = [ + { + path: 'rule', + component: Layout, + redirect: '/rule', + name: 'Rule', + meta: { + title: '规章制度', + icon: 'icon-config', // 图标 + permission: ['/rule']// 权限名称 + }, + children: [ + { + path: '/rule', + name: 'Rule', + component: () => import('@/views/rule/listRule'), + meta: { title: '规章制度', icon: 'function', permission: ['/rule'] } + } + ] + } +] diff --git a/src/router/modules/statistics.js b/src/router/modules/statistics.js new file mode 100644 index 0000000..fb9cbea --- /dev/null +++ b/src/router/modules/statistics.js @@ -0,0 +1,30 @@ +/* Layout */ +import Layout from '@/layout/Layout' + +export const statisticsRouters = [ + { + path: 'statisticsToilet', + component: Layout, + redirect: '/workStatistics', + name: 'StatisticsToilet', + meta: { + title: '作业统计', + icon: 'icon-config', // 图标 + permission: ['/statisticsToilet']// 权限名称 + }, + children: [ + { + path: '/workStatistics', + name: 'WorkStatistics', + component: () => import('@/views/statistics/toiletAssessment'), + meta: { title: '作业统计', icon: '', permission: ['/toilet/workStatistics'] } + }, + { + path: '/evaluationStatistics', + name: 'EvaluationStatistics', + component: () => import('@/views/statistics/evaluationAssessment'), + meta: { title: '评价统计', icon: '', permission: ['/toilet/evaluationStatistics'] } + } + ] + } +] diff --git a/src/router/modules/toilet.js b/src/router/modules/toilet.js new file mode 100644 index 0000000..b221a0e --- /dev/null +++ b/src/router/modules/toilet.js @@ -0,0 +1,30 @@ +/* Layout */ +import Layout from '@/layout/Layout' + +export const toiletRouters = [ + { + path: 'toiletManage', + component: Layout, + redirect: '/toiletManage', + name: 'ToiletManage', + meta: { + title: '公厕管理', + icon: 'icon-config', // 图标 + permission: ['/toiletManage']// 权限名称 + }, + children: [ + { + path: '/toiletList', + name: 'ToiletList', + component: () => import('@/views/toiletManage/toiletList'), + meta: { title: '公厕台帐管理', icon: 'function', permission: ['/toiletList'] } + }, + { + path: '/toiletMap', + name: 'ToiletMap', + component: () => import('@/views/overview/overview'), + meta: { title: '地图总览', icon: 'function', permission: ['/toiletMap'] } + } + ] + } +] diff --git a/src/router/modules/work.js b/src/router/modules/work.js new file mode 100644 index 0000000..5e0759f --- /dev/null +++ b/src/router/modules/work.js @@ -0,0 +1,24 @@ +/* Layout */ +import Layout from '@/layout/Layout' + +export const workRouters = [ + { + path: 'toiletWork', + component: Layout, + redirect: '/toiletManage', + name: 'toiletWork', + meta: { + title: '作业管理', + icon: 'icon-config', // 图标 + permission: ['/toiletWork']// 权限名称 + }, + children: [ + { + path: '/toiletWork', + name: 'ToiletWork', + component: () => import('@/views/toiletClean/toiletCleanList'), + meta: { title: '作业管理', icon: 'function', permission: ['/toiletWork'] } + } + ] + } +] diff --git a/src/settings.js b/src/settings.js index b568ce0..b8159bf 100644 --- a/src/settings.js +++ b/src/settings.js @@ -3,7 +3,7 @@ * @type {boolean} true | false * @description 是否显示设置按钮 */ - showSettings: true, + showSettings: false, /** * @type {boolean} true | false diff --git a/src/store/modules/permission.js b/src/store/modules/permission.js index a0cb8cf..3ab50d5 100644 --- a/src/store/modules/permission.js +++ b/src/store/modules/permission.js @@ -120,17 +120,23 @@ }) }, // 获取用户权限 - GetMenus({ commit, state }) { - console.log('in store.permission.js:GetMenus:') + GetMenus({ commit, state }, currentSystem) { + // console.log('in store.permission.js:GetMenus:') + console.log('获取' + currentSystem.name + '的菜单') + const params = { + parentCode: currentSystem.code // 传入该子系统的code,获取子系统的权限 + } return new Promise((resolve, reject) => { - getMenus(state.token).then(response => { // 处理返回值 + // 此处获取用户所有权限 + getMenus(params).then(response => { // 处理返回值 const data = response.data const menus = [] // 仅菜单 const btns = [] // 非菜单 if (data.menus && data.menus.length > 0) { - commit('SET_MENUS', data.menus) - for (const menu of data.menus) { // 遍历菜单,获取所有的权限项 - if (menu.ismenu === '1') { // 将是菜单的放入menus + const allmenus = [...data.menus] + commit('SET_MENUS', allmenus) + for (const menu of allmenus) { // 遍历菜单,获取所有的权限项 + if (menu.resourceType === '02' || menu.resourceType === '03') { // 将是菜单的放入menus const menu_tmp = {} menu_tmp.url = menu.url menu_tmp.icon = menu.icon @@ -142,11 +148,11 @@ btn_tmp.name = menu.name btn_tmp.icon = menu.icon btns.push(btn_tmp) - // console.log(menu.url) } } // 过滤路由表 - const accessedRouters = filterAsyncRouter(asyncRouterMap, menus) + let accessedRouters = filterAsyncRouter(asyncRouterMap, menus) + // accessedRouters = filterRedirect(accessedRouters) commit('SET_BTNS', btns) commit('SET_ROUTERS', accessedRouters) resolve(response) diff --git a/src/utils/baseConfig.js b/src/utils/baseConfig.js index 1f4fa38..999593e 100644 --- a/src/utils/baseConfig.js +++ b/src/utils/baseConfig.js @@ -1,5 +1,5 @@ const project = { - title: '后台管理系统前端基础框架' + title: '路桥养护子系统' } export function getProject() { return project diff --git a/src/utils/dateutils.js b/src/utils/dateutils.js index 868111a..5cd16af 100644 --- a/src/utils/dateutils.js +++ b/src/utils/dateutils.js @@ -15,15 +15,15 @@ return ct_month } -export function getLastWeek() { // 默认显示上周 +export function getLastWeek(fmt) { // 默认显示上周 const ct_month = new Date() ct_month.setTime(ct_month.getTime() - 3600 * 1000 * 24 * 7) - return ct_month + return ct_month.Format(fmt) } -export function getLastMonth() { // 默认显示上个月 +export function getLastMonth(fmt) { // 默认显示上个月 const ct_month = new Date() ct_month.setTime(ct_month.getTime() - 3600 * 1000 * 24 * 30) - return ct_month + return ct_month.Format(fmt) } // 对Date的扩展,将 Date 转化为指定格式的String diff --git a/src/utils/exportutils.js b/src/utils/exportutils.js new file mode 100644 index 0000000..b5d0bcf --- /dev/null +++ b/src/utils/exportutils.js @@ -0,0 +1,19 @@ +/** + * 导出文件工具 + * @param blob 文件 + * @param fileName 导出文件名 + */ +export function exportFile(blob, fileName) { + if (window.navigator && window.navigator.msSaveOrOpenBlob) { + navigator.msSaveBlob(blob, fileName) + } else { + const downloadElement = document.createElement('a') + const href = window.URL.createObjectURL(blob) // 创建下载的链接 + downloadElement.href = href + downloadElement.download = fileName + document.body.appendChild(downloadElement) + downloadElement.click() // 点击下载 + document.body.removeChild(downloadElement) // 下载完成移除元素 + window.URL.revokeObjectURL(href) // 释放blob对象 + } +} diff --git a/src/utils/request.js b/src/utils/request.js index c88ea76..dc56e26 100644 --- a/src/utils/request.js +++ b/src/utils/request.js @@ -17,6 +17,13 @@ config.headers['token'] = getToken() // 让每个请求携带自定义token 请根据实际情况自行修改 console.log(config.headers['token']) } + // 在接口增加时间戳 + // if (config.method === 'get') { + config.params = { + _t: Date.parse(new Date()) / 1000, + ...config.params + } + // } return config }, error => { diff --git a/src/views/mapViews/choosePointDialog.vue b/src/views/mapViews/choosePointDialog.vue new file mode 100644 index 0000000..c9dde8a --- /dev/null +++ b/src/views/mapViews/choosePointDialog.vue @@ -0,0 +1,105 @@ + + + + + diff --git a/src/views/mapViews/mapView.vue b/src/views/mapViews/mapView.vue new file mode 100644 index 0000000..a18db88 --- /dev/null +++ b/src/views/mapViews/mapView.vue @@ -0,0 +1,73 @@ + + + + + diff --git a/src/views/order/editOrder.vue b/src/views/order/editOrder.vue new file mode 100644 index 0000000..4a5fd8a --- /dev/null +++ b/src/views/order/editOrder.vue @@ -0,0 +1,319 @@ + + + + + diff --git a/src/views/order/listMaintainRecords.vue b/src/views/order/listMaintainRecords.vue new file mode 100644 index 0000000..2d4f682 --- /dev/null +++ b/src/views/order/listMaintainRecords.vue @@ -0,0 +1,327 @@ + + + + + diff --git a/src/views/overview/overview.vue b/src/views/overview/overview.vue new file mode 100644 index 0000000..9525867 --- /dev/null +++ b/src/views/overview/overview.vue @@ -0,0 +1,285 @@ + + + + + diff --git a/src/views/overview/toiletDetailDialog.vue b/src/views/overview/toiletDetailDialog.vue new file mode 100644 index 0000000..2b3a511 --- /dev/null +++ b/src/views/overview/toiletDetailDialog.vue @@ -0,0 +1,263 @@ + + + + + + diff --git a/src/views/overview/toiletLayer.vue b/src/views/overview/toiletLayer.vue new file mode 100644 index 0000000..d784323 --- /dev/null +++ b/src/views/overview/toiletLayer.vue @@ -0,0 +1,152 @@ + + + + + + diff --git a/src/views/rule/listRule.vue b/src/views/rule/listRule.vue new file mode 100644 index 0000000..a19b9e4 --- /dev/null +++ b/src/views/rule/listRule.vue @@ -0,0 +1,157 @@ + + + + + diff --git a/src/views/statistics/barChart.vue b/src/views/statistics/barChart.vue new file mode 100644 index 0000000..d10eb38 --- /dev/null +++ b/src/views/statistics/barChart.vue @@ -0,0 +1,65 @@ + + + + + diff --git a/src/views/statistics/components/evaluationListDialog.vue b/src/views/statistics/components/evaluationListDialog.vue new file mode 100644 index 0000000..1560772 --- /dev/null +++ b/src/views/statistics/components/evaluationListDialog.vue @@ -0,0 +1,100 @@ + + + + + + diff --git a/src/views/statistics/components/workChart.vue b/src/views/statistics/components/workChart.vue new file mode 100644 index 0000000..a891e0c --- /dev/null +++ b/src/views/statistics/components/workChart.vue @@ -0,0 +1,79 @@ + + + + + diff --git a/src/views/statistics/evaluationAssessment.vue b/src/views/statistics/evaluationAssessment.vue new file mode 100644 index 0000000..28dedc5 --- /dev/null +++ b/src/views/statistics/evaluationAssessment.vue @@ -0,0 +1,159 @@ + + + + + + diff --git a/src/views/statistics/pieChart.vue b/src/views/statistics/pieChart.vue new file mode 100644 index 0000000..e4dd287 --- /dev/null +++ b/src/views/statistics/pieChart.vue @@ -0,0 +1,58 @@ + + + + + diff --git a/src/views/statistics/statisticsChart.vue b/src/views/statistics/statisticsChart.vue new file mode 100644 index 0000000..2c48fe0 --- /dev/null +++ b/src/views/statistics/statisticsChart.vue @@ -0,0 +1,87 @@ + + + + + diff --git a/config/index.js b/config/index.js index 8abd37a..19b33b1 100644 --- a/config/index.js +++ b/config/index.js @@ -69,7 +69,7 @@ * then assetsPublicPath should be set to "/bar/". * In most cases please use '/' !!! */ - assetsPublicPath: '/', + assetsPublicPath: '/toilet/', /** * Source Maps diff --git a/package.json b/package.json index 45f055f..9f3a3eb 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "echarts": "^4.2.1", "element-ui": "2.13.0", "event-source-polyfill": "^1.0.5", + "file-saver": "^2.0.5", "js-cookie": "2.2.0", "jsencrypt": "^3.0.0-rc.1", "leaflet": "^1.7.1", @@ -33,7 +34,9 @@ "vue-amap": "^0.5.9", "vue-baidu-map": "^0.21.22", "vue-router": "3.0.1", - "vuex": "3.0.1" + "vue2-leaflet": "^2.7.0", + "vuex": "3.0.1", + "xlsx": "^0.17.0" }, "devDependencies": { "autoprefixer": "8.5.0", diff --git a/src/api/common.js b/src/api/common.js index 87c582b..7804714 100644 --- a/src/api/common.js +++ b/src/api/common.js @@ -2,10 +2,14 @@ * 常用接口 */ import request from '@/utils/request' +import Vue from 'vue' + // 模板下载 export function downloadTemplate(fileName) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath return request({ - url: 'template/download', + url: lampPath + 'template/download', method: 'get', params: { filename: fileName @@ -19,7 +23,7 @@ const param = new FormData() param.append('file', fileobj.file) return request({ - url: 'imageUpload', + url: 'fileUpload', method: 'post', headers: { 'Content-Type': 'multipart/form-data' }, data: param diff --git a/src/api/sanitation/statistics.js b/src/api/sanitation/statistics.js new file mode 100644 index 0000000..ffeac18 --- /dev/null +++ b/src/api/sanitation/statistics.js @@ -0,0 +1,22 @@ + +/** + * 考核统计接口 + */ +import request from '@/utils/request' +// 公厕保洁次数统计 +export function getToiletJobCount(params) { + return request({ + url: '/sanitation/statistic/toilet/jobCount', + method: 'get', + params + }) +} + +// 公厕评分统计 +export function getToiletEvaluation(params) { + return request({ + url: '/sanitation/toiletEvaluation/statistics', + method: 'get', + params + }) +} diff --git a/src/api/sanitation/toilet.js b/src/api/sanitation/toilet.js new file mode 100644 index 0000000..11affd4 --- /dev/null +++ b/src/api/sanitation/toilet.js @@ -0,0 +1,133 @@ +/** + * 公厕管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' +// 公厕查询 +export function getToiletListPage(params) { + return request({ + url: '/sanitation/toilet/listPage', + method: 'get', + params + }) +} +// 公厕查询 +export function getToiletList(pid) { + return request({ + url: '/sanitation/toilet/list', + method: 'get', + params: { + pid: pid + } + }) +} + +// 添加公厕 +export function addToilet(params) { + return request({ + url: '/sanitation/toilet/add', + method: 'post', + params + }) +} +// 修改公厕机构 +export function updateToilet(params) { + return request({ + url: '/sanitation/toilet/update', + method: 'post', + params + }) +} +// 删除公厕机构 +export function delToilet(ids) { + return request({ + url: '/sanitation/toilet/delete', + method: 'post', + params: { + ids + }, + paramsSerializer: params => { + return qs.stringify(params, { indices: false }) + } + }) +} + +// 公厕基本信息详情 +export function getToiletInfoDetail(id) { + return request({ + url: '/sanitation/toilet/detail?toiletId=' + id, + method: 'get' + }) +} + +// 某公厕保洁记录 +export function getRecordsByToilet(params) { + return request({ + url: '/sanitation/toilet/jobRecord/detail', + method: 'get', + params + }) +} + +// 某公厕平均评分 +export function getScoreByToilet(params) { + return request({ + url: '/sanitation/toiletEvaluation/detailScore', + method: 'get', + params + }) +} + +// 某公厕评分列表 +export function getScoreListByToilet(params) { + return request({ + url: '/sanitation/toiletEvaluation/list', + method: 'get', + params + }) +} + + +// 批量导入 +export function batchImportToilet(fileobj) { + const param = new FormData() + param.append('file', fileobj) + return request({ + url: '/sanitation/toilet/import', + method: 'post', + headers: { 'Content-Type': 'multipart/form-data' }, + data: param + }) +} +// 批量导出 +export function batchExportToilet(params, config) { + return request({ + url: '/sanitation/toilet/export', + method: 'get', + timeout: 120000, + params, + ...config, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 公厕保洁记录查询 +export function getToiletJobRecords(params) { + return request({ + url: '/sanitation/toilet/jobRecord', + method: 'get', + params + }) +} + +// 批量导出 +export function batchExportToiletJobRecords(params, config) { + return request({ + url: '/sanitation/toilet/exportJobRecord', + method: 'get', + timeout: 120000, + params, + ...config, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} diff --git a/src/api/system/alarm.js b/src/api/system/alarm.js new file mode 100644 index 0000000..1c3a7ab --- /dev/null +++ b/src/api/system/alarm.js @@ -0,0 +1,62 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' + +// 获取当前报警列表 +export function getAlarmNowList(params) { + return request({ + url: '/alarm/listNowPage', + method: 'get', + params + }) +} + +// 获取当前报警列表 +export function getAlarmHistoryList(params) { + return request({ + url: '/alarm/listHisPage', + method: 'get', + params + }) +} + + +// 批量消警 +export function clearAll(params) { + return request({ + url: '/alarm/allClear', + method: 'get', + params + }) +} + +// 消警 +export function clearAlarm(params) { + return request({ + url: '/alarm/cancel', + method: 'get', + params + }) +} + +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 设置报警阈值 +export function setThresh(params) { + return request({ + url: '/alarm/resetAlarmRule', + method: 'post', + params + }) +} diff --git a/src/api/system/bridge.js b/src/api/system/bridge.js new file mode 100644 index 0000000..e8a4108 --- /dev/null +++ b/src/api/system/bridge.js @@ -0,0 +1,80 @@ +/** + * 桥梁管理接口 + */ +import request from '@/utils/request' + +// 获取桥梁详情 +export function getDetail(id) { + return request({ + url: '/bridge/detail', + method: 'get', + params: { + id: id + } + }) +} + +export function updateBridge(params) { + return request({ + url: '/bridge/update', + method: 'post', + params + }) +} +// 批量导出 +export function exportRecords(params) { + return request({ + url: 'device/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +export function getContentList(params) { + return request({ + url: 'maintain/contentByType', + method: 'get', + params: { + type: params + } + }) +} +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 编辑 +export function editRecord(params) { + return request({ + url: 'maintain/update', + method: 'post', + params + }) +} +// 新增 +export function addRecord(params) { + return request({ + url: 'maintain/add', + method: 'post', + params + }) +} +// 删除 +export function delRecord(id) { + return request({ + url: 'maintain/delete', + method: 'post', + params: { + id: id + } + }) +} diff --git a/src/api/system/data.js b/src/api/system/data.js new file mode 100644 index 0000000..4c95db5 --- /dev/null +++ b/src/api/system/data.js @@ -0,0 +1,63 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' + +// 获取当前报警列表 +export function getHistoryList(params) { + return request({ + url: '/data/hisListPage', + method: 'get', + params + }) +} + +// 获取当前报警列表 +export function getHistory(params) { + return request({ + url: '/data/hisList', + method: 'get', + params + }) +} + + + +// 批量消警 +export function clearAll(params) { + return request({ + url: '/alarm/allClear', + method: 'get', + params + }) +} + +// 消警 +export function clearAlarm(params) { + return request({ + url: '/alarm/cancel', + method: 'get', + params + }) +} + +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 设置报警阈值 +export function setThresh(params) { + return request({ + url: '/alarm/resetAlarmRule', + method: 'post', + params + }) +} diff --git a/src/api/system/order.js b/src/api/system/order.js new file mode 100644 index 0000000..7007c50 --- /dev/null +++ b/src/api/system/order.js @@ -0,0 +1,71 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +// import qs from 'qs' + +// 获取当前报警列表 +export function getRecordList(params) { + return request({ + url: '/maintain/listPage', + method: 'get', + params + }) +} +// 批量导出 +export function exportRecords(params) { + return request({ + url: 'device/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +export function getContentList(params) { + return request({ + url: 'maintain/contentByType', + method: 'get', + params: { + type: params + } + }) +} +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 编辑 +export function editRecord(params) { + return request({ + url: 'maintain/update', + method: 'post', + params + }) +} +// 新增 +export function addRecord(params) { + return request({ + url: 'maintain/add', + method: 'post', + params + }) +} +// 删除 +export function delRecord(id) { + return request({ + url: 'maintain/delete', + method: 'post', + params: { + bridgeMaintenanceId: id + } + }) +} diff --git a/src/api/system/overview.js b/src/api/system/overview.js new file mode 100644 index 0000000..bca50cc --- /dev/null +++ b/src/api/system/overview.js @@ -0,0 +1,109 @@ +import request from '@/utils/request' +import qs from "qs" +import Vue from 'vue' + +// 路灯状态统计 +export function getLampStatus() { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampStatus', + method: 'get' + }) +} + +// 路灯总览列表 +export function getLampList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampList', + method: 'get', + params + }) +} + +// 路灯详情 +export function getlampDetail(lampId) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampDetail', + method: 'get', + params: { + lampId: lampId + } + }) +} + +// 回路列表 +export function getCircuitList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/circuitList', + method: 'get', + params + }) +} + +// 灯箱列表 +export function getLampBoxList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampBoxList', + method: 'get', + params + }) +} +// 灯箱详情 +export function getLampBoxDetail(lampBoxId) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampBoxDetail', + method: 'get', + params: { + lampBoxId: lampBoxId + } + }) +} + +// 报警总览列表 +export function getAlarmList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/alarmList', + method: 'get', + params + }) +} + +// 报警详情 +export function getAlarmDetail(alarmId) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/alarmDetail', + method: 'get', + params: { + alarmId: alarmId + } + }) +} + +// 路灯控制 +export function lampControl(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampControl', + method: 'post', + params, + paramsSerializer: params => { + return qs.stringify(params, { indices: false }) + } + }) +} diff --git a/src/api/system/rule.js b/src/api/system/rule.js new file mode 100644 index 0000000..76c6b2d --- /dev/null +++ b/src/api/system/rule.js @@ -0,0 +1,59 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +// import qs from 'qs' + +// 获取当前报警列表 +export function getRuleList() { + return request({ + url: 'rule/listPage', + method: 'get' + }) +} +export function getContentList(params) { + return request({ + url: 'maintain/contentByType', + method: 'get', + params: { + type: params + } + }) +} +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 编辑 +export function editRecord(params) { + return request({ + url: 'maintain/update', + method: 'post', + params + }) +} +// 新增 +export function addRecord(params) { + return request({ + url: 'maintain/add', + method: 'post', + params + }) +} +// 删除 +export function delRecord(id) { + return request({ + url: 'maintain/delete', + method: 'post', + params: { + id: id + } + }) +} diff --git a/src/api/system/statistics.js b/src/api/system/statistics.js new file mode 100644 index 0000000..b25efe9 --- /dev/null +++ b/src/api/system/statistics.js @@ -0,0 +1,23 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +// import qs from 'qs' + +// +export function countByToilet(params) { + return request({ + url: '/sanitation/toiletStatistic/jobStaticByToilet', + method: 'get', + params + }) +} + +export function countByDay(params) { + return request({ + url: '/sanitation/toiletStatistic/jobStaticByDate', + method: 'get', + params + }) +} + diff --git a/src/assets/global_images/icon-position.png b/src/assets/global_images/icon-position.png new file mode 100644 index 0000000..7444038 --- /dev/null +++ b/src/assets/global_images/icon-position.png Binary files differ diff --git a/src/assets/global_images/location_green.png b/src/assets/global_images/location_green.png new file mode 100644 index 0000000..aa8be65 --- /dev/null +++ b/src/assets/global_images/location_green.png Binary files differ diff --git a/src/assets/global_images/location_red.png b/src/assets/global_images/location_red.png new file mode 100644 index 0000000..2be8c3d --- /dev/null +++ b/src/assets/global_images/location_red.png Binary files differ diff --git a/src/assets/global_images/location_yellow.png b/src/assets/global_images/location_yellow.png new file mode 100644 index 0000000..5ab6f4d --- /dev/null +++ b/src/assets/global_images/location_yellow.png Binary files differ diff --git a/src/assets/global_images/toilet-position.png b/src/assets/global_images/toilet-position.png new file mode 100644 index 0000000..7db6d9a --- /dev/null +++ b/src/assets/global_images/toilet-position.png Binary files differ diff --git a/src/assets/global_images/toilet.png b/src/assets/global_images/toilet.png new file mode 100644 index 0000000..6d9fc05 --- /dev/null +++ b/src/assets/global_images/toilet.png Binary files differ diff --git a/src/assets/global_images/toiletPhoto.png b/src/assets/global_images/toiletPhoto.png new file mode 100644 index 0000000..15d08e2 --- /dev/null +++ b/src/assets/global_images/toiletPhoto.png Binary files differ diff --git a/src/components/DownloadTemplate/index.vue b/src/components/DownloadTemplate/index.vue index 8ded2cd..7807cac 100644 --- a/src/components/DownloadTemplate/index.vue +++ b/src/components/DownloadTemplate/index.vue @@ -47,8 +47,8 @@ diff --git a/src/components/NormalTable/index.vue b/src/components/NormalTable/index.vue index 5077bef..04d322d 100644 --- a/src/components/NormalTable/index.vue +++ b/src/components/NormalTable/index.vue @@ -79,7 +79,7 @@
-
+
Object.assign(obj, { [key]: this[key] }), {}), + on: events.reduce((obj, key) => Object.assign(obj, { [key]: this.transmitEvent }), {}) + }) + } + this.props = [...extraProps, ...props.filter(prop => exceptProps.indexOf(prop))] + } +} + +export default prop => new Mixin(prop) diff --git a/src/components/mapWindow/base/mixins/common.js b/src/components/mapWindow/base/mixins/common.js new file mode 100644 index 0000000..2fd1a28 --- /dev/null +++ b/src/components/mapWindow/base/mixins/common.js @@ -0,0 +1,82 @@ +const types = { + map: { + unload: 'clearMap' + }, + control: { + unload: 'removeControl' + }, + layer: { + unload: 'removeLayer' + }, + features: { + unload: 'removeFeatures' + }, + listener: { + unload: 'removeListener' + } +} + +const getParent = $component => ($component.abstract || $component.$el === $component.$children[0].$el) ? getParent($component.$parent) : $component + +function destroyInstance () { + const { unload, renderByParent, $parent } = this + if (renderByParent) { + $parent.reload() + } + unload() +} + +class Mixin { + constructor (prop) { + this.methods = { + ready () { + const $parent = getParent(this.$parent) + const map = this.map = $parent.map + this.load() + this.$emit('ready', { + map + }) + }, + transmitEvent (e) { + this.$emit(e.type.replace(/^on/, ''), e) + }, + reload () { + this && this.$nextTick(() => { + this.unload() + this.$nextTick(this.load) + }) + }, + unload () { + const { map, originInstance } = this + try { + switch (prop.type) { + case 'search': + return originInstance.clearResults() + case 'autoComplete': + case 'lushu': + return originInstance.dispose() + case 'markerClusterer': + return originInstance.clearMarkers() + default: + map[types[prop.type].unload](originInstance) + } + } catch (e) {} + } + } + this.computed = { + renderByParent () { + return this.$parent.preventChildrenRender + } + } + this.mounted = function () { + console.log('common mounted') + const $parent = getParent(this.$parent) + const map = $parent.map + const { ready } = this + console.log(map) + map ? ready() : $parent.$on('onload', ready) + } + } +} + +export default type => new Mixin({ type }) diff --git a/src/components/mapWindow/leafletMap.vue b/src/components/mapWindow/leafletMap.vue new file mode 100644 index 0000000..b753cc0 --- /dev/null +++ b/src/components/mapWindow/leafletMap.vue @@ -0,0 +1,143 @@ + + + + + + + diff --git a/src/components/mapWindow/mapWindow.vue b/src/components/mapWindow/mapWindow.vue new file mode 100644 index 0000000..9ced291 --- /dev/null +++ b/src/components/mapWindow/mapWindow.vue @@ -0,0 +1,46 @@ + + + + + + diff --git a/src/icons/svg/bridge.svg b/src/icons/svg/bridge.svg new file mode 100644 index 0000000..1a0336f --- /dev/null +++ b/src/icons/svg/bridge.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/icons/svg/toilet.svg b/src/icons/svg/toilet.svg new file mode 100644 index 0000000..9d8e765 --- /dev/null +++ b/src/icons/svg/toilet.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/main.js b/src/main.js index f2d105d..3e4074e 100644 --- a/src/main.js +++ b/src/main.js @@ -18,6 +18,9 @@ // echart // import echarts from 'echarts' // Vue.prototype.$echarts = echarts +// 引入v-charts +import VCharts from 'v-charts' +Vue.use(VCharts) // 将自动注册所有组件为全局组件 // import dataV from '@jiaminghi/data-view' @@ -35,9 +38,19 @@ Vue.component('search-item', SearchItem) // 加载leaflet的css +// import 'leaflet/dist/leaflet.css' +// import 'leaflet-draw/dist/leaflet.draw.css' +import L from 'leaflet' import 'leaflet/dist/leaflet.css' -import 'leaflet-draw/dist/leaflet.draw.css' +Vue.config.productionTip = false +Vue.L = Vue.prototype.$L = L +delete L.Icon.Default.prototype._getIconUrl +L.Icon.Default.mergeOptions({ + iconRetinaUrl: require('leaflet/dist/images/marker-icon-2x.png'), + iconUrl: require('leaflet/dist/images/marker-icon.png'), + shadowUrl: require('leaflet/dist/images/marker-shadow.png') +}) /** * This project originally used easy-mock to simulate data, * but its official service is very unstable, diff --git a/src/permission.js b/src/permission.js index dc6b2f8..809ca86 100644 --- a/src/permission.js +++ b/src/permission.js @@ -25,8 +25,8 @@ store.dispatch('GetInfo').then(res => { // 拉取用户信息 // 设置当前子系统为基础资源子系统 const currentSys = { - code: 'baseResourse', - name: '基础资源子系统' + code: 'toliet', + name: '公共厕所管理系统' } // 将当前系统信息保存在localStorage中 store.commit('SET_SYSTEM', currentSys) diff --git a/src/router/index.js b/src/router/index.js index 39c295c..d23076d 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -8,8 +8,11 @@ /* Layout */ import Layout from '@/layout/Layout' +import { toiletRouters } from './modules/toilet' +import { workRouters } from './modules/work' +import { statisticsRouters } from './modules/statistics' +import { ruleRouters } from './modules/rule' import { systemRouters } from './modules/system' -import { exampleRouters } from './modules/example' /** * hidden: true if `hidden:true` will not show in the sidebar(default is false) @@ -40,11 +43,12 @@ ] }, // 登录页面 - { path: '/login', component: () => import('@/views/login/index'), hidden: true }, + { path: '/login', component: () => import('@/views/login/index_2'), hidden: true }, // 404错误页面 { path: '/404', component: () => import('@/views/errorPage/404'), hidden: true }, // 401 错误页面 - { path: '/401', component: () => import('@/views/errorPage/401'), hidden: true } + { path: '/401', component: () => import('@/views/errorPage/401'), hidden: true }, + { path: '/', redirect: '/toiletList', hidden: true } ] // 实例化vue的时候直挂载constantRouter export default new Router({ @@ -56,7 +60,10 @@ // 异步挂载路由 // 动态需要根据权限加载的路由表 export const asyncRouterMap = [ - ...exampleRouters, - ...systemRouters, + ...toiletRouters, + ...workRouters, + ...statisticsRouters, + ...ruleRouters, + // ...systemRouters, { path: '*', redirect: '/404', hidden: true } ] diff --git a/src/router/modules/rule.js b/src/router/modules/rule.js new file mode 100644 index 0000000..51e0283 --- /dev/null +++ b/src/router/modules/rule.js @@ -0,0 +1,24 @@ +/* Layout */ +import Layout from '@/layout/Layout' + +export const ruleRouters = [ + { + path: 'rule', + component: Layout, + redirect: '/rule', + name: 'Rule', + meta: { + title: '规章制度', + icon: 'icon-config', // 图标 + permission: ['/rule']// 权限名称 + }, + children: [ + { + path: '/rule', + name: 'Rule', + component: () => import('@/views/rule/listRule'), + meta: { title: '规章制度', icon: 'function', permission: ['/rule'] } + } + ] + } +] diff --git a/src/router/modules/statistics.js b/src/router/modules/statistics.js new file mode 100644 index 0000000..fb9cbea --- /dev/null +++ b/src/router/modules/statistics.js @@ -0,0 +1,30 @@ +/* Layout */ +import Layout from '@/layout/Layout' + +export const statisticsRouters = [ + { + path: 'statisticsToilet', + component: Layout, + redirect: '/workStatistics', + name: 'StatisticsToilet', + meta: { + title: '作业统计', + icon: 'icon-config', // 图标 + permission: ['/statisticsToilet']// 权限名称 + }, + children: [ + { + path: '/workStatistics', + name: 'WorkStatistics', + component: () => import('@/views/statistics/toiletAssessment'), + meta: { title: '作业统计', icon: '', permission: ['/toilet/workStatistics'] } + }, + { + path: '/evaluationStatistics', + name: 'EvaluationStatistics', + component: () => import('@/views/statistics/evaluationAssessment'), + meta: { title: '评价统计', icon: '', permission: ['/toilet/evaluationStatistics'] } + } + ] + } +] diff --git a/src/router/modules/toilet.js b/src/router/modules/toilet.js new file mode 100644 index 0000000..b221a0e --- /dev/null +++ b/src/router/modules/toilet.js @@ -0,0 +1,30 @@ +/* Layout */ +import Layout from '@/layout/Layout' + +export const toiletRouters = [ + { + path: 'toiletManage', + component: Layout, + redirect: '/toiletManage', + name: 'ToiletManage', + meta: { + title: '公厕管理', + icon: 'icon-config', // 图标 + permission: ['/toiletManage']// 权限名称 + }, + children: [ + { + path: '/toiletList', + name: 'ToiletList', + component: () => import('@/views/toiletManage/toiletList'), + meta: { title: '公厕台帐管理', icon: 'function', permission: ['/toiletList'] } + }, + { + path: '/toiletMap', + name: 'ToiletMap', + component: () => import('@/views/overview/overview'), + meta: { title: '地图总览', icon: 'function', permission: ['/toiletMap'] } + } + ] + } +] diff --git a/src/router/modules/work.js b/src/router/modules/work.js new file mode 100644 index 0000000..5e0759f --- /dev/null +++ b/src/router/modules/work.js @@ -0,0 +1,24 @@ +/* Layout */ +import Layout from '@/layout/Layout' + +export const workRouters = [ + { + path: 'toiletWork', + component: Layout, + redirect: '/toiletManage', + name: 'toiletWork', + meta: { + title: '作业管理', + icon: 'icon-config', // 图标 + permission: ['/toiletWork']// 权限名称 + }, + children: [ + { + path: '/toiletWork', + name: 'ToiletWork', + component: () => import('@/views/toiletClean/toiletCleanList'), + meta: { title: '作业管理', icon: 'function', permission: ['/toiletWork'] } + } + ] + } +] diff --git a/src/settings.js b/src/settings.js index b568ce0..b8159bf 100644 --- a/src/settings.js +++ b/src/settings.js @@ -3,7 +3,7 @@ * @type {boolean} true | false * @description 是否显示设置按钮 */ - showSettings: true, + showSettings: false, /** * @type {boolean} true | false diff --git a/src/store/modules/permission.js b/src/store/modules/permission.js index a0cb8cf..3ab50d5 100644 --- a/src/store/modules/permission.js +++ b/src/store/modules/permission.js @@ -120,17 +120,23 @@ }) }, // 获取用户权限 - GetMenus({ commit, state }) { - console.log('in store.permission.js:GetMenus:') + GetMenus({ commit, state }, currentSystem) { + // console.log('in store.permission.js:GetMenus:') + console.log('获取' + currentSystem.name + '的菜单') + const params = { + parentCode: currentSystem.code // 传入该子系统的code,获取子系统的权限 + } return new Promise((resolve, reject) => { - getMenus(state.token).then(response => { // 处理返回值 + // 此处获取用户所有权限 + getMenus(params).then(response => { // 处理返回值 const data = response.data const menus = [] // 仅菜单 const btns = [] // 非菜单 if (data.menus && data.menus.length > 0) { - commit('SET_MENUS', data.menus) - for (const menu of data.menus) { // 遍历菜单,获取所有的权限项 - if (menu.ismenu === '1') { // 将是菜单的放入menus + const allmenus = [...data.menus] + commit('SET_MENUS', allmenus) + for (const menu of allmenus) { // 遍历菜单,获取所有的权限项 + if (menu.resourceType === '02' || menu.resourceType === '03') { // 将是菜单的放入menus const menu_tmp = {} menu_tmp.url = menu.url menu_tmp.icon = menu.icon @@ -142,11 +148,11 @@ btn_tmp.name = menu.name btn_tmp.icon = menu.icon btns.push(btn_tmp) - // console.log(menu.url) } } // 过滤路由表 - const accessedRouters = filterAsyncRouter(asyncRouterMap, menus) + let accessedRouters = filterAsyncRouter(asyncRouterMap, menus) + // accessedRouters = filterRedirect(accessedRouters) commit('SET_BTNS', btns) commit('SET_ROUTERS', accessedRouters) resolve(response) diff --git a/src/utils/baseConfig.js b/src/utils/baseConfig.js index 1f4fa38..999593e 100644 --- a/src/utils/baseConfig.js +++ b/src/utils/baseConfig.js @@ -1,5 +1,5 @@ const project = { - title: '后台管理系统前端基础框架' + title: '路桥养护子系统' } export function getProject() { return project diff --git a/src/utils/dateutils.js b/src/utils/dateutils.js index 868111a..5cd16af 100644 --- a/src/utils/dateutils.js +++ b/src/utils/dateutils.js @@ -15,15 +15,15 @@ return ct_month } -export function getLastWeek() { // 默认显示上周 +export function getLastWeek(fmt) { // 默认显示上周 const ct_month = new Date() ct_month.setTime(ct_month.getTime() - 3600 * 1000 * 24 * 7) - return ct_month + return ct_month.Format(fmt) } -export function getLastMonth() { // 默认显示上个月 +export function getLastMonth(fmt) { // 默认显示上个月 const ct_month = new Date() ct_month.setTime(ct_month.getTime() - 3600 * 1000 * 24 * 30) - return ct_month + return ct_month.Format(fmt) } // 对Date的扩展,将 Date 转化为指定格式的String diff --git a/src/utils/exportutils.js b/src/utils/exportutils.js new file mode 100644 index 0000000..b5d0bcf --- /dev/null +++ b/src/utils/exportutils.js @@ -0,0 +1,19 @@ +/** + * 导出文件工具 + * @param blob 文件 + * @param fileName 导出文件名 + */ +export function exportFile(blob, fileName) { + if (window.navigator && window.navigator.msSaveOrOpenBlob) { + navigator.msSaveBlob(blob, fileName) + } else { + const downloadElement = document.createElement('a') + const href = window.URL.createObjectURL(blob) // 创建下载的链接 + downloadElement.href = href + downloadElement.download = fileName + document.body.appendChild(downloadElement) + downloadElement.click() // 点击下载 + document.body.removeChild(downloadElement) // 下载完成移除元素 + window.URL.revokeObjectURL(href) // 释放blob对象 + } +} diff --git a/src/utils/request.js b/src/utils/request.js index c88ea76..dc56e26 100644 --- a/src/utils/request.js +++ b/src/utils/request.js @@ -17,6 +17,13 @@ config.headers['token'] = getToken() // 让每个请求携带自定义token 请根据实际情况自行修改 console.log(config.headers['token']) } + // 在接口增加时间戳 + // if (config.method === 'get') { + config.params = { + _t: Date.parse(new Date()) / 1000, + ...config.params + } + // } return config }, error => { diff --git a/src/views/mapViews/choosePointDialog.vue b/src/views/mapViews/choosePointDialog.vue new file mode 100644 index 0000000..c9dde8a --- /dev/null +++ b/src/views/mapViews/choosePointDialog.vue @@ -0,0 +1,105 @@ + + + + + diff --git a/src/views/mapViews/mapView.vue b/src/views/mapViews/mapView.vue new file mode 100644 index 0000000..a18db88 --- /dev/null +++ b/src/views/mapViews/mapView.vue @@ -0,0 +1,73 @@ + + + + + diff --git a/src/views/order/editOrder.vue b/src/views/order/editOrder.vue new file mode 100644 index 0000000..4a5fd8a --- /dev/null +++ b/src/views/order/editOrder.vue @@ -0,0 +1,319 @@ + + + + + diff --git a/src/views/order/listMaintainRecords.vue b/src/views/order/listMaintainRecords.vue new file mode 100644 index 0000000..2d4f682 --- /dev/null +++ b/src/views/order/listMaintainRecords.vue @@ -0,0 +1,327 @@ + + + + + diff --git a/src/views/overview/overview.vue b/src/views/overview/overview.vue new file mode 100644 index 0000000..9525867 --- /dev/null +++ b/src/views/overview/overview.vue @@ -0,0 +1,285 @@ + + + + + diff --git a/src/views/overview/toiletDetailDialog.vue b/src/views/overview/toiletDetailDialog.vue new file mode 100644 index 0000000..2b3a511 --- /dev/null +++ b/src/views/overview/toiletDetailDialog.vue @@ -0,0 +1,263 @@ + + + + + + diff --git a/src/views/overview/toiletLayer.vue b/src/views/overview/toiletLayer.vue new file mode 100644 index 0000000..d784323 --- /dev/null +++ b/src/views/overview/toiletLayer.vue @@ -0,0 +1,152 @@ + + + + + + diff --git a/src/views/rule/listRule.vue b/src/views/rule/listRule.vue new file mode 100644 index 0000000..a19b9e4 --- /dev/null +++ b/src/views/rule/listRule.vue @@ -0,0 +1,157 @@ + + + + + diff --git a/src/views/statistics/barChart.vue b/src/views/statistics/barChart.vue new file mode 100644 index 0000000..d10eb38 --- /dev/null +++ b/src/views/statistics/barChart.vue @@ -0,0 +1,65 @@ + + + + + diff --git a/src/views/statistics/components/evaluationListDialog.vue b/src/views/statistics/components/evaluationListDialog.vue new file mode 100644 index 0000000..1560772 --- /dev/null +++ b/src/views/statistics/components/evaluationListDialog.vue @@ -0,0 +1,100 @@ + + + + + + diff --git a/src/views/statistics/components/workChart.vue b/src/views/statistics/components/workChart.vue new file mode 100644 index 0000000..a891e0c --- /dev/null +++ b/src/views/statistics/components/workChart.vue @@ -0,0 +1,79 @@ + + + + + diff --git a/src/views/statistics/evaluationAssessment.vue b/src/views/statistics/evaluationAssessment.vue new file mode 100644 index 0000000..28dedc5 --- /dev/null +++ b/src/views/statistics/evaluationAssessment.vue @@ -0,0 +1,159 @@ + + + + + + diff --git a/src/views/statistics/pieChart.vue b/src/views/statistics/pieChart.vue new file mode 100644 index 0000000..e4dd287 --- /dev/null +++ b/src/views/statistics/pieChart.vue @@ -0,0 +1,58 @@ + + + + + diff --git a/src/views/statistics/statisticsChart.vue b/src/views/statistics/statisticsChart.vue new file mode 100644 index 0000000..2c48fe0 --- /dev/null +++ b/src/views/statistics/statisticsChart.vue @@ -0,0 +1,87 @@ + + + + + diff --git a/src/views/statistics/toiletAssessment.vue b/src/views/statistics/toiletAssessment.vue new file mode 100644 index 0000000..67aa32b --- /dev/null +++ b/src/views/statistics/toiletAssessment.vue @@ -0,0 +1,242 @@ + + + + + diff --git a/config/index.js b/config/index.js index 8abd37a..19b33b1 100644 --- a/config/index.js +++ b/config/index.js @@ -69,7 +69,7 @@ * then assetsPublicPath should be set to "/bar/". * In most cases please use '/' !!! */ - assetsPublicPath: '/', + assetsPublicPath: '/toilet/', /** * Source Maps diff --git a/package.json b/package.json index 45f055f..9f3a3eb 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "echarts": "^4.2.1", "element-ui": "2.13.0", "event-source-polyfill": "^1.0.5", + "file-saver": "^2.0.5", "js-cookie": "2.2.0", "jsencrypt": "^3.0.0-rc.1", "leaflet": "^1.7.1", @@ -33,7 +34,9 @@ "vue-amap": "^0.5.9", "vue-baidu-map": "^0.21.22", "vue-router": "3.0.1", - "vuex": "3.0.1" + "vue2-leaflet": "^2.7.0", + "vuex": "3.0.1", + "xlsx": "^0.17.0" }, "devDependencies": { "autoprefixer": "8.5.0", diff --git a/src/api/common.js b/src/api/common.js index 87c582b..7804714 100644 --- a/src/api/common.js +++ b/src/api/common.js @@ -2,10 +2,14 @@ * 常用接口 */ import request from '@/utils/request' +import Vue from 'vue' + // 模板下载 export function downloadTemplate(fileName) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath return request({ - url: 'template/download', + url: lampPath + 'template/download', method: 'get', params: { filename: fileName @@ -19,7 +23,7 @@ const param = new FormData() param.append('file', fileobj.file) return request({ - url: 'imageUpload', + url: 'fileUpload', method: 'post', headers: { 'Content-Type': 'multipart/form-data' }, data: param diff --git a/src/api/sanitation/statistics.js b/src/api/sanitation/statistics.js new file mode 100644 index 0000000..ffeac18 --- /dev/null +++ b/src/api/sanitation/statistics.js @@ -0,0 +1,22 @@ + +/** + * 考核统计接口 + */ +import request from '@/utils/request' +// 公厕保洁次数统计 +export function getToiletJobCount(params) { + return request({ + url: '/sanitation/statistic/toilet/jobCount', + method: 'get', + params + }) +} + +// 公厕评分统计 +export function getToiletEvaluation(params) { + return request({ + url: '/sanitation/toiletEvaluation/statistics', + method: 'get', + params + }) +} diff --git a/src/api/sanitation/toilet.js b/src/api/sanitation/toilet.js new file mode 100644 index 0000000..11affd4 --- /dev/null +++ b/src/api/sanitation/toilet.js @@ -0,0 +1,133 @@ +/** + * 公厕管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' +// 公厕查询 +export function getToiletListPage(params) { + return request({ + url: '/sanitation/toilet/listPage', + method: 'get', + params + }) +} +// 公厕查询 +export function getToiletList(pid) { + return request({ + url: '/sanitation/toilet/list', + method: 'get', + params: { + pid: pid + } + }) +} + +// 添加公厕 +export function addToilet(params) { + return request({ + url: '/sanitation/toilet/add', + method: 'post', + params + }) +} +// 修改公厕机构 +export function updateToilet(params) { + return request({ + url: '/sanitation/toilet/update', + method: 'post', + params + }) +} +// 删除公厕机构 +export function delToilet(ids) { + return request({ + url: '/sanitation/toilet/delete', + method: 'post', + params: { + ids + }, + paramsSerializer: params => { + return qs.stringify(params, { indices: false }) + } + }) +} + +// 公厕基本信息详情 +export function getToiletInfoDetail(id) { + return request({ + url: '/sanitation/toilet/detail?toiletId=' + id, + method: 'get' + }) +} + +// 某公厕保洁记录 +export function getRecordsByToilet(params) { + return request({ + url: '/sanitation/toilet/jobRecord/detail', + method: 'get', + params + }) +} + +// 某公厕平均评分 +export function getScoreByToilet(params) { + return request({ + url: '/sanitation/toiletEvaluation/detailScore', + method: 'get', + params + }) +} + +// 某公厕评分列表 +export function getScoreListByToilet(params) { + return request({ + url: '/sanitation/toiletEvaluation/list', + method: 'get', + params + }) +} + + +// 批量导入 +export function batchImportToilet(fileobj) { + const param = new FormData() + param.append('file', fileobj) + return request({ + url: '/sanitation/toilet/import', + method: 'post', + headers: { 'Content-Type': 'multipart/form-data' }, + data: param + }) +} +// 批量导出 +export function batchExportToilet(params, config) { + return request({ + url: '/sanitation/toilet/export', + method: 'get', + timeout: 120000, + params, + ...config, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 公厕保洁记录查询 +export function getToiletJobRecords(params) { + return request({ + url: '/sanitation/toilet/jobRecord', + method: 'get', + params + }) +} + +// 批量导出 +export function batchExportToiletJobRecords(params, config) { + return request({ + url: '/sanitation/toilet/exportJobRecord', + method: 'get', + timeout: 120000, + params, + ...config, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} diff --git a/src/api/system/alarm.js b/src/api/system/alarm.js new file mode 100644 index 0000000..1c3a7ab --- /dev/null +++ b/src/api/system/alarm.js @@ -0,0 +1,62 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' + +// 获取当前报警列表 +export function getAlarmNowList(params) { + return request({ + url: '/alarm/listNowPage', + method: 'get', + params + }) +} + +// 获取当前报警列表 +export function getAlarmHistoryList(params) { + return request({ + url: '/alarm/listHisPage', + method: 'get', + params + }) +} + + +// 批量消警 +export function clearAll(params) { + return request({ + url: '/alarm/allClear', + method: 'get', + params + }) +} + +// 消警 +export function clearAlarm(params) { + return request({ + url: '/alarm/cancel', + method: 'get', + params + }) +} + +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 设置报警阈值 +export function setThresh(params) { + return request({ + url: '/alarm/resetAlarmRule', + method: 'post', + params + }) +} diff --git a/src/api/system/bridge.js b/src/api/system/bridge.js new file mode 100644 index 0000000..e8a4108 --- /dev/null +++ b/src/api/system/bridge.js @@ -0,0 +1,80 @@ +/** + * 桥梁管理接口 + */ +import request from '@/utils/request' + +// 获取桥梁详情 +export function getDetail(id) { + return request({ + url: '/bridge/detail', + method: 'get', + params: { + id: id + } + }) +} + +export function updateBridge(params) { + return request({ + url: '/bridge/update', + method: 'post', + params + }) +} +// 批量导出 +export function exportRecords(params) { + return request({ + url: 'device/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +export function getContentList(params) { + return request({ + url: 'maintain/contentByType', + method: 'get', + params: { + type: params + } + }) +} +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 编辑 +export function editRecord(params) { + return request({ + url: 'maintain/update', + method: 'post', + params + }) +} +// 新增 +export function addRecord(params) { + return request({ + url: 'maintain/add', + method: 'post', + params + }) +} +// 删除 +export function delRecord(id) { + return request({ + url: 'maintain/delete', + method: 'post', + params: { + id: id + } + }) +} diff --git a/src/api/system/data.js b/src/api/system/data.js new file mode 100644 index 0000000..4c95db5 --- /dev/null +++ b/src/api/system/data.js @@ -0,0 +1,63 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' + +// 获取当前报警列表 +export function getHistoryList(params) { + return request({ + url: '/data/hisListPage', + method: 'get', + params + }) +} + +// 获取当前报警列表 +export function getHistory(params) { + return request({ + url: '/data/hisList', + method: 'get', + params + }) +} + + + +// 批量消警 +export function clearAll(params) { + return request({ + url: '/alarm/allClear', + method: 'get', + params + }) +} + +// 消警 +export function clearAlarm(params) { + return request({ + url: '/alarm/cancel', + method: 'get', + params + }) +} + +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 设置报警阈值 +export function setThresh(params) { + return request({ + url: '/alarm/resetAlarmRule', + method: 'post', + params + }) +} diff --git a/src/api/system/order.js b/src/api/system/order.js new file mode 100644 index 0000000..7007c50 --- /dev/null +++ b/src/api/system/order.js @@ -0,0 +1,71 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +// import qs from 'qs' + +// 获取当前报警列表 +export function getRecordList(params) { + return request({ + url: '/maintain/listPage', + method: 'get', + params + }) +} +// 批量导出 +export function exportRecords(params) { + return request({ + url: 'device/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +export function getContentList(params) { + return request({ + url: 'maintain/contentByType', + method: 'get', + params: { + type: params + } + }) +} +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 编辑 +export function editRecord(params) { + return request({ + url: 'maintain/update', + method: 'post', + params + }) +} +// 新增 +export function addRecord(params) { + return request({ + url: 'maintain/add', + method: 'post', + params + }) +} +// 删除 +export function delRecord(id) { + return request({ + url: 'maintain/delete', + method: 'post', + params: { + bridgeMaintenanceId: id + } + }) +} diff --git a/src/api/system/overview.js b/src/api/system/overview.js new file mode 100644 index 0000000..bca50cc --- /dev/null +++ b/src/api/system/overview.js @@ -0,0 +1,109 @@ +import request from '@/utils/request' +import qs from "qs" +import Vue from 'vue' + +// 路灯状态统计 +export function getLampStatus() { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampStatus', + method: 'get' + }) +} + +// 路灯总览列表 +export function getLampList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampList', + method: 'get', + params + }) +} + +// 路灯详情 +export function getlampDetail(lampId) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampDetail', + method: 'get', + params: { + lampId: lampId + } + }) +} + +// 回路列表 +export function getCircuitList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/circuitList', + method: 'get', + params + }) +} + +// 灯箱列表 +export function getLampBoxList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampBoxList', + method: 'get', + params + }) +} +// 灯箱详情 +export function getLampBoxDetail(lampBoxId) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampBoxDetail', + method: 'get', + params: { + lampBoxId: lampBoxId + } + }) +} + +// 报警总览列表 +export function getAlarmList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/alarmList', + method: 'get', + params + }) +} + +// 报警详情 +export function getAlarmDetail(alarmId) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/alarmDetail', + method: 'get', + params: { + alarmId: alarmId + } + }) +} + +// 路灯控制 +export function lampControl(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampControl', + method: 'post', + params, + paramsSerializer: params => { + return qs.stringify(params, { indices: false }) + } + }) +} diff --git a/src/api/system/rule.js b/src/api/system/rule.js new file mode 100644 index 0000000..76c6b2d --- /dev/null +++ b/src/api/system/rule.js @@ -0,0 +1,59 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +// import qs from 'qs' + +// 获取当前报警列表 +export function getRuleList() { + return request({ + url: 'rule/listPage', + method: 'get' + }) +} +export function getContentList(params) { + return request({ + url: 'maintain/contentByType', + method: 'get', + params: { + type: params + } + }) +} +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 编辑 +export function editRecord(params) { + return request({ + url: 'maintain/update', + method: 'post', + params + }) +} +// 新增 +export function addRecord(params) { + return request({ + url: 'maintain/add', + method: 'post', + params + }) +} +// 删除 +export function delRecord(id) { + return request({ + url: 'maintain/delete', + method: 'post', + params: { + id: id + } + }) +} diff --git a/src/api/system/statistics.js b/src/api/system/statistics.js new file mode 100644 index 0000000..b25efe9 --- /dev/null +++ b/src/api/system/statistics.js @@ -0,0 +1,23 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +// import qs from 'qs' + +// +export function countByToilet(params) { + return request({ + url: '/sanitation/toiletStatistic/jobStaticByToilet', + method: 'get', + params + }) +} + +export function countByDay(params) { + return request({ + url: '/sanitation/toiletStatistic/jobStaticByDate', + method: 'get', + params + }) +} + diff --git a/src/assets/global_images/icon-position.png b/src/assets/global_images/icon-position.png new file mode 100644 index 0000000..7444038 --- /dev/null +++ b/src/assets/global_images/icon-position.png Binary files differ diff --git a/src/assets/global_images/location_green.png b/src/assets/global_images/location_green.png new file mode 100644 index 0000000..aa8be65 --- /dev/null +++ b/src/assets/global_images/location_green.png Binary files differ diff --git a/src/assets/global_images/location_red.png b/src/assets/global_images/location_red.png new file mode 100644 index 0000000..2be8c3d --- /dev/null +++ b/src/assets/global_images/location_red.png Binary files differ diff --git a/src/assets/global_images/location_yellow.png b/src/assets/global_images/location_yellow.png new file mode 100644 index 0000000..5ab6f4d --- /dev/null +++ b/src/assets/global_images/location_yellow.png Binary files differ diff --git a/src/assets/global_images/toilet-position.png b/src/assets/global_images/toilet-position.png new file mode 100644 index 0000000..7db6d9a --- /dev/null +++ b/src/assets/global_images/toilet-position.png Binary files differ diff --git a/src/assets/global_images/toilet.png b/src/assets/global_images/toilet.png new file mode 100644 index 0000000..6d9fc05 --- /dev/null +++ b/src/assets/global_images/toilet.png Binary files differ diff --git a/src/assets/global_images/toiletPhoto.png b/src/assets/global_images/toiletPhoto.png new file mode 100644 index 0000000..15d08e2 --- /dev/null +++ b/src/assets/global_images/toiletPhoto.png Binary files differ diff --git a/src/components/DownloadTemplate/index.vue b/src/components/DownloadTemplate/index.vue index 8ded2cd..7807cac 100644 --- a/src/components/DownloadTemplate/index.vue +++ b/src/components/DownloadTemplate/index.vue @@ -47,8 +47,8 @@ diff --git a/src/components/NormalTable/index.vue b/src/components/NormalTable/index.vue index 5077bef..04d322d 100644 --- a/src/components/NormalTable/index.vue +++ b/src/components/NormalTable/index.vue @@ -79,7 +79,7 @@
-
+
Object.assign(obj, { [key]: this[key] }), {}), + on: events.reduce((obj, key) => Object.assign(obj, { [key]: this.transmitEvent }), {}) + }) + } + this.props = [...extraProps, ...props.filter(prop => exceptProps.indexOf(prop))] + } +} + +export default prop => new Mixin(prop) diff --git a/src/components/mapWindow/base/mixins/common.js b/src/components/mapWindow/base/mixins/common.js new file mode 100644 index 0000000..2fd1a28 --- /dev/null +++ b/src/components/mapWindow/base/mixins/common.js @@ -0,0 +1,82 @@ +const types = { + map: { + unload: 'clearMap' + }, + control: { + unload: 'removeControl' + }, + layer: { + unload: 'removeLayer' + }, + features: { + unload: 'removeFeatures' + }, + listener: { + unload: 'removeListener' + } +} + +const getParent = $component => ($component.abstract || $component.$el === $component.$children[0].$el) ? getParent($component.$parent) : $component + +function destroyInstance () { + const { unload, renderByParent, $parent } = this + if (renderByParent) { + $parent.reload() + } + unload() +} + +class Mixin { + constructor (prop) { + this.methods = { + ready () { + const $parent = getParent(this.$parent) + const map = this.map = $parent.map + this.load() + this.$emit('ready', { + map + }) + }, + transmitEvent (e) { + this.$emit(e.type.replace(/^on/, ''), e) + }, + reload () { + this && this.$nextTick(() => { + this.unload() + this.$nextTick(this.load) + }) + }, + unload () { + const { map, originInstance } = this + try { + switch (prop.type) { + case 'search': + return originInstance.clearResults() + case 'autoComplete': + case 'lushu': + return originInstance.dispose() + case 'markerClusterer': + return originInstance.clearMarkers() + default: + map[types[prop.type].unload](originInstance) + } + } catch (e) {} + } + } + this.computed = { + renderByParent () { + return this.$parent.preventChildrenRender + } + } + this.mounted = function () { + console.log('common mounted') + const $parent = getParent(this.$parent) + const map = $parent.map + const { ready } = this + console.log(map) + map ? ready() : $parent.$on('onload', ready) + } + } +} + +export default type => new Mixin({ type }) diff --git a/src/components/mapWindow/leafletMap.vue b/src/components/mapWindow/leafletMap.vue new file mode 100644 index 0000000..b753cc0 --- /dev/null +++ b/src/components/mapWindow/leafletMap.vue @@ -0,0 +1,143 @@ + + + + + + + diff --git a/src/components/mapWindow/mapWindow.vue b/src/components/mapWindow/mapWindow.vue new file mode 100644 index 0000000..9ced291 --- /dev/null +++ b/src/components/mapWindow/mapWindow.vue @@ -0,0 +1,46 @@ + + + + + + diff --git a/src/icons/svg/bridge.svg b/src/icons/svg/bridge.svg new file mode 100644 index 0000000..1a0336f --- /dev/null +++ b/src/icons/svg/bridge.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/icons/svg/toilet.svg b/src/icons/svg/toilet.svg new file mode 100644 index 0000000..9d8e765 --- /dev/null +++ b/src/icons/svg/toilet.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/main.js b/src/main.js index f2d105d..3e4074e 100644 --- a/src/main.js +++ b/src/main.js @@ -18,6 +18,9 @@ // echart // import echarts from 'echarts' // Vue.prototype.$echarts = echarts +// 引入v-charts +import VCharts from 'v-charts' +Vue.use(VCharts) // 将自动注册所有组件为全局组件 // import dataV from '@jiaminghi/data-view' @@ -35,9 +38,19 @@ Vue.component('search-item', SearchItem) // 加载leaflet的css +// import 'leaflet/dist/leaflet.css' +// import 'leaflet-draw/dist/leaflet.draw.css' +import L from 'leaflet' import 'leaflet/dist/leaflet.css' -import 'leaflet-draw/dist/leaflet.draw.css' +Vue.config.productionTip = false +Vue.L = Vue.prototype.$L = L +delete L.Icon.Default.prototype._getIconUrl +L.Icon.Default.mergeOptions({ + iconRetinaUrl: require('leaflet/dist/images/marker-icon-2x.png'), + iconUrl: require('leaflet/dist/images/marker-icon.png'), + shadowUrl: require('leaflet/dist/images/marker-shadow.png') +}) /** * This project originally used easy-mock to simulate data, * but its official service is very unstable, diff --git a/src/permission.js b/src/permission.js index dc6b2f8..809ca86 100644 --- a/src/permission.js +++ b/src/permission.js @@ -25,8 +25,8 @@ store.dispatch('GetInfo').then(res => { // 拉取用户信息 // 设置当前子系统为基础资源子系统 const currentSys = { - code: 'baseResourse', - name: '基础资源子系统' + code: 'toliet', + name: '公共厕所管理系统' } // 将当前系统信息保存在localStorage中 store.commit('SET_SYSTEM', currentSys) diff --git a/src/router/index.js b/src/router/index.js index 39c295c..d23076d 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -8,8 +8,11 @@ /* Layout */ import Layout from '@/layout/Layout' +import { toiletRouters } from './modules/toilet' +import { workRouters } from './modules/work' +import { statisticsRouters } from './modules/statistics' +import { ruleRouters } from './modules/rule' import { systemRouters } from './modules/system' -import { exampleRouters } from './modules/example' /** * hidden: true if `hidden:true` will not show in the sidebar(default is false) @@ -40,11 +43,12 @@ ] }, // 登录页面 - { path: '/login', component: () => import('@/views/login/index'), hidden: true }, + { path: '/login', component: () => import('@/views/login/index_2'), hidden: true }, // 404错误页面 { path: '/404', component: () => import('@/views/errorPage/404'), hidden: true }, // 401 错误页面 - { path: '/401', component: () => import('@/views/errorPage/401'), hidden: true } + { path: '/401', component: () => import('@/views/errorPage/401'), hidden: true }, + { path: '/', redirect: '/toiletList', hidden: true } ] // 实例化vue的时候直挂载constantRouter export default new Router({ @@ -56,7 +60,10 @@ // 异步挂载路由 // 动态需要根据权限加载的路由表 export const asyncRouterMap = [ - ...exampleRouters, - ...systemRouters, + ...toiletRouters, + ...workRouters, + ...statisticsRouters, + ...ruleRouters, + // ...systemRouters, { path: '*', redirect: '/404', hidden: true } ] diff --git a/src/router/modules/rule.js b/src/router/modules/rule.js new file mode 100644 index 0000000..51e0283 --- /dev/null +++ b/src/router/modules/rule.js @@ -0,0 +1,24 @@ +/* Layout */ +import Layout from '@/layout/Layout' + +export const ruleRouters = [ + { + path: 'rule', + component: Layout, + redirect: '/rule', + name: 'Rule', + meta: { + title: '规章制度', + icon: 'icon-config', // 图标 + permission: ['/rule']// 权限名称 + }, + children: [ + { + path: '/rule', + name: 'Rule', + component: () => import('@/views/rule/listRule'), + meta: { title: '规章制度', icon: 'function', permission: ['/rule'] } + } + ] + } +] diff --git a/src/router/modules/statistics.js b/src/router/modules/statistics.js new file mode 100644 index 0000000..fb9cbea --- /dev/null +++ b/src/router/modules/statistics.js @@ -0,0 +1,30 @@ +/* Layout */ +import Layout from '@/layout/Layout' + +export const statisticsRouters = [ + { + path: 'statisticsToilet', + component: Layout, + redirect: '/workStatistics', + name: 'StatisticsToilet', + meta: { + title: '作业统计', + icon: 'icon-config', // 图标 + permission: ['/statisticsToilet']// 权限名称 + }, + children: [ + { + path: '/workStatistics', + name: 'WorkStatistics', + component: () => import('@/views/statistics/toiletAssessment'), + meta: { title: '作业统计', icon: '', permission: ['/toilet/workStatistics'] } + }, + { + path: '/evaluationStatistics', + name: 'EvaluationStatistics', + component: () => import('@/views/statistics/evaluationAssessment'), + meta: { title: '评价统计', icon: '', permission: ['/toilet/evaluationStatistics'] } + } + ] + } +] diff --git a/src/router/modules/toilet.js b/src/router/modules/toilet.js new file mode 100644 index 0000000..b221a0e --- /dev/null +++ b/src/router/modules/toilet.js @@ -0,0 +1,30 @@ +/* Layout */ +import Layout from '@/layout/Layout' + +export const toiletRouters = [ + { + path: 'toiletManage', + component: Layout, + redirect: '/toiletManage', + name: 'ToiletManage', + meta: { + title: '公厕管理', + icon: 'icon-config', // 图标 + permission: ['/toiletManage']// 权限名称 + }, + children: [ + { + path: '/toiletList', + name: 'ToiletList', + component: () => import('@/views/toiletManage/toiletList'), + meta: { title: '公厕台帐管理', icon: 'function', permission: ['/toiletList'] } + }, + { + path: '/toiletMap', + name: 'ToiletMap', + component: () => import('@/views/overview/overview'), + meta: { title: '地图总览', icon: 'function', permission: ['/toiletMap'] } + } + ] + } +] diff --git a/src/router/modules/work.js b/src/router/modules/work.js new file mode 100644 index 0000000..5e0759f --- /dev/null +++ b/src/router/modules/work.js @@ -0,0 +1,24 @@ +/* Layout */ +import Layout from '@/layout/Layout' + +export const workRouters = [ + { + path: 'toiletWork', + component: Layout, + redirect: '/toiletManage', + name: 'toiletWork', + meta: { + title: '作业管理', + icon: 'icon-config', // 图标 + permission: ['/toiletWork']// 权限名称 + }, + children: [ + { + path: '/toiletWork', + name: 'ToiletWork', + component: () => import('@/views/toiletClean/toiletCleanList'), + meta: { title: '作业管理', icon: 'function', permission: ['/toiletWork'] } + } + ] + } +] diff --git a/src/settings.js b/src/settings.js index b568ce0..b8159bf 100644 --- a/src/settings.js +++ b/src/settings.js @@ -3,7 +3,7 @@ * @type {boolean} true | false * @description 是否显示设置按钮 */ - showSettings: true, + showSettings: false, /** * @type {boolean} true | false diff --git a/src/store/modules/permission.js b/src/store/modules/permission.js index a0cb8cf..3ab50d5 100644 --- a/src/store/modules/permission.js +++ b/src/store/modules/permission.js @@ -120,17 +120,23 @@ }) }, // 获取用户权限 - GetMenus({ commit, state }) { - console.log('in store.permission.js:GetMenus:') + GetMenus({ commit, state }, currentSystem) { + // console.log('in store.permission.js:GetMenus:') + console.log('获取' + currentSystem.name + '的菜单') + const params = { + parentCode: currentSystem.code // 传入该子系统的code,获取子系统的权限 + } return new Promise((resolve, reject) => { - getMenus(state.token).then(response => { // 处理返回值 + // 此处获取用户所有权限 + getMenus(params).then(response => { // 处理返回值 const data = response.data const menus = [] // 仅菜单 const btns = [] // 非菜单 if (data.menus && data.menus.length > 0) { - commit('SET_MENUS', data.menus) - for (const menu of data.menus) { // 遍历菜单,获取所有的权限项 - if (menu.ismenu === '1') { // 将是菜单的放入menus + const allmenus = [...data.menus] + commit('SET_MENUS', allmenus) + for (const menu of allmenus) { // 遍历菜单,获取所有的权限项 + if (menu.resourceType === '02' || menu.resourceType === '03') { // 将是菜单的放入menus const menu_tmp = {} menu_tmp.url = menu.url menu_tmp.icon = menu.icon @@ -142,11 +148,11 @@ btn_tmp.name = menu.name btn_tmp.icon = menu.icon btns.push(btn_tmp) - // console.log(menu.url) } } // 过滤路由表 - const accessedRouters = filterAsyncRouter(asyncRouterMap, menus) + let accessedRouters = filterAsyncRouter(asyncRouterMap, menus) + // accessedRouters = filterRedirect(accessedRouters) commit('SET_BTNS', btns) commit('SET_ROUTERS', accessedRouters) resolve(response) diff --git a/src/utils/baseConfig.js b/src/utils/baseConfig.js index 1f4fa38..999593e 100644 --- a/src/utils/baseConfig.js +++ b/src/utils/baseConfig.js @@ -1,5 +1,5 @@ const project = { - title: '后台管理系统前端基础框架' + title: '路桥养护子系统' } export function getProject() { return project diff --git a/src/utils/dateutils.js b/src/utils/dateutils.js index 868111a..5cd16af 100644 --- a/src/utils/dateutils.js +++ b/src/utils/dateutils.js @@ -15,15 +15,15 @@ return ct_month } -export function getLastWeek() { // 默认显示上周 +export function getLastWeek(fmt) { // 默认显示上周 const ct_month = new Date() ct_month.setTime(ct_month.getTime() - 3600 * 1000 * 24 * 7) - return ct_month + return ct_month.Format(fmt) } -export function getLastMonth() { // 默认显示上个月 +export function getLastMonth(fmt) { // 默认显示上个月 const ct_month = new Date() ct_month.setTime(ct_month.getTime() - 3600 * 1000 * 24 * 30) - return ct_month + return ct_month.Format(fmt) } // 对Date的扩展,将 Date 转化为指定格式的String diff --git a/src/utils/exportutils.js b/src/utils/exportutils.js new file mode 100644 index 0000000..b5d0bcf --- /dev/null +++ b/src/utils/exportutils.js @@ -0,0 +1,19 @@ +/** + * 导出文件工具 + * @param blob 文件 + * @param fileName 导出文件名 + */ +export function exportFile(blob, fileName) { + if (window.navigator && window.navigator.msSaveOrOpenBlob) { + navigator.msSaveBlob(blob, fileName) + } else { + const downloadElement = document.createElement('a') + const href = window.URL.createObjectURL(blob) // 创建下载的链接 + downloadElement.href = href + downloadElement.download = fileName + document.body.appendChild(downloadElement) + downloadElement.click() // 点击下载 + document.body.removeChild(downloadElement) // 下载完成移除元素 + window.URL.revokeObjectURL(href) // 释放blob对象 + } +} diff --git a/src/utils/request.js b/src/utils/request.js index c88ea76..dc56e26 100644 --- a/src/utils/request.js +++ b/src/utils/request.js @@ -17,6 +17,13 @@ config.headers['token'] = getToken() // 让每个请求携带自定义token 请根据实际情况自行修改 console.log(config.headers['token']) } + // 在接口增加时间戳 + // if (config.method === 'get') { + config.params = { + _t: Date.parse(new Date()) / 1000, + ...config.params + } + // } return config }, error => { diff --git a/src/views/mapViews/choosePointDialog.vue b/src/views/mapViews/choosePointDialog.vue new file mode 100644 index 0000000..c9dde8a --- /dev/null +++ b/src/views/mapViews/choosePointDialog.vue @@ -0,0 +1,105 @@ + + + + + diff --git a/src/views/mapViews/mapView.vue b/src/views/mapViews/mapView.vue new file mode 100644 index 0000000..a18db88 --- /dev/null +++ b/src/views/mapViews/mapView.vue @@ -0,0 +1,73 @@ + + + + + diff --git a/src/views/order/editOrder.vue b/src/views/order/editOrder.vue new file mode 100644 index 0000000..4a5fd8a --- /dev/null +++ b/src/views/order/editOrder.vue @@ -0,0 +1,319 @@ + + + + + diff --git a/src/views/order/listMaintainRecords.vue b/src/views/order/listMaintainRecords.vue new file mode 100644 index 0000000..2d4f682 --- /dev/null +++ b/src/views/order/listMaintainRecords.vue @@ -0,0 +1,327 @@ + + + + + diff --git a/src/views/overview/overview.vue b/src/views/overview/overview.vue new file mode 100644 index 0000000..9525867 --- /dev/null +++ b/src/views/overview/overview.vue @@ -0,0 +1,285 @@ + + + + + diff --git a/src/views/overview/toiletDetailDialog.vue b/src/views/overview/toiletDetailDialog.vue new file mode 100644 index 0000000..2b3a511 --- /dev/null +++ b/src/views/overview/toiletDetailDialog.vue @@ -0,0 +1,263 @@ + + + + + + diff --git a/src/views/overview/toiletLayer.vue b/src/views/overview/toiletLayer.vue new file mode 100644 index 0000000..d784323 --- /dev/null +++ b/src/views/overview/toiletLayer.vue @@ -0,0 +1,152 @@ + + + + + + diff --git a/src/views/rule/listRule.vue b/src/views/rule/listRule.vue new file mode 100644 index 0000000..a19b9e4 --- /dev/null +++ b/src/views/rule/listRule.vue @@ -0,0 +1,157 @@ + + + + + diff --git a/src/views/statistics/barChart.vue b/src/views/statistics/barChart.vue new file mode 100644 index 0000000..d10eb38 --- /dev/null +++ b/src/views/statistics/barChart.vue @@ -0,0 +1,65 @@ + + + + + diff --git a/src/views/statistics/components/evaluationListDialog.vue b/src/views/statistics/components/evaluationListDialog.vue new file mode 100644 index 0000000..1560772 --- /dev/null +++ b/src/views/statistics/components/evaluationListDialog.vue @@ -0,0 +1,100 @@ + + + + + + diff --git a/src/views/statistics/components/workChart.vue b/src/views/statistics/components/workChart.vue new file mode 100644 index 0000000..a891e0c --- /dev/null +++ b/src/views/statistics/components/workChart.vue @@ -0,0 +1,79 @@ + + + + + diff --git a/src/views/statistics/evaluationAssessment.vue b/src/views/statistics/evaluationAssessment.vue new file mode 100644 index 0000000..28dedc5 --- /dev/null +++ b/src/views/statistics/evaluationAssessment.vue @@ -0,0 +1,159 @@ + + + + + + diff --git a/src/views/statistics/pieChart.vue b/src/views/statistics/pieChart.vue new file mode 100644 index 0000000..e4dd287 --- /dev/null +++ b/src/views/statistics/pieChart.vue @@ -0,0 +1,58 @@ + + + + + diff --git a/src/views/statistics/statisticsChart.vue b/src/views/statistics/statisticsChart.vue new file mode 100644 index 0000000..2c48fe0 --- /dev/null +++ b/src/views/statistics/statisticsChart.vue @@ -0,0 +1,87 @@ + + + + + diff --git a/src/views/statistics/toiletAssessment.vue b/src/views/statistics/toiletAssessment.vue new file mode 100644 index 0000000..67aa32b --- /dev/null +++ b/src/views/statistics/toiletAssessment.vue @@ -0,0 +1,242 @@ + + + + + diff --git a/src/views/statistics/workStatistics.vue b/src/views/statistics/workStatistics.vue new file mode 100644 index 0000000..50a07f2 --- /dev/null +++ b/src/views/statistics/workStatistics.vue @@ -0,0 +1,191 @@ + + + + + diff --git a/config/index.js b/config/index.js index 8abd37a..19b33b1 100644 --- a/config/index.js +++ b/config/index.js @@ -69,7 +69,7 @@ * then assetsPublicPath should be set to "/bar/". * In most cases please use '/' !!! */ - assetsPublicPath: '/', + assetsPublicPath: '/toilet/', /** * Source Maps diff --git a/package.json b/package.json index 45f055f..9f3a3eb 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "echarts": "^4.2.1", "element-ui": "2.13.0", "event-source-polyfill": "^1.0.5", + "file-saver": "^2.0.5", "js-cookie": "2.2.0", "jsencrypt": "^3.0.0-rc.1", "leaflet": "^1.7.1", @@ -33,7 +34,9 @@ "vue-amap": "^0.5.9", "vue-baidu-map": "^0.21.22", "vue-router": "3.0.1", - "vuex": "3.0.1" + "vue2-leaflet": "^2.7.0", + "vuex": "3.0.1", + "xlsx": "^0.17.0" }, "devDependencies": { "autoprefixer": "8.5.0", diff --git a/src/api/common.js b/src/api/common.js index 87c582b..7804714 100644 --- a/src/api/common.js +++ b/src/api/common.js @@ -2,10 +2,14 @@ * 常用接口 */ import request from '@/utils/request' +import Vue from 'vue' + // 模板下载 export function downloadTemplate(fileName) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath return request({ - url: 'template/download', + url: lampPath + 'template/download', method: 'get', params: { filename: fileName @@ -19,7 +23,7 @@ const param = new FormData() param.append('file', fileobj.file) return request({ - url: 'imageUpload', + url: 'fileUpload', method: 'post', headers: { 'Content-Type': 'multipart/form-data' }, data: param diff --git a/src/api/sanitation/statistics.js b/src/api/sanitation/statistics.js new file mode 100644 index 0000000..ffeac18 --- /dev/null +++ b/src/api/sanitation/statistics.js @@ -0,0 +1,22 @@ + +/** + * 考核统计接口 + */ +import request from '@/utils/request' +// 公厕保洁次数统计 +export function getToiletJobCount(params) { + return request({ + url: '/sanitation/statistic/toilet/jobCount', + method: 'get', + params + }) +} + +// 公厕评分统计 +export function getToiletEvaluation(params) { + return request({ + url: '/sanitation/toiletEvaluation/statistics', + method: 'get', + params + }) +} diff --git a/src/api/sanitation/toilet.js b/src/api/sanitation/toilet.js new file mode 100644 index 0000000..11affd4 --- /dev/null +++ b/src/api/sanitation/toilet.js @@ -0,0 +1,133 @@ +/** + * 公厕管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' +// 公厕查询 +export function getToiletListPage(params) { + return request({ + url: '/sanitation/toilet/listPage', + method: 'get', + params + }) +} +// 公厕查询 +export function getToiletList(pid) { + return request({ + url: '/sanitation/toilet/list', + method: 'get', + params: { + pid: pid + } + }) +} + +// 添加公厕 +export function addToilet(params) { + return request({ + url: '/sanitation/toilet/add', + method: 'post', + params + }) +} +// 修改公厕机构 +export function updateToilet(params) { + return request({ + url: '/sanitation/toilet/update', + method: 'post', + params + }) +} +// 删除公厕机构 +export function delToilet(ids) { + return request({ + url: '/sanitation/toilet/delete', + method: 'post', + params: { + ids + }, + paramsSerializer: params => { + return qs.stringify(params, { indices: false }) + } + }) +} + +// 公厕基本信息详情 +export function getToiletInfoDetail(id) { + return request({ + url: '/sanitation/toilet/detail?toiletId=' + id, + method: 'get' + }) +} + +// 某公厕保洁记录 +export function getRecordsByToilet(params) { + return request({ + url: '/sanitation/toilet/jobRecord/detail', + method: 'get', + params + }) +} + +// 某公厕平均评分 +export function getScoreByToilet(params) { + return request({ + url: '/sanitation/toiletEvaluation/detailScore', + method: 'get', + params + }) +} + +// 某公厕评分列表 +export function getScoreListByToilet(params) { + return request({ + url: '/sanitation/toiletEvaluation/list', + method: 'get', + params + }) +} + + +// 批量导入 +export function batchImportToilet(fileobj) { + const param = new FormData() + param.append('file', fileobj) + return request({ + url: '/sanitation/toilet/import', + method: 'post', + headers: { 'Content-Type': 'multipart/form-data' }, + data: param + }) +} +// 批量导出 +export function batchExportToilet(params, config) { + return request({ + url: '/sanitation/toilet/export', + method: 'get', + timeout: 120000, + params, + ...config, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 公厕保洁记录查询 +export function getToiletJobRecords(params) { + return request({ + url: '/sanitation/toilet/jobRecord', + method: 'get', + params + }) +} + +// 批量导出 +export function batchExportToiletJobRecords(params, config) { + return request({ + url: '/sanitation/toilet/exportJobRecord', + method: 'get', + timeout: 120000, + params, + ...config, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} diff --git a/src/api/system/alarm.js b/src/api/system/alarm.js new file mode 100644 index 0000000..1c3a7ab --- /dev/null +++ b/src/api/system/alarm.js @@ -0,0 +1,62 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' + +// 获取当前报警列表 +export function getAlarmNowList(params) { + return request({ + url: '/alarm/listNowPage', + method: 'get', + params + }) +} + +// 获取当前报警列表 +export function getAlarmHistoryList(params) { + return request({ + url: '/alarm/listHisPage', + method: 'get', + params + }) +} + + +// 批量消警 +export function clearAll(params) { + return request({ + url: '/alarm/allClear', + method: 'get', + params + }) +} + +// 消警 +export function clearAlarm(params) { + return request({ + url: '/alarm/cancel', + method: 'get', + params + }) +} + +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 设置报警阈值 +export function setThresh(params) { + return request({ + url: '/alarm/resetAlarmRule', + method: 'post', + params + }) +} diff --git a/src/api/system/bridge.js b/src/api/system/bridge.js new file mode 100644 index 0000000..e8a4108 --- /dev/null +++ b/src/api/system/bridge.js @@ -0,0 +1,80 @@ +/** + * 桥梁管理接口 + */ +import request from '@/utils/request' + +// 获取桥梁详情 +export function getDetail(id) { + return request({ + url: '/bridge/detail', + method: 'get', + params: { + id: id + } + }) +} + +export function updateBridge(params) { + return request({ + url: '/bridge/update', + method: 'post', + params + }) +} +// 批量导出 +export function exportRecords(params) { + return request({ + url: 'device/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +export function getContentList(params) { + return request({ + url: 'maintain/contentByType', + method: 'get', + params: { + type: params + } + }) +} +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 编辑 +export function editRecord(params) { + return request({ + url: 'maintain/update', + method: 'post', + params + }) +} +// 新增 +export function addRecord(params) { + return request({ + url: 'maintain/add', + method: 'post', + params + }) +} +// 删除 +export function delRecord(id) { + return request({ + url: 'maintain/delete', + method: 'post', + params: { + id: id + } + }) +} diff --git a/src/api/system/data.js b/src/api/system/data.js new file mode 100644 index 0000000..4c95db5 --- /dev/null +++ b/src/api/system/data.js @@ -0,0 +1,63 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' + +// 获取当前报警列表 +export function getHistoryList(params) { + return request({ + url: '/data/hisListPage', + method: 'get', + params + }) +} + +// 获取当前报警列表 +export function getHistory(params) { + return request({ + url: '/data/hisList', + method: 'get', + params + }) +} + + + +// 批量消警 +export function clearAll(params) { + return request({ + url: '/alarm/allClear', + method: 'get', + params + }) +} + +// 消警 +export function clearAlarm(params) { + return request({ + url: '/alarm/cancel', + method: 'get', + params + }) +} + +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 设置报警阈值 +export function setThresh(params) { + return request({ + url: '/alarm/resetAlarmRule', + method: 'post', + params + }) +} diff --git a/src/api/system/order.js b/src/api/system/order.js new file mode 100644 index 0000000..7007c50 --- /dev/null +++ b/src/api/system/order.js @@ -0,0 +1,71 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +// import qs from 'qs' + +// 获取当前报警列表 +export function getRecordList(params) { + return request({ + url: '/maintain/listPage', + method: 'get', + params + }) +} +// 批量导出 +export function exportRecords(params) { + return request({ + url: 'device/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +export function getContentList(params) { + return request({ + url: 'maintain/contentByType', + method: 'get', + params: { + type: params + } + }) +} +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 编辑 +export function editRecord(params) { + return request({ + url: 'maintain/update', + method: 'post', + params + }) +} +// 新增 +export function addRecord(params) { + return request({ + url: 'maintain/add', + method: 'post', + params + }) +} +// 删除 +export function delRecord(id) { + return request({ + url: 'maintain/delete', + method: 'post', + params: { + bridgeMaintenanceId: id + } + }) +} diff --git a/src/api/system/overview.js b/src/api/system/overview.js new file mode 100644 index 0000000..bca50cc --- /dev/null +++ b/src/api/system/overview.js @@ -0,0 +1,109 @@ +import request from '@/utils/request' +import qs from "qs" +import Vue from 'vue' + +// 路灯状态统计 +export function getLampStatus() { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampStatus', + method: 'get' + }) +} + +// 路灯总览列表 +export function getLampList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampList', + method: 'get', + params + }) +} + +// 路灯详情 +export function getlampDetail(lampId) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampDetail', + method: 'get', + params: { + lampId: lampId + } + }) +} + +// 回路列表 +export function getCircuitList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/circuitList', + method: 'get', + params + }) +} + +// 灯箱列表 +export function getLampBoxList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampBoxList', + method: 'get', + params + }) +} +// 灯箱详情 +export function getLampBoxDetail(lampBoxId) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampBoxDetail', + method: 'get', + params: { + lampBoxId: lampBoxId + } + }) +} + +// 报警总览列表 +export function getAlarmList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/alarmList', + method: 'get', + params + }) +} + +// 报警详情 +export function getAlarmDetail(alarmId) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/alarmDetail', + method: 'get', + params: { + alarmId: alarmId + } + }) +} + +// 路灯控制 +export function lampControl(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampControl', + method: 'post', + params, + paramsSerializer: params => { + return qs.stringify(params, { indices: false }) + } + }) +} diff --git a/src/api/system/rule.js b/src/api/system/rule.js new file mode 100644 index 0000000..76c6b2d --- /dev/null +++ b/src/api/system/rule.js @@ -0,0 +1,59 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +// import qs from 'qs' + +// 获取当前报警列表 +export function getRuleList() { + return request({ + url: 'rule/listPage', + method: 'get' + }) +} +export function getContentList(params) { + return request({ + url: 'maintain/contentByType', + method: 'get', + params: { + type: params + } + }) +} +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 编辑 +export function editRecord(params) { + return request({ + url: 'maintain/update', + method: 'post', + params + }) +} +// 新增 +export function addRecord(params) { + return request({ + url: 'maintain/add', + method: 'post', + params + }) +} +// 删除 +export function delRecord(id) { + return request({ + url: 'maintain/delete', + method: 'post', + params: { + id: id + } + }) +} diff --git a/src/api/system/statistics.js b/src/api/system/statistics.js new file mode 100644 index 0000000..b25efe9 --- /dev/null +++ b/src/api/system/statistics.js @@ -0,0 +1,23 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +// import qs from 'qs' + +// +export function countByToilet(params) { + return request({ + url: '/sanitation/toiletStatistic/jobStaticByToilet', + method: 'get', + params + }) +} + +export function countByDay(params) { + return request({ + url: '/sanitation/toiletStatistic/jobStaticByDate', + method: 'get', + params + }) +} + diff --git a/src/assets/global_images/icon-position.png b/src/assets/global_images/icon-position.png new file mode 100644 index 0000000..7444038 --- /dev/null +++ b/src/assets/global_images/icon-position.png Binary files differ diff --git a/src/assets/global_images/location_green.png b/src/assets/global_images/location_green.png new file mode 100644 index 0000000..aa8be65 --- /dev/null +++ b/src/assets/global_images/location_green.png Binary files differ diff --git a/src/assets/global_images/location_red.png b/src/assets/global_images/location_red.png new file mode 100644 index 0000000..2be8c3d --- /dev/null +++ b/src/assets/global_images/location_red.png Binary files differ diff --git a/src/assets/global_images/location_yellow.png b/src/assets/global_images/location_yellow.png new file mode 100644 index 0000000..5ab6f4d --- /dev/null +++ b/src/assets/global_images/location_yellow.png Binary files differ diff --git a/src/assets/global_images/toilet-position.png b/src/assets/global_images/toilet-position.png new file mode 100644 index 0000000..7db6d9a --- /dev/null +++ b/src/assets/global_images/toilet-position.png Binary files differ diff --git a/src/assets/global_images/toilet.png b/src/assets/global_images/toilet.png new file mode 100644 index 0000000..6d9fc05 --- /dev/null +++ b/src/assets/global_images/toilet.png Binary files differ diff --git a/src/assets/global_images/toiletPhoto.png b/src/assets/global_images/toiletPhoto.png new file mode 100644 index 0000000..15d08e2 --- /dev/null +++ b/src/assets/global_images/toiletPhoto.png Binary files differ diff --git a/src/components/DownloadTemplate/index.vue b/src/components/DownloadTemplate/index.vue index 8ded2cd..7807cac 100644 --- a/src/components/DownloadTemplate/index.vue +++ b/src/components/DownloadTemplate/index.vue @@ -47,8 +47,8 @@ diff --git a/src/components/NormalTable/index.vue b/src/components/NormalTable/index.vue index 5077bef..04d322d 100644 --- a/src/components/NormalTable/index.vue +++ b/src/components/NormalTable/index.vue @@ -79,7 +79,7 @@
-
+
Object.assign(obj, { [key]: this[key] }), {}), + on: events.reduce((obj, key) => Object.assign(obj, { [key]: this.transmitEvent }), {}) + }) + } + this.props = [...extraProps, ...props.filter(prop => exceptProps.indexOf(prop))] + } +} + +export default prop => new Mixin(prop) diff --git a/src/components/mapWindow/base/mixins/common.js b/src/components/mapWindow/base/mixins/common.js new file mode 100644 index 0000000..2fd1a28 --- /dev/null +++ b/src/components/mapWindow/base/mixins/common.js @@ -0,0 +1,82 @@ +const types = { + map: { + unload: 'clearMap' + }, + control: { + unload: 'removeControl' + }, + layer: { + unload: 'removeLayer' + }, + features: { + unload: 'removeFeatures' + }, + listener: { + unload: 'removeListener' + } +} + +const getParent = $component => ($component.abstract || $component.$el === $component.$children[0].$el) ? getParent($component.$parent) : $component + +function destroyInstance () { + const { unload, renderByParent, $parent } = this + if (renderByParent) { + $parent.reload() + } + unload() +} + +class Mixin { + constructor (prop) { + this.methods = { + ready () { + const $parent = getParent(this.$parent) + const map = this.map = $parent.map + this.load() + this.$emit('ready', { + map + }) + }, + transmitEvent (e) { + this.$emit(e.type.replace(/^on/, ''), e) + }, + reload () { + this && this.$nextTick(() => { + this.unload() + this.$nextTick(this.load) + }) + }, + unload () { + const { map, originInstance } = this + try { + switch (prop.type) { + case 'search': + return originInstance.clearResults() + case 'autoComplete': + case 'lushu': + return originInstance.dispose() + case 'markerClusterer': + return originInstance.clearMarkers() + default: + map[types[prop.type].unload](originInstance) + } + } catch (e) {} + } + } + this.computed = { + renderByParent () { + return this.$parent.preventChildrenRender + } + } + this.mounted = function () { + console.log('common mounted') + const $parent = getParent(this.$parent) + const map = $parent.map + const { ready } = this + console.log(map) + map ? ready() : $parent.$on('onload', ready) + } + } +} + +export default type => new Mixin({ type }) diff --git a/src/components/mapWindow/leafletMap.vue b/src/components/mapWindow/leafletMap.vue new file mode 100644 index 0000000..b753cc0 --- /dev/null +++ b/src/components/mapWindow/leafletMap.vue @@ -0,0 +1,143 @@ + + + + + + + diff --git a/src/components/mapWindow/mapWindow.vue b/src/components/mapWindow/mapWindow.vue new file mode 100644 index 0000000..9ced291 --- /dev/null +++ b/src/components/mapWindow/mapWindow.vue @@ -0,0 +1,46 @@ + + + + + + diff --git a/src/icons/svg/bridge.svg b/src/icons/svg/bridge.svg new file mode 100644 index 0000000..1a0336f --- /dev/null +++ b/src/icons/svg/bridge.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/icons/svg/toilet.svg b/src/icons/svg/toilet.svg new file mode 100644 index 0000000..9d8e765 --- /dev/null +++ b/src/icons/svg/toilet.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/main.js b/src/main.js index f2d105d..3e4074e 100644 --- a/src/main.js +++ b/src/main.js @@ -18,6 +18,9 @@ // echart // import echarts from 'echarts' // Vue.prototype.$echarts = echarts +// 引入v-charts +import VCharts from 'v-charts' +Vue.use(VCharts) // 将自动注册所有组件为全局组件 // import dataV from '@jiaminghi/data-view' @@ -35,9 +38,19 @@ Vue.component('search-item', SearchItem) // 加载leaflet的css +// import 'leaflet/dist/leaflet.css' +// import 'leaflet-draw/dist/leaflet.draw.css' +import L from 'leaflet' import 'leaflet/dist/leaflet.css' -import 'leaflet-draw/dist/leaflet.draw.css' +Vue.config.productionTip = false +Vue.L = Vue.prototype.$L = L +delete L.Icon.Default.prototype._getIconUrl +L.Icon.Default.mergeOptions({ + iconRetinaUrl: require('leaflet/dist/images/marker-icon-2x.png'), + iconUrl: require('leaflet/dist/images/marker-icon.png'), + shadowUrl: require('leaflet/dist/images/marker-shadow.png') +}) /** * This project originally used easy-mock to simulate data, * but its official service is very unstable, diff --git a/src/permission.js b/src/permission.js index dc6b2f8..809ca86 100644 --- a/src/permission.js +++ b/src/permission.js @@ -25,8 +25,8 @@ store.dispatch('GetInfo').then(res => { // 拉取用户信息 // 设置当前子系统为基础资源子系统 const currentSys = { - code: 'baseResourse', - name: '基础资源子系统' + code: 'toliet', + name: '公共厕所管理系统' } // 将当前系统信息保存在localStorage中 store.commit('SET_SYSTEM', currentSys) diff --git a/src/router/index.js b/src/router/index.js index 39c295c..d23076d 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -8,8 +8,11 @@ /* Layout */ import Layout from '@/layout/Layout' +import { toiletRouters } from './modules/toilet' +import { workRouters } from './modules/work' +import { statisticsRouters } from './modules/statistics' +import { ruleRouters } from './modules/rule' import { systemRouters } from './modules/system' -import { exampleRouters } from './modules/example' /** * hidden: true if `hidden:true` will not show in the sidebar(default is false) @@ -40,11 +43,12 @@ ] }, // 登录页面 - { path: '/login', component: () => import('@/views/login/index'), hidden: true }, + { path: '/login', component: () => import('@/views/login/index_2'), hidden: true }, // 404错误页面 { path: '/404', component: () => import('@/views/errorPage/404'), hidden: true }, // 401 错误页面 - { path: '/401', component: () => import('@/views/errorPage/401'), hidden: true } + { path: '/401', component: () => import('@/views/errorPage/401'), hidden: true }, + { path: '/', redirect: '/toiletList', hidden: true } ] // 实例化vue的时候直挂载constantRouter export default new Router({ @@ -56,7 +60,10 @@ // 异步挂载路由 // 动态需要根据权限加载的路由表 export const asyncRouterMap = [ - ...exampleRouters, - ...systemRouters, + ...toiletRouters, + ...workRouters, + ...statisticsRouters, + ...ruleRouters, + // ...systemRouters, { path: '*', redirect: '/404', hidden: true } ] diff --git a/src/router/modules/rule.js b/src/router/modules/rule.js new file mode 100644 index 0000000..51e0283 --- /dev/null +++ b/src/router/modules/rule.js @@ -0,0 +1,24 @@ +/* Layout */ +import Layout from '@/layout/Layout' + +export const ruleRouters = [ + { + path: 'rule', + component: Layout, + redirect: '/rule', + name: 'Rule', + meta: { + title: '规章制度', + icon: 'icon-config', // 图标 + permission: ['/rule']// 权限名称 + }, + children: [ + { + path: '/rule', + name: 'Rule', + component: () => import('@/views/rule/listRule'), + meta: { title: '规章制度', icon: 'function', permission: ['/rule'] } + } + ] + } +] diff --git a/src/router/modules/statistics.js b/src/router/modules/statistics.js new file mode 100644 index 0000000..fb9cbea --- /dev/null +++ b/src/router/modules/statistics.js @@ -0,0 +1,30 @@ +/* Layout */ +import Layout from '@/layout/Layout' + +export const statisticsRouters = [ + { + path: 'statisticsToilet', + component: Layout, + redirect: '/workStatistics', + name: 'StatisticsToilet', + meta: { + title: '作业统计', + icon: 'icon-config', // 图标 + permission: ['/statisticsToilet']// 权限名称 + }, + children: [ + { + path: '/workStatistics', + name: 'WorkStatistics', + component: () => import('@/views/statistics/toiletAssessment'), + meta: { title: '作业统计', icon: '', permission: ['/toilet/workStatistics'] } + }, + { + path: '/evaluationStatistics', + name: 'EvaluationStatistics', + component: () => import('@/views/statistics/evaluationAssessment'), + meta: { title: '评价统计', icon: '', permission: ['/toilet/evaluationStatistics'] } + } + ] + } +] diff --git a/src/router/modules/toilet.js b/src/router/modules/toilet.js new file mode 100644 index 0000000..b221a0e --- /dev/null +++ b/src/router/modules/toilet.js @@ -0,0 +1,30 @@ +/* Layout */ +import Layout from '@/layout/Layout' + +export const toiletRouters = [ + { + path: 'toiletManage', + component: Layout, + redirect: '/toiletManage', + name: 'ToiletManage', + meta: { + title: '公厕管理', + icon: 'icon-config', // 图标 + permission: ['/toiletManage']// 权限名称 + }, + children: [ + { + path: '/toiletList', + name: 'ToiletList', + component: () => import('@/views/toiletManage/toiletList'), + meta: { title: '公厕台帐管理', icon: 'function', permission: ['/toiletList'] } + }, + { + path: '/toiletMap', + name: 'ToiletMap', + component: () => import('@/views/overview/overview'), + meta: { title: '地图总览', icon: 'function', permission: ['/toiletMap'] } + } + ] + } +] diff --git a/src/router/modules/work.js b/src/router/modules/work.js new file mode 100644 index 0000000..5e0759f --- /dev/null +++ b/src/router/modules/work.js @@ -0,0 +1,24 @@ +/* Layout */ +import Layout from '@/layout/Layout' + +export const workRouters = [ + { + path: 'toiletWork', + component: Layout, + redirect: '/toiletManage', + name: 'toiletWork', + meta: { + title: '作业管理', + icon: 'icon-config', // 图标 + permission: ['/toiletWork']// 权限名称 + }, + children: [ + { + path: '/toiletWork', + name: 'ToiletWork', + component: () => import('@/views/toiletClean/toiletCleanList'), + meta: { title: '作业管理', icon: 'function', permission: ['/toiletWork'] } + } + ] + } +] diff --git a/src/settings.js b/src/settings.js index b568ce0..b8159bf 100644 --- a/src/settings.js +++ b/src/settings.js @@ -3,7 +3,7 @@ * @type {boolean} true | false * @description 是否显示设置按钮 */ - showSettings: true, + showSettings: false, /** * @type {boolean} true | false diff --git a/src/store/modules/permission.js b/src/store/modules/permission.js index a0cb8cf..3ab50d5 100644 --- a/src/store/modules/permission.js +++ b/src/store/modules/permission.js @@ -120,17 +120,23 @@ }) }, // 获取用户权限 - GetMenus({ commit, state }) { - console.log('in store.permission.js:GetMenus:') + GetMenus({ commit, state }, currentSystem) { + // console.log('in store.permission.js:GetMenus:') + console.log('获取' + currentSystem.name + '的菜单') + const params = { + parentCode: currentSystem.code // 传入该子系统的code,获取子系统的权限 + } return new Promise((resolve, reject) => { - getMenus(state.token).then(response => { // 处理返回值 + // 此处获取用户所有权限 + getMenus(params).then(response => { // 处理返回值 const data = response.data const menus = [] // 仅菜单 const btns = [] // 非菜单 if (data.menus && data.menus.length > 0) { - commit('SET_MENUS', data.menus) - for (const menu of data.menus) { // 遍历菜单,获取所有的权限项 - if (menu.ismenu === '1') { // 将是菜单的放入menus + const allmenus = [...data.menus] + commit('SET_MENUS', allmenus) + for (const menu of allmenus) { // 遍历菜单,获取所有的权限项 + if (menu.resourceType === '02' || menu.resourceType === '03') { // 将是菜单的放入menus const menu_tmp = {} menu_tmp.url = menu.url menu_tmp.icon = menu.icon @@ -142,11 +148,11 @@ btn_tmp.name = menu.name btn_tmp.icon = menu.icon btns.push(btn_tmp) - // console.log(menu.url) } } // 过滤路由表 - const accessedRouters = filterAsyncRouter(asyncRouterMap, menus) + let accessedRouters = filterAsyncRouter(asyncRouterMap, menus) + // accessedRouters = filterRedirect(accessedRouters) commit('SET_BTNS', btns) commit('SET_ROUTERS', accessedRouters) resolve(response) diff --git a/src/utils/baseConfig.js b/src/utils/baseConfig.js index 1f4fa38..999593e 100644 --- a/src/utils/baseConfig.js +++ b/src/utils/baseConfig.js @@ -1,5 +1,5 @@ const project = { - title: '后台管理系统前端基础框架' + title: '路桥养护子系统' } export function getProject() { return project diff --git a/src/utils/dateutils.js b/src/utils/dateutils.js index 868111a..5cd16af 100644 --- a/src/utils/dateutils.js +++ b/src/utils/dateutils.js @@ -15,15 +15,15 @@ return ct_month } -export function getLastWeek() { // 默认显示上周 +export function getLastWeek(fmt) { // 默认显示上周 const ct_month = new Date() ct_month.setTime(ct_month.getTime() - 3600 * 1000 * 24 * 7) - return ct_month + return ct_month.Format(fmt) } -export function getLastMonth() { // 默认显示上个月 +export function getLastMonth(fmt) { // 默认显示上个月 const ct_month = new Date() ct_month.setTime(ct_month.getTime() - 3600 * 1000 * 24 * 30) - return ct_month + return ct_month.Format(fmt) } // 对Date的扩展,将 Date 转化为指定格式的String diff --git a/src/utils/exportutils.js b/src/utils/exportutils.js new file mode 100644 index 0000000..b5d0bcf --- /dev/null +++ b/src/utils/exportutils.js @@ -0,0 +1,19 @@ +/** + * 导出文件工具 + * @param blob 文件 + * @param fileName 导出文件名 + */ +export function exportFile(blob, fileName) { + if (window.navigator && window.navigator.msSaveOrOpenBlob) { + navigator.msSaveBlob(blob, fileName) + } else { + const downloadElement = document.createElement('a') + const href = window.URL.createObjectURL(blob) // 创建下载的链接 + downloadElement.href = href + downloadElement.download = fileName + document.body.appendChild(downloadElement) + downloadElement.click() // 点击下载 + document.body.removeChild(downloadElement) // 下载完成移除元素 + window.URL.revokeObjectURL(href) // 释放blob对象 + } +} diff --git a/src/utils/request.js b/src/utils/request.js index c88ea76..dc56e26 100644 --- a/src/utils/request.js +++ b/src/utils/request.js @@ -17,6 +17,13 @@ config.headers['token'] = getToken() // 让每个请求携带自定义token 请根据实际情况自行修改 console.log(config.headers['token']) } + // 在接口增加时间戳 + // if (config.method === 'get') { + config.params = { + _t: Date.parse(new Date()) / 1000, + ...config.params + } + // } return config }, error => { diff --git a/src/views/mapViews/choosePointDialog.vue b/src/views/mapViews/choosePointDialog.vue new file mode 100644 index 0000000..c9dde8a --- /dev/null +++ b/src/views/mapViews/choosePointDialog.vue @@ -0,0 +1,105 @@ + + + + + diff --git a/src/views/mapViews/mapView.vue b/src/views/mapViews/mapView.vue new file mode 100644 index 0000000..a18db88 --- /dev/null +++ b/src/views/mapViews/mapView.vue @@ -0,0 +1,73 @@ + + + + + diff --git a/src/views/order/editOrder.vue b/src/views/order/editOrder.vue new file mode 100644 index 0000000..4a5fd8a --- /dev/null +++ b/src/views/order/editOrder.vue @@ -0,0 +1,319 @@ + + + + + diff --git a/src/views/order/listMaintainRecords.vue b/src/views/order/listMaintainRecords.vue new file mode 100644 index 0000000..2d4f682 --- /dev/null +++ b/src/views/order/listMaintainRecords.vue @@ -0,0 +1,327 @@ + + + + + diff --git a/src/views/overview/overview.vue b/src/views/overview/overview.vue new file mode 100644 index 0000000..9525867 --- /dev/null +++ b/src/views/overview/overview.vue @@ -0,0 +1,285 @@ + + + + + diff --git a/src/views/overview/toiletDetailDialog.vue b/src/views/overview/toiletDetailDialog.vue new file mode 100644 index 0000000..2b3a511 --- /dev/null +++ b/src/views/overview/toiletDetailDialog.vue @@ -0,0 +1,263 @@ + + + + + + diff --git a/src/views/overview/toiletLayer.vue b/src/views/overview/toiletLayer.vue new file mode 100644 index 0000000..d784323 --- /dev/null +++ b/src/views/overview/toiletLayer.vue @@ -0,0 +1,152 @@ + + + + + + diff --git a/src/views/rule/listRule.vue b/src/views/rule/listRule.vue new file mode 100644 index 0000000..a19b9e4 --- /dev/null +++ b/src/views/rule/listRule.vue @@ -0,0 +1,157 @@ + + + + + diff --git a/src/views/statistics/barChart.vue b/src/views/statistics/barChart.vue new file mode 100644 index 0000000..d10eb38 --- /dev/null +++ b/src/views/statistics/barChart.vue @@ -0,0 +1,65 @@ + + + + + diff --git a/src/views/statistics/components/evaluationListDialog.vue b/src/views/statistics/components/evaluationListDialog.vue new file mode 100644 index 0000000..1560772 --- /dev/null +++ b/src/views/statistics/components/evaluationListDialog.vue @@ -0,0 +1,100 @@ + + + + + + diff --git a/src/views/statistics/components/workChart.vue b/src/views/statistics/components/workChart.vue new file mode 100644 index 0000000..a891e0c --- /dev/null +++ b/src/views/statistics/components/workChart.vue @@ -0,0 +1,79 @@ + + + + + diff --git a/src/views/statistics/evaluationAssessment.vue b/src/views/statistics/evaluationAssessment.vue new file mode 100644 index 0000000..28dedc5 --- /dev/null +++ b/src/views/statistics/evaluationAssessment.vue @@ -0,0 +1,159 @@ + + + + + + diff --git a/src/views/statistics/pieChart.vue b/src/views/statistics/pieChart.vue new file mode 100644 index 0000000..e4dd287 --- /dev/null +++ b/src/views/statistics/pieChart.vue @@ -0,0 +1,58 @@ + + + + + diff --git a/src/views/statistics/statisticsChart.vue b/src/views/statistics/statisticsChart.vue new file mode 100644 index 0000000..2c48fe0 --- /dev/null +++ b/src/views/statistics/statisticsChart.vue @@ -0,0 +1,87 @@ + + + + + diff --git a/src/views/statistics/toiletAssessment.vue b/src/views/statistics/toiletAssessment.vue new file mode 100644 index 0000000..67aa32b --- /dev/null +++ b/src/views/statistics/toiletAssessment.vue @@ -0,0 +1,242 @@ + + + + + diff --git a/src/views/statistics/workStatistics.vue b/src/views/statistics/workStatistics.vue new file mode 100644 index 0000000..50a07f2 --- /dev/null +++ b/src/views/statistics/workStatistics.vue @@ -0,0 +1,191 @@ + + + + + diff --git a/src/views/toilet/components/detail.vue b/src/views/toilet/components/detail.vue new file mode 100644 index 0000000..247c03d --- /dev/null +++ b/src/views/toilet/components/detail.vue @@ -0,0 +1,431 @@ + + + + diff --git a/config/index.js b/config/index.js index 8abd37a..19b33b1 100644 --- a/config/index.js +++ b/config/index.js @@ -69,7 +69,7 @@ * then assetsPublicPath should be set to "/bar/". * In most cases please use '/' !!! */ - assetsPublicPath: '/', + assetsPublicPath: '/toilet/', /** * Source Maps diff --git a/package.json b/package.json index 45f055f..9f3a3eb 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "echarts": "^4.2.1", "element-ui": "2.13.0", "event-source-polyfill": "^1.0.5", + "file-saver": "^2.0.5", "js-cookie": "2.2.0", "jsencrypt": "^3.0.0-rc.1", "leaflet": "^1.7.1", @@ -33,7 +34,9 @@ "vue-amap": "^0.5.9", "vue-baidu-map": "^0.21.22", "vue-router": "3.0.1", - "vuex": "3.0.1" + "vue2-leaflet": "^2.7.0", + "vuex": "3.0.1", + "xlsx": "^0.17.0" }, "devDependencies": { "autoprefixer": "8.5.0", diff --git a/src/api/common.js b/src/api/common.js index 87c582b..7804714 100644 --- a/src/api/common.js +++ b/src/api/common.js @@ -2,10 +2,14 @@ * 常用接口 */ import request from '@/utils/request' +import Vue from 'vue' + // 模板下载 export function downloadTemplate(fileName) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath return request({ - url: 'template/download', + url: lampPath + 'template/download', method: 'get', params: { filename: fileName @@ -19,7 +23,7 @@ const param = new FormData() param.append('file', fileobj.file) return request({ - url: 'imageUpload', + url: 'fileUpload', method: 'post', headers: { 'Content-Type': 'multipart/form-data' }, data: param diff --git a/src/api/sanitation/statistics.js b/src/api/sanitation/statistics.js new file mode 100644 index 0000000..ffeac18 --- /dev/null +++ b/src/api/sanitation/statistics.js @@ -0,0 +1,22 @@ + +/** + * 考核统计接口 + */ +import request from '@/utils/request' +// 公厕保洁次数统计 +export function getToiletJobCount(params) { + return request({ + url: '/sanitation/statistic/toilet/jobCount', + method: 'get', + params + }) +} + +// 公厕评分统计 +export function getToiletEvaluation(params) { + return request({ + url: '/sanitation/toiletEvaluation/statistics', + method: 'get', + params + }) +} diff --git a/src/api/sanitation/toilet.js b/src/api/sanitation/toilet.js new file mode 100644 index 0000000..11affd4 --- /dev/null +++ b/src/api/sanitation/toilet.js @@ -0,0 +1,133 @@ +/** + * 公厕管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' +// 公厕查询 +export function getToiletListPage(params) { + return request({ + url: '/sanitation/toilet/listPage', + method: 'get', + params + }) +} +// 公厕查询 +export function getToiletList(pid) { + return request({ + url: '/sanitation/toilet/list', + method: 'get', + params: { + pid: pid + } + }) +} + +// 添加公厕 +export function addToilet(params) { + return request({ + url: '/sanitation/toilet/add', + method: 'post', + params + }) +} +// 修改公厕机构 +export function updateToilet(params) { + return request({ + url: '/sanitation/toilet/update', + method: 'post', + params + }) +} +// 删除公厕机构 +export function delToilet(ids) { + return request({ + url: '/sanitation/toilet/delete', + method: 'post', + params: { + ids + }, + paramsSerializer: params => { + return qs.stringify(params, { indices: false }) + } + }) +} + +// 公厕基本信息详情 +export function getToiletInfoDetail(id) { + return request({ + url: '/sanitation/toilet/detail?toiletId=' + id, + method: 'get' + }) +} + +// 某公厕保洁记录 +export function getRecordsByToilet(params) { + return request({ + url: '/sanitation/toilet/jobRecord/detail', + method: 'get', + params + }) +} + +// 某公厕平均评分 +export function getScoreByToilet(params) { + return request({ + url: '/sanitation/toiletEvaluation/detailScore', + method: 'get', + params + }) +} + +// 某公厕评分列表 +export function getScoreListByToilet(params) { + return request({ + url: '/sanitation/toiletEvaluation/list', + method: 'get', + params + }) +} + + +// 批量导入 +export function batchImportToilet(fileobj) { + const param = new FormData() + param.append('file', fileobj) + return request({ + url: '/sanitation/toilet/import', + method: 'post', + headers: { 'Content-Type': 'multipart/form-data' }, + data: param + }) +} +// 批量导出 +export function batchExportToilet(params, config) { + return request({ + url: '/sanitation/toilet/export', + method: 'get', + timeout: 120000, + params, + ...config, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 公厕保洁记录查询 +export function getToiletJobRecords(params) { + return request({ + url: '/sanitation/toilet/jobRecord', + method: 'get', + params + }) +} + +// 批量导出 +export function batchExportToiletJobRecords(params, config) { + return request({ + url: '/sanitation/toilet/exportJobRecord', + method: 'get', + timeout: 120000, + params, + ...config, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} diff --git a/src/api/system/alarm.js b/src/api/system/alarm.js new file mode 100644 index 0000000..1c3a7ab --- /dev/null +++ b/src/api/system/alarm.js @@ -0,0 +1,62 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' + +// 获取当前报警列表 +export function getAlarmNowList(params) { + return request({ + url: '/alarm/listNowPage', + method: 'get', + params + }) +} + +// 获取当前报警列表 +export function getAlarmHistoryList(params) { + return request({ + url: '/alarm/listHisPage', + method: 'get', + params + }) +} + + +// 批量消警 +export function clearAll(params) { + return request({ + url: '/alarm/allClear', + method: 'get', + params + }) +} + +// 消警 +export function clearAlarm(params) { + return request({ + url: '/alarm/cancel', + method: 'get', + params + }) +} + +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 设置报警阈值 +export function setThresh(params) { + return request({ + url: '/alarm/resetAlarmRule', + method: 'post', + params + }) +} diff --git a/src/api/system/bridge.js b/src/api/system/bridge.js new file mode 100644 index 0000000..e8a4108 --- /dev/null +++ b/src/api/system/bridge.js @@ -0,0 +1,80 @@ +/** + * 桥梁管理接口 + */ +import request from '@/utils/request' + +// 获取桥梁详情 +export function getDetail(id) { + return request({ + url: '/bridge/detail', + method: 'get', + params: { + id: id + } + }) +} + +export function updateBridge(params) { + return request({ + url: '/bridge/update', + method: 'post', + params + }) +} +// 批量导出 +export function exportRecords(params) { + return request({ + url: 'device/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +export function getContentList(params) { + return request({ + url: 'maintain/contentByType', + method: 'get', + params: { + type: params + } + }) +} +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 编辑 +export function editRecord(params) { + return request({ + url: 'maintain/update', + method: 'post', + params + }) +} +// 新增 +export function addRecord(params) { + return request({ + url: 'maintain/add', + method: 'post', + params + }) +} +// 删除 +export function delRecord(id) { + return request({ + url: 'maintain/delete', + method: 'post', + params: { + id: id + } + }) +} diff --git a/src/api/system/data.js b/src/api/system/data.js new file mode 100644 index 0000000..4c95db5 --- /dev/null +++ b/src/api/system/data.js @@ -0,0 +1,63 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' + +// 获取当前报警列表 +export function getHistoryList(params) { + return request({ + url: '/data/hisListPage', + method: 'get', + params + }) +} + +// 获取当前报警列表 +export function getHistory(params) { + return request({ + url: '/data/hisList', + method: 'get', + params + }) +} + + + +// 批量消警 +export function clearAll(params) { + return request({ + url: '/alarm/allClear', + method: 'get', + params + }) +} + +// 消警 +export function clearAlarm(params) { + return request({ + url: '/alarm/cancel', + method: 'get', + params + }) +} + +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 设置报警阈值 +export function setThresh(params) { + return request({ + url: '/alarm/resetAlarmRule', + method: 'post', + params + }) +} diff --git a/src/api/system/order.js b/src/api/system/order.js new file mode 100644 index 0000000..7007c50 --- /dev/null +++ b/src/api/system/order.js @@ -0,0 +1,71 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +// import qs from 'qs' + +// 获取当前报警列表 +export function getRecordList(params) { + return request({ + url: '/maintain/listPage', + method: 'get', + params + }) +} +// 批量导出 +export function exportRecords(params) { + return request({ + url: 'device/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +export function getContentList(params) { + return request({ + url: 'maintain/contentByType', + method: 'get', + params: { + type: params + } + }) +} +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 编辑 +export function editRecord(params) { + return request({ + url: 'maintain/update', + method: 'post', + params + }) +} +// 新增 +export function addRecord(params) { + return request({ + url: 'maintain/add', + method: 'post', + params + }) +} +// 删除 +export function delRecord(id) { + return request({ + url: 'maintain/delete', + method: 'post', + params: { + bridgeMaintenanceId: id + } + }) +} diff --git a/src/api/system/overview.js b/src/api/system/overview.js new file mode 100644 index 0000000..bca50cc --- /dev/null +++ b/src/api/system/overview.js @@ -0,0 +1,109 @@ +import request from '@/utils/request' +import qs from "qs" +import Vue from 'vue' + +// 路灯状态统计 +export function getLampStatus() { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampStatus', + method: 'get' + }) +} + +// 路灯总览列表 +export function getLampList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampList', + method: 'get', + params + }) +} + +// 路灯详情 +export function getlampDetail(lampId) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampDetail', + method: 'get', + params: { + lampId: lampId + } + }) +} + +// 回路列表 +export function getCircuitList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/circuitList', + method: 'get', + params + }) +} + +// 灯箱列表 +export function getLampBoxList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampBoxList', + method: 'get', + params + }) +} +// 灯箱详情 +export function getLampBoxDetail(lampBoxId) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampBoxDetail', + method: 'get', + params: { + lampBoxId: lampBoxId + } + }) +} + +// 报警总览列表 +export function getAlarmList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/alarmList', + method: 'get', + params + }) +} + +// 报警详情 +export function getAlarmDetail(alarmId) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/alarmDetail', + method: 'get', + params: { + alarmId: alarmId + } + }) +} + +// 路灯控制 +export function lampControl(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampControl', + method: 'post', + params, + paramsSerializer: params => { + return qs.stringify(params, { indices: false }) + } + }) +} diff --git a/src/api/system/rule.js b/src/api/system/rule.js new file mode 100644 index 0000000..76c6b2d --- /dev/null +++ b/src/api/system/rule.js @@ -0,0 +1,59 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +// import qs from 'qs' + +// 获取当前报警列表 +export function getRuleList() { + return request({ + url: 'rule/listPage', + method: 'get' + }) +} +export function getContentList(params) { + return request({ + url: 'maintain/contentByType', + method: 'get', + params: { + type: params + } + }) +} +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 编辑 +export function editRecord(params) { + return request({ + url: 'maintain/update', + method: 'post', + params + }) +} +// 新增 +export function addRecord(params) { + return request({ + url: 'maintain/add', + method: 'post', + params + }) +} +// 删除 +export function delRecord(id) { + return request({ + url: 'maintain/delete', + method: 'post', + params: { + id: id + } + }) +} diff --git a/src/api/system/statistics.js b/src/api/system/statistics.js new file mode 100644 index 0000000..b25efe9 --- /dev/null +++ b/src/api/system/statistics.js @@ -0,0 +1,23 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +// import qs from 'qs' + +// +export function countByToilet(params) { + return request({ + url: '/sanitation/toiletStatistic/jobStaticByToilet', + method: 'get', + params + }) +} + +export function countByDay(params) { + return request({ + url: '/sanitation/toiletStatistic/jobStaticByDate', + method: 'get', + params + }) +} + diff --git a/src/assets/global_images/icon-position.png b/src/assets/global_images/icon-position.png new file mode 100644 index 0000000..7444038 --- /dev/null +++ b/src/assets/global_images/icon-position.png Binary files differ diff --git a/src/assets/global_images/location_green.png b/src/assets/global_images/location_green.png new file mode 100644 index 0000000..aa8be65 --- /dev/null +++ b/src/assets/global_images/location_green.png Binary files differ diff --git a/src/assets/global_images/location_red.png b/src/assets/global_images/location_red.png new file mode 100644 index 0000000..2be8c3d --- /dev/null +++ b/src/assets/global_images/location_red.png Binary files differ diff --git a/src/assets/global_images/location_yellow.png b/src/assets/global_images/location_yellow.png new file mode 100644 index 0000000..5ab6f4d --- /dev/null +++ b/src/assets/global_images/location_yellow.png Binary files differ diff --git a/src/assets/global_images/toilet-position.png b/src/assets/global_images/toilet-position.png new file mode 100644 index 0000000..7db6d9a --- /dev/null +++ b/src/assets/global_images/toilet-position.png Binary files differ diff --git a/src/assets/global_images/toilet.png b/src/assets/global_images/toilet.png new file mode 100644 index 0000000..6d9fc05 --- /dev/null +++ b/src/assets/global_images/toilet.png Binary files differ diff --git a/src/assets/global_images/toiletPhoto.png b/src/assets/global_images/toiletPhoto.png new file mode 100644 index 0000000..15d08e2 --- /dev/null +++ b/src/assets/global_images/toiletPhoto.png Binary files differ diff --git a/src/components/DownloadTemplate/index.vue b/src/components/DownloadTemplate/index.vue index 8ded2cd..7807cac 100644 --- a/src/components/DownloadTemplate/index.vue +++ b/src/components/DownloadTemplate/index.vue @@ -47,8 +47,8 @@ diff --git a/src/components/NormalTable/index.vue b/src/components/NormalTable/index.vue index 5077bef..04d322d 100644 --- a/src/components/NormalTable/index.vue +++ b/src/components/NormalTable/index.vue @@ -79,7 +79,7 @@
-
+
Object.assign(obj, { [key]: this[key] }), {}), + on: events.reduce((obj, key) => Object.assign(obj, { [key]: this.transmitEvent }), {}) + }) + } + this.props = [...extraProps, ...props.filter(prop => exceptProps.indexOf(prop))] + } +} + +export default prop => new Mixin(prop) diff --git a/src/components/mapWindow/base/mixins/common.js b/src/components/mapWindow/base/mixins/common.js new file mode 100644 index 0000000..2fd1a28 --- /dev/null +++ b/src/components/mapWindow/base/mixins/common.js @@ -0,0 +1,82 @@ +const types = { + map: { + unload: 'clearMap' + }, + control: { + unload: 'removeControl' + }, + layer: { + unload: 'removeLayer' + }, + features: { + unload: 'removeFeatures' + }, + listener: { + unload: 'removeListener' + } +} + +const getParent = $component => ($component.abstract || $component.$el === $component.$children[0].$el) ? getParent($component.$parent) : $component + +function destroyInstance () { + const { unload, renderByParent, $parent } = this + if (renderByParent) { + $parent.reload() + } + unload() +} + +class Mixin { + constructor (prop) { + this.methods = { + ready () { + const $parent = getParent(this.$parent) + const map = this.map = $parent.map + this.load() + this.$emit('ready', { + map + }) + }, + transmitEvent (e) { + this.$emit(e.type.replace(/^on/, ''), e) + }, + reload () { + this && this.$nextTick(() => { + this.unload() + this.$nextTick(this.load) + }) + }, + unload () { + const { map, originInstance } = this + try { + switch (prop.type) { + case 'search': + return originInstance.clearResults() + case 'autoComplete': + case 'lushu': + return originInstance.dispose() + case 'markerClusterer': + return originInstance.clearMarkers() + default: + map[types[prop.type].unload](originInstance) + } + } catch (e) {} + } + } + this.computed = { + renderByParent () { + return this.$parent.preventChildrenRender + } + } + this.mounted = function () { + console.log('common mounted') + const $parent = getParent(this.$parent) + const map = $parent.map + const { ready } = this + console.log(map) + map ? ready() : $parent.$on('onload', ready) + } + } +} + +export default type => new Mixin({ type }) diff --git a/src/components/mapWindow/leafletMap.vue b/src/components/mapWindow/leafletMap.vue new file mode 100644 index 0000000..b753cc0 --- /dev/null +++ b/src/components/mapWindow/leafletMap.vue @@ -0,0 +1,143 @@ + + + + + + + diff --git a/src/components/mapWindow/mapWindow.vue b/src/components/mapWindow/mapWindow.vue new file mode 100644 index 0000000..9ced291 --- /dev/null +++ b/src/components/mapWindow/mapWindow.vue @@ -0,0 +1,46 @@ + + + + + + diff --git a/src/icons/svg/bridge.svg b/src/icons/svg/bridge.svg new file mode 100644 index 0000000..1a0336f --- /dev/null +++ b/src/icons/svg/bridge.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/icons/svg/toilet.svg b/src/icons/svg/toilet.svg new file mode 100644 index 0000000..9d8e765 --- /dev/null +++ b/src/icons/svg/toilet.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/main.js b/src/main.js index f2d105d..3e4074e 100644 --- a/src/main.js +++ b/src/main.js @@ -18,6 +18,9 @@ // echart // import echarts from 'echarts' // Vue.prototype.$echarts = echarts +// 引入v-charts +import VCharts from 'v-charts' +Vue.use(VCharts) // 将自动注册所有组件为全局组件 // import dataV from '@jiaminghi/data-view' @@ -35,9 +38,19 @@ Vue.component('search-item', SearchItem) // 加载leaflet的css +// import 'leaflet/dist/leaflet.css' +// import 'leaflet-draw/dist/leaflet.draw.css' +import L from 'leaflet' import 'leaflet/dist/leaflet.css' -import 'leaflet-draw/dist/leaflet.draw.css' +Vue.config.productionTip = false +Vue.L = Vue.prototype.$L = L +delete L.Icon.Default.prototype._getIconUrl +L.Icon.Default.mergeOptions({ + iconRetinaUrl: require('leaflet/dist/images/marker-icon-2x.png'), + iconUrl: require('leaflet/dist/images/marker-icon.png'), + shadowUrl: require('leaflet/dist/images/marker-shadow.png') +}) /** * This project originally used easy-mock to simulate data, * but its official service is very unstable, diff --git a/src/permission.js b/src/permission.js index dc6b2f8..809ca86 100644 --- a/src/permission.js +++ b/src/permission.js @@ -25,8 +25,8 @@ store.dispatch('GetInfo').then(res => { // 拉取用户信息 // 设置当前子系统为基础资源子系统 const currentSys = { - code: 'baseResourse', - name: '基础资源子系统' + code: 'toliet', + name: '公共厕所管理系统' } // 将当前系统信息保存在localStorage中 store.commit('SET_SYSTEM', currentSys) diff --git a/src/router/index.js b/src/router/index.js index 39c295c..d23076d 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -8,8 +8,11 @@ /* Layout */ import Layout from '@/layout/Layout' +import { toiletRouters } from './modules/toilet' +import { workRouters } from './modules/work' +import { statisticsRouters } from './modules/statistics' +import { ruleRouters } from './modules/rule' import { systemRouters } from './modules/system' -import { exampleRouters } from './modules/example' /** * hidden: true if `hidden:true` will not show in the sidebar(default is false) @@ -40,11 +43,12 @@ ] }, // 登录页面 - { path: '/login', component: () => import('@/views/login/index'), hidden: true }, + { path: '/login', component: () => import('@/views/login/index_2'), hidden: true }, // 404错误页面 { path: '/404', component: () => import('@/views/errorPage/404'), hidden: true }, // 401 错误页面 - { path: '/401', component: () => import('@/views/errorPage/401'), hidden: true } + { path: '/401', component: () => import('@/views/errorPage/401'), hidden: true }, + { path: '/', redirect: '/toiletList', hidden: true } ] // 实例化vue的时候直挂载constantRouter export default new Router({ @@ -56,7 +60,10 @@ // 异步挂载路由 // 动态需要根据权限加载的路由表 export const asyncRouterMap = [ - ...exampleRouters, - ...systemRouters, + ...toiletRouters, + ...workRouters, + ...statisticsRouters, + ...ruleRouters, + // ...systemRouters, { path: '*', redirect: '/404', hidden: true } ] diff --git a/src/router/modules/rule.js b/src/router/modules/rule.js new file mode 100644 index 0000000..51e0283 --- /dev/null +++ b/src/router/modules/rule.js @@ -0,0 +1,24 @@ +/* Layout */ +import Layout from '@/layout/Layout' + +export const ruleRouters = [ + { + path: 'rule', + component: Layout, + redirect: '/rule', + name: 'Rule', + meta: { + title: '规章制度', + icon: 'icon-config', // 图标 + permission: ['/rule']// 权限名称 + }, + children: [ + { + path: '/rule', + name: 'Rule', + component: () => import('@/views/rule/listRule'), + meta: { title: '规章制度', icon: 'function', permission: ['/rule'] } + } + ] + } +] diff --git a/src/router/modules/statistics.js b/src/router/modules/statistics.js new file mode 100644 index 0000000..fb9cbea --- /dev/null +++ b/src/router/modules/statistics.js @@ -0,0 +1,30 @@ +/* Layout */ +import Layout from '@/layout/Layout' + +export const statisticsRouters = [ + { + path: 'statisticsToilet', + component: Layout, + redirect: '/workStatistics', + name: 'StatisticsToilet', + meta: { + title: '作业统计', + icon: 'icon-config', // 图标 + permission: ['/statisticsToilet']// 权限名称 + }, + children: [ + { + path: '/workStatistics', + name: 'WorkStatistics', + component: () => import('@/views/statistics/toiletAssessment'), + meta: { title: '作业统计', icon: '', permission: ['/toilet/workStatistics'] } + }, + { + path: '/evaluationStatistics', + name: 'EvaluationStatistics', + component: () => import('@/views/statistics/evaluationAssessment'), + meta: { title: '评价统计', icon: '', permission: ['/toilet/evaluationStatistics'] } + } + ] + } +] diff --git a/src/router/modules/toilet.js b/src/router/modules/toilet.js new file mode 100644 index 0000000..b221a0e --- /dev/null +++ b/src/router/modules/toilet.js @@ -0,0 +1,30 @@ +/* Layout */ +import Layout from '@/layout/Layout' + +export const toiletRouters = [ + { + path: 'toiletManage', + component: Layout, + redirect: '/toiletManage', + name: 'ToiletManage', + meta: { + title: '公厕管理', + icon: 'icon-config', // 图标 + permission: ['/toiletManage']// 权限名称 + }, + children: [ + { + path: '/toiletList', + name: 'ToiletList', + component: () => import('@/views/toiletManage/toiletList'), + meta: { title: '公厕台帐管理', icon: 'function', permission: ['/toiletList'] } + }, + { + path: '/toiletMap', + name: 'ToiletMap', + component: () => import('@/views/overview/overview'), + meta: { title: '地图总览', icon: 'function', permission: ['/toiletMap'] } + } + ] + } +] diff --git a/src/router/modules/work.js b/src/router/modules/work.js new file mode 100644 index 0000000..5e0759f --- /dev/null +++ b/src/router/modules/work.js @@ -0,0 +1,24 @@ +/* Layout */ +import Layout from '@/layout/Layout' + +export const workRouters = [ + { + path: 'toiletWork', + component: Layout, + redirect: '/toiletManage', + name: 'toiletWork', + meta: { + title: '作业管理', + icon: 'icon-config', // 图标 + permission: ['/toiletWork']// 权限名称 + }, + children: [ + { + path: '/toiletWork', + name: 'ToiletWork', + component: () => import('@/views/toiletClean/toiletCleanList'), + meta: { title: '作业管理', icon: 'function', permission: ['/toiletWork'] } + } + ] + } +] diff --git a/src/settings.js b/src/settings.js index b568ce0..b8159bf 100644 --- a/src/settings.js +++ b/src/settings.js @@ -3,7 +3,7 @@ * @type {boolean} true | false * @description 是否显示设置按钮 */ - showSettings: true, + showSettings: false, /** * @type {boolean} true | false diff --git a/src/store/modules/permission.js b/src/store/modules/permission.js index a0cb8cf..3ab50d5 100644 --- a/src/store/modules/permission.js +++ b/src/store/modules/permission.js @@ -120,17 +120,23 @@ }) }, // 获取用户权限 - GetMenus({ commit, state }) { - console.log('in store.permission.js:GetMenus:') + GetMenus({ commit, state }, currentSystem) { + // console.log('in store.permission.js:GetMenus:') + console.log('获取' + currentSystem.name + '的菜单') + const params = { + parentCode: currentSystem.code // 传入该子系统的code,获取子系统的权限 + } return new Promise((resolve, reject) => { - getMenus(state.token).then(response => { // 处理返回值 + // 此处获取用户所有权限 + getMenus(params).then(response => { // 处理返回值 const data = response.data const menus = [] // 仅菜单 const btns = [] // 非菜单 if (data.menus && data.menus.length > 0) { - commit('SET_MENUS', data.menus) - for (const menu of data.menus) { // 遍历菜单,获取所有的权限项 - if (menu.ismenu === '1') { // 将是菜单的放入menus + const allmenus = [...data.menus] + commit('SET_MENUS', allmenus) + for (const menu of allmenus) { // 遍历菜单,获取所有的权限项 + if (menu.resourceType === '02' || menu.resourceType === '03') { // 将是菜单的放入menus const menu_tmp = {} menu_tmp.url = menu.url menu_tmp.icon = menu.icon @@ -142,11 +148,11 @@ btn_tmp.name = menu.name btn_tmp.icon = menu.icon btns.push(btn_tmp) - // console.log(menu.url) } } // 过滤路由表 - const accessedRouters = filterAsyncRouter(asyncRouterMap, menus) + let accessedRouters = filterAsyncRouter(asyncRouterMap, menus) + // accessedRouters = filterRedirect(accessedRouters) commit('SET_BTNS', btns) commit('SET_ROUTERS', accessedRouters) resolve(response) diff --git a/src/utils/baseConfig.js b/src/utils/baseConfig.js index 1f4fa38..999593e 100644 --- a/src/utils/baseConfig.js +++ b/src/utils/baseConfig.js @@ -1,5 +1,5 @@ const project = { - title: '后台管理系统前端基础框架' + title: '路桥养护子系统' } export function getProject() { return project diff --git a/src/utils/dateutils.js b/src/utils/dateutils.js index 868111a..5cd16af 100644 --- a/src/utils/dateutils.js +++ b/src/utils/dateutils.js @@ -15,15 +15,15 @@ return ct_month } -export function getLastWeek() { // 默认显示上周 +export function getLastWeek(fmt) { // 默认显示上周 const ct_month = new Date() ct_month.setTime(ct_month.getTime() - 3600 * 1000 * 24 * 7) - return ct_month + return ct_month.Format(fmt) } -export function getLastMonth() { // 默认显示上个月 +export function getLastMonth(fmt) { // 默认显示上个月 const ct_month = new Date() ct_month.setTime(ct_month.getTime() - 3600 * 1000 * 24 * 30) - return ct_month + return ct_month.Format(fmt) } // 对Date的扩展,将 Date 转化为指定格式的String diff --git a/src/utils/exportutils.js b/src/utils/exportutils.js new file mode 100644 index 0000000..b5d0bcf --- /dev/null +++ b/src/utils/exportutils.js @@ -0,0 +1,19 @@ +/** + * 导出文件工具 + * @param blob 文件 + * @param fileName 导出文件名 + */ +export function exportFile(blob, fileName) { + if (window.navigator && window.navigator.msSaveOrOpenBlob) { + navigator.msSaveBlob(blob, fileName) + } else { + const downloadElement = document.createElement('a') + const href = window.URL.createObjectURL(blob) // 创建下载的链接 + downloadElement.href = href + downloadElement.download = fileName + document.body.appendChild(downloadElement) + downloadElement.click() // 点击下载 + document.body.removeChild(downloadElement) // 下载完成移除元素 + window.URL.revokeObjectURL(href) // 释放blob对象 + } +} diff --git a/src/utils/request.js b/src/utils/request.js index c88ea76..dc56e26 100644 --- a/src/utils/request.js +++ b/src/utils/request.js @@ -17,6 +17,13 @@ config.headers['token'] = getToken() // 让每个请求携带自定义token 请根据实际情况自行修改 console.log(config.headers['token']) } + // 在接口增加时间戳 + // if (config.method === 'get') { + config.params = { + _t: Date.parse(new Date()) / 1000, + ...config.params + } + // } return config }, error => { diff --git a/src/views/mapViews/choosePointDialog.vue b/src/views/mapViews/choosePointDialog.vue new file mode 100644 index 0000000..c9dde8a --- /dev/null +++ b/src/views/mapViews/choosePointDialog.vue @@ -0,0 +1,105 @@ + + + + + diff --git a/src/views/mapViews/mapView.vue b/src/views/mapViews/mapView.vue new file mode 100644 index 0000000..a18db88 --- /dev/null +++ b/src/views/mapViews/mapView.vue @@ -0,0 +1,73 @@ + + + + + diff --git a/src/views/order/editOrder.vue b/src/views/order/editOrder.vue new file mode 100644 index 0000000..4a5fd8a --- /dev/null +++ b/src/views/order/editOrder.vue @@ -0,0 +1,319 @@ + + + + + diff --git a/src/views/order/listMaintainRecords.vue b/src/views/order/listMaintainRecords.vue new file mode 100644 index 0000000..2d4f682 --- /dev/null +++ b/src/views/order/listMaintainRecords.vue @@ -0,0 +1,327 @@ + + + + + diff --git a/src/views/overview/overview.vue b/src/views/overview/overview.vue new file mode 100644 index 0000000..9525867 --- /dev/null +++ b/src/views/overview/overview.vue @@ -0,0 +1,285 @@ + + + + + diff --git a/src/views/overview/toiletDetailDialog.vue b/src/views/overview/toiletDetailDialog.vue new file mode 100644 index 0000000..2b3a511 --- /dev/null +++ b/src/views/overview/toiletDetailDialog.vue @@ -0,0 +1,263 @@ + + + + + + diff --git a/src/views/overview/toiletLayer.vue b/src/views/overview/toiletLayer.vue new file mode 100644 index 0000000..d784323 --- /dev/null +++ b/src/views/overview/toiletLayer.vue @@ -0,0 +1,152 @@ + + + + + + diff --git a/src/views/rule/listRule.vue b/src/views/rule/listRule.vue new file mode 100644 index 0000000..a19b9e4 --- /dev/null +++ b/src/views/rule/listRule.vue @@ -0,0 +1,157 @@ + + + + + diff --git a/src/views/statistics/barChart.vue b/src/views/statistics/barChart.vue new file mode 100644 index 0000000..d10eb38 --- /dev/null +++ b/src/views/statistics/barChart.vue @@ -0,0 +1,65 @@ + + + + + diff --git a/src/views/statistics/components/evaluationListDialog.vue b/src/views/statistics/components/evaluationListDialog.vue new file mode 100644 index 0000000..1560772 --- /dev/null +++ b/src/views/statistics/components/evaluationListDialog.vue @@ -0,0 +1,100 @@ + + + + + + diff --git a/src/views/statistics/components/workChart.vue b/src/views/statistics/components/workChart.vue new file mode 100644 index 0000000..a891e0c --- /dev/null +++ b/src/views/statistics/components/workChart.vue @@ -0,0 +1,79 @@ + + + + + diff --git a/src/views/statistics/evaluationAssessment.vue b/src/views/statistics/evaluationAssessment.vue new file mode 100644 index 0000000..28dedc5 --- /dev/null +++ b/src/views/statistics/evaluationAssessment.vue @@ -0,0 +1,159 @@ + + + + + + diff --git a/src/views/statistics/pieChart.vue b/src/views/statistics/pieChart.vue new file mode 100644 index 0000000..e4dd287 --- /dev/null +++ b/src/views/statistics/pieChart.vue @@ -0,0 +1,58 @@ + + + + + diff --git a/src/views/statistics/statisticsChart.vue b/src/views/statistics/statisticsChart.vue new file mode 100644 index 0000000..2c48fe0 --- /dev/null +++ b/src/views/statistics/statisticsChart.vue @@ -0,0 +1,87 @@ + + + + + diff --git a/src/views/statistics/toiletAssessment.vue b/src/views/statistics/toiletAssessment.vue new file mode 100644 index 0000000..67aa32b --- /dev/null +++ b/src/views/statistics/toiletAssessment.vue @@ -0,0 +1,242 @@ + + + + + diff --git a/src/views/statistics/workStatistics.vue b/src/views/statistics/workStatistics.vue new file mode 100644 index 0000000..50a07f2 --- /dev/null +++ b/src/views/statistics/workStatistics.vue @@ -0,0 +1,191 @@ + + + + + diff --git a/src/views/toilet/components/detail.vue b/src/views/toilet/components/detail.vue new file mode 100644 index 0000000..247c03d --- /dev/null +++ b/src/views/toilet/components/detail.vue @@ -0,0 +1,431 @@ + + + + diff --git a/src/views/toilet/components/editToilet.vue b/src/views/toilet/components/editToilet.vue new file mode 100644 index 0000000..000deea --- /dev/null +++ b/src/views/toilet/components/editToilet.vue @@ -0,0 +1,368 @@ + + + + + diff --git a/config/index.js b/config/index.js index 8abd37a..19b33b1 100644 --- a/config/index.js +++ b/config/index.js @@ -69,7 +69,7 @@ * then assetsPublicPath should be set to "/bar/". * In most cases please use '/' !!! */ - assetsPublicPath: '/', + assetsPublicPath: '/toilet/', /** * Source Maps diff --git a/package.json b/package.json index 45f055f..9f3a3eb 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "echarts": "^4.2.1", "element-ui": "2.13.0", "event-source-polyfill": "^1.0.5", + "file-saver": "^2.0.5", "js-cookie": "2.2.0", "jsencrypt": "^3.0.0-rc.1", "leaflet": "^1.7.1", @@ -33,7 +34,9 @@ "vue-amap": "^0.5.9", "vue-baidu-map": "^0.21.22", "vue-router": "3.0.1", - "vuex": "3.0.1" + "vue2-leaflet": "^2.7.0", + "vuex": "3.0.1", + "xlsx": "^0.17.0" }, "devDependencies": { "autoprefixer": "8.5.0", diff --git a/src/api/common.js b/src/api/common.js index 87c582b..7804714 100644 --- a/src/api/common.js +++ b/src/api/common.js @@ -2,10 +2,14 @@ * 常用接口 */ import request from '@/utils/request' +import Vue from 'vue' + // 模板下载 export function downloadTemplate(fileName) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath return request({ - url: 'template/download', + url: lampPath + 'template/download', method: 'get', params: { filename: fileName @@ -19,7 +23,7 @@ const param = new FormData() param.append('file', fileobj.file) return request({ - url: 'imageUpload', + url: 'fileUpload', method: 'post', headers: { 'Content-Type': 'multipart/form-data' }, data: param diff --git a/src/api/sanitation/statistics.js b/src/api/sanitation/statistics.js new file mode 100644 index 0000000..ffeac18 --- /dev/null +++ b/src/api/sanitation/statistics.js @@ -0,0 +1,22 @@ + +/** + * 考核统计接口 + */ +import request from '@/utils/request' +// 公厕保洁次数统计 +export function getToiletJobCount(params) { + return request({ + url: '/sanitation/statistic/toilet/jobCount', + method: 'get', + params + }) +} + +// 公厕评分统计 +export function getToiletEvaluation(params) { + return request({ + url: '/sanitation/toiletEvaluation/statistics', + method: 'get', + params + }) +} diff --git a/src/api/sanitation/toilet.js b/src/api/sanitation/toilet.js new file mode 100644 index 0000000..11affd4 --- /dev/null +++ b/src/api/sanitation/toilet.js @@ -0,0 +1,133 @@ +/** + * 公厕管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' +// 公厕查询 +export function getToiletListPage(params) { + return request({ + url: '/sanitation/toilet/listPage', + method: 'get', + params + }) +} +// 公厕查询 +export function getToiletList(pid) { + return request({ + url: '/sanitation/toilet/list', + method: 'get', + params: { + pid: pid + } + }) +} + +// 添加公厕 +export function addToilet(params) { + return request({ + url: '/sanitation/toilet/add', + method: 'post', + params + }) +} +// 修改公厕机构 +export function updateToilet(params) { + return request({ + url: '/sanitation/toilet/update', + method: 'post', + params + }) +} +// 删除公厕机构 +export function delToilet(ids) { + return request({ + url: '/sanitation/toilet/delete', + method: 'post', + params: { + ids + }, + paramsSerializer: params => { + return qs.stringify(params, { indices: false }) + } + }) +} + +// 公厕基本信息详情 +export function getToiletInfoDetail(id) { + return request({ + url: '/sanitation/toilet/detail?toiletId=' + id, + method: 'get' + }) +} + +// 某公厕保洁记录 +export function getRecordsByToilet(params) { + return request({ + url: '/sanitation/toilet/jobRecord/detail', + method: 'get', + params + }) +} + +// 某公厕平均评分 +export function getScoreByToilet(params) { + return request({ + url: '/sanitation/toiletEvaluation/detailScore', + method: 'get', + params + }) +} + +// 某公厕评分列表 +export function getScoreListByToilet(params) { + return request({ + url: '/sanitation/toiletEvaluation/list', + method: 'get', + params + }) +} + + +// 批量导入 +export function batchImportToilet(fileobj) { + const param = new FormData() + param.append('file', fileobj) + return request({ + url: '/sanitation/toilet/import', + method: 'post', + headers: { 'Content-Type': 'multipart/form-data' }, + data: param + }) +} +// 批量导出 +export function batchExportToilet(params, config) { + return request({ + url: '/sanitation/toilet/export', + method: 'get', + timeout: 120000, + params, + ...config, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 公厕保洁记录查询 +export function getToiletJobRecords(params) { + return request({ + url: '/sanitation/toilet/jobRecord', + method: 'get', + params + }) +} + +// 批量导出 +export function batchExportToiletJobRecords(params, config) { + return request({ + url: '/sanitation/toilet/exportJobRecord', + method: 'get', + timeout: 120000, + params, + ...config, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} diff --git a/src/api/system/alarm.js b/src/api/system/alarm.js new file mode 100644 index 0000000..1c3a7ab --- /dev/null +++ b/src/api/system/alarm.js @@ -0,0 +1,62 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' + +// 获取当前报警列表 +export function getAlarmNowList(params) { + return request({ + url: '/alarm/listNowPage', + method: 'get', + params + }) +} + +// 获取当前报警列表 +export function getAlarmHistoryList(params) { + return request({ + url: '/alarm/listHisPage', + method: 'get', + params + }) +} + + +// 批量消警 +export function clearAll(params) { + return request({ + url: '/alarm/allClear', + method: 'get', + params + }) +} + +// 消警 +export function clearAlarm(params) { + return request({ + url: '/alarm/cancel', + method: 'get', + params + }) +} + +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 设置报警阈值 +export function setThresh(params) { + return request({ + url: '/alarm/resetAlarmRule', + method: 'post', + params + }) +} diff --git a/src/api/system/bridge.js b/src/api/system/bridge.js new file mode 100644 index 0000000..e8a4108 --- /dev/null +++ b/src/api/system/bridge.js @@ -0,0 +1,80 @@ +/** + * 桥梁管理接口 + */ +import request from '@/utils/request' + +// 获取桥梁详情 +export function getDetail(id) { + return request({ + url: '/bridge/detail', + method: 'get', + params: { + id: id + } + }) +} + +export function updateBridge(params) { + return request({ + url: '/bridge/update', + method: 'post', + params + }) +} +// 批量导出 +export function exportRecords(params) { + return request({ + url: 'device/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +export function getContentList(params) { + return request({ + url: 'maintain/contentByType', + method: 'get', + params: { + type: params + } + }) +} +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 编辑 +export function editRecord(params) { + return request({ + url: 'maintain/update', + method: 'post', + params + }) +} +// 新增 +export function addRecord(params) { + return request({ + url: 'maintain/add', + method: 'post', + params + }) +} +// 删除 +export function delRecord(id) { + return request({ + url: 'maintain/delete', + method: 'post', + params: { + id: id + } + }) +} diff --git a/src/api/system/data.js b/src/api/system/data.js new file mode 100644 index 0000000..4c95db5 --- /dev/null +++ b/src/api/system/data.js @@ -0,0 +1,63 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' + +// 获取当前报警列表 +export function getHistoryList(params) { + return request({ + url: '/data/hisListPage', + method: 'get', + params + }) +} + +// 获取当前报警列表 +export function getHistory(params) { + return request({ + url: '/data/hisList', + method: 'get', + params + }) +} + + + +// 批量消警 +export function clearAll(params) { + return request({ + url: '/alarm/allClear', + method: 'get', + params + }) +} + +// 消警 +export function clearAlarm(params) { + return request({ + url: '/alarm/cancel', + method: 'get', + params + }) +} + +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 设置报警阈值 +export function setThresh(params) { + return request({ + url: '/alarm/resetAlarmRule', + method: 'post', + params + }) +} diff --git a/src/api/system/order.js b/src/api/system/order.js new file mode 100644 index 0000000..7007c50 --- /dev/null +++ b/src/api/system/order.js @@ -0,0 +1,71 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +// import qs from 'qs' + +// 获取当前报警列表 +export function getRecordList(params) { + return request({ + url: '/maintain/listPage', + method: 'get', + params + }) +} +// 批量导出 +export function exportRecords(params) { + return request({ + url: 'device/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +export function getContentList(params) { + return request({ + url: 'maintain/contentByType', + method: 'get', + params: { + type: params + } + }) +} +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 编辑 +export function editRecord(params) { + return request({ + url: 'maintain/update', + method: 'post', + params + }) +} +// 新增 +export function addRecord(params) { + return request({ + url: 'maintain/add', + method: 'post', + params + }) +} +// 删除 +export function delRecord(id) { + return request({ + url: 'maintain/delete', + method: 'post', + params: { + bridgeMaintenanceId: id + } + }) +} diff --git a/src/api/system/overview.js b/src/api/system/overview.js new file mode 100644 index 0000000..bca50cc --- /dev/null +++ b/src/api/system/overview.js @@ -0,0 +1,109 @@ +import request from '@/utils/request' +import qs from "qs" +import Vue from 'vue' + +// 路灯状态统计 +export function getLampStatus() { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampStatus', + method: 'get' + }) +} + +// 路灯总览列表 +export function getLampList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampList', + method: 'get', + params + }) +} + +// 路灯详情 +export function getlampDetail(lampId) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampDetail', + method: 'get', + params: { + lampId: lampId + } + }) +} + +// 回路列表 +export function getCircuitList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/circuitList', + method: 'get', + params + }) +} + +// 灯箱列表 +export function getLampBoxList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampBoxList', + method: 'get', + params + }) +} +// 灯箱详情 +export function getLampBoxDetail(lampBoxId) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampBoxDetail', + method: 'get', + params: { + lampBoxId: lampBoxId + } + }) +} + +// 报警总览列表 +export function getAlarmList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/alarmList', + method: 'get', + params + }) +} + +// 报警详情 +export function getAlarmDetail(alarmId) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/alarmDetail', + method: 'get', + params: { + alarmId: alarmId + } + }) +} + +// 路灯控制 +export function lampControl(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampControl', + method: 'post', + params, + paramsSerializer: params => { + return qs.stringify(params, { indices: false }) + } + }) +} diff --git a/src/api/system/rule.js b/src/api/system/rule.js new file mode 100644 index 0000000..76c6b2d --- /dev/null +++ b/src/api/system/rule.js @@ -0,0 +1,59 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +// import qs from 'qs' + +// 获取当前报警列表 +export function getRuleList() { + return request({ + url: 'rule/listPage', + method: 'get' + }) +} +export function getContentList(params) { + return request({ + url: 'maintain/contentByType', + method: 'get', + params: { + type: params + } + }) +} +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 编辑 +export function editRecord(params) { + return request({ + url: 'maintain/update', + method: 'post', + params + }) +} +// 新增 +export function addRecord(params) { + return request({ + url: 'maintain/add', + method: 'post', + params + }) +} +// 删除 +export function delRecord(id) { + return request({ + url: 'maintain/delete', + method: 'post', + params: { + id: id + } + }) +} diff --git a/src/api/system/statistics.js b/src/api/system/statistics.js new file mode 100644 index 0000000..b25efe9 --- /dev/null +++ b/src/api/system/statistics.js @@ -0,0 +1,23 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +// import qs from 'qs' + +// +export function countByToilet(params) { + return request({ + url: '/sanitation/toiletStatistic/jobStaticByToilet', + method: 'get', + params + }) +} + +export function countByDay(params) { + return request({ + url: '/sanitation/toiletStatistic/jobStaticByDate', + method: 'get', + params + }) +} + diff --git a/src/assets/global_images/icon-position.png b/src/assets/global_images/icon-position.png new file mode 100644 index 0000000..7444038 --- /dev/null +++ b/src/assets/global_images/icon-position.png Binary files differ diff --git a/src/assets/global_images/location_green.png b/src/assets/global_images/location_green.png new file mode 100644 index 0000000..aa8be65 --- /dev/null +++ b/src/assets/global_images/location_green.png Binary files differ diff --git a/src/assets/global_images/location_red.png b/src/assets/global_images/location_red.png new file mode 100644 index 0000000..2be8c3d --- /dev/null +++ b/src/assets/global_images/location_red.png Binary files differ diff --git a/src/assets/global_images/location_yellow.png b/src/assets/global_images/location_yellow.png new file mode 100644 index 0000000..5ab6f4d --- /dev/null +++ b/src/assets/global_images/location_yellow.png Binary files differ diff --git a/src/assets/global_images/toilet-position.png b/src/assets/global_images/toilet-position.png new file mode 100644 index 0000000..7db6d9a --- /dev/null +++ b/src/assets/global_images/toilet-position.png Binary files differ diff --git a/src/assets/global_images/toilet.png b/src/assets/global_images/toilet.png new file mode 100644 index 0000000..6d9fc05 --- /dev/null +++ b/src/assets/global_images/toilet.png Binary files differ diff --git a/src/assets/global_images/toiletPhoto.png b/src/assets/global_images/toiletPhoto.png new file mode 100644 index 0000000..15d08e2 --- /dev/null +++ b/src/assets/global_images/toiletPhoto.png Binary files differ diff --git a/src/components/DownloadTemplate/index.vue b/src/components/DownloadTemplate/index.vue index 8ded2cd..7807cac 100644 --- a/src/components/DownloadTemplate/index.vue +++ b/src/components/DownloadTemplate/index.vue @@ -47,8 +47,8 @@ diff --git a/src/components/NormalTable/index.vue b/src/components/NormalTable/index.vue index 5077bef..04d322d 100644 --- a/src/components/NormalTable/index.vue +++ b/src/components/NormalTable/index.vue @@ -79,7 +79,7 @@
-
+
Object.assign(obj, { [key]: this[key] }), {}), + on: events.reduce((obj, key) => Object.assign(obj, { [key]: this.transmitEvent }), {}) + }) + } + this.props = [...extraProps, ...props.filter(prop => exceptProps.indexOf(prop))] + } +} + +export default prop => new Mixin(prop) diff --git a/src/components/mapWindow/base/mixins/common.js b/src/components/mapWindow/base/mixins/common.js new file mode 100644 index 0000000..2fd1a28 --- /dev/null +++ b/src/components/mapWindow/base/mixins/common.js @@ -0,0 +1,82 @@ +const types = { + map: { + unload: 'clearMap' + }, + control: { + unload: 'removeControl' + }, + layer: { + unload: 'removeLayer' + }, + features: { + unload: 'removeFeatures' + }, + listener: { + unload: 'removeListener' + } +} + +const getParent = $component => ($component.abstract || $component.$el === $component.$children[0].$el) ? getParent($component.$parent) : $component + +function destroyInstance () { + const { unload, renderByParent, $parent } = this + if (renderByParent) { + $parent.reload() + } + unload() +} + +class Mixin { + constructor (prop) { + this.methods = { + ready () { + const $parent = getParent(this.$parent) + const map = this.map = $parent.map + this.load() + this.$emit('ready', { + map + }) + }, + transmitEvent (e) { + this.$emit(e.type.replace(/^on/, ''), e) + }, + reload () { + this && this.$nextTick(() => { + this.unload() + this.$nextTick(this.load) + }) + }, + unload () { + const { map, originInstance } = this + try { + switch (prop.type) { + case 'search': + return originInstance.clearResults() + case 'autoComplete': + case 'lushu': + return originInstance.dispose() + case 'markerClusterer': + return originInstance.clearMarkers() + default: + map[types[prop.type].unload](originInstance) + } + } catch (e) {} + } + } + this.computed = { + renderByParent () { + return this.$parent.preventChildrenRender + } + } + this.mounted = function () { + console.log('common mounted') + const $parent = getParent(this.$parent) + const map = $parent.map + const { ready } = this + console.log(map) + map ? ready() : $parent.$on('onload', ready) + } + } +} + +export default type => new Mixin({ type }) diff --git a/src/components/mapWindow/leafletMap.vue b/src/components/mapWindow/leafletMap.vue new file mode 100644 index 0000000..b753cc0 --- /dev/null +++ b/src/components/mapWindow/leafletMap.vue @@ -0,0 +1,143 @@ + + + + + + + diff --git a/src/components/mapWindow/mapWindow.vue b/src/components/mapWindow/mapWindow.vue new file mode 100644 index 0000000..9ced291 --- /dev/null +++ b/src/components/mapWindow/mapWindow.vue @@ -0,0 +1,46 @@ + + + + + + diff --git a/src/icons/svg/bridge.svg b/src/icons/svg/bridge.svg new file mode 100644 index 0000000..1a0336f --- /dev/null +++ b/src/icons/svg/bridge.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/icons/svg/toilet.svg b/src/icons/svg/toilet.svg new file mode 100644 index 0000000..9d8e765 --- /dev/null +++ b/src/icons/svg/toilet.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/main.js b/src/main.js index f2d105d..3e4074e 100644 --- a/src/main.js +++ b/src/main.js @@ -18,6 +18,9 @@ // echart // import echarts from 'echarts' // Vue.prototype.$echarts = echarts +// 引入v-charts +import VCharts from 'v-charts' +Vue.use(VCharts) // 将自动注册所有组件为全局组件 // import dataV from '@jiaminghi/data-view' @@ -35,9 +38,19 @@ Vue.component('search-item', SearchItem) // 加载leaflet的css +// import 'leaflet/dist/leaflet.css' +// import 'leaflet-draw/dist/leaflet.draw.css' +import L from 'leaflet' import 'leaflet/dist/leaflet.css' -import 'leaflet-draw/dist/leaflet.draw.css' +Vue.config.productionTip = false +Vue.L = Vue.prototype.$L = L +delete L.Icon.Default.prototype._getIconUrl +L.Icon.Default.mergeOptions({ + iconRetinaUrl: require('leaflet/dist/images/marker-icon-2x.png'), + iconUrl: require('leaflet/dist/images/marker-icon.png'), + shadowUrl: require('leaflet/dist/images/marker-shadow.png') +}) /** * This project originally used easy-mock to simulate data, * but its official service is very unstable, diff --git a/src/permission.js b/src/permission.js index dc6b2f8..809ca86 100644 --- a/src/permission.js +++ b/src/permission.js @@ -25,8 +25,8 @@ store.dispatch('GetInfo').then(res => { // 拉取用户信息 // 设置当前子系统为基础资源子系统 const currentSys = { - code: 'baseResourse', - name: '基础资源子系统' + code: 'toliet', + name: '公共厕所管理系统' } // 将当前系统信息保存在localStorage中 store.commit('SET_SYSTEM', currentSys) diff --git a/src/router/index.js b/src/router/index.js index 39c295c..d23076d 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -8,8 +8,11 @@ /* Layout */ import Layout from '@/layout/Layout' +import { toiletRouters } from './modules/toilet' +import { workRouters } from './modules/work' +import { statisticsRouters } from './modules/statistics' +import { ruleRouters } from './modules/rule' import { systemRouters } from './modules/system' -import { exampleRouters } from './modules/example' /** * hidden: true if `hidden:true` will not show in the sidebar(default is false) @@ -40,11 +43,12 @@ ] }, // 登录页面 - { path: '/login', component: () => import('@/views/login/index'), hidden: true }, + { path: '/login', component: () => import('@/views/login/index_2'), hidden: true }, // 404错误页面 { path: '/404', component: () => import('@/views/errorPage/404'), hidden: true }, // 401 错误页面 - { path: '/401', component: () => import('@/views/errorPage/401'), hidden: true } + { path: '/401', component: () => import('@/views/errorPage/401'), hidden: true }, + { path: '/', redirect: '/toiletList', hidden: true } ] // 实例化vue的时候直挂载constantRouter export default new Router({ @@ -56,7 +60,10 @@ // 异步挂载路由 // 动态需要根据权限加载的路由表 export const asyncRouterMap = [ - ...exampleRouters, - ...systemRouters, + ...toiletRouters, + ...workRouters, + ...statisticsRouters, + ...ruleRouters, + // ...systemRouters, { path: '*', redirect: '/404', hidden: true } ] diff --git a/src/router/modules/rule.js b/src/router/modules/rule.js new file mode 100644 index 0000000..51e0283 --- /dev/null +++ b/src/router/modules/rule.js @@ -0,0 +1,24 @@ +/* Layout */ +import Layout from '@/layout/Layout' + +export const ruleRouters = [ + { + path: 'rule', + component: Layout, + redirect: '/rule', + name: 'Rule', + meta: { + title: '规章制度', + icon: 'icon-config', // 图标 + permission: ['/rule']// 权限名称 + }, + children: [ + { + path: '/rule', + name: 'Rule', + component: () => import('@/views/rule/listRule'), + meta: { title: '规章制度', icon: 'function', permission: ['/rule'] } + } + ] + } +] diff --git a/src/router/modules/statistics.js b/src/router/modules/statistics.js new file mode 100644 index 0000000..fb9cbea --- /dev/null +++ b/src/router/modules/statistics.js @@ -0,0 +1,30 @@ +/* Layout */ +import Layout from '@/layout/Layout' + +export const statisticsRouters = [ + { + path: 'statisticsToilet', + component: Layout, + redirect: '/workStatistics', + name: 'StatisticsToilet', + meta: { + title: '作业统计', + icon: 'icon-config', // 图标 + permission: ['/statisticsToilet']// 权限名称 + }, + children: [ + { + path: '/workStatistics', + name: 'WorkStatistics', + component: () => import('@/views/statistics/toiletAssessment'), + meta: { title: '作业统计', icon: '', permission: ['/toilet/workStatistics'] } + }, + { + path: '/evaluationStatistics', + name: 'EvaluationStatistics', + component: () => import('@/views/statistics/evaluationAssessment'), + meta: { title: '评价统计', icon: '', permission: ['/toilet/evaluationStatistics'] } + } + ] + } +] diff --git a/src/router/modules/toilet.js b/src/router/modules/toilet.js new file mode 100644 index 0000000..b221a0e --- /dev/null +++ b/src/router/modules/toilet.js @@ -0,0 +1,30 @@ +/* Layout */ +import Layout from '@/layout/Layout' + +export const toiletRouters = [ + { + path: 'toiletManage', + component: Layout, + redirect: '/toiletManage', + name: 'ToiletManage', + meta: { + title: '公厕管理', + icon: 'icon-config', // 图标 + permission: ['/toiletManage']// 权限名称 + }, + children: [ + { + path: '/toiletList', + name: 'ToiletList', + component: () => import('@/views/toiletManage/toiletList'), + meta: { title: '公厕台帐管理', icon: 'function', permission: ['/toiletList'] } + }, + { + path: '/toiletMap', + name: 'ToiletMap', + component: () => import('@/views/overview/overview'), + meta: { title: '地图总览', icon: 'function', permission: ['/toiletMap'] } + } + ] + } +] diff --git a/src/router/modules/work.js b/src/router/modules/work.js new file mode 100644 index 0000000..5e0759f --- /dev/null +++ b/src/router/modules/work.js @@ -0,0 +1,24 @@ +/* Layout */ +import Layout from '@/layout/Layout' + +export const workRouters = [ + { + path: 'toiletWork', + component: Layout, + redirect: '/toiletManage', + name: 'toiletWork', + meta: { + title: '作业管理', + icon: 'icon-config', // 图标 + permission: ['/toiletWork']// 权限名称 + }, + children: [ + { + path: '/toiletWork', + name: 'ToiletWork', + component: () => import('@/views/toiletClean/toiletCleanList'), + meta: { title: '作业管理', icon: 'function', permission: ['/toiletWork'] } + } + ] + } +] diff --git a/src/settings.js b/src/settings.js index b568ce0..b8159bf 100644 --- a/src/settings.js +++ b/src/settings.js @@ -3,7 +3,7 @@ * @type {boolean} true | false * @description 是否显示设置按钮 */ - showSettings: true, + showSettings: false, /** * @type {boolean} true | false diff --git a/src/store/modules/permission.js b/src/store/modules/permission.js index a0cb8cf..3ab50d5 100644 --- a/src/store/modules/permission.js +++ b/src/store/modules/permission.js @@ -120,17 +120,23 @@ }) }, // 获取用户权限 - GetMenus({ commit, state }) { - console.log('in store.permission.js:GetMenus:') + GetMenus({ commit, state }, currentSystem) { + // console.log('in store.permission.js:GetMenus:') + console.log('获取' + currentSystem.name + '的菜单') + const params = { + parentCode: currentSystem.code // 传入该子系统的code,获取子系统的权限 + } return new Promise((resolve, reject) => { - getMenus(state.token).then(response => { // 处理返回值 + // 此处获取用户所有权限 + getMenus(params).then(response => { // 处理返回值 const data = response.data const menus = [] // 仅菜单 const btns = [] // 非菜单 if (data.menus && data.menus.length > 0) { - commit('SET_MENUS', data.menus) - for (const menu of data.menus) { // 遍历菜单,获取所有的权限项 - if (menu.ismenu === '1') { // 将是菜单的放入menus + const allmenus = [...data.menus] + commit('SET_MENUS', allmenus) + for (const menu of allmenus) { // 遍历菜单,获取所有的权限项 + if (menu.resourceType === '02' || menu.resourceType === '03') { // 将是菜单的放入menus const menu_tmp = {} menu_tmp.url = menu.url menu_tmp.icon = menu.icon @@ -142,11 +148,11 @@ btn_tmp.name = menu.name btn_tmp.icon = menu.icon btns.push(btn_tmp) - // console.log(menu.url) } } // 过滤路由表 - const accessedRouters = filterAsyncRouter(asyncRouterMap, menus) + let accessedRouters = filterAsyncRouter(asyncRouterMap, menus) + // accessedRouters = filterRedirect(accessedRouters) commit('SET_BTNS', btns) commit('SET_ROUTERS', accessedRouters) resolve(response) diff --git a/src/utils/baseConfig.js b/src/utils/baseConfig.js index 1f4fa38..999593e 100644 --- a/src/utils/baseConfig.js +++ b/src/utils/baseConfig.js @@ -1,5 +1,5 @@ const project = { - title: '后台管理系统前端基础框架' + title: '路桥养护子系统' } export function getProject() { return project diff --git a/src/utils/dateutils.js b/src/utils/dateutils.js index 868111a..5cd16af 100644 --- a/src/utils/dateutils.js +++ b/src/utils/dateutils.js @@ -15,15 +15,15 @@ return ct_month } -export function getLastWeek() { // 默认显示上周 +export function getLastWeek(fmt) { // 默认显示上周 const ct_month = new Date() ct_month.setTime(ct_month.getTime() - 3600 * 1000 * 24 * 7) - return ct_month + return ct_month.Format(fmt) } -export function getLastMonth() { // 默认显示上个月 +export function getLastMonth(fmt) { // 默认显示上个月 const ct_month = new Date() ct_month.setTime(ct_month.getTime() - 3600 * 1000 * 24 * 30) - return ct_month + return ct_month.Format(fmt) } // 对Date的扩展,将 Date 转化为指定格式的String diff --git a/src/utils/exportutils.js b/src/utils/exportutils.js new file mode 100644 index 0000000..b5d0bcf --- /dev/null +++ b/src/utils/exportutils.js @@ -0,0 +1,19 @@ +/** + * 导出文件工具 + * @param blob 文件 + * @param fileName 导出文件名 + */ +export function exportFile(blob, fileName) { + if (window.navigator && window.navigator.msSaveOrOpenBlob) { + navigator.msSaveBlob(blob, fileName) + } else { + const downloadElement = document.createElement('a') + const href = window.URL.createObjectURL(blob) // 创建下载的链接 + downloadElement.href = href + downloadElement.download = fileName + document.body.appendChild(downloadElement) + downloadElement.click() // 点击下载 + document.body.removeChild(downloadElement) // 下载完成移除元素 + window.URL.revokeObjectURL(href) // 释放blob对象 + } +} diff --git a/src/utils/request.js b/src/utils/request.js index c88ea76..dc56e26 100644 --- a/src/utils/request.js +++ b/src/utils/request.js @@ -17,6 +17,13 @@ config.headers['token'] = getToken() // 让每个请求携带自定义token 请根据实际情况自行修改 console.log(config.headers['token']) } + // 在接口增加时间戳 + // if (config.method === 'get') { + config.params = { + _t: Date.parse(new Date()) / 1000, + ...config.params + } + // } return config }, error => { diff --git a/src/views/mapViews/choosePointDialog.vue b/src/views/mapViews/choosePointDialog.vue new file mode 100644 index 0000000..c9dde8a --- /dev/null +++ b/src/views/mapViews/choosePointDialog.vue @@ -0,0 +1,105 @@ + + + + + diff --git a/src/views/mapViews/mapView.vue b/src/views/mapViews/mapView.vue new file mode 100644 index 0000000..a18db88 --- /dev/null +++ b/src/views/mapViews/mapView.vue @@ -0,0 +1,73 @@ + + + + + diff --git a/src/views/order/editOrder.vue b/src/views/order/editOrder.vue new file mode 100644 index 0000000..4a5fd8a --- /dev/null +++ b/src/views/order/editOrder.vue @@ -0,0 +1,319 @@ + + + + + diff --git a/src/views/order/listMaintainRecords.vue b/src/views/order/listMaintainRecords.vue new file mode 100644 index 0000000..2d4f682 --- /dev/null +++ b/src/views/order/listMaintainRecords.vue @@ -0,0 +1,327 @@ + + + + + diff --git a/src/views/overview/overview.vue b/src/views/overview/overview.vue new file mode 100644 index 0000000..9525867 --- /dev/null +++ b/src/views/overview/overview.vue @@ -0,0 +1,285 @@ + + + + + diff --git a/src/views/overview/toiletDetailDialog.vue b/src/views/overview/toiletDetailDialog.vue new file mode 100644 index 0000000..2b3a511 --- /dev/null +++ b/src/views/overview/toiletDetailDialog.vue @@ -0,0 +1,263 @@ + + + + + + diff --git a/src/views/overview/toiletLayer.vue b/src/views/overview/toiletLayer.vue new file mode 100644 index 0000000..d784323 --- /dev/null +++ b/src/views/overview/toiletLayer.vue @@ -0,0 +1,152 @@ + + + + + + diff --git a/src/views/rule/listRule.vue b/src/views/rule/listRule.vue new file mode 100644 index 0000000..a19b9e4 --- /dev/null +++ b/src/views/rule/listRule.vue @@ -0,0 +1,157 @@ + + + + + diff --git a/src/views/statistics/barChart.vue b/src/views/statistics/barChart.vue new file mode 100644 index 0000000..d10eb38 --- /dev/null +++ b/src/views/statistics/barChart.vue @@ -0,0 +1,65 @@ + + + + + diff --git a/src/views/statistics/components/evaluationListDialog.vue b/src/views/statistics/components/evaluationListDialog.vue new file mode 100644 index 0000000..1560772 --- /dev/null +++ b/src/views/statistics/components/evaluationListDialog.vue @@ -0,0 +1,100 @@ + + + + + + diff --git a/src/views/statistics/components/workChart.vue b/src/views/statistics/components/workChart.vue new file mode 100644 index 0000000..a891e0c --- /dev/null +++ b/src/views/statistics/components/workChart.vue @@ -0,0 +1,79 @@ + + + + + diff --git a/src/views/statistics/evaluationAssessment.vue b/src/views/statistics/evaluationAssessment.vue new file mode 100644 index 0000000..28dedc5 --- /dev/null +++ b/src/views/statistics/evaluationAssessment.vue @@ -0,0 +1,159 @@ + + + + + + diff --git a/src/views/statistics/pieChart.vue b/src/views/statistics/pieChart.vue new file mode 100644 index 0000000..e4dd287 --- /dev/null +++ b/src/views/statistics/pieChart.vue @@ -0,0 +1,58 @@ + + + + + diff --git a/src/views/statistics/statisticsChart.vue b/src/views/statistics/statisticsChart.vue new file mode 100644 index 0000000..2c48fe0 --- /dev/null +++ b/src/views/statistics/statisticsChart.vue @@ -0,0 +1,87 @@ + + + + + diff --git a/src/views/statistics/toiletAssessment.vue b/src/views/statistics/toiletAssessment.vue new file mode 100644 index 0000000..67aa32b --- /dev/null +++ b/src/views/statistics/toiletAssessment.vue @@ -0,0 +1,242 @@ + + + + + diff --git a/src/views/statistics/workStatistics.vue b/src/views/statistics/workStatistics.vue new file mode 100644 index 0000000..50a07f2 --- /dev/null +++ b/src/views/statistics/workStatistics.vue @@ -0,0 +1,191 @@ + + + + + diff --git a/src/views/toilet/components/detail.vue b/src/views/toilet/components/detail.vue new file mode 100644 index 0000000..247c03d --- /dev/null +++ b/src/views/toilet/components/detail.vue @@ -0,0 +1,431 @@ + + + + diff --git a/src/views/toilet/components/editToilet.vue b/src/views/toilet/components/editToilet.vue new file mode 100644 index 0000000..000deea --- /dev/null +++ b/src/views/toilet/components/editToilet.vue @@ -0,0 +1,368 @@ + + + + + diff --git a/src/views/toilet/listToilet.vue b/src/views/toilet/listToilet.vue new file mode 100644 index 0000000..2c5209e --- /dev/null +++ b/src/views/toilet/listToilet.vue @@ -0,0 +1,237 @@ + + + + + diff --git a/config/index.js b/config/index.js index 8abd37a..19b33b1 100644 --- a/config/index.js +++ b/config/index.js @@ -69,7 +69,7 @@ * then assetsPublicPath should be set to "/bar/". * In most cases please use '/' !!! */ - assetsPublicPath: '/', + assetsPublicPath: '/toilet/', /** * Source Maps diff --git a/package.json b/package.json index 45f055f..9f3a3eb 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "echarts": "^4.2.1", "element-ui": "2.13.0", "event-source-polyfill": "^1.0.5", + "file-saver": "^2.0.5", "js-cookie": "2.2.0", "jsencrypt": "^3.0.0-rc.1", "leaflet": "^1.7.1", @@ -33,7 +34,9 @@ "vue-amap": "^0.5.9", "vue-baidu-map": "^0.21.22", "vue-router": "3.0.1", - "vuex": "3.0.1" + "vue2-leaflet": "^2.7.0", + "vuex": "3.0.1", + "xlsx": "^0.17.0" }, "devDependencies": { "autoprefixer": "8.5.0", diff --git a/src/api/common.js b/src/api/common.js index 87c582b..7804714 100644 --- a/src/api/common.js +++ b/src/api/common.js @@ -2,10 +2,14 @@ * 常用接口 */ import request from '@/utils/request' +import Vue from 'vue' + // 模板下载 export function downloadTemplate(fileName) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath return request({ - url: 'template/download', + url: lampPath + 'template/download', method: 'get', params: { filename: fileName @@ -19,7 +23,7 @@ const param = new FormData() param.append('file', fileobj.file) return request({ - url: 'imageUpload', + url: 'fileUpload', method: 'post', headers: { 'Content-Type': 'multipart/form-data' }, data: param diff --git a/src/api/sanitation/statistics.js b/src/api/sanitation/statistics.js new file mode 100644 index 0000000..ffeac18 --- /dev/null +++ b/src/api/sanitation/statistics.js @@ -0,0 +1,22 @@ + +/** + * 考核统计接口 + */ +import request from '@/utils/request' +// 公厕保洁次数统计 +export function getToiletJobCount(params) { + return request({ + url: '/sanitation/statistic/toilet/jobCount', + method: 'get', + params + }) +} + +// 公厕评分统计 +export function getToiletEvaluation(params) { + return request({ + url: '/sanitation/toiletEvaluation/statistics', + method: 'get', + params + }) +} diff --git a/src/api/sanitation/toilet.js b/src/api/sanitation/toilet.js new file mode 100644 index 0000000..11affd4 --- /dev/null +++ b/src/api/sanitation/toilet.js @@ -0,0 +1,133 @@ +/** + * 公厕管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' +// 公厕查询 +export function getToiletListPage(params) { + return request({ + url: '/sanitation/toilet/listPage', + method: 'get', + params + }) +} +// 公厕查询 +export function getToiletList(pid) { + return request({ + url: '/sanitation/toilet/list', + method: 'get', + params: { + pid: pid + } + }) +} + +// 添加公厕 +export function addToilet(params) { + return request({ + url: '/sanitation/toilet/add', + method: 'post', + params + }) +} +// 修改公厕机构 +export function updateToilet(params) { + return request({ + url: '/sanitation/toilet/update', + method: 'post', + params + }) +} +// 删除公厕机构 +export function delToilet(ids) { + return request({ + url: '/sanitation/toilet/delete', + method: 'post', + params: { + ids + }, + paramsSerializer: params => { + return qs.stringify(params, { indices: false }) + } + }) +} + +// 公厕基本信息详情 +export function getToiletInfoDetail(id) { + return request({ + url: '/sanitation/toilet/detail?toiletId=' + id, + method: 'get' + }) +} + +// 某公厕保洁记录 +export function getRecordsByToilet(params) { + return request({ + url: '/sanitation/toilet/jobRecord/detail', + method: 'get', + params + }) +} + +// 某公厕平均评分 +export function getScoreByToilet(params) { + return request({ + url: '/sanitation/toiletEvaluation/detailScore', + method: 'get', + params + }) +} + +// 某公厕评分列表 +export function getScoreListByToilet(params) { + return request({ + url: '/sanitation/toiletEvaluation/list', + method: 'get', + params + }) +} + + +// 批量导入 +export function batchImportToilet(fileobj) { + const param = new FormData() + param.append('file', fileobj) + return request({ + url: '/sanitation/toilet/import', + method: 'post', + headers: { 'Content-Type': 'multipart/form-data' }, + data: param + }) +} +// 批量导出 +export function batchExportToilet(params, config) { + return request({ + url: '/sanitation/toilet/export', + method: 'get', + timeout: 120000, + params, + ...config, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 公厕保洁记录查询 +export function getToiletJobRecords(params) { + return request({ + url: '/sanitation/toilet/jobRecord', + method: 'get', + params + }) +} + +// 批量导出 +export function batchExportToiletJobRecords(params, config) { + return request({ + url: '/sanitation/toilet/exportJobRecord', + method: 'get', + timeout: 120000, + params, + ...config, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} diff --git a/src/api/system/alarm.js b/src/api/system/alarm.js new file mode 100644 index 0000000..1c3a7ab --- /dev/null +++ b/src/api/system/alarm.js @@ -0,0 +1,62 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' + +// 获取当前报警列表 +export function getAlarmNowList(params) { + return request({ + url: '/alarm/listNowPage', + method: 'get', + params + }) +} + +// 获取当前报警列表 +export function getAlarmHistoryList(params) { + return request({ + url: '/alarm/listHisPage', + method: 'get', + params + }) +} + + +// 批量消警 +export function clearAll(params) { + return request({ + url: '/alarm/allClear', + method: 'get', + params + }) +} + +// 消警 +export function clearAlarm(params) { + return request({ + url: '/alarm/cancel', + method: 'get', + params + }) +} + +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 设置报警阈值 +export function setThresh(params) { + return request({ + url: '/alarm/resetAlarmRule', + method: 'post', + params + }) +} diff --git a/src/api/system/bridge.js b/src/api/system/bridge.js new file mode 100644 index 0000000..e8a4108 --- /dev/null +++ b/src/api/system/bridge.js @@ -0,0 +1,80 @@ +/** + * 桥梁管理接口 + */ +import request from '@/utils/request' + +// 获取桥梁详情 +export function getDetail(id) { + return request({ + url: '/bridge/detail', + method: 'get', + params: { + id: id + } + }) +} + +export function updateBridge(params) { + return request({ + url: '/bridge/update', + method: 'post', + params + }) +} +// 批量导出 +export function exportRecords(params) { + return request({ + url: 'device/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +export function getContentList(params) { + return request({ + url: 'maintain/contentByType', + method: 'get', + params: { + type: params + } + }) +} +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 编辑 +export function editRecord(params) { + return request({ + url: 'maintain/update', + method: 'post', + params + }) +} +// 新增 +export function addRecord(params) { + return request({ + url: 'maintain/add', + method: 'post', + params + }) +} +// 删除 +export function delRecord(id) { + return request({ + url: 'maintain/delete', + method: 'post', + params: { + id: id + } + }) +} diff --git a/src/api/system/data.js b/src/api/system/data.js new file mode 100644 index 0000000..4c95db5 --- /dev/null +++ b/src/api/system/data.js @@ -0,0 +1,63 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' + +// 获取当前报警列表 +export function getHistoryList(params) { + return request({ + url: '/data/hisListPage', + method: 'get', + params + }) +} + +// 获取当前报警列表 +export function getHistory(params) { + return request({ + url: '/data/hisList', + method: 'get', + params + }) +} + + + +// 批量消警 +export function clearAll(params) { + return request({ + url: '/alarm/allClear', + method: 'get', + params + }) +} + +// 消警 +export function clearAlarm(params) { + return request({ + url: '/alarm/cancel', + method: 'get', + params + }) +} + +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 设置报警阈值 +export function setThresh(params) { + return request({ + url: '/alarm/resetAlarmRule', + method: 'post', + params + }) +} diff --git a/src/api/system/order.js b/src/api/system/order.js new file mode 100644 index 0000000..7007c50 --- /dev/null +++ b/src/api/system/order.js @@ -0,0 +1,71 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +// import qs from 'qs' + +// 获取当前报警列表 +export function getRecordList(params) { + return request({ + url: '/maintain/listPage', + method: 'get', + params + }) +} +// 批量导出 +export function exportRecords(params) { + return request({ + url: 'device/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +export function getContentList(params) { + return request({ + url: 'maintain/contentByType', + method: 'get', + params: { + type: params + } + }) +} +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 编辑 +export function editRecord(params) { + return request({ + url: 'maintain/update', + method: 'post', + params + }) +} +// 新增 +export function addRecord(params) { + return request({ + url: 'maintain/add', + method: 'post', + params + }) +} +// 删除 +export function delRecord(id) { + return request({ + url: 'maintain/delete', + method: 'post', + params: { + bridgeMaintenanceId: id + } + }) +} diff --git a/src/api/system/overview.js b/src/api/system/overview.js new file mode 100644 index 0000000..bca50cc --- /dev/null +++ b/src/api/system/overview.js @@ -0,0 +1,109 @@ +import request from '@/utils/request' +import qs from "qs" +import Vue from 'vue' + +// 路灯状态统计 +export function getLampStatus() { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampStatus', + method: 'get' + }) +} + +// 路灯总览列表 +export function getLampList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampList', + method: 'get', + params + }) +} + +// 路灯详情 +export function getlampDetail(lampId) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampDetail', + method: 'get', + params: { + lampId: lampId + } + }) +} + +// 回路列表 +export function getCircuitList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/circuitList', + method: 'get', + params + }) +} + +// 灯箱列表 +export function getLampBoxList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampBoxList', + method: 'get', + params + }) +} +// 灯箱详情 +export function getLampBoxDetail(lampBoxId) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampBoxDetail', + method: 'get', + params: { + lampBoxId: lampBoxId + } + }) +} + +// 报警总览列表 +export function getAlarmList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/alarmList', + method: 'get', + params + }) +} + +// 报警详情 +export function getAlarmDetail(alarmId) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/alarmDetail', + method: 'get', + params: { + alarmId: alarmId + } + }) +} + +// 路灯控制 +export function lampControl(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampControl', + method: 'post', + params, + paramsSerializer: params => { + return qs.stringify(params, { indices: false }) + } + }) +} diff --git a/src/api/system/rule.js b/src/api/system/rule.js new file mode 100644 index 0000000..76c6b2d --- /dev/null +++ b/src/api/system/rule.js @@ -0,0 +1,59 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +// import qs from 'qs' + +// 获取当前报警列表 +export function getRuleList() { + return request({ + url: 'rule/listPage', + method: 'get' + }) +} +export function getContentList(params) { + return request({ + url: 'maintain/contentByType', + method: 'get', + params: { + type: params + } + }) +} +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 编辑 +export function editRecord(params) { + return request({ + url: 'maintain/update', + method: 'post', + params + }) +} +// 新增 +export function addRecord(params) { + return request({ + url: 'maintain/add', + method: 'post', + params + }) +} +// 删除 +export function delRecord(id) { + return request({ + url: 'maintain/delete', + method: 'post', + params: { + id: id + } + }) +} diff --git a/src/api/system/statistics.js b/src/api/system/statistics.js new file mode 100644 index 0000000..b25efe9 --- /dev/null +++ b/src/api/system/statistics.js @@ -0,0 +1,23 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +// import qs from 'qs' + +// +export function countByToilet(params) { + return request({ + url: '/sanitation/toiletStatistic/jobStaticByToilet', + method: 'get', + params + }) +} + +export function countByDay(params) { + return request({ + url: '/sanitation/toiletStatistic/jobStaticByDate', + method: 'get', + params + }) +} + diff --git a/src/assets/global_images/icon-position.png b/src/assets/global_images/icon-position.png new file mode 100644 index 0000000..7444038 --- /dev/null +++ b/src/assets/global_images/icon-position.png Binary files differ diff --git a/src/assets/global_images/location_green.png b/src/assets/global_images/location_green.png new file mode 100644 index 0000000..aa8be65 --- /dev/null +++ b/src/assets/global_images/location_green.png Binary files differ diff --git a/src/assets/global_images/location_red.png b/src/assets/global_images/location_red.png new file mode 100644 index 0000000..2be8c3d --- /dev/null +++ b/src/assets/global_images/location_red.png Binary files differ diff --git a/src/assets/global_images/location_yellow.png b/src/assets/global_images/location_yellow.png new file mode 100644 index 0000000..5ab6f4d --- /dev/null +++ b/src/assets/global_images/location_yellow.png Binary files differ diff --git a/src/assets/global_images/toilet-position.png b/src/assets/global_images/toilet-position.png new file mode 100644 index 0000000..7db6d9a --- /dev/null +++ b/src/assets/global_images/toilet-position.png Binary files differ diff --git a/src/assets/global_images/toilet.png b/src/assets/global_images/toilet.png new file mode 100644 index 0000000..6d9fc05 --- /dev/null +++ b/src/assets/global_images/toilet.png Binary files differ diff --git a/src/assets/global_images/toiletPhoto.png b/src/assets/global_images/toiletPhoto.png new file mode 100644 index 0000000..15d08e2 --- /dev/null +++ b/src/assets/global_images/toiletPhoto.png Binary files differ diff --git a/src/components/DownloadTemplate/index.vue b/src/components/DownloadTemplate/index.vue index 8ded2cd..7807cac 100644 --- a/src/components/DownloadTemplate/index.vue +++ b/src/components/DownloadTemplate/index.vue @@ -47,8 +47,8 @@ diff --git a/src/components/NormalTable/index.vue b/src/components/NormalTable/index.vue index 5077bef..04d322d 100644 --- a/src/components/NormalTable/index.vue +++ b/src/components/NormalTable/index.vue @@ -79,7 +79,7 @@
-
+
Object.assign(obj, { [key]: this[key] }), {}), + on: events.reduce((obj, key) => Object.assign(obj, { [key]: this.transmitEvent }), {}) + }) + } + this.props = [...extraProps, ...props.filter(prop => exceptProps.indexOf(prop))] + } +} + +export default prop => new Mixin(prop) diff --git a/src/components/mapWindow/base/mixins/common.js b/src/components/mapWindow/base/mixins/common.js new file mode 100644 index 0000000..2fd1a28 --- /dev/null +++ b/src/components/mapWindow/base/mixins/common.js @@ -0,0 +1,82 @@ +const types = { + map: { + unload: 'clearMap' + }, + control: { + unload: 'removeControl' + }, + layer: { + unload: 'removeLayer' + }, + features: { + unload: 'removeFeatures' + }, + listener: { + unload: 'removeListener' + } +} + +const getParent = $component => ($component.abstract || $component.$el === $component.$children[0].$el) ? getParent($component.$parent) : $component + +function destroyInstance () { + const { unload, renderByParent, $parent } = this + if (renderByParent) { + $parent.reload() + } + unload() +} + +class Mixin { + constructor (prop) { + this.methods = { + ready () { + const $parent = getParent(this.$parent) + const map = this.map = $parent.map + this.load() + this.$emit('ready', { + map + }) + }, + transmitEvent (e) { + this.$emit(e.type.replace(/^on/, ''), e) + }, + reload () { + this && this.$nextTick(() => { + this.unload() + this.$nextTick(this.load) + }) + }, + unload () { + const { map, originInstance } = this + try { + switch (prop.type) { + case 'search': + return originInstance.clearResults() + case 'autoComplete': + case 'lushu': + return originInstance.dispose() + case 'markerClusterer': + return originInstance.clearMarkers() + default: + map[types[prop.type].unload](originInstance) + } + } catch (e) {} + } + } + this.computed = { + renderByParent () { + return this.$parent.preventChildrenRender + } + } + this.mounted = function () { + console.log('common mounted') + const $parent = getParent(this.$parent) + const map = $parent.map + const { ready } = this + console.log(map) + map ? ready() : $parent.$on('onload', ready) + } + } +} + +export default type => new Mixin({ type }) diff --git a/src/components/mapWindow/leafletMap.vue b/src/components/mapWindow/leafletMap.vue new file mode 100644 index 0000000..b753cc0 --- /dev/null +++ b/src/components/mapWindow/leafletMap.vue @@ -0,0 +1,143 @@ + + + + + + + diff --git a/src/components/mapWindow/mapWindow.vue b/src/components/mapWindow/mapWindow.vue new file mode 100644 index 0000000..9ced291 --- /dev/null +++ b/src/components/mapWindow/mapWindow.vue @@ -0,0 +1,46 @@ + + + + + + diff --git a/src/icons/svg/bridge.svg b/src/icons/svg/bridge.svg new file mode 100644 index 0000000..1a0336f --- /dev/null +++ b/src/icons/svg/bridge.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/icons/svg/toilet.svg b/src/icons/svg/toilet.svg new file mode 100644 index 0000000..9d8e765 --- /dev/null +++ b/src/icons/svg/toilet.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/main.js b/src/main.js index f2d105d..3e4074e 100644 --- a/src/main.js +++ b/src/main.js @@ -18,6 +18,9 @@ // echart // import echarts from 'echarts' // Vue.prototype.$echarts = echarts +// 引入v-charts +import VCharts from 'v-charts' +Vue.use(VCharts) // 将自动注册所有组件为全局组件 // import dataV from '@jiaminghi/data-view' @@ -35,9 +38,19 @@ Vue.component('search-item', SearchItem) // 加载leaflet的css +// import 'leaflet/dist/leaflet.css' +// import 'leaflet-draw/dist/leaflet.draw.css' +import L from 'leaflet' import 'leaflet/dist/leaflet.css' -import 'leaflet-draw/dist/leaflet.draw.css' +Vue.config.productionTip = false +Vue.L = Vue.prototype.$L = L +delete L.Icon.Default.prototype._getIconUrl +L.Icon.Default.mergeOptions({ + iconRetinaUrl: require('leaflet/dist/images/marker-icon-2x.png'), + iconUrl: require('leaflet/dist/images/marker-icon.png'), + shadowUrl: require('leaflet/dist/images/marker-shadow.png') +}) /** * This project originally used easy-mock to simulate data, * but its official service is very unstable, diff --git a/src/permission.js b/src/permission.js index dc6b2f8..809ca86 100644 --- a/src/permission.js +++ b/src/permission.js @@ -25,8 +25,8 @@ store.dispatch('GetInfo').then(res => { // 拉取用户信息 // 设置当前子系统为基础资源子系统 const currentSys = { - code: 'baseResourse', - name: '基础资源子系统' + code: 'toliet', + name: '公共厕所管理系统' } // 将当前系统信息保存在localStorage中 store.commit('SET_SYSTEM', currentSys) diff --git a/src/router/index.js b/src/router/index.js index 39c295c..d23076d 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -8,8 +8,11 @@ /* Layout */ import Layout from '@/layout/Layout' +import { toiletRouters } from './modules/toilet' +import { workRouters } from './modules/work' +import { statisticsRouters } from './modules/statistics' +import { ruleRouters } from './modules/rule' import { systemRouters } from './modules/system' -import { exampleRouters } from './modules/example' /** * hidden: true if `hidden:true` will not show in the sidebar(default is false) @@ -40,11 +43,12 @@ ] }, // 登录页面 - { path: '/login', component: () => import('@/views/login/index'), hidden: true }, + { path: '/login', component: () => import('@/views/login/index_2'), hidden: true }, // 404错误页面 { path: '/404', component: () => import('@/views/errorPage/404'), hidden: true }, // 401 错误页面 - { path: '/401', component: () => import('@/views/errorPage/401'), hidden: true } + { path: '/401', component: () => import('@/views/errorPage/401'), hidden: true }, + { path: '/', redirect: '/toiletList', hidden: true } ] // 实例化vue的时候直挂载constantRouter export default new Router({ @@ -56,7 +60,10 @@ // 异步挂载路由 // 动态需要根据权限加载的路由表 export const asyncRouterMap = [ - ...exampleRouters, - ...systemRouters, + ...toiletRouters, + ...workRouters, + ...statisticsRouters, + ...ruleRouters, + // ...systemRouters, { path: '*', redirect: '/404', hidden: true } ] diff --git a/src/router/modules/rule.js b/src/router/modules/rule.js new file mode 100644 index 0000000..51e0283 --- /dev/null +++ b/src/router/modules/rule.js @@ -0,0 +1,24 @@ +/* Layout */ +import Layout from '@/layout/Layout' + +export const ruleRouters = [ + { + path: 'rule', + component: Layout, + redirect: '/rule', + name: 'Rule', + meta: { + title: '规章制度', + icon: 'icon-config', // 图标 + permission: ['/rule']// 权限名称 + }, + children: [ + { + path: '/rule', + name: 'Rule', + component: () => import('@/views/rule/listRule'), + meta: { title: '规章制度', icon: 'function', permission: ['/rule'] } + } + ] + } +] diff --git a/src/router/modules/statistics.js b/src/router/modules/statistics.js new file mode 100644 index 0000000..fb9cbea --- /dev/null +++ b/src/router/modules/statistics.js @@ -0,0 +1,30 @@ +/* Layout */ +import Layout from '@/layout/Layout' + +export const statisticsRouters = [ + { + path: 'statisticsToilet', + component: Layout, + redirect: '/workStatistics', + name: 'StatisticsToilet', + meta: { + title: '作业统计', + icon: 'icon-config', // 图标 + permission: ['/statisticsToilet']// 权限名称 + }, + children: [ + { + path: '/workStatistics', + name: 'WorkStatistics', + component: () => import('@/views/statistics/toiletAssessment'), + meta: { title: '作业统计', icon: '', permission: ['/toilet/workStatistics'] } + }, + { + path: '/evaluationStatistics', + name: 'EvaluationStatistics', + component: () => import('@/views/statistics/evaluationAssessment'), + meta: { title: '评价统计', icon: '', permission: ['/toilet/evaluationStatistics'] } + } + ] + } +] diff --git a/src/router/modules/toilet.js b/src/router/modules/toilet.js new file mode 100644 index 0000000..b221a0e --- /dev/null +++ b/src/router/modules/toilet.js @@ -0,0 +1,30 @@ +/* Layout */ +import Layout from '@/layout/Layout' + +export const toiletRouters = [ + { + path: 'toiletManage', + component: Layout, + redirect: '/toiletManage', + name: 'ToiletManage', + meta: { + title: '公厕管理', + icon: 'icon-config', // 图标 + permission: ['/toiletManage']// 权限名称 + }, + children: [ + { + path: '/toiletList', + name: 'ToiletList', + component: () => import('@/views/toiletManage/toiletList'), + meta: { title: '公厕台帐管理', icon: 'function', permission: ['/toiletList'] } + }, + { + path: '/toiletMap', + name: 'ToiletMap', + component: () => import('@/views/overview/overview'), + meta: { title: '地图总览', icon: 'function', permission: ['/toiletMap'] } + } + ] + } +] diff --git a/src/router/modules/work.js b/src/router/modules/work.js new file mode 100644 index 0000000..5e0759f --- /dev/null +++ b/src/router/modules/work.js @@ -0,0 +1,24 @@ +/* Layout */ +import Layout from '@/layout/Layout' + +export const workRouters = [ + { + path: 'toiletWork', + component: Layout, + redirect: '/toiletManage', + name: 'toiletWork', + meta: { + title: '作业管理', + icon: 'icon-config', // 图标 + permission: ['/toiletWork']// 权限名称 + }, + children: [ + { + path: '/toiletWork', + name: 'ToiletWork', + component: () => import('@/views/toiletClean/toiletCleanList'), + meta: { title: '作业管理', icon: 'function', permission: ['/toiletWork'] } + } + ] + } +] diff --git a/src/settings.js b/src/settings.js index b568ce0..b8159bf 100644 --- a/src/settings.js +++ b/src/settings.js @@ -3,7 +3,7 @@ * @type {boolean} true | false * @description 是否显示设置按钮 */ - showSettings: true, + showSettings: false, /** * @type {boolean} true | false diff --git a/src/store/modules/permission.js b/src/store/modules/permission.js index a0cb8cf..3ab50d5 100644 --- a/src/store/modules/permission.js +++ b/src/store/modules/permission.js @@ -120,17 +120,23 @@ }) }, // 获取用户权限 - GetMenus({ commit, state }) { - console.log('in store.permission.js:GetMenus:') + GetMenus({ commit, state }, currentSystem) { + // console.log('in store.permission.js:GetMenus:') + console.log('获取' + currentSystem.name + '的菜单') + const params = { + parentCode: currentSystem.code // 传入该子系统的code,获取子系统的权限 + } return new Promise((resolve, reject) => { - getMenus(state.token).then(response => { // 处理返回值 + // 此处获取用户所有权限 + getMenus(params).then(response => { // 处理返回值 const data = response.data const menus = [] // 仅菜单 const btns = [] // 非菜单 if (data.menus && data.menus.length > 0) { - commit('SET_MENUS', data.menus) - for (const menu of data.menus) { // 遍历菜单,获取所有的权限项 - if (menu.ismenu === '1') { // 将是菜单的放入menus + const allmenus = [...data.menus] + commit('SET_MENUS', allmenus) + for (const menu of allmenus) { // 遍历菜单,获取所有的权限项 + if (menu.resourceType === '02' || menu.resourceType === '03') { // 将是菜单的放入menus const menu_tmp = {} menu_tmp.url = menu.url menu_tmp.icon = menu.icon @@ -142,11 +148,11 @@ btn_tmp.name = menu.name btn_tmp.icon = menu.icon btns.push(btn_tmp) - // console.log(menu.url) } } // 过滤路由表 - const accessedRouters = filterAsyncRouter(asyncRouterMap, menus) + let accessedRouters = filterAsyncRouter(asyncRouterMap, menus) + // accessedRouters = filterRedirect(accessedRouters) commit('SET_BTNS', btns) commit('SET_ROUTERS', accessedRouters) resolve(response) diff --git a/src/utils/baseConfig.js b/src/utils/baseConfig.js index 1f4fa38..999593e 100644 --- a/src/utils/baseConfig.js +++ b/src/utils/baseConfig.js @@ -1,5 +1,5 @@ const project = { - title: '后台管理系统前端基础框架' + title: '路桥养护子系统' } export function getProject() { return project diff --git a/src/utils/dateutils.js b/src/utils/dateutils.js index 868111a..5cd16af 100644 --- a/src/utils/dateutils.js +++ b/src/utils/dateutils.js @@ -15,15 +15,15 @@ return ct_month } -export function getLastWeek() { // 默认显示上周 +export function getLastWeek(fmt) { // 默认显示上周 const ct_month = new Date() ct_month.setTime(ct_month.getTime() - 3600 * 1000 * 24 * 7) - return ct_month + return ct_month.Format(fmt) } -export function getLastMonth() { // 默认显示上个月 +export function getLastMonth(fmt) { // 默认显示上个月 const ct_month = new Date() ct_month.setTime(ct_month.getTime() - 3600 * 1000 * 24 * 30) - return ct_month + return ct_month.Format(fmt) } // 对Date的扩展,将 Date 转化为指定格式的String diff --git a/src/utils/exportutils.js b/src/utils/exportutils.js new file mode 100644 index 0000000..b5d0bcf --- /dev/null +++ b/src/utils/exportutils.js @@ -0,0 +1,19 @@ +/** + * 导出文件工具 + * @param blob 文件 + * @param fileName 导出文件名 + */ +export function exportFile(blob, fileName) { + if (window.navigator && window.navigator.msSaveOrOpenBlob) { + navigator.msSaveBlob(blob, fileName) + } else { + const downloadElement = document.createElement('a') + const href = window.URL.createObjectURL(blob) // 创建下载的链接 + downloadElement.href = href + downloadElement.download = fileName + document.body.appendChild(downloadElement) + downloadElement.click() // 点击下载 + document.body.removeChild(downloadElement) // 下载完成移除元素 + window.URL.revokeObjectURL(href) // 释放blob对象 + } +} diff --git a/src/utils/request.js b/src/utils/request.js index c88ea76..dc56e26 100644 --- a/src/utils/request.js +++ b/src/utils/request.js @@ -17,6 +17,13 @@ config.headers['token'] = getToken() // 让每个请求携带自定义token 请根据实际情况自行修改 console.log(config.headers['token']) } + // 在接口增加时间戳 + // if (config.method === 'get') { + config.params = { + _t: Date.parse(new Date()) / 1000, + ...config.params + } + // } return config }, error => { diff --git a/src/views/mapViews/choosePointDialog.vue b/src/views/mapViews/choosePointDialog.vue new file mode 100644 index 0000000..c9dde8a --- /dev/null +++ b/src/views/mapViews/choosePointDialog.vue @@ -0,0 +1,105 @@ + + + + + diff --git a/src/views/mapViews/mapView.vue b/src/views/mapViews/mapView.vue new file mode 100644 index 0000000..a18db88 --- /dev/null +++ b/src/views/mapViews/mapView.vue @@ -0,0 +1,73 @@ + + + + + diff --git a/src/views/order/editOrder.vue b/src/views/order/editOrder.vue new file mode 100644 index 0000000..4a5fd8a --- /dev/null +++ b/src/views/order/editOrder.vue @@ -0,0 +1,319 @@ + + + + + diff --git a/src/views/order/listMaintainRecords.vue b/src/views/order/listMaintainRecords.vue new file mode 100644 index 0000000..2d4f682 --- /dev/null +++ b/src/views/order/listMaintainRecords.vue @@ -0,0 +1,327 @@ + + + + + diff --git a/src/views/overview/overview.vue b/src/views/overview/overview.vue new file mode 100644 index 0000000..9525867 --- /dev/null +++ b/src/views/overview/overview.vue @@ -0,0 +1,285 @@ + + + + + diff --git a/src/views/overview/toiletDetailDialog.vue b/src/views/overview/toiletDetailDialog.vue new file mode 100644 index 0000000..2b3a511 --- /dev/null +++ b/src/views/overview/toiletDetailDialog.vue @@ -0,0 +1,263 @@ + + + + + + diff --git a/src/views/overview/toiletLayer.vue b/src/views/overview/toiletLayer.vue new file mode 100644 index 0000000..d784323 --- /dev/null +++ b/src/views/overview/toiletLayer.vue @@ -0,0 +1,152 @@ + + + + + + diff --git a/src/views/rule/listRule.vue b/src/views/rule/listRule.vue new file mode 100644 index 0000000..a19b9e4 --- /dev/null +++ b/src/views/rule/listRule.vue @@ -0,0 +1,157 @@ + + + + + diff --git a/src/views/statistics/barChart.vue b/src/views/statistics/barChart.vue new file mode 100644 index 0000000..d10eb38 --- /dev/null +++ b/src/views/statistics/barChart.vue @@ -0,0 +1,65 @@ + + + + + diff --git a/src/views/statistics/components/evaluationListDialog.vue b/src/views/statistics/components/evaluationListDialog.vue new file mode 100644 index 0000000..1560772 --- /dev/null +++ b/src/views/statistics/components/evaluationListDialog.vue @@ -0,0 +1,100 @@ + + + + + + diff --git a/src/views/statistics/components/workChart.vue b/src/views/statistics/components/workChart.vue new file mode 100644 index 0000000..a891e0c --- /dev/null +++ b/src/views/statistics/components/workChart.vue @@ -0,0 +1,79 @@ + + + + + diff --git a/src/views/statistics/evaluationAssessment.vue b/src/views/statistics/evaluationAssessment.vue new file mode 100644 index 0000000..28dedc5 --- /dev/null +++ b/src/views/statistics/evaluationAssessment.vue @@ -0,0 +1,159 @@ + + + + + + diff --git a/src/views/statistics/pieChart.vue b/src/views/statistics/pieChart.vue new file mode 100644 index 0000000..e4dd287 --- /dev/null +++ b/src/views/statistics/pieChart.vue @@ -0,0 +1,58 @@ + + + + + diff --git a/src/views/statistics/statisticsChart.vue b/src/views/statistics/statisticsChart.vue new file mode 100644 index 0000000..2c48fe0 --- /dev/null +++ b/src/views/statistics/statisticsChart.vue @@ -0,0 +1,87 @@ + + + + + diff --git a/src/views/statistics/toiletAssessment.vue b/src/views/statistics/toiletAssessment.vue new file mode 100644 index 0000000..67aa32b --- /dev/null +++ b/src/views/statistics/toiletAssessment.vue @@ -0,0 +1,242 @@ + + + + + diff --git a/src/views/statistics/workStatistics.vue b/src/views/statistics/workStatistics.vue new file mode 100644 index 0000000..50a07f2 --- /dev/null +++ b/src/views/statistics/workStatistics.vue @@ -0,0 +1,191 @@ + + + + + diff --git a/src/views/toilet/components/detail.vue b/src/views/toilet/components/detail.vue new file mode 100644 index 0000000..247c03d --- /dev/null +++ b/src/views/toilet/components/detail.vue @@ -0,0 +1,431 @@ + + + + diff --git a/src/views/toilet/components/editToilet.vue b/src/views/toilet/components/editToilet.vue new file mode 100644 index 0000000..000deea --- /dev/null +++ b/src/views/toilet/components/editToilet.vue @@ -0,0 +1,368 @@ + + + + + diff --git a/src/views/toilet/listToilet.vue b/src/views/toilet/listToilet.vue new file mode 100644 index 0000000..2c5209e --- /dev/null +++ b/src/views/toilet/listToilet.vue @@ -0,0 +1,237 @@ + + + + + diff --git a/src/views/toilet/listWork.vue b/src/views/toilet/listWork.vue new file mode 100644 index 0000000..9281717 --- /dev/null +++ b/src/views/toilet/listWork.vue @@ -0,0 +1,206 @@ + + + + + diff --git a/config/index.js b/config/index.js index 8abd37a..19b33b1 100644 --- a/config/index.js +++ b/config/index.js @@ -69,7 +69,7 @@ * then assetsPublicPath should be set to "/bar/". * In most cases please use '/' !!! */ - assetsPublicPath: '/', + assetsPublicPath: '/toilet/', /** * Source Maps diff --git a/package.json b/package.json index 45f055f..9f3a3eb 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "echarts": "^4.2.1", "element-ui": "2.13.0", "event-source-polyfill": "^1.0.5", + "file-saver": "^2.0.5", "js-cookie": "2.2.0", "jsencrypt": "^3.0.0-rc.1", "leaflet": "^1.7.1", @@ -33,7 +34,9 @@ "vue-amap": "^0.5.9", "vue-baidu-map": "^0.21.22", "vue-router": "3.0.1", - "vuex": "3.0.1" + "vue2-leaflet": "^2.7.0", + "vuex": "3.0.1", + "xlsx": "^0.17.0" }, "devDependencies": { "autoprefixer": "8.5.0", diff --git a/src/api/common.js b/src/api/common.js index 87c582b..7804714 100644 --- a/src/api/common.js +++ b/src/api/common.js @@ -2,10 +2,14 @@ * 常用接口 */ import request from '@/utils/request' +import Vue from 'vue' + // 模板下载 export function downloadTemplate(fileName) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath return request({ - url: 'template/download', + url: lampPath + 'template/download', method: 'get', params: { filename: fileName @@ -19,7 +23,7 @@ const param = new FormData() param.append('file', fileobj.file) return request({ - url: 'imageUpload', + url: 'fileUpload', method: 'post', headers: { 'Content-Type': 'multipart/form-data' }, data: param diff --git a/src/api/sanitation/statistics.js b/src/api/sanitation/statistics.js new file mode 100644 index 0000000..ffeac18 --- /dev/null +++ b/src/api/sanitation/statistics.js @@ -0,0 +1,22 @@ + +/** + * 考核统计接口 + */ +import request from '@/utils/request' +// 公厕保洁次数统计 +export function getToiletJobCount(params) { + return request({ + url: '/sanitation/statistic/toilet/jobCount', + method: 'get', + params + }) +} + +// 公厕评分统计 +export function getToiletEvaluation(params) { + return request({ + url: '/sanitation/toiletEvaluation/statistics', + method: 'get', + params + }) +} diff --git a/src/api/sanitation/toilet.js b/src/api/sanitation/toilet.js new file mode 100644 index 0000000..11affd4 --- /dev/null +++ b/src/api/sanitation/toilet.js @@ -0,0 +1,133 @@ +/** + * 公厕管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' +// 公厕查询 +export function getToiletListPage(params) { + return request({ + url: '/sanitation/toilet/listPage', + method: 'get', + params + }) +} +// 公厕查询 +export function getToiletList(pid) { + return request({ + url: '/sanitation/toilet/list', + method: 'get', + params: { + pid: pid + } + }) +} + +// 添加公厕 +export function addToilet(params) { + return request({ + url: '/sanitation/toilet/add', + method: 'post', + params + }) +} +// 修改公厕机构 +export function updateToilet(params) { + return request({ + url: '/sanitation/toilet/update', + method: 'post', + params + }) +} +// 删除公厕机构 +export function delToilet(ids) { + return request({ + url: '/sanitation/toilet/delete', + method: 'post', + params: { + ids + }, + paramsSerializer: params => { + return qs.stringify(params, { indices: false }) + } + }) +} + +// 公厕基本信息详情 +export function getToiletInfoDetail(id) { + return request({ + url: '/sanitation/toilet/detail?toiletId=' + id, + method: 'get' + }) +} + +// 某公厕保洁记录 +export function getRecordsByToilet(params) { + return request({ + url: '/sanitation/toilet/jobRecord/detail', + method: 'get', + params + }) +} + +// 某公厕平均评分 +export function getScoreByToilet(params) { + return request({ + url: '/sanitation/toiletEvaluation/detailScore', + method: 'get', + params + }) +} + +// 某公厕评分列表 +export function getScoreListByToilet(params) { + return request({ + url: '/sanitation/toiletEvaluation/list', + method: 'get', + params + }) +} + + +// 批量导入 +export function batchImportToilet(fileobj) { + const param = new FormData() + param.append('file', fileobj) + return request({ + url: '/sanitation/toilet/import', + method: 'post', + headers: { 'Content-Type': 'multipart/form-data' }, + data: param + }) +} +// 批量导出 +export function batchExportToilet(params, config) { + return request({ + url: '/sanitation/toilet/export', + method: 'get', + timeout: 120000, + params, + ...config, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 公厕保洁记录查询 +export function getToiletJobRecords(params) { + return request({ + url: '/sanitation/toilet/jobRecord', + method: 'get', + params + }) +} + +// 批量导出 +export function batchExportToiletJobRecords(params, config) { + return request({ + url: '/sanitation/toilet/exportJobRecord', + method: 'get', + timeout: 120000, + params, + ...config, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} diff --git a/src/api/system/alarm.js b/src/api/system/alarm.js new file mode 100644 index 0000000..1c3a7ab --- /dev/null +++ b/src/api/system/alarm.js @@ -0,0 +1,62 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' + +// 获取当前报警列表 +export function getAlarmNowList(params) { + return request({ + url: '/alarm/listNowPage', + method: 'get', + params + }) +} + +// 获取当前报警列表 +export function getAlarmHistoryList(params) { + return request({ + url: '/alarm/listHisPage', + method: 'get', + params + }) +} + + +// 批量消警 +export function clearAll(params) { + return request({ + url: '/alarm/allClear', + method: 'get', + params + }) +} + +// 消警 +export function clearAlarm(params) { + return request({ + url: '/alarm/cancel', + method: 'get', + params + }) +} + +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 设置报警阈值 +export function setThresh(params) { + return request({ + url: '/alarm/resetAlarmRule', + method: 'post', + params + }) +} diff --git a/src/api/system/bridge.js b/src/api/system/bridge.js new file mode 100644 index 0000000..e8a4108 --- /dev/null +++ b/src/api/system/bridge.js @@ -0,0 +1,80 @@ +/** + * 桥梁管理接口 + */ +import request from '@/utils/request' + +// 获取桥梁详情 +export function getDetail(id) { + return request({ + url: '/bridge/detail', + method: 'get', + params: { + id: id + } + }) +} + +export function updateBridge(params) { + return request({ + url: '/bridge/update', + method: 'post', + params + }) +} +// 批量导出 +export function exportRecords(params) { + return request({ + url: 'device/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +export function getContentList(params) { + return request({ + url: 'maintain/contentByType', + method: 'get', + params: { + type: params + } + }) +} +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 编辑 +export function editRecord(params) { + return request({ + url: 'maintain/update', + method: 'post', + params + }) +} +// 新增 +export function addRecord(params) { + return request({ + url: 'maintain/add', + method: 'post', + params + }) +} +// 删除 +export function delRecord(id) { + return request({ + url: 'maintain/delete', + method: 'post', + params: { + id: id + } + }) +} diff --git a/src/api/system/data.js b/src/api/system/data.js new file mode 100644 index 0000000..4c95db5 --- /dev/null +++ b/src/api/system/data.js @@ -0,0 +1,63 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' + +// 获取当前报警列表 +export function getHistoryList(params) { + return request({ + url: '/data/hisListPage', + method: 'get', + params + }) +} + +// 获取当前报警列表 +export function getHistory(params) { + return request({ + url: '/data/hisList', + method: 'get', + params + }) +} + + + +// 批量消警 +export function clearAll(params) { + return request({ + url: '/alarm/allClear', + method: 'get', + params + }) +} + +// 消警 +export function clearAlarm(params) { + return request({ + url: '/alarm/cancel', + method: 'get', + params + }) +} + +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 设置报警阈值 +export function setThresh(params) { + return request({ + url: '/alarm/resetAlarmRule', + method: 'post', + params + }) +} diff --git a/src/api/system/order.js b/src/api/system/order.js new file mode 100644 index 0000000..7007c50 --- /dev/null +++ b/src/api/system/order.js @@ -0,0 +1,71 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +// import qs from 'qs' + +// 获取当前报警列表 +export function getRecordList(params) { + return request({ + url: '/maintain/listPage', + method: 'get', + params + }) +} +// 批量导出 +export function exportRecords(params) { + return request({ + url: 'device/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +export function getContentList(params) { + return request({ + url: 'maintain/contentByType', + method: 'get', + params: { + type: params + } + }) +} +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 编辑 +export function editRecord(params) { + return request({ + url: 'maintain/update', + method: 'post', + params + }) +} +// 新增 +export function addRecord(params) { + return request({ + url: 'maintain/add', + method: 'post', + params + }) +} +// 删除 +export function delRecord(id) { + return request({ + url: 'maintain/delete', + method: 'post', + params: { + bridgeMaintenanceId: id + } + }) +} diff --git a/src/api/system/overview.js b/src/api/system/overview.js new file mode 100644 index 0000000..bca50cc --- /dev/null +++ b/src/api/system/overview.js @@ -0,0 +1,109 @@ +import request from '@/utils/request' +import qs from "qs" +import Vue from 'vue' + +// 路灯状态统计 +export function getLampStatus() { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampStatus', + method: 'get' + }) +} + +// 路灯总览列表 +export function getLampList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampList', + method: 'get', + params + }) +} + +// 路灯详情 +export function getlampDetail(lampId) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampDetail', + method: 'get', + params: { + lampId: lampId + } + }) +} + +// 回路列表 +export function getCircuitList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/circuitList', + method: 'get', + params + }) +} + +// 灯箱列表 +export function getLampBoxList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampBoxList', + method: 'get', + params + }) +} +// 灯箱详情 +export function getLampBoxDetail(lampBoxId) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampBoxDetail', + method: 'get', + params: { + lampBoxId: lampBoxId + } + }) +} + +// 报警总览列表 +export function getAlarmList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/alarmList', + method: 'get', + params + }) +} + +// 报警详情 +export function getAlarmDetail(alarmId) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/alarmDetail', + method: 'get', + params: { + alarmId: alarmId + } + }) +} + +// 路灯控制 +export function lampControl(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampControl', + method: 'post', + params, + paramsSerializer: params => { + return qs.stringify(params, { indices: false }) + } + }) +} diff --git a/src/api/system/rule.js b/src/api/system/rule.js new file mode 100644 index 0000000..76c6b2d --- /dev/null +++ b/src/api/system/rule.js @@ -0,0 +1,59 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +// import qs from 'qs' + +// 获取当前报警列表 +export function getRuleList() { + return request({ + url: 'rule/listPage', + method: 'get' + }) +} +export function getContentList(params) { + return request({ + url: 'maintain/contentByType', + method: 'get', + params: { + type: params + } + }) +} +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 编辑 +export function editRecord(params) { + return request({ + url: 'maintain/update', + method: 'post', + params + }) +} +// 新增 +export function addRecord(params) { + return request({ + url: 'maintain/add', + method: 'post', + params + }) +} +// 删除 +export function delRecord(id) { + return request({ + url: 'maintain/delete', + method: 'post', + params: { + id: id + } + }) +} diff --git a/src/api/system/statistics.js b/src/api/system/statistics.js new file mode 100644 index 0000000..b25efe9 --- /dev/null +++ b/src/api/system/statistics.js @@ -0,0 +1,23 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +// import qs from 'qs' + +// +export function countByToilet(params) { + return request({ + url: '/sanitation/toiletStatistic/jobStaticByToilet', + method: 'get', + params + }) +} + +export function countByDay(params) { + return request({ + url: '/sanitation/toiletStatistic/jobStaticByDate', + method: 'get', + params + }) +} + diff --git a/src/assets/global_images/icon-position.png b/src/assets/global_images/icon-position.png new file mode 100644 index 0000000..7444038 --- /dev/null +++ b/src/assets/global_images/icon-position.png Binary files differ diff --git a/src/assets/global_images/location_green.png b/src/assets/global_images/location_green.png new file mode 100644 index 0000000..aa8be65 --- /dev/null +++ b/src/assets/global_images/location_green.png Binary files differ diff --git a/src/assets/global_images/location_red.png b/src/assets/global_images/location_red.png new file mode 100644 index 0000000..2be8c3d --- /dev/null +++ b/src/assets/global_images/location_red.png Binary files differ diff --git a/src/assets/global_images/location_yellow.png b/src/assets/global_images/location_yellow.png new file mode 100644 index 0000000..5ab6f4d --- /dev/null +++ b/src/assets/global_images/location_yellow.png Binary files differ diff --git a/src/assets/global_images/toilet-position.png b/src/assets/global_images/toilet-position.png new file mode 100644 index 0000000..7db6d9a --- /dev/null +++ b/src/assets/global_images/toilet-position.png Binary files differ diff --git a/src/assets/global_images/toilet.png b/src/assets/global_images/toilet.png new file mode 100644 index 0000000..6d9fc05 --- /dev/null +++ b/src/assets/global_images/toilet.png Binary files differ diff --git a/src/assets/global_images/toiletPhoto.png b/src/assets/global_images/toiletPhoto.png new file mode 100644 index 0000000..15d08e2 --- /dev/null +++ b/src/assets/global_images/toiletPhoto.png Binary files differ diff --git a/src/components/DownloadTemplate/index.vue b/src/components/DownloadTemplate/index.vue index 8ded2cd..7807cac 100644 --- a/src/components/DownloadTemplate/index.vue +++ b/src/components/DownloadTemplate/index.vue @@ -47,8 +47,8 @@ diff --git a/src/components/NormalTable/index.vue b/src/components/NormalTable/index.vue index 5077bef..04d322d 100644 --- a/src/components/NormalTable/index.vue +++ b/src/components/NormalTable/index.vue @@ -79,7 +79,7 @@
-
+
Object.assign(obj, { [key]: this[key] }), {}), + on: events.reduce((obj, key) => Object.assign(obj, { [key]: this.transmitEvent }), {}) + }) + } + this.props = [...extraProps, ...props.filter(prop => exceptProps.indexOf(prop))] + } +} + +export default prop => new Mixin(prop) diff --git a/src/components/mapWindow/base/mixins/common.js b/src/components/mapWindow/base/mixins/common.js new file mode 100644 index 0000000..2fd1a28 --- /dev/null +++ b/src/components/mapWindow/base/mixins/common.js @@ -0,0 +1,82 @@ +const types = { + map: { + unload: 'clearMap' + }, + control: { + unload: 'removeControl' + }, + layer: { + unload: 'removeLayer' + }, + features: { + unload: 'removeFeatures' + }, + listener: { + unload: 'removeListener' + } +} + +const getParent = $component => ($component.abstract || $component.$el === $component.$children[0].$el) ? getParent($component.$parent) : $component + +function destroyInstance () { + const { unload, renderByParent, $parent } = this + if (renderByParent) { + $parent.reload() + } + unload() +} + +class Mixin { + constructor (prop) { + this.methods = { + ready () { + const $parent = getParent(this.$parent) + const map = this.map = $parent.map + this.load() + this.$emit('ready', { + map + }) + }, + transmitEvent (e) { + this.$emit(e.type.replace(/^on/, ''), e) + }, + reload () { + this && this.$nextTick(() => { + this.unload() + this.$nextTick(this.load) + }) + }, + unload () { + const { map, originInstance } = this + try { + switch (prop.type) { + case 'search': + return originInstance.clearResults() + case 'autoComplete': + case 'lushu': + return originInstance.dispose() + case 'markerClusterer': + return originInstance.clearMarkers() + default: + map[types[prop.type].unload](originInstance) + } + } catch (e) {} + } + } + this.computed = { + renderByParent () { + return this.$parent.preventChildrenRender + } + } + this.mounted = function () { + console.log('common mounted') + const $parent = getParent(this.$parent) + const map = $parent.map + const { ready } = this + console.log(map) + map ? ready() : $parent.$on('onload', ready) + } + } +} + +export default type => new Mixin({ type }) diff --git a/src/components/mapWindow/leafletMap.vue b/src/components/mapWindow/leafletMap.vue new file mode 100644 index 0000000..b753cc0 --- /dev/null +++ b/src/components/mapWindow/leafletMap.vue @@ -0,0 +1,143 @@ + + + + + + + diff --git a/src/components/mapWindow/mapWindow.vue b/src/components/mapWindow/mapWindow.vue new file mode 100644 index 0000000..9ced291 --- /dev/null +++ b/src/components/mapWindow/mapWindow.vue @@ -0,0 +1,46 @@ + + + + + + diff --git a/src/icons/svg/bridge.svg b/src/icons/svg/bridge.svg new file mode 100644 index 0000000..1a0336f --- /dev/null +++ b/src/icons/svg/bridge.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/icons/svg/toilet.svg b/src/icons/svg/toilet.svg new file mode 100644 index 0000000..9d8e765 --- /dev/null +++ b/src/icons/svg/toilet.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/main.js b/src/main.js index f2d105d..3e4074e 100644 --- a/src/main.js +++ b/src/main.js @@ -18,6 +18,9 @@ // echart // import echarts from 'echarts' // Vue.prototype.$echarts = echarts +// 引入v-charts +import VCharts from 'v-charts' +Vue.use(VCharts) // 将自动注册所有组件为全局组件 // import dataV from '@jiaminghi/data-view' @@ -35,9 +38,19 @@ Vue.component('search-item', SearchItem) // 加载leaflet的css +// import 'leaflet/dist/leaflet.css' +// import 'leaflet-draw/dist/leaflet.draw.css' +import L from 'leaflet' import 'leaflet/dist/leaflet.css' -import 'leaflet-draw/dist/leaflet.draw.css' +Vue.config.productionTip = false +Vue.L = Vue.prototype.$L = L +delete L.Icon.Default.prototype._getIconUrl +L.Icon.Default.mergeOptions({ + iconRetinaUrl: require('leaflet/dist/images/marker-icon-2x.png'), + iconUrl: require('leaflet/dist/images/marker-icon.png'), + shadowUrl: require('leaflet/dist/images/marker-shadow.png') +}) /** * This project originally used easy-mock to simulate data, * but its official service is very unstable, diff --git a/src/permission.js b/src/permission.js index dc6b2f8..809ca86 100644 --- a/src/permission.js +++ b/src/permission.js @@ -25,8 +25,8 @@ store.dispatch('GetInfo').then(res => { // 拉取用户信息 // 设置当前子系统为基础资源子系统 const currentSys = { - code: 'baseResourse', - name: '基础资源子系统' + code: 'toliet', + name: '公共厕所管理系统' } // 将当前系统信息保存在localStorage中 store.commit('SET_SYSTEM', currentSys) diff --git a/src/router/index.js b/src/router/index.js index 39c295c..d23076d 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -8,8 +8,11 @@ /* Layout */ import Layout from '@/layout/Layout' +import { toiletRouters } from './modules/toilet' +import { workRouters } from './modules/work' +import { statisticsRouters } from './modules/statistics' +import { ruleRouters } from './modules/rule' import { systemRouters } from './modules/system' -import { exampleRouters } from './modules/example' /** * hidden: true if `hidden:true` will not show in the sidebar(default is false) @@ -40,11 +43,12 @@ ] }, // 登录页面 - { path: '/login', component: () => import('@/views/login/index'), hidden: true }, + { path: '/login', component: () => import('@/views/login/index_2'), hidden: true }, // 404错误页面 { path: '/404', component: () => import('@/views/errorPage/404'), hidden: true }, // 401 错误页面 - { path: '/401', component: () => import('@/views/errorPage/401'), hidden: true } + { path: '/401', component: () => import('@/views/errorPage/401'), hidden: true }, + { path: '/', redirect: '/toiletList', hidden: true } ] // 实例化vue的时候直挂载constantRouter export default new Router({ @@ -56,7 +60,10 @@ // 异步挂载路由 // 动态需要根据权限加载的路由表 export const asyncRouterMap = [ - ...exampleRouters, - ...systemRouters, + ...toiletRouters, + ...workRouters, + ...statisticsRouters, + ...ruleRouters, + // ...systemRouters, { path: '*', redirect: '/404', hidden: true } ] diff --git a/src/router/modules/rule.js b/src/router/modules/rule.js new file mode 100644 index 0000000..51e0283 --- /dev/null +++ b/src/router/modules/rule.js @@ -0,0 +1,24 @@ +/* Layout */ +import Layout from '@/layout/Layout' + +export const ruleRouters = [ + { + path: 'rule', + component: Layout, + redirect: '/rule', + name: 'Rule', + meta: { + title: '规章制度', + icon: 'icon-config', // 图标 + permission: ['/rule']// 权限名称 + }, + children: [ + { + path: '/rule', + name: 'Rule', + component: () => import('@/views/rule/listRule'), + meta: { title: '规章制度', icon: 'function', permission: ['/rule'] } + } + ] + } +] diff --git a/src/router/modules/statistics.js b/src/router/modules/statistics.js new file mode 100644 index 0000000..fb9cbea --- /dev/null +++ b/src/router/modules/statistics.js @@ -0,0 +1,30 @@ +/* Layout */ +import Layout from '@/layout/Layout' + +export const statisticsRouters = [ + { + path: 'statisticsToilet', + component: Layout, + redirect: '/workStatistics', + name: 'StatisticsToilet', + meta: { + title: '作业统计', + icon: 'icon-config', // 图标 + permission: ['/statisticsToilet']// 权限名称 + }, + children: [ + { + path: '/workStatistics', + name: 'WorkStatistics', + component: () => import('@/views/statistics/toiletAssessment'), + meta: { title: '作业统计', icon: '', permission: ['/toilet/workStatistics'] } + }, + { + path: '/evaluationStatistics', + name: 'EvaluationStatistics', + component: () => import('@/views/statistics/evaluationAssessment'), + meta: { title: '评价统计', icon: '', permission: ['/toilet/evaluationStatistics'] } + } + ] + } +] diff --git a/src/router/modules/toilet.js b/src/router/modules/toilet.js new file mode 100644 index 0000000..b221a0e --- /dev/null +++ b/src/router/modules/toilet.js @@ -0,0 +1,30 @@ +/* Layout */ +import Layout from '@/layout/Layout' + +export const toiletRouters = [ + { + path: 'toiletManage', + component: Layout, + redirect: '/toiletManage', + name: 'ToiletManage', + meta: { + title: '公厕管理', + icon: 'icon-config', // 图标 + permission: ['/toiletManage']// 权限名称 + }, + children: [ + { + path: '/toiletList', + name: 'ToiletList', + component: () => import('@/views/toiletManage/toiletList'), + meta: { title: '公厕台帐管理', icon: 'function', permission: ['/toiletList'] } + }, + { + path: '/toiletMap', + name: 'ToiletMap', + component: () => import('@/views/overview/overview'), + meta: { title: '地图总览', icon: 'function', permission: ['/toiletMap'] } + } + ] + } +] diff --git a/src/router/modules/work.js b/src/router/modules/work.js new file mode 100644 index 0000000..5e0759f --- /dev/null +++ b/src/router/modules/work.js @@ -0,0 +1,24 @@ +/* Layout */ +import Layout from '@/layout/Layout' + +export const workRouters = [ + { + path: 'toiletWork', + component: Layout, + redirect: '/toiletManage', + name: 'toiletWork', + meta: { + title: '作业管理', + icon: 'icon-config', // 图标 + permission: ['/toiletWork']// 权限名称 + }, + children: [ + { + path: '/toiletWork', + name: 'ToiletWork', + component: () => import('@/views/toiletClean/toiletCleanList'), + meta: { title: '作业管理', icon: 'function', permission: ['/toiletWork'] } + } + ] + } +] diff --git a/src/settings.js b/src/settings.js index b568ce0..b8159bf 100644 --- a/src/settings.js +++ b/src/settings.js @@ -3,7 +3,7 @@ * @type {boolean} true | false * @description 是否显示设置按钮 */ - showSettings: true, + showSettings: false, /** * @type {boolean} true | false diff --git a/src/store/modules/permission.js b/src/store/modules/permission.js index a0cb8cf..3ab50d5 100644 --- a/src/store/modules/permission.js +++ b/src/store/modules/permission.js @@ -120,17 +120,23 @@ }) }, // 获取用户权限 - GetMenus({ commit, state }) { - console.log('in store.permission.js:GetMenus:') + GetMenus({ commit, state }, currentSystem) { + // console.log('in store.permission.js:GetMenus:') + console.log('获取' + currentSystem.name + '的菜单') + const params = { + parentCode: currentSystem.code // 传入该子系统的code,获取子系统的权限 + } return new Promise((resolve, reject) => { - getMenus(state.token).then(response => { // 处理返回值 + // 此处获取用户所有权限 + getMenus(params).then(response => { // 处理返回值 const data = response.data const menus = [] // 仅菜单 const btns = [] // 非菜单 if (data.menus && data.menus.length > 0) { - commit('SET_MENUS', data.menus) - for (const menu of data.menus) { // 遍历菜单,获取所有的权限项 - if (menu.ismenu === '1') { // 将是菜单的放入menus + const allmenus = [...data.menus] + commit('SET_MENUS', allmenus) + for (const menu of allmenus) { // 遍历菜单,获取所有的权限项 + if (menu.resourceType === '02' || menu.resourceType === '03') { // 将是菜单的放入menus const menu_tmp = {} menu_tmp.url = menu.url menu_tmp.icon = menu.icon @@ -142,11 +148,11 @@ btn_tmp.name = menu.name btn_tmp.icon = menu.icon btns.push(btn_tmp) - // console.log(menu.url) } } // 过滤路由表 - const accessedRouters = filterAsyncRouter(asyncRouterMap, menus) + let accessedRouters = filterAsyncRouter(asyncRouterMap, menus) + // accessedRouters = filterRedirect(accessedRouters) commit('SET_BTNS', btns) commit('SET_ROUTERS', accessedRouters) resolve(response) diff --git a/src/utils/baseConfig.js b/src/utils/baseConfig.js index 1f4fa38..999593e 100644 --- a/src/utils/baseConfig.js +++ b/src/utils/baseConfig.js @@ -1,5 +1,5 @@ const project = { - title: '后台管理系统前端基础框架' + title: '路桥养护子系统' } export function getProject() { return project diff --git a/src/utils/dateutils.js b/src/utils/dateutils.js index 868111a..5cd16af 100644 --- a/src/utils/dateutils.js +++ b/src/utils/dateutils.js @@ -15,15 +15,15 @@ return ct_month } -export function getLastWeek() { // 默认显示上周 +export function getLastWeek(fmt) { // 默认显示上周 const ct_month = new Date() ct_month.setTime(ct_month.getTime() - 3600 * 1000 * 24 * 7) - return ct_month + return ct_month.Format(fmt) } -export function getLastMonth() { // 默认显示上个月 +export function getLastMonth(fmt) { // 默认显示上个月 const ct_month = new Date() ct_month.setTime(ct_month.getTime() - 3600 * 1000 * 24 * 30) - return ct_month + return ct_month.Format(fmt) } // 对Date的扩展,将 Date 转化为指定格式的String diff --git a/src/utils/exportutils.js b/src/utils/exportutils.js new file mode 100644 index 0000000..b5d0bcf --- /dev/null +++ b/src/utils/exportutils.js @@ -0,0 +1,19 @@ +/** + * 导出文件工具 + * @param blob 文件 + * @param fileName 导出文件名 + */ +export function exportFile(blob, fileName) { + if (window.navigator && window.navigator.msSaveOrOpenBlob) { + navigator.msSaveBlob(blob, fileName) + } else { + const downloadElement = document.createElement('a') + const href = window.URL.createObjectURL(blob) // 创建下载的链接 + downloadElement.href = href + downloadElement.download = fileName + document.body.appendChild(downloadElement) + downloadElement.click() // 点击下载 + document.body.removeChild(downloadElement) // 下载完成移除元素 + window.URL.revokeObjectURL(href) // 释放blob对象 + } +} diff --git a/src/utils/request.js b/src/utils/request.js index c88ea76..dc56e26 100644 --- a/src/utils/request.js +++ b/src/utils/request.js @@ -17,6 +17,13 @@ config.headers['token'] = getToken() // 让每个请求携带自定义token 请根据实际情况自行修改 console.log(config.headers['token']) } + // 在接口增加时间戳 + // if (config.method === 'get') { + config.params = { + _t: Date.parse(new Date()) / 1000, + ...config.params + } + // } return config }, error => { diff --git a/src/views/mapViews/choosePointDialog.vue b/src/views/mapViews/choosePointDialog.vue new file mode 100644 index 0000000..c9dde8a --- /dev/null +++ b/src/views/mapViews/choosePointDialog.vue @@ -0,0 +1,105 @@ + + + + + diff --git a/src/views/mapViews/mapView.vue b/src/views/mapViews/mapView.vue new file mode 100644 index 0000000..a18db88 --- /dev/null +++ b/src/views/mapViews/mapView.vue @@ -0,0 +1,73 @@ + + + + + diff --git a/src/views/order/editOrder.vue b/src/views/order/editOrder.vue new file mode 100644 index 0000000..4a5fd8a --- /dev/null +++ b/src/views/order/editOrder.vue @@ -0,0 +1,319 @@ + + + + + diff --git a/src/views/order/listMaintainRecords.vue b/src/views/order/listMaintainRecords.vue new file mode 100644 index 0000000..2d4f682 --- /dev/null +++ b/src/views/order/listMaintainRecords.vue @@ -0,0 +1,327 @@ + + + + + diff --git a/src/views/overview/overview.vue b/src/views/overview/overview.vue new file mode 100644 index 0000000..9525867 --- /dev/null +++ b/src/views/overview/overview.vue @@ -0,0 +1,285 @@ + + + + + diff --git a/src/views/overview/toiletDetailDialog.vue b/src/views/overview/toiletDetailDialog.vue new file mode 100644 index 0000000..2b3a511 --- /dev/null +++ b/src/views/overview/toiletDetailDialog.vue @@ -0,0 +1,263 @@ + + + + + + diff --git a/src/views/overview/toiletLayer.vue b/src/views/overview/toiletLayer.vue new file mode 100644 index 0000000..d784323 --- /dev/null +++ b/src/views/overview/toiletLayer.vue @@ -0,0 +1,152 @@ + + + + + + diff --git a/src/views/rule/listRule.vue b/src/views/rule/listRule.vue new file mode 100644 index 0000000..a19b9e4 --- /dev/null +++ b/src/views/rule/listRule.vue @@ -0,0 +1,157 @@ + + + + + diff --git a/src/views/statistics/barChart.vue b/src/views/statistics/barChart.vue new file mode 100644 index 0000000..d10eb38 --- /dev/null +++ b/src/views/statistics/barChart.vue @@ -0,0 +1,65 @@ + + + + + diff --git a/src/views/statistics/components/evaluationListDialog.vue b/src/views/statistics/components/evaluationListDialog.vue new file mode 100644 index 0000000..1560772 --- /dev/null +++ b/src/views/statistics/components/evaluationListDialog.vue @@ -0,0 +1,100 @@ + + + + + + diff --git a/src/views/statistics/components/workChart.vue b/src/views/statistics/components/workChart.vue new file mode 100644 index 0000000..a891e0c --- /dev/null +++ b/src/views/statistics/components/workChart.vue @@ -0,0 +1,79 @@ + + + + + diff --git a/src/views/statistics/evaluationAssessment.vue b/src/views/statistics/evaluationAssessment.vue new file mode 100644 index 0000000..28dedc5 --- /dev/null +++ b/src/views/statistics/evaluationAssessment.vue @@ -0,0 +1,159 @@ + + + + + + diff --git a/src/views/statistics/pieChart.vue b/src/views/statistics/pieChart.vue new file mode 100644 index 0000000..e4dd287 --- /dev/null +++ b/src/views/statistics/pieChart.vue @@ -0,0 +1,58 @@ + + + + + diff --git a/src/views/statistics/statisticsChart.vue b/src/views/statistics/statisticsChart.vue new file mode 100644 index 0000000..2c48fe0 --- /dev/null +++ b/src/views/statistics/statisticsChart.vue @@ -0,0 +1,87 @@ + + + + + diff --git a/src/views/statistics/toiletAssessment.vue b/src/views/statistics/toiletAssessment.vue new file mode 100644 index 0000000..67aa32b --- /dev/null +++ b/src/views/statistics/toiletAssessment.vue @@ -0,0 +1,242 @@ + + + + + diff --git a/src/views/statistics/workStatistics.vue b/src/views/statistics/workStatistics.vue new file mode 100644 index 0000000..50a07f2 --- /dev/null +++ b/src/views/statistics/workStatistics.vue @@ -0,0 +1,191 @@ + + + + + diff --git a/src/views/toilet/components/detail.vue b/src/views/toilet/components/detail.vue new file mode 100644 index 0000000..247c03d --- /dev/null +++ b/src/views/toilet/components/detail.vue @@ -0,0 +1,431 @@ + + + + diff --git a/src/views/toilet/components/editToilet.vue b/src/views/toilet/components/editToilet.vue new file mode 100644 index 0000000..000deea --- /dev/null +++ b/src/views/toilet/components/editToilet.vue @@ -0,0 +1,368 @@ + + + + + diff --git a/src/views/toilet/listToilet.vue b/src/views/toilet/listToilet.vue new file mode 100644 index 0000000..2c5209e --- /dev/null +++ b/src/views/toilet/listToilet.vue @@ -0,0 +1,237 @@ + + + + + diff --git a/src/views/toilet/listWork.vue b/src/views/toilet/listWork.vue new file mode 100644 index 0000000..9281717 --- /dev/null +++ b/src/views/toilet/listWork.vue @@ -0,0 +1,206 @@ + + + + + diff --git a/src/views/toiletClean/toiletCleanList.vue b/src/views/toiletClean/toiletCleanList.vue new file mode 100644 index 0000000..9ed5b84 --- /dev/null +++ b/src/views/toiletClean/toiletCleanList.vue @@ -0,0 +1,210 @@ + + + + + diff --git a/config/index.js b/config/index.js index 8abd37a..19b33b1 100644 --- a/config/index.js +++ b/config/index.js @@ -69,7 +69,7 @@ * then assetsPublicPath should be set to "/bar/". * In most cases please use '/' !!! */ - assetsPublicPath: '/', + assetsPublicPath: '/toilet/', /** * Source Maps diff --git a/package.json b/package.json index 45f055f..9f3a3eb 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "echarts": "^4.2.1", "element-ui": "2.13.0", "event-source-polyfill": "^1.0.5", + "file-saver": "^2.0.5", "js-cookie": "2.2.0", "jsencrypt": "^3.0.0-rc.1", "leaflet": "^1.7.1", @@ -33,7 +34,9 @@ "vue-amap": "^0.5.9", "vue-baidu-map": "^0.21.22", "vue-router": "3.0.1", - "vuex": "3.0.1" + "vue2-leaflet": "^2.7.0", + "vuex": "3.0.1", + "xlsx": "^0.17.0" }, "devDependencies": { "autoprefixer": "8.5.0", diff --git a/src/api/common.js b/src/api/common.js index 87c582b..7804714 100644 --- a/src/api/common.js +++ b/src/api/common.js @@ -2,10 +2,14 @@ * 常用接口 */ import request from '@/utils/request' +import Vue from 'vue' + // 模板下载 export function downloadTemplate(fileName) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath return request({ - url: 'template/download', + url: lampPath + 'template/download', method: 'get', params: { filename: fileName @@ -19,7 +23,7 @@ const param = new FormData() param.append('file', fileobj.file) return request({ - url: 'imageUpload', + url: 'fileUpload', method: 'post', headers: { 'Content-Type': 'multipart/form-data' }, data: param diff --git a/src/api/sanitation/statistics.js b/src/api/sanitation/statistics.js new file mode 100644 index 0000000..ffeac18 --- /dev/null +++ b/src/api/sanitation/statistics.js @@ -0,0 +1,22 @@ + +/** + * 考核统计接口 + */ +import request from '@/utils/request' +// 公厕保洁次数统计 +export function getToiletJobCount(params) { + return request({ + url: '/sanitation/statistic/toilet/jobCount', + method: 'get', + params + }) +} + +// 公厕评分统计 +export function getToiletEvaluation(params) { + return request({ + url: '/sanitation/toiletEvaluation/statistics', + method: 'get', + params + }) +} diff --git a/src/api/sanitation/toilet.js b/src/api/sanitation/toilet.js new file mode 100644 index 0000000..11affd4 --- /dev/null +++ b/src/api/sanitation/toilet.js @@ -0,0 +1,133 @@ +/** + * 公厕管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' +// 公厕查询 +export function getToiletListPage(params) { + return request({ + url: '/sanitation/toilet/listPage', + method: 'get', + params + }) +} +// 公厕查询 +export function getToiletList(pid) { + return request({ + url: '/sanitation/toilet/list', + method: 'get', + params: { + pid: pid + } + }) +} + +// 添加公厕 +export function addToilet(params) { + return request({ + url: '/sanitation/toilet/add', + method: 'post', + params + }) +} +// 修改公厕机构 +export function updateToilet(params) { + return request({ + url: '/sanitation/toilet/update', + method: 'post', + params + }) +} +// 删除公厕机构 +export function delToilet(ids) { + return request({ + url: '/sanitation/toilet/delete', + method: 'post', + params: { + ids + }, + paramsSerializer: params => { + return qs.stringify(params, { indices: false }) + } + }) +} + +// 公厕基本信息详情 +export function getToiletInfoDetail(id) { + return request({ + url: '/sanitation/toilet/detail?toiletId=' + id, + method: 'get' + }) +} + +// 某公厕保洁记录 +export function getRecordsByToilet(params) { + return request({ + url: '/sanitation/toilet/jobRecord/detail', + method: 'get', + params + }) +} + +// 某公厕平均评分 +export function getScoreByToilet(params) { + return request({ + url: '/sanitation/toiletEvaluation/detailScore', + method: 'get', + params + }) +} + +// 某公厕评分列表 +export function getScoreListByToilet(params) { + return request({ + url: '/sanitation/toiletEvaluation/list', + method: 'get', + params + }) +} + + +// 批量导入 +export function batchImportToilet(fileobj) { + const param = new FormData() + param.append('file', fileobj) + return request({ + url: '/sanitation/toilet/import', + method: 'post', + headers: { 'Content-Type': 'multipart/form-data' }, + data: param + }) +} +// 批量导出 +export function batchExportToilet(params, config) { + return request({ + url: '/sanitation/toilet/export', + method: 'get', + timeout: 120000, + params, + ...config, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 公厕保洁记录查询 +export function getToiletJobRecords(params) { + return request({ + url: '/sanitation/toilet/jobRecord', + method: 'get', + params + }) +} + +// 批量导出 +export function batchExportToiletJobRecords(params, config) { + return request({ + url: '/sanitation/toilet/exportJobRecord', + method: 'get', + timeout: 120000, + params, + ...config, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} diff --git a/src/api/system/alarm.js b/src/api/system/alarm.js new file mode 100644 index 0000000..1c3a7ab --- /dev/null +++ b/src/api/system/alarm.js @@ -0,0 +1,62 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' + +// 获取当前报警列表 +export function getAlarmNowList(params) { + return request({ + url: '/alarm/listNowPage', + method: 'get', + params + }) +} + +// 获取当前报警列表 +export function getAlarmHistoryList(params) { + return request({ + url: '/alarm/listHisPage', + method: 'get', + params + }) +} + + +// 批量消警 +export function clearAll(params) { + return request({ + url: '/alarm/allClear', + method: 'get', + params + }) +} + +// 消警 +export function clearAlarm(params) { + return request({ + url: '/alarm/cancel', + method: 'get', + params + }) +} + +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 设置报警阈值 +export function setThresh(params) { + return request({ + url: '/alarm/resetAlarmRule', + method: 'post', + params + }) +} diff --git a/src/api/system/bridge.js b/src/api/system/bridge.js new file mode 100644 index 0000000..e8a4108 --- /dev/null +++ b/src/api/system/bridge.js @@ -0,0 +1,80 @@ +/** + * 桥梁管理接口 + */ +import request from '@/utils/request' + +// 获取桥梁详情 +export function getDetail(id) { + return request({ + url: '/bridge/detail', + method: 'get', + params: { + id: id + } + }) +} + +export function updateBridge(params) { + return request({ + url: '/bridge/update', + method: 'post', + params + }) +} +// 批量导出 +export function exportRecords(params) { + return request({ + url: 'device/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +export function getContentList(params) { + return request({ + url: 'maintain/contentByType', + method: 'get', + params: { + type: params + } + }) +} +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 编辑 +export function editRecord(params) { + return request({ + url: 'maintain/update', + method: 'post', + params + }) +} +// 新增 +export function addRecord(params) { + return request({ + url: 'maintain/add', + method: 'post', + params + }) +} +// 删除 +export function delRecord(id) { + return request({ + url: 'maintain/delete', + method: 'post', + params: { + id: id + } + }) +} diff --git a/src/api/system/data.js b/src/api/system/data.js new file mode 100644 index 0000000..4c95db5 --- /dev/null +++ b/src/api/system/data.js @@ -0,0 +1,63 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' + +// 获取当前报警列表 +export function getHistoryList(params) { + return request({ + url: '/data/hisListPage', + method: 'get', + params + }) +} + +// 获取当前报警列表 +export function getHistory(params) { + return request({ + url: '/data/hisList', + method: 'get', + params + }) +} + + + +// 批量消警 +export function clearAll(params) { + return request({ + url: '/alarm/allClear', + method: 'get', + params + }) +} + +// 消警 +export function clearAlarm(params) { + return request({ + url: '/alarm/cancel', + method: 'get', + params + }) +} + +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 设置报警阈值 +export function setThresh(params) { + return request({ + url: '/alarm/resetAlarmRule', + method: 'post', + params + }) +} diff --git a/src/api/system/order.js b/src/api/system/order.js new file mode 100644 index 0000000..7007c50 --- /dev/null +++ b/src/api/system/order.js @@ -0,0 +1,71 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +// import qs from 'qs' + +// 获取当前报警列表 +export function getRecordList(params) { + return request({ + url: '/maintain/listPage', + method: 'get', + params + }) +} +// 批量导出 +export function exportRecords(params) { + return request({ + url: 'device/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +export function getContentList(params) { + return request({ + url: 'maintain/contentByType', + method: 'get', + params: { + type: params + } + }) +} +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 编辑 +export function editRecord(params) { + return request({ + url: 'maintain/update', + method: 'post', + params + }) +} +// 新增 +export function addRecord(params) { + return request({ + url: 'maintain/add', + method: 'post', + params + }) +} +// 删除 +export function delRecord(id) { + return request({ + url: 'maintain/delete', + method: 'post', + params: { + bridgeMaintenanceId: id + } + }) +} diff --git a/src/api/system/overview.js b/src/api/system/overview.js new file mode 100644 index 0000000..bca50cc --- /dev/null +++ b/src/api/system/overview.js @@ -0,0 +1,109 @@ +import request from '@/utils/request' +import qs from "qs" +import Vue from 'vue' + +// 路灯状态统计 +export function getLampStatus() { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampStatus', + method: 'get' + }) +} + +// 路灯总览列表 +export function getLampList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampList', + method: 'get', + params + }) +} + +// 路灯详情 +export function getlampDetail(lampId) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampDetail', + method: 'get', + params: { + lampId: lampId + } + }) +} + +// 回路列表 +export function getCircuitList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/circuitList', + method: 'get', + params + }) +} + +// 灯箱列表 +export function getLampBoxList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampBoxList', + method: 'get', + params + }) +} +// 灯箱详情 +export function getLampBoxDetail(lampBoxId) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampBoxDetail', + method: 'get', + params: { + lampBoxId: lampBoxId + } + }) +} + +// 报警总览列表 +export function getAlarmList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/alarmList', + method: 'get', + params + }) +} + +// 报警详情 +export function getAlarmDetail(alarmId) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/alarmDetail', + method: 'get', + params: { + alarmId: alarmId + } + }) +} + +// 路灯控制 +export function lampControl(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampControl', + method: 'post', + params, + paramsSerializer: params => { + return qs.stringify(params, { indices: false }) + } + }) +} diff --git a/src/api/system/rule.js b/src/api/system/rule.js new file mode 100644 index 0000000..76c6b2d --- /dev/null +++ b/src/api/system/rule.js @@ -0,0 +1,59 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +// import qs from 'qs' + +// 获取当前报警列表 +export function getRuleList() { + return request({ + url: 'rule/listPage', + method: 'get' + }) +} +export function getContentList(params) { + return request({ + url: 'maintain/contentByType', + method: 'get', + params: { + type: params + } + }) +} +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 编辑 +export function editRecord(params) { + return request({ + url: 'maintain/update', + method: 'post', + params + }) +} +// 新增 +export function addRecord(params) { + return request({ + url: 'maintain/add', + method: 'post', + params + }) +} +// 删除 +export function delRecord(id) { + return request({ + url: 'maintain/delete', + method: 'post', + params: { + id: id + } + }) +} diff --git a/src/api/system/statistics.js b/src/api/system/statistics.js new file mode 100644 index 0000000..b25efe9 --- /dev/null +++ b/src/api/system/statistics.js @@ -0,0 +1,23 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +// import qs from 'qs' + +// +export function countByToilet(params) { + return request({ + url: '/sanitation/toiletStatistic/jobStaticByToilet', + method: 'get', + params + }) +} + +export function countByDay(params) { + return request({ + url: '/sanitation/toiletStatistic/jobStaticByDate', + method: 'get', + params + }) +} + diff --git a/src/assets/global_images/icon-position.png b/src/assets/global_images/icon-position.png new file mode 100644 index 0000000..7444038 --- /dev/null +++ b/src/assets/global_images/icon-position.png Binary files differ diff --git a/src/assets/global_images/location_green.png b/src/assets/global_images/location_green.png new file mode 100644 index 0000000..aa8be65 --- /dev/null +++ b/src/assets/global_images/location_green.png Binary files differ diff --git a/src/assets/global_images/location_red.png b/src/assets/global_images/location_red.png new file mode 100644 index 0000000..2be8c3d --- /dev/null +++ b/src/assets/global_images/location_red.png Binary files differ diff --git a/src/assets/global_images/location_yellow.png b/src/assets/global_images/location_yellow.png new file mode 100644 index 0000000..5ab6f4d --- /dev/null +++ b/src/assets/global_images/location_yellow.png Binary files differ diff --git a/src/assets/global_images/toilet-position.png b/src/assets/global_images/toilet-position.png new file mode 100644 index 0000000..7db6d9a --- /dev/null +++ b/src/assets/global_images/toilet-position.png Binary files differ diff --git a/src/assets/global_images/toilet.png b/src/assets/global_images/toilet.png new file mode 100644 index 0000000..6d9fc05 --- /dev/null +++ b/src/assets/global_images/toilet.png Binary files differ diff --git a/src/assets/global_images/toiletPhoto.png b/src/assets/global_images/toiletPhoto.png new file mode 100644 index 0000000..15d08e2 --- /dev/null +++ b/src/assets/global_images/toiletPhoto.png Binary files differ diff --git a/src/components/DownloadTemplate/index.vue b/src/components/DownloadTemplate/index.vue index 8ded2cd..7807cac 100644 --- a/src/components/DownloadTemplate/index.vue +++ b/src/components/DownloadTemplate/index.vue @@ -47,8 +47,8 @@ diff --git a/src/components/NormalTable/index.vue b/src/components/NormalTable/index.vue index 5077bef..04d322d 100644 --- a/src/components/NormalTable/index.vue +++ b/src/components/NormalTable/index.vue @@ -79,7 +79,7 @@
-
+
Object.assign(obj, { [key]: this[key] }), {}), + on: events.reduce((obj, key) => Object.assign(obj, { [key]: this.transmitEvent }), {}) + }) + } + this.props = [...extraProps, ...props.filter(prop => exceptProps.indexOf(prop))] + } +} + +export default prop => new Mixin(prop) diff --git a/src/components/mapWindow/base/mixins/common.js b/src/components/mapWindow/base/mixins/common.js new file mode 100644 index 0000000..2fd1a28 --- /dev/null +++ b/src/components/mapWindow/base/mixins/common.js @@ -0,0 +1,82 @@ +const types = { + map: { + unload: 'clearMap' + }, + control: { + unload: 'removeControl' + }, + layer: { + unload: 'removeLayer' + }, + features: { + unload: 'removeFeatures' + }, + listener: { + unload: 'removeListener' + } +} + +const getParent = $component => ($component.abstract || $component.$el === $component.$children[0].$el) ? getParent($component.$parent) : $component + +function destroyInstance () { + const { unload, renderByParent, $parent } = this + if (renderByParent) { + $parent.reload() + } + unload() +} + +class Mixin { + constructor (prop) { + this.methods = { + ready () { + const $parent = getParent(this.$parent) + const map = this.map = $parent.map + this.load() + this.$emit('ready', { + map + }) + }, + transmitEvent (e) { + this.$emit(e.type.replace(/^on/, ''), e) + }, + reload () { + this && this.$nextTick(() => { + this.unload() + this.$nextTick(this.load) + }) + }, + unload () { + const { map, originInstance } = this + try { + switch (prop.type) { + case 'search': + return originInstance.clearResults() + case 'autoComplete': + case 'lushu': + return originInstance.dispose() + case 'markerClusterer': + return originInstance.clearMarkers() + default: + map[types[prop.type].unload](originInstance) + } + } catch (e) {} + } + } + this.computed = { + renderByParent () { + return this.$parent.preventChildrenRender + } + } + this.mounted = function () { + console.log('common mounted') + const $parent = getParent(this.$parent) + const map = $parent.map + const { ready } = this + console.log(map) + map ? ready() : $parent.$on('onload', ready) + } + } +} + +export default type => new Mixin({ type }) diff --git a/src/components/mapWindow/leafletMap.vue b/src/components/mapWindow/leafletMap.vue new file mode 100644 index 0000000..b753cc0 --- /dev/null +++ b/src/components/mapWindow/leafletMap.vue @@ -0,0 +1,143 @@ + + + + + + + diff --git a/src/components/mapWindow/mapWindow.vue b/src/components/mapWindow/mapWindow.vue new file mode 100644 index 0000000..9ced291 --- /dev/null +++ b/src/components/mapWindow/mapWindow.vue @@ -0,0 +1,46 @@ + + + + + + diff --git a/src/icons/svg/bridge.svg b/src/icons/svg/bridge.svg new file mode 100644 index 0000000..1a0336f --- /dev/null +++ b/src/icons/svg/bridge.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/icons/svg/toilet.svg b/src/icons/svg/toilet.svg new file mode 100644 index 0000000..9d8e765 --- /dev/null +++ b/src/icons/svg/toilet.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/main.js b/src/main.js index f2d105d..3e4074e 100644 --- a/src/main.js +++ b/src/main.js @@ -18,6 +18,9 @@ // echart // import echarts from 'echarts' // Vue.prototype.$echarts = echarts +// 引入v-charts +import VCharts from 'v-charts' +Vue.use(VCharts) // 将自动注册所有组件为全局组件 // import dataV from '@jiaminghi/data-view' @@ -35,9 +38,19 @@ Vue.component('search-item', SearchItem) // 加载leaflet的css +// import 'leaflet/dist/leaflet.css' +// import 'leaflet-draw/dist/leaflet.draw.css' +import L from 'leaflet' import 'leaflet/dist/leaflet.css' -import 'leaflet-draw/dist/leaflet.draw.css' +Vue.config.productionTip = false +Vue.L = Vue.prototype.$L = L +delete L.Icon.Default.prototype._getIconUrl +L.Icon.Default.mergeOptions({ + iconRetinaUrl: require('leaflet/dist/images/marker-icon-2x.png'), + iconUrl: require('leaflet/dist/images/marker-icon.png'), + shadowUrl: require('leaflet/dist/images/marker-shadow.png') +}) /** * This project originally used easy-mock to simulate data, * but its official service is very unstable, diff --git a/src/permission.js b/src/permission.js index dc6b2f8..809ca86 100644 --- a/src/permission.js +++ b/src/permission.js @@ -25,8 +25,8 @@ store.dispatch('GetInfo').then(res => { // 拉取用户信息 // 设置当前子系统为基础资源子系统 const currentSys = { - code: 'baseResourse', - name: '基础资源子系统' + code: 'toliet', + name: '公共厕所管理系统' } // 将当前系统信息保存在localStorage中 store.commit('SET_SYSTEM', currentSys) diff --git a/src/router/index.js b/src/router/index.js index 39c295c..d23076d 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -8,8 +8,11 @@ /* Layout */ import Layout from '@/layout/Layout' +import { toiletRouters } from './modules/toilet' +import { workRouters } from './modules/work' +import { statisticsRouters } from './modules/statistics' +import { ruleRouters } from './modules/rule' import { systemRouters } from './modules/system' -import { exampleRouters } from './modules/example' /** * hidden: true if `hidden:true` will not show in the sidebar(default is false) @@ -40,11 +43,12 @@ ] }, // 登录页面 - { path: '/login', component: () => import('@/views/login/index'), hidden: true }, + { path: '/login', component: () => import('@/views/login/index_2'), hidden: true }, // 404错误页面 { path: '/404', component: () => import('@/views/errorPage/404'), hidden: true }, // 401 错误页面 - { path: '/401', component: () => import('@/views/errorPage/401'), hidden: true } + { path: '/401', component: () => import('@/views/errorPage/401'), hidden: true }, + { path: '/', redirect: '/toiletList', hidden: true } ] // 实例化vue的时候直挂载constantRouter export default new Router({ @@ -56,7 +60,10 @@ // 异步挂载路由 // 动态需要根据权限加载的路由表 export const asyncRouterMap = [ - ...exampleRouters, - ...systemRouters, + ...toiletRouters, + ...workRouters, + ...statisticsRouters, + ...ruleRouters, + // ...systemRouters, { path: '*', redirect: '/404', hidden: true } ] diff --git a/src/router/modules/rule.js b/src/router/modules/rule.js new file mode 100644 index 0000000..51e0283 --- /dev/null +++ b/src/router/modules/rule.js @@ -0,0 +1,24 @@ +/* Layout */ +import Layout from '@/layout/Layout' + +export const ruleRouters = [ + { + path: 'rule', + component: Layout, + redirect: '/rule', + name: 'Rule', + meta: { + title: '规章制度', + icon: 'icon-config', // 图标 + permission: ['/rule']// 权限名称 + }, + children: [ + { + path: '/rule', + name: 'Rule', + component: () => import('@/views/rule/listRule'), + meta: { title: '规章制度', icon: 'function', permission: ['/rule'] } + } + ] + } +] diff --git a/src/router/modules/statistics.js b/src/router/modules/statistics.js new file mode 100644 index 0000000..fb9cbea --- /dev/null +++ b/src/router/modules/statistics.js @@ -0,0 +1,30 @@ +/* Layout */ +import Layout from '@/layout/Layout' + +export const statisticsRouters = [ + { + path: 'statisticsToilet', + component: Layout, + redirect: '/workStatistics', + name: 'StatisticsToilet', + meta: { + title: '作业统计', + icon: 'icon-config', // 图标 + permission: ['/statisticsToilet']// 权限名称 + }, + children: [ + { + path: '/workStatistics', + name: 'WorkStatistics', + component: () => import('@/views/statistics/toiletAssessment'), + meta: { title: '作业统计', icon: '', permission: ['/toilet/workStatistics'] } + }, + { + path: '/evaluationStatistics', + name: 'EvaluationStatistics', + component: () => import('@/views/statistics/evaluationAssessment'), + meta: { title: '评价统计', icon: '', permission: ['/toilet/evaluationStatistics'] } + } + ] + } +] diff --git a/src/router/modules/toilet.js b/src/router/modules/toilet.js new file mode 100644 index 0000000..b221a0e --- /dev/null +++ b/src/router/modules/toilet.js @@ -0,0 +1,30 @@ +/* Layout */ +import Layout from '@/layout/Layout' + +export const toiletRouters = [ + { + path: 'toiletManage', + component: Layout, + redirect: '/toiletManage', + name: 'ToiletManage', + meta: { + title: '公厕管理', + icon: 'icon-config', // 图标 + permission: ['/toiletManage']// 权限名称 + }, + children: [ + { + path: '/toiletList', + name: 'ToiletList', + component: () => import('@/views/toiletManage/toiletList'), + meta: { title: '公厕台帐管理', icon: 'function', permission: ['/toiletList'] } + }, + { + path: '/toiletMap', + name: 'ToiletMap', + component: () => import('@/views/overview/overview'), + meta: { title: '地图总览', icon: 'function', permission: ['/toiletMap'] } + } + ] + } +] diff --git a/src/router/modules/work.js b/src/router/modules/work.js new file mode 100644 index 0000000..5e0759f --- /dev/null +++ b/src/router/modules/work.js @@ -0,0 +1,24 @@ +/* Layout */ +import Layout from '@/layout/Layout' + +export const workRouters = [ + { + path: 'toiletWork', + component: Layout, + redirect: '/toiletManage', + name: 'toiletWork', + meta: { + title: '作业管理', + icon: 'icon-config', // 图标 + permission: ['/toiletWork']// 权限名称 + }, + children: [ + { + path: '/toiletWork', + name: 'ToiletWork', + component: () => import('@/views/toiletClean/toiletCleanList'), + meta: { title: '作业管理', icon: 'function', permission: ['/toiletWork'] } + } + ] + } +] diff --git a/src/settings.js b/src/settings.js index b568ce0..b8159bf 100644 --- a/src/settings.js +++ b/src/settings.js @@ -3,7 +3,7 @@ * @type {boolean} true | false * @description 是否显示设置按钮 */ - showSettings: true, + showSettings: false, /** * @type {boolean} true | false diff --git a/src/store/modules/permission.js b/src/store/modules/permission.js index a0cb8cf..3ab50d5 100644 --- a/src/store/modules/permission.js +++ b/src/store/modules/permission.js @@ -120,17 +120,23 @@ }) }, // 获取用户权限 - GetMenus({ commit, state }) { - console.log('in store.permission.js:GetMenus:') + GetMenus({ commit, state }, currentSystem) { + // console.log('in store.permission.js:GetMenus:') + console.log('获取' + currentSystem.name + '的菜单') + const params = { + parentCode: currentSystem.code // 传入该子系统的code,获取子系统的权限 + } return new Promise((resolve, reject) => { - getMenus(state.token).then(response => { // 处理返回值 + // 此处获取用户所有权限 + getMenus(params).then(response => { // 处理返回值 const data = response.data const menus = [] // 仅菜单 const btns = [] // 非菜单 if (data.menus && data.menus.length > 0) { - commit('SET_MENUS', data.menus) - for (const menu of data.menus) { // 遍历菜单,获取所有的权限项 - if (menu.ismenu === '1') { // 将是菜单的放入menus + const allmenus = [...data.menus] + commit('SET_MENUS', allmenus) + for (const menu of allmenus) { // 遍历菜单,获取所有的权限项 + if (menu.resourceType === '02' || menu.resourceType === '03') { // 将是菜单的放入menus const menu_tmp = {} menu_tmp.url = menu.url menu_tmp.icon = menu.icon @@ -142,11 +148,11 @@ btn_tmp.name = menu.name btn_tmp.icon = menu.icon btns.push(btn_tmp) - // console.log(menu.url) } } // 过滤路由表 - const accessedRouters = filterAsyncRouter(asyncRouterMap, menus) + let accessedRouters = filterAsyncRouter(asyncRouterMap, menus) + // accessedRouters = filterRedirect(accessedRouters) commit('SET_BTNS', btns) commit('SET_ROUTERS', accessedRouters) resolve(response) diff --git a/src/utils/baseConfig.js b/src/utils/baseConfig.js index 1f4fa38..999593e 100644 --- a/src/utils/baseConfig.js +++ b/src/utils/baseConfig.js @@ -1,5 +1,5 @@ const project = { - title: '后台管理系统前端基础框架' + title: '路桥养护子系统' } export function getProject() { return project diff --git a/src/utils/dateutils.js b/src/utils/dateutils.js index 868111a..5cd16af 100644 --- a/src/utils/dateutils.js +++ b/src/utils/dateutils.js @@ -15,15 +15,15 @@ return ct_month } -export function getLastWeek() { // 默认显示上周 +export function getLastWeek(fmt) { // 默认显示上周 const ct_month = new Date() ct_month.setTime(ct_month.getTime() - 3600 * 1000 * 24 * 7) - return ct_month + return ct_month.Format(fmt) } -export function getLastMonth() { // 默认显示上个月 +export function getLastMonth(fmt) { // 默认显示上个月 const ct_month = new Date() ct_month.setTime(ct_month.getTime() - 3600 * 1000 * 24 * 30) - return ct_month + return ct_month.Format(fmt) } // 对Date的扩展,将 Date 转化为指定格式的String diff --git a/src/utils/exportutils.js b/src/utils/exportutils.js new file mode 100644 index 0000000..b5d0bcf --- /dev/null +++ b/src/utils/exportutils.js @@ -0,0 +1,19 @@ +/** + * 导出文件工具 + * @param blob 文件 + * @param fileName 导出文件名 + */ +export function exportFile(blob, fileName) { + if (window.navigator && window.navigator.msSaveOrOpenBlob) { + navigator.msSaveBlob(blob, fileName) + } else { + const downloadElement = document.createElement('a') + const href = window.URL.createObjectURL(blob) // 创建下载的链接 + downloadElement.href = href + downloadElement.download = fileName + document.body.appendChild(downloadElement) + downloadElement.click() // 点击下载 + document.body.removeChild(downloadElement) // 下载完成移除元素 + window.URL.revokeObjectURL(href) // 释放blob对象 + } +} diff --git a/src/utils/request.js b/src/utils/request.js index c88ea76..dc56e26 100644 --- a/src/utils/request.js +++ b/src/utils/request.js @@ -17,6 +17,13 @@ config.headers['token'] = getToken() // 让每个请求携带自定义token 请根据实际情况自行修改 console.log(config.headers['token']) } + // 在接口增加时间戳 + // if (config.method === 'get') { + config.params = { + _t: Date.parse(new Date()) / 1000, + ...config.params + } + // } return config }, error => { diff --git a/src/views/mapViews/choosePointDialog.vue b/src/views/mapViews/choosePointDialog.vue new file mode 100644 index 0000000..c9dde8a --- /dev/null +++ b/src/views/mapViews/choosePointDialog.vue @@ -0,0 +1,105 @@ + + + + + diff --git a/src/views/mapViews/mapView.vue b/src/views/mapViews/mapView.vue new file mode 100644 index 0000000..a18db88 --- /dev/null +++ b/src/views/mapViews/mapView.vue @@ -0,0 +1,73 @@ + + + + + diff --git a/src/views/order/editOrder.vue b/src/views/order/editOrder.vue new file mode 100644 index 0000000..4a5fd8a --- /dev/null +++ b/src/views/order/editOrder.vue @@ -0,0 +1,319 @@ + + + + + diff --git a/src/views/order/listMaintainRecords.vue b/src/views/order/listMaintainRecords.vue new file mode 100644 index 0000000..2d4f682 --- /dev/null +++ b/src/views/order/listMaintainRecords.vue @@ -0,0 +1,327 @@ + + + + + diff --git a/src/views/overview/overview.vue b/src/views/overview/overview.vue new file mode 100644 index 0000000..9525867 --- /dev/null +++ b/src/views/overview/overview.vue @@ -0,0 +1,285 @@ + + + + + diff --git a/src/views/overview/toiletDetailDialog.vue b/src/views/overview/toiletDetailDialog.vue new file mode 100644 index 0000000..2b3a511 --- /dev/null +++ b/src/views/overview/toiletDetailDialog.vue @@ -0,0 +1,263 @@ + + + + + + diff --git a/src/views/overview/toiletLayer.vue b/src/views/overview/toiletLayer.vue new file mode 100644 index 0000000..d784323 --- /dev/null +++ b/src/views/overview/toiletLayer.vue @@ -0,0 +1,152 @@ + + + + + + diff --git a/src/views/rule/listRule.vue b/src/views/rule/listRule.vue new file mode 100644 index 0000000..a19b9e4 --- /dev/null +++ b/src/views/rule/listRule.vue @@ -0,0 +1,157 @@ + + + + + diff --git a/src/views/statistics/barChart.vue b/src/views/statistics/barChart.vue new file mode 100644 index 0000000..d10eb38 --- /dev/null +++ b/src/views/statistics/barChart.vue @@ -0,0 +1,65 @@ + + + + + diff --git a/src/views/statistics/components/evaluationListDialog.vue b/src/views/statistics/components/evaluationListDialog.vue new file mode 100644 index 0000000..1560772 --- /dev/null +++ b/src/views/statistics/components/evaluationListDialog.vue @@ -0,0 +1,100 @@ + + + + + + diff --git a/src/views/statistics/components/workChart.vue b/src/views/statistics/components/workChart.vue new file mode 100644 index 0000000..a891e0c --- /dev/null +++ b/src/views/statistics/components/workChart.vue @@ -0,0 +1,79 @@ + + + + + diff --git a/src/views/statistics/evaluationAssessment.vue b/src/views/statistics/evaluationAssessment.vue new file mode 100644 index 0000000..28dedc5 --- /dev/null +++ b/src/views/statistics/evaluationAssessment.vue @@ -0,0 +1,159 @@ + + + + + + diff --git a/src/views/statistics/pieChart.vue b/src/views/statistics/pieChart.vue new file mode 100644 index 0000000..e4dd287 --- /dev/null +++ b/src/views/statistics/pieChart.vue @@ -0,0 +1,58 @@ + + + + + diff --git a/src/views/statistics/statisticsChart.vue b/src/views/statistics/statisticsChart.vue new file mode 100644 index 0000000..2c48fe0 --- /dev/null +++ b/src/views/statistics/statisticsChart.vue @@ -0,0 +1,87 @@ + + + + + diff --git a/src/views/statistics/toiletAssessment.vue b/src/views/statistics/toiletAssessment.vue new file mode 100644 index 0000000..67aa32b --- /dev/null +++ b/src/views/statistics/toiletAssessment.vue @@ -0,0 +1,242 @@ + + + + + diff --git a/src/views/statistics/workStatistics.vue b/src/views/statistics/workStatistics.vue new file mode 100644 index 0000000..50a07f2 --- /dev/null +++ b/src/views/statistics/workStatistics.vue @@ -0,0 +1,191 @@ + + + + + diff --git a/src/views/toilet/components/detail.vue b/src/views/toilet/components/detail.vue new file mode 100644 index 0000000..247c03d --- /dev/null +++ b/src/views/toilet/components/detail.vue @@ -0,0 +1,431 @@ + + + + diff --git a/src/views/toilet/components/editToilet.vue b/src/views/toilet/components/editToilet.vue new file mode 100644 index 0000000..000deea --- /dev/null +++ b/src/views/toilet/components/editToilet.vue @@ -0,0 +1,368 @@ + + + + + diff --git a/src/views/toilet/listToilet.vue b/src/views/toilet/listToilet.vue new file mode 100644 index 0000000..2c5209e --- /dev/null +++ b/src/views/toilet/listToilet.vue @@ -0,0 +1,237 @@ + + + + + diff --git a/src/views/toilet/listWork.vue b/src/views/toilet/listWork.vue new file mode 100644 index 0000000..9281717 --- /dev/null +++ b/src/views/toilet/listWork.vue @@ -0,0 +1,206 @@ + + + + + diff --git a/src/views/toiletClean/toiletCleanList.vue b/src/views/toiletClean/toiletCleanList.vue new file mode 100644 index 0000000..9ed5b84 --- /dev/null +++ b/src/views/toiletClean/toiletCleanList.vue @@ -0,0 +1,210 @@ + + + + + diff --git a/src/views/toiletManage/editToilet.vue b/src/views/toiletManage/editToilet.vue new file mode 100644 index 0000000..1323d1e --- /dev/null +++ b/src/views/toiletManage/editToilet.vue @@ -0,0 +1,407 @@ + + + + + diff --git a/config/index.js b/config/index.js index 8abd37a..19b33b1 100644 --- a/config/index.js +++ b/config/index.js @@ -69,7 +69,7 @@ * then assetsPublicPath should be set to "/bar/". * In most cases please use '/' !!! */ - assetsPublicPath: '/', + assetsPublicPath: '/toilet/', /** * Source Maps diff --git a/package.json b/package.json index 45f055f..9f3a3eb 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "echarts": "^4.2.1", "element-ui": "2.13.0", "event-source-polyfill": "^1.0.5", + "file-saver": "^2.0.5", "js-cookie": "2.2.0", "jsencrypt": "^3.0.0-rc.1", "leaflet": "^1.7.1", @@ -33,7 +34,9 @@ "vue-amap": "^0.5.9", "vue-baidu-map": "^0.21.22", "vue-router": "3.0.1", - "vuex": "3.0.1" + "vue2-leaflet": "^2.7.0", + "vuex": "3.0.1", + "xlsx": "^0.17.0" }, "devDependencies": { "autoprefixer": "8.5.0", diff --git a/src/api/common.js b/src/api/common.js index 87c582b..7804714 100644 --- a/src/api/common.js +++ b/src/api/common.js @@ -2,10 +2,14 @@ * 常用接口 */ import request from '@/utils/request' +import Vue from 'vue' + // 模板下载 export function downloadTemplate(fileName) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath return request({ - url: 'template/download', + url: lampPath + 'template/download', method: 'get', params: { filename: fileName @@ -19,7 +23,7 @@ const param = new FormData() param.append('file', fileobj.file) return request({ - url: 'imageUpload', + url: 'fileUpload', method: 'post', headers: { 'Content-Type': 'multipart/form-data' }, data: param diff --git a/src/api/sanitation/statistics.js b/src/api/sanitation/statistics.js new file mode 100644 index 0000000..ffeac18 --- /dev/null +++ b/src/api/sanitation/statistics.js @@ -0,0 +1,22 @@ + +/** + * 考核统计接口 + */ +import request from '@/utils/request' +// 公厕保洁次数统计 +export function getToiletJobCount(params) { + return request({ + url: '/sanitation/statistic/toilet/jobCount', + method: 'get', + params + }) +} + +// 公厕评分统计 +export function getToiletEvaluation(params) { + return request({ + url: '/sanitation/toiletEvaluation/statistics', + method: 'get', + params + }) +} diff --git a/src/api/sanitation/toilet.js b/src/api/sanitation/toilet.js new file mode 100644 index 0000000..11affd4 --- /dev/null +++ b/src/api/sanitation/toilet.js @@ -0,0 +1,133 @@ +/** + * 公厕管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' +// 公厕查询 +export function getToiletListPage(params) { + return request({ + url: '/sanitation/toilet/listPage', + method: 'get', + params + }) +} +// 公厕查询 +export function getToiletList(pid) { + return request({ + url: '/sanitation/toilet/list', + method: 'get', + params: { + pid: pid + } + }) +} + +// 添加公厕 +export function addToilet(params) { + return request({ + url: '/sanitation/toilet/add', + method: 'post', + params + }) +} +// 修改公厕机构 +export function updateToilet(params) { + return request({ + url: '/sanitation/toilet/update', + method: 'post', + params + }) +} +// 删除公厕机构 +export function delToilet(ids) { + return request({ + url: '/sanitation/toilet/delete', + method: 'post', + params: { + ids + }, + paramsSerializer: params => { + return qs.stringify(params, { indices: false }) + } + }) +} + +// 公厕基本信息详情 +export function getToiletInfoDetail(id) { + return request({ + url: '/sanitation/toilet/detail?toiletId=' + id, + method: 'get' + }) +} + +// 某公厕保洁记录 +export function getRecordsByToilet(params) { + return request({ + url: '/sanitation/toilet/jobRecord/detail', + method: 'get', + params + }) +} + +// 某公厕平均评分 +export function getScoreByToilet(params) { + return request({ + url: '/sanitation/toiletEvaluation/detailScore', + method: 'get', + params + }) +} + +// 某公厕评分列表 +export function getScoreListByToilet(params) { + return request({ + url: '/sanitation/toiletEvaluation/list', + method: 'get', + params + }) +} + + +// 批量导入 +export function batchImportToilet(fileobj) { + const param = new FormData() + param.append('file', fileobj) + return request({ + url: '/sanitation/toilet/import', + method: 'post', + headers: { 'Content-Type': 'multipart/form-data' }, + data: param + }) +} +// 批量导出 +export function batchExportToilet(params, config) { + return request({ + url: '/sanitation/toilet/export', + method: 'get', + timeout: 120000, + params, + ...config, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 公厕保洁记录查询 +export function getToiletJobRecords(params) { + return request({ + url: '/sanitation/toilet/jobRecord', + method: 'get', + params + }) +} + +// 批量导出 +export function batchExportToiletJobRecords(params, config) { + return request({ + url: '/sanitation/toilet/exportJobRecord', + method: 'get', + timeout: 120000, + params, + ...config, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} diff --git a/src/api/system/alarm.js b/src/api/system/alarm.js new file mode 100644 index 0000000..1c3a7ab --- /dev/null +++ b/src/api/system/alarm.js @@ -0,0 +1,62 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' + +// 获取当前报警列表 +export function getAlarmNowList(params) { + return request({ + url: '/alarm/listNowPage', + method: 'get', + params + }) +} + +// 获取当前报警列表 +export function getAlarmHistoryList(params) { + return request({ + url: '/alarm/listHisPage', + method: 'get', + params + }) +} + + +// 批量消警 +export function clearAll(params) { + return request({ + url: '/alarm/allClear', + method: 'get', + params + }) +} + +// 消警 +export function clearAlarm(params) { + return request({ + url: '/alarm/cancel', + method: 'get', + params + }) +} + +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 设置报警阈值 +export function setThresh(params) { + return request({ + url: '/alarm/resetAlarmRule', + method: 'post', + params + }) +} diff --git a/src/api/system/bridge.js b/src/api/system/bridge.js new file mode 100644 index 0000000..e8a4108 --- /dev/null +++ b/src/api/system/bridge.js @@ -0,0 +1,80 @@ +/** + * 桥梁管理接口 + */ +import request from '@/utils/request' + +// 获取桥梁详情 +export function getDetail(id) { + return request({ + url: '/bridge/detail', + method: 'get', + params: { + id: id + } + }) +} + +export function updateBridge(params) { + return request({ + url: '/bridge/update', + method: 'post', + params + }) +} +// 批量导出 +export function exportRecords(params) { + return request({ + url: 'device/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +export function getContentList(params) { + return request({ + url: 'maintain/contentByType', + method: 'get', + params: { + type: params + } + }) +} +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 编辑 +export function editRecord(params) { + return request({ + url: 'maintain/update', + method: 'post', + params + }) +} +// 新增 +export function addRecord(params) { + return request({ + url: 'maintain/add', + method: 'post', + params + }) +} +// 删除 +export function delRecord(id) { + return request({ + url: 'maintain/delete', + method: 'post', + params: { + id: id + } + }) +} diff --git a/src/api/system/data.js b/src/api/system/data.js new file mode 100644 index 0000000..4c95db5 --- /dev/null +++ b/src/api/system/data.js @@ -0,0 +1,63 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' + +// 获取当前报警列表 +export function getHistoryList(params) { + return request({ + url: '/data/hisListPage', + method: 'get', + params + }) +} + +// 获取当前报警列表 +export function getHistory(params) { + return request({ + url: '/data/hisList', + method: 'get', + params + }) +} + + + +// 批量消警 +export function clearAll(params) { + return request({ + url: '/alarm/allClear', + method: 'get', + params + }) +} + +// 消警 +export function clearAlarm(params) { + return request({ + url: '/alarm/cancel', + method: 'get', + params + }) +} + +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 设置报警阈值 +export function setThresh(params) { + return request({ + url: '/alarm/resetAlarmRule', + method: 'post', + params + }) +} diff --git a/src/api/system/order.js b/src/api/system/order.js new file mode 100644 index 0000000..7007c50 --- /dev/null +++ b/src/api/system/order.js @@ -0,0 +1,71 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +// import qs from 'qs' + +// 获取当前报警列表 +export function getRecordList(params) { + return request({ + url: '/maintain/listPage', + method: 'get', + params + }) +} +// 批量导出 +export function exportRecords(params) { + return request({ + url: 'device/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +export function getContentList(params) { + return request({ + url: 'maintain/contentByType', + method: 'get', + params: { + type: params + } + }) +} +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 编辑 +export function editRecord(params) { + return request({ + url: 'maintain/update', + method: 'post', + params + }) +} +// 新增 +export function addRecord(params) { + return request({ + url: 'maintain/add', + method: 'post', + params + }) +} +// 删除 +export function delRecord(id) { + return request({ + url: 'maintain/delete', + method: 'post', + params: { + bridgeMaintenanceId: id + } + }) +} diff --git a/src/api/system/overview.js b/src/api/system/overview.js new file mode 100644 index 0000000..bca50cc --- /dev/null +++ b/src/api/system/overview.js @@ -0,0 +1,109 @@ +import request from '@/utils/request' +import qs from "qs" +import Vue from 'vue' + +// 路灯状态统计 +export function getLampStatus() { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampStatus', + method: 'get' + }) +} + +// 路灯总览列表 +export function getLampList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampList', + method: 'get', + params + }) +} + +// 路灯详情 +export function getlampDetail(lampId) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampDetail', + method: 'get', + params: { + lampId: lampId + } + }) +} + +// 回路列表 +export function getCircuitList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/circuitList', + method: 'get', + params + }) +} + +// 灯箱列表 +export function getLampBoxList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampBoxList', + method: 'get', + params + }) +} +// 灯箱详情 +export function getLampBoxDetail(lampBoxId) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampBoxDetail', + method: 'get', + params: { + lampBoxId: lampBoxId + } + }) +} + +// 报警总览列表 +export function getAlarmList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/alarmList', + method: 'get', + params + }) +} + +// 报警详情 +export function getAlarmDetail(alarmId) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/alarmDetail', + method: 'get', + params: { + alarmId: alarmId + } + }) +} + +// 路灯控制 +export function lampControl(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampControl', + method: 'post', + params, + paramsSerializer: params => { + return qs.stringify(params, { indices: false }) + } + }) +} diff --git a/src/api/system/rule.js b/src/api/system/rule.js new file mode 100644 index 0000000..76c6b2d --- /dev/null +++ b/src/api/system/rule.js @@ -0,0 +1,59 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +// import qs from 'qs' + +// 获取当前报警列表 +export function getRuleList() { + return request({ + url: 'rule/listPage', + method: 'get' + }) +} +export function getContentList(params) { + return request({ + url: 'maintain/contentByType', + method: 'get', + params: { + type: params + } + }) +} +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 编辑 +export function editRecord(params) { + return request({ + url: 'maintain/update', + method: 'post', + params + }) +} +// 新增 +export function addRecord(params) { + return request({ + url: 'maintain/add', + method: 'post', + params + }) +} +// 删除 +export function delRecord(id) { + return request({ + url: 'maintain/delete', + method: 'post', + params: { + id: id + } + }) +} diff --git a/src/api/system/statistics.js b/src/api/system/statistics.js new file mode 100644 index 0000000..b25efe9 --- /dev/null +++ b/src/api/system/statistics.js @@ -0,0 +1,23 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +// import qs from 'qs' + +// +export function countByToilet(params) { + return request({ + url: '/sanitation/toiletStatistic/jobStaticByToilet', + method: 'get', + params + }) +} + +export function countByDay(params) { + return request({ + url: '/sanitation/toiletStatistic/jobStaticByDate', + method: 'get', + params + }) +} + diff --git a/src/assets/global_images/icon-position.png b/src/assets/global_images/icon-position.png new file mode 100644 index 0000000..7444038 --- /dev/null +++ b/src/assets/global_images/icon-position.png Binary files differ diff --git a/src/assets/global_images/location_green.png b/src/assets/global_images/location_green.png new file mode 100644 index 0000000..aa8be65 --- /dev/null +++ b/src/assets/global_images/location_green.png Binary files differ diff --git a/src/assets/global_images/location_red.png b/src/assets/global_images/location_red.png new file mode 100644 index 0000000..2be8c3d --- /dev/null +++ b/src/assets/global_images/location_red.png Binary files differ diff --git a/src/assets/global_images/location_yellow.png b/src/assets/global_images/location_yellow.png new file mode 100644 index 0000000..5ab6f4d --- /dev/null +++ b/src/assets/global_images/location_yellow.png Binary files differ diff --git a/src/assets/global_images/toilet-position.png b/src/assets/global_images/toilet-position.png new file mode 100644 index 0000000..7db6d9a --- /dev/null +++ b/src/assets/global_images/toilet-position.png Binary files differ diff --git a/src/assets/global_images/toilet.png b/src/assets/global_images/toilet.png new file mode 100644 index 0000000..6d9fc05 --- /dev/null +++ b/src/assets/global_images/toilet.png Binary files differ diff --git a/src/assets/global_images/toiletPhoto.png b/src/assets/global_images/toiletPhoto.png new file mode 100644 index 0000000..15d08e2 --- /dev/null +++ b/src/assets/global_images/toiletPhoto.png Binary files differ diff --git a/src/components/DownloadTemplate/index.vue b/src/components/DownloadTemplate/index.vue index 8ded2cd..7807cac 100644 --- a/src/components/DownloadTemplate/index.vue +++ b/src/components/DownloadTemplate/index.vue @@ -47,8 +47,8 @@ diff --git a/src/components/NormalTable/index.vue b/src/components/NormalTable/index.vue index 5077bef..04d322d 100644 --- a/src/components/NormalTable/index.vue +++ b/src/components/NormalTable/index.vue @@ -79,7 +79,7 @@
-
+
Object.assign(obj, { [key]: this[key] }), {}), + on: events.reduce((obj, key) => Object.assign(obj, { [key]: this.transmitEvent }), {}) + }) + } + this.props = [...extraProps, ...props.filter(prop => exceptProps.indexOf(prop))] + } +} + +export default prop => new Mixin(prop) diff --git a/src/components/mapWindow/base/mixins/common.js b/src/components/mapWindow/base/mixins/common.js new file mode 100644 index 0000000..2fd1a28 --- /dev/null +++ b/src/components/mapWindow/base/mixins/common.js @@ -0,0 +1,82 @@ +const types = { + map: { + unload: 'clearMap' + }, + control: { + unload: 'removeControl' + }, + layer: { + unload: 'removeLayer' + }, + features: { + unload: 'removeFeatures' + }, + listener: { + unload: 'removeListener' + } +} + +const getParent = $component => ($component.abstract || $component.$el === $component.$children[0].$el) ? getParent($component.$parent) : $component + +function destroyInstance () { + const { unload, renderByParent, $parent } = this + if (renderByParent) { + $parent.reload() + } + unload() +} + +class Mixin { + constructor (prop) { + this.methods = { + ready () { + const $parent = getParent(this.$parent) + const map = this.map = $parent.map + this.load() + this.$emit('ready', { + map + }) + }, + transmitEvent (e) { + this.$emit(e.type.replace(/^on/, ''), e) + }, + reload () { + this && this.$nextTick(() => { + this.unload() + this.$nextTick(this.load) + }) + }, + unload () { + const { map, originInstance } = this + try { + switch (prop.type) { + case 'search': + return originInstance.clearResults() + case 'autoComplete': + case 'lushu': + return originInstance.dispose() + case 'markerClusterer': + return originInstance.clearMarkers() + default: + map[types[prop.type].unload](originInstance) + } + } catch (e) {} + } + } + this.computed = { + renderByParent () { + return this.$parent.preventChildrenRender + } + } + this.mounted = function () { + console.log('common mounted') + const $parent = getParent(this.$parent) + const map = $parent.map + const { ready } = this + console.log(map) + map ? ready() : $parent.$on('onload', ready) + } + } +} + +export default type => new Mixin({ type }) diff --git a/src/components/mapWindow/leafletMap.vue b/src/components/mapWindow/leafletMap.vue new file mode 100644 index 0000000..b753cc0 --- /dev/null +++ b/src/components/mapWindow/leafletMap.vue @@ -0,0 +1,143 @@ + + + + + + + diff --git a/src/components/mapWindow/mapWindow.vue b/src/components/mapWindow/mapWindow.vue new file mode 100644 index 0000000..9ced291 --- /dev/null +++ b/src/components/mapWindow/mapWindow.vue @@ -0,0 +1,46 @@ + + + + + + diff --git a/src/icons/svg/bridge.svg b/src/icons/svg/bridge.svg new file mode 100644 index 0000000..1a0336f --- /dev/null +++ b/src/icons/svg/bridge.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/icons/svg/toilet.svg b/src/icons/svg/toilet.svg new file mode 100644 index 0000000..9d8e765 --- /dev/null +++ b/src/icons/svg/toilet.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/main.js b/src/main.js index f2d105d..3e4074e 100644 --- a/src/main.js +++ b/src/main.js @@ -18,6 +18,9 @@ // echart // import echarts from 'echarts' // Vue.prototype.$echarts = echarts +// 引入v-charts +import VCharts from 'v-charts' +Vue.use(VCharts) // 将自动注册所有组件为全局组件 // import dataV from '@jiaminghi/data-view' @@ -35,9 +38,19 @@ Vue.component('search-item', SearchItem) // 加载leaflet的css +// import 'leaflet/dist/leaflet.css' +// import 'leaflet-draw/dist/leaflet.draw.css' +import L from 'leaflet' import 'leaflet/dist/leaflet.css' -import 'leaflet-draw/dist/leaflet.draw.css' +Vue.config.productionTip = false +Vue.L = Vue.prototype.$L = L +delete L.Icon.Default.prototype._getIconUrl +L.Icon.Default.mergeOptions({ + iconRetinaUrl: require('leaflet/dist/images/marker-icon-2x.png'), + iconUrl: require('leaflet/dist/images/marker-icon.png'), + shadowUrl: require('leaflet/dist/images/marker-shadow.png') +}) /** * This project originally used easy-mock to simulate data, * but its official service is very unstable, diff --git a/src/permission.js b/src/permission.js index dc6b2f8..809ca86 100644 --- a/src/permission.js +++ b/src/permission.js @@ -25,8 +25,8 @@ store.dispatch('GetInfo').then(res => { // 拉取用户信息 // 设置当前子系统为基础资源子系统 const currentSys = { - code: 'baseResourse', - name: '基础资源子系统' + code: 'toliet', + name: '公共厕所管理系统' } // 将当前系统信息保存在localStorage中 store.commit('SET_SYSTEM', currentSys) diff --git a/src/router/index.js b/src/router/index.js index 39c295c..d23076d 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -8,8 +8,11 @@ /* Layout */ import Layout from '@/layout/Layout' +import { toiletRouters } from './modules/toilet' +import { workRouters } from './modules/work' +import { statisticsRouters } from './modules/statistics' +import { ruleRouters } from './modules/rule' import { systemRouters } from './modules/system' -import { exampleRouters } from './modules/example' /** * hidden: true if `hidden:true` will not show in the sidebar(default is false) @@ -40,11 +43,12 @@ ] }, // 登录页面 - { path: '/login', component: () => import('@/views/login/index'), hidden: true }, + { path: '/login', component: () => import('@/views/login/index_2'), hidden: true }, // 404错误页面 { path: '/404', component: () => import('@/views/errorPage/404'), hidden: true }, // 401 错误页面 - { path: '/401', component: () => import('@/views/errorPage/401'), hidden: true } + { path: '/401', component: () => import('@/views/errorPage/401'), hidden: true }, + { path: '/', redirect: '/toiletList', hidden: true } ] // 实例化vue的时候直挂载constantRouter export default new Router({ @@ -56,7 +60,10 @@ // 异步挂载路由 // 动态需要根据权限加载的路由表 export const asyncRouterMap = [ - ...exampleRouters, - ...systemRouters, + ...toiletRouters, + ...workRouters, + ...statisticsRouters, + ...ruleRouters, + // ...systemRouters, { path: '*', redirect: '/404', hidden: true } ] diff --git a/src/router/modules/rule.js b/src/router/modules/rule.js new file mode 100644 index 0000000..51e0283 --- /dev/null +++ b/src/router/modules/rule.js @@ -0,0 +1,24 @@ +/* Layout */ +import Layout from '@/layout/Layout' + +export const ruleRouters = [ + { + path: 'rule', + component: Layout, + redirect: '/rule', + name: 'Rule', + meta: { + title: '规章制度', + icon: 'icon-config', // 图标 + permission: ['/rule']// 权限名称 + }, + children: [ + { + path: '/rule', + name: 'Rule', + component: () => import('@/views/rule/listRule'), + meta: { title: '规章制度', icon: 'function', permission: ['/rule'] } + } + ] + } +] diff --git a/src/router/modules/statistics.js b/src/router/modules/statistics.js new file mode 100644 index 0000000..fb9cbea --- /dev/null +++ b/src/router/modules/statistics.js @@ -0,0 +1,30 @@ +/* Layout */ +import Layout from '@/layout/Layout' + +export const statisticsRouters = [ + { + path: 'statisticsToilet', + component: Layout, + redirect: '/workStatistics', + name: 'StatisticsToilet', + meta: { + title: '作业统计', + icon: 'icon-config', // 图标 + permission: ['/statisticsToilet']// 权限名称 + }, + children: [ + { + path: '/workStatistics', + name: 'WorkStatistics', + component: () => import('@/views/statistics/toiletAssessment'), + meta: { title: '作业统计', icon: '', permission: ['/toilet/workStatistics'] } + }, + { + path: '/evaluationStatistics', + name: 'EvaluationStatistics', + component: () => import('@/views/statistics/evaluationAssessment'), + meta: { title: '评价统计', icon: '', permission: ['/toilet/evaluationStatistics'] } + } + ] + } +] diff --git a/src/router/modules/toilet.js b/src/router/modules/toilet.js new file mode 100644 index 0000000..b221a0e --- /dev/null +++ b/src/router/modules/toilet.js @@ -0,0 +1,30 @@ +/* Layout */ +import Layout from '@/layout/Layout' + +export const toiletRouters = [ + { + path: 'toiletManage', + component: Layout, + redirect: '/toiletManage', + name: 'ToiletManage', + meta: { + title: '公厕管理', + icon: 'icon-config', // 图标 + permission: ['/toiletManage']// 权限名称 + }, + children: [ + { + path: '/toiletList', + name: 'ToiletList', + component: () => import('@/views/toiletManage/toiletList'), + meta: { title: '公厕台帐管理', icon: 'function', permission: ['/toiletList'] } + }, + { + path: '/toiletMap', + name: 'ToiletMap', + component: () => import('@/views/overview/overview'), + meta: { title: '地图总览', icon: 'function', permission: ['/toiletMap'] } + } + ] + } +] diff --git a/src/router/modules/work.js b/src/router/modules/work.js new file mode 100644 index 0000000..5e0759f --- /dev/null +++ b/src/router/modules/work.js @@ -0,0 +1,24 @@ +/* Layout */ +import Layout from '@/layout/Layout' + +export const workRouters = [ + { + path: 'toiletWork', + component: Layout, + redirect: '/toiletManage', + name: 'toiletWork', + meta: { + title: '作业管理', + icon: 'icon-config', // 图标 + permission: ['/toiletWork']// 权限名称 + }, + children: [ + { + path: '/toiletWork', + name: 'ToiletWork', + component: () => import('@/views/toiletClean/toiletCleanList'), + meta: { title: '作业管理', icon: 'function', permission: ['/toiletWork'] } + } + ] + } +] diff --git a/src/settings.js b/src/settings.js index b568ce0..b8159bf 100644 --- a/src/settings.js +++ b/src/settings.js @@ -3,7 +3,7 @@ * @type {boolean} true | false * @description 是否显示设置按钮 */ - showSettings: true, + showSettings: false, /** * @type {boolean} true | false diff --git a/src/store/modules/permission.js b/src/store/modules/permission.js index a0cb8cf..3ab50d5 100644 --- a/src/store/modules/permission.js +++ b/src/store/modules/permission.js @@ -120,17 +120,23 @@ }) }, // 获取用户权限 - GetMenus({ commit, state }) { - console.log('in store.permission.js:GetMenus:') + GetMenus({ commit, state }, currentSystem) { + // console.log('in store.permission.js:GetMenus:') + console.log('获取' + currentSystem.name + '的菜单') + const params = { + parentCode: currentSystem.code // 传入该子系统的code,获取子系统的权限 + } return new Promise((resolve, reject) => { - getMenus(state.token).then(response => { // 处理返回值 + // 此处获取用户所有权限 + getMenus(params).then(response => { // 处理返回值 const data = response.data const menus = [] // 仅菜单 const btns = [] // 非菜单 if (data.menus && data.menus.length > 0) { - commit('SET_MENUS', data.menus) - for (const menu of data.menus) { // 遍历菜单,获取所有的权限项 - if (menu.ismenu === '1') { // 将是菜单的放入menus + const allmenus = [...data.menus] + commit('SET_MENUS', allmenus) + for (const menu of allmenus) { // 遍历菜单,获取所有的权限项 + if (menu.resourceType === '02' || menu.resourceType === '03') { // 将是菜单的放入menus const menu_tmp = {} menu_tmp.url = menu.url menu_tmp.icon = menu.icon @@ -142,11 +148,11 @@ btn_tmp.name = menu.name btn_tmp.icon = menu.icon btns.push(btn_tmp) - // console.log(menu.url) } } // 过滤路由表 - const accessedRouters = filterAsyncRouter(asyncRouterMap, menus) + let accessedRouters = filterAsyncRouter(asyncRouterMap, menus) + // accessedRouters = filterRedirect(accessedRouters) commit('SET_BTNS', btns) commit('SET_ROUTERS', accessedRouters) resolve(response) diff --git a/src/utils/baseConfig.js b/src/utils/baseConfig.js index 1f4fa38..999593e 100644 --- a/src/utils/baseConfig.js +++ b/src/utils/baseConfig.js @@ -1,5 +1,5 @@ const project = { - title: '后台管理系统前端基础框架' + title: '路桥养护子系统' } export function getProject() { return project diff --git a/src/utils/dateutils.js b/src/utils/dateutils.js index 868111a..5cd16af 100644 --- a/src/utils/dateutils.js +++ b/src/utils/dateutils.js @@ -15,15 +15,15 @@ return ct_month } -export function getLastWeek() { // 默认显示上周 +export function getLastWeek(fmt) { // 默认显示上周 const ct_month = new Date() ct_month.setTime(ct_month.getTime() - 3600 * 1000 * 24 * 7) - return ct_month + return ct_month.Format(fmt) } -export function getLastMonth() { // 默认显示上个月 +export function getLastMonth(fmt) { // 默认显示上个月 const ct_month = new Date() ct_month.setTime(ct_month.getTime() - 3600 * 1000 * 24 * 30) - return ct_month + return ct_month.Format(fmt) } // 对Date的扩展,将 Date 转化为指定格式的String diff --git a/src/utils/exportutils.js b/src/utils/exportutils.js new file mode 100644 index 0000000..b5d0bcf --- /dev/null +++ b/src/utils/exportutils.js @@ -0,0 +1,19 @@ +/** + * 导出文件工具 + * @param blob 文件 + * @param fileName 导出文件名 + */ +export function exportFile(blob, fileName) { + if (window.navigator && window.navigator.msSaveOrOpenBlob) { + navigator.msSaveBlob(blob, fileName) + } else { + const downloadElement = document.createElement('a') + const href = window.URL.createObjectURL(blob) // 创建下载的链接 + downloadElement.href = href + downloadElement.download = fileName + document.body.appendChild(downloadElement) + downloadElement.click() // 点击下载 + document.body.removeChild(downloadElement) // 下载完成移除元素 + window.URL.revokeObjectURL(href) // 释放blob对象 + } +} diff --git a/src/utils/request.js b/src/utils/request.js index c88ea76..dc56e26 100644 --- a/src/utils/request.js +++ b/src/utils/request.js @@ -17,6 +17,13 @@ config.headers['token'] = getToken() // 让每个请求携带自定义token 请根据实际情况自行修改 console.log(config.headers['token']) } + // 在接口增加时间戳 + // if (config.method === 'get') { + config.params = { + _t: Date.parse(new Date()) / 1000, + ...config.params + } + // } return config }, error => { diff --git a/src/views/mapViews/choosePointDialog.vue b/src/views/mapViews/choosePointDialog.vue new file mode 100644 index 0000000..c9dde8a --- /dev/null +++ b/src/views/mapViews/choosePointDialog.vue @@ -0,0 +1,105 @@ + + + + + diff --git a/src/views/mapViews/mapView.vue b/src/views/mapViews/mapView.vue new file mode 100644 index 0000000..a18db88 --- /dev/null +++ b/src/views/mapViews/mapView.vue @@ -0,0 +1,73 @@ + + + + + diff --git a/src/views/order/editOrder.vue b/src/views/order/editOrder.vue new file mode 100644 index 0000000..4a5fd8a --- /dev/null +++ b/src/views/order/editOrder.vue @@ -0,0 +1,319 @@ + + + + + diff --git a/src/views/order/listMaintainRecords.vue b/src/views/order/listMaintainRecords.vue new file mode 100644 index 0000000..2d4f682 --- /dev/null +++ b/src/views/order/listMaintainRecords.vue @@ -0,0 +1,327 @@ + + + + + diff --git a/src/views/overview/overview.vue b/src/views/overview/overview.vue new file mode 100644 index 0000000..9525867 --- /dev/null +++ b/src/views/overview/overview.vue @@ -0,0 +1,285 @@ + + + + + diff --git a/src/views/overview/toiletDetailDialog.vue b/src/views/overview/toiletDetailDialog.vue new file mode 100644 index 0000000..2b3a511 --- /dev/null +++ b/src/views/overview/toiletDetailDialog.vue @@ -0,0 +1,263 @@ + + + + + + diff --git a/src/views/overview/toiletLayer.vue b/src/views/overview/toiletLayer.vue new file mode 100644 index 0000000..d784323 --- /dev/null +++ b/src/views/overview/toiletLayer.vue @@ -0,0 +1,152 @@ + + + + + + diff --git a/src/views/rule/listRule.vue b/src/views/rule/listRule.vue new file mode 100644 index 0000000..a19b9e4 --- /dev/null +++ b/src/views/rule/listRule.vue @@ -0,0 +1,157 @@ + + + + + diff --git a/src/views/statistics/barChart.vue b/src/views/statistics/barChart.vue new file mode 100644 index 0000000..d10eb38 --- /dev/null +++ b/src/views/statistics/barChart.vue @@ -0,0 +1,65 @@ + + + + + diff --git a/src/views/statistics/components/evaluationListDialog.vue b/src/views/statistics/components/evaluationListDialog.vue new file mode 100644 index 0000000..1560772 --- /dev/null +++ b/src/views/statistics/components/evaluationListDialog.vue @@ -0,0 +1,100 @@ + + + + + + diff --git a/src/views/statistics/components/workChart.vue b/src/views/statistics/components/workChart.vue new file mode 100644 index 0000000..a891e0c --- /dev/null +++ b/src/views/statistics/components/workChart.vue @@ -0,0 +1,79 @@ + + + + + diff --git a/src/views/statistics/evaluationAssessment.vue b/src/views/statistics/evaluationAssessment.vue new file mode 100644 index 0000000..28dedc5 --- /dev/null +++ b/src/views/statistics/evaluationAssessment.vue @@ -0,0 +1,159 @@ + + + + + + diff --git a/src/views/statistics/pieChart.vue b/src/views/statistics/pieChart.vue new file mode 100644 index 0000000..e4dd287 --- /dev/null +++ b/src/views/statistics/pieChart.vue @@ -0,0 +1,58 @@ + + + + + diff --git a/src/views/statistics/statisticsChart.vue b/src/views/statistics/statisticsChart.vue new file mode 100644 index 0000000..2c48fe0 --- /dev/null +++ b/src/views/statistics/statisticsChart.vue @@ -0,0 +1,87 @@ + + + + + diff --git a/src/views/statistics/toiletAssessment.vue b/src/views/statistics/toiletAssessment.vue new file mode 100644 index 0000000..67aa32b --- /dev/null +++ b/src/views/statistics/toiletAssessment.vue @@ -0,0 +1,242 @@ + + + + + diff --git a/src/views/statistics/workStatistics.vue b/src/views/statistics/workStatistics.vue new file mode 100644 index 0000000..50a07f2 --- /dev/null +++ b/src/views/statistics/workStatistics.vue @@ -0,0 +1,191 @@ + + + + + diff --git a/src/views/toilet/components/detail.vue b/src/views/toilet/components/detail.vue new file mode 100644 index 0000000..247c03d --- /dev/null +++ b/src/views/toilet/components/detail.vue @@ -0,0 +1,431 @@ + + + + diff --git a/src/views/toilet/components/editToilet.vue b/src/views/toilet/components/editToilet.vue new file mode 100644 index 0000000..000deea --- /dev/null +++ b/src/views/toilet/components/editToilet.vue @@ -0,0 +1,368 @@ + + + + + diff --git a/src/views/toilet/listToilet.vue b/src/views/toilet/listToilet.vue new file mode 100644 index 0000000..2c5209e --- /dev/null +++ b/src/views/toilet/listToilet.vue @@ -0,0 +1,237 @@ + + + + + diff --git a/src/views/toilet/listWork.vue b/src/views/toilet/listWork.vue new file mode 100644 index 0000000..9281717 --- /dev/null +++ b/src/views/toilet/listWork.vue @@ -0,0 +1,206 @@ + + + + + diff --git a/src/views/toiletClean/toiletCleanList.vue b/src/views/toiletClean/toiletCleanList.vue new file mode 100644 index 0000000..9ed5b84 --- /dev/null +++ b/src/views/toiletClean/toiletCleanList.vue @@ -0,0 +1,210 @@ + + + + + diff --git a/src/views/toiletManage/editToilet.vue b/src/views/toiletManage/editToilet.vue new file mode 100644 index 0000000..1323d1e --- /dev/null +++ b/src/views/toiletManage/editToilet.vue @@ -0,0 +1,407 @@ + + + + + diff --git a/src/views/toiletManage/toiletList.vue b/src/views/toiletManage/toiletList.vue new file mode 100644 index 0000000..0860556 --- /dev/null +++ b/src/views/toiletManage/toiletList.vue @@ -0,0 +1,285 @@ + + + + + diff --git a/config/index.js b/config/index.js index 8abd37a..19b33b1 100644 --- a/config/index.js +++ b/config/index.js @@ -69,7 +69,7 @@ * then assetsPublicPath should be set to "/bar/". * In most cases please use '/' !!! */ - assetsPublicPath: '/', + assetsPublicPath: '/toilet/', /** * Source Maps diff --git a/package.json b/package.json index 45f055f..9f3a3eb 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "echarts": "^4.2.1", "element-ui": "2.13.0", "event-source-polyfill": "^1.0.5", + "file-saver": "^2.0.5", "js-cookie": "2.2.0", "jsencrypt": "^3.0.0-rc.1", "leaflet": "^1.7.1", @@ -33,7 +34,9 @@ "vue-amap": "^0.5.9", "vue-baidu-map": "^0.21.22", "vue-router": "3.0.1", - "vuex": "3.0.1" + "vue2-leaflet": "^2.7.0", + "vuex": "3.0.1", + "xlsx": "^0.17.0" }, "devDependencies": { "autoprefixer": "8.5.0", diff --git a/src/api/common.js b/src/api/common.js index 87c582b..7804714 100644 --- a/src/api/common.js +++ b/src/api/common.js @@ -2,10 +2,14 @@ * 常用接口 */ import request from '@/utils/request' +import Vue from 'vue' + // 模板下载 export function downloadTemplate(fileName) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath return request({ - url: 'template/download', + url: lampPath + 'template/download', method: 'get', params: { filename: fileName @@ -19,7 +23,7 @@ const param = new FormData() param.append('file', fileobj.file) return request({ - url: 'imageUpload', + url: 'fileUpload', method: 'post', headers: { 'Content-Type': 'multipart/form-data' }, data: param diff --git a/src/api/sanitation/statistics.js b/src/api/sanitation/statistics.js new file mode 100644 index 0000000..ffeac18 --- /dev/null +++ b/src/api/sanitation/statistics.js @@ -0,0 +1,22 @@ + +/** + * 考核统计接口 + */ +import request from '@/utils/request' +// 公厕保洁次数统计 +export function getToiletJobCount(params) { + return request({ + url: '/sanitation/statistic/toilet/jobCount', + method: 'get', + params + }) +} + +// 公厕评分统计 +export function getToiletEvaluation(params) { + return request({ + url: '/sanitation/toiletEvaluation/statistics', + method: 'get', + params + }) +} diff --git a/src/api/sanitation/toilet.js b/src/api/sanitation/toilet.js new file mode 100644 index 0000000..11affd4 --- /dev/null +++ b/src/api/sanitation/toilet.js @@ -0,0 +1,133 @@ +/** + * 公厕管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' +// 公厕查询 +export function getToiletListPage(params) { + return request({ + url: '/sanitation/toilet/listPage', + method: 'get', + params + }) +} +// 公厕查询 +export function getToiletList(pid) { + return request({ + url: '/sanitation/toilet/list', + method: 'get', + params: { + pid: pid + } + }) +} + +// 添加公厕 +export function addToilet(params) { + return request({ + url: '/sanitation/toilet/add', + method: 'post', + params + }) +} +// 修改公厕机构 +export function updateToilet(params) { + return request({ + url: '/sanitation/toilet/update', + method: 'post', + params + }) +} +// 删除公厕机构 +export function delToilet(ids) { + return request({ + url: '/sanitation/toilet/delete', + method: 'post', + params: { + ids + }, + paramsSerializer: params => { + return qs.stringify(params, { indices: false }) + } + }) +} + +// 公厕基本信息详情 +export function getToiletInfoDetail(id) { + return request({ + url: '/sanitation/toilet/detail?toiletId=' + id, + method: 'get' + }) +} + +// 某公厕保洁记录 +export function getRecordsByToilet(params) { + return request({ + url: '/sanitation/toilet/jobRecord/detail', + method: 'get', + params + }) +} + +// 某公厕平均评分 +export function getScoreByToilet(params) { + return request({ + url: '/sanitation/toiletEvaluation/detailScore', + method: 'get', + params + }) +} + +// 某公厕评分列表 +export function getScoreListByToilet(params) { + return request({ + url: '/sanitation/toiletEvaluation/list', + method: 'get', + params + }) +} + + +// 批量导入 +export function batchImportToilet(fileobj) { + const param = new FormData() + param.append('file', fileobj) + return request({ + url: '/sanitation/toilet/import', + method: 'post', + headers: { 'Content-Type': 'multipart/form-data' }, + data: param + }) +} +// 批量导出 +export function batchExportToilet(params, config) { + return request({ + url: '/sanitation/toilet/export', + method: 'get', + timeout: 120000, + params, + ...config, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 公厕保洁记录查询 +export function getToiletJobRecords(params) { + return request({ + url: '/sanitation/toilet/jobRecord', + method: 'get', + params + }) +} + +// 批量导出 +export function batchExportToiletJobRecords(params, config) { + return request({ + url: '/sanitation/toilet/exportJobRecord', + method: 'get', + timeout: 120000, + params, + ...config, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} diff --git a/src/api/system/alarm.js b/src/api/system/alarm.js new file mode 100644 index 0000000..1c3a7ab --- /dev/null +++ b/src/api/system/alarm.js @@ -0,0 +1,62 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' + +// 获取当前报警列表 +export function getAlarmNowList(params) { + return request({ + url: '/alarm/listNowPage', + method: 'get', + params + }) +} + +// 获取当前报警列表 +export function getAlarmHistoryList(params) { + return request({ + url: '/alarm/listHisPage', + method: 'get', + params + }) +} + + +// 批量消警 +export function clearAll(params) { + return request({ + url: '/alarm/allClear', + method: 'get', + params + }) +} + +// 消警 +export function clearAlarm(params) { + return request({ + url: '/alarm/cancel', + method: 'get', + params + }) +} + +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 设置报警阈值 +export function setThresh(params) { + return request({ + url: '/alarm/resetAlarmRule', + method: 'post', + params + }) +} diff --git a/src/api/system/bridge.js b/src/api/system/bridge.js new file mode 100644 index 0000000..e8a4108 --- /dev/null +++ b/src/api/system/bridge.js @@ -0,0 +1,80 @@ +/** + * 桥梁管理接口 + */ +import request from '@/utils/request' + +// 获取桥梁详情 +export function getDetail(id) { + return request({ + url: '/bridge/detail', + method: 'get', + params: { + id: id + } + }) +} + +export function updateBridge(params) { + return request({ + url: '/bridge/update', + method: 'post', + params + }) +} +// 批量导出 +export function exportRecords(params) { + return request({ + url: 'device/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +export function getContentList(params) { + return request({ + url: 'maintain/contentByType', + method: 'get', + params: { + type: params + } + }) +} +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 编辑 +export function editRecord(params) { + return request({ + url: 'maintain/update', + method: 'post', + params + }) +} +// 新增 +export function addRecord(params) { + return request({ + url: 'maintain/add', + method: 'post', + params + }) +} +// 删除 +export function delRecord(id) { + return request({ + url: 'maintain/delete', + method: 'post', + params: { + id: id + } + }) +} diff --git a/src/api/system/data.js b/src/api/system/data.js new file mode 100644 index 0000000..4c95db5 --- /dev/null +++ b/src/api/system/data.js @@ -0,0 +1,63 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +import qs from 'qs' + +// 获取当前报警列表 +export function getHistoryList(params) { + return request({ + url: '/data/hisListPage', + method: 'get', + params + }) +} + +// 获取当前报警列表 +export function getHistory(params) { + return request({ + url: '/data/hisList', + method: 'get', + params + }) +} + + + +// 批量消警 +export function clearAll(params) { + return request({ + url: '/alarm/allClear', + method: 'get', + params + }) +} + +// 消警 +export function clearAlarm(params) { + return request({ + url: '/alarm/cancel', + method: 'get', + params + }) +} + +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 设置报警阈值 +export function setThresh(params) { + return request({ + url: '/alarm/resetAlarmRule', + method: 'post', + params + }) +} diff --git a/src/api/system/order.js b/src/api/system/order.js new file mode 100644 index 0000000..7007c50 --- /dev/null +++ b/src/api/system/order.js @@ -0,0 +1,71 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +// import qs from 'qs' + +// 获取当前报警列表 +export function getRecordList(params) { + return request({ + url: '/maintain/listPage', + method: 'get', + params + }) +} +// 批量导出 +export function exportRecords(params) { + return request({ + url: 'device/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +export function getContentList(params) { + return request({ + url: 'maintain/contentByType', + method: 'get', + params: { + type: params + } + }) +} +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 编辑 +export function editRecord(params) { + return request({ + url: 'maintain/update', + method: 'post', + params + }) +} +// 新增 +export function addRecord(params) { + return request({ + url: 'maintain/add', + method: 'post', + params + }) +} +// 删除 +export function delRecord(id) { + return request({ + url: 'maintain/delete', + method: 'post', + params: { + bridgeMaintenanceId: id + } + }) +} diff --git a/src/api/system/overview.js b/src/api/system/overview.js new file mode 100644 index 0000000..bca50cc --- /dev/null +++ b/src/api/system/overview.js @@ -0,0 +1,109 @@ +import request from '@/utils/request' +import qs from "qs" +import Vue from 'vue' + +// 路灯状态统计 +export function getLampStatus() { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampStatus', + method: 'get' + }) +} + +// 路灯总览列表 +export function getLampList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampList', + method: 'get', + params + }) +} + +// 路灯详情 +export function getlampDetail(lampId) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampDetail', + method: 'get', + params: { + lampId: lampId + } + }) +} + +// 回路列表 +export function getCircuitList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/circuitList', + method: 'get', + params + }) +} + +// 灯箱列表 +export function getLampBoxList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampBoxList', + method: 'get', + params + }) +} +// 灯箱详情 +export function getLampBoxDetail(lampBoxId) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampBoxDetail', + method: 'get', + params: { + lampBoxId: lampBoxId + } + }) +} + +// 报警总览列表 +export function getAlarmList(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/alarmList', + method: 'get', + params + }) +} + +// 报警详情 +export function getAlarmDetail(alarmId) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/alarmDetail', + method: 'get', + params: { + alarmId: alarmId + } + }) +} + +// 路灯控制 +export function lampControl(params) { + const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面,否则获取不到值 + const lampPath = basetConfig.lampBasePath + return request({ + url: lampPath + 'overview/lampControl', + method: 'post', + params, + paramsSerializer: params => { + return qs.stringify(params, { indices: false }) + } + }) +} diff --git a/src/api/system/rule.js b/src/api/system/rule.js new file mode 100644 index 0000000..76c6b2d --- /dev/null +++ b/src/api/system/rule.js @@ -0,0 +1,59 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +// import qs from 'qs' + +// 获取当前报警列表 +export function getRuleList() { + return request({ + url: 'rule/listPage', + method: 'get' + }) +} +export function getContentList(params) { + return request({ + url: 'maintain/contentByType', + method: 'get', + params: { + type: params + } + }) +} +// 批量导出报警 +export function batchExportAlarm(params) { + return request({ + url: 'person/batchExport', + method: 'get', + timeout: 120000, + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 编辑 +export function editRecord(params) { + return request({ + url: 'maintain/update', + method: 'post', + params + }) +} +// 新增 +export function addRecord(params) { + return request({ + url: 'maintain/add', + method: 'post', + params + }) +} +// 删除 +export function delRecord(id) { + return request({ + url: 'maintain/delete', + method: 'post', + params: { + id: id + } + }) +} diff --git a/src/api/system/statistics.js b/src/api/system/statistics.js new file mode 100644 index 0000000..b25efe9 --- /dev/null +++ b/src/api/system/statistics.js @@ -0,0 +1,23 @@ +/** + * 人员管理接口 + */ +import request from '@/utils/request' +// import qs from 'qs' + +// +export function countByToilet(params) { + return request({ + url: '/sanitation/toiletStatistic/jobStaticByToilet', + method: 'get', + params + }) +} + +export function countByDay(params) { + return request({ + url: '/sanitation/toiletStatistic/jobStaticByDate', + method: 'get', + params + }) +} + diff --git a/src/assets/global_images/icon-position.png b/src/assets/global_images/icon-position.png new file mode 100644 index 0000000..7444038 --- /dev/null +++ b/src/assets/global_images/icon-position.png Binary files differ diff --git a/src/assets/global_images/location_green.png b/src/assets/global_images/location_green.png new file mode 100644 index 0000000..aa8be65 --- /dev/null +++ b/src/assets/global_images/location_green.png Binary files differ diff --git a/src/assets/global_images/location_red.png b/src/assets/global_images/location_red.png new file mode 100644 index 0000000..2be8c3d --- /dev/null +++ b/src/assets/global_images/location_red.png Binary files differ diff --git a/src/assets/global_images/location_yellow.png b/src/assets/global_images/location_yellow.png new file mode 100644 index 0000000..5ab6f4d --- /dev/null +++ b/src/assets/global_images/location_yellow.png Binary files differ diff --git a/src/assets/global_images/toilet-position.png b/src/assets/global_images/toilet-position.png new file mode 100644 index 0000000..7db6d9a --- /dev/null +++ b/src/assets/global_images/toilet-position.png Binary files differ diff --git a/src/assets/global_images/toilet.png b/src/assets/global_images/toilet.png new file mode 100644 index 0000000..6d9fc05 --- /dev/null +++ b/src/assets/global_images/toilet.png Binary files differ diff --git a/src/assets/global_images/toiletPhoto.png b/src/assets/global_images/toiletPhoto.png new file mode 100644 index 0000000..15d08e2 --- /dev/null +++ b/src/assets/global_images/toiletPhoto.png Binary files differ diff --git a/src/components/DownloadTemplate/index.vue b/src/components/DownloadTemplate/index.vue index 8ded2cd..7807cac 100644 --- a/src/components/DownloadTemplate/index.vue +++ b/src/components/DownloadTemplate/index.vue @@ -47,8 +47,8 @@ diff --git a/src/components/NormalTable/index.vue b/src/components/NormalTable/index.vue index 5077bef..04d322d 100644 --- a/src/components/NormalTable/index.vue +++ b/src/components/NormalTable/index.vue @@ -79,7 +79,7 @@
-
+
Object.assign(obj, { [key]: this[key] }), {}), + on: events.reduce((obj, key) => Object.assign(obj, { [key]: this.transmitEvent }), {}) + }) + } + this.props = [...extraProps, ...props.filter(prop => exceptProps.indexOf(prop))] + } +} + +export default prop => new Mixin(prop) diff --git a/src/components/mapWindow/base/mixins/common.js b/src/components/mapWindow/base/mixins/common.js new file mode 100644 index 0000000..2fd1a28 --- /dev/null +++ b/src/components/mapWindow/base/mixins/common.js @@ -0,0 +1,82 @@ +const types = { + map: { + unload: 'clearMap' + }, + control: { + unload: 'removeControl' + }, + layer: { + unload: 'removeLayer' + }, + features: { + unload: 'removeFeatures' + }, + listener: { + unload: 'removeListener' + } +} + +const getParent = $component => ($component.abstract || $component.$el === $component.$children[0].$el) ? getParent($component.$parent) : $component + +function destroyInstance () { + const { unload, renderByParent, $parent } = this + if (renderByParent) { + $parent.reload() + } + unload() +} + +class Mixin { + constructor (prop) { + this.methods = { + ready () { + const $parent = getParent(this.$parent) + const map = this.map = $parent.map + this.load() + this.$emit('ready', { + map + }) + }, + transmitEvent (e) { + this.$emit(e.type.replace(/^on/, ''), e) + }, + reload () { + this && this.$nextTick(() => { + this.unload() + this.$nextTick(this.load) + }) + }, + unload () { + const { map, originInstance } = this + try { + switch (prop.type) { + case 'search': + return originInstance.clearResults() + case 'autoComplete': + case 'lushu': + return originInstance.dispose() + case 'markerClusterer': + return originInstance.clearMarkers() + default: + map[types[prop.type].unload](originInstance) + } + } catch (e) {} + } + } + this.computed = { + renderByParent () { + return this.$parent.preventChildrenRender + } + } + this.mounted = function () { + console.log('common mounted') + const $parent = getParent(this.$parent) + const map = $parent.map + const { ready } = this + console.log(map) + map ? ready() : $parent.$on('onload', ready) + } + } +} + +export default type => new Mixin({ type }) diff --git a/src/components/mapWindow/leafletMap.vue b/src/components/mapWindow/leafletMap.vue new file mode 100644 index 0000000..b753cc0 --- /dev/null +++ b/src/components/mapWindow/leafletMap.vue @@ -0,0 +1,143 @@ + + + + + + + diff --git a/src/components/mapWindow/mapWindow.vue b/src/components/mapWindow/mapWindow.vue new file mode 100644 index 0000000..9ced291 --- /dev/null +++ b/src/components/mapWindow/mapWindow.vue @@ -0,0 +1,46 @@ + + + + + + diff --git a/src/icons/svg/bridge.svg b/src/icons/svg/bridge.svg new file mode 100644 index 0000000..1a0336f --- /dev/null +++ b/src/icons/svg/bridge.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/icons/svg/toilet.svg b/src/icons/svg/toilet.svg new file mode 100644 index 0000000..9d8e765 --- /dev/null +++ b/src/icons/svg/toilet.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/main.js b/src/main.js index f2d105d..3e4074e 100644 --- a/src/main.js +++ b/src/main.js @@ -18,6 +18,9 @@ // echart // import echarts from 'echarts' // Vue.prototype.$echarts = echarts +// 引入v-charts +import VCharts from 'v-charts' +Vue.use(VCharts) // 将自动注册所有组件为全局组件 // import dataV from '@jiaminghi/data-view' @@ -35,9 +38,19 @@ Vue.component('search-item', SearchItem) // 加载leaflet的css +// import 'leaflet/dist/leaflet.css' +// import 'leaflet-draw/dist/leaflet.draw.css' +import L from 'leaflet' import 'leaflet/dist/leaflet.css' -import 'leaflet-draw/dist/leaflet.draw.css' +Vue.config.productionTip = false +Vue.L = Vue.prototype.$L = L +delete L.Icon.Default.prototype._getIconUrl +L.Icon.Default.mergeOptions({ + iconRetinaUrl: require('leaflet/dist/images/marker-icon-2x.png'), + iconUrl: require('leaflet/dist/images/marker-icon.png'), + shadowUrl: require('leaflet/dist/images/marker-shadow.png') +}) /** * This project originally used easy-mock to simulate data, * but its official service is very unstable, diff --git a/src/permission.js b/src/permission.js index dc6b2f8..809ca86 100644 --- a/src/permission.js +++ b/src/permission.js @@ -25,8 +25,8 @@ store.dispatch('GetInfo').then(res => { // 拉取用户信息 // 设置当前子系统为基础资源子系统 const currentSys = { - code: 'baseResourse', - name: '基础资源子系统' + code: 'toliet', + name: '公共厕所管理系统' } // 将当前系统信息保存在localStorage中 store.commit('SET_SYSTEM', currentSys) diff --git a/src/router/index.js b/src/router/index.js index 39c295c..d23076d 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -8,8 +8,11 @@ /* Layout */ import Layout from '@/layout/Layout' +import { toiletRouters } from './modules/toilet' +import { workRouters } from './modules/work' +import { statisticsRouters } from './modules/statistics' +import { ruleRouters } from './modules/rule' import { systemRouters } from './modules/system' -import { exampleRouters } from './modules/example' /** * hidden: true if `hidden:true` will not show in the sidebar(default is false) @@ -40,11 +43,12 @@ ] }, // 登录页面 - { path: '/login', component: () => import('@/views/login/index'), hidden: true }, + { path: '/login', component: () => import('@/views/login/index_2'), hidden: true }, // 404错误页面 { path: '/404', component: () => import('@/views/errorPage/404'), hidden: true }, // 401 错误页面 - { path: '/401', component: () => import('@/views/errorPage/401'), hidden: true } + { path: '/401', component: () => import('@/views/errorPage/401'), hidden: true }, + { path: '/', redirect: '/toiletList', hidden: true } ] // 实例化vue的时候直挂载constantRouter export default new Router({ @@ -56,7 +60,10 @@ // 异步挂载路由 // 动态需要根据权限加载的路由表 export const asyncRouterMap = [ - ...exampleRouters, - ...systemRouters, + ...toiletRouters, + ...workRouters, + ...statisticsRouters, + ...ruleRouters, + // ...systemRouters, { path: '*', redirect: '/404', hidden: true } ] diff --git a/src/router/modules/rule.js b/src/router/modules/rule.js new file mode 100644 index 0000000..51e0283 --- /dev/null +++ b/src/router/modules/rule.js @@ -0,0 +1,24 @@ +/* Layout */ +import Layout from '@/layout/Layout' + +export const ruleRouters = [ + { + path: 'rule', + component: Layout, + redirect: '/rule', + name: 'Rule', + meta: { + title: '规章制度', + icon: 'icon-config', // 图标 + permission: ['/rule']// 权限名称 + }, + children: [ + { + path: '/rule', + name: 'Rule', + component: () => import('@/views/rule/listRule'), + meta: { title: '规章制度', icon: 'function', permission: ['/rule'] } + } + ] + } +] diff --git a/src/router/modules/statistics.js b/src/router/modules/statistics.js new file mode 100644 index 0000000..fb9cbea --- /dev/null +++ b/src/router/modules/statistics.js @@ -0,0 +1,30 @@ +/* Layout */ +import Layout from '@/layout/Layout' + +export const statisticsRouters = [ + { + path: 'statisticsToilet', + component: Layout, + redirect: '/workStatistics', + name: 'StatisticsToilet', + meta: { + title: '作业统计', + icon: 'icon-config', // 图标 + permission: ['/statisticsToilet']// 权限名称 + }, + children: [ + { + path: '/workStatistics', + name: 'WorkStatistics', + component: () => import('@/views/statistics/toiletAssessment'), + meta: { title: '作业统计', icon: '', permission: ['/toilet/workStatistics'] } + }, + { + path: '/evaluationStatistics', + name: 'EvaluationStatistics', + component: () => import('@/views/statistics/evaluationAssessment'), + meta: { title: '评价统计', icon: '', permission: ['/toilet/evaluationStatistics'] } + } + ] + } +] diff --git a/src/router/modules/toilet.js b/src/router/modules/toilet.js new file mode 100644 index 0000000..b221a0e --- /dev/null +++ b/src/router/modules/toilet.js @@ -0,0 +1,30 @@ +/* Layout */ +import Layout from '@/layout/Layout' + +export const toiletRouters = [ + { + path: 'toiletManage', + component: Layout, + redirect: '/toiletManage', + name: 'ToiletManage', + meta: { + title: '公厕管理', + icon: 'icon-config', // 图标 + permission: ['/toiletManage']// 权限名称 + }, + children: [ + { + path: '/toiletList', + name: 'ToiletList', + component: () => import('@/views/toiletManage/toiletList'), + meta: { title: '公厕台帐管理', icon: 'function', permission: ['/toiletList'] } + }, + { + path: '/toiletMap', + name: 'ToiletMap', + component: () => import('@/views/overview/overview'), + meta: { title: '地图总览', icon: 'function', permission: ['/toiletMap'] } + } + ] + } +] diff --git a/src/router/modules/work.js b/src/router/modules/work.js new file mode 100644 index 0000000..5e0759f --- /dev/null +++ b/src/router/modules/work.js @@ -0,0 +1,24 @@ +/* Layout */ +import Layout from '@/layout/Layout' + +export const workRouters = [ + { + path: 'toiletWork', + component: Layout, + redirect: '/toiletManage', + name: 'toiletWork', + meta: { + title: '作业管理', + icon: 'icon-config', // 图标 + permission: ['/toiletWork']// 权限名称 + }, + children: [ + { + path: '/toiletWork', + name: 'ToiletWork', + component: () => import('@/views/toiletClean/toiletCleanList'), + meta: { title: '作业管理', icon: 'function', permission: ['/toiletWork'] } + } + ] + } +] diff --git a/src/settings.js b/src/settings.js index b568ce0..b8159bf 100644 --- a/src/settings.js +++ b/src/settings.js @@ -3,7 +3,7 @@ * @type {boolean} true | false * @description 是否显示设置按钮 */ - showSettings: true, + showSettings: false, /** * @type {boolean} true | false diff --git a/src/store/modules/permission.js b/src/store/modules/permission.js index a0cb8cf..3ab50d5 100644 --- a/src/store/modules/permission.js +++ b/src/store/modules/permission.js @@ -120,17 +120,23 @@ }) }, // 获取用户权限 - GetMenus({ commit, state }) { - console.log('in store.permission.js:GetMenus:') + GetMenus({ commit, state }, currentSystem) { + // console.log('in store.permission.js:GetMenus:') + console.log('获取' + currentSystem.name + '的菜单') + const params = { + parentCode: currentSystem.code // 传入该子系统的code,获取子系统的权限 + } return new Promise((resolve, reject) => { - getMenus(state.token).then(response => { // 处理返回值 + // 此处获取用户所有权限 + getMenus(params).then(response => { // 处理返回值 const data = response.data const menus = [] // 仅菜单 const btns = [] // 非菜单 if (data.menus && data.menus.length > 0) { - commit('SET_MENUS', data.menus) - for (const menu of data.menus) { // 遍历菜单,获取所有的权限项 - if (menu.ismenu === '1') { // 将是菜单的放入menus + const allmenus = [...data.menus] + commit('SET_MENUS', allmenus) + for (const menu of allmenus) { // 遍历菜单,获取所有的权限项 + if (menu.resourceType === '02' || menu.resourceType === '03') { // 将是菜单的放入menus const menu_tmp = {} menu_tmp.url = menu.url menu_tmp.icon = menu.icon @@ -142,11 +148,11 @@ btn_tmp.name = menu.name btn_tmp.icon = menu.icon btns.push(btn_tmp) - // console.log(menu.url) } } // 过滤路由表 - const accessedRouters = filterAsyncRouter(asyncRouterMap, menus) + let accessedRouters = filterAsyncRouter(asyncRouterMap, menus) + // accessedRouters = filterRedirect(accessedRouters) commit('SET_BTNS', btns) commit('SET_ROUTERS', accessedRouters) resolve(response) diff --git a/src/utils/baseConfig.js b/src/utils/baseConfig.js index 1f4fa38..999593e 100644 --- a/src/utils/baseConfig.js +++ b/src/utils/baseConfig.js @@ -1,5 +1,5 @@ const project = { - title: '后台管理系统前端基础框架' + title: '路桥养护子系统' } export function getProject() { return project diff --git a/src/utils/dateutils.js b/src/utils/dateutils.js index 868111a..5cd16af 100644 --- a/src/utils/dateutils.js +++ b/src/utils/dateutils.js @@ -15,15 +15,15 @@ return ct_month } -export function getLastWeek() { // 默认显示上周 +export function getLastWeek(fmt) { // 默认显示上周 const ct_month = new Date() ct_month.setTime(ct_month.getTime() - 3600 * 1000 * 24 * 7) - return ct_month + return ct_month.Format(fmt) } -export function getLastMonth() { // 默认显示上个月 +export function getLastMonth(fmt) { // 默认显示上个月 const ct_month = new Date() ct_month.setTime(ct_month.getTime() - 3600 * 1000 * 24 * 30) - return ct_month + return ct_month.Format(fmt) } // 对Date的扩展,将 Date 转化为指定格式的String diff --git a/src/utils/exportutils.js b/src/utils/exportutils.js new file mode 100644 index 0000000..b5d0bcf --- /dev/null +++ b/src/utils/exportutils.js @@ -0,0 +1,19 @@ +/** + * 导出文件工具 + * @param blob 文件 + * @param fileName 导出文件名 + */ +export function exportFile(blob, fileName) { + if (window.navigator && window.navigator.msSaveOrOpenBlob) { + navigator.msSaveBlob(blob, fileName) + } else { + const downloadElement = document.createElement('a') + const href = window.URL.createObjectURL(blob) // 创建下载的链接 + downloadElement.href = href + downloadElement.download = fileName + document.body.appendChild(downloadElement) + downloadElement.click() // 点击下载 + document.body.removeChild(downloadElement) // 下载完成移除元素 + window.URL.revokeObjectURL(href) // 释放blob对象 + } +} diff --git a/src/utils/request.js b/src/utils/request.js index c88ea76..dc56e26 100644 --- a/src/utils/request.js +++ b/src/utils/request.js @@ -17,6 +17,13 @@ config.headers['token'] = getToken() // 让每个请求携带自定义token 请根据实际情况自行修改 console.log(config.headers['token']) } + // 在接口增加时间戳 + // if (config.method === 'get') { + config.params = { + _t: Date.parse(new Date()) / 1000, + ...config.params + } + // } return config }, error => { diff --git a/src/views/mapViews/choosePointDialog.vue b/src/views/mapViews/choosePointDialog.vue new file mode 100644 index 0000000..c9dde8a --- /dev/null +++ b/src/views/mapViews/choosePointDialog.vue @@ -0,0 +1,105 @@ + + + + + diff --git a/src/views/mapViews/mapView.vue b/src/views/mapViews/mapView.vue new file mode 100644 index 0000000..a18db88 --- /dev/null +++ b/src/views/mapViews/mapView.vue @@ -0,0 +1,73 @@ + + + + + diff --git a/src/views/order/editOrder.vue b/src/views/order/editOrder.vue new file mode 100644 index 0000000..4a5fd8a --- /dev/null +++ b/src/views/order/editOrder.vue @@ -0,0 +1,319 @@ + + + + + diff --git a/src/views/order/listMaintainRecords.vue b/src/views/order/listMaintainRecords.vue new file mode 100644 index 0000000..2d4f682 --- /dev/null +++ b/src/views/order/listMaintainRecords.vue @@ -0,0 +1,327 @@ + + + + + diff --git a/src/views/overview/overview.vue b/src/views/overview/overview.vue new file mode 100644 index 0000000..9525867 --- /dev/null +++ b/src/views/overview/overview.vue @@ -0,0 +1,285 @@ + + + + + diff --git a/src/views/overview/toiletDetailDialog.vue b/src/views/overview/toiletDetailDialog.vue new file mode 100644 index 0000000..2b3a511 --- /dev/null +++ b/src/views/overview/toiletDetailDialog.vue @@ -0,0 +1,263 @@ + + + + + + diff --git a/src/views/overview/toiletLayer.vue b/src/views/overview/toiletLayer.vue new file mode 100644 index 0000000..d784323 --- /dev/null +++ b/src/views/overview/toiletLayer.vue @@ -0,0 +1,152 @@ + + + + + + diff --git a/src/views/rule/listRule.vue b/src/views/rule/listRule.vue new file mode 100644 index 0000000..a19b9e4 --- /dev/null +++ b/src/views/rule/listRule.vue @@ -0,0 +1,157 @@ + + + + + diff --git a/src/views/statistics/barChart.vue b/src/views/statistics/barChart.vue new file mode 100644 index 0000000..d10eb38 --- /dev/null +++ b/src/views/statistics/barChart.vue @@ -0,0 +1,65 @@ + + + + + diff --git a/src/views/statistics/components/evaluationListDialog.vue b/src/views/statistics/components/evaluationListDialog.vue new file mode 100644 index 0000000..1560772 --- /dev/null +++ b/src/views/statistics/components/evaluationListDialog.vue @@ -0,0 +1,100 @@ + + + + + + diff --git a/src/views/statistics/components/workChart.vue b/src/views/statistics/components/workChart.vue new file mode 100644 index 0000000..a891e0c --- /dev/null +++ b/src/views/statistics/components/workChart.vue @@ -0,0 +1,79 @@ + + + + + diff --git a/src/views/statistics/evaluationAssessment.vue b/src/views/statistics/evaluationAssessment.vue new file mode 100644 index 0000000..28dedc5 --- /dev/null +++ b/src/views/statistics/evaluationAssessment.vue @@ -0,0 +1,159 @@ + + + + + + diff --git a/src/views/statistics/pieChart.vue b/src/views/statistics/pieChart.vue new file mode 100644 index 0000000..e4dd287 --- /dev/null +++ b/src/views/statistics/pieChart.vue @@ -0,0 +1,58 @@ + + + + + diff --git a/src/views/statistics/statisticsChart.vue b/src/views/statistics/statisticsChart.vue new file mode 100644 index 0000000..2c48fe0 --- /dev/null +++ b/src/views/statistics/statisticsChart.vue @@ -0,0 +1,87 @@ + + + + + diff --git a/src/views/statistics/toiletAssessment.vue b/src/views/statistics/toiletAssessment.vue new file mode 100644 index 0000000..67aa32b --- /dev/null +++ b/src/views/statistics/toiletAssessment.vue @@ -0,0 +1,242 @@ + + + + + diff --git a/src/views/statistics/workStatistics.vue b/src/views/statistics/workStatistics.vue new file mode 100644 index 0000000..50a07f2 --- /dev/null +++ b/src/views/statistics/workStatistics.vue @@ -0,0 +1,191 @@ + + + + + diff --git a/src/views/toilet/components/detail.vue b/src/views/toilet/components/detail.vue new file mode 100644 index 0000000..247c03d --- /dev/null +++ b/src/views/toilet/components/detail.vue @@ -0,0 +1,431 @@ + + + + diff --git a/src/views/toilet/components/editToilet.vue b/src/views/toilet/components/editToilet.vue new file mode 100644 index 0000000..000deea --- /dev/null +++ b/src/views/toilet/components/editToilet.vue @@ -0,0 +1,368 @@ + + + + + diff --git a/src/views/toilet/listToilet.vue b/src/views/toilet/listToilet.vue new file mode 100644 index 0000000..2c5209e --- /dev/null +++ b/src/views/toilet/listToilet.vue @@ -0,0 +1,237 @@ + + + + + diff --git a/src/views/toilet/listWork.vue b/src/views/toilet/listWork.vue new file mode 100644 index 0000000..9281717 --- /dev/null +++ b/src/views/toilet/listWork.vue @@ -0,0 +1,206 @@ + + + + + diff --git a/src/views/toiletClean/toiletCleanList.vue b/src/views/toiletClean/toiletCleanList.vue new file mode 100644 index 0000000..9ed5b84 --- /dev/null +++ b/src/views/toiletClean/toiletCleanList.vue @@ -0,0 +1,210 @@ + + + + + diff --git a/src/views/toiletManage/editToilet.vue b/src/views/toiletManage/editToilet.vue new file mode 100644 index 0000000..1323d1e --- /dev/null +++ b/src/views/toiletManage/editToilet.vue @@ -0,0 +1,407 @@ + + + + + diff --git a/src/views/toiletManage/toiletList.vue b/src/views/toiletManage/toiletList.vue new file mode 100644 index 0000000..0860556 --- /dev/null +++ b/src/views/toiletManage/toiletList.vue @@ -0,0 +1,285 @@ + + + + + diff --git a/static/project.config.json b/static/project.config.json index 73a7460..643a5ff 100644 --- a/static/project.config.json +++ b/static/project.config.json @@ -1,8 +1,8 @@ { - "title": "基础资源系统", + "title": "公共厕所管理系统", "baseUrl": "http://111.198.10.15:11409/", "mainPage": "http://111.198.10.15:11404/dcms/#", - "singleSys": false, + "singleSys": true, "city":"崇仁县", "mapUrl":"https://t0.tianditu.gov.cn/vec_w/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=vec&STYLE=default&TILEMATRIXSET=w&FORMAT=tiles&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}&tk=216ee92889e17ab1b083fae665d522b8", "labelUrl":"https://t0.tianditu.gov.cn/cva_w/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=cva&STYLE=default&TILEMATRIXSET=w&FORMAT=tiles&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}&tk=216ee92889e17ab1b083fae665d522b8",