소스 검색

Merge branch 'requirement_367' into debug

cldu 2 주 전
부모
커밋
d927797401
2개의 변경된 파일39개의 추가작업 그리고 23개의 파일을 삭제
  1. 19 12
      src/CustomElement/EtaTable.ce.vue
  2. 20 11
      src/views/ppt/components/SheetWrap.vue

+ 19 - 12
src/CustomElement/EtaTable.ce.vue

@@ -33,6 +33,11 @@ const SheetFFType = {
     12 : '华文隶书',
  }
 
+const HtObj = {
+    0:"center",
+    1:'left',
+    2:'right'
+}
 const setDefaultSource=(sourceText)=>{
   return JSON.stringify({
     isShow: true,
@@ -66,6 +71,16 @@ async function getTableData(){
 
 getTableData()
 
+function handleCellStyle(cell){
+    return `
+        color: ${cell.fc};
+        font-weight: ${cell.bl ? 'bold' : 'normal'};
+        font-style: ${cell.it ? 'italic' : 'normal'};
+        text-align: ${HtObj[cell.HorizontalType]};
+        font-family: ${handleFF(cell.ff)};
+    `
+}
+
 function handleFF(ff){
     return ff ? (typeof ff == 'number' ? SheetFFType[ff] :  ff) : ''
 }
@@ -120,25 +135,17 @@ function getSizeStyle(index,type) {
                     :colspan="cell.mc.cs||1"
                     :rowspan="cell.mc.rs||1"
                     :style="`
-                        color: ${cell.fc};
-                        font-weight: ${cell.bl ? 'bold' : 'normal'};
-                        font-style: ${cell.it ? 'italic' : 'normal'};
                         background: ${cell.bg};
-                        font-size: ${cell.fs||info.Config?.FontSize||12}px;
-                        ${cell.ct.s ? '' : `font-family: ${handleFF(cell.ff)};`}
+                        font-size: ${info.Config?.FontSize||cell.fs||12}px;
+                        ${!cell.ct.s ? handleCellStyle(cell) : ''}
                         ${getSizeStyle(cell_index,'width')}
                     `"
                     >
-                    <div class="split-word" v-if="cell.ct.s">
+                    <div class="split-word" v-if="cell.ct.s" :style="`text-align: ${HtObj[cell.HorizontalType]};`">
                         <span 
                         v-for="(word,word_index) in cell.ct.s" 
                         :key="`${index}_${cell_index}_${word_index}`"
-                        :style="`
-                            color: ${word.fc};
-                            font-weight: ${word.bl ? 'bold' : 'normal'};
-                            font-style: ${word.it ? 'italic' : 'normal'};
-                            font-family: ${handleFF(word.ff)};
-                        `"
+                        :style="handleCellStyle(word)"
                         >{{word.v}}</span>
                     </div>
                     <div v-else>{{cell.m}}</div>

+ 20 - 11
src/views/ppt/components/SheetWrap.vue

@@ -28,6 +28,12 @@ const SheetFFType = {
     12 : '华文隶书',
  }
 
+const HtObj = {
+    0:"center",
+    1:'left',
+    2:'right'
+}
+
 const sourceFrom=ref(null)
 
 // 获取表格数据
@@ -50,6 +56,16 @@ function setDefaultSource(sourceText){
     }
 }
 
+function handleCellStyle(cell){
+    return `
+        color: ${cell.fc};
+        font-weight: ${cell.bl ? 'bold' : 'normal'};
+        font-style: ${cell.it ? 'italic' : 'normal'};
+        text-align: ${HtObj[cell.HorizontalType]};
+        font-family: ${handleFF(cell.ff)};
+    `
+}
+
 function handleFF(ff){
     return ff ? (typeof ff == 'number' ? SheetFFType[ff] :  ff) : ''
 }
@@ -72,24 +88,17 @@ onMounted(()=>{
                             :rowspan="col.mc.rs===0?1:col.mc.rs"
                             :colspan="col.mc.cs===0?1:col.mc.cs"
                             :style="`
-                                color: ${col.fc};
-                                font-weight: ${col.bl ? 'bold' : 'normal'};
-                                font-style: ${col.it ? 'italic' : 'normal'};
                                 background: ${col.bg||'transparent'};
-                                ${col.ct.s ? '' : `font-family: ${handleFF(col.ff)};`}
+                                font-size: ${pptSheetSize || col.fs || 12}px;
+                                ${!col.ct.s ? handleCellStyle(col) : ''}
                             `"
                         >
                             <!-- 单元格拆分 -->
-                            <div class="split-word" v-if="col.ct.s">
+                            <div class="split-word" v-if="col.ct.s" :style="`text-align: ${HtObj[col.HorizontalType]};`">
                                 <span 
                                     v-for="(word,word_index) in col.ct.s" 
                                     :key="`${rowIndex}_${colIndex}_${word_index}`"
-                                    :style="`
-                                    color: ${word.fc};
-                                    font-weight: ${word.bl ? 'bold' : 'normal'};
-                                    font-style: ${word.it ? 'italic' : 'normal'};
-                                    font-family: ${handleFF(word.ff)};
-                                    `"
+                                    :style="handleCellStyle(word)"
                                 >{{word.v}}</span>
                             </div>
                             <div v-else>{{col.m}}</div>