doomiwork 4.0.6 → 4.0.7
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/core/controller.js +3 -3
- package/package.json +1 -1
- package/utilities/requestparser.js +2 -1
package/core/controller.js
CHANGED
|
@@ -219,7 +219,7 @@ class controller {
|
|
|
219
219
|
*/
|
|
220
220
|
async getDataById(req, dataKey, sqlCommand) {
|
|
221
221
|
if (this.logger) this.logger.trace("准备获取dataconfig文件中对应的 %s 详细数据",dataKey)
|
|
222
|
-
const detailinfo = getDetailInfo(dataKey);
|
|
222
|
+
const detailinfo = getDetailInfo(req, dataKey);
|
|
223
223
|
if (!detailinfo) return { successed: false, errcode: -10, errmsg: `缺失${dataKey}对应的详情配置` };
|
|
224
224
|
let beforeData = await this.beforeAccessDB(req, sqlCommand || this._daoModel.getByIdSql(), req.params.id, "detail", this);
|
|
225
225
|
////如果返回Null,则表示不加载数据了
|
|
@@ -255,7 +255,7 @@ class controller {
|
|
|
255
255
|
let detailinfo, resultItem = { successed: true, data: req.body };
|
|
256
256
|
///是否需要将data中的key-value值到配置文件中进行转换
|
|
257
257
|
if (mapping == true) {
|
|
258
|
-
detailinfo = getDetailInfo(dataKey);
|
|
258
|
+
detailinfo = getDetailInfo(req, dataKey);
|
|
259
259
|
if (!detailinfo) return { successed: false, errcode: -10, errmsg: `缺失${dataKey}对应的详情配置` };
|
|
260
260
|
resultItem = View2Data(req, detailinfo.fields, "create");
|
|
261
261
|
///如果转换的验证过程中出现错误,则返回
|
|
@@ -307,7 +307,7 @@ class controller {
|
|
|
307
307
|
let detailinfo, resultItem = { successed: true, data: req.body };
|
|
308
308
|
///是否需要将data中的key-value值到配置文件中进行转换
|
|
309
309
|
if (mapping == true) {
|
|
310
|
-
detailinfo = getDetailInfo(dataKey);
|
|
310
|
+
detailinfo = getDetailInfo(req, dataKey);
|
|
311
311
|
if (!detailinfo) return { successed: false, errcode: -10, errmsg: `缺失${dataKey}对应的详情配置` };
|
|
312
312
|
///从Request中获取到用户提交的数据
|
|
313
313
|
resultItem = View2Data(req, detailinfo.fields, "update");
|
package/package.json
CHANGED
|
@@ -149,10 +149,11 @@ module.exports.getListInfo = (req, dataKey, cfgType = 0, dao) => {
|
|
|
149
149
|
* 详细页面请求上下文中获取需要的信息
|
|
150
150
|
* 如Page ,PageSize , Sort 等等
|
|
151
151
|
*/
|
|
152
|
-
module.exports.getDetailInfo = (dataKey) => {
|
|
152
|
+
module.exports.getDetailInfo = (req,dataKey) => {
|
|
153
153
|
if (dataKey) {
|
|
154
154
|
const dataConfig = dataconfig.getConfig(dataKey);
|
|
155
155
|
if (dataConfig && dataConfig.detail) {
|
|
156
|
+
req.dataConfig = dataConfig;
|
|
156
157
|
const { primary, field: fields, primaryIsAutoIncrease } = dataConfig.detail;
|
|
157
158
|
return { primary, fields, autoincrease: primaryIsAutoIncrease }
|
|
158
159
|
}
|