inl-ui 0.0.25 → 0.0.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "inl-ui",
3
- "version": "0.0.25",
3
+ "version": "0.0.26",
4
4
  "description": "工业 pc ui库",
5
5
  "main": "dist/index.js",
6
6
  "types": "./dist/types/src/index.d.ts",
@@ -1,6 +1,6 @@
1
1
  const systemConfig = {
2
2
  projectInfo: [
3
- { name: "customer", label: "客户名称", type: "select" },
3
+ { name: "customer", label: "客户名称", type: "treeSelect" },
4
4
  {
5
5
  name: "project",
6
6
  label: "项目名称",
@@ -231,6 +231,47 @@ const SystemSetting = defineComponent({
231
231
  </>
232
232
  );
233
233
  };
234
+ const getDisabledData = (data: any[], fn: (item: any) => boolean) => {
235
+ return data.map((item) => {
236
+ return {
237
+ ...item,
238
+ disabled: fn(item),
239
+ subList: getDisabledData(item.subList, fn),
240
+ };
241
+ });
242
+ };
243
+ window.treeSelect = (item) => {
244
+ return (
245
+ <>
246
+ {_props[`${item.name}`] ? (
247
+ <div class="systemConfig_form">
248
+ <span class="label">{item.label}</span>
249
+ <a-tree-select
250
+ treeDefaultExpandAll
251
+ fieldNames={{
252
+ children: "subList",
253
+ value: "id",
254
+ key: "id",
255
+ label: "name",
256
+ }}
257
+ treeData={getDisabledData(
258
+ data[`${item.name}Option`],
259
+ (item) => item.level !== 3
260
+ )}
261
+ v-model={[data.form[`${item.name}Id`], "value"]}
262
+ disabled={!edit.value}
263
+ >
264
+ {/* {data[`${item.name}Option`].map((val: OptionItem) => (
265
+ <a-select-option value={val.id}>{val.name}</a-select-option>
266
+ ))} */}
267
+ </a-tree-select>
268
+ </div>
269
+ ) : (
270
+ ""
271
+ )}
272
+ </>
273
+ );
274
+ };
234
275
  window.input = (item: { [key: string]: string }) => {
235
276
  return (
236
277
  <>
package/src/types/gl.d.ts CHANGED
@@ -18,6 +18,7 @@ declare global {
18
18
  select: (opt: any) => void;
19
19
  input: (opt: any) => void;
20
20
  img: (opt: any) => void;
21
+ treeSelect: (opt: any) => void;
21
22
  }
22
23
  }
23
24