fmui-base 2.2.56 → 2.2.58
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 +2 -0
- package/lib/comment_list/List.js +2 -0
- package/lib/form/form.js +41 -2
- package/lib/form/subForm.js +1 -1
- package/lib/work_item/index.js +16 -0
- package/lib/work_item/workItem.js +195 -0
- package/lib/work_item/workItem.less +67 -0
- package/package.json +1 -1
package/README.md
CHANGED
package/lib/comment_list/List.js
CHANGED
|
@@ -272,6 +272,8 @@ var PageHome = function (_React$Component) {
|
|
|
272
272
|
//是否加签
|
|
273
273
|
if (item.isAddlots && item.isAddlots == '1' && userName) {
|
|
274
274
|
userName = userName + "(加签)";
|
|
275
|
+
} else if (item.isAddlots && item.isAddlots == '2' && userName) {
|
|
276
|
+
userName = userName + "(退回)";
|
|
275
277
|
}
|
|
276
278
|
var userNameHtml = _react2.default.createElement(
|
|
277
279
|
'span',
|
package/lib/form/form.js
CHANGED
|
@@ -2704,7 +2704,7 @@ var PageHome = function (_React$Component) {
|
|
|
2704
2704
|
} else {
|
|
2705
2705
|
newValue = "";
|
|
2706
2706
|
}
|
|
2707
|
-
var formItem =
|
|
2707
|
+
var formItem = this.props.allForm.item;
|
|
2708
2708
|
var mainTblData = data.mainTblData;
|
|
2709
2709
|
if (userId && formItem) {
|
|
2710
2710
|
// t.refs[mainTblName+"_"+itemExt.key].reloadItemParam(itemExt.value);
|
|
@@ -2723,7 +2723,7 @@ var PageHome = function (_React$Component) {
|
|
|
2723
2723
|
} else if (relatepopuservalue == 'relateusercode') {
|
|
2724
2724
|
mainTblDataItem.value = userInfo.userCode;
|
|
2725
2725
|
} else if (relatepopuservalue == 'relateusertelphone') {
|
|
2726
|
-
mainTblDataItem.value = userInfo.
|
|
2726
|
+
mainTblDataItem.value = userInfo.userTelephone;
|
|
2727
2727
|
} else if (relatepopuservalue == 'relateuserdutyname') {
|
|
2728
2728
|
mainTblDataItem.value = userInfo.dutyName;
|
|
2729
2729
|
} else if (relatepopuservalue == 'relateusercardid') {
|
|
@@ -2732,6 +2732,45 @@ var PageHome = function (_React$Component) {
|
|
|
2732
2732
|
t.props.reloadItemParam(data.mainTblName + "_" + mainTblDataItem.key, mainTblDataItem.value);
|
|
2733
2733
|
}
|
|
2734
2734
|
}
|
|
2735
|
+
} else if (item.children && item.children.length > 0) {
|
|
2736
|
+
for (var k = 0; k < item.children.length; k++) {
|
|
2737
|
+
var childItem = item.children[k];
|
|
2738
|
+
if (childItem.dataAttr && childItem.dataAttr.relatepopuserField && childItem.dataAttr.relatepopuserField == code) {
|
|
2739
|
+
var relatepopuservalue = childItem.dataAttr.relatepopuserValue;
|
|
2740
|
+
for (var j = 0; j < mainTblData.length; j++) {
|
|
2741
|
+
var mainTblDataItem = mainTblData[j];
|
|
2742
|
+
if (mainTblDataItem.key == childItem.itemCode) {
|
|
2743
|
+
if (relatepopuservalue == 'relateuserorg') {
|
|
2744
|
+
mainTblDataItem.value = userInfo.orgName;
|
|
2745
|
+
} else if (relatepopuservalue == 'relateusercode') {
|
|
2746
|
+
mainTblDataItem.value = userInfo.userCode;
|
|
2747
|
+
} else if (relatepopuservalue == 'relateusertelphone') {
|
|
2748
|
+
mainTblDataItem.value = userInfo.userTelephone;
|
|
2749
|
+
} else if (relatepopuservalue == 'relateuserdutyname') {
|
|
2750
|
+
mainTblDataItem.value = userInfo.dutyName;
|
|
2751
|
+
} else if (relatepopuservalue == 'relateusercardid') {
|
|
2752
|
+
mainTblDataItem.value = userInfo.cardId;
|
|
2753
|
+
}
|
|
2754
|
+
// 如果当前Form是在子表中(dataType === 'sub'),需要通过SubForm来刷新
|
|
2755
|
+
// SubForm的reloadSubItemParam方法可以刷新子表所有行的字段
|
|
2756
|
+
if (t.props.dataType === 'sub' && t.props.subTblName === data.mainTblName) {
|
|
2757
|
+
// 尝试通过props获取reloadSubItemParam方法(如果SubForm传递了的话)
|
|
2758
|
+
if (t.props.reloadSubItemParam && typeof t.props.reloadSubItemParam === 'function') {
|
|
2759
|
+
var reloadParams = [];
|
|
2760
|
+
reloadParams.push({
|
|
2761
|
+
key: mainTblDataItem.uniqueName,
|
|
2762
|
+
value: mainTblDataItem.value,
|
|
2763
|
+
index: t.props.keyNo
|
|
2764
|
+
});
|
|
2765
|
+
if (reloadParams.length > 0) {
|
|
2766
|
+
t.props.reloadSubItemParam(reloadParams);
|
|
2767
|
+
}
|
|
2768
|
+
}
|
|
2769
|
+
}
|
|
2770
|
+
}
|
|
2771
|
+
}
|
|
2772
|
+
}
|
|
2773
|
+
}
|
|
2735
2774
|
}
|
|
2736
2775
|
}
|
|
2737
2776
|
} else {}
|
package/lib/form/subForm.js
CHANGED
|
@@ -743,7 +743,7 @@ var PageHome = function (_React$Component) {
|
|
|
743
743
|
'div',
|
|
744
744
|
{ className: item.show ? "" : "t-DN" },
|
|
745
745
|
item.form.map(function (item2, j) {
|
|
746
|
-
return _react2.default.createElement(_form2.default, { className: "subform_" + item2.uniqueName, keyNo: i, ref: item2.uniqueName + '_' + i, dataType: 'sub', subTblName: t.state.itemParam.key, module: t.state.module, formKey: item2.formKey, status: t.state.status, form: item2, allForm: t.props.allForm, formStyle: t.props.formStyle, data: t.state.itemParam.value[i], fieldControll: t.state.fieldControll, caIsPrd: t.props.caIsPrd, preCaFields: t.props.preCaFields, formRelaFieldMaps: t.props.formRelaFieldMaps, linkFields: t.props.linkFields, onChange: _this2.changeSub.bind(_this2, _this2.state.itemParam, i) });
|
|
746
|
+
return _react2.default.createElement(_form2.default, { className: "subform_" + item2.uniqueName, keyNo: i, ref: item2.uniqueName + '_' + i, dataType: 'sub', subTblName: t.state.itemParam.key, module: t.state.module, formKey: item2.formKey, status: t.state.status, form: item2, allForm: t.props.allForm, formStyle: t.props.formStyle, data: t.state.itemParam.value[i], fieldControll: t.state.fieldControll, caIsPrd: t.props.caIsPrd, preCaFields: t.props.preCaFields, formRelaFieldMaps: t.props.formRelaFieldMaps, linkFields: t.props.linkFields, onChange: _this2.changeSub.bind(_this2, _this2.state.itemParam, i), reloadSubItemParam: _this2.reloadSubItemParam.bind(_this2) });
|
|
747
747
|
})
|
|
748
748
|
)
|
|
749
749
|
);
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
|
|
7
|
+
var _workItem = require('./workItem');
|
|
8
|
+
|
|
9
|
+
Object.defineProperty(exports, 'default', {
|
|
10
|
+
enumerable: true,
|
|
11
|
+
get: function get() {
|
|
12
|
+
return _interopRequireDefault(_workItem).default;
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = undefined;
|
|
7
|
+
|
|
8
|
+
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
|
9
|
+
|
|
10
|
+
var _class, _temp, _initialiseProps;
|
|
11
|
+
|
|
12
|
+
var _react = require('react');
|
|
13
|
+
|
|
14
|
+
var _react2 = _interopRequireDefault(_react);
|
|
15
|
+
|
|
16
|
+
var _Group = require('saltui/lib/Group');
|
|
17
|
+
|
|
18
|
+
var _Group2 = _interopRequireDefault(_Group);
|
|
19
|
+
|
|
20
|
+
var _Field = require('saltui/lib/Field');
|
|
21
|
+
|
|
22
|
+
var _Field2 = _interopRequireDefault(_Field);
|
|
23
|
+
|
|
24
|
+
var _Toast = require('saltui/lib/Toast');
|
|
25
|
+
|
|
26
|
+
var _Toast2 = _interopRequireDefault(_Toast);
|
|
27
|
+
|
|
28
|
+
require('./workItem.less');
|
|
29
|
+
|
|
30
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
31
|
+
|
|
32
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
33
|
+
|
|
34
|
+
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
|
35
|
+
|
|
36
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
|
37
|
+
|
|
38
|
+
var workItem = (_temp = _class = function (_React$Component) {
|
|
39
|
+
_inherits(workItem, _React$Component);
|
|
40
|
+
|
|
41
|
+
function workItem(props) {
|
|
42
|
+
_classCallCheck(this, workItem);
|
|
43
|
+
|
|
44
|
+
// 传入的props参数
|
|
45
|
+
var _this = _possibleConstructorReturn(this, (workItem.__proto__ || Object.getPrototypeOf(workItem)).call(this, props));
|
|
46
|
+
|
|
47
|
+
_initialiseProps.call(_this);
|
|
48
|
+
|
|
49
|
+
var listValue = _this.props.value || [{ sortNo: 1, content: '' }];
|
|
50
|
+
var title = _this.props.label || '今日完成工作';
|
|
51
|
+
var readOnly = _this.props.readOnly || false;
|
|
52
|
+
|
|
53
|
+
// 组件级计数器,用于生成稳定的 React key(不暴露给外部)
|
|
54
|
+
_this._keyCounter = 1;
|
|
55
|
+
listValue = listValue.map(function (it) {
|
|
56
|
+
if (!it.__key) it.__key = _this._keyCounter++;
|
|
57
|
+
return it;
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
_this.state = {
|
|
61
|
+
listValue: listValue,
|
|
62
|
+
title: title,
|
|
63
|
+
readOnly: readOnly
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
return _this;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
// 不在 componentDidMount 中保存渲染结果,直接在 render 中调用 initFn()
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
// 本地输入时更新 state,不立即通知父组件
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
// 输入完成(blur)时通知父组件或做后续处理
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
_createClass(workItem, [{
|
|
79
|
+
key: 'render',
|
|
80
|
+
value: function render() {
|
|
81
|
+
var _this2 = this;
|
|
82
|
+
|
|
83
|
+
return _react2.default.createElement(
|
|
84
|
+
_Group2.default.List,
|
|
85
|
+
{ borderTopNone: true },
|
|
86
|
+
_react2.default.createElement(
|
|
87
|
+
_Field2.default,
|
|
88
|
+
{ required: this.state.required, label: this.state.title, layout: 'v', multiLine: true },
|
|
89
|
+
_react2.default.createElement(
|
|
90
|
+
'div',
|
|
91
|
+
null,
|
|
92
|
+
this.initFn()
|
|
93
|
+
),
|
|
94
|
+
_react2.default.createElement(
|
|
95
|
+
'div',
|
|
96
|
+
{ className: 'iconfo', onClick: function onClick() {
|
|
97
|
+
return _this2.addItem();
|
|
98
|
+
} },
|
|
99
|
+
_react2.default.createElement('i', { className: 'iconfont icon-plus' })
|
|
100
|
+
)
|
|
101
|
+
)
|
|
102
|
+
);
|
|
103
|
+
}
|
|
104
|
+
}]);
|
|
105
|
+
|
|
106
|
+
return workItem;
|
|
107
|
+
}(_react2.default.Component), _initialiseProps = function _initialiseProps() {
|
|
108
|
+
var _this3 = this;
|
|
109
|
+
|
|
110
|
+
this.initFn = function () {
|
|
111
|
+
var list = _this3.state.listValue || [];
|
|
112
|
+
return _react2.default.createElement(
|
|
113
|
+
'div',
|
|
114
|
+
{ className: 'list' },
|
|
115
|
+
list.map(function (item, index) {
|
|
116
|
+
return _react2.default.createElement(
|
|
117
|
+
'div',
|
|
118
|
+
{ className: 'item', key: item.__key },
|
|
119
|
+
_react2.default.createElement(
|
|
120
|
+
'span',
|
|
121
|
+
{ className: 'number' },
|
|
122
|
+
index + 1
|
|
123
|
+
),
|
|
124
|
+
_react2.default.createElement('textarea', {
|
|
125
|
+
disabled: _this3.state.readOnly,
|
|
126
|
+
maxLength: 200,
|
|
127
|
+
className: 'form-control',
|
|
128
|
+
rows: 1,
|
|
129
|
+
placeholder: '1-200\u4E2A\u5B57\u7B26',
|
|
130
|
+
value: item.content,
|
|
131
|
+
onChange: function onChange(e) {
|
|
132
|
+
return _this3.handleLocalChange(index, e.target.value);
|
|
133
|
+
},
|
|
134
|
+
onBlur: function onBlur() {
|
|
135
|
+
return _this3.handleContentChange(index);
|
|
136
|
+
}
|
|
137
|
+
}),
|
|
138
|
+
_react2.default.createElement(
|
|
139
|
+
'span',
|
|
140
|
+
{ className: 'remove-btn', onClick: function onClick() {
|
|
141
|
+
return _this3.removeItem(index);
|
|
142
|
+
} },
|
|
143
|
+
_react2.default.createElement('i', { className: 'iconfont icon-close' })
|
|
144
|
+
)
|
|
145
|
+
);
|
|
146
|
+
})
|
|
147
|
+
);
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
this.addItem = function () {
|
|
151
|
+
var listValue = JSON.parse(JSON.stringify(_this3.state.listValue));
|
|
152
|
+
var num = listValue.length + 1;
|
|
153
|
+
var newItem = { __key: _this3._keyCounter++, sortNo: num, content: '' };
|
|
154
|
+
if (num <= listValue.length) {
|
|
155
|
+
listValue.splice(num - 1, 0, newItem);
|
|
156
|
+
} else {
|
|
157
|
+
listValue.push(newItem);
|
|
158
|
+
}
|
|
159
|
+
listValue.forEach(function (it, i) {
|
|
160
|
+
return it.sortNo = i + 1;
|
|
161
|
+
});
|
|
162
|
+
_this3.setState({ listValue: listValue }, function () {
|
|
163
|
+
// 若需通知父组件,在这里回调(使用最新 state)
|
|
164
|
+
if (_this3.props.onChange) _this3.props.onChange(_this3.state.listValue);
|
|
165
|
+
});
|
|
166
|
+
};
|
|
167
|
+
|
|
168
|
+
this.removeItem = function (index) {
|
|
169
|
+
var listValue = JSON.parse(JSON.stringify(_this3.state.listValue));
|
|
170
|
+
if (index >= 0 && index < listValue.length && listValue.length > 1) {
|
|
171
|
+
listValue.splice(index, 1);
|
|
172
|
+
listValue.forEach(function (it, i) {
|
|
173
|
+
return it.sortNo = i + 1;
|
|
174
|
+
});
|
|
175
|
+
_this3.setState({ listValue: listValue }, function () {
|
|
176
|
+
if (_this3.props.onChange) _this3.props.onChange(_this3.state.listValue);
|
|
177
|
+
});
|
|
178
|
+
} else {
|
|
179
|
+
_Toast2.default.show({ type: 'error', content: '至少保留一个' });
|
|
180
|
+
}
|
|
181
|
+
};
|
|
182
|
+
|
|
183
|
+
this.handleLocalChange = function (index, value) {
|
|
184
|
+
var listValue = (_this3.state.listValue || []).slice();
|
|
185
|
+
if (index >= 0 && index < listValue.length) {
|
|
186
|
+
listValue[index] = Object.assign({}, listValue[index], { content: value });
|
|
187
|
+
_this3.setState({ listValue: listValue });
|
|
188
|
+
}
|
|
189
|
+
};
|
|
190
|
+
|
|
191
|
+
this.handleContentChange = function (index) {
|
|
192
|
+
if (_this3.props.onChange) _this3.props.onChange(_this3.state.listValue);
|
|
193
|
+
};
|
|
194
|
+
}, _temp);
|
|
195
|
+
exports.default = workItem;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
.item {
|
|
2
|
+
position: relative;
|
|
3
|
+
border-radius: 4px;
|
|
4
|
+
margin: 5px 0;
|
|
5
|
+
|
|
6
|
+
.number {
|
|
7
|
+
width: 30px;
|
|
8
|
+
top: 1px;
|
|
9
|
+
left: 1px;
|
|
10
|
+
bottom: 1px;
|
|
11
|
+
position: absolute;
|
|
12
|
+
background: #f2f6fc;
|
|
13
|
+
display: flex;
|
|
14
|
+
align-items: center;
|
|
15
|
+
justify-content: center;
|
|
16
|
+
z-index: 9;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.form-control {
|
|
20
|
+
padding-left: 40px;
|
|
21
|
+
padding-right: 25px;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.form-control:focus {
|
|
25
|
+
border: 1px solid #3480fb;
|
|
26
|
+
border-radius: 4px;
|
|
27
|
+
box-shadow: none;
|
|
28
|
+
outline: 0;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.remove-btn {
|
|
32
|
+
width: 22px;
|
|
33
|
+
top: 1px;
|
|
34
|
+
right: 1px;
|
|
35
|
+
bottom: 1px;
|
|
36
|
+
position: absolute;
|
|
37
|
+
background: #f2f6fc;
|
|
38
|
+
display: flex;
|
|
39
|
+
align-items: center;
|
|
40
|
+
justify-content: center;
|
|
41
|
+
z-index: 9;
|
|
42
|
+
|
|
43
|
+
.iconfont {
|
|
44
|
+
font-size: 12px;
|
|
45
|
+
color: #909399;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.item:not(:last-child) {
|
|
51
|
+
margin: 5px 0 0 0;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.iconfo {
|
|
55
|
+
width: 30px;
|
|
56
|
+
height: 30px;
|
|
57
|
+
margin: 10px auto;
|
|
58
|
+
border-radius: 50%;
|
|
59
|
+
display: flex;
|
|
60
|
+
align-items: center;
|
|
61
|
+
justify-content: center;
|
|
62
|
+
background-color: #3480fb;
|
|
63
|
+
|
|
64
|
+
.iconfont {
|
|
65
|
+
color: #fff;
|
|
66
|
+
}
|
|
67
|
+
}
|