Commit e194ed55 authored by 仇晓婷's avatar 仇晓婷

消息ok

parent 59b0c802
<template> <template>
<span class="i-layout-header-trigger i-layout-header-trigger-min i-layout-header-trigger-in"> <span
<Notification class="i-layout-header-trigger i-layout-header-trigger-min i-layout-header-trigger-in i-con"
:wide="isMobile" >
:badge-props="badgeProps" <Notification auto-count @on-load-more="handleLoadMore" @on-clear="handleClear">
class="i-layout-header-notice" <NotificationTab title="通知" name="message" :count="unreadMessage" :loading="messageLoading">
:class="{ 'i-layout-header-notice-mobile': isMobile }"> <NotificationItem
<Icon slot="icon" custom="i-icon i-icon-notification" /> v-for="(item, index) in messages"
:key="index"
<NotificationTab title="消息"> :class="item.msg?'con_bord':''"
fdsafafafsafafd :title="item.title"
</NotificationTab> :icon="item.icon||'md-mail'"
<!-- <NotificationTab title="待办"> :icon-color="item.iconColor||'#2680eb'"
:time="item.creationTime"
</NotificationTab> @click.native="clickItem(item,index)"
<NotificationTab title="通知"> />
<!-- :read="item.content" -->
</NotificationTab> --> <div slot="clear">历史消息</div>
</Notification> </NotificationTab>
<Modal </Notification>
v-model="modal" <Modal v-model="modal1" :title="msg.title">
title="msg.title" <p class="content-in">发送时间:{{msg.creationTime}}</p>
> <p class="content-in">{{msg.content}}</p>
<div> <div slot="footer">
<Row> <Button type="primary" @click="modal1=false">取消</Button>
<Col :span="12"> </div>
发送时间:{{msg.time}} </Modal>
</Col> </span>
</Row>
<div class="content">
{{msg.content}}
</div>
</div>
</Modal>
</span>
</template> </template>
<script> <script>
import { mapState } from 'vuex'; import { mapState } from "vuex";
export default { export default {
name: 'iHeaderNotice', name: "iHeaderNotice",
data () { data() {
return { return {
badgeProps: { messageList: [],
offset: [20, 0] messageLoading: false,
}, badgeProps: {
modal:false, offset: [20, 0],
msg:{} },
} modal1: false,
}, msg: {},
computed: { };
...mapState('admin/layout', [ },
'isMobile' computed: {
]) // ...mapState("admin/layout", ["isMobile"]),
}, ...mapState({ messages: "messages" }),
mounted(){ unreadMessage() {
setInterval(()=>{ let unread = 0;
this.$store.dispatch("loadMessages"); this.messages.forEach((item) => {
},30*1000) if (!item.read) unread++;
} });
} return unread;
},
},
async fetch({ store, params }) {
await store.dispatch("loadMessages"); // 加载数据字典
},
mounted() {
// this.messageList = [...this.messages];
// console.log(this.messages);
},
methods: {
handleLoadMore(tab) {
this.loadMore(tab.name);
},
loadMore(type) {
if (this[`${type}Loading`]) return;
this[`${type}Loading`] = true;
setTimeout(() => {
this[`${type}List`] = this[`${type}List`].concat([
...this[`${type}BaseList`],
]);
this[`${type}Loading`] = false;
}, 1000);
},
handleClear(tab) {
this.$router.push("/home/msgRecord");
},
clickItem(item, i) {
this.modal1 = true;
this.msg = item;
item.iconColor = "#ccc";
item.msg = true;
let url = `${systemUrl}/usermessage/read`;
this.$api.post(url, item).then((r) => {
//消息转为已读
// this.msg = r.result;
setInterval(() => {
this.$store.dispatch("loadMessages");
}, 30 * 1000);
});
},
},
};
</script> </script>
<style lang="less">
.i-con .ivu-badge-count {
top: 0 !important;
}
.content-in {
height: 30px;
}
.con_bord {
.ivu-time {
color: #ccc;
}
h4 {
color: #ccc;
}
}
</style>
<template>
<div>
<DataGrid :columns="columns" ref="grid" :action="action" :conditions="easySearch">
<template slot="easySearch">
<Form ref="formInline" :model="easySearch" inline>
<FormItem prop="keys">
<Input placeholder="请输入消息标题" v-model="easySearch.keys.value" v-width="260" />
</FormItem>
<FormItem>
<Button type="primary" @click="search">查询</Button>
</FormItem>
</Form>
</template>
</DataGrid>
<Modal v-model="modal" :title="title" width="1200" footer-hide>
<component
:is="detail"
:eid="curId"
:cartList="this.$u.clone(this.$store.state.cart)"
@on-close="cancel"
@on-ok="ok"
/>
</Modal>
</div>
</template>
<script>
// import Api from "./api";
export default {
name: "Add",
data() {
return {
action: "", //Api.index1
easySearch: {
keys: { op: "serialNumber,customer", value: null },
},
detail: null,
dataList: [],
curId: 0,
modal: false,
title: "归还",
columns: [
{
type: "index",
width: 70,
align: "center",
},
{
title: "标题",
key: "serialNumber",
},
{
key: "creationTime",
title: "接受时间",
},
{
title: "接受人",
key: "libraryTube",
},
{
title: "发送人",
key: "customer",
},
{
title: "状态",
key: "status",
code: "resource.record.status",
},
// {
// title: this.l("action"),
// key: "action",
// width: 150,
// align: "center",
// render: (h, params) => {
// return h("div", { class: "action" }, [
// h(
// "a",
// {
// class: "details",
// on: { click: () => this.details(params.row.id) },
// },
// params.row.status == 0 ? "归还" : ""
// ),
// ]);
// },
// },
],
name: "",
resource: [],
selectList: [],
libraryTube: this.$store.state.userInfo.userName, //库管员
};
},
async fetch({ store, params }) {
await store.dispatch("loadDictionary"); // 加载数据字典
},
props: {},
mounted() {},
methods: {
details(id) {
this.curId = id;
// this.detail = () => import("./return");
this.modal = true;
},
handleClose() {
this.$emit("on-close");
},
selectInfo(value) {
this.selectList = [];
this.selectList = value;
},
l(key) {
let vkey = "resource" + "." + key;
return this.$t(vkey) || key;
},
search() {
this.$refs.grid.reload(this.easySearch);
},
ok() {
this.$refs.grid.load();
this.modal = false;
this.curId = 0;
},
cancel() {
this.curId = 0;
this.modal = false;
},
},
watch: {},
};
</script>
<style>
</style>
\ No newline at end of file
This diff is collapsed.
import createVuexAlong from 'vuex-along' import createVuexAlong from 'vuex-along'
import Api from '@/plugins/request' import Api from '@/plugins/request'
import Mock from 'mockjs' // import Mock from 'mockjs'
export const state = () => ({ export const state = () => ({
counter: 0, counter: 0,
dictionary: new Map(), //所有字典项 dictionary: new Map(), //所有字典项
...@@ -104,16 +104,22 @@ export const mutations = { ...@@ -104,16 +104,22 @@ export const mutations = {
export const actions = { export const actions = {
async loadMessages({commit}){ async loadMessages({commit}){
let data=Mock.mock({ let {
"result|1-30":[{ result
id:"@guid", } = await Api.get(`${systemUrl}/usermessage/getusermesssage`, {
title:"@csentence", status: 0
content:"@cparagraph(2,8)", });
read:"@boolean", commit("setMessages", result);
time:"@datetime" // let data=Mock.mock({
}] // "result|1-30":[{
}) // id:"@guid",
commit("setMessages", data.result); // title:"@csentence",
// content:"@cparagraph(2,8)",
// read:"@boolean",
// time:"@datetime"
// }]
// })
// commit("setMessages", data.result);
}, },
async collectList({ async collectList({
commit commit
...@@ -122,7 +128,7 @@ export const actions = { ...@@ -122,7 +128,7 @@ export const actions = {
let { let {
result result
} = await Api.post(`${systemUrl}/favorite/listbyuser`); } = await Api.post(`${systemUrl}/favorite/listbyuser`);
console.warn("result", result)
commit("setCollect", result); commit("setCollect", result);
}, },
async loadUser({ async loadUser({
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment