liu_manage.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347
  1. <template>
  2. <view class="content">
  3. <!-- 提交记录 -->
  4. <view>
  5. <view class="select_submit">
  6. <view style="width: 80px;margin-left: 9rpx;position: absolute;">
  7. <uni-data-select
  8. v-model="value3"
  9. :localdata="shenfen"
  10. @change="changeShen"
  11. ></uni-data-select>
  12. </view>
  13. <view style="width: 80px;margin-left: 196rpx;position: absolute;">
  14. <uni-data-select
  15. v-model="value"
  16. :localdata="zhuangtai"
  17. @change="changezhuang"
  18. ></uni-data-select>
  19. </view>
  20. <view style="width: 80px;margin-left: 396rpx;">
  21. <uni-data-select
  22. v-model="value2"
  23. :localdata="TimeRanges"
  24. @change="changetime"
  25. ></uni-data-select>
  26. </view>
  27. <!-- 不同状态的记录 -->
  28. <view :class="item.department=='4'?'submit-list2':'submit-list'" v-for="(item,index) in submit" :key="index">
  29. <text @click="clickDetail(item.id,item.department)">
  30. <text class="submit-title" v-if="item.department=='7'">临时人员</text>
  31. <text class="submit-title" v-if="item.department=='4'">教师换课</text>
  32. <text class="submit-time">{{item.submissionTime}}</text>
  33. <view class="submit-line"></view>
  34. <view class="submit-start">开始时间:{{item.startTime}}</view>
  35. <view class="submit-end">结束时间:{{item.endTime}}</view>
  36. <view class="submit-teacher" v-if="item.department=='4'">换课老师:{{item.changeUsersName}}</view>
  37. <view class="submit-remark">备注:{{item.reasonApplication}}</view>
  38. <view class="submit-type1" v-if="item.status==0">已拒绝</view>
  39. <view class="submit-type1" v-if="item.status==1">待审批</view>
  40. <view class="submit-type2" v-if="item.status==2">处理中</view>
  41. <view class="submit-type" v-if="item.status==3">已同意</view>
  42. </text>
  43. <view class="submit-disagree" v-if="item.status==1 || item.status==2" @click="disagree(item.id)">驳回</view>
  44. <view class="submit-agree" v-if="item.status==1 || item.status==2" @click="agree(item.id)">同意</view>
  45. </view>
  46. </view>
  47. </view>
  48. </view>
  49. </template>
  50. <script>
  51. import {
  52. getManaLinlist,
  53. getManaTealist,
  54. shenpiLinshi,
  55. shenpiTeacher
  56. } from '../../utils/api_hotel.js'
  57. export default {
  58. data() {
  59. return {
  60. // 提交记录
  61. value3: 0,
  62. shenfen: [
  63. { value: 0, text: "临时人员" },
  64. { value: 1, text: "教师换课" },
  65. ],
  66. value: '',
  67. zhuangtai: [
  68. { value: 0, text: "已拒绝" },
  69. { value: 1, text: "待审批" },
  70. { value: 2, text: "处理中" },
  71. { value: 3, text: "已同意" },
  72. { value: '', text: "全部" },
  73. ],
  74. value2: 2,
  75. TimeRanges: [
  76. { value: 0, text: "近一周" },
  77. { value: 1, text: "本月" },
  78. { value: 2, text: "全部" },
  79. ],
  80. submit:[],
  81. page:1,
  82. size:10,
  83. startTime:'',
  84. endTime:'',
  85. nowTime: new Date().toISOString().slice(0, 10),//当前日期2024-07-23
  86. totalCount:0,
  87. agreestatu:'',//1:同意 0:拒绝
  88. }
  89. },
  90. onLoad() {
  91. this.getManageLin()
  92. },
  93. mounted() {
  94. },
  95. methods: {
  96. //管理员查看临时人员记录
  97. getManageLin(){
  98. let _self = this
  99. // adminMenuId身份类型,localStorage.getItem('manager'),//1管理员,0不是管理员
  100. // 状态,0:已拒绝,1:待审批,2:处理中,3:已同意
  101. var data="?adminMenuId="+localStorage.getItem('manager')+"&startTime="+this.startTime+"&endTime="+this.endTime+"&status="+this.value+"&page="+this.page+"&size="+this.size
  102. getManaLinlist(data).then((res) => {
  103. if (res.success) {
  104. this.totalCount=res.data.total
  105. if (this.page == 1) {
  106. this.submit = res.data.records
  107. } else {
  108. this.submit = [...this.submit, ...res.data.records]
  109. }
  110. uni.stopPullDownRefresh();
  111. uni.hideLoading()
  112. } else {
  113. console.log('获取记录失败')
  114. }
  115. }).catch((err) => {
  116. uni.showToast({
  117. title: err.message
  118. })
  119. });
  120. },
  121. //管理员查看换课教师记录
  122. getManageTeacher(){
  123. let _self = this
  124. // adminMenuId身份类型,localStorage.getItem('manager'),//1管理员,0不是管理员
  125. // 状态,0:已拒绝,1:待审批,2:处理中,3:已同意
  126. var data="?adminMenuId="+localStorage.getItem('manager')+"&startTime="+this.startTime+"&endTime="+this.endTime+"&status="+this.value+"&page="+this.page+"&size="+this.size
  127. getManaTealist(data).then((res) => {
  128. if (res.success) {
  129. this.totalCount=res.data.totalCount
  130. if (this.page == 1) {
  131. this.submit = res.data.list
  132. } else {
  133. this.submit = [...this.submit, ...res.data.list]
  134. }
  135. uni.stopPullDownRefresh();
  136. uni.hideLoading()
  137. } else {
  138. console.log('获取记录失败')
  139. }
  140. }).catch((err) => {
  141. uni.showToast({
  142. title: err.message
  143. })
  144. });
  145. },
  146. //驳回
  147. disagree(id){
  148. this.agreestatu='0'
  149. var id=id
  150. if(this.value3==0){
  151. this.shenpiLinshi(id)
  152. }else if(this.value3==1){
  153. this.shenpiTeacher(id)
  154. }
  155. },
  156. //同意
  157. agree(id){
  158. this.agreestatu='1'
  159. var id=id
  160. if(this.value3==0){
  161. this.shenpiLinshi(id)
  162. }else if(this.value3==1){
  163. this.shenpiTeacher(id)
  164. }
  165. },
  166. // 审批临时人员
  167. shenpiLinshi(id){
  168. let _self = this
  169. this.$axios.defaults.headers.common['token'] = localStorage.getItem('token');
  170. this.$axios.defaults.headers.common['request_token'] = this.submitToken;
  171. this.$axios.defaults.headers.common['Content-Type'] ='application/json'
  172. var data={
  173. "id": id, //审批表id
  174. "adminMenuId": localStorage.getItem('manager'),//1管理员,0不是管理员
  175. "status": _self.agreestatu, //审批状态 1:同意 0:拒绝
  176. "adminId": localStorage.getItem('usersId'),//管理端id
  177. "remark": "" ,//审批备注
  178. }
  179. shenpiLinshi(data).then((res) => {
  180. if (res.success) {
  181. uni.showToast({
  182. title: '审批成功',
  183. icon: 'success',
  184. duration: 1000
  185. })
  186. if(_self.value3==1){
  187. _self.getManageTeacher()
  188. }else if(_self.value3==0){
  189. _self.getManageLin()
  190. }
  191. } else {
  192. }
  193. }).catch((err) => {
  194. uni.showToast({
  195. title: err.message
  196. })
  197. });
  198. },
  199. // 审批教师换课
  200. shenpiTeacher(id){
  201. let _self = this
  202. this.$axios.defaults.headers.common['token'] = localStorage.getItem('token');
  203. this.$axios.defaults.headers.common['request_token'] = this.submitToken;
  204. this.$axios.defaults.headers.common['Content-Type'] ='application/json'
  205. var data={
  206. "id": id, //审批表id
  207. "adminMenuId": localStorage.getItem('manager'),//1管理员,0不是管理员
  208. "status": _self.agreestatu, //审批状态 1:同意 0:拒绝
  209. "adminId": localStorage.getItem('usersId'),//管理端id
  210. "remark": "" ,//审批备注
  211. }
  212. shenpiTeacher(data).then((res) => {
  213. if (res.success) {
  214. uni.showToast({
  215. title: '审批成功',
  216. icon: 'success',
  217. duration: 1000
  218. })
  219. if(_self.value3==1){
  220. _self.getManageTeacher()
  221. }else if(_self.value3==0){
  222. _self.getManageLin()
  223. }
  224. } else {
  225. }
  226. }).catch((err) => {
  227. uni.showToast({
  228. title: err.message
  229. })
  230. });
  231. },
  232. // 提交记录
  233. //选择审批类型身份
  234. changeShen(e){
  235. this.value3=e
  236. if(this.value3==1){
  237. this.getManageTeacher()
  238. }else if(this.value3==0){
  239. this.getManageLin()
  240. }
  241. },
  242. // 选择审批状态
  243. changezhuang(e) {
  244. this.value=e
  245. if(this.value3==1){
  246. this.getManageTeacher()
  247. }else if(this.value3==0){
  248. this.getManageLin()
  249. }
  250. },
  251. //获得本周的开始时间:
  252. getStartDayOfWeek(time) {
  253. let now = new Date(time); // 当前日期
  254. let nowDayOfWeek = now.getDay(); // 今天本周的第几天
  255. let day = nowDayOfWeek || 7;
  256. let nowDay = now.getDate(); // 当前日
  257. let nowMonth = now.getMonth(); // 当前月
  258. return this.formatDate(new Date(now.getFullYear(), nowMonth, nowDay + 1 - day));
  259. },
  260. //获得本周的结束时间:
  261. getEndDayOfWeek(time) {
  262. let now = new Date(time); // 当前日期
  263. let nowDayOfWeek = now.getDay(); // 今天本周的第几天
  264. let day = nowDayOfWeek || 7;
  265. let nowDay = now.getDate(); // 当前日
  266. let nowMonth = now.getMonth(); // 当前月
  267. return this.formatDate(new Date(now.getFullYear(), nowMonth, nowDay + 7 - day));
  268. },
  269. //获得本月的开始时间:
  270. getStartDayOfMonth(time) {
  271. let now = new Date(time); // 当前日期
  272. let nowDay = now.getDate(); // 当前日
  273. let nowMonth = now.getMonth(); // 当前月
  274. return this.formatDate(new Date(now.getFullYear(), nowMonth, 1));
  275. },
  276. // 日期格式化
  277. formatDate(date) {
  278. let myyear = date.getFullYear();
  279. let mymonth = date.getMonth() + 1;
  280. let myweekday = date.getDate();
  281. if (mymonth < 10) {
  282. mymonth = '0' + mymonth;
  283. }
  284. if (myweekday < 10) {
  285. myweekday = '0' + myweekday;
  286. }
  287. return (myyear + '-' + mymonth + '-' + myweekday);
  288. },
  289. // 选择时间
  290. changetime(e) {
  291. this.value2=e
  292. if(this.value2==0){
  293. this.startTime=this.getStartDayOfWeek(this.nowTime).slice(0, 10)+' 00:00:00'
  294. this.endTime=this.getEndDayOfWeek(this.nowTime).slice(0, 10)+' 23:59:59'
  295. }else if(this.value2==1){
  296. this.startTime=this.getStartDayOfMonth(this.nowTime).slice(0, 10)+' 00:00:00'
  297. this.endTime=this.nowTime+' 23:59:59'
  298. }else if(this.value2==2){
  299. this.startTime=''
  300. this.endTime=''
  301. }
  302. if(this.value3==1){
  303. this.getManageTeacher()
  304. }else if(this.value3==0){
  305. this.getManageLin()
  306. }
  307. },
  308. // 跳转到详情页面
  309. clickDetail(id,department){
  310. uni.navigateTo({
  311. url: "../liuchengManger/detail/teach_detail?id="+id+"&department="+department
  312. })
  313. },
  314. onReachBottom: function() {
  315. if (this.submit.length < this.totalCount) {
  316. wx.showLoading({
  317. title: '加载中...',
  318. })
  319. this.page = this.page + 1;
  320. if(this.value3==1){
  321. this.getManageTeacher()
  322. }else if(this.value3==0){
  323. this.getManageLin()
  324. }
  325. } else {
  326. }
  327. },
  328. onPullDownRefresh: function() {
  329. this.page = 1;
  330. if(this.value3==1){
  331. this.getManageTeacher()
  332. }else if(this.value3==0){
  333. this.getManageLin()
  334. }
  335. },
  336. }
  337. }
  338. </script>
  339. <style>
  340. @import url("./css/liu_manage.css");
  341. </style>