潘志宝
2025-02-12 413d6598687f262ec27b6c5521fab0922f8930c4
提交 | 用户 | 时间
7462da 1 import request from '@/config/axios'
7b1ce6 2 import {UploadRequestOptions} from "element-plus/es/components/upload/src/upload";
7462da 3
7b1ce6 4 export interface MmPredictItemVO {
5   id: string,
7462da 6   itemtypename: string,
7b1ce6 7   mmPredictItem: {
8     id: string,
9     itemno: string,
10     itemname: string,
11     caltypeid: string,
12     itemtypeid: string,
13     predictlength: string,
14     granularity: number,
15     status: string,
16     isfuse: number,
17     predictphase: string,
18     workchecked: number,
19     unittransfactor: string,
413d65 20     saveindex: string,
21     iscumulant: number,
22     cumuldivisor: number,
23     cumulpoint: string
7b1ce6 24   },
25   dmModuleItem: {
26     id: string,
27     moduleid: string,
28     itemid: string,
29     itemorder: number,
30     status: number,
31     categoryid: string
32   },
33   mmItemOutput: {
34     id: string,
35     itemid: string,
36     pointid: string,
37     resulttableid: string,
38     tagname: string,
39     outputorder: number
40   },
41   mmPredictModel: {
42     id: string,
43     modelno: string,
44     modelname: string,
45     itemid: string,
46     arithid: string,
47     trainsamplength: number,
48     predictsamplength: string,
49     isonlinetrain: string,
50     modelpath: string,
51     isnormal: string,
52     normalmax: string,
53     normalmin: string,
54     status: number,
55     classname: string,
56     methodname: string,
57     modelparamstructure: string,
58     resultstrid: string,
59     settingmap: string
60   },
61   mmPredictMergeItem: {
62     id: string,
63     itemid: string,
64     expression: string,
65     num: string
66   },
67   modelparamtypeList: [],
68   mmModelArithSettingsList: [],
69   mmModelParamList: []
7462da 70 }
L 71
7b1ce6 72 export interface MmPredictItemPageReqVO extends PageParam {
73   itemno?: string,
74   itemname?: string,
6dbd81 75   itemtypeid?: string,
379650 76   modulename?: string,
7462da 77 }
L 78
7b1ce6 79 // 查询MmPredictItem列表
80 export const getMmPredictItemPage = (params: MmPredictItemPageReqVO) => {
81   return request.get({ url: '/model/pre/item/page', params })
7462da 82 }
L 83
7b1ce6 84 // 查询MmPredictItem详情
85 export const getMmPredictItem = (id: number) => {
86   return request.get({ url: `/model/pre/item/get/${id}`})
7462da 87 }
L 88
7b1ce6 89 // 新增MmPredictItem
90 export const createMmPredictItem = (data: MmPredictItemVO) => {
91   return request.post({ url: '/model/pre/item/create', data })
7462da 92 }
L 93
7b1ce6 94 // 修改MmPredictItem
95 export const updateMmPredictItem = (data: MmPredictItemVO) => {
96   return request.put({ url: '/model/pre/item/update', data })
7462da 97 }
L 98
7b1ce6 99 // 删除MmPredictItem
100 export const deleteMmPredictItem = (id: number) => {
101   return request.delete({ url: '/model/pre/item/delete?id=' + id })
cd9f11 102 }
L 103
7b1ce6 104 // 查询MmPredictItem列表
105 export const getMmPredictItemList = (params) => {
106   return request.get({ url: `/model/pre/item/list`, params})
107 }
cd9f11 108
ebc552 109 // 查询MmItemOutput列表
L 110 export const getMmItemOutputList = (params) => {
111   return request.get({ url: `/model/pre/item-output/list/all`, params})
112 }
113
7b1ce6 114 export const updateModel = (data: any) => {
115   return request.upload({ url: '/model/pre/item/upload-model', data })
116 }
117
118 export const useUpload = () => {
119   const uploadUrl = import.meta.env.VITE_BASE_URL + '/admin-api/model/pre/item/upload-model'
120
121   const httpRequest = async (options: UploadRequestOptions) => {
122     return new Promise((resolve, reject) => {
123       updateModel({ file: options.file })
124         .then((res) => {
125           if (res.code === 0) {
126             resolve(res)
127           } else {
128             reject(res)
129           }
130         })
131         .catch((res) => {
132           reject(res)
133         })
134     })
135
136   }
137
138   return {
139     uploadUrl,
140     httpRequest
141   }
142 }
143
144 export const getMmPredictItemTree = () => {
145   return request.get({ url: `/model/pre/item/tree`})
146 }
147
148 export const getViewCharts = (params) => {
149   return request.get({ url: `/model/pre/item/view-charts`,params})
7462da 150 }