设备调整、debug

This commit is contained in:
墨大叔 2024-05-07 18:02:37 +08:00
parent 24462ed7d5
commit 45a141415a
14 changed files with 466 additions and 316 deletions

View File

@ -9,6 +9,14 @@ export function listStore(query) {
})
}
// ids查询商户列表列表
export function listStoreByIds(ids) {
return request({
url: `/ss/store/listByIds/${ids}`,
method: 'get',
})
}
// 查询商户列表详细
export function getStore(storeId) {
return request({

View File

@ -43,6 +43,14 @@ export function updateDevice(data) {
})
}
// 修改设备SN
export function updateDeviceSn(deviceId, sn) {
return request({
url: `/system/device/${deviceId}/bindSn/${sn}`,
method: 'put'
})
}
// 删除设备
export function delDevice(deviceId) {
return request({

View File

@ -1,110 +0,0 @@
<template>
<div>
<el-input :value="multiple ? (realValue.length > 0 ? `(${realValue.length})${showValue}` : null): showValue"
@focus="openDialog"
:size="size"
readonly
:placeholder="placeholder"></el-input>
<group-dialog :show.sync="dialogShow"
:search="search"
:multiple="multiple"
:init-select="realValue"
@select="onSubmit"
:title="title"></group-dialog>
</div>
</template>
<script>
import GroupDialog from "@/components/Business/Group/groupDialog.vue";
export default {
name: 'groupSelect',
components: {GroupDialog},
props:{
size: {
type: String,
default: "medium"
},
placeholder: {
type: String,
default: "点击选择分组",
},
//
multiple: {
type: Boolean,
default: false,
},
// (id)
value: {
type: [Array, String, Number],
default: () => {
return []
}
},
//
search: {
type: Object,
default: () => ({})
},
//
title: {
type: String,
default: "选择分组"
},
beforeOpen: {
type: Function,
default: () => {
return true;
}
},
beforeClose: {
type: Function,
default: () => {
return true;
}
},
//
showValue: {
type: String,
default: null,
},
},
data() {
return {
realValue: [], //
dialogShow: false, //
}
},
methods: {
//
inputValue(val){
this.$emit('input', val);
},
//
onSubmit(selected){
if (this.multiple) {
this.realValue = selected;
this.inputValue(selected.map(item => item.groupId));
} else {
this.realValue = [selected];
this.inputValue(selected.groupId);
}
this.$emit('submit', selected);
this.closeDialog();
},
closeDialog() {
if (this.beforeClose()) {
this.dialogShow = false;
}
},
//
openDialog(){
if (this.beforeOpen()) {
this.dialogShow = true;
}
}
}
}
</script>

View File

@ -1,10 +1,12 @@
<!-- version: 2, 分组选择弹窗-->
<!--version: 3, 店铺选择弹窗-->
<!--版本更新内容添加prop属性修复多选-->
<template>
<el-dialog :title="title" :visible="show" width="60%" top="2vh" @open="open" @close="close"
:append-to-body="true">
<el-form size="small" :inline="true" label-width="6em">
<el-form-item label="分组名称:">
<el-input v-model="searchForm.groupName" clearable></el-input>
<el-form size="small" :inline="true" label-width="8em">
<el-form-item label="店铺名称:">
<el-input v-model="searchForm.name" clearable></el-input>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="onSearch()" icon="el-icon-search">搜索</el-button>
@ -23,9 +25,18 @@
>
<el-table-column align="center" type="selection" v-if="multiple"></el-table-column>
<el-table-column label="#" type="index" align="center"></el-table-column>
<el-table-column label="分组名称" align="center" prop="groupName"></el-table-column>
<el-table-column label="所属房东" align="center" prop="userName"></el-table-column>
<el-table-column label="备注" align="center" prop="remark"></el-table-column>
<el-table-column label="ID" align="center" prop="storeId" width="50"></el-table-column>
<el-table-column label="商户图片" align="center" prop="picture" width="100">
<template slot-scope="scope">
<image-preview :src="scope.row.picture" :width="50" :height="50"/>
</template>
</el-table-column>
<el-table-column label="店铺名称" align="center" prop="name"></el-table-column>
<el-table-column label="店铺地址" align="center">
<template slot-scope="d">
{{d.row.province}}{{d.row.city}}{{d.row.county}}{{d.row.address}}
</template>
</el-table-column>
</el-table>
<pagination
:limit.sync="searchForm.pageSize"
@ -41,27 +52,18 @@
<script>
import {clone} from "@/utils";
import {listGroup} from "@/api/system/group";
import { listStore } from '@/api/ss/store'
export default {
name: "groupDialog",
data() {
return {
loadTable: false,
tableData: [],
searchForm: {
pageNum: 1,
pageSize: 10,
...this.search
},
total: 0,
row: null,
selected: [],
}
},
name: "StoreDialog",
props: {
initSelect: {
type: Array,
//
title: {
type: String,
default: '选择店铺'
},
value: {
type: [String, Number, Array],
default: null,
},
multiple: {
@ -72,23 +74,50 @@ export default {
type: Boolean,
default: false
},
title: {
type: String,
default: '选择分组'
},
search: {
query: {
type: Object,
default: () => ({})
},
initSelect: {
type: Array,
default: null,
},
prop: {
type: String,
default: 'id'
}
},
data() {
return {
loadTable: false,
tableData: [],
searchForm: {},
total: 0,
row: null,
selected: [],
}
},
methods: {
//
searchList() {
this.loadTable = true;
listStore(this.searchForm).then(response => {
this.tableData = response.rows;
this.total = response.total;
//
this.$nextTick(()=>{
this.refreshTableSelection();
})
}).finally(() =>{
this.loadTable = false;
})
},
//
open() {
this.searchForm = {
code: null,
pageNum: 1,
pageSize: 10,
...this.search,
...this.query,
}
if (this.initSelect) {
@ -103,7 +132,7 @@ export default {
refreshTableSelection() {
if(this.multiple){
this.tableData.forEach(item => {
if (this.selected.map(j => j.id).includes(item.id)) {
if (this.selected.map(j => j[this.prop]).includes(item[this.prop])) {
this.$refs.multipleTable.toggleRowSelection(item, true);
} else {
this.$refs.multipleTable.toggleRowSelection(item, false);
@ -115,10 +144,10 @@ export default {
selectionAll(val){
let flag = val.length > 0;
this.tableData.forEach(item => {
if (flag && !this.selected.map(i => i.id).includes(item.id)){
if (flag && !this.selected.map(i => i[this.prop]).includes(item[this.prop])){
this.selected.push(item);
} else if (!flag && this.selected.map(i => i.id).includes(item.id)){
this.selected = this.selected.filter(i => i.id !== item.id);
} else if (!flag && this.selected.map(i => i[this.prop]).includes(item[this.prop])){
this.selected = this.selected.filter(i => i[this.prop] !== item[this.prop]);
}
})
},
@ -133,9 +162,9 @@ export default {
//
changeSelection(row){
if(this.multiple){
if (this.selected.map(i => i.id).includes(row.id)){
if (this.selected.map(i => i[this.prop]).includes(row[this.prop])){
this.$refs.multipleTable.toggleRowSelection(row, false);
this.selected = this.selected.filter(i => i.id !== row.id);
this.selected = this.selected.filter(i => i[this.prop] !== row[this.prop]);
}else {
this.$refs.multipleTable.toggleRowSelection(row, true);
this.selected.push(row);
@ -149,20 +178,6 @@ export default {
this.searchForm.pageNum = 1;
this.searchList();
},
//
searchList() {
this.loadTable = true;
listGroup(this.searchForm).then(response => {
this.tableData = response.rows;
this.total = response.total;
//
this.$nextTick(() => {
this.refreshTableSelection();
})
}).finally(() => {
this.loadTable = false;
})
},
//
close() {
this.$emit('update:show', false);

View File

@ -0,0 +1,185 @@
<!--version: 4, 店铺选择器-->
<!--版本更新内容添加prop属性修复多选-->
<template>
<div>
<el-input
v-if="multiple"
rows="1"
type="textarea"
:value="inputBindValue"
@focus="openDialog"
:size="size"
:disabled="disabled"
readonly
:placeholder="placeholder"/>
<el-input
v-else
:value="inputBindValue"
@focus="openDialog"
:size="size"
:disabled="disabled"
readonly
:placeholder="placeholder"/>
<store-dialog
:show.sync="dialogShow"
:query="query"
:multiple="multiple"
:init-select="selected"
@select="onSubmit"
:prop="prop"
:title="title"/>
</div>
</template>
<script>
import {isDeepEqual} from "@/utils";
import StoreDialog from '@/components/Business/Store/StoreDialog.vue'
import { listStoreByIds } from '@/api/ss/store'
export default {
name: 'StoreInput',
components: { StoreDialog },
props:{
//
title: {
type: String,
default: "选择店铺"
},
placeholder: {
type: String,
default: "点击选择店铺",
},
//
showProp: {
type: String,
default: 'name'
},
//
prop: {
type: String,
default: 'storeId'
},
//
multiple: {
type: Boolean,
default: false,
},
// (id)
value: {
type: [Array, String, Number],
default: null
},
//
query: {
type: Object,
default: () => ({})
},
//
beforeOpen: {
type: Function,
default: () => {
return true;
}
},
//
beforeClose: {
type: Function,
default: () => {
return true;
}
},
//
size: {
type: String,
default: "medium"
},
//
disabled: {
type: Boolean,
default: false,
},
//
objectParser: {
type: Function,
default: (obj) => {
return JSON.stringify(obj);
}
},
},
data() {
return {
selected: [], //
dialogShow: false, //
}
},
computed: {
//
inputBindValue() {
if (this.selected == null || this.selected.length === 0) {
return null;
}
return this.selected.map(item => item[this.showProp]).join(",");
}
},
watch: {
value(nv, ov) {
this.loadSelected(nv);
}
},
created() {
this.loadSelected(this.value);
},
methods: {
//
loadSelected(ids) {
if (ids == null || ids.length === 0) {
this.selected = [];
return;
}
if (ids instanceof Array) {
this.doLoad(ids);
} else {
this.doLoad([ids]);
}
},
//
doLoad(ids) {
listStoreByIds(ids).then(res => {
this.selected = res.data;
})
},
//
inputValue(val){
this.$emit('input', val);
},
//
onSubmit(selected){
let value = null;
if (this.multiple) {
value = selected.map(item => item[this.prop]);
} else {
value = selected[this.prop];
}
this.$emit('submit', selected);
if (!isDeepEqual(this.value, value)) {
this.$emit('change', selected);
}
this.inputValue(value);
this.closeDialog();
},
closeDialog() {
if (this.beforeClose()) {
this.dialogShow = false;
}
},
//
openDialog(){
if (this.beforeOpen()) {
this.dialogShow = true;
}
}
}
}
</script>

View File

@ -0,0 +1,94 @@
<template>
<el-dialog :title="title" :visible.sync="show" width="500px" center @open="open" @opened="opened" @close="close">
<el-form :model="form" :rules="rules" ref="form">
<el-form-item label="SN码" prop="sn">
<el-input
ref="sn"
maxlength="100"
show-word-limit
v-model="form.sn"
placeholder="请输入SN码或使用扫码枪获取"
/>
</el-form-item>
</el-form>
<template #footer>
<el-button type="success" icon="el-icon-check" plain @click="handleSubmit" v-loading="loading">确认</el-button>
<el-button icon="el-icon-close" plain @click="handleCancel" v-loading="loading">取消</el-button>
</template>
</el-dialog>
</template>
<script>
export default {
name: 'SnInput',
props: {
title: {
type: String,
default: '输入SN',
},
show: {
type: Boolean,
default: false,
},
requiredSn: {
type: Boolean,
default: true,
},
reset: {
type: Boolean,
default: true,
},
loading: {
type: Boolean,
default: false,
}
},
data() {
return {
form: {},
rules: {
sn: [
{required: this.requiredSn, message: 'SN不能为空', trigger: 'blur'}
]
}
}
},
created() {
this.resetForm();
},
methods: {
opened() {
this.$refs.sn.focus();
},
open() {
if (this.reset) {
this.resetForm();
}
},
close() {
this.$emit('update:show', false);
},
resetForm() {
this.form = {
sn: null,
}
},
handleCancel() {
this.$emit('cancel', this.form);
this.close();
},
handleSubmit() {
this.$refs.form.validate(valid => {
if (valid) {
this.$emit('submit', this.form);
}
})
},
}
}
</script>
<style scoped lang="scss">
</style>

View File

@ -6,9 +6,6 @@
<el-table-column align="center" label="总用电量" prop="totalElectriQuantity">
<template slot-scope="d">{{d.row.totalElectriQuantity | money}} </template>
</el-table-column>
<el-table-column align="center" label="剩余电量" prop="surplusElectriQuantity">
<template slot-scope="d">{{d.row.surplusElectriQuantity | money}} </template>
</el-table-column>
</el-table>
<pagination

View File

@ -4,15 +4,13 @@
<el-table-column align="center" type="index" label="#"></el-table-column>
<el-table-column align="center" label="时间" prop="createTime"></el-table-column>
<el-table-column align="center" label="充值用户" prop="userName"></el-table-column>
<el-table-column align="center" label="金额" prop="deviceAmount">
<template slot-scope="d">{{d.row.deviceAmount | money}} </template>
<el-table-column align="center" label="套餐名称" prop="suitName"></el-table-column>
<el-table-column align="center" label="金额" prop="money">
<template slot-scope="d">{{d.row.money | money}} </template>
</el-table-column>
<el-table-column align="center" label="计费标准">
<template slot-scope="d">{{d.row.unitPrice | money}} /</template>
</el-table-column>
<el-table-column align="center" label="电量">
<el-table-column align="center" label="时长">
<template slot-scope="d">
<span v-if="d.row.unitPrice">{{d.row.deviceAmount / d.row.unitPrice | money}} </span>
<span>{{d.row.suitTime | money}} 分钟</span>
</template>
</el-table-column>
</el-table>

View File

@ -3,12 +3,9 @@
<el-table v-loading="loading" :data="recordList">
<el-table-column align="center" type="index" label="#"></el-table-column>
<el-table-column align="center" label="时间" prop="createTime"></el-table-column>
<el-table-column align="center" label="房东名称" prop="landlordName"></el-table-column>
<el-table-column align="center" label="归零前剩余电量" prop="surplusElectriQuantity">
<template slot-scope="d">{{d.row.surplusElectriQuantity | money}} </template>
</el-table-column>
<el-table-column align="center" label="归零前总电量" prop="totalElectriQuantity">
<template slot-scope="d">{{d.row.totalElectriQuantity | money}} </template>
<el-table-column align="center" label="商户名称" prop="mchName"></el-table-column>
<el-table-column align="center" label="归零前剩余时长" prop="surplusTime">
<template slot-scope="d">{{d.row.surplusTime | money}} 分钟</template>
</el-table-column>
</el-table>

View File

@ -18,34 +18,23 @@
<el-descriptions-item label="MAC">{{deviceData.mac | defaultValue}}
<dict-tag :options="dict.type.sm_device_status" :value="deviceData.status" size="mini"/>
</el-descriptions-item>
<el-descriptions-item label="SN">{{deviceData.deviceNo | defaultValue}}</el-descriptions-item>
<el-descriptions-item label="型号">
<el-link type="primary" href="#">{{deviceData.model | defaultValue}}</el-link>
</el-descriptions-item>
<el-descriptions-item label="型号标签">
<dict-tag :options="dict.type.sm_model_tag" :value="deviceData.modelTags" size="mini"/>
</el-descriptions-item>
<el-descriptions-item label="所属用户">{{deviceData.userName | defaultValue}}</el-descriptions-item>
<el-descriptions-item label="分组">{{deviceData.groupName | defaultValue}}</el-descriptions-item>
<el-descriptions-item label="备注">{{deviceData.remark | defaultValue}}</el-descriptions-item>
<el-descriptions-item label="电费单价">{{deviceData.price | defaultValue}}/</el-descriptions-item>
<el-descriptions-item label="所属商户">{{deviceData.userName | defaultValue}}</el-descriptions-item>
<el-descriptions-item label="店铺名称">{{deviceData.storeName | defaultValue}}</el-descriptions-item>
<el-descriptions-item label="断电方式">
<dict-tag v-if="deviceData.outageWay != null" :options="dict.type.sm_device_outage_way" :value="deviceData.outageWay" size="mini"/>
<template v-else>--</template>
</el-descriptions-item>
<el-descriptions-item label="WIFI">{{deviceData.wifi | defaultValue}}</el-descriptions-item>
<el-descriptions-item label="现有电量">{{deviceData.surplusElectriQuantity | defaultValue}}
<span class="remark-text">更新于{{formatDate(deviceData.lastPullTime, '{y}-{m}-{d}') | defaultValue}}</span>
</el-descriptions-item>
<el-descriptions-item label="剩余时长">{{surplusTime | defaultValue}} 分钟</el-descriptions-item>
<el-descriptions-item label="实时功率">{{deviceData.realTimePower | defaultValue}} KWH</el-descriptions-item>
<el-descriptions-item label="房租到期提醒">
<template v-if="deviceData.noticeWay === '1'">
{{deviceData.expireDate | defaultValue}}
</template>
<template v-else>
{{deviceData.expireDay | defaultValue}}
</template>
<dict-tag :value="deviceData.noticeWay" :options="dict.type.sm_device_notice_way" size="mini"/>
</el-descriptions-item>
<el-descriptions-item label="备注">{{deviceData.remark | defaultValue}}</el-descriptions-item>
</el-descriptions>
</el-card>
@ -67,9 +56,6 @@
<el-tab-pane label="绑定记录" :lazy="true">
<bind-record :device-id="deviceData.deviceId"/>
</el-tab-pane>
<el-tab-pane label="租户列表" :lazy="true">
<tenant-list :device-id="deviceData.deviceId"/>
</el-tab-pane>
</el-tabs>
</el-card>
</div>
@ -97,6 +83,8 @@ export default {
return {
loading: false,
deviceData: {},
timer: null,
surplusTime: 0, //
}
},
computed: {
@ -109,7 +97,23 @@ export default {
created() {
this.getDevice();
},
beforeDestroy() {
clearInterval(this.timer);
},
methods: {
//
computeSurplusTime() {
console.log('compute', this.deviceData.expireTime , this.surplusTime );
if (this.deviceData.expireTime == null) {
return 0;
}
let expireTime = new Date(this.deviceData.expireTime).getTime();
let now = new Date().getTime();
if (expireTime < now) {
return 0;
}
return Math.floor((expireTime - now) / 60000);
},
//
refreshIot() {
refreshIot(this.deviceData.deviceId).then(data => {
@ -125,6 +129,13 @@ export default {
this.loading = true;
getDevice(this.$route.query.deviceId).then(response => {
this.deviceData = response.data;
this.surplusTime = this.computeSurplusTime();
if (this.timer == null) {
this.timer = setInterval(() => {
console.log('timer')
this.surplusTime = this.computeSurplusTime();
}, 60000)
}
}).finally(() => {
this.loading = false;
})

View File

@ -53,18 +53,10 @@
/>
</el-select>
</el-form-item>
<el-form-item label="房东名称" prop="userName">
<el-form-item label="商户名称" prop="userName">
<el-input
v-model="queryParams.userName"
placeholder="请输入房东名称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="租户昵称" prop="tenantName">
<el-input
v-model="queryParams.tenantName"
placeholder="请输入租户昵称"
placeholder="请输入商户名称"
clearable
@keyup.enter.native="handleQuery"
/>
@ -123,7 +115,7 @@
<el-table v-loading="loading" :data="deviceList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="id" align="center" prop="deviceId" />
<el-table-column label="ID" align="center" prop="deviceId" />
<el-table-column label="图片" align="center" prop="picture" width="100">
<template slot-scope="scope">
<image-preview :src="scope.row.picture" :width="50" :height="50"/>
@ -143,10 +135,15 @@
</el-popover>
</template>
</el-table-column>
<el-table-column label="设备Mac" align="center" prop="mac" />
<el-table-column label="设备SN" align="center" prop="deviceNo" >
<template slot-scope="d">
<el-link type="danger" v-if="d.row.deviceNo == null" @click="handleBindSn(d.row)">点击绑定</el-link>
<span v-else>{{d.row.deviceNo}}</span>
</template>
</el-table-column>
<el-table-column label="设备名称" align="center" prop="deviceName" />
<el-table-column label="型号" align="center" prop="model" />
<el-table-column label="设备Mac" align="center" prop="mac" />
<el-table-column label="剩余电量" align="center" prop="surplusElectriQuantity" />
<el-table-column label="在线状态" align="center" prop="onlineStatus">
<template slot-scope="scope">
<dict-tag :options="dict.type.sm_device_online_status" :value="scope.row.onlineStatus"/>
@ -157,10 +154,8 @@
<dict-tag :options="dict.type.sm_device_status" :value="scope.row.status"/>
</template>
</el-table-column>
<el-table-column label="实时功率" align="center" prop="realTimePower" />
<el-table-column label="电流" align="center" prop="electricity" />
<el-table-column label="电压" align="center" prop="voltage" />
<el-table-column label="房东" align="center" prop="userName" />
<el-table-column label="商户" align="center" prop="userName" />
<el-table-column label="店铺名称" align="center" prop="storeName" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" fixed="right" width="200">
<template slot-scope="scope">
<el-button
@ -196,9 +191,11 @@
@pagination="getList"
/>
<sn-input :show.sync="showBindSn" @submit="onSubmitSn"></sn-input>
<!-- 添加或修改设备对话框 -->
<el-dialog :title="title" :visible.sync="open" width="50%" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="6em">
<el-row :gutter="gutter">
<el-col :span="span">
<el-form-item label="型号" prop="modelId">
@ -206,13 +203,13 @@
</el-form-item>
</el-col>
<el-col :span="span">
<el-form-item label="房东" prop="userId">
<sm-user-select v-model="form.userId"
:show-value.sync="form.userName"
placeholder="点击选择房东"
title="选择房东"
:search="{userType: '01'}"
@submit="onSubmitUser" />
<el-form-item label="设备MAC" prop="mac">
<el-input v-model="form.mac" placeholder="请输入设备MAC" :disabled="isEdit"/>
</el-form-item>
</el-col>
<el-col :span="span">
<el-form-item label="店铺" prop="storeId">
<store-input v-model="form.storeId"/>
</el-form-item>
</el-col>
<el-col :span="span">
@ -220,65 +217,9 @@
<el-input v-model="form.deviceName" placeholder="请输入设备名称" />
</el-form-item>
</el-col>
<el-col :span="span">
<el-form-item label="电费单价" prop="price">
<el-input v-model.trim="form.price" placeholder="请输入电费单价">
<template #append>/</template>
</el-input>
</el-form-item>
</el-col>
<el-col :span="span">
<el-form-item label="断电方式" prop="outageWay">
<el-select v-model="form.outageWay" placeholder="请选择断电方式" style="width: 100%">
<el-option
v-for="dict in dict.type.sm_device_outage_way"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="span">
<el-form-item label="房租到期提醒" prop="expireDate" label-width="7em">
<el-switch v-model="form.enableExpireNotice"/>
<el-row v-show="form.enableExpireNotice">
<el-select v-model="form.noticeWay" placeholder="请选择提醒方式">
<el-option
v-for="dict in dict.type.sm_device_notice_way"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
<el-date-picker
v-model="form.expireDate"
v-show="form.noticeWay === '1'"
:clearable="false"
type="date"
:picker-options="expireDatePickerOptions"
placeholder="请选择提醒日期">
</el-date-picker>
<el-select v-model="form.expireDay" placeholder="请选择提醒日" v-show="form.noticeWay === '2'">
<el-option v-for="day in 31" :key="day" :label="day + '日'" :value="day"/>
</el-select>
</el-row>
</el-form-item>
</el-col>
<el-col :span="span">
<el-form-item label="服务费承担方" prop="tenantBearServiceFee" label-width="7em">
<el-select v-model="form.tenantBearServiceFee" style="width: 100%">
<el-option :value="true" label="租户"/>
<el-option :value="false" label="房东"/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="span">
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
<el-input v-model="form.remark" type="textarea" placeholder="请输入备注" />
</el-form-item>
</el-col>
</el-row>
@ -292,21 +233,22 @@
</template>
<script>
import {listDevice, getDevice, addDevice, updateDevice, logicDelDevice} from "@/api/system/device";
import { listDevice, getDevice, addDevice, updateDevice, logicDelDevice, updateDeviceSn } from '@/api/system/device'
import ModelSelect from "@/components/Business/Model/modelSelect.vue";
import GroupSelect from "@/components/Business/Group/groupSelect.vue";
import SmUserSelect from "@/components/Business/SmUser/smUserSelect.vue";
import QrCode from "@/components/QrCode/index.vue";
import {getWxIndexUrl, getWxSchemeUrl} from "@/utils/wx";
import {getWxIndexUrl} from "@/utils/wx";
import SnInput from '@/components/SnInput/index.vue'
import StoreInput from '@/components/Business/Store/StoreInput.vue'
export default {
name: "Device",
components: {QrCode, SmUserSelect, GroupSelect, ModelSelect},
components: { StoreInput, SnInput, QrCode, SmUserSelect, ModelSelect},
dicts: ['sm_device_online_status', 'sm_device_status', 'sm_device_outage_way','sm_device_notice_way'],
data() {
return {
span: 12,
gutter: 16,
span: 24,
gutter: 8,
//
loading: true,
//
@ -342,29 +284,30 @@ export default {
form: {},
//
rules: {
groupId: [
{ required: true, message: "分组不能为空", trigger: "change" }
storeId: [
{ required: true, message: "店铺不能为空", trigger: "change" }
],
modelId: [
{ required: true, message: "型号不能为空", trigger: "change" }
],
userId: [
{ required: true, message: "房东不能为空", trigger: "change" }
{ required: true, message: "商户不能为空", trigger: "change" }
],
deviceName: [
{ required: true, message: "设备名称不能为空", trigger: "change" }
],
},
//
groupSearchForm: {
userId: null,
mac: [
{ required: true, message: "设备MAC不能为空", trigger: "change" }
],
},
//
expireDatePickerOptions: {
disabledDate(date) {
return date.getTime() <= Date.now();
}
}
},
showBindSn: false,
snLoading: false,
};
},
computed: {
@ -382,22 +325,25 @@ export default {
this.getList();
},
methods: {
//
onSubmitUser(user) {
this.form.userName = user?.userName;
this.form.nickName = user?.nickName;
this.onSubmitGroup(null);
handleBindSn(row) {
this.form.deviceId = row.deviceId;
this.showBindSn = true;
},
//
beforeOpenGroup() {
if (this.form.userId == null) {
this.$message.error("请先选择房东")
return false;
}
this.groupSearchForm.userId = this.form.userId;
return true;
// SN
onSubmitSn(data) {
this.snLoading = true;
updateDeviceSn(this.form.deviceId, data.sn).then(res => {
if (res.code !== 200) {
return this.$message.error(res.msg);
}
this.$message.success("操作成功");
this.showBindSn = false;
this.getList();
}).finally(()=> {
this.snLoading = false;
})
},
//
//
onSubmitGroup(group) {
this.form.groupId = group?.groupId;
this.form.groupName = group?.groupName;

View File

@ -9,7 +9,7 @@
</template>
</el-table-column>
<el-table-column align="center" label="型号" prop="model"></el-table-column>
<el-table-column align="center" label="分组" prop="groupName"></el-table-column>
<el-table-column align="center" label="店铺" prop="storeName"></el-table-column>
<el-table-column align="center" label="最近更新时间" prop="updateTime"></el-table-column>
<el-table-column align="center" label="状态">
<template slot-scope="d">

View File

@ -5,8 +5,8 @@
<div class="user-header">
<el-avatar :size="64" :src="userData.avatar"></el-avatar>
<el-row type="flex" class="name-box">
<span class="user-name">{{userData.userName}}</span>
<dict-tag :options="dict.type.sm_user_type" :value="userData.userType"></dict-tag>
<span class="user-name">{{userData.nickName}}</span>
<el-tag type="primary" v-if="userData.isMch">商户</el-tag>
</el-row>
<div class="phone-number">{{userData.phonenumber}}</div>
</div>
@ -14,10 +14,11 @@
<div class="user-description">
<el-descriptions>
<el-descriptions-item label="微信">{{userData.wxOpenId}}</el-descriptions-item>
<el-descriptions-item label="总设备数" :span="2">{{userData.deviceCount}}</el-descriptions-item>
<el-descriptions-item label="账户余额">{{userData.balance | money}}</el-descriptions-item>
<el-descriptions-item label="总收入">{{userData.totalIncome | money}}</el-descriptions-item>
<el-descriptions-item label="总提现">{{userData.withDrawlAmount | money}}</el-descriptions-item>
<el-descriptions-item label="店铺数">{{userData.storeCount}} </el-descriptions-item>
<el-descriptions-item label="设备数">{{userData.deviceCount}} </el-descriptions-item>
<el-descriptions-item label="账户余额">{{userData.balance | money}} </el-descriptions-item>
<el-descriptions-item label="总收入">{{userData.totalIncome | money}} </el-descriptions-item>
<el-descriptions-item label="总提现">{{userData.withDrawlAmount | money}} </el-descriptions-item>
</el-descriptions>
</div>
</div>

View File

@ -114,7 +114,7 @@
<image-preview :src="d.row.avatar" :width="50" :height="50"/>
</template>
</el-table-column>
<el-table-column label="绑定设备数" align="center" prop="deviceCount" width="100" />
<el-table-column label="店铺数量" align="center" prop="storeCount" width="100" />
<el-table-column label="充值金额" align="center" prop="rechargeAmount" />
<el-table-column label="提现金额" align="center" prop="withDrawlAmount" />
<el-table-column label="账户余额" align="center" prop="balance" />