Merge branch 'khj'
This commit is contained in:
commit
7c5437312b
@ -5,6 +5,7 @@
|
|||||||
<span v-if="isEssential" class="text-danger">*</span>
|
<span v-if="isEssential" class="text-danger">*</span>
|
||||||
</label>
|
</label>
|
||||||
<div class="col-md-10">
|
<div class="col-md-10">
|
||||||
|
{{ min }}
|
||||||
<div class="d-flex align-items-center">
|
<div class="d-flex align-items-center">
|
||||||
<input
|
<input
|
||||||
:id="name"
|
:id="name"
|
||||||
|
|||||||
@ -104,9 +104,10 @@ const topVoters = computed(() => {
|
|||||||
|
|
||||||
const baseUrl = $api.defaults.baseURL.replace(/api\/$/, '');
|
const baseUrl = $api.defaults.baseURL.replace(/api\/$/, '');
|
||||||
const userStore = useUserInfoStore();
|
const userStore = useUserInfoStore();
|
||||||
const currentDate = new Date();
|
const offset = new Date().getTimezoneOffset() * 60000
|
||||||
const voteEndDate = new Date(props.data.localVote.formatted_LOCVOTEDT.replace(' ', 'T'));
|
const today = new Date(Date.now() - offset);
|
||||||
voteEndDate.setDate(voteEndDate.getDate() + 1);
|
const currentDate = today.toISOString().substring(0,16);
|
||||||
|
const voteEndDate = props.data.localVote.LOCVOTEDT.substring(0,16);
|
||||||
// 종료 여부 계산
|
// 종료 여부 계산
|
||||||
const isVoteEnded = computed(() => {
|
const isVoteEnded = computed(() => {
|
||||||
return currentDate > voteEndDate;
|
return currentDate > voteEndDate;
|
||||||
@ -125,7 +126,7 @@ watch(() => props.data.localVote.total_voted, () => {
|
|||||||
|
|
||||||
// 종료 체크 함수
|
// 종료 체크 함수
|
||||||
const checkVoteCompletion = () => {
|
const checkVoteCompletion = () => {
|
||||||
if (props.data.localVote.total_votable === props.data.localVote.total_voted && !props.data.localVote.LOCVOTDDT) {
|
if (props.data.localVote.total_votable === props.data.localVote.total_voted && props.data.localVote.LOCVOTDDT == '') {
|
||||||
emit('voteEnded', { id: props.data.localVote.LOCVOTSEQ });
|
emit('voteEnded', { id: props.data.localVote.LOCVOTSEQ });
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -136,7 +137,6 @@ const checkedNames = (numList) =>{
|
|||||||
emit('checkedNames',numList);
|
emit('checkedNames',numList);
|
||||||
}
|
}
|
||||||
const endBtn = (voteid) =>{
|
const endBtn = (voteid) =>{
|
||||||
voteEndDate.setTime(currentDate.getTime()); // 현재 날짜로 설정
|
|
||||||
emit('endVoteId',voteid);
|
emit('endVoteId',voteid);
|
||||||
}
|
}
|
||||||
const voteDelete = (voteid) =>{
|
const voteDelete = (voteid) =>{
|
||||||
|
|||||||
@ -17,16 +17,23 @@
|
|||||||
:is-alert="contentAlerts[index]"
|
:is-alert="contentAlerts[index]"
|
||||||
v-model="item.content"
|
v-model="item.content"
|
||||||
:is-btn="true"
|
:is-btn="true"
|
||||||
|
@keyup="ValidHandler('content' + (index + 1))"
|
||||||
>
|
>
|
||||||
<template v-slot:append>
|
<template v-slot:append>
|
||||||
<delete-btn @click="removeItem(index)" />
|
<delete-btn @click="removeItem(index)" />
|
||||||
</template>
|
</template>
|
||||||
</form-input>
|
</form-input>
|
||||||
<link-input v-model="item.url" class="mb-1"/>
|
<form-input
|
||||||
|
:title="'URL ' + (index + data.length + 1)"
|
||||||
|
:name="'url' + index"
|
||||||
|
v-model="item.url"
|
||||||
|
:is-essential="false"
|
||||||
|
class="mb-1"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div class="d-flex justify-content align-items-center mt-3">
|
<div class="d-flex justify-content align-items-center mt-3">
|
||||||
<plus-btn @click="addItem" :disabled=" total >= 10" />
|
<plus-btn @click="addItem" :disabled=" total >= 10" />
|
||||||
<button class="btn btn-primary btn-icon m-1" @click="addContentSave(item.LOCVOTSEQ)" :disabled="isSaveDisabled">
|
<button class="btn btn-primary btn-icon m-1" @click="addContentSave(item.LOCVOTSEQ ,index)" :disabled="isSaveDisabled">
|
||||||
<i class="bx bx-check"></i>
|
<i class="bx bx-check"></i>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
@ -46,20 +53,19 @@ import SaveBtn from '@c/button/SaveBtn.vue'
|
|||||||
import FormInput from '@c/input/FormInput.vue';
|
import FormInput from '@c/input/FormInput.vue';
|
||||||
import voteCardCheckList from '@c/voteboard/voteCardCheckList.vue';
|
import voteCardCheckList from '@c/voteboard/voteCardCheckList.vue';
|
||||||
import { computed, ref } from 'vue';
|
import { computed, ref } from 'vue';
|
||||||
import LinkInput from "@/components/voteboard/voteLinkInput.vue";
|
|
||||||
import { voteCommon } from '@s/voteCommon';
|
import { voteCommon } from '@s/voteCommon';
|
||||||
import DeleteBtn from "@c/button/DeleteBtn.vue";
|
import DeleteBtn from "@c/button/DeleteBtn.vue";
|
||||||
import { useToastStore } from '@s/toastStore';
|
import { useToastStore } from '@s/toastStore';
|
||||||
import router from '@/router';
|
import router from '@/router';
|
||||||
const toastStore = useToastStore();
|
const toastStore = useToastStore();
|
||||||
const contentAlerts = ref(false);
|
const contentAlerts = ref([false, false]);
|
||||||
const titleAlert = ref(false);
|
const titleAlert = ref(false);
|
||||||
const title = ref('');
|
const title = ref('');
|
||||||
const rink = ref('');
|
const rink = ref('');
|
||||||
const { itemList, addItem, removeItem } = voteCommon(true);
|
const { itemList, addItem, removeItem } = voteCommon(true);
|
||||||
const total = computed(() => props.total + itemList.value.length);
|
const total = computed(() => props.total + itemList.value.length);
|
||||||
const isSaveDisabled = computed(() => {
|
const isSaveDisabled = computed(() => {
|
||||||
return itemList.value.length === 0 || itemList.value.every(item => !item.content.trim());
|
return itemList.value.length === 0 || itemList.value.every(item => !item.content.trim() && !item.url.trim());
|
||||||
});
|
});
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
data: {
|
data: {
|
||||||
@ -77,11 +83,34 @@ const props = defineProps({
|
|||||||
});
|
});
|
||||||
const emit = defineEmits(['addContents','checkedNames']);
|
const emit = defineEmits(['addContents','checkedNames']);
|
||||||
//항목추가
|
//항목추가
|
||||||
const addContentSave = (voteId) =>{
|
const addContentSave = (voteId,index) =>{
|
||||||
|
let valid = true;
|
||||||
const filteredItemList = itemList.value.filter(item => item.content && item.content.trim() !== '');
|
const filteredItemList = itemList.value.filter(item => item.content && item.content.trim() !== '');
|
||||||
|
|
||||||
|
itemList.value.forEach((item, index) => {
|
||||||
|
if (!item.content.trim() && item.url.trim()) {
|
||||||
|
contentAlerts.value[index] = true;
|
||||||
|
valid = false;
|
||||||
|
} else {
|
||||||
|
contentAlerts.value[index] = false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if(valid){
|
||||||
emit('addContents',filteredItemList,voteId);
|
emit('addContents',filteredItemList,voteId);
|
||||||
itemList.value = [{ content: "", url: "" }];
|
itemList.value = [{ content: "", url: "" }];
|
||||||
|
removeItem();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const ValidHandler = (field) => {
|
||||||
|
if (field.startsWith('content')) {
|
||||||
|
const index = parseInt(field.replace('content', '')) - 1;
|
||||||
|
if (!isNaN(index)) {
|
||||||
|
contentAlerts.value[index] = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
const checkedNames = ref([]); // 선택된 값 저장
|
const checkedNames = ref([]); // 선택된 값 저장
|
||||||
const updateCheckedNames = (newValues) => {
|
const updateCheckedNames = (newValues) => {
|
||||||
|
|||||||
@ -132,17 +132,18 @@ const checkedNames = (numList) => {
|
|||||||
}
|
}
|
||||||
//투표종료
|
//투표종료
|
||||||
const endVoteId = (endVoteId) => {
|
const endVoteId = (endVoteId) => {
|
||||||
|
console.log('endVoteId',endVoteId)
|
||||||
$api.patch('vote/updateEndData',{
|
$api.patch('vote/updateEndData',{
|
||||||
endVoteId :endVoteId
|
endVoteId :endVoteId
|
||||||
}).then((res)=>{
|
}).then((res)=>{
|
||||||
if(res.data.status === 'OK'){
|
if(res.data.status === 'OK'){
|
||||||
//toastStore.onToast('투표가 종료되었습니다.', 's');
|
|
||||||
getvoteList();
|
getvoteList();
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
//기한 지난 투표 종료
|
//기한 지난 투표 종료
|
||||||
const voteEnded = async (id) =>{
|
const voteEnded = async (id) =>{
|
||||||
|
console.log('voteEnded',id)
|
||||||
await endVoteId(id.id);
|
await endVoteId(id.id);
|
||||||
}
|
}
|
||||||
//투표 삭제
|
//투표 삭제
|
||||||
|
|||||||
@ -28,8 +28,8 @@
|
|||||||
:is-essential="true"
|
:is-essential="true"
|
||||||
:is-alert="endDateAlert"
|
:is-alert="endDateAlert"
|
||||||
v-model="endDate"
|
v-model="endDate"
|
||||||
:min="today"
|
:min="minDate"
|
||||||
@change="ValidHandlerendDate"
|
@input="ValidHandlerendDate"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -102,7 +102,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { onMounted, ref, toRaw } from "vue";
|
import { nextTick, onMounted, ref, toRaw } from "vue";
|
||||||
import UserList from "@c/user/UserList.vue";
|
import UserList from "@c/user/UserList.vue";
|
||||||
import formInput from "@c/input/FormInput.vue";
|
import formInput from "@c/input/FormInput.vue";
|
||||||
import { useToastStore } from "@s/toastStore";
|
import { useToastStore } from "@s/toastStore";
|
||||||
@ -115,7 +115,10 @@ import { useUserStore } from '@s/userList';
|
|||||||
import { useRoute } from "vue-router";
|
import { useRoute } from "vue-router";
|
||||||
|
|
||||||
const userStore = useUserStore();
|
const userStore = useUserStore();
|
||||||
const today = new Date().toISOString().substring(0, 10);
|
// const offset = new Date().getTimezoneOffset() * 60000
|
||||||
|
// const today = new Date(Date.now() - offset);
|
||||||
|
// today.setDate(today.getDate() + 1);
|
||||||
|
// const minDate = today.toISOString().substring(0, 16);
|
||||||
const toastStore = useToastStore();
|
const toastStore = useToastStore();
|
||||||
const activeUserList = ref([]);
|
const activeUserList = ref([]);
|
||||||
const disabledUsers = ref([]);
|
const disabledUsers = ref([]);
|
||||||
@ -139,6 +142,15 @@ const focusDateInput = () => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const minDate = ref('');
|
||||||
|
onMounted(() => {
|
||||||
|
nextTick(() => {
|
||||||
|
const offset = new Date().getTimezoneOffset() * 60000;
|
||||||
|
const today = new Date(Date.now() - offset);
|
||||||
|
today.setDate(today.getDate() + 1);
|
||||||
|
minDate.value = today.toISOString().substring(0, 16);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
const userSet = ({ userList, userTotal }) => {
|
const userSet = ({ userList, userTotal }) => {
|
||||||
activeUserList.value = userList;
|
activeUserList.value = userList;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user