attendanceManagement.vue 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264
  1. <template>
  2. <a-card :bordered="false">
  3. <!-- 查询区域 -->
  4. <div class="table-page-search-wrapper">
  5. <a-form layout="inline" @keyup.enter.native="searchQuery">
  6. <a-row :gutter="24">
  7. <a-col :xl="6" :lg="7" :md="8" :sm="24">
  8. <a-form-item label="时间">
  9. <a-range-picker
  10. style="width: 100% !important"
  11. v-model="DateTime"
  12. format="YYYY-MM"
  13. valueFormat="YYYY-MM"
  14. :mode="mode2"
  15. :open="open"
  16. :placeholder="['开始时间', '结束时间']"
  17. @panelChange="handlePanelChange2"
  18. @openChange="onDateChange"
  19. @change="changeData"
  20. />
  21. </a-form-item>
  22. </a-col>
  23. <a-col :xl="6" :lg="7" :md="8" :sm="24">
  24. <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
  25. <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
  26. <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
  27. </span>
  28. </a-col>
  29. </a-row>
  30. </a-form>
  31. </div>
  32. <!-- 操作按钮区域 -->
  33. <div class="table-operator">
  34. <a-button @click="UploadAttendanceSheet" type="primary" icon="plus">上传考勤表</a-button>
  35. <a-button @click="addPayroll" v-has="'salaryAttendance:importExcel:flj'" type="primary" icon="plus">导入薪金</a-button>
  36. </div>
  37. <a-table
  38. ref="table"
  39. size="middle"
  40. bordered
  41. rowKey="id"
  42. :columns="columns"
  43. :dataSource="dataSource"
  44. :pagination="ipagination"
  45. :scroll="{x: 1000}"
  46. :loading="loading"
  47. @change="handleTableChange">
  48. <span slot="operation" slot-scope="text, record">
  49. <a @click="handleDetail(record)" >查看详情</a>
  50. <a-divider type="vertical" />
  51. <a @click="handleDownload(record)" >下载</a>
  52. </span>
  53. </a-table>
  54. </div>
  55. <!-- table区域-end -->
  56. <!-- 表单区域 -->
  57. <AttendancelDetail ref="AttendancelDetail"></AttendancelDetail>
  58. <OvertimeDetail ref="OvertimeDetail"></OvertimeDetail>
  59. <AnnualLeave ref="AnnualLeave"></AnnualLeave>
  60. <uploadPayroll ref="uploadPayroll" @ok="searchQuery"></uploadPayroll>
  61. <uploadModal ref="uploadModal" @ok="searchQuery"></uploadModal>
  62. </a-card>
  63. </template>
  64. <script>
  65. import JEllipsis from '@/components/jeecg/JEllipsis'
  66. import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  67. import { getAction,downFile} from '@/api/manage'
  68. import moment from 'moment'
  69. import AttendancelDetail from './modules/AttendancelDetail.vue'
  70. import OvertimeDetail from './modules/OvertimeDetail.vue'
  71. import AnnualLeave from './modules/AnnualLeave.vue'
  72. import uploadPayroll from '../personnelSalary/modules/uploadPayroll.vue'
  73. import uploadModal from './modules/uploadModal.vue'
  74. export default {
  75. name: "attendanceManagement",
  76. mixins: [JeecgListMixin],
  77. components: {
  78. JEllipsis,
  79. AttendancelDetail,
  80. AnnualLeave,
  81. OvertimeDetail,
  82. uploadModal,uploadPayroll
  83. },
  84. data () {
  85. let ellipsis = (v, l) => <j-ellipsis value={v} length={l} />
  86. return {
  87. description: '考勤管理',
  88. DateTime:[],
  89. yearWithMonth:'',
  90. open:false,
  91. mode2: ['month', 'month'],
  92. // 表头
  93. columns: [
  94. {
  95. title: '序号',
  96. width: 80,
  97. align:"center",
  98. dataIndex: 'index',
  99. customRender:function (t, r, index) {
  100. return parseInt(index)+1;
  101. }
  102. },
  103. {
  104. title: '月份',
  105. align:"center",
  106. dataIndex: 'yearWithMonth',
  107. },
  108. {
  109. title: '类型',
  110. align:"center",
  111. dataIndex: 'type',
  112. },
  113. {
  114. title: '名称 ',
  115. align:"center",
  116. dataIndex: 'name'
  117. },
  118. {
  119. title: '上传时间',
  120. align:"center",
  121. dataIndex: 'createTime'
  122. },
  123. {
  124. title: '备注',
  125. align:"center",
  126. width: 350,
  127. customRender: (t) => ellipsis(t,22),
  128. dataIndex: 'remarks'
  129. },
  130. {
  131. title: '版本',
  132. align:"center",
  133. dataIndex: 'version'
  134. },
  135. {
  136. title: '操作',
  137. align:"center",
  138. dataIndex: 'operation',
  139. width: 200,
  140. scopedSlots: { customRender: 'operation' }
  141. },
  142. ],
  143. queryParam:{},
  144. dataSource:[{}],
  145. ipagination:{}
  146. }
  147. },
  148. computed: {},
  149. created () {
  150. this.getTableList()
  151. },
  152. methods: {
  153. searchQuery(){
  154. this.queryParam.pageNo =1
  155. this.getTableList()
  156. },
  157. searchReset(){
  158. this.queryParam={}
  159. this.DateTime = []
  160. this.getTableList()
  161. },
  162. getTableList(){
  163. this.loading = true
  164. getAction('/salary/salaryAttendance/list',this.queryParam).then(res=>{
  165. this.loading = false
  166. if(res.success){
  167. this.dataSource =res.result.records
  168. this.dataSource.map(item=>item.version=item.version+'.0')
  169. this.ipagination = {
  170. total: res.result.total,
  171. current: res.result.current,
  172. pageSize: res.result.size
  173. }
  174. }else{
  175. this.$message.error(res.message);
  176. }
  177. })
  178. },
  179. addPayroll(){
  180. this.$refs.uploadPayroll.visible = true
  181. },
  182. UploadAttendanceSheet(){
  183. this.$refs.uploadModal.visible = true
  184. },
  185. handleDetail(record){
  186. if(record.type=='考勤表'){
  187. this.$refs.AttendancelDetail.visible = true
  188. this.$refs.AttendancelDetail.detail(record.id)
  189. }else if(record.type=='年休表'){
  190. this.$refs.AnnualLeave.visible = true
  191. this.$refs.AnnualLeave.detail(record.id)
  192. }
  193. },
  194. changeData(value){
  195. this.DateTime = value
  196. if(value == null || value.length == 0){
  197. this.queryParam.yearWithMonth_begin = ''
  198. this.queryParam.yearWithMonth_end = ''
  199. }
  200. },
  201. onDateChange(status) {
  202. if(status){
  203. this.open = true;
  204. }else{
  205. this.open = false
  206. }
  207. },
  208. handlePanelChange2(value,mode){
  209. if (this.DateTime[1] && this.DateTime[1]._d != value[1]._d) {
  210. this.open = false;
  211. }
  212. this.DateTime = value
  213. this.queryParam.yearWithMonth_begin = this.DateTime[0]&&this.DateTime[0]!==''?moment(this.DateTime[0]).format('YYYY-MM'):''
  214. this.queryParam.yearWithMonth_end = this.DateTime[1]&&this.DateTime[1]!==''?moment(this.DateTime[1]).format('YYYY-MM'):''
  215. this.mode2 = [mode[0] === 'date' ? 'month' : mode[0], mode[1] === 'date' ? 'month' : mode[1]];
  216. },
  217. handleDownload(record){
  218. this.$message.info('下载中,请稍后...')
  219. downFile('/salary/salaryAttendance/exportXls',{id:record.id,type:record.type}).then(data => {
  220. if (!data) {
  221. this.$message.warning('文件下载失败')
  222. return
  223. }
  224. if (typeof window.navigator.msSaveBlob !== 'undefined') {
  225. window.navigator.msSaveBlob(new Blob([data], { type: 'application/vnd.ms-excel' }), record.type + '.xlsx')
  226. } else {
  227. let url = window.URL.createObjectURL(new Blob([data], { type: 'application/vnd.ms-excel' }))
  228. let link = document.createElement('a')
  229. link.style.display = 'none'
  230. link.href = url
  231. link.setAttribute('download', record.type+'.xlsx')
  232. document.body.appendChild(link)
  233. link.click()
  234. document.body.removeChild(link) // 下载完成移除元素
  235. window.URL.revokeObjectURL(url) // 释放掉blob对象
  236. }
  237. this.$message.success('下载完成,请查看')
  238. })
  239. },
  240. onChange(data){
  241. this.yearWithMonth = data
  242. this.queryParam.yearWithMonth = this.yearWithMonth?moment(this.yearWithMonth).format('YYYY-MM'):''
  243. },
  244. handleTableChange(pagination, filters, sorter) {
  245. this.queryParam.pageNo = pagination.current
  246. this.queryParam.pageSize = pagination.pageSize
  247. this.getTableList()
  248. },
  249. }
  250. }
  251. </script>
  252. <style scoped>
  253. @import '~@assets/less/common.less'
  254. </style>