潘志宝
2024-11-22 df90c0c5cfa4de114798015b92120ad8ba8b4826
src/views/data/video/nvr/NvrCamera.vue
@@ -6,95 +6,104 @@
    @close="handleClose"
    size="60%">
    <div class="mod-dev__camera" style="padding: 10px;">
    <el-form
      class="-mb-15px"
      :model="queryParams"
      ref="queryFormRef"
      :inline="true"
      label-width="68px"
    >
      <el-form-item label="监控区域" prop="code">
        <el-input
          v-model="queryParams.location"
          placeholder="请输入监控区域"
          clearable
          @keyup.enter="handleQuery"
          class="!w-240px"
        />
      </el-form-item>
      <el-form-item>
        <el-button @click="handleQuery">
          <Icon icon="ep:search" class="mr-5px" />
          搜索
        </el-button>
        <el-button @click="resetQuery">
          <Icon icon="ep:refresh" class="mr-5px" />
          重置
        </el-button>
        <el-button
          type="primary"
          plain
          @click="openForm('create')"
        >
          <Icon icon="ep:plus" class="mr-5px" />
          新增
        </el-button>
        <el-button
          type="success"
          plain
          @click="handleExport"
          :loading="exportLoading"
          v-hasPermi="['dev:camera:export']"
        >
          <Icon icon="ep:download" class="mr-5px" />
          导出
        </el-button>
      </el-form-item>
    </el-form>
  <!-- 列表 -->
    <el-table v-loading="loading" :data="list">
      <el-table-column label="编码" align="center" prop="code" width="80" />
      <el-table-column label="抓图方式" align="center" prop="captureType" width="80">
        <template #default="scope">
          <dict-tag :type="DICT_TYPE.CAPTURE_TYPE" :value="scope.row.captureType" />
        </template>
      </el-table-column>
      <el-table-column label="通道" align="center" prop="channel" width="80"  />
      <el-table-column label="监控区域" align="center" prop="location" />
      <el-table-column label="备注" align="center" prop="remark" width="200" />
      <el-table-column label="操作" align="center" min-width="110" fixed="right">
        <template #default="scope">
      <el-form
        class="-mb-15px"
        :model="queryParams"
        ref="queryFormRef"
        :inline="true"
        label-width="68px"
      >
        <el-form-item label="监控区域" prop="code">
          <el-input
            v-model="queryParams.location"
            placeholder="请输入监控区域"
            clearable
            @keyup.enter="handleQuery"
            class="!w-240px"
          />
        </el-form-item>
        <el-form-item>
          <el-button @click="handleQuery">
            <Icon icon="ep:search" class="mr-5px"/>
            搜索
          </el-button>
          <el-button @click="resetQuery">
            <Icon icon="ep:refresh" class="mr-5px"/>
            重置
          </el-button>
          <el-button
            link
            type="primary"
            @click="openForm('update', scope.row.id)"
            plain
            @click="openForm('create')"
          >
            编辑
            <Icon icon="ep:plus" class="mr-5px"/>
            新增
          </el-button>
          <el-button
            link
            type="danger"
            @click="handleDelete(scope.row.id)"
            type="success"
            plain
            @click="handleExport"
            :loading="exportLoading"
            v-hasPermi="['dev:camera:export']"
          >
            删除
            <Icon icon="ep:download" class="mr-5px"/>
            导出
          </el-button>
        </template>
      </el-table-column>
    </el-table>
    <!-- 分页 -->
    <Pagination
      :total="total"
      v-model:page="queryParams.pageNo"
      v-model:limit="queryParams.pageSize"
      @pagination="getList"
    />
        </el-form-item>
      </el-form>
      <!-- 列表 -->
      <el-table v-loading="loading" :data="list">
        <el-table-column label="编码" align="center" prop="code" width="80"/>
        <el-table-column label="抓图方式" align="center" prop="captureType" width="80">
          <template #default="scope">
            <dict-tag :type="DICT_TYPE.CAPTURE_TYPE" :value="scope.row.captureType"/>
          </template>
        </el-table-column>
        <el-table-column label="通道" align="center" prop="channel" width="80"/>
        <el-table-column label="监控区域" align="center" prop="location"/>
        <el-table-column label="备注" align="center" prop="remark" width="200"/>
        <el-table-column label="操作" align="center" min-width="110" fixed="right">
          <template #default="scope">
            <el-button
              link
              type="primary"
              @click="openForm('update', scope.row.id)"
            >
              编辑
            </el-button>
            <el-button
              link
              type="danger"
              @click="handleDelete(scope.row.id)"
            >
              删除
            </el-button>
            <el-button
              link
              type="success"
              @click="imageHandle(scope.row.id)"
              v-hasPermi="['video:image:query']"
            >
              查看截图
            </el-button>
          </template>
        </el-table-column>
      </el-table>
      <!-- 分页 -->
      <Pagination
        :total="total"
        v-model:page="queryParams.pageNo"
        v-model:limit="queryParams.pageSize"
        @pagination="getList"
      />
    </div>
  </el-drawer>
  <!-- 表单弹窗:添加/修改 -->
  <NvrCameraForm ref="formRef" @success="getList" />
  <NvrCameraForm ref="formRef" @success="getList"/>
  <CameraImage ref="imageFormRef"/>
</template>
<script lang="ts" setup>
@@ -102,6 +111,7 @@
import * as CameraApi from '@/api/data/video/camera'
import NvrCameraForm from './NvrCameraForm.vue'
import {DICT_TYPE} from "@/utils/dict";
import CameraImage from "../camera/CameraImage.vue";
defineOptions({name: 'NvrCamera'})
@@ -134,7 +144,7 @@
  await getList()
}
defineExpose({ open }) // 提供 open 方法,用于打开弹窗
defineExpose({open}) // 提供 open 方法,用于打开弹窗
/** 查询列表 */
const getList = async () => {
@@ -148,6 +158,12 @@
  }
}
/** 查看截图 */
const imageFormRef = ref()
const imageHandle = (id: string) => {
  imageFormRef.value.open(id)
}
/** 搜索按钮操作 */
const handleQuery = () => {
  queryParams.pageNo = 1
@@ -156,7 +172,7 @@
/** 重置按钮操作 */
const resetQuery = () => {
  queryFormRef.value.resetFields()
  queryParams.location = undefined
  handleQuery()
}