干燥机配套车间生产管理系统/云平台服务端
baoshiwei
2024-05-27 fa3ac93010bea3805438ee3ab0a182bfbf7423da
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
import type { Component, Ref, ComputedRef, ExtractPropTypes } from 'vue';
import type { VxeColumnProps } from 'vxe-table/types/column';
import type { JVxeComponent } from './JVxeComponent';
import type { VxeGridInstance, VxeTablePropTypes } from 'vxe-table';
import { JVxeTypes } from './JVxeTypes';
import { vxeProps } from '../vxe.data';
import { useMethods } from '../hooks/useMethods';
import { getJVxeAuths } from '../utils/authUtils';
 
export type JVxeTableProps = Partial<ExtractPropTypes<ReturnType<typeof vxeProps>>>;
export type JVxeTableMethods = ReturnType<typeof useMethods>['methods'];
 
export type JVxeVueComponent = {
  enhanced?: JVxeComponent.EnhancedPartial;
} & Component;
 
type statisticsTypes = 'sum' | 'average';
 
export type JVxeColumn = IJVxeColumn & Recordable;
 
/**
 * JVxe 列配置项
 */
export interface IJVxeColumn extends VxeColumnProps {
  type?: any;
  // 行唯一标识
  key: string;
  // 表单预期值的提示信息,可以使用${...}变量替换文本
  placeholder?: string;
  // 默认值
  defaultValue?: any;
  // 是否禁用当前列,默认false
  disabled?: boolean;
  // 校验规则 TODO 类型待定义
  validateRules?: any;
  // 联动下一级的字段key
  linkageKey?: string;
  // 自定义传入组件的其他属性
  props?: Recordable;
  allowClear?: boolean; // 允许清除
  // 【inputNumber】是否是统计列,只有 inputNumber 才能设置统计列。统计列:sum 求和;average 平均值
  statistics?: boolean | [statisticsTypes, statisticsTypes?];
  // 【select】
  dictCode?: string; // 字典 code
  options?: { title?: string; label?: string; text?: string; value: any; disabled?: boolean }[]; // 下拉选项列表
  allowInput?: boolean; // 允许输入
  allowSearch?: boolean; // 允许搜索
  // 【slot】
  slotName?: string; // 插槽名
  // 【checkbox】
  customValue?: [any, any]; // 自定义值
  defaultChecked?: boolean; // 默认选中
  // 【upload】 upload
  btnText?: string; // 上传按钮文字
  token?: boolean; // 是否传递 token
  responseName?: string; // 返回取值名称
  action?: string; // 上传地址
  allowRemove?: boolean; // 是否允许删除
  allowDownload?: boolean; // 是否允许下载
  // 【下拉字典搜索】
  dict?: string; // 字典表配置信息:数据库表名,显示字段名,存储字段名
  async?: boolean; // 是否同步模式
  tipsContent?: string;
  // 【popup】
  popupCode?: string;
  field?: string;
  orgFields?: string;
  destFields?: string;
}
 
export interface JVxeRefs {
  gridRef: Ref<VxeGridInstance | undefined>;
  subPopoverRef: Ref<any>;
  detailsModalRef: Ref<any>;
}
 
export interface JVxeDataProps {
  prefixCls: string;
  // vxe 实例ID
  caseId: string;
  // vxe 最终 columns
  vxeColumns?: ComputedRef;
  // vxe 最终 dataSource
  vxeDataSource: Ref<Recordable[]>;
  // 记录滚动条位置
  scroll: { top: number; left: number };
  // 当前是否正在滚动
  scrolling: Ref<boolean>;
  // vxe 默认配置
  defaultVxeProps: object;
  // 绑定左侧选择框
  selectedRows: Ref<any[]>;
  // 绑定左侧选择框已选择的id
  selectedRowIds: Ref<string[]>;
  disabledRowIds: string[];
  // 统计列配置
  statistics: {
    has: boolean;
    sum: string[];
    average: string[];
  };
  // 所有和当前表格相关的授权信息
  authsMap: Ref<Nullable<ReturnType<typeof getJVxeAuths>>>;
  // 内置 EditRules
  innerEditRules: Recordable<VxeTablePropTypes.EditRules[]>;
  // 联动下拉选项(用于隔离不同的下拉选项)
  // 内部联动配置,map
  innerLinkageConfig: Map<string, any>;
  // 开启了数据刷新效果的行
  reloadEffectRowKeysMap: Recordable;
}
 
export interface JVxeLinkageConfig {
  // 联动第一级的 key
  key: string;
  // 获取数据的方法
  requestData: (parent: string) => Promise<any>;
}
 
export { JVxeTypes };