import initCtx from "@/utils/ctx.js";

export default function () {
	const {utils, Tea} = initCtx(this)

	this.createGroup = function () {
		utils.popup("/ns/domains/groups/createPopup", {
			callback: function () {
				utils.successRefresh("保存成功")
			}
		})
	}

	this.updateGroup = function (groupId) {
		utils.popup("/ns/domains/groups/group/updatePopup?groupId=" + groupId, {
			callback: function () {
				utils.successRefresh("保存成功")
			}
		})
	}

	this.deleteGroup = function (groupId) {
		let that = this
		utils.confirm("确定要删除此分组吗？", function () {
			that.$post("/ns/domains/groups/group/delete")
				.params({
					groupId: groupId
				})
				.success(function () {
					utils.successRefresh("删除成功")
				})
		})
	}
}