zhaohuanhuan 1 år sedan
förälder
incheckning
c2954fedb0

+ 19 - 6
index.html

@@ -2,25 +2,38 @@
 <html lang="en">
   <head>
     <meta charset="UTF-8" />
-    <link rel="icon" type="image/svg+xml" href="/vite.svg" />
+<!--    <link rel="icon" type="image/svg+xml" href="/vite.svg" />-->
+    <link rel="stylesheet" href="src/assets/iconfont/iconfont.css" />
     <meta
       name="viewport"
       content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, viewport-fit=cover"
     />
+
     <title>h5</title>
   </head>
   <body>
     <div id="app"></div>
+      <script type="module">
+        if (import.meta.env.MODE === 'development' || import.meta.env.MODE === 'sit') {
+          // 异步加载 eruda
+          const script = document.createElement('script');
+          script.src = 'https://cdn.bootcdn.net/ajax/libs/eruda/2.3.3/eruda.min.js';
+          script.onload = () => {
+          eruda.init();
+        };
+        document.head.appendChild(script);
+      }
+    </script>
     <script type="module" src="/src/main.ts"></script>
     <script>
       function getBrowserInfo() {
-        const userAgent = navigator.userAgent;
-        let browserName = "Unknown";
-        let browserVersion = "Unknown";
+        const userAgent = navigator.userAgent
+        let browserName = 'Unknown'
+        let browserVersion = 'Unknown'
 
         // 检查浏览器类型及版本
-        if (userAgent.includes("Chrome")) {
-          browserName = "Chrome";
+        if (userAgent.includes('Chrome')) {
+          browserName = 'Chrome';
           // 提取 Chrome 版本
           const match = userAgent.match(/Chrome\/([0-9]+)/);
           if (match) {

+ 1 - 2
package.json

@@ -35,7 +35,6 @@
     "@vue/compiler-sfc": "^3.5.13",
     "@vue/runtime-dom": "^3.5.13",
     "core-js": "^3.40.0",
-    "eruda": "^3.4.1",
     "eslint": "^9.17.0",
     "eslint-config-prettier": "^9.1.0",
     "eslint-plugin-prettier": "^5.2.1",
@@ -45,7 +44,7 @@
     "sass-embedded": "^1.83.0",
     "terser": "^5.37.0",
     "typescript": "^5.7.2",
-    "vite": "^6.0.1",
+    "vite": "6.0.9",
     "vue-tsc": "^2.2.0"
   }
 }

+ 63 - 0
src/api/blind/index.ts

@@ -0,0 +1,63 @@
+// @ts-ignore
+import request from '@/utils/request'
+// @ts-ignore
+import { checkBlindBarcodeType, getBlindTaskType, getMovingTaskType } from '@/types/blind'
+
+/**
+ * 盲收任务获取
+ * @param data
+ */
+export function getBlindTask(data:any) {
+  return request({
+    url: 'api/entryOrder/app/blind/get',
+    method: 'get',
+    params:data
+  })
+}
+/**
+ * 般仓任务获取
+ * @param data
+ */
+export function getMovingTask(data:getMovingTaskType) {
+  return request({
+    url: 'api/wms/moving/app/get',
+    method: 'get',
+    params:data
+  })
+}
+
+
+/**
+ * 获取盲收任务列表
+ */
+export function getBlindTaskList() {
+  return request({
+    url: 'api/entryOrder/app/blind/list',
+    method: 'get',
+  })
+}
+/**
+ * 设置盲收类型
+ */
+export function setBlindTaskMode(data:any) {
+  return request({
+    url: 'api/entryOrder/app/blind/acceptTask',
+    method: 'post',
+    data:JSON.stringify(data),
+  })
+}
+/**
+ * 检查盲收任务条码
+ */
+export function checkBlindBarcode(params:checkBlindBarcodeType) {
+  return request({
+    url: 'api/entryOrder/app/blind/checkBarcode',
+    method: 'get',
+    params
+  })
+}
+
+
+
+
+

+ 7 - 0
src/api/login/index.ts

@@ -10,3 +10,10 @@ export function login(data:loginType) {
     data:JSON.stringify(data)
   })
 }
+
+export function getUserInfo() {
+  return request({
+    url: 'api/user/info',
+    method: 'get',
+  })
+}

+ 34 - 0
src/assets/iconfont/iconfont.css

@@ -0,0 +1,34 @@
+@font-face {
+    font-family: "iconfont"; /* Project id 4817887 */
+    src: url('https://at.alicdn.com/t/c/font_4817887_cd0dd2fuadj.woff2?t=1737683854859') format('woff2'),
+    url('https://at.alicdn.com/t/c/font_4817887_cd0dd2fuadj.woff?t=1737683854859') format('woff'),
+    url('https://at.alicdn.com/t/c/font_4817887_cd0dd2fuadj.ttf?t=1737683854859') format('truetype');
+}
+
+.iconfont {
+    font-family: "iconfont" !important;
+    font-size: 16px;
+    font-style: normal;
+    -webkit-font-smoothing: antialiased;
+    -moz-osx-font-smoothing: grayscale;
+}
+
+.icon-zhuangxiangyanhuodan:before {
+    content: "\e8f0";
+}
+
+.icon-zhuangxiangsmall:before {
+    content: "\e732";
+}
+
+.icon-zaixianqingdian:before {
+    content: "\e6b0";
+}
+
+.icon-shoudongluru:before {
+    content: "\e67b";
+}
+
+.icon-anxiangshoufenhuozuoyedansvg:before {
+    content: "\e601";
+}

+ 0 - 6
src/main.ts

@@ -11,12 +11,6 @@ import 'regenerator-runtime/runtime';
 import Vant from 'vant'
 import { Loading } from 'vant'
 import 'vant/lib/index.css'
-if (process.env.NODE_ENV === 'development' || process.env.NODE_ENV === 'sit') {
-  import('eruda').then(eruda => {
-    // @ts-ignore
-    eruda.init();
-  });
-}
 const app = createApp(App)
 // 使用 Vant UI 组件库
 app.use(Vant)

+ 11 - 1
src/router/index.ts

@@ -20,7 +20,17 @@ const routes: RouteRecordRaw[] = [
     path: '/picking-task',
     name: 'PickingTask',
     component: () => import('@/views/outbound/picking/task/index.vue')
-  }
+  },
+  {
+    path: '/mode',
+    name: 'BlindMode',
+    component: () => import('@/views/inbound/blindCollection/mode/index.vue')
+  },
+  {
+    path: '/blind-task',
+    name: 'BlindTask',
+    component: () => import('@/views/inbound/blindCollection/task/index.vue')
+  },
 ];
 
 // 创建路由实例

+ 18 - 0
src/types/blind.ts

@@ -0,0 +1,18 @@
+/**
+ * 盲收任务
+ * taskNo:任务号
+ */
+export interface getBlindTaskType {
+  taskNo: string;
+}
+/**
+ * 检查盲收任务条码
+ * barcode:条码
+ * warehouse:仓库
+ * warehouse:货主
+ */
+export interface checkBlindBarcodeType {
+  warehouse: string;
+  ownerCode: string;
+  barcode: string;
+}

+ 12 - 3
src/utils/request.ts

@@ -1,7 +1,7 @@
 // src/utils/resquest.ts
 import axios from 'axios'
 import { useStore } from '../store/modules/user'
-import { showDialog, showFailToast, showToast } from 'vant'
+import { showDialog, showFailToast, showNotify, showToast } from 'vant'
 // @ts-ignore
 import router from '@/router'
 const store = useStore()
@@ -49,7 +49,11 @@ service.interceptors.response.use(
         }
         return
       }
-      showToast({duration:5000,message:res.message})
+      showNotify({
+        message: res.message,
+        duration: 5000,
+      });
+      // showToast({duration:10000,message:res.message})
       return Promise.reject(res);
     }
     return res;
@@ -58,8 +62,13 @@ service.interceptors.response.use(
     if (error.code === 'ECONNABORTED') {
       // 请求超时处理
       showFailToast({ duration: 5000, message: '请求超时,请稍后重试!', wordBreak: 'break-word' });
-    }else {
+    }else if(error.code === 'ERR_NETWORK'){
       showFailToast({duration:5000,message:'网络开小车了, 请稍后重试!',wordBreak:'break-word'})
+    }else {
+      showNotify({
+        message: error.message,
+        duration: 8000,
+      });
     }
     return Promise.reject(error);
   }

+ 85 - 0
src/views/inbound/blindCollection/components/TaskList.vue

@@ -0,0 +1,85 @@
+<template>
+  <div class="task">
+    <van-action-sheet
+      v-model:show="taskTrueFalseBy"
+      title="任务中心"
+      close-on-click-action
+      @cancel="taskTrueFalseBy=false"
+    >
+      <div class="task-content">
+      <table  class="task-table">
+        <thead>
+        <tr>
+          <th style="width: 80px">任务号</th>
+          <th style="width: 60px">货主</th>
+          <th style="width: 72px">创建时间</th>
+          <th>创建人</th>
+          <th>状态</th>
+          <th style="width: 50px">操作</th>
+        </tr>
+        </thead>
+        <tbody>
+        <tr v-for="(item, index) in taskList" :key="index" :class="{'odd-row': index % 2 !=0}">
+          <td>{{ item.code }}</td>
+          <td>{{ item.ownerName }}</td>
+          <td>{{ item.createTime }}</td>
+          <td>{{ item.creator }}</td>
+          <td>{{ item.status }}</td>
+          <td><van-button plain size="mini" type="primary">接受任务</van-button></td>
+
+        </tr>
+        </tbody>
+      </table>
+      </div>
+    </van-action-sheet>
+  </div>
+</template>
+<script setup lang="ts">
+import { nextTick, onMounted, ref } from 'vue'
+const taskTrueFalseBy=ref(false)
+const taskList=ref({})
+onMounted(()=>{
+  nextTick(() => {
+    window.scrollTo(0, 0);
+  });
+})
+const show = async (list) => {
+  taskList.value = list
+  taskTrueFalseBy.value = true
+}
+defineExpose({show})
+</script>
+<style scoped lang="sass">
+.task
+  .task-content
+    width: 100%
+    height: 65vh
+    overflow-y: auto
+    .task-table
+      width: 100%
+      border-collapse: collapse
+      table-layout: fixed
+      font-size: 12px
+    .task-table th, .task-table td
+      text-align: center
+      border: 1px solid #ccc
+      word-wrap: break-word
+      word-break: break-all
+      font-weight: 500
+    .task-table thead
+      background-color: #3f8dff
+      position: sticky
+      top: 0
+      z-index: 1
+      color: white
+      font-size: 14px
+    .task-table tbody tr.odd-row
+      background-color: #e4f2ff
+
+
+
+
+
+
+
+</style>

+ 252 - 0
src/views/inbound/blindCollection/mode/index.vue

@@ -0,0 +1,252 @@
+<template>
+  <div class="container">
+    <van-nav-bar
+      title="盲收-多人任务"
+      left-arrow
+      fixed
+      placeholder
+    >
+      <template #left>
+        <van-icon name="arrow-left" size="25"   @click="goBack" />
+        <div style="color: #fff" @click="onClickLeft">返回</div>
+      </template>
+      <template #right>
+        <div style="color: #fff" @click="onClickRight">任务中心</div>
+        <van-icon name="newspaper-o" size="25"   @click="onClickRight" />
+      </template>
+    </van-nav-bar>
+    <div class="mode">
+      <div class="mode-input-box">
+        <div class="mode-input-text">请扫描盲收/般仓任务号</div>
+        <van-field class="mode-input" ref="taskNoRef"
+                   :style="taskNo!==''?'border: 2px solid #07c160':''" clearable v-model="taskNo"
+                   placeholder="请扫描盲收/般仓任务号"
+                   @keydown.enter="_getBlindTask()"
+        />
+      </div>
+      <div class="mode-select">
+        <div class="select-list">
+          <div class="select-item" @click="onSelect(2)">
+            <i class="iconfont icon-zaixianqingdian select-item-icon" style="color: #7598ca"></i>
+            <div class="left">
+              <div class="select-item-title">清点模式</div>
+              <div class="select-item-tips">步骤:扫描条码->进行装箱</div>
+            </div>
+            <div class="right">
+              <van-button type="primary" round size="small">选择</van-button>
+            </div>
+          </div>
+          <div class="select-item"  @click="onSelect(1)">
+            <i class="iconfont icon-anxiangshoufenhuozuoyedansvg select-item-icon" style="color: #1989fa"></i>
+            <div class="left">
+              <div class="select-item-title" >分货模式</div>
+              <div class="select-item-tips">步骤:扫描条码->相同条码分配格口</div>
+            </div>
+            <div class="right">
+              <van-button type="primary" round size="small"> 选择</van-button>
+            </div>
+
+          </div>
+          <div class="select-item"  @click="onSelect(3)">
+            <i class="iconfont icon-shoudongluru select-item-icon" style="color: #ef9a00"></i>
+            <div class="left">
+              <div class="select-item-title">录入模式</div>
+              <div class="select-item-tips">步骤:扫描条码->录入效期、批次信息->输入数量->进行装箱</div>
+            </div>
+            <div class="right">
+              <van-button type="primary" round size="small"> 选择</van-button>
+            </div>
+          </div>
+          <div class="select-item"  @click="onSelect(5)">
+            <i class="iconfont icon-zhuangxiangyanhuodan select-item-icon" style="color:#55d1c2;"></i>
+            <div class="left">
+              <div class="select-item-title">按箱清点+分货多人</div>
+              <div class="select-item-tips">步骤:扫描箱号->扫描条码->统计数量</div>
+            </div>
+            <div class="right">
+              <van-button type="primary" round size="small"> 选择</van-button>
+            </div>
+          </div>
+        </div>
+      </div>
+    </div>
+    <task-list ref="taskListRef" />
+  </div>
+</template>
+<script setup>
+import { goBack } from '@/utils/android.ts'
+import { useRoute, useRouter } from 'vue-router'
+import { onMounted, ref } from 'vue'
+import { openListener, scanInit } from '@/utils/keydownListener.js'
+import { getBlindTask, getBlindTaskList, getMovingTask, setBlindTaskMode } from '@/api/blind/index.ts'
+import { showConfirmDialog, showToast } from 'vant'
+import TaskList from '@/views/inbound/blindCollection/components/TaskList.vue'
+import { closeLoading, showLoading } from '@/utils/loading.ts'
+const route = useRoute()
+const router = useRouter()
+//任务号
+const taskNo=ref('')
+const taskNoRef=ref(null)
+// 扫描
+onMounted(() => {
+  openListener()
+  setTimeout(() => {
+    taskNoRef.value?.focus()
+    scanInit(_handlerScan)
+  },300)
+})
+//监听扫描
+const _handlerScan=(code)=>{
+  if (/[a-zA-Z]/.test(code)) {
+    code =code.toUpperCase();  // 强制转换为大写字母
+  }
+  taskNo.value=code
+  _getBlindTask()
+}
+const onClickLeft = () => {
+  if(route.query.type==='picking'){
+    history.back();
+  }else {
+    goBack()
+  }
+};
+const link=(code,type)=>{
+  router.push({name:'BlindTask',query: { code,type }})
+}
+//查询盲收任务
+const taskModel=ref({})
+const _getBlindTask=()=>{
+  if(taskNo.value===''){
+    showToast({duration:5000,message:'请先扫描盲收或般仓任务号'})
+    return
+  }
+  taskModel.value={}
+  let url=getBlindTask,data={taskNo:taskNo.value},type=0
+  if(taskNo.value.startsWith("BC")) {
+    url=getMovingTask
+    data={code:taskNo.value}
+    type=1
+  }
+  url(data).then(res=>{
+    taskModel.value=res.data
+    //盲收任务
+    if(type===0){
+      if(res.data && res.data.type){
+        link(res.data.code,res.data.type)
+      }else {
+        showToast({duration:5000,message:'该任务未绑定模式,请选择模式!'})
+      }
+    }else {
+      //般仓任务
+      if(res.data){
+      }
+    }
+  })
+}
+//设置盲收任务类型
+const onSelect=(type)=>{
+  const modeMap={
+    1:'分货模式',
+    2:'清点模式',
+    3:'录入模式',
+    5:'按箱清点+分货多人',
+  }
+  if(taskNo.value===''){
+    showToast({duration:5000,message:'请先扫描盲收或般仓任务号'})
+    return
+  }
+  if(Object.keys(taskModel.value).length===0){
+    showToast({duration:5000,message:'未检测到任务,请检查任务号是否正确!'})
+    return
+  }
+  if(taskModel.value.type){
+    link(taskModel.value.code,taskModel.value.type)
+    return
+  }
+  showConfirmDialog({
+    title: '温馨提示',
+    message:
+      `是否将盲收任务:${taskNo.value},设置为:${modeMap[type]}`,
+  })
+    .then(() => {
+      const params={
+        type:modeMap[type],
+        warehouseCode:taskModel.value.warehouseCode,
+        ownerCode:taskModel.value.ownerCode,
+        code:taskModel.value.code,
+      }
+      setBlindTaskMode(params).then(res=>{
+        link(taskModel.value.code,modeMap[type])
+      })
+    })
+
+}
+
+const taskListRef=ref(null)
+/**
+ * 任务中心
+ */
+const onClickRight = () => {
+  showLoading()
+  getBlindTaskList().then(res=>{
+    closeLoading()
+    if(res.data.length>0){
+      taskListRef.value?.show(res.data)
+    }else {
+      showToast({duration:5000,message:'未检测到近两天盲收任务!'})
+    }
+  }).catch(err=>{
+    closeLoading()
+  })
+
+};
+
+</script>
+<style scoped lang="sass">
+.mode
+  .mode-input-box
+    padding: 10px
+    .mode-input-text
+      font-size: 18px
+      font-weight: bold
+      margin: 10px 0
+
+    .mode-input
+      background: #eff0f2
+      padding: 10px 20px
+      font-size: 20px
+      border-radius: 20px
+      border: 2px solid #0077ff
+      font-weight: 500
+  .mode-select
+    padding: 10px
+    .select-list
+      margin-top: 10px
+      text-align: left
+      .select-item
+        padding: 6px 10px
+        background: #ffffff
+        border-radius: 16px
+        display: flex
+        justify-content: space-between
+        align-items: center
+        margin-bottom: 10px
+        position: relative
+        box-sizing: content-box
+        box-shadow: 1px 1px 5px rgba(0, 0, 0, 0.4)
+        .select-item-icon
+          font-size: 40px
+          margin-right: 10px
+        .left
+          flex: 1
+        .right
+          width: 20%
+          text-align: right
+        .select-item-title
+          font-size: 18px
+          font-weight: bold
+        .select-item-tips
+          font-size: 14px
+          color: #666
+
+</style>

+ 58 - 0
src/views/inbound/blindCollection/task/index.vue

@@ -0,0 +1,58 @@
+<template>
+  <div class="container">
+    <van-nav-bar
+      :title="taskType"
+      left-arrow
+      fixed
+      placeholder
+    >
+      <template #left>
+        <van-icon name="arrow-left" size="25"   @click="goBack" />
+        <div style="color: #fff" @click="onClickLeft">返回</div>
+      </template>
+      <template #right>
+        <div style="color: #fff" @click="onClickRight">提交任务</div>
+      </template>
+    </van-nav-bar>
+    <van-field v-model="barcode" label="条码" placeholder="请扫描条码"  @keydown.enter.native="_checkBarcode" />
+  </div>
+</template>
+<script setup>
+import { goBack } from '@/utils/android'
+import { useRoute } from 'vue-router'
+import { checkBlindBarcode, getBlindTask } from '@/api/blind/index.ts'
+import { ref } from 'vue'
+const route = useRoute()
+const barcode=ref('')
+//查询任务信息
+const taskInfo=ref({})
+const taskType=route.query.type
+const getTaskInfo=(taskNo)=>{
+  getBlindTask({taskNo}).then(res => {
+    taskInfo.value=res.data
+  })
+}
+getTaskInfo(route.query.code)
+
+const _checkBarcode=()=>{
+  const params={
+    warehouse:taskInfo.value.warehouseCode,
+    ownerCode:taskInfo.value.ownerCode,
+    barcode:barcode.value,
+  }
+  checkBlindBarcode(params).then(res=>{
+    console.log(res.data)
+  })
+}
+// checkBlindBarcode
+
+
+const onClickLeft = () => {
+  history.back();
+};
+const onClickRight=()=>{
+
+}
+</script>
+<style scoped lang="scss">
+</style>

+ 25 - 4
src/views/index.vue

@@ -1,16 +1,35 @@
 <template>
   <div class="container">
     <van-image class="image" :src="imageUrl" ></van-image>
-    <div class="home" @click="onRouter">欢迎进入</div>
+    <div class="name" >{{userInfo.username}}</div>
+    <div class="home" @click="onRouter('picking')">进入拣货</div>
+    <div class="home" @click="onRouter('mode')">进入盲收</div>
+
   </div>
 </template>
 <script setup>
 import imageUrl from '@/assets/img.png'
 import { useRouter } from 'vue-router'
+import { getHeader } from '@/utils/android.ts'
+import { useStore } from '@/store/modules/user.ts'
+import { getUserInfo } from '@/api/login/index.ts'
+import { ref } from 'vue'
 const router = useRouter()
-const onRouter=()=>{
-  router.push('/picking')
+const onRouter=(path)=>{
+  router.push(`/${path}`)
+}
+const store = useStore()
+const userInfo=ref({})
+try {
+  getHeader()
+}catch (error) {
 }
+setTimeout(()=>{
+  getUserInfo().then(res => {
+    userInfo.value=res.data
+  })
+},300)
+
 </script>
 <style scoped lang="sass" >
 .container
@@ -23,5 +42,7 @@ const onRouter=()=>{
     font-size: 18px
     text-decoration: underline
     color: #0077ff
-
+  .name
+    font-size: 20px
+    color: #0077ff
 </style>

+ 1 - 1
src/views/login/login.vue

@@ -51,7 +51,7 @@ const onConfirm = async () => {
   const { data } = await login(params)
   data.warehouse='WH99'
   store.setToken(data)
-  router.push('/picking')
+  router.push('/')
 }
 
 </script>

+ 1 - 1
src/views/outbound/picking/components/BigPicking.vue

@@ -191,7 +191,7 @@ const onBuildTask=(action)=>
     }
     showLoading()
     api(params).then(res => {
-      console.log(res,"data")
+      // console.log(res,"data")
       closeLoading()
       showToast({duration:5000,message:'大件任务创建成功!正在跳转'})
       router.push({name:'PickingList',query: { code:res.data }})

+ 9 - 3
src/views/outbound/picking/list/index.vue

@@ -106,7 +106,7 @@
 </template>
 <script lang="ts" setup>
 import { computed, defineAsyncComponent, nextTick, onMounted, onUnmounted, ref, watch } from 'vue'
-import { showConfirmDialog, showDialog, showFailToast, showToast } from 'vant'
+import { showConfirmDialog, showDialog, showFailToast, showNotify, showToast } from 'vant'
 import { fetchPickingData, getPickingTask } from '@/views/outbound/picking/list/hooks/list'
 import { getOwnerList } from '@/hooks/basic'
 import { useRouter,useRoute } from 'vue-router'
@@ -233,7 +233,9 @@ const loadData =  async (pickingCode) => {
   }else {
     scanBarcode.value=''
     containerNo.value=''
+    // window.android.focus()
     // onContainerNo(2)
+
   }
 }
 // 设置拣货容器
@@ -321,7 +323,7 @@ const barcodeCombineRef=ref(null)
 const _handlerScan=(code)=> {
   if(scanType.value===1){
     if(code.split('-')[0]!=='JH'){
-      showToast({duration:5000,message:'请使用标准拣货容器'})
+       showToast({duration:5000,message:'请使用标准拣货容器'})
       return
     }
     containerNo.value=code
@@ -553,7 +555,11 @@ const _setPickingDetail=(params,type)=>{
     }if(err.code=='ECONNABORTED'){
       messageTips.value = '请求超时,请稍后重试!'
     }else {
-      showFailToast({duration:5000,message:err.message})
+      showNotify({
+        message: err.message,
+        duration: 5000,
+      });
+      // showFailToast({duration:5000,message:err.message})
     }
     jumpLoading.value=false
   })

+ 0 - 0
src/views/outbound/picking/my/index.vue


+ 1 - 1
src/views/outbound/picking/task/index.vue

@@ -469,7 +469,7 @@ const onMore= async (row)=>{
 //查看城市
 const onProvince= async (row)=>{
   showDialog({
-    title: `${ownerMap.value[row.owner]?ownerMap.value[row.owner]:row.owner}`+`规则`,
+    title: `${ownerMap.value[row.owner]?ownerMap.value[row.owner]:row.owner}`+`城市规则`,
     message: row.province,
   }).then(() => {
     // on close

+ 5 - 3
vite.config.ts

@@ -1,7 +1,8 @@
 import { defineConfig } from 'vite'
 import vue from '@vitejs/plugin-vue'
 import legacy from '@vitejs/plugin-legacy';
-export default defineConfig({
+export default defineConfig(({ mode }) => {
+  return {
   plugins: [vue(),
     legacy({
       targets: ['> 0.1%', 'not dead','chrome <= 66'],
@@ -21,10 +22,11 @@ export default defineConfig({
     }
   },
   optimizeDeps: {
-    include: ['vue']
+    include: ['vue','eruda']
   },
   base:'./',
   build: {
-    sourcemap: process.env.ENV === 'development',
+    sourcemap: mode === 'development'
   },
+  }
 })