378 lines
9.1 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<view class="addPlan">
<view class="fixedheader">
<headers :themeType="true" :showBack="true">
<view class="headerName">
{{title}}
</view>
</headers>
</view>
<view :style="{ 'padding-top': (statusBarHeight + 45) * 1.5 + 'rpx' }">
<view class="plan-form">
<view class="form-item b-bottom">
<view class="">作业票编号{{workTicketCode}}</view>
</view>
<view class="form-item b-bottom">
<view class="form-lable"><text class="tag">*</text>验收单位</view>
<picker @change="bindPickerChangeEnterprise" :value="enterpriseIndex" range-key="enterpriseName" :range="enterpriseInfoList">
<view style="display: flex;align-items: center;">
<view class="uni-input" style="margin-right: 20rpx;">{{enterpriseInfoList[enterpriseIndex] ? enterpriseInfoList[enterpriseIndex].enterpriseName : ""}}</view>
<uni-icons2 type="arrowright" size="20"></uni-icons2>
</view>
</picker>
</view>
<view class="form-item b-bottom">
<view class="form-lable"><text class="tag">*</text>验收人</view>
<picker @change="bindPickerChangePerson" :value="acceptanceIndex" range-key="workerName" :range="acceptancePersonList">
<view style="display: flex;align-items: center;">
<view class="uni-input" style="margin-right: 20rpx;">{{acceptancePersonList[acceptanceIndex] ? acceptancePersonList[acceptanceIndex].workerName : ""}}</view>
<uni-icons2 type="arrowright" size="20"></uni-icons2>
</view>
</picker>
</view>
<view class="form-item b-bottom">
<view class="form-lable"><text class="tag">*</text>验收时间</view>
<dateTimePicker :placeholder="'请选择验收时间'" :disabled="isDisabled"
:start="getNowTime()" :fields="'minute'" :default-value="planTime"
@change="bindPickerChange($event,'planTime')"
class="form-content">
<view class="uni-input">
<!-- <text>{{addForm.inspectTime}}</text> -->
<uni-icons2 v-if="!isDisabled" type="arrowright" color="#6C7178" />
</view>
</dateTimePicker>
</view>
</view>
</view>
<view class="save-btn" @click="saveForm">提交验收申请</view>
</view>
</template>
<script>
import dateTimePicker from '@/components/dateTimePicker/index.vue'
import { computed } from "vue";
export default {
components:{
dateTimePicker
},
data(){
return{
engineeringId: '',
//验收人相关属性
acceptanceIndex: '',
acceptancePerson: '',
acceptancePersonList: [],
//验收单位相关属性
enterpriseId: '',
enterpriseIndex: '',
enterpriseInfoList: [],
projectSn: '',
isDisabled: false,
planTime: '',
statusBarHeight: 0,
// title: "下发验证任务",
title: "验收申请",
inspectTime:'',
userInfo: {}
}
},
created() {
// this.projectSn = JSON.parse(uni.getStorageSync('projectDetail')).projectSn
},
onShow(){
this.statusBarHeight = uni.getStorageSync('systemInfo').statusBarHeight;
},
onLoad(val){
console.log("========================");
console.log(val);
console.log("========================");
this.projectSn = JSON.parse(uni.getStorageSync('projectDetail')).projectSn
this.userInfo = JSON.parse(uni.getStorageSync('userInfo'))
this.engineeringId = val.id
this.workTicketCode = val.workTicketCode
this.getEnterpriseInfoList()
},
watch:{
enterpriseId(newVal,oldVal){
if(newVal !== oldVal) {
this.sendRequest({
// url:'xmgl/enterpriseInfo/list',
url:'xmgl/systemUser/getProjectChilderSystemUserList',
method:'post',
data:{
enterpriseId: this.enterpriseId,
projectSn: this.projectSn,
},
success:res=>{
uni.hideLoading()
this.acceptancePersonList = res.result
console.log(this.acceptancePersonList);
}
})
}
}
},
methods:{
getEnterpriseInfoList(){
this.sendRequest({
url:'xmgl/enterpriseInfo/list',
method:'post',
data:{
// engineeringId: this.detailId,
projectSn: this.projectSn,
// projectSn: JSON.parse(uni.getStorageSync('projectDetail')).projectSn,
},
success:res=>{
uni.hideLoading()
console.log("xmgl/xzDangerousEngineeringAcceptance/list",res);
this.enterpriseInfoList = res.result;
}
})
},
saveForm(){
let data = {
projectSn: this.projectSn,
engineeringId: this.engineeringId, //危大工程Id
//申请验收相关属性
// applyAcceptanceUnitId: this.userInfo.userEnterpriseId, //申请验收单位id
// applyAcceptanceUserId: this.userInfo.userId, //申请验收人id
//验收相关属性
workTicketCode: this.workTicketCode,
acceptanceUnitId: this.enterpriseId,
acceptanceUserId: this.acceptancePerson.userId,
planTime: this.planTime,
type: 7
}
console.log(data);
if(!data.acceptanceUnitId){
uni.showToast({
title: '请选择验收单位',
icon: "none",
duration: 2000
});
return;
}
if(!data.acceptanceUserId){
uni.showToast({
title: '请选择验收人',
icon: "none",
duration: 2000
});
return;
}
if(!data.planTime){
uni.showToast({
title: '请选择验收时间',
icon: "none",
duration: 2000
});
return;
}
console.log("=====================================addform",data)
console.log("=====================================userInfo",this.userInfo)
this.sendRequest({
url:'xmgl/xzDangerousEngineeringAcceptance/add',
method:'post',
data: data,
success:res=>{
uni.hideLoading()
if(res.code==200){
uni.showToast({
title:'保存成功'
})
uni.navigateBack({})
}
console.log(res)
}
})
},
bindPickerChange(e){
this.planTime = e.f3
},
bindPickerChangePerson(e){
this.acceptanceIndex = e.target.value
this.acceptancePerson = this.acceptancePersonList[e.target.value]
},
bindPickerChangeEnterprise(e){
this.enterpriseIndex = e.target.value
this.enterpriseId = this.enterpriseInfoList[e.target.value].id
},
getNowTime() {
let dateTime
let yy = new Date().getFullYear()
let mm = new Date().getMonth() + 1
let dd = new Date().getDate()
let hh = new Date().getHours()
let mf = new Date().getMinutes() < 10 ? '0' + new Date().getMinutes() : new Date().getMinutes()
let ss = new Date().getSeconds() < 10 ? '0' + new Date().getSeconds() : new Date().getSeconds()
dateTime = yy + '-' + mm + '-' + dd + ' ' + hh + ':' + mf + ':' + ss
console.log(dateTime)
return dateTime
}
}
}
</script>
<style lang="scss" scoped>
.addPlan{
min-height: 100%;
background: #F6F6F6;
.fixedheader{
position: fixed;
top: 0;
left: 0;
width: 100%;
z-index: 2;
}
.save-btn{
position: fixed;
bottom: 0;
left: 0;
width: 100%;
height: 96rpx;
background: #2b8df3;
color: #fff;
text-align: center;
line-height: 96rpx;
}
.imgBox_wrap {
display: flex;
flex-wrap: wrap;
margin-top: 20rpx;
width: 100%;
min-height: 120rpx;
}
.imgBox {
width: 120rpx;
height: 120rpx;
display: inline-flex;
position: relative;
margin-right: 30rpx;
margin-bottom: 16rpx;
.img {
width: 100%;
height: 100%;
border-radius: 12rpx;
}
.deleteImg {
position: absolute;
right: -12rpx;
top: -18rpx;
uni-image{
width: 20rpx;
height: 20rpx;
}
}
}
.addImgBox {
border: 1px solid rgba(42, 43, 91, 0.1);
background-color: #f6f5f8;
width: 120rpx;
height: 120rpx;
display: inline-flex;
align-items: center;
justify-content: center;
border-radius: 20rpx;
font-size: 24rpx;
margin-right: 12rpx;
uni-image{
width: 100%;
height: 100%;
}
// .icon-add {
// width: 36rpx;
// height: 36rpx;
// }
}
.b-bottom{
border-bottom: 1px solid #F6F6F6;
}
.f-column{
flex-direction: column;
}
.plan-form{
padding-top: 20rpx;
padding-bottom: 96rpx;
.form-item{
padding: 28rpx 24rpx;
display: flex;
justify-content: space-between;
align-items: center;
background: #fff;
.form-lable{
white-space: nowrap;
.tag{
color: #DD524D;
}
}
.from-input{
text-align: right;
}
.form-result{
.form-radio{
display: flex;
margin-left: 30rpx;
border: 1px solid #E5E5E5;
padding: 0;
border-radius: 12rpx;
overflow: hidden;
li{
list-style: none;
font-size: 28rpx;
background: #EEEEEE;
text-align: center;
width: 156rpx;
padding: 12rpx 0;
}
.active-radio{
background: #2b8df3;
color: #fff;
}
}
}
}
.txt-length{
color: #888;
text-align: right;
margin-top: 20rpx;
font-size: 28rpx;
}
.form-textarea{
margin-top: 30rpx;
width: 100%;
background: #F8F8F8;
border: 1px solid #f0f0f0;
height: 160rpx;
padding: 20rpx;
box-sizing: border-box;
// overflow: auto;
:deep(uni-textarea){
width: 100%;
height: 100%;
font-size: 28rpx;
.uni-textarea-compute{
width: 100%;
height: 100%;
overflow: auto;
}
}
}
.a-none{
align-items: initial;
}
}
}
</style>