|
@@ -1,7 +1,9 @@
|
|
|
+import { AxiosResponse } from 'axios'
|
|
|
+
|
|
|
import {ContentType, HttpClient, RequestParams} from "/@/api/admin/http-client";
|
|
|
import {
|
|
|
softwarePackageManagement_DtoResult,
|
|
|
- softwarePackageManagement_PageInput, softwarePackageManagement_TableData
|
|
|
+ softwarePackageManagement_PageInput, softwarePackageManagement_TableData,softwarePackageManagement_SearchFilter
|
|
|
} from "/@/api/admin/deviceAuthorization/softwarePackageManagementDto";
|
|
|
import {oilSdkAuthorPageOutput, oilSdkTableModel} from "/@/api/admin/deviceAuthorization/oilSdkAuthorDto";
|
|
|
|
|
@@ -17,7 +19,28 @@ export class SoftwarePackageManagementApi<SecurityDataType = unknown> extends Ht
|
|
|
* @request GET:
|
|
|
* @secure
|
|
|
*/
|
|
|
- getPageData = (query: softwarePackageManagement_PageInput) =>{
|
|
|
+
|
|
|
+ getPageData = (data: softwarePackageManagement_PageInput, params: RequestParams = {}) =>
|
|
|
+ this.request<softwarePackageManagement_TableData, any>({
|
|
|
+ path: `/api/app/software/get-page`,
|
|
|
+ method: 'POST',
|
|
|
+ body: data,
|
|
|
+ secure: true,
|
|
|
+ type: ContentType.Json,
|
|
|
+ format: 'json',
|
|
|
+ ...params,
|
|
|
+ })
|
|
|
+ getPageData2 = (query: softwarePackageManagement_PageInput) =>{
|
|
|
+ debugger
|
|
|
+ var dd = this.request<AxiosResponse, any>({
|
|
|
+ path: `/api/app/software/get-page`,
|
|
|
+ method: 'POST',
|
|
|
+ body: query,
|
|
|
+ secure: true,
|
|
|
+ type: ContentType.Json,
|
|
|
+ format: 'json',
|
|
|
+ })
|
|
|
+ debugger
|
|
|
return new Promise(resolve => {
|
|
|
setTimeout(() => {
|
|
|
resolve({
|
|
@@ -28,7 +51,7 @@ export class SoftwarePackageManagementApi<SecurityDataType = unknown> extends Ht
|
|
|
total: 100,
|
|
|
list:[{
|
|
|
guid: 1,
|
|
|
- date: '2020-10-21',
|
|
|
+ date: '2020-11-22',
|
|
|
softwareType: 0,
|
|
|
equipmentType:0,
|
|
|
softwareName: 'test',
|
|
@@ -96,9 +119,11 @@ export class SoftwarePackageManagementApi<SecurityDataType = unknown> extends Ht
|
|
|
* @request GET:
|
|
|
* @secure
|
|
|
*/
|
|
|
- updateData = (data:softwarePackageManagement_TableData) => {
|
|
|
+ updateData = (data:softwarePackageManagement_TableData) => {
|
|
|
return new Promise(resolve => {
|
|
|
+ // 设置定时器
|
|
|
setTimeout(() => {
|
|
|
+ // 返回更新后的数据
|
|
|
resolve({
|
|
|
success: true,
|
|
|
code: 200,
|
|
@@ -109,6 +134,36 @@ export class SoftwarePackageManagementApi<SecurityDataType = unknown> extends Ht
|
|
|
})
|
|
|
}
|
|
|
|
|
|
+ uploadFile = (
|
|
|
+ data: {
|
|
|
+ /** @format binary */
|
|
|
+ file: File
|
|
|
+ },
|
|
|
+ query?: {
|
|
|
+ /**
|
|
|
+ * 文件目录
|
|
|
+ * @default ""
|
|
|
+ */
|
|
|
+ fileDirectory?: string
|
|
|
+ /**
|
|
|
+ * 文件重命名
|
|
|
+ * @default true
|
|
|
+ */
|
|
|
+ fileReName?: boolean
|
|
|
+ },
|
|
|
+ params: RequestParams = {}
|
|
|
+ ) =>
|
|
|
+ this.request<softwarePackageManagement_DtoResult, any>({
|
|
|
+ path: `/api/app/software/upload-file`,
|
|
|
+ method: 'POST',
|
|
|
+ query: query,
|
|
|
+ body: data,
|
|
|
+ secure: true,
|
|
|
+ type: ContentType.FormData,
|
|
|
+ format: 'json',
|
|
|
+ ...params,
|
|
|
+ })
|
|
|
+
|
|
|
/**
|
|
|
* No description
|
|
|
*
|
|
@@ -118,16 +173,54 @@ export class SoftwarePackageManagementApi<SecurityDataType = unknown> extends Ht
|
|
|
* @request GET:
|
|
|
* @secure
|
|
|
*/
|
|
|
- addData = (data:softwarePackageManagement_TableData) => {
|
|
|
- return new Promise(resolve => {
|
|
|
- setTimeout(() => {
|
|
|
- resolve({
|
|
|
- success: true,
|
|
|
- code: 200,
|
|
|
- msg: '',
|
|
|
- data: {}
|
|
|
- })
|
|
|
- },this.timer)
|
|
|
- })
|
|
|
+ addData = (data:softwarePackageManagement_TableData) =>
|
|
|
+ this.request<AxiosResponse, any>({
|
|
|
+ path: `/api/app/software/upload-file`,
|
|
|
+ method: 'POST',
|
|
|
+ body: data,
|
|
|
+ secure: true,
|
|
|
+ type: ContentType.Json,
|
|
|
+ format: 'json',
|
|
|
+ })
|
|
|
+
|
|
|
+/**
|
|
|
+ * No description
|
|
|
+ *
|
|
|
+ * @tags
|
|
|
+ * @name getPageData
|
|
|
+ * @summary 分页查询
|
|
|
+ * @request GET:
|
|
|
+ * @secure
|
|
|
+ */
|
|
|
+/* DownloadFile = (data:softwarePackageManagement_TableData) =>
|
|
|
+this.request<AxiosResponse, any>({
|
|
|
+ path: `/api/app/software/download-file`,
|
|
|
+ method: 'GET',
|
|
|
+ body: data,
|
|
|
+ secure: true,
|
|
|
+ type: ContentType.Json,
|
|
|
+ format: 'json',
|
|
|
+}) */
|
|
|
+DownloadFile = async (data: softwarePackageManagement_TableData) => {
|
|
|
+ try {
|
|
|
+ const response = await this.request<AxiosResponse, any>({
|
|
|
+ path: `/api/app/software/download-file?guid=`+data.guid,
|
|
|
+ method: 'GET',
|
|
|
+ body: data,
|
|
|
+ secure: true,
|
|
|
+ type: ContentType.Json,
|
|
|
+ format: 'json',
|
|
|
+ responseType: 'blob', // 添加这一行
|
|
|
+ });
|
|
|
+ const filename = data.fileName?.toString();
|
|
|
+ const blob = new Blob([response.data], { type: 'application/x-rar-compressed' });
|
|
|
+ const link = document.createElement('a');
|
|
|
+ debugger
|
|
|
+ link.href = URL.createObjectURL(blob);
|
|
|
+ link.download = filename; // 请替换为实际文件名
|
|
|
+ link.click();
|
|
|
+ } catch (error) {
|
|
|
+ console.error('下载失败:', error);
|
|
|
}
|
|
|
+};
|
|
|
}
|