|
100 | 100 | <div class="mb-4">
|
101 | 101 |
|
102 | 102 | <el-button type="success" @click="addNewEvent">新增记录</el-button>
|
103 |
| - <el-button @click.stop="handleExport(scope.row)" type="success">导出</el-button> |
104 |
| - <el-button @click="deleteTask(scope.row)" type="danger">删除</el-button> |
| 103 | + <el-button @click.stop="handleExport(selectedTask)" type="success">导出</el-button> |
| 104 | + <el-button @click="deleteTask(selectedTask)" type="danger">删除</el-button> |
105 | 105 | </div>
|
106 | 106 |
|
107 | 107 | <div class="relative border border-gray-200 rounded-lg overflow-hidden">
|
@@ -757,45 +757,49 @@ export default {
|
757 | 757 | reader.readAsText(file.raw);
|
758 | 758 | },
|
759 | 759 | deleteTask(task) {
|
760 |
| - ElMessageBox.prompt( |
761 |
| - '请输入完整的项目名称以确认删除', |
762 |
| - '警告', |
763 |
| - { |
764 |
| - confirmButtonText: '确认', |
765 |
| - cancelButtonText: '取消', |
766 |
| - inputPattern: new RegExp(`^${task.name}$`), |
767 |
| - inputErrorMessage: '项目名称不正确' |
768 |
| - } |
769 |
| - ).then(({ value }) => { |
770 |
| - this.tasks = this.tasks.filter(t => t.id !== task.id); |
771 |
| - this.saveToStorage(); |
772 |
| - ElMessage.success('删除成功'); |
773 |
| - }).catch(() => { |
774 |
| - // 用户取消或输入错误 |
775 |
| - }); |
| 760 | + ElMessageBox.prompt( |
| 761 | + `请输入完整的项目名称以确认删除:<span class="bg-red-100 text-red-600 px-1 mx-1 rounded-md" ">${task.name}</span>`, |
| 762 | + '警告', |
| 763 | + { |
| 764 | + confirmButtonText: '确认', |
| 765 | + cancelButtonText: '取消', |
| 766 | + inputPattern: new RegExp(`^${task.name}$`), |
| 767 | + inputErrorMessage: '项目名称不正确', |
| 768 | + dangerouslyUseHTMLString: true |
| 769 | + } |
| 770 | + ).then(({ value }) => { |
| 771 | + this.tasks = this.tasks.filter(t => t.id !== task.id); |
| 772 | + this.saveToStorage(); |
| 773 | + ElMessage.success('删除成功'); |
| 774 | + // 刷新页面 |
| 775 | + location.reload(); |
| 776 | + }).catch(() => { |
| 777 | + // 用户取消或输入错误 |
| 778 | + }); |
776 | 779 | },
|
777 | 780 | clearAllTasks() {
|
778 |
| - ElMessageBox.prompt( |
779 |
| - '请输入"我确定删除所有数据"以确认', |
780 |
| - '警告', |
781 |
| - { |
782 |
| - confirmButtonText: '确认', |
783 |
| - cancelButtonText: '取消', |
784 |
| - inputPattern: /^我确定删除所有数据$/, |
785 |
| - inputErrorMessage: '输入内容不正确' |
786 |
| - } |
787 |
| - ).then(({ value }) => { |
788 |
| - //强制下载存档 |
789 |
| - this.handleGlobalExport('json'); |
790 |
| - //删除开始 |
791 |
| - this.tasks = []; |
792 |
| - this.saveToStorage(); |
793 |
| - ElMessage.success('已清除所有数据'); |
794 |
| - //刷新页面 |
795 |
| - location.reload(); |
796 |
| - }).catch(() => { |
797 |
| - // 用户取消或输入错误 |
798 |
| - }); |
| 781 | + ElMessageBox.prompt( |
| 782 | + `请输入<span class="bg-red-100 text-red-600 px-1 mx-1 rounded-md">我确定删除所有数据</span>以确认`, |
| 783 | + '警告', |
| 784 | + { |
| 785 | + confirmButtonText: '确认', |
| 786 | + cancelButtonText: '取消', |
| 787 | + inputPattern: /^我确定删除所有数据$/, |
| 788 | + inputErrorMessage: '输入内容不正确', |
| 789 | + dangerouslyUseHTMLString: true |
| 790 | + } |
| 791 | + ).then(({ value }) => { |
| 792 | + // 强制下载存档 |
| 793 | + this.handleGlobalExport('json'); |
| 794 | + // 删除开始 |
| 795 | + this.tasks = []; |
| 796 | + this.saveToStorage(); |
| 797 | + ElMessage.success('已清除所有数据'); |
| 798 | + // 刷新页面 |
| 799 | + location.reload(); |
| 800 | + }).catch(() => { |
| 801 | + // 用户取消或输入错误 |
| 802 | + }); |
799 | 803 | },
|
800 | 804 | editEvent(block, date) {
|
801 | 805 | // 保存对原始timer的引用和日期
|
|
0 commit comments