pad-app/pages/shipWork/index.vue

538 lines
14 KiB
Vue

<template>
<view class="app">
<head-info></head-info>
<view class="container">
<side-bar path='3'></side-bar>
<view class="content">
<view class="form">
<!-- <view class="select">
<uni-data-select v-model="pamValue" :localdata="pamList" @change="pamChange"
placeholder="请选择港口">
</uni-data-select>
</view> -->
<view class="select">
<superwei-combox :candidates="shipList" :isJSON="true" keyName="spmName" placeholder="请选择船名航次"
v-model="shipName" @input="input_json" @select="select_json"></superwei-combox>
</view>
<van-button type="default" @click="search">搜索</van-button>
</view>
<view class="itemList">
<template v-if="total != 0">
<view v-for="(item, index) in itemList" :key="index" class="item" @click="toGo(item)">
<view class="title">
<view class="name">
{{item.spmName}}
</view>
</view>
<view class="table">
<view class="row">
<view class="nitem">
进口航次: <text>{{item.inVvyName}}</text>
</view>
<view class="nitem">
进口贸易类型: <text>{{item.inTradeTypeName}}</text>
</view>
</view>
<view class="row">
<view class="nitem">
出口航次: <text>{{item.outVvyName}}</text>
</view>
<view class="nitem">
出口贸易类型: <text>{{item.outTradeTypeName}}</text>
</view>
</view>
<view class="row">
<view class="nitem">
计划泊位: <text>{{item.planBerthageName}}</text>
</view>
<view class="nitem">
实际泊位: <text>{{item.actualBerthageName}}</text>
</view>
</view>
<view class="row">
<view class="nitem">
<text>{{item.uploadStatusDesc}}</text>
<text>{{item.uploadTime}}</text>
</view>
<!-- <view class="nitem" v-if="item==1">
<text class="green">●</text> 已下载
<text>2023/09/21 12:00</text>
</view>
<view class="nitem" v-if="item==2">
<text>●</text> 未下载
</view>
<view class="nitem" v-if="item==1">
<text class="green">●</text> 已上传
<text>2023/09/21 12:00</text>
</view>
<view class="nitem" v-if="item==2">
<text>●</text> 未上传
</view> -->
</view>
<view class="footer">
<view class="footer">
<van-button class="fitem" type="default"
@click.stop="download(item)">下载</van-button>
<van-button class="fitem" type="default"
@click.stop="upload(item)">上传</van-button>
</view>
</view>
</view>
</view>
</template>
<o-empty v-else height="70vh" bg="#f5f6fa" />
</view>
<view class="pageBox" v-if="total != 0">
<uni-pagination :show-icon="true" :total="total" :pageSize="pageSize" :current="current"
@change="changePage" />
</view>
</view>
</view>
</view>
</template>
<script>
import SideBar from '@/components/sider-bar/slider-bar';
import HeadInfo from '@/components/head-info/head-info';
export default {
data() {
return {
// 港口
pamValue: "",
// pamList: [],
// 船名航次
shipName: "",
shipValue: '',
shipList: [],
shipInput: "",
itemList: [],
// 分页
total: 0,
pageSize: 4,
current: 1,
}
},
onLoad() {
},
components: {
SideBar,
HeadInfo,
},
mounted() {
this.pamValue = uni.getStorageSync('portObj').portId
// this.getPam();
},
methods: {
// 获取船的数据
initData() {
uni.request({
url: this.$local + '/api/shipOperate/select?pamId=' + this.pamValue + "&vvyId=" + this
.shipValue,
header: {
'Content-Type': 'application/json' //自定义请求头信息
},
method: 'GET', //请求方式,必须为大写
success: (res) => {
console.log('接口返回------', res);
if (res.statusCode === 200) {
this.total = res.data.data.records.length
let newArr = this.getMapping(res.data.data.records, this.pageSize)
this.itemList = newArr[this.current - 1];
}
}
})
},
// 分页切割数组(数组,分割个数)
getMapping(list, num) {
let len = list.length
let newList = []
if (len) {
var chunk = num
for (var i = 0, j = len; i < j; i += chunk) {
newList.push(list.slice(i, i + chunk))
}
}
return newList
},
// 点击页面
changePage(e) {
this.current = e.current;
this.initData()
},
// 获取港区下拉数据
// getPam() {
// uni.request({
// url: this.$local + '/api/shipOperate/queryPortArea',
// header: {
// 'Content-Type': 'application/json' //自定义请求头信息
// },
// method: 'GET', //请求方式,必须为大写
// success: (res) => {
// console.log('接口返回------', res);
// if (res.statusCode === 200) {
// let arr = res.data.data;
// arr.forEach((v, index) => {
// this.pamList.push({
// text: v.pamName,
// value: v.pamId
// })
// })
// }
// }
// })
// },
// 获取船名航次下拉数据
getShip() {
uni.request({
url: this.$local + '/api/shipOperate/queryShipmentVoyageData?key=' + this.shipInput,
header: {
'Content-Type': 'application/json' //自定义请求头信息
},
method: 'GET', //请求方式,必须为大写
success: (res) => {
console.log('接口返回------', res);
if (res.statusCode === 200) {
this.shipList = res.data.data
}
}
})
},
// 船名航次下拉模糊查询
input_json(e) {
this.shipInput = e;
this.getShip();
},
// 船名航次下拉选项
select_json(e) {
this.shipValue = e.vvyId
this.shipName = e.spmName
},
// 点击搜索
search() {
this.initData()
},
// 下载
download(item) {
let ids = []
if (item.inVvyId != null && item.outVvyId == null) {
ids.push(item.inVvyId)
} else if (item.outVvyId != null && item.inVvyId == null) {
ids.push(item.outVvyId)
} else if (item.inVvyId != null && item.outVvyId != null) {
ids.push(item.inVvyId)
ids.push(item.outVvyId)
}
console.log(ids)
uni.request({
url: this.$local + '/api/shipOperate/download?vvyIds=' + ids,
header: {
'Content-Type': 'application/json' //自定义请求头信息
},
method: 'GET', //请求方式,必须为大写
success: (res) => {
console.log('接口返回------', res);
if (res.statusCode == 200) {
// 存储数据
uni.setStorageSync('shipInfo', res.data.data);
}
}
})
},
// 上传
upload(item) {
let workDataInfo = {
"adviserLayoutReqList": [{
"altId": "33333333333",
"bthId": "2f166d975bdc58e6a461e3d01de11289",
"createTime": "",
"createUser": "",
"endTime": "2023-07-14 10:00",
"loaderType": "装货",
"personNumber": 10,
"pwcType": "123321",
"remark": "12312312",
"sparePart": 10,
"startTime": "2023-07-13 12:00",
"tenantId": "",
"termcd": "",
"updateTime": "",
"updateUser": "",
"valid": "",
"vehicleSize": 20,
"version": "",
"vvyId": "6cb63df0526f20ecbaa43795774a1299"
}],
"conditionReqList": [{
"operationDate": "2023-07-14",
"remark": "123123",
"type": "2321312",
"vacId": "333333",
"vvyId": "6cb63df0526f20ecbaa43795774a1299"
}],
"consultationReqList": [{
"bthId": "2f166d975bdc58e6a461e3d01de11289",
"handlingType": "装货",
"operationDate": "2023-07-14",
"spareNumber": "12",
"vehiclesNumber": "22",
"vqcId": "123132132131321",
"vvyId": "6cb63df0526f20ecbaa43795774a1299"
}],
"delAlIds": [],
"delCsIds": [],
"delCtIds": [],
"delLnIds": [],
"delMfIds": [],
"delPmIds": [],
"delSauIds": [],
"delSiIds": [],
"delSoiIds": [],
"delSrmIds": [],
"delSsIds": [],
"delSwmIds": [],
"inVvyId": "6cb63df0526f20ecbaa43795774a1299",
"loadUnloadNoticeReqList": [{
"sluId": "11111",
"vbtId": "22222222",
"vvyId": "6cb63df0526f20ecbaa43795774a1299",
"workDate": "2023-07-14"
}],
"outVvyId": "6cb63df0526f20ecbaa43795774a1299",
"personMessageReqList": [{
"bthId": "2f166d975bdc58e6a461e3d01de11289",
"jobEndTime": "2023-7-14 10:00",
"jobStartTime": "2023-7-13 12:00",
"pmeId": "111",
"remark": "123123123remark",
"shipPerson": 0,
"termcd": "2222",
"valid": "33333",
"vbtId": "44444",
"vvyId": "6cb63df0526f20ecbaa43795774a1299",
"weatherType": "晴",
"workSuite": 0
}],
"shipmentAttachUnmoorReqList": [{
"attachTime": "2023-07-13 12:00",
"bthId": "2f166d975bdc58e6a461e3d01de11289",
"createTime": "",
"createUser": "",
"noProductBerthTime": "2023-07-13 12:00",
"remark": "23123123",
"sauId": "333333",
"shiftingBerthTime": "2023-07-13 12:00",
"shipDeadWeight": 30,
"tenantId": "11122222",
"termcd": "111222",
"unmoorTime": "2023-07-13 12:00",
"updateTime": "2023-07-13 12:00",
"updateUser": "111111",
"valid": "2222222",
"version": 20,
"vvyId": "6cb63df0526f20ecbaa43795774a1299"
}],
"shipmentMafiListReqList": [{
"loadType": "卸货",
"mafiBarcode": "000002",
"pamId": "ac9b606e04a2bc71b876914a64ccb0b6",
"size": 10,
"smlId": "1111",
"type": "FULL",
"vtpId": "222222",
"vvyId": "6cb63df0526f20ecbaa43795774a1299",
"workDate": "2023-07-14"
}],
"shipmentOtherInfoReqList": [{
"auxRemark": "111111",
"endTm": "2023-07-14 10:00:00",
"genNum": 20,
"remark": "12312321",
"soiId": "222222",
"startTm": "2023-07-13 12:00:00",
"tecNum": 30,
"volume": 20,
"vvyId": "6cb63df0526f20ecbaa43795774a1299",
"waitRemark": "123123",
"weight": 40,
"workRemark": "1231231"
}],
"shipmentRetallyMessageReqList": [{
"remId": "123123",
"retallyReqDTOS": [{
"remId": "1231231312",
"retallyDetailReqDTOS": [{
"carType": "中型车",
"goodsNumber": 10,
"goodsVolume": 20,
"goodsWeight": 30,
"retallyEndTime": "2023-07-14 10:00:00",
"retallyOrigin": "123123",
"retallyStartTime": "2023-07-13 12:00:00",
"retallyTerminus": "1231321",
"reyId": "1231321",
"rydId": "23123123"
}],
"retallyType": "",
"reyId": ""
}],
"vvyId": "6cb63df0526f20ecbaa43795774a1299"
}],
"shipmentSafetyInspectionReqList": [{
"importExport": "1231312",
"remark": "123123",
"spmId": "32131",
"tradeType": "123213",
"type": "123123",
"uploadStatus": "未上传",
"url": [],
"vsiId": "123123",
"vvyId": "6cb63df0526f20ecbaa43795774a1299"
}],
"shipmentShipSupplyReqList": [{
"sssId": "",
"stopBerthage": "2f166d975bdc58e6a461e3d01de11289",
"supplyAmount": 8,
"supplyDate": "2023-07-14",
"supplyType": "",
"vvyId": "6cb63df0526f20ecbaa43795774a1299",
"vvyName": "511I"
}],
"shipmentWorkMessageReqList": [{
"loadType": "自装",
"pwcType": "123",
"remark": "132311231",
"vvyId": "6cb63df0526f20ecbaa43795774a1299",
"wkmId": "123123",
"workEndTime": "2023-07-13 10:00:00",
"workStartTime": "2023-07-13 12:00:00",
"workMessageDetailReqDTOS": [{
"carType": "中型车",
"goodsNumber": 3,
"loadingType": "自装",
"remark": "",
"tenantId": "",
"termcd": "",
"valid": "",
"wkdId": "",
"wkmId": ""
}],
}],
"vtpId": "123123"
}
uni.request({
url: this.$local + '/api/shipOperate/upload',
data: workDataInfo,
header: {
'Content-Type': 'application/json' //自定义请求头信息
},
method: 'POST', //请求方式,必须为大写
success: (res) => {
console.log('接口返回------', res);
}
})
},
toGo(item) {
uni.navigateTo({
url: `/pages/shipWork/documentList`
})
}
}
};
</script>
<style lang="less" scoped>
.container {
background-color: #f5f6fa;
display: flex;
min-height: calc(100vh - 44px - 40px);
}
.content {
padding: 20px;
min-height: calc(100vh - 44px - 40px);
.form {
display: flex;
.select {
width: 200px;
margin-right: 20px;
}
.input {
width: 200px;
height: 35px;
line-height: 35px;
margin-left: 15px;
}
/deep/.van-button {
height: 35px;
line-height: 35px;
}
}
.itemList {
width: 100%;
display: flex;
justify-content: flex-start;
flex-wrap: wrap;
/deep/.o-empty {
width: 100%;
margin-top: 15px;
}
.item {
width: 49%;
margin-top: 15px;
margin-right: 2%;
border: 1px solid #c9cacb;
.title {
display: flex;
justify-content: space-between;
font-size: 21px;
padding: 10px 20px;
font-weight: 700;
}
.row {
display: flex;
justify-content: space-between;
font-size: 14px;
padding: 10px 20px;
.nitem {
width: 46%;
.text {
color: #929292;
}
}
}
.footer {
width: 100%;
display: flex;
justify-content: space-around;
.fitem {
flex: 1;
margin: 10px 20px;
}
}
}
.item:nth-child(2n) {
margin-right: 0;
}
}
.pageBox {
margin-top: 20px;
}
}
</style>