DeleteDataAuthConfirmDialog.vue 3.42 KB
Newer Older
YazhouChen's avatar
YazhouChen committed
1 2 3 4 5 6 7 8 9 10 11
<template>
  <!-- 删除数据用户对话框验证 -->
  <el-dialog
    @close="close"
    @opened="deleteDataAuthConfirmInit"
    v-dialogDrag
    :title="$t('login.authentication')"
    style="font-size: 10px;text-align: center" width='400px'
    :append-to-body='true'
    :visible.sync="DeleteDataAuthConfirmVisible">
    <el-form :model="form" inline="true">
neogcg's avatar
neogcg committed
12
      <p>验证用户身份</p>
YazhouChen's avatar
YazhouChen committed
13 14 15 16 17 18 19 20
      <el-form-item :label="$t('login.account')" :label-width="formLabelWidth" style="margin-bottom: -10px;">
        <el-input size = 'mini' type="text" :placeholder="$t('common.placeholder')" v-model="form.account"  disabled="true" v-on:blur="accountCheck" autocomplete="off"></el-input>
      </el-form-item>
      <el-form-item :label="$t('login.password')" :label-width="formLabelWidth" style="margin-bottom: -10px;">
        <el-input size = 'mini' type="password" :placeholder="$t('common.placeholder')" v-model="form.password"  v-on:blur="passwordCheck" autocomplete="off"></el-input>
      </el-form-item>
    </el-form>
    <div slot="footer" class="dialog-footer">
neogcg's avatar
neogcg committed
21 22
      <el-button class="btnstyle" size = 'mini' type="primary" @click="deleteDataAuthConfirm">{{$t('common.ok')+'删除'}} </el-button>
      <el-button class="btnstyle" size = 'mini' type="primary"  @click="close">{{$t('common.cancel')}}</el-button>
YazhouChen's avatar
YazhouChen committed
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106
    </div>
  </el-dialog>
</template>

<script>
import legitimacyCheck from '@/utils/legitimacyCheck'
import HelperUtil from '@/utils/HelperUtil'
import UserService from '@/domain/services/UserService'
import md5 from 'js-md5'
import {USER_NAME} from '@/utils/constantCollection'

export default {
  props: ['command'],
  data: function () {
    return {
      DeleteDataAuthConfirmVisible: false,
      formLabelWidth: '120px',

      confirmFlag: this.command.target,

      form: {
        account: '',
        password: ''
      }
    }
  },
  methods: {
    // 关闭
    close () {
      this.command.done()
    },

    // 初始化
    deleteDataAuthConfirmInit () {
      this.form.account = window.sessionStorage.getItem(USER_NAME)
      this.form.password = ''
    },

    // 用户验证
    deleteDataAuthConfirm () {
      let _this = this
      if (!_this.passwordCheck()) {
        return
      }
      UserService.checkPwd(md5(this.form.password).toUpperCase()).then((result) => {
        _this.confirmFlag.confirm = true
        _this.close()
      }).catch((err) => {
        _this.confirmFlag.confirm = false
        _this.InfoTip.errorTip(_this, err)
      })
    },

    // 账号非空验证
    accountCheck: function () {
      let switchCheck = legitimacyCheck()
      if (!switchCheck.textNullCheck(this.form.account)) {
        // 输入不可为空
        this.InfoTip.warningTip(this, HelperUtil.getCheckStatusCodeObjectByCode(this.successCode.TEXT_NULL_CODE), this.$t('login.account'))
        return false
      }
      return true
    },

    // 密码非空验证
    passwordCheck: function () {
      let switchCheck = legitimacyCheck()
      if (!switchCheck.textNullCheck(this.form.password)) {
        // 输入不可为空
        this.InfoTip.warningTip(this, HelperUtil.getCheckStatusCodeObjectByCode(this.successCode.TEXT_NULL_CODE), this.$t('login.password'))
        return false
      }
      return true
    }
  },

  created () {
    console.log('删除数据用户验证界面')
  },
  mounted () {
    this.DeleteDataAuthConfirmVisible = true
  }
}
</script>
neogcg's avatar
neogcg committed
107 108 109 110 111 112 113 114
<style scoped>

.btnstyle {
  
  height: 36px;
  width: 106px;
}
</style>