|
@@ -1,5 +1,6 @@
|
|
|
<template>
|
|
|
- <j-modal title="排班" :width="1000" :visible="visible" @ok="saves()" :fullscreen="true" switchFullscreen @cancel="handleCancel">
|
|
|
+ <j-modal title="排班" :width="1000" :visible="visible" @ok="saves()" :fullscreen="true" switchFullscreen
|
|
|
+ @cancel="handleCancel">
|
|
|
|
|
|
<a-spin :spinning="confirmLoading">
|
|
|
<!-- <a-form :form="form">
|
|
@@ -54,32 +55,28 @@
|
|
|
<div v-if="types=='2'">
|
|
|
<div class='month'>
|
|
|
<ul>
|
|
|
- <!--点击会触发pickpre函数,重新刷新当前日期 @click(vue v-on:click缩写) -->
|
|
|
+ <!--点击会触发pickpre函数,重新刷新当前日期 @click(vue v-on:click缩写) -->
|
|
|
<li class='arrow'>
|
|
|
- <a-popconfirm title="是否保存?" ok-text="是" cancel-text="否"
|
|
|
- @confirm="yes(1)"
|
|
|
- @cancel="no(1)"
|
|
|
- >
|
|
|
- <a-button type="primary" >上个月</a-button></a-popconfirm>
|
|
|
+ <a-popconfirm title="是否保存?" ok-text="是" cancel-text="否" @confirm="yes(1)" @cancel="no(1)">
|
|
|
+ <a-button type="primary">上个月</a-button>
|
|
|
+ </a-popconfirm>
|
|
|
</li>
|
|
|
<li class='year-month'>
|
|
|
<span class='choose-year'>{{ currentYear }}年</span>
|
|
|
<span class='choose-month'>{{ currentMonth }}月</span>
|
|
|
</li>
|
|
|
<li class='arrow'>
|
|
|
- <a-popconfirm title="是否保存?" ok-text="是" cancel-text="否"
|
|
|
- @confirm="yes(2)"
|
|
|
- @cancel="no(2)"
|
|
|
- >
|
|
|
- <a-button type="primary">下个月</a-button></a-popconfirm>
|
|
|
- </li>
|
|
|
+ <a-popconfirm title="是否保存?" ok-text="是" cancel-text="否" @confirm="yes(2)" @cancel="no(2)">
|
|
|
+ <a-button type="primary">下个月</a-button>
|
|
|
+ </a-popconfirm>
|
|
|
+ </li>
|
|
|
</ul>
|
|
|
<br>
|
|
|
</div>
|
|
|
|
|
|
<div>
|
|
|
- <a-table bordered :data-source="dataSource" :loading="loading" :columns="columns" :scroll="{ x:1000,y:600}" :pagination="ipagination"
|
|
|
- @change="handleTableChange">
|
|
|
+ <a-table bordered :data-source="dataSource" :loading="loading" :columns="columns" :scroll="{ x:1000,y:600}"
|
|
|
+ :pagination="ipagination" @change="handleTableChange">
|
|
|
<template v-for='(dayobject,i) in days' :slot="dayobject.day.getDate()" style="color: #ff6b81">
|
|
|
<div style="height: 35px;">
|
|
|
<div style="text-align: center;margin-top: -13px;">
|
|
@@ -96,30 +93,36 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
</template>
|
|
|
-
|
|
|
+
|
|
|
<span v-for='(d,i) in tpdata' style="margin-left: -13px;" :slot="d" slot-scope="text, record, index">
|
|
|
<a-dropdown :trigger="['click']">
|
|
|
- <a-tag closable @close="(e) => log(e,d,record)" color="blue" v-if="text=='休息'" @click="UserType(d,record,index,text)">{{text.substring(0,1)}}</a-tag>
|
|
|
- <a-tag color="red" style="margin-left: 10px;" v-if="text=='法'" @click="UserType(d,record,index,text)">{{text.substring(0,1)}}</a-tag>
|
|
|
- <a-tag closable @close="(e) => log(e,d,record)" color="#87d068" v-if="text!='休息'&&text!=''&&text!=null" @click="UserType(d,record,index,text)">
|
|
|
+ <a-tag closable @close="(e) => log(e,d,record)" color="blue" v-if="text=='休息'"
|
|
|
+ @click="UserType(d,record,index,text)">{{text.substring(0,1)}}</a-tag>
|
|
|
+ <a-tag color="red" style="margin-left: 10px;" v-if="text=='法'" @click="UserType(d,record,index,text)">
|
|
|
+ {{text.substring(0,1)}}</a-tag>
|
|
|
+ <a-tag closable @close="(e) => log(e,d,record)" color="#87d068" v-if="text!='休息'&&text!=''&&text!=null"
|
|
|
+ @click="UserType(d,record,index,text)">
|
|
|
{{text.substring(0,1)}}
|
|
|
</a-tag>
|
|
|
- <a-tag color="#FFFFFF" v-else @click="UserType(d,record,index,text)" style="width: 40px;height: 20px;margin-left: 4px;"> </a-tag>
|
|
|
+ <a-tag color="#FFFFFF" v-else @click="UserType(d,record,index,text)"
|
|
|
+ style="width: 40px;height: 20px;margin-left: 4px;"> </a-tag>
|
|
|
<a-menu slot="overlay" v-if="record.isColse" :style="isShow?'height:300px;overflow-y: scroll;':''">
|
|
|
<a-menu-item key="0" v-if="isShows">
|
|
|
<a @click="shiftOks(0,d,record,index)">休息</a>
|
|
|
</a-menu-item>
|
|
|
<a-menu-item v-if="isShow" v-for="(item,index) in shiftlist" :key="item.id">
|
|
|
- <a @click="shiftOks(item,d,record,index)">{{item.name}} <span>({{item.startDate}} - {{item.endDate}}<span v-if="item.shiftType==1"> / {{item.start2Date}} - {{item.end2Date}}</span>)</span></a>
|
|
|
+ <a @click="shiftOks(item,d,record,index)">{{item.name}} <span>({{item.startDate}} -
|
|
|
+ {{item.endDate}}<span v-if="item.shiftType==1"> / {{item.start2Date}} -
|
|
|
+ {{item.end2Date}}</span>)</span></a>
|
|
|
</a-menu-item>
|
|
|
</a-menu>
|
|
|
</a-dropdown>
|
|
|
|
|
|
</span>
|
|
|
- <template slot="names" slot-scope="text, record, index">
|
|
|
- <div style="height: 27px;">
|
|
|
+ <template slot="names" slot-scope="text, record, index">
|
|
|
+ <div style="height: 27px;">
|
|
|
{{text}}
|
|
|
- </div>
|
|
|
+ </div>
|
|
|
</template>
|
|
|
</a-table>
|
|
|
</div>
|
|
@@ -172,7 +175,12 @@
|
|
|
tts: false,
|
|
|
tpdata: [],
|
|
|
dataSource: [],
|
|
|
- savef:true,
|
|
|
+ savef: true,
|
|
|
+ ipagination:{
|
|
|
+
|
|
|
+ pageSize: 30,
|
|
|
+
|
|
|
+ },
|
|
|
columns: [],
|
|
|
queryParam: {
|
|
|
shiftDate: moment(new Date()).format('YYYY-MM-DD HH:mm:ss'),
|
|
@@ -200,7 +208,7 @@
|
|
|
shiftlist: null,
|
|
|
title: "操作",
|
|
|
visible: false,
|
|
|
- isSave:false,
|
|
|
+ isSave: false,
|
|
|
key: null,
|
|
|
index: null,
|
|
|
vs: false,
|
|
@@ -236,7 +244,7 @@
|
|
|
deptlist: "/sys/sysDepart/listAll",
|
|
|
delUserShift: '/userShift/userShift/delete',
|
|
|
edit: '/attendanceRule/attendanceRule/edit',
|
|
|
- userShiftDay:'/userShift/userShift/UserShiftType'
|
|
|
+ userShiftDay: '/userShift/userShift/UserShiftType'
|
|
|
},
|
|
|
}
|
|
|
},
|
|
@@ -244,7 +252,7 @@
|
|
|
this.initData(null)
|
|
|
this.queryShift()
|
|
|
},
|
|
|
- mounted () {
|
|
|
+ mounted() {
|
|
|
// this.h = document.querySelector('.ptp-layout-main').offsetHeight - 45
|
|
|
const _this = this
|
|
|
var tableBodyInnerNodeList = document.querySelectorAll('.ant-table-body-inner')
|
|
@@ -253,7 +261,7 @@
|
|
|
item.style.maxHeight = (parseInt(item.style.maxHeight) - 13) + 'px'
|
|
|
})
|
|
|
})
|
|
|
- window.addEventListener('resize', function () {
|
|
|
+ window.addEventListener('resize', function() {
|
|
|
// _this.h = document.querySelector('.ptp-layout-main').offsetHeight - 45
|
|
|
tableBodyInnerNodeList = document.querySelectorAll('.ant-table-body-inner')
|
|
|
tableBodyInnerNodeList.forEach(item => {
|
|
@@ -264,14 +272,14 @@
|
|
|
})
|
|
|
},
|
|
|
methods: {
|
|
|
- log(e,b,c){
|
|
|
- e.preventDefault();
|
|
|
- if(!c.isColse){
|
|
|
- this.$message.warning("当月已关账无法操作!");
|
|
|
- return;
|
|
|
- }
|
|
|
- var name="";
|
|
|
- var shift="";
|
|
|
+ log(e, b, c) {
|
|
|
+ e.preventDefault();
|
|
|
+ if (!c.isColse) {
|
|
|
+ this.$message.warning("当月已关账无法操作!");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ var name = "";
|
|
|
+ var shift = "";
|
|
|
if (b == 1) {
|
|
|
c.a1 = name;
|
|
|
c.shiftid1 = shift;
|
|
@@ -366,37 +374,37 @@
|
|
|
c.a31 = name;
|
|
|
c.shiftid31 = shift;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
},
|
|
|
- saves(){
|
|
|
- this.savef=true;
|
|
|
+ saves() {
|
|
|
+ this.savef = true;
|
|
|
this.save()
|
|
|
},
|
|
|
- yes(e){
|
|
|
- this.savef=false;
|
|
|
+ yes(e) {
|
|
|
+ this.savef = false;
|
|
|
this.save();
|
|
|
- if(e==1){
|
|
|
- this.pickPre(this.currentYear,this.currentMonth)
|
|
|
- }else if(e==2){
|
|
|
- this.pickNext(this.currentYear,this.currentMonth);
|
|
|
+ if (e == 1) {
|
|
|
+ this.pickPre(this.currentYear, this.currentMonth)
|
|
|
+ } else if (e == 2) {
|
|
|
+ this.pickNext(this.currentYear, this.currentMonth);
|
|
|
}
|
|
|
},
|
|
|
- no(e){
|
|
|
- if(e==1){
|
|
|
- this.pickPre(this.currentYear,this.currentMonth)
|
|
|
- }else if(e==2){
|
|
|
- this.pickNext(this.currentYear,this.currentMonth);
|
|
|
- }
|
|
|
+ no(e) {
|
|
|
+ if (e == 1) {
|
|
|
+ this.pickPre(this.currentYear, this.currentMonth)
|
|
|
+ } else if (e == 2) {
|
|
|
+ this.pickNext(this.currentYear, this.currentMonth);
|
|
|
+ }
|
|
|
},
|
|
|
tagBtnCloseFunc(e) {
|
|
|
const tags = this.selectUsers.filter(tag => tag !== e);
|
|
|
this.selectUsers = tags;
|
|
|
},
|
|
|
- UserType(e, a, index,text) {
|
|
|
- if(!a.isColse){
|
|
|
+ UserType(e, a, index, text) {
|
|
|
+ if (!a.isColse) {
|
|
|
this.$message.warning("当月已关账无法操作!");
|
|
|
return;
|
|
|
- }else if(text!=null&&text=='法'){
|
|
|
+ } else if (text != null && text == '法') {
|
|
|
this.isShow = false;
|
|
|
this.isShows = false;
|
|
|
return;
|
|
@@ -406,9 +414,9 @@
|
|
|
var d = new Date(this.formatDate(this.currentYear, this.currentMonth, e))
|
|
|
var obj = this.dataSource[index];
|
|
|
var list = [];
|
|
|
- var sum=0;
|
|
|
- var xsum=0;
|
|
|
- var f=false;
|
|
|
+ var sum = 0;
|
|
|
+ var xsum = 0;
|
|
|
+ var f = false;
|
|
|
if (d.getDay() == 1) {
|
|
|
list.push(this.getDays(0, d));
|
|
|
list.push(this.getDays(1, d));
|
|
@@ -467,60 +475,102 @@
|
|
|
list.push(this.getDays(0, d));
|
|
|
}
|
|
|
|
|
|
-
|
|
|
+ var date = "";
|
|
|
for (var i = 0; i < list.length; i++) {
|
|
|
if (list[i].split("-")[0] != this.currentYear || list[i].split("-")[1] != this.currentMonth) {
|
|
|
- getAction(this.url.userShiftDay, {
|
|
|
- userid: a.id,
|
|
|
- shiftDate:moment(new Date(list[i])).format('YYYY-MM-DD HH:mm:ss') ,
|
|
|
- }
|
|
|
- ).then((res) => {
|
|
|
- if (res.success) {
|
|
|
- if(res.result!=0&&res.result!='0'&&res.result!='1'&&res.result!=1){
|
|
|
- sum++;
|
|
|
- }else if(res.result==0||res.result=='0'){
|
|
|
- xsum++;
|
|
|
- }
|
|
|
- }
|
|
|
- }).finally(() => {
|
|
|
- })
|
|
|
- list.splice(i, 1)
|
|
|
+ date += list[i] + ",";
|
|
|
+ //list.splice(i, 1)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- for (var o = 0; o< list.length; o++) {
|
|
|
- for (var t in obj) { //用javascript的for/in循环遍历对象的属性
|
|
|
- if(this.currentYear==list[o].split("-")[0]&&this.currentMonth==list[o].split("-")[1]){
|
|
|
- if (t == "shiftid" + list[o].split("-")[2]&&list[o].split("-")[2]==e) {
|
|
|
- if(obj[t]!=0&&obj[t]!="0"&&obj[t]!=null){
|
|
|
- sum++;
|
|
|
- f=true;
|
|
|
- } if(obj[t]!=null&&obj[t]=="0"){
|
|
|
- xsum++;
|
|
|
+ if (date != "") {
|
|
|
+ getAction(this.url.userShiftDay, {
|
|
|
+ userId: a.id,
|
|
|
+ shiftId: date,
|
|
|
+ }).then((res) => {
|
|
|
+ if (res.success) {
|
|
|
+ xsum+=res.result.count;
|
|
|
+ sum+=res.result.counts;
|
|
|
+
|
|
|
+ for (var o = 0; o < list.length; o++) {
|
|
|
+ for (var t in obj) { //用javascript的for/in循环遍历对象的属性
|
|
|
+ if (this.currentYear == list[o].split("-")[0] && this.currentMonth == list[o].split("-")[1]) {
|
|
|
+ if (t == "shiftid" + list[o].split("-")[2] && list[o].split("-")[2] == e) {
|
|
|
+ if (obj[t] != "0" && obj[t] != null&&obj[t] != "1") {
|
|
|
+ sum++;
|
|
|
+ f = true;
|
|
|
+ }
|
|
|
+ if (obj[t] != null && obj[t] == "0") {
|
|
|
+ xsum++;
|
|
|
+ }
|
|
|
+ } else if (t == "shiftid" + list[o].split("-")[2]) {
|
|
|
+ if (obj[t] != "0" && obj[t] != null && obj[t] != "1") {
|
|
|
+ sum++;
|
|
|
+ }
|
|
|
+ if (obj[t] != null && obj[t] == "0") {
|
|
|
+ xsum++;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
- }else if(t == "shiftid" + list[o].split("-")[2]){
|
|
|
- if(obj[t]!=0&&obj[t]!="0"&&obj[t]!=null&&obj[t]!=1&&obj[t]!="1"){
|
|
|
- sum++;
|
|
|
- } if(obj[t]!=null&&obj[t]=="0"){
|
|
|
- xsum++;
|
|
|
+
|
|
|
+ if (a.category == 106) {
|
|
|
+ if (sum == 6 && f == false) {
|
|
|
+ this.isShow = false;
|
|
|
+ } else if (xsum == 1) {
|
|
|
+ this.isShows = false;
|
|
|
+ }
|
|
|
+
|
|
|
+ } else {
|
|
|
+ if (sum == 5 && f == false) {
|
|
|
+ this.isShow = false;
|
|
|
+ } else if (xsum == 2) {
|
|
|
+ this.isShows = false;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+ }).finally(() => {})
|
|
|
+ } else {
|
|
|
+ for (var o = 0; o < list.length; o++) {
|
|
|
+ for (var t in obj) { //用javascript的for/in循环遍历对象的属性
|
|
|
+ if (this.currentYear == list[o].split("-")[0] && this.currentMonth == list[o].split("-")[1]) {
|
|
|
+ if (t == "shiftid" + list[o].split("-")[2] && list[o].split("-")[2] == e) {
|
|
|
+ if (obj[t] != "0" && obj[t] != null&&obj[t] != "1") {
|
|
|
+ sum++;
|
|
|
+ f = true;
|
|
|
+ }
|
|
|
+ if (obj[t] != null && obj[t] == "0") {
|
|
|
+ xsum++;
|
|
|
+ }
|
|
|
+ } else if (t == "shiftid" + list[o].split("-")[2]) {
|
|
|
+ if (obj[t] != "0" && obj[t] != null && obj[t] != "1") {
|
|
|
+ sum++;
|
|
|
+ }
|
|
|
+ if (obj[t] != null && obj[t] == "0") {
|
|
|
+ xsum++;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- if (a.category == 106) {
|
|
|
- if (sum==6&&f==false) {
|
|
|
- this.isShow = false;
|
|
|
- }
|
|
|
+ if (a.category == 106) {
|
|
|
+ if (sum == 6 && f == false) {
|
|
|
+ this.isShow = false;
|
|
|
+ } else if (xsum == 1) {
|
|
|
+ this.isShows = false;
|
|
|
+ }
|
|
|
+
|
|
|
+ } else {
|
|
|
+ if (sum == 5 && f == false) {
|
|
|
+ this.isShow = false;
|
|
|
+ } else if (xsum == 2) {
|
|
|
+ this.isShows = false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- } else{
|
|
|
- if (sum==5&&f==false) {
|
|
|
- this.isShow = false;
|
|
|
- }else if(xsum==2){
|
|
|
- this.isShows = false;
|
|
|
- }
|
|
|
- }
|
|
|
},
|
|
|
// 获取当前时间,day为number,getDay(-1):昨天的日期;getDay(0):今天的日期;getDay(1):明天的日期;【以此类推】
|
|
|
getDays(day, date) {
|
|
@@ -1089,7 +1139,7 @@
|
|
|
userId: userid,
|
|
|
workDay: workDay,
|
|
|
ruleType: obj,
|
|
|
- name:this.currentYear+"-"+this.currentMonth
|
|
|
+ name: this.currentYear + "-" + this.currentMonth
|
|
|
},
|
|
|
typet).then((res) => {
|
|
|
if (res.success) {
|
|
@@ -1100,12 +1150,12 @@
|
|
|
}
|
|
|
}).finally(() => {
|
|
|
this.confirmLoading = false;
|
|
|
- if(this.savef){
|
|
|
+ if (this.savef) {
|
|
|
this.close();
|
|
|
}
|
|
|
- this.savef=true;
|
|
|
+ this.savef = true;
|
|
|
})
|
|
|
- if(this.savef){
|
|
|
+ if (this.savef) {
|
|
|
this.close();
|
|
|
}
|
|
|
},
|
|
@@ -1245,5 +1295,4 @@
|
|
|
background: #e1e1e1;
|
|
|
color: #fff;
|
|
|
}
|
|
|
-
|
|
|
-</style>
|
|
|
+</style>
|