Procházet zdrojové kódy

feat(wise-cost-util): 变更特征及内容方法

vian před 4 roky
rodič
revize
bd30ebf0a6
1 změnil soubory, kde provedl 12 přidání a 6 odebrání
  1. 12 6
      wise-cost-util/src/bill.ts

+ 12 - 6
wise-cost-util/src/bill.ts

@@ -3,6 +3,8 @@ import { IJobContent, IItemCharacter, IStdBill, IStdJobContent, IStdItemCharacte
 interface IJobsAndCharacterText {
   jobContentText: string;
   itemCharacterText: string;
+  onlyItemCharacterText: string;
+  onlyJobContentText: string;
 }
 
 interface IJobContentMap {
@@ -23,23 +25,27 @@ export const getJobsAndCharacterText = (
 ): IJobsAndCharacterText => {
   const jobContentText = '';
   let itemCharacterText = '';
+  let onlyJobContentText = '';
+  let onlyItemCharacterText = '';
   jobContents.sort((a, b) => a.seq - b.seq);
   itemCharacters.sort((a, b) => a.seq - b.seq);
-  const textArray: string[] = ['[项目特征]'];
+  const characterTextArray: string[] = ['[项目特征]'];
   let i = 1;
   for (const item of itemCharacters) {
-    if (item.isChecked) textArray.push(`${i}. ${item.character || ''}: ${item.eigenvalue || ''}`);
+    if (item.isChecked) characterTextArray.push(`${i}. ${item.character || ''}: ${item.eigenvalue || ''}`);
     i += 1;
   }
+  onlyItemCharacterText = characterTextArray.join('\n');
 
-  textArray.push('[工作内容]');
+  const jobTextArray = ['[工作内容]'];
   i = 1;
   for (const job of jobContents) {
-    if (job.isChecked) textArray.push(`${i}. ${job.content || ''}`);
+    if (job.isChecked) jobTextArray.push(`${i}. ${job.content || ''}`);
     i += 1;
   }
-  itemCharacterText = textArray.join('\n');
-  return { jobContentText, itemCharacterText };
+  onlyJobContentText = jobTextArray.join('\n');
+  itemCharacterText = `${onlyItemCharacterText}\n${onlyJobContentText}`;
+  return { jobContentText, itemCharacterText, onlyItemCharacterText, onlyJobContentText };
 };
 
 export const getJobContents = (stdBill: IStdBill, stdJobContentMap: IJobContentMap): IJobContent[] => {