1
lzhe
2024-11-24 f378a7f428d26f6a3f38e47c1857d11a0686497a
1
已修改2个文件
199 ■■■■■ 文件已修改
src/views/mdc/first-workpiece.vue 177 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
vue.config.js 22 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/mdc/first-workpiece.vue
@@ -10,44 +10,23 @@
    <el-main style="height: 100%;" class="timeAnalysis">
        <el-card shadow="never" style="height: 100%;" body-style="height: 100%;padding: 0;">
            <el-container style="height: 100%;">
                <!-- <el-aside width="300px" style="height: 100%;">
                    <el-container>
                        <el-main style="padding: 20px;">
                            <el-row>
                                <el-col style="margin-bottom: 12px;">日期</el-col>
                            </el-row>
                            <el-row style="margin-top: 14px;">
                                <MYTree getAll v-model="treeChecked" show-checkbox class="MYTree-content"></MYTree>
                            </el-row>
                        </el-main>
                        <el-footer>
                            <el-button @click="query" type="primary">查询</el-button>
                            <exportDialog @export="exportExcel"></exportDialog>
                        </el-footer>
                    </el-container>
                </el-aside>
                <el-container>
                    <el-main style="position: relative;">
                    </el-main>
                </el-container> -->
                <el-aside width="300px" style="height: 100%;">
                    <el-main style="border-bottom: 1px solid #ccc;">
                        <el-form ref="form" :model="searchInfo" label-width="80px">
                          <el-form-item label="零件号">
                            <el-input v-model="searchInfo.test"></el-input>
                            <el-input v-model="searchInfo.partNo"></el-input>
                          </el-form-item>
                          <el-form-item label="机序号">
                            <el-input v-model="searchInfo.test"></el-input>
                          <el-form-item label="工位编号">
                            <el-input v-model="searchInfo.workstationName"></el-input>
                          </el-form-item>
                          <el-form-item label="开始时间">
                            <el-date-picker v-model="searchInfo.time" type="date" placeholder="选择日期"></el-date-picker>
                            <el-date-picker v-model="searchInfo.startDate" format="YYYY-MM-DD" value-format="YYYY-MM-DD" @change="changeStartDate" type="date" placeholder="选择日期"></el-date-picker>
                          </el-form-item>
                          <el-form-item label="结束时间">
                            <el-date-picker v-model="searchInfo.time" type="date" placeholder="选择日期"></el-date-picker>
                            <el-date-picker v-model="searchInfo.endDate" format="YYYY-MM-DD" value-format="YYYY-MM-DD" type="date" placeholder="选择日期"></el-date-picker>
                          </el-form-item>
                        </el-form>
                        <div style="text-align: center;"><el-button type="primary">查询</el-button></div>
                        <div style="text-align: center;"><el-button type="primary" @click="searchBtn">查询</el-button></div>
                    </el-main>
                    <el-main>
                        <el-radio-group v-model="tabPosition" style="margin-bottom: 12px;">
@@ -61,23 +40,59 @@
                    <el-main>
                        <el-table :data="tableData" border @selection-change="handleSelectionChange">
                            <el-table-column type="selection" width="55"></el-table-column>
                            <el-table-column prop="test" label="序号" width="60"></el-table-column>
                            <el-table-column prop="test" label="零件号" width="80"></el-table-column>
                            <el-table-column prop="test" label="工序号" width="80"></el-table-column>
                            <el-table-column prop="test" label="版次" width="60"></el-table-column>
                            <el-table-column prop="test" label="机床" width="60"></el-table-column>
                            <el-table-column prop="test" label="开机时间" width="80"></el-table-column>
                            <el-table-column prop="test" label="结束时间" width="80"></el-table-column>
                            <el-table-column prop="test" label="占机时间" width="100"></el-table-column>
                            <el-table-column prop="test" label="装夹调试时间" width="100"></el-table-column>
                            <el-table-column prop="test" label="首件切削时间" width="100"></el-table-column>
                            <el-table-column prop="test" label="首件切削时间" width="100"></el-table-column>
                            <el-table-column prop="test" label="末件拆卸时间" width="100"></el-table-column>
                            <el-table-column prop="test" label="首件计量时间" width="100"></el-table-column>
                            <el-table-column prop="test" label="加工时间" width="80"></el-table-column>
                            <el-table-column prop="test" label="准备时间" width="80"></el-table-column>
                            <el-table-column prop="test" label="单件工时" width="80"></el-table-column>
                            <el-table-column prop="test" label="数量" width="60"></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 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="endTime" label="结束时间" width="145"></el-table-column>
                            <el-table-column prop="occupancySecs" label="占机时间" width="100">
                                <template #default="scope">
                                    {{ convertSeconds(scope.row.occupancySecs || 0) }}
                                </template>
                            </el-table-column>
                            <el-table-column prop="clampingSecs" label="装夹调试时间" width="100">
                                 <template #default="scope">
                                    {{ convertSeconds(scope.row.clampingSecs || 0) }}
                                </template>
                            </el-table-column>
                            <el-table-column prop="firstWorkingSecs" label="首件切削时间" width="100">
                                <template #default="scope">
                                    {{ convertSeconds(scope.row.firstWorkingSecs || 0) }}
                                </template>
                            </el-table-column>
                            <el-table-column prop="firstWorkingSecs" label="首件切削时间" width="100">
                                <template #default="scope">
                                    {{ convertSeconds(scope.row.firstWorkingSecs || 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 #default="scope">
                                    {{ convertSeconds(scope.row.processingSecs || 0) }}
                                </template>
                            </el-table-column>
                            <el-table-column prop="prepareSecs" label="准备时间" width="80">
                                <template #default="scope">
                                    {{ convertSeconds(scope.row.prepareSecs || 0) }}
                                </template>
                            </el-table-column>
                            <el-table-column prop="singleProcessSecs" label="单件工时" width="80">
                                <template #default="scope">
                                    {{ convertSeconds(scope.row.singleProcessSecs || 0) }}
                                </template>
                            </el-table-column>
                            <el-table-column prop="amount" label="数量" width="60"></el-table-column>
                        </el-table>
                    </el-main>
                    <el-footer>
@@ -105,8 +120,10 @@
    data() {
        return {
            searchInfo: {
                test: "",
                time: ""
              "endDate": "",
              "partNo": "",
              "startDate": "",
              "workstationName": ""
            },
            tabPosition: "设备结构树",
            tableData: [],
@@ -114,14 +131,74 @@
        }
    },
    created() {
        var obj = {test:1}
        for(var i=0;i<10;i++) {
            this.tableData.push(obj);
        }
        // var obj = {test:1}
        // for(var i=0;i<10;i++) {
        //     this.tableData.push(obj);
        // }
    },
    mounted() {
        //this.getTableData();
    },
    methods: {
        convertSeconds(seconds) {  //转换时间
            // 定义时间单位转换关系
            const daysInSeconds = 24 * 60 * 60;
            const hoursInSeconds = 60 * 60;
            const minutesInSeconds = 60;
            // 计算天数
            let days = Math.floor(seconds / daysInSeconds);
            seconds %= daysInSeconds;
            // 计算小时数
            let hours = Math.floor(seconds / hoursInSeconds);
            seconds %= hoursInSeconds;
            // 计算分钟数
            let minutes = Math.floor(seconds / minutesInSeconds);
            seconds %= minutesInSeconds;
            // 准备结果数组
            let result = [];
            // 根据需要添加天数到结果数组
            if (days > 0) {
                result.push(`${days}天`);
            }
            // 根据需要添加小时数到结果数组
            if (hours > 0) {
                result.push(`${hours}小时`);
            }
            // 根据需要添加分钟数到结果数组
            if (minutes > 0) {
                result.push(`${minutes}分钟`);
            }
            // 始终添加秒数到结果数组(因为秒数总是有意义的)
            result.push(`${seconds}秒`);
            // 返回格式化后的字符串
            return result.join(' ');
        },
        changeStartDate(val) {
            console.log(val,111)
        },
        searchBtn() {
            this.getTableData();
        },
        getTableData() {
            console.log(this.searchInfo,111)
            this.$HTTP.post('/workinghour/page?current=1&size=20', this.searchInfo).then(res => {
                if (res.code === 200) {
                    res.data.records.forEach((item,index)=> {
                        item.index = index + 1;
                    })
                    this.tableData = res.data.records;
                }
            })
        },
        goFirstWorkDetail() {
            this.$router.push({path: `/mdc/first-workpiece-detail`,query: {id:1}})
        },
vue.config.js
@@ -23,23 +23,23 @@
        port: process.env.VUE_APP_PORT, //挂载端口
        proxy: {
            '/api/smart-collect': {
                target: 'http://120.46.212.231:4102',
                target: 'http://120.46.212.231:5102',
                // ws: true,
                changeOrigin: true,
                pathRewrite: {
                    '^/api': '/'
                }
            },
            // '/api/smis/workstation/listDatapointsByWorkstationId': {
            //     target: 'http://120.46.212.231:4102',
            //     // ws: true,
            //     changeOrigin: true,
            //     pathRewrite: {
            //         '^/api': '/'
            //     }
            // },
            'workinghour': {
                target: 'http://120.46.212.231:5102',
                // ws: true,
                changeOrigin: true,
                pathRewrite: {
                    '^/api': '/'
                }
            },
            '/api/smis/workstation/saveDatapoints': {
                target: 'http://120.46.212.231:4102',
                target: 'http://120.46.212.231:5102',
                // ws: true,
                changeOrigin: true,
                pathRewrite: {
@@ -47,7 +47,7 @@
                }
            },
            '/api/smis/workstation/export-dp': {
                target: 'http://120.46.212.231:4102',
                target: 'http://120.46.212.231:5102',
                // ws: true,
                changeOrigin: true,
                pathRewrite: {