This commit is contained in:
yziiy
2026-01-14 15:04:01 +08:00
parent 555fe5c4d7
commit 4e1d7a60ae
11 changed files with 591 additions and 581 deletions

View File

@@ -1,8 +1,9 @@
import { ref, h } from "vue"; import { ref, h } from "vue";
import editForm from "./form.vue"; import editForm from "./form.vue";
import { message } from "@/utils/message"; import { message } from "@/utils/message";
import { verifyPassword } from "@/utils/passwordVerify";
import recordList from "./record.vue"; import recordList from "./record.vue";
import giftPackView from '../giftPack/index.vue'; import giftPackView from "../giftPack/index.vue";
import { import {
queryFirstCharge, queryFirstCharge,
addChargeTypeData, addChargeTypeData,
@@ -80,13 +81,16 @@ export function useData() {
onSearch(); onSearch();
}; };
const handleDelete = async rowData => { const handleDelete = async rowData => {
const { code } = await deteleChargeTypeData({ id: rowData.id }); // 删除需要二级密码验证
if (code) { verifyPassword(async () => {
message(`您删除了名称为${rowData.name}的这条数据`, { const { code } = await deteleChargeTypeData({ id: rowData.id });
type: "success" if (code) {
}); message(`您删除了名称为${rowData.name}的这条数据`, {
onSearch(); type: "success"
} });
onSearch();
}
});
}; };
const DistributionRecord = () => { const DistributionRecord = () => {
addDialog({ addDialog({
@@ -94,10 +98,10 @@ export function useData() {
width: "60%", width: "60%",
closeOnClickModal: false, closeOnClickModal: false,
hideFooter: true, hideFooter: true,
contentRenderer: () => h(recordList, { ref: formRef, formInline: null }), contentRenderer: () => h(recordList, { ref: formRef, formInline: null })
}); });
}; };
// 新增 // 新增/编辑首充分类
const openDialog = (title = "新增", rowData: any) => { const openDialog = (title = "新增", rowData: any) => {
addDialog({ addDialog({
title: `${title}首充分类`, title: `${title}首充分类`,
@@ -117,40 +121,37 @@ export function useData() {
beforeSure: (done, { options }) => { beforeSure: (done, { options }) => {
const FormRef = formRef.value.getRef(); const FormRef = formRef.value.getRef();
const curData = options.props.formInline; const curData = options.props.formInline;
const saveData = async form => {
const { code } = await addChargeTypeData(form); FormRef.validate(async valid => {
if (code) { if (!valid) return;
message("新增成功", { type: "success" });
onSearch(); if (title === "新增") {
done(); // 增加首充类型 - 需要二级密码验证
verifyPassword(async () => {
const { code } = await addChargeTypeData(curData);
if (code) {
message("新增成功", { type: "success" });
onSearch();
done();
} else {
message("新增失败", { type: "error" });
}
});
} else { } else {
message("新增失败", { type: "error" }); // 编辑操作 - 需要二级密码验证
} verifyPassword(async () => {
}; const { code } = await editChargeTypeData({
const updateData = async form => { ...curData,
const { code } = await editChargeTypeData({ id: rowData.id
...form, });
id: rowData.id if (code) {
}); message("修改成功", { type: "success" });
if (code) { onSearch();
message("修改成功", { type: "success" }); done();
onSearch(); } else {
done(); message("修改失败", { type: "error" });
} else { }
message("修改失败", { type: "error" }); });
}
};
FormRef.validate(valid => {
if (valid) {
console.log("curData", curData);
// 表单规则校验通过
if (title === "新增") {
// 实际开发先调用新增接口,再进行下面操作
saveData(curData);
} else {
// 实际开发先调用修改接口,再进行下面操作
updateData(curData);
}
} }
}); });
} }
@@ -166,9 +167,9 @@ export function useData() {
props: { props: {
rowData rowData
}, },
contentRenderer: () => h(giftPackView, { ref: formRef, formInline: null }), contentRenderer: () => h(giftPackView, { ref: formRef, formInline: null })
}); });
} };
return { return {
onSearch, onSearch,
isShow, isShow,

View File

@@ -1,6 +1,7 @@
import { ref, h, nextTick } from "vue"; import { ref, h, nextTick } from "vue";
import editForm from "./form.vue"; import editForm from "./form.vue";
import { message } from "@/utils/message"; import { message } from "@/utils/message";
import { verifyPassword } from "@/utils/passwordVerify";
import { import {
queryGiftPack, queryGiftPack,
addGiftPackData, addGiftPackData,
@@ -10,7 +11,7 @@ import {
import { addDialog } from "@/components/ReDialog"; import { addDialog } from "@/components/ReDialog";
export function useData() { export function useData() {
const formRef = ref(); const formRef = ref();
const propRowData = ref(null) const propRowData = ref(null);
const loading = ref(true); const loading = ref(true);
const tableList = ref([]); const tableList = ref([]);
const isShow = ref(false); const isShow = ref(false);
@@ -66,8 +67,8 @@ export function useData() {
slot: "operation" slot: "operation"
} }
]); ]);
const onSearch = async (rowData) => { const onSearch = async rowData => {
propRowData.value = { ...rowData } propRowData.value = { ...rowData };
loading.value = true; loading.value = true;
const { data, code } = await queryGiftPack({ const { data, code } = await queryGiftPack({
gift_bag_id: propRowData.value.id, gift_bag_id: propRowData.value.id,
@@ -78,7 +79,7 @@ export function useData() {
tableList.value = data.lists.map(ele => { tableList.value = data.lists.map(ele => {
return { return {
...ele ...ele
} };
}); });
pagination.value.total = data.count; pagination.value.total = data.count;
pagination.value.currentPage = data.page; pagination.value.currentPage = data.page;
@@ -93,7 +94,7 @@ export function useData() {
pagination.value.currentPage = val; pagination.value.currentPage = val;
onSearch(propRowData.value); onSearch(propRowData.value);
}; };
// 新增 // 新增/编辑礼物
const openDialog = (title = "新增", rowData: any) => { const openDialog = (title = "新增", rowData: any) => {
addDialog({ addDialog({
title: `${title}礼物`, title: `${title}礼物`,
@@ -102,8 +103,7 @@ export function useData() {
type: rowData?.type ?? "", type: rowData?.type ?? "",
num: rowData?.num ?? "", num: rowData?.num ?? "",
gift_id: rowData?.gift_id ?? "", gift_id: rowData?.gift_id ?? "",
gift_bag_id: propRowData.value.id ?? "", gift_bag_id: propRowData.value.id ?? ""
} }
}, },
width: "40%", width: "40%",
@@ -112,53 +112,51 @@ export function useData() {
beforeSure: (done, { options }) => { beforeSure: (done, { options }) => {
const FormRef = formRef.value.getRef(); const FormRef = formRef.value.getRef();
const curData = options.props.formInline; const curData = options.props.formInline;
const saveData = async form => {
const { code } = await addGiftPackData(form); FormRef.validate(async valid => {
if (code) { if (!valid) return;
message("新增成功", { type: "success" });
onSearch(propRowData.value); if (title === "新增") {
done(); // 新增操作
} else { const { code } = await addGiftPackData(curData);
message("新增失败", { type: "error" }); if (code) {
} message("新增成功", { type: "success" });
}; onSearch(propRowData.value);
const updateData = async form => { done();
const { code } = await editGiftPackData({
...form,
id: rowData.id
});
if (code) {
message("修改成功", { type: "success" });
onSearch(propRowData.value);
done();
} else {
message("修改失败", { type: "error" });
}
};
FormRef.validate(valid => {
if (valid) {
console.log("curData", curData);
// 表单规则校验通过
if (title === "新增") {
// 实际开发先调用新增接口,再进行下面操作
saveData(curData);
} else { } else {
// 实际开发先调用修改接口,再进行下面操作 message("新增失败", { type: "error" });
updateData(curData);
} }
} else {
// 编辑操作 - 需要二级密码验证
verifyPassword(async () => {
const { code } = await editGiftPackData({
...curData,
id: rowData.id
});
if (code) {
message("修改成功", { type: "success" });
onSearch(propRowData.value);
done();
} else {
message("修改失败", { type: "error" });
}
});
} }
}); });
} }
}); });
}; };
const handleDelete = async rowData => { const handleDelete = async rowData => {
const { code } = await deteleGiftPackData({ id: rowData.id }); // 删除需要二级密码验证
if (code) { verifyPassword(async () => {
message(`您删除了名称为${rowData.name}的这条数据`, { const { code } = await deteleGiftPackData({ id: rowData.id });
type: "success" if (code) {
}); message(`您删除了名称为${rowData.name}的这条数据`, {
onSearch(propRowData.value); type: "success"
} });
onSearch(propRowData.value);
}
});
}; };
return { return {
onSearch, onSearch,

View File

@@ -1,6 +1,7 @@
import { ref, h, nextTick } from "vue"; import { ref, h } from "vue";
import editForm from "./form.vue"; import editForm from "./form.vue";
import { message } from "@/utils/message"; import { message } from "@/utils/message";
import { verifyPassword } from "@/utils/passwordVerify";
import { import {
queryGiftPack, queryGiftPack,
addGiftPackData, addGiftPackData,
@@ -10,7 +11,7 @@ import {
import { addDialog } from "@/components/ReDialog"; import { addDialog } from "@/components/ReDialog";
export function useData() { export function useData() {
const formRef = ref(); const formRef = ref();
const propRowData = ref(null) const propRowData = ref(null);
const loading = ref(true); const loading = ref(true);
const tableList = ref([]); const tableList = ref([]);
const isShow = ref(false); const isShow = ref(false);
@@ -66,8 +67,8 @@ export function useData() {
slot: "operation" slot: "operation"
} }
]); ]);
const onSearch = async (rowData) => { const onSearch = async rowData => {
propRowData.value = { ...rowData } propRowData.value = { ...rowData };
loading.value = true; loading.value = true;
const { data, code } = await queryGiftPack({ const { data, code } = await queryGiftPack({
gift_bag_id: propRowData.value.id, gift_bag_id: propRowData.value.id,
@@ -78,7 +79,7 @@ export function useData() {
tableList.value = data.lists.map(ele => { tableList.value = data.lists.map(ele => {
return { return {
...ele ...ele
} };
}); });
pagination.value.total = data.count; pagination.value.total = data.count;
pagination.value.currentPage = data.page; pagination.value.currentPage = data.page;
@@ -93,7 +94,7 @@ export function useData() {
pagination.value.currentPage = val; pagination.value.currentPage = val;
onSearch(propRowData.value); onSearch(propRowData.value);
}; };
// 新增 // 新增/编辑礼物
const openDialog = (title = "新增", rowData: any) => { const openDialog = (title = "新增", rowData: any) => {
addDialog({ addDialog({
title: `${title}礼物`, title: `${title}礼物`,
@@ -102,8 +103,7 @@ export function useData() {
type: rowData?.type ?? "", type: rowData?.type ?? "",
num: rowData?.num ?? "", num: rowData?.num ?? "",
gift_id: rowData?.gift_id ?? "", gift_id: rowData?.gift_id ?? "",
gift_bag_id: propRowData.value.id, gift_bag_id: propRowData.value.id
} }
}, },
width: "40%", width: "40%",
@@ -112,53 +112,51 @@ export function useData() {
beforeSure: (done, { options }) => { beforeSure: (done, { options }) => {
const FormRef = formRef.value.getRef(); const FormRef = formRef.value.getRef();
const curData = options.props.formInline; const curData = options.props.formInline;
const saveData = async form => {
const { code } = await addGiftPackData(form); FormRef.validate(async valid => {
if (code) { if (!valid) return;
message("新增成功", { type: "success" });
onSearch(propRowData.value); if (title === "新增") {
done(); // 新增操作
} else { const { code } = await addGiftPackData(curData);
message("新增失败", { type: "error" }); if (code) {
} message("新增成功", { type: "success" });
}; onSearch(propRowData.value);
const updateData = async form => { done();
const { code } = await editGiftPackData({
...form,
id: rowData.id
});
if (code) {
message("修改成功", { type: "success" });
onSearch(propRowData.value);
done();
} else {
message("修改失败", { type: "error" });
}
};
FormRef.validate(valid => {
if (valid) {
console.log("curData", curData);
// 表单规则校验通过
if (title === "新增") {
// 实际开发先调用新增接口,再进行下面操作
saveData(curData);
} else { } else {
// 实际开发先调用修改接口,再进行下面操作 message("新增失败", { type: "error" });
updateData(curData);
} }
} else {
// 编辑操作 - 需要二级密码验证
verifyPassword(async () => {
const { code } = await editGiftPackData({
...curData,
id: rowData.id
});
if (code) {
message("修改成功", { type: "success" });
onSearch(propRowData.value);
done();
} else {
message("修改失败", { type: "error" });
}
});
} }
}); });
} }
}); });
}; };
const handleDelete = async rowData => { const handleDelete = async rowData => {
const { code } = await deteleGiftPackData({ id: rowData.id }); // 删除需要二级密码验证
if (code) { verifyPassword(async () => {
message(`您删除了名称为${rowData.name}的这条数据`, { const { code } = await deteleGiftPackData({ id: rowData.id });
type: "success" if (code) {
}); message(`您删除了名称为${rowData.name}的这条数据`, {
onSearch(propRowData.value); type: "success"
} });
onSearch(propRowData.value);
}
});
}; };
return { return {
onSearch, onSearch,

View File

@@ -1,12 +1,10 @@
import { ref, h, nextTick } from "vue"; import { ref, h, nextTick } from "vue";
import editForm from "./form.vue"; import editForm from "./form.vue";
import { message } from "@/utils/message"; import { message } from "@/utils/message";
import recordList from "./record.vue" import { verifyPassword } from "@/utils/passwordVerify";
import giftPackView from './giftPack/index.vue'; import recordList from "./record.vue";
import { import giftPackView from "./giftPack/index.vue";
getGoodGiftInfo, import { getGoodGiftInfo, setGoodGiftConfig } from "@/api/modules/activities";
setGoodGiftConfig
} from "@/api/modules/activities";
import { addDialog } from "@/components/ReDialog"; import { addDialog } from "@/components/ReDialog";
export function useData() { export function useData() {
const formRef = ref(); const formRef = ref();
@@ -37,8 +35,10 @@ export function useData() {
label: "状态", label: "状态",
prop: "status", prop: "status",
cellRenderer: ({ row }) => ( cellRenderer: ({ row }) => (
<el-tag type={row.status === 1 ? 'success' : 'info'}>{row.status === 1 ? '正常' : '隐藏'}</el-tag> <el-tag type={row.status === 1 ? "success" : "info"}>
), {row.status === 1 ? "正常" : "隐藏"}
</el-tag>
)
}, },
{ {
label: "介绍内容", label: "介绍内容",
@@ -58,6 +58,7 @@ export function useData() {
}, },
{ {
label: "操作", label: "操作",
width: 220,
fixed: "right", fixed: "right",
slot: "operation" slot: "operation"
} }
@@ -84,9 +85,9 @@ export function useData() {
onSearch(); onSearch();
}; };
const setConfig = async () => { const setConfig = async () => {
let rowData = {} let rowData = {};
const { data, code } = await getGoodGiftInfo({}) const { data, code } = await getGoodGiftInfo({});
rowData = code ? data : null rowData = code ? data : null;
nextTick(() => { nextTick(() => {
addDialog({ addDialog({
title: `设置配置`, title: `设置配置`,
@@ -99,7 +100,7 @@ export function useData() {
money: rowData?.money ?? "", money: rowData?.money ?? "",
money_str: rowData?.money_str ?? "", money_str: rowData?.money_str ?? "",
diamond: rowData?.diamond ?? "", diamond: rowData?.diamond ?? "",
activity_end_time: rowData?.activity_end_time ?? "", activity_end_time: rowData?.activity_end_time ?? ""
} }
}, },
width: "40%", width: "40%",
@@ -108,26 +109,25 @@ export function useData() {
beforeSure: (done, { options }) => { beforeSure: (done, { options }) => {
const FormRef = formRef.value.getRef(); const FormRef = formRef.value.getRef();
const curData = options.props.formInline; const curData = options.props.formInline;
const saveData = async form => {
const { code } = await setGoodGiftConfig(form); FormRef.validate(async valid => {
if (code) { if (!valid) return;
message("新增成功", { type: "success" });
onSearch(); // 设置配置需要二级密码验证
done(); verifyPassword(async () => {
} else { const { code } = await setGoodGiftConfig(curData);
message("新增失败", { type: "error" }); if (code) {
} message("设置成功", { type: "success" });
}; onSearch();
FormRef.validate(valid => { done();
if (valid) { } else {
// console.log("curData", curData); message("设置失败", { type: "error" });
saveData(curData); }
} });
}); });
} }
}); });
}) });
}; };
const DistributionRecord = () => { const DistributionRecord = () => {
addDialog({ addDialog({
@@ -135,10 +135,10 @@ export function useData() {
width: "60%", width: "60%",
closeOnClickModal: false, closeOnClickModal: false,
hideFooter: true, hideFooter: true,
contentRenderer: () => h(recordList, { ref: formRef, formInline: null }), contentRenderer: () => h(recordList, { ref: formRef, formInline: null })
}); });
}; };
const openGiftPark = (rowData) => { const openGiftPark = rowData => {
addDialog({ addDialog({
title: `礼包列表`, title: `礼包列表`,
width: "60%", width: "60%",
@@ -147,9 +147,9 @@ export function useData() {
props: { props: {
rowData rowData
}, },
contentRenderer: () => h(giftPackView, { ref: formRef, formInline: null }), contentRenderer: () => h(giftPackView, { ref: formRef, formInline: null })
}); });
} };
return { return {
onSearch, onSearch,
isShow, isShow,

View File

@@ -1,8 +1,9 @@
import { ref, h } from "vue"; import { ref, h } from "vue";
import editForm from "./form.vue"; import editForm from "./form.vue";
import { message } from "@/utils/message"; import { message } from "@/utils/message";
import { verifyPassword } from "@/utils/passwordVerify";
import recordList from "./record.vue"; import recordList from "./record.vue";
import giftPackView from '../giftPack/index.vue'; import giftPackView from "../giftPack/index.vue";
import { import {
queryFirstCharge, queryFirstCharge,
addChargeTypeData, addChargeTypeData,
@@ -95,10 +96,10 @@ export function useData() {
width: "60%", width: "60%",
closeOnClickModal: false, closeOnClickModal: false,
hideFooter: true, hideFooter: true,
contentRenderer: () => h(recordList, { ref: formRef, formInline: null }), contentRenderer: () => h(recordList, { ref: formRef, formInline: null })
}); });
}; };
// 新增 // 新增/编辑新人礼包
const openDialog = (title = "新增", rowData: any) => { const openDialog = (title = "新增", rowData: any) => {
addDialog({ addDialog({
title: `${title}首充分类`, title: `${title}首充分类`,
@@ -118,41 +119,39 @@ export function useData() {
beforeSure: (done, { options }) => { beforeSure: (done, { options }) => {
const FormRef = formRef.value.getRef(); const FormRef = formRef.value.getRef();
const curData = options.props.formInline; const curData = options.props.formInline;
const saveData = async form => {
const { code } = await addChargeTypeData({ ...form, activities_id: 7 }); FormRef.validate(async valid => {
if (code) { if (!valid) return;
message("新增成功", { type: "success" });
onSearch(); if (title === "新增") {
done(); // 新增操作
} else { const { code } = await addChargeTypeData({
message("新增失败", { type: "error" }); ...curData,
} activities_id: 7
}; });
const updateData = async form => { if (code) {
const { code } = await editChargeTypeData({ message("新增成功", { type: "success" });
...form, onSearch();
id: rowData.id, done();
activities_id: 7
});
if (code) {
message("修改成功", { type: "success" });
onSearch();
done();
} else {
message("修改失败", { type: "error" });
}
};
FormRef.validate(valid => {
if (valid) {
console.log("curData", curData);
// 表单规则校验通过
if (title === "新增") {
// 实际开发先调用新增接口,再进行下面操作
saveData(curData);
} else { } else {
// 实际开发先调用修改接口,再进行下面操作 message("新增失败", { type: "error" });
updateData(curData);
} }
} else {
// 编辑操作 - 需要二级密码验证
verifyPassword(async () => {
const { code } = await editChargeTypeData({
...curData,
id: rowData.id,
activities_id: 7
});
if (code) {
message("修改成功", { type: "success" });
onSearch();
done();
} else {
message("修改失败", { type: "error" });
}
});
} }
}); });
} }
@@ -168,9 +167,9 @@ export function useData() {
props: { props: {
rowData rowData
}, },
contentRenderer: () => h(giftPackView, { ref: formRef, formInline: null }), contentRenderer: () => h(giftPackView, { ref: formRef, formInline: null })
}); });
} };
return { return {
onSearch, onSearch,
isShow, isShow,

View File

@@ -1,6 +1,7 @@
import { ref, h } from "vue"; import { ref, h } from "vue";
import editForm from "./form.vue"; import editForm from "./form.vue";
import { message } from "@/utils/message"; import { message } from "@/utils/message";
import { verifyPassword } from "@/utils/passwordVerify";
import { import {
queryDecList, queryDecList,
deleteDecData, deleteDecData,
@@ -44,7 +45,7 @@ export function useData() {
preview-src-list={Array.of(row.decorate_image)} preview-src-list={Array.of(row.decorate_image)}
class="w-[24px] h-[24px] rounded-full align-middle" class="w-[24px] h-[24px] rounded-full align-middle"
/> />
), )
}, },
{ {
label: "时长(天数)", label: "时长(天数)",
@@ -59,12 +60,11 @@ export function useData() {
]); ]);
const onSearch = async () => { const onSearch = async () => {
loading.value = true; loading.value = true;
const { data, code } = await queryDecList const { data, code } = await queryDecList({
({ lid: detailData.value.lid,
lid: detailData.value.lid, page: pagination.value.currentPage,
page: pagination.value.currentPage, page_limit: pagination.value.pageSize
page_limit: pagination.value.pageSize });
});
if (code) { if (code) {
tableList.value = data.lists; tableList.value = data.lists;
pagination.value.total = data.count; pagination.value.total = data.count;
@@ -81,13 +81,15 @@ export function useData() {
onSearch(); onSearch();
}; };
const handleDelete = async rowData => { const handleDelete = async rowData => {
const { code } = await deleteDecData({ id: rowData.id }); verifyPassword(async () => {
if (code) { const { code } = await deleteDecData({ id: rowData.id });
message(`您删除了名称为${rowData.decorate_name}的这条数据`, { if (code) {
type: "success" message(`您删除了名称为${rowData.decorate_name}的这条数据`, {
}); type: "success"
onSearch(); });
} onSearch();
}
});
}; };
// 新增 // 新增
const openDialog = (title = "新增", rowData: any) => { const openDialog = (title = "新增", rowData: any) => {
@@ -105,23 +107,20 @@ export function useData() {
beforeSure: (done, { options }) => { beforeSure: (done, { options }) => {
const FormRef = formRef.value.getRef(); const FormRef = formRef.value.getRef();
const curData = options.props.formInline; const curData = options.props.formInline;
const saveData = async form => {
const { code, msg } = await addDecData({ FormRef.validate(async valid => {
lid: detailData.value.lid,
dpid: form.dpid
});
if (code) {
message("新增成功", { type: "success" });
onSearch();
done();
} else {
message(msg, { type: "error" });
}
};
FormRef.validate(valid => {
if (valid) { if (valid) {
console.log("curData", curData); verifyPassword(async () => {
saveData(curData); const { code } = await addDecData({
lid: detailData.value.lid,
dpid: curData.dpid
});
if (code) {
message("新增成功", { type: "success" });
onSearch();
done();
}
});
} }
}); });
} }

View File

@@ -1,7 +1,8 @@
import { ref, h } from "vue"; import { ref, h } from "vue";
import editForm from "./form.vue"; import editForm from "./form.vue";
import attireList from './List/index.vue' import attireList from "./List/index.vue";
import { message } from "@/utils/message"; import { message } from "@/utils/message";
import { verifyPassword } from "@/utils/passwordVerify";
import { import {
queryList, queryList,
addNobilityData, addNobilityData,
@@ -41,7 +42,7 @@ export function useData() {
preview-src-list={Array.of(row.image)} preview-src-list={Array.of(row.image)}
class="w-[24px] h-[24px] rounded-full align-middle" class="w-[24px] h-[24px] rounded-full align-middle"
/> />
), )
}, },
{ {
label: "购买价格", label: "购买价格",
@@ -92,13 +93,15 @@ export function useData() {
onSearch(); onSearch();
}; };
const handleDelete = async rowData => { const handleDelete = async rowData => {
const { code } = await deleteRobotData({ lid: rowData.lid }); verifyPassword(async () => {
if (code) { const { code } = await deleteRobotData({ lid: rowData.lid });
message(`您删除了名称为${rowData.name}的这条数据`, { if (code) {
type: "success" message(`您删除了名称为${rowData.name}的这条数据`, {
}); type: "success"
onSearch(); });
} onSearch();
}
});
}; };
const openList = (title = "爵位装扮", rowData: any) => { const openList = (title = "爵位装扮", rowData: any) => {
addDialog({ addDialog({
@@ -111,7 +114,7 @@ export function useData() {
closeOnClickModal: false, closeOnClickModal: false,
contentRenderer: () => h(attireList) contentRenderer: () => h(attireList)
}); });
} };
// 新增 // 新增
const openDialog = (title = "新增", rowData: any) => { const openDialog = (title = "新增", rowData: any) => {
addDialog({ addDialog({
@@ -127,10 +130,10 @@ export function useData() {
renew_coin: rowData?.renew_coin ?? "", renew_coin: rowData?.renew_coin ?? "",
day: rowData?.day ?? "", day: rowData?.day ?? "",
nick_name_color: rowData?.nick_name_color ?? "", nick_name_color: rowData?.nick_name_color ?? "",
power_ids: rowData?.power_ids ?? '', power_ids: rowData?.power_ids ?? "",
nick_name_color_name: rowData?.nick_name_color_name ?? '', nick_name_color_name: rowData?.nick_name_color_name ?? "",
play_image: rowData?.play_image ?? '', play_image: rowData?.play_image ?? "",
enter_image: rowData?.enter_image ?? '', enter_image: rowData?.enter_image ?? ""
} }
}, },
width: "40%", width: "40%",
@@ -139,39 +142,30 @@ export function useData() {
beforeSure: (done, { options }) => { beforeSure: (done, { options }) => {
const FormRef = formRef.value.getRef(); const FormRef = formRef.value.getRef();
const curData = options.props.formInline; const curData = options.props.formInline;
const saveData = async form => {
const { code, msg } = await addNobilityData(form); FormRef.validate(async valid => {
if (code) {
message("新增成功", { type: "success" });
onSearch();
done();
} else {
message(msg, { type: "error" });
}
};
const updateData = async form => {
const { code, msg } = await editNobilityData({
...form,
lid: rowData.lid
});
if (code) {
message("修改成功", { type: "success" });
onSearch();
done();
} else {
message(msg, { type: "error" });
}
};
FormRef.validate(valid => {
if (valid) { if (valid) {
console.log("curData", curData);
// 表单规则校验通过
if (title === "新增") { if (title === "新增") {
// 实际开发先调用新增接口,再进行下面操作 // 新增操作,不需要二级密码
saveData(curData); const { code } = await addNobilityData(curData);
if (code) {
message("新增成功", { type: "success" });
onSearch();
done();
}
} else { } else {
// 实际开发先调用修改接口,再进行下面操作 // 编辑操作,需要二级密码验证
updateData(curData); verifyPassword(async () => {
const { code } = await editNobilityData({
...curData,
lid: rowData.lid
});
if (code) {
message("修改成功", { type: "success" });
onSearch();
done();
}
});
} }
} }
}); });

View File

@@ -1,7 +1,5 @@
import { ref, h } from "vue"; import { ref, h } from "vue";
import { import { queryBoxTypeList } from "@/api/modules/blindBox";
queryBoxTypeList
} from "@/api/modules/blindBox";
import { import {
queryList, queryList,
addActivitiesBox, addActivitiesBox,
@@ -11,9 +9,10 @@ import {
setConfig setConfig
} from "@/api/modules/activities"; } from "@/api/modules/activities";
import editForm from "./form.vue"; import editForm from "./form.vue";
import settingRuleView from './settingRule.vue' import settingRuleView from "./settingRule.vue";
import { addDialog } from "@/components/ReDialog"; import { addDialog } from "@/components/ReDialog";
import { message } from "@/utils/message"; import { message } from "@/utils/message";
import { verifyPassword } from "@/utils/passwordVerify";
export function useData() { export function useData() {
const formRef = ref(); const formRef = ref();
const loading = ref(true); const loading = ref(true);
@@ -29,8 +28,8 @@ export function useData() {
const searchForm = ref({ const searchForm = ref({
user_id: "" user_id: ""
}); });
const activeName = ref(0) const activeName = ref(0);
const typeList = ref([]) const typeList = ref([]);
const statisticsList = ref([ const statisticsList = ref([
{ label: "抽奖人数总计", prop: "total_count" }, { label: "抽奖人数总计", prop: "total_count" },
{ label: "抽奖价格总计", prop: "total_price" }, { label: "抽奖价格总计", prop: "total_price" },
@@ -40,8 +39,8 @@ export function useData() {
// { label: "高级礼盒收入总计", prop: "" }, // { label: "高级礼盒收入总计", prop: "" },
{ label: "今日抽奖价格", prop: "today_total_price" }, { label: "今日抽奖价格", prop: "today_total_price" },
{ label: "今日抽奖次数", prop: "today_total_count" } { label: "今日抽奖次数", prop: "today_total_count" }
]) ]);
const statisticsData = ref({}) const statisticsData = ref({});
const searchLabel = ref([ const searchLabel = ref([
{ label: "用户ID", prop: "user_id", type: "input" } { label: "用户ID", prop: "user_id", type: "input" }
]); ]);
@@ -98,23 +97,23 @@ export function useData() {
slot: "operation" slot: "operation"
} }
]); ]);
const onSearch = async (formData) => { const onSearch = async formData => {
loading.value = true; loading.value = true;
searchForm.value = { ...formData } searchForm.value = { ...formData };
const { data, code } = await queryList({ const { data, code } = await queryList({
...formData, ...formData,
gift_bag_id: activeName.value, gift_bag_id: activeName.value,
page: pagination.value.currentPage, page: pagination.value.currentPage,
page_limit: pagination.value.pageSize, page_limit: pagination.value.pageSize
}); });
if (code) { if (code) {
tableList.value = data.lists.map(ele => { tableList.value = data.lists.map(ele => {
return { return {
...ele, ...data.total ...ele,
} ...data.total
};
}); });
statisticsData.value = data.total_data statisticsData.value = data.total_data;
pagination.value.total = data.count; pagination.value.total = data.count;
pagination.value.currentPage = data.page; pagination.value.currentPage = data.page;
} }
@@ -129,19 +128,21 @@ export function useData() {
onSearch(searchForm.value); onSearch(searchForm.value);
}; };
const getType = async () => { const getType = async () => {
const { code, data } = await queryBoxTypeList({ activities_id: 2 }) const { code, data } = await queryBoxTypeList({ activities_id: 2 });
typeList.value = code ? data.map(ele => { typeList.value = code
return { ? data.map(ele => {
label: ele.name, return {
value: ele.id label: ele.name,
} value: ele.id
}) : [] };
if (code) handleClick(data[0].id) })
} : [];
const handleClick = (id) => { if (code) handleClick(data[0].id);
activeName.value = id };
const handleClick = id => {
activeName.value = id;
onSearch(searchForm.value); onSearch(searchForm.value);
} };
// //
const resetSetting = async () => { const resetSetting = async () => {
// const { data, code } = await deletectivitiesBox({ // const { data, code } = await deletectivitiesBox({
@@ -153,16 +154,18 @@ export function useData() {
// }); // });
// handleClick(activeName.value); // handleClick(activeName.value);
// } // }
};
}
const handleDelete = async rowData => { const handleDelete = async rowData => {
const { code } = await deletectivitiesBox({ id: rowData.id }); // 删除需要二级密码验证
if (code) { verifyPassword(async () => {
message(`您删除了这条数据`, { const { code } = await deletectivitiesBox({ id: rowData.id });
type: "success" if (code) {
}); message(`您删除了这条数据`, {
onSearch(searchForm.value); type: "success"
} });
onSearch(searchForm.value);
}
});
}; };
const openDialog = async (title = "新增", rowData: any) => { const openDialog = async (title = "新增", rowData: any) => {
addDialog({ addDialog({
@@ -172,7 +175,7 @@ export function useData() {
type: rowData?.gift_type ?? "", type: rowData?.gift_type ?? "",
num: rowData?.quantity ?? "", num: rowData?.quantity ?? "",
gift_id: rowData?.gift_id ?? "", gift_id: rowData?.gift_id ?? "",
gift_bag_id: rowData?.gift_bag_id ?? "", gift_bag_id: rowData?.gift_bag_id ?? ""
} }
}, },
width: "40%", width: "40%",
@@ -181,51 +184,48 @@ export function useData() {
beforeSure: (done, { options }) => { beforeSure: (done, { options }) => {
const FormRef = formRef.value.getRef(); const FormRef = formRef.value.getRef();
const curData = options.props.formInline; const curData = options.props.formInline;
const saveData = async form => {
const { code } = await addActivitiesBox({ FormRef.validate(async valid => {
...form, if (!valid) return;
gift_bag_id: activeName.value,
}); if (title === "新增") {
if (code) { // 新增操作
message("新增成功", { type: "success" }); const { code } = await addActivitiesBox({
onSearch(searchForm.value); ...curData,
done(); gift_bag_id: activeName.value
} else { });
message("新增失败", { type: "error" }); if (code) {
} message("新增成功", { type: "success" });
}; onSearch(searchForm.value);
const updateData = async form => { done();
const { code, msg } = await editActivitiesBox({
...form,
gift_bag_id: activeName.value,
id: rowData.id
});
if (code) {
message("修改成功", { type: "success" });
onSearch(searchForm.value);
done();
} else {
message(msg, { type: "error" });
}
};
FormRef.validate(valid => {
if (valid) {
console.log("curData", curData);
// 表单规则校验通过
if (title === "新增") {
// 实际开发先调用新增接口,再进行下面操作
saveData(curData);
} else { } else {
// 实际开发先调用修改接口,再进行下面操作 message("新增失败", { type: "error" });
updateData(curData);
} }
} else {
// 编辑操作 - 需要二级密码验证
verifyPassword(async () => {
const { code, msg } = await editActivitiesBox({
...curData,
gift_bag_id: activeName.value,
id: rowData.id
});
if (code) {
message("修改成功", { type: "success" });
onSearch(searchForm.value);
done();
} else {
message(msg, { type: "error" });
}
});
} }
}); });
} }
}); });
}; };
const setting = async () => { const setting = async () => {
const { data, code } = await getActivitiesBoxInfo({ gift_bag_id: activeName.value }) const { data, code } = await getActivitiesBoxInfo({
gift_bag_id: activeName.value
});
addDialog({ addDialog({
title: `设置礼盒规则`, title: `设置礼盒规则`,
props: { props: {
@@ -235,30 +235,31 @@ export function useData() {
}, },
width: "40%", width: "40%",
closeOnClickModal: false, closeOnClickModal: false,
contentRenderer: () => h(settingRuleView, { ref: formRef, formInline: null }), contentRenderer: () =>
h(settingRuleView, { ref: formRef, formInline: null }),
beforeSure: (done, { options }) => { beforeSure: (done, { options }) => {
const FormRef = formRef.value.getRef(); const FormRef = formRef.value.getRef();
const curData = options.props.formInline; const curData = options.props.formInline;
const saveData = async form => {
const { code } = await setConfig({ ...form }); FormRef.validate(async valid => {
if (code) { if (!valid) return;
message("设置成功", { type: "success" });
onSearch(searchForm.value); // 设置规则需要二级密码验证
done(); verifyPassword(async () => {
} else { curData.gift_bag_id = activeName.value;
message("设置失败", { type: "error" }); const { code } = await setConfig({ ...curData });
} if (code) {
}; message("设置成功", { type: "success" });
FormRef.validate(valid => { onSearch(searchForm.value);
if (valid) { done();
// console.log(curData) } else {
curData.gift_bag_id = activeName.value message("设置失败", { type: "error" });
saveData(curData) }
} });
}); });
} }
}); });
} };
return { return {
searchForm, searchForm,
searchLabel, searchLabel,

View File

@@ -9,9 +9,10 @@ import {
settingXunLeRule settingXunLeRule
} from "@/api/modules/blindBox"; } from "@/api/modules/blindBox";
import editForm from "./form.vue"; import editForm from "./form.vue";
import settingRuleView from './settingRule.vue' import settingRuleView from "./settingRule.vue";
import { addDialog } from "@/components/ReDialog"; import { addDialog } from "@/components/ReDialog";
import { message } from "@/utils/message"; import { message } from "@/utils/message";
import { verifyPassword } from "@/utils/passwordVerify";
export function useData() { export function useData() {
const formRef = ref(); const formRef = ref();
const loading = ref(true); const loading = ref(true);
@@ -26,19 +27,20 @@ export function useData() {
}); });
const searchForm = ref({ const searchForm = ref({
gift_id: "", gift_id: "",
gift_name: "", gift_name: ""
}); });
const activeName = ref(13) const activeName = ref(13);
const typeList = ref([]) const typeList = ref([]);
const statisticsList = ref([ const statisticsList = ref([
{ label: "每期总次数", prop: "total_count" }, { label: "每期总次数", prop: "total_count" },
{ label: "每期总礼物价值(收入)", prop: "total_price" }, { label: "每期总礼物价值(收入)", prop: "total_price" },
{ {
label: "每期总抽奖花费(支出)", prop: "total_cost" label: "每期总抽奖花费(支出)",
prop: "total_cost"
}, },
{ label: "每期统计(收入/支出)", prop: "profit_loss_ratio", tip: "%" } { label: "每期统计(收入/支出)", prop: "profit_loss_ratio", tip: "%" }
]) ]);
const statisticsData = ref({}) const statisticsData = ref({});
const searchLabel = ref([ const searchLabel = ref([
{ label: "礼物ID", prop: "gift_id", type: "input" }, { label: "礼物ID", prop: "gift_id", type: "input" },
{ label: "礼物名称", prop: "gift_name", type: "input" } { label: "礼物名称", prop: "gift_name", type: "input" }
@@ -85,21 +87,27 @@ export function useData() {
label: "公屏", label: "公屏",
prop: "is_public_screen", prop: "is_public_screen",
cellRenderer: ({ row }) => ( cellRenderer: ({ row }) => (
<el-tag type={row.is_public_screen === 1 ? 'success' : 'error'}>{row.is_public_screen === 1 ? '显示' : '隐藏'}</el-tag> <el-tag type={row.is_public_screen === 1 ? "success" : "error"}>
{row.is_public_screen === 1 ? "显示" : "隐藏"}
</el-tag>
) )
}, },
{ {
label: "全服显示", label: "全服显示",
prop: "is_public_server", prop: "is_public_server",
cellRenderer: ({ row }) => ( cellRenderer: ({ row }) => (
<el-tag type={row.is_public_server === 1 ? 'success' : 'error'}>{row.is_public_server === 1 ? '显示' : '隐藏'}</el-tag> <el-tag type={row.is_public_server === 1 ? "success" : "error"}>
{row.is_public_server === 1 ? "显示" : "隐藏"}
</el-tag>
) )
}, },
{ {
label: "榜单显示", label: "榜单显示",
prop: "is_world_show", prop: "is_world_show",
cellRenderer: ({ row }) => ( cellRenderer: ({ row }) => (
<el-tag type={row.is_world_show === 1 ? 'success' : 'error'}>{row.is_world_show === 1 ? '显示' : '隐藏'}</el-tag> <el-tag type={row.is_world_show === 1 ? "success" : "error"}>
{row.is_world_show === 1 ? "显示" : "隐藏"}
</el-tag>
) )
}, },
{ {
@@ -113,23 +121,23 @@ export function useData() {
slot: "operation" slot: "operation"
} }
]); ]);
const onSearch = async (formData) => { const onSearch = async formData => {
loading.value = true; loading.value = true;
searchForm.value = { ...formData } searchForm.value = { ...formData };
const { data, code } = await queryBlindBoxList({ const { data, code } = await queryBlindBoxList({
...formData, ...formData,
gift_bag_id: activeName.value, gift_bag_id: activeName.value,
page: pagination.value.currentPage, page: pagination.value.currentPage,
page_limit: pagination.value.pageSize, page_limit: pagination.value.pageSize
}); });
if (code) { if (code) {
tableList.value = data.lists.map(ele => { tableList.value = data.lists.map(ele => {
return { return {
...ele, ...data.total ...ele,
} ...data.total
};
}); });
statisticsData.value = data.total_data statisticsData.value = data.total_data;
pagination.value.total = data.count; pagination.value.total = data.count;
pagination.value.currentPage = data.page; pagination.value.currentPage = data.page;
} }
@@ -144,25 +152,30 @@ export function useData() {
onSearch(searchForm.value); onSearch(searchForm.value);
}; };
const resetSetting = async () => { const resetSetting = async () => {
const { data, code } = await resetBlindBoxRule({ // 重置数量需要二级密码验证
gift_bag_id: activeName.value verifyPassword(async () => {
}) const { code } = await resetBlindBoxRule({
if (code) { gift_bag_id: activeName.value
message(`重置成功`, {
type: "success"
}); });
onSearch(searchForm.value); if (code) {
} message(`重置成功`, {
type: "success"
} });
onSearch(searchForm.value);
}
});
};
const handleDelete = async rowData => { const handleDelete = async rowData => {
const { code } = await removeBlindBoxData({ id: rowData.id }); // 删除需要二级密码验证
if (code) { verifyPassword(async () => {
message(`您删除了这条数据`, { const { code } = await removeBlindBoxData({ id: rowData.id });
type: "success" if (code) {
}); message(`您删除了这条数据`, {
onSearch(searchForm.value); type: "success"
} });
onSearch(searchForm.value);
}
});
}; };
const openDialog = async (title = "新增", rowData: any) => { const openDialog = async (title = "新增", rowData: any) => {
addDialog({ addDialog({
@@ -172,7 +185,7 @@ export function useData() {
gift_id: rowData?.gift_id ?? "", gift_id: rowData?.gift_id ?? "",
quantity: rowData?.quantity ?? 1, quantity: rowData?.quantity ?? 1,
weight: rowData?.weight ?? 1, weight: rowData?.weight ?? 1,
is_world_show: rowData?.is_world_show ?? 1, is_world_show: rowData?.is_world_show ?? 1
} }
}, },
width: "40%", width: "40%",
@@ -181,54 +194,51 @@ export function useData() {
beforeSure: (done, { options }) => { beforeSure: (done, { options }) => {
const FormRef = formRef.value.getRef(); const FormRef = formRef.value.getRef();
const curData = options.props.formInline; const curData = options.props.formInline;
const saveData = async form => {
const { code } = await addBlindBoxData({ FormRef.validate(async valid => {
...form, if (!valid) return;
gift_bag_id: activeName.value,
}); if (title === "新增") {
if (code) { // 添加操作 - 需要二级密码验证
message("新增成功", { type: "success" }); verifyPassword(async () => {
onSearch(searchForm.value); const { code } = await addBlindBoxData({
done(); ...curData,
gift_bag_id: activeName.value
});
if (code) {
message("新增成功", { type: "success" });
onSearch(searchForm.value);
done();
} else {
message("新增失败", { type: "error" });
}
});
} else { } else {
message("新增失败", { type: "error" }); // 编辑操作 - 需要二级密码验证
} verifyPassword(async () => {
}; const { code, msg } = await editBlindBoxData({
const updateData = async form => { ...curData,
const { code, msg } = await editBlindBoxData({ gift_bag_id: activeName.value,
...form, id: rowData.id
gift_bag_id: activeName.value, });
id: rowData.id if (code) {
}); message("修改成功", { type: "success" });
if (code) { onSearch(searchForm.value);
message("修改成功", { type: "success" }); done();
onSearch(searchForm.value); } else {
done(); message(msg, { type: "error" });
} else { }
message(msg, { type: "error" }); });
}
};
FormRef.validate(valid => {
if (valid) {
console.log("curData", curData);
// 表单规则校验通过
if (title === "新增") {
// 实际开发先调用新增接口,再进行下面操作
saveData(curData);
} else {
// 实际开发先调用修改接口,再进行下面操作
updateData(curData);
}
} }
}); });
} }
}); });
}; };
const addGiftData = async () => { const addGiftData = async () => {};
}
const setting = async () => { const setting = async () => {
const { data, code } = await getXunLeRule({ gift_bag_id: activeName.value }) const { data, code } = await getXunLeRule({
gift_bag_id: activeName.value
});
addDialog({ addDialog({
title: `设置巡乐会规则`, title: `设置巡乐会规则`,
props: { props: {
@@ -239,7 +249,8 @@ export function useData() {
start_num: data.open_condition.start_num, start_num: data.open_condition.start_num,
selected_gift_id: +data.locking_condition.selected_gift_id, selected_gift_id: +data.locking_condition.selected_gift_id,
locking_gift_id: +data.locking_condition.locking_gift_id, locking_gift_id: +data.locking_condition.locking_gift_id,
give_homeowner_gift_id: +data.locking_condition.give_homeowner_gift_id, give_homeowner_gift_id:
+data.locking_condition.give_homeowner_gift_id,
end_time: data.locking_time.end_time, end_time: data.locking_time.end_time,
tow_no_locking_time: data.locking_time.tow_no_locking_time, tow_no_locking_time: data.locking_time.tow_no_locking_time,
next_time: data.locking_time.next_time, next_time: data.locking_time.next_time,
@@ -248,29 +259,30 @@ export function useData() {
}, },
width: "60%", width: "60%",
closeOnClickModal: false, closeOnClickModal: false,
contentRenderer: () => h(settingRuleView, { ref: formRef, formInline: null }), contentRenderer: () =>
h(settingRuleView, { ref: formRef, formInline: null }),
beforeSure: (done, { options }) => { beforeSure: (done, { options }) => {
const FormRef = formRef.value.getRef(); const FormRef = formRef.value.getRef();
const curData = options.props.formInline; const curData = options.props.formInline;
const saveData = async form => {
const { code } = await settingXunLeRule({ ...form }); FormRef.validate(async valid => {
if (code) { if (!valid) return;
message("设置成功", { type: "success" });
onSearch(searchForm.value); // 设置规则需要二级密码验证
done(); verifyPassword(async () => {
} else { const { code } = await settingXunLeRule({ ...curData });
message("设置失败", { type: "error" }); if (code) {
} message("设置成功", { type: "success" });
}; onSearch(searchForm.value);
FormRef.validate(valid => { done();
if (valid) { } else {
// console.log("curData", curData); message("设置失败", { type: "error" });
saveData(curData) }
} });
}); });
} }
}); });
} };
return { return {
searchForm, searchForm,
searchLabel, searchLabel,

View File

@@ -3,8 +3,9 @@ import editForm from "./form.vue";
import { ElMessageBox } from "element-plus"; import { ElMessageBox } from "element-plus";
import memberListView from "./memberList.vue"; import memberListView from "./memberList.vue";
import roomListView from "./roomList.vue"; import roomListView from "./roomList.vue";
import mergeFormView from './mergeForm.vue' import mergeFormView from "./mergeForm.vue";
import { message } from "@/utils/message"; import { message } from "@/utils/message";
import { verifyPassword } from "@/utils/passwordVerify";
import { import {
queryUnionList, queryUnionList,
addUnionData, addUnionData,
@@ -71,7 +72,7 @@ export function useData() {
preview-src-list={Array.of(row.guild_logo)} preview-src-list={Array.of(row.guild_logo)}
class="w-[24px] h-[24px] align-middle" class="w-[24px] h-[24px] align-middle"
/> />
), )
}, },
{ {
label: "今日流水", label: "今日流水",
@@ -85,15 +86,17 @@ export function useData() {
label: "公会状态", label: "公会状态",
prop: "status_str", prop: "status_str",
cellRenderer: ({ row }) => ( cellRenderer: ({ row }) => (
<el-tag type={row.status_str === '正常' ? 'success' : 'error'}>{row.status_str}</el-tag> <el-tag type={row.status_str === "正常" ? "success" : "error"}>
), {row.status_str}
</el-tag>
)
}, },
{ {
label: "显示状态", label: "显示状态",
prop: "is_show", prop: "is_show",
cellRenderer: ({ row }) => ( cellRenderer: ({ row }) => (
<div>{row.status_str === '正常' ? row.is_show_str : '-'}</div> <div>{row.status_str === "正常" ? row.is_show_str : "-"}</div>
), )
}, },
{ {
label: "创建时间", label: "创建时间",
@@ -106,9 +109,9 @@ export function useData() {
slot: "operation" slot: "operation"
} }
]); ]);
const onSearch = async (formData) => { const onSearch = async formData => {
loading.value = true; loading.value = true;
searchForm.value = { ...formData } searchForm.value = { ...formData };
const { data, code } = await queryUnionList({ const { data, code } = await queryUnionList({
...formData, ...formData,
page: pagination.value.currentPage, page: pagination.value.currentPage,
@@ -130,16 +133,20 @@ export function useData() {
pagination.value.currentPage = val; pagination.value.currentPage = val;
onSearch(searchForm.value); onSearch(searchForm.value);
}; };
// 解散工会
const handleDelete = async rowData => { const handleDelete = async rowData => {
const { code } = await dissolveUnionData({ id: rowData.id }); // 解散需要二级密码验证
if (code === "0") { verifyPassword(async () => {
message(`您删除了公会名称为【${rowData.guild_name}】的这条数据`, { const { code } = await dissolveUnionData({ id: rowData.id });
type: "success" if (code === "0") {
}); message(`您删除了公会名称为【${rowData.guild_name}】的这条数据`, {
onSearch(searchForm.value); type: "success"
} });
onSearch(searchForm.value);
}
});
}; };
// 新增 // 新增/编辑工会
const openDialog = (title = "新增", rowData: any) => { const openDialog = (title = "新增", rowData: any) => {
addDialog({ addDialog({
title: `${title}工会`, title: `${title}工会`,
@@ -161,46 +168,42 @@ export function useData() {
beforeSure: (done, { options }) => { beforeSure: (done, { options }) => {
const FormRef = formRef.value.getRef(); const FormRef = formRef.value.getRef();
const curData = options.props.formInline; const curData = options.props.formInline;
const saveData = async form => {
const { code, msg } = await addUnionData(form); FormRef.validate(async valid => {
if (code) { if (!valid) return;
message("新增成功", { type: "success" });
onSearch(searchForm.value); if (title === "新增") {
done(); // 新增操作
} else { const { code, msg } = await addUnionData(curData);
message(msg, { type: "error" }); if (code) {
} message("新增成功", { type: "success" });
}; onSearch(searchForm.value);
const updateData = async form => { done();
const { code } = await editUnionData({
...form,
id: rowData.id
});
if (code) {
message("修改成功", { type: "success" });
onSearch(searchForm.value);
done();
} else {
message("修改失败", { type: "error" });
}
};
FormRef.validate(valid => {
if (valid) {
// 表单规则校验通过
if (title === "新增") {
// 实际开发先调用新增接口,再进行下面操作
saveData(curData);
} else { } else {
// 实际开发先调用修改接口,再进行下面操作 message(msg, { type: "error" });
updateData(curData);
} }
} else {
// 编辑操作 - 需要二级密码验证
verifyPassword(async () => {
const { code } = await editUnionData({
...curData,
id: rowData.id
});
if (code) {
message("修改成功", { type: "success" });
onSearch(searchForm.value);
done();
} else {
message("修改失败", { type: "error" });
}
});
} }
}); });
} }
}); });
}; };
// 查看成员 roomListView memberListView // 查看成员 roomListView memberListView
const viewMember = (rowData) => { const viewMember = rowData => {
addDialog({ addDialog({
title: `查看成员列表`, title: `查看成员列表`,
props: { props: {
@@ -209,13 +212,13 @@ export function useData() {
width: "60%", width: "60%",
closeOnClickModal: false, closeOnClickModal: false,
contentRenderer: () => h(memberListView), contentRenderer: () => h(memberListView),
beforeSure: (done) => { beforeSure: done => {
done() done();
} }
}); });
} };
// 查看房间列表 // 查看房间列表
const viewRoomList = (rowData) => { const viewRoomList = rowData => {
addDialog({ addDialog({
title: `查看房间列表`, title: `查看房间列表`,
props: { props: {
@@ -224,11 +227,11 @@ export function useData() {
width: "60%", width: "60%",
closeOnClickModal: false, closeOnClickModal: false,
contentRenderer: () => h(roomListView), contentRenderer: () => h(roomListView),
beforeSure: (done) => { beforeSure: done => {
done() done();
} }
}); });
} };
// 合并公会 // 合并公会
const mergeData = async () => { const mergeData = async () => {
addDialog({ addDialog({
@@ -236,50 +239,54 @@ export function useData() {
props: { props: {
formInline: { formInline: {
guild_id: "", guild_id: "",
merge_guild_id: "", merge_guild_id: ""
} }
}, },
width: "40%", width: "40%",
closeOnClickModal: false, closeOnClickModal: false,
contentRenderer: () => h(mergeFormView, { ref: formRef, formInline: null }), contentRenderer: () =>
h(mergeFormView, { ref: formRef, formInline: null }),
beforeSure: (done, { options }) => { beforeSure: (done, { options }) => {
const FormRef = formRef.value.getRef(); const FormRef = formRef.value.getRef();
const curData = options.props.formInline; const curData = options.props.formInline;
FormRef.validate(valid => {
if (valid) { FormRef.validate(async valid => {
ElMessageBox.confirm( if (!valid) return;
`此操作不可更改,是否继续?`,
"提示", // 合并公会需要二级密码验证
{ verifyPassword(async () => {
type: "warning" ElMessageBox.confirm(`此操作不可更改,是否继续?`, "提示", {
} type: "warning"
) })
.then(async () => { .then(async () => {
const { code, msg } = await guildUnionData(curData) const { code, msg } = await guildUnionData(curData);
if (code) { if (code) {
message("操作成功", { type: "success" }); message("操作成功", { type: "success" });
onSearch(searchForm.value); onSearch(searchForm.value);
done() done();
} else { } else {
message(msg, { type: "error" }); message(msg, { type: "error" });
} }
}) })
.catch(() => { }); .catch(() => {});
} });
}); });
} }
}); });
} };
// 更改工会状态 隐藏 显示 // 更改工会状态 隐藏/显示
const changeShowStatus = async (rowData) => { const changeShowStatus = async rowData => {
const { data, code, msg } = await changeStatus({ id: rowData.id }) // 更改状态需要二级密码验证
if (code) { verifyPassword(async () => {
message("操作成功", { type: "success" }); const { code, msg } = await changeStatus({ id: rowData.id });
onSearch(searchForm.value); if (code) {
} else { message("操作成功", { type: "success" });
message(msg, { type: "error" }); onSearch(searchForm.value);
} } else {
} message(msg, { type: "error" });
}
});
};
return { return {
searchForm, searchForm,
searchLabel, searchLabel,

View File

@@ -2,13 +2,11 @@
import SearchForm from "@/components/SearchForm/index.vue"; import SearchForm from "@/components/SearchForm/index.vue";
import { ref, onMounted } from "vue"; import { ref, onMounted } from "vue";
import { message } from "@/utils/message"; import { message } from "@/utils/message";
import { import { verifyPassword } from "@/utils/passwordVerify";
queryUnionMemberList, import { queryUnionMemberList, kickUnionMember } from "@/api/modules/union";
kickUnionMember
} from "@/api/modules/union";
const props = defineProps(["rowData"]); const props = defineProps(["rowData"]);
const loading = ref(false) const loading = ref(false);
const tableList = ref([]) const tableList = ref([]);
const searchForm = ref({ const searchForm = ref({
user_id: "", user_id: "",
search_stime: "", search_stime: "",
@@ -56,20 +54,26 @@ const dynamicColumns = ref([
width: 300, width: 300,
slot: "operation" slot: "operation"
} }
]) ]);
const kickMember = async (rowData) => { const kickMember = async rowData => {
const { code, msg } = await kickUnionMember({ user_id: rowData.user_id, guild_id: props.rowData.id }); // 踢出成员需要二级密码验证
if (code) { verifyPassword(async () => {
message(`您已踢出昵称为【${rowData.nickname}】的用户`, { const { code, msg } = await kickUnionMember({
type: "success" user_id: rowData.user_id,
guild_id: props.rowData.id
}); });
onSearch(searchForm.value); if (code) {
} else { message(`您已踢出昵称为【${rowData.nickname}】的用户`, {
message(msg, { type: "success"
type: "error" });
}); onSearch(searchForm.value);
} } else {
} message(msg, {
type: "error"
});
}
});
};
const handleSizeChange = (val: number) => { const handleSizeChange = (val: number) => {
pagination.value.pageSize = val; pagination.value.pageSize = val;
onSearch(searchForm.value); onSearch(searchForm.value);
@@ -78,9 +82,9 @@ const handleCurrentChange = (val: number) => {
pagination.value.currentPage = val; pagination.value.currentPage = val;
onSearch(searchForm.value); onSearch(searchForm.value);
}; };
const onSearch = async (formData) => { const onSearch = async formData => {
loading.value = true; loading.value = true;
searchForm.value = { ...formData } searchForm.value = { ...formData };
const { data, code } = await queryUnionMemberList({ const { data, code } = await queryUnionMemberList({
...formData, ...formData,
guild_id: props.rowData.id, guild_id: props.rowData.id,
@@ -93,10 +97,10 @@ const onSearch = async (formData) => {
pagination.value.currentPage = data.page; pagination.value.currentPage = data.page;
} }
loading.value = false; loading.value = false;
} };
onMounted(() => { onMounted(() => {
onSearch(searchForm.value) onSearch(searchForm.value);
}) });
</script> </script>
<template> <template>
@@ -112,12 +116,9 @@ onMounted(() => {
<!-- v-if="row.status_str === '正常'" --> <!-- v-if="row.status_str === '正常'" -->
<el-popconfirm :title="`是否确认踢出名称为【${row.nickname}】的用户`" @confirm="kickMember(row)"> <el-popconfirm :title="`是否确认踢出名称为【${row.nickname}】的用户`" @confirm="kickMember(row)">
<template #reference> <template #reference>
<el-button link type="primary"> <el-button link type="primary"> 踢出成员 </el-button>
踢出成员
</el-button>
</template> </template>
</el-popconfirm> </el-popconfirm>
</template> </template>
</pure-table> </pure-table>
</div> </div>