wangxinhui
2024-11-06 8f392cc88b0768b74efca3b68785cf5aa1c38e70
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
//author:jxx
//此处是对表单的方法,组件,权限操作按钮等进行任意扩展(方法扩展可参照SellOrder.js)
import modelHeader from "./stockComponents/specialfunction";
// import VolBox from "@/stockManagement/Base_ware_location.vue";
let extension = {
    components: {//动态扩充组件或组件路径
        //表单header、content、footer对应位置扩充的组件
        gridHeader:modelHeader,//{ template: "<div>扩展组xx件</div>" },
        gridBody: '',
        gridFooter: '',
        //弹出框(修改、编辑、查看)header、content、footer对应位置扩充的组件
        modelHeader: '',
        modelBody: '',
        modelFooter: ''
    },
    buttons: {view: [], box:[],  detail:[]},//扩展的按钮
    // components: { VolBox },
    methods: {//事件扩展
       onInit() {
        let ModifyLocationStatus = this.buttons.find(r => r.value == "ModifyLocationStatus");
            if (null != ModifyLocationStatus) {
                ModifyLocationStatus.onClick = function () {    
                    let rows = this.$refs.table.getSelected();
                    if (rows.length == 0) {
                        return this.$error("请选择数据!");
                    } else if (rows.length > 1) {
                        return this.$error("只能选择单条数据");
                    }
                    this.$refs.gridHeader.open3(rows[0].id);
                }
            }
            this.buttons.splice(2, 0, { 
                name: "一键解绑辊分架",
                icon: 'md-refresh',
                type: 'info',
                onClick: function () {
                    let rows = this.$refs.table.getSelected();
                
                    if (rows.length == 0) {
                        return this.$error("请选择数据!");
                    } else if (rows.length > 1) {
                        return this.$error("只能选择单条数据");
                    }
                if(rows[0].upper_code.includes("ZJ-GFHCJ")||rows[0].upper_code.includes("FJ-GFHCJ")){
               
                    this.http.post("/api/base_ware_location/GFXLuntie",rows,true).then(result=>{
                        if(result.status){
                            this.$Message.success("添加成功")
                        }
                        else{
                            this.$Message.error(result.message)
                        }
                    }).catch((error) => {
                        this.$Message.error(error.Message);
                    })
                }else {
                    return this.$error("只能选择辊分下料缓存架使用此按钮");
 
                }
                    //this.$refs.gridHeader.open2()
                }
              })
       }
    } 
};  
export default extension;