From 31380071dc933444909ae160c1ea34600784a13b Mon Sep 17 00:00:00 2001
From: gaoshp <291585735@qq.com>
Date: 星期三, 13 八月 2025 22:24:57 +0800
Subject: [PATCH] 导入导出

---
 src/views/basesetting/produceplan.vue |   70 +++++++++++++++++++++++++++++++++--
 1 files changed, 66 insertions(+), 4 deletions(-)

diff --git a/src/views/basesetting/produceplan.vue b/src/views/basesetting/produceplan.vue
index bb5510e..9c9f6be 100644
--- a/src/views/basesetting/produceplan.vue
+++ b/src/views/basesetting/produceplan.vue
@@ -1,7 +1,7 @@
 <!--
  * @Date: 2025-06-17 11:44:52
  * @LastEditors: gaoshp
- * @LastEditTime: 2025-08-06 20:34:14
+ * @LastEditTime: 2025-08-13 22:22:49
  * @FilePath: /mdmweb/src/views/basesetting/produceplan.vue
 -->
 <template>
@@ -24,17 +24,67 @@
                 </el-button>
             </template> -->
         </avue-crud>
+        <el-dialog title="" append-to-body v-model="excelBox" width="555px">
+            <avue-form :option="excelOption" v-model="excelForm" :upload-after="uploadAfter">
+                <template #excelTemplate>
+                    <el-button type="primary" @click="handleTemplate">
+                        纭畾
+                    </el-button>
+                </template>
+            </avue-form>
+        </el-dialog>
     </basic-container>
 </template>
 
 <script>
 import { getList, remove,save,update } from '@/api/basesetting/produceplan';
 import { mapGetters } from 'vuex';
+import { exportBlob } from '@/api/common';
+import { getToken } from '@/utils/auth';
+import NProgress from 'nprogress';
+import { downloadXls } from '@/utils/util';
 export default {
     name: 'ProducePlan',
     data() {
         return {
             // Define your data properties here
+            excelOption: {
+                submitBtn: false,
+                emptyBtn: false,
+                column: [
+                    // {
+                    //     label: '鏂囦欢绫诲瀷',
+                    //     prop: 'fileType',
+                    //     type: 'select',
+                    //     span: 24,
+                    //     clearable: false,
+                    //     dicData: [
+                    //         { label: '绋嬪簭鏂囦欢', value: 'program' },
+                    //         { label: '鍏朵粬鏂囦欢', value: 'other' },
+                    //     ],
+                    // },
+                    {
+                        label: '鏂囦欢瀵煎叆',
+                        prop: 'file',
+                        type: 'upload',
+                        drag: true,
+                        loadText: '瀵煎叆涓紝璇风◢鍚�',
+                        span: 24,
+                        propsHttp: {
+                            res: 'data',
+                        },
+                        data: {
+                        },
+                        tip: '',
+                        action: '/blade-mdm/producedivision/download-template',
+                    },
+                ],
+            },
+            excelForm: {
+                fileType: 'program',
+                excelFile: [],
+            },
+            excelBox: false,
             option: {
                 // Define your Avue CRUD options here
                 addBtn: true,
@@ -198,11 +248,23 @@
         },
         importAction() {
             // Logic for importing data
-            this.$message.success('瀵煎叆鍔熻兘灏氭湭瀹炵幇');
+            // this.$message.success('瀵煎叆鍔熻兘灏氭湭瀹炵幇');
+            this.excelBox = true;
+        },
+        uploadAfter(res, done, loading, column) {
+            window.console.log(column);
+            this.onLoad(this.page);
+            this.excelBox = false;
+            done();
         },
 		downTemplateAction() {
-            // Logic for importing data
-            this.$message.success('妯℃澘鍔熻兘灏氭湭瀹炵幇');
+            NProgress.start();
+            exportBlob(
+                `/blade-mdm/producedivision/download-template`
+            ).then(res => {
+                downloadXls(res.data, `涓诲埗鍒嗗伐琛ㄥ鍏ユā鐗�.xlsx`);
+                NProgress.done();
+            });
         },
         rowDel(row) {
             this.$confirm('纭畾灏嗛�夋嫨鏁版嵁鍒犻櫎?', {

--
Gitblit v1.9.3