pad-app/pages/shipWork/index.vue

1391 lines
50 KiB
Vue

<template>
<view class="app">
<head-info :navIndex="2"></head-info>
<view class="container">
<view class="content">
<view class="form">
<view class="select">
<superwei-combox :candidates="shipList" :isJSON="true" keyName="shipVvyname"
placeholder="请选择船名航次" v-model="shipVvyname" @input="input_json"
@select="select_json"></superwei-combox>
</view>
<button class="searchBtn" type="default" @click="search">搜索</button>
<!-- <button class="searchBtn" type="default" @click="dropTable">删除表</button> -->
<!-- <button class="searchBtn" type="default" @click="dropData">删除数据</button> -->
<!-- <button class="searchBtn" type="default" @click="createTable">创建</button> -->
<!-- <button class="searchBtn" type="default" @click="delAll">批量删除表</button> -->
<!-- <button class="searchBtn" type="default" @click="delAllData">批量删除数据</button> -->
</view>
<view class="itemList">
<template v-if="itemList.length > 0">
<view v-for="(item, index) in itemList" :key="index" class="item">
<view @click="toGo(item)">
<view class="title">
<image src="../../static/images/ship.png" mode="widthFix"></image>
<view class="name">
{{item.spmName}}
</view>
</view>
<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="statusBox statusBox1">
<view class="statusInfo" v-if="item.uploadStatus == '已上传'">
<text>已上传</text>
<text>{{item.uploadTime}}</text>
</view>
<view class="statusInfo notStatus" v-else>
<text>未上传</text>
</view>
</view>
<view class="statusBox statusBox2">
<view class="statusInfo" v-if="item.downloadStatus == '已下载'">
<text>已下载</text>
<text>{{item.downloadTime}}</text>
</view>
<view class="statusInfo notStatus" v-else>
<text>未下载</text>
</view>
</view>
</view>
<view class="footer">
<view class="fitem">
<button :class="{fitem1:item.uploadTime != ''}" type="default"
:disabled="item.uploadTime == ''" @click.stop="download(item)">下载</button>
<button class="fitem2" type="default" @click.stop="upload(item)">上传</button>
</view>
</view>
</view>
<uni-popup ref="popup" type="message">
<uni-popup-message :type="msgType" :message="popupText"
:duration="2000"></uni-popup-message>
</uni-popup>
<template v-if="isMore">
<uni-load-more iconType="circle" status="loading" style="width: 100%;" />
</template>
</template>
<o-empty v-else height="70vh" bg="#f5f6fa" />
</view>
<!-- <view class="pageBox" v-if="itemList.length > 0">
<uni-pagination :show-icon="true" :total="total" :pageSize="pageSize" :current="current"
@change="changePage" />
</view> -->
</view>
</view>
<LotusLoading :lotusLoadingData="lotusLoadingData"></LotusLoading>
</view>
</template>
<script>
import HeadInfo from '@/components/head-info/head-info';
import sqlite from "../../common/sqlite.js"
import tableList from "../../common/createDataTable.js"
import api from "../../common/api.js"
import LotusLoading from "../../components/Winglau14-lotusLoading/Winglau14-LotusLoading.vue";
import {
v4 as uuidv4
} from 'uuid';
export default {
data() {
return {
loginObj: {},
vtpId: "",
// 下载成功提示
popupText: "",
// 下载失败提示
errorText: "",
// 提示类型
msgType: "",
// 下载数据
downloadData: {},
// 港口
portObj: {},
// pamList: [],
// 船名航次
spmId: "", // 船名ID
spmName: '', // 船名
vvyId: "", // 航次ID
vvyName: "", // 航次名
shipVvyname: "",
shipList: [],
shipInput: "",
itemList: [],
vtpList: [],
// 分页
total: 0,
pageSize: 12,
current: 1,
// 下拉数据
optionData: [],
// 人员信息
messageRespList: [],
// 工班信息
workMessageRespList: [],
// 工班信息详细
workMessageRespInfoList: [],
// 工班信息翻仓
retallyMessageRespList: [],
// 工班信息其他
infoRespList: [],
// 系解缆
attachUnmoorRespList: [],
// 供给
shipmentShipSupplyRespList: [],
// 指导员作业布置
shipmentAdviserLayoutRespList: [],
// 船舶装卸通知书
shipmentLoadUnloadNoticeRespList: [],
// 质量意见征询
shipmentQualityConsultationRespList: [],
// 质量意见征询评价表
evaluateTable: [],
// 异常情况
abnormalConditionRespList: [],
// mafi清单
mafiListRespList: [],
// 签名数据
workSignTable: [],
// 所有表
allList: ["shipInfoTable", "voyageScheduleDataPadRespDTO", "voyageScheduleDataDetailRespDTOList",
"messageRespList", "workMessageRespList", "workMessageRespInfoList",
"retallyMessageRespList", "infoRespList", "attachUnmoorRespList", "shipmentShipSupplyRespList",
"shipmentAdviserLayoutRespList", "shipmentLoadUnloadNoticeRespList",
"shipmentQualityConsultationRespList", "abnormalConditionRespList", "mafiListRespList",
"shipmentShipLoadPlansRespList", "workQueryDetails", "shipOption", "workSignTable",
"shipmentBasicShiftList", "evaluateTable"
],
// 所有单证
allArr: ["messageRespList", "workMessageRespList", "workMessageRespInfoList",
"retallyMessageRespList", "infoRespList", "attachUnmoorRespList", "shipmentShipSupplyRespList",
"shipmentAdviserLayoutRespList", "shipmentLoadUnloadNoticeRespList",
"shipmentQualityConsultationRespList", "abnormalConditionRespList", "mafiListRespList",
"workSignTable", "evaluateTable"
],
// 基础数据表
jcList: ["shipInfoTable", "voyageScheduleDataPadRespDTO", "voyageScheduleDataDetailRespDTOList",
"shipmentBasicShiftList", "shipOption"
],
isMore: false,
lotusLoadingData: {
isShow: false //设置显示加载中组件true显示false隐藏
}
}
},
components: {
HeadInfo,
LotusLoading
},
onReachBottom() {
this.current++
this.initData()
this.isMore = true
},
onBackPress(options) {
// 触发返回就会调用此方法,这里实现的是禁用物理返回,顶部导航栏的自定义返回 uni.navigateBack 仍可使用
if (options.from == 'backbutton') {
return true;
} else if (options.from == 'navigateBack') {
return false;
}
},
mounted() {
this.portObj = uni.getStorageSync('portObj')
this.loginObj = uni.getStorageSync('loginObj')
this.getShip()
this.initData()
},
methods: {
createTable() {
tableList.createAllTable()
},
// 批量删除
delAll() {n
console.log('批量删除表');
this.allList.forEach(v => {
let sql = `DROP TABLE ${v};`
this.executeSql(sql)
})
},
// 批量删除数据
delAllData() {
console.log('批量删除数据');
this.allList.forEach(v => {
let sql = `delete from ${v} WHERE vtpId = '341a92f3c9ae3d4d228561d84984a1fb';`
this.executeSql(sql)
})
uni.setStorageSync('delSrmIds', []);
uni.setStorageSync('delSwmIds', []);
},
dropTable() {
console.log('删除表');
let sql = 'DROP TABLE workSignTable'
this.executeSql(sql)
},
dropData() {
console.log('删除数据');
let sql = "delete from workSignTable"
this.executeSql(sql)
},
// 获取船的数据
initData(flag) {
uni.request({
url: `${this.$local}/api/shipOperate/select?pamId=${this.portObj.portId}&vvyId=${this.vvyId}&size=${this.pageSize}&current=${this.current}`,
header: {
'Content-Type': 'application/json', //自定义请求头信息
'Authorization': `Bearer ${this.loginObj.access_token}`
},
method: 'GET', //请求方式,必须为大写
success: (res) => {
if (res.statusCode === 200) {
this.isMore = false
this.total = res.data.data.total
if (flag && flag == 'new') {
this.pageSize = 12
this.current = 1
this.itemList = res.data.data.records
} else {
this.itemList.push(...res.data.data.records)
}
}
}
})
let that = this
setTimeout(function() {
that.vtpId = []
let sq = `select * from shipInfoTable`
that.executeSql(sq, "shipInfoTable")
}, 100)
},
// 点击分页
changePage(e) {
this.current = e.current;
this.initData()
},
// 获取船名航次下拉数据
getShip() {
uni.request({
url: `${this.$local}/api/shipOperate/queryShipmentVoyageData?key=${this.shipInput}`,
header: {
'Content-Type': 'application/json', //自定义请求头信息
'Authorization': `Bearer ${this.loginObj.access_token}`
},
method: 'GET', //请求方式,必须为大写
success: (res) => {
if (res.statusCode === 200) {
this.shipList = res.data.data
this.shipList.forEach(v => {
this.$set(v, "shipVvyname", `${v.spmName}/${v.vvyName}`)
})
}
}
})
},
// 船名航次下拉模糊查询
input_json(e) {
this.shipInput = e
if (e == "") {
this.vvyId = ""
}
this.getShip()
},
// 船名航次下拉选项
select_json(e) {
this.vvyId = e.vvyId
this.vvyName = e.vvyName
this.spmId = e.spmId
this.spmName = e.spmName
},
// 点击搜索
search() {
this.pageSize = 12
this.current = 1
this.initData('new')
},
// 下拉数据
xlData(vtpId) {
for (let i = 0; i < this.optionData.length; i++) {
this.optionData[i]["webId"] = uuidv4()
this.optionData[i]["vtpId"] = vtpId
let date = new Date().getTime()
this.optionData[i]["webStatus"] = "0"
this.optionData[i]["webDate"] = api.getDate(date)
let dbTable = 'shipOption'
let Arr = []
for (let key in this.optionData[i]) {
Arr.push(`'${ this.optionData[i][key]}'`);
}
let Str = Arr.join(',')
sqlite.insertTableData(dbTable, Str).then((value) => {
// 在resolve时执行的回调函数
this.executeSql(value, "shipOption")
}).catch((error) => {
// 在reject时执行的回调函数
console.error(error);
});
}
},
// 船舶基本信息
shipDataInfo(info, vtpId) {
let date = new Date().getTime()
let webId = uuidv4()
let webDate = api.getDate(date)
let sql =
`insert into shipInfoTable values('${webId}','${vtpId}','${info.agencyCname}','${info.ctyCnname}','${info.ctyCode}','${info.dataVersion}','${info.shipCname}',
'${info.shipTypeName}','${info.spmBoardCentrele}','${info.spmBoardCentrerg}','${info.spmBoardFrontle}','${info.spmBoardFrontrg}','${info.spmBoardLaterle}',
'${info.spmBoardLaterrg}','${info.spmCab}','${info.spmCabinht}','${info.spmCountrycd}','${info.spmEdicd}','${info.spmId}',
'${info.spmLightWeight}','${info.spmMadeTime}','${info.spmMintide}','${info.spmMmsi}','${info.spmNationality}','${info.spmPilot}',
'${info.spmPilotName}','${info.spmRemark}','${info.spmShipSign}','${info.spmShipType}','${info.spmTotalCargo}','${info.spmTrade}',
'${info.spmTradeName}','${info.tenantId}','${info.termcd}','${info.valid}','${info.vslAudio}','${info.vslBaynum}',
'${info.vslBkbaynum}','${info.vslBkendbay}','${info.vslBkstartbay}','${info.vslBksternnum}','${info.vslBreadth}','${info.vslCallid}',
'${info.vslCallsign}','${info.vslCd}','${info.vslCnname}','${info.vslCstAgency}','${info.vslCstShippingline}','${info.vslCtyCountrycd}',
'${info.vslDeckmaxrows}','${info.vslDeckmaxtiers}','${info.vslDepth}','${info.vslDerrickamount}','${info.vslDraftload}','${info.vslDraftunload}',
'${info.vslEndlength}','${info.vslEnname}','${info.vslGton}','${info.vslHatchamount}','${info.vslHatchcoveramount}','${info.vslHatchmaxrows}',
'${info.vslHatchmaxtiers}','${info.vslImono}','${info.vslLcg}','${info.vslLoa}','${info.vslLoaddisargereq}','${info.vslMadedt}',
'${info.vslNetton}','${info.vslOrigin}','${info.vslPilotage}','${info.vslRfsocket}','${info.vslSailspeed}','${info.vslSpoptp}',
'${info.vslStdId}','${info.vslStopsign}','${info.vslStowagereq}','${info.vslSummaryloading}','${info.vslTcg}','${info.vslTotallocation}',
'${info.vslUncode}','${info.vslVcg}','${info.vslVtpcode}','${webDate}','${info.actualBerthingTime}')`
this.executeSql(sql)
},
// 船舶计划信息
shipPlanInfo(info) {
let webId = uuidv4()
let sql =
`insert into voyageScheduleDataPadRespDTO values('${webId}','${this.vtpId}','${info.berthStatus}','${info.confirmTime}','${info.pamId}','${info.planAnchoringTime}',
'${info.planArrivePortTime}','${info.planBerthage}','${info.planBerthageName}','${info.planBerthingTime}','${info.planDeparturePortTime}',
'${info.shipmentStatus}','${info.spmId}','${info.spmName}')`
this.executeSql(sql)
info.voyageScheduleDataDetailRespDTOList.forEach(v => {
let webId2 = uuidv4()
let sql2 =
`insert into voyageScheduleDataDetailRespDTOList values('${webId2}','${this.vtpId}',
'${webId}','${v.importExportFlag}','${v.importExportFlagName}','${v.lcoId}','${v.lcoName}',
'${v.pamId}','${v.planAmount}','${v.planCarAmount}','${v.planFinishTime}','${v.planNum}','${v.planOtherAmount}',
'${v.planParts}','${v.planRetallyAmount}','${v.planStartTime}','${v.planTunnage}','${v.planVolume}','${v.planWeight}',
'${v.shipAgentId}','${v.shipAgentName}','${v.shipComId}','${v.shipComName}','${v.spmId}','${v.spmName}',
'${v.teamNum}','${v.tradeType}','${v.tradeTypeName}','${v.vgdGoodName}','${v.votId}','${v.vvyId}',
'${v.vvyName}')`
this.executeSql(sql2)
})
},
// 下载
download(item) {
let sum = 0
this.vtpList.forEach(v => {
if (item.vtpId == v) {
sum++
}
})
if (sum == 0) {
if (item.padLockStatus == 0 || item.padLockStatus == 1) {
this.lotusLoadingData.isShow = true
let vvyIds = []
if (item.inVvyId != null && item.outVvyId == null) {
vvyIds.push(item.inVvyId)
} else if (item.outVvyId != null && item.inVvyId == null) {
vvyIds.push(item.outVvyId)
} else if (item.inVvyId != null && item.outVvyId != null) {
vvyIds.push(item.inVvyId)
vvyIds.push(item.outVvyId)
}
uni.request({
url: `${this.$local}/api/shipOperate/download?vvyIds=${vvyIds}`,
header: {
'Content-Type': 'application/json', //自定义请求头信息
'Authorization': `Bearer ${this.loginObj.access_token}`
},
method: 'GET', //请求方式,必须为大写
success: (res) => {
console.log('接口返回------', res);
if (res.statusCode == 200) {
uni.showToast({
title: `下载成功`,
icon: 'success',
duration: 2000
})
this.current = 1
this.initData('new')
this.lotusLoadingData.isShow = false
let date = new Date().getTime()
let webDate = api.getDate(date)
this.vtpId = item.vtpId
uni.setStorageSync('vtpId', item.vtpId);
this.downloadData = res.data.data
this.shipDataInfo(this.downloadData.shipmentShipManage, item.vtpId)
this.optionData = []
// 贸易类型
this.downloadData.epTypeList.forEach(v => {
this.optionData.push({
dictionariesName: "epTypeList",
ptrCode: v.ptrCode,
ptrDesc: v.ptrDesc,
ptrEnDesc:''
})
})
// 装卸类型
this.downloadData.handTypeList.forEach(v => {
this.optionData.push({
dictionariesName: "handTypeList",
ptrCode: v.ptrCode,
ptrDesc: v.ptrDesc,
ptrEnDesc:''
})
})
// 车型
this.downloadData.shipmentVehicleModeList.forEach(v => {
this.optionData.push({
dictionariesName: "carList",
ptrCode: v.bvmId,
ptrDesc: v.bvmName,
ptrEnDesc:v.bvmEnName
})
})
// 进出口
this.downloadData.ieTypeList.forEach(v => {
this.optionData.push({
dictionariesName: "ieTypeList",
ptrCode: v.ptrCode,
ptrDesc: v.ptrDesc,
ptrEnDesc:''
})
})
// 装卸方式
this.downloadData.loadTypeList.forEach(v => {
this.optionData.push({
dictionariesName: "loadTypeList",
ptrCode: v.ptrCode,
ptrDesc: v.ptrDesc,
ptrEnDesc:''
})
})
// 泊位
this.downloadData.pubBerthesManageRespList.forEach(v => {
this.optionData.push({
dictionariesName: "bthList",
ptrCode: v.bthId,
ptrDesc: v.bthBthnm,
ptrEnDesc:v.bthEnBthnm
})
})
// 翻仓类型
this.downloadData.turnoverTypeList.forEach(v => {
this.optionData.push({
dictionariesName: "turnoverTypeList",
ptrCode: v.ptrCode,
ptrDesc: v.ptrDesc,
ptrEnDesc:''
})
})
// 天气预报
// this.downloadData.weatherForecastList.forEach(v => {
this.downloadData.pubTypeWeather.forEach(v => {
this.optionData.push({
dictionariesName: "weather",
ptrCode: v.ptrCode,
ptrDesc: v.ptrDesc,
ptrEnDesc: v.ptrEnDesc
})
})
// 工班类型
this.downloadData.shipmentBasicShiftList.forEach(v => {
this.optionData.push({
dictionariesName: "shiftList",
ptrCode: v.pwcCode,
ptrDesc: v.pwcTypeDesc,
ptrEnDesc:''
})
})
// 供给类型
this.downloadData.supplyTypeList.forEach(v => {
this.optionData.push({
dictionariesName: "supplyTypeList",
ptrCode: v.ptrCode,
ptrDesc: v.ptrDesc,
ptrEnDesc:''
})
})
// 航次下拉
this.downloadData.voyageScheduleDataPadRespDTO
.voyageScheduleDataDetailRespDTOList
.forEach(v => {
this.optionData.push({
dictionariesName: "vvyList",
ptrCode: v.vvyId,
ptrDesc: v.vvyName,
ptrEnDesc:''
})
})
// 机械类型
this.downloadData.pmtType.forEach(v => {
this.optionData.push({
dictionariesName: "pmtType",
ptrCode: v.ptrCode,
ptrDesc: v.ptrDesc,
ptrEnDesc:v.ptrEnDesc
})
})
// 超长类型
this.downloadData.pubTypeLengthType.forEach(v => {
this.optionData.push({
dictionariesName: "pubTypeLengthType",
ptrCode: v.ptrCode,
ptrDesc: v.ptrDesc,
ptrEnDesc:v.ptrEnDesc
})
})
// 港区类型
this.downloadData.portDetail.forEach(v => {
this.optionData.push({
dictionariesName: "portDetail",
ptrCode: v.ptrCode,
ptrDesc: v.ptrDesc,
ptrEnDesc:v.ptrEnDesc
})
})
// 提单号数据
this.downloadData.mnfBlByVvyId.forEach(item => {
item.mnfBls.forEach(v => {
this.optionData.push({
dictionariesName: "mnfBlByVvyId",
ptrCode: '',
ptrDesc: v,
ptrEnDesc:''
})
})
})
// 存下拉到数据库
this.xlData(item.vtpId)
let webStatus = 1
// 工班基础信息表
if (this.downloadData.shipmentBasicShiftList.length > 0) {
this.downloadData.shipmentBasicShiftList.forEach(v => {
let webId = uuidv4()
let sql = `insert into shipmentBasicShiftList values('${webId}','${item.vtpId}','${v.beginTime}','${v.endTime}',
'${v.pwcCode}','${v.pwcType}','${v.pwcTypeDesc}')`
this.executeSql(sql)
})
}
// 杂项单证人员信息表
if (this.downloadData.messageRespList.length > 0) {
this.downloadData.messageRespList.forEach(v => {
let sql =
`insert into messageRespList values('${v.pmeId}','${this.vtpId}','${v.bthId}','${v.bthIdName}',
'${v.jobStartTime}','${v.jobEndTime}','${v.shipPerson}','${v.vvyId}','${v.vvyName}','${v.weatherType}',
'${v.weatherTypeDesc}','${v.workSuite}','${v.importExportFlagName}','${v.status}','${webStatus}','${v.createTime}')`
this.executeSql(sql)
})
}
// 工班信息
let aId = uuidv4()
if (this.downloadData.workMessageRespList.length > 0) {
this.downloadData.workMessageRespList.forEach(v => {
let sql =
`insert into workMessageRespList values('${v.wkmId}','${this.vtpId}','${this.downloadData.shipmentShipManage.spmId}','${aId}',
'${v.vvyId}','${v.vvyName}','${v.importExportFlagName}','${v.loadType}','${v.loadTypeName}','${v.pwcType}',
'${v.pwcTypeName}','${v.workStartTime}','${v.workEndTime}','${v.status}','${webStatus}','${v.createTime}')`
this.executeSql(sql)
if (v.workMessageDetailRespDTOS.length > 0) {
v.workMessageDetailRespDTOS.forEach(v2 => {
let sql2 = `insert into workMessageRespInfoList values('${v2.wkdId}','${this.vtpId}','${v2.wkmId}','${v2.carType}',
'${v2.carTypeName}','${v2.goodsNumber}','${v2.loadingType}','${v2.loadingTypeName}','${v2.remark}','${v2.mnfBl}',
'${v2.weight}','${v2.volume}','${v2.lengthType}','${v2.pmtType}','${webStatus}','${v.createTime}')`
this.executeSql(sql2)
})
}
})
}
let editStatus = 1
// 翻仓信息
if (this.downloadData.retallyRespList.length > 0) {
this.downloadData.retallyRespList.forEach(v => {
let sql =
`insert into retallyMessageRespList values('${v.reyId}','${this.vtpId}','${this.downloadData.shipmentShipManage.spmId}','${aId}',
'${v.reyVvyId}','${v.reyVvyName}','${v.retallyType}','${v.retallyTypeName}','${v.retallyOrigin}','${v.retallyTerminus}',
'${v.retallyStartTime}','${v.retallyEndTime}','${v.carType}','${v.carTypeName}',
'${v.goodsNumber}','${v.goodsVolume}','${v.goodsWeight}','${v.mafiGroupNum}','${v.mafiSize}','${editStatus}','${webStatus}','${webDate}')`
this.executeSql(sql)
})
}
// 其他信息
if (this.downloadData.infoRespList.length > 0) {
this.downloadData.infoRespList.forEach(v => {
let sql =
`insert into infoRespList values('${v.soiId}','${this.vtpId}','${this.downloadData.shipmentShipManage.spmId}','${aId}','${v.vvyId}',
'${v.vvyIdDesc}','${v.tecNum}','${v.startTm}','${v.endTm}','${v.weight}','${v.volume}','${v.genNum}',
'${v.startTmPt}','${v.endTmPt}','${v.weightPt}','${v.volumePt}','${v.auxRemark}',
'${v.waitRemark}','${v.workRemark}','${webStatus}','${v.createTime}')`
this.executeSql(sql)
})
}
// 系解缆
if (this.downloadData.attachUnmoorRespList.length > 0) {
this.downloadData.attachUnmoorRespList.forEach(v => {
let sql =
`insert into attachUnmoorRespList values('${v.sauId}','${this.vtpId}','${v.shipDeadWeight}','${v.vvyId}',
'${v.vvyName}','${v.importExportFlagName}','${v.bthId}','${v.bthIdName}','${v.attachTime}','${v.unmoorTime}','${v.shiftingBerthTime}',
'${v.noProductBerthStTime}','${v.noProductBerthEdTime}','${v.status}','${webStatus}','${v.createTime}')`
this.executeSql(sql)
})
}
// 供给
if (this.downloadData.shipmentShipSupplyRespList.length > 0) {
this.downloadData.shipmentShipSupplyRespList.forEach(v => {
let sql =
`insert into shipmentShipSupplyRespList values('${v.sssId}','${this.vtpId}','${v.vvyId}','${v.vvyName}','${v.importExportFlagName}',
'${v.stopBerthage}','${v.stopBerthageNm}','${v.supplyType}','${v.supplyTypeNm}','${v.supplyAmount}',
'${v.supplyDate}','${v.status}','${webStatus}','${v.createTime}')`
this.executeSql(sql)
})
}
// 指导员作业布置
if (this.downloadData.shipmentAdviserLayoutRespList.length > 0) {
this.downloadData.shipmentAdviserLayoutRespList.forEach(v => {
let sql =
`insert into shipmentAdviserLayoutRespList values('${v.altId}','${this.vtpId}','${v.vvyId}','${v.vvyName}','${v.importExportFlagName}',
'${v.bthId}','${v.bthIdName}','${v.pwcType}','${v.pwcTypeName}','${v.personNumber}',
'${v.loaderType}','${v.loaderTypeName}','${v.vehicleSize}','${v.sparePart}','${v.workTime}',
'${v.startTime}','${v.endTime}','${webStatus}','${v.createTime}')`
this.executeSql(sql)
})
}
// 船舶装卸通知书
if (this.downloadData.shipmentLoadUnloadNoticeRespList.length > 0) {
this.downloadData.shipmentLoadUnloadNoticeRespList.forEach(v => {
let sql =
`insert into shipmentLoadUnloadNoticeRespList values('${v.sluId}','${this.vtpId}','${v.vvyId}','${v.vvyName}','${v.importExportFlagName}',
'${v.workDate}','${webStatus}','${v.createTime}')`
this.executeSql(sql)
})
}
// 质量意见征询
if (this.downloadData.shipmentQualityConsultationRespList.length > 0) {
this.downloadData.shipmentQualityConsultationRespList.forEach(v => {
let webId = uuidv4()
let sql =
`insert into shipmentQualityConsultationRespList values('${v.vqcId}','${this.vtpId}','${v.vvyId}','${v.vvyName}','${v.importExportFlagName}',
'${v.bthId}','${v.berth}','${v.handlingType}','${v.handlingName}','${v.vehiclesNumber}','${v.spareNumber}',
'${v.operationDate}','${webStatus}','${v.createTime}','${v.vehiclesNumberDe}','${v.spareNumberDe}')`
this.executeSql(sql)
let sql2 =
`insert into evaluateTable values('${webId}','${this.vtpId}','${v.vqcId }','${v.evaluateOperate}','${v.evaluateSpeedSpecs}',
'${v.evaluateNoRude}','${v.evaluateAttitude}','${v.otherComents}','${webStatus}','${v.createTime}')`
this.executeSql(sql2)
})
}
// 异常情况
if (this.downloadData.abnormalConditionRespList.length > 0) {
this.downloadData.abnormalConditionRespList.forEach(v => {
let sql =
`insert into abnormalConditionRespList values('${v.vacId}','${this.vtpId}','${v.vvyId}','${v.vvyName}','${v.importExportFlagName}',
'${v.type}','${v.remark}','${v.operationDate}','${webStatus}','${v.createTime}')`
this.executeSql(sql)
})
}
// mafi清单
if (this.downloadData.mafiListRespList.length > 0) {
this.downloadData.mafiListRespList.forEach(v => {
let sql =
`insert into mafiListRespList values('${v.smlId}','${this.vtpId}','${v.vvyId}','${v.vvyName}','${v.importExportFlagName}',
'${v.loadType}','${v.loadType}','${v.type}','${v.type}','${v.size}',
'${v.mafiBarcode}','${v.workDate}','${v.status}','${webStatus}','${v.createTime}')`
this.executeSql(sql)
})
}
// 船舶计划
this.shipPlanInfo(this.downloadData.voyageScheduleDataPadRespDTO)
// 作业查询
if (this.downloadData.shipmentShipLoadPlansRespList != null) {
this.downloadData.shipmentShipLoadPlansRespList.forEach(v => {
let sql =
`insert into shipmentShipLoadPlansRespList values('${v.splId}','${this.vtpId}','${v.agentId}','${v.agentName}',
'${v.amount}','${v.brdId}','${v.brdName}','${v.bvdId}','${v.bvdName}','${v.bvmId}','${v.bvmName}',
'${v.carHeight}','${v.carLength}','${v.carWidth}','${v.consignee}','${v.customsDeclareNo}',
'${v.customsDeclareStatus}','${v.ieFg}','${v.ieFgNm}','${v.mnfBl}','${v.model}',
'${v.potId}','${v.potName}','${v.sourceType}','${v.sourceTypeNm}','${v.spmId}',
'${v.telephone}','${v.ticketGtpks}','${v.ticketVolume}','${v.ticketWeight}','${v.tradeType}',
'${v.tradeTypeNm}','${v.volume}','${v.vslCnname}',
'${v.vvyId}','${v.vvyName}','${v.weight}',
'${v.yardPos}','${webStatus}','${v.createTime}')`
this.executeSql(sql)
if (v.workQueryDetails != null) {
let sql2 =
`insert into workQueryDetails values('${v.workQueryDetails.splId}','${this.vtpId}','${v.splId}',
'${v.workQueryDetails.agentId}',
'${v.workQueryDetails.agentName}','${v.workQueryDetails.amount}','${v.workQueryDetails.brdId}',
'${v.workQueryDetails.brdName}',
'${v.workQueryDetails.bvdId}','${v.workQueryDetails.bvdName}','${v.workQueryDetails.bvmId}',
'${v.workQueryDetails.bvmName}',
'${v.workQueryDetails.carHeight}','${v.workQueryDetails.carLength}','${v.workQueryDetails.carWidth}',
'${v.workQueryDetails.consignee}','${v.workQueryDetails.customsDeclareNo}',
'${v.workQueryDetails.customsDeclareStatus}',
'${v.workQueryDetails.ieFg}','${v.workQueryDetails.ieFgNm}','${v.workQueryDetails.mnfBl}',
'${v.workQueryDetails.model}',
'${v.workQueryDetails.potId}','${v.workQueryDetails.potName}','${v.workQueryDetails.sourceType}',
'${v.workQueryDetails.sourceTypeNm}',
'${v.workQueryDetails.spmId}','${v.workQueryDetails.telephone}','${v.workQueryDetails.ticketGtpks}',
'${v.workQueryDetails.ticketVolume}','${v.workQueryDetails.ticketWeight}',
'${v.workQueryDetails.tradeType}','${v.workQueryDetails.tradeTypeNm}','${v.workQueryDetails.volume}',
'${v.workQueryDetails.vslCnname}','${v.workQueryDetails.vvyId}',
'${v.workQueryDetails.vvyName}','${v.workQueryDetails.weight}','${v.workQueryDetails.yardPos}',
'${webStatus}','${v.createTime}')`
this.executeSql(sql2)
v.workQueryDetails.vinCodeDetails.forEach(e => {
let sql3 = `insert into vinCodeDetails values('${e.spdId}','${this.vtpId}','${e.splId}','${e.godId}',
'${e.storeArea}','${e.storeLine}','${e.storeSeat}','${e.vinCode}','${e.yacId}','${e.yardId}',
'${e.yardName}','${e.yardPos}',
'${webStatus}','${v.createTime}')`
this.executeSql(sql3)
})
}
})
}
// 单证签名图片
if (this.downloadData.signAppendixRespList.length > 0) {
this.downloadData.signAppendixRespList.forEach(v => {
let sql =
`insert into workSignTable values('${v.swsId}','${this.vtpId}','${v.bizId}','${v.signFile}','${v.bizType}','${v.sort}',
'${v.vvyId}','${webDate}')`
this.executeSql(sql)
})
}
// 删除人员信息 ID 集合
uni.setStorageSync('delPmIds', [])
// 删除工班信息 ID 集合
uni.setStorageSync('delSwmIds', [])
// 删除翻仓信息展示 ID 集合
uni.setStorageSync('delSrmIds', [])
// 删除单证作业其他信息ID 集合
uni.setStorageSync('delSoiIds', [])
// 删除 单证-系解缆 ID 集合
uni.setStorageSync('delSauIds', [])
// 删除船舶供给 ID 集合
uni.setStorageSync('delSsIds', [])
// 删除指导员作业布置 ID 集合
uni.setStorageSync('delAlIds', [])
// 删除船舶装卸通知书 ID 集合
uni.setStorageSync('delLnIds', [])
// 删除质量意见征询单 ID 集合
uni.setStorageSync('delCsIds', [])
// 删除异常情况单 ID 集合
uni.setStorageSync('delCtIds', [])
// 删除MAFI ID 集合
uni.setStorageSync('delMfIds', [])
} else {
uni.showToast({
title: `下载失败`,
icon: 'error',
duration: 2000
})
this.lotusLoadingData.isShow = false
}
}
})
} else {
uni.showToast({
icon: 'none',
title: '该船名航次已被其他用户下载,不可再次下载'
});
}
} else {
uni.showToast({
icon: 'none',
title: '有单证未上传,请先上传信息后再下载'
});
}
},
// 上传
upload(item) {
if (item.padLockStatus == 0) {
this.lotusLoadingData.isShow = true
this.allArr.forEach(v => {
this.executeSql1(v, item.vtpId)
})
let that = this
setTimeout(function() {
that.workMessageRespList.forEach(v => {
that.workMessageRespInfoList.forEach(v2 => {
if (v.webId == v2.contactId) {
v.workMessageDetailReqDTOS.push(v2)
}
})
})
that.shipmentQualityConsultationRespList.forEach(v => {
that.evaluateTable.forEach(v2 => {
if (v.vqcId == v2.signId) {
that.$set(v, "evaluateOperate", v2.evaluate)
that.$set(v, "evaluateSpeedSpecs", v2.evaluate2)
that.$set(v, "evaluateNoRude", v2.evaluate3)
that.$set(v, "evaluateAttitude", v2.evaluate4)
that.$set(v, "otherComents", v2.remake)
}
})
})
let delPmIds = uni.getStorageSync("delPmIds")
if (delPmIds == null || delPmIds == "") {
delPmIds = []
}
let delSwmIds = uni.getStorageSync("delSwmIds")
if (delSwmIds == null || delSwmIds == "") {
delSwmIds = []
}
let delSrmIds = uni.getStorageSync("delSrmIds")
if (delSrmIds == null || delSrmIds == "") {
delSrmIds = []
}
let delSoiIds = uni.getStorageSync("delSoiIds")
if (delSoiIds == null || delSoiIds == "") {
delSoiIds = []
}
let delSauIds = uni.getStorageSync("delSauIds")
if (delSauIds == null || delSauIds == "") {
delSauIds = []
}
let delSsIds = uni.getStorageSync("delSsIds")
if (delSsIds == null || delSsIds == "") {
delSsIds = []
}
let delAlIds = uni.getStorageSync("delAlIds")
if (delAlIds == null || delAlIds == "") {
delAlIds = []
}
let delLnIds = uni.getStorageSync("delLnIds")
if (delLnIds == null || delLnIds == "") {
delLnIds = []
}
let delCsIds = uni.getStorageSync("delCsIds")
if (delCsIds == null || delCsIds == "") {
delCsIds = []
}
let delCtIds = uni.getStorageSync("delCtIds")
if (delCtIds == null || delCtIds == "") {
delCtIds = []
}
let delMfIds = uni.getStorageSync("delMfIds")
if (delMfIds == null || delMfIds == "") {
delMfIds = []
}
let workSignTableArr = []
that.workSignTable.forEach(item => {
if(item.vvyId.indexOf('/') != -1) {
workSignTableArr.push(
{
webId:item.webId,
vtpId:item.vtpId,
bizId:item.bizId,
signFile:item.signFile,
bizType:item.bizType,
sort:item.sort,
vvyId:item.vvyId.split('/')[0],
webDate:item.webDate,
},
{
webId:item.webId,
vtpId:item.vtpId,
bizId:item.bizId,
signFile:item.signFile,
bizType:item.bizType,
sort:item.sort,
vvyId:item.vvyId.split('/')[1],
webDate:item.webDate,
}
)
} else {
workSignTableArr.push(item)
}
})
let workDataInfo = {
"adviserLayoutReqList": that.shipmentAdviserLayoutRespList, // 指导员作业布置
"conditionReqList": that.abnormalConditionRespList, // 异常情况单
"consultationReqList": that.shipmentQualityConsultationRespList, // 质量意见征询单
"delAlIds": delAlIds, // 删除指导员作业布置 ID 集合
"delCsIds": delCsIds, // 删除质量意见征询单 ID 集合
"delCtIds": delCtIds, // 删除异常情况单 ID 集合
"delLnIds": delLnIds, // 删除船舶装卸通知书 ID 集合
"delMfIds": delMfIds, // 删除MAFI ID 集合
"delPmIds": delPmIds, // 删除人员信息 ID 集合
"delSauIds": delSauIds, // 删除 单证-系解缆 ID 集合
"delSiIds": [], // 删除安全巡检 ID 集合
"delSoiIds": delSoiIds, // 删除单证作业其他信息ID 集合
"delSrmIds": delSrmIds, // 删除翻仓信息展示 ID 集合
"delSsIds": delSsIds, // 删除船舶供给 ID 集合
"delSwmIds": delSwmIds, // 删除工班信息 ID 集合
"inVvyId": item.inVvyId, // 进口航次ID
"loadUnloadNoticeReqList": that.shipmentLoadUnloadNoticeRespList, // 船舶装卸通知书
"outVvyId": item.outVvyId, // 出口航次ID
"personMessageReqList": that.messageRespList, // 人员信息
"shipmentAttachUnmoorReqList": that.attachUnmoorRespList, // 单证-系解缆
"shipmentMafiListReqList": that.mafiListRespList, // MAFI
"shipmentOtherInfoReqList": that.infoRespList, // 单证作业其他信息
"shipmentRetallyReqList": that.retallyMessageRespList, // 单证-翻仓信息展示
"shipmentSafetyInspectionReqList": [], // 安全巡检
"shipmentShipSupplyReqList": that.shipmentShipSupplyRespList, // 船舶供给
"shipmentWorkMessageReqList": that.workMessageRespList, // 单证-工班信息
// "shipmentWorkSignAppendixReqList": that.workSignTable,
"shipmentWorkSignAppendixReqList": workSignTableArr, //签名保存数组
"vtpId": item.vtpId
}
console.log('上传参数',workDataInfo)
uni.request({
url: that.$local + '/api/shipOperate/upload',
data: workDataInfo,
header: {
'Content-Type': 'application/json', //自定义请求头信息
'Authorization': `Bearer ${that.loginObj.access_token}`
},
method: 'POST', //请求方式,必须为大写
success: (res) => {
console.log('上传接口返回------', res);
that.lotusLoadingData.isShow = false
if (res.data.status == 200) {
that.allList.forEach(v => {
let sql =
`delete from ${v} WHERE vtpId = '${item.vtpId}';`
that.executeSql(sql)
})
that.vtpList.forEach((v, index) => {
if (item.vtpId == v) {
that.vtpList.splice(index, 1)
}
})
that.current = 1
that.initData('new')
uni.showToast({
title: `上传成功`,
icon: 'success',
duration: 2000
})
// 重置删除集合
// 删除人员信息 ID 集合
uni.setStorageSync('delPmIds', [])
// 删除工班信息 ID 集合
uni.setStorageSync('delSwmIds', [])
// 删除翻仓信息展示 ID 集合
uni.setStorageSync('delSrmIds', [])
// 删除单证作业其他信息ID 集合
uni.setStorageSync('delSoiIds', [])
// 删除 单证-系解缆 ID 集合
uni.setStorageSync('delSauIds', [])
// 删除船舶供给 ID 集合
uni.setStorageSync('delSsIds', [])
// 删除指导员作业布置 ID 集合
uni.setStorageSync('delAlIds', [])
// 删除船舶装卸通知书 ID 集合
uni.setStorageSync('delLnIds', [])
// 删除质量意见征询单 ID 集合
uni.setStorageSync('delCsIds', [])
// 删除异常情况单 ID 集合
uni.setStorageSync('delCtIds', [])
// 删除MAFI ID 集合
uni.setStorageSync('delMfIds', [])
// 重置评价表
uni.setStorageSync('evaluate', "1")
uni.setStorageSync('current', 0)
uni.setStorageSync('evaluate2', "1")
uni.setStorageSync('current2', 0)
uni.setStorageSync('evaluate3', "1")
uni.setStorageSync('current3', 0)
uni.setStorageSync('evaluate4', "1")
uni.setStorageSync('current4', 0)
uni.setStorageSync('remake', "")
} else {
uni.showToast({
title: res.data.error_description,
icon: 'none',
duration: 2000
})
}
}
})
}, 2000);
} else {
uni.showToast({
icon: 'none',
title: '该船名航次已被其他用户下载,不可再次上传'
});
}
},
executeSql(sql, tableName) {
let that = this
sqlite.executeSqlCeshi(sql).then((value) => {
// 在resolve时执行的回调函数
if (tableName == "shipInfoTable") {
value.forEach(v => {
this.vtpList.push(v.vtpId)
})
} else if (tableName == "messageRespList") {
that.messageRespList = value
} else if (tableName == "workMessageRespList") {
that.workMessageRespList = value
that.workMessageRespList.forEach(v => {
that.$set(v, "wkmId", v.webId)
that.$set(v, "workMessageDetailReqDTOS", [])
})
} else if (tableName == "workMessageRespInfoList") {
that.workMessageRespInfoList = value
that.workMessageRespInfoList.forEach(v => {
that.$set(v, "wkdId", v.webId)
})
} else if (tableName == "retallyMessageRespList") {
that.retallyMessageRespList = value
that.retallyMessageRespList.forEach(v => {
that.$set(v, "reyId", v.webId)
if (v.retallyStartTime == "null") {
that.$set(v, "retallyStartTime", null)
}
if (v.retallyEndTime == "null") {
that.$set(v, "retallyEndTime", null)
}
})
} else if (tableName == "infoRespList") {
value.forEach(v => {
if (v.tecNum > 0 || v.genNum > 0) {
that.infoRespList.push(v)
}
})
that.infoRespList.forEach(v => {
that.$set(v, "soiId", v.webId)
})
} else if (tableName == "attachUnmoorRespList") {
that.attachUnmoorRespList = value
that.attachUnmoorRespList.forEach(v => {
if (v.attachTime == "null") {
that.$set(v, "attachTime", null)
}
if (v.unmoorTime == "null") {
that.$set(v, "unmoorTime", null)
}
if (v.shiftingBerthTime == "null") {
that.$set(v, "shiftingBerthTime", null)
}
if (v.noProductBerthStTime == "null") {
that.$set(v, "noProductBerthStTime", null)
}
if (v.noProductBerthEdTime == "null") {
that.$set(v, "noProductBerthEdTime", null)
}
})
} else if (tableName == "shipmentShipSupplyRespList") {
that.shipmentShipSupplyRespList = value
that.shipmentShipSupplyRespList.forEach(v => {
if (v.supplyDate == "null") {
that.$set(v, "supplyDate", null)
}
})
} else if (tableName == "shipmentAdviserLayoutRespList") {
that.shipmentAdviserLayoutRespList = value
that.shipmentAdviserLayoutRespList.forEach(v => {
if (v.workTime == "null") {
that.$set(v, "workTime", null)
}
})
} else if (tableName == "shipmentLoadUnloadNoticeRespList") {
that.shipmentLoadUnloadNoticeRespList = value
that.shipmentLoadUnloadNoticeRespList.forEach(v => {
if (v.workDate == "null") {
that.$set(v, "workDate", null)
}
})
} else if (tableName == "shipmentQualityConsultationRespList") {
that.shipmentQualityConsultationRespList = value
that.shipmentQualityConsultationRespList.forEach(v => {
if (v.operationDate == "null") {
that.$set(v, "operationDate", null)
}
})
} else if (tableName == "abnormalConditionRespList") {
that.abnormalConditionRespList = value
that.abnormalConditionRespList.forEach(v => {
if (v.operationDate == "null") {
that.$set(v, "operationDate", null)
}
})
} else if (tableName == "mafiListRespList") {
that.mafiListRespList = value
that.mafiListRespList.forEach(v => {
if (v.workDate == "null") {
that.$set(v, "workDate", null)
}
})
} else if (tableName == "workSignTable") {
that.workSignTable = value
} else if (tableName == 'evaluateTable') {
that.evaluateTable = value
that.evaluateTable.forEach(v => {
if (v.evaluate == "null") {
that.$set(v, "evaluate", null)
}
if (v.evaluate2 == "null") {
that.$set(v, "evaluate2", null)
}
if (v.evaluate3 == "null") {
that.$set(v, "evaluate3", null)
}
if (v.evaluate4 == "null") {
that.$set(v, "evaluate4", null)
}
if (v.remake == "null") {
that.$set(v, "remake", null)
}
})
}
}).catch((error) => {
// 在reject时执行的回调函数
console.error(error);
});
},
// 查
executeSql1(tableName, id) {
let sql = `select * from ${tableName} WHERE vtpId = '${id}';`
// if(tableName == 'workSignTable') sql = `SELECT webId,vtpId,strftime('%Y-%m-%d', bizId) as bizId,signFile,bizType,sort,vvyId,webDate FROM workSignTable t WHERE vtpId='${id}';`
this.executeSql(sql, tableName)
},
toGo(item) {
let sum = 0
this.vtpList.forEach(v => {
if (item.vtpId == v) {
sum++
}
})
if (sum > 0) {
uni.setStorageSync('vtpId', item.vtpId)
if (item.downloadStatus == '已下载') {
uni.navigateTo({
url: `/pages/shipWork/documentList`
})
} else {
uni.showToast({
icon: 'none',
title: '当前船只没下载,请下载后进入船只'
});
}
} else {
uni.showToast({
icon: 'none',
title: '当前船只没下载或者已经上传,请重新下载后进入船只'
});
}
}
}
};
</script>
<style lang="less" scoped>
.container {
background-color: #f5f6fa;
display: flex;
min-height: calc(100vh - 68px);
margin-top: 66px;
}
.content {
min-height: calc(100vh - 68px);
.form {
width: 100%;
background: #f5f6fa;
display: flex;
position: fixed;
top: 66px;
right: 0;
z-index: 995;
padding: 16px;
.select {
width: 200px;
margin-right: 15px;
}
.input {
width: 200px;
height: 35px;
line-height: 35px;
margin-left: 15px;
}
.searchBtn {
height: 35px;
line-height: 35px;
margin-left: 0;
font-size: 16px;
color: #fff;
background-color: #0067CF;
margin-right: 1px;
}
}
.itemList {
width: 100%;
display: flex;
justify-content: space-between;
flex-wrap: wrap;
padding: 16px;
margin-top: 40px;
padding-bottom: 50px;
/deep/.o-empty {
width: 100%;
margin-top: 15px;
}
.item {
width: 32.5%;
margin-top: 15px;
background-color: #fff;
border-radius: 8px;
padding: 16px;
position: relative;
.title {
display: flex;
margin-bottom: 24px;
image {
width: 32px;
height: 32px;
margin-right: 12px;
}
.name {
margin-top: 5px;
font-size: 16px;
color: #23262E;
font-weight: bold;
}
}
.row {
display: flex;
justify-content: space-between;
font-size: 16px;
margin-bottom: 12px;
.nitem {
width: 46%;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
color: #999;
text {
color: #23262e;
}
}
}
.footer {
width: 100%;
height: 42px;
display: flex;
justify-content: flex-end;
border-top: 1px solid #EEEEEE;
padding-top: 14px;
.fitem {
display: flex;
}
button {
width: 72px;
height: 28px;
line-height: 28px;
border-radius: 4px;
margin-right: 16px;
font-size: 14px;
border: 1px solid rgba(0, 0, 0, .2);
}
.fitem1 {
border: 1px solid #FC8300;
color: #FC8300;
background: #fff;
/deep/:after {
border: none;
}
}
.fitem2 {
background: #0067CF;
color: #fff;
}
}
.statusBox {
.statusInfo {
margin-bottom: 3px;
padding: 5px;
background: #F1F8FF;
border-radius: 4px;
font-size: 12px;
color: #0067CF;
text:first-child {
margin-right: 10px;
}
}
.notStatus {
background: #FFF7EE;
color: #FC8300;
text:first-child {
margin-right: 0;
}
}
}
.statusBox1 {
position: absolute;
top: 10px;
right: 5px;
}
.statusBox2 {
position: absolute;
top: 40px;
right: 5px;
}
}
.item:nth-child(3n) {
margin-right: 0;
}
}
.pageBox {
margin-top: 20px;
}
}
</style>