types.ts 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238
  1. /*
  2. * <<
  3. * Davinci
  4. * ==
  5. * Copyright (C) 2016 - 2017 EDP
  6. * ==
  7. * Licensed under the Apache License, Version 2.0 (the "License");
  8. * you may not use this file except in compliance with the License.
  9. * You may obtain a copy of the License at
  10. *
  11. * http://www.apache.org/licenses/LICENSE-2.0
  12. *
  13. * Unless required by applicable law or agreed to in writing, software
  14. * distributed under the License is distributed on an "AS IS" BASIS,
  15. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  16. * See the License for the specific language governing permissions and
  17. * limitations under the License.
  18. * >>
  19. */
  20. import { IOrganization } from '../Organizations/types'
  21. export interface IProjectPermission {
  22. downloadPermission: boolean
  23. schedulePermission: number
  24. sharePermission: boolean
  25. sourcePermission: number
  26. viewPermission: number
  27. vizPermission: number
  28. widgetPermission: number
  29. }
  30. export interface IProject {
  31. createBy?: { avatar?: string; id?: number; username?: string; email: string }
  32. permission?: IProjectPermission
  33. initialOrgId?: number
  34. userId: number
  35. isStar?: boolean
  36. isTransfer?: boolean
  37. isFavorites?: boolean
  38. type?: string
  39. name?: string
  40. id?: number
  41. description?: string
  42. pic?: string
  43. orgId?: number
  44. visibility?: boolean
  45. starNum?: number
  46. }
  47. export interface IStarUser {
  48. avatar: string
  49. id: number
  50. email?: string
  51. starTime: string
  52. username: string
  53. }
  54. export interface IProjectRole {
  55. id: number
  56. name: string
  57. description: string
  58. }
  59. interface IProjectRolePermission extends IProjectRole {
  60. permission: IProjectPermission
  61. }
  62. export interface IProjectState {
  63. projects: IProject[]
  64. currentProject: IProject
  65. currentProjectLoading: boolean
  66. searchProject: boolean
  67. starUserList: IStarUser[]
  68. collectProjects: IProject[]
  69. currentProjectRole: IProjectRolePermission
  70. projectRoles: IProjectRole[]
  71. }
  72. export interface IProjectFormFieldProps {
  73. id?: number
  74. orgId_hc?: string
  75. orgId?: number
  76. name?: string
  77. description?: string
  78. visibility?: string
  79. pic?: string
  80. }
  81. export interface IProjectsFormProps {
  82. type?: string
  83. organizations?: any
  84. onTransfer?: () => any
  85. onModalOk?: () => any
  86. modalLoading: boolean
  87. currentPro: Partial<IProject>
  88. onCheckUniqueName?: (
  89. pathname: any,
  90. data: any,
  91. resolve: () => any,
  92. reject: (error: string) => any
  93. ) => any
  94. }
  95. export interface IEnhanceButtonProps {
  96. type?: string
  97. }
  98. export interface IProjectsProps {
  99. projects: IProject[]
  100. collectProjects: IProject[]
  101. loginUser: any
  102. searchProject?: {
  103. list: any[]
  104. total: number
  105. pageNum: number
  106. pageSize: number
  107. }
  108. organizations: IOrganization[]
  109. starUserList: IStarUser[]
  110. onTransferProject: (id: number, orgId: number) => any
  111. onEditProject: (project: any, resolve: () => any) => any
  112. onLoadProjects: () => any
  113. onAddProject: (project: any, resolve: () => any) => any
  114. onLoadOrganizations: () => any
  115. onLoadCollectProjects: () => any
  116. onClickCollectProjects: (
  117. isFavorite: boolean,
  118. proId: number,
  119. resolve: (id: number) => any
  120. ) => any
  121. onDeleteProject: (id: number, resolve?: any) => any
  122. onLoadProjectDetail: (id: number) => any
  123. onStarProject: (id: number, resolve: () => any) => any
  124. onGetProjectStarUser: (id: number) => any
  125. onSearchProject: (param: {
  126. keywords: string
  127. pageNum: number
  128. pageSize: number
  129. }) => any
  130. onCheckUniqueName: (
  131. pathname: any,
  132. data: any,
  133. resolve: () => any,
  134. reject: (error: string) => any
  135. ) => any
  136. }
  137. export enum projectType {
  138. all = '全部',
  139. join = '我参与的',
  140. create = '我创建的',
  141. favorite = '我收藏的',
  142. history = '最近浏览的'
  143. }
  144. export enum projectTypeSmall {
  145. all = '全部',
  146. join = '参与',
  147. create = '创建',
  148. favorite = '收藏',
  149. history = '历史'
  150. }
  151. export type IProjectType = 'all' | 'join' | 'create' | 'favorite' | 'history'
  152. export type IDOMEventHandler = (event: React.MouseEvent<HTMLElement>) => any
  153. export interface IToolbarProps {
  154. pType?: string
  155. setKeywords: (keywords: string) => any
  156. searchKeywords?: string
  157. setPType: (type: IProjectType) => any
  158. setFormVisible: IDOMEventHandler
  159. showProForm: IShowProForm
  160. }
  161. export interface ItemToolbarProps {
  162. isStar: boolean
  163. isFavorite: boolean
  164. onStar: IDOMEventHandler
  165. onTransfer: IDOMEventHandler
  166. onEdit: IDOMEventHandler
  167. onDelete: IDOMEventHandler
  168. onFavorite: IDOMEventHandler
  169. organization: IOrganization
  170. isMimePro: boolean
  171. pType: string
  172. StarCom?: any
  173. }
  174. export interface ITagProps {
  175. type: Array<'create' | 'favorite' | 'join'>
  176. }
  177. export enum eTag {
  178. create = '创建',
  179. favorite = '收藏',
  180. join = '参与'
  181. }
  182. export interface ItemProps {
  183. key: string
  184. pro: IProject
  185. userId: number
  186. pType?: string
  187. history: History
  188. organizations: IOrganization[]
  189. showProForm?: IShowProForm
  190. deletePro?: IDeletePro
  191. favoritePro?: IFavoritePro
  192. }
  193. export type IShowProForm = (
  194. formType: string,
  195. project: Partial<IProject>,
  196. e: React.MouseEvent<HTMLElement>
  197. ) => void
  198. export interface IContentProps {
  199. userId: number
  200. pType: string
  201. deletePro: IDeletePro
  202. favoritePro: IFavoritePro
  203. searchKeywords: string
  204. projects: IProject[]
  205. history: History
  206. organizations: IOrganization[]
  207. collectProjects: IProject[]
  208. showProForm: IShowProForm
  209. }
  210. export enum FormType {
  211. 'transfer' = '移交',
  212. 'add' = '创建',
  213. 'edit' = '修改'
  214. }
  215. export type IDeletePro = (proId: number, isFavorite: boolean) => void
  216. export type IFavoritePro = (proId: number, isFavorite: boolean) => void