holidayDetails.vue 16 KB

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