feat: 通知中心
This commit is contained in:
@@ -47,9 +47,7 @@ const contentConfig: IContentConfig = {
|
||||
{
|
||||
label: "通知类型",
|
||||
align: "center",
|
||||
prop: "type",
|
||||
slotName: "type",
|
||||
templet: "custom",
|
||||
prop: "title",
|
||||
},
|
||||
{
|
||||
label: "是否已读",
|
||||
@@ -63,7 +61,7 @@ const contentConfig: IContentConfig = {
|
||||
align: "center",
|
||||
prop: "content",
|
||||
slotName: "content",
|
||||
templet: "list",
|
||||
templet: "custom",
|
||||
},
|
||||
{
|
||||
label: "创建时间",
|
||||
|
||||
@@ -16,12 +16,16 @@ const searchConfig: ISearchConfig = {
|
||||
},
|
||||
options: [
|
||||
{
|
||||
label: "商品",
|
||||
value: "0",
|
||||
label: "数据同步",
|
||||
value: "数据同步",
|
||||
},
|
||||
{
|
||||
label: "耗材",
|
||||
value: "1",
|
||||
label: "数据变动",
|
||||
value: "数据变动",
|
||||
},
|
||||
{
|
||||
label: "库存预警",
|
||||
value: "库存预警",
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
@@ -7,8 +7,24 @@
|
||||
<page-content ref="contentRef" :content-config="contentConfig" @add-click="handleAddClick"
|
||||
@edit-click="handleEditClick" @export-click="handleExportClick" @search-click="handleSearchClick"
|
||||
@toolbar-click="handleToolbarClick" @operat-click="handleOperatClick" @filter-change="handleFilterChange">
|
||||
<template #type="scope">
|
||||
{{ scope.row.type == 1 ? "耗材变动" : "商品变动 " }}
|
||||
<!-- <template #type="scope">
|
||||
<span v-if="scope.row.type == 0">商品新增</span>
|
||||
<span v-if="scope.row.type == 1">商品编辑</span>
|
||||
<span v-if="scope.row.type == 2">耗材新增</span>
|
||||
<span v-if="scope.row.type == 3">耗材编辑</span>
|
||||
</template> -->
|
||||
<template #content="scope">
|
||||
<span>{{ scope.row.title }}</span>
|
||||
<!-- <span v-if="scope.row.type == 1">商品编辑</span>
|
||||
<span v-if="scope.row.type == 2">耗材新增</span>
|
||||
<span v-if="scope.row.type == 3">耗材编辑</span> -->
|
||||
<div v-for="(item, index) in matchedProducts(scope.row.content)" :key="index">
|
||||
<span v-for="i in item.map" :key="i.id" style="color: #6161f7" @click="handleContentClick(scope, i)">
|
||||
{{ i.name }},
|
||||
</span>
|
||||
</div>
|
||||
|
||||
请及时确认
|
||||
</template>
|
||||
<template #isRead="scope">
|
||||
<el-tag :type="scope.row.isRead == 1 ? 'success' : 'info'">
|
||||
@@ -22,9 +38,11 @@
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
">
|
||||
<el-button link type="primary" @click="refAddHaocaiTakinShow(scope.row, '')">
|
||||
设为已读
|
||||
</el-button>
|
||||
<div>
|
||||
<el-button link type="primary" @click="refAddHaocaiTakinShow(scope.row, '')">
|
||||
设为已读
|
||||
</el-button>
|
||||
</div>
|
||||
<el-button link type="primary" @click="refAddHaocaiTakinShow(scope.row, 'delete')">
|
||||
删除
|
||||
</el-button>
|
||||
@@ -49,6 +67,8 @@ import contentConfig from "./config/content";
|
||||
import editModalConfig from "./config/edit";
|
||||
import searchConfig from "./config/search";
|
||||
import Api from "@/api/notifications";
|
||||
import router from "@/router";
|
||||
import { log } from "console";
|
||||
|
||||
const {
|
||||
searchRef,
|
||||
@@ -75,30 +95,47 @@ async function handleEditClick(row: IObject) {
|
||||
editModalRef.value?.handleDisabled(false);
|
||||
editModalRef.value?.setModalVisible();
|
||||
// 根据id获取数据进行填充
|
||||
console.log(row);
|
||||
editModalRef.value?.setFormData({ ...row });
|
||||
}
|
||||
1;
|
||||
// 其他工具栏
|
||||
function handleToolbarClick(name: string) {
|
||||
console.log(name);
|
||||
if (name === "custom1") {
|
||||
ElMessage.success("点击了自定义1按钮");
|
||||
}
|
||||
}
|
||||
|
||||
const matchedProducts = (data: string) => {
|
||||
return JSON.parse(data);
|
||||
};
|
||||
|
||||
//删除
|
||||
function refAddHaocaiTakinShow(item: any, type: string) {
|
||||
console.log(item);
|
||||
async function refAddHaocaiTakinShow(item: any, type: string) {
|
||||
if (type === "delete") {
|
||||
Api.delete(item.id);
|
||||
} else {
|
||||
Api.edit(item.id);
|
||||
Api.edit({
|
||||
noticeIdList: [item.id],
|
||||
});
|
||||
}
|
||||
contentRef.value?.fetchPageData();
|
||||
}
|
||||
|
||||
// 其他操作列
|
||||
async function handleOperatClick(data: IOperatData) {
|
||||
console.log(data);
|
||||
}
|
||||
// Handle content click
|
||||
function handleContentClick(scope: any, item: any) {
|
||||
if (scope.type == "1" || scope.type == "0") {
|
||||
router.push({
|
||||
path: "/product/addgoods",
|
||||
query: { goods_id: item.id },
|
||||
});
|
||||
} else {
|
||||
router.push({
|
||||
path: "/inventory/consumables",
|
||||
query: { conName: item.name },
|
||||
});
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user