pad-app/pages/shipWork/shiftAdd.vue

347 lines
6.6 KiB
Vue
Raw Normal View History

2023-07-11 17:29:53 +08:00
<template>
<view class="shiftAdd">
<view class="container">
<uni-steps :options="stepList" :active="active" />
<view class="line"></view>
<ul class="ul1">
<li>
<p>船名</p>
<span>快乐号</span>
</li>
<li>
<p><span class="required">*</span>航次</p>
<uni-data-select v-model="hcValue" :localdata="hcList" @change="hcChange"></uni-data-select>
</li>
<li>
<p>进出口</p>
<span>进口</span>
</li>
<li>
<p>贸易类型</p>
<span>内贸</span>
</li>
<li>
<p><span class="required">*</span>装卸类型</p>
<uni-data-select v-model="zxValue" :localdata="zxList" @change="zxChange"></uni-data-select>
</li>
</ul>
<view class="ulTop"><span @click="ulAdd1"></span><van-icon name="arrow-down" /></view>
<ul class="ul2" v-for="(item,index) in ulList1" :key="index">
<li>
<p class="liTitle"><span class="required">*</span>工班</p>
<uni-data-select v-model="gbValue" :localdata="gbList" @change="gbChange"></uni-data-select>
</li>
<li>
<p class="liTitle"><span class="required">*</span>作业时间 </p>
<uni-datetime-picker v-model="datetime" type="datetimerange" rangeSeparator="-"
@change="changeLog" />
</li>
</ul>
2023-07-11 17:43:29 +08:00
<view class="ulTop"><span @click="ulAdd2"></span><span @click="del"></span><van-icon
name="arrow-down" /></view>
2023-07-11 17:29:53 +08:00
<ul class="ul2" v-for="(item,index) in ulList2" :key="index">
<li>
<p class="liTitle"><span class="required">*</span>车型</p>
<uni-data-select v-model="cxValue" :localdata="cxList" @change="cxChange"></uni-data-select>
</li>
<li>
<p><span class="required">*</span>数量</p>
2023-07-11 17:43:29 +08:00
<uni-number-box @change="numChange" v-model="numValue" />
2023-07-11 17:29:53 +08:00
</li>
<li>
<p class="liTitle"><span class="required">*</span>装卸方式</p>
<uni-data-select v-model="fsValue" :localdata="fsList" @change="fsChange"></uni-data-select>
</li>
<li class="widthLi">
<p class="liTitle">备注</p>
<uni-easyinput type="textarea" autoHeight v-model="notes" placeholder="请输入任务描述(200字以内)"
maxlength="200"></uni-easyinput>
</li>
</ul>
2023-07-11 17:43:29 +08:00
2023-07-11 17:29:53 +08:00
<view class="btnList">
<van-button type="default" @click="cancel"></van-button>
<van-button type="info">保存</van-button>
<van-button type="info">下一步</van-button>
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
obj: {},
active: 0,
stepList: [{
title: '工班信息'
}, {
title: '翻舱信息'
}, {
title: '其他信息'
}],
// 航次下拉框
hcValue: "",
hcList: [{
value: 0,
text: "航次0"
},
{
value: 1,
text: "航次1"
},
{
value: 2,
text: "航次2"
},
],
// 装卸类型下拉框
zxValue: "",
zxList: [{
value: 0,
text: "装卸类型0"
},
{
value: 1,
text: "装卸类型1"
},
{
value: 2,
text: "装卸类型2"
},
],
ulList1: [{}],
// 工班下拉框
gbValue: "",
gbList: [{
value: 0,
text: "工班0"
},
{
value: 1,
text: "工班1"
},
{
value: 2,
text: "工班2"
},
],
// 作业时间
datetime: "",
ulList2: [{}],
// 车型下拉
cxValue: "",
cxList: [{
value: 0,
text: "车型0"
},
{
value: 1,
text: "车型1"
},
{
value: 2,
text: "车型2"
},
],
// 数量
numValue: 0,
// 装卸方式下拉
fsValue: "",
fsList: [{
value: 0,
text: "装卸方式0"
},
{
value: 1,
text: "装卸方式1"
},
{
value: 2,
text: "装卸方式2"
},
],
// 备注
notes: "",
}
},
onLoad(options) {
if ('params' in options) {
// 获取传递的对象参数使用decodeURIComponent解码并转为对象
this.obj = JSON.parse(decodeURIComponent(options.params))
}
},
methods: {
// 航次下拉
hcChange(e) {
this.hcValue = e;
},
// 装卸类型下拉
zxChange(e) {
this.zxValue = e;
},
// 点击第一个添加
ulAdd1() {
this.ulList1.push({})
},
// 工班下拉
gbChange(e) {
this.gbValue = e;
},
// 作业时间
changeLog(e) {},
// 点击第二个添加
ulAdd2() {
this.ulList2.push({})
},
2023-07-11 17:43:29 +08:00
del() {
this.ulList2.splice(0, 1)
},
2023-07-11 17:29:53 +08:00
// 车型下拉
cxChange(e) {
this.cxValue = e;
},
// 数量
numChange(val) {
2023-07-11 17:43:29 +08:00
console.log(val)
2023-07-11 17:29:53 +08:00
this.numValue = val;
},
// 装卸方式下拉
fsChange(e) {
this.fsValue = e;
},
// 取消
cancel() {
uni.navigateTo({
url: '/pages/shipWork/mixWork'
})
},
}
}
</script>
<style lang="less" scoped>
.shiftAdd {
.container {
padding: 30px 20px;
background-color: #fff;
/deep/.uni-steps__row-title {
font-size: 20px;
}
/deep/.uni-icons {
font-size: 20px !important;
}
/deep/.uni-steps__row-container {
margin-top: 10px;
}
.line {
width: 100%;
height: 10px;
background: #f2f2f2;
margin-top: 20px;
}
.ulTop {
width: 100%;
padding: 20px;
text-align: right;
border-top: 1px solid #ccc;
span {
color: #2979ff;
margin-right: 10px;
}
2023-07-11 17:43:29 +08:00
span:nth-of-type(2) {
color: red;
}
2023-07-11 17:29:53 +08:00
}
ul {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
margin: 20px 0;
li {
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;
}
.liTitle {
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;
}
}
.widthLi {
width: 100%;
}
}
.ul2 {
padding: 0;
margin-top: 0;
li {
border: none;
margin-bottom: 0;
}
}
.btnList {
display: flex;
justify-content: center;
/deep/ .van-button {
margin: 30px 20px;
width: 120px;
height: 50px;
}
}
}
}
</style>