|
@@ -1,114 +1,121 @@
|
|
<template>
|
|
<template>
|
|
- <el-row :gutter="20">
|
|
|
|
- <el-col :span="5" :xs="24">
|
|
|
|
- <ContentWrap class="h-1/1">
|
|
|
|
- <FileTree @node-click="handleFileNodeClick" :deviceId="id" />
|
|
|
|
- </ContentWrap>
|
|
|
|
- </el-col>
|
|
|
|
- <el-col :span="19">
|
|
|
|
- <ContentWrap>
|
|
|
|
- <el-form
|
|
|
|
- class="-mb-15px"
|
|
|
|
- :model="queryParams"
|
|
|
|
- ref="queryFormRef"
|
|
|
|
- :inline="true"
|
|
|
|
- label-width="68px"
|
|
|
|
- >
|
|
|
|
- <el-form-item label="文件名称" prop="fileName">
|
|
|
|
- <el-input
|
|
|
|
- v-model="queryParams.fileName"
|
|
|
|
- placeholder="请输入文件名称"
|
|
|
|
- clearable
|
|
|
|
- @keyup.enter="handleQuery"
|
|
|
|
- class="!w-240px"
|
|
|
|
|
|
+ <div class="container-tree" ref="container">
|
|
|
|
+ <el-row>
|
|
|
|
+ <div class="left-tree" :style="{ width: leftWidth + 'px' }">
|
|
|
|
+ <ContentWrapNoBottom>
|
|
|
|
+ <FileTree @node-click="handleFileNodeClick" :deviceId="id" />
|
|
|
|
+ </ContentWrapNoBottom>
|
|
|
|
+ </div>
|
|
|
|
+ <div class="divider-tree" @mousedown="startDrag"></div>
|
|
|
|
+ <div class="right-tree" :style="{ width: rightWidth + 'px' }">
|
|
|
|
+ <ContentWrap>
|
|
|
|
+ <el-form
|
|
|
|
+ class="-mb-15px"
|
|
|
|
+ :model="queryParams"
|
|
|
|
+ ref="queryFormRef"
|
|
|
|
+ :inline="true"
|
|
|
|
+ label-width="68px"
|
|
|
|
+ >
|
|
|
|
+ <el-form-item label="文件名称" prop="fileName">
|
|
|
|
+ <el-input
|
|
|
|
+ v-model="queryParams.fileName"
|
|
|
|
+ placeholder="请输入文件名称"
|
|
|
|
+ clearable
|
|
|
|
+ @keyup.enter="handleQuery"
|
|
|
|
+ class="!w-240px"
|
|
|
|
+ />
|
|
|
|
+ </el-form-item>
|
|
|
|
+ <el-form-item>
|
|
|
|
+ <el-button @click="handleQuery"><Icon icon="ep:search" />搜索</el-button>
|
|
|
|
+ <el-button @click="resetQuery"><Icon icon="ep:refresh" />重置</el-button>
|
|
|
|
+ <el-button type="primary" plain @click="openForm('create')">
|
|
|
|
+ <Icon icon="ep:plus" /> 文件上传
|
|
|
|
+ </el-button>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ </el-form>
|
|
|
|
+ </ContentWrap>
|
|
|
|
+ <ContentWrap>
|
|
|
|
+ <el-table
|
|
|
|
+ v-loading="formLoading"
|
|
|
|
+ :data="list"
|
|
|
|
+ :stripe="true"
|
|
|
|
+ :show-overflow-tooltip="true"
|
|
|
|
+ >
|
|
|
|
+ <!-- <el-table-column label="设备名称" align="center" prop="deviceId" />-->
|
|
|
|
+ <!-- <el-table-column label="资料分类" align="center" prop="classId" />-->
|
|
|
|
+ <el-table-column label="文件名称" align="center" prop="filename" />
|
|
|
|
+ <el-table-column label="文件类型" align="center" prop="fileType" />
|
|
|
|
+ <el-table-column label="查看预览" align="center" prop="filePath" >
|
|
|
|
+ <template #default="scope">
|
|
|
|
+ <el-button link type="primary" @click="openWeb(scope.row.filePath)"> <Icon size="19" icon="ep:view" /> </el-button>
|
|
|
|
+ </template>
|
|
|
|
+ </el-table-column>
|
|
|
|
+ <el-table-column label="备注" align="center" prop="remark" />
|
|
|
|
+ <el-table-column
|
|
|
|
+ label="创建时间"
|
|
|
|
+ align="center"
|
|
|
|
+ prop="createTime"
|
|
|
|
+ :formatter="dateFormatter"
|
|
|
|
+ width="180px"
|
|
/>
|
|
/>
|
|
- </el-form-item>
|
|
|
|
- <el-form-item>
|
|
|
|
- <el-button @click="handleQuery"><Icon icon="ep:search" />搜索</el-button>
|
|
|
|
- <el-button @click="resetQuery"><Icon icon="ep:refresh" />重置</el-button>
|
|
|
|
- <el-button type="primary" plain @click="openForm('create')">
|
|
|
|
- <Icon icon="ep:plus" /> 文件上传
|
|
|
|
- </el-button>
|
|
|
|
- </el-form-item>
|
|
|
|
- </el-form>
|
|
|
|
- </ContentWrap>
|
|
|
|
- <ContentWrap>
|
|
|
|
- <el-table v-loading="formLoading" :data="list" :stripe="true" :show-overflow-tooltip="true">
|
|
|
|
-<!-- <el-table-column label="设备名称" align="center" prop="deviceId" />-->
|
|
|
|
-<!-- <el-table-column label="资料分类" align="center" prop="classId" />-->
|
|
|
|
- <el-table-column label="文件名称" align="center" prop="filename" />
|
|
|
|
- <el-table-column label="文件类型" align="center" prop="fileType" />
|
|
|
|
- <el-table-column label="文件路径" align="center" prop="filePath" />
|
|
|
|
- <el-table-column label="备注" align="center" prop="remark" />
|
|
|
|
- <el-table-column
|
|
|
|
- label="创建时间"
|
|
|
|
- align="center"
|
|
|
|
- prop="createTime"
|
|
|
|
- :formatter="dateFormatter"
|
|
|
|
- width="180px"
|
|
|
|
|
|
+ <el-table-column label="操作" align="center" width="160">
|
|
|
|
+ <template #default="scope">
|
|
|
|
+ <div class="flex items-center justify-center">
|
|
|
|
+ <el-button type="primary" link @click="openForm('update', scope.row.id)">
|
|
|
|
+ <Icon icon="ep:edit" />修改
|
|
|
|
+ </el-button>
|
|
|
|
+ <el-dropdown
|
|
|
|
+ @command="(command) => handleCommand(command, scope.row)"
|
|
|
|
+ v-hasPermi="[
|
|
|
|
+ 'system:user:delete',
|
|
|
|
+ 'system:user:update-password',
|
|
|
|
+ 'system:permission:assign-user-role'
|
|
|
|
+ ]"
|
|
|
|
+ >
|
|
|
|
+ <el-button type="primary" link><Icon icon="ep:d-arrow-right" /> 更多</el-button>
|
|
|
|
+ <template #dropdown>
|
|
|
|
+ <el-dropdown-menu>
|
|
|
|
+ <el-dropdown-item command="handleDelete">
|
|
|
|
+ <Icon icon="ep:delete" />删除
|
|
|
|
+ </el-dropdown-item>
|
|
|
|
+<!-- <el-dropdown-item command="fileView">-->
|
|
|
|
+<!-- <Icon icon="ep:view" />预览-->
|
|
|
|
+<!-- </el-dropdown-item>-->
|
|
|
|
+ <el-dropdown-item command="fileDownload">
|
|
|
|
+ <Icon icon="ep:view" />下载
|
|
|
|
+ </el-dropdown-item>
|
|
|
|
+ </el-dropdown-menu>
|
|
|
|
+ </template>
|
|
|
|
+ </el-dropdown>
|
|
|
|
+ </div>
|
|
|
|
+ </template>
|
|
|
|
+ </el-table-column>
|
|
|
|
+ </el-table>
|
|
|
|
+ <Pagination
|
|
|
|
+ :total="total"
|
|
|
|
+ v-model:page="queryParams.pageNo"
|
|
|
|
+ v-model:limit="queryParams.pageSize"
|
|
|
|
+ @pagination="getList"
|
|
/>
|
|
/>
|
|
- <el-table-column label="操作" align="center" width="160">
|
|
|
|
- <template #default="scope">
|
|
|
|
- <div class="flex items-center justify-center">
|
|
|
|
- <el-button
|
|
|
|
- type="primary"
|
|
|
|
- link
|
|
|
|
- @click="openForm('update', scope.row.id)"
|
|
|
|
- >
|
|
|
|
- <Icon icon="ep:edit" />修改
|
|
|
|
- </el-button>
|
|
|
|
- <el-dropdown
|
|
|
|
- @command="(command) => handleCommand(command, scope.row)"
|
|
|
|
- v-hasPermi="[
|
|
|
|
- 'system:user:delete',
|
|
|
|
- 'system:user:update-password',
|
|
|
|
- 'system:permission:assign-user-role'
|
|
|
|
- ]"
|
|
|
|
- >
|
|
|
|
- <el-button type="primary" link><Icon icon="ep:d-arrow-right" /> 更多</el-button>
|
|
|
|
- <template #dropdown>
|
|
|
|
- <el-dropdown-menu>
|
|
|
|
- <el-dropdown-item
|
|
|
|
- command="handleDelete"
|
|
|
|
- >
|
|
|
|
- <Icon icon="ep:delete" />删除
|
|
|
|
- </el-dropdown-item>
|
|
|
|
- <el-dropdown-item
|
|
|
|
- command="fileView"
|
|
|
|
- >
|
|
|
|
- <Icon icon="ep:view" />预览
|
|
|
|
- </el-dropdown-item>
|
|
|
|
- <el-dropdown-item
|
|
|
|
- command="fileDownload"
|
|
|
|
- >
|
|
|
|
- <Icon icon="ep:view" />下载
|
|
|
|
- </el-dropdown-item>
|
|
|
|
- </el-dropdown-menu>
|
|
|
|
- </template>
|
|
|
|
- </el-dropdown>
|
|
|
|
- </div>
|
|
|
|
- </template>
|
|
|
|
- </el-table-column>
|
|
|
|
- </el-table>
|
|
|
|
- <Pagination
|
|
|
|
- :total="total"
|
|
|
|
- v-model:page="queryParams.pageNo"
|
|
|
|
- v-model:limit="queryParams.pageSize"
|
|
|
|
- @pagination="getList"
|
|
|
|
- />
|
|
|
|
- </ContentWrap>
|
|
|
|
- </el-col>
|
|
|
|
- </el-row>
|
|
|
|
- <IotInfoForm ref="formRef" @success="getList" :deviceId="deviceId" :classId="queryParams.classId"/>
|
|
|
|
|
|
+ </ContentWrap> </div
|
|
|
|
+ ></el-row>
|
|
|
|
+ </div>
|
|
|
|
+ <IotInfoForm
|
|
|
|
+ ref="formRef"
|
|
|
|
+ @success="getList"
|
|
|
|
+ :deviceId="deviceId"
|
|
|
|
+ :classId="queryParams.classId"
|
|
|
|
+ />
|
|
</template>
|
|
</template>
|
|
<script lang="ts" setup>
|
|
<script lang="ts" setup>
|
|
import { IotDeviceApi, IotDeviceVO } from '@/api/pms/device'
|
|
import { IotDeviceApi, IotDeviceVO } from '@/api/pms/device'
|
|
import FileTree from '@/views/pms/device/FileTree.vue'
|
|
import FileTree from '@/views/pms/device/FileTree.vue'
|
|
import { dateFormatter } from '@/utils/formatTime'
|
|
import { dateFormatter } from '@/utils/formatTime'
|
|
-import IotInfoForm from "@/views/pms/iotinfo/IotInfoForm.vue";
|
|
|
|
|
|
+import IotInfoForm from '@/views/pms/iotinfo/IotInfoForm.vue'
|
|
import * as IotInfoApi from '@/api/pms/iotinfo'
|
|
import * as IotInfoApi from '@/api/pms/iotinfo'
|
|
-import {SupplierVO} from "@/api/supplier/base";
|
|
|
|
-import {IotInfoVO} from "@/api/pms/iotinfo";
|
|
|
|
|
|
+import { IotInfoVO } from '@/api/pms/iotinfo'
|
|
|
|
+import { onMounted, ref } from 'vue'
|
|
|
|
+
|
|
defineOptions({ name: 'DeviceUpload' })
|
|
defineOptions({ name: 'DeviceUpload' })
|
|
const queryFormRef = ref() // 搜索的表单
|
|
const queryFormRef = ref() // 搜索的表单
|
|
const { t } = useI18n() // 国际化
|
|
const { t } = useI18n() // 国际化
|
|
@@ -119,13 +126,45 @@ const formLoading = ref(false) // 表单的加载中:1)修改时的数据加
|
|
const list = ref<IotDeviceVO[]>([]) // 列表的数据
|
|
const list = ref<IotDeviceVO[]>([]) // 列表的数据
|
|
const total = ref(0) // 列表的总页数
|
|
const total = ref(0) // 列表的总页数
|
|
const id = params.id as unknown as number
|
|
const id = params.id as unknown as number
|
|
|
|
+
|
|
|
|
+const container = ref(null)
|
|
|
|
+const leftWidth = ref(350) // 初始左侧宽度
|
|
|
|
+const rightWidth = ref(window.innerWidth * 0.69)
|
|
|
|
+let isDragging = false
|
|
|
|
+const openWeb = (url) => {
|
|
|
|
+ window.open('http://1.94.244.160:8012/onlinePreview?url='+encodeURIComponent(Base64.encode(url)));
|
|
|
|
+}
|
|
|
|
+const startDrag = (e) => {
|
|
|
|
+ isDragging = true
|
|
|
|
+ document.addEventListener('mousemove', onDrag)
|
|
|
|
+ document.addEventListener('mouseup', stopDrag)
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+const onDrag = (e) => {
|
|
|
|
+ if (!isDragging) return
|
|
|
|
+
|
|
|
|
+ const containerRect = container.value.getBoundingClientRect()
|
|
|
|
+ const newWidth = e.clientX - containerRect.left
|
|
|
|
+
|
|
|
|
+ // 设置最小和最大宽度限制
|
|
|
|
+ if (newWidth > 300 && newWidth < containerRect.width - 100) {
|
|
|
|
+ leftWidth.value = newWidth
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+const stopDrag = () => {
|
|
|
|
+ isDragging = false
|
|
|
|
+ document.removeEventListener('mousemove', onDrag)
|
|
|
|
+ document.removeEventListener('mouseup', stopDrag)
|
|
|
|
+}
|
|
|
|
+
|
|
const queryParams = reactive({
|
|
const queryParams = reactive({
|
|
pageNo: 1,
|
|
pageNo: 1,
|
|
pageSize: 10,
|
|
pageSize: 10,
|
|
fileName: null,
|
|
fileName: null,
|
|
createTime: [],
|
|
createTime: [],
|
|
deviceId: null,
|
|
deviceId: null,
|
|
- classId: null,
|
|
|
|
|
|
+ classId: null
|
|
})
|
|
})
|
|
// SPU 表单数据
|
|
// SPU 表单数据
|
|
const formData = ref({
|
|
const formData = ref({
|
|
@@ -136,7 +175,7 @@ const formData = ref({
|
|
fileType: undefined,
|
|
fileType: undefined,
|
|
filePath: undefined,
|
|
filePath: undefined,
|
|
remark: undefined,
|
|
remark: undefined,
|
|
- classId: undefined,
|
|
|
|
|
|
+ classId: undefined
|
|
})
|
|
})
|
|
const handleCommand = (command: string, row: IotInfoVO) => {
|
|
const handleCommand = (command: string, row: IotInfoVO) => {
|
|
switch (command) {
|
|
switch (command) {
|
|
@@ -158,27 +197,30 @@ const handleCommand = (command: string, row: IotInfoVO) => {
|
|
}
|
|
}
|
|
const handleDownload = async (url) => {
|
|
const handleDownload = async (url) => {
|
|
try {
|
|
try {
|
|
- const response = await fetch(url);
|
|
|
|
- const blob = await response.blob();
|
|
|
|
- const downloadUrl = window.URL.createObjectURL(blob);
|
|
|
|
|
|
+ const response = await fetch(url)
|
|
|
|
+ const blob = await response.blob()
|
|
|
|
+ const downloadUrl = window.URL.createObjectURL(blob)
|
|
|
|
|
|
- const link = document.createElement('a');
|
|
|
|
- link.href = downloadUrl;
|
|
|
|
- link.download = url.split('/').pop(); // 自动获取文件名:ml-citation{ref="3" data="citationList"}
|
|
|
|
- link.click();
|
|
|
|
|
|
+ const link = document.createElement('a')
|
|
|
|
+ link.href = downloadUrl
|
|
|
|
+ link.download = url.split('/').pop() // 自动获取文件名:ml-citation{ref="3" data="citationList"}
|
|
|
|
+ link.click()
|
|
|
|
|
|
- URL.revokeObjectURL(downloadUrl);
|
|
|
|
|
|
+ URL.revokeObjectURL(downloadUrl)
|
|
} catch (error) {
|
|
} catch (error) {
|
|
- console.error('下载失败:', error);
|
|
|
|
|
|
+ console.error('下载失败:', error)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
const handleFileView = (url: string) => {
|
|
const handleFileView = (url: string) => {
|
|
- window.open('http://1.94.244.160:8012/onlinePreview?url='+encodeURIComponent(Base64.encode(url)));
|
|
|
|
|
|
+ window.open(
|
|
|
|
+ 'http://1.94.244.160:8012/onlinePreview?url=' + encodeURIComponent(Base64.encode(url))
|
|
|
|
+ )
|
|
}
|
|
}
|
|
const handleDelete = async (id: number) => {
|
|
const handleDelete = async (id: number) => {
|
|
try {
|
|
try {
|
|
// 删除的二次确认
|
|
// 删除的二次确认
|
|
await message.delConfirm()
|
|
await message.delConfirm()
|
|
|
|
+
|
|
// 发起删除
|
|
// 发起删除
|
|
await IotInfoApi.IotInfoApi.deleteIotInfo(id)
|
|
await IotInfoApi.IotInfoApi.deleteIotInfo(id)
|
|
message.success(t('common.delSuccess'))
|
|
message.success(t('common.delSuccess'))
|
|
@@ -188,8 +230,8 @@ const handleDelete = async (id: number) => {
|
|
}
|
|
}
|
|
const formRef = ref()
|
|
const formRef = ref()
|
|
const openForm = (type: string, id?: number) => {
|
|
const openForm = (type: string, id?: number) => {
|
|
- if (!queryParams.classId){
|
|
|
|
- message.error("请选择左侧资料分类")
|
|
|
|
|
|
+ if (!queryParams.classId) {
|
|
|
|
+ message.error('请选择左侧资料分类')
|
|
return
|
|
return
|
|
}
|
|
}
|
|
formRef.value.open(type, id)
|
|
formRef.value.open(type, id)
|
|
@@ -212,14 +254,14 @@ const getDetail = async () => {
|
|
}
|
|
}
|
|
/** 查询列表 */
|
|
/** 查询列表 */
|
|
const getList = async () => {
|
|
const getList = async () => {
|
|
- loading.value = true
|
|
|
|
|
|
+ formLoading.value = true
|
|
try {
|
|
try {
|
|
queryParams.deviceId = deviceId.value
|
|
queryParams.deviceId = deviceId.value
|
|
const data = await IotInfoApi.IotInfoApi.getIotInfoPage(queryParams)
|
|
const data = await IotInfoApi.IotInfoApi.getIotInfoPage(queryParams)
|
|
list.value = data.list
|
|
list.value = data.list
|
|
total.value = data.total
|
|
total.value = data.total
|
|
} finally {
|
|
} finally {
|
|
- loading.value = false
|
|
|
|
|
|
+ formLoading.value = false
|
|
}
|
|
}
|
|
}
|
|
}
|
|
/** 搜索按钮操作 */
|
|
/** 搜索按钮操作 */
|
|
@@ -236,9 +278,39 @@ const resetQuery = () => {
|
|
/** 初始化 */
|
|
/** 初始化 */
|
|
onMounted(async () => {
|
|
onMounted(async () => {
|
|
await getDetail()
|
|
await getDetail()
|
|
-
|
|
|
|
|
|
+ await getList()
|
|
deviceId.value = params.id as unknown as number
|
|
deviceId.value = params.id as unknown as number
|
|
-
|
|
|
|
})
|
|
})
|
|
</script>
|
|
</script>
|
|
-<style scoped></style>
|
|
|
|
|
|
+<style scoped>
|
|
|
|
+.container-tree {
|
|
|
|
+ display: flex;
|
|
|
|
+ height: 100%;
|
|
|
|
+ user-select: none; /* 防止拖动时选中文本 */
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+.left-tree {
|
|
|
|
+ background: #f0f0f0;
|
|
|
|
+ height: 100%;
|
|
|
|
+ overflow: auto;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+.right-tree {
|
|
|
|
+ flex: 1;
|
|
|
|
+ background: #fff;
|
|
|
|
+ height: 100%;
|
|
|
|
+ overflow: auto;
|
|
|
|
+ margin-left: 5px;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+.divider-tree {
|
|
|
|
+ width: 2px;
|
|
|
|
+ background: #ccc;
|
|
|
|
+ cursor: col-resize;
|
|
|
|
+ position: relative;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+.divider-tree:hover {
|
|
|
|
+ background: #666;
|
|
|
|
+}
|
|
|
|
+</style>
|