From 233e4fc4f35bd00a36ee34a7fbf5e47b41db26db Mon Sep 17 00:00:00 2001
From: chenyao <1219716595@qq.com>
Date: Mon, 17 Nov 2025 09:54:44 +0800
Subject: [PATCH] feat:更新初始化地形

---
 src/views/device/components/firmwareManage.vue |   85 +++++++++++++++++++++++++++++++-----------
 1 files changed, 63 insertions(+), 22 deletions(-)

diff --git a/src/views/device/components/firmwareManage.vue b/src/views/device/components/firmwareManage.vue
index b090082..aa0b3e7 100644
--- a/src/views/device/components/firmwareManage.vue
+++ b/src/views/device/components/firmwareManage.vue
@@ -17,6 +17,7 @@
       @current-change="currentChange"
       @size-change="sizeChange"
       @refresh-change="refreshChange"
+       @on-load="onLoad"
     >
       <template #menu-left>
         <el-button type="primary" icon="el-icon-plus" plain @click="openFirmwareUpload"
@@ -24,20 +25,21 @@
         </el-button>
       </template>
     </avue-crud>
-    <el-dialog title="固件上传" append-to-body v-model="firmwareUploadBox" width="40%" height="60%">
+    <el-dialog title="固件上传" class="ztzf-dialog-mange" append-to-body v-model="firmwareUploadBox" width="40%" height="60%">
       <el-form
         ref="form"
+        class="ztzf-form-search"
         :model="importForm"
-        label-width="80px"
+        v-loading="loadingForm"
         style="width: 80%; margin-left: 10%"
         :rules="rules"
       >
         <el-form-item label="设备名称" prop="device_name">
-          <el-input v-model="importForm.device_name" clearable disabled></el-input>
+          <el-input v-model="importForm.device_name" clearable></el-input>
         </el-form-item>
 
         <!-- 上传 -->
-        <el-form-item label="固件文件" label-width="80px" prop="file">
+        <el-form-item label="固件文件" prop="file">
           <el-upload
             class="upload-demo"
             action="#"
@@ -48,7 +50,7 @@
             :before-upload="beforeUploadFile"
           >
             <i class="el-icon-upload"></i>
-            <div class="el-upload__text" style="height: 50px"><em>点击上传</em></div>
+            <div class="el-upload__text" style="height: 50px"> <el-button>点击上传</el-button></div>
           </el-upload>
         </el-form-item>
         <el-form-item label="是否可用" prop="status">
@@ -57,14 +59,16 @@
             <el-option label="否" value="0"></el-option>
           </el-select>
         </el-form-item>
-        <el-form-item label="说明" label-width="80px" prop="release_note">
+        <el-form-item label="说明" prop="release_note">
           <el-input type="textarea" v-model="importForm.release_note" clearable></el-input>
         </el-form-item>
-        <el-form-item>
-          <el-button type="primary" @click="onConfirm">确定</el-button>
-          <el-button @click="onCancel">取消</el-button>
-        </el-form-item>
       </el-form>
+      <template #footer>
+        <div class="dialog-footer">
+        <el-button type="primary" @click="onConfirm" icon="el-icon-circle-check">确定</el-button>
+        <el-button @click="onCancel" icon="el-icon-circle-close">取消</el-button>
+        </div>
+      </template>
     </el-dialog>
   </basic-container>
 </template>
@@ -76,6 +80,7 @@
 export default {
   data() {
     return {
+      loadingForm:false,
       file: '',
       rules: {
         device_name: [{ required: true, message: '请输入设备名称', trigger: 'blur' }],
@@ -86,7 +91,7 @@
       firmwareUploadBox: false,
       form: {},
       query: {},
-      workspaceId: '',
+      workspaceId: '4a574d68-4ad3-48f7-9f16-3edbcd8056e1',
       deviceName: '',
       loading: true,
       page: {
@@ -98,12 +103,12 @@
       option: {
         lazy: true,
         tree: true,
-        height: 'atuo',
-        calcHeight: 32,
         dialogWidth: 950,
         tip: false,
         searchShow: true,
-        searchMenuSpan: 6,
+        searchGutter: 30,
+        searchMenuPosition: 'left',
+        searchMenuSpan: 4,
         border: true,
         index: true,
         viewBtn: true,
@@ -112,11 +117,13 @@
         excelBtn: false,
         dialogClickModal: false,
         grid: false,
+
+        height: 'auto',
+        calcHeight: 20,
         column: [
           {
             label: '设备名称',
             prop: 'device_name',
-            editDisabled: true,
             // search: true,
             // searchSpan: 5,
             labelWidth: 130,
@@ -131,12 +138,12 @@
             ],
           },
           {
-            label: '固件文件名称',
+            label: '文件名称',
             prop: 'file_name',
             labelWidth: 130,
             search: true,
-            searchSpan: 8,
-            searchLabelWidth: 120,
+            searchSpan: 4,
+            // searchLabelWidth: 120,
             editDisabled: true,
             rules: [
               {
@@ -151,6 +158,7 @@
             prop: 'file_size',
             addDisplay: false,
             editDisabled: true,
+            hide:true,
             labelWidth: 130,
             rules: [
               {
@@ -218,6 +226,32 @@
               },
             ],
           },
+          {
+            label: '上传状态',
+            prop: 'upload_status',
+            addDisplay: false,
+            editDisplay: false,
+            labelWidth: 130,
+            type: 'select',
+            width: 100,
+            dicData: [
+              {
+                label: '上传中或者上传失败',
+                value: 1,
+              },
+              {
+                label: '上传成功',
+                value: 2,
+              },
+            ],
+            rules: [
+              {
+                required: true,
+                message: '请输入在线状态',
+                trigger: 'blur',
+              },
+            ],
+          },
         ],
       },
       data: [],
@@ -258,11 +292,12 @@
           formDatas.append('deviceName', that.importForm.device_name);
           formDatas.append('releaseNote', that.importForm.release_note);
           formDatas.append('status', that.importForm.status);
-          this.loading = true;
+          this.loadingForm = true;
           // 提交
           upload(this.workspaceId, formDatas).then(res => {
-            this.loading = false;
+            this.loadingForm = false;
             this.firmwareUploadBox = false;
+            that.importForm = {}
             this.onLoad(this.page);
             this.$message({
               type: 'success',
@@ -286,7 +321,8 @@
     },
     // 初始化数据
     init(data) {
-      this.workspaceId = data.workspace_id;
+      // this.workspaceId = data.workspace_id;
+      this.workspaceId = '4a574d68-4ad3-48f7-9f16-3edbcd8056e1';
       this.deviceName = data.device_name;
       this.onLoad(this.page);
     },
@@ -377,7 +413,7 @@
     onLoad(page, params = {}) {
       params['device_name'] = this.deviceName;
       this.loading = true;
-      getDeviceFirmwareList(page.currentPage, page.pageSize, this.workspaceId, params).then(res => {
+      getDeviceFirmwareList(page.currentPage, page.pageSize, params).then(res => {
         const data = res.data.data;
         this.page.total = data.total;
         this.data = data.records;
@@ -399,3 +435,8 @@
   /* color: aqua; */
 }
 </style>
+<style scoped lang="scss">
+.upload-demo {
+  height: 30px;
+}
+</style>

--
Gitblit v1.9.3