eeds_app/pages/ducha/xiangmubuduchashehe.vue
2024-07-19 10:23:05 +08:00

706 lines
22 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<view class="content">
<view class="form-box form-label-width-1">
<view class="form-title">工程信息</view>
<view class="form-item">
<view class="form-field2">工程名称</view>
<view class="form-info2">
{{prjInfo.prjName}}
</view>
</view>
<view class="form-item">
<view class="form-field2">工作票号</view>
<view class="form-info2">
{{planTicket.ticketNo}}
</view>
</view>
<view class="form-item">
<view class="form-field2">建设单位</view>
<view class="form-info2">
{{prjInfo.buildUnitStr}}
</view>
</view>
<view class="form-item">
<view class="form-field2">整改负责人</view>
<view class="form-info2">
{{prjInfo.projectManagerStr}}
</view>
</view>
<view class="form-item">
<view class="form-field2">联系方式</view>
<view class="form-info2">
{{prjInfo.managerPhone}}
</view>
</view>
<view class="form-item flex-par">
<view class="form-field">同行人</view>
<view class="form-info">
{{audit.data.companionName}}
</view>
</view>
</view>
<view class="form-box">
<view class="form-title">作业计划</view>
<view class="form-item ">
<view class="form-field2">当日主要施工作业内容</view>
<view class="form-info2">
{{planTicket.workContent}}
</view>
</view>
<view class="form-item ">
<view class="form-field2">当日计划的风险等级</view>
<view class="form-info2">
{{planTicket.riskLevel}}
</view>
</view>
<view class="form-item ">
<view class="form-field2">位置及内容</view>
<view class="form-info2">
{{planTicket.workLocation}}
</view>
</view>
</view>
<view class="form-box">
<view class="form-title">安全检查通知单</view>
<view class="form-item ">
<view class="form-field2">被查单位</view>
<view class="form-info2">
{{audit.data.constructionCompanyName}}
</view>
</view>
<view class="form-item ">
<view class="form-field2">检查单位</view>
<view class="form-info2">
{{audit.data.orgName}}
</view>
</view>
<view class="form-item ">
<view class="form-field2">督察员姓名</view>
<view class="form-info2">
{{audit.data.createUserName}}
</view>
</view>
<view class="form-item ">
<view class="form-field2">检查形式</view>
<view class="form-info2">
{{audit.data.checkTypeName}}
</view>
</view>
</view>
<template v-if="audit.data.problemList.length>0">
<view class="form-box" v-for="(item,index) in audit.data.problemList">
<view class="form-item">
<view class="form-field" style="font-size: 18px;font-weight: bold;color: darkred;">现场问题{{index+1}}</view>
</view>
<template v-if="item.isPeccancy==='1'">
<view class="form-item">
<view class="form-field2">违章类型:<span style="color: red;">*</span></view>
<view class="form-info2">
<picker @change="warnTypeChange($event,index)" :value="item.warnTypeIndex" :range="item.warnTypes" range-key="name">
<view>{{ item.warnTypes?item.warnTypes[item.warnTypeIndex].name:''}} </view>
</picker>
</view>
</view>
<view class="form-item">
<view class="form-field2">违章级别:<span style="color: red;">*</span></view>
<view class="form-info2">
<picker @change="warnLevelChange($event,index)" :value="item.warnLevelIndex" :range="item.warnLevels" range-key="name">
<view>{{ item.warnLevels?item.warnLevels[item.warnLevelIndex].name:'' }} </view>
</picker>
</view>
</view>
<view class="form-item">
<view >违章内容<span style="color: red;">*</span></view>
<view>
<uni-combox v-if="(item.warnDes&&item.warnDes.length>0)" :labelKey="'id'" :labelValue="'description'" :height="'13px'" :candidates="item.warnDes" :placeholder="'请选择'" @selectIndex="warnDesChange($event,index)" :initValue="initDesValue(item)"></uni-combox>
</view>
</view>
</template>
<view class="form-item">
<view class="form-field">存在问题:</view>
<view class="form-info">
{{item.problem}}
</view>
</view>
<view class="form-item">
<view class="form-field2">问题类型:</view>
<view class="form-info2">
{{item.problemTypesStr}}
</view>
</view>
<view class="form-item">
<view class="form-field">问题图片</view>
<view class="form-info">
<view class="form-img-box" v-for="it in item.images">
<img @click="showBigImage(`${baseUrl}${it}`)" :src="`${baseUrl}${it}`" class="form-img" />
</view>
</view>
</view>
<view class="form-item">
<view class="form-field2">是否违章:</view>
<view class="form-info2">
<radio-group @change="isPeccancyChange($event,index)">
<radio value="1" color="red" checked="true"/>是
<radio value="0" color="green"/>否
</radio-group>
</view>
</view>
</view>
</template>
<view class="form-box">
<view class="form-item ">
<view class="form-field">备注:</view>
<view class="form-info">
{{audit.data.description}}
</view>
</view>
<view class="form-item ">
<view class="form-field">审核意见:</view>
<view class="form-info">
<textarea v-model="audit.data.remark" class="form-textarea" placeholder="请输入" />
</view>
</view>
</view>
<view class="form-box">
<view class="form-btn-row flex-par">
<!-- 如果需要整改报告,那么可以肯定有违章,不能退回 -->
<button style="width: 75px;" type="default" @click="saveAudit('13')">完成</button>
<button style="width: 75px;" type="default" @click="saveAudit('12')">退回</button>
<button style="width: 75px;" type="default" @click="saveAudit('10')">保存</button>
<!-- 判定无违章,禁用提交按钮 -->
<button style="width: 75px;" type="primary" @click="saveAudit('11')">通过</button>
</view>
</view>
<view class="form-box">
<view class="form-title">审核流程</view>
<view class="audit-box">
<view style="margin: 10px;" class="flex-par" v-for="item in auditLog.list">
<view class="audit-right">
<view class="audit-name">
{{item.userName}}
<text :class="item.auditStatusName==='待审核'?'red-color':'green-color'" class="audit-state">{{item.auditStatusName}}</text>
<text v-if="item.auditRemark" class="audit-state blue-color">审核意见:{{item.auditRemark}}</text>
</view>
<view class="audit-time" v-if="item.auditStatus!==10">{{item.auditTime}}</view>
</view>
</view>
</view>
</view>
<!-- 照片预览 -->
<uni-popup ref="imgDialog" type="dialog">
<movable-area style="width: 700rpx;height: 700rpx;">
<movable-view style="width: 700rpx;height: 700rpx;" scale="true" direction="all">
<image style="width:100%;height:100%;background-color: #eeeeee;" :src="imgSrc"></image>
</movable-view>
</movable-area>
</uni-popup>
</view>
</template>
<script setup>
import { inject, reactive, ref,toRaw,onMounted,computed } from 'vue';
import { onLoad,onBackPress } from "@dcloudio/uni-app";
import REQUEST from "/common/request.js";
import {URL_BASE,validInfo} from '/common/config.js'
const imgDialog = ref();
const imgSrc = ref('');
const baseUrl = URL_BASE;
const businessId = ref("");
const type = ref('');
// const isWarn = ref('0');
const needUploadReport = ref('0');
const needHandle = ref(true);
const rectificationRequire = ref('');
const punishOption = ref('');
const currentAuditNum = ref(0);
const positions = ref("");
const audit = reactive({
data:{
id:'',
constructionCompanyId:'',
constructionCompanyName:'',
orgId:'',
orgName:'',
checkDate:'',
checkType:'',
checkTypeName:'',
createUserName:'',
companionName:'',
projectId:'',
jobTicketId:'',
jobPlanId:'',
description:'',
remark:null,
auditorDchzhg:null,
subcontractorName:null,
rectificationRequire:'',
punishOption:'',
departmentRecords:[],
peccancyRecordList:[],
problemList:[]
},
subcontractors:[],
subcontractorIndex:0,
departmentPoints:[
]
})
const prjInfo=reactive({
prjName:'',
projectManager:'',
projectManagerStr:'',
managerPhone:'',
buildUnit:'',
buildUnitStr:'',
constructionProjectDepartment:'',
constructionProjectDepartmentStr:''
});
const planTicket = reactive({
planId:'',
workContent:'',
workLocation:'',
riskLevel:'',
ticketNo:'',
jobTicketId:''
});
const auditLog = reactive({
total:0,
wfTaskStatus:null,
list:[]
});
onLoad((option)=>{
businessId.value = option.businessId;
type.value = option.type;
positions.value = uni.getStorageSync("personnelPositions");
initDatas();
});
const punishPersonChange = (event,viewIndex)=>{
audit.data.problemList[viewIndex].punishPersonIndex = event.detail.value;
}
const isPeccancyChange = (event,viewIndex)=>{
audit.data.problemList[viewIndex].isPeccancy = event.detail.value;
// console.log(audit.data.problemList[viewIndex].isPeccancy);
//统计所有问题的是否违章字段,如果都是没有违章,说明整个安全检查通知单没有违章,那么违章通知和整改通知就都没有了,隐藏是否需要整改报告,并禁用提交按钮
let sum = 0;
for(let problem of audit.data.problemList){
if(problem.isPeccancy==='1'){
sum++;
}
}
needHandle.value = (sum>0);
// if(sum<=0){
// isWarn.value='0';
// }
// console.log(isWarn.value);
// console.log(needHandle.value);
}
const reduceViews = (index)=>{
//删除
audit.departmentPoints.splice(index,1);
}
const addViews = async ()=>{
//添加一个新的
// views.value.push(count.value);
let res = await REQUEST.get("/securityCheckNotice/peccancy/level",{type:""});
res.unshift({name:"请选择"});
// console.log(res);
audit.departmentPoints.push({
levels:res,
levelIndex:0,
id:null,
disposalObjectType:null,
level:null,
points:null,
fine:null
});
}
// const auditLevelChange = async (event,viewIndex)=>{
// audit.departmentPoints[viewIndex].levelIndex = event.detail.value;
// }
const warnTypeChange = async (event,viewIndex)=>{
audit.data.problemList[viewIndex].warnTypeIndex = event.detail.value;
// if(audit.data.problemList[viewIndex].warnTypeIndex!==0){
// await getWarnLevels(event.detail.value,viewIndex);
// }else{
// if(audit.data.problemList[viewIndex].subcontractorPointsFine){
// audit.data.problemList[viewIndex].subcontractorPointsFine.fine=0;
// audit.data.problemList[viewIndex].subcontractorPointsFine.points=0;
// }
// if(audit.data.problemList[viewIndex].personPointsFine){
// audit.data.problemList[viewIndex].personPointsFine.fine=0;
// audit.data.problemList[viewIndex].personPointsFine.points=0;
// }
// audit.data.problemList[viewIndex].warnLevelIndex=0;
// audit.data.problemList[viewIndex].warnLevels = [{"name":""}];
// }
// audit.data.problemList[viewIndex].warnDesIndex=-1;
// audit.data.problemList[viewIndex].warnDes = [];
// audit.data.problemList[viewIndex].description = '';
}
// const getWarnLevels = async (index,viewIndex)=>{
// let arr = toRaw(audit.data.problemList[viewIndex].warnTypes);
// if(arr && arr.length){
// //选的是第几项
// const type=arr[index].name;
// let res = await REQUEST.get("/securityCheckNotice/peccancy/level",{type:type});
// res.unshift({"name":"请选择"});
// //将该部分中的index清0
// audit.data.problemList[viewIndex].warnLevelIndex=0;
// audit.data.problemList[viewIndex].warnLevels = res;
// }
// }
const warnLevelChange = async (event,viewIndex)=>{
audit.data.problemList[viewIndex].warnLevelIndex = event.detail.value;
// if(audit.data.problemList[viewIndex].warnLevelIndex!==0){
// await getWarnDes(event.detail.value,viewIndex);
// }else{
// audit.data.problemList[viewIndex].warnDesIndex=-1;
// audit.data.problemList[viewIndex].warnDes = [];
// audit.data.problemList[viewIndex].description = '';
// }
}
// const getWarnDes = async(index,viewIndex)=>{
// let arrType = toRaw(audit.data.problemList[viewIndex].warnTypes);
// let arrLevel = toRaw(audit.data.problemList[viewIndex].warnLevels);
// // console.log(arrType);
// // console.log(arrLevel);
// if(arrType && arrLevel && arrType.length && arrLevel.length){
// let res = await REQUEST.get("/securityCheckNotice/peccancy/problem",{type:arrType[audit.data.problemList[viewIndex].warnTypeIndex].name,level:arrLevel[index].name});
// audit.data.problemList[viewIndex].warnDesIndex=-1;
// audit.data.problemList[viewIndex].warnDes = res;
// audit.data.problemList[viewIndex].description = '';
// }
// }
const warnDesChange = (event,viewIndex)=>{
audit.data.problemList[viewIndex].warnDesIndex = event;
if(audit.data.problemList[viewIndex].warnDesIndex!==-1){
let type = audit.data.problemList[viewIndex].warnDes[audit.data.problemList[viewIndex].warnDesIndex].type;
let level = audit.data.problemList[viewIndex].warnDes[audit.data.problemList[viewIndex].warnDesIndex].level;
if(audit.data.problemList[viewIndex].warnTypes && audit.data.problemList[viewIndex].warnTypes.length>0){
let i=0;
for(let obj of audit.data.problemList[viewIndex].warnTypes){
if(obj.name===type){
audit.data.problemList[viewIndex].warnTypeIndex = i;
break;
}
i++;
}
}
if(audit.data.problemList[viewIndex].warnLevels && audit.data.problemList[viewIndex].warnLevels.length>0){
let i=0;
for(let obj of audit.data.problemList[viewIndex].warnLevels){
if(obj.name===level){
audit.data.problemList[viewIndex].warnLevelIndex = i;
break;
}
i++;
}
}
}else{
audit.data.problemList[viewIndex].warnTypeIndex=0;
audit.data.problemList[viewIndex].warnLevelIndex=0;
}
}
const initDesValue = computed(()=>(item)=>{
return (item&&item.description)?item.description:'';
})
const getPrjInfo = async (prjId)=>{
let res = await REQUEST.get("/prjInfo/findPrjInfo",{prjId:prjId});
if(res){
prjInfo.prjName = res.prjName;
prjInfo.projectManager = res.projectManager;
// prjInfo.projectManagerStr = res.projectManagerStr;
prjInfo.managerPhone = res.managerPhone;
prjInfo.buildUnit = res.buildUnit;
prjInfo.buildUnitStr = res.buildUnitStr;
prjInfo.constructionProjectDepartment = res.constructionProjectDepartment;
prjInfo.constructionProjectDepartmentStr = res.constructionProjectDepartmentStr;
}
}
const fillPlan = async(planId)=>{
let res = await REQUEST.get("/prjInfo/getPlanDetail",{planId:planId});
if(res){
planTicket.planId = res.planId;
planTicket.workContent = res.workContent;
planTicket.workLocation = res.workLocation;
planTicket.riskLevel = res.riskLevel;
planTicket.ticketNo = res.ticketNo;
planTicket.jobTicketId = res.jobTicketId;
prjInfo.projectManagerStr = res.projectManagerStr;
}
}
const initDatas = async()=>{
let res = await REQUEST.get(`/securityCheckNotice/detail/${businessId.value}`);
if(res){
audit.data = res;
audit.data.id=res.id;
audit.data.constructionCompanyId=res.constructionCompanyId;
audit.data.constructionCompanyName=res.constructionCompanyName;
audit.data.orgId=res.orgId;
audit.data.orgName=res.orgName;
audit.data.checkDate=res.checkDate;
audit.data.checkType=res.checkType;
audit.data.checkTypeName=res.checkTypeName;
audit.data.createUserName = res.createUserName;
audit.data.projectId=res.projectId;
audit.data.jobTicketId = res.jobTicketId;
audit.data.jobPlanId=res.jobPlanId;
audit.data.description=res.description;
audit.data.peccancyRecordList = res.peccancyRecordList;
audit.data.problemList=res.problemList;
audit.data.auditorDchzhg = res.auditorDchzhg;
audit.data.rectificationRequire = res.rectificationRequire;
audit.data.punishOption = res.punishOption;
audit.data.companionName = res.companionName;
await getPrjInfo(audit.data.projectId);
await fillPlan(audit.data.jobPlanId);
await getTaskLogs();
//拆分项目部、分包商、人员扣分,安监部长、副总查看
let departArr = [];
let ps = [];
if(audit.data.peccancyRecordList){
for(let record of audit.data.peccancyRecordList){
if(record.disposalObjectType===1){
departArr.push(toRaw(record));
}else{
ps.push(toRaw(record));
}
}
}
audit.data.departmentRecords = departArr;
//处理问题列表
if(audit.data.problemList){
for(let problem of audit.data.problemList){
//图片
let images = problem.files?problem.files.split(","):[];
problem.images = images;
//三联下拉框
problem.warnTypeIndex = 0;
problem.warnLevelIndex = 0;
problem.warnDesIndex = 0;
let res = await REQUEST.get("/securityCheckNotice/peccancy/type");
res.unshift({"name":"请选择"});
problem.warnTypes = res;
if(positions.value.includes('11')){
//是否违章默认值
if(problem.isPeccancy){
problem.isPeccancy = problem.isPeccancy+"";
}else{
problem.isPeccancy="1";
}
}
let i = 0;
//处理下标
if(problem.type){
for(let type of problem.warnTypes){
if(type.name===problem.type){
// console.log("找到了");
problem.warnTypeIndex = i;
break;
}
i++;
}
}
res = await REQUEST.get("/securityCheckNotice/peccancy/levelNew",{type:(problem.type?problem.type:"")});
res.unshift({"name":"请选择"});
problem.warnLevels = res;
i = 0;
if(problem.level){
for(let level of problem.warnLevels){
if(level.name===problem.level){
// console.log("找到了");
problem.warnLevelIndex = i;
break;
}
i++;
}
}
res = await REQUEST.get("/securityCheckNotice/peccancy/problemNew",{type:(problem.type?problem.type:""),level:(problem.level?problem.level:"")});
problem.warnDes = res;
i = 0;
if(problem.description){
for(let des of problem.warnDes){
if(des.description===problem.description){
// console.log("找到了");
problem.warnDesIndex = i;
break;
}
i++;
}
}
}
}
}
}
const getTaskLogs = async()=>{
let res = await REQUEST.get("/securityCheckNotice/audit/log",{businessId:audit.data.id,businessType:1});
// console.log(res);
if(res){
auditLog.total = res.total;
auditLog.wfTaskStatus = res.wfTaskStatus;
auditLog.list = res.list;
currentAuditNum.value = auditLog.list.length;
// console.log("当前节点数",currentAuditNum.value);
}
}
const saveAudit = async (auditType)=>{
if(auditType==='13' && needHandle.value){
uni.showToast({ title:'有违章问题,不能作废!', duration: 2000, icon: 'none' });
return;
}
if(auditType==='11' && !needHandle.value){
uni.showToast({ title:'不存在违章问题,不能通过!', duration: 2000, icon: 'none' });
return;
}
if(auditType==='12' && (audit.data.remark===null || audit.data.remark==='')){
uni.showToast({ title:'请填写审核意见!', duration: 2000, icon: 'none' });
return;
}
let problems = [];
let seps = toRaw(audit.data.problemList);
if(auditType!=='13'){
let i=1;
for(let p of seps){
// console.log("isPeccancy"+p.isPeccancy);
if(p.isPeccancy==='1'){
//校验
if(auditType!=='10' && auditType!=='12'){
if(!p.warnTypes || !p.warnTypeIndex || p.warnTypeIndex===0 || p.warnTypes[p.warnTypeIndex].name==='请选择'){
validInfo("请为第"+i+"个问题选择","违章类型");
return;
}
if(!p.warnLevels || !p.warnLevelIndex || p.warnLevelIndex===0 || p.warnLevels[p.warnLevelIndex].name==='请选择'){
validInfo("请为第"+i+"个问题选择","违章级别");
return;
}
if(!p.warnDes || p.warnDesIndex===-1){
validInfo("请为第"+i+"个问题选择","正确的违章内容");
return;
}
}
}
const plId = p.warnDes?p.warnDes[p.warnDesIndex].id:'';
let problem = {id:p.id,problem:p.problem,plId:plId,files:p.files,isPeccancy:p.isPeccancy};
problems.push(problem);
i++;
}
}else{
for(let p of seps){
let problem = {id:p.id,problem:p.problem,plId:null,files:p.files,isPeccancy:p.isPeccancy};
problems.push(problem);
}
}
let param = {
id:audit.data.id,
constructionCompanyId: audit.data.constructionCompanyId,
orgId:audit.data.orgId,
checkType:audit.data.checkType,
projectId:audit.data.projectId,
description:audit.data.description,
remark:audit.data.remark,
jobPlanId:audit.data.jobPlanId,
jobTicketId:audit.data.jobTicketId,
auditStatus:auditType!=="10"?auditType:null,
isReport:needUploadReport.value,
isDisposalNotice:'1',
problemList:problems
};
let path = auditType==="10"?"/securityCheckNotice/save/1":"/securityCheckNotice/audit";
if(auditType==="10"){
//分公司查工程
param.type="2";
}
let res = await REQUEST.post(path,param);
let tipsText = "";
if(auditType==="13"){
tipsText = "已完成";
}else if(auditType==="11"){
tipsText = "已通过";
}else if(auditType==="12"){
tipsText = "已退回";
}else if(auditType==="10"){
tipsText = "保存成功";
}
// console.log(res)
if(res && parseInt(res)>0){
uni.showModal({
title: '提示',
content: tipsText,
confirmText: '确定',
showCancel: false,
complete: function(res) {
if(type.value==='daiban'){
uni.switchTab({
url:"/pages/tabBar/daiban"
});
}else{
uni.redirectTo({
url:"/pages/ducha/xiangmubuduchalist?type=examine"
});
}
}
})
}
}
const showBigImage=(src)=>{
// console.log("图片地址:",src);
if(src){
imgSrc.value = src
imgDialog.value.open();
}
}
onBackPress(()=>{
if(type.value==='daiban'){
console.log(111);
uni.switchTab({
url:"/pages/tabBar/daiban"
});
}else{
console.log(222);
uni.redirectTo({
url:"/pages/ducha/xiangmubuduchalist?type=examine"
});
}
return true;
});
</script>
<style>
*{
z-index: auto;
}
</style>