diff --git a/mock-server/index.js b/mock-server/index.js
index 1e1390d..aa1d81e 100644
--- a/mock-server/index.js
+++ b/mock-server/index.js
@@ -3,6 +3,7 @@ import cors from 'cors'
import cookieParser from 'cookie-parser'
import authRoutes from './routes/auth.js'
import systemRoutes from './routes/system.js'
+import baseConfigRoutes from './routes/baseConfig.js'
const app = express()
app.use(cors({ origin: 'http://localhost:5173', credentials: true }))
@@ -11,6 +12,7 @@ app.use(cookieParser())
app.use('/auth', authRoutes)
app.use('/system', systemRoutes)
+app.use('/base-config', baseConfigRoutes)
const PORT = 8888
app.listen(PORT, () => {
diff --git a/mock-server/routes/baseConfig.js b/mock-server/routes/baseConfig.js
new file mode 100644
index 0000000..02a64bc
--- /dev/null
+++ b/mock-server/routes/baseConfig.js
@@ -0,0 +1,107 @@
+import express from 'express'
+import { orgs } from '../data/orgs.js'
+import { channels, nextChannelId } from '../data/channels.js'
+import { requireAuth } from '../middleware/requireAuth.js'
+
+const router = express.Router()
+router.use(requireAuth)
+
+function orgName(orgId) {
+ return orgs.find((o) => o.id === orgId)?.name || ''
+}
+
+function nowStr() {
+ return new Date().toISOString().slice(0, 19).replace('T', ' ')
+}
+
+// ---------------- 核心企业管理 ----------------
+
+router.get('/channel/list', (req, res) => {
+ const { orgId, channelCode, channelName, page = 1, pageSize = 10 } = req.query || {}
+ let list = channels
+ if (orgId) list = list.filter((c) => c.orgId === orgId)
+ if (channelCode) list = list.filter((c) => c.channelCode.includes(channelCode))
+ if (channelName) list = list.filter((c) => c.name.includes(channelName))
+
+ const total = list.length
+ const start = (Number(page) - 1) * Number(pageSize)
+ const pageList = list.slice(start, start + Number(pageSize)).map((c) => ({
+ id: c.id,
+ name: c.name,
+ channelCode: c.channelCode,
+ appCode: c.appCode,
+ motherAccountBank: c.motherAccountBank,
+ orgId: c.orgId,
+ orgName: orgName(c.orgId),
+ createdAt: c.createdAt
+ }))
+ res.json({ code: 200, msg: 'ok', data: { list: pageList, total } })
+})
+
+router.post('/channel', (req, res) => {
+ const { name, channelCode, appCode, motherAccountBank, orgId } = req.body || {}
+ if (!name) return res.json({ code: 40025, msg: '请输入渠道名称', data: null })
+ if (!channelCode) return res.json({ code: 40026, msg: '请输入渠道编号', data: null })
+ if (!appCode) return res.json({ code: 40027, msg: '请输入应用编号', data: null })
+ if (!motherAccountBank) return res.json({ code: 40028, msg: '请输入母户开户行', data: null })
+ if (!orgId || !orgs.some((o) => o.id === orgId)) {
+ return res.json({ code: 40029, msg: '请选择有效的所属机构', data: null })
+ }
+
+ const channel = {
+ id: nextChannelId(),
+ name,
+ channelCode,
+ appCode,
+ motherAccountBank,
+ orgId,
+ createdAt: nowStr()
+ }
+ channels.push(channel)
+ res.json({ code: 200, msg: 'ok', data: channel })
+})
+
+router.put('/channel/:id', (req, res) => {
+ const { id } = req.params
+ const { name, channelCode, appCode, motherAccountBank, orgId } = req.body || {}
+ const channel = channels.find((c) => c.id === id)
+ if (!channel) return res.json({ code: 40404, msg: '核心企业不存在', data: null })
+ if (!name) return res.json({ code: 40025, msg: '请输入渠道名称', data: null })
+ if (!channelCode) return res.json({ code: 40026, msg: '请输入渠道编号', data: null })
+ if (!appCode) return res.json({ code: 40027, msg: '请输入应用编号', data: null })
+ if (!motherAccountBank) return res.json({ code: 40028, msg: '请输入母户开户行', data: null })
+ if (!orgId || !orgs.some((o) => o.id === orgId)) {
+ return res.json({ code: 40029, msg: '请选择有效的所属机构', data: null })
+ }
+
+ channel.name = name
+ channel.channelCode = channelCode
+ channel.appCode = appCode
+ channel.motherAccountBank = motherAccountBank
+ channel.orgId = orgId
+ res.json({ code: 200, msg: 'ok', data: channel })
+})
+
+router.delete('/channel/batch', (req, res) => {
+ const { ids } = req.body || {}
+ if (!Array.isArray(ids) || ids.length === 0) {
+ return res.json({ code: 40024, msg: '请选择要删除的核心企业', data: null })
+ }
+ const successIds = []
+ const failed = []
+ ids.forEach((id) => {
+ const channel = channels.find((c) => c.id === id)
+ if (!channel) {
+ failed.push({ id, name: id, reason: '核心企业不存在' })
+ return
+ }
+ successIds.push(id)
+ })
+ successIds.forEach((id) => {
+ const index = channels.findIndex((c) => c.id === id)
+ if (index !== -1) channels.splice(index, 1)
+ })
+ res.json({ code: 200, msg: 'ok', data: { successIds, failed } })
+})
+
+export default router
diff --git a/src/api/baseConfig.js b/src/api/baseConfig.js
new file mode 100644
index 0000000..a1b7309
--- /dev/null
+++ b/src/api/baseConfig.js
@@ -0,0 +1,7 @@
+import request from './request'
+
+// ---------------- 核心企业管理 ----------------
+export const fetchChannelListApi = (params) => request.get('/base-config/channel/list', { params })
+export const createChannelApi = (data) => request.post('/base-config/channel', data)
+export const updateChannelApi = (id, data) => request.put(`/base-config/channel/${id}`, data)
+export const batchDeleteChannelApi = (ids) => request.delete('/base-config/channel/batch', { data: { ids } })
diff --git a/src/views/base-config/channel/ChannelList.vue b/src/views/base-config/channel/ChannelList.vue
new file mode 100644
index 0000000..b38ed3a
--- /dev/null
+++ b/src/views/base-config/channel/ChannelList.vue
@@ -0,0 +1,174 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 新增
+
+
+
+ 删除
+
+
+
+
+
+
+ {{ index + 1 }}
+
+ 修改
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+