applyHoliday.vue 31 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181
  1. <template>
  2. <el-dialog
  3. :close-on-click-modal="false"
  4. :close-on-press-escape="false"
  5. :title="dialogTitle"
  6. :visible.sync="dialogVisible"
  7. top="50px"
  8. width="85%"
  9. :before-close="beforeClose"
  10. >
  11. <div class="tabsdom">
  12. <el-tabs v-model="activeName" @tab-click="handleClick">
  13. <el-tab-pane label="请假申请" name="first">
  14. <el-card shadow="always" style="padding: 20px 10px 10px 20px">
  15. <div v-for="(item,index) in hoildaylist" :key="index" style="margin:10px 0px">
  16. <el-row v-show="item.offWorkType==1" :gutter="10" class="holidayRow">
  17. <el-col :span="2" class="col-txt">
  18. <div style="width: 100%">
  19. &nbsp;
  20. <span v-show="index==0">请假类型 </span>
  21. </div>
  22. </el-col>
  23. <el-col :span="5">
  24. <el-select
  25. v-model="item.offWorkType"
  26. filterable
  27. placeholder="请假类型"
  28. @change="getHolidayType($event,index)"
  29. >
  30. <el-option
  31. v-for="itam in ProjectData"
  32. :key="itam.name"
  33. :disabled="itam.disabled"
  34. :label="itam.name"
  35. :value="itam.type"
  36. />
  37. </el-select>
  38. </el-col>
  39. <el-col :span="4">
  40. <el-date-picker
  41. v-model="item.startDate"
  42. placeholder="选择日期"
  43. style="width: 100%!important;"
  44. type="date"
  45. value-format="yyyy-MM-dd"
  46. width="100%"
  47. @change="countDays(item.startDate,item.endDate,item.startIsAllday,item.endIsAllday,index,item.offWorkType)"
  48. />
  49. </el-col>
  50. <el-col :span="2">
  51. <el-select
  52. v-model="item.startIsAllday"
  53. filterable
  54. placeholder=""
  55. @change="countDays(item.startDate,item.endDate,item.startIsAllday,item.endIsAllday,index,item.offWorkType)"
  56. >
  57. <el-option label="上午" value="上午"/>
  58. <el-option label="下午" value="下午"/>
  59. </el-select>
  60. </el-col>
  61. <el-col :span="1">
  62. <div style="height: 1px;background: #606266;width:100%;margin-top:40%"/>
  63. </el-col>
  64. <el-col :span="4">
  65. <el-date-picker
  66. v-model="item.endDate"
  67. :readonly="!item.startDate||item.startDate.length==0?true:false"
  68. placeholder="选择日期"
  69. style="width:100%"
  70. type="date"
  71. value-format="yyyy-MM-dd"
  72. @change="countDays(item.startDate,item.endDate,item.startIsAllday,item.endIsAllday,index,item.offWorkType)"
  73. />
  74. </el-col>
  75. <el-col :span="2">
  76. <el-select
  77. v-model="item.endIsAllday"
  78. filterable
  79. placeholder=""
  80. @change="countDays(item.startDate,item.endDate,item.startIsAllday,item.endIsAllday,index,item.offWorkType)"
  81. >
  82. <el-option label="上午" value="上午"/>
  83. <el-option label="下午" value="下午"/>
  84. </el-select>
  85. </el-col>
  86. <el-col :span="2" class="col-txt" style="text-align: center">
  87. 共{{
  88. !item.days ? 0 : item.days
  89. }}天
  90. </el-col>
  91. <el-col :span="1" class="col-txt" style="text-align: center">
  92. &nbsp;
  93. <el-button
  94. v-show="index!=0"
  95. circle
  96. icon="el-icon-minus"
  97. @click="spliceListRow(index)"
  98. />
  99. </el-col>
  100. <el-col :span="1" class="col-txt" style="text-align: center">
  101. <el-button
  102. circle
  103. icon="el-icon-plus"
  104. type="primary"
  105. @click="addListRow()"
  106. />
  107. </el-col>
  108. </el-row>
  109. <el-row v-show="item.offWorkType==3||item.offWorkType==2" :gutter="10" class="holidayRow">
  110. <el-col :span="2" class="col-txt">
  111. <div style="width: 100%">
  112. <span v-show="index==0">请假类型 </span>&nbsp;
  113. </div>
  114. </el-col>
  115. <el-col :span="5" class="col-input">
  116. <el-select
  117. v-model="item.offWorkType"
  118. filterable
  119. placeholder="请假类型"
  120. style="width: 100%"
  121. @change="getHolidayType($event,index,item)"
  122. >
  123. <el-option
  124. v-for="itam in ProjectData"
  125. :key="itam.name"
  126. :disabled="itam.disabled"
  127. :label="itam.name"
  128. :value="itam.type"
  129. />
  130. </el-select>
  131. </el-col>
  132. <el-col :span="6">
  133. <el-date-picker
  134. v-model="item.dayMerange"
  135. class="pdr10px mgb10px"
  136. placeholder="选择日期"
  137. type="date"
  138. value-format="yyyy-MM-dd"
  139. >
  140. </el-date-picker>
  141. </el-col>
  142. <el-col :span="7">
  143. <!-- @change="countDays(item.startDate,item.endDate,item.startIsAllday,item.endIsAllday,index,item.offWorkType)"-->
  144. <el-time-picker
  145. v-model="item.timeMerange"
  146. :disabled="!item.dayMerange"
  147. class="el-input pdr10px mgb10px"
  148. clearable
  149. end-placeholder="结束时间"
  150. format="HH:mm"
  151. is-range
  152. range-separator="至"
  153. start-placeholder="开始时间"
  154. value-format="HH:mm"
  155. @change="getTimeMerange(item.timeMerange,item.dayMerange,item.startIsAllday,item.endIsAllday,index,item.offWorkType)"
  156. />
  157. </el-col>
  158. <el-col :span="2" class="col-txt" style="text-align: center">
  159. <!-- {{ JSON.stringify(item) }}-->
  160. 共{{ item.hour }}小时
  161. </el-col>
  162. <el-col :span="1" class="col-txt" style="text-align: center">
  163. &nbsp;
  164. <el-button
  165. v-show="index!=0"
  166. circle
  167. icon="el-icon-minus"
  168. @click="spliceListRow(index)"
  169. />
  170. </el-col>
  171. <el-col :span="1" class="col-txt" style="text-align: center">
  172. <el-button
  173. circle
  174. icon="el-icon-plus"
  175. type="primary"
  176. @click="addListRow()"
  177. />
  178. </el-col>
  179. </el-row>
  180. <el-row v-show="item.offWorkType!=1&& item.offWorkType!=3&&item.offWorkType!=2" :gutter="10"
  181. class="holidayRow"
  182. >
  183. <el-col :span="2" class="col-txt">
  184. <div style="width: 100%">
  185. &nbsp;
  186. <span v-show="index==0">请假类型 </span>
  187. </div>
  188. </el-col>
  189. <el-col :span="5">
  190. <el-select
  191. v-model="item.offWorkType"
  192. filterable
  193. placeholder="请假类型"
  194. @change="getHolidayType($event,index,item)"
  195. >
  196. <el-option
  197. v-for="itam in ProjectData"
  198. :key="itam.name"
  199. :disabled="itam.disabled"
  200. :label="itam.name"
  201. :value="itam.type"
  202. />
  203. </el-select>
  204. </el-col>
  205. <el-col :span="4">
  206. <el-date-picker
  207. v-model="item.startDate"
  208. placeholder="选择日期"
  209. style="width: 100%!important;"
  210. type="date"
  211. value-format="yyyy-MM-dd"
  212. width="100%"
  213. @change="countDays(item.startDate,item.endDate,item.startIsAllday,item.endIsAllday,index,item.offWorkType)"
  214. />
  215. </el-col>
  216. <el-col :span="2">
  217. <el-select
  218. v-model="item.startIsAllday"
  219. filterable
  220. placeholder=""
  221. @change="countDays(item.startDate,item.endDate,item.startIsAllday,item.endIsAllday,index,item.offWorkType)"
  222. >
  223. <el-option label="上午" value="上午"/>
  224. <el-option label="下午" value="下午"/>
  225. </el-select>
  226. </el-col>
  227. <el-col :span="1">
  228. <div style="height: 1px;background: #606266;width:100%;margin-top:40%"/>
  229. </el-col>
  230. <el-col :span="4">
  231. <el-date-picker
  232. v-model="item.endDate"
  233. :readonly="!item.startDate||item.startDate.length==0?true:false"
  234. placeholder="选择日期"
  235. style="width:100%"
  236. type="date"
  237. value-format="yyyy-MM-dd"
  238. @change="countDays(item.startDate,item.endDate,item.startIsAllday,item.endIsAllday,index,item.offWorkType)"
  239. />
  240. </el-col>
  241. <el-col :span="2">
  242. <el-select
  243. v-model="item.endIsAllday"
  244. filterable
  245. placeholder=""
  246. @change="countDays(item.startDate,item.endDate,item.startIsAllday,item.endIsAllday,index,item.offWorkType)"
  247. >
  248. <el-option label="上午" value="上午"/>
  249. <el-option label="下午" value="下午"/>
  250. </el-select>
  251. </el-col>
  252. <el-col :span="2" class="col-txt" style="text-align: center">
  253. 共{{
  254. !item.days ? 0 : item.days
  255. }}天
  256. </el-col>
  257. <el-col :span="1" class="col-txt" style="text-align: center">
  258. &nbsp;
  259. <el-button
  260. v-show="index!=0"
  261. circle
  262. icon="el-icon-minus"
  263. @click="spliceListRow(index)"
  264. />
  265. </el-col>
  266. <el-col :span="1" class="col-txt" style="text-align: center">
  267. <el-button
  268. circle
  269. icon="el-icon-plus"
  270. type="primary"
  271. @click="addListRow()"
  272. />
  273. </el-col>
  274. </el-row>
  275. </div>
  276. <div class="totalApplyTime">{{ totalApplyTime }}</div>
  277. <el-row>
  278. <el-col :span="2" class="col-txt"><span>请假事由</span></el-col>
  279. <el-col :span="22">
  280. <el-input v-model="form.applyReasons" style="min-height:50px;margin-bottom: 25px" type="textarea"/>
  281. </el-col>
  282. </el-row>
  283. <el-row>
  284. <el-col :span="2" class="col-txt">附件</el-col>
  285. <el-col :span="22">
  286. <el-upload
  287. :action="$constant.BASE_URI+'/FileController/upload'"
  288. :file-list="form.fileUrlList"
  289. :http-request="uploadFile"
  290. multiple
  291. >
  292. <el-button size="small" type="primary">点击上传</el-button>
  293. <div slot="file" slot-scope="{file}">
  294. <a :href="file.url">{{ file.name }}</a>
  295. <span class="el-upload-list__item-actions">
  296. <i class="el-icon-delete" @click="handlePictureRemove(file,form.fileUrlList)"/>
  297. </span>
  298. </div>
  299. </el-upload>
  300. </el-col>
  301. </el-row>
  302. <el-row style="margin-top: 25px">
  303. <el-col :span="2" class="col-txt">抄送</el-col>
  304. <el-col :span="22">
  305. <user-select
  306. :default-select="selectList"
  307. :multiple="true"
  308. width="700"
  309. @selectValue="parentMethod"
  310. />
  311. </el-col>
  312. </el-row>
  313. </el-card>
  314. </el-tab-pane>
  315. <el-tab-pane label="流程图" name="second">
  316. <div style="width: 100%">
  317. <el-row>
  318. <el-col :span="24">
  319. <div class="node_info">
  320. <div>节点说明:</div>
  321. <div class="dis_flex" v-for="item in nodeColor">
  322. <div class="node_class" :style="{backgroundColor: item.nodeback}"></div>
  323. {{ item.name }}
  324. </div>
  325. </div>
  326. <div id="containerHoliday" style="width: 100%" v-show="true"></div>
  327. </el-col>
  328. </el-row>
  329. </div>
  330. </el-tab-pane>
  331. </el-tabs>
  332. </div>
  333. <div slot="footer">
  334. <el-button @click="dialogVisible = false">取 消</el-button>
  335. <el-button :loading="loading" type="primary" @click="confirmSubmit()">确 定</el-button>
  336. </div>
  337. </el-dialog>
  338. </template>
  339. <script>
  340. import UserSelect from '@/views/components/UserSelect'
  341. import Base from '@/views/base/base.vue'
  342. import BaseData from '@/views/base/baseData.vue'
  343. import { upload } from '@/static/utils/channel'
  344. import * as echarts from 'echarts'
  345. const lineStyle = {
  346. color: '#2A3980',
  347. width: 2
  348. }
  349. const redLinestyle = {
  350. color: 'red',
  351. width: 2
  352. }
  353. export default {
  354. name: 'ApplyPay',
  355. components: {
  356. UserSelect
  357. },
  358. mixins: [Base, BaseData],
  359. data() {
  360. return {
  361. nodeColor: [
  362. { name: '审核通过', nodeback: '#2A3980' },
  363. { name: '未经过', nodeback: '#999999' },
  364. { name: '退回', nodeback: '#E04242' },
  365. { name: '审核中', nodeback: '#E08E42' },
  366. { name: '撤回', nodeback: '#4294E0' }
  367. ],
  368. freezeHolidayTime: 0,
  369. freezeExchangeTime: 0,
  370. loading: false,
  371. totalApplyTime: '共计请假0天,0.00小时',
  372. dialogVisible: false,
  373. hoildaylist: [
  374. { offWorkType: 2, hour: 0, days: 0 }
  375. ],
  376. fileError: false,
  377. fileList: [],
  378. selectList: [],
  379. value1: [],
  380. ProjectData: [],
  381. dialogTitle: '请假申请',
  382. form: {
  383. fileUrlList: []
  384. },
  385. activeName: 'first',
  386. daysNum: 0,
  387. holidayDays: {},
  388. linesData: [ // 连线
  389. {
  390. lineStyle: lineStyle,
  391. coords: [[0, 500], [60, 500]]
  392. },
  393. {
  394. lineStyle: lineStyle,
  395. coords: [[80, 500], [140, 500]]
  396. },
  397. {
  398. lineStyle: lineStyle,
  399. coords: [[160, 500], [227, 500]]
  400. },
  401. {
  402. name: '是',
  403. lineStyle: { color: '#2A3980', type: 'dotted' },
  404. itemStyle: {
  405. color: 'rgb(0,0,0,0)'
  406. },
  407. coords: [[260, 500], [550, 500]]
  408. },
  409. {
  410. lineStyle: { color: '#2A3980', type: 'dotted' },
  411. coords: [[260, 375], [575, 375]],
  412. symbol: 'none'
  413. },
  414. {
  415. lineStyle: { color: '#2A3980', type: 'dotted' },
  416. coords: [[244, 335], [244, 225]],
  417. symbol: 'none'
  418. },
  419. {
  420. lineStyle: { color: '#2A3980', type: 'dotted' },
  421. coords: [[244, 225], [293, 225]]
  422. },
  423. {
  424. lineStyle: { color: '#2A3980', type: 'dotted' },
  425. coords: [[293, 225], [372, 225]]
  426. },
  427. {
  428. lineStyle: { color: '#2A3980', type: 'dotted' },
  429. coords: [[372, 225], [463, 225]]
  430. },
  431. {
  432. lineStyle: { color: '#2A3980', type: 'dotted' },
  433. coords: [[463, 225], [575, 225]]
  434. },
  435. {
  436. lineStyle: { color: '#2A3980', type: 'dotted' },
  437. coords: [[575, 225], [575, 470]]
  438. },
  439. {
  440. lineStyle: lineStyle,
  441. coords: [[315, 225], [315, 150]],
  442. symbol: 'none'
  443. },
  444. {
  445. lineStyle: lineStyle,
  446. coords: [[315, 150], [5, 150]],
  447. symbol: 'none'
  448. },
  449. {
  450. name: '发起人退回',
  451. lineStyle: lineStyle,
  452. coords: [[5, 50], [5, 470]]
  453. },
  454. {
  455. name: '',
  456. lineStyle: lineStyle,
  457. coords: [[395, 225], [395, 100]],
  458. symbol: 'none'
  459. },
  460. {
  461. name: '发起人退回',
  462. lineStyle: lineStyle,
  463. coords: [[5, 50], [5, 470]]
  464. },
  465. {
  466. name: '',
  467. lineStyle: lineStyle,
  468. coords: [[5, 100], [395, 100]],
  469. symbol: 'none'
  470. },
  471. {
  472. name: '',
  473. lineStyle: lineStyle,
  474. coords: [[480, 225], [480, 50]],
  475. symbol: 'none'
  476. },
  477. {
  478. name: '',
  479. lineStyle: lineStyle,
  480. coords: [[480, 50], [5, 50]],
  481. symbol: 'none'
  482. },
  483. {
  484. name: '',
  485. lineStyle: lineStyle,
  486. coords: [[85, 500], [85, 400]],
  487. symbol: 'none'
  488. },
  489. {
  490. name: '',
  491. lineStyle: lineStyle,
  492. coords: [[85, 400], [5, 400]],
  493. symbol: 'none'
  494. },
  495. {
  496. name: '',
  497. lineStyle: lineStyle,
  498. coords: [[165, 500], [165, 350]],
  499. symbol: 'none'
  500. },
  501. {
  502. name: '',
  503. lineStyle: lineStyle,
  504. coords: [[165, 350], [5, 350]],
  505. symbol: 'none'
  506. },
  507. {
  508. name: '',
  509. lineStyle: lineStyle,
  510. coords: [[243.9, 465], [243.9, 415]]
  511. }
  512. //
  513. ],
  514. node: [ // 节点
  515. {
  516. name: '申请人发起',
  517. value: [0, 500],
  518. symbol: 'image://' + require('../asste/huifangkuai.png'),
  519. symbolSize: [110, 60]
  520. },
  521. {
  522. name: '直接上级审核',
  523. value: [80, 500],
  524. symbol: 'image://' + require('../asste/huifangkuai.png'),
  525. symbolSize: [110, 60]
  526. },
  527. {
  528. name: '部门负责人审核',
  529. value: [160, 500],
  530. symbol: 'image://' + require('../asste/huifangkuai.png'),
  531. symbolSize: [110, 60]
  532. },
  533. {
  534. label: {
  535. show: true,
  536. color: '#777777' // 节点文字颜色
  537. },
  538. name: '假别仅有\n调休假',
  539. value: [240, 500],
  540. symbol: 'image://' + require('../asste/lingxing.png'),
  541. symbolSize: [80, 80]
  542. },
  543. {
  544. label: {
  545. show: true,
  546. color: 'red', // 节点文字颜色
  547. backgroundColor: 'rgb(0,0,0,0)'
  548. },
  549. itemStyle: {
  550. color: 'rgb(0,0,0,0)'
  551. },
  552. name: '是',
  553. value: [280, 500],
  554. symbolSize: [20, 20]
  555. },
  556. {
  557. label: {
  558. show: true,
  559. color: '#777777' // 节点文字颜色
  560. },
  561. name: '请假天数',
  562. value: [240, 375],
  563. symbol: 'image://' + require('../asste/lingxing.png'),
  564. symbolSize: [80, 80]
  565. },
  566. {
  567. name: '分管领导\n审核',
  568. value: [310, 225],
  569. symbol: 'image://' + require('../asste/huifangkuai.png'),
  570. symbolSize: [110, 60]
  571. },
  572. {
  573. name: '上级分管领导\n审核',
  574. value: [390, 225],
  575. symbol: 'image://' + require('../asste/huifangkuai.png'),
  576. symbolSize: [110, 60]
  577. },
  578. {
  579. name: '主要领导\n审核',
  580. value: [480, 225],
  581. symbol: 'image://' + require('../asste/huifangkuai.png'),
  582. symbolSize: [110, 60]
  583. },
  584. {
  585. name: '结束',
  586. value: [570, 500],
  587. symbol: 'image://' + require('../asste/huifangkuai.png'),
  588. symbolSize: [110, 60]
  589. },
  590. {
  591. label: {
  592. show: true,
  593. color: 'red' // 节点文字颜色
  594. //backgroundColor: '#f5f5f5'
  595. },
  596. itemStyle: {
  597. color: 'rgb(0,0,0,0)'
  598. },
  599. name: '假期天数合计≤3天',
  600. value: [380, 375],
  601. symbolSize: [20, 20]
  602. },
  603. {
  604. label: {
  605. show: true,
  606. color: 'red' // 节点文字颜色
  607. //backgroundColor: '#f5f5f5'
  608. },
  609. itemStyle: {
  610. color: 'rgb(0,0,0,0)'
  611. },
  612. name: '假期天数合计>3天',
  613. value: [240, 275],
  614. symbolSize: [20, 20]
  615. },
  616. {
  617. label: {
  618. show: true,
  619. color: 'red' // 节点文字颜色
  620. // //backgroundColor: '#f5f5f5'
  621. },
  622. itemStyle: {
  623. color: 'rgb(0,0,0,0)'
  624. },
  625. name: ' 退回发起人',
  626. value: [100, 150],
  627. symbolSize: [20, 20]
  628. },
  629. {
  630. label: {
  631. show: true,
  632. color: 'red' // 节点文字颜色
  633. //backgroundColor: '#f5f5f5'
  634. },
  635. itemStyle: {
  636. color: 'rgb(0,0,0,0)'
  637. },
  638. name: ' 退回发起人 ',
  639. value: [150, 100],
  640. symbolSize: [20, 20]
  641. },
  642. {
  643. label: {
  644. show: true,
  645. color: 'red' // 节点文字颜色
  646. //backgroundColor: '#f5f5f5'
  647. },
  648. itemStyle: {
  649. color: 'rgb(0,0,0,0)'
  650. },
  651. name: ' 退回发起人 ',
  652. value: [200, 50],
  653. symbolSize: [20, 20]
  654. },
  655. {
  656. label: {
  657. show: true,
  658. color: 'red' // 节点文字颜色
  659. //backgroundColor: '#f5f5f5'
  660. },
  661. itemStyle: {
  662. color: 'rgb(0,0,0,0)'
  663. },
  664. name: ' 退回发起人 ',
  665. value: [45, 400],
  666. symbolSize: [20, 20]
  667. },
  668. {
  669. label: {
  670. show: true,
  671. color: 'red' // 节点文字颜色
  672. //backgroundColor: '#f5f5f5'
  673. },
  674. itemStyle: {
  675. color: 'rgb(0,0,0,0)'
  676. },
  677. name: ' 退回发起人 ',
  678. value: [85, 350],
  679. symbolSize: [20, 20]
  680. }
  681. ]
  682. }
  683. },
  684. watch: {
  685. 'hoildaylist': {
  686. deep: true,
  687. handler(newValue, oldValue) {
  688. let day = 0
  689. let hour = 0
  690. for (let i = 0; i < this.hoildaylist.length; i++) {
  691. if (this.hoildaylist[i].hour === 0 || this.hoildaylist[i].hour) {
  692. hour = hour + (typeof this.hoildaylist[i].hour == 'string' ? Number(this.hoildaylist[i].hour) : this.hoildaylist[i].hour)
  693. }
  694. if (this.hoildaylist[i].days == 0 || this.hoildaylist[i].days) {
  695. day = day + (typeof this.hoildaylist[i].days == 'string' ? Number(this.hoildaylist[i].days) : this.hoildaylist[i].days)
  696. }
  697. }
  698. this.changeCotalApplyTime(`共计请假${day}天,${hour}小时`)
  699. }
  700. }
  701. },
  702. computed: {},
  703. mounted() {
  704. },
  705. methods: {
  706. beforeClose() {
  707. this.hoildaylist = [
  708. { offWorkType: 2, hour: 0, days: 0 }
  709. ]
  710. this.form = {
  711. fileUrlList: []
  712. }
  713. this.fileList = []
  714. this.dialogVisible = false
  715. },
  716. handleClick(tab, event) {
  717. if (this.activeName == 'second') this.createNodeCanvas()
  718. },
  719. createNodeCanvas() {
  720. this.$nextTick(() => {
  721. let chartDom = document.getElementById('containerHoliday')
  722. var myCharts = echarts.init(chartDom)
  723. let charts = {
  724. nodes: this.node,
  725. linesData: this.linesData
  726. }
  727. let option = {
  728. xAxis: {
  729. min: 0,
  730. max: 600,
  731. padding: [0, 50, 0, 50],
  732. show: false,
  733. type: 'value'
  734. },
  735. yAxis: {
  736. min: 0,
  737. max: 600,
  738. show: false,
  739. type: 'value'
  740. },
  741. grid: {
  742. left: 50,
  743. right: 0,
  744. bottom: 0,
  745. top: 0
  746. },
  747. series: [
  748. {
  749. type: 'graph',
  750. coordinateSystem: 'cartesian2d',
  751. symbol: 'rect',
  752. symbolSize: [80, 40],
  753. symbolOffset: [10, 0],
  754. // force: {
  755. // edgeLength: 100,//连线的长度
  756. // repulsion: 200 //子节点之间的间距
  757. // },
  758. label: {
  759. show: true,
  760. color: 'white' // 节点文字颜色
  761. },
  762. data: charts.nodes
  763. },
  764. {
  765. type: 'lines',
  766. polyline: false,
  767. coordinateSystem: 'cartesian2d',
  768. symbol: ['', 'arrow'],
  769. symbolSize: 10,
  770. data: charts.linesData
  771. }
  772. ]
  773. }
  774. myCharts.clear()
  775. myCharts.setOption(option)
  776. window.addEventListener('resize', () => {
  777. myCharts.resize()
  778. })
  779. })
  780. },
  781. getTimeMerange(timeMerange, dayMerange, startIsAllday, endIsAllday, index, type) {
  782. if (timeMerange && dayMerange && (index == 0 || index) && (type == 0 || type)) {
  783. this.hoildaylist[index].startDate = dayMerange + ' ' + timeMerange[0] + ':00'
  784. this.hoildaylist[index].endDate = dayMerange + ' ' + timeMerange[1] + ':00'
  785. this.countDays(dayMerange + ' ' + timeMerange[0], dayMerange + ' ' + timeMerange[1], startIsAllday, endIsAllday, index, type)
  786. }
  787. },
  788. changeCotalApplyTime(e) {
  789. this.totalApplyTime = e
  790. },
  791. uploadFile(param) {
  792. upload(param, true).then((res) => {
  793. this.form.fileUrlList.push(res)
  794. console.log(res)
  795. })
  796. },
  797. spliceListRow(index) {
  798. this.hoildaylist.splice(index, 1)
  799. let daysNum = 0
  800. for (let j = 0; j < this.hoildaylist.length; j++) {
  801. if (this.hoildaylist[j].offWorkType == 1) {
  802. daysNum = daysNum + this.hoildaylist[j].days
  803. }
  804. }
  805. this.ProjectData[0] = {
  806. name: `年假(剩余${this.holidayDays.restHolidayTime - daysNum}天,已冻结${daysNum}天)`,
  807. type: 1,
  808. disabled: (this.holidayDays.restHolidayTime - daysNum) < 0
  809. }
  810. let yearsTime = 0
  811. for (let j = 0; j < this.hoildaylist.length; j++) {
  812. if (this.hoildaylist[j].offWorkType == 3) {
  813. yearsTime += this.hoildaylist[j].hour
  814. }
  815. }
  816. this.ProjectData[1] = {
  817. name: `调休(剩余${this.holidayDays.restExchangeTime - yearsTime}小时,已冻结${yearsTime}小时)`,
  818. type: 3
  819. }
  820. },
  821. parentMethod(val) {
  822. if (val.length > 0) {
  823. this.form.ccList = val.join(',')
  824. }
  825. },
  826. countDays(startDate, endDate, startIsAllday, endIsAllday, index, type) {
  827. // 如果是年假
  828. if (type == 1) {
  829. if (startDate && endDate && startIsAllday && endIsAllday) {
  830. // 判断是不是都已经选择完成
  831. const endDateParams = new Date(endDate).getTime() //计算一下开始时间
  832. const startDateParams = new Date(startDate).getTime() //计算一下结束时间
  833. let days = (endDateParams - startDateParams) / (1000 * 60 * 60 * 24) //开始和结束时间相减 单位:毫秒
  834. if (
  835. startDateParams == endIsAllday ||
  836. (startIsAllday == '上午' && endIsAllday == '上午') ||
  837. (startIsAllday == '下午' && endIsAllday == '下午')
  838. ) {
  839. // 如果选择的情况是 开始:上午 ,结束:上午 或者 开始:下午 ,结束:下午。则都加0.5天
  840. days = days + 0.5
  841. } else if (
  842. startIsAllday == '上午' &&
  843. endIsAllday == '下午'
  844. ) {
  845. //如果选择情况是 开始:上午 结束:下午 ,则加一天,其他情况不加减
  846. days = days + 1
  847. }
  848. this.hoildaylist[index].days = days
  849. let daysNum = 0
  850. let i = this.ProjectData.findIndex((e) => e.type == type)
  851. for (let j = 0; j < this.hoildaylist.length; j++) {
  852. if (this.hoildaylist[j].offWorkType == 1) {
  853. daysNum = daysNum + this.hoildaylist[j].days
  854. }
  855. }
  856. this.ProjectData[i] = {
  857. name: `年假(剩余${this.holidayDays.restHolidayTime - daysNum}天,已冻结${this.freezeHolidayTime + daysNum}天)`,
  858. type: 1,
  859. disabled: (this.holidayDays.restHolidayTime - daysNum) < 0
  860. }
  861. }
  862. }
  863. if (type == 3) {
  864. // 如果是调休
  865. if (startDate && endDate) {
  866. const endDateParams = new Date(endDate).getTime()
  867. const startDateParams = new Date(startDate).getTime()
  868. let hour = endDateParams - startDateParams
  869. hour = hour / (1000 * 60 * 60)
  870. if (new Date(startDate).getHours() <= 12 && new Date(endDate).getHours() >= 13) hour -= 1
  871. this.$nextTick(() => {
  872. this.hoildaylist[index].hour = hour
  873. let i = this.ProjectData.findIndex((e) => e.type == type)
  874. let timeNum = this.ProjectData[i].timeNum - hour
  875. let yearsTime = 0
  876. for (let j = 0; j < this.hoildaylist.length; j++) {
  877. if (this.hoildaylist[j].offWorkType == 3) {
  878. yearsTime = yearsTime + this.hoildaylist[j].hour
  879. }
  880. }
  881. this.ProjectData[i] = {
  882. name: `调休(剩余${this.holidayDays.restExchangeTime - yearsTime}小时,已冻结${this.freezeExchangeTime + yearsTime}小时)`,
  883. type: 3
  884. }
  885. })
  886. }
  887. }
  888. if (type == 2) {
  889. // 如果是事假
  890. if (startDate && endDate) {
  891. this.$common.transServDate
  892. this.$nextTick(() => {
  893. console.log(endDate)
  894. console.log(new Date(startDate).getHours())
  895. const endDateParams = new Date(endDate).getTime()
  896. const startDateParams = new Date(startDate).getTime()
  897. let hour = endDateParams - startDateParams
  898. hour = hour / (1000 * 60 * 60)
  899. console.log('hourhourhourhourhourhour', hour.toFixed(2))
  900. if (new Date(startDate).getHours() <= 12 && new Date(endDate).getHours() >= 13) hour -= 1
  901. this.hoildaylist[index].hour = hour.toFixed(2)
  902. })
  903. }
  904. }
  905. if (type == 4 || type == 5 || type == 6 || type == 7 || type == 8) {
  906. if (startDate && endDate && startIsAllday && endIsAllday) {
  907. // 判断是不是都已经选择完成
  908. this.$nextTick(() => {
  909. const endDateParams = new Date(endDate).getTime() //计算一下开始时间
  910. const startDateParams = new Date(startDate).getTime() //计算一下结束时间
  911. let days = (endDateParams - startDateParams) / (1000 * 60 * 60 * 24) //开始和结束时间相减 单位:毫秒
  912. if (
  913. startDateParams == endIsAllday ||
  914. (startIsAllday == '上午' && endIsAllday == '上午') ||
  915. (startIsAllday == '下午' && endIsAllday == '下午')
  916. ) {
  917. // 如果选择的情况是 开始:上午 ,结束:上午 或者 开始:下午 ,结束:下午。则都加0.5天
  918. days = days + 0.5
  919. } else if (
  920. startIsAllday == '上午' &&
  921. endIsAllday == '下午'
  922. ) {
  923. //如果选择情况是 开始:上午 结束:下午 ,则加一天,其他情况不加减
  924. days = days + 1
  925. }
  926. this.hoildaylist[index].days = days
  927. })
  928. }
  929. }
  930. },
  931. getHolidayType($event, i, item) {
  932. delete this.hoildaylist[i].startDate
  933. delete this.hoildaylist[i].endDate
  934. this.hoildaylist[i].hour = 0
  935. this.hoildaylist[i].days = 0
  936. delete this.hoildaylist[i].startIsAllday
  937. delete this.hoildaylist[i].endIsAllday
  938. let daysNum = 0
  939. for (let j = 0; j < this.hoildaylist.length; j++) {
  940. if (this.hoildaylist[j].offWorkType == 1) {
  941. daysNum = daysNum + this.hoildaylist[j].days
  942. }
  943. }
  944. this.ProjectData[0] = {
  945. name: `年假(剩余${this.holidayDays.restHolidayTime - daysNum}天,已冻结${this.freezeHolidayTime - daysNum}天)`,
  946. type: 1,
  947. disabled: (this.holidayDays.restHolidayTime - daysNum) < 0
  948. }
  949. let yearsTime = 0
  950. for (let j = 0; j < this.hoildaylist.length; j++) {
  951. if (this.hoildaylist[j].offWorkType == 3) {
  952. yearsTime += this.hoildaylist[j].hour
  953. }
  954. }
  955. this.ProjectData[1] = {
  956. name: `调休(剩余${this.holidayDays.restExchangeTime - yearsTime}小时,已冻结${this.freezeExchangeTime - yearsTime}小时)`,
  957. type: 3,
  958. disabled: (this.holidayDays.restExchangeTime - yearsTime) < 0
  959. }
  960. },
  961. baseRequest1(prefix, opUrl, postData) {
  962. return this.$channel.globleRequest(prefix, opUrl, postData, 'project task')
  963. },
  964. async confirmSubmit() {
  965. let yearsTime = 0
  966. let daysNum = 0
  967. for (let j = 0; j < this.hoildaylist.length; j++) {
  968. if (this.hoildaylist[j].offWorkType == 3) {
  969. yearsTime += this.hoildaylist[j].hour
  970. }
  971. if (this.hoildaylist[j].offWorkType == 1) {
  972. daysNum = daysNum + this.hoildaylist[j].days
  973. }
  974. }
  975. if ((this.holidayDays.restHolidayTime - daysNum) < 0) {
  976. this.$message.error('年假选择时间超时')
  977. return
  978. }
  979. if (this.holidayDays.restExchangeTime - yearsTime < 0) {
  980. this.$message.error('调休假选择时间超时')
  981. return
  982. }
  983. if (!this.form.applyReasons || this.form.applyReasons.length == 0) {
  984. this.$message.error('请填写请假事由')
  985. return
  986. }
  987. let applyOffWorkTimeString = this.hoildaylist.map((e) => {
  988. return {
  989. offWorkType: e.offWorkType,
  990. timeUnit: e.offWorkType == 3 || e.offWorkType == 2 ? '小时' : '天',
  991. useTime: e.offWorkType == 3 || e.offWorkType == 2 ? e.hour : e.days,
  992. startDay: e.startDate,
  993. endDay: e.endDate,
  994. endTime: e.offWorkType == 3 || e.offWorkType == 2 ? null : e.endIsAllday,
  995. startTime: e.offWorkType == 3 || e.offWorkType == 2 ? null : e.startIsAllday
  996. }
  997. })
  998. let fileDataIds = this.form.fileUrlList.map((e) => {
  999. return e.data
  1000. }).toString()
  1001. const confirmForm = {
  1002. ccList: this.form.ccList,
  1003. applyReasons: this.form.applyReasons,
  1004. applyOffWorkTimeString: JSON.stringify(applyOffWorkTimeString),
  1005. fileDataIds: fileDataIds
  1006. }
  1007. this.loading = true
  1008. const { data } = await this.baseRequest1('ApplyOffWorkController', 'addApplyOffWork', { ...confirmForm })
  1009. this.loading = false
  1010. if (data.code == 200) {
  1011. this.hoildaylist = []
  1012. this.selectList = []
  1013. this.form = {
  1014. fileUrlList: []
  1015. }
  1016. this.hoildaylist = [
  1017. { offWorkType: 2, hour: 0, days: 0 }
  1018. ]
  1019. this.$emit('getData')
  1020. this.dialogVisible = false
  1021. }
  1022. },
  1023. async setVisible(status, data) {
  1024. this.dialogVisible = status
  1025. this.hoildaylist = [
  1026. { offWorkType: 2, hour: 0, days: 0 }
  1027. ]
  1028. this.form = {
  1029. fileUrlList: []
  1030. }
  1031. const { data: holidayDays } = await this.baseRequest1('ApplyOffWorkController', 'getHolidayManagementByCreater', {})
  1032. this.freezeHolidayTime = holidayDays.freezeHolidayTime
  1033. this.freezeExchangeTime = holidayDays.freezeExchangeTime
  1034. this.holidayDays = holidayDays
  1035. this.ProjectData = [
  1036. {
  1037. name: `年假(剩余${holidayDays.restHolidayTime}天,已冻结${holidayDays.freezeHolidayTime}天)`,
  1038. type: 1,
  1039. disabled: this.holidayDays.restHolidayTime <= 0
  1040. },
  1041. {
  1042. name: `调休(剩余${holidayDays.restExchangeTime}小时,已冻结${holidayDays.freezeExchangeTime}小时)`,
  1043. type: 3,
  1044. disabled: this.holidayDays.restExchangeTime <= 0
  1045. },
  1046. {
  1047. name: `事假`,
  1048. type: 2
  1049. },
  1050. {
  1051. name: `病假`,
  1052. type: 4
  1053. },
  1054. {
  1055. name: `婚假`,
  1056. type: 5
  1057. },
  1058. {
  1059. name: `产假`,
  1060. type: 6
  1061. },
  1062. {
  1063. name: `陪产假`,
  1064. type: 7
  1065. },
  1066. {
  1067. name: `丧假`,
  1068. type: 8
  1069. }
  1070. ]
  1071. },
  1072. addListRow() {
  1073. const _this = this
  1074. _this.hoildaylist.push({ offWorkType: 2, days: 0, hour: 0 })
  1075. }
  1076. }
  1077. }
  1078. </script>
  1079. <style lang="scss">
  1080. #containerHoliday {
  1081. width: 100%;
  1082. height: 600px;
  1083. background: #F5F5F5;
  1084. }
  1085. .ml5 {
  1086. margin-left: 5px;
  1087. }
  1088. .totalApplyTime {
  1089. font-size: 16px;
  1090. font-family: 微软雅黑;
  1091. font-weight: 400;
  1092. color: #1890FF;
  1093. text-align: right;
  1094. margin: 15px 0 15px 0;
  1095. width: 100%;
  1096. }
  1097. .tabsdom {
  1098. .el-tabs__header {
  1099. text-align: center !important;
  1100. width: 139px !important;
  1101. text-align: center !important;
  1102. display: block !important;
  1103. margin: auto !important;
  1104. margin-bottom: 15px !important;
  1105. }
  1106. .el-tabs__nav-wrap::after {
  1107. display: none;
  1108. }
  1109. .el-upload {
  1110. width: 100%;
  1111. }
  1112. }
  1113. </style>