zouyu
2024-02-29 363678a54142e62fdd4ca39a0db5c54af1a704dc
src/views/quality/rawMaterial/index.vue
@@ -54,7 +54,7 @@
</template>
<script>
import ttable from '@/views/common/ztt-table.vue'
import { getRawInspectList,delObj,exportRawMaterial,getObj,downloadReport } from '@/api/quality/rawMaterial'
import { getRawInspectList,delObj,exportRawMaterial,getObj,downloadReport,checkPutIFS } from '@/api/quality/rawMaterial'
import RawMaterialForm from './rawMaterial-form'
import * as fecha from 'element-ui/lib/utils/date'
import { mapGetters } from 'vuex'
@@ -112,6 +112,18 @@
                        searchInfoType: 'select',
                        optList: () => {
                            return this.typeList
                        }
                    },
                    {
                        minWidth: '120',
                        prop: 'checkState',
                        label: '审核状态',
                        isTrue: true,
                        isSearch: true,
                        searchInfoType: 'select',
                        formatter: this.checkStateFormat,
                        optList: () => {
                            return this.checkStateList
                        }
                    },
                    {
@@ -237,6 +249,7 @@
            insStateList: [{label:'全部',value:''},{label:'已检测',value:'1'},{label:'未检测',value:'0'}],
            StateList: [{label:'全部',value:''},{label:'已合格',value:'1'},{label:'不合格',value:'0'}],
            typeList: [{label:'全部',value:''},{label:'首检',value:'首检'},{label:'返检',value:'返检'}],
            checkStateList: [{label:'未审核',value:'0'},{label:'审核通过',value:'1'},{label:'审核不通过',value:'2'}],
        }
    },
    components: {
@@ -262,13 +275,28 @@
            })
        }
        this.table.operator = [{
            text: '审核',
            type: 'text',
            size: 'small',
            fun: this.examineHandle,
            showFun: (row)=>{return row.type==='首检'},
            show: {
                key: 'checkState',
                val: ['0']
            }
        }]
        if(this.permissions.quality_rawMaterial_del){
            this.table.operator = [{
            this.table.operator.push({
                    text: '作废',
                    type: 'text',
                    size: 'small',
                    fun: this.deleteHandle
                }]
                    fun: this.deleteHandle,
                    show: {
                        key: 'judgeState',
                        val: ['',null]
                    }
                })
        }
     },
    computed: {
@@ -282,6 +310,29 @@
        }
    },
    methods:{
        examineHandle(val){
            this.$confirm('是否审核通过该检验项?', '提示', {
                distinguishCancelAndClose: true,
                confirmButtonText: '通过',
                cancelButtonText: '不通过',
                type: 'warning'
            }).then(() => {
                this.checkPutIFSFun(val.id,1);
            }).catch((action) => {
                if(action === 'cancel'){
                    this.checkPutIFSFun(val.id,2);
                }
            });
        },
        checkPutIFSFun(id,result){
            checkPutIFS(id, result).then(res=>{
                if(res.status===200){
                    this.getData()
                }
            }).catch(error=>{
                console.error(error)
            })
        },
        downloadReport(){
            let selection = this.multipleSelection
            if(!selection || selection.length < 1){
@@ -420,6 +471,14 @@
                return "<span style='color:#34BD66;'>合格</span>"
            }
        },
        checkStateFormat(row, column, cellValue){
            this.checkStateList.forEach((obj) => {
                if (obj.value === cellValue) {
                    cellValue = obj.label
                }
            })
            return cellValue
        },
        formatDateTime(row, column, cellValue) {
            return cellValue ? fecha.format(new Date(cellValue), 'yyyy-MM-dd') : ''
        },