zhgdyunapp/pages/projectEnd/dangerBigProject/addFinallyAcceptance.vue

406 lines
9.1 KiB
Vue
Raw Normal View History

2024-04-28 15:34:42 +08:00
<template>
<view class="addPlan">
<headers class="fixedheader" :themeType="true" :showBack="true">
<view class="headerName">
2024-04-28 18:40:19 +08:00
{{title}}
2024-04-28 15:34:42 +08:00
</view>
</headers>
2024-04-28 18:40:19 +08:00
<view :style="{ 'padding-top': statusBarHeight + 45 + 'px' }">
2024-04-28 15:34:42 +08:00
<view class="plan-form">
<view class="form-item b-bottom">
2024-04-28 18:40:19 +08:00
<view class="form-lable"><text class="tag">*</text>验收单位</view>
2024-05-04 16:13:57 +08:00
<picker @change="bindPickerChange" :value="typeIndex" range-key="enterpriseName" :range="enterpriseInfoList">
2024-04-28 18:40:19 +08:00
<view style="display: flex;align-items: center;">
2024-05-04 16:13:57 +08:00
<view class="uni-input" style="margin-right: 10px;">{{enterpriseInfoList[typeIndex] ? enterpriseInfoList[typeIndex].name : ""}}</view>
2024-04-28 18:40:19 +08:00
<uni-icons2 type="arrowright" size="20"></uni-icons2>
2024-04-28 15:34:42 +08:00
</view>
2024-04-28 18:40:19 +08:00
</picker>
</view>
<view class="form-item b-bottom">
<view class="form-lable"><text class="tag">*</text>验收人</view>
<picker @change="bindPickerChange" :value="typeIndex" range-key="name" :range="typeList">
<view style="display: flex;align-items: center;">
<view class="uni-input" style="margin-right: 10px;">{{typeList[typeIndex] ? typeList[typeIndex].name : ""}}</view>
<uni-icons2 type="arrowright" size="20"></uni-icons2>
2024-04-28 15:34:42 +08:00
</view>
2024-04-28 18:40:19 +08:00
</picker>
</view>
<view class="form-item b-bottom">
<view class="form-lable"><text class="tag">*</text>验收时间</view>
<dateTimePicker :placeholder="'请选择验收时间'" :disabled="isDisabled"
2024-05-04 16:13:57 +08:00
:start="checkedTime" :fields="'minute'" :default-value="inspectTime"
@change="bindPickerChange($event,'checkedTime')"
2024-04-28 18:40:19 +08:00
class="form-content">
<view class="uni-input">
<!-- <text>{{addForm.inspectTime}}</text> -->
<uni-icons v-if="!isDisabled" type="arrowright" color="#6C7178" />
</view>
</dateTimePicker>
</view>
2024-04-28 15:34:42 +08:00
</view>
2024-04-28 18:40:19 +08:00
</view>
2024-04-28 15:34:42 +08:00
<view class="save-btn" @click="saveForm">保存</view>
</view>
</template>
<script>
2024-04-28 18:40:19 +08:00
import dateTimePicker from '@/components/dateTimePicker/index.vue'
import { computed } from "vue";
2024-04-28 15:34:42 +08:00
export default {
2024-04-28 18:40:19 +08:00
components:{
dateTimePicker
},
2024-04-28 15:34:42 +08:00
data(){
return{
2024-05-04 16:13:57 +08:00
projectSn: '',
enterpriseInfoList: [],
isDisabled: false,
checkedTime: '',
2024-04-28 15:34:42 +08:00
statusBarHeight: 0,
2024-04-28 18:40:19 +08:00
title: "下发验证任务",
inspectTime:'',
2024-04-28 15:34:42 +08:00
formData:{
2024-04-28 18:40:19 +08:00
acceptanceRegion: "",
acceptanceDescribe: "",
2024-04-28 15:34:42 +08:00
imgFileList:[],
2024-04-28 18:40:19 +08:00
acceptanceResult: 1,
acceptanceType: "",
2024-04-28 15:34:42 +08:00
dangerousEngineeringId: ""
},
textareaLengh: 0,
2024-04-28 18:40:19 +08:00
typeIndex: "",
typeList:[{
id: 1,
name: '施工条件验收'
},{
id: 2,
name: '危大工程验收'
}]
2024-04-28 15:34:42 +08:00
}
},
2024-05-04 16:13:57 +08:00
created() {
this.projectSn = JSON.parse(uni.getStorageSync('projectDetail'))
},
2024-04-28 15:34:42 +08:00
onShow(){
this.statusBarHeight = uni.getStorageSync('systemInfo').statusBarHeight;
},
onLoad(val){
this.formData.dangerousEngineeringId = val.id
2024-05-04 16:13:57 +08:00
this.getEnterpriseInfoList()
2024-04-28 15:34:42 +08:00
},
methods:{
2024-05-04 16:13:57 +08:00
async getEnterpriseInfoList(){
await this.sendRequest({
url:'xmgl/enterpriseInfo/list',
method:'post',
data:{
// engineeringId: this.detailId,
projectSn: this.projectSn,
},
success:res=>{
uni.hideLoading()
console.log("xmgl/xzDangerousEngineeringAcceptance/list",res);
this.enterpriseInfoList = res.result;
}
})
},
2024-04-28 18:40:19 +08:00
checkRadio(val){
this.formData.acceptanceResult = val
},
2024-05-04 16:13:57 +08:00
2024-04-28 15:34:42 +08:00
bindTextAreaBlur(e){
console.log(e)
2024-04-28 18:40:19 +08:00
this.formData.acceptanceDescribe = e.detail.value
2024-04-28 15:34:42 +08:00
},
2024-05-04 16:13:57 +08:00
2024-04-28 15:34:42 +08:00
bindInputBlur(e){
console.log(e)
2024-04-28 18:40:19 +08:00
this.formData.acceptanceRegion = e.detail.value
2024-04-28 15:34:42 +08:00
},
2024-05-04 16:13:57 +08:00
2024-04-28 15:34:42 +08:00
uploadImg() {
var that = this
uni.chooseImage({
count: 5 - that.formData.imgFileList.length,
success(res) {
const tempFilePaths = res.tempFilePaths;
uni.uploadFile({
url: that.url_config + 'upload/image', //仅为示例,非真实的接口地址
filePath: tempFilePaths[0],
name: 'files',
success: (uploadFileRes) => {
let data = {
name: JSON.parse(uploadFileRes.data).data[0].filename,
url: JSON.parse(uploadFileRes.data).data[0].imageUrl
};
that.formData.imgFileList.push(data)
}
});
}
})
},
2024-05-04 16:13:57 +08:00
2024-04-28 15:34:42 +08:00
//删除附件
deleteImg(val, type) {
let that = this;
uni.showModal({
title: '提示',
content: '确定删除该附件吗?',
success: function(res) {
if (res.confirm) {
if (type == 1) {
let fileArr = JSON.parse(JSON.stringify(that.formData.imgFileList));
fileArr.forEach((item, index) => {
if (item.url == val.url) {
fileArr.splice(index, 1)
}
})
that.formData.imgFileList = fileArr;
} else if (type == 2) {
let fileArr = JSON.parse(JSON.stringify(that.videoFileList));
fileArr.forEach((item, index) => {
if (item.url == val.url) {
fileArr.splice(index, 1)
}
})
that.videoFileList = fileArr;
}
} else if (res.cancel) {
console.log('用户点击取消');
}
}
});
},
//预览图片
previewImage(url) {
uni.previewImage({
urls: [url]
})
},
2024-05-04 16:13:57 +08:00
2024-04-28 15:34:42 +08:00
bindLength(e){
// console.log(e)
this.textareaLengh = e.detail.value.split('').length
},
2024-05-04 16:13:57 +08:00
2024-04-28 15:34:42 +08:00
saveForm(){
2024-04-28 18:40:19 +08:00
// console.log(this.formData)
2024-04-28 15:34:42 +08:00
let data = {
2024-04-28 18:40:19 +08:00
acceptanceDescribe: this.formData.acceptanceDescribe,
acceptanceRegion: this.formData.acceptanceRegion,
acceptanceResult: this.formData.acceptanceResult,
acceptanceType: this.formData.acceptanceType,
dangerousEngineeringId: this.formData.dangerousEngineeringId
2024-04-28 15:34:42 +08:00
}
2024-04-28 18:40:19 +08:00
data.createUser = JSON.parse(uni.getStorageSync('userInfo')).userId;
2024-04-28 15:34:42 +08:00
let arr = []
this.formData.imgFileList.forEach(item=>{
arr.push(item.url)
})
data.imageUrl = arr.join(',')
2024-04-28 18:40:19 +08:00
if(data.acceptanceType == ""){
uni.showToast({
title: '请选择验收类型!',
icon: "none",
duration: 2000
});
return;
}
if(data.acceptanceRegion == ""){
2024-04-28 15:34:42 +08:00
uni.showToast({
title: '请输入验收部位!',
icon: "none",
duration: 2000
});
return;
}
console.log(data)
this.sendRequest({
2024-04-28 18:40:19 +08:00
url:'xmgl/dangerousEngineeringAcceptanceCheck/add',
2024-04-28 15:34:42 +08:00
method:'post',
data: data,
success:res=>{
uni.hideLoading()
if(res.code==200){
uni.showToast({
title:'保存成功'
})
uni.navigateBack({})
}
console.log(res)
}
})
2024-04-28 18:40:19 +08:00
},
2024-05-04 16:13:57 +08:00
2024-04-28 18:40:19 +08:00
bindPickerChange(e){
this.typeIndex = e.target.value
this.formData.acceptanceType = this.typeList[e.target.value].id
2024-04-28 15:34:42 +08:00
}
}
}
</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;
2024-04-28 18:40:19 +08:00
align-items: center;
2024-04-28 15:34:42 +08:00
background: #fff;
.form-lable{
white-space: nowrap;
.tag{
color: #DD524D;
}
}
.from-input{
text-align: right;
}
2024-04-28 18:40:19 +08:00
.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: 14px;
background: #EEEEEE;
text-align: center;
width: 156rpx;
padding: 12rpx 0;
}
.active-radio{
background: #2b8df3;
color: #fff;
}
}
}
2024-04-28 15:34:42 +08:00
}
.txt-length{
color: #888;
text-align: right;
margin-top: 20rpx;
font-size: 14px;
}
.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;
}
}
}
2024-04-28 18:40:19 +08:00
.a-none{
align-items: initial;
}
2024-04-28 15:34:42 +08:00
}
}
</style>