302 lines
		
	
	
		
			11 KiB
		
	
	
	
		
			Vue
		
	
	
	
	
	
			
		
		
	
	
			302 lines
		
	
	
		
			11 KiB
		
	
	
	
		
			Vue
		
	
	
	
	
	
<template>
 | 
						|
	<view class="page-wrap" v-bind:style="{paddingBottom:paddingBottom+'px'}">
 | 
						|
		<uni-card margin="0" :is-shadow="true">
 | 
						|
			<u--form labelPosition="left" labelWidth="auto" labelAlign="center" :model="model">
 | 
						|
				<u-form-item label="任务层级:" prop="LEVEL" borderBottom>
 | 
						|
					<u--input v-model="model.LEVEL" border="none" slot="right" inputAlign="right" disabled
 | 
						|
						disabledColor="fff"></u--input>
 | 
						|
				</u-form-item>
 | 
						|
				<u-form-item label="执行时间:" prop="execTime" borderBottom>
 | 
						|
					<u--input v-model="model.execTime" border="none" slot="right" inputAlign="right" disabled
 | 
						|
						disabledColor="fff"></u--input>
 | 
						|
				</u-form-item>
 | 
						|
				<u-form-item label="辨识区域:" prop="Areas" borderBottom>
 | 
						|
				</u-form-item>
 | 
						|
				<u--textarea v-model="model.Areas" border="none" inputAlign="right" disabled></u--textarea>
 | 
						|
				<u-form-item label="辨识要求:" prop="Nav_Request.NAME" borderBottom>
 | 
						|
				</u-form-item>
 | 
						|
				<u--textarea autoHeight v-model="model.Nav_Request.NAME" border="none" inputAlign="right"
 | 
						|
					disabled></u--textarea>
 | 
						|
				<u-form-item label="记录人:" prop="Nav_NoteTaker.NAME" borderBottom>
 | 
						|
					<u--input autoHeight v-model="model.Nav_NoteTaker.NAME" border="none" inputAlign="right" disabled
 | 
						|
						disabledColor="fff"></u--input>
 | 
						|
				</u-form-item>
 | 
						|
 | 
						|
				<u-form-item label="辨识人员:" prop="UserNames" borderBottom>
 | 
						|
				</u-form-item>
 | 
						|
				<u--textarea autoHeight v-html="model.UserNames" border="none" inputAlign="right"
 | 
						|
					disabled></u--textarea>
 | 
						|
				<u-form-item label="辨识对象:" prop="Identifyings" borderBottom disabled>
 | 
						|
				</u-form-item>
 | 
						|
				<u--textarea autoHeight v-model="model.Identifyings" border="none" inputAlign="right"
 | 
						|
					disabled></u--textarea>
 | 
						|
				<view class="upload-title">附件</view>
 | 
						|
				<full-upload v-model="model.Nav_Files" :listProp='listPropUpload' :listPropVal='listPropValUpload'
 | 
						|
					:isShowBtn="false"></full-upload>
 | 
						|
			</u--form>
 | 
						|
		</uni-card>
 | 
						|
		<u-sticky offset-top="20">
 | 
						|
			<view class="sub-form">
 | 
						|
				<view class="sub-form-wrap">
 | 
						|
					<u--form labelPosition="left" labelWidth="auto" labelAlign="center" errorType="border-bottom"
 | 
						|
						ref="sForm">
 | 
						|
						<u-collapse :border="false" accordion>
 | 
						|
							<uni-card style="margin-bottom: 16px;" margin="0" spacing="0" :is-shadow="false"
 | 
						|
								v-for="(item, index) in model.Nav_Details">
 | 
						|
								<u-collapse-item :title="index + 1 + '. ' + item.RISK_NAME">
 | 
						|
									<view slot=" right-icon" class="row-action">
 | 
						|
									</view>
 | 
						|
									<u-form-item label="区域:" prop="item.Nav_Area.NAME" borderBottom>
 | 
						|
										<u--input disabled disabledColor="#fff" v-model="item.Nav_Area.NAME"
 | 
						|
											border="none" inputAlign="right"></u--input>
 | 
						|
									</u-form-item>
 | 
						|
									<u-form-item label="辨识对象:" prop="item.Nav_Identifying.NAME" borderBottom>
 | 
						|
										<u--input disabled disabledColor="#fff" v-model="item.Nav_Identifying.NAME"
 | 
						|
											border="none" inputAlign="right"></u--input>
 | 
						|
									</u-form-item>
 | 
						|
									<u-form-item label="风险类别:" prop="item.Nav_Type.NAME" borderBottom>
 | 
						|
										<u--input disabled disabledColor="#fff" v-model="item.Nav_Type.NAME"
 | 
						|
											border="none" inputAlign="right"></u--input>
 | 
						|
									</u-form-item>
 | 
						|
									<u-form-item label="风险地点:" prop="item.RISK_PLACE" borderBottom>
 | 
						|
										<u--input disabled disabledColor="#fff" v-model="item.RISK_PLACE" border="none"
 | 
						|
											inputAlign="right"></u--input>
 | 
						|
									</u-form-item>
 | 
						|
									<u-form-item label="相关岗位:" prop="item.Posts" borderBottom>
 | 
						|
										<u--input disabled disabledColor="#fff" v-model="item.Posts" border="none"
 | 
						|
											inputAlign="right"></u--input>
 | 
						|
									</u-form-item>
 | 
						|
									<u-form-item label="相关设备:" prop="item.Equs" borderBottom>
 | 
						|
										<u--input disabled disabledColor="#fff" v-model="item.Equs" border="none"
 | 
						|
											inputAlign="right"></u--input>
 | 
						|
									</u-form-item>
 | 
						|
									<u-form-item label="作业环节:" prop="item.Nav_OperationStep.NAME" borderBottom>
 | 
						|
										<u--input disabled disabledColor="#fff" v-model="item.Nav_OperationStep.NAME"
 | 
						|
											border="none" inputAlign="right"></u--input>
 | 
						|
									</u-form-item>
 | 
						|
									<u-form-item label="责任单位:" prop="item.Nav_DepartmentLiable.NAME" borderBottom>
 | 
						|
										<u--input disabled disabledColor="#fff" v-if="item.Nav_DepartmentLiable"
 | 
						|
											v-model="item.Nav_DepartmentLiable.NAME" border="none"
 | 
						|
											inputAlign="right"></u--input>
 | 
						|
									</u-form-item>
 | 
						|
									<u-form-item label="责任岗位:" prop="item.Nav_PostLiable.NAME" borderBottom>
 | 
						|
										<u--input disabled disabledColor="#fff" v-if="item.Nav_PostLiable"
 | 
						|
											v-model="item.Nav_PostLiable.NAME" border="none"
 | 
						|
											inputAlign="right"></u--input>
 | 
						|
									</u-form-item>
 | 
						|
									<u-form-item label="责任人员:" prop="item.Nav_LiableUser.NAME" borderBottom>
 | 
						|
										<u--input disabled disabledColor="#fff" v-model="item.Nav_LiableUser.NAME"
 | 
						|
											border="none" inputAlign="right"></u--input>
 | 
						|
									</u-form-item>
 | 
						|
								</u-collapse-item>
 | 
						|
							</uni-card>
 | 
						|
						</u-collapse>
 | 
						|
					</u--form>
 | 
						|
				</view>
 | 
						|
			</view>
 | 
						|
		</u-sticky>
 | 
						|
		<audit-process :show="showAudit" @close="handleCloseAudit" :dataSource="auditData" />
 | 
						|
		<check-action v-if="isLoadOK && tableKey === '1'&&isAudit==='true' " :okApi="okApi" :refuseApi="refuseApi"
 | 
						|
			:dataSource="$store.state.auditModel"></check-action>
 | 
						|
		<view class="bottom-button">
 | 
						|
			<button type="primary" class="bottom" v-if='isLoadOK&&tableKey==1&&!isAudit'
 | 
						|
				@click="onTableBtnAgree">签到</button>
 | 
						|
		</view>
 | 
						|
	</view>
 | 
						|
</template>
 | 
						|
 | 
						|
<script>
 | 
						|
	import {
 | 
						|
		initFilter,
 | 
						|
		extendRule,
 | 
						|
		extendInclude
 | 
						|
	} from '../../../../utils/common'
 | 
						|
 | 
						|
	import {
 | 
						|
		getRequest,
 | 
						|
	} from '../../../../services/apply/FOServices/FOServices.js'
 | 
						|
	import '../../../../utils/showMsg.js'
 | 
						|
	import color from '../../../../uni_modules/uview-ui/libs/config/color'
 | 
						|
	import config from '../../../../config/common'
 | 
						|
 | 
						|
	export default {
 | 
						|
		data() {
 | 
						|
			return {
 | 
						|
				model: {
 | 
						|
					Nav_Request: "",
 | 
						|
					Nav_NoteTaker: ""
 | 
						|
				},
 | 
						|
				isAudit: false,
 | 
						|
				TaskID: "",
 | 
						|
				tableKey: '0',
 | 
						|
				isLoadOK: false,
 | 
						|
				paddingBottom: '170',
 | 
						|
				auditData: [],
 | 
						|
				showAudit: false,
 | 
						|
				orgId: uni.getStorageSync('orgId'),
 | 
						|
				listPropUpload: ['RECORD_ID'],
 | 
						|
				listPropValUpload: [],
 | 
						|
			}
 | 
						|
		},
 | 
						|
		onLoad(option) {
 | 
						|
			this.model.ID = option.ID;
 | 
						|
			this.TaskID = option.taskID;
 | 
						|
			this.tableKey = option.tableKey ? option.tableKey : '0'
 | 
						|
			this.isAudit = option.isAudit
 | 
						|
			this.okApi = option.okApi
 | 
						|
			this.refuseApi = option.refuseApi
 | 
						|
			this.loadData()
 | 
						|
		},
 | 
						|
		methods: {
 | 
						|
			removeDuplicateArea(arr) {
 | 
						|
				let obj = {};
 | 
						|
				arr = arr.reduce((newArr, next) => {
 | 
						|
					obj[next.AREA_ID] ? "" : (obj[next.AREA_ID] = true && newArr.push(next));
 | 
						|
					return newArr;
 | 
						|
				}, []);
 | 
						|
				return arr;
 | 
						|
			},
 | 
						|
			loadData() {
 | 
						|
				const json = initFilter(this.orgId, "", "CODE", 1)
 | 
						|
				extendRule(json, 'ID', 1, this.model.ID);
 | 
						|
				extendInclude(json, 'Nav_Request');
 | 
						|
				extendInclude(json, 'Nav_Users.Nav_User');
 | 
						|
				extendInclude(json, 'Nav_Identifyings.Nav_Identifying');
 | 
						|
				extendInclude(json, 'Nav_Details.Nav_Area');
 | 
						|
				extendInclude(json, 'Nav_Details.Nav_Identifying');
 | 
						|
				extendInclude(json, 'Nav_Details.Nav_Type');
 | 
						|
				extendInclude(json, 'Nav_Details.Nav_EvaluateRiskRecordWorkduty.Nav_Workduty');
 | 
						|
				extendInclude(json, 'Nav_Details.Nav_EvaluateRiskRecordEquipment.Nav_Equipment');
 | 
						|
				extendInclude(json, 'Nav_Details.Nav_EvaluateRiskRecordFacilities.Nav_Facilities');
 | 
						|
				extendInclude(json, 'Nav_Details.Nav_OperationStep');
 | 
						|
				extendInclude(json, 'Nav_Files.Nav_ImgFile');
 | 
						|
				extendInclude(json, 'Nav_NoteTaker');
 | 
						|
				extendInclude(json, 'Nav_Details.Nav_DepartmentLiable');
 | 
						|
				extendInclude(json, 'Nav_Details.Nav_LiableUser');
 | 
						|
				getRequest(json, "/HM/HMRiskRecord/FullGet").then(res => {
 | 
						|
					this.model = res
 | 
						|
					let strUserName = '';
 | 
						|
					let strIdentifyings = '';
 | 
						|
					let strAreas = '';
 | 
						|
					res.Nav_Users = this.removeDuplicateUser(res.Nav_Users);
 | 
						|
					if (res.Nav_Users && res.Nav_Users.length > 0) {
 | 
						|
						for (let i = 0; i < res.Nav_Users.length; i++) {
 | 
						|
							if (res.Nav_Users[i].DEAL_STATUS == 0) {
 | 
						|
								strUserName += (strUserName.length > 0 ? " " : "") +
 | 
						|
									"<text style='color:red'>" +
 | 
						|
									res.Nav_Users[i].Nav_User.NAME + "</text> ";
 | 
						|
							} else {
 | 
						|
								strUserName += (strUserName.length > 0 ? " " : "") + res.Nav_Users[
 | 
						|
									i].Nav_User.NAME + " ";
 | 
						|
							}
 | 
						|
 | 
						|
						}
 | 
						|
					}
 | 
						|
					if (res.Nav_Identifyings && res.Nav_Identifyings.length > 0) {
 | 
						|
						for (let i = 0; i < res.Nav_Identifyings.length; i++) {
 | 
						|
							strIdentifyings += (strIdentifyings.length > 0 ? "," : "") + res.Nav_Identifyings[
 | 
						|
								i].Nav_Identifying.NAME;
 | 
						|
						}
 | 
						|
					}
 | 
						|
					if (res.Nav_Details && res.Nav_Details.length > 0) {
 | 
						|
						for (let i = 0; i < res.Nav_Details.length; i++) {
 | 
						|
							if (res.Nav_Details[i].Nav_OperationStep == undefined) {
 | 
						|
								res.Nav_Details[i].Nav_OperationStep = {
 | 
						|
									NAME: ""
 | 
						|
								};
 | 
						|
							}
 | 
						|
						}
 | 
						|
					}
 | 
						|
					let newAreas = this.removeDuplicateArea(res.Nav_Details)
 | 
						|
					if (res.Nav_Details && res.Nav_Details.length > 0) {
 | 
						|
						for (let i = 0; i < newAreas.length; i++) {
 | 
						|
							strAreas += (strAreas.length > 0 ? "," : "") + newAreas[i].Nav_Area.NAME;
 | 
						|
						}
 | 
						|
					}
 | 
						|
					this.model.LEVEL = this.transLevel(this.model.LEVEL);
 | 
						|
					this.model.execTime = uni.$u.timeFormat(this.model.START_TIME, 'yyyy-mm-dd') + '~' + uni.$u
 | 
						|
						.timeFormat(this.model.END_TIME, 'yyyy-mm-dd');
 | 
						|
					this.model.UserNames = strUserName;
 | 
						|
					this.model.Identifyings = strIdentifyings;
 | 
						|
					this.model.Areas = strAreas;
 | 
						|
					if (this.model.SHIFT_STATUS == 2) {
 | 
						|
						this.isSign = true;
 | 
						|
						this.isAudit = false;
 | 
						|
					} else if (this.model.SHIFT_STATUS == 3) {
 | 
						|
						this.isSign = false;
 | 
						|
						this.isAudit = true;
 | 
						|
					}
 | 
						|
					this.isLoadOK = true
 | 
						|
				})
 | 
						|
			},
 | 
						|
			onTableBtnAgree() {
 | 
						|
				let json = {};
 | 
						|
				json.ID = this.model.ID;
 | 
						|
				json.TaskID = this.TaskID;
 | 
						|
				getRequest(json, "/HM/HMRiskRecord/PersonalAgree").then(res => {
 | 
						|
					if (res) {
 | 
						|
						uni.showToast({
 | 
						|
							title: '提交成功'
 | 
						|
						});
 | 
						|
						uni.navigateBack();
 | 
						|
					}
 | 
						|
				})
 | 
						|
			},
 | 
						|
			transLevel(level) {
 | 
						|
				if (level == 0) {
 | 
						|
					return '部门 ';
 | 
						|
				}
 | 
						|
				if (level == 1) {
 | 
						|
					return '车间 ';
 | 
						|
				}
 | 
						|
				if (level == 2) {
 | 
						|
					return '班组 ';
 | 
						|
				}
 | 
						|
				if (level == 3) {
 | 
						|
					return '公司 ';
 | 
						|
				}
 | 
						|
			},
 | 
						|
			removeDuplicateUser(arr) {
 | 
						|
				let obj = {};
 | 
						|
				arr = arr.reduce((newArr, next) => {
 | 
						|
					obj[next.USER_ID] ? "" : (obj[next.USER_ID] = true && newArr.push(next));
 | 
						|
					return newArr;
 | 
						|
				}, []);
 | 
						|
				return arr;
 | 
						|
			},
 | 
						|
			loadAuditData() {
 | 
						|
				const json = initFilter(this.orgId, this.model.ID, "CODE", 1)
 | 
						|
				return new Promise((resolve, reject) => {
 | 
						|
					getRequest(json, "/PF/Approve/GetApproveInfo").then(res => {
 | 
						|
						if (res) {
 | 
						|
							if (res && res[0].Nav_ApproveDetails.length > 0) {
 | 
						|
								resolve(res)
 | 
						|
							}
 | 
						|
						} else {
 | 
						|
							uni.showToast({
 | 
						|
								title: '暂无审批数据',
 | 
						|
								icon: 'none'
 | 
						|
							})
 | 
						|
						}
 | 
						|
					}).catch(err => {
 | 
						|
						reject(err)
 | 
						|
					})
 | 
						|
				})
 | 
						|
			},
 | 
						|
			handleCloseAudit() {
 | 
						|
				this.showAudit = false
 | 
						|
			},
 | 
						|
			async onNavigationBarButtonTap() {
 | 
						|
				const res = await this.loadAuditData()
 | 
						|
				if (res) {
 | 
						|
					this.auditData = res
 | 
						|
					this.showAudit = true
 | 
						|
				}
 | 
						|
			}
 | 
						|
		}
 | 
						|
	}
 | 
						|
</script>
 | 
						|
 | 
						|
<style>
 | 
						|
	@import url("@/style/css/editTemplate.css");
 | 
						|
</style> |