Ver Fonte

fix: 导入指标

ystl_myq há 3 semanas atrás
pai
commit
24958a5cd4

+ 1 - 4
src/api/indexDefine.ts

@@ -54,8 +54,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">

+ 1 - 0
src/router/modules/password.ts

@@ -2,6 +2,7 @@
 import server from "@/assets/icon-png/menuList/server.svg";
 export default {
   path: "/password",
+  redirect: "/password/change",
   meta: {
     title: "账号与密码",
     // 是否在主菜单显示父级路由 仅支持mixNav

+ 1 - 0
src/routerList/password.ts

@@ -2,6 +2,7 @@
 import server from "@/assets/icon-png/menuList/server.svg";
 export default {
   path: "/password",
+  redirect: "/password/change",
   meta: {
     title: "账号与密码",
     // 是否在主菜单显示父级路由 仅支持mixNav

+ 7 - 1
src/utils/http/index.ts

@@ -13,6 +13,7 @@ import { stringify } from "qs";
 import NProgress from "../progress";
 import { getToken, formatToken } from "@/utils/auth";
 import { useUserStoreHook } from "@/store/modules/user";
+import { message } from "@/utils/message";
 // 相关配置请参考:www.axios-js.com/zh-cn/docs/#axios-request-config-1
 const defaultConfig: AxiosRequestConfig = {
   // 请求超时时间
@@ -125,8 +126,12 @@ class PureHttp {
         const $config = response.config;
         // 关闭进度条动画
         NProgress.done();
-        // 优先判断post/get等方法是否传入回调,否则执行初始化设置等回调
+        // 统一返回接口报错信息
+        if (response.data.code && response.data.code !== 200) {
+          message(response.data.msg, { type: "error" });
+        }
         if (typeof $config.beforeResponseCallback === "function") {
+          // 优先判断post/get等方法是否传入回调,否则执行初始化设置等回调
           $config.beforeResponseCallback(response);
           return response.data;
         }
@@ -141,6 +146,7 @@ class PureHttp {
         $error.isCancelRequest = Axios.isCancel($error);
         // 关闭进度条动画
         NProgress.done();
+        message($error, { type: "error" });
         // 所有的响应异常 区分来源为取消请求/非取消请求
         return Promise.reject($error);
       }

+ 6 - 3
src/views/background/framework/proson/components/newDepartment.vue

@@ -20,12 +20,17 @@ const optiones = reactive({
 });
 // 添加
 const postAddDeptApi = async () => {
-  const { code } = await postAddDept(form);
+  const { code } = await postAddDept({
+    ...form,
+    parentCode: form.parentCode || 0
+  });
   if (code === 200) {
     ElMessage({
       message: "添加成功",
       type: "success"
     });
+    emit("handleClick");
+    handleClose();
   }
 };
 // 上级部门
@@ -65,8 +70,6 @@ const saveDepartment = () => {
   formRef.value.validate(valid => {
     if (valid) {
       postAddDeptApi();
-      emit("handleClick");
-      handleClose();
     }
   });
 };

+ 4 - 2
src/views/background/framework/proson/components/prosonEditDrawer.vue

@@ -1,5 +1,5 @@
 <script setup lang="ts">
-import { ref, reactive } from "vue";
+import { ref, reactive, defineEmits } from "vue";
 import { ElMessageBox, ElMessage } from "element-plus";
 import type { DrawerProps, FormItemProps, FormProps } from "element-plus";
 import { postUpdateDept, postListTree } from "@/api/department";
@@ -7,6 +7,7 @@ import { postUserList } from "@/api/userSetting";
 import { encryption } from "@/utils/encrypt";
 // const itemLabelPosition = ref<FormItemProps["labelPosition"]>("");
 const drawer = ref(false);
+const emit = defineEmits(["handleClick"]);
 const disabledValue = ref(true);
 const formRef = ref();
 const direction = ref<DrawerProps["direction"]>("rtl");
@@ -67,6 +68,7 @@ const postUpdateDeptApi = async () => {
       message: "保存成功",
       type: "success"
     });
+    emit("handleClick");
   }
 };
 function confirmClick() {
@@ -193,7 +195,7 @@ const timer = ref("");
         >
         <div v-else>
           <el-button @click="cancelClick">取消</el-button>
-          <el-button type="primary" @click="confirmClick">确认</el-button>
+          <el-button type="primary" @click="confirmClick">保存</el-button>
         </div>
       </template>
     </el-drawer>

+ 22 - 5
src/views/background/framework/proson/prosonDepartment.vue

@@ -3,7 +3,7 @@ defineOptions({
   // name 作为一种规范最好必须写上并且和路由的name保持一致
   name: "prosonDepartment"
 });
-import { ref, reactive, watch } from "vue";
+import { ref, reactive, watch, nextTick } from "vue";
 import { ElMessageBox, ElMessage } from "element-plus";
 import { Search } from "@element-plus/icons-vue";
 import prosonEditDrawer from "./components/prosonEditDrawer.vue";
@@ -14,6 +14,8 @@ import changeRole from "./components/changeRole.vue";
 import { postListTree, postDelDept } from "@/api/department";
 import { postOrganizationUserPage, getDeleteUserApi } from "@/api/userSetting";
 import UserPageTable from "@/components/UserPageTable/index.vue";
+import { Plus } from "@element-plus/icons-vue";
+
 // 添加部门
 const newDepartmentRef = ref(null);
 const newDepartmentShow = ref(false);
@@ -53,7 +55,13 @@ const postListTreeApi = async () => {
   const { code, data } = await postListTree();
   if (code == 200) {
     console.log(data);
+    if (data && data.length) {
+      data[0].id = 1;
+    }
     dataTree.value = data;
+    nextTick(() => {
+      handleNodeClick(dataTree.value[0]);
+    });
   }
 };
 postListTreeApi();
@@ -173,6 +181,7 @@ watch(realName, val => {
     <prosonEditDrawer
       ref="prosonEditDrawerRef"
       v-model="prosonEditDrawerShow"
+      @handleClick="postListTreeApi"
     />
     <!-- 添加部门 -->
     <newDepartment
@@ -216,7 +225,9 @@ watch(realName, val => {
             <span>{{ node.label }}</span>
             <el-dropdown trigger="click" @click.stop>
               <span>
-                <el-icon><Operation /></el-icon>
+                <el-icon>
+                  <Operation />
+                </el-icon>
               </span>
               <template #dropdown>
                 <el-dropdown-menu class="setting">
@@ -253,8 +264,9 @@ watch(realName, val => {
           class="w-full mt-4"
           type="primary"
           plain
+          :icon="Plus"
           @click="addDepartment"
-          >添加部门</el-button
+          >新增部门</el-button
         >
       </Auth>
     </div>
@@ -268,11 +280,15 @@ watch(realName, val => {
         <template #actions="{ row }">
           <Auth :value="['编辑成员']">
             <el-dropdown trigger="click" class="mr-2">
-              <el-icon @click="personDetails(row)"><View /></el-icon>
+              <el-icon @click="personDetails(row)">
+                <View />
+              </el-icon>
             </el-dropdown>
           </Auth>
           <el-dropdown trigger="click">
-            <el-icon><Operation /></el-icon>
+            <el-icon>
+              <Operation />
+            </el-icon>
             <template #dropdown>
               <el-dropdown-menu class="setting">
                 <Auth :value="['删除成员']">
@@ -309,6 +325,7 @@ watch(realName, val => {
   height: 100%;
   padding: 10px 20px;
 }
+
 // ::v-deep .el-dropdown {
 //   line-height: 1;
 // }

+ 1 - 1
src/views/background/framework/users/components/addUsers.vue

@@ -135,7 +135,7 @@ defineExpose({
         <el-form-item label="用户组编号">
           <el-input v-model="form.hospitalCode" placeholder="请输入" />
         </el-form-item>
-        <el-form-item label="用户组负责人">
+        <el-form-item v-if="dialogTitle !== '新建用户组'" label="用户组负责人">
           <el-select v-model="form.leaderCode" placeholder="请选择">
             <el-option
               v-for="(item, index) in rolesList.list"

+ 1 - 1
src/views/background/framework/users/components/editPerson.vue

@@ -117,7 +117,7 @@ const timer = ref("");
         </div>
       </template>
       <template #footer>
-        <el-button v-if="editShow" type="warning" @click="editClick"
+        <el-button v-if="editShow" type="primary" @click="editClick"
           >编辑</el-button
         >
         <div v-else>

+ 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">

+ 0 - 2
src/views/login/index.vue

@@ -44,8 +44,6 @@ const { title, toggleSideBar } = useNav();
 const ruleForm = reactive({
   username: "",
   password: ""
-  // username: "admin",
-  // password: "123456"
 });
 const handleBlur = () => {
   // @ts-ignore

+ 1 - 1
src/views/password/index.vue

@@ -118,7 +118,7 @@ const rules = {
         />
       </el-form-item>
       <el-form-item label="">
-        <el-button type="primary" @click="UpdatePasswordApi()">提交</el-button>
+        <el-button type="primary" @click="UpdatePasswordApi">提交</el-button>
       </el-form-item>
     </el-form>
   </div>