pickinglist.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391
  1. <template>
  2. <div>
  3. <layout>
  4. <layout-header>
  5. <el-form>
  6. <el-form-item>
  7. <el-input v-model="searchInfo" placeholder="搜索订单编号、单号、物料或款号" @keyup.enter="handleSearch()" style="width: 230px;" />
  8. <el-button type="primary" icon="Search" class="search" @click="handleSearch" />
  9. <el-button type="primary" icon="Download" @click="exportToExcel" style="margin: 5px;float: right;">导出单号Excel</el-button>
  10. <el-button type="primary" icon="Download" @click="exportToExcel2" style="margin: 5px;float: right;">导出单号(详情)Excel</el-button>
  11. </el-form-item>
  12. </el-form>
  13. </layout-header>
  14. <layout>
  15. <!-- 左侧树形结构 -->
  16. <layout-sider :resize-directions="['right']" :width="190" style="margin: 0px;">
  17. <div class="JKWTree-tree" style="height: 200px">
  18. <h3>领用单记录</h3>
  19. <el-tree :data="treeData" class="treecolor" @node-click="handleNodeClick"></el-tree>
  20. </div>
  21. </layout-sider>
  22. <layout-content >
  23. <el-main>
  24. <div class="gva-table-box">
  25. <el-table ref="multipleTable" style="width: 100%;height: 28vh" tooltip-effect="dark"
  26. :row-style="{ height: '20px' }"
  27. :cell-style="{ padding: '0px' }" :header-row-style="{ height: '20px' }"
  28. :header-cell-style="{ padding: '0px' }"
  29. :data="restableData" border row-key="ID" size="small"
  30. :cell-class-name="tableDataCellClass" id="dhtable"
  31. highlight-current-row="true" @row-dblclick="updateCompanyFunc"
  32. @row-click="tableRowClick" :show-overflow-tooltip="true"
  33. @selection-change="handleSelectionChange">
  34. <!-- <el-table-column type="selection" width="80" /> -->
  35. <el-table-column align="left" label="订单编号" prop="订单编号" width="160" />
  36. <el-table-column align="left" label="单号" prop="出库单" width="160"/>
  37. <el-table-column align="left" label="物料名称" prop="物料名称" width="160"/>
  38. <el-table-column align="left" label="款号" prop="款号" width="100"/>
  39. <el-table-column align="left" label="单号类型" prop="单号类型" width="160"/>
  40. <el-table-column align="left" label="领料人员" prop="领料人员" width="160"/>
  41. <el-table-column align="left" label="操作人员" prop="操作机台" width="160"/>
  42. <el-table-column align="left" label="日期" prop="日期" width="160"/>
  43. </el-table>
  44. <div class="gva-pagination">
  45. <el-pagination
  46. @size-change="handleSizeChange"
  47. @current-change="handleCurrentChange"
  48. :current-page="page"
  49. :page-sizes="[10, 30, 50, 100]"
  50. :page-size="pageSize"
  51. layout="total, sizes, prev, pager, next, jumper"
  52. :total="total">
  53. </el-pagination>
  54. </div>
  55. </div>
  56. <el-tabs v-model="activeName" @tab-click="handleClick">
  57. <el-tab-pane label="单号详情" @click="showTable('出库单详情')" name="first">
  58. <el-table ref="multipleTable"
  59. :row-style="{ height: '20px' }"
  60. :cell-style="{ padding: '0px' }" :header-row-style="{ height: '20px' }"
  61. :header-cell-style="{ padding: '0px' }"
  62. :show-overflow-tooltip="true" id="dhtable2"
  63. highlight-current-row="true"
  64. @row-click="listtableclick"
  65. @row-dblclick="ysupdateCompanyFunc"
  66. @selection-change="selectionChange($event, '出库单详情')"
  67. style="width: 100%;height: 36vh" border show-summary
  68. :summary-method="getSummaries" tooltip-effect="dark" :data="listtableData" row-key="ID" >
  69. <!-- <el-table-column type="selection" width="30" /> -->
  70. <el-table-column align="left" label="订单编号" prop="订单编号" width="160" />
  71. <el-table-column align="left" label="单号" prop="出库单据编号" width="160"/>
  72. <el-table-column align="left" label="物料名称" prop="物料名称" width="220"/>
  73. <el-table-column align="left" label="款号" prop="款号" width="100"/>
  74. <el-table-column align="left" label="数量" prop="数量" width="160"/>
  75. <el-table-column align="left" label="领料人员" prop="领料人员" width="160"/>
  76. <el-table-column align="left" label="操作人员" prop="操作机台" width="160"/>
  77. <el-table-column align="left" label="日期" prop="日期" width="160"/>
  78. </el-table>
  79. </el-tab-pane>
  80. </el-tabs>
  81. </el-main>
  82. </layout-content>
  83. </layout>
  84. </layout>
  85. </div>
  86. </template>
  87. <script>
  88. //点击按钮显示下方表格
  89. export default {
  90. data() {
  91. return {
  92. currentTable: '', // 当前展示的表格
  93. activeName: 'first',
  94. _ddhval:'',
  95. add_gddialogFormVisible: true,
  96. };
  97. },
  98. methods: {
  99. }
  100. };
  101. </script>
  102. <script setup>
  103. // 全量引入格式化工具 请按需保留
  104. import { Layout, LayoutSider, LayoutContent } from '@arco-design/web-vue';
  105. import {ref, reactive} from 'vue'
  106. import {getSpotList,getSpotTab,outReport,orderBomList,FabricDetail,getReceiptTab,
  107. ReceiptList,
  108. ReceiptDetail
  109. } from '@/api/mes/job'
  110. import {ElMessage} from "element-plus";
  111. import * as XLSX from 'xlsx';
  112. import FileSaver from 'file-saver';
  113. // import { get } from 'scriptjs';
  114. import { useUserStore } from '@/pinia/modules/user'
  115. defineOptions({name: 'Company'})
  116. //获取用户登录信息
  117. const userStore = useUserStore()
  118. const _username = ref('')
  119. _username.value = userStore.userInfo.userName + '/' + userStore.userInfo.nickName
  120. console.log('获取用户名称',_username.value)
  121. //全局调用获取当前日期
  122. const today = new Date();
  123. const year = today.getFullYear();
  124. const month = String(today.getMonth() + 1).padStart(2, '0'); // 月份从 0 开始,需要补零
  125. const day = String(today.getDate()).padStart(2, '0');
  126. const hours = String(today.getHours()).padStart(2, '0');
  127. const minutes = String(today.getMinutes()).padStart(2, '0');
  128. const seconds = String(today.getSeconds()).padStart(2, '0');
  129. const currentDate = `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
  130. const currentDates = `${year}-${month}-${day}`;
  131. //自动聚焦光标input
  132. const getMachineMacdata = async () => {
  133. setTimeout(() => {
  134. const inputElement = document.getElementById('searchInput');
  135. if (inputElement) {
  136. inputElement.focus();
  137. }
  138. }, 100); // 延迟100毫秒
  139. }
  140. getMachineMacdata();
  141. // =========== 左侧树侧形结构 ===========
  142. const treeData = ref([]);
  143. const defaultProps = {
  144. children: 'children',
  145. label: 'label'
  146. };
  147. const getReceiptTabs = async () => {
  148. try {
  149. // 调用接口获取数据
  150. const response = await getReceiptTab();
  151. console.log(response); // 查看接口返回的数据
  152. // 将接口返回的数据格式化为树形结构
  153. const formattedData = response.data.map(item => ({
  154. label: item.month, // 显示月份
  155. children: [] // 如果需要,可以添加子节点,或者根据需求添加
  156. }));
  157. // 将格式化后的数据赋值给treeData
  158. treeData.value = formattedData;
  159. } catch (error) {
  160. console.error(error);
  161. }
  162. };
  163. getReceiptTabs();
  164. const restableData = reactive([])
  165. const nodedata = ref('')
  166. //点击左侧树形获取编号
  167. const handleNodeClick = async (node) => {
  168. restableData.splice(0, restableData.length);//清空表格
  169. nodedata.value = node.label;
  170. // 获取点击的节点的月份
  171. const response = await ReceiptList({order:'',mouth:nodedata.value,page:page.value,limit:pageSize.value});
  172. console.log(response)
  173. restableData.splice(0,response.length,...response.data.table);
  174. total.value = response.data.total;
  175. }
  176. const searchInfo = ref('')
  177. //查询按钮
  178. const handleSearch = async ()=>{
  179. restableData.splice(0, restableData.length);//清空表格
  180. //订单信息数据查询【接口】
  181. const response = await ReceiptList({order:searchInfo.value,mouth:nodedata.value,page:page.value,limit:pageSize.value});
  182. console.log(response)
  183. restableData.splice(0,response.length,...response.data.table);
  184. total.value = response.data.total;
  185. };
  186. const exportToExcel = ()=>{
  187. const el = document.getElementById('dhtable');
  188. // 文件名
  189. const filename = '出入库单号.xlsx';
  190. const wb = XLSX.utils.table_to_book(el, { raw: true });
  191. const wbout = XLSX.write(wb, { bookType: 'xlsx', bookSST: true, type: 'array' });
  192. try {
  193. FileSaver.saveAs(new Blob([wbout], { type: 'application/octet-stream' }), filename);
  194. } catch (e) {
  195. console.log(e);
  196. }
  197. return wbout;
  198. }
  199. const exportToExcel2 = ()=>{
  200. const el = document.getElementById('dhtable2');
  201. // 文件名
  202. const filename = '出入库单号(详情).xlsx';
  203. const wb = XLSX.utils.table_to_book(el, { raw: true });
  204. const wbout = XLSX.write(wb, { bookType: 'xlsx', bookSST: true, type: 'array' });
  205. try {
  206. FileSaver.saveAs(new Blob([wbout], { type: 'application/octet-stream' }), filename);
  207. } catch (e) {
  208. console.log(e);
  209. }
  210. return wbout;
  211. }
  212. const listtableData = reactive([])
  213. //表格行点击
  214. const tableRowClick = async (row)=>{
  215. listtableData.splice(0, listtableData.length);//清空表格
  216. console.log(row['出库单'])
  217. if(row['单号类型'] != '退还'){
  218. //单据详情
  219. const response = await ReceiptDetail({receipt:row['出库单']});
  220. console.log(response)
  221. listtableData.splice(0,response.length,...response.data);
  222. }
  223. }
  224. const getSummaries = (param) => {
  225. const { columns, data } = param;
  226. const sums = {};
  227. //选择你希望合计的列
  228. const summableLabels = ["数量"];
  229. columns.forEach((column, index) => {
  230. if (index === 0) {
  231. sums[index] = '总数量合计';
  232. return;
  233. }
  234. if (summableLabels.includes(column.label)) {
  235. const values = data.map(item => Number(item[column.property]));
  236. if (!values.every(value => isNaN(value))) {
  237. sums[index] = values.reduce((prev, curr) => {
  238. const value = Number(curr);
  239. if (!isNaN(value)) {
  240. return prev + value;
  241. }
  242. return prev;
  243. }, 0);
  244. } else {
  245. sums[index] = 'N/A';
  246. }
  247. }
  248. });
  249. return sums;
  250. };
  251. // =========== 分页 ===========
  252. // 分页相关的响应式变量
  253. const page = ref(1)
  254. const total = ref(0)
  255. const pageSize = ref(50)
  256. // 分页
  257. const handleCurrentChange = (val) => {
  258. page.value = val;
  259. handleSearch();
  260. };
  261. // 修改页面容量 点击多少条/页
  262. const handleSizeChange = (val) => {
  263. pageSize.value = val;
  264. handleSearch();
  265. };
  266. </script>
  267. <style scoped>
  268. /* 根据出库状态文字颜色 */
  269. :deep(.status-plan-usage-low div) {
  270. color: #8c939d !important;
  271. }
  272. :deep(.statusy-plan-usage-low div) {
  273. color: blue !important;
  274. }
  275. .form-container {
  276. display: flex;
  277. flex-wrap: wrap;
  278. }
  279. .form-column {
  280. /*flex: 1;*/
  281. margin-right: 15px; /* 调整列之间的间距 */
  282. }
  283. /* 左侧输入框宽度调整 */
  284. .form-column .el-form-item .el-input {
  285. width: 150px; /* 调整左侧输入框的宽度 */
  286. }
  287. /* 媒体查询,根据需要调整断点 */
  288. @media screen and (max-width: 768px) {
  289. .form-column {
  290. flex: 1 0 100%; /* 在小屏幕下变成单列布局 */
  291. margin-right: 0;
  292. }
  293. }
  294. .JKWTree-container {
  295. display: flex;
  296. }
  297. .JKWTree-tree {
  298. /*width: 300px;*/
  299. background-color: #fff;
  300. padding: 10px;
  301. margin-right: 20px;
  302. }
  303. .JKWTree-tree h3 {
  304. font-size: 15px;
  305. font-weight: 700;
  306. margin: 10px 0;
  307. }
  308. .JKWTree-content {
  309. flex: 1;
  310. }
  311. /* 表格复选框大小调整 */
  312. :deep(.el-checkbox.el-checkbox--small .el-checkbox__inner) {
  313. width: 45px; /* 复选框宽度 */
  314. height: 23px; /* 复选框高度 */
  315. }
  316. /*bom参数背景*/
  317. :deep(.el-table__body .background-plan-usage-low div div div) {
  318. background: #80FA80 !important;
  319. }
  320. /* 选中某行时的背景色 */
  321. :deep(.el-table__body tr.current-row) > td {
  322. background: #ff80ff !important;
  323. }
  324. :deep(.el-checkbox.el-checkbox--small.is-checked .el-checkbox__inner::after) {
  325. transform: scale(1.2) rotate(45deg); /* 调整选中后的对勾大小 */
  326. top: 5%; /* 调整对勾位置 */
  327. left: 40%; /* 调整对勾位置 */
  328. width: 5px; /* 调整对勾宽度 */
  329. height: 9px; /* 调整对勾高度 */
  330. }
  331. /* 选中某行时的背景色 */
  332. :deep(.el-table__body tr.current-row) > td {
  333. background: #ff80ff !important;
  334. }
  335. </style>
  336. <style scoped>
  337. :deep(.el-table td .cell) {
  338. line-height: 20px !important;
  339. }
  340. :deep(.el-tabs__header){
  341. margin-bottom: 0;
  342. }
  343. .search{
  344. margin-left: 0px !important;
  345. margin-right: 10px !important;
  346. }
  347. .bt{
  348. margin-left: 2px !important;
  349. padding: 3px !important;
  350. font-size: 12px;
  351. }
  352. .el-tabs__header{
  353. margin: 0px !important;
  354. }
  355. .gva-table-box{
  356. padding: 0px !important;
  357. margin-left: 5px !important;
  358. }
  359. .mab{
  360. margin-bottom: 5px;
  361. }
  362. /* 搜索样式 */
  363. ::v-deep .el-input__wrapper #searchInput {
  364. font-size: 16px;
  365. }
  366. ::v-deep(.el-descriptions__table tbody tr .is-bordered-label){
  367. width: 60px;
  368. }
  369. ::v-deep(.el-descriptions__table tbody tr .el-descriptions__content){
  370. width: 120px;
  371. }
  372. </style>