holidayQuota.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565
  1. <template>
  2. <div class="custom-tree-container">
  3. <div class="block-l">
  4. <el-card class="space-vertical" shadow="hover">
  5. <el-select v-model="deptAttr" class="full" filterable placeholder="组织架构类型" size="small"
  6. @change="handleDeptAttrChange"
  7. >
  8. <el-option v-for="item in DeptAttrData" :key="item.value" :label="item.label" :value="item.value"/>
  9. </el-select>
  10. </el-card>
  11. <el-card shadow="hover">
  12. <el-tag :closable="selectDeptNode.level!==0" class="full space-vertical" @close="handleCloseDept()">当前所选:{{
  13. selectDeptNode.name
  14. }}
  15. </el-tag>
  16. <el-tree
  17. ref="selectTree"
  18. :data="DeptTree"
  19. :default-expanded-keys="expandedDeptKey"
  20. :expand-on-click-node="expandDeptClick"
  21. :indent="deptTreeIndent"
  22. accordion
  23. node-key="id"
  24. @node-click="handleDeptNodeClick"
  25. >
  26. <span slot-scope="{ node, data }" class="custom-tree-node">
  27. <span>
  28. <i v-if="data.level == 0" class="el-icon-s-home"/>
  29. <i v-else-if="data.level == 1" class="el-icon-menu"/>
  30. <i v-else class="el-icon-link"/>
  31. {{ node.label }}
  32. </span>
  33. <span v-if="data.level == 0">
  34. <el-link class="space" type="primary" @click="() => unFoldAll()">展开</el-link>
  35. <el-link class="space" type="primary" @click="() => collapseAll()">折叠</el-link>
  36. </span>
  37. </span>
  38. </el-tree>
  39. </el-card>
  40. </div>
  41. <div class="block-r">
  42. <el-row class="handle-box" style="margin-bottom: 10px">
  43. <el-col :span="24">
  44. <el-form
  45. ref="elForm"
  46. :model="search"
  47. :rules="rules"
  48. label-width="100px"
  49. size="medium"
  50. >
  51. <el-col :span="6">
  52. <el-form-item label="姓名" prop="name" style="margin-bottom: 0">
  53. <el-input
  54. v-model="search.name"
  55. :style="{ width: '100%' }"
  56. clearable
  57. placeholder="请输入名称"
  58. />
  59. </el-form-item>
  60. </el-col>
  61. <el-col :span="6">
  62. </el-col>
  63. <el-col :span="18">
  64. <div style="width: auto;float: right">
  65. <el-button class="ch-button-warning" plain size="small" @click="handleReset()"><i
  66. class="el-icon-aim"
  67. />&nbsp;重置
  68. </el-button>
  69. <el-button class="ch-button" size="small" @click="handleSearch()"><i class="el-icon-search"/>&nbsp;搜索
  70. </el-button>
  71. <el-button size="small" type="success" @click="confirmOutput()"><i class="el-icon-download"/>&nbsp;导出
  72. </el-button>
  73. </div>
  74. </el-col>
  75. </el-form>
  76. </el-col>
  77. </el-row>
  78. <el-row class="handle-box">
  79. <el-col :span="24">
  80. <el-table
  81. v-loading="loading"
  82. :cell-style="styleBack"
  83. :data="tableData"
  84. row-class-name="g_table_row"
  85. stripe
  86. style="width: 100%"
  87. >
  88. <el-table-column label="序号" type="index" width="60"/>
  89. <el-table-column label="姓名" prop="truename"/>
  90. <el-table-column label="部门" prop="deptName"/>
  91. <el-table-column label="入职日期" prop="joinDay"/>
  92. <el-table-column label="年假核算标准" prop="holidayType">
  93. <template slot-scope="scope">
  94. {{
  95. scope.row.holidayType == 1 ? '社保不满10年' :
  96. scope.row.holidayType == 2 ? '社保满10年' :
  97. scope.row.holidayType == 3 ? '司龄不满1年' :
  98. scope.row.holidayType == 4 ? '社保满20年' : ''
  99. }}
  100. </template>
  101. </el-table-column>
  102. <el-table-column label="年假基数(天)" prop="holidayDayBase"/>
  103. <!-- <el-table-column label="剩余年假(天)" prop="freezeHolidayTime"/>-->
  104. <el-table-column label="剩余年假(天)" prop="freezeHolidayTime" width="120">
  105. <template slot-scope="scope">
  106. <span>{{
  107. (scope.row.restHolidayTime != null ? scope.row.restHolidayTime : '') + '' + (scope.row.freezeHolidayTime > 0 ? '(另冻结' + scope.row.freezeHolidayTime + '天)' : '')
  108. }}</span>
  109. </template>
  110. </el-table-column>
  111. <!-- <el-table-column label="年假有效期" prop="restHolidayDate"/>-->
  112. <el-table-column label="年假有效期" prop="restHolidayDate">
  113. <template slot-scope="scope">
  114. <span>{{ scope.row.holidayDayBase <= 0 ? '' : scope.row.restHolidayDate }}</span>
  115. </template>
  116. </el-table-column>
  117. <el-table-column label="剩余调休假(h)" prop="restExchangeTime"/>
  118. <el-table-column label="用户状态" prop="status">
  119. <template slot-scope="scope">
  120. <el-switch
  121. v-model="scope.row.status==2?false:true"
  122. active-color="#13ce66"
  123. inactive-color="#ff4949"
  124. @change="changeStatus(scope.row)"
  125. >
  126. </el-switch>
  127. </template>
  128. </el-table-column>
  129. <el-table-column label="禁用时间" prop="noUseDate"/>
  130. <el-table-column align="center" fixed="right" header-align="center" label="操作" width="250px">
  131. <template slot-scope="scope">
  132. <el-button :disabled="scope.row.status!=0" size="small" type="primary"
  133. @click="openHolidayDialog(true,scope.row)"
  134. >编辑
  135. </el-button>
  136. </template>
  137. </el-table-column>
  138. </el-table>
  139. <div class="table-page">
  140. <el-pagination
  141. :current-page.sync="currentPage"
  142. :page-size="pageSize"
  143. :total="allpage"
  144. background
  145. layout="total, prev, pager, next"
  146. @current-change="handleCurrentChange"
  147. />
  148. </div>
  149. </el-col>
  150. </el-row>
  151. </div>
  152. <add-or-edit-holiiday ref="addOrEditHoliiday" @getData="getData()"/>
  153. </div>
  154. </template>
  155. <script>
  156. import addOrEditHoliiday from '@/views/workflow/components/holidayQuota/addOrEditHoliiday.vue'
  157. import common from '@/static/utils/common'
  158. import Base from '../base/base'
  159. import BaseData from '../base/baseData'
  160. import BaseDept from '../base/baseDept'
  161. export default {
  162. components: { addOrEditHoliiday },
  163. mixins: [Base, BaseData, BaseDept],
  164. data() {
  165. return {
  166. // 查询数据的内容
  167. search: {},
  168. departmentIds: '',
  169. deptAttr: '',
  170. // 通用字典项
  171. AUDIT_TYPE: [],
  172. dc_map: {},
  173. // 列表相关
  174. cusName: '',
  175. auditStatus: '',
  176. auditType: '',
  177. proName: '',
  178. applyBy: '',
  179. tableData: [],
  180. loading: false,
  181. UserMap: {},
  182. // 分页
  183. currentPage: 1,
  184. allpage: 0,
  185. pageSize: 12,
  186. // 弹框相关
  187. currAuditId: '',
  188. dialogVisible: false,
  189. dialogTitle: '新增',
  190. isAdd: true,
  191. detailList: [],
  192. rules: {},
  193. OutData: []
  194. }
  195. },
  196. mounted() {
  197. const _this = this
  198. _this.getData()
  199. this.initDeptAttr().then(() => {
  200. if (this.DeptAttrData.length > 0) {
  201. this.deptAttr = this.DeptAttrData[0].value
  202. this.initDepartment({ deptAttr: this.deptAttr })
  203. }
  204. })
  205. },
  206. methods: {
  207. styleBack({ row, column, rowIndex, columnIndex }) {
  208. if (row.isFirst == 1) return { backgroundColor: '#FDBABB' }
  209. },
  210. addAttrDept: function() {
  211. if (!this.form.selectDepts) this.form.selectDepts = []
  212. this.form.selectDepts.push({
  213. userId: this.form.id,
  214. attrId: '',
  215. deptAttrs: this.DeptAttrData,
  216. deptId: '',
  217. depts: [],
  218. postIds: []
  219. })
  220. },
  221. dlgOpen: function() {
  222. const _this = this
  223. if (this.form.id) {
  224. this.baseRequest('getById', {
  225. id: this.form.id
  226. }).then((res) => {
  227. if (res.data) {
  228. _this.form.groupId = res.data.groupId
  229. _this.form.username = res.data.username
  230. _this.form.truename = res.data.truename
  231. _this.form.staffCode = res.data.staffCode
  232. _this.form.gender = res.data.gender
  233. _this.form.leader = res.data.leader
  234. _this.form.position = res.data.position
  235. _this.form.posts = res.data.posts ? res.data.posts.split(',') : []
  236. if (_this.form.posts.length) {
  237. _this.initPosition2(_this.form.posts)
  238. }
  239. _this.form.sequenceNo = res.data.sequenceNo
  240. _this.form.phone = res.data.phone
  241. _this.form.secretKey = res.data.secretKey
  242. _this.form.comment = res.data.comment
  243. _this.form.selectDepartment = res.data.department
  244. _this.form.selectDepts = []
  245. _this.userDeptRequest('listByUserId', {
  246. userId: _this.form.id
  247. }).then(resDept => {
  248. if (resDept.data) {
  249. resDept.data.forEach(dept => {
  250. dept.postIds = dept.posts ? dept.posts.split(',') : []
  251. dept.deptAttrs = _this.DeptAttrData
  252. if (dept.attrId) {
  253. dept.depts = _this.TempDepts.filter(tempDept => {
  254. return tempDept.deptAttr === dept.attrId
  255. })
  256. }
  257. _this.form.selectDepts.push(dept)
  258. })
  259. }
  260. // console.log('listByUserId', _this.form.selectDepts)
  261. })
  262. }
  263. }).catch(() => {
  264. })
  265. }
  266. },
  267. handleDeptAttrChange: function(val) {
  268. this.selectDeptNode = this.getDeptDefaultTopNode()
  269. this.deptAttr = val
  270. this.initDepartment({ deptAttr: val })
  271. this.handleSearch()
  272. },
  273. handleDeptNodeClick(data, node, ocx) {
  274. this.departmentIds = data.id
  275. this.getData()
  276. },
  277. handleCloseDept: function() {
  278. this.selectDeptNode = this.getDeptDefaultTopNode()
  279. this.handleSearch()
  280. },
  281. confirmOutput() {
  282. const OutSize = [
  283. { wch: 15 }, { wch: 15 }, { wch: 15 }, { wch: 15 }, { wch: 15 }, { wch: 15 }, { wch: 15 },
  284. { wch: 15 }, { wch: 15 }, { wch: 25 }, { wch: 25 }, { wch: 15 }, { wch: 15 }, { wch: 15 }]
  285. const fileName = '假期额度导出' + new Date().Format('yyyy-MM-dd')
  286. this.$outputXlsxFile(this.OutData, OutSize, fileName)
  287. },
  288. getPostData: function() {
  289. const postData = {
  290. departmentIds: this.departmentIds,
  291. name: this.search.name,
  292. pageNum: this.currentPage,
  293. pageSize: this.pageSize
  294. }
  295. const currUser = this.$common.currUser()
  296. if (currUser && currUser.groupId) {
  297. postData.groupId = common.currUser().groupId
  298. }
  299. if (!this.$common.isAdmin()) {
  300. postData.chargedby = this.$common.currUser().id
  301. }
  302. return postData
  303. },
  304. initOutData: function() {
  305. const _this = this
  306. this.OutData = [[
  307. '姓名', '部门', '入职日期', '年假核算标准', '年假基数(天)', '剩余年假(天)',
  308. '年假有效期', '剩余调休假', '用户状态', '禁用时间']]
  309. const postData = this.getPostData()
  310. this.baseRequest1('listAll', postData).then((res) => {
  311. try {
  312. if (res.data) {
  313. res.data.forEach(function(item) {
  314. item.joinDay = !item.joinDay ? '' : _this.$common.transDate(item.joinDay)
  315. item.restHolidayDate = !item.restHolidayDate ? '' : _this.$common.transDate(item.restHolidayDate)
  316. item.zhuangtai = item.status == 2 ? '禁用' : '启用'
  317. item.noUseDate = !item.noUseDate ? '状态非禁用' : _this.$common.transDate(item.noUseDate)
  318. item.holidayType = item.holidayType == 1 ? '社保不满10年' : item.holidayType == 2 ? '社保满10年' : item.holidayType == 3 ? '司龄不满一年' : ''
  319. const jsonMap = _this.getItemJson(item)
  320. const jsonArray = [
  321. jsonMap.truename,//姓名
  322. jsonMap.deptName,//部门
  323. jsonMap.joinDay,//入职日期
  324. jsonMap.holidayType,//年假核算标准
  325. jsonMap.holidayDayBase,//年假基数
  326. (jsonMap.restHolidayTime != null ? jsonMap.restHolidayTime : '') + '' + (jsonMap.freezeHolidayTime > 0 ? '(另冻结' + jsonMap.freezeHolidayTime + '天)' : '')
  327. ,//剩余调休假
  328. jsonMap.restHolidayDate,//年假有效期
  329. jsonMap.restExchangeTime,//剩余调休假
  330. jsonMap.zhuangtai,
  331. jsonMap.noUseDate
  332. ]
  333. console.log(jsonArray)
  334. _this.OutData.push(jsonArray)
  335. })
  336. }
  337. } catch (e) {
  338. }
  339. }).catch(() => {
  340. })
  341. },
  342. async changeStatus(row) {
  343. let status = row.status == 0 ? 2 : row.status == 2 ? 0 : null
  344. this.loading = true
  345. let { data } = await this.baseRequest1('noOrUse', { id: row.id, status })
  346. if (data.code == 200) {
  347. this.loading = false
  348. this.getData()
  349. this.$message.success('状态修改成功')
  350. }
  351. },
  352. async openHolidayDialog(status, row) {
  353. this.$refs.addOrEditHoliiday.setVisible(status, row)
  354. },
  355. handleCurrentChange: function(val) {
  356. this.currentPage = val
  357. this.getData()
  358. },
  359. recallApply: function(row, type) {
  360. const _this = this
  361. _this.$confirm('该流程已经在审核中,撤回后原审核内容将作废确认撤回吗?', '提示', {
  362. confirmButtonText: '确定',
  363. cancelButtonText: '取消',
  364. type: 'warning'
  365. }).then(function() {
  366. const deleting = _this.$notify({
  367. title: '正在撤回,请稍等',
  368. type: 'warning'
  369. })
  370. const postData = {
  371. flowMainid: row.id
  372. }
  373. _this.baseRequest2(
  374. 'FlowMainController',
  375. 'recallApply',
  376. postData).then(res => {
  377. if (res.data.code === 200) {
  378. _this.getData()
  379. deleting.close()
  380. _this.$notify({
  381. title: '撤回成功',
  382. type: 'info'
  383. })
  384. } else {
  385. deleting.close()
  386. _this.dialogVisible = false
  387. _this.$notify({
  388. title: '撤回失败',
  389. type: 'info'
  390. })
  391. }
  392. }).catch((err) => {
  393. deleting.close()
  394. _this.$alert(err)
  395. })
  396. }).catch(function(error) {
  397. console.error(error)
  398. })
  399. },
  400. // 初始化获取数据
  401. getData() {
  402. const _this = this
  403. const postData = {
  404. applyUserName: _this.search.field103, // 申请人名称
  405. applyTheme: _this.search.field102, // 主题名称
  406. flowName: _this.search.name, // 流程名称
  407. auditUser: this.$common.currUser()
  408. ? this.$common.currUser().id
  409. : '',
  410. departmentIds: this.departmentIds,
  411. name: this.search.name,
  412. pageNum: _this.currentPage,
  413. pageSize: _this.pageSize
  414. }
  415. this.loading = true
  416. _this.baseRequest1('list', postData).then(res => {
  417. if (res.data) {
  418. this.loading = false
  419. _this.tableData = []
  420. res.data.rows.forEach(item => {
  421. item.noUseDate = item.noUseDate ? this.$common.transDate(item.noUseDate) : null
  422. item.restHolidayDate = item.restHolidayDate ? this.$common.transDate(item.restHolidayDate) : null
  423. item.joinDay = item.joinDay ? this.$common.transDate(item.joinDay) : null
  424. item.socialPayDay = item.socialPayDay ? this.$common.transDate(item.socialPayDay) : null
  425. _this.tableData.push(_this.getItemJson(item))
  426. })
  427. _this.allpage = res.data.total
  428. } else {
  429. _this.tableData = []
  430. }
  431. })
  432. this.initOutData()
  433. },
  434. getItemJson(item) {
  435. item.xxx = '111'
  436. return item
  437. },
  438. handleSearch: function() {
  439. this.getData()
  440. },
  441. handleReset: function() {
  442. for (const i in this.search) {
  443. if (i !== 'pageNum' && i !== 'pageSize') {
  444. this.search[i] = ''
  445. }
  446. }
  447. this.handleSearch()
  448. },
  449. // 打开流程发起菜单
  450. handleClick(tab, event) {
  451. this.getData()
  452. },
  453. // 请求封装,继承类中调用,必须存在
  454. baseRequest1(opUrl, postData) {
  455. return this.$channel.globleRequest(
  456. 'HolidayManagementController',
  457. opUrl,
  458. postData,
  459. 'project task'
  460. )
  461. },
  462. baseRequest2(controller, opUrl, postData) {
  463. return this.$channel.globleRequest(
  464. controller,
  465. opUrl,
  466. postData,
  467. 'project task'
  468. )
  469. }
  470. }
  471. }
  472. </script>
  473. <style lang="scss">
  474. .custom-tree-container .block-l {
  475. /*flex-grow: 2 ;*/
  476. float: left;
  477. width: 20%;
  478. padding: 0 8px 0 0;
  479. }
  480. .custom-tree-container .block-r {
  481. /*flex-grow: 10;*/
  482. float: left;
  483. width: 80%;
  484. /*padding: 0 0 0 8px;*/
  485. }
  486. .holidayRow {
  487. .el-select {
  488. width: 100%;
  489. }
  490. }
  491. .el-dropdown-link {
  492. cursor: pointer;
  493. color: rgba(39, 78, 219, 1);
  494. }
  495. .demonstration {
  496. display: block;
  497. color: #8492a6;
  498. font-size: 14px;
  499. margin-bottom: 20px;
  500. }
  501. .labeldom {
  502. .el-tabs__nav-wrap::after {
  503. background: none;
  504. }
  505. }
  506. .w200px {
  507. width: 200px;
  508. }
  509. </style>
  510. <style scoped>
  511. .ch-input .el-input__inner {
  512. border-radius: 0px;
  513. border-color: #32323a;
  514. }
  515. .ch-input-size {
  516. width: 150px;
  517. }
  518. .ch-button {
  519. borderund-color: #32323a;
  520. color: #fff;
  521. }
  522. .ch-button-warning {
  523. margin-left: 10px;
  524. border-radius: 0px;
  525. border-color: #E75B5B;
  526. background-color: #E75B5B;
  527. color: #fff;
  528. }
  529. </style>