| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347 |
- <template>
- <view class="content">
- <!-- 提交记录 -->
- <view>
- <view class="select_submit">
- <view style="width: 80px;margin-left: 9rpx;position: absolute;">
- <uni-data-select
- v-model="value3"
- :localdata="shenfen"
- @change="changeShen"
- ></uni-data-select>
- </view>
- <view style="width: 80px;margin-left: 196rpx;position: absolute;">
- <uni-data-select
- v-model="value"
- :localdata="zhuangtai"
- @change="changezhuang"
- ></uni-data-select>
- </view>
- <view style="width: 80px;margin-left: 396rpx;">
- <uni-data-select
- v-model="value2"
- :localdata="TimeRanges"
- @change="changetime"
- ></uni-data-select>
- </view>
- <!-- 不同状态的记录 -->
- <view :class="item.department=='4'?'submit-list2':'submit-list'" v-for="(item,index) in submit" :key="index">
- <text @click="clickDetail(item.id,item.department)">
- <text class="submit-title" v-if="item.department=='7'">临时人员</text>
- <text class="submit-title" v-if="item.department=='4'">教师换课</text>
- <text class="submit-time">{{item.submissionTime}}</text>
- <view class="submit-line"></view>
- <view class="submit-start">开始时间:{{item.startTime}}</view>
- <view class="submit-end">结束时间:{{item.endTime}}</view>
- <view class="submit-teacher" v-if="item.department=='4'">换课老师:{{item.changeUsersName}}</view>
- <view class="submit-remark">备注:{{item.reasonApplication}}</view>
- <view class="submit-type1" v-if="item.status==0">已拒绝</view>
- <view class="submit-type1" v-if="item.status==1">待审批</view>
- <view class="submit-type2" v-if="item.status==2">处理中</view>
- <view class="submit-type" v-if="item.status==3">已同意</view>
- </text>
- <view class="submit-disagree" v-if="item.status==1 || item.status==2" @click="disagree(item.id)">驳回</view>
- <view class="submit-agree" v-if="item.status==1 || item.status==2" @click="agree(item.id)">同意</view>
- </view>
- </view>
- </view>
- </view>
- </template>
- <script>
- import {
- getManaLinlist,
- getManaTealist,
- shenpiLinshi,
- shenpiTeacher
- } from '../../utils/api_hotel.js'
- export default {
- data() {
- return {
- // 提交记录
- value3: 0,
- shenfen: [
- { value: 0, text: "临时人员" },
- { value: 1, text: "教师换课" },
- ],
- value: '',
- zhuangtai: [
- { value: 0, text: "已拒绝" },
- { value: 1, text: "待审批" },
- { value: 2, text: "处理中" },
- { value: 3, text: "已同意" },
- { value: '', text: "全部" },
- ],
- value2: 2,
- TimeRanges: [
- { value: 0, text: "近一周" },
- { value: 1, text: "本月" },
- { value: 2, text: "全部" },
- ],
- submit:[],
- page:1,
- size:10,
- startTime:'',
- endTime:'',
- nowTime: new Date().toISOString().slice(0, 10),//当前日期2024-07-23
- totalCount:0,
- agreestatu:'',//1:同意 0:拒绝
- }
- },
- onLoad() {
- this.getManageLin()
- },
- mounted() {
-
- },
- methods: {
- //管理员查看临时人员记录
- getManageLin(){
- let _self = this
- // adminMenuId身份类型,localStorage.getItem('manager'),//1管理员,0不是管理员
- // 状态,0:已拒绝,1:待审批,2:处理中,3:已同意
- var data="?adminMenuId="+localStorage.getItem('manager')+"&startTime="+this.startTime+"&endTime="+this.endTime+"&status="+this.value+"&page="+this.page+"&size="+this.size
- getManaLinlist(data).then((res) => {
- if (res.success) {
- this.totalCount=res.data.total
- if (this.page == 1) {
- this.submit = res.data.records
- } else {
- this.submit = [...this.submit, ...res.data.records]
- }
- uni.stopPullDownRefresh();
- uni.hideLoading()
- } else {
- console.log('获取记录失败')
- }
- }).catch((err) => {
- uni.showToast({
- title: err.message
- })
- });
- },
- //管理员查看换课教师记录
- getManageTeacher(){
- let _self = this
- // adminMenuId身份类型,localStorage.getItem('manager'),//1管理员,0不是管理员
- // 状态,0:已拒绝,1:待审批,2:处理中,3:已同意
- var data="?adminMenuId="+localStorage.getItem('manager')+"&startTime="+this.startTime+"&endTime="+this.endTime+"&status="+this.value+"&page="+this.page+"&size="+this.size
- getManaTealist(data).then((res) => {
- if (res.success) {
- this.totalCount=res.data.totalCount
- if (this.page == 1) {
- this.submit = res.data.list
- } else {
- this.submit = [...this.submit, ...res.data.list]
- }
- uni.stopPullDownRefresh();
- uni.hideLoading()
- } else {
- console.log('获取记录失败')
- }
- }).catch((err) => {
- uni.showToast({
- title: err.message
- })
- });
- },
-
- //驳回
- disagree(id){
- this.agreestatu='0'
- var id=id
- if(this.value3==0){
- this.shenpiLinshi(id)
- }else if(this.value3==1){
- this.shenpiTeacher(id)
- }
- },
- //同意
- agree(id){
- this.agreestatu='1'
- var id=id
- if(this.value3==0){
- this.shenpiLinshi(id)
- }else if(this.value3==1){
- this.shenpiTeacher(id)
- }
- },
- // 审批临时人员
- shenpiLinshi(id){
- let _self = this
- this.$axios.defaults.headers.common['token'] = localStorage.getItem('token');
- this.$axios.defaults.headers.common['request_token'] = this.submitToken;
- this.$axios.defaults.headers.common['Content-Type'] ='application/json'
- var data={
- "id": id, //审批表id
- "adminMenuId": localStorage.getItem('manager'),//1管理员,0不是管理员
- "status": _self.agreestatu, //审批状态 1:同意 0:拒绝
- "adminId": localStorage.getItem('usersId'),//管理端id
- "remark": "" ,//审批备注
- }
- shenpiLinshi(data).then((res) => {
- if (res.success) {
- uni.showToast({
- title: '审批成功',
- icon: 'success',
- duration: 1000
- })
- if(_self.value3==1){
- _self.getManageTeacher()
- }else if(_self.value3==0){
- _self.getManageLin()
- }
- } else {
- }
- }).catch((err) => {
- uni.showToast({
- title: err.message
- })
- });
- },
- // 审批教师换课
- shenpiTeacher(id){
- let _self = this
- this.$axios.defaults.headers.common['token'] = localStorage.getItem('token');
- this.$axios.defaults.headers.common['request_token'] = this.submitToken;
- this.$axios.defaults.headers.common['Content-Type'] ='application/json'
- var data={
- "id": id, //审批表id
- "adminMenuId": localStorage.getItem('manager'),//1管理员,0不是管理员
- "status": _self.agreestatu, //审批状态 1:同意 0:拒绝
- "adminId": localStorage.getItem('usersId'),//管理端id
- "remark": "" ,//审批备注
- }
- shenpiTeacher(data).then((res) => {
- if (res.success) {
- uni.showToast({
- title: '审批成功',
- icon: 'success',
- duration: 1000
- })
- if(_self.value3==1){
- _self.getManageTeacher()
- }else if(_self.value3==0){
- _self.getManageLin()
- }
- } else {
- }
- }).catch((err) => {
- uni.showToast({
- title: err.message
- })
- });
- },
- // 提交记录
- //选择审批类型身份
- changeShen(e){
- this.value3=e
- if(this.value3==1){
- this.getManageTeacher()
- }else if(this.value3==0){
- this.getManageLin()
- }
- },
- // 选择审批状态
- changezhuang(e) {
- this.value=e
- if(this.value3==1){
- this.getManageTeacher()
- }else if(this.value3==0){
- this.getManageLin()
- }
- },
- //获得本周的开始时间:
- getStartDayOfWeek(time) {
- let now = new Date(time); // 当前日期
- let nowDayOfWeek = now.getDay(); // 今天本周的第几天
- let day = nowDayOfWeek || 7;
- let nowDay = now.getDate(); // 当前日
- let nowMonth = now.getMonth(); // 当前月
- return this.formatDate(new Date(now.getFullYear(), nowMonth, nowDay + 1 - day));
- },
- //获得本周的结束时间:
- getEndDayOfWeek(time) {
- let now = new Date(time); // 当前日期
- let nowDayOfWeek = now.getDay(); // 今天本周的第几天
- let day = nowDayOfWeek || 7;
- let nowDay = now.getDate(); // 当前日
- let nowMonth = now.getMonth(); // 当前月
- return this.formatDate(new Date(now.getFullYear(), nowMonth, nowDay + 7 - day));
- },
- //获得本月的开始时间:
- getStartDayOfMonth(time) {
- let now = new Date(time); // 当前日期
- let nowDay = now.getDate(); // 当前日
- let nowMonth = now.getMonth(); // 当前月
- return this.formatDate(new Date(now.getFullYear(), nowMonth, 1));
- },
- // 日期格式化
- formatDate(date) {
- let myyear = date.getFullYear();
- let mymonth = date.getMonth() + 1;
- let myweekday = date.getDate();
- if (mymonth < 10) {
- mymonth = '0' + mymonth;
- }
- if (myweekday < 10) {
- myweekday = '0' + myweekday;
- }
- return (myyear + '-' + mymonth + '-' + myweekday);
- },
- // 选择时间
- changetime(e) {
- this.value2=e
- if(this.value2==0){
- this.startTime=this.getStartDayOfWeek(this.nowTime).slice(0, 10)+' 00:00:00'
- this.endTime=this.getEndDayOfWeek(this.nowTime).slice(0, 10)+' 23:59:59'
- }else if(this.value2==1){
- this.startTime=this.getStartDayOfMonth(this.nowTime).slice(0, 10)+' 00:00:00'
- this.endTime=this.nowTime+' 23:59:59'
- }else if(this.value2==2){
- this.startTime=''
- this.endTime=''
- }
- if(this.value3==1){
- this.getManageTeacher()
- }else if(this.value3==0){
- this.getManageLin()
- }
- },
- // 跳转到详情页面
- clickDetail(id,department){
- uni.navigateTo({
- url: "../liuchengManger/detail/teach_detail?id="+id+"&department="+department
- })
- },
- onReachBottom: function() {
-
- if (this.submit.length < this.totalCount) {
- wx.showLoading({
- title: '加载中...',
- })
- this.page = this.page + 1;
- if(this.value3==1){
- this.getManageTeacher()
- }else if(this.value3==0){
- this.getManageLin()
- }
- } else {
- }
- },
- onPullDownRefresh: function() {
- this.page = 1;
- if(this.value3==1){
- this.getManageTeacher()
- }else if(this.value3==0){
- this.getManageLin()
- }
- },
- }
- }
- </script>
- <style>
- @import url("./css/liu_manage.css");
- </style>
|