bm-admin-ui 1.0.53-alpha → 1.0.55-alpha
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/components/form-create/index.js +220 -44
- package/es/components/form-designer/index.js +7 -0
- package/es/components/staffs-selector/index.d.ts +1 -0
- package/es/components/staffs-selector/index.js +4 -1
- package/es/components/staffs-selector/src/multipleCmp.vue.d.ts +1 -0
- package/es/components/staffs-selector/src/staffs-selector.vue.d.ts +1 -0
- package/es/utils/isNull.d.ts +1 -0
- package/es/utils/isNull.js +5 -0
- package/lib/components/form-create/index.js +220 -43
- package/lib/components/form-designer/index.js +7 -0
- package/lib/components/staffs-selector/index.d.ts +1 -0
- package/lib/components/staffs-selector/index.js +4 -1
- package/lib/components/staffs-selector/src/multipleCmp.vue.d.ts +1 -0
- package/lib/components/staffs-selector/src/staffs-selector.vue.d.ts +1 -0
- package/lib/utils/isNull.d.ts +1 -0
- package/lib/utils/isNull.js +9 -0
- package/package.json +1 -1
- package/theme-chalk/form-create.css +1 -1
- package/theme-chalk/index.css +1 -1
- package/types/components/staffs-selector/index.d.ts +1 -0
- package/types/components/staffs-selector/src/multipleCmp.vue.d.ts +1 -0
- package/types/components/staffs-selector/src/staffs-selector.vue.d.ts +1 -0
- package/types/utils/isNull.d.ts +1 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { withInstall } from 'bm-admin-ui/es/utils/with-install';
|
|
2
|
-
import { h, nextTick, defineComponent, ref, watch, openBlock, createElementBlock, createVNode, unref, computed, normalizeStyle, Fragment, renderList, normalizeClass, reactive, createBlock, withCtx, createTextVNode, createElementVNode, toDisplayString, createCommentVNode, inject, createStaticVNode, provide, resolveComponent } from 'vue';
|
|
2
|
+
import { h, nextTick, defineComponent, ref, watch, openBlock, createElementBlock, createVNode, unref, computed, normalizeStyle, Fragment, renderList, normalizeClass, reactive, createBlock, withCtx, createTextVNode, createElementVNode, toDisplayString, createCommentVNode, createSlots, inject, createStaticVNode, provide, resolveComponent } from 'vue';
|
|
3
3
|
import { Input, InputNumber, Select, DatePicker, RangePicker, message, Modal, Layout, LayoutSider, Tree, LayoutContent, Button, Row, Col, Pagination, FormItemRest, Divider, Tabs, TabPane, Cascader } from 'ant-design-vue';
|
|
4
4
|
import dayjs from 'dayjs';
|
|
5
5
|
import Picture from 'bm-admin-ui/es/components/upload';
|
|
@@ -7,6 +7,8 @@ import BmStaffsSelector from 'bm-admin-ui/es/components/staffs-selector';
|
|
|
7
7
|
import { BmTagsDisplay, BmFloatTable } from 'bm-admin-ui/es/components';
|
|
8
8
|
import { SearchOutlined, CheckCircleFilled, PlusOutlined } from '@ant-design/icons-vue';
|
|
9
9
|
import { cloneDeep, floor, debounce } from 'lodash-es';
|
|
10
|
+
import customParseFormat from 'dayjs/plugin/customParseFormat';
|
|
11
|
+
import { isNull } from 'bm-admin-ui/es/utils/isNull';
|
|
10
12
|
|
|
11
13
|
const fieldRatioMap = {
|
|
12
14
|
'25%': 6,
|
|
@@ -802,13 +804,17 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
802
804
|
val.map((item) => ({
|
|
803
805
|
[fieldNames.value]: item.key,
|
|
804
806
|
[fieldNames.label]: item.title,
|
|
805
|
-
|
|
807
|
+
key: item.key,
|
|
808
|
+
title: item.title
|
|
806
809
|
}))
|
|
807
810
|
);
|
|
808
811
|
}
|
|
809
812
|
function handleAdd() {
|
|
810
813
|
visible.value = true;
|
|
811
814
|
}
|
|
815
|
+
function getPopupContainer() {
|
|
816
|
+
return document.body;
|
|
817
|
+
}
|
|
812
818
|
watch(
|
|
813
819
|
() => props.defaultSelected,
|
|
814
820
|
(val) => {
|
|
@@ -828,9 +834,12 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
828
834
|
"onUpdate:list": _cache[0] || (_cache[0] = ($event) => selected.value = $event),
|
|
829
835
|
"show-empty-btn": false,
|
|
830
836
|
disabled: __props.disabled,
|
|
837
|
+
"tool-tip-props": {
|
|
838
|
+
getPopupContainer
|
|
839
|
+
},
|
|
831
840
|
"show-empty": "",
|
|
832
841
|
onAddClick: handleAdd
|
|
833
|
-
}, null, 8, ["list", "disabled"]),
|
|
842
|
+
}, null, 8, ["list", "disabled", "tool-tip-props"]),
|
|
834
843
|
createVNode(unref(BmStaffsSelector), {
|
|
835
844
|
select: selected.value,
|
|
836
845
|
"onUpdate:select": _cache[1] || (_cache[1] = ($event) => selected.value = $event),
|
|
@@ -938,6 +947,7 @@ var people = {
|
|
|
938
947
|
minWidth: data.config.fieldRatio,
|
|
939
948
|
slots: {
|
|
940
949
|
default({ row }) {
|
|
950
|
+
var _a;
|
|
941
951
|
return h(StaffSelector, {
|
|
942
952
|
title: '添加员工',
|
|
943
953
|
mode: data.props.limit ? 'radio' : 'multiple',
|
|
@@ -952,6 +962,7 @@ var people = {
|
|
|
952
962
|
return yield extraConfig.people.fetch(params);
|
|
953
963
|
});
|
|
954
964
|
},
|
|
965
|
+
fieldNames: (_a = extraConfig.people) === null || _a === void 0 ? void 0 : _a.fieldNames,
|
|
955
966
|
});
|
|
956
967
|
},
|
|
957
968
|
},
|
|
@@ -1274,11 +1285,13 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
1274
1285
|
"extraConfig",
|
|
1275
1286
|
"disabled",
|
|
1276
1287
|
"disabledTable",
|
|
1277
|
-
"hidden"
|
|
1288
|
+
"hidden",
|
|
1289
|
+
"formCreateInject"
|
|
1278
1290
|
],
|
|
1279
1291
|
emits: ["change"],
|
|
1280
1292
|
setup(__props, { emit: emits }) {
|
|
1281
1293
|
const props = __props;
|
|
1294
|
+
dayjs.extend(customParseFormat);
|
|
1282
1295
|
const productInfoKeyMap = {
|
|
1283
1296
|
\u5546\u54C1\u540D\u79F0: "productName",
|
|
1284
1297
|
\u5546\u54C1\u7B80\u79F0: "productShortName",
|
|
@@ -1298,6 +1311,9 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
1298
1311
|
const config = computed(() => ({
|
|
1299
1312
|
columns: [...columns],
|
|
1300
1313
|
data: [...data],
|
|
1314
|
+
columnConfig: {
|
|
1315
|
+
resizable: true
|
|
1316
|
+
},
|
|
1301
1317
|
checkboxConfig: {
|
|
1302
1318
|
trigger: "cell",
|
|
1303
1319
|
checkMethod() {
|
|
@@ -1336,12 +1352,15 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
1336
1352
|
return result;
|
|
1337
1353
|
}, {}) || {}
|
|
1338
1354
|
);
|
|
1355
|
+
const productInputSlots = reactive([]);
|
|
1356
|
+
const formData = computed(() => props.formCreateInject.api.bind());
|
|
1339
1357
|
function isShow(key) {
|
|
1340
1358
|
return props.rule.config.tableAdvancedFeatures.includes(key);
|
|
1341
1359
|
}
|
|
1342
1360
|
function initConfig() {
|
|
1343
1361
|
columns.splice(0, columns.length);
|
|
1344
1362
|
data.splice(0, data.length);
|
|
1363
|
+
productInputSlots.splice(0, productInputSlots.length);
|
|
1345
1364
|
const childRules = cloneDeep(props.rule.config.childRules);
|
|
1346
1365
|
const value = props.rule.value;
|
|
1347
1366
|
if (deleteFeature.value && !props.hidden) {
|
|
@@ -1395,6 +1414,7 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
1395
1414
|
const productName = `\u5546\u54C1${String(++productIndex).padStart(2, "0")}`;
|
|
1396
1415
|
const field = rule.field;
|
|
1397
1416
|
const associatedFields = rule.config.associatedFields;
|
|
1417
|
+
productInputSlots.push(rule);
|
|
1398
1418
|
const columns2 = [
|
|
1399
1419
|
{
|
|
1400
1420
|
field,
|
|
@@ -1402,19 +1422,7 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
1402
1422
|
headerClassName: rule.effect.required ? "is-required" : "",
|
|
1403
1423
|
minWidth: "138px",
|
|
1404
1424
|
slots: {
|
|
1405
|
-
default
|
|
1406
|
-
return h(Input, {
|
|
1407
|
-
value: row[field],
|
|
1408
|
-
placeholder: "\u8BF7\u8F93\u5165",
|
|
1409
|
-
disabled: rule.disabled,
|
|
1410
|
-
"onUpdate:value": (value) => {
|
|
1411
|
-
row[field] = value;
|
|
1412
|
-
},
|
|
1413
|
-
onPressEnter() {
|
|
1414
|
-
queryProductInfo(rule, row);
|
|
1415
|
-
}
|
|
1416
|
-
});
|
|
1417
|
-
}
|
|
1425
|
+
default: rule.field
|
|
1418
1426
|
}
|
|
1419
1427
|
}
|
|
1420
1428
|
];
|
|
@@ -1486,13 +1494,15 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
1486
1494
|
function emitChange() {
|
|
1487
1495
|
emits("change", data);
|
|
1488
1496
|
}
|
|
1489
|
-
function queryProductInfo(rule, row) {
|
|
1497
|
+
async function queryProductInfo(rule, row) {
|
|
1490
1498
|
const field = rule.field;
|
|
1491
1499
|
const associatedFields = rule?.config?.associatedFields;
|
|
1492
|
-
|
|
1493
|
-
associatedFields.
|
|
1494
|
-
|
|
1495
|
-
|
|
1500
|
+
return await props.extraConfig.product.fetch({ productCode: row[field] }).then((data2) => {
|
|
1501
|
+
if (associatedFields.length)
|
|
1502
|
+
associatedFields.forEach((item) => {
|
|
1503
|
+
row[field + item.value] = data2 ? data2[productInfoKeyMap[item.value]] : void 0;
|
|
1504
|
+
});
|
|
1505
|
+
return data2;
|
|
1496
1506
|
});
|
|
1497
1507
|
}
|
|
1498
1508
|
function handleChange(e) {
|
|
@@ -1509,7 +1519,14 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
1509
1519
|
});
|
|
1510
1520
|
result.push(rowData);
|
|
1511
1521
|
});
|
|
1512
|
-
validate(result)
|
|
1522
|
+
result.length && validate(result).then((result2) => {
|
|
1523
|
+
data.splice(0, data.length, ...result2);
|
|
1524
|
+
}).catch((error) => {
|
|
1525
|
+
message.error("\u5B58\u5728\u9519\u8BEF\u6570\u636E\uFF0C\u5BFC\u5165\u5931\u8D25");
|
|
1526
|
+
console.log("---------------");
|
|
1527
|
+
console.log(error);
|
|
1528
|
+
console.log("---------------");
|
|
1529
|
+
});
|
|
1513
1530
|
e.target.value = "";
|
|
1514
1531
|
};
|
|
1515
1532
|
file && reader.readAsText(file, "GB2312");
|
|
@@ -1520,64 +1537,139 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
1520
1537
|
function parseCsv(result) {
|
|
1521
1538
|
let data2 = [];
|
|
1522
1539
|
if (result) {
|
|
1523
|
-
|
|
1540
|
+
const rows = result.split("\r\n");
|
|
1541
|
+
const columnsTxt = rows[0];
|
|
1542
|
+
const columnArr = columnsTxt.includes(" ") ? columnsTxt.split(" ") : columnsTxt.split(",");
|
|
1543
|
+
if (columnArr.length !== columns.filter((c) => isValidColumn(c)).length) {
|
|
1544
|
+
message.error("\u5BFC\u5165\u7684\u6A21\u677F\u51FA\u9519");
|
|
1545
|
+
} else {
|
|
1546
|
+
data2 = rows.slice(1).filter((item) => item).map(
|
|
1547
|
+
(item) => item.includes(" ") ? item.split(" ") : item.split(",")
|
|
1548
|
+
);
|
|
1549
|
+
}
|
|
1524
1550
|
}
|
|
1525
1551
|
return data2;
|
|
1526
1552
|
}
|
|
1527
|
-
function validate(rowData) {
|
|
1553
|
+
async function validate(rowData) {
|
|
1554
|
+
let error = "";
|
|
1528
1555
|
const validColumns = columns.filter((c) => isValidColumn(c));
|
|
1529
1556
|
for (const row of rowData) {
|
|
1530
1557
|
for (const { field } of validColumns) {
|
|
1531
1558
|
const rule = childRulesMap.value[field];
|
|
1532
|
-
|
|
1559
|
+
const title = rule?.title?.title;
|
|
1560
|
+
if (!rule)
|
|
1561
|
+
break;
|
|
1562
|
+
let value = row[field] || "";
|
|
1533
1563
|
const txtFormatFn = rule.config?.txtFormatFn;
|
|
1534
1564
|
if (rule.effect.required && !value) {
|
|
1565
|
+
error = `${title}\u4E0D\u80FD\u4E3A\u7A7A`;
|
|
1535
1566
|
break;
|
|
1536
1567
|
}
|
|
1537
1568
|
if (txtFormatFn && !txtFormatFn(value)) {
|
|
1569
|
+
error = `${title}\u586B\u5199\u89C4\u5219\u4E0D\u6B63\u786E`;
|
|
1538
1570
|
break;
|
|
1539
1571
|
}
|
|
1540
1572
|
if (rule.name === "input") {
|
|
1541
1573
|
const maxlength = rule.props.maxlength || 200;
|
|
1542
1574
|
if (value.length > maxlength) {
|
|
1575
|
+
error = `${title}\u5B57\u6570\u8D85\u51FA`;
|
|
1543
1576
|
break;
|
|
1544
1577
|
}
|
|
1545
1578
|
}
|
|
1546
1579
|
if (rule.name === "textarea") {
|
|
1547
1580
|
if (value.length > 5e3) {
|
|
1581
|
+
error = `${title}\u5B57\u6570\u8D85\u51FA`;
|
|
1548
1582
|
break;
|
|
1549
1583
|
}
|
|
1550
1584
|
}
|
|
1551
1585
|
if (rule.name === "numInput") {
|
|
1552
1586
|
if (rule.config.format === 1) {
|
|
1553
1587
|
if (!value.includes("%")) {
|
|
1588
|
+
error = `${title}\u4E0D\u4E3A\u767E\u5206\u6570`;
|
|
1554
1589
|
break;
|
|
1590
|
+
} else {
|
|
1591
|
+
value = value.replaceAll("%", "");
|
|
1555
1592
|
}
|
|
1556
1593
|
} else {
|
|
1557
|
-
if (
|
|
1594
|
+
if (isNaN(value)) {
|
|
1595
|
+
error = `${title}\u4E0D\u4E3A\u6570\u5B57\u7C7B\u578B`;
|
|
1558
1596
|
break;
|
|
1559
1597
|
}
|
|
1560
1598
|
}
|
|
1561
1599
|
if (rule.config.decimalPlaces !== void 0 && value.split(".")[1]?.length > rule.config.decimalPlaces) {
|
|
1600
|
+
error = `${title}\u4FDD\u7559\u7684\u5C0F\u6570\u70B9\u4E3A\u4E0D\u6B63\u786E`;
|
|
1562
1601
|
break;
|
|
1563
1602
|
}
|
|
1564
1603
|
}
|
|
1565
1604
|
if (rule.name === "radio") {
|
|
1566
1605
|
if (rule.options.every((item) => item.value !== value)) {
|
|
1606
|
+
error = `${title}\u4E0D\u5B58\u5728\u8BE5\u9009\u9879`;
|
|
1567
1607
|
break;
|
|
1568
1608
|
}
|
|
1569
1609
|
}
|
|
1570
1610
|
if (rule.name === "checkbox") {
|
|
1571
1611
|
value = value.split("\u3001");
|
|
1572
1612
|
if (value.some((item) => rule.options.every((r) => r.value !== item))) {
|
|
1613
|
+
error = `${title}\u5B58\u5728\u4E0D\u5B58\u5728\u7684\u9009\u9879\u503C`;
|
|
1573
1614
|
break;
|
|
1574
1615
|
}
|
|
1575
|
-
row[field] = value;
|
|
1576
1616
|
}
|
|
1577
|
-
if (rule.name === "date")
|
|
1617
|
+
if (rule.name === "date") {
|
|
1618
|
+
if (!dayjs(value, rule.props.format, true).isValid()) {
|
|
1619
|
+
error = `${title}\u4E0D\u4E3A\u6709\u6548\u65F6\u671F\u6216\u4E0D\u7B26\u5408\u65E5\u671F\u683C\u5F0F`;
|
|
1620
|
+
break;
|
|
1621
|
+
}
|
|
1622
|
+
}
|
|
1623
|
+
if (rule.name === "dateRange") {
|
|
1624
|
+
value = value.split("~");
|
|
1625
|
+
if (value.some((item) => !dayjs(item, rule.props.format, true).isValid())) {
|
|
1626
|
+
error = `${title}\u4E0D\u4E3A\u6709\u6548\u65F6\u671F\u6216\u4E0D\u7B26\u5408\u65E5\u671F\u683C\u5F0F`;
|
|
1627
|
+
break;
|
|
1628
|
+
}
|
|
1629
|
+
}
|
|
1630
|
+
if (rule.name === "people" || rule.name === "department") {
|
|
1631
|
+
const limit = rule.props.limit;
|
|
1632
|
+
value = value.split("\u3001").map((item) => ({}));
|
|
1633
|
+
if (limit === 1 && value.length > limit) {
|
|
1634
|
+
error = `${title}\u6700\u591A\u53EA\u80FD\u9009\u4E00\u4E2A`;
|
|
1635
|
+
break;
|
|
1636
|
+
}
|
|
1637
|
+
}
|
|
1638
|
+
if (rule.name === "product") {
|
|
1639
|
+
const productInfo = await queryProductInfo(rule, row);
|
|
1640
|
+
if (!productInfo) {
|
|
1641
|
+
error = `${title}\u67E5\u8BE2\u7684\u5546\u54C1\u4E0D\u5B58\u5728`;
|
|
1642
|
+
break;
|
|
1643
|
+
}
|
|
1644
|
+
}
|
|
1645
|
+
if (rule.name === "shop") {
|
|
1646
|
+
value = {
|
|
1647
|
+
value: Number(value)
|
|
1648
|
+
};
|
|
1649
|
+
}
|
|
1650
|
+
row[field] = value;
|
|
1578
1651
|
}
|
|
1652
|
+
if (error)
|
|
1653
|
+
break;
|
|
1654
|
+
}
|
|
1655
|
+
if (error) {
|
|
1656
|
+
return Promise.reject(error);
|
|
1657
|
+
} else {
|
|
1658
|
+
return Promise.resolve(rowData);
|
|
1579
1659
|
}
|
|
1580
1660
|
}
|
|
1661
|
+
function pruductInputDisabled(shopField) {
|
|
1662
|
+
if (!shopField)
|
|
1663
|
+
return false;
|
|
1664
|
+
return !formData.value[shopField];
|
|
1665
|
+
}
|
|
1666
|
+
function handlePressEnter(rule, row) {
|
|
1667
|
+
queryProductInfo(rule, row).then((data2) => {
|
|
1668
|
+
if (!data2) {
|
|
1669
|
+
row[rule.field] = "";
|
|
1670
|
+
}
|
|
1671
|
+
});
|
|
1672
|
+
}
|
|
1581
1673
|
watch(
|
|
1582
1674
|
() => props.rule,
|
|
1583
1675
|
() => {
|
|
@@ -1660,7 +1752,7 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
1660
1752
|
ref_key: "bmFloatTableRef",
|
|
1661
1753
|
ref: bmFloatTableRef,
|
|
1662
1754
|
config: unref(config)
|
|
1663
|
-
}, {
|
|
1755
|
+
}, createSlots({
|
|
1664
1756
|
floatHandle: withCtx(({ row, rowIndex }) => [
|
|
1665
1757
|
unref(copyFeature) ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
1666
1758
|
createVNode(unref(Button), {
|
|
@@ -1688,8 +1780,23 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
1688
1780
|
_: 2
|
|
1689
1781
|
}, 1032, ["disabled", "onClick"])
|
|
1690
1782
|
]),
|
|
1691
|
-
_:
|
|
1692
|
-
},
|
|
1783
|
+
_: 2
|
|
1784
|
+
}, [
|
|
1785
|
+
renderList(productInputSlots, (item) => {
|
|
1786
|
+
return {
|
|
1787
|
+
name: item.field,
|
|
1788
|
+
fn: withCtx(({ row }) => [
|
|
1789
|
+
createVNode(unref(Input), {
|
|
1790
|
+
value: row[item.field],
|
|
1791
|
+
"onUpdate:value": ($event) => row[item.field] = $event,
|
|
1792
|
+
placeholder: "\u8BF7\u8F93\u5165",
|
|
1793
|
+
disabled: item.disabled || pruductInputDisabled(item.config?.dataFiltering),
|
|
1794
|
+
onPressEnter: ($event) => handlePressEnter(item, row)
|
|
1795
|
+
}, null, 8, ["value", "onUpdate:value", "disabled", "onPressEnter"])
|
|
1796
|
+
])
|
|
1797
|
+
};
|
|
1798
|
+
})
|
|
1799
|
+
]), 1032, ["config"])
|
|
1693
1800
|
]),
|
|
1694
1801
|
_: 1
|
|
1695
1802
|
})
|
|
@@ -1894,7 +2001,8 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
|
1894
2001
|
return void 0;
|
|
1895
2002
|
}
|
|
1896
2003
|
function handleTableDataChange(value) {
|
|
1897
|
-
getAcitvePane()
|
|
2004
|
+
const activePane2 = getAcitvePane();
|
|
2005
|
+
activePane2.tableData = value;
|
|
1898
2006
|
}
|
|
1899
2007
|
function emitChange() {
|
|
1900
2008
|
emits("change", {
|
|
@@ -1905,7 +2013,8 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
|
1905
2013
|
tempIdSelected: pane.tempSelected.templateCode || pane.tempIdSelected,
|
|
1906
2014
|
templateName: pane.tempSelected?.templateName || pane.templateName,
|
|
1907
2015
|
tableData: pane.tableData,
|
|
1908
|
-
uploadList: pane.uploadList
|
|
2016
|
+
uploadList: pane.uploadList,
|
|
2017
|
+
tableRequiredFields: pane.tableRule?.config?.childRules?.filter((rule) => rule.effect?.required).map((rule) => rule.field)
|
|
1909
2018
|
}))
|
|
1910
2019
|
});
|
|
1911
2020
|
}
|
|
@@ -2243,6 +2352,30 @@ var materialTemp = {
|
|
|
2243
2352
|
inject.self.value = value;
|
|
2244
2353
|
},
|
|
2245
2354
|
},
|
|
2355
|
+
validate: [
|
|
2356
|
+
{
|
|
2357
|
+
validator(rule, value) {
|
|
2358
|
+
if (isNull(value)) {
|
|
2359
|
+
return Promise.reject();
|
|
2360
|
+
}
|
|
2361
|
+
const panes = value.panes;
|
|
2362
|
+
for (const pane of panes) {
|
|
2363
|
+
if (!pane.tempIdSelected) {
|
|
2364
|
+
return Promise.reject();
|
|
2365
|
+
}
|
|
2366
|
+
if (pane.tableRequiredFields) {
|
|
2367
|
+
for (const field of pane.tableRequiredFields) {
|
|
2368
|
+
if (pane.tableData.some((row) => isNull(row[field]))) {
|
|
2369
|
+
return Promise.reject();
|
|
2370
|
+
}
|
|
2371
|
+
}
|
|
2372
|
+
}
|
|
2373
|
+
}
|
|
2374
|
+
return Promise.resolve();
|
|
2375
|
+
},
|
|
2376
|
+
message: '请检查必填项',
|
|
2377
|
+
},
|
|
2378
|
+
],
|
|
2246
2379
|
},
|
|
2247
2380
|
],
|
|
2248
2381
|
class: 'bm-fc-module-widget',
|
|
@@ -2260,7 +2393,8 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
|
2260
2393
|
"required",
|
|
2261
2394
|
"extraConfig",
|
|
2262
2395
|
"defalutValue",
|
|
2263
|
-
"disabled"
|
|
2396
|
+
"disabled",
|
|
2397
|
+
"formCreateInject"
|
|
2264
2398
|
],
|
|
2265
2399
|
emits: ["change"],
|
|
2266
2400
|
setup(__props, { emit: emits }) {
|
|
@@ -2275,8 +2409,9 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
|
2275
2409
|
\u5546\u54C1\u5355\u4F4D: "unit"
|
|
2276
2410
|
};
|
|
2277
2411
|
const unitMap = ["\u652F", "\u74F6", "\u5957", "\u7EC4", "\u7BB1", "\u4E2A", "\u5F20"];
|
|
2412
|
+
const formData = computed(() => props.formCreateInject.api.bind());
|
|
2278
2413
|
async function fetch(value) {
|
|
2279
|
-
productInfo.value = await props.extraConfig.fetch({
|
|
2414
|
+
productInfo.value = await props.extraConfig.product.fetch({
|
|
2280
2415
|
productCode: value,
|
|
2281
2416
|
filterByShopcode: props.dataFiltering
|
|
2282
2417
|
}) || {};
|
|
@@ -2292,6 +2427,9 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
|
2292
2427
|
function emitChange(value) {
|
|
2293
2428
|
emits("change", value);
|
|
2294
2429
|
}
|
|
2430
|
+
function inputDisbale(shopField) {
|
|
2431
|
+
return shopField && !formData.value[shopField];
|
|
2432
|
+
}
|
|
2295
2433
|
watch(
|
|
2296
2434
|
() => props.defalutValue,
|
|
2297
2435
|
(val) => {
|
|
@@ -2324,7 +2462,7 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
|
2324
2462
|
createVNode(unref(Input), {
|
|
2325
2463
|
placeholder: "\u8BF7\u8F93\u5165",
|
|
2326
2464
|
value: __props.defalutValue,
|
|
2327
|
-
disabled: __props.disabled,
|
|
2465
|
+
disabled: __props.disabled || inputDisbale(__props.dataFiltering),
|
|
2328
2466
|
onPressEnter: handleBlur
|
|
2329
2467
|
}, null, 8, ["value", "disabled"])
|
|
2330
2468
|
]),
|
|
@@ -2358,7 +2496,8 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
|
2358
2496
|
getValue(field.value) ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
2359
2497
|
field.value === "\u5546\u54C1\u56FE\u7247" ? (openBlock(), createElementBlock("img", {
|
|
2360
2498
|
key: 0,
|
|
2361
|
-
|
|
2499
|
+
class: "bm-fc-form-item__img",
|
|
2500
|
+
src: __props.extraConfig.common.previewImg(getValue(field.value))
|
|
2362
2501
|
}, null, 8, _hoisted_2$2)) : field.value === "\u5546\u54C1\u5355\u4F4D" ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
|
|
2363
2502
|
createTextVNode(toDisplayString(unitMap[getValue(field.value)]), 1)
|
|
2364
2503
|
], 64)) : (openBlock(), createElementBlock(Fragment, { key: 2 }, [
|
|
@@ -2399,7 +2538,7 @@ var product = {
|
|
|
2399
2538
|
required: data.effect.required,
|
|
2400
2539
|
associatedFields: data.config.associatedFields,
|
|
2401
2540
|
dataFiltering: data.config.dataFiltering,
|
|
2402
|
-
extraConfig: extraConfig
|
|
2541
|
+
extraConfig: extraConfig,
|
|
2403
2542
|
defalutValue: data.value,
|
|
2404
2543
|
},
|
|
2405
2544
|
inject: true,
|
|
@@ -2413,7 +2552,7 @@ var product = {
|
|
|
2413
2552
|
},
|
|
2414
2553
|
};
|
|
2415
2554
|
},
|
|
2416
|
-
rowRule(data) {
|
|
2555
|
+
rowRule(data, extraConfig) {
|
|
2417
2556
|
return {
|
|
2418
2557
|
type: 'ProductInfo',
|
|
2419
2558
|
component: ProductInfo,
|
|
@@ -2426,6 +2565,7 @@ var product = {
|
|
|
2426
2565
|
associatedFields: data.config.associatedFields,
|
|
2427
2566
|
dataFiltering: data.config.dataFiltering,
|
|
2428
2567
|
defalutValue: data.value,
|
|
2568
|
+
extraConfig: extraConfig,
|
|
2429
2569
|
},
|
|
2430
2570
|
inject: true,
|
|
2431
2571
|
on: {
|
|
@@ -2854,7 +2994,7 @@ var department = {
|
|
|
2854
2994
|
return yield extraConfig.department.fetch();
|
|
2855
2995
|
});
|
|
2856
2996
|
},
|
|
2857
|
-
fieldNames: (_a = extraConfig.
|
|
2997
|
+
fieldNames: (_a = extraConfig.department) === null || _a === void 0 ? void 0 : _a.fieldNames,
|
|
2858
2998
|
},
|
|
2859
2999
|
effect: {
|
|
2860
3000
|
required: data.effect.required && '请选择',
|
|
@@ -2897,7 +3037,7 @@ var department = {
|
|
|
2897
3037
|
return yield extraConfig.department.fetch();
|
|
2898
3038
|
});
|
|
2899
3039
|
},
|
|
2900
|
-
fieldNames: (_a = extraConfig.
|
|
3040
|
+
fieldNames: (_a = extraConfig.department) === null || _a === void 0 ? void 0 : _a.fieldNames,
|
|
2901
3041
|
},
|
|
2902
3042
|
effect: {
|
|
2903
3043
|
required: data.effect.required && '请选择',
|
|
@@ -2928,6 +3068,7 @@ var department = {
|
|
|
2928
3068
|
minWidth: data.config.fieldRatio,
|
|
2929
3069
|
slots: {
|
|
2930
3070
|
default({ row }) {
|
|
3071
|
+
var _a;
|
|
2931
3072
|
return h(StaffSelector, {
|
|
2932
3073
|
title: '添加部门',
|
|
2933
3074
|
mode: data.props.limit ? 'radio' : 'multiple',
|
|
@@ -2944,6 +3085,7 @@ var department = {
|
|
|
2944
3085
|
return yield extraConfig.department.fetch(params);
|
|
2945
3086
|
});
|
|
2946
3087
|
},
|
|
3088
|
+
fieldNames: (_a = extraConfig.department) === null || _a === void 0 ? void 0 : _a.fieldNames,
|
|
2947
3089
|
});
|
|
2948
3090
|
},
|
|
2949
3091
|
},
|
|
@@ -2951,6 +3093,20 @@ var department = {
|
|
|
2951
3093
|
},
|
|
2952
3094
|
};
|
|
2953
3095
|
|
|
3096
|
+
function validator(rule, value) {
|
|
3097
|
+
var _a;
|
|
3098
|
+
const childRules = ((_a = rule.config) === null || _a === void 0 ? void 0 : _a.childRules) || [];
|
|
3099
|
+
const requiredRules = childRules.filter((rule) => { var _a; return (_a = rule === null || rule === void 0 ? void 0 : rule.effect) === null || _a === void 0 ? void 0 : _a.required; });
|
|
3100
|
+
if (requiredRules.length && isNull(value)) {
|
|
3101
|
+
return Promise.reject();
|
|
3102
|
+
}
|
|
3103
|
+
for (const rule of requiredRules) {
|
|
3104
|
+
if (value.some((item) => isNull(item[rule.field]))) {
|
|
3105
|
+
return Promise.reject();
|
|
3106
|
+
}
|
|
3107
|
+
}
|
|
3108
|
+
return Promise.resolve();
|
|
3109
|
+
}
|
|
2954
3110
|
var table = {
|
|
2955
3111
|
name: 'table',
|
|
2956
3112
|
rule(data, extraConfig) {
|
|
@@ -2965,9 +3121,19 @@ var table = {
|
|
|
2965
3121
|
inject: true,
|
|
2966
3122
|
on: {
|
|
2967
3123
|
change(inject, value) {
|
|
2968
|
-
inject.self
|
|
3124
|
+
const rule = inject.self;
|
|
3125
|
+
rule.value = value;
|
|
3126
|
+
inject.api.emit('table-change', inject.api.bind());
|
|
2969
3127
|
},
|
|
2970
3128
|
},
|
|
3129
|
+
validate: [
|
|
3130
|
+
{
|
|
3131
|
+
validator(rule, value) {
|
|
3132
|
+
return validator(data, value);
|
|
3133
|
+
},
|
|
3134
|
+
message: '请检查必填项',
|
|
3135
|
+
},
|
|
3136
|
+
],
|
|
2971
3137
|
};
|
|
2972
3138
|
},
|
|
2973
3139
|
rowRule(data, extraConfig) {
|
|
@@ -2983,8 +3149,17 @@ var table = {
|
|
|
2983
3149
|
on: {
|
|
2984
3150
|
change(inject, value) {
|
|
2985
3151
|
inject.self.value = value;
|
|
3152
|
+
inject.api.emit('table-change', inject.api.bind());
|
|
2986
3153
|
},
|
|
2987
3154
|
},
|
|
3155
|
+
validate: [
|
|
3156
|
+
{
|
|
3157
|
+
validator(rule, value) {
|
|
3158
|
+
return validator(data, value);
|
|
3159
|
+
},
|
|
3160
|
+
message: '请检查必填项',
|
|
3161
|
+
},
|
|
3162
|
+
],
|
|
2988
3163
|
col: {
|
|
2989
3164
|
span: 24,
|
|
2990
3165
|
},
|
|
@@ -3305,7 +3480,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
3305
3480
|
"model-value": __props.value,
|
|
3306
3481
|
option,
|
|
3307
3482
|
rule: rule.value,
|
|
3308
|
-
"onUpdate:modelValue": handleValue
|
|
3483
|
+
"onUpdate:modelValue": handleValue,
|
|
3484
|
+
onTableChange: handleValue
|
|
3309
3485
|
}, null, 8, ["api", "model-value", "rule"])
|
|
3310
3486
|
], 64);
|
|
3311
3487
|
};
|
|
@@ -1354,6 +1354,7 @@ var date = {
|
|
|
1354
1354
|
props: {
|
|
1355
1355
|
placeholder: '请选择',
|
|
1356
1356
|
format: 'YYYY-MM',
|
|
1357
|
+
valueFormat: 'YYYY-MM',
|
|
1357
1358
|
},
|
|
1358
1359
|
config: {
|
|
1359
1360
|
propsFields: Object.values(fieldsMap$b),
|
|
@@ -1404,6 +1405,12 @@ var date = {
|
|
|
1404
1405
|
},
|
|
1405
1406
|
],
|
|
1406
1407
|
value: rule.props.format,
|
|
1408
|
+
inject: true,
|
|
1409
|
+
on: {
|
|
1410
|
+
change({ api, self }, format) {
|
|
1411
|
+
api.emit('props.valueFormat', format.value);
|
|
1412
|
+
},
|
|
1413
|
+
},
|
|
1407
1414
|
},
|
|
1408
1415
|
{
|
|
1409
1416
|
type: 'input',
|
|
@@ -917,6 +917,7 @@ declare const BmStaffsSelector: import("bm-admin-ui/es/utils/with-install").SFCW
|
|
|
917
917
|
}> | null | undefined)[]>;
|
|
918
918
|
isFulfill: import("vue").Ref<boolean>;
|
|
919
919
|
changeTreeCheck: (checkedKeys: any) => void;
|
|
920
|
+
departmentSelect: import("vue").Ref<never[]>;
|
|
920
921
|
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("update:selected" | "fetchList")[], "update:selected" | "fetchList", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
921
922
|
limit: {
|
|
922
923
|
type: NumberConstructor;
|
|
@@ -156,7 +156,9 @@ const _sfc_main$3 = defineComponent({
|
|
|
156
156
|
},
|
|
157
157
|
{ deep: true }
|
|
158
158
|
);
|
|
159
|
+
const departmentSelect = ref([]);
|
|
159
160
|
function changeTreeCheck(checkedKeys) {
|
|
161
|
+
departmentSelect.value = checkedKeys;
|
|
160
162
|
let flatMap = selectState.dataMap;
|
|
161
163
|
let curlistKeys = selectState.curlistKeys;
|
|
162
164
|
let hadselected = new Set(selectState.multipDepartment);
|
|
@@ -181,6 +183,7 @@ const _sfc_main$3 = defineComponent({
|
|
|
181
183
|
}
|
|
182
184
|
return {
|
|
183
185
|
changeTreeCheck,
|
|
186
|
+
departmentSelect,
|
|
184
187
|
...toRefs(state),
|
|
185
188
|
...toRefs(selectState),
|
|
186
189
|
list,
|
|
@@ -261,7 +264,7 @@ function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
261
264
|
}), 128))
|
|
262
265
|
], 64)) : _ctx.isTree ? (openBlock(), createBlock(_component_ATree, {
|
|
263
266
|
key: 1,
|
|
264
|
-
"checked-keys": _ctx.
|
|
267
|
+
"checked-keys": _ctx.departmentSelect,
|
|
265
268
|
checkable: "",
|
|
266
269
|
"tree-data": _ctx.list,
|
|
267
270
|
onCheck: _ctx.changeTreeCheck
|
|
@@ -35,6 +35,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
35
35
|
}> | null | undefined)[]>;
|
|
36
36
|
isFulfill: import("vue").Ref<boolean>;
|
|
37
37
|
changeTreeCheck: (checkedKeys: any) => void;
|
|
38
|
+
departmentSelect: import("vue").Ref<never[]>;
|
|
38
39
|
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("update:selected" | "fetchList")[], "update:selected" | "fetchList", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
39
40
|
limit: {
|
|
40
41
|
type: NumberConstructor;
|
|
@@ -917,6 +917,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
917
917
|
}> | null | undefined)[]>;
|
|
918
918
|
isFulfill: import("vue").Ref<boolean>;
|
|
919
919
|
changeTreeCheck: (checkedKeys: any) => void;
|
|
920
|
+
departmentSelect: import("vue").Ref<never[]>;
|
|
920
921
|
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("update:selected" | "fetchList")[], "update:selected" | "fetchList", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
921
922
|
limit: {
|
|
922
923
|
type: NumberConstructor;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function isNull(value: any): boolean;
|