long
2021-07-15 eaaa5b7839f08ddae008bd9fba3fa432b689b9af
src/pages/system/admin.vue
@@ -9,6 +9,7 @@
          clearable
          size="small"
          style="width: 240px"
          maxlength="50"
          @keyup.enter.native="reGetList"
        />
      </el-form-item>
@@ -40,7 +41,7 @@
      <el-table-column label="账号" prop="account" align="center" min-width="120" />
      <el-table-column label="账号类型" prop="account" align="center" min-width="120">
        <template slot-scope="scope">
          <span v-if="scope.row.type">{{ accountTypeOptions[scope.row.type].name }}</span>
          {{ accountTypeOptions.find(item=>item.id == scope.row.type) ? accountTypeOptions.find(item=>item.id == scope.row.type).name : '' }}
        </template>
      </el-table-column>
      <el-table-column label="角色" prop="roleName" align="center" min-width="120" />
@@ -48,6 +49,7 @@
      <el-table-column label="状态" align="center" min-width="100">
        <template slot-scope="scope">
          <el-switch
            v-if="scope.row.type!=0"
            v-model="scope.row.isUse"
            :active-value="1"
            :inactive-value="0"
@@ -66,7 +68,7 @@
            @click="showEditAdminDialog(scope.row)"
          >编辑</el-button>
          <el-button
            v-if="getAuthValueFN('sys_admin_del')"
            v-if="getAuthValueFN('sys_admin_del') && scope.row.type!=0"
            size="mini"
            type="text warn"
            icon="el-icon-delete"
@@ -85,19 +87,19 @@
    />
    <!-- 新增&编辑 -->
    <el-dialog :title="adminDialogData.type=='add'?'新增管理员':'编辑管理员'" width="500px" :visible.sync="adminDialogVisible" append-to-body :before-close="hideDialog">
    <el-dialog v-el-drag-dialog :title="adminDialogData.type==='add'?'新增管理员':'编辑管理员'" width="500px" :visible.sync="adminDialogVisible" append-to-body :close-on-click-modal="false">
      <el-form ref="adminDialog" :model="adminDialogData" label-width="80px" :rules="rules" size="small">
        <el-form-item label="名称" prop="name">
          <el-input v-model="adminDialogData.name" placeholder="请输入名称" />
          <el-input v-model="adminDialogData.name" placeholder="请输入名称" maxlength="50" />
        </el-form-item>
        <el-form-item label="账号" prop="account">
          <el-input v-model="adminDialogData.account" placeholder="请输入帐号" :disabled="adminDialogData.type!='add'" />
          <el-input v-model="adminDialogData.account" placeholder="请输入帐号" maxlength="20" :disabled="adminDialogData.type!='add'" />
        </el-form-item>
        <el-form-item label="密码" :prop="adminDialogData.type=='add'?'password':''">
          <el-input v-model="adminDialogData.password" type="password" placeholder="请输入密码" />
        <el-form-item label="密码" :prop="adminDialogData.type==='add'||adminDialogData.password||adminDialogData.passwordSure?'password':'none'">
          <el-input v-model="adminDialogData.password" type="password" placeholder="请输入密码" maxlength="20" />
        </el-form-item>
        <el-form-item label="确认密码" :prop="adminDialogData.type=='add'?'passwordSure':''">
          <el-input v-model="adminDialogData.passwordSure" type="password" placeholder="请输入确认密码" />
        <el-form-item label="确认密码" :prop="adminDialogData.type==='add'||adminDialogData.password||adminDialogData.passwordSure?'passwordSure':'none'">
          <el-input v-model="adminDialogData.passwordSure" type="password" placeholder="请输入确认密码" maxlength="20" />
        </el-form-item>
        <!-- 账号类型 -->
        <el-form-item label="账号类型" prop="accountType">
@@ -140,7 +142,6 @@
</template>
<script>
export default {
  name: 'Admin',
  data() {
@@ -183,7 +184,8 @@
          { required: true, message: '账号不能为空', trigger: 'change' }
        ],
        password: [
          { required: true, message: '密码不能为空', trigger: 'change' }
          { required: true, message: '密码不能为空', trigger: 'change' },
          { min: 5, max: 20, message: '密码在5~20个字之间' }
        ],
        passwordSure: [
          { required: true, message: '确认密码不能为空', trigger: 'change' },
@@ -194,6 +196,9 @@
        ],
        accountType: [
          { required: true, message: '账号类型不能为空', trigger: 'change' }
        ],
        isUse: [
          { required: true, message: '是否启用不能为空', trigger: 'change' }
        ]
      }
    }
@@ -219,13 +224,15 @@
        mockData: {
          code: 100,
          msg: '',
          data: [{
            id: 'xxx',
            name: '野马发'
          }]
          data: {
            list: [{
              id: 'xxx',
              name: '野马发'
            }]
          }
        }
      }, (inf) => {
        this.roleArr = inf.list || []
        this.roleArr = inf.list && inf.list.filter(item => item.isUse === 1) || []
      })
    },
@@ -349,9 +356,9 @@
        passwordSure: '',
        sysRoleId: item.roId,
        id: item.id,
        isUse: item.isUse
        isUse: item.isUse,
        accountType: item.type
      }
      if (!item.type + '') adminDialogData.accountType = item.type
      this.adminDialogVisible = true
      this.$nextTick(() => {
        this.adminDialogData = adminDialogData
@@ -392,7 +399,7 @@
          }, () => {
            this.$messageSuc('保存成功')
            this.hideAdminDialog()
            this.getList()
            isAdd ? this.reGetList() : this.getList()
          })
        }
      })