holidayDetails.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618
  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="closeDialog"
  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" style="margin:10px 0px">
  16. <el-row v-if="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-if="index==0">请假类型 </span>
  21. </div>
  22. </el-col>
  23. <el-col :span="5">
  24. <el-select
  25. v-model="item.offWorkType"
  26. disabled
  27. filterable
  28. placeholder="请假类型"
  29. @change="getHolidayType($event,index,item)"
  30. >
  31. <el-option
  32. v-for="itam in ProjectData"
  33. :key="itam.name"
  34. :disabled="itam.disabled"
  35. :label="itam.name"
  36. :value="itam.type"
  37. />
  38. </el-select>
  39. </el-col>
  40. <el-col :span="4">
  41. <el-date-picker
  42. v-model="item.startDate"
  43. disabled
  44. placeholder="选择日期"
  45. style="width: 100%!important;"
  46. type="date"
  47. value-format="yyyy-MM-dd"
  48. width="100%"
  49. />
  50. </el-col>
  51. <el-col :span="2">
  52. <el-select
  53. v-model="item.startIsAllday"
  54. disabled
  55. filterable
  56. placeholder=""
  57. >
  58. <el-option label="上午" value="上午"/>
  59. <el-option label="下午" value="下午"/>
  60. </el-select>
  61. </el-col>
  62. <el-col :span="1">
  63. <div style="height: 1px;background: #606266;width:100%;margin-top:40%"/>
  64. </el-col>
  65. <el-col :span="4">
  66. <el-date-picker
  67. v-model="item.endDate"
  68. :readonly="!item.startDate||item.startDate.length==0?true:false"
  69. disabled
  70. placeholder="选择日期"
  71. style="width:100%"
  72. type="date"
  73. value-format="yyyy-MM-dd"
  74. />
  75. </el-col>
  76. <el-col :span="2">
  77. <el-select
  78. v-model="item.endIsAllday"
  79. disabled
  80. filterable
  81. placeholder=""
  82. >
  83. <el-option label="上午" value="上午"/>
  84. <el-option label="下午" value="下午"/>
  85. </el-select>
  86. </el-col>
  87. <el-col :span="2" class="col-txt" style="text-align: center">
  88. 共{{
  89. !item.days ? 0 : item.days
  90. }}天
  91. </el-col>
  92. </el-row>
  93. <el-row v-if="item.offWorkType==3||item.offWorkType==2" :gutter="10" class="holidayRow">
  94. <el-col :span="2" class="col-txt">
  95. <div style="
  96. width: 100%"
  97. >
  98. <span v-if="index==0">请假类型 </span>&nbsp;
  99. </div>
  100. </el-col>
  101. <el-col :span="5" class="col-input">
  102. <el-select
  103. v-model="item.offWorkType"
  104. disabled
  105. filterable
  106. placeholder="请假类型"
  107. style="width: 100%"
  108. @change="getHolidayType($event,index,item)"
  109. >
  110. <el-option
  111. v-for="itam in ProjectData"
  112. :key="itam.name"
  113. :disabled="itam.disabled"
  114. :label="itam.name"
  115. :value="itam.type"
  116. />
  117. </el-select>
  118. </el-col>
  119. <el-col :span="6">
  120. <el-date-picker
  121. v-model="item.dayMerange"
  122. class="pdr10px mgb10px"
  123. disabled
  124. placeholder="选择日期"
  125. type="date"
  126. value-format="yyyy-MM-dd"
  127. >
  128. </el-date-picker>
  129. </el-col>
  130. <el-col :span="7">
  131. <div style="display: flex;align-items: center">
  132. <el-time-picker
  133. disabled
  134. value-format="HH:mm"
  135. format="HH:mm"
  136. v-model="item.startTime"
  137. placeholder="开始时间"
  138. >
  139. </el-time-picker>
  140. <div class="zhi">至</div>
  141. <el-time-picker
  142. disabled
  143. format="HH:mm"
  144. value-format="HH:mm"
  145. v-model="item.endTime"
  146. placeholder="结束时间"
  147. >
  148. </el-time-picker>
  149. </div>
  150. </el-col>
  151. <el-col :span="2" class="col-txt" style="text-align: center">
  152. <!-- {{ JSON.stringify(item) }}-->
  153. 共{{ item.hour }}小时
  154. </el-col>
  155. </el-row>
  156. <el-row v-if="item.offWorkType!=1&& item.offWorkType!=3&&item.offWorkType!=2" :gutter="10"
  157. class="holidayRow"
  158. >
  159. <el-col :span="2" class="col-txt">
  160. <div style="width: 100%">
  161. &nbsp;
  162. <span v-if="index==0">请假类型 </span>
  163. </div>
  164. </el-col>
  165. <el-col :span="5">
  166. <el-select v-model="item.offWorkType"
  167. disabled
  168. filterable
  169. placeholder="请假类型"
  170. @change="getHolidayType($event,index,item)"
  171. >
  172. <el-option
  173. v-for="itam in ProjectData"
  174. :key="itam.name"
  175. :disabled="itam.disabled"
  176. :label="itam.name"
  177. :value="itam.type"
  178. />
  179. </el-select>
  180. </el-col>
  181. <el-col :span="4">
  182. <el-date-picker v-model="item.startDate"
  183. disabled
  184. placeholder="选择日期"
  185. style="width: 100%!important;"
  186. type="date"
  187. value-format="yyyy-MM-dd"
  188. width="100%"
  189. @change="countDays(item.startDate,item.endDate,item.startIsAllday,item.endIsAllday,index,item.offWorkType)"
  190. />
  191. </el-col>
  192. <el-col :span="2">
  193. <el-select v-model="item.startIsAllday"
  194. disabled
  195. filterable
  196. placeholder=""
  197. >
  198. <el-option label="上午" value="上午"/>
  199. <el-option label="下午" value="下午"/>
  200. </el-select>
  201. </el-col>
  202. <el-col :span="1">
  203. <div style="height: 1px;background: #606266;width:100%;margin-top:40%"/>
  204. </el-col>
  205. <el-col :span="4">
  206. <el-date-picker v-model="item.endDate"
  207. :readonly="!item.startDate||item.startDate.length==0?true:false"
  208. disabled
  209. placeholder="选择日期"
  210. style="width:100%"
  211. type="date"
  212. value-format="yyyy-MM-dd"
  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 v-model="item.endIsAllday"
  218. disabled
  219. filterable
  220. placeholder=""
  221. >
  222. <el-option label="上午" value="上午"/>
  223. <el-option label="下午" value="下午"/>
  224. </el-select>
  225. </el-col>
  226. <el-col :span="2" class="col-txt" style="text-align: center">
  227. 共{{
  228. !item.days ? 0 : item.days
  229. }}天
  230. </el-col>
  231. </el-row>
  232. </div>
  233. <div class="totalApplyTime">{{ totalApplyTime }}</div>
  234. <el-row>
  235. <el-col :span="2" class="col-txt"><span>请假事由</span></el-col>
  236. <el-col :span="22">
  237. <el-input v-model="form.applyReasons" readonly style="min-height:50px;margin-bottom: 25px"
  238. type="textarea"
  239. />
  240. </el-col>
  241. </el-row>
  242. <el-row>
  243. <el-col :span="2" class="col-txt">附件</el-col>
  244. <el-col :span="22">
  245. <el-upload
  246. :action="$constant.BASE_URI+'/FileController/upload'"
  247. :file-list="form.fileUrlList"
  248. class="upload-demo"
  249. disabled
  250. multiple
  251. >
  252. <el-button size="small" type="primary">点击上传</el-button>
  253. <div slot="file" slot-scope="{file}">
  254. <a :href="file.url">{{ file.name }}</a>
  255. <span class="el-upload-list__item-actions">
  256. <i class="el-icon-delete" @click="handlePictureRemove(file,form.fileUrlList)"/>
  257. </span>
  258. </div>
  259. </el-upload>
  260. </el-col>
  261. </el-row>
  262. <el-row style="margin-top: 25px">
  263. <el-col :span="2" class="col-txt">抄送</el-col>
  264. <el-col :span="22">
  265. <user-select
  266. ref="userSelect"
  267. :default-select="selectList"
  268. :multiple="true"
  269. disab
  270. width="700"
  271. />
  272. </el-col>
  273. </el-row>
  274. </el-card>
  275. <h3>流程历史</h3>
  276. <div class="tableDom">
  277. <el-card>
  278. <div class="tableDom">
  279. <el-table
  280. :data="tableData"
  281. :header-cell-style="{
  282. background:'#1890FF !important',
  283. color:'white'
  284. }"
  285. border
  286. style="width: 100%"
  287. >
  288. <el-table-column fixed label="序号" type="index" width="60"/>
  289. <el-table-column
  290. label="节点名称"
  291. prop="nodeName"
  292. width="180"
  293. />
  294. <el-table-column
  295. label="处理人"
  296. prop="auditUserName"
  297. width="180"
  298. />
  299. <el-table-column
  300. label="审核结果"
  301. prop="auditResultString"
  302. />
  303. <el-table-column
  304. label="审核意见"
  305. prop="auditContent"
  306. />
  307. <el-table-column
  308. label="发起/审核时间"
  309. prop="createdAt"
  310. >
  311. <template slot-scope="scope">
  312. {{ $common.transTime(scope.row.createdAt) }}
  313. </template>
  314. </el-table-column>
  315. </el-table>
  316. </div>
  317. </el-card>
  318. </div>
  319. </el-tab-pane>
  320. <el-tab-pane label="流程图 " name="second">
  321. <div style="width: 100%">
  322. <el-row>
  323. <el-col :span="24">
  324. <!-- <div id="containerHolidayDetails" style="width: 100%" v-show="true"></div>-->
  325. <holiday-canvas ref="holidayCanvas"/>
  326. </el-col>
  327. </el-row>
  328. </div>
  329. </el-tab-pane>
  330. </el-tabs>
  331. </div>
  332. <div slot="footer">
  333. <el-button @click="closeDialog">关闭</el-button>
  334. </div>
  335. </el-dialog>
  336. </template>
  337. <script>
  338. import userSelect from '@/views/components/UserSelect.vue'
  339. import holidayCanvas from '@/views/workflow/components/myProcess/holidayCanvas.vue'
  340. export default {
  341. name: 'applyPay',
  342. components: {
  343. userSelect,
  344. holidayCanvas
  345. },
  346. data() {
  347. return {
  348. row: {},
  349. tableData: [],
  350. loading: false,
  351. totalApplyTime: '共计请假0天,0.00小时',
  352. dialogVisible: false,
  353. hoildaylist: [
  354. { offWorkType: 2, hour: 0, days: 0 }
  355. ],
  356. fileError: false,
  357. fileList: [],
  358. selectList: [],
  359. form: {
  360. fileUrlList: []
  361. },
  362. daysNum: 0,
  363. holidayDays: {},
  364. hoildayist: [
  365. { type: 'year' }
  366. ],
  367. options: [],
  368. value1: [],
  369. ProjectData: [
  370. { name: '年假(剩余x天)', type: 'year' },
  371. { name: '调休(剩余x小时)', type: 'affair' },
  372. { name: '病假', type: 'illness' }
  373. ],
  374. dialogTitle: '请假申请-查看详情',
  375. activeName: 'first'
  376. }
  377. },
  378. watch: {
  379. 'hoildaylist': {
  380. deep: true,
  381. handler(newValue, oldValue) {
  382. let day = 0
  383. let hour = 0
  384. for (let i = 0; i < this.hoildaylist.length; i++) {
  385. if (this.hoildaylist[i].hour === 0 || this.hoildaylist[i].hour) {
  386. hour = hour + this.hoildaylist[i].hour
  387. }
  388. if (this.hoildaylist[i].days == 0 || this.hoildaylist[i].days) {
  389. day = day + this.hoildaylist[i].days
  390. }
  391. }
  392. this.holidayDate = day
  393. this.holidayTime = hour
  394. this.changeCotalApplyTime(`共计请假${day}天,${hour.toFixed(2)}小时`)
  395. }
  396. }
  397. },
  398. methods: {
  399. closeDialog(){
  400. this.dialogVisible =false
  401. this.$emit('close')
  402. },
  403. reductionLineStyle(nodeKey) {
  404. for (let i = 0; i < this.linesData.length; i++) {
  405. if (this.linesData[i].nodeKey == nodeKey) {
  406. this.linesData[i].lineStyle = lineStyle
  407. }
  408. }
  409. },
  410. getLineStyle(nodeKey) {
  411. for (let i = 0; i < this.linesData.length; i++) {
  412. if (this.linesData[i].nodeKey == nodeKey) {
  413. this.linesData[i].lineStyle = {
  414. color: '#2A3980',
  415. width: 2
  416. }
  417. }
  418. }
  419. },
  420. getImgUrl(index, type) {
  421. switch (type) {
  422. case '1':
  423. this.node[index].symbol = 'image://' + require('../asste/lanfangkuai.png')
  424. break
  425. case '2':
  426. this.node[index].symbol = 'image://' + require('../asste/hongfangkuai.jpg')
  427. break
  428. case '3':
  429. this.node[index].symbol = 'image://' + require('../asste/huangfanmgkuai.png')
  430. break
  431. case '4' || '5':
  432. this.node[index].symbol = 'image://' + require('../asste/qianlanfangkuai.jpg')
  433. break
  434. default:
  435. }
  436. },
  437. handleClick(tab, event) {
  438. if (this.activeName == 'second') this.$refs.holidayCanvas.createNodeCanvas(this.row)
  439. },
  440. changeCotalApplyTime(e) {
  441. this.totalApplyTime = e
  442. },
  443. handleRemove(file, fileList) {
  444. },
  445. handlePreview(file) {
  446. },
  447. handleExceed(files, fileList) {
  448. this.$message.warning(`当前限制选择 3 个文件,本次选择了 ${files.length} 个文件,共选择了 ${files.length + fileList.length} 个文件`)
  449. },
  450. beforeRemove(file, fileList) {
  451. return this.$confirm(`确定移除 ${file.name}?`)
  452. },
  453. getHolidayType(i, type) {
  454. },
  455. confirmSubmit() {
  456. this.dialogVisibl = false
  457. },
  458. baseRequest1(prefix, opUrl, postData) {
  459. return this.$channel.globleRequest(prefix, opUrl, postData, 'project task')
  460. },
  461. async setVisible(status, row) {
  462. this.activeName = 'first'
  463. const { data: holidayDays } = await this.baseRequest1('ApplyOffWorkController', 'getHolidayManagementByUserId', { userId: row.applyUser })
  464. this.holidayDays = holidayDays
  465. this.ProjectData = [
  466. {
  467. name: `年假(剩余${holidayDays.restHolidayTime}天,已冻结${holidayDays.freezeHolidayTime}天)`,
  468. type: 1
  469. },
  470. {
  471. name: `调休(剩余${holidayDays.restExchangeTime}小时,已冻结${holidayDays.freezeExchangeTime}小时)`,
  472. type: 3
  473. },
  474. {
  475. name: `事假`,
  476. type: 2
  477. },
  478. {
  479. name: `病假`,
  480. type: 4
  481. },
  482. {
  483. name: `婚假`,
  484. type: 5
  485. },
  486. {
  487. name: `产假`,
  488. type: 6
  489. },
  490. {
  491. name: `陪产假`,
  492. type: 7
  493. },
  494. {
  495. name: `丧假`,
  496. type: 8
  497. }
  498. ]
  499. const { data } = await this.baseRequest1('ApplyOffWorkController', 'getInfoByFlowMainId', { flowMainId: row.id })
  500. const { data: flowHistroy } = await this.baseRequest1('FlowMainController', 'getFlowHistroyByFlowMainId', { flowMainId: row.id })
  501. this.form = data
  502. this.tableData = flowHistroy
  503. this.hoildaylist = data.applyOffWorkTimeList.map((e) => {
  504. return {
  505. offWorkType: Number(e.offWorkType),
  506. endDate: this.$common.transTime(e.endDay),
  507. startDate: this.$common.transTime(e.startDay),
  508. days: Number(e.offWorkType) != 3 && Number(e.offWorkType) != 2 ? e.useTime : 0,
  509. hour: Number(e.offWorkType) == 3 || Number(e.offWorkType) == 2 ? e.useTime : 0,
  510. startIsAllday: e.startTime,
  511. dayMerange: Number(e.offWorkType) == 2 || Number(e.offWorkType) == 3 ? this.$common.transDate(e.startDay) : null,
  512. timeMerange: Number(e.offWorkType) == 2 || Number(e.offWorkType) == 3 ? [this.$common.transhh(e.startDay), this.$common.transhh(e.endDay)] : null,
  513. startTime: this.$common.transhh(e.startDay),
  514. endTime: this.$common.transhh(e.endDay),
  515. endIsAllday: e.endTime
  516. }
  517. })
  518. let selectList = data.flowMainCcList.map((e) => {
  519. return e.ccUser
  520. })
  521. this.selectList = selectList
  522. if (data.fileDataIds) {
  523. const { data: fileTaoTaoList } = await this.baseRequest1('FileZtController', 'findFileInfoByIds/' + data.fileDataIds, '')
  524. this.form.fileUrlList = fileTaoTaoList.data.map((e) => {
  525. return {
  526. url: this.$constant.BASE_URI + '/FileController/download/' + e.id,
  527. name: e.fileName,
  528. data: e.id,
  529. uid: new Date().getTime()
  530. }
  531. })
  532. } else {
  533. this.form.fileUrlList = []
  534. }
  535. this.dialogVisible = status
  536. this.row = row
  537. },
  538. addListRow() {
  539. const _this = this
  540. _this.hoildayist.push({ type: 'year' })
  541. }
  542. }
  543. }
  544. </script>
  545. <style lang="scss">
  546. #containerHolidayDetails {
  547. width: 100%;
  548. height: 600px;
  549. background: #F5F5F5;
  550. }
  551. .ml5 {
  552. margin-left: 5px;
  553. }
  554. .tabsdom {
  555. .el-tabs__header {
  556. text-align: center !important;
  557. width: 139px !important;
  558. text-align: center !important;
  559. display: block !important;
  560. margin: auto !important;
  561. margin-bottom: 15px !important;
  562. }
  563. .el-tabs__nav-wrap::after {
  564. display: none;
  565. }
  566. .el-upload {
  567. width: 100%;
  568. }
  569. }
  570. </style>