index.ts 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374
  1. import { VNode, Component } from "vue";
  2. import { ColumnProps } from "@/components/LjVxeTable/interface";
  3. import type { aboutVxetableApiProps } from "@/components/LjVxeTable/interface";
  4. import type { curLayoutTypeItem } from "@/components/LjFoldLayout/index.vue";
  5. import { BreakPoint } from "@/components/Grid/interface";
  6. export interface detailModelItemProp extends requestApiProps {
  7. /**
  8. * @argument string 模块id
  9. */
  10. id: string;
  11. /**
  12. * @argument string 模块类型
  13. */
  14. type?: "table" | "form" | "base";
  15. /**
  16. * @argument string 名称
  17. */
  18. label: string;
  19. /**
  20. * @argument 组件参数,根据 element plus 官方文档来传递,该属性所有值会透传到组件
  21. */
  22. props?: any;
  23. // /**
  24. // * @argument string 模块数据
  25. // */
  26. // value?: any;
  27. render?: (scope: any) => VNode | string; // 自定义内容渲染(tsx语法)
  28. /**
  29. * 是否隐藏标签页
  30. */
  31. isHidden?: boolean;
  32. /**
  33. * @augments boolean 是否限制显示
  34. */
  35. limited?: boolean | ((params?: any) => boolean);
  36. }
  37. /**
  38. * @description 按钮列表
  39. */
  40. export type detailAction = {
  41. label?: string;
  42. /**
  43. * @argument 权限验证
  44. */
  45. power?: number | ((params?: any) => boolean);
  46. /**
  47. * @augments boolean ERP系统选项:是否限制显示
  48. */
  49. limited?: boolean | ((params?: any) => boolean);
  50. /**
  51. * @augments boolean ERP系统选项:是否限制显示
  52. */
  53. loading?: (params?: any) => boolean;
  54. /**
  55. * @argument 点击事件
  56. */
  57. clickFunc?: (params?: any) => void;
  58. slotName?: string;
  59. render?: (scope: any) => VNode | string; // 自定义内容渲染(tsx语法)
  60. /**
  61. * @argument 禁用按钮文字回调
  62. */
  63. disabledTextCallBack?: (data: any) => string;
  64. /**
  65. * @description el-button attr
  66. */
  67. type?: "primary" | "success" | "warning" | "danger" | "info" | "text";
  68. size?: "large" | "default" | "small";
  69. /**
  70. * @argument 图标,支持iconfont |el-icon | render
  71. */
  72. icon?: string | Component | ((params?: any) => VNode);
  73. /**
  74. * @description 按钮描述
  75. */
  76. dscrp?: string;
  77. /**
  78. * @description 分组名称
  79. */
  80. groupLabel?: string;
  81. /**
  82. * @description 分组 可额外多套一层detailAction[],注意:detailAction[]不能与detailAction同一层
  83. */
  84. groupAction?: detailAction[];
  85. /**
  86. * @argument 其他属性
  87. */
  88. [key: string]: any;
  89. };
  90. /**
  91. * @description 头部,摘要
  92. */
  93. export type detailBase = {
  94. // data: any;
  95. fieldNames?: FieldNamesProps; // enum 指定 label && value && children 的 key 值
  96. /**
  97. * @argument 图标,支持iconfont |el-icon | render
  98. */
  99. icon?: string | Component | ((params?: any) => VNode);
  100. /**
  101. * @argument 标签属性, 技术文档:vant van-tabs
  102. */
  103. tabsProp?: any;
  104. // /**
  105. // * @argument 基础信息,信息卡模块
  106. // */
  107. // baseCard?: BaseCardType;
  108. /**
  109. * @description LjFoldLayout布局方向:水平,垂直
  110. */
  111. direction?: "horizontal" | "vertical";
  112. /**
  113. * @description LjFoldLayout左插槽
  114. */
  115. foldleft?: curLayoutTypeItem | any;
  116. /**
  117. * @description LjFoldLayout右插槽
  118. */
  119. foldright?: curLayoutTypeItem | any;
  120. /**
  121. * @description 业务需要,未定义且需要保存的布局参数
  122. */
  123. mxprops?: any;
  124. /**
  125. * @description 悬浮按钮配置
  126. */
  127. floatbtn?: FloatBtnType[];
  128. };
  129. export type FieldNamesProps = {
  130. code: string;
  131. /**
  132. * @description 副标题标题文本
  133. */
  134. codeLabel?: string;
  135. name: string;
  136. };
  137. // export type BaseCardType = {
  138. // /**
  139. // * @description 组件类型
  140. // */
  141. // type?: "timeline" | string;
  142. // /**
  143. // * @description 数据模型
  144. // */
  145. // modes?: BaseCardModesType[];
  146. // /**
  147. // * @description 是否吟唱
  148. // * @default false
  149. // */
  150. // hidden?: boolean;
  151. // };
  152. // export type BaseCardModesType = {
  153. // /**
  154. // * @description 组件参数数据
  155. // */
  156. // props?: any;
  157. // field: string;
  158. // secondFeild: string;
  159. // };
  160. export type BasicGroupType = {
  161. /**
  162. * @description 分组名称
  163. */
  164. label: string;
  165. /**
  166. * @description 占用列数
  167. * @default number 一行
  168. */
  169. span?: number;
  170. };
  171. export type FloatBtnType = {
  172. /**
  173. * @description 按钮名称
  174. */
  175. id: string;
  176. /**
  177. * @description 初始位置[left, top],百分数
  178. */
  179. originLeft?: number;
  180. originTop?: number;
  181. };
  182. export type BasicDefaultType = {
  183. /**
  184. * @argument string 表单域标签的位置
  185. */
  186. labelPosition?: "left" | "right" | "top";
  187. /**
  188. * @argument string 标签宽度
  189. */
  190. labelWidth?: string | number;
  191. /**
  192. * @description 属性分组设置
  193. */
  194. basicGroup?: BasicGroupType[];
  195. };
  196. /**
  197. * @description 数据请求接口
  198. */
  199. export type requestApiProps = {
  200. /**
  201. * @argument any 初始化请求参数 ==> 非必传(默认为{})
  202. */
  203. initParam?: any;
  204. /**
  205. * @argument string 详情页请求数据的api ==> 非必传
  206. */
  207. requestApi?: (params: any) => Promise<any>;
  208. /**
  209. * @argument boolean 是否自动执行请求 api ==> 非必传(默认为true)
  210. */
  211. requestAuto?: boolean;
  212. /**
  213. * @argument function 表格 api 请求错误监听 ==> 非必传
  214. */
  215. requestError?: (params: any) => void;
  216. /**
  217. * @argument function 返回数据的回调函数,可以对数据进行处理 ==> 非必传
  218. */
  219. dataCallback?: (data: any) => any;
  220. };
  221. /**
  222. * @name 详情页prop
  223. */
  224. export interface DetailProp extends aboutVxetableApiProps {
  225. name?: string; // 详情页router的name, 组件名称
  226. // /**
  227. // * @description 详情页布局名称,取值建议,主表布局名称,自动补充“__layout-detail”
  228. // */
  229. // dwname: string;
  230. /**
  231. * @argument 模块列表
  232. */
  233. mould?: detailModelItemProp[];
  234. /**
  235. * @argument 业务动作列表
  236. * @example 支持二维数组嵌套,会以下拉菜单形式渲染,结构允许:[{},{},...] [[{},{},..], {}]
  237. */
  238. action?: detailAction[][] | detailAction[];
  239. /**
  240. * @argument 单据功能(右侧)
  241. * @example 支持二维数组嵌套,会以下拉菜单形式渲染,结构允许:[{},{},...] [[{},{},..], {}]
  242. */
  243. rightAction?: detailAction[][] | detailAction[];
  244. /**
  245. * @argument Array 单据固定功能(右侧)
  246. * @enum print,printMx
  247. */
  248. rightFixedAction?: string[];
  249. /**
  250. * @argument Array 单据固定功能(右侧)
  251. * @enum print,printMx
  252. * @attention 按钮权限,需要与按钮位置对应,若无/0,则默认显示
  253. */
  254. rightFixedActionPower?: number[];
  255. /**
  256. * @argument 标题
  257. */
  258. header: detailBase;
  259. /**
  260. * @description 基础信息模块,默认设置
  261. */
  262. basicDefault?: BasicDefaultType;
  263. // /**
  264. // * @argument any 主表数据,与主表接口二选一必填 初始化请求参数 ==> 非必传
  265. // */
  266. // mainData?: any;
  267. // /**
  268. // * @argument 获取主表表格布局中,basicinfo属性集合
  269. // */
  270. // columns?: ColumnProps[];
  271. // /**
  272. // * @argument 主表布局名称
  273. // */
  274. // mainDwname?: string;
  275. /**
  276. * @argument 订单新增权限值, 直接访问地址时,防止用户跨越权限操作; 订单状态判断:修改,true:可执行
  277. */
  278. addPower?: number | ((params: any) => boolean);
  279. /**
  280. * @argument 订单修改权限值, 直接访问地址时,防止用户跨越权限操作; 订单状态判断:修改,true:可执行
  281. */
  282. editPower?: number | ((params: any) => boolean);
  283. // /**
  284. // * @argument any 主表接口 ==> 非必传
  285. // */
  286. // mainApi?: requestApiProps;
  287. // /**
  288. // * @argument any 详情数据,与详情接口二选一必填 初始化请求参数 ==> 非必传
  289. // */
  290. // detailData?: any;
  291. // /**
  292. // * @argument any 初始化请求参数 ==> 非必传
  293. // */
  294. // detailApi?: requestApiProps;
  295. /**
  296. * @argument string[] 布局读取/保存时,赋值的属性
  297. */
  298. detailLayoutAttr?: string[];
  299. /**
  300. * @argument 订单状态:新建/修改/详情页
  301. */
  302. orderStatus?: string;
  303. // /**
  304. // * @argument string[] 布局读取/保存时,赋值的属性 == 与表格LjVxeTable.laoyoutAttr一样
  305. // */
  306. // layoutAttr?: string[];
  307. // /**
  308. // * @argument Object 布局默认设置,保存时移除,的属性 == 与表格LjVxeTable.layoutAttrDefine一样
  309. // */
  310. // layoutAttrDefine?: any;
  311. /**
  312. * @augments boolean 是否自动加载布局, 默认true;决定是否读取通用接口返回的布局(false读取)
  313. */
  314. autoLoadLayout?: boolean;
  315. /**
  316. * @description 是否fold布局
  317. */
  318. ifFoldLayout?: boolean;
  319. /**
  320. * @argument function
  321. * @description 布局加载后,执行函数
  322. */
  323. afterMound?: (data: any) => void;
  324. /**
  325. * @description 是否可编辑布局
  326. */
  327. ifLayoutEditable?: boolean;
  328. /**
  329. * @description 是否可编辑基础信息布局
  330. */
  331. ifBasicEditable?: boolean;
  332. /**
  333. * @description 属性gird响应占位
  334. */
  335. searchCol?: number | Record<BreakPoint, number> | any;
  336. /**
  337. * @description BaseForm, 分组gird响应占位
  338. */
  339. basicGroupCol?: number | Record<BreakPoint, number> | any;
  340. /**
  341. * @description 直接打开详情页时,传递枚举类型(字典)
  342. */
  343. enum?: Map<string, any>;
  344. /**
  345. * @description infoParams默认值
  346. */
  347. defaultColumnsValue?: any;
  348. }
  349. // /**
  350. // * @description 基础信息,信息卡模块
  351. // */
  352. // export namespace BaceCard {
  353. // /**
  354. // * @description 信息卡:时间线
  355. // */
  356. // export interface BaseCardProps extends BaseCardType {
  357. // /**
  358. // * @description 数据
  359. // */
  360. // data: any;
  361. // }
  362. // }