diff --git a/.hbuilderx/launch.json b/.hbuilderx/launch.json index 9b0d791..4ccd172 100644 --- a/.hbuilderx/launch.json +++ b/.hbuilderx/launch.json @@ -13,7 +13,7 @@ "type" : "uniCloud" }, { - "playground" : "standard", + "playground" : "custom", "type" : "uni-app:app-android" } ] diff --git a/api/workPlan/homePage.js b/api/workPlan/homePage.js new file mode 100644 index 0000000..982d47d --- /dev/null +++ b/api/workPlan/homePage.js @@ -0,0 +1,42 @@ +import request_yn from '@/utils/request_new_yn_home' + +// 获取风险概况 +export function getTitleRiskApi(data) { + return request_yn({ + url: '/ynPlan/home/getTitleRisk', + method: 'post', + data: data + }) +} +// 获取今日作业人数 +export function getDayUserApi(data) { + return request_yn({ + url: '/ynPlan/home/getDayUser', + method: 'post', + data: data + }) +} +// 获取月数据 +export function getMonthRiskApi(data) { + return request_yn({ + url: '/ynPlan/home/getMonthFx', + method: 'post', + data: data + }) +} +// 获取周的数据 +export function getWeekDataApi(data) { + return request_yn({ + url: '/ynPlan/home/getWeekFx', + method: 'post', + data: data + }) +} +// 获取日数据 +export function getProFxByDayApi(data) { + return request_yn({ + url: '/ynPlan/home/getProFxByDay', + method: 'post', + data: data + }) +} diff --git a/api/workPlan/riskDay.js b/api/workPlan/riskDay.js index ae38f0b..3c175a9 100644 --- a/api/workPlan/riskDay.js +++ b/api/workPlan/riskDay.js @@ -8,6 +8,14 @@ export function getDayRiskApi(data) { data: data }) } +// 获取风险点 +export function getTodayRiskApi(data) { + return request_yn({ + url: '/ynPlanApp/scene/getriskNum', + method: 'post', + data: data + }) +} // 风险提交 export function setRiskSubmitApi(data) { return request_yn({ @@ -16,7 +24,7 @@ export function setRiskSubmitApi(data) { data: data }) } -// 获取风险详情 +// 获取风险详情列表 export function getMySceneListApi(data) { return request_yn({ url: '/ynPlanApp/scene/getMySceneList', @@ -24,3 +32,11 @@ export function getMySceneListApi(data) { data: data }) } +// 获取风险详情 +export function getMySceneDataApi(data) { + return request_yn({ + url: '/ynPlanApp/scene/getMySceneData', + method: 'post', + data: data + }) +} diff --git a/pages/workPlan/custody/index.vue b/pages/workPlan/custody/index.vue index 04ad233..5c86c05 100644 --- a/pages/workPlan/custody/index.vue +++ b/pages/workPlan/custody/index.vue @@ -189,7 +189,7 @@ @@ -53,10 +142,6 @@ export default { width: 100%; background-color: #efefef; - .title-bold { - font-size: 32rpx; - font-weight: bold; - } .risk-header { width: 94%; margin: 16rpx auto; @@ -78,42 +163,6 @@ export default { margin-left: 6rpx; } } - - .change-today { - width: 94%; - margin: 16rpx auto; - padding: 26rpx; - border: 1px solid #ccc; - background-color: #fff; - border-radius: 6rpx; - - .today-title { - display: flex; - justify-content: space-between; - align-items: center; - } - - .today-title view:last-child { - padding: 26rpx 6rpx; - background-color: #d6001a; - border-radius: 20rpx; - color: #fff; - } - - ::v-deep .uni-forms-item__label { - font-weight: bold; - color: #000; - font-size: 26rpx; - } - } - .scene-container { - width: 94%; - margin: 16rpx auto; - padding: 26rpx; - border: 1px solid #ccc; - background-color: #fff; - border-radius: 6rpx; - } } } @@ -147,8 +196,8 @@ export default { width: 30%; margin-left: 5%; margin-top: 20rpx !important; - height: 180rpx; - background-color: #eee; + height: 200rpx; + // background-color: #eee; border: 1px solid #ccc; box-sizing: border-box; position: relative; @@ -270,4 +319,50 @@ export default { border-radius: 6rpx; } } + +.change-today { + width: 94%; + margin: 16rpx auto; + padding: 26rpx; + border: 1px solid #ccc; + background-color: #fff; + border-radius: 6rpx; + + .today-title { + display: flex; + justify-content: space-between; + align-items: center; + } + + // .today-title view:last-child { + // padding: 26rpx 6rpx; + // background-color: #d6001a; + // border-radius: 20rpx; + // color: #fff; + // } + + ::v-deep .uni-forms-item__label { + font-weight: bold; + color: #000; + font-size: 26rpx; + } +} +.scene-container { + width: 94%; + margin: 16rpx auto; + padding: 26rpx; + border: 1px solid #ccc; + background-color: #fff; + border-radius: 6rpx; + + ::v-deep .uni-forms-item__label { + font-weight: bold; + color: #000; + font-size: 26rpx; + } +} +.title-bold { + font-size: 32rpx; + font-weight: bold; +} diff --git a/pages/workPlan/index/components/calendar.vue b/pages/workPlan/index/components/calendar.vue index 05e7015..2150b17 100644 --- a/pages/workPlan/index/components/calendar.vue +++ b/pages/workPlan/index/components/calendar.vue @@ -5,7 +5,11 @@ {{ currentYear }}年{{ currentMonth + 1 }}月 --> - +

风险日历

+ + 今日作业人数: + {{ todayCount }} + @@ -43,9 +47,11 @@ > {{ days.day }} - 中:9 - 低:30 - 可接受:4 + 可接受:{{ days.kjsfx }} + 低:{{ days.dfx }} + 中:{{ days.zfx }} + 高:{{ days.gfx }} + 特高:{{ days.tgfx }} @@ -62,13 +68,15 @@ - {{ item.name }} + {{ item.orgName }} - - 高:{{ i.height }} - 中:{{ i.height }} - 低:{{ i.kjs }} - 可接受:{{ i.height }} + + + 可接受:{{ i.kjsfx }} + 低:{{ i.dfx }} + 中:{{ i.zfx }} + 高:{{ i.gfx }} + 特高:{{ i.tgfx }} @@ -85,16 +93,16 @@ - 10kv换东线10kv换东线10kv换东线10kv换东线10kv换东线 + {{ currentDayInfo.proName }} - 3 + {{ currentDayInfo.rys }} - - - - 可接受 - 特高 + 可接受:{{ currentDayInfo.kjsfx }} + 低:{{ currentDayInfo.dfx }} + 中:{{ currentDayInfo.zfx }} + 高:{{ currentDayInfo.gfx }} + 特高:{{ currentDayInfo.tgfx }} @@ -102,6 +110,7 @@ diff --git a/utils/request_new_yn_home.js b/utils/request_new_yn_home.js new file mode 100644 index 0000000..202e8dc --- /dev/null +++ b/utils/request_new_yn_home.js @@ -0,0 +1,87 @@ +import store from '@/store' +import config from '@/config' +import { getToken, setToken } from '@/utils/auth' +import errorCode from '@/utils/errorCode' +import { toast, showConfirm, tansParams } from '@/utils/common' + +const token = uni.getStorageSync('wkToken') || null + +let timeout = 60000 +const baseUrl = config.realNewYnUrl +console.log('token', token) + +const request = config => { + // 是否需要设置 token + const isToken = (config.headers || {}).isToken === false + config.header = config.header || {} + if (token && !isToken) { + config.header['Authorization'] = 'Bearer ' + token + } + // get请求映射params参数 + if (config.params) { + let url = config.url + '?' + tansParams(config.params) + url = url.slice(0, -1) + config.url = url + } + + if (config.method === 'post') { + config.header = { + ...config.header, + 'Content-Type': 'application/x-www-form-urlencoded' + } + // config.data = JSON.stringify(config.data); + } + return new Promise((resolve, reject) => { + uni + .request({ + method: config.method || 'get', + timeout: config.timeout || timeout, + url: baseUrl + config.url, + data: config.data, + header: config.header, + dataType: 'json' + }) + .then(response => { + // console.log(response) + let [error, res] = response + if (error) { + toast('后端接口连接异常') + reject('后端接口连接异常') + return + } + const code = res.data.code || 200 + const msg = errorCode[code] || res.data.msg || errorCode['default'] + if (code === 401) { + showConfirm('登录状态已过期,您可以继续留在该页面,或者重新登录?').then(res => { + if (res.confirm) { + store.dispatch('LogOut').then(res => { + uni.reLaunch({ url: '/pages/login' }) + }) + } + }) + reject('无效的会话,或者会话已过期,请重新登录。') + } else if (code === 500) { + toast(msg) + reject(msg) + } else if (code !== 200) { + toast(msg) + reject(msg) + } + resolve(res.data) + }) + .catch(error => { + let { message } = error + if (message === 'Network Error') { + message = '后端接口连接异常' + } else if (message.includes('timeout')) { + message = '系统接口请求超时' + } else if (message.includes('Request failed with status code')) { + message = '系统接口' + message.substr(message.length - 3) + '异常' + } + toast(message) + reject(error) + }) + }) +} + +export default request