feat: 通知管理
This commit is contained in:
77
src/views/notifications/config/add.ts
Normal file
77
src/views/notifications/config/add.ts
Normal file
@@ -0,0 +1,77 @@
|
||||
import Api from "@/api/product/vendor";
|
||||
import { returnOptions, switchAttr } from "./config";
|
||||
import type { IModalConfig } from "@/components/CURD/types";
|
||||
|
||||
const modalConfig: IModalConfig = {
|
||||
pageName: "sys:user",
|
||||
dialog: {
|
||||
title: "添加供应商",
|
||||
width: 800,
|
||||
draggable: true,
|
||||
},
|
||||
form: {
|
||||
labelWidth: 140,
|
||||
},
|
||||
formAction: function (data) {
|
||||
return Api.add({ ...data });
|
||||
},
|
||||
beforeSubmit(data) {
|
||||
console.log("提交之前处理", data);
|
||||
},
|
||||
formItems: [
|
||||
|
||||
{
|
||||
label: "名称",
|
||||
prop: "name",
|
||||
rules: [{ required: true, message: "请输入名称", trigger: "blur" }],
|
||||
attrs: {
|
||||
placeholder: "请输入名称",
|
||||
},
|
||||
},
|
||||
{
|
||||
label: "联系人名字",
|
||||
prop: "contactName",
|
||||
rules: [{ required: false, message: "请输入联系人名字", trigger: "blur" }],
|
||||
attrs: {
|
||||
placeholder: "请输入联系人名字",
|
||||
},
|
||||
},
|
||||
{
|
||||
label: "联系人电话",
|
||||
prop: "telephone",
|
||||
rules: [{ required: false, message: "请输入联系人名字", trigger: "blur" }],
|
||||
attrs: {
|
||||
placeholder: "请输入联系人名字",
|
||||
},
|
||||
},
|
||||
{
|
||||
label: "供应商地址",
|
||||
prop: "address",
|
||||
rules: [{ required: false, message: "请输入供应商地址", trigger: "blur" }],
|
||||
attrs: {
|
||||
placeholder: "请输入供应商地址",
|
||||
},
|
||||
},
|
||||
{
|
||||
label: "备注",
|
||||
prop: "remark",
|
||||
rules: [{ required: false, message: "请输入备注", trigger: "blur" }],
|
||||
attrs: {
|
||||
placeholder: "请输入备注",
|
||||
},
|
||||
},
|
||||
{
|
||||
label: "排序",
|
||||
prop: "sort",
|
||||
rules: [{ required: true, message: "请输入排序", trigger: "blur" }],
|
||||
type: "input-number",
|
||||
attrs: {
|
||||
placeholder: "请输入排序",
|
||||
},
|
||||
},
|
||||
|
||||
],
|
||||
};
|
||||
|
||||
// 如果有异步数据会修改配置的,推荐用reactive包裹,而纯静态配置的可以直接导出
|
||||
export default reactive(modalConfig);
|
||||
46
src/views/notifications/config/config.ts
Normal file
46
src/views/notifications/config/config.ts
Normal file
@@ -0,0 +1,46 @@
|
||||
export interface options {
|
||||
label: string;
|
||||
value: string | number;
|
||||
[property: string]: any;
|
||||
}
|
||||
export interface optionObject {
|
||||
[property: string]: options[];
|
||||
}
|
||||
const options: optionObject = {
|
||||
payType: [
|
||||
{ label: "现金", value: "cash" },
|
||||
{ label: "微信", value: "weixin" },
|
||||
{ label: "银行卡", value: "bank" },
|
||||
{ label: "会员支付", value: "member-account" },
|
||||
{ label: "支付宝", value: "alipay" },
|
||||
{ label: "刷卡", value: "deposit" },
|
||||
{ label: "挂账", value: "arrears" },
|
||||
{ label: "刷卡", value: "deposit" },
|
||||
{ label: "储值", value: "member-account" },
|
||||
{ label: "自定义", value: "virtual" },
|
||||
],
|
||||
isIdeal: [
|
||||
{ label: "否", value: 0 },
|
||||
{ label: "是", value: 1 },
|
||||
],
|
||||
};
|
||||
|
||||
export const switchAttr = {
|
||||
"active-value": 1,
|
||||
"inactive-value": 0,
|
||||
};
|
||||
|
||||
export type optionsType = string;
|
||||
|
||||
export function returnOptions(type: optionsType) {
|
||||
return options[type];
|
||||
}
|
||||
|
||||
export function returnOptionsLabel(optionsType: optionsType, value: string | number) {
|
||||
const options = returnOptions(optionsType);
|
||||
if (!options) {
|
||||
return "";
|
||||
}
|
||||
const option = options.find((item) => item.value === value);
|
||||
return option ? option.label : "";
|
||||
}
|
||||
87
src/views/notifications/config/content.ts
Normal file
87
src/views/notifications/config/content.ts
Normal file
@@ -0,0 +1,87 @@
|
||||
import Api from "@/api/notifications";
|
||||
import type { IContentConfig } from "@/components/CURD/types";
|
||||
|
||||
const contentConfig: IContentConfig = {
|
||||
pageName: "sys:user",
|
||||
table: {
|
||||
border: true,
|
||||
highlightCurrentRow: true,
|
||||
},
|
||||
pagination: {
|
||||
background: true,
|
||||
layout: "prev,pager,next,jumper,total,sizes",
|
||||
pageSize: 20,
|
||||
pageSizes: [10, 20, 30, 50],
|
||||
},
|
||||
indexAction: function (params) {
|
||||
return Api.getList(params);
|
||||
},
|
||||
deleteAction: function (id) {
|
||||
return Api.delete(id);
|
||||
},
|
||||
modifyAction: function (data) {
|
||||
return Api.edit(data);
|
||||
},
|
||||
indexActionData: {},
|
||||
pk: "id",
|
||||
toolbar: [
|
||||
// {
|
||||
// text: "入库记录",
|
||||
// name: "manual-in",
|
||||
// auth: "",
|
||||
// },
|
||||
// {
|
||||
// text: "出库记录",
|
||||
// name: "manual-out",
|
||||
// auth: "",
|
||||
// },
|
||||
// {
|
||||
// text: "报损记录",
|
||||
// name: "damage-out",
|
||||
// auth: "",
|
||||
// },
|
||||
],
|
||||
defaultToolbar: ["refresh", "filter", "search"],
|
||||
cols: [
|
||||
// { type: "selection", width: 50, align: "center" },
|
||||
{
|
||||
label: "通知类型",
|
||||
align: "center",
|
||||
prop: "type",
|
||||
},
|
||||
{
|
||||
label: "是否已读",
|
||||
align: "center",
|
||||
prop: "isRead",
|
||||
slotName: "isRead",
|
||||
templet: "custom",
|
||||
},
|
||||
{
|
||||
label: "消息内容",
|
||||
align: "center",
|
||||
prop: "content",
|
||||
slotName: "content",
|
||||
templet: "list",
|
||||
},
|
||||
{
|
||||
label: "商品/耗材",
|
||||
align: "center",
|
||||
prop: "extraJson",
|
||||
},
|
||||
{
|
||||
label: "创建时间",
|
||||
align: "center",
|
||||
prop: "createTime",
|
||||
},
|
||||
// {
|
||||
// label: "操作",
|
||||
// align: "center",
|
||||
// fixed: "right",
|
||||
// width: 280,
|
||||
// templet: "tool",
|
||||
// operat: ["edit", "delete"],
|
||||
// },
|
||||
],
|
||||
};
|
||||
|
||||
export default contentConfig;
|
||||
75
src/views/notifications/config/edit.ts
Normal file
75
src/views/notifications/config/edit.ts
Normal file
@@ -0,0 +1,75 @@
|
||||
import Api from "@/api/product/vendor";
|
||||
import { returnOptions, switchAttr } from "./config";
|
||||
import type { IModalConfig } from "@/components/CURD/types";
|
||||
|
||||
const modalConfig: IModalConfig = {
|
||||
pageName: "sys:user",
|
||||
dialog: {
|
||||
title: "编辑供应商",
|
||||
width: 800,
|
||||
draggable: true,
|
||||
},
|
||||
form: {
|
||||
labelWidth: 140,
|
||||
},
|
||||
formAction: function (data) {
|
||||
return Api.edit({ ...data });
|
||||
},
|
||||
beforeSubmit(data) {
|
||||
console.log("提交之前处理", data);
|
||||
},
|
||||
formItems: [
|
||||
{
|
||||
label: "名称",
|
||||
prop: "name",
|
||||
rules: [{ required: true, message: "请输入名称", trigger: "blur" }],
|
||||
attrs: {
|
||||
placeholder: "请输入名称",
|
||||
},
|
||||
},
|
||||
{
|
||||
label: "联系人名字",
|
||||
prop: "contactName",
|
||||
rules: [{ required: false, message: "请输入联系人名字", trigger: "blur" }],
|
||||
attrs: {
|
||||
placeholder: "请输入联系人名字",
|
||||
},
|
||||
},
|
||||
{
|
||||
label: "联系人电话",
|
||||
prop: "telephone",
|
||||
rules: [{ required: false, message: "请输入联系人名字", trigger: "blur" }],
|
||||
attrs: {
|
||||
placeholder: "请输入联系人名字",
|
||||
},
|
||||
},
|
||||
{
|
||||
label: "供应商地址",
|
||||
prop: "address",
|
||||
rules: [{ required: false, message: "请输入供应商地址", trigger: "blur" }],
|
||||
attrs: {
|
||||
placeholder: "请输入供应商地址",
|
||||
},
|
||||
},
|
||||
{
|
||||
label: "备注",
|
||||
prop: "remark",
|
||||
rules: [{ required: false, message: "请输入备注", trigger: "blur" }],
|
||||
attrs: {
|
||||
placeholder: "请输入备注",
|
||||
},
|
||||
},
|
||||
{
|
||||
label: "排序",
|
||||
prop: "sort",
|
||||
rules: [{ required: true, message: "请输入排序", trigger: "blur" }],
|
||||
type: "input-number",
|
||||
attrs: {
|
||||
placeholder: "请输入排序",
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
// 如果有异步数据会修改配置的,推荐用reactive包裹,而纯静态配置的可以直接导出
|
||||
export default reactive(modalConfig);
|
||||
53
src/views/notifications/config/search.ts
Normal file
53
src/views/notifications/config/search.ts
Normal file
@@ -0,0 +1,53 @@
|
||||
import type { ISearchConfig } from "@/components/CURD/types";
|
||||
const searchConfig: ISearchConfig = {
|
||||
pageName: "sys:user",
|
||||
isExpandable: false,
|
||||
formItems: [
|
||||
{
|
||||
type: "select",
|
||||
label: "通知类型 ",
|
||||
prop: "type",
|
||||
attrs: {
|
||||
placeholder: "请选择",
|
||||
clearable: true,
|
||||
style: {
|
||||
width: "200px",
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
label: "商品",
|
||||
value: "0",
|
||||
},
|
||||
{
|
||||
label: "耗材",
|
||||
value: "1",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
type: "select",
|
||||
label: "是否已读",
|
||||
prop: "isRead",
|
||||
attrs: {
|
||||
placeholder: "请选择",
|
||||
clearable: true,
|
||||
style: {
|
||||
width: "200px",
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
label: "未读",
|
||||
value: "0",
|
||||
},
|
||||
{
|
||||
label: "已读",
|
||||
value: "1",
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
export default searchConfig;
|
||||
Reference in New Issue
Block a user