提交 f401a183 编写于 作者: kadycui's avatar kadycui 💻

ADD: 状态修改, 权限数据删除

上级 0ae07ddb
...@@ -15,4 +15,14 @@ export function createRule(data) { ...@@ -15,4 +15,14 @@ export function createRule(data) {
export function updateRule(id, data) { export function updateRule(id, data) {
return axios.post("/admin/rule/" + id, data) return axios.post("/admin/rule/" + id, data)
}
export function updateRuleStatus(id, status){
return axios.post(`/admin/rule/${id}/update_status`, {status})
}
export function deleteRule(id){
return axios.post(`/admin/rule/${id}/delete`)
} }
\ No newline at end of file
...@@ -14,10 +14,16 @@ ...@@ -14,10 +14,16 @@
</el-icon> </el-icon>
<span> {{ data.name }}</span> <span> {{ data.name }}</span>
<div class="ml-auto"> <div class="ml-auto">
<el-switch :modelValue="data.status" :active-value="1" :inactive-value="0" /> <el-switch :modelValue="data.status" :active-value="1"
:inactive-value="0" @change="handleStatusChange($event, data)" />
<el-button text type="primary" size="small" @click.stop="handleEdit(data)">修改</el-button> <el-button text type="primary" size="small" @click.stop="handleEdit(data)">修改</el-button>
<el-button text type="primary" size="small" @click.stop="addChild(data.id)">增加</el-button> <el-button text type="primary" size="small" @click.stop="addChild(data.id)">增加</el-button>
<el-button text type="primary" size="small">删除</el-button> <el-popconfirm title="是否删除该记录?" confirm-button-text="确认" cancel-button-text="取消"
@confirm="handleDelete(data.id)">
<template #reference>
<el-button text type="primary" size="small">删除</el-button>
</template>
</el-popconfirm>
</div> </div>
</div> </div>
</template> </template>
...@@ -76,7 +82,9 @@ import IconSelect from "@/components/IconSelect.vue" ...@@ -76,7 +82,9 @@ import IconSelect from "@/components/IconSelect.vue"
import { import {
getRuleList, getRuleList,
createRule, createRule,
updateRule updateRule,
updateRuleStatus,
deleteRule
} from "@/api/rule.js" } from "@/api/rule.js"
...@@ -93,15 +101,18 @@ const defaultExpandKeys = ref([]) ...@@ -93,15 +101,18 @@ const defaultExpandKeys = ref([])
const { const {
loading, loading,
tableData, tableData,
getData getData,
handleDelete,
handleStatusChange
} = useInitTable({ } = useInitTable({
getList: getRuleList, getList: getRuleList,
onGetListSuccess: (res) => { onGetListSuccess: (res) => {
tableData.value = res.list tableData.value = res.list
options.value = res.rules options.value = res.rules
defaultExpandKeys.value = res.list.map(o => o.id) defaultExpandKeys.value = res.list.map(o => o.id)
} },
delete:deleteRule,
updateStatus:updateRuleStatus
}) })
...@@ -115,7 +126,6 @@ const { ...@@ -115,7 +126,6 @@ const {
handleSubmit, handleSubmit,
handleCreate, handleCreate,
handleEdit handleEdit
} = useInitForm( } = useInitForm(
{ {
form: { form: {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册