2023-07-12 17:46:47 +08:00
|
|
|
|
<template>
|
|
|
|
|
<view class="patrolAdd">
|
|
|
|
|
<view class="container">
|
2023-07-20 17:16:08 +08:00
|
|
|
|
<view class="ul">
|
|
|
|
|
<view class="li">
|
2023-07-12 17:46:47 +08:00
|
|
|
|
<p>船名:</p>
|
2023-07-20 17:16:08 +08:00
|
|
|
|
<text>{{shipInfo.voyageScheduleDataList[0].spmName}}</text>
|
|
|
|
|
</view>
|
|
|
|
|
<view class="li">
|
|
|
|
|
<p><text class="required" v-if="obj.state != 'look'">*</text>航次:</p>
|
|
|
|
|
<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>
|
|
|
|
|
</view>
|
|
|
|
|
<view class="li">
|
2023-07-12 17:46:47 +08:00
|
|
|
|
<p>进出口:</p>
|
2023-07-20 17:16:08 +08:00
|
|
|
|
<text>{{shipInfo.voyageScheduleDataList[0].importExportFlagName}}</text>
|
|
|
|
|
</view>
|
|
|
|
|
<view class="li">
|
2023-07-12 17:46:47 +08:00
|
|
|
|
<p>贸易类型:</p>
|
2023-07-20 17:16:08 +08:00
|
|
|
|
<text>{{shipInfo.voyageScheduleDataList[0].tradeTypeName}}</text>
|
|
|
|
|
</view>
|
|
|
|
|
<view class="li">
|
|
|
|
|
<p><text class="required" v-if="obj.state != 'look'">*</text>类型:</p>
|
|
|
|
|
<uni-easyinput v-if="obj.state != 'look'" v-model="type" placeholder="请输入"></uni-easyinput>
|
|
|
|
|
<text v-else>{{type}}</text>
|
|
|
|
|
</view>
|
|
|
|
|
<view class="li tpLi">
|
|
|
|
|
<p><text class="required" v-if="obj.state != 'look'">*</text>图片上传:</p>
|
2023-07-12 17:46:47 +08:00
|
|
|
|
<template v-if="obj.state != 'look'">
|
|
|
|
|
<view class="picture">
|
2023-07-20 17:16:08 +08:00
|
|
|
|
<uni-file-picker limit="9" v-model="imageValue" fileMediatype="image" @select="select"
|
|
|
|
|
title="最多选择9张图片"></uni-file-picker>
|
2023-07-12 17:46:47 +08:00
|
|
|
|
</view>
|
|
|
|
|
</template>
|
|
|
|
|
<view class="pictureLook" v-else>
|
2023-07-20 17:16:08 +08:00
|
|
|
|
<view v-for="(item,index) in imageValue" :key="index">
|
|
|
|
|
<image :src="item">
|
|
|
|
|
</view>
|
2023-07-12 17:46:47 +08:00
|
|
|
|
</view>
|
2023-07-20 17:16:08 +08:00
|
|
|
|
</view>
|
|
|
|
|
<view class="li wLi">
|
|
|
|
|
<p><text class="required" v-if="obj.state != 'look'">*</text>描述:</p>
|
|
|
|
|
<uni-easyinput type="textarea" autoHeight v-model="remark" placeholder="请输入任务描述(200字以内)"
|
2023-07-12 17:46:47 +08:00
|
|
|
|
maxlength="200" v-if="obj.state != 'look'"></uni-easyinput>
|
2023-07-20 17:16:08 +08:00
|
|
|
|
<text v-else>{{remark}}</text>
|
|
|
|
|
</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-20 17:16:08 +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>
|
|
|
|
|
export default {
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
2023-07-20 17:16:08 +08:00
|
|
|
|
shipInfo: {
|
|
|
|
|
voyageScheduleDataList: [{
|
|
|
|
|
spmName: "",
|
|
|
|
|
importExportFlagName: "",
|
|
|
|
|
tradeTypeName: ""
|
|
|
|
|
}]
|
|
|
|
|
},
|
2023-07-12 17:46:47 +08:00
|
|
|
|
obj: {},
|
2023-07-20 17:16:08 +08:00
|
|
|
|
patrolRow: {},
|
|
|
|
|
patrolRowIndex: {},
|
2023-07-12 17:46:47 +08:00
|
|
|
|
// 航次下拉框
|
2023-07-20 17:16:08 +08:00
|
|
|
|
vvyId: "",
|
|
|
|
|
vvyName: "",
|
|
|
|
|
hcList: [],
|
2023-07-12 17:46:47 +08:00
|
|
|
|
// 类型
|
2023-07-20 17:16:08 +08:00
|
|
|
|
type: "",
|
|
|
|
|
// 图片
|
|
|
|
|
imageValue: [],
|
2023-07-12 17:46:47 +08:00
|
|
|
|
// 描述
|
2023-07-20 17:16:08 +08:00
|
|
|
|
remark: "",
|
2023-07-12 17:46:47 +08:00
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
onLoad(options) {
|
|
|
|
|
if ('params' in options) {
|
|
|
|
|
// 获取传递的对象参数,使用decodeURIComponent解码,并转为对象
|
|
|
|
|
this.obj = JSON.parse(decodeURIComponent(options.params))
|
|
|
|
|
}
|
2023-07-20 17:16:08 +08:00
|
|
|
|
},
|
|
|
|
|
mounted() {
|
|
|
|
|
if (this.obj.state == 'edit' || this.obj.state == 'look') {
|
|
|
|
|
this.getRow();
|
|
|
|
|
}
|
|
|
|
|
this.getShip()
|
2023-07-12 17:46:47 +08:00
|
|
|
|
},
|
|
|
|
|
methods: {
|
2023-07-20 17:16:08 +08:00
|
|
|
|
// 获取船只信息
|
|
|
|
|
getShip() {
|
|
|
|
|
this.shipInfo = uni.getStorageSync('shipInfo')
|
|
|
|
|
// 航次数据
|
|
|
|
|
this.shipInfo.voyageScheduleDataList.forEach((v, index) => {
|
|
|
|
|
this.hcList.push({
|
|
|
|
|
text: v.vvyName,
|
|
|
|
|
value: v.vvyId
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
// 获取当前行信息
|
|
|
|
|
getRow() {
|
|
|
|
|
this.patrolRow = uni.getStorageSync('patrolRow');
|
|
|
|
|
this.patrolRowIndex = uni.getStorageSync('patrolRowIndex');
|
|
|
|
|
this.vvyId = this.patrolRow.vvyId
|
|
|
|
|
this.vvyName = this.patrolRow.vvyName
|
|
|
|
|
this.type = this.patrolRow.type
|
|
|
|
|
this.remark = this.patrolRow.remark
|
|
|
|
|
this.imageValue = this.patrolRow.imageValue
|
|
|
|
|
},
|
2023-07-12 17:46:47 +08:00
|
|
|
|
// 航次下拉
|
|
|
|
|
hcChange(e) {
|
2023-07-20 17:16:08 +08:00
|
|
|
|
this.vvyId = e;
|
|
|
|
|
this.hcList.forEach(v => {
|
|
|
|
|
if (v.value == e) {
|
|
|
|
|
this.vvyName = v.text
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
// 图片上传
|
|
|
|
|
select(e) {
|
|
|
|
|
console.log(e)
|
2023-07-12 17:46:47 +08:00
|
|
|
|
},
|
|
|
|
|
// 取消
|
|
|
|
|
cancel() {
|
|
|
|
|
uni.navigateTo({
|
|
|
|
|
url: '/pages/shipWork/patrol'
|
|
|
|
|
})
|
|
|
|
|
},
|
2023-07-24 16:56:46 +08:00
|
|
|
|
// 弹框删除
|
|
|
|
|
delConfirm() {
|
2023-07-20 17:16:08 +08:00
|
|
|
|
let addPatrolArr = uni.getStorageSync('addPatrolArr')
|
|
|
|
|
addPatrolArr.splice(this.patrolRowIndex, 1)
|
|
|
|
|
uni.setStorageSync('addPatrolArr', addPatrolArr);
|
|
|
|
|
uni.navigateTo({
|
|
|
|
|
url: '/pages/shipWork/patrol'
|
|
|
|
|
})
|
|
|
|
|
},
|
2023-07-24 16:56:46 +08:00
|
|
|
|
// 删除
|
|
|
|
|
del() {
|
|
|
|
|
this.$refs.popup.open()
|
|
|
|
|
},
|
2023-07-12 17:46:47 +08:00
|
|
|
|
// 保存
|
|
|
|
|
save() {
|
2023-07-20 17:16:08 +08:00
|
|
|
|
let addPatrolArr = uni.getStorageSync('addPatrolArr')
|
|
|
|
|
let addPatrolObj = {
|
|
|
|
|
vvyId: this.vvyId,
|
|
|
|
|
vvyName: this.vvyName,
|
|
|
|
|
type: this.type,
|
|
|
|
|
remark: this.remark,
|
|
|
|
|
imageValue: this.imageValue,
|
|
|
|
|
tradeTypeName: this.shipInfo.voyageScheduleDataList[0].tradeTypeName,
|
|
|
|
|
importExportFlagName: this.shipInfo.voyageScheduleDataList[0].importExportFlagName,
|
|
|
|
|
spmName: this.shipInfo.voyageScheduleDataList[0].spmName,
|
|
|
|
|
}
|
|
|
|
|
if (this.obj.state == "edit") {
|
|
|
|
|
addPatrolArr[this.patrolRowIndex] = addPatrolObj;
|
|
|
|
|
uni.setStorageSync('addPatrolArr', addPatrolArr);
|
|
|
|
|
} else if (this.obj.state == "add") {
|
|
|
|
|
if (addPatrolArr != "") {
|
|
|
|
|
addPatrolArr.push(addPatrolObj)
|
|
|
|
|
uni.setStorageSync('addPatrolArr', addPatrolArr);
|
|
|
|
|
} else {
|
|
|
|
|
addPatrolArr = []
|
|
|
|
|
addPatrolArr.push(addPatrolObj)
|
|
|
|
|
uni.setStorageSync('addPatrolArr', addPatrolArr);
|
|
|
|
|
}
|
|
|
|
|
}
|
2023-07-12 17:46:47 +08:00
|
|
|
|
uni.navigateTo({
|
|
|
|
|
url: '/pages/shipWork/patrol'
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
// 编辑
|
|
|
|
|
toGo(state) {
|
|
|
|
|
this.obj.state = state;
|
|
|
|
|
const params = encodeURIComponent(JSON.stringify(this.obj));
|
|
|
|
|
uni.navigateTo({
|
|
|
|
|
url: `/pages/shipWork/patrolAdd?params=${params}`
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style lang="less" scoped>
|
|
|
|
|
.patrolAdd {
|
|
|
|
|
.container {
|
|
|
|
|
padding: 30px 20px;
|
|
|
|
|
|
2023-07-20 17:16:08 +08:00
|
|
|
|
.ul {
|
2023-07-12 17:46:47 +08:00
|
|
|
|
display: flex;
|
|
|
|
|
flex-wrap: wrap;
|
|
|
|
|
justify-content: space-between;
|
|
|
|
|
|
|
|
|
|
.wLi {
|
2023-07-20 17:16:08 +08:00
|
|
|
|
width: 100% !important;
|
2023-07-12 17:46:47 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.tpLi {
|
2023-07-20 17:16:08 +08:00
|
|
|
|
width: 100% !important;
|
|
|
|
|
display: block !important;
|
2023-07-12 17:46:47 +08:00
|
|
|
|
|
|
|
|
|
p {
|
2023-07-20 17:16:08 +08:00
|
|
|
|
text-align: left !important;
|
2023-07-12 17:46:47 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2023-07-20 17:16:08 +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;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.picture {
|
|
|
|
|
/deep/.file-picker__box {
|
|
|
|
|
width: 120px !important;
|
|
|
|
|
height: 120px !important;
|
|
|
|
|
padding-top: 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.pictureLook {
|
|
|
|
|
display: flex;
|
|
|
|
|
flex-wrap: wrap;
|
|
|
|
|
|
2023-07-20 17:16:08 +08:00
|
|
|
|
image {
|
2023-07-12 17:46:47 +08:00
|
|
|
|
width: 120px;
|
|
|
|
|
height: 120px;
|
|
|
|
|
margin: 10px;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.btnList {
|
|
|
|
|
display: flex;
|
|
|
|
|
justify-content: center;
|
|
|
|
|
|
|
|
|
|
/deep/ .van-button {
|
|
|
|
|
margin: 30px 20px;
|
|
|
|
|
width: 120px;
|
|
|
|
|
height: 50px;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</style>
|