zhao
2021-07-19 8347f2fbddbd25369359dcb2da1233ac48a19fdc
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
@{
    ViewBag.Title = "流程配置";
    Layout = "~/Views/Shared/_LayoutVue.cshtml";
}
<div id="workflow" v-cloak>
    <el-card class="box-card">
        <el-form label-width="90px" v-bind:model="formData" class="demo-ruleForm" v-bind:inline="true" ref="formData">
            <el-form-item label="起点库区:">
                <el-input v-model="formData.CN_S_START_AREA_CODE" size="mini"></el-input>
            </el-form-item>
            <el-form-item label="终点库区:">
                <el-input v-model="formData.CN_S_END_AREA_CODE" size="mini"></el-input>
            </el-form-item>
            <el-button style="margin-top:2px;" size="mini" type="primary" v-on:click="search">查 询</el-button>
            <el-button size="mini" type="primary" v-on:click="add">新增</el-button>
        </el-form>
    </el-card>
    <el-table v-bind:data="workflowData"
              class="tb-edit"
              style="width: 100%;"
              border
              highlight-current-row
              size="mini"
              v-bind:height="tabHeight"
              v-on:row-click="workflowRowClick"
              ref="list">
        <el-table-column label="类型" prop="CN_S_TYPE" width="60" align="center"></el-table-column>
        <el-table-column label="起点库区" prop="CN_S_START_AREA_CODE" width="80"></el-table-column>
        <el-table-column label="终点库区" prop="CN_S_END_AREA_CODE" width="80"></el-table-column>
        <el-table-column label="起点库区名" prop="CN_S_START_AREA_NAME" width="100"></el-table-column>
        <el-table-column label="终点库区名" prop="CN_S_END_AREA_NAME" width="100"></el-table-column>
        <el-table-column label="是否启用" prop="CN_B_IS_USE" width="70" align="center">
            <template scope="scope">
                <el-switch v-model="scope.row.CN_B_IS_USE" size="mini" v-on:change="changeRowData(scope.row)">
                </el-switch>
            </template>
        </el-table-column>
        <el-table-column label="条件" prop="CN_S_EXPRESS">
            <template scope="scope">
                <el-input size="mini"
                          v-model="scope.row.CN_S_EXPRESS"
                          v-on:blur="expressInputBlur">
                </el-input>
                <span>{{scope.row.CN_S_EXPRESS}}</span>
            </template>
        </el-table-column>
        <el-table-column fixed="right"
                         label="操作"
                         width="100"
                         align="center">
            <template slot-scope="scope">
                <a href="javascript:void(0)" style="color:#409EFF" v-on:click="edit(scope.row)">编辑</a>
                <a href="javascript:void(0)" style="color:#409EFF" v-on:click="remove(scope.row)">删除</a>
            </template>
        </el-table-column>
    </el-table>
</div>
@section scripts{
    <script>
        new Vue({
            el: '#workflow',
            mixins: [useAutoHeight],
            computed: {
                tabHeight: function () {
                    return this.autoHeight - 40;
                },
            },
            data: {
                formData: {
                    CN_S_START_AREA_CODE: "",
                    CN_S_END_AREA_CODE: ""
                },
                workflowData: [],
                currentRow: null
            },
            methods: {
                expressInputBlur: function () {
                    if (this.currentRow)
                        this.changeRowData(this.currentRow);
                },
                changeRowData: function (row) {
                    ajaxManage({
                        url: "@Url.Action("UpdateData")",
                        data: row,
                        success: function (data) {
                            wms.showMsg(data, function () {
                                wms.success("已修改");
                            });
                        }
                    });
                },
                workflowRowClick: function (row, event, column) {
                    this.currentRow = row;
                },
                loadWorkflow: function () {
                    var $this = this;
                    ajaxManage({
                        url: "@Url.Action("GetWorkflowList")",
                        data: {
                            CN_S_START_AREA_CODE: $this.formData.CN_S_START_AREA_CODE,
                            CN_S_END_AREA_CODE: $this.formData.CN_S_END_AREA_CODE
                        },
                        success: function (data) {
                            wms.showMsg(data, function () {
                                $this.workflowData = [];
                                var _data = data.Data;
                                $this.workflowData = _data;
                            });
                        }
                    });
                },
                search: function () {
 
                },
                add: function () {
                    var $this = this;
                    wms.showDialogFrame({
                        title: '新增',
                        dh: 320,
                        width: "400px",
                        btn: false,
                        callBack: function (frame) {
                            $this.loadWorkflow();
                        },
                        url: "@Url.Action("Edit")"
                    });
                },
                edit: function (row) {
                    var $this = this;
                    wms.showDialogFrame({
                        title: '修改',
                        dh: 320,
                        width: "400px",
                        btn: false,
                        callBack: function (frame) {
                            $this.loadWorkflow();
                        },
                        url: "@Url.Action("Edit")?id=" + row.CN_GUID
                    });
                },
                remove: function (row) {
                    var $this = this;
                    wms.confirm("是否确认删除?", function () {
                        ajaxManage({
                            url: "@Url.Action("Delete")?id=" + row.CN_GUID,
                            success: function (data) {
                                wms.showMsg(data, function () {
                                    wms.success("已删除");
                                    $this.loadWorkflow();
                                });
                            }
                        });
                    });
                }
            },
            mounted: function () {
                this.loadWorkflow();
            }
        });
    </script>
}