删除穿梭框测试页面

yangwl
李靖 1 year ago
parent 82ee5db859
commit 5ae84ff69a

@ -1,186 +0,0 @@
<template>
<div>
<el-input
class="transfer_input"
placeholder="请输入内容"
v-model="knowledgeQuery.name"
clearable
@change="filterKonwledgeFn"
>
</el-input>
<el-transfer
v-model="knowledgeIds"
:titles="['选择知识点', '已选择知识点']"
:button-texts="['移除', '添加']"
:data="knowledgeData"
@change="handleKnowledgeChange"
>
<div class="transfer-footer" slot="left-footer">
<el-pagination
:pager-count="3"
@size-change="transferSizeChange"
@current-change="transferCurrentChange"
:current-page="transferCurrentPage"
:page-sizes="[10, 20, 50, 100]"
:page-size="transferPageSize"
layout=" sizes, prev, pager, next"
:total="transferTotal"
>
</el-pagination>
</div>
<div class="transfer-footer" slot="right-footer">
<el-pagination
:pager-count="3"
@size-change="transferSizeChange"
@current-change="transferCurrentChange"
:current-page="transferCurrentPage"
:page-sizes="[10, 20, 50, 100]"
:page-size="transferPageSize"
layout=" sizes, prev, pager, next"
:total="transferTotal"
>
</el-pagination>
</div>
</el-transfer>
</div>
</template>
<script>
import {
getListProduct,
getRightList,
addProduct,
updateProduct,
getProduct,
delProduct,
} from "@/api/technology/routeprodproduct";
export default {
name: "Routeprodproductnew",
data() {
return {
knowledgeQuery: {
//
cursor: 1,
limit: 10,
searchCount: true,
name: "",
},
knowledgeIds: [], // 穿
knowledgeData: [], // 穿
preKnowledgeData: [], // 穿
transferCurrentPage: 1, //穿
transferPageSize: 10, //穿pagesize
transferTotal: 0, //
leftQueryParams: {
routeId: this.routeId,
pageNum: 1,
pageSize: 20
},
};
},
props: {
routeId: undefined,
optType: undefined,
},
created() {
this.getKnowledges();
// this.getRightListFun();
},
methods: {
// 穿id
getKnowledges() {
const _this = this
getListProduct(this.leftQueryParams).then(response => {
// this.LPages = Math.ceil(response.total/this.LPageSize)
// this.leftList = response.rows;
// this.Ltotal = response.total;
// this.LPageNum = this.leftQueryParams.pageNum;
// this.LNextPage = this.leftQueryParams.pageNum+1;
// this.loading = false;
this.knowledges = response.rows;
this.knowledges.forEach((e) => {
_this.knowledgeIds.push(e.id);
});
});
},
//
getKnowledgesFn() {
getKnowledgesByPage(this.knowledgeQuery).then((res) => {
// 穿
console.log("res章节列表", res);
this.transferTotal = res.result.total;
this.dialogKnowledgeVisible = true;
this.preKnowledgeData = [...this.knowledgeData];
// 穿
this.knowledgeData = res.result.records
.map((item, index) => {
return {
key: item.id,
label: item.name,
};
})
.filter((item, index, self) => {
return self.findIndex((el) => el.key == item.key) === index;
});
// console.log(' this.knowledgeData', this.knowledgeData)
this.getChooseDataFn();
});
},
// pageSize
transferSizeChange(size) {
this.knowledgeQuery.limit = size;
this.getKnowledgesFn();
},
// currentPage
transferCurrentChange(page) {
this.knowledgeQuery.cursor = page;
this.transferCurrentPage = page;
this.getKnowledgesFn();
},
// 穿,
getChooseDataFn() {
this.knowledgeData = this.knowledgeData.filter((item) => {
return !this.knowledgeIds.includes(item.key);
});
// console.log('knowledgeIds_55', this.knowledgeIds)
// knowledgeIds id
const pushArrVal = this.preKnowledgeData.filter((item, index, self) => {
return this.knowledgeIds.includes(item.key);
});
// console.log('pushArrVal', pushArrVal)
this.knowledgeData.push(...pushArrVal);
// console.log('this.knowledgeData888', this.knowledgeData) //
// console.log(' this.preKnowledgeData', this.preKnowledgeData)
},
// 穿
handleKnowledgeChange(value, direction, movedKeys) {
this.knowledges = [];
for (let i = 0; i < value.length; i++) {
this.knowledgeIds[i] = value[i];
for (let j = 0; j < this.knowledgeData.length; j++) {
if (this.knowledgeData[j].key == value[i]) {
this.knowledges.push({
id: this.knowledgeData[j].key,
name: this.knowledgeData[j].label,
category: this.knowledgeData[j].category,
});
}
}
}
},
// 穿
filterKonwledgeFn(val) {
this.transferCurrentPage = 1;
this.knowledgeQuery.cursor = 1;
this.getKnowledgesFn();
},
},
};
</script>
<style>
.el-transfer-panel {
width: 350px;
}
</style>
Loading…
Cancel
Save