123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531 |
- <template>
- <div class="container">
- <div class="left-pane">
- <el-input
- placeholder="告警类别"
- v-model="filterText"
- class="left-input"
- suffix-icon="el-icon-search"
- >
- </el-input>
- <div class="tree_container">
- <el-tree
- ref="tree"
- :data="deviceTypeList"
- :props="defaultProps"
- node-key="id"
- default-expand-all
- :filter-node-method="filterNode"
- @node-click="handleNodeClick"
- >
- <span slot-scope="{ node, data }">
- <!-- <el-image :src="data.url"></el-image> -->
- <span style="padding-left: 10px; vertical-align: text-bottom">{{
- node.label
- }}</span>
- <span class="operate_btns">
- <dropdown
- :events="data.id ? menuEvents : subMenuEvents"
- :data="{ node, data }"
- @itemClick="dropDownClick"
- ></dropdown>
- </span>
- </span>
- </el-tree>
- </div>
- <el-button
- class="newDevice"
- @click="newDeviceType()"
- ><i class="el-icon-s-order"></i>新建设备类别</el-button>
- </div>
- <div class="right-pane">
- <div class="right-pane-inner">
- <div class="top">
- <el-button
- @click="addDevice()"
- class="add-btn"
- >添加设备</el-button>
- <el-button
- @click="dataImport()"
- class="import-btn"
- >批量导入</el-button>
- <!-- <el-button @click="batchDelete" class="delete-btn"
- >批量删除</el-button
- > -->
- <el-input
- class="search-input"
- v-model="searchInput"
- placeholder="请输入搜索内容"
- >
- <template slot="append">
- <i
- class="el-icon-search"
- style="cursor: pointer"
- @click="searchTypeEvent"
- ></i>
- </template>
- </el-input>
- </div>
- <div class="center">
- <el-table
- ref="multipleTable"
- :data="tableData"
- tooltip-effect="dark"
- :header-cell-style="{ textAlign: 'center' }"
- :cell-style="{ textAlign: 'center' }"
- style="width: 100%"
- height="500"
- @selection-change="handleSelectionChange"
- >
- <el-table-column
- type="selection"
- width="50"
- > </el-table-column>
- <el-table-column
- type="index"
- width="80"
- label="序号"
- >
- </el-table-column>
- <el-table-column
- prop="deviceName"
- label="设备名称"
- >
- </el-table-column>
- <el-table-column
- prop="deviceID"
- label="设备ID"
- > </el-table-column>
- <el-table-column
- prop="deviceUse"
- label="设备用途"
- >
- </el-table-column>
- <el-table-column
- prop="devicePosition"
- label="设备位置"
- >
- </el-table-column>
- <el-table-column
- prop="deviceLife"
- label="设备使用年限"
- >
- </el-table-column>
- <el-table-column
- prop="company"
- label="设备单位"
- > </el-table-column>
- <el-table-column
- prop="deviceRespon"
- label="设备责任人"
- >
- </el-table-column>
- <el-table-column
- prop="operation"
- label="操作"
- >
- <template slot-scope="scope">
- <el-button
- v-show="scope.row.deviceID == null ? false : true"
- size="mini"
- type="text"
- @click="deviceEdit"
- style="color: #2ea8e6"
- >编辑</el-button>
- <el-button
- v-show="scope.row.deviceID == null ? false : true"
- size="mini"
- type="text"
- style="color: #2ea8e6"
- @click="deviceDelete(scope.row)"
- >删除</el-button>
- </template>
- </el-table-column>
- </el-table>
- </div>
- <div class="bottom">
- <page :paginationData="paginationData"></page>
- </div>
- </div>
- </div>
- <!--弹窗-->
- <NewDeviceType
- ref="newDevice"
- v-bind="{
- update:getDeviceTypeList
- }"
- ></NewDeviceType>
- <addDevice ref="addDevice"></addDevice>
- <dataImport ref="dataImport"></dataImport>
- <deviceEdit ref="deviceEdit"></deviceEdit>
- </div>
- </template>
- <script>
- import checkbox from "@/components/Checkbox/index";
- import page from "@/components/pagination/index";
- import NewDeviceType from "./messageDailog/newDeviceType";
- import dataImport from "./messageDailog/dataImport";
- import addDevice from "./messageDailog/addDevice";
- import deviceEdit from "./messageDailog/deviceEdit";
- import dropdown from "@/components/Dropdown/index";
- import api from "@/api/deviceManagement/api";
- export default {
- components: {
- checkbox,
- page,
- NewDeviceType,
- dataImport,
- addDevice,
- deviceEdit,
- dropdown,
- },
- data() {
- return {
- searchInput: "",
- filterText: "",
- filter: "",
- form: {
- typeName: "",
- },
- deviceTypeList: [
- // {
- // id: 1,
- // label: "A设备",
- // },
- // {
- // id: 2,
- // label: "B设备",
- // },
- ],
- defaultProps: {
- children: "children",
- label: "label",
- },
- menuEvents: [
- { label: "新建", funcName: "addNode" },
- { label: "上移", funcName: "moveUp" },
- { label: "下移", funcName: "moveDown" },
- { label: "编辑", funcName: "editNode" },
- { label: "删除", funcName: "removeNode" },
- ],
- subMenuEvents: [
- { label: "新建", funcName: "addNode" },
- { label: "上移", funcName: "moveUp" },
- { label: "下移", funcName: "moveDown" },
- { label: "编辑", funcName: "editNode" },
- { label: "删除", funcName: "removeNode" },
- ],
- tableData: [
- {
- deviceName: "摄像头",
- deviceID: "SXT-001",
- deviceUse: "监控摄像头",
- devicePosition: "1层101",
- deviceLife: "3年6个月",
- company: "北京电信规划院",
- deviceRespon: "张三",
- },
- {
- deviceName: "摄像头",
- deviceID: "SXT-001",
- deviceUse: "监控摄像头",
- devicePosition: "1层101",
- deviceLife: "3年6个月",
- company: "北京电信规划院",
- deviceRespon: "张三",
- },
- {
- deviceName: "摄像头",
- deviceID: "SXT-001",
- deviceUse: "监控摄像头",
- devicePosition: "1层101",
- deviceLife: "3年6个月",
- company: "北京电信规划院",
- deviceRespon: "张三",
- },
- ],
- multipleSelection: [],
- show: true,
- paginationData: {
- pageSize: 10,
- pagerCount: 5,
- currentPage: 1,
- pageSizes: [5, 10, 20, 30],
- total: 30,
- currentChange: (val) => {
- this.getTableData(val);
- },
- handleSizeChange: (val) => {
- this.handleSizeChange(val);
- },
- },
- };
- },
- mounted() {
- this.getDeviceTypeList();
- },
- watch: {
- filterText(val) {
- this.$refs.tree.filter(val);
- },
- },
- methods: {
- getDeviceTypeList() {
- let that = this;
- api
- .getDeviceTypeList()
- .then((result) => {
- that.deviceTypeList = result.data.data.map(function (item) {
- item.label = item.type_name;
- return item;
- });
- })
- .catch((err) => {});
- },
- searchTypeEvent() {},
- dropDownClick() {},
- getTableData(val) {},
- handleSizeChange(val) {},
- filterNode(value, data) {
- if (!value) return true;
- return data.label.indexOf(value) !== -1;
- },
- newDeviceType() {
- this.$refs.newDevice.dialogVisible = true;
- },
- dataImport() {
- this.$refs.dataImport.dialogVisible = true;
- },
- addDevice() {
- this.$refs.addDevice.dialogVisible = true;
- },
- deviceEdit() {
- this.$refs.deviceEdit.dialogVisible = true;
- },
- deviceDelete(data) {
- // this.tableData = this.tableData.filter(()=>{
- // })
- },
- handleSelectionChange() {
- //
- },
- handleNodeClick() {
- //
- },
- batchDelete() {},
- },
- };
- </script>
- <style lang="less" scoped>
- .container {
- width: 100%;
- height: 100%;
- background-color: rgba(255, 255, 255, 1);
- color: rgba(16, 16, 16, 1);
- font-size: 14px;
- // text-align: center;
- box-shadow: 0px 0px 4px 0px rgba(0, 0, 0, 0.15);
- display: flex;
- align-items: center;
- .left-pane {
- width: 300px;
- padding: 15px;
- height: calc(100% - 31px);
- .tree_container {
- height: calc(100% - 101px);
- margin-top: 10px;
- margin-bottom: 10px;
- overflow: hidden;
- overflow-y: auto;
- .el-tree {
- height: 100%;
- background-color: #fafafa;
- /deep/.el-tree-node__content {
- align-items: center;
- height: 30px;
- cursor: pointer;
- font-size: 16px;
- position: relative;
- color: #999999;
- padding-top: 10px;
- padding-left: 30px !important;
- .operate_btns {
- position: absolute;
- right: 20px;
- display: none;
- }
- &:hover,
- :focus-within {
- background-color: #f7fbff;
- .operate_btns {
- display: inline;
- }
- }
- }
- /deep/.el-tree-node__children {
- .el-tree-node__content {
- padding-left: 60px !important;
- }
- }
- }
- }
- .newDevice {
- position: relative;
- // bottom: 50px;
- width: 250px;
- text-align: center;
- font-size: 16px;
- color: #fff;
- background: #3da0d6;
- margin-left: 24px;
- color: #fff;
- }
- }
- .right-pane {
- width: calc(100% - 300px);
- height: 100%;
- display: flex;
- align-items: center;
- justify-content: center;
- &-inner {
- width: calc(100% - 15px);
- height: calc(100% - 15px);
- .top {
- height: 80px;
- width: 100%;
- position: relative;
- .add-btn,
- .import-btn,
- .delete-btn {
- color: #fff;
- }
- .add-btn {
- position: absolute;
- background: #2ea8e6;
- top: 20px;
- left: 20px;
- }
- .import-btn {
- position: absolute;
- background: #2ea8e6;
- top: 20px;
- left: 130px;
- }
- .delete-btn {
- position: absolute;
- background: #b3b3b3;
- top: 20px;
- left: 250px;
- }
- .search-input {
- position: absolute;
- top: 20px;
- right: 30px;
- width: 300px;
- }
- }
- .center {
- width: 100%;
- height: calc(100% - 150px);
- .el-table {
- // height: 100%;
- border: 1px solid #f0f2f2;
- margin-top: 10px;
- font-size: 0.95rem;
- font-family: PingFang SC;
- font-weight: 500;
- color: #b2b2b2;
- background: rgba(255, 255, 255, 0.8);
- /deep/th {
- background: #f7fbff;
- }
- /deep/.el-checkbox {
- color: #b2b2b2;
- .el-checkbox__input.is-checked + .el-checkbox__label {
- color: #2ea8e6;
- }
- .el-checkbox__input.is-checked .el-checkbox__inner::after {
- width: 70%;
- height: 70%;
- background: #2ea8e6;
- border-radius: 0;
- transform: rotate(0deg) scaleY(1);
- position: static;
- // border: 1px solid #8DD9FF;
- }
- .el-checkbox__inner {
- border: 1px solid #8dd9ff;
- background: rgba(0, 170, 255, 0);
- display: flex;
- align-items: center;
- justify-content: center;
- position: static;
- &::after {
- transition: 0ms;
- }
- }
- .el-checkbox__label {
- padding-left: 0;
- font-size: 15px;
- position: absolute;
- top: 1px;
- left: 25px;
- }
- }
- }
- }
- .bottom {
- height: 70px;
- width: 100%;
- position: relative;
- }
- }
- }
- .el-form {
- margin: 30px 0 0 0;
- .el-form-item {
- margin-inline: 20px;
- margin-bottom: 0;
- }
- /deep/.el-form-item__label {
- padding: 0;
- }
- /deep/.el-form-item__content {
- display: flex;
- }
- /deep/.el-input__inner {
- width: 300px;
- }
- }
- // /deep/.el-dialog__title {
- // margin-right: 330px;
- // }
- /deep/.el-dialog__headerbtn {
- font-size: 25px;
- }
- /deep/.el-dialog__body {
- padding: 0;
- }
- }
- </style>
|