瀏覽代碼

新增配套资源后台管理模块 可手动添加类型 添加点位

zhouwang 4 天之前
父節點
當前提交
2245f55138
共有 4 個文件被更改,包括 811 次插入0 次删除
  1. 59 0
      src/api/supporting/info.js
  2. 53 0
      src/api/supporting/type.js
  3. 393 0
      src/views/supporting/info/index.vue
  4. 306 0
      src/views/supporting/type/index.vue

+ 59 - 0
src/api/supporting/info.js

@@ -0,0 +1,59 @@
1
+import request from '@/utils/request'
2
+
3
+// 查询资源点位对象列表
4
+export function listInfo(query) {
5
+  return request({
6
+    url: '/supporting/info/list',
7
+    method: 'get',
8
+    params: query
9
+  })
10
+}
11
+
12
+// 查询资源点位对象详细
13
+export function getInfo(infoId) {
14
+  return request({
15
+    url: '/supporting/info/' + infoId,
16
+    method: 'get'
17
+  })
18
+}
19
+
20
+// 新增资源点位对象
21
+export function addInfo(data) {
22
+  return request({
23
+    url: '/supporting/info',
24
+    method: 'post',
25
+    data: data
26
+  })
27
+}
28
+
29
+// 修改资源点位对象
30
+export function updateInfo(data) {
31
+  return request({
32
+    url: '/supporting/info',
33
+    method: 'put',
34
+    data: data
35
+  })
36
+}
37
+
38
+// 删除资源点位对象
39
+export function delInfo(infoId) {
40
+  return request({
41
+    url: '/supporting/info/' + infoId,
42
+    method: 'delete'
43
+  })
44
+}
45
+
46
+// 导出资源点位对象
47
+export function exportInfo(query) {
48
+  return request({
49
+    url: '/supporting/info/export',
50
+    method: 'get',
51
+    params: query
52
+  })
53
+}
54
+  export function getType() {
55
+  return request({
56
+    url: '/supporting/type/listAll',
57
+    method: 'get'
58
+  })
59
+}

+ 53 - 0
src/api/supporting/type.js

@@ -0,0 +1,53 @@
1
+import request from '@/utils/request'
2
+
3
+// 查询资源类型列表
4
+export function listType(query) {
5
+  return request({
6
+    url: '/supporting/type/list',
7
+    method: 'get',
8
+    params: query
9
+  })
10
+}
11
+
12
+// 查询资源类型详细
13
+export function getType(typeId) {
14
+  return request({
15
+    url: '/supporting/type/' + typeId,
16
+    method: 'get'
17
+  })
18
+}
19
+
20
+// 新增资源类型
21
+export function addType(data) {
22
+  return request({
23
+    url: '/supporting/type',
24
+    method: 'post',
25
+    data: data
26
+  })
27
+}
28
+
29
+// 修改资源类型
30
+export function updateType(data) {
31
+  return request({
32
+    url: '/supporting/type',
33
+    method: 'put',
34
+    data: data
35
+  })
36
+}
37
+
38
+// 删除资源类型
39
+export function delType(typeId) {
40
+  return request({
41
+    url: '/supporting/type/' + typeId,
42
+    method: 'delete'
43
+  })
44
+}
45
+
46
+// 导出资源类型
47
+export function exportType(query) {
48
+  return request({
49
+    url: '/supporting/type/export',
50
+    method: 'get',
51
+    params: query
52
+  })
53
+}

+ 393 - 0
src/views/supporting/info/index.vue

@@ -0,0 +1,393 @@
1
+<template>
2
+  <div class="app-container">
3
+    <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px" @submit.native.prevent>
4
+      <el-form-item label="所属类型" prop="typeId">
5
+        <el-select v-model="queryParams.typeId" placeholder="请选择所属类型" clearable size="small">
6
+          <el-option
7
+            v-for="dict in typeList"
8
+            :key="dict.typeName"
9
+            :label="dict.typeName"
10
+            :value="dict.typeId"
11
+          />
12
+        </el-select>
13
+      </el-form-item>
14
+      <el-form-item label="名字" prop="infoName">
15
+        <el-input
16
+          v-model="queryParams.infoName"
17
+          placeholder="请输入名字"
18
+          clearable
19
+          size="small"
20
+          @keyup.enter.native="handleQuery"
21
+        />
22
+      </el-form-item>
23
+      <el-form-item>
24
+        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
25
+        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
26
+      </el-form-item>
27
+    </el-form>
28
+
29
+    <el-row :gutter="10" class="mb8">
30
+      <el-col :span="1.5">
31
+        <el-button
32
+          type="primary"
33
+          plain
34
+          icon="el-icon-plus"
35
+          size="mini"
36
+          @click="handleAdd"
37
+          v-hasPermi="['supporting:info:add']"
38
+        >新增</el-button>
39
+      </el-col>
40
+      <el-col :span="1.5">
41
+        <el-button
42
+          type="success"
43
+          plain
44
+          icon="el-icon-edit"
45
+          size="mini"
46
+          :disabled="single"
47
+          @click="handleUpdate"
48
+          v-hasPermi="['supporting:info:edit']"
49
+        >修改</el-button>
50
+      </el-col>
51
+      <el-col :span="1.5">
52
+        <el-button
53
+          type="danger"
54
+          plain
55
+          icon="el-icon-delete"
56
+          size="mini"
57
+          :disabled="multiple"
58
+          @click="handleDelete"
59
+          v-hasPermi="['supporting:info:remove']"
60
+        >删除</el-button>
61
+      </el-col>
62
+      <el-col :span="1.5">
63
+        <el-button
64
+          type="warning"
65
+          plain
66
+          icon="el-icon-download"
67
+          size="mini"
68
+          :loading="exportLoading"
69
+          @click="handleExport"
70
+          v-hasPermi="['supporting:info:export']"
71
+        >导出</el-button>
72
+      </el-col>
73
+      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
74
+    </el-row>
75
+
76
+    <el-table v-loading="loading" :data="infoList" @selection-change="handleSelectionChange">
77
+      <el-table-column type="selection" width="55" align="center" />
78
+      <el-table-column label="信息ID" align="center" prop="infoId" />
79
+      <el-table-column label="类型名称" align="center" prop="typeName" />
80
+      <el-table-column label="名字" align="center" prop="infoName" />
81
+      <el-table-column label="备注" align="center" prop="memo" />
82
+      <el-table-column label="坐标" align="center" prop="location" />
83
+      <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="140">
84
+        <template slot-scope="scope">
85
+          <el-button
86
+            size="mini"
87
+            type="text"
88
+            icon="el-icon-edit"
89
+            @click="handleUpdate(scope.row)"
90
+            v-hasPermi="['supporting:info:edit']"
91
+          >修改</el-button>
92
+          <el-button
93
+            size="mini"
94
+            type="text"
95
+            icon="el-icon-delete"
96
+            @click="handleDelete(scope.row)"
97
+            v-hasPermi="['supporting:info:remove']"
98
+          >删除</el-button>
99
+        </template>
100
+      </el-table-column>
101
+    </el-table>
102
+
103
+    <pagination
104
+      v-show="total>0"
105
+      :total="total"
106
+      :page.sync="queryParams.pageNum"
107
+      :limit.sync="queryParams.pageSize"
108
+      @pagination="getList"
109
+    />
110
+
111
+    <!-- 添加或修改资源点位对象对话框 -->
112
+    <el-dialog :title="title" :visible.sync="open" width="800px" append-to-body>
113
+      <el-form ref="form" :model="form" :rules="rules" label-width="120px">
114
+        <el-form-item label="所属类型" prop="typeId">
115
+          <el-select v-model="form.typeId" placeholder="请选择类型">
116
+              <el-option
117
+                v-for="dict in typeList"
118
+                :key="dict.typeName"
119
+                :label="dict.typeName"
120
+                :value="dict.typeId"
121
+              />
122
+          </el-select>
123
+        </el-form-item>
124
+        <el-form-item label="名字" prop="infoName">
125
+          <el-input v-model="form.infoName" placeholder="请输入名字" />
126
+        </el-form-item>
127
+        <el-form-item label="备注" prop="memo">
128
+          <el-input v-model="form.memo" placeholder="请输入备注" />
129
+        </el-form-item>
130
+        <el-form-item label="坐标" prop="location">
131
+          <el-input v-model="form.location" @focus="openditu">
132
+            {{ form.location}}
133
+          </el-input>
134
+        </el-form-item>
135
+      </el-form>
136
+      <div slot="footer" class="dialog-footer">
137
+        <el-button type="primary" @click="submitForm">确 定</el-button>
138
+        <el-button @click="cancel">取 消</el-button>
139
+      </div>
140
+    </el-dialog>
141
+    <el-dialog title="地图" :visible.sync="dialogVisible" width="80%">
142
+      <div id='mainMap'>
143
+        <div id="mapDiv" style="width:100%; height:700px">
144
+        </div>
145
+      </div>
146
+      <input type="button" value="清除" @click='clearmian()' />
147
+      <input type="button" value="标点工具" @click='openMarkTool()' />
148
+      <span slot="footer" class="dialog-footer">
149
+        <el-button @click="dialogVisible = false">取 消</el-button>
150
+        <el-button type="primary" @click='tijiao'>确定</el-button>
151
+      </span>
152
+    </el-dialog>
153
+  </div>
154
+</template>
155
+
156
+<script>
157
+import { listInfo, getInfo, delInfo, addInfo, updateInfo, exportInfo,getType } from "@/api/supporting/info";
158
+
159
+export default {
160
+  name: "Info",
161
+  data() {
162
+    return {
163
+      dialogVisible: false,
164
+      map: null,
165
+      handler: null,
166
+      markPoints: '', // 保存标记点的坐标
167
+      // 遮罩层
168
+      loading: true,
169
+      // 导出遮罩层
170
+      exportLoading: false,
171
+      // 选中数组
172
+      ids: [],
173
+      // 非单个禁用
174
+      single: true,
175
+      // 非多个禁用
176
+      multiple: true,
177
+      // 显示搜索条件
178
+      showSearch: true,
179
+      // 总条数
180
+      total: 0,
181
+      // 资源点位对象表格数据
182
+      infoList: [],
183
+      typeList:[],
184
+      // 弹出层标题
185
+      title: "",
186
+      // 是否显示弹出层
187
+      open: false,
188
+      // 查询参数
189
+      queryParams: {
190
+        pageNum: 1,
191
+        pageSize: 10,
192
+        typeId: null,
193
+        infoName: null
194
+      },
195
+      // 表单参数
196
+      form: {},
197
+      // 表单校验
198
+      rules: {
199
+        typeId: [
200
+          { required: true, message: "类型编号不能为空", trigger: "change" }
201
+        ],
202
+      }
203
+    };
204
+  },
205
+  created() {
206
+    this.getList();
207
+    this.getType();
208
+  },
209
+  methods: {
210
+
211
+    // 销毁天地图
212
+    destructionTMap ()  {
213
+      if (this.map) {
214
+        this.map = null;
215
+        // 直接将节点给删掉
216
+        console.log('1qsad');
217
+
218
+        const parentEl = document.getElementById('mainMap');
219
+        const cahildrenEl1 = document.getElementById('mapDiv');
220
+        if(cahildrenEl1) parentEl.removeChild(cahildrenEl1);
221
+        // 然后再手动将节点加进来
222
+        const newCahildrenEl = document.createElement("div");
223
+        newCahildrenEl.id = 'mapDiv'
224
+        newCahildrenEl.style = 'height: 700px;width: 100%;'
225
+        parentEl.appendChild(newCahildrenEl)
226
+      }
227
+    },
228
+
229
+    tijiao() {
230
+      console.log('多边形数据:', this.form.rasterLngLat);
231
+      console.log('多边形数据:', this.markPoints);
232
+      this.form.location = this.markPoints
233
+      this.destructionTMap()
234
+      this.dialogVisible = false;
235
+    },
236
+
237
+    clearmian() {
238
+      if (this.handler) this.handler.close();
239
+      this.map.clearOverLays(); // 清除所有覆盖物
240
+      this.markPoints = ''; // 清除保存的标记点坐标
241
+    },
242
+
243
+    openMarkTool() {
244
+      console.log("1111111111")
245
+      if (this.handler) this.handler.close(); // 关闭之前的工具
246
+
247
+      this.handler = new T.MarkTool(this.map); // 创建标点工具
248
+      this.handler.open(); // 打开标点工具
249
+
250
+      this.handler.on("mouseup", (e) => {
251
+        let drawData1 = e.currentLnglat.lat+","+e.currentLnglat.lng;
252
+        this.markPoints = drawData1;
253
+      });
254
+
255
+      this.handler.on("close", () => {
256
+        // 标点工具关闭时的处理
257
+        this.handler = null;
258
+      });
259
+    },
260
+
261
+
262
+    openditu() {
263
+      console.log('打开地图对话框');
264
+      this.dialogVisible = true;
265
+      this.$nextTick(() => {
266
+        const T = window.T;
267
+        const zoom = 12;
268
+        this.map = new T.Map('mapDiv');
269
+        this.map.centerAndZoom(new T.LngLat(103.96, 30.66), zoom);
270
+        // 创建标注工具对象
271
+        this.handler = new T.MarkTool(this.map);
272
+        console.log('handler 初始化完成:', this.handler);
273
+        console.log('kanknak1', this.form.location);
274
+        let points = new T.LngLat();
275
+        if (this.form.location) {
276
+          const coordinates = this.form.location.split(',');
277
+          points =  new T.LngLat(coordinates[1], coordinates[0]);
278
+        }
279
+        // 创建面对象
280
+        console.log('kanknak2', points);
281
+        const marker = new T.Marker(points);
282
+        // 向地图上添加面
283
+        this.map.addOverLay(marker);
284
+      });
285
+    },
286
+
287
+    /** 查询资源点位对象列表 */
288
+    getList() {
289
+      this.loading = true;
290
+      listInfo(this.queryParams).then(response => {
291
+        this.infoList = response.data.list;
292
+        this.total = response.data.total;
293
+        this.loading = false;
294
+      });
295
+    },
296
+    /** 查询类型**/
297
+    getType() {
298
+      getType().then(response => {
299
+        this.typeList = response.data;
300
+      });
301
+    },
302
+    // 取消按钮
303
+    cancel() {
304
+      this.open = false;
305
+      this.reset();
306
+    },
307
+    // 表单重置
308
+    reset() {
309
+      this.form = {
310
+        infoId: null,
311
+        typeId: null,
312
+        infoName: null,
313
+        memo: null,
314
+        location: null
315
+      };
316
+      this.resetForm("form");
317
+    },
318
+    /** 搜索按钮操作 */
319
+    handleQuery() {
320
+      this.queryParams.pageNum = 1;
321
+      this.getList();
322
+    },
323
+    /** 重置按钮操作 */
324
+    resetQuery() {
325
+      this.resetForm("queryForm");
326
+      this.handleQuery();
327
+    },
328
+    // 多选框选中数据
329
+    handleSelectionChange(selection) {
330
+      this.ids = selection.map(item => item.infoId)
331
+      this.single = selection.length!==1
332
+      this.multiple = !selection.length
333
+    },
334
+    /** 新增按钮操作 */
335
+    handleAdd() {
336
+      this.reset();
337
+      this.open = true;
338
+      this.title = "添加资源点位对象";
339
+    },
340
+    /** 修改按钮操作 */
341
+    handleUpdate(row) {
342
+      this.reset();
343
+      const infoId = row.infoId || this.ids
344
+      getInfo(infoId).then(response => {
345
+        this.form = response.data;
346
+        this.open = true;
347
+        this.title = "修改资源点位对象";
348
+      });
349
+    },
350
+    /** 提交按钮 */
351
+    submitForm() {
352
+      this.$refs["form"].validate(valid => {
353
+        if (valid) {
354
+          if (this.form.infoId != null) {
355
+            updateInfo(this.form).then(response => {
356
+              this.$modal.msgSuccess("修改成功");
357
+              this.open = false;
358
+              this.getList();
359
+            });
360
+          } else {
361
+            addInfo(this.form).then(response => {
362
+              this.$modal.msgSuccess("新增成功");
363
+              this.open = false;
364
+              this.getList();
365
+            });
366
+          }
367
+        }
368
+      });
369
+    },
370
+    /** 删除按钮操作 */
371
+    handleDelete(row) {
372
+      const infoIds = row.infoId || this.ids;
373
+      this.$modal.confirm('是否确认删除资源点位对象编号为"' + infoIds + '"的数据项?').then(function() {
374
+        return delInfo(infoIds);
375
+      }).then(() => {
376
+        this.getList();
377
+        this.$modal.msgSuccess("删除成功");
378
+      }).catch(() => {});
379
+    },
380
+    /** 导出按钮操作 */
381
+    handleExport() {
382
+      const queryParams = this.queryParams;
383
+      this.$modal.confirm('是否确认导出所有资源点位对象数据项?').then(() => {
384
+        this.exportLoading = true;
385
+        return exportInfo(queryParams);
386
+      }).then(response => {
387
+        this.$download.name(response.msg);
388
+        this.exportLoading = false;
389
+      }).catch(() => {});
390
+    }
391
+  }
392
+};
393
+</script>

+ 306 - 0
src/views/supporting/type/index.vue

@@ -0,0 +1,306 @@
1
+<template>
2
+  <div class="app-container">
3
+    <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px" @submit.native.prevent>
4
+      <el-form-item label="类型名称" prop="typeName">
5
+        <el-input
6
+          v-model="queryParams.typeName"
7
+          placeholder="请输入类型名称"
8
+          clearable
9
+          size="small"
10
+          @keyup.enter.native="handleQuery"
11
+        />
12
+      </el-form-item>
13
+      <el-form-item label="类型分类" prop="typeLabel">
14
+        <el-select v-model="queryParams.typeLabel" placeholder="请选择类型分类" clearable size="small">
15
+          <el-option
16
+            v-for="dict in dict.type.supporting_resources_classify"
17
+            :key="dict.value"
18
+            :label="dict.label"
19
+            :value="dict.value"
20
+          />
21
+        </el-select>
22
+      </el-form-item>
23
+      <el-form-item>
24
+        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
25
+        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
26
+      </el-form-item>
27
+    </el-form>
28
+
29
+    <el-row :gutter="10" class="mb8">
30
+      <el-col :span="1.5">
31
+        <el-button
32
+          type="primary"
33
+          plain
34
+          icon="el-icon-plus"
35
+          size="mini"
36
+          @click="handleAdd"
37
+          v-hasPermi="['supporting:type:add']"
38
+        >新增</el-button>
39
+      </el-col>
40
+      <el-col :span="1.5">
41
+        <el-button
42
+          type="success"
43
+          plain
44
+          icon="el-icon-edit"
45
+          size="mini"
46
+          :disabled="single"
47
+          @click="handleUpdate"
48
+          v-hasPermi="['supporting:type:edit']"
49
+        >修改</el-button>
50
+      </el-col>
51
+      <el-col :span="1.5">
52
+        <el-button
53
+          type="danger"
54
+          plain
55
+          icon="el-icon-delete"
56
+          size="mini"
57
+          :disabled="multiple"
58
+          @click="handleDelete"
59
+          v-hasPermi="['supporting:type:remove']"
60
+        >删除</el-button>
61
+      </el-col>
62
+      <el-col :span="1.5">
63
+        <el-button
64
+          type="warning"
65
+          plain
66
+          icon="el-icon-download"
67
+          size="mini"
68
+          :loading="exportLoading"
69
+          @click="handleExport"
70
+          v-hasPermi="['supporting:type:export']"
71
+        >导出</el-button>
72
+      </el-col>
73
+      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
74
+    </el-row>
75
+
76
+    <el-table v-loading="loading" :data="typeList" @selection-change="handleSelectionChange">
77
+      <el-table-column type="selection" width="55" align="center" />
78
+      <el-table-column label="类型ID" align="center" prop="typeId" />
79
+      <el-table-column label="类型名称" align="center" prop="typeName" />
80
+      <el-table-column label="类型分类" align="center" prop="typeLabel"/>
81
+      <el-table-column prop="icon" label="类型图标" align="center" width="100">
82
+        <template slot-scope="scope">
83
+          <img :src="BASE_URL + scope.row.icon" style="width: 50px; height: 50px;">
84
+        </template>
85
+      </el-table-column>
86
+
87
+      <el-table-column label="排序" align="center" prop="orderId" />
88
+      <el-table-column label="备注" align="center" prop="memo" />
89
+      <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="140">
90
+        <template slot-scope="scope">
91
+          <el-button
92
+            size="mini"
93
+            type="text"
94
+            icon="el-icon-edit"
95
+            @click="handleUpdate(scope.row)"
96
+            v-hasPermi="['supporting:type:edit']"
97
+          >修改</el-button>
98
+          <el-button
99
+            size="mini"
100
+            type="text"
101
+            icon="el-icon-delete"
102
+            @click="handleDelete(scope.row)"
103
+            v-hasPermi="['supporting:type:remove']"
104
+          >删除</el-button>
105
+        </template>
106
+      </el-table-column>
107
+    </el-table>
108
+
109
+    <pagination
110
+      v-show="total>0"
111
+      :total="total"
112
+      :page.sync="queryParams.pageNum"
113
+      :limit.sync="queryParams.pageSize"
114
+      @pagination="getList"
115
+    />
116
+
117
+    <!-- 添加或修改资源类型对话框 -->
118
+    <el-dialog :title="title" :visible.sync="open" width="800px" append-to-body>
119
+      <el-form ref="form" :model="form" :rules="rules" label-width="120px">
120
+        <el-form-item label="类型名称" prop="typeName">
121
+          <el-input v-model="form.typeName" placeholder="请输入类型名称" />
122
+        </el-form-item>
123
+        <el-form-item label="类型分类" prop="typeLabel">
124
+          <el-select v-model="form.typeLabel" placeholder="请选择类型分类">
125
+            <el-option
126
+              v-for="dict in dict.type.supporting_resources_classify"
127
+              :key="dict.value"
128
+              :label="dict.label"
129
+              :value="dict.value"
130
+            ></el-option>
131
+          </el-select>
132
+        </el-form-item>
133
+        <el-form-item label="类型图标">
134
+          <imageUpload v-model="form.icon"/>
135
+        </el-form-item>
136
+        <el-form-item label="排序" prop="orderId">
137
+          <el-input-number v-model="form.orderId" controls-position="right"   :min="0" placeholder="请输入排序" />
138
+        </el-form-item>
139
+
140
+        <el-form-item label="备注" prop="memo">
141
+          <el-input v-model="form.memo" placeholder="请输入备注" />
142
+        </el-form-item>
143
+      </el-form>
144
+      <div slot="footer" class="dialog-footer">
145
+        <el-button type="primary" @click="submitForm">确 定</el-button>
146
+        <el-button @click="cancel">取 消</el-button>
147
+      </div>
148
+    </el-dialog>
149
+  </div>
150
+</template>
151
+
152
+<script>
153
+import { listType, getType, delType, addType, updateType, exportType } from "@/api/supporting/type";
154
+
155
+export default {
156
+  name: "Type",
157
+  dicts: ['supporting_resources_classify'],
158
+  data() {
159
+    return {
160
+      BASE_URL:  BASE_URL,
161
+      // 遮罩层
162
+      loading: true,
163
+      // 导出遮罩层
164
+      exportLoading: false,
165
+      // 选中数组
166
+      ids: [],
167
+      // 非单个禁用
168
+      single: true,
169
+      // 非多个禁用
170
+      multiple: true,
171
+      // 显示搜索条件
172
+      showSearch: true,
173
+      // 总条数
174
+      total: 0,
175
+      // 资源类型表格数据
176
+      typeList: [],
177
+      // 弹出层标题
178
+      title: "",
179
+      // 是否显示弹出层
180
+      open: false,
181
+      // 查询参数
182
+      queryParams: {
183
+        pageNum: 1,
184
+        pageSize: 10,
185
+        typeName: null,
186
+        typeLabel: null,
187
+      },
188
+      // 表单参数
189
+      form: {},
190
+      // 表单校验
191
+      rules: {
192
+        typeName: [
193
+          { required: true, message: "类型名称不能为空", trigger: "blur" }
194
+        ],
195
+        typeLabel: [
196
+          { required: true, message: "类型分类不能为空", trigger: "change" }
197
+        ],
198
+      }
199
+    };
200
+  },
201
+  created() {
202
+    this.getList();
203
+  },
204
+  methods: {
205
+    /** 查询资源类型列表 */
206
+    getList() {
207
+      this.loading = true;
208
+      listType(this.queryParams).then(response => {
209
+        this.typeList = response.data.list;
210
+        this.total = response.data.total;
211
+        this.loading = false;
212
+      });
213
+    },
214
+    // 取消按钮
215
+    cancel() {
216
+      this.open = false;
217
+      this.reset();
218
+    },
219
+    // 表单重置
220
+    reset() {
221
+      this.form = {
222
+        typeId: null,
223
+        typeName: null,
224
+        typeLabel: null,
225
+        icon: null,
226
+        orderId: null,
227
+        memo: null
228
+      };
229
+      this.resetForm("form");
230
+    },
231
+    /** 搜索按钮操作 */
232
+    handleQuery() {
233
+      this.queryParams.pageNum = 1;
234
+      this.getList();
235
+    },
236
+    /** 重置按钮操作 */
237
+    resetQuery() {
238
+      this.resetForm("queryForm");
239
+      this.handleQuery();
240
+    },
241
+    // 多选框选中数据
242
+    handleSelectionChange(selection) {
243
+      this.ids = selection.map(item => item.typeId)
244
+      this.single = selection.length!==1
245
+      this.multiple = !selection.length
246
+    },
247
+    /** 新增按钮操作 */
248
+    handleAdd() {
249
+      this.reset();
250
+      this.open = true;
251
+      this.title = "添加资源类型";
252
+    },
253
+    /** 修改按钮操作 */
254
+    handleUpdate(row) {
255
+      this.reset();
256
+      const typeId = row.typeId || this.ids
257
+      getType(typeId).then(response => {
258
+        this.form = response.data;
259
+        this.open = true;
260
+        this.title = "修改资源类型";
261
+      });
262
+    },
263
+    /** 提交按钮 */
264
+    submitForm() {
265
+      this.$refs["form"].validate(valid => {
266
+        if (valid) {
267
+          if (this.form.typeId != null) {
268
+            updateType(this.form).then(response => {
269
+              this.$modal.msgSuccess("修改成功");
270
+              this.open = false;
271
+              this.getList();
272
+            });
273
+          } else {
274
+            addType(this.form).then(response => {
275
+              this.$modal.msgSuccess("新增成功");
276
+              this.open = false;
277
+              this.getList();
278
+            });
279
+          }
280
+        }
281
+      });
282
+    },
283
+    /** 删除按钮操作 */
284
+    handleDelete(row) {
285
+      const typeIds = row.typeId || this.ids;
286
+      this.$modal.confirm('是否确认删除资源类型编号为"' + typeIds + '"的数据项?').then(function() {
287
+        return delType(typeIds);
288
+      }).then(() => {
289
+        this.getList();
290
+        this.$modal.msgSuccess("删除成功");
291
+      }).catch(() => {});
292
+    },
293
+    /** 导出按钮操作 */
294
+    handleExport() {
295
+      const queryParams = this.queryParams;
296
+      this.$modal.confirm('是否确认导出所有资源类型数据项?').then(() => {
297
+        this.exportLoading = true;
298
+        return exportType(queryParams);
299
+      }).then(response => {
300
+        this.$download.name(response.msg);
301
+        this.exportLoading = false;
302
+      }).catch(() => {});
303
+    }
304
+  }
305
+};
306
+</script>