首页等接口调试
This commit is contained in:
parent
ed32882c47
commit
32bbc24344
|
|
@ -13,7 +13,7 @@
|
|||
"type" : "uniCloud"
|
||||
},
|
||||
{
|
||||
"playground" : "standard",
|
||||
"playground" : "custom",
|
||||
"type" : "uni-app:app-android"
|
||||
}
|
||||
]
|
||||
|
|
|
|||
|
|
@ -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
|
||||
})
|
||||
}
|
||||
|
|
@ -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
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -189,7 +189,7 @@
|
|||
|
||||
<script>
|
||||
import TabbarConfig from '../util/tabbar'
|
||||
import { setRiskSubmitApi, getMySceneListApi } from '../../../api/workPlan/riskDay'
|
||||
import { setRiskSubmitApi, getMySceneListApi, getTodayRiskApi } from '../../../api/workPlan/riskDay'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
|
|
@ -431,12 +431,20 @@ export default {
|
|||
/* 跳转详情 */
|
||||
onViewDetails(item) {
|
||||
console.log(item, '-----')
|
||||
uni.navigateTo({ url: `/pages/workPlan/guaRecord/index` })
|
||||
uni.navigateTo({ url: `/pages/workPlan/guaRecord/index?id=${item.id}` })
|
||||
},
|
||||
/* 获取今日风险 */
|
||||
async getTodayRiskData() {
|
||||
const res = await getTodayRiskApi({ id: '' })
|
||||
if (res.resMsg == 'success') {
|
||||
this.riskInfo = res.obj[0]
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
onLoad(options) {
|
||||
this.getMySceneListData()
|
||||
this.getTodayRiskData()
|
||||
// 获取定位位置信息
|
||||
uni.getLocation({
|
||||
type: 'gcj02', // 默认为 gcj02,可以选择 'wgs84'
|
||||
|
|
|
|||
|
|
@ -9,15 +9,104 @@
|
|||
bgColor="#00337A"
|
||||
:titleStyle="{ color: '#FFF', fontSize: '32rpx' }"
|
||||
/>
|
||||
|
||||
<view class="change-today">
|
||||
<view class="today-title">
|
||||
<view class="title-bold">日计划风险</view>
|
||||
</view>
|
||||
|
||||
<uni-forms label-position="top" label-width="200">
|
||||
<uni-forms-item label="作业风险内容" required name="zynr">
|
||||
<u--textarea autoHeight v-model="riskDetailsInfo.zynr" disabled></u--textarea>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="风险等级" required name="fxdjName">
|
||||
<u--input type="text" v-model="riskDetailsInfo.fxdjName" disabled />
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="工程名称" required name="proName">
|
||||
<u--textarea type="text" autoHeight v-model="riskDetailsInfo.proName" disabled />
|
||||
</uni-forms-item>
|
||||
</uni-forms>
|
||||
</view>
|
||||
|
||||
<view class="scene-container">
|
||||
<view class="title-bold">现场监护</view>
|
||||
<uni-forms label-position="top" label-width="200">
|
||||
<uni-forms-item label="位置" required name="address">
|
||||
<view class="address-content">
|
||||
<u--input type="text" v-model="riskDetailsInfo.address" disabled />
|
||||
<view class="address-info">
|
||||
<text>
|
||||
{{ riskDetailsInfo.lat }}
|
||||
</text>
|
||||
<text>
|
||||
{{ riskDetailsInfo.lon }}
|
||||
</text>
|
||||
</view>
|
||||
</view>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="附件" required>
|
||||
<view class="autograph">
|
||||
<view class="autograph-img-box">
|
||||
<view v-for="(item, index) in fileList" :key="index">
|
||||
<image
|
||||
:src="`http://192.168.0.14:19191/ynPlanApp/${item}`"
|
||||
mode="scaleToFill"
|
||||
class="view-autograph"
|
||||
></image>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="电子签名" required>
|
||||
<view class="autograph">
|
||||
<view class="autograph-img-box">
|
||||
<view v-for="(item, index) in autographList" :key="index">
|
||||
<image
|
||||
:src="`http://192.168.0.14:19191/ynPlanApp/${item}`"
|
||||
mode="scaleToFill"
|
||||
class="view-autograph"
|
||||
></image>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="备注" required name="remark">
|
||||
<u--textarea autoHeight v-model="riskDetailsInfo.remark" disabled></u--textarea>
|
||||
</uni-forms-item>
|
||||
</uni-forms>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getMySceneDataApi } from '../../../api/workPlan/riskDay'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
riskDetailsInfo: {},
|
||||
fileList: [],
|
||||
autographList: []
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
leftClick() {
|
||||
uni.navigateBack()
|
||||
},
|
||||
/* 获取详情数据 */
|
||||
async getMySceneListData(id) {
|
||||
const res = await getMySceneDataApi({ id })
|
||||
|
||||
if (res.resMsg == 'success') {
|
||||
this.riskDetailsInfo = res.obj[0]
|
||||
this.fileList = res.obj[0].photoPath.split(',')
|
||||
this.autographList = res.obj[0].signPath.split(',')
|
||||
}
|
||||
console.log('风险详情数据---', res)
|
||||
}
|
||||
},
|
||||
onLoad(options) {
|
||||
const id = options.id
|
||||
this.getMySceneListData(id)
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
@ -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;
|
||||
}
|
||||
</style>
|
||||
|
|
|
|||
|
|
@ -5,7 +5,11 @@
|
|||
<text>{{ currentYear }}年{{ currentMonth + 1 }}月</text>
|
||||
<text @click="changeMonth(1)">》</text>
|
||||
</view> -->
|
||||
|
||||
<h2>风险日历</h2>
|
||||
<view class="today-work-num">
|
||||
今日作业人数:
|
||||
<text>{{ todayCount }}</text>
|
||||
</view>
|
||||
<view class="header">
|
||||
<view v-show="activeType === 1">
|
||||
<uni-icons type="left" size="16" @click="changeMonth(-1)"></uni-icons>
|
||||
|
|
@ -43,9 +47,11 @@
|
|||
>
|
||||
<text style="font-weight: bold">{{ days.day }}</text>
|
||||
<view class="risk-container">
|
||||
<text>中:9</text>
|
||||
<text>低:30</text>
|
||||
<text>可接受:4</text>
|
||||
<text v-show="days.kjsfx > 0">可接受:{{ days.kjsfx }}</text>
|
||||
<text v-show="days.dfx > 0">低:{{ days.dfx }}</text>
|
||||
<text v-show="days.zfx > 0">中:{{ days.zfx }}</text>
|
||||
<text v-show="days.gfx > 0">高:{{ days.gfx }}</text>
|
||||
<text v-show="days.tgfx > 0">特高:{{ days.tgfx }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
|
@ -62,13 +68,15 @@
|
|||
|
||||
<view class="week-td" v-for="(item, index) in weekCompanyList" :key="index">
|
||||
<view>
|
||||
<text style="font-size: 26rpx">{{ item.name }}</text>
|
||||
<text style="font-size: 26rpx">{{ item.orgName }}</text>
|
||||
</view>
|
||||
<view v-for="(i, j) in item.weekList" :key="j">
|
||||
<text class="style_1">高:{{ i.height }}</text>
|
||||
<text class="style_2">中:{{ i.height }}</text>
|
||||
<text class="style_3">低:{{ i.kjs }}</text>
|
||||
<text style="margin-bottom: 60rpx" class="style_4">可接受:{{ i.height }}</text>
|
||||
|
||||
<view v-for="(i, j) in item.dbs" :key="j" @tap="onViewDayData(i.day)">
|
||||
<text class="style_4" v-if="i.kjsfx > 0">可接受:{{ i.kjsfx }}</text>
|
||||
<text class="style_3" v-if="i.dfx > 0">低:{{ i.dfx }}</text>
|
||||
<text class="style_2" v-if="i.zfx > 0">中:{{ i.zfx }}</text>
|
||||
<text class="style_1" v-if="i.gfx > 0">高:{{ i.gfx }}</text>
|
||||
<text class="style_1" v-if="i.tgfx > 0">特高:{{ i.tgfx }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
|
@ -85,16 +93,16 @@
|
|||
</view>
|
||||
|
||||
<view class="day-td">
|
||||
<view>10kv换东线10kv换东线10kv换东线10kv换东线10kv换东线</view>
|
||||
<view>{{ currentDayInfo.proName }}</view>
|
||||
<view>
|
||||
<text>3</text>
|
||||
<text>{{ currentDayInfo.rys }}</text>
|
||||
</view>
|
||||
<view>
|
||||
<text class="style_1">中</text>
|
||||
<text class="style_2">高</text>
|
||||
<text class="style_3">低</text>
|
||||
<text class="style_4">可接受</text>
|
||||
<text class="style_4">特高</text>
|
||||
<text class="style_4" v-if="currentDayInfo.kjsfx > 0">可接受:{{ currentDayInfo.kjsfx }}</text>
|
||||
<text class="style_3" v-if="currentDayInfo.dfx > 0">低:{{ currentDayInfo.dfx }}</text>
|
||||
<text class="style_2" v-if="currentDayInfo.zfx > 0">中:{{ currentDayInfo.zfx }}</text>
|
||||
<text class="style_1" v-if="currentDayInfo.gfx > 0">高:{{ currentDayInfo.gfx }}</text>
|
||||
<text class="style_1" v-if="currentDayInfo.tgfx > 0">特高:{{ currentDayInfo.tgfx }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
|
@ -102,6 +110,7 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import { getDayUserApi, getMonthRiskApi, getWeekDataApi, getProFxByDayApi } from '../../../../api/workPlan/homePage'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
|
|
@ -147,53 +156,17 @@ export default {
|
|||
weekStart: this.$moment().week(this.$moment().week()).startOf('week').format('YYYY-MM-DD'),
|
||||
weekEnd: this.$moment().week(this.$moment().week()).endOf('week').format('YYYY-MM-DD'),
|
||||
currentDay: this.$moment().format('YYYY-MM-DD'),
|
||||
weekCompanyList: [
|
||||
{
|
||||
name: '全部',
|
||||
weekList: [
|
||||
{
|
||||
height: 3,
|
||||
kjs: 6
|
||||
},
|
||||
{
|
||||
height: 3,
|
||||
kjs: 6
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
name: '分公司一',
|
||||
weekList: [
|
||||
{
|
||||
height: 3,
|
||||
kjs: 6
|
||||
},
|
||||
{
|
||||
height: 3,
|
||||
kjs: 6
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
name: '分公司二',
|
||||
weekList: [
|
||||
{
|
||||
height: 3,
|
||||
kjs: 6
|
||||
},
|
||||
{
|
||||
height: 3,
|
||||
kjs: 6
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
weekCompanyList: [],
|
||||
days: [],
|
||||
// currentWeekDay: this.$moment().day(),
|
||||
currentDays: this.$moment().format('MM-DD'),
|
||||
customDates: {
|
||||
'2023-06-15': '自定义内容'
|
||||
}
|
||||
},
|
||||
todayCount: 0,
|
||||
currentQueryDay: this.$moment().format('YYYY-MM'),
|
||||
currentPramsWeekDay: '',
|
||||
currentDayInfo: {}
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
|
|
@ -210,6 +183,7 @@ export default {
|
|||
},
|
||||
mounted() {
|
||||
this.generateCalendar()
|
||||
this.getDayUserData()
|
||||
},
|
||||
methods: {
|
||||
generateCalendar() {
|
||||
|
|
@ -220,37 +194,48 @@ export default {
|
|||
|
||||
this.days = []
|
||||
|
||||
for (let i = 0; i < startingDay; i++) {
|
||||
const prevMonthLastDay = new Date(this.currentYear, this.currentMonth, 0).getDate()
|
||||
this.days.push({
|
||||
day: prevMonthLastDay - startingDay + i + 1,
|
||||
currentMonth: false,
|
||||
date: new Date(this.currentYear, this.currentMonth - 1, prevMonthLastDay - startingDay + i + 1)
|
||||
})
|
||||
}
|
||||
new Promise((resolve, reject) => {
|
||||
for (let i = 0; i < startingDay; i++) {
|
||||
const prevMonthLastDay = new Date(this.currentYear, this.currentMonth, 0).getDate()
|
||||
this.days.push({
|
||||
day: prevMonthLastDay - startingDay + i + 1,
|
||||
currentMonth: false,
|
||||
date: new Date(this.currentYear, this.currentMonth - 1, prevMonthLastDay - startingDay + i + 1)
|
||||
})
|
||||
}
|
||||
|
||||
for (let i = 1; i <= daysInMonth; i++) {
|
||||
const date = new Date(this.currentYear, this.currentMonth, i)
|
||||
const dateString = `${this.currentYear}-${String(this.currentMonth + 1).padStart(2, '0')}-${String(i).padStart(
|
||||
2,
|
||||
'0'
|
||||
)}`
|
||||
this.days.push({
|
||||
day: i,
|
||||
currentMonth: true,
|
||||
date: date,
|
||||
customContent: this.customDates[dateString]
|
||||
})
|
||||
}
|
||||
for (let i = 1; i <= daysInMonth; i++) {
|
||||
const date = new Date(this.currentYear, this.currentMonth, i)
|
||||
const dateString = `${this.currentYear}-${String(this.currentMonth + 1).padStart(2, '0')}-${String(
|
||||
i
|
||||
).padStart(2, '0')}`
|
||||
this.days.push({
|
||||
day: i > 10 ? i : `0${i}`,
|
||||
currentMonth: true,
|
||||
date: date,
|
||||
customContent: this.customDates[dateString]
|
||||
})
|
||||
}
|
||||
|
||||
const remainingDays = 42 - this.days.length
|
||||
for (let i = 1; i <= remainingDays; i++) {
|
||||
this.days.push({
|
||||
day: i,
|
||||
currentMonth: false,
|
||||
date: new Date(this.currentYear, this.currentMonth + 1, i)
|
||||
})
|
||||
}
|
||||
const remainingDays = 42 - this.days.length
|
||||
for (let i = 1; i <= remainingDays; i++) {
|
||||
this.days.push({
|
||||
day: i,
|
||||
currentMonth: false,
|
||||
date: new Date(this.currentYear, this.currentMonth + 1, i),
|
||||
kjsfx: 0,
|
||||
dfx: 0,
|
||||
zfx: 0,
|
||||
gfx: 0,
|
||||
tgfx: 0,
|
||||
currentDay: ''
|
||||
})
|
||||
}
|
||||
|
||||
resolve()
|
||||
}).then(() => {
|
||||
this.getMonthRiskData()
|
||||
})
|
||||
},
|
||||
changeMonth(delta) {
|
||||
this.currentMonth += delta
|
||||
|
|
@ -261,7 +246,11 @@ export default {
|
|||
this.currentMonth = 11
|
||||
this.currentYear--
|
||||
}
|
||||
this.currentQueryDay = this.currentYear + '-' + (this.currentMonth + 1)
|
||||
|
||||
console.log('this.currentQueryDay ', this.currentQueryDay)
|
||||
this.generateCalendar()
|
||||
this.getMonthRiskData()
|
||||
},
|
||||
changeDay(delta) {
|
||||
if (delta > 0) {
|
||||
|
|
@ -280,10 +269,23 @@ export default {
|
|||
this.weekStart = this.$moment(this.weekStart).subtract(7, 'days').format('YYYY-MM-DD')
|
||||
this.weekEnd = this.$moment(this.weekEnd).subtract(7, 'days').format('YYYY-MM-DD')
|
||||
}
|
||||
this.currentPramsWeekDay = this.weekStart
|
||||
this.getWeekDataFun()
|
||||
},
|
||||
selectDate(day) {
|
||||
console.log('选择的日期', day.date)
|
||||
// 在这里可以添加选择日期后的逻辑
|
||||
this.currentPramsWeekDay = day.currentDay
|
||||
this.getWeekDataFun()
|
||||
this.weekStart = this.$moment(day.currentDay).startOf('week').format('YYYY-MM-DD')
|
||||
this.weekEnd = this.$moment(day.currentDay).endOf('week').format('YYYY-MM-DD')
|
||||
this.activeType = 2
|
||||
},
|
||||
|
||||
/* 根据周获取数据 */
|
||||
async getWeekDataFun() {
|
||||
console.log('this.currentPramsWeekDay', this.currentPramsWeekDay)
|
||||
const res = await getWeekDataApi({ day: this.currentPramsWeekDay })
|
||||
console.log('resssss', res)
|
||||
this.weekCompanyList = res.data
|
||||
},
|
||||
onTransWeek(num) {
|
||||
let weekStr = ''
|
||||
|
|
@ -315,6 +317,67 @@ export default {
|
|||
},
|
||||
onCheckTime(type) {
|
||||
this.activeType = type
|
||||
if (type == 1) {
|
||||
/* 切换月 */
|
||||
this.currentYear = new Date().getFullYear()
|
||||
this.currentMonth = new Date().getMonth()
|
||||
this.currentQueryDay = this.currentYear + '-' + (this.currentMonth + 1)
|
||||
this.generateCalendar()
|
||||
// this.getMonthRiskData()
|
||||
}
|
||||
if (type == 2) {
|
||||
/* 切换周 */
|
||||
this.weekStart = this.$moment().week(this.$moment().week()).startOf('week').format('YYYY-MM-DD')
|
||||
this.weekEnd = this.$moment().week(this.$moment().week()).endOf('week').format('YYYY-MM-DD')
|
||||
this.currentPramsWeekDay = this.weekStart
|
||||
this.getWeekDataFun()
|
||||
}
|
||||
if (type == 3) {
|
||||
/* 切换日 */
|
||||
this.currentDay = this.$moment().format('YYYY-MM-DD')
|
||||
this.getProFxByDayFun()
|
||||
}
|
||||
},
|
||||
/* 获取今日作业人数 */
|
||||
async getDayUserData() {
|
||||
const res = await getDayUserApi({ day: this.$moment().format('YYYY-MM-DD') })
|
||||
console.log('今日作业人数---', res)
|
||||
|
||||
this.todayCount = res.count
|
||||
},
|
||||
/* 获取当月数据 */
|
||||
async getMonthRiskData() {
|
||||
console.log('this.currentQueryDay', this.currentQueryDay)
|
||||
const res = await getMonthRiskApi({ month: this.currentQueryDay })
|
||||
|
||||
if (res.code == 200) {
|
||||
const monthList = res.data
|
||||
for (let i = 0; i < monthList.length; i++) {
|
||||
for (let j = 0; j < this.days.length; j++) {
|
||||
if (monthList[i].dayNum == this.days[j].day) {
|
||||
const { kjsfx, dfx, zfx, gfx, tgfx } = monthList[i]
|
||||
this.days[j].kjsfx = kjsfx
|
||||
this.days[j].dfx = dfx
|
||||
this.days[j].zfx = zfx
|
||||
this.days[j].gfx = gfx
|
||||
this.days[j].tgfx = tgfx
|
||||
this.days[j].currentDay = monthList[i].day
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
console.log('res---', res)
|
||||
},
|
||||
onViewDayData(day) {
|
||||
this.currentDay = day
|
||||
this.getProFxByDayFun()
|
||||
this.activeType = 3
|
||||
},
|
||||
/* 获取当日数据 */
|
||||
async getProFxByDayFun() {
|
||||
const res = await getProFxByDayApi({ day: this.currentDay })
|
||||
this.currentDayInfo = res.data[0]
|
||||
console.log('----------当日数据', res)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -325,6 +388,25 @@ export default {
|
|||
width: 100%;
|
||||
margin-top: 30rpx;
|
||||
/* padding: 20rpx; */
|
||||
|
||||
h2 {
|
||||
padding: 18rpx 0;
|
||||
font-size: 34rpx;
|
||||
}
|
||||
|
||||
.today-work-num {
|
||||
width: 100%;
|
||||
padding: 10rpx 0;
|
||||
text-align: right;
|
||||
font-size: 24rpx;
|
||||
font-weight: bold;
|
||||
|
||||
text {
|
||||
padding-right: 8rpx;
|
||||
font-weight: normal;
|
||||
color: #4dbfa3;
|
||||
}
|
||||
}
|
||||
}
|
||||
.header {
|
||||
width: 100%;
|
||||
|
|
@ -396,30 +478,44 @@ export default {
|
|||
.risk-container {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
height: 160rpx;
|
||||
margin-bottom: 30rpx;
|
||||
flex-direction: column;
|
||||
justify-content: flex-start;
|
||||
|
||||
text {
|
||||
width: 100%;
|
||||
// height: 20rpx;
|
||||
display: block;
|
||||
margin-bottom: 3rpx;
|
||||
padding-left: 3rpx;
|
||||
text-align: left;
|
||||
font-size: 24rpx;
|
||||
box-sizing: border-box;
|
||||
// visibility: hidden;
|
||||
}
|
||||
}
|
||||
.risk-container text:first-child {
|
||||
background-color: #fde9cf;
|
||||
border-left: 2px solid #fa8d0a;
|
||||
}
|
||||
|
||||
.risk-container text:nth-child(2) {
|
||||
.risk-container text:nth-child(1) {
|
||||
background-color: #cff2ec;
|
||||
border-left: 2px solid #1db691;
|
||||
}
|
||||
.risk-container text:nth-child(3) {
|
||||
.risk-container text:nth-child(2) {
|
||||
background-color: #d8fbff;
|
||||
border-left: 2px solid #45e6ed;
|
||||
}
|
||||
.risk-container text:nth-child(3) {
|
||||
background-color: #fde9cf;
|
||||
border-left: 2px solid #fa8d0a;
|
||||
}
|
||||
.risk-container text:nth-child(4) {
|
||||
background-color: #ffd5d6;
|
||||
border-left: 2px solid #eb363b;
|
||||
}
|
||||
.risk-container text:nth-child(5) {
|
||||
background-color: #ffd5d6;
|
||||
border-left: 2px solid #eb363b;
|
||||
}
|
||||
}
|
||||
.days view {
|
||||
width: 14.28%;
|
||||
|
|
@ -453,10 +549,20 @@ export default {
|
|||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
}
|
||||
|
||||
.week-td view {
|
||||
height: 260rpx;
|
||||
padding: 10rpx 0;
|
||||
border-bottom: 1px solid #ccc;
|
||||
}
|
||||
|
||||
.week-td view:first-child {
|
||||
border-right: 1px solid #ccc;
|
||||
justify-content: center !important;
|
||||
}
|
||||
|
||||
.week-td view text {
|
||||
width: 100%;
|
||||
margin-bottom: 3rpx;
|
||||
|
|
@ -519,6 +625,10 @@ export default {
|
|||
border-left: 1px solid #ccc;
|
||||
border-right: 1px solid #ccc;
|
||||
}
|
||||
.day-td view:last-child {
|
||||
justify-content: flex-start;
|
||||
padding: 8rpx 0;
|
||||
}
|
||||
|
||||
.day-td view:last-child text {
|
||||
width: 100%;
|
||||
|
|
|
|||
|
|
@ -5,29 +5,44 @@
|
|||
<view class="left-content">
|
||||
<text>本月风险数</text>
|
||||
<text>{{ monthNum }}</text>
|
||||
<text>累计总数: {{ monthAmount }}</text>
|
||||
<text>累计总数: {{ monthNum }}</text>
|
||||
</view>
|
||||
<view class="left-right">
|
||||
<text>本周风险数</text>
|
||||
<text>{{ weekNum }}</text>
|
||||
<text>累计总数: {{ weekAmount }}</text>
|
||||
<text>累计总数: {{ weekNum }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getTitleRiskApi } from '../../../../api/workPlan/homePage'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
monthNum: 1420,
|
||||
monthNum: 0,
|
||||
monthAmount: 9520,
|
||||
weekNum: 320,
|
||||
weekNum: 0,
|
||||
weekAmount: 9820
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
getRiskNumData() {}
|
||||
async getRiskNumData() {
|
||||
const res = await getTitleRiskApi()
|
||||
console.log('风险数据---', res)
|
||||
|
||||
if (res.resMsg == '数据获取成功') {
|
||||
res.obj.list.forEach(e => {
|
||||
if (e.type == 'm') {
|
||||
this.monthNum = e.num
|
||||
}
|
||||
if (e.type == 'w1') {
|
||||
this.weekNum = e.num
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.getRiskNumData()
|
||||
|
|
@ -37,6 +52,10 @@ export default {
|
|||
|
||||
<style lang="scss" scoped>
|
||||
.day-risk {
|
||||
h2 {
|
||||
padding: 18rpx 0;
|
||||
font-size: 34rpx;
|
||||
}
|
||||
.data-container {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
<view class="uni-notice-bar">
|
||||
<uni-notice-bar
|
||||
style="height: 100%"
|
||||
:speed="30"
|
||||
:speed="50"
|
||||
scrollable
|
||||
:text="noticeContent"
|
||||
:showClose="showClose"
|
||||
|
|
@ -17,13 +17,14 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import { getTitleRiskApi } from '../../../../api/workPlan/homePage'
|
||||
export default {
|
||||
props: {
|
||||
/* 提示内容 */
|
||||
noticeContent: {
|
||||
type: String,
|
||||
default: '中风险:35 低风险:153 可接收风险:153 高风险:126'
|
||||
},
|
||||
// /* 提示内容 */
|
||||
// noticeContent: {
|
||||
// type: String,
|
||||
// default: '中风险:35 低风险:153 可接收风险:153 高风险:126'
|
||||
// },
|
||||
/* 是否显示关闭按钮 */
|
||||
showClose: {
|
||||
type: Boolean,
|
||||
|
|
@ -34,6 +35,50 @@ export default {
|
|||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
kjs: 0,
|
||||
dfx: 0,
|
||||
zfx: 0,
|
||||
gfx: 0,
|
||||
tfx: 0
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
noticeContent() {
|
||||
const amount = this.kjs + this.dfx + +this.zfx + this.gfx + this.tfx
|
||||
return `风险总数${amount} 可接受风险${this.kjs} 低风险${this.dfx} 中风险${this.zfx} 高风险${this.gfx} 特高风险${this.tfx}`
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
async getRiskNumData() {
|
||||
const res = await getTitleRiskApi()
|
||||
console.log('风险数据---', res)
|
||||
|
||||
if (res.resMsg == '数据获取成功') {
|
||||
res.obj.list.forEach(e => {
|
||||
if (e.type == '可1') {
|
||||
this.kjs = e.num * 1
|
||||
}
|
||||
if (e.type == '低1') {
|
||||
this.dfx = e.num * 1
|
||||
}
|
||||
if (e.type == '中1') {
|
||||
this.zfx = e.num * 1
|
||||
}
|
||||
if (e.type == '高1') {
|
||||
this.gfx = e.num * 1
|
||||
}
|
||||
if (e.type == '特高1') {
|
||||
this.tfx = e.num * 1
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.getRiskNumData()
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -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
|
||||
Loading…
Reference in New Issue