types.ts 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243
  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. dataOverviiewPermission: number
  30. dataDictionaryPermission: number
  31. makeRulePermission: number
  32. qualityAuditPermission: number
  33. auditAnalysisPermission: number
  34. }
  35. export interface IProject {
  36. createBy?: { avatar?: string; id?: number; username?: string; email: string }
  37. permission?: IProjectPermission
  38. initialOrgId?: number
  39. userId: number
  40. isStar?: boolean
  41. isTransfer?: boolean
  42. isFavorites?: boolean
  43. type?: string
  44. name?: string
  45. id?: number
  46. description?: string
  47. pic?: string
  48. orgId?: number
  49. visibility?: boolean
  50. starNum?: number
  51. }
  52. export interface IStarUser {
  53. avatar: string
  54. id: number
  55. email?: string
  56. starTime: string
  57. username: string
  58. }
  59. export interface IProjectRole {
  60. id: number
  61. name: string
  62. description: string
  63. }
  64. interface IProjectRolePermission extends IProjectRole {
  65. permission: IProjectPermission
  66. }
  67. export interface IProjectState {
  68. projects: IProject[]
  69. currentProject: IProject
  70. currentProjectLoading: boolean
  71. searchProject: boolean
  72. starUserList: IStarUser[]
  73. collectProjects: IProject[]
  74. currentProjectRole: IProjectRolePermission
  75. projectRoles: IProjectRole[]
  76. }
  77. export interface IProjectFormFieldProps {
  78. id?: number
  79. orgId_hc?: string
  80. orgId?: number
  81. name?: string
  82. description?: string
  83. visibility?: string
  84. pic?: string
  85. }
  86. export interface IProjectsFormProps {
  87. type?: string
  88. organizations?: any
  89. onTransfer?: () => any
  90. onModalOk?: () => any
  91. modalLoading: boolean
  92. currentPro: Partial<IProject>
  93. onCheckUniqueName?: (
  94. pathname: any,
  95. data: any,
  96. resolve: () => any,
  97. reject: (error: string) => any
  98. ) => any
  99. }
  100. export interface IEnhanceButtonProps {
  101. type?: string
  102. }
  103. export interface IProjectsProps {
  104. projects: IProject[]
  105. collectProjects: IProject[]
  106. loginUser: any
  107. searchProject?: {
  108. list: any[]
  109. total: number
  110. pageNum: number
  111. pageSize: number
  112. }
  113. organizations: IOrganization[]
  114. starUserList: IStarUser[]
  115. onTransferProject: (id: number, orgId: number) => any
  116. onEditProject: (project: any, resolve: () => any) => any
  117. onLoadProjects: () => any
  118. onAddProject: (project: any, resolve: () => any) => any
  119. onLoadOrganizations: () => any
  120. onLoadCollectProjects: () => any
  121. onClickCollectProjects: (
  122. isFavorite: boolean,
  123. proId: number,
  124. resolve: (id: number) => any
  125. ) => any
  126. onDeleteProject: (id: number, resolve?: any) => any
  127. onLoadProjectDetail: (id: number) => any
  128. onStarProject: (id: number, resolve: () => any) => any
  129. onGetProjectStarUser: (id: number) => any
  130. onSearchProject: (param: {
  131. keywords: string
  132. pageNum: number
  133. pageSize: number
  134. }) => any
  135. onCheckUniqueName: (
  136. pathname: any,
  137. data: any,
  138. resolve: () => any,
  139. reject: (error: string) => any
  140. ) => any
  141. }
  142. export enum projectType {
  143. all = '全部',
  144. join = '我参与的',
  145. create = '我创建的',
  146. favorite = '我收藏的',
  147. history = '最近浏览的'
  148. }
  149. export enum projectTypeSmall {
  150. all = '全部',
  151. join = '参与',
  152. create = '创建',
  153. favorite = '收藏',
  154. history = '历史'
  155. }
  156. export type IProjectType = 'all' | 'join' | 'create' | 'favorite' | 'history'
  157. export type IDOMEventHandler = (event: React.MouseEvent<HTMLElement>) => any
  158. export interface IToolbarProps {
  159. pType?: string
  160. setKeywords: (keywords: string) => any
  161. searchKeywords?: string
  162. setPType: (type: IProjectType) => any
  163. setFormVisible: IDOMEventHandler
  164. showProForm: IShowProForm
  165. }
  166. export interface ItemToolbarProps {
  167. isStar: boolean
  168. isFavorite: boolean
  169. onStar: IDOMEventHandler
  170. onTransfer: IDOMEventHandler
  171. onEdit: IDOMEventHandler
  172. onDelete: IDOMEventHandler
  173. onFavorite: IDOMEventHandler
  174. organization: IOrganization
  175. isMimePro: boolean
  176. pType: string
  177. StarCom?: any
  178. }
  179. export interface ITagProps {
  180. type: Array<'create' | 'favorite' | 'join'>
  181. }
  182. export enum eTag {
  183. create = '创建',
  184. favorite = '收藏',
  185. join = '参与'
  186. }
  187. export interface ItemProps {
  188. key: string
  189. pro: IProject
  190. userId: number
  191. pType?: string
  192. history: History
  193. organizations: IOrganization[]
  194. showProForm?: IShowProForm
  195. deletePro?: IDeletePro
  196. favoritePro?: IFavoritePro
  197. }
  198. export type IShowProForm = (
  199. formType: string,
  200. project: Partial<IProject>,
  201. e: React.MouseEvent<HTMLElement>
  202. ) => void
  203. export interface IContentProps {
  204. userId: number
  205. pType: string
  206. deletePro: IDeletePro
  207. favoritePro: IFavoritePro
  208. searchKeywords: string
  209. projects: IProject[]
  210. history: History
  211. organizations: IOrganization[]
  212. collectProjects: IProject[]
  213. showProForm: IShowProForm
  214. }
  215. export enum FormType {
  216. 'transfer' = '移交',
  217. 'add' = '创建',
  218. 'edit' = '修改'
  219. }
  220. export type IDeletePro = (proId: number, isFavorite: boolean) => void
  221. export type IFavoritePro = (proId: number, isFavorite: boolean) => void