创建路径名字重复校验

This commit is contained in:
zhangyc
2022-12-25 16:29:14 +08:00
parent a44efa9931
commit 2a0e6c5870

View File

@@ -278,7 +278,7 @@
/>
</div>
<div class="inname">路径图名称</div>
<div class="in" >
<div class="in road" >
<!-- <a-input-->
<!-- v-model:value="pathName"-->
<!-- maxlength="20"-->
@@ -710,6 +710,7 @@ import { storage } from "../../api/storage";
import { useStore } from "vuex";
import OrgClass from "@/components/project/OrgClass";
import NameInput from "@/components/project/NameInput";
import {validateName} from "../../api/index1";
export default {
name: "learningPath",
@@ -1458,7 +1459,7 @@ export default {
state.organizationSelectId = e;
};
//创建学习路径图
const createLearnPath = () => {
const createLearnPath = async() => {
if (!state.pathName) {
message.destroy();
return message.warning("请输入路径图名称");
@@ -1475,6 +1476,17 @@ export default {
message.destroy();
message.warning("路径图名称重复");
return;
}
const offName = await validateName({
name: state.pathName,
type: 3,
id:state.editPathId,
}).then(res => {
return res.data.data == 1;
});
if (offName) {
message.destroy();
return message.warning("项目名称重复,请重新填写");
}
state.lpLoading = true;
let obj = {
@@ -1636,7 +1648,7 @@ export default {
state.out1 = true;
};
//编辑学习路径图
const editLearnPath = () => {
const editLearnPath = async () => {
if (!state.pathName) {
message.destroy();
return message.warning("请输入路径图名称");
@@ -1661,6 +1673,17 @@ export default {
// state.pathIntro = detail.remark;
// state.editPathId = id;
// state.createLoading = true;
const offName = await validateName({
name: state.pathName,
type: 3,
id:state.editPathId,
}).then(res => {
return res.data.data == 1;
});
if (offName) {
message.destroy();
return message.warning("项目名称重复,请重新填写");
}
let obj = {
routerId: state.editPathId,
name: state.pathName,