feat:合并

This commit is contained in:
lixg
2023-03-02 19:05:04 +08:00
4 changed files with 25 additions and 20 deletions

View File

@@ -210,7 +210,7 @@ async function confirm() {
} else { } else {
const data = props.taskList[taskIndex.value]; const data = props.taskList[taskIndex.value];
data.name = formData.value.evaluationName; data.name = formData.value.evaluationName;
data.info = formData.value; data.info = {...formData.value};
data.duration = dayjs(formData.value.evaluationEndTime).diff( data.duration = dayjs(formData.value.evaluationEndTime).diff(
formData.value.evaluationStartTime, formData.value.evaluationStartTime,
"minutes" "minutes"

View File

@@ -138,7 +138,7 @@ function confirm() {
} else { } else {
const data = props.taskList[taskIndex.value] const data = props.taskList[taskIndex.value]
data.name = formData.value.workName data.name = formData.value.workName
data.info = formData.value data.info = {...formData.value}
data.duration = dayjs(formData.value.submitEndTime).diff(formData.value.submitStartTime,'minutes') data.duration = dayjs(formData.value.submitEndTime).diff(formData.value.submitStartTime,'minutes')
} }
emit('update:taskList', [...props.taskList]) emit('update:taskList', [...props.taskList])

View File

@@ -4,7 +4,7 @@
<div class="left clearfix"> <div class="left clearfix">
<div class="leftmain"> <div class="leftmain">
<div class="tit" style="margin-left: 18px">关卡</div> <div class="tit" style="margin-left: 18px">关卡</div>
<div class="btn btn3" @click="showModal({},'add')" style="margin-left: 19px"> <div class="btn btn3" @click="showModal()" style="margin-left: 19px">
<div class="search"></div> <div class="search"></div>
<div class="btnText">添加关卡</div> <div class="btnText">添加关卡</div>
</div> </div>
@@ -33,7 +33,7 @@
</div> </div>
</div> </div>
</a-popover> </a-popover>
<div class="imgIcon" @click="showModal(element,'edit')"></div> <div class="imgIcon" @click="showEditModal(element)"></div>
</div> </div>
<div class="boxs_right"> <div class="boxs_right">
<div class="imgIcon" @click="deleteChapter"></div> <div class="imgIcon" @click="deleteChapter"></div>
@@ -376,7 +376,6 @@ import dialog from "@/utils/dialog";
const { query: { routerId } } = useRoute(); const { query: { routerId } } = useRoute();
const modal = ref(false); const modal = ref(false);
const ischapterEdit = ref(false);
const visiblene = ref(false); const visiblene = ref(false);
const cancleLoading = ref(false); const cancleLoading = ref(false);
const confirmLoading = ref(false); const confirmLoading = ref(false);
@@ -408,18 +407,14 @@ watch(() => routerInfo.value.chapterList, () => {
}); });
}, { deep: true }); }, { deep: true });
const showModal = (e, type) => { const showModal = () => {
ischapterEdit.value = (type === "edit"); formValue.value = {draftTaskList: []}
console.log(ischapterEdit.value);
if (type == "edit") {
console.log("关卡信息:" + e.name);
formValue.value = e;//回传修改的信息
} else {
//关卡信息初始化
formValue.value = {};
}
modal.value = true; modal.value = true;
}; };
function showEditModal(ele){
formValue.value =ele;
modal.value = true;
}
const closeModal = () => { const closeModal = () => {
modal.value = false; modal.value = false;
}; };
@@ -429,11 +424,12 @@ const editChapter = () => {
if (!formValue.value.name) { if (!formValue.value.name) {
return message.warning("请输入关卡名称"); return message.warning("请输入关卡名称");
} }
if (ischapterEdit.value) { if(formValue.value.id){
routerInfo.value.chapterList = [{ ...formValue.value, draftTaskList: [] }]; closeModal();
} else { return
routerInfo.value.chapterList.push({ ...formValue.value, draftTaskList: [] });
} }
routerInfo.value.chapterList.push({ ...formValue.value, draftTaskList: [] });
activeIndex.value = activeIndex.value + 1
formValue.value = { draftTaskList: [] }; formValue.value = { draftTaskList: [] };
closeModal(); closeModal();
}; };

View File

@@ -35,7 +35,7 @@
<span style="font-size: 12px; color: #ffffff">说明</span> <span style="font-size: 12px; color: #ffffff">说明</span>
</div> </div>
</a-popover> </a-popover>
<div class="imgIcon" @click="showModal(index)"></div> <div class="imgIcon" @click="editModal(index)"></div>
</div> </div>
<div class="boxs_right"> <div class="boxs_right">
<div class="imgIcon" @click="deleteStage(index)"></div> <div class="imgIcon" @click="deleteStage(index)"></div>
@@ -513,6 +513,11 @@ const closeModal = () => {
}; };
//显示添加阶段弹窗 //显示添加阶段弹窗
const showModal = () => { const showModal = () => {
formValue.value = {taskDraftDtoList: []}
stage.value = true
};
const editModal = () => {
formValue.value = projectInfo.value.stageList[activeIndex.value]
stage.value = true stage.value = true
}; };
@@ -522,6 +527,10 @@ function editStage() {
message.warning("请输入阶段名称!"); message.warning("请输入阶段名称!");
return return
} }
if(formValue.value.id){
stage.value = false
return
}
//替换 默认阶段 //替换 默认阶段
if (projectInfo.value.stageList.length === 1 && projectInfo.value.stageList[0].id === '0') { if (projectInfo.value.stageList.length === 1 && projectInfo.value.stageList[0].id === '0') {
formValue.value.taskDraftDtoList = [...projectInfo.value.stageList[0].taskDraftDtoList] formValue.value.taskDraftDtoList = [...projectInfo.value.stageList[0].taskDraftDtoList]