pad-app/pages/shipWork/shiftAdd.vue

347 lines
6.6 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<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>
<view class="ulTop"><span @click="ulAdd2">添加</span><span @click="del">删除</span><van-icon
name="arrow-down" /></view>
<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>
<uni-number-box @change="numChange" v-model="numValue" />
</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>
<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({})
},
del() {
this.ulList2.splice(0, 1)
},
// 车型下拉
cxChange(e) {
this.cxValue = e;
},
// 数量
numChange(val) {
console.log(val)
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;
}
span:nth-of-type(2) {
color: red;
}
}
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>