lusa %!s(int64=3) %!d(string=hai) anos
pai
achega
2d81be0b1a
Modificáronse 4 ficheiros con 516 adicións e 467 borrados
  1. 17 17
      src/router/index.js
  2. 21 4
      src/views/EventLogs.vue
  3. 1 1
      src/views/FRUInfo.vue
  4. 477 445
      src/views/UploadProgre.vue

+ 17 - 17
src/router/index.js

@@ -101,23 +101,23 @@ router.beforeEach(async (to, from, next) => {
 
 
     let title = to.name ? to.name : '领存BMC'
-    // console.log("/login" == to.path)
-    // if("/login" == to.path) {
-    //     next()
-    //     return
-    // }
-    // let res = await api.Get('/action/checkLoginStatus',{})
-    // if(res.code == 200 && res.data.loginStatus == 'ok'){
-    //     next()
-    //     return
-    // }
-    // next({
-    //     path:'/login',
-    //     query:{
-    //         redirect: to.path
-    //     }
-    // })
-    next();
+    console.log("/login" == to.path)
+    if("/login" == to.path) {
+        next()
+        return
+    }
+    let res = await api.Get('/action/checkLoginStatus',{})
+    if(res.code == 200 && res.data.loginStatus == 'ok'){
+        next()
+        return
+    }
+    next({
+        path:'/login',
+        query:{
+            redirect: to.path
+        }
+    })
+    // next();
 })
 // // 跳转后返回顶部
 // router.afterEach((to, from, next) => {

+ 21 - 4
src/views/EventLogs.vue

@@ -22,7 +22,7 @@
           <span>{{ month +'/'+year }}</span>
         </TimelineItem>
         <template v-for="(item, index) in data">
-          <TimelineItem>
+          <TimelineItem >
             <Icon
               slot="dot"
               type="ios-navigate"
@@ -33,7 +33,13 @@
               class="log-event"
             >
               <p style="color:#333">
-                ID:{{ item.RecordID }} {{ getTimeStamp(item.TimeStamp).substring(6,10) == "1970" ? 'Pre-init Timestamp':getTimeStamp(item.TimeStamp) }} 名称:{{ item.SensorName }}  类型:{{ item.sensortype }} 描述:{{ item.eventdesc }}
+                  <template v-if="item.hasOwnProperty('RecordID')">
+                      ID:{{ item.RecordID }} {{ getTimeStamp(item.TimeStamp).substring(6,10) == "1970" ? 'Pre-init Timestamp':getTimeStamp(item.TimeStamp) }} 名称:{{ item.SensorName }}  类型:{{ item.sensortype }} 描述:{{ item.eventdesc }}
+                  </template>
+                  <template v-else>
+                        没有数据, 请稍后再试
+                  </template>
+
               </p>
             </Card>
           </TimelineItem>
@@ -216,10 +222,21 @@ export default {
         filterByData(data){
         	let eventtype = 0;
 			 data.forEach(item =>{
+                 item.RecordID     = item.D1
+                 item.RecordType   = item.D2
+                 item.TimeStamp= item.D3
+                 item.GenID1   = item.D4
+                 item.GenID2   = item.D5
+                 item.EvmRev   = item.D6
+                 item.SensorType   = item.D7
+                 item.EventDirType = item.D8
+                 item.EventData1   = item.D9
+                 item.EventData2   = item.D10
+                 item.EventData3   = item.D11
+                 item.SensorName   = item.D12
 				if(this.formItem.lowGraveErr != 0){
-					if (item.RecordType >= 0x0 && 
+				    if (item.RecordType >= 0x0 &&
 						item.RecordType <= 0xBF) {
-					
 						eventtype = 0;
 						if (this.formItem.lowGraveErr != 1) {
 							if (this.getbits(item.GenID1, 0, 0) == 1) {

+ 1 - 1
src/views/FRUInfo.vue

@@ -11,7 +11,7 @@
                             <Icon type="ios-easel"  :color="mainColor"/>
                             机箱信息
                         </p>
-                        <p>机箱类型:{{data.type}}</p>
+                        <p>机箱类型:{{data.Type}}</p>
                         <p>机箱编号:{{data.PN}}</p>
                         <p>机箱序号:{{data.SN}}</p>
                         <p>其它信息:{{data.OEM}}</p>

+ 477 - 445
src/views/UploadProgre.vue

@@ -1,470 +1,502 @@
 <template>
-  <div
-    class="dashboard_box set-pro"
-    style="width: 1180px;margin: auto;"
-  >
-    <Title
-      title="固件更新"
-      desc=""
-    />
     <div
-      class="subSection"
-      style="width:100%"
+            class="dashboard_box set-pro"
+            style="width: 1180px;margin: auto;"
     >
-      <!-- <p> <Button @click='userModel = true' type="primary">新增用户</Button></p> -->
-      <!-- <Table :disabled-hover='true' :row-class-name="rowClassName" :columns="columns" :data="data"></Table> -->
-
-      <!--  <Upload action="/action/uploadTest">
-		        <Button icon="ios-cloud-upload-outline">更新固件</Button>
-		    </Upload> -->
-
-      <Upload
-        multiple
-        type="drag"
-        :show-upload-list="false"
-        accept=".uImage"
-        :before-upload="beforeUpload"
-        :on-progress="onProgress"
-        :on-success="success"
-        :on-error="upErrorFn"
-        :on-format-error="onFormatError"
-        action="/action/uploadFirmware"
-      >
-        <div style="padding: 20px 0">
-          <Icon
-            type="ios-cloud-upload"
-            size="52"
-            style="color: #3399ff"
-          />
-          <p style="text-align:center;margin-top:20px">
-            点击或者拖拽固件进行更新
-          </p>
-        </div>
-      </Upload>
-    </div>
-		
-    <Modal
-      v-model="uploadModel"
-      :transfer="false"
-      :width="900"
-      :footer-hide="true"
-      :mask-closable="false"
-      :closable="false"
-      :title="title"
-    >
-      <Spin>
-        <Icon
-          type="ios-loading"
-          size="18"
-          class="demo-spin-icon-load"
-        />
-        <div>{{ status }}</div>
-      </Spin>
-      <Spin
-        v-show="checkEvn"
-        fix
-      >
-        <Icon
-          type="ios-loading"
-          size="18"
-          class="demo-spin-icon-load"
-        />
-        <div>正在检查更新需要的环境,请稍后...</div>
-      </Spin>
-
-      <Steps
-        style="margin-top:20px"
-        :current="step"
-      >
-        <Step
-          title="检查更新"
-          content=""
+        <Title
+                title="固件更新"
+                desc=""
         />
-        <Step
-          title="上传固件"
-          content=""
-        />
-        <Step
-          title="更新Flash"
-          content=""
-        />
-        <Step
-          title="重启BMC"
-          content=""
-        />
-      </Steps>
-      <Scroll style="margin-top:20px">
-        <Card
-          v-show="step >= 0"
-          dis-hover
-          style="margin: 1px 10px"
-        >
-          环境检查OK
-        </Card>
-        <Card
-          v-show="step >= 1"
-          dis-hover
-          style="margin: 1px 10px"
-        >
-          文件开始上传
-        </Card>
-        <Card
-          v-show="step >= 1"
-          dis-hover
-          style="margin: 1px 10px"
+        <div
+                class="subSection"
+                style="width:100%"
         >
-          文件名:{{ fileData.fileName }}
-        </Card>
-        <Card
-          v-show="step >= 1"
-          dis-hover
-          style="margin: 1px 10px"
-        >
-          文件名:{{ fileData.fileSize }} 字节
-        </Card>
-        <Card
-          v-show="step >= 1"
-          dis-hover
-          style="margin: 1px 10px"
-        >
-          文件上传:{{ fileData.uploadPer }}%
-          <Progress
-            :percent="fileData.uploadPer"
-            :stroke-width="5"
-          />
-        </Card>
-
-        <Card
-          v-show="step >= 1 && fileData.uploadPer == 100"
-          dis-hover
-          style="margin: 1px 10px"
-        >
-          上传成功!
-        </Card>
-        <Card
-          v-show="step >= 1 && upError"
-          dis-hover
-          style="margin: 1px 10px"
-        >
-          <Tag color="error">
-            上传失败:{{ errorMsg }}
-          </Tag>
-          <p style="color:#ed4014">
-            上传失败:{{ errorMsg }}
-          </p>
-        </Card>
-
-          <Card
-                  v-show="eraseing > 0"
-                  dis-hover
-                  style="margin: 1px 10px"
-          >
-              {{eraseing == 1 ? '正在擦除...' : '擦除完毕'}} <spin v-show="eraseing == 1"></spin>
-          </Card>
-
-          <Card
-          v-show="step >= 2"
-          dis-hover
-          style="margin: 1px 10px"
-        >
-          开始更新Flash
-        </Card>
+            <!-- <p> <Button @click='userModel = true' type="primary">新增用户</Button></p> -->
+            <!-- <Table :disabled-hover='true' :row-class-name="rowClassName" :columns="columns" :data="data"></Table> -->
 
+            <!--  <Upload action="/action/uploadTest">
+                      <Button icon="ios-cloud-upload-outline">更新固件</Button>
+                  </Upload> -->
 
-        <Card
-          v-show="step >= 2"
-          dis-hover
-          style="margin: 1px 10px"
-        >
-          更新Flash:{{ updatePer }}%
-          <Progress
-            :percent="updatePer"
-            :stroke-width="5"
-          />
-        </Card>
-        <Card
-          v-show="step >= 3 && updateError"
-          dis-hover
-          style="margin: 1px 10px"
-        >
-          更新异常,请刷新页面重新上传固件更新
-        </Card>
-
-          <Card
-                  v-show="updatePer == 100 && !updateError"
-                  dis-hover
-                  style="margin: 1px 10px"
-          >
-              正在校验flash...
-          </Card>
-
-          <Card
-                  v-show="verifyStatus > 0"
-                  dis-hover
-                  style="margin: 1px 10px"
-          >
-              {{eraseing == 1 ? ' 正在校验flash...' : '校验完毕'}} <spin v-show="verifyStatus == 1"></spin>
-          </Card>
-
-
-        <Card
-          v-show="updatePer == 100 && !updateError"
-          dis-hover
-          style="margin: 1px 10px"
-        >
-          更新Flash完成
-        </Card>
-        <Card
-          v-show="step >= 3"
-          dis-hover
-          style="margin: 1px 10px"
+            <Upload
+                    multiple
+                    type="drag"
+                    :show-upload-list="false"
+                    accept=".uImage"
+                    :before-upload="beforeUpload"
+                    :on-progress="onProgress"
+                    :on-success="success"
+                    :on-error="upErrorFn"
+                    :on-format-error="onFormatError"
+                    action="/action/uploadFirmware"
+            >
+                <div style="padding: 20px 0">
+                    <Icon
+                            type="ios-cloud-upload"
+                            size="52"
+                            style="color: #3399ff"
+                    />
+                    <p style="text-align:center;margin-top:20px">
+                        点击或者拖拽固件进行更新
+                    </p>
+                </div>
+            </Upload>
+        </div>
+
+        <Modal
+                v-model="uploadModel"
+                :transfer="false"
+                :width="900"
+                :footer-hide="true"
+                :mask-closable="false"
+                :closable="false"
+                :title="title"
         >
-          正在重启BMC。。。
-        </Card>
-        <!--  <Card dis-hover v-for="(item, index) in data" :key="index" style="margin: 10px 0">
-			             item
-			        </Card> -->
-      </Scroll>
-    </Modal>
-  </div>
+            <Spin>
+                <Icon
+                        type="ios-loading"
+                        size="18"
+                        class="demo-spin-icon-load"
+                />
+                <div>{{ status }}</div>
+            </Spin>
+            <Spin
+                    v-show="checkEvn"
+                    fix
+            >
+                <Icon
+                        type="ios-loading"
+                        size="18"
+                        class="demo-spin-icon-load"
+                />
+                <div>正在检查更新需要的环境,请稍后...</div>
+            </Spin>
+
+            <Steps
+                    style="margin-top:20px"
+                    :current="step"
+            >
+                <Step
+                        title="检查更新"
+                        content=""
+                />
+                <Step
+                        title="上传固件"
+                        content=""
+                />
+                <Step
+                        title="更新Flash"
+                        content=""
+                />
+                <Step
+                        title="重启BMC"
+                        content=""
+                />
+            </Steps>
+            <Scroll style="margin-top:20px">
+
+                <Card
+                        v-show="step >= 3"
+                        dis-hover
+                        style="margin: 1px 10px"
+                >
+                    正在重启BMC。大约需要2分钟,请关闭网页后重新登录。
+                </Card>
+
+
+                <Card
+                        v-show="updatePer == 100 && !updateError"
+                        dis-hover
+                        style="margin: 1px 10px"
+                >
+                    更新Flash完成
+                </Card>
+
+                <Card
+                        v-show="verifyStatus > 0"
+                        dis-hover
+                        style="margin: 1px 10px"
+                >
+                    {{eraseing == 1 ? ' 正在校验flash...' : '校验完毕'}}
+                    <spin v-show="verifyStatus == 1"></spin>
+                </Card>
+
+                <Card
+                        v-show="updatePer == 100 && !updateError"
+                        dis-hover
+                        style="margin: 1px 10px"
+                >
+                    正在校验flash...
+                </Card>
+                <Card
+                        v-show="step >= 3 && updateError"
+                        dis-hover
+                        style="margin: 1px 10px"
+                >
+                    更新异常,请刷新页面重新上传固件更新
+                </Card>
+
+                <Card
+                        v-show="updateFlashStatusProcess == 1"
+                        dis-hover
+                        style="margin: 1px 10px"
+                >
+                    更新Flash:{{ updatePer }}%
+                    <Progress
+                            :percent="updatePer"
+                            :stroke-width="5"
+                    />
+                </Card>
+
+                <Card
+                        v-show="eraseing > 0"
+                        dis-hover
+                        style="margin: 1px 10px"
+                >
+                    {{eraseing == 1 ? '正在擦除...' : '擦除完毕'}}
+                    <spin v-show="eraseing == 1"></spin>
+                </Card>
+
+                <Card
+                        v-show="updateFlashStatus == 1"
+                        dis-hover
+                        style="margin: 1px 10px"
+                >
+                    开始更新Flash
+                </Card>
+
+
+                <Card
+                        v-show="step >= 1 && upError"
+                        dis-hover
+                        style="margin: 1px 10px"
+                >
+                    <Tag color="error">
+                        上传失败:{{ errorMsg }}
+                    </Tag>
+                    <p style="color:#ed4014">
+                        上传失败:{{ errorMsg }}
+                    </p>
+                </Card>
+
+
+                <Card
+                        v-show="step >= 1 && fileData.uploadPer == 100"
+                        dis-hover
+                        style="margin: 1px 10px"
+                >
+                    上传成功!
+                </Card>
+
+
+                <Card
+                        v-show="step >= 1"
+                        dis-hover
+                        style="margin: 1px 10px"
+                >
+                    文件上传:{{ fileData.uploadPer }}%
+                    <Progress
+                            :percent="fileData.uploadPer"
+                            :stroke-width="5"
+                    />
+                </Card>
+
+                <Card
+                        v-show="step >= 1"
+                        dis-hover
+                        style="margin: 1px 10px"
+                >
+                    文件名:{{ fileData.fileSize }} 字节
+                </Card>
+
+                <Card
+                        v-show="step >= 1"
+                        dis-hover
+                        style="margin: 1px 10px"
+                >
+                    文件名:{{ fileData.fileName }}
+                </Card>
+
+
+                <Card
+                        v-show="step >= 1"
+                        dis-hover
+                        style="margin: 1px 10px"
+                >
+                    文件开始上传
+                </Card>
+
+                <Card
+                        v-show="step >= 0"
+                        dis-hover
+                        style="margin: 1px 10px"
+                >
+                    环境检查OK
+                </Card>
+                <!--  <Card dis-hover v-for="(item, index) in data" :key="index" style="margin: 10px 0">
+                                 item
+                            </Card> -->
+            </Scroll>
+        </Modal>
+    </div>
 </template>
 <script>
-	import Title from '@/components/title'
-	import api from '../api/'
-    let $ = function(className){
-	    return document.getElementsByClassName(className);
+    import Title from '@/components/title'
+    import api from '../api/'
+
+    let $ = function (className) {
+        return document.getElementsByClassName(className)
     }
-export default {
-	name: 'UploadProgre',
-	components:{Title},
-	data() {
-		return {
-			step:0,
-			title:'更新固件(更新过程中请勿关闭浏览器和电源)',
-			uploadModel:false,
-			data: [],
-			loading: true,
-		    loadingStatus: false,
-		    md5code:null,
-		    fileData:{
-		    	uploadPer:12.3,
-		    	fileName:'',
-		    	fileSize:12354
-		    },
-		    status:'上传中...',
-		    checkEvn:false,
-		    interval: null,
-		    updatePer:0,
-		    upError:false,
-		    errorMsg:'',
-		    updateError: false,
-            eraseing: 0, //0,表示未进入1表示正在擦除  2 表示擦除完毕
-            verifyStatus: 0
-		}
-	},
-	
-	created() {
-	},
-	updated: function updated() {
-		this.resetScoll();
-	},
-
-	mounted(){
-		this.resetScoll();
-	},
-	methods: {
-		//kill所有进程
-		prepareDevice(){
-			this.checkEvn = true
-			this.step = 1
-			return new Promise((resolve, reject)=>{
-        		api.Get("/action/prepareDevice", {}).then((res)=>{
-        			this.checkEvn = false
-        			console.log(res.data)
-                	if(res.code==200){
-						resolve()
-                	}
-                	reject()
-                	
-	            }).catch((err)=>{
-	                console.log(err)
-	                console.log(err.isSuccess)
-	                reject()
-	                this.checkEvn = false
-	            })
-        	})
-		},
-        getEraseStatusFn(){
-            this.status='擦除固件'
-            this.eraseing = 1
-            api.Get("/action/getEraseStatus", {}).then((res)=>{
-                console.log(res,">>>>>>>>>>>>>>>>>")
-                if(res.data == 200 && res.data.Erase){
-                    this.eraseing = 2
-                    this.updateFlash();//擦除后更新固件
-                } else {
-                    setTimeout(this.getEraseStatusFn, 3000)
-                }
+    export default {
+        name: 'UploadProgre',
+        components: {Title},
+        data() {
+            return {
+                step: 0,
+                title: '更新固件(更新过程中请勿关闭浏览器和电源)',
+                uploadModel: false,
+                data: [],
+                loading: true,
+                loadingStatus: false,
+                md5code: null,
+                fileData: {
+                    uploadPer: 12.3,
+                    fileName: '',
+                    fileSize: 12354
+                },
+                status: '上传中...',
+                checkEvn: false,
+                interval: null,
+                updatePer: 0,
+                upError: false,
+                errorMsg: '',
+                updateError: false,
+                eraseing: 0, //0,表示未进入1表示正在擦除  2 表示擦除完毕
+                verifyStatus: 0,
+                updateFlashStatus: 0,
+                updateFlashStatusProcess: 0,
+            }
+        },
 
-            })
+        created() {
         },
-		resetScoll(){
-		    // console.log( $('.ivu-scroll-container'))
-			// this.$nextTick(function() {
-			// 	var div = $('.ivu-scroll-container')[0];
-			// 	div.scrollTop = div.scrollHeight;
-			// });
-		},
-		
-		onProgress(event, file, fileList){
-			console.log(event)
-			// console.log(event.percent)
-			// console.log(file)
-			this.fileData.uploadPer = event.percent
-			// 调用监听 上传进度 的事件
-			  event.target.onprogress = (event) => {
-			  	console.log(file)
-			    let uploadPercent = parseFloat(((event.loaded / event.total) * 100).toFixed(2))	// 保留两位小数,具体根据自己需求做更改
-			 
-			    // 手动设置显示上传进度条 以及上传百分比
-			    // file.showProgress = true
-			    file.percentage = uploadPercent
-			    if(uploadPercent > 95) {
-			    	this.fileData.uploadPer = 98
-			    } else {
-			     	this.fileData.uploadPer = uploadPercent
-			    }
-			}
-
-		},
-		//获取固件更新进度
-		getUpdateProgress(){
-			let self = this
-			function progress(){
-				api.Get("/action/getUpdateProgress", {}).then((res)=>{
-	    			console.log(res.progress == 100)
-	    			console.log(res.progress)
-	    			self.updatePer = Number(res.progress)
-	            	if(res.progress == 100){
-	            		console.log(self.interval)
-	            		self.step = 3
-	            		self.verify();
-	            		window.clearInterval(self.interval)
-	            	}
-            	
-	            }).catch((err)=>{
-	                console.log(err)
-	                console.log(err.isSuccess)
-	                window.clearInterval(self.interval)
-	            })
-        	}
-            this.interval = setInterval(progress, 1000);
-		},
-		verify(){
-			this.verifyStatus = 1
-			api.Get("/action/getVerifyStatus", {}).then((res)=>{
-    			console.log(res.data)
-            	if(res.data.Verify) {
-                    this.verifyStatus = 2
-            		this.resetBmc();
-            	} else {
-            	    setTimeout(this.verify, 3000)
-                }
-            }).catch((err)=>{
-                console.log(err)
-                console.log(err.isSuccess)
-
-            })
-		},
-		//重启BMC
-		resetBmc(){
-			this.status='重启BMC'
-			console.log(">>>>>>>>>>>>>>>>")
-			api.Get("/action/resetBmc", {}).then((res)=>{
-    			console.log(res.data)
-            	if(res.code==200){
-
-            	}
-            	
-            }).catch((err)=>{
-                console.log(err)
-                console.log(err.isSuccess)
-            })
-		},
-		//烧录固件
-		updateFlash(){
-			this.status='更新flash'
-			this.step = 2
-			api.Get("/action/updateFlash", {}).then((res)=>{
-    			console.log(res.data)
-            	if(res.code == 200){
-					this.getUpdateProgress()
-            	}
-            	
-            }).catch((err)=>{
-                console.log(err)
-                console.log(err.isSuccess)
-            })
-		},
-		success(response, file, fileList){
-			this.fileData.uploadPer = 100
-			console.log(response)
-
-			if(response.code==200){
-				console.log(">>>>>>>>>>>>>")
-				// this.updateFlash();
-                //上传完成后先擦除旧固件
-                this.getEraseStatusFn();
-
-        	}
-			// this.uploadModel=false
-		},
-        beforeUpload(file){
-        	console.log(file)
-        	this.fileData={
-		    	fileName:file.name,
-		    	fileSize:file.size,
-		    	uploadPer:0
-		    }
-		    this.uploadModel=true
-		    return this.prepareDevice();
+        updated() {
+            // this.resetScoll()
         },
-        upErrorFn(error){
-        	this.upError = true
-        	this.errorMsg = '链接异常,请刷新后重新上传'
+
+        mounted() {
+            // this.resetScoll()
         },
-        onFormatError(){
-        	this.$Message.error('上传文件错误,请检查镜像文件格式。')
+        methods: {
+            //kill所有进程
+            prepareDevice() {
+                this.checkEvn = true
+                this.step = 1
+                return new Promise((resolve, reject) => {
+                    api.Get("/action/prepareDevice", {}).then((res) => {
+                        this.checkEvn = false
+                        console.log(res.data)
+                        if (res.code == 200) {
+                            resolve()
+                        }
+                        reject()
+
+                    }).catch((err) => {
+                        console.log(err)
+                        console.log(err.isSuccess)
+                        reject()
+                        this.checkEvn = false
+                    })
+                })
+            },
+            getEraseStatusFn() {
+                this.status = '擦除固件'
+                this.eraseing = 1
+                api.Get("/action/getEraseStatus", {}).then((res) => {
+                    console.log(res, ">>>>>>>>>>>>>>>>>")
+                    if (res.Erase) {
+                        this.eraseing = 2
+                        this.getUpdateProgress()//擦除后更新固件
+                    } else {
+                        setTimeout(this.getEraseStatusFn, 3000)
+                    }
+
+                })
+            },
+            resetScoll() {
+                console.log($('.ivu-scroll-container'))
+                this.$nextTick(function () {
+                    var div = $('.ivu-scroll-container')[0]
+                    div.scrollTop = div.scrollHeight
+                })
+            },
+
+            onProgress(event, file, fileList) {
+                this.status = '上传固件'
+                console.log(event)
+                // console.log(event.percent)
+                // console.log(file)
+                this.fileData.uploadPer = event.percent
+                // 调用监听 上传进度 的事件
+                event.target.onprogress = (event) => {
+
+                    let uploadPercent = parseFloat(((event.loaded / event.total) * 100).toFixed(2))	// 保留两位小数,具体根据自己需求做更改
+                    console.log(uploadPercent)
+                    // 手动设置显示上传进度条 以及上传百分比
+                    // file.showProgress = true
+                    file.percentage = uploadPercent
+                    if (uploadPercent > 95) {
+                        this.fileData.uploadPer = 98
+                    } else {
+                        this.fileData.uploadPer = uploadPercent
+                    }
+                }
+
+            },
+            //获取固件更新进度
+            getUpdateProgress() {
+                let self = this
+                this.updateFlashStatusProcess = 1
+                this.status = '更新固件'
+                function progress() {
+                    api.Get("/action/getUpdateProgress", {}).then((res) => {
+                        console.log(res.progress == 100)
+                        console.log(res.progress)
+                        self.updatePer = Number(res.progress)
+                        if (res.progress == 100) {
+                            console.log(self.interval)
+                            self.step = 3
+                            self.verify()
+                            window.clearInterval(self.interval)
+                        }
+
+                    }).catch((err) => {
+                        console.log(err)
+                        console.log(err.isSuccess)
+                        window.clearInterval(self.interval)
+                    })
+                }
+
+                this.interval = setInterval(progress, 2000)
+            },
+            verify() {
+                this.status = '验证固件'
+                this.verifyStatus = 1
+                api.Get("/action/getVerifyStatus", {}).then((res) => {
+                    console.log(res.data)
+                    if (res.verify == 1) {
+                        this.verifyStatus = 2
+                        this.resetBmc()
+                    } else {
+                        setTimeout(this.verify, 3000)
+                    }
+                }).catch((err) => {
+                    console.log(err)
+                    console.log(err.isSuccess)
+
+                })
+            },
+            //重启BMC
+            resetBmc() {
+                this.status = '重启BMC'
+                console.log(">>>>>>>>>>>>>>>>")
+                api.Get("/action/resetBmc", {}).then((res) => {
+                    console.log(res.data)
+                    if (res.code == 200) {
+
+                    }
+
+                }).catch((err) => {
+                    console.log(err)
+                    console.log(err.isSuccess)
+                })
+            },
+            //烧录固件
+            updateFlash() {
+                this.status = '更新flash'
+                this.step = 2
+                this.updateFlashStatus = 1
+                api.Get("/action/updateFlash", {}).then((res) => {
+                    console.log(res.data)
+                    if (res.code == 200) {
+                        //上传完成后先擦除旧固件
+                        this.getEraseStatusFn()
+                        // this.getUpdateProgress()
+                    }
+
+                }).catch((err) => {
+                    console.log(err)
+                    console.log(err.isSuccess)
+                })
+            },
+            success(response, file, fileList) {
+                this.fileData.uploadPer = 100
+                console.log(response)
+
+                if (response.code == 200) {
+                    console.log(">>>>>>>>>>>>>")
+                    this.updateFlash()
+                }
+                // this.uploadModel=false
+            },
+            beforeUpload(file) {
+                console.log(file)
+                this.fileData = {
+                    fileName: file.name,
+                    fileSize: file.size,
+                    uploadPer: 0
+                }
+                this.uploadModel = true
+                return this.prepareDevice()
+            },
+            upErrorFn(error) {
+                this.upError = true
+                this.errorMsg = '链接异常,请刷新后重新上传'
+            },
+            onFormatError() {
+                this.$Message.error('上传文件错误,请检查镜像文件格式。')
+            }
+
         }
-		
-	}
-}
+    }
 </script>
 <style lang="scss" scoped>
-input {
-	margin: 0;
-}
-.set-pro{
-
-}
-.subSection{
-	padding: 20px;
-	/*margin:0 auto;*/
-	width: 450px;
-	p{
-		margin-bottom:20px;
-		text-align: right;
-	}
-}
-.demo-spin-icon-load{
+    input {
+        margin: 0;
+    }
+
+    .set-pro {
+
+    }
+
+    .subSection {
+        padding: 20px;
+        /*margin:0 auto;*/
+        width: 450px;
+
+        p {
+            margin-bottom: 20px;
+            text-align: right;
+        }
+    }
+
+    .demo-spin-icon-load {
         animation: ani-demo-spin 1s linear infinite;
     }
+
     @keyframes ani-demo-spin {
-        from { transform: rotate(0deg);}
-        50%  { transform: rotate(180deg);}
-        to   { transform: rotate(360deg);}
+        from {
+            transform: rotate(0deg);
+        }
+        50% {
+            transform: rotate(180deg);
+        }
+        to {
+            transform: rotate(360deg);
+        }
     }
-    .demo-spin-col{
+
+    .demo-spin-col {
         height: 100px;
         position: relative;
         border: 1px solid #eee;