diff --git a/package.json b/package.json index f590bdb..276aad6 100644 --- a/package.json +++ b/package.json @@ -35,6 +35,7 @@ "vue-amap": "^0.5.9", "vue-baidu-map": "^0.21.22", "vue-router": "3.0.1", + "vue2-leaflet": "^2.7.1", "vuex": "3.0.1" }, "devDependencies": { diff --git a/package.json b/package.json index f590bdb..276aad6 100644 --- a/package.json +++ b/package.json @@ -35,6 +35,7 @@ "vue-amap": "^0.5.9", "vue-baidu-map": "^0.21.22", "vue-router": "3.0.1", + "vue2-leaflet": "^2.7.1", "vuex": "3.0.1" }, "devDependencies": { diff --git a/src/api/environment/device.js b/src/api/environment/device.js new file mode 100644 index 0000000..04bc9dd --- /dev/null +++ b/src/api/environment/device.js @@ -0,0 +1,106 @@ +/** + * 公厕管理接口 + */ +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 getToiletCleanListPage(params) { + return request({ + url: '/sanitation/toilet/jobRecord', + 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/package.json b/package.json index f590bdb..276aad6 100644 --- a/package.json +++ b/package.json @@ -35,6 +35,7 @@ "vue-amap": "^0.5.9", "vue-baidu-map": "^0.21.22", "vue-router": "3.0.1", + "vue2-leaflet": "^2.7.1", "vuex": "3.0.1" }, "devDependencies": { diff --git a/src/api/environment/device.js b/src/api/environment/device.js new file mode 100644 index 0000000..04bc9dd --- /dev/null +++ b/src/api/environment/device.js @@ -0,0 +1,106 @@ +/** + * 公厕管理接口 + */ +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 getToiletCleanListPage(params) { + return request({ + url: '/sanitation/toilet/jobRecord', + 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/dict.js b/src/api/system/dict.js index 3415b6d..444617e 100644 --- a/src/api/system/dict.js +++ b/src/api/system/dict.js @@ -37,3 +37,11 @@ } }) } +// 获取字典值列表 +export function getDictByCode(params) { + return request({ + url: '/environment/dict/code/'+params, + method: 'get', + params + }) +} diff --git a/package.json b/package.json index f590bdb..276aad6 100644 --- a/package.json +++ b/package.json @@ -35,6 +35,7 @@ "vue-amap": "^0.5.9", "vue-baidu-map": "^0.21.22", "vue-router": "3.0.1", + "vue2-leaflet": "^2.7.1", "vuex": "3.0.1" }, "devDependencies": { diff --git a/src/api/environment/device.js b/src/api/environment/device.js new file mode 100644 index 0000000..04bc9dd --- /dev/null +++ b/src/api/environment/device.js @@ -0,0 +1,106 @@ +/** + * 公厕管理接口 + */ +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 getToiletCleanListPage(params) { + return request({ + url: '/sanitation/toilet/jobRecord', + 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/dict.js b/src/api/system/dict.js index 3415b6d..444617e 100644 --- a/src/api/system/dict.js +++ b/src/api/system/dict.js @@ -37,3 +37,11 @@ } }) } +// 获取字典值列表 +export function getDictByCode(params) { + return request({ + url: '/environment/dict/code/'+params, + method: 'get', + params + }) +} diff --git a/src/assets/icons/icon-position.png b/src/assets/icons/icon-position.png new file mode 100644 index 0000000..7444038 --- /dev/null +++ b/src/assets/icons/icon-position.png Binary files differ diff --git a/package.json b/package.json index f590bdb..276aad6 100644 --- a/package.json +++ b/package.json @@ -35,6 +35,7 @@ "vue-amap": "^0.5.9", "vue-baidu-map": "^0.21.22", "vue-router": "3.0.1", + "vue2-leaflet": "^2.7.1", "vuex": "3.0.1" }, "devDependencies": { diff --git a/src/api/environment/device.js b/src/api/environment/device.js new file mode 100644 index 0000000..04bc9dd --- /dev/null +++ b/src/api/environment/device.js @@ -0,0 +1,106 @@ +/** + * 公厕管理接口 + */ +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 getToiletCleanListPage(params) { + return request({ + url: '/sanitation/toilet/jobRecord', + 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/dict.js b/src/api/system/dict.js index 3415b6d..444617e 100644 --- a/src/api/system/dict.js +++ b/src/api/system/dict.js @@ -37,3 +37,11 @@ } }) } +// 获取字典值列表 +export function getDictByCode(params) { + return request({ + url: '/environment/dict/code/'+params, + method: 'get', + params + }) +} diff --git a/src/assets/icons/icon-position.png b/src/assets/icons/icon-position.png new file mode 100644 index 0000000..7444038 --- /dev/null +++ b/src/assets/icons/icon-position.png Binary files differ diff --git a/src/icons/svg/icon-overview.svg b/src/icons/svg/icon-overview.svg index a2f9449..9dc3936 100644 --- a/src/icons/svg/icon-overview.svg +++ b/src/icons/svg/icon-overview.svg @@ -1 +1 @@ - \ No newline at end of file + diff --git a/package.json b/package.json index f590bdb..276aad6 100644 --- a/package.json +++ b/package.json @@ -35,6 +35,7 @@ "vue-amap": "^0.5.9", "vue-baidu-map": "^0.21.22", "vue-router": "3.0.1", + "vue2-leaflet": "^2.7.1", "vuex": "3.0.1" }, "devDependencies": { diff --git a/src/api/environment/device.js b/src/api/environment/device.js new file mode 100644 index 0000000..04bc9dd --- /dev/null +++ b/src/api/environment/device.js @@ -0,0 +1,106 @@ +/** + * 公厕管理接口 + */ +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 getToiletCleanListPage(params) { + return request({ + url: '/sanitation/toilet/jobRecord', + 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/dict.js b/src/api/system/dict.js index 3415b6d..444617e 100644 --- a/src/api/system/dict.js +++ b/src/api/system/dict.js @@ -37,3 +37,11 @@ } }) } +// 获取字典值列表 +export function getDictByCode(params) { + return request({ + url: '/environment/dict/code/'+params, + method: 'get', + params + }) +} diff --git a/src/assets/icons/icon-position.png b/src/assets/icons/icon-position.png new file mode 100644 index 0000000..7444038 --- /dev/null +++ b/src/assets/icons/icon-position.png Binary files differ diff --git a/src/icons/svg/icon-overview.svg b/src/icons/svg/icon-overview.svg index a2f9449..9dc3936 100644 --- a/src/icons/svg/icon-overview.svg +++ b/src/icons/svg/icon-overview.svg @@ -1 +1 @@ - \ No newline at end of file + diff --git a/src/main.js b/src/main.js index edd9b93..5cd086d 100644 --- a/src/main.js +++ b/src/main.js @@ -20,8 +20,9 @@ import 'esri-leaflet-renderers/dist/esri-leaflet-renderers.js' // 引入Leaflet对象 挂载到Vue上,便于全局使用,也可以单独页面中单独引用 -import * as L from 'leaflet' -Vue.L = Vue.prototype.$L = L +// 加载leaflet的css +import 'leaflet/dist/leaflet.css' +import 'leaflet-draw/dist/leaflet.draw.css' import VCharts from 'v-charts' Vue.use(VCharts) diff --git a/package.json b/package.json index f590bdb..276aad6 100644 --- a/package.json +++ b/package.json @@ -35,6 +35,7 @@ "vue-amap": "^0.5.9", "vue-baidu-map": "^0.21.22", "vue-router": "3.0.1", + "vue2-leaflet": "^2.7.1", "vuex": "3.0.1" }, "devDependencies": { diff --git a/src/api/environment/device.js b/src/api/environment/device.js new file mode 100644 index 0000000..04bc9dd --- /dev/null +++ b/src/api/environment/device.js @@ -0,0 +1,106 @@ +/** + * 公厕管理接口 + */ +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 getToiletCleanListPage(params) { + return request({ + url: '/sanitation/toilet/jobRecord', + 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/dict.js b/src/api/system/dict.js index 3415b6d..444617e 100644 --- a/src/api/system/dict.js +++ b/src/api/system/dict.js @@ -37,3 +37,11 @@ } }) } +// 获取字典值列表 +export function getDictByCode(params) { + return request({ + url: '/environment/dict/code/'+params, + method: 'get', + params + }) +} diff --git a/src/assets/icons/icon-position.png b/src/assets/icons/icon-position.png new file mode 100644 index 0000000..7444038 --- /dev/null +++ b/src/assets/icons/icon-position.png Binary files differ diff --git a/src/icons/svg/icon-overview.svg b/src/icons/svg/icon-overview.svg index a2f9449..9dc3936 100644 --- a/src/icons/svg/icon-overview.svg +++ b/src/icons/svg/icon-overview.svg @@ -1 +1 @@ - \ No newline at end of file + diff --git a/src/main.js b/src/main.js index edd9b93..5cd086d 100644 --- a/src/main.js +++ b/src/main.js @@ -20,8 +20,9 @@ import 'esri-leaflet-renderers/dist/esri-leaflet-renderers.js' // 引入Leaflet对象 挂载到Vue上,便于全局使用,也可以单独页面中单独引用 -import * as L from 'leaflet' -Vue.L = Vue.prototype.$L = L +// 加载leaflet的css +import 'leaflet/dist/leaflet.css' +import 'leaflet-draw/dist/leaflet.draw.css' import VCharts from 'v-charts' Vue.use(VCharts) diff --git a/src/permission.js b/src/permission.js index b7f3a79..7ef5999 100644 --- a/src/permission.js +++ b/src/permission.js @@ -26,7 +26,7 @@ // 设置当前子系统为基础资源子系统 const currentSys = { code: 'environment', - name: '视频与环境监测子系统' + name: '环境监测系统' } // 将当前系统信息保存在localStorage中 store.commit('SET_SYSTEM', currentSys) diff --git a/package.json b/package.json index f590bdb..276aad6 100644 --- a/package.json +++ b/package.json @@ -35,6 +35,7 @@ "vue-amap": "^0.5.9", "vue-baidu-map": "^0.21.22", "vue-router": "3.0.1", + "vue2-leaflet": "^2.7.1", "vuex": "3.0.1" }, "devDependencies": { diff --git a/src/api/environment/device.js b/src/api/environment/device.js new file mode 100644 index 0000000..04bc9dd --- /dev/null +++ b/src/api/environment/device.js @@ -0,0 +1,106 @@ +/** + * 公厕管理接口 + */ +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 getToiletCleanListPage(params) { + return request({ + url: '/sanitation/toilet/jobRecord', + 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/dict.js b/src/api/system/dict.js index 3415b6d..444617e 100644 --- a/src/api/system/dict.js +++ b/src/api/system/dict.js @@ -37,3 +37,11 @@ } }) } +// 获取字典值列表 +export function getDictByCode(params) { + return request({ + url: '/environment/dict/code/'+params, + method: 'get', + params + }) +} diff --git a/src/assets/icons/icon-position.png b/src/assets/icons/icon-position.png new file mode 100644 index 0000000..7444038 --- /dev/null +++ b/src/assets/icons/icon-position.png Binary files differ diff --git a/src/icons/svg/icon-overview.svg b/src/icons/svg/icon-overview.svg index a2f9449..9dc3936 100644 --- a/src/icons/svg/icon-overview.svg +++ b/src/icons/svg/icon-overview.svg @@ -1 +1 @@ - \ No newline at end of file + diff --git a/src/main.js b/src/main.js index edd9b93..5cd086d 100644 --- a/src/main.js +++ b/src/main.js @@ -20,8 +20,9 @@ import 'esri-leaflet-renderers/dist/esri-leaflet-renderers.js' // 引入Leaflet对象 挂载到Vue上,便于全局使用,也可以单独页面中单独引用 -import * as L from 'leaflet' -Vue.L = Vue.prototype.$L = L +// 加载leaflet的css +import 'leaflet/dist/leaflet.css' +import 'leaflet-draw/dist/leaflet.draw.css' import VCharts from 'v-charts' Vue.use(VCharts) diff --git a/src/permission.js b/src/permission.js index b7f3a79..7ef5999 100644 --- a/src/permission.js +++ b/src/permission.js @@ -26,7 +26,7 @@ // 设置当前子系统为基础资源子系统 const currentSys = { code: 'environment', - name: '视频与环境监测子系统' + name: '环境监测系统' } // 将当前系统信息保存在localStorage中 store.commit('SET_SYSTEM', currentSys) diff --git a/src/router/index.js b/src/router/index.js index 8af362f..7ec2018 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -11,6 +11,7 @@ import { overviewRouters } from './modules/overview' import { videoRouters } from './modules/video' import { systemRouters } from './modules/system' +import { configRouters } from './modules/config' import { environmentRouters } from './modules/environment' /** @@ -42,7 +43,7 @@ ] }, // 登录页面 - { 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 错误页面 @@ -59,8 +60,7 @@ // 动态需要根据权限加载的路由表 export const asyncRouterMap = [ ...overviewRouters, - ...videoRouters, ...environmentRouters, - // ...systemRouters, + ...configRouters, { path: '*', redirect: '/404', hidden: true } ] diff --git a/package.json b/package.json index f590bdb..276aad6 100644 --- a/package.json +++ b/package.json @@ -35,6 +35,7 @@ "vue-amap": "^0.5.9", "vue-baidu-map": "^0.21.22", "vue-router": "3.0.1", + "vue2-leaflet": "^2.7.1", "vuex": "3.0.1" }, "devDependencies": { diff --git a/src/api/environment/device.js b/src/api/environment/device.js new file mode 100644 index 0000000..04bc9dd --- /dev/null +++ b/src/api/environment/device.js @@ -0,0 +1,106 @@ +/** + * 公厕管理接口 + */ +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 getToiletCleanListPage(params) { + return request({ + url: '/sanitation/toilet/jobRecord', + 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/dict.js b/src/api/system/dict.js index 3415b6d..444617e 100644 --- a/src/api/system/dict.js +++ b/src/api/system/dict.js @@ -37,3 +37,11 @@ } }) } +// 获取字典值列表 +export function getDictByCode(params) { + return request({ + url: '/environment/dict/code/'+params, + method: 'get', + params + }) +} diff --git a/src/assets/icons/icon-position.png b/src/assets/icons/icon-position.png new file mode 100644 index 0000000..7444038 --- /dev/null +++ b/src/assets/icons/icon-position.png Binary files differ diff --git a/src/icons/svg/icon-overview.svg b/src/icons/svg/icon-overview.svg index a2f9449..9dc3936 100644 --- a/src/icons/svg/icon-overview.svg +++ b/src/icons/svg/icon-overview.svg @@ -1 +1 @@ - \ No newline at end of file + diff --git a/src/main.js b/src/main.js index edd9b93..5cd086d 100644 --- a/src/main.js +++ b/src/main.js @@ -20,8 +20,9 @@ import 'esri-leaflet-renderers/dist/esri-leaflet-renderers.js' // 引入Leaflet对象 挂载到Vue上,便于全局使用,也可以单独页面中单独引用 -import * as L from 'leaflet' -Vue.L = Vue.prototype.$L = L +// 加载leaflet的css +import 'leaflet/dist/leaflet.css' +import 'leaflet-draw/dist/leaflet.draw.css' import VCharts from 'v-charts' Vue.use(VCharts) diff --git a/src/permission.js b/src/permission.js index b7f3a79..7ef5999 100644 --- a/src/permission.js +++ b/src/permission.js @@ -26,7 +26,7 @@ // 设置当前子系统为基础资源子系统 const currentSys = { code: 'environment', - name: '视频与环境监测子系统' + name: '环境监测系统' } // 将当前系统信息保存在localStorage中 store.commit('SET_SYSTEM', currentSys) diff --git a/src/router/index.js b/src/router/index.js index 8af362f..7ec2018 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -11,6 +11,7 @@ import { overviewRouters } from './modules/overview' import { videoRouters } from './modules/video' import { systemRouters } from './modules/system' +import { configRouters } from './modules/config' import { environmentRouters } from './modules/environment' /** @@ -42,7 +43,7 @@ ] }, // 登录页面 - { 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 错误页面 @@ -59,8 +60,7 @@ // 动态需要根据权限加载的路由表 export const asyncRouterMap = [ ...overviewRouters, - ...videoRouters, ...environmentRouters, - // ...systemRouters, + ...configRouters, { path: '*', redirect: '/404', hidden: true } ] diff --git a/src/router/modules/config.js b/src/router/modules/config.js new file mode 100644 index 0000000..eb29210 --- /dev/null +++ b/src/router/modules/config.js @@ -0,0 +1,28 @@ +/* Layout */ +import Layout from '@/layout/Layout' +export const configRouters = [{ + path: 'system', + component: Layout, + redirect: '/dict', + name: 'System', + alwaysShow: true, + meta: { + title: '系统配置', + icon: 'icon-config', // 图标 + permission: ['/environment/sysconfig']// 权限名称 + }, + children: [ + { + path: '/dict', + name: 'Dict', + component: () => import('@/views/system/dict/listDict'), + meta: { title: '字典管理', icon: 'function', permission: ['/environment/dict/listPage'] } + }, + { + path: '/alarmLevel', + component: () => import('@/views/system/log/listLog'), // Parent router-view + name: 'AlarmLevel', + meta: { title: '报警等级管理', permission: ['/environment/alarmLevel/list'] } + } + ] +}] diff --git a/package.json b/package.json index f590bdb..276aad6 100644 --- a/package.json +++ b/package.json @@ -35,6 +35,7 @@ "vue-amap": "^0.5.9", "vue-baidu-map": "^0.21.22", "vue-router": "3.0.1", + "vue2-leaflet": "^2.7.1", "vuex": "3.0.1" }, "devDependencies": { diff --git a/src/api/environment/device.js b/src/api/environment/device.js new file mode 100644 index 0000000..04bc9dd --- /dev/null +++ b/src/api/environment/device.js @@ -0,0 +1,106 @@ +/** + * 公厕管理接口 + */ +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 getToiletCleanListPage(params) { + return request({ + url: '/sanitation/toilet/jobRecord', + 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/dict.js b/src/api/system/dict.js index 3415b6d..444617e 100644 --- a/src/api/system/dict.js +++ b/src/api/system/dict.js @@ -37,3 +37,11 @@ } }) } +// 获取字典值列表 +export function getDictByCode(params) { + return request({ + url: '/environment/dict/code/'+params, + method: 'get', + params + }) +} diff --git a/src/assets/icons/icon-position.png b/src/assets/icons/icon-position.png new file mode 100644 index 0000000..7444038 --- /dev/null +++ b/src/assets/icons/icon-position.png Binary files differ diff --git a/src/icons/svg/icon-overview.svg b/src/icons/svg/icon-overview.svg index a2f9449..9dc3936 100644 --- a/src/icons/svg/icon-overview.svg +++ b/src/icons/svg/icon-overview.svg @@ -1 +1 @@ - \ No newline at end of file + diff --git a/src/main.js b/src/main.js index edd9b93..5cd086d 100644 --- a/src/main.js +++ b/src/main.js @@ -20,8 +20,9 @@ import 'esri-leaflet-renderers/dist/esri-leaflet-renderers.js' // 引入Leaflet对象 挂载到Vue上,便于全局使用,也可以单独页面中单独引用 -import * as L from 'leaflet' -Vue.L = Vue.prototype.$L = L +// 加载leaflet的css +import 'leaflet/dist/leaflet.css' +import 'leaflet-draw/dist/leaflet.draw.css' import VCharts from 'v-charts' Vue.use(VCharts) diff --git a/src/permission.js b/src/permission.js index b7f3a79..7ef5999 100644 --- a/src/permission.js +++ b/src/permission.js @@ -26,7 +26,7 @@ // 设置当前子系统为基础资源子系统 const currentSys = { code: 'environment', - name: '视频与环境监测子系统' + name: '环境监测系统' } // 将当前系统信息保存在localStorage中 store.commit('SET_SYSTEM', currentSys) diff --git a/src/router/index.js b/src/router/index.js index 8af362f..7ec2018 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -11,6 +11,7 @@ import { overviewRouters } from './modules/overview' import { videoRouters } from './modules/video' import { systemRouters } from './modules/system' +import { configRouters } from './modules/config' import { environmentRouters } from './modules/environment' /** @@ -42,7 +43,7 @@ ] }, // 登录页面 - { 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 错误页面 @@ -59,8 +60,7 @@ // 动态需要根据权限加载的路由表 export const asyncRouterMap = [ ...overviewRouters, - ...videoRouters, ...environmentRouters, - // ...systemRouters, + ...configRouters, { path: '*', redirect: '/404', hidden: true } ] diff --git a/src/router/modules/config.js b/src/router/modules/config.js new file mode 100644 index 0000000..eb29210 --- /dev/null +++ b/src/router/modules/config.js @@ -0,0 +1,28 @@ +/* Layout */ +import Layout from '@/layout/Layout' +export const configRouters = [{ + path: 'system', + component: Layout, + redirect: '/dict', + name: 'System', + alwaysShow: true, + meta: { + title: '系统配置', + icon: 'icon-config', // 图标 + permission: ['/environment/sysconfig']// 权限名称 + }, + children: [ + { + path: '/dict', + name: 'Dict', + component: () => import('@/views/system/dict/listDict'), + meta: { title: '字典管理', icon: 'function', permission: ['/environment/dict/listPage'] } + }, + { + path: '/alarmLevel', + component: () => import('@/views/system/log/listLog'), // Parent router-view + name: 'AlarmLevel', + meta: { title: '报警等级管理', permission: ['/environment/alarmLevel/list'] } + } + ] +}] diff --git a/src/router/modules/environment.js b/src/router/modules/environment.js index 62128a8..10f1d58 100644 --- a/src/router/modules/environment.js +++ b/src/router/modules/environment.js @@ -16,31 +16,85 @@ }] }, { - path: 'environment', + path: 'alarm', component: Layout, - redirect: '/environmentPoint', - name: 'Environment', + redirect: '/realAlarm', + name: 'Alarm', alwaysShow: true, meta: { - title: '环境监控管理', - icon: 'icon-config' // 图标 + title: '报警管理', + icon: 'icon-alarm', // 图标 + permission: ['/environment/alarm'] }, children: [ { - path: '/environmentPoint', - name: 'EnvironmentPoint', - component: () => import('@/views/environment/environmentPoint'), - meta: { title: '环境监控点位', icon: '' } + path: '/realAlarm', + name: 'RealAlarm', + component: () => import('@/views/alarm/listAlarmNow'), + meta: { title: '实时报警', icon: '',permission: ['/environment/alarm/listReal'] } }, { - path: '/environmentData', - name: 'EnvironmentData', + path: '/historyAlarm', + name: 'historyAlarm', component: () => import('@/views/environment/environmentData'), - meta: { title: '环境监测数据', icon: '' } + meta: { title: '历史报警', icon: '', permission: ['/environment/alarm/listPage'] } + } + ] + }, + { + path: 'device', + component: Layout, + redirect: '/deivceManage', + name: 'Device', + alwaysShow: true, + meta: { + title: '设备管理', + icon: 'icon-device', // 图标 + permission: ['/environment/device/list'] + }, + children: [ + { + path: '/deviceManage', + name: 'DeviceManage', + component: () => import('@/views/device/deviceList'), + meta: { title: '设备管理', icon: '', permission: ['/environment/device/listPage'] } + }, + { + path: '/alarmRuleManage', + name: 'AlarmRuleManage', + component: () => import('@/views/alarmRule/simpleDeviceList'), + meta: { title: '设备报警阈值管理', icon: '', permission: ['/environment/alarmRule/listByDevice'] } + }, + { + path: '/deviceAlarmRule', + name: 'DeviceAlarmRule', + hidden: true, + component: () => import('@/views/alarmRule/deviceAlarmRuleList'), + meta: { title: '设备报警阈值', icon: '', activeMenu:'/alarmRuleManage' } + } + ] + }, + { + path: 'data', + component: Layout, + redirect: '/environmentRealData', + name: 'Data', + alwaysShow: true, + meta: { + title: '数据管理', + icon: 'icon-data', // 图标 + permission: ['/environment/data'] + }, + children: [ + { + path: '/realData', + name: 'RealData', + component: () => import('@/views/data/allDeviceData'), + meta: { title: '实时数据', icon: '', permission: ['/environment/data/real'] } }, { - path: '/environmentCase', - name: 'EnvironmentCase', - component: () => import('@/views/dashboard/index'), - meta: { title: '环境案卷管理', icon: '' } + path: '/historyData', + name: 'HistoryData', + component: () => import('@/views/environment/environmentData'), + meta: { title: '历史数据', icon: '', permission: ['/environment/data/historyData'] } } ] }] diff --git a/package.json b/package.json index f590bdb..276aad6 100644 --- a/package.json +++ b/package.json @@ -35,6 +35,7 @@ "vue-amap": "^0.5.9", "vue-baidu-map": "^0.21.22", "vue-router": "3.0.1", + "vue2-leaflet": "^2.7.1", "vuex": "3.0.1" }, "devDependencies": { diff --git a/src/api/environment/device.js b/src/api/environment/device.js new file mode 100644 index 0000000..04bc9dd --- /dev/null +++ b/src/api/environment/device.js @@ -0,0 +1,106 @@ +/** + * 公厕管理接口 + */ +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 getToiletCleanListPage(params) { + return request({ + url: '/sanitation/toilet/jobRecord', + 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/dict.js b/src/api/system/dict.js index 3415b6d..444617e 100644 --- a/src/api/system/dict.js +++ b/src/api/system/dict.js @@ -37,3 +37,11 @@ } }) } +// 获取字典值列表 +export function getDictByCode(params) { + return request({ + url: '/environment/dict/code/'+params, + method: 'get', + params + }) +} diff --git a/src/assets/icons/icon-position.png b/src/assets/icons/icon-position.png new file mode 100644 index 0000000..7444038 --- /dev/null +++ b/src/assets/icons/icon-position.png Binary files differ diff --git a/src/icons/svg/icon-overview.svg b/src/icons/svg/icon-overview.svg index a2f9449..9dc3936 100644 --- a/src/icons/svg/icon-overview.svg +++ b/src/icons/svg/icon-overview.svg @@ -1 +1 @@ - \ No newline at end of file + diff --git a/src/main.js b/src/main.js index edd9b93..5cd086d 100644 --- a/src/main.js +++ b/src/main.js @@ -20,8 +20,9 @@ import 'esri-leaflet-renderers/dist/esri-leaflet-renderers.js' // 引入Leaflet对象 挂载到Vue上,便于全局使用,也可以单独页面中单独引用 -import * as L from 'leaflet' -Vue.L = Vue.prototype.$L = L +// 加载leaflet的css +import 'leaflet/dist/leaflet.css' +import 'leaflet-draw/dist/leaflet.draw.css' import VCharts from 'v-charts' Vue.use(VCharts) diff --git a/src/permission.js b/src/permission.js index b7f3a79..7ef5999 100644 --- a/src/permission.js +++ b/src/permission.js @@ -26,7 +26,7 @@ // 设置当前子系统为基础资源子系统 const currentSys = { code: 'environment', - name: '视频与环境监测子系统' + name: '环境监测系统' } // 将当前系统信息保存在localStorage中 store.commit('SET_SYSTEM', currentSys) diff --git a/src/router/index.js b/src/router/index.js index 8af362f..7ec2018 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -11,6 +11,7 @@ import { overviewRouters } from './modules/overview' import { videoRouters } from './modules/video' import { systemRouters } from './modules/system' +import { configRouters } from './modules/config' import { environmentRouters } from './modules/environment' /** @@ -42,7 +43,7 @@ ] }, // 登录页面 - { 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 错误页面 @@ -59,8 +60,7 @@ // 动态需要根据权限加载的路由表 export const asyncRouterMap = [ ...overviewRouters, - ...videoRouters, ...environmentRouters, - // ...systemRouters, + ...configRouters, { path: '*', redirect: '/404', hidden: true } ] diff --git a/src/router/modules/config.js b/src/router/modules/config.js new file mode 100644 index 0000000..eb29210 --- /dev/null +++ b/src/router/modules/config.js @@ -0,0 +1,28 @@ +/* Layout */ +import Layout from '@/layout/Layout' +export const configRouters = [{ + path: 'system', + component: Layout, + redirect: '/dict', + name: 'System', + alwaysShow: true, + meta: { + title: '系统配置', + icon: 'icon-config', // 图标 + permission: ['/environment/sysconfig']// 权限名称 + }, + children: [ + { + path: '/dict', + name: 'Dict', + component: () => import('@/views/system/dict/listDict'), + meta: { title: '字典管理', icon: 'function', permission: ['/environment/dict/listPage'] } + }, + { + path: '/alarmLevel', + component: () => import('@/views/system/log/listLog'), // Parent router-view + name: 'AlarmLevel', + meta: { title: '报警等级管理', permission: ['/environment/alarmLevel/list'] } + } + ] +}] diff --git a/src/router/modules/environment.js b/src/router/modules/environment.js index 62128a8..10f1d58 100644 --- a/src/router/modules/environment.js +++ b/src/router/modules/environment.js @@ -16,31 +16,85 @@ }] }, { - path: 'environment', + path: 'alarm', component: Layout, - redirect: '/environmentPoint', - name: 'Environment', + redirect: '/realAlarm', + name: 'Alarm', alwaysShow: true, meta: { - title: '环境监控管理', - icon: 'icon-config' // 图标 + title: '报警管理', + icon: 'icon-alarm', // 图标 + permission: ['/environment/alarm'] }, children: [ { - path: '/environmentPoint', - name: 'EnvironmentPoint', - component: () => import('@/views/environment/environmentPoint'), - meta: { title: '环境监控点位', icon: '' } + path: '/realAlarm', + name: 'RealAlarm', + component: () => import('@/views/alarm/listAlarmNow'), + meta: { title: '实时报警', icon: '',permission: ['/environment/alarm/listReal'] } }, { - path: '/environmentData', - name: 'EnvironmentData', + path: '/historyAlarm', + name: 'historyAlarm', component: () => import('@/views/environment/environmentData'), - meta: { title: '环境监测数据', icon: '' } + meta: { title: '历史报警', icon: '', permission: ['/environment/alarm/listPage'] } + } + ] + }, + { + path: 'device', + component: Layout, + redirect: '/deivceManage', + name: 'Device', + alwaysShow: true, + meta: { + title: '设备管理', + icon: 'icon-device', // 图标 + permission: ['/environment/device/list'] + }, + children: [ + { + path: '/deviceManage', + name: 'DeviceManage', + component: () => import('@/views/device/deviceList'), + meta: { title: '设备管理', icon: '', permission: ['/environment/device/listPage'] } + }, + { + path: '/alarmRuleManage', + name: 'AlarmRuleManage', + component: () => import('@/views/alarmRule/simpleDeviceList'), + meta: { title: '设备报警阈值管理', icon: '', permission: ['/environment/alarmRule/listByDevice'] } + }, + { + path: '/deviceAlarmRule', + name: 'DeviceAlarmRule', + hidden: true, + component: () => import('@/views/alarmRule/deviceAlarmRuleList'), + meta: { title: '设备报警阈值', icon: '', activeMenu:'/alarmRuleManage' } + } + ] + }, + { + path: 'data', + component: Layout, + redirect: '/environmentRealData', + name: 'Data', + alwaysShow: true, + meta: { + title: '数据管理', + icon: 'icon-data', // 图标 + permission: ['/environment/data'] + }, + children: [ + { + path: '/realData', + name: 'RealData', + component: () => import('@/views/data/allDeviceData'), + meta: { title: '实时数据', icon: '', permission: ['/environment/data/real'] } }, { - path: '/environmentCase', - name: 'EnvironmentCase', - component: () => import('@/views/dashboard/index'), - meta: { title: '环境案卷管理', icon: '' } + path: '/historyData', + name: 'HistoryData', + component: () => import('@/views/environment/environmentData'), + meta: { title: '历史数据', icon: '', permission: ['/environment/data/historyData'] } } ] }] diff --git a/src/router/modules/overview.js b/src/router/modules/overview.js index 404d017..5833611 100644 --- a/src/router/modules/overview.js +++ b/src/router/modules/overview.js @@ -6,17 +6,17 @@ component: Layout, redirect: '/overview', name: 'Overview', - alwaysShow: true, meta: { title: '地图总览', - icon: 'icon-config' // 图标 + icon: 'icon-config', // 图标 + permission:'/environment/overview' }, children: [ { path: '/overview', name: 'Overview', component: () => import('@/views/overview/overview'), - meta: { title: '点位预览', icon: '' } + meta: { title: '点位预览', icon: '', permission:'/environment/overview' } } ] }] diff --git a/package.json b/package.json index f590bdb..276aad6 100644 --- a/package.json +++ b/package.json @@ -35,6 +35,7 @@ "vue-amap": "^0.5.9", "vue-baidu-map": "^0.21.22", "vue-router": "3.0.1", + "vue2-leaflet": "^2.7.1", "vuex": "3.0.1" }, "devDependencies": { diff --git a/src/api/environment/device.js b/src/api/environment/device.js new file mode 100644 index 0000000..04bc9dd --- /dev/null +++ b/src/api/environment/device.js @@ -0,0 +1,106 @@ +/** + * 公厕管理接口 + */ +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 getToiletCleanListPage(params) { + return request({ + url: '/sanitation/toilet/jobRecord', + 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/dict.js b/src/api/system/dict.js index 3415b6d..444617e 100644 --- a/src/api/system/dict.js +++ b/src/api/system/dict.js @@ -37,3 +37,11 @@ } }) } +// 获取字典值列表 +export function getDictByCode(params) { + return request({ + url: '/environment/dict/code/'+params, + method: 'get', + params + }) +} diff --git a/src/assets/icons/icon-position.png b/src/assets/icons/icon-position.png new file mode 100644 index 0000000..7444038 --- /dev/null +++ b/src/assets/icons/icon-position.png Binary files differ diff --git a/src/icons/svg/icon-overview.svg b/src/icons/svg/icon-overview.svg index a2f9449..9dc3936 100644 --- a/src/icons/svg/icon-overview.svg +++ b/src/icons/svg/icon-overview.svg @@ -1 +1 @@ - \ No newline at end of file + diff --git a/src/main.js b/src/main.js index edd9b93..5cd086d 100644 --- a/src/main.js +++ b/src/main.js @@ -20,8 +20,9 @@ import 'esri-leaflet-renderers/dist/esri-leaflet-renderers.js' // 引入Leaflet对象 挂载到Vue上,便于全局使用,也可以单独页面中单独引用 -import * as L from 'leaflet' -Vue.L = Vue.prototype.$L = L +// 加载leaflet的css +import 'leaflet/dist/leaflet.css' +import 'leaflet-draw/dist/leaflet.draw.css' import VCharts from 'v-charts' Vue.use(VCharts) diff --git a/src/permission.js b/src/permission.js index b7f3a79..7ef5999 100644 --- a/src/permission.js +++ b/src/permission.js @@ -26,7 +26,7 @@ // 设置当前子系统为基础资源子系统 const currentSys = { code: 'environment', - name: '视频与环境监测子系统' + name: '环境监测系统' } // 将当前系统信息保存在localStorage中 store.commit('SET_SYSTEM', currentSys) diff --git a/src/router/index.js b/src/router/index.js index 8af362f..7ec2018 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -11,6 +11,7 @@ import { overviewRouters } from './modules/overview' import { videoRouters } from './modules/video' import { systemRouters } from './modules/system' +import { configRouters } from './modules/config' import { environmentRouters } from './modules/environment' /** @@ -42,7 +43,7 @@ ] }, // 登录页面 - { 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 错误页面 @@ -59,8 +60,7 @@ // 动态需要根据权限加载的路由表 export const asyncRouterMap = [ ...overviewRouters, - ...videoRouters, ...environmentRouters, - // ...systemRouters, + ...configRouters, { path: '*', redirect: '/404', hidden: true } ] diff --git a/src/router/modules/config.js b/src/router/modules/config.js new file mode 100644 index 0000000..eb29210 --- /dev/null +++ b/src/router/modules/config.js @@ -0,0 +1,28 @@ +/* Layout */ +import Layout from '@/layout/Layout' +export const configRouters = [{ + path: 'system', + component: Layout, + redirect: '/dict', + name: 'System', + alwaysShow: true, + meta: { + title: '系统配置', + icon: 'icon-config', // 图标 + permission: ['/environment/sysconfig']// 权限名称 + }, + children: [ + { + path: '/dict', + name: 'Dict', + component: () => import('@/views/system/dict/listDict'), + meta: { title: '字典管理', icon: 'function', permission: ['/environment/dict/listPage'] } + }, + { + path: '/alarmLevel', + component: () => import('@/views/system/log/listLog'), // Parent router-view + name: 'AlarmLevel', + meta: { title: '报警等级管理', permission: ['/environment/alarmLevel/list'] } + } + ] +}] diff --git a/src/router/modules/environment.js b/src/router/modules/environment.js index 62128a8..10f1d58 100644 --- a/src/router/modules/environment.js +++ b/src/router/modules/environment.js @@ -16,31 +16,85 @@ }] }, { - path: 'environment', + path: 'alarm', component: Layout, - redirect: '/environmentPoint', - name: 'Environment', + redirect: '/realAlarm', + name: 'Alarm', alwaysShow: true, meta: { - title: '环境监控管理', - icon: 'icon-config' // 图标 + title: '报警管理', + icon: 'icon-alarm', // 图标 + permission: ['/environment/alarm'] }, children: [ { - path: '/environmentPoint', - name: 'EnvironmentPoint', - component: () => import('@/views/environment/environmentPoint'), - meta: { title: '环境监控点位', icon: '' } + path: '/realAlarm', + name: 'RealAlarm', + component: () => import('@/views/alarm/listAlarmNow'), + meta: { title: '实时报警', icon: '',permission: ['/environment/alarm/listReal'] } }, { - path: '/environmentData', - name: 'EnvironmentData', + path: '/historyAlarm', + name: 'historyAlarm', component: () => import('@/views/environment/environmentData'), - meta: { title: '环境监测数据', icon: '' } + meta: { title: '历史报警', icon: '', permission: ['/environment/alarm/listPage'] } + } + ] + }, + { + path: 'device', + component: Layout, + redirect: '/deivceManage', + name: 'Device', + alwaysShow: true, + meta: { + title: '设备管理', + icon: 'icon-device', // 图标 + permission: ['/environment/device/list'] + }, + children: [ + { + path: '/deviceManage', + name: 'DeviceManage', + component: () => import('@/views/device/deviceList'), + meta: { title: '设备管理', icon: '', permission: ['/environment/device/listPage'] } + }, + { + path: '/alarmRuleManage', + name: 'AlarmRuleManage', + component: () => import('@/views/alarmRule/simpleDeviceList'), + meta: { title: '设备报警阈值管理', icon: '', permission: ['/environment/alarmRule/listByDevice'] } + }, + { + path: '/deviceAlarmRule', + name: 'DeviceAlarmRule', + hidden: true, + component: () => import('@/views/alarmRule/deviceAlarmRuleList'), + meta: { title: '设备报警阈值', icon: '', activeMenu:'/alarmRuleManage' } + } + ] + }, + { + path: 'data', + component: Layout, + redirect: '/environmentRealData', + name: 'Data', + alwaysShow: true, + meta: { + title: '数据管理', + icon: 'icon-data', // 图标 + permission: ['/environment/data'] + }, + children: [ + { + path: '/realData', + name: 'RealData', + component: () => import('@/views/data/allDeviceData'), + meta: { title: '实时数据', icon: '', permission: ['/environment/data/real'] } }, { - path: '/environmentCase', - name: 'EnvironmentCase', - component: () => import('@/views/dashboard/index'), - meta: { title: '环境案卷管理', icon: '' } + path: '/historyData', + name: 'HistoryData', + component: () => import('@/views/environment/environmentData'), + meta: { title: '历史数据', icon: '', permission: ['/environment/data/historyData'] } } ] }] diff --git a/src/router/modules/overview.js b/src/router/modules/overview.js index 404d017..5833611 100644 --- a/src/router/modules/overview.js +++ b/src/router/modules/overview.js @@ -6,17 +6,17 @@ component: Layout, redirect: '/overview', name: 'Overview', - alwaysShow: true, meta: { title: '地图总览', - icon: 'icon-config' // 图标 + icon: 'icon-config', // 图标 + permission:'/environment/overview' }, children: [ { path: '/overview', name: 'Overview', component: () => import('@/views/overview/overview'), - meta: { title: '点位预览', icon: '' } + meta: { title: '点位预览', icon: '', permission:'/environment/overview' } } ] }] diff --git a/src/store/modules/permission.js b/src/store/modules/permission.js index a0cb8cf..f07c0a0 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,10 @@ 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) commit('SET_BTNS', btns) commit('SET_ROUTERS', accessedRouters) resolve(response) diff --git a/package.json b/package.json index f590bdb..276aad6 100644 --- a/package.json +++ b/package.json @@ -35,6 +35,7 @@ "vue-amap": "^0.5.9", "vue-baidu-map": "^0.21.22", "vue-router": "3.0.1", + "vue2-leaflet": "^2.7.1", "vuex": "3.0.1" }, "devDependencies": { diff --git a/src/api/environment/device.js b/src/api/environment/device.js new file mode 100644 index 0000000..04bc9dd --- /dev/null +++ b/src/api/environment/device.js @@ -0,0 +1,106 @@ +/** + * 公厕管理接口 + */ +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 getToiletCleanListPage(params) { + return request({ + url: '/sanitation/toilet/jobRecord', + 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/dict.js b/src/api/system/dict.js index 3415b6d..444617e 100644 --- a/src/api/system/dict.js +++ b/src/api/system/dict.js @@ -37,3 +37,11 @@ } }) } +// 获取字典值列表 +export function getDictByCode(params) { + return request({ + url: '/environment/dict/code/'+params, + method: 'get', + params + }) +} diff --git a/src/assets/icons/icon-position.png b/src/assets/icons/icon-position.png new file mode 100644 index 0000000..7444038 --- /dev/null +++ b/src/assets/icons/icon-position.png Binary files differ diff --git a/src/icons/svg/icon-overview.svg b/src/icons/svg/icon-overview.svg index a2f9449..9dc3936 100644 --- a/src/icons/svg/icon-overview.svg +++ b/src/icons/svg/icon-overview.svg @@ -1 +1 @@ - \ No newline at end of file + diff --git a/src/main.js b/src/main.js index edd9b93..5cd086d 100644 --- a/src/main.js +++ b/src/main.js @@ -20,8 +20,9 @@ import 'esri-leaflet-renderers/dist/esri-leaflet-renderers.js' // 引入Leaflet对象 挂载到Vue上,便于全局使用,也可以单独页面中单独引用 -import * as L from 'leaflet' -Vue.L = Vue.prototype.$L = L +// 加载leaflet的css +import 'leaflet/dist/leaflet.css' +import 'leaflet-draw/dist/leaflet.draw.css' import VCharts from 'v-charts' Vue.use(VCharts) diff --git a/src/permission.js b/src/permission.js index b7f3a79..7ef5999 100644 --- a/src/permission.js +++ b/src/permission.js @@ -26,7 +26,7 @@ // 设置当前子系统为基础资源子系统 const currentSys = { code: 'environment', - name: '视频与环境监测子系统' + name: '环境监测系统' } // 将当前系统信息保存在localStorage中 store.commit('SET_SYSTEM', currentSys) diff --git a/src/router/index.js b/src/router/index.js index 8af362f..7ec2018 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -11,6 +11,7 @@ import { overviewRouters } from './modules/overview' import { videoRouters } from './modules/video' import { systemRouters } from './modules/system' +import { configRouters } from './modules/config' import { environmentRouters } from './modules/environment' /** @@ -42,7 +43,7 @@ ] }, // 登录页面 - { 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 错误页面 @@ -59,8 +60,7 @@ // 动态需要根据权限加载的路由表 export const asyncRouterMap = [ ...overviewRouters, - ...videoRouters, ...environmentRouters, - // ...systemRouters, + ...configRouters, { path: '*', redirect: '/404', hidden: true } ] diff --git a/src/router/modules/config.js b/src/router/modules/config.js new file mode 100644 index 0000000..eb29210 --- /dev/null +++ b/src/router/modules/config.js @@ -0,0 +1,28 @@ +/* Layout */ +import Layout from '@/layout/Layout' +export const configRouters = [{ + path: 'system', + component: Layout, + redirect: '/dict', + name: 'System', + alwaysShow: true, + meta: { + title: '系统配置', + icon: 'icon-config', // 图标 + permission: ['/environment/sysconfig']// 权限名称 + }, + children: [ + { + path: '/dict', + name: 'Dict', + component: () => import('@/views/system/dict/listDict'), + meta: { title: '字典管理', icon: 'function', permission: ['/environment/dict/listPage'] } + }, + { + path: '/alarmLevel', + component: () => import('@/views/system/log/listLog'), // Parent router-view + name: 'AlarmLevel', + meta: { title: '报警等级管理', permission: ['/environment/alarmLevel/list'] } + } + ] +}] diff --git a/src/router/modules/environment.js b/src/router/modules/environment.js index 62128a8..10f1d58 100644 --- a/src/router/modules/environment.js +++ b/src/router/modules/environment.js @@ -16,31 +16,85 @@ }] }, { - path: 'environment', + path: 'alarm', component: Layout, - redirect: '/environmentPoint', - name: 'Environment', + redirect: '/realAlarm', + name: 'Alarm', alwaysShow: true, meta: { - title: '环境监控管理', - icon: 'icon-config' // 图标 + title: '报警管理', + icon: 'icon-alarm', // 图标 + permission: ['/environment/alarm'] }, children: [ { - path: '/environmentPoint', - name: 'EnvironmentPoint', - component: () => import('@/views/environment/environmentPoint'), - meta: { title: '环境监控点位', icon: '' } + path: '/realAlarm', + name: 'RealAlarm', + component: () => import('@/views/alarm/listAlarmNow'), + meta: { title: '实时报警', icon: '',permission: ['/environment/alarm/listReal'] } }, { - path: '/environmentData', - name: 'EnvironmentData', + path: '/historyAlarm', + name: 'historyAlarm', component: () => import('@/views/environment/environmentData'), - meta: { title: '环境监测数据', icon: '' } + meta: { title: '历史报警', icon: '', permission: ['/environment/alarm/listPage'] } + } + ] + }, + { + path: 'device', + component: Layout, + redirect: '/deivceManage', + name: 'Device', + alwaysShow: true, + meta: { + title: '设备管理', + icon: 'icon-device', // 图标 + permission: ['/environment/device/list'] + }, + children: [ + { + path: '/deviceManage', + name: 'DeviceManage', + component: () => import('@/views/device/deviceList'), + meta: { title: '设备管理', icon: '', permission: ['/environment/device/listPage'] } + }, + { + path: '/alarmRuleManage', + name: 'AlarmRuleManage', + component: () => import('@/views/alarmRule/simpleDeviceList'), + meta: { title: '设备报警阈值管理', icon: '', permission: ['/environment/alarmRule/listByDevice'] } + }, + { + path: '/deviceAlarmRule', + name: 'DeviceAlarmRule', + hidden: true, + component: () => import('@/views/alarmRule/deviceAlarmRuleList'), + meta: { title: '设备报警阈值', icon: '', activeMenu:'/alarmRuleManage' } + } + ] + }, + { + path: 'data', + component: Layout, + redirect: '/environmentRealData', + name: 'Data', + alwaysShow: true, + meta: { + title: '数据管理', + icon: 'icon-data', // 图标 + permission: ['/environment/data'] + }, + children: [ + { + path: '/realData', + name: 'RealData', + component: () => import('@/views/data/allDeviceData'), + meta: { title: '实时数据', icon: '', permission: ['/environment/data/real'] } }, { - path: '/environmentCase', - name: 'EnvironmentCase', - component: () => import('@/views/dashboard/index'), - meta: { title: '环境案卷管理', icon: '' } + path: '/historyData', + name: 'HistoryData', + component: () => import('@/views/environment/environmentData'), + meta: { title: '历史数据', icon: '', permission: ['/environment/data/historyData'] } } ] }] diff --git a/src/router/modules/overview.js b/src/router/modules/overview.js index 404d017..5833611 100644 --- a/src/router/modules/overview.js +++ b/src/router/modules/overview.js @@ -6,17 +6,17 @@ component: Layout, redirect: '/overview', name: 'Overview', - alwaysShow: true, meta: { title: '地图总览', - icon: 'icon-config' // 图标 + icon: 'icon-config', // 图标 + permission:'/environment/overview' }, children: [ { path: '/overview', name: 'Overview', component: () => import('@/views/overview/overview'), - meta: { title: '点位预览', icon: '' } + meta: { title: '点位预览', icon: '', permission:'/environment/overview' } } ] }] diff --git a/src/store/modules/permission.js b/src/store/modules/permission.js index a0cb8cf..f07c0a0 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,10 @@ 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) commit('SET_BTNS', btns) commit('SET_ROUTERS', accessedRouters) resolve(response) 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/package.json b/package.json index f590bdb..276aad6 100644 --- a/package.json +++ b/package.json @@ -35,6 +35,7 @@ "vue-amap": "^0.5.9", "vue-baidu-map": "^0.21.22", "vue-router": "3.0.1", + "vue2-leaflet": "^2.7.1", "vuex": "3.0.1" }, "devDependencies": { diff --git a/src/api/environment/device.js b/src/api/environment/device.js new file mode 100644 index 0000000..04bc9dd --- /dev/null +++ b/src/api/environment/device.js @@ -0,0 +1,106 @@ +/** + * 公厕管理接口 + */ +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 getToiletCleanListPage(params) { + return request({ + url: '/sanitation/toilet/jobRecord', + 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/dict.js b/src/api/system/dict.js index 3415b6d..444617e 100644 --- a/src/api/system/dict.js +++ b/src/api/system/dict.js @@ -37,3 +37,11 @@ } }) } +// 获取字典值列表 +export function getDictByCode(params) { + return request({ + url: '/environment/dict/code/'+params, + method: 'get', + params + }) +} diff --git a/src/assets/icons/icon-position.png b/src/assets/icons/icon-position.png new file mode 100644 index 0000000..7444038 --- /dev/null +++ b/src/assets/icons/icon-position.png Binary files differ diff --git a/src/icons/svg/icon-overview.svg b/src/icons/svg/icon-overview.svg index a2f9449..9dc3936 100644 --- a/src/icons/svg/icon-overview.svg +++ b/src/icons/svg/icon-overview.svg @@ -1 +1 @@ - \ No newline at end of file + diff --git a/src/main.js b/src/main.js index edd9b93..5cd086d 100644 --- a/src/main.js +++ b/src/main.js @@ -20,8 +20,9 @@ import 'esri-leaflet-renderers/dist/esri-leaflet-renderers.js' // 引入Leaflet对象 挂载到Vue上,便于全局使用,也可以单独页面中单独引用 -import * as L from 'leaflet' -Vue.L = Vue.prototype.$L = L +// 加载leaflet的css +import 'leaflet/dist/leaflet.css' +import 'leaflet-draw/dist/leaflet.draw.css' import VCharts from 'v-charts' Vue.use(VCharts) diff --git a/src/permission.js b/src/permission.js index b7f3a79..7ef5999 100644 --- a/src/permission.js +++ b/src/permission.js @@ -26,7 +26,7 @@ // 设置当前子系统为基础资源子系统 const currentSys = { code: 'environment', - name: '视频与环境监测子系统' + name: '环境监测系统' } // 将当前系统信息保存在localStorage中 store.commit('SET_SYSTEM', currentSys) diff --git a/src/router/index.js b/src/router/index.js index 8af362f..7ec2018 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -11,6 +11,7 @@ import { overviewRouters } from './modules/overview' import { videoRouters } from './modules/video' import { systemRouters } from './modules/system' +import { configRouters } from './modules/config' import { environmentRouters } from './modules/environment' /** @@ -42,7 +43,7 @@ ] }, // 登录页面 - { 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 错误页面 @@ -59,8 +60,7 @@ // 动态需要根据权限加载的路由表 export const asyncRouterMap = [ ...overviewRouters, - ...videoRouters, ...environmentRouters, - // ...systemRouters, + ...configRouters, { path: '*', redirect: '/404', hidden: true } ] diff --git a/src/router/modules/config.js b/src/router/modules/config.js new file mode 100644 index 0000000..eb29210 --- /dev/null +++ b/src/router/modules/config.js @@ -0,0 +1,28 @@ +/* Layout */ +import Layout from '@/layout/Layout' +export const configRouters = [{ + path: 'system', + component: Layout, + redirect: '/dict', + name: 'System', + alwaysShow: true, + meta: { + title: '系统配置', + icon: 'icon-config', // 图标 + permission: ['/environment/sysconfig']// 权限名称 + }, + children: [ + { + path: '/dict', + name: 'Dict', + component: () => import('@/views/system/dict/listDict'), + meta: { title: '字典管理', icon: 'function', permission: ['/environment/dict/listPage'] } + }, + { + path: '/alarmLevel', + component: () => import('@/views/system/log/listLog'), // Parent router-view + name: 'AlarmLevel', + meta: { title: '报警等级管理', permission: ['/environment/alarmLevel/list'] } + } + ] +}] diff --git a/src/router/modules/environment.js b/src/router/modules/environment.js index 62128a8..10f1d58 100644 --- a/src/router/modules/environment.js +++ b/src/router/modules/environment.js @@ -16,31 +16,85 @@ }] }, { - path: 'environment', + path: 'alarm', component: Layout, - redirect: '/environmentPoint', - name: 'Environment', + redirect: '/realAlarm', + name: 'Alarm', alwaysShow: true, meta: { - title: '环境监控管理', - icon: 'icon-config' // 图标 + title: '报警管理', + icon: 'icon-alarm', // 图标 + permission: ['/environment/alarm'] }, children: [ { - path: '/environmentPoint', - name: 'EnvironmentPoint', - component: () => import('@/views/environment/environmentPoint'), - meta: { title: '环境监控点位', icon: '' } + path: '/realAlarm', + name: 'RealAlarm', + component: () => import('@/views/alarm/listAlarmNow'), + meta: { title: '实时报警', icon: '',permission: ['/environment/alarm/listReal'] } }, { - path: '/environmentData', - name: 'EnvironmentData', + path: '/historyAlarm', + name: 'historyAlarm', component: () => import('@/views/environment/environmentData'), - meta: { title: '环境监测数据', icon: '' } + meta: { title: '历史报警', icon: '', permission: ['/environment/alarm/listPage'] } + } + ] + }, + { + path: 'device', + component: Layout, + redirect: '/deivceManage', + name: 'Device', + alwaysShow: true, + meta: { + title: '设备管理', + icon: 'icon-device', // 图标 + permission: ['/environment/device/list'] + }, + children: [ + { + path: '/deviceManage', + name: 'DeviceManage', + component: () => import('@/views/device/deviceList'), + meta: { title: '设备管理', icon: '', permission: ['/environment/device/listPage'] } + }, + { + path: '/alarmRuleManage', + name: 'AlarmRuleManage', + component: () => import('@/views/alarmRule/simpleDeviceList'), + meta: { title: '设备报警阈值管理', icon: '', permission: ['/environment/alarmRule/listByDevice'] } + }, + { + path: '/deviceAlarmRule', + name: 'DeviceAlarmRule', + hidden: true, + component: () => import('@/views/alarmRule/deviceAlarmRuleList'), + meta: { title: '设备报警阈值', icon: '', activeMenu:'/alarmRuleManage' } + } + ] + }, + { + path: 'data', + component: Layout, + redirect: '/environmentRealData', + name: 'Data', + alwaysShow: true, + meta: { + title: '数据管理', + icon: 'icon-data', // 图标 + permission: ['/environment/data'] + }, + children: [ + { + path: '/realData', + name: 'RealData', + component: () => import('@/views/data/allDeviceData'), + meta: { title: '实时数据', icon: '', permission: ['/environment/data/real'] } }, { - path: '/environmentCase', - name: 'EnvironmentCase', - component: () => import('@/views/dashboard/index'), - meta: { title: '环境案卷管理', icon: '' } + path: '/historyData', + name: 'HistoryData', + component: () => import('@/views/environment/environmentData'), + meta: { title: '历史数据', icon: '', permission: ['/environment/data/historyData'] } } ] }] diff --git a/src/router/modules/overview.js b/src/router/modules/overview.js index 404d017..5833611 100644 --- a/src/router/modules/overview.js +++ b/src/router/modules/overview.js @@ -6,17 +6,17 @@ component: Layout, redirect: '/overview', name: 'Overview', - alwaysShow: true, meta: { title: '地图总览', - icon: 'icon-config' // 图标 + icon: 'icon-config', // 图标 + permission:'/environment/overview' }, children: [ { path: '/overview', name: 'Overview', component: () => import('@/views/overview/overview'), - meta: { title: '点位预览', icon: '' } + meta: { title: '点位预览', icon: '', permission:'/environment/overview' } } ] }] diff --git a/src/store/modules/permission.js b/src/store/modules/permission.js index a0cb8cf..f07c0a0 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,10 @@ 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) commit('SET_BTNS', btns) commit('SET_ROUTERS', accessedRouters) resolve(response) 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/views/alarm/listAlarmNow.vue b/src/views/alarm/listAlarmNow.vue new file mode 100644 index 0000000..75133d1 --- /dev/null +++ b/src/views/alarm/listAlarmNow.vue @@ -0,0 +1,287 @@ + + + + + diff --git a/package.json b/package.json index f590bdb..276aad6 100644 --- a/package.json +++ b/package.json @@ -35,6 +35,7 @@ "vue-amap": "^0.5.9", "vue-baidu-map": "^0.21.22", "vue-router": "3.0.1", + "vue2-leaflet": "^2.7.1", "vuex": "3.0.1" }, "devDependencies": { diff --git a/src/api/environment/device.js b/src/api/environment/device.js new file mode 100644 index 0000000..04bc9dd --- /dev/null +++ b/src/api/environment/device.js @@ -0,0 +1,106 @@ +/** + * 公厕管理接口 + */ +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 getToiletCleanListPage(params) { + return request({ + url: '/sanitation/toilet/jobRecord', + 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/dict.js b/src/api/system/dict.js index 3415b6d..444617e 100644 --- a/src/api/system/dict.js +++ b/src/api/system/dict.js @@ -37,3 +37,11 @@ } }) } +// 获取字典值列表 +export function getDictByCode(params) { + return request({ + url: '/environment/dict/code/'+params, + method: 'get', + params + }) +} diff --git a/src/assets/icons/icon-position.png b/src/assets/icons/icon-position.png new file mode 100644 index 0000000..7444038 --- /dev/null +++ b/src/assets/icons/icon-position.png Binary files differ diff --git a/src/icons/svg/icon-overview.svg b/src/icons/svg/icon-overview.svg index a2f9449..9dc3936 100644 --- a/src/icons/svg/icon-overview.svg +++ b/src/icons/svg/icon-overview.svg @@ -1 +1 @@ - \ No newline at end of file + diff --git a/src/main.js b/src/main.js index edd9b93..5cd086d 100644 --- a/src/main.js +++ b/src/main.js @@ -20,8 +20,9 @@ import 'esri-leaflet-renderers/dist/esri-leaflet-renderers.js' // 引入Leaflet对象 挂载到Vue上,便于全局使用,也可以单独页面中单独引用 -import * as L from 'leaflet' -Vue.L = Vue.prototype.$L = L +// 加载leaflet的css +import 'leaflet/dist/leaflet.css' +import 'leaflet-draw/dist/leaflet.draw.css' import VCharts from 'v-charts' Vue.use(VCharts) diff --git a/src/permission.js b/src/permission.js index b7f3a79..7ef5999 100644 --- a/src/permission.js +++ b/src/permission.js @@ -26,7 +26,7 @@ // 设置当前子系统为基础资源子系统 const currentSys = { code: 'environment', - name: '视频与环境监测子系统' + name: '环境监测系统' } // 将当前系统信息保存在localStorage中 store.commit('SET_SYSTEM', currentSys) diff --git a/src/router/index.js b/src/router/index.js index 8af362f..7ec2018 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -11,6 +11,7 @@ import { overviewRouters } from './modules/overview' import { videoRouters } from './modules/video' import { systemRouters } from './modules/system' +import { configRouters } from './modules/config' import { environmentRouters } from './modules/environment' /** @@ -42,7 +43,7 @@ ] }, // 登录页面 - { 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 错误页面 @@ -59,8 +60,7 @@ // 动态需要根据权限加载的路由表 export const asyncRouterMap = [ ...overviewRouters, - ...videoRouters, ...environmentRouters, - // ...systemRouters, + ...configRouters, { path: '*', redirect: '/404', hidden: true } ] diff --git a/src/router/modules/config.js b/src/router/modules/config.js new file mode 100644 index 0000000..eb29210 --- /dev/null +++ b/src/router/modules/config.js @@ -0,0 +1,28 @@ +/* Layout */ +import Layout from '@/layout/Layout' +export const configRouters = [{ + path: 'system', + component: Layout, + redirect: '/dict', + name: 'System', + alwaysShow: true, + meta: { + title: '系统配置', + icon: 'icon-config', // 图标 + permission: ['/environment/sysconfig']// 权限名称 + }, + children: [ + { + path: '/dict', + name: 'Dict', + component: () => import('@/views/system/dict/listDict'), + meta: { title: '字典管理', icon: 'function', permission: ['/environment/dict/listPage'] } + }, + { + path: '/alarmLevel', + component: () => import('@/views/system/log/listLog'), // Parent router-view + name: 'AlarmLevel', + meta: { title: '报警等级管理', permission: ['/environment/alarmLevel/list'] } + } + ] +}] diff --git a/src/router/modules/environment.js b/src/router/modules/environment.js index 62128a8..10f1d58 100644 --- a/src/router/modules/environment.js +++ b/src/router/modules/environment.js @@ -16,31 +16,85 @@ }] }, { - path: 'environment', + path: 'alarm', component: Layout, - redirect: '/environmentPoint', - name: 'Environment', + redirect: '/realAlarm', + name: 'Alarm', alwaysShow: true, meta: { - title: '环境监控管理', - icon: 'icon-config' // 图标 + title: '报警管理', + icon: 'icon-alarm', // 图标 + permission: ['/environment/alarm'] }, children: [ { - path: '/environmentPoint', - name: 'EnvironmentPoint', - component: () => import('@/views/environment/environmentPoint'), - meta: { title: '环境监控点位', icon: '' } + path: '/realAlarm', + name: 'RealAlarm', + component: () => import('@/views/alarm/listAlarmNow'), + meta: { title: '实时报警', icon: '',permission: ['/environment/alarm/listReal'] } }, { - path: '/environmentData', - name: 'EnvironmentData', + path: '/historyAlarm', + name: 'historyAlarm', component: () => import('@/views/environment/environmentData'), - meta: { title: '环境监测数据', icon: '' } + meta: { title: '历史报警', icon: '', permission: ['/environment/alarm/listPage'] } + } + ] + }, + { + path: 'device', + component: Layout, + redirect: '/deivceManage', + name: 'Device', + alwaysShow: true, + meta: { + title: '设备管理', + icon: 'icon-device', // 图标 + permission: ['/environment/device/list'] + }, + children: [ + { + path: '/deviceManage', + name: 'DeviceManage', + component: () => import('@/views/device/deviceList'), + meta: { title: '设备管理', icon: '', permission: ['/environment/device/listPage'] } + }, + { + path: '/alarmRuleManage', + name: 'AlarmRuleManage', + component: () => import('@/views/alarmRule/simpleDeviceList'), + meta: { title: '设备报警阈值管理', icon: '', permission: ['/environment/alarmRule/listByDevice'] } + }, + { + path: '/deviceAlarmRule', + name: 'DeviceAlarmRule', + hidden: true, + component: () => import('@/views/alarmRule/deviceAlarmRuleList'), + meta: { title: '设备报警阈值', icon: '', activeMenu:'/alarmRuleManage' } + } + ] + }, + { + path: 'data', + component: Layout, + redirect: '/environmentRealData', + name: 'Data', + alwaysShow: true, + meta: { + title: '数据管理', + icon: 'icon-data', // 图标 + permission: ['/environment/data'] + }, + children: [ + { + path: '/realData', + name: 'RealData', + component: () => import('@/views/data/allDeviceData'), + meta: { title: '实时数据', icon: '', permission: ['/environment/data/real'] } }, { - path: '/environmentCase', - name: 'EnvironmentCase', - component: () => import('@/views/dashboard/index'), - meta: { title: '环境案卷管理', icon: '' } + path: '/historyData', + name: 'HistoryData', + component: () => import('@/views/environment/environmentData'), + meta: { title: '历史数据', icon: '', permission: ['/environment/data/historyData'] } } ] }] diff --git a/src/router/modules/overview.js b/src/router/modules/overview.js index 404d017..5833611 100644 --- a/src/router/modules/overview.js +++ b/src/router/modules/overview.js @@ -6,17 +6,17 @@ component: Layout, redirect: '/overview', name: 'Overview', - alwaysShow: true, meta: { title: '地图总览', - icon: 'icon-config' // 图标 + icon: 'icon-config', // 图标 + permission:'/environment/overview' }, children: [ { path: '/overview', name: 'Overview', component: () => import('@/views/overview/overview'), - meta: { title: '点位预览', icon: '' } + meta: { title: '点位预览', icon: '', permission:'/environment/overview' } } ] }] diff --git a/src/store/modules/permission.js b/src/store/modules/permission.js index a0cb8cf..f07c0a0 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,10 @@ 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) commit('SET_BTNS', btns) commit('SET_ROUTERS', accessedRouters) resolve(response) 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/views/alarm/listAlarmNow.vue b/src/views/alarm/listAlarmNow.vue new file mode 100644 index 0000000..75133d1 --- /dev/null +++ b/src/views/alarm/listAlarmNow.vue @@ -0,0 +1,287 @@ + + + + + diff --git a/src/views/alarmRule/deviceAlarmRuleList.vue b/src/views/alarmRule/deviceAlarmRuleList.vue new file mode 100644 index 0000000..611d0bf --- /dev/null +++ b/src/views/alarmRule/deviceAlarmRuleList.vue @@ -0,0 +1,143 @@ + + + + + diff --git a/package.json b/package.json index f590bdb..276aad6 100644 --- a/package.json +++ b/package.json @@ -35,6 +35,7 @@ "vue-amap": "^0.5.9", "vue-baidu-map": "^0.21.22", "vue-router": "3.0.1", + "vue2-leaflet": "^2.7.1", "vuex": "3.0.1" }, "devDependencies": { diff --git a/src/api/environment/device.js b/src/api/environment/device.js new file mode 100644 index 0000000..04bc9dd --- /dev/null +++ b/src/api/environment/device.js @@ -0,0 +1,106 @@ +/** + * 公厕管理接口 + */ +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 getToiletCleanListPage(params) { + return request({ + url: '/sanitation/toilet/jobRecord', + 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/dict.js b/src/api/system/dict.js index 3415b6d..444617e 100644 --- a/src/api/system/dict.js +++ b/src/api/system/dict.js @@ -37,3 +37,11 @@ } }) } +// 获取字典值列表 +export function getDictByCode(params) { + return request({ + url: '/environment/dict/code/'+params, + method: 'get', + params + }) +} diff --git a/src/assets/icons/icon-position.png b/src/assets/icons/icon-position.png new file mode 100644 index 0000000..7444038 --- /dev/null +++ b/src/assets/icons/icon-position.png Binary files differ diff --git a/src/icons/svg/icon-overview.svg b/src/icons/svg/icon-overview.svg index a2f9449..9dc3936 100644 --- a/src/icons/svg/icon-overview.svg +++ b/src/icons/svg/icon-overview.svg @@ -1 +1 @@ - \ No newline at end of file + diff --git a/src/main.js b/src/main.js index edd9b93..5cd086d 100644 --- a/src/main.js +++ b/src/main.js @@ -20,8 +20,9 @@ import 'esri-leaflet-renderers/dist/esri-leaflet-renderers.js' // 引入Leaflet对象 挂载到Vue上,便于全局使用,也可以单独页面中单独引用 -import * as L from 'leaflet' -Vue.L = Vue.prototype.$L = L +// 加载leaflet的css +import 'leaflet/dist/leaflet.css' +import 'leaflet-draw/dist/leaflet.draw.css' import VCharts from 'v-charts' Vue.use(VCharts) diff --git a/src/permission.js b/src/permission.js index b7f3a79..7ef5999 100644 --- a/src/permission.js +++ b/src/permission.js @@ -26,7 +26,7 @@ // 设置当前子系统为基础资源子系统 const currentSys = { code: 'environment', - name: '视频与环境监测子系统' + name: '环境监测系统' } // 将当前系统信息保存在localStorage中 store.commit('SET_SYSTEM', currentSys) diff --git a/src/router/index.js b/src/router/index.js index 8af362f..7ec2018 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -11,6 +11,7 @@ import { overviewRouters } from './modules/overview' import { videoRouters } from './modules/video' import { systemRouters } from './modules/system' +import { configRouters } from './modules/config' import { environmentRouters } from './modules/environment' /** @@ -42,7 +43,7 @@ ] }, // 登录页面 - { 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 错误页面 @@ -59,8 +60,7 @@ // 动态需要根据权限加载的路由表 export const asyncRouterMap = [ ...overviewRouters, - ...videoRouters, ...environmentRouters, - // ...systemRouters, + ...configRouters, { path: '*', redirect: '/404', hidden: true } ] diff --git a/src/router/modules/config.js b/src/router/modules/config.js new file mode 100644 index 0000000..eb29210 --- /dev/null +++ b/src/router/modules/config.js @@ -0,0 +1,28 @@ +/* Layout */ +import Layout from '@/layout/Layout' +export const configRouters = [{ + path: 'system', + component: Layout, + redirect: '/dict', + name: 'System', + alwaysShow: true, + meta: { + title: '系统配置', + icon: 'icon-config', // 图标 + permission: ['/environment/sysconfig']// 权限名称 + }, + children: [ + { + path: '/dict', + name: 'Dict', + component: () => import('@/views/system/dict/listDict'), + meta: { title: '字典管理', icon: 'function', permission: ['/environment/dict/listPage'] } + }, + { + path: '/alarmLevel', + component: () => import('@/views/system/log/listLog'), // Parent router-view + name: 'AlarmLevel', + meta: { title: '报警等级管理', permission: ['/environment/alarmLevel/list'] } + } + ] +}] diff --git a/src/router/modules/environment.js b/src/router/modules/environment.js index 62128a8..10f1d58 100644 --- a/src/router/modules/environment.js +++ b/src/router/modules/environment.js @@ -16,31 +16,85 @@ }] }, { - path: 'environment', + path: 'alarm', component: Layout, - redirect: '/environmentPoint', - name: 'Environment', + redirect: '/realAlarm', + name: 'Alarm', alwaysShow: true, meta: { - title: '环境监控管理', - icon: 'icon-config' // 图标 + title: '报警管理', + icon: 'icon-alarm', // 图标 + permission: ['/environment/alarm'] }, children: [ { - path: '/environmentPoint', - name: 'EnvironmentPoint', - component: () => import('@/views/environment/environmentPoint'), - meta: { title: '环境监控点位', icon: '' } + path: '/realAlarm', + name: 'RealAlarm', + component: () => import('@/views/alarm/listAlarmNow'), + meta: { title: '实时报警', icon: '',permission: ['/environment/alarm/listReal'] } }, { - path: '/environmentData', - name: 'EnvironmentData', + path: '/historyAlarm', + name: 'historyAlarm', component: () => import('@/views/environment/environmentData'), - meta: { title: '环境监测数据', icon: '' } + meta: { title: '历史报警', icon: '', permission: ['/environment/alarm/listPage'] } + } + ] + }, + { + path: 'device', + component: Layout, + redirect: '/deivceManage', + name: 'Device', + alwaysShow: true, + meta: { + title: '设备管理', + icon: 'icon-device', // 图标 + permission: ['/environment/device/list'] + }, + children: [ + { + path: '/deviceManage', + name: 'DeviceManage', + component: () => import('@/views/device/deviceList'), + meta: { title: '设备管理', icon: '', permission: ['/environment/device/listPage'] } + }, + { + path: '/alarmRuleManage', + name: 'AlarmRuleManage', + component: () => import('@/views/alarmRule/simpleDeviceList'), + meta: { title: '设备报警阈值管理', icon: '', permission: ['/environment/alarmRule/listByDevice'] } + }, + { + path: '/deviceAlarmRule', + name: 'DeviceAlarmRule', + hidden: true, + component: () => import('@/views/alarmRule/deviceAlarmRuleList'), + meta: { title: '设备报警阈值', icon: '', activeMenu:'/alarmRuleManage' } + } + ] + }, + { + path: 'data', + component: Layout, + redirect: '/environmentRealData', + name: 'Data', + alwaysShow: true, + meta: { + title: '数据管理', + icon: 'icon-data', // 图标 + permission: ['/environment/data'] + }, + children: [ + { + path: '/realData', + name: 'RealData', + component: () => import('@/views/data/allDeviceData'), + meta: { title: '实时数据', icon: '', permission: ['/environment/data/real'] } }, { - path: '/environmentCase', - name: 'EnvironmentCase', - component: () => import('@/views/dashboard/index'), - meta: { title: '环境案卷管理', icon: '' } + path: '/historyData', + name: 'HistoryData', + component: () => import('@/views/environment/environmentData'), + meta: { title: '历史数据', icon: '', permission: ['/environment/data/historyData'] } } ] }] diff --git a/src/router/modules/overview.js b/src/router/modules/overview.js index 404d017..5833611 100644 --- a/src/router/modules/overview.js +++ b/src/router/modules/overview.js @@ -6,17 +6,17 @@ component: Layout, redirect: '/overview', name: 'Overview', - alwaysShow: true, meta: { title: '地图总览', - icon: 'icon-config' // 图标 + icon: 'icon-config', // 图标 + permission:'/environment/overview' }, children: [ { path: '/overview', name: 'Overview', component: () => import('@/views/overview/overview'), - meta: { title: '点位预览', icon: '' } + meta: { title: '点位预览', icon: '', permission:'/environment/overview' } } ] }] diff --git a/src/store/modules/permission.js b/src/store/modules/permission.js index a0cb8cf..f07c0a0 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,10 @@ 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) commit('SET_BTNS', btns) commit('SET_ROUTERS', accessedRouters) resolve(response) 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/views/alarm/listAlarmNow.vue b/src/views/alarm/listAlarmNow.vue new file mode 100644 index 0000000..75133d1 --- /dev/null +++ b/src/views/alarm/listAlarmNow.vue @@ -0,0 +1,287 @@ + + + + + diff --git a/src/views/alarmRule/deviceAlarmRuleList.vue b/src/views/alarmRule/deviceAlarmRuleList.vue new file mode 100644 index 0000000..611d0bf --- /dev/null +++ b/src/views/alarmRule/deviceAlarmRuleList.vue @@ -0,0 +1,143 @@ + + + + + diff --git a/src/views/alarmRule/editAlarmRule.vue b/src/views/alarmRule/editAlarmRule.vue new file mode 100644 index 0000000..67c5774 --- /dev/null +++ b/src/views/alarmRule/editAlarmRule.vue @@ -0,0 +1,226 @@ + + + + + + diff --git a/package.json b/package.json index f590bdb..276aad6 100644 --- a/package.json +++ b/package.json @@ -35,6 +35,7 @@ "vue-amap": "^0.5.9", "vue-baidu-map": "^0.21.22", "vue-router": "3.0.1", + "vue2-leaflet": "^2.7.1", "vuex": "3.0.1" }, "devDependencies": { diff --git a/src/api/environment/device.js b/src/api/environment/device.js new file mode 100644 index 0000000..04bc9dd --- /dev/null +++ b/src/api/environment/device.js @@ -0,0 +1,106 @@ +/** + * 公厕管理接口 + */ +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 getToiletCleanListPage(params) { + return request({ + url: '/sanitation/toilet/jobRecord', + 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/dict.js b/src/api/system/dict.js index 3415b6d..444617e 100644 --- a/src/api/system/dict.js +++ b/src/api/system/dict.js @@ -37,3 +37,11 @@ } }) } +// 获取字典值列表 +export function getDictByCode(params) { + return request({ + url: '/environment/dict/code/'+params, + method: 'get', + params + }) +} diff --git a/src/assets/icons/icon-position.png b/src/assets/icons/icon-position.png new file mode 100644 index 0000000..7444038 --- /dev/null +++ b/src/assets/icons/icon-position.png Binary files differ diff --git a/src/icons/svg/icon-overview.svg b/src/icons/svg/icon-overview.svg index a2f9449..9dc3936 100644 --- a/src/icons/svg/icon-overview.svg +++ b/src/icons/svg/icon-overview.svg @@ -1 +1 @@ - \ No newline at end of file + diff --git a/src/main.js b/src/main.js index edd9b93..5cd086d 100644 --- a/src/main.js +++ b/src/main.js @@ -20,8 +20,9 @@ import 'esri-leaflet-renderers/dist/esri-leaflet-renderers.js' // 引入Leaflet对象 挂载到Vue上,便于全局使用,也可以单独页面中单独引用 -import * as L from 'leaflet' -Vue.L = Vue.prototype.$L = L +// 加载leaflet的css +import 'leaflet/dist/leaflet.css' +import 'leaflet-draw/dist/leaflet.draw.css' import VCharts from 'v-charts' Vue.use(VCharts) diff --git a/src/permission.js b/src/permission.js index b7f3a79..7ef5999 100644 --- a/src/permission.js +++ b/src/permission.js @@ -26,7 +26,7 @@ // 设置当前子系统为基础资源子系统 const currentSys = { code: 'environment', - name: '视频与环境监测子系统' + name: '环境监测系统' } // 将当前系统信息保存在localStorage中 store.commit('SET_SYSTEM', currentSys) diff --git a/src/router/index.js b/src/router/index.js index 8af362f..7ec2018 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -11,6 +11,7 @@ import { overviewRouters } from './modules/overview' import { videoRouters } from './modules/video' import { systemRouters } from './modules/system' +import { configRouters } from './modules/config' import { environmentRouters } from './modules/environment' /** @@ -42,7 +43,7 @@ ] }, // 登录页面 - { 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 错误页面 @@ -59,8 +60,7 @@ // 动态需要根据权限加载的路由表 export const asyncRouterMap = [ ...overviewRouters, - ...videoRouters, ...environmentRouters, - // ...systemRouters, + ...configRouters, { path: '*', redirect: '/404', hidden: true } ] diff --git a/src/router/modules/config.js b/src/router/modules/config.js new file mode 100644 index 0000000..eb29210 --- /dev/null +++ b/src/router/modules/config.js @@ -0,0 +1,28 @@ +/* Layout */ +import Layout from '@/layout/Layout' +export const configRouters = [{ + path: 'system', + component: Layout, + redirect: '/dict', + name: 'System', + alwaysShow: true, + meta: { + title: '系统配置', + icon: 'icon-config', // 图标 + permission: ['/environment/sysconfig']// 权限名称 + }, + children: [ + { + path: '/dict', + name: 'Dict', + component: () => import('@/views/system/dict/listDict'), + meta: { title: '字典管理', icon: 'function', permission: ['/environment/dict/listPage'] } + }, + { + path: '/alarmLevel', + component: () => import('@/views/system/log/listLog'), // Parent router-view + name: 'AlarmLevel', + meta: { title: '报警等级管理', permission: ['/environment/alarmLevel/list'] } + } + ] +}] diff --git a/src/router/modules/environment.js b/src/router/modules/environment.js index 62128a8..10f1d58 100644 --- a/src/router/modules/environment.js +++ b/src/router/modules/environment.js @@ -16,31 +16,85 @@ }] }, { - path: 'environment', + path: 'alarm', component: Layout, - redirect: '/environmentPoint', - name: 'Environment', + redirect: '/realAlarm', + name: 'Alarm', alwaysShow: true, meta: { - title: '环境监控管理', - icon: 'icon-config' // 图标 + title: '报警管理', + icon: 'icon-alarm', // 图标 + permission: ['/environment/alarm'] }, children: [ { - path: '/environmentPoint', - name: 'EnvironmentPoint', - component: () => import('@/views/environment/environmentPoint'), - meta: { title: '环境监控点位', icon: '' } + path: '/realAlarm', + name: 'RealAlarm', + component: () => import('@/views/alarm/listAlarmNow'), + meta: { title: '实时报警', icon: '',permission: ['/environment/alarm/listReal'] } }, { - path: '/environmentData', - name: 'EnvironmentData', + path: '/historyAlarm', + name: 'historyAlarm', component: () => import('@/views/environment/environmentData'), - meta: { title: '环境监测数据', icon: '' } + meta: { title: '历史报警', icon: '', permission: ['/environment/alarm/listPage'] } + } + ] + }, + { + path: 'device', + component: Layout, + redirect: '/deivceManage', + name: 'Device', + alwaysShow: true, + meta: { + title: '设备管理', + icon: 'icon-device', // 图标 + permission: ['/environment/device/list'] + }, + children: [ + { + path: '/deviceManage', + name: 'DeviceManage', + component: () => import('@/views/device/deviceList'), + meta: { title: '设备管理', icon: '', permission: ['/environment/device/listPage'] } + }, + { + path: '/alarmRuleManage', + name: 'AlarmRuleManage', + component: () => import('@/views/alarmRule/simpleDeviceList'), + meta: { title: '设备报警阈值管理', icon: '', permission: ['/environment/alarmRule/listByDevice'] } + }, + { + path: '/deviceAlarmRule', + name: 'DeviceAlarmRule', + hidden: true, + component: () => import('@/views/alarmRule/deviceAlarmRuleList'), + meta: { title: '设备报警阈值', icon: '', activeMenu:'/alarmRuleManage' } + } + ] + }, + { + path: 'data', + component: Layout, + redirect: '/environmentRealData', + name: 'Data', + alwaysShow: true, + meta: { + title: '数据管理', + icon: 'icon-data', // 图标 + permission: ['/environment/data'] + }, + children: [ + { + path: '/realData', + name: 'RealData', + component: () => import('@/views/data/allDeviceData'), + meta: { title: '实时数据', icon: '', permission: ['/environment/data/real'] } }, { - path: '/environmentCase', - name: 'EnvironmentCase', - component: () => import('@/views/dashboard/index'), - meta: { title: '环境案卷管理', icon: '' } + path: '/historyData', + name: 'HistoryData', + component: () => import('@/views/environment/environmentData'), + meta: { title: '历史数据', icon: '', permission: ['/environment/data/historyData'] } } ] }] diff --git a/src/router/modules/overview.js b/src/router/modules/overview.js index 404d017..5833611 100644 --- a/src/router/modules/overview.js +++ b/src/router/modules/overview.js @@ -6,17 +6,17 @@ component: Layout, redirect: '/overview', name: 'Overview', - alwaysShow: true, meta: { title: '地图总览', - icon: 'icon-config' // 图标 + icon: 'icon-config', // 图标 + permission:'/environment/overview' }, children: [ { path: '/overview', name: 'Overview', component: () => import('@/views/overview/overview'), - meta: { title: '点位预览', icon: '' } + meta: { title: '点位预览', icon: '', permission:'/environment/overview' } } ] }] diff --git a/src/store/modules/permission.js b/src/store/modules/permission.js index a0cb8cf..f07c0a0 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,10 @@ 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) commit('SET_BTNS', btns) commit('SET_ROUTERS', accessedRouters) resolve(response) 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/views/alarm/listAlarmNow.vue b/src/views/alarm/listAlarmNow.vue new file mode 100644 index 0000000..75133d1 --- /dev/null +++ b/src/views/alarm/listAlarmNow.vue @@ -0,0 +1,287 @@ + + + + + diff --git a/src/views/alarmRule/deviceAlarmRuleList.vue b/src/views/alarmRule/deviceAlarmRuleList.vue new file mode 100644 index 0000000..611d0bf --- /dev/null +++ b/src/views/alarmRule/deviceAlarmRuleList.vue @@ -0,0 +1,143 @@ + + + + + diff --git a/src/views/alarmRule/editAlarmRule.vue b/src/views/alarmRule/editAlarmRule.vue new file mode 100644 index 0000000..67c5774 --- /dev/null +++ b/src/views/alarmRule/editAlarmRule.vue @@ -0,0 +1,226 @@ + + + + + + diff --git a/src/views/alarmRule/simpleDeviceList.vue b/src/views/alarmRule/simpleDeviceList.vue new file mode 100644 index 0000000..4a92655 --- /dev/null +++ b/src/views/alarmRule/simpleDeviceList.vue @@ -0,0 +1,167 @@ + + + + + diff --git a/package.json b/package.json index f590bdb..276aad6 100644 --- a/package.json +++ b/package.json @@ -35,6 +35,7 @@ "vue-amap": "^0.5.9", "vue-baidu-map": "^0.21.22", "vue-router": "3.0.1", + "vue2-leaflet": "^2.7.1", "vuex": "3.0.1" }, "devDependencies": { diff --git a/src/api/environment/device.js b/src/api/environment/device.js new file mode 100644 index 0000000..04bc9dd --- /dev/null +++ b/src/api/environment/device.js @@ -0,0 +1,106 @@ +/** + * 公厕管理接口 + */ +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 getToiletCleanListPage(params) { + return request({ + url: '/sanitation/toilet/jobRecord', + 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/dict.js b/src/api/system/dict.js index 3415b6d..444617e 100644 --- a/src/api/system/dict.js +++ b/src/api/system/dict.js @@ -37,3 +37,11 @@ } }) } +// 获取字典值列表 +export function getDictByCode(params) { + return request({ + url: '/environment/dict/code/'+params, + method: 'get', + params + }) +} diff --git a/src/assets/icons/icon-position.png b/src/assets/icons/icon-position.png new file mode 100644 index 0000000..7444038 --- /dev/null +++ b/src/assets/icons/icon-position.png Binary files differ diff --git a/src/icons/svg/icon-overview.svg b/src/icons/svg/icon-overview.svg index a2f9449..9dc3936 100644 --- a/src/icons/svg/icon-overview.svg +++ b/src/icons/svg/icon-overview.svg @@ -1 +1 @@ - \ No newline at end of file + diff --git a/src/main.js b/src/main.js index edd9b93..5cd086d 100644 --- a/src/main.js +++ b/src/main.js @@ -20,8 +20,9 @@ import 'esri-leaflet-renderers/dist/esri-leaflet-renderers.js' // 引入Leaflet对象 挂载到Vue上,便于全局使用,也可以单独页面中单独引用 -import * as L from 'leaflet' -Vue.L = Vue.prototype.$L = L +// 加载leaflet的css +import 'leaflet/dist/leaflet.css' +import 'leaflet-draw/dist/leaflet.draw.css' import VCharts from 'v-charts' Vue.use(VCharts) diff --git a/src/permission.js b/src/permission.js index b7f3a79..7ef5999 100644 --- a/src/permission.js +++ b/src/permission.js @@ -26,7 +26,7 @@ // 设置当前子系统为基础资源子系统 const currentSys = { code: 'environment', - name: '视频与环境监测子系统' + name: '环境监测系统' } // 将当前系统信息保存在localStorage中 store.commit('SET_SYSTEM', currentSys) diff --git a/src/router/index.js b/src/router/index.js index 8af362f..7ec2018 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -11,6 +11,7 @@ import { overviewRouters } from './modules/overview' import { videoRouters } from './modules/video' import { systemRouters } from './modules/system' +import { configRouters } from './modules/config' import { environmentRouters } from './modules/environment' /** @@ -42,7 +43,7 @@ ] }, // 登录页面 - { 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 错误页面 @@ -59,8 +60,7 @@ // 动态需要根据权限加载的路由表 export const asyncRouterMap = [ ...overviewRouters, - ...videoRouters, ...environmentRouters, - // ...systemRouters, + ...configRouters, { path: '*', redirect: '/404', hidden: true } ] diff --git a/src/router/modules/config.js b/src/router/modules/config.js new file mode 100644 index 0000000..eb29210 --- /dev/null +++ b/src/router/modules/config.js @@ -0,0 +1,28 @@ +/* Layout */ +import Layout from '@/layout/Layout' +export const configRouters = [{ + path: 'system', + component: Layout, + redirect: '/dict', + name: 'System', + alwaysShow: true, + meta: { + title: '系统配置', + icon: 'icon-config', // 图标 + permission: ['/environment/sysconfig']// 权限名称 + }, + children: [ + { + path: '/dict', + name: 'Dict', + component: () => import('@/views/system/dict/listDict'), + meta: { title: '字典管理', icon: 'function', permission: ['/environment/dict/listPage'] } + }, + { + path: '/alarmLevel', + component: () => import('@/views/system/log/listLog'), // Parent router-view + name: 'AlarmLevel', + meta: { title: '报警等级管理', permission: ['/environment/alarmLevel/list'] } + } + ] +}] diff --git a/src/router/modules/environment.js b/src/router/modules/environment.js index 62128a8..10f1d58 100644 --- a/src/router/modules/environment.js +++ b/src/router/modules/environment.js @@ -16,31 +16,85 @@ }] }, { - path: 'environment', + path: 'alarm', component: Layout, - redirect: '/environmentPoint', - name: 'Environment', + redirect: '/realAlarm', + name: 'Alarm', alwaysShow: true, meta: { - title: '环境监控管理', - icon: 'icon-config' // 图标 + title: '报警管理', + icon: 'icon-alarm', // 图标 + permission: ['/environment/alarm'] }, children: [ { - path: '/environmentPoint', - name: 'EnvironmentPoint', - component: () => import('@/views/environment/environmentPoint'), - meta: { title: '环境监控点位', icon: '' } + path: '/realAlarm', + name: 'RealAlarm', + component: () => import('@/views/alarm/listAlarmNow'), + meta: { title: '实时报警', icon: '',permission: ['/environment/alarm/listReal'] } }, { - path: '/environmentData', - name: 'EnvironmentData', + path: '/historyAlarm', + name: 'historyAlarm', component: () => import('@/views/environment/environmentData'), - meta: { title: '环境监测数据', icon: '' } + meta: { title: '历史报警', icon: '', permission: ['/environment/alarm/listPage'] } + } + ] + }, + { + path: 'device', + component: Layout, + redirect: '/deivceManage', + name: 'Device', + alwaysShow: true, + meta: { + title: '设备管理', + icon: 'icon-device', // 图标 + permission: ['/environment/device/list'] + }, + children: [ + { + path: '/deviceManage', + name: 'DeviceManage', + component: () => import('@/views/device/deviceList'), + meta: { title: '设备管理', icon: '', permission: ['/environment/device/listPage'] } + }, + { + path: '/alarmRuleManage', + name: 'AlarmRuleManage', + component: () => import('@/views/alarmRule/simpleDeviceList'), + meta: { title: '设备报警阈值管理', icon: '', permission: ['/environment/alarmRule/listByDevice'] } + }, + { + path: '/deviceAlarmRule', + name: 'DeviceAlarmRule', + hidden: true, + component: () => import('@/views/alarmRule/deviceAlarmRuleList'), + meta: { title: '设备报警阈值', icon: '', activeMenu:'/alarmRuleManage' } + } + ] + }, + { + path: 'data', + component: Layout, + redirect: '/environmentRealData', + name: 'Data', + alwaysShow: true, + meta: { + title: '数据管理', + icon: 'icon-data', // 图标 + permission: ['/environment/data'] + }, + children: [ + { + path: '/realData', + name: 'RealData', + component: () => import('@/views/data/allDeviceData'), + meta: { title: '实时数据', icon: '', permission: ['/environment/data/real'] } }, { - path: '/environmentCase', - name: 'EnvironmentCase', - component: () => import('@/views/dashboard/index'), - meta: { title: '环境案卷管理', icon: '' } + path: '/historyData', + name: 'HistoryData', + component: () => import('@/views/environment/environmentData'), + meta: { title: '历史数据', icon: '', permission: ['/environment/data/historyData'] } } ] }] diff --git a/src/router/modules/overview.js b/src/router/modules/overview.js index 404d017..5833611 100644 --- a/src/router/modules/overview.js +++ b/src/router/modules/overview.js @@ -6,17 +6,17 @@ component: Layout, redirect: '/overview', name: 'Overview', - alwaysShow: true, meta: { title: '地图总览', - icon: 'icon-config' // 图标 + icon: 'icon-config', // 图标 + permission:'/environment/overview' }, children: [ { path: '/overview', name: 'Overview', component: () => import('@/views/overview/overview'), - meta: { title: '点位预览', icon: '' } + meta: { title: '点位预览', icon: '', permission:'/environment/overview' } } ] }] diff --git a/src/store/modules/permission.js b/src/store/modules/permission.js index a0cb8cf..f07c0a0 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,10 @@ 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) commit('SET_BTNS', btns) commit('SET_ROUTERS', accessedRouters) resolve(response) 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/views/alarm/listAlarmNow.vue b/src/views/alarm/listAlarmNow.vue new file mode 100644 index 0000000..75133d1 --- /dev/null +++ b/src/views/alarm/listAlarmNow.vue @@ -0,0 +1,287 @@ + + + + + diff --git a/src/views/alarmRule/deviceAlarmRuleList.vue b/src/views/alarmRule/deviceAlarmRuleList.vue new file mode 100644 index 0000000..611d0bf --- /dev/null +++ b/src/views/alarmRule/deviceAlarmRuleList.vue @@ -0,0 +1,143 @@ + + + + + diff --git a/src/views/alarmRule/editAlarmRule.vue b/src/views/alarmRule/editAlarmRule.vue new file mode 100644 index 0000000..67c5774 --- /dev/null +++ b/src/views/alarmRule/editAlarmRule.vue @@ -0,0 +1,226 @@ + + + + + + diff --git a/src/views/alarmRule/simpleDeviceList.vue b/src/views/alarmRule/simpleDeviceList.vue new file mode 100644 index 0000000..4a92655 --- /dev/null +++ b/src/views/alarmRule/simpleDeviceList.vue @@ -0,0 +1,167 @@ + + + + + diff --git a/src/views/data/allDeviceData.vue b/src/views/data/allDeviceData.vue new file mode 100644 index 0000000..3a3cf7b --- /dev/null +++ b/src/views/data/allDeviceData.vue @@ -0,0 +1,159 @@ +