mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/fe-manage.git
synced 2025-12-13 04:46:46 +08:00
feat:合并
This commit is contained in:
@@ -62,7 +62,10 @@
|
||||
<div class="notice_icon"></div>
|
||||
<span style="color: rgba(0, 0, 0, 0.65); margin-right: 17px"
|
||||
>已选择
|
||||
<span style="color: #388be1">{{ selectedRowKeys.length }}</span>
|
||||
<span v-if="edit" style="color: #388be1">{{ 1 }}</span>
|
||||
<span v-else style="color: #388be1">{{
|
||||
selectedRowKeys.length
|
||||
}}</span>
|
||||
项</span
|
||||
>
|
||||
<span style="color: rgba(0, 0, 0, 0.65)"
|
||||
@@ -75,8 +78,26 @@
|
||||
</div>
|
||||
<div class="main_table">
|
||||
<!-- 编辑的表格 -->
|
||||
<div v-if="edit">
|
||||
<div
|
||||
v-if="choicecourse"
|
||||
class="main_btns"
|
||||
style="justify-content: flex-start"
|
||||
>
|
||||
<div
|
||||
class="btn2"
|
||||
style="
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
"
|
||||
@click="ChoiceCourse"
|
||||
>
|
||||
选择在线课
|
||||
</div>
|
||||
</div>
|
||||
<div v-else>
|
||||
<a-table
|
||||
v-if="edit"
|
||||
class="ant-table-striped"
|
||||
:row-class-name="
|
||||
(_record, index) => (index % 2 === 1 ? 'table-striped' : null)
|
||||
@@ -91,8 +112,23 @@
|
||||
:loading="tableDataTotal === -1 ? true : false"
|
||||
:pagination="false"
|
||||
/>
|
||||
<div class="pa">
|
||||
<a-pagination
|
||||
v-if="tableDataTotal > 10"
|
||||
showSizeChanger="true"
|
||||
showQuickJumper="true"
|
||||
hideOnSinglePage="true"
|
||||
:pageSize="pageSize"
|
||||
:current="currentPage"
|
||||
:total="tableDataTotal"
|
||||
class="pagination"
|
||||
@change="handelChangePage"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div v-else>
|
||||
<a-table
|
||||
v-else
|
||||
class="ant-table-striped"
|
||||
:row-class-name="
|
||||
(_record, index) => (index % 2 === 1 ? 'table-striped' : null)
|
||||
@@ -121,6 +157,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="main_btns">
|
||||
<button class="btn1" @click="closeDrawer">取消</button>
|
||||
<button class="btn2" @click="updateTask">确定</button>
|
||||
@@ -134,7 +171,11 @@ import * as api from "../../api/indexOnline.js";
|
||||
import * as apiTask from "../../api/indexTaskadd";
|
||||
// import { setCookie } from "../../api/method"
|
||||
import { message } from "ant-design-vue";
|
||||
import { RouterEditTask, IsExistence, IsExistenceProject } from "@/api/indexTask";
|
||||
import {
|
||||
RouterEditTask,
|
||||
IsExistence,
|
||||
IsExistenceProject,
|
||||
} from "@/api/indexTask";
|
||||
import { addTempTask } from "../../api/indexTaskadd";
|
||||
export default {
|
||||
name: "AddOnline",
|
||||
@@ -193,8 +234,8 @@ export default {
|
||||
},
|
||||
{
|
||||
value: "录播课",
|
||||
label: "录播课"
|
||||
}
|
||||
label: "录播课",
|
||||
},
|
||||
],
|
||||
time: undefined,
|
||||
onlineClassesId: null,
|
||||
@@ -206,8 +247,13 @@ export default {
|
||||
currentPage: 1,
|
||||
tableDataTotal: 0,
|
||||
pageSize: 10,
|
||||
choicecourse: true,
|
||||
});
|
||||
const ChoiceCourse = () => {
|
||||
state.choicecourse = false;
|
||||
};
|
||||
const closeDrawer = () => {
|
||||
state.choicecourse = true;
|
||||
ctx.emit("update:addonlineVisible", false);
|
||||
ctx.emit("update:edit", false);
|
||||
state.inputV1 = "";
|
||||
@@ -272,16 +318,17 @@ export default {
|
||||
const onSelectChange = (selectedRowKeys, selectedRows) => {
|
||||
state.selectedRowKeys = selectedRowKeys;
|
||||
state.addOnlineList = selectedRows;
|
||||
console.log(selectedRowKeys,selectedRows)
|
||||
console.log(selectedRowKeys, selectedRows);
|
||||
if (props.edit && selectedRows.length > 0) {
|
||||
selectedRows.map((value) => {
|
||||
console.log(props, value);
|
||||
if (value.courseId == props.EditOnlineId) {
|
||||
message.destroy()
|
||||
message.error('选项相同,请重新选择')
|
||||
state.selectedRowKeys = []
|
||||
state.addOnlineList = []
|
||||
message.destroy();
|
||||
message.error("选项相同,请重新选择");
|
||||
state.selectedRowKeys = [];
|
||||
state.addOnlineList = [];
|
||||
}
|
||||
})
|
||||
});
|
||||
}
|
||||
};
|
||||
//清空所选
|
||||
@@ -317,75 +364,73 @@ export default {
|
||||
const getAllOnlineText = () => {
|
||||
api
|
||||
.queryOnlinelList({
|
||||
"createUser": "",
|
||||
"keyword": state.inputV1,
|
||||
"orderAsc": true,
|
||||
"orderField": "",
|
||||
"pageIndex": state.currentPage,
|
||||
"pageSize": state.pageSize,
|
||||
"publish": true,
|
||||
"status": 0,
|
||||
"sysType1": "",
|
||||
"sysType2": "",
|
||||
"sysType3": "",
|
||||
createUser: "",
|
||||
keyword: state.inputV1,
|
||||
orderAsc: true,
|
||||
orderField: "",
|
||||
pageIndex: state.currentPage,
|
||||
pageSize: state.pageSize,
|
||||
publish: true,
|
||||
status: 0,
|
||||
sysType1: "",
|
||||
sysType2: "",
|
||||
sysType3: "",
|
||||
})
|
||||
.then((res) => {
|
||||
let arr = res.data.data.list;
|
||||
state.tableDataTotal = res.data.data.count
|
||||
state.tableDataTotal = res.data.data.count;
|
||||
if (res.status === 200) {
|
||||
console.log('获取在线课列表数据', res)
|
||||
console.log("获取在线课列表数据", res);
|
||||
getTableDate(arr);
|
||||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
console.log(err,'请求失败在线');});
|
||||
console.log(err, "请求失败在线");
|
||||
});
|
||||
};
|
||||
|
||||
// 校验当前在线课是否已经添加进来了
|
||||
const isExistence = (id) => {
|
||||
|
||||
console.log({
|
||||
"chapterId": Number(props.isactive),
|
||||
"courseTaskId": Number(id),
|
||||
"routerId": props.routerId,
|
||||
"type": 1
|
||||
})
|
||||
|
||||
chapterId: Number(props.isactive),
|
||||
courseTaskId: Number(id),
|
||||
routerId: props.routerId,
|
||||
type: 1,
|
||||
});
|
||||
IsExistence({
|
||||
"chapterId": Number(props.isactive),
|
||||
"courseTaskId": Number(id),
|
||||
"routerId": props.routerId,
|
||||
"type": 1
|
||||
}).then(res=>{
|
||||
console.log('我是不是已经添加了',res)
|
||||
}).catch(err=>{
|
||||
console.log(err)
|
||||
chapterId: Number(props.isactive),
|
||||
courseTaskId: Number(id),
|
||||
routerId: props.routerId,
|
||||
type: 1,
|
||||
})
|
||||
}
|
||||
|
||||
.then((res) => {
|
||||
console.log("我是不是已经添加了", res);
|
||||
})
|
||||
.catch((err) => {
|
||||
console.log(err);
|
||||
});
|
||||
};
|
||||
// 判断项目中是否添加当前在线课
|
||||
const IsExistenceProjects = (id) => {
|
||||
console.log('参数传递',{
|
||||
"courseTaskId": id,
|
||||
"projectId": props.projectId,
|
||||
"stageId": props.chooseStageId || 0,
|
||||
"type": 1
|
||||
})
|
||||
console.log("参数传递", {
|
||||
courseTaskId: id,
|
||||
projectId: props.projectId,
|
||||
stageId: props.chooseStageId || 0,
|
||||
type: 1,
|
||||
});
|
||||
IsExistenceProject({
|
||||
"courseTaskId": id,
|
||||
"projectId": Number(props.projectId),
|
||||
"stageId": props.chooseStageId || 0,
|
||||
"type": 1
|
||||
}).then(res=>{
|
||||
console.log('项目中是否包含此在线课了',res)
|
||||
}).catch(err=>{
|
||||
console.log(err)
|
||||
courseTaskId: id,
|
||||
projectId: Number(props.projectId),
|
||||
stageId: props.chooseStageId || 0,
|
||||
type: 1,
|
||||
})
|
||||
}
|
||||
|
||||
.then((res) => {
|
||||
console.log("项目中是否包含此在线课了", res);
|
||||
})
|
||||
.catch((err) => {
|
||||
console.log(err);
|
||||
});
|
||||
};
|
||||
const updateTask = () => {
|
||||
|
||||
|
||||
if (props.isLevel == 1) {
|
||||
// isExistence(23)
|
||||
// return
|
||||
@@ -396,45 +441,41 @@ export default {
|
||||
// })
|
||||
// console.log('当前是否已经添加了',routerarr)
|
||||
}
|
||||
|
||||
if (props.isLevel == 3) {
|
||||
console.log('我是要便利的数据3', state.addOnlineList)
|
||||
|
||||
console.log("我是要便利的数据3", state.addOnlineList);
|
||||
}
|
||||
|
||||
if (props.isLevel == 1) {
|
||||
console.log('我是要便利的数据2', state.addOnlineList)
|
||||
console.log("我是要便利的数据2", state.addOnlineList);
|
||||
let l_data = state.addOnlineList;
|
||||
let l_data_id = []
|
||||
let l_data_id = [];
|
||||
l_data.map((item) => {
|
||||
l_data_id.push(item["courseId"])
|
||||
})
|
||||
|
||||
console.log('需要查询的在线课ID',l_data_id)
|
||||
|
||||
l_data_id.push(item["courseId"]);
|
||||
});
|
||||
console.log("需要查询的在线课ID", l_data_id);
|
||||
IsExistence({
|
||||
"chapterId": Number(props.isactive),
|
||||
"courseTaskId": l_data_id,
|
||||
"routerId": props.routerId,
|
||||
"type": 1
|
||||
}).then(res=>{
|
||||
console.log('路径图中是否包含此在线课了',res)
|
||||
chapterId: Number(props.isactive),
|
||||
courseTaskId: l_data_id,
|
||||
routerId: props.routerId,
|
||||
type: 1,
|
||||
})
|
||||
.then((res) => {
|
||||
console.log("路径图中是否包含此在线课了", res);
|
||||
if (res.data.data.length) {
|
||||
let strdata = res.data.data
|
||||
let tipStr = ''
|
||||
let strdata = res.data.data;
|
||||
let tipStr = "";
|
||||
for (let i = 0; i < strdata.length; i++) {
|
||||
if (i == strdata.length - 1) {
|
||||
tipStr+=strdata[i].courseName
|
||||
tipStr += strdata[i].courseName;
|
||||
} else {
|
||||
tipStr+=strdata[i].courseName + '/'
|
||||
tipStr += strdata[i].courseName + "/";
|
||||
}
|
||||
}
|
||||
message.destroy()
|
||||
message.info('在线课('+tipStr+')重复添加')
|
||||
return
|
||||
message.destroy();
|
||||
message.info("在线课(" + tipStr + ")重复添加");
|
||||
return;
|
||||
} else {
|
||||
state.addOnlineList.map((value) => {
|
||||
console.log(value)
|
||||
console.log(value);
|
||||
RouterEditTask({
|
||||
chapterId: Number(props.isactive),
|
||||
courseId: value.num,
|
||||
@@ -445,51 +486,54 @@ export default {
|
||||
})
|
||||
.then(() => {
|
||||
message.destroy();
|
||||
message.success(`${props.edit ? "编辑" : "新增"}关卡任务成功`);
|
||||
message.success(
|
||||
`${props.edit ? "编辑" : "新增"}关卡任务成功`
|
||||
);
|
||||
ctx.emit("changeData", false);
|
||||
closeDrawer();
|
||||
state.addLoading = false;
|
||||
})
|
||||
.catch(() => {
|
||||
message.destroy();
|
||||
message.error(`${props.edit ? "编辑" : "新增"}关卡任务失败`);
|
||||
message.error(
|
||||
`${props.edit ? "编辑" : "新增"}关卡任务失败`
|
||||
);
|
||||
});
|
||||
});
|
||||
})
|
||||
}
|
||||
}).catch(err=>{
|
||||
console.log(err)
|
||||
})
|
||||
|
||||
.catch((err) => {
|
||||
console.log(err);
|
||||
});
|
||||
} else if (props.isLevel === 2) {
|
||||
console.log('我是要便利的数据2', state.addOnlineList)
|
||||
console.log("我是要便利的数据2", state.addOnlineList);
|
||||
let p_data = state.addOnlineList;
|
||||
let p_data_id = []
|
||||
let p_data_id = [];
|
||||
p_data.map((item) => {
|
||||
p_data_id.push(item["courseId"])
|
||||
})
|
||||
|
||||
console.log('需要查询的在线课ID',p_data_id)
|
||||
|
||||
p_data_id.push(item["courseId"]);
|
||||
});
|
||||
console.log("需要查询的在线课ID", p_data_id);
|
||||
IsExistenceProject({
|
||||
"courseTaskId": p_data_id,
|
||||
"projectId": Number(props.projectId),
|
||||
"stageId": props.chooseStageId || 0,
|
||||
"type": 1
|
||||
}).then(res=>{
|
||||
console.log('项目中是否包含此在线课了',res)
|
||||
courseTaskId: p_data_id,
|
||||
projectId: Number(props.projectId),
|
||||
stageId: props.chooseStageId || 0,
|
||||
type: 1,
|
||||
})
|
||||
.then((res) => {
|
||||
console.log("项目中是否包含此在线课了", res);
|
||||
if (res.data.data.length) {
|
||||
let strdata = res.data.data
|
||||
let tipStr = ''
|
||||
let strdata = res.data.data;
|
||||
let tipStr = "";
|
||||
for (let i = 0; i < strdata.length; i++) {
|
||||
if (i == strdata.length - 1) {
|
||||
tipStr+=strdata[i].courseName
|
||||
tipStr += strdata[i].courseName;
|
||||
} else {
|
||||
tipStr+=strdata[i].courseName + '/'
|
||||
tipStr += strdata[i].courseName + "/";
|
||||
}
|
||||
}
|
||||
message.destroy()
|
||||
message.info('在线课('+tipStr+')重复添加')
|
||||
return
|
||||
message.destroy();
|
||||
message.info("在线课(" + tipStr + ")重复添加");
|
||||
return;
|
||||
} else {
|
||||
state.addOnlineList.map((value) => {
|
||||
apiTask
|
||||
@@ -503,19 +547,24 @@ export default {
|
||||
})
|
||||
.then(() => {
|
||||
message.destroy();
|
||||
message.success(`${props.edit ? "编辑" : "新增"}阶段任务成功`);
|
||||
message.success(
|
||||
`${props.edit ? "编辑" : "新增"}阶段任务成功`
|
||||
);
|
||||
ctx.emit("changeData", false);
|
||||
closeDrawer();
|
||||
})
|
||||
.catch(() => {
|
||||
message.destroy();
|
||||
message.error(`${props.edit ? "编辑" : "新增"}阶段任务失败`);
|
||||
message.error(
|
||||
`${props.edit ? "编辑" : "新增"}阶段任务失败`
|
||||
);
|
||||
});
|
||||
});
|
||||
})
|
||||
}
|
||||
}).catch(err=>{
|
||||
console.log(err)
|
||||
})
|
||||
.catch((err) => {
|
||||
console.log(err);
|
||||
});
|
||||
} else if (props.isLevel == 3) {
|
||||
addTempTask({
|
||||
courseId: state.onlineClassesId,
|
||||
@@ -536,21 +585,18 @@ export default {
|
||||
message.error(`${props.edit ? "编辑" : "新增"}模板库任务失败`);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
//if(state.addOnlineList.Target==undefined){
|
||||
// closeDrawer();
|
||||
//}
|
||||
|
||||
};
|
||||
//搜索在线列表
|
||||
const searchList = () => {
|
||||
if(state.inputV1 !== '' || state.selectV !== ''){
|
||||
getAllOnlineText()
|
||||
if (state.inputV1 !== "" || state.selectV !== "") {
|
||||
getAllOnlineText();
|
||||
} else {
|
||||
resetOnline()
|
||||
}
|
||||
resetOnline();
|
||||
}
|
||||
};
|
||||
//重置在线信息
|
||||
const resetOnline = () => {
|
||||
state.inputV1 = "";
|
||||
@@ -564,7 +610,7 @@ export default {
|
||||
// let cookie =
|
||||
// "eyJ0eXBlIjoidG9rZW4iLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwOlwvXC91LmJvZS5jb20iLCJpYXQiOjE2Njk0MjgwNTAsImV4cCI6MTY2OTQzNTI1MCwiR2l2ZW5OYW1lIjoiYm9ldSIsInVzZXJJZCI6IjZCMDQ5RkFGLUMzMTQtN0NDRi0wRDI4LTBEMjNGNEM0MjUzMSIsInVJZCI6Ijk2NTM0MjAyNzQ5NzYwNzE2OCIsInBlcm1pc3Npb24iOiIifQ==.9ea5ce6d4cd43c2c17f21a293e4dc0d362c2a404b9d50fae5c49fed5a238fb1a";
|
||||
// setCookie("token", cookie, 10);
|
||||
})
|
||||
});
|
||||
return {
|
||||
...toRefs(state),
|
||||
afterVisibleChange,
|
||||
@@ -579,7 +625,8 @@ export default {
|
||||
searchList,
|
||||
resetOnline,
|
||||
isExistence,
|
||||
IsExistenceProjects
|
||||
IsExistenceProjects,
|
||||
ChoiceCourse,
|
||||
};
|
||||
},
|
||||
};
|
||||
@@ -731,7 +778,6 @@ export default {
|
||||
th.h {
|
||||
background-color: #eff4fc !important;
|
||||
}
|
||||
|
||||
.ant-table-tbody
|
||||
> tr:hover:not(.ant-table-expanded-row):not(.ant-table-row-selected)
|
||||
> td {
|
||||
@@ -747,7 +793,6 @@ export default {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.main_btns {
|
||||
height: 72px;
|
||||
width: 100%;
|
||||
|
||||
Reference in New Issue
Block a user