LiZedc vor 5 Jahren
Ursprung
Commit
f84234caef
1 geänderte Dateien mit 27 neuen und 5 gelöschten Zeilen
  1. 27 5
      src/views/certificate/index.vue

+ 27 - 5
src/views/certificate/index.vue

@@ -25,7 +25,8 @@
         <el-table-column align="center" label="操作" width="300">
           <template v-slot="scope">
             <el-button icon="el-icon-edit" @click="dialogFormVisible = true">修改</el-button>
-            <el-button type="danger" icon="el-icon-delete" @click="open(scope.$index)">注销</el-button>
+            <el-button v-if="tableData[scope.row].state == 1" type="danger" icon="el-icon-delete" @click="open1(scope.$index)">注销</el-button>
+            <el-button v-if="tableData[scope.row].state == 0" type="danger" icon="el-icon-delete" @click="open2(scope.$index)">恢复</el-button>
           </template>
         </el-table-column>
       </el-table>
@@ -42,12 +43,12 @@
       </el-form>
       <div v-if="form.way == 1">
         <el-row :span="24" style="margin-top: 15px;">
-          请输入旧密码:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<el-input v-model="input1" style="width:70%"></el-input>
+          请输入旧密码:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<el-input v-model="input1" style="width:70%" type="password"></el-input>
         </el-row>
         <el-row :span="24" style="margin-top: 15px;">
-          请输入新密码:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<el-input v-model="input2" style="width:70%"></el-input>
+          请输入新密码:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<el-input v-model="input2" style="width:70%" type="password"></el-input>
         </el-row>
-        <el-row :span="24" style="margin-top: 15px;">请重新输入新密码:&nbsp;<el-input v-model="input3" style="width:70%"></el-input></el-row>
+        <el-row :span="24" style="margin-top: 15px;">请重新输入新密码:&nbsp;<el-input v-model="input3" style="width:70%" type="password"></el-input></el-row>
       </div>
       <div v-if="form.way == 2"><span>请重新验证证书</span></div>
       <div v-if="form.way == 3"><span>请将手指放置在仪器上,并录入指纹</span></div>
@@ -124,7 +125,7 @@ export default {
   created() {},
   computed: {},
   methods: {
-    open(num) {
+    open1(num) {
       console.log(num);
       this.$confirm('确认注销此用户吗?', '提示', {
         confirmButtonText: '确定',
@@ -145,6 +146,27 @@ export default {
           });
         });
     },
+    open2(num) {
+      console.log(num);
+      this.$confirm('确认恢复此用户吗?', '提示', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning',
+      })
+        .then(() => {
+          this.$set(this.tableData[num], `state`, '1');
+          this.$message({
+            type: 'success',
+            message: '恢复成功!',
+          });
+        })
+        .catch(() => {
+          this.$message({
+            type: 'info',
+            message: '已取消',
+          });
+        });
+    },
   },
 };
 </script>