mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/fe-manage.git
synced 2025-12-12 04:16:47 +08:00
feat:获取学员列表 批量删除 单个删除 勾选效果 查询 重置 清空
This commit is contained in:
@@ -15,6 +15,8 @@
|
||||
@click="closeDrawer"
|
||||
/>
|
||||
</div>
|
||||
<a-form ref="formRef" name="custom-validation" :model="state" :rules="rules" v-bind="layout"
|
||||
@finish="handleFinish" @validate="handleValidate" @finishFailed="handleFinishFailed">
|
||||
<div class="contentMain">
|
||||
<div class="main_left">
|
||||
<div class="main_item">
|
||||
@@ -68,6 +70,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</a-form>
|
||||
<div class="main_btns">
|
||||
<button class="btn1" @click="closeDrawer">取消</button>
|
||||
<button class="btn2" @click="createExternalChain">确定</button>
|
||||
@@ -81,6 +84,7 @@ import * as api from "../../api/indexExternalChain";
|
||||
import * as apiTask from "../../api/indexTaskadd";
|
||||
import { message } from "ant-design-vue";
|
||||
import { RouterEditTask } from "@/api/indexTask";
|
||||
//import { query } from "express";
|
||||
const rowSelection = ref({
|
||||
checkStrictly: false,
|
||||
onChange: (selectedRowKeys, selectedRows) => {
|
||||
@@ -151,12 +155,111 @@ export default {
|
||||
state.inputV1 = "";
|
||||
state.textV1 = "";
|
||||
};
|
||||
const updateRef = () => {
|
||||
// 如果是关卡页面进入 ---------------------------------
|
||||
if (props.isLevel) {
|
||||
if(props.isRefEdit){
|
||||
createExternalRef();
|
||||
|
||||
}else{
|
||||
updateExternalRef();
|
||||
}
|
||||
console.log('关卡创建任务***************');
|
||||
} else { // 任务页面进入------------------------------
|
||||
if (props.isRefEdit) { // 编辑任务
|
||||
console.log('编辑任务***************');
|
||||
updateExternalChain();
|
||||
} else { // 创建任务
|
||||
console.log('创建任务***************');
|
||||
createExternalChain();
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
const afterVisibleChange = (bool) => {
|
||||
console.log("state", bool);
|
||||
queryRef();
|
||||
};
|
||||
const handleFinish = values => {
|
||||
console.log(values);
|
||||
updateRef(props.workId)
|
||||
};
|
||||
const handleFinishFailed = errors => {
|
||||
console.log(errors);
|
||||
// message.error("handleFinishFailed");
|
||||
};
|
||||
|
||||
//创建外链
|
||||
const createExternalChain = () => {
|
||||
if (!state.inputV1) return message.warning("请输入外链名称");
|
||||
if (!state.inputV2) return message.warning("请输入链接");
|
||||
let obj = {
|
||||
linkAddress: state.inputV2,
|
||||
linkDescription: state.textV1,
|
||||
linkId: props.EditRefId == null ? 0 : props.EditRefId,
|
||||
linkName: state.inputV1,
|
||||
};
|
||||
//编辑外链
|
||||
|
||||
api
|
||||
.createExternalChain(obj)
|
||||
.then((res) => {
|
||||
console.log(res.data.data, "外链添加成功了");
|
||||
message.success("提交成功");
|
||||
closeDrawer();
|
||||
|
||||
//项目的创建
|
||||
apiTask
|
||||
.addTask({
|
||||
courseId: res.data.data.linkId,
|
||||
duration: 0,
|
||||
flag: true,
|
||||
name: obj.linkName,
|
||||
projectId: props.projectId,
|
||||
projectTaskId: 0,
|
||||
stageId: props.chooseStageId,
|
||||
type: 7,
|
||||
})
|
||||
.then((res) => {
|
||||
console.log("调用项目添加接口后111", res.data, 11111);
|
||||
ctx.emit("changeData", false);
|
||||
//重新获取任务列表
|
||||
// apiTask.getTask({ projectId: 28 });
|
||||
// router.push("/taskadd");
|
||||
})
|
||||
.catch((err) => {
|
||||
console.log(err, 111111);
|
||||
});
|
||||
|
||||
})
|
||||
.catch((err) => {
|
||||
console.log(err);
|
||||
});
|
||||
|
||||
};
|
||||
const updateExternalChain = () => {
|
||||
if (!state.inputV1) return message.warning("请输入外链名称");
|
||||
if (!state.inputV2) return message.warning("请输入链接");
|
||||
let obj = {
|
||||
|
||||
linkAddress: state.inputV2,
|
||||
linkDescription: state.textV1,
|
||||
linkId: props.EditRefId == null ? 0 : props.EditRefId,
|
||||
linkName: state.inputV1,
|
||||
|
||||
};
|
||||
|
||||
//编辑外链
|
||||
api
|
||||
.updateLinks(obj)
|
||||
.then((res) => {
|
||||
console.log("编辑成功", res);
|
||||
message.success("编辑成功");
|
||||
closeDrawer();
|
||||
})
|
||||
.catch((err) => console.log(err));
|
||||
|
||||
};
|
||||
const createExternalRef = () => {
|
||||
if (!state.inputV1) return message.warning("请输入外链名称");
|
||||
if (!state.inputV2) return message.warning("请输入链接");
|
||||
let obj = {
|
||||
@@ -171,8 +274,9 @@ export default {
|
||||
updateTime: "",
|
||||
updateUser: 0,
|
||||
};
|
||||
|
||||
//编辑外链
|
||||
if (props.isRefEdit == 2) {
|
||||
if (props.isRefEdit) {
|
||||
api
|
||||
.updateLinks(obj)
|
||||
.then((res) => {
|
||||
@@ -237,6 +341,103 @@ export default {
|
||||
});
|
||||
}
|
||||
};
|
||||
const updateExternalRef = () => {
|
||||
if (!state.inputV1) return message.warning("请输入外链名称");
|
||||
if (!state.inputV2) return message.warning("请输入链接");
|
||||
let obj = {
|
||||
createUser: 0,
|
||||
createTime: "",
|
||||
linkAddress: state.inputV2,
|
||||
linkDescription: state.textV1,
|
||||
linkFlag: "",
|
||||
linkId: props.EditRefId == null ? 0 : props.EditRefId,
|
||||
linkName: state.inputV1,
|
||||
linkTag: "",
|
||||
updateTime: "",
|
||||
updateUser: 0,
|
||||
};
|
||||
|
||||
//编辑外链
|
||||
if (props.isRefEdit) {
|
||||
api
|
||||
.updateLinks(obj)
|
||||
.then((res) => {
|
||||
console.log("编辑成功", res);
|
||||
message.success("编辑成功");
|
||||
closeDrawer();
|
||||
})
|
||||
.catch((err) => console.log(err));
|
||||
} else {
|
||||
api
|
||||
.createExternalChain(obj)
|
||||
.then((res) => {
|
||||
console.log(res.data.data, "外链添加成功了");
|
||||
message.success("提交成功");
|
||||
closeDrawer();
|
||||
//学习路径的创建
|
||||
if (props.isStudy == 1) {
|
||||
let objj = {
|
||||
chapterId: 36,
|
||||
courseId: 0,
|
||||
duration: 0,
|
||||
flag: true,
|
||||
name: obj.linkName,
|
||||
routerId: 92,
|
||||
routerTaskId: 0,
|
||||
type: 7,
|
||||
};
|
||||
RouterEditTask(objj)
|
||||
.then((res) => {
|
||||
console.log(res, 11111);
|
||||
})
|
||||
.catch((err) => {
|
||||
console.log(err, 1111);
|
||||
});
|
||||
} else {
|
||||
//项目的创建
|
||||
apiTask
|
||||
.addTask({
|
||||
courseId: res.data.data.linkId,
|
||||
duration: 0,
|
||||
flag: true,
|
||||
name: obj.linkName,
|
||||
projectId: props.projectId,
|
||||
projectTaskId: 0,
|
||||
stageId: props.chooseStageId,
|
||||
type: 7,
|
||||
})
|
||||
.then((res) => {
|
||||
console.log("调用项目添加接口后111", res.data, 11111);
|
||||
ctx.emit("changeData", false);
|
||||
//重新获取任务列表
|
||||
// apiTask.getTask({ projectId: 28 });
|
||||
// router.push("/taskadd");
|
||||
})
|
||||
.catch((err) => {
|
||||
console.log(err, 111111);
|
||||
});
|
||||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
console.log(err);
|
||||
});
|
||||
}
|
||||
};
|
||||
// 查询任务
|
||||
const queryRef = () => {
|
||||
let p =new FormData;
|
||||
p.append('linkId',props.EditRefId);
|
||||
api
|
||||
.getLink(p).then((res) => {
|
||||
// console.log(dayjs(res.data.data.submitStartTime).format("YYYY-MM-DD"));
|
||||
state.inputV1 = res.data.data.linkName;
|
||||
state.inputV2 =res.data.data.linkAddress;
|
||||
state.textV1 =res.data.data.linkDescription;
|
||||
console.log("查询成功=====inputv1",state.inputV1);
|
||||
}).catch(() => {
|
||||
message.error(`查询失败`)
|
||||
})
|
||||
};
|
||||
//不生效
|
||||
onMounted(() => {
|
||||
state.title = props.isRefEdit == 2 ? "编辑" : "添加";
|
||||
@@ -247,6 +448,9 @@ export default {
|
||||
closeDrawer,
|
||||
rowSelection,
|
||||
createExternalChain,
|
||||
handleFinish,
|
||||
handleFinishFailed,
|
||||
updateRef,
|
||||
};
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user