没权限的直接不让粘贴
This commit is contained in:
@@ -92,9 +92,9 @@ const pageData = reactive({//本页全局变量
|
|||||||
|
|
||||||
submitChecked: false,
|
submitChecked: false,
|
||||||
|
|
||||||
isCopy:false,
|
isCopy: false,
|
||||||
copyTitle:"",
|
copyTitle: "",
|
||||||
copyColor:"",
|
copyColor: "",
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -257,7 +257,7 @@ const calendarOptions = ref({
|
|||||||
const nowTime = new Date().getTime();
|
const nowTime = new Date().getTime();
|
||||||
const timeDifference = nowTime - pageData.lastClickTime;
|
const timeDifference = nowTime - pageData.lastClickTime;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
unseleEventAll();//点击了日期就取消event的选择
|
unseleEventAll();//点击了日期就取消event的选择
|
||||||
|
|
||||||
@@ -287,7 +287,7 @@ const calendarOptions = ref({
|
|||||||
select(info) {
|
select(info) {
|
||||||
if (info.end - info.start > 86400000) {
|
if (info.end - info.start > 86400000) {
|
||||||
//选择了多日
|
//选择了多日
|
||||||
console.log("选择了多日:", info);
|
//console.log("选择了多日:", info);
|
||||||
openEventModal(info.startStr, info.endStr);
|
openEventModal(info.startStr, info.endStr);
|
||||||
} else {
|
} else {
|
||||||
//选择单日 无功能
|
//选择单日 无功能
|
||||||
@@ -333,43 +333,43 @@ const calendarOptions = ref({
|
|||||||
|
|
||||||
//event拖动处理
|
//event拖动处理
|
||||||
eventDrop(info) {
|
eventDrop(info) {
|
||||||
updateEditData(parseInt(info.event.id),info.event.title,info.event.startStr,info.event.end === null ? info.event.startStr : DateUtils.toRealEnd(info.event.end),info.event.backgroundColor);
|
updateEditData(parseInt(info.event.id), info.event.title, info.event.startStr, info.event.end === null ? info.event.startStr : DateUtils.toRealEnd(info.event.end), info.event.backgroundColor);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
function editSaveEvent(){
|
function editSaveEvent() {
|
||||||
//console.log(eventData)
|
//console.log(eventData)
|
||||||
updateEditData(eventData.value.id,eventData.value.title,eventData.value.startDate,eventData.value.startDate===eventData.value.endDate?eventData.value.startDate:DateUtils.toRealEnd(eventData.value.endDate),eventData.value.color);
|
updateEditData(eventData.value.id, eventData.value.title, eventData.value.startDate, eventData.value.startDate === eventData.value.endDate ? eventData.value.startDate : DateUtils.toRealEnd(eventData.value.endDate), eventData.value.color);
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateEditData(id,title,start,end,color){
|
function updateEditData(id, title, start, end, color) {
|
||||||
//需要发送到后端修改event
|
//需要发送到后端修改event
|
||||||
//console.log(info.event)
|
//console.log(info.event)
|
||||||
scheduleApi
|
scheduleApi
|
||||||
.editEvent({
|
.editEvent({
|
||||||
id: id,
|
id: id,
|
||||||
title: title,
|
title: title,
|
||||||
start: start,
|
start: start,
|
||||||
end: end,
|
end: end,
|
||||||
color: color,
|
color: color,
|
||||||
})
|
})
|
||||||
.then((r) => {
|
.then((r) => {
|
||||||
//console.log(r);
|
//console.log(r);
|
||||||
if (r.errCode == 0) {
|
if (r.errCode == 0) {
|
||||||
//前端提交是否错误
|
//前端提交是否错误
|
||||||
switch (
|
switch (
|
||||||
r.raw.err_code //后端返回是否错误
|
r.raw.err_code //后端返回是否错误
|
||||||
) {
|
) {
|
||||||
case 0:
|
case 0:
|
||||||
closeEventModal();
|
closeEventModal();
|
||||||
getEvents();//从新从后端获取最新数据
|
getEvents();//从新从后端获取最新数据
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
toast.danger(t("message.server_error"));
|
toast.danger(t("message.server_error"));
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// 打开模态框
|
// 打开模态框
|
||||||
@@ -510,31 +510,31 @@ const getEvents = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
//删除event
|
//删除event
|
||||||
function delEvent(){
|
function delEvent() {
|
||||||
|
|
||||||
scheduleApi
|
scheduleApi
|
||||||
.deleEvent({
|
.deleEvent({
|
||||||
id:eventData.value.id
|
id: eventData.value.id
|
||||||
}).then((r) => {
|
}).then((r) => {
|
||||||
//console.log(r);
|
//console.log(r);
|
||||||
if (r.errCode == 0) {
|
if (r.errCode == 0) {
|
||||||
//前端提交是否错误
|
//前端提交是否错误
|
||||||
switch (
|
switch (
|
||||||
r.raw.err_code //后端返回是否错误
|
r.raw.err_code //后端返回是否错误
|
||||||
) {
|
) {
|
||||||
case 0:
|
case 0:
|
||||||
closeEventModal();
|
closeEventModal();
|
||||||
getEvents();//从新从后端获取最新数据
|
getEvents();//从新从后端获取最新数据
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
toast.danger(t("message.server_error"));
|
toast.danger(t("message.server_error"));
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
}else{
|
|
||||||
toast.danger(t("message.server_error"));
|
|
||||||
}
|
}
|
||||||
});
|
} else {
|
||||||
|
toast.danger(t("message.server_error"));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -546,20 +546,20 @@ const selectColor = (colorValue) => {
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
function copyEvent(){
|
function copyEvent() {
|
||||||
pageData.copyTitle=eventData.value.title;
|
pageData.copyTitle = eventData.value.title;
|
||||||
pageData.copyColor=eventData.value.color;
|
pageData.copyColor = eventData.value.color;
|
||||||
pageData.isCopy=true;
|
pageData.isCopy = true;
|
||||||
toast.info("已复制");
|
toast.info("已复制");
|
||||||
}
|
}
|
||||||
|
|
||||||
function pastEvent(){
|
function pastEvent() {
|
||||||
if (pageData.isCopy){
|
if (pageData.isCopy) {
|
||||||
if(eventData.value.isEditable){
|
if (eventData.value.isEditable) {
|
||||||
eventData.value.color=pageData.copyColor;
|
eventData.value.color = pageData.copyColor;
|
||||||
eventData.value.title=pageData.copyTitle;
|
eventData.value.title = pageData.copyTitle;
|
||||||
toast.info("已粘贴");
|
toast.info("已粘贴");
|
||||||
}else{
|
} else {
|
||||||
toast.warning("这不是你的日程");
|
toast.warning("这不是你的日程");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -641,8 +641,8 @@ onMounted(() => {
|
|||||||
|
|
||||||
</h5>
|
</h5>
|
||||||
<h5 class="modal-title text-lg font-semibold absolute left-1/2 -translate-x-1/2">
|
<h5 class="modal-title text-lg font-semibold absolute left-1/2 -translate-x-1/2">
|
||||||
{{userStore.isLoggedIn ? eventData.isEditing ?"xxx的日程":"":""}}
|
{{ userStore.isLoggedIn ? eventData.isEditing ? "xxx的日程" : "" : "" }}
|
||||||
|
|
||||||
</h5>
|
</h5>
|
||||||
<button @click="closeEventModal" class="btn-close text-gray-500 hover:text-gray-700">
|
<button @click="closeEventModal" class="btn-close text-gray-500 hover:text-gray-700">
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none"
|
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none"
|
||||||
@@ -658,12 +658,8 @@ onMounted(() => {
|
|||||||
<!-- 👇 主体区域:允许内部滚动 -->
|
<!-- 👇 主体区域:允许内部滚动 -->
|
||||||
<div class="modal-body p-4 flex-1 overflow-y-auto">
|
<div class="modal-body p-4 flex-1 overflow-y-auto">
|
||||||
<!-- 日期选择区域 -->
|
<!-- 日期选择区域 -->
|
||||||
<DatatimePickerForFullCalendar
|
<DatatimePickerForFullCalendar v-model:startDate="eventData.startDate" v-model:endDate="eventData.endDate"
|
||||||
v-model:startDate="eventData.startDate"
|
:color="eventData.color" :title="eventData.title" :isEditable="eventData.isEditable" />
|
||||||
v-model:endDate="eventData.endDate"
|
|
||||||
:color="eventData.color"
|
|
||||||
:title="eventData.title"
|
|
||||||
:isEditable="eventData.isEditable" />
|
|
||||||
|
|
||||||
<!-- 内容输入区域 -->
|
<!-- 内容输入区域 -->
|
||||||
<div class="mb-4">
|
<div class="mb-4">
|
||||||
@@ -719,27 +715,20 @@ onMounted(() => {
|
|||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex gap-2">
|
<div class="flex gap-2">
|
||||||
<button class="btn px-4 py-2 text-gray-700 hover:bg-gray-100 rounded-md"
|
<button class="btn px-4 py-2 text-gray-700 hover:bg-gray-100 rounded-md" @click="copyEvent">
|
||||||
@click="copyEvent"
|
|
||||||
>
|
|
||||||
{{ t("schedule.copy") }}
|
{{ t("schedule.copy") }}
|
||||||
</button>
|
</button>
|
||||||
<button class="btn px-4 py-2 text-gray-700 hover:bg-gray-100 rounded-md disabled:cursor-not-allowed"
|
<button class="btn px-4 py-2 text-gray-700 hover:bg-gray-100 rounded-md disabled:cursor-not-allowed"
|
||||||
:disabled="!pageData.isCopy"
|
:disabled="!pageData.isCopy || !eventData.isEditable"
|
||||||
@click="pastEvent"
|
@click="pastEvent">
|
||||||
>
|
|
||||||
{{ t("schedule.paste") }}
|
{{ t("schedule.paste") }}
|
||||||
</button>
|
</button>
|
||||||
<button
|
<button v-if="!eventData.isEditing" @click="saveEvent"
|
||||||
v-if="!eventData.isEditing"
|
|
||||||
@click="saveEvent"
|
|
||||||
class="btn btn-primary px-4 py-2 bg-cyan-600 text-white hover:bg-cyan-700 rounded-md disabled:bg-gray-400 disabled:cursor-not-allowed"
|
class="btn btn-primary px-4 py-2 bg-cyan-600 text-white hover:bg-cyan-700 rounded-md disabled:bg-gray-400 disabled:cursor-not-allowed"
|
||||||
:disabled="!eventData.isEditable">
|
:disabled="!eventData.isEditable">
|
||||||
{{t("schedule.add_event_button") }}
|
{{ t("schedule.add_event_button") }}
|
||||||
</button>
|
</button>
|
||||||
<button
|
<button v-if="eventData.isEditing" @click="editSaveEvent"
|
||||||
v-if="eventData.isEditing"
|
|
||||||
@click="editSaveEvent"
|
|
||||||
class="btn btn-primary px-4 py-2 bg-teal-600 text-white hover:bg-teal-700 rounded-md disabled:bg-gray-400 disabled:cursor-not-allowed"
|
class="btn btn-primary px-4 py-2 bg-teal-600 text-white hover:bg-teal-700 rounded-md disabled:bg-gray-400 disabled:cursor-not-allowed"
|
||||||
:disabled="!eventData.isEditable">
|
:disabled="!eventData.isEditable">
|
||||||
修改日程
|
修改日程
|
||||||
|
|||||||
Reference in New Issue
Block a user