首页跳转等页面完善 接口接口完善

This commit is contained in:
BianLzhaoMin 2024-11-04 18:47:55 +08:00
parent 2d43edd5b8
commit 4db146875b
5 changed files with 277 additions and 60 deletions

52
api/workPlan/workPlan.js Normal file
View File

@ -0,0 +1,52 @@
import request_yn from '@/utils/request_new_yn' // 测试环境 19191
import request_yn_new from '@/utils/request_new_yn_home' // 测试环境 1918
/* 获取作业计划列表 */
export function getWorkPlanListApi(data) {
return request_yn_new({
url: '/ynPlan/home/getProFxByDayKq',
method: 'post',
data: data
})
}
/* 作业计划列表 -- 收藏 */
export function setInfoDaySetProApi(data) {
return request_yn({
url: '/ynPlanApp/infDay/setPro',
method: 'post',
data: data
})
}
// 首页二级页面--作业计划详情-作业计划列表
export function getWorkPlanDetailsApi(data) {
return request_yn_new({
url: '/ynPlan/home/getjhxxq',
method: 'post',
data
})
}
// 首页二级页面--作业计划详情-作业人员及持证信息
export function getWorkPersonnelApi(data) {
return request_yn_new({
url: '/ynPlan/home/getDayUser',
method: 'post',
data
})
}
// 首页二级页面--作业计划详情-作业票、站班会照片
export function getStandGuardImgApi(data) {
return request_yn_new({
url: '/ynPlan/home/getZbhPhotos',
method: 'post',
data
})
}
// 首页二级页面--作业计划详情-持证信息详情
export function getHoldCardInfoApi(data) {
return request_yn_new({
url: '/ynPlan/home/getDayUserCZ',
method: 'post',
data
})
}

View File

@ -88,16 +88,16 @@
<view>作业人数</view> <view>作业人数</view>
<view> <view>
<text>{{ currentWeekDay }}</text> <text>{{ currentWeekDay }}</text>
<text>{{ currentDays }}</text> <text>{{ currentDayInfo.day.slice(5) ? currentDayInfo.day.slice(5) : currentDays }}</text>
</view> </view>
</view> </view>
<view class="day-td"> <view class="day-td">
<view>{{ currentDayInfo.proName || '' }}</view> <view>{{ currentDayInfo.proName || '' }}</view>
<view> <view @tap="onViewPersonDetails(currentDayInfo)">
<text>{{ currentDayInfo.rys || '' }}</text> <text style="color: #21a1f4">{{ currentDayInfo.rys || '' }}</text>
</view> </view>
<view @tap="onViewPersonDetails(currentDayInfo.idNumber)"> <view @tap="onViewPersonDetails(currentDayInfo)">
<text class="style_4" v-if="currentDayInfo.kjsfx > 0">可接受:{{ currentDayInfo.kjsfx }}</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_3" v-if="currentDayInfo.dfx > 0">:{{ currentDayInfo.dfx }}</text>
<text class="style_2" v-if="currentDayInfo.zfx > 0">:{{ currentDayInfo.zfx }}</text> <text class="style_2" v-if="currentDayInfo.zfx > 0">:{{ currentDayInfo.zfx }}</text>
@ -167,7 +167,8 @@ export default {
currentQueryDay: this.$moment().format('YYYY-MM'), currentQueryDay: this.$moment().format('YYYY-MM'),
currentPramsWeekDay: '', currentPramsWeekDay: '',
currentDayInfo: { currentDayInfo: {
proName: '' proName: '',
day: ''
} }
} }
}, },
@ -262,6 +263,7 @@ export default {
this.currentDay = this.$moment(this.currentDay).subtract(1, 'days').format('YYYY-MM-DD') this.currentDay = this.$moment(this.currentDay).subtract(1, 'days').format('YYYY-MM-DD')
this.currentDays = this.$moment(this.currentDays).subtract(1, 'days').format('MM-DD') this.currentDays = this.$moment(this.currentDays).subtract(1, 'days').format('MM-DD')
} }
this.getProFxByDayFun()
}, },
changeWeek(delta) { changeWeek(delta) {
if (delta > 0) { if (delta > 0) {
@ -381,10 +383,16 @@ export default {
if (res.data.length > 0) { if (res.data.length > 0) {
this.currentDayInfo = res.data[0] this.currentDayInfo = res.data[0]
console.log('----------当日数据', res) console.log('----------当日数据', res)
} else {
this.currentDayInfo = {
proName: '',
day: ''
}
} }
}, },
onViewPersonDetails(id) { onViewPersonDetails(info) {
uni.navigateTo({ url: `/pages/realName/index/pages/personDetail?idNumber=${id}` }) console.log('跳转前参数', info)
uni.navigateTo({ url: `/pages/workPlan/workPlan-details/index?query=${JSON.stringify(info)}` })
} }
} }
} }
@ -603,6 +611,7 @@ export default {
view { view {
width: 33.33%; width: 33.33%;
height: 100%;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
// align-items: center; // align-items: center;
@ -615,12 +624,18 @@ export default {
} }
} }
.day-th {
height: 68rpx;
// background-color: orange;
}
.day-td { .day-td {
// height: 180rpx; height: 300rpx;
border-bottom: 1px solid #ccc;
view { view {
height: 100%; height: 100%;
padding: 30rpx 0; // padding: 30rpx 0;
} }
} }

View File

@ -78,6 +78,7 @@ export default {
}, },
onViewRiskDetails() { onViewRiskDetails() {
uni.navigateTo({ url: '/pages/workPlan/workPlan/index' }) uni.navigateTo({ url: '/pages/workPlan/workPlan/index' })
// uni.navigateTo({ url: `/pages/workPlan/workPlan/index?day=${this.$moment().format('YYYY-MM-DD')}` })
} }
}, },
mounted() { mounted() {

View File

@ -36,11 +36,11 @@
<!-- <text>{{ item.xcfzr.split('')[1] }}</text> --> <!-- <text>{{ item.xcfzr.split('')[1] }}</text> -->
</view> </view>
<view>作业人员</view> <view>作业人员</view>
<view>{{ item.rys }}</view> <view style="color: #3f9dfd">{{ item.rys }}</view>
</view> </view>
<view class="row-2"> <view class="row-2">
<view>风险等级</view> <view>风险等级</view>
<view>{{ item.fxdj }}</view> <view :class="setStyle(item)">{{ item.fxdj }}</view>
<view>执行情况</view> <view>执行情况</view>
<view>{{ item.state }}</view> <view>{{ item.state }}</view>
</view> </view>
@ -53,6 +53,16 @@
</uni-section> </uni-section>
<uni-section title="作业人员" type="line"> <uni-section title="作业人员" type="line">
<template v-slot:right>
<!-- <view @tap="onSearchAllPerson" style="color: #3f9dfd">全部人员</view> -->
<uni-icons
type="info"
size="30"
style="margin-right: 20rpx; color: #ccc"
@tap="onViewWorkPersonExplain"
></uni-icons>
</template>
<uni-card :is-shadow="true" margin="6" padding="0"> <uni-card :is-shadow="true" margin="6" padding="0">
<view class="work-person"> <view class="work-person">
<view <view
@ -148,6 +158,35 @@
</view> </view>
</view> </view>
</uni-popup> </uni-popup>
<uni-popup ref="popupPerson" type="center">
<view class="popup-person">
<view class="title">颜色标识意义</view>
<view class="container">
<view class="item">
<view class="style_2">张三</view>
<view style="color: #000; font-weight: bold">蓝框白底:</view>
<view>未打卡的固定人员;</view>
</view>
<view class="item">
<view class="style_4">张三</view>
<view style="color: #000; font-weight: bold">红框白底:</view>
<view>未打卡的临时人员;</view>
</view>
<view class="item">
<view class="style_1" style="color: #fff">张三</view>
<view style="color: #000; font-weight: bold">蓝框蓝底:</view>
<view>已打卡的固定人员;</view>
</view>
<view class="item">
<view class="style_3" style="color: #fff">张三</view>
<view style="color: #000; font-weight: bold">红框红底:</view>
<view>已打卡的临时人员;</view>
</view>
</view>
<view style="color: #5dceb6" class="title" @tap="onClosePopupPerson">确定</view>
</view>
</uni-popup>
</view> </view>
</template> </template>
@ -157,7 +196,7 @@ import {
getWorkPersonnelApi, getWorkPersonnelApi,
getStandGuardImgApi, getStandGuardImgApi,
getHoldCardInfoApi getHoldCardInfoApi
} from '../../../api/phaseTwo/homePage' } from '../../../api/workPlan/workPlan'
import config from '@/config' import config from '@/config'
export default { export default {
data() { data() {
@ -177,7 +216,7 @@ export default {
loading: false, loading: false,
commonParams: { commonParams: {
proName: '', proName: '',
day: this.$moment().format('YYYY-MM-DD') day: ''
} }
} }
}, },
@ -195,6 +234,7 @@ export default {
} }
} }
}, },
getPersonStyle() { getPersonStyle() {
return item => { return item => {
const { kqState, userState } = item const { kqState, userState } = item
@ -204,6 +244,14 @@ export default {
if (userState != 1 && kqState == 1) return 'style_3' // if (userState != 1 && kqState == 1) return 'style_3' //
if (userState != 1 && kqState != 1) return 'style_4' // if (userState != 1 && kqState != 1) return 'style_4' //
} }
},
setStyle() {
return item => {
const { fxdj } = item
if (fxdj == '可接受风险' || fxdj == '低风险') return 'color_1'
if (fxdj == '中风险') return 'color_2'
if (fxdj == '高风险' || fxdj == '特高风险') return 'color_3'
}
} }
}, },
methods: { methods: {
@ -213,6 +261,7 @@ export default {
/* 获取今日作业计划 */ /* 获取今日作业计划 */
async getTodayWorkPlan() { async getTodayWorkPlan() {
const res = await getWorkPlanDetailsApi(this.commonParams) const res = await getWorkPlanDetailsApi(this.commonParams)
console.log('现场负责人数据', res)
this.todayWorkList = res.data this.todayWorkList = res.data
}, },
/* 获取人员信息 */ /* 获取人员信息 */
@ -224,8 +273,14 @@ export default {
const res = await getWorkPersonnelApi(params) const res = await getWorkPersonnelApi(params)
const response = await getStandGuardImgApi(params) const response = await getStandGuardImgApi(params)
console.log('response站班会照片', response)
this.workPersonList = res.data this.workPersonList = res.data
console.log('人员信息---', res) console.log('人员信息---', res)
if (response.data.length < 1) {
uni.showToast({ title: '暂无作业票、站班会照片信息', icon: 'none' })
}
this.holdCardList = res.datac this.holdCardList = res.datac
this.standGuardList = response.data this.standGuardList = response.data
@ -277,13 +332,24 @@ export default {
current: index, current: index,
loop: true loop: true
}) })
},
/* 作业人员备注说明 */
onViewWorkPersonExplain() {
this.$refs.popupPerson.open()
},
/* 确定关闭按钮 */
onClosePopupPerson() {
this.$refs.popupPerson.close()
} }
}, },
onLoad(options) { onLoad(options) {
const query = JSON.parse(options.query) const query = JSON.parse(options.query)
this.queryInfo = query this.queryInfo = query
const { proName } = query
console.log('携带的参数---', query)
const { proName, day } = query
this.commonParams.proName = proName this.commonParams.proName = proName
this.commonParams.day = day
this.getTodayWorkPlan().then(() => { this.getTodayWorkPlan().then(() => {
this.getWorkPersonnelData() this.getWorkPersonnelData()
}) })
@ -452,4 +518,69 @@ export default {
.img-container view:nth-child(3n + 1) { .img-container view:nth-child(3n + 1) {
margin-left: 0; margin-left: 0;
} }
.color_1 {
color: #06bd36;
}
.color_2 {
color: #f28b00;
}
.color_3 {
color: #ff4e4b;
}
.popup-person {
width: 83vw;
// height: ;
background-color: #fff;
.title {
font-size: 38rpx;
font-weight: bold;
color: #000;
text-align: center;
padding: 26rpx 0;
letter-spacing: 1px;
}
.container {
padding: 32rpx 0;
border-top: 1px solid #ccc;
border-bottom: 1px solid #ccc;
.item {
width: 85%;
margin: 0 auto;
padding: 12rpx 0;
display: flex;
align-items: center;
justify-content: center;
view {
box-sizing: border-box;
margin: 0 16rpx;
}
.style_1 {
background-color: #3f9dfd;
}
.style_2 {
border: 1px solid #3f9dfd;
color: #000;
}
.style_3 {
background-color: #fb1515;
}
.style_4 {
border: 1px solid #fb1515;
color: #000;
}
}
.item view:first-child {
padding: 8rpx 20rpx;
border-radius: 8rpx;
}
}
}
</style> </style>

View File

@ -15,7 +15,7 @@
<view style="width: 90%"> <view style="width: 90%">
<uni-easyinput <uni-easyinput
suffixIcon="search" suffixIcon="search"
v-model="queryParams.params.proName" v-model="queryParams.keyWord"
placeholder="请输入工程信息" placeholder="请输入工程信息"
@iconClick="getWorkPlantData" @iconClick="getWorkPlantData"
></uni-easyinput> ></uni-easyinput>
@ -31,15 +31,15 @@
<view>{{ index + 1 }}</view> <view>{{ index + 1 }}</view>
<view>{{ item.proName }}</view> <view>{{ item.proName }}</view>
<uni-icons <uni-icons
:type="item.isCollect == 1 ? 'star-filled' : 'star'" :type="item.state == 1 ? 'star-filled' : 'star'"
size="20" size="20"
@tap="onCollection(item)" @tap="onCollection(item)"
:style="{ color: item.isCollect == 1 ? '#f9971e' : '' }" :style="{ color: item.state == 1 ? '#f9971e' : '' }"
style="position: absolute; right: 1%" style="position: absolute; right: 1%"
></uni-icons> ></uni-icons>
</view> </view>
<view class="item-2" @tap="onViewWorkDetails(item)"> <view class="item-2" @tap="onViewWorkDetails(item)">
<view>{{ item.subComName }}</view> <view>{{ item.orgName }}</view>
<view> <view>
<text v-if="item.kjsfx > 0" style="color: #6ff6d5; margin-right: 6rpx">可接受风险{{ item.kjsfx }}</text> <text v-if="item.kjsfx > 0" style="color: #6ff6d5; margin-right: 6rpx">可接受风险{{ item.kjsfx }}</text>
<text v-if="item.dfx > 0" style="color: #25c294; margin-right: 6rpx">低风险{{ item.dfx }}</text> <text v-if="item.dfx > 0" style="color: #25c294; margin-right: 6rpx">低风险{{ item.dfx }}</text>
@ -50,11 +50,11 @@
</view> </view>
<view class="item-3" @tap="onViewWorkDetails(item)"> <view class="item-3" @tap="onViewWorkDetails(item)">
<view>作业人数</view> <view>作业人数</view>
<view style="color: #3f9dfd; font-weight: bold">{{ item.personNum }}</view> <view style="color: #3f9dfd; font-weight: bold">{{ item.rys }}</view>
<view>已考勤</view> <view>已考勤</view>
<view style="color: #36aa76; font-weight: bold">{{ item.planProNum }}</view> <view style="color: #36aa76; font-weight: bold">{{ item.onWorkNum }}</view>
<view>未考勤</view> <view>未考勤</view>
<view style="color: #f91008; font-weight: bold">{{ item.planNum }}</view> <view style="color: #f91008; font-weight: bold">{{ item.offWorkNum }}</view>
</view> </view>
</view> </view>
</scroll-view> </scroll-view>
@ -91,6 +91,8 @@
<script> <script>
import { getHomePageSelectApi } from '../../../api/phaseTwo/homePage' import { getHomePageSelectApi } from '../../../api/phaseTwo/homePage'
import { getWorkPlanListApi, setInfoDaySetProApi } from '../../../api/workPlan/workPlan'
import config from '@/config' import config from '@/config'
export default { export default {
data() { data() {
@ -102,13 +104,16 @@ export default {
// token: uni.getStorageSync('tyToken'), // token: uni.getStorageSync('tyToken'),
// //
queryParams: { queryParams: {
offset: 0, // offset: 0,
limit: 99999, // limit: 99999,
params: { // params: {
userId: uni.getStorageSync('realNameUser').userId + '', // userId: uni.getStorageSync('realNameUser').userId + '',
proName: '', // proName: '',
subComName: '' // subComName: ''
} // }
day: this.$moment().format('YYYY-MM-DD'),
keyWord: '',
orgName: ''
}, },
companyList: [{ name: '全部', id: '' }], companyList: [{ name: '全部', id: '' }],
companyInfoList: [] companyInfoList: []
@ -121,16 +126,19 @@ export default {
methods: { methods: {
/* 获取作业计划列表 */ /* 获取作业计划列表 */
async getWorkPlantData() { async getWorkPlantData() {
// const res = await getWorkPlanListApi(this.queryParams)
console.log('作业计划列表查询参数--', this.queryParams)
uni.request({ uni.request({
url: config.realNewBmwUrl + '/bmw/homeSubPage/getAppDayPlanMsg', url: config.realNewYnUrl + '/ynPlan/home/getProFxByDayKq',
method: 'POST', method: 'POST',
data: JSON.stringify(this.queryParams), data: this.queryParams,
header: { header: {
'Content-Type': 'application/json' 'Content-Type': 'application/x-www-form-urlencoded'
// token: this.token // token: this.token
}, },
success: res => { success: res => {
this.recordsTotal = res.data.recordsTotal this.recordsTotal = res.data.length
this.companyInfoList = res.data.data this.companyInfoList = res.data.data
console.log('resssss作业计划列表信息', res) console.log('resssss作业计划列表信息', res)
@ -154,15 +162,15 @@ export default {
onSelectCompany(index, name) { onSelectCompany(index, name) {
this.activeIndex = index this.activeIndex = index
if (index === 0) { if (index === 0) {
this.queryParams.params.subComName = '' this.queryParams.orgName = ''
} else { } else {
this.queryParams.params.subComName = name this.queryParams.orgName = name
} }
}, },
/* 重置 */ /* 重置 */
onReset() { onReset() {
this.activeIndex = 0 this.activeIndex = 0
this.queryParams.params.subComName = '' this.queryParams.orgName = ''
this.onQuery() this.onQuery()
}, },
/* 查询 */ /* 查询 */
@ -176,35 +184,45 @@ export default {
uni.navigateTo({ url: `/pages/workPlan/workPlan-details/index?query=${JSON.stringify(row)}` }) uni.navigateTo({ url: `/pages/workPlan/workPlan-details/index?query=${JSON.stringify(row)}` })
}, },
/* 收藏与取消收藏 */ /* 收藏与取消收藏 */
onCollection(row) { async onCollection(row) {
console.log('收藏--', this.token) console.log('收藏--', this.token)
const params = { const params = {
id: row.collectId, // id: row.collectId,
userId: uni.getStorageSync('realNameUser').userId, // userId: uni.getStorageSync('realNameUser').userId,
foreignId: row.proId, // foreignId: row.proId,
type: 1 // type: 1
proName: row.proName,
state: row.state == 0 ? 1 : 0
} }
console.log('params参数', params) const res = await setInfoDaySetProApi(params)
uni.request({
url: `${config.workPlanNewYnUrl}${ if (res.res == 1) {
row.isCollect == 0 ? '/app/offLine/insertCollect' : '/app/offLine/deleteCollect' uni.showToast({ icon: 'none', title: ` ${row.state == 0 ? '收藏成功' : '已取消收藏'}` })
}`, this.getWorkPlantData()
method: 'POST', }
data: JSON.stringify(params), //192.168.0.14:19191/ynPlanApp/ // console.log('', res)
header: {
'Content-Type': 'application/json', // console.log('params', params)
token: this.token // uni.request({
}, // url: `${config.workPlanNewYnUrl}${
success: res => { // row.isCollect == 0 ? '/app/offLine/insertCollect' : '/app/offLine/deleteCollect'
console.log('收藏结果---', res) // }`,
if (res.data.code === 200) { // method: 'POST',
uni.showToast({ icon: 'none', title: ` ${row.isCollect == 0 ? '收藏成功' : '已取消收藏'}` }) // data: JSON.stringify(params), //192.168.0.14:19191/ynPlanApp/
this.getWorkPlantData() // header: {
} // 'Content-Type': 'application/json',
}, // token: this.token
fail: err => {} // },
}) // success: res => {
// console.log('---', res)
// if (res.data.code === 200) {
// uni.showToast({ icon: 'none', title: ` ${row.isCollect == 0 ? '' : ''}` })
// this.getWorkPlantData()
// }
// },
// fail: err => {}
// })
} }
} }
} }