|
|
@@ -0,0 +1,237 @@
|
|
|
+<template>
|
|
|
+ <div class="camera-share">
|
|
|
+ <div class="flex items-center query-head">
|
|
|
+ <el-space alignment="center" :size="50">
|
|
|
+ <div style="display: flex">
|
|
|
+ <div>公司名称:</div>
|
|
|
+ <el-input
|
|
|
+ v-model="queryName"
|
|
|
+ clearable
|
|
|
+ placeholder="请输入公司名称"
|
|
|
+ class="query-content"
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+ <div>
|
|
|
+ <span>公司账号:</span>
|
|
|
+ <el-input
|
|
|
+ v-model="queryAccount"
|
|
|
+ clearable
|
|
|
+ placeholder="请输入公司账号"
|
|
|
+ class="query-content"
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+ </el-space>
|
|
|
+ <div class="flex-1 flex justify-end">
|
|
|
+ <el-button type="primary" @click="queryCameraItems"> 查询 </el-button>
|
|
|
+ <el-button @click="resetSearch"> 重置 </el-button>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="camera-list">
|
|
|
+ <BasicTable
|
|
|
+ :columns="columns"
|
|
|
+ :data-source="props.addCameraType === 'complete' ? cameraCompleted : cameraInCompleted"
|
|
|
+ :row-key="(row) => row.cameraIp"
|
|
|
+ :action-column="actionColumn"
|
|
|
+ :tableSetting="{
|
|
|
+ size: false,
|
|
|
+ redo: false,
|
|
|
+ fullscreen: false,
|
|
|
+ striped: false,
|
|
|
+ setting: false,
|
|
|
+ }"
|
|
|
+ :striped="true"
|
|
|
+ ref="tableRef"
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+ <CameraEditshared
|
|
|
+ class="add-popover"
|
|
|
+ v-model="shareEditedPopover"
|
|
|
+ :edit-data="handleEditData"
|
|
|
+ @update-data="updateData"
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script setup lang="ts">
|
|
|
+ import { h, onMounted, reactive, ref, computed } from 'vue';
|
|
|
+ import { columns } from '../sharedColumns';
|
|
|
+ import editIcon from '@/assets/images/table/table-edit.png';
|
|
|
+ import deleteIcon from '@/assets/images/table/table-delete.png';
|
|
|
+ import { queryTypeSelect, protocalTypeSelect, CameraSharedItem } from '../constant';
|
|
|
+ import useCameraOverview from '../stores/useCameraOverview';
|
|
|
+ import useSceneInfos from '@/hooks/useSceneInfos';
|
|
|
+ import { storeToRefs } from 'pinia';
|
|
|
+ import { BasicColumn, TableActionIcons, BasicTable } from '@/components/Table';
|
|
|
+ import { Plus } from '@element-plus/icons-vue';
|
|
|
+ import CameraEditshared from '../components/CameraEditshared.vue';
|
|
|
+
|
|
|
+ const props = defineProps<{ addCameraType: string }>();
|
|
|
+
|
|
|
+ const cameraCompleted = ref<CameraSharedItem[]>([
|
|
|
+ {
|
|
|
+ cameraIp: '11133',
|
|
|
+ cameraType: 'haikang',
|
|
|
+ cameraPort: '11',
|
|
|
+ companyAccount: 111,
|
|
|
+ companyName: '1111',
|
|
|
+ code: '3',
|
|
|
+ workshopName: '222',
|
|
|
+ workspaceName: '2233',
|
|
|
+ shareState: 'complete',
|
|
|
+ password: '11',
|
|
|
+ username: '22',
|
|
|
+ },
|
|
|
+ ]);
|
|
|
+ const cameraInCompleted = ref<CameraSharedItem[]>([
|
|
|
+ {
|
|
|
+ cameraIp: '111',
|
|
|
+ cameraType: 'haikang',
|
|
|
+ cameraPort: '11',
|
|
|
+ companyAccount: 111,
|
|
|
+ companyName: '1111',
|
|
|
+ code: '1',
|
|
|
+ workshopName: '222',
|
|
|
+ workspaceName: '2233',
|
|
|
+ shareState: 'incomplete',
|
|
|
+ password: '11',
|
|
|
+ username: '22',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ cameraIp: '11122',
|
|
|
+ cameraType: 'haikang',
|
|
|
+ cameraPort: '11',
|
|
|
+ companyAccount: 111,
|
|
|
+ companyName: '1111',
|
|
|
+ code: '2',
|
|
|
+ workshopName: '222',
|
|
|
+ workspaceName: '2233',
|
|
|
+ shareState: 'incomplete',
|
|
|
+ password: '11',
|
|
|
+ username: '22',
|
|
|
+ },
|
|
|
+ ]);
|
|
|
+
|
|
|
+ const queryName = ref<string>();
|
|
|
+ const queryAccount = ref<string>();
|
|
|
+ const shareEditedPopover = ref<boolean>(false);
|
|
|
+
|
|
|
+ const handleAdd = (row) => {
|
|
|
+ if (props.addCameraType === 'complete') return;
|
|
|
+ const currentData = cameraInCompleted.value.find((item) => (item.cameraIp = row.cameraIp));
|
|
|
+ const indexToRemove = cameraInCompleted.value.findIndex(
|
|
|
+ (item) => item.cameraIp === row.cameraIp,
|
|
|
+ );
|
|
|
+ if (indexToRemove !== -1) {
|
|
|
+ cameraInCompleted.value.splice(indexToRemove, 1);
|
|
|
+ }
|
|
|
+ if (currentData) {
|
|
|
+ cameraCompleted.value.push(currentData!);
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
+ const handleEditData = ref<CameraSharedItem>({} as CameraSharedItem);
|
|
|
+ const handleEdit = (row) => {
|
|
|
+ shareEditedPopover.value = true;
|
|
|
+ handleEditData.value = row;
|
|
|
+ };
|
|
|
+ const handleDelete = (_row) => {};
|
|
|
+
|
|
|
+ const updateData = (data) => {
|
|
|
+ console.log(data);
|
|
|
+ if (props.addCameraType === 'complete') {
|
|
|
+ // const currentData = cameraCompleted.value.find((item) => (item.cameraIp = data.cameraIp));
|
|
|
+ const indexToRemove = cameraInCompleted.value.findIndex(
|
|
|
+ (item) => item.cameraIp === row.cameraIp,
|
|
|
+ );
|
|
|
+ currentData = data;
|
|
|
+ } else {
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
+ //操作列
|
|
|
+ const actionColumn: BasicColumn = reactive({
|
|
|
+ width: 200,
|
|
|
+ title: '操作',
|
|
|
+ prop: 'action',
|
|
|
+ key: 'action',
|
|
|
+ fixed: 'right',
|
|
|
+ render(record) {
|
|
|
+ return h(TableActionIcons as any, {
|
|
|
+ space: 20,
|
|
|
+ color: '#629bf9',
|
|
|
+ style: 'img',
|
|
|
+ size: 16,
|
|
|
+ actionIcons: [
|
|
|
+ {
|
|
|
+ label: '添加',
|
|
|
+ icon: Plus,
|
|
|
+ onClick: handleAdd.bind(null, record.row),
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '编辑',
|
|
|
+ icon: editIcon,
|
|
|
+ onClick: handleEdit.bind(null, record.row),
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '删除',
|
|
|
+ icon: deleteIcon,
|
|
|
+ onClick: handleDelete.bind(null, record.row),
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ });
|
|
|
+ },
|
|
|
+ });
|
|
|
+
|
|
|
+ const queryCameraItems = () => {};
|
|
|
+
|
|
|
+ // 重置查询条件
|
|
|
+ const resetSearch = () => {
|
|
|
+ queryName.value = '';
|
|
|
+ queryAccount.value = '';
|
|
|
+ // queryCameraType.value = '';
|
|
|
+ // queryWorkSpace.value = '';
|
|
|
+ };
|
|
|
+
|
|
|
+ // onMounted(() => {
|
|
|
+ // getScenesTree({ level: 3, valueKey: 'code', labelKey: 'name' });
|
|
|
+ // });
|
|
|
+</script>
|
|
|
+
|
|
|
+<style scoped>
|
|
|
+ .type-select {
|
|
|
+ width: 100px;
|
|
|
+ }
|
|
|
+
|
|
|
+ .query-content {
|
|
|
+ width: 160px;
|
|
|
+ margin-top: -6px;
|
|
|
+ }
|
|
|
+
|
|
|
+ .protocal-select {
|
|
|
+ width: 160px;
|
|
|
+ }
|
|
|
+
|
|
|
+ .query-head {
|
|
|
+ padding: 24px 57px 18px 21px;
|
|
|
+ }
|
|
|
+
|
|
|
+ .camera-share {
|
|
|
+ position: relative;
|
|
|
+ height: calc(100vh - 64px - 12px);
|
|
|
+ background-color: #ffffff;
|
|
|
+ }
|
|
|
+
|
|
|
+ .camera-list {
|
|
|
+ padding: 0 21px;
|
|
|
+ }
|
|
|
+
|
|
|
+ .add-popover {
|
|
|
+ position: absolute;
|
|
|
+ width: calc(100%);
|
|
|
+ height: 622px;
|
|
|
+ top: -57px;
|
|
|
+ left: -20px;
|
|
|
+ margin: auto;
|
|
|
+ z-index: 99;
|
|
|
+ }
|
|
|
+</style>
|