From 6e2f8da03ff34a9f24bd944b17023f5a4038ef7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E5=B0=8F=E6=9E=97?= <320730042@qq.com> Date: Fri, 17 May 2024 09:35:31 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9Etr069?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/device-type-ver/index.ts | 26 ++- src/api/device-type-ver/types.ts | 9 + src/api/device-type/index.ts | 50 +++++ src/api/file/index.ts | 9 + src/api/file/types.ts | 11 +- src/api/tr069/index.ts | 45 ++++ src/api/tr069/types.ts | 26 +++ src/assets/icons/document_tree.svg | 1 + src/components/Table/TableBar.vue | 4 +- src/router/index.ts | 7 + .../components/AddDevTypeVersion.vue | 93 ++++++++ .../device-type/components/AddDomianTree.vue | 4 +- .../{AddVendorProfile.vue => AddFile.vue} | 20 +- .../components/DeviceTypeToVer.vue | 48 ++++- .../components/DeviceTypeVersionEdit.vue | 76 ++++++- src/views/resources/device-type/index.vue | 113 +++++++++- .../tr069/components/AddTr069File.vue | 112 ++++++++++ .../resources/tr069/components/Tr069Tree.vue | 198 ++++++++++++++++++ src/views/resources/tr069/index.vue | 115 ++++++++++ 19 files changed, 929 insertions(+), 38 deletions(-) create mode 100644 src/api/tr069/index.ts create mode 100644 src/api/tr069/types.ts create mode 100644 src/assets/icons/document_tree.svg create mode 100644 src/views/resources/device-type/components/AddDevTypeVersion.vue rename src/views/resources/device-type/components/{AddVendorProfile.vue => AddFile.vue} (87%) create mode 100644 src/views/resources/tr069/components/AddTr069File.vue create mode 100644 src/views/resources/tr069/components/Tr069Tree.vue create mode 100644 src/views/resources/tr069/index.vue diff --git a/src/api/device-type-ver/index.ts b/src/api/device-type-ver/index.ts index 30b585d..9f90f1b 100644 --- a/src/api/device-type-ver/index.ts +++ b/src/api/device-type-ver/index.ts @@ -1,8 +1,8 @@ import { DeviceTypeToVerPageResult, DeviceTypeToVerQuery, - DeviceTypeVerForm, - GroupNamePageResult, + DeviceTypeVerForm, DevVerServicePageResult, + GroupNamePageResult } from "@/api/device-type-ver/types"; import request from "@/utils/request"; import { AxiosPromise } from "axios"; @@ -121,4 +121,24 @@ export function editVerDomain(typeAndVerId: number, data: number[]) { method: "POST", data, }); -}; +} +export function pageService( + data: PageQuery, + typeAndVerId: number +): AxiosPromise { + return request({ + url: `/api/device-type-ver/v1/page-service/${typeAndVerId}`, + method: "GET", + params: { + pageNum: data.pageNum, + pageSize: data.pageSize, + }, + }); +} +export function addTypeVer(devTypeId: number, data: DeviceTypeVerForm) { + return request({ + url: `/api/device-type-ver/v1/add-type-ver/${devTypeId}`, + method: "POST", + data, + }); +} diff --git a/src/api/device-type-ver/types.ts b/src/api/device-type-ver/types.ts index 53d964d..765a027 100644 --- a/src/api/device-type-ver/types.ts +++ b/src/api/device-type-ver/types.ts @@ -32,3 +32,12 @@ export interface DeviceTypeVerForm { } export type GroupNamePageResult = PageResult; + +export interface DeviceServiceVO { + servId?: number; + servName?: string; + servVerName?: string; + servDisplayName?: string; + servDesc?: string; +} +export type DevVerServicePageResult = PageResult; diff --git a/src/api/device-type/index.ts b/src/api/device-type/index.ts index ef26932..b055d2d 100644 --- a/src/api/device-type/index.ts +++ b/src/api/device-type/index.ts @@ -22,3 +22,53 @@ export function findDevTypeById(devTypeId: number): AxiosPromise { method: "GET", }); } +export function getVendorNameOption(): AxiosPromise { + return request({ + url: `/api/dev-type/v1/vendor-name-option`, + method: "GET", + }); +} + +export function getVendorOuiOption( + vendorName?: string +): AxiosPromise { + return request({ + url: `/api/dev-type/v1/vendor-oui-option/`, + method: "GET", + params: { + vendorName, + }, + }); +} + +export function getTypeNameOption( + vendorOui?: string +): AxiosPromise { + return request({ + url: `/api/dev-type/v1/type-name-option/`, + method: "GET", + params: { + vendorOui, + }, + }); +} + +export function getHardVerOption( + typeName?: string +): AxiosPromise { + return request({ + url: `/api/dev-type/v1/hard-ver-option/`, + method: "GET", + params: { + typeName: typeName, + }, + }); +} + +export function deleteDevTypeByIds(ids: number[]) { + return request({ + url: `/api/dev-type/v1/deletes/`, + method: "POST", + data: ids, + }); +} diff --git a/src/api/file/index.ts b/src/api/file/index.ts index 8815643..458a421 100644 --- a/src/api/file/index.ts +++ b/src/api/file/index.ts @@ -1,5 +1,6 @@ import request from "@/utils/request"; import { AxiosPromise } from "axios"; +import { Tr069XmlFileForm } from "@/api/file/types"; /** * 文件下载 @@ -29,3 +30,11 @@ export function uploadApi( }, }); } + +export function addTr069FileRecord(data: Tr069XmlFileForm) { + return request({ + url: "/api/file_list/v1/add", + method: "POST", + data, + }); +} diff --git a/src/api/file/types.ts b/src/api/file/types.ts index 7e2ae15..12755a4 100644 --- a/src/api/file/types.ts +++ b/src/api/file/types.ts @@ -7,9 +7,18 @@ export interface FileInfo { } export interface VendorProfile { + typeAndVerId?: number; - typeAndVerId?:number; + fileName?: string; + + fileDesc?: string; + + fileType?: string; + + fileUrl?: string; +} +export interface Tr069XmlFileForm { fileName?: string; fileDesc?: string; diff --git a/src/api/tr069/index.ts b/src/api/tr069/index.ts new file mode 100644 index 0000000..9016a29 --- /dev/null +++ b/src/api/tr069/index.ts @@ -0,0 +1,45 @@ +import request from "@/utils/request"; +import { AxiosPromise } from "axios"; +import { Tr069VerForm, Tr069VerPageResult, Tr069Xml } from "@/api/tr069/types"; + +export function getTr069Page( + data: PageQuery +): AxiosPromise { + return request({ + url: "/api/tr069/v1/page", + method: "POST", + data, + }); +} +export function getTr069XmlTree(fileId?: number): AxiosPromise { + return request({ + url: `/api/tr069/v1/tree/${fileId}`, + method: "get", + }); +} +export function getTr069XmlOption(): AxiosPromise { + return request({ + url: `/api/tr069/v1/tr069-model/option`, + method: "get", + }); +} +export function getTr069Form(tr069VerId: number): AxiosPromise { + return request({ + url: `/api/tr069/v1/${tr069VerId}`, + method: "get", + }); +} +export function editTr069(data: Tr069VerForm) { + return request({ + url: `/api/tr069/v1/edit`, + method: "POST", + data, + }); +} +export function addTr069(data: Tr069VerForm){ + return request({ + url: `/api/tr069/v1/add`, + method: "POST", + data, + }); +} diff --git a/src/api/tr069/types.ts b/src/api/tr069/types.ts new file mode 100644 index 0000000..2d8b449 --- /dev/null +++ b/src/api/tr069/types.ts @@ -0,0 +1,26 @@ +export interface Tr069VerVO { + tr069VerId?: number; + tr069VerName?: string; + tr069VerDesc?: string; + fileName?: string; + fileId?: number; +} +export type Tr069VerPageResult = PageResult; +export interface Tr069VerForm { + tr069VerId?: number; + tr069VerName?: string; + tr069VerDesc?: string; + fileId?: number; +} + +export interface Tr069Xml { + tagName?: string; + + read?: string; + + write?: string; + + type?: string; + + children?: Array; +} diff --git a/src/assets/icons/document_tree.svg b/src/assets/icons/document_tree.svg new file mode 100644 index 0000000..4896103 --- /dev/null +++ b/src/assets/icons/document_tree.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/components/Table/TableBar.vue b/src/components/Table/TableBar.vue index 1d8d863..5980dfc 100644 --- a/src/components/Table/TableBar.vue +++ b/src/components/Table/TableBar.vue @@ -46,7 +46,7 @@ + + diff --git a/src/views/resources/device-type/components/AddDomianTree.vue b/src/views/resources/device-type/components/AddDomianTree.vue index fac4b72..bd6565b 100644 --- a/src/views/resources/device-type/components/AddDomianTree.vue +++ b/src/views/resources/device-type/components/AddDomianTree.vue @@ -14,7 +14,7 @@ @@ -27,7 +27,7 @@ import { editVerDomain, listVerDomain } from "@/api/device-type-ver"; const loading = ref(false); const openDomainTreeFlag = ref(false); const typeAndVerId = ref(0); -const openDomainTree = (typeAndVerId_?: number) => { +const openDomainTree = (typeAndVerId_: number) => { openDomainTreeFlag.value = true; typeAndVerId.value = typeAndVerId_; loadResource(); diff --git a/src/views/resources/device-type/components/AddVendorProfile.vue b/src/views/resources/device-type/components/AddFile.vue similarity index 87% rename from src/views/resources/device-type/components/AddVendorProfile.vue rename to src/views/resources/device-type/components/AddFile.vue index bbf7854..b447790 100644 --- a/src/views/resources/device-type/components/AddVendorProfile.vue +++ b/src/views/resources/device-type/components/AddFile.vue @@ -3,7 +3,7 @@ class="com-dialog" v-model="vendorProfileFlag" align-center - title="新增厂商配置文件信息" + :title="title" > - + - + @@ -38,7 +38,7 @@ 保存 - 取消 + 取消 @@ -54,15 +54,17 @@ const loading = ref(false); const vendorProfileFlag = ref(false); const addVendorProfileRef = ref(); const fileList = ref([]); -const formData = ref({ - fileType: "1", -}); -const open = (typeAndVerId?: number) => { +const formData = ref({}); +const title = ref(""); +const open = (typeAndVerId?: number, fileType_?: string, title_?: string) => { resetForm(addVendorProfileRef.value); fileList.value = []; formData.value = { - fileType: "1", + fileType: fileType_, }; + if (title_ != null) { + title.value = title_; + } vendorProfileFlag.value = true; formData.value.typeAndVerId = typeAndVerId; }; diff --git a/src/views/resources/device-type/components/DeviceTypeToVer.vue b/src/views/resources/device-type/components/DeviceTypeToVer.vue index 735193a..447d1d0 100644 --- a/src/views/resources/device-type/components/DeviceTypeToVer.vue +++ b/src/views/resources/device-type/components/DeviceTypeToVer.vue @@ -55,6 +55,17 @@ +
+
+
设备类型对应的设备软件版本列表
+
+ + + 增加设备类型软件版本 + +
+
+
- {{scope.row.softVer}} + {{ scope.row.softVer }} @@ -82,7 +93,13 @@ @click="handleDownload(scope.row.fileId)" >{{ scope.row.fileName }} - 上传文件 + 上传文件 @@ -217,6 +241,8 @@ import { findDevTypeById } from "@/api/device-type"; import { downloadFileApi } from "@/api/file"; import { downloadHook } from "@/utils"; import { DocumentCopy, InfoFilled, View } from "@element-plus/icons-vue"; +import AddDevTypeVersion from "@/views/resources/device-type/components/AddDevTypeVersion.vue"; +import AddFile from "@/views/resources/device-type/components/AddFile.vue"; const loading = ref(false); const voLoading = ref(false); @@ -329,6 +355,14 @@ const redirect = (typeAndVerId: number) => { path: `/resources/device_type_version_edit/${devTypeId}/${typeAndVerId}`, }); }; +const addDevTypeVerRef = ref(); +const openAddTypeVer = () => { + addDevTypeVerRef.value.open(devTypeId); +}; +const addTypeVerFileRef = ref(); +const openAddVerFile = (typeAndVerId?: number) => { + addTypeVerFileRef.value.open(typeAndVerId, "0", "新增设备软件版本文件"); +}; onMounted(() => { loadDevTypeById(); loadDeviceTypeToVerPage(); diff --git a/src/views/resources/device-type/components/DeviceTypeVersionEdit.vue b/src/views/resources/device-type/components/DeviceTypeVersionEdit.vue index c71bfc5..8aa0f62 100644 --- a/src/views/resources/device-type/components/DeviceTypeVersionEdit.vue +++ b/src/views/resources/device-type/components/DeviceTypeVersionEdit.vue @@ -1,7 +1,7 @@ diff --git a/src/views/resources/device-type/index.vue b/src/views/resources/device-type/index.vue index 920ab43..0700e8b 100644 --- a/src/views/resources/device-type/index.vue +++ b/src/views/resources/device-type/index.vue @@ -69,14 +69,20 @@
- +
@@ -86,7 +92,9 @@ v-loading="loading" highlight-current-row style="width: 100%" + @selection-change="handleSelectionChange" > + import { DeviceTypePageVO, DeviceTypeQuery } from "@/api/device-type/types"; -import { getDeviceTypePage } from "@/api/device-type"; +import { + deleteDevTypeByIds, + getDeviceTypePage, + getHardVerOption, + getTypeNameOption, + getVendorNameOption, + getVendorOuiOption, +} from "@/api/device-type"; defineOptions({ name: "DeviceType", inheritAttrs: false, @@ -181,6 +201,10 @@ const changeColumns = (newColumns: TableColumns[]) => { }; const total = ref(0); const searchForm = ref({ + devTypeName: "", + devVendorOui: "", + devHardVer: "", + devVendorName: "", pageNum: 1, pageSize: 10, }); @@ -189,7 +213,78 @@ const vendorOuiOption = ref([]); const typeNameOption = ref([]); const hardVerOption = ref([]); const tableData = ref([]); +const multipleSelection = ref([]); +const handleSelectionChange = (val: DeviceTypePageVO[]) => { + multipleSelection.value = val; +}; +const handleDeletes = () => { + if (multipleSelection.value.length === 0) { + ElMessage.error("请至少选择一条记录来删除"); + return; + } + ElMessageBox.confirm("该操作将永久删除该数据,是否继续?", "Warning", { + confirmButtonText: "确认", + cancelButtonText: "取消", + type: "warning", + }).then(() => { + let ids: number[] = []; + multipleSelection.value.forEach((obj) => { + ids.push(obj.devTypeId); + }); + deleteDevTypeByIds(ids).then(() => { + ElMessage.success("操作成功"); + loadDeviceTypePage(); + }); + }); +}; +watch( + () => searchForm.value.devVendorName, + () => { + if (searchForm.value.devVendorName === undefined) { + return; + } + loadVendorOuiOption(); + } +); +watch( + () => searchForm.value.devVendorOui, + () => { + if (searchForm.value.devVendorOui === undefined) { + return; + } + loadTypeNameOption(); + } +); +watch( + () => searchForm.value.devTypeName, + () => { + if (searchForm.value.devTypeName === undefined) { + return; + } + loadHardVerOption(); + } +); +const loadVendorNameOption = async () => { + await getVendorNameOption().then(({ data }) => { + vendorNameOption.value = data; + }); +}; +const loadVendorOuiOption = async () => { + await getVendorOuiOption(searchForm.value.devVendorName).then(({ data }) => { + vendorOuiOption.value = data; + }); +}; +const loadTypeNameOption = async () => { + await getTypeNameOption(searchForm.value.devVendorOui).then(({ data }) => { + typeNameOption.value = data; + }); +}; +const loadHardVerOption = async () => { + await getHardVerOption(searchForm.value.devTypeName).then(({ data }) => { + hardVerOption.value = data; + }); +}; const loadDeviceTypePage = () => { loading.value = true; getDeviceTypePage(searchForm.value) @@ -207,6 +302,12 @@ const redirect = (devTypeId: number) => { path: `/resources/device_type_to_ver/${devTypeId}`, }); }; +onMounted(() => { + loadVendorNameOption(); + loadVendorOuiOption(); + loadTypeNameOption(); + loadHardVerOption(); +}); diff --git a/src/views/resources/tr069/components/AddTr069File.vue b/src/views/resources/tr069/components/AddTr069File.vue new file mode 100644 index 0000000..412f3b1 --- /dev/null +++ b/src/views/resources/tr069/components/AddTr069File.vue @@ -0,0 +1,112 @@ + + + + + diff --git a/src/views/resources/tr069/components/Tr069Tree.vue b/src/views/resources/tr069/components/Tr069Tree.vue new file mode 100644 index 0000000..f81a831 --- /dev/null +++ b/src/views/resources/tr069/components/Tr069Tree.vue @@ -0,0 +1,198 @@ + + + + + diff --git a/src/views/resources/tr069/index.vue b/src/views/resources/tr069/index.vue new file mode 100644 index 0000000..d827154 --- /dev/null +++ b/src/views/resources/tr069/index.vue @@ -0,0 +1,115 @@ + + + + +