applyHoliday.vue 33 KB

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