|
72 | 72 | </template>
|
73 | 73 |
|
74 | 74 | <script>
|
75 |
| - import { |
76 |
| - DeleteAtten, |
77 |
| - AttenDetailByPerson, |
78 |
| - UpdateAtten |
79 |
| - } from "@/api/KaoQin/Attendance"; |
80 |
| - import { |
81 |
| - GetUsers |
82 |
| - } from "@/api/KaoQin/person"; |
83 |
| - import { |
84 |
| - GetDeptTree |
85 |
| - } from "@/api/system/dept"; |
86 |
| - import { |
87 |
| - parseTime |
88 |
| - } from '@/utils/index' |
89 |
| - import Multiselect from 'vue-multiselect' |
90 |
| -
|
91 |
| - export default { |
92 |
| - data() { |
93 |
| - return { |
94 |
| - Title: "", |
95 |
| - selected: { |
96 |
| - 'text': '否', |
97 |
| - 'value': 0 |
98 |
| - }, |
99 |
| - options: [{ |
100 |
| - 'text': '是', |
101 |
| - 'value': 1 |
102 |
| - }, |
103 |
| - { |
104 |
| - 'text': '否', |
105 |
| - 'value': 0 |
106 |
| - } |
107 |
| - ], |
108 |
| - listQuery: { |
109 |
| - totalCount: "", |
110 |
| - pageSize: "10", |
111 |
| - pageNumber: "1", |
| 75 | +import { |
| 76 | + DeleteAtten, |
| 77 | + AttenDetailByPerson, |
| 78 | + UpdateAtten |
| 79 | +} from "@/api/KaoQin/Attendance"; |
| 80 | +import { GetUsers } from "@/api/KaoQin/person"; |
| 81 | +import { GetDeptTree } from "@/api/system/dept"; |
| 82 | +import { parseTime } from "@/utils/index"; |
| 83 | +import Multiselect from "vue-multiselect"; |
| 84 | +
|
| 85 | +export default { |
| 86 | + data() { |
| 87 | + return { |
| 88 | + Title: "", |
| 89 | + selected: { |
| 90 | + text: "否", |
| 91 | + value: 0 |
| 92 | + }, |
| 93 | + options: [ |
| 94 | + { |
| 95 | + text: "是", |
| 96 | + value: 1 |
112 | 97 | },
|
113 |
| - dialogFormVisible: false, |
114 |
| - dialogStatus: "", |
115 |
| - list: null, |
116 |
| - listLoading: true, |
117 |
| - temp: { |
118 |
| - ID: "", |
119 |
| - PersonId: "", |
120 |
| - Date: '', |
121 |
| - StartTime: '', |
122 |
| - EndTime: '', |
123 |
| - Vacation: "", |
124 |
| - Vacation_Reason: "", |
125 |
| - IsDeleted: false |
| 98 | + { |
| 99 | + text: "否", |
| 100 | + value: 0 |
126 | 101 | }
|
127 |
| - }; |
| 102 | + ], |
| 103 | + listQuery: { |
| 104 | + totalCount: "", |
| 105 | + pageSize: "10", |
| 106 | + pageNumber: "1" |
| 107 | + }, |
| 108 | + dialogFormVisible: false, |
| 109 | + dialogStatus: "", |
| 110 | + list: null, |
| 111 | + listLoading: true, |
| 112 | + temp: { |
| 113 | + ID: "", |
| 114 | + PersonId: "", |
| 115 | + Date: "", |
| 116 | + StartTime: "", |
| 117 | + EndTime: "", |
| 118 | + Vacation: "", |
| 119 | + Vacation_Reason: "", |
| 120 | + IsDeleted: false |
| 121 | + } |
| 122 | + }; |
| 123 | + }, |
| 124 | + components: { |
| 125 | + Multiselect |
| 126 | + }, |
| 127 | +
|
| 128 | + created() { |
| 129 | + this.fetchData(this.listQuery); |
| 130 | + }, |
| 131 | + methods: { |
| 132 | + handleSizeChange(val) { |
| 133 | + this.listQuery.pageSize = val; |
| 134 | + this.fetchData(this.listQuery); |
128 | 135 | },
|
129 |
| - components: { |
130 |
| - Multiselect |
| 136 | + handleCurrentChange(val) { |
| 137 | + this.listQuery.pageNumber = val; |
| 138 | + this.fetchData(this.listQuery); |
131 | 139 | },
|
132 |
| -
|
133 |
| - created() { |
134 |
| - this.fetchData(this.listQuery) |
| 140 | + fetchData(params) { |
| 141 | + this.listLoading = true; |
| 142 | + GetUsers(params).then(response => { |
| 143 | + this.list = response.data.rows; |
| 144 | + this.listQuery.totalCount = response.data.total; |
| 145 | + this.listLoading = false; |
| 146 | + }); |
135 | 147 | },
|
136 |
| - methods: { |
137 |
| - handleSizeChange(val) { |
138 |
| - this.listQuery.pageSize = val |
139 |
| - this.fetchData(this.listQuery) |
140 |
| - }, |
141 |
| - handleCurrentChange(val) { |
142 |
| - this.listQuery.pageNumber = val |
143 |
| - this.fetchData(this.listQuery) |
144 | 148 |
|
145 |
| - }, |
146 |
| - fetchData(params) { |
147 |
| - this.listLoading = true; |
148 |
| - GetUsers(params).then(response => { |
149 |
| - this.list = response.data.rows |
150 |
| - this.listQuery.totalCount = response.data.total |
151 |
| - this.listLoading = false |
152 |
| - }) |
153 |
| - }, |
154 |
| -
|
155 |
| - Delete(ID) { |
156 |
| - this.$confirm("确认删除?", "提示", { |
157 |
| - confirmButtonText: "确定", |
158 |
| - cancelButtonText: "取消", |
159 |
| - type: "warning" |
160 |
| - }).then(() => { |
161 |
| - DeleteUser(ID).then(response => { |
162 |
| - this.fetchData(this.listQuery); |
163 |
| - }) |
164 |
| - }) |
165 |
| - }, |
166 |
| - Edit(ID, Name) { |
167 |
| - this.dialogStatus = "update"; |
168 |
| - this.dialogFormVisible = true; |
169 |
| - this.Title = Name; |
170 |
| - this.temp.Date = parseTime(new Date()); |
171 |
| - AttenDetailByPerson(ID).then(response => { |
172 |
| - this.temp = response.data |
173 |
| - if(this.temp.Vacation === 1){ |
174 |
| - this.selected = this.options[0] |
175 |
| - } |
176 |
| -
|
177 |
| - else{ |
178 |
| - this.selected = this.options[1] |
179 |
| -
|
180 |
| - } |
181 |
| - this.temp.PersonId = ID |
182 |
| - }) |
183 |
| - }, |
184 |
| -
|
185 |
| - update() { |
186 |
| - this.temp.Vacation = this.selected.value; |
187 |
| - this.temp.Date = parseTime(new Date()); |
188 |
| - UpdateAtten(this.temp).then(response => { |
189 |
| - this.dialogFormVisible = false; |
| 149 | + Delete(ID) { |
| 150 | + this.$confirm("确认删除?", "提示", { |
| 151 | + confirmButtonText: "确定", |
| 152 | + cancelButtonText: "取消", |
| 153 | + type: "warning" |
| 154 | + }).then(() => { |
| 155 | + DeleteUser(ID).then(response => { |
190 | 156 | this.fetchData(this.listQuery);
|
191 |
| - }) |
192 |
| - } |
| 157 | + }); |
| 158 | + }); |
| 159 | + }, |
| 160 | + Edit(ID, Name) { |
| 161 | + this.dialogStatus = "update"; |
| 162 | + this.dialogFormVisible = true; |
| 163 | + this.Title = Name; |
| 164 | + this.temp.Date = parseTime(new Date()); |
| 165 | + AttenDetailByPerson(ID).then(response => { |
| 166 | + this.temp = response.data; |
| 167 | + if (this.temp.Vacation === 1) { |
| 168 | + this.selected = this.options[0]; |
| 169 | + } else { |
| 170 | + this.selected = this.options[1]; |
| 171 | + } |
| 172 | + this.temp.PersonId = ID; |
| 173 | + }); |
| 174 | + }, |
| 175 | +
|
| 176 | + update() { |
| 177 | + this.temp.Vacation = this.selected.value; |
| 178 | + this.temp.Date = parseTime(new Date()); |
| 179 | + UpdateAtten(this.temp).then(response => { |
| 180 | + this.dialogFormVisible = false; |
| 181 | + this.fetchData(this.listQuery); |
| 182 | + }); |
193 | 183 | }
|
194 | 184 | }
|
195 |
| -
|
| 185 | +}; |
196 | 186 | </script>
|
197 | 187 |
|
198 | 188 | <style rel="stylesheet/scss" lang="scss" scoped>
|
199 | 189 |
|
200 |
| -
|
201 | 190 | </style>
|
0 commit comments