Просмотр исходного кода

wanda-adm:feat > 设备筛选添加假数据

shaun-sheep 4 лет назад
Родитель
Сommit
ea8ac2e0d3
3 измененных файлов с 121 добавлено и 50 удалено
  1. 3 4
      src/layout/components/Sidebar/SidebarItem.vue
  2. 114 44
      src/views/maintain/device/index.vue
  3. 4 2
      vue.config.js

+ 3 - 4
src/layout/components/Sidebar/SidebarItem.vue

@@ -38,8 +38,7 @@ import { isExternal } from "@/utils/validate";
 import SidebarItemLink from "./SidebarItemLink.vue";
 
 @Component({
-    // Set 'name' here to prevent uglifyjs from causing recursive component not work
-    // See https://medium.com/haiiro-io/element-component-name-with-vue-class-component-f3b435656561 for detail
+    // 在此处设置'name'以防止uglifyjs导致递归组件无法工作
     name: "SidebarItem",
     components: {
         SidebarItemLink,
@@ -76,8 +75,8 @@ export default class extends Vue {
                 }
             }
         }
-        // If there is no children, return itself with path removed,
-        // because this.basePath already conatins item's path information
+        // 如果没有子级,则返回自身并移除路径
+        // 因为此.basePath已包含项的路径信息
         return { ...this.item, path: "" };
     }
 

+ 114 - 44
src/views/maintain/device/index.vue

@@ -2,22 +2,23 @@
     <div class="adm-device">
         <statistics :statistics-msg="statisticsMsg"/>
         <div class="operation">
-            <el-select
-                v-model="deviceType"
-                placeholder="请选择"
-                @change="handleFilter"
-                clearable
-                filterable
-                class="adm-select"
-            >
-                <el-option
-                    v-for="item in list"
-                    :key="item.code"
-                    :label="item.name"
-                    :value="item.code"
-
-                />
-            </el-select>
+<!--            <el-select-->
+<!--                v-model="deviceType"-->
+<!--                placeholder="请选择"-->
+<!--                @change="handleFilter"-->
+<!--                clearable-->
+<!--                filterable-->
+<!--                class="adm-select"-->
+<!--            >-->
+<!--                <el-option-->
+<!--                    v-for="item in list"-->
+<!--                    :key="item.code"-->
+<!--                    :label="item.name"-->
+<!--                    :value="item.code"-->
+
+<!--                />-->
+<!--            </el-select>-->
+            <el-cascader :options="options" clearable v-model="linshi" @change="changeLinshi"  class="adm-select" ></el-cascader>
             <admSearch @SearchValue="SearchValue"/>
             <el-button type="default" @click="addDevice" class="adm-btn">添加设备</el-button>
         </div>
@@ -27,7 +28,8 @@
                 <el-tab-pane v-for="(item,index) in paneMsg" :key="index" :label="item" :name="index.toString()"/>
             </el-tabs>
             <div class="table" v-loading="loading">
-                <template v-if="deviceType">
+<!--                <template v-if="deviceType">-->
+                <template v-if="linshi.length >0">
                     <admMultiTable :currentHeader="currentHeader" :tableData="tableData" :headersStage="headersStage"/>
                     <Pagination v-if="tableData.length > 0" :paginationList="paginationList"
                                 @handleCurrentChange="handleCurrentChange"
@@ -93,6 +95,30 @@ import tools from "@/utils/maintain"
     components: { Statistics, AdmSearch, AdmMultiTable, Pagination, dataForm }
 })
 export default class extends Vue {
+    // 临时假数据
+    linshi=''
+    options= [{
+        value: 'zhinan',
+        label: '水景系统',
+        children: [{
+            value: 'ACATAH',
+            label: '空调机组',
+        }, {
+            value: 'ACATFC',
+            label: '风机盘管',
+        }]
+    },{
+        value: 'zzzz',
+        label: '室外动力系统',
+        children: [{
+            value: 'ACATFU',
+            label: '新风机组',
+        }, {
+            value: 'ACATIO',
+            label: '空调风口',
+        }]
+    }]
+
     // loading
     loading = false
     // 统计信息对象
@@ -146,7 +172,7 @@ export default class extends Vue {
     }
 
     created() {
-        this.deviceList();
+        // this.deviceList();
         this.dataCount()
     }
 
@@ -158,32 +184,73 @@ export default class extends Vue {
     }
 
 // 设备类数据
-    deviceList() {
-        let param2 = {
-            distinct: true,
-            pageNumber: 1,
-            pageSize: 1000,
-            projection: ["classCode"],
-            projectId: this.projectId
-        }
-        let promise = new Promise(resolve => {
-            dictType({}).then(res => {
-                resolve(res)
+//     deviceList() {
+//         let param2 = {
+//             distinct: true,
+//             pageNumber: 1,
+//             pageSize: 1000,
+//             projection: ["classCode"],
+//             projectId: this.projectId
+//         }
+//         let promise = new Promise(resolve => {
+//             dictType({}).then(res => {
+//                 resolve(res)
+//             })
+//         })
+//         let promise2 = new Promise(resolve => {
+//             queryEquip(param2).then(res => {
+//                 resolve(res)
+//             })
+//         })
+//         Promise.all([promise, promise2]).then((res) => {
+//             let allData = res[0].content;
+//             let deviceInformation = res[1].content
+//             allData.filter(item => (deviceInformation.indexOf(item.code) > -1))
+//             this.list = allData
+//         })
+//     }
+
+
+    // todo 临时假数据函数
+    private changeLinshi(val) {
+        console.log(this.linshi,this.linshi[1])
+        if (this.linshi[1]) {
+            this.loading = true
+            let param = {
+                category: this.linshi[1]
+            }
+            let param2 = {
+                filters: this.linshi[1] ? `classCode='${ this.linshi[1] }'` : undefined,
+                pageNumber: this.paginationList.page,
+                pageSize: this.paginationList.size,
+                orders: "createTime desc, id asc",
+                projectId: this.projectId
+            }
+            if (this.inputSearch != '') {
+                param2.filters += `;codeName contain '${ this.inputSearch }' or systemCategory contain '${ this.inputSearch }' or bimTypeId contain '${ this.inputSearch }' or localId contain '${ this.inputSearch }'`
+            }
+            let promise = new Promise(resolve => {
+                dictInfo(param).then(res => {
+                    resolve(res)
+                })
             })
-        })
-        let promise2 = new Promise(resolve => {
-            queryEquip(param2).then(res => {
-                resolve(res)
+            let promise2 = new Promise(resolve => {
+                queryEquip(param2).then(res => {
+                    resolve(res)
+                })
             })
-        })
-        Promise.all([promise, promise2]).then((res) => {
-            let allData = res[0].content;
-            let deviceInformation = res[1].content
-            allData.filter(item => (deviceInformation.indexOf(item.code) > -1))
-            this.list = allData
-        })
+            Promise.all([promise, promise2]).then(res => {
+                this.loading = false
+                // 类型下信息点,默认设计阶段
+                this.headerInformation = res[0] // 获取表头
+                this.tableData = res[1].content // 主体数据
+                this.headerStage()
+                this.paginationList.total = res[1].total
+            })
+        } else {
+            this.headerInformation = {}
+        }
     }
-
     private handleFilter(val) {
         console.log(this.deviceType)
         if (this.deviceType) {
@@ -336,19 +403,22 @@ export default class extends Vue {
     // 搜索
     SearchValue(val: string) {
         this.inputSearch = val
-        this.handleFilter(this.deviceType)
+        // this.handleFilter(this.deviceType)
+        this.changeLinshi(this.linshi[1])
     }
 
     // 当前分页
     handleCurrentChange(val: number) {
         console.log(val)
         this.paginationList.page = val
-        this.handleFilter(this.deviceType)
+        // this.handleFilter(this.deviceType)
+        this.changeLinshi(this.linshi[1])
     }
 
     handleSizeChange(val: number) {
         this.paginationList.size = val
-        this.handleFilter(this.deviceType)
+        // this.handleFilter(this.deviceType)
+        this.changeLinshi(this.linshi[1])
     }
 
     // 添加设备

+ 4 - 2
vue.config.js

@@ -3,10 +3,11 @@ const name = "wanda-adm";
 const devServerPort = 28888;
 const stageServerPort = 28889;
 module.exports = {
-    // TODO: Remember to change publicPath to fit your need
+    // TODO: 更改 publicPath 打包静态文件目录的配置
     publicPath: process.env.NODE_ENV === "production" ? "/" : "/",
     // TODO:打包名称
     outputDir: "wanda-adm",
+    //TODO: eslint 是否在保存时检查
     lintOnSave: process.env.NODE_ENV === "development",
     productionSourceMap: false,
     devServer: {
@@ -58,7 +59,7 @@ module.exports = {
             }
         }
     },
-
+    //配置插件
     pluginOptions: {
         "style-resources-loader": {
             preProcessor: "scss",
@@ -68,6 +69,7 @@ module.exports = {
             ]
         }
     },
+    // 高级配置
     chainWebpack(config) {
         //在html网页包插件的选项列表中提供应用程序的标题,以便
         //可以在中访问索引.html插入正确的标题。