mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/fe-manage.git
synced 2025-12-09 02:46:45 +08:00
-- 项目名称校验
This commit is contained in:
@@ -131,6 +131,7 @@ export const addStudentCourse = (obj) => http.post("/admin/offcourse/addStudent"
|
||||
// 获取组织结构树
|
||||
export const orgtree = () => http.get("/org/tree");
|
||||
export const saveStu = obj => http.post("/admin/student/addStudent", obj);
|
||||
export const validateName = obj => http.post("/admin/validate/validateName", obj);
|
||||
|
||||
//获取积分列表
|
||||
export const noticeList = (projectId) =>
|
||||
|
||||
58
src/components/project/NameInput.vue
Normal file
58
src/components/project/NameInput.vue
Normal file
@@ -0,0 +1,58 @@
|
||||
<template>
|
||||
<a-input
|
||||
v-model:value="modelV"
|
||||
placeholder="请输入项目名称"
|
||||
:show-count="showCount"
|
||||
:maxlength="maxlength"
|
||||
@blur="validateProName"
|
||||
/>
|
||||
<div style="color:red;font-size: 10px" v-if="value && !validate">名称重复,请重新输入</div>
|
||||
</template>
|
||||
<script setup>
|
||||
import {defineProps, defineEmits, watch, ref} from "vue";
|
||||
import {validateName} from "@/api/index1";
|
||||
|
||||
const props = defineProps({
|
||||
value: {
|
||||
type: String,
|
||||
},
|
||||
validate: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
type: {
|
||||
type: Number,
|
||||
default: 1
|
||||
},
|
||||
maxlength: {
|
||||
type: Number,
|
||||
default: 30
|
||||
},
|
||||
showCount: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
})
|
||||
|
||||
const emit = defineEmits({})
|
||||
|
||||
const modelV = ref()
|
||||
|
||||
watch(() => props.value, () => {
|
||||
if (props.value !== modelV.value) {
|
||||
modelV.value = props.value
|
||||
}
|
||||
})
|
||||
|
||||
watch(modelV, () => {
|
||||
emit('update:value', modelV.value)
|
||||
})
|
||||
|
||||
function validateProName() {
|
||||
console.log(props.value)
|
||||
props.value && validateName({name: props.value, type: props.type}).then(res => {
|
||||
emit('update:validate', res.data.data !== 1)
|
||||
})
|
||||
}
|
||||
|
||||
</script>
|
||||
@@ -132,16 +132,17 @@
|
||||
</div>
|
||||
<span style="margin-right: 3px">课程名称:</span>
|
||||
</div>
|
||||
<div class="b_input">
|
||||
<a-input
|
||||
v-model:value="xzinputV1"
|
||||
maxlength="20"
|
||||
style="width: 440px; height: 40px; border-radius: 8px"
|
||||
placeholder="请输入课程名称"
|
||||
/>
|
||||
<div class="inp_num">
|
||||
<span style="color: #c7cbd2">{{ xzinputV1.length }}/20</span>
|
||||
</div>
|
||||
<div class="in b_input">
|
||||
<NameInput placeholder="请输入课程名称" v-model:value="xzinputV1" v-model:validate="validate" :maxlength="20" show-count :type="2"></NameInput>
|
||||
<!-- <a-input-->
|
||||
<!-- v-model:value="xzinputV1"-->
|
||||
<!-- maxlength="20"-->
|
||||
<!-- style="width: 440px; height: 40px; border-radius: 8px"-->
|
||||
<!-- placeholder="请输入课程名称"-->
|
||||
<!-- />-->
|
||||
<!-- <div class="inp_num">-->
|
||||
<!-- <span style="color: #c7cbd2">{{ xzinputV1.length }}/20</span>-->
|
||||
<!-- </div>-->
|
||||
</div>
|
||||
</div>
|
||||
<div class="b_sub">
|
||||
@@ -336,14 +337,15 @@
|
||||
<span style="margin-right: 14px">课程名称</span>
|
||||
</div>
|
||||
<div class="item_inp">
|
||||
<div class="i1_input">
|
||||
<a-input
|
||||
aria-readonly="true"
|
||||
v-model:value="qdms_inputV1"
|
||||
maxlength="90"
|
||||
style="width: 440px; height: 40px; border-radius: 8px"
|
||||
placeholder="请输入课程名称"
|
||||
/>
|
||||
<div class="in i1_input">
|
||||
<!-- <a-input-->
|
||||
<!-- aria-readonly="true"-->
|
||||
<!-- v-model:value="qdms_inputV1"-->
|
||||
<!-- maxlength="90"-->
|
||||
<!-- style="width: 440px; height: 40px; border-radius: 8px"-->
|
||||
<!-- placeholder="请输入课程名称"-->
|
||||
<!-- />-->
|
||||
<NameInput placeholder="请输入课程名称" v-model:value="qdms_inputV1" v-model:validate="validate" :maxlength="20" show-count :type="2"></NameInput>
|
||||
<div class="inp_num">
|
||||
<span style="color: #c7cbd2">
|
||||
{{ qdms_inputV1.length }}/90
|
||||
@@ -2752,6 +2754,7 @@ import { useRouter, useRoute } from "vue-router";
|
||||
import addOnlineCourse from "../../components/Modals/addOnlineCourse.vue";
|
||||
|
||||
import ProjOwnerShip from "../../components/drawers/ProjectOwn";
|
||||
import NameInput from "../../components/project/NameInput";
|
||||
import ProjPowerList from "../../components/drawers/ProjPowerList";
|
||||
import ProjCheckShip from "../../components/drawers/ProjCheckPower";
|
||||
import AssessmentList from "../../components/drawers/AssessmentList.vue";
|
||||
@@ -3305,6 +3308,7 @@ export default defineComponent({
|
||||
ProjPowerList,
|
||||
ProjCheckShip,
|
||||
AssessmentList,
|
||||
NameInput,
|
||||
// VNodes: (_, {attrs}) => {
|
||||
// return attrs.vnodes;
|
||||
// },
|
||||
@@ -3535,6 +3539,7 @@ export default defineComponent({
|
||||
|
||||
imageUrl: "",
|
||||
imgList: [],
|
||||
validate:true,
|
||||
|
||||
pageSize2: 10,
|
||||
currentPage2: 0,
|
||||
@@ -4481,6 +4486,10 @@ export default defineComponent({
|
||||
message.destroy();
|
||||
return message.warning("请输入必填项");
|
||||
}
|
||||
if (!state.validate) {
|
||||
message.destroy();
|
||||
return message.warning("路径图名称重复");
|
||||
}
|
||||
console.log(
|
||||
"state.bs_hs && state.valueE1 == 2",
|
||||
state.bs_hs,
|
||||
@@ -4594,7 +4603,10 @@ export default defineComponent({
|
||||
} else {
|
||||
state.addLoading = true;
|
||||
}
|
||||
|
||||
if (!state.validate) {
|
||||
message.destroy();
|
||||
return message.warning("路径图名称重复");
|
||||
}
|
||||
edit(postData).then((res) => {
|
||||
if (res.data.code === 200) {
|
||||
getTableDate();
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -3,13 +3,13 @@
|
||||
<div class="projectAdd">
|
||||
<div class="header">
|
||||
<span class="title"
|
||||
>{{ projectInfo.parentId ? "编辑" : "创建" }}项目</span
|
||||
>{{ projectInfo.parentId ? "编辑" : "创建" }}项目</span
|
||||
>
|
||||
<div
|
||||
@click="backPage"
|
||||
style="cursor: pointer"
|
||||
to="/projectmanage"
|
||||
class="goback"
|
||||
@click="backPage"
|
||||
style="cursor: pointer"
|
||||
to="/projectmanage"
|
||||
class="goback"
|
||||
>
|
||||
<span class="return"></span><span class="returntext">返回</span>
|
||||
</div>
|
||||
@@ -19,8 +19,8 @@
|
||||
<div class="name" v-if="projectInfo.parentName">
|
||||
<div class="namebox">
|
||||
<img
|
||||
class="nameimg"
|
||||
src="../../assets/images/basicinfo/asterisk.png"
|
||||
class="nameimg"
|
||||
src="../../assets/images/basicinfo/asterisk.png"
|
||||
/>
|
||||
<div class="inname">项目归属</div>
|
||||
</div>
|
||||
@@ -33,33 +33,27 @@
|
||||
<div class="name">
|
||||
<div class="namebox">
|
||||
<img
|
||||
class="nameimg"
|
||||
src="../../assets/images/basicinfo/asterisk.png"
|
||||
class="nameimg"
|
||||
src="../../assets/images/basicinfo/asterisk.png"
|
||||
/>
|
||||
<div class="inname">项目名称</div>
|
||||
</div>
|
||||
<div class="in">
|
||||
<a-input
|
||||
v-model:value="projectInfo.name"
|
||||
placeholder="请输入项目名称"
|
||||
show-count
|
||||
:maxlength="30"
|
||||
:disabled="viewDetail ? true : false"
|
||||
/>
|
||||
<NameInput placeholder="请输入项目名称" v-model:value="projectInfo.name" v-model:validate="projectInfo.validate" :maxlength="30" show-count></NameInput>
|
||||
</div>
|
||||
</div>
|
||||
<div class="name flex-top">
|
||||
<div class="namebox" style="margin-top: 10px">
|
||||
<img
|
||||
class="nameimg"
|
||||
src="../../assets/images/basicinfo/asterisk.png"
|
||||
class="nameimg"
|
||||
src="../../assets/images/basicinfo/asterisk.png"
|
||||
/>
|
||||
<div class="inname">封面图</div>
|
||||
</div>
|
||||
<div class="in select" style="flex: 1; display: flex">
|
||||
<div
|
||||
:class="`box ${projectInfo.picUrl === src.value ? 'active' : ''}`"
|
||||
style="
|
||||
:class="`box ${projectInfo.picUrl === src.value ? 'active' : ''}`"
|
||||
style="
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
border-radius: 5px;
|
||||
@@ -67,19 +61,19 @@
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
"
|
||||
v-for="(src, index) in projectPic"
|
||||
:key="index"
|
||||
@click="() => (projectInfo.picUrl = src.value)"
|
||||
v-for="(src, index) in projectPic"
|
||||
:key="index"
|
||||
@click="() => (projectInfo.picUrl = src.value)"
|
||||
>
|
||||
<img
|
||||
style="
|
||||
style="
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
margin-bottom: 4px;
|
||||
margin-right: 4px;
|
||||
"
|
||||
:src="src.value"
|
||||
alt="avatar"
|
||||
:src="src.value"
|
||||
alt="avatar"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
@@ -87,63 +81,63 @@
|
||||
<div class="name">
|
||||
<div class="namebox">
|
||||
<img
|
||||
class="nameimg"
|
||||
src="../../assets/images/basicinfo/asterisk.png"
|
||||
class="nameimg"
|
||||
src="../../assets/images/basicinfo/asterisk.png"
|
||||
/>
|
||||
<div class="inname">项目时间</div>
|
||||
</div>
|
||||
|
||||
<div class="in">
|
||||
<a-range-picker
|
||||
show-time
|
||||
separator="至"
|
||||
:placeholder="[' 开始时间', ' 结束时间']"
|
||||
v-model:value="projectInfo.rangeTime"
|
||||
style="width: 100%; height: 40px; border-radius: 5px"
|
||||
valueFormat="YYYY-MM-DD HH:mm:ss"
|
||||
@change="timeChange"
|
||||
:disabled="viewDetail ? true : false"
|
||||
show-time
|
||||
separator="至"
|
||||
:placeholder="[' 开始时间', ' 结束时间']"
|
||||
v-model:value="projectInfo.rangeTime"
|
||||
style="width: 100%; height: 40px; border-radius: 5px"
|
||||
valueFormat="YYYY-MM-DD HH:mm:ss"
|
||||
@change="timeChange"
|
||||
:disabled="viewDetail ? true : false"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="name">
|
||||
<div class="namebox">
|
||||
<img
|
||||
class="nameimg"
|
||||
src="../../assets/images/basicinfo/asterisk.png"
|
||||
class="nameimg"
|
||||
src="../../assets/images/basicinfo/asterisk.png"
|
||||
/>
|
||||
<div class="inname">项目经理</div>
|
||||
</div>
|
||||
<div class="in">
|
||||
<ProjectManager
|
||||
v-model:value="projectInfo.managerId"
|
||||
v-model:name="projectInfo.manager"
|
||||
@onChange="managerChange"
|
||||
mode="multiple"
|
||||
v-model:value="projectInfo.managerId"
|
||||
v-model:name="projectInfo.manager"
|
||||
@onChange="managerChange"
|
||||
mode="multiple"
|
||||
></ProjectManager>
|
||||
</div>
|
||||
</div>
|
||||
<div class="name">
|
||||
<div class="namebox">
|
||||
<img
|
||||
class="nameimg"
|
||||
src="../../assets/images/basicinfo/asterisk.png"
|
||||
class="nameimg"
|
||||
src="../../assets/images/basicinfo/asterisk.png"
|
||||
/>
|
||||
<div class="inname">资源归属</div>
|
||||
</div>
|
||||
|
||||
<div class="in select">
|
||||
<OrgClass
|
||||
v-model:value="projectInfo.sourceBelongId"
|
||||
v-model:name="projectInfo.sourceBelongName"
|
||||
v-model:value="projectInfo.sourceBelongId"
|
||||
v-model:name="projectInfo.sourceBelongName"
|
||||
></OrgClass>
|
||||
</div>
|
||||
</div>
|
||||
<div class="name">
|
||||
<div class="namebox">
|
||||
<img
|
||||
class="nameimg"
|
||||
src="../../assets/images/basicinfo/asterisk.png"
|
||||
class="nameimg"
|
||||
src="../../assets/images/basicinfo/asterisk.png"
|
||||
/>
|
||||
<div class="inname">项目级别</div>
|
||||
</div>
|
||||
@@ -154,8 +148,8 @@
|
||||
<div class="name">
|
||||
<div class="namebox">
|
||||
<img
|
||||
class="nameimg"
|
||||
src="../../assets/images/basicinfo/asterisk.png"
|
||||
class="nameimg"
|
||||
src="../../assets/images/basicinfo/asterisk.png"
|
||||
/>
|
||||
<div class="inname">培训分类</div>
|
||||
</div>
|
||||
@@ -166,15 +160,15 @@
|
||||
<div class="name">
|
||||
<div class="namebox">
|
||||
<img
|
||||
class="nameimg"
|
||||
src="../../assets/images/basicinfo/asterisk.png"
|
||||
class="nameimg"
|
||||
src="../../assets/images/basicinfo/asterisk.png"
|
||||
/>
|
||||
<div class="inname">是否BOEU实施</div>
|
||||
</div>
|
||||
<div class="in">
|
||||
<a-radio-group
|
||||
v-model:value="projectInfo.boeFlag"
|
||||
:disabled="viewDetail ? true : false"
|
||||
v-model:value="projectInfo.boeFlag"
|
||||
:disabled="viewDetail ? true : false"
|
||||
>
|
||||
<a-radio :style="radioStyle" :value="1">是</a-radio>
|
||||
<a-radio :style="radioStyle" :value="0">否</a-radio>
|
||||
@@ -187,16 +181,16 @@
|
||||
</div>
|
||||
<div class="in">
|
||||
<a-checkbox
|
||||
v-model:checked="courseSyncFlag"
|
||||
:disabled="viewDetail ? true : false"
|
||||
><span
|
||||
v-model:checked="courseSyncFlag"
|
||||
:disabled="viewDetail ? true : false"
|
||||
><span
|
||||
style="
|
||||
width: 100%;
|
||||
color: rgba(109, 117, 132, 1);
|
||||
font-size: 14px;
|
||||
"
|
||||
>同步课程学习记录(如学员在课程库中拥有课程的学习记录,自动免修该课程)</span
|
||||
></a-checkbox
|
||||
>同步课程学习记录(如学员在课程库中拥有课程的学习记录,自动免修该课程)</span
|
||||
></a-checkbox
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
@@ -206,12 +200,12 @@
|
||||
</div>
|
||||
<div class="in">
|
||||
<a-textarea
|
||||
v-model:value="projectInfo.remark"
|
||||
style="height: 80px"
|
||||
placeholder="请输入说明"
|
||||
show-count
|
||||
:maxlength="200"
|
||||
:disabled="viewDetail ? true : false"
|
||||
v-model:value="projectInfo.remark"
|
||||
style="height: 80px"
|
||||
placeholder="请输入说明"
|
||||
show-count
|
||||
:maxlength="200"
|
||||
:disabled="viewDetail ? true : false"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
@@ -221,18 +215,18 @@
|
||||
<div class="inname" style="width: 50px">模版</div>
|
||||
<div class="in select" style="margin-left: 2px">
|
||||
<a-select
|
||||
:getPopupContainer="
|
||||
:getPopupContainer="
|
||||
(triggerNode) => {
|
||||
return triggerNode.parentNode || document.body;
|
||||
}
|
||||
"
|
||||
placeholder="请选择模版"
|
||||
:size="size"
|
||||
style="width: 100%"
|
||||
:options="classifyList5"
|
||||
@change="classificationChange5"
|
||||
@popupScroll="templateScroll"
|
||||
:fieldNames="{
|
||||
placeholder="请选择模版"
|
||||
:size="size"
|
||||
style="width: 100%"
|
||||
:options="classifyList5"
|
||||
@change="classificationChange5"
|
||||
@popupScroll="templateScroll"
|
||||
:fieldNames="{
|
||||
label: 'name',
|
||||
value: 'projectTemplateId',
|
||||
}"
|
||||
@@ -246,29 +240,31 @@
|
||||
<div class="btn">
|
||||
<a-button @click="backPage" class="btn2">取消</a-button>
|
||||
<a-button
|
||||
v-on:click="createProject"
|
||||
type="primary"
|
||||
class="btn1"
|
||||
style="margin-left: 20px"
|
||||
>确定</a-button
|
||||
v-on:click="createProject"
|
||||
type="primary"
|
||||
class="btn1"
|
||||
style="margin-left: 20px"
|
||||
>确定
|
||||
</a-button
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import { onMounted, reactive, toRefs, watch } from "vue";
|
||||
import { message } from "ant-design-vue";
|
||||
import { useRoute, useRouter } from "vue-router";
|
||||
import {onMounted, reactive, toRefs, watch} from "vue";
|
||||
import {message} from "ant-design-vue";
|
||||
import {useRoute, useRouter} from "vue-router";
|
||||
import * as api from "../../api/index";
|
||||
import { useStore } from "vuex";
|
||||
import {useStore} from "vuex";
|
||||
// import ProjectClass from "@/components/project/ProjectClass";
|
||||
import TrainClass from "@/components/project/TrainClass";
|
||||
import OrgClass from "@/components/project/OrgClass";
|
||||
import ProjectManager from "@/components/project/ProjectManagerNew";
|
||||
import NameInput from "@/components/project/NameInput";
|
||||
import ProjectLevel from "@/components/project/ProjectLevel";
|
||||
import { changeOwnership, scrollLoad } from "@/api/method";
|
||||
import { storage } from "../../api/storage";
|
||||
import {changeOwnership, scrollLoad} from "@/api/method";
|
||||
import {storage} from "../../api/storage";
|
||||
|
||||
export default {
|
||||
name: "projectAdd",
|
||||
@@ -277,6 +273,7 @@ export default {
|
||||
ProjectLevel,
|
||||
// ProjectClass,
|
||||
TrainClass,
|
||||
NameInput,
|
||||
OrgClass,
|
||||
},
|
||||
setup() {
|
||||
@@ -326,10 +323,10 @@ export default {
|
||||
state.projectInfo.parentId = routers.query.parentId;
|
||||
state.projectInfo.projectId = routers.query.projectId;
|
||||
(state.projectInfo.projectId || state.projectInfo.parentId) &&
|
||||
api
|
||||
api
|
||||
.getProjectDetail({
|
||||
projectId:
|
||||
state.projectInfo.projectId || state.projectInfo.parentId,
|
||||
state.projectInfo.projectId || state.projectInfo.parentId,
|
||||
})
|
||||
.then((res) => {
|
||||
state.projectInfo = {
|
||||
@@ -422,19 +419,24 @@ export default {
|
||||
if (!validate(state.projectInfo, errorMsgs)) {
|
||||
return;
|
||||
}
|
||||
if (!state.projectInfo.validate) {
|
||||
message.destroy();
|
||||
message.warning('项目名称重复,请修改名称!');
|
||||
return;
|
||||
}
|
||||
state.projectInfo.type = 3;
|
||||
state.projectInfo.courseSyncFlag = state.courseSyncFlag ? 1 : 0;
|
||||
api.createProject(state.projectInfo).then((res) => {
|
||||
state.projectInfo.projectId ||
|
||||
changeOwnership("project", res.data.data.projectId, [
|
||||
{ id: res.data.data.createId, name: res.data.data.createName },
|
||||
]);
|
||||
changeOwnership("project", res.data.data.projectId, [
|
||||
{id: res.data.data.createId, name: res.data.data.createName},
|
||||
]);
|
||||
message.destroy();
|
||||
message.success(state.projectInfo.projectId ? "编辑成功" : "创建成功");
|
||||
// router.back();
|
||||
router.push({
|
||||
path: "/taskpage",
|
||||
query: { projectId: res.data.data.projectId },
|
||||
query: {projectId: res.data.data.projectId},
|
||||
});
|
||||
storage.set("projectId", res.data.data.projectId);
|
||||
});
|
||||
@@ -442,9 +444,9 @@ export default {
|
||||
|
||||
function managerChange(e, l, d) {
|
||||
!state.projectInfo.sourceBelongId &&
|
||||
(state.projectInfo.sourceBelongId = d);
|
||||
(state.projectInfo.sourceBelongId = d);
|
||||
!state.projectInfo.sourceBelongId &&
|
||||
(state.projectInfo.sourceBelongName = d);
|
||||
(state.projectInfo.sourceBelongName = d);
|
||||
}
|
||||
|
||||
return {
|
||||
|
||||
@@ -179,13 +179,7 @@
|
||||
</div>
|
||||
<div class="inname">项目名称:</div>
|
||||
<div class="in">
|
||||
<a-input
|
||||
v-model:value="projectInfo.name"
|
||||
show-count
|
||||
:maxlength="30"
|
||||
placeholder="请输入项目名称"
|
||||
style="border-radius: 8px"
|
||||
/>
|
||||
<NameInput placeholder="请输入项目名称" v-model:value="projectInfo.name" v-model:validate="projectInfo.validate" :maxlength="30" show-count></NameInput>
|
||||
</div>
|
||||
</div>
|
||||
<div class="name">
|
||||
@@ -828,6 +822,7 @@ import OrgClass from "@/components/project/OrgClass";
|
||||
import dayjs from "dayjs";
|
||||
import * as moment from "moment";
|
||||
import { changeOwnership } from "@/api/method";
|
||||
import NameInput from "@/components/project/NameInput";
|
||||
|
||||
export default {
|
||||
name: "projectManage",
|
||||
@@ -835,6 +830,7 @@ export default {
|
||||
ProjOwnerShip,
|
||||
ProjPowerList,
|
||||
ProjCheckShip,
|
||||
NameInput,
|
||||
ProjectManager,
|
||||
// ProjectClass,
|
||||
OrgClass,
|
||||
@@ -965,6 +961,11 @@ export default {
|
||||
if (!validate(state.projectInfo, errorMsgs)) {
|
||||
return;
|
||||
}
|
||||
if (!state.projectInfo.validate) {
|
||||
message.destroy();
|
||||
message.warning('项目名称重复,请修改名称!');
|
||||
return;
|
||||
}
|
||||
api.createProject(state.projectInfo).then((res) => {
|
||||
state.doublepro = false;
|
||||
message.destroy();
|
||||
|
||||
Reference in New Issue
Block a user