zhao
2021-06-11 98186752629a7bd38965418af84db382d90b9c07
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
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
@{
    ViewBag.Title = "Index";
    Layout = "~/Views/Shared/_LayoutVue.cshtml";
}
 
<div id="logistics" 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.logistics" 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="danger" v-on:click="remove" v-has="'Delete'">删 除</el-button>
            @*<el-button size="mini" type="primary" v-on:click="addtemplet">新增模版</el-button>*@
        </el-row>
    </el-card>
    <hh-table v-bind:coloptions="cols"
              v-bind:single="true"
              v-bind:paging="true"
              v-bind:check="true"
              v-bind:dh="tableHeight"
              url="@Url.Action("LogisticsList")"
              v-on:clickrow="clickRow"
              ref="list">
    </hh-table>
    <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="addtemplet">新增模版</el-button>
                <el-button size="mini" type="primary" v-on:click="update">修改模版</el-button>
                <el-button size="mini" type="danger" v-on:click="deletetenmplet">删除模版</el-button>
            </el-col>
        </el-row>
    </el-card>
    <hh-table v-bind:coloptions="templetCols"
              v-bind:single="true"
              v-bind:paging="false"
              v-bind:check="true"
              v-bind:url="templetUrl"
              ref="templetList"
              v-bind:dh="tabTableHeight"></hh-table>
</div>
@section scripts{
    <script src="~/Content/js/linq.js_ver2.2.0.2/linq.js"></script>
    <script>
        var outList = new Vue({
            mixins: [useAutoHeight],
            computed: {
                tableHeight: function () {
                    return (this.autoHeight + 100) / 2;
                },
                tabHeight: function () {
                    return (this.autoHeight - 60) / 2;
                },
                tabTableHeight: function () {
                    return (this.autoHeight + 80) / 2;
                }
            },
            data: {
                formData: {
                    logistics: ""
                },
                templetCols: [
                     //{ f: "CN_GUID", n: "主键",hidden:true},
                     { f: "CN_S_TEMPLET_NAME", n: "模版名称" },
                      {
                          f: "CN_N_IS_DEFAULT", n: "是否默认", format: function (row, column, cellValue, index) {
                              if (cellValue) return 'Y';
                              return 'N';
                          }
                      },
                     { f: "CN_S_CREATOR_BY", n: "创建人" },
                     { f: "CN_T_CREATE", n: "创建时间" },
                ],
                cols: [
                    { f: "CN_S_LOGISTICS_FLAG", n: "物流标识" },
                    { f: "CN_S_LOGISTICS_NAME", n: "物流名称" },
                    {
                        f: "CN_C_DIGITAL", n: "是否电子面单", format: function (row, column, cellValue, index) {
                            if (cellValue) return 'Y';
                            return 'N';
                        }
                    },
                    {
                        f: "CN_C_RETURN_ORDER", n: "是否回单", format: function (row, column, cellValue, index) {
                            if (cellValue) return 'Y';
                            return 'N';
                        }
                    }
                ],
                templetUrl:"",
            },
            methods: {
                search: function () {
                    this.$refs.templetList.clearData();
                    this.$refs.list.loadData(this.formData);
                },
                add: function () {
                    var $this = this;
                    wms.showDialogFrame({
                        title: '新增',
                        dh: 380,
                        width: "400px",
                        btn: false,
                        callBack: function (frame) {
                            $this.$refs.list.loadData();
                        },
                        url: "@Url.Action("Edit")"
                    });
                },
                addtemplet: function () {
                    var $this = this;
                    this.selectSingleRowEvent(function (row) {
                        wms.showDialogFrame({
                            title: '新增模版',
                            dh: 380,
                            width: "400px",
                            btn: false,
                            callBack: function (frame) {
                                //$this.$refs.list.loadData();
                                $this.$refs.templetList.loadData();
                            },
                            url: "@Url.Action("PrintTemplet")?flag=" + row.CN_S_LOGISTICS_FLAG
                        });
                    })
                },
                edit: function () {
                    var $this = this;
                    this.selectSingleRowEvent(function (row) {
                        wms.showDialogFrame({
                            title: '修改',
                            dh: 380,
                            width: "400px",
                            btn: false,
                            callBack: function (frame) {
                                $this.$refs.list.loadData();
                            },
                            url: "@Url.Action("Edit")?guid=" + row.CN_GUID
                        });
                    });
                },
                update:function()
                {
                    var $this = this;
                    this.selectSingleRowEvents(function (row) {
                        wms.showDialogFrame({
                            title: '修改模版',
                            dh: 380,
                            width: "400px",
                            btn: false,
                            callBack: function (frame) {
                                //$this.$refs.list.loadData();
                                $this.$refs.templetList.loadData();
                            },
                            url: "@Url.Action("PrintTemplet")?guid=" + row.CN_GUID + "&flag=" + row.CN_S_LOGISTICS_FLAG
                        });
                });
                },
 
                remove: function () {
                    var $this = this;
                    this.selectMultiRowEvent(function (rows) {
                        wms.confirm("确认删除?", function () {
                            var guid = "";
                            rows.forEach(function (value, index, array) {
                                if (index != 0)
                                    guid += ",";
                                guid += value.CN_GUID;
                            });
                            ajaxManage({
                                url: "@Url.Action("Delete")?guid=" + guid,
                                type: "Get",
                                success: function (data) {
                                    if (data.Success) {
                                        $this.$refs.list.loadData();
                                        wms.success("删除成功");
                                    } else {
                                        wms.error(data.Msg);
                                    }
                                }
                            });
                        });
                    });
                },
 
                deletetenmplet:function()
                {
                    var $this = this;
                    this.selectMultiRowEvents(function (rows) {
                        wms.confirm("确认删除?", function () {
                            var guid = "";
                            rows.forEach(function (value, index, array) {
                                if (index != 0)
                                    guid += "','";
                                guid += value.CN_GUID;
                            });
                            ajaxManage({
                                url: "@Url.Action("DeleteTemplet")?guid=" + guid,
                                type: "Get",
                            success: function (data) {
                                if (data.Success) {
                                    //$this.$refs.list.loadData();
                                    $this.$refs.templetList.loadData();
                                    wms.success("删除成功");
                                } else {
                                    wms.error(data.Msg);
                                }
                            }
                        });
                    });
                });
                },
                selectMultiRowEvent: function (callBack) {
                    var selectRow = this.$refs.list.selections;
                    if (selectRow.length <= 0) {
                        wms.warning("最少选择一条记录");
                        return;
                    }
                    if (callBack)
                        callBack(selectRow);
                },
                selectMultiRowEvents: function (callBack) {
                    var selectRow = this.$refs.templetList.selections;
                    if (selectRow.length <= 0) {
                        wms.warning("最少选择一条记录");
                        return;
                    }
                    if (callBack)
                        callBack(selectRow);
                },
 
                selectSingleRowEvent: function (callBack) {
                    var selectRow = this.$refs.list.selections;
                    if (selectRow.length != 1) {
                        wms.warning("请选择一条记录");
                        return;
                    }
                    if (callBack)
                        callBack(selectRow[0]);
                },
                selectSingleRowEvents: function (callBack) {
                    var selectRow = this.$refs.templetList.selections;
                    if (selectRow.length != 1) {
                        wms.warning("请选择一条记录");
                        return;
                    }
                    if (callBack)
                        callBack(selectRow[0]);
                },
                clickRow: function (row, event, column) {
                    var $this = this;
                    var logisticsFlag = row.CN_S_LOGISTICS_FLAG;
                    var token = (new Date()).getTime();
                    $this.templetUrl = "@Url.Action("LogisticsTempletList")?logisticsFlag=" + logisticsFlag + "&token=" + token;
                    //ajaxManage({
                    //    url: '/Basic/Logistics/LogisticsTempletList?logisticsFlag=' + logisticsFlag,
                    //    success: function (data) {
                    //        //console.log(data);
                    //        $this.templetdata = data.Data;
                    //    }
                    //});
                },
 
                handleEdit: function (index, row) {
                    console.log(index, row);
                },
                handleDelete: function (index, row) {
                    console.log(index, row);
                },
 
            },
            el: '#logistics'
        });
    </script>
}