li.shaoyi 2 سال پیش
والد
کامیت
6a1d48c939

BIN
public/file/20230608.zip


BIN
public/file/批量添加商品模版(单颗裸钻单颗彩钻).xlsx


+ 8 - 0
src/mock/router.ts

@@ -878,6 +878,14 @@ const appmenu = {
                             },
                             {
                                 authType: 3,
+                                title: '批量导入',
+                                code: 'warehousing_goods_import',
+                                component: 'views/warehousing/goods/components/import/index.vue',
+                                className: 'el-button--primary',
+                                hidden: true,
+                            },
+                            {
+                                authType: 3,
                                 title: '详情',
                                 code: 'warehousing_goods_details',
                                 component: 'views/warehousing/goods/components/details/index.vue',

+ 5 - 0
src/packages/pc/views/customs/exit/components/edit/index.vue

@@ -65,6 +65,7 @@
             v-if="formData.GZCJAccountType === 2 ? !!formData.GZCJCategoryType : !!formData.GZCJAccountType">
             <app-table :data="formData.GZCJCategoryDetails" :columns="columns" :max-height="400" border showToolbar>
                 <template #toolbar>
+                    <el-button size="small" @click="downloadFile()">下载模板</el-button>
                     <el-upload accept=".xlsx,.xls" :show-file-list="false" :auto-upload="false" @change="handleExcel">
                         <el-button size="small">导入</el-button>
                     </el-upload>
@@ -368,6 +369,10 @@ const onSubmit = (draft = false) => {
     })
 }
 
+const downloadFile = () => {
+    window.open('/file/20230608.zip')
+}
+
 onMounted(() => {
     const { gzcjaccounttype = gzcjAccountTypeList[0]?.value } = props.selectedRow ?? {}
     formData.GZCJAccountType = gzcjaccounttype

+ 32 - 0
src/packages/pc/views/warehousing/goods/components/import/index.vue

@@ -0,0 +1,32 @@
+<!-- 我的库存-批量导入 -->
+<template>
+    <app-drawer title="批量导入" :width="960" v-model:show="show">
+        <el-upload accept=".xlsx,.xls" :show-file-list="false" :auto-upload="false" @change="handleExcel">
+            <el-button size="small">导入</el-button>
+        </el-upload>
+    </app-drawer>
+</template>
+
+<script lang="ts" setup>
+import { shallowRef } from 'vue'
+import { UploadFile } from 'element-plus'
+import { read, utils } from 'xlsx'
+import AppDrawer from '@pc/components/base/drawer/index.vue'
+
+const show = shallowRef(true)
+
+// 处理导入的excel表格
+const handleExcel = (uploadFile: UploadFile) => {
+    const fileReader = new FileReader()
+    fileReader.readAsBinaryString(uploadFile.raw as Blob)
+    fileReader.onload = (ev) => {
+        const data = ev.target?.result
+        if (data) {
+            const workbook = read(data, { type: 'binary' })
+            const page1 = workbook.SheetNames[0]
+            const page2 = workbook.SheetNames[1]
+            console.log(workbook)
+        }
+    }
+}
+</script>

+ 2 - 1
src/packages/pc/views/warehousing/goods/index.vue

@@ -7,7 +7,8 @@
         <!-- 表格数据 -->
         <app-table :data="dataList" v-model:columns="tableColumns" :loading="loading">
             <template #header>
-                <app-auth-operation :menus="['warehousing_goods_add', 'warehousing_goods_sell']" @closed="onRefresh" />
+                <app-auth-operation :menus="['warehousing_goods_add', 'warehousing_goods_sell', 'warehousing_goods_import']"
+                    @closed="onRefresh" />
             </template>
             <!-- 价格 -->
             <template #price="{ row }">