index.vue 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. <template lang="html">
  2. <div id="certificate">
  3. <span style="padding:1rem;font-size:25px ">凭证管理</span>
  4. <el-row style="padding:2rem;">
  5. <el-col :span="12">
  6. <el-input placeholder="请输入需查询用户信息" v-model="input">
  7. <el-select v-model="value" slot="prepend" multiple placeholder="请选择查询凭证方式" style="width: 224px;">
  8. <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value"> </el-option>
  9. </el-select>
  10. <el-button slot="append" icon="el-icon-search"></el-button>
  11. </el-input>
  12. </el-col>
  13. </el-row>
  14. <el-row style="padding:2rem;">
  15. <el-table :data="tableData" style="width: 100%" border>
  16. <el-table-column align="center" prop="user" label="用户" width="200"> </el-table-column>
  17. <el-table-column align="center" prop="word" label="口令"> </el-table-column>
  18. <el-table-column align="center" prop="certificate" label="证书"> </el-table-column>
  19. <el-table-column align="center" prop="fingerprint" label="指纹"> </el-table-column>
  20. <el-table-column align="center" prop="state" label="状态">
  21. <template v-slot="scope">
  22. {{ scope.row.state === '0' ? '冻结' : '使用中' }}
  23. </template>
  24. </el-table-column>
  25. <el-table-column align="center" label="操作" width="300">
  26. <template v-slot="scope">
  27. <el-button icon="el-icon-edit" @click="dialogFormVisible = true">修改</el-button>
  28. <el-button v-if="scope.row.state == 1" type="danger" icon="el-icon-delete" @click="open1(scope.$index)">注销</el-button>
  29. <el-button v-if="scope.row.state == 0" type="success" icon="el-icon-setting" @click="open2(scope.$index)">恢复</el-button>
  30. </template>
  31. </el-table-column>
  32. </el-table>
  33. </el-row>
  34. <el-dialog title="修改信息" :visible.sync="dialogFormVisible" width="25%">
  35. <el-form :model="form">
  36. <el-form-item label="凭证方式">
  37. <el-select v-model="form.way" placeholder="请选择凭证方式">
  38. <el-option label="口令" value="1"></el-option>
  39. <el-option label="证书" value="2"></el-option>
  40. <el-option label="指纹" value="3"></el-option>
  41. </el-select>
  42. </el-form-item>
  43. </el-form>
  44. <div v-if="form.way == 1">
  45. <el-row :span="24" style="margin-top: 15px;">
  46. 请输入旧密码:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<el-input v-model="input1" style="width:70%" type="password"></el-input>
  47. </el-row>
  48. <el-row :span="24" style="margin-top: 15px;">
  49. 请输入新密码:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<el-input v-model="input2" style="width:70%" type="password"></el-input>
  50. </el-row>
  51. <el-row :span="24" style="margin-top: 15px;">请重新输入新密码:&nbsp;<el-input v-model="input3" style="width:70%" type="password"></el-input></el-row>
  52. </div>
  53. <div v-if="form.way == 2"><span>请重新验证证书</span></div>
  54. <div v-if="form.way == 3"><span>请将手指放置在仪器上,并录入指纹</span></div>
  55. <div slot="footer" class="dialog-footer">
  56. <el-button @click="dialogFormVisible = false">取 消</el-button>
  57. <el-button type="primary" @click="dialogFormVisible = false">确 定</el-button>
  58. </div>
  59. </el-dialog>
  60. </div>
  61. </template>
  62. <script>
  63. import { log } from 'util';
  64. export default {
  65. name: 'certificate',
  66. props: {},
  67. components: {},
  68. data: () => ({
  69. options: [
  70. {
  71. value: '选项1',
  72. label: '指纹',
  73. },
  74. {
  75. value: '选项2',
  76. label: '口令',
  77. },
  78. {
  79. value: '选项3',
  80. label: '证书',
  81. },
  82. ],
  83. tableData: [
  84. {
  85. user: 'Zedc',
  86. word: '******',
  87. certificate: '已认证',
  88. fingerprint: '未录入',
  89. state: '1',
  90. },
  91. {
  92. user: 'Abc',
  93. word: '******',
  94. certificate: '未认证',
  95. fingerprint: '未录入',
  96. state: '0',
  97. },
  98. {
  99. user: 'aBc',
  100. word: '******',
  101. certificate: '已认证',
  102. fingerprint: '已录入',
  103. state: '0',
  104. },
  105. {
  106. user: 'abC',
  107. word: '******',
  108. certificate: '未认证',
  109. fingerprint: '已录入',
  110. state: '1',
  111. },
  112. ],
  113. input: '',
  114. input1: '',
  115. input2: '',
  116. input3: '',
  117. value: [],
  118. dialogFormVisible: false,
  119. form: {
  120. way: '',
  121. },
  122. formLabelWidth: '120px',
  123. }),
  124. created() {},
  125. computed: {},
  126. methods: {
  127. open1(num) {
  128. console.log(num);
  129. this.$confirm('确认注销此用户吗?', '提示', {
  130. confirmButtonText: '确定',
  131. cancelButtonText: '取消',
  132. type: 'warning',
  133. })
  134. .then(() => {
  135. this.$set(this.tableData[num], `state`, '0');
  136. this.$message({
  137. type: 'success',
  138. message: '注销成功!',
  139. });
  140. })
  141. .catch(() => {
  142. this.$message({
  143. type: 'info',
  144. message: '已取消',
  145. });
  146. });
  147. },
  148. open2(num) {
  149. console.log(num);
  150. this.$confirm('确认恢复此用户吗?', '提示', {
  151. confirmButtonText: '确定',
  152. cancelButtonText: '取消',
  153. type: 'warning',
  154. })
  155. .then(() => {
  156. this.$set(this.tableData[num], `state`, '1');
  157. this.$message({
  158. type: 'success',
  159. message: '恢复成功!',
  160. });
  161. })
  162. .catch(() => {
  163. this.$message({
  164. type: 'info',
  165. message: '已取消',
  166. });
  167. });
  168. },
  169. },
  170. };
  171. </script>
  172. <style lang="scss" scoped></style>