| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- import { addModel, addModelPlugin, debugModelPlugin, delModel, getModel, getModelById, getModelCount, getModelList, getModelPlugin, updateModelPlugin } from '@/api/iot/model'
- import { message } from 'ant-design-vue'
- export class ModelController {
- static async list (params: {modelLabel?: string, limit?: number, lastId?: string} = {
- modelLabel: '',
- limit: 10000,
- lastId: ''
- }) {
- return await getModelList(params)
- }
- static async page (params: IOT.API.MODEL.QueryPamars) {
- return await getModel(params)
- }
- static async post (data: IOT.API.MODEL.Model) {
- await addModel(data)
- message.success('新增成功')
- }
- static async count () {
- return await getModelCount()
- }
- static put () {
- }
- static async detail (id: string) {
- const { data } = await getModelById(id)
- return data
- }
- static async del (id: string) {
- const { data } = await delModel(id)
- if (data) {
- message.success('删除成功')
- }
- }
- static async getPlugin (params: {modelId: string}) {
- return await getModelPlugin(params)
- }
- static async postPlugin (data: {modelPluginType: string, modelPluginBody: string, modelId: string}) {
- await addModelPlugin(data)
- message.success('保存成功')
- }
- static async updatePlugin (data: {modelPluginType: string, modelPluginBody: string, modelId: string, id: string}) {
- await updateModelPlugin(data)
- message.success('保存成功')
- }
- static async debugPlugin (data: {input: string, pluginBody: string, decode: boolean}) {
- return await debugModelPlugin(data)
- }
- }
|