ns-base-module 1.1.65 → 1.1.66
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.
|
@@ -943,15 +943,15 @@ var ColumnsToolbar = function ColumnsToolbar(_ref4) {
|
|
|
943
943
|
var cancel = function cancel() {};
|
|
944
944
|
|
|
945
945
|
// 设置默认
|
|
946
|
-
var handleSaveDefault = function handleSaveDefault(isDefault) {
|
|
946
|
+
var handleSaveDefault = function handleSaveDefault(isDefault, code) {
|
|
947
947
|
var arr = [].concat(_toConsumableArray(templateUser), _toConsumableArray(template));
|
|
948
948
|
arr.forEach(function (item) {
|
|
949
949
|
if (item.value === value) {
|
|
950
950
|
saveTempale({
|
|
951
951
|
menu_code: menuCode,
|
|
952
952
|
form_template_code: formTemplateCode,
|
|
953
|
-
is_default: isDefault,
|
|
954
|
-
is_default_public: isDefault,
|
|
953
|
+
is_default: code !== "public" ? isDefault : "N",
|
|
954
|
+
is_default_public: code === "public" ? isDefault : "N",
|
|
955
955
|
code: item === null || item === void 0 ? void 0 : item.value,
|
|
956
956
|
name: item === null || item === void 0 ? void 0 : item.label,
|
|
957
957
|
configs: item === null || item === void 0 ? void 0 : item.define,
|
|
@@ -1171,7 +1171,26 @@ var ColumnsToolbar = function ColumnsToolbar(_ref4) {
|
|
|
1171
1171
|
type: "primary"
|
|
1172
1172
|
}, initLang({
|
|
1173
1173
|
id: "button.set.default"
|
|
1174
|
-
}))), /*#__PURE__*/React.createElement(Button, {
|
|
1174
|
+
}))), (curItem === null || curItem === void 0 ? void 0 : curItem.perms_type) == "public" && /*#__PURE__*/React.createElement(React.Fragment, null, (curItem === null || curItem === void 0 ? void 0 : curItem.is_default_public) === "Y" ? /*#__PURE__*/React.createElement(Button, {
|
|
1175
|
+
onClick: function onClick() {
|
|
1176
|
+
return handleSaveDefault("N", "public");
|
|
1177
|
+
},
|
|
1178
|
+
size: "small",
|
|
1179
|
+
type: "primary"
|
|
1180
|
+
}, initLang({
|
|
1181
|
+
id: "button.set.cancelDefault"
|
|
1182
|
+
})) : /*#__PURE__*/React.createElement(Popconfirm, {
|
|
1183
|
+
title: "\u6CA1\u6709\u8BBE\u7F6E\u4E2A\u4EBA\u6A21\u677F\u7684\u7528\u6237\u5C06\u4F1A\u9ED8\u8BA4\u5230\u8BE5\u516C\u5171\u6A21\u677F!",
|
|
1184
|
+
onConfirm: function onConfirm() {
|
|
1185
|
+
handleSaveDefault("Y", "public");
|
|
1186
|
+
}
|
|
1187
|
+
// onCancel={() => {}}
|
|
1188
|
+
}, /*#__PURE__*/React.createElement(Button, {
|
|
1189
|
+
size: "small",
|
|
1190
|
+
type: "primary"
|
|
1191
|
+
}, initLang({
|
|
1192
|
+
id: "button.set.default"
|
|
1193
|
+
})))), /*#__PURE__*/React.createElement(Button, {
|
|
1175
1194
|
style: {
|
|
1176
1195
|
marginLeft: 8
|
|
1177
1196
|
},
|
|
@@ -105,6 +105,7 @@ var updateTemplateFilds = function updateTemplateFilds(JsonPares, _columns) {
|
|
|
105
105
|
* */
|
|
106
106
|
export function adapterColumns(customColumns, columns) {
|
|
107
107
|
if (customColumns && customColumns.length && columns && columns.length) {
|
|
108
|
+
var _item2;
|
|
108
109
|
// 展平 columns, 1,子是动态列 父级必须是,父级的表头宽度取决于子级设置.2,子级是浮动 父级同步 解决首行选择框的浮动
|
|
109
110
|
var _columns = flatColumns(columns);
|
|
110
111
|
var itemLoop = function itemLoop(arr, commad) {
|
|
@@ -126,100 +127,107 @@ export function adapterColumns(customColumns, columns) {
|
|
|
126
127
|
_loop2(k, j);
|
|
127
128
|
}
|
|
128
129
|
};
|
|
130
|
+
var item = null;
|
|
129
131
|
for (var n = 0, leng = customColumns.length; n < leng; n++) {
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
132
|
+
if (customColumns[n].is_default_public == "Y") {
|
|
133
|
+
item = customColumns[n];
|
|
134
|
+
}
|
|
135
|
+
if (customColumns[n].is_default == "Y") {
|
|
136
|
+
item = customColumns[n];
|
|
137
|
+
break;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
if ((_item2 = item) !== null && _item2 !== void 0 && _item2.is_default) {
|
|
141
|
+
var JsonPares = JSON.parse(item.define);
|
|
133
142
|
|
|
134
|
-
|
|
135
|
-
|
|
143
|
+
// 删 旧模板多出的字段
|
|
144
|
+
itemLoop(JsonPares, "del");
|
|
136
145
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
}
|
|
146
|
+
// 展平 columns
|
|
147
|
+
var flaJsonPares = flatColumns(JsonPares);
|
|
148
|
+
// 增 新字段加最后
|
|
149
|
+
var _loop3 = function _loop3(j) {
|
|
150
|
+
var _code = _columns[j].code ? "code" : "dataIndex";
|
|
151
|
+
if (!find(flaJsonPares, function (o) {
|
|
152
|
+
return o[_code] === _columns[j][_code];
|
|
153
|
+
})) {
|
|
154
|
+
var _item = initColumns([_columns[j]], null)[0];
|
|
155
|
+
if (_item.customizable !== false) {
|
|
156
|
+
// 不是动态列
|
|
157
|
+
if (_item.fixed === "left") {
|
|
158
|
+
JsonPares.unshift(_item);
|
|
159
|
+
} else {
|
|
160
|
+
JsonPares.push(_item);
|
|
153
161
|
}
|
|
154
162
|
}
|
|
163
|
+
}
|
|
155
164
|
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
});
|
|
163
|
-
if (h) {
|
|
164
|
-
d.width = h.width;
|
|
165
|
-
d.fixed = h.fixed;
|
|
166
|
-
d.checked = h.checked;
|
|
167
|
-
}
|
|
168
|
-
if (d.children && d.children.length && h !== null && h !== void 0 && h.children && h !== null && h !== void 0 && h.children.length) {
|
|
169
|
-
loopSetChildren(d.children, h.children);
|
|
170
|
-
}
|
|
165
|
+
// 动态列 columns[j].customizable === false 不能用模板,用列表数据
|
|
166
|
+
if (_columns[j].customizable === false && _code) {
|
|
167
|
+
var loopSetChildren = function loopSetChildren(arr1, arr2) {
|
|
168
|
+
arr1.forEach(function (d) {
|
|
169
|
+
var h = find(arr2, function (o) {
|
|
170
|
+
return o[_code] === d[_code];
|
|
171
171
|
});
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
_JsonPares[i]
|
|
187
|
-
|
|
172
|
+
if (h) {
|
|
173
|
+
d.width = h.width;
|
|
174
|
+
d.fixed = h.fixed;
|
|
175
|
+
d.checked = h.checked;
|
|
176
|
+
}
|
|
177
|
+
if (d.children && d.children.length && h !== null && h !== void 0 && h.children && h !== null && h !== void 0 && h.children.length) {
|
|
178
|
+
loopSetChildren(d.children, h.children);
|
|
179
|
+
}
|
|
180
|
+
});
|
|
181
|
+
};
|
|
182
|
+
var loopSetZable = function loopSetZable(_JsonPares) {
|
|
183
|
+
for (var i = 0, l = _JsonPares.length; i < l; i++) {
|
|
184
|
+
if (_columns[j][_code] === _JsonPares[i][_code]) {
|
|
185
|
+
var obj = {
|
|
186
|
+
width: _JsonPares[i].width,
|
|
187
|
+
fixed: _JsonPares[i].fixed,
|
|
188
|
+
checked: _JsonPares[i].checked
|
|
189
|
+
};
|
|
190
|
+
_columns[j] = _objectSpread(_objectSpread({}, _columns[j]), obj);
|
|
191
|
+
if (_columns[j].children && _columns[j].children.length && _JsonPares[i].children && _JsonPares[i].children.length) {
|
|
192
|
+
loopSetChildren(_columns[j].children, _JsonPares[i].children);
|
|
188
193
|
}
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
// }
|
|
193
|
-
// }
|
|
194
|
+
var d = initColumns([_columns[j]], null)[0];
|
|
195
|
+
_JsonPares[i] = _objectSpread({}, d);
|
|
196
|
+
return;
|
|
194
197
|
}
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
198
|
+
// else {
|
|
199
|
+
// if (_JsonPares[i].children && _JsonPares[i].children.length) {
|
|
200
|
+
// loopSetZable(_JsonPares[i].children);
|
|
201
|
+
// }
|
|
202
|
+
// }
|
|
203
|
+
}
|
|
204
|
+
};
|
|
205
|
+
loopSetZable(JsonPares);
|
|
201
206
|
}
|
|
207
|
+
};
|
|
208
|
+
for (var j = 0, k = _columns.length; j < k; j++) {
|
|
209
|
+
_loop3(j);
|
|
210
|
+
}
|
|
202
211
|
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
212
|
+
// 子级是否全部 浮动
|
|
213
|
+
JsonPares.forEach(function (dd) {
|
|
214
|
+
if (dd.fixed && dd.children && dd.children.length) {
|
|
215
|
+
var isAllChildrenFixed = true;
|
|
216
|
+
dd.children.forEach(function (hh) {
|
|
217
|
+
if (hh.checked && hh.fixed !== dd.fixed) {
|
|
218
|
+
isAllChildrenFixed = false;
|
|
219
|
+
}
|
|
220
|
+
});
|
|
221
|
+
dd.isAllChildrenFixed = isAllChildrenFixed;
|
|
222
|
+
}
|
|
223
|
+
});
|
|
215
224
|
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
}
|
|
225
|
+
// 替成新配置
|
|
226
|
+
updateTemplateFilds(JsonPares, _columns);
|
|
227
|
+
return {
|
|
228
|
+
JsonPares: JsonPares,
|
|
229
|
+
item: item
|
|
230
|
+
};
|
|
223
231
|
}
|
|
224
232
|
}
|
|
225
233
|
return {
|