index.vue 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328
  1. <template>
  2. <div>
  3. <el-container>
  4. <!-- 左侧树形结构 -->
  5. <!-- <el-scrollbar max-height="80vh">
  6. <el-aside width="280px">
  7. <div class="JKWTree-tree">
  8. <h3>计件员工加班费核查</h3>
  9. <el-tree
  10. :data="treeData"
  11. :props="defaultProps"
  12. highlight-current="true"
  13. @node-click="handleNodeClick"
  14. />
  15. </div>
  16. </el-aside>
  17. </el-scrollbar> -->
  18. <layout-sider
  19. :resize-directions="['right']"
  20. :width="220"
  21. style="margin-right: 10px;"
  22. >
  23. <div
  24. class="JKWTree-tree"
  25. style="height: 70vh;"
  26. >
  27. <h3>计件员工加班费核查</h3>
  28. <el-tree
  29. :data="treeData"
  30. highlight-current
  31. @node-click="handleNodeClick"
  32. />
  33. </div>
  34. </layout-sider>
  35. <el-container>
  36. <el-main>
  37. <div class="gva-table-box">
  38. <div class="gva-btn-list">
  39. <el-row :span="6">
  40. <el-input
  41. v-model="searchInfo"
  42. placeholder="输入员工编号或姓名"
  43. @keyup.enter="onSearch()"
  44. />
  45. </el-row>
  46. <!-- 按钮区域 -->
  47. <el-button
  48. type="primary"
  49. :icon="Search"
  50. @click="onSearch"
  51. >搜索
  52. </el-button>
  53. <el-button
  54. type="primary"
  55. :icon="Refresh"
  56. >重置
  57. </el-button>
  58. <div style="margin-left: auto;">
  59. <el-button
  60. type="primary"
  61. :icon="Download"
  62. @click="exportExcel"
  63. >导出到Excel
  64. </el-button>
  65. </div>
  66. </div>
  67. <!-- 上半数据展示 -->
  68. <el-table
  69. ref="tab1"
  70. style="width: 100%;height:30vh;"
  71. tooltip-effect="dark"
  72. :data="tableData1"
  73. row-key="ID"
  74. highlight-current-row
  75. border
  76. :row-style="{ height: '20px' }"
  77. :cell-style="{ padding: '0px' }"
  78. :header-row-style="{ height: '20px' }"
  79. :header-cell-style="{ padding: '0px' }"
  80. @cell-dblclick="handleDblclick1"
  81. @selection-change="handleSelectionChange"
  82. >
  83. <el-table-column
  84. type="selection"
  85. width="55"
  86. />
  87. <!-- 使用 v-for 循环渲染每一列 -->
  88. <el-table-column
  89. v-for="column in tableCols1"
  90. :key="column.prop"
  91. :prop="column.prop"
  92. :label="column.label"
  93. :width="column.width"
  94. show-overflow-tooltip="true"
  95. sortable
  96. />
  97. // 下半数据展示
  98. </el-table>
  99. <br>
  100. <el-table
  101. ref="tab2"
  102. style="width: 100%;height: 40vh;"
  103. tooltip-effect="dark"
  104. :data="tableData2"
  105. row-key="ID"
  106. highlight-current-row
  107. border
  108. :row-style="{ height: '20px' }"
  109. :cell-style="{ padding: '0px' }"
  110. :header-row-style="{ height: '20px' }"
  111. :header-cell-style="{ padding: '0px' }"
  112. @selection-change="handleSelectionChange"
  113. >
  114. <el-table-column
  115. type="selection"
  116. width="55"
  117. />
  118. <!-- 使用 v-for 循环渲染每一列 -->
  119. <el-table-column
  120. v-for="column in tableCols2"
  121. :key="column.prop"
  122. :prop="column.prop"
  123. :label="column.label"
  124. :width="column.width"
  125. show-overflow-tooltip="true"
  126. sortable
  127. />
  128. </el-table>
  129. </div>
  130. </el-main>
  131. </el-container>
  132. </el-container>
  133. </div>
  134. </template>
  135. <script setup>
  136. // 全量引入格式化工具 请按需保留
  137. import { Download, Refresh, Search } from '@element-plus/icons-vue'
  138. import { reactive, ref } from 'vue'
  139. import { getDownData, getSide, getUpData } from '@/api/mes_api_gty/overTimePayVerification'
  140. import { Layout, LayoutContent, LayoutHeader, LayoutSider } from '@arco-design/web-vue'
  141. defineOptions({
  142. name: '06PackingDocuments',
  143. })
  144. // 侧边栏数据请求
  145. const treeData = reactive([])
  146. const getSideData = async() => {
  147. try {
  148. const res = await getSide()
  149. if (res.code === 0) {
  150. treeData.splice(0, treeData.length, ...res.data)
  151. }
  152. } catch (e) {
  153. console.log(e)
  154. }
  155. }
  156. getSideData()
  157. // =========== 表格控制部分 ===========
  158. const tableCols1 = [
  159. { label: '员工编号', prop: 'bh', width: '100' },
  160. { label: '员工姓名', prop: '员工姓名', width: '100' },
  161. { label: '工资表类别', prop: '工资表类别', width: '150' },
  162. { label: '聘用日期', prop: '聘用日期', width: '150' },
  163. { label: '法定天数', prop: '法定天数', width: '100' },
  164. { label: '当月定额', prop: '当月定额', width: '100' },
  165. { label: '月度合计产量', prop: '月度合计产量', width: '150' },
  166. { label: '个人计件工资', prop: '个人计件工资', width: '150' },
  167. { label: '个人加班工资', prop: '个人加班工资', width: '150' },
  168. { label: '月计时时数', prop: '月计时时数', width: '150' },
  169. { label: '计时补差', prop: '计时补差', width: '150' },
  170. ]
  171. const tableCols2 = [
  172. { label: '日期', prop: 'sczl_rq', width: '100' },
  173. { label: '工单编号', prop: 'sczl_gdbh', width: '100' },
  174. { label: '成品名称', prop: 'Gd_cpmc', width: '300' },
  175. { label: '印件及工序', prop: 'sczl_type', width: '300' },
  176. { label: '车头产量', prop: '班组车头产量', width: '100' },
  177. { label: '机台编号', prop: 'sczl_jtbh', width: '100' },
  178. { label: '产量系数', prop: '产量系数', width: '100' },
  179. { label: '计件产量', prop: '计件产量', width: '100' },
  180. { label: '补产产量', prop: '补产产量', width: '100' },
  181. { label: '核算产量', prop: '核算产量', width: '100' },
  182. { label: '日定额', prop: '日定额', width: '100' },
  183. { label: '达标定额', prop: '达标定额', width: '100' },
  184. { label: '千件工价', prop: '千件工价', width: '100' },
  185. { label: '补产标准', prop: '补产标准', width: '100' },
  186. { label: '个人计件工资', prop: '个人计件工资', width: '120' },
  187. { label: '个人加班工资', prop: '个人加班工资', width: '120' },
  188. { label: '个人比例', prop: '个人比例', width: '100' },
  189. { label: '装版工时', prop: '装版工时', width: '100' },
  190. { label: '保养工时', prop: '保养工时', width: '100' },
  191. { label: '打样工时', prop: '打样工时', width: '100' },
  192. { label: '分摊计时', prop: '分摊计时', width: '100' },
  193. { label: '计时补差', prop: '计时补差', width: '100' },
  194. ]
  195. const tableData1 = reactive([])
  196. const tableData2 = reactive([])
  197. let originData = []
  198. const searchInfo = ref('')
  199. const params = {
  200. date: '',
  201. department: '',
  202. code: '',
  203. }
  204. const handleNodeClick = async(node, check) => {
  205. if (!node.children) {
  206. const val = {
  207. date: node.gdbh,
  208. department: node.label.slice(0, node.label.indexOf('(')),
  209. }
  210. params.date = val.date
  211. params.department = val.department
  212. const res = await getUpData(val)
  213. if (res.code === 0) {
  214. const data = res.data
  215. let totalPersonalPieceWage = 0
  216. let totalOvertimeWage = 0
  217. data.forEach(employee => {
  218. const personalPieceWage = parseFloat(employee['个人计件工资']) || 0
  219. const overtimeWage = parseFloat(employee['个人加班工资']) || 0
  220. totalPersonalPieceWage += personalPieceWage
  221. totalOvertimeWage += overtimeWage
  222. })
  223. data.push({
  224. '员工姓名': '合计',
  225. '个人计件工资': totalPersonalPieceWage.toFixed(2),
  226. '个人加班工资': totalOvertimeWage.toFixed(2),
  227. })
  228. tableData1.splice(0, tableData1.length, ...data)
  229. originData = [...tableData1]
  230. }
  231. }
  232. }
  233. const handleDblclick1 = async(row) => {
  234. params.code = row.bh
  235. const { date, code } = params
  236. const res = await getDownData({ date, code })
  237. if (res.code === 0) {
  238. const data = res.data
  239. let totalPersonalPieceWage = 0
  240. let totalOvertimeWage = 0
  241. data.forEach(employee => {
  242. const personalPieceWage = parseFloat(employee['个人计件工资']) || 0
  243. const overtimeWage = parseFloat(employee['个人加班工资']) || 0
  244. totalPersonalPieceWage += personalPieceWage
  245. totalOvertimeWage += overtimeWage
  246. })
  247. data.push({
  248. 'Gd_cpmc': '合计',
  249. '个人计件工资': totalPersonalPieceWage.toFixed(2),
  250. '个人加班工资': totalOvertimeWage.toFixed(2),
  251. })
  252. tableData2.splice(0, tableData2.length, ...data)
  253. }
  254. }
  255. // 搜索
  256. const onSearch = () => {
  257. if (searchInfo.value === '') {
  258. tableData1.splice(0, tableData1.length, ...originData)
  259. return
  260. }
  261. const val = originData.filter(item => {
  262. const bh = item.bh
  263. const name = item.员工姓名
  264. return (bh?.match(searchInfo.value) || name?.match(searchInfo.value))
  265. })
  266. tableData1.splice(0, tableData1.length, ...val)
  267. }
  268. // 导出excel
  269. function exportExcel() {
  270. console.log('导出到excel')
  271. }
  272. </script>
  273. <style scoped>
  274. .JKWTree-container {
  275. display: flex;
  276. }
  277. .JKWTree-tree {
  278. width: 300px;
  279. background-color: #fff;
  280. padding: 10px;
  281. margin-right: 20px;
  282. }
  283. .JKWTree-tree h3 {
  284. font-size: 15px;
  285. font-weight: 700;
  286. margin: 10px 0;
  287. }
  288. .JKWTree-content {
  289. flex: 1;
  290. }
  291. /* 选中某行时的背景色 */
  292. :deep(.el-table__body tr.current-row) > td {
  293. background: #ff80ff !important;
  294. }
  295. :deep(.el-table td .cell) {
  296. line-height: 30px !important;
  297. }
  298. </style>