Procházet zdrojové kódy

fix: 拉取后续代码迁移至新分支 用户批量导入

kuanghua liu před 1 rokem
rodič
revize
82d9923a68
2 změnil soubory, kde provedl 197 přidání a 32 odebrání
  1. 39 0
      .env.development
  2. 158 32
      src/views/system/user/component/AddUser.vue

+ 39 - 0
.env.development

@@ -5,3 +5,42 @@ VITE_PORT = 8092
 # 是否开启mock
 VITE_USE_MOCK = false
 
+# 是否删除console
+VITE_DROP_CONSOLE = true
+
+# 跨域代理,可以配置多个,请注意不要换行
+#VITE_PROXY = [["/appApi","http://localhost:8001"],["/upload","http://localhost:8001/upload"]]
+# VITE_PROXY=[["/temp","http://172.16.23.144:8800"],["/upload","http://172.16.23.144:8086"]]
+# VITE_PROXY=[["/skyeye-admin-api","http://172.16.23.144:8800/api"]]
+#VITE_PROXY=[["/skyeye-admin-api","http://58.144.197.158:19980/skyeye-admin-api"],["/eye_api","http://58.144.197.158:19980/eye_api"],["/push_stream_host","http://58.144.197.158:19980/push_stream_host"],["/skyeye-login","http://58.144.197.158:19980/skyeye-login"]]
+# VITE_PROXY=[["/skyeye-admin-api","http://36.133.176.76:19980/skyeye-admin-api"],["/eye_api","http://36.133.176.76:19980/eye_api"],["/push_stream_host","http://36.133.176.76:19980/push_stream_host"],["/skyeye-login","http://36.133.176.76:19980/skyeye-login"]]
+#VITE_PROXY=[["/skyeye-admin-api","http://172.16.23.144/skyeye-admin-api"],[],["/eye_api_bak","http://172.16.23.144/eye_api"],["/push_stream_host","http://172.16.23.144/push_stream_host"],["/skyeye-login","http://172.16.23.144/skyeye-login"],["/ws_api_bak","ws://172.16.23.144/ws_api_bak"]]
+# VITE_PROXY=[["/skyeye-admin-api","http://192.168.32.47/skyeye-admin-api"],["/eye_api","http://192.168.32.47/eye_api"],["/push_stream_host","http:/192.168.32.47/push_stream_host"],["/skyeye-login","http://192.168.32.47/skyeye-login"]]
+# VITE_PROXY=[["/skyeye-admin-api","http://192.168.14.68/skyeye-admin-api"],[],["/eye_api_bak","http://192.168.14.68/eye_api"],["/push_stream_host","http://192.168.14.68/push_stream_host"],["/skyeye-login","http://192.168.14.68/skyeye-login"],["/ws_api_bak","ws://192.168.14.68/ws_api_bak"]]
+# VITE_PROXY=[["/skyeye-admin-api","http://192.168.13.68/skyeye-admin-api"],[],["/eye_api_bak","http://192.168.13.68/eye_api"],["/push_stream_host","http://192.168.13.68/push_stream_host"],["/skyeye-login","http://192.168.13.68/skyeye-login"],["/ws_api_bak","ws://192.168.13.68/ws_api_bak"]]
+# 中建材 staff
+VITE_PROXY=[["/skyeye-admin-api","http://192.168.13.68:70/skyeye-admin-api"],["/eye_api_bak","http://192.168.13.68:70/eye_api"],["/push_stream_host","http://192.168.13.68:70/push_stream_host"],["/skyeye-login","http://192.168.13.68:70/skyeye-login"],["/ws_api_bak","ws://192.168.13.68:70/ws_api_bak"]]
+# VITE_PROXY=[["/skyeye-admin-api","http://192.168.13.68/skyeye-admin-api"],[],["/eye_api_bak","http://192.168.13.68/eye_api"],["/push_stream_host","http://192.168.13.68/push_stream_host"],["/skyeye-login","http://192.168.13.68/skyeye-login"],["/ws_api_bak","ws://192.168.13.68/ws_api_bak"],["/skyeye-file-upload","http://192.168.13.68/skyeye-file-upload"]]
+# VITE_PROXY=[["/skyeye-admin-api","http://192.168.22.163:8800/api"],[],["/eye_api_bak","http://192.168.22.163:8800/api"],["/push_stream_host","http://192.168.13.68/push_stream_host"],["/skyeye-login","http://192.168.13.68/skyeye-login"],["/ws_api_bak","ws://192.168.13.68/ws_api_bak"]]
+#VITE_PROXY=[["/skyeye-admin-api","http://192.168.22.121:8800/api"],["/eye_api_bak","http://192.168.22.121:8800/api"],["/push_stream_host","http://192.168.13.68/push_stream_host"],["/skyeye-login","http://192.168.13.68/skyeye-login"],["/ws_api_bak","ws://192.168.13.68/ws_api_bak"],["/skyeye-file-upload","http://192.168.13.68/skyeye-file-upload"]]
+# VITE_PROXY=[["/skyeye-admin-api","http://192.168.22.163:8800/api"],[],["/eye_api_bak","http://192.168.22.163:8800/api"],["/push_stream_host","http://192.168.13.68/push_stream_host"],["/skyeye-login","http://192.168.13.68/skyeye-login"],["/ws_api_bak","ws://192.168.13.68/ws_api_bak"],["/skyeye-file-upload","http://192.168.13.68/skyeye-file-upload"]]
+# VITE_PROXY=[["/skyeye-admin-api","http://192.168.13.68:70/skyeye-admin-api"],["/eye_api_bak","http://192.168.13.68:70/eye_api"],["/push_stream_host","http://192.168.13.68:70/push_stream_host"],["/skyeye-login","http://192.168.13.68:70/skyeye-login"],["/ws_api_bak","ws://192.168.13.68:70/ws_api_bak"]]
+# 本地调试
+# VITE_PROXY=[["/skyeye-admin-api","http://192.168.22.121:8800/api"],["/eye_api_bak","http://192.168.22.121:8800/api"],["/push_stream_host","http://192.168.22.121:8800/"],["/skyeye-login","192.168.13.68/skyeye-login"],["/ws_api_bak","ws://192.168.22.121:8800/ws_api_bak"],["/skyeye-file-upload","http://192.168.13.68/skyeye-file-upload"]]
+
+
+# API 接口地址
+VITE_GLOB_API_URL = 
+# 图片上传地址
+VITE_GLOB_UPLOAD_URL=  
+
+VITE_GLOB_APP_DOWNLOAD_QRCODE = //172.16.23.144/apk/skyeye.apk
+
+
+# 图片前缀地址
+#VITE_GLOB_IMG_URL = //36.133.176.76:19980/skyeye_static/
+VITE_GLOB_IMG_URL = //172.16.23.144/skyeye_static/
+
+
+# 接口前缀
+VITE_GLOB_API_URL_PREFIX = /skyeye-admin-api

+ 158 - 32
src/views/system/user/component/AddUser.vue

@@ -31,14 +31,18 @@
             ></div
           >
         </el-upload>
-        <div style="margin-top: 52px; margin-left: 288px; display: flex">
+        <div style="margin-top: 52px; display: flex">
+          <el-button @click="handleDownloadInfoForm" style="margin-right: 10px; margin-left: auto"
+            >组织/用户id信息</el-button
+          >
           <el-button @click="handleDownload" style="margin-right: 10px">下载模板</el-button>
           <el-button type="primary" @click="handleImport">导入</el-button></div
         ></div
       >
     </el-card>
+    <!-- 新的需求里面将上传成功和上传失败窗口合并了 -->
     <!-- //上传成功 -->
-    <el-dialog
+    <!-- <el-dialog
       v-model="DialogVisibleSuc"
       title="Warning"
       width="30%"
@@ -63,10 +67,10 @@
           <el-button type="primary" @click="handleRightComfirm"> 确定 </el-button>
         </span>
       </template>
-    </el-dialog>
+    </el-dialog> -->
 
     <!-- 上传失败 -->
-    <el-dialog
+    <!-- <el-dialog
       v-model="DialogVisibleErr"
       title="Warning"
       width="30%"
@@ -97,13 +101,52 @@
           <el-button type="primary" @click="handleErrComfirm"> 确定 </el-button>
         </span>
       </template>
-    </el-dialog></div
-  >
+    </el-dialog> -->
+
+    <el-dialog
+      v-model="DialogVisible"
+      title="Warning"
+      width="50%"
+      align-center
+      @close="
+        () => {
+          emits('update:modelValue', false);
+        }
+      "
+    >
+      <template #header>
+        <el-icon :size="24" color="#f2b20a" style="margin: 0 5px 2px">
+          <WarnTriangleFilled />
+        </el-icon>
+        <div class="header-text">添加提示</div>
+      </template>
+      <!-- <div class="sum-count">
+        成功上传 <span class="succ-sum">{{ sucCount }}</span> 条,
+        失败 <span class="err-sum">{{ errCount }}</span> 条
+      </div> -->
+      <div class="sum-count">
+        成功上传 <span class="succ-sum">{{ successCount }}</span> 条, 失败
+        <span class="err-sum">{{ errorCount }}</span> 条
+      </div>
+      <div class="err-info">
+        <!-- <div v-if="errCount === 0">未检测到相机数据</div> -->
+        <div>
+          <ul v-for="(item, index) in errDetail" :key="index">
+            <li v-html="item"></li>
+          </ul>
+        </div>
+      </div>
+      <template #footer>
+        <el-button type="primary" @click="handleErrComfirm"> 确定 </el-button>
+      </template>
+    </el-dialog>
+  </div>
 </template>
 
 <script setup lang="ts">
-  import { Close, Document, CircleCheck, Warning } from '@element-plus/icons-vue';
-  import { computed, ref } from 'vue';
+  // import { Close, Document, CircleCheck, Warning } from '@element-plus/icons-vue';
+  import { Close, Document } from '@element-plus/icons-vue';
+  import { ref } from 'vue';
   import { genFileId, ElMessage } from 'element-plus';
   import type { UploadInstance, UploadProps, UploadRawFile } from 'element-plus';
   import { useUserStore } from '@/store/modules/user';
@@ -130,16 +173,20 @@
   const cardVisible = ref<boolean>(true);
 
   //对话框
-  const DialogVisibleSuc = ref<boolean>(false);
-  const DialogVisibleErr = ref<boolean>(false);
+  // const DialogVisibleSuc = ref<boolean>(false);
+  // const DialogVisibleErr = ref<boolean>(false);
+  const DialogVisible = ref<boolean>(false);
 
   //更多
-  const showMore = ref(false);
+  // const showMore = ref(false);
 
   const isSuc = ref<boolean>(true);
+  // const errDetail = ref<string[]>([]);
   const errDetail = ref<string[]>([]);
-  const sucCount = ref<number>(0);
-  const { urlPrefix } = useGlobSetting();
+  // const sucCount = ref<number>(0);
+  const successCount = ref<number>(0);
+  // const sucCount = ref<number>(0);
+  const errorCount = ref<number>(0);
 
   const props = defineProps<{ modelValue: boolean }>();
   const emits = defineEmits(['update:modelValue', 'change']);
@@ -149,9 +196,7 @@
   };
   const upload = ref<UploadInstance>();
 
-  const importUrl = computed(() => {
-    return urlJoin(urlPrefix, `/user/import`);
-  });
+  const { urlPrefix } = useGlobSetting();
 
   const handleDownload = async () => {
     //调用后端接口
@@ -178,6 +223,31 @@
     }
   };
 
+  const handleDownloadInfoForm = async () => {
+    //调用后端接口
+    try {
+      const config: AxiosRequestConfig = {
+        headers,
+        responseType: 'blob',
+      };
+      const response = await axios.get(urlPrefix + '/user/downloadInfoForm', config);
+      const blob = new Blob([response.data], {
+        type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
+      });
+      // 创建下载链接
+      let downloadLink: HTMLAnchorElement | null = document.createElement('a');
+      const url = window.URL.createObjectURL(blob);
+      downloadLink.href = url;
+      downloadLink.download = '组织/用户id信息模板.xlsm';
+      downloadLink.click();
+      // 移除下载链接
+      window.URL.revokeObjectURL(url);
+      downloadLink = null;
+    } catch (error) {
+      console.error('Error downloading file:', error);
+    }
+  };
+
   const handleImport = async () => {
     upload.value!.submit();
   };
@@ -197,26 +267,30 @@
 
   const handleUploadSuccess = (response, _file, _fileList) => {
     isSuc.value = response.data.isSuc;
-    errDetail.value = response.data.failedInfo;
-    sucCount.value = response.data.sucCount || 0;
-
-    if (isSuc.value) {
-      DialogVisibleSuc.value = true;
-      DialogVisibleErr.value = false;
-    } else {
-      DialogVisibleSuc.value = false;
-      DialogVisibleErr.value = true;
-    }
+    errDetail.value = response.data.errorList;
+    successCount.value = response.data.successCount || 0;
+    errorCount.value = response.data.errorCount || 0;
+
+    DialogVisible.value = true;
+
+    // if (isSuc.value) {
+    //   DialogVisibleSuc.value = true;
+    //   DialogVisibleErr.value = false;
+    // } else {
+    //   DialogVisibleSuc.value = false;
+    //   DialogVisibleErr.value = true;
+    // }
     cardVisible.value = false;
   };
 
-  const handleRightComfirm = () => {
-    DialogVisibleSuc.value = false;
-    emits('update:modelValue', false);
-    emits('change');
-  };
+  // const handleRightComfirm = () => {
+  //   DialogVisibleSuc.value = false;
+  //   emits('update:modelValue', false);
+  //   emits('change');
+  // };
   const handleErrComfirm = () => {
-    DialogVisibleErr.value = false;
+    // DialogVisibleErr.value = false;
+    DialogVisible.value = false;
     emits('update:modelValue', false);
     emits('change');
   };
@@ -258,4 +332,56 @@
     font-size: 14px;
     margin-bottom: 2px;
   }
+
+  :deep(.el-dialog) {
+    padding: 0px;
+    border-radius: 5px;
+
+    .el-dialog__header {
+      display: flex;
+      align-items: flex-end;
+      height: 70px;
+      padding: 0px 0px 10px 10px;
+      border-bottom: 1px solid #e7e7e7;
+
+      .header-text {
+        font-size: 20px;
+      }
+    }
+
+    .el-dialog__headerbtn {
+      top: 22px;
+
+      .el-dialog__close {
+        color: black;
+      }
+    }
+
+    .el-dialog__body {
+      padding: 20px;
+
+      .sum-count {
+        margin: 10px 0 20px 20px;
+        font-size: 20px;
+
+        .succ-sum {
+          color: #52c41a;
+        }
+
+        .err-sum {
+          color: #ff4d4f;
+        }
+      }
+
+      .err-info {
+        height: 200px;
+        margin-left: 20px;
+        overflow: auto;
+      }
+    }
+
+    .el-dialog__footer {
+      margin: 0 20px 20px 0;
+    }
+  }
 </style>