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
| <template>
| <flex-layout>
| <div class="flex-page-content">
| <el-table stripe size="mini" header-row-class-name="header-primary" height="100%" :data="table.data">
| <el-table-column
| v-for="item in table.headers" :key="item.props"
| :prop="item.prop" :label="item.label" :min-width="item.minWidth"
| align="center" :resizable="false"></el-table-column>
| <el-table-column label="操作" width="250" align="center" fixed="right">
| <template slot-scope="scope">
| <el-button @click="handleUpdate(scope.row)" type="success" size="mini">编辑</el-button>
| <el-button type="error" size="mini" @click="handleDel(scope.row)">删除</el-button>
| </template>
| </el-table-column>
| </el-table>
| </div>
| <!-- 3D机房信息功能按钮 -->
| <div class="flex-page-footer" slot="footer" v-if="acTabs=='threeHomeInfo'">
| <div class="el-pagination-btns">
| <el-button type="primary" round size="mini" icon="el-icon-search" @click="searchData">查询</el-button>
| </div>
| <div class="el-pagination-btns">
| <el-button type="primary" round size="mini" icon="el-icon-plus" @click="handleAdd">新增站点配置</el-button>
| </div>
| <div class="el-pagination-btns">
| <el-button type="primary" round size="mini" icon="el-icon-upload" @click="handleUploadPicture">上传3D资源</el-button>
| </div>
| </div>
| <el-dialog title="新增3D机房配置" width="auto" :visible.sync="addDialog" :close-on-click-modal="false" top="0"
| class="dialog-center" :modal-append-to-body="false">
| <add-three-home-setting v-if="addDialog" :three-home-list="table.data" :visible.sync="addDialog" @successHandle="addSuccessHandle"></add-three-home-setting>
| </el-dialog>
| <el-dialog title="更新3D机房配置" width="auto" :visible.sync="editDialog" :close-on-click-modal="false" top="0"
| class="dialog-center" :modal-append-to-body="false">
| <edit-three-home-setting v-if="editDialog" :visible.sync="editDialog" :info="editRow" @successHandle="editSuccessHandle"></edit-three-home-setting>
| </el-dialog>
| <el-dialog title="上传图片资源" width="auto" :visible.sync="uploadDialog" :close-on-click-modal="false" top="0"
| class="dialog-center" :modal-append-to-body="false">
| <upload-picture v-if="uploadDialog" :visible.sync="uploadDialog"></upload-picture>
| </el-dialog>
| </flex-layout>
| </template>
|
| <script>
| import AddThreeHomeSetting from "@/pages/pageSetting/dialog/AddThreeHomeSetting";
| import UploadPicture from "@/pages/pageSetting/dialog/UploadPicture";
| import EditThreeHomeSetting from "@/pages/pageSetting/dialog/EditThreeHomeSetting";
| export default {
| name: "threeHomeSetting",
| components: {
| EditThreeHomeSetting,
| AddThreeHomeSetting,
| UploadPicture
| },
| data() {
| return {
| acTabs: "threeHomeInfo",
| table: {
| headers: [
| {
| prop: "stationName",
| label: "站点名称",
| minWidth: 360,
| },
| {
| prop: "battGroupName",
| label: "电池组名称",
| minWidth: 180,
| },
| {
| prop: "pictureName",
| label: "3D图片名",
| minWidth: 300,
| },
| {
| prop: "positionX",
| label: "电池组位置X",
| minWidth: 180,
| },
| {
| prop: "positionY",
| label: "电池组位置Y",
| minWidth: 180,
| },
| {
| prop: "length",
| label: "电池组长",
| minWidth: 180,
| },
| {
| prop: "width",
| label: "电池组宽",
| minWidth: 180,
| }
| ],
| data: []
| },
| addDialog: false,
| editDialog: false,
| editRow: {},
| uploadDialog: false,
| }
| },
| methods: {
| handleAdd() {
| this.addDialog = true;
| },
| addSuccessHandle() {
| this.searchData();
| },
| editSuccessHandle() {
| this.searchData();
| },
| handleUpdate(row) {
| this.editRow = row;
| this.$nextTick(()=>{
| this.editDialog = true;
| });
| },
| handleDel(row) {
| this.$confirm("确认删除", "提示", {
| confirmButtonText: '确定',
| cancelButtonText: '取消',
| type: 'warning'
| }).then(()=>{
| // 开启等待框
| let loading = this.$layer.loading();
| this.$apis.pageSetting.threeHomeSetting.del(row).then(res=>{
| let rs = JSON.parse(res.data.result);
| if(rs.code == 1) {
| this.$layer.msg("删除成功");
| }else {
| this.$layer.msg("删除失败");
| }
| this.searchData();
| this.$layer.close(loading);
| }).catch(error=>{
| console.log(error);
| this.$layer.close(loading);
| });
| }).catch(()=>{});
| },
| searchData() {
| this.$apis.pageSetting.threeHomeSetting.searchAll().then(res=>{
| let rs = JSON.parse(res.data.result);
| let data = [];
| if(rs.code == 1) {
| data = rs.data;
| }
| // 设置表格的值
| this.table.data = data;
| }).catch(error=>{
| console.log(error);
| });
| },
| searchPictureData() {
| this.$apis.pageSetting.threeHomeSetting.searchPicture().then(res=>{
| let rs = JSON.parse(res.data.result);
| let data = [];
| if(rs.code == 1) {
| data = rs.data;
| }
| // 设置表格的值
| console.log(rs);
| //this.table.data = data;
| }).catch(error=>{
| console.log(error);
| });
| },
| handleUploadPicture() {
| this.uploadDialog = true;
| },
| },
| mounted() {
| // 查询配置信息
| this.searchData();
| }
| }
| </script>
|
| <style scoped>
|
| </style>
|
|