366 lines
9.3 KiB
Vue
366 lines
9.3 KiB
Vue
<template>
|
|
<view class="fullHeight">
|
|
<headers :showBack="true">
|
|
<view class="headerName">
|
|
{{pageTitle}}
|
|
</view>
|
|
</headers>
|
|
<view class="formBox">
|
|
<form @submit="formSubmit">
|
|
<view class="uni-form-item">
|
|
<view class="uni-form-label">
|
|
<text class="star">*</text>混泥土标号
|
|
</view>
|
|
<view class="uni-form-input">
|
|
<input class="uni-input" placeholder-class="cl" name="concreteTab" :value="form.concreteTab" placeholder="请输入" />
|
|
</view>
|
|
</view>
|
|
<view class="uni-form-item">
|
|
<view class="uni-form-label">
|
|
<text class="star">*</text>楼栋
|
|
</view>
|
|
<view class="uni-form-input">
|
|
<picker @change="bindPickerChange" :value="buildIndex" :range="buildList" range-key="buildName">
|
|
<view class="uni-input uni-select cl" v-if="buildIndex==null">
|
|
请选择 <image class="icon-down" src="/static/icon-down-black.png" mode=""></image>
|
|
</view>
|
|
<view class="uni-input uni-select" v-else>{{buildList[buildIndex].buildName}}
|
|
<image class="icon-down" src="/static/icon-down-black.png" mode=""></image>
|
|
</view>
|
|
</picker>
|
|
</view>
|
|
</view>
|
|
<view class="uni-form-item">
|
|
<view class="uni-form-label">
|
|
<text class="star">*</text>楼层
|
|
</view>
|
|
<view class="uni-form-input">
|
|
<picker @change="bindPickerChange2" :value="floorIndex" :range="floorList" range-key="floorName">
|
|
<view class="uni-input uni-select cl" v-if="floorIndex==null">
|
|
请选择 <image class="icon-down" src="/static/icon-down-black.png" mode=""></image>
|
|
</view>
|
|
<view class="uni-input uni-select" v-else>{{floorList[floorIndex].floorName}}
|
|
<image class="icon-down" src="/static/icon-down-black.png" mode=""></image>
|
|
</view>
|
|
</picker>
|
|
</view>
|
|
</view>
|
|
<view class="uni-form-item">
|
|
<view class="uni-form-label">
|
|
设计强度
|
|
</view>
|
|
<view class="uni-form-input">
|
|
|
|
</view>
|
|
</view>
|
|
<view class="designBox">
|
|
<checkbox-group @change="checkboxChange" class="designItem">
|
|
<label class="uni-list-cell uni-list-cell-pd" v-for="item in selectList" :key="item.name">
|
|
<checkbox :value="item.name" :checked="item.checked" />{{item.name}}
|
|
</label>
|
|
</checkbox-group>
|
|
</view>
|
|
<view class="uni-form-item">
|
|
<view class="uni-form-label">
|
|
浇筑日期
|
|
</view>
|
|
<view class="uni-form-input">
|
|
<picker mode="date" :value="form.pourTime" @change="bindDateChange">
|
|
<view class="uni-input uni-select cl" v-if="form.pourTime==''">
|
|
请选择 <image class="icon-down" src="/static/icon-down-black.png" mode=""></image>
|
|
</view>
|
|
<view class="uni-input uni-select" v-else>{{form.pourTime}}
|
|
<image class="icon-down" src="/static/icon-down-black.png" mode=""></image>
|
|
</view>
|
|
</picker>
|
|
</view>
|
|
|
|
</view>
|
|
<view class="uni-form-item">
|
|
<view class="uni-form-label">
|
|
分包单位
|
|
</view>
|
|
<view class="uni-form-input">
|
|
<input class="uni-input" placeholder-class="cl" name="subpackage" :value="form.subpackage" placeholder="请输入" />
|
|
</view>
|
|
</view>
|
|
<view class="uni-form-item">
|
|
<view class="uni-form-label">
|
|
搅拌站单位
|
|
</view>
|
|
<view class="uni-form-input">
|
|
<input class="uni-input" placeholder-class="cl" name="mixingPlant" :value="form.mixingPlant" placeholder="请输入" />
|
|
</view>
|
|
</view>
|
|
<view class="uni-form-item">
|
|
<view class="uni-form-label">
|
|
计划方量
|
|
</view>
|
|
<view class="uni-form-input">
|
|
<input class="uni-input" placeholder-class="cl" name="planVolume" :value="form.planVolume" placeholder="请输入" />
|
|
</view>
|
|
</view>
|
|
<button form-type="submit" type="primary" class="btn submitBtn big">保存</button>
|
|
</form>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
export default {
|
|
data() {
|
|
return {
|
|
pageTitle: '新增电子浇筑令',
|
|
buildIndex: null,
|
|
floorIndex:null,
|
|
selectList: [{name:'C15'}, {name:'C20'}, {name:'C25'}, {name:'C30'}, {name:'C35'},
|
|
{name:'C40'}, {name:'C45'}, {name:'C50'}, {name:'C55'}, {name:'C60'}],
|
|
selectArr:[],
|
|
buildList:[],
|
|
floorList:[],
|
|
form: {
|
|
buildId: '',
|
|
concreteTab: "",
|
|
designStrength: "",
|
|
floorId: '',
|
|
mixingPlant: "",
|
|
planVolume: "",
|
|
pourTime: "",
|
|
projectSn: "",
|
|
subpackage: ""
|
|
},
|
|
personList: [],
|
|
projectDetail: {},
|
|
isAdd: true
|
|
}
|
|
},
|
|
onLoad(options) {
|
|
this.projectDetail = JSON.parse(uni.getStorageSync('projectDetail'))
|
|
|
|
if (options.id) {
|
|
this.isAdd = false
|
|
this.pageTitle='编辑电子浇筑令'
|
|
this.getDetails(options.id)
|
|
}else{
|
|
this.loadBuildData()
|
|
}
|
|
},
|
|
onShow() {
|
|
|
|
},
|
|
methods: {
|
|
loadBuildData(id){
|
|
this.sendRequest({
|
|
url: 'xmgl/massReboundBuild/getBuildFloorList',
|
|
data: {projectSn:this.projectDetail.projectSn},
|
|
method: "POST",
|
|
success:(res)=>{
|
|
this.buildList=res.result
|
|
if(id){
|
|
for (var i = 0; i < this.buildList.length; i++) {
|
|
var item = this.buildList[i];
|
|
if(item.id==this.form.buildId){
|
|
this.buildIndex=i
|
|
this.floorList=item.floorList;
|
|
for (var j = 0; j < this.floorList.length; j++) {
|
|
if(this.floorList[j].floorId==this.form.floorId){
|
|
this.floorIndex=j
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
})
|
|
},
|
|
goSelectPersonFn() {
|
|
uni.navigateTo({
|
|
url: './personList'
|
|
// url:'../../selectPerson/selectPerson2'
|
|
})
|
|
},
|
|
getDetails(id) {
|
|
this.sendRequest({
|
|
url: 'xmgl/electronPourOrder/queryById',
|
|
data: {
|
|
id: id
|
|
},
|
|
method: "POST",
|
|
success:(res)=> {
|
|
this.form = res.result
|
|
|
|
if(this.form.designStrength){
|
|
var items = this.selectList,values = [];
|
|
if(this.form.designStrength.indexOf(',')!=-1){
|
|
values=this.form.designStrength.split(',')
|
|
}else{
|
|
values=[this.form.designStrength]
|
|
}
|
|
for (var i = 0, lenI = this.selectList.length; i < lenI; ++i) {
|
|
const item = this.selectList[i]
|
|
if(values.includes(item.name)){
|
|
this.$set(item,'checked',true)
|
|
}else{
|
|
this.$set(item,'checked',false)
|
|
}
|
|
}
|
|
// console.log(this.selectList)
|
|
}
|
|
|
|
|
|
this.loadBuildData(id)
|
|
}
|
|
})
|
|
},
|
|
bindPickerChange: function(e) {
|
|
this.buildIndex = e.target.value
|
|
this.floorList=this.buildList[e.target.value].floorList
|
|
this.floorIndex=null
|
|
},
|
|
bindPickerChange2: function(e) {
|
|
this.floorIndex = e.target.value
|
|
},
|
|
bindDateChange: function(e) {
|
|
this.form.pourTime = e.target.value
|
|
},
|
|
checkboxChange: function (e) {
|
|
// var items = this.selectList,
|
|
// values = e.detail.value;
|
|
this.selectArr=e.detail.value;
|
|
// for (var i = 0, lenI = items.length; i < lenI; ++i) {
|
|
// const item = items[i]
|
|
// if(values.includes(item.value)){
|
|
// this.$set(item,'checked',true)
|
|
// }else{
|
|
// this.$set(item,'checked',false)
|
|
// }
|
|
// }
|
|
},
|
|
formSubmit(e) {
|
|
var that = this
|
|
console.log(e)
|
|
var params = e.detail.value
|
|
params.projectSn = this.projectDetail.projectSn
|
|
if (params.concreteTab == '') {
|
|
uni.showToast({
|
|
title: '请输入混泥土标号',
|
|
icon: 'none'
|
|
})
|
|
return false;
|
|
}
|
|
if (this.buildIndex == null) {
|
|
uni.showToast({
|
|
title: '请选择楼栋',
|
|
icon: 'none'
|
|
})
|
|
return false;
|
|
}
|
|
if (this.floorIndex == null) {
|
|
uni.showToast({
|
|
title: '请选择楼层',
|
|
icon: 'none'
|
|
})
|
|
return false;
|
|
}
|
|
|
|
|
|
params.buildId = this.buildList[this.buildIndex].id
|
|
params.floorId = this.floorList[this.floorIndex].floorId
|
|
params.pourTime = this.form.pourTime
|
|
params.designStrength=this.selectArr.join(',')
|
|
|
|
|
|
var url = 'xmgl/electronPourOrder/edit'
|
|
if (this.isAdd) {
|
|
url = 'xmgl/electronPourOrder/add'
|
|
|
|
} else {
|
|
params.id = this.form.id
|
|
}
|
|
this.sendRequest({
|
|
url: url,
|
|
data: params,
|
|
method: "POST",
|
|
success(res) {
|
|
uni.showToast({
|
|
title: '保存成功!'
|
|
})
|
|
uni.navigateBack({
|
|
|
|
})
|
|
}
|
|
})
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
.personListBox {
|
|
// background-color: #f7f7f7;
|
|
border-radius: 4px;
|
|
overflow: hidden;
|
|
border-left: 1px dashed #e6e6e6;
|
|
position: relative;
|
|
|
|
.personLeft {
|
|
width: calc(100% - 20rpx);
|
|
}
|
|
|
|
.personItem {
|
|
float: left;
|
|
width: calc(33.33% - 21px);
|
|
height: 54px;
|
|
text-align: center;
|
|
font-size: 24rpx;
|
|
border-bottom: 1px dashed #e6e6e6;
|
|
padding: 0px 20rpx 0;
|
|
border-right: 1px dashed #e6e6e6;
|
|
border-top: 1px dashed #e6e6e6;
|
|
background-color: #f7f7f7;
|
|
|
|
.name {
|
|
font-size: 30rpx;
|
|
padding-top: 16rpx;
|
|
}
|
|
|
|
.txt {
|
|
overflow: hidden;
|
|
white-space: nowrap;
|
|
text-overflow: ellipsis;
|
|
}
|
|
|
|
&.total {
|
|
display: inline-flex;
|
|
align-items: center;
|
|
font-size: 30rpx;
|
|
justify-content: center;
|
|
}
|
|
|
|
// &:nth-child(3n){
|
|
// border-right: none;
|
|
// }
|
|
}
|
|
|
|
.icon-right {
|
|
position: absolute;
|
|
right: 0;
|
|
top: calc(50% - 7px);
|
|
width: 16rpx;
|
|
height: 28rpx;
|
|
}
|
|
}
|
|
.designBox{
|
|
background-color: #f9f9f9;
|
|
border-radius: 4px;
|
|
padding: 20rpx 20rpx 0;
|
|
overflow: hidden;
|
|
margin-bottom: 40rpx;
|
|
.uni-list-cell{
|
|
width: 20%;
|
|
float: left;
|
|
margin-bottom: 20rpx;
|
|
}
|
|
}
|
|
</style>
|