作者 xiaoqiu

优化公共表单

@@ -199,7 +199,7 @@ @@ -199,7 +199,7 @@
199 <el-radio 199 <el-radio
200 v-for="dict in sys_notice_status" 200 v-for="dict in sys_notice_status"
201 :key="dict.value" 201 :key="dict.value"
202 - :label="dict.value" 202 + :value="dict.value"
203 >{{ dict.label }}</el-radio 203 >{{ dict.label }}</el-radio
204 > 204 >
205 </el-radio-group> 205 </el-radio-group>
@@ -236,7 +236,7 @@ const { sys_notice_status, sys_notice_type } = proxy.useDict( @@ -236,7 +236,7 @@ const { sys_notice_status, sys_notice_type } = proxy.useDict(
236 "sys_notice_status", 236 "sys_notice_status",
237 "sys_notice_type" 237 "sys_notice_type"
238 ); 238 );
239 -const timer = ref(null); 239 +
240 const noticeList = ref([]); 240 const noticeList = ref([]);
241 const open = ref(false); 241 const open = ref(false);
242 const loading = ref(true); 242 const loading = ref(true);
@@ -277,44 +277,51 @@ function getList() { @@ -277,44 +277,51 @@ function getList() {
277 loading.value = false; 277 loading.value = false;
278 }); 278 });
279 } 279 }
  280 +
280 /** 取消按钮 */ 281 /** 取消按钮 */
281 function cancel() { 282 function cancel() {
282 open.value = false; 283 open.value = false;
283 reset(); 284 reset();
284 } 285 }
  286 +
285 /** 表单重置 */ 287 /** 表单重置 */
286 function reset() { 288 function reset() {
287 form.value = { 289 form.value = {
288 noticeId: undefined, 290 noticeId: undefined,
289 noticeTitle: undefined, 291 noticeTitle: undefined,
290 noticeType: undefined, 292 noticeType: undefined,
291 - noticeContent: "", 293 + noticeContent: undefined,
292 status: "0", 294 status: "0",
293 }; 295 };
294 proxy.resetForm("noticeRef"); 296 proxy.resetForm("noticeRef");
295 } 297 }
  298 +
296 /** 搜索按钮操作 */ 299 /** 搜索按钮操作 */
297 function handleQuery() { 300 function handleQuery() {
298 queryParams.value.pageNum = 1; 301 queryParams.value.pageNum = 1;
299 getList(); 302 getList();
300 } 303 }
  304 +
301 /** 重置按钮操作 */ 305 /** 重置按钮操作 */
302 function resetQuery() { 306 function resetQuery() {
303 proxy.resetForm("queryRef"); 307 proxy.resetForm("queryRef");
304 handleQuery(); 308 handleQuery();
305 } 309 }
  310 +
306 /** 多选框选中数据 */ 311 /** 多选框选中数据 */
307 function handleSelectionChange(selection) { 312 function handleSelectionChange(selection) {
308 ids.value = selection.map((item) => item.noticeId); 313 ids.value = selection.map((item) => item.noticeId);
309 single.value = selection.length != 1; 314 single.value = selection.length != 1;
310 multiple.value = !selection.length; 315 multiple.value = !selection.length;
311 } 316 }
  317 +
312 /** 新增按钮操作 */ 318 /** 新增按钮操作 */
313 function handleAdd() { 319 function handleAdd() {
314 reset(); 320 reset();
315 open.value = true; 321 open.value = true;
316 title.value = "添加公告"; 322 title.value = "添加公告";
317 } 323 }
  324 +
318 /**修改按钮操作 */ 325 /**修改按钮操作 */
319 function handleUpdate(row) { 326 function handleUpdate(row) {
320 reset(); 327 reset();
@@ -325,6 +332,7 @@ function handleUpdate(row) { @@ -325,6 +332,7 @@ function handleUpdate(row) {
325 title.value = "修改公告"; 332 title.value = "修改公告";
326 }); 333 });
327 } 334 }
  335 +
328 /** 提交按钮 */ 336 /** 提交按钮 */
329 function submitForm() { 337 function submitForm() {
330 proxy.$refs["noticeRef"].validate((valid) => { 338 proxy.$refs["noticeRef"].validate((valid) => {
@@ -345,6 +353,7 @@ function submitForm() { @@ -345,6 +353,7 @@ function submitForm() {
345 } 353 }
346 }); 354 });
347 } 355 }
  356 +
348 /** 删除按钮操作 */ 357 /** 删除按钮操作 */
349 function handleDelete(row) { 358 function handleDelete(row) {
350 const noticeIds = row.noticeId || ids.value; 359 const noticeIds = row.noticeId || ids.value;