username před 3 týdny
rodič
revize
19f7680e29

+ 10 - 0
src/api/download.ts

@@ -81,3 +81,13 @@ export const postImportAssessmentTemplate = async data => {
     }
   });
 };
+// 上传文件获取回显的数据
+export const getListTable = async data => {
+  const token = localStorage.getItem("token") || "";
+  return axios.post(`${FLIE_URL}/quota/importQuotaDisplayBackData`, data, {
+    headers: {
+      "Content-Type": "multipart/form-data", // 指定内容类型
+      satoken: token // 将 Token 添加到请求头
+    }
+  });
+};

+ 7 - 3
src/views/evaluate/children/change/manage.vue

@@ -151,7 +151,7 @@ const saveCopy = async () => {
             </template>
           </el-table-column>
           <el-table-column prop="createUser" label="创建人" />
-          <el-table-column prop="updateTime" label="更新时间">
+          <el-table-column prop="updateTime" label="更新时间" sortable>
             <template #default="{ row }">
               <div v-if="row.updateTime">
                 {{ dayjs(row.updateTime).format("YYYY-MM-DD HH:mm:ss") }}
@@ -164,13 +164,17 @@ const saveCopy = async () => {
               <Auth :value="['编辑']">
                 <el-dropdown trigger="click">
                   <span class="el-dropdown-link navbar-bg-hover select-none">
-                    <el-icon @click="setEdit(row)"><Edit /></el-icon>
+                    <el-icon @click="setEdit(row)">
+                      <Edit />
+                    </el-icon>
                   </span>
                 </el-dropdown>
               </Auth>
               <el-dropdown class="ml-2" trigger="click">
                 <span class="el-dropdown-link navbar-bg-hover select-none">
-                  <el-icon><More /></el-icon>
+                  <el-icon>
+                    <More />
+                  </el-icon>
                 </span>
                 <template #dropdown>
                   <el-dropdown-menu class="setting">

+ 24 - 8
src/views/evaluate/children/change/mould.vue

@@ -53,7 +53,7 @@ const setCopy = (row: any) => {
 const data = reactive({
   params: {
     pageNumber: 1,
-    pageSize: 5,
+    pageSize: 10,
     // records: {
     tpName: ""
     // }
@@ -66,9 +66,7 @@ const data = reactive({
 const tableLoading = ref(false);
 const getTemplateInfoListApi = async () => {
   tableLoading.value = true;
-  console.log("打印数据", data.params);
   const res = await getTemplateInfoList(data.params);
-  console.log("1111", res);
   if (res.code == 200) {
     tableLoading.value = false;
     data.records = res.data.records;
@@ -84,6 +82,14 @@ const handleCurrentChange = (val: number) => {
   data.params.pageNumber = val;
   getTemplateInfoListApi();
 };
+// 更新时间返回值
+const formattedTime = time => {
+  if (time) {
+    return dayjs(time).format("YYYY-MM-DD HH:mm:ss");
+  } else {
+    return "无效日期";
+  }
+};
 </script>
 
 <template>
@@ -121,12 +127,18 @@ const handleCurrentChange = (val: number) => {
         v-loading="tableLoading"
         :data="data.records"
         style="width: 100%"
+        max-height="250"
       >
         <el-table-column prop="tpName" label="考核模板" />
-        <el-table-column prop="createTime" label="更新时间" width="160">
+        <el-table-column
+          prop="updateTime"
+          label="更新时间"
+          width="160"
+          sortable
+        >
           <template #default="{ row }">
-            <div v-if="row.createTime">
-              {{ dayjs(row.createTime).format("YYYY-MM-DD HH:mm:ss") }}
+            <div v-if="row.updateTime">
+              {{ formattedTime(row.updateTime) }}
             </div>
           </template>
         </el-table-column>
@@ -137,13 +149,17 @@ const handleCurrentChange = (val: number) => {
             <Auth :value="['复制']">
               <el-dropdown trigger="click">
                 <span class="el-dropdown-link navbar-bg-hover select-none">
-                  <el-icon @click="setEdit(row)"><Edit /></el-icon>
+                  <el-icon @click="setEdit(row)">
+                    <Edit />
+                  </el-icon>
                 </span>
               </el-dropdown>
             </Auth>
             <el-dropdown class="ml-2" trigger="click">
               <span class="el-dropdown-link navbar-bg-hover select-none">
-                <el-icon><More /></el-icon>
+                <el-icon>
+                  <More />
+                </el-icon>
               </span>
               <template #dropdown>
                 <el-dropdown-menu class="setting">

+ 13 - 4
src/views/evaluate/children/change/mould/manageObject.vue

@@ -249,7 +249,9 @@ const handleCurrentIndexChange = (val: number) => {
       <div class="flex items-center justify-between mt-2">
         <div class="bg-icon">
           <div>
-            <el-icon><Tickets /></el-icon>
+            <el-icon>
+              <Tickets />
+            </el-icon>
           </div>
         </div>
         <div>
@@ -331,7 +333,7 @@ const handleCurrentIndexChange = (val: number) => {
             label="考核模板"
             width="300"
           />
-          <el-table-column prop="name" label="更新时间" width="150">
+          <el-table-column prop="name" label="更新时间" width="150" sortable>
             <template #default="{ row }">
               {{ dayjs(row.updateTime).format("YYYY-MM-DD HH:mm:ss") }}
             </template>
@@ -339,7 +341,9 @@ const handleCurrentIndexChange = (val: number) => {
           <el-table-column label="操作" width="200" fixed="right">
             <template #default="{ row }">
               <!-- <el-button link :icon="Edit" /> -->
-              <el-icon @click="GoView(row)"><View /></el-icon>
+              <el-icon @click="GoView(row)">
+                <View />
+              </el-icon>
             </template>
           </el-table-column>
         </el-table>
@@ -402,7 +406,12 @@ const handleCurrentIndexChange = (val: number) => {
           <el-table-column prop="targetValue" label="目标值" width="180" />
           <el-table-column prop="finalValue" label="完成值" width="180" />
           <el-table-column prop="score" label="得分" width="180" />
-          <el-table-column prop="updateTime" label="更新时间" width="150">
+          <el-table-column
+            prop="updateTime"
+            label="更新时间"
+            width="150"
+            sortable
+          >
             <template #default="{ row }">
               {{ dayjs(row.updateTime).format("YYYY-MM-DD HH:mm:ss") }}
             </template>

+ 7 - 3
src/views/evaluate/children/exam/index.vue

@@ -52,19 +52,23 @@ const newAdd = () => {
     <div class="mt-8">
       <el-table :data="tableData" style="width: 100%">
         <el-table-column prop="address" label="考核模板" />
-        <el-table-column prop="date" label="更新时间" width="150" />
+        <el-table-column prop="date" label="更新时间" width="150" sortable />
         <el-table-column prop="name" label="创建人" width="150" />
         <el-table-column label="操作" width="200">
           <template #default="{ row }">
             <!-- <el-button link :icon="Edit" /> -->
             <el-dropdown trigger="click">
               <span class="el-dropdown-link navbar-bg-hover select-none">
-                <el-icon @click="setEdit(row)"><Edit /></el-icon>
+                <el-icon @click="setEdit(row)">
+                  <Edit />
+                </el-icon>
               </span>
             </el-dropdown>
             <el-dropdown class="ml-2" trigger="click">
               <span class="el-dropdown-link navbar-bg-hover select-none">
-                <el-icon><More /></el-icon>
+                <el-icon>
+                  <More />
+                </el-icon>
               </span>
               <template #dropdown>
                 <el-dropdown-menu class="setting">

+ 65 - 60
src/views/indexDefine/children/import/index.vue

@@ -6,7 +6,8 @@ import { ref } from "vue";
 import * as XLSX from "xlsx";
 import {
   GetdownloadDataRosterTemplateApi,
-  postUpdateDeptApi
+  postUpdateDeptApi,
+  getListTable
 } from "@/api/download";
 import { ElMessage } from "element-plus";
 import { useRouter } from "vue-router";
@@ -26,7 +27,6 @@ const uploadFile = async () => {
   try {
     const formData = new FormData();
     formData.append("file", fileDocument.value); // 将文件添加到表单数据
-    console.log("文件上传", fileDocument.value, formData);
     // 调用 API 上传文件
     const { data } = await postUpdateDeptApi(formData);
     if (data.code === 200) {
@@ -37,13 +37,6 @@ const uploadFile = async () => {
       backDefine();
       $router.push("/indexDefine/children/define");
       tableHeaders.value = []; // 清空表头
-      tableData.value = [
-        { name: "" },
-        { defin: "" },
-        { caliber: "" },
-        { type: "" },
-        { from: "" }
-      ]; // 清空表格数据
     } else {
       ElMessage.error(data.msg);
     }
@@ -54,69 +47,77 @@ const uploadFile = async () => {
 };
 
 const tableHeaders = ref<any>([]);
-const tableData = ref<any>([
-  { name: "" },
-  { defin: "" },
-  { caliber: "" },
-  { type: "" },
-  { from: "" }
-]);
+const tableData = ref<any>([]);
 
 const backDefine = () => {
   emit("handleImport");
 };
 
 // 处理文件上传并解析 Excel 内容
-const handleUploadChange = (file: File) => {
+const handleUploadChange = async (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);
-      const workbook = XLSX.read(data, { type: "array" }); // 读取 Excel 文件
-      const firstSheetName = workbook.SheetNames[0]; // 获取第一个工作表名
-      const worksheet = workbook.Sheets[firstSheetName]; // 获取第一个工作表
-      const jsonData = XLSX.utils.sheet_to_json(worksheet, { header: 1 }); // 将工作表转为 JSON
-      if (jsonData[1].length == 6) {
-        tableHeaders.value = [
-          "指标名称",
-          "指标定义",
-          "指标口径",
-          "指标分类",
-          "来源",
-          "状态"
-        ]; // 表头
+    const formData = new FormData();
+    formData.append("file", fileDocument.value); // 将文件添加到表单数据
+    // 调用 API 上传文件
+    const { data } = await getListTable(formData);
+    if (data.code === 200) {
+      tableData.value = data.data;
+    }
+    // reader.onload = e => {
+    //   const data = new Uint8Array(e.target?.result as ArrayBuffer);
+    //   const workbook = XLSX.read(data, { type: "array" }); // 读取 Excel 文件
+    //   const firstSheetName = workbook.SheetNames[0]; // 获取第一个工作表名
+    //   const worksheet = workbook.Sheets[firstSheetName]; // 获取第一个工作表
+    //   const jsonData = XLSX.utils.sheet_to_json(worksheet, { header: 1 }); // 将工作表转为 JSON
+    //   if (jsonData[1].length == 6) {
+    //     tableHeaders.value = [
+    //       "指标名称",
+    //       "指标定义",
+    //       "指标口径",
+    //       "指标分类",
+    //       "来源",
+    //       "状态"
+    //     ]; // 表头
+
+    //     const arr = jsonData.slice(3).map(row => {
+    //       if (row[0] && row[1] && row[2] && row[3]) {
+    //         const rowData = {};
+    //         tableHeaders.value.forEach((header, index) => {
+    //           if (row[index] && row[index].trim().length > 0) {
+    //             rowData[header] = row[index];
+    //           } else if (header == "来源") {
+    //             rowData[header] = "-";
+    //           } else if (header == "状态") {
+    //             rowData[header] = "草稿";
+    //           }
+    //         });
+    //         return rowData;
+    //       }
+    //     });
+    //     tableData.value = arr.filter(item => item);
+    //     console.log("111", tableData.value)
 
-        const arr = jsonData.slice(3).map(row => {
-          if (row[0] && row[1] && row[2] && row[3]) {
-            const rowData = {};
-            tableHeaders.value.forEach((header, index) => {
-              if (row[index] && row[index].trim().length > 0) {
-                rowData[header] = row[index];
-              } else if (header == "来源") {
-                rowData[header] = "-";
-              } else if (header == "状态") {
-                rowData[header] = "草稿";
-              }
-            });
-            return rowData;
-          }
-        });
-        tableData.value = arr.filter(item => item);
-        ElMessage.success("文件上传成功");
-        uploadShow.value = false; // 隐藏上传区域,显示数据表
-      } else {
-        ElMessage.error("文件为空或格式不正确");
-      }
-    };
+    //     ElMessage.success("文件上传成功");
+    uploadShow.value = false; // 隐藏上传区域,显示数据表
+    //   } else {
+    //     ElMessage.error("文件为空或格式不正确");
+    //   }
+    // };
   } else {
     ElMessage.error("请上传xlsx文件");
   }
 
   reader.readAsArrayBuffer(file); // 读取文件为 ArrayBuffer
 };
+
+const stateDone = state => {
+  const arr = ["草稿", "发布", "下架"];
+  return arr[state];
+};
 </script>
 
 <template>
@@ -162,12 +163,16 @@ const handleUploadChange = (file: File) => {
             style="width: 100%"
             max-height="250"
           >
-            <el-table-column
-              v-for="header in tableHeaders"
-              :key="header"
-              :label="header"
-              :prop="header"
-            />
+            <el-table-column prop="name" label="指标名称" />
+            <el-table-column prop="define" label="指标定义" />
+            <el-table-column prop="caliber" label="指标口径" />
+            <el-table-column prop="categoryName" label="指标分类" />
+            <el-table-column prop="source" label="来源" />
+            <el-table-column prop="statue" label="状态">
+              <template #default="scope">
+                {{ stateDone(scope.row.statue) }}
+              </template>
+            </el-table-column>
           </el-table>
         </div>
         <div class="float-right">