qinchulong
2025-03-29 039a4a5433e7f80adc88b491b549e5d9486e4f9a
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
//author:jxx
//此处是对表单的方法,组件,权限操作按钮等进行任意扩展(方法扩展可参照SellOrder.js)
import addTaskss from "@/views/dialog/addTask.vue"
import addTaskss2 from "@/views/dialog/addTask2.vue"
let extension = {
    components: {//动态扩充组件或组件路径
        //表单header、content、footer对应位置扩充的组件
        gridHeader: addTaskss,//{ template: "<div>扩展组xx件</div>" },
        gridBody: addTaskss2,
        gridFooter: '',
        //弹出框(修改、编辑、查看)header、content、footer对应位置扩充的组件
        modelHeader: '',
        modelBody: '',
        modelFooter: ''
    },
    buttons: { view: [], box: [], detail: [] },//扩展的按钮
    buttons: { view: [], box: [], detail: [] },//扩展的按钮
    methods: {//事件扩展
        onInit() {
            this.maxBtnLength = 6;
            let ManualCompletion = this.buttons.find(r => r.value == "ManualCompletion");
            if (null != ManualCompletion) {
                ManualCompletion.onClick = function () {
                    let rows = this.$refs.table.getSelected();
                    if (rows.length == 0) {
                        return this.$error("请选择要完成的数据!");
                    } else if (rows.length > 1) {
                        return this.$error("只能选择单条数据");
                    }
                    let request = {
                        taskID: rows[0].agv_tasknum,
                    }
                    this.http.post("/api/WCS/UpdateAGVTaskState", request, "正在完成任务....").then(x => {
                        if (x.code != 0) return this.$error(x.message);
                        this.$success("完成任务成功!");
                        this.refresh();
                    });
                }
            };
            let CancelManually = this.buttons.find(r => r.value == "CancelManually");
            if (null != CancelManually) {
                CancelManually.onClick = function () {
                    let rows = this.$refs.table.getSelected();
                    if (rows.length == 0) {
                        return this.$error("请选择要取消的数据!");
                    } else if (rows.length > 1) {
                        return this.$error("只能选择单条数据");
                    }
                    let request = {
                        taskID: rows[0].agv_tasknum,
                    }
                    this.http.post("/api/WCS/DeleteAGVTaskState", request, "正在取消任务....").then(x => {
                        if (x.code != 0) return this.$error(x.message);
                        this.$success("取消任务成功!");
                        this.refresh();
                    });
                }
            };
            this.buttons.splice(1, 0, {
                    name: "正负及烘烤1/2手动任务",
                    icon: 'md-refresh',
                    type: 'primary',
                    onClick: function () {
                        this.$refs.gridHeader.detialBox = true;
                    }
                }),this.buttons.splice(1, 0, {
                    name: "正负及烘烤其他手动任务",
                    icon: 'md-refresh',
                    type: 'primary',
                    onClick: function () {
                        this.$refs.gridBody.detialBox = true;
                    }
                })
        }
    }
};
export default extension;