pad-app/pages/shipWork/patrol.vue

194 lines
4.3 KiB
Vue
Raw Permalink Normal View History

2023-07-12 17:46:47 +08:00
<template>
<view class="patrol">
2023-08-24 17:06:35 +08:00
<head-view :title="title" url="/pages/shipWork/documentList"></head-view>
2023-11-01 18:40:05 +08:00
<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)">
2023-08-23 17:42:44 +08:00
<view class="title">
2023-09-23 20:16:54 +08:00
<image src="../../static/images/shipWork/hc.png" mode="widthFix"></image>
2023-08-23 17:42:44 +08:00
<text>航次{{item.vvyName}}</text>
</view>
<view class="liInfo">
2023-12-27 17:57:26 +08:00
<p>类型<text>{{item.type}}</text></p>
<p>贸易类型<text>{{item.tradeTypeName}}</text></p>
<p>进出口<text>{{item.importExportName}}</text></p>
2023-08-23 17:42:44 +08:00
</view>
2023-11-21 17:43:02 +08:00
<!-- <view class="status didNot">
2023-08-23 17:42:44 +08:00
<p>未上传</p>
2023-11-21 17:43:02 +08:00
</view> -->
2023-08-23 17:42:44 +08:00
<!-- <view class="status success">
<p>已上传</p>
</view>
<view class="status fail">
<p>上传失败</p>
</view> -->
</view>
2023-07-20 17:16:08 +08:00
</view>
</template>
<o-empty v-else height="70vh" bg="#f5f6fa" />
2023-07-12 17:46:47 +08:00
<view class="addBtn" @click="add('add')">+ </view>
</view>
</view>
</template>
<script>
2023-08-01 09:32:45 +08:00
import sqlite from "../../common/sqlite.js"
2023-07-12 17:46:47 +08:00
export default {
data() {
return {
2023-08-24 16:22:29 +08:00
title: "船只 - 安全巡检",
2023-11-21 17:43:02 +08:00
vtpId: "",
2023-07-20 17:16:08 +08:00
shipInfo: {},
2023-11-21 17:43:02 +08:00
infoList: [],
portObj: {},
loginObj: {},
vvyList: "",
2023-07-12 17:46:47 +08:00
}
},
2023-07-20 17:16:08 +08:00
mounted() {
2023-11-21 17:43:02 +08:00
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')
2023-07-20 17:16:08 +08:00
},
2023-07-12 17:46:47 +08:00
methods: {
2023-08-01 09:32:45 +08:00
// 查
2023-08-01 14:35:05 +08:00
executeSql1(tableName) {
2023-11-21 17:43:02 +08:00
let sql = `select * from ${tableName} WHERE vtpId = '${this.vtpId}'`
2023-08-01 09:32:45 +08:00
sqlite.executeSqlCeshi(sql).then((value) => {
// 在resolve时执行的回调函数
2023-11-21 17:43:02 +08:00
this.vvyList = value
let vvyIds = []
this.vvyList.forEach(v => {
vvyIds.push(v.vvyId)
})
this.initData(vvyIds)
2023-08-01 09:32:45 +08:00
}).catch((error) => {
// 在reject时执行的回调函数
console.error(error);
});
},
2023-11-21 17:43:02 +08:00
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: () => {
}
})
},
2023-07-20 17:16:08 +08:00
add(state, item, index) {
if (state != 'add') {
uni.setStorageSync('patrolRow', item);
uni.setStorageSync('patrolRowIndex', index);
}
2023-11-21 17:43:02 +08:00
let id = ""
if (state != 'add') {
id = item.vsiId
}
2023-07-12 17:46:47 +08:00
const obj = {
state: state,
2023-11-21 17:43:02 +08:00
id: id,
2023-07-12 17:46:47 +08:00
}
const params = encodeURIComponent(JSON.stringify(obj));
uni.navigateTo({
url: `/pages/shipWork/patrolAdd?params=${params}`
})
},
}
}
</script>
<style lang="less" scoped>
.patrol {
.container {
padding: 30px 20px;
2023-07-20 17:16:08 +08:00
.ul {
2023-07-12 17:46:47 +08:00
padding: 20px 0;
2023-08-23 17:42:44 +08:00
display: flex;
flex-wrap: wrap;
2023-07-12 17:46:47 +08:00
2023-07-20 17:16:08 +08:00
.li {
2023-08-23 17:42:44 +08:00
width: 33%;
padding: 16px;
border: 1px solid #ccc;
background-color: #fff;
border-radius: 8px;
position: relative;
margin-bottom: 10px;
2023-07-12 17:46:47 +08:00
.title {
2023-08-23 17:42:44 +08:00
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;
2023-12-27 17:57:26 +08:00
margin-top: 24px;
2023-08-23 17:42:44 +08:00
p {
width: 49%;
margin-bottom: 12px;
2023-12-27 17:57:26 +08:00
color: #999;
2023-08-23 17:42:44 +08:00
text {
font-weight: bold;
2023-12-27 17:57:26 +08:00
color: #23262e;
2023-08-23 17:42:44 +08:00
}
}
}
2023-07-12 17:46:47 +08:00
}
2023-08-23 17:42:44 +08:00
.li:nth-of-type(3n - 1) {
margin: 0 0.5% 10px;
}
/deep/.o-empty {
width: 100%;
}
2023-07-12 17:46:47 +08:00
}
.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>