pad-app/pages/shipWork/patrol.vue

244 lines
5.0 KiB
Vue

<template>
<view class="patrol">
<head-view :title="title" url="/pages/shipWork/documentList"></head-view>
<view class="container contentFixed">
<template v-if="infoList.length > 0">
<view class="ul">
<view class="li" v-for="(item,index) in infoList" :key="index" @click="add('look',item,index)">
<view class="title">
<image src="../../static/images/shipWork/hc.png" mode="widthFix"></image>
<text>航次:{{item.vvyName}}</text>
</view>
<view class="liInfo">
<p>类型:{{item.type}}</text></p>
<p>贸易类型:{{item.tradeTypeName}}</p>
<p>进出口:{{item.importExportName}}</p>
</view>
<!-- <view class="status didNot">
<p>未上传</p>
</view> -->
<!-- <view class="status success">
<p>已上传</p>
</view>
<view class="status fail">
<p>上传失败</p>
</view> -->
</view>
</view>
</template>
<o-empty v-else height="70vh" bg="#f5f6fa" />
<view class="addBtn" @click="add('add')">+ </view>
</view>
</view>
</template>
<script>
import sqlite from "../../common/sqlite.js"
export default {
data() {
return {
title: "船只 - 安全巡检",
vtpId: "",
shipInfo: {},
infoList: [],
portObj: {},
loginObj: {},
vvyList: "",
}
},
mounted() {
let title = uni.getStorageSync('shipWorkTitle')
this.title = `${title} / 安全巡检`
this.portObj = uni.getStorageSync('portObj')
this.loginObj = uni.getStorageSync('loginObj')
this.vtpId = uni.getStorageSync('vtpId')
this.executeSql1('voyageScheduleDataDetailRespDTOList')
},
methods: {
// 查
executeSql1(tableName) {
let sql = `select * from ${tableName} WHERE vtpId = '${this.vtpId}'`
sqlite.executeSqlCeshi(sql).then((value) => {
// 在resolve时执行的回调函数
this.vvyList = value
let vvyIds = []
this.vvyList.forEach(v => {
vvyIds.push(v.vvyId)
})
this.initData(vvyIds)
}).catch((error) => {
// 在reject时执行的回调函数
console.error(error);
});
},
initData(vvyIds) {
// console.log(`pamId=${this.portObj.portId}&vvyIds=${vvyIds}`)
uni.request({
url: `${this.$local}/api/safetyInspection/page?pamId=${this.portObj.portId}&vvyIds=${vvyIds}`,
header: {
'Content-Type': 'application/json', //自定义请求头信息
'Authorization': `Bearer ${this.loginObj.access_token}`
},
method: 'GET', //请求方式,必须为大写
success: (res) => {
this.infoList = res.data.data.records
},
fail: () => {
}
})
},
add(state, item, index) {
if (state != 'add') {
uni.setStorageSync('patrolRow', item);
uni.setStorageSync('patrolRowIndex', index);
}
let id = ""
if (state != 'add') {
id = item.vsiId
}
const obj = {
state: state,
id: id,
}
const params = encodeURIComponent(JSON.stringify(obj));
uni.navigateTo({
url: `/pages/shipWork/patrolAdd?params=${params}`
})
},
}
}
</script>
<style lang="less" scoped>
.patrol {
.container {
padding: 30px 20px;
.ul {
padding: 20px 0;
display: flex;
flex-wrap: wrap;
.li {
width: 33%;
padding: 16px;
border: 1px solid #ccc;
background-color: #fff;
border-radius: 8px;
position: relative;
margin-bottom: 10px;
.title {
display: flex;
text {
font-size: 16px;
font-weight: bold;
display: flex;
flex-direction: column;
justify-content: center;
margin-left: 8px;
}
image {
width: 32px;
height: 32px;
}
}
.liInfo {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
margin-top: 16px;
p {
width: 49%;
margin-bottom: 12px;
text {
font-weight: bold;
}
}
}
.status {
padding: 5px;
position: absolute;
top: 16px;
right: 16px;
}
.didNot {
background-color: #FFF7EE;
color: #FC8300;
}
.success {
background: #F1F8FF;
color: #0067CF;
}
.fail {
background: #FFF0F0;
color: #E50101;
}
.shift {
display: flex;
padding: 16px 4px;
background-color: #f7f7f7;
margin: 5px 0;
text:first-child {
color: #0067CF;
margin: 0 12px;
}
.text {
color: #999;
}
.time {
color: #23262E;
margin-top: 3px;
margin-right: 15px;
}
}
.state {
display: flex;
flex-direction: column;
justify-content: center;
}
}
.li:nth-of-type(3n - 1) {
margin: 0 0.5% 10px;
}
/deep/.o-empty {
width: 100%;
}
}
.addBtn {
position: fixed;
right: 50px;
bottom: 50px;
width: 100px;
height: 100px;
border-radius: 50%;
background-color: #2979ff;
color: #fff;
font-size: 24px;
text-align: center;
line-height: 100px;
font-weight: bold;
}
}
}
</style>