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
|
@@ -11,12 +11,15 @@ var BmStaffsSelector = require('bm-admin-ui/lib/components/staffs-selector');
|
|
|
11
11
|
var components = require('bm-admin-ui/lib/components');
|
|
12
12
|
var iconsVue = require('@ant-design/icons-vue');
|
|
13
13
|
var lodashEs = require('lodash-es');
|
|
14
|
+
var customParseFormat = require('dayjs/plugin/customParseFormat');
|
|
15
|
+
var isNull = require('bm-admin-ui/lib/utils/isNull');
|
|
14
16
|
|
|
15
17
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
16
18
|
|
|
17
19
|
var dayjs__default = /*#__PURE__*/_interopDefaultLegacy(dayjs);
|
|
18
20
|
var Picture__default = /*#__PURE__*/_interopDefaultLegacy(Picture);
|
|
19
21
|
var BmStaffsSelector__default = /*#__PURE__*/_interopDefaultLegacy(BmStaffsSelector);
|
|
22
|
+
var customParseFormat__default = /*#__PURE__*/_interopDefaultLegacy(customParseFormat);
|
|
20
23
|
|
|
21
24
|
const fieldRatioMap = {
|
|
22
25
|
'25%': 6,
|
|
@@ -812,13 +815,17 @@ const _sfc_main$a = /* @__PURE__ */ vue.defineComponent({
|
|
|
812
815
|
val.map((item) => ({
|
|
813
816
|
[fieldNames.value]: item.key,
|
|
814
817
|
[fieldNames.label]: item.title,
|
|
815
|
-
|
|
818
|
+
key: item.key,
|
|
819
|
+
title: item.title
|
|
816
820
|
}))
|
|
817
821
|
);
|
|
818
822
|
}
|
|
819
823
|
function handleAdd() {
|
|
820
824
|
visible.value = true;
|
|
821
825
|
}
|
|
826
|
+
function getPopupContainer() {
|
|
827
|
+
return document.body;
|
|
828
|
+
}
|
|
822
829
|
vue.watch(
|
|
823
830
|
() => props.defaultSelected,
|
|
824
831
|
(val) => {
|
|
@@ -838,9 +845,12 @@ const _sfc_main$a = /* @__PURE__ */ vue.defineComponent({
|
|
|
838
845
|
"onUpdate:list": _cache[0] || (_cache[0] = ($event) => selected.value = $event),
|
|
839
846
|
"show-empty-btn": false,
|
|
840
847
|
disabled: __props.disabled,
|
|
848
|
+
"tool-tip-props": {
|
|
849
|
+
getPopupContainer
|
|
850
|
+
},
|
|
841
851
|
"show-empty": "",
|
|
842
852
|
onAddClick: handleAdd
|
|
843
|
-
}, null, 8, ["list", "disabled"]),
|
|
853
|
+
}, null, 8, ["list", "disabled", "tool-tip-props"]),
|
|
844
854
|
vue.createVNode(vue.unref(BmStaffsSelector__default["default"]), {
|
|
845
855
|
select: selected.value,
|
|
846
856
|
"onUpdate:select": _cache[1] || (_cache[1] = ($event) => selected.value = $event),
|
|
@@ -948,6 +958,7 @@ var people = {
|
|
|
948
958
|
minWidth: data.config.fieldRatio,
|
|
949
959
|
slots: {
|
|
950
960
|
default({ row }) {
|
|
961
|
+
var _a;
|
|
951
962
|
return vue.h(StaffSelector, {
|
|
952
963
|
title: '添加员工',
|
|
953
964
|
mode: data.props.limit ? 'radio' : 'multiple',
|
|
@@ -962,6 +973,7 @@ var people = {
|
|
|
962
973
|
return yield extraConfig.people.fetch(params);
|
|
963
974
|
});
|
|
964
975
|
},
|
|
976
|
+
fieldNames: (_a = extraConfig.people) === null || _a === void 0 ? void 0 : _a.fieldNames,
|
|
965
977
|
});
|
|
966
978
|
},
|
|
967
979
|
},
|
|
@@ -1284,11 +1296,13 @@ const _sfc_main$7 = /* @__PURE__ */ vue.defineComponent({
|
|
|
1284
1296
|
"extraConfig",
|
|
1285
1297
|
"disabled",
|
|
1286
1298
|
"disabledTable",
|
|
1287
|
-
"hidden"
|
|
1299
|
+
"hidden",
|
|
1300
|
+
"formCreateInject"
|
|
1288
1301
|
],
|
|
1289
1302
|
emits: ["change"],
|
|
1290
1303
|
setup(__props, { emit: emits }) {
|
|
1291
1304
|
const props = __props;
|
|
1305
|
+
dayjs__default["default"].extend(customParseFormat__default["default"]);
|
|
1292
1306
|
const productInfoKeyMap = {
|
|
1293
1307
|
\u5546\u54C1\u540D\u79F0: "productName",
|
|
1294
1308
|
\u5546\u54C1\u7B80\u79F0: "productShortName",
|
|
@@ -1308,6 +1322,9 @@ const _sfc_main$7 = /* @__PURE__ */ vue.defineComponent({
|
|
|
1308
1322
|
const config = vue.computed(() => ({
|
|
1309
1323
|
columns: [...columns],
|
|
1310
1324
|
data: [...data],
|
|
1325
|
+
columnConfig: {
|
|
1326
|
+
resizable: true
|
|
1327
|
+
},
|
|
1311
1328
|
checkboxConfig: {
|
|
1312
1329
|
trigger: "cell",
|
|
1313
1330
|
checkMethod() {
|
|
@@ -1346,12 +1363,15 @@ const _sfc_main$7 = /* @__PURE__ */ vue.defineComponent({
|
|
|
1346
1363
|
return result;
|
|
1347
1364
|
}, {}) || {}
|
|
1348
1365
|
);
|
|
1366
|
+
const productInputSlots = vue.reactive([]);
|
|
1367
|
+
const formData = vue.computed(() => props.formCreateInject.api.bind());
|
|
1349
1368
|
function isShow(key) {
|
|
1350
1369
|
return props.rule.config.tableAdvancedFeatures.includes(key);
|
|
1351
1370
|
}
|
|
1352
1371
|
function initConfig() {
|
|
1353
1372
|
columns.splice(0, columns.length);
|
|
1354
1373
|
data.splice(0, data.length);
|
|
1374
|
+
productInputSlots.splice(0, productInputSlots.length);
|
|
1355
1375
|
const childRules = lodashEs.cloneDeep(props.rule.config.childRules);
|
|
1356
1376
|
const value = props.rule.value;
|
|
1357
1377
|
if (deleteFeature.value && !props.hidden) {
|
|
@@ -1405,6 +1425,7 @@ const _sfc_main$7 = /* @__PURE__ */ vue.defineComponent({
|
|
|
1405
1425
|
const productName = `\u5546\u54C1${String(++productIndex).padStart(2, "0")}`;
|
|
1406
1426
|
const field = rule.field;
|
|
1407
1427
|
const associatedFields = rule.config.associatedFields;
|
|
1428
|
+
productInputSlots.push(rule);
|
|
1408
1429
|
const columns2 = [
|
|
1409
1430
|
{
|
|
1410
1431
|
field,
|
|
@@ -1412,19 +1433,7 @@ const _sfc_main$7 = /* @__PURE__ */ vue.defineComponent({
|
|
|
1412
1433
|
headerClassName: rule.effect.required ? "is-required" : "",
|
|
1413
1434
|
minWidth: "138px",
|
|
1414
1435
|
slots: {
|
|
1415
|
-
default
|
|
1416
|
-
return vue.h(antDesignVue.Input, {
|
|
1417
|
-
value: row[field],
|
|
1418
|
-
placeholder: "\u8BF7\u8F93\u5165",
|
|
1419
|
-
disabled: rule.disabled,
|
|
1420
|
-
"onUpdate:value": (value) => {
|
|
1421
|
-
row[field] = value;
|
|
1422
|
-
},
|
|
1423
|
-
onPressEnter() {
|
|
1424
|
-
queryProductInfo(rule, row);
|
|
1425
|
-
}
|
|
1426
|
-
});
|
|
1427
|
-
}
|
|
1436
|
+
default: rule.field
|
|
1428
1437
|
}
|
|
1429
1438
|
}
|
|
1430
1439
|
];
|
|
@@ -1496,13 +1505,15 @@ const _sfc_main$7 = /* @__PURE__ */ vue.defineComponent({
|
|
|
1496
1505
|
function emitChange() {
|
|
1497
1506
|
emits("change", data);
|
|
1498
1507
|
}
|
|
1499
|
-
function queryProductInfo(rule, row) {
|
|
1508
|
+
async function queryProductInfo(rule, row) {
|
|
1500
1509
|
const field = rule.field;
|
|
1501
1510
|
const associatedFields = rule?.config?.associatedFields;
|
|
1502
|
-
|
|
1503
|
-
associatedFields.
|
|
1504
|
-
|
|
1505
|
-
|
|
1511
|
+
return await props.extraConfig.product.fetch({ productCode: row[field] }).then((data2) => {
|
|
1512
|
+
if (associatedFields.length)
|
|
1513
|
+
associatedFields.forEach((item) => {
|
|
1514
|
+
row[field + item.value] = data2 ? data2[productInfoKeyMap[item.value]] : void 0;
|
|
1515
|
+
});
|
|
1516
|
+
return data2;
|
|
1506
1517
|
});
|
|
1507
1518
|
}
|
|
1508
1519
|
function handleChange(e) {
|
|
@@ -1519,7 +1530,14 @@ const _sfc_main$7 = /* @__PURE__ */ vue.defineComponent({
|
|
|
1519
1530
|
});
|
|
1520
1531
|
result.push(rowData);
|
|
1521
1532
|
});
|
|
1522
|
-
validate(result)
|
|
1533
|
+
result.length && validate(result).then((result2) => {
|
|
1534
|
+
data.splice(0, data.length, ...result2);
|
|
1535
|
+
}).catch((error) => {
|
|
1536
|
+
antDesignVue.message.error("\u5B58\u5728\u9519\u8BEF\u6570\u636E\uFF0C\u5BFC\u5165\u5931\u8D25");
|
|
1537
|
+
console.log("---------------");
|
|
1538
|
+
console.log(error);
|
|
1539
|
+
console.log("---------------");
|
|
1540
|
+
});
|
|
1523
1541
|
e.target.value = "";
|
|
1524
1542
|
};
|
|
1525
1543
|
file && reader.readAsText(file, "GB2312");
|
|
@@ -1530,64 +1548,139 @@ const _sfc_main$7 = /* @__PURE__ */ vue.defineComponent({
|
|
|
1530
1548
|
function parseCsv(result) {
|
|
1531
1549
|
let data2 = [];
|
|
1532
1550
|
if (result) {
|
|
1533
|
-
|
|
1551
|
+
const rows = result.split("\r\n");
|
|
1552
|
+
const columnsTxt = rows[0];
|
|
1553
|
+
const columnArr = columnsTxt.includes(" ") ? columnsTxt.split(" ") : columnsTxt.split(",");
|
|
1554
|
+
if (columnArr.length !== columns.filter((c) => isValidColumn(c)).length) {
|
|
1555
|
+
antDesignVue.message.error("\u5BFC\u5165\u7684\u6A21\u677F\u51FA\u9519");
|
|
1556
|
+
} else {
|
|
1557
|
+
data2 = rows.slice(1).filter((item) => item).map(
|
|
1558
|
+
(item) => item.includes(" ") ? item.split(" ") : item.split(",")
|
|
1559
|
+
);
|
|
1560
|
+
}
|
|
1534
1561
|
}
|
|
1535
1562
|
return data2;
|
|
1536
1563
|
}
|
|
1537
|
-
function validate(rowData) {
|
|
1564
|
+
async function validate(rowData) {
|
|
1565
|
+
let error = "";
|
|
1538
1566
|
const validColumns = columns.filter((c) => isValidColumn(c));
|
|
1539
1567
|
for (const row of rowData) {
|
|
1540
1568
|
for (const { field } of validColumns) {
|
|
1541
1569
|
const rule = childRulesMap.value[field];
|
|
1542
|
-
|
|
1570
|
+
const title = rule?.title?.title;
|
|
1571
|
+
if (!rule)
|
|
1572
|
+
break;
|
|
1573
|
+
let value = row[field] || "";
|
|
1543
1574
|
const txtFormatFn = rule.config?.txtFormatFn;
|
|
1544
1575
|
if (rule.effect.required && !value) {
|
|
1576
|
+
error = `${title}\u4E0D\u80FD\u4E3A\u7A7A`;
|
|
1545
1577
|
break;
|
|
1546
1578
|
}
|
|
1547
1579
|
if (txtFormatFn && !txtFormatFn(value)) {
|
|
1580
|
+
error = `${title}\u586B\u5199\u89C4\u5219\u4E0D\u6B63\u786E`;
|
|
1548
1581
|
break;
|
|
1549
1582
|
}
|
|
1550
1583
|
if (rule.name === "input") {
|
|
1551
1584
|
const maxlength = rule.props.maxlength || 200;
|
|
1552
1585
|
if (value.length > maxlength) {
|
|
1586
|
+
error = `${title}\u5B57\u6570\u8D85\u51FA`;
|
|
1553
1587
|
break;
|
|
1554
1588
|
}
|
|
1555
1589
|
}
|
|
1556
1590
|
if (rule.name === "textarea") {
|
|
1557
1591
|
if (value.length > 5e3) {
|
|
1592
|
+
error = `${title}\u5B57\u6570\u8D85\u51FA`;
|
|
1558
1593
|
break;
|
|
1559
1594
|
}
|
|
1560
1595
|
}
|
|
1561
1596
|
if (rule.name === "numInput") {
|
|
1562
1597
|
if (rule.config.format === 1) {
|
|
1563
1598
|
if (!value.includes("%")) {
|
|
1599
|
+
error = `${title}\u4E0D\u4E3A\u767E\u5206\u6570`;
|
|
1564
1600
|
break;
|
|
1601
|
+
} else {
|
|
1602
|
+
value = value.replaceAll("%", "");
|
|
1565
1603
|
}
|
|
1566
1604
|
} else {
|
|
1567
|
-
if (
|
|
1605
|
+
if (isNaN(value)) {
|
|
1606
|
+
error = `${title}\u4E0D\u4E3A\u6570\u5B57\u7C7B\u578B`;
|
|
1568
1607
|
break;
|
|
1569
1608
|
}
|
|
1570
1609
|
}
|
|
1571
1610
|
if (rule.config.decimalPlaces !== void 0 && value.split(".")[1]?.length > rule.config.decimalPlaces) {
|
|
1611
|
+
error = `${title}\u4FDD\u7559\u7684\u5C0F\u6570\u70B9\u4E3A\u4E0D\u6B63\u786E`;
|
|
1572
1612
|
break;
|
|
1573
1613
|
}
|
|
1574
1614
|
}
|
|
1575
1615
|
if (rule.name === "radio") {
|
|
1576
1616
|
if (rule.options.every((item) => item.value !== value)) {
|
|
1617
|
+
error = `${title}\u4E0D\u5B58\u5728\u8BE5\u9009\u9879`;
|
|
1577
1618
|
break;
|
|
1578
1619
|
}
|
|
1579
1620
|
}
|
|
1580
1621
|
if (rule.name === "checkbox") {
|
|
1581
1622
|
value = value.split("\u3001");
|
|
1582
1623
|
if (value.some((item) => rule.options.every((r) => r.value !== item))) {
|
|
1624
|
+
error = `${title}\u5B58\u5728\u4E0D\u5B58\u5728\u7684\u9009\u9879\u503C`;
|
|
1583
1625
|
break;
|
|
1584
1626
|
}
|
|
1585
|
-
row[field] = value;
|
|
1586
1627
|
}
|
|
1587
|
-
if (rule.name === "date")
|
|
1628
|
+
if (rule.name === "date") {
|
|
1629
|
+
if (!dayjs__default["default"](value, rule.props.format, true).isValid()) {
|
|
1630
|
+
error = `${title}\u4E0D\u4E3A\u6709\u6548\u65F6\u671F\u6216\u4E0D\u7B26\u5408\u65E5\u671F\u683C\u5F0F`;
|
|
1631
|
+
break;
|
|
1632
|
+
}
|
|
1633
|
+
}
|
|
1634
|
+
if (rule.name === "dateRange") {
|
|
1635
|
+
value = value.split("~");
|
|
1636
|
+
if (value.some((item) => !dayjs__default["default"](item, rule.props.format, true).isValid())) {
|
|
1637
|
+
error = `${title}\u4E0D\u4E3A\u6709\u6548\u65F6\u671F\u6216\u4E0D\u7B26\u5408\u65E5\u671F\u683C\u5F0F`;
|
|
1638
|
+
break;
|
|
1639
|
+
}
|
|
1640
|
+
}
|
|
1641
|
+
if (rule.name === "people" || rule.name === "department") {
|
|
1642
|
+
const limit = rule.props.limit;
|
|
1643
|
+
value = value.split("\u3001").map((item) => ({}));
|
|
1644
|
+
if (limit === 1 && value.length > limit) {
|
|
1645
|
+
error = `${title}\u6700\u591A\u53EA\u80FD\u9009\u4E00\u4E2A`;
|
|
1646
|
+
break;
|
|
1647
|
+
}
|
|
1648
|
+
}
|
|
1649
|
+
if (rule.name === "product") {
|
|
1650
|
+
const productInfo = await queryProductInfo(rule, row);
|
|
1651
|
+
if (!productInfo) {
|
|
1652
|
+
error = `${title}\u67E5\u8BE2\u7684\u5546\u54C1\u4E0D\u5B58\u5728`;
|
|
1653
|
+
break;
|
|
1654
|
+
}
|
|
1655
|
+
}
|
|
1656
|
+
if (rule.name === "shop") {
|
|
1657
|
+
value = {
|
|
1658
|
+
value: Number(value)
|
|
1659
|
+
};
|
|
1660
|
+
}
|
|
1661
|
+
row[field] = value;
|
|
1588
1662
|
}
|
|
1663
|
+
if (error)
|
|
1664
|
+
break;
|
|
1665
|
+
}
|
|
1666
|
+
if (error) {
|
|
1667
|
+
return Promise.reject(error);
|
|
1668
|
+
} else {
|
|
1669
|
+
return Promise.resolve(rowData);
|
|
1589
1670
|
}
|
|
1590
1671
|
}
|
|
1672
|
+
function pruductInputDisabled(shopField) {
|
|
1673
|
+
if (!shopField)
|
|
1674
|
+
return false;
|
|
1675
|
+
return !formData.value[shopField];
|
|
1676
|
+
}
|
|
1677
|
+
function handlePressEnter(rule, row) {
|
|
1678
|
+
queryProductInfo(rule, row).then((data2) => {
|
|
1679
|
+
if (!data2) {
|
|
1680
|
+
row[rule.field] = "";
|
|
1681
|
+
}
|
|
1682
|
+
});
|
|
1683
|
+
}
|
|
1591
1684
|
vue.watch(
|
|
1592
1685
|
() => props.rule,
|
|
1593
1686
|
() => {
|
|
@@ -1670,7 +1763,7 @@ const _sfc_main$7 = /* @__PURE__ */ vue.defineComponent({
|
|
|
1670
1763
|
ref_key: "bmFloatTableRef",
|
|
1671
1764
|
ref: bmFloatTableRef,
|
|
1672
1765
|
config: vue.unref(config)
|
|
1673
|
-
}, {
|
|
1766
|
+
}, vue.createSlots({
|
|
1674
1767
|
floatHandle: vue.withCtx(({ row, rowIndex }) => [
|
|
1675
1768
|
vue.unref(copyFeature) ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
|
|
1676
1769
|
vue.createVNode(vue.unref(antDesignVue.Button), {
|
|
@@ -1698,8 +1791,23 @@ const _sfc_main$7 = /* @__PURE__ */ vue.defineComponent({
|
|
|
1698
1791
|
_: 2
|
|
1699
1792
|
}, 1032, ["disabled", "onClick"])
|
|
1700
1793
|
]),
|
|
1701
|
-
_:
|
|
1702
|
-
},
|
|
1794
|
+
_: 2
|
|
1795
|
+
}, [
|
|
1796
|
+
vue.renderList(productInputSlots, (item) => {
|
|
1797
|
+
return {
|
|
1798
|
+
name: item.field,
|
|
1799
|
+
fn: vue.withCtx(({ row }) => [
|
|
1800
|
+
vue.createVNode(vue.unref(antDesignVue.Input), {
|
|
1801
|
+
value: row[item.field],
|
|
1802
|
+
"onUpdate:value": ($event) => row[item.field] = $event,
|
|
1803
|
+
placeholder: "\u8BF7\u8F93\u5165",
|
|
1804
|
+
disabled: item.disabled || pruductInputDisabled(item.config?.dataFiltering),
|
|
1805
|
+
onPressEnter: ($event) => handlePressEnter(item, row)
|
|
1806
|
+
}, null, 8, ["value", "onUpdate:value", "disabled", "onPressEnter"])
|
|
1807
|
+
])
|
|
1808
|
+
};
|
|
1809
|
+
})
|
|
1810
|
+
]), 1032, ["config"])
|
|
1703
1811
|
]),
|
|
1704
1812
|
_: 1
|
|
1705
1813
|
})
|
|
@@ -1904,7 +2012,8 @@ const _sfc_main$6 = /* @__PURE__ */ vue.defineComponent({
|
|
|
1904
2012
|
return void 0;
|
|
1905
2013
|
}
|
|
1906
2014
|
function handleTableDataChange(value) {
|
|
1907
|
-
getAcitvePane()
|
|
2015
|
+
const activePane2 = getAcitvePane();
|
|
2016
|
+
activePane2.tableData = value;
|
|
1908
2017
|
}
|
|
1909
2018
|
function emitChange() {
|
|
1910
2019
|
emits("change", {
|
|
@@ -1915,7 +2024,8 @@ const _sfc_main$6 = /* @__PURE__ */ vue.defineComponent({
|
|
|
1915
2024
|
tempIdSelected: pane.tempSelected.templateCode || pane.tempIdSelected,
|
|
1916
2025
|
templateName: pane.tempSelected?.templateName || pane.templateName,
|
|
1917
2026
|
tableData: pane.tableData,
|
|
1918
|
-
uploadList: pane.uploadList
|
|
2027
|
+
uploadList: pane.uploadList,
|
|
2028
|
+
tableRequiredFields: pane.tableRule?.config?.childRules?.filter((rule) => rule.effect?.required).map((rule) => rule.field)
|
|
1919
2029
|
}))
|
|
1920
2030
|
});
|
|
1921
2031
|
}
|
|
@@ -2253,6 +2363,30 @@ var materialTemp = {
|
|
|
2253
2363
|
inject.self.value = value;
|
|
2254
2364
|
},
|
|
2255
2365
|
},
|
|
2366
|
+
validate: [
|
|
2367
|
+
{
|
|
2368
|
+
validator(rule, value) {
|
|
2369
|
+
if (isNull.isNull(value)) {
|
|
2370
|
+
return Promise.reject();
|
|
2371
|
+
}
|
|
2372
|
+
const panes = value.panes;
|
|
2373
|
+
for (const pane of panes) {
|
|
2374
|
+
if (!pane.tempIdSelected) {
|
|
2375
|
+
return Promise.reject();
|
|
2376
|
+
}
|
|
2377
|
+
if (pane.tableRequiredFields) {
|
|
2378
|
+
for (const field of pane.tableRequiredFields) {
|
|
2379
|
+
if (pane.tableData.some((row) => isNull.isNull(row[field]))) {
|
|
2380
|
+
return Promise.reject();
|
|
2381
|
+
}
|
|
2382
|
+
}
|
|
2383
|
+
}
|
|
2384
|
+
}
|
|
2385
|
+
return Promise.resolve();
|
|
2386
|
+
},
|
|
2387
|
+
message: '请检查必填项',
|
|
2388
|
+
},
|
|
2389
|
+
],
|
|
2256
2390
|
},
|
|
2257
2391
|
],
|
|
2258
2392
|
class: 'bm-fc-module-widget',
|
|
@@ -2270,7 +2404,8 @@ const _sfc_main$5 = /* @__PURE__ */ vue.defineComponent({
|
|
|
2270
2404
|
"required",
|
|
2271
2405
|
"extraConfig",
|
|
2272
2406
|
"defalutValue",
|
|
2273
|
-
"disabled"
|
|
2407
|
+
"disabled",
|
|
2408
|
+
"formCreateInject"
|
|
2274
2409
|
],
|
|
2275
2410
|
emits: ["change"],
|
|
2276
2411
|
setup(__props, { emit: emits }) {
|
|
@@ -2285,8 +2420,9 @@ const _sfc_main$5 = /* @__PURE__ */ vue.defineComponent({
|
|
|
2285
2420
|
\u5546\u54C1\u5355\u4F4D: "unit"
|
|
2286
2421
|
};
|
|
2287
2422
|
const unitMap = ["\u652F", "\u74F6", "\u5957", "\u7EC4", "\u7BB1", "\u4E2A", "\u5F20"];
|
|
2423
|
+
const formData = vue.computed(() => props.formCreateInject.api.bind());
|
|
2288
2424
|
async function fetch(value) {
|
|
2289
|
-
productInfo.value = await props.extraConfig.fetch({
|
|
2425
|
+
productInfo.value = await props.extraConfig.product.fetch({
|
|
2290
2426
|
productCode: value,
|
|
2291
2427
|
filterByShopcode: props.dataFiltering
|
|
2292
2428
|
}) || {};
|
|
@@ -2302,6 +2438,9 @@ const _sfc_main$5 = /* @__PURE__ */ vue.defineComponent({
|
|
|
2302
2438
|
function emitChange(value) {
|
|
2303
2439
|
emits("change", value);
|
|
2304
2440
|
}
|
|
2441
|
+
function inputDisbale(shopField) {
|
|
2442
|
+
return shopField && !formData.value[shopField];
|
|
2443
|
+
}
|
|
2305
2444
|
vue.watch(
|
|
2306
2445
|
() => props.defalutValue,
|
|
2307
2446
|
(val) => {
|
|
@@ -2334,7 +2473,7 @@ const _sfc_main$5 = /* @__PURE__ */ vue.defineComponent({
|
|
|
2334
2473
|
vue.createVNode(vue.unref(antDesignVue.Input), {
|
|
2335
2474
|
placeholder: "\u8BF7\u8F93\u5165",
|
|
2336
2475
|
value: __props.defalutValue,
|
|
2337
|
-
disabled: __props.disabled,
|
|
2476
|
+
disabled: __props.disabled || inputDisbale(__props.dataFiltering),
|
|
2338
2477
|
onPressEnter: handleBlur
|
|
2339
2478
|
}, null, 8, ["value", "disabled"])
|
|
2340
2479
|
]),
|
|
@@ -2368,7 +2507,8 @@ const _sfc_main$5 = /* @__PURE__ */ vue.defineComponent({
|
|
|
2368
2507
|
getValue(field.value) ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
|
|
2369
2508
|
field.value === "\u5546\u54C1\u56FE\u7247" ? (vue.openBlock(), vue.createElementBlock("img", {
|
|
2370
2509
|
key: 0,
|
|
2371
|
-
|
|
2510
|
+
class: "bm-fc-form-item__img",
|
|
2511
|
+
src: __props.extraConfig.common.previewImg(getValue(field.value))
|
|
2372
2512
|
}, null, 8, _hoisted_2$2)) : field.value === "\u5546\u54C1\u5355\u4F4D" ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
|
|
2373
2513
|
vue.createTextVNode(vue.toDisplayString(unitMap[getValue(field.value)]), 1)
|
|
2374
2514
|
], 64)) : (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 2 }, [
|
|
@@ -2409,7 +2549,7 @@ var product = {
|
|
|
2409
2549
|
required: data.effect.required,
|
|
2410
2550
|
associatedFields: data.config.associatedFields,
|
|
2411
2551
|
dataFiltering: data.config.dataFiltering,
|
|
2412
|
-
extraConfig: extraConfig
|
|
2552
|
+
extraConfig: extraConfig,
|
|
2413
2553
|
defalutValue: data.value,
|
|
2414
2554
|
},
|
|
2415
2555
|
inject: true,
|
|
@@ -2423,7 +2563,7 @@ var product = {
|
|
|
2423
2563
|
},
|
|
2424
2564
|
};
|
|
2425
2565
|
},
|
|
2426
|
-
rowRule(data) {
|
|
2566
|
+
rowRule(data, extraConfig) {
|
|
2427
2567
|
return {
|
|
2428
2568
|
type: 'ProductInfo',
|
|
2429
2569
|
component: ProductInfo,
|
|
@@ -2436,6 +2576,7 @@ var product = {
|
|
|
2436
2576
|
associatedFields: data.config.associatedFields,
|
|
2437
2577
|
dataFiltering: data.config.dataFiltering,
|
|
2438
2578
|
defalutValue: data.value,
|
|
2579
|
+
extraConfig: extraConfig,
|
|
2439
2580
|
},
|
|
2440
2581
|
inject: true,
|
|
2441
2582
|
on: {
|
|
@@ -2864,7 +3005,7 @@ var department = {
|
|
|
2864
3005
|
return yield extraConfig.department.fetch();
|
|
2865
3006
|
});
|
|
2866
3007
|
},
|
|
2867
|
-
fieldNames: (_a = extraConfig.
|
|
3008
|
+
fieldNames: (_a = extraConfig.department) === null || _a === void 0 ? void 0 : _a.fieldNames,
|
|
2868
3009
|
},
|
|
2869
3010
|
effect: {
|
|
2870
3011
|
required: data.effect.required && '请选择',
|
|
@@ -2907,7 +3048,7 @@ var department = {
|
|
|
2907
3048
|
return yield extraConfig.department.fetch();
|
|
2908
3049
|
});
|
|
2909
3050
|
},
|
|
2910
|
-
fieldNames: (_a = extraConfig.
|
|
3051
|
+
fieldNames: (_a = extraConfig.department) === null || _a === void 0 ? void 0 : _a.fieldNames,
|
|
2911
3052
|
},
|
|
2912
3053
|
effect: {
|
|
2913
3054
|
required: data.effect.required && '请选择',
|
|
@@ -2938,6 +3079,7 @@ var department = {
|
|
|
2938
3079
|
minWidth: data.config.fieldRatio,
|
|
2939
3080
|
slots: {
|
|
2940
3081
|
default({ row }) {
|
|
3082
|
+
var _a;
|
|
2941
3083
|
return vue.h(StaffSelector, {
|
|
2942
3084
|
title: '添加部门',
|
|
2943
3085
|
mode: data.props.limit ? 'radio' : 'multiple',
|
|
@@ -2954,6 +3096,7 @@ var department = {
|
|
|
2954
3096
|
return yield extraConfig.department.fetch(params);
|
|
2955
3097
|
});
|
|
2956
3098
|
},
|
|
3099
|
+
fieldNames: (_a = extraConfig.department) === null || _a === void 0 ? void 0 : _a.fieldNames,
|
|
2957
3100
|
});
|
|
2958
3101
|
},
|
|
2959
3102
|
},
|
|
@@ -2961,6 +3104,20 @@ var department = {
|
|
|
2961
3104
|
},
|
|
2962
3105
|
};
|
|
2963
3106
|
|
|
3107
|
+
function validator(rule, value) {
|
|
3108
|
+
var _a;
|
|
3109
|
+
const childRules = ((_a = rule.config) === null || _a === void 0 ? void 0 : _a.childRules) || [];
|
|
3110
|
+
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; });
|
|
3111
|
+
if (requiredRules.length && isNull.isNull(value)) {
|
|
3112
|
+
return Promise.reject();
|
|
3113
|
+
}
|
|
3114
|
+
for (const rule of requiredRules) {
|
|
3115
|
+
if (value.some((item) => isNull.isNull(item[rule.field]))) {
|
|
3116
|
+
return Promise.reject();
|
|
3117
|
+
}
|
|
3118
|
+
}
|
|
3119
|
+
return Promise.resolve();
|
|
3120
|
+
}
|
|
2964
3121
|
var table = {
|
|
2965
3122
|
name: 'table',
|
|
2966
3123
|
rule(data, extraConfig) {
|
|
@@ -2975,9 +3132,19 @@ var table = {
|
|
|
2975
3132
|
inject: true,
|
|
2976
3133
|
on: {
|
|
2977
3134
|
change(inject, value) {
|
|
2978
|
-
inject.self
|
|
3135
|
+
const rule = inject.self;
|
|
3136
|
+
rule.value = value;
|
|
3137
|
+
inject.api.emit('table-change', inject.api.bind());
|
|
2979
3138
|
},
|
|
2980
3139
|
},
|
|
3140
|
+
validate: [
|
|
3141
|
+
{
|
|
3142
|
+
validator(rule, value) {
|
|
3143
|
+
return validator(data, value);
|
|
3144
|
+
},
|
|
3145
|
+
message: '请检查必填项',
|
|
3146
|
+
},
|
|
3147
|
+
],
|
|
2981
3148
|
};
|
|
2982
3149
|
},
|
|
2983
3150
|
rowRule(data, extraConfig) {
|
|
@@ -2993,8 +3160,17 @@ var table = {
|
|
|
2993
3160
|
on: {
|
|
2994
3161
|
change(inject, value) {
|
|
2995
3162
|
inject.self.value = value;
|
|
3163
|
+
inject.api.emit('table-change', inject.api.bind());
|
|
2996
3164
|
},
|
|
2997
3165
|
},
|
|
3166
|
+
validate: [
|
|
3167
|
+
{
|
|
3168
|
+
validator(rule, value) {
|
|
3169
|
+
return validator(data, value);
|
|
3170
|
+
},
|
|
3171
|
+
message: '请检查必填项',
|
|
3172
|
+
},
|
|
3173
|
+
],
|
|
2998
3174
|
col: {
|
|
2999
3175
|
span: 24,
|
|
3000
3176
|
},
|
|
@@ -3315,7 +3491,8 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
3315
3491
|
"model-value": __props.value,
|
|
3316
3492
|
option,
|
|
3317
3493
|
rule: rule.value,
|
|
3318
|
-
"onUpdate:modelValue": handleValue
|
|
3494
|
+
"onUpdate:modelValue": handleValue,
|
|
3495
|
+
onTableChange: handleValue
|
|
3319
3496
|
}, null, 8, ["api", "model-value", "rule"])
|
|
3320
3497
|
], 64);
|
|
3321
3498
|
};
|
|
@@ -1364,6 +1364,7 @@ var date = {
|
|
|
1364
1364
|
props: {
|
|
1365
1365
|
placeholder: '请选择',
|
|
1366
1366
|
format: 'YYYY-MM',
|
|
1367
|
+
valueFormat: 'YYYY-MM',
|
|
1367
1368
|
},
|
|
1368
1369
|
config: {
|
|
1369
1370
|
propsFields: Object.values(fieldsMap$b),
|
|
@@ -1414,6 +1415,12 @@ var date = {
|
|
|
1414
1415
|
},
|
|
1415
1416
|
],
|
|
1416
1417
|
value: rule.props.format,
|
|
1418
|
+
inject: true,
|
|
1419
|
+
on: {
|
|
1420
|
+
change({ api, self }, format) {
|
|
1421
|
+
api.emit('props.valueFormat', format.value);
|
|
1422
|
+
},
|
|
1423
|
+
},
|
|
1417
1424
|
},
|
|
1418
1425
|
{
|
|
1419
1426
|
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;
|
|
@@ -160,7 +160,9 @@ const _sfc_main$3 = vue.defineComponent({
|
|
|
160
160
|
},
|
|
161
161
|
{ deep: true }
|
|
162
162
|
);
|
|
163
|
+
const departmentSelect = vue.ref([]);
|
|
163
164
|
function changeTreeCheck(checkedKeys) {
|
|
165
|
+
departmentSelect.value = checkedKeys;
|
|
164
166
|
let flatMap = selectState.dataMap;
|
|
165
167
|
let curlistKeys = selectState.curlistKeys;
|
|
166
168
|
let hadselected = new Set(selectState.multipDepartment);
|
|
@@ -185,6 +187,7 @@ const _sfc_main$3 = vue.defineComponent({
|
|
|
185
187
|
}
|
|
186
188
|
return {
|
|
187
189
|
changeTreeCheck,
|
|
190
|
+
departmentSelect,
|
|
188
191
|
...vue.toRefs(state),
|
|
189
192
|
...vue.toRefs(selectState),
|
|
190
193
|
list,
|
|
@@ -265,7 +268,7 @@ function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
265
268
|
}), 128))
|
|
266
269
|
], 64)) : _ctx.isTree ? (vue.openBlock(), vue.createBlock(_component_ATree, {
|
|
267
270
|
key: 1,
|
|
268
|
-
"checked-keys": _ctx.
|
|
271
|
+
"checked-keys": _ctx.departmentSelect,
|
|
269
272
|
checkable: "",
|
|
270
273
|
"tree-data": _ctx.list,
|
|
271
274
|
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;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isNull = void 0;
|
|
4
|
+
function isNull(value) {
|
|
5
|
+
return (!value ||
|
|
6
|
+
(Array.isArray(value) && !value.length) ||
|
|
7
|
+
(value.constructor === Object && !Object.keys(value).length));
|
|
8
|
+
}
|
|
9
|
+
exports.isNull = isNull;
|