<template>
|
<!-- 填写监理日志 -->
|
<div class="container paddingB_form" >
|
<NavBar customerTitle="填写监理日志" />
|
|
<div class="main DetailsMaintainer" ref="keyboardControl">
|
<div class="main-header">
|
<div class="marginT_10 item">
|
<div class="item-title">项目名称:{{supervisorLog.projectName}}</div>
|
<div class="item-desc">项目编号:{{supervisorLog.projectCode}}</div>
|
|
<div class="marginT_16 item-title">创建人</div>
|
<div class="item-desc">{{supervisorLog.creator}}</div>
|
</div>
|
</div>
|
|
<div class="marginT_16 bgc-fff">
|
<van-cell title="接收人" is-link :value="notifierNameDeptName || '请选择'" @click="copyHumanPickershow=true"/>
|
</div>
|
|
<van-cell-group title="日志内容">
|
<van-field label="天气"
|
class="dynamic text-right"
|
v-model="supervisorLog.meteorological"
|
placeholder="请输入"
|
/>
|
</van-cell-group>
|
|
<!-- <div class="marginT_10 bgc-fff">
|
<van-field label="监理方人员动态"
|
class="dynamic text-right"
|
v-model="supervisorLog.supervisorInformationDynamics"
|
placeholder="请输入"
|
/>
|
</div>
|
|
<div class="marginT_10 bgc-fff">
|
<van-field label="施工方人员动态"
|
class="dynamic text-right"
|
v-model="supervisorLog.supervisorPartyDynamics"
|
placeholder="请输入"
|
/>
|
</div> -->
|
|
<div class="marginT_10 bgc-fff input_padding_spec">
|
<van-cell :border="false" title="监理方人员动态" label-class="input_padding">
|
<!-- <template #label>
|
<van-field
|
v-model="supervisorLog.supervisorInformationDynamics"
|
rows="2"
|
autosize
|
:readonly="statusReadlony"
|
type="textarea"
|
maxlength="200"
|
placeholder="请输入(少于200字)"
|
show-word-limit
|
@focus="$fieldFocusEventFn"
|
@blur="$fieldBlurEventFn"
|
/>
|
</template> -->
|
</van-cell>
|
<div id="summernote1" v-model="supervisorLog.supervisorInformationDynamics"></div>
|
</div>
|
|
<div class="marginT_10 bgc-fff input_padding_spec">
|
<van-cell :border="false" title="施工方人员动态" label-class="input_padding">
|
<!-- <template #label>
|
<van-field
|
v-model="supervisorLog.supervisorPartyDynamics"
|
rows="2"
|
autosize
|
:readonly="statusReadlony"
|
type="textarea"
|
maxlength="200"
|
placeholder="请输入(少于200字)"
|
show-word-limit
|
@focus="$fieldFocusEventFn"
|
@blur="$fieldBlurEventFn"
|
/>
|
</template> -->
|
</van-cell>
|
<div id="summernote2" v-model="supervisorLog.supervisorPartyDynamics"></div>
|
</div>
|
|
<div class="marginT_10 bgc-fff input_padding_spec">
|
<van-cell :border="false" title="材料进场" label-class="input_padding">
|
<!-- <template #label>
|
<van-field
|
v-model="supervisorLog.materialEntry"
|
rows="2"
|
autosize
|
:readonly="statusReadlony"
|
type="textarea"
|
maxlength="200"
|
placeholder="请输入(少于200字)"
|
show-word-limit
|
@focus="$fieldFocusEventFn"
|
@blur="$fieldBlurEventFn"
|
/>
|
</template> -->
|
</van-cell>
|
<div id="summernote3" v-model="supervisorLog.materialEntry"></div>
|
</div>
|
|
<div class="marginT_10 bgc-fff input_padding_spec">
|
<van-cell :border="false" title="取证见证" label-class="input_padding">
|
<!-- <template #label>
|
<van-field
|
v-model="supervisorLog.forensicsWitness"
|
rows="2"
|
autosize
|
:readonly="statusReadlony"
|
type="textarea"
|
maxlength="200"
|
placeholder="请输入(少于200字)"
|
show-word-limit
|
@focus="$fieldFocusEventFn"
|
@blur="$fieldBlurEventFn"
|
/>
|
</template> -->
|
</van-cell>
|
<div id="summernote4" v-model="supervisorLog.forensicsWitness"></div>
|
</div>
|
|
<div class="marginT_10 bgc-fff input_padding_spec">
|
<van-cell :border="false" title="合格情况" label-class="input_padding">
|
<!-- <template #label>
|
<van-field
|
v-model="supervisorLog.forensicsWitness"
|
rows="2"
|
autosize
|
:readonly="statusReadlony"
|
type="textarea"
|
maxlength="200"
|
placeholder="请输入(少于200字)"
|
show-word-limit
|
@focus="$fieldFocusEventFn"
|
@blur="$fieldBlurEventFn"
|
/>
|
</template> -->
|
</van-cell>
|
<div id="summernote5" v-model="supervisorLog.qualification"></div>
|
</div>
|
|
<!-- <div class="marginT_10 bgc-fff input_padding_spec">
|
<van-cell :border="false" title="合格情况" label-class="input_padding">
|
<template #label>
|
<van-field
|
v-model="supervisorLog.qualification"
|
rows="2"
|
autosize
|
:readonly="statusReadlony"
|
type="textarea"
|
maxlength="200"
|
placeholder="请输入(少于200字)"
|
show-word-limit
|
@focus="$fieldFocusEventFn"
|
@blur="$fieldBlurEventFn"
|
/>
|
</template> -->
|
<!-- </van-cell>
|
<div id="summernote5" v-model="supervisorLog.qualification"></div>
|
</div> -->
|
|
<div class="marginT_10 bgc-fff input_padding_spec">
|
<van-cell :border="false" title="施工情况" label-class="input_padding">
|
<!-- <template #label>
|
<van-field
|
v-model="supervisorLog.construction"
|
rows="2"
|
autosize
|
:readonly="statusReadlony"
|
type="textarea"
|
maxlength="800"
|
placeholder="请输入(少于800字)"
|
show-word-limit
|
@focus="$fieldFocusEventFn"
|
@blur="$fieldBlurEventFn"
|
/>
|
</template> -->
|
</van-cell>
|
<div id="summernote6" v-model="supervisorLog.construction"></div>
|
</div>
|
|
<div class="marginT_10 bgc-fff input_padding_spec">
|
<van-cell :border="false" title="监理工作情况" label-class="input_padding">
|
<!-- <template #label>
|
<van-field
|
v-model="supervisorLog.supervision"
|
rows="2"
|
autosize
|
:readonly="statusReadlony"
|
type="textarea"
|
maxlength="300"
|
placeholder="请输入(少于300字)"
|
show-word-limit
|
@focus="$fieldFocusEventFn"
|
@blur="$fieldBlurEventFn"
|
/>
|
</template> -->
|
</van-cell>
|
<div id="summernote7" v-model="supervisorLog.supervision"></div>
|
</div>
|
|
<div class="marginT_10 bgc-fff input_padding_spec">
|
<van-cell :border="false" title="检查问题及处理" label-class="input_padding">
|
<!-- <template #label>
|
<van-field
|
v-model="supervisorLog.problemDeal"
|
rows="2"
|
autosize
|
:readonly="statusReadlony"
|
type="textarea"
|
maxlength="300"
|
placeholder="请输入(少于300字)"
|
show-word-limit
|
@focus="$fieldFocusEventFn"
|
@blur="$fieldBlurEventFn"
|
/>
|
</template> -->
|
</van-cell>
|
<div id="summernote8" v-model="supervisorLog.problemDeal"></div>
|
</div>
|
|
<div class="marginT_10 bgc-fff input_padding_spec">
|
<van-cell :border="false" title="协调内容或其他" label-class="input_padding">
|
<!-- <template #label>
|
<van-field
|
v-model="supervisorLog.coordinateOthers"
|
rows="2"
|
autosize
|
:readonly="statusReadlony"
|
type="textarea"
|
maxlength="300"
|
placeholder="请输入(少于300字)"
|
show-word-limit
|
@focus="$fieldFocusEventFn"
|
@blur="$fieldBlurEventFn"
|
/>
|
</template> -->
|
</van-cell>
|
<div id="summernote9" v-model="supervisorLog.coordinateOthers"></div>
|
</div>
|
|
<div class="marginT_10 bgc-fff">
|
<van-field name="uploader" label="上传图片">
|
<template #input>
|
<UploadImgCustom
|
:ywSid ="supervisorLog.supervisorLogSid+'_supervisorLog'"
|
uploadImgType="supervisorLog"
|
:previewImage="true"
|
:uploader="imgBeforeArr"
|
:disabled="statusReadlony"
|
@uploadImg="getLoadImg"
|
@deleteImg="getLoadImg"
|
/>
|
</template>
|
</van-field>
|
</div>
|
|
</div>
|
|
<div class="bottomSaveBoxHeight" v-if="showBtn">
|
<div class="bottomSaveGroup bgc-fff bottomSaveGroupFixed flex-wrap-center">
|
<span class="btn btn1" @click="submitFn('0')">保存</span>
|
<span class="btn btn2" @click="submitFn('3')">发送</span>
|
</div>
|
</div>
|
|
<AllProjectHuman
|
:show='copyHumanPickershow'
|
titleName="接收人"
|
@checkHuman='copyHumanSelect'
|
@closeCheck="copyHumanPickershow=false"
|
/>
|
</div><!-- container end -->
|
</template>
|
|
<script>
|
import AllProjectHuman from "@/compontent/choosePeople/allProjectHuman"
|
import UploadImgCustom from "@/compontent/common/uploadImgCustom"
|
import { Dialog } from 'vant';
|
export default({
|
name:'QualityForm',
|
components:{
|
AllProjectHuman,
|
UploadImgCustom,
|
[Dialog.Component.name]: Dialog.Component,
|
},
|
data(){
|
return {
|
projectSid:'',
|
supervisorLog:{},
|
supervisorLogComp:{},
|
status:'',
|
supervisorLogSid:'',
|
|
copyHumanPickershow:false,//接收人
|
statusReadlony:false,
|
imgBeforeArr:[],//上传的图片
|
|
showBtn:true,//显示按钮
|
isBack:true,
|
|
notifierNameDeptName:"",//接收人
|
}
|
},
|
created(){
|
this.projectSid=this.$route.query.projectSid
|
this.status=this.$route.query.status
|
this.supervisorLogSid=this.$route.query.supervisorLogSid
|
if(this.status == "add"){
|
this.getData();// 获取天气
|
}else{
|
this.getDetail()
|
}
|
},
|
beforeRouteLeave(to, from, next) {
|
this.changeObj();
|
if(this.isBack){
|
next();
|
}else{
|
setTimeout(()=>{ //用定时器是返回时弹框二次不显示,加定时器就好
|
Dialog.confirm({
|
message: '是否放弃已编辑内容?',
|
}).then(() => {
|
next();//跳转下一个页面
|
}).catch(() => {
|
next(false);//跳转到当前页面
|
this.isBack = true;
|
});
|
|
},200)
|
}
|
},
|
mounted(){
|
let _this = this;
|
if(this.status == "add"){
|
this.getWeath();// 获取天气
|
}
|
|
var newOptions = Object.assign({},this.$summernoteOption,{
|
callbacks: {
|
onFocus: function() {
|
_this.$fieldFocusEventFn();
|
},
|
onBlur: function() {
|
_this.$fieldBlurEventFn();
|
}
|
}
|
})
|
|
var newOptions1 = Object.assign({},this.$summernoteOption,{
|
placeholder:"请输入(少于800字)",
|
callbacks: {
|
onFocus: function() {
|
_this.$fieldFocusEventFn();
|
},
|
onBlur: function() {
|
_this.$fieldBlurEventFn();
|
}
|
}
|
})
|
|
jQuery('#summernote1').summernote(newOptions);
|
jQuery('#summernote2').summernote(newOptions);
|
jQuery('#summernote3').summernote(newOptions);
|
jQuery('#summernote4').summernote(newOptions);
|
jQuery('#summernote5').summernote(newOptions);
|
jQuery('#summernote6').summernote(newOptions1);
|
jQuery('#summernote7').summernote(newOptions);
|
jQuery('#summernote8').summernote(newOptions);
|
jQuery('#summernote9').summernote(newOptions);
|
},
|
methods:{
|
changeObj(){
|
let obj1 = this.supervisorLogComp;
|
let obj2 = this.supervisorLog;
|
for (let val in obj2) {
|
// console.log(val)
|
// console.log(obj1[val] ,"-------", obj2[val])
|
if (obj1[val] != obj2[val]) {
|
this.isBack = false; //有一个改变返回
|
return false;
|
}else { this.isBack = true;}
|
}
|
},
|
getDetail(){
|
let _this = this;
|
_this.service({
|
url:'/app/supervisorLog/supervisorLogInfo',
|
params:{
|
projectSid:this.projectSid,
|
sid:this.supervisorLogSid
|
}
|
}).then(res => {
|
if(res.success && res.data){
|
console.log(106666,res);
|
this.supervisorLog = res.data.supervisorLog;
|
this.supervisorLogComp = JSON.parse(JSON.stringify(this.supervisorLog))
|
|
let attachfiles=res.data.attachfiles||[],attachfilesLen=attachfiles.length;
|
if(attachfilesLen){
|
attachfiles.forEach(item => {
|
item.url=item.attachUrl;
|
})
|
this.imgBeforeArr = attachfiles;
|
}
|
|
jQuery('#summernote1').summernote('code', this.supervisorLog.supervisorInformationDynamics || '')
|
jQuery('#summernote2').summernote('code', this.supervisorLog.supervisorPartyDynamics || '')
|
jQuery('#summernote3').summernote('code', this.supervisorLog.materialEntry || '')
|
jQuery('#summernote4').summernote('code', this.supervisorLog.forensicsWitness || '')
|
jQuery('#summernote5').summernote('code', this.supervisorLog.qualification || '')
|
jQuery('#summernote6').summernote('code', this.supervisorLog.construction || '')
|
jQuery('#summernote7').summernote('code', this.supervisorLog.supervision || '')
|
jQuery('#summernote8').summernote('code', this.supervisorLog.problemDeal || '')
|
jQuery('#summernote9').summernote('code', this.supervisorLog.coordinateOthers || '')
|
|
let toHuman = res.data.supervisorLog.notifierName;
|
if(this.status == "modify"){//新增和修改接收人
|
if(toHuman.search("-") != -1){
|
this.notifierNameDeptName = toHuman.substring(0,toHuman.length-1);
|
}else{
|
this.notifierNameDeptName = toHuman;
|
}
|
}else{
|
this.notifierNameDeptName = null;
|
}
|
}
|
}).catch(err => {
|
console.log(err);
|
})
|
},
|
getData(){
|
let _this = this;
|
_this.service({
|
url:'/app/supervisorLog/supervisorLogInit',
|
params:{
|
projectSid:this.projectSid,
|
supervisorLogSid:this.supervisorLogSid
|
}
|
}).then(res => {
|
if(res.success && res.data){
|
let data = res.data.supervisorLog;
|
for(let key in data){
|
if(data[key] == null){
|
data[key] = "";
|
}
|
}
|
this.supervisorLog = data || {};
|
this.supervisorLogComp = JSON.parse(JSON.stringify(this.supervisorLog))
|
}
|
}).catch(err => {
|
console.log(err);
|
})
|
},
|
getLoadImg(file){ //获取图片
|
this.imgBeforeArr = file;
|
},
|
submitFn(state){
|
let _this = this;
|
if(state == '3'){
|
if(!this.supervisorLog.notifierName){
|
this.$toast('请先填写接收人');
|
return false;
|
}
|
}
|
|
if(this.checkCharacterLength('summernote1') > 300){
|
this.$toast("监理方人员动态超过300字");
|
return false;
|
}else if(this.checkCharacterLength('summernote2') > 300){
|
this.$toast("施工方人员动态超过300字");
|
return false;
|
}else if(this.checkCharacterLength('summernote3') > 300){
|
this.$toast("材料进场超过300字");
|
return false;
|
}else if(this.checkCharacterLength('summernote4') > 300){
|
this.$toast("取证见证超过300字");
|
return false;
|
}else if(this.checkCharacterLength('summernote5') > 300){
|
this.$toast("合格情况超过300字");
|
return false;
|
}else if(this.checkCharacterLength('summernote6') > 800){
|
this.$toast("施工情况超过800字");
|
return false;
|
}else if(this.checkCharacterLength('summernote7') > 300){
|
this.$toast("监理工作情况超过300字");
|
return false;
|
}else if(this.checkCharacterLength('summernote8') > 300){
|
this.$toast("检查问题及处理超过300字");
|
return false;
|
}else if(this.checkCharacterLength('summernote9') > 300){
|
this.$toast("协调内容或其他超过300字");
|
return false;
|
}
|
|
this.supervisorLog.supervisorInformationDynamics = jQuery('#summernote1').summernote('code') || '',
|
this.supervisorLog.supervisorPartyDynamics = jQuery('#summernote2').summernote('code') || '',
|
this.supervisorLog.materialEntry = jQuery('#summernote3').summernote('code') || '',
|
this.supervisorLog.forensicsWitness = jQuery('#summernote4').summernote('code') || '',
|
this.supervisorLog.qualification = jQuery('#summernote5').summernote('code') || '',
|
this.supervisorLog.construction = jQuery('#summernote6').summernote('code') || '',
|
this.supervisorLog.supervision = jQuery('#summernote7').summernote('code') || '',
|
this.supervisorLog.problemDeal = jQuery('#summernote8').summernote('code') || '',
|
this.supervisorLog.coordinateOthers = jQuery('#summernote9').summernote('code') || '',
|
|
_this.service({
|
url:'/app/supervisorLog/saveOrUpdate',
|
params:{
|
model:{
|
supervisorLogSid:this.supervisorLog.supervisorLogSid,//主键
|
projectSid:this.projectSid,
|
notifierName:this.supervisorLog.notifierName,
|
notifierSid:this.supervisorLog.notifierSid,
|
|
meteorological:this.supervisorLog.meteorological,//气象、平均温度
|
supervisorInformationDynamics:this.supervisorLog.supervisorInformationDynamics,// 监理人员动态
|
supervisorPartyDynamics:this.supervisorLog.supervisorPartyDynamics,// 施工方人员动态
|
materialEntry:this.supervisorLog.materialEntry,// 材料进场
|
forensicsWitness:this.supervisorLog.forensicsWitness,// 取证见证
|
qualification:this.supervisorLog.qualification,// 合格情况
|
construction:this.supervisorLog.construction,// 施工情况
|
supervision:this.supervisorLog.supervision,// 监理工作情况
|
problemDeal:this.supervisorLog.problemDeal,// 检查问题及处理
|
coordinateOthers:this.supervisorLog.coordinateOthers,// 协调内容或其他
|
|
},
|
state:state
|
}
|
}).then(res => {
|
console.log(254,state);
|
this.supervisorLogComp = JSON.parse(JSON.stringify(this.supervisorLog));
|
if(res.success){
|
if(state=="0"){
|
this.$toast("保存成功")
|
}else{
|
this.$toast("发送成功")
|
}
|
this.$router.go(-1)
|
}
|
}).catch(err => {
|
console.log(err);
|
})
|
},
|
|
getNoMarkupStr(markupStr) {
|
var noMarkupStr=jQuery("<div>").html(markupStr).text();
|
noMarkupStr=noMarkupStr.replace(/(\r\n|\n|\r)/gm,"");
|
noMarkupStr=noMarkupStr.replace(/^\s+/g,"");
|
noMarkupStr=noMarkupStr.replace(/\s+$/g,"");
|
noMarkupStr=noMarkupStr.replace(/\s+/g," ");
|
return noMarkupStr;
|
},
|
|
checkCharacterLength(id){
|
var markupStr = jQuery('#'+id).summernote('code') || '';
|
return this.getNoMarkupStr(markupStr).length || 0;
|
},
|
|
copyHumanSelect(data){// 接收人的弹出层方法
|
if(!data){
|
this.copyHumanPickershow=false
|
}
|
let humanNameStr='',humanSidStr='',humanDeptName = "";
|
data.forEach((item,index) => {
|
if(index!=0){
|
humanNameStr+=item.humanName?","+item.humanName:'';
|
humanSidStr+=item.humanSid?","+item.humanSid:'';
|
humanDeptName += item.humanName + "-" + item.deptName + ',';
|
}else{
|
humanNameStr+=item.humanName ||'';
|
humanSidStr+=item.humanSid ||'';
|
humanDeptName += item.humanName + "-" + item.deptName + ','|| '';
|
}
|
})
|
this.notifierNameDeptName = humanDeptName.substring(0,humanDeptName.length-1)
|
this.supervisorLog.notifierName = humanDeptName;
|
this.supervisorLog.notifierSid = humanSidStr;
|
},
|
getWeath(){// 获取天气
|
let _this = this;
|
let mapObj = new AMap.Map('container',{
|
zoom: 17
|
});
|
mapObj.plugin('AMap.Geolocation', function () {
|
let geolocation = new AMap.Geolocation({
|
enableHighAccuracy: true,//是否使用高精度定位,默认:true
|
timeout: 10000, //超过10秒后停止定位,默认:无穷大
|
maximumAge: 0, //定位结果缓存0毫秒,默认:0
|
convert: true, //自动偏移坐标,偏移后的坐标为高德坐标,默认:true
|
showButton: true, //显示定位按钮,默认:true
|
buttonPosition: 'LB', //定位按钮停靠位置,默认:'LB',左下角
|
buttonOffset: new AMap.Pixel(6, 10),//定位按钮与设置的停靠位置的偏移量,默认:Pixel(10, 20)
|
showMarker: true, //定位成功后在定位到的位置显示点标记,默认:true
|
showCircle: true, //定位成功后用圆圈表示定位精度范围,默认:true
|
panToLocation: true, //定位成功后将定位到的位置作为地图中心点,默认:true
|
zoomToAccuracy:true //定位成功后调整地图视野范围使定位位置及精度范围视野内可见,默认:false
|
});
|
geolocation.getCurrentPosition();
|
AMap.event.addListener(geolocation, 'complete', function(res){
|
if(res.formattedAddress){
|
_this.city = res.addressComponent.city || res.addressComponent.province;
|
|
AMap.plugin('AMap.Geocoder', function() {
|
var geocoder = new AMap.Geocoder();
|
var lnglat = [res.position.lng,res.position.lat];//南京
|
|
geocoder.getAddress(lnglat, function(status, result) {
|
if (status === 'complete' && result.info === 'OK') {
|
AMap.plugin('AMap.Weather', function() {//加载天气查询插件
|
var weather = new AMap.Weather();//创建天气查询实例
|
//执行实时天气信息查询
|
weather.getLive(result.regeocode.addressComponent.adcode, function(err, data) {
|
if(data){
|
// _this.weather = data.weather;// 天气
|
// _this.temperature = data.temperature + '℃';// 温度
|
_this.supervisorLog.meteorological=data.weather+' '+data.temperature + '℃'
|
}
|
});
|
});
|
}
|
})
|
})
|
}
|
});//返回定位信息
|
AMap.event.addListener(geolocation, 'error', function(err){
|
_this.$toast( `“未获得您的地理位置,请前往“设置”授权使用”`);
|
});//返回定位出错信息
|
});
|
},
|
},
|
})
|
</script>
|
|
<style lang="scss">
|
.main{
|
padding: 10px 0 0 0;
|
.main-header{
|
padding:0 12px 10px 12px;
|
.item{
|
padding:14px 24px;
|
background-color: #fff;
|
border-radius: 12px;
|
box-shadow: 0px -1px 0px 0px #F4F4F4;
|
.item-title{
|
min-height: 22px;
|
line-height: 22px;
|
font-size: 16px;
|
color:#333;
|
}
|
.item-desc{
|
min-height: 22px;
|
line-height: 22px;
|
font-size: 14px;
|
color:#8c8c8c;
|
}
|
.item-descImg{
|
float: left;
|
max-width: 46px;
|
max-height: 46px;
|
margin:0 20px 14px 0;
|
}
|
}
|
}
|
|
.dynamic{
|
.van-field__label{
|
width:7.2em!important;
|
}
|
}
|
.input_padding .van-cell{
|
padding: 0;
|
}
|
}
|
</style>
|