吉安感知网项目-前端
罗广辉
2026-01-08 26b6cf706524340dd9f9e556092fb598e08a9e4c
applications/drone-command/src/views/basicManage/deviceStock/deviceStock.vue
@@ -53,12 +53,13 @@
<script setup>
import { onMounted, ref } from 'vue'
import { ElMessageBox } from 'element-plus'
import { fwDeviceListApi, fwDeviceRemoveApi } from '@/views/basicManage/deviceStock/fwDevice'
import { ElMessage, ElMessageBox } from 'element-plus'
import { fwDevicePageApi, fwDeviceRemoveApi } from '@/views/basicManage/deviceStock/fwDevice'
import FormDiaLog from './FormDiaLog.vue'
import { getDictionaryByCode } from '@/api/system/dictbiz'
import { getDeptTree } from '@/api/system/dept'
const initSearchParams = () => ({
   // 查询参数默认值
   deviceName: '', // 设备名称
   deviceType: '', // 设备类型
   current: 1, // 当前页
@@ -70,12 +71,19 @@
const list = ref([]) // 列表数据
const queryParamsRef = ref(null) // 查询表单实例
const dialogRef = ref(null) // 弹框实例
const dictObj = ref({
   deviceType: [],
   deviceAtt: [],
})
const deptTree = ref([])
provide('dictObj', dictObj)
provide('deptTree', deptTree)
// 获取列表
async function getList() {
   loading.value = true
   try {
      const res = await fwDeviceListApi(searchParams.value)
      const res = await fwDevicePageApi(searchParams.value)
      list.value = res?.data?.data?.records ?? []
      total.value = res?.data?.data?.total ?? 0
   } finally {
@@ -109,8 +117,23 @@
// 删除
async function handleDelete(row) {
   await ElMessageBox.confirm('确认删除该设备吗?', '提示', { type: 'warning' })
   await fwDeviceRemoveApi({ ids: [row.id] })
   await fwDeviceRemoveApi({ ids: row.id })
   ElMessage.success('删除成功')
   getList()
}
// 获取字典
function getDictList() {
   getDictionaryByCode('deviceType,deviceAtt').then(res => {
      dictObj.value = res.data.data
   })
}
// 获取部门树
function getDeptTreeFun() {
   getDeptTree().then(res => {
      deptTree.value = res.data.data
   })
}
// 新增
@@ -120,6 +143,8 @@
onMounted(() => {
   getList()
   getDictList()
   getDeptTreeFun()
})
</script>
<style scoped lang="scss"></style>