|
|
@ -1,6 +1,6 @@ |
|
|
|
<script setup> |
|
|
|
import { ref, onMounted, computed, reactive } from "vue"; |
|
|
|
import { ElMessageBox } from "element-plus"; |
|
|
|
import { ElMessage, ElMessageBox } from "element-plus"; |
|
|
|
import axios from "axios"; |
|
|
|
import { createApp } from "vue"; |
|
|
|
import moment from "moment"; |
|
|
@ -98,10 +98,9 @@ const search = function () { |
|
|
|
get(); |
|
|
|
}; |
|
|
|
// 添加方法 |
|
|
|
const rateAdd = ref({ |
|
|
|
adminId: "1", |
|
|
|
}); |
|
|
|
const rateAdd = ref({}); |
|
|
|
const addRate = async function () { |
|
|
|
rateAdd.value.adminId = adminData.value.adminId; |
|
|
|
try { |
|
|
|
console.log("搜索参数", getObj.value); |
|
|
|
// 发送POST请求 |
|
|
@ -109,7 +108,9 @@ const addRate = async function () { |
|
|
|
"http://192.168.8.93:10010/rates/add", |
|
|
|
rateAdd.value |
|
|
|
); |
|
|
|
|
|
|
|
if (result.code == 0) { |
|
|
|
ElMessage.error(result.msg); |
|
|
|
} |
|
|
|
// 将响应结果存储到响应式数据中 |
|
|
|
console.log("请求成功", result); |
|
|
|
get(); |
|
|
@ -162,6 +163,7 @@ const getEditData = async function (row) { |
|
|
|
// 存储表格数据 |
|
|
|
|
|
|
|
rateEdit.value = result.data; |
|
|
|
rateEdit.value.adminId = adminData.value.adminId; |
|
|
|
console.log("这是编辑的数值", rateEdit.value); |
|
|
|
} catch (error) { |
|
|
|
console.log("请求失败", error); |
|
|
@ -347,6 +349,26 @@ const checkNumber = function () { |
|
|
|
}); |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
// 删除========================================================= |
|
|
|
// 删除按钮 |
|
|
|
|
|
|
|
// 删除按钮的气泡弹出框确认按钮 |
|
|
|
const delConfirm = async function (row) { |
|
|
|
try { |
|
|
|
// 发送POST请求 |
|
|
|
const result = await API.post( |
|
|
|
"http://192.168.8.93:10010/rates/delete/ " + row.rateId, |
|
|
|
{} |
|
|
|
); |
|
|
|
// 将响应结果存储到响应式数据中 |
|
|
|
console.log("请求成功", result); |
|
|
|
get(); |
|
|
|
} catch (error) { |
|
|
|
console.log("请求失败", error); |
|
|
|
// 在这里可以处理错误逻辑,比如显示错误提示等 |
|
|
|
} |
|
|
|
}; |
|
|
|
</script> |
|
|
|
|
|
|
|
<template> |
|
|
@ -427,7 +449,7 @@ const checkNumber = function () { |
|
|
|
<span v-if="scope.row.status === 1"> |
|
|
|
<div class="status"> |
|
|
|
<span class="green-dot"></span> |
|
|
|
<span>进行中</span> |
|
|
|
<span>使用中</span> |
|
|
|
</div> |
|
|
|
</span> |
|
|
|
<span v-if="scope.row.status === 0"> |
|
|
@ -439,7 +461,7 @@ const checkNumber = function () { |
|
|
|
<span v-if="scope.row.status === 2"> |
|
|
|
<div class="status"> |
|
|
|
<span class="grey-dot"></span> |
|
|
|
<span>已结束</span> |
|
|
|
<span>已过期</span> |
|
|
|
</div> |
|
|
|
</span> |
|
|
|
</template> |
|
|
@ -461,9 +483,24 @@ const checkNumber = function () { |
|
|
|
" |
|
|
|
>编辑</el-button |
|
|
|
> |
|
|
|
<el-button type="text" @click="deleteRate(scope.row)" |
|
|
|
>删除</el-button |
|
|
|
<el-popconfirm |
|
|
|
title="确定将此条活动删除吗?" |
|
|
|
@confirm="delConfirm" |
|
|
|
> |
|
|
|
<template #reference> |
|
|
|
<el-button type="primary" text> 删除 </el-button> |
|
|
|
</template> |
|
|
|
<template #actions="{ confirm, cancel }"> |
|
|
|
<el-button size="small" @click="cancel">取消</el-button> |
|
|
|
<el-button |
|
|
|
type="primary" |
|
|
|
size="small" |
|
|
|
@click="confirm(scope.row)" |
|
|
|
> |
|
|
|
确定 |
|
|
|
</el-button> |
|
|
|
</template> |
|
|
|
</el-popconfirm> |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
</el-table> |
|
|
@ -698,4 +735,7 @@ p { |
|
|
|
.pagination { |
|
|
|
display: flex; |
|
|
|
} |
|
|
|
.status { |
|
|
|
display: flex; |
|
|
|
} |
|
|
|
</style> |