bm-admin-ui 1.0.53-alpha → 1.0.54-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.
|
@@ -7,6 +7,7 @@ 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';
|
|
10
11
|
|
|
11
12
|
const fieldRatioMap = {
|
|
12
13
|
'25%': 6,
|
|
@@ -802,7 +803,8 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
802
803
|
val.map((item) => ({
|
|
803
804
|
[fieldNames.value]: item.key,
|
|
804
805
|
[fieldNames.label]: item.title,
|
|
805
|
-
|
|
806
|
+
key: item.key,
|
|
807
|
+
title: item.title
|
|
806
808
|
}))
|
|
807
809
|
);
|
|
808
810
|
}
|
|
@@ -938,6 +940,7 @@ var people = {
|
|
|
938
940
|
minWidth: data.config.fieldRatio,
|
|
939
941
|
slots: {
|
|
940
942
|
default({ row }) {
|
|
943
|
+
var _a;
|
|
941
944
|
return h(StaffSelector, {
|
|
942
945
|
title: '添加员工',
|
|
943
946
|
mode: data.props.limit ? 'radio' : 'multiple',
|
|
@@ -952,6 +955,7 @@ var people = {
|
|
|
952
955
|
return yield extraConfig.people.fetch(params);
|
|
953
956
|
});
|
|
954
957
|
},
|
|
958
|
+
fieldNames: (_a = extraConfig.people) === null || _a === void 0 ? void 0 : _a.fieldNames,
|
|
955
959
|
});
|
|
956
960
|
},
|
|
957
961
|
},
|
|
@@ -1279,6 +1283,7 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
1279
1283
|
emits: ["change"],
|
|
1280
1284
|
setup(__props, { emit: emits }) {
|
|
1281
1285
|
const props = __props;
|
|
1286
|
+
dayjs.extend(customParseFormat);
|
|
1282
1287
|
const productInfoKeyMap = {
|
|
1283
1288
|
\u5546\u54C1\u540D\u79F0: "productName",
|
|
1284
1289
|
\u5546\u54C1\u7B80\u79F0: "productShortName",
|
|
@@ -1486,13 +1491,15 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
1486
1491
|
function emitChange() {
|
|
1487
1492
|
emits("change", data);
|
|
1488
1493
|
}
|
|
1489
|
-
function queryProductInfo(rule, row) {
|
|
1494
|
+
async function queryProductInfo(rule, row) {
|
|
1490
1495
|
const field = rule.field;
|
|
1491
1496
|
const associatedFields = rule?.config?.associatedFields;
|
|
1492
|
-
|
|
1493
|
-
associatedFields.
|
|
1494
|
-
|
|
1495
|
-
|
|
1497
|
+
return await props.extraConfig.product.fetch({ productCode: row[field] }).then((data2) => {
|
|
1498
|
+
if (data2 && associatedFields.length)
|
|
1499
|
+
associatedFields.forEach((item) => {
|
|
1500
|
+
row[field + item.value] = data2[productInfoKeyMap[item.value]];
|
|
1501
|
+
});
|
|
1502
|
+
return data2;
|
|
1496
1503
|
});
|
|
1497
1504
|
}
|
|
1498
1505
|
function handleChange(e) {
|
|
@@ -1509,7 +1516,14 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
1509
1516
|
});
|
|
1510
1517
|
result.push(rowData);
|
|
1511
1518
|
});
|
|
1512
|
-
validate(result)
|
|
1519
|
+
result.length && validate(result).then((result2) => {
|
|
1520
|
+
data.splice(0, data.length, ...result2);
|
|
1521
|
+
}).catch((error) => {
|
|
1522
|
+
message.error("\u5B58\u5728\u9519\u8BEF\u6570\u636E\uFF0C\u5BFC\u5165\u5931\u8D25");
|
|
1523
|
+
console.log("---------------");
|
|
1524
|
+
console.log(error);
|
|
1525
|
+
console.log("---------------");
|
|
1526
|
+
});
|
|
1513
1527
|
e.target.value = "";
|
|
1514
1528
|
};
|
|
1515
1529
|
file && reader.readAsText(file, "GB2312");
|
|
@@ -1520,62 +1534,125 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
1520
1534
|
function parseCsv(result) {
|
|
1521
1535
|
let data2 = [];
|
|
1522
1536
|
if (result) {
|
|
1523
|
-
|
|
1537
|
+
const rows = result.split("\r\n");
|
|
1538
|
+
const columnsTxt = rows[0];
|
|
1539
|
+
const columnArr = columnsTxt.includes(" ") ? columnsTxt.split(" ") : columnsTxt.split(",");
|
|
1540
|
+
if (columnArr.length !== columns.filter((c) => isValidColumn(c)).length) {
|
|
1541
|
+
message.error("\u5BFC\u5165\u7684\u6A21\u677F\u51FA\u9519");
|
|
1542
|
+
} else {
|
|
1543
|
+
data2 = rows.slice(1).filter((item) => item).map(
|
|
1544
|
+
(item) => item.includes(" ") ? item.split(" ") : item.split(",")
|
|
1545
|
+
);
|
|
1546
|
+
}
|
|
1524
1547
|
}
|
|
1525
1548
|
return data2;
|
|
1526
1549
|
}
|
|
1527
|
-
function validate(rowData) {
|
|
1550
|
+
async function validate(rowData) {
|
|
1551
|
+
let error = "";
|
|
1528
1552
|
const validColumns = columns.filter((c) => isValidColumn(c));
|
|
1529
1553
|
for (const row of rowData) {
|
|
1530
1554
|
for (const { field } of validColumns) {
|
|
1531
1555
|
const rule = childRulesMap.value[field];
|
|
1532
|
-
|
|
1556
|
+
const title = rule?.title?.title;
|
|
1557
|
+
if (!rule)
|
|
1558
|
+
break;
|
|
1559
|
+
let value = row[field] || "";
|
|
1533
1560
|
const txtFormatFn = rule.config?.txtFormatFn;
|
|
1534
1561
|
if (rule.effect.required && !value) {
|
|
1562
|
+
error = `${title}\u4E0D\u80FD\u4E3A\u7A7A`;
|
|
1535
1563
|
break;
|
|
1536
1564
|
}
|
|
1537
1565
|
if (txtFormatFn && !txtFormatFn(value)) {
|
|
1566
|
+
error = `${title}\u586B\u5199\u89C4\u5219\u4E0D\u6B63\u786E`;
|
|
1538
1567
|
break;
|
|
1539
1568
|
}
|
|
1540
1569
|
if (rule.name === "input") {
|
|
1541
1570
|
const maxlength = rule.props.maxlength || 200;
|
|
1542
1571
|
if (value.length > maxlength) {
|
|
1572
|
+
error = `${title}\u5B57\u6570\u8D85\u51FA`;
|
|
1543
1573
|
break;
|
|
1544
1574
|
}
|
|
1545
1575
|
}
|
|
1546
1576
|
if (rule.name === "textarea") {
|
|
1547
1577
|
if (value.length > 5e3) {
|
|
1578
|
+
error = `${title}\u5B57\u6570\u8D85\u51FA`;
|
|
1548
1579
|
break;
|
|
1549
1580
|
}
|
|
1550
1581
|
}
|
|
1551
1582
|
if (rule.name === "numInput") {
|
|
1552
1583
|
if (rule.config.format === 1) {
|
|
1553
1584
|
if (!value.includes("%")) {
|
|
1585
|
+
error = `${title}\u4E0D\u4E3A\u767E\u5206\u6570`;
|
|
1554
1586
|
break;
|
|
1587
|
+
} else {
|
|
1588
|
+
value = value.replaceAll("%", "");
|
|
1555
1589
|
}
|
|
1556
1590
|
} else {
|
|
1557
|
-
if (
|
|
1591
|
+
if (isNaN(value)) {
|
|
1592
|
+
error = `${title}\u4E0D\u4E3A\u6570\u5B57\u7C7B\u578B`;
|
|
1558
1593
|
break;
|
|
1559
1594
|
}
|
|
1560
1595
|
}
|
|
1561
1596
|
if (rule.config.decimalPlaces !== void 0 && value.split(".")[1]?.length > rule.config.decimalPlaces) {
|
|
1597
|
+
error = `${title}\u4FDD\u7559\u7684\u5C0F\u6570\u70B9\u4E3A\u4E0D\u6B63\u786E`;
|
|
1562
1598
|
break;
|
|
1563
1599
|
}
|
|
1564
1600
|
}
|
|
1565
1601
|
if (rule.name === "radio") {
|
|
1566
1602
|
if (rule.options.every((item) => item.value !== value)) {
|
|
1603
|
+
error = `${title}\u4E0D\u5B58\u5728\u8BE5\u9009\u9879`;
|
|
1567
1604
|
break;
|
|
1568
1605
|
}
|
|
1569
1606
|
}
|
|
1570
1607
|
if (rule.name === "checkbox") {
|
|
1571
1608
|
value = value.split("\u3001");
|
|
1572
1609
|
if (value.some((item) => rule.options.every((r) => r.value !== item))) {
|
|
1610
|
+
error = `${title}\u5B58\u5728\u4E0D\u5B58\u5728\u7684\u9009\u9879\u503C`;
|
|
1611
|
+
break;
|
|
1612
|
+
}
|
|
1613
|
+
}
|
|
1614
|
+
if (rule.name === "date") {
|
|
1615
|
+
if (!dayjs(value, rule.props.format, true).isValid()) {
|
|
1616
|
+
error = `${title}\u4E0D\u4E3A\u6709\u6548\u65F6\u671F\u6216\u4E0D\u7B26\u5408\u65E5\u671F\u683C\u5F0F`;
|
|
1617
|
+
break;
|
|
1618
|
+
}
|
|
1619
|
+
}
|
|
1620
|
+
if (rule.name === "dateRange") {
|
|
1621
|
+
value = value.split("~");
|
|
1622
|
+
if (value.some((item) => !dayjs(item, rule.props.format, true).isValid())) {
|
|
1623
|
+
error = `${title}\u4E0D\u4E3A\u6709\u6548\u65F6\u671F\u6216\u4E0D\u7B26\u5408\u65E5\u671F\u683C\u5F0F`;
|
|
1624
|
+
break;
|
|
1625
|
+
}
|
|
1626
|
+
}
|
|
1627
|
+
if (rule.name === "people" || rule.name === "department") {
|
|
1628
|
+
const limit = rule.props.limit;
|
|
1629
|
+
value = value.split("\u3001").map((item) => ({}));
|
|
1630
|
+
if (limit === 1 && value.length > limit) {
|
|
1631
|
+
error = `${title}\u6700\u591A\u53EA\u80FD\u9009\u4E00\u4E2A`;
|
|
1632
|
+
break;
|
|
1633
|
+
}
|
|
1634
|
+
}
|
|
1635
|
+
if (rule.name === "product") {
|
|
1636
|
+
const productInfo = await queryProductInfo(rule, row);
|
|
1637
|
+
if (!productInfo) {
|
|
1638
|
+
error = `${title}\u67E5\u8BE2\u7684\u5546\u54C1\u4E0D\u5B58\u5728`;
|
|
1573
1639
|
break;
|
|
1574
1640
|
}
|
|
1575
|
-
row[field] = value;
|
|
1576
1641
|
}
|
|
1577
|
-
if (rule.name === "
|
|
1642
|
+
if (rule.name === "shop") {
|
|
1643
|
+
value = {
|
|
1644
|
+
value: Number(value)
|
|
1645
|
+
};
|
|
1646
|
+
}
|
|
1647
|
+
row[field] = value;
|
|
1578
1648
|
}
|
|
1649
|
+
if (error)
|
|
1650
|
+
break;
|
|
1651
|
+
}
|
|
1652
|
+
if (error) {
|
|
1653
|
+
return Promise.reject(error);
|
|
1654
|
+
} else {
|
|
1655
|
+
return Promise.resolve(rowData);
|
|
1579
1656
|
}
|
|
1580
1657
|
}
|
|
1581
1658
|
watch(
|
|
@@ -2854,7 +2931,7 @@ var department = {
|
|
|
2854
2931
|
return yield extraConfig.department.fetch();
|
|
2855
2932
|
});
|
|
2856
2933
|
},
|
|
2857
|
-
fieldNames: (_a = extraConfig.
|
|
2934
|
+
fieldNames: (_a = extraConfig.department) === null || _a === void 0 ? void 0 : _a.fieldNames,
|
|
2858
2935
|
},
|
|
2859
2936
|
effect: {
|
|
2860
2937
|
required: data.effect.required && '请选择',
|
|
@@ -2897,7 +2974,7 @@ var department = {
|
|
|
2897
2974
|
return yield extraConfig.department.fetch();
|
|
2898
2975
|
});
|
|
2899
2976
|
},
|
|
2900
|
-
fieldNames: (_a = extraConfig.
|
|
2977
|
+
fieldNames: (_a = extraConfig.department) === null || _a === void 0 ? void 0 : _a.fieldNames,
|
|
2901
2978
|
},
|
|
2902
2979
|
effect: {
|
|
2903
2980
|
required: data.effect.required && '请选择',
|
|
@@ -2928,6 +3005,7 @@ var department = {
|
|
|
2928
3005
|
minWidth: data.config.fieldRatio,
|
|
2929
3006
|
slots: {
|
|
2930
3007
|
default({ row }) {
|
|
3008
|
+
var _a;
|
|
2931
3009
|
return h(StaffSelector, {
|
|
2932
3010
|
title: '添加部门',
|
|
2933
3011
|
mode: data.props.limit ? 'radio' : 'multiple',
|
|
@@ -2944,6 +3022,7 @@ var department = {
|
|
|
2944
3022
|
return yield extraConfig.department.fetch(params);
|
|
2945
3023
|
});
|
|
2946
3024
|
},
|
|
3025
|
+
fieldNames: (_a = extraConfig.department) === null || _a === void 0 ? void 0 : _a.fieldNames,
|
|
2947
3026
|
});
|
|
2948
3027
|
},
|
|
2949
3028
|
},
|
|
@@ -11,12 +11,14 @@ 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');
|
|
14
15
|
|
|
15
16
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
16
17
|
|
|
17
18
|
var dayjs__default = /*#__PURE__*/_interopDefaultLegacy(dayjs);
|
|
18
19
|
var Picture__default = /*#__PURE__*/_interopDefaultLegacy(Picture);
|
|
19
20
|
var BmStaffsSelector__default = /*#__PURE__*/_interopDefaultLegacy(BmStaffsSelector);
|
|
21
|
+
var customParseFormat__default = /*#__PURE__*/_interopDefaultLegacy(customParseFormat);
|
|
20
22
|
|
|
21
23
|
const fieldRatioMap = {
|
|
22
24
|
'25%': 6,
|
|
@@ -812,7 +814,8 @@ const _sfc_main$a = /* @__PURE__ */ vue.defineComponent({
|
|
|
812
814
|
val.map((item) => ({
|
|
813
815
|
[fieldNames.value]: item.key,
|
|
814
816
|
[fieldNames.label]: item.title,
|
|
815
|
-
|
|
817
|
+
key: item.key,
|
|
818
|
+
title: item.title
|
|
816
819
|
}))
|
|
817
820
|
);
|
|
818
821
|
}
|
|
@@ -948,6 +951,7 @@ var people = {
|
|
|
948
951
|
minWidth: data.config.fieldRatio,
|
|
949
952
|
slots: {
|
|
950
953
|
default({ row }) {
|
|
954
|
+
var _a;
|
|
951
955
|
return vue.h(StaffSelector, {
|
|
952
956
|
title: '添加员工',
|
|
953
957
|
mode: data.props.limit ? 'radio' : 'multiple',
|
|
@@ -962,6 +966,7 @@ var people = {
|
|
|
962
966
|
return yield extraConfig.people.fetch(params);
|
|
963
967
|
});
|
|
964
968
|
},
|
|
969
|
+
fieldNames: (_a = extraConfig.people) === null || _a === void 0 ? void 0 : _a.fieldNames,
|
|
965
970
|
});
|
|
966
971
|
},
|
|
967
972
|
},
|
|
@@ -1289,6 +1294,7 @@ const _sfc_main$7 = /* @__PURE__ */ vue.defineComponent({
|
|
|
1289
1294
|
emits: ["change"],
|
|
1290
1295
|
setup(__props, { emit: emits }) {
|
|
1291
1296
|
const props = __props;
|
|
1297
|
+
dayjs__default["default"].extend(customParseFormat__default["default"]);
|
|
1292
1298
|
const productInfoKeyMap = {
|
|
1293
1299
|
\u5546\u54C1\u540D\u79F0: "productName",
|
|
1294
1300
|
\u5546\u54C1\u7B80\u79F0: "productShortName",
|
|
@@ -1496,13 +1502,15 @@ const _sfc_main$7 = /* @__PURE__ */ vue.defineComponent({
|
|
|
1496
1502
|
function emitChange() {
|
|
1497
1503
|
emits("change", data);
|
|
1498
1504
|
}
|
|
1499
|
-
function queryProductInfo(rule, row) {
|
|
1505
|
+
async function queryProductInfo(rule, row) {
|
|
1500
1506
|
const field = rule.field;
|
|
1501
1507
|
const associatedFields = rule?.config?.associatedFields;
|
|
1502
|
-
|
|
1503
|
-
associatedFields.
|
|
1504
|
-
|
|
1505
|
-
|
|
1508
|
+
return await props.extraConfig.product.fetch({ productCode: row[field] }).then((data2) => {
|
|
1509
|
+
if (data2 && associatedFields.length)
|
|
1510
|
+
associatedFields.forEach((item) => {
|
|
1511
|
+
row[field + item.value] = data2[productInfoKeyMap[item.value]];
|
|
1512
|
+
});
|
|
1513
|
+
return data2;
|
|
1506
1514
|
});
|
|
1507
1515
|
}
|
|
1508
1516
|
function handleChange(e) {
|
|
@@ -1519,7 +1527,14 @@ const _sfc_main$7 = /* @__PURE__ */ vue.defineComponent({
|
|
|
1519
1527
|
});
|
|
1520
1528
|
result.push(rowData);
|
|
1521
1529
|
});
|
|
1522
|
-
validate(result)
|
|
1530
|
+
result.length && validate(result).then((result2) => {
|
|
1531
|
+
data.splice(0, data.length, ...result2);
|
|
1532
|
+
}).catch((error) => {
|
|
1533
|
+
antDesignVue.message.error("\u5B58\u5728\u9519\u8BEF\u6570\u636E\uFF0C\u5BFC\u5165\u5931\u8D25");
|
|
1534
|
+
console.log("---------------");
|
|
1535
|
+
console.log(error);
|
|
1536
|
+
console.log("---------------");
|
|
1537
|
+
});
|
|
1523
1538
|
e.target.value = "";
|
|
1524
1539
|
};
|
|
1525
1540
|
file && reader.readAsText(file, "GB2312");
|
|
@@ -1530,62 +1545,125 @@ const _sfc_main$7 = /* @__PURE__ */ vue.defineComponent({
|
|
|
1530
1545
|
function parseCsv(result) {
|
|
1531
1546
|
let data2 = [];
|
|
1532
1547
|
if (result) {
|
|
1533
|
-
|
|
1548
|
+
const rows = result.split("\r\n");
|
|
1549
|
+
const columnsTxt = rows[0];
|
|
1550
|
+
const columnArr = columnsTxt.includes(" ") ? columnsTxt.split(" ") : columnsTxt.split(",");
|
|
1551
|
+
if (columnArr.length !== columns.filter((c) => isValidColumn(c)).length) {
|
|
1552
|
+
antDesignVue.message.error("\u5BFC\u5165\u7684\u6A21\u677F\u51FA\u9519");
|
|
1553
|
+
} else {
|
|
1554
|
+
data2 = rows.slice(1).filter((item) => item).map(
|
|
1555
|
+
(item) => item.includes(" ") ? item.split(" ") : item.split(",")
|
|
1556
|
+
);
|
|
1557
|
+
}
|
|
1534
1558
|
}
|
|
1535
1559
|
return data2;
|
|
1536
1560
|
}
|
|
1537
|
-
function validate(rowData) {
|
|
1561
|
+
async function validate(rowData) {
|
|
1562
|
+
let error = "";
|
|
1538
1563
|
const validColumns = columns.filter((c) => isValidColumn(c));
|
|
1539
1564
|
for (const row of rowData) {
|
|
1540
1565
|
for (const { field } of validColumns) {
|
|
1541
1566
|
const rule = childRulesMap.value[field];
|
|
1542
|
-
|
|
1567
|
+
const title = rule?.title?.title;
|
|
1568
|
+
if (!rule)
|
|
1569
|
+
break;
|
|
1570
|
+
let value = row[field] || "";
|
|
1543
1571
|
const txtFormatFn = rule.config?.txtFormatFn;
|
|
1544
1572
|
if (rule.effect.required && !value) {
|
|
1573
|
+
error = `${title}\u4E0D\u80FD\u4E3A\u7A7A`;
|
|
1545
1574
|
break;
|
|
1546
1575
|
}
|
|
1547
1576
|
if (txtFormatFn && !txtFormatFn(value)) {
|
|
1577
|
+
error = `${title}\u586B\u5199\u89C4\u5219\u4E0D\u6B63\u786E`;
|
|
1548
1578
|
break;
|
|
1549
1579
|
}
|
|
1550
1580
|
if (rule.name === "input") {
|
|
1551
1581
|
const maxlength = rule.props.maxlength || 200;
|
|
1552
1582
|
if (value.length > maxlength) {
|
|
1583
|
+
error = `${title}\u5B57\u6570\u8D85\u51FA`;
|
|
1553
1584
|
break;
|
|
1554
1585
|
}
|
|
1555
1586
|
}
|
|
1556
1587
|
if (rule.name === "textarea") {
|
|
1557
1588
|
if (value.length > 5e3) {
|
|
1589
|
+
error = `${title}\u5B57\u6570\u8D85\u51FA`;
|
|
1558
1590
|
break;
|
|
1559
1591
|
}
|
|
1560
1592
|
}
|
|
1561
1593
|
if (rule.name === "numInput") {
|
|
1562
1594
|
if (rule.config.format === 1) {
|
|
1563
1595
|
if (!value.includes("%")) {
|
|
1596
|
+
error = `${title}\u4E0D\u4E3A\u767E\u5206\u6570`;
|
|
1564
1597
|
break;
|
|
1598
|
+
} else {
|
|
1599
|
+
value = value.replaceAll("%", "");
|
|
1565
1600
|
}
|
|
1566
1601
|
} else {
|
|
1567
|
-
if (
|
|
1602
|
+
if (isNaN(value)) {
|
|
1603
|
+
error = `${title}\u4E0D\u4E3A\u6570\u5B57\u7C7B\u578B`;
|
|
1568
1604
|
break;
|
|
1569
1605
|
}
|
|
1570
1606
|
}
|
|
1571
1607
|
if (rule.config.decimalPlaces !== void 0 && value.split(".")[1]?.length > rule.config.decimalPlaces) {
|
|
1608
|
+
error = `${title}\u4FDD\u7559\u7684\u5C0F\u6570\u70B9\u4E3A\u4E0D\u6B63\u786E`;
|
|
1572
1609
|
break;
|
|
1573
1610
|
}
|
|
1574
1611
|
}
|
|
1575
1612
|
if (rule.name === "radio") {
|
|
1576
1613
|
if (rule.options.every((item) => item.value !== value)) {
|
|
1614
|
+
error = `${title}\u4E0D\u5B58\u5728\u8BE5\u9009\u9879`;
|
|
1577
1615
|
break;
|
|
1578
1616
|
}
|
|
1579
1617
|
}
|
|
1580
1618
|
if (rule.name === "checkbox") {
|
|
1581
1619
|
value = value.split("\u3001");
|
|
1582
1620
|
if (value.some((item) => rule.options.every((r) => r.value !== item))) {
|
|
1621
|
+
error = `${title}\u5B58\u5728\u4E0D\u5B58\u5728\u7684\u9009\u9879\u503C`;
|
|
1622
|
+
break;
|
|
1623
|
+
}
|
|
1624
|
+
}
|
|
1625
|
+
if (rule.name === "date") {
|
|
1626
|
+
if (!dayjs__default["default"](value, rule.props.format, true).isValid()) {
|
|
1627
|
+
error = `${title}\u4E0D\u4E3A\u6709\u6548\u65F6\u671F\u6216\u4E0D\u7B26\u5408\u65E5\u671F\u683C\u5F0F`;
|
|
1628
|
+
break;
|
|
1629
|
+
}
|
|
1630
|
+
}
|
|
1631
|
+
if (rule.name === "dateRange") {
|
|
1632
|
+
value = value.split("~");
|
|
1633
|
+
if (value.some((item) => !dayjs__default["default"](item, rule.props.format, true).isValid())) {
|
|
1634
|
+
error = `${title}\u4E0D\u4E3A\u6709\u6548\u65F6\u671F\u6216\u4E0D\u7B26\u5408\u65E5\u671F\u683C\u5F0F`;
|
|
1635
|
+
break;
|
|
1636
|
+
}
|
|
1637
|
+
}
|
|
1638
|
+
if (rule.name === "people" || rule.name === "department") {
|
|
1639
|
+
const limit = rule.props.limit;
|
|
1640
|
+
value = value.split("\u3001").map((item) => ({}));
|
|
1641
|
+
if (limit === 1 && value.length > limit) {
|
|
1642
|
+
error = `${title}\u6700\u591A\u53EA\u80FD\u9009\u4E00\u4E2A`;
|
|
1643
|
+
break;
|
|
1644
|
+
}
|
|
1645
|
+
}
|
|
1646
|
+
if (rule.name === "product") {
|
|
1647
|
+
const productInfo = await queryProductInfo(rule, row);
|
|
1648
|
+
if (!productInfo) {
|
|
1649
|
+
error = `${title}\u67E5\u8BE2\u7684\u5546\u54C1\u4E0D\u5B58\u5728`;
|
|
1583
1650
|
break;
|
|
1584
1651
|
}
|
|
1585
|
-
row[field] = value;
|
|
1586
1652
|
}
|
|
1587
|
-
if (rule.name === "
|
|
1653
|
+
if (rule.name === "shop") {
|
|
1654
|
+
value = {
|
|
1655
|
+
value: Number(value)
|
|
1656
|
+
};
|
|
1657
|
+
}
|
|
1658
|
+
row[field] = value;
|
|
1588
1659
|
}
|
|
1660
|
+
if (error)
|
|
1661
|
+
break;
|
|
1662
|
+
}
|
|
1663
|
+
if (error) {
|
|
1664
|
+
return Promise.reject(error);
|
|
1665
|
+
} else {
|
|
1666
|
+
return Promise.resolve(rowData);
|
|
1589
1667
|
}
|
|
1590
1668
|
}
|
|
1591
1669
|
vue.watch(
|
|
@@ -2864,7 +2942,7 @@ var department = {
|
|
|
2864
2942
|
return yield extraConfig.department.fetch();
|
|
2865
2943
|
});
|
|
2866
2944
|
},
|
|
2867
|
-
fieldNames: (_a = extraConfig.
|
|
2945
|
+
fieldNames: (_a = extraConfig.department) === null || _a === void 0 ? void 0 : _a.fieldNames,
|
|
2868
2946
|
},
|
|
2869
2947
|
effect: {
|
|
2870
2948
|
required: data.effect.required && '请选择',
|
|
@@ -2907,7 +2985,7 @@ var department = {
|
|
|
2907
2985
|
return yield extraConfig.department.fetch();
|
|
2908
2986
|
});
|
|
2909
2987
|
},
|
|
2910
|
-
fieldNames: (_a = extraConfig.
|
|
2988
|
+
fieldNames: (_a = extraConfig.department) === null || _a === void 0 ? void 0 : _a.fieldNames,
|
|
2911
2989
|
},
|
|
2912
2990
|
effect: {
|
|
2913
2991
|
required: data.effect.required && '请选择',
|
|
@@ -2938,6 +3016,7 @@ var department = {
|
|
|
2938
3016
|
minWidth: data.config.fieldRatio,
|
|
2939
3017
|
slots: {
|
|
2940
3018
|
default({ row }) {
|
|
3019
|
+
var _a;
|
|
2941
3020
|
return vue.h(StaffSelector, {
|
|
2942
3021
|
title: '添加部门',
|
|
2943
3022
|
mode: data.props.limit ? 'radio' : 'multiple',
|
|
@@ -2954,6 +3033,7 @@ var department = {
|
|
|
2954
3033
|
return yield extraConfig.department.fetch(params);
|
|
2955
3034
|
});
|
|
2956
3035
|
},
|
|
3036
|
+
fieldNames: (_a = extraConfig.department) === null || _a === void 0 ? void 0 : _a.fieldNames,
|
|
2957
3037
|
});
|
|
2958
3038
|
},
|
|
2959
3039
|
},
|