gaoshp
2024-11-03 3e091224ab26252d8624b42b461ba773ee8bee0f
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-03 19:15:51
 * @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: ''
@@ -217,7 +217,7 @@
                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 => {
@@ -243,28 +243,35 @@
                ...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)
                }
                console.log(this.list, '>>>>>>>>>>//////1')
            })
        },
        setLineOptions(data, myname) {
@@ -301,13 +308,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 +337,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,
@@ -407,7 +414,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