|
@@ -7,9 +7,12 @@
|
|
|
<div class="card-header">
|
|
<div class="card-header">
|
|
|
<span>设备台账区域</span>
|
|
<span>设备台账区域</span>
|
|
|
<div>
|
|
<div>
|
|
|
- <el-button type="primary" plain>
|
|
|
|
|
|
|
+ <el-button type="primary" plain @click="addOrganizational()">
|
|
|
添加
|
|
添加
|
|
|
</el-button>
|
|
</el-button>
|
|
|
|
|
+ <!-- <el-button type="primary" plain @click="updateOrganizational()">
|
|
|
|
|
+ 编辑
|
|
|
|
|
+ </el-button> -->
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
</template>
|
|
</template>
|
|
@@ -17,7 +20,14 @@
|
|
|
<LayTree :data="treeList" :tail-node-icon="false" :onlyIconControl="true" v-model:selectedKey="selectedKey"
|
|
<LayTree :data="treeList" :tail-node-icon="false" :onlyIconControl="true" v-model:selectedKey="selectedKey"
|
|
|
@node-click="handleClick">
|
|
@node-click="handleClick">
|
|
|
<template #title="{ data }">
|
|
<template #title="{ data }">
|
|
|
- {{ data.name }}
|
|
|
|
|
|
|
+ <div style="display: flex;flex-direction: row;justify-content: space-around;">
|
|
|
|
|
+ <div @click="handleClickTitle(data)">{{ data.name }}</div>
|
|
|
|
|
+ <div>
|
|
|
|
|
+ <el-icon @click="updateOrganizational(data)">
|
|
|
|
|
+ <Edit />
|
|
|
|
|
+ </el-icon>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </div>
|
|
|
</template>
|
|
</template>
|
|
|
</LayTree>
|
|
</LayTree>
|
|
|
</div>
|
|
</div>
|
|
@@ -117,7 +127,32 @@
|
|
|
</el-col>
|
|
</el-col>
|
|
|
</el-row>
|
|
</el-row>
|
|
|
|
|
|
|
|
-
|
|
|
|
|
|
|
+ <el-dialog v-model="dialogFormVisible" :title="dialogTitle">
|
|
|
|
|
+ <el-form :model="organizationalQuery">
|
|
|
|
|
+ <el-form-item label="上层位置" :label-width="formLabelWidth">
|
|
|
|
|
+ <el-tree-select v-model="organizationalQuery.parentId" :data="treeList"
|
|
|
|
|
+ :props="{ value: 'id', label: 'name', children: 'children' }" value-key="id" placeholder="请选上层位置"
|
|
|
|
|
+ check-strictly />
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ <el-form-item label="组织机构编码" :label-width="formLabelWidth">
|
|
|
|
|
+ <el-input v-model="organizationalQuery.sn" placeholder="请输入组织编码" />
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ <el-form-item label="组织机构名称" :label-width="formLabelWidth">
|
|
|
|
|
+ <el-input v-model="organizationalQuery.name" placeholder="请输入组织名称" />
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ <el-form-item label="所属公司" :label-width="formLabelWidth">
|
|
|
|
|
+ <el-input v-model="organizationalQuery.company" placeholder="请输入所属公司" />
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ </el-form>
|
|
|
|
|
+ <template #footer>
|
|
|
|
|
+ <span class="dialog-footer">
|
|
|
|
|
+ <el-button @click="dialogFormVisible = false">取消</el-button>
|
|
|
|
|
+ <el-button type="primary" @click="saveOrgainzational()">
|
|
|
|
|
+ 确认
|
|
|
|
|
+ </el-button>
|
|
|
|
|
+ </span>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </el-dialog>
|
|
|
</div>
|
|
</div>
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
@@ -127,8 +162,8 @@ import { LayTree } from "@layui/layui-vue";
|
|
|
import "@layui/layui-vue/lib/index.css";
|
|
import "@layui/layui-vue/lib/index.css";
|
|
|
|
|
|
|
|
import { useRoute, useRouter } from "vue-router";
|
|
import { useRoute, useRouter } from "vue-router";
|
|
|
-import { listEquipmentOrganizational } from "@/api/data/equipmentOrganizational"
|
|
|
|
|
-import { listEquipmentSbook } from "@/api/data/equipmentSbook"
|
|
|
|
|
|
|
+import { listEquipmentOrganizational, addEquipmentOrganizational, updateEquipmentOrganizational } from "@/api/data/equipmentOrganizational"
|
|
|
|
|
+import { listEquipmentSbook, updateEquipmentSbook } from "@/api/data/equipmentSbook"
|
|
|
import { getDicts } from '@/api/system/dict/data'
|
|
import { getDicts } from '@/api/system/dict/data'
|
|
|
|
|
|
|
|
|
|
|
|
@@ -142,22 +177,57 @@ const goadd = () => {
|
|
|
router.push("/device/equipmentdash/add")
|
|
router.push("/device/equipmentdash/add")
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+const dialogFormVisible = ref(false)
|
|
|
|
|
+
|
|
|
|
|
+const formLabelWidth = '140px'
|
|
|
|
|
+
|
|
|
|
|
+const dialogTitle = ref("新增组织架构")
|
|
|
|
|
+
|
|
|
|
|
+const form = {
|
|
|
|
|
+ name: '',
|
|
|
|
|
+ region: ''
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+const organizationalQuery = ref({
|
|
|
|
|
+ id: null,
|
|
|
|
|
+ parentId: "",
|
|
|
|
|
+ name: "",
|
|
|
|
|
+ sn: "",
|
|
|
|
|
+ company: '',
|
|
|
|
|
+ ancestors: ""
|
|
|
|
|
+})
|
|
|
|
|
+
|
|
|
|
|
+const organizationalParams = ref({
|
|
|
|
|
+ id: null,
|
|
|
|
|
+ parentId: "",
|
|
|
|
|
+ name: "",
|
|
|
|
|
+ sn: "",
|
|
|
|
|
+ company: '',
|
|
|
|
|
+ ancestors: ''
|
|
|
|
|
+})
|
|
|
|
|
|
|
|
const goUpdate = (item) => {
|
|
const goUpdate = (item) => {
|
|
|
// router.push({ name: 'EquipmentDashAdd', params: { userId: '123' }})
|
|
// router.push({ name: 'EquipmentDashAdd', params: { userId: '123' }})
|
|
|
- router.push({ path: '/device/equipmentdash/add', query:{id:item.id} })
|
|
|
|
|
|
|
+ router.push({ path: '/device/equipmentdash/add', query: { id: item.id } })
|
|
|
// router.push({ name: "EquipmentDashAdd", params: { item } })
|
|
// router.push({ name: "EquipmentDashAdd", params: { item } })
|
|
|
// router.push({path:"/device/equipmentdash/add",params:item})
|
|
// router.push({path:"/device/equipmentdash/add",params:item})
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-const handleClick = (node) => {
|
|
|
|
|
|
|
+const handleClick = (node) =>{
|
|
|
|
|
+ console.log(node);
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+const handleClickTitle = (node) => {
|
|
|
//console.log("Click Node:" + JSON.stringify(node));
|
|
//console.log("Click Node:" + JSON.stringify(node));
|
|
|
searchform.value.equipmentTreeId = node.id
|
|
searchform.value.equipmentTreeId = node.id
|
|
|
|
|
+ organizationalParams.value = node
|
|
|
|
|
+ console.log(organizationalParams.value);
|
|
|
getlistEquipmentSbook();
|
|
getlistEquipmentSbook();
|
|
|
};
|
|
};
|
|
|
const selectedKey = ref(4);
|
|
const selectedKey = ref(4);
|
|
|
const treeList = ref([]);
|
|
const treeList = ref([]);
|
|
|
const typeList = ref([]);
|
|
const typeList = ref([]);
|
|
|
|
|
+const organizationalList = ref([]);
|
|
|
|
|
|
|
|
const pagedata = ref({
|
|
const pagedata = ref({
|
|
|
total: 0,
|
|
total: 0,
|
|
@@ -212,6 +282,7 @@ const onchangepage = (page) => {
|
|
|
const getTreedata = () => {
|
|
const getTreedata = () => {
|
|
|
listEquipmentOrganizational({ pageSize: 10000 }).then(res => {
|
|
listEquipmentOrganizational({ pageSize: 10000 }).then(res => {
|
|
|
const { rows, total, page, size } = res;
|
|
const { rows, total, page, size } = res;
|
|
|
|
|
+ organizationalList.value = res.rows;
|
|
|
treeList.value = proxy.handleTree(res.rows, "id", "parentId");
|
|
treeList.value = proxy.handleTree(res.rows, "id", "parentId");
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
@@ -245,23 +316,76 @@ const getDictsData = () => {
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-const getTypeName = (scope) => {
|
|
|
|
|
- var equipment = toRaw(scope)
|
|
|
|
|
- if (equipment != null) {
|
|
|
|
|
- for (var index in typeList.value) {
|
|
|
|
|
- var obj = toRaw(typeList.value[index]);
|
|
|
|
|
- console.log(obj.dictValue);
|
|
|
|
|
- console.log(equipment.equipmentTypeId);
|
|
|
|
|
- if (obj.dictValue == equipment.equipmentTypeId) {
|
|
|
|
|
- console.log(obj.dictLabel);
|
|
|
|
|
- return obj.dictLabel
|
|
|
|
|
- }
|
|
|
|
|
|
|
+const addOrganizational = () => {
|
|
|
|
|
+ organizationalQuery.value = {
|
|
|
|
|
+ id: null,
|
|
|
|
|
+ parentId: "",
|
|
|
|
|
+ name: "",
|
|
|
|
|
+ sn: "",
|
|
|
|
|
+ company: '',
|
|
|
|
|
+ ancestors: ''
|
|
|
|
|
+ }
|
|
|
|
|
+ dialogTitle.value = "新增组织架构"
|
|
|
|
|
+ dialogFormVisible.value = true
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+const updateOrganizational = (data) => {
|
|
|
|
|
+ organizationalQuery.value = data
|
|
|
|
|
+ dialogTitle.value = "修改组织架构"
|
|
|
|
|
+ dialogFormVisible.value = true
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+// const getTypeName = (scope) => {
|
|
|
|
|
+// var equipment = toRaw(scope)
|
|
|
|
|
+// if (equipment != null) {
|
|
|
|
|
+// for (var index in typeList.value) {
|
|
|
|
|
+// var obj = toRaw(typeList.value[index]);
|
|
|
|
|
+// console.log(obj.dictValue);
|
|
|
|
|
+// console.log(equipment.equipmentTypeId);
|
|
|
|
|
+// if (obj.dictValue == equipment.equipmentTypeId) {
|
|
|
|
|
+// console.log(obj.dictLabel);
|
|
|
|
|
+// return obj.dictLabel
|
|
|
|
|
+// }
|
|
|
|
|
+// }
|
|
|
|
|
+// }
|
|
|
|
|
+// }
|
|
|
|
|
+
|
|
|
|
|
+const saveOrgainzational = () => {
|
|
|
|
|
+ for (var index in organizationalList.value) {
|
|
|
|
|
+ if (organizationalQuery.value.parentId == organizationalList.value[index].id) {
|
|
|
|
|
+ console.log(organizationalList.value[index]);
|
|
|
|
|
+ organizationalQuery.value.ancestors = organizationalList.value[index].ancestors + "," + organizationalList.value[index].id
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+ console.log(organizationalQuery.value.id);
|
|
|
|
|
+ if (organizationalQuery.value.id != null) {
|
|
|
|
|
+ updateEquipmentOrganizational(organizationalQuery.value).then(res => {
|
|
|
|
|
+ console.log(res);
|
|
|
|
|
+ if (res.code == 200) {
|
|
|
|
|
+ getTreedata();
|
|
|
|
|
+ dialogFormVisible.value = false
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+ } else {
|
|
|
|
|
+ addEquipmentOrganizational(organizationalQuery.value).then(res => {
|
|
|
|
|
+ if (res.code == 200) {
|
|
|
|
|
+ getTreedata();
|
|
|
|
|
+ dialogFormVisible.value = false
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
const deleteDevice = (scope) => {
|
|
const deleteDevice = (scope) => {
|
|
|
- console.log(scope)
|
|
|
|
|
|
|
+ console.log(scope.id)
|
|
|
|
|
+ var obj = {
|
|
|
|
|
+ id: scope.id,
|
|
|
|
|
+ isDelete: 1
|
|
|
|
|
+ }
|
|
|
|
|
+ updateEquipmentSbook(obj).then(res => {
|
|
|
|
|
+ getlistEquipmentSbook();
|
|
|
|
|
+ })
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
getTreedata();
|
|
getTreedata();
|