吉安感知网项目-前端
罗广辉
2026-01-08 48e30e3f34ce90ee855b7f631f37064599b6ec27
applications/drone-command/src/views/basicManage/deviceStock/deviceStock.vue
@@ -33,6 +33,21 @@
               </el-form-item>
            </el-col>
            <el-col :span="4">
               <el-form-item label="时间" prop="belongDept">
                  <el-date-picker
                     popper-class="ztzf-date-picker-popper"
                     class="ztzf-date-picker"
                     v-model="dateRange"
                     type="daterange"
                     range-separator="至"
                     start-placeholder="开始日期"
                     end-placeholder="结束日期"
                     value-format="YYYY-MM-DD HH:mm:ss"
                     @change="handleSearch"
                  />
               </el-form-item>
            </el-col>
            <el-col :span="4">
               <el-form-item>
                  <el-button @click="resetForm">重置</el-button>
                  <el-button type="primary" @click="handleSearch">查询</el-button>
@@ -42,6 +57,7 @@
      </el-form>
      <div>
         <el-button type="primary" @click="handleAdd">新增</el-button>
         <el-button type="primary" @click="exportFile" :loading="exportLoading">导出</el-button>
         <el-button type="danger" :disabled="!selectedIds.length" @click="handleDelete()">删除</el-button>
      </div>
      <el-table v-loading="loading" :data="list" @selection-change="handleSelectionChange">
@@ -79,11 +95,11 @@
<script setup>
import { onMounted, ref } from 'vue'
import { ElMessage, ElMessageBox } from 'element-plus'
import { fwDevicePageApi, fwDeviceRemoveApi } from '@/views/basicManage/deviceStock/fwDevice'
import { exportFwDeviceApi, fwDevicePageApi, fwDeviceRemoveApi } from '@/views/basicManage/deviceStock/fwDevice'
import FormDiaLog from './FormDiaLog.vue'
import { getDictionaryByCode } from '@/api/system/dictbiz'
import { getDeptTree } from '@/api/system/dept'
import { getDictLabel } from '@ztzf/utils'
import { blobDownload, dateRangeFormat, getDictLabel } from '@ztzf/utils'
const initSearchParams = () => ({
   deviceName: '', // 设备名称
@@ -103,19 +119,22 @@
   deviceType: [], //设备类型
   deviceAtt: [], //设备属性
})
const dateRange = ref([])
const deptTree = ref([])
const treeProps = {
   label: 'name',
   children: 'children',
}
const exportLoading = ref(false)
provide('dictObj', dictObj)
provide('deptTree', deptTree)
// 获取列表
async function getList() {
   const range = dateRangeFormat(dateRange.value)
   loading.value = true
   try {
      const res = await fwDevicePageApi(searchParams.value)
      const res = await fwDevicePageApi({ ...searchParams.value, start_time: range[0], end_time: range[1] })
      list.value = res?.data?.data?.records ?? []
      total.value = res?.data?.data?.total ?? 0
   } finally {
@@ -131,6 +150,7 @@
// 重置查询
function resetForm() {
   dateRange.value = []
   queryParamsRef.value?.resetFields()
   searchParams.value.current = 1
   getList()
@@ -162,6 +182,17 @@
   selectedIds.value = rows.map(item => item.id)
}
function exportFile() {
   exportLoading.value = true
   exportFwDeviceApi()
      .then(res => {
         blobDownload(res)
      })
      .finally(() => {
         exportLoading.value = false
      })
}
// 获取字典
function getDictList() {
   getDictionaryByCode('deviceType,deviceAtt').then(res => {