|
@@ -16,10 +16,10 @@
|
|
|
:inline="true"
|
|
|
label-width="68px"
|
|
|
>
|
|
|
- <el-form-item label="文件名称" prop="fileName">
|
|
|
+ <el-form-item label="物料名称" prop="name">
|
|
|
<el-input
|
|
|
- v-model="queryParams.fileName"
|
|
|
- placeholder="请输入文件名称"
|
|
|
+ v-model="queryParams.name"
|
|
|
+ placeholder="请输入物料名称"
|
|
|
clearable
|
|
|
@keyup.enter="handleQuery"
|
|
|
class="!w-240px"
|
|
@@ -28,9 +28,6 @@
|
|
|
<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>
|
|
@@ -41,16 +38,10 @@
|
|
|
: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="fileSize" />
|
|
|
- <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="code" />
|
|
|
+ <el-table-column label="物料名称" align="center" prop="name" />
|
|
|
+ <el-table-column label="规格型号" align="center" prop="model" />
|
|
|
+ <el-table-column label="单位" align="center" prop="unit" />
|
|
|
<el-table-column label="备注" align="center" prop="remark" />
|
|
|
<el-table-column
|
|
|
label="创建时间"
|
|
@@ -59,38 +50,6 @@
|
|
|
: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"
|
|
@@ -109,14 +68,12 @@
|
|
|
/>
|
|
|
</template>
|
|
|
<script lang="ts" setup>
|
|
|
-import { IotDeviceApi, IotDeviceVO } from '@/api/pms/device'
|
|
|
-import FileTree from '@/views/pms/device/FileTree.vue'
|
|
|
+import { IotDeviceVO } from '@/api/pms/device'
|
|
|
import { dateFormatter } from '@/utils/formatTime'
|
|
|
import IotInfoForm from '@/views/pms/iotinfo/IotInfoForm.vue'
|
|
|
-import * as IotInfoApi from '@/api/pms/iotinfo'
|
|
|
-import { IotInfoVO } from '@/api/pms/iotinfo'
|
|
|
import { onMounted, ref } from 'vue'
|
|
|
-import BomTree from "@/views/pms/device/BomTree.vue";
|
|
|
+import BomTree from '@/views/pms/device/BomTree.vue'
|
|
|
+import * as PmsMaterialApi from '@/api/pms/material'
|
|
|
|
|
|
defineOptions({ name: 'DeviceUpload' })
|
|
|
const queryFormRef = ref() // 搜索的表单
|
|
@@ -132,9 +89,6 @@ 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)
|
|
@@ -162,94 +116,23 @@ const stopDrag = () => {
|
|
|
const queryParams = reactive({
|
|
|
pageNo: 1,
|
|
|
pageSize: 10,
|
|
|
- fileName: null,
|
|
|
createTime: [],
|
|
|
deviceId: null,
|
|
|
- classId: null
|
|
|
+ bomId: null,
|
|
|
+ name: null
|
|
|
})
|
|
|
-// SPU 表单数据
|
|
|
-const handleCommand = (command: string, row: IotInfoVO) => {
|
|
|
- switch (command) {
|
|
|
- case 'handleDelete':
|
|
|
- handleDelete(row.id)
|
|
|
- break
|
|
|
- case 'handleUpdate':
|
|
|
- openForm('update', row.id)
|
|
|
- break
|
|
|
- case 'fileView':
|
|
|
- handleFileView(row.filePath)
|
|
|
- break
|
|
|
- case 'fileDownload':
|
|
|
- handleDownload(row.filePath)
|
|
|
- break
|
|
|
- default:
|
|
|
- break
|
|
|
- }
|
|
|
-}
|
|
|
-const handleDownload = async (url) => {
|
|
|
- try {
|
|
|
- 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()
|
|
|
-
|
|
|
- URL.revokeObjectURL(downloadUrl)
|
|
|
- } catch (error) {
|
|
|
- console.error('下载失败:', error)
|
|
|
- }
|
|
|
-}
|
|
|
-const handleFileView = (url: string) => {
|
|
|
- window.open(
|
|
|
- 'http://1.94.244.160:8012/onlinePreview?url=' + encodeURIComponent(Base64.encode(url))
|
|
|
- )
|
|
|
-}
|
|
|
-const handleDelete = async (id: number) => {
|
|
|
- try {
|
|
|
- // 删除的二次确认
|
|
|
- await message.delConfirm()
|
|
|
-
|
|
|
- // 发起删除
|
|
|
- await IotInfoApi.IotInfoApi.deleteIotInfo(id)
|
|
|
- message.success(t('common.delSuccess'))
|
|
|
- // 刷新列表
|
|
|
- await getList()
|
|
|
- } catch {}
|
|
|
-}
|
|
|
const formRef = ref()
|
|
|
-const openForm = (type: string, id?: number) => {
|
|
|
- if (!queryParams.classId) {
|
|
|
- message.error('请选择左侧资料分类')
|
|
|
- return
|
|
|
- }
|
|
|
- formRef.value.open(type, id)
|
|
|
-}
|
|
|
const deviceId = ref('')
|
|
|
const handleFileNodeClick = async (row) => {
|
|
|
- queryParams.classId = row.id
|
|
|
+ queryParams.bomId = row.id
|
|
|
await getList()
|
|
|
}
|
|
|
-/** 获得详情 */
|
|
|
-// const getDetail = async () => {
|
|
|
-// if (id) {
|
|
|
-// formLoading.value = true
|
|
|
-// try {
|
|
|
-// formData.value = (await IotDeviceApi.getIotDevice(id)) as IotDeviceVO
|
|
|
-//
|
|
|
-// } finally {
|
|
|
-// formLoading.value = false
|
|
|
-// }
|
|
|
-// }
|
|
|
-// }
|
|
|
/** 查询列表 */
|
|
|
const getList = async () => {
|
|
|
formLoading.value = true
|
|
|
try {
|
|
|
- queryParams.deviceId = deviceId.value
|
|
|
- const data = await IotInfoApi.IotInfoApi.getIotInfoPage(queryParams)
|
|
|
+ // queryParams.deviceId = deviceId.value
|
|
|
+ const data = await PmsMaterialApi.listByBomId(queryParams)
|
|
|
list.value = data.list
|
|
|
total.value = data.total
|
|
|
} finally {
|