2023-07-03 17:49:29 +08:00
|
|
|
|
<template>
|
|
|
|
|
<view class="app">
|
|
|
|
|
<head-info></head-info>
|
|
|
|
|
<view class="container">
|
2023-07-05 10:56:11 +08:00
|
|
|
|
<side-bar path='1'></side-bar>
|
2023-07-03 17:49:29 +08:00
|
|
|
|
<view class="content">
|
|
|
|
|
<view class="form">
|
2023-07-06 17:08:59 +08:00
|
|
|
|
<view class="end">
|
2023-07-21 17:28:30 +08:00
|
|
|
|
<superwei-combox class="input" :candidates="portList" :isJSON="true" keyName="pamName"
|
|
|
|
|
placeholder="港区" v-model="portName" @input="portInput"
|
|
|
|
|
@select="portSelect"></superwei-combox>
|
|
|
|
|
<superwei-combox class="input" :candidates="shipList" :isJSON="true" keyName="vvyName"
|
|
|
|
|
placeholder="船名/航次" v-model="shipName" @input="shipInput"
|
|
|
|
|
@select="shipSelect"></superwei-combox>
|
2023-07-06 17:08:59 +08:00
|
|
|
|
</uni-easyinput>
|
2023-07-21 17:28:30 +08:00
|
|
|
|
<button class="btn" @click="onSearch">搜索</button>
|
2023-07-28 09:42:53 +08:00
|
|
|
|
<button class="btn" @click="open">打开</button>
|
|
|
|
|
<button class="btn" @click="isOpenDatabase">判断</button>
|
|
|
|
|
<button class="btn" @click="createTable">创建表</button>
|
|
|
|
|
<button class="btn" @click="dropTable">删除表</button>
|
|
|
|
|
<button class="btn" @click="insertChatRow">增</button>
|
|
|
|
|
<button class="btn" @click="executeSql1">查</button>
|
2023-07-06 17:08:59 +08:00
|
|
|
|
</view>
|
2023-07-03 17:49:29 +08:00
|
|
|
|
</view>
|
|
|
|
|
<view class="itemList">
|
2023-07-21 17:28:30 +08:00
|
|
|
|
<view v-for="(item, index) in ltemList" :key="index" class="item" @click="toDetails(item.spmId)">
|
2023-07-06 17:08:59 +08:00
|
|
|
|
<view class="title">
|
|
|
|
|
<view class="name">
|
|
|
|
|
海王星领袖
|
|
|
|
|
</view>
|
|
|
|
|
<view class="status">
|
2023-07-21 17:28:30 +08:00
|
|
|
|
<text v-if="item.vvyStatus==2" class="green">● 作业中</text>
|
2023-07-06 17:08:59 +08:00
|
|
|
|
<text v-else>● 已完成</text>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
<view class="table">
|
|
|
|
|
<view class="row">
|
|
|
|
|
<view class="nitem">
|
|
|
|
|
航次: <text>735546</text>
|
|
|
|
|
</view>
|
|
|
|
|
<view class="nitem">
|
2023-07-21 17:28:30 +08:00
|
|
|
|
贸易类型: <text>{{item.tradeType}}</text>
|
2023-07-06 17:08:59 +08:00
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
<view class="row">
|
|
|
|
|
<view class="nitem">
|
2023-07-21 17:28:30 +08:00
|
|
|
|
进出口: <text>{{item.importExportFlag}}</text>
|
2023-07-05 10:56:11 +08:00
|
|
|
|
</view>
|
2023-07-06 17:08:59 +08:00
|
|
|
|
<view class="nitem">
|
2023-07-21 17:28:30 +08:00
|
|
|
|
泊位: <text>{{item.actualBerthage}}</text>
|
2023-07-06 17:08:59 +08:00
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
2023-07-03 17:49:29 +08:00
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
import SideBar from '@/components/sider-bar/slider-bar';
|
|
|
|
|
import HeadInfo from '@/components/head-info/head-info';
|
2023-07-28 09:42:53 +08:00
|
|
|
|
import sqlite from "../../common/sqlite.js"
|
2023-07-21 17:28:30 +08:00
|
|
|
|
import {
|
|
|
|
|
mapActions
|
|
|
|
|
} from 'vuex'
|
|
|
|
|
let timers = null;
|
2023-07-03 17:49:29 +08:00
|
|
|
|
export default {
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
2023-07-21 17:28:30 +08:00
|
|
|
|
ltemList: [],
|
|
|
|
|
portName: '',
|
|
|
|
|
portItem: {},
|
|
|
|
|
portList: [],
|
|
|
|
|
shipName: '',
|
|
|
|
|
shipItem: {},
|
|
|
|
|
shipList: []
|
2023-07-03 17:49:29 +08:00
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
onLoad() {
|
2023-07-21 17:28:30 +08:00
|
|
|
|
// this.loadList()
|
2023-07-03 17:49:29 +08:00
|
|
|
|
},
|
|
|
|
|
components: {
|
|
|
|
|
SideBar,
|
|
|
|
|
HeadInfo
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
2023-07-21 17:28:30 +08:00
|
|
|
|
...mapActions([
|
|
|
|
|
'majax',
|
|
|
|
|
'najax'
|
|
|
|
|
]),
|
2023-07-28 09:42:53 +08:00
|
|
|
|
open() {
|
|
|
|
|
plus.sqlite.openDatabase({
|
|
|
|
|
name: 'dianji_chat',
|
|
|
|
|
path: '_doc/dianji_chat.db',
|
|
|
|
|
success: function(e) {
|
|
|
|
|
console.log('打开数据库成功')
|
|
|
|
|
},
|
|
|
|
|
fail: function(e) {
|
|
|
|
|
console.log(e, '打开数据库失败')
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
isOpenDatabase() {
|
|
|
|
|
let res = plus.sqlite.isOpenDatabase({
|
|
|
|
|
name: 'dianji_chat',
|
|
|
|
|
path: '_doc/dianji_chat.db',
|
|
|
|
|
});
|
|
|
|
|
if (res) {
|
|
|
|
|
uni.showToast({
|
|
|
|
|
icon: 'none',
|
|
|
|
|
title: '数据库已打开'
|
|
|
|
|
});
|
|
|
|
|
return;
|
|
|
|
|
} else {
|
|
|
|
|
uni.showToast({
|
|
|
|
|
icon: 'none',
|
|
|
|
|
title: '数据库未打开'
|
|
|
|
|
});
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
createTable() {
|
|
|
|
|
console.log('创建表');
|
|
|
|
|
let sql =
|
|
|
|
|
'CREATE TABLE if not exists cesTable ( "id" varchar(32) NOT NULL,"content" varchar(1024),"fromId" varchar(32), "toId" varchar(32), "flag" varchar(2), PRIMARY KEY ("id"));'
|
|
|
|
|
sqlite.executeSqlCeshi(sql).then((value) => {
|
|
|
|
|
// 在resolve时执行的回调函数
|
|
|
|
|
console.log(value); // 输出:Hello, World!
|
|
|
|
|
}).catch((error) => {
|
|
|
|
|
// 在reject时执行的回调函数
|
|
|
|
|
console.error(error);
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
dropTable() {
|
|
|
|
|
console.log('删除表');
|
|
|
|
|
let sql = 'DROP TABLE cesTable;'
|
|
|
|
|
plus.sqlite.executeSql({
|
|
|
|
|
name: 'dianji_chat',
|
|
|
|
|
sql: sql,
|
|
|
|
|
success: function(e) {
|
|
|
|
|
console.log("删除数据表成功");
|
|
|
|
|
},
|
|
|
|
|
fail: function(e) {
|
|
|
|
|
console.log('executeSql failed: ' + JSON.stringify(e));
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
insertChatRow() {
|
|
|
|
|
let data = {
|
|
|
|
|
id: 1,
|
|
|
|
|
fromId: '123',
|
|
|
|
|
toId: '321',
|
|
|
|
|
content: 'bihao1',
|
|
|
|
|
flag: 1
|
|
|
|
|
}
|
|
|
|
|
data.id = Math.floor(Math.random() * 100);
|
|
|
|
|
let dbTable = 'cesTable'
|
|
|
|
|
// let sql = "insert into " + this.dbTable + " values('" + data.id + "','" + data.content +
|
|
|
|
|
// "','" + data.fromId + "','" + data.toId + "'," + data.flag + ")";
|
|
|
|
|
let sql = "insert into " + dbTable + " values('" + data.id + "','" +
|
|
|
|
|
data.content + "','" + data.fromId + "','" + data.toId + "','" + data.flag + "')";
|
|
|
|
|
this.executeSql(sql)
|
|
|
|
|
},
|
|
|
|
|
// 查
|
|
|
|
|
executeSql(sql) {
|
|
|
|
|
sqlite.executeSqlCeshi(sql).then((value) => {
|
|
|
|
|
// 在resolve时执行的回调函数
|
|
|
|
|
// this.sqlData = value
|
|
|
|
|
console.log(value); // 输出:Hello, World!
|
|
|
|
|
}).catch((error) => {
|
|
|
|
|
// 在reject时执行的回调函数
|
|
|
|
|
console.error(error);
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
executeSql1() {
|
|
|
|
|
let sql = 'select * from cesTable'
|
|
|
|
|
sqlite.executeSqlCeshi(sql).then((value) => {
|
|
|
|
|
// 在resolve时执行的回调函数
|
|
|
|
|
// this.sqlData = value
|
|
|
|
|
console.log(value); // 输出:Hello, World!
|
|
|
|
|
}).catch((error) => {
|
|
|
|
|
// 在reject时执行的回调函数
|
|
|
|
|
console.error(error);
|
|
|
|
|
});
|
|
|
|
|
},
|
2023-07-21 17:28:30 +08:00
|
|
|
|
portInput(e) {
|
|
|
|
|
clearTimeout(timers)
|
|
|
|
|
timers = setTimeout(() => {
|
|
|
|
|
this.getPort(e)
|
|
|
|
|
}, 500)
|
|
|
|
|
},
|
|
|
|
|
portSelect(e) {
|
|
|
|
|
this.portItem = e
|
|
|
|
|
this.shipName = ''
|
|
|
|
|
this.shipItem = {}
|
|
|
|
|
},
|
|
|
|
|
// 获取港口
|
|
|
|
|
getPort(keyWords) {
|
|
|
|
|
let data = {}
|
|
|
|
|
data.pamName = keyWords
|
|
|
|
|
this.majax({
|
|
|
|
|
url: this.$local + "/api/miniapp/portAreaManage/getPortArea",
|
|
|
|
|
params: data,
|
|
|
|
|
method: 'GET'
|
|
|
|
|
}).then(res => {
|
|
|
|
|
this.portList = res.data
|
|
|
|
|
})
|
|
|
|
|
// 模拟
|
|
|
|
|
this.portList = [{
|
|
|
|
|
potId: 1123,
|
|
|
|
|
pamName: '测试港口'
|
|
|
|
|
}]
|
|
|
|
|
},
|
|
|
|
|
shipInput(e) {
|
|
|
|
|
clearTimeout(timers)
|
|
|
|
|
timers = setTimeout(() => {
|
|
|
|
|
this.getShip(e)
|
|
|
|
|
}, 500)
|
|
|
|
|
},
|
|
|
|
|
shipSelect(e) {
|
|
|
|
|
this.shipItem = e
|
|
|
|
|
},
|
|
|
|
|
// 获取船舶
|
|
|
|
|
getShip(keyWords) {
|
|
|
|
|
console.log(this.portName);
|
|
|
|
|
let data = {}
|
|
|
|
|
data.ieType = 'I' // I进口 E出口 暂无法区分
|
|
|
|
|
data.key = keyWords
|
|
|
|
|
data.pamId = this.portItem.pamId
|
|
|
|
|
this.majax({
|
|
|
|
|
url: this.$local + "/api/shipInstructions/queryByKey",
|
|
|
|
|
params: data,
|
|
|
|
|
method: 'GET'
|
|
|
|
|
}).then(res => {
|
|
|
|
|
this.shipList = res.data
|
|
|
|
|
})
|
|
|
|
|
// 模拟
|
|
|
|
|
this.shipList = [{
|
|
|
|
|
vvyId: 1123,
|
|
|
|
|
vvyName: '测试航次'
|
|
|
|
|
}]
|
|
|
|
|
},
|
|
|
|
|
onSearch() {
|
|
|
|
|
let data = {}
|
|
|
|
|
data.tradeType = '外贸' // I进口 E出口 暂无法区分
|
|
|
|
|
data.vvyId = this.shipItem.vvyId
|
|
|
|
|
data.pamId = this.portItem.pamId
|
|
|
|
|
this.majax({
|
|
|
|
|
url: this.$local + "/api/shipInstructions/queryStowageVoyages",
|
|
|
|
|
params: data,
|
|
|
|
|
method: 'GET'
|
|
|
|
|
}).then(res => {
|
|
|
|
|
this.ltemList = res.data.records
|
|
|
|
|
})
|
|
|
|
|
// 模拟
|
|
|
|
|
this.ltemList = [{
|
|
|
|
|
actualBerthage: "一号位置",
|
|
|
|
|
actualBerthageDesc: "",
|
|
|
|
|
importExportFlag: "出口",
|
|
|
|
|
spmId: "spm1112",
|
|
|
|
|
spmIdDesc: "331122",
|
|
|
|
|
tradeType: "内贸",
|
|
|
|
|
vvyId: "11231",
|
|
|
|
|
vvyName: "海王星领袖",
|
|
|
|
|
vvyStatus: "2",
|
|
|
|
|
vvyStatusName: "作业中",
|
|
|
|
|
}]
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
toDetails(id) {
|
2023-07-06 17:08:59 +08:00
|
|
|
|
uni.navigateTo({
|
2023-07-21 17:28:30 +08:00
|
|
|
|
url: '/pages/index/instruct?id=' + id
|
2023-07-06 17:08:59 +08:00
|
|
|
|
})
|
2023-07-13 17:21:12 +08:00
|
|
|
|
},
|
2023-07-03 17:49:29 +08:00
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
</script>
|
|
|
|
|
|
2023-07-25 13:20:04 +08:00
|
|
|
|
<style lang="less">
|
2023-07-03 17:49:29 +08:00
|
|
|
|
.container {
|
|
|
|
|
display: flex;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.content {
|
|
|
|
|
flex: 1;
|
|
|
|
|
padding: 20px;
|
|
|
|
|
|
|
|
|
|
.form {
|
|
|
|
|
display: flex;
|
|
|
|
|
justify-content: flex-end;
|
|
|
|
|
|
2023-07-06 17:08:59 +08:00
|
|
|
|
.end {
|
|
|
|
|
width: 500px;
|
|
|
|
|
display: flex;
|
|
|
|
|
justify-content: space-between;
|
|
|
|
|
|
|
|
|
|
.input {
|
|
|
|
|
width: 200px;
|
|
|
|
|
height: 35px;
|
|
|
|
|
line-height: 35px;
|
|
|
|
|
padding-left: 10px;
|
|
|
|
|
margin-left: 15px;
|
|
|
|
|
}
|
2023-07-21 17:28:30 +08:00
|
|
|
|
|
|
|
|
|
.btn {
|
|
|
|
|
height: 35px;
|
|
|
|
|
line-height: 35px;
|
|
|
|
|
margin-left: 20px;
|
|
|
|
|
}
|
2023-07-03 17:49:29 +08:00
|
|
|
|
}
|
2023-07-06 17:08:59 +08:00
|
|
|
|
|
2023-07-03 17:49:29 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.itemList {
|
|
|
|
|
width: 100%;
|
|
|
|
|
display: flex;
|
|
|
|
|
justify-content: flex-start;
|
|
|
|
|
flex-wrap: wrap;
|
2023-07-06 17:08:59 +08:00
|
|
|
|
|
2023-07-03 17:49:29 +08:00
|
|
|
|
.item {
|
|
|
|
|
width: 32%;
|
|
|
|
|
margin-top: 15px;
|
|
|
|
|
margin-right: 2%;
|
2023-07-05 10:56:11 +08:00
|
|
|
|
height: 160px;
|
2023-07-03 17:49:29 +08:00
|
|
|
|
border: 1px solid #c9cacb;
|
2023-07-05 10:56:11 +08:00
|
|
|
|
padding: 22px 15px;
|
2023-07-06 17:08:59 +08:00
|
|
|
|
|
2023-07-05 10:56:11 +08:00
|
|
|
|
.title {
|
|
|
|
|
display: flex;
|
|
|
|
|
justify-content: space-between;
|
|
|
|
|
font-size: 21px;
|
|
|
|
|
margin-bottom: 20px;
|
|
|
|
|
font-weight: 700;
|
|
|
|
|
}
|
2023-07-06 17:08:59 +08:00
|
|
|
|
|
2023-07-05 10:56:11 +08:00
|
|
|
|
.status {
|
|
|
|
|
font-size: 16px;
|
|
|
|
|
font-weight: 400;
|
|
|
|
|
}
|
2023-07-06 17:08:59 +08:00
|
|
|
|
|
|
|
|
|
|
2023-07-05 10:56:11 +08:00
|
|
|
|
.row {
|
|
|
|
|
display: flex;
|
|
|
|
|
justify-content: space-between;
|
|
|
|
|
font-size: 18px;
|
|
|
|
|
margin: 10px 0;
|
2023-07-06 17:08:59 +08:00
|
|
|
|
|
|
|
|
|
.nitem {
|
|
|
|
|
width: 46%;
|
|
|
|
|
|
|
|
|
|
text {
|
|
|
|
|
color: #929292;
|
|
|
|
|
}
|
2023-07-05 10:56:11 +08:00
|
|
|
|
}
|
2023-07-06 17:08:59 +08:00
|
|
|
|
|
2023-07-05 10:56:11 +08:00
|
|
|
|
}
|
2023-07-03 17:49:29 +08:00
|
|
|
|
}
|
2023-07-06 17:08:59 +08:00
|
|
|
|
|
2023-07-03 17:49:29 +08:00
|
|
|
|
.item:nth-child(3n) {
|
|
|
|
|
margin-right: 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2023-07-13 17:21:12 +08:00
|
|
|
|
</style>
|