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
<template> <template>
<div class="h100"> <div class="h100">
<DataGrid :columns="columns" ref="grid" :action="action"><template slot="easySearch"><Form ref="formInline" :model="easySearch" inline><FormItem prop="keys"><Input placeholder="请输入关键字编码/名称" v-model="easySearch.keys.value" /> </FormItem> <DataGrid :columns="columns" ref="grid" :action="action">
<FormItem><Button type="primary" @click="search">查询</Button></FormItem> <template slot="easySearch">
</Form></template> <Form ref="formInline" :model="easySearch" inline>
<template slot="searchForm"> <FormItem prop="keys">
<Search /> <Input placeholder="请输入关键字编码/名称" v-model="easySearch.keys.value" />
</template> </FormItem>
<template slot="buttons"> <FormItem>
<Button type="primary" @click="add">新增</Button> <Button type="primary" @click="search">查询</Button>
</template> </FormItem>
</DataGrid> </Form>
<Modal v-model="modal" :title="title" width="800" footer-hide> </template>
<component :is="detail" :eid="curId" @on-close="cancel" @on-ok="ok" /> <template slot="searchForm">
</Modal> <Search />
</div> </template>
<template slot="buttons">
<Button type="primary" @click="add">新增</Button>
</template>
</DataGrid>
<Modal v-model="modal" :title="title" width="800" footer-hide>
<component :is="detail" :eid="curId" @on-close="cancel" @on-ok="ok" />
</Modal>
</div>
</template> </template>
<script> <script>
import Api from './api' import Api from "./api";
import Search from './search' import Search from "./search";
export default { export default {
name: 'list', name: "list",
components:{ components: {
Search Search,
}, },
head: { head: {
title: "物料编码规则", title: "物料编码规则",
author: "henq", author: "henq",
description: "coderule 6/4/2020 9:02:55 AM", description: "coderule 6/4/2020 9:02:55 AM",
}, },
data() { data() {
return { return {
action: Api.index, action: Api.index,
easySearch: { easySearch: {
keys:{op:"code,name",value:null} keys: { op: "code,name", value: null },
}, },
modal: false, modal: false,
title:"新增", title: "新增",
detail:null, detail: null,
curId: 0, curId: 0,
columns: [ columns: [
{ key:"id",title:this.$t("id") ,hide:true ,align:"left" ,high:true }, {
{ key:"creationTime",title:this.l("creationTime") ,hide:true ,align:"left" ,high:true }, key: "id",
{ key:"creatorUserId",title:this.l("creatorUserId") ,hide:true ,align:"left" ,high:true }, title: this.$t("id"),
{ key:"lastModificationTime",title:this.l("lastModificationTime") ,hide:true ,align:"left" ,high:true }, hide: true,
{ key:"lastModifierUserId",title:this.l("lastModifierUserId") ,hide:true ,align:"left" ,high:true }, align: "left",
{ key:"isDeleted",title:this.l("isDeleted") ,align:"left" ,hide:true ,high:true }, high: true,
{ key:"deletionTime",title:this.l("deletionTime") ,hide:true ,align:"left" ,high:true }, },
{ key:"deleterUserId",title:this.l("deleterUserId") ,hide:true ,align:"left" ,high:true }, {
{ key:"code",title:this.l("code") ,align:"left" ,easy:true ,high:true }, key: "creationTime",
{ key:"name",title:this.l("name") ,align:"left" ,easy:true ,high:true }, title: this.l("creationTime"),
{ key:"type",title:this.l("type") ,align:"center" ,high:true,code:"material.code.type" }, hide: true,
{ key:"status",title:this.l("status") ,align:"center" ,high:true,code:"material.code.status" }, align: "left",
{ key:"description",title:this.l("description") ,align:"center" ,high:true }, high: true,
{ key:"levelNum",title:this.l("levelNum") ,align:"center" ,high:true ,hide:true , }, },
{ key:"codeLength",title:this.l("codeLength") ,align:"center" ,high:true,hide:true , }, {
{ key:"materialCodeLength",title:this.l("materialCodeLength") ,align:"center" ,high:true,hide:true , }, key: "creatorUserId",
{ title: this.l("creatorUserId"),
title: '操作', hide: true,
key: 'action', align: "left",
width: 140, high: true,
align: 'center', },
render: (h, params) => { {
return h('div', { class: "action" }, [ key: "lastModificationTime",
h('op', { attrs: { oprate: 'detail' }, on: { click: () => this.view(params.row.id) } }, '查看'), title: this.l("lastModificationTime"),
//h('op', { attrs: { oprate: 'copy' }, on: { click: () => this.copy(params.row.id) } }, '克隆'), hide: true,
h('op', { attrs: { oprate: 'edit'}, on: { click: () => this.edit(params.row.id) } }, '编辑'), align: "left",
h('op', { attrs: { oprate: 'delete' }, on: { click: () => this.remove(params.row.id) } }, '删除') high: true,
]) },
} {
key: "lastModifierUserId",
title: this.l("lastModifierUserId"),
hide: true,
align: "left",
high: true,
},
{
key: "isDeleted",
title: this.l("isDeleted"),
align: "left",
hide: true,
high: true,
},
{
key: "deletionTime",
title: this.l("deletionTime"),
hide: true,
align: "left",
high: true,
},
{
key: "deleterUserId",
title: this.l("deleterUserId"),
hide: true,
align: "left",
high: true,
},
{
key: "code",
title: this.l("code"),
align: "left",
easy: true,
high: true,
},
{
key: "name",
title: this.l("name"),
align: "left",
easy: true,
high: true,
},
{
key: "type",
title: this.l("type"),
align: "center",
high: true,
code: "material.code.type",
},
{
key: "status",
title: this.l("status"),
align: "center",
high: true,
code: "material.code.status",
},
{
key: "description",
title: this.l("description"),
align: "center",
high: true,
},
{
key: "levelNum",
title: this.l("levelNum"),
align: "center",
high: true,
hide: true,
},
{
key: "codeLength",
title: this.l("codeLength"),
align: "center",
high: true,
hide: true,
},
{
key: "materialCodeLength",
title: this.l("materialCodeLength"),
align: "center",
high: true,
hide: true,
},
{
title: "操作",
key: "action",
width: 140,
align: "center",
render: (h, params) => {
return h("div", { class: "action" }, [
h(
"op",
{
attrs: { oprate: "detail" },
on: { click: () => this.view(params.row.id) },
},
"查看"
),
//h('op', { attrs: { oprate: 'copy' }, on: { click: () => this.copy(params.row.id) } }, '克隆'),
h(
"op",
{
attrs: { oprate: "edit" },
on: { click: () => this.edit(params.row.id) },
},
"编辑"
),
// h(
// "op",
// {
// attrs: { oprate: "delete" },
// on: { click: () => this.remove(params.row.id) },
// },
// "删除"
// ),
]);
}, },
] },
} ],
};
}, },
mounted(){ mounted() {
console.log(this); console.log(this);
}, },
async fetch({ store, params }) { async fetch({ store, params }) {
await store.dispatch('loadDictionary') // 加载数据字典 await store.dispatch("loadDictionary"); // 加载数据字典
}, },
methods:{ methods: {
ok() { ok() {
this.$refs.grid.load() this.$refs.grid.load();
this.modal = false this.modal = false;
this.curId = 0; this.curId = 0;
}, },
search() { search() {
this.$refs.grid.reload(this.easySearch) this.$refs.grid.reload(this.easySearch);
}, },
add() { add() {
this.curId = 0; this.curId = 0;
this.title = "新增"; this.title = "新增";
this.detail =()=> import('./add') this.detail = () => import("./add");
this.modal = true; this.modal = true;
}, },
copy(id) { copy(id) {
this.curId = id; this.curId = id;
this.title = "克隆"; this.title = "克隆";
this.detail = () =>import('./add') this.detail = () => import("./add");
this.modal = true; this.modal = true;
}, },
view(id) { view(id) {
this.curId = id; this.curId = id;
this.title = "详情"; this.title = "详情";
this.detail = () =>import('./detail') this.detail = () => import("./detail");
this.modal = true; this.modal = true;
}, },
edit(id) { edit(id) {
this.curId = id; this.curId = id;
this.title = "编辑"; this.title = "编辑";
this.detail = () => import('./edit') this.detail = () => import("./edit");
this.modal = true; this.modal = true;
}, },
remove(id) { remove(id) {
Api.delete(id).then((r) => { Api.delete(id).then((r) => {
if (r.success) { if (r.success) {
this.$refs.grid.load(); this.$refs.grid.load();
this.$Message.success('删除成功') this.$Message.success("删除成功");
} }
}) });
}, },
cancel() { cancel() {
this.curId = 0; this.curId = 0;
this.modal = false this.modal = false;
}, },
l(key) { l(key) {
/* /*
coderule:{ coderule:{
creationTime:'创建时间', creationTime:'创建时间',
creatorUserId:'创建人', creatorUserId:'创建人',
...@@ -142,11 +266,11 @@ keys:{op:"code,name",value:null} ...@@ -142,11 +266,11 @@ keys:{op:"code,name",value:null}
codelength:'编码分类位数', codelength:'编码分类位数',
} }
*/ */
let vkey = "coderule" + "." + key; let vkey = "coderule" + "." + key;
return this.$t(vkey)||key return this.$t(vkey) || key;
} },
} },
} };
</script> </script>
<style lang="less"> <style lang="less">
</style> </style>
\ No newline at end of file
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