OvertimePayroll.vue 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235
  1. <template>
  2. <div class="reply" ref = "replyModal">
  3. <a-modal
  4. title="加班工资单"
  5. width="85%"
  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: 1000 ,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: 'OvertimePayroll',
  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:'5%',
  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. },
  87. {
  88. title: '姓名',
  89. align: "center",
  90. dataIndex: 'name',
  91. customRender: (t) => ellipsis(t,17),
  92. width:'10%'
  93. },
  94. // {
  95. // title: '编号',
  96. // align: "center",
  97. // dataIndex: 'code',
  98. // customRender: (t) => ellipsis(t,17),
  99. // width:'10%'
  100. // },
  101. {
  102. title: '加班工资',
  103. align: "center",
  104. dataIndex: 'workOvertimeCost',
  105. ellipsis: true,
  106. width:'10%'
  107. },
  108. {
  109. title: '个税',
  110. align: "center",
  111. dataIndex: 'personalTax',
  112. ellipsis: true,
  113. width:'10%'
  114. },
  115. {
  116. title: '实发合计',
  117. align: "center",
  118. dataIndex: 'actualOccurrence',
  119. customRender: (t) => ellipsis(t,10),
  120. width:'10%'
  121. },
  122. ]
  123. }
  124. },
  125. created(){
  126. },
  127. watch:{
  128. dataSource(){
  129. this.$nextTick(()=>{
  130. const dom = this.$refs.tableRef.$el.getElementsByClassName('ant-table-body')[0];
  131. dom.addEventListener(
  132. 'scroll',
  133. () => {
  134. this.$refs.tableInfo.$el.querySelectorAll(
  135. '.ant-table-body'
  136. )[0].scrollLeft = dom.scrollLeft
  137. },
  138. true
  139. )
  140. })
  141. }
  142. },
  143. computed: {
  144. // 合计展示
  145. totalDataSource(){
  146. var item = {
  147. "name":"合计"
  148. };
  149. var allNumber = 0
  150. var allPersonalTax = 0
  151. for (let row of this.dataSource){
  152. allNumber += row.actualOccurrence*1;
  153. allPersonalTax+=row.personalTax*1
  154. }
  155. item.actualOccurrence= parseFloat(allNumber.toFixed(2));
  156. item.personalTax = parseFloat(allPersonalTax.toFixed(2));
  157. return [item];
  158. }
  159. },
  160. methods: {
  161. handleCancel(){
  162. this.visible = false
  163. this.dataSource=[]
  164. this.formState={}
  165. },
  166. detail(id){
  167. this.formState = {}
  168. this.formState.id = id
  169. this.getTableList()
  170. },
  171. getTableList(){
  172. this.loading = true
  173. getAction('/salary/salaryManagement/querySalaryManagementWorkOvertimeListByMainId',this.formState).then(res=>{
  174. this.loading = false
  175. if(res.success){
  176. this.dataSource =res.result
  177. var all=0
  178. this.dataSource.map(item=>{
  179. item.actualOccurrence = Number(item.actualOccurrence).toFixed(2)
  180. })
  181. }else{
  182. this.$message.error(res.message);
  183. }
  184. })
  185. },
  186. searchSonList(){
  187. this.getTableList()
  188. },
  189. showTotal(data) {
  190. return (
  191. <a-table
  192. ref="tableInfo"
  193. pagination={false}
  194. columns={this.columns}
  195. dataSource={this.totalDataSource || []}
  196. showHeader={false}
  197. scroll={{x:1000 }}
  198. ></a-table>
  199. )
  200. },
  201. }
  202. }
  203. </script>
  204. <style scoped lang="less">
  205. /deep/ .nresume .ant-input{
  206. height: 100px !important;
  207. }
  208. /deep/ .ant-select{
  209. width: 100%;
  210. }
  211. .form-table-heard:before {
  212. content: '*';
  213. color: red;
  214. }
  215. /deep/ .ant-calendar-picker{
  216. width: 113px !important;
  217. }
  218. /deep/ .ant-table-footer .ant-table-body {
  219. overflow-x: hidden !important;
  220. }
  221. /deep/.ant-table-footer{
  222. padding:0 !important;
  223. overflow: hidden !important;
  224. }
  225. /deep/.ant-table-fixed-left .ant-table-body-inner {
  226. margin-right: -28px !important;
  227. padding-right: 20px !important;
  228. }
  229. </style>