|
@@ -780,7 +780,7 @@ let pageCCOprObj = {
|
|
|
}
|
|
|
// 保存的条件数据
|
|
|
const findSet = { ID: node.data.ID, projectID: node.data.projectID };
|
|
|
-
|
|
|
+ const baseData = { findSet, itemJob, itemCharacter };
|
|
|
let characterArray = [];
|
|
|
for (const tmp of itemCharacter) {
|
|
|
if (tmp.eigenvalue === undefined || tmp.eigenvalue.length <= 0 || !tmp.isChecked) {
|
|
@@ -823,7 +823,16 @@ let pageCCOprObj = {
|
|
|
|
|
|
// 组合数据
|
|
|
let content = '';
|
|
|
- let defaultContentInfo = {};
|
|
|
+ const jobContent = jobArray.join("\r\n");
|
|
|
+ const characterContent = characterArray.join("\r\n");
|
|
|
+ let nodeNameList = node.data.name.split("\n");
|
|
|
+ const nameContent = nodeNameList[0] !== undefined ? nodeNameList[0] : '';
|
|
|
+ // 存入对象,生成数据时用
|
|
|
+ let defaultContentInfo = {
|
|
|
+ jobContent,
|
|
|
+ characterContent,
|
|
|
+ nameContent
|
|
|
+ };
|
|
|
switch (setting.addContent) {
|
|
|
case "1":
|
|
|
// 项目特征+工作内容
|
|
@@ -854,16 +863,6 @@ let pageCCOprObj = {
|
|
|
break;
|
|
|
case "":
|
|
|
// 无
|
|
|
- const jobContent = jobArray.join("\r\n");
|
|
|
- const characterContent = characterArray.join("\r\n");
|
|
|
- let nodeNameList = node.data.name.split("\n");
|
|
|
- const nameContent = nodeNameList[0] !== undefined ? nodeNameList[0] : '';
|
|
|
- // 存入对象,生成数据时用
|
|
|
- defaultContentInfo = {
|
|
|
- jobContent,
|
|
|
- characterContent,
|
|
|
- nameContent
|
|
|
- };
|
|
|
break;
|
|
|
}
|
|
|
// 显示格式
|
|
@@ -881,10 +880,13 @@ let pageCCOprObj = {
|
|
|
content = '(' + contentArray.join(',') + ')';
|
|
|
break;
|
|
|
}
|
|
|
+ // 还原数据
|
|
|
+ this.restoreData(node, setting.position, baseData, defaultContentInfo);
|
|
|
// 添加到对应位置
|
|
|
let saveObj = {};
|
|
|
switch (setting.position) {
|
|
|
case "1":
|
|
|
+ // 添加到项目特征列
|
|
|
saveObj = {field: 'itemCharacterText', text: content};
|
|
|
// 更新到数据库
|
|
|
pageCCOprObj.updateCharacterContent(findSet, {field: 'itemCharacter', updateArr: itemCharacter},
|
|
@@ -978,4 +980,51 @@ let pageCCOprObj = {
|
|
|
|
|
|
return result;
|
|
|
},
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 还原数据
|
|
|
+ *
|
|
|
+ * @param {Object} node - 节点数据
|
|
|
+ * @param {String} setType - 当前设置的项
|
|
|
+ * @param {Object} baseData - 需要用到的基础数据
|
|
|
+ * @param {Object} defaultContentInfo - 默认数据
|
|
|
+ * @return {void}
|
|
|
+ */
|
|
|
+ restoreData: function(node, setType, baseData, defaultContentInfo) {
|
|
|
+ if (baseData.findSet === undefined ||
|
|
|
+ baseData.itemJob === undefined || baseData.itemCharacter === undefined) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ switch (setType) {
|
|
|
+ case "1":
|
|
|
+ // 添加到项目特征列
|
|
|
+ // 把其他字段还原回原来数据
|
|
|
+ // 还原名称
|
|
|
+ projectObj.project.Bills.updateField(node.source, 'name', defaultContentInfo.nameContent, true);
|
|
|
+ projectObj.mainController.refreshTreeNode([node], false);
|
|
|
+ // 还原工作内容
|
|
|
+ pageCCOprObj.updateCharacterContent(baseData.findSet, {field: 'jobContent', updateArr: baseData.itemJob},
|
|
|
+ {field: 'jobContentText', text: defaultContentInfo.jobContent}, node);
|
|
|
+ break;
|
|
|
+ case "2":
|
|
|
+ // 添加到清单名称
|
|
|
+ // 还原特征
|
|
|
+ pageCCOprObj.updateCharacterContent(baseData.findSet, {field: 'itemCharacter', updateArr: baseData.itemCharacter},
|
|
|
+ {field: 'itemCharacterText', text: defaultContentInfo.characterContent}, node);
|
|
|
+ // 还原工作内容
|
|
|
+ pageCCOprObj.updateCharacterContent(baseData.findSet, {field: 'jobContent', updateArr: baseData.itemJob},
|
|
|
+ {field: 'jobContentText', text: defaultContentInfo.jobContent}, node);
|
|
|
+ break;
|
|
|
+ case "3":
|
|
|
+ // 添加到工作内容列
|
|
|
+ // 还原名称
|
|
|
+ projectObj.project.Bills.updateField(node.source, 'name', defaultContentInfo.nameContent, true);
|
|
|
+ projectObj.mainController.refreshTreeNode([node], false);
|
|
|
+ // 还原特征
|
|
|
+ pageCCOprObj.updateCharacterContent(baseData.findSet, {field: 'itemCharacter', updateArr: baseData.itemCharacter},
|
|
|
+ {field: 'jobContentText', text: defaultContentInfo.characterContent}, node);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ },
|
|
|
}
|