Commit 38cdcf91 authored by 赵啸非's avatar 赵啸非

Merge remote-tracking branch 'origin/master'

parents 70fb6541 ca4e0369
...@@ -96,6 +96,12 @@ ...@@ -96,6 +96,12 @@
<span class="primary pointer" @click="handlePreview(text.id)" <span class="primary pointer" @click="handlePreview(text.id)"
>预览</span >预览</span
> >
<span
class="delete pointer"
v-permission="[1]"
@click="handleDel(text.id)"
>删除</span
>
</a-space> </a-space>
</template> </template>
</a-table> </a-table>
...@@ -118,6 +124,7 @@ import { ...@@ -118,6 +124,7 @@ import {
usedVersion, usedVersion,
previewVersion, previewVersion,
getCategoryList, getCategoryList,
deleteVersion,
} from "@/services/market"; } from "@/services/market";
import CheckSite from "../modal/CheckSite.vue"; import CheckSite from "../modal/CheckSite.vue";
import { pageSizeOptions } from "@/config/pageConfig.js"; import { pageSizeOptions } from "@/config/pageConfig.js";
...@@ -270,6 +277,33 @@ export default { ...@@ -270,6 +277,33 @@ export default {
window.open(routeUrl.href, "_blank"); window.open(routeUrl.href, "_blank");
} }
}, },
// 删除
handleDel(id) {
let _this = this;
_this.$confirm({
title: "系统提示",
content: "删除不可恢复,确定要删除吗?",
okText: "确定",
okType: "danger",
cancelText: "取消",
centered: true,
icon: "exclamation-circle",
maskClosable: true,
async onOk() {
let res = await deleteVersion({ id });
let { code, msg } = res.data;
if (code === 1) {
_this.$message.success(msg);
_this.getVersions();
}
},
onCancel() {
console.log("Cancel");
},
});
},
// 翻页 // 翻页
handleChange(cur) { handleChange(cur) {
this.current = cur; this.current = cur;
...@@ -353,4 +387,4 @@ export default { ...@@ -353,4 +387,4 @@ export default {
/deep/.ant-form-item { /deep/.ant-form-item {
align-items: flex-start; align-items: flex-start;
} }
</style> </style>
\ No newline at end of file
...@@ -4,6 +4,12 @@ ...@@ -4,6 +4,12 @@
<a-space> <a-space>
<a-button type="primary" @click="handleAdd"> 新增应用 </a-button> <a-button type="primary" @click="handleAdd"> 新增应用 </a-button>
<a-button type="primary" @click="handleClone"> 克隆 </a-button> <a-button type="primary" @click="handleClone"> 克隆 </a-button>
<a-button type="primary" @click="handleTheme">
批量关联应用主题
</a-button>
<a-button v-permission="[1]" type="danger" @click="handleDelAll">
批量删除
</a-button>
</a-space> </a-space>
<a-input-search <a-input-search
style="width: 300px" style="width: 300px"
...@@ -67,7 +73,7 @@ ...@@ -67,7 +73,7 @@
</template> </template>
<!-- 版本 --> <!-- 版本 -->
<template slot="version" slot-scope="text"> <template slot="version" slot-scope="text">
{{ text.version ? "v" + text.version : "--" }} {{ text.version || text.version == 0 ? "v" + text.version : "--" }}
</template> </template>
<!-- 类型 --> <!-- 类型 -->
<template slot="appType" slot-scope="text"> <template slot="appType" slot-scope="text">
...@@ -91,7 +97,7 @@ ...@@ -91,7 +97,7 @@
> >
<span <span
class="delete pointer" class="delete pointer"
:class="{ unDelete: text.distribute }" :class="{ unDelete: userInfo.id != 1 && text.distribute }"
@click="handleDel(text.distribute, text.id)" @click="handleDel(text.distribute, text.id)"
>删除</span >删除</span
> >
...@@ -114,22 +120,30 @@ ...@@ -114,22 +120,30 @@
:appList="selectedRowKeys" :appList="selectedRowKeys"
:siteVisible.sync="siteVisible" :siteVisible.sync="siteVisible"
></CheckSite> ></CheckSite>
<!-- 批量修改应用主题 -->
<ChangeThem
:themVisible.sync="themVisible"
:themList="categoryList"
:appList="selectedAppList"
@edit="cloneSuccess"
></ChangeThem>
</div> </div>
</template> </template>
<script> <script>
import YSwitch from "../../../../components/yswitch/YSwitch.vue"; import YSwitch from "../../../../components/yswitch/YSwitch.vue";
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 ChangeThem from "../modal/ChangeThem.vue";
import { import {
getAppList, getAppList,
deleteApp, deleteApp,
saveApp, saveApp,
getCategoryList, getCategoryList,
} from "@/services/market"; } from "@/services/market";
import { mapMutations } from "vuex";
import local from "@/utils/local"; import local from "@/utils/local";
import { mapMutations, mapGetters } from "vuex";
import { pageSizeOptions } from "@/config/pageConfig.js";
const columns = [ const columns = [
{ {
title: "序号", title: "序号",
...@@ -184,6 +198,7 @@ export default { ...@@ -184,6 +198,7 @@ export default {
YSwitch, YSwitch,
AddApp, AddApp,
CheckSite, CheckSite,
ChangeThem,
}, },
data() { data() {
return { return {
...@@ -198,32 +213,21 @@ export default { ...@@ -198,32 +213,21 @@ export default {
size: 10, size: 10,
total: 0, total: 0,
pageSizeOptions, pageSizeOptions,
selectedRowKeys: [], // 表格勾选数据 selectedRowKeys: [], // 表格勾选id列表
selectedAppList: [], // 表格勾选信息列表
AddVisible: false, AddVisible: false,
title: "新增应用", title: "新增应用",
siteVisible: false, siteVisible: false,
themVisible: false,
dict: {}, // 字典 dict: {}, // 字典
categoryList: [], // 应用分类列表 categoryList: [], // 应用分类列表
}; };
}, },
// 进入路由前
// beforeRouteEnter(to, from, text) { computed: {
// if (from.path === "/appmarket/appdetails") { ...mapGetters("site", ["userInfo"]),
// to.meta.isBack = true; },
// } else {
// to.meta.isBack = false;
// }
// text();
// },
// // 详情页返回不刷新数据
// activated() {
// if (!this.$route.meta.isBack) {
// Object.assign(this.$data, this.$options.data());
// this.getAppList();
// } else {
// this.$route.meta.isBack = false;
// }
// },
created() { created() {
this.getCategoryList(); this.getCategoryList();
this.getAppList(); this.getAppList();
...@@ -232,7 +236,6 @@ export default { ...@@ -232,7 +236,6 @@ export default {
...mapMutations("site", ["SET_appDict"]), ...mapMutations("site", ["SET_appDict"]),
// 获取分类列表 // 获取分类列表
async getCategoryList() { async getCategoryList() {
this.loading = true;
let res = await getCategoryList({ let res = await getCategoryList({
page: 1, page: 1,
size: -1, size: -1,
...@@ -243,6 +246,7 @@ export default { ...@@ -243,6 +246,7 @@ export default {
this.categoryList = data; this.categoryList = data;
} }
}, },
// 获取应用列表 // 获取应用列表
async getAppList() { async getAppList() {
this.loading = true; this.loading = true;
...@@ -297,8 +301,17 @@ export default { ...@@ -297,8 +301,17 @@ export default {
this.getAppList(); this.getAppList();
}, },
// 勾选表格 // 勾选表格
onSelectChange(keys) { onSelectChange(keys, rows) {
this.selectedRowKeys = keys; this.selectedRowKeys = keys;
this.selectedAppList = [...this.selectedAppList, ...rows];
let map = new Map();
this.selectedAppList = this.selectedAppList
.filter((v) => {
return !map.has(v.id) && map.set(v.id, 1);
})
.filter((v) => {
return this.selectedRowKeys.some((item) => item == v.id);
});
}, },
// 编辑 // 编辑
handleEdit(row) { handleEdit(row) {
...@@ -306,6 +319,16 @@ export default { ...@@ -306,6 +319,16 @@ export default {
this.$refs.AddApp.onEdit(row); this.$refs.AddApp.onEdit(row);
this.AddVisible = true; this.AddVisible = true;
}, },
// 批量修改应用主题
handleTheme() {
if (!this.selectedRowKeys.length) {
this.$message.warning("请先勾选应用");
return;
}
this.themVisible = true;
},
// 查看 // 查看
handleCheck(id) { handleCheck(id) {
this.$router.push({ this.$router.push({
...@@ -317,7 +340,7 @@ export default { ...@@ -317,7 +340,7 @@ export default {
}, },
// 删除 // 删除
handleDel(distribute, id) { handleDel(distribute, id) {
if (distribute) { if (this.userInfo.id != 1 && distribute) {
this.$confirm({ this.$confirm({
title: "拒绝删除", title: "拒绝删除",
content: "该应用正在使用中。", content: "该应用正在使用中。",
...@@ -359,6 +382,17 @@ export default { ...@@ -359,6 +382,17 @@ export default {
}, },
}); });
}, },
// 批量删除
handleDelAll() {
if (!this.selectedRowKeys.length) {
this.$message.warning("请先勾选应用");
return;
}
let ids = this.selectedRowKeys.join(",");
this.handleDel(0, ids);
},
// 克隆成功 // 克隆成功
cloneSuccess() { cloneSuccess() {
this.selectedRowKeys = []; this.selectedRowKeys = [];
......
...@@ -4,6 +4,12 @@ ...@@ -4,6 +4,12 @@
<a-space> <a-space>
<a-button type="primary" @click="handleAdd"> 新增应用 </a-button> <a-button type="primary" @click="handleAdd"> 新增应用 </a-button>
<a-button type="primary" @click="handleClone"> 克隆 </a-button> <a-button type="primary" @click="handleClone"> 克隆 </a-button>
<a-button type="primary" @click="handleTheme">
批量关联应用主题
</a-button>
<a-button v-permission="[1]" type="danger" @click="handleDelAll">
批量删除
</a-button>
</a-space> </a-space>
<a-input-search <a-input-search
style="width: 300px" style="width: 300px"
...@@ -67,7 +73,7 @@ ...@@ -67,7 +73,7 @@
</template> </template>
<!-- 版本 --> <!-- 版本 -->
<template slot="version" slot-scope="text"> <template slot="version" slot-scope="text">
{{ text.version ? "v" + text.version : "--" }} {{ text.version || text.version == 0 ? "v" + text.version : "--" }}
</template> </template>
<!-- 类型 --> <!-- 类型 -->
<template slot="appType" slot-scope="text"> <template slot="appType" slot-scope="text">
...@@ -91,7 +97,7 @@ ...@@ -91,7 +97,7 @@
> >
<span <span
class="delete pointer" class="delete pointer"
:class="{ unDelete: text.distribute }" :class="{ unDelete: userInfo.id != 1 && text.distribute }"
@click="handleDel(text.distribute, text.id)" @click="handleDel(text.distribute, text.id)"
>删除</span >删除</span
> >
...@@ -114,6 +120,13 @@ ...@@ -114,6 +120,13 @@
:appList="selectedRowKeys" :appList="selectedRowKeys"
:siteVisible.sync="siteVisible" :siteVisible.sync="siteVisible"
></CheckSite> ></CheckSite>
<!-- 批量修改应用主题 -->
<ChangeThem
:themVisible.sync="themVisible"
:themList="categoryList"
:appList="selectedAppList"
@edit="cloneSuccess"
></ChangeThem>
</div> </div>
</template> </template>
...@@ -121,6 +134,7 @@ ...@@ -121,6 +134,7 @@
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 ChangeThem from "../modal/ChangeThem.vue";
import { import {
getAppList, getAppList,
deleteApp, deleteApp,
...@@ -128,7 +142,7 @@ import { ...@@ -128,7 +142,7 @@ import {
getCategoryList, getCategoryList,
} from "@/services/market"; } from "@/services/market";
import local from "@/utils/local"; import local from "@/utils/local";
import { mapMutations } from "vuex"; import { mapMutations, mapGetters } from "vuex";
import { pageSizeOptions } from "@/config/pageConfig.js"; import { pageSizeOptions } from "@/config/pageConfig.js";
const columns = [ const columns = [
{ {
...@@ -184,6 +198,7 @@ export default { ...@@ -184,6 +198,7 @@ export default {
YSwitch, YSwitch,
AddApp, AddApp,
CheckSite, CheckSite,
ChangeThem,
}, },
data() { data() {
return { return {
...@@ -198,15 +213,21 @@ export default { ...@@ -198,15 +213,21 @@ export default {
size: 10, size: 10,
total: 0, total: 0,
pageSizeOptions, pageSizeOptions,
selectedRowKeys: [], // 表格勾选数据 selectedRowKeys: [], // 表格勾选id列表
selectedAppList: [], // 表格勾选信息列表
AddVisible: false, AddVisible: false,
title: "新增应用", title: "新增应用",
siteVisible: false, siteVisible: false,
themVisible: false,
dict: {}, // 字典 dict: {}, // 字典
categoryList: [], // 应用分类列表 categoryList: [], // 应用分类列表
}; };
}, },
computed: {
...mapGetters("site", ["userInfo"]),
},
created() { created() {
this.getCategoryList(); this.getCategoryList();
this.getAppList(); this.getAppList();
...@@ -280,8 +301,17 @@ export default { ...@@ -280,8 +301,17 @@ export default {
this.getAppList(); this.getAppList();
}, },
// 勾选表格 // 勾选表格
onSelectChange(keys) { onSelectChange(keys, rows) {
this.selectedRowKeys = keys; this.selectedRowKeys = keys;
this.selectedAppList = [...this.selectedAppList, ...rows];
let map = new Map();
this.selectedAppList = this.selectedAppList
.filter((v) => {
return !map.has(v.id) && map.set(v.id, 1);
})
.filter((v) => {
return this.selectedRowKeys.some((item) => item == v.id);
});
}, },
// 编辑 // 编辑
handleEdit(row) { handleEdit(row) {
...@@ -289,6 +319,16 @@ export default { ...@@ -289,6 +319,16 @@ export default {
this.$refs.AddApp.onEdit(row); this.$refs.AddApp.onEdit(row);
this.AddVisible = true; this.AddVisible = true;
}, },
// 批量修改应用主题
handleTheme() {
if (!this.selectedRowKeys.length) {
this.$message.warning("请先勾选应用");
return;
}
this.themVisible = true;
},
// 查看 // 查看
handleCheck(id) { handleCheck(id) {
this.$router.push({ this.$router.push({
...@@ -301,7 +341,7 @@ export default { ...@@ -301,7 +341,7 @@ export default {
}, },
// 删除 // 删除
handleDel(distribute, id) { handleDel(distribute, id) {
if (distribute) { if (this.userInfo.id != 1 && distribute) {
this.$confirm({ this.$confirm({
title: "拒绝删除", title: "拒绝删除",
content: "该应用正在使用中。", content: "该应用正在使用中。",
...@@ -343,6 +383,17 @@ export default { ...@@ -343,6 +383,17 @@ export default {
}, },
}); });
}, },
// 批量删除
handleDelAll() {
if (!this.selectedRowKeys.length) {
this.$message.warning("请先勾选应用");
return;
}
let ids = this.selectedRowKeys.join(",");
this.handleDel(0, ids);
},
// 克隆成功 // 克隆成功
cloneSuccess() { cloneSuccess() {
this.selectedRowKeys = []; this.selectedRowKeys = [];
......
<template>
<div>
<a-modal v-model="Visible" title="请选择主题">
<a-form-model
ref="form"
:model="form"
:rules="rules"
:label-col="{ span: 4 }"
:wrapper-col="{ span: 20 }"
>
<a-form-model-item label="应用" prop="appThemeName">
<a-select placeholder="请选择主题" v-model="form.appThemeName">
<a-select-option
v-for="v in themList"
:key="v.id"
:value="'' + v.id"
>
{{ v.categoryName }}
</a-select-option>
</a-select>
</a-form-model-item>
</a-form-model>
<div slot="footer">
<a-space size="middle">
<a-button @click="handleCancel">取消</a-button>
<a-button type="primary" @click="handleOk">确定</a-button>
</a-space>
</div>
</a-modal>
</div>
</template>
<script>
import { batchSave } from "@/services/market";
export default {
props: {
themVisible: {
type: Boolean,
required: true,
default: false,
},
themList: {
type: Array,
required: true,
default: () => [],
},
appList: {
type: Array,
required: true,
default: () => [],
},
},
data() {
return {
form: {
appThemeName: undefined,
},
rules: {
appThemeName: [
{ required: true, message: "请选择主题", trigger: "change" },
],
},
};
},
computed: {
Visible: {
get() {
return this.themVisible;
},
set(val) {
this.$emit("update:themVisible", val);
},
},
},
methods: {
// 保存
handleOk() {
this.$refs.form.validate(async (valid) => {
if (valid) {
let arr = this.appList.map((v) => {
return {
...v,
appThemeName: this.form.appThemeName,
};
});
let res = await batchSave(arr);
let { code, msg } = res.data;
if (code == 1) {
this.$message.success(msg);
this.$emit("edit");
this.handleCancel();
}
}
});
},
// 取消
handleCancel() {
this.$refs.form.resetFields();
this.Visible = false;
},
},
};
</script>
<style lang="less" scoped></style>
...@@ -285,6 +285,7 @@ module.exports = { ...@@ -285,6 +285,7 @@ module.exports = {
list: `${BASE_URL}/base/app/list`, list: `${BASE_URL}/base/app/list`,
info: `${BASE_URL}/base/app/info`, info: `${BASE_URL}/base/app/info`,
save: `${BASE_URL}/base/app/save`, save: `${BASE_URL}/base/app/save`,
batchSave: `${BASE_URL}/base/app/batchSave`,
delete: `${BASE_URL}/base/app/delete`, delete: `${BASE_URL}/base/app/delete`,
distribute: `${BASE_URL}/base/app/appDistribute`, distribute: `${BASE_URL}/base/app/appDistribute`,
clone: `${BASE_URL}/base/app/cloneAppsBySites`, clone: `${BASE_URL}/base/app/cloneAppsBySites`,
......
...@@ -27,6 +27,10 @@ export async function getAppInfo(data) { ...@@ -27,6 +27,10 @@ export async function getAppInfo(data) {
export async function saveApp(data) { export async function saveApp(data) {
return request(App.save, METHOD.POST, data); return request(App.save, METHOD.POST, data);
} }
// 新增,修改应用(批量)
export async function batchSave(data) {
return request(App.batchSave, METHOD.POST, data);
}
// 删除应用 // 删除应用
export async function deleteApp(data) { export async function deleteApp(data) {
return request(App.delete, METHOD.GET, data); return request(App.delete, METHOD.GET, 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