1382 lines
36 KiB
Vue
Raw Normal View History

<template>
<view class="fullHeight addExamine">
<view class="fixedheader">
<headers :themeType="true" :showBack="true">
<view class="headerName">
{{headerTitle}}
</view>
<!-- <view class="header-btn" @tap="previewRecord" v-if="pageType == 1">
隐患记录
</view> -->
</headers>
</view>
<scroll-view class="smallHeight" :class="{'p-0': pageType == 4||pageType == 5}"
:style="{ 'padding-top': (statusBarHeight + 45) * 1.5 + 'rpx' }" scroll-y>
<view class="addExamine-form">
<view class="form-box">
<view class="form-title b-bottom">
上报安全隐患
</view>
<view class="b-bottom" v-if="addForm.status == 1 && addForm.status == 2 || pageType == 1">
<view class="form-item flex">
<view class="form-lable"><text>是否需要整改</text></view>
<radio-group class="flex" @change="radioChange">
<label class="uni-list-cell uni-list-cell-pd flex" v-for="(item, index) in radioOptions"
:key="index">
<radio :disabled="isDisabled" :value="item.id"
:checked="addForm.status === item.id" />
<view>{{item.name}}</view>
</label>
</radio-group>
</view>
</view>
<view class="b-bottom" v-if="addForm.status != 1">
<view class="form-item flex">
<view class="form-lable">*<text>隐患类别</text></view>
<view class="text" @click="checkDanger">
<text>{{addForm.examineEntry !=''? addForm.examineEntry : "--请选择隐患--"}}</text>
</view>
</view>
</view>
<view class="b-bottom" v-if="addForm.status != 1">
<view class="form-item flex">
<view class="form-lable"><text>检查项目</text></view>
<view class="text">
<text>{{addForm.examineProject}}</text>
</view>
</view>
</view>
<!-- <view class="b-bottom" v-if="addForm.status != 1"> -->
<view class="b-bottom">
<view class="form-item flex">
<!-- <view class="form-lable"><text>检查时间</text></view> -->
<view class="form-lable">*<text>检查时间</text></view>
<!-- <picker class="form-content" :disabled="isDisabled" mode="date" :value="addForm.inspectTime"
:start="startDate" @change="bindCheckDateChange">
<view class="uni-input">
<text class="uni-input2" v-if="addForm.inspectTime ===''">请选择检查时间</text>
<text v-else>{{addForm.inspectTime}}</text>
<uni-icons2 v-if="!isDisabled" type="arrowright" color="#6C7178" />
</view>
</picker> -->
<dateTimePicker :placeholder="'请选择检查时间'" :disabled="isDisabled"
:start="startTime" :fields="'minute'" :default-value="addForm.inspectTime"
@change="bindPickerChange($event,'startTime')"
class="form-content">
<view class="uni-input">
<!-- <text>{{addForm.inspectTime}}</text> -->
<uni-icons2 v-if="!isDisabled" type="arrowright" color="#6C7178" />
</view>
</dateTimePicker>
</view>
</view>
<view class="b-bottom" v-if="addForm.status != 1">
<view class="form-item flex">
<view class="form-lable"><text>隐患内容</text></view>
<view class="form-textarea">
<textarea :disabled="isDisabled" :value="addForm.examineContent"
@blur="bindTextAreaBlur" />
</view>
</view>
</view>
<view class="b-bottom" v-if="addForm.status != 1">
<view class="form-item flex">
<view class="form-lable"><text>整改要求</text></view>
<view class="form-textarea">
<textarea :disabled="isDisabled" :value="addForm.requestContent"
@blur="bindTextAreaBlur2" />
</view>
</view>
</view>
<view class="b-bottom" v-if="addForm.status != 1">
<view class="form-item flex">
<view class="form-lable"><text>隐患等级</text></view>
<view class="text">
<text>{{addForm.examineLv}}</text>
</view>
</view>
</view>
<view class="b-bottom">
<view class="form-item flex">
<view class="form-lable">*<text>检查类型</text></view>
<picker class="form-content" :disabled="isDisabled" :value="addForm.type"
range-key="inspectTypeName" :range="typeList" @change="bindExamineType">
<view class="uni-input" :class="{'noCheck': !addForm.type.toString()}">
{{addForm.type.toString() ? typeList[addForm.type].inspectTypeName : "请选择检查类型"}}
<uni-icons2 v-if="!isDisabled" type="arrowright" color="#6C7178" />
</view>
</picker>
</view>
</view>
<view class="b-bottom" v-if="addForm.status != 1">
<view class="form-item flex">
<view class="form-lable">*<text>事故隐患等级</text></view>
<picker class="form-content" :disabled="isDisabled" :value="addForm.faultLevel"
range-key="name" :range="faultLevelList" @change="bindfaultLevel">
<view class="uni-input" :class="{'noCheck': !addForm.faultLevel.toString()}">
{{addForm.faultLevel.toString() ? faultLevelList[addForm.faultLevel].name : "请选择事故隐患等级"}}
<uni-icons2 v-if="!isDisabled" type="arrowright" color="#6C7178" />
</view>
</picker>
</view>
</view>
<view class="b-b ottom" v-if="addForm.status != 1">
<view class="form-item flex">
<view class="form-lable">*<text>责任区域</text></view>
<picker @click="openDutyArea" :disabled="true" class="picker">
<view class="uni-input uni-select cl" v-if="hiddenDangerInspectRegionName == ''">
请选择 <image class="icon-down" src="/static/icon-down-black.png"></image>
</view>
<view class="uni-input uni-select flex2" v-else>
<view style="width: 98%;white-space: nowrap;" class="ellipsis">
{{hiddenDangerInspectRegionName }}</view>
</view>
</picker>
</view>
</view>
<view class="b-bottom">
<view class="form-item flex">
<view class="form-lable">
<view v-if="addForm.status == 1" style="display: inline;">*</view><text>详细位置</text>
</view>
<view class="form-input">
<input :disabled="isDisabled" :value="addForm.address" @blur="bindAddress" type="text"
placeholder="输入详细位置信息" />
</view>
</view>
</view>
<view class="b-bottom" v-if="addForm.status != 1">
<view class="form-item flex">
<view class="form-lable">*<text>整改责任人</text></view>
<picker class="form-content" :disabled="isDisabled" :value="addForm.dutyPeople"
range-key="realName" :range="dutyPeopleList" @change="bindPeopleId">
<view class="uni-input" :class="{'noCheck': !addForm.dutyPeople.toString()}">
{{addForm.dutyPeople.toString() ? dutyPeopleList[addForm.dutyPeople].realName : "请选择整改责任人"}}
<uni-icons2 v-if="!isDisabled" type="arrowright" color="#6C7178" />
</view>
</picker>
</view>
</view>
<view class="b-bottom" v-if="addForm.status != 1">
<view class="form-item flex">
<view class="form-lable"><text>整改单位</text></view>
<picker class="form-content" :disabled="isDisabled" :value="addForm.dutyUnit"
range-key="enterpriseName" :range="dutyUnitList" @change="bindDutyUnit">
<view class="uni-input" :class="{'noCheck': !addForm.dutyUnit.toString()}">
{{addForm.dutyUnit.toString() ? dutyUnitList[addForm.dutyUnit].enterpriseName : "请选择整改单位"}}
<uni-icons2 v-if="!isDisabled" type="arrowright" color="#6C7178" />
</view>
</picker>
</view>
</view>
<view class="b-bottom" v-if="addForm.status != 1">
<view class="form-item flex">
<view class="form-lable"><text>要求完成时间</text></view>
<!-- <picker class="form-content" :disabled="isDisabled" mode="date" :value="addForm.date"
:start="startDate" @change="bindDateChange">
<view class="uni-input">
{{addForm.date}}
<uni-icons2 v-if="!isDisabled" type="arrowright" color="#6C7178" />
</view>
</picker> -->
<dateTimePicker :placeholder="startTime" :disabled="isDisabled"
:start="startTime" fields="minute" :default-value="addForm.date"
@change="bindPickerChange($event,'startTime2')" class="form-content">
<view class="uni-input">
<!-- <text>{{addForm.date}}</text> -->
<uni-icons2 v-if="!isDisabled" type="arrowright" color="#6C7178" />
</view>
</dateTimePicker>
</view>
</view>
<view class="b-bottom">
<view class="form-item flex">
<view class="form-lable"><text>补充说明</text></view>
<view class="form-textarea">
<textarea :disabled="isDisabled" :value="addForm.remark" @blur="bindRemarksBlur" />
</view>
</view>
</view>
<view class="form-item flex f-column a-start">
<view class="form-lable">
<view v-if="addForm.status == 1" style="display: inline;">*</view><text>图片</text>
</view>
<view class="uni-form-input imgBox_wrap">
<view class="addImgBox" @click="uploadImg" v-if="!isDisabled">
<image src="/static/safeMange/upload_image.png" class="icon-add" color="#F56C6C">
</image>
</view>
<view class="imgBox" v-show="addForm.imgFileList.length>0"
v-for="(item,index) in addForm.imgFileList" :key="index">
<image :src="url_config+'image/'+item.url" class="img"
@click="previewImage(url_config+'image/'+item.url)"></image>
<view v-if="!isDisabled" @click="deleteImg(item,1)" class="deleteImg">
<image src="/static/safeMange/close_icon.png" color="#F56C6C"></image>
</view>
</view>
</view>
</view>
</view>
</view>
<reply-list :replyData="replyData" v-if="replyData.length > 0"></reply-list>
</scroll-view>
<view class="btn-box" v-if="pageType != 4&&pageType != 5">
<view class="submit-btn" v-if="pageType != 3" @click="submitForm">{{btnTitle}}</view>
<view class="btn-box" v-if="pageType == 3">
<view class="cancle-btn" @click="showDialog(1)">驳回</view>
<view class="pass-btn" @click="showDialog(2)">通过</view>
</view>
</view>
<dialogs class="formDialog" ref="dialogs">
<template v-slot:content>
<view class="dialog-title">
复查情况
</view>
<view class="dialog-content">
<view class="form-textarea">
<textarea placeholder="请输入复查情况" @blur="bindContentBlur" />
</view>
</view>
<view class="dialog-btn">
<view class="cancle-btn" @click="cancleReply">取消</view>
<view class="primary-btn" @click="submitReply">提交</view>
</view>
</template>
</dialogs>
<!-- 丢到文档流外避免占空间 -->
<view>
<!-- 隐患区域 -->
<tki-tree ref="locationTree" @confirm="(val)=>checkPointBtn(val,1)" idKey='id' :range="checkPointList"
rangeKey="regionName" confirmColor="#4e8af7" :selectParent="true" />
<canversCom v-if="openImg" @imgUrl="imgUrl" :imgList="imgList"></canversCom>
</view>
<levitatedsphere :x="100" :y="80"></levitatedsphere>
</view>
</template>
<script>
import levitatedsphere from "@/components/levitatedsphere/levitatedsphere.vue"
import canversCom from "@/pages/videoManage/component/canversCom.vue"
import tkiTree from "@/components/tki-tree/tki-tree.vue"
import headers from '../../../components/headers/headers.vue';
import replyList from './replyList.vue';
import dialogs from '../../../components/dialog/dialog.vue'
import dateTimePicker from '@/components/dateTimePicker/index.vue'
export default {
data() {
return {
startTime: this.getDate({
format: true,
}),
checkPointList: [],
hiddenDangerInspectRegionId: "",
hiddenDangerInspectRegionName: "",
imgList: {},
openImg: false,
headerTitle: "隐患上报",
statusBarHeight: 0,
typeList: [],
dutyPeopleList: [],
dutyUnitList: [],
engineeringId: "",
faultLevelList: [{
id: 1,
name: "一般"
}, {
id: 2,
name: "重大"
}],
radioOptions: [{
id: "1",
name: "无需整改"
}, {
id: "2",
name: "待整改"
}],
addForm: {
type: "",
typeId: "",
examineProject: "",
examineEntry: "",
examineContent: "",
examineLv: "",
requestContent: "",
address: "",
date: this.getDate({
format: true,
}),
imgFileList: [],
dutyPeople: "",
dutyPeopleId: "",
dutyUnit: "",
enterpriseSn: "",
faultLevel: "",
status: "2",
remark: "",
taskId: '',
itemId: '',
//inspectTime: this.getDate({
//format: true,
//}),
inspectTime: ''
},
pageType: 1,
replyData: [],
btnTitle: "保存",
projectSn: "",
userId: "",
isDisabled: false,
datailData: {},
reviewStatus: 1,
reviewContent: "",
taskId: "",
itemId: "",
base64Image: '',
moduleType: ''
}
},
computed: {
startDate() {
return this.getDate('start');
}
},
components: {
headers,
replyList,
dialogs,
canversCom,
tkiTree,
dateTimePicker
},
onShow() {
this.statusBarHeight = uni.getStorageSync('systemInfo').statusBarHeight;
this.projectSn = JSON.parse(uni.getStorageSync('userInfo')).sn
this.userId = JSON.parse(uni.getStorageSync('userInfo')).userId
this.queryTypeList()
this.queryUserData()
this.getSubpackageLsit()
if (uni.getStorageSync('dangerData')) {
let dangerData = uni.getStorageSync('dangerData')
this.addForm.examineContent = dangerData.checkContent
this.addForm.examineLv = dangerData.hiddenDangerLevel
this.addForm.requestContent = dangerData.rectifyRequire
this.addForm.examineProject = dangerData.hiddenDangerName
this.addForm.examineEntry = dangerData.title
console.log(uni.getStorageSync('dangerData'), '-----检查项列表带回数据')
}
if (uni.getStorageSync('detailData')) {
let data = ""
this.datailData = data = uni.getStorageSync('detailData');
console.log('带回的数据', uni.getStorageSync('detailData'));
this.addForm.examineContent = data.checkContent
this.addForm.examineLv = data.hiddenDangerLevel
this.addForm.requestContent = data.rectifyRequire
this.addForm.examineProject = data.checkSubitem
this.addForm.inspectTime = data.inspectTime
this.addForm.examineEntry = data.checkItem
this.addForm.address = data.dutyRegion
this.addForm.date = data.changeLimitTime
let imgArr = data.imageUrl.split(",")
this.enterpriseSn = data.enterpriseSn
this.addForm.typeId = data.inspectTypeId
this.addForm.status = data.status.toString()
this.addForm.remark = data.dangerDesc
this.hiddenDangerInspectRegionName = data.hiddenDangerInspectRegionName
this.hiddenDangerInspectRegionId = data.hiddenDangerInspectRegionId
// console.log(imgArr)
this.addForm.imgFileList = []
imgArr.forEach(item => {
if (item) {
this.addForm.imgFileList.push({
url: item
})
}
})
this.faultLevelList.forEach((item, index) => {
if (data.faultLevel == item.id) {
this.addForm.faultLevel = index
}
})
this.queryReply(data.id)
console.log(this.addForm)
// this.addForm = {
// type: "",
// typeId: "",
// dutyPeople: "",
// dutyPeopleId: "",
// dutyUnit: "",
// }
}
this.getCheckPointList()
console.log(uni.getStorageSync('detailData'), '-----详情')
},
onLoad(val) {
console.log(val, '-----记载详情')
if (val.engineeringId) {
this.engineeringId = val.engineeringId
if (uni.getStorageSync('engineeringList')) {
let data = uni.getStorageSync('engineeringList')
let arr1 = [],
arr2 = []
data.forEach(item => {
arr1.push(item.id)
arr2.push(item.checkDetailContent)
})
this.addForm.checkItemResultId = arr1.join(',')
this.addForm.remark = arr2.join(" ")
}
}
// 判断页面类型 1.新增 2.整改详细 3.审核详细 4.查看详情
if (val.type) {
this.pageType = val.type
}
if (val.type == 2) {
this.headerTitle = "整改详细"
this.btnTitle = "整改回复"
this.isDisabled = true
} else if (val.type == 3 || val.type == 4) {
this.headerTitle = "隐患上报详细"
this.isDisabled = true
}
if (val.type == 5) {
this.headerTitle = "整改情况"
this.isDisabled = true
}
if (val.taskId && val.itemId) {
this.taskId = val.taskId
this.itemId = val.itemId
}
if(val.moduleType){
this.moduleType = val.moduleType;
}
console.log(val, '----页面类型')
},
methods: {
//下拉选择回显
bindPickerChange(e, type) {
console.log(e)
if (type == 'startTime') {
this.addForm.inspectTime = e.f3;
} else if (type == 'startTime2') {
this.addForm.date = e.f3;
}
},
//确定选中--回显
checkPointBtn(val, type) {
// type==1 责任区域
console.log(val, "下拉树形回显")
if (type == 1) {
// console.log(this.checkPointList, val, this.personList)
for (let i = 0; i < this.dutyPeopleList.length; i++) {
if (this.dutyPeopleList[i].realName === val[0].dutyName) {
this.addForm.dutyPeople = i
this.addForm.dutyPeopleId = this.dutyPeopleList[i].userId
}
}
this.hiddenDangerInspectRegionName = val[0].regionName
this.hiddenDangerInspectRegionId = val[0].id
// console.log(this.addForm.dutyPeople,"下拉",this.hiddenDangerInspectRegionName)
}
},
openDutyArea() {
if (this.isDisabled) {
return
}
this.$refs.locationTree._show()
},
//获取责任区域 列表
getCheckPointList() {
this.sendRequest({
url: 'xmgl/hiddenDangerInspectRegion/tree',
method: 'post',
data: {
projectSn: this.projectSn
},
success: res => {
if (res.code == 200) {
this.checkPointList = res.result;
console.log('责任区域下拉', this.checkPointList)
}
}
})
},
imgUrl(val) {
this.imgUpload(val)
this.openImg = true
},
queryReply(val) {
let _this = this
this.sendRequest({
url: 'xmgl/hiddenDangerRectifyRecord/selectHiddenDangerRectifyRecordList',
method: 'post',
data: {
inspectId: val
},
success: res => {
res.result.forEach(item => {
if (item.fileUrl != "") {
let arr = item.fileUrl.split(",")
item.imgFileList = []
arr.forEach(itm => {
item.imgFileList.push({
url: itm
})
})
}
})
this.replyData = res.result
console.log(res.result, '-----整改回复')
}
})
},
queryTypeList() {
let sn = JSON.parse(uni.getStorageSync('userInfo')).headquartersSn
let _this = this
this.sendRequest({
url: 'xmgl/inspectType/list',
method: 'post',
data: {
sn: sn
},
success: res => {
this.typeList = res.result
if (this.datailData) {
this.typeList.forEach((item, index) => {
if (this.datailData.inspectTypeId == item.id) {
this.addForm.type = index
}
})
}
console.log(res.result, '-----检查类型')
}
})
},
queryUserData() {
let _this = this
this.sendRequest({
url: 'xmgl/systemUser/getProjectChilderSystemUserList',
method: 'post',
data: {
projectSn: this.projectSn
},
success: res => {
_this.dutyPeopleList = res.result
if (this.datailData) {
this.dutyPeopleList.forEach((item, index) => {
if (this.datailData.changeUser == item.userId) {
this.addForm.dutyPeople = index
}
})
}
console.log(res.result, '-----检查人')
}
})
},
getSubpackageLsit() {
let data = {
enterpriseTypeId: "",
pageNo: 1,
pageSize: 10000,
projectSn: this.projectSn,
};
this.sendRequest({
url: 'xmgl/projectEnterprise/list',
method: 'post',
data: data,
success: (res) => {
console.log(res.result, '------整改单位')
if (res.result.records.length > 0) {
this.dutyUnitList = res.result.records;
} else {
this.dutyUnitList = [];
}
if (this.datailData) {
this.dutyUnitList.forEach((item, index) => {
if (this.datailData.enterpriseSn == item.enterpriseSn) {
this.addForm.dutyUnit = index
}
})
}
}
})
},
bindExamineType(e) {
this.addForm.type = e.detail.value
this.addForm.typeId = this.typeList[e.detail.value].id
console.log(e)
},
bindContentBlur(e) {
this.reviewContent = e.detail.value
},
bindTextAreaBlur(e) {
this.addForm.examineContent = e.detail.value
console.log(e.detail.value)
},
bindTextAreaBlur2(e) {
this.addForm.requestContent = e.detail.value
},
bindRemarksBlur(e) {
this.addForm.remark = e.detail.value
},
bindDateChange(e) {
this.addForm.date = e.detail.value
console.log(e.detail.value)
},
bindCheckDateChange(e) {
this.addForm.inspectTime = e.detail.value
console.log(e.detail.value)
},
bindPeopleId(e) {
this.addForm.dutyPeople = e.detail.value
this.addForm.dutyPeopleId = this.dutyPeopleList[e.detail.value].userId
console.log(e.detail.value)
},
bindfaultLevel(e) {
this.addForm.faultLevel = e.detail.value
},
bindDutyUnit(e) {
this.addForm.dutyUnit = e.detail.value
this.addForm.enterpriseSn = this.dutyUnitList[e.detail.value].enterpriseSn
console.log(e.detail.value)
},
bindAddress(e) {
this.addForm.address = e.detail.value
console.log(e.detail.value)
},
getDate(type) {
const date = new Date();
let year = date.getFullYear();
let month = date.getMonth() + 1;
let day = date.getDate();
let hour = date.getHours();
let minute = date.getMinutes();
let second = date.getSeconds();
if (type === 'start') {
year = year;
} else if (type === 'end') {
// year = year + 2;
}
month = month > 9 ? month : '0' + month;
day = day > 9 ? day : '0' + day;
hour = hour > 9 ? hour : '0' + hour;
minute = minute > 9 ? minute : '0' + minute;
second = second > 9 ? second : '0' + second;
return `${year}-${month}-${day} ${hour}:${minute}`;
},
checkDanger(val) {
console.log('点击触发了吗=========');
if (!this.isDisabled) {
// if (uni.getStorageSync('dangerData')) {
// uni.removeStorageSync('dangerData');
// }
uni.navigateTo({
url: './dangerLibrary?type=1&taskId=' + this.taskId + '&itemId=' + this.itemId + '&engineeringId=' + this.engineeringId + '&moduleType=' + this.moduleType
})
}
},
radioChange(e) {
// this.restForm()
console.log(this.addForm)
this.addForm.status = e.detail.value
console.log(this.addForm.status)
},
//上传附件
uploadImg() {
var that = this
uni.chooseImage({
count: 5 - that.addForm.imgFileList.length,
success(res) {
const tempFilePaths = res.tempFilePaths;
console.log('传过去啦 - tempFilePaths', tempFilePaths)
uni.uploadFile({
url: that.url_config + 'upload/image', //仅为示例,非真实的接口地址
filePath: tempFilePaths[0],
name: 'files',
success: (uploadFileRes) => {
let data = {
name: JSON.parse(uploadFileRes.data).data[0].filename,
url: JSON.parse(uploadFileRes.data).data[0].imageUrl
};
console.log('传过去啦', res)
that.addForm.imgFileList.push(data)
uni.getImageInfo({
src: tempFilePaths[0],
success: (resInfo) => {
console.log('传过去啦 resInfo', resInfo)
that.imgList = {
imgUrl: tempFilePaths[0],
imgWidth: resInfo.width,
imgHeight: resInfo.height,
// team:'班组人员',
// name: '张三'
}
that.openImg = true
}
})
that.openImg = false
}
});
}
})
},
//删除附件
deleteImg(val, type) {
let that = this;
uni.showModal({
title: '提示',
content: '确定删除该附件吗?',
success: function(res) {
if (res.confirm) {
if (type == 1) {
let fileArr = JSON.parse(JSON.stringify(that.addForm.imgFileList));
fileArr.forEach((item, index) => {
if (item.url == val.url) {
fileArr.splice(index, 1)
}
})
that.addForm.imgFileList = fileArr;
} else if (type == 2) {
let fileArr = JSON.parse(JSON.stringify(that.videoFileList));
fileArr.forEach((item, index) => {
if (item.url == val.url) {
fileArr.splice(index, 1)
}
})
that.videoFileList = fileArr;
}
} else if (res.cancel) {
console.log('用户点击取消');
}
}
});
},
//预览图片
previewImage(url) {
uni.previewImage({
urls: [url]
})
},
restForm() {
this.addForm = {
type: "",
typeId: "",
examineProject: "",
examineEntry: "",
examineContent: "",
examineLv: "",
requestContent: "",
address: "",
date: this.getDate({
format: true,
}),
imgFileList: [],
dutyPeople: "",
dutyPeopleId: "",
dutyUnit: "",
enterpriseSn: "",
status: "1",
remark: ""
}
if (uni.getStorageSync('dangerData')) {
uni.removeStorageSync('dangerData');
}
},
//图片上传请求的接口
imgUpload(baseImg) {
let that = this
let arr = []
that.base64Image = baseImg
let parmars = {
base64Image: that.base64Image
}
this.sendRequest({
url: 'xmgl/upload/uploadBase64',
method: 'post',
header: {
'content-type': 'application/x-www-form-urlencoded' //自定义请求头信息
},
data: parmars,
success: (res) => {
console.log('图片接口返回的结果', res.data);
that.addForm.imgFileList[that.addForm.imgFileList.length - 1].url = res.data.imageUrl
}
})
},
submitForm() {
let that = this
if (this.pageType == 1) {
let data = {
projectSn: this.projectSn, //项目编号
reviewId: this.userId, //核查人ID--
createUser: this.userId, //创建人
dangerDesc: this.addForm.remark, //报警信息
status: this.addForm.status, //整改状态 1无需整改2待整改3待复查4合格5不合格
dutyRegion: this.addForm.address, //地址
inspectTime: this.addForm.inspectTime,
engineeringId: this.engineeringId, //工程id
taskId: this.taskId,
itemId: this.itemId,
hiddenDangerInspectRegionName: this.hiddenDangerInspectRegionName,
hiddenDangerInspectRegionId: this.hiddenDangerInspectRegionId
};
data.inspectTypeId = this.addForm.typeId
data.taskId = this.taskId
data.itemId = this.itemId
data.imageUrl = ''
let arr = []
this.addForm.imgFileList.forEach(item => {
arr.push(item.url)
})
data.imageUrl = arr.join(",")
// if (this.addForm.typeId == "") {
// uni.showToast({
// title: '请选择检查类型!',
// icon: "none",
// duration: 2000
// });
// return;
// }
if (this.addForm.status == 2) {
if (this.addForm.hiddenDangerInspectRegionName == "") {
uni.showToast({
title: '请选择责任区域!',
icon: "none",
duration: 2000
});
return;
}
if (this.addForm.inspectTime == "") {
uni.showToast({
title: '请选择检查时间!',
icon: "none",
duration: 2000
});
return;
}
if (this.addForm.dutyPeopleId == "") {
uni.showToast({
title: '请选择整改责任人!',
icon: "none",
duration: 2000
});
return;
}
if (this.addForm.faultLevel.toString() == "") {
uni.showToast({
title: '请选择事故隐患等级!',
icon: "none",
duration: 2000
});
return;
}
data.checkItem = this.addForm.examineEntry
data.checkSubitem = this.addForm.examineProject
data.checkContent = this.addForm.examineContent
data.hiddenDangerLevel = this.addForm.examineLv
data.rectifyRequire = this.addForm.requestContent
data.changeUser = this.addForm.dutyPeopleId
data.enterpriseSn = this.addForm.enterpriseSn
data.changeLimitTime = this.addForm.date
data.inspectTime = this.addForm.inspectTime
data.faultLevel = this.faultLevelList[this.addForm.faultLevel].id
data.recordType = 1
if (this.addForm.checkItemResultId) {
data.checkItemResultId = this.addForm.checkItemResultId
}
} else {
if (data.inspectTime == "") {
uni.showToast({
title: '请选择检查时间!',
icon: "none",
duration: 2000
});
return;
}
if (data.dutyRegion == "") {
uni.showToast({
title: '请填写详细位置信息!',
icon: "none",
duration: 2000
});
return;
}
if (data.imageUrl == "") {
uni.showToast({
title: '请上传图片!',
icon: "none",
duration: 2000
});
return;
}
data.recordType = 2
}
console.log('this.addForm2--------------', this.addForm)
let _this = this
this.sendRequest({
url: 'xmgl/hiddenDangerInspectRecord/add',
method: 'post',
data: data,
success: (res) => {
if (res.code == 200) {
uni.showToast({
title: '保存成功'
})
if(this.moduleType == 'safeCheck'){
uni.navigateBack({
delta: 3
})
} else {
uni.navigateTo({
url: "./safeIndex"
})
}
}
console.log(res.result)
}
})
}
if (this.pageType == 2) {
uni.redirectTo({
url: "./rectificationReply"
})
}
},
previewRecord() {
uni.navigateTo({
url: "./dangerRecord"
})
},
// refusalForm(){
// uni.redirectTo({
// url: "./dangerList?type=2"
// })
// },
showDialog(val) {
this.$refs.dialogs.showFn()
this.reviewStatus = val
},
cancleReply() {
this.$refs.dialogs.hideFn2()
},
submitReply() {
if (this.reviewContent == "") {
uni.showToast({
title: '请输入复查情况!',
icon: "none",
duration: 2000
});
return;
}
let data = {
createUser: this.userId,
inspectId: "",
additionalRemarks: this.reviewContent,
status: this.reviewStatus,
type: 2,
}
if (uni.getStorageSync('detailData')) {
data.inspectId = uni.getStorageSync('detailData').id
}
console.log(data)
let _this = this
this.sendRequest({
url: 'xmgl/hiddenDangerRectifyRecord/add',
method: 'post',
data: data,
success: (res) => {
if (res.code == 200) {
uni.showToast({
title: '保存成功'
})
uni.navigateBack({})
}
console.log(res.result)
}
})
this.$refs.dialogs.hideFn2()
// uni.redirectTo({
// url: './dangerList?type=2'
// })
}
}
}
</script>
<style lang="scss" scoped>
.addExamine {
position: relative;
overflow: hidden;
.fixedheader {
position: fixed;
top: 0;
left: 0;
width: 100%;
z-index: 2;
.headerName {
z-index: 1;
}
}
.header-btn {
position: absolute;
top: 0;
right: 20rpx;
font-size: 24rpx;
line-height: 88rpx;
z-index: 2;
}
.smallHeight {
height: 100%;
box-sizing: border-box;
padding-bottom: 90rpx;
background: #eee;
}
.addExamine-form {
width: 100%;
// height: 100%;
background: #eee;
padding: 16rpx 20rpx;
padding-bottom: 50rpx;
box-sizing: border-box;
.form-box {
background: #fff;
border-radius: 12rpx;
.form-title {
padding: 16rpx 0;
padding-left: 30rpx;
position: relative;
font-weight: 600;
font-size: 28rpx;
}
.form-title::before {
content: "";
width: 6rpx;
height: 36rpx;
background: #409EFF;
position: absolute;
left: 0;
top: 50%;
transform: translateY(-50%);
}
.b-bottom {
border-bottom: 2rpx solid #f0f0f0;
}
.form-item {
padding: 36rpx 20rpx;
line-height: 36rpx;
.form-lable {
color: #F56C6C;
white-space: nowrap;
:deep(span ){
color: #000;
}
}
.text {
:deep(span ){
font-size: 28rpx;
}
}
.form-textarea {
flex: 1;
margin-left: 20rpx;
height: 160rpx;
border: 1px solid #f0f0f0;
overflow: auto;
:deep(uni-textarea ){
width: 100%;
height: 100%;
font-size: 28rpx;
.uni-textarea-compute {
width: 100%;
height: 100%;
overflow: auto;
}
}
}
.form-input {
text-align: right;
:deep(input ){
font-size: 28rpx;
}
:deep(.uni-input-placeholder ){
color: #C0C4CC;
}
}
}
.flex {
display: flex;
align-items: center;
justify-content: space-between;
}
.f-column {
flex-direction: column;
}
.noCheck {
color: #C0C4CC;
}
.form-content {
font-size: 28rpx;
.uni-input {
line-height: 36rpx;
}
.uni-input2 {
color: black;
}
}
.a-start {
align-items: flex-start;
}
.imgBox_wrap {
display: flex;
flex-wrap: wrap;
margin-top: 20rpx;
width: 100%;
min-height: 120rpx;
}
.imgBox {
width: 120rpx;
height: 120rpx;
display: inline-flex;
position: relative;
margin-right: 30rpx;
margin-bottom: 16rpx;
.img {
width: 100%;
height: 100%;
border-radius: 12rpx;
}
.deleteImg {
position: absolute;
right: -12rpx;
top: -18rpx;
uni-image {
width: 20rpx;
height: 20rpx;
}
}
}
.addImgBox {
border: 1px solid rgba(42, 43, 91, 0.1);
background-color: #f6f5f8;
width: 120rpx;
height: 120rpx;
display: inline-flex;
align-items: center;
justify-content: center;
border-radius: 20rpx;
font-size: 24rpx;
margin-right: 12rpx;
uni-image {
width: 100%;
height: 100%;
}
// .icon-add {
// width: 36rpx;
// height: 36rpx;
// }
}
}
}
.submit-btn {
width: 100%;
height: 96rpx;
background: #409EFF;
color: #fff;
position: fixed;
bottom: 0;
left: 0;
text-align: center;
line-height: 96rpx;
}
.p-0 {
padding-bottom: 0;
}
.btn-box {
position: fixed;
bottom: 0;
left: 0;
line-height: 96rpx;
display: flex;
width: 100%;
height: 96rpx;
color: #fff;
text-align: center;
.cancle-btn {
flex: 1;
height: 100%;
background: #DD4907;
}
.pass-btn {
flex: 1;
height: 100%;
background: #127FEC;
}
}
.formDialog {
:deep(.dialogContent ){
width: 90%;
top: auto;
left: 50%;
bottom: 40rpx;
transform: translate(-50%, 0);
}
.dialog-title {
padding: 0 40rpx;
padding-top: 40rpx;
margin-bottom: 16rpx;
}
.dialog-content {
padding: 0 40rpx;
.form-textarea {
flex: 1;
width: 100%;
height: 218rpx;
border: 1px dashed #f0f0f0;
// overflow: auto;
background: #FAFAFA;
border-radius: 10rpx;
margin-bottom: 30rpx;
:deep(uni-textarea ){
width: 100%;
height: 100%;
padding: 26rpx 28rpx;
box-sizing: border-box;
font-size: 28rpx;
.uni-textarea-compute {
width: 100%;
height: 100%;
overflow: auto;
}
}
}
}
.dialog-btn {
width: 100%;
height: 94rpx;
display: flex;
border-top: 1px solid #f0f0f0;
align-items: center;
.cancle-btn {
flex: 1;
height: 94rpx;
text-align: center;
line-height: 94rpx;
background: #F3F3F3;
}
.primary-btn {
flex: 1;
height: 94rpx;
text-align: center;
line-height: 94rpx;
color: #127FEC;
background: #E7F2FD;
}
}
}
.uni-list-cell {
font-size: 28rpx;
margin-right: 20rpx;
:deep(uni-radio .uni-radio-input ){
width: 36rpx;
height: 36rpx;
}
}
}
.example-body {
padding: 0 0 20rpx 140rpx;
}
.dateTimePicker {
border: 1px solid #ccc;
border-radius: 10rpx;
width: 67%;
padding-left: 20rpx;
}
</style>