PayrollDetail.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370
  1. <template>
  2. <div class="reply" ref = "replyModal">
  3. <a-modal
  4. title="月度工资单"
  5. width="100%"
  6. :visible="visible"
  7. :confirmLoading="loading"
  8. :getContainer ='()=>$refs.replyModal'
  9. @cancel="handleCancel"
  10. destroyOnClose
  11. >
  12. <template #footer>
  13. <a-button @click="handleCancel" style="margin-left: 8px;">取消</a-button>
  14. </template>
  15. <div class="table-page-search-wrapper">
  16. <a-form-model layout="inline" ref="form" :model="formState" >
  17. <a-row :gutter="24">
  18. <a-col :md="6" :sm="8">
  19. <a-form-model-item label="姓名" >
  20. <j-search-select-tag v-model="formState.name" placeholder="请选择名称"
  21. dict="sys_user,realname,realname" allowClear/>
  22. </a-form-model-item>
  23. </a-col>
  24. <!-- <a-col :xl="6" :lg="7" :md="8" :sm="24">
  25. <a-form-item label="部门">
  26. <j-search-select-tag v-model="formState.sysOrgCode" placeholder="请选择部门"
  27. dict="sys_depart,depart_name,depart_name,org_type='3' or org_code='TBD' order by org_code"/>
  28. </a-form-item> -->
  29. <!-- </a-col> -->
  30. <a-col :md="6" :sm="8">
  31. <a-form-model-item label="" >
  32. <a-button type="primary" icon="search" @click="searchSonList">查询</a-button>
  33. </a-form-model-item>
  34. </a-col>
  35. </a-row>
  36. </a-form-model>
  37. <a-table
  38. ref="tableRef"
  39. bordered
  40. :columns="columns"
  41. :data-source="dataSource"
  42. :loading="loading"
  43. :scroll="{x: 2000 ,y:400}"
  44. :pagination="false"
  45. :footer="showTotal"
  46. >
  47. </a-table>
  48. </div>
  49. </a-modal>
  50. </div>
  51. </template>
  52. <script>
  53. import moment from 'moment'
  54. import pick from 'lodash.pick'
  55. import { FormTypes } from '@/utils/JEditableTableUtil'
  56. import { putAction,getAction } from '@/api/manage'
  57. import JSearchSelectTag from '@/components/dict/JSearchSelectTag'
  58. import JEllipsis from '@/components/jeecg/JEllipsis'
  59. export default {
  60. name: 'PayrollDetail',
  61. components: {
  62. moment,
  63. JSearchSelectTag,
  64. JEllipsis
  65. },
  66. data() {
  67. let ellipsis = (v, l) => <j-ellipsis value={v} length={l} />
  68. return {
  69. formState:{},
  70. dataSource: [{}],
  71. visible:false,
  72. loading:false,
  73. columns: [
  74. {
  75. title: '序号',
  76. align:"center",
  77. width:90,
  78. dataIndex: 'index',
  79. customRender:function (t, record, index) {
  80. if(record.name=='合计'){
  81. return ''
  82. }else{
  83. return parseInt(index)+1;
  84. }
  85. },
  86. fixed:'left'
  87. },
  88. {
  89. title: '姓名',
  90. align: "center",
  91. dataIndex: 'name',
  92. ellipsis: true,
  93. width:120,
  94. fixed:'left'
  95. },
  96. {
  97. title: '基本薪资',
  98. align: "center",
  99. dataIndex: 'wages',
  100. width:110,
  101. fixed:'left'
  102. },
  103. // {
  104. // title: '编号',
  105. // align: "center",
  106. // dataIndex: 'code',
  107. // ellipsis: true,
  108. // customRender: (t) => ellipsis(t,17),
  109. // width:120,
  110. // },
  111. {
  112. title: '话费补贴',
  113. align: "center",
  114. dataIndex: 'phoneBill',
  115. ellipsis: true,
  116. // width:110
  117. },
  118. {
  119. title: '午餐补贴',
  120. align: "center",
  121. dataIndex: 'lunch',
  122. ellipsis: true,
  123. width:110
  124. },
  125. {
  126. title: '住房补贴',
  127. align: "center",
  128. dataIndex: 'housingSubsidies',
  129. ellipsis: true,
  130. width:110
  131. },
  132. {
  133. title: '交通补贴',
  134. align: "center",
  135. dataIndex: 'transportation',
  136. ellipsis: true,
  137. width:110
  138. },
  139. {
  140. title: '全勤奖',
  141. align: "center",
  142. dataIndex: 'fullAttendance',
  143. ellipsis: true,
  144. width:100
  145. },
  146. {
  147. title: '社保',
  148. align: "center",
  149. dataIndex: 'socialSecurity',
  150. ellipsis: true,
  151. width:100
  152. },
  153. {
  154. title: '公积金',
  155. align: "center",
  156. dataIndex: 'accumulationFund',
  157. ellipsis: true,
  158. width:100
  159. },
  160. {
  161. title: '迟到',
  162. align: "center",
  163. dataIndex: 'latenessCost',
  164. ellipsis: true,
  165. width:100
  166. },
  167. {
  168. title: '事假',
  169. align: "center",
  170. dataIndex: 'personalCost',
  171. ellipsis: true,
  172. width:100
  173. },
  174. {
  175. title: '病假',
  176. align: "center",
  177. dataIndex: 'sickCost',
  178. ellipsis: true,
  179. width:100
  180. },
  181. {
  182. title: '婚假',
  183. align: "center",
  184. dataIndex: 'marriageCost',
  185. ellipsis: true,
  186. width:100
  187. },
  188. {
  189. title: '丧假',
  190. align: "center",
  191. dataIndex: 'funeralCost',
  192. ellipsis: true,
  193. width:100
  194. },
  195. {
  196. title: '合计应发',
  197. align: "center",
  198. dataIndex: 'totalPayable',
  199. ellipsis: true,
  200. width:110,
  201. fixed:'right'
  202. },
  203. {
  204. title: '个税',
  205. align: "center",
  206. dataIndex: 'personalTax',
  207. ellipsis: true,
  208. width:100,
  209. fixed:'right'
  210. },
  211. {
  212. title: '合计应扣',
  213. align: "center",
  214. dataIndex: 'totalDeduction',
  215. ellipsis: true,
  216. width:110,
  217. fixed:'right'
  218. },
  219. {
  220. title: '实发合计',
  221. align: "center",
  222. dataIndex: 'actualOccurrence',
  223. ellipsis: true,
  224. width:110,
  225. fixed:'right'
  226. },
  227. ]
  228. }
  229. },
  230. created(){
  231. },
  232. watch:{
  233. dataSource(){
  234. this.$nextTick(()=>{
  235. const dom = this.$refs.tableRef.$el.getElementsByClassName('ant-table-body')[0];
  236. dom.addEventListener(
  237. 'scroll',
  238. () => {
  239. this.$refs.tableInfo.$el.querySelectorAll(
  240. '.ant-table-body'
  241. )[0].scrollLeft = dom.scrollLeft
  242. },
  243. true
  244. )
  245. })
  246. }
  247. },
  248. computed: {
  249. // 合计展示
  250. totalDataSource(){
  251. var item = {
  252. "name":"合计"
  253. };
  254. var allNumber = 0
  255. var allWages = 0
  256. var allPersonalTax = 0
  257. var allTotalPayable = 0
  258. var allTotalDeduction = 0
  259. var allPhoneBill = 0
  260. var allLunch = 0
  261. var allHousingSubsidies = 0
  262. var allTransportation = 0
  263. var allFullAttendance = 0
  264. var allSocialSecurity = 0
  265. var allAccumulationFund = 0
  266. var allLatenessCost = 0
  267. var allPersonalCost = 0
  268. var allSickCost = 0
  269. var allMarriageCost = 0
  270. var allFuneralCost = 0
  271. for (let row of this.dataSource){
  272. allNumber += row.actualOccurrence*1;
  273. allWages +=Number(row.wages);
  274. allPersonalTax+=Number(row.personalTax);
  275. allTotalPayable+=Number(row.totalPayable);
  276. allTotalDeduction+=Number(row.totalDeduction);
  277. allPhoneBill+=Number(row.phoneBill);
  278. allLunch+=Number(row.lunch);
  279. allHousingSubsidies+=Number(row.housingSubsidies);
  280. allTransportation+=Number(row.transportation);
  281. allFullAttendance+=Number(row.fullAttendance);
  282. allSocialSecurity+=Number(row.socialSecurity);
  283. allAccumulationFund+=Number(row.accumulationFund);
  284. allLatenessCost+=Number(row.latenessCost);
  285. allPersonalCost+=Number(row.personalCost);
  286. allSickCost+=Number(row.sickCost);
  287. allMarriageCost+=Number(row.marriageCost);
  288. allFuneralCost+=Number(row.funeralCost);
  289. }
  290. item.actualOccurrence= parseFloat(allNumber.toFixed(2));
  291. item.wages = parseFloat(allWages.toFixed(2));
  292. item.personalTax = parseFloat(allPersonalTax.toFixed(2));
  293. item.totalPayable = parseFloat(allTotalPayable.toFixed(2));
  294. item.totalDeduction = parseFloat(allTotalDeduction.toFixed(2));
  295. item.phoneBill = parseFloat(allPhoneBill.toFixed(2));
  296. item.lunch = parseFloat(allLunch.toFixed(2));
  297. item.housingSubsidies = parseFloat(allHousingSubsidies.toFixed(2));
  298. item.transportation = parseFloat(allTransportation.toFixed(2));
  299. item.fullAttendance = parseFloat(allFullAttendance.toFixed(2));
  300. item.socialSecurity = parseFloat(allSocialSecurity.toFixed(2));
  301. item.accumulationFund = parseFloat(allAccumulationFund.toFixed(2));
  302. item.latenessCost = parseFloat(allLatenessCost.toFixed(2));
  303. item.personalCost = parseFloat(allPersonalCost.toFixed(2));
  304. item.sickCost = parseFloat(allSickCost.toFixed(2));
  305. item.marriageCost = parseFloat(allMarriageCost.toFixed(2));
  306. item.funeralCost = parseFloat(allFuneralCost.toFixed(2));
  307. return [item];
  308. }
  309. },
  310. methods: {
  311. handleCancel(){
  312. this.visible = false
  313. this.formState = {}
  314. },
  315. detail(id){
  316. this.formState = {}
  317. this.formState.id = id
  318. this.getTableList()
  319. },
  320. getTableList(){
  321. this.loading = true
  322. getAction('/salary/salaryManagement/querySalaryManagementDetailByMainId',this.formState).then(res=>{
  323. this.loading = false
  324. if(res.success){
  325. this.dataSource =res.result
  326. }else{
  327. this.$message.error(res.message);
  328. }
  329. })
  330. },
  331. searchSonList(){
  332. this.getTableList()
  333. },
  334. showTotal(data) {
  335. return (
  336. <a-table
  337. ref="tableInfo"
  338. pagination={false}
  339. columns={this.columns}
  340. dataSource={this.totalDataSource || []}
  341. showHeader={false}
  342. scroll={{x:2000 ,y:400}}
  343. ></a-table>
  344. )
  345. },
  346. }
  347. }
  348. </script>
  349. <style scoped lang="less">
  350. /deep/ .nresume .ant-input{
  351. height: 100px !important;
  352. }
  353. /deep/ .ant-table-footer .ant-table-body {
  354. overflow-x: hidden !important;
  355. }
  356. /deep/.ant-table-footer{
  357. padding:0 !important;
  358. overflow: hidden !important;
  359. }
  360. /deep/.ant-table-fixed-left .ant-table-body-inner {
  361. margin-right: -28px !important;
  362. padding-right: 20px !important;
  363. }
  364. </style>