538 lines
14 KiB
Vue
538 lines
14 KiB
Vue
<template>
|
|
<view class="addPlan">
|
|
<view class="fixedheader">
|
|
<headers :themeType="true" :showBack="true">
|
|
<view class="headerName">
|
|
{{title}}
|
|
</view>
|
|
</headers>
|
|
</view>
|
|
|
|
<view :style="{ 'padding-top': ((statusBarHeight * 2) + 45) * 1.5 + 'rpx' }">
|
|
<view class="plan-form">
|
|
<view class="form-item b-bottom">
|
|
<view class="form-lable"><text class="tag">*</text>检查时间</view>
|
|
<dateTimePiccker :placeholder="'请选择'" :start="startTime" fields="second"
|
|
:default-value="formData.trainBeginTime" @change="bindPickerChange($event,'startTime')"
|
|
class="dateTimePiccker">
|
|
</dateTimePiccker>
|
|
</view>
|
|
<view class="form-item b-bottom">
|
|
<view class="form-lable"><text class="tag">*</text>检查人</view>
|
|
<!-- <picker mode="selector" :range="workerListOptions" range-key="workerName"
|
|
@change="handleChangeFrequency(1, $event)" filterable>
|
|
<view class="picker">
|
|
<view class="" style="color: #c0c4cc; font-size: 28rpx;" v-if="!formData.inspector">
|
|
请选择
|
|
</view>
|
|
<view style="flex-shrink: 0; white-space: nowrap;" v-else>
|
|
{{formData.inspectorName}}
|
|
<u-icon style="margin-left: 8rpx;" name="arrow-right"></u-icon>
|
|
</view>
|
|
</view>
|
|
</picker> -->
|
|
<search-picker :searchFlag="true" :defaultList="[formData.inspector]" :value="formData.inspectorName"
|
|
:columns="workerListOptions" :filter="{label: 'workerName', value: 'id'}" input-align="left"
|
|
@confirm="handleChangeFrequency(1, $event)"></search-picker>
|
|
</view>
|
|
<view class="form-item b-bottom">
|
|
<view class="form-lable"><text class="tag">*</text>检查单位</view>
|
|
<!-- <picker mode="selector" :range="enterpriseList" range-key="enterpriseName"
|
|
@change="handleChangeFrequency(2, $event)" filterable>
|
|
<view class="picker">
|
|
<view class="" style="color: #c0c4cc; font-size: 28rpx;" v-if="!formData.inspectionUnit">
|
|
请选择
|
|
</view>
|
|
<view style="flex-shrink: 0; white-space: nowrap;" v-else>
|
|
{{formData.inspectionUnitName}}
|
|
<u-icon style="margin-left: 8rpx;" name="arrow-right"></u-icon>
|
|
</view>
|
|
</view>
|
|
</picker> -->
|
|
<search-picker :searchFlag="true" :defaultList="[formData.inspectionUnit]" :value="formData.inspectionUnitName"
|
|
:columns="enterpriseList" :filter="{label: 'enterpriseName', value: 'id'}" input-align="left"
|
|
@confirm="handleChangeFrequency(2, $event)"></search-picker>
|
|
</view>
|
|
|
|
|
|
<view class="form-item b-bottom">
|
|
<view class="form-lable"><text class="tag">*</text>检查内容</view>
|
|
<input class="from-input" type="text" :value="formData.sideStationAddr" @blur="bindInputBlur"
|
|
placeholder="请输入检查内容" />
|
|
</view>
|
|
<view class="form-item b-bottom">
|
|
<view class="form-lable"><text class="tag">*</text>检查结果</view>
|
|
<picker mode="selector" :range="inspectionResultList" range-key="inspectionResultName"
|
|
@change="handleChangeFrequency(3, $event)" filterable>
|
|
<view class="picker">
|
|
<view class="" style="color: #c0c4cc; font-size: 28rpx;" v-if="!formData.inspectionResult">
|
|
请选择
|
|
</view>
|
|
<view style="flex-shrink: 0; white-space: nowrap;" v-else>
|
|
{{formData.inspectionResultName}}
|
|
<u-icon style="margin-left: 8rpx;" name="arrow-right"></u-icon>
|
|
</view>
|
|
</view>
|
|
</picker>
|
|
</view>
|
|
<!-- <view class="form-item f-column b-bottom">
|
|
<view class="form-lable"><text class="tag">*</text>旁站记录</view>
|
|
<textarea class="form-textarea" @input="bindLength" @blur="bindTextAreaBlur" maxlength="50"
|
|
:value="formData.buildSituation" placeholder="请输入旁站记录" />
|
|
<view class="txt-length">{{textareaLengh}}/50</view>
|
|
</view> -->
|
|
<view class="form-item f-column">
|
|
<view class="form-lable"><text class="tag">*</text>附件</view>
|
|
<view class="uni-form-input imgBox_wrap">
|
|
<view class="addImgBox" @click="uploadImg" v-show="formData.imgFileList.length == 0">
|
|
<image src="/static/safeMange/upload_image.png" class="icon-add" color="#F56C6C"></image>
|
|
</view>
|
|
<view class="imgBox" v-show="formData.imgFileList.length>0"
|
|
v-for="(item,index) in formData.imgFileList" :key="index">
|
|
<image :src="url_config+'image/'+item.url" class="img"
|
|
@click="previewImage(url_config+'image/'+item.url)"></image>
|
|
<view @click="deleteImg(item,1)" class="deleteImg">
|
|
<image src="/static/safeMange/close_icon.png"></image>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
|
|
</view>
|
|
</view>
|
|
<view class="save-btn" @click="saveForm">保存</view>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import dateTimePiccker from '@/components/dateTimePicker/index.vue'
|
|
export default {
|
|
components: {
|
|
dateTimePiccker
|
|
|
|
},
|
|
data() {
|
|
return {
|
|
startTime: this.getDate({
|
|
format: true,
|
|
}),
|
|
startTime2: this.getDate({
|
|
format: true,
|
|
}),
|
|
statusBarHeight: 0,
|
|
title: "新增安全检查",
|
|
formData: {
|
|
sideStationAddr: "",
|
|
buildSituation: "",
|
|
imgFileList: [],
|
|
dangerousEngineeringId: "",
|
|
trainBeginTime: "",
|
|
trainEndTime: "",
|
|
inspector: "",
|
|
inspectorName: "",
|
|
inspectionUnit: "",
|
|
inspectionUnitName: "",
|
|
inspectionResult: "",
|
|
inspectionResultName: "",
|
|
},
|
|
textareaLengh: 0,
|
|
workerListOptions: [],
|
|
enterpriseList: [],
|
|
inspectionResultList: [{
|
|
id: 1,
|
|
inspectionResultName: "合格",
|
|
}, {
|
|
id: 2,
|
|
inspectionResultName: "不合格",
|
|
}],
|
|
}
|
|
},
|
|
onShow() {
|
|
this.statusBarHeight = uni.getStorageSync('systemInfo').statusBarHeight;
|
|
this.getSelectWorkerInfoList();
|
|
this.getProjectEnterpriseList();
|
|
},
|
|
onLoad(val) {
|
|
this.formData.dangerousEngineeringId = val.id
|
|
},
|
|
methods: {
|
|
// 切换检查频次
|
|
handleChangeFrequency(type, e) {
|
|
console.info(type, e, 'eee')
|
|
// this.form.frequencyType = e.detail.value + 1;
|
|
if (type == 1) {
|
|
|
|
this.formData.inspectorName = e.workerName;
|
|
this.formData.inspector = e.id;
|
|
console.log(this.formData.inspectorName)
|
|
} else if (type == 2) {
|
|
this.formData.inspectionUnitName = e.enterpriseName;
|
|
this.formData.inspectionUnit = e.id;
|
|
|
|
} else if (type == 3) {
|
|
this.formData.inspectionResultName = this.inspectionResultList[e.detail.value].inspectionResultName;
|
|
this.formData.inspectionResult = this.inspectionResultList[e.detail.value].id;
|
|
|
|
}
|
|
},
|
|
bindTextAreaBlur(e) {
|
|
console.log(e)
|
|
this.formData.buildSituation = e.detail.value
|
|
},
|
|
bindInputBlur(e) {
|
|
console.log(e)
|
|
this.formData.sideStationAddr = e.detail.value
|
|
},
|
|
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)
|
|
}
|
|
});
|
|
}
|
|
})
|
|
},
|
|
//删除附件
|
|
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]
|
|
})
|
|
},
|
|
bindLength(e) {
|
|
// console.log(e)
|
|
this.textareaLengh = e.detail.value.split('').length
|
|
},
|
|
saveForm() {
|
|
console.log(this.formData)
|
|
// if(!this.formData.trainBeginTime){
|
|
// uni.showToast({
|
|
// icon: 'none',
|
|
// title: '请选择开始时间',
|
|
// duration: 2000
|
|
// })
|
|
// return
|
|
// }
|
|
// if(!this.formData.trainEndTime){
|
|
// uni.showToast({
|
|
// icon: 'none',
|
|
// title: '请选择结束时间',
|
|
// duration: 2000
|
|
// })
|
|
// return
|
|
// }
|
|
// if (!this.formData.sideStationAddr) {
|
|
// uni.showToast({
|
|
// icon: 'none',
|
|
// title: '请输入施工部位',
|
|
// duration: 2000
|
|
// })
|
|
// return
|
|
// }
|
|
// if (!this.formData.buildSituation) {
|
|
// uni.showToast({
|
|
// icon: 'none',
|
|
// title: '请输入旁站记录',
|
|
// duration: 2000
|
|
// })
|
|
// return
|
|
// }
|
|
// if (!this.formData.imgFileList.length > 0) {
|
|
// uni.showToast({
|
|
// icon: 'none',
|
|
// title: '请上传图片',
|
|
// duration: 2000
|
|
// })
|
|
// return
|
|
// }
|
|
let data = {
|
|
inspectionTime: this.formData.trainBeginTime,
|
|
inspector: this.formData.inspector,
|
|
inspectionContent: this.formData.sideStationAddr,
|
|
inspectionUnit: this.formData.inspectionUnit,
|
|
inspectionResult: this.formData.inspectionResult,
|
|
projectSn: JSON.parse(uni.getStorageSync('projectDetail')).projectSn,
|
|
constructionEquipmentToolId: this.formData.dangerousEngineeringId,
|
|
attachment: JSON.stringify(this.formData.imgFileList),
|
|
}
|
|
console.log(data)
|
|
this.sendRequest({
|
|
url: 'xmgl/constructionEquipmentToolCheck/add',
|
|
method: 'post',
|
|
data: data,
|
|
success: res => {
|
|
uni.hideLoading()
|
|
if (res.code == 200) {
|
|
uni.showToast({
|
|
title: '保存成功'
|
|
})
|
|
uni.navigateBack({})
|
|
}
|
|
console.log(res)
|
|
}
|
|
})
|
|
},
|
|
getSelectWorkerInfoList() {
|
|
this.sendRequest({
|
|
url: 'xmgl/workerInfo/selectWorkerInfoList',
|
|
method: 'post',
|
|
data: {
|
|
projectSn: JSON.parse(uni.getStorageSync('projectDetail')).projectSn,
|
|
},
|
|
success: res => {
|
|
uni.hideLoading()
|
|
if (res.code == 200) {
|
|
this.workerListOptions = res.result.records;
|
|
}
|
|
console.log(res)
|
|
}
|
|
})
|
|
},
|
|
getProjectEnterpriseList() {
|
|
this.sendRequest({
|
|
url: 'xmgl/projectEnterprise/list',
|
|
method: 'post',
|
|
data: {
|
|
pageNo: 1,
|
|
pageSize: -1,
|
|
projectSn: JSON.parse(uni.getStorageSync('projectDetail')).projectSn,
|
|
},
|
|
success: res => {
|
|
uni.hideLoading()
|
|
if (res.code == 200) {
|
|
this.enterpriseList = res.result.records;
|
|
}
|
|
console.log(res)
|
|
}
|
|
})
|
|
},
|
|
//下拉选择回显
|
|
bindPickerChange(e, type) {
|
|
console.log(e)
|
|
if (!e) return;
|
|
//type ==1 问题等级;2紧急情况;3检查人;4 检查时间;5整改时限; 6整改人; 7复查人; 8核验人;
|
|
if (type == 'startTime') {
|
|
this.formData.trainBeginTime = e.f3;
|
|
} else if (type == 'endTime') {
|
|
this.formData.trainEndTime = e.f3;
|
|
}
|
|
|
|
},
|
|
getDate(type) {
|
|
const date = new Date();
|
|
let year = date.getFullYear();
|
|
let month = date.getMonth() + 1;
|
|
let day = date.getDate();
|
|
if (type === 'start') {
|
|
year = year;
|
|
} else if (type === 'end') {
|
|
// year = year + 2;
|
|
}
|
|
month = month > 9 ? month : '0' + month;
|
|
day = day > 9 ? day : '0' + day;
|
|
return `${year}-${month}-${day}`;
|
|
},
|
|
}
|
|
}
|
|
</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;
|
|
background: #fff;
|
|
|
|
.form-lable {
|
|
white-space: nowrap;
|
|
|
|
.tag {
|
|
color: #DD524D;
|
|
}
|
|
}
|
|
|
|
.from-input {
|
|
text-align: right;
|
|
font-size: 28rpx;
|
|
|
|
:deep(.uni-input-placeholder) {
|
|
font-size: 28rpx;
|
|
}
|
|
}
|
|
}
|
|
|
|
.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;
|
|
}
|
|
}
|
|
|
|
:deep(.uni-textarea-placeholder) {
|
|
font-size: 28rpx;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
</style> |