diff --git a/package.json b/package.json index f8c5e2a..9f3a3eb 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "echarts": "^4.2.1", "element-ui": "2.13.0", "event-source-polyfill": "^1.0.5", + "file-saver": "^2.0.5", "js-cookie": "2.2.0", "jsencrypt": "^3.0.0-rc.1", "leaflet": "^1.7.1", @@ -34,7 +35,8 @@ "vue-baidu-map": "^0.21.22", "vue-router": "3.0.1", "vue2-leaflet": "^2.7.0", - "vuex": "3.0.1" + "vuex": "3.0.1", + "xlsx": "^0.17.0" }, "devDependencies": { "autoprefixer": "8.5.0", diff --git a/package.json b/package.json index f8c5e2a..9f3a3eb 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "echarts": "^4.2.1", "element-ui": "2.13.0", "event-source-polyfill": "^1.0.5", + "file-saver": "^2.0.5", "js-cookie": "2.2.0", "jsencrypt": "^3.0.0-rc.1", "leaflet": "^1.7.1", @@ -34,7 +35,8 @@ "vue-baidu-map": "^0.21.22", "vue-router": "3.0.1", "vue2-leaflet": "^2.7.0", - "vuex": "3.0.1" + "vuex": "3.0.1", + "xlsx": "^0.17.0" }, "devDependencies": { "autoprefixer": "8.5.0", diff --git a/src/api/sanitation/statistics.js b/src/api/sanitation/statistics.js new file mode 100644 index 0000000..2ca7549 --- /dev/null +++ b/src/api/sanitation/statistics.js @@ -0,0 +1,13 @@ + +/** + * 考核统计接口 + */ +import request from '@/utils/request' +// 公厕保洁次数统计 +export function getToiletJobCount(params) { + return request({ + url: '/sanitation/statistic/toilet/jobCount', + method: 'get', + params + }) +} diff --git a/package.json b/package.json index f8c5e2a..9f3a3eb 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "echarts": "^4.2.1", "element-ui": "2.13.0", "event-source-polyfill": "^1.0.5", + "file-saver": "^2.0.5", "js-cookie": "2.2.0", "jsencrypt": "^3.0.0-rc.1", "leaflet": "^1.7.1", @@ -34,7 +35,8 @@ "vue-baidu-map": "^0.21.22", "vue-router": "3.0.1", "vue2-leaflet": "^2.7.0", - "vuex": "3.0.1" + "vuex": "3.0.1", + "xlsx": "^0.17.0" }, "devDependencies": { "autoprefixer": "8.5.0", diff --git a/src/api/sanitation/statistics.js b/src/api/sanitation/statistics.js new file mode 100644 index 0000000..2ca7549 --- /dev/null +++ b/src/api/sanitation/statistics.js @@ -0,0 +1,13 @@ + +/** + * 考核统计接口 + */ +import request from '@/utils/request' +// 公厕保洁次数统计 +export function getToiletJobCount(params) { + return request({ + url: '/sanitation/statistic/toilet/jobCount', + method: 'get', + params + }) +} diff --git a/src/api/sanitation/toilet.js b/src/api/sanitation/toilet.js new file mode 100644 index 0000000..10fd245 --- /dev/null +++ b/src/api/sanitation/toilet.js @@ -0,0 +1,97 @@ +/** + * 公厕管理接口 + */ +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 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 f8c5e2a..9f3a3eb 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "echarts": "^4.2.1", "element-ui": "2.13.0", "event-source-polyfill": "^1.0.5", + "file-saver": "^2.0.5", "js-cookie": "2.2.0", "jsencrypt": "^3.0.0-rc.1", "leaflet": "^1.7.1", @@ -34,7 +35,8 @@ "vue-baidu-map": "^0.21.22", "vue-router": "3.0.1", "vue2-leaflet": "^2.7.0", - "vuex": "3.0.1" + "vuex": "3.0.1", + "xlsx": "^0.17.0" }, "devDependencies": { "autoprefixer": "8.5.0", diff --git a/src/api/sanitation/statistics.js b/src/api/sanitation/statistics.js new file mode 100644 index 0000000..2ca7549 --- /dev/null +++ b/src/api/sanitation/statistics.js @@ -0,0 +1,13 @@ + +/** + * 考核统计接口 + */ +import request from '@/utils/request' +// 公厕保洁次数统计 +export function getToiletJobCount(params) { + return request({ + url: '/sanitation/statistic/toilet/jobCount', + method: 'get', + params + }) +} diff --git a/src/api/sanitation/toilet.js b/src/api/sanitation/toilet.js new file mode 100644 index 0000000..10fd245 --- /dev/null +++ b/src/api/sanitation/toilet.js @@ -0,0 +1,97 @@ +/** + * 公厕管理接口 + */ +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 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/toilet.js b/src/api/system/toilet.js deleted file mode 100644 index 8f38b8f..0000000 --- a/src/api/system/toilet.js +++ /dev/null @@ -1,91 +0,0 @@ -/** - * 公厕管理接口 - */ -import request from '@/utils/request' -import qs from 'qs' -export function getToiletList(params) { - return request({ - url: '/sanitation/toilet/listPage', - method: 'get', - params - }) -} - -export function getDetail(id) { - return request({ - url: '/sanitation/toiletClean/detail', - method: 'get', - params: { - id: id - } - }) -} - -// 公厕查询 -export function getToiletAll() { - return request({ - url: '/sanitation/toilet/listPage', - method: 'get' - }) -} - -// 添加公厕 -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 exportRecords(params) { - return request({ - url: 'device/batchExport', - method: 'get', - timeout: 120000, - params, - 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 f8c5e2a..9f3a3eb 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "echarts": "^4.2.1", "element-ui": "2.13.0", "event-source-polyfill": "^1.0.5", + "file-saver": "^2.0.5", "js-cookie": "2.2.0", "jsencrypt": "^3.0.0-rc.1", "leaflet": "^1.7.1", @@ -34,7 +35,8 @@ "vue-baidu-map": "^0.21.22", "vue-router": "3.0.1", "vue2-leaflet": "^2.7.0", - "vuex": "3.0.1" + "vuex": "3.0.1", + "xlsx": "^0.17.0" }, "devDependencies": { "autoprefixer": "8.5.0", diff --git a/src/api/sanitation/statistics.js b/src/api/sanitation/statistics.js new file mode 100644 index 0000000..2ca7549 --- /dev/null +++ b/src/api/sanitation/statistics.js @@ -0,0 +1,13 @@ + +/** + * 考核统计接口 + */ +import request from '@/utils/request' +// 公厕保洁次数统计 +export function getToiletJobCount(params) { + return request({ + url: '/sanitation/statistic/toilet/jobCount', + method: 'get', + params + }) +} diff --git a/src/api/sanitation/toilet.js b/src/api/sanitation/toilet.js new file mode 100644 index 0000000..10fd245 --- /dev/null +++ b/src/api/sanitation/toilet.js @@ -0,0 +1,97 @@ +/** + * 公厕管理接口 + */ +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 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/toilet.js b/src/api/system/toilet.js deleted file mode 100644 index 8f38b8f..0000000 --- a/src/api/system/toilet.js +++ /dev/null @@ -1,91 +0,0 @@ -/** - * 公厕管理接口 - */ -import request from '@/utils/request' -import qs from 'qs' -export function getToiletList(params) { - return request({ - url: '/sanitation/toilet/listPage', - method: 'get', - params - }) -} - -export function getDetail(id) { - return request({ - url: '/sanitation/toiletClean/detail', - method: 'get', - params: { - id: id - } - }) -} - -// 公厕查询 -export function getToiletAll() { - return request({ - url: '/sanitation/toilet/listPage', - method: 'get' - }) -} - -// 添加公厕 -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 exportRecords(params) { - return request({ - url: 'device/batchExport', - method: 'get', - timeout: 120000, - params, - 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/assets/global_images/toilet.png b/src/assets/global_images/toilet.png new file mode 100644 index 0000000..6d9fc05 --- /dev/null +++ b/src/assets/global_images/toilet.png Binary files differ diff --git a/package.json b/package.json index f8c5e2a..9f3a3eb 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "echarts": "^4.2.1", "element-ui": "2.13.0", "event-source-polyfill": "^1.0.5", + "file-saver": "^2.0.5", "js-cookie": "2.2.0", "jsencrypt": "^3.0.0-rc.1", "leaflet": "^1.7.1", @@ -34,7 +35,8 @@ "vue-baidu-map": "^0.21.22", "vue-router": "3.0.1", "vue2-leaflet": "^2.7.0", - "vuex": "3.0.1" + "vuex": "3.0.1", + "xlsx": "^0.17.0" }, "devDependencies": { "autoprefixer": "8.5.0", diff --git a/src/api/sanitation/statistics.js b/src/api/sanitation/statistics.js new file mode 100644 index 0000000..2ca7549 --- /dev/null +++ b/src/api/sanitation/statistics.js @@ -0,0 +1,13 @@ + +/** + * 考核统计接口 + */ +import request from '@/utils/request' +// 公厕保洁次数统计 +export function getToiletJobCount(params) { + return request({ + url: '/sanitation/statistic/toilet/jobCount', + method: 'get', + params + }) +} diff --git a/src/api/sanitation/toilet.js b/src/api/sanitation/toilet.js new file mode 100644 index 0000000..10fd245 --- /dev/null +++ b/src/api/sanitation/toilet.js @@ -0,0 +1,97 @@ +/** + * 公厕管理接口 + */ +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 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/toilet.js b/src/api/system/toilet.js deleted file mode 100644 index 8f38b8f..0000000 --- a/src/api/system/toilet.js +++ /dev/null @@ -1,91 +0,0 @@ -/** - * 公厕管理接口 - */ -import request from '@/utils/request' -import qs from 'qs' -export function getToiletList(params) { - return request({ - url: '/sanitation/toilet/listPage', - method: 'get', - params - }) -} - -export function getDetail(id) { - return request({ - url: '/sanitation/toiletClean/detail', - method: 'get', - params: { - id: id - } - }) -} - -// 公厕查询 -export function getToiletAll() { - return request({ - url: '/sanitation/toilet/listPage', - method: 'get' - }) -} - -// 添加公厕 -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 exportRecords(params) { - return request({ - url: 'device/batchExport', - method: 'get', - timeout: 120000, - params, - 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/assets/global_images/toilet.png b/src/assets/global_images/toilet.png new file mode 100644 index 0000000..6d9fc05 --- /dev/null +++ b/src/assets/global_images/toilet.png Binary files differ diff --git a/src/components/NormalTable/index.vue b/src/components/NormalTable/index.vue index 5077bef..04d322d 100644 --- a/src/components/NormalTable/index.vue +++ b/src/components/NormalTable/index.vue @@ -79,7 +79,7 @@ -
+
{ + return qs.stringify(params, { indices: false }) + } + }) +} + +// 批量导入 +export function 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/toilet.js b/src/api/system/toilet.js deleted file mode 100644 index 8f38b8f..0000000 --- a/src/api/system/toilet.js +++ /dev/null @@ -1,91 +0,0 @@ -/** - * 公厕管理接口 - */ -import request from '@/utils/request' -import qs from 'qs' -export function getToiletList(params) { - return request({ - url: '/sanitation/toilet/listPage', - method: 'get', - params - }) -} - -export function getDetail(id) { - return request({ - url: '/sanitation/toiletClean/detail', - method: 'get', - params: { - id: id - } - }) -} - -// 公厕查询 -export function getToiletAll() { - return request({ - url: '/sanitation/toilet/listPage', - method: 'get' - }) -} - -// 添加公厕 -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 exportRecords(params) { - return request({ - url: 'device/batchExport', - method: 'get', - timeout: 120000, - params, - 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/assets/global_images/toilet.png b/src/assets/global_images/toilet.png new file mode 100644 index 0000000..6d9fc05 --- /dev/null +++ b/src/assets/global_images/toilet.png Binary files differ diff --git a/src/components/NormalTable/index.vue b/src/components/NormalTable/index.vue index 5077bef..04d322d 100644 --- a/src/components/NormalTable/index.vue +++ b/src/components/NormalTable/index.vue @@ -79,7 +79,7 @@
-
+
{ + return qs.stringify(params, { indices: false }) + } + }) +} + +// 批量导入 +export function 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/toilet.js b/src/api/system/toilet.js deleted file mode 100644 index 8f38b8f..0000000 --- a/src/api/system/toilet.js +++ /dev/null @@ -1,91 +0,0 @@ -/** - * 公厕管理接口 - */ -import request from '@/utils/request' -import qs from 'qs' -export function getToiletList(params) { - return request({ - url: '/sanitation/toilet/listPage', - method: 'get', - params - }) -} - -export function getDetail(id) { - return request({ - url: '/sanitation/toiletClean/detail', - method: 'get', - params: { - id: id - } - }) -} - -// 公厕查询 -export function getToiletAll() { - return request({ - url: '/sanitation/toilet/listPage', - method: 'get' - }) -} - -// 添加公厕 -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 exportRecords(params) { - return request({ - url: 'device/batchExport', - method: 'get', - timeout: 120000, - params, - 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/assets/global_images/toilet.png b/src/assets/global_images/toilet.png new file mode 100644 index 0000000..6d9fc05 --- /dev/null +++ b/src/assets/global_images/toilet.png Binary files differ diff --git a/src/components/NormalTable/index.vue b/src/components/NormalTable/index.vue index 5077bef..04d322d 100644 --- a/src/components/NormalTable/index.vue +++ b/src/components/NormalTable/index.vue @@ -79,7 +79,7 @@
-
+
Object.assign(obj, { [key]: this[key] }), {}), + on: events.reduce((obj, key) => Object.assign(obj, { [key]: this.transmitEvent }), {}) + }) + } + this.props = [...extraProps, ...props.filter(prop => exceptProps.indexOf(prop))] + } +} + +export default prop => new Mixin(prop) diff --git a/package.json b/package.json index f8c5e2a..9f3a3eb 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "echarts": "^4.2.1", "element-ui": "2.13.0", "event-source-polyfill": "^1.0.5", + "file-saver": "^2.0.5", "js-cookie": "2.2.0", "jsencrypt": "^3.0.0-rc.1", "leaflet": "^1.7.1", @@ -34,7 +35,8 @@ "vue-baidu-map": "^0.21.22", "vue-router": "3.0.1", "vue2-leaflet": "^2.7.0", - "vuex": "3.0.1" + "vuex": "3.0.1", + "xlsx": "^0.17.0" }, "devDependencies": { "autoprefixer": "8.5.0", diff --git a/src/api/sanitation/statistics.js b/src/api/sanitation/statistics.js new file mode 100644 index 0000000..2ca7549 --- /dev/null +++ b/src/api/sanitation/statistics.js @@ -0,0 +1,13 @@ + +/** + * 考核统计接口 + */ +import request from '@/utils/request' +// 公厕保洁次数统计 +export function getToiletJobCount(params) { + return request({ + url: '/sanitation/statistic/toilet/jobCount', + method: 'get', + params + }) +} diff --git a/src/api/sanitation/toilet.js b/src/api/sanitation/toilet.js new file mode 100644 index 0000000..10fd245 --- /dev/null +++ b/src/api/sanitation/toilet.js @@ -0,0 +1,97 @@ +/** + * 公厕管理接口 + */ +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 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/toilet.js b/src/api/system/toilet.js deleted file mode 100644 index 8f38b8f..0000000 --- a/src/api/system/toilet.js +++ /dev/null @@ -1,91 +0,0 @@ -/** - * 公厕管理接口 - */ -import request from '@/utils/request' -import qs from 'qs' -export function getToiletList(params) { - return request({ - url: '/sanitation/toilet/listPage', - method: 'get', - params - }) -} - -export function getDetail(id) { - return request({ - url: '/sanitation/toiletClean/detail', - method: 'get', - params: { - id: id - } - }) -} - -// 公厕查询 -export function getToiletAll() { - return request({ - url: '/sanitation/toilet/listPage', - method: 'get' - }) -} - -// 添加公厕 -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 exportRecords(params) { - return request({ - url: 'device/batchExport', - method: 'get', - timeout: 120000, - params, - 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/assets/global_images/toilet.png b/src/assets/global_images/toilet.png new file mode 100644 index 0000000..6d9fc05 --- /dev/null +++ b/src/assets/global_images/toilet.png Binary files differ diff --git a/src/components/NormalTable/index.vue b/src/components/NormalTable/index.vue index 5077bef..04d322d 100644 --- a/src/components/NormalTable/index.vue +++ b/src/components/NormalTable/index.vue @@ -79,7 +79,7 @@
-
+
Object.assign(obj, { [key]: this[key] }), {}), + on: events.reduce((obj, key) => Object.assign(obj, { [key]: this.transmitEvent }), {}) + }) + } + this.props = [...extraProps, ...props.filter(prop => exceptProps.indexOf(prop))] + } +} + +export default prop => new Mixin(prop) diff --git a/src/components/mapWindow/base/mixins/common.js b/src/components/mapWindow/base/mixins/common.js new file mode 100644 index 0000000..2fd1a28 --- /dev/null +++ b/src/components/mapWindow/base/mixins/common.js @@ -0,0 +1,82 @@ +const types = { + map: { + unload: 'clearMap' + }, + control: { + unload: 'removeControl' + }, + layer: { + unload: 'removeLayer' + }, + features: { + unload: 'removeFeatures' + }, + listener: { + unload: 'removeListener' + } +} + +const getParent = $component => ($component.abstract || $component.$el === $component.$children[0].$el) ? getParent($component.$parent) : $component + +function destroyInstance () { + const { unload, renderByParent, $parent } = this + if (renderByParent) { + $parent.reload() + } + unload() +} + +class Mixin { + constructor (prop) { + this.methods = { + ready () { + const $parent = getParent(this.$parent) + const map = this.map = $parent.map + this.load() + this.$emit('ready', { + map + }) + }, + transmitEvent (e) { + this.$emit(e.type.replace(/^on/, ''), e) + }, + reload () { + this && this.$nextTick(() => { + this.unload() + this.$nextTick(this.load) + }) + }, + unload () { + const { map, originInstance } = this + try { + switch (prop.type) { + case 'search': + return originInstance.clearResults() + case 'autoComplete': + case 'lushu': + return originInstance.dispose() + case 'markerClusterer': + return originInstance.clearMarkers() + default: + map[types[prop.type].unload](originInstance) + } + } catch (e) {} + } + } + this.computed = { + renderByParent () { + return this.$parent.preventChildrenRender + } + } + this.mounted = function () { + console.log('common mounted') + const $parent = getParent(this.$parent) + const map = $parent.map + const { ready } = this + console.log(map) + map ? ready() : $parent.$on('onload', ready) + } + } +} + +export default type => new Mixin({ type }) diff --git a/package.json b/package.json index f8c5e2a..9f3a3eb 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "echarts": "^4.2.1", "element-ui": "2.13.0", "event-source-polyfill": "^1.0.5", + "file-saver": "^2.0.5", "js-cookie": "2.2.0", "jsencrypt": "^3.0.0-rc.1", "leaflet": "^1.7.1", @@ -34,7 +35,8 @@ "vue-baidu-map": "^0.21.22", "vue-router": "3.0.1", "vue2-leaflet": "^2.7.0", - "vuex": "3.0.1" + "vuex": "3.0.1", + "xlsx": "^0.17.0" }, "devDependencies": { "autoprefixer": "8.5.0", diff --git a/src/api/sanitation/statistics.js b/src/api/sanitation/statistics.js new file mode 100644 index 0000000..2ca7549 --- /dev/null +++ b/src/api/sanitation/statistics.js @@ -0,0 +1,13 @@ + +/** + * 考核统计接口 + */ +import request from '@/utils/request' +// 公厕保洁次数统计 +export function getToiletJobCount(params) { + return request({ + url: '/sanitation/statistic/toilet/jobCount', + method: 'get', + params + }) +} diff --git a/src/api/sanitation/toilet.js b/src/api/sanitation/toilet.js new file mode 100644 index 0000000..10fd245 --- /dev/null +++ b/src/api/sanitation/toilet.js @@ -0,0 +1,97 @@ +/** + * 公厕管理接口 + */ +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 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/toilet.js b/src/api/system/toilet.js deleted file mode 100644 index 8f38b8f..0000000 --- a/src/api/system/toilet.js +++ /dev/null @@ -1,91 +0,0 @@ -/** - * 公厕管理接口 - */ -import request from '@/utils/request' -import qs from 'qs' -export function getToiletList(params) { - return request({ - url: '/sanitation/toilet/listPage', - method: 'get', - params - }) -} - -export function getDetail(id) { - return request({ - url: '/sanitation/toiletClean/detail', - method: 'get', - params: { - id: id - } - }) -} - -// 公厕查询 -export function getToiletAll() { - return request({ - url: '/sanitation/toilet/listPage', - method: 'get' - }) -} - -// 添加公厕 -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 exportRecords(params) { - return request({ - url: 'device/batchExport', - method: 'get', - timeout: 120000, - params, - 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/assets/global_images/toilet.png b/src/assets/global_images/toilet.png new file mode 100644 index 0000000..6d9fc05 --- /dev/null +++ b/src/assets/global_images/toilet.png Binary files differ diff --git a/src/components/NormalTable/index.vue b/src/components/NormalTable/index.vue index 5077bef..04d322d 100644 --- a/src/components/NormalTable/index.vue +++ b/src/components/NormalTable/index.vue @@ -79,7 +79,7 @@
-
+
Object.assign(obj, { [key]: this[key] }), {}), + on: events.reduce((obj, key) => Object.assign(obj, { [key]: this.transmitEvent }), {}) + }) + } + this.props = [...extraProps, ...props.filter(prop => exceptProps.indexOf(prop))] + } +} + +export default prop => new Mixin(prop) diff --git a/src/components/mapWindow/base/mixins/common.js b/src/components/mapWindow/base/mixins/common.js new file mode 100644 index 0000000..2fd1a28 --- /dev/null +++ b/src/components/mapWindow/base/mixins/common.js @@ -0,0 +1,82 @@ +const types = { + map: { + unload: 'clearMap' + }, + control: { + unload: 'removeControl' + }, + layer: { + unload: 'removeLayer' + }, + features: { + unload: 'removeFeatures' + }, + listener: { + unload: 'removeListener' + } +} + +const getParent = $component => ($component.abstract || $component.$el === $component.$children[0].$el) ? getParent($component.$parent) : $component + +function destroyInstance () { + const { unload, renderByParent, $parent } = this + if (renderByParent) { + $parent.reload() + } + unload() +} + +class Mixin { + constructor (prop) { + this.methods = { + ready () { + const $parent = getParent(this.$parent) + const map = this.map = $parent.map + this.load() + this.$emit('ready', { + map + }) + }, + transmitEvent (e) { + this.$emit(e.type.replace(/^on/, ''), e) + }, + reload () { + this && this.$nextTick(() => { + this.unload() + this.$nextTick(this.load) + }) + }, + unload () { + const { map, originInstance } = this + try { + switch (prop.type) { + case 'search': + return originInstance.clearResults() + case 'autoComplete': + case 'lushu': + return originInstance.dispose() + case 'markerClusterer': + return originInstance.clearMarkers() + default: + map[types[prop.type].unload](originInstance) + } + } catch (e) {} + } + } + this.computed = { + renderByParent () { + return this.$parent.preventChildrenRender + } + } + this.mounted = function () { + console.log('common mounted') + const $parent = getParent(this.$parent) + const map = $parent.map + const { ready } = this + console.log(map) + map ? ready() : $parent.$on('onload', ready) + } + } +} + +export default type => new Mixin({ type }) diff --git a/src/components/mapWindow/leafletMap.vue b/src/components/mapWindow/leafletMap.vue new file mode 100644 index 0000000..931a5e9 --- /dev/null +++ b/src/components/mapWindow/leafletMap.vue @@ -0,0 +1,132 @@ + + + + + + + diff --git a/package.json b/package.json index f8c5e2a..9f3a3eb 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "echarts": "^4.2.1", "element-ui": "2.13.0", "event-source-polyfill": "^1.0.5", + "file-saver": "^2.0.5", "js-cookie": "2.2.0", "jsencrypt": "^3.0.0-rc.1", "leaflet": "^1.7.1", @@ -34,7 +35,8 @@ "vue-baidu-map": "^0.21.22", "vue-router": "3.0.1", "vue2-leaflet": "^2.7.0", - "vuex": "3.0.1" + "vuex": "3.0.1", + "xlsx": "^0.17.0" }, "devDependencies": { "autoprefixer": "8.5.0", diff --git a/src/api/sanitation/statistics.js b/src/api/sanitation/statistics.js new file mode 100644 index 0000000..2ca7549 --- /dev/null +++ b/src/api/sanitation/statistics.js @@ -0,0 +1,13 @@ + +/** + * 考核统计接口 + */ +import request from '@/utils/request' +// 公厕保洁次数统计 +export function getToiletJobCount(params) { + return request({ + url: '/sanitation/statistic/toilet/jobCount', + method: 'get', + params + }) +} diff --git a/src/api/sanitation/toilet.js b/src/api/sanitation/toilet.js new file mode 100644 index 0000000..10fd245 --- /dev/null +++ b/src/api/sanitation/toilet.js @@ -0,0 +1,97 @@ +/** + * 公厕管理接口 + */ +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 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/toilet.js b/src/api/system/toilet.js deleted file mode 100644 index 8f38b8f..0000000 --- a/src/api/system/toilet.js +++ /dev/null @@ -1,91 +0,0 @@ -/** - * 公厕管理接口 - */ -import request from '@/utils/request' -import qs from 'qs' -export function getToiletList(params) { - return request({ - url: '/sanitation/toilet/listPage', - method: 'get', - params - }) -} - -export function getDetail(id) { - return request({ - url: '/sanitation/toiletClean/detail', - method: 'get', - params: { - id: id - } - }) -} - -// 公厕查询 -export function getToiletAll() { - return request({ - url: '/sanitation/toilet/listPage', - method: 'get' - }) -} - -// 添加公厕 -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 exportRecords(params) { - return request({ - url: 'device/batchExport', - method: 'get', - timeout: 120000, - params, - 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/assets/global_images/toilet.png b/src/assets/global_images/toilet.png new file mode 100644 index 0000000..6d9fc05 --- /dev/null +++ b/src/assets/global_images/toilet.png Binary files differ diff --git a/src/components/NormalTable/index.vue b/src/components/NormalTable/index.vue index 5077bef..04d322d 100644 --- a/src/components/NormalTable/index.vue +++ b/src/components/NormalTable/index.vue @@ -79,7 +79,7 @@
-
+
Object.assign(obj, { [key]: this[key] }), {}), + on: events.reduce((obj, key) => Object.assign(obj, { [key]: this.transmitEvent }), {}) + }) + } + this.props = [...extraProps, ...props.filter(prop => exceptProps.indexOf(prop))] + } +} + +export default prop => new Mixin(prop) diff --git a/src/components/mapWindow/base/mixins/common.js b/src/components/mapWindow/base/mixins/common.js new file mode 100644 index 0000000..2fd1a28 --- /dev/null +++ b/src/components/mapWindow/base/mixins/common.js @@ -0,0 +1,82 @@ +const types = { + map: { + unload: 'clearMap' + }, + control: { + unload: 'removeControl' + }, + layer: { + unload: 'removeLayer' + }, + features: { + unload: 'removeFeatures' + }, + listener: { + unload: 'removeListener' + } +} + +const getParent = $component => ($component.abstract || $component.$el === $component.$children[0].$el) ? getParent($component.$parent) : $component + +function destroyInstance () { + const { unload, renderByParent, $parent } = this + if (renderByParent) { + $parent.reload() + } + unload() +} + +class Mixin { + constructor (prop) { + this.methods = { + ready () { + const $parent = getParent(this.$parent) + const map = this.map = $parent.map + this.load() + this.$emit('ready', { + map + }) + }, + transmitEvent (e) { + this.$emit(e.type.replace(/^on/, ''), e) + }, + reload () { + this && this.$nextTick(() => { + this.unload() + this.$nextTick(this.load) + }) + }, + unload () { + const { map, originInstance } = this + try { + switch (prop.type) { + case 'search': + return originInstance.clearResults() + case 'autoComplete': + case 'lushu': + return originInstance.dispose() + case 'markerClusterer': + return originInstance.clearMarkers() + default: + map[types[prop.type].unload](originInstance) + } + } catch (e) {} + } + } + this.computed = { + renderByParent () { + return this.$parent.preventChildrenRender + } + } + this.mounted = function () { + console.log('common mounted') + const $parent = getParent(this.$parent) + const map = $parent.map + const { ready } = this + console.log(map) + map ? ready() : $parent.$on('onload', ready) + } + } +} + +export default type => new Mixin({ type }) diff --git a/src/components/mapWindow/leafletMap.vue b/src/components/mapWindow/leafletMap.vue new file mode 100644 index 0000000..931a5e9 --- /dev/null +++ b/src/components/mapWindow/leafletMap.vue @@ -0,0 +1,132 @@ + + + + + + + diff --git a/src/components/mapWindow/mapWindow.vue b/src/components/mapWindow/mapWindow.vue new file mode 100644 index 0000000..9ced291 --- /dev/null +++ b/src/components/mapWindow/mapWindow.vue @@ -0,0 +1,46 @@ + + + + + + diff --git a/package.json b/package.json index f8c5e2a..9f3a3eb 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "echarts": "^4.2.1", "element-ui": "2.13.0", "event-source-polyfill": "^1.0.5", + "file-saver": "^2.0.5", "js-cookie": "2.2.0", "jsencrypt": "^3.0.0-rc.1", "leaflet": "^1.7.1", @@ -34,7 +35,8 @@ "vue-baidu-map": "^0.21.22", "vue-router": "3.0.1", "vue2-leaflet": "^2.7.0", - "vuex": "3.0.1" + "vuex": "3.0.1", + "xlsx": "^0.17.0" }, "devDependencies": { "autoprefixer": "8.5.0", diff --git a/src/api/sanitation/statistics.js b/src/api/sanitation/statistics.js new file mode 100644 index 0000000..2ca7549 --- /dev/null +++ b/src/api/sanitation/statistics.js @@ -0,0 +1,13 @@ + +/** + * 考核统计接口 + */ +import request from '@/utils/request' +// 公厕保洁次数统计 +export function getToiletJobCount(params) { + return request({ + url: '/sanitation/statistic/toilet/jobCount', + method: 'get', + params + }) +} diff --git a/src/api/sanitation/toilet.js b/src/api/sanitation/toilet.js new file mode 100644 index 0000000..10fd245 --- /dev/null +++ b/src/api/sanitation/toilet.js @@ -0,0 +1,97 @@ +/** + * 公厕管理接口 + */ +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 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/toilet.js b/src/api/system/toilet.js deleted file mode 100644 index 8f38b8f..0000000 --- a/src/api/system/toilet.js +++ /dev/null @@ -1,91 +0,0 @@ -/** - * 公厕管理接口 - */ -import request from '@/utils/request' -import qs from 'qs' -export function getToiletList(params) { - return request({ - url: '/sanitation/toilet/listPage', - method: 'get', - params - }) -} - -export function getDetail(id) { - return request({ - url: '/sanitation/toiletClean/detail', - method: 'get', - params: { - id: id - } - }) -} - -// 公厕查询 -export function getToiletAll() { - return request({ - url: '/sanitation/toilet/listPage', - method: 'get' - }) -} - -// 添加公厕 -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 exportRecords(params) { - return request({ - url: 'device/batchExport', - method: 'get', - timeout: 120000, - params, - 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/assets/global_images/toilet.png b/src/assets/global_images/toilet.png new file mode 100644 index 0000000..6d9fc05 --- /dev/null +++ b/src/assets/global_images/toilet.png Binary files differ diff --git a/src/components/NormalTable/index.vue b/src/components/NormalTable/index.vue index 5077bef..04d322d 100644 --- a/src/components/NormalTable/index.vue +++ b/src/components/NormalTable/index.vue @@ -79,7 +79,7 @@
-
+
Object.assign(obj, { [key]: this[key] }), {}), + on: events.reduce((obj, key) => Object.assign(obj, { [key]: this.transmitEvent }), {}) + }) + } + this.props = [...extraProps, ...props.filter(prop => exceptProps.indexOf(prop))] + } +} + +export default prop => new Mixin(prop) diff --git a/src/components/mapWindow/base/mixins/common.js b/src/components/mapWindow/base/mixins/common.js new file mode 100644 index 0000000..2fd1a28 --- /dev/null +++ b/src/components/mapWindow/base/mixins/common.js @@ -0,0 +1,82 @@ +const types = { + map: { + unload: 'clearMap' + }, + control: { + unload: 'removeControl' + }, + layer: { + unload: 'removeLayer' + }, + features: { + unload: 'removeFeatures' + }, + listener: { + unload: 'removeListener' + } +} + +const getParent = $component => ($component.abstract || $component.$el === $component.$children[0].$el) ? getParent($component.$parent) : $component + +function destroyInstance () { + const { unload, renderByParent, $parent } = this + if (renderByParent) { + $parent.reload() + } + unload() +} + +class Mixin { + constructor (prop) { + this.methods = { + ready () { + const $parent = getParent(this.$parent) + const map = this.map = $parent.map + this.load() + this.$emit('ready', { + map + }) + }, + transmitEvent (e) { + this.$emit(e.type.replace(/^on/, ''), e) + }, + reload () { + this && this.$nextTick(() => { + this.unload() + this.$nextTick(this.load) + }) + }, + unload () { + const { map, originInstance } = this + try { + switch (prop.type) { + case 'search': + return originInstance.clearResults() + case 'autoComplete': + case 'lushu': + return originInstance.dispose() + case 'markerClusterer': + return originInstance.clearMarkers() + default: + map[types[prop.type].unload](originInstance) + } + } catch (e) {} + } + } + this.computed = { + renderByParent () { + return this.$parent.preventChildrenRender + } + } + this.mounted = function () { + console.log('common mounted') + const $parent = getParent(this.$parent) + const map = $parent.map + const { ready } = this + console.log(map) + map ? ready() : $parent.$on('onload', ready) + } + } +} + +export default type => new Mixin({ type }) diff --git a/src/components/mapWindow/leafletMap.vue b/src/components/mapWindow/leafletMap.vue new file mode 100644 index 0000000..931a5e9 --- /dev/null +++ b/src/components/mapWindow/leafletMap.vue @@ -0,0 +1,132 @@ + + + + + + + diff --git a/src/components/mapWindow/mapWindow.vue b/src/components/mapWindow/mapWindow.vue new file mode 100644 index 0000000..9ced291 --- /dev/null +++ b/src/components/mapWindow/mapWindow.vue @@ -0,0 +1,46 @@ + + + + + + diff --git a/src/permission.js b/src/permission.js index dc6b2f8..809ca86 100644 --- a/src/permission.js +++ b/src/permission.js @@ -25,8 +25,8 @@ store.dispatch('GetInfo').then(res => { // 拉取用户信息 // 设置当前子系统为基础资源子系统 const currentSys = { - code: 'baseResourse', - name: '基础资源子系统' + code: 'toliet', + name: '公共厕所管理系统' } // 将当前系统信息保存在localStorage中 store.commit('SET_SYSTEM', currentSys) diff --git a/package.json b/package.json index f8c5e2a..9f3a3eb 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "echarts": "^4.2.1", "element-ui": "2.13.0", "event-source-polyfill": "^1.0.5", + "file-saver": "^2.0.5", "js-cookie": "2.2.0", "jsencrypt": "^3.0.0-rc.1", "leaflet": "^1.7.1", @@ -34,7 +35,8 @@ "vue-baidu-map": "^0.21.22", "vue-router": "3.0.1", "vue2-leaflet": "^2.7.0", - "vuex": "3.0.1" + "vuex": "3.0.1", + "xlsx": "^0.17.0" }, "devDependencies": { "autoprefixer": "8.5.0", diff --git a/src/api/sanitation/statistics.js b/src/api/sanitation/statistics.js new file mode 100644 index 0000000..2ca7549 --- /dev/null +++ b/src/api/sanitation/statistics.js @@ -0,0 +1,13 @@ + +/** + * 考核统计接口 + */ +import request from '@/utils/request' +// 公厕保洁次数统计 +export function getToiletJobCount(params) { + return request({ + url: '/sanitation/statistic/toilet/jobCount', + method: 'get', + params + }) +} diff --git a/src/api/sanitation/toilet.js b/src/api/sanitation/toilet.js new file mode 100644 index 0000000..10fd245 --- /dev/null +++ b/src/api/sanitation/toilet.js @@ -0,0 +1,97 @@ +/** + * 公厕管理接口 + */ +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 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/toilet.js b/src/api/system/toilet.js deleted file mode 100644 index 8f38b8f..0000000 --- a/src/api/system/toilet.js +++ /dev/null @@ -1,91 +0,0 @@ -/** - * 公厕管理接口 - */ -import request from '@/utils/request' -import qs from 'qs' -export function getToiletList(params) { - return request({ - url: '/sanitation/toilet/listPage', - method: 'get', - params - }) -} - -export function getDetail(id) { - return request({ - url: '/sanitation/toiletClean/detail', - method: 'get', - params: { - id: id - } - }) -} - -// 公厕查询 -export function getToiletAll() { - return request({ - url: '/sanitation/toilet/listPage', - method: 'get' - }) -} - -// 添加公厕 -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 exportRecords(params) { - return request({ - url: 'device/batchExport', - method: 'get', - timeout: 120000, - params, - 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/assets/global_images/toilet.png b/src/assets/global_images/toilet.png new file mode 100644 index 0000000..6d9fc05 --- /dev/null +++ b/src/assets/global_images/toilet.png Binary files differ diff --git a/src/components/NormalTable/index.vue b/src/components/NormalTable/index.vue index 5077bef..04d322d 100644 --- a/src/components/NormalTable/index.vue +++ b/src/components/NormalTable/index.vue @@ -79,7 +79,7 @@
-
+
Object.assign(obj, { [key]: this[key] }), {}), + on: events.reduce((obj, key) => Object.assign(obj, { [key]: this.transmitEvent }), {}) + }) + } + this.props = [...extraProps, ...props.filter(prop => exceptProps.indexOf(prop))] + } +} + +export default prop => new Mixin(prop) diff --git a/src/components/mapWindow/base/mixins/common.js b/src/components/mapWindow/base/mixins/common.js new file mode 100644 index 0000000..2fd1a28 --- /dev/null +++ b/src/components/mapWindow/base/mixins/common.js @@ -0,0 +1,82 @@ +const types = { + map: { + unload: 'clearMap' + }, + control: { + unload: 'removeControl' + }, + layer: { + unload: 'removeLayer' + }, + features: { + unload: 'removeFeatures' + }, + listener: { + unload: 'removeListener' + } +} + +const getParent = $component => ($component.abstract || $component.$el === $component.$children[0].$el) ? getParent($component.$parent) : $component + +function destroyInstance () { + const { unload, renderByParent, $parent } = this + if (renderByParent) { + $parent.reload() + } + unload() +} + +class Mixin { + constructor (prop) { + this.methods = { + ready () { + const $parent = getParent(this.$parent) + const map = this.map = $parent.map + this.load() + this.$emit('ready', { + map + }) + }, + transmitEvent (e) { + this.$emit(e.type.replace(/^on/, ''), e) + }, + reload () { + this && this.$nextTick(() => { + this.unload() + this.$nextTick(this.load) + }) + }, + unload () { + const { map, originInstance } = this + try { + switch (prop.type) { + case 'search': + return originInstance.clearResults() + case 'autoComplete': + case 'lushu': + return originInstance.dispose() + case 'markerClusterer': + return originInstance.clearMarkers() + default: + map[types[prop.type].unload](originInstance) + } + } catch (e) {} + } + } + this.computed = { + renderByParent () { + return this.$parent.preventChildrenRender + } + } + this.mounted = function () { + console.log('common mounted') + const $parent = getParent(this.$parent) + const map = $parent.map + const { ready } = this + console.log(map) + map ? ready() : $parent.$on('onload', ready) + } + } +} + +export default type => new Mixin({ type }) diff --git a/src/components/mapWindow/leafletMap.vue b/src/components/mapWindow/leafletMap.vue new file mode 100644 index 0000000..931a5e9 --- /dev/null +++ b/src/components/mapWindow/leafletMap.vue @@ -0,0 +1,132 @@ + + + + + + + diff --git a/src/components/mapWindow/mapWindow.vue b/src/components/mapWindow/mapWindow.vue new file mode 100644 index 0000000..9ced291 --- /dev/null +++ b/src/components/mapWindow/mapWindow.vue @@ -0,0 +1,46 @@ + + + + + + diff --git a/src/permission.js b/src/permission.js index dc6b2f8..809ca86 100644 --- a/src/permission.js +++ b/src/permission.js @@ -25,8 +25,8 @@ store.dispatch('GetInfo').then(res => { // 拉取用户信息 // 设置当前子系统为基础资源子系统 const currentSys = { - code: 'baseResourse', - name: '基础资源子系统' + code: 'toliet', + name: '公共厕所管理系统' } // 将当前系统信息保存在localStorage中 store.commit('SET_SYSTEM', currentSys) diff --git a/src/router/index.js b/src/router/index.js index 431844b..d23076d 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -43,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 错误页面 diff --git a/package.json b/package.json index f8c5e2a..9f3a3eb 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "echarts": "^4.2.1", "element-ui": "2.13.0", "event-source-polyfill": "^1.0.5", + "file-saver": "^2.0.5", "js-cookie": "2.2.0", "jsencrypt": "^3.0.0-rc.1", "leaflet": "^1.7.1", @@ -34,7 +35,8 @@ "vue-baidu-map": "^0.21.22", "vue-router": "3.0.1", "vue2-leaflet": "^2.7.0", - "vuex": "3.0.1" + "vuex": "3.0.1", + "xlsx": "^0.17.0" }, "devDependencies": { "autoprefixer": "8.5.0", diff --git a/src/api/sanitation/statistics.js b/src/api/sanitation/statistics.js new file mode 100644 index 0000000..2ca7549 --- /dev/null +++ b/src/api/sanitation/statistics.js @@ -0,0 +1,13 @@ + +/** + * 考核统计接口 + */ +import request from '@/utils/request' +// 公厕保洁次数统计 +export function getToiletJobCount(params) { + return request({ + url: '/sanitation/statistic/toilet/jobCount', + method: 'get', + params + }) +} diff --git a/src/api/sanitation/toilet.js b/src/api/sanitation/toilet.js new file mode 100644 index 0000000..10fd245 --- /dev/null +++ b/src/api/sanitation/toilet.js @@ -0,0 +1,97 @@ +/** + * 公厕管理接口 + */ +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 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/toilet.js b/src/api/system/toilet.js deleted file mode 100644 index 8f38b8f..0000000 --- a/src/api/system/toilet.js +++ /dev/null @@ -1,91 +0,0 @@ -/** - * 公厕管理接口 - */ -import request from '@/utils/request' -import qs from 'qs' -export function getToiletList(params) { - return request({ - url: '/sanitation/toilet/listPage', - method: 'get', - params - }) -} - -export function getDetail(id) { - return request({ - url: '/sanitation/toiletClean/detail', - method: 'get', - params: { - id: id - } - }) -} - -// 公厕查询 -export function getToiletAll() { - return request({ - url: '/sanitation/toilet/listPage', - method: 'get' - }) -} - -// 添加公厕 -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 exportRecords(params) { - return request({ - url: 'device/batchExport', - method: 'get', - timeout: 120000, - params, - 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/assets/global_images/toilet.png b/src/assets/global_images/toilet.png new file mode 100644 index 0000000..6d9fc05 --- /dev/null +++ b/src/assets/global_images/toilet.png Binary files differ diff --git a/src/components/NormalTable/index.vue b/src/components/NormalTable/index.vue index 5077bef..04d322d 100644 --- a/src/components/NormalTable/index.vue +++ b/src/components/NormalTable/index.vue @@ -79,7 +79,7 @@
-
+
Object.assign(obj, { [key]: this[key] }), {}), + on: events.reduce((obj, key) => Object.assign(obj, { [key]: this.transmitEvent }), {}) + }) + } + this.props = [...extraProps, ...props.filter(prop => exceptProps.indexOf(prop))] + } +} + +export default prop => new Mixin(prop) diff --git a/src/components/mapWindow/base/mixins/common.js b/src/components/mapWindow/base/mixins/common.js new file mode 100644 index 0000000..2fd1a28 --- /dev/null +++ b/src/components/mapWindow/base/mixins/common.js @@ -0,0 +1,82 @@ +const types = { + map: { + unload: 'clearMap' + }, + control: { + unload: 'removeControl' + }, + layer: { + unload: 'removeLayer' + }, + features: { + unload: 'removeFeatures' + }, + listener: { + unload: 'removeListener' + } +} + +const getParent = $component => ($component.abstract || $component.$el === $component.$children[0].$el) ? getParent($component.$parent) : $component + +function destroyInstance () { + const { unload, renderByParent, $parent } = this + if (renderByParent) { + $parent.reload() + } + unload() +} + +class Mixin { + constructor (prop) { + this.methods = { + ready () { + const $parent = getParent(this.$parent) + const map = this.map = $parent.map + this.load() + this.$emit('ready', { + map + }) + }, + transmitEvent (e) { + this.$emit(e.type.replace(/^on/, ''), e) + }, + reload () { + this && this.$nextTick(() => { + this.unload() + this.$nextTick(this.load) + }) + }, + unload () { + const { map, originInstance } = this + try { + switch (prop.type) { + case 'search': + return originInstance.clearResults() + case 'autoComplete': + case 'lushu': + return originInstance.dispose() + case 'markerClusterer': + return originInstance.clearMarkers() + default: + map[types[prop.type].unload](originInstance) + } + } catch (e) {} + } + } + this.computed = { + renderByParent () { + return this.$parent.preventChildrenRender + } + } + this.mounted = function () { + console.log('common mounted') + const $parent = getParent(this.$parent) + const map = $parent.map + const { ready } = this + console.log(map) + map ? ready() : $parent.$on('onload', ready) + } + } +} + +export default type => new Mixin({ type }) diff --git a/src/components/mapWindow/leafletMap.vue b/src/components/mapWindow/leafletMap.vue new file mode 100644 index 0000000..931a5e9 --- /dev/null +++ b/src/components/mapWindow/leafletMap.vue @@ -0,0 +1,132 @@ + + + + + + + diff --git a/src/components/mapWindow/mapWindow.vue b/src/components/mapWindow/mapWindow.vue new file mode 100644 index 0000000..9ced291 --- /dev/null +++ b/src/components/mapWindow/mapWindow.vue @@ -0,0 +1,46 @@ + + + + + + diff --git a/src/permission.js b/src/permission.js index dc6b2f8..809ca86 100644 --- a/src/permission.js +++ b/src/permission.js @@ -25,8 +25,8 @@ store.dispatch('GetInfo').then(res => { // 拉取用户信息 // 设置当前子系统为基础资源子系统 const currentSys = { - code: 'baseResourse', - name: '基础资源子系统' + code: 'toliet', + name: '公共厕所管理系统' } // 将当前系统信息保存在localStorage中 store.commit('SET_SYSTEM', currentSys) diff --git a/src/router/index.js b/src/router/index.js index 431844b..d23076d 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -43,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 错误页面 diff --git a/src/router/modules/statistics.js b/src/router/modules/statistics.js index 442aa6f..fb9cbea 100644 --- a/src/router/modules/statistics.js +++ b/src/router/modules/statistics.js @@ -5,7 +5,7 @@ { path: 'statisticsToilet', component: Layout, - redirect: '/statisticsToilet', + redirect: '/workStatistics', name: 'StatisticsToilet', meta: { title: '作业统计', @@ -14,10 +14,16 @@ }, children: [ { - path: '/statistics', - name: 'Statistics', - component: () => import('@/views/statistics/workStatistics'), - meta: { title: '作业统计', icon: 'function', permission: ['/statisticsToilet'] } + path: '/workStatistics', + name: 'WorkStatistics', + component: () => import('@/views/statistics/toiletAssessment'), + meta: { title: '作业统计', icon: '', permission: ['/toilet/workStatistics'] } + }, + { + path: '/evaluationStatistics', + name: 'EvaluationStatistics', + component: () => import('@/views/statistics/evaluationAssessment'), + meta: { title: '评价统计', icon: '', permission: ['/toilet/evaluationStatistics'] } } ] } diff --git a/package.json b/package.json index f8c5e2a..9f3a3eb 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "echarts": "^4.2.1", "element-ui": "2.13.0", "event-source-polyfill": "^1.0.5", + "file-saver": "^2.0.5", "js-cookie": "2.2.0", "jsencrypt": "^3.0.0-rc.1", "leaflet": "^1.7.1", @@ -34,7 +35,8 @@ "vue-baidu-map": "^0.21.22", "vue-router": "3.0.1", "vue2-leaflet": "^2.7.0", - "vuex": "3.0.1" + "vuex": "3.0.1", + "xlsx": "^0.17.0" }, "devDependencies": { "autoprefixer": "8.5.0", diff --git a/src/api/sanitation/statistics.js b/src/api/sanitation/statistics.js new file mode 100644 index 0000000..2ca7549 --- /dev/null +++ b/src/api/sanitation/statistics.js @@ -0,0 +1,13 @@ + +/** + * 考核统计接口 + */ +import request from '@/utils/request' +// 公厕保洁次数统计 +export function getToiletJobCount(params) { + return request({ + url: '/sanitation/statistic/toilet/jobCount', + method: 'get', + params + }) +} diff --git a/src/api/sanitation/toilet.js b/src/api/sanitation/toilet.js new file mode 100644 index 0000000..10fd245 --- /dev/null +++ b/src/api/sanitation/toilet.js @@ -0,0 +1,97 @@ +/** + * 公厕管理接口 + */ +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 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/toilet.js b/src/api/system/toilet.js deleted file mode 100644 index 8f38b8f..0000000 --- a/src/api/system/toilet.js +++ /dev/null @@ -1,91 +0,0 @@ -/** - * 公厕管理接口 - */ -import request from '@/utils/request' -import qs from 'qs' -export function getToiletList(params) { - return request({ - url: '/sanitation/toilet/listPage', - method: 'get', - params - }) -} - -export function getDetail(id) { - return request({ - url: '/sanitation/toiletClean/detail', - method: 'get', - params: { - id: id - } - }) -} - -// 公厕查询 -export function getToiletAll() { - return request({ - url: '/sanitation/toilet/listPage', - method: 'get' - }) -} - -// 添加公厕 -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 exportRecords(params) { - return request({ - url: 'device/batchExport', - method: 'get', - timeout: 120000, - params, - 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/assets/global_images/toilet.png b/src/assets/global_images/toilet.png new file mode 100644 index 0000000..6d9fc05 --- /dev/null +++ b/src/assets/global_images/toilet.png Binary files differ diff --git a/src/components/NormalTable/index.vue b/src/components/NormalTable/index.vue index 5077bef..04d322d 100644 --- a/src/components/NormalTable/index.vue +++ b/src/components/NormalTable/index.vue @@ -79,7 +79,7 @@
-
+
Object.assign(obj, { [key]: this[key] }), {}), + on: events.reduce((obj, key) => Object.assign(obj, { [key]: this.transmitEvent }), {}) + }) + } + this.props = [...extraProps, ...props.filter(prop => exceptProps.indexOf(prop))] + } +} + +export default prop => new Mixin(prop) diff --git a/src/components/mapWindow/base/mixins/common.js b/src/components/mapWindow/base/mixins/common.js new file mode 100644 index 0000000..2fd1a28 --- /dev/null +++ b/src/components/mapWindow/base/mixins/common.js @@ -0,0 +1,82 @@ +const types = { + map: { + unload: 'clearMap' + }, + control: { + unload: 'removeControl' + }, + layer: { + unload: 'removeLayer' + }, + features: { + unload: 'removeFeatures' + }, + listener: { + unload: 'removeListener' + } +} + +const getParent = $component => ($component.abstract || $component.$el === $component.$children[0].$el) ? getParent($component.$parent) : $component + +function destroyInstance () { + const { unload, renderByParent, $parent } = this + if (renderByParent) { + $parent.reload() + } + unload() +} + +class Mixin { + constructor (prop) { + this.methods = { + ready () { + const $parent = getParent(this.$parent) + const map = this.map = $parent.map + this.load() + this.$emit('ready', { + map + }) + }, + transmitEvent (e) { + this.$emit(e.type.replace(/^on/, ''), e) + }, + reload () { + this && this.$nextTick(() => { + this.unload() + this.$nextTick(this.load) + }) + }, + unload () { + const { map, originInstance } = this + try { + switch (prop.type) { + case 'search': + return originInstance.clearResults() + case 'autoComplete': + case 'lushu': + return originInstance.dispose() + case 'markerClusterer': + return originInstance.clearMarkers() + default: + map[types[prop.type].unload](originInstance) + } + } catch (e) {} + } + } + this.computed = { + renderByParent () { + return this.$parent.preventChildrenRender + } + } + this.mounted = function () { + console.log('common mounted') + const $parent = getParent(this.$parent) + const map = $parent.map + const { ready } = this + console.log(map) + map ? ready() : $parent.$on('onload', ready) + } + } +} + +export default type => new Mixin({ type }) diff --git a/src/components/mapWindow/leafletMap.vue b/src/components/mapWindow/leafletMap.vue new file mode 100644 index 0000000..931a5e9 --- /dev/null +++ b/src/components/mapWindow/leafletMap.vue @@ -0,0 +1,132 @@ + + + + + + + diff --git a/src/components/mapWindow/mapWindow.vue b/src/components/mapWindow/mapWindow.vue new file mode 100644 index 0000000..9ced291 --- /dev/null +++ b/src/components/mapWindow/mapWindow.vue @@ -0,0 +1,46 @@ + + + + + + diff --git a/src/permission.js b/src/permission.js index dc6b2f8..809ca86 100644 --- a/src/permission.js +++ b/src/permission.js @@ -25,8 +25,8 @@ store.dispatch('GetInfo').then(res => { // 拉取用户信息 // 设置当前子系统为基础资源子系统 const currentSys = { - code: 'baseResourse', - name: '基础资源子系统' + code: 'toliet', + name: '公共厕所管理系统' } // 将当前系统信息保存在localStorage中 store.commit('SET_SYSTEM', currentSys) diff --git a/src/router/index.js b/src/router/index.js index 431844b..d23076d 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -43,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 错误页面 diff --git a/src/router/modules/statistics.js b/src/router/modules/statistics.js index 442aa6f..fb9cbea 100644 --- a/src/router/modules/statistics.js +++ b/src/router/modules/statistics.js @@ -5,7 +5,7 @@ { path: 'statisticsToilet', component: Layout, - redirect: '/statisticsToilet', + redirect: '/workStatistics', name: 'StatisticsToilet', meta: { title: '作业统计', @@ -14,10 +14,16 @@ }, children: [ { - path: '/statistics', - name: 'Statistics', - component: () => import('@/views/statistics/workStatistics'), - meta: { title: '作业统计', icon: 'function', permission: ['/statisticsToilet'] } + path: '/workStatistics', + name: 'WorkStatistics', + component: () => import('@/views/statistics/toiletAssessment'), + meta: { title: '作业统计', icon: '', permission: ['/toilet/workStatistics'] } + }, + { + path: '/evaluationStatistics', + name: 'EvaluationStatistics', + component: () => import('@/views/statistics/evaluationAssessment'), + meta: { title: '评价统计', icon: '', permission: ['/toilet/evaluationStatistics'] } } ] } diff --git a/src/router/modules/toilet.js b/src/router/modules/toilet.js index e537ce9..b221a0e 100644 --- a/src/router/modules/toilet.js +++ b/src/router/modules/toilet.js @@ -16,7 +16,7 @@ { path: '/toiletList', name: 'ToiletList', - component: () => import('@/views/toilet/listToilet'), + component: () => import('@/views/toiletManage/toiletList'), meta: { title: '公厕台帐管理', icon: 'function', permission: ['/toiletList'] } }, { diff --git a/package.json b/package.json index f8c5e2a..9f3a3eb 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "echarts": "^4.2.1", "element-ui": "2.13.0", "event-source-polyfill": "^1.0.5", + "file-saver": "^2.0.5", "js-cookie": "2.2.0", "jsencrypt": "^3.0.0-rc.1", "leaflet": "^1.7.1", @@ -34,7 +35,8 @@ "vue-baidu-map": "^0.21.22", "vue-router": "3.0.1", "vue2-leaflet": "^2.7.0", - "vuex": "3.0.1" + "vuex": "3.0.1", + "xlsx": "^0.17.0" }, "devDependencies": { "autoprefixer": "8.5.0", diff --git a/src/api/sanitation/statistics.js b/src/api/sanitation/statistics.js new file mode 100644 index 0000000..2ca7549 --- /dev/null +++ b/src/api/sanitation/statistics.js @@ -0,0 +1,13 @@ + +/** + * 考核统计接口 + */ +import request from '@/utils/request' +// 公厕保洁次数统计 +export function getToiletJobCount(params) { + return request({ + url: '/sanitation/statistic/toilet/jobCount', + method: 'get', + params + }) +} diff --git a/src/api/sanitation/toilet.js b/src/api/sanitation/toilet.js new file mode 100644 index 0000000..10fd245 --- /dev/null +++ b/src/api/sanitation/toilet.js @@ -0,0 +1,97 @@ +/** + * 公厕管理接口 + */ +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 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/toilet.js b/src/api/system/toilet.js deleted file mode 100644 index 8f38b8f..0000000 --- a/src/api/system/toilet.js +++ /dev/null @@ -1,91 +0,0 @@ -/** - * 公厕管理接口 - */ -import request from '@/utils/request' -import qs from 'qs' -export function getToiletList(params) { - return request({ - url: '/sanitation/toilet/listPage', - method: 'get', - params - }) -} - -export function getDetail(id) { - return request({ - url: '/sanitation/toiletClean/detail', - method: 'get', - params: { - id: id - } - }) -} - -// 公厕查询 -export function getToiletAll() { - return request({ - url: '/sanitation/toilet/listPage', - method: 'get' - }) -} - -// 添加公厕 -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 exportRecords(params) { - return request({ - url: 'device/batchExport', - method: 'get', - timeout: 120000, - params, - 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/assets/global_images/toilet.png b/src/assets/global_images/toilet.png new file mode 100644 index 0000000..6d9fc05 --- /dev/null +++ b/src/assets/global_images/toilet.png Binary files differ diff --git a/src/components/NormalTable/index.vue b/src/components/NormalTable/index.vue index 5077bef..04d322d 100644 --- a/src/components/NormalTable/index.vue +++ b/src/components/NormalTable/index.vue @@ -79,7 +79,7 @@
-
+
Object.assign(obj, { [key]: this[key] }), {}), + on: events.reduce((obj, key) => Object.assign(obj, { [key]: this.transmitEvent }), {}) + }) + } + this.props = [...extraProps, ...props.filter(prop => exceptProps.indexOf(prop))] + } +} + +export default prop => new Mixin(prop) diff --git a/src/components/mapWindow/base/mixins/common.js b/src/components/mapWindow/base/mixins/common.js new file mode 100644 index 0000000..2fd1a28 --- /dev/null +++ b/src/components/mapWindow/base/mixins/common.js @@ -0,0 +1,82 @@ +const types = { + map: { + unload: 'clearMap' + }, + control: { + unload: 'removeControl' + }, + layer: { + unload: 'removeLayer' + }, + features: { + unload: 'removeFeatures' + }, + listener: { + unload: 'removeListener' + } +} + +const getParent = $component => ($component.abstract || $component.$el === $component.$children[0].$el) ? getParent($component.$parent) : $component + +function destroyInstance () { + const { unload, renderByParent, $parent } = this + if (renderByParent) { + $parent.reload() + } + unload() +} + +class Mixin { + constructor (prop) { + this.methods = { + ready () { + const $parent = getParent(this.$parent) + const map = this.map = $parent.map + this.load() + this.$emit('ready', { + map + }) + }, + transmitEvent (e) { + this.$emit(e.type.replace(/^on/, ''), e) + }, + reload () { + this && this.$nextTick(() => { + this.unload() + this.$nextTick(this.load) + }) + }, + unload () { + const { map, originInstance } = this + try { + switch (prop.type) { + case 'search': + return originInstance.clearResults() + case 'autoComplete': + case 'lushu': + return originInstance.dispose() + case 'markerClusterer': + return originInstance.clearMarkers() + default: + map[types[prop.type].unload](originInstance) + } + } catch (e) {} + } + } + this.computed = { + renderByParent () { + return this.$parent.preventChildrenRender + } + } + this.mounted = function () { + console.log('common mounted') + const $parent = getParent(this.$parent) + const map = $parent.map + const { ready } = this + console.log(map) + map ? ready() : $parent.$on('onload', ready) + } + } +} + +export default type => new Mixin({ type }) diff --git a/src/components/mapWindow/leafletMap.vue b/src/components/mapWindow/leafletMap.vue new file mode 100644 index 0000000..931a5e9 --- /dev/null +++ b/src/components/mapWindow/leafletMap.vue @@ -0,0 +1,132 @@ + + + + + + + diff --git a/src/components/mapWindow/mapWindow.vue b/src/components/mapWindow/mapWindow.vue new file mode 100644 index 0000000..9ced291 --- /dev/null +++ b/src/components/mapWindow/mapWindow.vue @@ -0,0 +1,46 @@ + + + + + + diff --git a/src/permission.js b/src/permission.js index dc6b2f8..809ca86 100644 --- a/src/permission.js +++ b/src/permission.js @@ -25,8 +25,8 @@ store.dispatch('GetInfo').then(res => { // 拉取用户信息 // 设置当前子系统为基础资源子系统 const currentSys = { - code: 'baseResourse', - name: '基础资源子系统' + code: 'toliet', + name: '公共厕所管理系统' } // 将当前系统信息保存在localStorage中 store.commit('SET_SYSTEM', currentSys) diff --git a/src/router/index.js b/src/router/index.js index 431844b..d23076d 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -43,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 错误页面 diff --git a/src/router/modules/statistics.js b/src/router/modules/statistics.js index 442aa6f..fb9cbea 100644 --- a/src/router/modules/statistics.js +++ b/src/router/modules/statistics.js @@ -5,7 +5,7 @@ { path: 'statisticsToilet', component: Layout, - redirect: '/statisticsToilet', + redirect: '/workStatistics', name: 'StatisticsToilet', meta: { title: '作业统计', @@ -14,10 +14,16 @@ }, children: [ { - path: '/statistics', - name: 'Statistics', - component: () => import('@/views/statistics/workStatistics'), - meta: { title: '作业统计', icon: 'function', permission: ['/statisticsToilet'] } + path: '/workStatistics', + name: 'WorkStatistics', + component: () => import('@/views/statistics/toiletAssessment'), + meta: { title: '作业统计', icon: '', permission: ['/toilet/workStatistics'] } + }, + { + path: '/evaluationStatistics', + name: 'EvaluationStatistics', + component: () => import('@/views/statistics/evaluationAssessment'), + meta: { title: '评价统计', icon: '', permission: ['/toilet/evaluationStatistics'] } } ] } diff --git a/src/router/modules/toilet.js b/src/router/modules/toilet.js index e537ce9..b221a0e 100644 --- a/src/router/modules/toilet.js +++ b/src/router/modules/toilet.js @@ -16,7 +16,7 @@ { path: '/toiletList', name: 'ToiletList', - component: () => import('@/views/toilet/listToilet'), + component: () => import('@/views/toiletManage/toiletList'), meta: { title: '公厕台帐管理', icon: 'function', permission: ['/toiletList'] } }, { diff --git a/src/router/modules/work.js b/src/router/modules/work.js index 3725050..5e0759f 100644 --- a/src/router/modules/work.js +++ b/src/router/modules/work.js @@ -16,7 +16,7 @@ { path: '/toiletWork', name: 'ToiletWork', - component: () => import('@/views/toilet/listWork'), + component: () => import('@/views/toiletClean/toiletCleanList'), meta: { title: '作业管理', icon: 'function', permission: ['/toiletWork'] } } ] diff --git a/package.json b/package.json index f8c5e2a..9f3a3eb 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "echarts": "^4.2.1", "element-ui": "2.13.0", "event-source-polyfill": "^1.0.5", + "file-saver": "^2.0.5", "js-cookie": "2.2.0", "jsencrypt": "^3.0.0-rc.1", "leaflet": "^1.7.1", @@ -34,7 +35,8 @@ "vue-baidu-map": "^0.21.22", "vue-router": "3.0.1", "vue2-leaflet": "^2.7.0", - "vuex": "3.0.1" + "vuex": "3.0.1", + "xlsx": "^0.17.0" }, "devDependencies": { "autoprefixer": "8.5.0", diff --git a/src/api/sanitation/statistics.js b/src/api/sanitation/statistics.js new file mode 100644 index 0000000..2ca7549 --- /dev/null +++ b/src/api/sanitation/statistics.js @@ -0,0 +1,13 @@ + +/** + * 考核统计接口 + */ +import request from '@/utils/request' +// 公厕保洁次数统计 +export function getToiletJobCount(params) { + return request({ + url: '/sanitation/statistic/toilet/jobCount', + method: 'get', + params + }) +} diff --git a/src/api/sanitation/toilet.js b/src/api/sanitation/toilet.js new file mode 100644 index 0000000..10fd245 --- /dev/null +++ b/src/api/sanitation/toilet.js @@ -0,0 +1,97 @@ +/** + * 公厕管理接口 + */ +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 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/toilet.js b/src/api/system/toilet.js deleted file mode 100644 index 8f38b8f..0000000 --- a/src/api/system/toilet.js +++ /dev/null @@ -1,91 +0,0 @@ -/** - * 公厕管理接口 - */ -import request from '@/utils/request' -import qs from 'qs' -export function getToiletList(params) { - return request({ - url: '/sanitation/toilet/listPage', - method: 'get', - params - }) -} - -export function getDetail(id) { - return request({ - url: '/sanitation/toiletClean/detail', - method: 'get', - params: { - id: id - } - }) -} - -// 公厕查询 -export function getToiletAll() { - return request({ - url: '/sanitation/toilet/listPage', - method: 'get' - }) -} - -// 添加公厕 -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 exportRecords(params) { - return request({ - url: 'device/batchExport', - method: 'get', - timeout: 120000, - params, - 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/assets/global_images/toilet.png b/src/assets/global_images/toilet.png new file mode 100644 index 0000000..6d9fc05 --- /dev/null +++ b/src/assets/global_images/toilet.png Binary files differ diff --git a/src/components/NormalTable/index.vue b/src/components/NormalTable/index.vue index 5077bef..04d322d 100644 --- a/src/components/NormalTable/index.vue +++ b/src/components/NormalTable/index.vue @@ -79,7 +79,7 @@
-
+
Object.assign(obj, { [key]: this[key] }), {}), + on: events.reduce((obj, key) => Object.assign(obj, { [key]: this.transmitEvent }), {}) + }) + } + this.props = [...extraProps, ...props.filter(prop => exceptProps.indexOf(prop))] + } +} + +export default prop => new Mixin(prop) diff --git a/src/components/mapWindow/base/mixins/common.js b/src/components/mapWindow/base/mixins/common.js new file mode 100644 index 0000000..2fd1a28 --- /dev/null +++ b/src/components/mapWindow/base/mixins/common.js @@ -0,0 +1,82 @@ +const types = { + map: { + unload: 'clearMap' + }, + control: { + unload: 'removeControl' + }, + layer: { + unload: 'removeLayer' + }, + features: { + unload: 'removeFeatures' + }, + listener: { + unload: 'removeListener' + } +} + +const getParent = $component => ($component.abstract || $component.$el === $component.$children[0].$el) ? getParent($component.$parent) : $component + +function destroyInstance () { + const { unload, renderByParent, $parent } = this + if (renderByParent) { + $parent.reload() + } + unload() +} + +class Mixin { + constructor (prop) { + this.methods = { + ready () { + const $parent = getParent(this.$parent) + const map = this.map = $parent.map + this.load() + this.$emit('ready', { + map + }) + }, + transmitEvent (e) { + this.$emit(e.type.replace(/^on/, ''), e) + }, + reload () { + this && this.$nextTick(() => { + this.unload() + this.$nextTick(this.load) + }) + }, + unload () { + const { map, originInstance } = this + try { + switch (prop.type) { + case 'search': + return originInstance.clearResults() + case 'autoComplete': + case 'lushu': + return originInstance.dispose() + case 'markerClusterer': + return originInstance.clearMarkers() + default: + map[types[prop.type].unload](originInstance) + } + } catch (e) {} + } + } + this.computed = { + renderByParent () { + return this.$parent.preventChildrenRender + } + } + this.mounted = function () { + console.log('common mounted') + const $parent = getParent(this.$parent) + const map = $parent.map + const { ready } = this + console.log(map) + map ? ready() : $parent.$on('onload', ready) + } + } +} + +export default type => new Mixin({ type }) diff --git a/src/components/mapWindow/leafletMap.vue b/src/components/mapWindow/leafletMap.vue new file mode 100644 index 0000000..931a5e9 --- /dev/null +++ b/src/components/mapWindow/leafletMap.vue @@ -0,0 +1,132 @@ + + + + + + + diff --git a/src/components/mapWindow/mapWindow.vue b/src/components/mapWindow/mapWindow.vue new file mode 100644 index 0000000..9ced291 --- /dev/null +++ b/src/components/mapWindow/mapWindow.vue @@ -0,0 +1,46 @@ + + + + + + diff --git a/src/permission.js b/src/permission.js index dc6b2f8..809ca86 100644 --- a/src/permission.js +++ b/src/permission.js @@ -25,8 +25,8 @@ store.dispatch('GetInfo').then(res => { // 拉取用户信息 // 设置当前子系统为基础资源子系统 const currentSys = { - code: 'baseResourse', - name: '基础资源子系统' + code: 'toliet', + name: '公共厕所管理系统' } // 将当前系统信息保存在localStorage中 store.commit('SET_SYSTEM', currentSys) diff --git a/src/router/index.js b/src/router/index.js index 431844b..d23076d 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -43,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 错误页面 diff --git a/src/router/modules/statistics.js b/src/router/modules/statistics.js index 442aa6f..fb9cbea 100644 --- a/src/router/modules/statistics.js +++ b/src/router/modules/statistics.js @@ -5,7 +5,7 @@ { path: 'statisticsToilet', component: Layout, - redirect: '/statisticsToilet', + redirect: '/workStatistics', name: 'StatisticsToilet', meta: { title: '作业统计', @@ -14,10 +14,16 @@ }, children: [ { - path: '/statistics', - name: 'Statistics', - component: () => import('@/views/statistics/workStatistics'), - meta: { title: '作业统计', icon: 'function', permission: ['/statisticsToilet'] } + path: '/workStatistics', + name: 'WorkStatistics', + component: () => import('@/views/statistics/toiletAssessment'), + meta: { title: '作业统计', icon: '', permission: ['/toilet/workStatistics'] } + }, + { + path: '/evaluationStatistics', + name: 'EvaluationStatistics', + component: () => import('@/views/statistics/evaluationAssessment'), + meta: { title: '评价统计', icon: '', permission: ['/toilet/evaluationStatistics'] } } ] } diff --git a/src/router/modules/toilet.js b/src/router/modules/toilet.js index e537ce9..b221a0e 100644 --- a/src/router/modules/toilet.js +++ b/src/router/modules/toilet.js @@ -16,7 +16,7 @@ { path: '/toiletList', name: 'ToiletList', - component: () => import('@/views/toilet/listToilet'), + component: () => import('@/views/toiletManage/toiletList'), meta: { title: '公厕台帐管理', icon: 'function', permission: ['/toiletList'] } }, { diff --git a/src/router/modules/work.js b/src/router/modules/work.js index 3725050..5e0759f 100644 --- a/src/router/modules/work.js +++ b/src/router/modules/work.js @@ -16,7 +16,7 @@ { path: '/toiletWork', name: 'ToiletWork', - component: () => import('@/views/toilet/listWork'), + component: () => import('@/views/toiletClean/toiletCleanList'), meta: { title: '作业管理', icon: 'function', permission: ['/toiletWork'] } } ] diff --git a/src/settings.js b/src/settings.js index b568ce0..b8159bf 100644 --- a/src/settings.js +++ b/src/settings.js @@ -3,7 +3,7 @@ * @type {boolean} true | false * @description 是否显示设置按钮 */ - showSettings: true, + showSettings: false, /** * @type {boolean} true | false diff --git a/package.json b/package.json index f8c5e2a..9f3a3eb 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "echarts": "^4.2.1", "element-ui": "2.13.0", "event-source-polyfill": "^1.0.5", + "file-saver": "^2.0.5", "js-cookie": "2.2.0", "jsencrypt": "^3.0.0-rc.1", "leaflet": "^1.7.1", @@ -34,7 +35,8 @@ "vue-baidu-map": "^0.21.22", "vue-router": "3.0.1", "vue2-leaflet": "^2.7.0", - "vuex": "3.0.1" + "vuex": "3.0.1", + "xlsx": "^0.17.0" }, "devDependencies": { "autoprefixer": "8.5.0", diff --git a/src/api/sanitation/statistics.js b/src/api/sanitation/statistics.js new file mode 100644 index 0000000..2ca7549 --- /dev/null +++ b/src/api/sanitation/statistics.js @@ -0,0 +1,13 @@ + +/** + * 考核统计接口 + */ +import request from '@/utils/request' +// 公厕保洁次数统计 +export function getToiletJobCount(params) { + return request({ + url: '/sanitation/statistic/toilet/jobCount', + method: 'get', + params + }) +} diff --git a/src/api/sanitation/toilet.js b/src/api/sanitation/toilet.js new file mode 100644 index 0000000..10fd245 --- /dev/null +++ b/src/api/sanitation/toilet.js @@ -0,0 +1,97 @@ +/** + * 公厕管理接口 + */ +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 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/toilet.js b/src/api/system/toilet.js deleted file mode 100644 index 8f38b8f..0000000 --- a/src/api/system/toilet.js +++ /dev/null @@ -1,91 +0,0 @@ -/** - * 公厕管理接口 - */ -import request from '@/utils/request' -import qs from 'qs' -export function getToiletList(params) { - return request({ - url: '/sanitation/toilet/listPage', - method: 'get', - params - }) -} - -export function getDetail(id) { - return request({ - url: '/sanitation/toiletClean/detail', - method: 'get', - params: { - id: id - } - }) -} - -// 公厕查询 -export function getToiletAll() { - return request({ - url: '/sanitation/toilet/listPage', - method: 'get' - }) -} - -// 添加公厕 -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 exportRecords(params) { - return request({ - url: 'device/batchExport', - method: 'get', - timeout: 120000, - params, - 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/assets/global_images/toilet.png b/src/assets/global_images/toilet.png new file mode 100644 index 0000000..6d9fc05 --- /dev/null +++ b/src/assets/global_images/toilet.png Binary files differ diff --git a/src/components/NormalTable/index.vue b/src/components/NormalTable/index.vue index 5077bef..04d322d 100644 --- a/src/components/NormalTable/index.vue +++ b/src/components/NormalTable/index.vue @@ -79,7 +79,7 @@
-
+
Object.assign(obj, { [key]: this[key] }), {}), + on: events.reduce((obj, key) => Object.assign(obj, { [key]: this.transmitEvent }), {}) + }) + } + this.props = [...extraProps, ...props.filter(prop => exceptProps.indexOf(prop))] + } +} + +export default prop => new Mixin(prop) diff --git a/src/components/mapWindow/base/mixins/common.js b/src/components/mapWindow/base/mixins/common.js new file mode 100644 index 0000000..2fd1a28 --- /dev/null +++ b/src/components/mapWindow/base/mixins/common.js @@ -0,0 +1,82 @@ +const types = { + map: { + unload: 'clearMap' + }, + control: { + unload: 'removeControl' + }, + layer: { + unload: 'removeLayer' + }, + features: { + unload: 'removeFeatures' + }, + listener: { + unload: 'removeListener' + } +} + +const getParent = $component => ($component.abstract || $component.$el === $component.$children[0].$el) ? getParent($component.$parent) : $component + +function destroyInstance () { + const { unload, renderByParent, $parent } = this + if (renderByParent) { + $parent.reload() + } + unload() +} + +class Mixin { + constructor (prop) { + this.methods = { + ready () { + const $parent = getParent(this.$parent) + const map = this.map = $parent.map + this.load() + this.$emit('ready', { + map + }) + }, + transmitEvent (e) { + this.$emit(e.type.replace(/^on/, ''), e) + }, + reload () { + this && this.$nextTick(() => { + this.unload() + this.$nextTick(this.load) + }) + }, + unload () { + const { map, originInstance } = this + try { + switch (prop.type) { + case 'search': + return originInstance.clearResults() + case 'autoComplete': + case 'lushu': + return originInstance.dispose() + case 'markerClusterer': + return originInstance.clearMarkers() + default: + map[types[prop.type].unload](originInstance) + } + } catch (e) {} + } + } + this.computed = { + renderByParent () { + return this.$parent.preventChildrenRender + } + } + this.mounted = function () { + console.log('common mounted') + const $parent = getParent(this.$parent) + const map = $parent.map + const { ready } = this + console.log(map) + map ? ready() : $parent.$on('onload', ready) + } + } +} + +export default type => new Mixin({ type }) diff --git a/src/components/mapWindow/leafletMap.vue b/src/components/mapWindow/leafletMap.vue new file mode 100644 index 0000000..931a5e9 --- /dev/null +++ b/src/components/mapWindow/leafletMap.vue @@ -0,0 +1,132 @@ + + + + + + + diff --git a/src/components/mapWindow/mapWindow.vue b/src/components/mapWindow/mapWindow.vue new file mode 100644 index 0000000..9ced291 --- /dev/null +++ b/src/components/mapWindow/mapWindow.vue @@ -0,0 +1,46 @@ + + + + + + diff --git a/src/permission.js b/src/permission.js index dc6b2f8..809ca86 100644 --- a/src/permission.js +++ b/src/permission.js @@ -25,8 +25,8 @@ store.dispatch('GetInfo').then(res => { // 拉取用户信息 // 设置当前子系统为基础资源子系统 const currentSys = { - code: 'baseResourse', - name: '基础资源子系统' + code: 'toliet', + name: '公共厕所管理系统' } // 将当前系统信息保存在localStorage中 store.commit('SET_SYSTEM', currentSys) diff --git a/src/router/index.js b/src/router/index.js index 431844b..d23076d 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -43,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 错误页面 diff --git a/src/router/modules/statistics.js b/src/router/modules/statistics.js index 442aa6f..fb9cbea 100644 --- a/src/router/modules/statistics.js +++ b/src/router/modules/statistics.js @@ -5,7 +5,7 @@ { path: 'statisticsToilet', component: Layout, - redirect: '/statisticsToilet', + redirect: '/workStatistics', name: 'StatisticsToilet', meta: { title: '作业统计', @@ -14,10 +14,16 @@ }, children: [ { - path: '/statistics', - name: 'Statistics', - component: () => import('@/views/statistics/workStatistics'), - meta: { title: '作业统计', icon: 'function', permission: ['/statisticsToilet'] } + path: '/workStatistics', + name: 'WorkStatistics', + component: () => import('@/views/statistics/toiletAssessment'), + meta: { title: '作业统计', icon: '', permission: ['/toilet/workStatistics'] } + }, + { + path: '/evaluationStatistics', + name: 'EvaluationStatistics', + component: () => import('@/views/statistics/evaluationAssessment'), + meta: { title: '评价统计', icon: '', permission: ['/toilet/evaluationStatistics'] } } ] } diff --git a/src/router/modules/toilet.js b/src/router/modules/toilet.js index e537ce9..b221a0e 100644 --- a/src/router/modules/toilet.js +++ b/src/router/modules/toilet.js @@ -16,7 +16,7 @@ { path: '/toiletList', name: 'ToiletList', - component: () => import('@/views/toilet/listToilet'), + component: () => import('@/views/toiletManage/toiletList'), meta: { title: '公厕台帐管理', icon: 'function', permission: ['/toiletList'] } }, { diff --git a/src/router/modules/work.js b/src/router/modules/work.js index 3725050..5e0759f 100644 --- a/src/router/modules/work.js +++ b/src/router/modules/work.js @@ -16,7 +16,7 @@ { path: '/toiletWork', name: 'ToiletWork', - component: () => import('@/views/toilet/listWork'), + component: () => import('@/views/toiletClean/toiletCleanList'), meta: { title: '作业管理', icon: 'function', permission: ['/toiletWork'] } } ] diff --git a/src/settings.js b/src/settings.js index b568ce0..b8159bf 100644 --- a/src/settings.js +++ b/src/settings.js @@ -3,7 +3,7 @@ * @type {boolean} true | false * @description 是否显示设置按钮 */ - showSettings: true, + showSettings: false, /** * @type {boolean} true | false diff --git a/src/store/modules/permission.js b/src/store/modules/permission.js index a0cb8cf..3ab50d5 100644 --- a/src/store/modules/permission.js +++ b/src/store/modules/permission.js @@ -120,17 +120,23 @@ }) }, // 获取用户权限 - GetMenus({ commit, state }) { - console.log('in store.permission.js:GetMenus:') + GetMenus({ commit, state }, currentSystem) { + // console.log('in store.permission.js:GetMenus:') + console.log('获取' + currentSystem.name + '的菜单') + const params = { + parentCode: currentSystem.code // 传入该子系统的code,获取子系统的权限 + } return new Promise((resolve, reject) => { - getMenus(state.token).then(response => { // 处理返回值 + // 此处获取用户所有权限 + getMenus(params).then(response => { // 处理返回值 const data = response.data const menus = [] // 仅菜单 const btns = [] // 非菜单 if (data.menus && data.menus.length > 0) { - commit('SET_MENUS', data.menus) - for (const menu of data.menus) { // 遍历菜单,获取所有的权限项 - if (menu.ismenu === '1') { // 将是菜单的放入menus + const allmenus = [...data.menus] + commit('SET_MENUS', allmenus) + for (const menu of allmenus) { // 遍历菜单,获取所有的权限项 + if (menu.resourceType === '02' || menu.resourceType === '03') { // 将是菜单的放入menus const menu_tmp = {} menu_tmp.url = menu.url menu_tmp.icon = menu.icon @@ -142,11 +148,11 @@ btn_tmp.name = menu.name btn_tmp.icon = menu.icon btns.push(btn_tmp) - // console.log(menu.url) } } // 过滤路由表 - const accessedRouters = filterAsyncRouter(asyncRouterMap, menus) + let accessedRouters = filterAsyncRouter(asyncRouterMap, menus) + // accessedRouters = filterRedirect(accessedRouters) commit('SET_BTNS', btns) commit('SET_ROUTERS', accessedRouters) resolve(response) diff --git a/package.json b/package.json index f8c5e2a..9f3a3eb 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "echarts": "^4.2.1", "element-ui": "2.13.0", "event-source-polyfill": "^1.0.5", + "file-saver": "^2.0.5", "js-cookie": "2.2.0", "jsencrypt": "^3.0.0-rc.1", "leaflet": "^1.7.1", @@ -34,7 +35,8 @@ "vue-baidu-map": "^0.21.22", "vue-router": "3.0.1", "vue2-leaflet": "^2.7.0", - "vuex": "3.0.1" + "vuex": "3.0.1", + "xlsx": "^0.17.0" }, "devDependencies": { "autoprefixer": "8.5.0", diff --git a/src/api/sanitation/statistics.js b/src/api/sanitation/statistics.js new file mode 100644 index 0000000..2ca7549 --- /dev/null +++ b/src/api/sanitation/statistics.js @@ -0,0 +1,13 @@ + +/** + * 考核统计接口 + */ +import request from '@/utils/request' +// 公厕保洁次数统计 +export function getToiletJobCount(params) { + return request({ + url: '/sanitation/statistic/toilet/jobCount', + method: 'get', + params + }) +} diff --git a/src/api/sanitation/toilet.js b/src/api/sanitation/toilet.js new file mode 100644 index 0000000..10fd245 --- /dev/null +++ b/src/api/sanitation/toilet.js @@ -0,0 +1,97 @@ +/** + * 公厕管理接口 + */ +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 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/toilet.js b/src/api/system/toilet.js deleted file mode 100644 index 8f38b8f..0000000 --- a/src/api/system/toilet.js +++ /dev/null @@ -1,91 +0,0 @@ -/** - * 公厕管理接口 - */ -import request from '@/utils/request' -import qs from 'qs' -export function getToiletList(params) { - return request({ - url: '/sanitation/toilet/listPage', - method: 'get', - params - }) -} - -export function getDetail(id) { - return request({ - url: '/sanitation/toiletClean/detail', - method: 'get', - params: { - id: id - } - }) -} - -// 公厕查询 -export function getToiletAll() { - return request({ - url: '/sanitation/toilet/listPage', - method: 'get' - }) -} - -// 添加公厕 -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 exportRecords(params) { - return request({ - url: 'device/batchExport', - method: 'get', - timeout: 120000, - params, - 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/assets/global_images/toilet.png b/src/assets/global_images/toilet.png new file mode 100644 index 0000000..6d9fc05 --- /dev/null +++ b/src/assets/global_images/toilet.png Binary files differ diff --git a/src/components/NormalTable/index.vue b/src/components/NormalTable/index.vue index 5077bef..04d322d 100644 --- a/src/components/NormalTable/index.vue +++ b/src/components/NormalTable/index.vue @@ -79,7 +79,7 @@
-
+
Object.assign(obj, { [key]: this[key] }), {}), + on: events.reduce((obj, key) => Object.assign(obj, { [key]: this.transmitEvent }), {}) + }) + } + this.props = [...extraProps, ...props.filter(prop => exceptProps.indexOf(prop))] + } +} + +export default prop => new Mixin(prop) diff --git a/src/components/mapWindow/base/mixins/common.js b/src/components/mapWindow/base/mixins/common.js new file mode 100644 index 0000000..2fd1a28 --- /dev/null +++ b/src/components/mapWindow/base/mixins/common.js @@ -0,0 +1,82 @@ +const types = { + map: { + unload: 'clearMap' + }, + control: { + unload: 'removeControl' + }, + layer: { + unload: 'removeLayer' + }, + features: { + unload: 'removeFeatures' + }, + listener: { + unload: 'removeListener' + } +} + +const getParent = $component => ($component.abstract || $component.$el === $component.$children[0].$el) ? getParent($component.$parent) : $component + +function destroyInstance () { + const { unload, renderByParent, $parent } = this + if (renderByParent) { + $parent.reload() + } + unload() +} + +class Mixin { + constructor (prop) { + this.methods = { + ready () { + const $parent = getParent(this.$parent) + const map = this.map = $parent.map + this.load() + this.$emit('ready', { + map + }) + }, + transmitEvent (e) { + this.$emit(e.type.replace(/^on/, ''), e) + }, + reload () { + this && this.$nextTick(() => { + this.unload() + this.$nextTick(this.load) + }) + }, + unload () { + const { map, originInstance } = this + try { + switch (prop.type) { + case 'search': + return originInstance.clearResults() + case 'autoComplete': + case 'lushu': + return originInstance.dispose() + case 'markerClusterer': + return originInstance.clearMarkers() + default: + map[types[prop.type].unload](originInstance) + } + } catch (e) {} + } + } + this.computed = { + renderByParent () { + return this.$parent.preventChildrenRender + } + } + this.mounted = function () { + console.log('common mounted') + const $parent = getParent(this.$parent) + const map = $parent.map + const { ready } = this + console.log(map) + map ? ready() : $parent.$on('onload', ready) + } + } +} + +export default type => new Mixin({ type }) diff --git a/src/components/mapWindow/leafletMap.vue b/src/components/mapWindow/leafletMap.vue new file mode 100644 index 0000000..931a5e9 --- /dev/null +++ b/src/components/mapWindow/leafletMap.vue @@ -0,0 +1,132 @@ + + + + + + + diff --git a/src/components/mapWindow/mapWindow.vue b/src/components/mapWindow/mapWindow.vue new file mode 100644 index 0000000..9ced291 --- /dev/null +++ b/src/components/mapWindow/mapWindow.vue @@ -0,0 +1,46 @@ + + + + + + diff --git a/src/permission.js b/src/permission.js index dc6b2f8..809ca86 100644 --- a/src/permission.js +++ b/src/permission.js @@ -25,8 +25,8 @@ store.dispatch('GetInfo').then(res => { // 拉取用户信息 // 设置当前子系统为基础资源子系统 const currentSys = { - code: 'baseResourse', - name: '基础资源子系统' + code: 'toliet', + name: '公共厕所管理系统' } // 将当前系统信息保存在localStorage中 store.commit('SET_SYSTEM', currentSys) diff --git a/src/router/index.js b/src/router/index.js index 431844b..d23076d 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -43,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 错误页面 diff --git a/src/router/modules/statistics.js b/src/router/modules/statistics.js index 442aa6f..fb9cbea 100644 --- a/src/router/modules/statistics.js +++ b/src/router/modules/statistics.js @@ -5,7 +5,7 @@ { path: 'statisticsToilet', component: Layout, - redirect: '/statisticsToilet', + redirect: '/workStatistics', name: 'StatisticsToilet', meta: { title: '作业统计', @@ -14,10 +14,16 @@ }, children: [ { - path: '/statistics', - name: 'Statistics', - component: () => import('@/views/statistics/workStatistics'), - meta: { title: '作业统计', icon: 'function', permission: ['/statisticsToilet'] } + path: '/workStatistics', + name: 'WorkStatistics', + component: () => import('@/views/statistics/toiletAssessment'), + meta: { title: '作业统计', icon: '', permission: ['/toilet/workStatistics'] } + }, + { + path: '/evaluationStatistics', + name: 'EvaluationStatistics', + component: () => import('@/views/statistics/evaluationAssessment'), + meta: { title: '评价统计', icon: '', permission: ['/toilet/evaluationStatistics'] } } ] } diff --git a/src/router/modules/toilet.js b/src/router/modules/toilet.js index e537ce9..b221a0e 100644 --- a/src/router/modules/toilet.js +++ b/src/router/modules/toilet.js @@ -16,7 +16,7 @@ { path: '/toiletList', name: 'ToiletList', - component: () => import('@/views/toilet/listToilet'), + component: () => import('@/views/toiletManage/toiletList'), meta: { title: '公厕台帐管理', icon: 'function', permission: ['/toiletList'] } }, { diff --git a/src/router/modules/work.js b/src/router/modules/work.js index 3725050..5e0759f 100644 --- a/src/router/modules/work.js +++ b/src/router/modules/work.js @@ -16,7 +16,7 @@ { path: '/toiletWork', name: 'ToiletWork', - component: () => import('@/views/toilet/listWork'), + component: () => import('@/views/toiletClean/toiletCleanList'), meta: { title: '作业管理', icon: 'function', permission: ['/toiletWork'] } } ] diff --git a/src/settings.js b/src/settings.js index b568ce0..b8159bf 100644 --- a/src/settings.js +++ b/src/settings.js @@ -3,7 +3,7 @@ * @type {boolean} true | false * @description 是否显示设置按钮 */ - showSettings: true, + showSettings: false, /** * @type {boolean} true | false diff --git a/src/store/modules/permission.js b/src/store/modules/permission.js index a0cb8cf..3ab50d5 100644 --- a/src/store/modules/permission.js +++ b/src/store/modules/permission.js @@ -120,17 +120,23 @@ }) }, // 获取用户权限 - GetMenus({ commit, state }) { - console.log('in store.permission.js:GetMenus:') + GetMenus({ commit, state }, currentSystem) { + // console.log('in store.permission.js:GetMenus:') + console.log('获取' + currentSystem.name + '的菜单') + const params = { + parentCode: currentSystem.code // 传入该子系统的code,获取子系统的权限 + } return new Promise((resolve, reject) => { - getMenus(state.token).then(response => { // 处理返回值 + // 此处获取用户所有权限 + getMenus(params).then(response => { // 处理返回值 const data = response.data const menus = [] // 仅菜单 const btns = [] // 非菜单 if (data.menus && data.menus.length > 0) { - commit('SET_MENUS', data.menus) - for (const menu of data.menus) { // 遍历菜单,获取所有的权限项 - if (menu.ismenu === '1') { // 将是菜单的放入menus + const allmenus = [...data.menus] + commit('SET_MENUS', allmenus) + for (const menu of allmenus) { // 遍历菜单,获取所有的权限项 + if (menu.resourceType === '02' || menu.resourceType === '03') { // 将是菜单的放入menus const menu_tmp = {} menu_tmp.url = menu.url menu_tmp.icon = menu.icon @@ -142,11 +148,11 @@ btn_tmp.name = menu.name btn_tmp.icon = menu.icon btns.push(btn_tmp) - // console.log(menu.url) } } // 过滤路由表 - const accessedRouters = filterAsyncRouter(asyncRouterMap, menus) + let accessedRouters = filterAsyncRouter(asyncRouterMap, menus) + // accessedRouters = filterRedirect(accessedRouters) commit('SET_BTNS', btns) commit('SET_ROUTERS', accessedRouters) resolve(response) diff --git a/src/utils/dateutils.js b/src/utils/dateutils.js index 868111a..5cd16af 100644 --- a/src/utils/dateutils.js +++ b/src/utils/dateutils.js @@ -15,15 +15,15 @@ return ct_month } -export function getLastWeek() { // 默认显示上周 +export function getLastWeek(fmt) { // 默认显示上周 const ct_month = new Date() ct_month.setTime(ct_month.getTime() - 3600 * 1000 * 24 * 7) - return ct_month + return ct_month.Format(fmt) } -export function getLastMonth() { // 默认显示上个月 +export function getLastMonth(fmt) { // 默认显示上个月 const ct_month = new Date() ct_month.setTime(ct_month.getTime() - 3600 * 1000 * 24 * 30) - return ct_month + return ct_month.Format(fmt) } // 对Date的扩展,将 Date 转化为指定格式的String diff --git a/package.json b/package.json index f8c5e2a..9f3a3eb 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "echarts": "^4.2.1", "element-ui": "2.13.0", "event-source-polyfill": "^1.0.5", + "file-saver": "^2.0.5", "js-cookie": "2.2.0", "jsencrypt": "^3.0.0-rc.1", "leaflet": "^1.7.1", @@ -34,7 +35,8 @@ "vue-baidu-map": "^0.21.22", "vue-router": "3.0.1", "vue2-leaflet": "^2.7.0", - "vuex": "3.0.1" + "vuex": "3.0.1", + "xlsx": "^0.17.0" }, "devDependencies": { "autoprefixer": "8.5.0", diff --git a/src/api/sanitation/statistics.js b/src/api/sanitation/statistics.js new file mode 100644 index 0000000..2ca7549 --- /dev/null +++ b/src/api/sanitation/statistics.js @@ -0,0 +1,13 @@ + +/** + * 考核统计接口 + */ +import request from '@/utils/request' +// 公厕保洁次数统计 +export function getToiletJobCount(params) { + return request({ + url: '/sanitation/statistic/toilet/jobCount', + method: 'get', + params + }) +} diff --git a/src/api/sanitation/toilet.js b/src/api/sanitation/toilet.js new file mode 100644 index 0000000..10fd245 --- /dev/null +++ b/src/api/sanitation/toilet.js @@ -0,0 +1,97 @@ +/** + * 公厕管理接口 + */ +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 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/toilet.js b/src/api/system/toilet.js deleted file mode 100644 index 8f38b8f..0000000 --- a/src/api/system/toilet.js +++ /dev/null @@ -1,91 +0,0 @@ -/** - * 公厕管理接口 - */ -import request from '@/utils/request' -import qs from 'qs' -export function getToiletList(params) { - return request({ - url: '/sanitation/toilet/listPage', - method: 'get', - params - }) -} - -export function getDetail(id) { - return request({ - url: '/sanitation/toiletClean/detail', - method: 'get', - params: { - id: id - } - }) -} - -// 公厕查询 -export function getToiletAll() { - return request({ - url: '/sanitation/toilet/listPage', - method: 'get' - }) -} - -// 添加公厕 -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 exportRecords(params) { - return request({ - url: 'device/batchExport', - method: 'get', - timeout: 120000, - params, - 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/assets/global_images/toilet.png b/src/assets/global_images/toilet.png new file mode 100644 index 0000000..6d9fc05 --- /dev/null +++ b/src/assets/global_images/toilet.png Binary files differ diff --git a/src/components/NormalTable/index.vue b/src/components/NormalTable/index.vue index 5077bef..04d322d 100644 --- a/src/components/NormalTable/index.vue +++ b/src/components/NormalTable/index.vue @@ -79,7 +79,7 @@
-
+
Object.assign(obj, { [key]: this[key] }), {}), + on: events.reduce((obj, key) => Object.assign(obj, { [key]: this.transmitEvent }), {}) + }) + } + this.props = [...extraProps, ...props.filter(prop => exceptProps.indexOf(prop))] + } +} + +export default prop => new Mixin(prop) diff --git a/src/components/mapWindow/base/mixins/common.js b/src/components/mapWindow/base/mixins/common.js new file mode 100644 index 0000000..2fd1a28 --- /dev/null +++ b/src/components/mapWindow/base/mixins/common.js @@ -0,0 +1,82 @@ +const types = { + map: { + unload: 'clearMap' + }, + control: { + unload: 'removeControl' + }, + layer: { + unload: 'removeLayer' + }, + features: { + unload: 'removeFeatures' + }, + listener: { + unload: 'removeListener' + } +} + +const getParent = $component => ($component.abstract || $component.$el === $component.$children[0].$el) ? getParent($component.$parent) : $component + +function destroyInstance () { + const { unload, renderByParent, $parent } = this + if (renderByParent) { + $parent.reload() + } + unload() +} + +class Mixin { + constructor (prop) { + this.methods = { + ready () { + const $parent = getParent(this.$parent) + const map = this.map = $parent.map + this.load() + this.$emit('ready', { + map + }) + }, + transmitEvent (e) { + this.$emit(e.type.replace(/^on/, ''), e) + }, + reload () { + this && this.$nextTick(() => { + this.unload() + this.$nextTick(this.load) + }) + }, + unload () { + const { map, originInstance } = this + try { + switch (prop.type) { + case 'search': + return originInstance.clearResults() + case 'autoComplete': + case 'lushu': + return originInstance.dispose() + case 'markerClusterer': + return originInstance.clearMarkers() + default: + map[types[prop.type].unload](originInstance) + } + } catch (e) {} + } + } + this.computed = { + renderByParent () { + return this.$parent.preventChildrenRender + } + } + this.mounted = function () { + console.log('common mounted') + const $parent = getParent(this.$parent) + const map = $parent.map + const { ready } = this + console.log(map) + map ? ready() : $parent.$on('onload', ready) + } + } +} + +export default type => new Mixin({ type }) diff --git a/src/components/mapWindow/leafletMap.vue b/src/components/mapWindow/leafletMap.vue new file mode 100644 index 0000000..931a5e9 --- /dev/null +++ b/src/components/mapWindow/leafletMap.vue @@ -0,0 +1,132 @@ + + + + + + + diff --git a/src/components/mapWindow/mapWindow.vue b/src/components/mapWindow/mapWindow.vue new file mode 100644 index 0000000..9ced291 --- /dev/null +++ b/src/components/mapWindow/mapWindow.vue @@ -0,0 +1,46 @@ + + + + + + diff --git a/src/permission.js b/src/permission.js index dc6b2f8..809ca86 100644 --- a/src/permission.js +++ b/src/permission.js @@ -25,8 +25,8 @@ store.dispatch('GetInfo').then(res => { // 拉取用户信息 // 设置当前子系统为基础资源子系统 const currentSys = { - code: 'baseResourse', - name: '基础资源子系统' + code: 'toliet', + name: '公共厕所管理系统' } // 将当前系统信息保存在localStorage中 store.commit('SET_SYSTEM', currentSys) diff --git a/src/router/index.js b/src/router/index.js index 431844b..d23076d 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -43,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 错误页面 diff --git a/src/router/modules/statistics.js b/src/router/modules/statistics.js index 442aa6f..fb9cbea 100644 --- a/src/router/modules/statistics.js +++ b/src/router/modules/statistics.js @@ -5,7 +5,7 @@ { path: 'statisticsToilet', component: Layout, - redirect: '/statisticsToilet', + redirect: '/workStatistics', name: 'StatisticsToilet', meta: { title: '作业统计', @@ -14,10 +14,16 @@ }, children: [ { - path: '/statistics', - name: 'Statistics', - component: () => import('@/views/statistics/workStatistics'), - meta: { title: '作业统计', icon: 'function', permission: ['/statisticsToilet'] } + path: '/workStatistics', + name: 'WorkStatistics', + component: () => import('@/views/statistics/toiletAssessment'), + meta: { title: '作业统计', icon: '', permission: ['/toilet/workStatistics'] } + }, + { + path: '/evaluationStatistics', + name: 'EvaluationStatistics', + component: () => import('@/views/statistics/evaluationAssessment'), + meta: { title: '评价统计', icon: '', permission: ['/toilet/evaluationStatistics'] } } ] } diff --git a/src/router/modules/toilet.js b/src/router/modules/toilet.js index e537ce9..b221a0e 100644 --- a/src/router/modules/toilet.js +++ b/src/router/modules/toilet.js @@ -16,7 +16,7 @@ { path: '/toiletList', name: 'ToiletList', - component: () => import('@/views/toilet/listToilet'), + component: () => import('@/views/toiletManage/toiletList'), meta: { title: '公厕台帐管理', icon: 'function', permission: ['/toiletList'] } }, { diff --git a/src/router/modules/work.js b/src/router/modules/work.js index 3725050..5e0759f 100644 --- a/src/router/modules/work.js +++ b/src/router/modules/work.js @@ -16,7 +16,7 @@ { path: '/toiletWork', name: 'ToiletWork', - component: () => import('@/views/toilet/listWork'), + component: () => import('@/views/toiletClean/toiletCleanList'), meta: { title: '作业管理', icon: 'function', permission: ['/toiletWork'] } } ] diff --git a/src/settings.js b/src/settings.js index b568ce0..b8159bf 100644 --- a/src/settings.js +++ b/src/settings.js @@ -3,7 +3,7 @@ * @type {boolean} true | false * @description 是否显示设置按钮 */ - showSettings: true, + showSettings: false, /** * @type {boolean} true | false diff --git a/src/store/modules/permission.js b/src/store/modules/permission.js index a0cb8cf..3ab50d5 100644 --- a/src/store/modules/permission.js +++ b/src/store/modules/permission.js @@ -120,17 +120,23 @@ }) }, // 获取用户权限 - GetMenus({ commit, state }) { - console.log('in store.permission.js:GetMenus:') + GetMenus({ commit, state }, currentSystem) { + // console.log('in store.permission.js:GetMenus:') + console.log('获取' + currentSystem.name + '的菜单') + const params = { + parentCode: currentSystem.code // 传入该子系统的code,获取子系统的权限 + } return new Promise((resolve, reject) => { - getMenus(state.token).then(response => { // 处理返回值 + // 此处获取用户所有权限 + getMenus(params).then(response => { // 处理返回值 const data = response.data const menus = [] // 仅菜单 const btns = [] // 非菜单 if (data.menus && data.menus.length > 0) { - commit('SET_MENUS', data.menus) - for (const menu of data.menus) { // 遍历菜单,获取所有的权限项 - if (menu.ismenu === '1') { // 将是菜单的放入menus + const allmenus = [...data.menus] + commit('SET_MENUS', allmenus) + for (const menu of allmenus) { // 遍历菜单,获取所有的权限项 + if (menu.resourceType === '02' || menu.resourceType === '03') { // 将是菜单的放入menus const menu_tmp = {} menu_tmp.url = menu.url menu_tmp.icon = menu.icon @@ -142,11 +148,11 @@ btn_tmp.name = menu.name btn_tmp.icon = menu.icon btns.push(btn_tmp) - // console.log(menu.url) } } // 过滤路由表 - const accessedRouters = filterAsyncRouter(asyncRouterMap, menus) + let accessedRouters = filterAsyncRouter(asyncRouterMap, menus) + // accessedRouters = filterRedirect(accessedRouters) commit('SET_BTNS', btns) commit('SET_ROUTERS', accessedRouters) resolve(response) diff --git a/src/utils/dateutils.js b/src/utils/dateutils.js index 868111a..5cd16af 100644 --- a/src/utils/dateutils.js +++ b/src/utils/dateutils.js @@ -15,15 +15,15 @@ return ct_month } -export function getLastWeek() { // 默认显示上周 +export function getLastWeek(fmt) { // 默认显示上周 const ct_month = new Date() ct_month.setTime(ct_month.getTime() - 3600 * 1000 * 24 * 7) - return ct_month + return ct_month.Format(fmt) } -export function getLastMonth() { // 默认显示上个月 +export function getLastMonth(fmt) { // 默认显示上个月 const ct_month = new Date() ct_month.setTime(ct_month.getTime() - 3600 * 1000 * 24 * 30) - return ct_month + return ct_month.Format(fmt) } // 对Date的扩展,将 Date 转化为指定格式的String diff --git a/src/utils/exportutils.js b/src/utils/exportutils.js new file mode 100644 index 0000000..b5d0bcf --- /dev/null +++ b/src/utils/exportutils.js @@ -0,0 +1,19 @@ +/** + * 导出文件工具 + * @param blob 文件 + * @param fileName 导出文件名 + */ +export function exportFile(blob, fileName) { + if (window.navigator && window.navigator.msSaveOrOpenBlob) { + navigator.msSaveBlob(blob, fileName) + } else { + const downloadElement = document.createElement('a') + const href = window.URL.createObjectURL(blob) // 创建下载的链接 + downloadElement.href = href + downloadElement.download = fileName + document.body.appendChild(downloadElement) + downloadElement.click() // 点击下载 + document.body.removeChild(downloadElement) // 下载完成移除元素 + window.URL.revokeObjectURL(href) // 释放blob对象 + } +} diff --git a/package.json b/package.json index f8c5e2a..9f3a3eb 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "echarts": "^4.2.1", "element-ui": "2.13.0", "event-source-polyfill": "^1.0.5", + "file-saver": "^2.0.5", "js-cookie": "2.2.0", "jsencrypt": "^3.0.0-rc.1", "leaflet": "^1.7.1", @@ -34,7 +35,8 @@ "vue-baidu-map": "^0.21.22", "vue-router": "3.0.1", "vue2-leaflet": "^2.7.0", - "vuex": "3.0.1" + "vuex": "3.0.1", + "xlsx": "^0.17.0" }, "devDependencies": { "autoprefixer": "8.5.0", diff --git a/src/api/sanitation/statistics.js b/src/api/sanitation/statistics.js new file mode 100644 index 0000000..2ca7549 --- /dev/null +++ b/src/api/sanitation/statistics.js @@ -0,0 +1,13 @@ + +/** + * 考核统计接口 + */ +import request from '@/utils/request' +// 公厕保洁次数统计 +export function getToiletJobCount(params) { + return request({ + url: '/sanitation/statistic/toilet/jobCount', + method: 'get', + params + }) +} diff --git a/src/api/sanitation/toilet.js b/src/api/sanitation/toilet.js new file mode 100644 index 0000000..10fd245 --- /dev/null +++ b/src/api/sanitation/toilet.js @@ -0,0 +1,97 @@ +/** + * 公厕管理接口 + */ +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 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/toilet.js b/src/api/system/toilet.js deleted file mode 100644 index 8f38b8f..0000000 --- a/src/api/system/toilet.js +++ /dev/null @@ -1,91 +0,0 @@ -/** - * 公厕管理接口 - */ -import request from '@/utils/request' -import qs from 'qs' -export function getToiletList(params) { - return request({ - url: '/sanitation/toilet/listPage', - method: 'get', - params - }) -} - -export function getDetail(id) { - return request({ - url: '/sanitation/toiletClean/detail', - method: 'get', - params: { - id: id - } - }) -} - -// 公厕查询 -export function getToiletAll() { - return request({ - url: '/sanitation/toilet/listPage', - method: 'get' - }) -} - -// 添加公厕 -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 exportRecords(params) { - return request({ - url: 'device/batchExport', - method: 'get', - timeout: 120000, - params, - 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/assets/global_images/toilet.png b/src/assets/global_images/toilet.png new file mode 100644 index 0000000..6d9fc05 --- /dev/null +++ b/src/assets/global_images/toilet.png Binary files differ diff --git a/src/components/NormalTable/index.vue b/src/components/NormalTable/index.vue index 5077bef..04d322d 100644 --- a/src/components/NormalTable/index.vue +++ b/src/components/NormalTable/index.vue @@ -79,7 +79,7 @@
-
+
Object.assign(obj, { [key]: this[key] }), {}), + on: events.reduce((obj, key) => Object.assign(obj, { [key]: this.transmitEvent }), {}) + }) + } + this.props = [...extraProps, ...props.filter(prop => exceptProps.indexOf(prop))] + } +} + +export default prop => new Mixin(prop) diff --git a/src/components/mapWindow/base/mixins/common.js b/src/components/mapWindow/base/mixins/common.js new file mode 100644 index 0000000..2fd1a28 --- /dev/null +++ b/src/components/mapWindow/base/mixins/common.js @@ -0,0 +1,82 @@ +const types = { + map: { + unload: 'clearMap' + }, + control: { + unload: 'removeControl' + }, + layer: { + unload: 'removeLayer' + }, + features: { + unload: 'removeFeatures' + }, + listener: { + unload: 'removeListener' + } +} + +const getParent = $component => ($component.abstract || $component.$el === $component.$children[0].$el) ? getParent($component.$parent) : $component + +function destroyInstance () { + const { unload, renderByParent, $parent } = this + if (renderByParent) { + $parent.reload() + } + unload() +} + +class Mixin { + constructor (prop) { + this.methods = { + ready () { + const $parent = getParent(this.$parent) + const map = this.map = $parent.map + this.load() + this.$emit('ready', { + map + }) + }, + transmitEvent (e) { + this.$emit(e.type.replace(/^on/, ''), e) + }, + reload () { + this && this.$nextTick(() => { + this.unload() + this.$nextTick(this.load) + }) + }, + unload () { + const { map, originInstance } = this + try { + switch (prop.type) { + case 'search': + return originInstance.clearResults() + case 'autoComplete': + case 'lushu': + return originInstance.dispose() + case 'markerClusterer': + return originInstance.clearMarkers() + default: + map[types[prop.type].unload](originInstance) + } + } catch (e) {} + } + } + this.computed = { + renderByParent () { + return this.$parent.preventChildrenRender + } + } + this.mounted = function () { + console.log('common mounted') + const $parent = getParent(this.$parent) + const map = $parent.map + const { ready } = this + console.log(map) + map ? ready() : $parent.$on('onload', ready) + } + } +} + +export default type => new Mixin({ type }) diff --git a/src/components/mapWindow/leafletMap.vue b/src/components/mapWindow/leafletMap.vue new file mode 100644 index 0000000..931a5e9 --- /dev/null +++ b/src/components/mapWindow/leafletMap.vue @@ -0,0 +1,132 @@ + + + + + + + diff --git a/src/components/mapWindow/mapWindow.vue b/src/components/mapWindow/mapWindow.vue new file mode 100644 index 0000000..9ced291 --- /dev/null +++ b/src/components/mapWindow/mapWindow.vue @@ -0,0 +1,46 @@ + + + + + + diff --git a/src/permission.js b/src/permission.js index dc6b2f8..809ca86 100644 --- a/src/permission.js +++ b/src/permission.js @@ -25,8 +25,8 @@ store.dispatch('GetInfo').then(res => { // 拉取用户信息 // 设置当前子系统为基础资源子系统 const currentSys = { - code: 'baseResourse', - name: '基础资源子系统' + code: 'toliet', + name: '公共厕所管理系统' } // 将当前系统信息保存在localStorage中 store.commit('SET_SYSTEM', currentSys) diff --git a/src/router/index.js b/src/router/index.js index 431844b..d23076d 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -43,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 错误页面 diff --git a/src/router/modules/statistics.js b/src/router/modules/statistics.js index 442aa6f..fb9cbea 100644 --- a/src/router/modules/statistics.js +++ b/src/router/modules/statistics.js @@ -5,7 +5,7 @@ { path: 'statisticsToilet', component: Layout, - redirect: '/statisticsToilet', + redirect: '/workStatistics', name: 'StatisticsToilet', meta: { title: '作业统计', @@ -14,10 +14,16 @@ }, children: [ { - path: '/statistics', - name: 'Statistics', - component: () => import('@/views/statistics/workStatistics'), - meta: { title: '作业统计', icon: 'function', permission: ['/statisticsToilet'] } + path: '/workStatistics', + name: 'WorkStatistics', + component: () => import('@/views/statistics/toiletAssessment'), + meta: { title: '作业统计', icon: '', permission: ['/toilet/workStatistics'] } + }, + { + path: '/evaluationStatistics', + name: 'EvaluationStatistics', + component: () => import('@/views/statistics/evaluationAssessment'), + meta: { title: '评价统计', icon: '', permission: ['/toilet/evaluationStatistics'] } } ] } diff --git a/src/router/modules/toilet.js b/src/router/modules/toilet.js index e537ce9..b221a0e 100644 --- a/src/router/modules/toilet.js +++ b/src/router/modules/toilet.js @@ -16,7 +16,7 @@ { path: '/toiletList', name: 'ToiletList', - component: () => import('@/views/toilet/listToilet'), + component: () => import('@/views/toiletManage/toiletList'), meta: { title: '公厕台帐管理', icon: 'function', permission: ['/toiletList'] } }, { diff --git a/src/router/modules/work.js b/src/router/modules/work.js index 3725050..5e0759f 100644 --- a/src/router/modules/work.js +++ b/src/router/modules/work.js @@ -16,7 +16,7 @@ { path: '/toiletWork', name: 'ToiletWork', - component: () => import('@/views/toilet/listWork'), + component: () => import('@/views/toiletClean/toiletCleanList'), meta: { title: '作业管理', icon: 'function', permission: ['/toiletWork'] } } ] diff --git a/src/settings.js b/src/settings.js index b568ce0..b8159bf 100644 --- a/src/settings.js +++ b/src/settings.js @@ -3,7 +3,7 @@ * @type {boolean} true | false * @description 是否显示设置按钮 */ - showSettings: true, + showSettings: false, /** * @type {boolean} true | false diff --git a/src/store/modules/permission.js b/src/store/modules/permission.js index a0cb8cf..3ab50d5 100644 --- a/src/store/modules/permission.js +++ b/src/store/modules/permission.js @@ -120,17 +120,23 @@ }) }, // 获取用户权限 - GetMenus({ commit, state }) { - console.log('in store.permission.js:GetMenus:') + GetMenus({ commit, state }, currentSystem) { + // console.log('in store.permission.js:GetMenus:') + console.log('获取' + currentSystem.name + '的菜单') + const params = { + parentCode: currentSystem.code // 传入该子系统的code,获取子系统的权限 + } return new Promise((resolve, reject) => { - getMenus(state.token).then(response => { // 处理返回值 + // 此处获取用户所有权限 + getMenus(params).then(response => { // 处理返回值 const data = response.data const menus = [] // 仅菜单 const btns = [] // 非菜单 if (data.menus && data.menus.length > 0) { - commit('SET_MENUS', data.menus) - for (const menu of data.menus) { // 遍历菜单,获取所有的权限项 - if (menu.ismenu === '1') { // 将是菜单的放入menus + const allmenus = [...data.menus] + commit('SET_MENUS', allmenus) + for (const menu of allmenus) { // 遍历菜单,获取所有的权限项 + if (menu.resourceType === '02' || menu.resourceType === '03') { // 将是菜单的放入menus const menu_tmp = {} menu_tmp.url = menu.url menu_tmp.icon = menu.icon @@ -142,11 +148,11 @@ btn_tmp.name = menu.name btn_tmp.icon = menu.icon btns.push(btn_tmp) - // console.log(menu.url) } } // 过滤路由表 - const accessedRouters = filterAsyncRouter(asyncRouterMap, menus) + let accessedRouters = filterAsyncRouter(asyncRouterMap, menus) + // accessedRouters = filterRedirect(accessedRouters) commit('SET_BTNS', btns) commit('SET_ROUTERS', accessedRouters) resolve(response) diff --git a/src/utils/dateutils.js b/src/utils/dateutils.js index 868111a..5cd16af 100644 --- a/src/utils/dateutils.js +++ b/src/utils/dateutils.js @@ -15,15 +15,15 @@ return ct_month } -export function getLastWeek() { // 默认显示上周 +export function getLastWeek(fmt) { // 默认显示上周 const ct_month = new Date() ct_month.setTime(ct_month.getTime() - 3600 * 1000 * 24 * 7) - return ct_month + return ct_month.Format(fmt) } -export function getLastMonth() { // 默认显示上个月 +export function getLastMonth(fmt) { // 默认显示上个月 const ct_month = new Date() ct_month.setTime(ct_month.getTime() - 3600 * 1000 * 24 * 30) - return ct_month + return ct_month.Format(fmt) } // 对Date的扩展,将 Date 转化为指定格式的String diff --git a/src/utils/exportutils.js b/src/utils/exportutils.js new file mode 100644 index 0000000..b5d0bcf --- /dev/null +++ b/src/utils/exportutils.js @@ -0,0 +1,19 @@ +/** + * 导出文件工具 + * @param blob 文件 + * @param fileName 导出文件名 + */ +export function exportFile(blob, fileName) { + if (window.navigator && window.navigator.msSaveOrOpenBlob) { + navigator.msSaveBlob(blob, fileName) + } else { + const downloadElement = document.createElement('a') + const href = window.URL.createObjectURL(blob) // 创建下载的链接 + downloadElement.href = href + downloadElement.download = fileName + document.body.appendChild(downloadElement) + downloadElement.click() // 点击下载 + document.body.removeChild(downloadElement) // 下载完成移除元素 + window.URL.revokeObjectURL(href) // 释放blob对象 + } +} diff --git a/src/views/mapViews/mapView.vue b/src/views/mapViews/mapView.vue index feba3f6..a18db88 100644 --- a/src/views/mapViews/mapView.vue +++ b/src/views/mapViews/mapView.vue @@ -41,10 +41,7 @@ zoomOffset: 1 } }, - // mapurl: 'http://t1.tianditu.com/vec_w/wmts?layer=vec&style=default&tilematrixset=w&Service=WMTS&Request=GetTile&Version=1.0.0&Format=tiles&TileMatrix={z}&TileCol={x}&TileRow={y}&tk=adbdd8e08c292f6cb4e3f0289f7d0447', mapurl: this.baseConfig.mapUrl, - // mapurl: 'http://webrd01.is.autonavi.com/appmaptile?lang=zh_cn&size=1&scale=1&style=8&x={x}&y={y}&z={z}', - // labelurl: 'http://t1.tianditu.com/cva_w/wmts?layer=cva&style=default&tilematrixset=w&Service=WMTS&Request=GetTile&Version=1.0.0&Format=tiles&TileMatrix={z}&TileCol={x}&TileRow={y}&tk=adbdd8e08c292f6cb4e3f0289f7d0447' labelurl: this.baseConfig.labelUrl } }, diff --git a/package.json b/package.json index f8c5e2a..9f3a3eb 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "echarts": "^4.2.1", "element-ui": "2.13.0", "event-source-polyfill": "^1.0.5", + "file-saver": "^2.0.5", "js-cookie": "2.2.0", "jsencrypt": "^3.0.0-rc.1", "leaflet": "^1.7.1", @@ -34,7 +35,8 @@ "vue-baidu-map": "^0.21.22", "vue-router": "3.0.1", "vue2-leaflet": "^2.7.0", - "vuex": "3.0.1" + "vuex": "3.0.1", + "xlsx": "^0.17.0" }, "devDependencies": { "autoprefixer": "8.5.0", diff --git a/src/api/sanitation/statistics.js b/src/api/sanitation/statistics.js new file mode 100644 index 0000000..2ca7549 --- /dev/null +++ b/src/api/sanitation/statistics.js @@ -0,0 +1,13 @@ + +/** + * 考核统计接口 + */ +import request from '@/utils/request' +// 公厕保洁次数统计 +export function getToiletJobCount(params) { + return request({ + url: '/sanitation/statistic/toilet/jobCount', + method: 'get', + params + }) +} diff --git a/src/api/sanitation/toilet.js b/src/api/sanitation/toilet.js new file mode 100644 index 0000000..10fd245 --- /dev/null +++ b/src/api/sanitation/toilet.js @@ -0,0 +1,97 @@ +/** + * 公厕管理接口 + */ +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 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/toilet.js b/src/api/system/toilet.js deleted file mode 100644 index 8f38b8f..0000000 --- a/src/api/system/toilet.js +++ /dev/null @@ -1,91 +0,0 @@ -/** - * 公厕管理接口 - */ -import request from '@/utils/request' -import qs from 'qs' -export function getToiletList(params) { - return request({ - url: '/sanitation/toilet/listPage', - method: 'get', - params - }) -} - -export function getDetail(id) { - return request({ - url: '/sanitation/toiletClean/detail', - method: 'get', - params: { - id: id - } - }) -} - -// 公厕查询 -export function getToiletAll() { - return request({ - url: '/sanitation/toilet/listPage', - method: 'get' - }) -} - -// 添加公厕 -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 exportRecords(params) { - return request({ - url: 'device/batchExport', - method: 'get', - timeout: 120000, - params, - 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/assets/global_images/toilet.png b/src/assets/global_images/toilet.png new file mode 100644 index 0000000..6d9fc05 --- /dev/null +++ b/src/assets/global_images/toilet.png Binary files differ diff --git a/src/components/NormalTable/index.vue b/src/components/NormalTable/index.vue index 5077bef..04d322d 100644 --- a/src/components/NormalTable/index.vue +++ b/src/components/NormalTable/index.vue @@ -79,7 +79,7 @@
-
+
Object.assign(obj, { [key]: this[key] }), {}), + on: events.reduce((obj, key) => Object.assign(obj, { [key]: this.transmitEvent }), {}) + }) + } + this.props = [...extraProps, ...props.filter(prop => exceptProps.indexOf(prop))] + } +} + +export default prop => new Mixin(prop) diff --git a/src/components/mapWindow/base/mixins/common.js b/src/components/mapWindow/base/mixins/common.js new file mode 100644 index 0000000..2fd1a28 --- /dev/null +++ b/src/components/mapWindow/base/mixins/common.js @@ -0,0 +1,82 @@ +const types = { + map: { + unload: 'clearMap' + }, + control: { + unload: 'removeControl' + }, + layer: { + unload: 'removeLayer' + }, + features: { + unload: 'removeFeatures' + }, + listener: { + unload: 'removeListener' + } +} + +const getParent = $component => ($component.abstract || $component.$el === $component.$children[0].$el) ? getParent($component.$parent) : $component + +function destroyInstance () { + const { unload, renderByParent, $parent } = this + if (renderByParent) { + $parent.reload() + } + unload() +} + +class Mixin { + constructor (prop) { + this.methods = { + ready () { + const $parent = getParent(this.$parent) + const map = this.map = $parent.map + this.load() + this.$emit('ready', { + map + }) + }, + transmitEvent (e) { + this.$emit(e.type.replace(/^on/, ''), e) + }, + reload () { + this && this.$nextTick(() => { + this.unload() + this.$nextTick(this.load) + }) + }, + unload () { + const { map, originInstance } = this + try { + switch (prop.type) { + case 'search': + return originInstance.clearResults() + case 'autoComplete': + case 'lushu': + return originInstance.dispose() + case 'markerClusterer': + return originInstance.clearMarkers() + default: + map[types[prop.type].unload](originInstance) + } + } catch (e) {} + } + } + this.computed = { + renderByParent () { + return this.$parent.preventChildrenRender + } + } + this.mounted = function () { + console.log('common mounted') + const $parent = getParent(this.$parent) + const map = $parent.map + const { ready } = this + console.log(map) + map ? ready() : $parent.$on('onload', ready) + } + } +} + +export default type => new Mixin({ type }) diff --git a/src/components/mapWindow/leafletMap.vue b/src/components/mapWindow/leafletMap.vue new file mode 100644 index 0000000..931a5e9 --- /dev/null +++ b/src/components/mapWindow/leafletMap.vue @@ -0,0 +1,132 @@ + + + + + + + diff --git a/src/components/mapWindow/mapWindow.vue b/src/components/mapWindow/mapWindow.vue new file mode 100644 index 0000000..9ced291 --- /dev/null +++ b/src/components/mapWindow/mapWindow.vue @@ -0,0 +1,46 @@ + + + + + + diff --git a/src/permission.js b/src/permission.js index dc6b2f8..809ca86 100644 --- a/src/permission.js +++ b/src/permission.js @@ -25,8 +25,8 @@ store.dispatch('GetInfo').then(res => { // 拉取用户信息 // 设置当前子系统为基础资源子系统 const currentSys = { - code: 'baseResourse', - name: '基础资源子系统' + code: 'toliet', + name: '公共厕所管理系统' } // 将当前系统信息保存在localStorage中 store.commit('SET_SYSTEM', currentSys) diff --git a/src/router/index.js b/src/router/index.js index 431844b..d23076d 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -43,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 错误页面 diff --git a/src/router/modules/statistics.js b/src/router/modules/statistics.js index 442aa6f..fb9cbea 100644 --- a/src/router/modules/statistics.js +++ b/src/router/modules/statistics.js @@ -5,7 +5,7 @@ { path: 'statisticsToilet', component: Layout, - redirect: '/statisticsToilet', + redirect: '/workStatistics', name: 'StatisticsToilet', meta: { title: '作业统计', @@ -14,10 +14,16 @@ }, children: [ { - path: '/statistics', - name: 'Statistics', - component: () => import('@/views/statistics/workStatistics'), - meta: { title: '作业统计', icon: 'function', permission: ['/statisticsToilet'] } + path: '/workStatistics', + name: 'WorkStatistics', + component: () => import('@/views/statistics/toiletAssessment'), + meta: { title: '作业统计', icon: '', permission: ['/toilet/workStatistics'] } + }, + { + path: '/evaluationStatistics', + name: 'EvaluationStatistics', + component: () => import('@/views/statistics/evaluationAssessment'), + meta: { title: '评价统计', icon: '', permission: ['/toilet/evaluationStatistics'] } } ] } diff --git a/src/router/modules/toilet.js b/src/router/modules/toilet.js index e537ce9..b221a0e 100644 --- a/src/router/modules/toilet.js +++ b/src/router/modules/toilet.js @@ -16,7 +16,7 @@ { path: '/toiletList', name: 'ToiletList', - component: () => import('@/views/toilet/listToilet'), + component: () => import('@/views/toiletManage/toiletList'), meta: { title: '公厕台帐管理', icon: 'function', permission: ['/toiletList'] } }, { diff --git a/src/router/modules/work.js b/src/router/modules/work.js index 3725050..5e0759f 100644 --- a/src/router/modules/work.js +++ b/src/router/modules/work.js @@ -16,7 +16,7 @@ { path: '/toiletWork', name: 'ToiletWork', - component: () => import('@/views/toilet/listWork'), + component: () => import('@/views/toiletClean/toiletCleanList'), meta: { title: '作业管理', icon: 'function', permission: ['/toiletWork'] } } ] diff --git a/src/settings.js b/src/settings.js index b568ce0..b8159bf 100644 --- a/src/settings.js +++ b/src/settings.js @@ -3,7 +3,7 @@ * @type {boolean} true | false * @description 是否显示设置按钮 */ - showSettings: true, + showSettings: false, /** * @type {boolean} true | false diff --git a/src/store/modules/permission.js b/src/store/modules/permission.js index a0cb8cf..3ab50d5 100644 --- a/src/store/modules/permission.js +++ b/src/store/modules/permission.js @@ -120,17 +120,23 @@ }) }, // 获取用户权限 - GetMenus({ commit, state }) { - console.log('in store.permission.js:GetMenus:') + GetMenus({ commit, state }, currentSystem) { + // console.log('in store.permission.js:GetMenus:') + console.log('获取' + currentSystem.name + '的菜单') + const params = { + parentCode: currentSystem.code // 传入该子系统的code,获取子系统的权限 + } return new Promise((resolve, reject) => { - getMenus(state.token).then(response => { // 处理返回值 + // 此处获取用户所有权限 + getMenus(params).then(response => { // 处理返回值 const data = response.data const menus = [] // 仅菜单 const btns = [] // 非菜单 if (data.menus && data.menus.length > 0) { - commit('SET_MENUS', data.menus) - for (const menu of data.menus) { // 遍历菜单,获取所有的权限项 - if (menu.ismenu === '1') { // 将是菜单的放入menus + const allmenus = [...data.menus] + commit('SET_MENUS', allmenus) + for (const menu of allmenus) { // 遍历菜单,获取所有的权限项 + if (menu.resourceType === '02' || menu.resourceType === '03') { // 将是菜单的放入menus const menu_tmp = {} menu_tmp.url = menu.url menu_tmp.icon = menu.icon @@ -142,11 +148,11 @@ btn_tmp.name = menu.name btn_tmp.icon = menu.icon btns.push(btn_tmp) - // console.log(menu.url) } } // 过滤路由表 - const accessedRouters = filterAsyncRouter(asyncRouterMap, menus) + let accessedRouters = filterAsyncRouter(asyncRouterMap, menus) + // accessedRouters = filterRedirect(accessedRouters) commit('SET_BTNS', btns) commit('SET_ROUTERS', accessedRouters) resolve(response) diff --git a/src/utils/dateutils.js b/src/utils/dateutils.js index 868111a..5cd16af 100644 --- a/src/utils/dateutils.js +++ b/src/utils/dateutils.js @@ -15,15 +15,15 @@ return ct_month } -export function getLastWeek() { // 默认显示上周 +export function getLastWeek(fmt) { // 默认显示上周 const ct_month = new Date() ct_month.setTime(ct_month.getTime() - 3600 * 1000 * 24 * 7) - return ct_month + return ct_month.Format(fmt) } -export function getLastMonth() { // 默认显示上个月 +export function getLastMonth(fmt) { // 默认显示上个月 const ct_month = new Date() ct_month.setTime(ct_month.getTime() - 3600 * 1000 * 24 * 30) - return ct_month + return ct_month.Format(fmt) } // 对Date的扩展,将 Date 转化为指定格式的String diff --git a/src/utils/exportutils.js b/src/utils/exportutils.js new file mode 100644 index 0000000..b5d0bcf --- /dev/null +++ b/src/utils/exportutils.js @@ -0,0 +1,19 @@ +/** + * 导出文件工具 + * @param blob 文件 + * @param fileName 导出文件名 + */ +export function exportFile(blob, fileName) { + if (window.navigator && window.navigator.msSaveOrOpenBlob) { + navigator.msSaveBlob(blob, fileName) + } else { + const downloadElement = document.createElement('a') + const href = window.URL.createObjectURL(blob) // 创建下载的链接 + downloadElement.href = href + downloadElement.download = fileName + document.body.appendChild(downloadElement) + downloadElement.click() // 点击下载 + document.body.removeChild(downloadElement) // 下载完成移除元素 + window.URL.revokeObjectURL(href) // 释放blob对象 + } +} diff --git a/src/views/mapViews/mapView.vue b/src/views/mapViews/mapView.vue index feba3f6..a18db88 100644 --- a/src/views/mapViews/mapView.vue +++ b/src/views/mapViews/mapView.vue @@ -41,10 +41,7 @@ zoomOffset: 1 } }, - // mapurl: 'http://t1.tianditu.com/vec_w/wmts?layer=vec&style=default&tilematrixset=w&Service=WMTS&Request=GetTile&Version=1.0.0&Format=tiles&TileMatrix={z}&TileCol={x}&TileRow={y}&tk=adbdd8e08c292f6cb4e3f0289f7d0447', mapurl: this.baseConfig.mapUrl, - // mapurl: 'http://webrd01.is.autonavi.com/appmaptile?lang=zh_cn&size=1&scale=1&style=8&x={x}&y={y}&z={z}', - // labelurl: 'http://t1.tianditu.com/cva_w/wmts?layer=cva&style=default&tilematrixset=w&Service=WMTS&Request=GetTile&Version=1.0.0&Format=tiles&TileMatrix={z}&TileCol={x}&TileRow={y}&tk=adbdd8e08c292f6cb4e3f0289f7d0447' labelurl: this.baseConfig.labelUrl } }, diff --git a/src/views/overview/overview.vue b/src/views/overview/overview.vue index b356b46..9525867 100644 --- a/src/views/overview/overview.vue +++ b/src/views/overview/overview.vue @@ -1,30 +1,11 @@ @@ -32,13 +13,11 @@ import L from 'leaflet' import 'leaflet/dist/leaflet.css' import { getDetail } from '@/api/system/bridge' -// import icon from '/static/images/well/0100.png' -// import { getAllMarker } from '@/api/overview' -// import { getMarkerInfo } from '@/api/marker' -// import { lazyAMapApiLoaderInstance } from 'vue-amap' - +import LeafletMap from '@/components/mapWindow/leafletMap' +import ToiletLayer from './toiletLayer' export default { name: 'Overview', + components: { ToiletLayer, LeafletMap }, data() { return { baselayer: [], @@ -72,13 +51,15 @@ loading: false, icon: 'cross', map: null, - msg: 'Welcome to Your Vue.js App' } }, mounted() { - this.initMap() }, methods: { + // 地图加载完毕 + mapReady (map) { + this.map = map + }, initMap() { const map = L.map('map', { minZoom: 2, @@ -150,7 +131,7 @@ + + diff --git a/src/components/mapWindow/mapWindow.vue b/src/components/mapWindow/mapWindow.vue new file mode 100644 index 0000000..9ced291 --- /dev/null +++ b/src/components/mapWindow/mapWindow.vue @@ -0,0 +1,46 @@ + + + + + + diff --git a/src/permission.js b/src/permission.js index dc6b2f8..809ca86 100644 --- a/src/permission.js +++ b/src/permission.js @@ -25,8 +25,8 @@ store.dispatch('GetInfo').then(res => { // 拉取用户信息 // 设置当前子系统为基础资源子系统 const currentSys = { - code: 'baseResourse', - name: '基础资源子系统' + code: 'toliet', + name: '公共厕所管理系统' } // 将当前系统信息保存在localStorage中 store.commit('SET_SYSTEM', currentSys) diff --git a/src/router/index.js b/src/router/index.js index 431844b..d23076d 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -43,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 错误页面 diff --git a/src/router/modules/statistics.js b/src/router/modules/statistics.js index 442aa6f..fb9cbea 100644 --- a/src/router/modules/statistics.js +++ b/src/router/modules/statistics.js @@ -5,7 +5,7 @@ { path: 'statisticsToilet', component: Layout, - redirect: '/statisticsToilet', + redirect: '/workStatistics', name: 'StatisticsToilet', meta: { title: '作业统计', @@ -14,10 +14,16 @@ }, children: [ { - path: '/statistics', - name: 'Statistics', - component: () => import('@/views/statistics/workStatistics'), - meta: { title: '作业统计', icon: 'function', permission: ['/statisticsToilet'] } + path: '/workStatistics', + name: 'WorkStatistics', + component: () => import('@/views/statistics/toiletAssessment'), + meta: { title: '作业统计', icon: '', permission: ['/toilet/workStatistics'] } + }, + { + path: '/evaluationStatistics', + name: 'EvaluationStatistics', + component: () => import('@/views/statistics/evaluationAssessment'), + meta: { title: '评价统计', icon: '', permission: ['/toilet/evaluationStatistics'] } } ] } diff --git a/src/router/modules/toilet.js b/src/router/modules/toilet.js index e537ce9..b221a0e 100644 --- a/src/router/modules/toilet.js +++ b/src/router/modules/toilet.js @@ -16,7 +16,7 @@ { path: '/toiletList', name: 'ToiletList', - component: () => import('@/views/toilet/listToilet'), + component: () => import('@/views/toiletManage/toiletList'), meta: { title: '公厕台帐管理', icon: 'function', permission: ['/toiletList'] } }, { diff --git a/src/router/modules/work.js b/src/router/modules/work.js index 3725050..5e0759f 100644 --- a/src/router/modules/work.js +++ b/src/router/modules/work.js @@ -16,7 +16,7 @@ { path: '/toiletWork', name: 'ToiletWork', - component: () => import('@/views/toilet/listWork'), + component: () => import('@/views/toiletClean/toiletCleanList'), meta: { title: '作业管理', icon: 'function', permission: ['/toiletWork'] } } ] diff --git a/src/settings.js b/src/settings.js index b568ce0..b8159bf 100644 --- a/src/settings.js +++ b/src/settings.js @@ -3,7 +3,7 @@ * @type {boolean} true | false * @description 是否显示设置按钮 */ - showSettings: true, + showSettings: false, /** * @type {boolean} true | false diff --git a/src/store/modules/permission.js b/src/store/modules/permission.js index a0cb8cf..3ab50d5 100644 --- a/src/store/modules/permission.js +++ b/src/store/modules/permission.js @@ -120,17 +120,23 @@ }) }, // 获取用户权限 - GetMenus({ commit, state }) { - console.log('in store.permission.js:GetMenus:') + GetMenus({ commit, state }, currentSystem) { + // console.log('in store.permission.js:GetMenus:') + console.log('获取' + currentSystem.name + '的菜单') + const params = { + parentCode: currentSystem.code // 传入该子系统的code,获取子系统的权限 + } return new Promise((resolve, reject) => { - getMenus(state.token).then(response => { // 处理返回值 + // 此处获取用户所有权限 + getMenus(params).then(response => { // 处理返回值 const data = response.data const menus = [] // 仅菜单 const btns = [] // 非菜单 if (data.menus && data.menus.length > 0) { - commit('SET_MENUS', data.menus) - for (const menu of data.menus) { // 遍历菜单,获取所有的权限项 - if (menu.ismenu === '1') { // 将是菜单的放入menus + const allmenus = [...data.menus] + commit('SET_MENUS', allmenus) + for (const menu of allmenus) { // 遍历菜单,获取所有的权限项 + if (menu.resourceType === '02' || menu.resourceType === '03') { // 将是菜单的放入menus const menu_tmp = {} menu_tmp.url = menu.url menu_tmp.icon = menu.icon @@ -142,11 +148,11 @@ btn_tmp.name = menu.name btn_tmp.icon = menu.icon btns.push(btn_tmp) - // console.log(menu.url) } } // 过滤路由表 - const accessedRouters = filterAsyncRouter(asyncRouterMap, menus) + let accessedRouters = filterAsyncRouter(asyncRouterMap, menus) + // accessedRouters = filterRedirect(accessedRouters) commit('SET_BTNS', btns) commit('SET_ROUTERS', accessedRouters) resolve(response) diff --git a/src/utils/dateutils.js b/src/utils/dateutils.js index 868111a..5cd16af 100644 --- a/src/utils/dateutils.js +++ b/src/utils/dateutils.js @@ -15,15 +15,15 @@ return ct_month } -export function getLastWeek() { // 默认显示上周 +export function getLastWeek(fmt) { // 默认显示上周 const ct_month = new Date() ct_month.setTime(ct_month.getTime() - 3600 * 1000 * 24 * 7) - return ct_month + return ct_month.Format(fmt) } -export function getLastMonth() { // 默认显示上个月 +export function getLastMonth(fmt) { // 默认显示上个月 const ct_month = new Date() ct_month.setTime(ct_month.getTime() - 3600 * 1000 * 24 * 30) - return ct_month + return ct_month.Format(fmt) } // 对Date的扩展,将 Date 转化为指定格式的String diff --git a/src/utils/exportutils.js b/src/utils/exportutils.js new file mode 100644 index 0000000..b5d0bcf --- /dev/null +++ b/src/utils/exportutils.js @@ -0,0 +1,19 @@ +/** + * 导出文件工具 + * @param blob 文件 + * @param fileName 导出文件名 + */ +export function exportFile(blob, fileName) { + if (window.navigator && window.navigator.msSaveOrOpenBlob) { + navigator.msSaveBlob(blob, fileName) + } else { + const downloadElement = document.createElement('a') + const href = window.URL.createObjectURL(blob) // 创建下载的链接 + downloadElement.href = href + downloadElement.download = fileName + document.body.appendChild(downloadElement) + downloadElement.click() // 点击下载 + document.body.removeChild(downloadElement) // 下载完成移除元素 + window.URL.revokeObjectURL(href) // 释放blob对象 + } +} diff --git a/src/views/mapViews/mapView.vue b/src/views/mapViews/mapView.vue index feba3f6..a18db88 100644 --- a/src/views/mapViews/mapView.vue +++ b/src/views/mapViews/mapView.vue @@ -41,10 +41,7 @@ zoomOffset: 1 } }, - // mapurl: 'http://t1.tianditu.com/vec_w/wmts?layer=vec&style=default&tilematrixset=w&Service=WMTS&Request=GetTile&Version=1.0.0&Format=tiles&TileMatrix={z}&TileCol={x}&TileRow={y}&tk=adbdd8e08c292f6cb4e3f0289f7d0447', mapurl: this.baseConfig.mapUrl, - // mapurl: 'http://webrd01.is.autonavi.com/appmaptile?lang=zh_cn&size=1&scale=1&style=8&x={x}&y={y}&z={z}', - // labelurl: 'http://t1.tianditu.com/cva_w/wmts?layer=cva&style=default&tilematrixset=w&Service=WMTS&Request=GetTile&Version=1.0.0&Format=tiles&TileMatrix={z}&TileCol={x}&TileRow={y}&tk=adbdd8e08c292f6cb4e3f0289f7d0447' labelurl: this.baseConfig.labelUrl } }, diff --git a/src/views/overview/overview.vue b/src/views/overview/overview.vue index b356b46..9525867 100644 --- a/src/views/overview/overview.vue +++ b/src/views/overview/overview.vue @@ -1,30 +1,11 @@ @@ -32,13 +13,11 @@ import L from 'leaflet' import 'leaflet/dist/leaflet.css' import { getDetail } from '@/api/system/bridge' -// import icon from '/static/images/well/0100.png' -// import { getAllMarker } from '@/api/overview' -// import { getMarkerInfo } from '@/api/marker' -// import { lazyAMapApiLoaderInstance } from 'vue-amap' - +import LeafletMap from '@/components/mapWindow/leafletMap' +import ToiletLayer from './toiletLayer' export default { name: 'Overview', + components: { ToiletLayer, LeafletMap }, data() { return { baselayer: [], @@ -72,13 +51,15 @@ loading: false, icon: 'cross', map: null, - msg: 'Welcome to Your Vue.js App' } }, mounted() { - this.initMap() }, methods: { + // 地图加载完毕 + mapReady (map) { + this.map = map + }, initMap() { const map = L.map('map', { minZoom: 2, @@ -150,7 +131,7 @@ diff --git a/package.json b/package.json index f8c5e2a..9f3a3eb 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "echarts": "^4.2.1", "element-ui": "2.13.0", "event-source-polyfill": "^1.0.5", + "file-saver": "^2.0.5", "js-cookie": "2.2.0", "jsencrypt": "^3.0.0-rc.1", "leaflet": "^1.7.1", @@ -34,7 +35,8 @@ "vue-baidu-map": "^0.21.22", "vue-router": "3.0.1", "vue2-leaflet": "^2.7.0", - "vuex": "3.0.1" + "vuex": "3.0.1", + "xlsx": "^0.17.0" }, "devDependencies": { "autoprefixer": "8.5.0", diff --git a/src/api/sanitation/statistics.js b/src/api/sanitation/statistics.js new file mode 100644 index 0000000..2ca7549 --- /dev/null +++ b/src/api/sanitation/statistics.js @@ -0,0 +1,13 @@ + +/** + * 考核统计接口 + */ +import request from '@/utils/request' +// 公厕保洁次数统计 +export function getToiletJobCount(params) { + return request({ + url: '/sanitation/statistic/toilet/jobCount', + method: 'get', + params + }) +} diff --git a/src/api/sanitation/toilet.js b/src/api/sanitation/toilet.js new file mode 100644 index 0000000..10fd245 --- /dev/null +++ b/src/api/sanitation/toilet.js @@ -0,0 +1,97 @@ +/** + * 公厕管理接口 + */ +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 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/toilet.js b/src/api/system/toilet.js deleted file mode 100644 index 8f38b8f..0000000 --- a/src/api/system/toilet.js +++ /dev/null @@ -1,91 +0,0 @@ -/** - * 公厕管理接口 - */ -import request from '@/utils/request' -import qs from 'qs' -export function getToiletList(params) { - return request({ - url: '/sanitation/toilet/listPage', - method: 'get', - params - }) -} - -export function getDetail(id) { - return request({ - url: '/sanitation/toiletClean/detail', - method: 'get', - params: { - id: id - } - }) -} - -// 公厕查询 -export function getToiletAll() { - return request({ - url: '/sanitation/toilet/listPage', - method: 'get' - }) -} - -// 添加公厕 -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 exportRecords(params) { - return request({ - url: 'device/batchExport', - method: 'get', - timeout: 120000, - params, - 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/assets/global_images/toilet.png b/src/assets/global_images/toilet.png new file mode 100644 index 0000000..6d9fc05 --- /dev/null +++ b/src/assets/global_images/toilet.png Binary files differ diff --git a/src/components/NormalTable/index.vue b/src/components/NormalTable/index.vue index 5077bef..04d322d 100644 --- a/src/components/NormalTable/index.vue +++ b/src/components/NormalTable/index.vue @@ -79,7 +79,7 @@
-
+
Object.assign(obj, { [key]: this[key] }), {}), + on: events.reduce((obj, key) => Object.assign(obj, { [key]: this.transmitEvent }), {}) + }) + } + this.props = [...extraProps, ...props.filter(prop => exceptProps.indexOf(prop))] + } +} + +export default prop => new Mixin(prop) diff --git a/src/components/mapWindow/base/mixins/common.js b/src/components/mapWindow/base/mixins/common.js new file mode 100644 index 0000000..2fd1a28 --- /dev/null +++ b/src/components/mapWindow/base/mixins/common.js @@ -0,0 +1,82 @@ +const types = { + map: { + unload: 'clearMap' + }, + control: { + unload: 'removeControl' + }, + layer: { + unload: 'removeLayer' + }, + features: { + unload: 'removeFeatures' + }, + listener: { + unload: 'removeListener' + } +} + +const getParent = $component => ($component.abstract || $component.$el === $component.$children[0].$el) ? getParent($component.$parent) : $component + +function destroyInstance () { + const { unload, renderByParent, $parent } = this + if (renderByParent) { + $parent.reload() + } + unload() +} + +class Mixin { + constructor (prop) { + this.methods = { + ready () { + const $parent = getParent(this.$parent) + const map = this.map = $parent.map + this.load() + this.$emit('ready', { + map + }) + }, + transmitEvent (e) { + this.$emit(e.type.replace(/^on/, ''), e) + }, + reload () { + this && this.$nextTick(() => { + this.unload() + this.$nextTick(this.load) + }) + }, + unload () { + const { map, originInstance } = this + try { + switch (prop.type) { + case 'search': + return originInstance.clearResults() + case 'autoComplete': + case 'lushu': + return originInstance.dispose() + case 'markerClusterer': + return originInstance.clearMarkers() + default: + map[types[prop.type].unload](originInstance) + } + } catch (e) {} + } + } + this.computed = { + renderByParent () { + return this.$parent.preventChildrenRender + } + } + this.mounted = function () { + console.log('common mounted') + const $parent = getParent(this.$parent) + const map = $parent.map + const { ready } = this + console.log(map) + map ? ready() : $parent.$on('onload', ready) + } + } +} + +export default type => new Mixin({ type }) diff --git a/src/components/mapWindow/leafletMap.vue b/src/components/mapWindow/leafletMap.vue new file mode 100644 index 0000000..931a5e9 --- /dev/null +++ b/src/components/mapWindow/leafletMap.vue @@ -0,0 +1,132 @@ + + + + + + + diff --git a/src/components/mapWindow/mapWindow.vue b/src/components/mapWindow/mapWindow.vue new file mode 100644 index 0000000..9ced291 --- /dev/null +++ b/src/components/mapWindow/mapWindow.vue @@ -0,0 +1,46 @@ + + + + + + diff --git a/src/permission.js b/src/permission.js index dc6b2f8..809ca86 100644 --- a/src/permission.js +++ b/src/permission.js @@ -25,8 +25,8 @@ store.dispatch('GetInfo').then(res => { // 拉取用户信息 // 设置当前子系统为基础资源子系统 const currentSys = { - code: 'baseResourse', - name: '基础资源子系统' + code: 'toliet', + name: '公共厕所管理系统' } // 将当前系统信息保存在localStorage中 store.commit('SET_SYSTEM', currentSys) diff --git a/src/router/index.js b/src/router/index.js index 431844b..d23076d 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -43,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 错误页面 diff --git a/src/router/modules/statistics.js b/src/router/modules/statistics.js index 442aa6f..fb9cbea 100644 --- a/src/router/modules/statistics.js +++ b/src/router/modules/statistics.js @@ -5,7 +5,7 @@ { path: 'statisticsToilet', component: Layout, - redirect: '/statisticsToilet', + redirect: '/workStatistics', name: 'StatisticsToilet', meta: { title: '作业统计', @@ -14,10 +14,16 @@ }, children: [ { - path: '/statistics', - name: 'Statistics', - component: () => import('@/views/statistics/workStatistics'), - meta: { title: '作业统计', icon: 'function', permission: ['/statisticsToilet'] } + path: '/workStatistics', + name: 'WorkStatistics', + component: () => import('@/views/statistics/toiletAssessment'), + meta: { title: '作业统计', icon: '', permission: ['/toilet/workStatistics'] } + }, + { + path: '/evaluationStatistics', + name: 'EvaluationStatistics', + component: () => import('@/views/statistics/evaluationAssessment'), + meta: { title: '评价统计', icon: '', permission: ['/toilet/evaluationStatistics'] } } ] } diff --git a/src/router/modules/toilet.js b/src/router/modules/toilet.js index e537ce9..b221a0e 100644 --- a/src/router/modules/toilet.js +++ b/src/router/modules/toilet.js @@ -16,7 +16,7 @@ { path: '/toiletList', name: 'ToiletList', - component: () => import('@/views/toilet/listToilet'), + component: () => import('@/views/toiletManage/toiletList'), meta: { title: '公厕台帐管理', icon: 'function', permission: ['/toiletList'] } }, { diff --git a/src/router/modules/work.js b/src/router/modules/work.js index 3725050..5e0759f 100644 --- a/src/router/modules/work.js +++ b/src/router/modules/work.js @@ -16,7 +16,7 @@ { path: '/toiletWork', name: 'ToiletWork', - component: () => import('@/views/toilet/listWork'), + component: () => import('@/views/toiletClean/toiletCleanList'), meta: { title: '作业管理', icon: 'function', permission: ['/toiletWork'] } } ] diff --git a/src/settings.js b/src/settings.js index b568ce0..b8159bf 100644 --- a/src/settings.js +++ b/src/settings.js @@ -3,7 +3,7 @@ * @type {boolean} true | false * @description 是否显示设置按钮 */ - showSettings: true, + showSettings: false, /** * @type {boolean} true | false diff --git a/src/store/modules/permission.js b/src/store/modules/permission.js index a0cb8cf..3ab50d5 100644 --- a/src/store/modules/permission.js +++ b/src/store/modules/permission.js @@ -120,17 +120,23 @@ }) }, // 获取用户权限 - GetMenus({ commit, state }) { - console.log('in store.permission.js:GetMenus:') + GetMenus({ commit, state }, currentSystem) { + // console.log('in store.permission.js:GetMenus:') + console.log('获取' + currentSystem.name + '的菜单') + const params = { + parentCode: currentSystem.code // 传入该子系统的code,获取子系统的权限 + } return new Promise((resolve, reject) => { - getMenus(state.token).then(response => { // 处理返回值 + // 此处获取用户所有权限 + getMenus(params).then(response => { // 处理返回值 const data = response.data const menus = [] // 仅菜单 const btns = [] // 非菜单 if (data.menus && data.menus.length > 0) { - commit('SET_MENUS', data.menus) - for (const menu of data.menus) { // 遍历菜单,获取所有的权限项 - if (menu.ismenu === '1') { // 将是菜单的放入menus + const allmenus = [...data.menus] + commit('SET_MENUS', allmenus) + for (const menu of allmenus) { // 遍历菜单,获取所有的权限项 + if (menu.resourceType === '02' || menu.resourceType === '03') { // 将是菜单的放入menus const menu_tmp = {} menu_tmp.url = menu.url menu_tmp.icon = menu.icon @@ -142,11 +148,11 @@ btn_tmp.name = menu.name btn_tmp.icon = menu.icon btns.push(btn_tmp) - // console.log(menu.url) } } // 过滤路由表 - const accessedRouters = filterAsyncRouter(asyncRouterMap, menus) + let accessedRouters = filterAsyncRouter(asyncRouterMap, menus) + // accessedRouters = filterRedirect(accessedRouters) commit('SET_BTNS', btns) commit('SET_ROUTERS', accessedRouters) resolve(response) diff --git a/src/utils/dateutils.js b/src/utils/dateutils.js index 868111a..5cd16af 100644 --- a/src/utils/dateutils.js +++ b/src/utils/dateutils.js @@ -15,15 +15,15 @@ return ct_month } -export function getLastWeek() { // 默认显示上周 +export function getLastWeek(fmt) { // 默认显示上周 const ct_month = new Date() ct_month.setTime(ct_month.getTime() - 3600 * 1000 * 24 * 7) - return ct_month + return ct_month.Format(fmt) } -export function getLastMonth() { // 默认显示上个月 +export function getLastMonth(fmt) { // 默认显示上个月 const ct_month = new Date() ct_month.setTime(ct_month.getTime() - 3600 * 1000 * 24 * 30) - return ct_month + return ct_month.Format(fmt) } // 对Date的扩展,将 Date 转化为指定格式的String diff --git a/src/utils/exportutils.js b/src/utils/exportutils.js new file mode 100644 index 0000000..b5d0bcf --- /dev/null +++ b/src/utils/exportutils.js @@ -0,0 +1,19 @@ +/** + * 导出文件工具 + * @param blob 文件 + * @param fileName 导出文件名 + */ +export function exportFile(blob, fileName) { + if (window.navigator && window.navigator.msSaveOrOpenBlob) { + navigator.msSaveBlob(blob, fileName) + } else { + const downloadElement = document.createElement('a') + const href = window.URL.createObjectURL(blob) // 创建下载的链接 + downloadElement.href = href + downloadElement.download = fileName + document.body.appendChild(downloadElement) + downloadElement.click() // 点击下载 + document.body.removeChild(downloadElement) // 下载完成移除元素 + window.URL.revokeObjectURL(href) // 释放blob对象 + } +} diff --git a/src/views/mapViews/mapView.vue b/src/views/mapViews/mapView.vue index feba3f6..a18db88 100644 --- a/src/views/mapViews/mapView.vue +++ b/src/views/mapViews/mapView.vue @@ -41,10 +41,7 @@ zoomOffset: 1 } }, - // mapurl: 'http://t1.tianditu.com/vec_w/wmts?layer=vec&style=default&tilematrixset=w&Service=WMTS&Request=GetTile&Version=1.0.0&Format=tiles&TileMatrix={z}&TileCol={x}&TileRow={y}&tk=adbdd8e08c292f6cb4e3f0289f7d0447', mapurl: this.baseConfig.mapUrl, - // mapurl: 'http://webrd01.is.autonavi.com/appmaptile?lang=zh_cn&size=1&scale=1&style=8&x={x}&y={y}&z={z}', - // labelurl: 'http://t1.tianditu.com/cva_w/wmts?layer=cva&style=default&tilematrixset=w&Service=WMTS&Request=GetTile&Version=1.0.0&Format=tiles&TileMatrix={z}&TileCol={x}&TileRow={y}&tk=adbdd8e08c292f6cb4e3f0289f7d0447' labelurl: this.baseConfig.labelUrl } }, diff --git a/src/views/overview/overview.vue b/src/views/overview/overview.vue index b356b46..9525867 100644 --- a/src/views/overview/overview.vue +++ b/src/views/overview/overview.vue @@ -1,30 +1,11 @@ @@ -32,13 +13,11 @@ import L from 'leaflet' import 'leaflet/dist/leaflet.css' import { getDetail } from '@/api/system/bridge' -// import icon from '/static/images/well/0100.png' -// import { getAllMarker } from '@/api/overview' -// import { getMarkerInfo } from '@/api/marker' -// import { lazyAMapApiLoaderInstance } from 'vue-amap' - +import LeafletMap from '@/components/mapWindow/leafletMap' +import ToiletLayer from './toiletLayer' export default { name: 'Overview', + components: { ToiletLayer, LeafletMap }, data() { return { baselayer: [], @@ -72,13 +51,15 @@ loading: false, icon: 'cross', map: null, - msg: 'Welcome to Your Vue.js App' } }, mounted() { - this.initMap() }, methods: { + // 地图加载完毕 + mapReady (map) { + this.map = map + }, initMap() { const map = L.map('map', { minZoom: 2, @@ -150,7 +131,7 @@ diff --git a/src/views/statistics/components/evaluationListDialog.vue b/src/views/statistics/components/evaluationListDialog.vue new file mode 100644 index 0000000..15a9c2f --- /dev/null +++ b/src/views/statistics/components/evaluationListDialog.vue @@ -0,0 +1,120 @@ + + + + + + diff --git a/package.json b/package.json index f8c5e2a..9f3a3eb 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "echarts": "^4.2.1", "element-ui": "2.13.0", "event-source-polyfill": "^1.0.5", + "file-saver": "^2.0.5", "js-cookie": "2.2.0", "jsencrypt": "^3.0.0-rc.1", "leaflet": "^1.7.1", @@ -34,7 +35,8 @@ "vue-baidu-map": "^0.21.22", "vue-router": "3.0.1", "vue2-leaflet": "^2.7.0", - "vuex": "3.0.1" + "vuex": "3.0.1", + "xlsx": "^0.17.0" }, "devDependencies": { "autoprefixer": "8.5.0", diff --git a/src/api/sanitation/statistics.js b/src/api/sanitation/statistics.js new file mode 100644 index 0000000..2ca7549 --- /dev/null +++ b/src/api/sanitation/statistics.js @@ -0,0 +1,13 @@ + +/** + * 考核统计接口 + */ +import request from '@/utils/request' +// 公厕保洁次数统计 +export function getToiletJobCount(params) { + return request({ + url: '/sanitation/statistic/toilet/jobCount', + method: 'get', + params + }) +} diff --git a/src/api/sanitation/toilet.js b/src/api/sanitation/toilet.js new file mode 100644 index 0000000..10fd245 --- /dev/null +++ b/src/api/sanitation/toilet.js @@ -0,0 +1,97 @@ +/** + * 公厕管理接口 + */ +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 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/toilet.js b/src/api/system/toilet.js deleted file mode 100644 index 8f38b8f..0000000 --- a/src/api/system/toilet.js +++ /dev/null @@ -1,91 +0,0 @@ -/** - * 公厕管理接口 - */ -import request from '@/utils/request' -import qs from 'qs' -export function getToiletList(params) { - return request({ - url: '/sanitation/toilet/listPage', - method: 'get', - params - }) -} - -export function getDetail(id) { - return request({ - url: '/sanitation/toiletClean/detail', - method: 'get', - params: { - id: id - } - }) -} - -// 公厕查询 -export function getToiletAll() { - return request({ - url: '/sanitation/toilet/listPage', - method: 'get' - }) -} - -// 添加公厕 -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 exportRecords(params) { - return request({ - url: 'device/batchExport', - method: 'get', - timeout: 120000, - params, - 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/assets/global_images/toilet.png b/src/assets/global_images/toilet.png new file mode 100644 index 0000000..6d9fc05 --- /dev/null +++ b/src/assets/global_images/toilet.png Binary files differ diff --git a/src/components/NormalTable/index.vue b/src/components/NormalTable/index.vue index 5077bef..04d322d 100644 --- a/src/components/NormalTable/index.vue +++ b/src/components/NormalTable/index.vue @@ -79,7 +79,7 @@
-
+
Object.assign(obj, { [key]: this[key] }), {}), + on: events.reduce((obj, key) => Object.assign(obj, { [key]: this.transmitEvent }), {}) + }) + } + this.props = [...extraProps, ...props.filter(prop => exceptProps.indexOf(prop))] + } +} + +export default prop => new Mixin(prop) diff --git a/src/components/mapWindow/base/mixins/common.js b/src/components/mapWindow/base/mixins/common.js new file mode 100644 index 0000000..2fd1a28 --- /dev/null +++ b/src/components/mapWindow/base/mixins/common.js @@ -0,0 +1,82 @@ +const types = { + map: { + unload: 'clearMap' + }, + control: { + unload: 'removeControl' + }, + layer: { + unload: 'removeLayer' + }, + features: { + unload: 'removeFeatures' + }, + listener: { + unload: 'removeListener' + } +} + +const getParent = $component => ($component.abstract || $component.$el === $component.$children[0].$el) ? getParent($component.$parent) : $component + +function destroyInstance () { + const { unload, renderByParent, $parent } = this + if (renderByParent) { + $parent.reload() + } + unload() +} + +class Mixin { + constructor (prop) { + this.methods = { + ready () { + const $parent = getParent(this.$parent) + const map = this.map = $parent.map + this.load() + this.$emit('ready', { + map + }) + }, + transmitEvent (e) { + this.$emit(e.type.replace(/^on/, ''), e) + }, + reload () { + this && this.$nextTick(() => { + this.unload() + this.$nextTick(this.load) + }) + }, + unload () { + const { map, originInstance } = this + try { + switch (prop.type) { + case 'search': + return originInstance.clearResults() + case 'autoComplete': + case 'lushu': + return originInstance.dispose() + case 'markerClusterer': + return originInstance.clearMarkers() + default: + map[types[prop.type].unload](originInstance) + } + } catch (e) {} + } + } + this.computed = { + renderByParent () { + return this.$parent.preventChildrenRender + } + } + this.mounted = function () { + console.log('common mounted') + const $parent = getParent(this.$parent) + const map = $parent.map + const { ready } = this + console.log(map) + map ? ready() : $parent.$on('onload', ready) + } + } +} + +export default type => new Mixin({ type }) diff --git a/src/components/mapWindow/leafletMap.vue b/src/components/mapWindow/leafletMap.vue new file mode 100644 index 0000000..931a5e9 --- /dev/null +++ b/src/components/mapWindow/leafletMap.vue @@ -0,0 +1,132 @@ + + + + + + + diff --git a/src/components/mapWindow/mapWindow.vue b/src/components/mapWindow/mapWindow.vue new file mode 100644 index 0000000..9ced291 --- /dev/null +++ b/src/components/mapWindow/mapWindow.vue @@ -0,0 +1,46 @@ + + + + + + diff --git a/src/permission.js b/src/permission.js index dc6b2f8..809ca86 100644 --- a/src/permission.js +++ b/src/permission.js @@ -25,8 +25,8 @@ store.dispatch('GetInfo').then(res => { // 拉取用户信息 // 设置当前子系统为基础资源子系统 const currentSys = { - code: 'baseResourse', - name: '基础资源子系统' + code: 'toliet', + name: '公共厕所管理系统' } // 将当前系统信息保存在localStorage中 store.commit('SET_SYSTEM', currentSys) diff --git a/src/router/index.js b/src/router/index.js index 431844b..d23076d 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -43,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 错误页面 diff --git a/src/router/modules/statistics.js b/src/router/modules/statistics.js index 442aa6f..fb9cbea 100644 --- a/src/router/modules/statistics.js +++ b/src/router/modules/statistics.js @@ -5,7 +5,7 @@ { path: 'statisticsToilet', component: Layout, - redirect: '/statisticsToilet', + redirect: '/workStatistics', name: 'StatisticsToilet', meta: { title: '作业统计', @@ -14,10 +14,16 @@ }, children: [ { - path: '/statistics', - name: 'Statistics', - component: () => import('@/views/statistics/workStatistics'), - meta: { title: '作业统计', icon: 'function', permission: ['/statisticsToilet'] } + path: '/workStatistics', + name: 'WorkStatistics', + component: () => import('@/views/statistics/toiletAssessment'), + meta: { title: '作业统计', icon: '', permission: ['/toilet/workStatistics'] } + }, + { + path: '/evaluationStatistics', + name: 'EvaluationStatistics', + component: () => import('@/views/statistics/evaluationAssessment'), + meta: { title: '评价统计', icon: '', permission: ['/toilet/evaluationStatistics'] } } ] } diff --git a/src/router/modules/toilet.js b/src/router/modules/toilet.js index e537ce9..b221a0e 100644 --- a/src/router/modules/toilet.js +++ b/src/router/modules/toilet.js @@ -16,7 +16,7 @@ { path: '/toiletList', name: 'ToiletList', - component: () => import('@/views/toilet/listToilet'), + component: () => import('@/views/toiletManage/toiletList'), meta: { title: '公厕台帐管理', icon: 'function', permission: ['/toiletList'] } }, { diff --git a/src/router/modules/work.js b/src/router/modules/work.js index 3725050..5e0759f 100644 --- a/src/router/modules/work.js +++ b/src/router/modules/work.js @@ -16,7 +16,7 @@ { path: '/toiletWork', name: 'ToiletWork', - component: () => import('@/views/toilet/listWork'), + component: () => import('@/views/toiletClean/toiletCleanList'), meta: { title: '作业管理', icon: 'function', permission: ['/toiletWork'] } } ] diff --git a/src/settings.js b/src/settings.js index b568ce0..b8159bf 100644 --- a/src/settings.js +++ b/src/settings.js @@ -3,7 +3,7 @@ * @type {boolean} true | false * @description 是否显示设置按钮 */ - showSettings: true, + showSettings: false, /** * @type {boolean} true | false diff --git a/src/store/modules/permission.js b/src/store/modules/permission.js index a0cb8cf..3ab50d5 100644 --- a/src/store/modules/permission.js +++ b/src/store/modules/permission.js @@ -120,17 +120,23 @@ }) }, // 获取用户权限 - GetMenus({ commit, state }) { - console.log('in store.permission.js:GetMenus:') + GetMenus({ commit, state }, currentSystem) { + // console.log('in store.permission.js:GetMenus:') + console.log('获取' + currentSystem.name + '的菜单') + const params = { + parentCode: currentSystem.code // 传入该子系统的code,获取子系统的权限 + } return new Promise((resolve, reject) => { - getMenus(state.token).then(response => { // 处理返回值 + // 此处获取用户所有权限 + getMenus(params).then(response => { // 处理返回值 const data = response.data const menus = [] // 仅菜单 const btns = [] // 非菜单 if (data.menus && data.menus.length > 0) { - commit('SET_MENUS', data.menus) - for (const menu of data.menus) { // 遍历菜单,获取所有的权限项 - if (menu.ismenu === '1') { // 将是菜单的放入menus + const allmenus = [...data.menus] + commit('SET_MENUS', allmenus) + for (const menu of allmenus) { // 遍历菜单,获取所有的权限项 + if (menu.resourceType === '02' || menu.resourceType === '03') { // 将是菜单的放入menus const menu_tmp = {} menu_tmp.url = menu.url menu_tmp.icon = menu.icon @@ -142,11 +148,11 @@ btn_tmp.name = menu.name btn_tmp.icon = menu.icon btns.push(btn_tmp) - // console.log(menu.url) } } // 过滤路由表 - const accessedRouters = filterAsyncRouter(asyncRouterMap, menus) + let accessedRouters = filterAsyncRouter(asyncRouterMap, menus) + // accessedRouters = filterRedirect(accessedRouters) commit('SET_BTNS', btns) commit('SET_ROUTERS', accessedRouters) resolve(response) diff --git a/src/utils/dateutils.js b/src/utils/dateutils.js index 868111a..5cd16af 100644 --- a/src/utils/dateutils.js +++ b/src/utils/dateutils.js @@ -15,15 +15,15 @@ return ct_month } -export function getLastWeek() { // 默认显示上周 +export function getLastWeek(fmt) { // 默认显示上周 const ct_month = new Date() ct_month.setTime(ct_month.getTime() - 3600 * 1000 * 24 * 7) - return ct_month + return ct_month.Format(fmt) } -export function getLastMonth() { // 默认显示上个月 +export function getLastMonth(fmt) { // 默认显示上个月 const ct_month = new Date() ct_month.setTime(ct_month.getTime() - 3600 * 1000 * 24 * 30) - return ct_month + return ct_month.Format(fmt) } // 对Date的扩展,将 Date 转化为指定格式的String diff --git a/src/utils/exportutils.js b/src/utils/exportutils.js new file mode 100644 index 0000000..b5d0bcf --- /dev/null +++ b/src/utils/exportutils.js @@ -0,0 +1,19 @@ +/** + * 导出文件工具 + * @param blob 文件 + * @param fileName 导出文件名 + */ +export function exportFile(blob, fileName) { + if (window.navigator && window.navigator.msSaveOrOpenBlob) { + navigator.msSaveBlob(blob, fileName) + } else { + const downloadElement = document.createElement('a') + const href = window.URL.createObjectURL(blob) // 创建下载的链接 + downloadElement.href = href + downloadElement.download = fileName + document.body.appendChild(downloadElement) + downloadElement.click() // 点击下载 + document.body.removeChild(downloadElement) // 下载完成移除元素 + window.URL.revokeObjectURL(href) // 释放blob对象 + } +} diff --git a/src/views/mapViews/mapView.vue b/src/views/mapViews/mapView.vue index feba3f6..a18db88 100644 --- a/src/views/mapViews/mapView.vue +++ b/src/views/mapViews/mapView.vue @@ -41,10 +41,7 @@ zoomOffset: 1 } }, - // mapurl: 'http://t1.tianditu.com/vec_w/wmts?layer=vec&style=default&tilematrixset=w&Service=WMTS&Request=GetTile&Version=1.0.0&Format=tiles&TileMatrix={z}&TileCol={x}&TileRow={y}&tk=adbdd8e08c292f6cb4e3f0289f7d0447', mapurl: this.baseConfig.mapUrl, - // mapurl: 'http://webrd01.is.autonavi.com/appmaptile?lang=zh_cn&size=1&scale=1&style=8&x={x}&y={y}&z={z}', - // labelurl: 'http://t1.tianditu.com/cva_w/wmts?layer=cva&style=default&tilematrixset=w&Service=WMTS&Request=GetTile&Version=1.0.0&Format=tiles&TileMatrix={z}&TileCol={x}&TileRow={y}&tk=adbdd8e08c292f6cb4e3f0289f7d0447' labelurl: this.baseConfig.labelUrl } }, diff --git a/src/views/overview/overview.vue b/src/views/overview/overview.vue index b356b46..9525867 100644 --- a/src/views/overview/overview.vue +++ b/src/views/overview/overview.vue @@ -1,30 +1,11 @@ @@ -32,13 +13,11 @@ import L from 'leaflet' import 'leaflet/dist/leaflet.css' import { getDetail } from '@/api/system/bridge' -// import icon from '/static/images/well/0100.png' -// import { getAllMarker } from '@/api/overview' -// import { getMarkerInfo } from '@/api/marker' -// import { lazyAMapApiLoaderInstance } from 'vue-amap' - +import LeafletMap from '@/components/mapWindow/leafletMap' +import ToiletLayer from './toiletLayer' export default { name: 'Overview', + components: { ToiletLayer, LeafletMap }, data() { return { baselayer: [], @@ -72,13 +51,15 @@ loading: false, icon: 'cross', map: null, - msg: 'Welcome to Your Vue.js App' } }, mounted() { - this.initMap() }, methods: { + // 地图加载完毕 + mapReady (map) { + this.map = map + }, initMap() { const map = L.map('map', { minZoom: 2, @@ -150,7 +131,7 @@ diff --git a/src/views/statistics/components/evaluationListDialog.vue b/src/views/statistics/components/evaluationListDialog.vue new file mode 100644 index 0000000..15a9c2f --- /dev/null +++ b/src/views/statistics/components/evaluationListDialog.vue @@ -0,0 +1,120 @@ + + + + + + diff --git a/src/views/statistics/components/workChart.vue b/src/views/statistics/components/workChart.vue new file mode 100644 index 0000000..a891e0c --- /dev/null +++ b/src/views/statistics/components/workChart.vue @@ -0,0 +1,79 @@ + + + + + diff --git a/package.json b/package.json index f8c5e2a..9f3a3eb 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "echarts": "^4.2.1", "element-ui": "2.13.0", "event-source-polyfill": "^1.0.5", + "file-saver": "^2.0.5", "js-cookie": "2.2.0", "jsencrypt": "^3.0.0-rc.1", "leaflet": "^1.7.1", @@ -34,7 +35,8 @@ "vue-baidu-map": "^0.21.22", "vue-router": "3.0.1", "vue2-leaflet": "^2.7.0", - "vuex": "3.0.1" + "vuex": "3.0.1", + "xlsx": "^0.17.0" }, "devDependencies": { "autoprefixer": "8.5.0", diff --git a/src/api/sanitation/statistics.js b/src/api/sanitation/statistics.js new file mode 100644 index 0000000..2ca7549 --- /dev/null +++ b/src/api/sanitation/statistics.js @@ -0,0 +1,13 @@ + +/** + * 考核统计接口 + */ +import request from '@/utils/request' +// 公厕保洁次数统计 +export function getToiletJobCount(params) { + return request({ + url: '/sanitation/statistic/toilet/jobCount', + method: 'get', + params + }) +} diff --git a/src/api/sanitation/toilet.js b/src/api/sanitation/toilet.js new file mode 100644 index 0000000..10fd245 --- /dev/null +++ b/src/api/sanitation/toilet.js @@ -0,0 +1,97 @@ +/** + * 公厕管理接口 + */ +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 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/toilet.js b/src/api/system/toilet.js deleted file mode 100644 index 8f38b8f..0000000 --- a/src/api/system/toilet.js +++ /dev/null @@ -1,91 +0,0 @@ -/** - * 公厕管理接口 - */ -import request from '@/utils/request' -import qs from 'qs' -export function getToiletList(params) { - return request({ - url: '/sanitation/toilet/listPage', - method: 'get', - params - }) -} - -export function getDetail(id) { - return request({ - url: '/sanitation/toiletClean/detail', - method: 'get', - params: { - id: id - } - }) -} - -// 公厕查询 -export function getToiletAll() { - return request({ - url: '/sanitation/toilet/listPage', - method: 'get' - }) -} - -// 添加公厕 -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 exportRecords(params) { - return request({ - url: 'device/batchExport', - method: 'get', - timeout: 120000, - params, - 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/assets/global_images/toilet.png b/src/assets/global_images/toilet.png new file mode 100644 index 0000000..6d9fc05 --- /dev/null +++ b/src/assets/global_images/toilet.png Binary files differ diff --git a/src/components/NormalTable/index.vue b/src/components/NormalTable/index.vue index 5077bef..04d322d 100644 --- a/src/components/NormalTable/index.vue +++ b/src/components/NormalTable/index.vue @@ -79,7 +79,7 @@
-
+
Object.assign(obj, { [key]: this[key] }), {}), + on: events.reduce((obj, key) => Object.assign(obj, { [key]: this.transmitEvent }), {}) + }) + } + this.props = [...extraProps, ...props.filter(prop => exceptProps.indexOf(prop))] + } +} + +export default prop => new Mixin(prop) diff --git a/src/components/mapWindow/base/mixins/common.js b/src/components/mapWindow/base/mixins/common.js new file mode 100644 index 0000000..2fd1a28 --- /dev/null +++ b/src/components/mapWindow/base/mixins/common.js @@ -0,0 +1,82 @@ +const types = { + map: { + unload: 'clearMap' + }, + control: { + unload: 'removeControl' + }, + layer: { + unload: 'removeLayer' + }, + features: { + unload: 'removeFeatures' + }, + listener: { + unload: 'removeListener' + } +} + +const getParent = $component => ($component.abstract || $component.$el === $component.$children[0].$el) ? getParent($component.$parent) : $component + +function destroyInstance () { + const { unload, renderByParent, $parent } = this + if (renderByParent) { + $parent.reload() + } + unload() +} + +class Mixin { + constructor (prop) { + this.methods = { + ready () { + const $parent = getParent(this.$parent) + const map = this.map = $parent.map + this.load() + this.$emit('ready', { + map + }) + }, + transmitEvent (e) { + this.$emit(e.type.replace(/^on/, ''), e) + }, + reload () { + this && this.$nextTick(() => { + this.unload() + this.$nextTick(this.load) + }) + }, + unload () { + const { map, originInstance } = this + try { + switch (prop.type) { + case 'search': + return originInstance.clearResults() + case 'autoComplete': + case 'lushu': + return originInstance.dispose() + case 'markerClusterer': + return originInstance.clearMarkers() + default: + map[types[prop.type].unload](originInstance) + } + } catch (e) {} + } + } + this.computed = { + renderByParent () { + return this.$parent.preventChildrenRender + } + } + this.mounted = function () { + console.log('common mounted') + const $parent = getParent(this.$parent) + const map = $parent.map + const { ready } = this + console.log(map) + map ? ready() : $parent.$on('onload', ready) + } + } +} + +export default type => new Mixin({ type }) diff --git a/src/components/mapWindow/leafletMap.vue b/src/components/mapWindow/leafletMap.vue new file mode 100644 index 0000000..931a5e9 --- /dev/null +++ b/src/components/mapWindow/leafletMap.vue @@ -0,0 +1,132 @@ + + + + + + + diff --git a/src/components/mapWindow/mapWindow.vue b/src/components/mapWindow/mapWindow.vue new file mode 100644 index 0000000..9ced291 --- /dev/null +++ b/src/components/mapWindow/mapWindow.vue @@ -0,0 +1,46 @@ + + + + + + diff --git a/src/permission.js b/src/permission.js index dc6b2f8..809ca86 100644 --- a/src/permission.js +++ b/src/permission.js @@ -25,8 +25,8 @@ store.dispatch('GetInfo').then(res => { // 拉取用户信息 // 设置当前子系统为基础资源子系统 const currentSys = { - code: 'baseResourse', - name: '基础资源子系统' + code: 'toliet', + name: '公共厕所管理系统' } // 将当前系统信息保存在localStorage中 store.commit('SET_SYSTEM', currentSys) diff --git a/src/router/index.js b/src/router/index.js index 431844b..d23076d 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -43,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 错误页面 diff --git a/src/router/modules/statistics.js b/src/router/modules/statistics.js index 442aa6f..fb9cbea 100644 --- a/src/router/modules/statistics.js +++ b/src/router/modules/statistics.js @@ -5,7 +5,7 @@ { path: 'statisticsToilet', component: Layout, - redirect: '/statisticsToilet', + redirect: '/workStatistics', name: 'StatisticsToilet', meta: { title: '作业统计', @@ -14,10 +14,16 @@ }, children: [ { - path: '/statistics', - name: 'Statistics', - component: () => import('@/views/statistics/workStatistics'), - meta: { title: '作业统计', icon: 'function', permission: ['/statisticsToilet'] } + path: '/workStatistics', + name: 'WorkStatistics', + component: () => import('@/views/statistics/toiletAssessment'), + meta: { title: '作业统计', icon: '', permission: ['/toilet/workStatistics'] } + }, + { + path: '/evaluationStatistics', + name: 'EvaluationStatistics', + component: () => import('@/views/statistics/evaluationAssessment'), + meta: { title: '评价统计', icon: '', permission: ['/toilet/evaluationStatistics'] } } ] } diff --git a/src/router/modules/toilet.js b/src/router/modules/toilet.js index e537ce9..b221a0e 100644 --- a/src/router/modules/toilet.js +++ b/src/router/modules/toilet.js @@ -16,7 +16,7 @@ { path: '/toiletList', name: 'ToiletList', - component: () => import('@/views/toilet/listToilet'), + component: () => import('@/views/toiletManage/toiletList'), meta: { title: '公厕台帐管理', icon: 'function', permission: ['/toiletList'] } }, { diff --git a/src/router/modules/work.js b/src/router/modules/work.js index 3725050..5e0759f 100644 --- a/src/router/modules/work.js +++ b/src/router/modules/work.js @@ -16,7 +16,7 @@ { path: '/toiletWork', name: 'ToiletWork', - component: () => import('@/views/toilet/listWork'), + component: () => import('@/views/toiletClean/toiletCleanList'), meta: { title: '作业管理', icon: 'function', permission: ['/toiletWork'] } } ] diff --git a/src/settings.js b/src/settings.js index b568ce0..b8159bf 100644 --- a/src/settings.js +++ b/src/settings.js @@ -3,7 +3,7 @@ * @type {boolean} true | false * @description 是否显示设置按钮 */ - showSettings: true, + showSettings: false, /** * @type {boolean} true | false diff --git a/src/store/modules/permission.js b/src/store/modules/permission.js index a0cb8cf..3ab50d5 100644 --- a/src/store/modules/permission.js +++ b/src/store/modules/permission.js @@ -120,17 +120,23 @@ }) }, // 获取用户权限 - GetMenus({ commit, state }) { - console.log('in store.permission.js:GetMenus:') + GetMenus({ commit, state }, currentSystem) { + // console.log('in store.permission.js:GetMenus:') + console.log('获取' + currentSystem.name + '的菜单') + const params = { + parentCode: currentSystem.code // 传入该子系统的code,获取子系统的权限 + } return new Promise((resolve, reject) => { - getMenus(state.token).then(response => { // 处理返回值 + // 此处获取用户所有权限 + getMenus(params).then(response => { // 处理返回值 const data = response.data const menus = [] // 仅菜单 const btns = [] // 非菜单 if (data.menus && data.menus.length > 0) { - commit('SET_MENUS', data.menus) - for (const menu of data.menus) { // 遍历菜单,获取所有的权限项 - if (menu.ismenu === '1') { // 将是菜单的放入menus + const allmenus = [...data.menus] + commit('SET_MENUS', allmenus) + for (const menu of allmenus) { // 遍历菜单,获取所有的权限项 + if (menu.resourceType === '02' || menu.resourceType === '03') { // 将是菜单的放入menus const menu_tmp = {} menu_tmp.url = menu.url menu_tmp.icon = menu.icon @@ -142,11 +148,11 @@ btn_tmp.name = menu.name btn_tmp.icon = menu.icon btns.push(btn_tmp) - // console.log(menu.url) } } // 过滤路由表 - const accessedRouters = filterAsyncRouter(asyncRouterMap, menus) + let accessedRouters = filterAsyncRouter(asyncRouterMap, menus) + // accessedRouters = filterRedirect(accessedRouters) commit('SET_BTNS', btns) commit('SET_ROUTERS', accessedRouters) resolve(response) diff --git a/src/utils/dateutils.js b/src/utils/dateutils.js index 868111a..5cd16af 100644 --- a/src/utils/dateutils.js +++ b/src/utils/dateutils.js @@ -15,15 +15,15 @@ return ct_month } -export function getLastWeek() { // 默认显示上周 +export function getLastWeek(fmt) { // 默认显示上周 const ct_month = new Date() ct_month.setTime(ct_month.getTime() - 3600 * 1000 * 24 * 7) - return ct_month + return ct_month.Format(fmt) } -export function getLastMonth() { // 默认显示上个月 +export function getLastMonth(fmt) { // 默认显示上个月 const ct_month = new Date() ct_month.setTime(ct_month.getTime() - 3600 * 1000 * 24 * 30) - return ct_month + return ct_month.Format(fmt) } // 对Date的扩展,将 Date 转化为指定格式的String diff --git a/src/utils/exportutils.js b/src/utils/exportutils.js new file mode 100644 index 0000000..b5d0bcf --- /dev/null +++ b/src/utils/exportutils.js @@ -0,0 +1,19 @@ +/** + * 导出文件工具 + * @param blob 文件 + * @param fileName 导出文件名 + */ +export function exportFile(blob, fileName) { + if (window.navigator && window.navigator.msSaveOrOpenBlob) { + navigator.msSaveBlob(blob, fileName) + } else { + const downloadElement = document.createElement('a') + const href = window.URL.createObjectURL(blob) // 创建下载的链接 + downloadElement.href = href + downloadElement.download = fileName + document.body.appendChild(downloadElement) + downloadElement.click() // 点击下载 + document.body.removeChild(downloadElement) // 下载完成移除元素 + window.URL.revokeObjectURL(href) // 释放blob对象 + } +} diff --git a/src/views/mapViews/mapView.vue b/src/views/mapViews/mapView.vue index feba3f6..a18db88 100644 --- a/src/views/mapViews/mapView.vue +++ b/src/views/mapViews/mapView.vue @@ -41,10 +41,7 @@ zoomOffset: 1 } }, - // mapurl: 'http://t1.tianditu.com/vec_w/wmts?layer=vec&style=default&tilematrixset=w&Service=WMTS&Request=GetTile&Version=1.0.0&Format=tiles&TileMatrix={z}&TileCol={x}&TileRow={y}&tk=adbdd8e08c292f6cb4e3f0289f7d0447', mapurl: this.baseConfig.mapUrl, - // mapurl: 'http://webrd01.is.autonavi.com/appmaptile?lang=zh_cn&size=1&scale=1&style=8&x={x}&y={y}&z={z}', - // labelurl: 'http://t1.tianditu.com/cva_w/wmts?layer=cva&style=default&tilematrixset=w&Service=WMTS&Request=GetTile&Version=1.0.0&Format=tiles&TileMatrix={z}&TileCol={x}&TileRow={y}&tk=adbdd8e08c292f6cb4e3f0289f7d0447' labelurl: this.baseConfig.labelUrl } }, diff --git a/src/views/overview/overview.vue b/src/views/overview/overview.vue index b356b46..9525867 100644 --- a/src/views/overview/overview.vue +++ b/src/views/overview/overview.vue @@ -1,30 +1,11 @@ @@ -32,13 +13,11 @@ import L from 'leaflet' import 'leaflet/dist/leaflet.css' import { getDetail } from '@/api/system/bridge' -// import icon from '/static/images/well/0100.png' -// import { getAllMarker } from '@/api/overview' -// import { getMarkerInfo } from '@/api/marker' -// import { lazyAMapApiLoaderInstance } from 'vue-amap' - +import LeafletMap from '@/components/mapWindow/leafletMap' +import ToiletLayer from './toiletLayer' export default { name: 'Overview', + components: { ToiletLayer, LeafletMap }, data() { return { baselayer: [], @@ -72,13 +51,15 @@ loading: false, icon: 'cross', map: null, - msg: 'Welcome to Your Vue.js App' } }, mounted() { - this.initMap() }, methods: { + // 地图加载完毕 + mapReady (map) { + this.map = map + }, initMap() { const map = L.map('map', { minZoom: 2, @@ -150,7 +131,7 @@ diff --git a/src/views/statistics/components/evaluationListDialog.vue b/src/views/statistics/components/evaluationListDialog.vue new file mode 100644 index 0000000..15a9c2f --- /dev/null +++ b/src/views/statistics/components/evaluationListDialog.vue @@ -0,0 +1,120 @@ + + + + + + diff --git a/src/views/statistics/components/workChart.vue b/src/views/statistics/components/workChart.vue new file mode 100644 index 0000000..a891e0c --- /dev/null +++ b/src/views/statistics/components/workChart.vue @@ -0,0 +1,79 @@ + + + + + diff --git a/src/views/statistics/evaluationAssessment.vue b/src/views/statistics/evaluationAssessment.vue new file mode 100644 index 0000000..2193f0e --- /dev/null +++ b/src/views/statistics/evaluationAssessment.vue @@ -0,0 +1,161 @@ + + + + + + diff --git a/package.json b/package.json index f8c5e2a..9f3a3eb 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "echarts": "^4.2.1", "element-ui": "2.13.0", "event-source-polyfill": "^1.0.5", + "file-saver": "^2.0.5", "js-cookie": "2.2.0", "jsencrypt": "^3.0.0-rc.1", "leaflet": "^1.7.1", @@ -34,7 +35,8 @@ "vue-baidu-map": "^0.21.22", "vue-router": "3.0.1", "vue2-leaflet": "^2.7.0", - "vuex": "3.0.1" + "vuex": "3.0.1", + "xlsx": "^0.17.0" }, "devDependencies": { "autoprefixer": "8.5.0", diff --git a/src/api/sanitation/statistics.js b/src/api/sanitation/statistics.js new file mode 100644 index 0000000..2ca7549 --- /dev/null +++ b/src/api/sanitation/statistics.js @@ -0,0 +1,13 @@ + +/** + * 考核统计接口 + */ +import request from '@/utils/request' +// 公厕保洁次数统计 +export function getToiletJobCount(params) { + return request({ + url: '/sanitation/statistic/toilet/jobCount', + method: 'get', + params + }) +} diff --git a/src/api/sanitation/toilet.js b/src/api/sanitation/toilet.js new file mode 100644 index 0000000..10fd245 --- /dev/null +++ b/src/api/sanitation/toilet.js @@ -0,0 +1,97 @@ +/** + * 公厕管理接口 + */ +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 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/toilet.js b/src/api/system/toilet.js deleted file mode 100644 index 8f38b8f..0000000 --- a/src/api/system/toilet.js +++ /dev/null @@ -1,91 +0,0 @@ -/** - * 公厕管理接口 - */ -import request from '@/utils/request' -import qs from 'qs' -export function getToiletList(params) { - return request({ - url: '/sanitation/toilet/listPage', - method: 'get', - params - }) -} - -export function getDetail(id) { - return request({ - url: '/sanitation/toiletClean/detail', - method: 'get', - params: { - id: id - } - }) -} - -// 公厕查询 -export function getToiletAll() { - return request({ - url: '/sanitation/toilet/listPage', - method: 'get' - }) -} - -// 添加公厕 -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 exportRecords(params) { - return request({ - url: 'device/batchExport', - method: 'get', - timeout: 120000, - params, - 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/assets/global_images/toilet.png b/src/assets/global_images/toilet.png new file mode 100644 index 0000000..6d9fc05 --- /dev/null +++ b/src/assets/global_images/toilet.png Binary files differ diff --git a/src/components/NormalTable/index.vue b/src/components/NormalTable/index.vue index 5077bef..04d322d 100644 --- a/src/components/NormalTable/index.vue +++ b/src/components/NormalTable/index.vue @@ -79,7 +79,7 @@
-
+
Object.assign(obj, { [key]: this[key] }), {}), + on: events.reduce((obj, key) => Object.assign(obj, { [key]: this.transmitEvent }), {}) + }) + } + this.props = [...extraProps, ...props.filter(prop => exceptProps.indexOf(prop))] + } +} + +export default prop => new Mixin(prop) diff --git a/src/components/mapWindow/base/mixins/common.js b/src/components/mapWindow/base/mixins/common.js new file mode 100644 index 0000000..2fd1a28 --- /dev/null +++ b/src/components/mapWindow/base/mixins/common.js @@ -0,0 +1,82 @@ +const types = { + map: { + unload: 'clearMap' + }, + control: { + unload: 'removeControl' + }, + layer: { + unload: 'removeLayer' + }, + features: { + unload: 'removeFeatures' + }, + listener: { + unload: 'removeListener' + } +} + +const getParent = $component => ($component.abstract || $component.$el === $component.$children[0].$el) ? getParent($component.$parent) : $component + +function destroyInstance () { + const { unload, renderByParent, $parent } = this + if (renderByParent) { + $parent.reload() + } + unload() +} + +class Mixin { + constructor (prop) { + this.methods = { + ready () { + const $parent = getParent(this.$parent) + const map = this.map = $parent.map + this.load() + this.$emit('ready', { + map + }) + }, + transmitEvent (e) { + this.$emit(e.type.replace(/^on/, ''), e) + }, + reload () { + this && this.$nextTick(() => { + this.unload() + this.$nextTick(this.load) + }) + }, + unload () { + const { map, originInstance } = this + try { + switch (prop.type) { + case 'search': + return originInstance.clearResults() + case 'autoComplete': + case 'lushu': + return originInstance.dispose() + case 'markerClusterer': + return originInstance.clearMarkers() + default: + map[types[prop.type].unload](originInstance) + } + } catch (e) {} + } + } + this.computed = { + renderByParent () { + return this.$parent.preventChildrenRender + } + } + this.mounted = function () { + console.log('common mounted') + const $parent = getParent(this.$parent) + const map = $parent.map + const { ready } = this + console.log(map) + map ? ready() : $parent.$on('onload', ready) + } + } +} + +export default type => new Mixin({ type }) diff --git a/src/components/mapWindow/leafletMap.vue b/src/components/mapWindow/leafletMap.vue new file mode 100644 index 0000000..931a5e9 --- /dev/null +++ b/src/components/mapWindow/leafletMap.vue @@ -0,0 +1,132 @@ + + + + + + + diff --git a/src/components/mapWindow/mapWindow.vue b/src/components/mapWindow/mapWindow.vue new file mode 100644 index 0000000..9ced291 --- /dev/null +++ b/src/components/mapWindow/mapWindow.vue @@ -0,0 +1,46 @@ + + + + + + diff --git a/src/permission.js b/src/permission.js index dc6b2f8..809ca86 100644 --- a/src/permission.js +++ b/src/permission.js @@ -25,8 +25,8 @@ store.dispatch('GetInfo').then(res => { // 拉取用户信息 // 设置当前子系统为基础资源子系统 const currentSys = { - code: 'baseResourse', - name: '基础资源子系统' + code: 'toliet', + name: '公共厕所管理系统' } // 将当前系统信息保存在localStorage中 store.commit('SET_SYSTEM', currentSys) diff --git a/src/router/index.js b/src/router/index.js index 431844b..d23076d 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -43,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 错误页面 diff --git a/src/router/modules/statistics.js b/src/router/modules/statistics.js index 442aa6f..fb9cbea 100644 --- a/src/router/modules/statistics.js +++ b/src/router/modules/statistics.js @@ -5,7 +5,7 @@ { path: 'statisticsToilet', component: Layout, - redirect: '/statisticsToilet', + redirect: '/workStatistics', name: 'StatisticsToilet', meta: { title: '作业统计', @@ -14,10 +14,16 @@ }, children: [ { - path: '/statistics', - name: 'Statistics', - component: () => import('@/views/statistics/workStatistics'), - meta: { title: '作业统计', icon: 'function', permission: ['/statisticsToilet'] } + path: '/workStatistics', + name: 'WorkStatistics', + component: () => import('@/views/statistics/toiletAssessment'), + meta: { title: '作业统计', icon: '', permission: ['/toilet/workStatistics'] } + }, + { + path: '/evaluationStatistics', + name: 'EvaluationStatistics', + component: () => import('@/views/statistics/evaluationAssessment'), + meta: { title: '评价统计', icon: '', permission: ['/toilet/evaluationStatistics'] } } ] } diff --git a/src/router/modules/toilet.js b/src/router/modules/toilet.js index e537ce9..b221a0e 100644 --- a/src/router/modules/toilet.js +++ b/src/router/modules/toilet.js @@ -16,7 +16,7 @@ { path: '/toiletList', name: 'ToiletList', - component: () => import('@/views/toilet/listToilet'), + component: () => import('@/views/toiletManage/toiletList'), meta: { title: '公厕台帐管理', icon: 'function', permission: ['/toiletList'] } }, { diff --git a/src/router/modules/work.js b/src/router/modules/work.js index 3725050..5e0759f 100644 --- a/src/router/modules/work.js +++ b/src/router/modules/work.js @@ -16,7 +16,7 @@ { path: '/toiletWork', name: 'ToiletWork', - component: () => import('@/views/toilet/listWork'), + component: () => import('@/views/toiletClean/toiletCleanList'), meta: { title: '作业管理', icon: 'function', permission: ['/toiletWork'] } } ] diff --git a/src/settings.js b/src/settings.js index b568ce0..b8159bf 100644 --- a/src/settings.js +++ b/src/settings.js @@ -3,7 +3,7 @@ * @type {boolean} true | false * @description 是否显示设置按钮 */ - showSettings: true, + showSettings: false, /** * @type {boolean} true | false diff --git a/src/store/modules/permission.js b/src/store/modules/permission.js index a0cb8cf..3ab50d5 100644 --- a/src/store/modules/permission.js +++ b/src/store/modules/permission.js @@ -120,17 +120,23 @@ }) }, // 获取用户权限 - GetMenus({ commit, state }) { - console.log('in store.permission.js:GetMenus:') + GetMenus({ commit, state }, currentSystem) { + // console.log('in store.permission.js:GetMenus:') + console.log('获取' + currentSystem.name + '的菜单') + const params = { + parentCode: currentSystem.code // 传入该子系统的code,获取子系统的权限 + } return new Promise((resolve, reject) => { - getMenus(state.token).then(response => { // 处理返回值 + // 此处获取用户所有权限 + getMenus(params).then(response => { // 处理返回值 const data = response.data const menus = [] // 仅菜单 const btns = [] // 非菜单 if (data.menus && data.menus.length > 0) { - commit('SET_MENUS', data.menus) - for (const menu of data.menus) { // 遍历菜单,获取所有的权限项 - if (menu.ismenu === '1') { // 将是菜单的放入menus + const allmenus = [...data.menus] + commit('SET_MENUS', allmenus) + for (const menu of allmenus) { // 遍历菜单,获取所有的权限项 + if (menu.resourceType === '02' || menu.resourceType === '03') { // 将是菜单的放入menus const menu_tmp = {} menu_tmp.url = menu.url menu_tmp.icon = menu.icon @@ -142,11 +148,11 @@ btn_tmp.name = menu.name btn_tmp.icon = menu.icon btns.push(btn_tmp) - // console.log(menu.url) } } // 过滤路由表 - const accessedRouters = filterAsyncRouter(asyncRouterMap, menus) + let accessedRouters = filterAsyncRouter(asyncRouterMap, menus) + // accessedRouters = filterRedirect(accessedRouters) commit('SET_BTNS', btns) commit('SET_ROUTERS', accessedRouters) resolve(response) diff --git a/src/utils/dateutils.js b/src/utils/dateutils.js index 868111a..5cd16af 100644 --- a/src/utils/dateutils.js +++ b/src/utils/dateutils.js @@ -15,15 +15,15 @@ return ct_month } -export function getLastWeek() { // 默认显示上周 +export function getLastWeek(fmt) { // 默认显示上周 const ct_month = new Date() ct_month.setTime(ct_month.getTime() - 3600 * 1000 * 24 * 7) - return ct_month + return ct_month.Format(fmt) } -export function getLastMonth() { // 默认显示上个月 +export function getLastMonth(fmt) { // 默认显示上个月 const ct_month = new Date() ct_month.setTime(ct_month.getTime() - 3600 * 1000 * 24 * 30) - return ct_month + return ct_month.Format(fmt) } // 对Date的扩展,将 Date 转化为指定格式的String diff --git a/src/utils/exportutils.js b/src/utils/exportutils.js new file mode 100644 index 0000000..b5d0bcf --- /dev/null +++ b/src/utils/exportutils.js @@ -0,0 +1,19 @@ +/** + * 导出文件工具 + * @param blob 文件 + * @param fileName 导出文件名 + */ +export function exportFile(blob, fileName) { + if (window.navigator && window.navigator.msSaveOrOpenBlob) { + navigator.msSaveBlob(blob, fileName) + } else { + const downloadElement = document.createElement('a') + const href = window.URL.createObjectURL(blob) // 创建下载的链接 + downloadElement.href = href + downloadElement.download = fileName + document.body.appendChild(downloadElement) + downloadElement.click() // 点击下载 + document.body.removeChild(downloadElement) // 下载完成移除元素 + window.URL.revokeObjectURL(href) // 释放blob对象 + } +} diff --git a/src/views/mapViews/mapView.vue b/src/views/mapViews/mapView.vue index feba3f6..a18db88 100644 --- a/src/views/mapViews/mapView.vue +++ b/src/views/mapViews/mapView.vue @@ -41,10 +41,7 @@ zoomOffset: 1 } }, - // mapurl: 'http://t1.tianditu.com/vec_w/wmts?layer=vec&style=default&tilematrixset=w&Service=WMTS&Request=GetTile&Version=1.0.0&Format=tiles&TileMatrix={z}&TileCol={x}&TileRow={y}&tk=adbdd8e08c292f6cb4e3f0289f7d0447', mapurl: this.baseConfig.mapUrl, - // mapurl: 'http://webrd01.is.autonavi.com/appmaptile?lang=zh_cn&size=1&scale=1&style=8&x={x}&y={y}&z={z}', - // labelurl: 'http://t1.tianditu.com/cva_w/wmts?layer=cva&style=default&tilematrixset=w&Service=WMTS&Request=GetTile&Version=1.0.0&Format=tiles&TileMatrix={z}&TileCol={x}&TileRow={y}&tk=adbdd8e08c292f6cb4e3f0289f7d0447' labelurl: this.baseConfig.labelUrl } }, diff --git a/src/views/overview/overview.vue b/src/views/overview/overview.vue index b356b46..9525867 100644 --- a/src/views/overview/overview.vue +++ b/src/views/overview/overview.vue @@ -1,30 +1,11 @@ @@ -32,13 +13,11 @@ import L from 'leaflet' import 'leaflet/dist/leaflet.css' import { getDetail } from '@/api/system/bridge' -// import icon from '/static/images/well/0100.png' -// import { getAllMarker } from '@/api/overview' -// import { getMarkerInfo } from '@/api/marker' -// import { lazyAMapApiLoaderInstance } from 'vue-amap' - +import LeafletMap from '@/components/mapWindow/leafletMap' +import ToiletLayer from './toiletLayer' export default { name: 'Overview', + components: { ToiletLayer, LeafletMap }, data() { return { baselayer: [], @@ -72,13 +51,15 @@ loading: false, icon: 'cross', map: null, - msg: 'Welcome to Your Vue.js App' } }, mounted() { - this.initMap() }, methods: { + // 地图加载完毕 + mapReady (map) { + this.map = map + }, initMap() { const map = L.map('map', { minZoom: 2, @@ -150,7 +131,7 @@ diff --git a/src/views/statistics/components/evaluationListDialog.vue b/src/views/statistics/components/evaluationListDialog.vue new file mode 100644 index 0000000..15a9c2f --- /dev/null +++ b/src/views/statistics/components/evaluationListDialog.vue @@ -0,0 +1,120 @@ + + + + + + diff --git a/src/views/statistics/components/workChart.vue b/src/views/statistics/components/workChart.vue new file mode 100644 index 0000000..a891e0c --- /dev/null +++ b/src/views/statistics/components/workChart.vue @@ -0,0 +1,79 @@ + + + + + diff --git a/src/views/statistics/evaluationAssessment.vue b/src/views/statistics/evaluationAssessment.vue new file mode 100644 index 0000000..2193f0e --- /dev/null +++ b/src/views/statistics/evaluationAssessment.vue @@ -0,0 +1,161 @@ + + + + + + diff --git a/src/views/statistics/toiletAssessment.vue b/src/views/statistics/toiletAssessment.vue new file mode 100644 index 0000000..2b8522a --- /dev/null +++ b/src/views/statistics/toiletAssessment.vue @@ -0,0 +1,237 @@ + + + + + diff --git a/package.json b/package.json index f8c5e2a..9f3a3eb 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "echarts": "^4.2.1", "element-ui": "2.13.0", "event-source-polyfill": "^1.0.5", + "file-saver": "^2.0.5", "js-cookie": "2.2.0", "jsencrypt": "^3.0.0-rc.1", "leaflet": "^1.7.1", @@ -34,7 +35,8 @@ "vue-baidu-map": "^0.21.22", "vue-router": "3.0.1", "vue2-leaflet": "^2.7.0", - "vuex": "3.0.1" + "vuex": "3.0.1", + "xlsx": "^0.17.0" }, "devDependencies": { "autoprefixer": "8.5.0", diff --git a/src/api/sanitation/statistics.js b/src/api/sanitation/statistics.js new file mode 100644 index 0000000..2ca7549 --- /dev/null +++ b/src/api/sanitation/statistics.js @@ -0,0 +1,13 @@ + +/** + * 考核统计接口 + */ +import request from '@/utils/request' +// 公厕保洁次数统计 +export function getToiletJobCount(params) { + return request({ + url: '/sanitation/statistic/toilet/jobCount', + method: 'get', + params + }) +} diff --git a/src/api/sanitation/toilet.js b/src/api/sanitation/toilet.js new file mode 100644 index 0000000..10fd245 --- /dev/null +++ b/src/api/sanitation/toilet.js @@ -0,0 +1,97 @@ +/** + * 公厕管理接口 + */ +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 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/toilet.js b/src/api/system/toilet.js deleted file mode 100644 index 8f38b8f..0000000 --- a/src/api/system/toilet.js +++ /dev/null @@ -1,91 +0,0 @@ -/** - * 公厕管理接口 - */ -import request from '@/utils/request' -import qs from 'qs' -export function getToiletList(params) { - return request({ - url: '/sanitation/toilet/listPage', - method: 'get', - params - }) -} - -export function getDetail(id) { - return request({ - url: '/sanitation/toiletClean/detail', - method: 'get', - params: { - id: id - } - }) -} - -// 公厕查询 -export function getToiletAll() { - return request({ - url: '/sanitation/toilet/listPage', - method: 'get' - }) -} - -// 添加公厕 -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 exportRecords(params) { - return request({ - url: 'device/batchExport', - method: 'get', - timeout: 120000, - params, - 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/assets/global_images/toilet.png b/src/assets/global_images/toilet.png new file mode 100644 index 0000000..6d9fc05 --- /dev/null +++ b/src/assets/global_images/toilet.png Binary files differ diff --git a/src/components/NormalTable/index.vue b/src/components/NormalTable/index.vue index 5077bef..04d322d 100644 --- a/src/components/NormalTable/index.vue +++ b/src/components/NormalTable/index.vue @@ -79,7 +79,7 @@
-
+
Object.assign(obj, { [key]: this[key] }), {}), + on: events.reduce((obj, key) => Object.assign(obj, { [key]: this.transmitEvent }), {}) + }) + } + this.props = [...extraProps, ...props.filter(prop => exceptProps.indexOf(prop))] + } +} + +export default prop => new Mixin(prop) diff --git a/src/components/mapWindow/base/mixins/common.js b/src/components/mapWindow/base/mixins/common.js new file mode 100644 index 0000000..2fd1a28 --- /dev/null +++ b/src/components/mapWindow/base/mixins/common.js @@ -0,0 +1,82 @@ +const types = { + map: { + unload: 'clearMap' + }, + control: { + unload: 'removeControl' + }, + layer: { + unload: 'removeLayer' + }, + features: { + unload: 'removeFeatures' + }, + listener: { + unload: 'removeListener' + } +} + +const getParent = $component => ($component.abstract || $component.$el === $component.$children[0].$el) ? getParent($component.$parent) : $component + +function destroyInstance () { + const { unload, renderByParent, $parent } = this + if (renderByParent) { + $parent.reload() + } + unload() +} + +class Mixin { + constructor (prop) { + this.methods = { + ready () { + const $parent = getParent(this.$parent) + const map = this.map = $parent.map + this.load() + this.$emit('ready', { + map + }) + }, + transmitEvent (e) { + this.$emit(e.type.replace(/^on/, ''), e) + }, + reload () { + this && this.$nextTick(() => { + this.unload() + this.$nextTick(this.load) + }) + }, + unload () { + const { map, originInstance } = this + try { + switch (prop.type) { + case 'search': + return originInstance.clearResults() + case 'autoComplete': + case 'lushu': + return originInstance.dispose() + case 'markerClusterer': + return originInstance.clearMarkers() + default: + map[types[prop.type].unload](originInstance) + } + } catch (e) {} + } + } + this.computed = { + renderByParent () { + return this.$parent.preventChildrenRender + } + } + this.mounted = function () { + console.log('common mounted') + const $parent = getParent(this.$parent) + const map = $parent.map + const { ready } = this + console.log(map) + map ? ready() : $parent.$on('onload', ready) + } + } +} + +export default type => new Mixin({ type }) diff --git a/src/components/mapWindow/leafletMap.vue b/src/components/mapWindow/leafletMap.vue new file mode 100644 index 0000000..931a5e9 --- /dev/null +++ b/src/components/mapWindow/leafletMap.vue @@ -0,0 +1,132 @@ + + + + + + + diff --git a/src/components/mapWindow/mapWindow.vue b/src/components/mapWindow/mapWindow.vue new file mode 100644 index 0000000..9ced291 --- /dev/null +++ b/src/components/mapWindow/mapWindow.vue @@ -0,0 +1,46 @@ + + + + + + diff --git a/src/permission.js b/src/permission.js index dc6b2f8..809ca86 100644 --- a/src/permission.js +++ b/src/permission.js @@ -25,8 +25,8 @@ store.dispatch('GetInfo').then(res => { // 拉取用户信息 // 设置当前子系统为基础资源子系统 const currentSys = { - code: 'baseResourse', - name: '基础资源子系统' + code: 'toliet', + name: '公共厕所管理系统' } // 将当前系统信息保存在localStorage中 store.commit('SET_SYSTEM', currentSys) diff --git a/src/router/index.js b/src/router/index.js index 431844b..d23076d 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -43,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 错误页面 diff --git a/src/router/modules/statistics.js b/src/router/modules/statistics.js index 442aa6f..fb9cbea 100644 --- a/src/router/modules/statistics.js +++ b/src/router/modules/statistics.js @@ -5,7 +5,7 @@ { path: 'statisticsToilet', component: Layout, - redirect: '/statisticsToilet', + redirect: '/workStatistics', name: 'StatisticsToilet', meta: { title: '作业统计', @@ -14,10 +14,16 @@ }, children: [ { - path: '/statistics', - name: 'Statistics', - component: () => import('@/views/statistics/workStatistics'), - meta: { title: '作业统计', icon: 'function', permission: ['/statisticsToilet'] } + path: '/workStatistics', + name: 'WorkStatistics', + component: () => import('@/views/statistics/toiletAssessment'), + meta: { title: '作业统计', icon: '', permission: ['/toilet/workStatistics'] } + }, + { + path: '/evaluationStatistics', + name: 'EvaluationStatistics', + component: () => import('@/views/statistics/evaluationAssessment'), + meta: { title: '评价统计', icon: '', permission: ['/toilet/evaluationStatistics'] } } ] } diff --git a/src/router/modules/toilet.js b/src/router/modules/toilet.js index e537ce9..b221a0e 100644 --- a/src/router/modules/toilet.js +++ b/src/router/modules/toilet.js @@ -16,7 +16,7 @@ { path: '/toiletList', name: 'ToiletList', - component: () => import('@/views/toilet/listToilet'), + component: () => import('@/views/toiletManage/toiletList'), meta: { title: '公厕台帐管理', icon: 'function', permission: ['/toiletList'] } }, { diff --git a/src/router/modules/work.js b/src/router/modules/work.js index 3725050..5e0759f 100644 --- a/src/router/modules/work.js +++ b/src/router/modules/work.js @@ -16,7 +16,7 @@ { path: '/toiletWork', name: 'ToiletWork', - component: () => import('@/views/toilet/listWork'), + component: () => import('@/views/toiletClean/toiletCleanList'), meta: { title: '作业管理', icon: 'function', permission: ['/toiletWork'] } } ] diff --git a/src/settings.js b/src/settings.js index b568ce0..b8159bf 100644 --- a/src/settings.js +++ b/src/settings.js @@ -3,7 +3,7 @@ * @type {boolean} true | false * @description 是否显示设置按钮 */ - showSettings: true, + showSettings: false, /** * @type {boolean} true | false diff --git a/src/store/modules/permission.js b/src/store/modules/permission.js index a0cb8cf..3ab50d5 100644 --- a/src/store/modules/permission.js +++ b/src/store/modules/permission.js @@ -120,17 +120,23 @@ }) }, // 获取用户权限 - GetMenus({ commit, state }) { - console.log('in store.permission.js:GetMenus:') + GetMenus({ commit, state }, currentSystem) { + // console.log('in store.permission.js:GetMenus:') + console.log('获取' + currentSystem.name + '的菜单') + const params = { + parentCode: currentSystem.code // 传入该子系统的code,获取子系统的权限 + } return new Promise((resolve, reject) => { - getMenus(state.token).then(response => { // 处理返回值 + // 此处获取用户所有权限 + getMenus(params).then(response => { // 处理返回值 const data = response.data const menus = [] // 仅菜单 const btns = [] // 非菜单 if (data.menus && data.menus.length > 0) { - commit('SET_MENUS', data.menus) - for (const menu of data.menus) { // 遍历菜单,获取所有的权限项 - if (menu.ismenu === '1') { // 将是菜单的放入menus + const allmenus = [...data.menus] + commit('SET_MENUS', allmenus) + for (const menu of allmenus) { // 遍历菜单,获取所有的权限项 + if (menu.resourceType === '02' || menu.resourceType === '03') { // 将是菜单的放入menus const menu_tmp = {} menu_tmp.url = menu.url menu_tmp.icon = menu.icon @@ -142,11 +148,11 @@ btn_tmp.name = menu.name btn_tmp.icon = menu.icon btns.push(btn_tmp) - // console.log(menu.url) } } // 过滤路由表 - const accessedRouters = filterAsyncRouter(asyncRouterMap, menus) + let accessedRouters = filterAsyncRouter(asyncRouterMap, menus) + // accessedRouters = filterRedirect(accessedRouters) commit('SET_BTNS', btns) commit('SET_ROUTERS', accessedRouters) resolve(response) diff --git a/src/utils/dateutils.js b/src/utils/dateutils.js index 868111a..5cd16af 100644 --- a/src/utils/dateutils.js +++ b/src/utils/dateutils.js @@ -15,15 +15,15 @@ return ct_month } -export function getLastWeek() { // 默认显示上周 +export function getLastWeek(fmt) { // 默认显示上周 const ct_month = new Date() ct_month.setTime(ct_month.getTime() - 3600 * 1000 * 24 * 7) - return ct_month + return ct_month.Format(fmt) } -export function getLastMonth() { // 默认显示上个月 +export function getLastMonth(fmt) { // 默认显示上个月 const ct_month = new Date() ct_month.setTime(ct_month.getTime() - 3600 * 1000 * 24 * 30) - return ct_month + return ct_month.Format(fmt) } // 对Date的扩展,将 Date 转化为指定格式的String diff --git a/src/utils/exportutils.js b/src/utils/exportutils.js new file mode 100644 index 0000000..b5d0bcf --- /dev/null +++ b/src/utils/exportutils.js @@ -0,0 +1,19 @@ +/** + * 导出文件工具 + * @param blob 文件 + * @param fileName 导出文件名 + */ +export function exportFile(blob, fileName) { + if (window.navigator && window.navigator.msSaveOrOpenBlob) { + navigator.msSaveBlob(blob, fileName) + } else { + const downloadElement = document.createElement('a') + const href = window.URL.createObjectURL(blob) // 创建下载的链接 + downloadElement.href = href + downloadElement.download = fileName + document.body.appendChild(downloadElement) + downloadElement.click() // 点击下载 + document.body.removeChild(downloadElement) // 下载完成移除元素 + window.URL.revokeObjectURL(href) // 释放blob对象 + } +} diff --git a/src/views/mapViews/mapView.vue b/src/views/mapViews/mapView.vue index feba3f6..a18db88 100644 --- a/src/views/mapViews/mapView.vue +++ b/src/views/mapViews/mapView.vue @@ -41,10 +41,7 @@ zoomOffset: 1 } }, - // mapurl: 'http://t1.tianditu.com/vec_w/wmts?layer=vec&style=default&tilematrixset=w&Service=WMTS&Request=GetTile&Version=1.0.0&Format=tiles&TileMatrix={z}&TileCol={x}&TileRow={y}&tk=adbdd8e08c292f6cb4e3f0289f7d0447', mapurl: this.baseConfig.mapUrl, - // mapurl: 'http://webrd01.is.autonavi.com/appmaptile?lang=zh_cn&size=1&scale=1&style=8&x={x}&y={y}&z={z}', - // labelurl: 'http://t1.tianditu.com/cva_w/wmts?layer=cva&style=default&tilematrixset=w&Service=WMTS&Request=GetTile&Version=1.0.0&Format=tiles&TileMatrix={z}&TileCol={x}&TileRow={y}&tk=adbdd8e08c292f6cb4e3f0289f7d0447' labelurl: this.baseConfig.labelUrl } }, diff --git a/src/views/overview/overview.vue b/src/views/overview/overview.vue index b356b46..9525867 100644 --- a/src/views/overview/overview.vue +++ b/src/views/overview/overview.vue @@ -1,30 +1,11 @@ @@ -32,13 +13,11 @@ import L from 'leaflet' import 'leaflet/dist/leaflet.css' import { getDetail } from '@/api/system/bridge' -// import icon from '/static/images/well/0100.png' -// import { getAllMarker } from '@/api/overview' -// import { getMarkerInfo } from '@/api/marker' -// import { lazyAMapApiLoaderInstance } from 'vue-amap' - +import LeafletMap from '@/components/mapWindow/leafletMap' +import ToiletLayer from './toiletLayer' export default { name: 'Overview', + components: { ToiletLayer, LeafletMap }, data() { return { baselayer: [], @@ -72,13 +51,15 @@ loading: false, icon: 'cross', map: null, - msg: 'Welcome to Your Vue.js App' } }, mounted() { - this.initMap() }, methods: { + // 地图加载完毕 + mapReady (map) { + this.map = map + }, initMap() { const map = L.map('map', { minZoom: 2, @@ -150,7 +131,7 @@ diff --git a/src/views/statistics/components/evaluationListDialog.vue b/src/views/statistics/components/evaluationListDialog.vue new file mode 100644 index 0000000..15a9c2f --- /dev/null +++ b/src/views/statistics/components/evaluationListDialog.vue @@ -0,0 +1,120 @@ + + + + + + diff --git a/src/views/statistics/components/workChart.vue b/src/views/statistics/components/workChart.vue new file mode 100644 index 0000000..a891e0c --- /dev/null +++ b/src/views/statistics/components/workChart.vue @@ -0,0 +1,79 @@ + + + + + diff --git a/src/views/statistics/evaluationAssessment.vue b/src/views/statistics/evaluationAssessment.vue new file mode 100644 index 0000000..2193f0e --- /dev/null +++ b/src/views/statistics/evaluationAssessment.vue @@ -0,0 +1,161 @@ + + + + + + diff --git a/src/views/statistics/toiletAssessment.vue b/src/views/statistics/toiletAssessment.vue new file mode 100644 index 0000000..2b8522a --- /dev/null +++ b/src/views/statistics/toiletAssessment.vue @@ -0,0 +1,237 @@ + + + + + diff --git a/src/views/toilet/components/detail.vue b/src/views/toilet/components/detail.vue index 7864470..247c03d 100644 --- a/src/views/toilet/components/detail.vue +++ b/src/views/toilet/components/detail.vue @@ -115,7 +115,7 @@
+ + + + diff --git a/src/components/mapWindow/mapWindow.vue b/src/components/mapWindow/mapWindow.vue new file mode 100644 index 0000000..9ced291 --- /dev/null +++ b/src/components/mapWindow/mapWindow.vue @@ -0,0 +1,46 @@ + + + + + + diff --git a/src/permission.js b/src/permission.js index dc6b2f8..809ca86 100644 --- a/src/permission.js +++ b/src/permission.js @@ -25,8 +25,8 @@ store.dispatch('GetInfo').then(res => { // 拉取用户信息 // 设置当前子系统为基础资源子系统 const currentSys = { - code: 'baseResourse', - name: '基础资源子系统' + code: 'toliet', + name: '公共厕所管理系统' } // 将当前系统信息保存在localStorage中 store.commit('SET_SYSTEM', currentSys) diff --git a/src/router/index.js b/src/router/index.js index 431844b..d23076d 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -43,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 错误页面 diff --git a/src/router/modules/statistics.js b/src/router/modules/statistics.js index 442aa6f..fb9cbea 100644 --- a/src/router/modules/statistics.js +++ b/src/router/modules/statistics.js @@ -5,7 +5,7 @@ { path: 'statisticsToilet', component: Layout, - redirect: '/statisticsToilet', + redirect: '/workStatistics', name: 'StatisticsToilet', meta: { title: '作业统计', @@ -14,10 +14,16 @@ }, children: [ { - path: '/statistics', - name: 'Statistics', - component: () => import('@/views/statistics/workStatistics'), - meta: { title: '作业统计', icon: 'function', permission: ['/statisticsToilet'] } + path: '/workStatistics', + name: 'WorkStatistics', + component: () => import('@/views/statistics/toiletAssessment'), + meta: { title: '作业统计', icon: '', permission: ['/toilet/workStatistics'] } + }, + { + path: '/evaluationStatistics', + name: 'EvaluationStatistics', + component: () => import('@/views/statistics/evaluationAssessment'), + meta: { title: '评价统计', icon: '', permission: ['/toilet/evaluationStatistics'] } } ] } diff --git a/src/router/modules/toilet.js b/src/router/modules/toilet.js index e537ce9..b221a0e 100644 --- a/src/router/modules/toilet.js +++ b/src/router/modules/toilet.js @@ -16,7 +16,7 @@ { path: '/toiletList', name: 'ToiletList', - component: () => import('@/views/toilet/listToilet'), + component: () => import('@/views/toiletManage/toiletList'), meta: { title: '公厕台帐管理', icon: 'function', permission: ['/toiletList'] } }, { diff --git a/src/router/modules/work.js b/src/router/modules/work.js index 3725050..5e0759f 100644 --- a/src/router/modules/work.js +++ b/src/router/modules/work.js @@ -16,7 +16,7 @@ { path: '/toiletWork', name: 'ToiletWork', - component: () => import('@/views/toilet/listWork'), + component: () => import('@/views/toiletClean/toiletCleanList'), meta: { title: '作业管理', icon: 'function', permission: ['/toiletWork'] } } ] diff --git a/src/settings.js b/src/settings.js index b568ce0..b8159bf 100644 --- a/src/settings.js +++ b/src/settings.js @@ -3,7 +3,7 @@ * @type {boolean} true | false * @description 是否显示设置按钮 */ - showSettings: true, + showSettings: false, /** * @type {boolean} true | false diff --git a/src/store/modules/permission.js b/src/store/modules/permission.js index a0cb8cf..3ab50d5 100644 --- a/src/store/modules/permission.js +++ b/src/store/modules/permission.js @@ -120,17 +120,23 @@ }) }, // 获取用户权限 - GetMenus({ commit, state }) { - console.log('in store.permission.js:GetMenus:') + GetMenus({ commit, state }, currentSystem) { + // console.log('in store.permission.js:GetMenus:') + console.log('获取' + currentSystem.name + '的菜单') + const params = { + parentCode: currentSystem.code // 传入该子系统的code,获取子系统的权限 + } return new Promise((resolve, reject) => { - getMenus(state.token).then(response => { // 处理返回值 + // 此处获取用户所有权限 + getMenus(params).then(response => { // 处理返回值 const data = response.data const menus = [] // 仅菜单 const btns = [] // 非菜单 if (data.menus && data.menus.length > 0) { - commit('SET_MENUS', data.menus) - for (const menu of data.menus) { // 遍历菜单,获取所有的权限项 - if (menu.ismenu === '1') { // 将是菜单的放入menus + const allmenus = [...data.menus] + commit('SET_MENUS', allmenus) + for (const menu of allmenus) { // 遍历菜单,获取所有的权限项 + if (menu.resourceType === '02' || menu.resourceType === '03') { // 将是菜单的放入menus const menu_tmp = {} menu_tmp.url = menu.url menu_tmp.icon = menu.icon @@ -142,11 +148,11 @@ btn_tmp.name = menu.name btn_tmp.icon = menu.icon btns.push(btn_tmp) - // console.log(menu.url) } } // 过滤路由表 - const accessedRouters = filterAsyncRouter(asyncRouterMap, menus) + let accessedRouters = filterAsyncRouter(asyncRouterMap, menus) + // accessedRouters = filterRedirect(accessedRouters) commit('SET_BTNS', btns) commit('SET_ROUTERS', accessedRouters) resolve(response) diff --git a/src/utils/dateutils.js b/src/utils/dateutils.js index 868111a..5cd16af 100644 --- a/src/utils/dateutils.js +++ b/src/utils/dateutils.js @@ -15,15 +15,15 @@ return ct_month } -export function getLastWeek() { // 默认显示上周 +export function getLastWeek(fmt) { // 默认显示上周 const ct_month = new Date() ct_month.setTime(ct_month.getTime() - 3600 * 1000 * 24 * 7) - return ct_month + return ct_month.Format(fmt) } -export function getLastMonth() { // 默认显示上个月 +export function getLastMonth(fmt) { // 默认显示上个月 const ct_month = new Date() ct_month.setTime(ct_month.getTime() - 3600 * 1000 * 24 * 30) - return ct_month + return ct_month.Format(fmt) } // 对Date的扩展,将 Date 转化为指定格式的String diff --git a/src/utils/exportutils.js b/src/utils/exportutils.js new file mode 100644 index 0000000..b5d0bcf --- /dev/null +++ b/src/utils/exportutils.js @@ -0,0 +1,19 @@ +/** + * 导出文件工具 + * @param blob 文件 + * @param fileName 导出文件名 + */ +export function exportFile(blob, fileName) { + if (window.navigator && window.navigator.msSaveOrOpenBlob) { + navigator.msSaveBlob(blob, fileName) + } else { + const downloadElement = document.createElement('a') + const href = window.URL.createObjectURL(blob) // 创建下载的链接 + downloadElement.href = href + downloadElement.download = fileName + document.body.appendChild(downloadElement) + downloadElement.click() // 点击下载 + document.body.removeChild(downloadElement) // 下载完成移除元素 + window.URL.revokeObjectURL(href) // 释放blob对象 + } +} diff --git a/src/views/mapViews/mapView.vue b/src/views/mapViews/mapView.vue index feba3f6..a18db88 100644 --- a/src/views/mapViews/mapView.vue +++ b/src/views/mapViews/mapView.vue @@ -41,10 +41,7 @@ zoomOffset: 1 } }, - // mapurl: 'http://t1.tianditu.com/vec_w/wmts?layer=vec&style=default&tilematrixset=w&Service=WMTS&Request=GetTile&Version=1.0.0&Format=tiles&TileMatrix={z}&TileCol={x}&TileRow={y}&tk=adbdd8e08c292f6cb4e3f0289f7d0447', mapurl: this.baseConfig.mapUrl, - // mapurl: 'http://webrd01.is.autonavi.com/appmaptile?lang=zh_cn&size=1&scale=1&style=8&x={x}&y={y}&z={z}', - // labelurl: 'http://t1.tianditu.com/cva_w/wmts?layer=cva&style=default&tilematrixset=w&Service=WMTS&Request=GetTile&Version=1.0.0&Format=tiles&TileMatrix={z}&TileCol={x}&TileRow={y}&tk=adbdd8e08c292f6cb4e3f0289f7d0447' labelurl: this.baseConfig.labelUrl } }, diff --git a/src/views/overview/overview.vue b/src/views/overview/overview.vue index b356b46..9525867 100644 --- a/src/views/overview/overview.vue +++ b/src/views/overview/overview.vue @@ -1,30 +1,11 @@ @@ -32,13 +13,11 @@ import L from 'leaflet' import 'leaflet/dist/leaflet.css' import { getDetail } from '@/api/system/bridge' -// import icon from '/static/images/well/0100.png' -// import { getAllMarker } from '@/api/overview' -// import { getMarkerInfo } from '@/api/marker' -// import { lazyAMapApiLoaderInstance } from 'vue-amap' - +import LeafletMap from '@/components/mapWindow/leafletMap' +import ToiletLayer from './toiletLayer' export default { name: 'Overview', + components: { ToiletLayer, LeafletMap }, data() { return { baselayer: [], @@ -72,13 +51,15 @@ loading: false, icon: 'cross', map: null, - msg: 'Welcome to Your Vue.js App' } }, mounted() { - this.initMap() }, methods: { + // 地图加载完毕 + mapReady (map) { + this.map = map + }, initMap() { const map = L.map('map', { minZoom: 2, @@ -150,7 +131,7 @@ diff --git a/src/views/statistics/components/evaluationListDialog.vue b/src/views/statistics/components/evaluationListDialog.vue new file mode 100644 index 0000000..15a9c2f --- /dev/null +++ b/src/views/statistics/components/evaluationListDialog.vue @@ -0,0 +1,120 @@ + + + + + + diff --git a/src/views/statistics/components/workChart.vue b/src/views/statistics/components/workChart.vue new file mode 100644 index 0000000..a891e0c --- /dev/null +++ b/src/views/statistics/components/workChart.vue @@ -0,0 +1,79 @@ + + + + + diff --git a/src/views/statistics/evaluationAssessment.vue b/src/views/statistics/evaluationAssessment.vue new file mode 100644 index 0000000..2193f0e --- /dev/null +++ b/src/views/statistics/evaluationAssessment.vue @@ -0,0 +1,161 @@ + + + + + + diff --git a/src/views/statistics/toiletAssessment.vue b/src/views/statistics/toiletAssessment.vue new file mode 100644 index 0000000..2b8522a --- /dev/null +++ b/src/views/statistics/toiletAssessment.vue @@ -0,0 +1,237 @@ + + + + + diff --git a/src/views/toilet/components/detail.vue b/src/views/toilet/components/detail.vue index 7864470..247c03d 100644 --- a/src/views/toilet/components/detail.vue +++ b/src/views/toilet/components/detail.vue @@ -115,7 +115,7 @@
+ + + + diff --git a/src/components/mapWindow/mapWindow.vue b/src/components/mapWindow/mapWindow.vue new file mode 100644 index 0000000..9ced291 --- /dev/null +++ b/src/components/mapWindow/mapWindow.vue @@ -0,0 +1,46 @@ + + + + + + diff --git a/src/permission.js b/src/permission.js index dc6b2f8..809ca86 100644 --- a/src/permission.js +++ b/src/permission.js @@ -25,8 +25,8 @@ store.dispatch('GetInfo').then(res => { // 拉取用户信息 // 设置当前子系统为基础资源子系统 const currentSys = { - code: 'baseResourse', - name: '基础资源子系统' + code: 'toliet', + name: '公共厕所管理系统' } // 将当前系统信息保存在localStorage中 store.commit('SET_SYSTEM', currentSys) diff --git a/src/router/index.js b/src/router/index.js index 431844b..d23076d 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -43,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 错误页面 diff --git a/src/router/modules/statistics.js b/src/router/modules/statistics.js index 442aa6f..fb9cbea 100644 --- a/src/router/modules/statistics.js +++ b/src/router/modules/statistics.js @@ -5,7 +5,7 @@ { path: 'statisticsToilet', component: Layout, - redirect: '/statisticsToilet', + redirect: '/workStatistics', name: 'StatisticsToilet', meta: { title: '作业统计', @@ -14,10 +14,16 @@ }, children: [ { - path: '/statistics', - name: 'Statistics', - component: () => import('@/views/statistics/workStatistics'), - meta: { title: '作业统计', icon: 'function', permission: ['/statisticsToilet'] } + path: '/workStatistics', + name: 'WorkStatistics', + component: () => import('@/views/statistics/toiletAssessment'), + meta: { title: '作业统计', icon: '', permission: ['/toilet/workStatistics'] } + }, + { + path: '/evaluationStatistics', + name: 'EvaluationStatistics', + component: () => import('@/views/statistics/evaluationAssessment'), + meta: { title: '评价统计', icon: '', permission: ['/toilet/evaluationStatistics'] } } ] } diff --git a/src/router/modules/toilet.js b/src/router/modules/toilet.js index e537ce9..b221a0e 100644 --- a/src/router/modules/toilet.js +++ b/src/router/modules/toilet.js @@ -16,7 +16,7 @@ { path: '/toiletList', name: 'ToiletList', - component: () => import('@/views/toilet/listToilet'), + component: () => import('@/views/toiletManage/toiletList'), meta: { title: '公厕台帐管理', icon: 'function', permission: ['/toiletList'] } }, { diff --git a/src/router/modules/work.js b/src/router/modules/work.js index 3725050..5e0759f 100644 --- a/src/router/modules/work.js +++ b/src/router/modules/work.js @@ -16,7 +16,7 @@ { path: '/toiletWork', name: 'ToiletWork', - component: () => import('@/views/toilet/listWork'), + component: () => import('@/views/toiletClean/toiletCleanList'), meta: { title: '作业管理', icon: 'function', permission: ['/toiletWork'] } } ] diff --git a/src/settings.js b/src/settings.js index b568ce0..b8159bf 100644 --- a/src/settings.js +++ b/src/settings.js @@ -3,7 +3,7 @@ * @type {boolean} true | false * @description 是否显示设置按钮 */ - showSettings: true, + showSettings: false, /** * @type {boolean} true | false diff --git a/src/store/modules/permission.js b/src/store/modules/permission.js index a0cb8cf..3ab50d5 100644 --- a/src/store/modules/permission.js +++ b/src/store/modules/permission.js @@ -120,17 +120,23 @@ }) }, // 获取用户权限 - GetMenus({ commit, state }) { - console.log('in store.permission.js:GetMenus:') + GetMenus({ commit, state }, currentSystem) { + // console.log('in store.permission.js:GetMenus:') + console.log('获取' + currentSystem.name + '的菜单') + const params = { + parentCode: currentSystem.code // 传入该子系统的code,获取子系统的权限 + } return new Promise((resolve, reject) => { - getMenus(state.token).then(response => { // 处理返回值 + // 此处获取用户所有权限 + getMenus(params).then(response => { // 处理返回值 const data = response.data const menus = [] // 仅菜单 const btns = [] // 非菜单 if (data.menus && data.menus.length > 0) { - commit('SET_MENUS', data.menus) - for (const menu of data.menus) { // 遍历菜单,获取所有的权限项 - if (menu.ismenu === '1') { // 将是菜单的放入menus + const allmenus = [...data.menus] + commit('SET_MENUS', allmenus) + for (const menu of allmenus) { // 遍历菜单,获取所有的权限项 + if (menu.resourceType === '02' || menu.resourceType === '03') { // 将是菜单的放入menus const menu_tmp = {} menu_tmp.url = menu.url menu_tmp.icon = menu.icon @@ -142,11 +148,11 @@ btn_tmp.name = menu.name btn_tmp.icon = menu.icon btns.push(btn_tmp) - // console.log(menu.url) } } // 过滤路由表 - const accessedRouters = filterAsyncRouter(asyncRouterMap, menus) + let accessedRouters = filterAsyncRouter(asyncRouterMap, menus) + // accessedRouters = filterRedirect(accessedRouters) commit('SET_BTNS', btns) commit('SET_ROUTERS', accessedRouters) resolve(response) diff --git a/src/utils/dateutils.js b/src/utils/dateutils.js index 868111a..5cd16af 100644 --- a/src/utils/dateutils.js +++ b/src/utils/dateutils.js @@ -15,15 +15,15 @@ return ct_month } -export function getLastWeek() { // 默认显示上周 +export function getLastWeek(fmt) { // 默认显示上周 const ct_month = new Date() ct_month.setTime(ct_month.getTime() - 3600 * 1000 * 24 * 7) - return ct_month + return ct_month.Format(fmt) } -export function getLastMonth() { // 默认显示上个月 +export function getLastMonth(fmt) { // 默认显示上个月 const ct_month = new Date() ct_month.setTime(ct_month.getTime() - 3600 * 1000 * 24 * 30) - return ct_month + return ct_month.Format(fmt) } // 对Date的扩展,将 Date 转化为指定格式的String diff --git a/src/utils/exportutils.js b/src/utils/exportutils.js new file mode 100644 index 0000000..b5d0bcf --- /dev/null +++ b/src/utils/exportutils.js @@ -0,0 +1,19 @@ +/** + * 导出文件工具 + * @param blob 文件 + * @param fileName 导出文件名 + */ +export function exportFile(blob, fileName) { + if (window.navigator && window.navigator.msSaveOrOpenBlob) { + navigator.msSaveBlob(blob, fileName) + } else { + const downloadElement = document.createElement('a') + const href = window.URL.createObjectURL(blob) // 创建下载的链接 + downloadElement.href = href + downloadElement.download = fileName + document.body.appendChild(downloadElement) + downloadElement.click() // 点击下载 + document.body.removeChild(downloadElement) // 下载完成移除元素 + window.URL.revokeObjectURL(href) // 释放blob对象 + } +} diff --git a/src/views/mapViews/mapView.vue b/src/views/mapViews/mapView.vue index feba3f6..a18db88 100644 --- a/src/views/mapViews/mapView.vue +++ b/src/views/mapViews/mapView.vue @@ -41,10 +41,7 @@ zoomOffset: 1 } }, - // mapurl: 'http://t1.tianditu.com/vec_w/wmts?layer=vec&style=default&tilematrixset=w&Service=WMTS&Request=GetTile&Version=1.0.0&Format=tiles&TileMatrix={z}&TileCol={x}&TileRow={y}&tk=adbdd8e08c292f6cb4e3f0289f7d0447', mapurl: this.baseConfig.mapUrl, - // mapurl: 'http://webrd01.is.autonavi.com/appmaptile?lang=zh_cn&size=1&scale=1&style=8&x={x}&y={y}&z={z}', - // labelurl: 'http://t1.tianditu.com/cva_w/wmts?layer=cva&style=default&tilematrixset=w&Service=WMTS&Request=GetTile&Version=1.0.0&Format=tiles&TileMatrix={z}&TileCol={x}&TileRow={y}&tk=adbdd8e08c292f6cb4e3f0289f7d0447' labelurl: this.baseConfig.labelUrl } }, diff --git a/src/views/overview/overview.vue b/src/views/overview/overview.vue index b356b46..9525867 100644 --- a/src/views/overview/overview.vue +++ b/src/views/overview/overview.vue @@ -1,30 +1,11 @@ @@ -32,13 +13,11 @@ import L from 'leaflet' import 'leaflet/dist/leaflet.css' import { getDetail } from '@/api/system/bridge' -// import icon from '/static/images/well/0100.png' -// import { getAllMarker } from '@/api/overview' -// import { getMarkerInfo } from '@/api/marker' -// import { lazyAMapApiLoaderInstance } from 'vue-amap' - +import LeafletMap from '@/components/mapWindow/leafletMap' +import ToiletLayer from './toiletLayer' export default { name: 'Overview', + components: { ToiletLayer, LeafletMap }, data() { return { baselayer: [], @@ -72,13 +51,15 @@ loading: false, icon: 'cross', map: null, - msg: 'Welcome to Your Vue.js App' } }, mounted() { - this.initMap() }, methods: { + // 地图加载完毕 + mapReady (map) { + this.map = map + }, initMap() { const map = L.map('map', { minZoom: 2, @@ -150,7 +131,7 @@ diff --git a/src/views/statistics/components/evaluationListDialog.vue b/src/views/statistics/components/evaluationListDialog.vue new file mode 100644 index 0000000..15a9c2f --- /dev/null +++ b/src/views/statistics/components/evaluationListDialog.vue @@ -0,0 +1,120 @@ + + + + + + diff --git a/src/views/statistics/components/workChart.vue b/src/views/statistics/components/workChart.vue new file mode 100644 index 0000000..a891e0c --- /dev/null +++ b/src/views/statistics/components/workChart.vue @@ -0,0 +1,79 @@ + + + + + diff --git a/src/views/statistics/evaluationAssessment.vue b/src/views/statistics/evaluationAssessment.vue new file mode 100644 index 0000000..2193f0e --- /dev/null +++ b/src/views/statistics/evaluationAssessment.vue @@ -0,0 +1,161 @@ + + + + + + diff --git a/src/views/statistics/toiletAssessment.vue b/src/views/statistics/toiletAssessment.vue new file mode 100644 index 0000000..2b8522a --- /dev/null +++ b/src/views/statistics/toiletAssessment.vue @@ -0,0 +1,237 @@ + + + + + diff --git a/src/views/toilet/components/detail.vue b/src/views/toilet/components/detail.vue index 7864470..247c03d 100644 --- a/src/views/toilet/components/detail.vue +++ b/src/views/toilet/components/detail.vue @@ -115,7 +115,7 @@
+ + + + diff --git a/src/components/mapWindow/mapWindow.vue b/src/components/mapWindow/mapWindow.vue new file mode 100644 index 0000000..9ced291 --- /dev/null +++ b/src/components/mapWindow/mapWindow.vue @@ -0,0 +1,46 @@ + + + + + + diff --git a/src/permission.js b/src/permission.js index dc6b2f8..809ca86 100644 --- a/src/permission.js +++ b/src/permission.js @@ -25,8 +25,8 @@ store.dispatch('GetInfo').then(res => { // 拉取用户信息 // 设置当前子系统为基础资源子系统 const currentSys = { - code: 'baseResourse', - name: '基础资源子系统' + code: 'toliet', + name: '公共厕所管理系统' } // 将当前系统信息保存在localStorage中 store.commit('SET_SYSTEM', currentSys) diff --git a/src/router/index.js b/src/router/index.js index 431844b..d23076d 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -43,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 错误页面 diff --git a/src/router/modules/statistics.js b/src/router/modules/statistics.js index 442aa6f..fb9cbea 100644 --- a/src/router/modules/statistics.js +++ b/src/router/modules/statistics.js @@ -5,7 +5,7 @@ { path: 'statisticsToilet', component: Layout, - redirect: '/statisticsToilet', + redirect: '/workStatistics', name: 'StatisticsToilet', meta: { title: '作业统计', @@ -14,10 +14,16 @@ }, children: [ { - path: '/statistics', - name: 'Statistics', - component: () => import('@/views/statistics/workStatistics'), - meta: { title: '作业统计', icon: 'function', permission: ['/statisticsToilet'] } + path: '/workStatistics', + name: 'WorkStatistics', + component: () => import('@/views/statistics/toiletAssessment'), + meta: { title: '作业统计', icon: '', permission: ['/toilet/workStatistics'] } + }, + { + path: '/evaluationStatistics', + name: 'EvaluationStatistics', + component: () => import('@/views/statistics/evaluationAssessment'), + meta: { title: '评价统计', icon: '', permission: ['/toilet/evaluationStatistics'] } } ] } diff --git a/src/router/modules/toilet.js b/src/router/modules/toilet.js index e537ce9..b221a0e 100644 --- a/src/router/modules/toilet.js +++ b/src/router/modules/toilet.js @@ -16,7 +16,7 @@ { path: '/toiletList', name: 'ToiletList', - component: () => import('@/views/toilet/listToilet'), + component: () => import('@/views/toiletManage/toiletList'), meta: { title: '公厕台帐管理', icon: 'function', permission: ['/toiletList'] } }, { diff --git a/src/router/modules/work.js b/src/router/modules/work.js index 3725050..5e0759f 100644 --- a/src/router/modules/work.js +++ b/src/router/modules/work.js @@ -16,7 +16,7 @@ { path: '/toiletWork', name: 'ToiletWork', - component: () => import('@/views/toilet/listWork'), + component: () => import('@/views/toiletClean/toiletCleanList'), meta: { title: '作业管理', icon: 'function', permission: ['/toiletWork'] } } ] diff --git a/src/settings.js b/src/settings.js index b568ce0..b8159bf 100644 --- a/src/settings.js +++ b/src/settings.js @@ -3,7 +3,7 @@ * @type {boolean} true | false * @description 是否显示设置按钮 */ - showSettings: true, + showSettings: false, /** * @type {boolean} true | false diff --git a/src/store/modules/permission.js b/src/store/modules/permission.js index a0cb8cf..3ab50d5 100644 --- a/src/store/modules/permission.js +++ b/src/store/modules/permission.js @@ -120,17 +120,23 @@ }) }, // 获取用户权限 - GetMenus({ commit, state }) { - console.log('in store.permission.js:GetMenus:') + GetMenus({ commit, state }, currentSystem) { + // console.log('in store.permission.js:GetMenus:') + console.log('获取' + currentSystem.name + '的菜单') + const params = { + parentCode: currentSystem.code // 传入该子系统的code,获取子系统的权限 + } return new Promise((resolve, reject) => { - getMenus(state.token).then(response => { // 处理返回值 + // 此处获取用户所有权限 + getMenus(params).then(response => { // 处理返回值 const data = response.data const menus = [] // 仅菜单 const btns = [] // 非菜单 if (data.menus && data.menus.length > 0) { - commit('SET_MENUS', data.menus) - for (const menu of data.menus) { // 遍历菜单,获取所有的权限项 - if (menu.ismenu === '1') { // 将是菜单的放入menus + const allmenus = [...data.menus] + commit('SET_MENUS', allmenus) + for (const menu of allmenus) { // 遍历菜单,获取所有的权限项 + if (menu.resourceType === '02' || menu.resourceType === '03') { // 将是菜单的放入menus const menu_tmp = {} menu_tmp.url = menu.url menu_tmp.icon = menu.icon @@ -142,11 +148,11 @@ btn_tmp.name = menu.name btn_tmp.icon = menu.icon btns.push(btn_tmp) - // console.log(menu.url) } } // 过滤路由表 - const accessedRouters = filterAsyncRouter(asyncRouterMap, menus) + let accessedRouters = filterAsyncRouter(asyncRouterMap, menus) + // accessedRouters = filterRedirect(accessedRouters) commit('SET_BTNS', btns) commit('SET_ROUTERS', accessedRouters) resolve(response) diff --git a/src/utils/dateutils.js b/src/utils/dateutils.js index 868111a..5cd16af 100644 --- a/src/utils/dateutils.js +++ b/src/utils/dateutils.js @@ -15,15 +15,15 @@ return ct_month } -export function getLastWeek() { // 默认显示上周 +export function getLastWeek(fmt) { // 默认显示上周 const ct_month = new Date() ct_month.setTime(ct_month.getTime() - 3600 * 1000 * 24 * 7) - return ct_month + return ct_month.Format(fmt) } -export function getLastMonth() { // 默认显示上个月 +export function getLastMonth(fmt) { // 默认显示上个月 const ct_month = new Date() ct_month.setTime(ct_month.getTime() - 3600 * 1000 * 24 * 30) - return ct_month + return ct_month.Format(fmt) } // 对Date的扩展,将 Date 转化为指定格式的String diff --git a/src/utils/exportutils.js b/src/utils/exportutils.js new file mode 100644 index 0000000..b5d0bcf --- /dev/null +++ b/src/utils/exportutils.js @@ -0,0 +1,19 @@ +/** + * 导出文件工具 + * @param blob 文件 + * @param fileName 导出文件名 + */ +export function exportFile(blob, fileName) { + if (window.navigator && window.navigator.msSaveOrOpenBlob) { + navigator.msSaveBlob(blob, fileName) + } else { + const downloadElement = document.createElement('a') + const href = window.URL.createObjectURL(blob) // 创建下载的链接 + downloadElement.href = href + downloadElement.download = fileName + document.body.appendChild(downloadElement) + downloadElement.click() // 点击下载 + document.body.removeChild(downloadElement) // 下载完成移除元素 + window.URL.revokeObjectURL(href) // 释放blob对象 + } +} diff --git a/src/views/mapViews/mapView.vue b/src/views/mapViews/mapView.vue index feba3f6..a18db88 100644 --- a/src/views/mapViews/mapView.vue +++ b/src/views/mapViews/mapView.vue @@ -41,10 +41,7 @@ zoomOffset: 1 } }, - // mapurl: 'http://t1.tianditu.com/vec_w/wmts?layer=vec&style=default&tilematrixset=w&Service=WMTS&Request=GetTile&Version=1.0.0&Format=tiles&TileMatrix={z}&TileCol={x}&TileRow={y}&tk=adbdd8e08c292f6cb4e3f0289f7d0447', mapurl: this.baseConfig.mapUrl, - // mapurl: 'http://webrd01.is.autonavi.com/appmaptile?lang=zh_cn&size=1&scale=1&style=8&x={x}&y={y}&z={z}', - // labelurl: 'http://t1.tianditu.com/cva_w/wmts?layer=cva&style=default&tilematrixset=w&Service=WMTS&Request=GetTile&Version=1.0.0&Format=tiles&TileMatrix={z}&TileCol={x}&TileRow={y}&tk=adbdd8e08c292f6cb4e3f0289f7d0447' labelurl: this.baseConfig.labelUrl } }, diff --git a/src/views/overview/overview.vue b/src/views/overview/overview.vue index b356b46..9525867 100644 --- a/src/views/overview/overview.vue +++ b/src/views/overview/overview.vue @@ -1,30 +1,11 @@ @@ -32,13 +13,11 @@ import L from 'leaflet' import 'leaflet/dist/leaflet.css' import { getDetail } from '@/api/system/bridge' -// import icon from '/static/images/well/0100.png' -// import { getAllMarker } from '@/api/overview' -// import { getMarkerInfo } from '@/api/marker' -// import { lazyAMapApiLoaderInstance } from 'vue-amap' - +import LeafletMap from '@/components/mapWindow/leafletMap' +import ToiletLayer from './toiletLayer' export default { name: 'Overview', + components: { ToiletLayer, LeafletMap }, data() { return { baselayer: [], @@ -72,13 +51,15 @@ loading: false, icon: 'cross', map: null, - msg: 'Welcome to Your Vue.js App' } }, mounted() { - this.initMap() }, methods: { + // 地图加载完毕 + mapReady (map) { + this.map = map + }, initMap() { const map = L.map('map', { minZoom: 2, @@ -150,7 +131,7 @@ diff --git a/src/views/statistics/components/evaluationListDialog.vue b/src/views/statistics/components/evaluationListDialog.vue new file mode 100644 index 0000000..15a9c2f --- /dev/null +++ b/src/views/statistics/components/evaluationListDialog.vue @@ -0,0 +1,120 @@ + + + + + + diff --git a/src/views/statistics/components/workChart.vue b/src/views/statistics/components/workChart.vue new file mode 100644 index 0000000..a891e0c --- /dev/null +++ b/src/views/statistics/components/workChart.vue @@ -0,0 +1,79 @@ + + + + + diff --git a/src/views/statistics/evaluationAssessment.vue b/src/views/statistics/evaluationAssessment.vue new file mode 100644 index 0000000..2193f0e --- /dev/null +++ b/src/views/statistics/evaluationAssessment.vue @@ -0,0 +1,161 @@ + + + + + + diff --git a/src/views/statistics/toiletAssessment.vue b/src/views/statistics/toiletAssessment.vue new file mode 100644 index 0000000..2b8522a --- /dev/null +++ b/src/views/statistics/toiletAssessment.vue @@ -0,0 +1,237 @@ + + + + + diff --git a/src/views/toilet/components/detail.vue b/src/views/toilet/components/detail.vue index 7864470..247c03d 100644 --- a/src/views/toilet/components/detail.vue +++ b/src/views/toilet/components/detail.vue @@ -115,7 +115,7 @@
+ + + + diff --git a/src/components/mapWindow/mapWindow.vue b/src/components/mapWindow/mapWindow.vue new file mode 100644 index 0000000..9ced291 --- /dev/null +++ b/src/components/mapWindow/mapWindow.vue @@ -0,0 +1,46 @@ + + + + + + diff --git a/src/permission.js b/src/permission.js index dc6b2f8..809ca86 100644 --- a/src/permission.js +++ b/src/permission.js @@ -25,8 +25,8 @@ store.dispatch('GetInfo').then(res => { // 拉取用户信息 // 设置当前子系统为基础资源子系统 const currentSys = { - code: 'baseResourse', - name: '基础资源子系统' + code: 'toliet', + name: '公共厕所管理系统' } // 将当前系统信息保存在localStorage中 store.commit('SET_SYSTEM', currentSys) diff --git a/src/router/index.js b/src/router/index.js index 431844b..d23076d 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -43,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 错误页面 diff --git a/src/router/modules/statistics.js b/src/router/modules/statistics.js index 442aa6f..fb9cbea 100644 --- a/src/router/modules/statistics.js +++ b/src/router/modules/statistics.js @@ -5,7 +5,7 @@ { path: 'statisticsToilet', component: Layout, - redirect: '/statisticsToilet', + redirect: '/workStatistics', name: 'StatisticsToilet', meta: { title: '作业统计', @@ -14,10 +14,16 @@ }, children: [ { - path: '/statistics', - name: 'Statistics', - component: () => import('@/views/statistics/workStatistics'), - meta: { title: '作业统计', icon: 'function', permission: ['/statisticsToilet'] } + path: '/workStatistics', + name: 'WorkStatistics', + component: () => import('@/views/statistics/toiletAssessment'), + meta: { title: '作业统计', icon: '', permission: ['/toilet/workStatistics'] } + }, + { + path: '/evaluationStatistics', + name: 'EvaluationStatistics', + component: () => import('@/views/statistics/evaluationAssessment'), + meta: { title: '评价统计', icon: '', permission: ['/toilet/evaluationStatistics'] } } ] } diff --git a/src/router/modules/toilet.js b/src/router/modules/toilet.js index e537ce9..b221a0e 100644 --- a/src/router/modules/toilet.js +++ b/src/router/modules/toilet.js @@ -16,7 +16,7 @@ { path: '/toiletList', name: 'ToiletList', - component: () => import('@/views/toilet/listToilet'), + component: () => import('@/views/toiletManage/toiletList'), meta: { title: '公厕台帐管理', icon: 'function', permission: ['/toiletList'] } }, { diff --git a/src/router/modules/work.js b/src/router/modules/work.js index 3725050..5e0759f 100644 --- a/src/router/modules/work.js +++ b/src/router/modules/work.js @@ -16,7 +16,7 @@ { path: '/toiletWork', name: 'ToiletWork', - component: () => import('@/views/toilet/listWork'), + component: () => import('@/views/toiletClean/toiletCleanList'), meta: { title: '作业管理', icon: 'function', permission: ['/toiletWork'] } } ] diff --git a/src/settings.js b/src/settings.js index b568ce0..b8159bf 100644 --- a/src/settings.js +++ b/src/settings.js @@ -3,7 +3,7 @@ * @type {boolean} true | false * @description 是否显示设置按钮 */ - showSettings: true, + showSettings: false, /** * @type {boolean} true | false diff --git a/src/store/modules/permission.js b/src/store/modules/permission.js index a0cb8cf..3ab50d5 100644 --- a/src/store/modules/permission.js +++ b/src/store/modules/permission.js @@ -120,17 +120,23 @@ }) }, // 获取用户权限 - GetMenus({ commit, state }) { - console.log('in store.permission.js:GetMenus:') + GetMenus({ commit, state }, currentSystem) { + // console.log('in store.permission.js:GetMenus:') + console.log('获取' + currentSystem.name + '的菜单') + const params = { + parentCode: currentSystem.code // 传入该子系统的code,获取子系统的权限 + } return new Promise((resolve, reject) => { - getMenus(state.token).then(response => { // 处理返回值 + // 此处获取用户所有权限 + getMenus(params).then(response => { // 处理返回值 const data = response.data const menus = [] // 仅菜单 const btns = [] // 非菜单 if (data.menus && data.menus.length > 0) { - commit('SET_MENUS', data.menus) - for (const menu of data.menus) { // 遍历菜单,获取所有的权限项 - if (menu.ismenu === '1') { // 将是菜单的放入menus + const allmenus = [...data.menus] + commit('SET_MENUS', allmenus) + for (const menu of allmenus) { // 遍历菜单,获取所有的权限项 + if (menu.resourceType === '02' || menu.resourceType === '03') { // 将是菜单的放入menus const menu_tmp = {} menu_tmp.url = menu.url menu_tmp.icon = menu.icon @@ -142,11 +148,11 @@ btn_tmp.name = menu.name btn_tmp.icon = menu.icon btns.push(btn_tmp) - // console.log(menu.url) } } // 过滤路由表 - const accessedRouters = filterAsyncRouter(asyncRouterMap, menus) + let accessedRouters = filterAsyncRouter(asyncRouterMap, menus) + // accessedRouters = filterRedirect(accessedRouters) commit('SET_BTNS', btns) commit('SET_ROUTERS', accessedRouters) resolve(response) diff --git a/src/utils/dateutils.js b/src/utils/dateutils.js index 868111a..5cd16af 100644 --- a/src/utils/dateutils.js +++ b/src/utils/dateutils.js @@ -15,15 +15,15 @@ return ct_month } -export function getLastWeek() { // 默认显示上周 +export function getLastWeek(fmt) { // 默认显示上周 const ct_month = new Date() ct_month.setTime(ct_month.getTime() - 3600 * 1000 * 24 * 7) - return ct_month + return ct_month.Format(fmt) } -export function getLastMonth() { // 默认显示上个月 +export function getLastMonth(fmt) { // 默认显示上个月 const ct_month = new Date() ct_month.setTime(ct_month.getTime() - 3600 * 1000 * 24 * 30) - return ct_month + return ct_month.Format(fmt) } // 对Date的扩展,将 Date 转化为指定格式的String diff --git a/src/utils/exportutils.js b/src/utils/exportutils.js new file mode 100644 index 0000000..b5d0bcf --- /dev/null +++ b/src/utils/exportutils.js @@ -0,0 +1,19 @@ +/** + * 导出文件工具 + * @param blob 文件 + * @param fileName 导出文件名 + */ +export function exportFile(blob, fileName) { + if (window.navigator && window.navigator.msSaveOrOpenBlob) { + navigator.msSaveBlob(blob, fileName) + } else { + const downloadElement = document.createElement('a') + const href = window.URL.createObjectURL(blob) // 创建下载的链接 + downloadElement.href = href + downloadElement.download = fileName + document.body.appendChild(downloadElement) + downloadElement.click() // 点击下载 + document.body.removeChild(downloadElement) // 下载完成移除元素 + window.URL.revokeObjectURL(href) // 释放blob对象 + } +} diff --git a/src/views/mapViews/mapView.vue b/src/views/mapViews/mapView.vue index feba3f6..a18db88 100644 --- a/src/views/mapViews/mapView.vue +++ b/src/views/mapViews/mapView.vue @@ -41,10 +41,7 @@ zoomOffset: 1 } }, - // mapurl: 'http://t1.tianditu.com/vec_w/wmts?layer=vec&style=default&tilematrixset=w&Service=WMTS&Request=GetTile&Version=1.0.0&Format=tiles&TileMatrix={z}&TileCol={x}&TileRow={y}&tk=adbdd8e08c292f6cb4e3f0289f7d0447', mapurl: this.baseConfig.mapUrl, - // mapurl: 'http://webrd01.is.autonavi.com/appmaptile?lang=zh_cn&size=1&scale=1&style=8&x={x}&y={y}&z={z}', - // labelurl: 'http://t1.tianditu.com/cva_w/wmts?layer=cva&style=default&tilematrixset=w&Service=WMTS&Request=GetTile&Version=1.0.0&Format=tiles&TileMatrix={z}&TileCol={x}&TileRow={y}&tk=adbdd8e08c292f6cb4e3f0289f7d0447' labelurl: this.baseConfig.labelUrl } }, diff --git a/src/views/overview/overview.vue b/src/views/overview/overview.vue index b356b46..9525867 100644 --- a/src/views/overview/overview.vue +++ b/src/views/overview/overview.vue @@ -1,30 +1,11 @@ @@ -32,13 +13,11 @@ import L from 'leaflet' import 'leaflet/dist/leaflet.css' import { getDetail } from '@/api/system/bridge' -// import icon from '/static/images/well/0100.png' -// import { getAllMarker } from '@/api/overview' -// import { getMarkerInfo } from '@/api/marker' -// import { lazyAMapApiLoaderInstance } from 'vue-amap' - +import LeafletMap from '@/components/mapWindow/leafletMap' +import ToiletLayer from './toiletLayer' export default { name: 'Overview', + components: { ToiletLayer, LeafletMap }, data() { return { baselayer: [], @@ -72,13 +51,15 @@ loading: false, icon: 'cross', map: null, - msg: 'Welcome to Your Vue.js App' } }, mounted() { - this.initMap() }, methods: { + // 地图加载完毕 + mapReady (map) { + this.map = map + }, initMap() { const map = L.map('map', { minZoom: 2, @@ -150,7 +131,7 @@ diff --git a/src/views/statistics/components/evaluationListDialog.vue b/src/views/statistics/components/evaluationListDialog.vue new file mode 100644 index 0000000..15a9c2f --- /dev/null +++ b/src/views/statistics/components/evaluationListDialog.vue @@ -0,0 +1,120 @@ + + + + + + diff --git a/src/views/statistics/components/workChart.vue b/src/views/statistics/components/workChart.vue new file mode 100644 index 0000000..a891e0c --- /dev/null +++ b/src/views/statistics/components/workChart.vue @@ -0,0 +1,79 @@ + + + + + diff --git a/src/views/statistics/evaluationAssessment.vue b/src/views/statistics/evaluationAssessment.vue new file mode 100644 index 0000000..2193f0e --- /dev/null +++ b/src/views/statistics/evaluationAssessment.vue @@ -0,0 +1,161 @@ + + + + + + diff --git a/src/views/statistics/toiletAssessment.vue b/src/views/statistics/toiletAssessment.vue new file mode 100644 index 0000000..2b8522a --- /dev/null +++ b/src/views/statistics/toiletAssessment.vue @@ -0,0 +1,237 @@ + + + + + diff --git a/src/views/toilet/components/detail.vue b/src/views/toilet/components/detail.vue index 7864470..247c03d 100644 --- a/src/views/toilet/components/detail.vue +++ b/src/views/toilet/components/detail.vue @@ -115,7 +115,7 @@
+ + diff --git a/package.json b/package.json index f8c5e2a..9f3a3eb 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "echarts": "^4.2.1", "element-ui": "2.13.0", "event-source-polyfill": "^1.0.5", + "file-saver": "^2.0.5", "js-cookie": "2.2.0", "jsencrypt": "^3.0.0-rc.1", "leaflet": "^1.7.1", @@ -34,7 +35,8 @@ "vue-baidu-map": "^0.21.22", "vue-router": "3.0.1", "vue2-leaflet": "^2.7.0", - "vuex": "3.0.1" + "vuex": "3.0.1", + "xlsx": "^0.17.0" }, "devDependencies": { "autoprefixer": "8.5.0", diff --git a/src/api/sanitation/statistics.js b/src/api/sanitation/statistics.js new file mode 100644 index 0000000..2ca7549 --- /dev/null +++ b/src/api/sanitation/statistics.js @@ -0,0 +1,13 @@ + +/** + * 考核统计接口 + */ +import request from '@/utils/request' +// 公厕保洁次数统计 +export function getToiletJobCount(params) { + return request({ + url: '/sanitation/statistic/toilet/jobCount', + method: 'get', + params + }) +} diff --git a/src/api/sanitation/toilet.js b/src/api/sanitation/toilet.js new file mode 100644 index 0000000..10fd245 --- /dev/null +++ b/src/api/sanitation/toilet.js @@ -0,0 +1,97 @@ +/** + * 公厕管理接口 + */ +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 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/toilet.js b/src/api/system/toilet.js deleted file mode 100644 index 8f38b8f..0000000 --- a/src/api/system/toilet.js +++ /dev/null @@ -1,91 +0,0 @@ -/** - * 公厕管理接口 - */ -import request from '@/utils/request' -import qs from 'qs' -export function getToiletList(params) { - return request({ - url: '/sanitation/toilet/listPage', - method: 'get', - params - }) -} - -export function getDetail(id) { - return request({ - url: '/sanitation/toiletClean/detail', - method: 'get', - params: { - id: id - } - }) -} - -// 公厕查询 -export function getToiletAll() { - return request({ - url: '/sanitation/toilet/listPage', - method: 'get' - }) -} - -// 添加公厕 -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 exportRecords(params) { - return request({ - url: 'device/batchExport', - method: 'get', - timeout: 120000, - params, - 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/assets/global_images/toilet.png b/src/assets/global_images/toilet.png new file mode 100644 index 0000000..6d9fc05 --- /dev/null +++ b/src/assets/global_images/toilet.png Binary files differ diff --git a/src/components/NormalTable/index.vue b/src/components/NormalTable/index.vue index 5077bef..04d322d 100644 --- a/src/components/NormalTable/index.vue +++ b/src/components/NormalTable/index.vue @@ -79,7 +79,7 @@
-
+
Object.assign(obj, { [key]: this[key] }), {}), + on: events.reduce((obj, key) => Object.assign(obj, { [key]: this.transmitEvent }), {}) + }) + } + this.props = [...extraProps, ...props.filter(prop => exceptProps.indexOf(prop))] + } +} + +export default prop => new Mixin(prop) diff --git a/src/components/mapWindow/base/mixins/common.js b/src/components/mapWindow/base/mixins/common.js new file mode 100644 index 0000000..2fd1a28 --- /dev/null +++ b/src/components/mapWindow/base/mixins/common.js @@ -0,0 +1,82 @@ +const types = { + map: { + unload: 'clearMap' + }, + control: { + unload: 'removeControl' + }, + layer: { + unload: 'removeLayer' + }, + features: { + unload: 'removeFeatures' + }, + listener: { + unload: 'removeListener' + } +} + +const getParent = $component => ($component.abstract || $component.$el === $component.$children[0].$el) ? getParent($component.$parent) : $component + +function destroyInstance () { + const { unload, renderByParent, $parent } = this + if (renderByParent) { + $parent.reload() + } + unload() +} + +class Mixin { + constructor (prop) { + this.methods = { + ready () { + const $parent = getParent(this.$parent) + const map = this.map = $parent.map + this.load() + this.$emit('ready', { + map + }) + }, + transmitEvent (e) { + this.$emit(e.type.replace(/^on/, ''), e) + }, + reload () { + this && this.$nextTick(() => { + this.unload() + this.$nextTick(this.load) + }) + }, + unload () { + const { map, originInstance } = this + try { + switch (prop.type) { + case 'search': + return originInstance.clearResults() + case 'autoComplete': + case 'lushu': + return originInstance.dispose() + case 'markerClusterer': + return originInstance.clearMarkers() + default: + map[types[prop.type].unload](originInstance) + } + } catch (e) {} + } + } + this.computed = { + renderByParent () { + return this.$parent.preventChildrenRender + } + } + this.mounted = function () { + console.log('common mounted') + const $parent = getParent(this.$parent) + const map = $parent.map + const { ready } = this + console.log(map) + map ? ready() : $parent.$on('onload', ready) + } + } +} + +export default type => new Mixin({ type }) diff --git a/src/components/mapWindow/leafletMap.vue b/src/components/mapWindow/leafletMap.vue new file mode 100644 index 0000000..931a5e9 --- /dev/null +++ b/src/components/mapWindow/leafletMap.vue @@ -0,0 +1,132 @@ + + + + + + + diff --git a/src/components/mapWindow/mapWindow.vue b/src/components/mapWindow/mapWindow.vue new file mode 100644 index 0000000..9ced291 --- /dev/null +++ b/src/components/mapWindow/mapWindow.vue @@ -0,0 +1,46 @@ + + + + + + diff --git a/src/permission.js b/src/permission.js index dc6b2f8..809ca86 100644 --- a/src/permission.js +++ b/src/permission.js @@ -25,8 +25,8 @@ store.dispatch('GetInfo').then(res => { // 拉取用户信息 // 设置当前子系统为基础资源子系统 const currentSys = { - code: 'baseResourse', - name: '基础资源子系统' + code: 'toliet', + name: '公共厕所管理系统' } // 将当前系统信息保存在localStorage中 store.commit('SET_SYSTEM', currentSys) diff --git a/src/router/index.js b/src/router/index.js index 431844b..d23076d 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -43,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 错误页面 diff --git a/src/router/modules/statistics.js b/src/router/modules/statistics.js index 442aa6f..fb9cbea 100644 --- a/src/router/modules/statistics.js +++ b/src/router/modules/statistics.js @@ -5,7 +5,7 @@ { path: 'statisticsToilet', component: Layout, - redirect: '/statisticsToilet', + redirect: '/workStatistics', name: 'StatisticsToilet', meta: { title: '作业统计', @@ -14,10 +14,16 @@ }, children: [ { - path: '/statistics', - name: 'Statistics', - component: () => import('@/views/statistics/workStatistics'), - meta: { title: '作业统计', icon: 'function', permission: ['/statisticsToilet'] } + path: '/workStatistics', + name: 'WorkStatistics', + component: () => import('@/views/statistics/toiletAssessment'), + meta: { title: '作业统计', icon: '', permission: ['/toilet/workStatistics'] } + }, + { + path: '/evaluationStatistics', + name: 'EvaluationStatistics', + component: () => import('@/views/statistics/evaluationAssessment'), + meta: { title: '评价统计', icon: '', permission: ['/toilet/evaluationStatistics'] } } ] } diff --git a/src/router/modules/toilet.js b/src/router/modules/toilet.js index e537ce9..b221a0e 100644 --- a/src/router/modules/toilet.js +++ b/src/router/modules/toilet.js @@ -16,7 +16,7 @@ { path: '/toiletList', name: 'ToiletList', - component: () => import('@/views/toilet/listToilet'), + component: () => import('@/views/toiletManage/toiletList'), meta: { title: '公厕台帐管理', icon: 'function', permission: ['/toiletList'] } }, { diff --git a/src/router/modules/work.js b/src/router/modules/work.js index 3725050..5e0759f 100644 --- a/src/router/modules/work.js +++ b/src/router/modules/work.js @@ -16,7 +16,7 @@ { path: '/toiletWork', name: 'ToiletWork', - component: () => import('@/views/toilet/listWork'), + component: () => import('@/views/toiletClean/toiletCleanList'), meta: { title: '作业管理', icon: 'function', permission: ['/toiletWork'] } } ] diff --git a/src/settings.js b/src/settings.js index b568ce0..b8159bf 100644 --- a/src/settings.js +++ b/src/settings.js @@ -3,7 +3,7 @@ * @type {boolean} true | false * @description 是否显示设置按钮 */ - showSettings: true, + showSettings: false, /** * @type {boolean} true | false diff --git a/src/store/modules/permission.js b/src/store/modules/permission.js index a0cb8cf..3ab50d5 100644 --- a/src/store/modules/permission.js +++ b/src/store/modules/permission.js @@ -120,17 +120,23 @@ }) }, // 获取用户权限 - GetMenus({ commit, state }) { - console.log('in store.permission.js:GetMenus:') + GetMenus({ commit, state }, currentSystem) { + // console.log('in store.permission.js:GetMenus:') + console.log('获取' + currentSystem.name + '的菜单') + const params = { + parentCode: currentSystem.code // 传入该子系统的code,获取子系统的权限 + } return new Promise((resolve, reject) => { - getMenus(state.token).then(response => { // 处理返回值 + // 此处获取用户所有权限 + getMenus(params).then(response => { // 处理返回值 const data = response.data const menus = [] // 仅菜单 const btns = [] // 非菜单 if (data.menus && data.menus.length > 0) { - commit('SET_MENUS', data.menus) - for (const menu of data.menus) { // 遍历菜单,获取所有的权限项 - if (menu.ismenu === '1') { // 将是菜单的放入menus + const allmenus = [...data.menus] + commit('SET_MENUS', allmenus) + for (const menu of allmenus) { // 遍历菜单,获取所有的权限项 + if (menu.resourceType === '02' || menu.resourceType === '03') { // 将是菜单的放入menus const menu_tmp = {} menu_tmp.url = menu.url menu_tmp.icon = menu.icon @@ -142,11 +148,11 @@ btn_tmp.name = menu.name btn_tmp.icon = menu.icon btns.push(btn_tmp) - // console.log(menu.url) } } // 过滤路由表 - const accessedRouters = filterAsyncRouter(asyncRouterMap, menus) + let accessedRouters = filterAsyncRouter(asyncRouterMap, menus) + // accessedRouters = filterRedirect(accessedRouters) commit('SET_BTNS', btns) commit('SET_ROUTERS', accessedRouters) resolve(response) diff --git a/src/utils/dateutils.js b/src/utils/dateutils.js index 868111a..5cd16af 100644 --- a/src/utils/dateutils.js +++ b/src/utils/dateutils.js @@ -15,15 +15,15 @@ return ct_month } -export function getLastWeek() { // 默认显示上周 +export function getLastWeek(fmt) { // 默认显示上周 const ct_month = new Date() ct_month.setTime(ct_month.getTime() - 3600 * 1000 * 24 * 7) - return ct_month + return ct_month.Format(fmt) } -export function getLastMonth() { // 默认显示上个月 +export function getLastMonth(fmt) { // 默认显示上个月 const ct_month = new Date() ct_month.setTime(ct_month.getTime() - 3600 * 1000 * 24 * 30) - return ct_month + return ct_month.Format(fmt) } // 对Date的扩展,将 Date 转化为指定格式的String diff --git a/src/utils/exportutils.js b/src/utils/exportutils.js new file mode 100644 index 0000000..b5d0bcf --- /dev/null +++ b/src/utils/exportutils.js @@ -0,0 +1,19 @@ +/** + * 导出文件工具 + * @param blob 文件 + * @param fileName 导出文件名 + */ +export function exportFile(blob, fileName) { + if (window.navigator && window.navigator.msSaveOrOpenBlob) { + navigator.msSaveBlob(blob, fileName) + } else { + const downloadElement = document.createElement('a') + const href = window.URL.createObjectURL(blob) // 创建下载的链接 + downloadElement.href = href + downloadElement.download = fileName + document.body.appendChild(downloadElement) + downloadElement.click() // 点击下载 + document.body.removeChild(downloadElement) // 下载完成移除元素 + window.URL.revokeObjectURL(href) // 释放blob对象 + } +} diff --git a/src/views/mapViews/mapView.vue b/src/views/mapViews/mapView.vue index feba3f6..a18db88 100644 --- a/src/views/mapViews/mapView.vue +++ b/src/views/mapViews/mapView.vue @@ -41,10 +41,7 @@ zoomOffset: 1 } }, - // mapurl: 'http://t1.tianditu.com/vec_w/wmts?layer=vec&style=default&tilematrixset=w&Service=WMTS&Request=GetTile&Version=1.0.0&Format=tiles&TileMatrix={z}&TileCol={x}&TileRow={y}&tk=adbdd8e08c292f6cb4e3f0289f7d0447', mapurl: this.baseConfig.mapUrl, - // mapurl: 'http://webrd01.is.autonavi.com/appmaptile?lang=zh_cn&size=1&scale=1&style=8&x={x}&y={y}&z={z}', - // labelurl: 'http://t1.tianditu.com/cva_w/wmts?layer=cva&style=default&tilematrixset=w&Service=WMTS&Request=GetTile&Version=1.0.0&Format=tiles&TileMatrix={z}&TileCol={x}&TileRow={y}&tk=adbdd8e08c292f6cb4e3f0289f7d0447' labelurl: this.baseConfig.labelUrl } }, diff --git a/src/views/overview/overview.vue b/src/views/overview/overview.vue index b356b46..9525867 100644 --- a/src/views/overview/overview.vue +++ b/src/views/overview/overview.vue @@ -1,30 +1,11 @@ @@ -32,13 +13,11 @@ import L from 'leaflet' import 'leaflet/dist/leaflet.css' import { getDetail } from '@/api/system/bridge' -// import icon from '/static/images/well/0100.png' -// import { getAllMarker } from '@/api/overview' -// import { getMarkerInfo } from '@/api/marker' -// import { lazyAMapApiLoaderInstance } from 'vue-amap' - +import LeafletMap from '@/components/mapWindow/leafletMap' +import ToiletLayer from './toiletLayer' export default { name: 'Overview', + components: { ToiletLayer, LeafletMap }, data() { return { baselayer: [], @@ -72,13 +51,15 @@ loading: false, icon: 'cross', map: null, - msg: 'Welcome to Your Vue.js App' } }, mounted() { - this.initMap() }, methods: { + // 地图加载完毕 + mapReady (map) { + this.map = map + }, initMap() { const map = L.map('map', { minZoom: 2, @@ -150,7 +131,7 @@ diff --git a/src/views/statistics/components/evaluationListDialog.vue b/src/views/statistics/components/evaluationListDialog.vue new file mode 100644 index 0000000..15a9c2f --- /dev/null +++ b/src/views/statistics/components/evaluationListDialog.vue @@ -0,0 +1,120 @@ + + + + + + diff --git a/src/views/statistics/components/workChart.vue b/src/views/statistics/components/workChart.vue new file mode 100644 index 0000000..a891e0c --- /dev/null +++ b/src/views/statistics/components/workChart.vue @@ -0,0 +1,79 @@ + + + + + diff --git a/src/views/statistics/evaluationAssessment.vue b/src/views/statistics/evaluationAssessment.vue new file mode 100644 index 0000000..2193f0e --- /dev/null +++ b/src/views/statistics/evaluationAssessment.vue @@ -0,0 +1,161 @@ + + + + + + diff --git a/src/views/statistics/toiletAssessment.vue b/src/views/statistics/toiletAssessment.vue new file mode 100644 index 0000000..2b8522a --- /dev/null +++ b/src/views/statistics/toiletAssessment.vue @@ -0,0 +1,237 @@ + + + + + diff --git a/src/views/toilet/components/detail.vue b/src/views/toilet/components/detail.vue index 7864470..247c03d 100644 --- a/src/views/toilet/components/detail.vue +++ b/src/views/toilet/components/detail.vue @@ -115,7 +115,7 @@
+ + diff --git a/src/views/toiletManage/editToilet.vue b/src/views/toiletManage/editToilet.vue new file mode 100644 index 0000000..e797eec --- /dev/null +++ b/src/views/toiletManage/editToilet.vue @@ -0,0 +1,408 @@ + + + + + + diff --git a/package.json b/package.json index f8c5e2a..9f3a3eb 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "echarts": "^4.2.1", "element-ui": "2.13.0", "event-source-polyfill": "^1.0.5", + "file-saver": "^2.0.5", "js-cookie": "2.2.0", "jsencrypt": "^3.0.0-rc.1", "leaflet": "^1.7.1", @@ -34,7 +35,8 @@ "vue-baidu-map": "^0.21.22", "vue-router": "3.0.1", "vue2-leaflet": "^2.7.0", - "vuex": "3.0.1" + "vuex": "3.0.1", + "xlsx": "^0.17.0" }, "devDependencies": { "autoprefixer": "8.5.0", diff --git a/src/api/sanitation/statistics.js b/src/api/sanitation/statistics.js new file mode 100644 index 0000000..2ca7549 --- /dev/null +++ b/src/api/sanitation/statistics.js @@ -0,0 +1,13 @@ + +/** + * 考核统计接口 + */ +import request from '@/utils/request' +// 公厕保洁次数统计 +export function getToiletJobCount(params) { + return request({ + url: '/sanitation/statistic/toilet/jobCount', + method: 'get', + params + }) +} diff --git a/src/api/sanitation/toilet.js b/src/api/sanitation/toilet.js new file mode 100644 index 0000000..10fd245 --- /dev/null +++ b/src/api/sanitation/toilet.js @@ -0,0 +1,97 @@ +/** + * 公厕管理接口 + */ +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 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/toilet.js b/src/api/system/toilet.js deleted file mode 100644 index 8f38b8f..0000000 --- a/src/api/system/toilet.js +++ /dev/null @@ -1,91 +0,0 @@ -/** - * 公厕管理接口 - */ -import request from '@/utils/request' -import qs from 'qs' -export function getToiletList(params) { - return request({ - url: '/sanitation/toilet/listPage', - method: 'get', - params - }) -} - -export function getDetail(id) { - return request({ - url: '/sanitation/toiletClean/detail', - method: 'get', - params: { - id: id - } - }) -} - -// 公厕查询 -export function getToiletAll() { - return request({ - url: '/sanitation/toilet/listPage', - method: 'get' - }) -} - -// 添加公厕 -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 exportRecords(params) { - return request({ - url: 'device/batchExport', - method: 'get', - timeout: 120000, - params, - 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/assets/global_images/toilet.png b/src/assets/global_images/toilet.png new file mode 100644 index 0000000..6d9fc05 --- /dev/null +++ b/src/assets/global_images/toilet.png Binary files differ diff --git a/src/components/NormalTable/index.vue b/src/components/NormalTable/index.vue index 5077bef..04d322d 100644 --- a/src/components/NormalTable/index.vue +++ b/src/components/NormalTable/index.vue @@ -79,7 +79,7 @@
-
+
Object.assign(obj, { [key]: this[key] }), {}), + on: events.reduce((obj, key) => Object.assign(obj, { [key]: this.transmitEvent }), {}) + }) + } + this.props = [...extraProps, ...props.filter(prop => exceptProps.indexOf(prop))] + } +} + +export default prop => new Mixin(prop) diff --git a/src/components/mapWindow/base/mixins/common.js b/src/components/mapWindow/base/mixins/common.js new file mode 100644 index 0000000..2fd1a28 --- /dev/null +++ b/src/components/mapWindow/base/mixins/common.js @@ -0,0 +1,82 @@ +const types = { + map: { + unload: 'clearMap' + }, + control: { + unload: 'removeControl' + }, + layer: { + unload: 'removeLayer' + }, + features: { + unload: 'removeFeatures' + }, + listener: { + unload: 'removeListener' + } +} + +const getParent = $component => ($component.abstract || $component.$el === $component.$children[0].$el) ? getParent($component.$parent) : $component + +function destroyInstance () { + const { unload, renderByParent, $parent } = this + if (renderByParent) { + $parent.reload() + } + unload() +} + +class Mixin { + constructor (prop) { + this.methods = { + ready () { + const $parent = getParent(this.$parent) + const map = this.map = $parent.map + this.load() + this.$emit('ready', { + map + }) + }, + transmitEvent (e) { + this.$emit(e.type.replace(/^on/, ''), e) + }, + reload () { + this && this.$nextTick(() => { + this.unload() + this.$nextTick(this.load) + }) + }, + unload () { + const { map, originInstance } = this + try { + switch (prop.type) { + case 'search': + return originInstance.clearResults() + case 'autoComplete': + case 'lushu': + return originInstance.dispose() + case 'markerClusterer': + return originInstance.clearMarkers() + default: + map[types[prop.type].unload](originInstance) + } + } catch (e) {} + } + } + this.computed = { + renderByParent () { + return this.$parent.preventChildrenRender + } + } + this.mounted = function () { + console.log('common mounted') + const $parent = getParent(this.$parent) + const map = $parent.map + const { ready } = this + console.log(map) + map ? ready() : $parent.$on('onload', ready) + } + } +} + +export default type => new Mixin({ type }) diff --git a/src/components/mapWindow/leafletMap.vue b/src/components/mapWindow/leafletMap.vue new file mode 100644 index 0000000..931a5e9 --- /dev/null +++ b/src/components/mapWindow/leafletMap.vue @@ -0,0 +1,132 @@ + + + + + + + diff --git a/src/components/mapWindow/mapWindow.vue b/src/components/mapWindow/mapWindow.vue new file mode 100644 index 0000000..9ced291 --- /dev/null +++ b/src/components/mapWindow/mapWindow.vue @@ -0,0 +1,46 @@ + + + + + + diff --git a/src/permission.js b/src/permission.js index dc6b2f8..809ca86 100644 --- a/src/permission.js +++ b/src/permission.js @@ -25,8 +25,8 @@ store.dispatch('GetInfo').then(res => { // 拉取用户信息 // 设置当前子系统为基础资源子系统 const currentSys = { - code: 'baseResourse', - name: '基础资源子系统' + code: 'toliet', + name: '公共厕所管理系统' } // 将当前系统信息保存在localStorage中 store.commit('SET_SYSTEM', currentSys) diff --git a/src/router/index.js b/src/router/index.js index 431844b..d23076d 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -43,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 错误页面 diff --git a/src/router/modules/statistics.js b/src/router/modules/statistics.js index 442aa6f..fb9cbea 100644 --- a/src/router/modules/statistics.js +++ b/src/router/modules/statistics.js @@ -5,7 +5,7 @@ { path: 'statisticsToilet', component: Layout, - redirect: '/statisticsToilet', + redirect: '/workStatistics', name: 'StatisticsToilet', meta: { title: '作业统计', @@ -14,10 +14,16 @@ }, children: [ { - path: '/statistics', - name: 'Statistics', - component: () => import('@/views/statistics/workStatistics'), - meta: { title: '作业统计', icon: 'function', permission: ['/statisticsToilet'] } + path: '/workStatistics', + name: 'WorkStatistics', + component: () => import('@/views/statistics/toiletAssessment'), + meta: { title: '作业统计', icon: '', permission: ['/toilet/workStatistics'] } + }, + { + path: '/evaluationStatistics', + name: 'EvaluationStatistics', + component: () => import('@/views/statistics/evaluationAssessment'), + meta: { title: '评价统计', icon: '', permission: ['/toilet/evaluationStatistics'] } } ] } diff --git a/src/router/modules/toilet.js b/src/router/modules/toilet.js index e537ce9..b221a0e 100644 --- a/src/router/modules/toilet.js +++ b/src/router/modules/toilet.js @@ -16,7 +16,7 @@ { path: '/toiletList', name: 'ToiletList', - component: () => import('@/views/toilet/listToilet'), + component: () => import('@/views/toiletManage/toiletList'), meta: { title: '公厕台帐管理', icon: 'function', permission: ['/toiletList'] } }, { diff --git a/src/router/modules/work.js b/src/router/modules/work.js index 3725050..5e0759f 100644 --- a/src/router/modules/work.js +++ b/src/router/modules/work.js @@ -16,7 +16,7 @@ { path: '/toiletWork', name: 'ToiletWork', - component: () => import('@/views/toilet/listWork'), + component: () => import('@/views/toiletClean/toiletCleanList'), meta: { title: '作业管理', icon: 'function', permission: ['/toiletWork'] } } ] diff --git a/src/settings.js b/src/settings.js index b568ce0..b8159bf 100644 --- a/src/settings.js +++ b/src/settings.js @@ -3,7 +3,7 @@ * @type {boolean} true | false * @description 是否显示设置按钮 */ - showSettings: true, + showSettings: false, /** * @type {boolean} true | false diff --git a/src/store/modules/permission.js b/src/store/modules/permission.js index a0cb8cf..3ab50d5 100644 --- a/src/store/modules/permission.js +++ b/src/store/modules/permission.js @@ -120,17 +120,23 @@ }) }, // 获取用户权限 - GetMenus({ commit, state }) { - console.log('in store.permission.js:GetMenus:') + GetMenus({ commit, state }, currentSystem) { + // console.log('in store.permission.js:GetMenus:') + console.log('获取' + currentSystem.name + '的菜单') + const params = { + parentCode: currentSystem.code // 传入该子系统的code,获取子系统的权限 + } return new Promise((resolve, reject) => { - getMenus(state.token).then(response => { // 处理返回值 + // 此处获取用户所有权限 + getMenus(params).then(response => { // 处理返回值 const data = response.data const menus = [] // 仅菜单 const btns = [] // 非菜单 if (data.menus && data.menus.length > 0) { - commit('SET_MENUS', data.menus) - for (const menu of data.menus) { // 遍历菜单,获取所有的权限项 - if (menu.ismenu === '1') { // 将是菜单的放入menus + const allmenus = [...data.menus] + commit('SET_MENUS', allmenus) + for (const menu of allmenus) { // 遍历菜单,获取所有的权限项 + if (menu.resourceType === '02' || menu.resourceType === '03') { // 将是菜单的放入menus const menu_tmp = {} menu_tmp.url = menu.url menu_tmp.icon = menu.icon @@ -142,11 +148,11 @@ btn_tmp.name = menu.name btn_tmp.icon = menu.icon btns.push(btn_tmp) - // console.log(menu.url) } } // 过滤路由表 - const accessedRouters = filterAsyncRouter(asyncRouterMap, menus) + let accessedRouters = filterAsyncRouter(asyncRouterMap, menus) + // accessedRouters = filterRedirect(accessedRouters) commit('SET_BTNS', btns) commit('SET_ROUTERS', accessedRouters) resolve(response) diff --git a/src/utils/dateutils.js b/src/utils/dateutils.js index 868111a..5cd16af 100644 --- a/src/utils/dateutils.js +++ b/src/utils/dateutils.js @@ -15,15 +15,15 @@ return ct_month } -export function getLastWeek() { // 默认显示上周 +export function getLastWeek(fmt) { // 默认显示上周 const ct_month = new Date() ct_month.setTime(ct_month.getTime() - 3600 * 1000 * 24 * 7) - return ct_month + return ct_month.Format(fmt) } -export function getLastMonth() { // 默认显示上个月 +export function getLastMonth(fmt) { // 默认显示上个月 const ct_month = new Date() ct_month.setTime(ct_month.getTime() - 3600 * 1000 * 24 * 30) - return ct_month + return ct_month.Format(fmt) } // 对Date的扩展,将 Date 转化为指定格式的String diff --git a/src/utils/exportutils.js b/src/utils/exportutils.js new file mode 100644 index 0000000..b5d0bcf --- /dev/null +++ b/src/utils/exportutils.js @@ -0,0 +1,19 @@ +/** + * 导出文件工具 + * @param blob 文件 + * @param fileName 导出文件名 + */ +export function exportFile(blob, fileName) { + if (window.navigator && window.navigator.msSaveOrOpenBlob) { + navigator.msSaveBlob(blob, fileName) + } else { + const downloadElement = document.createElement('a') + const href = window.URL.createObjectURL(blob) // 创建下载的链接 + downloadElement.href = href + downloadElement.download = fileName + document.body.appendChild(downloadElement) + downloadElement.click() // 点击下载 + document.body.removeChild(downloadElement) // 下载完成移除元素 + window.URL.revokeObjectURL(href) // 释放blob对象 + } +} diff --git a/src/views/mapViews/mapView.vue b/src/views/mapViews/mapView.vue index feba3f6..a18db88 100644 --- a/src/views/mapViews/mapView.vue +++ b/src/views/mapViews/mapView.vue @@ -41,10 +41,7 @@ zoomOffset: 1 } }, - // mapurl: 'http://t1.tianditu.com/vec_w/wmts?layer=vec&style=default&tilematrixset=w&Service=WMTS&Request=GetTile&Version=1.0.0&Format=tiles&TileMatrix={z}&TileCol={x}&TileRow={y}&tk=adbdd8e08c292f6cb4e3f0289f7d0447', mapurl: this.baseConfig.mapUrl, - // mapurl: 'http://webrd01.is.autonavi.com/appmaptile?lang=zh_cn&size=1&scale=1&style=8&x={x}&y={y}&z={z}', - // labelurl: 'http://t1.tianditu.com/cva_w/wmts?layer=cva&style=default&tilematrixset=w&Service=WMTS&Request=GetTile&Version=1.0.0&Format=tiles&TileMatrix={z}&TileCol={x}&TileRow={y}&tk=adbdd8e08c292f6cb4e3f0289f7d0447' labelurl: this.baseConfig.labelUrl } }, diff --git a/src/views/overview/overview.vue b/src/views/overview/overview.vue index b356b46..9525867 100644 --- a/src/views/overview/overview.vue +++ b/src/views/overview/overview.vue @@ -1,30 +1,11 @@ @@ -32,13 +13,11 @@ import L from 'leaflet' import 'leaflet/dist/leaflet.css' import { getDetail } from '@/api/system/bridge' -// import icon from '/static/images/well/0100.png' -// import { getAllMarker } from '@/api/overview' -// import { getMarkerInfo } from '@/api/marker' -// import { lazyAMapApiLoaderInstance } from 'vue-amap' - +import LeafletMap from '@/components/mapWindow/leafletMap' +import ToiletLayer from './toiletLayer' export default { name: 'Overview', + components: { ToiletLayer, LeafletMap }, data() { return { baselayer: [], @@ -72,13 +51,15 @@ loading: false, icon: 'cross', map: null, - msg: 'Welcome to Your Vue.js App' } }, mounted() { - this.initMap() }, methods: { + // 地图加载完毕 + mapReady (map) { + this.map = map + }, initMap() { const map = L.map('map', { minZoom: 2, @@ -150,7 +131,7 @@ diff --git a/src/views/statistics/components/evaluationListDialog.vue b/src/views/statistics/components/evaluationListDialog.vue new file mode 100644 index 0000000..15a9c2f --- /dev/null +++ b/src/views/statistics/components/evaluationListDialog.vue @@ -0,0 +1,120 @@ + + + + + + diff --git a/src/views/statistics/components/workChart.vue b/src/views/statistics/components/workChart.vue new file mode 100644 index 0000000..a891e0c --- /dev/null +++ b/src/views/statistics/components/workChart.vue @@ -0,0 +1,79 @@ + + + + + diff --git a/src/views/statistics/evaluationAssessment.vue b/src/views/statistics/evaluationAssessment.vue new file mode 100644 index 0000000..2193f0e --- /dev/null +++ b/src/views/statistics/evaluationAssessment.vue @@ -0,0 +1,161 @@ + + + + + + diff --git a/src/views/statistics/toiletAssessment.vue b/src/views/statistics/toiletAssessment.vue new file mode 100644 index 0000000..2b8522a --- /dev/null +++ b/src/views/statistics/toiletAssessment.vue @@ -0,0 +1,237 @@ + + + + + diff --git a/src/views/toilet/components/detail.vue b/src/views/toilet/components/detail.vue index 7864470..247c03d 100644 --- a/src/views/toilet/components/detail.vue +++ b/src/views/toilet/components/detail.vue @@ -115,7 +115,7 @@
+ + diff --git a/src/views/toiletManage/editToilet.vue b/src/views/toiletManage/editToilet.vue new file mode 100644 index 0000000..e797eec --- /dev/null +++ b/src/views/toiletManage/editToilet.vue @@ -0,0 +1,408 @@ + + + + + + diff --git a/src/views/toiletManage/toiletList.vue b/src/views/toiletManage/toiletList.vue new file mode 100644 index 0000000..92997a0 --- /dev/null +++ b/src/views/toiletManage/toiletList.vue @@ -0,0 +1,286 @@ + + + + + + diff --git a/package.json b/package.json index f8c5e2a..9f3a3eb 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "echarts": "^4.2.1", "element-ui": "2.13.0", "event-source-polyfill": "^1.0.5", + "file-saver": "^2.0.5", "js-cookie": "2.2.0", "jsencrypt": "^3.0.0-rc.1", "leaflet": "^1.7.1", @@ -34,7 +35,8 @@ "vue-baidu-map": "^0.21.22", "vue-router": "3.0.1", "vue2-leaflet": "^2.7.0", - "vuex": "3.0.1" + "vuex": "3.0.1", + "xlsx": "^0.17.0" }, "devDependencies": { "autoprefixer": "8.5.0", diff --git a/src/api/sanitation/statistics.js b/src/api/sanitation/statistics.js new file mode 100644 index 0000000..2ca7549 --- /dev/null +++ b/src/api/sanitation/statistics.js @@ -0,0 +1,13 @@ + +/** + * 考核统计接口 + */ +import request from '@/utils/request' +// 公厕保洁次数统计 +export function getToiletJobCount(params) { + return request({ + url: '/sanitation/statistic/toilet/jobCount', + method: 'get', + params + }) +} diff --git a/src/api/sanitation/toilet.js b/src/api/sanitation/toilet.js new file mode 100644 index 0000000..10fd245 --- /dev/null +++ b/src/api/sanitation/toilet.js @@ -0,0 +1,97 @@ +/** + * 公厕管理接口 + */ +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 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/toilet.js b/src/api/system/toilet.js deleted file mode 100644 index 8f38b8f..0000000 --- a/src/api/system/toilet.js +++ /dev/null @@ -1,91 +0,0 @@ -/** - * 公厕管理接口 - */ -import request from '@/utils/request' -import qs from 'qs' -export function getToiletList(params) { - return request({ - url: '/sanitation/toilet/listPage', - method: 'get', - params - }) -} - -export function getDetail(id) { - return request({ - url: '/sanitation/toiletClean/detail', - method: 'get', - params: { - id: id - } - }) -} - -// 公厕查询 -export function getToiletAll() { - return request({ - url: '/sanitation/toilet/listPage', - method: 'get' - }) -} - -// 添加公厕 -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 exportRecords(params) { - return request({ - url: 'device/batchExport', - method: 'get', - timeout: 120000, - params, - 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/assets/global_images/toilet.png b/src/assets/global_images/toilet.png new file mode 100644 index 0000000..6d9fc05 --- /dev/null +++ b/src/assets/global_images/toilet.png Binary files differ diff --git a/src/components/NormalTable/index.vue b/src/components/NormalTable/index.vue index 5077bef..04d322d 100644 --- a/src/components/NormalTable/index.vue +++ b/src/components/NormalTable/index.vue @@ -79,7 +79,7 @@
-
+
Object.assign(obj, { [key]: this[key] }), {}), + on: events.reduce((obj, key) => Object.assign(obj, { [key]: this.transmitEvent }), {}) + }) + } + this.props = [...extraProps, ...props.filter(prop => exceptProps.indexOf(prop))] + } +} + +export default prop => new Mixin(prop) diff --git a/src/components/mapWindow/base/mixins/common.js b/src/components/mapWindow/base/mixins/common.js new file mode 100644 index 0000000..2fd1a28 --- /dev/null +++ b/src/components/mapWindow/base/mixins/common.js @@ -0,0 +1,82 @@ +const types = { + map: { + unload: 'clearMap' + }, + control: { + unload: 'removeControl' + }, + layer: { + unload: 'removeLayer' + }, + features: { + unload: 'removeFeatures' + }, + listener: { + unload: 'removeListener' + } +} + +const getParent = $component => ($component.abstract || $component.$el === $component.$children[0].$el) ? getParent($component.$parent) : $component + +function destroyInstance () { + const { unload, renderByParent, $parent } = this + if (renderByParent) { + $parent.reload() + } + unload() +} + +class Mixin { + constructor (prop) { + this.methods = { + ready () { + const $parent = getParent(this.$parent) + const map = this.map = $parent.map + this.load() + this.$emit('ready', { + map + }) + }, + transmitEvent (e) { + this.$emit(e.type.replace(/^on/, ''), e) + }, + reload () { + this && this.$nextTick(() => { + this.unload() + this.$nextTick(this.load) + }) + }, + unload () { + const { map, originInstance } = this + try { + switch (prop.type) { + case 'search': + return originInstance.clearResults() + case 'autoComplete': + case 'lushu': + return originInstance.dispose() + case 'markerClusterer': + return originInstance.clearMarkers() + default: + map[types[prop.type].unload](originInstance) + } + } catch (e) {} + } + } + this.computed = { + renderByParent () { + return this.$parent.preventChildrenRender + } + } + this.mounted = function () { + console.log('common mounted') + const $parent = getParent(this.$parent) + const map = $parent.map + const { ready } = this + console.log(map) + map ? ready() : $parent.$on('onload', ready) + } + } +} + +export default type => new Mixin({ type }) diff --git a/src/components/mapWindow/leafletMap.vue b/src/components/mapWindow/leafletMap.vue new file mode 100644 index 0000000..931a5e9 --- /dev/null +++ b/src/components/mapWindow/leafletMap.vue @@ -0,0 +1,132 @@ + + + + + + + diff --git a/src/components/mapWindow/mapWindow.vue b/src/components/mapWindow/mapWindow.vue new file mode 100644 index 0000000..9ced291 --- /dev/null +++ b/src/components/mapWindow/mapWindow.vue @@ -0,0 +1,46 @@ + + + + + + diff --git a/src/permission.js b/src/permission.js index dc6b2f8..809ca86 100644 --- a/src/permission.js +++ b/src/permission.js @@ -25,8 +25,8 @@ store.dispatch('GetInfo').then(res => { // 拉取用户信息 // 设置当前子系统为基础资源子系统 const currentSys = { - code: 'baseResourse', - name: '基础资源子系统' + code: 'toliet', + name: '公共厕所管理系统' } // 将当前系统信息保存在localStorage中 store.commit('SET_SYSTEM', currentSys) diff --git a/src/router/index.js b/src/router/index.js index 431844b..d23076d 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -43,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 错误页面 diff --git a/src/router/modules/statistics.js b/src/router/modules/statistics.js index 442aa6f..fb9cbea 100644 --- a/src/router/modules/statistics.js +++ b/src/router/modules/statistics.js @@ -5,7 +5,7 @@ { path: 'statisticsToilet', component: Layout, - redirect: '/statisticsToilet', + redirect: '/workStatistics', name: 'StatisticsToilet', meta: { title: '作业统计', @@ -14,10 +14,16 @@ }, children: [ { - path: '/statistics', - name: 'Statistics', - component: () => import('@/views/statistics/workStatistics'), - meta: { title: '作业统计', icon: 'function', permission: ['/statisticsToilet'] } + path: '/workStatistics', + name: 'WorkStatistics', + component: () => import('@/views/statistics/toiletAssessment'), + meta: { title: '作业统计', icon: '', permission: ['/toilet/workStatistics'] } + }, + { + path: '/evaluationStatistics', + name: 'EvaluationStatistics', + component: () => import('@/views/statistics/evaluationAssessment'), + meta: { title: '评价统计', icon: '', permission: ['/toilet/evaluationStatistics'] } } ] } diff --git a/src/router/modules/toilet.js b/src/router/modules/toilet.js index e537ce9..b221a0e 100644 --- a/src/router/modules/toilet.js +++ b/src/router/modules/toilet.js @@ -16,7 +16,7 @@ { path: '/toiletList', name: 'ToiletList', - component: () => import('@/views/toilet/listToilet'), + component: () => import('@/views/toiletManage/toiletList'), meta: { title: '公厕台帐管理', icon: 'function', permission: ['/toiletList'] } }, { diff --git a/src/router/modules/work.js b/src/router/modules/work.js index 3725050..5e0759f 100644 --- a/src/router/modules/work.js +++ b/src/router/modules/work.js @@ -16,7 +16,7 @@ { path: '/toiletWork', name: 'ToiletWork', - component: () => import('@/views/toilet/listWork'), + component: () => import('@/views/toiletClean/toiletCleanList'), meta: { title: '作业管理', icon: 'function', permission: ['/toiletWork'] } } ] diff --git a/src/settings.js b/src/settings.js index b568ce0..b8159bf 100644 --- a/src/settings.js +++ b/src/settings.js @@ -3,7 +3,7 @@ * @type {boolean} true | false * @description 是否显示设置按钮 */ - showSettings: true, + showSettings: false, /** * @type {boolean} true | false diff --git a/src/store/modules/permission.js b/src/store/modules/permission.js index a0cb8cf..3ab50d5 100644 --- a/src/store/modules/permission.js +++ b/src/store/modules/permission.js @@ -120,17 +120,23 @@ }) }, // 获取用户权限 - GetMenus({ commit, state }) { - console.log('in store.permission.js:GetMenus:') + GetMenus({ commit, state }, currentSystem) { + // console.log('in store.permission.js:GetMenus:') + console.log('获取' + currentSystem.name + '的菜单') + const params = { + parentCode: currentSystem.code // 传入该子系统的code,获取子系统的权限 + } return new Promise((resolve, reject) => { - getMenus(state.token).then(response => { // 处理返回值 + // 此处获取用户所有权限 + getMenus(params).then(response => { // 处理返回值 const data = response.data const menus = [] // 仅菜单 const btns = [] // 非菜单 if (data.menus && data.menus.length > 0) { - commit('SET_MENUS', data.menus) - for (const menu of data.menus) { // 遍历菜单,获取所有的权限项 - if (menu.ismenu === '1') { // 将是菜单的放入menus + const allmenus = [...data.menus] + commit('SET_MENUS', allmenus) + for (const menu of allmenus) { // 遍历菜单,获取所有的权限项 + if (menu.resourceType === '02' || menu.resourceType === '03') { // 将是菜单的放入menus const menu_tmp = {} menu_tmp.url = menu.url menu_tmp.icon = menu.icon @@ -142,11 +148,11 @@ btn_tmp.name = menu.name btn_tmp.icon = menu.icon btns.push(btn_tmp) - // console.log(menu.url) } } // 过滤路由表 - const accessedRouters = filterAsyncRouter(asyncRouterMap, menus) + let accessedRouters = filterAsyncRouter(asyncRouterMap, menus) + // accessedRouters = filterRedirect(accessedRouters) commit('SET_BTNS', btns) commit('SET_ROUTERS', accessedRouters) resolve(response) diff --git a/src/utils/dateutils.js b/src/utils/dateutils.js index 868111a..5cd16af 100644 --- a/src/utils/dateutils.js +++ b/src/utils/dateutils.js @@ -15,15 +15,15 @@ return ct_month } -export function getLastWeek() { // 默认显示上周 +export function getLastWeek(fmt) { // 默认显示上周 const ct_month = new Date() ct_month.setTime(ct_month.getTime() - 3600 * 1000 * 24 * 7) - return ct_month + return ct_month.Format(fmt) } -export function getLastMonth() { // 默认显示上个月 +export function getLastMonth(fmt) { // 默认显示上个月 const ct_month = new Date() ct_month.setTime(ct_month.getTime() - 3600 * 1000 * 24 * 30) - return ct_month + return ct_month.Format(fmt) } // 对Date的扩展,将 Date 转化为指定格式的String diff --git a/src/utils/exportutils.js b/src/utils/exportutils.js new file mode 100644 index 0000000..b5d0bcf --- /dev/null +++ b/src/utils/exportutils.js @@ -0,0 +1,19 @@ +/** + * 导出文件工具 + * @param blob 文件 + * @param fileName 导出文件名 + */ +export function exportFile(blob, fileName) { + if (window.navigator && window.navigator.msSaveOrOpenBlob) { + navigator.msSaveBlob(blob, fileName) + } else { + const downloadElement = document.createElement('a') + const href = window.URL.createObjectURL(blob) // 创建下载的链接 + downloadElement.href = href + downloadElement.download = fileName + document.body.appendChild(downloadElement) + downloadElement.click() // 点击下载 + document.body.removeChild(downloadElement) // 下载完成移除元素 + window.URL.revokeObjectURL(href) // 释放blob对象 + } +} diff --git a/src/views/mapViews/mapView.vue b/src/views/mapViews/mapView.vue index feba3f6..a18db88 100644 --- a/src/views/mapViews/mapView.vue +++ b/src/views/mapViews/mapView.vue @@ -41,10 +41,7 @@ zoomOffset: 1 } }, - // mapurl: 'http://t1.tianditu.com/vec_w/wmts?layer=vec&style=default&tilematrixset=w&Service=WMTS&Request=GetTile&Version=1.0.0&Format=tiles&TileMatrix={z}&TileCol={x}&TileRow={y}&tk=adbdd8e08c292f6cb4e3f0289f7d0447', mapurl: this.baseConfig.mapUrl, - // mapurl: 'http://webrd01.is.autonavi.com/appmaptile?lang=zh_cn&size=1&scale=1&style=8&x={x}&y={y}&z={z}', - // labelurl: 'http://t1.tianditu.com/cva_w/wmts?layer=cva&style=default&tilematrixset=w&Service=WMTS&Request=GetTile&Version=1.0.0&Format=tiles&TileMatrix={z}&TileCol={x}&TileRow={y}&tk=adbdd8e08c292f6cb4e3f0289f7d0447' labelurl: this.baseConfig.labelUrl } }, diff --git a/src/views/overview/overview.vue b/src/views/overview/overview.vue index b356b46..9525867 100644 --- a/src/views/overview/overview.vue +++ b/src/views/overview/overview.vue @@ -1,30 +1,11 @@ @@ -32,13 +13,11 @@ import L from 'leaflet' import 'leaflet/dist/leaflet.css' import { getDetail } from '@/api/system/bridge' -// import icon from '/static/images/well/0100.png' -// import { getAllMarker } from '@/api/overview' -// import { getMarkerInfo } from '@/api/marker' -// import { lazyAMapApiLoaderInstance } from 'vue-amap' - +import LeafletMap from '@/components/mapWindow/leafletMap' +import ToiletLayer from './toiletLayer' export default { name: 'Overview', + components: { ToiletLayer, LeafletMap }, data() { return { baselayer: [], @@ -72,13 +51,15 @@ loading: false, icon: 'cross', map: null, - msg: 'Welcome to Your Vue.js App' } }, mounted() { - this.initMap() }, methods: { + // 地图加载完毕 + mapReady (map) { + this.map = map + }, initMap() { const map = L.map('map', { minZoom: 2, @@ -150,7 +131,7 @@ diff --git a/src/views/statistics/components/evaluationListDialog.vue b/src/views/statistics/components/evaluationListDialog.vue new file mode 100644 index 0000000..15a9c2f --- /dev/null +++ b/src/views/statistics/components/evaluationListDialog.vue @@ -0,0 +1,120 @@ + + + + + + diff --git a/src/views/statistics/components/workChart.vue b/src/views/statistics/components/workChart.vue new file mode 100644 index 0000000..a891e0c --- /dev/null +++ b/src/views/statistics/components/workChart.vue @@ -0,0 +1,79 @@ + + + + + diff --git a/src/views/statistics/evaluationAssessment.vue b/src/views/statistics/evaluationAssessment.vue new file mode 100644 index 0000000..2193f0e --- /dev/null +++ b/src/views/statistics/evaluationAssessment.vue @@ -0,0 +1,161 @@ + + + + + + diff --git a/src/views/statistics/toiletAssessment.vue b/src/views/statistics/toiletAssessment.vue new file mode 100644 index 0000000..2b8522a --- /dev/null +++ b/src/views/statistics/toiletAssessment.vue @@ -0,0 +1,237 @@ + + + + + diff --git a/src/views/toilet/components/detail.vue b/src/views/toilet/components/detail.vue index 7864470..247c03d 100644 --- a/src/views/toilet/components/detail.vue +++ b/src/views/toilet/components/detail.vue @@ -115,7 +115,7 @@
+ + diff --git a/src/views/toiletManage/editToilet.vue b/src/views/toiletManage/editToilet.vue new file mode 100644 index 0000000..e797eec --- /dev/null +++ b/src/views/toiletManage/editToilet.vue @@ -0,0 +1,408 @@ + + + + + + diff --git a/src/views/toiletManage/toiletList.vue b/src/views/toiletManage/toiletList.vue new file mode 100644 index 0000000..92997a0 --- /dev/null +++ b/src/views/toiletManage/toiletList.vue @@ -0,0 +1,286 @@ + + + + + + diff --git a/static/project.config.json b/static/project.config.json index e4b8dce..643a5ff 100644 --- a/static/project.config.json +++ b/static/project.config.json @@ -1,5 +1,5 @@ { - "title": "基础资源系统", + "title": "公共厕所管理系统", "baseUrl": "http://111.198.10.15:11409/", "mainPage": "http://111.198.10.15:11404/dcms/#", "singleSys": true,