1
HuBingJie
9 天以前 28110912ca4803e5793f181517d7bf2d7a5ea2ad
´úÂë¹ÜÀí/WCS/WCS/WIDESEAWCS_Client/src/extension/taskinfo/task.js
@@ -1,11 +1,13 @@
//此js文件是用来自定义扩展业务代码,可以扩展一些自定义页面或者重新配置生成的代码
import gridBody from './extend/taskExecuteDetail.vue'
import AbnormalFinishDialog from './extend/abnormalFinishDialog.vue'
import http from '../../api/http'
let extension = {
    components: {
        //查询界面扩展组件
        gridHeader: '',
        gridHeader: AbnormalFinishDialog,
        gridBody: gridBody,
        gridFooter: '',
        //新建、编辑弹出框扩展组件
@@ -18,6 +20,26 @@
    buttons: {
        view: [
            // ä»»åŠ¡å¼‚å¸¸å®Œæˆ
            {
                name: '任务异常完成',
                icon: 'el-icon-warning',
                type: 'danger',
                value: 'YCCG',
                onClick: function () {
                    const rows = this.getSelectRows();
                    if (rows.length !== 1) {
                        return this.$message.warning('请仅选择一条任务');
                    }
                    const taskNum = rows[0].taskNum;
                    // é€šè¿‡ gridHeader æ¸²æŸ“的弹窗组件 ref è°ƒç”¨ open
                    if (this.$refs.gridHeader && this.$refs.gridHeader.open) {
                        this.$refs.gridHeader.open(taskNum);
                    } else {
                        this.$message.error('对话框未就绪,请稍后重试');
                    }
                }
            },
            //手动完成按钮
            {
                name: '手动完成',
@@ -107,6 +129,98 @@
                        });
                    }
                }
            },
                      //任务异常排出
            {
                name: '任务异常排出',
                icon: 'el-icon-s-unfold',
                type: 'danger',
                value: 'YCPC',
                onClick: function (row) {
                    let rows = this.getSelectRows();
                    console.log('选中的数据行:', rows);
                    if (rows.length === 0 || rows.length > 1) {
                        return this.$message.warning('请选择一条数据');
                    }
                    if (rows.length === 1) {
                        let selectRow = rows;
                        let taskNum = selectRow[0].taskNum;
                        // console.log('任务ID列表:', Id);
                        // æ˜¾ç¤ºç¡®è®¤æ¡†ï¼Œè®©ç”¨æˆ·ç¡®è®¤æ˜¯å¦æ‰§è¡Œæ“ä½œ
                        this.$confirm('确定要异常排出吗?' + selectRow.map(item => item.taskNum) + '任务吗?', '操作确认', {
                            confirmButtonText: '确定',
                            cancelButtonText: '取消',
                            type: 'warning' // è­¦å‘Šç±»åž‹ï¼Œæ˜¾ç¤ºé»„色图标
                        }).then(() => {
                            // ç”¨æˆ·ç‚¹å‡»"确定"后执行的逻辑
                            http.post("api/RgvOperation/WriteInAbnormal", {"mainData":{"taskNum":taskNum}}, "数据处理中..."
                            ).then(res => {
                                if (res && res.status) {
                                    this.$message.success(res.message || '异常排出成功!');
                                    this.search();
                                } else {
                                    this.$message.error(res.message || '异常排出失败!');
                                }
                            })
                                .catch(() => {
                                    this.$message.error('请求失败,请稍后重试');
                                });
                        }).catch(() => {
                            // ç”¨æˆ·ç‚¹å‡»"取消"后执行的逻辑(通常是提示取消操作)
                            this.$message.info('已取消异常排出任务');
                        });
                    }
                }
            },
                        //继续任务
            {
                name: '继续任务',
                icon: 'el-icon-s-unfold',
                type: 'success',
                value: 'JXRW',
                onClick: function (row) {
                    let rows = this.getSelectRows();
                    console.log('选中的数据行:', rows);
                    if (rows.length === 0 || rows.length > 1) {
                        return this.$message.warning('请选择一条数据');
                    }
                    if (rows.length === 1) {
                        let selectRow = rows;
                        let taskNum = selectRow[0].taskNum;
                        // console.log('任务ID列表:', Id);
                        // æ˜¾ç¤ºç¡®è®¤æ¡†ï¼Œè®©ç”¨æˆ·ç¡®è®¤æ˜¯å¦æ‰§è¡Œæ“ä½œ
                        this.$confirm('确定要继续任务吗?' + selectRow.map(item => item.taskNum) + '任务吗?', '操作确认', {
                            confirmButtonText: '确定',
                            cancelButtonText: '取消',
                            type: 'warning' // è­¦å‘Šç±»åž‹ï¼Œæ˜¾ç¤ºé»„色图标
                        }).then(() => {
                            // ç”¨æˆ·ç‚¹å‡»"确定"后执行的逻辑
                            http.post("api/RgvOperation/WriteInNormal", {"mainData":{"taskNum":taskNum}}, "数据处理中..."
                            ).then(res => {
                                if (res && res.status) {
                                    this.$message.success(res.message || '继续任务成功!');
                                    this.search();
                                } else {
                                    this.$message.error(res.message || '继续任务失败!');
                                }
                            })
                                .catch(() => {
                                    this.$message.error('请求失败,请稍后重试');
                                });
                        }).catch(() => {
                            // ç”¨æˆ·ç‚¹å‡»"取消"后执行的逻辑(通常是提示取消操作)
                            this.$message.info('已取消继续任务任务');
                        });
                    }
                }
            }
        ], box: [], detail: []
    }, //扩展的按钮
@@ -152,8 +266,8 @@
                    
                }
            });
            this.maxBtnLength = 11;
            //this.boxOptions.labelWidth = 10000;
            this.maxBtnLength = 26;
            // this.boxOptions.labelWidth = 10000;
        },
        onInited() {
            //框架初始化配置后