2023-07-12 17:46:47 +08:00
|
|
|
|
<template>
|
|
|
|
|
<view class="untieAdd">
|
|
|
|
|
<view class="container">
|
2023-07-19 18:12:19 +08:00
|
|
|
|
<view class="ul">
|
|
|
|
|
<view class="li">
|
2023-07-12 17:46:47 +08:00
|
|
|
|
<p>船名:</p>
|
2023-07-19 18:12:19 +08:00
|
|
|
|
<text>{{shipInfo.voyageScheduleDataList[0].spmName}}</text>
|
|
|
|
|
</view>
|
|
|
|
|
<view class="li">
|
|
|
|
|
<p><text class="required" v-if="obj.state != 'look'">*</text>船舶净吨:</p>
|
2023-07-12 17:46:47 +08:00
|
|
|
|
<uni-number-box v-model="zlShip" v-if="obj.state != 'look'" />
|
2023-07-19 18:12:19 +08:00
|
|
|
|
<text v-else>{{zlShip}}</text>
|
|
|
|
|
</view>
|
|
|
|
|
<view class="li">
|
|
|
|
|
<p><text class="required" v-if="obj.state != 'look'">*</text>航次:</p>
|
2023-07-20 17:16:08 +08:00
|
|
|
|
<uni-data-select v-model="vvyId" :localdata="hcList" @change="hcChange"
|
2023-07-12 17:46:47 +08:00
|
|
|
|
v-if="obj.state != 'look'"></uni-data-select>
|
2023-07-20 17:16:08 +08:00
|
|
|
|
<text v-else>{{vvyName}}</text>
|
2023-07-19 18:12:19 +08:00
|
|
|
|
</view>
|
|
|
|
|
<view class="li">
|
2023-07-12 17:46:47 +08:00
|
|
|
|
<p>进出口:</p>
|
2023-07-19 18:12:19 +08:00
|
|
|
|
<text>{{shipInfo.voyageScheduleDataList[0].importExportFlagName}}</text>
|
|
|
|
|
</view>
|
|
|
|
|
<view class="li">
|
2023-07-12 17:46:47 +08:00
|
|
|
|
<p>贸易类型:</p>
|
2023-07-19 18:12:19 +08:00
|
|
|
|
<text>{{shipInfo.voyageScheduleDataList[0].tradeTypeName}}</text>
|
|
|
|
|
</view>
|
|
|
|
|
<view class="li">
|
|
|
|
|
<p><text class="required" v-if="obj.state != 'look'">*</text>泊位:</p>
|
2023-07-20 17:16:08 +08:00
|
|
|
|
<uni-data-select v-model="bthId" :localdata="bwList" @change="bwChange"
|
2023-07-12 17:46:47 +08:00
|
|
|
|
v-if="obj.state != 'look'"></uni-data-select>
|
2023-07-20 17:16:08 +08:00
|
|
|
|
<text v-else>{{bthIdName}}</text>
|
2023-07-19 18:12:19 +08:00
|
|
|
|
</view>
|
|
|
|
|
<view class="li">
|
|
|
|
|
<p><text class="required" v-if="obj.state != 'look'">*</text>系缆时间:</p>
|
2023-07-20 17:16:08 +08:00
|
|
|
|
<uni-datetime-picker v-model="attachTime" @change="changeLog1" v-if="obj.state != 'look'" />
|
|
|
|
|
<text v-else>{{attachTime}}</text>
|
2023-07-19 18:12:19 +08:00
|
|
|
|
</view>
|
|
|
|
|
<view class="li">
|
2023-07-12 17:46:47 +08:00
|
|
|
|
<p>解缆时间:</p>
|
2023-07-20 17:16:08 +08:00
|
|
|
|
<uni-datetime-picker v-model="unmoorTime" @change="changeLog2" v-if="obj.state != 'look'" />
|
|
|
|
|
<text v-else>{{unmoorTime}}</text>
|
2023-07-19 18:12:19 +08:00
|
|
|
|
</view>
|
|
|
|
|
<view class="li">
|
2023-07-12 17:46:47 +08:00
|
|
|
|
<p>移泊时间:</p>
|
2023-07-20 17:16:08 +08:00
|
|
|
|
<uni-datetime-picker v-model="shiftingBerthTime" @change="changeLog3" v-if="obj.state != 'look'" />
|
|
|
|
|
<text v-else>{{shiftingBerthTime}}</text>
|
2023-07-19 18:12:19 +08:00
|
|
|
|
</view>
|
|
|
|
|
<view class="li">
|
2023-07-12 17:46:47 +08:00
|
|
|
|
<p>停泊时间:</p>
|
2023-07-20 17:16:08 +08:00
|
|
|
|
<uni-datetime-picker v-model="noProductBerthTime" @change="changeLog4" v-if="obj.state != 'look'" />
|
|
|
|
|
<text v-else>{{noProductBerthTime}}</text>
|
2023-07-19 18:12:19 +08:00
|
|
|
|
</view>
|
|
|
|
|
</view>
|
2023-07-24 16:56:46 +08:00
|
|
|
|
<uni-popup ref="popup" type="dialog">
|
|
|
|
|
<uni-popup-dialog type="error" confirmText="确定" title="通知" content="是否删除此条数据"
|
|
|
|
|
@confirm="delConfirm"></uni-popup-dialog>
|
|
|
|
|
</uni-popup>
|
2023-07-12 17:46:47 +08:00
|
|
|
|
<view class="btnList">
|
|
|
|
|
<van-button type="default" @click="cancel">取消</van-button>
|
2023-07-19 18:12:19 +08:00
|
|
|
|
<van-button type="danger" v-if="obj.state == 'look'" @click="del">删除</van-button>
|
2023-07-12 17:46:47 +08:00
|
|
|
|
<van-button type="info" v-if="obj.state == 'add' || obj.state == 'edit'" @click="save">保存</van-button>
|
|
|
|
|
<van-button type="info" v-if="obj.state == 'look'" @click="toGo('edit')">编辑</van-button>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
2023-08-01 09:32:45 +08:00
|
|
|
|
import sqlite from "../../common/sqlite.js"
|
2023-08-01 14:35:05 +08:00
|
|
|
|
import api from "../../common/api.js"
|
2023-07-12 17:46:47 +08:00
|
|
|
|
export default {
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
2023-07-19 18:12:19 +08:00
|
|
|
|
shipInfo: {
|
|
|
|
|
voyageScheduleDataList: [{
|
|
|
|
|
spmName: "",
|
|
|
|
|
importExportFlagName: "",
|
|
|
|
|
tradeTypeName: ""
|
|
|
|
|
}]
|
|
|
|
|
},
|
2023-07-12 17:46:47 +08:00
|
|
|
|
obj: {},
|
2023-07-19 18:12:19 +08:00
|
|
|
|
untieRow: {},
|
|
|
|
|
untieRowIndex: 0,
|
2023-07-12 17:46:47 +08:00
|
|
|
|
// 航次下拉框
|
2023-07-20 17:16:08 +08:00
|
|
|
|
vvyId: "",
|
|
|
|
|
vvyName: "",
|
2023-07-19 18:12:19 +08:00
|
|
|
|
hcList: [],
|
2023-07-12 17:46:47 +08:00
|
|
|
|
// 船舶净吨
|
2023-07-19 18:12:19 +08:00
|
|
|
|
zlShip: 0,
|
2023-07-12 17:46:47 +08:00
|
|
|
|
// 泊位下拉框
|
2023-07-20 17:16:08 +08:00
|
|
|
|
bthId: "",
|
|
|
|
|
bthIdName: "",
|
2023-07-19 18:12:19 +08:00
|
|
|
|
bwList: [],
|
2023-07-12 17:46:47 +08:00
|
|
|
|
// 系缆时间
|
2023-07-20 17:16:08 +08:00
|
|
|
|
attachTime: [''],
|
2023-07-12 17:46:47 +08:00
|
|
|
|
// 解缆时间
|
2023-07-20 17:16:08 +08:00
|
|
|
|
unmoorTime: [''],
|
2023-07-12 17:46:47 +08:00
|
|
|
|
// 移泊时间
|
2023-07-20 17:16:08 +08:00
|
|
|
|
shiftingBerthTime: [''],
|
2023-07-12 17:46:47 +08:00
|
|
|
|
// 停泊时间
|
2023-07-20 17:16:08 +08:00
|
|
|
|
noProductBerthTime: [''],
|
2023-07-12 17:46:47 +08:00
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
onLoad(options) {
|
|
|
|
|
if ('params' in options) {
|
|
|
|
|
// 获取传递的对象参数,使用decodeURIComponent解码,并转为对象
|
|
|
|
|
this.obj = JSON.parse(decodeURIComponent(options.params))
|
2023-07-19 18:12:19 +08:00
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
mounted() {
|
|
|
|
|
if (this.obj.state == "edit" || this.obj.state == "look") {
|
|
|
|
|
this.getRow()
|
2023-07-12 17:46:47 +08:00
|
|
|
|
}
|
2023-07-19 18:12:19 +08:00
|
|
|
|
this.getShip()
|
2023-07-12 17:46:47 +08:00
|
|
|
|
},
|
|
|
|
|
methods: {
|
2023-07-19 18:12:19 +08:00
|
|
|
|
// 获取船只信息
|
|
|
|
|
getShip() {
|
|
|
|
|
this.shipInfo = uni.getStorageSync('shipInfo')
|
|
|
|
|
this.shipInfo.pubBerthesManageRespList.forEach((v, index) => {
|
|
|
|
|
this.bwList.push({
|
|
|
|
|
text: v.bthBthnm,
|
|
|
|
|
value: v.bthId
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
this.shipInfo.voyageScheduleDataList.forEach((v, index) => {
|
|
|
|
|
this.hcList.push({
|
|
|
|
|
text: v.vvyName,
|
|
|
|
|
value: v.vvyId
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
// 获取当前行信息
|
|
|
|
|
getRow() {
|
|
|
|
|
this.untieRow = uni.getStorageSync('untieRow');
|
|
|
|
|
this.untieRowIndex = uni.getStorageSync('untieRowIndex');
|
2023-07-20 17:16:08 +08:00
|
|
|
|
this.vvyId = this.untieRow.vvyId
|
|
|
|
|
this.vvyName = this.untieRow.vvyName
|
2023-08-01 09:32:45 +08:00
|
|
|
|
this.zlShip = this.untieRow.shipDeadWeight
|
2023-07-20 17:16:08 +08:00
|
|
|
|
this.bthId = this.untieRow.bthId
|
|
|
|
|
this.bthIdName = this.untieRow.bthIdName
|
|
|
|
|
this.attachTime = (this.untieRow.attachTime[0] ? this.untieRow.attachTime : '')
|
|
|
|
|
this.unmoorTime = (this.untieRow.unmoorTime[0] ? this.untieRow.unmoorTime : '')
|
|
|
|
|
this.shiftingBerthTime = (this.untieRow.shiftingBerthTime[0] ? this.untieRow.shiftingBerthTime : '')
|
|
|
|
|
this.noProductBerthTime = (this.untieRow.noProductBerthTime[0] ? this.untieRow.noProductBerthTime : '')
|
2023-07-19 18:12:19 +08:00
|
|
|
|
},
|
2023-07-12 17:46:47 +08:00
|
|
|
|
// 航次下拉
|
|
|
|
|
hcChange(e) {
|
2023-07-20 17:16:08 +08:00
|
|
|
|
this.vvyId = e;
|
2023-07-19 18:12:19 +08:00
|
|
|
|
this.hcList.forEach(v => {
|
|
|
|
|
if (v.value == e) {
|
2023-07-20 17:16:08 +08:00
|
|
|
|
this.vvyName = v.text
|
2023-07-19 18:12:19 +08:00
|
|
|
|
}
|
|
|
|
|
})
|
2023-07-12 17:46:47 +08:00
|
|
|
|
},
|
|
|
|
|
// 泊位下拉
|
|
|
|
|
bwChange(e) {
|
2023-07-20 17:16:08 +08:00
|
|
|
|
this.bthId = e;
|
2023-07-19 18:12:19 +08:00
|
|
|
|
this.bwList.forEach(v => {
|
|
|
|
|
if (v.value == e) {
|
2023-07-20 17:16:08 +08:00
|
|
|
|
this.bthIdName = v.text
|
2023-07-19 18:12:19 +08:00
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
// 系缆时间
|
|
|
|
|
changeLog1(e) {
|
2023-07-20 17:16:08 +08:00
|
|
|
|
this.attachTime = e.slice(0, e.length - 3)
|
2023-07-19 18:12:19 +08:00
|
|
|
|
},
|
|
|
|
|
// 解缆时间
|
|
|
|
|
changeLog2(e) {
|
2023-07-20 17:16:08 +08:00
|
|
|
|
this.unmoorTime = e.slice(0, e.length - 3)
|
2023-07-19 18:12:19 +08:00
|
|
|
|
},
|
|
|
|
|
// 移泊时间
|
|
|
|
|
changeLog3(e) {
|
2023-07-20 17:16:08 +08:00
|
|
|
|
this.shiftingBerthTime = e.slice(0, e.length - 3)
|
2023-07-19 18:12:19 +08:00
|
|
|
|
},
|
|
|
|
|
// 停泊时间
|
|
|
|
|
changeLog4(e) {
|
2023-07-20 17:16:08 +08:00
|
|
|
|
this.noProductBerthTime = e.slice(0, e.length - 3)
|
2023-07-12 17:46:47 +08:00
|
|
|
|
},
|
|
|
|
|
// 取消
|
|
|
|
|
cancel() {
|
|
|
|
|
uni.navigateTo({
|
|
|
|
|
url: '/pages/shipWork/untieCord'
|
|
|
|
|
})
|
|
|
|
|
},
|
2023-07-24 16:56:46 +08:00
|
|
|
|
// 弹框删除
|
|
|
|
|
delConfirm() {
|
2023-08-01 09:32:45 +08:00
|
|
|
|
// let addUntieArr = uni.getStorageSync('addUntieArr')
|
|
|
|
|
// addUntieArr.splice(this.untieRowIndex, 1)
|
|
|
|
|
// uni.setStorageSync('addUntieArr', addUntieArr);
|
|
|
|
|
let sql = `DELETE FROM attachUnmoorRespList WHERE webId = ${this.untieRow.webId};`
|
|
|
|
|
this.executeSql(sql)
|
2023-07-19 18:12:19 +08:00
|
|
|
|
uni.navigateTo({
|
|
|
|
|
url: '/pages/shipWork/untieCord'
|
|
|
|
|
})
|
|
|
|
|
},
|
2023-07-24 16:56:46 +08:00
|
|
|
|
// 删除
|
|
|
|
|
del() {
|
|
|
|
|
this.$refs.popup.open()
|
|
|
|
|
},
|
2023-07-12 17:46:47 +08:00
|
|
|
|
// 保存
|
|
|
|
|
save() {
|
2023-08-01 09:32:45 +08:00
|
|
|
|
let date = new Date().getTime()
|
|
|
|
|
let str = String(date)
|
|
|
|
|
let webId = Number(str.slice(str.length - 5))
|
|
|
|
|
let webStatus = 0
|
2023-08-01 14:35:05 +08:00
|
|
|
|
let webDate = api.getDate(date)
|
2023-07-19 18:12:19 +08:00
|
|
|
|
if (this.obj.state == "edit") {
|
2023-08-01 09:32:45 +08:00
|
|
|
|
let sql =
|
|
|
|
|
`UPDATE attachUnmoorRespList SET shipDeadWeight = '${this.zlShip}',vvyId = '${this.vvyId}',
|
|
|
|
|
vvyName = '${this.vvyName}',bthId = '${this.bthId}',bthIdName = '${this.bthIdName}',
|
|
|
|
|
attachTime = '${this.attachTime}',unmoorTime = '${this.unmoorTime}',shiftingBerthTime = '${this.shiftingBerthTime}',
|
|
|
|
|
noProductBerthTime = '${this.noProductBerthTime}',webStatus = '${webStatus}',
|
|
|
|
|
webDate = '${webDate}' WHERE webId = ${this.untieRow.webId};`
|
|
|
|
|
this.executeSql(sql)
|
2023-07-19 18:12:19 +08:00
|
|
|
|
} else if (this.obj.state == "add") {
|
2023-08-01 09:32:45 +08:00
|
|
|
|
let sql =
|
|
|
|
|
`insert into attachUnmoorRespList values('${webId}','${this.zlShip}','${this.vvyId}','${this.vvyName}',
|
|
|
|
|
'${this.bthId}','${this.bthIdName}','${this.shipInfo.voyageScheduleDataList[0].tradeTypeName}',
|
|
|
|
|
'${this.shipInfo.voyageScheduleDataList[0].importExportFlagName}','${this.shipInfo.voyageScheduleDataList[0].spmName}',
|
|
|
|
|
'${this.attachTime}','${this.unmoorTime}','${this.shiftingBerthTime}','${this.noProductBerthTime}','${webStatus}','${webDate}')`
|
|
|
|
|
this.executeSql(sql)
|
2023-07-19 18:12:19 +08:00
|
|
|
|
}
|
2023-08-01 09:32:45 +08:00
|
|
|
|
// let addUntieArr = uni.getStorageSync('addUntieArr')
|
|
|
|
|
// let addUntieObj = {
|
|
|
|
|
// shipDeadWeight: this.zlShip,
|
|
|
|
|
// vvyId: this.vvyId,
|
|
|
|
|
// vvyName: this.vvyName,
|
|
|
|
|
// bthId: this.bthId,
|
|
|
|
|
// bthIdName: this.bthIdName,
|
|
|
|
|
// tradeTypeName: this.shipInfo.voyageScheduleDataList[0].tradeTypeName,
|
|
|
|
|
// importExportFlagName: this.shipInfo.voyageScheduleDataList[0].importExportFlagName,
|
|
|
|
|
// spmName: this.shipInfo.voyageScheduleDataList[0].spmName,
|
|
|
|
|
// attachTime: this.attachTime,
|
|
|
|
|
// unmoorTime: this.unmoorTime,
|
|
|
|
|
// shiftingBerthTime: this.shiftingBerthTime,
|
|
|
|
|
// noProductBerthTime: this.noProductBerthTime
|
|
|
|
|
// }
|
|
|
|
|
// if (this.obj.state == "edit") {
|
|
|
|
|
// addUntieArr[this.untieRowIndex] = addUntieObj;
|
|
|
|
|
// uni.setStorageSync('addUntieArr', addUntieArr);
|
|
|
|
|
// } else if (this.obj.state == "add") {
|
|
|
|
|
// if (addUntieArr != "") {
|
|
|
|
|
// addUntieArr.push(addUntieObj)
|
|
|
|
|
// uni.setStorageSync('addUntieArr', addUntieArr);
|
|
|
|
|
// } else {
|
|
|
|
|
// addUntieArr = []
|
|
|
|
|
// addUntieArr.push(addUntieObj)
|
|
|
|
|
// uni.setStorageSync('addUntieArr', addUntieArr);
|
|
|
|
|
// }
|
|
|
|
|
// }
|
2023-07-12 17:46:47 +08:00
|
|
|
|
uni.navigateTo({
|
|
|
|
|
url: '/pages/shipWork/untieCord'
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
// 编辑
|
|
|
|
|
toGo(state) {
|
|
|
|
|
this.obj.state = state;
|
|
|
|
|
const params = encodeURIComponent(JSON.stringify(this.obj));
|
|
|
|
|
uni.navigateTo({
|
|
|
|
|
url: `/pages/shipWork/untieAdd?params=${params}`
|
|
|
|
|
})
|
2023-08-01 09:32:45 +08:00
|
|
|
|
},
|
|
|
|
|
executeSql(sql) {
|
|
|
|
|
sqlite.executeSqlCeshi(sql).then((value) => {
|
|
|
|
|
// 在resolve时执行的回调函数
|
|
|
|
|
console.log(value);
|
|
|
|
|
}).catch((error) => {
|
|
|
|
|
// 在reject时执行的回调函数
|
|
|
|
|
console.error(error);
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
onBackPress(event) {
|
|
|
|
|
uni.navigateTo({
|
|
|
|
|
url: '/pages/shipWork/untieCord'
|
|
|
|
|
})
|
|
|
|
|
return true;
|
|
|
|
|
},
|
2023-07-12 17:46:47 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style lang="less" scoped>
|
|
|
|
|
.untieAdd {
|
|
|
|
|
.container {
|
|
|
|
|
padding: 30px 20px;
|
|
|
|
|
|
2023-07-19 18:12:19 +08:00
|
|
|
|
.ul {
|
2023-07-12 17:46:47 +08:00
|
|
|
|
display: flex;
|
|
|
|
|
flex-wrap: wrap;
|
|
|
|
|
justify-content: space-between;
|
|
|
|
|
|
2023-07-19 18:12:19 +08:00
|
|
|
|
.li {
|
2023-07-12 17:46:47 +08:00
|
|
|
|
width: 44%;
|
|
|
|
|
border-top: 1px solid #ccc;
|
|
|
|
|
border-bottom: 1px solid #ccc;
|
|
|
|
|
display: flex;
|
|
|
|
|
padding: 10px 20px;
|
|
|
|
|
line-height: 35px;
|
|
|
|
|
margin-bottom: 20px;
|
|
|
|
|
|
|
|
|
|
.required {
|
|
|
|
|
color: red;
|
|
|
|
|
margin-right: 5px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
p {
|
|
|
|
|
min-width: 85px;
|
|
|
|
|
text-align: right;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/deep/.uni-numbox {
|
|
|
|
|
border: 1px solid #ccc;
|
|
|
|
|
box-sizing: border-box;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/deep/.uni-numbox-btns {
|
|
|
|
|
border-right: 1px solid #ccc;
|
|
|
|
|
border-left: 1px solid #ccc;
|
|
|
|
|
padding: 0 14px;
|
|
|
|
|
box-sizing: border-box;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/deep/.uni-numbox__value {
|
|
|
|
|
width: 100px;
|
|
|
|
|
height: 35px;
|
|
|
|
|
line-height: 35px;
|
|
|
|
|
background-color: #fff !important;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.btnList {
|
|
|
|
|
display: flex;
|
|
|
|
|
justify-content: center;
|
|
|
|
|
|
|
|
|
|
/deep/ .van-button {
|
|
|
|
|
margin: 30px 20px;
|
|
|
|
|
width: 120px;
|
|
|
|
|
height: 50px;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</style>
|