355 lines
		
	
	
		
			11 KiB
		
	
	
	
		
			Vue
		
	
	
	
	
	
			
		
		
	
	
			355 lines
		
	
	
		
			11 KiB
		
	
	
	
		
			Vue
		
	
	
	
	
	
<!-- WB013 外包工程危险作业申请编辑 -->
 | 
						||
<template>
 | 
						||
	<view class="todo-page">
 | 
						||
		<view class="background"></view>
 | 
						||
		<view class="card">
 | 
						||
			<u--form labelPosition="left" labelWidth="auto" labelAlign="center" :model="model" :rules="rules" ref="wForm" errorType="border-bottom" class="demo-ruleForm">
 | 
						||
				<view style="position: relative;">
 | 
						||
					<view style="position: absolute;left: -10px;color: #3d4b70;top: -3px;">*</view>
 | 
						||
				</view>
 | 
						||
 | 
						||
				<view style="font-size: 15px; font-weight: bold;color: #3d4b70;margin-bottom: 10px;">基本信息填写</view>
 | 
						||
				<u-form-item label="项目名称" prop="Nav_Project.NAME" borderBottom>
 | 
						||
					<u--input disabled v-model="model.Nav_Project.NAME" border="none" inputAlign="right" fontSize="14px"></u--input>
 | 
						||
				</u-form-item>
 | 
						||
 | 
						||
				<u-form-item label="外包单位名称" prop="Nav_Project.UNIT_NAME" borderBottom>
 | 
						||
					<u--input disabled v-model="model.Nav_Project.UNIT_NAME" border="none" inputAlign="right" fontSize="14px"></u--input>
 | 
						||
				</u-form-item>
 | 
						||
 | 
						||
				<u-form-item label="作业类别" prop="Nav_Type.NAME" borderBottom>
 | 
						||
					<u--input disabled v-model="model.Nav_Type.NAME" border="none" inputAlign="right" fontSize="14px"></u--input>
 | 
						||
				</u-form-item>
 | 
						||
 | 
						||
				<u-form-item label="危险作业名称" prop="DANGEROUS_JOB_NAME" borderBottom>
 | 
						||
					<u--input disabled v-model="model.DANGEROUS_JOB_NAME" border="none" inputAlign="right" fontSize="14px"></u--input>
 | 
						||
				</u-form-item>
 | 
						||
				<u-form-item label="危险作业具体事项" prop="DANGEROUS_JOB_ITEM" borderBottom>
 | 
						||
					<u--input disabled v-model="model.DANGEROUS_JOB_ITEM" border="none" inputAlign="right" fontSize="14px"></u--input>
 | 
						||
				</u-form-item>
 | 
						||
				<u-form-item label="作业风险辨识" prop="JOB_RISK_IDENTIFY" borderBottom>
 | 
						||
					<u--input disabled v-model="model.JOB_RISK_IDENTIFY" border="none" inputAlign="right" fontSize="14px"></u--input>
 | 
						||
				</u-form-item>
 | 
						||
 | 
						||
				<u-form-item label="作业开始时间" prop="START_TIME" borderBottom>
 | 
						||
					<u--input disabled v-model="model.START_TIME" border="none" inputAlign="right" fontSize="14px"></u--input>
 | 
						||
 | 
						||
				</u-form-item>
 | 
						||
				<u-form-item label="作业结束时间" prop="END_TIME" borderBottom>
 | 
						||
					<u--input disabled v-model="model.END_TIME" border="none" inputAlign="right" fontSize="14px"></u--input>
 | 
						||
 | 
						||
				</u-form-item>
 | 
						||
 | 
						||
				<u-form-item label="作业地点" prop="JOB_ADDRESS" borderBottom>
 | 
						||
					<u--input disabled v-model="model.JOB_ADDRESS" border="none" inputAlign="right" fontSize="14px"></u--input>
 | 
						||
				</u-form-item>
 | 
						||
 | 
						||
 | 
						||
				<u-form-item label="现场监护人" prop="USER_ID" borderBottom>
 | 
						||
					<u--input disabled v-model="model.Nav_User.NAME" border="none" inputAlign="right" fontSize="14px"></u--input>
 | 
						||
				</u-form-item>
 | 
						||
				<u-form-item required label="监查部门:" prop="Nav_MointerDepartment.NAME" borderBottom @click="handleShowSheet({title: '监查部门', name: 'Nav_MointerDepartment'})">
 | 
						||
					<u--input disabledColor="#fff" disabled placeholder="请选择监查部门" v-model="model.Nav_MointerDepartment.NAME" border="none" inputAlign="right" fontSize="14px"></u--input>
 | 
						||
					<u-icon style="margin-left: 4px;" name="arrow-down" size="12"></u-icon>
 | 
						||
				</u-form-item>
 | 
						||
				<u-form-item required label="监查人:" prop="Nav_MointerUser.NAME" borderBottom @click="handleShowSheet({title: '监查人', name: 'UserName'})">
 | 
						||
					<u--input disabledColor="#fff" disabled placeholder="请选择监查人" v-model="model.Nav_MointerUser.NAME" border="none" inputAlign="right" fontSize="14px"></u--input>
 | 
						||
					<u-icon style="margin-left: 4px;" name="arrow-down" size="12"></u-icon>
 | 
						||
				</u-form-item>
 | 
						||
			</u--form>
 | 
						||
		</view>
 | 
						||
 | 
						||
 | 
						||
 | 
						||
 | 
						||
		<query-selector :multiple="selectorInfo.isMultiple" :show="selectorInfo.showPopup" :title="selectorInfo.title" :lists="selectorInfo.dataLists" :defaultChecked="selectorInfo.defaultChecked" @search="handleSearch"
 | 
						||
			@select="handleSelected" @close="selectorInfo.showPopup=false" :total="selectorInfo.totalCount" />
 | 
						||
		<view class="bottom-button">
 | 
						||
 | 
						||
			<u-button type="primary" @click="submit" color="#3d4b70" style="margin-left: 5px;">提交</u-button>
 | 
						||
		</view>
 | 
						||
	</view>
 | 
						||
</template>
 | 
						||
 | 
						||
<script>
 | 
						||
	import {
 | 
						||
		mapState,
 | 
						||
		mapMutations
 | 
						||
	} from 'vuex'
 | 
						||
	import {
 | 
						||
		extendFilterGroup,
 | 
						||
		extendGroupRule,
 | 
						||
		extendInclude,
 | 
						||
		extendOrder,
 | 
						||
		extendRule,
 | 
						||
		guid,
 | 
						||
		initFilter,
 | 
						||
		initFilterGroup
 | 
						||
	} from '../../../../utils/common'
 | 
						||
	import {
 | 
						||
		getRequest,
 | 
						||
	} from '../../../../services/apply/FOServices/FOServices';
 | 
						||
	import {
 | 
						||
		GetDangerousJob,
 | 
						||
		WBCheckFullUpdate,
 | 
						||
		OrderEntitiesJobSafeMeasureEnum,
 | 
						||
		CheckUseful,
 | 
						||
		WBDepartment
 | 
						||
	} from '../../../../services/apply/subPages/scWB';
 | 
						||
 | 
						||
	import {
 | 
						||
		getEnum
 | 
						||
	} from '../../../../services/common';
 | 
						||
 | 
						||
	import config from '../../../../config/common'
 | 
						||
	export default {
 | 
						||
		data() {
 | 
						||
			return {
 | 
						||
				tableKey: '0',
 | 
						||
				TaskID: '',
 | 
						||
				ORG_ID: uni.getStorageSync('orgId'),
 | 
						||
				isLoadOK: true,
 | 
						||
				stepsPageList: 0,
 | 
						||
				listISORNOT: [], //是否涉及
 | 
						||
				listISORNOTText: [],
 | 
						||
				listPropUpload: ['PARENT_ID'],
 | 
						||
				listPropValUpload: [],
 | 
						||
				indexShow: 0,
 | 
						||
				model: {
 | 
						||
					ID: '',
 | 
						||
					ORG_ID: '',
 | 
						||
					TaskID: null,
 | 
						||
					AUDIT_OPINION: '',
 | 
						||
					PROJECT_ID: '',
 | 
						||
					Nav_Project: {
 | 
						||
						NAME: ''
 | 
						||
					},
 | 
						||
					UNIT_NAME: '',
 | 
						||
					TYPE_ID: '',
 | 
						||
					Nav_Type: {
 | 
						||
						NAME: ''
 | 
						||
					},
 | 
						||
					DANGEROUS_JOB_NAME: '',
 | 
						||
					DANGEROUS_JOB_ITEM: '',
 | 
						||
					JOB_RISK_IDENTIFY: '',
 | 
						||
					START_TIME: '',
 | 
						||
					END_TIME: '',
 | 
						||
					JOB_ADDRESS: '',
 | 
						||
					UsersName: '',
 | 
						||
 | 
						||
					PARENT_ID: '',
 | 
						||
 | 
						||
 | 
						||
					USER_ID: '',
 | 
						||
					Nav_User: {
 | 
						||
						NAME: ''
 | 
						||
					},
 | 
						||
					DISCLOSE_TIME: '',
 | 
						||
					Nav_MointerUser: {
 | 
						||
						NAME: ''
 | 
						||
					},
 | 
						||
					Nav_MointerDepartment: {
 | 
						||
						NAME: ''
 | 
						||
					}
 | 
						||
				},
 | 
						||
				rules: {
 | 
						||
					'Nav_MointerDepartment.NAME': {
 | 
						||
						type: 'string',
 | 
						||
						required: true,
 | 
						||
						trigger: ['blur', 'change'],
 | 
						||
						message: '请选择【监查部门】'
 | 
						||
					},
 | 
						||
					'Nav_MointerUser.NAME': {
 | 
						||
						type: 'string',
 | 
						||
						required: true,
 | 
						||
						trigger: ['blur', 'change'],
 | 
						||
						message: '请选择【监查人】'
 | 
						||
					},
 | 
						||
				},
 | 
						||
				selectorInfo: {
 | 
						||
					name: 'user',
 | 
						||
					isMultiple: false,
 | 
						||
					showPopup: false,
 | 
						||
					totalCount: 0,
 | 
						||
					title: '考核结果选择',
 | 
						||
					dataItem: {},
 | 
						||
					index: 0,
 | 
						||
					columns: [],
 | 
						||
					dataLists: [],
 | 
						||
					defaultText: '',
 | 
						||
					defaultChecked: []
 | 
						||
				},
 | 
						||
			}
 | 
						||
		},
 | 
						||
		onLoad(option) {
 | 
						||
			// this.TaskID = option.taskID ? option.taskID : '';
 | 
						||
			// this.model.ID = option.ID ? option.ID : '';
 | 
						||
			// this.JOBID = option.ID ? option.ID : '';
 | 
						||
			// this.tableKey = option.tableKey ? option.tableKey : '0'
 | 
						||
			// this.loadData();
 | 
						||
 | 
						||
			this.model.ID = option.ID
 | 
						||
			this.TaskID = option.taskID
 | 
						||
			this.tableKey = option.tableKey
 | 
						||
			if (option.taskID != null && option.taskID != '')
 | 
						||
				this.model.TaskID = option.taskID
 | 
						||
			this.loadData()
 | 
						||
		},
 | 
						||
		methods: {
 | 
						||
			loadData() {
 | 
						||
				let json = initFilter(this.ORG_ID);
 | 
						||
				extendRule(json, 'ID', 1, this.model.ID);
 | 
						||
				extendInclude(json, 'Nav_Project')
 | 
						||
				extendInclude(json, 'Nav_Type')
 | 
						||
				extendInclude(json, 'Nav_User')
 | 
						||
				extendInclude(json, 'Nav_MointerDepartment')
 | 
						||
				extendInclude(json, 'Nav_MointerUser')
 | 
						||
				json.IgnoreDataRule = true;
 | 
						||
				GetDangerousJob(json).then(ret => {
 | 
						||
					this.model = ret
 | 
						||
					this.initializeMissingFields();
 | 
						||
					this.listPropValUpload.push(this.model.ID)
 | 
						||
 | 
						||
					// uni.$updateData()
 | 
						||
					this.isLoadOK = false
 | 
						||
				});
 | 
						||
				this.listPropValUpload.push(this.model.ID)
 | 
						||
			},
 | 
						||
			initializeMissingFields() {
 | 
						||
				const fields = ['Nav_Project', 'Nav_Type', 'Nav_User', 'Nav_MointerUser', 'Nav_MointerDepartment'];
 | 
						||
				fields.forEach(field => {
 | 
						||
					if (!this.model[field]) {
 | 
						||
						if (field == 'Nav_Project') {
 | 
						||
							this.model[field] = {
 | 
						||
								NAME: '',
 | 
						||
								UNIT_NAME: ''
 | 
						||
							};
 | 
						||
						} else {
 | 
						||
							this.model[field] = {
 | 
						||
								NAME: ''
 | 
						||
							};
 | 
						||
						}
 | 
						||
 | 
						||
					}
 | 
						||
				});
 | 
						||
			},
 | 
						||
			async handleShowSheet(p) {
 | 
						||
				const json = initFilter(this.ORG_ID, "", "", 0, p.pageIndex ?? 1)
 | 
						||
				let dataSelect = []
 | 
						||
				var defaultChecked = []
 | 
						||
				this.selectorInfo.isMultiple = false
 | 
						||
				if (p.val) {
 | 
						||
					extendRule(json, 'NAME', 9, p.val);
 | 
						||
				}
 | 
						||
				json.Sort = "NAME"
 | 
						||
				json.Order = 1
 | 
						||
				json.Limit = 20
 | 
						||
				if (p.pageIndex) {
 | 
						||
					json.Start = (p.pageIndex - 1) * json.Limit;
 | 
						||
				}
 | 
						||
				if (p.name == 'Nav_MointerDepartment') {
 | 
						||
					extendRule(json, 'ENABLE_STATUS', 1, '0');
 | 
						||
					dataSelect = await WBDepartment(json).then(res => {
 | 
						||
						this.selectorInfo.totalCount = res.TotalCount
 | 
						||
						if (res != undefined && res.Data.length > 0) {
 | 
						||
							for (let i = 0; i < res.Data.length; i++) {
 | 
						||
								res.Data[i].name = res.Data[i].NAME
 | 
						||
								res.Data[i].code = res.Data[i].CODE
 | 
						||
							}
 | 
						||
						}
 | 
						||
						return res.Data
 | 
						||
					})
 | 
						||
				} else if (p.name == 'UserName') {
 | 
						||
					if (this.model.MOINTER_DEPARTMENT_ID != undefined && this.model.MOINTER_DEPARTMENT_ID != '')
 | 
						||
						extendRule(json, 'DEPARTMENT_ID', 1, this.model.MOINTER_DEPARTMENT_ID);
 | 
						||
					extendRule(json, 'ENABLE_STATUS', 1, '0');
 | 
						||
					dataSelect = await CheckUseful(json).then(res => {
 | 
						||
						this.selectorInfo.totalCount = res.TotalCount
 | 
						||
						if (res != undefined && res.Data.length > 0) {
 | 
						||
							for (let i = 0; i < res.Data.length; i++) {
 | 
						||
								res.Data[i].name = res.Data[i].NAME
 | 
						||
								res.Data[i].code = res.Data[i].CODE
 | 
						||
							}
 | 
						||
						}
 | 
						||
						return res.Data
 | 
						||
					})
 | 
						||
				}
 | 
						||
 | 
						||
 | 
						||
				this.selectorInfo = {
 | 
						||
					itemData: p.itemData != undefined ? p.itemData : this.selectorInfo
 | 
						||
						.itemData, //itemData: p.itemData,  搜索的时候  p.itemData为空  赋值修改 为 她自己本身 this.selectorInfo.itemData
 | 
						||
					isMultiple: this.selectorInfo.isMultiple,
 | 
						||
					totalCount: this.selectorInfo.totalCount,
 | 
						||
					showPopup: true,
 | 
						||
					title: p.title,
 | 
						||
					name: p.name,
 | 
						||
					dataLists: dataSelect,
 | 
						||
					defaultChecked: defaultChecked
 | 
						||
				}
 | 
						||
			},
 | 
						||
			//数据加载
 | 
						||
			handleSearch(val, pageIndex) {
 | 
						||
				var p = {
 | 
						||
					name: this.selectorInfo.name,
 | 
						||
					title: this.selectorInfo.title,
 | 
						||
					val: val,
 | 
						||
					pageIndex: pageIndex
 | 
						||
				}
 | 
						||
				this.handleShowSheet(p)
 | 
						||
			},
 | 
						||
 | 
						||
			handleSelected(e) {
 | 
						||
				this.selectorInfo.showPopup = false
 | 
						||
				if (this.selectorInfo.name == 'UserName') { //交底人
 | 
						||
					this.model.Nav_MointerUser = e
 | 
						||
					this.model.MOINTER_USER_ID = e.ID
 | 
						||
				} else if (this.selectorInfo.name == 'Nav_MointerDepartment') {
 | 
						||
					this.model.Nav_MointerDepartment = e
 | 
						||
					this.model.MOINTER_DEPARTMENT_ID = e.ID
 | 
						||
				}
 | 
						||
			},
 | 
						||
 | 
						||
 | 
						||
			submit() {
 | 
						||
				const ele = this.$refs
 | 
						||
				ele['wForm'].validate().then(res => {
 | 
						||
					this.modelEdit = JSON.parse(JSON.stringify(this.model))
 | 
						||
					delete this.modelEdit.Nav_Project
 | 
						||
					delete this.modelEdit.Nav_MointerUser
 | 
						||
					delete this.modelEdit.Nav_Project
 | 
						||
					delete this.modelEdit.Nav_Type
 | 
						||
					delete this.modelEdit.Nav_User
 | 
						||
					delete this.modelEdit.Nav_MointerDepartment
 | 
						||
					if (this.TaskID == null || this.TaskID == '') {
 | 
						||
						this.modelEdit.TaskID = '00000000-0000-0000-0000-000000000000'
 | 
						||
					} else {
 | 
						||
						this.modelEdit.TaskID = this.TaskID
 | 
						||
					}
 | 
						||
 | 
						||
					if (this.modelEdit.ORG_ID == null || this.modelEdit.ORG_ID == '')
 | 
						||
						this.modelEdit.ORG_ID = this.ORG_ID
 | 
						||
					this.modelEdit.PUBLISH = 'SaveAndNotify'
 | 
						||
					WBCheckFullUpdate(this.modelEdit).then(res => {
 | 
						||
						uni.$showMsgFunc('操作成功!', () => {
 | 
						||
							uni.navigateBack()
 | 
						||
						}, 'success', 1000)
 | 
						||
					})
 | 
						||
 | 
						||
				}).catch(err => {
 | 
						||
					uni.$showErrorInfo(err[0].message + '!')
 | 
						||
				})
 | 
						||
 | 
						||
			},
 | 
						||
		}
 | 
						||
	}
 | 
						||
</script>
 | 
						||
 | 
						||
<style scoped>
 | 
						||
	@import url("../../../../style/css/newTemplate.css");
 | 
						||
	/* @import url("../../../../style/css/editTemplate.css"); */
 | 
						||
 | 
						||
	/* .todo-page {
 | 
						||
		padding: 16px 16px 70px;
 | 
						||
	} */
 | 
						||
</style> |