850 lines
24 KiB
Vue
850 lines
24 KiB
Vue
|
<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-textarea">
|
||
|
<view class="cu-form-title">检查内容</view>
|
||
|
<view class="f24 text-black">
|
||
|
{{pd.CHECK_CONTENT}}
|
||
|
</view>
|
||
|
</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-type="0" :data-url="imgList[index].filePath">
|
||
|
<image :src="imgList[index].filePath" mode="aspectFill"></image>
|
||
|
<view 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">
|
||
|
<text class='cuIcon-cameraadd'></text>
|
||
|
</view>
|
||
|
</view>
|
||
|
</view>
|
||
|
<view class="cu-form-textarea margin-top">
|
||
|
<view class="cu-form-title">隐患描述</view>
|
||
|
<textarea maxlength="-1" :disabled="modalName!=null" v-model="pd.HIDDENDESCR" placeholder="请对隐患进行详细描述(必填项)"></textarea>
|
||
|
</view>
|
||
|
<view class="cu-form-textarea margin-top">
|
||
|
<view class="cu-form-title">隐患部位</view>
|
||
|
<textarea maxlength="-1" :disabled="modalName!=null" v-model="pd.HIDDENPART" placeholder="请对隐患部位进行详细描述(必填项)"></textarea>
|
||
|
</view>
|
||
|
<view class="cu-form-group margin-top">
|
||
|
<view class="title">隐患级别</view>
|
||
|
<picker @change="levelPickerChange" :value="lindex" :range="levelList" range-key="NAME">
|
||
|
<view class="picker">
|
||
|
{{pd.HIDDENLEVELNAME?pd.HIDDENLEVELNAME:'请选择'}}
|
||
|
</view>
|
||
|
</picker>
|
||
|
</view>
|
||
|
<view class="cu-form-group margin-top">
|
||
|
<view class="title">隐患类型</view>
|
||
|
<picker @change="typePickerChange" :value="tindex" :range="hiddenTypeList" range-key="NAME">
|
||
|
<view class="picker">
|
||
|
{{pd.HIDDENTYPENAME?pd.HIDDENTYPENAME:'请选择'}}
|
||
|
</view>
|
||
|
</picker>
|
||
|
</view>
|
||
|
|
||
|
<!-- <view class="cu-form-group margin-top">-->
|
||
|
<!-- <view class="title">验收部门</view>-->
|
||
|
<!-- <view class="picker" @tap="showYsTree">{{pd.CHECKDEPTNAME?pd.CHECKDEPTNAME:'请选择'}}</view>-->
|
||
|
<!-- <tki-tree ref="tkiTree1"-->
|
||
|
<!-- :selectParent=true-->
|
||
|
<!-- :range="treeNode"-->
|
||
|
<!-- rangeKey="name"-->
|
||
|
<!-- @confirm="ystreeConfirm"></tki-tree>-->
|
||
|
<!-- </view>-->
|
||
|
|
||
|
<view class="cu-form-group margin-top">
|
||
|
<view class="title">是否立即整改</view>
|
||
|
<radio-group class="selected">
|
||
|
<view class="group mr20">
|
||
|
<radio :disabled="pd.HIDDENLEVEL == 'hiddenLevel0002'" class='radio' value="1" :checked="RECTIFICATIONTYPE==1" @click="radioType(1)"></radio>
|
||
|
<text>是</text>
|
||
|
</view>
|
||
|
<view class="group">
|
||
|
<radio :disabled="pd.HIDDENLEVEL == 'hiddenLevel0002'" 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">
|
||
|
<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">
|
||
|
<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">
|
||
|
<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-textarea margin-top" v-if="RECTIFICATIONTYPE==1">
|
||
|
<view class="cu-form-title">整改描述</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">
|
||
|
整改后图片
|
||
|
</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 class="padding flex flex-direction">
|
||
|
<button class="cu-btn bg-blue margin-tb-sm lg" @click="$noMultipleClicks(goSubmit)">提交</button>
|
||
|
</view>
|
||
|
</scroll-view>
|
||
|
</view>
|
||
|
</template>
|
||
|
|
||
|
<script>
|
||
|
import {
|
||
|
basePath,corpinfoId,deptId,loginUser,formatDate,loginSession,baseImgPath
|
||
|
} from '@/common/tool.js';
|
||
|
import tkiTree from "@/components/select-tree/select-tree.vue"
|
||
|
import gcoord from '@/common/gcoord.js'
|
||
|
export default {
|
||
|
components: {
|
||
|
tkiTree
|
||
|
},
|
||
|
data() {
|
||
|
return {
|
||
|
isUps:false,
|
||
|
msg:'add',
|
||
|
riskId:'',
|
||
|
itemId:'',
|
||
|
index:'',
|
||
|
noClick:true,
|
||
|
pd:[{"RECTIFICATIONTYPE":2}],
|
||
|
imgList: [],
|
||
|
imgList1: [],
|
||
|
HIDDENDESCR:'',//隐患描述
|
||
|
HIDDENPART:'',//隐患部位
|
||
|
modalName: null,
|
||
|
id:'',
|
||
|
CHECK_CONTENT:'',
|
||
|
checkId:'',
|
||
|
RECTIFYDESCR:'',//整改描述
|
||
|
RECTIFICATIONTYPE:2,//是否立即
|
||
|
treeNode:[],//部门下拉数据
|
||
|
RECTIFICATIONDEPT:'',//整改部门
|
||
|
RECTIFICATIONDEPTNAME:'请选择',//整改部门
|
||
|
CHECKDEPT:'',//验收部门
|
||
|
CHECKDEPTNAME:'请选择',//验收部门
|
||
|
rectificationUserList:[],
|
||
|
RECTIFICATIONOR:'',//整改人
|
||
|
uindex: -1,
|
||
|
lindex: -1,
|
||
|
levelList:[],
|
||
|
tindex: -1,
|
||
|
hiddenTypeList:[],
|
||
|
HIDDENLEVEL:'',//隐患级别
|
||
|
RECTIFICATIONDEADLINE:'',//整改期限
|
||
|
rectifyPlanCompletionStartTime:'',
|
||
|
LISTMANAGER_ID:'',
|
||
|
CHECKRECORD_ID:''
|
||
|
}
|
||
|
},
|
||
|
onLoad(event){
|
||
|
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.CHECKRECORD_ID = event.CHECKRECORD_ID;
|
||
|
if(this.pd.HIDDEN_ID){
|
||
|
this.msg="edit";
|
||
|
this.getData();
|
||
|
}else {
|
||
|
// this.pd.CHECK_CONTENT = JSON.parse(decodeURIComponent(event.checkContent));
|
||
|
// this.riskId = JSON.parse(decodeURIComponent(event.riskId));
|
||
|
// this.itemId = JSON.parse(decodeURIComponent(event.itemId));
|
||
|
// this.index = event.index;
|
||
|
this.LISTMANAGER_ID = event.listId;
|
||
|
}
|
||
|
this.getDept();
|
||
|
this.getLevel();
|
||
|
this.getHiddenType();
|
||
|
loginSession();
|
||
|
},
|
||
|
methods: {
|
||
|
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.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+files[i].FILEPATH;
|
||
|
img.id=files[i].IMGFILES_ID;
|
||
|
_this.imgList1.push(img);
|
||
|
}
|
||
|
_this.getUserList();
|
||
|
} 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.uindex=-1;
|
||
|
this.pd.RECTIFICATIONOR='';
|
||
|
this.pd.RECTIFICATIONORNAME='';
|
||
|
this.$forceUpdate();//强制刷新
|
||
|
this.getUserList();
|
||
|
},
|
||
|
// 取消回调事件
|
||
|
zgtreeCancel(e) {
|
||
|
this.isUps=false;
|
||
|
},
|
||
|
// 显示树形选择器
|
||
|
showZgTree() {
|
||
|
this.isUps=true
|
||
|
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,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;
|
||
|
if(this.pd.HIDDENLEVEL == 'hiddenLevel0002'){
|
||
|
this.RECTIFICATIONTYPE = '2'
|
||
|
}
|
||
|
this.$forceUpdate();//强制刷新
|
||
|
},
|
||
|
getHiddenType: 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: '3babc15144444bdc8d763d0af2bdfff6'},
|
||
|
dataType: 'json',
|
||
|
success: function (res) {
|
||
|
_this.hiddenTypeList = res.data.list;
|
||
|
}
|
||
|
});
|
||
|
},
|
||
|
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();//强制刷新
|
||
|
},
|
||
|
//图片上传
|
||
|
ChooseImage(e) {
|
||
|
var _this = this;
|
||
|
var ss=4-this.imgList.length;
|
||
|
uni.chooseImage({
|
||
|
count: ss, //默认9
|
||
|
sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
|
||
|
sourceType: ['camera','album'], //从相册选择
|
||
|
success: (res) => {
|
||
|
for (let i = 0; i < res.tempFilePaths.length; i++) {
|
||
|
if(e==0) {
|
||
|
let img={};
|
||
|
img.id='';
|
||
|
img.filePath=res.tempFilePaths[i];
|
||
|
this.imgList.push(img)
|
||
|
}else{
|
||
|
let img={};
|
||
|
img.id='';
|
||
|
img.filePath=res.tempFilePaths[i];
|
||
|
this.imgList1.push(img)
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
});
|
||
|
},
|
||
|
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.CHECKDEPT) {
|
||
|
// 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.HIDDENPART) {
|
||
|
uni.showToast({
|
||
|
icon: 'none',
|
||
|
title: '请填隐患部位',
|
||
|
duration: 1500
|
||
|
});
|
||
|
return;
|
||
|
}
|
||
|
if (!_this.pd.HIDDENLEVEL) {
|
||
|
uni.showToast({
|
||
|
icon: 'none',
|
||
|
title: '请选择隐患级别',
|
||
|
duration: 1500
|
||
|
});
|
||
|
return;
|
||
|
}
|
||
|
if (!_this.pd.HIDDENTYPE) {
|
||
|
uni.showToast({
|
||
|
icon: 'none',
|
||
|
title: '请选择隐患类型',
|
||
|
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.RECTIFICATIONTYPE == 2 && !_this.pd.RECTIFICATIONDEPT) {
|
||
|
uni.showToast({
|
||
|
icon: 'none',
|
||
|
title: '请选择整改部门',
|
||
|
duration: 1500
|
||
|
});
|
||
|
return;
|
||
|
}
|
||
|
if (_this.RECTIFICATIONTYPE == 2 && !_this.pd.RECTIFICATIONOR) {
|
||
|
uni.showToast({
|
||
|
icon: 'none',
|
||
|
title: '请选择整改人',
|
||
|
duration: 1500
|
||
|
});
|
||
|
return;
|
||
|
}
|
||
|
if (_this.RECTIFICATIONTYPE == 2 && !_this.pd.RECTIFICATIONDEADLINE) {
|
||
|
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);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
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];
|
||
|
if(_this.index) {
|
||
|
prePage.$vm.initflag = true; // A 页面 init方法 为true
|
||
|
// prePage.$vm.list[_this.index].ISNORMAL = 1;
|
||
|
// prePage.$vm.list[_this.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,
|
||
|
'CORPINFO_ID':corpinfoId
|
||
|
},
|
||
|
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.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 请求提交保存
|
||
|
uni.request({
|
||
|
url: basePath+'/app/hidden/appAdd',
|
||
|
method: 'POST',
|
||
|
dataType: 'json',
|
||
|
header: {
|
||
|
'Content-type':'application/x-www-form-urlencoded'
|
||
|
},
|
||
|
data: {
|
||
|
HIDDEN_ID:_this.pd.HIDDEN_ID,
|
||
|
SOURCE:'1',
|
||
|
//STATE:'1',
|
||
|
HIDDENDESCR:_this.pd.HIDDENDESCR,
|
||
|
HIDDENPART:_this.pd.HIDDENPART,
|
||
|
LATITUDE:latitude,
|
||
|
LONGITUDE:longitude,
|
||
|
RECTIFYDESCR:_this.pd.RECTIFYDESCR?_this.pd.RECTIFYDESCR:'',
|
||
|
RECTIFICATIONDEADLINE:_this.pd.RECTIFICATIONDEADLINE?_this.pd.RECTIFICATIONDEADLINE:'',
|
||
|
RECTIFICATIONTYPE:_this.RECTIFICATIONTYPE,
|
||
|
RECTIFICATIONOR:_this.pd.RECTIFICATIONOR,
|
||
|
RECTIFICATIONORNAME: _this.pd.RECTIFICATIONORNAME,
|
||
|
HIDDENTYPE:_this.pd.HIDDENTYPE,
|
||
|
HIDDENLEVEL:_this.pd.HIDDENLEVEL,
|
||
|
RECTIFICATIONDEPT:_this.pd.RECTIFICATIONDEPT,
|
||
|
RECTIFICATIONDEPTNAME: _this.pd.RECTIFICATIONDEPTNAME,
|
||
|
// CHECKDEPT:_this.pd.CHECKDEPT?_this.pd.CHECKDEPT:'',
|
||
|
// CHECK_CONTENT:_this.pd.CHECK_CONTENT,
|
||
|
CORPINFO_ID:corpinfoId,
|
||
|
HIDDENFINDDEPT:deptId,
|
||
|
HIDDENFINDDEPTNAME: loginUser.DEPARTMENT_NAME,
|
||
|
CREATOR:loginUser.USER_ID,
|
||
|
CREATORNAME: loginUser.NAME,
|
||
|
// RECORDITEM_ID:_this.itemId,
|
||
|
// RISKITEM_ID:_this.riskId,
|
||
|
},
|
||
|
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({
|
||
|
title: res.data.msaesge,
|
||
|
duration: 2000
|
||
|
});
|
||
|
}
|
||
|
}
|
||
|
});
|
||
|
},
|
||
|
fail: function(res){
|
||
|
uni.hideLoading();
|
||
|
uni.showToast({
|
||
|
title: "获取位置失败",
|
||
|
duration: 2000
|
||
|
});
|
||
|
}
|
||
|
});
|
||
|
|
||
|
});
|
||
|
},
|
||
|
radioType(e){
|
||
|
if(this.pd.HIDDENLEVEL != 'hiddenLevel0002'){
|
||
|
this.RECTIFICATIONTYPE = e
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
</script>
|
||
|
|
||
|
<style>
|
||
|
.prevent {
|
||
|
width: 100%;
|
||
|
height: 100%;
|
||
|
position: fixed;
|
||
|
top: 0;
|
||
|
left: 0;
|
||
|
overflow: hidden;
|
||
|
}
|
||
|
.cu-form-title{
|
||
|
padding: 20upx 0;
|
||
|
}
|
||
|
.cu-form-textarea{
|
||
|
background-color: #ffffff;
|
||
|
padding: 1upx 30upx 20upx;
|
||
|
min-height: 100upx;
|
||
|
}
|
||
|
.cu-form-textarea textarea {
|
||
|
height: 4.6em;
|
||
|
width: 100%;
|
||
|
line-height: 1.2em;
|
||
|
flex: 1;
|
||
|
font-size: 28upx;
|
||
|
padding: 0;
|
||
|
}
|
||
|
.selected{
|
||
|
display: flex;
|
||
|
align-items: center;
|
||
|
height: 100upx;
|
||
|
}
|
||
|
.selected .radio{
|
||
|
transform:scale(0.8);
|
||
|
margin-right: 10upx;
|
||
|
}
|
||
|
.group{
|
||
|
display: flex;
|
||
|
align-items: center;
|
||
|
}
|
||
|
.cu-form-group .title{
|
||
|
font-size: 28upx;
|
||
|
font-weight: bold;
|
||
|
}
|
||
|
.cu-bar .action:first-child {
|
||
|
font-size: 28upx;
|
||
|
}
|
||
|
.cu-form-group .picker{
|
||
|
color: #808080;
|
||
|
}
|
||
|
.picker-tree{
|
||
|
color: #808080;
|
||
|
}
|
||
|
</style>
|