mirror of
https://gitee.com/lab1024/smart-admin.git
synced 2025-09-17 10:56:39 +08:00
优化首页的待办工作添加与标记star的移动位置
This commit is contained in:
parent
ecd671682e
commit
15cc4a9003
@ -1,5 +1,5 @@
|
|||||||
<!--
|
<!--
|
||||||
* 已办/代办
|
* 待办工作
|
||||||
*
|
*
|
||||||
* @Author: 1024创新实验室-主任:卓大
|
* @Author: 1024创新实验室-主任:卓大
|
||||||
* @Date: 2022-09-12 22:34:00
|
* @Date: 2022-09-12 22:34:00
|
||||||
@ -70,16 +70,21 @@
|
|||||||
|
|
||||||
function handleCheckbox(e) {
|
function handleCheckbox(e) {
|
||||||
localSave(localKey.TO_BE_DONE, JSON.stringify(toBeDoneList.value));
|
localSave(localKey.TO_BE_DONE, JSON.stringify(toBeDoneList.value));
|
||||||
|
useUserStore().toBeDoneCount = toDoList.value.length;
|
||||||
}
|
}
|
||||||
|
|
||||||
function itemStar(data) {
|
function itemStar(data) {
|
||||||
data.starFlag = !data.starFlag;
|
data.starFlag = !data.starFlag;
|
||||||
|
// 将取消 star 的删除掉
|
||||||
const index = toBeDoneList.value.findIndex((item) => item.title === data.title);
|
const index = toBeDoneList.value.findIndex((item) => item.title === data.title);
|
||||||
toBeDoneList.value.splice(index, 1);
|
toBeDoneList.value.splice(index, 1);
|
||||||
if (data.starFlag) {
|
if (data.starFlag) {
|
||||||
|
// 最新添加标记star的移动到第一位
|
||||||
toBeDoneList.value.unshift(data);
|
toBeDoneList.value.unshift(data);
|
||||||
} else {
|
} else {
|
||||||
toBeDoneList.value.push(data);
|
// 取消标记star的移动到最后一个标记 star 的后面添加
|
||||||
|
const lastStarIndex = toBeDoneList.value.findLastIndex((item) => item.starFlag);
|
||||||
|
toBeDoneList.value.splice(lastStarIndex + 1, 0, data);
|
||||||
}
|
}
|
||||||
localSave(localKey.TO_BE_DONE, JSON.stringify(toBeDoneList.value));
|
localSave(localKey.TO_BE_DONE, JSON.stringify(toBeDoneList.value));
|
||||||
}
|
}
|
||||||
@ -94,9 +99,9 @@
|
|||||||
|
|
||||||
// 添加待办工作
|
// 添加待办工作
|
||||||
function addToBeDone(data) {
|
function addToBeDone(data) {
|
||||||
toBeDoneList.value.unshift(data);
|
toBeDoneList.value.push(data);
|
||||||
useUserStore().toBeDoneCount = toBeDoneList.value.length;
|
|
||||||
localSave(localKey.TO_BE_DONE, JSON.stringify(toBeDoneList.value));
|
localSave(localKey.TO_BE_DONE, JSON.stringify(toBeDoneList.value));
|
||||||
|
useUserStore().toBeDoneCount = toDoList.value.length;
|
||||||
}
|
}
|
||||||
|
|
||||||
function toDelete(data) {
|
function toDelete(data) {
|
||||||
@ -121,8 +126,8 @@
|
|||||||
function deleteToBeDone(data) {
|
function deleteToBeDone(data) {
|
||||||
const index = toBeDoneList.value.findIndex((item) => item.title === data.title);
|
const index = toBeDoneList.value.findIndex((item) => item.title === data.title);
|
||||||
toBeDoneList.value.splice(index, 1);
|
toBeDoneList.value.splice(index, 1);
|
||||||
useUserStore().toBeDoneCount = toBeDoneList.value.length;
|
|
||||||
localSave(localKey.TO_BE_DONE, JSON.stringify(toBeDoneList.value));
|
localSave(localKey.TO_BE_DONE, JSON.stringify(toBeDoneList.value));
|
||||||
|
useUserStore().toBeDoneCount = toDoList.value.length;
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<style lang="less" scoped>
|
<style lang="less" scoped>
|
||||||
|
@ -1,15 +1,17 @@
|
|||||||
<template>
|
<template>
|
||||||
<a-modal v-model:open="visible" title="新建待办" @close="onClose">
|
<div>
|
||||||
<a-form ref="formRef" :model="form" :rules="rules">
|
<a-modal v-model:open="visible" title="新建待办" @close="onClose">
|
||||||
<a-form-item label="标题" name="title">
|
<a-form ref="formRef" :model="form" :rules="rules">
|
||||||
<a-input v-model:value="form.title" placeholder="请输入标题" />
|
<a-form-item label="标题" name="title">
|
||||||
</a-form-item>
|
<a-input v-model:value="form.title" placeholder="请输入标题" />
|
||||||
</a-form>
|
</a-form-item>
|
||||||
<template #footer>
|
</a-form>
|
||||||
<a-button @click="onClose">取消</a-button>
|
<template #footer>
|
||||||
<a-button type="primary" @click="onSubmit">确定</a-button>
|
<a-button @click="onClose">取消</a-button>
|
||||||
</template>
|
<a-button type="primary" @click="onSubmit">确定</a-button>
|
||||||
</a-modal>
|
</template>
|
||||||
|
</a-modal>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script setup>
|
<script setup>
|
||||||
import { reactive, ref } from 'vue';
|
import { reactive, ref } from 'vue';
|
||||||
|
Loading…
Reference in New Issue
Block a user