123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150 |
- /**
- * 公告管理API
- * @description 提供公告的增删改查功能
- * @version 2.0.0
- */
- import request from '@/router/axios';
- /**
- * 公告查询参数类型定义
- * @typedef {Object} NoticeQueryParams
- * @property {number} current - 当前页码
- * @property {number} size - 每页大小
- * @property {string} [categoryId] - 分类ID(可选)
- * @property {string} [title] - 公告标题(搜索用)
- * @property {string} [content] - 公告内容(搜索用)
- */
- /**
- * 公告表单数据类型定义
- * @typedef {Object} NoticeFormData
- * @property {string} [id] - 公告ID(更新时必填)
- * @property {string} title - 公告标题
- * @property {string} content - 公告内容
- * @property {string} categoryId - 分类ID
- * @property {string} categoryName - 分类名称
- * @property {number} orgId - 组织ID
- * @property {string} orgCode - 组织编码
- * @property {string} orgName - 组织名称
- * @property {string} visibleRoles - 可见角色
- * @property {Object} [brandScope] - 品牌范围
- * @property {Object} [customerBlacklist] - 客户黑名单
- * @property {string} [remark] - 备注
- */
- /**
- * 公告列表项类型定义
- * @typedef {Object} NoticeRecord
- * @property {string} id - 公告ID
- * @property {string} createUser - 创建用户ID
- * @property {string} createDept - 创建部门ID
- * @property {string} createTime - 创建时间
- * @property {string} updateUser - 更新用户ID
- * @property {string} updateTime - 更新时间
- * @property {number} status - 状态 1-正常 0-禁用
- * @property {number} isDeleted - 是否删除 0-未删除 1-已删除
- * @property {string} title - 公告标题
- * @property {string} content - 公告内容
- * @property {string} categoryId - 分类ID
- * @property {string} categoryName - 分类名称
- * @property {number} orgId - 组织ID
- * @property {string} orgCode - 组织编码
- * @property {string} orgName - 组织名称
- * @property {string} visibleRoles - 可见角色
- * @property {Object|null} brandScope - 品牌范围
- * @property {Object|null} customerBlacklist - 客户黑名单
- * @property {string} remark - 备注
- */
- /**
- * 获取公告列表
- * @param {number} current - 当前页码
- * @param {number} size - 每页大小
- * @param {NoticeQueryParams} [params={}] - 查询参数
- * @returns {Promise<AxiosResponse<{data: {data: {records: NoticeRecord[], total: number, size: number, current: number}}}>>}
- */
- export const getList = (current, size, params = {}) => {
- return request({
- url: '/api/blade-factory/api/factory/notice/page',
- method: 'get',
- params: {
- current,
- size,
- ...params
- }
- });
- };
- /**
- * 新增公告
- * @param {NoticeFormData} row - 公告表单数据
- * @returns {Promise<AxiosResponse<boolean>>} 操作结果
- */
- export const add = (row) => {
- return request({
- url: '/api/blade-factory/api/factory/notice/add',
- method: 'post',
- data: row
- });
- };
- /**
- * 修改公告
- * @param {NoticeFormData} row - 公告表单数据
- * @returns {Promise<AxiosResponse<boolean>>} 操作结果
- */
- export const update = (row) => {
- return request({
- url: '/api/blade-factory/api/factory/notice/update',
- method: 'post',
- data: row
- });
- };
- /**
- * 获取公告详情
- * @param {string} id - 公告ID
- * @returns {Promise<AxiosResponse<NoticeRecord>>} 公告详情
- */
- export const getAnnouncement = (id) => {
- return request({
- url: '/api/blade-factory/api/factory/notice/detail',
- method: 'get',
- params: {
- id
- }
- });
- };
- /**
- * 获取经销商列表(保留兼容性)
- * @returns {Promise<AxiosResponse<Array<{id: string, name: string}>>>}
- */
- export const getDealerList = () => {
- return request({
- url: '/api/blade-system/dealer/list',
- method: 'get'
- });
- };
- /**
- * 获取品牌列表(保留兼容性)
- * @returns {Promise<AxiosResponse<Array<{id: string, name: string}>>>}
- */
- export const getBrandList = () => {
- return request({
- url: '/api/blade-system/brand/list',
- method: 'get'
- });
- };
- /**
- * 获取分类列表
- * @returns {Promise<any>}
- */
- export const getCategoryList = () => {
- return request({
- url: '/api/blade-factory/api/factory/notice/category/list',
- method: 'get'
- });
- };
|