|
|
|
|
@ -15,22 +15,25 @@ |
|
|
|
|
@selection-change="selectionChange" |
|
|
|
|
@on-load="onLoad" |
|
|
|
|
> |
|
|
|
|
<template #status="{row}"> |
|
|
|
|
<el-tag v-if="row.status === 1" type="info">已读</el-tag> |
|
|
|
|
<el-tag v-if="row.status === 2" type="success">未读</el-tag> |
|
|
|
|
</template> |
|
|
|
|
<template #menu-left> |
|
|
|
|
<el-button type="primary" @click="handleRead">标记已读</el-button> |
|
|
|
|
</template> |
|
|
|
|
<template #content="{row}"> |
|
|
|
|
<span @click="hanleView(row)" style="color:#284c89;cursor:pointer">{{row.content}}</span> |
|
|
|
|
</template> |
|
|
|
|
<template #status="{ row }"> |
|
|
|
|
<el-tag v-if="row.status === 1" type="info">已读</el-tag> |
|
|
|
|
<el-tag v-if="row.status === 0" type="success">未读</el-tag> |
|
|
|
|
</template> |
|
|
|
|
<template #menu-left> |
|
|
|
|
<el-button type="primary" @click="handleRead">标记已读</el-button> |
|
|
|
|
</template> |
|
|
|
|
<template #content="{ row }"> |
|
|
|
|
<span @click="hanleView(row)" style="color: #284c89; cursor: pointer">{{ |
|
|
|
|
row.content |
|
|
|
|
}}</span> |
|
|
|
|
</template> |
|
|
|
|
</avue-crud> |
|
|
|
|
</basic-container> |
|
|
|
|
</template> |
|
|
|
|
|
|
|
|
|
<script> |
|
|
|
|
import { getList} from '@/api/desk/myMessage'; |
|
|
|
|
import { getList, update } from '@/api/desk/myMessage'; |
|
|
|
|
import EventBus from '@/utils/event-bus'; |
|
|
|
|
export default { |
|
|
|
|
data() { |
|
|
|
|
return { |
|
|
|
|
@ -46,8 +49,8 @@ export default { |
|
|
|
|
option: { |
|
|
|
|
columnSort: true, |
|
|
|
|
tip: false, |
|
|
|
|
height: "auto", |
|
|
|
|
align: "center", |
|
|
|
|
height: 'auto', |
|
|
|
|
align: 'center', |
|
|
|
|
calcHeight: 32, |
|
|
|
|
simplePage: false, |
|
|
|
|
searchShow: true, |
|
|
|
|
@ -61,9 +64,9 @@ export default { |
|
|
|
|
viewBtn: false, |
|
|
|
|
delBtn: true, |
|
|
|
|
editBtn: true, |
|
|
|
|
editBtnText: "修改", |
|
|
|
|
editBtnIcon: " ", |
|
|
|
|
delBtnIcon: " ", |
|
|
|
|
editBtnText: '修改', |
|
|
|
|
editBtnIcon: ' ', |
|
|
|
|
delBtnIcon: ' ', |
|
|
|
|
addBtn: false, |
|
|
|
|
labelWidth: 120, |
|
|
|
|
searchLabelWidth: 120, |
|
|
|
|
@ -76,18 +79,18 @@ export default { |
|
|
|
|
gridBtn: false, |
|
|
|
|
searchShowBtn: false, |
|
|
|
|
showOverflowTooltip: true, |
|
|
|
|
searchLabelPosition: "left", |
|
|
|
|
searchLabelPosition: "left", |
|
|
|
|
searchLabelPosition: 'left', |
|
|
|
|
searchLabelPosition: 'left', |
|
|
|
|
searchGutter: 24, |
|
|
|
|
searchSpan: 6, |
|
|
|
|
menuAlign: "left", |
|
|
|
|
menuAlign: 'left', |
|
|
|
|
gridBtn: false, |
|
|
|
|
searchMenuPosition: "right", |
|
|
|
|
addBtnIcon: " ", |
|
|
|
|
viewBtnIcon: " ", |
|
|
|
|
delBtnIcon: " ", |
|
|
|
|
editBtnIcon: " ", |
|
|
|
|
menu:false, |
|
|
|
|
searchMenuPosition: 'right', |
|
|
|
|
addBtnIcon: ' ', |
|
|
|
|
viewBtnIcon: ' ', |
|
|
|
|
delBtnIcon: ' ', |
|
|
|
|
editBtnIcon: ' ', |
|
|
|
|
menu: false, |
|
|
|
|
|
|
|
|
|
column: [ |
|
|
|
|
{ |
|
|
|
|
@ -112,10 +115,9 @@ export default { |
|
|
|
|
searchLabelWidth: 90, |
|
|
|
|
display:false, |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
{ |
|
|
|
|
label: '消息类型', |
|
|
|
|
prop: 'type', |
|
|
|
|
prop: 'bizType', |
|
|
|
|
sortable: false, |
|
|
|
|
type: 'select', |
|
|
|
|
filter: true, |
|
|
|
|
@ -140,7 +142,7 @@ export default { |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
label: '未读', |
|
|
|
|
value: '2', |
|
|
|
|
value: '0', |
|
|
|
|
}, |
|
|
|
|
], |
|
|
|
|
filter: true, |
|
|
|
|
@ -152,8 +154,8 @@ export default { |
|
|
|
|
label: '发送时间', |
|
|
|
|
prop: 'approvalTime', |
|
|
|
|
type: 'date', |
|
|
|
|
format:"YYYY-MM-DD", |
|
|
|
|
valueFormat:"YYYY-MM-DD", |
|
|
|
|
format: 'YYYY-MM-DD', |
|
|
|
|
valueFormat: 'YYYY-MM-DD', |
|
|
|
|
searchRange:true, |
|
|
|
|
sortable: false, |
|
|
|
|
filter: true, |
|
|
|
|
@ -179,19 +181,32 @@ export default { |
|
|
|
|
data: [], |
|
|
|
|
}; |
|
|
|
|
}, |
|
|
|
|
computed: { |
|
|
|
|
ids() { |
|
|
|
|
let ids = []; |
|
|
|
|
this.selectionList.forEach(ele => { |
|
|
|
|
ids.push(ele.id); |
|
|
|
|
}); |
|
|
|
|
return ids.join(','); |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
created() { |
|
|
|
|
this.onLoad(this.page); |
|
|
|
|
}, |
|
|
|
|
methods: { |
|
|
|
|
searchReset() { |
|
|
|
|
this.query = {}; |
|
|
|
|
this.onLoad(this.page); |
|
|
|
|
}, |
|
|
|
|
searchChange(params, done) { |
|
|
|
|
console.log('搜索参数:', params); |
|
|
|
|
this.query = params; |
|
|
|
|
this.page.currentPage = 1; |
|
|
|
|
this.onLoad(); |
|
|
|
|
this.onLoad(this.page); |
|
|
|
|
done(); |
|
|
|
|
}, |
|
|
|
|
selectionChange(list){ |
|
|
|
|
this.selectionList = list; |
|
|
|
|
selectionChange(list) { |
|
|
|
|
this.selectionList = list; |
|
|
|
|
}, |
|
|
|
|
currentChange(currentPage) { |
|
|
|
|
this.page.currentPage = currentPage; |
|
|
|
|
@ -202,69 +217,47 @@ export default { |
|
|
|
|
refreshChange() { |
|
|
|
|
this.onLoad(); |
|
|
|
|
}, |
|
|
|
|
hanleView(row){ |
|
|
|
|
this.$refs.crud.rowView(row) |
|
|
|
|
hanleView(row) { |
|
|
|
|
this.$refs.crud.rowView(row); |
|
|
|
|
}, |
|
|
|
|
handleRead(){ |
|
|
|
|
if(this.selectionList.length == 0){ |
|
|
|
|
this.$message.error('请至少选择一条数据!'); |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
let tmp = this.selectionList.find(item => item.status == 1) |
|
|
|
|
if(tmp){ |
|
|
|
|
this.$message.error('请选择状态为【未读】的数据!') |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
handleRead() { |
|
|
|
|
if (this.selectionList.length == 0) { |
|
|
|
|
this.$message.error('请至少选择一条数据!'); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
let tmp = this.selectionList.find(item => item.status == 1); |
|
|
|
|
console.log(tmp, '111'); |
|
|
|
|
if (tmp) { |
|
|
|
|
this.$message.error('请选择状态为【未读】的数据!'); |
|
|
|
|
return; |
|
|
|
|
} else { |
|
|
|
|
console.log(this.ids); |
|
|
|
|
this.$confirm('确定将选择消息标记为已读?', { |
|
|
|
|
confirmButtonText: '确定', |
|
|
|
|
cancelButtonText: '取消', |
|
|
|
|
type: 'warning', |
|
|
|
|
}).then(() => { |
|
|
|
|
update(this.ids).then(() => { |
|
|
|
|
this.$message.success('操作成功!'); |
|
|
|
|
this.onLoad(this.page); |
|
|
|
|
// 触发事件,通知顶部导航栏更新未读数量 |
|
|
|
|
console.log('触发消息已读事件'); |
|
|
|
|
EventBus.$emit('message-read'); |
|
|
|
|
|
|
|
|
|
// 备用方案:直接更新 localStorage 通知 |
|
|
|
|
localStorage.setItem('message-read-timestamp', Date.now()); |
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
onLoad(page, params = {}) { |
|
|
|
|
|
|
|
|
|
onLoad(page, params = {}) { |
|
|
|
|
getList(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => { |
|
|
|
|
console.log(res,'00000001'); |
|
|
|
|
|
|
|
|
|
const data = res.data.data; |
|
|
|
|
this.page.total = data.total; |
|
|
|
|
this.data = data.records; |
|
|
|
|
this.loading = false; |
|
|
|
|
|
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
// onLoad(page, params = {}) { |
|
|
|
|
// this.loading = true; |
|
|
|
|
// this.data = [ |
|
|
|
|
// { |
|
|
|
|
// id: 1, |
|
|
|
|
// type: 1, |
|
|
|
|
// title: '请审核张三提交的外协审批流程', |
|
|
|
|
// content:"审批信息审批信息审批信息审批信息审批信息审批信息审批信息审批信息审批信息审批信息", |
|
|
|
|
// createUser: '张三', |
|
|
|
|
// status:1, |
|
|
|
|
// approvalTime:"2026-01-18 22:15:30", |
|
|
|
|
// createTime: '2026-01-05 09:06:32', |
|
|
|
|
// }, |
|
|
|
|
// { |
|
|
|
|
// id: 2, |
|
|
|
|
// type: 2, |
|
|
|
|
// title: '请审核李四提交的仓管审批流程', |
|
|
|
|
// content:"审批信息审批信息审批信息审批信息审批信息审批信息审批信息审批信息审批信息审批信息", |
|
|
|
|
// createUser: '张三', |
|
|
|
|
// status:1, |
|
|
|
|
// approvalTime:"2026-01-18 22:15:30", |
|
|
|
|
// createTime: '2026-01-12 09:06:32', |
|
|
|
|
// }, |
|
|
|
|
// { |
|
|
|
|
// id: 3, |
|
|
|
|
// type: 1, |
|
|
|
|
// title: '请审核王五提交的槽液审批流程', |
|
|
|
|
// content:"审批信息审批信息审批信息审批信息审批信息审批信息审批信息审批信息审批信息审批信息", |
|
|
|
|
// createUser: '张三', |
|
|
|
|
// status:2, |
|
|
|
|
// approvalTime:"2026-01-18 22:15:30", |
|
|
|
|
// createTime: '2026-01-15 09:06:32', |
|
|
|
|
// }, |
|
|
|
|
// ]; |
|
|
|
|
// this.page.total = this.data.length; |
|
|
|
|
// this.loading = false; |
|
|
|
|
// }, |
|
|
|
|
}, |
|
|
|
|
}; |
|
|
|
|
</script> |
|
|
|
|
|