Commit 4d3b3f45 authored by YIyiyi's avatar YIyiyi

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

parent a9e00cd1
......@@ -43,6 +43,7 @@
</template>
<script>
import { getSiteTree } from "@/services/basicsetFun";
import { mapMutations } from "vuex";
import local from "@/utils/local";
// import Cookie from "js-cookie";
export default {
......@@ -63,6 +64,7 @@ export default {
},
mounted() {},
methods: {
...mapMutations("site", ["SET_SITE_ID", "SET_siteName"]),
// 确认站点
onSucessSite() {
if (this.checkarr.length == 0) return;
......@@ -112,7 +114,7 @@ export default {
const { siteTree } = data;
this.sitelist = siteTree;
let arr = [];
const treeFn = function (e) {
const treeFn = function(e) {
e.forEach((element) => {
arr.push(element);
if (element.children && element.children.length > 0) {
......@@ -135,6 +137,8 @@ export default {
// };
local.setLocal("siteId", obj.id);
local.setLocal("siteName", obj.label);
this.SET_SITE_ID(obj.id);
this.SET_siteName(obj.label);
this.show = false;
if (location.href.search(/token/gi) >= 0) {
setTimeout(() => {
......
......@@ -55,7 +55,7 @@
</template>
<!-- 主题类型 -->
<template slot="appThemeName" slot-scope="text">
{{ filterItems(text.appThemeName, dict.appThemeName) }}
{{ filterItems(text.appThemeName) }}
</template>
<!-- 简介 -->
<template slot="summary" slot-scope="text">
......@@ -100,7 +100,7 @@
<!-- 新增应用 -->
<AddApp
ref="AddApp"
:dict="dict"
:categoryList="categoryList"
@success="getAppList"
:AddVisible.sync="AddVisible"
:title="title"
......@@ -120,9 +120,13 @@ import YSwitch from "../../../../components/yswitch/YSwitch.vue";
import { pageSizeOptions } from "@/config/pageConfig.js";
import AddApp from "../modal/AddApp.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 { filterItems } from "@/utils";
import local from "@/utils/local";
const columns = [
{
......@@ -181,7 +185,6 @@ export default {
},
data() {
return {
filterItems,
api: process.env.VUE_APP_API_BASE_URL + "/",
api2: process.env.VUE_APP_API_IMG_URL,
columns,
......@@ -198,6 +201,7 @@ export default {
title: "新增应用",
siteVisible: false,
dict: {}, // 字典
categoryList: [], // 应用分类列表
};
},
// 进入路由前
......@@ -219,10 +223,24 @@ export default {
// }
// },
created() {
this.getCategoryList();
this.getAppList();
},
methods: {
...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() {
this.loading = true;
......@@ -354,6 +372,12 @@ export default {
this.getAppList();
}
},
// 过滤分类展示
filterItems(appThemeName) {
return (
this.categoryList.find((v) => v.id == appThemeName).categoryName || "--"
);
},
},
};
</script>
......
......@@ -55,7 +55,7 @@
</template>
<!-- 主题类型 -->
<template slot="appThemeName" slot-scope="text">
{{ filterItems(text.appThemeName, dict.appThemeName) }}
{{ filterItems(text.appThemeName) }}
</template>
<!-- 简介 -->
<template slot="summary" slot-scope="text">
......@@ -100,7 +100,7 @@
<!-- 新增应用 -->
<AddApp
ref="AddApp"
:dict="dict"
:categoryList="categoryList"
@success="getAppList"
:AddVisible.sync="AddVisible"
:title="title"
......@@ -119,10 +119,14 @@
import YSwitch from "../../../../components/yswitch/YSwitch.vue";
import AddApp from "../modal/AddApp.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 { mapMutations } from "vuex";
import { filterItems } from "@/utils";
import { pageSizeOptions } from "@/config/pageConfig.js";
const columns = [
{
......@@ -181,7 +185,6 @@ export default {
},
data() {
return {
filterItems,
api: process.env.VUE_APP_API_BASE_URL + "/",
api2: process.env.VUE_APP_API_IMG_URL,
columns,
......@@ -198,14 +201,30 @@ export default {
title: "新增应用",
siteVisible: false,
dict: {}, // 字典
categoryList: [], // 应用分类列表
};
},
created() {
this.getCategoryList();
this.getAppList();
},
methods: {
...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() {
this.loading = true;
......@@ -338,6 +357,12 @@ export default {
this.getAppList();
}
},
// 过滤分类展示
filterItems(appThemeName) {
return (
this.categoryList.find((v) => v.id == appThemeName).categoryName || "--"
);
},
},
};
</script>
......
......@@ -24,11 +24,11 @@
<a-form-model-item label="应用主题" prop="appThemeName">
<a-select v-model="form.appThemeName" placeholder="请选择应用主题">
<a-select-option
v-for="(v, key) in dict.appThemeName"
:value="key"
:key="key"
v-for="v in categoryList"
:value="'' + v.id"
:key="v.id"
>
{{ v }}
{{ v.categoryName }}
</a-select-option>
</a-select>
</a-form-model-item>
......@@ -180,6 +180,7 @@ import YSwitch from "../../../../components/yswitch/YSwitch.vue";
import { saveApp } from "@/services/market";
import { mapGetters } from "vuex";
import { changeCodeNumber } from "@/utils/validate";
import local from "@/utils/local";
import PrevieModal from "@/components/PrevieModal.vue";
export default {
components: {
......@@ -197,12 +198,10 @@ export default {
required: true,
default: false,
},
dict: {
type: Object,
categoryList: {
type: Array,
required: true,
default: () => {
return {};
},
default: () => [],
},
},
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