chengpinrucang.vue 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259
  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="190" style="margin-right: 10px;">
  19. <div class="JKWTree-tree" style="height: 200px">
  20. <h3>成品入仓</h3>
  21. <el-tree :data="treeData" :props="defaultProps" @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="120" />
  41. <!-- <el-table-column align="center" label="实裁数量" prop="实裁数量" width="110" /> -->
  42. <el-table-column align="center" label="入仓数量" prop="入仓数量" width="110" />
  43. <el-table-column align="center" label="裁剪总产量" prop="裁剪总产量" width="200" />
  44. <el-table-column align="center" label="实际合格率" prop="裁剪合格率" width="200" />
  45. <!-- <el-table-column align="center" label="车缝总产量" prop="车缝总产量" width="200" />
  46. <el-table-column align="center" label="车缝合格率" prop="车缝合格率" width="200" /> -->
  47. <el-table-column align="center" label="返工总数" prop="返工总数" width="110" />
  48. <el-table-column align="center" label="次片总数" prop="次片总数" width="110" />
  49. </el-table>
  50. <!-- 分页 -->
  51. <div class="gva-pagination">
  52. <el-pagination layout="total" :current-page="page" :page-size="pageSize"
  53. :total="total" @current-change="handleCurrentChange" @size-change="handleSizeChange" />
  54. </div>
  55. </div>
  56. <div class="gva-table-box">
  57. <!-- 表格数据 -->
  58. <el-table ref="multipleTable" style="width: 100%;height: 45vh" tooltip-effect="dark"
  59. :row-style="{ height: '25px' }" :header-cell-style="{ padding: '0px' }"
  60. :cell-style="{ padding: '0px' }" :header-row-style="{ height: '20px' }"
  61. :data="mxtableData" border row-key="ID"
  62. size="small"
  63. :cell-class-name="gxbgCellClass"
  64. highlight-current-row="true" @row-dblclick="updateCompanyFunc"
  65. @row-click="tableRowClick" :show-overflow-tooltip="true"
  66. @selection-change="handleSelectionChange">
  67. <el-table-column sortable align="center" label="订单编号" prop="订单编号" width="120" />
  68. <el-table-column sortable align="center" label="子订单编号" prop="子订单编号" width="160" />
  69. <el-table-column sortable align="center" label="生产款号" prop="生产款号" width="200" />
  70. <el-table-column sortable align="center" label="入仓数量" prop="入仓数量" width="100" />
  71. <el-table-column sortable align="center" label="裁剪数量" prop="裁剪数量" width="100" />
  72. <el-table-column sortable align="center" label="实际合格率" prop="裁剪合格率" width="120" />
  73. <!-- <el-table-column sortable align="center" label="车缝数量" prop="车缝数量" width="100" />
  74. <el-table-column sortable align="center" label="车缝合格率" prop="车缝合格率" width="120" /> -->
  75. </el-table>
  76. <!-- 分页 -->
  77. <div class="gva-pagination">
  78. <el-pagination layout="total" :current-page="page" :page-size="pageSize"
  79. :total="total" @current-change="handleCurrentChange" @size-change="handleSizeChange" />
  80. </div>
  81. </div>
  82. </el-main>
  83. </layout-content>
  84. </layout>
  85. </layout>
  86. </div>
  87. </template>
  88. <script setup>
  89. // 全量引入格式化工具 请按需保留
  90. import { Layout, LayoutSider, LayoutContent } from '@arco-design/web-vue';
  91. import {ref, reactive} from 'vue'
  92. import { exportExcelFile } from '@/utils/excel'
  93. import {ElMessage} from "element-plus";
  94. import { GetWfpList,GetWfpDataLeft,GetSubOrderStats} from '@/api/mes/job'
  95. defineOptions({name: 'Company'})
  96. // =========== 获取左侧树侧形结构 ===========
  97. const treeData = ref('')
  98. // 获取树形数据
  99. const getTree = async () => {
  100. try {
  101. // 调用API获取数据 - 根据你的实际API调用方式调整
  102. const response = await GetWfpDataLeft()
  103. const data = response.data
  104. // 转换数据为el-tree需要的格式
  105. treeData.value = Object.keys(data).map(yearMonth => {
  106. return {
  107. label: `${yearMonth}`,
  108. children: data[yearMonth].map(customer => {
  109. return {
  110. label: `${customer.客户编号} (${customer.total}条)`,
  111. yearMonth: yearMonth,
  112. customerCode: customer.客户编号,
  113. total: customer.total,
  114. }
  115. })
  116. }
  117. })
  118. } catch (error) {
  119. ElMessage.error('获取数据失败')
  120. console.error('获取树形数据失败:', error)
  121. }
  122. }
  123. getTree()
  124. const hztableData = ref([])
  125. const _noderq = ref('')
  126. const _nodecode = ref('')
  127. const handleNodeClick = async (node) => {
  128. _noderq.value = node.yearMonth
  129. _nodecode.value = node.customerCode
  130. console.log('点击节点:', node)
  131. if (!node.children) {
  132. const res = await GetWfpList({sys_rq: node.yearMonth,customer: node.customerCode,})
  133. console.log('获取数据:', res)
  134. if(res.code === 0){
  135. hztableData.value = res.data.result
  136. }
  137. }
  138. }
  139. const mxtableData = ref([])
  140. const tableRowClick = async(row) => {
  141. const res = await GetSubOrderStats({sys_rq: _noderq.value,customer: _nodecode.value,order:row.订单编号})
  142. console.log('获取数据:', res)
  143. if(res.code === 0){
  144. mxtableData.value = res.data.result
  145. }
  146. }
  147. </script>
  148. <style scoped>
  149. .form-container {
  150. display: flex;
  151. flex-wrap: wrap;
  152. }
  153. .form-column {
  154. /*flex: 1;*/
  155. margin-right: 15px; /* 调整列之间的间距 */
  156. }
  157. /* 左侧输入框宽度调整 */
  158. .form-column .el-form-item .el-input {
  159. width: 150px; /* 调整左侧输入框的宽度 */
  160. }
  161. :deep(.hui-plan-usage-lows div) {
  162. color: #8c939d !important;
  163. }
  164. :deep(.lan-plan-usage-lows div) {
  165. color: blue !important;
  166. font-weight: bold;
  167. }
  168. /* 媒体查询,根据需要调整断点 */
  169. @media screen and (max-width: 768px) {
  170. .form-column {
  171. flex: 1 0 100%; /* 在小屏幕下变成单列布局 */
  172. margin-right: 0;
  173. }
  174. }
  175. /*:deep(.el-table td .cell) {*/
  176. /* line-height: 30px !important;*/
  177. /*}*/
  178. .JKWTree-container {
  179. display: flex;
  180. }
  181. .JKWTree-tree {
  182. /*width: 300px;*/
  183. background-color: #fff;
  184. padding: 10px;
  185. margin-right: 20px;
  186. }
  187. .JKWTree-tree h3 {
  188. font-size: 15px;
  189. font-weight: 700;
  190. margin: 10px 0;
  191. }
  192. .JKWTree-content {
  193. flex: 1;
  194. }
  195. /* 选中某行时的背景色 */
  196. :deep(.el-table__body tr.current-row) > td {
  197. background: #ff80ff !important;
  198. }
  199. </style>
  200. <style scoped>
  201. :deep(.el-table td .cell) {
  202. line-height: 20px !important;
  203. }
  204. :deep(.el-tabs__header){
  205. margin-bottom: 0;
  206. }
  207. .search{
  208. margin-left: 0px !important;
  209. margin-right: 10px !important;
  210. }
  211. .bt{
  212. margin-left: 2px !important;
  213. padding: 3px !important;
  214. font-size: 12px;
  215. }
  216. .el-tabs__header{
  217. margin: 0px !important;
  218. }
  219. .gva-table-box{
  220. padding: 0px !important;
  221. }
  222. .mab{
  223. margin-bottom: 5px;
  224. }
  225. </style>