updateMore.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215
  1. <template>
  2. <el-dialog title="Add Student" :visible.sync="dialogVisibleMember" :append-to-body="true" width="540px" height="80%"
  3. :before-close="handleClose" class="addNewPP">
  4. <div class="people" v-if="dialogVisibleMember">
  5. <div class="people_top">
  6. <div class="people_top_right">
  7. <div class="people_search">
  8. <el-input placeholder="Enter Custom Name" v-model="name" @change="nameChange"></el-input>
  9. </div>
  10. </div>
  11. <div class="people_nav">Select Student</div>
  12. </div>
  13. <div class="i_box_login2" v-if="cList.length">
  14. <div :class="{ active: cname == item.userid }" v-for="(item, index) in cList" :key="index"
  15. :label="item.userid" @click="addGroupUser(item.userid)">
  16. <el-tooltip placement="top" :content="item.name ? item.name : 'No Name Available'">
  17. <span>{{ item.name ? item.name : "No Name Available" }}</span>
  18. </el-tooltip>
  19. </div>
  20. </div>
  21. <div style="text-align: center; margin-top: 10px" v-else>No Data Available</div>
  22. </div>
  23. <span slot="footer" class="dialog-footer">
  24. <el-button @click="close">Cancel</el-button>
  25. <el-button type="primary" @click="joinUpMore">Confirm</el-button>
  26. </span>
  27. </el-dialog>
  28. </template>
  29. <script>
  30. export default {
  31. props: ["dialogVisibleMember", "cList", "userid", "searchTN"],
  32. data() {
  33. return {
  34. checkboxList: [],
  35. name:"",
  36. cname:""
  37. };
  38. },
  39. watch:{
  40. dialogVisibleMember(n){
  41. if(n){
  42. let a = JSON.parse(JSON.stringify(this.searchTN))
  43. let type = 1
  44. this.cList.forEach(e => {
  45. if(e.userid == a){
  46. type = 2
  47. this.cname = e.userid
  48. this.name = ""
  49. }
  50. })
  51. if(type == 1){
  52. this.name = a;
  53. this.cname = ""
  54. }
  55. }
  56. }
  57. },
  58. methods: {
  59. handleClose(done) {
  60. this.close()
  61. done();
  62. },
  63. nameChange(){
  64. this.cname = ""
  65. },
  66. addGroupUser(uid) {
  67. this.cname = uid
  68. this.name = "";
  69. },
  70. close(){
  71. this.$emit("update:dialogVisibleMember",false)
  72. },
  73. joinUpMore() {
  74. if(!this.cname && !this.name){
  75. this.$message.error("Please select a student or enter a custom name")
  76. }
  77. let a = this.name ? this.name : this.cname
  78. this.$emit("setPlname",a)
  79. },
  80. },
  81. mounted () {
  82. let a = JSON.parse(JSON.stringify(this.searchTN))
  83. let type = 1
  84. this.cList.forEach(e => {
  85. if(e.userid == a){
  86. type = 2
  87. this.cname = e.userid
  88. }
  89. })
  90. if(type == 1){
  91. this.name = a;
  92. }
  93. },
  94. };
  95. </script>
  96. <style scoped>
  97. .dialog_diy>>>.el-dialog__body {
  98. padding: 0 30px !important;
  99. }
  100. .dialog_diy>>>.el-dialog {
  101. margin-top: 10vh !important;
  102. }
  103. .dialog_diy>>>.el-dialog__header {
  104. background: #454545 !important;
  105. padding: 15px 20px;
  106. }
  107. .dialog_diy>>>.el-dialog__title {
  108. color: #fff;
  109. }
  110. .dialog_diy>>>.el-dialog__headerbtn {
  111. top: 19px;
  112. }
  113. .dialog_diy>>>.el-dialog__headerbtn .el-dialog__close {
  114. color: #fff;
  115. }
  116. .dialog_diy>>>.el-dialog__headerbtn .el-dialog__close:hover {
  117. color: #fff;
  118. }
  119. .dialog_diy>>>.el-dialog__body,
  120. .dialog_diy>>>.el-dialog__footer {
  121. background: #fafafa;
  122. }
  123. .people {
  124. border: 1px solid rgb(229 229 229);
  125. height: 495px;
  126. border-radius: 5px;
  127. width: 100%;
  128. overflow: auto;
  129. }
  130. .people_top {
  131. display: flex;
  132. width: 100%;
  133. /* justify-content: space-between; */
  134. /* align-items: center; */
  135. flex-direction: column;
  136. padding: 10px 25px 0;
  137. box-sizing: border-box;
  138. }
  139. .people_nav,
  140. .people_top_right {
  141. /* padding: 20px 0 0 20px; */
  142. }
  143. .people_top_right {
  144. height: 40px;
  145. margin-bottom: 10px;
  146. }
  147. .people_search {
  148. display: flex;
  149. position: relative;
  150. }
  151. .people_search>>>.el-input__inner {
  152. /* height: 25px; */
  153. width: 100%;
  154. }
  155. .i_box_login2 {
  156. height: calc(100% - 80px);
  157. width: 100%;
  158. display: flex;
  159. flex-wrap: wrap;
  160. overflow: auto;
  161. padding-bottom: 10px;
  162. box-sizing: border-box;
  163. align-content: flex-start;
  164. padding: 10px 25px 0;
  165. }
  166. .i_box_login2>div {
  167. cursor: pointer;
  168. width: 80px;
  169. text-align: center;
  170. height: 30px;
  171. line-height: 30px;
  172. padding: 0 5px;
  173. overflow: hidden;
  174. background: rgb(225, 237, 255);
  175. margin: 10px calc((100% - (80px * 5)) / 4) 0 0;
  176. color: rgb(37 124 255);
  177. border-radius: 5px;
  178. box-sizing: border-box;
  179. }
  180. .i_box_login2>div:nth-child(5n) {
  181. margin: 10px 0 0 0;
  182. }
  183. .i_box_login2>.active {
  184. background: rgb(92, 157, 255);
  185. color: #fff;
  186. }
  187. .i_box_login2>div>span {
  188. width: 100%;
  189. overflow: hidden;
  190. white-space: nowrap;
  191. text-overflow: ellipsis;
  192. display: block;
  193. }
  194. </style>