llj
2026-03-06 d5fb8aec3919e8b442b0d73535d4b62b08d78d77
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
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,
                代码项目:'',
                是否禁用: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,
                            代码项目: element.代码项目,
                            是否启用: 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("删除项ID:", 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>