stuNameList.vue 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. <template>
  2. <div id="stuNameList">
  3. <el-row>
  4. <el-row type="flex" justify="center" style="padding:10px 0">
  5. <el-col :span="6">
  6. <el-button type="primary" plain size="mini" @click.native="$router.push({ path: '/class/achieve', query: { classid: $attrs.classid } })">
  7. 查看平时成绩
  8. </el-button>
  9. </el-col>
  10. </el-row>
  11. <el-col :span="24" v-if="user.job == '班长'"> </el-col>
  12. <el-col :span="24" class="info">
  13. <el-col :span="12" class="list" v-for="(item, index) in stuNameList" :key="index">
  14. <p class="name" @click="submitinfo(item)">{{ item.name }}</p>
  15. <p class="job" v-if="item.job">
  16. 职务:{{ item.job }}<span v-if="item.job == '班长' || item.job == '学委'"><i class="el-icon-circle-check"></i></span>
  17. </p>
  18. <el-col :span="24" class="job">性别:{{ item.gender }}</el-col>
  19. <el-col :span="24" class="job">寝室号:{{ item.bedroom }}</el-col>
  20. <el-col :span="24" class="job"
  21. ><i class="el-icon-phone"></i><el-link href="tel:01234567890" :underline="false">:{{ item.phone }}</el-link></el-col
  22. >
  23. </el-col>
  24. </el-col>
  25. </el-row>
  26. <van-popup v-model="show" position="bottom">
  27. <van-form @submit="onSubmit">
  28. <van-field
  29. v-model="newform.name"
  30. disabled
  31. name="学生名称"
  32. label="学生名称"
  33. placeholder="请输入学生名称"
  34. :rules="[{ required: true, message: '请填写用户名' }]"
  35. />
  36. <van-field readonly clickable name="picker" :value="newform.job" label="选择器" placeholder="点击选择城市" @click="showPicker = true" />
  37. <van-popup v-model="showPicker" position="bottom">
  38. <van-picker show-toolbar :columns="columns" @confirm="onConfirm" @cancel="showPicker = false" />
  39. </van-popup>
  40. <van-field name="radio" label="选择优秀学生">
  41. <template #input>
  42. <van-radio-group v-model="newform.is_fine" direction="horizontal">
  43. <van-radio name="0">否</van-radio>
  44. <van-radio name="1">是</van-radio>
  45. </van-radio-group>
  46. </template>
  47. </van-field>
  48. <div style="margin: 16px;">
  49. <van-button round block type="info" native-type="submit">
  50. 提交
  51. </van-button>
  52. </div>
  53. </van-form>
  54. </van-popup>
  55. </div>
  56. </template>
  57. <script>
  58. import { mapState, createNamespacedHelpers, mapGetters } from 'vuex';
  59. export default {
  60. name: 'stuNameList',
  61. props: {
  62. stuNameList: null,
  63. },
  64. components: {},
  65. data: () => ({
  66. newform: {},
  67. form: {},
  68. show: false,
  69. newshow: false,
  70. value: '',
  71. columns: [],
  72. showPicker: false,
  73. column1: ['文艺委员', '安全委员', '普通学生'],
  74. column2: ['文艺委员', '普通学生'],
  75. column3: ['安全委员', '普通学生'],
  76. column4: ['普通学生'],
  77. }),
  78. created() {},
  79. computed: { ...mapState(['user']) },
  80. methods: {
  81. onSubmit(values) {
  82. this.$emit('newsubmit', { data: this.newform });
  83. this.show = false;
  84. },
  85. submitinfo(item) {
  86. // this.value = item.job;
  87. console.log(this.stuNameList);
  88. var wenyi = this.stuNameList.filter(item => item.job == '文艺委员');
  89. var anquan = this.stuNameList.filter(item => item.job == '安全委员');
  90. console.log('ccc');
  91. // this.value = item.job;
  92. // this.columns = this.column1;
  93. if (wenyi.length == '1') {
  94. if (anquan.length == '0') {
  95. if (item.job == '文艺委员') {
  96. this.columns = this.column1;
  97. } else {
  98. console.log('2313');
  99. this.columns = this.column3;
  100. }
  101. } else if (anquan.length == '1') {
  102. console.log('c');
  103. if (item.job == '普通学生') {
  104. this.columns = this.column4;
  105. } else if (item.job == '安全委员') {
  106. this.columns = this.column3;
  107. } else if (item.job == '文艺委员') {
  108. this.columns = this.column2;
  109. }
  110. }
  111. } else if (wenyi.length == '0') {
  112. if (anquan.length == '0') {
  113. console.log('cc3123');
  114. this.columns = this.column1;
  115. } else if (anquan.length == 1) {
  116. if (item.job == '安全委员') {
  117. this.columns = this.column1;
  118. } else {
  119. this.columns = this.column2;
  120. }
  121. }
  122. }
  123. this.show = true;
  124. this.newform = item;
  125. },
  126. //设置优秀学员
  127. goodstu(item) {
  128. this.newshow = true;
  129. },
  130. onConfirm(job) {
  131. this.$set(this.form, `job`, job);
  132. this.showPicker = false;
  133. },
  134. },
  135. };
  136. </script>
  137. <style lang="less" scoped>
  138. p {
  139. padding: 0;
  140. margin: 0;
  141. }
  142. .list {
  143. padding: 10px 0;
  144. border-bottom: 1px dashed #ccc;
  145. margin: 0 10px;
  146. width: 44%;
  147. }
  148. .list .name {
  149. text-align: center;
  150. font-size: 14px;
  151. }
  152. .list .job {
  153. text-align: center;
  154. font-size: 12px;
  155. color: #405ffe;
  156. padding: 5px 0 0 0;
  157. }
  158. /deep/.van-popup--bottom {
  159. bottom: 0;
  160. left: 0;
  161. width: 100%;
  162. height: 400px;
  163. }
  164. </style>