马宇豪
2024-02-23 4cfbfd1b425f7b22b876ae6cae95c4fc29ae6bfb
src/views/warning/purchase.vue
@@ -39,6 +39,7 @@
                @click="queryHandle"
            />
        </div>
        <br/>
        <div class="table_content">
            <el-table
                v-loading="listLoading"
@@ -166,6 +167,12 @@
                        type="text"
                        @click="showDetailHandle(scope.row)"
                    >购买明细</el-button>
                    <el-button
                        v-if="isAdmin"
                        :disabled="scope.row.ismend == 1"
                        type="text"
                        @click="markSolved(scope.row)"
                    >标记已处理</el-button>
                </template>
                </el-table-column>
            </el-table>
@@ -245,7 +252,7 @@
<script>
    import { mapGetters } from 'vuex'
    import { getPurchaseWarningList, getPurchaseDetailList } from '@/api/warning'
    import { getPurchaseWarningList, getPurchaseDetailList, setSolved } from '@/api/warning'
    import { parseTime, computePageCount } from '@/utils'
    import { parseError } from '@/utils/messageDialog'
    import Cookies from 'js-cookie'
@@ -280,6 +287,7 @@
                tableKey: 0,
                stockWarningData: null,
                listLoading: true,
                isAdmin: false,
                queryForm: {
                    warnlevel: '',
                    customer:'',
@@ -356,6 +364,12 @@
        created() {
            this.setDateRange();
            this.getPurchaseWarningList()
            const roles = JSON.parse(Cookies.get('roles'))
            if(roles.find(i=>i.name == '管理员'|| i.name == '监管部门')){
                this.isAdmin = true
            }else{
                this.isAdmin = false
            }
        },
        methods: {
            setDateRange(){
@@ -479,6 +493,29 @@
                this.detailCurrentPage = 1
                this.getEntryDetailInfoList()
            },
            markSolved(row){
                MessageBox.confirm('确定将该数据标记为已处理', '标记已处理', {
                    confirmButtonText: '确定',
                    cancelButtonText: '取消',
                    type: 'warning'
                }).then(async () => {
                    const res = await setSolved({id: row.id})
                    if(res.data.code === "200"){
                        this.$message({
                            type:'success',
                            message: '标记成功'
                        })
                        this.getPurchaseWarningList()
                    }else{
                        this.$message({
                            type:'warning',
                            message:res.data.message
                        })
                    }
                }).catch(() => {
                    console.log('已取消')
                })
            },
            handleDetailSizeChange: function(val) {
                this.detailPageSize = val
                this.detailCurrentPage = 1