123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284 |
- <template>
- <view class="mind">
- <picker range-key="dictLabel" v-if="roles!='parents'" :disabled="daflag" :range="classlist" :value="classidx" @change="bindDateChangeb">
- <view class="flexc mibox mb20">
- <view class="tit" style="margin-bottom: 0;">班级</view>
- <view class="f15 flex1 txr co16" v-if="className" >{{className}}</view>
- <view class="f15 flex1 txr coa" v-else >请选择班级</view>
- <image :src="rimg" class="rimg"></image>
- </view>
- </picker>
- <picker range-key="dictLabel" :disabled="daflag||studentlist.length<1" :range="studentlist" :value="nameidx" @change="bindDateChangea">
- <view class="flexc mibox mb20">
- <view class="tit" style="margin-bottom: 0;">人员</view>
- <view class="f15 flex1 txr co16" v-if="name" >{{name}}</view>
- <view class="f15 flex1 txr coa" v-else >请选择人员</view>
- <image :src="rimg" class="rimg"></image>
- </view>
- </picker>
- <picker range-key="dictLabel" :disabled="daflag" :range="qjlxrange" :value="qjlbidx" @change="bindDateChanged">
- <view class="flexc mibox mb20">
- <view class="tit" style="margin-bottom: 0;">请假类别</view>
- <view class="f15 flex1 txr co16" v-if="category" >{{category}}</view>
- <view class="f15 flex1 txr coa" v-else >请选择请假类别</view>
- <image :src="rimg" class="rimg"></image>
- </view>
- </picker>
- <!-- <picker mode="time" @change="bindDateChanged"> -->
- <view class="flexc mibox mb20">
- <view class="tit" style="margin-bottom: 0;">开始时间</view>
- <uni-datetime-picker :border="false" :hide-second='true' type="datetime" v-model="startTime" @change="changeLog" />
- <!-- <view class="f15 flex1 txr co16" v-if="starttime" >{{starttime}}</view>
- <view class="f15 flex1 txr coa" v-else >请选择开始时间</view> -->
- <image :src="rimg" class="rimg"></image>
- </view>
- <view class="flexc mibox mb20">
- <view class="tit" style="margin-bottom: 0;">结束时间</view>
- <uni-datetime-picker :border="false" :hide-second='true' type="datetime" v-model="endTime" @change="changeLog" />
- <!-- <view class="f15 flex1 txr co16" v-if="starttime" >{{starttime}}</view>
- <view class="f15 flex1 txr coa" v-else >请选择开始时间</view> -->
- <image :src="rimg" class="rimg"></image>
- </view>
- <!-- </picker> -->
- <view class='mibox'>
- <view class="tit">详情描述</view>
- <textarea placeholder="请输入详情描述内容……" v-model="reason" :auto-height="autoHeight"></textarea>
- </view>
- <view class="rebtn mt30" @click="getSubmit">确认</view>
- </view>
- </template>
- <script>
- // import tabSearch from "@/components/toptab/search.vue"
- import {getDictionaryFn} from '@/api/mine/register.js'
- import {getDeptList} from "@/api/mine/mine.js"
- import {getleaveAddFn,getstunoListFn} from "@/api/mine/files.js"
- export default {
- data(){
- return{
- rimg:require("@/mine/static/score/rimg.png"),
- autoHeight:true,
- qjlx:[],
-
- startTime:'',
- endTime:'',
- absenteeName:'',
- qjlbidx:0,
- category:'',//请假类别
- categoryval:'',//请假类别
- datainfo:{
-
- },
- roles:'',
- studentlist:[],
- name:'',
- nameidx:0,
- classidx:0,
- studentId:'',
- classId:'',
- className:'',
- psychologicalDescription:'',
- daflag:false,
- qjlxrange:[],
- reason:'',
- classlist:[],//班级
- }
- },
- onLoad: function(e) {
- this.init();
- if(e.type&&e.type=='daup'){
- this.name=e.name;
- this.studentId=e.id;
- this.daflag=true;
- }else{
- var roles=this.$store.state.user.choseroles;
- this.roles=roles;
- if(roles=='parents'){
- var newArr=this.$store.state.user.student;
- if(newArr&&newArr.length){
- if(newArr.length>1){
- this.studentlist = newArr.map(v => {
- return {
- dictLabel:v.studentName,
- dictValue: v.id,
- classId:v.classId
- }
- })
- }else{
- // 一个娃
- this.name=newArr[0].studentName
- this.studentId=newArr[0].id
- this.classId=newArr[0].classId
- }
- }
- }else if(roles=='teacher'){
- var newArr=this.$store.state.user.teacherClass;
- if(newArr&&newArr.length){
- this.classlist = newArr.map(v => {
- return {
- dictLabel:v.className,
- dictValue: v.classId,
- }
- })
- }
- }else{
- var id=this.$store.state.user.deptId;
- this.getclassListFn(id)
- }
-
- }
- },
- methods:{
- init(){
- //心理健康状态
- getDictionaryFn('qjlx').then(res=>{
- if(res.code==200){
- this.qjlxrange = res.data.map(v => {
- return {
- dictLabel: v.dictLabel,
- dictValue: v.dictValue
- }
- })
- }
- })
- },
- changeLog(){
-
- },
- getclassListFn(id){
- getDeptList(id).then(res=>{
- if(res.code==200){
- var newArr=res.data;
- if(newArr&&newArr.length){
- this.classlist = newArr.map(v => {
- return {
- dictLabel: v.deptName,
- dictValue: v.deptId,
-
- }
- })
- }
- }else{
- this.$toast(res.msg)
- }
- })
- },
- bindDateChangea(e){
- var idx=e.detail.value
- this.name=this.studentlist[idx].dictLabel
- this.studentId=this.studentlist[idx].dictValue
- this.classId=this.studentlist[idx].classId
- },
- bindDateChangeb(e){
- var idx=e.detail.value
- this.className=this.classlist[idx].dictLabel
- this.classId=this.classlist[idx].dictValue
- this.name='';
- this.studentId='';
- // 获取班级信息
- this.getstunoListFn()
- },
- bindDateChanged(e){
- var idx=e.detail.value
- this.category=this.qjlxrange[idx].dictLabel
- this.categoryval=this.qjlxrange[idx].dictValue
- },
- getstunoListFn(){
- var params={
- classId:this.classId
- }
- params['params[role]']=this.$store.state.user.choseroles
- getstunoListFn(params).then(res=>{
- if(res.code==200){
- this.studentlist = res.rows.map(v => {
- return {
- dictLabel: v.studentName,
- dictValue: v.id,
- classId:v.classId
- }
- })
- }
- })
- },
- getSubmit(){
- // 学生 id
- var roles=this.$store.state.user.choseroles;
- var that=this;
- if(roles!="parents"){
- if(!this.className){
- this.$toast('请选择班级')
- return
- }
- }
- if(!this.studentId){
- this.$toast('请选择人员')
- return
- }
- if(!this.category){
- this.$toast('请选择请假类别')
- return
- }
- if(!this.startTime){
- this.$toast('请选择开始时间')
- return
- }
- if(!this.endTime){
- this.$toast('请选择结束时间')
- return
- }
- var params={
- absenteeId:this.studentId,
- category:this.categoryval,
- reason:this.reason,
- startTime:this.startTime+':00',
- endTime:this.endTime+':00',
- classId:this.classId,
- absenteeName:this.name,
- }
- params['params[role]']=this.$store.state.user.choseroles
- // if(roles=='teacher'){
- // params.createType='2'
- // }else if(roles=='parents'){
- // params.createType='1'
- // }
- getleaveAddFn(params).then(res => {
- if (res.code == 200) {
- that.$toast('新增成功')
- setTimeout(function() {
- if(that.daflag){
- uni.$emit('refreshleavelist');
- uni.redirectTo({
- url:'/mine/pages/files/leavelist?type=da&id='+that.studentId+'&name='+that.name
- })
- }else{
- uni.$emit('refreshleavelist');
- uni.navigateBack({
- delta:1
- })
- }
- }, 1500)
- } else {
- this.$toast(res.msg)
- }
- })
- },
- },
-
- }
- </script>
- <style lang="scss" scoped>
- .mind{
- min-height: 100vh;background: #ffffff;padding: 80rpx 60rpx;
- .mibox{
- .tit{font-size: 32rpx;font-weight: 500;color: #161616;margin-bottom: 40rpx;}
- textarea{border: 2rpx solid #FFB132;border-radius: 20rpx;width: 100%;min-height: 230rpx;padding:32rpx;box-sizing: border-box;}
- .rimg{width: 14rpx;height: 24rpx;flex: 0 0 auto;margin-left: 12rpx;}
- }
- }
- .mind /deep/ .uni-input-wrapper{text-align: right;font-size: 30rpx;}
- .mind /deep/ .uni-date__x-input{padding: 0;text-align: right;font-size: 30rpx;}
- .mind /deep/ .uni-date-x{padding: 0;}
- .mind /deep/ .uniui-calendar::before{display: none;}
- .mind /deep/ .uni-input-placeholder{color:#AAAAAA;font-size: 30rpx;}
- </style>
|