pad-app/components/head-view/head-view.vue

229 lines
5.1 KiB
Vue
Raw Permalink Normal View History

2023-07-06 17:08:59 +08:00
<template>
<view class="headInfo">
2023-11-01 18:40:05 +08:00
<view>
<uni-icons class="icon" type="back" size="24" @click="toBack" />
<text @click="tabsPort('center')">{{title}}</text>
<uni-icons class="bottom" type="bottom" size="18" v-if="type" />
</view>
<uni-popup ref="popup" background-color="#fff">
<view class="popupBox">
<view class="popupTitle">
请选择船只
</view>
<view class="ul">
<view class="li" v-for="(item,index) in shipList" :key="index"
:class="{active:activeIndex == index}" @click="selectPort(item,index)">
<text>{{item.shipName}} 进口航次{{item.inVvyName}} / 出口航次{{item.outVvyName}}</text>
</view>
</view>
<view class="btnBox">
<button class="btn" type="primary" @click="toGo"> </button>
</view>
</view>
</uni-popup>
2023-07-06 17:08:59 +08:00
</view>
</template>
<script>
2023-11-01 18:40:05 +08:00
import sqlite from "../../common/sqlite.js"
2023-07-06 17:08:59 +08:00
export default {
name: "headView",
props: {
title: {
type: String
},
2023-08-24 16:22:29 +08:00
type: {
type: Boolean,
default: () => false
2023-08-24 17:06:35 +08:00
},
2023-09-23 20:16:54 +08:00
special: {
type: String,
default: () => ""
},
2023-08-24 17:06:35 +08:00
url: {
type: String,
default: () => ""
},
2023-07-06 17:08:59 +08:00
},
2023-11-01 18:40:05 +08:00
data() {
return {
shipList: [],
activeIndex: 0,
vtpId: "",
inVvyId: "",
inVvyName: "",
outVvyId: "",
outVvyName: "",
shipName: "",
}
},
mounted() {
this.vtpId = uni.getStorageSync('vtpId')
this.executeSql1("voyageScheduleDataDetailRespDTOList")
},
2023-07-06 17:08:59 +08:00
methods: {
2023-11-01 18:40:05 +08:00
// 船只
tabsPort(type) {
if (this.type) {
this.$refs.popup.open(type)
this.vtpId = this.shipList[0].vtpId
this.shipName = this.shipList[0].shipName
this.inVvyId = this.shipList[0].inVvyId
this.inVvyName = this.shipList[0].inVvyName
this.outVvyId = this.shipList[0].outVvyId
this.outVvyName = this.shipList[0].outVvyName
}
},
// 选择弹框内容
selectPort(item, index) {
this.activeIndex = index
this.vtpId = item.vtpId
this.shipName = item.shipName
this.inVvyId = item.inVvyId
this.inVvyName = item.inVvyName
this.outVvyId = item.outVvyId
this.outVvyName = item.outVvyName
},
// 点击确认
toGo() {
uni.setStorageSync('vtpId', this.vtpId)
this.$refs.popup.close()
this.title = `${this.shipName} 进口航次:${this.inVvyName} / 出口航次:${this.outVvyName}`
uni.setStorageSync('shipWorkTitle', this.title)
},
// 查
executeSql(sql) {
sqlite.executeSqlCeshi(sql).then((value) => {
value.forEach(v => {
2023-11-24 15:55:58 +08:00
this.inVvyId = ""
this.inVvyName = ""
this.outVvyId = ""
this.outVvyName = ""
2023-11-01 18:40:05 +08:00
if (v.importExportFlagName == '出口') {
this.inVvyId = v.vvyId
this.inVvyName = v.vvyName
} else {
this.outVvyId = v.vvyId
this.outVvyName = v.vvyName
}
let obj = {
inVvyId: this.inVvyId,
inVvyName: this.inVvyName,
outVvyId: this.outVvyId,
outVvyName: this.outVvyName,
shipName: v.spmName,
vtpId: v.vtpId
}
this.shipList.push(obj)
})
}).catch((error) => {
// 在reject时执行的回调函数
console.error(error);
});
},
executeSql1(tableName) {
let sql = `select * from ${tableName}`
this.executeSql(sql)
},
2023-07-06 17:08:59 +08:00
toBack() {
2023-08-24 17:06:35 +08:00
if (this.url != "") {
uni.navigateTo({
url: `${this.url}`
})
} else {
uni.navigateBack('-1')
}
2023-09-23 20:16:54 +08:00
if (this.special == 1) {
uni.setStorageSync('tabsType', 0);
}
2023-07-06 17:08:59 +08:00
}
}
}
</script>
2023-07-25 13:18:37 +08:00
<style lang="less" scoped>
2023-07-06 17:08:59 +08:00
.headInfo {
2023-11-01 18:40:05 +08:00
position: fixed;
top: 0;
left: 0;
2023-07-06 17:08:59 +08:00
background-color: #fff;
2023-11-01 18:40:05 +08:00
width: 100%;
2023-08-24 16:22:29 +08:00
height: 68px;
line-height: 68px;
font-size: 20px;
color: #23262E;
2023-07-06 17:08:59 +08:00
text-align: center;
2023-08-24 16:22:29 +08:00
font-weight: bold;
box-shadow: 0 2px 6px 0 rgba(0, 0, 0, 0.10);
2023-11-01 18:40:05 +08:00
z-index: 9999;
2023-07-06 17:08:59 +08:00
.icon {
position: absolute;
2023-11-01 18:40:05 +08:00
left: 30px;
2023-07-06 17:08:59 +08:00
}
2023-08-24 16:22:29 +08:00
.bottom {
margin-left: 6px;
}
2023-11-01 18:40:05 +08:00
.popupBox {
min-width: 500px;
height: 300px;
.popupTitle {
width: 100%;
height: 48px;
line-height: 48px;
text-align: center;
font-size: 18px;
color: #23262E;
font-weight: bold;
border-bottom: 1px solid #eee;
}
.ul {
padding: 30px;
height: 192px;
overflow: scroll;
.li {
height: 40px;
line-height: 40px;
text-align: center;
border: 1px solid #ccc;
margin-bottom: 10px;
font-size: 14px;
}
.active {
color: #0079fe;
border-color: #0079fe;
}
}
.btnBox {
height: 40px;
display: flex;
justify-content: center;
box-shadow: 0 -3px 7px 0 rgba(0, 0, 0, 0.10);
border-radius: 0 0 16px 16px;
.btn {
width: 170px;
font-size: 16px;
padding: 10px;
margin: 10px;
height: 36px;
line-height: 18px;
background-color: #fff;
border: 1px solid rgba(0, 0, 0, .1);
}
.btn:last-child {
color: #fff;
background-color: #0067CF;
}
}
}
2023-07-06 17:08:59 +08:00
}
2023-07-12 18:06:16 +08:00
</style>