ztxkui 4.2.18-2 → 4.2.18-21
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/README.md +57 -57
- package/dist/DemoCom/SyhDemo.d.ts +3 -0
- package/dist/DemoCom/SyhDemo.js +257 -0
- package/dist/DemoCom/TableDemo.js +8 -4
- package/dist/TableDemo/BasicTable.js +2 -1
- package/dist/TableDemo/EditableTable.js +83 -67
- package/dist/TableDemo/ProEditableTable.d.ts +21 -0
- package/dist/TableDemo/ProEditableTable.js +482 -0
- package/dist/TableDemo/data.d.ts +15 -0
- package/dist/TableDemo/data.js +33 -1
- package/dist/TableDemo/index.js +6 -5
- package/dist/components/DatePicker/data-picker.d.ts +7 -8
- package/dist/components/Menu/menu.d.ts +3 -3
- package/dist/components/PrintContainer/utils.js +3 -3
- package/dist/components/ProTable/hooks.d.ts +28 -0
- package/dist/components/ProTable/hooks.js +279 -0
- package/dist/components/ProTable/index.d.ts +8 -0
- package/dist/components/ProTable/index.js +77 -0
- package/dist/components/ProTable/interface.d.ts +51 -0
- package/dist/components/ProTable/interface.js +1 -0
- package/dist/components/Table/components/FillDown.d.ts +8 -0
- package/dist/components/Table/components/FillDown.js +10 -0
- package/dist/components/Table/components/FilterDropdown.d.ts +14 -0
- package/dist/components/Table/components/FilterDropdown.js +69 -0
- package/dist/components/Table/constants.d.ts +2 -0
- package/dist/components/Table/constants.js +2 -0
- package/dist/components/Table/hooks/useColumns.d.ts +20 -8
- package/dist/components/Table/hooks/useColumns.js +484 -182
- package/dist/components/Table/hooks/useDropRef.js +2 -1
- package/dist/components/Table/hooks/useInnerPagination.js +1 -0
- package/dist/components/Table/hooks/useSelectSubtotal.d.ts +4 -0
- package/dist/components/Table/hooks/useSelectSubtotal.js +178 -0
- package/dist/components/Table/index.d.ts +7 -0
- package/dist/components/Table/table-adddel-column.d.ts +8 -5
- package/dist/components/Table/table-adddel-column.js +15 -5
- package/dist/components/Table/table-dynamic.js +63 -5
- package/dist/components/Table/table-enhance-cell.d.ts +6 -3
- package/dist/components/Table/table-enhance-cell.js +196 -109
- package/dist/components/Table/table-enhance-row.d.ts +4 -4
- package/dist/components/Table/table-enhance-row.js +10 -11
- package/dist/components/Table/table-headTooltip.d.ts +6 -0
- package/dist/components/Table/table-headTooltip.js +13 -0
- package/dist/components/Table/table-resizable-title.d.ts +4 -5
- package/dist/components/Table/table-resizable-title.js +32 -6
- package/dist/components/Table/table-sort.d.ts +11 -0
- package/dist/components/Table/table-sort.js +65 -0
- package/dist/components/Table/table.d.ts +20 -4
- package/dist/components/Table/table.js +478 -176
- package/dist/components/Table/utils/dom.d.ts +26 -0
- package/dist/components/Table/utils/dom.js +122 -0
- package/dist/components/Table/utils/filterHandle.d.ts +1 -0
- package/dist/components/Table/utils/filterHandle.js +51 -0
- package/dist/components/Table/utils/getSummaryData.d.ts +1 -0
- package/dist/components/Table/utils/getSummaryData.js +3 -1
- package/dist/components/Table/utils/shallowEqual.d.ts +2 -0
- package/dist/components/Table/utils/shallowEqual.js +34 -0
- package/dist/components/Table/utils/validate.d.ts +1 -1
- package/dist/components/Table/utils/validate.js +5 -5
- package/dist/components/TimePicker/time-picker.d.ts +0 -1
- package/dist/components/ZtIcon/index.d.ts +1 -1
- package/dist/components/business/Common/UserForgetPassword/index.js +17 -6
- package/dist/components/business/Common/UserInfo/index.js +3 -1
- package/dist/components/business/Common/UserPassword/index.d.ts +1 -0
- package/dist/components/business/Common/UserPassword/index.js +42 -14
- package/dist/components/business/Common/validatePassword.d.ts +8 -0
- package/dist/components/business/Common/validatePassword.js +168 -0
- package/dist/components/utils/index.d.ts +1 -0
- package/dist/components/utils/index.js +20 -0
- package/dist/components/utils/useLastest.d.ts +2 -0
- package/dist/components/utils/useLastest.js +6 -0
- package/dist/index.css +96 -7
- package/dist/index.css.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +5 -0
- package/package.json +4 -3
|
@@ -5,3 +5,29 @@
|
|
|
5
5
|
export declare function domFind(el: any, selector: any): any;
|
|
6
6
|
export declare function domFindAll(el: any, selector: any): any;
|
|
7
7
|
export declare function domParentsUntil(el: any, selector: any): any;
|
|
8
|
+
export declare function createTr(data: any, titleIndex: any): HTMLTableRowElement;
|
|
9
|
+
export declare function getIndex(el: any, selector: any): any;
|
|
10
|
+
/**
|
|
11
|
+
* 封装切片数据
|
|
12
|
+
* @param currentIndexArr 已选中的索引选择项
|
|
13
|
+
* @param currentRecordObj 已选中的数据选择项
|
|
14
|
+
* @returns
|
|
15
|
+
*/
|
|
16
|
+
export declare function parseSliceData(currentIndexArr: any, currentRecordObj: any): any;
|
|
17
|
+
/**
|
|
18
|
+
* 删除内部小计数据
|
|
19
|
+
*/
|
|
20
|
+
export declare function deleteSubtotalTr($tableContent: any): void;
|
|
21
|
+
/**
|
|
22
|
+
* 删除内部小计选中项样式
|
|
23
|
+
* @param $tableContent
|
|
24
|
+
*/
|
|
25
|
+
export declare function deleteSubtotalClassNameTr($tr: any): void;
|
|
26
|
+
/**
|
|
27
|
+
* 将切好片的数据 插入到表格中
|
|
28
|
+
* @param $tr 当前选中项
|
|
29
|
+
* @param sliceArr 切片数据
|
|
30
|
+
* @param getColumnData 根据数据获取规则的方法
|
|
31
|
+
*/
|
|
32
|
+
export declare function appendSubtotalTr($tr: any, sliceArr: any, getColumnData: any): void;
|
|
33
|
+
export declare function createSummaryConfig(config: any): any;
|
|
@@ -22,3 +22,125 @@ export function domParentsUntil(el, selector) {
|
|
|
22
22
|
}
|
|
23
23
|
return null;
|
|
24
24
|
}
|
|
25
|
+
export function createTr(data, titleIndex) {
|
|
26
|
+
var tr = document.createElement('tr');
|
|
27
|
+
tr.classList.add('ztxk-tr-subtotal');
|
|
28
|
+
if (Array.isArray(data)) {
|
|
29
|
+
var td = document.createElement('td');
|
|
30
|
+
td.setAttribute('colspan', data.length + '');
|
|
31
|
+
data.forEach(function (i, index) {
|
|
32
|
+
var td = document.createElement('td');
|
|
33
|
+
td.innerText = i !== null && i !== void 0 ? i : '';
|
|
34
|
+
if (index === titleIndex) {
|
|
35
|
+
td.innerText = '小计';
|
|
36
|
+
}
|
|
37
|
+
tr.appendChild(td);
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
return tr;
|
|
41
|
+
}
|
|
42
|
+
export function getIndex(el, selector) {
|
|
43
|
+
if (el) {
|
|
44
|
+
var parentNode = el.parentNode;
|
|
45
|
+
return Array.prototype.indexOf.call(parentNode.querySelectorAll(selector), el);
|
|
46
|
+
}
|
|
47
|
+
return null;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* 封装切片数据
|
|
51
|
+
* @param currentIndexArr 已选中的索引选择项
|
|
52
|
+
* @param currentRecordObj 已选中的数据选择项
|
|
53
|
+
* @returns
|
|
54
|
+
*/
|
|
55
|
+
export function parseSliceData(currentIndexArr, currentRecordObj) {
|
|
56
|
+
if (!Array.isArray(currentIndexArr)) {
|
|
57
|
+
return {};
|
|
58
|
+
}
|
|
59
|
+
// 将索引排序好
|
|
60
|
+
var sortIndexArr = currentIndexArr.sort(function (a, b) { return a - b; });
|
|
61
|
+
// 按相邻规则分段
|
|
62
|
+
var preIndex = null;
|
|
63
|
+
var sliceArr = {}; // 记录切片数据
|
|
64
|
+
var itemArr = []; // 每片数组的值
|
|
65
|
+
var len = sortIndexArr.length;
|
|
66
|
+
sortIndexArr.forEach(function (i, index) {
|
|
67
|
+
if (preIndex == null) {
|
|
68
|
+
preIndex = i;
|
|
69
|
+
}
|
|
70
|
+
if (preIndex === i || preIndex === i - 1) {
|
|
71
|
+
itemArr.push(currentRecordObj[i]);
|
|
72
|
+
preIndex = i; // 重新赋值
|
|
73
|
+
// 如果是最后一个数据
|
|
74
|
+
if (index === len - 1) {
|
|
75
|
+
sliceArr[preIndex] = itemArr;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
sliceArr[preIndex] = itemArr;
|
|
80
|
+
preIndex = i;
|
|
81
|
+
itemArr = [currentRecordObj[i]];
|
|
82
|
+
if (index === len - 1) {
|
|
83
|
+
sliceArr[preIndex] = itemArr;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
return sliceArr;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* 删除内部小计数据
|
|
91
|
+
*/
|
|
92
|
+
export function deleteSubtotalTr($tableContent) {
|
|
93
|
+
if ($tableContent) {
|
|
94
|
+
var subtotalTrList = $tableContent.querySelectorAll('tr.ztxk-tr-subtotal');
|
|
95
|
+
if (subtotalTrList) {
|
|
96
|
+
[].forEach.call(subtotalTrList, function (el) {
|
|
97
|
+
$tableContent.removeChild(el);
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* 删除内部小计选中项样式
|
|
104
|
+
* @param $tableContent
|
|
105
|
+
*/
|
|
106
|
+
export function deleteSubtotalClassNameTr($tr) {
|
|
107
|
+
if ($tr) {
|
|
108
|
+
[].forEach.call($tr, function (el) {
|
|
109
|
+
var _a, _b;
|
|
110
|
+
if (el) {
|
|
111
|
+
(_b = (_a = el === null || el === void 0 ? void 0 : el.classList) === null || _a === void 0 ? void 0 : _a.remove) === null || _b === void 0 ? void 0 : _b.call(_a, 'ant-table-row-doubleClick');
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* 将切好片的数据 插入到表格中
|
|
118
|
+
* @param $tr 当前选中项
|
|
119
|
+
* @param sliceArr 切片数据
|
|
120
|
+
* @param getColumnData 根据数据获取规则的方法
|
|
121
|
+
*/
|
|
122
|
+
export function appendSubtotalTr($tr, sliceArr, getColumnData) {
|
|
123
|
+
var sliceKeys = Object.keys(sliceArr);
|
|
124
|
+
var sliceValues = Object.values(sliceArr);
|
|
125
|
+
if (sliceKeys) {
|
|
126
|
+
var trParent = $tr.parentNode;
|
|
127
|
+
var trList_1 = trParent.querySelectorAll('tr.ant-table-row');
|
|
128
|
+
deleteSubtotalTr(trParent);
|
|
129
|
+
sliceKeys.forEach(function (key, index) {
|
|
130
|
+
var data = sliceValues[index];
|
|
131
|
+
var parseData = getColumnData(data);
|
|
132
|
+
var subtotalData = parseData.find(function (item) { return item.key === 'subtotal'; });
|
|
133
|
+
var currentTr = trList_1[key];
|
|
134
|
+
if (subtotalData) {
|
|
135
|
+
var list = subtotalData.list, titleIndex = subtotalData.titleIndex;
|
|
136
|
+
var tr = createTr(list, titleIndex);
|
|
137
|
+
currentTr.insertAdjacentElement('afterend', tr);
|
|
138
|
+
}
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
export function createSummaryConfig(config) {
|
|
143
|
+
if (config) {
|
|
144
|
+
return config;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function filterHandle(value: any, record: any, key: any): any;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/* eslint-disable eqeqeq */
|
|
2
|
+
import { message } from 'antd';
|
|
3
|
+
var isMessage = false;
|
|
4
|
+
export function filterHandle(value, record, key) {
|
|
5
|
+
var _a, _b, _c, _d;
|
|
6
|
+
var newValue = ((_b = (_a = value === null || value === void 0 ? void 0 : value.toString) === null || _a === void 0 ? void 0 : _a.call(value)) === null || _b === void 0 ? void 0 : _b.trim()) || null;
|
|
7
|
+
var currentValue = record && key ? record[key] : null;
|
|
8
|
+
if (currentValue != null && newValue != null) {
|
|
9
|
+
if (newValue.startsWith('大于等于') || newValue.startsWith('>=')) {
|
|
10
|
+
var subValue = Number(newValue.substring(newValue.startsWith('大于等于') ? 4 : 2));
|
|
11
|
+
return currentValue >= subValue;
|
|
12
|
+
}
|
|
13
|
+
if (newValue.startsWith('小于等于') || newValue.startsWith('<=')) {
|
|
14
|
+
var subValue = Number(newValue.substring(newValue.startsWith('小于等于') ? 4 : 2));
|
|
15
|
+
return currentValue <= subValue;
|
|
16
|
+
}
|
|
17
|
+
if (newValue.startsWith('大于') || newValue.startsWith('>')) {
|
|
18
|
+
var subValue = Number(newValue.substring(newValue.startsWith('大于') ? 2 : 1));
|
|
19
|
+
return currentValue > subValue;
|
|
20
|
+
}
|
|
21
|
+
if (newValue.startsWith('小于') || newValue.startsWith('<')) {
|
|
22
|
+
var subValue = Number(newValue.substring(newValue.startsWith('小于') ? 2 : 1));
|
|
23
|
+
return currentValue < subValue;
|
|
24
|
+
}
|
|
25
|
+
if (newValue.startsWith('等于') || newValue.startsWith('=')) {
|
|
26
|
+
var subValue = Number(newValue.substring(newValue.startsWith('等于') ? 2 : 1));
|
|
27
|
+
return currentValue == subValue;
|
|
28
|
+
}
|
|
29
|
+
// 使用eval执行代码 长度不能过长。防止
|
|
30
|
+
if (newValue.indexOf('$0') !== -1 && newValue.length <= 100) {
|
|
31
|
+
var newEvalStr = newValue.replace(/\$0/g, currentValue);
|
|
32
|
+
var result = null;
|
|
33
|
+
try {
|
|
34
|
+
// eslint-disable-next-line no-eval
|
|
35
|
+
result = eval(newEvalStr);
|
|
36
|
+
}
|
|
37
|
+
catch (err) {
|
|
38
|
+
console.log(err);
|
|
39
|
+
if (!isMessage) {
|
|
40
|
+
isMessage = true;
|
|
41
|
+
message.info('不要使用赋值语句如:1+1=2 /n 应该使用:1+1==2', 3, function () {
|
|
42
|
+
isMessage = false;
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
return result;
|
|
47
|
+
}
|
|
48
|
+
return (_d = (_c = currentValue === null || currentValue === void 0 ? void 0 : currentValue.toString()) === null || _c === void 0 ? void 0 : _c.toLowerCase()) === null || _d === void 0 ? void 0 : _d.includes(newValue.toLowerCase());
|
|
49
|
+
}
|
|
50
|
+
return true;
|
|
51
|
+
}
|
|
@@ -20,6 +20,7 @@ export interface ISummaryConfig {
|
|
|
20
20
|
* @param pageData 当前表格数据
|
|
21
21
|
* @param columns 列配置
|
|
22
22
|
* @param hasRowSelection 是否有选择列
|
|
23
|
+
* @param isSubtotal 是否是内部使用的小计(这个)
|
|
23
24
|
* @returns any[]
|
|
24
25
|
*/
|
|
25
26
|
declare function getSummaryData(summaryConfig: ISummaryConfig[] | undefined, pageData: any, columns: any, { hasRowSelection, hasExpandable, }: {
|
|
@@ -10,6 +10,7 @@ import { plus, round } from 'number-precision';
|
|
|
10
10
|
* @param pageData 当前表格数据
|
|
11
11
|
* @param columns 列配置
|
|
12
12
|
* @param hasRowSelection 是否有选择列
|
|
13
|
+
* @param isSubtotal 是否是内部使用的小计(这个)
|
|
13
14
|
* @returns any[]
|
|
14
15
|
*/
|
|
15
16
|
function getSummaryData(summaryConfig, pageData, columns, _a) {
|
|
@@ -297,7 +298,8 @@ function getTotalObj(fields) {
|
|
|
297
298
|
if (value != null) {
|
|
298
299
|
// 如果value是数组 那么也要输出数组
|
|
299
300
|
if (Array.isArray(value)) {
|
|
300
|
-
summaryTotalObj[key] = value.map(function (
|
|
301
|
+
summaryTotalObj[key] = value.map(function (val, index) {
|
|
302
|
+
var v = val || 0;
|
|
301
303
|
// 如果传入两个键值 需要小计,那么取对应的值
|
|
302
304
|
var _toFixedNum = Array.isArray(toFixedNum_2)
|
|
303
305
|
? toFixedNum_2[index]
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import isEqual from 'lodash/isEqual';
|
|
2
|
+
export function is(x, y) {
|
|
3
|
+
return ((x === y && (x !== 0 || 1 / x === 1 / y)) || (x !== x && y !== y) // eslint-disable-line no-self-compare
|
|
4
|
+
);
|
|
5
|
+
}
|
|
6
|
+
export function shallowEqual(objA, objB, deepKeys) {
|
|
7
|
+
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
8
|
+
if (is(objA, objB)) {
|
|
9
|
+
return true;
|
|
10
|
+
}
|
|
11
|
+
if (typeof objA !== 'object' ||
|
|
12
|
+
objA === null ||
|
|
13
|
+
typeof objB !== 'object' ||
|
|
14
|
+
objB === null) {
|
|
15
|
+
return false;
|
|
16
|
+
}
|
|
17
|
+
var keysA = Object.keys(objA);
|
|
18
|
+
var keysB = Object.keys(objB);
|
|
19
|
+
if (keysA.length !== keysB.length) {
|
|
20
|
+
return false;
|
|
21
|
+
}
|
|
22
|
+
// Test for A's keys different from B.
|
|
23
|
+
for (var i = 0; i < keysA.length; i++) {
|
|
24
|
+
var key = keysA[i];
|
|
25
|
+
if ((deepKeys === null || deepKeys === void 0 ? void 0 : deepKeys.includes(key)) && !isEqual(objA[key], objB[key])) {
|
|
26
|
+
return false;
|
|
27
|
+
}
|
|
28
|
+
else if (!hasOwnProperty.call(objB, key) || !is(objA[key], objB[key])) {
|
|
29
|
+
console.log('因为某个key渲染', key, objA[key], objB[key]);
|
|
30
|
+
return false;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
return true;
|
|
34
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function tableValidate(dataSource: any, mergeColumns: any, restParams: any): Promise<never>;
|
|
1
|
+
export declare function tableValidate(dataSource: any, mergeColumns: any, restParams: any, isDataItemValidate?: any): Promise<never>;
|
|
@@ -39,10 +39,10 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
39
39
|
* @description 表格验证逻辑
|
|
40
40
|
*/
|
|
41
41
|
import { ERROR_TD_CLASSNAME } from '../index';
|
|
42
|
-
export function tableValidate(dataSource, mergeColumns, restParams) {
|
|
42
|
+
export function tableValidate(dataSource, mergeColumns, restParams, isDataItemValidate) {
|
|
43
43
|
var _a, _b, _c, _d;
|
|
44
44
|
return __awaiter(this, void 0, void 0, function () {
|
|
45
|
-
var getCurrentTable, rowSelection, tableName, expandable, showInnerPagination, setCurrent, pageSize, requiredFileds, i, item, _loop_1, j, state_1;
|
|
45
|
+
var getCurrentTable, rowSelection, tableName, expandable, showInnerPagination, setCurrent, pageSize, requiredFileds, i, item, flag, _loop_1, j, state_1;
|
|
46
46
|
return __generator(this, function (_e) {
|
|
47
47
|
switch (_e.label) {
|
|
48
48
|
case 0:
|
|
@@ -73,6 +73,9 @@ export function tableValidate(dataSource, mergeColumns, restParams) {
|
|
|
73
73
|
case 1:
|
|
74
74
|
if (!(i < dataSource.length)) return [3 /*break*/, 6];
|
|
75
75
|
item = dataSource[i];
|
|
76
|
+
flag = isDataItemValidate ? isDataItemValidate(item) : true;
|
|
77
|
+
if (!flag)
|
|
78
|
+
return [3 /*break*/, 5];
|
|
76
79
|
_loop_1 = function (j) {
|
|
77
80
|
var _f, dataIndex, title, validate, index, value, setElementState, innerCurrentI, currentPage, err_1;
|
|
78
81
|
return __generator(this, function (_g) {
|
|
@@ -83,9 +86,6 @@ export function tableValidate(dataSource, mergeColumns, restParams) {
|
|
|
83
86
|
return [2 /*return*/, "break"];
|
|
84
87
|
}
|
|
85
88
|
value = item[dataIndex];
|
|
86
|
-
if (dataIndex === 'test3') {
|
|
87
|
-
console.log(value);
|
|
88
|
-
}
|
|
89
89
|
setElementState = function (i, index, className) {
|
|
90
90
|
var _a, _b, _c;
|
|
91
91
|
// 获取表格元素
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { Dayjs } from 'dayjs';
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { PickerTimeProps } from 'antd/es/date-picker/generatePicker';
|
|
4
|
-
import { Omit } from 'antd/es/_util/type';
|
|
5
4
|
export interface TimePickerProps extends Omit<PickerTimeProps<Dayjs>, 'picker'> {
|
|
6
5
|
}
|
|
7
6
|
declare const TimePicker: React.ForwardRefExoticComponent<TimePickerProps & React.RefAttributes<any>>;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
declare const IconFont: import("react").
|
|
2
|
+
declare const IconFont: import("react").FC<import("@ant-design/icons/lib/components/IconFont").IconFontProps<string>>;
|
|
3
3
|
export default IconFont;
|
|
@@ -48,6 +48,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
48
48
|
import React, { useState, useCallback, useRef, useEffect, useLayoutEffect, } from 'react';
|
|
49
49
|
import { Modal, Form, SearchContainer, Input, Container, Button, message, } from '../../../../index';
|
|
50
50
|
import { validate, commonMessage } from 'ztxkutils/dist/validate';
|
|
51
|
+
import { validatePassword, passwordMessage } from '../validatePassword';
|
|
51
52
|
var SearchLeft = SearchContainer.SearchLeft, Item = SearchContainer.SearchItem;
|
|
52
53
|
var countDownMaxTime = 60; // 倒计时最大时间
|
|
53
54
|
var ForgetPassword = function (_a) {
|
|
@@ -256,14 +257,24 @@ var ForgetPassword = function (_a) {
|
|
|
256
257
|
React.createElement("div", { style: { width: '100%', display: 'flex' } },
|
|
257
258
|
React.createElement(Item, { name: "newPassword", label: "\u65B0\u5BC6\u7801", rules: [
|
|
258
259
|
{ required: true, message: '请输入新密码' },
|
|
259
|
-
{
|
|
260
|
-
|
|
261
|
-
|
|
260
|
+
function (_a) {
|
|
261
|
+
var getFieldValue = _a.getFieldValue;
|
|
262
|
+
return ({
|
|
263
|
+
validator: function (rule, value) {
|
|
264
|
+
var result = validatePassword(value, getFieldValue('account'));
|
|
265
|
+
if (result.result) {
|
|
266
|
+
return Promise.resolve();
|
|
267
|
+
}
|
|
268
|
+
else {
|
|
269
|
+
return Promise.reject(result.message);
|
|
270
|
+
}
|
|
271
|
+
},
|
|
272
|
+
});
|
|
262
273
|
},
|
|
263
274
|
] },
|
|
264
|
-
React.createElement(Input, { autoComplete: "off",
|
|
275
|
+
React.createElement(Input.Password, { autoComplete: "off", placeholder: "\u8BF7\u8F93\u5165\u65B0\u5BC6\u7801" })),
|
|
265
276
|
React.createElement("div", null,
|
|
266
|
-
React.createElement("p", { style: { height: 32, lineHeight: '32px', color: 'red' } },
|
|
277
|
+
React.createElement("p", { style: { height: 32, lineHeight: '32px', color: 'red' } }, passwordMessage))),
|
|
267
278
|
React.createElement(Item, { name: "newPassword1", label: "\u786E\u8BA4\u65B0\u5BC6\u7801", rules: [
|
|
268
279
|
{ required: true, message: '请确认密码' },
|
|
269
280
|
function (_a) {
|
|
@@ -278,6 +289,6 @@ var ForgetPassword = function (_a) {
|
|
|
278
289
|
});
|
|
279
290
|
},
|
|
280
291
|
], dependencies: ['newPassword'] },
|
|
281
|
-
React.createElement(Input, { autoComplete: "off",
|
|
292
|
+
React.createElement(Input.Password, { autoComplete: "off", placeholder: "\u786E\u8BA4\u65B0\u5BC6\u7801" }))))))));
|
|
282
293
|
};
|
|
283
294
|
export default ForgetPassword;
|
|
@@ -173,7 +173,9 @@ var UserInfo = function (_a) {
|
|
|
173
173
|
React.createElement(Button, { type: "primary", onClick: onSaveHandle, loading: loading }, "\u4FDD\u5B58"),
|
|
174
174
|
React.createElement(Button, { type: "default", onClick: onCloseHandle, loading: loading }, "\u53D6\u6D88"))) : (React.createElement(Button, { type: "primary", onClick: onStartHandle, loading: loading }, "\u7F16\u8F91"));
|
|
175
175
|
};
|
|
176
|
-
return (React.createElement(Modal, { visible: visible, loading: loading, onCancel: onCancel, title: "\u7528\u6237\u4FE1\u606F",
|
|
176
|
+
return (React.createElement(Modal, { visible: visible, loading: loading, onCancel: onCancel, title: "\u7528\u6237\u4FE1\u606F",
|
|
177
|
+
// footer={footerDomFn()}
|
|
178
|
+
footer: null, maskClosable: false, width: "80%" },
|
|
177
179
|
React.createElement(Container, null,
|
|
178
180
|
React.createElement(MakingForm, { params: params, isEdit: isEdit, getFormObj: getFormObjHandle, setParams: setParams }))));
|
|
179
181
|
};
|
|
@@ -45,14 +45,20 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
45
45
|
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
46
46
|
}
|
|
47
47
|
};
|
|
48
|
-
import React, { useCallback, useState } from 'react';
|
|
48
|
+
import React, { useCallback, useState, useMemo } from 'react';
|
|
49
49
|
import { Container, Form, SearchContainer, Input, message, Modal, Button, } from '../../../../index';
|
|
50
|
-
import {
|
|
50
|
+
import { validatePassword, passwordMessage } from '../validatePassword';
|
|
51
51
|
var SearchLeft = SearchContainer.SearchLeft, Item = SearchContainer.SearchItem;
|
|
52
52
|
var Making = function (_a) {
|
|
53
|
-
var visible = _a.visible, onCancel = _a.onCancel, setUserPassword = _a.setUserPassword, request = _a.request, setUserPasswordOption = _a.setUserPasswordOption, encryptionHandle = _a.encryptionHandle;
|
|
53
|
+
var visible = _a.visible, onCancel = _a.onCancel, setUserPassword = _a.setUserPassword, request = _a.request, setUserPasswordOption = _a.setUserPasswordOption, encryptionHandle = _a.encryptionHandle, empSource = _a.empSource;
|
|
54
54
|
var form = Form.useForm()[0];
|
|
55
55
|
var _b = useState(false), loading = _b[0], setLoading = _b[1];
|
|
56
|
+
var isOutSource = useMemo(function () {
|
|
57
|
+
if (empSource && empSource + '' === '2') {
|
|
58
|
+
return true;
|
|
59
|
+
}
|
|
60
|
+
return false;
|
|
61
|
+
}, [empSource]);
|
|
56
62
|
/**提交验证 */
|
|
57
63
|
var vallidateFn = useCallback(function (callback) { return __awaiter(void 0, void 0, void 0, function () {
|
|
58
64
|
var err_1, errorFields;
|
|
@@ -84,10 +90,14 @@ var Making = function (_a) {
|
|
|
84
90
|
setLoading(true);
|
|
85
91
|
var params = form.getFieldsValue();
|
|
86
92
|
var submitParams = {
|
|
87
|
-
|
|
93
|
+
empSource: empSource,
|
|
88
94
|
newPassword: encryptionHandle(params === null || params === void 0 ? void 0 : params.newPassword),
|
|
89
95
|
newPassword1: encryptionHandle(params === null || params === void 0 ? void 0 : params.newPassword1),
|
|
90
96
|
};
|
|
97
|
+
// 外部用户 不需要旧密码
|
|
98
|
+
if (!isOutSource) {
|
|
99
|
+
submitParams.oldPassword = encryptionHandle(params === null || params === void 0 ? void 0 : params.oldPassword);
|
|
100
|
+
}
|
|
91
101
|
request(setUserPasswordOption
|
|
92
102
|
? __assign(__assign({}, setUserPasswordOption), { data: __assign(__assign({}, setUserPasswordOption.data), submitParams) }) : {
|
|
93
103
|
url: '/api/zmdms-user/update-password',
|
|
@@ -111,7 +121,15 @@ var Making = function (_a) {
|
|
|
111
121
|
setLoading(false);
|
|
112
122
|
message.warning(((_b = (_a = err === null || err === void 0 ? void 0 : err.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || '密码修改失败!');
|
|
113
123
|
});
|
|
114
|
-
}, [
|
|
124
|
+
}, [
|
|
125
|
+
form,
|
|
126
|
+
encryptionHandle,
|
|
127
|
+
request,
|
|
128
|
+
setUserPasswordOption,
|
|
129
|
+
setUserPassword,
|
|
130
|
+
empSource,
|
|
131
|
+
isOutSource,
|
|
132
|
+
]);
|
|
115
133
|
var onSaveHandle = useCallback(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
116
134
|
return __generator(this, function (_a) {
|
|
117
135
|
vallidateFn(function () {
|
|
@@ -128,20 +146,30 @@ var Making = function (_a) {
|
|
|
128
146
|
React.createElement(Form, { name: "user-password-making", form: form },
|
|
129
147
|
React.createElement(SearchContainer, { dark: true },
|
|
130
148
|
React.createElement(SearchLeft, null,
|
|
131
|
-
React.createElement("div", { style: { width: '100%' } },
|
|
149
|
+
isOutSource ? null : (React.createElement("div", { style: { width: '100%' } },
|
|
132
150
|
React.createElement(Item, { name: "oldPassword", label: "\u539F\u5BC6\u7801", rules: [{ required: true, message: '请输入原密码' }] },
|
|
133
|
-
React.createElement(Input, { autoComplete: "new-password"
|
|
151
|
+
React.createElement(Input.Password, { autoComplete: "new-password" })))),
|
|
134
152
|
React.createElement("div", { style: { width: '100%', display: 'flex' } },
|
|
135
153
|
React.createElement(Item, { name: "newPassword", label: "\u65B0\u5BC6\u7801", rules: [
|
|
136
154
|
{ required: true, message: '请输入新密码' },
|
|
137
|
-
{
|
|
138
|
-
|
|
139
|
-
|
|
155
|
+
function (_a) {
|
|
156
|
+
var getFieldValue = _a.getFieldValue;
|
|
157
|
+
return ({
|
|
158
|
+
validator: function (rule, value) {
|
|
159
|
+
var result = validatePassword(value, null);
|
|
160
|
+
if (result.result) {
|
|
161
|
+
return Promise.resolve();
|
|
162
|
+
}
|
|
163
|
+
else {
|
|
164
|
+
return Promise.reject(result.message);
|
|
165
|
+
}
|
|
166
|
+
},
|
|
167
|
+
});
|
|
140
168
|
},
|
|
141
169
|
] },
|
|
142
|
-
React.createElement(Input, { autoComplete: "new-password"
|
|
143
|
-
React.createElement("div",
|
|
144
|
-
React.createElement("p", { style: { height: 32, lineHeight: '32px', color: 'red' } },
|
|
170
|
+
React.createElement(Input.Password, { autoComplete: "new-password" })),
|
|
171
|
+
React.createElement("div", { style: { width: '60%' } },
|
|
172
|
+
React.createElement("p", { style: { height: 32, lineHeight: '32px', color: 'red' } }, passwordMessage))),
|
|
145
173
|
React.createElement(Item, { name: "newPassword1", label: "\u786E\u8BA4\u65B0\u5BC6\u7801", rules: [
|
|
146
174
|
{ required: true, message: '请确认密码' },
|
|
147
175
|
function (_a) {
|
|
@@ -156,6 +184,6 @@ var Making = function (_a) {
|
|
|
156
184
|
});
|
|
157
185
|
},
|
|
158
186
|
], dependencies: ['newPassword'] },
|
|
159
|
-
React.createElement(Input, { autoComplete: "new-password"
|
|
187
|
+
React.createElement(Input.Password, { autoComplete: "new-password" }))))))));
|
|
160
188
|
};
|
|
161
189
|
export default Making;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare const passwordMessage = "\u5BC6\u7801\u5FC5\u987B\u5305\u542B\u5927\u5C0F\u5199\u5B57\u6BCD\u3001\u6570\u5B57\u3001\u7279\u6B8A\u5B57\u7B26\u4E14\u6700\u5C0F\u957F\u5EA6\u4E3A8\uFF0C\u4E14\u4E0D\u80FD\u51FA\u73B0\u8FDE\u7EED\u6570\u5B57\u6216\u5B57\u7B26\uFF0C\u4E0D\u80FD\u51FA\u73B0\u76F8\u540C\u5B57\u7B26\uFF0C\u4E14\u7981\u6B62\u4F7F\u7528\u7528\u6237\u8D26\u53F7\u4F5C\u4E3A\u5BC6\u7801";
|
|
2
|
+
export declare function validatePassword(password: any, username: any): {
|
|
3
|
+
result: boolean;
|
|
4
|
+
message: string;
|
|
5
|
+
} | {
|
|
6
|
+
result: boolean;
|
|
7
|
+
message?: undefined;
|
|
8
|
+
};
|