chengpinrucang.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282
  1. <template>
  2. <div>
  3. <layout>
  4. <layout-header>
  5. <div class="">
  6. <!-- 按钮部分-->
  7. <el-form ref="elSearchFormRef" class="demo-form-inline" :rules="searchRule" >
  8. <el-form-item>
  9. <!-- <el-input v-model="searchInfo" placeholder="搜索工单编号" clearable style="width: 200px;margin: 5px"></el-input>
  10. <el-button type="primary" class="bt" icon="download" @click="hzToExcel" >导出到Excel(汇总)</el-button>
  11. <el-button type="primary" class="bt" icon="download" @click="mxToExcel" >导出到Excel(明细)</el-button> -->
  12. </el-form-item>
  13. </el-form>
  14. </div>
  15. </layout-header>
  16. <layout>
  17. <!-- 左侧树侧形结构-->
  18. <layout-sider :resize-directions="['right']" :width="220" style="margin-right: 10px;">
  19. <div class="JKWTree-tree" style="height: 200px">
  20. <h3>成品入仓</h3>
  21. <el-tree :data="treeData" :props="defaultProps" class="treecolor" @node-click="handleNodeClick" @node-expand="handleNodeExpand">
  22. </el-tree>
  23. </div>
  24. </layout-sider>
  25. <!-- 右侧区域 -->
  26. <layout-content >
  27. <!-- <el-main> -->
  28. <div class="gva-table-box">
  29. <!-- 表格数据 -->
  30. <el-table ref="multipleTable" style="width: 100%;height: 33vh" tooltip-effect="dark"
  31. :row-style="{ height: '25px' }" :header-cell-style="{ padding: '0px' }"
  32. :cell-style="{ padding: '0px' }" :header-row-style="{ height: '20px' }"
  33. :data="hztableData" border row-key="ID"
  34. size="small"
  35. :cell-class-name="gxbgCellClass"
  36. highlight-current-row="true" @row-dblclick="updateCompanyFunc"
  37. @row-click="tableRowClick" :show-overflow-tooltip="true"
  38. @selection-change="handleSelectionChange">
  39. <el-table-column sortable align="center" label="订单编号" prop="订单编号" width="120" />
  40. <el-table-column sortable align="center" label="生产款号" prop="生产款号" width="170" />
  41. <el-table-column sortable align="center" label="款式" prop="款式" width="120" />
  42. <!-- <el-table-column align="center" label="实裁数量" prop="实裁数量" width="110" /> -->
  43. <el-table-column align="center" label="本月总检完工数量" prop="入仓数量" width="150" />
  44. <el-table-column align="center" label="累计总检完工数量" prop="累计入仓数量" width="150" />
  45. <el-table-column align="center" label="裁剪总产量" prop="裁剪总产量" width="120" />
  46. <el-table-column sortable align="center" label="实际合格率" prop="裁剪合格率" width="120" />
  47. <!-- <el-table-column align="center" label="车缝总产量" prop="车缝总产量" width="200" />
  48. <el-table-column align="center" label="车缝合格率" prop="车缝合格率" width="200" /> -->
  49. <el-table-column align="center" label="返工总数" prop="返工总数" width="120" />
  50. <el-table-column align="center" label="次片总数" prop="次片总数" width="120" />
  51. </el-table>
  52. <!-- 分页 -->
  53. <div class="gva-pagination">
  54. <el-pagination layout="total" :current-page="page" :page-size="pageSize"
  55. :total="total" @current-change="handleCurrentChange" @size-change="handleSizeChange" />
  56. </div>
  57. </div>
  58. <div class="gva-table-box">
  59. <!-- 表格数据 -->
  60. <el-table ref="multipleTable" style="width: 100%;height: 45vh" tooltip-effect="dark"
  61. :row-style="{ height: '25px' }" :header-cell-style="{ padding: '0px' }"
  62. :cell-style="{ padding: '0px' }" :header-row-style="{ height: '20px' }"
  63. :data="mxtableData" border row-key="ID"
  64. size="small"
  65. :cell-class-name="gxbgCellClass"
  66. highlight-current-row="true" @row-dblclick="updateCompanyFunc"
  67. :show-overflow-tooltip="true"
  68. @selection-change="handleSelectionChange">
  69. <el-table-column sortable align="center" label="订单编号" prop="订单编号" width="120" />
  70. <el-table-column sortable align="center" label="子订单编号" prop="子订单编号" width="160" />
  71. <el-table-column sortable align="center" label="PO号" prop="生产款号" width="200" />
  72. <el-table-column align="center" label="本月总检完工数量" prop="入仓数量" width="150" />
  73. <el-table-column align="center" label="累计总检完工数量" prop="累计入仓数量" width="150" />
  74. <el-table-column align="center" label="裁剪数量" prop="裁剪数量" width="100" />
  75. <el-table-column sortable align="center" label="实际合格率" prop="实际合格率" width="120" />
  76. <!-- <el-table-column sortable align="center" label="车缝数量" prop="车缝数量" width="100" />
  77. <el-table-column sortable align="center" label="车缝合格率" prop="车缝合格率" width="120" /> -->
  78. </el-table>
  79. <!-- 分页 -->
  80. <div class="gva-pagination">
  81. <el-pagination layout="total" :current-page="page" :page-size="pageSize"
  82. :total="total" @current-change="handleCurrentChange" @size-change="handleSizeChange" />
  83. </div>
  84. </div>
  85. <!-- </el-main> -->
  86. </layout-content>
  87. </layout>
  88. </layout>
  89. </div>
  90. </template>
  91. <script setup>
  92. // 全量引入格式化工具 请按需保留
  93. import { Layout, LayoutSider, LayoutContent } from '@arco-design/web-vue';
  94. import {ref, reactive} from 'vue'
  95. import { exportExcelFile } from '@/utils/excel'
  96. import {ElMessage} from "element-plus";
  97. import { GetWfpList,GetWfpDataLeft,GetSubOrderStats} from '@/api/mes/job'
  98. defineOptions({name: 'Company'})
  99. // =========== 获取左侧树侧形结构 ===========
  100. const treeData = ref('')
  101. // 获取树形数据
  102. const getTree = async () => {
  103. try {
  104. const response = await GetWfpDataLeft()
  105. const data = response.data
  106. // 获取所有年月键并排序(降序,最近的在上方)
  107. const sortedYearMonths = Object.keys(data).sort((a, b) => {
  108. const yearMonthA = parseInt(a);
  109. const yearMonthB = parseInt(b);
  110. // 降序排列(最近的在上方)
  111. return yearMonthB - yearMonthA;
  112. });
  113. // 转换数据为el-tree需要的格式
  114. treeData.value = sortedYearMonths.map(yearMonth => {
  115. return {
  116. label: `${yearMonth}`,
  117. children: data[yearMonth].map(customer => {
  118. return {
  119. label: `${customer.客户编号} (${customer.total}条)`,
  120. yearMonth: yearMonth,
  121. customerCode: customer.客户编号,
  122. total: customer.total,
  123. }
  124. })
  125. }
  126. })
  127. } catch (error) {
  128. ElMessage.error('获取数据失败')
  129. console.error('获取树形数据失败:', error)
  130. }
  131. }
  132. getTree()
  133. const hztableData = ref([])
  134. const _noderq = ref('')
  135. const _nodecode = ref('')
  136. const handleNodeClick = async (node) => {
  137. // 取消所有节点的颜色
  138. const allNodes = document.querySelectorAll('.treecolor .el-tree-node');
  139. allNodes.forEach(node => {
  140. node.querySelector('.el-tree-node__label').style.color = '';
  141. });
  142. // 获取点击的节点 给当前点击的节点改变颜色【红色】
  143. const clickedNodeId = node['$treeNodeId'];
  144. const clickedNode = document.querySelector(`.treecolor .el-tree-node[data-key="${clickedNodeId}"]`);
  145. if (clickedNode) {
  146. clickedNode.querySelector('.el-tree-node__label').style.color = 'red';
  147. }
  148. _noderq.value = node.yearMonth
  149. _nodecode.value = node.customerCode
  150. console.log('点击节点:', node)
  151. if (!node.children) {
  152. const res = await GetWfpList({sys_rq: node.yearMonth,customer: node.customerCode,})
  153. console.log('获取数据:', res)
  154. if(res.code === 0){
  155. hztableData.value = res.data.result
  156. }
  157. }
  158. }
  159. const mxtableData = ref([])
  160. const tableRowClick = async(row) => {
  161. const res = await GetSubOrderStats({sys_rq: _noderq.value,customer: _nodecode.value,order:row.订单编号})
  162. console.log('获取数据:', res)
  163. if(res.code === 0){
  164. mxtableData.value = res.data.result
  165. }
  166. }
  167. </script>
  168. <style scoped>
  169. .form-container {
  170. display: flex;
  171. flex-wrap: wrap;
  172. }
  173. .form-column {
  174. /*flex: 1;*/
  175. margin-right: 15px; /* 调整列之间的间距 */
  176. }
  177. /* 左侧输入框宽度调整 */
  178. .form-column .el-form-item .el-input {
  179. width: 150px; /* 调整左侧输入框的宽度 */
  180. }
  181. :deep(.hui-plan-usage-lows div) {
  182. color: #8c939d !important;
  183. }
  184. :deep(.lan-plan-usage-lows div) {
  185. color: blue !important;
  186. font-weight: bold;
  187. }
  188. /* 媒体查询,根据需要调整断点 */
  189. @media screen and (max-width: 768px) {
  190. .form-column {
  191. flex: 1 0 100%; /* 在小屏幕下变成单列布局 */
  192. margin-right: 0;
  193. }
  194. }
  195. /*:deep(.el-table td .cell) {*/
  196. /* line-height: 30px !important;*/
  197. /*}*/
  198. .JKWTree-container {
  199. display: flex;
  200. }
  201. .JKWTree-tree {
  202. /*width: 300px;*/
  203. background-color: #fff;
  204. padding: 10px;
  205. margin-right: 20px;
  206. }
  207. .JKWTree-tree h3 {
  208. font-size: 15px;
  209. font-weight: 700;
  210. margin: 10px 0;
  211. }
  212. .JKWTree-content {
  213. flex: 1;
  214. }
  215. /* 选中某行时的背景色 */
  216. :deep(.el-table__body tr.current-row) > td {
  217. background: #ff80ff !important;
  218. }
  219. </style>
  220. <style scoped>
  221. :deep(.el-table td .cell) {
  222. line-height: 20px !important;
  223. }
  224. :deep(.el-tabs__header){
  225. margin-bottom: 0;
  226. }
  227. .search{
  228. margin-left: 0px !important;
  229. margin-right: 10px !important;
  230. }
  231. .bt{
  232. margin-left: 2px !important;
  233. padding: 3px !important;
  234. font-size: 12px;
  235. }
  236. .el-tabs__header{
  237. margin: 0px !important;
  238. }
  239. .gva-table-box{
  240. padding: 0px !important;
  241. }
  242. .mab{
  243. margin-bottom: 5px;
  244. }
  245. </style>