Commit a0ebe869 authored by Administrator's avatar Administrator
parents 7ed4003b 68680e14
Pipeline #81 failed with stages
...@@ -411,7 +411,7 @@ class DevicesController extends Controller ...@@ -411,7 +411,7 @@ class DevicesController extends Controller
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 { } else {
$this->timeline('删除了设备'); $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 = { ...@@ -46,6 +46,7 @@ const actions = {
login({ email: email.trim(), password: password, userOrAdmin: userOrAdmin }) login({ email: email.trim(), password: password, userOrAdmin: userOrAdmin })
.then(response => { .then(response => {
localStorage.setItem('userinfoid', response.id); localStorage.setItem('userinfoid', response.id);
localStorage.setItem('isroles', response.roles);
commit('SET_TOKEN', response.token); commit('SET_TOKEN', response.token);
setToken(response.token); setToken(response.token);
resolve(); resolve();
......
...@@ -134,8 +134,12 @@ export default { ...@@ -134,8 +134,12 @@ export default {
adddevice(this.form) adddevice(this.form)
.then(response => { .then(response => {
if (response.code === 200) { if (response.code === 200) {
if (localStorage.getItem('isroles') === 'admin') {
this.$router.push({ path: '/device/device' });
} else {
this.$router.push({ path: '/userdevice/device' }); this.$router.push({ path: '/userdevice/device' });
} }
}
}) })
.catch(err => { .catch(err => {
console.log(err); console.log(err);
......
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
<el-table-column prop="state" label="状态"> <el-table-column prop="state" label="状态">
<template slot-scope="scope"> <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> <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> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
......
...@@ -99,10 +99,10 @@ ...@@ -99,10 +99,10 @@
<el-table-column align="center" label="操作" width="300px"> <el-table-column align="center" label="操作" width="300px">
<template slot-scope="scope"> <template slot-scope="scope">
<el-popover width="160" trigger="click" placement="top"> <el-popover width="160" trigger="click" placement="top">
<p>此操作,分丢弃废纸篓,禁用用户</p> <p>此操作,分丢弃废纸篓,删除设备</p>
<div style="text-align: right; margin: 0"> <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 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> </div>
<el-button slot="reference" size="mini" type="danger" :disabled="scope.row.delete == 1 ? true : (scope.row.devicestatus > 1 ? true : false) ">操作</el-button> <el-button slot="reference" size="mini" type="danger" :disabled="scope.row.delete == 1 ? true : (scope.row.devicestatus > 1 ? true : false) ">操作</el-button>
</el-popover> </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