fabricsummary.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326
  1. <template>
  2. <div>
  3. <el-form>
  4. <el-form-item>
  5. <el-input v-model="searchInfo" placeholder="搜索订单编号或生产款号" @keyup.enter="handleSearch()" style="width: 180px;" />
  6. <el-button type="primary" icon="Search" class="search" @click="handleSearch" />
  7. <el-button type="primary" icon="Download" @click="exportToExcel" style="margin: 5px;float: right;">导出库存Excel</el-button>
  8. </el-form-item>
  9. </el-form>
  10. <layout>
  11. <layout-sider :resize-directions="['right']" :width="220" style="margin-right: 10px;">
  12. <div class="JKWTree-tree" style="height: 70vh;">
  13. <h3>面料库存</h3>
  14. <el-tree :data="treeData" highlight-current="true" @node-click="handleNodeClick" />
  15. </div>
  16. </layout-sider>
  17. <layout>
  18. <layout-content>
  19. <div class="gva-table-box">
  20. <el-table ref="multipleTable" style="width: 100%;height: 64vh" tooltip-effect="dark"
  21. :row-style="{ height: '40px' }" :header-cell-style="{ padding: '0px' }"
  22. :cell-style="{ padding: '0px' }" :header-row-style="{ height: '20px' }"
  23. :data="restableData" border row-key="ID" size="small"
  24. :cell-class-name="tableDataCellClass" id="Fabricinventory"
  25. highlight-current-row="true" @row-dblclick="updateCompanyFunc"
  26. @row-click="tableRowClick" :show-overflow-tooltip="true"
  27. @selection-change="handleSelectionChange">
  28. <!-- <el-table-column type="selection" width="80" /> -->
  29. <el-table-column align="left" label="订单编号" prop="订单编号" width="105" />
  30. <el-table-column align="left" label="客户编号" prop="客户编号" width="80"/>
  31. <el-table-column align="left" label="生产款号" prop="生产款号" width="170"/>
  32. <el-table-column align="left" label="款式" prop="款式" width="170"/>
  33. <el-table-column align="left" label="物料名称" prop="物料名称" width="160"/>
  34. <el-table-column align="left" label="计划用料" prop="计划用料" width="100"/>
  35. <el-table-column align="left" label="定额用料" prop="定额用料" width="100"/>
  36. <el-table-column align="left" label="门封" prop="门封" width="100"/>
  37. <el-table-column align="left" label="裁床领用面料" prop="裁床领用面料" width="130"/>
  38. <el-table-column align="left" label="裁床实际用料" prop="裁床实际用料" width="130"/>
  39. <el-table-column align="left" label="裁床退回仓库面料" prop="裁床退回仓库面料" width="130"/>
  40. <el-table-column align="left" label="库存总量" prop="入库总量" width="100"/>
  41. <el-table-column align="left" label="面料结余" prop="面料结余" width="100"/>
  42. <el-table-column align="left" label="投料单位" prop="投料单位" width="100"/>
  43. <el-table-column align="left" label="备注" prop="备注" width="150"/>
  44. <el-table-column align="left" label="日期" prop="日期" width="150"/>
  45. </el-table>
  46. <div class="gva-pagination">
  47. <el-pagination
  48. @size-change="handleSizeChange"
  49. @current-change="handleCurrentChange"
  50. :current-page="page"
  51. :page-sizes="[10, 30, 50, 100]"
  52. :page-size="pageSize"
  53. layout="total, sizes, prev, pager, next, jumper"
  54. :total="total">
  55. </el-pagination>
  56. </div>
  57. <div class="dialog-footer" style="text-align: left;margin-right: 60px;">
  58. </div>
  59. </div>
  60. </layout-content>
  61. </layout>
  62. </layout>
  63. </div>
  64. </template>
  65. <script>
  66. //点击按钮显示下方表格
  67. export default {
  68. data() {
  69. return {
  70. currentTable: '', // 当前展示的表格
  71. activeName: 'first',
  72. _ddhval:'',
  73. add_gddialogFormVisible: true,
  74. };
  75. },
  76. methods: {
  77. }
  78. };
  79. </script>
  80. <script setup>
  81. // 全量引入格式化工具 请按需保留
  82. import { Layout, LayoutSider, LayoutContent } from '@arco-design/web-vue';
  83. import {ref, reactive} from 'vue'
  84. import {getSpotList,getSpotTab,orderSearch,outReport,orderBomList,FabricDetail,fabricList,fabricListmonth} from '@/api/mes/job'
  85. import {ElMessage} from "element-plus";
  86. import * as XLSX from 'xlsx';
  87. import FileSaver from 'file-saver';
  88. // import { get } from 'scriptjs';
  89. import { useUserStore } from '@/pinia/modules/user'
  90. defineOptions({name: 'Company'})
  91. //获取用户登录信息
  92. const userStore = useUserStore()
  93. const _username = ref('')
  94. _username.value = userStore.userInfo.userName + '/' + userStore.userInfo.nickName
  95. console.log('获取用户名称',_username.value)
  96. //全局调用获取当前日期
  97. const today = new Date();
  98. const year = today.getFullYear();
  99. const month = String(today.getMonth() + 1).padStart(2, '0'); // 月份从 0 开始,需要补零
  100. const day = String(today.getDate()).padStart(2, '0');
  101. const hours = String(today.getHours()).padStart(2, '0');
  102. const minutes = String(today.getMinutes()).padStart(2, '0');
  103. const seconds = String(today.getSeconds()).padStart(2, '0');
  104. const currentDate = `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
  105. const currentDates = `${year}-${month}-${day}`;
  106. const currentDatess = `${year}-${month}`;
  107. // 侧边栏数据请求
  108. const treeData = reactive([])
  109. const gettreeData = async () => {
  110. const response = await fabricListmonth()
  111. if (response.code === 0) {
  112. const transformedData = response.data.map(item => ({
  113. label: item.date,
  114. params: {
  115. date: item.date.substring(0, 4) + '-' + item.date.substring(4),
  116. },
  117. }))
  118. treeData.splice(0, treeData.length, ...transformedData)
  119. }
  120. }
  121. gettreeData()
  122. const mlscgdformData = reactive({
  123. 日期: '',
  124. });
  125. const nodedata = ref('')
  126. const handleNodeClick = async (node, check) => {
  127. console.log(node);
  128. nodedata.value = node.label
  129. restableData.splice(0, restableData.length);//清空表格
  130. //订单信息数据查询【接口】
  131. const fabricListdata = await fabricList({order:'',mouth:nodedata.value,page:page.value,limit:pageSize.value});
  132. console.log(fabricListdata)
  133. restableData.splice(0,fabricListdata.length,...fabricListdata.data.table);
  134. total.value = fabricListdata.data.total;
  135. }
  136. const searchInfo = ref('')
  137. //查询按钮
  138. const handleSearch = async ()=>{
  139. restableData.splice(0, restableData.length);//清空表格
  140. //订单信息数据查询【接口】
  141. const fabricListdata = await fabricList({order:searchInfo.value,mouth:nodedata.value,page:page.value,limit:pageSize.value});
  142. console.log(fabricListdata)
  143. restableData.splice(0,fabricListdata.length,...fabricListdata.data.table);
  144. total.value = fabricListdata.data.total;
  145. };
  146. const exportToExcel = ()=>{
  147. const el = document.getElementById('Fabricinventory');
  148. // 文件名
  149. const filename = '面料库存汇总.xlsx';
  150. const wb = XLSX.utils.table_to_book(el, { raw: true });
  151. const wbout = XLSX.write(wb, { bookType: 'xlsx', bookSST: true, type: 'array' });
  152. try {
  153. FileSaver.saveAs(new Blob([wbout], { type: 'application/octet-stream' }), filename);
  154. } catch (e) {
  155. console.log(e);
  156. }
  157. return wbout;
  158. }
  159. //自动聚焦光标input
  160. const getMachineMacdata = async () => {
  161. mlscgdformData['日期'] = currentDates
  162. restableData.splice(0, restableData.length);//清空表格
  163. setTimeout(() => {
  164. const inputElement = document.getElementById('searchInput');
  165. if (inputElement) {
  166. inputElement.focus();
  167. }
  168. }, 100); // 延迟100毫秒
  169. }
  170. getMachineMacdata();
  171. //全局调用参数
  172. const add_searchInfo = ref('')//搜索
  173. const restableData = reactive([])//表格
  174. const _orderid = ref('')//订单子编号
  175. const handleInput = async ()=>{
  176. add_onSubmit()
  177. }
  178. //表格行点击
  179. const tableRowClick = async (row)=>{
  180. console.log(row)
  181. }
  182. const resbomtableData = ref([]);
  183. // =========== 分页 ===========
  184. // 分页相关的响应式变量
  185. const page = ref(1)
  186. const total = ref(0)
  187. const pageSize = ref(50)
  188. // 分页
  189. const handleCurrentChange = (val) => {
  190. page.value = val;
  191. handleSearch();
  192. };
  193. // 修改页面容量 点击多少条/页
  194. const handleSizeChange = (val) => {
  195. pageSize.value = val;
  196. handleSearch();
  197. };
  198. </script>
  199. <style scoped>
  200. /* 根据出库状态文字颜色 */
  201. :deep(.status-plan-usage-low div) {
  202. color: #8c939d !important;
  203. }
  204. :deep(.statusy-plan-usage-low div) {
  205. color: blue !important;
  206. }
  207. .form-container {
  208. display: flex;
  209. flex-wrap: wrap;
  210. }
  211. .form-column {
  212. /*flex: 1;*/
  213. margin-right: 15px; /* 调整列之间的间距 */
  214. }
  215. /* 左侧输入框宽度调整 */
  216. .form-column .el-form-item .el-input {
  217. width: 150px; /* 调整左侧输入框的宽度 */
  218. }
  219. /* 媒体查询,根据需要调整断点 */
  220. @media screen and (max-width: 768px) {
  221. .form-column {
  222. flex: 1 0 100%; /* 在小屏幕下变成单列布局 */
  223. margin-right: 0;
  224. }
  225. }
  226. .JKWTree-container {
  227. display: flex;
  228. }
  229. .JKWTree-tree {
  230. /*width: 300px;*/
  231. background-color: #fff;
  232. padding: 10px;
  233. margin-right: 20px;
  234. }
  235. .JKWTree-tree h3 {
  236. font-size: 15px;
  237. font-weight: 700;
  238. margin: 10px 0;
  239. }
  240. .JKWTree-content {
  241. flex: 1;
  242. }
  243. /* 表格复选框大小调整 */
  244. :deep(.el-checkbox.el-checkbox--small .el-checkbox__inner) {
  245. width: 45px; /* 复选框宽度 */
  246. height: 23px; /* 复选框高度 */
  247. }
  248. /*bom参数背景*/
  249. :deep(.el-table__body .background-plan-usage-low div div div) {
  250. background: #80FA80 !important;
  251. }
  252. /* 选中某行时的背景色 */
  253. :deep(.el-table__body tr.current-row) > td {
  254. background: #ff80ff !important;
  255. }
  256. :deep(.el-checkbox.el-checkbox--small.is-checked .el-checkbox__inner::after) {
  257. transform: scale(1.2) rotate(45deg); /* 调整选中后的对勾大小 */
  258. top: 5%; /* 调整对勾位置 */
  259. left: 40%; /* 调整对勾位置 */
  260. width: 5px; /* 调整对勾宽度 */
  261. height: 9px; /* 调整对勾高度 */
  262. }
  263. /* 选中某行时的背景色 */
  264. :deep(.el-table__body tr.current-row) > td {
  265. background: #ff80ff !important;
  266. }
  267. </style>
  268. <style scoped>
  269. :deep(.el-table td .cell) {
  270. line-height: 20px !important;
  271. }
  272. :deep(.el-tabs__header){
  273. margin-bottom: 0;
  274. }
  275. .search{
  276. margin-left: 0px !important;
  277. margin-right: 10px !important;
  278. }
  279. .bt{
  280. margin-left: 2px !important;
  281. padding: 3px !important;
  282. font-size: 12px;
  283. }
  284. .el-tabs__header{
  285. margin: 0px !important;
  286. }
  287. .gva-table-box{
  288. padding: 0px !important;
  289. margin-left: 5px !important;
  290. }
  291. .mab{
  292. margin-bottom: 5px;
  293. }
  294. /* 搜索样式 */
  295. ::v-deep .el-input__wrapper #searchInput {
  296. font-size: 16px;
  297. }
  298. ::v-deep(.el-descriptions__table tbody tr .is-bordered-label){
  299. width: 60px;
  300. }
  301. ::v-deep(.el-descriptions__table tbody tr .el-descriptions__content){
  302. width: 120px;
  303. }
  304. </style>