Commit f63b9396 by YG8999

设备网关

parent c039b8ff
......@@ -42,3 +42,13 @@ export function delDevice(id) {
method: 'delete'
})
}
//开门、关门、取电、断电
export function openOrClose(data) {
return request({
url: '/system/device/openOrClose',
method: 'post',
data: data
})
}
......@@ -117,6 +117,39 @@
v-hasPermi="['system:device:remove']"
>删除
</el-button>
<el-button v-if="scope.row.devType=='CCEE'"
size="mini"
type="text"
icon="el-icon-switch"
@click="openOrClose(scope.row, '10')"
v-hasPermi="['system:device:edit']"
>开门
</el-button>
<el-button v-if="scope.row.devType=='CCEE'"
size="mini"
type="text"
icon="el-icon-switch"
@click="openOrClose(scope.row, '30')"
v-hasPermi="['system:device:edit']"
>关门
</el-button>
<el-button v-if="scope.row.devType=='0001'"
size="mini"
type="text"
icon="el-icon-switch"
@click="openOrClose(scope.row, '20')"
v-hasPermi="['system:device:edit']"
>取电
</el-button>
<el-button v-if="scope.row.devType=='0001'"
size="mini"
type="text"
icon="el-icon-switch"
@click="openOrClose(scope.row, '40')"
v-hasPermi="['system:device:edit']"
>断电
</el-button>
</template>
</el-table-column>
</el-table>
......@@ -197,7 +230,7 @@
</template>
<script>
import {listDevice, getDevice, delDevice, addDevice, updateDevice} from "@/api/system/device";
import {listDevice, getDevice, delDevice, addDevice, updateDevice, openOrClose} from "@/api/system/device";
import selectStore from "./selectStore";
......@@ -383,6 +416,26 @@ export default {
}).catch(() => {
});
},
/** 开门、关门、取电、断电 */
openOrClose(row, opType) {
let data = {devId: row.devId, opType: opType};
openOrClose(data).then(response => {
let msg = '操作成功';
if (opType === '10') {
msg = '开门成功';
}
if (opType === '20') {
msg = '取电成功';
}
if (opType === '30') {
msg = '关门成功';
}
if (opType === '40') {
msg = '断电成功';
}
this.$modal.msgSuccess(msg);
});
},
/** 导出按钮操作 */
handleExport() {
this.download('system/device/export', {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment