ModifyOrgAdmin.vue 4.3 KB

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