<template>
	<el-dialog
	 :close-on-click-modal="false"
	 :close-on-press-escape="false"
	 :title="dialogTitle"
	 :visible.sync="dialogVisible"
	 top="50px"
	 width="85%"
	>
		<div class="tabsdom">
			<el-tabs v-model="activeName" @tab-click="handleClick">
				<el-tab-pane label="请假申请" name="first">

					<el-card shadow="always" style="padding: 20px 10px 10px 20px">
						<div v-for="(item,index) in hoildaylist" style="margin:10px 0px">
							<el-row v-if="item.offWorkType==1" :gutter="10" class="holidayRow">
								<el-col :span="2" class="col-txt">
									<div style="width: 100%">
										&nbsp;
										<span v-if="index==0">请假类型 </span>
									</div>
								</el-col>
								<el-col :span="5">
									<el-select
									 v-model="item.offWorkType"

									 filterable
									 placeholder="请假类型"
									 @change="getHolidayType($event,index,item)"
									>
										<el-option
										 v-for="itam in ProjectData"
										 :key="itam.name"
										 :disabled="!itam.disabled"
										 :label="itam.name"
										 :value="itam.type"
										/>
									</el-select>
								</el-col>
								<el-col :span="4">
									<el-date-picker
									 v-model="item.startDate"
									 placeholder="选择日期"
									 style="width: 100%!important;"
									 type="date"
									 value-format="yyyy-MM-dd"
									 width="100%"
									 @change="countDays(item.startDate,item.endDate,item.startIsAllday,item.endIsAllday,index,item.offWorkType)"
									/>
								</el-col>
								<el-col :span="2">

									<el-select
									 v-model="item.startIsAllday"
									 filterable
									 placeholder=""
									 @change="countDays(item.startDate,item.endDate,item.startIsAllday,item.endIsAllday,index,item.offWorkType)"
									>

										<el-option label="上午" value="上午"/>
										<el-option label="下午" value="下午"/>
									</el-select>
								</el-col>
								<el-col :span="1">
									<div style="height: 1px;background: #606266;width:100%;margin-top:40%"/>
								</el-col>
								<el-col :span="4">
									<el-date-picker
									 v-model="item.endDate"
									 :readonly="!item.startDate||item.startDate.length==0?true:false"
									 placeholder="选择日期"
									 style="width:100%"
									 type="date"
									 value-format="yyyy-MM-dd"
									 @change="countDays(item.startDate,item.endDate,item.startIsAllday,item.endIsAllday,index,item.offWorkType)"
									/>
								</el-col>
								<el-col :span="2">
									<el-select
									 v-model="item.endIsAllday"
									 filterable
									 placeholder=""
									 @change="countDays(item.startDate,item.endDate,item.startIsAllday,item.endIsAllday,index,item.offWorkType)"
									>

										<el-option label="上午" value="上午"/>
										<el-option label="下午" value="下午"/>
									</el-select>
								</el-col>
								<el-col :span="2" class="col-txt" style="text-align: center">
									共{{
										!item.days ? 0 : item.days
									}}天
								</el-col>
								<el-col :span="1" class="col-txt" style="text-align: center">
									&nbsp;
									<el-button
									 v-if="index!=0"
									 circle
									 icon="el-icon-minus"
									 @click="spliceListRow(index)"
									/>
								</el-col>
								<el-col :span="1" class="col-txt" style="text-align: center">
									<el-button
									 circle
									 icon="el-icon-plus"
									 type="primary"
									 @click="addListRow()"
									/>
								</el-col>
							</el-row>
							<el-row v-if="item.offWorkType==3||item.offWorkType==2" :gutter="10" class="holidayRow">
								<el-col :span="2" class="col-txt">
									<div style="width: 100%">

										<span v-if="index==0">请假类型 </span>&nbsp;
									</div>
								</el-col>
								<el-col :span="5" class="col-input">

									<el-select
									 v-model="item.offWorkType"
									 filterable
									 placeholder="请假类型"
									 style="width: 100%"
									 @change="getHolidayType($event,index,item)"
									>
										<el-option
										 v-for="itam in ProjectData"
										 :key="itam.name"
										 :label="itam.name"
										 :value="itam.type"
										/>
									</el-select>

								</el-col>
								<el-col :span="6">
									<el-date-picker
									 v-model="item.dayMerange"
									 class="pdr10px mgb10px"
									 placeholder="选择日期"
									 type="date"
									 value-format="yyyy-MM-dd"
									>
									</el-date-picker>
								</el-col>
								<el-col :span="7">
									<!--									@change="countDays(item.startDate,item.endDate,item.startIsAllday,item.endIsAllday,index,item.offWorkType)"-->

									<el-time-picker

									 v-model="item.timeMerange"
									 :disabled="!item.dayMerange"
									 class="el-input pdr10px mgb10px"
									 clearable
									 end-placeholder="结束时间" format="HH:mm"
									 is-range
									 range-separator="至"
									 start-placeholder="开始时间"
									 value-format="HH:mm"
									 @change="getTimeMerange(item.timeMerange,item.dayMerange,item.startIsAllday,item.endIsAllday,index,item.offWorkType)"
									/>
								</el-col>
								<el-col :span="2" class="col-txt" style="text-align: center">
									<!--                      {{ JSON.stringify(item) }}-->
									共{{ item.hour }}小时

								</el-col>
								<el-col :span="1" class="col-txt" style="text-align: center">
									&nbsp;
									<el-button
									 v-if="index!=0"
									 circle
									 icon="el-icon-minus"
									 @click="spliceListRow(index)"
									/>
								</el-col>
								<el-col :span="1" class="col-txt" style="text-align: center">
									<el-button
									 circle
									 icon="el-icon-plus"
									 type="primary"
									 @click="addListRow()"
									/>
								</el-col>
							</el-row>
							<el-row v-if="item.offWorkType!=1&& item.offWorkType!=3&&item.offWorkType!=2" :gutter="10"
											class="holidayRow"
							>
								<el-col :span="2" class="col-txt">
									<div style="width: 100%">
										&nbsp;
										<span v-if="index==0">请假类型 </span>
									</div>
								</el-col>
								<el-col :span="5">
									<el-select
									 v-model="item.offWorkType"
									 filterable
									 placeholder="请假类型"
									 @change="getHolidayType($event,index,item)"
									>
										<el-option
										 v-for="itam in ProjectData"
										 :key="itam.name"
										 :disabled="!itam.disabled"
										 :label="itam.name"
										 :value="itam.type"
										/>
									</el-select>
								</el-col>
								<el-col :span="4">
									<el-date-picker
									 v-model="item.startDate"
									 placeholder="选择日期"
									 style="width: 100%!important;"
									 type="date"
									 value-format="yyyy-MM-dd"
									 width="100%"
									 @change="countDays(item.startDate,item.endDate,item.startIsAllday,item.endIsAllday,index,item.offWorkType)"
									/>
								</el-col>
								<el-col :span="2">

									<el-select
									 v-model="item.startIsAllday"
									 filterable
									 placeholder=""
									 @change="countDays(item.startDate,item.endDate,item.startIsAllday,item.endIsAllday,index,item.offWorkType)"
									>

										<el-option label="上午" value="上午"/>
										<el-option label="下午" value="下午"/>
									</el-select>
								</el-col>
								<el-col :span="1">
									<div style="height: 1px;background: #606266;width:100%;margin-top:40%"/>
								</el-col>
								<el-col :span="4">
									<el-date-picker
									 v-model="item.endDate"
									 :readonly="!item.startDate||item.startDate.length==0?true:false"
									 placeholder="选择日期"
									 style="width:100%"
									 type="date"
									 value-format="yyyy-MM-dd"
									 @change="countDays(item.startDate,item.endDate,item.startIsAllday,item.endIsAllday,index,item.offWorkType)"
									/>
								</el-col>
								<el-col :span="2">
									<el-select
									 v-model="item.endIsAllday"
									 filterable
									 placeholder=""
									 @change="countDays(item.startDate,item.endDate,item.startIsAllday,item.endIsAllday,index,item.offWorkType)"
									>

										<el-option label="上午" value="上午"/>
										<el-option label="下午" value="下午"/>
									</el-select>
								</el-col>
								<el-col :span="2" class="col-txt" style="text-align: center">
									共{{
										!item.days ? 0 : item.days
									}}天
								</el-col>
								<el-col :span="1" class="col-txt" style="text-align: center">
									&nbsp;
									<el-button
									 v-if="index!=0"
									 circle
									 icon="el-icon-minus"
									 @click="spliceListRow(index)"
									/>
								</el-col>
								<el-col :span="1" class="col-txt" style="text-align: center">
									<el-button
									 circle
									 icon="el-icon-plus"
									 type="primary"
									 @click="addListRow()"
									/>
								</el-col>
							</el-row>

						</div>
						<div class="totalApplyTime">{{ totalApplyTime }}</div>
						<el-row>
							<el-col :span="2" class="col-txt"><span>请假事由</span></el-col>
							<el-col :span="22">
								<el-input v-model="form.applyReasons" style="min-height:50px;margin-bottom: 25px" type="textarea"/>
							</el-col>
						</el-row>
						<el-row>
							<el-col :span="2" class="col-txt">附件</el-col>

							<el-col :span="22">
								<el-upload
								 :action="$constant.BASE_URI+'/FileController/upload'"
								 :file-list="form.fileUrlList"
								 :http-request="uploadFile"
								 class="upload-demo"
								 multiple
								>
									<el-button size="small" type="primary">点击上传</el-button>
									<div slot="file" slot-scope="{file}">
										<a :href="file.url">{{ file.name }}</a>
										<span class="el-upload-list__item-actions">
                      <i class="el-icon-delete" @click="handlePictureRemove(file,form.fileUrlList)"/>
                    </span>
									</div>
								</el-upload>
							</el-col>
						</el-row>
						<el-row style="margin-top: 25px">
							<el-col :span="2" class="col-txt">抄送</el-col>
							<el-col :span="22">
								<user-select
								 ref="userSelect"
								 :default-select="selectList"
								 :multiple="true"
								 width="700"
								 @selectValue="parentMethod"
								/>
							</el-col>
						</el-row>

					</el-card>

				</el-tab-pane>
				<el-tab-pane label="流程图  " name="second">
					<holidayCanvas ref="holidayCanvas"/>
				</el-tab-pane>
			</el-tabs>
		</div>
		<div slot="footer">
			<el-button @click="dialogVisible = false">取 消</el-button>
			<el-button :loading="loading" type="primary" @click="confirmSubmit()">确 定</el-button>
		</div>
	</el-dialog>

</template>

<script>
import userSelect from '@/views/components/UserSelect.vue'
import { upload } from '@/static/utils/channel'
import Base from '@/views/base/base'
import BaseData from '@/views/base/baseData'
import holidayCanvas from '@/views/workflow/components/myProcess/holidayCanvas.vue'

export default {
	name: 'ApplyPay',
	components: {
		userSelect, holidayCanvas
	},
	mixins: [Base, BaseData],
	data() {
		return {
			row: {},
			freezeHolidayTime: 0,
			freezeExchangeTime: 0,
			confirmForm: {
				confirmContent: ''
			},
			dc_key: ['ORDER_STATUS', 'PAY_TYPE', 'BUDGET_FY', 'COMMON_PHRASES'],
			dc_data: {},
			tableData: [],
			loading: false,
			totalApplyTime: '共计请假0天，0.00小时',
			dialogVisible: false,
			hoildaylist: [
				{ offWorkType: 2, hour: 0, days: 0 }
			],
			fileError: false,
			fileList: [],
			selectList: [],

			form: {
				fileUrlList: []
			},
			daysNum: 0,
			holidayDays: {},

			options: [
				{ value: '陈鹏铭', label: '陈鹏铭' },
				{ value: '宣胜伟', label: '宣胜伟' },
				{ value: '张洮', label: '张洮' },
				{ value: '潘毅', label: '潘毅' },
				{ value: '崔伟', label: '崔伟' }
			],
			value1: [],
			ProjectData: [
				{ name: '年假(剩余x天)', type: 'year' },
				{ name: '调休(x小时)', type: 'affair' },
				{ name: '病假', type: 'illness' }
			],
			dialogTitle: '请假申请',
			activeName: 'first'

		}
	},
	watch: {
		'hoildaylist': {
			deep: true,
			handler(newValue, oldValue) {
				let day = 0
				let hour = 0
				for (let i = 0; i < this.hoildaylist.length; i++) {
					if (this.hoildaylist[i].hour === 0 || this.hoildaylist[i].hour) {
						hour = (hour + Number(this.hoildaylist[i].hour))
					}
					if (this.hoildaylist[i].days === 0 || this.hoildaylist[i].days) {
						day = (day + Number(this.hoildaylist[i].days))
					}
				}
				this.holidayDate = day
				this.holidayTime = Number(hour).toFixed(2)

				this.changeCotalApplyTime(`共计请假${day}天，${hour.toFixed(2)}小时`)
			}
		}
	},
	mounted() {
		const _this = this
		_this.initDict(this.dc_key).then((res) => {
			_this.initProject({ /* signstatus: '2,3'*/ })
		})
	},
	methods: {
		handleClick(tab, event) {
			this.canVasStatus = false
			if (this.activeName == 'second') {
				this.canVasStatus = true
				this.$nextTick(() => {
					this.$refs.holidayCanvas.createNodeCanvas(this.row)

				})
			}
		},
		getTimeMerange(timeMerange, dayMerange, startIsAllday, endIsAllday, index, type) {

			this.hoildaylist[index].startDate = dayMerange + ' ' + timeMerange[0] + ':00'
			this.hoildaylist[index].endDate = dayMerange + ' ' + timeMerange[1] + ':00'
			this.countDays(dayMerange + ' ' + timeMerange[0], dayMerange + ' ' + timeMerange[1], startIsAllday, endIsAllday, index, type)
		},
		countDays(startDate, endDate, startIsAllday, endIsAllday, index, type) {
			// 如果是年假
			if (type == 1) {
				if (startDate && endDate && startIsAllday && endIsAllday) {
					// 判断是不是都已经选择完成
					const endDateParams = new Date(endDate).getTime() //计算一下开始时间
					const startDateParams = new Date(startDate).getTime() //计算一下结束时间
					let days = (endDateParams - startDateParams) / (1000 * 60 * 60 * 24) //开始和结束时间相减 单位：毫秒
					if (
					 startDateParams == endIsAllday ||
					 (startIsAllday == '上午' && endIsAllday == '上午') ||
					 (startIsAllday == '下午' && endIsAllday == '下午')
					) {
						// 如果选择的情况是 开始：上午 ，结束：上午 或者 开始：下午 ，结束：下午。则都加0.5天
						days = days + 0.5
					} else if (
					 startIsAllday == '上午' &&
					 endIsAllday == '下午'
					) {
						//如果选择情况是 开始：上午 结束：下午 ，则加一天，其他情况不加减

						days = days + 1
					}

					this.hoildaylist[index].days = days
					let daysNum = 0
					let i = this.ProjectData.findIndex((e) => e.type == type)
					for (let j = 0; j < this.hoildaylist.length; j++) {
						if (this.hoildaylist[j].offWorkType == 1) {
							daysNum = daysNum + this.hoildaylist[j].days
						}
					}
					this.ProjectData[i] = {
						name: `年假(剩余${this.holidayDays.restHolidayTime - daysNum}天,已冻结${this.freezeHolidayTime + daysNum}天)`,
						type: 1,
						disabled: (this.holidayDays.restHolidayTime - daysNum) <= 0
					}
				}
			} else if (type == 3) {
				// 如果是调休
				if (startDate && endDate) {

					const endDateParams = new Date(endDate).getTime()
					const startDateParams = new Date(startDate).getTime()
					let hour = endDateParams - startDateParams
					hour = hour / (1000 * 60 * 60)
					this.$nextTick(() => {
						this.hoildaylist[index].hour = hour
						let i = this.ProjectData.findIndex((e) => e.type == type)
						let timeNum = this.ProjectData[i].timeNum - hour
						let yearsTime = 0
						for (let j = 0; j < this.hoildaylist.length; j++) {
							if (this.hoildaylist[j].offWorkType == 3) {
								yearsTime = yearsTime + this.hoildaylist[j].hour
							}
						}
						this.ProjectData[i] = {
							name: `调休(剩余${this.holidayDays.restExchangeTime - yearsTime}小时,已冻结${this.freezeExchangeTime + yearsTime}小时)`,
							type: 3,
							disabled: this.holidayDays.restExchangeTime - yearsTime <= 0
						}

					})

				}
			} else if (type == 2) {
				// 如果是事假
				if (startDate && endDate) {
					this.$nextTick(() => {
						const endDateParams = new Date(endDate).getTime()
						const startDateParams = new Date(startDate).getTime()
						let hour = endDateParams - startDateParams
						hour = hour / (1000 * 60 * 60)
						this.hoildaylist[index].hour = hour.toFixed(2)

					})

				}
			} else if (type == 4 || type == 5 || type == 6 || type == 7 || type == 8) {
				if (startDate && endDate && startIsAllday && endIsAllday) {
					// 判断是不是都已经选择完成
					const endDateParams = new Date(endDate).getTime() //计算一下开始时间
					const startDateParams = new Date(startDate).getTime() //计算一下结束时间
					let days = (endDateParams - startDateParams) / (1000 * 60 * 60 * 24) //开始和结束时间相减 单位：毫秒
					if (
					 startDateParams == endIsAllday ||
					 (startIsAllday == '上午' && endIsAllday == '上午') ||
					 (startIsAllday == '下午' && endIsAllday == '下午')
					) {
						// 如果选择的情况是 开始：上午 ，结束：上午 或者 开始：下午 ，结束：下午。则都加0.5天
						days = days + 0.5
					} else if (
					 startIsAllday == '上午' &&
					 endIsAllday == '下午'
					) {
						//如果选择情况是 开始：上午 结束：下午 ，则加一天，其他情况不加减

						days = days + 1
					}
					this.hoildaylist[index].days = days
				}
			}
		},
		getHolidayType($event, i, item) {

			delete this.hoildaylist[i].startDate
			delete this.hoildaylist[i].endDate
			this.hoildaylist[i].hour = 0
			this.hoildaylist[i].days = 0

		},
		selectCommonPhrases(e) {
			if (!this.confirmForm.confirmContent) this.confirmForm.confirmContent = ''
			this.confirmForm.confirmContent += e
		},
		changeCotalApplyTime(e) {
			this.totalApplyTime = e
		},
		uploadFile(param) {
			upload(param, true).then((res) => {
				this.form.fileUrlList.push(res)
				console.log(res)
			})
		},
		spliceListRow(index) {
			this.hoildaylist.splice(index, 1)
			let daysNum = 0
			for (let j = 0; j < this.hoildaylist.length; j++) {
				if (this.hoildaylist[j].offWorkType == 1) {
					daysNum = daysNum + this.hoildaylist[j].days
				}
			}
			this.ProjectData[0] = {
				name: `年假(剩余${this.holidayDays.restHolidayTime - daysNum}天,已冻结${daysNum}天)`,
				type: 1,
				disabled: this.holidayDays.restHolidayTime - daysNum <= 0
			}
			let yearsTime = 0
			for (let j = 0; j < this.hoildaylist.length; j++) {
				if (this.hoildaylist[j].offWorkType == 2) {
					yearsTime += this.hoildaylist[j].hour
				}
			}
			this.ProjectData[1] = {
				name: `调休(剩余${this.holidayDays.restExchangeTime - yearsTime}小时,已冻结${yearsTime}小时)`,
				type: 3,
				disabled: this.holidayDays.restExchangeTime - yearsTime <= 0
			}
		},
		parentMethod(val) {
			if (val.length > 0) {
				this.form.ccList = val.join(',')
			}
		},
		async confirmSubmit() {
			let yearsTime = 0
			let daysNum = 0
			for (let j = 0; j < this.hoildaylist.length; j++) {
				if (this.hoildaylist[j].offWorkType == 3) {
					yearsTime += this.hoildaylist[j].hour
				}
				if (this.hoildaylist[j].offWorkType == 1) {
					daysNum = daysNum + this.hoildaylist[j].days
				}
			}
			if ((this.holidayDays.restHolidayTime - daysNum) < 0) {
				this.$message.error('年假选择时间超时')
				return
			}
			if (this.holidayDays.restExchangeTime - yearsTime < 0) {
				this.$message.error('调休假选择时间超时')
				return
			}

			if (!this.form.applyReasons || this.form.applyReasons.length == 0) {
				this.$message.error('请填写请假事由')
				return
			}

			let applyOffWorkTimeString = this.hoildaylist.map((e) => {
				return {
					offWorkType: e.offWorkType,
					timeUnit: e.offWorkType == 3 || e.offWorkType == 2 ? '小时' : '天',
					useTime: e.offWorkType == 3 || e.offWorkType == 2 ? e.hour : e.days,
					startDay: e.startDate,
					endDay: e.endDate,
					endTime: e.offWorkType == 3 || e.offWorkType == 2 ? null : e.startIsAllday,
					startTime: e.offWorkType == 3 || e.offWorkType == 2 ? null : e.endIsAllday

				}
			})

			let fileDataIds = ''
			if (this.form.fileUrlList && this.form.fileUrlList.length > 0) {
				fileDataIds = this.form.fileUrlList.map((e) => {

					if (e && e.data) {
						return e.data
					}
				}).toString()
			}
			const confirmForm = {
				ccList: this.form.ccList,
				applyReasons: this.form.applyReasons,
				applyOffWorkTimeString: JSON.stringify(applyOffWorkTimeString),
				fileDataIds: fileDataIds,
				flowMainId: this.form.flowMainId
			}
			this.loading = true
			const { data } = await this.baseRequest1('ApplyOffWorkController', 'addApplyOffWorkAgain', { ...confirmForm })
			this.loading = false
			if (data.code == 200) {
				this.$message.success('流程已重新发起')
				this.hoildaylist = []
				this.selectList = []
				this.form = {
					fileUrlList: []
				}
				this.hoildaylist = [
					{ offWorkType: 2, hour: 0, days: 0 }
				]
				this.dialogVisible = false
				this.$emit('getData')
			}

			this.dialogVisibl = false
		},
		baseRequest1(prefix, opUrl, postData) {
			return this.$channel.globleRequest(prefix, opUrl, postData, 'project task')
		},
		async setVisible(status, row) {
			this.activeName = 'first'
			const { data: holidayDays } = await this.baseRequest1('ApplyOffWorkController', 'getHolidayManagementByApplyUserId', { userId: row.applyUser })
			this.holidayDays = holidayDays
			this.freezeHolidayTime = holidayDays.freezeHolidayTime
			this.freezeExchangeTime = holidayDays.freezeExchangeTime
			this.ProjectData = [
				{
					name: `年假(剩余${holidayDays.restHolidayTime}天,已冻结${holidayDays.freezeHolidayTime}天)`,
					type: 1,
					disabled: holidayDays.restHolidayTime <= 0

				},
				{
					name: `调休(剩余${holidayDays.restExchangeTime}小时,已冻结${holidayDays.freezeExchangeTime}小时)`,
					type: 3,
					disabled: holidayDays.restExchangeTime <= 0

				},
				{
					name: `事假`,
					type: 2
				},
				{
					name: `病假`,
					type: 4
				},
				{
					name: `婚假`,
					type: 5
				},
				{
					name: `产假`,
					type: 6
				},
				{
					name: `陪产假`,
					type: 7
				},
				{
					name: `丧假`,
					type: 8
				}
			]
			const { data } = await this.baseRequest1('ApplyOffWorkController', 'getInfoByFlowMainId', { flowMainId: row.id })
			this.form.flowMainId = data.flowMainId
			const { data: flowHistroy } = await this.baseRequest1('FlowMainController', 'getFlowHistroyByFlowMainId', { flowMainId: row.id })

			this.form = data
			this.tableData = flowHistroy
			this.hoildaylist = data.applyOffWorkTimeList.map((e) => {
				return {
					offWorkType: Number(e.offWorkType),
					endDate: this.$common.transTime(e.endDay),
					startDate: this.$common.transTime(e.startDay),
					days: Number(e.offWorkType) != 2 && Number(e.offWorkType) != 3 ? e.useTime : 0,
					hour: Number(e.offWorkType) == 2 || Number(e.offWorkType) == 3 ? e.useTime : 0,
					startIsAllday: e.startTime,
					dayMerange: Number(e.offWorkType) == 2 || Number(e.offWorkType) == 3 ? this.$common.transDate(e.startDay) : null,
					timeMerange: Number(e.offWorkType) == 2 || Number(e.offWorkType) == 3 ? [this.$common.transhh(e.startDay), this.$common.transhh(e.endDay)] : null,
					endIsAllday: e.endTime,
					endTime: e.endTime

				}
			})
			//
			// let daysNum = 0
			// for (let j = 0; j < this.hoildaylist.length; j++) {
			// 	if (this.hoildaylist[j].offWorkType == 1) {
			// 		daysNum = daysNum + this.hoildaylist[j].days
			// 	}
			// }
			// this.ProjectData[0] = {
			// 	name: `年假(剩余${this.holidayDays.restHolidayTime - daysNum}天,已冻结${daysNum}天)`,
			// 	type: 1
			// }
			// let yearsTime = 0
			// for (let j = 0; j < this.hoildaylist.length; j++) {
			// 	if (this.hoildaylist[j].offWorkType == 2) {
			// 		yearsTime += this.hoildaylist[j].hour
			// 	}
			// }
			// this.ProjectData[1] = {
			// 	name: `调休${this.holidayDays.restExchangeTime - yearsTime}小时,已冻结${yearsTime}小时)`,
			// 	type: 3
			// }
			// this.totalApplyTime = `共计请假${daysNum}天，${yearsTime.toFixed(2)}小时`
			const selectList = data.flowMainCcList.map((e) => {
				return e.ccUser
			})
			this.selectList = selectList
			if (data.fileDataIds) {
				const { data: fileTaoTaoList } = await this.baseRequest1('FileZtController', 'findFileInfoByIds/' + data.fileDataIds, '')
				console.log(fileTaoTaoList.data)
				this.form.fileUrlList = fileTaoTaoList.data.map((e) => {
					return {
						url: this.$constant.BASE_URI + '/FileController/download/' + e.id,
						name: e.fileName,
						data: e.id,
						uid: new Date().getTime()
					}
				})
				console.log(this.form.fileUrlList)
			} else {
				this.form.fileUrlList = []
			}
			this.dialogVisible = status
			this.row = row
		},
		addListRow() {
			const _this = this
			_this.hoildaylist.push({ offWorkType: 2, hour: 0, days: 0 })
		}
	}
}
</script>

<style lang="scss">
.ml5 {
	margin-left: 5px;
}

.tabsdom {
	.el-tabs__header {
		text-align: center !important;
		width: 139px !important;
		text-align: center !important;
		display: block !important;
		margin: auto !important;
		margin-bottom: 15px !important;
	}

	.el-tabs__nav-wrap::after {
		display: none;
	}

	.el-upload {
		width: 100%;
	}
}

</style>
