From d5fb8aec3919e8b442b0d73535d4b62b08d78d77 Mon Sep 17 00:00:00 2001
From: llj <132905093+newwwwwwtree@users.noreply.github.com>
Date: 星期五, 06 三月 2026 08:47:34 +0800
Subject: [PATCH] 我的待办列表
---
components/ZWDB/Hfooter.vue | 36 ++++
pages/ziwodaiban/todoMain.vue | 173 +++++++++++++++++++++
components/ZWDB/HList.vue | 48 ++++++
pages.json | 7
components/ZWDB/HItem.vue | 101 ++++++++++++
components/ZWDB/Header.vue | 51 ++++++
pages/index/mine.vue | 6
7 files changed, 422 insertions(+), 0 deletions(-)
diff --git a/components/ZWDB/HItem.vue b/components/ZWDB/HItem.vue
new file mode 100644
index 0000000..760a97e
--- /dev/null
+++ b/components/ZWDB/HItem.vue
@@ -0,0 +1,101 @@
+<template>
+ <li class="todo-item">
+ <checkbox-group @change="onRadioChange" v-model="checkedIds">
+ <label class="radio-option" v-for="(item, index) in todoItem" :key="item.HID" v-show="item.鏄惁鍚敤">
+ <checkbox @change="onCheckboxChange(item.HID)"/>
+ <text class="item-text" >{{item.浠g爜椤圭洰}}</text>
+ <button class="delete-btn" @click="deleteItem(item)">鍒犻櫎</button>
+ </label>
+ </checkbox-group>
+ </li>
+</template>
+
+<script>
+
+
+export default {
+ props: {
+ todoItem: {
+ type: Array,
+ required: true
+ }
+ },
+ data() {
+ return {
+ checkedIds: [] ,
+ }
+ },
+ methods: {
+ deleteItem(item)
+ {
+ uni.$emit("deleteItem", item.HID);
+ console.log("鍒犻櫎椤笽D:", item.HID);
+ },
+ },
+
+}
+</script>
+
+<style scoped>
+.todo-item {
+ list-style: none; /* 鍘绘帀榛樿鍒楄〃绗﹀彿 */
+ margin: 12px 0; /* 涓婁笅闂磋窛 */
+ padding: 0; /* 鐢卞唴閮ㄥ厓绱犳帶鍒跺唴杈硅窛 */
+ background-color: #fff; /* 鐧借壊鑳屾櫙 */
+ border-radius: 12px; /* 鍦嗚 */
+ box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06); /* 杞诲井闃村奖 */
+ overflow: hidden; /* 淇濊瘉鍦嗚瑁佸壀鍐呭 */
+}
+
+.radio-option {
+ display: flex; /* 寮规�у竷灞� */
+ align-items: center; /* 鍨傜洿灞呬腑 */
+ padding: 14px 16px; /* 鍐呰竟璺� */
+ border-bottom: 1px solid #f0f0f0; /* 鍒嗗壊绾匡紙鏈�鍚庝竴椤瑰彲鍘绘帀锛� */
+ transition: background 0.2s;
+}
+
+.radio-option:last-child {
+ border-bottom: none; /* 鏈�鍚庝竴椤瑰幓鎺夊垎鍓茬嚎 */
+}
+
+.radio-option:hover {
+ background-color: #fafafa; /* 鎮仠鏁堟灉锛堜粎H5锛� */
+}
+
+radio {
+ transform: scale(0.9); /* 閫傚綋缂╁皬鍗曢�夋锛堝彲閫夛級 */
+ margin-right: 8px; /* 涓庢枃瀛楅棿璺� */
+}
+
+.item-text {
+ flex: 1; /* 鍗犵敤鍓╀綑瀹藉害锛屾妸鎸夐挳鎸ゅ埌鍙宠竟 */
+ font-size: 16px;
+ color: #333;
+ word-break: break-word; /* 闀挎枃鏈崲琛� */
+}
+
+.delete-btn {
+ background-color: #ff5a5f; /* 绾㈣壊鍒犻櫎鎸夐挳 */
+ color: white;
+ border: none;
+ border-radius: 20px; /* 鑳跺泭鏍峰紡 */
+ padding: 6px 16px;
+ font-size: 14px;
+ font-weight: 500;
+ line-height: 1.2;
+ box-shadow: 0 2px 6px rgba(255, 90, 95, 0.3);
+ transition: opacity 0.2s;
+ cursor: pointer; /* 榧犳爣鎵嬪瀷锛圚5锛� */
+}
+
+.delete-btn:active {
+ opacity: 0.7; /* 鐐瑰嚮鍙嶉 */
+}
+
+/* 閽堝涓嶅悓骞冲彴寰皟锛堝彲閫夛級 */
+/* 寰俊灏忕▼搴忎腑 button 鏈夐粯璁ゆ牱寮忥紝闇�瑕侀噸缃� */
+button.delete-btn::after {
+ border: none;
+}
+</style>鎴戝笇鏈涢�氳繃watch鑾峰彇鍒版墍鏈夊嬀閫夌殑HID
\ No newline at end of file
diff --git a/components/ZWDB/HList.vue b/components/ZWDB/HList.vue
new file mode 100644
index 0000000..1f544cf
--- /dev/null
+++ b/components/ZWDB/HList.vue
@@ -0,0 +1,48 @@
+<template>
+ <view class="todo-list">
+ <ul>
+ <HItem :todoItem="todoList"/>
+ </ul>
+ </view>
+</template>
+
+<script>
+
+import HItem from '../../components/ZWDB/HItem.vue';
+export default {
+ props: {
+ todoList: {
+ type: Array,
+ default: () => []
+ }
+ },
+ components: {
+ HItem
+ },
+ data() {
+ return {
+ }
+ },
+ methods: {
+ addMission() {
+
+ }
+ }
+}
+</script>
+
+<style scoped>
+.todo-list {
+ padding: 20px;
+ background: #fafafa;
+ border-top: 1px solid #e5e5e5;
+}
+.todo-list ul {
+ list-style: none;
+ margin: 0;
+ padding: 0;
+}
+.todo-list li {
+ margin-bottom: 5px;
+}
+</style>
\ No newline at end of file
diff --git a/components/ZWDB/Header.vue b/components/ZWDB/Header.vue
new file mode 100644
index 0000000..58ddd3b
--- /dev/null
+++ b/components/ZWDB/Header.vue
@@ -0,0 +1,51 @@
+<template>
+ <view class="form">
+ <input
+ type="text"
+ placeholder="璇疯緭鍏ュ唴瀹癸紝鎸変笅鍥炶溅纭"
+ v-model="inputValue"
+ @confirm="addMission"
+ />
+ </view>
+</template>
+
+<script>
+export default {
+ data() {
+ return {
+ loading: false,
+ ContentID: 0,
+ inputValue: ''
+ }
+ },
+ methods: {
+ addMission(event) {
+ const value = this.inputValue.trim();
+ if (value === '') {
+ uni.showToast({
+ title: '璇疯緭鍏ュ唴瀹�',
+ icon: 'none'
+ });
+ return;
+ }
+ this.inputValue = '';
+ this.$emit("missionAdded", value);
+ }
+ }
+}
+</script>
+
+<style scoped>
+.form {
+ background: #f7f7f7;
+ padding: 10px;
+ border-bottom: 1px solid #e5e5e5;
+}
+.form input {
+ width: 90%;
+ padding: 8px;
+ /* box-sizing: border-box; */
+ border: 1px solid #ccc;
+ border-radius: 4px;
+}
+</style>
\ No newline at end of file
diff --git a/components/ZWDB/Hfooter.vue b/components/ZWDB/Hfooter.vue
new file mode 100644
index 0000000..453b716
--- /dev/null
+++ b/components/ZWDB/Hfooter.vue
@@ -0,0 +1,36 @@
+<template>
+ <view class="todo-footer">
+ <radio-group>
+
+ <radio />
+ <span><span>宸插畬鎴恵{ completedCount }}</span>/鎬诲叡{{ total }}</span>
+ <button @click="clearAllobj">娓呴櫎宸插畬鎴�</button>
+
+ </radio-group>
+ </view>
+</template>
+
+<script>
+export default {
+ data() {
+ return {
+ completedCount: 0,
+ total: 0,
+ }
+ },
+ computed: {
+ // completedCount() {
+ // return this.todoList.filter(item => item.completed).length;
+ // },
+ // total() {
+ // return this.todoList.length;
+ // }
+ },
+ methods: {
+
+ }
+}
+</script>
+
+<style>
+</style>
\ No newline at end of file
diff --git a/pages.json b/pages.json
index e9a69e3..7ec9892 100644
--- a/pages.json
+++ b/pages.json
@@ -1916,6 +1916,13 @@
{
"navigationBarTitleText" : "鍣ㄥ叿缁翠慨鍏ュ簱鍗�"
}
+ },
+ {
+ "path" : "pages/ziwodaiban/todoMain",
+ "style" :
+ {
+ "navigationBarTitleText" : "鎴戠殑寰呭姙鍒楄〃"
+ }
}
],
"tabBar": {
diff --git a/pages/index/mine.vue b/pages/index/mine.vue
index fd640b8..cf4b127 100644
--- a/pages/index/mine.vue
+++ b/pages/index/mine.vue
@@ -71,6 +71,12 @@
text:'鎴戠殑宸ヨ祫锛堥浼帮級',
url:'/pages/gongxuOut/moneystatistics',
id:4
+ },
+ {
+ img:'../../static/icon05.png',
+ text:'鎴戠殑寰呭姙',
+ url:'/pages/ziwodaiban/todoMain',
+ id:5
}
]
}
diff --git a/pages/ziwodaiban/todoMain.vue b/pages/ziwodaiban/todoMain.vue
new file mode 100644
index 0000000..dd18b41
--- /dev/null
+++ b/pages/ziwodaiban/todoMain.vue
@@ -0,0 +1,173 @@
+<template >
+ <view class="form" id="todoMain">
+ <Header @missionAdded="onMissionAdded"></Header>
+
+ <HList :todoList="contentList"></HList>
+ <Hfooter></Hfooter>
+ </view>
+</template>
+
+<script>
+ import getDateTime from '@/utils/getdateTime.js';
+ import {
+ getUserInfo
+ } from "@/utils/auth.js";
+ import {
+ CommonUtils
+ } from '@/utils/common';
+import Header from '../../components/ZWDB/Header.vue';
+import Hfooter from '../../components/ZWDB/Hfooter.vue';
+import HList from '../../components/ZWDB/HList.vue';
+export default {
+ components: {
+ Header,
+ Hfooter,
+ HList
+ },
+ data() {
+ return {
+ userInfo: null,
+ // dateTime: getDateTime(),
+ todoList: [],
+ contentList: [],
+ loading: false,
+ empty: false,
+ HForm:{
+ HID:0,
+ 浠g爜椤圭洰:'',
+ 鏄惁绂佺敤:0,
+ 鏄惁鍚敤:1,
+ 鏄惁鍙紪杈�:1,
+ }
+ }
+ },
+ onLoad() {
+ this.userInfo = getUserInfo();
+ this.getTodoList();
+ },
+ methods: {
+ getTodoList() {
+ this.loading = true;
+ let res = CommonUtils.doRequest2Sync({
+ url: '/ZWDBController/GetLIST',
+ data: {
+ user: localStorage.getItem('HUserName'),
+ OrgIDs: 100038
+ },
+ }).then(res => {
+ this.loading = false;
+ if (res.data.code === "1") {
+ this.todoList = res.data.data || [];
+ this.contentList=this.todoList.map(element => {
+ return {
+ HID: element.HItemID,
+ 浠g爜椤圭洰: element.浠g爜椤圭洰,
+ 鏄惁鍚敤: element.鏄惁鍚敤,
+ 鏄惁鍙紪杈�: element.鏄惁鍙紪杈�,
+ 鏄惁绂佺敤: element.鏄惁绂佺敤,
+ };
+ });
+ this.empty = this.todoList.length === 0;
+
+
+ console.log(this.contentList);
+ } else {
+ uni.showToast({
+ title: '鎺ュ彛璇锋眰澶辫触',
+ icon: 'none'
+ })
+ }
+ }).catch(() => {
+ this.loading = false;
+ uni.showToast({
+ title: '鎺ュ彛璇锋眰澶辫触',
+ icon: 'none'
+ })
+ });
+
+ },
+ onMissionAdded(inputValue) {
+ let res= CommonUtils.doRequest2Sync({
+ url: '/ZWDBController/insertTODOS',
+
+ data: {
+ user: localStorage.getItem('HUserName'),
+ contents: inputValue
+ },
+
+ }).then(res => {
+ this.loading = false;
+ if (res.data.code === "1") {
+ this.ContentID = res.data.data.HItemID;
+ uni.showToast({
+ title: '娣诲姞鎴愬姛',
+ icon: 'success'
+ });
+ this.getTodoList();
+ } else {
+ uni.showToast({
+ title: '鎺ュ彛璇锋眰澶辫触',
+ icon: 'none'
+ })
+ }
+ }).catch(() => {
+ this.loading = false;
+ uni.showToast({
+ title: '鎺ュ彛璇锋眰澶辫触',
+ icon: 'none'
+ })
+ });
+
+ },
+ deleteMission(deleteID) {
+ let res= CommonUtils.doRequest2Sync({
+ url: '/ZWDBController/deleteTODOS',
+ data: {
+ user: localStorage.getItem('HUserName'),
+ HID: deleteID
+ },
+
+ }).then(res => {
+ this.loading = false;
+ if (res.data.code === "1") {
+ uni.showToast({
+ title: '鍒犻櫎鎴愬姛',
+ icon: 'success'
+ });
+ this.getTodoList();
+ } else {
+ uni.showToast({
+ title: '鎺ュ彛璇锋眰澶辫触',
+ icon: 'none'
+ })
+ }
+ }).catch(() => {
+ this.loading = false;
+ uni.showToast({
+ title: '鎺ュ彛璇锋眰澶辫触',
+ icon: 'none'
+ })
+ });
+ console.log("鍒犻櫎椤笽D:", deleteID);
+ },
+ itemChanged(checkedID)
+ {
+
+ console.log("鐘舵�佸彉鍖栭」ID:", checkedID);
+ }
+
+ },
+ mounted() {
+ uni.$on("deleteItem", this.deleteMission);
+ uni.$on("changeItem", this.itemChanged);
+ },
+ beforeDestroy() {
+ uni.$off("deleteItem", this.deleteMission);
+ uni.$off("changeItem", this.itemChanged);
+ },
+}
+</script>
+
+<style>
+
+</style>
\ No newline at end of file
--
Gitblit v1.9.1