From a660db06773007b1be690e0674829c00a57aeb7b Mon Sep 17 00:00:00 2001
From: 廖井涛 <2265517004@qq.com>
Date: 星期三, 24 十二月 2025 16:21:23 +0800
Subject: [PATCH] 订单首页流程卡新增楼层编号显示

---
 north-glass-erp/northglass-erp/src/components/sd/order/UploadPicture.vue |  105 +++++++++++++++++++++++++++++++++++++++-------------
 1 files changed, 79 insertions(+), 26 deletions(-)

diff --git a/north-glass-erp/northglass-erp/src/components/sd/order/UploadPicture.vue b/north-glass-erp/northglass-erp/src/components/sd/order/UploadPicture.vue
index 6e039b2..74fe908 100644
--- a/north-glass-erp/northglass-erp/src/components/sd/order/UploadPicture.vue
+++ b/north-glass-erp/northglass-erp/src/components/sd/order/UploadPicture.vue
@@ -6,7 +6,9 @@
 } from '@element-plus/icons-vue'
 import { ElMessage, ElMessageBox } from 'element-plus'
 import request from "@/utils/requestByFile"
+import {useI18n} from "vue-i18n";
 
+const { t } = useI18n()
 const uploadRef = ref()
 const fileList = ref([])
 const converting = ref(false)
@@ -22,6 +24,8 @@
   orderId:null,
   state:null
 })
+let imgWidth = ref(null)
+let imgHeight = ref(null)
 
 const form = reactive({
   format: 'png'
@@ -38,6 +42,8 @@
     }
     result.value = res.data
     conversionResult.value = res.data.imageBase64
+    imgWidth.value = res.data.width
+    imgHeight.value = res.data.height
   })
 }
 
@@ -45,7 +51,7 @@
   request.post(`/orderFile/deleteOrderNumberFile/${props.orderId}/${props.rowIndex.orderNumber}`).then(res=>{
     result.value = null
     conversionResult.value = null
-    ElMessage.success("鍒犻櫎鎴愬姛")
+    ElMessage.success(t("basicData.msg.deleteSuccess"))
   })
 }
 
@@ -102,27 +108,45 @@
 const loadSupportedFormats = async () => {
   try {
     if (fileList.value.length === 0) {
-      ElMessage.warning('璇峰厛閫夋嫨瑕佷笂浼犵殑DWG鏂囦欢')
+      ElMessage.warning(t("order.msg.pleaseUploadPicture1"))
       return
     }
+    if(imgHeight.value ){
+      const regex = /^(0|[1-9]\d{0,2}|1000)$/
+      if(!regex.test(imgHeight.value)){
+        ElMessage.warning(`height:0~1000`)
+        return
+      }
+    }
+
+    if(imgWidth.value ){
+      const regex = /^(0|[1-9]\d{0,2}|1000)$/
+      if(!regex.test(imgWidth.value)){
+        ElMessage.warning(`width:0~1000`)
+        return
+      }
+    }
+
     loadingFormats.value = true
 
     converting.value = true
     progressPercentage.value = 0
     progressStatus.value = ''
-    progressText.value = '鍑嗗涓婁紶...'
+    progressText.value = t("order.msg.pleaseUploadPicture2")
 
     // 妯℃嫙杩涘害鏇存柊
     const progressInterval = setInterval(() => {
       if (progressPercentage.value < 80) {
         progressPercentage.value += 10
-        progressText.value = `涓婁紶涓�... ${progressPercentage.value}%`
+        progressText.value = t("order.msg.pleaseUploadPicture3")+progressPercentage.value+'%'
       }
     }, 500)
 
-
     const data ={
-      file:fileList.value[0].raw
+      file:fileList.value[0].raw,
+      name:fileList.value[0].raw.name,
+      width:imgWidth.value || 1000,
+      height:imgHeight.value || 700,
     }
     request.post(`/orderFile/updateOrderFileByOrderNumber/${props.orderId}/${props.rowIndex.orderNumber}`,data).then(res=>{
       if (res.code === '200') {
@@ -132,7 +156,7 @@
         clearInterval(progressInterval)
         progressPercentage.value = 100
         progressStatus.value = 'success'
-        progressText.value = '涓婁紶瀹屾垚!'
+        progressText.value = t("order.msg.pleaseUploadPicture4")
         uploadRef.value.clearFiles()
         fileList.value = []
         setTimeout(() => {
@@ -142,32 +166,43 @@
       }
     })
   } catch (error) {
-    ElMessage.error('涓婁紶澶辫触')
+    ElMessage.error(t("order.msg.pleaseUploadPicture5"))
   } finally {
     loadingFormats.value = false
   }
 }
 
+const fileTypeCheck = (file) => {
+  const fileName = file.raw.name.toLowerCase();
 
+  switch (true) {
+    case /\.dwg$/.test(fileName):
+    case /\.png$/.test(fileName):
+    case /\.jpg$/.test(fileName):
+      return true;
+    default:
+      return false;
+  }
+};
 
 
 
 const handleFileChange = (file) => {
-  console.log(file)
-  if (!(file.raw.name.toLowerCase().endsWith('.dwg') )) {
+  const fileTypeCheckBoole = fileTypeCheck(file)
+  if (!(fileTypeCheckBoole )) {
     //ElMessage.error('璇烽�夋嫨DWG鎴朌XF鏍煎紡鐨勬枃浠�')
-    ElMessage.error('璇烽�夋嫨DWG鏍煎紡鐨勬枃浠�')
+    ElMessage.error(t("order.msg.pleaseUploadPicture6"))
     uploadRef.value.clearFiles()
     return
   }
 
   if (file.raw.size > 50 * 1024 * 1024) {
-    ElMessage.error('鏂囦欢澶у皬涓嶈兘瓒呰繃50MB')
+    ElMessage.error(t("order.msg.pleaseUploadPicture7"))
     uploadRef.value.clearFiles()
     return
   }
   fileList.value = [file]
-  ElMessage.success(`宸查�夋嫨鏂囦欢: ${file.name}`)
+  ElMessage.success(t("order.msg.pleaseUploadPicture8")+file.name)
 }
 
 const handleFileRemove = () => {
@@ -206,7 +241,7 @@
         <div class="card-header">
           <span class="header-title">
             <el-icon><Document /></el-icon>
-            DWG鏂囦欢涓婁紶
+            {{$t("order.msg.pleaseUploadPicture9")}}
           </span>
 
         </div>
@@ -224,17 +259,34 @@
           :on-remove="handleFileRemove"
           :file-list="fileList"
           :limit="1"
-          :accept="'.dwg' || '.dxf' "
           :disabled="converting"
       >
         <el-icon class="el-icon--upload"><UploadFilled /></el-icon>
         <div class="el-upload__text">
-          鎷栨嫿DWG鏂囦欢鍒版澶勬垨 <em>鐐瑰嚮閫夋嫨鏂囦欢</em>
+          {{$t("order.msg.pleaseUploadPicture10")}} <em>{{$t("order.msg.pleaseUploadPicture11")}}</em>
         </div>
         <template #tip>
-          <div class="el-upload__tip">
-            浠呮敮鎸� .dwg 鏍煎紡鏂囦欢锛屼笖鏂囦欢澶у皬涓嶈秴杩�50MB
+          <div class="el-upload__tip" style="width: 30%;margin-left: 35%">
+            <el-row>
+              <el-col :span="12">
+                <el-input
+                    v-model.number="imgWidth"
+                    placeholder="瀹�"/>
+              </el-col>
+              <el-col :span="12">
+                <el-input
+                    v-model.number="imgHeight"
+                    placeholder="楂�"/>
+              </el-col>
+            </el-row>
           </div>
+
+
+
+          <div class="el-upload__tip">
+            {{$t("order.msg.pleaseUploadPicture12")}}
+          </div>
+
         </template>
       </el-upload>
 
@@ -251,7 +303,7 @@
             <template #icon>
               <el-icon><MagicStick /></el-icon>
             </template>
-            淇濆瓨
+            {{$t("basicData.save")}}
           </el-button>
 
           <el-button @click="handleReset"
@@ -260,14 +312,14 @@
             <template #icon>
               <el-icon><RefreshLeft /></el-icon>
             </template>
-            閲嶇疆
+            {{$t("craft.reset")}}
           </el-button>
         </div>
       </div>
 
       <!-- 杞崲杩涘害 -->
       <div v-if="converting" class="conversion-progress">
-        <el-divider content-position="left">涓婁紶杩涘害</el-divider>
+        <el-divider content-position="left">{{$t("order.msg.pleaseUploadPicture13")}}</el-divider>
         <el-progress
             :percentage="progressPercentage"
             :status="progressStatus"
@@ -280,11 +332,11 @@
 
       <!-- 杞崲缁撴灉 -->
       <div v-if="conversionResult" class="conversion-result">
-        <el-divider content-position="left">涓婁紶缁撴灉</el-divider>
+        <el-divider content-position="left">{{$t("order.msg.pleaseUploadPicture14")}}</el-divider>
 
         <el-result
             icon="success"
-            :sub-title="`鏂囦欢宸叉垚鍔熻浆鏍煎紡`"
+            :sub-title='t("order.msg.pleaseUploadPicture15")'
         >
           <template #extra>
             <div class="result-content">
@@ -295,7 +347,7 @@
                     :src="conversionResult"
                     :preview-src-list="[conversionResult]"
                     fit="contain"
-                    style="max-height: 600px;"
+                    :style="{width: `${imgWidth}px`, height: `${imgHeight}px`}"
                 >
 <!--                  <template #error>-->
 <!--                    <div class="image-slot">-->
@@ -317,7 +369,7 @@
                 ><template #icon>
                   <el-icon><Download/></el-icon>
                 </template>
-                  涓嬭浇
+                  {{$t("order.msg.pleaseUploadPicture16")}}
                 </el-button>
                 <el-button
                     @click = 'deleteFile'
@@ -325,7 +377,7 @@
                 ><template #icon>
                   <el-icon><Delete  /></el-icon>
                 </template>
-                  鍒犻櫎
+                  {{$t("basicData.delete")}}
                 </el-button>
               </div>
             </div>
@@ -406,6 +458,7 @@
   margin: 20px 0;
   display: flex;
   justify-content: center;
+  overflow: auto;
 }
 
 .file-info {

--
Gitblit v1.8.0