3h1-ui 3.0.0-next.73 → 3.0.0-next.75
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/es/index.js +685 -243
- package/es/style.css +98 -29
- package/lib/index.js +685 -243
- package/package.json +1 -1
package/es/index.js
CHANGED
|
@@ -8907,7 +8907,7 @@ const _hoisted_6$3 = {
|
|
|
8907
8907
|
key: 1,
|
|
8908
8908
|
class: "p-5"
|
|
8909
8909
|
};
|
|
8910
|
-
const _hoisted_7$
|
|
8910
|
+
const _hoisted_7$1 = {
|
|
8911
8911
|
key: 0,
|
|
8912
8912
|
class: "cursor-pointer px-2 py-1 flex items-center"
|
|
8913
8913
|
};
|
|
@@ -9051,7 +9051,7 @@ const _sfc_main$1t = /* @__PURE__ */ defineComponent({
|
|
|
9051
9051
|
]))
|
|
9052
9052
|
]),
|
|
9053
9053
|
default: withCtx(() => [
|
|
9054
|
-
isSvgMode && currentSelect.value ? (openBlock(), createElementBlock("span", _hoisted_7$
|
|
9054
|
+
isSvgMode && currentSelect.value ? (openBlock(), createElementBlock("span", _hoisted_7$1, [
|
|
9055
9055
|
createVNode(SvgIcon, { name: currentSelect.value }, null, 8, ["name"])
|
|
9056
9056
|
])) : (openBlock(), createBlock(Icon2, {
|
|
9057
9057
|
key: 1,
|
|
@@ -18224,7 +18224,7 @@ const _hoisted_5$4 = {
|
|
|
18224
18224
|
class: "shy-ui-advanced-search-item-value-range"
|
|
18225
18225
|
};
|
|
18226
18226
|
const _hoisted_6$1 = /* @__PURE__ */ createElementVNode("div", { style: { "flex": "0", "width": "40px", "margin-right": "8px" } }, " 至 ", -1);
|
|
18227
|
-
const _hoisted_7
|
|
18227
|
+
const _hoisted_7 = {
|
|
18228
18228
|
key: 1,
|
|
18229
18229
|
style: { "margin-left": "8px", "cursor": "pointer", "position": "relative" },
|
|
18230
18230
|
class: "shy-ui-advanced-minus-icon"
|
|
@@ -18531,7 +18531,7 @@ const _sfc_main$T = /* @__PURE__ */ defineComponent({
|
|
|
18531
18531
|
]),
|
|
18532
18532
|
_: 2
|
|
18533
18533
|
}, 1024)) : createCommentVNode("", true),
|
|
18534
|
-
(schemasCurrent == null ? void 0 : schemasCurrent.length) !== 1 ? (openBlock(), createElementBlock("div", _hoisted_7
|
|
18534
|
+
(schemasCurrent == null ? void 0 : schemasCurrent.length) !== 1 ? (openBlock(), createElementBlock("div", _hoisted_7, [
|
|
18535
18535
|
createElementVNode("div", {
|
|
18536
18536
|
style: { "position": "absolute", "width": "14px", "height": "14px", "left": "0", "right": "0", "top": "0", "bottom": "0" },
|
|
18537
18537
|
class: "shy-basic-minus-icon",
|
|
@@ -20705,7 +20705,7 @@ const Description = /* @__PURE__ */ defineComponent({
|
|
|
20705
20705
|
element = slots[`${item.field}Value`] ? (_b = slots[`${item.field}Value`]) == null ? void 0 : _b.call(slots, {
|
|
20706
20706
|
model: data,
|
|
20707
20707
|
field: data[`${item.field}`]
|
|
20708
|
-
}) : isNumber$2(+data[`${item.field}`]) && !isNaN(+data[`${item.field}`]) ? (+data[`${item.field}`]).toFixed(getProps.value.summaryPrecision).replace(/(\d)(?=(\d{3})+\.)/g, "$1,") : data[`${item.field}`];
|
|
20708
|
+
}) : getProps.value.summaryTotalFields.includes(item.field) && isNumber$2(+data[`${item.field}`]) && !isNaN(+data[`${item.field}`]) ? (+data[`${item.field}`]).toFixed(getProps.value.summaryPrecision).replace(/(\d)(?=(\d{3})+\.)/g, "$1,") : data[`${item.field}`];
|
|
20709
20709
|
} else {
|
|
20710
20710
|
element = slots[`${item.field}Value`] ? (_c = slots[`${item.field}Value`]) == null ? void 0 : _c.call(slots, {
|
|
20711
20711
|
model: data,
|
|
@@ -33114,15 +33114,11 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
|
|
|
33114
33114
|
};
|
|
33115
33115
|
}
|
|
33116
33116
|
});
|
|
33117
|
-
const
|
|
33118
|
-
|
|
33119
|
-
|
|
33120
|
-
|
|
33121
|
-
const
|
|
33122
|
-
const _hoisted_3$2 = { class: "table-children-add-btn" };
|
|
33123
|
-
const _hoisted_4$2 = { class: "w-full h-[fit-content] py-8px flex justify-end items-center" };
|
|
33124
|
-
const _sfc_main$d = /* @__PURE__ */ defineComponent({
|
|
33125
|
-
__name: "Table",
|
|
33117
|
+
const formTable = "";
|
|
33118
|
+
const SHOW_ROW_COUNT = 10;
|
|
33119
|
+
const ROW_HEIGHT = 48.67;
|
|
33120
|
+
const BODY_HEIGHT = ROW_HEIGHT * SHOW_ROW_COUNT;
|
|
33121
|
+
const ShyFormTable = /* @__PURE__ */ defineComponent({
|
|
33126
33122
|
props: {
|
|
33127
33123
|
rowKey: {
|
|
33128
33124
|
type: String,
|
|
@@ -33156,21 +33152,27 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
|
|
|
33156
33152
|
}
|
|
33157
33153
|
},
|
|
33158
33154
|
emits: ["update:value", "change", "add", "remove"],
|
|
33159
|
-
setup(
|
|
33155
|
+
setup(props2, {
|
|
33156
|
+
emit,
|
|
33157
|
+
attrs
|
|
33158
|
+
}) {
|
|
33159
|
+
const {
|
|
33160
|
+
prefixCls: prefixCls2
|
|
33161
|
+
} = useDesign$1("ant-form-table-children");
|
|
33160
33162
|
const formActionType = inject("formActionType");
|
|
33161
|
-
const
|
|
33162
|
-
const props2 = __props;
|
|
33163
|
+
const tableWrapperRef = ref();
|
|
33163
33164
|
const tableElRef = ref();
|
|
33165
|
+
const curIndex = ref(0);
|
|
33166
|
+
const sourceHeight = ref(0);
|
|
33167
|
+
const dataSource = ref([]);
|
|
33164
33168
|
const emitData = ref([]);
|
|
33165
33169
|
const [state] = useRuleFormItem(props2, "value", "change", emitData);
|
|
33166
33170
|
const getColumns = computed(() => {
|
|
33167
33171
|
const indexColumn = {
|
|
33168
33172
|
title: "序号",
|
|
33169
33173
|
dataIndex: "index",
|
|
33170
|
-
customRender: ({ index: index2 }) => {
|
|
33171
|
-
return `${index2 + 1}`;
|
|
33172
|
-
},
|
|
33173
33174
|
width: 50,
|
|
33175
|
+
maxWidth: 50,
|
|
33174
33176
|
align: "center"
|
|
33175
33177
|
};
|
|
33176
33178
|
const actionColumn = {
|
|
@@ -33179,14 +33181,10 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
|
|
|
33179
33181
|
width: 80,
|
|
33180
33182
|
align: "center"
|
|
33181
33183
|
};
|
|
33182
|
-
return [
|
|
33183
|
-
|
|
33184
|
-
|
|
33185
|
-
|
|
33186
|
-
type: item.type ? item.type : "input"
|
|
33187
|
-
})),
|
|
33188
|
-
...(props2 == null ? void 0 : props2.isShowAction) ? [actionColumn] : []
|
|
33189
|
-
];
|
|
33184
|
+
return [indexColumn, ...props2.columns.map((item) => ({
|
|
33185
|
+
...item,
|
|
33186
|
+
type: item.type ? item.type : "input"
|
|
33187
|
+
})), ...(props2 == null ? void 0 : props2.isShowAction) ? [actionColumn] : []];
|
|
33190
33188
|
});
|
|
33191
33189
|
const getScrollX = computed(() => {
|
|
33192
33190
|
var _a2;
|
|
@@ -33196,9 +33194,7 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
|
|
|
33196
33194
|
columns.forEach((item) => {
|
|
33197
33195
|
width += Number.parseFloat(item.width) || 0;
|
|
33198
33196
|
});
|
|
33199
|
-
const unsetWidthColumns = columns.filter(
|
|
33200
|
-
(item) => !Reflect.has(item, "width")
|
|
33201
|
-
);
|
|
33197
|
+
const unsetWidthColumns = columns.filter((item) => !Reflect.has(item, "width"));
|
|
33202
33198
|
const len = unsetWidthColumns.length;
|
|
33203
33199
|
if (len !== 0) {
|
|
33204
33200
|
width += len * NORMAL_WIDTH;
|
|
@@ -33207,11 +33203,190 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
|
|
|
33207
33203
|
const tableWidth = ((_a2 = table2 == null ? void 0 : table2.$el) == null ? void 0 : _a2.offsetWidth) ?? 0;
|
|
33208
33204
|
return tableWidth > width ? "100%" : width;
|
|
33209
33205
|
});
|
|
33210
|
-
const
|
|
33211
|
-
|
|
33206
|
+
const handleScroll = (e) => {
|
|
33207
|
+
const {
|
|
33208
|
+
scrollTop,
|
|
33209
|
+
scrollHeight
|
|
33210
|
+
} = e.target;
|
|
33211
|
+
let lenMax = state.value.length, nIdx;
|
|
33212
|
+
if (scrollTop === 0) {
|
|
33213
|
+
dataSource.value = state.value.slice(0, SHOW_ROW_COUNT);
|
|
33214
|
+
curIndex.value = 0;
|
|
33215
|
+
} else if (scrollTop === scrollHeight - BODY_HEIGHT) {
|
|
33216
|
+
nIdx = lenMax - SHOW_ROW_COUNT;
|
|
33217
|
+
dataSource.value = state.value.slice(nIdx, nIdx + SHOW_ROW_COUNT);
|
|
33218
|
+
curIndex.value = nIdx;
|
|
33219
|
+
} else {
|
|
33220
|
+
nIdx = Math.ceil(scrollTop * lenMax / scrollHeight);
|
|
33221
|
+
if (nIdx !== curIndex.value && nIdx <= lenMax - SHOW_ROW_COUNT) {
|
|
33222
|
+
dataSource.value = state.value.slice(nIdx, nIdx + SHOW_ROW_COUNT);
|
|
33223
|
+
curIndex.value = nIdx;
|
|
33224
|
+
}
|
|
33225
|
+
}
|
|
33226
|
+
};
|
|
33227
|
+
const defaultProps = {
|
|
33228
|
+
style: {
|
|
33229
|
+
width: "100%"
|
|
33230
|
+
},
|
|
33231
|
+
allowClear: true,
|
|
33232
|
+
getPopupContainer: () => document.body
|
|
33233
|
+
};
|
|
33234
|
+
const renderTable = computed(() => {
|
|
33235
|
+
return createVNode("div", {
|
|
33236
|
+
"ref": tableWrapperRef,
|
|
33237
|
+
"class": prefixCls2
|
|
33238
|
+
}, [createVNode(Table$2, {
|
|
33239
|
+
"ref": tableElRef,
|
|
33240
|
+
"columns": getColumns.value,
|
|
33241
|
+
"scroll": {
|
|
33242
|
+
x: state.value.length ? getScrollX.value : void 0,
|
|
33243
|
+
y: BODY_HEIGHT
|
|
33244
|
+
},
|
|
33245
|
+
"data-source": dataSource.value,
|
|
33246
|
+
"pagination": false,
|
|
33247
|
+
"bordered": true,
|
|
33248
|
+
"size": "small",
|
|
33249
|
+
"class": `${prefixCls2}-body`,
|
|
33250
|
+
"align": "center",
|
|
33251
|
+
"rowKey": props2.rowKey,
|
|
33252
|
+
"components": {
|
|
33253
|
+
body: {
|
|
33254
|
+
cell: renderTd
|
|
33255
|
+
}
|
|
33256
|
+
}
|
|
33257
|
+
}, {
|
|
33258
|
+
headerCell: ({
|
|
33259
|
+
column: column2
|
|
33260
|
+
}) => {
|
|
33261
|
+
const renderRequired = () => {
|
|
33262
|
+
var _a2;
|
|
33263
|
+
if (column2.required || ((_a2 = column2 == null ? void 0 : column2.rules) == null ? void 0 : _a2.length)) {
|
|
33264
|
+
return createVNode("span", {
|
|
33265
|
+
"class": `${prefixCls2}-body-required`
|
|
33266
|
+
}, [createTextVNode("*")]);
|
|
33267
|
+
}
|
|
33268
|
+
return null;
|
|
33269
|
+
};
|
|
33270
|
+
return createVNode(Fragment, null, [renderRequired(), createVNode("span", null, [column2.title])]);
|
|
33271
|
+
},
|
|
33272
|
+
bodyCell: ({
|
|
33273
|
+
column: column2,
|
|
33274
|
+
record,
|
|
33275
|
+
index: index2,
|
|
33276
|
+
...args
|
|
33277
|
+
}) => {
|
|
33278
|
+
const renderFormItem = () => {
|
|
33279
|
+
const componentProps = isFunction$4(column2.componentProps) ? {
|
|
33280
|
+
...defaultProps,
|
|
33281
|
+
...column2.componentProps({
|
|
33282
|
+
record,
|
|
33283
|
+
column: column2,
|
|
33284
|
+
index: index2,
|
|
33285
|
+
...args
|
|
33286
|
+
})
|
|
33287
|
+
} : {
|
|
33288
|
+
...defaultProps,
|
|
33289
|
+
...column2.componentProps
|
|
33290
|
+
};
|
|
33291
|
+
const eventKey = `on${upperFirst$2("change")}`;
|
|
33292
|
+
const isCheck = ["Switch", "Checkbox"].includes(getType(column2.type));
|
|
33293
|
+
const on2 = {
|
|
33294
|
+
[eventKey]: (...args2) => {
|
|
33295
|
+
const [e] = args2;
|
|
33296
|
+
if (componentProps[eventKey] && args2.length >= 1) {
|
|
33297
|
+
componentProps[eventKey](...args2);
|
|
33298
|
+
}
|
|
33299
|
+
const target = e ? e.target : null;
|
|
33300
|
+
const value = target ? isCheck ? target.checked : target.value : e;
|
|
33301
|
+
const currValue = state.value.find((item) => item[props2.rowKey] === record[props2.rowKey]);
|
|
33302
|
+
currValue[column2.dataIndex] = value;
|
|
33303
|
+
}
|
|
33304
|
+
};
|
|
33305
|
+
const bindValue = {
|
|
33306
|
+
[isCheck ? "checked" : "value"]: record[column2.dataIndex]
|
|
33307
|
+
};
|
|
33308
|
+
const compAttr = {
|
|
33309
|
+
...componentProps,
|
|
33310
|
+
...on2,
|
|
33311
|
+
...bindValue
|
|
33312
|
+
};
|
|
33313
|
+
return column2.dataIndex !== "index" && column2.type !== "text" && column2.dataIndex !== "_action" ? createVNode("td", {
|
|
33314
|
+
"class": "ant-table-cell",
|
|
33315
|
+
"style": renderTdProps(column2)
|
|
33316
|
+
}, [createVNode(FormItem, {
|
|
33317
|
+
"required": column2.required,
|
|
33318
|
+
"rules": getRules({
|
|
33319
|
+
column: column2,
|
|
33320
|
+
record,
|
|
33321
|
+
index: index2,
|
|
33322
|
+
...args
|
|
33323
|
+
}),
|
|
33324
|
+
"name": [attrs.codeField, index2 + curIndex.value, column2.dataIndex]
|
|
33325
|
+
}, {
|
|
33326
|
+
default: () => {
|
|
33327
|
+
var _a2;
|
|
33328
|
+
return [createVNode(Popover, {
|
|
33329
|
+
"visible": !!((_a2 = rulesRef == null ? void 0 : rulesRef[`${column2.dataIndex}-${record[props2.rowKey]}Info`]) == null ? void 0 : _a2.show) && !isScroll.value
|
|
33330
|
+
}, {
|
|
33331
|
+
content: () => {
|
|
33332
|
+
var _a3;
|
|
33333
|
+
return createVNode("span", {
|
|
33334
|
+
"class": "text-red-500"
|
|
33335
|
+
}, [(_a3 = rulesRef[`${column2.dataIndex}-${record[props2.rowKey]}Info`]) == null ? void 0 : _a3.msg]);
|
|
33336
|
+
},
|
|
33337
|
+
default: () => {
|
|
33338
|
+
const Comp = ShyComponentMap.get(getType(column2.type));
|
|
33339
|
+
return createVNode(Comp, compAttr, null);
|
|
33340
|
+
}
|
|
33341
|
+
})];
|
|
33342
|
+
}
|
|
33343
|
+
})]) : null;
|
|
33344
|
+
};
|
|
33345
|
+
const renderAction = () => {
|
|
33346
|
+
return column2.dataIndex === "_action" ? createVNode("td", {
|
|
33347
|
+
"class": "ant-table-cell",
|
|
33348
|
+
"style": {
|
|
33349
|
+
textAlign: "center"
|
|
33350
|
+
}
|
|
33351
|
+
}, [createVNode(ShyTableAction, {
|
|
33352
|
+
"actions": getActions(record)
|
|
33353
|
+
}, null)]) : null;
|
|
33354
|
+
};
|
|
33355
|
+
const renderIndex = () => {
|
|
33356
|
+
return column2.dataIndex === "index" ? createVNode("td", {
|
|
33357
|
+
"class": "ant-table-cell",
|
|
33358
|
+
"style": {
|
|
33359
|
+
textAlign: "center"
|
|
33360
|
+
}
|
|
33361
|
+
}, [index2 + curIndex.value + 1]) : null;
|
|
33362
|
+
};
|
|
33363
|
+
return renderFormItem() ?? renderAction() ?? renderIndex() ?? createVNode("td", {
|
|
33364
|
+
"class": "ant-table-cell",
|
|
33365
|
+
"style": renderTdProps(column2)
|
|
33366
|
+
}, [record[column2.dataIndex]]);
|
|
33367
|
+
}
|
|
33368
|
+
}), createVNode("div", {
|
|
33369
|
+
"class": `${prefixCls2}-scroll-bar-wrapper`,
|
|
33370
|
+
"style": {
|
|
33371
|
+
"--height": `${BODY_HEIGHT}px`
|
|
33372
|
+
}
|
|
33373
|
+
}, [createVNode("div", {
|
|
33374
|
+
"class": `${prefixCls2}-scroll-bar-inner`,
|
|
33375
|
+
"style": {
|
|
33376
|
+
"--height": `${sourceHeight.value}px`
|
|
33377
|
+
}
|
|
33378
|
+
}, null)])]);
|
|
33379
|
+
});
|
|
33380
|
+
const create = () => {
|
|
33381
|
+
state.value = [{
|
|
33382
|
+
[props2.rowKey]: buildUUID()
|
|
33383
|
+
}, ...toRaw(state.value)];
|
|
33384
|
+
curIndex.value = 0;
|
|
33385
|
+
document.querySelector(`.${prefixCls2}-scroll-bar-wrapper`).scrollTop = curIndex.value * ROW_HEIGHT;
|
|
33212
33386
|
emit("add", state.value);
|
|
33213
33387
|
};
|
|
33214
|
-
const
|
|
33388
|
+
const remove = (index2) => {
|
|
33389
|
+
curIndex.value -= curIndex.value === 0 ? 0 : 1;
|
|
33215
33390
|
const tempState = state.value.filter((item) => {
|
|
33216
33391
|
return item[props2.rowKey] !== index2;
|
|
33217
33392
|
});
|
|
@@ -33219,9 +33394,13 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
|
|
|
33219
33394
|
state.value = [...tempState];
|
|
33220
33395
|
emit("remove", state.value, index2);
|
|
33221
33396
|
};
|
|
33222
|
-
const getPopupContainer2 = () => document.body;
|
|
33223
33397
|
const rulesRef = reactive({});
|
|
33224
|
-
const getRules = ({
|
|
33398
|
+
const getRules = ({
|
|
33399
|
+
column: column2,
|
|
33400
|
+
record,
|
|
33401
|
+
index: index2,
|
|
33402
|
+
...args
|
|
33403
|
+
}) => {
|
|
33225
33404
|
var _a2, _b;
|
|
33226
33405
|
const errKey = `${column2.dataIndex}-${record[props2.rowKey]}Info`;
|
|
33227
33406
|
if (!column2.required)
|
|
@@ -33234,22 +33413,20 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
|
|
|
33234
33413
|
msg: ""
|
|
33235
33414
|
};
|
|
33236
33415
|
if (!column2.rules && column2.required) {
|
|
33237
|
-
rulesRef[errKey].rules = [
|
|
33238
|
-
|
|
33239
|
-
|
|
33240
|
-
|
|
33241
|
-
|
|
33242
|
-
|
|
33243
|
-
|
|
33244
|
-
|
|
33245
|
-
return Promise.resolve();
|
|
33246
|
-
}
|
|
33247
|
-
rulesRef[errKey].show = true;
|
|
33248
|
-
rulesRef[errKey].msg = errMsg;
|
|
33249
|
-
return Promise.reject(errMsg);
|
|
33416
|
+
rulesRef[errKey].rules = [{
|
|
33417
|
+
required: true,
|
|
33418
|
+
validator: (rule, value) => {
|
|
33419
|
+
const prefix = column2.type.toLocaleLowerCase().includes("input") ? "请输入" : "请选择";
|
|
33420
|
+
const errMsg = `${prefix}${column2.title}`;
|
|
33421
|
+
if (value) {
|
|
33422
|
+
rulesRef[errKey].show = false;
|
|
33423
|
+
return Promise.resolve();
|
|
33250
33424
|
}
|
|
33425
|
+
rulesRef[errKey].show = true;
|
|
33426
|
+
rulesRef[errKey].msg = errMsg;
|
|
33427
|
+
return Promise.reject(errMsg);
|
|
33251
33428
|
}
|
|
33252
|
-
];
|
|
33429
|
+
}];
|
|
33253
33430
|
return rulesRef[errKey].rules;
|
|
33254
33431
|
}
|
|
33255
33432
|
if (!isArray$3(column2.rules))
|
|
@@ -33262,12 +33439,11 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
|
|
|
33262
33439
|
item.validator = async (rule, value) => {
|
|
33263
33440
|
try {
|
|
33264
33441
|
rulesRef[errKey].show = false;
|
|
33265
|
-
return await validator(
|
|
33266
|
-
|
|
33267
|
-
|
|
33268
|
-
|
|
33269
|
-
|
|
33270
|
-
);
|
|
33442
|
+
return await validator(rule, value, {
|
|
33443
|
+
column: column2,
|
|
33444
|
+
record,
|
|
33445
|
+
...args
|
|
33446
|
+
}, formActionType);
|
|
33271
33447
|
} catch (error2) {
|
|
33272
33448
|
rulesRef[errKey].show = true;
|
|
33273
33449
|
rulesRef[errKey].msg = error2;
|
|
@@ -33278,192 +33454,112 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
|
|
|
33278
33454
|
return rulesRef[errKey].rules;
|
|
33279
33455
|
};
|
|
33280
33456
|
const getActions = (record) => {
|
|
33281
|
-
return [
|
|
33282
|
-
|
|
33283
|
-
|
|
33284
|
-
|
|
33285
|
-
|
|
33286
|
-
confirm: rowClickEvent.bind(null, record[props2.rowKey])
|
|
33287
|
-
}
|
|
33288
|
-
},
|
|
33289
|
-
...props2.tableAction(record)
|
|
33290
|
-
];
|
|
33291
|
-
};
|
|
33292
|
-
watch(
|
|
33293
|
-
() => state.value,
|
|
33294
|
-
(v, old) => {
|
|
33295
|
-
if (!isEqual(toRaw(v), toRaw(old))) {
|
|
33296
|
-
state.value = toRaw(v).map((ele) => {
|
|
33297
|
-
return {
|
|
33298
|
-
...ele,
|
|
33299
|
-
[props2.rowKey]: ele[props2.rowKey] || buildUUID()
|
|
33300
|
-
};
|
|
33301
|
-
});
|
|
33457
|
+
return [{
|
|
33458
|
+
label: "删除",
|
|
33459
|
+
popConfirm: {
|
|
33460
|
+
title: "确定删除",
|
|
33461
|
+
confirm: remove.bind(null, record[props2.rowKey])
|
|
33302
33462
|
}
|
|
33303
|
-
},
|
|
33304
|
-
|
|
33305
|
-
|
|
33463
|
+
}, ...props2.tableAction(record)];
|
|
33464
|
+
};
|
|
33465
|
+
const getType = (type) => {
|
|
33466
|
+
switch (type) {
|
|
33467
|
+
case "input":
|
|
33468
|
+
return "Input";
|
|
33469
|
+
case "select":
|
|
33470
|
+
return "Select";
|
|
33471
|
+
case "datePicker":
|
|
33472
|
+
return "DatePicker";
|
|
33473
|
+
case "number":
|
|
33474
|
+
return "InputNumber";
|
|
33475
|
+
default:
|
|
33476
|
+
return type;
|
|
33306
33477
|
}
|
|
33307
|
-
|
|
33478
|
+
};
|
|
33479
|
+
watch(() => state.value, (v, old) => {
|
|
33480
|
+
if (!isEqual(toRaw(v), toRaw(old))) {
|
|
33481
|
+
state.value = toRaw(v).map((ele) => {
|
|
33482
|
+
return {
|
|
33483
|
+
...ele,
|
|
33484
|
+
[props2.rowKey]: ele[props2.rowKey] || buildUUID()
|
|
33485
|
+
};
|
|
33486
|
+
});
|
|
33487
|
+
sourceHeight.value = v.length * ROW_HEIGHT;
|
|
33488
|
+
dataSource.value = v.length > SHOW_ROW_COUNT ? v.slice(curIndex.value, curIndex.value + SHOW_ROW_COUNT) : v.slice(0, SHOW_ROW_COUNT);
|
|
33489
|
+
}
|
|
33490
|
+
}, {
|
|
33491
|
+
deep: true
|
|
33492
|
+
});
|
|
33308
33493
|
const isScroll = ref(false);
|
|
33309
33494
|
const timer = ref();
|
|
33310
33495
|
onMounted(() => {
|
|
33311
|
-
window.addEventListener(
|
|
33312
|
-
|
|
33313
|
-
(
|
|
33314
|
-
|
|
33315
|
-
|
|
33316
|
-
|
|
33317
|
-
|
|
33318
|
-
|
|
33319
|
-
|
|
33320
|
-
|
|
33321
|
-
|
|
33322
|
-
|
|
33323
|
-
|
|
33496
|
+
window.addEventListener("scroll", (e) => {
|
|
33497
|
+
clearTimeout(timer.value);
|
|
33498
|
+
timer.value = setTimeout(() => {
|
|
33499
|
+
isScroll.value = false;
|
|
33500
|
+
}, 500);
|
|
33501
|
+
if (isScroll.value)
|
|
33502
|
+
return;
|
|
33503
|
+
isScroll.value = true;
|
|
33504
|
+
}, true);
|
|
33505
|
+
tableWrapperRef.value.addEventListener("wheel", (e) => {
|
|
33506
|
+
e.preventDefault();
|
|
33507
|
+
if (state.value.length <= SHOW_ROW_COUNT) {
|
|
33508
|
+
return;
|
|
33509
|
+
}
|
|
33510
|
+
if (e.deltaY > 0 && curIndex.value + SHOW_ROW_COUNT < state.value.length) {
|
|
33511
|
+
dataSource.value = state.value.slice(++curIndex.value, curIndex.value + SHOW_ROW_COUNT);
|
|
33512
|
+
}
|
|
33513
|
+
if (e.deltaY < 0 && curIndex.value > 0) {
|
|
33514
|
+
dataSource.value = state.value.slice(--curIndex.value, curIndex.value + SHOW_ROW_COUNT);
|
|
33515
|
+
}
|
|
33516
|
+
document.querySelector(`.${prefixCls2}-scroll-bar-wrapper`).scrollTop = curIndex.value * ROW_HEIGHT;
|
|
33517
|
+
}, true);
|
|
33518
|
+
tableWrapperRef.value.addEventListener("scroll", handleScroll, true);
|
|
33324
33519
|
});
|
|
33325
33520
|
onUnmounted(() => {
|
|
33326
33521
|
window.removeEventListener("scroll", () => {
|
|
33327
33522
|
});
|
|
33328
33523
|
});
|
|
33329
|
-
const
|
|
33330
|
-
|
|
33331
|
-
|
|
33332
|
-
|
|
33333
|
-
|
|
33334
|
-
|
|
33335
|
-
|
|
33336
|
-
|
|
33337
|
-
|
|
33338
|
-
|
|
33339
|
-
|
|
33340
|
-
|
|
33341
|
-
|
|
33342
|
-
|
|
33343
|
-
|
|
33344
|
-
|
|
33345
|
-
|
|
33346
|
-
|
|
33524
|
+
const renderTdProps = (column2) => {
|
|
33525
|
+
switch (column2.align) {
|
|
33526
|
+
case "center":
|
|
33527
|
+
return {
|
|
33528
|
+
textAlign: "center"
|
|
33529
|
+
};
|
|
33530
|
+
case "left":
|
|
33531
|
+
return {
|
|
33532
|
+
textAlign: "left"
|
|
33533
|
+
};
|
|
33534
|
+
case "right":
|
|
33535
|
+
return {
|
|
33536
|
+
textAlign: "right"
|
|
33537
|
+
};
|
|
33538
|
+
default:
|
|
33539
|
+
return {
|
|
33540
|
+
textAlign: "left"
|
|
33541
|
+
};
|
|
33347
33542
|
}
|
|
33348
33543
|
};
|
|
33349
|
-
|
|
33350
|
-
|
|
33351
|
-
|
|
33352
|
-
return
|
|
33353
|
-
|
|
33354
|
-
|
|
33355
|
-
|
|
33356
|
-
|
|
33357
|
-
|
|
33358
|
-
|
|
33359
|
-
|
|
33360
|
-
|
|
33361
|
-
|
|
33362
|
-
|
|
33363
|
-
|
|
33364
|
-
|
|
33365
|
-
align: "center"
|
|
33366
|
-
}, {
|
|
33367
|
-
headerCell: withCtx(({ column: column2 }) => {
|
|
33368
|
-
var _a2;
|
|
33369
|
-
return [
|
|
33370
|
-
column2.required || ((_a2 = column2 == null ? void 0 : column2.rules) == null ? void 0 : _a2.length) ? (openBlock(), createElementBlock("span", _hoisted_1$6, "*")) : createCommentVNode("", true),
|
|
33371
|
-
createElementVNode("span", null, toDisplayString(column2.title), 1)
|
|
33372
|
-
];
|
|
33373
|
-
}),
|
|
33374
|
-
bodyCell: withCtx(({ column: column2, record, index: index2, ...args }) => [
|
|
33375
|
-
column2.dataIndex !== "index" && column2.type !== "text" && column2.dataIndex !== "_action" ? (openBlock(), createBlock(unref(FormItem), {
|
|
33376
|
-
required: column2.required,
|
|
33377
|
-
rules: getRules({ column: column2, record, index: index2, ...args }),
|
|
33378
|
-
name: [_ctx.$attrs.codeField, index2, column2.dataIndex],
|
|
33379
|
-
key: record[__props.rowKey]
|
|
33380
|
-
}, {
|
|
33381
|
-
default: withCtx(() => {
|
|
33382
|
-
var _a2;
|
|
33383
|
-
return [
|
|
33384
|
-
createVNode(unref(Popover), {
|
|
33385
|
-
overlayClassName: "table-children-err-popover",
|
|
33386
|
-
visible: !!((_a2 = rulesRef == null ? void 0 : rulesRef[`${column2.dataIndex}-${record[props2.rowKey]}Info`]) == null ? void 0 : _a2.show) && !isScroll.value
|
|
33387
|
-
}, {
|
|
33388
|
-
content: withCtx(() => {
|
|
33389
|
-
var _a3;
|
|
33390
|
-
return [
|
|
33391
|
-
createElementVNode("span", _hoisted_2$3, toDisplayString((_a3 = rulesRef[`${column2.dataIndex}-${record[props2.rowKey]}Info`]) == null ? void 0 : _a3.msg), 1)
|
|
33392
|
-
];
|
|
33393
|
-
}),
|
|
33394
|
-
default: withCtx(() => [
|
|
33395
|
-
column2.type === "select" ? (openBlock(), createBlock(unref(Select), {
|
|
33396
|
-
key: 0,
|
|
33397
|
-
value: record[column2.dataIndex],
|
|
33398
|
-
"onUpdate:value": ($event) => record[column2.dataIndex] = $event,
|
|
33399
|
-
options: column2.dicData,
|
|
33400
|
-
mode: column2.mode,
|
|
33401
|
-
"max-tag-count": column2.maxTagCount,
|
|
33402
|
-
"max-tag-text-length": column2.maxTagTextLength
|
|
33403
|
-
}, null, 8, ["value", "onUpdate:value", "options", "mode", "max-tag-count", "max-tag-text-length"])) : column2.type === "datePicker" ? (openBlock(), createBlock(unref(DatePicker$1), {
|
|
33404
|
-
key: 1,
|
|
33405
|
-
value: record[column2.dataIndex],
|
|
33406
|
-
"onUpdate:value": ($event) => record[column2.dataIndex] = $event,
|
|
33407
|
-
valueFormat: "YYYY-MM-DD HH:mm:ss"
|
|
33408
|
-
}, null, 8, ["value", "onUpdate:value"])) : column2.type === "number" ? (openBlock(), createBlock(unref(InputNumber), {
|
|
33409
|
-
key: 2,
|
|
33410
|
-
value: record[column2.dataIndex],
|
|
33411
|
-
"onUpdate:value": ($event) => record[column2.dataIndex] = $event,
|
|
33412
|
-
min: column2.min,
|
|
33413
|
-
max: column2.max,
|
|
33414
|
-
precision: column2.precision ?? 2
|
|
33415
|
-
}, null, 8, ["value", "onUpdate:value", "min", "max", "precision"])) : column2.type === "input" ? (openBlock(), createBlock(unref(Input), {
|
|
33416
|
-
key: 3,
|
|
33417
|
-
value: record[column2.dataIndex],
|
|
33418
|
-
"onUpdate:value": ($event) => record[column2.dataIndex] = $event,
|
|
33419
|
-
disabled: !props2.isShowAction
|
|
33420
|
-
}, null, 8, ["value", "onUpdate:value", "disabled"])) : (openBlock(), createBlock(resolveDynamicComponent(unref(ShyComponentMap).get(column2.type)), mergeProps(
|
|
33421
|
-
{
|
|
33422
|
-
key: 4,
|
|
33423
|
-
allowClear: "",
|
|
33424
|
-
getPopupContainer: getPopupContainer2,
|
|
33425
|
-
style: { width: "100%" }
|
|
33426
|
-
},
|
|
33427
|
-
unref(isFunction$4)(column2.componentProps) ? column2.componentProps({ record, column: column2, index: index2, ...args }) : column2.componentProps,
|
|
33428
|
-
{
|
|
33429
|
-
value: record[column2.dataIndex],
|
|
33430
|
-
"onUpdate:value": ($event) => record[column2.dataIndex] = $event
|
|
33431
|
-
}
|
|
33432
|
-
), null, 16, ["value", "onUpdate:value"]))
|
|
33433
|
-
]),
|
|
33434
|
-
_: 2
|
|
33435
|
-
}, 1032, ["visible"])
|
|
33436
|
-
];
|
|
33437
|
-
}),
|
|
33438
|
-
_: 2
|
|
33439
|
-
}, 1032, ["required", "rules", "name"])) : createCommentVNode("", true),
|
|
33440
|
-
column2.dataIndex === "_action" ? (openBlock(), createBlock(unref(ShyTableAction$1), {
|
|
33441
|
-
key: 1,
|
|
33442
|
-
actions: getActions(record)
|
|
33443
|
-
}, null, 8, ["actions"])) : createCommentVNode("", true)
|
|
33444
|
-
]),
|
|
33445
|
-
_: 1
|
|
33446
|
-
}, 8, ["columns", "scroll", "data-source"]),
|
|
33447
|
-
createElementVNode("div", _hoisted_3$2, [
|
|
33448
|
-
createVNode(unref(BasicButton), {
|
|
33449
|
-
onClick: plusClickEvent,
|
|
33450
|
-
type: "dashed"
|
|
33451
|
-
}, {
|
|
33452
|
-
default: withCtx(() => [
|
|
33453
|
-
createTextVNode(" 新增 ")
|
|
33454
|
-
]),
|
|
33455
|
-
_: 1
|
|
33456
|
-
})
|
|
33457
|
-
]),
|
|
33458
|
-
createElementVNode("div", _hoisted_4$2, [
|
|
33459
|
-
(openBlock(), createBlock(resolveDynamicComponent(h("span", null, __props.footerRender()))))
|
|
33460
|
-
])
|
|
33461
|
-
], 64);
|
|
33544
|
+
const renderTd = (cell, {
|
|
33545
|
+
slots
|
|
33546
|
+
}) => {
|
|
33547
|
+
return cell.colSpan === props2.columns.length + 2 ? createVNode("td", cell, [slots.default()]) : slots.default();
|
|
33548
|
+
};
|
|
33549
|
+
return () => {
|
|
33550
|
+
return createVNode(Fragment, null, [renderTable.value, createVNode("div", {
|
|
33551
|
+
"class": `${prefixCls2}-add-btn`
|
|
33552
|
+
}, [createVNode(BasicButton, {
|
|
33553
|
+
"onClick": create,
|
|
33554
|
+
"type": "dashed"
|
|
33555
|
+
}, {
|
|
33556
|
+
default: () => [createTextVNode("新增")]
|
|
33557
|
+
})]), createVNode("div", {
|
|
33558
|
+
"class": `${prefixCls2}-footer`
|
|
33559
|
+
}, [props2.footerRender()])]);
|
|
33462
33560
|
};
|
|
33463
33561
|
}
|
|
33464
33562
|
});
|
|
33465
|
-
const Table_vue_vue_type_style_index_0_scoped_d3bdc269_lang = "";
|
|
33466
|
-
const Table = /* @__PURE__ */ _export_sfc(_sfc_main$d, [["__scopeId", "data-v-d3bdc269"]]);
|
|
33467
33563
|
const ShyComponentMap = /* @__PURE__ */ new Map();
|
|
33468
33564
|
ShyComponentMap.set("Input", Input);
|
|
33469
33565
|
ShyComponentMap.set("InputGroup", Input.Group);
|
|
@@ -33497,7 +33593,7 @@ ShyComponentMap.set("TimePicker", TimePicker$1);
|
|
|
33497
33593
|
ShyComponentMap.set("StrengthMeter", StrengthMeter);
|
|
33498
33594
|
ShyComponentMap.set("IconPicker", _sfc_main$1t);
|
|
33499
33595
|
ShyComponentMap.set("InputCountDown", CountdownInput);
|
|
33500
|
-
ShyComponentMap.set("Table",
|
|
33596
|
+
ShyComponentMap.set("Table", ShyFormTable);
|
|
33501
33597
|
ShyComponentMap.set("Tinymce", _sfc_main$e);
|
|
33502
33598
|
ShyComponentMap.set("Divider", BasicTitle$1);
|
|
33503
33599
|
ShyComponentMap.set("ColorPicker", ColorPickerPanel);
|
|
@@ -33592,7 +33688,7 @@ function useItemLabelWidth(schemaItemRef, propsRef) {
|
|
|
33592
33688
|
function _isSlot$3(s) {
|
|
33593
33689
|
return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
|
|
33594
33690
|
}
|
|
33595
|
-
const _sfc_main$
|
|
33691
|
+
const _sfc_main$d = /* @__PURE__ */ defineComponent({
|
|
33596
33692
|
name: "BasicFormItem",
|
|
33597
33693
|
inheritAttrs: false,
|
|
33598
33694
|
props: {
|
|
@@ -34025,7 +34121,7 @@ function createFormContext(context) {
|
|
|
34025
34121
|
function useFormContext() {
|
|
34026
34122
|
return useContext$2(key$1);
|
|
34027
34123
|
}
|
|
34028
|
-
const _sfc_main$
|
|
34124
|
+
const _sfc_main$c = defineComponent({
|
|
34029
34125
|
name: "BasicFormAction",
|
|
34030
34126
|
components: {
|
|
34031
34127
|
FormItem: Form.Item,
|
|
@@ -34162,7 +34258,7 @@ function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
34162
34258
|
})
|
|
34163
34259
|
], 6);
|
|
34164
34260
|
}
|
|
34165
|
-
const FormAction = /* @__PURE__ */ _export_sfc(_sfc_main$
|
|
34261
|
+
const FormAction = /* @__PURE__ */ _export_sfc(_sfc_main$c, [["render", _sfc_render$3]]);
|
|
34166
34262
|
function tryDeconstructArray(key2, value, target) {
|
|
34167
34263
|
const pattern = /^\[(.+)\]$/;
|
|
34168
34264
|
if (pattern.test(key2)) {
|
|
@@ -34605,7 +34701,7 @@ const basicProps = {
|
|
|
34605
34701
|
},
|
|
34606
34702
|
size: {
|
|
34607
34703
|
type: String,
|
|
34608
|
-
default:
|
|
34704
|
+
default: void 0
|
|
34609
34705
|
},
|
|
34610
34706
|
// // 禁用表单
|
|
34611
34707
|
disabled: {
|
|
@@ -35016,7 +35112,7 @@ const ShyForm = /* @__PURE__ */ defineComponent({
|
|
|
35016
35112
|
};
|
|
35017
35113
|
const renderItem = (schema) => {
|
|
35018
35114
|
var _a2, _b, _c;
|
|
35019
|
-
return createVNode(_sfc_main$
|
|
35115
|
+
return createVNode(_sfc_main$d, {
|
|
35020
35116
|
"tableAction": props2.tableAction,
|
|
35021
35117
|
"formActionType": formActionType,
|
|
35022
35118
|
"schema": schema,
|
|
@@ -35205,6 +35301,356 @@ function useShyForm(props2) {
|
|
|
35205
35301
|
};
|
|
35206
35302
|
return [register, methods2];
|
|
35207
35303
|
}
|
|
35304
|
+
const _hoisted_1$6 = {
|
|
35305
|
+
key: 0,
|
|
35306
|
+
class: "table-children-required"
|
|
35307
|
+
};
|
|
35308
|
+
const _hoisted_2$3 = { class: "text-red-500" };
|
|
35309
|
+
const _hoisted_3$2 = { class: "table-children-add-btn" };
|
|
35310
|
+
const _hoisted_4$2 = { class: "w-full h-[fit-content] py-8px flex justify-end items-center" };
|
|
35311
|
+
const _sfc_main$b = /* @__PURE__ */ defineComponent({
|
|
35312
|
+
__name: "Table",
|
|
35313
|
+
props: {
|
|
35314
|
+
rowKey: {
|
|
35315
|
+
type: String,
|
|
35316
|
+
default: () => "uuid"
|
|
35317
|
+
},
|
|
35318
|
+
columns: {
|
|
35319
|
+
type: Array,
|
|
35320
|
+
default: () => []
|
|
35321
|
+
},
|
|
35322
|
+
value: {
|
|
35323
|
+
type: Array,
|
|
35324
|
+
default: () => []
|
|
35325
|
+
},
|
|
35326
|
+
isShowFooter: {
|
|
35327
|
+
type: Boolean,
|
|
35328
|
+
default: () => false
|
|
35329
|
+
},
|
|
35330
|
+
footerRender: {
|
|
35331
|
+
type: Function,
|
|
35332
|
+
default: () => ""
|
|
35333
|
+
},
|
|
35334
|
+
isShowAction: {
|
|
35335
|
+
type: Boolean,
|
|
35336
|
+
default: () => true
|
|
35337
|
+
},
|
|
35338
|
+
tableAction: {
|
|
35339
|
+
type: Function,
|
|
35340
|
+
default: (res) => {
|
|
35341
|
+
return [];
|
|
35342
|
+
}
|
|
35343
|
+
}
|
|
35344
|
+
},
|
|
35345
|
+
emits: ["update:value", "change", "add", "remove"],
|
|
35346
|
+
setup(__props, { expose: __expose, emit: __emit }) {
|
|
35347
|
+
const formActionType = inject("formActionType");
|
|
35348
|
+
const emit = __emit;
|
|
35349
|
+
const props2 = __props;
|
|
35350
|
+
const tableElRef = ref();
|
|
35351
|
+
const emitData = ref([]);
|
|
35352
|
+
const [state] = useRuleFormItem(props2, "value", "change", emitData);
|
|
35353
|
+
const getColumns = computed(() => {
|
|
35354
|
+
const indexColumn = {
|
|
35355
|
+
title: "序号",
|
|
35356
|
+
dataIndex: "index",
|
|
35357
|
+
customRender: ({ index: index2 }) => {
|
|
35358
|
+
return `${index2 + 1}`;
|
|
35359
|
+
},
|
|
35360
|
+
width: 50,
|
|
35361
|
+
align: "center"
|
|
35362
|
+
};
|
|
35363
|
+
const actionColumn = {
|
|
35364
|
+
title: "操作",
|
|
35365
|
+
dataIndex: "_action",
|
|
35366
|
+
width: 80,
|
|
35367
|
+
align: "center"
|
|
35368
|
+
};
|
|
35369
|
+
return [
|
|
35370
|
+
indexColumn,
|
|
35371
|
+
...props2.columns.map((item) => ({
|
|
35372
|
+
...item,
|
|
35373
|
+
type: item.type ? item.type : "input"
|
|
35374
|
+
})),
|
|
35375
|
+
...(props2 == null ? void 0 : props2.isShowAction) ? [actionColumn] : []
|
|
35376
|
+
];
|
|
35377
|
+
});
|
|
35378
|
+
const getScrollX = computed(() => {
|
|
35379
|
+
var _a2;
|
|
35380
|
+
let width = 0;
|
|
35381
|
+
const NORMAL_WIDTH = 150;
|
|
35382
|
+
const columns = unref(props2.columns).filter((item) => !item.defaultHidden);
|
|
35383
|
+
columns.forEach((item) => {
|
|
35384
|
+
width += Number.parseFloat(item.width) || 0;
|
|
35385
|
+
});
|
|
35386
|
+
const unsetWidthColumns = columns.filter(
|
|
35387
|
+
(item) => !Reflect.has(item, "width")
|
|
35388
|
+
);
|
|
35389
|
+
const len = unsetWidthColumns.length;
|
|
35390
|
+
if (len !== 0) {
|
|
35391
|
+
width += len * NORMAL_WIDTH;
|
|
35392
|
+
}
|
|
35393
|
+
const table2 = unref(tableElRef);
|
|
35394
|
+
const tableWidth = ((_a2 = table2 == null ? void 0 : table2.$el) == null ? void 0 : _a2.offsetWidth) ?? 0;
|
|
35395
|
+
return tableWidth > width ? "100%" : width;
|
|
35396
|
+
});
|
|
35397
|
+
const plusClickEvent = () => {
|
|
35398
|
+
state.value = [{ [props2.rowKey]: buildUUID() }, ...toRaw(state.value)];
|
|
35399
|
+
emit("add", state.value);
|
|
35400
|
+
};
|
|
35401
|
+
const rowClickEvent = (index2) => {
|
|
35402
|
+
const tempState = state.value.filter((item) => {
|
|
35403
|
+
return item[props2.rowKey] !== index2;
|
|
35404
|
+
});
|
|
35405
|
+
tempState.forEach((item) => item[props2.rowKey] = buildUUID());
|
|
35406
|
+
state.value = [...tempState];
|
|
35407
|
+
emit("remove", state.value, index2);
|
|
35408
|
+
};
|
|
35409
|
+
const getPopupContainer2 = () => document.body;
|
|
35410
|
+
const rulesRef = reactive({});
|
|
35411
|
+
const getRules = ({ column: column2, record, index: index2, ...args }) => {
|
|
35412
|
+
var _a2, _b;
|
|
35413
|
+
const errKey = `${column2.dataIndex}-${record[props2.rowKey]}Info`;
|
|
35414
|
+
if (!column2.required)
|
|
35415
|
+
return [];
|
|
35416
|
+
if ((_a2 = rulesRef[errKey]) == null ? void 0 : _a2.rules)
|
|
35417
|
+
return (_b = rulesRef[errKey]) == null ? void 0 : _b.rules;
|
|
35418
|
+
rulesRef[errKey] = {
|
|
35419
|
+
rules: [],
|
|
35420
|
+
show: false,
|
|
35421
|
+
msg: ""
|
|
35422
|
+
};
|
|
35423
|
+
if (!column2.rules && column2.required) {
|
|
35424
|
+
rulesRef[errKey].rules = [
|
|
35425
|
+
{
|
|
35426
|
+
required: true,
|
|
35427
|
+
validator: (rule, value) => {
|
|
35428
|
+
const prefix = column2.type.toLocaleLowerCase().includes("input") ? "请输入" : "请选择";
|
|
35429
|
+
const errMsg = `${prefix}${column2.title}`;
|
|
35430
|
+
if (value) {
|
|
35431
|
+
rulesRef[errKey].show = false;
|
|
35432
|
+
return Promise.resolve();
|
|
35433
|
+
}
|
|
35434
|
+
rulesRef[errKey].show = true;
|
|
35435
|
+
rulesRef[errKey].msg = errMsg;
|
|
35436
|
+
return Promise.reject(errMsg);
|
|
35437
|
+
}
|
|
35438
|
+
}
|
|
35439
|
+
];
|
|
35440
|
+
return rulesRef[errKey].rules;
|
|
35441
|
+
}
|
|
35442
|
+
if (!isArray$3(column2.rules))
|
|
35443
|
+
return column2.rules;
|
|
35444
|
+
rulesRef[errKey].rules = cloneDeep(column2.rules);
|
|
35445
|
+
rulesRef[errKey].rules.forEach((item) => {
|
|
35446
|
+
if (!item.validator || !isFunction$4(item.validator))
|
|
35447
|
+
return;
|
|
35448
|
+
const validator = item.validator;
|
|
35449
|
+
item.validator = async (rule, value) => {
|
|
35450
|
+
try {
|
|
35451
|
+
rulesRef[errKey].show = false;
|
|
35452
|
+
return await validator(
|
|
35453
|
+
rule,
|
|
35454
|
+
value,
|
|
35455
|
+
{ column: column2, record, ...args },
|
|
35456
|
+
formActionType
|
|
35457
|
+
);
|
|
35458
|
+
} catch (error2) {
|
|
35459
|
+
rulesRef[errKey].show = true;
|
|
35460
|
+
rulesRef[errKey].msg = error2;
|
|
35461
|
+
return Promise.reject(error2);
|
|
35462
|
+
}
|
|
35463
|
+
};
|
|
35464
|
+
});
|
|
35465
|
+
return rulesRef[errKey].rules;
|
|
35466
|
+
};
|
|
35467
|
+
const getActions = (record) => {
|
|
35468
|
+
return [
|
|
35469
|
+
{
|
|
35470
|
+
label: "删除",
|
|
35471
|
+
popConfirm: {
|
|
35472
|
+
title: "确定删除",
|
|
35473
|
+
confirm: rowClickEvent.bind(null, record[props2.rowKey])
|
|
35474
|
+
}
|
|
35475
|
+
},
|
|
35476
|
+
...props2.tableAction(record)
|
|
35477
|
+
];
|
|
35478
|
+
};
|
|
35479
|
+
watch(
|
|
35480
|
+
() => state.value,
|
|
35481
|
+
(v, old) => {
|
|
35482
|
+
if (!isEqual(toRaw(v), toRaw(old))) {
|
|
35483
|
+
state.value = toRaw(v).map((ele) => {
|
|
35484
|
+
return {
|
|
35485
|
+
...ele,
|
|
35486
|
+
[props2.rowKey]: ele[props2.rowKey] || buildUUID()
|
|
35487
|
+
};
|
|
35488
|
+
});
|
|
35489
|
+
}
|
|
35490
|
+
},
|
|
35491
|
+
{
|
|
35492
|
+
deep: true
|
|
35493
|
+
}
|
|
35494
|
+
);
|
|
35495
|
+
const isScroll = ref(false);
|
|
35496
|
+
const timer = ref();
|
|
35497
|
+
onMounted(() => {
|
|
35498
|
+
window.addEventListener(
|
|
35499
|
+
"scroll",
|
|
35500
|
+
(e) => {
|
|
35501
|
+
clearTimeout(timer.value);
|
|
35502
|
+
timer.value = setTimeout(() => {
|
|
35503
|
+
isScroll.value = false;
|
|
35504
|
+
}, 500);
|
|
35505
|
+
if (isScroll.value)
|
|
35506
|
+
return;
|
|
35507
|
+
isScroll.value = true;
|
|
35508
|
+
},
|
|
35509
|
+
true
|
|
35510
|
+
);
|
|
35511
|
+
});
|
|
35512
|
+
onUnmounted(() => {
|
|
35513
|
+
window.removeEventListener("scroll", () => {
|
|
35514
|
+
});
|
|
35515
|
+
});
|
|
35516
|
+
const loadKv = () => {
|
|
35517
|
+
const columns = props2.columns;
|
|
35518
|
+
let dicData = [];
|
|
35519
|
+
columns.forEach(async (column2) => {
|
|
35520
|
+
if (column2 == null ? void 0 : column2.api) {
|
|
35521
|
+
dicData = await column2.api();
|
|
35522
|
+
column2.dicData = dicData;
|
|
35523
|
+
}
|
|
35524
|
+
});
|
|
35525
|
+
};
|
|
35526
|
+
const listFormRefs = ref([]);
|
|
35527
|
+
const validate = async () => {
|
|
35528
|
+
try {
|
|
35529
|
+
for (let formRef of listFormRefs.value) {
|
|
35530
|
+
await formRef.validate();
|
|
35531
|
+
}
|
|
35532
|
+
} catch {
|
|
35533
|
+
throw new Error("校验失败");
|
|
35534
|
+
}
|
|
35535
|
+
};
|
|
35536
|
+
loadKv();
|
|
35537
|
+
__expose({ validate });
|
|
35538
|
+
return (_ctx, _cache) => {
|
|
35539
|
+
return openBlock(), createElementBlock(Fragment, null, [
|
|
35540
|
+
createVNode(unref(Table$2), {
|
|
35541
|
+
ref_key: "tableElRef",
|
|
35542
|
+
ref: tableElRef,
|
|
35543
|
+
columns: getColumns.value,
|
|
35544
|
+
scroll: {
|
|
35545
|
+
x: getScrollX.value
|
|
35546
|
+
},
|
|
35547
|
+
"data-source": unref(state),
|
|
35548
|
+
pagination: false,
|
|
35549
|
+
bordered: "",
|
|
35550
|
+
size: "small",
|
|
35551
|
+
class: "table-children",
|
|
35552
|
+
align: "center"
|
|
35553
|
+
}, {
|
|
35554
|
+
headerCell: withCtx(({ column: column2 }) => {
|
|
35555
|
+
var _a2;
|
|
35556
|
+
return [
|
|
35557
|
+
column2.required || ((_a2 = column2 == null ? void 0 : column2.rules) == null ? void 0 : _a2.length) ? (openBlock(), createElementBlock("span", _hoisted_1$6, "*")) : createCommentVNode("", true),
|
|
35558
|
+
createElementVNode("span", null, toDisplayString(column2.title), 1)
|
|
35559
|
+
];
|
|
35560
|
+
}),
|
|
35561
|
+
bodyCell: withCtx(({ column: column2, record, index: index2, ...args }) => [
|
|
35562
|
+
column2.dataIndex !== "index" && column2.type !== "text" && column2.dataIndex !== "_action" ? (openBlock(), createBlock(unref(FormItem), {
|
|
35563
|
+
required: column2.required,
|
|
35564
|
+
rules: getRules({ column: column2, record, index: index2, ...args }),
|
|
35565
|
+
name: [_ctx.$attrs.codeField, index2, column2.dataIndex],
|
|
35566
|
+
key: record[__props.rowKey]
|
|
35567
|
+
}, {
|
|
35568
|
+
default: withCtx(() => {
|
|
35569
|
+
var _a2;
|
|
35570
|
+
return [
|
|
35571
|
+
createVNode(unref(Popover), {
|
|
35572
|
+
overlayClassName: "table-children-err-popover",
|
|
35573
|
+
visible: !!((_a2 = rulesRef == null ? void 0 : rulesRef[`${column2.dataIndex}-${record[props2.rowKey]}Info`]) == null ? void 0 : _a2.show) && !isScroll.value
|
|
35574
|
+
}, {
|
|
35575
|
+
content: withCtx(() => {
|
|
35576
|
+
var _a3;
|
|
35577
|
+
return [
|
|
35578
|
+
createElementVNode("span", _hoisted_2$3, toDisplayString((_a3 = rulesRef[`${column2.dataIndex}-${record[props2.rowKey]}Info`]) == null ? void 0 : _a3.msg), 1)
|
|
35579
|
+
];
|
|
35580
|
+
}),
|
|
35581
|
+
default: withCtx(() => [
|
|
35582
|
+
column2.type === "select" ? (openBlock(), createBlock(unref(Select), {
|
|
35583
|
+
key: 0,
|
|
35584
|
+
value: record[column2.dataIndex],
|
|
35585
|
+
"onUpdate:value": ($event) => record[column2.dataIndex] = $event,
|
|
35586
|
+
options: column2.dicData,
|
|
35587
|
+
mode: column2.mode,
|
|
35588
|
+
"max-tag-count": column2.maxTagCount,
|
|
35589
|
+
"max-tag-text-length": column2.maxTagTextLength
|
|
35590
|
+
}, null, 8, ["value", "onUpdate:value", "options", "mode", "max-tag-count", "max-tag-text-length"])) : column2.type === "datePicker" ? (openBlock(), createBlock(unref(DatePicker$1), {
|
|
35591
|
+
key: 1,
|
|
35592
|
+
value: record[column2.dataIndex],
|
|
35593
|
+
"onUpdate:value": ($event) => record[column2.dataIndex] = $event,
|
|
35594
|
+
valueFormat: "YYYY-MM-DD HH:mm:ss"
|
|
35595
|
+
}, null, 8, ["value", "onUpdate:value"])) : column2.type === "number" ? (openBlock(), createBlock(unref(InputNumber), {
|
|
35596
|
+
key: 2,
|
|
35597
|
+
value: record[column2.dataIndex],
|
|
35598
|
+
"onUpdate:value": ($event) => record[column2.dataIndex] = $event,
|
|
35599
|
+
min: column2.min,
|
|
35600
|
+
max: column2.max,
|
|
35601
|
+
precision: column2.precision ?? 2
|
|
35602
|
+
}, null, 8, ["value", "onUpdate:value", "min", "max", "precision"])) : column2.type === "input" ? (openBlock(), createBlock(unref(Input), {
|
|
35603
|
+
key: 3,
|
|
35604
|
+
value: record[column2.dataIndex],
|
|
35605
|
+
"onUpdate:value": ($event) => record[column2.dataIndex] = $event,
|
|
35606
|
+
disabled: !props2.isShowAction
|
|
35607
|
+
}, null, 8, ["value", "onUpdate:value", "disabled"])) : (openBlock(), createBlock(resolveDynamicComponent(unref(ShyComponentMap).get(column2.type)), mergeProps(
|
|
35608
|
+
{
|
|
35609
|
+
key: 4,
|
|
35610
|
+
allowClear: "",
|
|
35611
|
+
getPopupContainer: getPopupContainer2,
|
|
35612
|
+
style: { width: "100%" }
|
|
35613
|
+
},
|
|
35614
|
+
unref(isFunction$4)(column2.componentProps) ? column2.componentProps({ record, column: column2, index: index2, ...args }) : column2.componentProps,
|
|
35615
|
+
{
|
|
35616
|
+
value: record[column2.dataIndex],
|
|
35617
|
+
"onUpdate:value": ($event) => record[column2.dataIndex] = $event
|
|
35618
|
+
}
|
|
35619
|
+
), null, 16, ["value", "onUpdate:value"]))
|
|
35620
|
+
]),
|
|
35621
|
+
_: 2
|
|
35622
|
+
}, 1032, ["visible"])
|
|
35623
|
+
];
|
|
35624
|
+
}),
|
|
35625
|
+
_: 2
|
|
35626
|
+
}, 1032, ["required", "rules", "name"])) : createCommentVNode("", true),
|
|
35627
|
+
column2.dataIndex === "_action" ? (openBlock(), createBlock(unref(ShyTableAction), {
|
|
35628
|
+
key: 1,
|
|
35629
|
+
actions: getActions(record)
|
|
35630
|
+
}, null, 8, ["actions"])) : createCommentVNode("", true)
|
|
35631
|
+
]),
|
|
35632
|
+
_: 1
|
|
35633
|
+
}, 8, ["columns", "scroll", "data-source"]),
|
|
35634
|
+
createElementVNode("div", _hoisted_3$2, [
|
|
35635
|
+
createVNode(unref(BasicButton), {
|
|
35636
|
+
onClick: plusClickEvent,
|
|
35637
|
+
type: "dashed"
|
|
35638
|
+
}, {
|
|
35639
|
+
default: withCtx(() => [
|
|
35640
|
+
createTextVNode(" 新增 ")
|
|
35641
|
+
]),
|
|
35642
|
+
_: 1
|
|
35643
|
+
})
|
|
35644
|
+
]),
|
|
35645
|
+
createElementVNode("div", _hoisted_4$2, [
|
|
35646
|
+
(openBlock(), createBlock(resolveDynamicComponent(h("span", null, __props.footerRender()))))
|
|
35647
|
+
])
|
|
35648
|
+
], 64);
|
|
35649
|
+
};
|
|
35650
|
+
}
|
|
35651
|
+
});
|
|
35652
|
+
const Table_vue_vue_type_style_index_0_scoped_d3bdc269_lang = "";
|
|
35653
|
+
const Table = /* @__PURE__ */ _export_sfc(_sfc_main$b, [["__scopeId", "data-v-d3bdc269"]]);
|
|
35208
35654
|
const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
35209
35655
|
__name: "DeptTree",
|
|
35210
35656
|
props: {
|
|
@@ -39286,7 +39732,6 @@ const ShyTableAction = /* @__PURE__ */ defineComponent({
|
|
|
39286
39732
|
};
|
|
39287
39733
|
}
|
|
39288
39734
|
});
|
|
39289
|
-
const ShyTableAction$1 = ShyTableAction;
|
|
39290
39735
|
function useShyTable(tableProps) {
|
|
39291
39736
|
const tableRef = ref(null);
|
|
39292
39737
|
const loadedRef = ref(false);
|
|
@@ -39642,8 +40087,7 @@ const _hoisted_4 = {
|
|
|
39642
40087
|
class: "process-item"
|
|
39643
40088
|
};
|
|
39644
40089
|
const _hoisted_5 = { key: 0 };
|
|
39645
|
-
const _hoisted_6 = { key:
|
|
39646
|
-
const _hoisted_7 = { key: 2 };
|
|
40090
|
+
const _hoisted_6 = { key: 2 };
|
|
39647
40091
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
39648
40092
|
__name: "Process",
|
|
39649
40093
|
props: {
|
|
@@ -39732,9 +40176,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
39732
40176
|
return openBlock(), createElementBlock(Fragment, { key: _cIndex }, [
|
|
39733
40177
|
item[key2] ? (openBlock(), createElementBlock("div", _hoisted_4, [
|
|
39734
40178
|
label ? (openBlock(), createElementBlock("span", _hoisted_5, toDisplayString(label) + ":", 1)) : createCommentVNode("", true),
|
|
39735
|
-
customRender ? (openBlock(), createElementBlock("span", _hoisted_6, [
|
|
39736
|
-
(openBlock(), createBlock(resolveDynamicComponent(h("span", null, customRender(item)))))
|
|
39737
|
-
])) : (openBlock(), createElementBlock("span", _hoisted_7, toDisplayString(item[key2]), 1))
|
|
40179
|
+
customRender ? (openBlock(), createBlock(resolveDynamicComponent(h("span", null, customRender(item))), { key: 1 })) : (openBlock(), createElementBlock("span", _hoisted_6, toDisplayString(item[key2]), 1))
|
|
39738
40180
|
])) : createCommentVNode("", true)
|
|
39739
40181
|
], 64);
|
|
39740
40182
|
}), 128))
|
|
@@ -39750,8 +40192,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
39750
40192
|
};
|
|
39751
40193
|
}
|
|
39752
40194
|
});
|
|
39753
|
-
const
|
|
39754
|
-
const Process = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-
|
|
40195
|
+
const Process_vue_vue_type_style_index_0_scoped_95c7693b_lang = "";
|
|
40196
|
+
const Process = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-95c7693b"]]);
|
|
39755
40197
|
export {
|
|
39756
40198
|
_sfc_main$T as AdvancedSearch,
|
|
39757
40199
|
ApiCascader$1 as ApiCascader,
|
|
@@ -39810,11 +40252,11 @@ export {
|
|
|
39810
40252
|
ShyComponentMap,
|
|
39811
40253
|
ShyContainer,
|
|
39812
40254
|
ShyForm,
|
|
39813
|
-
_sfc_main$
|
|
40255
|
+
_sfc_main$d as ShyFormItem,
|
|
39814
40256
|
_sfc_main$6 as ShyFormWrapper,
|
|
39815
40257
|
RadioButtonGroup as ShyRadioButtonGroup,
|
|
39816
40258
|
ShyTable,
|
|
39817
|
-
ShyTableAction
|
|
40259
|
+
ShyTableAction,
|
|
39818
40260
|
Table as ShyTableChildren,
|
|
39819
40261
|
StrengthMeter,
|
|
39820
40262
|
SvgIcon,
|