Procházet zdrojové kódy

限制导入交验单limit:1

zhaoyaxiong před 1 rokem
rodič
revize
631ec02408

+ 16 - 3
ZRAdmin-vue-main/.vscode/settings.json

@@ -48,15 +48,28 @@
     }
   },
   "i18n-ally.displayLanguage": "zh-cn",
-  "i18n-ally.enabledParsers": ["json", "js"],
+  "i18n-ally.enabledParsers": [
+    "json",
+    "js"
+  ],
   "i18n-ally.localesPaths": [
     "src/i18n/lang",
     "src/i18n/pages/login",
     "src/i18n/pages/menu",
   ],
   "i18n-ally.extract.parsers.html": {
-    "attributes": ["text", "title", "alt", "placeholder", "label", "aria-label"],
-    "ignoredTags": ["script", "style"],
+    "attributes": [
+      "text",
+      "title",
+      "alt",
+      "placeholder",
+      "label",
+      "aria-label"
+    ],
+    "ignoredTags": [
+      "script",
+      "style"
+    ],
     "vBind": true,
     "inlineText": true
   },

+ 12 - 5
ZRAdmin-vue-main/src/views/Business/SapDeliverRecord/index.vue

@@ -307,7 +307,7 @@
       <el-upload name="file" ref="uploadRef" :limit="1" accept=".xlsx,.xls" :headers="upload.headers"
         :action="upload.url + '?updateSupport=' + upload.updateSupport" :disabled="upload.isUploading"
         :on-progress="handleFileUploadProgress" :on-success="handleFileSuccess" :on-error="handleFileError"
-        :auto-upload="false" :data="uploadPara" drag>
+        :on-exceed="handleExceed" :auto-upload="false" :data="uploadPara" drag>
         <el-icon class="el-icon--upload">
           <upload-filled />
         </el-icon>
@@ -318,6 +318,8 @@
                   <el-checkbox v-model="upload.updateSupport" /> 是否更新已经存在的用户数据
                 </div> -->
             <span>仅允许导入xlsx和xls格式文件。</span>
+            <br /><br />
+            <span>限单次导入一个文件,再次选择将替换前一个文件。</span>
             <!-- <el-link type="primary" :underline="false" style="font-size: 12px; vertical-align: baseline"
               @click="importTemplate">下载模板</el-link> -->
           </div>
@@ -340,9 +342,7 @@
 <script setup name="sapdeliverrecord">
 import {
   listSapDeliverRecord, addSapDeliverRecord, delSapDeliverRecord, updateSapDeliverRecord, getSapDeliverRecord,
-
-}
-  from '@/api/business/sapdeliverrecord.js'
+} from '@/api/business/sapdeliverrecord.js'
 
 import { getToken } from "@/utils/auth";
 const { proxy } = getCurrentInstance()
@@ -458,6 +458,13 @@ const upload = reactive({
 const uploadPara = reactive({
   category: '外协件'
 })
+// 上传文件超限,替换文件
+const handleExceed = (files, uploadFiles) => {
+  // console.log(files)
+  // console.log(uploadFiles)
+  proxy.$refs['uploadRef'].clearFiles()
+  proxy.$refs['uploadRef'].handleStart(files[0])
+}
 // 导入按钮操作
 function handleImport() {
   upload.title = '交验单导入'
@@ -486,7 +493,7 @@ const handleFileSuccess = (response, file, fileList) => {
   })
   getList()
 }
-/** 文件上传失败处理 */
+/** 文件上传服务器错误处理 */
 const handleFileError = (Error, file, fileList) => {
   upload.isUploading = false
   proxy.$alert("<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>文件:【" + file.name + "】导入错误。<br/>请确认:<br/>交验单号<br/>采购订单<br/>生产令号<br/>行项目<br/>规格型号<br/>关键件标识<br/>交验单数量<br/>抽检数量<br/>以上内容在表格中正确无误。" + '</div>', '导入错误', {