zhibin 6 anni fa
parent
commit
15c15200eb

+ 1 - 0
src/main.js

@@ -11,6 +11,7 @@ import '@/util/dateHandle'
 Vue.use(ElementUI)
 Vue.config.productionTip = false
 Vue.prototype.$http = http
+Vue.prototype.$bus = new Vue()
 
 setHandle(router)
 

+ 1 - 1
src/page/layout/slide.vue

@@ -54,7 +54,7 @@ export default {
         text: '更多设置',
         link: {name: 'home'},
         children: [
-          { text: '场景管理', link: {name: 'home'} },
+          { text: '场景管理', link: {name: 'scene'} },
           { text: '反馈消息', link: {name: 'feedback'} },
           { text: '设备管理', link: {name: 'device'} }
         ],

+ 27 - 1
src/page/layout/title.vue

@@ -1,6 +1,9 @@
 <template>
   <div class="title-layout">
-    <span class="label">{{routes[routes.length - 1]}}</span>
+    <div>
+      <span class="label">{{routes[routes.length - 1]}}</span>
+      <div v-html="temp" class="temp"></div>
+    </div>
     <div class="router">
       <span>系统后台</span>
       <span v-for="route in routes" :key="route">{{route}}</span>
@@ -23,6 +26,16 @@ function queryPath (routes, route, path) {
 }
 
 export default {
+  data () {
+    return {
+      temp: ''
+    }
+  },
+  mounted () {
+    this.$bus.$on('title-f', temp => {
+      this.temp = temp
+    })
+  },
   computed: {
     routes () {
       let routes = []
@@ -56,6 +69,11 @@ export default {
   font-weight: normal;
 }
 
+.temp {
+  display: inline-block;
+  margin-left: 10px;
+}
+
 .router span {
   color: rgb(153, 153, 153);
   font-size: 14px;
@@ -70,3 +88,11 @@ export default {
   display: none;
 }
 </style>
+
+<style>
+.temp span {
+  color: rgb(245, 108, 108);
+  margin-left: 20px;
+  font-size: 14px;
+}
+</style>

+ 267 - 630
src/page/scene/index.vue

@@ -1,213 +1,213 @@
 <template>
-  <div id="scene-management">
-
-    <div class="scene-management-body" v-loading.fullscreen.lock="fullscreenLoading">
-      <div class="order-management-body">
-        <div class="order-management-inner">
-          <div class="base-info">
-            <span>关键词:</span>
-            <el-input  @keyup.enter.native="_sceneSearch" ref="searchKey" value="" placeholder="关键词"></el-input>
-            <el-button type="primary" @click="_sceneSearch" color='red'>搜索</el-button>
-          </div>
+  <div class="scene-management-body" v-loading.fullscreen.lock="fullscreenLoading">
+    <div class="order-management-body">
+      <div class="order-management-inner">
+        <div class="base-info">
+          <span>关键词:</span>
+          <el-input  @keyup.enter.native="currentPage=1&&_getSceneData()" v-model="searchKey" placeholder="关键词"></el-input>
+          <el-button type="primary" @click="currentPage=1&&_getSceneData()" color='red'>搜索</el-button>
         </div>
-        <!-- 全部 -->
-        <div  class="scene-management_bottom" v-if="tabIndex==0">
-          <div class="order-management-table">
-            <div class="scene-management_tab">
-              <ul>
-                <li v-for="(item,index) in tabs" :key="index" :class="{'scene-management_tab_li_active':item.idx==tabIndex}" @click="clickTabItem(item.idx)">{{item.name}}<span v-if="item.idx != -2" style="margin:0 10px;color: #999;font-weight: normal;">/</span></li>
-              </ul>
-              <!-- <div style="float: right;vertical-align: middle;">
-                <el-button type="primary" icon="el-icon-upload" @click="" color='red'>恢复</el-button>
-                <el-button type="danger" icon="el-icon-delete" @click="" color='red'>删除</el-button>
-              </div> -->
-            </div>
-            <el-table key="order_table" ref="order_table" class='e-table' :data="scenes" style="width: 100%">
-              <el-table-column label="场景封面" width="120">
-                <template slot-scope="scope">
-                  <a :href="scope.row.webSite" target="_blank" style="cursor: pointer;">
-                    <img :src="scope.row.homepic" width="100%" height="" />
-                  </a>
-                </template>
-              </el-table-column>
-              <el-table-column prop="sceneType" label="分类">
-              </el-table-column>
-              <el-table-column prop="sceneName" width="200" label="标题">
-              </el-table-column>
-              <el-table-column label="拍摄时间" width="200">
-                <template slot-scope="scope">
-                  <div>{{$base.dateFormat('yyyy-MM-dd hh:mm:ss', new Date(scope.row.createTime.time))}}</div>
-                </template>
-              </el-table-column>
-              <el-table-column  label="经纬度" width="200">
-                <template slot-scope="scope">
-                  <div v-if="scope.row.longitude">经度:{{scope.row.longitude}}</div>
-                  <div v-if="scope.row.latitude">维度:{{scope.row.latitude }}</div>
-                  <span v-if="!scope.row.latitude&&!scope.row.longitude">/</span>
-                </template>
-              </el-table-column>
-              <el-table-column prop="childName" label="设备ID" width="150">
-              </el-table-column>
-              <el-table-column prop="userName" label="用户名" width="150">
-              </el-table-column>
-              <el-table-column prop="scenekey" label="权限">
-              </el-table-column>
-              <el-table-column prop="viewCount" label="浏览数">
-              </el-table-column>
-              <el-table-column prop="sceneType" label="平台展示">
-                <template slot-scope="scope">
-                  <el-switch @change="_updateSceneStatus(scope.row.num,scope.row.status)" v-model="scope.row.statusBoo" active-color="#13ce66" inactive-color="#ff4949">
-                  </el-switch>
-                </template>
-              </el-table-column>
-              <el-table-column prop="status" label="操作">
-                <template slot-scope="scope">
-                  <el-button type="text" @click="_deleScene(scope.row.num)" class="delete_btn">删除</el-button>
-                </template>
-              </el-table-column>
-            </el-table>
-          </div>
-          <div class="order-management-pagination">
-            <el-pagination @current-change="handleCurrentChange" :current-page.sync="currentPage" :page-size="10" layout="total, prev, pager, next, jumper" :total="total">
-            </el-pagination>
+      </div>
+      <!-- 全部 -->
+      <div  class="scene-management_bottom" v-if="tabIndex==0">
+        <div class="order-management-table">
+          <div class="scene-management_tab">
+            <ul>
+              <li v-for="(item,index) in tabs" :key="index" :class="{'scene-management_tab_li_active':item.idx==tabIndex}" @click="clickTabItem(item.idx)">{{item.name}}<span v-if="item.idx != -2" style="margin:0 10px;color: #999;font-weight: normal;">/</span></li>
+            </ul>
+            <!-- <div style="float: right;vertical-align: middle;">
+              <el-button type="primary" icon="el-icon-upload" @click="" color='red'>恢复</el-button>
+              <el-button type="danger" icon="el-icon-delete" @click="" color='red'>删除</el-button>
+            </div> -->
           </div>
+          <el-table key="order_table" ref="order_table" class='e-table' :data="scenes" style="width: 100%">
+            <el-table-column label="场景封面" width="120">
+              <template slot-scope="scope">
+                <a :href="scope.row.webSite" target="_blank" style="cursor: pointer;">
+                  <img :src="scope.row.thumb" width="100%" height="" />
+                </a>
+              </template>
+            </el-table-column>
+            <el-table-column prop="sceneType" label="分类">
+            </el-table-column>
+            <el-table-column prop="sceneName" width="200" label="标题">
+            </el-table-column>
+            <el-table-column label="拍摄时间" width="200">
+              <template slot-scope="scope">
+                <div>{{new Date(scope.row.createTime).format('yyyy-MM-dd hh:mm:ss')}}</div>
+              </template>
+            </el-table-column>
+            <el-table-column  label="经纬度" width="200">
+              <template slot-scope="scope">
+                <div v-if="scope.row.longitude">经度:{{scope.row.longitude}}</div>
+                <div v-if="scope.row.latitude">维度:{{scope.row.latitude }}</div>
+                <span v-if="!scope.row.latitude&&!scope.row.longitude">/</span>
+              </template>
+            </el-table-column>
+            <el-table-column prop="childName" label="设备ID" width="150">
+            </el-table-column>
+            <el-table-column prop="userName" label="用户名" width="150">
+            </el-table-column>
+            <el-table-column prop="scenekey" label="权限">
+            </el-table-column>
+            <el-table-column prop="viewCount" label="浏览数">
+            </el-table-column>
+            <el-table-column prop="sceneType" label="平台展示">
+              <template slot-scope="scope">
+                <el-switch @change="_updateSceneStatus(scope.row.id,scope.row.status)" v-model="scope.row.statusBoo" active-color="#13ce66" inactive-color="#ff4949">
+                </el-switch>
+              </template>
+            </el-table-column>
+            <el-table-column prop="status" label="操作">
+              <template slot-scope="scope">
+                <el-button type="text" @click="_deleScene(scope.row.id)" class="delete_btn">删除</el-button>
+              </template>
+            </el-table-column>
+          </el-table>
         </div>
-        <!-- 展示中 -->
-        <div class="scene-management_bottom" v-if="tabIndex==1">
-          <div class="order-management-table">
-            <div class="scene-management_tab">
-              <ul>
-                <li v-for="(item,index) in tabs" :key="index" :class="{'scene-management_tab_li_active':item.idx==tabIndex}" @click="clickTabItem(item.idx)">{{item.name}}<span v-if="item.idx != -2" style="margin:0 10px;color: #999;font-weight: normal;">/</span></li>
-              </ul>
-              <!-- <div style="float: right;vertical-align: middle;">
-                <el-button type="primary" icon="el-icon-upload" @click="" color='red'>恢复</el-button>
-                <el-button type="danger" icon="el-icon-delete" @click="" color='red'>删除</el-button>
-              </div> -->
-            </div>
-            <el-table key="order_table1" ref="order_table1" class='e-table' :data="scenes" style="width: 100%">
-              <el-table-column label="场景封面" width="120">
-                <template slot-scope="scope">
-                  <a :href="scope.row.webSite" target="_blank" style="cursor: pointer;">
-                    <img :src="scope.row.homepic" width="100%" height="" />
-                  </a>
-                </template>
-              </el-table-column>
-              <el-table-column prop="sceneType" label="分类">
-              </el-table-column>
-              <el-table-column prop="sceneName" width="200" label="标题">
-              </el-table-column>
-              <el-table-column label="拍摄时间" width="200">
-                <template slot-scope="scope">
-                  <div>{{$base.dateFormat('yyyy-MM-dd hh:mm:ss', new Date(scope.row.createTime.time))}}</div>
-                </template>
-              </el-table-column>
-               <el-table-column  label="经纬度" width="200">
-                <template slot-scope="scope">
-                  <div v-if="scope.row.longitude">经度:{{scope.row.longitude}}</div>
-                  <div v-if="scope.row.latitude">维度:{{scope.row.latitude }}</div>
-                  <span v-if="!scope.row.latitude&&!scope.row.longitude">/</span>
-                </template>
-              </el-table-column>
-              <el-table-column prop="childName" width="150" label="设备ID">
-              </el-table-column>
-              <el-table-column prop="userName" width="150" label="用户名">
-              </el-table-column>
-              <el-table-column prop="scenekey" label="权限">
-              </el-table-column>
-              <el-table-column prop="viewCount" label="浏览数">
-              </el-table-column>
-              <el-table-column prop="sceneType" label="平台展示">
-                <template slot-scope="scope">
-                  <el-switch @change="_updateSceneStatus(scope.row.num,scope.row.status)" v-model="scope.row.statusBoo" active-color="#13ce66" inactive-color="#ff4949">
-                  </el-switch>
-                </template>
-              </el-table-column>
-              <el-table-column prop="status" label="操作">
-                <template slot-scope="scope">
-                  <el-button type="text" @click="_deleScene(scope.row.num)" class="delete_btn">删除</el-button>
-                </template>
-              </el-table-column>
-            </el-table>
-          </div>
-          <div class="order-management-pagination">
-            <el-pagination @current-change="handleCurrentChange" :current-page.sync="currentPage" :page-size="10" layout="total, prev, pager, next, jumper" :total="total">
-            </el-pagination>
-          </div>
+        <div class="order-management-pagination">
+          <el-pagination @current-change="handleCurrentChange" :current-page.sync="currentPage" :page-size="pageSize" layout="total, prev, pager, next, jumper" :total="total">
+          </el-pagination>
         </div>
-        <!-- 已隐藏 -->
-        <div class="scene-management_bottom" v-if="tabIndex==-2">
-                    <div class="order-management-table">
-            <div class="scene-management_tab">
-              <ul>
-                <li v-for="(item,index) in tabs" :key="index" :class="{'scene-management_tab_li_active':item.idx==tabIndex}" @click="clickTabItem(item.idx)">{{item.name}}<span v-if="item.idx != -2" style="margin:0 10px;color: #999;font-weight: normal;">/</span></li>
-              </ul>
-              <!-- <div style="float: right;vertical-align: middle;">
-                <el-button type="primary" icon="el-icon-upload" @click="" color='red'>恢复</el-button>
-                <el-button type="danger" icon="el-icon-delete" @click="" color='red'>删除</el-button>
-              </div> -->
-            </div>
-            <el-table key="order_table2" ref="order_table2" class='e-table' :data="scenes" style="width: 100%">
-              <el-table-column label="场景封面" width="120">
-                <template slot-scope="scope">
-                  <a :href="scope.row.webSite" target="_blank" style="cursor: pointer;">
-                    <img :src="scope.row.homepic" width="100%" height="" />
-                  </a>
-                </template>
-              </el-table-column>
-              <el-table-column prop="sceneType" label="分类">
-              </el-table-column>
-              <el-table-column prop="sceneName" width="200" label="标题">
-              </el-table-column>
-              <el-table-column label="拍摄时间" width="200">
-                <template slot-scope="scope">
-                  <div>{{$base.dateFormat('yyyy-MM-dd hh:mm:ss', new Date(scope.row.createTime.time))}}</div>
-                </template>
-              </el-table-column>
-               <el-table-column  label="经纬度" width="200">
-                <template slot-scope="scope">
-                  <div v-if="scope.row.longitude">经度:{{scope.row.longitude}}</div>
-                  <div v-if="scope.row.latitude">维度:{{scope.row.latitude }}</div>
-                  <span v-if="!scope.row.latitude&&!scope.row.longitude">/</span>
-                </template>
-              </el-table-column>
-              <el-table-column prop="childName" width="150" label="设备ID">
-              </el-table-column>
-              <el-table-column prop="userName" width="150" label="用户名">
-              </el-table-column>
-              <el-table-column prop="scenekey" label="权限">
-              </el-table-column>
-              <el-table-column prop="viewCount" label="浏览数">
-              </el-table-column>
-              <el-table-column prop="sceneType" label="平台展示">
-                <template slot-scope="scope">
-                  <el-switch @change="_updateSceneStatus(scope.row.num,scope.row.status)" v-model="scope.row.statusBoo" active-color="#13ce66" inactive-color="#ff4949">
-                  </el-switch>
-                </template>
-              </el-table-column>
-              <el-table-column prop="status" label="操作">
-                <template slot-scope="scope">
-                  <el-button type="text" @click="_deleScene(scope.row.num)" class="delete_btn">删除</el-button>
-                </template>
-              </el-table-column>
-            </el-table>
+      </div>
+      <!-- 展示中 -->
+      <div class="scene-management_bottom" v-if="tabIndex==1">
+        <div class="order-management-table">
+          <div class="scene-management_tab">
+            <ul>
+              <li v-for="(item,index) in tabs" :key="index" :class="{'scene-management_tab_li_active':item.idx==tabIndex}" @click="clickTabItem(item.idx)">{{item.name}}<span v-if="item.idx != -2" style="margin:0 10px;color: #999;font-weight: normal;">/</span></li>
+            </ul>
+            <!-- <div style="float: right;vertical-align: middle;">
+              <el-button type="primary" icon="el-icon-upload" @click="" color='red'>恢复</el-button>
+              <el-button type="danger" icon="el-icon-delete" @click="" color='red'>删除</el-button>
+            </div> -->
           </div>
-          <div class="order-management-pagination">
-            <el-pagination @current-change="handleCurrentChange" :current-page.sync="currentPage" :page-size="10" layout="total, prev, pager, next, jumper" :total="total">
-            </el-pagination>
+          <el-table key="order_table1" ref="order_table1" class='e-table' :data="scenes" style="width: 100%">
+            <el-table-column label="场景封面" width="120">
+              <template slot-scope="scope">
+                <a :href="scope.row.webSite" target="_blank" style="cursor: pointer;">
+                  <img :src="scope.row.thumb" width="100%" height="" />
+                </a>
+              </template>
+            </el-table-column>
+            <el-table-column prop="sceneType" label="分类">
+            </el-table-column>
+            <el-table-column prop="sceneName" width="200" label="标题">
+            </el-table-column>
+            <el-table-column label="拍摄时间" width="200">
+              <template slot-scope="scope">
+                <div>{{new Date(scope.row.createTime).format('yyyy-MM-dd hh:mm:ss')}}</div>
+              </template>
+            </el-table-column>
+              <el-table-column  label="经纬度" width="200">
+              <template slot-scope="scope">
+                <div v-if="scope.row.longitude">经度:{{scope.row.longitude}}</div>
+                <div v-if="scope.row.latitude">维度:{{scope.row.latitude }}</div>
+                <span v-if="!scope.row.latitude&&!scope.row.longitude">/</span>
+              </template>
+            </el-table-column>
+            <el-table-column prop="childName" width="150" label="设备ID">
+            </el-table-column>
+            <el-table-column prop="userName" width="150" label="用户名">
+            </el-table-column>
+            <el-table-column prop="scenekey" label="权限">
+            </el-table-column>
+            <el-table-column prop="viewCount" label="浏览数">
+            </el-table-column>
+            <el-table-column prop="sceneType" label="平台展示">
+              <template slot-scope="scope">
+                <el-switch @change="_updateSceneStatus(scope.row.id,scope.row.status)" v-model="scope.row.statusBoo" active-color="#13ce66" inactive-color="#ff4949">
+                </el-switch>
+              </template>
+            </el-table-column>
+            <el-table-column prop="status" label="操作">
+              <template slot-scope="scope">
+                <el-button type="text" @click="_deleScene(scope.row.id)" class="delete_btn">删除</el-button>
+              </template>
+            </el-table-column>
+          </el-table>
+        </div>
+        <div class="order-management-pagination">
+          <el-pagination @current-change="handleCurrentChange" :current-page.sync="currentPage" :page-size="10" layout="total, prev, pager, next, jumper" :total="total">
+          </el-pagination>
+        </div>
+      </div>
+      <!-- 已隐藏 -->
+      <div class="scene-management_bottom" v-if="tabIndex==-2">
+                  <div class="order-management-table">
+          <div class="scene-management_tab">
+            <ul>
+              <li v-for="(item,index) in tabs" :key="index" :class="{'scene-management_tab_li_active':item.idx==tabIndex}" @click="clickTabItem(item.idx)">{{item.name}}<span v-if="item.idx != -2" style="margin:0 10px;color: #999;font-weight: normal;">/</span></li>
+            </ul>
+            <!-- <div style="float: right;vertical-align: middle;">
+              <el-button type="primary" icon="el-icon-upload" @click="" color='red'>恢复</el-button>
+              <el-button type="danger" icon="el-icon-delete" @click="" color='red'>删除</el-button>
+            </div> -->
           </div>
+          <el-table key="order_table2" ref="order_table2" class='e-table' :data="scenes" style="width: 100%">
+            <el-table-column label="场景封面" width="120">
+              <template slot-scope="scope">
+                <a :href="scope.row.webSite" target="_blank" style="cursor: pointer;">
+                  <img :src="scope.row.thumb" width="100%" height="" />
+                </a>
+              </template>
+            </el-table-column>
+            <el-table-column prop="sceneType" label="分类">
+            </el-table-column>
+            <el-table-column prop="sceneName" width="200" label="标题">
+            </el-table-column>
+            <el-table-column label="拍摄时间" width="200">
+              <template slot-scope="scope">
+                <div>{{new Date(scope.row.createTime).format('yyyy-MM-dd hh:mm:ss')}}</div>
+              </template>
+            </el-table-column>
+              <el-table-column  label="经纬度" width="200">
+              <template slot-scope="scope">
+                <div v-if="scope.row.longitude">经度:{{scope.row.longitude}}</div>
+                <div v-if="scope.row.latitude">维度:{{scope.row.latitude }}</div>
+                <span v-if="!scope.row.latitude&&!scope.row.longitude">/</span>
+              </template>
+            </el-table-column>
+            <el-table-column prop="childName" width="150" label="设备ID">
+            </el-table-column>
+            <el-table-column prop="userName" width="150" label="用户名">
+            </el-table-column>
+            <el-table-column prop="scenekey" label="权限">
+            </el-table-column>
+            <el-table-column prop="viewCount" label="浏览数">
+            </el-table-column>
+            <el-table-column prop="sceneType" label="平台展示">
+              <template slot-scope="scope">
+                <el-switch @change="_updateSceneStatus(scope.row.id,scope.row.status)" v-model="scope.row.statusBoo" active-color="#13ce66" inactive-color="#ff4949">
+                </el-switch>
+              </template>
+            </el-table-column>
+            <el-table-column prop="status" label="操作">
+              <template slot-scope="scope">
+                <el-button type="text" @click="_deleScene(scope.row.id)" class="delete_btn">删除</el-button>
+              </template>
+            </el-table-column>
+          </el-table>
+        </div>
+        <div class="order-management-pagination">
+          <el-pagination @current-change="handleCurrentChange" :current-page.sync="currentPage" :page-size="10" layout="total, prev, pager, next, jumper" :total="total">
+          </el-pagination>
         </div>
-
       </div>
+
     </div>
   </div>
 </template>
 <script>
-// import { request } from 'api/server'
-
+const _sceneTypeName = {
+  0: '其他',
+  1: '文博',
+  2: '地产',
+  3: '电商',
+  4: '餐饮',
+  5: '家居'
+}
 export default {
-
-  name: 'scene-management',
-
   data () {
     return {
       getRowKeys (row) {
@@ -223,14 +223,24 @@ export default {
       total: 0,
       // expressNum_input: "",
       searchDate: [],
+      searchKey: '',
       searchOrderNumber: '',
       searchPhone: '',
       searchExpressNum: '',
       hasClickSearch: false,
       tabIndex: 0,
+      pageSize: 10,
       value2: true
     }
   },
+  watch: {
+    currentPage () {
+      this._getSceneData()
+    },
+    tabIndex () {
+      this._getSceneData()
+    }
+  },
   methods: {
     handleCurrentChange (val) {
       let page = val
@@ -250,97 +260,58 @@ export default {
       this.$refs.searchKey.currentValue = this.key_input = ''
       this._getSceneData(1)
     },
-    _getSceneData (page) {
+    async _getSceneData () {
       this.fullscreenLoading = true
       let status = this.tabIndex === 0 ? null : this.tabIndex
 
-      request['getManageScene']({
-        page: page - 1,
-        status
-        // key:"1"
-      }, 'get').then(res => {
-        this.fullscreenLoading = false
-
-        if (res) {
-          let temp = res.scene ? res.scene : res
-          // console.log(temp)
-
-          // console.log(this.scenes)
-          for (var i = 0; i < temp.length; i++) {
-            // temp[i]['expressNum_input'] = "";
-            let _sceneType = temp[i].sceneType
-            let _sceneTypeName = ''
-            switch (_sceneType) {
-              case 0:
-                _sceneTypeName = '其他'
-                break
-              case 1:
-                _sceneTypeName = '文博'
-                break
-              case 2:
-                _sceneTypeName = '地产'
-                break
-              case 3:
-                _sceneTypeName = '电商'
-                break
-              case 4:
-                _sceneTypeName = '餐饮'
-                break
-              case 5:
-                _sceneTypeName = '家居'
-                break
-              default:
-                _sceneTypeName = ''
-                break
-            }
-            temp[i].sceneType = _sceneTypeName
-            temp[i].scenekey = temp[i].scenekey ? '私密' : '公开'
-            temp[i]['userName'] = temp[i]['userName'] ? temp[i]['userName'] : '未绑定'
-            let gpsStr = temp[i].gps || ''
-
-            if (gpsStr instanceof Object) {
-              JSON.parse(gpsStr, (k, v) => {
-                // console.log(k)
-                if (k && k === 'latitude') {
-                  temp[i].latitude = this.formatDegree(v)
-                } else if (k && k === 'longitude') {
-                  temp[i].longitude = this.formatDegree(v)
-                }
-                // return v;       // 返回修改的值
-              })
-            }
-
-            // console.log(temp[i].latitude, temp[i].longitude)
+      let res = await this.$http.post('/manager/scene/list', {
+        type: status,
+        searchKey: this.searchKey,
+        pageNum: this.currentPage,
+        pageSize: this.pageSize
+      })
 
-            if (temp[i].status === 1) {
-              temp[i].statusBoo = true
-            } else if (temp[i].status === -2) {
-              temp[i].statusBoo = false
-            } else {
-              temp[i].statusBoo = ''
-            }
+      this.fullscreenLoading = false
+
+      if (res.code === 0) {
+        let temp = res.data.list
+        for (var i = 0; i < temp.length; i++) {
+          temp[i].sceneType = _sceneTypeName[temp[i].sceneType]
+          temp[i].scenekey = temp[i].scenekey ? '私密' : '公开'
+          temp[i]['userName'] = temp[i]['userName'] ? temp[i]['userName'] : '未绑定'
+          let gpsStr = temp[i].gps || ''
+
+          if (gpsStr instanceof Object) {
+            JSON.parse(gpsStr, (k, v) => {
+              if (k && k === 'latitude') {
+                temp[i].latitude = this.formatDegree(v)
+              } else if (k && k === 'longitude') {
+                temp[i].longitude = this.formatDegree(v)
+              }
+            })
           }
-          this.scenes = temp
-          this.total = res.sub ? res.sub : this.total
-
-          // console.log(temp)
 
-          // console.log(this.scenes)
-          // this.expands.push(this.orders[1].number);
+          if (temp[i].status === 1) {
+            temp[i].statusBoo = true
+          } else if (temp[i].status === -2) {
+            temp[i].statusBoo = false
+          } else {
+            temp[i].statusBoo = ''
+          }
         }
-      })
+        this.scenes = temp
+        this.total = res.data.total ? res.data.total : this.total
+      }
     },
 
     formatDegree (value) {
-      /// <summary>将度转换成为度分秒</summary>
-
       value = Math.abs(value)
       var v1 = Math.floor(value)// 度
       var v2 = Math.floor((value - v1) * 60)// 分
       var v3 = Math.round((value - v1) * 3600 % 60)// 秒
       return v1 + '°' + v2 + '\'' + v3 + '"'
     },
-    _updateSceneStatus (num, status) {
+    async _updateSceneStatus (num, status) {
       let tempStatus
       if (status === 1) {
         tempStatus = -2
@@ -353,42 +324,40 @@ export default {
         })
         return
       }
-      let page = this.currentPage
       this.fullscreenLoading = true
-      request['updateSceneStatus']({
-        num,
-        status: tempStatus
-      }, 'get').then(res => {
-        this._searchOrderByPage(page)
-
-        this.fullscreenLoading = false
+      await this.$http.post('/manager/scene/updateStatus', {
+        type: tempStatus,
+        sceneId: num
       })
+
+      this._getSceneData()
+      this.fullscreenLoading = false
     },
 
     _deleScene (num) {
-      let page = this.currentPage
-      // console.log(page)
       this.$confirm('此操作将删除该场景, 是否继续?', '提示', {
         confirmButtonText: '确定',
         cancelButtonText: '取消',
         type: 'warning'
-      }).then(() => {
+      }).then(async () => {
         this.fullscreenLoading = true
-
-        request['deleteScene']({
-          num
-        }, 'get').then(res => {
-          if (res === 1) {
-            this.$message({
-              type: 'success',
-              message: '删除成功!'
-            })
-            this._getSceneData(page)
-            this.fullscreenLoading = false
-            this.total -= 1
-            // console.log(res)
-          }
+        let res = await this.$http.post('/manager/scene/delete', {
+          sceneId: num
         })
+        if (res.code === 0) {
+          this.$message({
+            type: 'success',
+            message: '删除成功!'
+          })
+          this._getSceneData()
+        } else {
+          this.$message({
+            type: 'error',
+            message: res.msg
+          })
+          this._getSceneData()
+        }
+        this.fullscreenLoading = false
       }).catch(() => {
         this.$message({
           type: 'info',
@@ -396,342 +365,16 @@ export default {
         })
         this.fullscreenLoading = false
       })
-    },
-
-    _sceneSearch () {
-      this.fullscreenLoading = true
-      this.hasClickSearch = true
-      let status = this.tabIndex === 0 ? null : this.tabIndex
-      let key = this.key_input = this.$refs.searchKey.currentValue || null
-      request['searchManageScene']({
-        key,
-        page: 0,
-        status
-      }, 'get').then(res => {
-        this.fullscreenLoading = false
-
-        if (res) {
-          let temp = res.scene ? res.scene : res
-          // console.log(temp)
-
-          // console.log(this.scenes)
-          for (var i = 0; i < temp.length; i++) {
-            // temp[i]['expressNum_input'] = "";
-            // temp[i]['userName'] = temp[i]['userName'] ? temp[i]['userName']:"未绑定";
-            let _sceneType = temp[i].sceneType
-            let _sceneTypeName = ''
-            switch (_sceneType) {
-              case 0:
-                _sceneTypeName = '其他'
-                break
-              case 1:
-                _sceneTypeName = '文博'
-                break
-              case 2:
-                _sceneTypeName = '地产'
-                break
-              case 3:
-                _sceneTypeName = '电商'
-                break
-              case 4:
-                _sceneTypeName = '餐饮'
-                break
-              case 5:
-                _sceneTypeName = '家居'
-                break
-              default:
-                _sceneTypeName = ''
-                break
-            }
-            temp[i].sceneType = _sceneTypeName
-            temp[i].scenekey = temp[i].scenekey ? '私密' : '公开'
-            temp[i]['userName'] = temp[i]['userName'] ? temp[i]['userName'] : '未绑定'
-
-            if (temp[i].status === 1) {
-              temp[i].statusBoo = true
-            } else if (temp[i].status === -2) {
-              temp[i].statusBoo = false
-            } else {
-              temp[i].statusBoo = ''
-            }
-          }
-          this.scenes = temp
-          this.currentPage = 1
-          this.total = res.sub >= 0 ? res.sub : this.total
-          // console.log(temp)
-          // console.log(this.scenes)
-        } else {
-          // this.total = 0
-        }
-      })
-    },
-    _searchOrderByPage (page) {
-      let status = this.tabIndex === 0 ? null : this.tabIndex
-      let key = this.key_input
-      this.$refs.searchKey.currentValue = this.key_input
-      this.fullscreenLoading = true
-      request['searchManageScene']({
-        key,
-        page: page - 1,
-        status
-      }, 'get').then(res => {
-        this.fullscreenLoading = false
-
-        if (res) {
-          let temp = res.scene ? res.scene : res
-          // console.log(temp)
-
-          // console.log(this.scenes)
-          for (var i = 0; i < temp.length; i++) {
-            // temp[i]['expressNum_input'] = "";
-            let _sceneType = temp[i].sceneType
-            let _sceneTypeName = ''
-            switch (_sceneType) {
-              case 0:
-                _sceneTypeName = '其他'
-                break
-              case 1:
-                _sceneTypeName = '文博'
-                break
-              case 2:
-                _sceneTypeName = '地产'
-                break
-              case 3:
-                _sceneTypeName = '电商'
-                break
-              case 4:
-                _sceneTypeName = '餐饮'
-                break
-              case 5:
-                _sceneTypeName = '家居'
-                break
-              default:
-                _sceneTypeName = ''
-                break
-            }
-            temp[i].sceneType = _sceneTypeName
-            temp[i].scenekey = temp[i].scenekey ? '私密' : '公开'
-            temp[i]['userName'] = temp[i]['userName'] ? temp[i]['userName'] : '未绑定'
-            if (temp[i].status === 1) {
-              temp[i].statusBoo = true
-            } else if (temp[i].status === -2) {
-              temp[i].statusBoo = false
-            } else {
-              temp[i].statusBoo = ''
-            }
-          }
-          this.scenes = temp
-
-          // console.log(temp)
-
-          // console.log(this.scenes)
-        }
-      })
-    },
-    loadData (row, expandedRows) {
-      // console.log(row, expandedRows)
-      this._getOrderDetail(row)
-    },
-    _getOrderDetail (row) {
-      this.fullscreenLoading = true
-      let { number: orderNum, cameraTypeId, amount, userName, productCount } = row
-
-      request['getOrderDetail']({
-        orderNum,
-        cameraTypeId,
-        amount,
-        userName,
-        productCount
-      }, 'get').then(res => {
-        this.fullscreenLoading = false
-        if (res) {
-          // console.log(row.number)
-          // console.log(res)
-          let tempRes = res
-          let temp = this.orders
-          for (let i = 0; i <= temp.length; i++) {
-            if (row.number === temp[i].number) {
-              temp[i]['product'] = tempRes['product']
-              temp[i]['receive'] = tempRes['receive']
-              // console.log('temp', temp[i].number)
-              // console.log('res', tempRes)
-              this.orders = temp
-            } else {
-              continue
-            }
-          }
-        }
-      })
     }
   },
   created () {
-    this._getSceneData(1)
+    this._getSceneData()
   }
 }
 
 </script>
 <style lang="css" scoped>
-.scene-management-body {
-  width: 100%;
-  float: left;
-  /*  box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
-  -moz-box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
-  -webkit-box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);*/
-  /*border: 1px solid #ebeef5;*/
-}
-
-.order_check_row {
-  display: flex;
-  width: 100%;
-}
-
-.product_info {
-  width: 50%;
-  flex-direction: column;
-  display: flex;
-  padding: 20px;
-  background: #fff;
-}
-
-.order_info {
-  width: 50%;
-  padding: 20px;
-  margin-left: 20px;
-  background: #fff;
-}
-
-.product_info_title {
-  text-align: left;
-  font-weight: 700;
-  margin-bottom: 20px;
-}
-
-.product_info_body {
-  margin-left: 30px;
-  display: flex;
-}
-
-.product_info_body_img {
-  width: 110px;
-  height: 110px;
-  border: 1px solid #ddd;
-}
-
-.product_img {
-  margin: 5px auto;
-  width: 100px;
-  height: 100px;
-}
-
-.product_info_body_info {
-  margin-left: 50px;
-}
-
-.product_info_body_info_item {
-  line-height: 27px;
-  text-align: left;
-}
-
-.product_info_body_info_item_title {
-  width: 100px;
-  display: inline-block;
-  margin-right: 20px;
-  font-weight: 700;
-}
-
-.order_info_title {
-  text-align: left;
-  font-weight: 700;
-  margin-bottom: 20px;
-}
-
-.order_info_body {
-  margin-left: 30px;
-  text-align: left;
-}
-
-.order_info_body_info_item {
-  line-height: 23px;
-  padding: 10px 0;
-  border-bottom: 1px solid #f5f5f5;
-  text-align: left;
-}
-
-.order_info_body_info_item_title {
-  width: 100px;
-  display: inline-block;
-  margin-right: 20px;
-  font-weight: 700;
-}
-
-.order-management-body {
-  width: 100%;
-  margin: 30px 0 20px 0;
-  float: left;
-}
-
-.order-management-inner {
-  box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
-  -moz-box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
-  -webkit-box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
-  /*border: 1px solid #ebeef5;*/
-  padding: 20px;
-  background: #fff;
-  border-radius: 5px;
-}
-
-.base-info {
-  margin: 20px 0;
-}
-
-.scene-management_bottom {
-  box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
-  -moz-box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
-  -webkit-box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
-  /*border: 1px solid #ebeef5;*/
-  margin-top: 30px;
-  background: #fff;
-  border-radius: 5px;
-  padding: 20px 0;
-}
-
-.scene-management_tab {
-  margin: 0 0 20px;
-  display: flex;
-  justify-content: space-between;
-  align-items: center;
-}
-
-.scene-management_tab ul {
-  display: inline-block;
-}
-
-.scene-management_tab li {
-  display: inline-block;
-  cursor: pointer;
-  color: #999;
-  line-height: 1;
-}
-
-.scene-management_tab_li_active {
-  color: #000!important;
-  font-weight: bold;
-}
-
-.order-management-table {
-  margin: 0 20px;
-}
-
-.order-management-pagination {
-  padding: 20px 20px 0;
-  position: relative;
-  text-align: right;
-}
-
-.el-input {
-  width: 220px;
-}
-
+@import './style.css';
 </style>
 <style type="text/css">
 .el-table__expand-icon>i {
@@ -742,10 +385,4 @@ export default {
   color: #f56c6c
 }
 
-/*.el-table__expand-icon:after {
-    content: "查看详细"!important;
-    color:#09e1c0;
-    cursor: pointer;
-}*/
-
 </style>

+ 160 - 0
src/page/scene/style.css

@@ -0,0 +1,160 @@
+.scene-management-body {
+  width: 100%;
+  float: left;
+  /*  box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
+  -moz-box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
+  -webkit-box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);*/
+  /*border: 1px solid #ebeef5;*/
+}
+
+.order_check_row {
+  display: flex;
+  width: 100%;
+}
+
+.product_info {
+  width: 50%;
+  flex-direction: column;
+  display: flex;
+  padding: 20px;
+  background: #fff;
+}
+
+.order_info {
+  width: 50%;
+  padding: 20px;
+  margin-left: 20px;
+  background: #fff;
+}
+
+.product_info_title {
+  text-align: left;
+  font-weight: 700;
+  margin-bottom: 20px;
+}
+
+.product_info_body {
+  margin-left: 30px;
+  display: flex;
+}
+
+.product_info_body_img {
+  width: 110px;
+  height: 110px;
+  border: 1px solid #ddd;
+}
+
+.product_img {
+  margin: 5px auto;
+  width: 100px;
+  height: 100px;
+}
+
+.product_info_body_info {
+  margin-left: 50px;
+}
+
+.product_info_body_info_item {
+  line-height: 27px;
+  text-align: left;
+}
+
+.product_info_body_info_item_title {
+  width: 100px;
+  display: inline-block;
+  margin-right: 20px;
+  font-weight: 700;
+}
+
+.order_info_title {
+  text-align: left;
+  font-weight: 700;
+  margin-bottom: 20px;
+}
+
+.order_info_body {
+  margin-left: 30px;
+  text-align: left;
+}
+
+.order_info_body_info_item {
+  line-height: 23px;
+  padding: 10px 0;
+  border-bottom: 1px solid #f5f5f5;
+  text-align: left;
+}
+
+.order_info_body_info_item_title {
+  width: 100px;
+  display: inline-block;
+  margin-right: 20px;
+  font-weight: 700;
+}
+
+.order-management-body {
+  width: 100%;
+  margin: 30px 0 20px 0;
+  float: left;
+}
+
+.order-management-inner {
+  box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
+  -moz-box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
+  -webkit-box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
+  /*border: 1px solid #ebeef5;*/
+  padding: 20px;
+  background: #fff;
+  border-radius: 5px;
+}
+
+.base-info {
+  margin: 20px 0;
+}
+
+.scene-management_bottom {
+  box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
+  -moz-box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
+  -webkit-box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
+  /*border: 1px solid #ebeef5;*/
+  margin-top: 30px;
+  background: #fff;
+  border-radius: 5px;
+  padding: 20px 0;
+}
+
+.scene-management_tab {
+  margin: 0 0 20px;
+  display: flex;
+  justify-content: space-between;
+  align-items: center;
+}
+
+.scene-management_tab ul {
+  display: inline-block;
+}
+
+.scene-management_tab li {
+  display: inline-block;
+  cursor: pointer;
+  color: #999;
+  line-height: 1;
+}
+
+.scene-management_tab_li_active {
+  color: #000!important;
+  font-weight: bold;
+}
+
+.order-management-table {
+  margin: 0 20px;
+}
+
+.order-management-pagination {
+  padding: 20px 20px 0;
+  position: relative;
+  text-align: right;
+}
+
+.el-input {
+  width: 220px;
+}

+ 25 - 46
src/page/user/query-detail/index.vue

@@ -9,7 +9,7 @@
       </div>
     </div>
     <div class="data-show">
-      <el-table :data="users" v-if="type === 1" style="width: 100%" show-summary :summary-method="getSummaries" v-loading="loading" class="table info1">
+      <el-table :data="users" v-if="type === 0" style="width: 100%" show-summary :summary-method="getSummaries" v-loading="loading" class="table info1">
         <el-table-column label="时间2">
           <template slot-scope="scope">
             <span>
@@ -33,11 +33,11 @@
         <el-table-column width="60">
         </el-table-column>
       </el-table>
-      <el-table :data="users" v-if="type === -1" style="width: 100%" show-summary :summary-method="getSummaries" v-loading="loading" class="table info2">
+      <el-table :data="users" v-if="type === 1" style="width: 100%" show-summary :summary-method="getSummaries" v-loading="loading" class="table info2">
         <el-table-column prop="create_time" label="时间">
           <template slot-scope="scope">
             <span>
-              {{new Date(scope.row.createTime.tradeTime).format('yyyy-MM-dd hh:mm:ss')}}
+              {{new Date(scope.row.tradeTime).format('yyyy-MM-dd hh:mm:ss')}}
             </span>
           </template>
         </el-table-column>
@@ -66,18 +66,20 @@ export default {
     return {
       users: [],
       pag: { current: 1 },
-      statistics: {},
+      statistics: {
+        result: 0
+      },
       loading: false,
-      type: 1,
+      type: 0,
       types: [
-        { val: 1, text: '充值记录' },
-        { val: -1, text: '消费记录' }
+        { val: 0, text: '充值记录' },
+        { val: 1, text: '消费记录' }
       ]
     }
   },
   methods: {
     getSummaries () {
-      if (~this.type) {
+      if (!this.type) {
         return [
           '',
           this.statistics.result || 0,
@@ -176,24 +178,6 @@ export default {
         total: data.total
       }
       this.users = data.list
-      return;
-
-      let result = []
-      await request['showCameraDetail'](params, 'post').then(res => {
-        if (res === -101) {
-          return this.$error('系统异常,请重试~')
-        } else if (res === -102) {
-          return this.$error('当前相机不存在!')
-        } else {
-          result = res
-          console.log(result)
-        }
-      })
-      this.users = result.content
-      this.pag = {
-        current: this.pag.current,
-        total: result.sub || this.pag.total
-      }
     },
     async refresh () {
       this.loading = true
@@ -216,37 +200,32 @@ export default {
       let status = this.type
       date1 = this.screen.date1 || null
       date2 = this.screen.date2 || null
-      console.log('-----------')
-      await request['showCameraStatistics2']({cameraId, status, date1, date2}, 'post').then(res => {
-        // result = res;
-        this.statistics = res
-
-        console.log('result', this.statistics)
-      })
+      let data = (await this.$http.post('/manager/camera/searchCameraDetailStatistics', {
+        type: status,
+        startDate: date1,
+        endDate: date2,
+        cameraId: cameraId
+      })).data
+      this.statistics.result = data.result
+      this.$bus.$emit('title-f', `<p>设备ID:${this.$route.params.rid}<span>当前剩余点数:${data.balance}</span></p>`)
     },
     deleteTool () {
       let tool
       while ((tool = this.tools.pop())) {
         this.$emit('rmTool', tool)
       }
-    },
-    async getPoint() {
-      
-      request['showCameraSurplus']({ cameraId: name }, 'post').then(res => {
-        // result = res;
-
-        console.log('result', res)
-        this.$router.push({ name: '用户明细', params: { id: name, points: res.result } })
-      })
     }
   },
+  destroyed () {
+    this.$bus.$emit('title-f', '')
+  },
   watch: {
     screen () {
       this.refresh()
     },
-    type () {
-      this.loadData()
-      this.getStatistics()
+    async type () {
+      await this.getStatistics()
+      await this.loadData()
     },
     '$route.params.id': function (newVal) {
       // this.deleteTool()
@@ -261,7 +240,7 @@ export default {
     this.tools = []
     // this.deleteTool()
     // this.addTool()
-  },
+  }, 
   beforeDestroy () {
     // this.deleteTool()
   },

+ 5 - 4
src/page/user/query-list/index.vue

@@ -31,7 +31,7 @@
       <el-table-column label="">
         <el-table-column label="操作" width="80">
           <template slot-scope="scope">
-            <span @click="goToDetail(scope.row.id)" class="link">详细</span>
+            <span @click="goToDetail(scope.row.id, scope.row.childName)" class="link">详细</span>
             <!-- <router-link :to="" class="link">详细</router-link> -->
           </template>
         </el-table-column>
@@ -139,11 +139,12 @@ export default {
         this.fullscreenLoading = false
       })
     },
-    goToDetail (name) {
-      this.$router.push({ name: 'user-detail', params: {id: name}})
+    goToDetail (name, childName) {
+      this.$router.push({ name: 'user-detail', params: {id: name, rid: childName}})
     },
     getSummaries () {
       let {subCharge,subPoint,subSubStract,subSubStractPoint} = this.statistics
+      console.log({...this.statistics})
       let tmp = [
         '', '', '', '',
         subCharge,
@@ -181,7 +182,7 @@ export default {
         startDate: params.date1,
         endDate: params.date2,
         childName: params.childName
-      })).data.data
+      })).data
 
       Object.keys(data).forEach(k => {
         this.statistics[k] = data[k]

+ 7 - 1
src/router/index.js

@@ -40,6 +40,12 @@ export default new Router({
           meta: {text: '反馈消息'}
         },
         {
+          path: '/scene',
+          name: 'scene',
+          component: require('@/page/scene').default,
+          meta: {text: '场景管理'}
+        },
+        {
           path: '/user',
           name: 'User',
           component: require('@/page/user').default,
@@ -51,7 +57,7 @@ export default new Router({
               component: require('@/page/user/query-list').default
             },
             {
-              path: ':id',
+              path: ':id-:rid',
               name: 'user-detail',
               meta: { text: '用户明细' },
               component: require('@/page/user/query-detail').default