111
chenyong
2026-03-06 9051d96029c8e860c6e6657b7df2106bfbfdc010
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
//此js文件是用来自定义扩展业务代码,可以扩展一些自定义页面或者重新配置生成的代码
 
let extension = {
    components: {
        //查询界面扩展组件
        gridHeader: '',
        gridBody: '',
        gridFooter: '',
        //新建、编辑弹出框扩展组件
        modelHeader: '',
        modelBody: '',
        modelFooter: ''
    },
    tableAction: '', //指定某张表的权限(这里填写表名,默认不用填写)
    buttons: { view: [], box: [], detail: [] }, //扩展的按钮
    methods: {
        //下面这些方法可以保留也可以删除
        onInit() {
            let TaskHandCancelBtn = this.buttons.find(x => x.value == 'TaskHandCancel');
            if (TaskHandCancelBtn) {
                TaskHandCancelBtn.onClick = function() {
                    this.$message.success('自定义按钮点击事件');
                }
            }
            let TaskHandCompletedBtn = this.buttons.find(x => x.value == 'TaskHandCompleted');
            if (TaskHandCompletedBtn) {
                TaskHandCompletedBtn.onClick = function() {
                    let rows = this.$refs.table.getSelected();
                    if (rows.length == 0) return this.$error("请选择数据!");
                    this.$confirm(`是否确定要手动完成,${rows[0].taskNum}任务!`, "提示", {
                        // iconClass:"el-icon-success",//el-icon-remove自定义图标样式
                        confirmButtonText: "确认", //确认按钮文字更换
                        cancelButtonText: "取消", //取消按钮文字更换
                        // cancelBtn:"取消",//取消按钮文字更换
                        showClose: true, //是否显示右上角关闭按钮
                        type: "warning", //提示类型 success:成功/info:信息/warning:警告/error:报错
                    }).then(() => {
                        var param = rows[0].palletCode;
                        let data = {
                            BusinessId: "1",
                            TaskId: 1,
                            PalletCode: param
                        }
                        this.http
                            .post("v1/pallet/rmsPalletTask/mockComplete", data)
                            .then((x) => {
                                if (x.status) {
                                    this.$Message.success('任务手动完成成功.');
                                    this.refresh();
                                } else {
                                    return this.$error(x.message);
                                }
                            });
                    })
 
                }
            }
            //自定义手动发送任务信息按钮
            let Manualtasksendingbutton = this.buttons.find(x => x.value == 'Manualtasksendingbut');
            if (Manualtasksendingbutton) {
                Manualtasksendingbutton.onClick = function() {
                    let rows = this.$refs.table.getSelected();
                    if (rows.length == 0) return this.$error("请选择数据!");
                    this.$confirm(`是否确定手动发送任务信息至wcs,${rows[0].taskNum}任务!`, "提示", {
                        // iconClass:"el-icon-success",//el-icon-remove自定义图标样式
                        confirmButtonText: "确认", //确认按钮文字更换
                        cancelButtonText: "取消", //取消按钮文字更换
                        // cancelBtn:"取消",//取消按钮文字更换
                        showClose: true, //是否显示右上角关闭按钮
                        type: "warning", //提示类型 success:成功/info:信息/warning:警告/error:报错
                    }).then(() => {
                        var task = rows[0].taskNum;
                        // let data = {
                        //     BusinessId: "1",
                        //     TaskId: 1,
                        //     PalletCode: param
                        // }
                        this.http
                            .get(`api/Task/WCSTask?task=${task}`)
                            .then((x) => {
                                if (x.status) {
                                    this.$Message.success('任务手动下发成功.');
                                    this.refresh();
                                } else {
                                    return this.$error(x.message);
                                }
                            });
                    })
 
                }
            }
 
 
            var btnHandOutbound = this.buttons.find(x => x.value == "TaskCancellation");
if (btnHandOutbound != null) {
    btnHandOutbound.onClick = () => {
        let rows = this.$refs.table.getSelected();
        if (rows.length == 0) {
            return this.$error("请选择数据!");
        } else {
            this.$confirm(`是否确定要取消任务,${rows[0].taskNum}任务`, "提示", {
                confirmButtonText: "确认",
                cancelButtonText: "取消",
                showClose: true,
                type: "warning",
            }).then(() => {
                // 修改这里:使用托盘号(palletCode)而不是任务号(taskNum)
                var palletCodes = rows.map(x => {
                    return x.palletCode  // 假设表格数据中有palletCode字段
                })
                var palletCode = rows[0].palletCode;  // 直接取第一个
var requestData = { palletCode: palletCode };  // 创建JSON对象
                // 注意:这里一次只能处理一个托盘,所以取第一个选中的托盘号
                if (palletCodes.length > 0) {
                    this.http
                    .post("v1/pallet/rmsPalletTask/cancelTask", requestData, "数据处理中...")
                        .then((x) => {
                            if (x.status) {
                                this.$Message.success('成功.');
                                this.refresh();
                            } else {
                                return this.$error(x.message);
                            }
                        });
                } else {
                    this.$error("未找到托盘号信息!");
                }
            })
        }
    }
}
        },
        onInited() {
            //框架初始化配置后
            //如果要配置明细表,在此方法操作
            //this.detailOptions.columns.forEach(column=>{ });
        },
        searchBefore(param) {
            //界面查询前,可以给param.wheres添加查询参数
            //返回false,则不会执行查询
            return true;
        },
        searchAfter(result) {
            //查询后,result返回的查询数据,可以在显示到表格前处理表格的值
            return true;
        },
        addBefore(formData) {
            //新建保存前formData为对象,包括明细表,可以给给表单设置值,自己输出看formData的值
            return true;
        },
        updateBefore(formData) {
            //编辑保存前formData为对象,包括明细表、删除行的Id
            return true;
        },
        rowClick({ row, column, event }) {
            //查询界面点击行事件
            this.$refs.table.$refs.table.toggleRowSelection(row); //单击行时选中当前行;
        },
        modelOpenAfter(row) {
            //点击编辑、新建按钮弹出框后,可以在此处写逻辑,如,从后台获取数据
            //(1)判断是编辑还是新建操作: this.currentAction=='Add';
            //(2)给弹出框设置默认值
            //(3)this.editFormFields.字段='xxx';
            //如果需要给下拉框设置默认值,请遍历this.editFormOptions找到字段配置对应data属性的key值
            //看不懂就把输出看:console.log(this.editFormOptions)
        }
    }
};
export default extension;