Inspection.js
4.56 KB
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
let action = null;
layui.config({
    base: "/js/",
    version: 1114
}).use(["system"], function () {
    var form = layui.form,
        $ = layui.jquery,
        system = layui.system,
        table = layui.table,
        u = new system.u(),
        sendData = null,
        areaName = "wo",
        tableName = "WorkOrder";
    action = {
        addOptions: function () {
            var options = {
                fromId: "#modifyForm form",
                url: `/${areaName}/${tableName}/Ins`,
                submit: "submit(fromAdd)"
            }
            return options;
        },
        editOptions: function () {
            var options = {
                fromId: "#modifyForm form",
                url: `/${areaName}/${tableName}/Upd`,
                submit: "submit(fromUpdate)"
            }
            return options;
        },
        deleteOptions: function () {
            var options = {
                url: `/${areaName}/${tableName}/DelByIds`,
                keyId: "companyId"
            }
            return options;
        },
        uploadOptions: function () {
            var options = {
                url: `/${areaName}/${tableName}/Import`,
                fromFile: "#excelfile",
                selectRow: "true",
                content: $("#ImportData")
            }
            return options;
        },
        queryOptions: function () {
            var options = {
                resetFrom: "form[lay-filter=listForm]",
                fromId: "listForm",
                urlQuery: `/${areaName}/${tableName}/Load`,
                mainTable: app.data.tableIns
            }
            return options;
        },
        editBefore: function (data, callBack) {
            form.val("modifyForm", data);
            //callBack是回调函数,如果editBefore有ajax 放在成功之后
            if (callBack != null) callBack();
        },
        addSaveBefore: function (data, callBack) {
            if (callBack != null) callBack();
        },
        editSaveBefore: function (data, callBack) {
            if (callBack != null) callBack();
        },
        uploadBefore: function (formData, callBack) {
        },
        //所有动作成功之后
        actionSuccess: (falg) => {
            app.data.tableIns.config.where = {};
            app.data.tableIns.config.page.curr = 1;
            app.data.tableIns.reload("mainList", {});
        }
    }
    var app = {
        data: {
            cols: [[
                { field: "id", width: 60, title: "序号", hide: true },
                { field: "keys", width: 150, title: "keys", hide: true },
                { field: "zizeng", width: 80, title: "序号", fixed: "left", type: "numbers" },
                { field: "workOrderBodyKeys", width: 100, title: "workOrderBodyKeys", hide: true},
                { field: "workOrderCode", width: 150, title: "工单号" },
                { field: "lineCode", width: 150, title: "线体编码" },
                { field: "stationCode", width: 100, title: "工位编码" },
                { field: "equipmentCode", width: 130, title: "设备编码" },
                { field: "oprSequenceCode", width: 130, title: "工序" },
                { field: "oprSequenceName", width: 130, title: "工序名称" },
                { field: "actualStartTime", width: 100, title: "开始时间" },
                { field: "actualEndTime", width: 150, title: "结束时间" },
                { field: "progressType", width: 150, title: "开工\完工", templet: "#progressType" },
                { field: "sendStatus", width: 150, title: "报检标识", templet: "#sendStatus"  },
                { field: "createBy", width: 150, title: "报检人员" }
            ]],
            tableIns: null,
            tableElem: "mainList"
        },
        methods: {
            initTable: function (opt) {
                var config = {};
                if (opt != undefined) $.extend(config, opt);
                let options = {
                    elem: "#" + app.data.tableElem,
                    url: `/${areaName}/${tableName}/LoadInspection`,
                    cols: app.data.cols,
                    limit: 0,
                    page: false,
                    where: config
                }
                app.data.tableIns = u.initTable(options);
            }
        },
        registerEvent: function () {
        },
        init: function () {
            sendData = {
                workOrderCode: "".GetUrlParam("workOrderCode")
            }
            app.methods.initTable(sendData);
            app.registerEvent();
        }
    };
    app.init();
});