马宇豪
2024-02-23 4cfbfd1b425f7b22b876ae6cae95c4fc29ae6bfb
src/views/warning/stock.vue
@@ -107,6 +107,7 @@
                </div>
            </div>
        </div>
        <br/>
        <div class="table_content">
            <el-table
                v-loading="listLoading"
@@ -234,6 +235,20 @@
                        <span>{{ scope.row.modifieddate | parseTime('{y}-{m}-{d}') }}</span>
                    </template>
                </el-table-column>
                <el-table-column
                    label="操作"
                    align="center"
                    width="100"
                    class-name="small-padding fixed-width"
                    v-if="isAdmin"
                ><template slot-scope="scope">
                    <el-button
                        type="text"
                        :disabled="scope.row.ismend == 1"
                        @click="markSolved(scope.row)"
                    >标记已处理</el-button>
                </template>
                </el-table-column>
            </el-table>
            <br>
            <el-pagination
@@ -255,7 +270,7 @@
<script>
    import { mapGetters } from 'vuex'
    import { getStockWarningList } from '@/api/warning'
    import { getStockWarningList, setSolved } from '@/api/warning'
    import { parseTime, computePageCount } from '@/utils'
    import { parseError } from '@/utils/messageDialog'
    import Cookies from 'js-cookie'
@@ -315,6 +330,7 @@
                    }
                ],
                dateRange: [],
                isAdmin: false,
                pickClear:false,
                pickerOptions: {
                    shortcuts: [{
@@ -367,6 +383,12 @@
            this.getProvince();
            this.getDictionaryEnterpriseType();
            this.getCertWarningList();
            const roles = JSON.parse(Cookies.get('roles'))
            if(roles.find(i=>i.name == '管理员'|| i.name == '监管部门')){
                this.isAdmin = true
            }else{
                this.isAdmin = false
            }
        },
        methods: {
            setDateRange(){
@@ -490,6 +512,30 @@
                this.currentPage = val
                this.getCertWarningList()
            },
            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.getCertWarningList()
                    }else{
                        this.$message({
                            type:'warning',
                            message:res.data.message
                        })
                    }
                }).catch(() => {
                    console.log('已取消')
                })
            },
            getBtnPermission(btnType) {
                return checkBtnPermission(this.userType, btnType)
            },