holidayDetailList.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485
  1. <template>
  2. <div class="custom-tree-container">
  3. <el-row class="handle-box" :gutter="10" style="margin-bottom: 10px">
  4. <el-form
  5. ref="elForm"
  6. :model="search"
  7. :rules="rules"
  8. size="medium"
  9. >
  10. <el-col :span="4">
  11. <el-form-item label="" prop="name" style="margin-bottom: 0">
  12. <el-input
  13. size="small"
  14. v-model="search.name"
  15. :style="{ width: '100%' }"
  16. clearable
  17. placeholder="请输入名称"
  18. />
  19. </el-form-item>
  20. </el-col>
  21. <el-col :span="4">
  22. <el-form-item label="" prop="name" style="margin-bottom: 0">
  23. <el-date-picker
  24. id="datePicker"
  25. v-model="timeValue"
  26. size="small"
  27. type="daterange"
  28. align="right"
  29. unlink-panels
  30. range-separator="-"
  31. start-placeholder="流程开始日期"
  32. end-placeholder="流程结束日期"
  33. value-format="yyyy-MM-dd"
  34. :picker-options="pickerOptions"
  35. @change="pickerChange"
  36. />
  37. </el-form-item>
  38. </el-col>
  39. <el-col :span="16">
  40. <div style="width: auto;float: right">
  41. <el-button class="ch-button-warning" plain size="small" @click="handleReset()"><i
  42. class="el-icon-aim"
  43. />&nbsp;重置
  44. </el-button>
  45. <el-button class="ch-button" size="small" @click="handleSearch()"><i class="el-icon-search"/>&nbsp;搜索
  46. </el-button>
  47. <el-button size="small" type="success" @click="confirmOutput()"><i class="el-icon-download"/>&nbsp;导出
  48. </el-button>
  49. </div>
  50. </el-col>
  51. </el-form>
  52. </el-row>
  53. <el-row class="handle-box">
  54. <el-col :span="24">
  55. <el-table
  56. v-loading="loading"
  57. :cell-style="styleBack"
  58. :data="tableData"
  59. row-class-name="g_table_row"
  60. stripe
  61. style="width: 100%"
  62. >
  63. <el-table-column label="序号" type="index" width="60"/>
  64. <el-table-column label="请假单号" prop="form_id"/>
  65. <el-table-column label="请假人" prop="truename"/>
  66. <el-table-column label="所在部门" prop="dept_name"/>
  67. <el-table-column label="发起时间" prop="created_at"/>
  68. <el-table-column label="流程结束时间" prop="last_update_time"/>
  69. <el-table-column label="假别" prop="off_work_type"/>
  70. <el-table-column label="请假日期起">
  71. <template scope="scope">
  72. {{ scope.row.startTime }}
  73. </template>
  74. </el-table-column>
  75. <el-table-column label="请假日期止">
  76. <template scope="scope">
  77. {{ scope.row.endTime }}
  78. </template>
  79. </el-table-column>
  80. <el-table-column label="请假小时数" prop="use_time"/>
  81. <el-table-column label="请假事由" prop="apply_reasons">
  82. <template scope="scope">
  83. <el-tooltip class="item" effect="dark" :content="scope.row.apply_reasons" placement="top">
  84. <div class="chaochuyingcang">{{ scope.row.apply_reasons }}</div>
  85. </el-tooltip>
  86. </template>
  87. </el-table-column>
  88. </el-table>
  89. <div class="table-page">
  90. <el-pagination
  91. :current-page.sync="currentPage"
  92. :page-size="pageSize"
  93. :total="allpage"
  94. background
  95. layout="total, prev, pager, next"
  96. @current-change="handleCurrentChange"
  97. />
  98. </div>
  99. </el-col>
  100. </el-row>
  101. </div>
  102. </template>
  103. <script>
  104. import common from '@/static/utils/common'
  105. import Base from '../base/base'
  106. import BaseData from '../base/baseData'
  107. import BaseDept from '../base/baseDept'
  108. export default {
  109. mixins: [Base, BaseData, BaseDept],
  110. data() {
  111. return {
  112. pickerOptions: {
  113. shortcuts: [{
  114. text: '最近一周',
  115. onClick: function(picker) {
  116. var end = new Date()
  117. var start = new Date()
  118. start.setTime(start.getTime() - 3600 * 1000 * 24 * 7)
  119. picker.$emit('pick', [start, end])
  120. }
  121. }, {
  122. text: '最近一个月',
  123. onClick: function(picker) {
  124. var end = new Date()
  125. var start = new Date()
  126. start.setTime(start.getTime() - 3600 * 1000 * 24 * 30)
  127. picker.$emit('pick', [start, end])
  128. }
  129. }, {
  130. text: '最近三个月',
  131. onClick: function(picker) {
  132. var end = new Date()
  133. var start = new Date()
  134. start.setTime(start.getTime() - 3600 * 1000 * 24 * 90)
  135. picker.$emit('pick', [start, end])
  136. }
  137. }]
  138. },
  139. timeValue: '',
  140. // 查询数据的内容
  141. search: {},
  142. departmentIds: '',
  143. deptAttr: '',
  144. // 通用字典项
  145. AUDIT_TYPE: [],
  146. dc_map: {},
  147. // 列表相关
  148. cusName: '',
  149. auditStatus: '',
  150. auditType: '',
  151. proName: '',
  152. applyBy: '',
  153. tableData: [],
  154. loading: false,
  155. UserMap: {},
  156. // 分页
  157. currentPage: 1,
  158. allpage: 0,
  159. pageSize: 12,
  160. // 弹框相关
  161. currAuditId: '',
  162. dialogVisible: false,
  163. dialogTitle: '新增',
  164. isAdd: true,
  165. detailList: [],
  166. rules: {},
  167. OutData: []
  168. }
  169. },
  170. mounted() {
  171. const _this = this
  172. _this.getData()
  173. this.initDeptAttr().then(() => {
  174. if (this.DeptAttrData.length > 0) {
  175. this.deptAttr = this.DeptAttrData[0].value
  176. this.initDepartment({ deptAttr: this.deptAttr })
  177. }
  178. })
  179. },
  180. methods: {
  181. pickerChange: function(val) {
  182. if(val){
  183. this.search.startTime = val[0]
  184. this.search.endTime = val[1]
  185. }else{
  186. this.search.startTime = ''
  187. this.search.endTime = ''
  188. }
  189. },
  190. styleBack({ row, column, rowIndex, columnIndex }) {
  191. if (row.isFirst == 1) return { backgroundColor: '#FDBABB' }
  192. },
  193. confirmOutput() {
  194. const OutSize = [{ wch: 15 }, { wch: 15 }, { wch: 15 }, { wch: 15 }, { wch: 15 }, { wch: 15 }, { wch: 15 }, { wch: 15 }]
  195. const fileName = '请假申请明细' + new Date().Format('yyyy-MM-dd')
  196. this.$outputXlsxFile(this.OutData, OutSize, fileName)
  197. },
  198. getPostData: function() {
  199. const postData = {
  200. departmentIds: this.departmentIds,
  201. name: this.search.name,
  202. startTime: this.search.startTime,
  203. endTime: this.search.endTime,
  204. pageNum: this.currentPage,
  205. pageSize: this.pageSize
  206. }
  207. const currUser = this.$common.currUser()
  208. if (currUser && currUser.groupId) {
  209. postData.groupId = common.currUser().groupId
  210. }
  211. if (!this.$common.isAdmin()) {
  212. postData.chargedby = this.$common.currUser().id
  213. }
  214. return postData
  215. },
  216. initOutData: function() {
  217. const _this = this
  218. this.OutData = [['请假单号', '请假人', '所在部门', '发起时间', '流程结束时间', '假别', '请假日期起', '请假日期止', '请假小时数', '请假事由']]
  219. const postData = this.getPostData()
  220. this.baseRequest1('findAllApplyOffWorkListByInfo', postData).then((res) => {
  221. try {
  222. if (res.data) {
  223. res.data.forEach(function(item) {
  224. const jsonMap = _this.getItemJson(item)
  225. // <el-table-column label="请假单号" prop="form_id"/>
  226. // <el-table-column label="请假人" prop="truename"/>
  227. // <el-table-column label="所在部门" prop="dept_name"/>
  228. // <el-table-column label="发起时间" prop="created_at"/>
  229. // <el-table-column label="流程结束时间" prop="last_update_time"/>
  230. // <el-table-column label="假别" prop="off_work_type"/>
  231. // <el-table-column label="请假小时数" prop="use_time"/>
  232. // <el-table-column label="请假事由" prop="apply_reasons">
  233. const jsonArray = [
  234. jsonMap.form_id,
  235. jsonMap.truename,
  236. jsonMap.dept_name,
  237. jsonMap.created_at,
  238. jsonMap.last_update_time,
  239. jsonMap.off_work_type,
  240. jsonMap.startTime,
  241. jsonMap.endTime,
  242. jsonMap.use_time,
  243. jsonMap.apply_reasons
  244. ]
  245. _this.OutData.push(jsonArray)
  246. })
  247. }
  248. } catch (e) {
  249. }
  250. }).catch(() => {
  251. })
  252. },
  253. async changeStatus(row) {
  254. let status = row.status == 0 ? 2 : row.status == 2 ? 0 : null
  255. this.loading = true
  256. let { data } = await this.baseRequest1('noOrUse', { id: row.id, status })
  257. if (data.code == 200) {
  258. this.loading = false
  259. this.getData()
  260. this.$message.success('状态修改成功')
  261. }
  262. },
  263. async openHolidayDialog(status, row) {
  264. this.$refs.addOrEditHoliiday.setVisible(status, row)
  265. },
  266. handleCurrentChange: function(val) {
  267. this.currentPage = val
  268. this.getData()
  269. },
  270. recallApply: function(row, type) {
  271. const _this = this
  272. _this.$confirm('该流程已经在审核中,撤回后原审核内容将作废确认撤回吗?', '提示', {
  273. confirmButtonText: '确定',
  274. cancelButtonText: '取消',
  275. type: 'warning'
  276. }).then(function() {
  277. const deleting = _this.$notify({
  278. title: '正在撤回,请稍等',
  279. type: 'warning'
  280. })
  281. const postData = {
  282. flowMainid: row.id
  283. }
  284. _this.baseRequest2(
  285. 'FlowMainController',
  286. 'recallApply',
  287. postData).then(res => {
  288. if (res.data.code === 200) {
  289. _this.getData()
  290. deleting.close()
  291. _this.$notify({
  292. title: '撤回成功',
  293. type: 'info'
  294. })
  295. } else {
  296. deleting.close()
  297. _this.dialogVisible = false
  298. _this.$notify({
  299. title: '撤回失败',
  300. type: 'info'
  301. })
  302. }
  303. }).catch((err) => {
  304. deleting.close()
  305. _this.$alert(err)
  306. })
  307. }).catch(function(error) {
  308. console.error(error)
  309. })
  310. },
  311. // 初始化获取数据
  312. getData() {
  313. const _this = this
  314. const postData = {
  315. name: _this.search.name,
  316. startTime: _this.search.startTime,
  317. endTime: this.search.endTime,
  318. pageNum: _this.currentPage,
  319. pageSize: _this.pageSize
  320. }
  321. this.loading = true
  322. _this.baseRequest1('findApplyOffWorkListByInfo', postData).then(res => {
  323. if (res.data) {
  324. this.loading = false
  325. _this.tableData = []
  326. res.data.rows.forEach(item => {
  327. item.noUseDate = item.noUseDate ? this.$common.transDate(item.noUseDate) : null
  328. item.restHolidayDate = item.restHolidayDate ? this.$common.transDate(item.restHolidayDate) : null
  329. item.joinDay = item.joinDay ? this.$common.transDate(item.joinDay) : null
  330. item.socialPayDay = item.socialPayDay ? this.$common.transDate(item.socialPayDay) : null
  331. _this.tableData.push(_this.getItemJson(item))
  332. })
  333. _this.allpage = res.data.total
  334. } else {
  335. _this.tableData = []
  336. }
  337. })
  338. this.initOutData()
  339. },
  340. getItemJson(item) {
  341. item.created_at = item.created_at ? this.$common.transDate(item.created_at) : null
  342. item.use_time = item.use_time + item.time_unit
  343. item.last_update_time = item.created_at ? this.$common.transDate(item.last_update_time) : null
  344. item.off_work_type = item.off_work_type == 1 ? '年假'
  345. : item.off_work_type == 2 ? '事假'
  346. : item.off_work_type == 3 ? '调休'
  347. : item.off_work_type == 4 ? '病假'
  348. : item.off_work_type == 5 ? '婚假'
  349. : item.off_work_type == 6 ? '产假'
  350. : item.off_work_type == 7 ? '陪产假'
  351. : item.off_work_type == 8 ? '丧假' : ''
  352. return item
  353. },
  354. handleSearch: function() {
  355. this.getData()
  356. },
  357. handleReset: function() {
  358. for (const i in this.search) {
  359. if (i !== 'pageNum' && i !== 'pageSize') {
  360. this.search[i] = ''
  361. }
  362. }
  363. this.handleSearch()
  364. },
  365. // 打开流程发起菜单
  366. handleClick(tab, event) {
  367. this.getData()
  368. },
  369. // 请求封装,继承类中调用,必须存在
  370. baseRequest1(opUrl, postData) {
  371. return this.$channel.globleRequest(
  372. 'ApplyOffWorkController',
  373. opUrl,
  374. postData,
  375. 'project task'
  376. )
  377. },
  378. baseRequest2(controller, opUrl, postData) {
  379. return this.$channel.globleRequest(
  380. controller,
  381. opUrl,
  382. postData,
  383. 'project task'
  384. )
  385. }
  386. }
  387. }
  388. </script>
  389. <style lang="scss">
  390. .chaochuyingcang {
  391. width: 100%;
  392. white-space: nowrap;
  393. overflow: hidden;
  394. text-overflow: ellipsis;
  395. }
  396. .custom-tree-container .block-l {
  397. /*flex-grow: 2 ;*/
  398. float: left;
  399. width: 20%;
  400. padding: 0 8px 0 0;
  401. }
  402. .custom-tree-container .block-r {
  403. /*flex-grow: 10;*/
  404. float: left;
  405. width: 80%;
  406. /*padding: 0 0 0 8px;*/
  407. }
  408. .holidayRow {
  409. .el-select {
  410. width: 100%;
  411. }
  412. }
  413. .el-dropdown-link {
  414. cursor: pointer;
  415. color: rgba(39, 78, 219, 1);
  416. }
  417. .demonstration {
  418. display: block;
  419. color: #8492a6;
  420. font-size: 14px;
  421. margin-bottom: 20px;
  422. }
  423. .labeldom {
  424. .el-tabs__nav-wrap::after {
  425. background: none;
  426. }
  427. }
  428. .w200px {
  429. width: 200px;
  430. }
  431. </style>
  432. <style scoped>
  433. .ch-input .el-input__inner {
  434. border-radius: 0px;
  435. border-color: #32323a;
  436. }
  437. .ch-input-size {
  438. width: 150px;
  439. }
  440. .ch-button {
  441. borderund-color: #32323a;
  442. color: #fff;
  443. }
  444. .ch-button-warning {
  445. margin-left: 10px;
  446. border-radius: 0px;
  447. border-color: #E75B5B;
  448. background-color: #E75B5B;
  449. color: #fff;
  450. }
  451. </style>