| | |
| | | >录入设备信息</el-button |
| | | > |
| | | </div> |
| | | <el-button type="danger" :disabled="!enabled">上传匹配信息</el-button> |
| | | <el-button type="danger" :disabled="!enabled" @click="uploadMatchScene" |
| | | >上传匹配信息</el-button |
| | | > |
| | | </el-row> |
| | | <div v-if="newDevice"> |
| | | <el-text>新增设备</el-text> |
| | | <FormDevice :form-info="newDevice" :is-edit="true" ></FormDevice> |
| | | <FormDevice :form-info="newDevice" :is-edit="true"></FormDevice> |
| | | </div> |
| | | <div v-if="deviceList.length > 0"> |
| | | <el-text>已有设备</el-text> |
| | |
| | | <script setup> |
| | | import { ref, computed, watch } from 'vue'; |
| | | import deviceApi from '@/api/fysp/deviceApi'; |
| | | import constructionApi from '@/api/additional-jingan/constructionApi'; |
| | | import { useFetchData } from '@/composables/fetchData'; |
| | | import { ElMessage } from 'element-plus'; |
| | | |
| | | import FormDevice from './FormDevice.vue'; |
| | | |
| | |
| | | device: Object, |
| | | scene: Object |
| | | }); |
| | | |
| | | const emit = defineEmits(['success']); |
| | | |
| | | // 新增设备信息 |
| | | const newDevice = ref(); |
| | |
| | | () => props.scene, |
| | | (nV, oV) => { |
| | | if (nV != oV) { |
| | | fetchDeviceInfo(); |
| | | // fetchDeviceInfo(); |
| | | } |
| | | } |
| | | ); |
| | |
| | | diRemoved: false |
| | | }; |
| | | } |
| | | |
| | | const { loading, fetchData } = useFetchData(); |
| | | /** |
| | | * 上传设备关联工地 |
| | | */ |
| | | function uploadMatchScene() { |
| | | const param = { |
| | | name: props.scene.name, |
| | | address: props.scene.location, |
| | | street: props.scene.townname, |
| | | lon: props.device.lon, |
| | | lat: props.device.lat, |
| | | sbCode: props.device.code, |
| | | sbName: props.device.name |
| | | }; |
| | | |
| | | fetchData(() => { |
| | | return constructionApi.uploadConstructionDevice(param).then((res) => { |
| | | ElMessage({ |
| | | message: res.message, |
| | | type: 'success' |
| | | }); |
| | | emit('success'); |
| | | }); |
| | | }); |
| | | } |
| | | </script> |