qa-prevention-gwj-first-app/pages/application/fire-management/hidden-trouble-app/exclude-form.vue

1569 lines
51 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<template>
<view :class="isUps == true ? 'prevent' : ''">
<cu-custom bgColor="bg-gradual-blueness" :isBack="true">
<block slot="backText">返回</block>
<block slot="content">隐患登记</block>
</cu-custom>
<scroll-view scroll-y="false">
<view class="form">
<view class="cu-form-group">
<view class="title asterisk">检查内容</view>
<!-- <view class="f24 text-black">-->
<!-- {{pd.CHECK_CONTENT}}-->
<!-- </view>-->
<picker @change="fireDeviceTypeChange" :value="pd.CHECK_CONTENT" :range="fireDeviceTypeList"
range-key="FIRE_CHECK_STANDARD_ITEM">
<view class="picker">
{{ pd.CHECK_CONTENT || '请选择' }}
</view>
</picker>
</view>
<view class="cu-bar bg-white margin-top">
<view class="action asterisk">
隐患照片
</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-type="0"
:data-url="imgList[index].filePath">
<image :src="imgList[index].filePath" mode="aspectFill"></image>
<view v-if="ISLOG == '0'" class="cu-tag bg-red" @tap.stop="DelImg" data-type="0"
:data-index="index">
<text class='cuIcon-close'></text>
</view>
</view>
<view class="solids" @tap="ChooseImage(0)" v-if="imgList.length<4 && ISLOG == '0'">
<text class='cuIcon-cameraadd'></text>
</view>
</view>
</view>
<view class="cu-bar bg-white">
<view class="action">
隐患视频
</view>
<view class="action">
{{ videoList.length }}/1
</view>
</view>
<view class="cu-form-group">
<view class="grid col-4 grid-square flex-sub">
<view class="bg-img" v-for="(item,vindex) in videoList" :key="vindex" data-type="0"
:data-url="videoList[vindex].filePath" style="background-color: #000">
<image src="/static/icon-apps/video.png" mode="aspectFill" @click="playVideo"
:data-src="videoList[vindex].filePath"></image>
<view v-if="ISLOG == '0'" class="cu-tag bg-red" @tap.stop="DelVideo" data-type="0"
:data-index="vindex">
<text class='cuIcon-close'></text>
</view>
</view>
<view class="solids" @tap="chooseVideo(0)" v-if="videoList.length == 0 && ISLOG == '0'">
<text class='cuIcon-cameraadd'></text>
</view>
</view>
</view>
<view class="cu-form-textarea margin-top">
<view class="cu-form-title text-hui">隐患描述</view>
<textarea maxlength="-1" :disabled="modalName!=null" v-model="pd.HIDDENDESCR"
placeholder="请对隐患进行详细描述(必填项)"></textarea>
</view>
<view class="cu-form-group margin-top">
<view class="title">隐患部位</view>
<view class="picker-tree-box">
<view class="picker-tree" @tap="showHiddenRegionTree">
{{ pd.hregionName ? pd.hregionName : '请选择' }}
</view>
</view>
<tki-tree ref="hiddenRegionTree" :selectParent=false :range="hiddenRegionTreeList" rangeKey="name"
@confirm="hiddenRegionTreeCon" @cancel="hiddentreeCancel"></tki-tree>
</view>
<view class="cu-form-group margin-top">
<view class="title asterisk">隐患级别</view>
<view class="picker-tree-box">
<view class="picker-tree" @tap="showHiddenLevenTreeTree">
{{ pd.HIDDENLEVELNAME ? pd.HIDDENLEVELNAME : '请选择' }}
</view>
</view>
<tki-tree ref="hiddenLevenTree" :selectParent=false :range="levelList" rangeKey="name"
@confirm="hiddenLevenConfirm" @cancel="hiddentreeCancel"></tki-tree>
</view>
<view class="cu-form-group margin-top">
<view class="title asterisk">隐患类型</view>
<view class="picker-tree-box">
<view class="picker-tree" @tap="showHiddenType1TreeTree('1')">
{{ pd.HIDDENTYPENAME ? pd.HIDDENTYPENAME : '请选择' }}
</view>
</view>
<tki-tree ref="hiddenType1Tree" :selectParent=false :range="hiddenTypeList" rangeKey="name"
@confirm="hiddenType1Confirm" @cancel="hiddentreeCancel">
</tki-tree>
</view>
<!--<view class="cu-form-group margin-top">
<view class="title">隐患类型2</view>
<view class="picker-tree-box">
<view class="picker-tree" @tap="showHiddenType1TreeTree('2')">
{{pd.HIDDENTYPENAME2?pd.HIDDENTYPENAME2:'请选择'}}
</view>
</view>
<tki-tree ref="hiddenType2Tree" :selectParent=false :range="hiddenTypeList" rangeKey="name"
@confirm="hiddenType2Confirm" @cancel="hiddenType2Cancel"></tki-tree>
</view>-->
<view class="cu-form-group margin-top">
<view class="title text-hui asterisk">是否立即整改</view>
<radio-group class="selected">
<view v-if="pd.HIDDENLEVEL != 'jdyh001' && pd.HIDDENLEVEL !='hiddenLevel2002'"
class="group mr20">
<radio class='radio' value="1" :checked="RECTIFICATIONTYPE==1" @click="radioType(1)">
</radio>
<text>是</text>
</view>
<view class="group">
<radio class='radio' value="2" :checked="RECTIFICATIONTYPE==2" @click="radioType(2)">
</radio>
<text>否</text>
</view>
</radio-group>
</view>
<view class="cu-form-group margin-top"
v-if="RECTIFICATIONTYPE==2 && pd.HIDDENLEVEL != 'jdyh001' && pd.HIDDENLEVEL !='hiddenLevel2002'">
<view class="title">整改责任部门</view>
<view class="picker-tree-box">
<view class="picker-tree" @tap="showZgTree">
{{ pd.RECTIFICATIONDEPTNAME ? pd.RECTIFICATIONDEPTNAME : '请选择' }}
</view>
</view>
<tki-tree ref="tkiTree" :selectParent=true :range="treeNode" rangeKey="name"
@confirm="zgtreeConfirm" @cancel="zgtreeCancel"></tki-tree>
</view>
<view class="cu-form-group margin-top"
v-if="RECTIFICATIONTYPE==2 && rectificationUserList.length>0 && pd.HIDDENLEVEL != 'jdyh001' && pd.HIDDENLEVEL !='hiddenLevel2002'">
<view class="title">整改责任人</view>
<picker @change="PickerZgr" :value="uindex" :range="rectificationUserList" range-key="NAME">
<view class="picker">
{{ pd.RECTIFICATIONORNAME ? pd.RECTIFICATIONORNAME : '请选择' }}
</view>
</picker>
</view>
<view class="cu-form-group margin-top"
v-if="RECTIFICATIONTYPE==2 && pd.HIDDENLEVEL != 'jdyh001' && pd.HIDDENLEVEL !='hiddenLevel2002'">
<view class="title">整改期限</view>
<picker mode="date" :value="pd.RECTIFICATIONDEADLINE" :start="rectifyPlanCompletionStartTime"
@change="changeDate">
<view class="picker">
{{ pd.RECTIFICATIONDEADLINE ? pd.RECTIFICATIONDEADLINE : '请选择' }}
</view>
</picker>
</view>
<view class="cu-form-group margin-top"
v-if=" pd.HIDDENLEVEL != 'jdyh001' && pd.HIDDENLEVEL !='hiddenLevel2002'">
<view class="title asterisk">隐患确认人</view>
<picker @change="setConUser" :value="uindex" :range="confirUserAllList" range-key="NAME">
<view class="picker">
{{ pd.conUserName ? pd.conUserName : '请选择' }}
</view>
</picker>
</view>
<view class="cu-form-group margin-top">
<view class="title asterisk">隐患发现时间</view>
<ruiDatePicker v-if="pd.DISCOVERYTIME" fields="minute" :value="pd.DISCOVERYTIME || '请选择'"
start="2010-01-01 00:00:00" :end="this.TIME" @change="changeDiscoverDate"></ruiDatePicker>
<text v-else>{{ pd.DISCOVERYTIME }}</text>
</view>
<view class="cu-form-group margin-top">
<view class="title text-hui asterisk">是否相关方</view>
<radio-group class="selected">
<view class="group mr20">
<radio class='radio' value="1" :checked="ISRELEVANT==1" @click="radioISRELEVANT(1)"></radio>
<text>是</text>
</view>
<view class="group">
<radio class='radio' value="2" :checked="ISRELEVANT==2" @click="radioISRELEVANT(2)"></radio>
<text>否</text>
</view>
</radio-group>
</view>
<view class="cu-form-textarea margin-top">
<view class="title text-hui">隐患位置描述</view>
<textarea maxlength="-1" :disabled="modalName!=null" v-model="pd.POSITIONDESC"
placeholder="请对隐患位置进行详细描述"></textarea>
</view>
<view class="cu-form-group margin-top">
<view class="title">地点坐标:</view>
<button v-if="ISLOG == '0'" class="cu-btn bg-green shadow" @tap="showMapModal">定位</button>
</view>
<view class="cu-form-group" v-if="pd.LATITUDE && pd.LATITUDE != 'undefined' ">
<view class="title">经度:</view>
<view>{{ pd.LATITUDE }}</view>
</view>
<view class="cu-form-group" v-if="pd.LONGITUDE && pd.LONGITUDE != 'undefined'">
<view class="title">纬度:</view>
<view>{{ pd.LONGITUDE }}</view>
</view>
<view class="add_pard_box">
<view v-if="ISLOG == '0'" class="add_pard_btns">
<view class="add_pard_b">
<button class="cu-btn round bg-blue" @click="addOther">添加</button>
</view>
</view>
<view class="add_pard_item" v-for="(item,index) of other">
<view class="add_pard_del" v-if="index>0" @click="removeOther(index)">
<text class="cuIcon-roundclosefill text-red f40"></text>
</view>
<view class="cu-form-group">
<view class="title">隐患发现人部门</view>
<view class="picker-tree-box">
<view class="picker-tree" @tap="showConTree(index)">
{{ other[index].DEPARTMENT_NAME ? other[index].DEPARTMENT_NAME : '请选择' }}
</view>
</view>
<tki-tree :ref="'tkiConfirmTree'+index" :selectParent=true :range="treeNode" rangeKey="name"
@confirm="contreeConfirm($event,index)"></tki-tree>
</view>
<view class="cu-form-group">
<view class="title">隐患发现人</view>
<picker @change="PickerYsr($event,index)" :value="other[index].index"
@click="haveUser(otherUserList[index])"
:disabled="otherUserList[index] ==null || otherUserList[index].length==0"
:range="otherUserList[index]" range-key="NAME">
<view class="picker">
{{ other[index].USER_NAME ? other[index].USER_NAME : '请选择' }}
</view>
</picker>
</view>
</view>
</view>
<view class="cu-form-textarea margin-top" v-if="RECTIFICATIONTYPE==1">
<view class="cu-form-title text-hui">整改描述</view>
<textarea maxlength="-1" :disabled="modalName!=null" v-model="pd.RECTIFYDESCR"
placeholder="请对隐患进行整改描述(必填项)"></textarea>
</view>
<view class="cu-bar bg-white margin-top" v-if="RECTIFICATIONTYPE==1">
<view class="action asterisk">
整改后图片
</view>
<view class="action">
{{ imgList1.length }}/4
</view>
</view>
<view class="cu-form-group" v-if="RECTIFICATIONTYPE==1">
<view class="grid col-4 grid-square flex-sub">
<view class="bg-img" v-for="(item,index) in imgList1" :key="index" @tap="ViewImage"
data-type="1" :data-url="imgList1[index].filePath">
<image :src="imgList1[index].filePath" mode="aspectFill"></image>
<view class="cu-tag bg-red" @tap.stop="DelImg" data-type="1" :data-index="index">
<text class='cuIcon-close'></text>
</view>
</view>
<view class="solids" @tap="ChooseImage(1)" v-if="imgList1.length<4">
<text class='cuIcon-cameraadd'></text>
</view>
</view>
</view>
</view>
<view v-if="ISLOG == '0'" class="padding flex flex-direction">
<button class="cu-btn bg-blue margin-tb-sm lg" @click="$noMultipleClicks(goSubmit)">提交</button>
</view>
</scroll-view>
<view :class="['cu-modal',{'show':modalShow}]" v-if="modalShow">
<view class="cu-dialog">
<view class="cu-bar bg-white justify-end">
<view class="content">播放视频</view>
<view class="action" @tap="modalShow = false">
<text class="cuIcon-close text-red"></text>
</view>
</view>
<video :src="videoSrc" :autoplay="true"></video>
<view class="cu-bar bg-white justify-end">
<view class="action">
<button class="cu-btn line-green text-green" @click="modalShow = false">关闭</button>
</view>
</view>
</view>
</view>
<view style="width: 0;height: 0;overflow: hidden;position:fixed;left: 200%;">
<canvas canvas-id="firstCanvas" :style="{border:'1px solid #000000',width: width,height: height}"
class="canvas"></canvas>
</view>
</view>
</template>
<script>
import {
baseImgPath,
basePath,
corpinfoId,
deptId,
formatDate,
loginSession,
loginUser
} from '@/common/tool.js';
import tkiTree from "@/components/select-tree/select-tree.vue"
import ruiDatePicker from '@/components/rattenking-dtpicker/rattenking-dtpicker.vue';
export default {
components: {
tkiTree,
ruiDatePicker
},
data() {
return {
isUps: false,
msg: 'appAdd',
RECORDITEM_ID: '',
RISKITEM_ID: '',
LISTMANAGER_ID: '',
width: '',
height: '',
ISLOG: '',
index: '',
noClick: true,
pd: {
"RECTIFICATIONTYPE": 2,
DISCOVERYTIME: '',
LATITUDE: '',
LONGITUDE: '',
ISRELEVANT: '1',
conUserId: '',
CHECK_CONTENT: -1,
},
imgList: [],
imgList1: [],
HIDDENDESCR: '', //隐患描述
HIDDENPART: '', //隐患部位
modalName: null,
id: '',
CHECK_CONTENT: '',
checkId: '',
info_index: 0,
RECTIFYDESCR: '', //整改描述
RECTIFICATIONTYPE: 2, //是否立即
ISRELEVANT: '2', //是否相关方
treeNode: [], //部门下拉数据
RECTIFICATIONDEPT: '', //整改部门
RECTIFICATIONDEPTNAME: '请选择', //整改部门
CHECKDEPT: '', //验收部门
CHECKDEPTNAME: '请选择', //验收部门
confirmDept: '',
hregionDeptName: '请选择',
rectificationUserList: [],
RECTIFICATIONOR: '', //整改人
uindex: -1,
lindex: -1,
levelList: [],
tindex: -1,
hiddenTypeList: [],
HIDDENLEVEL: '', //隐患级别
RECTIFICATIONDEADLINE: '', //整改期限
rectifyPlanCompletionStartTime: '',
todayDate: formatDate(new Date(), 'yyyy-MM-dd hh:mm'),
TIME: formatDate(new Date(), 'yyyy-MM-dd hh:mm:ss'),
confirUserAllList: [],
otherUserList: [],
other: [],
hiddenRegionTreeList: [],
videoList: [],
modalShow: false,
videoSrc: '',
FIRE_DEVICE_TYPE_ID: '', //检查标准
fireDeviceTypeList: []
}
},
onLoad(event) {
this.ISLOG = event.ISLOG
this.info_index = event.INDEX
let now = new Date();
var tomorrow = now.setDate(now.getDate() + 1);
tomorrow = new Date(tomorrow);
this.rectifyPlanCompletionStartTime = formatDate(tomorrow, 'yyyy-MM-dd');
this.pd.HIDDEN_ID = event.HIDDEN_ID;
this.FIRE_DEVICE_TYPE_ID = event.FIRE_DEVICE_TYPE_ID;
this.ISLOG = event.ISLOG;
if (this.pd.HIDDEN_ID && this.pd.HIDDEN_ID != 'undefined') {
this.msg = "edit";
this.getData();
} else {
this.pd.CHECK_CONTENT = event.FIRE_CHECK_STANDARD_ITEM;
this.RECORDITEM_ID = event.RECORDITEM_ID;
this.RISKITEM_ID = event.RISKITEM_ID;
this.LISTMANAGER_ID = event.LISTMANAGER_ID;
this.pd.DISCOVERYTIME = formatDate(new Date(), 'yyyy-MM-dd hh:mm')
this.myOther();
}
this.getDept();
this.getLevel();
this.getConfirmUser()
this.getFireDeviceType();
// this.getHiddenType();
loginSession();
},
methods: {
hiddentreeCancel() {
this.isUps = false;
},
getData() {
var _this = this;
uni.showLoading({
title: '请稍候'
})
uni.request({
url: basePath + '/app/hidden/goEdit',
method: 'POST',
dataType: 'json',
header: {
'Content-type': 'application/x-www-form-urlencoded'
},
data: {
HIDDEN_ID: _this.pd.HIDDEN_ID,
},
success: (res) => {
if ("success" == res.data.result) {
uni.hideLoading();
_this.pd = res.data.pd; //参数map
_this.ISRELEVANT = res.data.pd.ISRELEVANT
_this.RECTIFICATIONTYPE = _this.pd.RECTIFICATIONTYPE;
let files = res.data.hImgs;
for (var i = 0; i < files.length; i++) {
let img = {};
img.filePath = baseImgPath + files[i].FILEPATH;
img.id = files[i].IMGFILES_ID;
_this.imgList.push(img);
}
let files1 = res.data.rImgs;
for (var i = 0; i < files1.length; i++) {
let img = {};
img.filePath = baseImgPath + files1[i].FILEPATH;
img.id = files1[i].IMGFILES_ID;
_this.imgList1.push(img);
}
_this.getUserList();
for (var i = 0; i < res.data.hiddenVideo.length; i++) {
let video = {};
video.filePath = baseImgPath + res.data.hiddenVideo[i].FILEPATH;
video.id = res.data.hiddenVideo[i].IMGFILES_ID;
_this.videoList.push(video);
}
for (var i = 0; i < res.data.hiddenFindPeople.length; i++) {
let o = {
"DEPARTMENT_ID": res.data.hiddenFindPeople[i].DEPARTMENT_ID,
"USER_ID": res.data.hiddenFindPeople[i].USER_ID,
"DEPARTMENT_NAME": res.data.hiddenFindPeople[i].deptName,
"USER_NAME": res.data.hiddenFindPeople[i].NAME,
index: (i - 1)
};
_this.other.push(o)
}
} else if ("exception" == data.result) {
uni.showToast({
title: '错误',
duration: 2000
});
}
}
});
},
getDept() {
var _this = this;
uni.request({
url: basePath + '/app/sys/listTree', //部门下拉接口
method: 'POST',
dataType: 'json',
header: {
'Content-type': 'application/x-www-form-urlencoded'
},
data: {
CORPINFO_ID: corpinfoId,
},
success: (res) => {
if ("success" == res.data.result) {
_this.treeNode = eval(res.data.zTreeNodes);
} else {
uni.showToast({
title: res.data.message,
duration: 2000
});
}
}
});
},
// 确定回调事件
zgtreeConfirm(e) {
this.isUps = false;
this.pd.RECTIFICATIONDEPT = e[0].id;
this.pd.RECTIFICATIONDEPTNAME = e[0].name;
this.pd.confirmDept = e[0].id;
this.pd.hregionDeptName = e[0].name;
this.uindex = -1;
this.pd.RECTIFICATIONOR = '';
this.pd.RECTIFICATIONORNAME = '';
this.$forceUpdate(); //强制刷新
this.getUserList();
},
// 取消回调事件
zgtreeCancel(e) {
this.isUps = false;
},
// 显示树形选择器
showZgTree() {
this.isUps = false
this.$refs.tkiTree._show();
},
// 确定回调事件
ystreeConfirm(e) {
this.pd.CHECKDEPT = e[0].id;
this.pd.CHECKDEPTNAME = e[0].name;
this.$forceUpdate(); //强制刷新
},
// 显示树形选择器
showYsTree() {
this.$refs.tkiTree1._show();
},
//获取人员列表
getUserList() {
//发送 post 请求
var _this = this;
uni.request({
method: 'POST',
dataType: 'json',
header: {
'Content-type': 'application/x-www-form-urlencoded'
},
url: basePath + '/app/sys/listUser',
data: {
DEPARTMENT_ID: _this.pd.RECTIFICATIONDEPT,
NOMAIN: '1',
tm: new Date().getTime()
},
success: function(res) {
if ("success" == res.data.result) {
_this.rectificationUserList = res.data.userList;
} else {
uni.showToast({
title: res.data.message,
duration: 2000
});
}
}
})
},
PickerZgr(e) {
this.uindex = e.detail.value;
this.pd.RECTIFICATIONOR = this.rectificationUserList[this.uindex].USER_ID;
this.pd.RECTIFICATIONORNAME = this.rectificationUserList[this.uindex].NAME;
this.$forceUpdate(); //强制刷新
},
//获取数据字典数据
getLevel: function() {
// var _this = this;
// uni.request({
// method: 'POST',
// dataType: 'json',
// header: {
// 'Content-type': 'application/x-www-form-urlencoded'
// },
// url: basePath + '/dictionaries/getLevels?tm=' + new Date().getTime(),
// data: {DICTIONARIES_ID: '5e7cf8620ba54ad89719d0be62133c7a'},
// dataType: 'json',
// success: function (res) {
// _this.levelList = res.data.list;
// }
// });
},
levelPickerChange(e) {
this.lindex = e.detail.value;
this.pd.HIDDENLEVEL = this.levelList[this.lindex].BIANMA;
this.pd.HIDDENLEVELNAME = this.levelList[this.lindex].NAME;
this.$forceUpdate(); //强制刷新
},
typePickerChange(e) {
this.tindex = e.detail.value;
this.pd.HIDDENTYPE = this.hiddenTypeList[this.tindex].BIANMA;
this.pd.HIDDENTYPENAME = this.hiddenTypeList[this.tindex].NAME;
this.$forceUpdate(); //强制刷新
},
changeDate(e) {
this.pd.RECTIFICATIONDEADLINE = e.detail.value
this.$forceUpdate(); //强制刷新
},
radioISRELEVANT(e) {
this.pd.ISRELEVANT = e
},
//图片上传
ChooseImage(e) {
var _this = this;
var ss = 4 - this.imgList.length;
uni.chooseImage({
count: ss, //默认9
sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
sourceType: ['camera', 'album'], //从相册选择
success: (res) => {
uni.showLoading({
title: '加载中',
mask: true
})
for (let i = 0; i < res.tempFilePaths.length; i++) {
this.setimg(res.tempFilePaths[i],e)
}
}
});
},
setimg(path,e){
var _this = this
let newDate = new Date();
let year = newDate.getFullYear() //年
let month = newDate.getMonth() + 1 //月
let day = newDate.getDate() //日
const hour = newDate.getHours();
const minute = newDate.getMinutes();
const second = newDate.getSeconds();
let date = year + '-' + month + '-' + day + '- ' + hour + ':' + minute + ':' + second
uni.getImageInfo({
src: path,
success: res => {
// console.log(res);
this.width = res.width/3 + 'px';
this.height = res.height/3 + 'px';
if (res.width < 800) {
uni.hideLoading()
uni.showToast({
title: '图片尺寸不能小于800',
icon: 'none'
})
return
}
//初始化画布
const ctx = uni.createCanvasContext('firstCanvas', this);
ctx.fillRect(0, 0, res.width, res.height);
ctx.drawImage(res.path, 0, 0, res.width/3, res.height/3); //将图片src放到cancas内宽高为图片大小
ctx.setFontSize(10);
// ctx.globalAlpha = 1;
ctx.setFillStyle('red');
let textToWidth = (res.width/3) - 100;
let textToHeight = (res.height/3) - 20;
ctx.fillText(date, textToWidth, textToHeight);
setTimeout(() => {// 这个不加异步 第一次的图片显示不出来
ctx.draw(false, () => {
setTimeout(() => {
uni.canvasToTempFilePath({
canvasId: 'firstCanvas',//将画布中内容转成图片,即水印与图片合成
x: 0,
y: 0,
width: res.width,
height: res.height,
destWidth: res.width,
destHeight: res.height,
success: ress => {
if (e == 0 ) {
let img = {};
img.id = '';
img.filePath = ress.tempFilePath;
_this.imgList.push(img)
uni.hideLoading()
} else {
let img = {};
img.id = '';
img.filePath = ress.tempFilePath;
_this.imgList1.push(img)
uni.hideLoading()
}
},
fail: (err) => {
uni.hideLoading()
console.log(err);
}
});
}, 500);
});
},300);
}
});
},
ViewImage(e) {
console.info(e.currentTarget.dataset.type)
if (e.currentTarget.dataset.type == 0) {
let files = [];
for (var i = 0; i < this.imgList.length; i++) {
files.push(this.imgList[i].filePath)
}
uni.previewImage({
urls: files,
current: e.currentTarget.dataset.url
});
} else {
let files = [];
for (var i = 0; i < this.imgList1.length; i++) {
files.push(this.imgList1[i].filePath)
}
uni.previewImage({
urls: files,
current: e.currentTarget.dataset.url
});
}
},
DelImg(e) {
var _this = this;
let i = e.currentTarget.dataset.index
uni.showModal({
title: '秦港-双基双控',
content: '确定要删除这张图片吗?',
cancelColor: "#000000",
cancelText: '取消',
confirmText: '确定',
success: res => {
if (res.confirm) {
if (e.currentTarget.dataset.type == 0) {
if (_this.imgList[i].id) {
uni.showLoading({
title: '处理中'
})
uni.request({
url: basePath + '/app/imgfiles/delete',
method: 'POST',
dataType: 'json',
header: {
'Content-type': 'application/x-www-form-urlencoded'
},
data: {
IMGFILES_ID: _this.imgList[i].id,
},
success: (res) => {
uni.hideLoading();
uni.showToast({
icon: 'none',
title: '删除成功',
duration: 1500
});
_this.imgList.splice(i, 1)
},
fail: (err) => {
uni.hideLoading();
uni.showModal({
content: err.errMsg,
showCancel: false
});
}
})
} else {
this.imgList.splice(e.currentTarget.dataset.index, 1)
}
} else {
if (_this.imgList1[i].id) {
uni.showLoading({
title: '处理中'
})
uni.request({
url: basePath + '/app/imgfiles/delete',
method: 'POST',
dataType: 'json',
header: {
'Content-type': 'application/x-www-form-urlencoded'
},
data: {
IMGFILES_ID: _this.imgList1[i].id,
},
success: (res) => {
uni.hideLoading();
uni.showToast({
icon: 'none',
title: '删除成功',
duration: 1500
});
_this.imgList1.splice(i, 1)
},
fail: (err) => {
uni.hideLoading();
uni.showModal({
content: err.errMsg,
showCancel: false
});
}
})
} else {
this.imgList1.splice(e.currentTarget.dataset.index, 1)
}
}
}
}
})
},
textareaAInput(e) {
this.pd.HIDDENDESCR = e.detail.value
},
textareaBInput(e) {
this.pd.HIDDENPART = e.detail.value
},
textareaCInput(e) {
this.pd.RECTIFYDESCR = e.detail.value
},
goSubmit() {
var _this = this;
if (_this.pd.POSITIONDESC == undefined) {
_this.pd.POSITIONDESC = ''
}
if (_this.pd.RECTIFICATIONDEPT == undefined) {
_this.pd.RECTIFICATIONDEPT = ''
}
if (_this.pd.RECTIFICATIONOR == undefined) {
_this.pd.RECTIFICATIONOR = ''
}
if (_this.pd.HIDDENPART == undefined) {
_this.pd.HIDDENPART = ''
}
if (!_this.pd.CHECK_CONTENT || _this.pd.CHECK_CONTENT == '请选择') {
uni.showToast({
icon: 'none',
title: '请选择检查内容',
duration: 1500
});
return;
}
if (_this.imgList.length <= 0) {
uni.showToast({
icon: 'none',
title: '请上传隐患图片',
duration: 1500
});
return;
}
if (!_this.pd.HIDDENDESCR) {
uni.showToast({
icon: 'none',
title: '请填隐患描述',
duration: 1500
});
return;
}
if (!_this.pd.conUserId && _this.pd.HIDDENLEVEL != 'jdyh001' && _this.pd.HIDDENLEVEL !=
'hiddenLevel2002') {
uni.showToast({
icon: 'none',
title: '请填隐患确认人',
duration: 1500
});
return;
}
// if (!_this.pd.HIDDENPART) {
// uni.showToast({
// icon: 'none',
// title: '请填隐患部位',
// duration: 1500
// });
// return;
// }
if (!_this.pd.HIDDENLEVEL) {
uni.showToast({
icon: 'none',
title: '请选择隐患级别',
duration: 1500
});
return;
}
if (!_this.pd.CHECK_CONTENT) {
uni.showToast({
icon: 'none',
title: '请选择检查内容',
duration: 1500
});
return;
}
if (!_this.pd.HIDDENTYPE) {
uni.showToast({
icon: 'none',
title: '请选择隐患类型',
duration: 1500
});
return;
}
/*if (!_this.pd.HIDDENTYPE2) {
uni.showToast({
icon: 'none',
title: '请选择隐患类型2',
duration: 1500
});
return;
}*/
if (_this.RECTIFICATIONTYPE == 1 && !_this.pd.RECTIFYDESCR) {
uni.showToast({
icon: 'none',
title: '请填整改描述',
duration: 1500
});
return;
}
if (_this.RECTIFICATIONTYPE == 1 && _this.imgList1.length <= 0) {
uni.showToast({
icon: 'none',
title: '请上传整改后图片',
duration: 1500
});
return;
}
if (!_this.pd.ISRELEVANT) {
uni.showToast({
icon: 'none',
title: '请选择是否相关方',
duration: 1500
});
return;
}
/*if (_this.pd.HIDDENLEVEL != 'jdyh001' && _this.pd.HIDDENLEVEL !='hiddenLevel2002') {
uni.showToast({
icon: 'none',
title: '请选择整改部门',
duration: 1500
});
return;
}
if (_this.pd.HIDDENLEVEL != 'jdyh001' && _this.pd.HIDDENLEVEL !='hiddenLevel2002') {
uni.showToast({
icon: 'none',
title: '请选择整改人',
duration: 1500
});
return;
}
if (_this.pd.HIDDENLEVEL != 'jdyh001' && _this.pd.HIDDENLEVEL !='hiddenLevel2002') {
uni.showToast({
icon: 'none',
title: '请选择整改期限',
duration: 1500
});
return;
}*/
if (!_this.pd.DISCOVERYTIME) {
uni.showToast({
icon: 'none',
title: '请选择隐患发现时间',
duration: 1500
});
return;
}
var fileList = [];
for (var i = 0; i < _this.imgList.length; i++) {
if (!_this.imgList[i].id) {
var file = {};
file.type = 3;
file.filePath = _this.imgList[i].filePath;
fileList.push(file);
}
}
if (_this.RECTIFICATIONTYPE == 1) {
for (var i = 0; i < _this.imgList1.length; i++) {
if (!_this.imgList1[i].id) {
var file = {};
file.type = 4;
file.filePath = _this.imgList1[i].filePath;
fileList.push(file);
}
}
}
if (_this.videoList.length > 0) {
if (!_this.videoList[0].id) {
var file = {};
file.type = 102;
file.filePath = _this.videoList[0].filePath;
fileList.push(file);
}
}
new Promise((resolve, reject) => {
_this.submit().then(() => {
resolve();
})
}).then(() => {
var i = 0;
_this.uploadImg(fileList, i).then(() => {
resolve();
})
}).then(() => {
var pages = getCurrentPages(); // 获取当前页面栈
var prePage = pages[pages.length - 2]; // 上一个页面
// var task = prePage.$vm.list[_this.index];
prePage.$vm.initflag = true; // A 页面 init方法 为true
prePage.$vm.info[this.info_index].ISNORMAL = 1;
prePage.$vm.info[this.info_index].HIDDEN_ID = _this.pd.HIDDEN_ID;
uni.navigateBack({});
uni.hideLoading();
})
},
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].filePath,
name: 'FFILE',
formData: {
'TYPE': tempFilePaths[i].type,
'FOREIGN_KEY': _this.pd.HIDDEN_ID
},
success: (res) => {
i++;
if (tempFilePaths.length > i) {
_this.uploadImg(tempFilePaths, i);
} else {
uni.hideLoading();
resolve();
}
},
fail: (err) => {
uni.hideLoading();
uni.showModal({
content: err.errMsg,
showCancel: false
});
}
})
})
},
submit() {
return new Promise((resolve, reject) => {
var _this = this;
// var pages = getCurrentPages(); // 获取当前页面栈
// var prePage = pages[pages.length - 2]; // 上一个页面
// var task = prePage.$vm.list[_this.index];
let longitude;
let latitude;
uni.request({
url: basePath + '/app/hidden/' + _this.msg,
method: 'POST',
dataType: 'json',
header: {
'Content-type': 'application/x-www-form-urlencoded'
},
data: {
HIDDEN_ID: _this.pd.HIDDEN_ID,
SOURCE: '6',
STATE: '0',
HIDDENDESCR: _this.pd.HIDDENDESCR,
HIDDENPART: _this.pd.HIDDENPART,
LATITUDE: _this.pd.LATITUDE,
LONGITUDE: _this.pd.LONGITUDE,
RECTIFYDESCR: _this.pd.RECTIFYDESCR ? _this.pd.RECTIFYDESCR : '',
RECTIFICATIONDEADLINE: _this.pd.RECTIFICATIONDEADLINE ? _this.pd
.RECTIFICATIONDEADLINE : '',
RECTIFICATIONTYPE: _this.RECTIFICATIONTYPE,
RECTIFICATIONOR: _this.pd.RECTIFICATIONOR,
HIDDENLEVEL: _this.pd.HIDDENLEVEL,
HIDDENTYPE: _this.pd.HIDDENTYPE,
RECTIFICATIONDEPT: _this.pd.RECTIFICATIONDEPT,
// CHECKDEPT:_this.pd.CHECKDEPT?_this.pd.CHECKDEPT:'',
CHECK_CONTENT: _this.pd.CHECK_CONTENT,
CORPINFO_ID: corpinfoId,
HIDDENFINDDEPT: deptId,
CREATOR: loginUser.USER_ID,
ISRELEVANT: _this.pd.ISRELEVANT,
POSITIONDESC: _this.pd.POSITIONDESC,
RECORDITEM_ID: _this.RECORDITEM_ID,
LISTMANAGER_ID: _this.LISTMANAGER_ID,
RISKITEM_ID: _this.RISKITEM_ID,
CLEARIMG: '1',
DISCOVERYTIME: this.pd.DISCOVERYTIME, //gwj 发现时间
other: JSON.stringify(this.other), //gwj 发现人
CONFIRM_USER: this.pd.conUserId, //gwj 隐患确认人
HIDDENTYPE2: _this.pd.HIDDENTYPE2, //gwj 隐患类型2 HIDDENTYPE2
},
success: (res) => {
if ("success" == res.data.result) {
_this.pd.HIDDEN_ID = res.data.pd.HIDDEN_ID;
resolve();
// prePage.$vm.initflag = true; // A 页面 init方法 为true
// prePage.$vm.list[_this.index].ISNORMAL = 1;
// prePage.$vm.list[_this.index].HIDDEN_ID = _this.HIDDEN_ID;
// uni.navigateBack({});
// uni.hideLoading();
} else {
uni.showToast({
icon: 'none',
title: res.data.msg,
duration: 2000
});
}
}
});
// uni.getLocation({
// type: 'GCJ02',
// success: function (res1) {
// longitude = res1.longitude;
// latitude = res1.latitude;
// var result = gcoord.transform(
// [longitude, latitude], // 经纬度坐标
// gcoord.GCJ02, // 当前坐标系
// gcoord.BD09 // 目标坐标系
// );
// longitude = result[0];
// latitude = result[1];
// //发送 post 请求提交保存
//
// },
// fail: function(res){
// uni.hideLoading();
// uni.showToast({
// title: "获取位置失败",
// duration: 2000
// });
// }
// });
});
},
radioType(e) {
this.RECTIFICATIONTYPE = e
},
showHiddenLevenTreeTree() {
var _this = this;
uni.request({
method: 'POST',
dataType: 'json',
header: {
'Content-type': 'application/x-www-form-urlencoded'
},
url: basePath + '/dictionaries/listSelectTreeByTkiTree?tm=' + new Date().getTime(),
data: {
DICTIONARIES_ID: '5e7cf8620ba54ad89719d0be62133c7a'
},
success: function(res) {
// _this.levelList = JSON.parse(data.zTreeNodes) res.data.zTreeNodes;
var data = JSON.parse(res.data.zTreeNodes);
for (let i = 0; i < data.length; i++) {
for (let j = 0; j < data[i].children.length; j++) {
if (data[i].children[j].id == 'hiddenLevel1001') {
data[i].children.splice(j, 1)
}
}
}
_this.levelList = data
}
});
this.isUps = false
this.$refs.hiddenLevenTree._show();
this.$forceUpdate()
},
// 确定回调事件
hiddenLevenConfirm(e) {
this.isUps = false;
this.pd.HIDDENLEVEL = e[0].id;
this.pd.HIDDENLEVELNAME = e[0].name;
this.$forceUpdate()
},
// 取消回调事件
hiddentrddeeCancel(e) {
this.isUps = false;
},
showHiddenType1TreeTree(type) {
var dicID = '3babc15144444bdc8d763d0af2bdfff6'
if ('2' == type) {
dicID = '18c0a9aea6e54feab9f4ab3f46e0bc86'
}
var _this = this;
if (_this.hiddenTypeList) {
uni.request({
method: 'POST',
dataType: 'json',
header: {
'Content-type': 'application/x-www-form-urlencoded'
},
url: basePath + '/dictionaries/listSelectTreeByTkiTree?tm=' + new Date().getTime(),
data: {
DICTIONARIES_ID: dicID
},
success: function(res) {
var jons = res.data.zTreeNodes;
_this.hiddenTypeList = JSON.parse(jons);
}
});
}
this.isUps = false
if ('1' == type) {
this.$refs.hiddenType1Tree._show();
}
if ('2' == type) {
this.$refs.hiddenType2Tree._show();
}
},
hiddenType1Confirm(e) {
this.$set(this.pd, 'HIDDENTYPENAME', e[0].name)
this.$set(this.pd, 'HIDDENTYPE', e[0].id)
this.isUps = false;
},
hiddenType1Cancel() {
this.isUps = false;
},
hiddenType2Confirm(e) {
this.$set(this.pd, 'HIDDENTYPENAME2', e[0].name)
this.$set(this.pd, 'HIDDENTYPE2', e[0].id)
this.isUps = false;
},
hiddenType2Cancel() {
this.isUps = false;
},
changeDiscoverDate(e) {
this.pd.DISCOVERYTIME = e
this.$forceUpdate(); //强制刷新
},
myOther() {
var _this = this;
let o = {
"DEPARTMENT_ID": loginUser.DEPARTMENT_ID,
"USER_ID": loginUser.USER_ID,
"DEPARTMENT_NAME": loginUser.DEPARTMENT_NAME,
"USER_NAME": loginUser.NAME,
index: -1
};
_this.other.push(o);
let index = _this.other.length - 1;
_this.otherUserList[index] = [];
},
addOther() {
var _this = this;
let o = {
"DEPARTMENT_ID": '',
"USER_ID": '',
"DEPARTMENT_NAME": '',
"USER_NAME": '',
index: -1
};
_this.other.push(o);
let index = _this.other.length - 1;
_this.otherUserList[index] = [];
},
showConTree(index) {
this.$refs['tkiConfirmTree' + index][0]._show();
},
contreeConfirm(e, index) {
this.other[index].DEPARTMENT_ID = e[0].id;
this.other[index].DEPARTMENT_NAME = e[0].name;
this.other[index].USER_ID = '';
this.other[index].USER_NAME = '';
this.other[index].index = -1;
this.getConUserList(this.other[index].DEPARTMENT_ID, index);
this.$forceUpdate(); //强制刷新
},
getConUserList(DEPARTMENT_ID, i) {
//发送 post 请求
var _this = this;
uni.request({
method: 'POST',
dataType: 'json',
header: {
'Content-type': 'application/x-www-form-urlencoded'
},
url: basePath + '/app/sys/listUser',
data: {
DEPARTMENT_ID: DEPARTMENT_ID,
NOMAIN: '1',
LOGINUSERID: loginUser.USER_ID,
NOSELF: '1',
tm: new Date().getTime()
},
success: function(res) {
if ("success" == res.data.result) {
if (i > -1) {
_this.otherUserList[i] = [];
_this.otherUserList[i] = res.data.userList;
_this.$forceUpdate(); //强制刷新
} else {
_this.rectificationUserList = res.data.userList;
}
} else {
uni.showToast({
title: res.data.message,
duration: 2000
});
}
}
})
},
haveUser(e) {
if (e == null || e.length == 0) {
uni.showToast({
icon: "none",
title: '请先选择有人员的部门',
duration: 2000
});
}
},
PickerYsr(e, index) {
this.other[index].index = e.detail.value;
this.other[index].USER_ID = this.otherUserList[index][e.detail.value] ? this.otherUserList[index][e.detail
.value
].USER_ID : '';
this.other[index].USER_NAME = this.otherUserList[index][e.detail.value] ? this.otherUserList[index][e
.detail.value
].NAME : '';
this.$forceUpdate(); //强制刷新
},
removeOther(index) {
this.other.splice(index, 1);
this.otherUserList.splice(index, 1);
},
showConTreeTree() {
this.isUps = false
this.$refs.confirmTree._show();
},
getConfirmUser(e) {
this.isUps = false;
//发送 post 请求
var _this = this;
uni.request({
method: 'POST',
dataType: 'json',
header: {
'Content-type': 'application/x-www-form-urlencoded'
},
url: basePath + '/app/user/getHiddenConfirm',
data: {
corpinfoId: corpinfoId,
tm: new Date().getTime()
},
success: function(res) {
if ("success" == res.data.result) {
_this.confirUserAllList = res.data.userList;
_this.$forceUpdate(); //强制刷新
} else {
uni.showToast({
title: res.data.message,
duration: 2000
});
}
}
})
},
setConUser(e) {
var index = e.detail.value;
this.pd.conUserId = this.confirUserAllList[index].USER_ID;
this.pd.conUserName = this.confirUserAllList[index].NAME;
this.$forceUpdate(); //强制刷新
},
showHiddenRegionTree() {
var _this = this
uni.request({
method: 'POST',
dataType: 'json',
header: {
'Content-type': 'application/x-www-form-urlencoded'
},
url: basePath + '/app/hidden/getTreehiddenRegionListAll',
data: {
CORPINFO_ID: corpinfoId,
tm: new Date().getTime()
},
success: function(res) {
if ("success" == res.data.result) {
var json = res.data.zTreeNodes
_this.hiddenRegionTreeList = JSON.parse(json);
_this.$forceUpdate(); //强制刷新
} else {
uni.showToast({
title: res.data.message,
duration: 2000
});
}
}
})
this.isUps = false
this.$refs.hiddenRegionTree._show();
},
hiddenRegionTreeCon(e) {
this.isUps = false;
this.pd.hregionName = e[0].name;
this.pd.HIDDENPART = e[0].id;
this.$forceUpdate(); //强制刷新
},
DelVideo(e) {
uni.showModal({
title: '秦港-双基双控',
content: '确定要删除这个视频吗?',
cancelColor: "#000000",
cancelText: '取消',
confirmText: '确定',
success: res => {
if (res.confirm) {
this.videoList = []
}
}
})
},
chooseVideo(e) {
var _this = this;
uni.chooseVideo({
maxDuration: 60,
count: 1, //默认9
// sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
sourceType: ['camera', 'album'], //从相册选择
success: (res) => {
console.info(res)
if (e == 0) {
let img = {};
img.id = '';
img.filePath = res.tempFilePath;
this.videoList.push(img)
} else {
let img = {};
img.id = '';
img.filePath = res.tempFilePaths[0];
this.videoList.push(img)
}
}
});
},
/** 坐标定位 */
showMapModal() {
var _this = this
uni.navigateTo({
url: '/pages/map/mapPro',
events: {
// 为指定事件添加一个监听器,获取被打开页面传送到当前页面的数据
acceptDataFromOpenedPage: function(e) {
_this.pd.LONGITUDE = e.data.longitue;
_this.pd.LATITUDE = e.data.latitude;
}
},
})
},
playVideo(e) {
this.videoSrc = e.currentTarget.dataset.src
this.modalShow = true
},
getFireDeviceType() {
var _this = this;
uni.showLoading({
title: '请稍候'
})
uni.request({
url: basePath + '/app/fireRecordManger/getStandardListByType',
method: 'POST',
dataType: 'json',
header: {
'Content-type': 'application/x-www-form-urlencoded'
},
data: {
FIRE_DEVICE_TYPE_LIST: _this.FIRE_DEVICE_TYPE_ID,
},
success: (res) => {
if ("success" == res.data.result) {
uni.hideLoading();
_this.fireDeviceTypeList = res.data.varList;
this.pd.CHECK_CONTENT = '请选择'
this.$forceUpdate()
} else {
uni.showToast({
title: res.data.message,
duration: 2000
});
}
}
});
},
fireDeviceTypeChange(e) {
const value = e.detail.value || 0
this.$set(this.pd, 'CHECK_CONTENT_INDEX', value);
this.$set(this.pd, 'CHECK_CONTENT', this.fireDeviceTypeList[value].FIRE_CHECK_STANDARD_ITEM);
this.$set(this.pd, 'CHECK_CONTENT_ID', this.fireDeviceTypeList[value].FIRE_CHECK_STANDARD_ID);
this.$forceUpdate()
}
/*/!** 坐标定位 *!/
showMapModal() {
var _this = this
uni.navigateTo({
url: '/pages/map/map',
events: {
// 为指定事件添加一个监听器,获取被打开页面传送到当前页面的数据
acceptDataFromOpenedPage: function (e) {
// console.log(e.data)
// console.info(e.data.longitue)
_this.form.WORK_LONGITUDE = e.data.longitue;
_this.form.WORK_LATITUDE = e.data.latitude;
// console.info(_this.pd)
}
},
})
}*/
}
}
</script>
<style>
.prevent {
width: 100%;
height: 100%;
position: fixed;
top: 0;
left: 0;
overflow: hidden;
}
.cu-form-title {
padding: 20 upx 0;
}
.cu-form-textarea {
background-color: #ffffff;
padding: 1 upx 30 upx 20 upx;
min-height: 100 upx;
}
.cu-form-textarea textarea {
height: 4.6em;
width: 100%;
line-height: 1.2em;
flex: 1;
font-size: 28 upx;
padding: 0;
}
.selected {
display: flex;
align-items: center;
height: 100 upx;
}
.selected .radio {
transform: scale(0.8);
margin-right: 10 upx;
}
.group {
display: flex;
align-items: center;
}
.cu-form-group .title {
font-size: 28 upx;
color: #666;
}
.cu-bar .action:first-child {
font-size: 28 upx;
}
.cu-form-title:before {
content: "*";
color: red;
vertical-align: sub;
margin-right: 5px;
}
.asterisk:before {
content: "*";
color: red;
vertical-align: sub;
margin-right: 5px;
}
</style>