670 lines
		
	
	
		
			22 KiB
		
	
	
	
		
			Vue
		
	
	
	
	
	
			
		
		
	
	
			670 lines
		
	
	
		
			22 KiB
		
	
	
	
		
			Vue
		
	
	
	
	
	
<!-- WB013 外包工程危险作业申请编辑 -->
 | 
						||
<template>
 | 
						||
	<view class="todo-page">
 | 
						||
		<view class="background"></view>
 | 
						||
		<view class="card">
 | 
						||
			<!-- <uni-card margin="0" :is-shadow="true"> -->
 | 
						||
			<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="Product_Unit" @click="handleChange('minetype')" borderBottom>
 | 
						||
					<u--input v-model="model.Product_Unit" disabled disabledColor="#ffffff" placeholder="请选择生产单元" 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 label="年度" prop="Nav_Project.NAME" borderBottom>
 | 
						||
					<u--input disabledColor="#ffffff" v-model="model.YEARPLAN" border="none" inputAlign="right" fontSize="14px"></u--input>
 | 
						||
				</u-form-item>
 | 
						||
				<u-form-item label="制定部门" prop="Nav_Department.NAME" borderBottom>
 | 
						||
					<u--input disabled disabledColor="#ffffff" v-model="model.Nav_Department.NAME" border="none" inputAlign="right"></u--input> </u-form-item>
 | 
						||
				<u-form-item label="制定人" prop="Nav_User.NAME" borderBottom>
 | 
						||
					<u--input disabled disabledColor="#ffffff" v-model="model.Nav_User.NAME" border="none"  inputAlign="right">
 | 
						||
 | 
						||
					</u--input>
 | 
						||
				</u-form-item>
 | 
						||
				<u-form-item label="制定时间" prop="CREATE_TIME" borderBottom @click="showCheckDate(1)">
 | 
						||
					<u--input disabled disabledColor="#fff" v-model="model.CREATE_TIME" placeholder="请选择制定时间" border="none" inputAlign="right" fontSize="14px"></u--input>
 | 
						||
					<u-icon style="margin-left: 4px;" name="arrow-down" size="12"></u-icon>
 | 
						||
				</u-form-item>
 | 
						||
				<view class="upload-title">维保方案</view>
 | 
						||
				<full-upload v-model="model.Nav_Files" :isShowBtn="true" :listProp="listPropUpload" :listPropVal="listPropValUpload"></full-upload>
 | 
						||
 | 
						||
			</u--form>
 | 
						||
			<u--form labelPosition="left" labelWidth="auto" labelAlign="center" errorType="border-bottom" ref="sForm" class="sub-form" style="margin-top: 20px;" v-if="model.Nav_PlanDetails">
 | 
						||
				<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>
 | 
						||
 | 
						||
				<uni-collapse :border="false" accordion>
 | 
						||
					<view v-for="(item, index) in model.Nav_PlanDetails.filter(i => !i.IS_DELETED)" :key="index">
 | 
						||
						<uni-collapse-item title-border="none" :border="false">
 | 
						||
							<template v-slot:title>
 | 
						||
								<view class="uni-collapse-item__title-box">
 | 
						||
									<view class="uni-collapse-item__title-text">
 | 
						||
										{{item.Nav_DeviceBase?index+1+'.'+item.Nav_DeviceBase.NAME:index+1+'.'}}
 | 
						||
									</view>
 | 
						||
									<view @click.stop style="margin-right: 10px;">
 | 
						||
 | 
						||
										<u-icon @click="handleDelRowBefore(item)" name="trash" color="#ff4d4f" size="21" style="margin-right: 10px;"></u-icon>
 | 
						||
										<!-- <u-icon name="arrow-down" size="12"></u-icon> -->
 | 
						||
									</view>
 | 
						||
								</view>
 | 
						||
							</template>
 | 
						||
							<view class="content" style="padding: 0px 0px 0px 10px;">
 | 
						||
								<u-form-item class="subRequired" label="设备名称" prop="Nav_Device.NAME" borderBottom @click="handleShowSheetForArea(item,{title: '设备名称', name: 'Nav_DeviceBase'})">
 | 
						||
									<u--input disabled fontSize="14px" placeholder="请选择设备名称" disabledColor="#fff" v-model="item.Nav_DeviceBase.NAME" border="none" inputAlign="right" v-if="item.Nav_DeviceBase"></u--input>
 | 
						||
									<u-icon style="margin-left: 4px;" name="arrow-down" size="12" ></u-icon>
 | 
						||
								</u-form-item>
 | 
						||
								<u-form-item label="内部编号" prop="POSITION" borderBottom>
 | 
						||
									<u--input disabled disabledColor="#ffffff"  v-model="item.Nav_DeviceBase.MACHINE_CODE" border="none" inputAlign="right" fontSize="14px" v-if="item.Nav_DeviceBase">
 | 
						||
									</u--input>
 | 
						||
								</u-form-item>
 | 
						||
								<u-form-item label="规格/型号" prop="POSITION" borderBottom>
 | 
						||
									<u--input disabled disabledColor="#ffffff" v-model="item.SPEC" border="none" inputAlign="right" fontSize="14px">
 | 
						||
									</u--input>
 | 
						||
								</u-form-item>
 | 
						||
								<u-form-item label="位置" prop="POSITION" borderBottom>
 | 
						||
									<u--input disabled disabledColor="#ffffff" v-model="item.POSITION" border="none" inputAlign="right" fontSize="14px">
 | 
						||
									</u--input>
 | 
						||
								</u-form-item>
 | 
						||
								<u-form-item label="开始时间" prop="CHECK_TIME" borderBottom @click="showCheckDate(2,item)">
 | 
						||
									<u--input disabledColor="#fff" disabled v-model="item.RUNSETTIME" placeholder="请选择开始时间" 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 label="结束时间" prop="CHECK_TIME" borderBottom @click="showCheckDate(3,item)">
 | 
						||
									<u--input disabledColor="#fff" disabled v-model="item.ENDTIME" placeholder="请选择结束时间" 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 label="维保内容" prop="POSITION" borderBottom>
 | 
						||
									<u--input disabledColor="#ffffff" v-model="item.CONTENTS" border="none" inputAlign="right" fontSize="14px" placeholder="请输入维保内容">
 | 
						||
									</u--input>
 | 
						||
								</u-form-item>
 | 
						||
								<u-form-item label="维保周期" prop="Product_Unit" @click="handleChange('PLANCHECKFREQUENCY',item)" borderBottom>
 | 
						||
									<u--input v-model="item.PLANCHECKFREQUENCYShow" disabled disabledColor="#ffffff" placeholder="请选择维保周期" 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 label="维保人员" prop="Nav_User.NAME" borderBottom @click="handleShowSheetForArea(item,{title: '维保人员', name: 'Nav_User'})">
 | 
						||
									<u--input disabled fontSize="14px" placeholder="请选择维保人员" disabledColor="#fff" v-model="item.Nav_User.NAME" border="none" inputAlign="right" v-if="item.Nav_User"></u--input>
 | 
						||
									<u-icon style="margin-left: 4px;" name="arrow-down" size="12" ></u-icon>
 | 
						||
								</u-form-item>
 | 
						||
								
 | 
						||
								<!-- 	<view class="upload-title">附件</view>
 | 
						||
								<full-upload v-model="item.Nav_DetailFiles" :isShowBtn='true' :listProp='listPropUpload' :listPropVal='listPropValUpload'></full-upload> -->
 | 
						||
 | 
						||
 | 
						||
							</view>
 | 
						||
 | 
						||
 | 
						||
						</uni-collapse-item>
 | 
						||
					</view>
 | 
						||
				</uni-collapse>
 | 
						||
				<view style="margin-top: 10px;">
 | 
						||
					<u-button text="新增" type="primary" @click="handleAdd"></u-button>
 | 
						||
				</view>
 | 
						||
			</u--form>
 | 
						||
 | 
						||
			<!-- </uni-card> -->
 | 
						||
		</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" />
 | 
						||
		<u-datetime-picker :show="dateTimePickerInfo.showCheckDate" v-model='dateTimePickerInfo.defaultDateTime' @confirm="handleCheckDate" @close="dateTimePickerInfo.showCheckDate = false"
 | 
						||
			@cancel="dateTimePickerInfo.showCheckDate = false" :mode="dateTimePickerInfo.mode"></u-datetime-picker>
 | 
						||
		<u-picker :show="comPickerInfo.showSheet" :columns="comPickerInfo.columns" @confirm="onConfirmPicker" @close="comPickerInfo.showSheet=false" @cancel="comPickerInfo.showSheet=false" keyName="NAME"></u-picker>
 | 
						||
		<view style="padding: 10px 16px;display: flex;flex-direction: row;" class="bottom-button">
 | 
						||
			<u-button type="primary" @click="submit" color="#3d4b70" :disabled="isLoadOK">提交</u-button>
 | 
						||
		</view>
 | 
						||
		<!-- <view style="padding: 10px 16px;" v-if='isLoadOK' class="bottom-button">
 | 
						||
			<u-button type="primary" @click="submit" color="#3d4b70">提交</u-button>
 | 
						||
		</view> -->
 | 
						||
		<!-- 		<view class="bottom-button">
 | 
						||
			<button type="primary" v-if='isLoadOK' @click="submit">提交</button>
 | 
						||
		</view> -->
 | 
						||
	</view>
 | 
						||
</template>
 | 
						||
 | 
						||
<script>
 | 
						||
	import {
 | 
						||
		mapState,
 | 
						||
		mapMutations
 | 
						||
	} from 'vuex'
 | 
						||
	import {
 | 
						||
		extendFilterGroup,
 | 
						||
		extendGroupRule,
 | 
						||
		extendInclude,
 | 
						||
		extendOrder,
 | 
						||
		extendRule,
 | 
						||
		guid,
 | 
						||
		initFilter,
 | 
						||
		initFilterGroup,
 | 
						||
		getRealIndex
 | 
						||
	} from '../../../../utils/common'
 | 
						||
	import {
 | 
						||
		FMProductionUnit,
 | 
						||
		CheckPeriods,
 | 
						||
		CheckLevels,
 | 
						||
		MineTypeIndex,
 | 
						||
		MineTypeName
 | 
						||
	} from '../../../../utils/enums.js'
 | 
						||
	import {
 | 
						||
		DMPGet,
 | 
						||
		DMPFull,
 | 
						||
		DMUser,
 | 
						||
		DMDeviceBase
 | 
						||
	} from '../../../../services/apply/subPages/DM/dm';
 | 
						||
 | 
						||
	import {
 | 
						||
		getEnum
 | 
						||
	} from '../../../../services/common';
 | 
						||
 | 
						||
	import config from '../../../../config/common'
 | 
						||
	export default {
 | 
						||
		data() {
 | 
						||
			return {
 | 
						||
				tableKey: '0',
 | 
						||
				TaskID: '',
 | 
						||
				ID: '',
 | 
						||
				ORG_ID: uni.getStorageSync('orgId'),
 | 
						||
				isLoadOK: true,
 | 
						||
				stepsPageList: 0,
 | 
						||
				listISORNOT: [], //是否涉及
 | 
						||
				listType: [],
 | 
						||
				listResult: [],
 | 
						||
				listResultText: [],
 | 
						||
				listISORNOTText: [],
 | 
						||
				listPropUpload: ['PARENT_ID'],
 | 
						||
				listPropValUpload: [],
 | 
						||
				indexShow: 0,
 | 
						||
 | 
						||
				model: {
 | 
						||
					Nav_Department: {
 | 
						||
						NAME: ''
 | 
						||
					},
 | 
						||
					NavUsersName: '',
 | 
						||
					Nav_User: {
 | 
						||
						NAME: ""
 | 
						||
					},
 | 
						||
					Product_Unit: '',
 | 
						||
					ID: '',
 | 
						||
					ORG_ID: '',
 | 
						||
					TaskID: null,
 | 
						||
					Nav_PlanDetails: []
 | 
						||
				},
 | 
						||
				rules: {
 | 
						||
 | 
						||
				},
 | 
						||
				comPickerInfo: {
 | 
						||
					showSheet: false,
 | 
						||
					dataItem: {},
 | 
						||
					columns: [],
 | 
						||
					title: '',
 | 
						||
					dataIndex: undefined,
 | 
						||
					formIndex: undefined,
 | 
						||
					name: ''
 | 
						||
				},
 | 
						||
 | 
						||
				selectorInfo: {
 | 
						||
					name: 'user',
 | 
						||
					isMultiple: false,
 | 
						||
					showPopup: false,
 | 
						||
					totalCount: 0,
 | 
						||
					title: '考核结果选择',
 | 
						||
					dataItem: {},
 | 
						||
					index: 0,
 | 
						||
					columns: [],
 | 
						||
					dataLists: [],
 | 
						||
					defaultText: '',
 | 
						||
					defaultChecked: []
 | 
						||
				},
 | 
						||
				dateTimePickerInfo: {
 | 
						||
					showCheckDate: false,
 | 
						||
					dataIndex: undefined,
 | 
						||
					defaultDateTime: uni.$u.timeFormat(new Date(), 'yyyy-mm-dd hh:MM:ss'),
 | 
						||
					value: '',
 | 
						||
					name: '',
 | 
						||
					mode: ''
 | 
						||
				},
 | 
						||
			}
 | 
						||
		},
 | 
						||
		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.ID = option.ID
 | 
						||
			this.TaskID = option.taskID
 | 
						||
			this.tableKey = option.tableKey
 | 
						||
 | 
						||
			if (option.taskID != null && option.taskID != '')
 | 
						||
				this.model.TaskID = option.taskID
 | 
						||
			this.getEnums()
 | 
						||
			// this.loadData()
 | 
						||
		},
 | 
						||
		methods: {
 | 
						||
			getEnums() {
 | 
						||
				var dataParm = {
 | 
						||
					'name': "FMProductionUnit"
 | 
						||
				}
 | 
						||
				getEnum(dataParm).then(res => {
 | 
						||
					this.listISORNOT = res
 | 
						||
					this.listISORNOTText = []
 | 
						||
					this.listISORNOT.forEach(e => {
 | 
						||
						e.name = e.NAME
 | 
						||
						e.code = e.ID
 | 
						||
						this.listISORNOTText.push(e.NAME)
 | 
						||
					})
 | 
						||
					// this.loadData()
 | 
						||
					// this.getEnumeration()
 | 
						||
					this.getConclusion()
 | 
						||
				})
 | 
						||
			},
 | 
						||
			getConclusion() {
 | 
						||
				var dataParm = {
 | 
						||
					'name': "BSPLANCHECKFREQUENCYEnum"
 | 
						||
				}
 | 
						||
				getEnum(dataParm).then(res => {
 | 
						||
					this.listResult = res
 | 
						||
					this.listResultText = []
 | 
						||
					this.listResult.forEach(e => {
 | 
						||
						e.name = e.NAME
 | 
						||
						e.code = e.ID
 | 
						||
						this.listResultText.push(e.NAME)
 | 
						||
 | 
						||
					})
 | 
						||
					this.loadData()
 | 
						||
				})
 | 
						||
			},
 | 
						||
			changeConfirm(item) {
 | 
						||
				const validDetails = this.model.Nav_PlanDetails.filter(i => !i.IS_DELETED);
 | 
						||
				const index = validDetails.indexOf(item);
 | 
						||
				const realIndex = this.model.Nav_PlanDetails.findIndex(item => item === validDetails[index]);
 | 
						||
				this.model.Nav_PlanDetails[realIndex].ISOCONFIRM = true;
 | 
						||
			},
 | 
						||
			handleDelRowBefore(item) {
 | 
						||
				item.IS_DELETED = true
 | 
						||
				let indexNotDel = 1
 | 
						||
				this.model.Nav_PlanDetails.forEach((e, i) => {
 | 
						||
					if (!e.IS_DELETED) {
 | 
						||
						e.ROW_NO = indexNotDel
 | 
						||
						indexNotDel++
 | 
						||
					}
 | 
						||
				})
 | 
						||
				this.$forceUpdate()
 | 
						||
			},
 | 
						||
			stepAdd() {
 | 
						||
				this.stepsPageList = this.stepsPageList + 1
 | 
						||
 | 
						||
			},
 | 
						||
			stepReduce() {
 | 
						||
				this.stepsPageList = this.stepsPageList - 1
 | 
						||
			},
 | 
						||
			loadData() {
 | 
						||
				let json = initFilter(this.ORG_ID);
 | 
						||
				extendRule(json, 'ID', 1, this.ID);
 | 
						||
				extendInclude(json, 'Nav_Department');
 | 
						||
				extendInclude(json, 'Nav_User');
 | 
						||
				extendInclude(json, 'Nav_PlanDetails');
 | 
						||
				extendInclude(json, 'Nav_Files.Nav_ImgFile');
 | 
						||
				extendInclude(json, 'Nav_PlanDetails.Nav_DeviceBase');
 | 
						||
				extendInclude(json, 'Nav_PlanDetails.Nav_User');
 | 
						||
 | 
						||
				DMPGet(json).then(ret => {
 | 
						||
					this.isLoadOK = false
 | 
						||
					this.model = ret
 | 
						||
					this.model.ID = this.ID
 | 
						||
					this.model.Product_Unit = this.listISORNOT.find(item => item.code === this.model.MineType).name
 | 
						||
					// this.model.CHECKTYPENAME = this.listType.find(item => item.ID === this.model.CHECKTYPE).NAME
 | 
						||
					this.listPropValUpload.push(this.ID)
 | 
						||
					if (this.model.Nav_PlanDetails && this.model.Nav_PlanDetails.length > 0) {
 | 
						||
						this.model.Nav_PlanDetails.map(item => {
 | 
						||
							item.RUNSETTIME = uni.$u.timeFormat(item.RUNSETTIME,
 | 
						||
								'yyyy-mm-dd')
 | 
						||
 | 
						||
							item.ENDTIME = uni.$u.timeFormat(item.ENDTIME,
 | 
						||
								'yyyy-mm-dd')
 | 
						||
							item.PLANCHECKFREQUENCYShow = this.listResult.find(item1 => item1.code === item.PLANCHECKFREQUENCY).name
 | 
						||
 | 
						||
						})
 | 
						||
					}
 | 
						||
 | 
						||
					// uni.$updateData()
 | 
						||
 | 
						||
				});
 | 
						||
 | 
						||
 | 
						||
 | 
						||
				this.listPropValUpload.push(this.model.ID)
 | 
						||
			},
 | 
						||
			// getEnumeration() {
 | 
						||
			// 	var dataParm = {
 | 
						||
			// 		'name': "CheckType"
 | 
						||
			// 	}
 | 
						||
			// 	getEnum(dataParm).then(res => {
 | 
						||
			// 		this.listType = res
 | 
						||
			// 	})
 | 
						||
			// },
 | 
						||
			//显示时间控件
 | 
						||
			showCheckDate(dataIndex, item) {
 | 
						||
				// let date = new Date()
 | 
						||
				// this.dateTimePickerInfo.showCheckDate = true
 | 
						||
				this.dateTimePickerInfo = {
 | 
						||
					showCheckDate: true,
 | 
						||
					defaultDateTime: uni.$u.timeFormat(new Date(), 'yyyy-mm-dd'),
 | 
						||
					dataIndex: dataIndex,
 | 
						||
					item: item,
 | 
						||
					mode: dataIndex == 1 ? 'datetime' : 'date'
 | 
						||
				}
 | 
						||
			},
 | 
						||
			//隐藏控件 显示时间
 | 
						||
			handleCheckDate(e) {
 | 
						||
 | 
						||
				if (this.dateTimePickerInfo.dataIndex == 1) {
 | 
						||
					this.model.CREATE_TIME = uni.$u.timeFormat(e.value,
 | 
						||
						'yyyy-mm-dd hh:MM:ss')
 | 
						||
				} else if (this.dateTimePickerInfo.dataIndex == 2) {
 | 
						||
					const realIndex = getRealIndex(this.dateTimePickerInfo.item, this.model.Nav_PlanDetails)
 | 
						||
					this.model.Nav_PlanDetails[realIndex].RUNSETTIME = uni.$u.timeFormat(e.value,
 | 
						||
						'yyyy-mm-dd')
 | 
						||
				} else if (this.dateTimePickerInfo.dataIndex == 3) {
 | 
						||
					const realIndex = getRealIndex(this.dateTimePickerInfo.item, this.model.Nav_PlanDetails)
 | 
						||
					this.model.Nav_PlanDetails[realIndex].ENDTIME = uni.$u.timeFormat(e.value,
 | 
						||
						'yyyy-mm-dd')
 | 
						||
				}
 | 
						||
				this.dateTimePickerInfo.showCheckDate = false
 | 
						||
 | 
						||
			},
 | 
						||
			initializeMissingFields() {
 | 
						||
				const fields = ['Nav_Project', 'Nav_Type', 'Nav_User'];
 | 
						||
				fields.forEach(field => {
 | 
						||
					if (!this.model[field]) {
 | 
						||
						if (field == 'Nav_Project') {
 | 
						||
							this.model[field] = {
 | 
						||
								NAME: '',
 | 
						||
								UNIT_NAME: ''
 | 
						||
							};
 | 
						||
						} else {
 | 
						||
							this.model[field] = {
 | 
						||
								NAME: ''
 | 
						||
							};
 | 
						||
						}
 | 
						||
 | 
						||
					}
 | 
						||
				});
 | 
						||
			},
 | 
						||
 | 
						||
			handleShowSheetForArea(item, todo) {
 | 
						||
				const validDetails = this.model.Nav_PlanDetails.filter(i => !i.IS_DELETED);
 | 
						||
				const index = validDetails.indexOf(item);
 | 
						||
				this.handleShowSheet({
 | 
						||
					title: todo.title,
 | 
						||
					name: todo.name,
 | 
						||
					index: index
 | 
						||
				});
 | 
						||
			},
 | 
						||
			async handleShowSheet(p) {
 | 
						||
				const orgId = uni.getStorageSync('orgId')
 | 
						||
				const json = initFilter(orgId, "", "", 0, p.pageIndex ?? 1)
 | 
						||
				// 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.Limit = 20
 | 
						||
				if (p.pageIndex) {
 | 
						||
					json.Start = (p.pageIndex - 1) * json.Limit;
 | 
						||
				}
 | 
						||
				json.Sort = 'NAME'
 | 
						||
				// json.SelectField = ["ID", "NAME", "NAME", "CODE"]
 | 
						||
				// json.Sort = "NAME"
 | 
						||
				// json.Order = 1
 | 
						||
				if (p.name == 'Nav_DeviceBase') {
 | 
						||
					extendRule(json, 'DEVICE_STATUS', 1, '1');
 | 
						||
					dataSelect = await DMDeviceBase(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
 | 
						||
							}
 | 
						||
						}
 | 
						||
						return res.Data
 | 
						||
					})
 | 
						||
				} else if (p.name == 'Nav_User') {
 | 
						||
					let data = uni.getStorageSync('appInfo').User
 | 
						||
					extendRule(json, 'DEPARTMENT_ID', 1, data.DEPARTMENT_ID);
 | 
						||
					dataSelect = await DMUser(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
 | 
						||
							}
 | 
						||
						}
 | 
						||
						return res.Data
 | 
						||
					})
 | 
						||
				}
 | 
						||
 | 
						||
				if (defaultChecked == null)
 | 
						||
					defaultChecked = []
 | 
						||
				if (dataSelect.length) {
 | 
						||
					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,
 | 
						||
						index: p.index
 | 
						||
					}
 | 
						||
				} else {
 | 
						||
					// 暂无数据
 | 
						||
				}
 | 
						||
			},
 | 
						||
			//数据加载
 | 
						||
			handleSearch(val, pageIndex) {
 | 
						||
				var p = {
 | 
						||
					name: this.selectorInfo.name,
 | 
						||
					title: this.selectorInfo.title,
 | 
						||
					val: val,
 | 
						||
					pageIndex: pageIndex,
 | 
						||
					index: this.selectorInfo.index
 | 
						||
				}
 | 
						||
				this.handleShowSheet(p)
 | 
						||
			},
 | 
						||
 | 
						||
			handleSelected(e) {
 | 
						||
			this.selectorInfo.showPopup = false
 | 
						||
			const validDetails = this.model.Nav_PlanDetails.filter(i => !i.IS_DELETED);
 | 
						||
			const index = this.selectorInfo.index;
 | 
						||
			const realIndex = this.model.Nav_PlanDetails.findIndex(item => item === validDetails[index]);
 | 
						||
			if (this.selectorInfo.name == 'Nav_DeviceBase' ) {
 | 
						||
				this.model.Nav_PlanDetails[realIndex].Nav_DeviceBase = e;
 | 
						||
				this.model.Nav_PlanDetails[realIndex].DEVICE_BASE_ID = e.ID;
 | 
						||
				this.model.Nav_PlanDetails[realIndex].SPEC = e.SPEC;
 | 
						||
				this.model.Nav_PlanDetails[realIndex].POSITION = e.POSITION;
 | 
						||
			}else if (this.selectorInfo.name == 'Nav_User') {
 | 
						||
				this.model.Nav_PlanDetails[realIndex].Nav_User = e;
 | 
						||
				this.model.Nav_PlanDetails[realIndex].USER_ID = e.ID;
 | 
						||
			}
 | 
						||
 | 
						||
 | 
						||
			},
 | 
						||
			submit() {
 | 
						||
				// for (let item of this.model.Nav_PlanDetails.filter(i => !i.IS_DELETED)) {
 | 
						||
				// 	if (item.CHECK_VALUEShow == '不正常' && !item.DESCRIPTION) {
 | 
						||
				// 		uni.$showErrorInfo('请填写不正常结论的问题描述!')
 | 
						||
				// 		return
 | 
						||
				// 	}
 | 
						||
				// 	if (!item.CHECK_VALUEShow) {
 | 
						||
				// 		uni.$showErrorInfo('请选择点检结论!')
 | 
						||
				// 		return
 | 
						||
				// 	}
 | 
						||
				// 	item.TaskID = this.TaskID
 | 
						||
				// }
 | 
						||
				this.modelEdit = JSON.parse(JSON.stringify(this.model))
 | 
						||
 | 
						||
				// delete this.modelEdit.Nav_DeviceBase
 | 
						||
				delete this.modelEdit.Nav_Department
 | 
						||
				delete this.modelEdit.Nav_User
 | 
						||
				this.modelEdit.Nav_PlanDetails.map(item => {
 | 
						||
					if(!item.IS_DELETED){
 | 
						||
						item.STATUS_APPROVE = '10' //只针对点检巡检,后端根据status判断
 | 
						||
					}
 | 
						||
					
 | 
						||
					delete item.Nav_Department
 | 
						||
					delete item.Nav_User
 | 
						||
					delete item.Nav_DeviceBase
 | 
						||
					if(item.PLANCHECKFREQUENCY==''){
 | 
						||
						delete item.PLANCHECKFREQUENCY
 | 
						||
							delete item.PLANCHECKFREQUENCYShow
 | 
						||
					}
 | 
						||
					if(item.CONTENTS==''){
 | 
						||
						delete item.CONTENTS
 | 
						||
					}
 | 
						||
					if(item.ENDTIME==''){
 | 
						||
						delete item.ENDTIME
 | 
						||
					}
 | 
						||
					if(item.RUNSETTIME==''){
 | 
						||
						delete item.RUNSETTIME
 | 
						||
					}
 | 
						||
					if(item.POSITION==''){
 | 
						||
						delete item.POSITION
 | 
						||
					}
 | 
						||
					if(item.SPEC==''){
 | 
						||
						delete item.SPEC
 | 
						||
					}
 | 
						||
					
 | 
						||
				})
 | 
						||
				const result = this.modelEdit.Nav_Files .map(item=>{
 | 
						||
					 return {
 | 
						||
					    ID: item.ID,
 | 
						||
					    IMG_FILE_ID: item.IMG_FILE_ID,
 | 
						||
						 ORG_ID: item.ORG_ID,
 | 
						||
						  PLAN_ID: this.model.ID
 | 
						||
					  };
 | 
						||
				})
 | 
						||
				this.modelEdit.Nav_Files = result
 | 
						||
				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.STATUS_APPROVE = '10' //只针对点检巡检,后端根据status判断 
 | 
						||
				// console.log(this.modelEdit,'this.modelEdit')
 | 
						||
				DMPFull(this.modelEdit).then(res => {
 | 
						||
					uni.$showMsgFunc('操作成功!', () => {
 | 
						||
						uni.navigateBack()
 | 
						||
					}, 'success', 1000)
 | 
						||
				})
 | 
						||
 | 
						||
			},
 | 
						||
			handleAdd() {
 | 
						||
				if (this.model.Nav_PlanDetails == null) {
 | 
						||
					this.model.Nav_PlanDetails = []
 | 
						||
				}
 | 
						||
 | 
						||
				var ROW_NO = 1;
 | 
						||
				if (this.model.Nav_PlanDetails.length > 0) {
 | 
						||
					this.model.Nav_PlanDetails.forEach(e => {
 | 
						||
						if (e.IS_DELETED == undefined || e.IS_DELETED == false)
 | 
						||
							ROW_NO++
 | 
						||
					})
 | 
						||
				}
 | 
						||
				var modelAdd = {
 | 
						||
					ID: guid(),
 | 
						||
					ORG_ID: this.ORG_ID,
 | 
						||
					DEVICE_MAINTENANCE_PLAN_ID: this.model.ID,
 | 
						||
					ROW_NUM: ROW_NO,
 | 
						||
					Nav_DeviceBase: {
 | 
						||
						NAME:'',
 | 
						||
						MACHINE_CODE:''
 | 
						||
					},
 | 
						||
					SPEC: '',
 | 
						||
					POSITION: '',
 | 
						||
					RUNSETTIME:'',
 | 
						||
					ENDTIME:'',
 | 
						||
					CONTENTS:'',
 | 
						||
					PLANCHECKFREQUENCY: '',
 | 
						||
					PLANCHECKFREQUENCYShow: '',
 | 
						||
					Nav_User: {
 | 
						||
						NAME:'',	
 | 
						||
					},
 | 
						||
					IS_DELETED: false,
 | 
						||
				}
 | 
						||
				this.model.Nav_PlanDetails.push(modelAdd)
 | 
						||
				this.indexShow = ROW_NO
 | 
						||
			},
 | 
						||
 | 
						||
			handleChange(name, item) {
 | 
						||
				if (name == 'minetype') {
 | 
						||
					this.comPickerInfo = {
 | 
						||
						showSheet: true,
 | 
						||
						columns: [this.listISORNOTText],
 | 
						||
						name: name
 | 
						||
					}
 | 
						||
				} else if (name == 'PLANCHECKFREQUENCY') {
 | 
						||
					this.comPickerInfo = {
 | 
						||
						showSheet: true,
 | 
						||
						columns: [this.listResultText],
 | 
						||
						dataItem: item,
 | 
						||
						name: name
 | 
						||
					}
 | 
						||
				}
 | 
						||
 | 
						||
			},
 | 
						||
			onConfirmPicker(e) {
 | 
						||
				if (this.comPickerInfo.name == 'minetype') {
 | 
						||
					this.comPickerInfo = {
 | 
						||
						showSheet: false,
 | 
						||
						columns: [],
 | 
						||
						title: '',
 | 
						||
						formIndex: undefined
 | 
						||
					}
 | 
						||
					this.model.Product_Unit = e.value[0]
 | 
						||
					this.model.MineType = this.listISORNOT[e.indexs[0]].code
 | 
						||
				} else if (this.comPickerInfo.name == 'PLANCHECKFREQUENCY') {
 | 
						||
					this.comPickerInfo = {
 | 
						||
						showSheet: false,
 | 
						||
						dataItem: this.comPickerInfo.dataItem,
 | 
						||
						columns: [],
 | 
						||
						title: '',
 | 
						||
						name: '',
 | 
						||
						formIndex: undefined
 | 
						||
					}
 | 
						||
					this.comPickerInfo.dataItem.PLANCHECKFREQUENCYShow = e.value[0]
 | 
						||
					this.comPickerInfo.dataItem.PLANCHECKFREQUENCY = this.listResult[e.indexs[0]].code
 | 
						||
				}
 | 
						||
 | 
						||
 | 
						||
			}
 | 
						||
		}
 | 
						||
	}
 | 
						||
</script>
 | 
						||
 | 
						||
<style scoped>
 | 
						||
	@import url("../../../../style/css/newTemplate.css");
 | 
						||
	/* @import url("../../../../style/css/editTemplate.css"); */
 | 
						||
 | 
						||
	/* .todo-page {
 | 
						||
		padding: 16px 16px 70px;
 | 
						||
	} */
 | 
						||
</style> |