Commit 0c9ac1a2 authored by 李鹏 's avatar 李鹏

添加文档类型编辑时切换状态条件

parent f9c6f7a8
...@@ -157,7 +157,8 @@ ...@@ -157,7 +157,8 @@
:active-value="1" :active-value="1"
:inactive-value="0" :inactive-value="0"
active-text="是" active-text="是"
inactive-text="否" /> inactive-text="否"
:before-change="() => beforeSwitchStatusInEdit()" />
</el-form-item> </el-form-item>
</el-form> </el-form>
<template #footer> <template #footer>
...@@ -394,6 +395,20 @@ const handleCloseForm = () => { ...@@ -394,6 +395,20 @@ const handleCloseForm = () => {
}; };
state.formDialogConfig.visible = false; state.formDialogConfig.visible = false;
}; };
//在编辑状态中切换起停用状态
const beforeSwitchStatusInEdit = async () => {
if (state.selectedRow.is_active) {
const res = await axios.get(
`/apaas/knowledge/v5/documentmgr/classify/quote/${state.selectedRow.id}`
);
if (res.data.code !== 200) {
ElMessage.warning("请将该文档类型下所挂载的文档删除或转移至其他文档类型下再停用!");
return false;
}
return true;
}
return true;
};
const editCurType = async (row) => { const editCurType = async (row) => {
const res = await axios.get(`/apaas/knowledge/v5/documentmgr/classify/detail/${row.id}`); const res = await axios.get(`/apaas/knowledge/v5/documentmgr/classify/detail/${row.id}`);
...@@ -453,13 +468,16 @@ const deleteCurType = (row) => { ...@@ -453,13 +468,16 @@ const deleteCurType = (row) => {
content: "确定删除该文档类型吗?", content: "确定删除该文档类型吗?",
}; };
}; };
//在列表中切换起停用状态
const beforeSwitchStatus = async (row) => { const beforeSwitchStatus = async (row) => {
const res = await axios.get(`/apaas/knowledge/v5/documentmgr/classify/quote/${row.id}`); if (row.is_active) {
console.log(res); const res = await axios.get(`/apaas/knowledge/v5/documentmgr/classify/quote/${row.id}`);
if (res.data.code !== 200) { if (res.data.code !== 200) {
ElMessage.warning("请将该文档类型下所挂载的文档删除或转移至其他文档类型下再停用!"); ElMessage.warning("请将该文档类型下所挂载的文档删除或转移至其他文档类型下再停用!");
return false; return false;
}
} }
const text = row.is_active ? "停用" : "启用"; const text = row.is_active ? "停用" : "启用";
state.selectedRow = row; state.selectedRow = row;
state.secondTipsDialogConfig = { state.secondTipsDialogConfig = {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment