SalarysStatistics.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424
  1. <template>
  2. <a-card :bordered="false">
  3. <a-spin :spinning="spinning" tip="执行中,请稍后...">
  4. <!-- 查询区域 -->
  5. <div class="table-page-search-wrapper">
  6. <a-form layout="inline" @keyup.enter.native="searchQuery">
  7. <a-row :gutter="24">
  8. <a-col :xl="6" :lg="7" :md="8" :sm="24">
  9. <a-form-item label="时间">
  10. <a-range-picker
  11. style="width: 100% !important"
  12. v-model="DateTime"
  13. :allowClear = 'false'
  14. format="YYYY-MM"
  15. :mode="mode2"
  16. :open="open"
  17. :placeholder="['开始时间', '结束时间']"
  18. @panelChange="handlePanelChange2"
  19. @openChange="onDateChange"
  20. @change="changeData"
  21. />
  22. </a-form-item>
  23. </a-col>
  24. <a-col :xl="6" :lg="7" :md="8" :sm="24">
  25. <a-form-item label="公司">
  26. <a-select v-model="queryParam.orgName">
  27. <a-select-option value="">所有</a-select-option>
  28. <a-select-option value="正织">正织</a-select-option>
  29. <a-select-option value="森语">森语</a-select-option>
  30. <a-select-option value="马菲羊">马菲羊</a-select-option>
  31. </a-select>
  32. </a-form-item>
  33. </a-col>
  34. <a-col :xl="6" :lg="7" :md="8" :sm="24">
  35. <a-form-item label="部门">
  36. <j-search-select-tag v-model="queryParam.sysOrgCode" placeholder="请选择部门"
  37. dict="sys_depart,depart_name,depart_name,org_type='3' or org_code='TBD' order by org_code"/>
  38. </a-form-item>
  39. </a-col>
  40. <template v-if="toggleSearchStatus">
  41. <a-col :xl="6" :lg="7" :md="8" :sm="24">
  42. <a-form-item label="姓名">
  43. <j-search-select-tag v-model="queryParam.name" placeholder="请选择名称"
  44. dict="sys_user,realname,realname" allowClear/>
  45. </a-form-item>
  46. </a-col>
  47. <a-col :xl="6" :lg="7" :md="8" :sm="24">
  48. <a-form-item label="雇佣状态">
  49. <a-select v-model="queryParam.syHireType" mode="multiple">
  50. <a-select-option value="">所有</a-select-option>
  51. <a-select-option value="在职">在职</a-select-option>
  52. <a-select-option value="离职">离职</a-select-option>
  53. <a-select-option value="退休返聘">退休返聘</a-select-option>
  54. <a-select-option value="系统运维">系统运维</a-select-option>
  55. </a-select>
  56. </a-form-item>
  57. </a-col>
  58. </template>
  59. <a-col :xl="6" :lg="7" :md="8" :sm="24">
  60. <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
  61. <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
  62. <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
  63. <a @click="handleToggleSearch" style="margin-left: 8px">
  64. {{ toggleSearchStatus ? '收起' : '展开' }}
  65. <a-icon :type="toggleSearchStatus ? 'up' : 'down'" />
  66. </a>
  67. </span>
  68. </a-col>
  69. </a-row>
  70. </a-form>
  71. </div>
  72. <!-- 操作按钮区域 -->
  73. <div class="table-operator">
  74. <a-button type="primary" @click="exportList" icon="plus">导出</a-button>
  75. </div>
  76. <a-table
  77. ref="tableRef"
  78. size="middle"
  79. bordered
  80. rowKey="userId"
  81. :columns="columns"
  82. :dataSource="dataSource"
  83. :pagination="ipagination"
  84. :scroll="{x: 2000}"
  85. :loading="loading"
  86. :footer="showTotal"
  87. @change="handleTableChange">
  88. </a-table>
  89. </div>
  90. <!-- table区域-end -->
  91. </a-spin>
  92. <!-- 表单区域 -->
  93. </a-card>
  94. </template>
  95. <script>
  96. import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  97. import { getAction,downFile } from '@/api/manage'
  98. import moment from 'moment'
  99. import JSearchSelectTag from '@/components/dict/JSearchSelectTag'
  100. export default {
  101. name: "SalarysStatistics",
  102. mixins: [JeecgListMixin],
  103. components: {
  104. moment,
  105. JSearchSelectTag
  106. },
  107. data () {
  108. return {
  109. description: '薪资统计',
  110. DateTime:[moment().subtract(1, 'months'),moment().subtract(1, 'months'),],
  111. mode2: ['month', 'month'],
  112. open:false,
  113. spinning:false,
  114. // 表头
  115. columns: [
  116. {
  117. title: '序号',
  118. width: 80,
  119. align:"center",
  120. dataIndex: 'code',
  121. customRender:function (text, record, index) {
  122. if(record.name=='合计'){
  123. return ''
  124. }else{
  125. return parseInt(index)+1;
  126. }
  127. },
  128. fixed:'left'
  129. },
  130. {
  131. title: '姓名',
  132. align:"center",
  133. dataIndex: 'name',
  134. width: 100,
  135. fixed:'left'
  136. },
  137. {
  138. title: '基本薪资',
  139. align:"center",
  140. dataIndex: 'beforeAdjustment',
  141. fixed:'left'
  142. },
  143. {
  144. title: '公司',
  145. align:"center",
  146. dataIndex: 'orgName',
  147. },
  148. {
  149. title: '话费补贴',
  150. align:"center",
  151. dataIndex: 'phoneBill'
  152. },
  153. {
  154. title: '午餐补贴',
  155. align:"center",
  156. dataIndex: 'lunch'
  157. },
  158. {
  159. title: '住房补贴',
  160. align:"center",
  161. dataIndex: 'housingSubsidies',
  162. },
  163. {
  164. title: '交通补贴',
  165. align:"center",
  166. dataIndex: 'transportation',
  167. },
  168. {
  169. title: '全勤奖',
  170. align:"center",
  171. dataIndex: 'fullAttendance'
  172. },
  173. {
  174. title: '加班工资',
  175. align:"center",
  176. dataIndex: 'overtimePay'
  177. },
  178. {
  179. title: '年休工资',
  180. align:"center",
  181. dataIndex: 'yearSalary'
  182. },
  183. {
  184. title: '社保',
  185. align:"center",
  186. dataIndex: 'socialSecurity'
  187. },
  188. {
  189. title: '公积金',
  190. align:"center",
  191. dataIndex: 'accumulationFund'
  192. },
  193. {
  194. title: '迟到',
  195. align:"center",
  196. dataIndex: 'latenessCost'
  197. },
  198. {
  199. title: '事假',
  200. align:"center",
  201. dataIndex: 'personalCost'
  202. },
  203. {
  204. title: '病假',
  205. align:"center",
  206. dataIndex: 'sickCost'
  207. },
  208. {
  209. title: '婚假',
  210. align:"center",
  211. dataIndex: 'marriageCost'
  212. },
  213. {
  214. title: '丧假',
  215. align:"center",
  216. dataIndex: 'funeralCost'
  217. },
  218. {
  219. title: '个税',
  220. align:"center",
  221. dataIndex: 'personalTax',
  222. fixed:'right'
  223. },
  224. {
  225. title: '合计应发',
  226. align:"center",
  227. dataIndex: 'totalPayable',
  228. fixed:'right'
  229. },
  230. {
  231. title: '合计应扣',
  232. align:"center",
  233. dataIndex: 'totalDeduction',
  234. fixed:'right'
  235. },
  236. {
  237. title: '实发合计',
  238. align:"center",
  239. dataIndex: 'actualOccurrence',
  240. width: 120,
  241. fixed:'right'
  242. },
  243. ],
  244. ipagination:{},
  245. queryParam:{
  246. beginDate:moment().subtract(1, 'months').format('YYYY-MM'),
  247. endDate:moment().subtract(1, 'months').format('YYYY-MM'),
  248. syHireType:['在职','退休返聘']
  249. },
  250. dataSource:[{}],
  251. totalDataSource:[]
  252. // 请求参数
  253. // url: {
  254. // },
  255. }
  256. },
  257. watch:{
  258. dataSource(){
  259. this.$nextTick(()=>{
  260. const dom = this.$refs.tableRef.$el.getElementsByClassName('ant-table-body')[0];
  261. dom.addEventListener(
  262. 'scroll',
  263. () => {
  264. this.$refs.tableInfo.$el.querySelectorAll(
  265. '.ant-table-body'
  266. )[0].scrollLeft = dom.scrollLeft
  267. },
  268. true
  269. )
  270. })
  271. }
  272. },
  273. computed: {
  274. },
  275. created () {
  276. // this.getTableList()
  277. },
  278. methods: {
  279. getTableList(){
  280. this.spinning = true
  281. var param = Object.assign({}, this.queryParam)
  282. param.syHireType = (param.syHireType).toString()
  283. getAction('/salary/salaryManagement/querySalaryTotalList',param).then(res=>{
  284. this.spinning = false
  285. if(res.success){
  286. this.dataSource =res.result.records
  287. this.totalDataSourceList(res.data)
  288. this.ipagination = {
  289. total: res.result.total,
  290. current: res.result.current,
  291. pageSize: res.result.size
  292. }
  293. }else{
  294. this.$message.error(res.message);
  295. }
  296. })
  297. },
  298. totalDataSourceList(data){
  299. this.totalDataSource = [];
  300. var item={
  301. name:'合计',
  302. beforeAdjustment:data.beforeAdjustment,//data.beforeAdjustment?parseFloat(data.beforeAdjustment.toFixed(2)):'',
  303. personalTax:data.personalTax?parseFloat(data.personalTax.toFixed(2)):'',
  304. totalPayable:data.totalPayable?parseFloat(data.totalPayable.toFixed(2)):'',
  305. totalDeduction: data.totalDeduction?parseFloat(data.totalDeduction.toFixed(2)):'',
  306. actualOccurrence: data.actualOccurrence?parseFloat(data.actualOccurrence.toFixed(2)):''
  307. }
  308. this.totalDataSource.push(item)
  309. },
  310. changeData(value){
  311. this.DateTime = value
  312. },
  313. onDateChange(status) {
  314. if(status){
  315. this.open = true;
  316. }else{
  317. this.open = false
  318. }
  319. },
  320. handlePanelChange2(value,mode){
  321. if (this.DateTime[1] && this.DateTime[1]._d != value[1]._d) {
  322. this.open = false;
  323. }
  324. this.DateTime = value
  325. this.queryParam.beginDate = this.DateTime[0]&&this.DateTime[0]!==''?moment(this.DateTime[0]).format('YYYY-MM'):''
  326. this.queryParam.endDate = this.DateTime[1]&&this.DateTime[1]!==''?moment(this.DateTime[1]).format('YYYY-MM'):''
  327. this.mode2 = [mode[0] === 'date' ? 'month' : mode[0], mode[1] === 'date' ? 'month' : mode[1]];
  328. },
  329. searchQuery(){
  330. // this.spinning = true
  331. // this.toggleSearchStatus = false
  332. this.queryParam.pageNo = 1
  333. this.getTableList()
  334. },
  335. searchReset(){
  336. this.queryParam={
  337. beginDate:moment().subtract(1, 'months').format('YYYY-MM'),
  338. endDate:moment().subtract(1, 'months').format('YYYY-MM'),
  339. syHireType:['在职','退休返聘']
  340. }
  341. // this.spinning = true
  342. this.getTableList()
  343. },
  344. handleTableChange(pagination, filters, sorter) {
  345. this.queryParam.pageNo = pagination.current
  346. this.queryParam.pageSize = pagination.pageSize
  347. this.getTableList()
  348. },
  349. exportList(){
  350. this.spinning = true
  351. var param1 = Object.assign({}, this.queryParam)
  352. param1.syHireType = (param1.syHireType).toString()
  353. downFile('/salary/salaryManagement/exportXls3',param1).then(data => {
  354. console.log("================"+data)
  355. this.spinning = false
  356. if (!data) {
  357. this.$message.warning('文件下载失败')
  358. return
  359. }
  360. if (typeof window.navigator.msSaveBlob !== 'undefined') {
  361. window.navigator.msSaveBlob(new Blob([data], { type: 'application/vnd.ms-excel' }), '薪资统计' + '.xlsx')
  362. } else {
  363. let url = window.URL.createObjectURL(new Blob([data], { type: 'application/vnd.ms-excel' }))
  364. let link = document.createElement('a')
  365. link.style.display = 'none'
  366. link.href = url
  367. link.setAttribute('download', '薪资统计'+'.xlsx')
  368. document.body.appendChild(link)
  369. link.click()
  370. document.body.removeChild(link) // 下载完成移除元素
  371. window.URL.revokeObjectURL(url) // 释放掉blob对象
  372. }
  373. }).catch(
  374. error => {
  375. this.alertMsg(error.toString());
  376. }
  377. )
  378. },
  379. alertMsg(st){
  380. this.spinning = false
  381. this.$message.warning('文件导出失败,请联系系统管理员'+st)
  382. },
  383. showTotal(data) {
  384. return (
  385. <a-table
  386. ref="tableInfo"
  387. pagination={false}
  388. columns={this.columns}
  389. dataSource={this.totalDataSource || []}
  390. showHeader={false}
  391. scroll={{x:2000 }}
  392. ></a-table>
  393. )
  394. },
  395. }
  396. }
  397. </script>
  398. <style scoped lang="less">
  399. // @import '~@assets/less/common.less';
  400. /deep/ .ant-table-footer .ant-table-body {
  401. overflow-x: hidden !important;
  402. }
  403. /deep/.ant-table-footer{
  404. padding:0 !important;
  405. overflow: hidden !important;
  406. }
  407. /deep/.ant-table-fixed-left .ant-table-body-inner {
  408. margin-right: -22px !important;
  409. padding-right: 20px !important;
  410. }
  411. /deep/.ant-table-bordered .ant-table-thead > tr > th{
  412. min-width: 120px !important;
  413. }
  414. /deep/ .ant-table-bordered .ant-table-tbody > tr > td{
  415. min-width: 120px !important;
  416. }
  417. </style>