| | |
| | | * @Author: lzhe lzhe@example.com |
| | | * @Date: 2024-04-26 09:36:18 |
| | | * @LastEditors: lzhe lzhe@example.com |
| | | * @LastEditTime: 2024-11-25 14:33:40 |
| | | * @LastEditTime: 2024-12-20 15:10:08 |
| | | * @FilePath: /smart-web/src/views/mdc/status-record.vue |
| | | * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE |
| | | --> |
| | |
| | | <el-radio-button label="设备结构树"></el-radio-button> |
| | | <el-radio-button label="零件结构树"></el-radio-button> |
| | | </el-radio-group> |
| | | <MYTree v-model="treeChecked" show-checkbox class="MYTree-content"></MYTree> |
| | | <!-- <MYTree v-model="treeChecked" show-checkbox class="MYTree-content"></MYTree> --> |
| | | </el-main> |
| | | </el-aside> |
| | | <el-container> |
| | | <el-main> |
| | | <el-table :data="tableData" border @selection-change="handleSelectionChange"> |
| | | <el-table-column type="selection" width="55"></el-table-column> |
| | | <el-table-column prop="index" label="序号" width="60"></el-table-column> |
| | | <el-table-column prop="partNo" label="零件号" width="80"></el-table-column> |
| | | <el-table-column type="selection" width="55" fixed></el-table-column> |
| | | <el-table-column prop="index" label="序号" width="60" fixed></el-table-column> |
| | | <el-table-column prop="partNo" label="零件号" width="80" fixed></el-table-column> |
| | | <el-table-column prop="processNo" label="工序号" width="80"></el-table-column> |
| | | <el-table-column prop="version" label="版次" width="60"></el-table-column> |
| | | <el-table-column prop="workstationName" label="机床" width="100"></el-table-column> |
| | | <el-table-column prop="startTime" label="开机时间" width="145"></el-table-column> |
| | | <el-table-column prop="workstationName" label="工位" width="100"></el-table-column> |
| | | <el-table-column prop="startTime" label="开始时间" width="145"></el-table-column> |
| | | <el-table-column prop="endTime" label="结束时间" width="145"></el-table-column> |
| | | <el-table-column prop="occupancySecs" label="占机时间" width="100"> |
| | | <template #default="scope"> |
| | |
| | | {{ convertSeconds(scope.row.firstWorkingSecs || 0) }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="firstWorkingSecs" label="首件切削时间" width="100"> |
| | | <el-table-column prop="firstMeasureSecs" label="首件计量时间" width="100"> |
| | | <template #default="scope"> |
| | | {{ convertSeconds(scope.row.firstWorkingSecs || 0) }} |
| | | {{ convertSeconds(scope.row.firstMeasureSecs || 0) }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="lastRemoveSecs" label="末件拆卸时间" width="100"> |
| | | <template #default="scope"> |
| | | {{ convertSeconds(scope.row.lastRemoveSecs || 0) }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="firstMeasureSecs" label="首件计量时间" width="100"> |
| | | <template #default="scope"> |
| | | {{ convertSeconds(scope.row.firstMeasureSecs || 0) }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="processingSecs" label="加工时间" width="80"> |
| | |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="amount" label="数量" width="60"></el-table-column> |
| | | <el-table-column label="操作" width="100"> |
| | | <template #default="scope"> |
| | | <el-button type="primary" @click="exportBtn(scope)">输出</el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | <el-pagination background layout="total, prev, pager, next" :total="total" style="margin-top: 12px;" @current-change="handleCurrentChange"></el-pagination> |
| | | </el-main> |
| | | <el-footer> |
| | | <el-button type="primary" @click="goFirstWorkDetail">详情</el-button> |
| | | <el-button type="primary">输出</el-button> |
| | | </el-footer> |
| | | </el-container> |
| | | </el-container> |
| | |
| | | tabPosition: "设备结构树", |
| | | tableData: [], |
| | | treeChecked: [], |
| | | workstationIdList: [], |
| | | ids: [], |
| | | total: 0, |
| | | current: 1, |
| | | size: 20 |
| | |
| | | // } |
| | | }, |
| | | mounted() { |
| | | //this.getTableData(); |
| | | this.setDate(); //设置开始,结束日期 |
| | | this.getTableData(); |
| | | }, |
| | | methods: { |
| | | exportBtn(scope) { |
| | | this.$HTTP.get(`/api/workinghour/export?id=${scope.row.id}`).then(res => { |
| | | if (res.code == 200) { |
| | | this.$TOOL.downFile(res.data.link,res.data.originalName); |
| | | } |
| | | }) |
| | | }, |
| | | setDate() { |
| | | var date = new Date(); |
| | | var threeDaysInMilliseconds = 3 * 24 * 60 * 60 * 1000; |
| | | var threeDaysAgo = new Date(date.getTime() - threeDaysInMilliseconds); |
| | | |
| | | // 辅助函数,用于将数字格式化为两位数 |
| | | function padZero(num) { |
| | | return num < 10 ? '0' + num : num; |
| | | } |
| | | |
| | | // 构建当前日期的字符串 |
| | | var currentYear = date.getFullYear(); |
| | | var currentMonth = padZero(date.getMonth() + 1); // 月份从0开始,所以需要加1 |
| | | var currentDay = padZero(date.getDate()); |
| | | this.searchInfo.endDate = currentYear + '-' + currentMonth + '-' + currentDay; |
| | | |
| | | // 构建三天前日期的字符串 |
| | | var previousYear = threeDaysAgo.getFullYear(); |
| | | var previousMonth = padZero(threeDaysAgo.getMonth() + 1); |
| | | var previousDay = padZero(threeDaysAgo.getDate()); |
| | | this.searchInfo.startDate = previousYear + '-' + previousMonth + '-' + previousDay; |
| | | }, |
| | | handleCurrentChange(val) { |
| | | this.current = val; |
| | | this.getTableData(); |
| | |
| | | this.getTableData(); |
| | | }, |
| | | getTableData() { |
| | | this.$HTTP.post(`/workinghour/page?current=${this.current}&size=${this.size}`, this.searchInfo).then(res => { |
| | | this.$HTTP.post(`/api/workinghour/page?current=${this.current}&size=${this.size}`, this.searchInfo).then(res => { |
| | | if (res.code === 200) { |
| | | res.data.records.forEach((item,index)=> { |
| | | item.index = index + 1; |
| | |
| | | }) |
| | | }, |
| | | goFirstWorkDetail() { |
| | | if(this.workstationIdList.length == 0) { |
| | | if(this.ids.length == 0) { |
| | | this.$message.error("请先选择数据"); |
| | | return; |
| | | } |
| | | this.$router.push({path: `/mdc/first-workpiece-detail`,query: {idList: this.workstationIdList.join(',')}}) |
| | | this.$router.push({path: `/mdc/first-workpiece-detail`,query: {ids: this.ids.join(',')}}) |
| | | }, |
| | | handleSelectionChange(val) { |
| | | this.workstationIdList = []; |
| | | this.ids = []; |
| | | val.forEach(item=> { |
| | | this.workstationIdList.push(item.workstationId); |
| | | this.ids.push(item.id); |
| | | }) |
| | | }, |
| | | query() { |