526 lines
13 KiB
Vue
526 lines
13 KiB
Vue
<template>
|
|
<view>
|
|
<cu-custom bgColor="bg-gradual-blueness" :isBack="true">
|
|
<block slot="backText">返回</block>
|
|
<block slot="content">隐患整改</block>
|
|
</cu-custom>
|
|
<scroll-view scroll-y>
|
|
<view class="wui-form-list">
|
|
<view class="wui-form-title">
|
|
<text>{{pd.HIDDENDESCR}}</text>
|
|
</view>
|
|
<view class="cu-form-group">
|
|
<view class="title">
|
|
<text>隐患部位</text>
|
|
</view>
|
|
<view>
|
|
<text>{{pd.HIDDENPART}}</text>
|
|
</view>
|
|
</view>
|
|
<view class="cu-form-group">
|
|
<view class="title">
|
|
<text>隐患级别</text>
|
|
</view>
|
|
<view>
|
|
<text>{{pd.HIDDENLEVELNAME}}</text>
|
|
</view>
|
|
</view>
|
|
<view class="cu-form-group">
|
|
<view class="title">
|
|
<text>检查人</text>
|
|
</view>
|
|
<view>
|
|
<text>{{pd.DISCOVERER_NAME}}</text>
|
|
</view>
|
|
</view>
|
|
<view class="cu-form-group">
|
|
<view class="title">
|
|
<text>发现时间</text>
|
|
</view>
|
|
<view>
|
|
<text>{{pd.DISCOVER_TIME}}</text>
|
|
</view>
|
|
</view>
|
|
<view class="cu-form-group">
|
|
<view class="title">
|
|
<text>整改截止时间</text>
|
|
</view>
|
|
<view>
|
|
<text>{{pd.RECTIFY_DEADLINE}}</text>
|
|
</view>
|
|
</view>
|
|
<view class="cu-form-group">
|
|
<view class="title">
|
|
<text>隐患处置</text>
|
|
</view>
|
|
<view>
|
|
<text>{{pd.DISPOSE}}</text>
|
|
</view>
|
|
</view>
|
|
<view class="cu-form-group">
|
|
<view class="title">
|
|
<text>隐患状态</text>
|
|
</view>
|
|
<view>
|
|
<text v-if="pd.STATE=='1'">待整改</text>
|
|
<text v-else-if="pd.STATE=='2'">待复查</text>
|
|
<text v-else-if="pd.STATE=='3'">已复查</text>
|
|
<text v-else></text>
|
|
</view>
|
|
</view>
|
|
<view v-if="pd.RECTIFICATIONTYPE=='2'" class="cu-form-group bb-default">
|
|
<view class="title">
|
|
<text>整改期限</text>
|
|
</view>
|
|
<view>
|
|
<text>{{pd.RECTIFICATIONDEADLINE}}</text>
|
|
</view>
|
|
</view>
|
|
<view class="cu-form-textarea">
|
|
<view class="title">
|
|
<text>隐患照片</text>
|
|
</view>
|
|
<view class="cu-form-p">
|
|
<scroll-view scroll-x class="bg-white nav" scroll-with-animation>
|
|
<view class="cu-item" v-for="(item,index) in pd.hImgs" v-bind:key="index">
|
|
<view class="imgs">
|
|
<image :src="baseImgPath+item.FILEPATH" :data-index="index" @click="ViewShowImage"
|
|
mode=""></image>
|
|
</view>
|
|
</view>
|
|
</scroll-view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<view class="wui-form-list">
|
|
<view class="wui-sub-title">
|
|
<text>隐患整改</text>
|
|
</view>
|
|
<view class="cu-form-group">
|
|
<view class="title">整改人</view>
|
|
<input name="input" v-model="form.RECTIFYER_NAME" placeholder="请输入整改人"></input>
|
|
</view>
|
|
|
|
<view class="cu-form-textarea">
|
|
<view class="cu-form-title">整改描述</view>
|
|
<textarea maxlength="-1" v-model="form.RECTIFY_DESCR" placeholder="请对隐患进行详细描述(必填项)"></textarea>
|
|
</view>
|
|
<!-- <view class="cu-form-group bb-default">
|
|
<view class="title">整改时间</view>
|
|
<picker mode="date">
|
|
<view class="picker">
|
|
{{form.RECTIFY_TIME==''?'请选择':form.RECTIFY_TIME}}
|
|
</view>
|
|
</picker>
|
|
</view> -->
|
|
<view class="cu-form-group ">
|
|
<view class="title">整改时间</view>
|
|
<ruiDatePicker fields="minute" :value="form.RECTIFY_TIME?form.RECTIFY_TIME:''"
|
|
@change="changeStartDate"></ruiDatePicker>
|
|
</view>
|
|
<view class="cu-bar bg-white">
|
|
<view class="action" style="font-size: 28upx; font-weight: bold; color: #000;">
|
|
整改图片
|
|
</view>
|
|
<view class="action">
|
|
{{imgList.length}}/4
|
|
</view>
|
|
</view>
|
|
<view class="cu-form-group">
|
|
<view class="grid col-4 grid-square flex-sub">
|
|
<view class="bg-img" v-for="(item,index) in imgList" :key="index" @tap="ViewImage"
|
|
:data-url="imgList[index]">
|
|
<image :src="imgList[index]" mode="aspectFill"></image>
|
|
<view class="cu-tag bg-red" @tap.stop="DelImg" :data-index="index">
|
|
<text class='cuIcon-close'></text>
|
|
</view>
|
|
</view>
|
|
<view class="solids" @tap="ChooseImage" v-if="imgList.length<4">
|
|
<text class='cuIcon-cameraadd'></text>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<view class="padding flex flex-direction">
|
|
<button class="cu-btn bg-green margin-tb-sm lg" @click="$noMultipleClicks(goSubmit)">提 交</button>
|
|
</view>
|
|
<view class="cu-tabbar-height"></view>
|
|
</scroll-view>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import {
|
|
basePath,
|
|
loginUserId,
|
|
loginSession,
|
|
baseImgPath,
|
|
corpinfoId,
|
|
loginUser
|
|
} from '@/common/tool.js';
|
|
|
|
import ruiDatePicker from '@/components/rattenking-dtpicker/rattenking-dtpicker.vue';
|
|
export default {
|
|
components: {
|
|
ruiDatePicker
|
|
},
|
|
data() {
|
|
return {
|
|
noClick: true,
|
|
date: '',
|
|
RECTIFICATIONTIME: '',
|
|
CHECK_TIME: '',
|
|
imgList: [],
|
|
id: '',
|
|
pd: [],
|
|
hs: [],
|
|
files: [],
|
|
files2: [],
|
|
files3: [],
|
|
files4: [],
|
|
CHECKDESCR: '',
|
|
basePath: basePath,
|
|
baseImgPath: baseImgPath,
|
|
ISQUALIFIED: '1',
|
|
check: [],
|
|
form: {}
|
|
|
|
}
|
|
},
|
|
onLoad(e) {
|
|
this.id = e.id;
|
|
// let now = new Date();
|
|
// this.date = formatDate(now, 'yyyy-MM-dd');
|
|
this.getData();
|
|
loginSession();
|
|
},
|
|
// filters: {
|
|
// formatDate(time) {
|
|
// time = time * 1
|
|
// let date = new Date(time)
|
|
// return formatDate(date, 'yyyy-MM-dd hh:mm')
|
|
// }
|
|
// },
|
|
methods: {
|
|
getData() {
|
|
var _this = this;
|
|
uni.showLoading({
|
|
title: '请稍候'
|
|
})
|
|
uni.request({
|
|
url: basePath + '/app/superviseinspecthidden/goEdit',
|
|
method: 'POST',
|
|
dataType: 'json',
|
|
header: {
|
|
'Content-type': 'application/x-www-form-urlencoded'
|
|
},
|
|
data: {
|
|
SUPERVISE_INSPECT_HIDDEN_ID: _this.id,
|
|
},
|
|
success: (res) => {
|
|
console.info(res);
|
|
if ("success" == res.data.result) {
|
|
uni.hideLoading();
|
|
_this.pd = res.data.pd; //参数map
|
|
// _this.hs = res.data.hs; //参数map
|
|
// _this.files = res.data.hImgs;
|
|
// _this.files2 = res.data.rImgs;
|
|
// _this.files3 = res.data.cImgs;
|
|
// _this.files4 = res.data.sImgs;
|
|
} else if ("exception" == data.result) {
|
|
uni.showToast({
|
|
title: '错误',
|
|
duration: 2000
|
|
});
|
|
}
|
|
}
|
|
});
|
|
},
|
|
//图片上传
|
|
ChooseImage() {
|
|
var _this = this;
|
|
uni.chooseImage({
|
|
count: 4, //默认9
|
|
sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
|
|
sourceType: ['camera', 'album'], //从相册选择
|
|
success: (res) => {
|
|
if (this.imgList.length != 0) {
|
|
this.imgList = this.imgList.concat(res.tempFilePaths)
|
|
} else {
|
|
this.imgList = res.tempFilePaths
|
|
}
|
|
}
|
|
});
|
|
},
|
|
ViewImage(e) {
|
|
uni.previewImage({
|
|
urls: this.imgList,
|
|
current: e.currentTarget.dataset.url
|
|
});
|
|
},
|
|
DelImg(e) {
|
|
uni.showModal({
|
|
title: '双控平台',
|
|
content: '确定要删除这张图片吗?',
|
|
cancelColor: "#000000",
|
|
cancelText: '取消',
|
|
confirmText: '确定',
|
|
success: res => {
|
|
if (res.confirm) {
|
|
this.imgList.splice(e.currentTarget.dataset.index, 1)
|
|
}
|
|
}
|
|
})
|
|
},
|
|
textareaAInput(e) {
|
|
this.CHECKDESCR = e.detail.value
|
|
},
|
|
changeStartDate(e) {
|
|
this.form.RECTIFY_TIME = e
|
|
this.$forceUpdate(); //强制刷新
|
|
},
|
|
goSubmit() {
|
|
var _this = this;
|
|
if (!_this.form.RECTIFYER_NAME) {
|
|
uni.showToast({
|
|
icon: 'none',
|
|
title: '请填整改人',
|
|
duration: 1500
|
|
});
|
|
return;
|
|
}
|
|
if (!_this.form.RECTIFY_DESCR) {
|
|
uni.showToast({
|
|
icon: 'none',
|
|
title: '请填整改描述',
|
|
duration: 1500
|
|
});
|
|
return;
|
|
}
|
|
if (!_this.form.RECTIFY_TIME) {
|
|
uni.showToast({
|
|
icon: 'none',
|
|
title: '请填整改时间',
|
|
duration: 1500
|
|
});
|
|
return;
|
|
}
|
|
if (_this.imgList.length <= 0) {
|
|
uni.showToast({
|
|
icon: 'none',
|
|
title: '请上传整改照片',
|
|
duration: 1500
|
|
});
|
|
return;
|
|
}
|
|
|
|
uni.showLoading({
|
|
title: '上传中'
|
|
})
|
|
console.log(_this.imgList)
|
|
var imgsListUrl = []
|
|
for (var i = 0; i < _this.imgList.length; i++) {
|
|
var img = {
|
|
'uri': _this.imgList[i],
|
|
'name':'file' + (i + 1)
|
|
}
|
|
imgsListUrl.push(img)
|
|
}
|
|
console.log(imgsListUrl)
|
|
uni.uploadFile({
|
|
url: basePath + '/app/superviseinspecthidden/rectify',
|
|
files: imgsListUrl,
|
|
|
|
formData: {
|
|
SUPERVISE_INSPECT_HIDDEN_ID: _this.id,
|
|
RECTIFYER_NAME: _this.form.RECTIFYER_NAME,
|
|
RECTIFY_TIME: _this.form.RECTIFY_TIME,
|
|
RECTIFY_DESCR: _this.form.RECTIFY_DESCR,
|
|
OPERATOR: loginUser.NAME,
|
|
CREATOR: loginUser.NAME,
|
|
CORPINFO_ID: loginUser.CORPINFO_ID
|
|
},
|
|
success: (res) => {
|
|
uni.showToast({
|
|
icon: 'none',
|
|
title: '提交成功',
|
|
duration: 1500
|
|
});
|
|
var pages = getCurrentPages(); // 获取当前页面栈
|
|
var prePage = pages[pages.length - 2]; // 上一个页面
|
|
prePage.$vm.initflag = true; // A 页面 init方法 为true
|
|
uni.navigateBack({});
|
|
uni.hideLoading();
|
|
},
|
|
fail: (err) => {
|
|
uni.hideLoading();
|
|
console.log('uploadImage fail', err);
|
|
uni.showModal({
|
|
content: err.errMsg,
|
|
showCancel: false
|
|
});
|
|
}
|
|
})
|
|
|
|
// new Promise((resolve, reject) => {
|
|
// _this.submit().then(() => {
|
|
// resolve();
|
|
// })
|
|
// }).then(() => {
|
|
// var i = 0;
|
|
// _this.uploadImg(_this.imgList, i).then(() => {
|
|
// resolve();
|
|
// })
|
|
// }).then(() => {
|
|
// uni.showToast({
|
|
// icon: 'none',
|
|
// title: '提交成功',
|
|
// duration: 1500
|
|
// });
|
|
// setTimeout(function() {
|
|
// var pages = getCurrentPages(); // 获取当前页面栈
|
|
// var prePage = pages[pages.length - 2]; // 上一个页面
|
|
// prePage.$vm.initflag = true; // A 页面 init方法 为true
|
|
// uni.navigateBack({});
|
|
// uni.hideLoading();
|
|
// }, 1500);
|
|
// })
|
|
|
|
},
|
|
uploadImg(tempFilePaths, i) {
|
|
return new Promise((resolve, reject) => {
|
|
var _this = this;
|
|
if (tempFilePaths.length == 0) {
|
|
resolve();
|
|
}
|
|
uni.showLoading({
|
|
title: '上传中'
|
|
})
|
|
uni.uploadFile({
|
|
url: basePath + '/app/imgfiles/add',
|
|
filePath: tempFilePaths[i],
|
|
name: 'FFILE',
|
|
|
|
formData: {
|
|
'FOREIGN_KEY': _this.check.HIDDENCHECK_ID,
|
|
'TYPE': '5',
|
|
'CORPINFO_ID': corpinfoId
|
|
},
|
|
success: (res) => {
|
|
i++;
|
|
if (tempFilePaths.length > i) {
|
|
_this.uploadImg(tempFilePaths, i);
|
|
} else {
|
|
uni.hideLoading();
|
|
resolve();
|
|
}
|
|
},
|
|
fail: (err) => {
|
|
uni.hideLoading();
|
|
console.log('uploadImage fail', err);
|
|
uni.showModal({
|
|
content: err.errMsg,
|
|
showCancel: false
|
|
});
|
|
}
|
|
})
|
|
})
|
|
},
|
|
submit() {
|
|
return new Promise((resolve, reject) => {
|
|
var _this = this;
|
|
uni.request({
|
|
url: basePath + "/app/hidden/check", //提交接口
|
|
method: 'POST',
|
|
dataType: 'json',
|
|
header: {
|
|
'Content-type': 'application/x-www-form-urlencoded'
|
|
},
|
|
data: {
|
|
ISQUALIFIED: _this.ISQUALIFIED,
|
|
CHECKDESCR: _this.CHECKDESCR,
|
|
CHECK_TIME: _this.CHECK_TIME,
|
|
HIDDEN_ID: _this.id,
|
|
CHECKOR: loginUserId
|
|
},
|
|
success: (res) => {
|
|
uni.hideLoading();
|
|
if ("success" == res.data.result) {
|
|
_this.check = res.data.check;
|
|
resolve();
|
|
} else {
|
|
uni.showToast({
|
|
title: '错误',
|
|
duration: 2000
|
|
});
|
|
}
|
|
|
|
}
|
|
});
|
|
})
|
|
},
|
|
changeDate(e) {
|
|
this.CHECK_TIME = e.detail.value
|
|
},
|
|
radio(e) {
|
|
this.ISQUALIFIED = e
|
|
},
|
|
ViewShowImage(e) {
|
|
let files = [];
|
|
for (var i = 0; i < this.pd.hImgs.length; i++) {
|
|
files.push(baseImgPath + this.pd.hImgs[i].FILEPATH)
|
|
}
|
|
uni.previewImage({
|
|
urls: files,
|
|
current: e.currentTarget.dataset.index
|
|
});
|
|
},
|
|
ViewShowImage2(e) {
|
|
let files = [];
|
|
for (var i = 0; i < this.files2.length; i++) {
|
|
files.push(baseImgPath + this.files2[i].FILEPATH)
|
|
}
|
|
uni.previewImage({
|
|
urls: files,
|
|
current: e.currentTarget.dataset.index
|
|
});
|
|
},
|
|
|
|
ViewShowImage4(e) {
|
|
let files = [];
|
|
for (var i = 0; i < this.files4.length; i++) {
|
|
files.push(baseImgPath + this.files4[i].FILEPATH)
|
|
}
|
|
uni.previewImage({
|
|
urls: files,
|
|
current: e.currentTarget.dataset.index
|
|
});
|
|
},
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style>
|
|
.selected {
|
|
display: flex;
|
|
align-items: center;
|
|
}
|
|
|
|
.selected .radio {
|
|
transform: scale(0.75);
|
|
margin-right: 10upx;
|
|
}
|
|
|
|
.cu-btn {
|
|
border-radius: 0;
|
|
width: 100%;
|
|
height: 84upx;
|
|
font-weight: bold;
|
|
}
|
|
|
|
.group {
|
|
display: flex;
|
|
align-items: center;
|
|
}
|
|
</style>
|