szld-libs 0.3.24 → 0.3.26

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,5 @@
1
- import { IformConfigItem, Ijson } from './index.d';
1
+ import { IformConfigItem } from './index.d';
2
2
  import { RangePickerProps } from 'antd/es/date-picker';
3
- import { AxiosResponse } from 'axios';
4
3
  export declare const handleGetPlaceholder: (itemWithJson: IformConfigItem, langId?: string) => string;
5
4
  /**
6
5
  * 处理表单项目初始值
@@ -18,15 +17,6 @@ export declare const handleUrlOptions: (val: any, delimiter: string, list: any[]
18
17
  * @param param0
19
18
  * @returns
20
19
  */
21
- export declare const handleSelectOptions: ({ commonRequestWidthParams, commonRequest, interfaceTypeDict, interfaceTypeSysDict, actionUrlKey, actionUrlExtraParams, item, }: {
22
- commonRequestWidthParams: (params: object, data?: any) => Promise<AxiosResponse<any, any>>;
23
- commonRequest: (InterfaceType: string, data?: any) => Promise<AxiosResponse<any, any>>;
24
- interfaceTypeDict?: string | undefined;
25
- interfaceTypeSysDict?: string | undefined;
26
- actionUrlKey?: string | undefined;
27
- actionUrlExtraParams?: object | undefined;
28
- item: Ijson;
29
- }) => Promise<any[]>;
30
20
  /**
31
21
  * attrList 格式的单层数组 处理成对象{attrid:attrname}
32
22
  */
@@ -1,5 +1,4 @@
1
1
  import dayjs from "dayjs";
2
- import { message } from "antd";
3
2
  const handleGetPlaceholder = (itemWithJson, langId) => {
4
3
  const { input = "" } = (itemWithJson == null ? void 0 : itemWithJson.json) || {};
5
4
  let placeholderCn = "请输入", placeholderEn = "Please input";
@@ -93,94 +92,6 @@ const handleUrlOptions = (val, delimiter, list) => {
93
92
  });
94
93
  return arr.join(delimiter || "-");
95
94
  };
96
- const handleSelectOptions = async ({
97
- commonRequestWidthParams,
98
- commonRequest,
99
- interfaceTypeDict = "YLZDDictList",
100
- interfaceTypeSysDict = "YLZDSysConfigList",
101
- actionUrlKey = "action-url",
102
- actionUrlExtraParams = {},
103
- item
104
- }) => {
105
- var _a;
106
- let options = [];
107
- const getDict = async (interfaceType) => {
108
- var _a2;
109
- let list = [];
110
- if (item.classify) {
111
- try {
112
- const response = await commonRequest(interfaceType, {
113
- asctypeid: item.classify
114
- });
115
- if (((_a2 = response == null ? void 0 : response.data) == null ? void 0 : _a2.list) && Array.isArray(response.data.list)) {
116
- list = response.data.list.map((dictItem) => ({
117
- label: `${dictItem.dicid || ""}-${dictItem.info || ""}`,
118
- value: `${dictItem.dicid || ""}-${dictItem.info || ""}`
119
- }));
120
- }
121
- } catch (error) {
122
- message.error("加载选项失败");
123
- }
124
- }
125
- return list;
126
- };
127
- const getUrlOptions = async () => {
128
- var _a2, _b;
129
- try {
130
- const keyFieldList = ((_a2 = item == null ? void 0 : item["key-field"]) == null ? void 0 : _a2.list) || [];
131
- const delimiter = ((_b = item == null ? void 0 : item["key-field"]) == null ? void 0 : _b.delimiter) || "";
132
- if (!keyFieldList.length) {
133
- message.error("请配置key-field");
134
- return;
135
- }
136
- const response = await commonRequestWidthParams(
137
- {
138
- PageName: "dns_relay",
139
- Controlname: "CallActionUrl",
140
- InterfaceType: ""
141
- },
142
- {
143
- [actionUrlKey]: item == null ? void 0 : item["action-url"],
144
- ...actionUrlExtraParams
145
- }
146
- );
147
- if (response == null ? void 0 : response.data) {
148
- const data = response == null ? void 0 : response.data;
149
- const list = (data == null ? void 0 : data.list) || [];
150
- let urlData = [];
151
- if (Array.isArray(data)) {
152
- urlData = data;
153
- }
154
- if (Array.isArray(list)) {
155
- urlData = list;
156
- }
157
- options = urlData.map((val) => ({
158
- label: handleUrlOptions(val, delimiter, keyFieldList),
159
- value: handleUrlOptions(val, delimiter, keyFieldList)
160
- }));
161
- }
162
- } catch (error) {
163
- message.error("加载选项失败");
164
- }
165
- };
166
- if (item.inputType === "local") {
167
- options = ((_a = item.data) == null ? void 0 : _a.map((val) => ({
168
- label: val,
169
- value: val
170
- }))) || [];
171
- if (item.options && Array.isArray(item.options)) {
172
- options = item.options;
173
- }
174
- } else if (item.inputType === "dictionary") {
175
- options = await getDict(interfaceTypeDict);
176
- } else if (item.inputType === "system-dictionary") {
177
- options = await getDict(interfaceTypeSysDict);
178
- }
179
- if (item.inputType === "url" && (item == null ? void 0 : item["action-url"])) {
180
- await getUrlOptions();
181
- }
182
- return options;
183
- };
184
95
  const handleGetSingleAttrListObj = (children) => {
185
96
  if (!(children == null ? void 0 : children.length)) {
186
97
  return [];
@@ -205,7 +116,6 @@ export {
205
116
  disabledDate,
206
117
  handleGetPlaceholder,
207
118
  handleGetSingleAttrListObj,
208
- handleSelectOptions,
209
119
  handleSetFormItemInitialValue,
210
120
  handleUrlOptions
211
121
  };
@@ -18,6 +18,7 @@ export interface IformConfigItem {
18
18
  }
19
19
 
20
20
  export interface Ijson {
21
+ 'field-names'?: string; // 级联选择的自定义字段名
21
22
  'input-width'?: string; // 输入框宽度
22
23
  'action-url-extra-params'?: { [key: string]: any }; // 弹窗选择对应多个表单字段时,额外的参数
23
24
  'disable-date-goover'?: boolean; // 禁用日期选择器超出当前日期
@@ -1,5 +1,6 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
- import { handleSelectOptions, handleGetPlaceholder } from "../func";
2
+ import { handleSelectOptions } from "../../../utils/method";
3
+ import { handleGetPlaceholder } from "../func";
3
4
  import { useState, useEffect } from "react";
4
5
  import { Select } from "antd";
5
6
  const MySelect = ({
@@ -1,6 +1,5 @@
1
- import { IformConfigItem, Ijson } from './index.d';
1
+ import { IformConfigItem } from './index.d';
2
2
  import { RangePickerProps } from 'antd/es/date-picker';
3
- import { AxiosResponse } from 'axios';
4
3
  export declare const handleGetPlaceholder: (itemWithJson: IformConfigItem, langId?: string) => string;
5
4
  /**
6
5
  * 处理表单项目初始值
@@ -18,15 +17,6 @@ export declare const handleUrlOptions: (val: any, delimiter: string, list: any[]
18
17
  * @param param0
19
18
  * @returns
20
19
  */
21
- export declare const handleSelectOptions: ({ commonRequestWidthParams, commonRequest, interfaceTypeDict, interfaceTypeSysDict, actionUrlKey, actionUrlExtraParams, item, }: {
22
- commonRequestWidthParams: (params: object, data?: any) => Promise<AxiosResponse<any, any>>;
23
- commonRequest: (InterfaceType: string, data?: any) => Promise<AxiosResponse<any, any>>;
24
- interfaceTypeDict?: string | undefined;
25
- interfaceTypeSysDict?: string | undefined;
26
- actionUrlKey?: string | undefined;
27
- actionUrlExtraParams?: object | undefined;
28
- item: Ijson;
29
- }) => Promise<any[]>;
30
20
  /**
31
21
  * attrList 格式的单层数组 处理成对象{attrid:attrname}
32
22
  */
@@ -1,5 +1,4 @@
1
1
  import dayjs from "dayjs";
2
- import { message } from "antd";
3
2
  const handleGetPlaceholder = (itemWithJson, langId) => {
4
3
  const { input = "" } = (itemWithJson == null ? void 0 : itemWithJson.json) || {};
5
4
  let placeholderCn = "请输入", placeholderEn = "Please input";
@@ -93,94 +92,6 @@ const handleUrlOptions = (val, delimiter, list) => {
93
92
  });
94
93
  return arr.join(delimiter || "-");
95
94
  };
96
- const handleSelectOptions = async ({
97
- commonRequestWidthParams,
98
- commonRequest,
99
- interfaceTypeDict = "YLZDDictList",
100
- interfaceTypeSysDict = "YLZDSysConfigList",
101
- actionUrlKey = "action-url",
102
- actionUrlExtraParams = {},
103
- item
104
- }) => {
105
- var _a;
106
- let options = [];
107
- const getDict = async (interfaceType) => {
108
- var _a2;
109
- let list = [];
110
- if (item.classify) {
111
- try {
112
- const response = await commonRequest(interfaceType, {
113
- asctypeid: item.classify
114
- });
115
- if (((_a2 = response == null ? void 0 : response.data) == null ? void 0 : _a2.list) && Array.isArray(response.data.list)) {
116
- list = response.data.list.map((dictItem) => ({
117
- label: `${dictItem.dicid || ""}-${dictItem.info || ""}`,
118
- value: `${dictItem.dicid || ""}-${dictItem.info || ""}`
119
- }));
120
- }
121
- } catch (error) {
122
- message.error("加载选项失败");
123
- }
124
- }
125
- return list;
126
- };
127
- const getUrlOptions = async () => {
128
- var _a2, _b;
129
- try {
130
- const keyFieldList = ((_a2 = item == null ? void 0 : item["key-field"]) == null ? void 0 : _a2.list) || [];
131
- const delimiter = ((_b = item == null ? void 0 : item["key-field"]) == null ? void 0 : _b.delimiter) || "";
132
- if (!keyFieldList.length) {
133
- message.error("请配置key-field");
134
- return;
135
- }
136
- const response = await commonRequestWidthParams(
137
- {
138
- PageName: "dns_relay",
139
- Controlname: "CallActionUrl",
140
- InterfaceType: ""
141
- },
142
- {
143
- [actionUrlKey]: item == null ? void 0 : item["action-url"],
144
- ...actionUrlExtraParams
145
- }
146
- );
147
- if (response == null ? void 0 : response.data) {
148
- const data = response == null ? void 0 : response.data;
149
- const list = (data == null ? void 0 : data.list) || [];
150
- let urlData = [];
151
- if (Array.isArray(data)) {
152
- urlData = data;
153
- }
154
- if (Array.isArray(list)) {
155
- urlData = list;
156
- }
157
- options = urlData.map((val) => ({
158
- label: handleUrlOptions(val, delimiter, keyFieldList),
159
- value: handleUrlOptions(val, delimiter, keyFieldList)
160
- }));
161
- }
162
- } catch (error) {
163
- message.error("加载选项失败");
164
- }
165
- };
166
- if (item.inputType === "local") {
167
- options = ((_a = item.data) == null ? void 0 : _a.map((val) => ({
168
- label: val,
169
- value: val
170
- }))) || [];
171
- if (item.options && Array.isArray(item.options)) {
172
- options = item.options;
173
- }
174
- } else if (item.inputType === "dictionary") {
175
- options = await getDict(interfaceTypeDict);
176
- } else if (item.inputType === "system-dictionary") {
177
- options = await getDict(interfaceTypeSysDict);
178
- }
179
- if (item.inputType === "url" && (item == null ? void 0 : item["action-url"])) {
180
- await getUrlOptions();
181
- }
182
- return options;
183
- };
184
95
  const handleGetSingleAttrListObj = (children) => {
185
96
  if (!(children == null ? void 0 : children.length)) {
186
97
  return [];
@@ -205,7 +116,6 @@ export {
205
116
  disabledDate,
206
117
  handleGetPlaceholder,
207
118
  handleGetSingleAttrListObj,
208
- handleSelectOptions,
209
119
  handleSetFormItemInitialValue,
210
120
  handleUrlOptions
211
121
  };
@@ -18,6 +18,7 @@ export interface IformConfigItem {
18
18
  }
19
19
 
20
20
  export interface Ijson {
21
+ 'field-names'?: string; // 级联选择的自定义字段名
21
22
  'search-field'?: any; // 是否搜索字段
22
23
  'action-url-extra-params'?: { [key: string]: any }; // 弹窗选择对应多个表单字段时,额外的参数
23
24
  'disable-date-goover'?: boolean; // 禁用日期选择器超出当前日期
@@ -1,6 +1,6 @@
1
1
  import { jsx, Fragment, jsxs } from "react/jsx-runtime";
2
2
  import { Field, Popup, Checkbox, Picker } from "react-vant";
3
- import { handleSelectOptions } from "../func";
3
+ import { handleSelectOptions } from "../../../utils/method";
4
4
  import { useState, useEffect } from "react";
5
5
  import { Flex } from "antd";
6
6
  const checkboxGroup = "index-module_checkbox-group_4684b";
@@ -1,7 +1,7 @@
1
1
  import { jsx, jsxs, Fragment as Fragment$1 } from "react/jsx-runtime";
2
- import { getJson, base64ToString } from "szld-libs/lib/utils/method";
3
2
  import { App, Row, Col, Flex, Table, Space, Image } from "antd";
4
3
  import { handleSetTableRowColor } from "../utils/szxkFunc";
4
+ import { getJson, base64ToString } from "../utils/method";
5
5
  import { useMemoizedFn } from "ahooks";
6
6
  import { Fragment } from "react";
7
7
  function useDetailRender({
@@ -23,7 +23,7 @@ declare function useUniversalTable(): {
23
23
  searchText?: string | undefined;
24
24
  resetText?: string | undefined;
25
25
  }) => Promise<{
26
- formItems: import("szld-libs/lib/components/CreateForm").CreateFormItemProps<import("szld-libs/lib/components/CreateForm").ValueType>[];
26
+ formItems: CreateFormProps;
27
27
  selList: any[];
28
28
  }>;
29
29
  handleUniversalDelete: ({ commonRequest, refresh, interfaceType, record, configData, }: {
@@ -477,6 +477,7 @@ const handleSelectOptions = async ({
477
477
  try {
478
478
  const keyFieldList = ((_a2 = item == null ? void 0 : item["key-field"]) == null ? void 0 : _a2.list) || [];
479
479
  const delimiter = ((_b = item == null ? void 0 : item["key-field"]) == null ? void 0 : _b.delimiter) || "";
480
+ const fileNames = item == null ? void 0 : item["field-names"];
480
481
  if (!keyFieldList.length) {
481
482
  message.error("请配置key-field");
482
483
  return;
@@ -502,10 +503,14 @@ const handleSelectOptions = async ({
502
503
  if (Array.isArray(list)) {
503
504
  urlData = list;
504
505
  }
505
- options = urlData.map((val) => ({
506
- label: handleUrlOptions(val, delimiter, keyFieldList),
507
- value: handleUrlOptions(val, delimiter, keyFieldList)
508
- }));
506
+ if (fileNames) {
507
+ options = urlData;
508
+ } else {
509
+ options = urlData.map((val) => ({
510
+ label: handleUrlOptions(val, delimiter, keyFieldList),
511
+ value: handleUrlOptions(val, delimiter, keyFieldList)
512
+ }));
513
+ }
509
514
  }
510
515
  } catch (error) {
511
516
  message.error("加载选项失败");
@@ -1,6 +1,5 @@
1
- import { IformConfigItem, Ijson } from './index.d';
1
+ import { IformConfigItem } from './index.d';
2
2
  import { RangePickerProps } from 'antd/es/date-picker';
3
- import { AxiosResponse } from 'axios';
4
3
  export declare const handleGetPlaceholder: (itemWithJson: IformConfigItem, langId?: string) => string;
5
4
  /**
6
5
  * 处理表单项目初始值
@@ -18,15 +17,6 @@ export declare const handleUrlOptions: (val: any, delimiter: string, list: any[]
18
17
  * @param param0
19
18
  * @returns
20
19
  */
21
- export declare const handleSelectOptions: ({ commonRequestWidthParams, commonRequest, interfaceTypeDict, interfaceTypeSysDict, actionUrlKey, actionUrlExtraParams, item, }: {
22
- commonRequestWidthParams: (params: object, data?: any) => Promise<AxiosResponse<any, any>>;
23
- commonRequest: (InterfaceType: string, data?: any) => Promise<AxiosResponse<any, any>>;
24
- interfaceTypeDict?: string | undefined;
25
- interfaceTypeSysDict?: string | undefined;
26
- actionUrlKey?: string | undefined;
27
- actionUrlExtraParams?: object | undefined;
28
- item: Ijson;
29
- }) => Promise<any[]>;
30
20
  /**
31
21
  * attrList 格式的单层数组 处理成对象{attrid:attrname}
32
22
  */
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const dayjs = require("dayjs");
4
- const antd = require("antd");
5
4
  const handleGetPlaceholder = (itemWithJson, langId) => {
6
5
  const { input = "" } = (itemWithJson == null ? void 0 : itemWithJson.json) || {};
7
6
  let placeholderCn = "请输入", placeholderEn = "Please input";
@@ -95,94 +94,6 @@ const handleUrlOptions = (val, delimiter, list) => {
95
94
  });
96
95
  return arr.join(delimiter || "-");
97
96
  };
98
- const handleSelectOptions = async ({
99
- commonRequestWidthParams,
100
- commonRequest,
101
- interfaceTypeDict = "YLZDDictList",
102
- interfaceTypeSysDict = "YLZDSysConfigList",
103
- actionUrlKey = "action-url",
104
- actionUrlExtraParams = {},
105
- item
106
- }) => {
107
- var _a;
108
- let options = [];
109
- const getDict = async (interfaceType) => {
110
- var _a2;
111
- let list = [];
112
- if (item.classify) {
113
- try {
114
- const response = await commonRequest(interfaceType, {
115
- asctypeid: item.classify
116
- });
117
- if (((_a2 = response == null ? void 0 : response.data) == null ? void 0 : _a2.list) && Array.isArray(response.data.list)) {
118
- list = response.data.list.map((dictItem) => ({
119
- label: `${dictItem.dicid || ""}-${dictItem.info || ""}`,
120
- value: `${dictItem.dicid || ""}-${dictItem.info || ""}`
121
- }));
122
- }
123
- } catch (error) {
124
- antd.message.error("加载选项失败");
125
- }
126
- }
127
- return list;
128
- };
129
- const getUrlOptions = async () => {
130
- var _a2, _b;
131
- try {
132
- const keyFieldList = ((_a2 = item == null ? void 0 : item["key-field"]) == null ? void 0 : _a2.list) || [];
133
- const delimiter = ((_b = item == null ? void 0 : item["key-field"]) == null ? void 0 : _b.delimiter) || "";
134
- if (!keyFieldList.length) {
135
- antd.message.error("请配置key-field");
136
- return;
137
- }
138
- const response = await commonRequestWidthParams(
139
- {
140
- PageName: "dns_relay",
141
- Controlname: "CallActionUrl",
142
- InterfaceType: ""
143
- },
144
- {
145
- [actionUrlKey]: item == null ? void 0 : item["action-url"],
146
- ...actionUrlExtraParams
147
- }
148
- );
149
- if (response == null ? void 0 : response.data) {
150
- const data = response == null ? void 0 : response.data;
151
- const list = (data == null ? void 0 : data.list) || [];
152
- let urlData = [];
153
- if (Array.isArray(data)) {
154
- urlData = data;
155
- }
156
- if (Array.isArray(list)) {
157
- urlData = list;
158
- }
159
- options = urlData.map((val) => ({
160
- label: handleUrlOptions(val, delimiter, keyFieldList),
161
- value: handleUrlOptions(val, delimiter, keyFieldList)
162
- }));
163
- }
164
- } catch (error) {
165
- antd.message.error("加载选项失败");
166
- }
167
- };
168
- if (item.inputType === "local") {
169
- options = ((_a = item.data) == null ? void 0 : _a.map((val) => ({
170
- label: val,
171
- value: val
172
- }))) || [];
173
- if (item.options && Array.isArray(item.options)) {
174
- options = item.options;
175
- }
176
- } else if (item.inputType === "dictionary") {
177
- options = await getDict(interfaceTypeDict);
178
- } else if (item.inputType === "system-dictionary") {
179
- options = await getDict(interfaceTypeSysDict);
180
- }
181
- if (item.inputType === "url" && (item == null ? void 0 : item["action-url"])) {
182
- await getUrlOptions();
183
- }
184
- return options;
185
- };
186
97
  const handleGetSingleAttrListObj = (children) => {
187
98
  if (!(children == null ? void 0 : children.length)) {
188
99
  return [];
@@ -206,6 +117,5 @@ const handleGetSingleAttrListObj = (children) => {
206
117
  exports.disabledDate = disabledDate;
207
118
  exports.handleGetPlaceholder = handleGetPlaceholder;
208
119
  exports.handleGetSingleAttrListObj = handleGetSingleAttrListObj;
209
- exports.handleSelectOptions = handleSelectOptions;
210
120
  exports.handleSetFormItemInitialValue = handleSetFormItemInitialValue;
211
121
  exports.handleUrlOptions = handleUrlOptions;
@@ -18,6 +18,7 @@ export interface IformConfigItem {
18
18
  }
19
19
 
20
20
  export interface Ijson {
21
+ 'field-names'?: string; // 级联选择的自定义字段名
21
22
  'input-width'?: string; // 输入框宽度
22
23
  'action-url-extra-params'?: { [key: string]: any }; // 弹窗选择对应多个表单字段时,额外的参数
23
24
  'disable-date-goover'?: boolean; // 禁用日期选择器超出当前日期
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  const jsxRuntime = require("react/jsx-runtime");
3
+ const method = require("../../../utils/method");
3
4
  const func = require("../func");
4
5
  const react = require("react");
5
6
  const antd = require("antd");
@@ -24,7 +25,7 @@ const MySelect = ({
24
25
  }, [item.inputType, item.classify, item.data, item.options]);
25
26
  const handleLoadOptions = async () => {
26
27
  setLoading(true);
27
- const list = await func.handleSelectOptions({
28
+ const list = await method.handleSelectOptions({
28
29
  commonRequestWidthParams,
29
30
  commonRequest,
30
31
  interfaceTypeDict,
@@ -1,6 +1,5 @@
1
- import { IformConfigItem, Ijson } from './index.d';
1
+ import { IformConfigItem } from './index.d';
2
2
  import { RangePickerProps } from 'antd/es/date-picker';
3
- import { AxiosResponse } from 'axios';
4
3
  export declare const handleGetPlaceholder: (itemWithJson: IformConfigItem, langId?: string) => string;
5
4
  /**
6
5
  * 处理表单项目初始值
@@ -18,15 +17,6 @@ export declare const handleUrlOptions: (val: any, delimiter: string, list: any[]
18
17
  * @param param0
19
18
  * @returns
20
19
  */
21
- export declare const handleSelectOptions: ({ commonRequestWidthParams, commonRequest, interfaceTypeDict, interfaceTypeSysDict, actionUrlKey, actionUrlExtraParams, item, }: {
22
- commonRequestWidthParams: (params: object, data?: any) => Promise<AxiosResponse<any, any>>;
23
- commonRequest: (InterfaceType: string, data?: any) => Promise<AxiosResponse<any, any>>;
24
- interfaceTypeDict?: string | undefined;
25
- interfaceTypeSysDict?: string | undefined;
26
- actionUrlKey?: string | undefined;
27
- actionUrlExtraParams?: object | undefined;
28
- item: Ijson;
29
- }) => Promise<any[]>;
30
20
  /**
31
21
  * attrList 格式的单层数组 处理成对象{attrid:attrname}
32
22
  */
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const dayjs = require("dayjs");
4
- const antd = require("antd");
5
4
  const handleGetPlaceholder = (itemWithJson, langId) => {
6
5
  const { input = "" } = (itemWithJson == null ? void 0 : itemWithJson.json) || {};
7
6
  let placeholderCn = "请输入", placeholderEn = "Please input";
@@ -95,94 +94,6 @@ const handleUrlOptions = (val, delimiter, list) => {
95
94
  });
96
95
  return arr.join(delimiter || "-");
97
96
  };
98
- const handleSelectOptions = async ({
99
- commonRequestWidthParams,
100
- commonRequest,
101
- interfaceTypeDict = "YLZDDictList",
102
- interfaceTypeSysDict = "YLZDSysConfigList",
103
- actionUrlKey = "action-url",
104
- actionUrlExtraParams = {},
105
- item
106
- }) => {
107
- var _a;
108
- let options = [];
109
- const getDict = async (interfaceType) => {
110
- var _a2;
111
- let list = [];
112
- if (item.classify) {
113
- try {
114
- const response = await commonRequest(interfaceType, {
115
- asctypeid: item.classify
116
- });
117
- if (((_a2 = response == null ? void 0 : response.data) == null ? void 0 : _a2.list) && Array.isArray(response.data.list)) {
118
- list = response.data.list.map((dictItem) => ({
119
- label: `${dictItem.dicid || ""}-${dictItem.info || ""}`,
120
- value: `${dictItem.dicid || ""}-${dictItem.info || ""}`
121
- }));
122
- }
123
- } catch (error) {
124
- antd.message.error("加载选项失败");
125
- }
126
- }
127
- return list;
128
- };
129
- const getUrlOptions = async () => {
130
- var _a2, _b;
131
- try {
132
- const keyFieldList = ((_a2 = item == null ? void 0 : item["key-field"]) == null ? void 0 : _a2.list) || [];
133
- const delimiter = ((_b = item == null ? void 0 : item["key-field"]) == null ? void 0 : _b.delimiter) || "";
134
- if (!keyFieldList.length) {
135
- antd.message.error("请配置key-field");
136
- return;
137
- }
138
- const response = await commonRequestWidthParams(
139
- {
140
- PageName: "dns_relay",
141
- Controlname: "CallActionUrl",
142
- InterfaceType: ""
143
- },
144
- {
145
- [actionUrlKey]: item == null ? void 0 : item["action-url"],
146
- ...actionUrlExtraParams
147
- }
148
- );
149
- if (response == null ? void 0 : response.data) {
150
- const data = response == null ? void 0 : response.data;
151
- const list = (data == null ? void 0 : data.list) || [];
152
- let urlData = [];
153
- if (Array.isArray(data)) {
154
- urlData = data;
155
- }
156
- if (Array.isArray(list)) {
157
- urlData = list;
158
- }
159
- options = urlData.map((val) => ({
160
- label: handleUrlOptions(val, delimiter, keyFieldList),
161
- value: handleUrlOptions(val, delimiter, keyFieldList)
162
- }));
163
- }
164
- } catch (error) {
165
- antd.message.error("加载选项失败");
166
- }
167
- };
168
- if (item.inputType === "local") {
169
- options = ((_a = item.data) == null ? void 0 : _a.map((val) => ({
170
- label: val,
171
- value: val
172
- }))) || [];
173
- if (item.options && Array.isArray(item.options)) {
174
- options = item.options;
175
- }
176
- } else if (item.inputType === "dictionary") {
177
- options = await getDict(interfaceTypeDict);
178
- } else if (item.inputType === "system-dictionary") {
179
- options = await getDict(interfaceTypeSysDict);
180
- }
181
- if (item.inputType === "url" && (item == null ? void 0 : item["action-url"])) {
182
- await getUrlOptions();
183
- }
184
- return options;
185
- };
186
97
  const handleGetSingleAttrListObj = (children) => {
187
98
  if (!(children == null ? void 0 : children.length)) {
188
99
  return [];
@@ -206,6 +117,5 @@ const handleGetSingleAttrListObj = (children) => {
206
117
  exports.disabledDate = disabledDate;
207
118
  exports.handleGetPlaceholder = handleGetPlaceholder;
208
119
  exports.handleGetSingleAttrListObj = handleGetSingleAttrListObj;
209
- exports.handleSelectOptions = handleSelectOptions;
210
120
  exports.handleSetFormItemInitialValue = handleSetFormItemInitialValue;
211
121
  exports.handleUrlOptions = handleUrlOptions;
@@ -18,6 +18,7 @@ export interface IformConfigItem {
18
18
  }
19
19
 
20
20
  export interface Ijson {
21
+ 'field-names'?: string; // 级联选择的自定义字段名
21
22
  'search-field'?: any; // 是否搜索字段
22
23
  'action-url-extra-params'?: { [key: string]: any }; // 弹窗选择对应多个表单字段时,额外的参数
23
24
  'disable-date-goover'?: boolean; // 禁用日期选择器超出当前日期
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  const jsxRuntime = require("react/jsx-runtime");
3
3
  const reactVant = require("react-vant");
4
- const func = require("../func");
4
+ const method = require("../../../utils/method");
5
5
  const react = require("react");
6
6
  const antd = require("antd");
7
7
  const checkboxGroup = "index-module_checkbox-group_4684b";
@@ -46,7 +46,7 @@ const MySelect = ({
46
46
  handleLoadOptions();
47
47
  }, [item.inputType, item.classify, item.data, item.options]);
48
48
  const handleLoadOptions = async () => {
49
- const list = await func.handleSelectOptions({
49
+ const list = await method.handleSelectOptions({
50
50
  commonRequestWidthParams,
51
51
  commonRequest,
52
52
  interfaceTypeDict,