2023-09-08
This commit is contained in:
1 parent
70708c0b35
commit
de6037444a
6 files changed
+139
-68
No files matched your search
@@ -156,8 +156,8 @@ export default {
|
||||
longname: '',
|
||||
name: '',
|
||||
difficult:0,
|
||||
datestart: "",
|
||||
dateend: "",
|
||||
datestart: undefined,
|
||||
dateend: undefined,
|
||||
ptype: { "id": 2 },
|
||||
project_checkpoint: [],
|
||||
info:{
|
||||
|
||||
@@ -100,8 +100,8 @@
|
||||
<v-date-picker
|
||||
v-model="node.datestart"
|
||||
@input="menudatestart = false"
|
||||
:min="findMinMaxdate(node.id, 'datestart')"
|
||||
:max="findMinMaxdate(node.id,'dateend')"
|
||||
:min="findStartMinDate"
|
||||
:max="findStartMaxdate"
|
||||
|
||||
></v-date-picker>
|
||||
</v-menu>
|
||||
@@ -127,8 +127,8 @@
|
||||
<v-date-picker
|
||||
v-model="node.dateend"
|
||||
@input="menudateend = false"
|
||||
:min="findMinMaxdate(node.id, 'datestart')"
|
||||
:max="findMinMaxdate(node.id,'dateend')"
|
||||
:min="findEndMinDate"
|
||||
:max="findEndMaxdate"
|
||||
></v-date-picker>
|
||||
</v-menu>
|
||||
</v-col>
|
||||
@@ -223,6 +223,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import moment from "moment";
|
||||
import rowPirow from '@/components/carddetails/pattern/row-pirow.vue';
|
||||
import formatDate from '@/utils/datepiker'
|
||||
export default {
|
||||
@@ -265,6 +266,67 @@ export default {
|
||||
a.forEach(el=> {if( (el!=undefined && b.findIndex(e=>el.user.id===e.id)==-1))b.push(el.user)})
|
||||
return b
|
||||
},
|
||||
|
||||
findStartMaxdate(){
|
||||
if ("task_work" in this.selection[0]){
|
||||
// datestart
|
||||
|
||||
if(this.selection[0].task_work.length>0){
|
||||
let min = this.selection[0].task_work.reduce((prev,curr)=>{
|
||||
return moment(prev.datestart).isBefore(curr.datestart)?prev.datestart : curr.datestart
|
||||
})
|
||||
|
||||
return moment(this.newproject.dateend).isBefore(min)?this.newproject.dateend : min
|
||||
}
|
||||
return "dateend" in this.newproject?this.newproject.dateend:undefined
|
||||
|
||||
|
||||
}
|
||||
else{
|
||||
let elm=this.newproject.tasks.find(e=>e.id==this.selection[0].parent.id)
|
||||
return elm.dateend
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
findStartMinDate(){
|
||||
if ("task_work" in this.selection[0]){return this.newproject.datestart}
|
||||
else{
|
||||
let elm=this.newproject.tasks.find(e=>e.id==this.selection[0].parent.id)
|
||||
return elm.datestart
|
||||
}},
|
||||
|
||||
findEndMinDate(){
|
||||
if ("task_work" in this.selection[0]){
|
||||
// datestart
|
||||
if(this.selection[0].task_work.length>0){
|
||||
let min = this.selection[0].task_work.reduce((prev,curr)=>{
|
||||
return moment(prev.dateend).isAfter(curr.dateend)?prev.dateend : curr.dateend
|
||||
})
|
||||
if(moment(min).isValid()) return moment(this.newproject.datestart).isAfter(min)?this.newproject.datestart : min}
|
||||
|
||||
return this.newproject.datestart
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
else{
|
||||
let elm=this.newproject.tasks.find(e=>e.id==this.selection[0].parent.id)
|
||||
return moment(elm.datestart).isValid()?elm.datestart:undefined
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
findEndMaxdate(){
|
||||
if ("task_work" in this.selection[0]){return this.newproject.dateend}
|
||||
else{
|
||||
let elm=this.newproject.tasks.find(e=>e.id==this.selection[0].parent.id)
|
||||
return elm.dateend
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
},
|
||||
methods:{
|
||||
addtask() {
|
||||
@@ -331,18 +393,6 @@ export default {
|
||||
|
||||
|
||||
|
||||
findMinMaxdate(id,key){
|
||||
if ("task_work" in this.selection[0]){
|
||||
return this.newproject[key]
|
||||
|
||||
}
|
||||
else{
|
||||
|
||||
let elm=this.newproject.tasks.find(e=>e.id==this.selection[0].parent.id)
|
||||
return elm[key]
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,9 +48,7 @@
|
||||
<template v-slot:activator="{ on, attrs }">
|
||||
<v-text-field
|
||||
:value ='formatDate(newproject.datestart)'
|
||||
:rules="newproject_rules.datestart"
|
||||
|
||||
|
||||
:rules="newproject_rules.datestart"
|
||||
v-bind="attrs"
|
||||
v-on="on"
|
||||
></v-text-field>
|
||||
@@ -58,7 +56,7 @@
|
||||
<v-date-picker
|
||||
v-model="newproject.datestart"
|
||||
@input="menu_project_dates[0] = false"
|
||||
|
||||
:max="newproject.tasks.length>0?projectmaxStartdate:undefined"
|
||||
></v-date-picker>
|
||||
</v-menu>
|
||||
</v-col>
|
||||
@@ -71,6 +69,7 @@
|
||||
offset-y
|
||||
min-width="auto"
|
||||
>
|
||||
|
||||
<template v-slot:activator="{ on, attrs }">
|
||||
<v-text-field
|
||||
:value ='formatDate(newproject.dateend)'
|
||||
@@ -82,7 +81,7 @@
|
||||
<v-date-picker
|
||||
v-model="newproject.dateend"
|
||||
@input="menu_project_dates[1] = false"
|
||||
|
||||
:min="newproject.tasks.length>0?projectminEnddate:undefined"
|
||||
></v-date-picker>
|
||||
</v-menu>
|
||||
</v-col>
|
||||
@@ -253,6 +252,7 @@ export default {
|
||||
],
|
||||
datestart:[ v => !!v || 'Обязательно для заполнения',
|
||||
v => moment(v, "DD.MM.YYYY").isValid() || 'Дата указана неверно',
|
||||
// v=> moment(v, "DD.MM.YYYY").isBefore(st)||"Одна из задач начинается раньше этой даты"
|
||||
],
|
||||
dateend:[ v => !!v || 'Обязательно для заполнения',
|
||||
v => moment(v, "DD.MM.YYYY").isValid() || 'Дата указана неверно',
|
||||
@@ -265,6 +265,27 @@ export default {
|
||||
|
||||
}
|
||||
),
|
||||
computed:{
|
||||
projectmaxStartdate(){
|
||||
let min = this.newproject.tasks.reduce((prev,curr)=>{
|
||||
return moment(prev.datestart).isBefore(curr.datestart)?prev.datestart:curr.datestart
|
||||
})
|
||||
|
||||
return moment(this.newproject.dateend).isBefore(min)?this.newproject.dateend : min
|
||||
},
|
||||
projectminEnddate(){
|
||||
let min = this.newproject.tasks.reduce((prev,curr)=>{
|
||||
return moment(prev.dateend).isAfter(curr.dateend)?prev.dateend : curr.dateend
|
||||
})
|
||||
|
||||
return moment(this.newproject.datstart).isAfter(min)?this.newproject.datestart : min
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
@@ -325,7 +325,7 @@ export default {
|
||||
newproject(val) {
|
||||
console.log('nude', val);
|
||||
this.ws.send({"action":"update","payload":val})
|
||||
this.show= false
|
||||
this.show_change_dialog= false
|
||||
},
|
||||
rout(val) {
|
||||
this.$router.push({ path: `${this.$route.fullPath}/task/${val}` })
|
||||
|
||||
@@ -312,6 +312,7 @@ export default {
|
||||
|
||||
// console.log(val)
|
||||
let res = await axiosInstance.post('/createproj',val)
|
||||
this.dialog_create_project=false
|
||||
this.$router.push(`/project/${res.data.id}`)
|
||||
|
||||
},
|
||||
|
||||
Reference in new issue
Block a user