Payroll.vue 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268
  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-select v-model="queryParam.orgName">
  10. <a-select-option value="all">所有</a-select-option>
  11. <a-select-option value="正织">正织</a-select-option>
  12. <a-select-option value="宁波森语">宁波森语</a-select-option>
  13. <a-select-option value="马菲羊">马菲羊</a-select-option>
  14. </a-select>
  15. </a-form-item>
  16. </a-col>
  17. <a-col :xl="6" :lg="7" :md="8" :sm="24">
  18. <a-form-item label="时间">
  19. <a-month-picker placeholder="请选择" :allowClear="false" v-model="yearWithMonth" @change="onChange" style="width:100% !important"/>
  20. </a-form-item>
  21. </a-col>
  22. <a-col :xl="6" :lg="7" :md="8" :sm="24">
  23. <a-form-item label="类型">
  24. <a-select v-model="queryParam.type">
  25. <a-select-option value="all">所有</a-select-option>
  26. <a-select-option value="加班费">加班费</a-select-option>
  27. <a-select-option value="年休假补贴">年休假补贴</a-select-option>
  28. <a-select-option value="月度工资">月度工资</a-select-option>
  29. </a-select>
  30. </a-form-item>
  31. </a-col>
  32. <a-col :xl="6" :lg="7" :md="8" :sm="24">
  33. <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
  34. <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
  35. <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
  36. </span>
  37. </a-col>
  38. </a-row>
  39. </a-form>
  40. </div>
  41. <!-- 操作按钮区域 -->
  42. <div class="table-operator">
  43. <a-button @click="createPayroll" type="primary" icon="plus">生成工资单</a-button>
  44. </div>
  45. <!-- table区域-begin -->
  46. <div>
  47. <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">
  48. <i class="anticon anticon-info-circle ant-alert-icon"></i>
  49. <span>已选择</span>
  50. <a style="font-weight: 600">
  51. {{ selectedRowKeys.length }}
  52. </a>
  53. <span>项</span>
  54. <a style="margin-left: 24px" @click="onClearSelected">清空</a>
  55. </div>
  56. <a-table
  57. ref="table"
  58. size="middle"
  59. bordered
  60. rowKey="id"
  61. :columns="columns"
  62. :dataSource="dataSource"
  63. :pagination="ipagination"
  64. :scroll="{x: 1000}"
  65. :loading="loading"
  66. :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
  67. @change="handleTableChange">
  68. <span slot="operation" slot-scope="text, record">
  69. <a @click="handleDetail(record)" >查看详情</a>
  70. <a-divider type="vertical" />
  71. <a @click="handleDownload(record)" >下载</a>
  72. </span>
  73. </a-table>
  74. </div>
  75. <!-- table区域-end -->
  76. <!-- 表单区域 -->
  77. <PayrollDetail ref="PayrollDetail"></PayrollDetail>
  78. <AnnualLeavePayroll ref="AnnualLeavePayroll"></AnnualLeavePayroll>
  79. <OvertimePayroll ref="OvertimePayroll"></OvertimePayroll>
  80. <uploadModal ref="uploadModal" @ok="searchQuery"></uploadModal>
  81. </a-card>
  82. </template>
  83. <script>
  84. import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  85. import { getAction,downFile } from '@/api/manage'
  86. import moment from 'moment'
  87. import PayrollDetail from './modules/PayrollDetail.vue'
  88. import AnnualLeavePayroll from './modules/AnnualLeavePayroll.vue'
  89. import OvertimePayroll from './modules/OvertimePayroll.vue'
  90. import uploadModal from './modules/uploadModal.vue'
  91. import JSearchSelectTag from '@/components/dict/JSearchSelectTag'
  92. export default {
  93. name: "Payroll",
  94. mixins: [JeecgListMixin],
  95. components: {
  96. moment,
  97. PayrollDetail,
  98. JSearchSelectTag,
  99. uploadModal,
  100. AnnualLeavePayroll,
  101. OvertimePayroll
  102. },
  103. data () {
  104. return {
  105. description: '工资单列表',
  106. yearWithMonth:'',
  107. selectedRowKeys:[],
  108. selectedRows:[],
  109. // 表头
  110. columns: [
  111. {
  112. title: '序号',
  113. width: 80,
  114. align:"center",
  115. dataIndex: 'index',
  116. customRender:function (t, r, index) {
  117. return parseInt(index)+1;
  118. }
  119. },
  120. {
  121. title: '月份',
  122. align:"center",
  123. dataIndex: 'yearWithMonth'
  124. },
  125. {
  126. title: '类型',
  127. align:"center",
  128. dataIndex: 'type'
  129. },
  130. {
  131. title: '组织',
  132. align:"center",
  133. dataIndex: 'orgName'
  134. },
  135. {
  136. title: '发放人数',
  137. align:"center",
  138. dataIndex: 'numberPeople'
  139. },
  140. {
  141. title: '发放薪水',
  142. align:"center",
  143. dataIndex: 'salary'
  144. },
  145. {
  146. title: '缴纳个税',
  147. align:"center",
  148. dataIndex: 'personalTax'
  149. },
  150. {
  151. title: '生成时间',
  152. align:"center",
  153. dataIndex: 'generationTime'
  154. },
  155. {
  156. title: '版本',
  157. align:"center",
  158. dataIndex: 'version'
  159. },
  160. {
  161. title: '操作',
  162. align:"center",
  163. dataIndex: 'operation',
  164. width: 200,
  165. scopedSlots: { customRender: 'operation' }
  166. },
  167. ],
  168. queryParam:{},
  169. dataSource:[],
  170. // 请求参数
  171. // url: {
  172. // },
  173. }
  174. },
  175. computed: {},
  176. created () {
  177. this.getTableList()
  178. },
  179. methods: {
  180. onChange(data){
  181. this.yearWithMonth = data
  182. this.queryParam.yearWithMonth = this.yearWithMonth?moment(this.yearWithMonth).format('YYYY-MM'):''
  183. },
  184. searchQuery(){
  185. this.queryParam.pageNo = 1
  186. this.getTableList()
  187. },
  188. searchReset(){
  189. this.queryParam={}
  190. this.getTableList()
  191. },
  192. getTableList(){
  193. this.loading = true
  194. getAction('/salary/salaryManagement/list',this.queryParam).then(res=>{
  195. if(res.success){
  196. this.loading = false
  197. this.dataSource =res.result.records
  198. this.dataSource.map(item=>item.version=item.version+'.0')
  199. this.ipagination = {
  200. total: res.result.total,
  201. current: res.result.current,
  202. pageSize: res.result.size
  203. }
  204. }else{
  205. this.$message.error(res.message);
  206. }
  207. })
  208. },
  209. createPayroll(){
  210. this.$refs.uploadModal.visible = true
  211. },
  212. handleDetail(record){
  213. if(record.type=='加班工资单'){
  214. this.$refs.OvertimePayroll.visible = true
  215. this.$refs.OvertimePayroll.detail(record.id)
  216. }else if(record.type=='年休工资单'){
  217. this.$refs.AnnualLeavePayroll.visible = true
  218. this.$refs.AnnualLeavePayroll.detail(record.id)
  219. }else if(record.type=='月度工资单'){
  220. this.$refs.PayrollDetail.visible = true
  221. this.$refs.PayrollDetail.detail(record.id)
  222. }
  223. },
  224. handleDownload(record){
  225. downFile('/salary/salaryManagement/exportXls',{id:record.id,type:record.type}).then(data => {
  226. if (!data) {
  227. this.$message.warning('文件下载失败')
  228. return
  229. }
  230. if (typeof window.navigator.msSaveBlob !== 'undefined') {
  231. window.navigator.msSaveBlob(new Blob([data], { type: 'application/vnd.ms-excel' }), record.type + '.xlsx')
  232. } else {
  233. let url = window.URL.createObjectURL(new Blob([data], { type: 'application/vnd.ms-excel' }))
  234. let link = document.createElement('a')
  235. link.style.display = 'none'
  236. link.href = url
  237. link.setAttribute('download', record.type+'.xlsx')
  238. document.body.appendChild(link)
  239. link.click()
  240. document.body.removeChild(link) // 下载完成移除元素
  241. window.URL.revokeObjectURL(url) // 释放掉blob对象
  242. }
  243. })
  244. },
  245. onSelectChange(selectedRowKeys, selectionRows) {
  246. this.selectedRowKeys = selectedRowKeys;
  247. this.selectedRows = selectionRows;
  248. },
  249. handleTableChange(pagination, filters, sorter) {
  250. this.queryParam.pageNo = pagination.current
  251. this.queryParam.pageSize = pagination.pageSize
  252. this.getTableList()
  253. },
  254. }
  255. }
  256. </script>
  257. <style scoped>
  258. @import '~@assets/less/common.less'
  259. </style>