添加传参方法

This commit is contained in:
宋文超
2022-11-17 16:26:17 +08:00
parent 429e8339c9
commit 5bd067c4d0
13 changed files with 1724 additions and 1491 deletions

View File

@@ -8,7 +8,7 @@
@after-visible-change="afterVisibleChange"
>
<div class="drawerMain">
<div class="header">
<div class="header">
<div v-if="edit" class="headerTitle">编辑在线</div>
<div v-else class="headerTitle">添加在线</div>
<img
@@ -59,10 +59,10 @@
<div class="mntc_left">
<div class="notice_icon"></div>
<span style="color: rgba(0, 0, 0, 0.65); margin-right: 17px"
>已选择 <span style="color: #388be1">{{RowsNum}}</span> </span
>已选择 <span style="color: #388be1">{{ RowsNum }}</span> </span
>
<span style="color: rgba(0, 0, 0, 0.65)"
>列表选项总计<span>{{tableDataTotal}}</span> </span
>列表选项总计<span>{{ tableDataTotal }}</span> </span
>
</div>
<div class="mntc_right">
@@ -79,24 +79,24 @@
:columns="tableDataFunc()"
:data-source="tableData"
:loading="tableDataTotal === -1 ? true : false"
expandRowByClick="true"
this.getMilitaryDeployment()
@expand="expandTable"
expandRowByClick="true"
this.getMilitaryDeployment()
@expand="expandTable"
:pagination="false"
filterMultiple:false
filterMultiple:false
/>
<div class="pa">
<a-pagination
showSizeChanger="true"
showQuickJumper="true"
hideOnSinglePage="true"
:pageSize="pageSize"
:current="currentPage"
:total="tableDataTotal"
class="pagination"
@change="handelChangePage"
/>
</div>
<a-pagination
showSizeChanger="true"
showQuickJumper="true"
hideOnSinglePage="true"
:pageSize="pageSize"
:current="currentPage"
:total="tableDataTotal"
class="pagination"
@change="handelChangePage"
/>
</div>
</div>
</div>
<div class="main_btns">
@@ -124,7 +124,8 @@ export default {
type: Number,
default: null,
},
edit: { // 是否为编辑
edit: {
// 是否为编辑
type: Boolean,
default: null,
},
@@ -140,11 +141,13 @@ export default {
type: Number,
default: 0,
},
isLevel: { // 是否是关卡页面触发
isLevel: {
// 是否是关卡页面触发
type: Number,
default: null,
},
projectTaskId: { // 要编辑的projectId
projectTaskId: {
// 要编辑的projectId
type: Number,
default: null,
},
@@ -155,20 +158,20 @@ export default {
isactive: {
type: Number,
default: null,
}
},
},
setup(props, ctx) {
const state = reactive({
inputV1:"",
options1 : [
inputV1: "",
options1: [
{
value: "value1",
label: "未完成",
},
],
time: undefined,
assessmentId:null,
assessmentName:"",
assessmentId: null,
assessmentName: "",
RowsNum: 0,
tableData: [],
currentPage: 1,
@@ -178,6 +181,9 @@ export default {
const closeDrawer = () => {
ctx.emit("update:addonlineVisible", false);
ctx.emit("update:edit", false);
// ctx.emit("changeData", false);
localStorage.setItem("stageId", props.chooseStageId);
localStorage.setItem("chapterId", props.isactive);
};
const afterVisibleChange = (bool) => {
console.log("state", bool);
@@ -199,7 +205,8 @@ export default {
width: "100px",
align: "left",
className: "classify",
}, {
},
{
title: "内容分类",
dataIndex: "content",
key: "content",
@@ -235,19 +242,25 @@ export default {
onSelectAll: (selected) => {
console.log(selected);
if (selected == true) {
state.RowsNum = state.tableDataTotal
state.RowsNum = state.tableDataTotal;
} else {
state.RowsNum = 0
state.RowsNum = 0;
}
},
onSelect: (selectedRows, selected, selectedRowKeys) => {
console.log(
"selectedRowKeys", selectedRowKeys, "selectedRows", selectedRows, "selected", selected);
"selectedRowKeys",
selectedRowKeys,
"selectedRows",
selectedRows,
"selected",
selected
);
console.log(selectedRows.assessmentId);
if (selected == true) {
state.RowsNum++
state.RowsNum++;
} else {
state.RowsNum--
state.RowsNum--;
}
state.assessmentId = selectedRows.assessmentId;
state.assessmentName = selectedRows.name;
@@ -295,49 +308,49 @@ export default {
// state.createLoading = false;
});
};
const updateTask =()=>{
if(props.isLevel ==1){
const updateTask = () => {
if (props.isLevel == 1) {
RouterEditTask({
chapterId: props.isactive,
courseId: state.assessmentId,
name: state.assessmentName,
routerId: props.routerId,
routerTaskId: props.routerTaskId || 0,
type: 1,
})
.then((res) => {
console.log(res, 11111);
message.success(`${props.edit ? '编辑' : '新增'}关卡任务成功`)
ctx.emit("changeData", false);
closeDrawer();
state.addLoading = false;
})
.catch((err) => {
console.log(err, 1111);
});
}else if(props.isLevel ==2){
console.log("=========projectTaskId",props.projectTaskId);
chapterId: props.isactive,
courseId: state.assessmentId,
name: state.assessmentName,
routerId: props.routerId,
routerTaskId: props.routerTaskId || 0,
type: 1,
})
.then((res) => {
console.log(res, 11111);
message.success(`${props.edit ? "编辑" : "新增"}关卡任务成功`);
ctx.emit("changeData", false);
closeDrawer();
state.addLoading = false;
})
.catch((err) => {
console.log(err, 1111);
});
} else if (props.isLevel == 2) {
console.log("=========projectTaskId", props.projectTaskId);
apiTask
.addTask({
courseId: state.assessmentId,
name: state.assessmentName,
projectId: props.projectId,
projectTaskId: props.projectTaskId || 0,
stageId: props.chooseStageId,
type: 1,
})
.then((res) => {
console.log("调用项目添加接口后111", res.data, 11111);
ctx.emit("changeData", false);
closeDrawer();
})
.catch((err) => {
console.log(err, 111111);
});
}else if(props.isLevel ==3){
.addTask({
courseId: state.assessmentId,
name: state.assessmentName,
projectId: props.projectId,
projectTaskId: props.projectTaskId || 0,
stageId: props.chooseStageId,
type: 1,
})
.then((res) => {
console.log("调用项目添加接口后111", res.data, 11111);
ctx.emit("changeData", false);
closeDrawer();
})
.catch((err) => {
console.log(err, 111111);
});
} else if (props.isLevel == 3) {
console.log("");
}
}
};
//重置在线信息
const resetOnline = () => {
state.inputV1 = "";
@@ -367,201 +380,201 @@ export default {
background-color: #fafafa !important;
}
.addonlineDrawer {
.drawerMain {
.header {
height: 73px;
border-bottom: 1px solid #e8e8e8;
.drawerMain {
.header {
height: 73px;
border-bottom: 1px solid #e8e8e8;
display: flex;
justify-content: space-between;
align-items: center;
flex-shrink: 0;
.headerTitle {
font-size: 18px;
font-weight: 600;
color: #333333;
line-height: 25px;
margin-left: 24px;
}
}
.contentMain {
padding-right: 12px;
.main_items {
display: flex;
justify-content: space-between;
margin-top: 32px;
margin-bottom: 12px;
flex-wrap: wrap;
.mi_ipts {
display: flex;
margin-bottom: 20px;
.mii_ipt {
display: flex;
align-items: center;
margin-right: 24px;
.ipt_name {
white-space: nowrap;
}
}
}
.mi_btns {
display: flex;
margin-left: 38px;
margin-bottom: 20px;
cursor: pointer;
.btn {
padding: 0px 26px 0px 26px;
height: 38px;
border-radius: 8px;
border: 1px solid rgba(64, 158, 255, 1);
display: flex;
align-items: center;
justify-content: center;
margin-left: 14px;
flex-shrink: 0;
.search {
background-size: 100%;
}
.btnText {
font-size: 14px;
font-weight: 400;
line-height: 36px;
margin-left: 5px;
}
}
.btn1 {
background: rgb(64, 158, 255);
.search {
width: 15px;
height: 17px;
background-image: url("@/assets/images/coursewareManage/search0.png");
}
.btnText {
color: rgb(255, 255, 255);
}
}
.btn2 {
background: rgb(255, 255, 255);
.search {
width: 15px;
height: 17px;
background-image: url("@/assets/images/coursewareManage/reset1.png");
}
.btnText {
color: rgb(64, 158, 255);
}
}
.btn1:hover {
background: rgb(255, 255, 255);
.search {
background-image: url("@/assets/images/courseManage/search1.png");
}
.btnText {
color: #388be1;
}
}
.btn2:hover {
background: rgba(64, 158, 255, 1);
.search {
background-image: url("@/assets/images/courseManage/reset0.png");
}
.btnText {
color: #ffffff;
}
}
}
}
.main_notice {
display: flex;
justify-content: space-between;
align-items: center;
flex-shrink: 0;
.headerTitle {
font-size: 18px;
font-weight: 600;
color: #333333;
line-height: 25px;
margin-left: 24px;
}
}
.contentMain {
padding-right: 12px;
.main_items {
margin-bottom: 32px;
height: 40px;
background-color: #e9f6fe;
.mntc_left {
display: flex;
justify-content: space-between;
margin-top: 32px;
margin-bottom: 12px;
flex-wrap: wrap;
.mi_ipts {
display: flex;
margin-bottom: 20px;
.mii_ipt {
display: flex;
align-items: center;
margin-right: 24px;
.ipt_name {
white-space: nowrap;
}
}
}
.mi_btns {
display: flex;
margin-left: 38px;
margin-bottom: 20px;
cursor: pointer;
.btn {
padding: 0px 26px 0px 26px;
height: 38px;
border-radius: 8px;
border: 1px solid rgba(64, 158, 255, 1);
display: flex;
align-items: center;
justify-content: center;
margin-left: 14px;
flex-shrink: 0;
.search {
background-size: 100%;
}
.btnText {
font-size: 14px;
font-weight: 400;
line-height: 36px;
margin-left: 5px;
}
}
.btn1 {
background: rgb(64, 158, 255);
.search {
width: 15px;
height: 17px;
background-image: url("@/assets/images/coursewareManage/search0.png");
}
.btnText {
color: rgb(255, 255, 255);
}
}
.btn2 {
background: rgb(255, 255, 255);
.search {
width: 15px;
height: 17px;
background-image: url("@/assets/images/coursewareManage/reset1.png");
}
.btnText {
color: rgb(64, 158, 255);
}
}
.btn1:hover {
background: rgb(255, 255, 255);
.search {
background-image: url("@/assets/images/courseManage/search1.png");
}
.btnText {
color: #388be1;
}
}
.btn2:hover {
background: rgba(64, 158, 255, 1);
.search {
background-image: url("@/assets/images/courseManage/reset0.png");
}
.btnText {
color: #ffffff;
}
}
}
}
.main_notice {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 32px;
height: 40px;
background-color: #e9f6fe;
.mntc_left {
display: flex;
align-items: center;
.notice_icon {
width: 14px;
height: 14px;
margin-right: 9px;
margin-left: 9px;
background-image: url(@/assets/images/coursewareManage/gan.png);
background-size: 100% 100%;
}
}
.mntc_right {
cursor: pointer;
.notice_icon {
width: 14px;
height: 14px;
margin-right: 9px;
margin-left: 9px;
background-image: url(@/assets/images/coursewareManage/gan.png);
background-size: 100% 100%;
}
}
.main_table {
position: relative;
padding-bottom: 80px;
.classify {
margin-left: 10px !important;
padding-left: 9px !important;
}
.ant-checkbox-wrapper {
align-items: center;
margin-top: -2px;
}
.ant-table-selection-column {
padding: 0px !important;
padding-left: 60px !important;
}
.ant-table-thead > tr > th {
background-color: rgba(239, 244, 252, 1);
}
th.h {
background-color: #eff4fc !important;
}
.ant-table-tbody
> tr:hover:not(.ant-table-expanded-row):not(.ant-table-row-selected)
> td {
background: #f6f9fd;
}
.pa {
left: 0;
width: 100%;
// height: 20px;
// background-color: red;
display: flex;
justify-content: center;
position: absolute;
bottom: 20px;
}
}
.mntc_right {
cursor: pointer;
}
}
.main_btns {
height: 72px;
width: 100%;
bottom: 0;
left: 0;
display: flex;
align-items: center;
justify-content: center;
box-shadow: 0px 1px 35px 0px rgba(118, 136, 166, 0.16);
.btn1 {
width: 100px;
height: 40px;
border: 1px solid #4ea6ff;
border-radius: 8px;
color: #4ea6ff;
background-color: #fff;
cursor: pointer;
.main_table {
position: relative;
padding-bottom: 80px;
.classify {
margin-left: 10px !important;
padding-left: 9px !important;
}
.btn2 {
cursor: pointer;
width: 100px;
height: 40px;
background: #4ea6ff;
border-radius: 8px;
border: 0;
margin-left: 15px;
color: #fff;
.ant-checkbox-wrapper {
align-items: center;
margin-top: -2px;
}
.ant-table-selection-column {
padding: 0px !important;
padding-left: 60px !important;
}
.ant-table-thead > tr > th {
background-color: rgba(239, 244, 252, 1);
}
th.h {
background-color: #eff4fc !important;
}
.ant-table-tbody
> tr:hover:not(.ant-table-expanded-row):not(.ant-table-row-selected)
> td {
background: #f6f9fd;
}
.pa {
left: 0;
width: 100%;
// height: 20px;
// background-color: red;
display: flex;
justify-content: center;
position: absolute;
bottom: 20px;
}
}
}
.main_btns {
height: 72px;
width: 100%;
bottom: 0;
left: 0;
display: flex;
align-items: center;
justify-content: center;
box-shadow: 0px 1px 35px 0px rgba(118, 136, 166, 0.16);
.btn1 {
width: 100px;
height: 40px;
border: 1px solid #4ea6ff;
border-radius: 8px;
color: #4ea6ff;
background-color: #fff;
cursor: pointer;
}
.btn2 {
cursor: pointer;
width: 100px;
height: 40px;
background: #4ea6ff;
border-radius: 8px;
border: 0;
margin-left: 15px;
color: #fff;
}
}
}
}
</style>