Admin
2025-12-02 9e42f0dafa019f5ecf6b0ff425ecb966b002171e
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
//此处是对表单的方法,组件,权限操作按钮等进行任意扩展(方法扩展可参照SellOrder.js)
let extension = {
    components: {//动态扩充组件或组件路径
        //表单header、content、footer对应位置扩充的组件
        gridHeader: '',//{ template: "<div>扩展组xx件</div>" },
        gridBody: '',
        gridFooter: '',
        //弹出框(修改、编辑、查看)header、content、footer对应位置扩充的组件
        modelHeader: '',
        modelBody: '',
        modelFooter: ''
    },
    buttons: { view: [], box: [], detail: [] },//扩展的按钮
    methods: {//事件扩展
        onInit() {
            let materiel_modelno = this.getOption("weighing_materiel_id");
            let confignameselect = this.getOption("weighing_bearing_id");
            let manufacturerselect = this.getOption("weighing_manufacturer");
            materiel_modelno.onChange = (val, options) => {
                let params = {
                    MainData: { "materielId": val },
                }
                this.editFormFields.weighing_bearing_id = '';
                this.editFormFields.weighing_manufacturer = '';
                confignameselect.data = [];
                manufacturerselect.data = [];
                this.http.post("api/Dt_materiel_zc_info/GetZCInfoByMateriel", params, "").then(x => {
                    confignameselect.data = x.data;
                });
            };
            confignameselect.onChange = (val, options) => {
                let params = {
                    MainData: { "materielId": this.editFormFields.weighing_materiel_id, 'materielModel': val },
                }
                manufacturerselect.data = [];
                this.editFormFields.weighing_manufacturer = '';
                this.http.post("api/Dt_materiel_zc_info/GetManufacturerByMateriel", params, "").then(x => {
                    manufacturerselect.data = x.data;
                });
            };
        },
        getOption(field) {
            let option;
            this.editFormOptions.forEach(x => {
                let col = x.find(r => r.field == field);
                if (null != col) {
                    option = col;
                    return;
                }
            });
            return option;
        }, modelOpenAfter(row) {
            let isEDIT = this.currentAction == this.const.ADD;
            this.editFormOptions.forEach(item => {
                item.forEach(x => {
                    if (x.field == "weighing_materiel_id" || x.field == "weighing_bearing_id" || x.field == "weighing_manufacturer" || x.field == "weighing_type") {
                        x.disabled = !isEDIT;
                    }
                });
            })
        }
    }
};
export default extension;