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

消息ok

parent 59b0c802
<template>
<span class="i-layout-header-trigger i-layout-header-trigger-min i-layout-header-trigger-in">
<Notification
:wide="isMobile"
:badge-props="badgeProps"
class="i-layout-header-notice"
:class="{ 'i-layout-header-notice-mobile': isMobile }">
<Icon slot="icon" custom="i-icon i-icon-notification" />
<NotificationTab title="消息">
fdsafafafsafafd
</NotificationTab>
<!-- <NotificationTab title="待办">
<span
class="i-layout-header-trigger i-layout-header-trigger-min i-layout-header-trigger-in i-con"
>
<Notification auto-count @on-load-more="handleLoadMore" @on-clear="handleClear">
<NotificationTab title="通知" name="message" :count="unreadMessage" :loading="messageLoading">
<NotificationItem
v-for="(item, index) in messages"
:key="index"
:class="item.msg?'con_bord':''"
:title="item.title"
:icon="item.icon||'md-mail'"
:icon-color="item.iconColor||'#2680eb'"
:time="item.creationTime"
@click.native="clickItem(item,index)"
/>
<!-- :read="item.content" -->
<div slot="clear">历史消息</div>
</NotificationTab>
<NotificationTab title="通知">
</NotificationTab> -->
</Notification>
<Modal
v-model="modal"
title="msg.title"
>
<div>
<Row>
<Col :span="12">
发送时间:{{msg.time}}
</Col>
</Row>
<div class="content">
{{msg.content}}
</div>
</div>
<Modal v-model="modal1" :title="msg.title">
<p class="content-in">发送时间:{{msg.creationTime}}</p>
<p class="content-in">{{msg.content}}</p>
<div slot="footer">
<Button type="primary" @click="modal1=false">取消</Button>
</div>
</Modal>
</span>
</template>
<script>
import { mapState } from 'vuex';
import { mapState } from "vuex";
export default {
name: 'iHeaderNotice',
data () {
export default {
name: "iHeaderNotice",
data() {
return {
messageList: [],
messageLoading: false,
badgeProps: {
offset: [20, 0]
offset: [20, 0],
},
modal:false,
msg:{}
}
modal1: false,
msg: {},
};
},
computed: {
...mapState('admin/layout', [
'isMobile'
])
// ...mapState("admin/layout", ["isMobile"]),
...mapState({ messages: "messages" }),
unreadMessage() {
let unread = 0;
this.messages.forEach((item) => {
if (!item.read) unread++;
});
return unread;
},
},
mounted(){
setInterval(()=>{
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)
}, 30 * 1000);
});
},
},
};
</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;
}
</script>
}
</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>
<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>
<FormItem><Button type="primary" @click="search">查询</Button></FormItem>
</Form></template>
<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>
<FormItem>
<Button type="primary" @click="search">查询</Button>
</FormItem>
</Form>
</template>
<template slot="searchForm">
<Search />
</template>
......@@ -16,112 +24,228 @@
</div>
</template>
<script>
import Api from './api'
import Search from './search'
import Api from "./api";
import Search from "./search";
export default {
name: 'list',
components:{
Search
name: "list",
components: {
Search,
},
head: {
title: "物料编码规则",
author: "henq",
description: "coderule 6/4/2020 9:02:55 AM",
},
},
data() {
return {
action: Api.index,
easySearch: {
keys:{op:"code,name",value:null}
},
keys: { op: "code,name", value: null },
},
modal: false,
title:"新增",
detail:null,
title: "新增",
detail: null,
curId: 0,
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:"creatorUserId",title:this.l("creatorUserId") ,hide:true ,align:"left" ,high:true },
{ key:"lastModificationTime",title:this.l("lastModificationTime") ,hide:true ,align:"left" ,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',
{
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: "creatorUserId",
title: this.l("creatorUserId"),
hide: true,
align: "left",
high: true,
},
{
key: "lastModificationTime",
title: this.l("lastModificationTime"),
hide: true,
align: "left",
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',
align: "center",
render: (h, params) => {
return h('div', { class: "action" }, [
h('op', { attrs: { oprate: 'detail' }, on: { click: () => this.view(params.row.id) } }, '查看'),
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) } }, '删除')
])
}
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);
},
async fetch({ store, params }) {
await store.dispatch('loadDictionary') // 加载数据字典
await store.dispatch("loadDictionary"); // 加载数据字典
},
methods:{
methods: {
ok() {
this.$refs.grid.load()
this.modal = false
this.$refs.grid.load();
this.modal = false;
this.curId = 0;
},
search() {
this.$refs.grid.reload(this.easySearch)
this.$refs.grid.reload(this.easySearch);
},
add() {
this.curId = 0;
this.title = "新增";
this.detail =()=> import('./add')
this.detail = () => import("./add");
this.modal = true;
},
copy(id) {
this.curId = id;
this.title = "克隆";
this.detail = () =>import('./add')
this.detail = () => import("./add");
this.modal = true;
},
view(id) {
this.curId = id;
this.title = "详情";
this.detail = () =>import('./detail')
this.detail = () => import("./detail");
this.modal = true;
},
edit(id) {
this.curId = id;
this.title = "编辑";
this.detail = () => import('./edit')
this.detail = () => import("./edit");
this.modal = true;
},
remove(id) {
Api.delete(id).then((r) => {
if (r.success) {
this.$refs.grid.load();
this.$Message.success('删除成功')
this.$Message.success("删除成功");
}
})
});
},
cancel() {
this.curId = 0;
this.modal = false
this.modal = false;
},
l(key) {
/*
......@@ -143,10 +267,10 @@ keys:{op:"code,name",value:null}
}
*/
let vkey = "coderule" + "." + key;
return this.$t(vkey)||key
}
}
}
return this.$t(vkey) || key;
},
},
};
</script>
<style lang="less">
</style>
\ No newline at end of file
import createVuexAlong from 'vuex-along'
import Api from '@/plugins/request'
import Mock from 'mockjs'
// import Mock from 'mockjs'
export const state = () => ({
counter: 0,
dictionary: new Map(), //所有字典项
......@@ -104,16 +104,22 @@ export const mutations = {
export const actions = {
async loadMessages({commit}){
let data=Mock.mock({
"result|1-30":[{
id:"@guid",
title:"@csentence",
content:"@cparagraph(2,8)",
read:"@boolean",
time:"@datetime"
}]
})
commit("setMessages", data.result);
let {
result
} = await Api.get(`${systemUrl}/usermessage/getusermesssage`, {
status: 0
});
commit("setMessages", result);
// let data=Mock.mock({
// "result|1-30":[{
// id:"@guid",
// title:"@csentence",
// content:"@cparagraph(2,8)",
// read:"@boolean",
// time:"@datetime"
// }]
// })
// commit("setMessages", data.result);
},
async collectList({
commit
......@@ -122,7 +128,7 @@ export const actions = {
let {
result
} = await Api.post(`${systemUrl}/favorite/listbyuser`);
console.warn("result", result)
commit("setCollect", result);
},
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