From ce70bd97c7f2577f0978b39b9da1ccdd8d5b768f Mon Sep 17 00:00:00 2001
From: yangys <y_ys79@sina.com>
Date: 星期五, 19 九月 2025 22:50:14 +0800
Subject: [PATCH] 机床增加设备编号

---
 src/views/basesetting/machine.vue |  117 ++++++++++++++++++++++++++++++++++++++++++++++++----------
 1 files changed, 97 insertions(+), 20 deletions(-)

diff --git a/src/views/basesetting/machine.vue b/src/views/basesetting/machine.vue
index b7cb51f..3572019 100644
--- a/src/views/basesetting/machine.vue
+++ b/src/views/basesetting/machine.vue
@@ -27,22 +27,18 @@
           @on-load="onLoad"
         >
           <template #menu-left>
-            <el-button type="primary" size="default" icon="el-icon-circle-plus" plain @click="handleExport">瀵煎嚭</el-button>
-
-
-            <el-upload :show-file-list="false" class="upload-demo"
-                action="/api/blade-mdm/machine/import"
-                       :on-change="handleChange">
-              <el-button type="primary" plain size="default">瀵煎叆</el-button>
-            </el-upload>
-
-
-
-            <el-button type="primary" size="default" icon="el-icon-circle-plus" plain @click="handleAdd">鏂板</el-button>
+            <div class="menuLeft">
+              <el-button type="primary" size="default" icon="el-icon-circle-plus" plain @click="handleExport">瀵煎嚭</el-button>
+              
+              <el-button type="primary" plain @click="importAction">瀵煎叆</el-button>
+               <el-button type="primary" plain @click="downloadTemplate">涓嬭浇妯℃澘
+                        </el-button>
+              <el-button type="primary" size="default" icon="el-icon-circle-plus" plain @click="handleAdd">鏂板</el-button>
+            </div>
           </template>
           <template #menu="scope">
-            <el-button type="primary" text size="default" icon="el-icon-upload" @click.stop="handleEdit(scope.row, scope.index)">缂栬緫</el-button>
-            <el-button type="primary" text size="default" icon="el-icon-upload" @click.stop="handleDel(scope.row, scope.index)">鍒犻櫎</el-button>
+            <el-button type="primary" text size="default" icon="el-icon-edit" @click.stop="handleEdit(scope.row, scope.index)">缂栬緫</el-button>
+            <el-button type="primary" text size="default" icon="el-icon-delete" @click.stop="handleDel(scope.row, scope.index)">鍒犻櫎</el-button>
             <!--
             <el-button type="primary" text size="default" icon="el-icon-upload" @click.stop="handleUp(scope.row, scope.index)">浜х敓鏈哄簥鍥炰紶鏈烘瀯鏍�</el-button>
             -->
@@ -60,6 +56,11 @@
             </template>
           </avue-form>
         </el-dialog>
+
+        <el-dialog title="" append-to-body v-model="excelBox" width="555px">
+            <avue-form :option="excelOption" v-model="excelForm" :upload-after="uploadAfter">
+            </avue-form>
+        </el-dialog>
       </basic-container>
     </el-col>
   </el-row>
@@ -76,6 +77,29 @@
   data() {
     var that = this;
     return {
+      excelBox: false,
+      excelOption: {
+          submitBtn: false,
+          emptyBtn: false,
+          column: [
+              {
+                  label: '鏂囦欢瀵煎叆',
+                  prop: 'file',
+                  type: 'upload',
+                  drag: true,
+                  loadText: '瀵煎叆涓紝璇风◢鍚�',
+                  span: 24,
+                  propsHttp: {
+                      res: 'data',
+                  },
+                  data: {
+                  },
+                  tip: '',
+                  action: '/blade-mdm/machine/import',
+              },
+          ],
+      },
+      excelForm: {},
       treeOption: {
         nodeKey: 'id',
         lazy: true,
@@ -131,6 +155,7 @@
         labelWidth: 120,
         emptyBtn: false,
         searchSpan: 8,
+        searchEnter:true,
         column: [
           {
             label: '缂栧彿/鍚嶇О',
@@ -143,6 +168,10 @@
           {
             label: '鏈哄簥缂栧彿',
             prop: 'code'
+          },
+          {
+            label: '璁惧缂栧彿',
+            prop: 'equipmentCode'
           },
           {
             label: '鏈哄簥鍨嬪彿',
@@ -196,6 +225,20 @@
               {
                 required: true,
                 message: '璇疯緭鍏ユ満搴婄紪鍙�',
+                trigger: 'blur'
+              }
+            ]
+          },
+          {
+            label: '璁惧缂栧彿',
+            prop: 'equipmentCode',
+            type: 'input',
+            span: 12,
+            dataType: 'string',
+            rules: [
+              {
+                required: true,
+                message: '璇疯緭鍏ヨ澶囩紪鍙�',
                 trigger: 'blur'
               }
             ]
@@ -279,7 +322,7 @@
             dataType: 'string',
           },
           {
-            label: '绯荤粺鎺у埗',
+            label: '鎺у埗绯荤粺',
             prop: 'controlSystem',
             type: 'select',
             span: 12,
@@ -318,7 +361,7 @@
             prop: 'sendDirExpiryHours',
             placeholder:"(灏忔椂)",
             max:24,
-            min:1,
+            min:0,
             type: 'number',
             span: 12,
           },
@@ -329,16 +372,16 @@
             span: 12,
             dataType: 'string',
           },
-          {
+          /*{
             label: '鍥炰紶鐩綍淇濆瓨鏃堕棿',
             prop: 'receiveDirExpiryHours',
-             max:24,
-            min:1,
+            max:24,
+            min:0,
             placeholder:"(灏忔椂)",
             type: 'number',
             span: 12,
           },
-		      
+		      */
           {
             label: '澶囨敞',
             prop: 'remark',
@@ -352,6 +395,25 @@
     };
   },
   methods: {
+    importAction() {
+      this.excelBox = true;
+    },
+    uploadAfter(res, done, loading, column) {
+        window.console.log('res',res);
+        //console.log('res',res)
+        if(res.failure==0 && res.success>0){
+            //鏈夋垚鍔熺殑锛屽叧闂璇濇
+            this.excelBox = false;
+            this.$message.success(res.message);
+            this.onLoad(this.page);
+            //done();
+        }else{
+            //0鎴愬姛鐨勶紝浠呮彁绀�
+            this.$message.info("鎴愬姛"+res.success+",澶辫触"+res.failure+":"+res.message);
+            done();
+        }
+        
+    },
     handleChange(a,b,c) {
       console.log(a,b,c);
     },
@@ -441,6 +503,15 @@
         });
       });
     },
+    downloadTemplate() {
+      NProgress.start();
+      exportBlob(
+          `/blade-mdm/machine/download-template`
+      ).then(res => {
+          downloadXls(res.data, `鏈哄簥瀵煎叆妯$増.xlsx`);
+          NProgress.done();
+      });
+    },
     formSubmit(params, done) {
       var obj = {...params};
       if(params.status.length == 0) {
@@ -463,6 +534,8 @@
         }else {
           this.$message({type: 'error',message: res.data.msg});
         }
+        done();
+      }).catch(e=>{
         done();
       });
     },
@@ -544,4 +617,8 @@
   margin-left: 6px;
   margin-right: 6px;
 }
+.menuLeft {
+  display: flex;
+  align-items: center;
+}
 </style>

--
Gitblit v1.9.3