| | |
| | | import request from '@/config/axios' |
| | | import {UploadRequestOptions} from "element-plus/es/components/upload/src/upload"; |
| | | |
| | | export interface MmPredictItemVO { |
| | | id: string, |
| | |
| | | |
| | | // 查询MmPredictItem列表 |
| | | export const getMmPredictItemPage = (params: MmPredictItemPageReqVO) => { |
| | | return request.get({ url: '/model/pre/predict-item/page', params }) |
| | | return request.get({ url: '/model/pre/item/page', params }) |
| | | } |
| | | |
| | | // 查询MmPredictItem详情 |
| | | export const getMmPredictItem = (id: number) => { |
| | | return request.get({ url: `/model/pre/predict-item/get/${id}`}) |
| | | return request.get({ url: `/model/pre/item/get/${id}`}) |
| | | } |
| | | |
| | | // 新增MmPredictItem |
| | | export const createMmPredictItem = (data: MmPredictItemVO) => { |
| | | return request.post({ url: '/model/pre/predict-item/create', data }) |
| | | return request.post({ url: '/model/pre/item/create', data }) |
| | | } |
| | | |
| | | // 修改MmPredictItem |
| | | export const updateMmPredictItem = (data: MmPredictItemVO) => { |
| | | return request.put({ url: '/model/pre/predict-item/update', data }) |
| | | return request.put({ url: '/model/pre/item/update', data }) |
| | | } |
| | | |
| | | // 删除MmPredictItem |
| | | export const deleteMmPredictItem = (id: number) => { |
| | | return request.delete({ url: '/model/pre/predict-item/delete?id=' + id }) |
| | | return request.delete({ url: '/model/pre/item/delete?id=' + id }) |
| | | } |
| | | |
| | | // 查询getMmPredictItemList详情 |
| | | export const getMmPredictItemList = () => { |
| | | return request.get({ url: `/model/pre/predict-item/list`}) |
| | | // 查询MmPredictItem列表 |
| | | export const getMmPredictItemList = (params) => { |
| | | return request.get({ url: `/model/pre/item/list`, params}) |
| | | } |
| | | |
| | | export const updateModel = (data: any) => { |
| | | return request.upload({ url: '/model/pre/item/upload-model', data }) |
| | | } |
| | | |
| | | export const useUpload = () => { |
| | | const uploadUrl = import.meta.env.VITE_BASE_URL + '/admin-api/model/pre/item/upload-model' |
| | | |
| | | const httpRequest = async (options: UploadRequestOptions) => { |
| | | return new Promise((resolve, reject) => { |
| | | updateModel({ file: options.file }) |
| | | .then((res) => { |
| | | if (res.code === 0) { |
| | | resolve(res) |
| | | } else { |
| | | reject(res) |
| | | } |
| | | }) |
| | | .catch((res) => { |
| | | reject(res) |
| | | }) |
| | | }) |
| | | |
| | | } |
| | | |
| | | return { |
| | | uploadUrl, |
| | | httpRequest |
| | | } |
| | | } |
| | | |
| | | export const getMmPredictItemTree = () => { |
| | | return request.get({ url: `/model/pre/item/tree`}) |
| | | } |
| | | |
| | | export const getViewCharts = (params) => { |
| | | return request.get({ url: `/model/pre/item/view-charts`,params}) |
| | | } |