Bladeren bron

fix: 修改指标库取消点击不关问题

username 7 maanden geleden
bovenliggende
commit
955335c7f2

+ 1 - 4
src/api/indexDefine.ts

@@ -47,8 +47,5 @@ export const postImportQuotaTemplate = data => {
 };
 // 日志
 export const getQuotaLogInfo = data => {
-  return http.request<QuotaPageList>(
-    "get",
-    `/quota/getQuotaLogInfo/&quotaId=${data}`
-  );
+  return http.request<QuotaPageList>("get", `/quota/getQuotaLogInfo/${data}`);
 };

+ 36 - 15
src/components/import/index.vue

@@ -35,7 +35,6 @@ const handleUploadChange = (file: File) => {
   fileDocument.value = file; // 保存文件
   const reader = new FileReader();
   let fileType = file.name.slice(-4);
-  console.log("文件", file.name.slice(-4));
   if (fileType == "xlsx") {
     reader.onload = e => {
       const data = new Uint8Array(e.target?.result as ArrayBuffer);
@@ -43,16 +42,36 @@ const handleUploadChange = (file: File) => {
       const firstSheetName = workbook.SheetNames[0]; // 获取第一个工作表名
       const worksheet = workbook.Sheets[firstSheetName]; // 获取第一个工作表
       const jsonData = XLSX.utils.sheet_to_json(worksheet, { header: 1 }); // 将工作表转为 JSON
+      console.log(jsonData, "获取的数据");
+      if (jsonData[1].length == 6) {
+        tableHeaders.value = [
+          "工号",
+          "人员",
+          "考核模板",
+          "指标名称",
+          "完成值",
+          "得分"
+        ]; // 表头
 
-      if (jsonData.length > 0) {
-        tableHeaders.value = jsonData[0]; // 表头
-        tableData.value = jsonData.slice(1).map(row => {
-          const rowData = {};
-          tableHeaders.value.forEach((header, index) => {
-            rowData[header] = row[index] !== undefined ? row[index] : null; // 填充缺失值
-          });
-          return rowData;
+        const arr = jsonData.slice(2).map(row => {
+          if (row[0] && row[1] && row[2] && row[3]) {
+            const rowData = {};
+            tableHeaders.value.forEach((header, index) => {
+              if (row[index]) {
+                rowData[header] = row[index];
+              }
+            });
+            return rowData;
+          }
         });
+        tableData.value = arr.filter(item => item);
+        // tableData.value = jsonData.slice(1).map(row => {
+        //   const rowData = {};
+        //   tableHeaders.value.forEach((header, index) => {
+        //     rowData[header] = row[index] !== undefined ? row[index] : null; // 填充缺失值
+        //   });
+        //   return rowData;
+        // });
         console.log("表头", tableHeaders.value);
         ElMessage.success("文件上传成功");
         uploadShow.value = false; // 隐藏上传区域,显示数据表
@@ -74,6 +93,7 @@ const postImportAssessmentTemplateApi = async data => {
   }
   try {
     const formData = new FormData();
+    console.log(fileDocument.value, "获取的数据");
     formData.append("file", fileDocument.value); // 将文件添加到表单数据
 
     // 调用 API 上传文件
@@ -118,12 +138,13 @@ const backDefine = () => {
       <div class="w-full bg p-3">
         <h5>1.下载导入模板</h5>
         <p class="text-xs mt-2 text">根据提升信息完善表格内容</p>
-        <el-button
-          class="mt-2"
-          @click="
-            assessmentDownloadDataRosterTemplateApi(route.query.assessmentType)
-          "
-          ><el-icon><Download /></el-icon>下载空的模板表格</el-button
+        <el-button class="mt-2"
+          ><el-icon> <Download /> </el-icon
+          ><a
+            href="http://116.148.231.9:9999/download/考核数据导入模板-人员.xlsx"
+            download="考核数据导入模板-人员.xlsx"
+            >下载空的模板表格</a
+          ></el-button
         >
       </div>
       <div class="w-full mt-4 bg p-3">

+ 22 - 7
src/views/evaluate/children/change/components/settingIndexDrawer.vue

@@ -219,6 +219,7 @@ const handleClose = (done: () => void) => {
   // });
 };
 function cancelClick() {
+  drawer.value = false;
   disabledValue.value = true;
   editShow.value = true;
 }
@@ -743,7 +744,9 @@ const manyConditions = () => {
                             style="width: 80px"
                           />
                           <el-text type="danger" @click="deleteItem(index)">
-                            <el-icon><Delete /></el-icon>
+                            <el-icon>
+                              <Delete />
+                            </el-icon>
                           </el-text>
                         </div>
                         <div
@@ -761,7 +764,9 @@ const manyConditions = () => {
                               type="danger"
                               @click="dataleListItemAll(item, index)"
                             >
-                              <el-icon><Delete /></el-icon>
+                              <el-icon>
+                                <Delete />
+                              </el-icon>
                             </el-text>
                           </div>
                           <div
@@ -815,7 +820,9 @@ const manyConditions = () => {
                                 type="danger"
                                 @click="dataleListItem(index, indexList)"
                               >
-                                <el-icon><Delete /></el-icon>
+                                <el-icon>
+                                  <Delete />
+                                </el-icon>
                               </el-text>
                             </div>
                             <div
@@ -833,7 +840,9 @@ const manyConditions = () => {
                                   )
                                 "
                               >
-                                <el-icon><Plus /></el-icon>
+                                <el-icon>
+                                  <Plus />
+                                </el-icon>
                                 添加子条件
                               </el-text>
                             </div>
@@ -848,7 +857,9 @@ const manyConditions = () => {
                           type="primary"
                           @click="addItemFormulaList(item, index)"
                         >
-                          <el-icon><Plus /></el-icon>
+                          <el-icon>
+                            <Plus />
+                          </el-icon>
                           添加子条件
                         </el-text>
                       </div>
@@ -864,7 +875,9 @@ const manyConditions = () => {
                           type="primary"
                           @click="addNewItemOldValue(item)"
                         >
-                          <el-icon><Plus /></el-icon>
+                          <el-icon>
+                            <Plus />
+                          </el-icon>
                           添加条件
                         </el-text>
                       </div>
@@ -874,7 +887,9 @@ const manyConditions = () => {
                       class="mt-5 text-xs cursor-pointer"
                     >
                       <el-text type="primary" @click="addNewItem">
-                        <el-icon><Plus /></el-icon>
+                        <el-icon>
+                          <Plus />
+                        </el-icon>
                         添加条件
                       </el-text>
                     </div>

+ 11 - 7
src/views/indexDefine/children/import/index.vue

@@ -26,10 +26,9 @@ const uploadFile = async () => {
   try {
     const formData = new FormData();
     formData.append("file", fileDocument.value); // 将文件添加到表单数据
-
+    console.log("文件上传", fileDocument.value, formData);
     // 调用 API 上传文件
     const { data } = await postUpdateDeptApi(formData);
-    console.log("dsada", data);
     if (data.code === 200) {
       // 根据后端返回的 code 判断是否成功
       ElMessage.success("文件上传并导入成功");
@@ -80,8 +79,7 @@ const handleUploadChange = (file: File) => {
       const firstSheetName = workbook.SheetNames[0]; // 获取第一个工作表名
       const worksheet = workbook.Sheets[firstSheetName]; // 获取第一个工作表
       const jsonData = XLSX.utils.sheet_to_json(worksheet, { header: 1 }); // 将工作表转为 JSON
-
-      if (jsonData[0].length == 6) {
+      if (jsonData[1].length == 6) {
         tableHeaders.value = [
           "指标名称",
           "指标定义",
@@ -91,7 +89,7 @@ const handleUploadChange = (file: File) => {
           "状态"
         ]; // 表头
 
-        const arr = jsonData.slice(1).map(row => {
+        const arr = jsonData.slice(3).map(row => {
           if (row[0] && row[1] && row[2] && row[3]) {
             const rowData = {};
             tableHeaders.value.forEach((header, index) => {
@@ -128,8 +126,14 @@ const handleUploadChange = (file: File) => {
         <!-- <el-button class="float-right" @click="backDefine">返回</el-button> -->
         <h5>1.下载导入模板</h5>
         <p class="text-xs mt-2 text">根据提升信息完善表格内容</p>
-        <el-button class="mt-2" @click="GetdownloadDataRosterTemplateApi">
-          <el-icon> <Download /> </el-icon>下载空的模板表格
+
+        <el-button class="mt-2">
+          <el-icon> <Download /> </el-icon
+          ><a
+            href="http://116.148.231.9:9999/download/指标导入模板.xlsx"
+            download="指标导入模板.xlsx"
+            >下载空的模板表格</a
+          >
         </el-button>
       </div>
       <div class="w-full mt-4 bg p-3">