feat: 通知中心
This commit is contained in:
@@ -34,7 +34,7 @@ const Api = {
|
||||
},
|
||||
edit(data: any) {
|
||||
return request<any>({
|
||||
url: `${baseURL}/read`,
|
||||
url: `${baseURL}/syncNotice/read`,
|
||||
method: "put",
|
||||
data,
|
||||
});
|
||||
@@ -42,7 +42,7 @@ const Api = {
|
||||
|
||||
delete(id: string | number) {
|
||||
return request<any>({
|
||||
url: `${baseURL}/syncNotice/` + id,
|
||||
url: `${baseURL}/syncNotice?id=` + id,
|
||||
method: "delete",
|
||||
});
|
||||
},
|
||||
|
||||
@@ -25,6 +25,7 @@ const contentConfig: IContentConfig = {
|
||||
// modifyAction: function (data) {
|
||||
// // return Api.edit(data);
|
||||
// },
|
||||
indexActionData: {},
|
||||
pk: "id",
|
||||
toolbar: [
|
||||
"add",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { ISearchConfig } from "@/components/CURD/types";
|
||||
import consGroupApi from '@/api/product/cons-group'
|
||||
import consGroupApi from "@/api/product/cons-group";
|
||||
import { statusOptions, payTypeOptions } from "./config";
|
||||
const searchConfig: ISearchConfig = {
|
||||
pageName: "sys:user",
|
||||
@@ -20,14 +20,14 @@ const searchConfig: ISearchConfig = {
|
||||
initialValue: "",
|
||||
initFn(formItem) {
|
||||
console.log(formItem);
|
||||
consGroupApi.getAllList({}).then(res => {
|
||||
formItem.options = res.map((item: { name: any; id: any; }) => {
|
||||
consGroupApi.getAllList({}).then((res) => {
|
||||
formItem.options = res.map((item: { name: any; id: any }) => {
|
||||
return {
|
||||
label: item?.name,
|
||||
value: item?.id
|
||||
}
|
||||
})
|
||||
})
|
||||
value: item?.id,
|
||||
};
|
||||
});
|
||||
});
|
||||
},
|
||||
},
|
||||
|
||||
@@ -42,6 +42,7 @@ const searchConfig: ISearchConfig = {
|
||||
width: "200px",
|
||||
},
|
||||
},
|
||||
initialValue: "",
|
||||
},
|
||||
{
|
||||
type: "date-picker",
|
||||
|
||||
@@ -136,6 +136,16 @@ function toGoods(id: number | string) {
|
||||
router.push({ path: "/product/index", query: { id: id } });
|
||||
}
|
||||
|
||||
// 默认初始数据
|
||||
const route = useRoute();
|
||||
const { conName } = route.query;
|
||||
if (conName) {
|
||||
contentConfig.indexActionData = { conName };
|
||||
if (conName) {
|
||||
searchConfig.formItems[1].initialValue = conName;
|
||||
}
|
||||
}
|
||||
|
||||
//统计数据
|
||||
const gongjiData = reactive({ totalRow: 0 });
|
||||
function getTongji(params: IObject | undefined) {
|
||||
|
||||
@@ -54,15 +54,10 @@ const contentConfig: IContentConfig = {
|
||||
align: "center",
|
||||
prop: "unitName",
|
||||
},
|
||||
{
|
||||
label: "所属商品",
|
||||
align: "center",
|
||||
prop: "unitName",
|
||||
},
|
||||
{
|
||||
label: "供应商",
|
||||
align: "center",
|
||||
prop: "unitName",
|
||||
prop: "vendorName",
|
||||
},
|
||||
{
|
||||
label: "变动原因",
|
||||
|
||||
@@ -19,7 +19,6 @@ const modalConfig: IModalConfig = {
|
||||
console.log("提交之前处理", data);
|
||||
},
|
||||
formItems: [
|
||||
|
||||
{
|
||||
label: "名称",
|
||||
prop: "name",
|
||||
@@ -41,7 +40,7 @@ const modalConfig: IModalConfig = {
|
||||
prop: "telephone",
|
||||
rules: [{ required: false, message: "请输入联系人名字", trigger: "blur" }],
|
||||
attrs: {
|
||||
placeholder: "请输入联系人名字",
|
||||
placeholder: "请输入联系人电话",
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -69,7 +68,6 @@ const modalConfig: IModalConfig = {
|
||||
placeholder: "请输入排序",
|
||||
},
|
||||
},
|
||||
|
||||
],
|
||||
};
|
||||
|
||||
|
||||
@@ -57,13 +57,13 @@ const contentConfig: IContentConfig = {
|
||||
align: "center",
|
||||
prop: "createTime",
|
||||
},
|
||||
{
|
||||
label: "状态",
|
||||
align: "center",
|
||||
prop: "status",
|
||||
templet: 'custom',
|
||||
slotName: 'switch'
|
||||
},
|
||||
// {
|
||||
// label: "状态",
|
||||
// align: "center",
|
||||
// prop: "status",
|
||||
// templet: 'custom',
|
||||
// slotName: 'switch'
|
||||
// },
|
||||
|
||||
{
|
||||
label: "操作",
|
||||
@@ -71,7 +71,7 @@ const contentConfig: IContentConfig = {
|
||||
fixed: "right",
|
||||
width: 280,
|
||||
templet: "tool",
|
||||
operat: ["edit", 'delete'],
|
||||
operat: ["edit", "delete"],
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
@@ -19,7 +19,6 @@ const modalConfig: IModalConfig = {
|
||||
console.log("提交之前处理", data);
|
||||
},
|
||||
formItems: [
|
||||
|
||||
{
|
||||
label: "名称",
|
||||
prop: "name",
|
||||
@@ -41,7 +40,7 @@ const modalConfig: IModalConfig = {
|
||||
prop: "telephone",
|
||||
rules: [{ required: false, message: "请输入联系人名字", trigger: "blur" }],
|
||||
attrs: {
|
||||
placeholder: "请输入联系人名字",
|
||||
placeholder: "请输入联系人电话",
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -69,7 +68,6 @@ const modalConfig: IModalConfig = {
|
||||
placeholder: "请输入排序",
|
||||
},
|
||||
},
|
||||
|
||||
],
|
||||
};
|
||||
|
||||
|
||||
@@ -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