chenrui 4 年之前
父節點
當前提交
7745fc6278

+ 1 - 1
src/api/storeVsDevice.js

@@ -11,7 +11,7 @@ export const bindVsDevice = params => {
 // 查询门店设备信息
 // 查询门店设备信息
 export const findStoreVsDevice = params => {
 export const findStoreVsDevice = params => {
   return axios({
   return axios({
-    url: `/storeVsDevice/findStoreVsDevice/${params.id}`,
+    url: `/storeVsDevice/findStoreVsDevice/${params.code}`,
     data: {},
     data: {},
     method: 'get'
     method: 'get'
   })
   })

+ 18 - 0
src/api/vsDevice.js

@@ -0,0 +1,18 @@
+import { axios } from '@/utils/request'
+
+// 获取设备下通道(流)列表
+export const vsDeviceChannels = params => {
+  return axios({
+    url: `/vs/device/channels/${params.id}`,
+    data: params,
+    method: 'post'
+  })
+}
+// 设备重命名
+export const vsDeviceRename = params => {
+  return axios({
+    url: `/vs/device/rename/${params.id}/${params.name}`,
+    data: {},
+    method: 'get'
+  })
+}

+ 25 - 15
src/views/BasicSettings/StoreAssociatedEquipmentModal.vue

@@ -19,22 +19,23 @@
         @focus="isFocus=true"
         @focus="isFocus=true"
         @search="onSearch"
         @search="onSearch"
       />
       />
-      <a-card class="search-sub" :bordered="false" v-show="resultData.length != 0 && isFocus">
-        <div class="search-sub-item" v-for="(item, index) in resultData" :key="index">
-          <p>{{ item.des }}-{{ item.isBind ? '已绑定' : '未绑定' }}</p>
+      <a-card class="search-sub" :bordered="false" v-if="resultData && isFocus">
+        <div class="search-sub-item">
+          <p>{{ resultData.name }}-{{ resultData.params ? '已绑定' : '未绑定' }}</p>
           <a-button
           <a-button
             id="equipment-bind"
             id="equipment-bind"
-            v-if="!item.isBind"
+            v-if="!resultData.params"
             type="primary"
             type="primary"
             ghost
             ghost
             size="small"
             size="small"
-            @click="onBundling(item)">立即绑定</a-button>
+            @click="onBundling(resultData)">立即绑定</a-button>
+          <a-button v-else disabled type="link">已绑定</a-button>
         </div>
         </div>
       </a-card>
       </a-card>
     </div>
     </div>
     <!-- 已绑设备 -->
     <!-- 已绑设备 -->
     <div class="eq-tit">已绑设备:</div>
     <div class="eq-tit">已绑设备:</div>
-    <s-table
+    <a-table
       class="table"
       class="table"
       ref="table"
       ref="table"
       bordered
       bordered
@@ -45,7 +46,7 @@
       :showPagination="false">
       :showPagination="false">
       <div slot="expandedRowRender" slot-scope="record" style="margin: 30px 30px;">
       <div slot="expandedRowRender" slot-scope="record" style="margin: 30px 30px;">
         <div class="eq-subTit">设备通道(机位):</div>
         <div class="eq-subTit">设备通道(机位):</div>
-        <s-table
+        <a-table
           ref="tables"
           ref="tables"
           bordered
           bordered
           size="small"
           size="small"
@@ -55,12 +56,12 @@
           <template slot="action" slot-scope="record">
           <template slot="action" slot-scope="record">
             <a-button type="link" id="equipment-edit" @click="onEdit(record)">编辑</a-button>
             <a-button type="link" id="equipment-edit" @click="onEdit(record)">编辑</a-button>
           </template>
           </template>
-        </s-table>
+        </a-table>
       </div>
       </div>
       <template slot="action" slot-scope="record">
       <template slot="action" slot-scope="record">
         <a-button type="primary" ghost size="small" id="equipment-unBind" @click="onUnbundling(record)">解绑</a-button>
         <a-button type="primary" ghost size="small" id="equipment-unBind" @click="onUnbundling(record)">解绑</a-button>
       </template>
       </template>
-    </s-table>
+    </a-table>
     <!-- 编辑  通道/机位名称 -->
     <!-- 编辑  通道/机位名称 -->
     <a-modal
     <a-modal
       class="passagewayModal"
       class="passagewayModal"
@@ -87,6 +88,7 @@
 <script>
 <script>
 import { STable, VSelect } from '@/components'
 import { STable, VSelect } from '@/components'
 import { findStoreVsDevice, unbindVsDevice, findVsDevice, bindVsDevice } from '@/api/storeVsDevice.js'
 import { findStoreVsDevice, unbindVsDevice, findVsDevice, bindVsDevice } from '@/api/storeVsDevice.js'
+import { vsDeviceChannels, vsDeviceRename } from '@/api/vsDevice.js'
 export default {
 export default {
   name: 'StoreAssociatedEquipmentModal',
   name: 'StoreAssociatedEquipmentModal',
   components: { STable, VSelect },
   components: { STable, VSelect },
@@ -100,6 +102,11 @@ export default {
       //  门店id
       //  门店id
       type: String,
       type: String,
       default: ''
       default: ''
+    },
+    storeCode: {
+      //  门店code
+      type: String,
+      default: ''
     }
     }
   },
   },
   data () {
   data () {
@@ -107,8 +114,8 @@ export default {
       isShow: this.openModal, //  弹框是否展示
       isShow: this.openModal, //  弹框是否展示
       columns: [
       columns: [
         { title: '序号', dataIndex: 'no', width: '100', align: 'center' },
         { title: '序号', dataIndex: 'no', width: '100', align: 'center' },
-        { title: '设备名称', dataIndex: 'name', width: '100', align: 'center' },
-        { title: '设备ID', dataIndex: 'id', width: '100', align: 'center' },
+        { title: '设备名称', dataIndex: 'vsDeviceName', width: '100', align: 'center' },
+        { title: '设备ID', dataIndex: 'vsDeviceId', width: '100', align: 'center' },
         { title: '操作', scopedSlots: { customRender: 'action' }, width: '265', align: 'center' }
         { title: '操作', scopedSlots: { customRender: 'action' }, width: '265', align: 'center' }
       ],
       ],
       equipmentData: [], //  已绑设备
       equipmentData: [], //  已绑设备
@@ -125,7 +132,7 @@ export default {
       rules: { //  表单校验规则
       rules: { //  表单校验规则
         name: [{ required: true, message: '请输入名称', trigger: 'blur' }]
         name: [{ required: true, message: '请输入名称', trigger: 'blur' }]
       },
       },
-      resultData: [], //  设备搜索结果
+      resultData: null, //  设备搜索结果
       isFocus: false //  搜索框是否获取焦点
       isFocus: false //  搜索框是否获取焦点
     }
     }
   },
   },
@@ -141,8 +148,9 @@ export default {
     },
     },
     //  门店已绑设备
     //  门店已绑设备
     getStoreEquipment (id) {
     getStoreEquipment (id) {
-      findStoreVsDevice({ id: id }).then(res => {
+      findStoreVsDevice({ code: id }).then(res => {
         if (res.status == 200) {
         if (res.status == 200) {
+          console.log(res)
           res.data.map((item, ind) => {
           res.data.map((item, ind) => {
             item.no = ind + 1
             item.no = ind + 1
           })
           })
@@ -175,9 +183,11 @@ export default {
         title: '提示',
         title: '提示',
         content: '确定要绑定该设备吗?',
         content: '确定要绑定该设备吗?',
         onOk () {
         onOk () {
-          bindVsDevice({ tenantId: _this.storeId, vsDeviceId: item.id }).then(res => {
+          bindVsDevice({ storeCode: _this.storeCode, vsDeviceId: item.id }).then(res => {
             if (res.status == 200) {
             if (res.status == 200) {
               _this.$message.success(res.message)
               _this.$message.success(res.message)
+              _this.resultData = null
+              _this.isFocus = false
               _this.$refs.table.refresh()
               _this.$refs.table.refresh()
             } else {
             } else {
               _this.$message.error(res.message)
               _this.$message.error(res.message)
@@ -227,7 +237,7 @@ export default {
 
 
       }
       }
     },
     },
-    storeId (newValue, oldValue) {
+    storeCode (newValue, oldValue) {
       if (newValue && this.isShow) {
       if (newValue && this.isShow) {
         this.getStoreEquipment(newValue)
         this.getStoreEquipment(newValue)
       }
       }

+ 8 - 3
src/views/BasicSettings/StoreManagement.vue

@@ -54,7 +54,7 @@
     <!-- 编辑 门店所属组织 -->
     <!-- 编辑 门店所属组织 -->
     <store-modal :openModal="openModal" :storeId="storeId" @success="storeSubmit" @close="closeModal" />
     <store-modal :openModal="openModal" :storeId="storeId" @success="storeSubmit" @close="closeModal" />
     <!-- 门店 关联设备 -->
     <!-- 门店 关联设备 -->
-    <store-associated-equipment-modal :openModal="openEquipmentModal" :storeId="storeId" @close="closeDetailsModal" />
+    <store-associated-equipment-modal :openModal="openEquipmentModal" :storeId="storeId" :storeCode="storeCode" @close="closeDetailsModal" />
   </a-card>
   </a-card>
 </template>
 </template>
 
 
@@ -102,13 +102,15 @@ export default {
       },
       },
       openModal: false, //  编辑 门店所属组织  弹框展示状态
       openModal: false, //  编辑 门店所属组织  弹框展示状态
       openEquipmentModal: false, //  门店 关联设备  弹框展示状态
       openEquipmentModal: false, //  门店 关联设备  弹框展示状态
-      storeId: '' //  门店id
+      storeId: '', //  门店id
+      storeCode: '' //  门店code
     }
     }
   },
   },
   methods: {
   methods: {
     //  编辑
     //  编辑
     edit (item) {
     edit (item) {
       this.storeId = String(item.id)
       this.storeId = String(item.id)
+      this.storeCode = String(item.code)
       this.openModal = true
       this.openModal = true
       this.openEquipmentModal = false
       this.openEquipmentModal = false
     },
     },
@@ -120,6 +122,7 @@ export default {
     //  设置
     //  设置
     setEquipment (item) {
     setEquipment (item) {
       this.storeId = String(item.id)
       this.storeId = String(item.id)
+      this.storeCode = String(item.code)
       this.openEquipmentModal = true
       this.openEquipmentModal = true
       this.openModal = false
       this.openModal = false
     },
     },
@@ -138,11 +141,13 @@ export default {
     // 新增、编辑 弹框关闭
     // 新增、编辑 弹框关闭
     closeModal () {
     closeModal () {
       this.storeId = ''
       this.storeId = ''
+      this.storeCode = ''
       this.openModal = false
       this.openModal = false
     },
     },
-    // 详情 弹框关闭
+    // 关联设备 弹框关闭
     closeDetailsModal () {
     closeDetailsModal () {
       this.storeId = ''
       this.storeId = ''
+      this.storeCode = ''
       this.openEquipmentModal = false
       this.openEquipmentModal = false
     }
     }
   }
   }