Payroll.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419
  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-select v-model="queryParam.orgName">
  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-option value="马菲羊">马菲羊</a-select-option>
  15. </a-select>
  16. </a-form-item>
  17. </a-col>
  18. <a-col :xl="6" :lg="7" :md="8" :sm="24">
  19. <a-form-item label="年度">
  20. <a-date-picker placeholder="请选择" :allowClear="true" :open="isopen" mode="year" format="YYYY" v-model="yearWith"
  21. @openChange="changeopen" @panelChange="handlePanelChange1" @change="onChange" style="width:100% !important"/>
  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-month-picker placeholder="请选择" :allowClear="false" v-model="yearWithMonth" @change="onChange" style="width:100% !important"/> -->
  27. <a-range-picker
  28. style="width: 100% !important"
  29. v-model="DateTime"
  30. format="YYYY-MM"
  31. valueFormat="YYYY-MM"
  32. :mode="mode2"
  33. :open="open"
  34. :placeholder="['开始时间', '结束时间']"
  35. @panelChange="handlePanelChange2"
  36. @openChange="onDateChange"
  37. @change="changeData"
  38. />
  39. </a-form-item>
  40. </a-col>
  41. <a-col :xl="6" :lg="7" :md="8" :sm="24">
  42. <a-form-item label="类型">
  43. <a-select v-model="queryParam.type">
  44. <a-select-option value="">所有</a-select-option>
  45. <a-select-option value="加班工资单">加班工资单</a-select-option>
  46. <a-select-option value="年休工资单">年休工资单</a-select-option>
  47. <a-select-option value="月度工资单">月度工资单</a-select-option>
  48. <a-select-option value="福利现金">福利现金</a-select-option>
  49. <a-select-option value="年终奖">年终奖</a-select-option>
  50. </a-select>
  51. </a-form-item>
  52. </a-col>
  53. <a-col :xl="6" :lg="7" :md="8" :sm="24">
  54. <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
  55. <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
  56. <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
  57. </span>
  58. </a-col>
  59. </a-row>
  60. </a-form>
  61. </div>
  62. <!-- 操作按钮区域 -->
  63. <div class="table-operator">
  64. <a-button @click="createPayroll" type="primary" icon="plus">生成工资单</a-button>
  65. <a-button @click="addPayroll" type="primary" icon="plus">导入</a-button>
  66. <!-- <a-button @click="daochu" type="primary" icon="plus">导出明细</a-button> -->
  67. </div>
  68. <div>
  69. <a-table
  70. ref="table"
  71. size="middle"
  72. bordered
  73. rowKey="id"
  74. :columns="columns"
  75. :dataSource="dataSource"
  76. :pagination="ipagination"
  77. :scroll="{x: 1000}"
  78. :loading="loading"
  79. @change="handleTableChange">
  80. <span slot="operation" slot-scope="text, record">
  81. <a @click="handleDetail(record)" >查看详情</a>
  82. <a-divider type="vertical" />
  83. <a @click="handleDownload(record)" >下载</a>
  84. <a-divider type="vertical" />
  85. <a @click="handleExport(record)" >导出</a>
  86. </span>
  87. </a-table>
  88. </div>
  89. <!-- table区域-end -->
  90. <!-- 表单区域 -->
  91. <PayrollDetail ref="PayrollDetail"></PayrollDetail>
  92. <AnnualLeavePayroll ref="AnnualLeavePayroll"></AnnualLeavePayroll>
  93. <OvertimePayroll ref="OvertimePayroll"></OvertimePayroll>
  94. <uploadModal ref="uploadModal" @ok="searchQuery"></uploadModal>
  95. <uploadPayroll ref="uploadPayroll" @ok="searchQuery"></uploadPayroll>
  96. <YearEndBonusPayroll ref="YearEndBonusPayroll" @ok="searchQuery"></YearEndBonusPayroll>
  97. </a-spin>
  98. </a-card>
  99. </template>
  100. <script>
  101. import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  102. import { getAction,downFile } from '@/api/manage'
  103. import moment from 'moment'
  104. import PayrollDetail from './modules/PayrollDetail.vue'
  105. import AnnualLeavePayroll from './modules/AnnualLeavePayroll.vue'
  106. import OvertimePayroll from './modules/OvertimePayroll.vue'
  107. import uploadModal from './modules/uploadModal.vue'
  108. import uploadPayroll from './modules/uploadPayroll.vue'
  109. import YearEndBonusPayroll from './modules/YearEndBonusPayroll.vue'
  110. import JSearchSelectTag from '@/components/dict/JSearchSelectTag'
  111. export default {
  112. name: "Payroll",
  113. mixins: [JeecgListMixin],
  114. components: {
  115. moment,
  116. PayrollDetail,
  117. JSearchSelectTag,
  118. uploadModal,
  119. uploadPayroll,
  120. AnnualLeavePayroll,
  121. OvertimePayroll,
  122. YearEndBonusPayroll
  123. },
  124. data () {
  125. return {
  126. description: '工资单列表',
  127. yearWith:'',
  128. mode2: ['month', 'month'],
  129. DateTime:[],
  130. spinning:false,
  131. open:false,
  132. isopen:false,
  133. // 表头
  134. columns: [
  135. {
  136. title: '序号',
  137. width: 80,
  138. align:"center",
  139. dataIndex: 'index',
  140. customRender:function (t, r, index) {
  141. return parseInt(index)+1;
  142. }
  143. },
  144. {
  145. title: '月份',
  146. align:"center",
  147. dataIndex: 'yearWithMonth',
  148. // customRender:function (t, r, index) {
  149. // if(r.type == '年休工资单'){
  150. // return t + "-12";
  151. // }else{
  152. // return t;
  153. // }
  154. // }
  155. },
  156. {
  157. title: '类型',
  158. align:"center",
  159. dataIndex: 'type'
  160. },
  161. {
  162. title: '组织',
  163. align:"center",
  164. dataIndex: 'orgName'
  165. },
  166. {
  167. title: '发放人数',
  168. align:"center",
  169. dataIndex: 'numberPeople'
  170. },
  171. {
  172. title: '发放薪水',
  173. align:"center",
  174. dataIndex: 'salary'
  175. },
  176. {
  177. title: '缴纳个税',
  178. align:"center",
  179. dataIndex: 'personalTax'
  180. },
  181. {
  182. title: '生成时间',
  183. align:"center",
  184. dataIndex: 'generationTime'
  185. },
  186. {
  187. title: '版本',
  188. align:"center",
  189. dataIndex: 'version'
  190. },
  191. {
  192. title: '操作',
  193. align:"center",
  194. dataIndex: 'operation',
  195. width: 200,
  196. scopedSlots: { customRender: 'operation' }
  197. },
  198. ],
  199. queryParam:{},
  200. dataSource:[],
  201. // 请求参数
  202. // url: {
  203. // },
  204. }
  205. },
  206. computed: {},
  207. created () {
  208. this.getTableList()
  209. },
  210. methods: {
  211. searchQuery(){
  212. this.queryParam.pageNo = 1
  213. this.getTableList()
  214. },
  215. searchReset(){
  216. this.queryParam={}
  217. this.DateTime = []
  218. this.getTableList()
  219. },
  220. getTableList(){
  221. this.loading = true
  222. getAction('/salary/salaryManagement/list',this.queryParam).then(res=>{
  223. if(res.success){
  224. this.loading = false
  225. this.dataSource =res.result.records
  226. this.dataSource.map(item=>item.version=item.version?item.version+'.0':'')
  227. this.ipagination = {
  228. total: res.result.total,
  229. current: res.result.current,
  230. pageSize: res.result.size
  231. }
  232. }else{
  233. this.$message.error(res.message);
  234. }
  235. })
  236. },
  237. createPayroll(){
  238. this.$refs.uploadModal.visible = true
  239. },
  240. addPayroll(){
  241. this.$refs.uploadPayroll.visible = true
  242. },
  243. handleDetail(record){
  244. if(record.type=='加班工资单'){
  245. this.$refs.OvertimePayroll.visible = true
  246. this.$refs.OvertimePayroll.detail(record.id)
  247. }else if(record.type=='年休工资单'){
  248. this.$refs.AnnualLeavePayroll.visible = true
  249. this.$refs.AnnualLeavePayroll.detail(record.id)
  250. }else if(record.type=='月度工资单'){
  251. this.$refs.PayrollDetail.visible = true
  252. this.$refs.PayrollDetail.detail(record.id,)
  253. }else if(record.type=='福利现金'||record.type=='年终奖'){
  254. this.$refs.YearEndBonusPayroll.visible = true
  255. this.$refs.YearEndBonusPayroll.detail(record.id,record.type)
  256. }
  257. },
  258. alertMsg(st){
  259. this.spinning = false
  260. this.$message.warning('执行失败,请联系系统管理员'+st)
  261. },
  262. // tempChange(){
  263. // // console.log("=====================执行开始-五月考勤 - 森语");
  264. // // let par = {"excelName":"五月考勤 - 马菲羊","month":"2024-05"}
  265. // // let par = {"excelName":"五月考勤 - 正织","month":"2024-05"}
  266. // // let par = {"excelName":"五月考勤 - 森语","month":"2024-05"}
  267. // // getAction('/salary/salaryManagement/tempChange',par).then(res=>{
  268. // // console.log("=====================执行结束");
  269. // // })
  270. // },
  271. daochu(){
  272. this.spinning = true
  273. downFile('/salary/salaryManagement/exportXls99',{}).then(data => {
  274. this.spinning = false
  275. if (!data) {
  276. this.$message.warning('文件下载失败')
  277. return
  278. }
  279. if (typeof window.navigator.msSaveBlob !== 'undefined') {
  280. window.navigator.msSaveBlob(new Blob([data], { type: 'application/vnd.ms-excel' }), record.type + '.xlsx')
  281. } else {
  282. let url = window.URL.createObjectURL(new Blob([data], { type: 'application/vnd.ms-excel' }))
  283. let link = document.createElement('a')
  284. link.style.display = 'none'
  285. link.href = url
  286. link.setAttribute('download', '明细.xlsx')
  287. document.body.appendChild(link)
  288. link.click()
  289. document.body.removeChild(link) // 下载完成移除元素
  290. window.URL.revokeObjectURL(url) // 释放掉blob对象
  291. }
  292. }).catch(
  293. error => {
  294. this.alertMsg(error.toString());
  295. }
  296. )
  297. },
  298. handleDownload(record){
  299. this.spinning = true
  300. var titleFlie = moment(record.yearWithMonth).format('YYYY年MM月')
  301. titleFlie =titleFlie+record.orgName+record.type
  302. downFile('/salary/salaryManagement/exportXls',{id:record.id,type:record.type}).then(data => {
  303. this.spinning = false
  304. if (!data) {
  305. this.$message.warning('文件下载失败')
  306. return
  307. }
  308. if (typeof window.navigator.msSaveBlob !== 'undefined') {
  309. window.navigator.msSaveBlob(new Blob([data], { type: 'application/vnd.ms-excel' }), titleFlie + '.xlsx')
  310. } else {
  311. let url = window.URL.createObjectURL(new Blob([data], { type: 'application/vnd.ms-excel' }))
  312. let link = document.createElement('a')
  313. link.style.display = 'none'
  314. link.href = url
  315. link.setAttribute('download', titleFlie+'.xlsx')
  316. document.body.appendChild(link)
  317. link.click()
  318. document.body.removeChild(link) // 下载完成移除元素
  319. window.URL.revokeObjectURL(url) // 释放掉blob对象
  320. }
  321. }).catch(
  322. error => {
  323. this.alertMsg(error.toString());
  324. }
  325. )
  326. },
  327. handleExport(record){
  328. this.spinning = true
  329. downFile('/salary/salaryManagement/exportXls2',{id:record.id,type:record.type}).then(data => {
  330. this.spinning = false
  331. if (!data) {
  332. this.$message.warning('文件下载失败')
  333. return
  334. }
  335. if (typeof window.navigator.msSaveBlob !== 'undefined') {
  336. window.navigator.msSaveBlob(new Blob([data], { type: 'application/vnd.ms-excel' }), record.type + '.xls')
  337. } else {
  338. let url = window.URL.createObjectURL(new Blob([data], { type: 'application/vnd.ms-excel' }))
  339. let link = document.createElement('a')
  340. link.style.display = 'none'
  341. link.href = url
  342. link.setAttribute('download', record.orgName+record.yearWithMonth+record.type+'.xls')
  343. document.body.appendChild(link)
  344. link.click()
  345. document.body.removeChild(link) // 下载完成移除元素
  346. window.URL.revokeObjectURL(url) // 释放掉blob对象
  347. }
  348. }).catch(
  349. error => {
  350. this.alertMsg(error.toString());
  351. }
  352. )
  353. },
  354. handleTableChange(pagination, filters, sorter) {
  355. this.queryParam.pageNo = pagination.current
  356. this.queryParam.pageSize = pagination.pageSize
  357. this.getTableList()
  358. },
  359. handlePanelChange2(value,mode){
  360. if (this.DateTime[1] && this.DateTime[1]._d != value[1]._d) {
  361. this.open = false;
  362. }
  363. this.DateTime = value
  364. this.queryParam.yearWithMonth_begin = this.DateTime[0]&&this.DateTime[0]!==''?moment(this.DateTime[0]).format('YYYY-MM'):''
  365. this.queryParam.yearWithMonth_end = this.DateTime[1]&&this.DateTime[1]!==''?moment(this.DateTime[1]).format('YYYY-MM'):''
  366. this.mode2 = [mode[0] === 'date' ? 'month' : mode[0], mode[1] === 'date' ? 'month' : mode[1]];
  367. },
  368. onDateChange(status) {
  369. if(status){
  370. this.open = true;
  371. }else{
  372. this.open = false
  373. }
  374. },
  375. changeData(value){
  376. if(value == null || value.length == 0){
  377. this.queryParam.yearWithMonth_begin = ''
  378. this.queryParam.yearWithMonth_end = ''
  379. }
  380. this.DateTime = value
  381. },
  382. handlePanelChange1(value){
  383. this.isopen = false
  384. this.yearWith = value
  385. this.queryParam.yearWith = this.yearWith?moment(this.yearWith).format('YYYY'):''
  386. },
  387. changeopen(status){
  388. if(status){
  389. this.isopen = true
  390. }
  391. },
  392. onChange(data){
  393. // if(data == null || data == ''){
  394. // this.yearWithMonth = ''
  395. // this.queryParam.yearWithMonth = ''
  396. // }
  397. this.yearWith = data
  398. this.queryParam.yearWith = this.yearWith?moment(this.yearWith).format('YYYY'):''
  399. }
  400. }
  401. }
  402. </script>
  403. <style scoped>
  404. @import '~@assets/less/common.less'
  405. </style>