王震
2024-01-25 36653c98622c8a74cb850575b2001457121b794c
src/views/quality/rawMaterial/index.vue
@@ -17,7 +17,7 @@
<template>
    <div class="mod-config">
        <basic-container>
            <ttable
            <ttable
            :table="table"
            :resultData="resultData"
            @handleSelectionChange="handleSelectionChange"
@@ -27,7 +27,7 @@
            @queryParam="getQueryParam($event)"
            ref="rawMaterialTable">
            <template #toolbar>
                <el-button @click="exportRawMaterial" type="primary" >导出</el-button>
                <!-- <el-button @click="exportRawMaterial" type="primary" >导出</el-button> -->
            </template>
            </ttable>
        </basic-container>
@@ -60,7 +60,7 @@
import { mapGetters } from 'vuex'
import PrintJS from 'print-js'
import { transformZip } from '@/util/fileTransform'
import printTemplate from './rawMaterial-print.vue'
import printTemplate from './rawMaterial-print'
  export default {
    data() {
        return {
@@ -214,38 +214,8 @@
                            }
                    },
                ],
                toolbar: [
                    {
                        text: '新增',
                        type: 'primary',
                        fun: this.addOrUpdateHandle
                    },
                    {
                        text: '下载检验报告',
                        type: 'primary',
                        fun: this.downloadReport
                    }
                ],
                operator: [
                //     {
                //     text: '打印',
                //     type: 'text',
                //     size: 'small',
                //     fun: this.previewFun,
                //     show: {
                //         val: [
                //             '1',
                //             '0'
                //         ],
                //         key: 'judgeState'
                //     }
                // },
                {
                    text: '作废',
                    type: 'text',
                    size: 'small',
                    fun: this.deleteHandle
                }],
                toolbar: [],
                operator: null,
                operatorConfig: {
                fixed: 'right',
                label: '操作',
@@ -262,7 +232,30 @@
        RawMaterialForm,
        printTemplate,
    },
    created() { },
    created() {
        if(this.permissions.quality_rawMaterial_add){
            this.table.toolbar.push({
                text: '新增',
                type: 'primary',
                fun: this.addOrUpdateHandle
            })
        }
        if(this.permissions.quality_rawMaterial_download){
            this.table.toolbar.push({
                text: '下载检验报告',
                type: 'primary',
                fun: this.downloadReport
            })
        }
        if(this.permissions.quality_rawMaterial_del){
            this.table.operator = [{
                    text: '作废',
                    type: 'text',
                    size: 'small',
                    fun: this.deleteHandle
                }]
        }
     },
    computed: {
        ...mapGetters(['permissions'])
    },
@@ -375,10 +368,16 @@
        },
        // 新增 / 修改
        addOrUpdateHandle(row) {
            if(!this.permissions.quality_rawMaterial_edit && row.id!=null){
                this.$message.error("该角色没有操作权限")
                return
            }
            this.$router.push({
                name: 'rawMaterialForm',
                query: {
                    id: row == null ? null : row.id,
                query: {
                    id: row == null ? null : row.id
                 },
                 params: {
                    resultVal: row == null ? null : row.judgeState
                 }
            })
@@ -392,7 +391,7 @@
            }
        },
        formatJudgeState(row, column, cellValue){
            if(cellValue != undefined || cellValue != null){
            if(cellValue != undefined && cellValue != null && cellValue != ''){
                if(cellValue == 0){
                    return "<span style='color:#E84738;'>不合格</span>"
                }
@@ -438,4 +437,3 @@
    }
  }
  </script>