user können sich in verschiedene dienstarten eintragen.
This commit is contained in:
parent
0a6994e107
commit
b4f5735947
|
@ -70,6 +70,7 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
|
this.getActiveUser()
|
||||||
for (let intDate = 1; intDate < 7; intDate++) {
|
for (let intDate = 1; intDate < 7; intDate++) {
|
||||||
if (
|
if (
|
||||||
new Date(
|
new Date(
|
||||||
|
@ -81,6 +82,7 @@ export default {
|
||||||
if (this.date.getDate() < intDate)
|
if (this.date.getDate() < intDate)
|
||||||
this.date = new Date(this.date.getFullYear(), this.date.getMonth(), 0)
|
this.date = new Date(this.date.getFullYear(), this.date.getMonth(), 0)
|
||||||
}
|
}
|
||||||
|
this.getAllJobKinds()
|
||||||
this.createMonth(this.date)
|
this.createMonth(this.date)
|
||||||
this.getAllUsers()
|
this.getAllUsers()
|
||||||
this.getUsers({
|
this.getUsers({
|
||||||
|
@ -103,10 +105,13 @@ export default {
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
...mapActions({
|
...mapActions({
|
||||||
|
getActiveUser: 'user/getUser',
|
||||||
getTransactJobs: 'requestJobs/getTransactJobs',
|
getTransactJobs: 'requestJobs/getTransactJobs',
|
||||||
createMonth: 'jobs/createMonth',
|
createMonth: 'jobs/createMonth',
|
||||||
getAllUsers: 'jobs/getAllUsers',
|
getAllUsers: 'jobs/getAllUsers',
|
||||||
getUsers: 'jobs/getUsers'
|
getUsers: 'jobs/getUsers',
|
||||||
|
getDBUsers: 'usermanager/getUsersWithExtern',
|
||||||
|
getAllJobKinds: 'jkm/getAllJobKinds',
|
||||||
}),
|
}),
|
||||||
changeMonth(value) {
|
changeMonth(value) {
|
||||||
if (value === -1) {
|
if (value === -1) {
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
<v-card :color="color(day)" max-width="250px" min-width="250px">
|
<v-card :color="color(day)" max-width="250px" min-width="250px">
|
||||||
<v-card-title v-if="day.date" class="subtitle-1 font-weight-bold">
|
<v-card-title v-if="day.date" class="subtitle-1 font-weight-bold">
|
||||||
{{ day.name }} den {{ day.date.getDate() }}.{{
|
{{ day.name }} den {{ day.date.getDate() }}.{{
|
||||||
day.date.getMonth() + 1
|
day.date.getMonth() + 1
|
||||||
}}.{{ day.date.getFullYear() }}
|
}}.{{ day.date.getFullYear() }}
|
||||||
</v-card-title>
|
</v-card-title>
|
||||||
<v-card-text>
|
<v-card-text>
|
||||||
|
@ -14,25 +14,36 @@
|
||||||
</v-expand-transition>
|
</v-expand-transition>
|
||||||
<v-expand-transition>
|
<v-expand-transition>
|
||||||
<div v-show="!day.loading">
|
<div v-show="!day.loading">
|
||||||
<div v-for="worker in day.worker" :key="day.worker.indexOf(worker)">
|
<div
|
||||||
<v-chip
|
v-for="(jobkinddateitem, index) in day.jobkinddate"
|
||||||
style="margin: 3px;"
|
:key="index"
|
||||||
:close="
|
>
|
||||||
(user(worker) && !day.locked) || (canDelete && user(worker))
|
<div class="title black--text text-sm-center">
|
||||||
"
|
{{ jobkinddateitem.job_kind.name }}
|
||||||
@click:close="
|
</div>
|
||||||
deleteJob({
|
<v-combobox
|
||||||
year: day.date.getFullYear(),
|
multiple
|
||||||
month: day.date.getMonth() + 1,
|
filled
|
||||||
day: day.date.getDate()
|
disabled
|
||||||
})
|
readonly
|
||||||
"
|
:counter="jobkinddateitem.maxpersons"
|
||||||
>{{ worker.firstname }} {{ worker.lastname }}</v-chip>
|
v-model="jobkinddateitem.worker"
|
||||||
|
:item-text="item => item.firstname + ' ' + item.lastname"
|
||||||
|
item-value="username"
|
||||||
|
chips
|
||||||
|
append-icon=""
|
||||||
|
>
|
||||||
|
<template v-slot:selection="data">
|
||||||
|
<v-chip
|
||||||
|
>{{ data.item.firstname }} {{ data.item.lastname }}</v-chip
|
||||||
|
>
|
||||||
|
</template>
|
||||||
|
</v-combobox>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</v-expand-transition>
|
</v-expand-transition>
|
||||||
</v-card-text>
|
</v-card-text>
|
||||||
<div v-if="userInWorker && day.locked">
|
<div v-if="userInWorker() && day.locked">
|
||||||
<v-card-actions class="text--secondary">
|
<v-card-actions class="text--secondary">
|
||||||
<v-autocomplete
|
<v-autocomplete
|
||||||
return-object
|
return-object
|
||||||
|
@ -50,7 +61,10 @@
|
||||||
</template>
|
</template>
|
||||||
<template v-slot:item="data">
|
<template v-slot:item="data">
|
||||||
<v-list-item-content>
|
<v-list-item-content>
|
||||||
<v-list-item-title>{{ data.item.firstname }} {{ data.item.lastname }}</v-list-item-title>
|
<v-list-item-title
|
||||||
|
>{{ data.item.firstname }}
|
||||||
|
{{ data.item.lastname }}</v-list-item-title
|
||||||
|
>
|
||||||
</v-list-item-content>
|
</v-list-item-content>
|
||||||
</template>
|
</template>
|
||||||
</v-autocomplete>
|
</v-autocomplete>
|
||||||
|
@ -59,35 +73,43 @@
|
||||||
<v-btn text block @click="send">senden</v-btn>
|
<v-btn text block @click="send">senden</v-btn>
|
||||||
</v-card-actions>
|
</v-card-actions>
|
||||||
</div>
|
</div>
|
||||||
<v-card-actions class="text--secondary">
|
<v-card-actions
|
||||||
<div v-if="!userInWorker">
|
class="text--secondary"
|
||||||
<div v-if="day.locked">
|
v-if="!day.loading"
|
||||||
Du kannst dich nicht zum Bardienst eintragen, da der Tag gesperrt
|
v-show="filterAddJob.length > 0 && !userInWorker()"
|
||||||
ist.
|
>
|
||||||
</div>
|
<div>
|
||||||
<div v-else-if="day.worker.length >= 2">
|
<div>Hier kannst du dich zum Bardienst eintragen.</div>
|
||||||
Du kannst dich nicht Bardienst eintragen, da mehr als 2 Personen
|
<v-spacer />
|
||||||
schon eingetragen sind.
|
<v-menu
|
||||||
</div>
|
v-model="menu"
|
||||||
<div v-else>Hier kannst du dich zum Bardienst eintragen.</div>
|
open-on-hover
|
||||||
|
close-on-click
|
||||||
|
close-on-content-click
|
||||||
|
offset-y
|
||||||
|
>
|
||||||
|
<template v-slot:activator="{ on }">
|
||||||
|
<v-btn
|
||||||
|
text
|
||||||
|
v-on="on"
|
||||||
|
v-show="filterAddJob.length > 0 && !userInWorker()"
|
||||||
|
>
|
||||||
|
Eintragen
|
||||||
|
</v-btn>
|
||||||
|
</template>
|
||||||
|
<v-list>
|
||||||
|
<v-list-item
|
||||||
|
v-for="(jobkinddateitem, index) in filterAddJob"
|
||||||
|
:key="index"
|
||||||
|
@click="addingJob(jobkinddateitem)"
|
||||||
|
>
|
||||||
|
<v-list-item-title>
|
||||||
|
{{ jobkinddateitem.job_kind.name }}
|
||||||
|
</v-list-item-title>
|
||||||
|
</v-list-item>
|
||||||
|
</v-list>
|
||||||
|
</v-menu>
|
||||||
</div>
|
</div>
|
||||||
<v-spacer />
|
|
||||||
<v-btn
|
|
||||||
text
|
|
||||||
v-if="
|
|
||||||
!day.locked &&
|
|
||||||
!day.loading &&
|
|
||||||
day.worker.length < 2 &&
|
|
||||||
!userInWorker
|
|
||||||
"
|
|
||||||
@click="
|
|
||||||
addJob({
|
|
||||||
year: day.date.getFullYear(),
|
|
||||||
month: day.date.getMonth() + 1,
|
|
||||||
day: day.date.getDate()
|
|
||||||
})
|
|
||||||
"
|
|
||||||
>Eintragen</v-btn>
|
|
||||||
</v-card-actions>
|
</v-card-actions>
|
||||||
</v-card>
|
</v-card>
|
||||||
</div>
|
</div>
|
||||||
|
@ -105,7 +127,9 @@ export default {
|
||||||
return {
|
return {
|
||||||
account_add: mdiAccountPlus,
|
account_add: mdiAccountPlus,
|
||||||
searchInput: null,
|
searchInput: null,
|
||||||
requestUser: null
|
requestUser: null,
|
||||||
|
menu: false,
|
||||||
|
update: 0
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
|
@ -134,11 +158,17 @@ export default {
|
||||||
if (day.date.getDay() === 0 || day.date.getDay() === 1) {
|
if (day.date.getDay() === 0 || day.date.getDay() === 1) {
|
||||||
return 'grey lighten-4'
|
return 'grey lighten-4'
|
||||||
} else {
|
} else {
|
||||||
if (day.worker.length < 2) {
|
var retVal = 'yellow'
|
||||||
return 'yellow'
|
retVal = 'light-green'
|
||||||
} else {
|
for (var jobkind in day.jobkinddate) {
|
||||||
return 'light-green'
|
if (
|
||||||
|
day.jobkinddate[jobkind].worker.length >=
|
||||||
|
day.jobkinddate[jobkind].maxpersons
|
||||||
|
)
|
||||||
|
retVal = 'light-green'
|
||||||
|
else return 'yellow'
|
||||||
}
|
}
|
||||||
|
return retVal
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return 'grey lighten-4'
|
return 'grey lighten-4'
|
||||||
|
@ -146,20 +176,37 @@ export default {
|
||||||
},
|
},
|
||||||
user(worker) {
|
user(worker) {
|
||||||
return worker.username === this.activeUser.username
|
return worker.username === this.activeUser.username
|
||||||
|
},
|
||||||
|
addingJob(jobkinddateitem) {
|
||||||
|
this.addJob({
|
||||||
|
year: this.day.date.getFullYear(),
|
||||||
|
month: this.day.date.getMonth() + 1,
|
||||||
|
day: this.day.date.getDate(),
|
||||||
|
job_kind: jobkinddateitem.job_kind
|
||||||
|
})
|
||||||
|
this.menu = false
|
||||||
|
setTimeout(() => {
|
||||||
|
this.update += 1
|
||||||
|
}, 200)
|
||||||
|
console.log('after adding Job', this.day.jobkinddate)
|
||||||
|
},
|
||||||
|
userInWorker() {
|
||||||
|
var jobkinddate = this.day.jobkinddate.find(item => {
|
||||||
|
return item.worker.find(workeritem => {
|
||||||
|
return workeritem.id === this.activeUser.id
|
||||||
|
})
|
||||||
|
})
|
||||||
|
console.log('userin', !!jobkinddate, !jobkinddate)
|
||||||
|
return !!jobkinddate
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapGetters({
|
...mapGetters({
|
||||||
disabled: 'jobs/disabled',
|
disabled: 'jobs/disabled',
|
||||||
activeUser: 'user',
|
activeUser: 'user/user',
|
||||||
allUsers: 'jobs/allUsers',
|
allUsers: 'jobs/allUsers',
|
||||||
transactJobs: 'requestJobs/transactJobs'
|
transactJobs: 'requestJobs/transactJobs'
|
||||||
}),
|
}),
|
||||||
userInWorker() {
|
|
||||||
return this.day.worker.find(a => {
|
|
||||||
return a.username === this.activeUser.username
|
|
||||||
})
|
|
||||||
},
|
|
||||||
specifiedUsers() {
|
specifiedUsers() {
|
||||||
var users = [...this.allUsers]
|
var users = [...this.allUsers]
|
||||||
for (var i in this.day.worker) {
|
for (var i in this.day.worker) {
|
||||||
|
@ -179,11 +226,24 @@ export default {
|
||||||
return a.accepted && a.answerd
|
return a.accepted && a.answerd
|
||||||
})
|
})
|
||||||
return test
|
return test
|
||||||
}
|
},
|
||||||
},
|
filterAddJob() {
|
||||||
watch: {
|
var retVal = this.day.jobkinddate.filter(item => {
|
||||||
worker() {
|
if (item.maxpersons <= item.worker.length) {
|
||||||
return this.day.worker
|
return false
|
||||||
|
}
|
||||||
|
if (!item.job_kind.workgroup) {
|
||||||
|
return true
|
||||||
|
} else {
|
||||||
|
if (this.activeUser.workgroups) {
|
||||||
|
return this.activeUser.workgroups.find(workgroup => {
|
||||||
|
return workgroup.id === item.job_kind.workgroup.id
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
console.log('filterAddJob', retVal, retVal.length > 0, this.user.workgroups)
|
||||||
|
return retVal
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -249,7 +249,6 @@ export default {
|
||||||
methods: {
|
methods: {
|
||||||
...mapActions({
|
...mapActions({
|
||||||
addUser: 'sm/addUser',
|
addUser: 'sm/addUser',
|
||||||
getUser: 'sm/getUser',
|
|
||||||
deleteUser: 'sm/deleteUser',
|
deleteUser: 'sm/deleteUser',
|
||||||
setLoading: 'sm/setDayLoading',
|
setLoading: 'sm/setDayLoading',
|
||||||
setNotLoading: 'sm/setDayNotLoading',
|
setNotLoading: 'sm/setDayNotLoading',
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
//const main = 'https://192.168.5.128:5000/'
|
//const main = 'https://192.168.5.128:5000/'
|
||||||
const main = 'http://localhost:5000/'
|
//const main = 'http://localhost:5000/'
|
||||||
//const main = 'http://192.168.5.118:5000/'
|
const main = 'http://192.168.5.118:5000/'
|
||||||
//const main = 'https://groeger-clan.duckdns.org:5000/'
|
//const main = 'https://groeger-clan.duckdns.org:5000/'
|
||||||
|
|
||||||
const url = {
|
const url = {
|
||||||
|
|
|
@ -52,7 +52,8 @@ const mutations = {
|
||||||
name: 'Montag',
|
name: 'Montag',
|
||||||
worker: [],
|
worker: [],
|
||||||
loading: false,
|
loading: false,
|
||||||
locked: false
|
locked: false,
|
||||||
|
jobkinddate: []
|
||||||
}
|
}
|
||||||
break
|
break
|
||||||
case 2:
|
case 2:
|
||||||
|
@ -62,7 +63,8 @@ const mutations = {
|
||||||
name: 'Dienstag',
|
name: 'Dienstag',
|
||||||
worker: [],
|
worker: [],
|
||||||
loading: false,
|
loading: false,
|
||||||
locked: false
|
locked: false,
|
||||||
|
jobkinddate: []
|
||||||
}
|
}
|
||||||
break
|
break
|
||||||
case 3:
|
case 3:
|
||||||
|
@ -77,7 +79,8 @@ const mutations = {
|
||||||
name: 'Mittwoch',
|
name: 'Mittwoch',
|
||||||
worker: [],
|
worker: [],
|
||||||
loading: false,
|
loading: false,
|
||||||
locked: false
|
locked: false,
|
||||||
|
jobkinddate: []
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break
|
break
|
||||||
|
@ -88,7 +91,8 @@ const mutations = {
|
||||||
name: 'Donnerstag',
|
name: 'Donnerstag',
|
||||||
worker: [],
|
worker: [],
|
||||||
loading: false,
|
loading: false,
|
||||||
locked: false
|
locked: false,
|
||||||
|
jobkinddate: []
|
||||||
}
|
}
|
||||||
break
|
break
|
||||||
case 5:
|
case 5:
|
||||||
|
@ -98,7 +102,8 @@ const mutations = {
|
||||||
name: 'Freitag',
|
name: 'Freitag',
|
||||||
worker: [],
|
worker: [],
|
||||||
loading: false,
|
loading: false,
|
||||||
locked: false
|
locked: false,
|
||||||
|
jobkinddate: []
|
||||||
}
|
}
|
||||||
break
|
break
|
||||||
case 6:
|
case 6:
|
||||||
|
@ -108,7 +113,8 @@ const mutations = {
|
||||||
name: 'Samstag',
|
name: 'Samstag',
|
||||||
worker: [],
|
worker: [],
|
||||||
loading: false,
|
loading: false,
|
||||||
locked: false
|
locked: false,
|
||||||
|
jobkinddate: []
|
||||||
}
|
}
|
||||||
break
|
break
|
||||||
case 0:
|
case 0:
|
||||||
|
@ -118,7 +124,8 @@ const mutations = {
|
||||||
name: 'Sontag',
|
name: 'Sontag',
|
||||||
worker: [],
|
worker: [],
|
||||||
loading: false,
|
loading: false,
|
||||||
locked: false
|
locked: false,
|
||||||
|
jobkinddate: []
|
||||||
}
|
}
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
@ -155,6 +162,80 @@ const mutations = {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
// eslint-disable-next-line no-unused-vars
|
||||||
|
updateMonthWorker: (state, { workers, date, getters }) => {
|
||||||
|
var day = getters.getDay(date)
|
||||||
|
day.jobkinddate.forEach(item => {
|
||||||
|
var filtered = workers.filter(worker => {
|
||||||
|
return item.job_kind.id === (worker.job_kind ? worker.job_kind.id : 1)
|
||||||
|
})
|
||||||
|
var filteredWorkers = []
|
||||||
|
filtered.forEach(item => {
|
||||||
|
filteredWorkers.push(item.user)
|
||||||
|
})
|
||||||
|
filteredWorkers.forEach(worker => {
|
||||||
|
if (!item.worker.find(a => {return a.id === worker.id})) {
|
||||||
|
item.worker.push(worker)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
item.worker.forEach(worker => {
|
||||||
|
if (!filteredWorkers.find(a => {return a.id === worker.id})) {
|
||||||
|
item.worker.splice(item.worker.indexOf(worker), 1)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
console.log(day)
|
||||||
|
},
|
||||||
|
updateMonthLocked: (state, { locked, date, getters }) => {
|
||||||
|
var day = getters.getDay(date)
|
||||||
|
day.locked = !!locked
|
||||||
|
},
|
||||||
|
updateMonthJobkind: (state, { data, date, getters }) => {
|
||||||
|
let day = getters.getDay(date)
|
||||||
|
var backup = []
|
||||||
|
|
||||||
|
for (let jobkind in day.jobkinddate) {
|
||||||
|
if (day.jobkinddate[jobkind].worker !== undefined) {
|
||||||
|
backup.push({
|
||||||
|
id: day.jobkinddate[jobkind].job_kind.id,
|
||||||
|
worker: day.jobkinddate[jobkind].worker,
|
||||||
|
backupWorker: day.jobkinddate[jobkind].backupWorker
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
backup.push({
|
||||||
|
id: day.jobkinddate[jobkind].job_kind.id,
|
||||||
|
worker: [],
|
||||||
|
backupWorker: []
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
day.jobkinddate = [...data]
|
||||||
|
var test = day.jobkinddate.find(jobkind => {
|
||||||
|
return jobkind.job_kind.id === 1
|
||||||
|
})
|
||||||
|
if (!test) {
|
||||||
|
day.jobkinddate.push({
|
||||||
|
id: -1,
|
||||||
|
job_kind: { id: 1, name: 'Bardienst' },
|
||||||
|
maxpersons: 2,
|
||||||
|
daydate: {
|
||||||
|
year: date.getFullYear(),
|
||||||
|
month: date.getMonth() + 1,
|
||||||
|
day: date.getDate()
|
||||||
|
},
|
||||||
|
worker: [],
|
||||||
|
backupWorker: []
|
||||||
|
})
|
||||||
|
}
|
||||||
|
for (var jobkind in day.jobkinddate) {
|
||||||
|
var worker = backup.find(item => {
|
||||||
|
return item.id === day.jobkinddate[jobkind].job_kind.id
|
||||||
|
})
|
||||||
|
day.jobkinddate[jobkind].worker = worker ? worker.worker : []
|
||||||
|
day.jobkinddate[jobkind].backupWorker = worker ? worker.backupWorker : []
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
setAllDayLoading: state => {
|
setAllDayLoading: state => {
|
||||||
for (let week = 0; week < state.month.length; week++) {
|
for (let week = 0; week < state.month.length; week++) {
|
||||||
for (let day in state.month[week].days) {
|
for (let day in state.month[week].days) {
|
||||||
|
@ -239,62 +320,44 @@ const actions = {
|
||||||
commit('setAllDayLoading')
|
commit('setAllDayLoading')
|
||||||
try {
|
try {
|
||||||
const response = await axios.post(
|
const response = await axios.post(
|
||||||
url.user.jobs,
|
url.vorstand.sm.getUsers,
|
||||||
{ ...data },
|
{ ...data },
|
||||||
{ headers: { Token: rootState.login.user.accessToken } }
|
{ headers: { Token: rootState.login.user.accessToken } }
|
||||||
)
|
)
|
||||||
for (let day in response.data) {
|
console.log(response.data)
|
||||||
for (let item = 0; item < response.data[day].worker.length; item++) {
|
for (var day in response.data) {
|
||||||
commit('updateMonth', {
|
|
||||||
...response.data[day].worker[item],
|
|
||||||
com: 'add',
|
|
||||||
day: response.data[day].day
|
|
||||||
})
|
|
||||||
}
|
|
||||||
commit('updateMonth', {
|
|
||||||
start: response.data[day].day.date,
|
|
||||||
day: response.data[day].day
|
|
||||||
})
|
|
||||||
var date = new Date(
|
var date = new Date(
|
||||||
response.data[day].day.date.year,
|
response.data[day].day.date.year,
|
||||||
response.data[day].day.date.month - 1,
|
response.data[day].day.date.month - 1,
|
||||||
response.data[day].day.date.day
|
response.data[day].day.date.day
|
||||||
)
|
)
|
||||||
commit('setDayNotLoading', { date: date, getters })
|
commit('updateMonthJobkind', {
|
||||||
}
|
data: [...response.data[day].jobkinddate],
|
||||||
} catch (e) {
|
date,
|
||||||
if (e.response)
|
getters
|
||||||
if (e.response.status === 401) dispatch('logout', null, { root: true })
|
|
||||||
}
|
|
||||||
},
|
|
||||||
async getUser({ commit, rootState, dispatch, getters }, data) {
|
|
||||||
commit('setDayLoading', { date: data.startdatetime, getters })
|
|
||||||
try {
|
|
||||||
const response = await axios.post(
|
|
||||||
url.user.job,
|
|
||||||
{ ...data },
|
|
||||||
{ headers: { Token: rootState.login.user.accessToken } }
|
|
||||||
)
|
|
||||||
for (let item = 0; item < response.data.worker.length; item++) {
|
|
||||||
commit('updateMonth', {
|
|
||||||
...response.data.worker[item],
|
|
||||||
com: 'add',
|
|
||||||
day: response.data.day
|
|
||||||
})
|
})
|
||||||
|
commit('updateMonthWorker', {
|
||||||
|
workers: [...response.data[day].worker],
|
||||||
|
date,
|
||||||
|
getters
|
||||||
|
})
|
||||||
|
commit('updateMonthLocked', {
|
||||||
|
locked: response.data[day].day.locked,
|
||||||
|
date,
|
||||||
|
getters
|
||||||
|
})
|
||||||
|
commit('setDayNotLoading', { date, getters })
|
||||||
}
|
}
|
||||||
commit('updateMonth', {
|
|
||||||
start: response.data.day.date,
|
|
||||||
day: response.data.day
|
|
||||||
})
|
|
||||||
commit('setDayNotLoading', { date: data.startdatetime, getters })
|
|
||||||
dispatch('getLifeTime', null, { root: true })
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (e.response)
|
if (e.response)
|
||||||
if (e.response.status === 401) dispatch('logout', null, { root: true })
|
if (e.response.status === 401) dispatch('logout', null, { root: true })
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
async addJob({ commit, rootState, dispatch }, data) {
|
async addJob({ commit, rootState, dispatch, getters }, data) {
|
||||||
|
var date = new Date(data.year, data.month - 1, data.day)
|
||||||
|
commit('setDayLoading', {date, getters})
|
||||||
try {
|
try {
|
||||||
|
|
||||||
const response = await axios.post(
|
const response = await axios.post(
|
||||||
url.user.addJob,
|
url.user.addJob,
|
||||||
{ ...data },
|
{ ...data },
|
||||||
|
@ -302,7 +365,13 @@ const actions = {
|
||||||
headers: { Token: rootState.login.user.accessToken }
|
headers: { Token: rootState.login.user.accessToken }
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
commit('updateMonth', { ...response.data[0], com: 'add' })
|
console.log(response.data)
|
||||||
|
commit('updateMonthWorker', {
|
||||||
|
workers: [...response.data],
|
||||||
|
date: new Date(data.year, data.month - 1, data.day),
|
||||||
|
getters
|
||||||
|
})
|
||||||
|
commit('setDayNotLoading', {date, getters})
|
||||||
dispatch('getLifeTime', null, { root: true })
|
dispatch('getLifeTime', null, { root: true })
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (e.response)
|
if (e.response)
|
||||||
|
|
|
@ -321,32 +321,6 @@ const actions = {
|
||||||
if (e.response.status === 401) dispatch('logout', null, { root: true })
|
if (e.response.status === 401) dispatch('logout', null, { root: true })
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
async getUser({ commit, rootState, dispatch, getters }, data) {
|
|
||||||
commit('setDayLoading', { date: data.startdatetime, getters })
|
|
||||||
try {
|
|
||||||
const response = await axios.post(
|
|
||||||
url.vorstand.sm.getUser,
|
|
||||||
{ ...data },
|
|
||||||
{ headers: { Token: rootState.login.user.accessToken } }
|
|
||||||
)
|
|
||||||
for (let item = 0; item < response.data.worker.length; item++) {
|
|
||||||
commit('updateMonth', {
|
|
||||||
...response.data.worker[item],
|
|
||||||
com: 'add',
|
|
||||||
day: response.data.day
|
|
||||||
})
|
|
||||||
}
|
|
||||||
commit('updateMonth', {
|
|
||||||
start: response.data.day.date,
|
|
||||||
day: response.data.day
|
|
||||||
})
|
|
||||||
commit('setDayNotLoading', { date: data.startdatetime, getters })
|
|
||||||
dispatch('getLifeTime', null, { root: true })
|
|
||||||
} catch (e) {
|
|
||||||
if (e.response)
|
|
||||||
if (e.response.status === 401) dispatch('logout', null, { root: true })
|
|
||||||
}
|
|
||||||
},
|
|
||||||
// eslint-disable-next-line no-unused-vars
|
// eslint-disable-next-line no-unused-vars
|
||||||
async deleteUser({ commit, rootState, dispatch }, data) {
|
async deleteUser({ commit, rootState, dispatch }, data) {
|
||||||
try {
|
try {
|
||||||
|
|
Loading…
Reference in New Issue