index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358
  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="40"
  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="40"
  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. import { useUserStore } from '@/pinia/modules/user'
  143. const userStore = useUserStore()
  144. const sys_id='['+userStore.userInfo.userName+'/'+userStore.userInfo.nickName+']'
  145. defineOptions({
  146. name: '06PackingDocuments',
  147. })
  148. // 侧边栏数据请求
  149. const treeData = reactive([])
  150. const getSideData = async() => {
  151. try {
  152. const res = await getSide()
  153. if (res.code === 0) {
  154. treeData.splice(0, treeData.length, ...res.data)
  155. }
  156. } catch (e) {
  157. console.log(e)
  158. }
  159. }
  160. getSideData()
  161. // =========== 表格控制部分 ===========
  162. const tableCols1 = [
  163. { label: '员工编号', prop: 'bh', width: '105' },
  164. { label: '员工姓名', prop: '员工姓名', width: '105' },
  165. { label: '工资表类别', prop: '工资表类别', width: '120' },
  166. { label: '聘用日期', prop: '聘用日期', width: '105' },
  167. { label: '法定天数', prop: '法定天数', width: '105' },
  168. { label: '当月定额', prop: '当月定额', width: '105' },
  169. { label: '月度合计产量', prop: '月度合计产量', width: '135' },
  170. { label: '个人计件工资', prop: '个人计件工资', width: '135' },
  171. { label: '个人加班工资', prop: '个人加班工资', width: '135' },
  172. { label: '月计时时数', prop: '月计时时数', width: '120' },
  173. { label: '计时补差', prop: '计时补差', width: '120' },
  174. ]
  175. const tableCols2 = [
  176. { label: '日期', prop: 'sczl_rq', width: '105' },
  177. { label: '工单编号', prop: 'sczl_gdbh', width: '105' },
  178. { label: '成品名称', prop: 'Gd_cpmc', width: '150' },
  179. { label: '印件及工序', prop: 'sczl_type', width: '150' },
  180. { label: '车头产量', prop: '班组车头产量', width: '105' },
  181. { label: '机台编号', prop: 'sczl_jtbh', width: '105' },
  182. { label: '产量系数', prop: '产量系数', width: '105' },
  183. { label: '计件产量', prop: '计件产量', width: '105' },
  184. { label: '补产产量', prop: '补产产量', width: '105' },
  185. { label: '核算产量', prop: '核算产量', width: '105' },
  186. { label: '日定额', prop: '日定额', width: '91' },
  187. { label: '达标定额', prop: '达标定额', width: '105' },
  188. { label: '千件工价', prop: '千件工价', width: '105' },
  189. { label: '补产标准', prop: '补产标准', width: '105' },
  190. { label: '个人计件工资', prop: '个人计件工资', width: '135' },
  191. { label: '个人加班工资', prop: '个人加班工资', width: '135' },
  192. { label: '个人比例', prop: '个人比例', width: '105' },
  193. { label: '装版工时', prop: '装版工时', width: '105' },
  194. { label: '保养工时', prop: '保养工时', width: '105' },
  195. { label: '打样工时', prop: '打样工时', width: '105' },
  196. { label: '分摊计时', prop: '分摊计时', width: '105' },
  197. { label: '计时补差', prop: '计时补差', width: '105' },
  198. ]
  199. const tableData1 = reactive([])
  200. const tableData2 = reactive([])
  201. let originData = []
  202. const searchInfo = ref('')
  203. const params = {
  204. date: '',
  205. department: '',
  206. code: '',
  207. }
  208. const handleNodeClick = async(node, check) => {
  209. if (!node.children) {
  210. const val = {
  211. date: node.gdbh,
  212. department: node.label.slice(0, node.label.indexOf('(')),
  213. }
  214. params.date = val.date
  215. params.department = val.department
  216. const res = await getUpData(val)
  217. if (res.code === 0) {
  218. const data = res.data
  219. let totalPersonalPieceWage = 0
  220. let totalOvertimeWage = 0
  221. data.forEach(employee => {
  222. const personalPieceWage = parseFloat(employee['个人计件工资']) || 0
  223. const overtimeWage = parseFloat(employee['个人加班工资']) || 0
  224. totalPersonalPieceWage += personalPieceWage
  225. totalOvertimeWage += overtimeWage
  226. })
  227. data.push({
  228. '员工姓名': '合计',
  229. '个人计件工资': totalPersonalPieceWage.toFixed(2),
  230. '个人加班工资': totalOvertimeWage.toFixed(2),
  231. })
  232. tableData1.splice(0, tableData1.length, ...data)
  233. originData = [...tableData1]
  234. }
  235. }
  236. }
  237. const handleDblclick1 = async(row) => {
  238. // params.code = row.bh
  239. // const { date, code } = params
  240. // const res = await getDownData({ date, code })
  241. // if (res.code === 0) {
  242. // const data = res.data
  243. // let totalPersonalPieceWage = 0
  244. // let totalOvertimeWage = 0
  245. // data.forEach(employee => {
  246. // const personalPieceWage = parseFloat(employee['个人计件工资']) || 0
  247. // const overtimeWage = parseFloat(employee['个人加班工资']) || 0
  248. // totalPersonalPieceWage += personalPieceWage
  249. // totalOvertimeWage += overtimeWage
  250. // })
  251. // data.push({
  252. // 'Gd_cpmc': '合计',
  253. // '个人计件工资': totalPersonalPieceWage.toFixed(2),
  254. // '个人加班工资': totalOvertimeWage.toFixed(2),
  255. // })
  256. // tableData2.splice(0, tableData2.length, ...data)
  257. // }
  258. }
  259. const clickybupdate = async(row) => {
  260. if(row.bh == undefined) return
  261. params.code = row.bh
  262. const { date, code } = params
  263. const res = await getDownData({ date, code })
  264. if (res.code === 0) {
  265. const data = res.data
  266. let totalPersonalPieceWage = 0
  267. let totalOvertimeWage = 0
  268. data.forEach(employee => {
  269. const personalPieceWage = parseFloat(employee['个人计件工资']) || 0
  270. const overtimeWage = parseFloat(employee['个人加班工资']) || 0
  271. totalPersonalPieceWage += personalPieceWage
  272. totalOvertimeWage += overtimeWage
  273. })
  274. data.push({
  275. 'Gd_cpmc': '合计',
  276. '个人计件工资': totalPersonalPieceWage.toFixed(2),
  277. '个人加班工资': totalOvertimeWage.toFixed(2),
  278. })
  279. tableData2.splice(0, tableData2.length, ...data)
  280. }
  281. }
  282. // 搜索
  283. const onSearch = () => {
  284. if (searchInfo.value === '') {
  285. tableData1.splice(0, tableData1.length, ...originData)
  286. return
  287. }
  288. const val = originData.filter(item => {
  289. const bh = item.bh
  290. const name = item.员工姓名
  291. return (bh?.match(searchInfo.value) || name?.match(searchInfo.value))
  292. })
  293. tableData1.splice(0, tableData1.length, ...val)
  294. }
  295. // 导出excel
  296. function exportExcel() {
  297. console.log('导出到excel')
  298. }
  299. </script>
  300. <style scoped>
  301. .JKWTree-container {
  302. display: flex;
  303. }
  304. .JKWTree-tree {
  305. width: 300px;
  306. background-color: #fff;
  307. padding: 10px;
  308. margin-right: 20px;
  309. }
  310. .JKWTree-tree h3 {
  311. font-size: 15px;
  312. font-weight: 700;
  313. margin: 10px 0;
  314. }
  315. .JKWTree-content {
  316. flex: 1;
  317. }
  318. /* 选中某行时的背景色 */
  319. :deep(.el-table__body tr.current-row) > td {
  320. background: #ff80ff !important;
  321. }
  322. :deep(.el-table td .cell) {
  323. line-height: 30px !important;
  324. }
  325. </style>