riku
2024-08-01 59b6bafdf03464ad5d89a74623ec8941dec415c7
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<template>
  <el-card shadow="hover">
    <div>新设备</div>
    <div v-if="device">{{ device.name }}</div>
    <div v-else>未选择</div>
    <el-divider></el-divider>
    <div>监管场景</div>
    <div v-if="scene">{{ scene.name }}</div>
    <div v-else>未选择</div>
    <template #footer>
      <el-row justify="space-between">
        <div>
          <!-- <el-button type="primary" plain :disabled="!enabled">名称同步</el-button> -->
          <el-button type="primary" plain :disabled="!enabled">录入设备信息</el-button>
        </div>
        <el-button type="danger" :disabled="!enabled">上传匹配信息</el-button>
      </el-row>
      <el-row></el-row>
    </template>
  </el-card>
</template>
<script setup>
import { ref, computed, watch } from 'vue';
import deviceApi from '@/api/fysp/deviceApi';
 
const props = defineProps({
  device: Object,
  scene: Object
});
 
const deviceList = ref([]);
 
const enabled = computed(() => {
  return props.device && props.scene;
});
 
watch(
  () => props.scene,
  (nV, oV) => {
    if (nV != oV) {
      fetchDeviceInfo();
    }
  }
);
 
function fetchDeviceInfo() {
  deviceApi.fetchDevice(props.scene.guid).then((res) => {
    deviceList.value = res.data;
  });
}
</script>