GradingUserManage.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. <template>
  2. <div class="grading-user-manage">
  3. <div class="part-box-top">
  4. <Button type="success" icon="md-add" @click="toAdd">新增</Button>
  5. </div>
  6. <div class="part-box">
  7. <Table
  8. ref="TableList"
  9. :columns="columes"
  10. :data="users"
  11. disabled-hover
  12. border
  13. ></Table>
  14. </div>
  15. <!-- modify-grading-user -->
  16. <modify-grading-user
  17. :instance="curUser"
  18. @modified="getList"
  19. ref="ModifyGradingUser"
  20. ></modify-grading-user>
  21. </div>
  22. </template>
  23. <script>
  24. import { gradingUserList, deleteGradingUser, resetPwd } from "@/api";
  25. import ModifyGradingUser from "./components/ModifyGradingUser";
  26. export default {
  27. name: "grading-user-manage",
  28. components: { ModifyGradingUser },
  29. data() {
  30. return {
  31. subjectId: this.$route.params.subjectId,
  32. workId: this.$route.params.workId,
  33. users: [],
  34. curUser: {},
  35. columes: [
  36. {
  37. type: "index",
  38. title: "序号",
  39. width: 60,
  40. align: "center"
  41. },
  42. {
  43. title: "科目",
  44. key: "subjectName"
  45. },
  46. {
  47. title: "账号",
  48. key: "loginName"
  49. },
  50. {
  51. title: "姓名",
  52. key: "name"
  53. },
  54. {
  55. title: "角色",
  56. key: "roleName"
  57. },
  58. {
  59. title: "权限",
  60. key: "rightName"
  61. },
  62. {
  63. title: "权重",
  64. key: "weight"
  65. },
  66. {
  67. title: "操作",
  68. key: "action",
  69. width: 240,
  70. align: "center",
  71. render: (h, param) => {
  72. let actions = [
  73. {
  74. name: "重置",
  75. action: () => {
  76. this.toResetPwd(param.row);
  77. }
  78. },
  79. {
  80. name: "编辑",
  81. action: () => {
  82. this.toEdit(param.row);
  83. }
  84. },
  85. {
  86. name: "删除",
  87. type: "error",
  88. action: () => {
  89. this.toDelete(param.row);
  90. }
  91. }
  92. ];
  93. return h("div", this.$tableAction(h, actions));
  94. }
  95. }
  96. ]
  97. };
  98. },
  99. methods: {
  100. async getList() {
  101. const datas = {
  102. workId: this.workId,
  103. subjectId: this.subjectId
  104. };
  105. const data = await gradingUserList(datas);
  106. this.users = data;
  107. },
  108. async toResetPwd(row) {
  109. await resetPwd(row.id);
  110. this.$Message.success("重置密码成功!");
  111. },
  112. toAdd() {
  113. this.curUser = {
  114. workId: this.workId,
  115. subjectId: this.subjectId
  116. };
  117. this.$refs.ModifyGradingUser.open();
  118. },
  119. toEdit(row) {
  120. this.curUser = row;
  121. this.$refs.ModifyGradingUser.open();
  122. },
  123. toDelete(row) {
  124. this.$Modal.confirm({
  125. title: "删除警告",
  126. content: "确定要删除当前账号吗?",
  127. onOk: () => {
  128. this.toDel(row.id);
  129. }
  130. });
  131. },
  132. async toDel(id) {
  133. await deleteGradingUser(id);
  134. this.$Message.success("删除成功!");
  135. this.getList();
  136. }
  137. }
  138. };
  139. </script>