|
@@ -40,19 +40,21 @@
|
|
ref="table"
|
|
ref="table"
|
|
bordered
|
|
bordered
|
|
size="small"
|
|
size="small"
|
|
- :row-key="id"
|
|
|
|
|
|
+ :rowKey="(record) => record.id"
|
|
:columns="columns"
|
|
:columns="columns"
|
|
:data-source="equipmentData"
|
|
:data-source="equipmentData"
|
|
- :showPagination="false">
|
|
|
|
|
|
+ :pagination="false"
|
|
|
|
+ @expand="eqExpand">
|
|
<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>
|
|
<a-table
|
|
<a-table
|
|
ref="tables"
|
|
ref="tables"
|
|
bordered
|
|
bordered
|
|
size="small"
|
|
size="small"
|
|
|
|
+ :rowKey="(record) => record.gbId"
|
|
:columns="passagewayColumns"
|
|
:columns="passagewayColumns"
|
|
- :data-source="record.passageway"
|
|
|
|
- :showPagination="false">
|
|
|
|
|
|
+ :data-source="passagewayData"
|
|
|
|
+ :pagination="false">
|
|
<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>
|
|
@@ -73,8 +75,8 @@
|
|
width="600px">
|
|
width="600px">
|
|
<!-- 表单 -->
|
|
<!-- 表单 -->
|
|
<a-form-model ref="ruleForm" :model="form" :rules="rules">
|
|
<a-form-model ref="ruleForm" :model="form" :rules="rules">
|
|
- <a-form-model-item label="名称" prop="name">
|
|
|
|
- <a-input v-model.trim="form.name" id="equipment-name" :maxLength="30" placeholder="请输入名称,30个字以内" />
|
|
|
|
|
|
+ <a-form-model-item label="名称" prop="deviceName">
|
|
|
|
+ <a-input v-model.trim="form.deviceName" id="equipment-name" :maxLength="30" placeholder="请输入名称,30个字以内" />
|
|
</a-form-model-item>
|
|
</a-form-model-item>
|
|
<a-form-model-item class="btn-cont">
|
|
<a-form-model-item class="btn-cont">
|
|
<a-button type="primary" id="equipment-save" @click="onSubmit">保存</a-button>
|
|
<a-button type="primary" id="equipment-save" @click="onSubmit">保存</a-button>
|
|
@@ -86,12 +88,10 @@
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script>
|
|
<script>
|
|
-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'
|
|
import { vsDeviceChannels, vsDeviceRename } from '@/api/vsDevice.js'
|
|
export default {
|
|
export default {
|
|
name: 'StoreAssociatedEquipmentModal',
|
|
name: 'StoreAssociatedEquipmentModal',
|
|
- components: { STable, VSelect },
|
|
|
|
props: {
|
|
props: {
|
|
openModal: {
|
|
openModal: {
|
|
// 弹框是否展示
|
|
// 弹框是否展示
|
|
@@ -119,38 +119,46 @@ export default {
|
|
{ title: '操作', scopedSlots: { customRender: 'action' }, width: '265', align: 'center' }
|
|
{ title: '操作', scopedSlots: { customRender: 'action' }, width: '265', align: 'center' }
|
|
],
|
|
],
|
|
equipmentData: [], // 已绑设备
|
|
equipmentData: [], // 已绑设备
|
|
|
|
+ passagewayData: [], // 设备通道
|
|
passagewayColumns: [
|
|
passagewayColumns: [
|
|
{ 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: 'name', width: '100', align: 'center' },
|
|
|
|
+ { title: '设备ID', dataIndex: 'deviceId', width: '100', align: 'center' },
|
|
{ title: '操作', scopedSlots: { customRender: 'action' }, width: '265', align: 'center' }
|
|
{ title: '操作', scopedSlots: { customRender: 'action' }, width: '265', align: 'center' }
|
|
],
|
|
],
|
|
visible: false, // 编辑 通道/机位名称
|
|
visible: false, // 编辑 通道/机位名称
|
|
form: {
|
|
form: {
|
|
- name: '' // 名称
|
|
|
|
|
|
+ deviceName: '' // 名称
|
|
},
|
|
},
|
|
rules: { // 表单校验规则
|
|
rules: { // 表单校验规则
|
|
- name: [{ required: true, message: '请输入名称', trigger: 'blur' }]
|
|
|
|
|
|
+ deviceName: [{ required: true, message: '请输入名称', trigger: 'blur' }]
|
|
},
|
|
},
|
|
resultData: null, // 设备搜索结果
|
|
resultData: null, // 设备搜索结果
|
|
- isFocus: false // 搜索框是否获取焦点
|
|
|
|
|
|
+ isFocus: false, // 搜索框是否获取焦点
|
|
|
|
+ vsDeviceId: '', // 设备id
|
|
|
|
+ deviceId: '' // 设备通道id
|
|
}
|
|
}
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
|
|
+ // 搜索设备
|
|
onSearch (value) {
|
|
onSearch (value) {
|
|
- findVsDevice({ id: value }).then(res => {
|
|
|
|
- if (res.status == 200) {
|
|
|
|
- this.resultData = res.data
|
|
|
|
- } else {
|
|
|
|
- this.$message.error(res.message)
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
|
|
+ if (value) {
|
|
|
|
+ findVsDevice({ id: value }).then(res => {
|
|
|
|
+ if (res.status == 200) {
|
|
|
|
+ this.resultData = res.data
|
|
|
|
+ } else {
|
|
|
|
+ this.$message.error(res.message)
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ } else {
|
|
|
|
+ this.resultData = null
|
|
|
|
+ this.isFocus = false
|
|
|
|
+ }
|
|
},
|
|
},
|
|
// 门店已绑设备
|
|
// 门店已绑设备
|
|
getStoreEquipment (id) {
|
|
getStoreEquipment (id) {
|
|
findStoreVsDevice({ code: 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
|
|
})
|
|
})
|
|
@@ -168,7 +176,7 @@ export default {
|
|
unbindVsDevice({ id: item.id }).then(res => {
|
|
unbindVsDevice({ id: item.id }).then(res => {
|
|
if (res.status == 200) {
|
|
if (res.status == 200) {
|
|
_this.$message.success(res.message)
|
|
_this.$message.success(res.message)
|
|
- _this.$refs.table.refresh()
|
|
|
|
|
|
+ _this.getStoreEquipment(_this.storeCode)
|
|
} else {
|
|
} else {
|
|
_this.$message.error(res.message)
|
|
_this.$message.error(res.message)
|
|
}
|
|
}
|
|
@@ -188,7 +196,7 @@ export default {
|
|
_this.$message.success(res.message)
|
|
_this.$message.success(res.message)
|
|
_this.resultData = null
|
|
_this.resultData = null
|
|
_this.isFocus = false
|
|
_this.isFocus = false
|
|
- _this.$refs.table.refresh()
|
|
|
|
|
|
+ _this.getStoreEquipment(_this.storeCode)
|
|
} else {
|
|
} else {
|
|
_this.$message.error(res.message)
|
|
_this.$message.error(res.message)
|
|
}
|
|
}
|
|
@@ -198,7 +206,8 @@ export default {
|
|
},
|
|
},
|
|
// 编辑 通道/机位名称
|
|
// 编辑 通道/机位名称
|
|
onEdit (item) {
|
|
onEdit (item) {
|
|
- this.form.name = item.name
|
|
|
|
|
|
+ this.form.deviceName = item.name
|
|
|
|
+ this.deviceId = item.deviceId
|
|
this.visible = true
|
|
this.visible = true
|
|
},
|
|
},
|
|
// 提交更改的通道信息
|
|
// 提交更改的通道信息
|
|
@@ -207,21 +216,40 @@ export default {
|
|
_this.$refs.ruleForm.validate(valid => {
|
|
_this.$refs.ruleForm.validate(valid => {
|
|
if (valid) {
|
|
if (valid) {
|
|
const formData = JSON.parse(JSON.stringify(_this.form))
|
|
const formData = JSON.parse(JSON.stringify(_this.form))
|
|
- formData.tenantId = this.storeId
|
|
|
|
- console.log(formData)
|
|
|
|
- // saveStoreOrg(formData).then(res => {
|
|
|
|
- // if (res.status == 200) {
|
|
|
|
- // _this.$message.success(res.message)
|
|
|
|
- // _this.$refs.tables.refresh(true)
|
|
|
|
- // _this.visible = false
|
|
|
|
- // } else {
|
|
|
|
- // _this.$message.error(res.message)
|
|
|
|
- // }
|
|
|
|
- // })
|
|
|
|
|
|
+ formData.deviceId = this.deviceId
|
|
|
|
+ vsDeviceRename(formData).then(res => {
|
|
|
|
+ if (res.status == 200) {
|
|
|
|
+ _this.$message.success(res.message)
|
|
|
|
+ _this.visible = false
|
|
|
|
+ _this.getDeviceChannels()
|
|
|
|
+ } else {
|
|
|
|
+ _this.$message.error(res.message)
|
|
|
|
+ }
|
|
|
|
+ })
|
|
} else {
|
|
} else {
|
|
return false
|
|
return false
|
|
}
|
|
}
|
|
})
|
|
})
|
|
|
|
+ },
|
|
|
|
+ // 设备行展开事件
|
|
|
|
+ eqExpand (expanded, record) {
|
|
|
|
+ if (expanded) { // 展开行
|
|
|
|
+ this.vsDeviceId = record.vsDeviceId
|
|
|
|
+ this.getDeviceChannels()
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ // 获取设备通道信息
|
|
|
|
+ getDeviceChannels () {
|
|
|
|
+ vsDeviceChannels({ id: this.vsDeviceId }).then(res => {
|
|
|
|
+ if (res.status == 200) {
|
|
|
|
+ if (res.data) {
|
|
|
|
+ res.data.map((item, ind) => {
|
|
|
|
+ item.no = ind + 1
|
|
|
|
+ })
|
|
|
|
+ this.passagewayData = res.data
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ })
|
|
}
|
|
}
|
|
},
|
|
},
|
|
watch: {
|
|
watch: {
|
|
@@ -234,7 +262,9 @@ export default {
|
|
if (!val) {
|
|
if (!val) {
|
|
this.$emit('close')
|
|
this.$emit('close')
|
|
} else {
|
|
} else {
|
|
-
|
|
|
|
|
|
+ // 重置信息
|
|
|
|
+ this.resultData = null
|
|
|
|
+ this.isFocus = false
|
|
}
|
|
}
|
|
},
|
|
},
|
|
storeCode (newValue, oldValue) {
|
|
storeCode (newValue, oldValue) {
|
|
@@ -285,7 +315,7 @@ export default {
|
|
.eq-tit{
|
|
.eq-tit{
|
|
line-height: 40px;
|
|
line-height: 40px;
|
|
font-size: 16px;
|
|
font-size: 16px;
|
|
- margin: 75px 0 5px;
|
|
|
|
|
|
+ margin: 85px 0 5px;
|
|
}
|
|
}
|
|
.eq-subTit{
|
|
.eq-subTit{
|
|
margin: 0 0 10px;
|
|
margin: 0 0 10px;
|