zhao
2021-07-02 23ee356c6f260ecc1a48bbb8bd60932b979e4698
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
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
@{
    ViewBag.Title = "Index";
    Layout = "~/Views/Shared/_LayoutVue.cshtml";
}
 
<div id="list" v-cloak>
    <el-card class="box-card">
        <el-form label-width="90px" v-bind:model="formData" class="demo-ruleForm" v-bind:inline="true">
            <el-form-item label="接口名:">
                <el-input v-model="formData.intfName" size="mini"></el-input>
            </el-form-item>
            <el-button style="margin-top:2px;" size="mini" type="primary" v-on:click="search">查 询</el-button>
        </el-form>
        <el-row style="padding-left: 10px; margin-top: 7px;">
            <el-button size="mini" type="primary" v-on:click="add" v-has="'Add'">新 增</el-button>
            <el-button size="mini" type="primary" v-on:click="edit" v-has="'Edit'">修 改</el-button>
            <el-button size="mini" type="primary" v-on:click="logPage">访问日志</el-button>
            @*<el-button size="mini" type="primary" v-on:click="remove" v-has="'Delete'">删 除</el-button>*@
        </el-row>
    </el-card>
    <hh-table v-bind:coloptions="outCols"
              v-bind:paging="true"
              v-bind:single="true"
              v-bind:check="true"
              v-bind:where="where"
              dh="80"
              v-on:clickrow="clickRow"
              url="@Url.Action("GetList")"
              ref="busslist"
              v-bind:dh="tableHeight"></hh-table>
    <el-tabs type="border-card" tab-position="left" v-bind:style="'height:'+tabHeight+'px'">
        <el-tab-pane label="参数">
            <el-card class="box-card">
                <el-row style="padding-left: 10px; margin-top: 7px;" v-bind:inline="true">
                    <el-col>
                        <el-button size="mini" type="primary" v-on:click="addParam">新 增</el-button>
                        <el-button size="mini" type="primary" v-on:click="editParam">修 改</el-button>
                        <el-button size="mini" type="danger" v-on:click="delParam">删 除</el-button>
                    </el-col>
                </el-row>
            </el-card>
            <hh-table v-bind:coloptions="paramDef"
                      v-bind:single="true"
                      v-bind:paging="false"
                      v-bind:check="true"
                      v-bind:url="relUrl"
                      ref="waveList"
                      v-bind:dh="tabTableHeight"></hh-table>
        </el-tab-pane>
    </el-tabs>
</div>
@section scripts{
    <script>
        var outList = new Vue({
            mixins: [useAutoHeight],
            computed: {
                tableHeight: function () {
                    return (this.autoHeight + 180) / 2;
                },
                tabHeight: function () {
                    return (this.autoHeight - 50) / 2;
                },
                tabTableHeight: function () {
                    return (this.autoHeight + 80) / 2;
                }
            },
            data: {
                relUrl: "",
                formData: {
                    intfName: ""
                },
                where: {},
                outCols: [
                    { f: "CN_S_INTF_CODE", n: "接口编码", w: 120 },
                    { f: "CN_S_INTF_NAME", n: "接口名称", w: 120 },
                    { f: "CN_S_TYPE", n: "类型", w: 50 },
                    { f: "CN_S_URL", n: "地址", w: 200 },
                    { f: "CN_S_PROTOCOL", n: "协议", w: 80 },
                    { f: "CN_S_MODE", n: "请求方式", w: 80 },
                    { f: "CN_S_DB_TYPE", n: "数据库", w: 80 },
                    { f: "CN_S_CENTER_TABLE", n: "中间表", w: 120 },
                    { f: "CN_S_METHOD", n: "方法名", w: 120 },
                    { f: "CN_C_IS_ENABLE", n: "是否启用", w: 80 },
                    { f: "CN_S_MODIFY_BY", n: "修改人", w: 100 },
                    { f: "CN_T_MODIFY", n: "修改时间", w: 120 }
                ],
                paramDef: [
                    { f: "CN_S_WMS_PARAM_NAME", n: "WMS系统参数" },
                    { f: "CN_S_OTHER_PARAM_NAME", n: "外接系统参数" },
                    { f: "CN_S_FIXED_PARAM_NAME", n: "固定参数名" },
                    { f: "CN_S_FIXED_PARAM_VALUE", n: "固定参数值" },
                    { f: "CN_S_FIXED_PARAM_TYPE", n: "固定参数类型" },
                    { f: "CN_C_IS_ENABLE", n: "是否启用" },
                    { f: "CN_S_MODIFY_BY", n: "修改人" },
                    { f: "CN_T_MODIFY", n: "修改时间" }
                ]
            },
            methods: {
                search: function () {
                    this.$refs.busslist.loadData(this.formData);
                },
                add: function () {
                    wms.showDialogFrame({
                        title: '新增',
                        dh: 250,
                        width: "400px",
                        btn: false,
                        callBack: function (frame) {
                            $this.$refs.busslist.loadData();
                        },
                        url: "@Url.Action("Edit")?intfCode="
                    });
                },
                edit: function () {
                    var $this = this;
                    this.selectSingleRowEvent(function (row) {
                        wms.showDialogFrame({
                            title: '修改',
                            dh: 250,
                            width: "400px",
                            btn: false,
                            callBack: function (frame) {
                                $this.$refs.busslist.loadData();
                            },
                            url: "@Url.Action("Edit")?intfCode=" + row.CN_S_INTF_CODE
                        });
                    });
                },
                logPage: function () {
                    var $this = this;
                    this.selectSingleRowEvent(function (row) {
                        parent.tab.tabAdd({
                            title: '访问日志',
                            href: '@Url.Action("RequestLog")?intfCode=' + row.CN_S_INTF_CODE
                        });
                    });
                },
                selectSingleRowEvent: function (callBack) {
                    var selectRow = this.$refs.busslist.selections;
                    if (selectRow.length != 1) {
                        wms.warning("请选择一条记录");
                        return;
                    }
                    if (callBack)
                        callBack(selectRow[0]);
                },
                remove: function () {
                    var $this = this;
                    this.selectMultiRowEvent(function (rows) {
                        wms.confirm("确认删除?", function () {
                            var trays = "";
                            rows.forEach(function (value, index, array) {
                                if (index != 0)
                                    trays += ",";
                                trays += value.CN_S_TRAY_CODE;
                            });
 
                            ajaxManage({
                                url: "@Url.Action("Delete")?trays=" + trays,
                                type: "Get",
                                success: function (data) {
                                    if (data.Success) {
                                        $this.$refs.busslist.loadData();
                                        wms.success("删除成功");
                                    } else {
                                        wms.error(data.Msg);
                                    }
                                }
                            });
                        });
                    });
                },
                clickRow: function (row, event, column) {
                    $this = this;
                    $this.relUrl = "@Url.Action("GetParamsDef")?intfCode=" + $this.formData.CN_S_INTF_CODE;
                    //$this.op =
                    //    {
                    //        opCode: row.CN_S_OPERATION_CODE,
                    //        opName: row.CN_S_OPERATION_NAME
                    //    }
                },
                addParam: function () {
                    $this = this;
                    //if ($this.formData.stockCode == "") {
                    //    wms.error("请选择仓库名称!");
                    //    return false;
                    //}
                    this.selectSingleRowEvent(function (row) {
                        if (row == null) {
                            wms.error("请选择接口!");
                            return false;
                        }
                        wms.showDialogFrame({
                            title: '修改',
                            //dh: 300,
                            height: "250px",
                            width: "400px",
                            btn: false,
                            callBack: function (frame) {
                                $this.$refs.busslist.loadData();
                            },
                            url: "@Url.Action("EditParam")?intfCode=" + row.CN_S_INTF_CODE + "&paramGuid="
                        });
                    });
                    @*wms.showDialogFrame({
                        title: '关联可用库区',
                        dh: 280,
                        width: "490px",
                        btn: false,
                        callBack: function (frame) {
                            $this.relAreaUrl = "@Url.Action("GetParamsDef")?intfCode=" + $this.formData.CN_S_INTF_CODE;
                        },
                        url: "@Url.Action("StoreRel")?stockCode=" + $this.formData.stockCode + "&stockName=" + $this.formData.stockCode + "&opCode=" + $this.op.opCode + "&opName=" + $this.op.opName
                    });*@
                },
                editParam: function () {
                    $this = this;
 
                    if ($this.formData.stockCode == "") {
                        wms.error("请选择仓库名称!");
                        return false;
                    }
                    else if ($this.formData.opCode == "") {
                        wms.error("请选择业务类型!");
                        return false;
                    }
                },
                delParam: function () {
                    $this = this;
                }
            },
            el: '#list'
        });
    </script>
}