Commit ea293c3b authored by Mac's avatar Mac

课耗修改

parent d09c93c5
......@@ -76,7 +76,7 @@
<div class="col-3" v-if='datetype==1'>
<q-field filled>
 <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)">
</el-date-picker>    
</template>
......@@ -85,9 +85,15 @@
<div class="col-3" v-if='datetype==2'>
<q-field filled>
 <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)">
</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>
</q-field>
</div>
......@@ -182,7 +188,8 @@
created() {
let userinfo = this.getLocalStorage();
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()
},
......@@ -194,18 +201,7 @@
},
methods: {
getList() {
if(this.valuemonth ==null || this.valueyear==null){
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) {
if (this.datetype == 1) {
this.msg.StartMonth = this.valueyear + '-01';
this.msg.EndMonth = this.valueyear + '-12';
}
......@@ -245,57 +241,71 @@
})
},
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, {
id: id,
datetype:this.datetype,
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) {
this.msg.pageIndex = val;
this.getList()
},
txexport() {
if(this.valuemonth ==null || this.valueyear==null){
this.$q.notify({
type: 'negative',
position: "top",
message: `请选择日期`
})
return
}
let text = '';
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) {
text = this.valueyear+'年课耗统计.xls'
}
var msg = JSON.parse(JSON.stringify(this.msg));
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 @@
<div class="col-3" v-if='datetype==1'>
<q-field filled>
 <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)">
</el-date-picker>    
</template>
......@@ -96,9 +96,12 @@
<div class="col-3" v-if='datetype==2'>
<q-field filled>
 <template v-slot:control>
<el-date-picker v-model="valuemonth" type="month" placeholder="选择月份" value-format="yyyy-MM"
@change="handleCurrentChanges(1)">
</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>
</q-field>
</div>
......@@ -200,7 +203,8 @@
created() {
let userinfo = this.getLocalStorage();
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()
if(this.$route.query && this.$route.query.id){
this.msg.TeacherId = Number(this.$route.query.id)
......@@ -211,8 +215,11 @@
if(this.$route.query && this.$route.query.valueyear){
this.valueyear = this.$route.query.valueyear
}
if(this.$route.query && this.$route.query.valuemonth){
this.valuemonth = this.$route.query.valuemonth
if(this.$route.query && this.$route.query.StartMonth){
this.msg.StartMonth = this.$route.query.StartMonth
}
if(this.$route.query && this.$route.query.EndMonth){
this.msg.EndMonth = this.$route.query.EndMonth
}
},
mounted() {
......@@ -223,18 +230,8 @@
},
methods: {
getList() {
if(this.valuemonth ==null || this.valueyear==null){
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) {
if (this.datetype == 1) {
this.msg.StartMonth = this.valueyear + '-01';
this.msg.EndMonth = this.valueyear + '-12';
}
......@@ -287,17 +284,14 @@
this.getList()
},
txexport(){
if(this.valuemonth ==null || this.valueyear==null){
this.$q.notify({
type: 'negative',
position: "top",
message: `请选择日期`
})
return
}
let text = '';
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) {
text = this.valueyear+'年课耗学生明细.xls'
}
......@@ -308,6 +302,45 @@
this.OpenNewUrl('/sale/orderStatistics', {
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 @@
<div class="col-3" v-if='datetype==1'>
<q-field filled>
 <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)">
</el-date-picker>    
</template>
......@@ -84,9 +84,13 @@
<div class="col-3" v-if='datetype==2'>
<q-field filled>
 <template v-slot:control>
<el-date-picker v-model="valuemonth" type="month" placeholder="选择月份" value-format="yyyy-MM"
@change="handleCurrentChanges(1)">
</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>
</q-field>
</div>
......@@ -164,14 +168,15 @@
TeacherList: [],
datetypelist: [
{ Id: '2', Name: '月份' },
// { Id: '1', Name: '年份' },
{ Id: '1', Name: '年份' },
]
}
},
created() {
let userinfo = this.getLocalStorage();
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()
if(this.$route.query && this.$route.query.id){
this.msg.TeacherId = Number(this.$route.query.id)
......@@ -182,8 +187,11 @@
if(this.$route.query && this.$route.query.valueyear){
this.valueyear = this.$route.query.valueyear
}
if(this.$route.query && this.$route.query.valuemonth){
this.valuemonth = this.$route.query.valuemonth
if(this.$route.query && this.$route.query.StartMonth){
this.msg.StartMonth = this.$route.query.StartMonth
}
if(this.$route.query && this.$route.query.EndMonth){
this.msg.EndMonth = this.$route.query.EndMonth
}
},
mounted() {
......@@ -194,18 +202,8 @@
},
methods: {
getList() {
if(this.valuemonth ==null || this.valueyear==null){
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) {
if (this.datetype == 1) {
this.msg.StartMonth = this.valueyear + '-01';
this.msg.EndMonth = this.valueyear + '-12';
}
......@@ -258,23 +256,60 @@
this.getList()
},
txexport(){
if(this.valuemonth ==null || this.valueyear==null){
this.$q.notify({
type: 'negative',
position: "top",
message: `请选择日期`
})
return
}
let text = '';
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) {
text = this.valueyear+'年课耗老师明细.xls'
}
var msg = JSON.parse(JSON.stringify(this.msg));
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