From 2741803c5f85f8eefc86c46d2321323200462c63 Mon Sep 17 00:00:00 2001 From: zhangtao <1176193409@qq.com> Date: Tue, 13 Dec 2022 14:13:10 +0800 Subject: [PATCH] add report page --- .env | 3 +- .env.development | 3 +- .env.localhost | 5 +- .env.production | 3 +- .env.test | 5 +- src/api/auth/index.js | 7 +- src/api/common/index.js | 12 + src/api/report/river.js | 24 ++ src/router/guard/permission-guard.js | 8 - src/store/modules/permission.js | 2 +- src/utils/http/interceptors.js | 3 +- src/utils/oidc/index.js | 6 +- src/views/login/index.vue | 2 +- .../river-report/components/ReportDrawer.vue | 81 +++++ .../river-report/components/ResultReport.vue | 336 ++++++++++++++++++ .../river-report/components/RiverReport.vue | 25 ++ src/views/reports/river-report/index.vue | 47 ++- .../reports/river-report/tools/search.js | 28 ++ src/views/reports/river-report/tools/table.js | 107 ++++++ src/views/setting/advertising/tools/table.js | 2 +- src/views/setting/notice/tools/form.js | 2 +- src/views/setting/notice/tools/table.js | 2 +- 22 files changed, 678 insertions(+), 35 deletions(-) create mode 100644 src/api/common/index.js create mode 100644 src/api/report/river.js create mode 100644 src/views/reports/river-report/components/ReportDrawer.vue create mode 100644 src/views/reports/river-report/components/ResultReport.vue create mode 100644 src/views/reports/river-report/components/RiverReport.vue create mode 100644 src/views/reports/river-report/tools/search.js create mode 100644 src/views/reports/river-report/tools/table.js diff --git a/.env b/.env index b6e694e..9ec87e5 100644 --- a/.env +++ b/.env @@ -5,7 +5,6 @@ VITE_APP_TITLE = '智慧河长' VITE_PORT = 3000 -# VITE_SERVER = "/hhz/admin/api" -VITE_SERVER = "" +VITE_SERVER = "/hhz/admin" VITE_PLATFORM = "tuoheng-hhz-admin" \ No newline at end of file diff --git a/.env.development b/.env.development index d9e321e..999062a 100644 --- a/.env.development +++ b/.env.development @@ -12,5 +12,4 @@ VITE_APP_GLOB_BASE_API = '/api' VITE_AUTHORITY = 'http://192.168.11.11:8090' VITE_CLIENT_ID = 'tuoheng-hhz-admin' -VITE_CLIENT_SECRET = 'qsPaU8a2YGFsZfIa7HoGSz==' -VITE_REDIRECT_URI = 'http://192.168.11.11:8086/login' \ No newline at end of file +VITE_CLIENT_SECRET = 'qsPaU8a2YGFsZfIa7HoGSz==' \ No newline at end of file diff --git a/.env.localhost b/.env.localhost index bb90054..4824ef7 100644 --- a/.env.localhost +++ b/.env.localhost @@ -5,7 +5,7 @@ VITE_PUBLIC_PATH = '/' VITE_APP_USE_MOCK = false # proxy -VITE_PROXY = [["/api-local","http://127.0.0.1:8002/api"],["/api-mock","http://127.0.0.1:8003"]] +VITE_PROXY = [["/api-local","http://127.0.0.1:8002"],["/api-mock","http://127.0.0.1:8003"]] # base api VITE_APP_GLOB_BASE_API = '/api-local' @@ -15,5 +15,4 @@ VITE_APP_GLOB_BASE_API_MOCK = '/api-mock' VITE_AUTHORITY = 'http://192.168.11.11:8090' VITE_CLIENT_ID = 'tuoheng-hhz-admin' -VITE_CLIENT_SECRET = 'qsPaU8a2YGFsZfIa7HoGSz==' -VITE_REDIRECT_URI = 'http://192.168.12.8:3000/login' \ No newline at end of file +VITE_CLIENT_SECRET = 'qsPaU8a2YGFsZfIa7HoGSz==' \ No newline at end of file diff --git a/.env.production b/.env.production index 18f273d..88a0cdc 100644 --- a/.env.production +++ b/.env.production @@ -12,5 +12,4 @@ VITE_APP_GLOB_BASE_API = '/api' VITE_AUTHORITY = 'https://oidc.t-aaron.com' VITE_CLIENT_ID = 'tuoheng-hhz-admin' -VITE_CLIENT_SECRET = 'qsPaU8a2YGFsZfIa7HoGSz==' -VITE_REDIRECT_URI = 'https://dsp-portal.t-aaron.com/login' \ No newline at end of file +VITE_CLIENT_SECRET = 'qsPaU8a2YGFsZfIa7HoGSz==' \ No newline at end of file diff --git a/.env.test b/.env.test index c79cf84..d204b4e 100644 --- a/.env.test +++ b/.env.test @@ -10,7 +10,6 @@ VITE_PROXY = [["/api","http://192.168.11.241:9011/api"]] # base api VITE_APP_GLOB_BASE_API = '/api' -VITE_AUTHORITY = 'https://oidc.test.t-aaron.com' +VITE_AUTHORITY = 'https://login-test.t-aaron.com/' VITE_CLIENT_ID = 'tuoheng-hhz-admin' -VITE_CLIENT_SECRET = 'qsPaU8a2YGFsZfIa7HoGSz==' -VITE_REDIRECT_URI = 'http://192.168.11.241:8086/login' \ No newline at end of file +VITE_CLIENT_SECRET = 'qsPaU8a2YGFsZfIa7HoGSz==' \ No newline at end of file diff --git a/src/api/auth/index.js b/src/api/auth/index.js index 8ef3795..b24514e 100644 --- a/src/api/auth/index.js +++ b/src/api/auth/index.js @@ -20,10 +20,11 @@ export const refreshToken = () => { * @param {String} roleId 角色Id * @return {*} */ -export const fetchPermission = (roleId) => { +export const fetchPermission = (params) => { return request({ - url: `/permission/getRolePermission/${roleId}`, - method: 'GET' + url: `/permission/getRolePermission/`, + method: 'GET', + params }) } diff --git a/src/api/common/index.js b/src/api/common/index.js new file mode 100644 index 0000000..96ecdd8 --- /dev/null +++ b/src/api/common/index.js @@ -0,0 +1,12 @@ +import { defAxios as request } from '@/utils/http' + +/** + * @description: 获取问题列表数据 + * @return {Object} + */ +export function getQuestionTree() { + return request({ + url: '/question/getTree', + method: 'get' + }) +} diff --git a/src/api/report/river.js b/src/api/report/river.js new file mode 100644 index 0000000..0e89a21 --- /dev/null +++ b/src/api/report/river.js @@ -0,0 +1,24 @@ +import { defAxios as request } from '@/utils/http' + +/** + * @description: 分页查询巡河报告列表 + * @return {*} + */ +export function fetchReportList(params) { + return request({ + url: '/reportPatrol/indexNew', + method: 'get', + params + }) +} +/** + * @description: 获取报告详情 + * @return {*} + */ +export function reportDetail(params) { + return request({ + url: '/report/detail', + method: 'get', + params + }) +} diff --git a/src/router/guard/permission-guard.js b/src/router/guard/permission-guard.js index ceb7db1..6ea4512 100644 --- a/src/router/guard/permission-guard.js +++ b/src/router/guard/permission-guard.js @@ -1,11 +1,3 @@ -/* - * @Author: whyafterme - * @Date: 2022-11-03 11:31:21 - * @LastEditTime: 2022-11-21 09:02:20 - * @LastEditors: whyafterme - * @Description: - * @FilePath: \new\src\router\guard\permission-guard.js - */ import { useUserStore } from '@/store/modules/user' import { usePermissionStore } from '@/store/modules/permission' import { NOT_FOUND_ROUTE, REDIRECT_ROUTE } from '@/router/routes' diff --git a/src/store/modules/permission.js b/src/store/modules/permission.js index 92e6a4c..f531739 100644 --- a/src/store/modules/permission.js +++ b/src/store/modules/permission.js @@ -102,7 +102,7 @@ export const usePermissionStore = defineStore('permission', { }, async generateRoutes(roleId) { try { - const res = await fetchPermission(roleId) + const res = await fetchPermission({ roleId, clientId: 'tuoheng-hhz-admin' }) // const res = await fetchPermission(3) if (res.code === 0) { const { opMenusList, permissionsList } = res.data diff --git a/src/utils/http/interceptors.js b/src/utils/http/interceptors.js index d9369ad..38f34b9 100644 --- a/src/utils/http/interceptors.js +++ b/src/utils/http/interceptors.js @@ -15,8 +15,7 @@ export function setupInterceptor(service) { const userInfo = await getUserInfo() if (userInfo) { const { token_type, access_token } = userInfo - // config.headers.Authorization = `${token_type} ${access_token}` - config.headers.Authorization = '70aa58b4-dda7-446d-8cbf-8e6d6ab89a02' + config.headers.Authorization = `${token_type} ${access_token}` const { VITE_CLIENT_ID } = import.meta.env config.headers['Client-Id'] = VITE_CLIENT_ID return config diff --git a/src/utils/oidc/index.js b/src/utils/oidc/index.js index f631ba2..f0f6518 100644 --- a/src/utils/oidc/index.js +++ b/src/utils/oidc/index.js @@ -4,7 +4,7 @@ let oidcManager = null export const initServe = () => { if (oidcManager) return oidcManager - const { VITE_AUTHORITY, VITE_CLIENT_ID, VITE_CLIENT_SECRET, VITE_REDIRECT_URI } = import.meta.env + const { VITE_AUTHORITY, VITE_CLIENT_ID, VITE_CLIENT_SECRET } = import.meta.env oidcManager = new UserManager({ /* 认证服务器 */ authority: VITE_AUTHORITY, @@ -12,8 +12,8 @@ export const initServe = () => { client_id: VITE_CLIENT_ID, client_secret: VITE_CLIENT_SECRET, /* 回调客户端页面 */ - redirect_uri: VITE_REDIRECT_URI, - post_logout_redirect_uri: VITE_REDIRECT_URI, + redirect_uri: `${window.location.origin}/login`, + post_logout_redirect_uri: `${window.location.origin}/login`, response_type: 'code', /* 授权范围 */ scope: 'openid profile', diff --git a/src/views/login/index.vue b/src/views/login/index.vue index e84dc17..5db87e7 100644 --- a/src/views/login/index.vue +++ b/src/views/login/index.vue @@ -34,7 +34,7 @@ export default { return item.clientId === VITE_CLIENT_ID }) if (authority && (authority.includes(VITE_PLATFORM) || authority.includes('admin'))) { - fetchPermission(roleId) + fetchPermission({ roleId, clientId: 'tuoheng-hhz-admin' }) .then(res => { const { opMenusList } = res.data const path = opMenusList[0].path diff --git a/src/views/reports/river-report/components/ReportDrawer.vue b/src/views/reports/river-report/components/ReportDrawer.vue new file mode 100644 index 0000000..ef07305 --- /dev/null +++ b/src/views/reports/river-report/components/ReportDrawer.vue @@ -0,0 +1,81 @@ + + + + + diff --git a/src/views/reports/river-report/components/ResultReport.vue b/src/views/reports/river-report/components/ResultReport.vue new file mode 100644 index 0000000..5b7e41d --- /dev/null +++ b/src/views/reports/river-report/components/ResultReport.vue @@ -0,0 +1,336 @@ + + + + diff --git a/src/views/reports/river-report/components/RiverReport.vue b/src/views/reports/river-report/components/RiverReport.vue new file mode 100644 index 0000000..5ca34f8 --- /dev/null +++ b/src/views/reports/river-report/components/RiverReport.vue @@ -0,0 +1,25 @@ + + + + + diff --git a/src/views/reports/river-report/index.vue b/src/views/reports/river-report/index.vue index a590100..2f88f29 100644 --- a/src/views/reports/river-report/index.vue +++ b/src/views/reports/river-report/index.vue @@ -1,17 +1,60 @@ diff --git a/src/views/reports/river-report/tools/search.js b/src/views/reports/river-report/tools/search.js new file mode 100644 index 0000000..9e2668b --- /dev/null +++ b/src/views/reports/river-report/tools/search.js @@ -0,0 +1,28 @@ +import { reactive } from 'vue' + +const data = reactive([ + { + label: '报告编码', + key: 'reportNo', + props: { + placeholder: '请输入报告编码' + } + }, + { + label: '任务编码', + key: 'inspectionCode', + props: { + placeholder: '请输入任务编码' + } + }, + { + label: '任务名称', + key: 'inspectionName', + props: { + placeholder: '请输入任务名称' + } + } +]) + +export default data + diff --git a/src/views/reports/river-report/tools/table.js b/src/views/reports/river-report/tools/table.js new file mode 100644 index 0000000..44830b7 --- /dev/null +++ b/src/views/reports/river-report/tools/table.js @@ -0,0 +1,107 @@ +import { h, ref, reactive } from 'vue' +import TableAction from '@/components/DataTable/tools/Action.vue' + +/* 注册table */ +const tableRef = ref() +const searchParams = ref() + +function handleSearch(params) { + searchParams.value = { ...params } + tableRef.value.reFetch({ searchParams }) +} + +/** + * @description: 获取数据及操作 + * @param {*} row 单行数据 + * @param {*} type 操作类型 create:创建,preview:预览,edit:编辑 + * @return {*} + */ +function getRowData(row, type) { + data.rowData = row || {} + data.drawerType = type + data.drawerShow = true +} + +const data = reactive({ + tableRef, + searchParams, + rowData: {}, + drawerType: 'create', + drawerShow: false, + handleSearch, + + columns: [ + { + title: '任务编码', + key: 'inspectionCode', + align: 'center', + width: 200 + }, + { + title: '任务名称', + key: 'inspectionName', + align: 'center', + ellipsis: { + tooltip: true + }, + width: 400 + }, + { + title: '巡检河道', + key: 'streamName', + align: 'center', + width: 200 + }, + { + title: '巡检时间', + key: 'inspectionTime', + align: 'center', + width: 200 + }, + { + title: '操作', + align: 'center', + width: 150, + fixed: 'right', + render(row) { + return h(TableAction, { + actions: [ + // { + // label: '查看', + // type: 'button', + // props: { + // type: 'primary', + // text: true, + // onClick: getRowData.bind(null, row, 'preview') + // }, + // auth: 'basic_list' + // }, + { + label: '巡河报告', + type: 'button', + props: { + type: 'primary', + text: true, + onClick: getRowData.bind(null, row, 'river') + }, + auth: 'basic_list' + }, + { + label: '处理结果', + type: 'button', + props: { + type: 'primary', + text: true, + onClick: getRowData.bind(null, row, 'result') + }, + auth: 'basic_list' + } + ], + align: 'center' + }) + } + } + ] +}) + +export default data diff --git a/src/views/setting/advertising/tools/table.js b/src/views/setting/advertising/tools/table.js index c1bb26b..3d70d7c 100644 --- a/src/views/setting/advertising/tools/table.js +++ b/src/views/setting/advertising/tools/table.js @@ -21,7 +21,7 @@ function handleSearch(params) { * @return {*} */ function getRowData(row, type) { - data.rowData = type === 'create' ? { pid: row.id } : row + data.rowData = row || {} data.modalType = type data.modalShow = true } diff --git a/src/views/setting/notice/tools/form.js b/src/views/setting/notice/tools/form.js index fa230b1..fe37ae0 100644 --- a/src/views/setting/notice/tools/form.js +++ b/src/views/setting/notice/tools/form.js @@ -25,7 +25,7 @@ export const form = reactive({ { type: 'input', key: 'guide', label: '公告摘要', props: { maxlength: '20', placeholder: '请输入公告摘要', clearable: true }}, - { type: 'editor', key: 'content', label: '通知内容', props: { height: 300 }} + { type: 'editor', key: 'content', label: '通知内容', props: { height: 350 }} ] }) diff --git a/src/views/setting/notice/tools/table.js b/src/views/setting/notice/tools/table.js index da8c390..b336085 100644 --- a/src/views/setting/notice/tools/table.js +++ b/src/views/setting/notice/tools/table.js @@ -22,7 +22,7 @@ function handleSearch(params) { * @return {*} */ function getRowData(row, type) { - data.rowData = type === 'create' ? { pid: row.id } : row + data.rowData = row || {} data.modalType = type data.modalShow = true }