增加预设点,接入萤石摄像
This commit is contained in:
		| @ -1,145 +0,0 @@ | ||||
| <template>   | ||||
|   <div class="system-ys7Devices-add"> | ||||
|     <!-- 添加或修改荧石摄像头对话框 --> | ||||
|     <el-dialog v-model="isShowDialog" width="769px" :close-on-click-modal="false" :destroy-on-close="true"> | ||||
|       <template #header> | ||||
|         <div v-drag="['.system-ys7Devices-add .el-dialog', '.system-ys7Devices-add .el-dialog__header']">添加荧石摄像头</div> | ||||
|       </template> | ||||
|       <el-form ref="formRef" :model="formData" :rules="rules" label-width="90px">         | ||||
|         <el-form-item label="设备序列号" prop="deviceSerial"> | ||||
|           <el-input v-model="formData.deviceSerial" placeholder="请输入设备串号" /> | ||||
|         </el-form-item>         | ||||
|         <el-form-item label="设备名称" prop="deviceName"> | ||||
|           <el-input v-model="formData.deviceName" placeholder="请输入设备名称" /> | ||||
|         </el-form-item>         | ||||
|         <el-form-item label="设备类型" prop="deviceType"> | ||||
|           <el-input v-model="formData.deviceType" placeholder="请输入设备类型" /> | ||||
|         </el-form-item>         | ||||
|         <!-- <el-form-item label="状态" prop="status"> | ||||
|           <el-input v-model="formData.status" placeholder="请输入状态" /> | ||||
|         </el-form-item>         | ||||
|         <el-form-item label="" prop="defence"> | ||||
|           <el-input v-model="formData.defence" placeholder="请输入" /> | ||||
|         </el-form-item>         --> | ||||
|         <el-form-item label="设备版本" prop="deviceVersion"> | ||||
|           <el-input v-model="formData.deviceVersion" placeholder="请输入设备版本" /> | ||||
|         </el-form-item>         | ||||
|         <!-- <el-form-item label="项目ID" prop="projectId"> | ||||
|           <el-input v-model="formData.projectId" placeholder="请输入项目ID" /> | ||||
|         </el-form-item>        --> | ||||
|       </el-form> | ||||
|       <template #footer> | ||||
|         <div class="dialog-footer"> | ||||
|           <el-button type="primary" @click="onSubmit">确 定</el-button> | ||||
|           <el-button @click="onCancel">取 消</el-button> | ||||
|         </div> | ||||
|       </template> | ||||
|     </el-dialog> | ||||
|   </div> | ||||
| </template> | ||||
| <script lang="ts"> | ||||
| import { reactive, toRefs, defineComponent,ref,unref,getCurrentInstance } from 'vue'; | ||||
| import {ElMessageBox, ElMessage, FormInstance,UploadProps} from 'element-plus'; | ||||
| import { | ||||
|   listYs7Devices, | ||||
|   getYs7Devices, | ||||
|   delYs7Devices, | ||||
|   addYs7Devices, | ||||
|   updateYs7Devices,   | ||||
| } from "/@/api/system/ys7Devices"; | ||||
| import { | ||||
|   Ys7DevicesTableColumns, | ||||
|   Ys7DevicesInfoData, | ||||
|   Ys7DevicesTableDataState, | ||||
|   Ys7DevicesEditState,   | ||||
| } from "/@/views/system/ys7Devices/list/component/model" | ||||
| export default defineComponent({ | ||||
|   name:"apiV1SystemYs7DevicesEdit", | ||||
|   components:{     | ||||
|   }, | ||||
|   props:{     | ||||
|   }, | ||||
|   setup(props,{emit}) {     | ||||
|     const {proxy} = <any>getCurrentInstance() | ||||
|     const formRef = ref<HTMLElement | null>(null); | ||||
|     const menuRef = ref();     | ||||
|     const state = reactive<Ys7DevicesEditState>({ | ||||
|       loading:false, | ||||
|       isShowDialog: false, | ||||
|       formData: {         | ||||
|         id: undefined,         | ||||
|         createdAt: undefined,         | ||||
|         deviceSerial: undefined,         | ||||
|         deviceName: undefined,         | ||||
|         deviceType: undefined,         | ||||
|         status: undefined,         | ||||
|         defence: undefined,         | ||||
|         deviceVersion: undefined,         | ||||
|         projectId: undefined,         | ||||
|       }, | ||||
|       // 表单校验 | ||||
|       rules: {         | ||||
|         id : [ | ||||
|             { required: true, message: "id不能为空", trigger: "blur" } | ||||
|         ],         | ||||
|       } | ||||
|     }); | ||||
|     // 打开弹窗 | ||||
|     const openDialog = () => { | ||||
|       resetForm(); | ||||
|       state.isShowDialog = true; | ||||
|     }; | ||||
|     // 关闭弹窗 | ||||
|     const closeDialog = () => { | ||||
|       state.isShowDialog = false; | ||||
|     }; | ||||
|     // 取消 | ||||
|     const onCancel = () => { | ||||
|       closeDialog(); | ||||
|     }; | ||||
|     // 提交 | ||||
|     const onSubmit = () => { | ||||
|       const formWrap = unref(formRef) as any; | ||||
|       if (!formWrap) return; | ||||
|       formWrap.validate((valid: boolean) => { | ||||
|         if (valid) { | ||||
|           state.loading = true; | ||||
|           //添加 | ||||
|           addYs7Devices(state.formData).then(()=>{ | ||||
|               ElMessage.success('添加成功'); | ||||
|               closeDialog(); // 关闭弹窗 | ||||
|               emit('ys7DevicesList') | ||||
|             }).finally(()=>{ | ||||
|               state.loading = false; | ||||
|             }) | ||||
|         } | ||||
|       }); | ||||
|     }; | ||||
|     const resetForm = ()=>{ | ||||
|       state.formData = {         | ||||
|         id: undefined,         | ||||
|         createdAt: undefined,         | ||||
|         deviceSerial: undefined,         | ||||
|         deviceName: undefined,         | ||||
|         deviceType: undefined,         | ||||
|         status: undefined,         | ||||
|         defence: undefined,         | ||||
|         deviceVersion: undefined,         | ||||
|         projectId: undefined,         | ||||
|       } | ||||
|     };     | ||||
|     return { | ||||
|       proxy, | ||||
|       openDialog, | ||||
|       closeDialog, | ||||
|       onCancel, | ||||
|       onSubmit, | ||||
|       menuRef, | ||||
|       formRef,       | ||||
|       ...toRefs(state), | ||||
|     }; | ||||
|   } | ||||
| }) | ||||
| </script> | ||||
| <style scoped>   | ||||
| </style> | ||||
| @ -49,10 +49,14 @@ const state = reactive({ | ||||
|  | ||||
| const openDialog = (row: any) => { | ||||
|   resetForm(); | ||||
|  | ||||
|   if (row.row && row.row.id) { | ||||
|     state.formData.id = row.row.id; | ||||
|   if (row.serials.length) { | ||||
|     state.formData.id = row.serials; | ||||
|   } | ||||
|   if (row.row && row.row.id) { | ||||
|     state.formData.id = [row.row.id]; | ||||
|   } | ||||
|   console.log('🚀 ~ openDialog ~ state.formData:', state.formData); | ||||
|  | ||||
|   state.isShowDialog = true; | ||||
| }; | ||||
|  | ||||
|  | ||||
| @ -1,149 +0,0 @@ | ||||
| <template> | ||||
|   <!-- 荧石摄像头详情抽屉 -->   | ||||
|   <div class="system-ys7Devices-detail"> | ||||
|     <el-drawer v-model="isShowDialog" size="80%" direction="ltr"> | ||||
|       <template #header> | ||||
|         <h4>荧石摄像头详情</h4> | ||||
|       </template> | ||||
|       <el-form ref="formRef" :model="formData" label-width="100px">           | ||||
|         <el-row>           | ||||
|           <el-col :span="12"> | ||||
|             <el-form-item label="创建时间">{{ proxy.parseTime(formData.createdAt, '{y}-{m}-{d} {h}:{i}:{s}') }}</el-form-item> | ||||
|           </el-col>         | ||||
|           <el-col :span="12">           | ||||
|             <el-form-item label="设备串号">{{ formData.deviceSerial }}</el-form-item>           | ||||
|           </el-col>         | ||||
|           <el-col :span="12">           | ||||
|             <el-form-item label="设备名称">{{ formData.deviceName }}</el-form-item>           | ||||
|           </el-col>         | ||||
|           <el-col :span="12">           | ||||
|             <el-form-item label="设备类型">{{ formData.deviceType }}</el-form-item>           | ||||
|           </el-col>         | ||||
|           <el-col :span="12">           | ||||
|             <el-form-item label="状态">{{ formData.status }}</el-form-item>           | ||||
|           </el-col>         | ||||
|           <!-- <el-col :span="12">           | ||||
|             <el-form-item label="">{{ formData.defence }}</el-form-item>           | ||||
|           </el-col>         --> | ||||
|           <el-col :span="12">           | ||||
|             <el-form-item label="设备版本">{{ formData.deviceVersion }}</el-form-item>           | ||||
|           </el-col>         | ||||
|           <el-col :span="12">           | ||||
|             <el-form-item label="所属项目">{{ formData.projectId }}</el-form-item>           | ||||
|           </el-col>       | ||||
|         </el-row>       | ||||
|       </el-form> | ||||
|     </el-drawer> | ||||
|   </div> | ||||
| </template> | ||||
| <script lang="ts"> | ||||
|   import { reactive, toRefs, defineComponent,ref,unref,getCurrentInstance,computed } from 'vue'; | ||||
|   import {ElMessageBox, ElMessage, FormInstance,UploadProps} from 'element-plus';   | ||||
|   import { | ||||
|     listYs7Devices, | ||||
|     getYs7Devices, | ||||
|     delYs7Devices, | ||||
|     addYs7Devices, | ||||
|     updateYs7Devices,     | ||||
|   } from "/@/api/system/ys7Devices";   | ||||
|   import { | ||||
|     Ys7DevicesTableColumns, | ||||
|     Ys7DevicesInfoData, | ||||
|     Ys7DevicesTableDataState, | ||||
|     Ys7DevicesEditState,     | ||||
|   } from "/@/views/system/ys7Devices/list/component/model" | ||||
|   export default defineComponent({ | ||||
|     name:"apiV1SystemYs7DevicesDetail", | ||||
|     components:{       | ||||
|     }, | ||||
|     props:{       | ||||
|     }, | ||||
|     setup(props,{emit}) {       | ||||
|       const {proxy} = <any>getCurrentInstance() | ||||
|       const formRef = ref<HTMLElement | null>(null); | ||||
|       const menuRef = ref();       | ||||
|       const state = reactive<Ys7DevicesEditState>({ | ||||
|         loading:false, | ||||
|         isShowDialog: false, | ||||
|         formData: {           | ||||
|           id: undefined,           | ||||
|           createdAt: undefined,           | ||||
|           deviceSerial: undefined,           | ||||
|           deviceName: undefined,           | ||||
|           deviceType: undefined,           | ||||
|           status: undefined,           | ||||
|           defence: undefined,           | ||||
|           deviceVersion: undefined,           | ||||
|           projectId: undefined,           | ||||
|         }, | ||||
|         // 表单校验 | ||||
|         rules: {           | ||||
|           id : [ | ||||
|               { required: true, message: "id不能为空", trigger: "blur" } | ||||
|           ],           | ||||
|         } | ||||
|       }); | ||||
|         // 打开弹窗 | ||||
|         const openDialog = (row?: Ys7DevicesInfoData) => { | ||||
|           resetForm(); | ||||
|           if(row) { | ||||
|             getYs7Devices(row.id!).then((res:any)=>{ | ||||
|               const data = res.data;               | ||||
|               state.formData = data;               | ||||
|             }) | ||||
|           } | ||||
|           state.isShowDialog = true; | ||||
|         }; | ||||
|         // 关闭弹窗 | ||||
|         const closeDialog = () => { | ||||
|           state.isShowDialog = false; | ||||
|         }; | ||||
|         // 取消 | ||||
|         const onCancel = () => { | ||||
|           closeDialog(); | ||||
|         }; | ||||
|         const resetForm = ()=>{ | ||||
|           state.formData = {             | ||||
|             id: undefined,             | ||||
|             createdAt: undefined,             | ||||
|             deviceSerial: undefined,             | ||||
|             deviceName: undefined,             | ||||
|             deviceType: undefined,             | ||||
|             status: undefined,             | ||||
|             defence: undefined,             | ||||
|             deviceVersion: undefined,             | ||||
|             projectId: undefined,             | ||||
|           } | ||||
|         };         | ||||
|         return { | ||||
|           proxy, | ||||
|           openDialog, | ||||
|           closeDialog, | ||||
|           onCancel, | ||||
|           menuRef, | ||||
|           formRef,           | ||||
|           ...toRefs(state), | ||||
|         }; | ||||
|       } | ||||
|   }) | ||||
| </script> | ||||
| <style scoped>   | ||||
|   .system-ys7Devices-detail :deep(.el-form-item--large .el-form-item__label){ | ||||
|     font-weight: bolder; | ||||
|   } | ||||
|   .pic-block{ | ||||
|     margin-right: 8px; | ||||
|   } | ||||
|   .file-block{ | ||||
|     width: 100%; | ||||
|     border: 1px solid var(--el-border-color); | ||||
|     border-radius: 6px; | ||||
|     cursor: pointer; | ||||
|     position: relative; | ||||
|     overflow: hidden; | ||||
|     transition: var(--el-transition-duration-fast); | ||||
|     margin-bottom: 5px; | ||||
|     padding: 3px 6px; | ||||
|   } | ||||
|   .ml-2{margin-right: 5px;} | ||||
| </style> | ||||
| @ -1,20 +1,22 @@ | ||||
| <template>   | ||||
| <template> | ||||
|   <div class="system-ys7Devices-edit"> | ||||
|     <!-- 添加或修改荧石摄像头对话框 --> | ||||
|     <el-dialog v-model="isShowDialog" width="769px" :close-on-click-modal="false" :destroy-on-close="true"  custom-class="ys7Devices_edit">  | ||||
|     <el-dialog v-model="isShowDialog" width="769px" :close-on-click-modal="false" :destroy-on-close="true" custom-class="ys7Devices_edit"> | ||||
|       <template #header> | ||||
|         <div v-drag="['.system-ys7Devices-edit .el-dialog', '.system-ys7Devices-edit .el-dialog__header']">{{(!formData.id || formData.id==0?'添加':'修改')+'荧石摄像头'}}</div> | ||||
|         <div v-drag="['.system-ys7Devices-edit .el-dialog', '.system-ys7Devices-edit .el-dialog__header']"> | ||||
|           {{ (!formData.id || formData.id == 0 ? '添加' : '修改') + '荧石摄像头' }} | ||||
|         </div> | ||||
|       </template> | ||||
|       <el-form ref="formRef" :model="formData" :rules="rules" label-width="90px">         | ||||
|       <el-form ref="formRef" :model="formData" :rules="rules" label-width="90px"> | ||||
|         <el-form-item label="设备序列号" prop="deviceSerial"> | ||||
|           <el-input v-model="formData.deviceSerial" placeholder="请输入设备串号"  disabled/> | ||||
|         </el-form-item>         | ||||
|           <el-input v-model="formData.deviceSerial" placeholder="请输入设备串号" disabled /> | ||||
|         </el-form-item> | ||||
|         <el-form-item label="设备名称" prop="deviceName"> | ||||
|           <el-input v-model="formData.deviceName" placeholder="请输入设备名称" /> | ||||
|         </el-form-item>         | ||||
|         </el-form-item> | ||||
|         <el-form-item label="设备类型" prop="deviceType"> | ||||
|           <el-input v-model="formData.deviceType" placeholder="请输入设备类型" /> | ||||
|         </el-form-item>         | ||||
|         </el-form-item> | ||||
|         <!-- <el-form-item label="状态" prop="status"> | ||||
|           <el-input v-model="formData.status" placeholder="请输入状态" /> | ||||
|         </el-form-item>         | ||||
| @ -23,10 +25,10 @@ | ||||
|         </el-form-item>         --> | ||||
|         <el-form-item label="设备版本" prop="deviceVersion"> | ||||
|           <el-input v-model="formData.deviceVersion" placeholder="请输入设备版本" /> | ||||
|         </el-form-item>  | ||||
|         </el-form-item> | ||||
|         <el-form-item label="备注" prop="remark"> | ||||
|           <el-input v-model="formData.remark" placeholder="请输入备注信息" /> | ||||
|         </el-form-item>         | ||||
|         </el-form-item> | ||||
|         <!-- <el-form-item label="项目ID" prop="projectId"> | ||||
|           <el-input v-model="formData.projectId" placeholder="请输入项目ID" /> | ||||
|         </el-form-item>        --> | ||||
| @ -40,135 +42,114 @@ | ||||
|     </el-dialog> | ||||
|   </div> | ||||
| </template> | ||||
| <script lang="ts"> | ||||
| import { reactive, toRefs, defineComponent,ref,unref,getCurrentInstance } from 'vue'; | ||||
| import {ElMessageBox, ElMessage, FormInstance,ElLoading} from 'element-plus'; | ||||
| import { | ||||
|   listYs7Devices, | ||||
|   getYs7Devices, | ||||
|   delYs7Devices, | ||||
|   addYs7Devices, | ||||
|   updateYs7Devices,   | ||||
| } from "/@/api/system/ys7Devices"; | ||||
| import { | ||||
|   Ys7DevicesTableColumns, | ||||
|   Ys7DevicesInfoData, | ||||
|   Ys7DevicesTableDataState, | ||||
|   Ys7DevicesEditState,   | ||||
| } from "/@/views/system/ys7Devices/list/component/model" | ||||
| export default defineComponent({ | ||||
|   name:"apiV1SystemYs7DevicesEdit", | ||||
|   components:{     | ||||
|   }, | ||||
|   props:{     | ||||
|   }, | ||||
|   setup(props,{emit}) {     | ||||
|     const {proxy} = <any>getCurrentInstance() | ||||
|     const formRef = ref<HTMLElement | null>(null); | ||||
|     const menuRef = ref();     | ||||
|     const state = reactive<Ys7DevicesEditState>({ | ||||
|       loading:false, | ||||
|       isShowDialog: false, | ||||
|       formData: {         | ||||
|         id: undefined,         | ||||
|         createdAt: undefined,         | ||||
|         deviceSerial: undefined,         | ||||
|         deviceName: undefined,         | ||||
|         deviceType: undefined,         | ||||
|         status: undefined,         | ||||
|         defence: undefined,         | ||||
|         deviceVersion: undefined,         | ||||
|         projectId: undefined,     | ||||
|         remark: undefined     | ||||
|       }, | ||||
|       // 表单校验 | ||||
|       rules: {         | ||||
|         id : [ | ||||
|             { required: true, message: "id不能为空", trigger: "blur" } | ||||
|         ],         | ||||
|       } | ||||
| <script setup lang="ts"> | ||||
| import { ref, getCurrentInstance } from 'vue'; | ||||
| import { ElMessage, ElLoading } from 'element-plus'; | ||||
|  | ||||
| import { getYs7Device, addYs7Device, updateYs7Device } from '@/api/other/ys7Device'; | ||||
| import { Ys7DeviceVO } from '@/api/other/ys7Device/types'; | ||||
|  | ||||
| const emit = defineEmits(['ys7DevicesList']); | ||||
|  | ||||
| const formRef = ref<HTMLElement | null>(null); | ||||
|  | ||||
| const isShowDialog = ref(false); | ||||
| const loading = ref(false); | ||||
|  | ||||
| const formData = ref({ | ||||
|   id: undefined, | ||||
|   createdAt: undefined, | ||||
|   deviceSerial: undefined, | ||||
|   deviceName: undefined, | ||||
|   deviceType: undefined, | ||||
|   status: undefined, | ||||
|   defence: undefined, | ||||
|   deviceVersion: undefined, | ||||
|   projectId: undefined, | ||||
|   remark: undefined | ||||
| }); | ||||
|  | ||||
| const rules = ref({ | ||||
|   id: [{ required: true, message: 'id不能为空', trigger: 'blur' }] | ||||
| }); | ||||
|  | ||||
| const resetForm = () => { | ||||
|   formData.value = { | ||||
|     id: undefined, | ||||
|     createdAt: undefined, | ||||
|     deviceSerial: undefined, | ||||
|     deviceName: undefined, | ||||
|     deviceType: undefined, | ||||
|     status: undefined, | ||||
|     defence: undefined, | ||||
|     deviceVersion: undefined, | ||||
|     projectId: undefined, | ||||
|     remark: undefined | ||||
|   }; | ||||
| }; | ||||
|  | ||||
| const openDialog = (row?: Ys7DeviceVO) => { | ||||
|   resetForm(); | ||||
|   const loadingInstance = ElLoading.service({ | ||||
|     lock: true, | ||||
|     text: '正在加载中……', | ||||
|     background: 'rgba(0, 0, 0, 0.7)', | ||||
|     target: '.ys7Devices_edit' | ||||
|   }); | ||||
|   if (row) { | ||||
|     getYs7Device(row.id!).then((res: any) => { | ||||
|       loadingInstance.close(); | ||||
|       formData.value = res.data; | ||||
|     }); | ||||
|     // 打开弹窗 | ||||
|     const openDialog = (row?: Ys7DevicesInfoData) => { | ||||
|       resetForm(); | ||||
|       const loading = ElLoading.service({ | ||||
| 					lock: true, | ||||
| 					text: '正在加载中……', | ||||
| 					background: 'rgba(0, 0, 0, 0.7)', | ||||
| 					target: '.ys7Devices_edit', | ||||
| 				}); | ||||
|       if(row) {         | ||||
|         getYs7Devices(row.id!).then((res:any)=>{ | ||||
|           loading.close(); | ||||
|           const data = res.data;           | ||||
|           state.formData = data; | ||||
|       }) | ||||
|     } | ||||
|       state.isShowDialog = true; | ||||
|     }; | ||||
|     // 关闭弹窗 | ||||
|     const closeDialog = () => { | ||||
|       state.isShowDialog = false; | ||||
|     }; | ||||
|     // 取消 | ||||
|     const onCancel = () => { | ||||
|       closeDialog(); | ||||
|     }; | ||||
|     // 提交 | ||||
|     const onSubmit = () => { | ||||
|       const formWrap = unref(formRef) as any; | ||||
|       if (!formWrap) return; | ||||
|       formWrap.validate((valid: boolean) => { | ||||
|         if (valid) { | ||||
|           state.loading = true; | ||||
|           if(!state.formData.id || state.formData.id===0){ | ||||
|             //添加 | ||||
|           addYs7Devices(state.formData).then(()=>{ | ||||
|               ElMessage.success('添加成功'); | ||||
|               closeDialog(); // 关闭弹窗 | ||||
|               emit('ys7DevicesList') | ||||
|             }).finally(()=>{ | ||||
|               state.loading = false; | ||||
|             }) | ||||
|           }else{ | ||||
|             //修改 | ||||
|           updateYs7Devices(state.formData).then(()=>{ | ||||
|               ElMessage.success('修改成功'); | ||||
|               closeDialog(); // 关闭弹窗 | ||||
|               emit('ys7DevicesList') | ||||
|             }).finally(()=>{ | ||||
|               state.loading = false; | ||||
|             }) | ||||
|           } | ||||
|         } | ||||
|       }); | ||||
|     }; | ||||
|     const resetForm = ()=>{ | ||||
|       state.formData = {         | ||||
|         id: undefined,         | ||||
|         createdAt: undefined,         | ||||
|         deviceSerial: undefined,         | ||||
|         deviceName: undefined,         | ||||
|         deviceType: undefined,         | ||||
|         status: undefined,         | ||||
|         defence: undefined,         | ||||
|         deviceVersion: undefined,         | ||||
|         projectId: undefined,     | ||||
|         remark: undefined         | ||||
|       } | ||||
|     };     | ||||
|     return { | ||||
|       proxy, | ||||
|       openDialog, | ||||
|       closeDialog, | ||||
|       onCancel, | ||||
|       onSubmit, | ||||
|       menuRef, | ||||
|       formRef,       | ||||
|       ...toRefs(state), | ||||
|     }; | ||||
|   } else { | ||||
|     loadingInstance.close(); | ||||
|   } | ||||
| }) | ||||
|   isShowDialog.value = true; | ||||
| }; | ||||
|  | ||||
| const closeDialog = () => { | ||||
|   isShowDialog.value = false; | ||||
| }; | ||||
|  | ||||
| const onCancel = () => { | ||||
|   closeDialog(); | ||||
| }; | ||||
|  | ||||
| const onSubmit = () => { | ||||
|   const formWrap = formRef.value as any; | ||||
|   if (!formWrap) return; | ||||
|   formWrap.validate((valid: boolean) => { | ||||
|     if (valid) { | ||||
|       loading.value = true; | ||||
|       if (!formData.value.id || formData.value.id === 0) { | ||||
|         addYs7Device(formData.value) | ||||
|           .then(() => { | ||||
|             ElMessage.success('添加成功'); | ||||
|             closeDialog(); | ||||
|             emit('ys7DevicesList'); | ||||
|           }) | ||||
|           .finally(() => { | ||||
|             loading.value = false; | ||||
|           }); | ||||
|       } else { | ||||
|         updateYs7Device(formData.value) | ||||
|           .then(() => { | ||||
|             ElMessage.success('修改成功'); | ||||
|             closeDialog(); | ||||
|             emit('ys7DevicesList'); | ||||
|           }) | ||||
|           .finally(() => { | ||||
|             loading.value = false; | ||||
|           }); | ||||
|       } | ||||
|     } | ||||
|   }); | ||||
| }; | ||||
|  | ||||
| // ✅ 关键:暴露方法给父组件调用 | ||||
| defineExpose({ | ||||
|   openDialog, | ||||
|   closeDialog | ||||
| }); | ||||
| </script> | ||||
| <style scoped>   | ||||
| </style> | ||||
| <style scoped></style> | ||||
|  | ||||
| @ -1,284 +1,281 @@ | ||||
| <template> | ||||
| 	<div class="system-busPresettingBit-add"> | ||||
| 		<el-dialog v-model="isShowDialog" width="1250px" :close-on-click-modal="false" :destroy-on-close="true"> | ||||
| 			<template #header> | ||||
| 				<div v-drag="['.system-busPresettingBit-add .el-dialog', '.system-busPresettingBit-add .el-dialog__header']"> | ||||
| 					{{ title }}:添加摄像头预置位 | ||||
| 				</div> | ||||
| 			</template> | ||||
| 			<div class="info_list"> | ||||
| 				<div class="video_box"> | ||||
| 					<div class="video-container" id="video-container" style="width: 870px; height: 600px"></div> | ||||
| 				</div> | ||||
| 				<div> | ||||
| 					<el-button type="primary" style="margin: 0 20px 10px" @click="addPre"> | ||||
| 						<el-icon><ele-Plus /></el-icon> | ||||
| 						添加预置点</el-button | ||||
| 					> | ||||
| 					<el-table v-loading="loading" :data="tableData.data" border> | ||||
| 						<el-table-column label="序号" align="center" type="index" width="50" /> | ||||
| 						<el-table-column label="名称" align="center" prop="name" width="100px" show-overflow-tooltip> | ||||
| 							<template #default="scope"> | ||||
| 								<el-input placeholder="请输入内容" v-model="scope.row.name" @change="handleEdit(scope.row)"></el-input> | ||||
| 							</template> | ||||
| 						</el-table-column> | ||||
| 						<el-table-column label="操作" align="center" width="130px"> | ||||
| 							<template #default="scope"> | ||||
| 								<el-button type="primary" link @click="handleDebug(scope.row)" | ||||
| 									><el-icon><ele-View /></el-icon>调用</el-button | ||||
| 								> | ||||
| 								<el-button type="danger" link @click="handleDelete(scope.row)" | ||||
| 									><el-icon><ele-DeleteFilled /></el-icon>删除</el-button | ||||
| 								> | ||||
| 							</template> | ||||
| 						</el-table-column> | ||||
| 					</el-table> | ||||
| 					<pagination | ||||
| 						style="padding: 5px 16px" | ||||
| 						v-show="tableData.total > 0" | ||||
| 						:total="tableData.total" | ||||
| 						v-model:page="tableData.param.pageNum" | ||||
| 						v-model:limit="tableData.param.pageSize" | ||||
| 						@pagination="busPresettingBitList" | ||||
| 						:layout="layout" | ||||
| 					/> | ||||
| 				</div> | ||||
| 			</div> | ||||
| 		</el-dialog> | ||||
| 	</div> | ||||
|   <div class="system-busPresettingBit-add"> | ||||
|     <el-dialog v-model="isShowDialog" width="1250px" :close-on-click-modal="false" :destroy-on-close="true"> | ||||
|       <template #header> | ||||
|         <div v-drag="['.system-busPresettingBit-add .el-dialog', '.system-busPresettingBit-add .el-dialog__header']"> | ||||
|           {{ title }}:添加摄像头预置位 | ||||
|         </div> | ||||
|       </template> | ||||
|       <div class="info_list"> | ||||
|         <div class="video_box"> | ||||
|           <div class="video-container" id="video-container" style="width: 870px; height: 600px"></div> | ||||
|         </div> | ||||
|         <div> | ||||
|           <el-button type="primary" style="margin: 0 20px 10px" @click="addPre"> | ||||
|             <el-icon><Plus /></el-icon> | ||||
|             添加预置点 | ||||
|           </el-button> | ||||
|           <el-table v-loading="loading" :data="tableData.data" border> | ||||
|             <el-table-column label="序号" align="center" type="index" width="55" /> | ||||
|             <el-table-column label="名称" align="center" prop="presetName" width="120px" show-overflow-tooltip> | ||||
|               <template #default="scope"> | ||||
|                 <el-input v-model="scope.row.presetName" placeholder="请输入内容" @change="handleEdit(scope.row)" /> | ||||
|               </template> | ||||
|             </el-table-column> | ||||
|             <el-table-column label="操作" align="center" width="135px"> | ||||
|               <template #default="scope"> | ||||
|                 <el-button type="primary" link @click="handleDebug(scope.row)"> | ||||
|                   <el-icon><View /></el-icon>调用 | ||||
|                 </el-button> | ||||
|                 <el-button type="danger" link @click="handleDelete(scope.row)"> | ||||
|                   <el-icon><DeleteFilled /></el-icon>删除 | ||||
|                 </el-button> | ||||
|               </template> | ||||
|             </el-table-column> | ||||
|           </el-table> | ||||
|           <pagination | ||||
|             style="padding: 5px 16px" | ||||
|             v-show="tableData.total > 0" | ||||
|             :total="tableData.total" | ||||
|             v-model:page="tableData.param.pageNum" | ||||
|             v-model:limit="tableData.param.pageSize" | ||||
|             @pagination="busPresettingBitList" | ||||
|             :layout="layout" | ||||
|           /> | ||||
|         </div> | ||||
|       </div> | ||||
|     </el-dialog> | ||||
|   </div> | ||||
| </template> | ||||
| <script lang="ts"> | ||||
| import { reactive, toRefs, defineComponent, ref, unref, getCurrentInstance, nextTick, onBeforeUnmount } from 'vue'; | ||||
| import { ElMessageBox, ElMessage } from 'element-plus'; | ||||
| import { | ||||
| 	listDevicePreset, | ||||
| 	getDevicePreset, | ||||
| 	addDevicePreset, | ||||
| 	updateDevicePreset, | ||||
| 	delDevicePreset, | ||||
| 	callDevicePreset, | ||||
| } from '/@/api/system/devicePreset'; | ||||
| import { getAccessToken } from '/@/api/system/ys7Devices'; | ||||
| export default defineComponent({ | ||||
| 	name: 'index', | ||||
| 	setup(props, { emit }) { | ||||
| 		const { proxy } = <any>getCurrentInstance(); | ||||
| 		const formRef = ref<HTMLElement | null>(null); | ||||
| 		const menuRef = ref(); | ||||
| 		const loading = ref(false); | ||||
| 		const state = reactive({ | ||||
| 			loading: false, | ||||
| 			isShowDialog: false, | ||||
| 			formData: { | ||||
| 				deviceSerial: undefined, | ||||
| 				channelNo: '1', | ||||
| 				presetName: undefined, | ||||
| 			}, | ||||
| 			layout: 'total, prev, pager, next', | ||||
| 			tableData: { | ||||
| 				data: [], | ||||
| 				total: 0, | ||||
| 				loading: false, | ||||
| 				param: { | ||||
| 					pageNum: 1, | ||||
| 					pageSize: 15, | ||||
| 					deviceSerial: '', | ||||
| 				}, | ||||
| 			}, | ||||
| 			// 表单校验 | ||||
| 			rules: {}, | ||||
| 			title: '', | ||||
| 			updateRow: null, | ||||
| 			src: null, | ||||
| 			flvPlayer: null, | ||||
| 		}); | ||||
| 		// 打开弹窗 | ||||
| 		const openDialog = (row) => { | ||||
| 			resetForm(); | ||||
| 			state.updateRow = row; | ||||
| 			state.title = row.deviceName; //摄像头名称 | ||||
| 			state.formData.deviceSerial = row.deviceSerial; | ||||
| 			state.tableData.param.deviceSerial = row.deviceSerial; | ||||
| 			state.isShowDialog = true; | ||||
| 			busPresettingBitList(); // 获取预置点列表数据 | ||||
| 			nextTick(() => { | ||||
| 				videoPlay(row); | ||||
| 			}); | ||||
| 		}; | ||||
| 		// 添加预置点 | ||||
| 		const addPre = () => { | ||||
| 			ElMessageBox.prompt('请输入预置点名称', '添加预置点', { | ||||
| 				confirmButtonText: '确定', | ||||
| 				cancelButtonText: '取消', | ||||
| 				inputErrorMessage: '请输入预置点名称', | ||||
| 			}) | ||||
| 				.then(({ value }) => { | ||||
| 					state.formData.presetName = value; | ||||
| 					addDevicePreset(state.formData) | ||||
| 						.then(() => { | ||||
| 							ElMessage.success('添加成功'); | ||||
| 							busPresettingBitList(); //获取预置点 | ||||
| 						}) | ||||
| 						.finally(() => { | ||||
| 							state.loading = false; | ||||
| 						}); | ||||
| 				}) | ||||
| 				.catch(() => {}); | ||||
| 		}; | ||||
| 		// 视频播放 | ||||
| 		const videoPlay = (obj) => { | ||||
| 			getAccessToken({}).then((res: any) => { | ||||
| 				if (res.code == 0 && obj.deviceSerial) { | ||||
| 					state.flvPlayer = new EZUIKit.EZUIKitPlayer({ | ||||
| 						audio: '0', | ||||
| 						id: 'video-container', // 视频容器ID | ||||
| 						accessToken: res.data.token, | ||||
| 						url: `ezopen://open.ys7.com/${obj.deviceSerial}/1.hd.live`, // 初始化写死一个离线或者找不到的设备,避免初始化无法创建播放器; | ||||
| 						template: 'pcLive', //standard   pcLive | ||||
| 						width: 870, //默认值为容器容器DOM宽高度 | ||||
| 						height: 600, | ||||
| 						plugin: ['talk'], // 加载插件,talk-对讲 | ||||
| 					}); | ||||
| 				} | ||||
| 			}); | ||||
| 		}; | ||||
| 		// 关闭弹窗 | ||||
| 		const closeDialog = () => { | ||||
| 			if (state.flvPlayer) { | ||||
| 				const destroyPromise = state.flvPlayer.destroy(); | ||||
| 				destroyPromise.then((data: any) => { | ||||
| 					console.log('promise 获取 数据', data); | ||||
| 				}); | ||||
| 				state.flvPlayer = null; | ||||
| 			} | ||||
| 			state.isShowDialog = false; | ||||
| 		}; | ||||
| 		// 获取预置点列表数据 | ||||
| 		const busPresettingBitList = () => { | ||||
| 			loading.value = true; | ||||
| 			listDevicePreset(state.tableData.param).then((res: any) => { | ||||
| 				let list = res.data.list ?? []; | ||||
| 				state.tableData.data = list; | ||||
| 				state.tableData.total = res.data.total; | ||||
| 				loading.value = false; | ||||
| 			}); | ||||
| 		}; | ||||
| 		// 取消 | ||||
| 		const onCancel = () => { | ||||
| 			closeDialog(); | ||||
| 		}; | ||||
| 		const handleDelete = (row: any) => { | ||||
| 			let msg = '你确定要删除所选数据?'; | ||||
| 			let id: number[] = []; | ||||
| 			if (row) { | ||||
| 				msg = `此操作将永久删除数据,是否继续?`; | ||||
| 				id = [row.id]; | ||||
| 			} | ||||
| 			if (id.length === 0) { | ||||
| 				ElMessage.error('请选择要删除的数据。'); | ||||
| 				return; | ||||
| 			} | ||||
| 			ElMessageBox.confirm(msg, '提示', { | ||||
| 				confirmButtonText: '确认', | ||||
| 				cancelButtonText: '取消', | ||||
| 				type: 'warning', | ||||
| 			}) | ||||
| 				.then(() => { | ||||
| 					let obj = { | ||||
| 						deviceSerial: row.deviceSerial, | ||||
| 						ids: id, | ||||
| 					}; | ||||
| 					delDevicePreset(obj).then((res: any) => { | ||||
| 						if (res.code == 0) { | ||||
| 							ElMessage.success('删除成功'); | ||||
| 							busPresettingBitList(); | ||||
| 						} | ||||
| 					}); | ||||
| 				}) | ||||
| 				.catch(() => {}); | ||||
| 		}; | ||||
| 		// 调用 | ||||
| 		const handleDebug = (row) => { | ||||
| 			let obj = { | ||||
| 				deviceSerial: row.deviceSerial, | ||||
| 				index: row.index, | ||||
| 			}; | ||||
| 			callDevicePreset(obj).then((res: any) => { | ||||
| 				if (res.code == 0) { | ||||
| 					ElMessage.success('调用成功'); | ||||
| 				} | ||||
| 			}); | ||||
| 		}; | ||||
| 		const handleEdit = (row: any) => { | ||||
| 			let param = { | ||||
| 				id: row.id, | ||||
| 				deviceSerial: row.deviceSerial, | ||||
| 				newName: row.name, | ||||
| 			}; | ||||
| 			updateDevicePreset(param) | ||||
| 				.then(() => { | ||||
| 					ElMessage.success('修改成功'); | ||||
| 					busPresettingBitList(); //获取预置点 | ||||
| 				}) | ||||
| 				.finally(() => { | ||||
| 					state.loading = false; | ||||
| 				}); | ||||
| 		}; | ||||
| 		const resetForm = () => { | ||||
| 			state.formData = { | ||||
| 				deviceSerial: undefined, | ||||
| 				channelNo: '1', | ||||
| 				presetName: undefined, | ||||
| 			}; | ||||
| 		}; | ||||
| 		onBeforeUnmount(() => { | ||||
| 			if (state.flvPlayer) { | ||||
| 				const destroyPromise = state.flvPlayer.destroy(); | ||||
| 				destroyPromise.then((data: any) => { | ||||
| 					console.log('promise 获取 数据', data); | ||||
| 				}); | ||||
| 				state.flvPlayer = null; | ||||
| 			} | ||||
| 		}); | ||||
|  | ||||
| 		return { | ||||
| 			proxy, | ||||
| 			openDialog, | ||||
| 			closeDialog, | ||||
| 			onCancel, | ||||
| 			menuRef, | ||||
| 			formRef, | ||||
| 			handleDebug, | ||||
| 			handleDelete, | ||||
| 			addPre, | ||||
| 			handleEdit, | ||||
| 			loading, | ||||
| 			busPresettingBitList, | ||||
| 			...toRefs(state), | ||||
| 		}; | ||||
| 	}, | ||||
| <script lang="ts" setup> | ||||
| import { ref, onBeforeUnmount, getCurrentInstance, nextTick } from 'vue'; | ||||
| import { ElMessageBox, ElMessage } from 'element-plus'; | ||||
| import { listDevicePreset, addDevicePreset, updateDevicePreset, delDevicePreset, callDevicePreset } from '@/api/other/devicePreset'; | ||||
| import { getAccessToken } from '@/api/other/ys7Device'; | ||||
| import EZUIKit from 'ezuikit-js'; | ||||
|  | ||||
| const emit = defineEmits(['update']); | ||||
| const { proxy } = getCurrentInstance() as any; | ||||
|  | ||||
| const formRef = ref<HTMLElement | null>(null); | ||||
| const menuRef = ref(); | ||||
| const loading = ref(false); | ||||
|  | ||||
| const isShowDialog = ref(false); | ||||
| const layout = ref('total, prev, pager, next'); | ||||
| const title = ref(''); | ||||
| const updateRow = ref<any>(null); | ||||
| const src = ref(null); | ||||
| const flvPlayer = ref<any>(null); | ||||
|  | ||||
| const formData = ref({ | ||||
|   deviceSerial: undefined, | ||||
|   channelNo: '1', | ||||
|   presetName: undefined | ||||
| }); | ||||
|  | ||||
| const tableData = ref({ | ||||
|   data: [], | ||||
|   total: 0, | ||||
|   loading: false, | ||||
|   param: { | ||||
|     pageNum: 1, | ||||
|     pageSize: 15, | ||||
|     deviceSerial: '' | ||||
|   } | ||||
| }); | ||||
|  | ||||
| // 打开弹窗 | ||||
| function openDialog(row: any) { | ||||
|   resetForm(); | ||||
|   updateRow.value = row; | ||||
|   title.value = row.deviceName; | ||||
|   formData.value.deviceSerial = row.deviceSerial; | ||||
|   tableData.value.param.deviceSerial = row.deviceSerial; | ||||
|   isShowDialog.value = true; | ||||
|   busPresettingBitList(); | ||||
|   nextTick(() => { | ||||
|     videoPlay(row); | ||||
|   }); | ||||
| } | ||||
|  | ||||
| // 添加预置点 | ||||
| function addPre() { | ||||
|   ElMessageBox.prompt('请输入预置点名称', '添加预置点', { | ||||
|     confirmButtonText: '确定', | ||||
|     cancelButtonText: '取消', | ||||
|     inputErrorMessage: '请输入预置点名称' | ||||
|   }) | ||||
|     .then(({ value }) => { | ||||
|       formData.value.presetName = value; | ||||
|       addDevicePreset(formData.value) | ||||
|         .then(() => { | ||||
|           ElMessage.success('添加成功'); | ||||
|           busPresettingBitList(); | ||||
|         }) | ||||
|         .finally(() => { | ||||
|           loading.value = false; | ||||
|         }); | ||||
|     }) | ||||
|     .catch(() => {}); | ||||
| } | ||||
|  | ||||
| // 视频播放 | ||||
| function videoPlay(obj: any) { | ||||
|   getAccessToken().then((res: any) => { | ||||
|     if (res.code == 200 && obj.deviceSerial) { | ||||
|       flvPlayer.value = new EZUIKit.EZUIKitPlayer({ | ||||
|         audio: '0', | ||||
|         id: 'video-container', | ||||
|         accessToken: res.data, | ||||
|         url: `ezopen://open.ys7.com/${obj.deviceSerial}/1.hd.live`, | ||||
|         template: 'pcLive', | ||||
|         width: 870, | ||||
|         height: 600, | ||||
|         plugin: ['talk'], | ||||
|         handleError: function (err: any) { | ||||
|           console.log(err); | ||||
|  | ||||
|           if (err?.data?.ret === 20020) { | ||||
|             // 20020 是并发连接限制的错误码 | ||||
|             ElMessage.error('当前观看人数已达上限,请稍后再试'); | ||||
|           } | ||||
|         } | ||||
|       }); | ||||
|     } | ||||
|   }); | ||||
| } | ||||
|  | ||||
| // 关闭弹窗 | ||||
| function closeDialog() { | ||||
|   if (flvPlayer.value) { | ||||
|     flvPlayer.value.destroy().then((data: any) => { | ||||
|       console.log('promise 获取 数据', data); | ||||
|     }); | ||||
|     flvPlayer.value = null; | ||||
|   } | ||||
|   isShowDialog.value = false; | ||||
| } | ||||
|  | ||||
| // 获取列表 | ||||
| function busPresettingBitList() { | ||||
|   loading.value = true; | ||||
|   listDevicePreset(tableData.value.param).then((res: any) => { | ||||
|     tableData.value.data = res.rows ?? []; | ||||
|     tableData.value.total = res.total; | ||||
|     loading.value = false; | ||||
|   }); | ||||
| } | ||||
|  | ||||
| // 取消 | ||||
| function onCancel() { | ||||
|   closeDialog(); | ||||
| } | ||||
|  | ||||
| // 删除 | ||||
| function handleDelete(row: any) { | ||||
|   let msg = '你确定要删除所选数据?'; | ||||
|   let id: number[] = []; | ||||
|   if (row) { | ||||
|     msg = '此操作将永久删除数据,是否继续?'; | ||||
|     id = [row.id]; | ||||
|   } | ||||
|   if (id.length === 0) { | ||||
|     ElMessage.error('请选择要删除的数据。'); | ||||
|     return; | ||||
|   } | ||||
|   ElMessageBox.confirm(msg, '提示', { | ||||
|     confirmButtonText: '确认', | ||||
|     cancelButtonText: '取消', | ||||
|     type: 'warning' | ||||
|   }) | ||||
|     .then(() => { | ||||
|       const obj = { | ||||
|         deviceSerial: row.deviceSerial, | ||||
|         ids: id | ||||
|       }; | ||||
|       delDevicePreset(id).then((res: any) => { | ||||
|         if (res.code === 200) { | ||||
|           ElMessage.success('删除成功'); | ||||
|           busPresettingBitList(); | ||||
|         } | ||||
|       }); | ||||
|     }) | ||||
|     .catch(() => {}); | ||||
| } | ||||
|  | ||||
| // 调用 | ||||
| function handleDebug(row: any) { | ||||
|   callDevicePreset(row.id).then((res: any) => { | ||||
|     if (res.code === 200) { | ||||
|       ElMessage.success('调用成功'); | ||||
|     } | ||||
|   }); | ||||
| } | ||||
|  | ||||
| // 修改 | ||||
| function handleEdit(row: any) { | ||||
|   const param = { | ||||
|     id: row.id, | ||||
|     deviceSerial: row.deviceSerial, | ||||
|     presetName: row.presetName | ||||
|   }; | ||||
|   updateDevicePreset(param) | ||||
|     .then(() => { | ||||
|       ElMessage.success('修改成功'); | ||||
|       busPresettingBitList(); | ||||
|     }) | ||||
|     .finally(() => { | ||||
|       loading.value = false; | ||||
|     }); | ||||
| } | ||||
|  | ||||
| // 重置表单 | ||||
| function resetForm() { | ||||
|   formData.value = { | ||||
|     deviceSerial: undefined, | ||||
|     channelNo: '1', | ||||
|     presetName: undefined | ||||
|   }; | ||||
| } | ||||
|  | ||||
| onBeforeUnmount(() => { | ||||
|   if (flvPlayer.value) { | ||||
|     flvPlayer.value.destroy().then((data: any) => { | ||||
|       console.log('promise 获取 数据', data); | ||||
|     }); | ||||
|     flvPlayer.value = null; | ||||
|   } | ||||
| }); | ||||
|  | ||||
| // ✅ 关键:暴露方法给父组件调用 | ||||
| defineExpose({ | ||||
|   openDialog, | ||||
|   closeDialog | ||||
| }); | ||||
| </script> | ||||
|  | ||||
| <style scoped lang="scss"> | ||||
| .system-busPresettingBit-add { | ||||
| 	.info_list { | ||||
| 		width: 100%; | ||||
| 		display: flex; | ||||
| 		height: 100%; | ||||
| 		.video_box { | ||||
| 			width: 75%; | ||||
| 			height: 600px; | ||||
| 			margin-right: 10px; | ||||
| 			.iframe { | ||||
| 				border: none; | ||||
| 				outline: none; | ||||
| 			} | ||||
| 			.video_air { | ||||
| 				width: 100%; | ||||
| 				height: 100%; | ||||
| 				object-fit: fill; | ||||
| 			} | ||||
| 		} | ||||
| 	} | ||||
|   .info_list { | ||||
|     width: 100%; | ||||
|     display: flex; | ||||
|     height: 100%; | ||||
|     .video_box { | ||||
|       width: 75%; | ||||
|       height: 600px; | ||||
|       margin-right: 10px; | ||||
|       .iframe { | ||||
|         border: none; | ||||
|         outline: none; | ||||
|       } | ||||
|       .video_air { | ||||
|         width: 100%; | ||||
|         height: 100%; | ||||
|         object-fit: fill; | ||||
|       } | ||||
|     } | ||||
|   } | ||||
| } | ||||
| </style> | ||||
|  | ||||
| @ -159,23 +159,17 @@ | ||||
|         @pagination="ys7DevicesList" | ||||
|       /> | ||||
|     </el-card> | ||||
|     <!-- <apiV1SystemYs7DevicesAdd ref="addRef" @ys7DevicesList="ys7DevicesList"></apiV1SystemYs7DevicesAdd> | ||||
|     <apiV1SystemYs7DevicesEdit ref="editRef" @ys7DevicesList="ys7DevicesList"></apiV1SystemYs7DevicesEdit> | ||||
|     <apiV1SystemYs7DevicesDetail ref="detailRef" @ys7DevicesList="ys7DevicesList"></apiV1SystemYs7DevicesDetail> --> | ||||
|     <bindPro ref="bindProRef" :projectList="projectList" @ys7DevicesList="ys7DevicesList"></bindPro> | ||||
|     <!-- <presetAdd ref="presetAddRef" @busPresettingBitList="busPresettingBitList"></presetAdd> --> | ||||
|     <presetAdd ref="presetAddRef"></presetAdd> | ||||
|   </div> | ||||
| </template> | ||||
| <script setup lang="ts"> | ||||
| // import { ref, reactive, onMounted, computed, toRefs, getCurrentInstance, toRaw } from 'vue'; | ||||
| import { ElMessageBox, ElMessage, FormInstance } from 'element-plus'; | ||||
| import { listYs7Device, delYs7Device, toggleEncrypt } from '@/api/other/ys7Device'; | ||||
| // import { Ys7DeviceVO, Ys7DevicesInfoData, Ys7DevicesTableDataState } from './component/model'; | ||||
| import { Ys7DeviceVO, Ys7DeviceForm, Ys7DeviceQuery } from '@/api/other/ys7Device/types'; | ||||
| import { useUserStoreHook } from '@/store/modules/user'; | ||||
| // import apiV1SystemYs7DevicesAdd from './component/add.vue'; | ||||
| // import apiV1SystemYs7DevicesEdit from './component/edit.vue'; | ||||
| // import apiV1SystemYs7DevicesDetail from './component/detail.vue'; | ||||
| import apiV1SystemYs7DevicesEdit from './component/edit.vue'; | ||||
| import bindPro from './component/bindPro.vue'; | ||||
| import presetAdd from './component/presetAdd.vue'; | ||||
|  | ||||
| @ -308,14 +302,10 @@ const handleDelete = (row?: Ys7DeviceVO) => { | ||||
|     .catch(() => {}); | ||||
| }; | ||||
|  | ||||
| // 查看详情 | ||||
| const handleView = (row: Ys7DeviceVO) => { | ||||
|   detailRef.value.openDialog(toRaw(row)); | ||||
| }; | ||||
|  | ||||
| // 绑定项目 | ||||
| const onLinkProject = (row?: Ys7DeviceVO) => { | ||||
|   let serials = row ? [row.deviceSerial] : state.serials; | ||||
|   let serials = row ? [row.deviceSerial] : state.ids; | ||||
|  | ||||
|   if (serials.length === 0) { | ||||
|     ElMessage.error('请选择要绑定项目的设备'); | ||||
|     return; | ||||
|  | ||||
		Reference in New Issue
	
	Block a user