mirror of
				https://github.com/TeaOSLab/EdgeAdmin.git
				synced 2025-11-04 13:10:26 +08:00 
			
		
		
		
	消息发送任务队列可以删除单个任务
This commit is contained in:
		@@ -0,0 +1,26 @@
 | 
			
		||||
// Copyright 2021 Liuxiangchao iwind.liu@gmail.com. All rights reserved.
 | 
			
		||||
 | 
			
		||||
package tasks
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
 | 
			
		||||
	"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
type DeleteAction struct {
 | 
			
		||||
	actionutils.ParentAction
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (this *DeleteAction) RunPost(params struct {
 | 
			
		||||
	TaskId int64
 | 
			
		||||
}) {
 | 
			
		||||
	defer this.CreateLogInfo("删除消息发送任务 %d", params.TaskId)
 | 
			
		||||
 | 
			
		||||
	_, err := this.RPC().MessageTaskRPC().DeleteMessageTask(this.AdminContext(), &pb.DeleteMessageTaskRequest{MessageTaskId: params.TaskId})
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		this.ErrorPage(err)
 | 
			
		||||
		return
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	this.Success()
 | 
			
		||||
}
 | 
			
		||||
@@ -15,6 +15,7 @@ func init() {
 | 
			
		||||
			Prefix("/admins/recipients/tasks").
 | 
			
		||||
			Get("", new(IndexAction)).
 | 
			
		||||
			Post("/taskInfo", new(TaskInfoAction)).
 | 
			
		||||
			Post("/delete", new(DeleteAction)).
 | 
			
		||||
			EndAll()
 | 
			
		||||
	})
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										9
									
								
								web/views/@default/admins/recipients/tasks/index.css
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								web/views/@default/admins/recipients/tasks/index.css
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,9 @@
 | 
			
		||||
td {
 | 
			
		||||
  position: relative;
 | 
			
		||||
}
 | 
			
		||||
td a.op {
 | 
			
		||||
  position: absolute;
 | 
			
		||||
  right: 1em;
 | 
			
		||||
  top: 0.5em;
 | 
			
		||||
}
 | 
			
		||||
/*# sourceMappingURL=index.css.map */
 | 
			
		||||
							
								
								
									
										1
									
								
								web/views/@default/admins/recipients/tasks/index.css.map
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								web/views/@default/admins/recipients/tasks/index.css.map
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1 @@
 | 
			
		||||
{"version":3,"sources":["index.less"],"names":[],"mappings":"AAAA;EACC,kBAAA;;AAGD,EAAG,EAAC;EACH,kBAAA;EACA,UAAA;EACA,UAAA","file":"index.css"}
 | 
			
		||||
@@ -17,6 +17,8 @@
 | 
			
		||||
            <td>
 | 
			
		||||
                {{task.user}} <span class="disabled">  |  </span> <span v-if="task.instance != null">媒介:{{task.instance.name}}<link-icon :href="'/admins/recipients/instances/instance?instanceId=' + task.instance.id"></link-icon></span>
 | 
			
		||||
                <span class="disabled">  |  </span> 时间:{{task.createdTime}}
 | 
			
		||||
 | 
			
		||||
                <a href="" title="删除" class="op" @click.prevent="deleteTask(task.id)"><i class="icon remove small"></i></a>
 | 
			
		||||
            </td>
 | 
			
		||||
        </tr>
 | 
			
		||||
        <tr v-if="task.subject.length > 0">
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										16
									
								
								web/views/@default/admins/recipients/tasks/index.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								web/views/@default/admins/recipients/tasks/index.js
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,16 @@
 | 
			
		||||
Tea.context(function () {
 | 
			
		||||
	this.deleteTask = function (taskId) {
 | 
			
		||||
		let that = this
 | 
			
		||||
		teaweb.confirm("确定要删除这个发送任务吗?", function () {
 | 
			
		||||
			that.$post(".delete")
 | 
			
		||||
				.params({
 | 
			
		||||
					taskId: taskId
 | 
			
		||||
				})
 | 
			
		||||
				.success(function () {
 | 
			
		||||
					teaweb.successToast("删除成功", null, function () {
 | 
			
		||||
						teaweb.reload()
 | 
			
		||||
					})
 | 
			
		||||
				})
 | 
			
		||||
		})
 | 
			
		||||
	}
 | 
			
		||||
})
 | 
			
		||||
							
								
								
									
										9
									
								
								web/views/@default/admins/recipients/tasks/index.less
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								web/views/@default/admins/recipients/tasks/index.less
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,9 @@
 | 
			
		||||
td {
 | 
			
		||||
	position: relative;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
td a.op {
 | 
			
		||||
	position: absolute;
 | 
			
		||||
	right: 1em;
 | 
			
		||||
	top: 0.5em;
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user