提交测试环境
This commit is contained in:
parent
3f0b6cb5f1
commit
29c719dfd4
src
api/system
components/Business/Model
views
|
@ -92,3 +92,23 @@ export function resetDevice(deviceId) {
|
|||
method: 'put'
|
||||
})
|
||||
}
|
||||
|
||||
// 批量修改型号
|
||||
export function batchUpdateModel(deviceIds, modelId) {
|
||||
return request({
|
||||
url: `/system/device/batchUpdateModel`,
|
||||
method: 'put',
|
||||
data: {
|
||||
deviceIds,
|
||||
modelId
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 设备开关
|
||||
export function switchDevice(deviceId, open) {
|
||||
return request({
|
||||
url: `/system/device/${deviceId}/switch?open=${open}`,
|
||||
method: 'put'
|
||||
})
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<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 size="small" :inline="true" label-width="6em" @submit.native.prevent = "onSearch">
|
||||
<el-form-item label="型号名称:">
|
||||
<el-input v-model="searchForm.modelName" clearable></el-input>
|
||||
</el-form-item>
|
||||
|
|
|
@ -8,12 +8,13 @@
|
|||
:placeholder="placeholder"></el-input>
|
||||
<span v-else>{{showValue}}</span>
|
||||
|
||||
<model-dialog :show.sync="dialogShow"
|
||||
:search="search"
|
||||
:multiple="multiple"
|
||||
:init-select="realValue"
|
||||
@select="onSubmit"
|
||||
:title="title"></model-dialog>
|
||||
<model-dialog
|
||||
:show.sync="dialogShow"
|
||||
:search="search"
|
||||
:multiple="multiple"
|
||||
:init-select="realValue"
|
||||
@select="onSubmit"
|
||||
:title="title"/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
|
|
@ -134,12 +134,15 @@
|
|||
<el-dialog :title="title" :visible.sync="open" width="50%" append-to-body :close-on-click-modal="false">
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
||||
<el-row :gutter="8">
|
||||
<form-col label="所属用户" prop="userId" :span="span * 2">
|
||||
<user-input v-model="form.userId" :query="userQuery"/>
|
||||
</form-col>
|
||||
<form-col label="店铺图片" prop="picture" :span="span * 2">
|
||||
<image-upload v-model="form.picture" :limit="9"/>
|
||||
</form-col>
|
||||
<form-col label="所属用户" prop="userId" :span="span">
|
||||
<user-input v-model="form.userId" :query="userQuery"/>
|
||||
</form-col>
|
||||
<form-col label="是否显示" prop="show" :span="span">
|
||||
<el-switch v-model="form.show"/>
|
||||
</form-col>
|
||||
<form-col label="店铺名称" prop="name" :span="span * 2">
|
||||
<el-input v-model="form.name" placeholder="请输入店铺名称" />
|
||||
</form-col>
|
||||
|
@ -342,7 +345,8 @@ export default {
|
|||
createBy: null,
|
||||
updateTime: null,
|
||||
updateBy: null,
|
||||
deleted: null
|
||||
deleted: null,
|
||||
show: true
|
||||
};
|
||||
this.resetForm("form");
|
||||
},
|
||||
|
|
|
@ -92,6 +92,7 @@
|
|||
</el-table-column>
|
||||
<el-table-column label="详细说明" align="center" prop="description" show-overflow-tooltip/>
|
||||
<el-table-column label="创建时间" align="center" prop="createTime" />
|
||||
<el-table-column label="sourceId" align="center" prop="sourceId" />
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
|
|
|
@ -3,6 +3,8 @@
|
|||
<el-card class="box-card">
|
||||
<el-descriptions title="设备详情">
|
||||
<template slot="extra">
|
||||
<el-button icon="el-icon-switch-button" @click="handleSwitch(true)">强制开启</el-button>
|
||||
<el-button icon="el-icon-switch-button" @click="handleSwitch(false)">强制关闭</el-button>
|
||||
<el-button icon="el-icon-refresh" @click="handleReset">时长归零</el-button>
|
||||
<el-button icon="el-icon-plus" @click="handleAddElectricity">增加时长</el-button>
|
||||
<el-button icon="el-icon-refresh" @click="refreshIot" style="margin-right: 1em">刷新设备信息</el-button>
|
||||
|
@ -40,7 +42,7 @@
|
|||
{{deviceData.remainTime / 60 | money | defaultValue}} 分钟
|
||||
<span class="remark-text">最近更新时间:{{deviceData.lastPullTime}}</span>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="实时功率">{{deviceData.realTimePower | defaultValue}} KWH</el-descriptions-item>
|
||||
<!-- <el-descriptions-item label="实时功率">{{deviceData.realTimePower | defaultValue}} KWH</el-descriptions-item>-->
|
||||
<el-descriptions-item label="备注">{{deviceData.remark | defaultValue}}</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
</el-card>
|
||||
|
@ -89,7 +91,7 @@
|
|||
|
||||
<script>
|
||||
|
||||
import { addTime, getDevice, refreshIot, resetDevice } from '@/api/system/device'
|
||||
import { addTime, getDevice, refreshIot, resetDevice, switchDevice } from '@/api/system/device'
|
||||
import LineChart from "@/views/dashboard/LineChart.vue";
|
||||
import RechargeRecord from "@/views/system/device/components/rechargeRecord.vue";
|
||||
import {formatDate} from "@/utils";
|
||||
|
@ -143,6 +145,22 @@ export default {
|
|||
clearInterval(this.timer);
|
||||
},
|
||||
methods: {
|
||||
handleSwitch(open) {
|
||||
this.$confirm(`是否确认强制${open ? '开启' : '关闭'}设备?`, '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
this.loading = true;
|
||||
switchDevice(this.deviceData.deviceId, open).then(res => {
|
||||
if (res.code === 200) {
|
||||
this.$message.success("操作成功");
|
||||
}
|
||||
}).finally(() => {
|
||||
this.loading = false;
|
||||
})
|
||||
})
|
||||
},
|
||||
// 计算剩余时长
|
||||
computeSurplusTime() {
|
||||
console.log('compute', this.deviceData.expireTime , this.surplusTime );
|
||||
|
|
|
@ -118,6 +118,17 @@
|
|||
v-hasPermi="['system:device:export']"
|
||||
>导出</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="warning"
|
||||
plain
|
||||
icon="el-icon-edit"
|
||||
size="mini"
|
||||
@click="handleBatchModel"
|
||||
:disabled="multiple"
|
||||
v-hasPermi="['system:device:edit']"
|
||||
>批量修改型号</el-button>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
|
@ -251,11 +262,26 @@
|
|||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
||||
<!--型号选择弹窗-->
|
||||
<model-dialog
|
||||
:show.sync="showCheckModel"
|
||||
@select="onSubmitBatchModel"
|
||||
/>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listDevice, getDevice, addDevice, updateDevice, logicDelDevice, updateDeviceSn } from '@/api/system/device'
|
||||
import {
|
||||
listDevice,
|
||||
getDevice,
|
||||
addDevice,
|
||||
updateDevice,
|
||||
logicDelDevice,
|
||||
updateDeviceSn,
|
||||
batchUpdateModel
|
||||
} from '@/api/system/device'
|
||||
import ModelSelect from "@/components/Business/Model/modelSelect.vue";
|
||||
import SmUserSelect from "@/components/Business/SmUser/smUserSelect.vue";
|
||||
import QrCode from "@/components/QrCode/index.vue";
|
||||
|
@ -264,13 +290,16 @@ import SnInput from '@/components/SnInput/index.vue'
|
|||
import StoreInput from '@/components/Business/Store/StoreInput.vue'
|
||||
import UserInput from '@/components/Business/SmUser/UserInput.vue'
|
||||
import { isEmpty } from '@/utils'
|
||||
import ModelDialog from '@/components/Business/Model/modelDialog.vue'
|
||||
|
||||
export default {
|
||||
name: "Device",
|
||||
components: { UserInput, StoreInput, SnInput, QrCode, SmUserSelect, ModelSelect},
|
||||
components: { ModelDialog, UserInput, StoreInput, SnInput, QrCode, SmUserSelect, ModelSelect},
|
||||
dicts: ['sm_device_online_status', 'sm_device_status', 'sm_device_outage_way','sm_device_notice_way'],
|
||||
data() {
|
||||
return {
|
||||
// 是否展示选择型号弹窗
|
||||
showCheckModel: false,
|
||||
span: 24,
|
||||
gutter: 8,
|
||||
// 遮罩层
|
||||
|
@ -341,6 +370,19 @@ export default {
|
|||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
// 选中型号后
|
||||
onSubmitBatchModel(model) {
|
||||
if (model == null) {
|
||||
return;
|
||||
}
|
||||
batchUpdateModel(this.ids, model.modelId).then(res => {
|
||||
if (res.code === 200) {
|
||||
this.$message.success("操作成功");
|
||||
this.showCheckModel = false;
|
||||
this.getList();
|
||||
}
|
||||
})
|
||||
},
|
||||
isEmpty,
|
||||
handleBindSn(row) {
|
||||
this.form.deviceId = row.deviceId;
|
||||
|
@ -471,6 +513,9 @@ export default {
|
|||
}
|
||||
});
|
||||
},
|
||||
handleBatchModel() {
|
||||
this.showCheckModel = true;
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const deviceIds = row.deviceId || this.ids;
|
||||
|
|
|
@ -138,6 +138,9 @@
|
|||
<template v-else-if="column.key === 'deviceCount'">
|
||||
{{d.row.deviceCount | defaultValue}} 台
|
||||
</template>
|
||||
<template v-else-if="column.key === 'deviceAdmin'">
|
||||
<el-tag :type="d.row.deviceAdmin ? 'danger' : 'info'">{{d.row.deviceAdmin ? '是' : '否'}}</el-tag>
|
||||
</template>
|
||||
<template v-else>
|
||||
{{d.row[column.key]}}
|
||||
</template>
|
||||
|
@ -201,6 +204,9 @@
|
|||
<el-input v-model="form.phonenumber" placeholder="请输入手机号" :maxlength="11" show-word-limit
|
||||
clearable prefix-icon='el-icon-mobile' :style="{width: '100%'}"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="是否设备管理员" prop="deviceAdmin" label-width="9em">
|
||||
<el-switch v-model="form.deviceAdmin" active-text="是" inactive-text="否" @change="onChangeDeviceAdmin"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="form.remark" placeholder="请输入备注" :maxlength="500" show-word-limit type="textarea"/>
|
||||
</el-form-item>
|
||||
|
@ -248,6 +254,7 @@ export default {
|
|||
{key: 'serviceRate', visible: true, label: '服务费费率', align: 'center', minWidth: null, sortable: true},
|
||||
{key: 'status', visible: true, label: '账号状态', align: 'center', minWidth: null, sortable: true},
|
||||
{key: 'deviceCount', visible: true, label: '设备数量', align: 'center', minWidth: null, sortable: false},
|
||||
{key: 'deviceAdmin', visible: false, label: '设备管理员', align: 'center', minWidth: null, sortable: false},
|
||||
],
|
||||
openServiceRate: false,
|
||||
// 遮罩层
|
||||
|
@ -287,7 +294,7 @@ export default {
|
|||
sex: undefined,
|
||||
identityCard: undefined,
|
||||
phonenumber: '',
|
||||
address: undefined,
|
||||
address: null,
|
||||
},
|
||||
// 表单校验
|
||||
rules: {
|
||||
|
@ -323,6 +330,20 @@ export default {
|
|||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
onChangeDeviceAdmin(val) {
|
||||
if (val) {
|
||||
this.$confirm('【高危操作】是否确认设置用户为设备管理员?<br/>用户将可以通过微信小程序注册设备!', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning',
|
||||
dangerouslyUseHTMLString: true
|
||||
}).then(() => {
|
||||
this.form.deviceAdmin = true;
|
||||
}).catch((e) => {
|
||||
this.form.deviceAdmin = false;
|
||||
});
|
||||
}
|
||||
},
|
||||
onSortChange(column) {
|
||||
if (column.order == null) {
|
||||
this.queryParams.orderByColumn = defaultSort.prop;
|
||||
|
@ -367,6 +388,7 @@ export default {
|
|||
sex: "2",
|
||||
avatar: null,
|
||||
isMch: false,
|
||||
deviceAdmin: false,
|
||||
};
|
||||
this.resetForm("form");
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue
Block a user