gaoshp
2024-04-18 71f58f33a8bd79e66d5cc70e62c1a7daa2861e30
update
已添加2个文件
已修改2个文件
256 ■■■■ 文件已修改
package.json 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/mdc/components/Shift.vue 168 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/mdc/components/Time.vue 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/mdc/efficiency-analysis.vue 68 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
package.json
@@ -20,6 +20,7 @@
        "deepmerge": "^1.5.2",
        "echarts": "5.4.1",
        "element-plus": "2.2.32",
        "moment": "^2.30.1",
        "nprogress": "0.2.0",
        "qrcodejs2": "0.0.2",
        "qs": "6.7.0",
src/views/mdc/components/Shift.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,168 @@
<!--
 * @Date: 2024-04-18 21:52:18
 * @LastEditors: Sneed
 * @LastEditTime: 2024-04-18 23:43:13
 * @FilePath: /belleson-frontend/Users/mache/Documents/demo/cps-web/src/views/mdc/components/Shift.vue
-->
<template>
    <el-row>
        <el-col>
            <el-button-group>
                <el-button :type="btnListActive == item.id ? 'primary' : ''" v-for="item in btnList" :key="item.id">{{
                    item.title }}</el-button>
            </el-button-group>
        </el-col>
        <el-col>
            <el-card shadow="never">
                <scEcharts height="300px" :option="option2"></scEcharts>
            </el-card>
        </el-col>
        <el-col>
            ç»Ÿè®¡æ•°æ®
        </el-col>
        <el-col>
            <scTable ref="table" row-key="id" border :params="params" :apiObj="apiObj" stripe>
                <el-table-column prop="workstationCode" label="工位编码" />
                <el-table-column prop="workstationName" label="工位名称" />
                <el-table-column prop="" label="班次1">
                    <template #default="scope">
                        <span>{{ scope.row.nameData['1'] }}</span>
                    </template>
                </el-table-column>
                <el-table-column prop="" label="效率">
                    <template #default="scope">
                        <span>{{ scope.row.data['1'] }}</span>
                    </template>
                </el-table-column>
                <el-table-column prop="" label="班次2">
                    <template #default="scope">
                        <span>{{ scope.row.nameData['2'] }}</span>
                    </template>
                </el-table-column>
                <el-table-column prop="" label="效率">
                    <template #default="scope">
                        <span>{{ scope.row.data['2'] }}</span>
                    </template>
                </el-table-column>
            </scTable>
        </el-col>
    </el-row>
</template>
<script>
import scEcharts from '@/components/scEcharts';
export default {
    components: {
        scEcharts
    },
    data() {
        return {
            apiObj: '',
            params: {},
            statisticalMethod: 'SHIFT',
            btnList: [],
            btnListActive: '',
            chartsData: [],
            option2: {
                title: {
                    text: '统计图表',
                    subtext: '基础折线图',
                },
                grid: {
                    top: '80px'
                },
                tooltip: {
                    trigger: 'axis'
                },
                xAxis: {
                    type: 'category',
                    data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
                },
                yAxis: {
                    type: 'value'
                },
                series: [{
                    data: [120, 200, 150, 80, 70, 110, 130],
                    type: 'line',
                },
                {
                    data: [110, 180, 120, 120, 60, 90, 110],
                    type: 'line',
                }]
            },
        }
    },
    methods: {
        init(params) {
            this.getTime({
                endDate: params.endDate,
                startDate: params.startDate,
                statisticalMethod: this.statisticalMethod
            }).then(res => {
                this.query({
                    ...params,
                    startDate: this.btnListActive,
                    endDate: this.btnListActive
                })
                this.queryChart({
                    ...params,
                    startDate: this.btnListActive,
                    endDate: this.btnListActive
                })
            })
        },
        getTime(data) {
            return this.$HTTP.post('/api/blade-mdc/efficiency-analysis/interval', {
                ...data
            }).then(res => {
                if (res.code === 200) {
                    this.btnList = res.data
                    this.btnListActive = res?.data?.[0]?.id
                }
            })
        },
        queryChart(data) {
            let params = {
                size: -1
            }
            let dataSend = {
                ...data,
                queryType: 0,
                statisticalMethod: this.statisticalMethod
            }
            return this.$HTTP.post('/api/blade-mdc/efficiency-analysis', dataSend, { params }).then(res => {
                this.chartsData = res.data.items.records
            })
        },
        query(params) {
            this.params = params
            this.apiObj = {
                get: async (data) => {
                    let params = {
                        current: data.current,
                        size: data.size
                    }
                    let dataSend = {
                        ...data,
                        queryType: 1,
                        statisticalMethod: this.statisticalMethod
                    }
                    delete dataSend.current
                    delete dataSend.size
                    delete dataSend.order
                    delete dataSend.prop
                    return await this.$HTTP.post('/api/blade-mdc/efficiency-analysis', dataSend, { params }).then(res => {
                        return {
                            ...res,
                            data: res.data.items
                        }
                    })
                }
            }
        }
    }
}
</script>
<style lang="scss" scoped></style>
src/views/mdc/components/Time.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,19 @@
<!--
 * @Date: 2024-04-18 21:52:28
 * @LastEditors: Sneed
 * @LastEditTime: 2024-04-18 21:54:53
 * @FilePath: /belleson-frontend/Users/mache/Documents/demo/cps-web/src/views/mdc/components/Time.vue
-->
<template>
    <div>
    </div>
</template>
<script>
export default {
}
</script>
<style lang="scss" scoped></style>
src/views/mdc/efficiency-analysis.vue
@@ -1,7 +1,7 @@
<!--
 * @Date: 2024-04-09 22:11:21
 * @LastEditors: Sneed
 * @LastEditTime: 2024-04-18 21:48:13
 * @LastEditTime: 2024-04-18 22:47:36
 * @FilePath: /belleson-frontend/Users/mache/Documents/demo/cps-web/src/views/mdc/efficiency-analysis.vue
 * æ•ˆçŽ‡åˆ†æž
-->
@@ -22,8 +22,8 @@
                                </el-col>
                                <el-col style="margin-top: 14px;">日期</el-col>
                                <el-col>
                                    <el-date-picker style="width: 250px" v-model="time" type="daterange"
                                        range-separator="-" start-placeholder="" end-placeholder="" />
                                    <el-date-picker value-format="YYYY-MM-DD" style="width: 250px" v-model="time"
                                        type="daterange" range-separator="-" start-placeholder="" end-placeholder="" />
                                </el-col>
                            </el-row>
                            <el-row style="margin-top: 14px;">
@@ -32,20 +32,22 @@
                            <MYTree v-model="treeChecked" show-checkbox></MYTree>
                        </el-main>
                        <el-footer>
                            <el-button>查询</el-button>
                            <el-button @click="query">查询</el-button>
                            <el-button>导出</el-button>
                        </el-footer>
                    </el-container>
                </el-aside>
                <el-container>
                    <el-tabs tab-position="top" v-model="activeName">
                        <el-tab-pane label="按班次统计" name="ban">
                        </el-tab-pane>
                        <el-tab-pane label="按时间周期统计" name="time">
                        </el-tab-pane>
                    </el-tabs>
                    <el-main>
                        <el-tabs tab-position="top" v-model="activeName" type="card">
                            <el-tab-pane label="按班次统计" name="shift">
                                <Shift ref="shift" v-if="activeName == 'shift'" />
                            </el-tab-pane>
                            <el-tab-pane label="按时间周期统计" name="time">
                                <Time ref="time" v-if="activeName == 'time'" />
                            </el-tab-pane>
                        </el-tabs>
                    </el-main>
                </el-container>
            </el-container>
        </el-card>
@@ -53,21 +55,28 @@
</template>
<script>
import moment from 'moment';
import MYTree from './MYTree.vue'
import Shift from './components/Shift.vue'
import Time from './components/Time.vue'
export default {
    components: {
        MYTree,
        Shift,
        Time
    },
    watch: {
        treeChecked(value) {
            this.query(value)
            // this.query(value)
        }
    },
    data() {
        return {
            activeName: '',
            productivityType: '',
            activeName: 'shift',
            productivityType: 'OEE',
            time: [],
            treeChecked: [],
            options: [
                {
                    label: '稼动率',
@@ -84,21 +93,28 @@
            ]
        }
    },
    created() {
        this.time = [moment().format('YYYY-MM-DD'), moment().format('YYYY-MM-DD')]
    },
    mounted() {
        this.query()
    },
    methods: {
        query(vals) {
            console.log([...vals])
            this.$HTTP.post('/api/blade-mdc/efficiency-analysis/interval', {
                endDate: this.time[0],
                startDate: this.time[1],
                statisticalMethod: 'SHIFT'
        query() {
            this.$refs[this.activeName].init({
                endDate: this.time[1],
                startDate: this.time[0],
                productivityType: this.productivityType,
                shiftIndexList: [1, 2],
                workStationIdList: [...this.treeChecked]
            })
            this.$HTTP.post('/api/blade-mdc/efficiency-analysis?size=-1', {
            // this.$HTTP.post('/api/blade-mdc/efficiency-analysis?size=-1', {
            })
            this.$HTTP.post('/api/blade-mdc/efficiency-analysis?current=1&size=15', {
            // })
            // this.$HTTP.post('/api/blade-mdc/efficiency-analysis?current=1&size=15', {
            })
            this.$HTTP.post('/api/blade-cps/workstation-wcs-feedback/feedback-status', [...vals])
            // })
            // this.$HTTP.post('/api/blade-cps/workstation-wcs-feedback/feedback-status', [...vals])
        }
    }
}