tkcourse.vue 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215
  1. <template>
  2. <view class="zhbox">
  3. <view class="pfixed"><tab-list :tablist='tablist' :tabidx="tabidx" @getCheck="goCheck" ></tab-list></view>
  4. <sh-list :datalist='list' :zhtype="zhtype" :userId="userId" :wtdt="wtdt" :subject="subject" :week="week" @getDel="getDel" @getPass='getPass' @getSefuse="getSefuse" @getUpdate="getUpdate"></sh-list>
  5. <pop-up :type="type" @getyjSubmit="getyjSubmit" @getClose="getClose"></pop-up>
  6. </view>
  7. </template>
  8. <script>
  9. import tabList from "@/components/toptab/tab.vue"
  10. import shList from "@/components/shlist/list.vue"
  11. import popUp from "@/components/popup/popup.vue"
  12. import {getshyjFn,getDictionaryFn} from '@/api/mine/register.js'
  13. import {getChangelistFn,getChangereplyFn,getChangeDelFn} from "@/api/work/index.js"
  14. export default {
  15. components:{
  16. tabList,shList,popUp
  17. },
  18. data(){
  19. return{
  20. sucimg:require("@/mine/static/mine/success.png"),
  21. tabidx:0,
  22. tablist:[{tit:'全部',val:0},{tit:'待审',val:1},{tit:'已审',val:2},{tit:'已拒绝',val:3,}],
  23. list:[],
  24. pageSize: 10,
  25. pageNum: 1,
  26. reachflag:true,
  27. wtdt:'',
  28. type:0,
  29. zhtype:4,
  30. subject:[],
  31. week:[],
  32. datain:'',
  33. userId:this.$store.state.user.userId,
  34. schoolId:'',
  35. }
  36. },
  37. onUnload(){
  38. uni.$off('refreshdatalis')
  39. },
  40. onLoad: function() {
  41. uni.$on('refreshdatalis',(e) => {
  42. this.reachflag=true;
  43. this.pageNum=1;
  44. this.list=[];
  45. this.getDataFn();
  46. })
  47. var choseroles=this.$store.state.user.choseroles;
  48. this.roles=choseroles;
  49. if(choseroles=='school'){
  50. this.schoolId=this.$store.state.user.deptId
  51. }else{
  52. this.schoolId=this.$store.state.user.schoolId
  53. }
  54. this.getDataFn();
  55. this.init()
  56. },
  57. onReachBottom() {
  58. if (this.reachflag) {
  59. this.pageNum++
  60. this.getDataFn()
  61. }
  62. },
  63. methods:{
  64. getClose(){
  65. this.type=0
  66. },
  67. init(){
  68. // 学科
  69. getDictionaryFn('sys_subject').then(res=>{
  70. if(res.code==200){
  71. this.subject = res.data.map(v => {
  72. return {
  73. dictLabel: v.dictLabel,
  74. dictValue: v.dictValue
  75. }
  76. })
  77. }
  78. })
  79. // 星期
  80. getDictionaryFn('sys_week').then(res=>{
  81. if(res.code==200){
  82. this.week = res.data.map(v => {
  83. return {
  84. dictLabel: v.dictLabel,
  85. dictValue: v.dictValue
  86. }
  87. })
  88. }
  89. })
  90. },
  91. getUpdate(data){
  92. this.$tab.navigateTo(`/work/pages/examine/applyclass?id=${data}&pagetype='update'`)
  93. },
  94. getPass(data){
  95. var params={
  96. id:data.id,
  97. isPass:2,
  98. "subjectClassId":data.subjectClassId,
  99. "beSubject":data.beSubject,
  100. opinion:''
  101. }
  102. var that=this;
  103. getChangereplyFn(params).then(res=>{
  104. if(res.code==200){
  105. this.$toast('审核成功')
  106. setTimeout(function(){
  107. that.pageNum=1;
  108. that.reachflag=true;
  109. that.list=[];
  110. that.getDataFn();
  111. that.type=0;
  112. },1500)
  113. }else{
  114. that.type=0;
  115. this.$toast(res.msg)
  116. }
  117. })
  118. },
  119. getDel(data){
  120. var idx=data.id;
  121. var that=this;
  122. getChangeDelFn(data.id).then(res=>{
  123. if(res.code==200){
  124. that.$toast('删除成功')
  125. setTimeout(function(){
  126. that.pageNum=1;
  127. that.reachflag=true;
  128. that.list=[];
  129. that.getDataFn()
  130. },1500)
  131. }else{
  132. that.$toast(res.msg)
  133. }
  134. })
  135. },
  136. getSefuse(data){
  137. this.type=6;
  138. this.datain=data;
  139. },
  140. getyjSubmit(e){
  141. var params={
  142. id:this.datain.id,
  143. isPass:3,
  144. "subjectClassId":this.datain.subjectClassId,
  145. "beSubject":this.datain.beSubject,
  146. opinion:e
  147. }
  148. var that=this;
  149. getChangereplyFn(params).then(res=>{
  150. if(res.code==200){
  151. this.$toast('审核成功')
  152. setTimeout(function(){
  153. that.pageNum=1;
  154. that.reachflag=true;
  155. that.list=[];
  156. that.type=0;
  157. that.getDataFn()
  158. },1500)
  159. }else{
  160. that.type=0;
  161. this.$toast(res.msg)
  162. }
  163. })
  164. },
  165. goCheck(data){
  166. this.tabidx=data;
  167. this.reachflag=true;
  168. this.pageNum=1;
  169. this.list=[];
  170. this.getDataFn()
  171. },
  172. getDataFn(){
  173. var params={
  174. pageSize:this.pageSize,
  175. pageNum: this.pageNum,
  176. schoolId:this.schoolId
  177. }
  178. if(this.tabidx>0){
  179. params.isPass=this.tabidx
  180. }
  181. getChangelistFn(params).then(res=>{
  182. if(res.code==200){
  183. if (res.rows.length < this.pageSize) {
  184. this.reachflag = false
  185. this.wtdt = '到底了~';
  186. } else {
  187. var num = parseInt(res.rows.length) + parseInt(this.pageSize) * parseInt(this.pageNum - 1)
  188. if (num < res.total) {
  189. this.reachflag = true
  190. this.wtdt = '上拉加载更多'
  191. } else {
  192. this.reachflag = false
  193. this.wtdt = '到底了~';
  194. }
  195. }
  196. if (this.pageNum == 1) {
  197. this.list = res.rows;
  198. } else {
  199. this.list = this.list.concat(res.rows)
  200. }
  201. }else{
  202. this.$toast(res.msg)
  203. }
  204. })
  205. },
  206. },
  207. }
  208. </script>
  209. <style lang="scss" scoped>
  210. .zhbox{padding:132rpx 36rpx 32rpx;}
  211. </style>