mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/fe-manage.git
synced 2025-12-07 01:46:43 +08:00
取消重复名称
This commit is contained in:
@@ -196,6 +196,7 @@
|
||||
<span style="margin-top: 10px;width: 34px;">权重</span>
|
||||
<div style="display: flex;">
|
||||
<a-button v-if="index===0" shape="circle" class="btn-circle btn-add" @click="inputAdd">+</a-button>
|
||||
<a-button v-else shape="circle" class="btn-circle btn-add" @click="inputAdd"></a-button>
|
||||
<a-button shape="circle" class="btn-circle" @click="inputRemove(index)" :disabled="formData.offteachers.length == 1"><template #icon><delete-outlined class="custom-icon"/></template></a-button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -738,7 +739,8 @@ const projectInfo = ref({});
|
||||
const emit = defineEmits(['call-parent-method']);
|
||||
const confirm = async()=>{
|
||||
closeDrawer();
|
||||
await api.getDraftTask({projectId: route.query.projectId}).then((res) => {
|
||||
if(route.query.projectId){
|
||||
await api.getDraftTask({projectId: route.query.projectId}).then((res) => {
|
||||
projectInfo.value = res.data.data
|
||||
});
|
||||
request(PROJECT_DETAIL_MODIFY, { ...projectInfo.value });
|
||||
@@ -746,6 +748,8 @@ const confirm = async()=>{
|
||||
request(PROJECT_RELEASE, {projectId: route.query.projectId})
|
||||
}
|
||||
emit('call-parent-method');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
const createNewCourse = () => {
|
||||
@@ -861,14 +865,17 @@ async function coursePlanConfirm() {
|
||||
formData.value.beginTime = dateTime.value[0]
|
||||
formData.value.endTime = dateTime.value[1]
|
||||
await request(COURSE_PLAN_EDIT, { ...formData.value });
|
||||
await api.getDraftTask({projectId: route.query.projectId}).then((res) => {
|
||||
projectInfo.value = res.data.data
|
||||
});
|
||||
request(PROJECT_DETAIL_MODIFY, { ...projectInfo.value });
|
||||
if(projectInfo.value.projectInfo.status==3){
|
||||
request(PROJECT_RELEASE, {projectId: route.query.projectId})
|
||||
if(route.query.projectId){
|
||||
await api.getDraftTask({projectId: route.query.projectId}).then((res) => {
|
||||
projectInfo.value = res.data.data
|
||||
});
|
||||
request(PROJECT_DETAIL_MODIFY, { ...projectInfo.value });
|
||||
if(projectInfo.value.projectInfo.status==3){
|
||||
request(PROJECT_RELEASE, {projectId: route.query.projectId})
|
||||
}
|
||||
emit('call-parent-method');
|
||||
|
||||
}
|
||||
emit('call-parent-method');
|
||||
handleCancelStu();
|
||||
tableRef.value.fetch();
|
||||
}
|
||||
|
||||
@@ -8,12 +8,13 @@
|
||||
@focus="onFocus"
|
||||
@blur="onBlur"
|
||||
/>
|
||||
<div style="color: red; font-size: 10px" v-if="modelV.value && validated===0 && isExistName">
|
||||
名称重复,请重新输入
|
||||
<div style="color: blue; font-size: 10px" v-if="modelV.value && validated===0 && isExistName">
|
||||
<!-- 名称重复,请重新输入 -->
|
||||
开课名称已自动带入,请自行修改
|
||||
</div>
|
||||
<div style="color: red; font-size: 10px" v-if="newNamess">
|
||||
<!-- <div style="color: red; font-size: 10px" v-if="newNamess">
|
||||
名称重复,已自动生成不重复名称,可自行修改
|
||||
</div>
|
||||
</div> -->
|
||||
</template>
|
||||
<script setup>
|
||||
import {defineProps, defineEmits, watch, ref, onMounted} from "vue";
|
||||
@@ -86,31 +87,31 @@ onMounted(() => {
|
||||
isExistName.value = true;
|
||||
}
|
||||
})
|
||||
const newNamess = ref(false)
|
||||
const generateUniqueName = () => {
|
||||
let baseName = modelV.value.value;
|
||||
let randomSuffix = '_' + Math.floor(Math.random() * 1000);
|
||||
let newName = baseName + randomSuffix;
|
||||
emit("update:value", newName);
|
||||
newNamess.value = true
|
||||
}
|
||||
const watchChange = ref(true)
|
||||
const onFocus = ()=>{
|
||||
newNamess.value = false
|
||||
watchChange.value = false
|
||||
}
|
||||
const onBlur = ()=>{
|
||||
watchChange.value = true
|
||||
}
|
||||
watch(props,()=>{
|
||||
if(props.changeName){
|
||||
if (watchChange.value && modelV.value.value && props.validated === 0 && isExistName.value) {
|
||||
generateUniqueName();
|
||||
}
|
||||
}else{
|
||||
newNamess.value = false
|
||||
}
|
||||
},{immediate: true})
|
||||
const newNamess = ref(true)
|
||||
// const generateUniqueName = () => {
|
||||
// let baseName = modelV.value.value;
|
||||
// let randomSuffix = Math.floor(Math.random() * 1000);
|
||||
// let newName = baseName + randomSuffix;
|
||||
// emit("update:value", newName);
|
||||
// newNamess.value = true
|
||||
// }
|
||||
// const watchChange = ref(true)
|
||||
// const onFocus = ()=>{
|
||||
// newNamess.value = false
|
||||
// watchChange.value = false
|
||||
// }
|
||||
// const onBlur = ()=>{
|
||||
// watchChange.value = true
|
||||
// }
|
||||
// watch(props,()=>{
|
||||
// if(props.changeName){
|
||||
// if (watchChange.value && modelV.value.value && props.validated === 0 && isExistName.value) {
|
||||
// generateUniqueName();
|
||||
// }
|
||||
// }else{
|
||||
// newNamess.value = false
|
||||
// }
|
||||
// },{immediate: true})
|
||||
watch(props, () => {
|
||||
if(props.onceName==modelV.value.value){
|
||||
isExistName.value = false;
|
||||
|
||||
@@ -5243,10 +5243,6 @@ export default {
|
||||
coursePlanRef,
|
||||
openCourse,
|
||||
exportScore,
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user