xytSk-App/pages/xcrw/detail/index.vue

212 lines
4.8 KiB
Vue

<template>
<view :style="{height:'100vh'}">
<u-status-bar></u-status-bar>
<u-navbar :title="taskTitle" :autoBack="true" :titleStyle="{
fontSize:'18px'
}" :height='44' :safeAreaInsetTop=true leftIconSize='20' leftIconColor='rgb(153, 153, 153)'>
</u-navbar>
<view class="" style="margin-top: 44px;;background-color: #f0f0f0;border-top: 1px solid #f0f0f0; height:calc(100vh - 44px)">
<view style="margin: 10px;background-color: #fff;padding: 10px;">
<view class="item">
<view class="blueTiao"></view>
<view class="title">
基本信息
</view>
</view>
<view class="contentItem">
<view class="itemC">
<text>任务标题</text>
<text>{{taskTitle}}</text>
</view>
<view class="itemC">
<text>任务类型</text>
<text>{{taskType == 1 ? "日常巡查" : taskType == 2 ? "特别检查" : taskType == 3 ? "汛前巡检" : '' }}</text>
</view>
<view class="itemC">
<text>任务内容</text>
<text>{{taskContent ? taskContent : ''}}</text>
</view>
<view class="itemC">
<text>开始日期</text>
<text>{{startDate}}</text>
</view>
<view class="itemC">
<text>结束日期</text>
<text>{{endDate}}</text>
</view>
</view>
</view>
<view v-show="status !== 2 && btnStatus == 0" style="display:flex;justify-content: center;margin-top: 20%;">
<view v-show="status !== 2 && btnStatus == 0" class="circle-btn" @click="startXc">{{statusType[status]}}</view>
</view>
<view class="" style="height: calc(100vh - 311px);overflow: auto;">
<view v-show="btnStatus != 0" style="margin: 10px;background-color: #fff;padding: 10px;">
<view class="item">
<view class="blueTiao"></view>
<view class="title">
巡检项
</view>
</view>
<view class="contentItem1" style="height: 100%;">
<db-form :xjItem="xjItem"></db-form>
</view>
</view>
</view>
</view>
</view>
</template>
<script>
import moment from 'moment'
import DbForm from './dbForm.vue'
export default {
components:{
DbForm
},
data() {
return {
taskTitle:'',
taskType:'',
taskContent:'',
startDate:'',
endDate:'',
status:'',
id:'',
btnStatus: 0,
xjItem:[],
list:["正常","异常"],
current:3,
statusType:{
0:'开始巡查',
1:'继续巡查',
2:'已完成'
},
};
},
methods: {
// 开始巡查
async startXc(){
try {
if(status == 0){
const {data} = await uni.$http.get(`/gunshiApp/xyt/inspect/task/startInspect/${this.id}`)
if(data.code == 200){
this.btnStatus = 1;
this.getXjItem(this.id)
}
}else if(status == 1){
this.btnStatus = 1;
this.getXjItem(this.id)
}
} catch (error) {
uni.$showMsg();
}
},
// 获取巡查项
async getXjItem(id){
try {
const {data} = await uni.$http.get(`/gunshiApp/xyt/inspect/detail/info?taskId=${id}`)
if(data.code == 200){
this.xjItem = data.data
}
} catch (error) {
uni.$showMsg();
}
},
},
onLoad(option){
this.taskTitle = option.taskTitle
this.taskType = option.taskType
this.taskContent = option.taskContent
this.startDate = (option.startDate)
this.endDate = option.endDate == "null" ? "" : option.endDate
this.status = option.status
this.id = option.id
}
}
</script>
<style lang="scss" scoped>
.myTitleStyle {
font-size: 30px;
background-color: red;
height: 200px;
}
.tabsClass {
margin-top: 44px;
height: 44px;
padding: 0 40px;
border-top: 1px solid #eee;
border-bottom: 1px solid #eee;
}
.circle-btn{
width: 120px;
height: 120px;
background-color: #007aff;
border-radius: 50%;
color:#fff;
text-align: center;
line-height: 120px;
}
.item {
padding-bottom: 10px;
display: flex;
align-items: center;
// justify-content: space-between;
.blueTiao{
background-color: #007aff;
width: 5px;
height: 16px;
margin-right: 10px;
}
.title {
border-width: 0px;
font-family: '微软雅黑 Bold', '微软雅黑 Regular', '微软雅黑', sans-serif;
font-weight: 700;
font-style: normal;
font-size: 15px;
color: #666666
}
.titleRight {
display: flex;
.border {
border-width: 0px;
background-color: rgba(236, 245, 255, 1);
box-sizing: border-box;
border-width: 1px;
border-style: solid;
border-color: rgba(187, 220, 255, 1);
border-radius: 5px;
box-shadow: none;
width: 58px;
height: 25px;
color: #689FFF;
text-align: center;
}
}
}
.contentItem{
.itemC{
display: flex;
justify-content: space-between;
display: flex;
color: #666666;
padding: 10px;
border-bottom: 1px solid #f0f0f0;
}
.itemNo{
color: #666666;
padding: 10px;
}
}
</style>