Commit c75d147a by 岑成威

feat:新增

1 parent 5bf9d8a2
import request from "./request";
import RequestMethods from "./request.methods";
/**
* 项目组管理 — 分页列表
* @param {Object} data groupName, pageNum, pageSize
*/
export function getProjectGroupList(data = {}) {
data.method = "dj.api.strategy.project.group.list";
return request(data, RequestMethods.POST);
}
/**
* 项目组管理 — 详情
* @param {Object} data groupId
*/
export function getProjectGroupDetail(data = {}) {
data.method = "dj.api.strategy.project.group.detail";
return request(data, RequestMethods.POST);
}
/**
* 项目组管理 — 新增/保存
*/
export function saveProjectGroup(data = {}) {
data.method = "dj.api.strategy.project.group.save";
return request(data, RequestMethods.POST);
}
/**
* 项目组管理 — 删除
* @param {Object} data groupId
*/
export function deleteProjectGroup(data = {}) {
data.method = "dj.api.strategy.project.group.delete";
return request(data, RequestMethods.POST);
}
/**
* 项目组门店 — 分页列表
* @param {Object} data groupId, pageNum, pageSize, merchantName?, merchantId?
* @returns data.list[]: id, groupId, merchantId, merchantName, createdBy, createdDate
*/
export function getProjectGroupStoreList(data = {}) {
data.method = "dj.api.strategy.project.group.store.list";
return request(data, RequestMethods.POST);
}
/**
* 项目组门店 — 批量新增
* @param {Object} data groupId, merchantIds
*/
export function addProjectGroupStores(data = {}) {
data.method = "dj.api.strategy.project.group.store.add";
return request(data, RequestMethods.POST);
}
/**
* 项目组门店 — 删除
* @param {Object} data id
*/
export function deleteProjectGroupStore(data = {}) {
data.method = "dj.api.strategy.project.group.store.delete";
return request(data, RequestMethods.POST);
}
/**
* 预警类型下拉
*/
export function getWarningMetaTypes(data = {}) {
data.method = "dj.api.strategy.project.group.warning.meta.types";
return request(data, RequestMethods.POST);
}
/**
* 应用业务下拉
*/
export function getWarningMetaBizs(data = {}) {
data.method = "dj.api.strategy.project.group.warning.meta.bizs";
return request(data, RequestMethods.POST);
}
/**
* 指标下拉
* @param {Object} data warningType, biz;查拓展业务时额外传 indexName(当前选中指标)
*/
export function getWarningMetaMetrics(data = {}) {
data.method = "dj.api.strategy.project.group.warning.meta.metrics";
return request(data, RequestMethods.POST);
}
/**
* 项目组门店 — 异步批量导入(file 为 ext@base64,与采购上架导入一致)
* @param {Object} data groupId, file
*/
export function importProjectGroupStore(data = {}) {
data.method = "dj.api.smartcarlife.strategy.pg.import";
// 与采购上架导入一致:x-www-form-urlencoded(axios transformRequest: Qs.stringify)
return request(data, RequestMethods.POST, ["file"], {
headers: { "Content-Type": "application/x-www-form-urlencoded;charset=utf-8" },
});
}
// eslint-disable-next-line node/prefer-global/process
const _import = require("@/libs/util.import." + process.env.NODE_ENV); const _import = require("@/libs/util.import." + process.env.NODE_ENV);
export const routerName = { export const routerName = {
906: { 906: {
path: "/systemConfig", path: "/systemConfig",
...@@ -1519,4 +1521,86 @@ export const routerName = { ...@@ -1519,4 +1521,86 @@ export const routerName = {
}, },
component: _import("systemConfig/manageScene/index"), component: _import("systemConfig/manageScene/index"),
}, },
90634: {
path: "/manageProjectGroup",
name: "manageProjectGroup",
meta: {
title: "项目组管理",
authId: "90634",
parentId: "906",
cache: false,
},
addRoutePath: [
{
authId: "9063402",
name: "新增项目组",
parentId: "90634",
},
{
authId: "9063403",
name: "门店管理",
parentId: "90634",
},
],
auth: [
{
authId: "9063401",
parentId: "90634",
label: "添加",
category: "Button",
type: "primary",
handle: "handleAdd",
addRoutePath: [
{
authId: "9063402",
name: "新增项目组",
parentId: "90634",
},
],
},
],
component: _import("systemConfig/manageProjectGroup/index"),
},
9063402: {
path: "/manageProjectGroupAdd",
name: "manageProjectGroupAdd",
meta: {
title: "新增项目组",
authId: "9063402",
parentId: "90634",
cache: false,
activePath: "/manageProjectGroup",
},
component: _import("systemConfig/manageProjectGroup/add"),
},
9063403: {
path: "/manageProjectGroupStore",
name: "manageProjectGroupStore",
meta: {
title: "门店管理",
authId: "9063403",
parentId: "90634",
cache: false,
activePath: "/manageProjectGroup",
},
auth: [
{
authId: "906340301",
parentId: "9063403",
label: "添加",
category: "Button",
type: "primary",
handle: "handleAdd",
},
{
authId: "906340302",
parentId: "9063403",
label: "批量导入",
category: "Button",
type: "primary",
handle: "handleBatchImport",
},
],
component: _import("systemConfig/manageProjectGroup/storeManage"),
},
}; };
<!-- 项目组管理 -->
<template>
<d2-container class="manage-project-group-manage">
<template #header>
<div class="header">
<d2-search ref="showSearch"
class="show-search"
:form-data="showFormData"
:search-form="searchForm" />
<div class="up-btns">
<el-button :id="tableParams.btnId"
size="small"
type="primary">
查询
</el-button>
<el-button size="small" @click="handleReset">
重置
</el-button>
</div>
</div>
</template>
<div class="d2-container-content">
<d2-table-header>
<auth-button category="Button" />
</d2-table-header>
<d2-table ref="serviceStoreTable"
:before-search-fn="beforeSearchFn"
:get-list-api="getListApi"
:search-form="searchForm"
:table-params="tableParams">
<template #auth-button="scope">
<el-button size="mini"
type="text"
@click="handleEdit(scope.scope)">
编辑
</el-button>
<el-button size="mini"
type="text"
@click="handleStoreManage(scope.scope)">
门店管理
</el-button>
<el-button v-if="scope.scope.canDelete !== false"
size="mini"
type="text"
:loading="!!scope.scope._deleteLoading"
@click="handleDelete(scope.scope)">
删除
</el-button>
</template>
</d2-table>
</div>
</d2-container>
</template>
<script>
import { deleteProjectGroup, getProjectGroupList } from "@api/projectGroup";
import { Util } from "@/common/util";
export default {
name: "ManageProjectGroupManage",
data() {
return {
searchForm: {
groupName: "",
},
showFormData: [{
label: "项目组名称",
name: "groupName",
type: "input",
placeholder: "请输入项目组名称",
maxlength: 10,
isClear: true,
keyFn: this.keyDowmGetList,
}],
tableParams: {
btnId: new Date().getTime() + Number.parseInt(Math.random() * 1000),
listName: "list",
tableOption: true,
tableColumns: [{
label: "项目组名称",
minWidth: 200,
prop: "groupName",
showOverFlow: true,
}, {
label: "备注",
minWidth: 160,
prop: "remark",
showOverFlow: true,
formatter: (row) => {
return row.remark || "-";
},
}, {
label: "门店数量",
width: 100,
prop: "storeCount",
formatter: (row) => {
const val = row.storeCount;
return val === 0 || val ? val : "-";
},
}, {
label: "预警配置数",
width: 100,
prop: "warningConfigCount",
formatter: (row) => {
const val = row.warningConfigCount;
return val === 0 || val ? val : "-";
},
}, {
label: "创建人",
width: 120,
prop: "createdBy",
formatter: (row) => {
return row.createdBy || "-";
},
}, {
label: "创建时间",
width: 180,
prop: "createdDate",
formatter: (row) => {
const time = row.createdDate;
return time ? Util.dateFormate(time, "YYYY-MM-DD HH:mm:ss") : "-";
},
}],
},
};
},
methods: {
getRowGroupId(row) {
return row && (row.groupId ?? row.id);
},
beforeSearchFn() {
return Promise.resolve();
},
getListApi(params) {
return getProjectGroupList({
groupName: (params.groupName || "").trim(),
pageNum: params.currentPage || 1,
pageSize: params.pageSize || 10,
});
},
keyDowmGetList() {
this.$refs.serviceStoreTable.refreshTable();
},
handleReset() {
this.searchForm = {
groupName: "",
};
this.$refs.serviceStoreTable.refreshTable(false, true);
},
handleAdd() {
this.$router.push({
name: "manageProjectGroupAdd",
});
},
handleStoreManage(row) {
const groupId = this.getRowGroupId(row);
this.$router.push({
name: "manageProjectGroupStore",
query: {
groupId: groupId != null && groupId !== "" ? String(groupId) : "",
groupName: row && row.groupName ? String(row.groupName) : "",
},
});
},
handleEdit(row) {
const groupId = this.getRowGroupId(row);
this.$router.push({
name: "manageProjectGroupAdd",
query: {
groupId: groupId != null && groupId !== "" ? String(groupId) : "",
},
});
},
handleDelete(row) {
const groupId = this.getRowGroupId(row);
if (groupId == null || groupId === "") {
this.$message.error("缺少项目组ID,无法删除");
return;
}
const groupName = row.groupName || "";
this.$confirm(
groupName ? `确定删除项目组「${groupName}」吗?` : "确定删除该项目组吗?",
"提示",
{
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
closeOnClickModal: false,
},
).then(() => {
this.$set(row, "_deleteLoading", true);
return deleteProjectGroup({ groupId });
}).then(() => {
this.$message.success("删除成功");
this.$refs.serviceStoreTable.refreshTable();
}).catch(() => {}).finally(() => {
this.$set(row, "_deleteLoading", false);
});
},
},
};
</script>
<style lang="scss" scoped>
::v-deep .show-search .el-form-item__label {
white-space: nowrap;
word-break: keep-all;
}
</style>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!