Commit 4d3b3f45 authored by YIyiyi's avatar YIyiyi

pref:修改应用列表应用分类的展示

parent a9e00cd1
...@@ -43,6 +43,7 @@ ...@@ -43,6 +43,7 @@
</template> </template>
<script> <script>
import { getSiteTree } from "@/services/basicsetFun"; import { getSiteTree } from "@/services/basicsetFun";
import { mapMutations } from "vuex";
import local from "@/utils/local"; import local from "@/utils/local";
// import Cookie from "js-cookie"; // import Cookie from "js-cookie";
export default { export default {
...@@ -63,6 +64,7 @@ export default { ...@@ -63,6 +64,7 @@ export default {
}, },
mounted() {}, mounted() {},
methods: { methods: {
...mapMutations("site", ["SET_SITE_ID", "SET_siteName"]),
// 确认站点 // 确认站点
onSucessSite() { onSucessSite() {
if (this.checkarr.length == 0) return; if (this.checkarr.length == 0) return;
...@@ -112,7 +114,7 @@ export default { ...@@ -112,7 +114,7 @@ export default {
const { siteTree } = data; const { siteTree } = data;
this.sitelist = siteTree; this.sitelist = siteTree;
let arr = []; let arr = [];
const treeFn = function (e) { const treeFn = function(e) {
e.forEach((element) => { e.forEach((element) => {
arr.push(element); arr.push(element);
if (element.children && element.children.length > 0) { if (element.children && element.children.length > 0) {
...@@ -135,6 +137,8 @@ export default { ...@@ -135,6 +137,8 @@ export default {
// }; // };
local.setLocal("siteId", obj.id); local.setLocal("siteId", obj.id);
local.setLocal("siteName", obj.label); local.setLocal("siteName", obj.label);
this.SET_SITE_ID(obj.id);
this.SET_siteName(obj.label);
this.show = false; this.show = false;
if (location.href.search(/token/gi) >= 0) { if (location.href.search(/token/gi) >= 0) {
setTimeout(() => { setTimeout(() => {
......
...@@ -55,7 +55,7 @@ ...@@ -55,7 +55,7 @@
</template> </template>
<!-- 主题类型 --> <!-- 主题类型 -->
<template slot="appThemeName" slot-scope="text"> <template slot="appThemeName" slot-scope="text">
{{ filterItems(text.appThemeName, dict.appThemeName) }} {{ filterItems(text.appThemeName) }}
</template> </template>
<!-- 简介 --> <!-- 简介 -->
<template slot="summary" slot-scope="text"> <template slot="summary" slot-scope="text">
...@@ -100,7 +100,7 @@ ...@@ -100,7 +100,7 @@
<!-- 新增应用 --> <!-- 新增应用 -->
<AddApp <AddApp
ref="AddApp" ref="AddApp"
:dict="dict" :categoryList="categoryList"
@success="getAppList" @success="getAppList"
:AddVisible.sync="AddVisible" :AddVisible.sync="AddVisible"
:title="title" :title="title"
...@@ -120,9 +120,13 @@ import YSwitch from "../../../../components/yswitch/YSwitch.vue"; ...@@ -120,9 +120,13 @@ import YSwitch from "../../../../components/yswitch/YSwitch.vue";
import { pageSizeOptions } from "@/config/pageConfig.js"; import { pageSizeOptions } from "@/config/pageConfig.js";
import AddApp from "../modal/AddApp.vue"; import AddApp from "../modal/AddApp.vue";
import CheckSite from "../modal/CheckSite.vue"; import CheckSite from "../modal/CheckSite.vue";
import { getAppList, deleteApp, saveApp } from "@/services/market"; import {
getAppList,
deleteApp,
saveApp,
getCategoryList,
} from "@/services/market";
import { mapMutations } from "vuex"; import { mapMutations } from "vuex";
import { filterItems } from "@/utils";
import local from "@/utils/local"; import local from "@/utils/local";
const columns = [ const columns = [
{ {
...@@ -181,7 +185,6 @@ export default { ...@@ -181,7 +185,6 @@ export default {
}, },
data() { data() {
return { return {
filterItems,
api: process.env.VUE_APP_API_BASE_URL + "/", api: process.env.VUE_APP_API_BASE_URL + "/",
api2: process.env.VUE_APP_API_IMG_URL, api2: process.env.VUE_APP_API_IMG_URL,
columns, columns,
...@@ -198,6 +201,7 @@ export default { ...@@ -198,6 +201,7 @@ export default {
title: "新增应用", title: "新增应用",
siteVisible: false, siteVisible: false,
dict: {}, // 字典 dict: {}, // 字典
categoryList: [], // 应用分类列表
}; };
}, },
// 进入路由前 // 进入路由前
...@@ -219,10 +223,24 @@ export default { ...@@ -219,10 +223,24 @@ export default {
// } // }
// }, // },
created() { created() {
this.getCategoryList();
this.getAppList(); this.getAppList();
}, },
methods: { methods: {
...mapMutations("site", ["SET_appDict"]), ...mapMutations("site", ["SET_appDict"]),
// 获取分类列表
async getCategoryList() {
this.loading = true;
let res = await getCategoryList({
page: 1,
size: -1,
siteId: this.siteId,
});
let { data } = res.data.data;
if (res.data.code === 1) {
this.categoryList = data;
}
},
// 获取应用列表 // 获取应用列表
async getAppList() { async getAppList() {
this.loading = true; this.loading = true;
...@@ -354,6 +372,12 @@ export default { ...@@ -354,6 +372,12 @@ export default {
this.getAppList(); this.getAppList();
} }
}, },
// 过滤分类展示
filterItems(appThemeName) {
return (
this.categoryList.find((v) => v.id == appThemeName).categoryName || "--"
);
},
}, },
}; };
</script> </script>
...@@ -362,4 +386,4 @@ export default { ...@@ -362,4 +386,4 @@ export default {
.unDelete { .unDelete {
color: #ff4d5075 !important; color: #ff4d5075 !important;
} }
</style> </style>
\ No newline at end of file
...@@ -55,7 +55,7 @@ ...@@ -55,7 +55,7 @@
</template> </template>
<!-- 主题类型 --> <!-- 主题类型 -->
<template slot="appThemeName" slot-scope="text"> <template slot="appThemeName" slot-scope="text">
{{ filterItems(text.appThemeName, dict.appThemeName) }} {{ filterItems(text.appThemeName) }}
</template> </template>
<!-- 简介 --> <!-- 简介 -->
<template slot="summary" slot-scope="text"> <template slot="summary" slot-scope="text">
...@@ -100,7 +100,7 @@ ...@@ -100,7 +100,7 @@
<!-- 新增应用 --> <!-- 新增应用 -->
<AddApp <AddApp
ref="AddApp" ref="AddApp"
:dict="dict" :categoryList="categoryList"
@success="getAppList" @success="getAppList"
:AddVisible.sync="AddVisible" :AddVisible.sync="AddVisible"
:title="title" :title="title"
...@@ -119,10 +119,14 @@ ...@@ -119,10 +119,14 @@
import YSwitch from "../../../../components/yswitch/YSwitch.vue"; import YSwitch from "../../../../components/yswitch/YSwitch.vue";
import AddApp from "../modal/AddApp.vue"; import AddApp from "../modal/AddApp.vue";
import CheckSite from "../modal/CheckSite.vue"; import CheckSite from "../modal/CheckSite.vue";
import { getAppList, deleteApp, saveApp } from "@/services/market"; import {
getAppList,
deleteApp,
saveApp,
getCategoryList,
} from "@/services/market";
import local from "@/utils/local"; import local from "@/utils/local";
import { mapMutations } from "vuex"; import { mapMutations } from "vuex";
import { filterItems } from "@/utils";
import { pageSizeOptions } from "@/config/pageConfig.js"; import { pageSizeOptions } from "@/config/pageConfig.js";
const columns = [ const columns = [
{ {
...@@ -181,7 +185,6 @@ export default { ...@@ -181,7 +185,6 @@ export default {
}, },
data() { data() {
return { return {
filterItems,
api: process.env.VUE_APP_API_BASE_URL + "/", api: process.env.VUE_APP_API_BASE_URL + "/",
api2: process.env.VUE_APP_API_IMG_URL, api2: process.env.VUE_APP_API_IMG_URL,
columns, columns,
...@@ -198,14 +201,30 @@ export default { ...@@ -198,14 +201,30 @@ export default {
title: "新增应用", title: "新增应用",
siteVisible: false, siteVisible: false,
dict: {}, // 字典 dict: {}, // 字典
categoryList: [], // 应用分类列表
}; };
}, },
created() { created() {
this.getCategoryList();
this.getAppList(); this.getAppList();
}, },
methods: { methods: {
...mapMutations("site", ["SET_appDict"]), ...mapMutations("site", ["SET_appDict"]),
// 获取分类列表
async getCategoryList() {
this.loading = true;
let res = await getCategoryList({
page: 1,
size: -1,
siteId: this.siteId,
});
let { data } = res.data.data;
if (res.data.code === 1) {
this.categoryList = data;
}
},
// 获取应用列表 // 获取应用列表
async getAppList() { async getAppList() {
this.loading = true; this.loading = true;
...@@ -338,6 +357,12 @@ export default { ...@@ -338,6 +357,12 @@ export default {
this.getAppList(); this.getAppList();
} }
}, },
// 过滤分类展示
filterItems(appThemeName) {
return (
this.categoryList.find((v) => v.id == appThemeName).categoryName || "--"
);
},
}, },
}; };
</script> </script>
...@@ -346,4 +371,4 @@ export default { ...@@ -346,4 +371,4 @@ export default {
.unDelete { .unDelete {
color: #ff4d5075 !important; color: #ff4d5075 !important;
} }
</style> </style>
\ No newline at end of file
...@@ -24,11 +24,11 @@ ...@@ -24,11 +24,11 @@
<a-form-model-item label="应用主题" prop="appThemeName"> <a-form-model-item label="应用主题" prop="appThemeName">
<a-select v-model="form.appThemeName" placeholder="请选择应用主题"> <a-select v-model="form.appThemeName" placeholder="请选择应用主题">
<a-select-option <a-select-option
v-for="(v, key) in dict.appThemeName" v-for="v in categoryList"
:value="key" :value="'' + v.id"
:key="key" :key="v.id"
> >
{{ v }} {{ v.categoryName }}
</a-select-option> </a-select-option>
</a-select> </a-select>
</a-form-model-item> </a-form-model-item>
...@@ -180,6 +180,7 @@ import YSwitch from "../../../../components/yswitch/YSwitch.vue"; ...@@ -180,6 +180,7 @@ import YSwitch from "../../../../components/yswitch/YSwitch.vue";
import { saveApp } from "@/services/market"; import { saveApp } from "@/services/market";
import { mapGetters } from "vuex"; import { mapGetters } from "vuex";
import { changeCodeNumber } from "@/utils/validate"; import { changeCodeNumber } from "@/utils/validate";
import local from "@/utils/local";
import PrevieModal from "@/components/PrevieModal.vue"; import PrevieModal from "@/components/PrevieModal.vue";
export default { export default {
components: { components: {
...@@ -197,12 +198,10 @@ export default { ...@@ -197,12 +198,10 @@ export default {
required: true, required: true,
default: false, default: false,
}, },
dict: { categoryList: {
type: Object, type: Array,
required: true, required: true,
default: () => { default: () => [],
return {};
},
}, },
}, },
data() { data() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment