Ben Lin
2024-07-22 323e576c64129723df20fd18effb20d96d8d18b3
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
import { Ref } from 'vue';
import { IAnyObject } from './base-type';
import { IFormConfig, IVFormComponent } from './v-form-component';
 
export interface IToolbarMethods {
  showModal: (jsonData: IAnyObject) => void;
}
 
type ChangeTabKey = 1 | 2;
export interface IPropsPanel {
  changeTab: (key: ChangeTabKey) => void;
}
export interface IState {
  // 语言
  locale: any;
  // 公用组件
  baseComponents: IVFormComponent[];
  // 自定义组件
  customComponents: IVFormComponent[];
  // 布局组件
  layoutComponents: IVFormComponent[];
  // 属性面板实例
  propsPanel: Ref<null | IPropsPanel>;
  // json模态框实例
  jsonModal: Ref<null | IToolbarMethods>;
  // 导入json数据模态框
  importJsonModal: Ref<null | IToolbarMethods>;
  // 代码预览模态框
  codeModal: Ref<null | IToolbarMethods>;
  // 预览模态框
  eFormPreview: Ref<null | IToolbarMethods>;
 
  eFormPreview2: Ref<null | IToolbarMethods>;
}
 
export interface IFormDesignMethods {
  // 设置当前选中的控件
  handleSetSelectItem(item: IVFormComponent): void;
  // 添加控件到formConfig.formItems中
  handleListPush(item: IVFormComponent): void;
  // 复制控件
  handleCopy(item?: IVFormComponent, isCopy?: boolean): void;
  // 添加控件属性
  handleAddAttrs(schemas: IVFormComponent[], index: number): void;
  setFormConfig(config: IFormConfig): void;
  // 添加到表单中之前触发
  handleBeforeColAdd(
    event: { newIndex: string },
    schemas: IVFormComponent[],
    isCopy?: boolean,
  ): void;
}