index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355
  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. @row-click="clickybupdate"
  82. @selection-change="handleSelectionChange"
  83. >
  84. <el-table-column
  85. type="selection"
  86. width="55"
  87. />
  88. <!-- 使用 v-for 循环渲染每一列 -->
  89. <el-table-column
  90. v-for="column in tableCols1"
  91. :key="column.prop"
  92. :prop="column.prop"
  93. :label="column.label"
  94. :width="column.width"
  95. show-overflow-tooltip="true"
  96. sortable
  97. />
  98. // 下半数据展示
  99. </el-table>
  100. <br>
  101. <el-table
  102. ref="tab2"
  103. style="width: 100%;height: 40vh;"
  104. tooltip-effect="dark"
  105. :data="tableData2"
  106. row-key="ID"
  107. highlight-current-row
  108. border
  109. :row-style="{ height: '20px' }"
  110. :cell-style="{ padding: '0px' }"
  111. :header-row-style="{ height: '20px' }"
  112. :header-cell-style="{ padding: '0px' }"
  113. @selection-change="handleSelectionChange"
  114. >
  115. <el-table-column
  116. type="selection"
  117. width="55"
  118. />
  119. <!-- 使用 v-for 循环渲染每一列 -->
  120. <el-table-column
  121. v-for="column in tableCols2"
  122. :key="column.prop"
  123. :prop="column.prop"
  124. :label="column.label"
  125. :width="column.width"
  126. show-overflow-tooltip="true"
  127. sortable
  128. />
  129. </el-table>
  130. </div>
  131. </el-main>
  132. </el-container>
  133. </el-container>
  134. </div>
  135. </template>
  136. <script setup>
  137. // 全量引入格式化工具 请按需保留
  138. import { Download, Refresh, Search } from '@element-plus/icons-vue'
  139. import { reactive, ref } from 'vue'
  140. import { getDownData, getSide, getUpData } from '@/api/mes_api_gty/overTimePayVerification'
  141. import { Layout, LayoutContent, LayoutHeader, LayoutSider } from '@arco-design/web-vue'
  142. defineOptions({
  143. name: '06PackingDocuments',
  144. })
  145. // 侧边栏数据请求
  146. const treeData = reactive([])
  147. const getSideData = async() => {
  148. try {
  149. const res = await getSide()
  150. if (res.code === 0) {
  151. treeData.splice(0, treeData.length, ...res.data)
  152. }
  153. } catch (e) {
  154. console.log(e)
  155. }
  156. }
  157. getSideData()
  158. // =========== 表格控制部分 ===========
  159. const tableCols1 = [
  160. { label: '员工编号', prop: 'bh', width: '100' },
  161. { label: '员工姓名', prop: '员工姓名', width: '100' },
  162. { label: '工资表类别', prop: '工资表类别', width: '150' },
  163. { label: '聘用日期', prop: '聘用日期', width: '150' },
  164. { label: '法定天数', prop: '法定天数', width: '100' },
  165. { label: '当月定额', prop: '当月定额', width: '100' },
  166. { label: '月度合计产量', prop: '月度合计产量', width: '150' },
  167. { label: '个人计件工资', prop: '个人计件工资', width: '150' },
  168. { label: '个人加班工资', prop: '个人加班工资', width: '150' },
  169. { label: '月计时时数', prop: '月计时时数', width: '150' },
  170. { label: '计时补差', prop: '计时补差', width: '150' },
  171. ]
  172. const tableCols2 = [
  173. { label: '日期', prop: 'sczl_rq', width: '100' },
  174. { label: '工单编号', prop: 'sczl_gdbh', width: '100' },
  175. { label: '成品名称', prop: 'Gd_cpmc', width: '300' },
  176. { label: '印件及工序', prop: 'sczl_type', width: '300' },
  177. { label: '车头产量', prop: '班组车头产量', width: '100' },
  178. { label: '机台编号', prop: 'sczl_jtbh', 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: '100' },
  187. { label: '个人计件工资', prop: '个人计件工资', width: '120' },
  188. { label: '个人加班工资', prop: '个人加班工资', width: '120' },
  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. { label: '计时补差', prop: '计时补差', width: '100' },
  195. ]
  196. const tableData1 = reactive([])
  197. const tableData2 = reactive([])
  198. let originData = []
  199. const searchInfo = ref('')
  200. const params = {
  201. date: '',
  202. department: '',
  203. code: '',
  204. }
  205. const handleNodeClick = async(node, check) => {
  206. if (!node.children) {
  207. const val = {
  208. date: node.gdbh,
  209. department: node.label.slice(0, node.label.indexOf('(')),
  210. }
  211. params.date = val.date
  212. params.department = val.department
  213. const res = await getUpData(val)
  214. if (res.code === 0) {
  215. const data = res.data
  216. let totalPersonalPieceWage = 0
  217. let totalOvertimeWage = 0
  218. data.forEach(employee => {
  219. const personalPieceWage = parseFloat(employee['个人计件工资']) || 0
  220. const overtimeWage = parseFloat(employee['个人加班工资']) || 0
  221. totalPersonalPieceWage += personalPieceWage
  222. totalOvertimeWage += overtimeWage
  223. })
  224. data.push({
  225. '员工姓名': '合计',
  226. '个人计件工资': totalPersonalPieceWage.toFixed(2),
  227. '个人加班工资': totalOvertimeWage.toFixed(2),
  228. })
  229. tableData1.splice(0, tableData1.length, ...data)
  230. originData = [...tableData1]
  231. }
  232. }
  233. }
  234. const handleDblclick1 = async(row) => {
  235. // params.code = row.bh
  236. // const { date, code } = params
  237. // const res = await getDownData({ date, code })
  238. // if (res.code === 0) {
  239. // const data = res.data
  240. // let totalPersonalPieceWage = 0
  241. // let totalOvertimeWage = 0
  242. // data.forEach(employee => {
  243. // const personalPieceWage = parseFloat(employee['个人计件工资']) || 0
  244. // const overtimeWage = parseFloat(employee['个人加班工资']) || 0
  245. // totalPersonalPieceWage += personalPieceWage
  246. // totalOvertimeWage += overtimeWage
  247. // })
  248. // data.push({
  249. // 'Gd_cpmc': '合计',
  250. // '个人计件工资': totalPersonalPieceWage.toFixed(2),
  251. // '个人加班工资': totalOvertimeWage.toFixed(2),
  252. // })
  253. // tableData2.splice(0, tableData2.length, ...data)
  254. // }
  255. }
  256. const clickybupdate = async(row) => {
  257. params.code = row.bh
  258. const { date, code } = params
  259. const res = await getDownData({ date, code })
  260. if (res.code === 0) {
  261. const data = res.data
  262. let totalPersonalPieceWage = 0
  263. let totalOvertimeWage = 0
  264. data.forEach(employee => {
  265. const personalPieceWage = parseFloat(employee['个人计件工资']) || 0
  266. const overtimeWage = parseFloat(employee['个人加班工资']) || 0
  267. totalPersonalPieceWage += personalPieceWage
  268. totalOvertimeWage += overtimeWage
  269. })
  270. data.push({
  271. 'Gd_cpmc': '合计',
  272. '个人计件工资': totalPersonalPieceWage.toFixed(2),
  273. '个人加班工资': totalOvertimeWage.toFixed(2),
  274. })
  275. tableData2.splice(0, tableData2.length, ...data)
  276. }
  277. console.log('22')
  278. }
  279. // 搜索
  280. const onSearch = () => {
  281. if (searchInfo.value === '') {
  282. tableData1.splice(0, tableData1.length, ...originData)
  283. return
  284. }
  285. const val = originData.filter(item => {
  286. const bh = item.bh
  287. const name = item.员工姓名
  288. return (bh?.match(searchInfo.value) || name?.match(searchInfo.value))
  289. })
  290. tableData1.splice(0, tableData1.length, ...val)
  291. }
  292. // 导出excel
  293. function exportExcel() {
  294. console.log('导出到excel')
  295. }
  296. </script>
  297. <style scoped>
  298. .JKWTree-container {
  299. display: flex;
  300. }
  301. .JKWTree-tree {
  302. width: 300px;
  303. background-color: #fff;
  304. padding: 10px;
  305. margin-right: 20px;
  306. }
  307. .JKWTree-tree h3 {
  308. font-size: 15px;
  309. font-weight: 700;
  310. margin: 10px 0;
  311. }
  312. .JKWTree-content {
  313. flex: 1;
  314. }
  315. /* 选中某行时的背景色 */
  316. :deep(.el-table__body tr.current-row) > td {
  317. background: #ff80ff !important;
  318. }
  319. :deep(.el-table td .cell) {
  320. line-height: 30px !important;
  321. }
  322. </style>