Browse Source

wanda-adm:feat > 维护位置上一步数据回显,空间搜索功能

shaun-sheep 4 years ago
parent
commit
137f494c71
2 changed files with 21 additions and 18 deletions
  1. 11 12
      src/views/maintain/device/index.vue
  2. 10 6
      src/views/maintain/space/index.vue

+ 11 - 12
src/views/maintain/device/index.vue

@@ -32,7 +32,6 @@
         </div>
         <!--        添加/编辑 设备-->
         <el-scrollbar style="height:400px;">
-
             <el-dialog
                 :title="deviceMsg"
                 :visible.sync="dialogVisible"
@@ -40,11 +39,11 @@
             >
                 <template slot="title">
                     <div class="alertTitle">
-                        <span>添加设备</span>
+                        <span>{{deviceMsg}}</span>
                         <el-button type="text"><span class="el-icon-question"></span>维护帮助</el-button>
                     </div>
                 </template>
-                <template v-if="status == '添加'">
+                <template v-if="deviceMsg == '添加设备'">
                     <template v-if="next">
                         <div class="align" style="height: 400px">
                             <span class="text ">设备类别</span>
@@ -62,9 +61,7 @@
                         </span>
                     </template>
                     <template v-else>
-                        <div>
-                            <dataForm :deviceHeaders="deviceHeaders" ref="dataForm"/>
-                        </div>
+                        <dataForm :deviceHeaders="deviceHeaders" ref="dataForm" :currRowContent="currRowContent"/>
                         <span slot="footer" class="dialog-footer">
                          <el-button type="primary" @click="handleDataForm">确 定</el-button>
                          <el-button @click="handlePosition">维护位置</el-button>
@@ -80,7 +77,7 @@
                         </span>
                     </template>
                     <template v-else>
-                        <dataForm :deviceHeaders="deviceHeaders"  ref="dataForm" :currRowContent="currRowContent"/>
+                        <dataForm :deviceHeaders="deviceHeaders" ref="dataForm" :currRowContent="currRowContent"/>
                         <span slot="footer" class="dialog-footer">
                          <el-button type="primary" @click="handleDataForm">确 定</el-button>
                          <el-button @click="handlePosition">维护位置</el-button>
@@ -155,7 +152,7 @@ export default class extends Vue {
     // 下一步
     next = true
     // 弹窗 title
-    deviceMsg = '添加设备'
+    deviceMsg = ''
     // 默认当前阶段
     currentHeader = ''
     // 主体数据
@@ -164,8 +161,7 @@ export default class extends Vue {
     deviceHeaders = {}
     // 当前行数据
     currRowContent = {}
-    // 弹窗显示
-    status = '添加'
+
     // 维护位置开关
     maintain = ''
     // 传到维护位置的设备信息
@@ -380,7 +376,7 @@ export default class extends Vue {
 
     // 添加设备
     addDevice() {
-        this.status = '添加'
+        this.deviceMsg = '添加设备'
         this.dialogVisible = true
         this.currRowContent = {}
     }
@@ -388,6 +384,7 @@ export default class extends Vue {
 
     // 维护位置
     handlePosition() {
+        this.currentRow = this.$refs.dataForm.form
         this.$refs.dataForm.submitForm(this.handlePositionSave)
     }
 
@@ -415,7 +412,7 @@ export default class extends Vue {
 
     // 编辑当前行
     handleCurrentEdit(val: object) {
-        this.status = '编辑'
+        this.deviceMsg = '编辑设备'
         this.currRowContent = val
         this.handleNext()
         this.dialogVisible = true
@@ -500,6 +497,8 @@ export default class extends Vue {
     // 返回
     goBack() {
         this.displayLocation = false
+        this.currRowContent = this.currentRow
+        console.log(this.currentRow, this.currRowContent)
     }
 
     @Watch("deviceType", { immediate: true, deep: true })

+ 10 - 6
src/views/maintain/space/index.vue

@@ -296,28 +296,32 @@ export default class spaceIndex extends Vue {
                 pageSize: this.paginationList.size,
                 orders: "createTime asc, localName asc, localId desc, id asc",
             };
-
+            let search = this.inputSearch ? `;localName contain '${ this.inputSearch }' or localId contain '${ this.inputSearch }'` : undefined
             if (this.building.length === 1) {
                 param2.filters = "";
                 switch (this.building[0]) {
                     case "noKnow":
-                        param2.filters = `buildingId='isnull'`;
+                        param2.filters = `buildingId='isnull'${ search }`;
                         break;
                     case "all":
-                        delete param2.filters;
+                        if (this.inputSearch) {
+                            param2.filters = `localName contain '${ this.inputSearch }' or localId contain '${ this.inputSearch }'`
+                        } else {
+                            delete param2.filters;
+                        }
                         break;
                 }
             } else if (this.building.length === 2) {
                 switch (this.building[1]) {
                     case "noKnow":
-                        param2.filters = `buildingId='${ this.building[0] }';floorId='isnull'`;
+                        param2.filters = `buildingId='${ this.building[0] }';floorId='isnull'${ search }`;
 
                         break;
                     case "all":
-                        param2.filters = `buildingId='${ this.building[0] }'`;
+                        param2.filters = `buildingId='${ this.building[0] }'${ search }`;
                         break;
                     default:
-                        param2.filters = `buildingId='${ this.building[0] }';floorId='${ this.building[1] }'`;
+                        param2.filters = `buildingId='${ this.building[0] }';floorId='${ this.building[1] }'${ search }`;
                 }
             }