消息添加一键已读功能

质检入库添加批量审核功能
This commit is contained in:
DESKTOP-8FGKA8Q\chunfen 2024-12-16 16:05:25 +08:00
parent baa5c435b5
commit f88ae50f45
3 changed files with 87 additions and 7 deletions

View File

@ -60,3 +60,11 @@ export function messageRead(id, data) {
data data
}) })
} }
export function messageReadAll(data) {
return http({
url: `/api/website_message/batchRead`,
method: "post",
data: data
})
}

View File

@ -81,6 +81,9 @@
</div> </div>
<div class="bottom"> <div class="bottom">
<div>
<el-button v-if="curTopTab == '0'" icon="el-icon-finished" :disabled="msgList.length ? false : true" @click="markHasRead()">标记全部已读</el-button>
</div>
<el-pagination <el-pagination
:current-page="page" :current-page="page"
:page-sizes="[10, 20, 50, 100]" :page-sizes="[10, 20, 50, 100]"
@ -99,7 +102,7 @@
<script> <script>
import { removeToken } from "@/util/auth" import { removeToken } from "@/util/auth"
import { getMenu } from "../api/menu.js" import { getMenu } from "../api/menu.js"
import { websiteMessage, messageRead } from "../api/user.js" import { websiteMessage, messageRead, messageReadAll } from "../api/user.js"
export default { export default {
mounted() { mounted() {
@ -242,6 +245,17 @@ export default {
this.page = 1 this.page = 1
this.pageSize = e this.pageSize = e
this.getMsgList() this.getMsgList()
},
markHasRead() {
let ids = []
this.msgList.forEach(it => {
ids.push(it.id)
})
messageReadAll({ids: ids}).then((res) => {
this.page = 1
this.getMsgList()
this.getNoReadNum()
})
} }
} }
} }
@ -429,7 +443,7 @@ export default {
.bottom{ .bottom{
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: space-between;
padding: 20px 0; padding: 20px 0;
border-top: 1px solid #D7D7D7; border-top: 1px solid #D7D7D7;
} }

View File

@ -23,6 +23,19 @@
@change="handleSearch()"> @change="handleSearch()">
</el-date-picker> </el-date-picker>
</div> </div>
<div class="row">
<span>采购时间</span>
<el-date-picker
v-model="buyTime"
type="datetimerange"
range-separator="-"
start-placeholder="开始时间"
end-placeholder="结束时间"
value-format="yyyy-MM-dd HH:mm:ss"
style="width: 340px"
@change="handleSearch()">
</el-date-picker>
</div>
<div class="row"> <div class="row">
<span>审核状态</span> <span>审核状态</span>
<el-select v-model="filter.status" placeholder="请选择" clearable @change="handleSearch()"> <el-select v-model="filter.status" placeholder="请选择" clearable @change="handleSearch()">
@ -35,8 +48,14 @@
</div> </div>
</div> </div>
</div> </div>
<el-card> <el-card>
<el-table v-loading="loading" :data="procureList" style="width: 100%" border> <div class="opaBox">
<el-button type="primary" :disabled="chooseList.length ? false : true" icon="el-icon-s-check" @click="batchExamine">批量审核</el-button>
</div>
<el-table v-loading="loading" :data="procureList" style="width: 100%" border ref="cesTable" @selection-change="handleSelectionChange">
<el-table-column type="selection" align="center" width="50" :selectable="selectable"></el-table-column>
<el-table-column prop="goods_sku.id" label="商品id" width="80" align="center" /> <el-table-column prop="goods_sku.id" label="商品id" width="80" align="center" />
<el-table-column prop="goods_sku.name" label="商品名称" /> <el-table-column prop="goods_sku.name" label="商品名称" />
<el-table-column prop="external_sku_id" label="商品编码" /> <el-table-column prop="external_sku_id" label="商品编码" />
@ -79,7 +98,7 @@
<el-dialog title="审核" :visible.sync="dialogVisible" width="500px"> <el-dialog title="审核" :visible.sync="dialogVisible" width="500px">
<el-form label-width="90px"> <el-form label-width="90px">
<el-form-item label="采购数量:"> <el-form-item label="采购数量:" v-if="opaType == 'normal'">
<el-input v-model="curInfo.num" type="number" clearable></el-input> <el-input v-model="curInfo.num" type="number" clearable></el-input>
</el-form-item> </el-form-item>
<el-form-item label="审核状态:"> <el-form-item label="审核状态:">
@ -109,12 +128,14 @@ export default {
pageSize: 15, pageSize: 15,
total: 0, total: 0,
procureList: [], procureList: [],
chooseList: [],
filter: { filter: {
title: '', title: '',
external_sku_id: '', external_sku_id: '',
status: '' status: ''
}, },
addTime: [], addTime: [],
buyTime: [],
curInfo: {}, curInfo: {},
commitloading: false, commitloading: false,
dialogVisible: false, dialogVisible: false,
@ -122,7 +143,8 @@ export default {
{ id: 0, name: '待审核' }, { id: 0, name: '待审核' },
{ id: 1, name: '审核通过' }, { id: 1, name: '审核通过' },
{ id: 2, name: '审核不通过' } { id: 2, name: '审核不通过' }
] ],
opaType: ''
} }
}, },
methods: { methods: {
@ -133,7 +155,9 @@ export default {
per_page: this.pageSize, per_page: this.pageSize,
...this.filter, ...this.filter,
start_time: this.addTime ? this.addTime[0] : '', start_time: this.addTime ? this.addTime[0] : '',
end_time: this.addTime ? this.addTime[1] : '' end_time: this.addTime ? this.addTime[1] : '',
date_start_time: this.buyTime ? this.buyTime[0] : '',
date_end_time: this.buyTime ? this.buyTime[1] : ''
} }
getPurchaseLog(params).then((res) => { getPurchaseLog(params).then((res) => {
this.procureList = res.data.data this.procureList = res.data.data
@ -158,6 +182,7 @@ export default {
}, },
toExamine(row) { toExamine(row) {
this.curInfo = JSON.parse(JSON.stringify(row)) this.curInfo = JSON.parse(JSON.stringify(row))
this.opaType = 'normal'
this.dialogVisible = true this.dialogVisible = true
}, },
commitCheck() { commitCheck() {
@ -167,13 +192,26 @@ export default {
} }
this.commitloading = true this.commitloading = true
let params = { let params = {
purchaseOrders: [{ purchaseOrders: []
}
if(this.opaType == 'normal') {
params.purchaseOrders = [{
id: this.curInfo.id, id: this.curInfo.id,
status: this.curInfo.status, status: this.curInfo.status,
num: this.curInfo.num num: this.curInfo.num
}] }]
} else {
for (let index = 0; index < this.chooseList.length; index++) {
params.purchaseOrders.push({
id: this.chooseList[index].id,
status: this.curInfo.status,
num: this.chooseList[index].num
})
}
} }
examinePurchase(params).then((res) => { examinePurchase(params).then((res) => {
this.chooseList = []
this.$refs.cesTable.clearSelection()
this.$message({ type: "success", message: "操作成功!" }) this.$message({ type: "success", message: "操作成功!" })
this.commitloading = false this.commitloading = false
this.dialogVisible = false this.dialogVisible = false
@ -181,6 +219,23 @@ export default {
}).catch(() => { }).catch(() => {
this.commitloading = false this.commitloading = false
}) })
},
batchExamine() {
this.curInfo = {
status: 0
}
this.opaType = 'batch'
this.dialogVisible = true
},
handleSelectionChange(val) {
this.chooseList = val
},
selectable(row, index) {
if (row.status == 1) {
return false;
} else {
return true;
}
} }
}, },
mounted() { mounted() {
@ -226,4 +281,7 @@ export default {
cursor: pointer; cursor: pointer;
width: fit-content; width: fit-content;
} }
.opaBox{
margin-bottom: 15px;
}
</style> </style>