gaoshp
2024-11-04 eef1ef0be935d4a3d8fc691b2666f41796b2d4a5
src/views/mdc/processParam/index.vue
@@ -1,7 +1,7 @@
<!--
 * @Date: 2024-04-09 22:11:21
 * @LastEditors: gaoshp
 * @LastEditTime: 2024-10-27 14:55:20
 * @LastEditTime: 2024-11-04 19:16:35
 * @FilePath: /cps-web/src/views/mdc/processParam/index.vue
 实时看板
-->
@@ -37,10 +37,10 @@
                        </el-row>
                        <TimeLine v-model="timeRange" ref="timeLine"></TimeLine>
                        <el-collapse v-model="activeList">
                            <el-collapse-item :title="item.deLabel" :name="index" v-for="(item, index) in list"
                            <el-collapse-item :title="item.dpLabel" :name="index" v-for="(item, index) in list"
                                :key="index">
                                <div
                                    v-if="(['DeviceStatus', 'ProcessProgram'].includes(item.name) && item?.dayCharts?.series?.length > 1) || (!['DeviceStatus', 'ProcessProgram'].includes(item.name) && item?.dayCharts?.series?.length > 0) && activeList.indexOf(index) > -1">
                                    v-if="(item.paramChartType == 'distribute' && item?.dayCharts?.series?.length > 1) || (item.paramChartType !== 'distribute' && item?.dayCharts?.series?.length > 0) && activeList.indexOf(index) > -1">
                                    <div>
                                        <el-button size="small" @click="viewData(item)">查看数据</el-button>
                                    </div>
@@ -150,7 +150,7 @@
        },
        save() {
            console.log(this.checkedCities)
            this.$HTTP.post(`/api/blade-mdc/process-parameter/excel/export`, {
            this.$HTTP.post(`/api/mdc/process-parameter/excel/export`, {
                collectItem: this.list.filter(v => this.checkedCities.includes(v.id)),
                endTime: this.timeRange.endTime,
                startTime: this.timeRange.startTime,
@@ -172,7 +172,7 @@
            this.visible = true
        },
        init() {
            this.$HTTP.get('/api/blade-mdc/process-parameter').then(res => {
            this.$HTTP.get('/api/mdc/process-parameter').then(res => {
                if (res.code === 200) {
                    this.legend = res.data
                }
@@ -181,10 +181,10 @@
        viewData(item) {
            this.drawerName = item.dpLabel
            this.$HTTP.post('/api/blade-mdc/process-parameter/item?current=1&size=1500', {
            this.$HTTP.post('/api/mdc/process-parameter/item?current=1&size=1500', {
                endTime: this.timeRange.endTime,
                startTime: this.timeRange.startTime,
                item: item.name,
                item: item.dpName,
                methodEnum: "HOUR",
                workstationId: this.treeChecked.toString(),
                workstationName: ''
@@ -211,15 +211,13 @@
        },
        query() {
            if (!this.treeChecked.toString()) return
            console.log(this.treeChecked.toString(), '>>>>>>>>>/')
            this.$refs?.timeLine?.init({
                dates: this.time,
                workstationId: this.treeChecked.toString()
            })
            this.list = []
            this.$HTTP.get('/api/blade-mdc/process-parameter/params', { workstationId: this.treeChecked.toString() }).then(res => {
            this.$HTTP.get('/api/mdc/process-parameter/params', { workstationId: this.treeChecked.toString() }).then(res => {
                if (res.code === 200) {
                    console.log('jkjkjkjkj', this.list)
                    this.list = res.data.map(v => {
                        let name = v.isProcessParam ? 'ProcessProgram' : v.dpName
                        return {
@@ -243,27 +241,33 @@
                ...this.list[index],
                dayCharts: {}
            })
            this.$HTTP.post('/api/blade-mdc/process-parameter/chart/dmp-item', {
            let params = { ...item }
            try {
                delete params.name
                delete params.height
            } catch (err) { console.error(err) }
            this.$HTTP.post('/api/mdc/process-parameter/chart/dmp-item', {
                methodEnum: "HOUR",
                startTime: this.timeRange.startTime,
                endTime: this.timeRange.endTime,
                workstationId: this.treeChecked.toString(),
                workstationName: '',
                dmpDTO: {
                dpDTO: {
                    id: this.treeChecked.toString(),
                    dmpDeviced: item.dmpDeviceId,
                    name: item.name,
                    description: item.description,
                    dataType: item.dataType,
                    wcsDataType: item.wcsDataType,
                    processParameter: item.processParameter
                    // name: item.name,
                    ...params
                    // dmpDeviced: item.dmpDeviceId,
                    // description: item.description,
                    // dataType: item.dataType,
                    // wcsDataType: item.wcsDataType,
                    // processParameter: item.processParameter
                }
            }).then(res => {
                // if (['DeviceStatus', 'ProcessProgram'].includes(item.name)) {
                if (item.paramChartType === 'distribute') {
                    this.setDeviceStatusOptions(res.data, item.name)
                    this.setDeviceStatusOptions(res.data, item.dpName)
                } else {
                    this.setLineOptions(res.data.data, item.name)
                    this.setLineOptions(res.data.data, item.dpName)
                }
            })
        },
@@ -301,13 +305,13 @@
                },
            }
            if (yAxisData?.length == 0) {
                let index = this.list.findIndex(item => item.name === myname)
                let index = this.list.findIndex(item => item.dpName === myname)
                this.list[index] = Object.assign({
                    ...this.list[index],
                    dayCharts: {}
                })
            } else {
                let index = this.list.findIndex(item => item.name === myname)
                let index = this.list.findIndex(item => item.dpName === myname)
                this.list[index] = Object.assign({
                    ...this.list[index],
                    dayCharts
@@ -330,9 +334,9 @@
                let current = Math.abs(moment(start).diff(moment(item.time)))
                start = item.time
                let name = i === 0 ? '' : data.data[i - 1].name
                if (myname === 'ProcessProgram') {
                    name = item.value
                }
                // if (myname === 'ProcessProgram') {
                name = item.value
                // }
                // let color = !name ? 'transparent' : data.data[i - 1].color
                return {
                    name,
@@ -357,7 +361,7 @@
                    tooltip: {
                        show: true,
                        trigger: 'item',
                        position: 'top',
                        // position: 'top',
                        triggerOn: 'click',
                        formatter: (value, ticket) => {
                            // console.log('----------1111')
@@ -406,8 +410,7 @@
                    },
                },
            }
            console.log(dayCharts, '>>>>>>>???')
            let index = this.list.findIndex(item => item.name === myname)
            let index = this.list.findIndex(item => item.dpName === myname)
            this.list[index] = Object.assign({
                ...this.list[index],
                dayCharts