|
@@ -109,9 +109,10 @@
|
|
|
<el-input v-model="form.latitude" placeholder="请输入维度"/>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="部门名称" prop="parentId">
|
|
|
- <treeselect v-model="form.parentId" :normalizer="normalizer" :options="deptOptions"
|
|
|
+ <treeselect v-model="form.parentId" :options="deptOptions" :show-count="true"
|
|
|
placeholder="请选择部门名称"/>
|
|
|
</el-form-item>
|
|
|
+<!-- :normalizer="normalizer"-->
|
|
|
</el-form>
|
|
|
<div slot="footer" class="dialog-footer">
|
|
|
<el-button type="primary" @click="submitForm">确 定</el-button>
|
|
@@ -126,6 +127,7 @@ import {addCamera, delCamera, getCamera, getCameraList, listCamera, updateCamera
|
|
|
import Treeselect from "@riophae/vue-treeselect";
|
|
|
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
|
|
|
import {listDept} from "@/api/system/dept";
|
|
|
+import {deptTreeSelect} from "@/api/system/user";
|
|
|
|
|
|
export default {
|
|
|
name: "Camera",
|
|
@@ -173,6 +175,7 @@ export default {
|
|
|
},
|
|
|
created() {
|
|
|
this.getList();
|
|
|
+ this.getDeptTree();
|
|
|
},
|
|
|
methods: {
|
|
|
handleDept(){},
|
|
@@ -185,26 +188,27 @@ export default {
|
|
|
this.getList();
|
|
|
})
|
|
|
},
|
|
|
- /** 查询部门列表 */
|
|
|
- getDeptList() {
|
|
|
- this.loading = true;
|
|
|
- listDept({}).then(response => {
|
|
|
- this.deptList = this.handleTree(response.data, "deptId");
|
|
|
- this.loading = false;
|
|
|
- });
|
|
|
- console.log("deptList", this.deptList);
|
|
|
- },
|
|
|
+ // /** 查询部门列表 */
|
|
|
+ // getDeptList() {
|
|
|
+ // this.loading = true;
|
|
|
+ // listDept({}).then(response => {
|
|
|
+ // this.deptList = this.handleTree(response.data, "deptId");
|
|
|
+ // this.loading = false;
|
|
|
+ // });
|
|
|
+ // console.log("deptList", this.deptList);
|
|
|
+ // },
|
|
|
+
|
|
|
/** 转换部门数据结构 */
|
|
|
- normalizer(node) {
|
|
|
- if (node.children && !node.children.length) {
|
|
|
- delete node.children;
|
|
|
- }
|
|
|
- return {
|
|
|
- id: node.deptId,
|
|
|
- label: node.deptName,
|
|
|
- children: node.children
|
|
|
- };
|
|
|
- },
|
|
|
+ // normalizer(node) {
|
|
|
+ // if (node.children && !node.children.length) {
|
|
|
+ // delete node.children;
|
|
|
+ // }
|
|
|
+ // return {
|
|
|
+ // id: node.deptId,
|
|
|
+ // label: node.deptName,
|
|
|
+ // children: node.children
|
|
|
+ // };
|
|
|
+ // },
|
|
|
/** 查询摄像头列表 */
|
|
|
getList() {
|
|
|
this.loading = true;
|
|
@@ -214,6 +218,25 @@ export default {
|
|
|
this.loading = false;
|
|
|
});
|
|
|
},
|
|
|
+ /** 查询部门下拉树结构 */
|
|
|
+ getDeptTree() {
|
|
|
+ deptTreeSelect().then(response => {
|
|
|
+ this.deptOptions = response.data;
|
|
|
+ this.enabledDeptOptions = this.filterDisabledDept(JSON.parse(JSON.stringify(response.data)));
|
|
|
+ });
|
|
|
+ },
|
|
|
+ // 过滤禁用的部门
|
|
|
+ filterDisabledDept(deptList) {
|
|
|
+ return deptList.filter(dept => {
|
|
|
+ if (dept.disabled) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ if (dept.children && dept.children.length) {
|
|
|
+ dept.children = this.filterDisabledDept(dept.children);
|
|
|
+ }
|
|
|
+ return true;
|
|
|
+ });
|
|
|
+ },
|
|
|
// 取消按钮
|
|
|
cancel() {
|
|
|
this.open = false;
|
|
@@ -255,7 +278,7 @@ export default {
|
|
|
/** 新增按钮操作 */
|
|
|
handleAdd() {
|
|
|
this.reset();
|
|
|
- this.getDeptList();
|
|
|
+ // this.getDeptList();
|
|
|
this.open = true;
|
|
|
this.title = "添加摄像头";
|
|
|
},
|