3h1-ui 3.0.0-next.72 → 3.0.0-next.74
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 +686 -245
- package/es/style.css +98 -29
- package/lib/index.js +686 -245
- package/package.json +3 -3
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,111 @@ 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
|
+
if (state.value.length <= SHOW_ROW_COUNT) {
|
|
33507
|
+
return;
|
|
33508
|
+
}
|
|
33509
|
+
if (e.deltaY > 0 && curIndex.value + SHOW_ROW_COUNT < state.value.length) {
|
|
33510
|
+
dataSource.value = state.value.slice(++curIndex.value, curIndex.value + SHOW_ROW_COUNT);
|
|
33511
|
+
}
|
|
33512
|
+
if (e.deltaY < 0 && curIndex.value > 0) {
|
|
33513
|
+
dataSource.value = state.value.slice(--curIndex.value, curIndex.value + SHOW_ROW_COUNT);
|
|
33514
|
+
}
|
|
33515
|
+
document.querySelector(`.${prefixCls2}-scroll-bar-wrapper`).scrollTop = curIndex.value * ROW_HEIGHT;
|
|
33516
|
+
}, true);
|
|
33517
|
+
tableWrapperRef.value.addEventListener("scroll", handleScroll, true);
|
|
33324
33518
|
});
|
|
33325
33519
|
onUnmounted(() => {
|
|
33326
33520
|
window.removeEventListener("scroll", () => {
|
|
33327
33521
|
});
|
|
33328
33522
|
});
|
|
33329
|
-
const
|
|
33330
|
-
|
|
33331
|
-
|
|
33332
|
-
|
|
33333
|
-
|
|
33334
|
-
|
|
33335
|
-
|
|
33336
|
-
|
|
33337
|
-
|
|
33338
|
-
|
|
33339
|
-
|
|
33340
|
-
|
|
33341
|
-
|
|
33342
|
-
|
|
33343
|
-
|
|
33344
|
-
|
|
33345
|
-
|
|
33346
|
-
|
|
33523
|
+
const renderTdProps = (column2) => {
|
|
33524
|
+
switch (column2.align) {
|
|
33525
|
+
case "center":
|
|
33526
|
+
return {
|
|
33527
|
+
textAlign: "center"
|
|
33528
|
+
};
|
|
33529
|
+
case "left":
|
|
33530
|
+
return {
|
|
33531
|
+
textAlign: "left"
|
|
33532
|
+
};
|
|
33533
|
+
case "right":
|
|
33534
|
+
return {
|
|
33535
|
+
textAlign: "right"
|
|
33536
|
+
};
|
|
33537
|
+
default:
|
|
33538
|
+
return {
|
|
33539
|
+
textAlign: "left"
|
|
33540
|
+
};
|
|
33347
33541
|
}
|
|
33348
33542
|
};
|
|
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);
|
|
33543
|
+
const renderTd = (cell, {
|
|
33544
|
+
slots
|
|
33545
|
+
}) => {
|
|
33546
|
+
return cell.colSpan === props2.columns.length + 2 ? createVNode("td", cell, [slots.default()]) : slots.default();
|
|
33547
|
+
};
|
|
33548
|
+
return () => {
|
|
33549
|
+
return createVNode(Fragment, null, [renderTable.value, createVNode("div", {
|
|
33550
|
+
"class": `${prefixCls2}-add-btn`
|
|
33551
|
+
}, [createVNode(BasicButton, {
|
|
33552
|
+
"onClick": create,
|
|
33553
|
+
"type": "dashed"
|
|
33554
|
+
}, {
|
|
33555
|
+
default: () => [createTextVNode("新增")]
|
|
33556
|
+
})]), createVNode("div", {
|
|
33557
|
+
"class": `${prefixCls2}-footer`
|
|
33558
|
+
}, [props2.footerRender()])]);
|
|
33462
33559
|
};
|
|
33463
33560
|
}
|
|
33464
33561
|
});
|
|
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
33562
|
const ShyComponentMap = /* @__PURE__ */ new Map();
|
|
33468
33563
|
ShyComponentMap.set("Input", Input);
|
|
33469
33564
|
ShyComponentMap.set("InputGroup", Input.Group);
|
|
@@ -33497,7 +33592,7 @@ ShyComponentMap.set("TimePicker", TimePicker$1);
|
|
|
33497
33592
|
ShyComponentMap.set("StrengthMeter", StrengthMeter);
|
|
33498
33593
|
ShyComponentMap.set("IconPicker", _sfc_main$1t);
|
|
33499
33594
|
ShyComponentMap.set("InputCountDown", CountdownInput);
|
|
33500
|
-
ShyComponentMap.set("Table",
|
|
33595
|
+
ShyComponentMap.set("Table", ShyFormTable);
|
|
33501
33596
|
ShyComponentMap.set("Tinymce", _sfc_main$e);
|
|
33502
33597
|
ShyComponentMap.set("Divider", BasicTitle$1);
|
|
33503
33598
|
ShyComponentMap.set("ColorPicker", ColorPickerPanel);
|
|
@@ -33592,7 +33687,7 @@ function useItemLabelWidth(schemaItemRef, propsRef) {
|
|
|
33592
33687
|
function _isSlot$3(s) {
|
|
33593
33688
|
return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
|
|
33594
33689
|
}
|
|
33595
|
-
const _sfc_main$
|
|
33690
|
+
const _sfc_main$d = /* @__PURE__ */ defineComponent({
|
|
33596
33691
|
name: "BasicFormItem",
|
|
33597
33692
|
inheritAttrs: false,
|
|
33598
33693
|
props: {
|
|
@@ -34025,7 +34120,7 @@ function createFormContext(context) {
|
|
|
34025
34120
|
function useFormContext() {
|
|
34026
34121
|
return useContext$2(key$1);
|
|
34027
34122
|
}
|
|
34028
|
-
const _sfc_main$
|
|
34123
|
+
const _sfc_main$c = defineComponent({
|
|
34029
34124
|
name: "BasicFormAction",
|
|
34030
34125
|
components: {
|
|
34031
34126
|
FormItem: Form.Item,
|
|
@@ -34162,7 +34257,7 @@ function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
34162
34257
|
})
|
|
34163
34258
|
], 6);
|
|
34164
34259
|
}
|
|
34165
|
-
const FormAction = /* @__PURE__ */ _export_sfc(_sfc_main$
|
|
34260
|
+
const FormAction = /* @__PURE__ */ _export_sfc(_sfc_main$c, [["render", _sfc_render$3]]);
|
|
34166
34261
|
function tryDeconstructArray(key2, value, target) {
|
|
34167
34262
|
const pattern = /^\[(.+)\]$/;
|
|
34168
34263
|
if (pattern.test(key2)) {
|
|
@@ -34605,7 +34700,7 @@ const basicProps = {
|
|
|
34605
34700
|
},
|
|
34606
34701
|
size: {
|
|
34607
34702
|
type: String,
|
|
34608
|
-
default:
|
|
34703
|
+
default: void 0
|
|
34609
34704
|
},
|
|
34610
34705
|
// // 禁用表单
|
|
34611
34706
|
disabled: {
|
|
@@ -35015,8 +35110,8 @@ const ShyForm = /* @__PURE__ */ defineComponent({
|
|
|
35015
35110
|
}) : null;
|
|
35016
35111
|
};
|
|
35017
35112
|
const renderItem = (schema) => {
|
|
35018
|
-
var _a2;
|
|
35019
|
-
return createVNode(_sfc_main$
|
|
35113
|
+
var _a2, _b, _c;
|
|
35114
|
+
return createVNode(_sfc_main$d, {
|
|
35020
35115
|
"tableAction": props2.tableAction,
|
|
35021
35116
|
"formActionType": formActionType,
|
|
35022
35117
|
"schema": schema,
|
|
@@ -35029,7 +35124,7 @@ const ShyForm = /* @__PURE__ */ defineComponent({
|
|
|
35029
35124
|
[`${prefixCls2}-table-form-item`]: isTableForm.value
|
|
35030
35125
|
},
|
|
35031
35126
|
"style": {
|
|
35032
|
-
[`--col-span`]: `${(((_a2 = schema.colProps) == null ? void 0 : _a2.span) ?? getBindValue.value.baseColProps.span) / (ROW_SLICE + ACTION_COL) * 100}%`
|
|
35127
|
+
[`--col-span`]: `${(((_a2 = schema.colProps) == null ? void 0 : _a2.span) ?? ((_c = (_b = getBindValue.value) == null ? void 0 : _b.baseColProps) == null ? void 0 : _c.span)) / (ROW_SLICE + ACTION_COL) * 100}%`
|
|
35033
35128
|
}
|
|
35034
35129
|
}, {
|
|
35035
35130
|
...Object.keys(omit$1(slots, ignoreKeys)).reduce((pre, cur) => {
|
|
@@ -35205,6 +35300,356 @@ function useShyForm(props2) {
|
|
|
35205
35300
|
};
|
|
35206
35301
|
return [register, methods2];
|
|
35207
35302
|
}
|
|
35303
|
+
const _hoisted_1$6 = {
|
|
35304
|
+
key: 0,
|
|
35305
|
+
class: "table-children-required"
|
|
35306
|
+
};
|
|
35307
|
+
const _hoisted_2$3 = { class: "text-red-500" };
|
|
35308
|
+
const _hoisted_3$2 = { class: "table-children-add-btn" };
|
|
35309
|
+
const _hoisted_4$2 = { class: "w-full h-[fit-content] py-8px flex justify-end items-center" };
|
|
35310
|
+
const _sfc_main$b = /* @__PURE__ */ defineComponent({
|
|
35311
|
+
__name: "Table",
|
|
35312
|
+
props: {
|
|
35313
|
+
rowKey: {
|
|
35314
|
+
type: String,
|
|
35315
|
+
default: () => "uuid"
|
|
35316
|
+
},
|
|
35317
|
+
columns: {
|
|
35318
|
+
type: Array,
|
|
35319
|
+
default: () => []
|
|
35320
|
+
},
|
|
35321
|
+
value: {
|
|
35322
|
+
type: Array,
|
|
35323
|
+
default: () => []
|
|
35324
|
+
},
|
|
35325
|
+
isShowFooter: {
|
|
35326
|
+
type: Boolean,
|
|
35327
|
+
default: () => false
|
|
35328
|
+
},
|
|
35329
|
+
footerRender: {
|
|
35330
|
+
type: Function,
|
|
35331
|
+
default: () => ""
|
|
35332
|
+
},
|
|
35333
|
+
isShowAction: {
|
|
35334
|
+
type: Boolean,
|
|
35335
|
+
default: () => true
|
|
35336
|
+
},
|
|
35337
|
+
tableAction: {
|
|
35338
|
+
type: Function,
|
|
35339
|
+
default: (res) => {
|
|
35340
|
+
return [];
|
|
35341
|
+
}
|
|
35342
|
+
}
|
|
35343
|
+
},
|
|
35344
|
+
emits: ["update:value", "change", "add", "remove"],
|
|
35345
|
+
setup(__props, { expose: __expose, emit: __emit }) {
|
|
35346
|
+
const formActionType = inject("formActionType");
|
|
35347
|
+
const emit = __emit;
|
|
35348
|
+
const props2 = __props;
|
|
35349
|
+
const tableElRef = ref();
|
|
35350
|
+
const emitData = ref([]);
|
|
35351
|
+
const [state] = useRuleFormItem(props2, "value", "change", emitData);
|
|
35352
|
+
const getColumns = computed(() => {
|
|
35353
|
+
const indexColumn = {
|
|
35354
|
+
title: "序号",
|
|
35355
|
+
dataIndex: "index",
|
|
35356
|
+
customRender: ({ index: index2 }) => {
|
|
35357
|
+
return `${index2 + 1}`;
|
|
35358
|
+
},
|
|
35359
|
+
width: 50,
|
|
35360
|
+
align: "center"
|
|
35361
|
+
};
|
|
35362
|
+
const actionColumn = {
|
|
35363
|
+
title: "操作",
|
|
35364
|
+
dataIndex: "_action",
|
|
35365
|
+
width: 80,
|
|
35366
|
+
align: "center"
|
|
35367
|
+
};
|
|
35368
|
+
return [
|
|
35369
|
+
indexColumn,
|
|
35370
|
+
...props2.columns.map((item) => ({
|
|
35371
|
+
...item,
|
|
35372
|
+
type: item.type ? item.type : "input"
|
|
35373
|
+
})),
|
|
35374
|
+
...(props2 == null ? void 0 : props2.isShowAction) ? [actionColumn] : []
|
|
35375
|
+
];
|
|
35376
|
+
});
|
|
35377
|
+
const getScrollX = computed(() => {
|
|
35378
|
+
var _a2;
|
|
35379
|
+
let width = 0;
|
|
35380
|
+
const NORMAL_WIDTH = 150;
|
|
35381
|
+
const columns = unref(props2.columns).filter((item) => !item.defaultHidden);
|
|
35382
|
+
columns.forEach((item) => {
|
|
35383
|
+
width += Number.parseFloat(item.width) || 0;
|
|
35384
|
+
});
|
|
35385
|
+
const unsetWidthColumns = columns.filter(
|
|
35386
|
+
(item) => !Reflect.has(item, "width")
|
|
35387
|
+
);
|
|
35388
|
+
const len = unsetWidthColumns.length;
|
|
35389
|
+
if (len !== 0) {
|
|
35390
|
+
width += len * NORMAL_WIDTH;
|
|
35391
|
+
}
|
|
35392
|
+
const table2 = unref(tableElRef);
|
|
35393
|
+
const tableWidth = ((_a2 = table2 == null ? void 0 : table2.$el) == null ? void 0 : _a2.offsetWidth) ?? 0;
|
|
35394
|
+
return tableWidth > width ? "100%" : width;
|
|
35395
|
+
});
|
|
35396
|
+
const plusClickEvent = () => {
|
|
35397
|
+
state.value = [{ [props2.rowKey]: buildUUID() }, ...toRaw(state.value)];
|
|
35398
|
+
emit("add", state.value);
|
|
35399
|
+
};
|
|
35400
|
+
const rowClickEvent = (index2) => {
|
|
35401
|
+
const tempState = state.value.filter((item) => {
|
|
35402
|
+
return item[props2.rowKey] !== index2;
|
|
35403
|
+
});
|
|
35404
|
+
tempState.forEach((item) => item[props2.rowKey] = buildUUID());
|
|
35405
|
+
state.value = [...tempState];
|
|
35406
|
+
emit("remove", state.value, index2);
|
|
35407
|
+
};
|
|
35408
|
+
const getPopupContainer2 = () => document.body;
|
|
35409
|
+
const rulesRef = reactive({});
|
|
35410
|
+
const getRules = ({ column: column2, record, index: index2, ...args }) => {
|
|
35411
|
+
var _a2, _b;
|
|
35412
|
+
const errKey = `${column2.dataIndex}-${record[props2.rowKey]}Info`;
|
|
35413
|
+
if (!column2.required)
|
|
35414
|
+
return [];
|
|
35415
|
+
if ((_a2 = rulesRef[errKey]) == null ? void 0 : _a2.rules)
|
|
35416
|
+
return (_b = rulesRef[errKey]) == null ? void 0 : _b.rules;
|
|
35417
|
+
rulesRef[errKey] = {
|
|
35418
|
+
rules: [],
|
|
35419
|
+
show: false,
|
|
35420
|
+
msg: ""
|
|
35421
|
+
};
|
|
35422
|
+
if (!column2.rules && column2.required) {
|
|
35423
|
+
rulesRef[errKey].rules = [
|
|
35424
|
+
{
|
|
35425
|
+
required: true,
|
|
35426
|
+
validator: (rule, value) => {
|
|
35427
|
+
const prefix = column2.type.toLocaleLowerCase().includes("input") ? "请输入" : "请选择";
|
|
35428
|
+
const errMsg = `${prefix}${column2.title}`;
|
|
35429
|
+
if (value) {
|
|
35430
|
+
rulesRef[errKey].show = false;
|
|
35431
|
+
return Promise.resolve();
|
|
35432
|
+
}
|
|
35433
|
+
rulesRef[errKey].show = true;
|
|
35434
|
+
rulesRef[errKey].msg = errMsg;
|
|
35435
|
+
return Promise.reject(errMsg);
|
|
35436
|
+
}
|
|
35437
|
+
}
|
|
35438
|
+
];
|
|
35439
|
+
return rulesRef[errKey].rules;
|
|
35440
|
+
}
|
|
35441
|
+
if (!isArray$3(column2.rules))
|
|
35442
|
+
return column2.rules;
|
|
35443
|
+
rulesRef[errKey].rules = cloneDeep(column2.rules);
|
|
35444
|
+
rulesRef[errKey].rules.forEach((item) => {
|
|
35445
|
+
if (!item.validator || !isFunction$4(item.validator))
|
|
35446
|
+
return;
|
|
35447
|
+
const validator = item.validator;
|
|
35448
|
+
item.validator = async (rule, value) => {
|
|
35449
|
+
try {
|
|
35450
|
+
rulesRef[errKey].show = false;
|
|
35451
|
+
return await validator(
|
|
35452
|
+
rule,
|
|
35453
|
+
value,
|
|
35454
|
+
{ column: column2, record, ...args },
|
|
35455
|
+
formActionType
|
|
35456
|
+
);
|
|
35457
|
+
} catch (error2) {
|
|
35458
|
+
rulesRef[errKey].show = true;
|
|
35459
|
+
rulesRef[errKey].msg = error2;
|
|
35460
|
+
return Promise.reject(error2);
|
|
35461
|
+
}
|
|
35462
|
+
};
|
|
35463
|
+
});
|
|
35464
|
+
return rulesRef[errKey].rules;
|
|
35465
|
+
};
|
|
35466
|
+
const getActions = (record) => {
|
|
35467
|
+
return [
|
|
35468
|
+
{
|
|
35469
|
+
label: "删除",
|
|
35470
|
+
popConfirm: {
|
|
35471
|
+
title: "确定删除",
|
|
35472
|
+
confirm: rowClickEvent.bind(null, record[props2.rowKey])
|
|
35473
|
+
}
|
|
35474
|
+
},
|
|
35475
|
+
...props2.tableAction(record)
|
|
35476
|
+
];
|
|
35477
|
+
};
|
|
35478
|
+
watch(
|
|
35479
|
+
() => state.value,
|
|
35480
|
+
(v, old) => {
|
|
35481
|
+
if (!isEqual(toRaw(v), toRaw(old))) {
|
|
35482
|
+
state.value = toRaw(v).map((ele) => {
|
|
35483
|
+
return {
|
|
35484
|
+
...ele,
|
|
35485
|
+
[props2.rowKey]: ele[props2.rowKey] || buildUUID()
|
|
35486
|
+
};
|
|
35487
|
+
});
|
|
35488
|
+
}
|
|
35489
|
+
},
|
|
35490
|
+
{
|
|
35491
|
+
deep: true
|
|
35492
|
+
}
|
|
35493
|
+
);
|
|
35494
|
+
const isScroll = ref(false);
|
|
35495
|
+
const timer = ref();
|
|
35496
|
+
onMounted(() => {
|
|
35497
|
+
window.addEventListener(
|
|
35498
|
+
"scroll",
|
|
35499
|
+
(e) => {
|
|
35500
|
+
clearTimeout(timer.value);
|
|
35501
|
+
timer.value = setTimeout(() => {
|
|
35502
|
+
isScroll.value = false;
|
|
35503
|
+
}, 500);
|
|
35504
|
+
if (isScroll.value)
|
|
35505
|
+
return;
|
|
35506
|
+
isScroll.value = true;
|
|
35507
|
+
},
|
|
35508
|
+
true
|
|
35509
|
+
);
|
|
35510
|
+
});
|
|
35511
|
+
onUnmounted(() => {
|
|
35512
|
+
window.removeEventListener("scroll", () => {
|
|
35513
|
+
});
|
|
35514
|
+
});
|
|
35515
|
+
const loadKv = () => {
|
|
35516
|
+
const columns = props2.columns;
|
|
35517
|
+
let dicData = [];
|
|
35518
|
+
columns.forEach(async (column2) => {
|
|
35519
|
+
if (column2 == null ? void 0 : column2.api) {
|
|
35520
|
+
dicData = await column2.api();
|
|
35521
|
+
column2.dicData = dicData;
|
|
35522
|
+
}
|
|
35523
|
+
});
|
|
35524
|
+
};
|
|
35525
|
+
const listFormRefs = ref([]);
|
|
35526
|
+
const validate = async () => {
|
|
35527
|
+
try {
|
|
35528
|
+
for (let formRef of listFormRefs.value) {
|
|
35529
|
+
await formRef.validate();
|
|
35530
|
+
}
|
|
35531
|
+
} catch {
|
|
35532
|
+
throw new Error("校验失败");
|
|
35533
|
+
}
|
|
35534
|
+
};
|
|
35535
|
+
loadKv();
|
|
35536
|
+
__expose({ validate });
|
|
35537
|
+
return (_ctx, _cache) => {
|
|
35538
|
+
return openBlock(), createElementBlock(Fragment, null, [
|
|
35539
|
+
createVNode(unref(Table$2), {
|
|
35540
|
+
ref_key: "tableElRef",
|
|
35541
|
+
ref: tableElRef,
|
|
35542
|
+
columns: getColumns.value,
|
|
35543
|
+
scroll: {
|
|
35544
|
+
x: getScrollX.value
|
|
35545
|
+
},
|
|
35546
|
+
"data-source": unref(state),
|
|
35547
|
+
pagination: false,
|
|
35548
|
+
bordered: "",
|
|
35549
|
+
size: "small",
|
|
35550
|
+
class: "table-children",
|
|
35551
|
+
align: "center"
|
|
35552
|
+
}, {
|
|
35553
|
+
headerCell: withCtx(({ column: column2 }) => {
|
|
35554
|
+
var _a2;
|
|
35555
|
+
return [
|
|
35556
|
+
column2.required || ((_a2 = column2 == null ? void 0 : column2.rules) == null ? void 0 : _a2.length) ? (openBlock(), createElementBlock("span", _hoisted_1$6, "*")) : createCommentVNode("", true),
|
|
35557
|
+
createElementVNode("span", null, toDisplayString(column2.title), 1)
|
|
35558
|
+
];
|
|
35559
|
+
}),
|
|
35560
|
+
bodyCell: withCtx(({ column: column2, record, index: index2, ...args }) => [
|
|
35561
|
+
column2.dataIndex !== "index" && column2.type !== "text" && column2.dataIndex !== "_action" ? (openBlock(), createBlock(unref(FormItem), {
|
|
35562
|
+
required: column2.required,
|
|
35563
|
+
rules: getRules({ column: column2, record, index: index2, ...args }),
|
|
35564
|
+
name: [_ctx.$attrs.codeField, index2, column2.dataIndex],
|
|
35565
|
+
key: record[__props.rowKey]
|
|
35566
|
+
}, {
|
|
35567
|
+
default: withCtx(() => {
|
|
35568
|
+
var _a2;
|
|
35569
|
+
return [
|
|
35570
|
+
createVNode(unref(Popover), {
|
|
35571
|
+
overlayClassName: "table-children-err-popover",
|
|
35572
|
+
visible: !!((_a2 = rulesRef == null ? void 0 : rulesRef[`${column2.dataIndex}-${record[props2.rowKey]}Info`]) == null ? void 0 : _a2.show) && !isScroll.value
|
|
35573
|
+
}, {
|
|
35574
|
+
content: withCtx(() => {
|
|
35575
|
+
var _a3;
|
|
35576
|
+
return [
|
|
35577
|
+
createElementVNode("span", _hoisted_2$3, toDisplayString((_a3 = rulesRef[`${column2.dataIndex}-${record[props2.rowKey]}Info`]) == null ? void 0 : _a3.msg), 1)
|
|
35578
|
+
];
|
|
35579
|
+
}),
|
|
35580
|
+
default: withCtx(() => [
|
|
35581
|
+
column2.type === "select" ? (openBlock(), createBlock(unref(Select), {
|
|
35582
|
+
key: 0,
|
|
35583
|
+
value: record[column2.dataIndex],
|
|
35584
|
+
"onUpdate:value": ($event) => record[column2.dataIndex] = $event,
|
|
35585
|
+
options: column2.dicData,
|
|
35586
|
+
mode: column2.mode,
|
|
35587
|
+
"max-tag-count": column2.maxTagCount,
|
|
35588
|
+
"max-tag-text-length": column2.maxTagTextLength
|
|
35589
|
+
}, null, 8, ["value", "onUpdate:value", "options", "mode", "max-tag-count", "max-tag-text-length"])) : column2.type === "datePicker" ? (openBlock(), createBlock(unref(DatePicker$1), {
|
|
35590
|
+
key: 1,
|
|
35591
|
+
value: record[column2.dataIndex],
|
|
35592
|
+
"onUpdate:value": ($event) => record[column2.dataIndex] = $event,
|
|
35593
|
+
valueFormat: "YYYY-MM-DD HH:mm:ss"
|
|
35594
|
+
}, null, 8, ["value", "onUpdate:value"])) : column2.type === "number" ? (openBlock(), createBlock(unref(InputNumber), {
|
|
35595
|
+
key: 2,
|
|
35596
|
+
value: record[column2.dataIndex],
|
|
35597
|
+
"onUpdate:value": ($event) => record[column2.dataIndex] = $event,
|
|
35598
|
+
min: column2.min,
|
|
35599
|
+
max: column2.max,
|
|
35600
|
+
precision: column2.precision ?? 2
|
|
35601
|
+
}, null, 8, ["value", "onUpdate:value", "min", "max", "precision"])) : column2.type === "input" ? (openBlock(), createBlock(unref(Input), {
|
|
35602
|
+
key: 3,
|
|
35603
|
+
value: record[column2.dataIndex],
|
|
35604
|
+
"onUpdate:value": ($event) => record[column2.dataIndex] = $event,
|
|
35605
|
+
disabled: !props2.isShowAction
|
|
35606
|
+
}, null, 8, ["value", "onUpdate:value", "disabled"])) : (openBlock(), createBlock(resolveDynamicComponent(unref(ShyComponentMap).get(column2.type)), mergeProps(
|
|
35607
|
+
{
|
|
35608
|
+
key: 4,
|
|
35609
|
+
allowClear: "",
|
|
35610
|
+
getPopupContainer: getPopupContainer2,
|
|
35611
|
+
style: { width: "100%" }
|
|
35612
|
+
},
|
|
35613
|
+
unref(isFunction$4)(column2.componentProps) ? column2.componentProps({ record, column: column2, index: index2, ...args }) : column2.componentProps,
|
|
35614
|
+
{
|
|
35615
|
+
value: record[column2.dataIndex],
|
|
35616
|
+
"onUpdate:value": ($event) => record[column2.dataIndex] = $event
|
|
35617
|
+
}
|
|
35618
|
+
), null, 16, ["value", "onUpdate:value"]))
|
|
35619
|
+
]),
|
|
35620
|
+
_: 2
|
|
35621
|
+
}, 1032, ["visible"])
|
|
35622
|
+
];
|
|
35623
|
+
}),
|
|
35624
|
+
_: 2
|
|
35625
|
+
}, 1032, ["required", "rules", "name"])) : createCommentVNode("", true),
|
|
35626
|
+
column2.dataIndex === "_action" ? (openBlock(), createBlock(unref(ShyTableAction), {
|
|
35627
|
+
key: 1,
|
|
35628
|
+
actions: getActions(record)
|
|
35629
|
+
}, null, 8, ["actions"])) : createCommentVNode("", true)
|
|
35630
|
+
]),
|
|
35631
|
+
_: 1
|
|
35632
|
+
}, 8, ["columns", "scroll", "data-source"]),
|
|
35633
|
+
createElementVNode("div", _hoisted_3$2, [
|
|
35634
|
+
createVNode(unref(BasicButton), {
|
|
35635
|
+
onClick: plusClickEvent,
|
|
35636
|
+
type: "dashed"
|
|
35637
|
+
}, {
|
|
35638
|
+
default: withCtx(() => [
|
|
35639
|
+
createTextVNode(" 新增 ")
|
|
35640
|
+
]),
|
|
35641
|
+
_: 1
|
|
35642
|
+
})
|
|
35643
|
+
]),
|
|
35644
|
+
createElementVNode("div", _hoisted_4$2, [
|
|
35645
|
+
(openBlock(), createBlock(resolveDynamicComponent(h("span", null, __props.footerRender()))))
|
|
35646
|
+
])
|
|
35647
|
+
], 64);
|
|
35648
|
+
};
|
|
35649
|
+
}
|
|
35650
|
+
});
|
|
35651
|
+
const Table_vue_vue_type_style_index_0_scoped_d3bdc269_lang = "";
|
|
35652
|
+
const Table = /* @__PURE__ */ _export_sfc(_sfc_main$b, [["__scopeId", "data-v-d3bdc269"]]);
|
|
35208
35653
|
const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
35209
35654
|
__name: "DeptTree",
|
|
35210
35655
|
props: {
|
|
@@ -39286,7 +39731,6 @@ const ShyTableAction = /* @__PURE__ */ defineComponent({
|
|
|
39286
39731
|
};
|
|
39287
39732
|
}
|
|
39288
39733
|
});
|
|
39289
|
-
const ShyTableAction$1 = ShyTableAction;
|
|
39290
39734
|
function useShyTable(tableProps) {
|
|
39291
39735
|
const tableRef = ref(null);
|
|
39292
39736
|
const loadedRef = ref(false);
|
|
@@ -39642,8 +40086,7 @@ const _hoisted_4 = {
|
|
|
39642
40086
|
class: "process-item"
|
|
39643
40087
|
};
|
|
39644
40088
|
const _hoisted_5 = { key: 0 };
|
|
39645
|
-
const _hoisted_6 = { key:
|
|
39646
|
-
const _hoisted_7 = { key: 2 };
|
|
40089
|
+
const _hoisted_6 = { key: 2 };
|
|
39647
40090
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
39648
40091
|
__name: "Process",
|
|
39649
40092
|
props: {
|
|
@@ -39732,9 +40175,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
39732
40175
|
return openBlock(), createElementBlock(Fragment, { key: _cIndex }, [
|
|
39733
40176
|
item[key2] ? (openBlock(), createElementBlock("div", _hoisted_4, [
|
|
39734
40177
|
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))
|
|
40178
|
+
customRender ? (openBlock(), createBlock(resolveDynamicComponent(h("span", null, customRender(item))), { key: 1 })) : (openBlock(), createElementBlock("span", _hoisted_6, toDisplayString(item[key2]), 1))
|
|
39738
40179
|
])) : createCommentVNode("", true)
|
|
39739
40180
|
], 64);
|
|
39740
40181
|
}), 128))
|
|
@@ -39750,8 +40191,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
39750
40191
|
};
|
|
39751
40192
|
}
|
|
39752
40193
|
});
|
|
39753
|
-
const
|
|
39754
|
-
const Process = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-
|
|
40194
|
+
const Process_vue_vue_type_style_index_0_scoped_95c7693b_lang = "";
|
|
40195
|
+
const Process = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-95c7693b"]]);
|
|
39755
40196
|
export {
|
|
39756
40197
|
_sfc_main$T as AdvancedSearch,
|
|
39757
40198
|
ApiCascader$1 as ApiCascader,
|
|
@@ -39810,11 +40251,11 @@ export {
|
|
|
39810
40251
|
ShyComponentMap,
|
|
39811
40252
|
ShyContainer,
|
|
39812
40253
|
ShyForm,
|
|
39813
|
-
_sfc_main$
|
|
40254
|
+
_sfc_main$d as ShyFormItem,
|
|
39814
40255
|
_sfc_main$6 as ShyFormWrapper,
|
|
39815
40256
|
RadioButtonGroup as ShyRadioButtonGroup,
|
|
39816
40257
|
ShyTable,
|
|
39817
|
-
ShyTableAction
|
|
40258
|
+
ShyTableAction,
|
|
39818
40259
|
Table as ShyTableChildren,
|
|
39819
40260
|
StrengthMeter,
|
|
39820
40261
|
SvgIcon,
|