holidayDetailList.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478
  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. this.search.startTime = val[0]
  183. this.search.endTime = val[1]
  184. },
  185. styleBack({ row, column, rowIndex, columnIndex }) {
  186. if (row.isFirst == 1) return { backgroundColor: '#FDBABB' }
  187. },
  188. confirmOutput() {
  189. const OutSize = [{ wch: 15 }, { wch: 15 }, { wch: 15 }, { wch: 15 }, { wch: 15 }, { wch: 15 }, { wch: 15 }, { wch: 15 }]
  190. const fileName = '请假申请明细' + new Date().Format('yyyy-MM-dd')
  191. this.$outputXlsxFile(this.OutData, OutSize, fileName)
  192. },
  193. getPostData: function() {
  194. const postData = {
  195. departmentIds: this.departmentIds,
  196. name: this.search.name,
  197. pageNum: this.currentPage,
  198. pageSize: this.pageSize
  199. }
  200. const currUser = this.$common.currUser()
  201. if (currUser && currUser.groupId) {
  202. postData.groupId = common.currUser().groupId
  203. }
  204. if (!this.$common.isAdmin()) {
  205. postData.chargedby = this.$common.currUser().id
  206. }
  207. return postData
  208. },
  209. initOutData: function() {
  210. const _this = this
  211. this.OutData = [['请假单号', '请假人', '所在部门', '发起时间', '流程结束时间', '假别', '请假日期起', '请假日期止', '请假小时数', '请假事由']]
  212. const postData = this.getPostData()
  213. this.baseRequest1('findAllApplyOffWorkListByInfo', postData).then((res) => {
  214. try {
  215. if (res.data) {
  216. res.data.forEach(function(item) {
  217. const jsonMap = _this.getItemJson(item)
  218. // <el-table-column label="请假单号" prop="form_id"/>
  219. // <el-table-column label="请假人" prop="truename"/>
  220. // <el-table-column label="所在部门" prop="dept_name"/>
  221. // <el-table-column label="发起时间" prop="created_at"/>
  222. // <el-table-column label="流程结束时间" prop="last_update_time"/>
  223. // <el-table-column label="假别" prop="off_work_type"/>
  224. // <el-table-column label="请假小时数" prop="use_time"/>
  225. // <el-table-column label="请假事由" prop="apply_reasons">
  226. const jsonArray = [
  227. jsonMap.form_id,
  228. jsonMap.truename,
  229. jsonMap.dept_name,
  230. jsonMap.created_at,
  231. jsonMap.last_update_time,
  232. jsonMap.off_work_type,
  233. jsonMap.startTime,
  234. jsonMap.endTime,
  235. jsonMap.use_time,
  236. jsonMap.apply_reasons
  237. ]
  238. _this.OutData.push(jsonArray)
  239. })
  240. }
  241. } catch (e) {
  242. }
  243. }).catch(() => {
  244. })
  245. },
  246. async changeStatus(row) {
  247. let status = row.status == 0 ? 2 : row.status == 2 ? 0 : null
  248. this.loading = true
  249. let { data } = await this.baseRequest1('noOrUse', { id: row.id, status })
  250. if (data.code == 200) {
  251. this.loading = false
  252. this.getData()
  253. this.$message.success('状态修改成功')
  254. }
  255. },
  256. async openHolidayDialog(status, row) {
  257. this.$refs.addOrEditHoliiday.setVisible(status, row)
  258. },
  259. handleCurrentChange: function(val) {
  260. this.currentPage = val
  261. this.getData()
  262. },
  263. recallApply: function(row, type) {
  264. const _this = this
  265. _this.$confirm('该流程已经在审核中,撤回后原审核内容将作废确认撤回吗?', '提示', {
  266. confirmButtonText: '确定',
  267. cancelButtonText: '取消',
  268. type: 'warning'
  269. }).then(function() {
  270. const deleting = _this.$notify({
  271. title: '正在撤回,请稍等',
  272. type: 'warning'
  273. })
  274. const postData = {
  275. flowMainid: row.id
  276. }
  277. _this.baseRequest2(
  278. 'FlowMainController',
  279. 'recallApply',
  280. postData).then(res => {
  281. if (res.data.code === 200) {
  282. _this.getData()
  283. deleting.close()
  284. _this.$notify({
  285. title: '撤回成功',
  286. type: 'info'
  287. })
  288. } else {
  289. deleting.close()
  290. _this.dialogVisible = false
  291. _this.$notify({
  292. title: '撤回失败',
  293. type: 'info'
  294. })
  295. }
  296. }).catch((err) => {
  297. deleting.close()
  298. _this.$alert(err)
  299. })
  300. }).catch(function(error) {
  301. console.error(error)
  302. })
  303. },
  304. // 初始化获取数据
  305. getData() {
  306. const _this = this
  307. const postData = {
  308. name: _this.search.name,
  309. startTime: _this.search.startTime,
  310. endTime: this.search.endTime,
  311. pageNum: _this.currentPage,
  312. pageSize: _this.pageSize
  313. }
  314. this.loading = true
  315. _this.baseRequest1('findApplyOffWorkListByInfo', postData).then(res => {
  316. if (res.data) {
  317. this.loading = false
  318. _this.tableData = []
  319. res.data.rows.forEach(item => {
  320. item.noUseDate = item.noUseDate ? this.$common.transDate(item.noUseDate) : null
  321. item.restHolidayDate = item.restHolidayDate ? this.$common.transDate(item.restHolidayDate) : null
  322. item.joinDay = item.joinDay ? this.$common.transDate(item.joinDay) : null
  323. item.socialPayDay = item.socialPayDay ? this.$common.transDate(item.socialPayDay) : null
  324. _this.tableData.push(_this.getItemJson(item))
  325. })
  326. _this.allpage = res.data.total
  327. } else {
  328. _this.tableData = []
  329. }
  330. })
  331. this.initOutData()
  332. },
  333. getItemJson(item) {
  334. item.created_at = item.created_at ? this.$common.transDate(item.created_at) : null
  335. item.use_time = item.use_time + item.time_unit
  336. item.last_update_time = item.created_at ? this.$common.transDate(item.last_update_time) : null
  337. item.off_work_type = item.off_work_type == 1 ? '年假'
  338. : item.off_work_type == 2 ? '事假'
  339. : item.off_work_type == 3 ? '调休'
  340. : item.off_work_type == 4 ? '病假'
  341. : item.off_work_type == 5 ? '婚假'
  342. : item.off_work_type == 6 ? '产假'
  343. : item.off_work_type == 7 ? '陪产假'
  344. : item.off_work_type == 8 ? '丧假' : ''
  345. return item
  346. },
  347. handleSearch: function() {
  348. this.getData()
  349. },
  350. handleReset: function() {
  351. for (const i in this.search) {
  352. if (i !== 'pageNum' && i !== 'pageSize') {
  353. this.search[i] = ''
  354. }
  355. }
  356. this.handleSearch()
  357. },
  358. // 打开流程发起菜单
  359. handleClick(tab, event) {
  360. this.getData()
  361. },
  362. // 请求封装,继承类中调用,必须存在
  363. baseRequest1(opUrl, postData) {
  364. return this.$channel.globleRequest(
  365. 'ApplyOffWorkController',
  366. opUrl,
  367. postData,
  368. 'project task'
  369. )
  370. },
  371. baseRequest2(controller, opUrl, postData) {
  372. return this.$channel.globleRequest(
  373. controller,
  374. opUrl,
  375. postData,
  376. 'project task'
  377. )
  378. }
  379. }
  380. }
  381. </script>
  382. <style lang="scss">
  383. .chaochuyingcang {
  384. width: 100%;
  385. white-space: nowrap;
  386. overflow: hidden;
  387. text-overflow: ellipsis;
  388. }
  389. .custom-tree-container .block-l {
  390. /*flex-grow: 2 ;*/
  391. float: left;
  392. width: 20%;
  393. padding: 0 8px 0 0;
  394. }
  395. .custom-tree-container .block-r {
  396. /*flex-grow: 10;*/
  397. float: left;
  398. width: 80%;
  399. /*padding: 0 0 0 8px;*/
  400. }
  401. .holidayRow {
  402. .el-select {
  403. width: 100%;
  404. }
  405. }
  406. .el-dropdown-link {
  407. cursor: pointer;
  408. color: rgba(39, 78, 219, 1);
  409. }
  410. .demonstration {
  411. display: block;
  412. color: #8492a6;
  413. font-size: 14px;
  414. margin-bottom: 20px;
  415. }
  416. .labeldom {
  417. .el-tabs__nav-wrap::after {
  418. background: none;
  419. }
  420. }
  421. .w200px {
  422. width: 200px;
  423. }
  424. </style>
  425. <style scoped>
  426. .ch-input .el-input__inner {
  427. border-radius: 0px;
  428. border-color: #32323a;
  429. }
  430. .ch-input-size {
  431. width: 150px;
  432. }
  433. .ch-button {
  434. borderund-color: #32323a;
  435. color: #fff;
  436. }
  437. .ch-button-warning {
  438. margin-left: 10px;
  439. border-radius: 0px;
  440. border-color: #E75B5B;
  441. background-color: #E75B5B;
  442. color: #fff;
  443. }
  444. </style>