提交
This commit is contained in:
		| @ -1,11 +1,29 @@ | ||||
| <template> | ||||
|   <div class="upload-file"> | ||||
|     <el-upload ref="fileUploadRef" multiple :action="realUploadUrl" :before-upload="handleBeforeUpload" | ||||
|       :file-list="fileList" :limit="limit" :on-error="handleUploadError" :on-exceed="handleExceed" | ||||
|       :on-success="handleUploadSuccess" :show-file-list="showFileList" :on-preview="handlePreview" :headers="headers" | ||||
|       class="upload-file-uploader" :list-type="isConstruction ? 'picture-card' : 'text'" :accept="accept" :drag="isDarg" | ||||
|       :data="data" :auto-upload="autoUpload" :on-change="handleChange" :on-remove="handleRemove" :method="method" | ||||
|       :http-request="customUpload"> | ||||
|     <el-upload | ||||
|       ref="fileUploadRef" | ||||
|       multiple | ||||
|       :action="realUploadUrl" | ||||
|       :before-upload="handleBeforeUpload" | ||||
|       :file-list="fileList" | ||||
|       :limit="limit" | ||||
|       :on-error="handleUploadError" | ||||
|       :on-exceed="handleExceed" | ||||
|       :on-success="handleUploadSuccess" | ||||
|       :show-file-list="showFileList" | ||||
|       :on-preview="handlePreview" | ||||
|       :headers="headers" | ||||
|       class="upload-file-uploader" | ||||
|       :list-type="isConstruction ? 'picture-card' : 'text'" | ||||
|       :accept="accept" | ||||
|       :drag="isDarg" | ||||
|       :data="data" | ||||
|       :auto-upload="autoUpload" | ||||
|       :on-change="handleChange" | ||||
|       :on-remove="handleRemove" | ||||
|       :method="method" | ||||
|       :http-request="customUpload" | ||||
|     > | ||||
|       <slot> | ||||
|         <div> | ||||
|           <!-- 上传按钮 --> | ||||
| @ -24,10 +42,20 @@ | ||||
|             的文件 | ||||
|           </div> | ||||
|           <!-- 文件列表 --> | ||||
|           <transition-group v-if="!isConstruction && !isImportInfo" | ||||
|             class="upload-file-list el-upload-list el-upload-list--text" name="el-fade-in-linear" tag="ul" @click.stop> | ||||
|             <li style="margin-top: 10px" v-for="(file, index) in fileList" :key="file.uid" | ||||
|               class="el-upload-list__item ele-upload-list__item-content" v-if="autoUpload"> | ||||
|           <transition-group | ||||
|             v-if="!isConstruction && !isImportInfo" | ||||
|             class="upload-file-list el-upload-list el-upload-list--text" | ||||
|             name="el-fade-in-linear" | ||||
|             tag="ul" | ||||
|             @click.stop | ||||
|           > | ||||
|             <li | ||||
|               style="margin-top: 10px" | ||||
|               v-for="(file, index) in fileList" | ||||
|               :key="file.uid" | ||||
|               class="el-upload-list__item ele-upload-list__item-content" | ||||
|               v-if="autoUpload" | ||||
|             > | ||||
|               <el-link :href="`${file.url}`" :underline="false" target="_blank"> | ||||
|                 <span class="el-icon-document"> {{ getFileName(file.name) }} </span> | ||||
|               </el-link> | ||||
| @ -79,7 +107,7 @@ const props = defineProps({ | ||||
|   // 数量限制 | ||||
|   limit: propTypes.number.def(5), | ||||
|   // 大小限制(MB) | ||||
|   fileSize: propTypes.number.def(5), | ||||
|   fileSize: propTypes.number.def(10), | ||||
|   // 文件类型, 例如['png', 'jpg', 'jpeg'] | ||||
|   // fileType: propTypes.array.def(['doc', 'xls', 'ppt', 'txt', 'pdf', 'png', 'jpg', 'jpeg', 'zip']), | ||||
|   fileType: propTypes.array.def(['pdf']), | ||||
| @ -440,7 +468,7 @@ defineExpose({ submitUpload }); | ||||
|     } | ||||
|   } | ||||
|  | ||||
|   >span { | ||||
|   > span { | ||||
|     width: 100%; | ||||
|   } | ||||
| } | ||||
|  | ||||
| @ -56,7 +56,7 @@ const props = defineProps({ | ||||
|   // 图片数量限制 | ||||
|   limit: propTypes.number.def(5), | ||||
|   // 大小限制(MB) | ||||
|   fileSize: propTypes.number.def(5), | ||||
|   fileSize: propTypes.number.def(10), | ||||
|   // 文件类型, 例如['png', 'jpg', 'jpeg'] | ||||
|   fileType: propTypes.array.def(['png', 'jpg', 'jpeg']), | ||||
|   // 是否显示提示 | ||||
|  | ||||
| @ -46,8 +46,10 @@ export let pieOption = { | ||||
|     label: { | ||||
|       alignTo: 'edge', | ||||
|       formatter: function (params) { | ||||
|         console.log(params, 3333333333); | ||||
|  | ||||
|         // 只显示前三个数据项 | ||||
|         return `{name|${params.data.name}}\n{percent|${params.data.completionRate}MW}`; | ||||
|         return `{name|${params.data.name}}\n{percent|${(params.data.completionRate / 100).toFixed(2)}%}`; | ||||
|       }, | ||||
|       minMargin: 10, | ||||
|       edgeDistance: 20, | ||||
|  | ||||
| @ -110,23 +110,23 @@ const getData = async () => { | ||||
|   if (res.code == 200) { | ||||
|     capacityData.value = res.data; | ||||
|     // processedDataList.value = res.data.projectProgressDetailList; | ||||
|     let totalCapacity = 0; | ||||
|     const processedData = res.data.projectProgressDetailList.map((item) => { | ||||
|       const capacity = parseInt(item.projectCapacity) || 0; | ||||
|       totalCapacity += capacity; | ||||
|       return { | ||||
|         name: item.projectName, | ||||
|         value: capacity, | ||||
|         completionRate: item.completionRate | ||||
|       }; | ||||
|     }); | ||||
|     // let totalCapacity = 0; | ||||
|     // const processedData = res.data.projectProgressDetailList.map((item) => { | ||||
|     //   const capacity = parseInt(item.projectCapacity) || 0; | ||||
|     //   totalCapacity += capacity; | ||||
|     //   return { | ||||
|     //     name: item.projectName, | ||||
|     //     value: capacity, | ||||
|     //     completionRate: item.completionRate | ||||
|     //   }; | ||||
|     // }); | ||||
|  | ||||
|     // 计算每个项目的百分比 | ||||
|     processedData.forEach((item) => { | ||||
|       item.percentage = totalCapacity > 0 ? ((item.value / totalCapacity) * 100).toFixed(2) : '0%'; | ||||
|     }); | ||||
|     processedDataList.value = processedData; | ||||
|     initPieChart(); | ||||
|     // // 计算每个项目的百分比 | ||||
|     // processedData.forEach((item) => { | ||||
|     //   item.percentage = totalCapacity > 0 ? ((item.value / totalCapacity) * 100).toFixed(2) : '0%'; | ||||
|     // }); | ||||
|     // processedDataList.value = processedData; | ||||
|     // initPieChart(); | ||||
|   } | ||||
| }; | ||||
| // 初始化饼图 | ||||
| @ -158,6 +158,25 @@ const getOutputData = async () => { | ||||
|     designAreaData.value = res.data.map((item: any) => Number((item.plannedCapacity * item.progressPercentage) / 100)); | ||||
|     transferAreaData.value = res.data.map((item: any) => Number(item.plannedCapacity)); | ||||
|     barNames.value = res.data.map((item: any) => item.projectName); | ||||
|     let totalCapacity = 0; | ||||
|     const processedData = res.data.map((item) => { | ||||
|       const capacity = item.plannedCapacity * item.progressPercentage || 0; | ||||
|       totalCapacity += capacity; | ||||
|       return { | ||||
|         name: item.projectName, | ||||
|         value: capacity, | ||||
|         completionRate: item.progressPercentage | ||||
|       }; | ||||
|     }); | ||||
|  | ||||
|     // 计算每个项目的百分比 | ||||
|     processedData.forEach((item) => { | ||||
|       item.percentage = totalCapacity > 0 ? ((item.value / totalCapacity) * 100).toFixed(2) : '0%'; | ||||
|     }); | ||||
|     console.log(processedData, 55555555); | ||||
|  | ||||
|     processedDataList.value = processedData; | ||||
|     initPieChart(); | ||||
|     initLineChart(); | ||||
|   } | ||||
| }; | ||||
|  | ||||
		Reference in New Issue
	
	Block a user