gaosp
2024-01-16 457caac77ecdcef92c98d5e7d4d6ac1f3227f520
update
已修改4个文件
54 ■■■■■ 文件已修改
src/container/Map/Map.vue 16 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/container/Map/addMachine.vue 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/container/workshop/device.vue 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/mixins/index.js 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/container/Map/Map.vue
@@ -1,7 +1,7 @@
<!--
 * @Date: 2024-01-05 23:47:53
 * @LastEditors: Sneed
 * @LastEditTime: 2024-01-16 00:19:18
 * @LastEditTime: 2024-01-16 01:03:35
 * @FilePath: /belleson-frontend/Users/mache/Documents/demo/mdc/src/container/Map/Map.vue
-->
<template>
@@ -46,7 +46,7 @@
            </div>
        </div>
        <el-dialog
        :title="添加设备"
        title="添加设备"
        :close-on-click-modal="false"
        width="20%"
        :visible.sync="addStatus">
@@ -182,6 +182,15 @@
        id (val) {
            if (!val) {
                this.map = []
            }else {
                // getRequest('machineList',{plantId: val}).then(res => {
                //         this.plantDeviceList = res.list.map(item => {
                //             return {
                //                 machineId: item.id,
                //                 machineName: item.machineName
                //             }
                //         }) || []
                //     })
            }
        },
        currentMap: {
@@ -266,7 +275,7 @@
        contextmenu(e) {
            console.log(e)
            if(this.status ===2) return
            if (!this.range.x) return
            if (this.range.x === undefined) return
            // if (this.range.x !=='') return 
            e.preventDefault()
            e.stopPropagation()
@@ -361,6 +370,7 @@
        addDevice (e,v) {
            e.stopPropagation()
            this.addStatus = true
            this.deviceId = ''
            this.currentAdd =  v
        },
        del () {
src/container/Map/addMachine.vue
@@ -1,14 +1,14 @@
<!--
 * @Date: 2024-01-10 22:28:38
 * @LastEditors: Sneed
 * @LastEditTime: 2024-01-14 15:04:42
 * @LastEditTime: 2024-01-16 00:45:48
 * @FilePath: /belleson-frontend/Users/mache/Documents/demo/mdc/src/container/Map/addMachine.vue
-->
<template>
    <div class="map-add">
        <div class="map-add-item">
            <span>机床名称</span>
            <el-input class="value" v-model="addInfo.name"></el-input>
            <el-input class="value" v-model="addInfo.machineName"></el-input>
        </div>
        <div class="map-add-item">
            <span>机床</span>
@@ -92,7 +92,7 @@
            workshopList: [],
            accountList: [],
            addInfo: {
                name: '',
                machineName: '',
                id: '',
                ip: '',
                port: '',
src/container/workshop/device.vue
@@ -1,13 +1,13 @@
<!--
 * @Date: 2024-01-13 20:46:33
 * @LastEditors: Sneed
 * @LastEditTime: 2024-01-16 00:32:38
 * @LastEditTime: 2024-01-16 01:08:39
 * @FilePath: /belleson-frontend/Users/mache/Documents/demo/mdc/src/container/workshop/device.vue
-->
<template>
    <div class="device-item">
        <el-checkbox class="care" v-model="care" @change="change"></el-checkbox>
        <p>{{ name }}</p>
        <p>{{ machineName }}</p>
        <div class="device-item-box">
            <div class="img">
                <span class="img-status" v-if="item.status === 'STOP'">停机</span>
@@ -68,18 +68,6 @@
            }
        }
    },
    computed: {
        name () {
            let name = ''
            let arr = [...this.deviceList,...this.plantDeviceList]
            arr.find(item => {
                if(item.machineId=== this.id) {
                    name = item.machineName
                }
            })
            return machineName
        }
    },
    data () {
        return {
            care: false,
@@ -95,6 +83,15 @@
        },
        cycleCount () {
            return this.info.cycleCount || 0
        },
        machineName () {
            try {
                let arr = [...this.deviceList,...this.plantDeviceList]
                return arr.find(item => item.machineId=== this.id).machineName
            } catch (error) {
                return this.id
            }
        }
    },
    methods: {
src/mixins/index.js
@@ -1,7 +1,7 @@
/*
 * @Date: 2024-01-07 22:18:41
 * @LastEditors: Sneed
 * @LastEditTime: 2024-01-16 00:36:21
 * @LastEditTime: 2024-01-16 01:02:46
 * @FilePath: /belleson-frontend/Users/mache/Documents/demo/mdc/src/mixins/index.js
 */
import { getUseDpts, getRequest } from '@/api/Api'
@@ -17,11 +17,12 @@
        id: {
            handler (val) {
                if(val) {
                    debugger
                    getRequest('machineList',{plantId: val}).then(res => {
                        this.plantDeviceList = res.list.map(item => {
                        this.plantDeviceList = res.data.list.map(item => {
                            return {
                                machineId: item.id,
                                machineName: item.name
                                machineName: item.machineName
                            }
                        }) || []
                    })