Commit a0ebe869 authored by Administrator's avatar Administrator
parents 7ed4003b 68680e14
Pipeline #81 failed with stages
......@@ -408,10 +408,10 @@ class DevicesController extends Controller
$type = $request->input('type');
if ($type == 1) {//丢弃废纸篓
$this->timeline('设备放到废纸篓[设备id' . $id . ']');
return $this->jsonSuccessData(DB::table('device')->where('id', '=', $id)->update(['delete' => 1, 'devicestatus' => 6, 'devicedeleteinfo' => $this->isadmin() == 1 ? '管理员将设备放置废纸篓' : '用户将设备放置废纸篓']));
return $this->jsonSuccessData(DB::table('device')->where('id', '=', $id)->update(['delete' => 1, 'devicestatus' => 6, 'devicedeleteinfo' => $this->isadmin() == 1 ? '管理员将设备放置废纸篓' : '用户将设备放置废纸篓']));
} else {
$this->timeline('删除了设备');
return $this->jsonSuccessData(DB::table('device')->where('id', '=', $id)->update(['devicestatus' => 6]));
return $this->jsonSuccessData(DB::table('device')->where('id', '=', $id)->delete());
}
}
......
......@@ -46,6 +46,7 @@ const actions = {
login({ email: email.trim(), password: password, userOrAdmin: userOrAdmin })
.then(response => {
localStorage.setItem('userinfoid', response.id);
localStorage.setItem('isroles', response.roles);
commit('SET_TOKEN', response.token);
setToken(response.token);
resolve();
......
......@@ -134,7 +134,11 @@ export default {
adddevice(this.form)
.then(response => {
if (response.code === 200) {
this.$router.push({ path: '/userdevice/device' });
if (localStorage.getItem('isroles') === 'admin') {
this.$router.push({ path: '/device/device' });
} else {
this.$router.push({ path: '/userdevice/device' });
}
}
})
.catch(err => {
......
......@@ -31,7 +31,7 @@
<el-table-column prop="state" label="状态">
<template slot-scope="scope">
<el-switch :v-model="scope.row.delete == 2" active-color="#13ce66" inactive-color="#ff4949" @change="UpPaperBasket(scope.row.id)"></el-switch>
<span>废纸篓用户</span>
<span>废纸篓设备</span>
</template>
</el-table-column>
</el-table>
......
......@@ -99,10 +99,10 @@
<el-table-column align="center" label="操作" width="300px">
<template slot-scope="scope">
<el-popover width="160" trigger="click" placement="top">
<p>此操作,分丢弃废纸篓,禁用用户</p>
<p>此操作,分丢弃废纸篓,删除设备</p>
<div style="text-align: right; margin: 0">
<el-button v-if="scope.row.delete==2" size="mini" type="text" @click="deviceDelete(scope.row.id, 1)">丢弃废纸篓</el-button>
<el-button type="text" size="mini" @click="deviceDelete(scope.row.id, 2)">禁用设备</el-button>
<el-button type="text" size="mini" @click="deviceDelete(scope.row.id, 2)">删除设备</el-button>
</div>
<el-button slot="reference" size="mini" type="danger" :disabled="scope.row.delete == 1 ? true : (scope.row.devicestatus > 1 ? true : false) ">操作</el-button>
</el-popover>
......
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