|
@@ -250,7 +250,7 @@ module.exports = app => {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- async _updateArchiveCommon(ctx, prjId, stgId, rptId, parentUuidName, childUuids) {
|
|
|
+ async _updateArchiveCommon(ctx, prjId, stgId, rptId, parentUuidName, childUuids, splitField) {
|
|
|
const updateDate = new Date();
|
|
|
const montStr = (updateDate.getMonth() + 1) < 10 ? ('0' + (updateDate.getMonth() + 1)) : (updateDate.getMonth() + 1);
|
|
|
const dateStr = (updateDate.getDate()) < 10 ? ('0' + updateDate.getDate()) : (updateDate.getDate());
|
|
@@ -300,14 +300,14 @@ module.exports = app => {
|
|
|
item.items.splice(updateRmIdx, 1);
|
|
|
}
|
|
|
|
|
|
- const newItem = { uuid: parentUuidName, updateDate_time: dtStr, childUuids };
|
|
|
+ const newItem = { uuid: parentUuidName, updateDate_time: dtStr, childUuids, splitField };
|
|
|
item.items.push(newItem);
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
if (!hasArchive) {
|
|
|
// 表示有新的模板需要添加
|
|
|
- contentArr.push({ rpt_id: rptId, items: [{ uuid: parentUuidName, updateDate_time: dtStr, childUuids }] });
|
|
|
+ contentArr.push({ rpt_id: rptId, items: [{ uuid: parentUuidName, updateDate_time: dtStr, childUuids, splitField }] });
|
|
|
}
|
|
|
const updatedRst = await ctx.service.rptArchive.updateArchive(orgArchiveList[0].id, prjId, stgId, contentArr);
|
|
|
// console.log(updatedRst);
|
|
@@ -315,7 +315,7 @@ module.exports = app => {
|
|
|
} else {
|
|
|
// 需要增加
|
|
|
const archiveArr = [];
|
|
|
- archiveArr.push({ rpt_id: rptId, items: [{ uuid: parentUuidName, updateDate_time: dtStr, childUuids }] });
|
|
|
+ archiveArr.push({ rpt_id: rptId, items: [{ uuid: parentUuidName, updateDate_time: dtStr, childUuids, splitField }] });
|
|
|
const addedRst = await ctx.service.rptArchive.createArchive(prjId, stgId, archiveArr);
|
|
|
rst = { err: 0, msg: parentUuidName, data: { uuid: parentUuidName, fileName, updateDate, updatedRst: archiveArr } };
|
|
|
}
|
|
@@ -329,7 +329,11 @@ module.exports = app => {
|
|
|
const prjId = ctx.params.prjId;
|
|
|
const stgId = ctx.params.stgId;
|
|
|
const rptId = ctx.params.rptId;
|
|
|
- const childAmt = parseInt(ctx.params.childAmt); // 子分页数量
|
|
|
+ // const childAmt = parseInt(ctx.params.childAmt); // 子分页数量
|
|
|
+ const childInfo = ctx.params.childAmt.split(';'); // 这个参数带比较多的信息,包含分割指标的:1. 名称 2. ID 3. 内容
|
|
|
+ const childAmt = parseInt(childInfo[0]);
|
|
|
+ const splitFieldObj = JSON.parse(childInfo[1]);
|
|
|
+ // console.log(splitFieldObj);
|
|
|
const parentUuid = uuidV1();
|
|
|
const childUuids = [];
|
|
|
// const newUuidName = uuidV1();
|
|
@@ -360,7 +364,7 @@ module.exports = app => {
|
|
|
}
|
|
|
// stream = await parts();
|
|
|
}
|
|
|
- const body = await this._updateArchiveCommon(ctx, prjId, stgId, rptId, parentUuid, childUuids);
|
|
|
+ const body = await this._updateArchiveCommon(ctx, prjId, stgId, rptId, parentUuid, childUuids, splitFieldObj);
|
|
|
ctx.body = body;
|
|
|
} catch (error) {
|
|
|
ctx.helper.log(error);
|
|
@@ -384,7 +388,7 @@ module.exports = app => {
|
|
|
if (!(oss_result && oss_result.url && oss_result.res.status === 200)) {
|
|
|
throw '上传文件失败';
|
|
|
}
|
|
|
- const body = await this._updateArchiveCommon(ctx, prjId, stgId, rptId, newUuidName, []);
|
|
|
+ const body = await this._updateArchiveCommon(ctx, prjId, stgId, rptId, newUuidName, [], {});
|
|
|
ctx.body = body;
|
|
|
} catch (err) {
|
|
|
this.log(err);
|
|
@@ -422,7 +426,7 @@ module.exports = app => {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- const body = await this._updateArchiveCommon(ctx, prjId, stgId, rptId, orgUuidName, []);
|
|
|
+ const body = await this._updateArchiveCommon(ctx, prjId, stgId, rptId, orgUuidName, [], {});
|
|
|
ctx.body = body;
|
|
|
} catch (err) {
|
|
|
this.log(err);
|