新增编辑功能

This commit is contained in:
Dragon
2023-10-26 14:58:07 +08:00
parent c23afafdc5
commit 8226604c00
2 changed files with 93 additions and 4 deletions

View File

@@ -42,6 +42,14 @@ export const saveManager = query => {
params: query
});
};
// 弹窗编辑
export const redEnvelopeUpdate = query => {
return request({
url: '/admin/room/redEnvelope/update',
method: 'post',
params: query
});
};
// 弹窗删除
export const delUserRoomRedEnvelope = query => {
return request({

View File

@@ -102,7 +102,11 @@
<el-button
class="dialogTableVisibleBut primary"
type="primary"
@click="authorityLimits = true"
@click="
authorityLimits = true;
radioFull = false;
radioHall = false;
"
>
新增
</el-button>
@@ -142,8 +146,16 @@
: "空或未知类型"
}}</template>
</el-table-column>
<el-table-column align="center" label="操作">
<el-table-column align="center" label="操作" width="200px">
<template v-slot="scope">
<el-button
@click="editTablePower(scope.row)"
class="primary"
type="primary"
size="default"
:disabled="!(scope.row.roomUid === scope.row.uid) ? false : true"
>编辑</el-button
>
<el-button
@click="delTablePower(scope.row)"
class="danger"
@@ -203,6 +215,29 @@
</span>
</template>
</el-dialog>
<!-- 编辑弹窗 -->
<el-dialog v-model="editDialog" title="编辑" width="30%" center>
<div class="optionBox">
<el-checkbox
v-model="radioHall"
@change="checkBoxChange()"
label="厅内红包"
size="large"
/>
<el-checkbox
v-model="radioFull"
@change="checkBoxChange()"
label="全服红包"
size="large"
/>
</div>
<template #footer>
<span class="dialog-footer">
<el-button @click="editDialog = false">取消</el-button>
<el-button type="primary" @click="editDialogClick()"> 确认 </el-button>
</span>
</template>
</el-dialog>
<!-- 公共二次确认删除弹窗 -->
<el-dialog v-model="delDialog" title="提示" width="30%" center>
<span> {{ delDialogText }}</span>
@@ -223,12 +258,14 @@ import {
delUserRoomRedEnvelope,
userPage,
saveManager,
redEnvelopeUpdate,
} from "@/api/roomAlbumPower/RoomRed";
import { ElMessage } from "element-plus";
export default {
name: "RoomRed",
data() {
return {
editDialog: false,
total: 10, //总页数
currentPage: 1, //页码
pageSize: 10, //条数
@@ -256,6 +293,7 @@ export default {
public: null,
delTablePowerRoomUid: null,
delTablePowerUid: null,
editTableData: {},
};
},
created() {
@@ -333,6 +371,49 @@ export default {
this.delTablePowerRoomUid = row.roomUid;
this.delTablePowerUid = row.uid;
},
// 编辑弹窗权限
editTablePower(row) {
if (row.type == 1) {
this.radioHall = true;
this.radioFull = false;
} else if (row.type == 2) {
this.radioHall = false;
this.radioFull = true;
} else if (row.type == 3) {
this.radioHall = true;
this.radioFull = true;
}
this.editTableData = row;
this.editDialog = true;
},
// 确认编辑按钮
editDialogClick() {
if (this.radioHall && this.radioFull) {
this.typeRadio = 3;
} else if (this.radioHall && this.radioFull == false) {
this.typeRadio = 1;
} else if (this.radioFull && this.radioHall == false) {
this.typeRadio = 2;
} else {
this.typeRadio = 0;
}
if (this.typeRadio == 0) {
ElMessage({
message: "请勾选开启的权限",
type: "error",
});
return;
}
redEnvelopeUpdate({
id: this.editTableData.id,
roomUid: this.editTableData.roomUid,
uid: this.editTableData.uid,
type: this.typeRadio,
}).then((res) => {
this.editDialog = false;
this.getUserPage(this.editTableData.roomUid);
});
},
// 确认新增房间红包弹窗按钮
addAuthority() {
redEnvelopeSave({
@@ -350,13 +431,13 @@ export default {
this.typeRadio = 1;
} else if (this.radioFull && this.radioHall == false) {
this.typeRadio = 2;
}else{
} else {
this.typeRadio = 0;
}
},
// 确认弹窗新增按钮
addAuthorityLimits() {
console.log(this.typeRadio);
console.log(this.typeRadio);
if (this.typeRadio == 0) {
ElMessage({
message: "请勾选开启的权限",