Commit b5546655ecf5f6bdabde213add592edc83807c6d

Authored by fengwotao
1 parent 5ec23c02

pref:优化大屏内容接口定义

1 -import {defHttp} from '@/utils/external/http/axios';  
2 -import {  
3 - ContentParams,  
4 - ContentResultModel,  
5 -} from './model/contentModel'; 1 +import { defHttp } from '@/utils/external/http/axios'
  2 +import { BaseSaveContentParams, BaseUpdateContentParams } from './model/contentModel'
6 3
7 -import type {ErrorMessageMode} from '/#/external/axios'; 4 +import type { ErrorMessageMode } from '/#/external/axios'
8 5
9 enum Api { 6 enum Api {
10 - CONTENT = '/data_view/content',  
11 - GET_CONTENT = '/data_view',  
12 - FILE_UPLOAD = '/oss/upload' 7 + //大屏设计器
  8 + DATA_VIEW_CONTENT = '/data_view/content',
  9 + //大屏内容
  10 + DATA_VIEW = '/data_view',
  11 + FILE_UPLOAD = '/oss/upload'
13 } 12 }
14 13
15 /** 14 /**
16 - * @description: content save api 15 + * @description: 大屏设计器 update api
17 */ 16 */
18 -export function contentUpdateApi(params: object, mode: ErrorMessageMode = 'modal') {  
19 - return defHttp.put(  
20 - {  
21 - url: Api.CONTENT,  
22 - params,  
23 - },  
24 - {  
25 - errorMessageMode: mode,  
26 - }  
27 - ); 17 +export function contentUpdateApi(params: BaseUpdateContentParams, mode: ErrorMessageMode = 'modal') {
  18 + return defHttp.put<BaseUpdateContentParams>(
  19 + {
  20 + url: Api.DATA_VIEW_CONTENT,
  21 + params
  22 + },
  23 + {
  24 + errorMessageMode: mode
  25 + }
  26 + )
28 } 27 }
  28 +
  29 +/**
  30 + * @description: 大屏设计器 save api
  31 + */
29 export function contentSaveApi(params: object, mode: ErrorMessageMode = 'modal') { 32 export function contentSaveApi(params: object, mode: ErrorMessageMode = 'modal') {
30 - return defHttp.post(  
31 - {  
32 - url: Api.CONTENT,  
33 - params,  
34 - },  
35 - {  
36 - errorMessageMode: mode,  
37 - }  
38 - ); 33 + return defHttp.post<BaseSaveContentParams>(
  34 + {
  35 + url: Api.DATA_VIEW_CONTENT,
  36 + params
  37 + },
  38 + {
  39 + errorMessageMode: mode
  40 + }
  41 + )
39 } 42 }
  43 +
40 /** 44 /**
41 - * @description:dataView content get api 45 + * @description: 大屏设计器 delete api
42 */ 46 */
  47 +export function contentDeleteApi(data: [string], mode: ErrorMessageMode = 'modal') {
  48 + return defHttp.delete(
  49 + {
  50 + url: Api.DATA_VIEW_CONTENT,
  51 + data
  52 + },
  53 + {
  54 + errorMessageMode: mode
  55 + }
  56 + )
  57 +}
43 58
44 -export const getDataView = (id: string) => {  
45 - return defHttp.get({  
46 - url: `${Api.GET_CONTENT}/get_configuration_info/${id}`,  
47 - });  
48 -}; 59 +/**
  60 + * @description:大屏内容 content get api
  61 + */
49 62
  63 +export const getDataView = (id: string) => {
  64 + return defHttp.get({
  65 + url: `${Api.DATA_VIEW}/get_configuration_info/${id}`
  66 + })
  67 +}
50 68
51 /** 69 /**
52 - * @description: content get api 70 + * @description: 大屏内容 get api
53 */ 71 */
54 72
55 export const getDataViewList = (params: object) => { 73 export const getDataViewList = (params: object) => {
56 - return defHttp.get({  
57 - url: `${Api.GET_CONTENT}`,  
58 - params  
59 - });  
60 -}; 74 + return defHttp.get({
  75 + url: `${Api.DATA_VIEW}`,
  76 + params
  77 + })
  78 +}
61 79
62 /** 80 /**
63 * @description: file Upload 81 * @description: file Upload
64 */ 82 */
65 -  
66 -  
67 -// * 上传文件  
68 export const uploadFile = async (file: FormData, mode: ErrorMessageMode = 'modal') => { 83 export const uploadFile = async (file: FormData, mode: ErrorMessageMode = 'modal') => {
69 - return defHttp.post({url: Api.FILE_UPLOAD, params: file}, {  
70 - errorMessageMode: mode,  
71 - }); 84 + return defHttp.post(
  85 + { url: Api.FILE_UPLOAD, params: file },
  86 + {
  87 + errorMessageMode: mode
  88 + }
  89 + )
72 } 90 }
73 -  
1 /** 1 /**
2 - * @description: Login interface parameters 2 + * @description: 大屏新增内容Model
3 */ 3 */
4 -export interface ContentParams {  
5 - "content": string,  
6 - "createTime"?: string,  
7 - "creator"?: string,  
8 - "defaultConfig"?: string,  
9 - "description"?: string,  
10 - "enabled"?: boolean,  
11 - "icon"?: string,  
12 - "id": string,  
13 - "name"?: string,  
14 - "nodeIds"?: [  
15 - string  
16 - ],  
17 - "remark"?: string,  
18 - "roleIds"?: [  
19 - string  
20 - ],  
21 - "tenantExpireTime"?: string,  
22 - "tenantId"?: string,  
23 - "tenantProfileId"?: string,  
24 - "tenantStatus"?: string,  
25 - "updateTime"?: string,  
26 - "updater"?: string,  
27 - "viewId"?: string  
28 -}  
29 -  
30 -export interface RoleInfo {  
31 - roleName: string;  
32 - value: string; 4 +export interface BaseSaveContentParams {
  5 + content: string
  6 + createTime?: string
  7 + creator?: string
  8 + defaultConfig?: string
  9 + description?: string
  10 + enabled?: boolean
  11 + icon?: string
  12 + id: string
  13 + name?: string
  14 + nodeIds?: [string]
  15 + remark?: string
  16 + roleIds?: [string]
  17 + tenantExpireTime?: string
  18 + tenantId?: string
  19 + tenantProfileId?: string
  20 + tenantStatus?: string
  21 + updateTime?: string
  22 + updater?: string
  23 + viewId?: string
33 } 24 }
34 25
35 /** 26 /**
36 - * @description: Login interface return value 27 + * @description: 大屏更新内容Model
37 */ 28 */
38 -export interface ContentResultModel {  
39 - "content": string,  
40 - "createTime": string,  
41 - "creator": string,  
42 - "defaultConfig": string,  
43 - "description": string,  
44 - "enabled": boolean,  
45 - "icon": string,  
46 - "id": string,  
47 - "name": string,  
48 - "nodeIds": [  
49 - string  
50 - ],  
51 - "remark": string,  
52 - "roleIds": [  
53 - string  
54 - ],  
55 - "tenantExpireTime": string,  
56 - "tenantId": string,  
57 - "tenantProfileId": string,  
58 - "tenantStatus": string,  
59 - "updateTime": string,  
60 - "updater": string,  
61 - "viewId": string 29 +export interface BaseUpdateContentParams {
  30 + dataViewContent: BaseSaveContentParams
  31 + dataViewId?: string
  32 + dataViewName: string
  33 + state?: number
62 } 34 }
63 -