|
@@ -3,14 +3,14 @@
|
|
<div class="layout-padding-auto layout-padding-view pd20">
|
|
<div class="layout-padding-auto layout-padding-view pd20">
|
|
<div class="flex-center-between mb20">
|
|
<div class="flex-center-between mb20">
|
|
<el-form :model="state.queryParams" ref="ruleFormRef" :inline="true" @submit.native.prevent>
|
|
<el-form :model="state.queryParams" ref="ruleFormRef" :inline="true" @submit.native.prevent>
|
|
- <el-form-item label="关键字" prop="keyword">
|
|
|
|
|
|
+ <el-form-item label="关键字" prop="keyword" class="mb0">
|
|
<el-input v-model="state.queryParams.keyword" placeholder="类型名称" clearable @keyup.enter="handleQuery" style="width: 250px" />
|
|
<el-input v-model="state.queryParams.keyword" placeholder="类型名称" clearable @keyup.enter="handleQuery" style="width: 250px" />
|
|
</el-form-item>
|
|
</el-form-item>
|
|
- <el-form-item>
|
|
|
|
- <el-button type="primary" @click="handleQuery" :loading="state.loading" v-waves>
|
|
|
|
|
|
+ <el-form-item class="mb0">
|
|
|
|
+ <el-button type="primary" @click="handleQuery" :loading="state.loading">
|
|
<SvgIcon name="ele-Search" class="mr5" />查询
|
|
<SvgIcon name="ele-Search" class="mr5" />查询
|
|
</el-button>
|
|
</el-button>
|
|
- <el-button @click="resetQuery(ruleFormRef)" v-waves class="default-button"> <SvgIcon name="ele-Refresh" class="mr5" />重置 </el-button>
|
|
|
|
|
|
+ <el-button @click="resetQuery(ruleFormRef)" class="default-button"> <SvgIcon name="ele-Refresh" class="mr5" />重置 </el-button>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
</el-form>
|
|
</el-form>
|
|
<div>
|
|
<div>
|
|
@@ -84,6 +84,7 @@ const knowledgeTypeEditRef = ref();
|
|
const ruleFormRef = ref();
|
|
const ruleFormRef = ref();
|
|
const state = reactive({
|
|
const state = reactive({
|
|
tableData: <any>[], // 获取所有菜单
|
|
tableData: <any>[], // 获取所有菜单
|
|
|
|
+ staticArr: <any>[], // 获取所有菜单
|
|
loading: false,
|
|
loading: false,
|
|
isExpand: true,
|
|
isExpand: true,
|
|
queryParams: {
|
|
queryParams: {
|
|
@@ -93,8 +94,8 @@ const state = reactive({
|
|
});
|
|
});
|
|
// 过滤表格
|
|
// 过滤表格
|
|
const formatTable = (list: any[], keyword: string) => {
|
|
const formatTable = (list: any[], keyword: string) => {
|
|
- if (!list.length || !Array.isArray(list)) return [];
|
|
|
|
let emptyArr: any[] = [];
|
|
let emptyArr: any[] = [];
|
|
|
|
+ console.log(list)
|
|
list.map((item) => {
|
|
list.map((item) => {
|
|
if (item.name.includes(keyword)) {
|
|
if (item.name.includes(keyword)) {
|
|
if (item.child && Array.isArray(item.child) && item.child.length > 0) {
|
|
if (item.child && Array.isArray(item.child) && item.child.length > 0) {
|
|
@@ -114,7 +115,7 @@ const formatTable = (list: any[], keyword: string) => {
|
|
const handleQuery = throttle(() => {
|
|
const handleQuery = throttle(() => {
|
|
if (state.queryParams.keyword) {
|
|
if (state.queryParams.keyword) {
|
|
state.loading = true;
|
|
state.loading = true;
|
|
- state.tableData = formatTable(state.tableData, state.queryParams.keyword);
|
|
|
|
|
|
+ state.tableData = formatTable(JSON.parse(JSON.stringify(state.staticArr)), state.queryParams.keyword);
|
|
state.loading = false;
|
|
state.loading = false;
|
|
} else {
|
|
} else {
|
|
getList();
|
|
getList();
|
|
@@ -214,6 +215,7 @@ const getList = () => {
|
|
treelist()
|
|
treelist()
|
|
.then((res: any) => {
|
|
.then((res: any) => {
|
|
state.tableData = res?.result ?? [];
|
|
state.tableData = res?.result ?? [];
|
|
|
|
+ state.staticArr = res?.result ?? [];
|
|
state.loading = false;
|
|
state.loading = false;
|
|
})
|
|
})
|
|
.catch(() => {
|
|
.catch(() => {
|