From 88eb226ff61f3ce18be4a07c8fa7dd51726aaa63 Mon Sep 17 00:00:00 2001
From: chenlu <1320612696@qq.com>
Date: 星期四, 11 七月 2024 15:43:43 +0800
Subject: [PATCH] Merge branch 'master' of http://bore.pub:10439/r/ERP_override

---
 north-glass-erp/northglass-erp/src/views/sd/basicData/CreateBasicData.vue |   42 +++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 41 insertions(+), 1 deletions(-)

diff --git a/north-glass-erp/northglass-erp/src/views/sd/basicData/CreateBasicData.vue b/north-glass-erp/northglass-erp/src/views/sd/basicData/CreateBasicData.vue
index 30483a9..d96dcaa 100644
--- a/north-glass-erp/northglass-erp/src/views/sd/basicData/CreateBasicData.vue
+++ b/north-glass-erp/northglass-erp/src/views/sd/basicData/CreateBasicData.vue
@@ -140,6 +140,7 @@
       basic.value.input=basic.value.input+"mm"
     }
   }
+  console.log(basic.value)
   request.post(`/basicData/addBasicData`, basic.value).then(res => {
     if (res.data) {
       ElMessage.success(t('basicData.msg.saveSuccess'))
@@ -172,6 +173,29 @@
   ).map((item) =>item.children.filter((item) =>item.value === value[1]))
 }
 
+const changeFile = (file) => {
+  const isJPG = file.raw.type === 'image/jpeg' || file.raw.type === 'image/png' ;
+  const isLt2M = file.size / 1024 / 1024 < 5;
+
+  if (!isJPG) {
+    ElMessage.warning(t('orderBasicData.msg2'))
+    return
+  }
+  if (!isLt2M) {
+    ElMessage.warning(t('orderBasicData.msg1'))
+    return
+  }
+
+  return new Promise((resolve, reject) => {
+    let reader = new FileReader();
+    reader.readAsDataURL(file.raw);
+    reader.onload = (e) => {
+      resolve(e.target.result);
+      basic.value.nickname=e.target.result;
+    };
+  });
+}
+
 
 </script>
 
@@ -184,7 +208,6 @@
             v-model="basic.basicType"
             @change="handleChange"
             :options="options"
-            clearable
             placeholder=""
             :disabled="props.rowIndex"
         />
@@ -202,6 +225,23 @@
         <el-input v-model="basic.nickname"/>
       </el-col>
     </el-row>
+    <el-row v-if="basic.basicType.length!==0 && basic.basicType[1]==='icon'" >
+      <el-col :span="4"></el-col>
+      <el-col :span="12">
+        <el-upload
+            v-model="basic.nickname"
+            :limit="1"
+            :on-change="changeFile"
+            class="upload-demo"
+            ref="upload"
+            action="https://jsonplaceholder.typicode.com/posts/"
+            :file-list="fileList"
+            :auto-upload="false">
+          <el-button slot="trigger" size="small" type="primary" >{{ $t('orderBasicData.selectFile') }}</el-button>
+          <div slot="tip" class="el-upload__tip">{{ $t('orderBasicData.msg3') }}</div>
+        </el-upload>
+      </el-col>
+    </el-row>
     <el-row>
       <el-col :span="4"></el-col>
       <el-col :span="12">

--
Gitblit v1.8.0