Commit ea293c3b authored by Mac's avatar Mac

课耗修改

parent d09c93c5
...@@ -76,7 +76,7 @@ ...@@ -76,7 +76,7 @@
<div class="col-3" v-if='datetype==1'> <div class="col-3" v-if='datetype==1'>
<q-field filled> <q-field filled>
 <template v-slot:control>  <template v-slot:control>
<el-date-picker v-model="valueyear" type="year" placeholder="选择年份" value-format="yyyy" <el-date-picker v-model="valueyear" type="year" placeholder="选择年份" value-format="yyyy" :clearable='false'
@change="handleCurrentChanges(1)"> @change="handleCurrentChanges(1)">
</el-date-picker>     </el-date-picker>    
</template> </template>
...@@ -85,9 +85,15 @@ ...@@ -85,9 +85,15 @@
<div class="col-3" v-if='datetype==2'> <div class="col-3" v-if='datetype==2'>
<q-field filled> <q-field filled>
 <template v-slot:control>  <template v-slot:control>
<el-date-picker v-model="valuemonth" type="month" placeholder="选择月份" value-format="yyyy-MM" <!-- <el-date-picker v-model="valuemonth" type="month" placeholder="选择月份" value-format="yyyy-MM"
@change="handleCurrentChanges(1)"> @change="handleCurrentChanges(1)">
</el-date-picker>     </el-date-picker>     -->
<el-date-picker v-model="msg.StartMonth" type="month" placeholder="开始月份" size="small" style="width:47%;" value-format="yyyy-MM" :clearable='false'
@change="choicemonth(1)" clear-icon="iconfont icon-guanbi">
</el-date-picker>
<el-date-picker v-model="msg.EndMonth" type="month" placeholder="结束月份" size="small" style="width:47%;" value-format="yyyy-MM" :clearable='false'
@change="choicemonth(2)" clear-icon="iconfont icon-guanbi">
</el-date-picker>
</template> </template>
</q-field> </q-field>
</div> </div>
...@@ -182,7 +188,8 @@ ...@@ -182,7 +188,8 @@
created() { created() {
let userinfo = this.getLocalStorage(); let userinfo = this.getLocalStorage();
var myDate = new Date(); var myDate = new Date();
this.valuemonth = myDate.getFullYear() + "-" + (myDate.getMonth() + 1) this.msg.StartMonth = myDate.getFullYear() + "-" + (myDate.getMonth() + 1)
this.msg.EndMonth = myDate.getFullYear() + "-" + (myDate.getMonth() + 1)
this.valueyear = myDate.getFullYear().toString() this.valueyear = myDate.getFullYear().toString()
}, },
...@@ -194,21 +201,10 @@ ...@@ -194,21 +201,10 @@
}, },
methods: { methods: {
getList() { getList() {
if(this.valuemonth ==null || this.valueyear==null){ if (this.datetype == 1) {
this.$q.notify({
type: 'negative',
position: "top",
message: `请选择日期`
})
return
}
if (this.datetype == 2) {
this.msg.StartMonth = this.valuemonth;
this.msg.EndMonth = this.valuemonth;
} else if (this.datetype == 1) {
this.msg.StartMonth = this.valueyear + '-01'; this.msg.StartMonth = this.valueyear + '-01';
this.msg.EndMonth = this.valueyear + '-12'; this.msg.EndMonth = this.valueyear + '-12';
} }
this.loading = true; this.loading = true;
getTeacherConsumptionHoursStatistics(this.msg).then(res => { getTeacherConsumptionHoursStatistics(this.msg).then(res => {
if (res.Code == 1) { if (res.Code == 1) {
...@@ -245,57 +241,71 @@ ...@@ -245,57 +241,71 @@
}) })
}, },
goUrl(path, id) { goUrl(path, id) {
if(this.valuemonth ==null || this.valueyear==null){
this.$q.notify({
type: 'negative',
position: "top",
message: `请选择日期`
})
return
}
if(path == 'teacherclassfee' && this.datetype==1){
this.$q.notify({
type: 'negative',
position: "top",
message: `老师只能按月份查看`
})
return
}
this.OpenNewUrl('/financial/' + path, { this.OpenNewUrl('/financial/' + path, {
id: id, id: id,
datetype:this.datetype, datetype:this.datetype,
valueyear:this.valueyear, valueyear:this.valueyear,
valuemonth:this.valuemonth, StartMonth:this.msg.StartMonth,
EndMonth:this.msg.EndMonth,
}); });
// this.$router.push({
// path: '/financial/' + path,
// query: {
// id: id,
// blank: 'y',
// }
// })
}, },
handleCurrentChanges(val) { handleCurrentChanges(val) {
this.msg.pageIndex = val; this.msg.pageIndex = val;
this.getList() this.getList()
}, },
txexport() { txexport() {
if(this.valuemonth ==null || this.valueyear==null){
this.$q.notify({
type: 'negative',
position: "top",
message: `请选择日期`
})
return
}
let text = ''; let text = '';
if (this.datetype == 2) { if (this.datetype == 2) {
text = this.valuemonth +'课耗统计.xls' if(new Date(this.msg.StartMonth).getTime() == new Date(this.msg.EndMonth).getTime()){
text = this.msg.StartMonth+'课耗统计.xls'
}else{
text = this.msg.StartMonth+'-'+ this.msg.EndMonth +'课耗统计.xls'
}
} else if (this.datetype == 1) { } else if (this.datetype == 1) {
text = this.valueyear+'年课耗统计.xls' text = this.valueyear+'年课耗统计.xls'
} }
var msg = JSON.parse(JSON.stringify(this.msg)); var msg = JSON.parse(JSON.stringify(this.msg));
EduDownLoad("/finance/GetTeacherConsumptionHoursStatisticsToExcel", msg, text) EduDownLoad("/finance/GetTeacherConsumptionHoursStatisticsToExcel", msg, text)
},
choicemonth(val){
let StartMonth = JSON.parse(JSON.stringify(this.msg.StartMonth))
let EndMonth = JSON.parse(JSON.stringify(this.msg.EndMonth))
if(val==1){//判断选择的时候开始时间大于结束时间的处理
if(new Date(StartMonth).getTime() > new Date(EndMonth).getTime()){
this.msg.EndMonth = this.msg.StartMonth
}
}else{
if(new Date(this.msg.StartMonth).getTime() > new Date(this.msg.EndMonth).getTime()){
this.msg.StartMonth = this.msg.EndMonth
}
}
let diff = this.dateMinus(this.msg.StartMonth,this.msg.EndMonth)
if(diff >11){
this.$q.notify({
type: 'negative',
position: "top",
message: `月份不能超过12个月`
})
if(val==1){//如果超哥12过月的处理
this.msg.StartMonth = this.msg.EndMonth
}else{
this.msg.EndMonth = this.msg.StartMonth
}
return
}
setTimeout(()=>{
this.handleCurrentChanges(1)
},10)
},
//两个日期相差几个月
dateMinus(d1, d2) {
var m1 = parseInt(d1.split("-")[1].replace(/^0+/, "")) + parseInt(d1.split("-")[0]) * 12;
var m2 = parseInt(d2.split("-")[1].replace(/^0+/, "")) + parseInt(d2.split("-")[0]) * 12;
var diff = m2 - m1;
return diff;
} }
......
...@@ -87,7 +87,7 @@ ...@@ -87,7 +87,7 @@
<div class="col-3" v-if='datetype==1'> <div class="col-3" v-if='datetype==1'>
<q-field filled> <q-field filled>
 <template v-slot:control>  <template v-slot:control>
<el-date-picker v-model="valueyear" type="year" placeholder="选择年份" value-format="yyyy" <el-date-picker v-model="valueyear" type="year" placeholder="选择年份" value-format="yyyy" :clearable='false'
@change="handleCurrentChanges(1)"> @change="handleCurrentChanges(1)">
</el-date-picker>     </el-date-picker>    
</template> </template>
...@@ -96,9 +96,12 @@ ...@@ -96,9 +96,12 @@
<div class="col-3" v-if='datetype==2'> <div class="col-3" v-if='datetype==2'>
<q-field filled> <q-field filled>
 <template v-slot:control>  <template v-slot:control>
<el-date-picker v-model="valuemonth" type="month" placeholder="选择月份" value-format="yyyy-MM" <el-date-picker v-model="msg.StartMonth" type="month" placeholder="开始月份" size="small" style="width:47%;" value-format="yyyy-MM" :clearable='false'
@change="handleCurrentChanges(1)"> @change="choicemonth(1)" clear-icon="iconfont icon-guanbi">
</el-date-picker>     </el-date-picker>
<el-date-picker v-model="msg.EndMonth" type="month" placeholder="结束月份" size="small" style="width:47%;" value-format="yyyy-MM" :clearable='false'
@change="choicemonth(2)" clear-icon="iconfont icon-guanbi">
</el-date-picker> 
</template> </template>
</q-field> </q-field>
</div> </div>
...@@ -200,7 +203,8 @@ ...@@ -200,7 +203,8 @@
created() { created() {
let userinfo = this.getLocalStorage(); let userinfo = this.getLocalStorage();
var myDate = new Date(); var myDate = new Date();
this.valuemonth = myDate.getFullYear() + "-" + (myDate.getMonth() + 1) this.msg.StartMonth = myDate.getFullYear() + "-" + (myDate.getMonth() + 1)
this.msg.EndMonth = myDate.getFullYear() + "-" + (myDate.getMonth() + 1)
this.valueyear = myDate.getFullYear().toString() this.valueyear = myDate.getFullYear().toString()
if(this.$route.query && this.$route.query.id){ if(this.$route.query && this.$route.query.id){
this.msg.TeacherId = Number(this.$route.query.id) this.msg.TeacherId = Number(this.$route.query.id)
...@@ -211,8 +215,11 @@ ...@@ -211,8 +215,11 @@
if(this.$route.query && this.$route.query.valueyear){ if(this.$route.query && this.$route.query.valueyear){
this.valueyear = this.$route.query.valueyear this.valueyear = this.$route.query.valueyear
} }
if(this.$route.query && this.$route.query.valuemonth){ if(this.$route.query && this.$route.query.StartMonth){
this.valuemonth = this.$route.query.valuemonth this.msg.StartMonth = this.$route.query.StartMonth
}
if(this.$route.query && this.$route.query.EndMonth){
this.msg.EndMonth = this.$route.query.EndMonth
} }
}, },
mounted() { mounted() {
...@@ -223,21 +230,11 @@ ...@@ -223,21 +230,11 @@
}, },
methods: { methods: {
getList() { getList() {
if(this.valuemonth ==null || this.valueyear==null){
this.$q.notify({ if (this.datetype == 1) {
type: 'negative',
position: "top",
message: `请选择日期`
})
return
}
if (this.datetype == 2) {
this.msg.StartMonth = this.valuemonth;
this.msg.EndMonth = this.valuemonth;
} else if (this.datetype == 1) {
this.msg.StartMonth = this.valueyear + '-01'; this.msg.StartMonth = this.valueyear + '-01';
this.msg.EndMonth = this.valueyear + '-12'; this.msg.EndMonth = this.valueyear + '-12';
} }
this.loading = true; this.loading = true;
getStudentConsumptionHoursDetialPageList(this.msg).then(res => { getStudentConsumptionHoursDetialPageList(this.msg).then(res => {
if (res.Code == 1) { if (res.Code == 1) {
...@@ -287,17 +284,14 @@ ...@@ -287,17 +284,14 @@
this.getList() this.getList()
}, },
txexport(){ txexport(){
if(this.valuemonth ==null || this.valueyear==null){
this.$q.notify({
type: 'negative',
position: "top",
message: `请选择日期`
})
return
}
let text = ''; let text = '';
if (this.datetype == 2) { if (this.datetype == 2) {
text = this.valuemonth +'课耗学生明细.xls' if(new Date(this.msg.StartMonth).getTime() == new Date(this.msg.EndMonth).getTime()){
text = this.msg.StartMonth+'课耗学生明细.xls'
}else{
text = this.msg.StartMonth+'-'+ this.msg.EndMonth +'课耗学生明细.xls'
}
} else if (this.datetype == 1) { } else if (this.datetype == 1) {
text = this.valueyear+'年课耗学生明细.xls' text = this.valueyear+'年课耗学生明细.xls'
} }
...@@ -308,6 +302,45 @@ ...@@ -308,6 +302,45 @@
this.OpenNewUrl('/sale/orderStatistics', { this.OpenNewUrl('/sale/orderStatistics', {
OrderId: Id OrderId: Id
}); });
},
choicemonth(val){
let StartMonth = JSON.parse(JSON.stringify(this.msg.StartMonth))
let EndMonth = JSON.parse(JSON.stringify(this.msg.EndMonth))
if(val==1){//判断选择的时候开始时间大于结束时间的处理
if(new Date(StartMonth).getTime() > new Date(EndMonth).getTime()){
this.msg.EndMonth = this.msg.StartMonth
}
}else{
if(new Date(this.msg.StartMonth).getTime() > new Date(this.msg.EndMonth).getTime()){
this.msg.StartMonth = this.msg.EndMonth
}
}
let diff = this.dateMinus(this.msg.StartMonth,this.msg.EndMonth)
if(diff >11){
this.$q.notify({
type: 'negative',
position: "top",
message: `月份不能超过12个月`
})
if(val==1){//如果超哥12过月的处理
this.msg.StartMonth = this.msg.EndMonth
}else{
this.msg.EndMonth = this.msg.StartMonth
}
return
}
setTimeout(()=>{
this.handleCurrentChanges(1)
},10)
},
//两个日期相差几个月
dateMinus(d1, d2) {
var m1 = parseInt(d1.split("-")[1].replace(/^0+/, "")) + parseInt(d1.split("-")[0]) * 12;
var m2 = parseInt(d2.split("-")[1].replace(/^0+/, "")) + parseInt(d2.split("-")[0]) * 12;
var diff = m2 - m1;
return diff;
} }
}, },
......
...@@ -75,7 +75,7 @@ ...@@ -75,7 +75,7 @@
<div class="col-3" v-if='datetype==1'> <div class="col-3" v-if='datetype==1'>
<q-field filled> <q-field filled>
 <template v-slot:control>  <template v-slot:control>
<el-date-picker v-model="valueyear" type="year" placeholder="选择年份" value-format="yyyy" <el-date-picker v-model="valueyear" type="year" placeholder="选择年份" value-format="yyyy" :clearable='false'
@change="handleCurrentChanges(1)"> @change="handleCurrentChanges(1)">
</el-date-picker>     </el-date-picker>    
</template> </template>
...@@ -84,9 +84,13 @@ ...@@ -84,9 +84,13 @@
<div class="col-3" v-if='datetype==2'> <div class="col-3" v-if='datetype==2'>
<q-field filled> <q-field filled>
 <template v-slot:control>  <template v-slot:control>
<el-date-picker v-model="valuemonth" type="month" placeholder="选择月份" value-format="yyyy-MM"
@change="handleCurrentChanges(1)"> <el-date-picker v-model="msg.StartMonth" type="month" placeholder="开始月份" size="small" style="width:47%;" value-format="yyyy-MM" :clearable='false'
</el-date-picker>     @change="choicemonth(1)" clear-icon="iconfont icon-guanbi">
</el-date-picker>
<el-date-picker v-model="msg.EndMonth" type="month" placeholder="结束月份" size="small" style="width:47%;" value-format="yyyy-MM" :clearable='false'
@change="choicemonth(2)" clear-icon="iconfont icon-guanbi">
</el-date-picker> 
</template> </template>
</q-field> </q-field>
</div> </div>
...@@ -164,14 +168,15 @@ ...@@ -164,14 +168,15 @@
TeacherList: [], TeacherList: [],
datetypelist: [ datetypelist: [
{ Id: '2', Name: '月份' }, { Id: '2', Name: '月份' },
// { Id: '1', Name: '年份' }, { Id: '1', Name: '年份' },
] ]
} }
}, },
created() { created() {
let userinfo = this.getLocalStorage(); let userinfo = this.getLocalStorage();
var myDate = new Date(); var myDate = new Date();
this.valuemonth = myDate.getFullYear() + "-" + (myDate.getMonth() + 1) this.msg.StartMonth = myDate.getFullYear() + "-" + (myDate.getMonth() + 1)
this.msg.EndMonth = myDate.getFullYear() + "-" + (myDate.getMonth() + 1)
this.valueyear = myDate.getFullYear().toString() this.valueyear = myDate.getFullYear().toString()
if(this.$route.query && this.$route.query.id){ if(this.$route.query && this.$route.query.id){
this.msg.TeacherId = Number(this.$route.query.id) this.msg.TeacherId = Number(this.$route.query.id)
...@@ -182,8 +187,11 @@ ...@@ -182,8 +187,11 @@
if(this.$route.query && this.$route.query.valueyear){ if(this.$route.query && this.$route.query.valueyear){
this.valueyear = this.$route.query.valueyear this.valueyear = this.$route.query.valueyear
} }
if(this.$route.query && this.$route.query.valuemonth){ if(this.$route.query && this.$route.query.StartMonth){
this.valuemonth = this.$route.query.valuemonth this.msg.StartMonth = this.$route.query.StartMonth
}
if(this.$route.query && this.$route.query.EndMonth){
this.msg.EndMonth = this.$route.query.EndMonth
} }
}, },
mounted() { mounted() {
...@@ -194,21 +202,11 @@ ...@@ -194,21 +202,11 @@
}, },
methods: { methods: {
getList() { getList() {
if(this.valuemonth ==null || this.valueyear==null){
this.$q.notify({ if (this.datetype == 1) {
type: 'negative',
position: "top",
message: `请选择日期`
})
return
}
if (this.datetype == 2) {
this.msg.StartMonth = this.valuemonth;
this.msg.EndMonth = this.valuemonth;
} else if (this.datetype == 1) {
this.msg.StartMonth = this.valueyear + '-01'; this.msg.StartMonth = this.valueyear + '-01';
this.msg.EndMonth = this.valueyear + '-12'; this.msg.EndMonth = this.valueyear + '-12';
} }
this.loading = true; this.loading = true;
getTeacherConsumptionHoursDetialPageList(this.msg).then(res => { getTeacherConsumptionHoursDetialPageList(this.msg).then(res => {
if (res.Code == 1) { if (res.Code == 1) {
...@@ -258,24 +256,61 @@ ...@@ -258,24 +256,61 @@
this.getList() this.getList()
}, },
txexport(){ txexport(){
if(this.valuemonth ==null || this.valueyear==null){
this.$q.notify({
type: 'negative',
position: "top",
message: `请选择日期`
})
return
}
let text = ''; let text = '';
if (this.datetype == 2) { if (this.datetype == 2) {
text = this.valuemonth +'课耗老师明细.xls' if(new Date(this.msg.StartMonth).getTime() == new Date(this.msg.EndMonth).getTime()){
text = this.msg.StartMonth+'课耗老师明细.xls'
}else{
text = this.msg.StartMonth+'-'+ this.msg.EndMonth +'课耗老师明细.xls'
}
} else if (this.datetype == 1) { } else if (this.datetype == 1) {
text = this.valueyear+'年课耗老师明细.xls' text = this.valueyear+'年课耗老师明细.xls'
} }
var msg = JSON.parse(JSON.stringify(this.msg)); var msg = JSON.parse(JSON.stringify(this.msg));
EduDownLoad("/finance/GetTeacherConsumptionHoursDetialPageListToExcel", msg, text) EduDownLoad("/finance/GetTeacherConsumptionHoursDetialPageListToExcel", msg, text)
},
choicemonth(val){
let StartMonth = JSON.parse(JSON.stringify(this.msg.StartMonth))
let EndMonth = JSON.parse(JSON.stringify(this.msg.EndMonth))
if(val==1){//判断选择的时候开始时间大于结束时间的处理
if(new Date(StartMonth).getTime() > new Date(EndMonth).getTime()){
this.msg.EndMonth = this.msg.StartMonth
}
}else{
if(new Date(this.msg.StartMonth).getTime() > new Date(this.msg.EndMonth).getTime()){
this.msg.StartMonth = this.msg.EndMonth
}
}
let diff = this.dateMinus(this.msg.StartMonth,this.msg.EndMonth)
if(diff >11){
this.$q.notify({
type: 'negative',
position: "top",
message: `月份不能超过12个月`
})
if(val==1){//如果超哥12过月的处理
this.msg.StartMonth = this.msg.EndMonth
}else{
this.msg.EndMonth = this.msg.StartMonth
}
return
}
setTimeout(()=>{
this.handleCurrentChanges(1)
},10)
},
//两个日期相差几个月
dateMinus(d1, d2) {
var m1 = parseInt(d1.split("-")[1].replace(/^0+/, "")) + parseInt(d1.split("-")[0]) * 12;
var m2 = parseInt(d2.split("-")[1].replace(/^0+/, "")) + parseInt(d2.split("-")[0]) * 12;
var diff = m2 - m1;
return diff;
} }
}, },
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment