ModifyOrgAdmin.vue 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. <template>
  2. <el-dialog
  3. class="modify-organization"
  4. :visible.sync="modalIsShow"
  5. title="机构管理人员"
  6. top="10px"
  7. width="1000px"
  8. :close-on-click-modal="false"
  9. :close-on-press-escape="false"
  10. append-to-body
  11. >
  12. <div class="part-box part-box-pad part-box-border">
  13. <div class="part-title">
  14. <h2>部门主管</h2>
  15. </div>
  16. <el-table>
  17. <el-table-column prop="realName" label="姓名"></el-table-column>
  18. <el-table-column prop="realName" label="手机号"></el-table-column>
  19. <el-table-column prop="realName" label="用户名/工号"></el-table-column>
  20. <el-table-column prop="realName" label="角色"></el-table-column>
  21. <el-table-column prop="realName" label="部门"></el-table-column>
  22. <el-table-column class-name="action-column" label="操作" width="120px">
  23. <template slot-scope="scope">
  24. <el-button
  25. class="btn-primary"
  26. type="text"
  27. @click="setAdmin(scope.row)"
  28. >
  29. {{ scope.row.isAdmin ? "取消部门主管" : "设为部分主管" }}
  30. </el-button>
  31. </template>
  32. </el-table-column>
  33. </el-table>
  34. </div>
  35. <div class="part-box part-box-pad part-box-border">
  36. <div class="flex-between">
  37. <el-form ref="modalFormComp" :model="filter" label-width="100px">
  38. <el-form-item prop="name" label="部分成员:">
  39. <el-input
  40. style="width: 282px"
  41. v-model.trim="filter.name"
  42. placeholder="姓名/工号/手机号"
  43. clearable
  44. ></el-input>
  45. </el-form-item>
  46. <el-form-item>
  47. <el-button @click="search">查询</el-button>
  48. </el-form-item>
  49. </el-form>
  50. <div>
  51. <el-button
  52. type="primary"
  53. icon="el-icon-circle-plus-outline"
  54. @click="toAdd"
  55. >添加成员</el-button
  56. >
  57. </div>
  58. </div>
  59. <table>
  60. <el-table-column prop="realName" label="姓名"></el-table-column>
  61. <el-table-column prop="realName" label="手机号"></el-table-column>
  62. <el-table-column prop="realName" label="用户名/工号"></el-table-column>
  63. <el-table-column prop="realName" label="角色"></el-table-column>
  64. <el-table-column prop="realName" label="部门"></el-table-column>
  65. <el-table-column class-name="action-column" label="操作" width="120px">
  66. <template slot-scope="scope">
  67. <el-button
  68. class="btn-primary"
  69. type="text"
  70. @click="setAdmin(scope.row)"
  71. >
  72. {{ scope.row.isAdmin ? "取消部门主管" : "设为部分主管" }}
  73. </el-button>
  74. </template>
  75. </el-table-column>
  76. </table>
  77. </div>
  78. <div slot="footer"></div>
  79. </el-dialog>
  80. </template>
  81. <script>
  82. import { updateOrganization } from "../api";
  83. export default {
  84. name: "modify-organization",
  85. props: {
  86. orgId: {
  87. type: String,
  88. default: "",
  89. },
  90. },
  91. data() {
  92. return {
  93. modalIsShow: false,
  94. filter: { name: "" },
  95. admins: [],
  96. users: [],
  97. current: 1,
  98. size: this.GLOBAL.pageSize,
  99. total: 0,
  100. };
  101. },
  102. watch: {
  103. orgId(val, oldval) {
  104. if (val !== oldval) this.initData();
  105. },
  106. },
  107. methods: {
  108. initData() {
  109. this.filter.name = "";
  110. this.admins = [];
  111. this.users = [];
  112. this.getAdmins();
  113. this.toPage(1);
  114. },
  115. cancel() {
  116. this.modalIsShow = false;
  117. },
  118. open() {
  119. this.modalIsShow = true;
  120. },
  121. async getAdmins() {
  122. if (!this.orgId) return;
  123. const data = await updateOrganization({ orgId: this.orgId });
  124. this.admins = data || [];
  125. },
  126. async getList() {
  127. if (!this.orgId) return;
  128. const datas = {
  129. ...this.filter,
  130. orgId: this.orgId,
  131. pageNumber: this.current,
  132. pageSize: this.size,
  133. };
  134. const data = await updateOrganization(datas);
  135. this.users = data.records;
  136. this.total = data.total;
  137. },
  138. toPage(page) {
  139. this.current = page;
  140. this.getList();
  141. },
  142. search() {
  143. this.toPage(1);
  144. },
  145. setAdmin(user) {
  146. console.log(user);
  147. },
  148. toAdd() {},
  149. },
  150. };
  151. </script>