pad-app/pages/shipWork/mixSign.vue

687 lines
18 KiB
Vue
Raw Normal View History

2023-09-23 20:16:54 +08:00
<template>
<view class="mixSign">
<head-view :title="title" url="/pages/shipWork/mixWork"></head-view>
2023-11-01 18:40:05 +08:00
<view class="contentFixedr">
<custom-tabs type="c1" :value="tabsValue" @change="tabsChange">
<custom-tab-pane :label="item.name" v-for="(item,index) in tabsList" :name="'c1_'+index" :key="index">
<view></view>
<view class="container">
<table>
<tbody>
<tr>
<td class="h-l1r1">
<image id="HT-logo" src="../../static/images/theme/logo.png" mode="widthFix">
</image>
</td>
<td class="h-l1r2">&nbsp;</td>
<td class="h-l1r3">
<p>上海海通国际汽车码头有限公司</p>
<p>Shanghai HaiTong International Automotive Terminal Co.,Ltd.</p>
</td>
</tr>
<tr>
<td colspan="3">
<p class="bh-dz">QR-7.5.1-01-11-M</p>
</td>
</tr>
<tr>
<td colspan="3" class="h-l2r1">
<p class="name-dz">海通码头装卸和杂项作业单</p>
<p class="ename-dz">SHANGHAI HARBOUR BUREAU STEVEDORE WORKING RECORD</p>
</td>
</tr>
</tbody>
</table>
<table>
<tbody>
<tr class="top">
<td class="topTitle">Name of ship:<p>{{shipInfo.vslCnname}}</p>
</td>
<td class="topTitle">Voy No:<p>{{vvyName}}</p>
</td>
</tr>
<tr class="top">
<td class="topTitle">Date:<p>{{dateId}}</p>
</td>
<!-- <td>Weather:</td>
<td></td> -->
<!-- <td>Gangs:</td>
<td></td>
<td>Foreman:</td>
<td></td> -->
</tr>
<!-- <tr>
<td>Foreman Working time:</td>
<td class="td-b-b0"></td>
<td>Berthed at Haitong:</td>
<td></td>
</tr> -->
</tbody>
</table>
<table class="t-zx">
<tbody>
<tr>
<td rowspan="2" style="width: 50px;"></td>
<td colspan="6">Working time</td>
<td colspan="4">Kind Of Works</td>
<td rowspan="2">B/L</td>
<td colspan="3">Handling method</td>
</tr>
<tr>
<td colspan="3" style="width: 120px;">From</td>
<td colspan="3" style="width: 120px;">To</td>
<td colspan="4">Loading/UnLoading</td>
<td>Ro/Ro</td>
<td>PortDevices</td>
<td>Others</td>
</tr>
</tbody>
</table>
<view v-for="(item2,index2) in shiftInfo" :key="index2 + 'shift'" class="rowBox">
<view class="name">{{item2.pwcTypeName}}</view>
<view class="time">{{item2.workStartTime}}</view>
<view class="time">{{item2.workEndTime}}</view>
<view class="infoBox">
<view class="iBox" v-for="(item3,index3) in item2.infoArr">
<view colspan="4" class="carCss">
车型:{{item3.carTypeName}},数量:{{item3.goodsNumber}}
</view>
<view class="remark">{{item3.remark}}</view>
<view class="ro gx"><text v-if="item3.loadingType == 'RO'"></text></view>
<view class="pr gx"><text v-if="item3.loadingType == 'PR'"></text></view>
<view class="ot gx"><text v-if="item3.loadingType == 'OT'"></text></view>
</view>
</view>
2023-09-23 20:16:54 +08:00
</view>
2023-11-01 18:40:05 +08:00
<table class="t-zx">
<tbody>
<tr>
<td :rowspan="fcList.length + 2">翻仓信息</td>
<td colspan="2" rowspan="2">Kind of Rehangdling</td>
<td colspan="2">DK/H</td>
<td colspan="6">Working time</td>
<td colspan="4">Weight/Measure</td>
</tr>
<tr>
<td>From</td>
<td>To</td>
<td colspan="3">From</td>
<td colspan="3">To</td>
<td colspan="2">Vehicle type/Quantity</td>
<td colspan="2">Total W/M</td>
</tr>
<tr v-for="(item,index) in fcArr" :key="index + 'fc'">
<td colspan="2">{{item.retallyTypeName}}</td>
<td>{{item.retallyOrigin}}</td>
<td>{{item.retallyTerminus}}</td>
<td colspan="3">{{item.retallyStartTime}}</td>
<td colspan="3">{{item.retallyEndTime}}</td>
<td colspan="2">车型:{{item.carTypeName}},数量:{{item.goodsNumber}}</td>
<td colspan="2">重量:{{item.goodsWeight}},体积:{{item.goodsVolume}}</td>
</tr>
</tbody>
</table>
<table class="t-zx" v-for="(v,indexv) in qtArr" :key="indexv">
<tbody>
<tr>
<td>&nbsp;</td>
<!-- <td colspan="2">Reason</td> -->
<td colspan="3">技术工人</td>
<td>From</td>
<td>To</td>
<td>Weight/Measure</td>
<td colspan="3">普通工人</td>
<td>From</td>
<td>To</td>
<td>Weight/Measure</td>
</tr>
<tr>
<td>&nbsp;</td>
<td colspan="3">{{v.tecNum}}</td>
<td>{{v.startTm}}</td>
<td>{{v.endTm}}</td>
<td>重量:{{v.weight}},体积:{{v.volume}}</td>
<td colspan="3">{{v.genNum}}</td>
<td>{{v.startTmPt}}</td>
<td>{{v.endTmPt}}</td>
<td>重量:{{v.weightPt}},体积:{{v.volumePt}}</td>
</tr>
<tr>
<td>Extra Labour辅助作业</td>
<td colspan="15">{{v.auxRemark}}</td>
</tr>
<tr>
<td>Stand by待工</td>
<td colspan="15">{{v.waitRemark}}</td>
</tr>
<tr>
<td>Remark备注</td>
<td colspan="15">{{v.workRemark}}</td>
</tr>
</tbody>
</table>
<view class="sginBox">
<view class="box">
<p>Foreman(指导员):</p>
<p class="sign" @click="togoSign('0')" v-if="zdySign.url == ''"></p>
<template v-else>
<image :src="zdySign.url" mode="widthFix"></image>
<!-- <text class="del" @click="delSign(zdySign.id)"></text> -->
</template>
</view>
<view class="box">
<p>Capt/Chief Mate(船长/大副):</p>
<p class="sign" @click="togoSign('1')" v-if="czSign.url == ''"></p>
<template v-else>
<image :src="czSign.url" mode="widthFix"></image>
<!-- <text class="del" @click="delSign(czSign.id)"></text> -->
</template>
</view>
2023-09-23 20:16:54 +08:00
</view>
</view>
2023-11-01 18:40:05 +08:00
</custom-tab-pane>
</custom-tabs>
</view>
2023-09-23 20:16:54 +08:00
<uni-popup ref="delPopup" type="dialog">
<uni-popup-dialog type="error" confirmText="确定" title="通知" content="是否删除此条数据"
@confirm="delConfirm"></uni-popup-dialog>
</uni-popup>
</view>
</template>
<script>
import sqlite from "../../common/sqlite.js"
2023-11-01 18:40:05 +08:00
import api from "../../common/api.js"
2023-09-23 20:16:54 +08:00
export default {
data() {
return {
title: "杂项单证签名",
tabsValue: 0,
tabsList: [],
2023-11-13 10:11:34 +08:00
vvyId: "",
2023-11-01 18:40:05 +08:00
vvyName: "",
webId: "",
2023-09-23 20:16:54 +08:00
aIdList: [],
aId: "",
2023-11-01 18:40:05 +08:00
vtpId: "",
// 时间段数组
timeArr: [],
// 一天开始时间
startTime: "",
// 一天结束时间
endTime: "",
// 单证数量
tabsArr: [],
gbArr: [],
2023-09-23 20:16:54 +08:00
// 船舶信息
shipInfo: {},
2023-11-01 18:40:05 +08:00
shiftInfo: [],
2023-09-23 20:16:54 +08:00
// 工班信息
shiftList: [],
// 翻仓信息
fcList: [],
2023-11-01 18:40:05 +08:00
fcArr: [],
2023-09-23 20:16:54 +08:00
// 其他信息
2023-11-01 18:40:05 +08:00
qtList: [],
qtArr: [],
2023-09-23 20:16:54 +08:00
// 签名信息
zdySign: {
url: "",
id: ""
},
2023-11-01 18:40:05 +08:00
dateId: "",
2023-09-23 20:16:54 +08:00
czSign: {
url: "",
id: ""
},
delId: "",
}
},
onLoad(option) {
if ('params' in option) {
this.tabsValue = JSON.parse(decodeURIComponent(option.params)).tabsValue
}
},
mounted() {
2023-11-01 18:40:05 +08:00
this.vtpId = uni.getStorageSync('vtpId')
let that = this
that.executeSql2()
that.executeSql('shipInfoTable')
that.aaa()
setTimeout(function() {
that.fcList.forEach(v => {
let endT = v.retallyEndTime.slice(0, 10)
if (endT == that.dateId) {
that.fcArr.push(v)
}
})
that.qtList.forEach(v => {
let endT = ""
if (v.endTm != "") {
endT = v.endTm.slice(0, 10)
} else if (v.endTmPt != "") {
endT = v.endTmPt.slice(0, 10)
}
if (endT == that.dateId) {
that.qtArr.push(v)
}
})
that.shiftInfo.forEach(v => {
let arr = api.arrFrom(v.infoArr, "webId")
that.$set(v, "infoArr", arr)
})
}, 300)
2023-09-23 20:16:54 +08:00
},
methods: {
// 查船舶信息
executeSql(tableName) {
2023-11-01 18:40:05 +08:00
let sql = `select * from ${tableName} WHERE vtpId = '${this.vtpId}'`
2023-09-23 20:16:54 +08:00
sqlite.executeSqlCeshi(sql).then((value) => {
// 在resolve时执行的回调函数
if (tableName == 'shipInfoTable') {
this.shipInfo = value[0]
} else {
console.log(value)
}
}).catch((error) => {
// 在reject时执行的回调函数
console.error(error);
});
},
2023-11-01 18:40:05 +08:00
// 查工班信息
executeSql2(type) {
let sql = `SELECT
strftime('%Y-%m-%d %H:00:00', datetime(workEndTime, '0 day', 'start of day', '+22 hours')) || ',' || strftime('%Y-%m-%d %H:00:00', datetime(workEndTime, '1 day', 'start of day', '+22 hours')) AS work_shift
FROM workMessageRespList WHERE workMessageRespList.vtpId='${this.vtpId}'
GROUP BY work_shift
UNION SELECT strftime('%Y-%m-%d %H:00:00', datetime(workEndTime, '-1 day', 'start of day', '+22 hours')) || ',' || strftime('%Y-%m-%d %H:00:00', datetime(workEndTime, '0 day', 'start of day', '+22 hours')) AS work_shift
FROM workMessageRespList WHERE workMessageRespList.vtpId='${this.vtpId}'
GROUP BY work_shift;`
2023-09-23 20:16:54 +08:00
sqlite.executeSqlCeshi(sql).then((value) => {
2023-11-01 18:40:05 +08:00
this.timeArr = value
value.forEach((v, index) => {
this.startTime = v.work_shift.split(",")[0]
this.endTime = v.work_shift.split(",")[1]
let sql2 =
`Select COUNT(*),pwcTypeName,vvyId,vvyName,MIN(workStartTime) AS workStartTime, MAX(workEndTime)
AS workEndTime FROM (SELECT * FROM workMessageRespList WHERE workStartTime>='${this.startTime}' and
workEndTime<'${this.endTime}' and workMessageRespList.vtpId='${this.vtpId}')
GROUP BY pwcTypeName ORDER BY workStartTime asc;`
this.executeSql22(sql2, index)
let sql3 = `SELECT * FROM retallyMessageRespList WHERE retallyMessageRespList.retallyStartTime>='${this.startTime}' and
retallyMessageRespList.retallyEndTime<'${this.endTime}' and vtpId = '${this.vtpId}'`
this.executeSql3(sql3, this.endTime)
let sql4 = `SELECT * FROM infoRespList WHERE infoRespList.startTm>='${this.startTime}' and
infoRespList.endTm<'${this.endTime}' and vtpId = '${this.vtpId}'`
this.executeSql4(sql4, this.endTime)
})
let that = this
setTimeout(function() {
if (type != 0) {
that.tabsArr.forEach((v, index) => {
let _index = index + 1
that.$set(v, "name", `杂项单证${_index}`)
})
2023-09-23 20:16:54 +08:00
}
2023-11-01 18:40:05 +08:00
that.tabsList = that.tabsArr
that.shiftInfo = that.tabsList[that.tabsValue].shiftArr
that.shiftList = that.tabsList[that.tabsValue].shiftArr
2023-11-13 10:11:34 +08:00
that.vvyId = that.tabsList[0].shiftArr[0].vvyId
2023-11-01 18:40:05 +08:00
that.vvyName = that.tabsList[0].shiftArr[0].vvyName
let dateId = that.tabsList[that.tabsValue].shiftArr[0].workEndTime
that.dateId = dateId.slice(0, 10)
that.executeSql5()
that.shiftList.forEach(v => {
that.executeSql222(v.workStartTime, v.workEndTime, v.pwcTypeName)
})
setTimeout(function() {
that.shiftList = that.shiftList
}, 100)
}, 100)
}).catch((error) => {
// 在reject时执行的回调函数
console.error(error);
});
},
executeSql22(sql, index) {
sqlite.executeSqlCeshi(sql).then((value) => {
if (value.length > 0) {
this.tabsArr.push({
shiftArr: value
})
}
}).catch((error) => {
// 在reject时执行的回调函数
console.error(error);
});
},
executeSql222(sTime, eTime, pwcTypeName) {
let sql = `SELECT * FROM workMessageRespList
WHERE workStartTime>='${sTime}'
and workEndTime<='${eTime}'
and workMessageRespList.vtpId='${this.vtpId}'
and workMessageRespList.pwcTypeName='${pwcTypeName}';`
sqlite.executeSqlCeshi(sql).then((value) => {
this.gbArr.push(...value)
this.shiftInfo.forEach((i, index) => {
this.$set(i, "infoArr", [])
this.gbArr.forEach((v, index2) => {
if (i.pwcTypeName == v.pwcTypeName) {
this.aaa(v.webId, index)
}
})
2023-09-23 20:16:54 +08:00
})
}).catch((error) => {
// 在reject时执行的回调函数
console.error(error);
});
},
2023-11-01 18:40:05 +08:00
aaa(id, index) {
2023-09-23 20:16:54 +08:00
let sql =
2023-11-01 18:40:05 +08:00
`SELECT * FROM workMessageRespInfoList WHERE workMessageRespInfoList.contactId = '${id}'`
2023-09-23 20:16:54 +08:00
sqlite.executeSqlCeshi(sql).then((value) => {
2023-11-01 18:40:05 +08:00
// this.$set(this.gbArr[index], "infoArr", value)
this.shiftInfo[index].infoArr.push(...value)
2023-09-23 20:16:54 +08:00
}).catch((error) => {
// 在reject时执行的回调函数
console.error(error);
});
},
// 查翻仓信息
2023-11-01 18:40:05 +08:00
executeSql3(sql, endTIme) {
2023-09-23 20:16:54 +08:00
sqlite.executeSqlCeshi(sql).then((value) => {
2023-11-01 18:40:05 +08:00
if (value.length > 0) {
this.fcList.push(...value)
}
this.fcList = api.arrFrom(this.fcList, "webId")
2023-09-23 20:16:54 +08:00
}).catch((error) => {
// 在reject时执行的回调函数
console.error(error);
});
},
// 查其他信息
2023-11-01 18:40:05 +08:00
executeSql4(sql, endTIme) {
2023-09-23 20:16:54 +08:00
sqlite.executeSqlCeshi(sql).then((value) => {
// 在resolve时执行的回调函数
2023-11-01 18:40:05 +08:00
if (value.length > 0) {
this.qtList.push(...value)
}
this.qtList = api.arrFrom(this.qtList, "webId")
2023-09-23 20:16:54 +08:00
}).catch((error) => {
// 在reject时执行的回调函数
console.error(error);
});
},
// 查单证签字表
executeSql5() {
2023-11-01 18:40:05 +08:00
let sql = `select * from workSignTable WHERE bizId = '${this.dateId}';`
2023-09-23 20:16:54 +08:00
sqlite.executeSqlCeshi(sql).then((value) => {
// 在resolve时执行的回调函数
let zdyList = []
let czList = []
if (value.length > 0) {
value.forEach(v => {
2023-11-01 18:40:05 +08:00
if (v.sort == 0) {
2023-09-23 20:16:54 +08:00
this.zdySign = {
2023-11-01 18:40:05 +08:00
url: v.signFile,
2023-09-23 20:16:54 +08:00
id: v.webId
}
zdyList.push(v)
} else {
this.czSign = {
2023-11-01 18:40:05 +08:00
url: v.signFile,
2023-09-23 20:16:54 +08:00
id: v.webId
}
czList.push(v)
}
})
}
if (zdyList.length == 0) {
this.zdySign = {
url: "",
id: ""
}
}
if (czList.length == 0) {
this.czSign = {
url: "",
id: ""
}
}
}).catch((error) => {
// 在reject时执行的回调函数
console.error(error);
});
},
// 删除当前签名
delSign(id) {
this.$refs.delPopup.open()
this.delId = id
},
// 弹框删除
delConfirm() {
let sql = `DELETE FROM workSignTable WHERE webId = '${this.delId}';`
sqlite.executeSqlCeshi(sql).then((value) => {
// 在resolve时执行的回调函数
this.executeSql5()
}).catch((error) => {
// 在reject时执行的回调函数
console.error(error);
});
},
// 点击标签
tabsChange(e) {
this.tabsValue = e.value
2023-11-01 18:40:05 +08:00
this.shiftList = this.tabsList[e.value].shiftArr
this.dateId = this.tabsList[e.value].shiftArr[0].workEndTime.slice(0, 10)
this.vvyName = this.tabsList[e.value].shiftArr[0].vvyName
this.gbArr = []
this.tabsArr = []
this.tabsList = []
this.shiftList = []
this.shiftInf = []
this.fcArr = []
this.qtArr = []
this.executeSql2(0)
2023-09-23 20:16:54 +08:00
this.executeSql5()
2023-11-01 18:40:05 +08:00
this.shiftInfo.forEach(v => {
let arr = api.arrFrom(v.infoArr, "webId")
this.$set(v, "infoArr", arr)
})
this.fcList.forEach(v => {
let endT = v.retallyEndTime.slice(0, 10)
if (endT == this.dateId) {
this.fcArr.push(v)
}
})
this.qtList.forEach(v => {
let endT = ""
if (v.endTm != "") {
endT = v.endTm.slice(0, 10)
} else if (v.endTmPt != "") {
endT = v.endTmPt.slice(0, 10)
}
if (endT == this.dateId) {
this.qtArr.push(v)
}
})
console.log(this.qtArr)
2023-09-23 20:16:54 +08:00
},
// 点击签名
togoSign(signType) {
let obj = {
2023-11-01 18:40:05 +08:00
id: this.dateId,
2023-09-23 20:16:54 +08:00
url: "mixSign",
2023-11-01 18:40:05 +08:00
signType: Number(signType), // 0 指导员 1 船长/大副
signTable: "2",
2023-09-23 20:16:54 +08:00
tabsValue: this.tabsValue,
2023-11-13 10:11:34 +08:00
vvyId: this.vvyId,
2023-09-23 20:16:54 +08:00
}
const params = encodeURIComponent(JSON.stringify(obj));
uni.navigateTo({
url: `/pages/shipWork/sign?params=${params}`
})
},
}
}
</script>
<style lang="less" scoped>
@import "../../style/css/main-dz.css";
2023-11-01 18:40:05 +08:00
.contentFixedr {
margin-top: 68px !important;
2023-09-23 20:16:54 +08:00
}
2023-11-01 18:40:05 +08:00
.container {
padding: 0px 20px;
2023-09-23 20:16:54 +08:00
2023-11-01 18:40:05 +08:00
table {
margin-bottom: 0 !important;
}
2023-09-23 20:16:54 +08:00
}
2023-11-01 18:40:05 +08:00
.td-b-b1 {
border-bottom: #000000 solid 1px;
2023-09-23 20:16:54 +08:00
}
2023-11-01 18:40:05 +08:00
.t-zx td {
2023-09-23 20:16:54 +08:00
height: 36px;
}
2023-11-01 18:40:05 +08:00
/deep/.uni-scroll-view-content {
display: flex;
2023-09-23 20:16:54 +08:00
}
2023-11-01 18:40:05 +08:00
.top {
display: flex;
margin-bottom: 16px;
2023-09-23 20:16:54 +08:00
}
2023-11-01 18:40:05 +08:00
.topTitle {
width: calc(50% - 20px);
display: flex;
margin-left: 20px;
p {
width: 80%;
display: flex;
flex-direction: column;
justify-content: center;
text-align: center;
border-bottom: 1px solid #000000;
}
}
.rowBox {
width: 100%;
display: flex;
border: 1px solid #000;
box-sizing: border-box;
.name {
border-right: 1px solid #000;
width: 70px;
text-align: center;
display: flex;
flex-direction: column;
justify-content: center;
padding: 10px;
}
.time {
border-right: 1px solid #000;
width: 200px;
text-align: center;
display: flex;
flex-direction: column;
justify-content: center;
}
.infoBox {
display: flex;
flex-direction: column;
justify-items: center;
.iBox {
flex: 1;
display: flex;
border-top: 1px solid #000;
border-bottom: 1px solid #000;
.carCss {
border-right: 1px solid #000;
width: 245px;
text-align: center;
display: flex;
flex-direction: column;
justify-content: center;
}
.remark {
border-right: 1px solid #000;
width: 61px;
text-align: center;
display: flex;
flex-direction: column;
justify-content: center;
}
.gx {
border-right: 1px solid #000;
width: 61px;
text-align: center;
display: flex;
flex-direction: column;
justify-content: center;
}
.ro {
width: 86px;
}
.pr {
width: 137px;
}
.ot {
width: 90px;
border: none;
}
}
.iBox:first-child {
border-top: none;
}
.iBox:last-child {
border-bottom: none;
}
}
2023-09-23 20:16:54 +08:00
}
.sginBox {
display: flex;
2023-11-01 18:40:05 +08:00
margin-top: 20px;
2023-09-23 20:16:54 +08:00
.box {
flex: 1;
display: flex;
image {
width: 200px;
height: 50px;
}
.del {
color: red;
}
}
}
.sign {
color: #2979ff;
margin-left: 10px;
}
</style>