春风项目四线(合箱线、总装线)
wujian
5 天以前 ea3c33c8561df39d4f123d1424fda99dd0f0c51d
提交 | 用户 | 时间
2c65c3 1 <template>
W 2   <div class="app-container">
3     <el-card class="box-card">
4       <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="100px">
5         <el-form-item label="按月份统计" prop="queryMonth">
6           <el-date-picker
7             v-model="queryParams.queryMonth"
8             type="month"
9             @change = changeMonth
10             value-format="yyyy-MM"
11             placeholder="选择月份">
12           </el-date-picker>
13         </el-form-item>
14         <el-form-item label="按日期统计" prop="queryDate">
15           <el-date-picker
16             v-model="queryParams.queryDate"
17             type="date"
18             @change = changeDate
19             value-format="yyyy-MM-dd"
20             placeholder="选择日期">
21           </el-date-picker>
22         </el-form-item>
23         <el-form-item>
24           <el-button type="primary" icon="el-icon-download" style="background-color: #6dbf6d;" @click="exportReport">导出报表</el-button>
25         </el-form-item>
26       </el-form>
27
28       <el-table v-loading="loading" border :data="productNumList" v-if="productNumList.length > 0">
29         <el-table-column label="机型" align="center" prop="model">
30         </el-table-column>
31         <el-table-column label="产量" align="center" prop="num" width="150">
32         </el-table-column>
33       </el-table>
34       <el-empty v-else>
35         <span slot="description">暂无数据</span>
36       </el-empty>
37     </el-card>
38   </div>
39 </template>
40
41 <script>
42 import {
43   getProductNum
44 } from "../../../../api/main/da/passingStationCollection/passingStationCollection";
45
46 export default {
47   name: "productNum",
48   data() {
49     return {
50       // 遮罩层
51       loading: true,
52       queryParams: {
53         queryDate: '',
54         queryMonth: '',
55         pageNum: 1,
56         pageSize: 10,
57       },
58       // 表单参数
59       form: {},
60       showSearch: true,
61       productNumList: [],
62       // 总条数
63       total: 0,
64     };
65   },
66   created() {
67     const date = new Date();
68     const year = date.getFullYear();
69     let month = date.getMonth() + 1;
70     let day = date.getDate();
71     month = (month > 9) ? month : ("0" + month);
72     day = (day < 10) ? ("0" + day) : day;
73     this.queryParams.queryDate = year + "-" + month + "-" + day;
74     this.queryParams.queryMonth = year + "-" + month;
75     this.getList();
76   },
77   methods: {
78     //导出
79     exportReport(){
80       this.download('bs/beatSetting/productNumExport', {
81         ...this.queryParams
82       }, `产量报表_${new Date().getTime()}.xlsx`)
83
84     },
85     /** 查询产品过站采集列表 */
86     getList: function () {
87       this.loading = true;
88       getProductNum(this.queryParams).then(response => {
89         console.log('res', response)
90         this.productNumList = response.data;
91         this.loading = false;
92       });
93     },
94     changeMonth (){
95       this.queryParams.queryDate = ''
96       this.getList()
97     },
98     changeDate(){
99       console.log('000000')
100       if (this.queryParams.queryDate !== null && this.queryParams.queryDate !==''){
101         let split = this.queryParams.queryDate.split('-');
102         this.queryParams.queryMonth = split[0]+"-"+split[1]
103       }
104       this.getList()
105     },
106     // 取消按钮
107     cancel() {
108       this.open = false;
109       this.reset();
110     },
111     // 表单重置
112     reset() {
113       this.form = {
114         id: null,
115         workOrderNo: null,
116         sfcCode: null,
117         productCode: null,
118         productionLine: null,
119         locationCode: null,
120         equipmentNo: null,
121         inboundTime: null,
122         outboundTime: null,
123         inRsSign: null,
124         inMsgSign: null,
125         outRsSign: null,
126         outMsgSign: null,
127         collectionTime: null,
128         spareField1: null,
129         spareField2: null,
130         createUser: null,
131         createTime: null,
132         updateUser: null,
133         updateTime: null,
134         beatTime: null
135       };
136       this.resetForm("form");
137     },
138     /** 搜索按钮操作 */
139     handleQuery() {
140       this.queryParams.pageNum = 1;
141       this.getList();
142     },
143     /** 重置按钮操作 */
144     resetQuery() {
145       this.resetForm("queryForm");
146       this.handleQuery();
147     },
148   }
149 };
150 </script>
151
152 <style scoped>
153
154 </style>