明梦爽
2022-04-17 5529b7077126be368abd444d45ec085d8c7779e3
src/components/Administrator/AdEdit.vue
@@ -1,24 +1,16 @@
<template>
  <div>
    <el-card class="box-card">
      <el-button type="primary" @click="add()" icon="el-icon-circle-plus" class='add'>注册新的管理员账号</el-button>
      <el-button type="primary" @click="add()" icon="el-icon-circle-plus" class="add">注册新的管理员账号</el-button>
      <!-- 新闻表格区域 -->
      <el-table
        :data="tableData"
        border
        style="width: 100%"
        :header-cell-style="{textAlign: 'center'}"
        :cell-style="{ textAlign: 'center' }"
      >
      <el-table :data="tableData" border style="width: 100%" :header-cell-style="{ textAlign: 'center' }" :cell-style="{ textAlign: 'center' }">
        <el-table-column type="index" label="序号" width="50">
          <!-- <template slot-scope="scope">
            <span>{{ (currentPage-1)*pageSize+scope.$index+1 }}</span>
          </template> -->
        </el-table-column>
        <el-table-column prop="username" label="普通管理员账号" width="" >
        </el-table-column>
        <el-table-column prop="id" label="id" width="">
        </el-table-column>
        <el-table-column prop="username" label="普通管理员账号" width=""> </el-table-column>
        <el-table-column prop="id" label="id" width=""> </el-table-column>
        <el-table-column label="操作" width="">
          <template slot-scope="scope">
            <!-- {{ scope.row.id }} -->
@@ -27,16 +19,11 @@
              <el-button type="danger" @click="deleteAds(scope.row.id)" icon="el-icon-delete"></el-button>
            </div>
          </template>
        </el-table-column>
      </el-table>
    </el-card>
    <!-- 修改账户的对话框 -->
    <el-dialog
      title="修改普通管理员密码"
      :visible.sync="editDialogVisible"
      width="50%"
      @close="editClose">
    <el-dialog title="修改普通管理员密码" :visible.sync="editDialogVisible" width="50%" @close="editClose">
      <!-- rules表单验证规则,ref当前表单的验证对象 -->
      <el-form ref="editFormRef" :model="editForm"  label-width="80px" status-icon>
        <el-form-item label="用户名:">
@@ -55,11 +42,7 @@
      </span>
    </el-dialog>
    <!-- 添加管理员对话框 -->
    <el-dialog
      title="添加普通管理员"
      :visible.sync="addDialogVisible"
      width="50%"
      @close="addClose">
    <el-dialog title="添加普通管理员" :visible.sync="addDialogVisible" width="50%" @close="addClose">
      <!-- rules表单验证规则,ref当前表单的验证对象 -->
      <el-form ref="addFormRef" :model="addForm"  label-width="80px" status-icon>
        <el-form-item label="用户名:">
@@ -107,14 +90,14 @@
      this.editDialogVisible = true
    },
    editClose(){
      this.editForm.username = '';
      this.editForm.oldPassword = '';
      this.editForm.password = '';
      this.editForm.username = ''
      this.editForm.oldPassword = ''
      this.editForm.password = ''
    },
    cancel(){
      this.editForm.username = '';
      this.editForm.oldPassword = '';
      this.editForm.password = '';
      this.editForm.username = ''
      this.editForm.oldPassword = ''
      this.editForm.password = ''
      this.editDialogVisible = false
    },
    //编辑确定事件
@@ -147,7 +130,7 @@
      })
      //如果用户点击确定则返回confirm
      //如果用户点击取消则返回cancel
      console.log(res);
      console.log(res)
      if(res !== 'confirm'){
        return this.$message.info('已取消删除~')
      }else{
@@ -172,13 +155,13 @@
    },
    //注册取消清空
    canceladd(){
      this.addForm.username = '';
      this.addForm.password = '';
      this.addForm.username = ''
      this.addForm.password = ''
      this.addDialogVisible = false
    },
    addClose(){
      this.addForm.username = '';
      this.addForm.password = '';
      this.addForm.username = ''
      this.addForm.password = ''
    },
    //注册提交
    addEdit(){
@@ -195,7 +178,6 @@
          this.$message.error('注册失败')
        }
      })
    }
  }
}
@@ -205,5 +187,4 @@
.add{
  margin-bottom: 10px;
}
</style>