Commit 922fd930 authored by 冯超鹏's avatar 冯超鹏

提交新模块

parent 6a4e8c57
Pipeline #35 failed with stages
...@@ -233,7 +233,6 @@ class DevicesController extends Controller ...@@ -233,7 +233,6 @@ class DevicesController extends Controller
} }
//批量上传设备 //批量上传设备
public function batchdevice(){ public function batchdevice(){
} }
//获取设备详情信息 //获取设备详情信息
public function deviceDataInfo($id){ public function deviceDataInfo($id){
...@@ -275,6 +274,31 @@ class DevicesController extends Controller ...@@ -275,6 +274,31 @@ class DevicesController extends Controller
->select('r.*','s.status_name') ->select('r.*','s.status_name')
->get()->toArray(); ->get()->toArray();
} }
//返回设备废纸篓数量
public function deviceBasket(){
return $this->jsonSuccessData(DB::table('device')->where('delete','=','1')->count());
}
//返回设备废纸篓和禁用设备
public function deviceBasketList(){
$paper = DB::table('device')->where('delete','=','1')->get()->toArray();
return $this->jsonSuccessData($paper);
}
public function deviceDelete(Request $request){
$id = $request->input('id');
$type = $request->input('type');
if ($type == 1){//丢弃废纸篓
return $this->jsonSuccessData(DB::table('device')->where('id','=',$id)->update(['delete'=>1,'devicestatus'=>6]));
}else{
return $this->jsonSuccessData(DB::table('device')->where('id','=',$id)->update(['devicestatus'=>6]));
}
}
public function UpPaperBasket($id){
return $this->jsonSuccessData(DB::table('device')->where('id','=',$id)->update(['delete'=>2,'devicestatus'=>1]));
}
/** /**
* @param bool $isNew * @param bool $isNew
* @return array * @return array
......
...@@ -480,31 +480,15 @@ class UserController extends Controller ...@@ -480,31 +480,15 @@ class UserController extends Controller
} }
//查看所有逻辑删除用户 和禁用用户 //查看所有逻辑删除用户 和禁用用户
public function deupuser(Request $request) public function UpPaperBasket($id)
{ {
$pagenNum = $request->input('page') - 1;//页数 return $this->jsonSuccessData(DB::table('BackgroundUser')->where('id','=',$id)->update(['state'=>'2']));
$limit = $request->input('limit'); }
if (is_null($pagenNum)) {
return $this->jsonErrorData(105, 'page不能为空'); //禁用用户
} public function UpuserForbidden($id)
if (is_null($limit)) { {
return $this->jsonErrorData(105, 'limt不能为空'); return $this->jsonSuccessData(DB::table('BackgroundUser')->where('id','=',$id)->update(['state'=>'3']));
}
$users = DB::table('BackgroundUser as b')
->where('b.state', '!=', '2')
->leftjoin('areachina as p', 'b.provinceid', '=', 'p.areaid')
->leftjoin('areachina as c', 'b.cityid', '=', 'c.areaid')
->leftjoin('areachina as a', 'b.areaid', '=', 'a.areaid')
->orderBy('b.id', 'desc')
->select('b.username', 'b.state', 'b.nickname', 'b.email', 'b.state', 'a.area_name as area', 'c.area_name as city', 'p.area_name as province')
->offset($pagenNum)
->limit($limit)
->get()->toArray();
if ($users) {
return $this->jsonSuccessData($users);
} else {
return $this->jsonErrorData(105, '获取失败');
}
} }
/* /*
...@@ -515,4 +499,22 @@ class UserController extends Controller ...@@ -515,4 +499,22 @@ class UserController extends Controller
return $this->jsonSuccessData(DB::table('contactsuser')->where([['contactsid', '=', Auth::id()], ['isadmin', '=', is_null($this->isadmin()) ? '2' : '1'],['isstatus', '=', '1']])->get()); return $this->jsonSuccessData(DB::table('contactsuser')->where([['contactsid', '=', Auth::id()], ['isadmin', '=', is_null($this->isadmin()) ? '2' : '1'],['isstatus', '=', '1']])->get());
} }
/*
* 返回废纸篓数量
* */
public function paperBasket()
{
return $this->jsonSuccessData(DB::table('BackgroundUser')->where('state','=','1')->count());
}
/*
* 返回废纸篓 和状态
* */
public function paperBasketList()
{
$paper = DB::table('BackgroundUser')->where('state','=','1')->get()->toArray();
$stutus = DB::table('BackgroundUser')->where('state','=','3')->get()->toArray();
return $this->jsonSuccessData(['paper'=>$paper,'stutus'=>$stutus]);
}
} }
\ No newline at end of file
...@@ -29,3 +29,30 @@ export function deviceDataSearch(data) { ...@@ -29,3 +29,30 @@ export function deviceDataSearch(data) {
}); });
} }
export function deviceBasket() {
return request({
url: '/devices/deviceBasket',
method: 'get',
});
}
export function deviceDelete(id, type) {
return request({
url: '/devices/deviceDelete?id=' + id + '&type=' + type,
method: 'get',
});
}
export function deviceBasketList() {
return request({
url: '/devices/deviceBasketList',
method: 'get',
});
}
export function UpPaperBasket(id) {
return request({
url: '/devices/UpPaperBasket/' + id,
method: 'get',
});
}
...@@ -37,3 +37,31 @@ export function postUpUser(data) { ...@@ -37,3 +37,31 @@ export function postUpUser(data) {
data, data,
}); });
} }
export function paperBasket() {
return request({
url: '/user/paperBasket',
method: 'get',
});
}
export function UpPaperBasket(id) {
return request({
url: '/user/UpPaperBasket/' + id,
method: 'get',
});
}
export function UpuserForbidden(id) {
return request({
url: '/user/UpuserForbidden/' + id,
method: 'get',
});
}
export function paperBasketList() {
return request({
url: '/user/paperBasketList',
method: 'get',
});
}
...@@ -24,6 +24,12 @@ const deviceRoutes = { ...@@ -24,6 +24,12 @@ const deviceRoutes = {
name: 'Categories', name: 'Categories',
meta: { title: '设备分类', icon: 'tree-table', permissions: ['manage categories'] }, meta: { title: '设备分类', icon: 'tree-table', permissions: ['manage categories'] },
}, },
{
path: 'DeviceStutus',
component: () => import('@/views/device/devicedtutus'),
name: 'DeviceStutus',
meta: { title: '设备状态列表', icon: 'devicestutus', permissions: ['manage user'] },
},
], ],
}; };
export default deviceRoutes; export default deviceRoutes;
...@@ -30,6 +30,12 @@ const usersRoutes = { ...@@ -30,6 +30,12 @@ const usersRoutes = {
name: 'Installer', name: 'Installer',
meta: { title: '装维人员', icon: 'role' }, meta: { title: '装维人员', icon: 'role' },
}, },
{
path: 'userStatus',
component: () => import('@/views/user/userStatus'),
name: 'userStatus',
meta: { title: '用户状态', icon: 'userstutus', permissions: ['manage user'] },
},
], ],
}; };
export default usersRoutes; export default usersRoutes;
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<div class="app-container"> <div class="app-container">
<div class="filter-container"> <div class="filter-container">
<el-form ref="query" :model="deviceSearch" style="display: inline-block;"> <el-form ref="query" :model="deviceSearch" style="display: inline-block;">
<el-input v-model="deviceSearch.deviceName" placeholder="用户名称" style="width: 200px;" class="filter-item" name="userskk" /> <el-input v-model="deviceSearch.deviceName" placeholder="设备编号" style="width: 200px;" class="filter-item" name="userskk" />
<el-button v-waves class="filter-item" type="primary" icon="el-icon-search" @click="handleSubmit"> <el-button v-waves class="filter-item" type="primary" icon="el-icon-search" @click="handleSubmit">
{{ $t('table.search') }} {{ $t('table.search') }}
</el-button> </el-button>
...@@ -10,6 +10,11 @@ ...@@ -10,6 +10,11 @@
<el-button v-if="device != '' " v-waves :loading="downloadLoading" class="filter-item" type="primary" icon="el-icon-download" @click="handleDownload"> <el-button v-if="device != '' " v-waves :loading="downloadLoading" class="filter-item" type="primary" icon="el-icon-download" @click="handleDownload">
{{ $t('table.export') }} {{ $t('table.export') }}
</el-button> </el-button>
<el-badge v-if="paper > 0" :value="paper" class="item" style="margin-bottom: 8px;">
<el-button size="small">
<svg-icon class-name="custom-class" icon-class="feizhilou" />废纸篓
</el-button>
</el-badge>
</div> </div>
<el-tabs v-model="activeName" stretch @tab-click="handleClick"> <el-tabs v-model="activeName" stretch @tab-click="handleClick">
<el-tab-pane v-for="item in list" :key="item.tid" :label="item.tname" :tid="item.tid" :name="item.tid==1 ? 'second' : list.tid"></el-tab-pane> <el-tab-pane v-for="item in list" :key="item.tid" :label="item.tname" :tid="item.tid" :name="item.tid==1 ? 'second' : list.tid"></el-tab-pane>
...@@ -77,6 +82,18 @@ ...@@ -77,6 +82,18 @@
<span :style="{color:( scope.row.devicestatus==1 ? '#67C23A' : '#F56C6C' )}">{{ scope.row.devicestatus==1 ? '正常' : '设备错误' }}</span> <span :style="{color:( scope.row.devicestatus==1 ? '#67C23A' : '#F56C6C' )}">{{ scope.row.devicestatus==1 ? '正常' : '设备错误' }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column align="center" label="操作" width="170">
<template slot-scope="scope">
<el-popover width="160" trigger="click" placement="top">
<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>
</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>
</template>
</el-table-column>
</el-table> </el-table>
<pagination v-show="total>0" :total="total" :page.sync="page" :limit.sync="limit" @pagination="getList" /> <pagination v-show="total>0" :total="total" :page.sync="page" :limit.sync="limit" @pagination="getList" />
...@@ -109,7 +126,7 @@ ...@@ -109,7 +126,7 @@
</template> </template>
<script> <script>
import { deviceTypeList, deviceList, deviceDataInfo, deviceDataSearch } from '@/api/device'; import { deviceTypeList, deviceList, deviceDataInfo, deviceDataSearch, deviceBasket, deviceDelete } from '@/api/device';
import Pagination from '@/components/Pagination'; // 分页 import Pagination from '@/components/Pagination'; // 分页
import waves from '@/directive/waves'; // 水波纹效果 import waves from '@/directive/waves'; // 水波纹效果
import clip from '@/utils/clipboard'; import clip from '@/utils/clipboard';
...@@ -139,11 +156,13 @@ export default { ...@@ -139,11 +156,13 @@ export default {
limit: 10, limit: 10,
type: '', type: '',
total: 0, total: 0,
paper: undefined,
}; };
}, },
created() { created() {
this.getList(); // 设备状态 this.getList(); // 设备状态
this.devicelist(); this.devicelist();
this.deviceBasket();
}, },
methods: { methods: {
...@@ -246,6 +265,38 @@ export default { ...@@ -246,6 +265,38 @@ export default {
console.log(err); console.log(err);
}); });
}, },
// 获取废纸篓数量
deviceBasket() {
deviceBasket()
.then(response => {
this.paper = response.data;
})
.catch(err => {
console.log(err);
});
},
deviceDelete(id, type) {
this.$confirm('是否将用户丢弃', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
}).then(() => {
deviceDelete(id, type)
.then(response => {
this.getList();
this.devicelist();
this.deviceBasket();
})
.catch(err => {
console.log(err);
});
}).catch(() => {
this.$message({
type: 'info',
message: '已取消',
});
});
},
}, },
}; };
</script> </script>
......
...@@ -13,6 +13,11 @@ ...@@ -13,6 +13,11 @@
<el-button v-if="userList != '' " v-waves :loading="downloadLoading" class="filter-item" type="primary" icon="el-icon-download" @click="handleDownload"> <el-button v-if="userList != '' " v-waves :loading="downloadLoading" class="filter-item" type="primary" icon="el-icon-download" @click="handleDownload">
{{ $t('table.export') }} {{ $t('table.export') }}
</el-button> </el-button>
<el-badge v-if="paper > 0" :value="paper" class="item" style="margin-bottom: 8px;">
<el-button size="small">
<svg-icon class-name="custom-class" icon-class="feizhilou" />废纸篓
</el-button>
</el-badge>
</div> </div>
<el-table :key="tableKey" v-loading="loading" :data="userList" border fit highlight-current-rows> <el-table :key="tableKey" v-loading="loading" :data="userList" border fit highlight-current-rows>
<el-table-column align="center" label="id" width="80"> <el-table-column align="center" label="id" width="80">
...@@ -50,7 +55,7 @@ ...@@ -50,7 +55,7 @@
<span>{{ scope.row.add_time | parseTime('{y}-{m}-{d} {h}:{i}') }}</span> <span>{{ scope.row.add_time | parseTime('{y}-{m}-{d} {h}:{i}') }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column align="center" label="状态" width="170"> <el-table-column align="center" label="状态" width="400">
<template slot-scope="scope"> <template slot-scope="scope">
<span :style="{color:( scope.row.state==1 ? '#F56C6C' : ( scope.row.state==3 ? '#909399' : '#67C23A' ) )}">{{ scope.row.state==1 ? '用户已被丢弃废纸篓' : ( scope.row.state==3 ? '禁用' : '正常' ) }}</span> <span :style="{color:( scope.row.state==1 ? '#F56C6C' : ( scope.row.state==3 ? '#909399' : '#67C23A' ) )}">{{ scope.row.state==1 ? '用户已被丢弃废纸篓' : ( scope.row.state==3 ? '禁用' : '正常' ) }}</span>
</template> </template>
...@@ -61,11 +66,12 @@ ...@@ -61,11 +66,12 @@
<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 size="mini" type="text" @click="userDelete(scope.row.id, 1)">丢弃废纸篓</el-button> <el-button v-if="scope.row.state>1" size="mini" type="text" @click="userDelete(scope.row.id, 1)">丢弃废纸篓</el-button>
<el-button type="text" size="mini" @click="userDelete(scope.row.id, 2)">删除</el-button> <el-button type="text" size="mini" @click="userDelete(scope.row.id, 2)">删除</el-button>
</div> </div>
<el-button slot="reference" size="mini" type="danger">删除</el-button> <el-button slot="reference" size="mini" type="danger">删除</el-button>
</el-popover> </el-popover>
<el-switch v-if="scope.row.state==2" :v-model="false" inactive-color="#ff4949" @change="UpuserForbidden(scope.row.id)"></el-switch>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
...@@ -96,7 +102,7 @@ ...@@ -96,7 +102,7 @@
</div> </div>
</template> </template>
<script> <script>
import { userList, userSeek, userDelete, userDataInfo, postUpUser } from '@/api/users'; import { userList, userSeek, userDelete, userDataInfo, postUpUser, paperBasket, UpuserForbidden } from '@/api/users';
import Pagination from '@/components/Pagination'; // 分页 import Pagination from '@/components/Pagination'; // 分页
import waves from '@/directive/waves'; // 水波纹效果 import waves from '@/directive/waves'; // 水波纹效果
import clip from '@/utils/clipboard'; import clip from '@/utils/clipboard';
...@@ -128,10 +134,12 @@ export default { ...@@ -128,10 +134,12 @@ export default {
company: undefined, company: undefined,
userid: undefined, userid: undefined,
}, },
paper: undefined,
}; };
}, },
created() { created() {
this.getUserList(); // 用户列表 this.getUserList(); // 用户列表
this.paperBasket();
}, },
methods: { methods: {
getUserList() { getUserList() {
...@@ -215,6 +223,7 @@ export default { ...@@ -215,6 +223,7 @@ export default {
}); });
} else { } else {
this.getUserList(); this.getUserList();
this.paperBasket();
} }
}) })
.catch(err => { .catch(err => {
...@@ -245,6 +254,7 @@ export default { ...@@ -245,6 +254,7 @@ export default {
if (response.code === 200) { if (response.code === 200) {
this.dialogPvVisible = false; this.dialogPvVisible = false;
this.getUserList(); this.getUserList();
this.paperBasket();
} }
} }
}) })
...@@ -276,6 +286,39 @@ export default { ...@@ -276,6 +286,39 @@ export default {
console.log(err); console.log(err);
}); });
}, },
// 获取废纸篓数量
paperBasket() {
paperBasket()
.then(response => {
if (response.code === 200) {
this.paper = response.data;
}
})
.catch(err => {
console.log(err);
});
},
UpuserForbidden(id) {
this.$confirm('是否将用户禁用', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
}).then(() => {
UpuserForbidden(id)
.then(response => {
this.getUserList();
this.paperBasket();
})
.catch(err => {
console.log(err);
});
}).catch(() => {
this.$message({
type: 'info',
message: '已取消',
});
});
},
}, },
}; };
</script> </script>
......
...@@ -38,7 +38,11 @@ Route::group(['middleware' => 'auth:api'], function () { ...@@ -38,7 +38,11 @@ Route::group(['middleware' => 'auth:api'], function () {
Route::match(['get','post'],'user/areachina','UserController@areachina')->middleware('permission:' . \App\Laravue\Acl::PERMISSION_PERMISSION_MANAGE);//获取地址列表 Route::match(['get','post'],'user/areachina','UserController@areachina')->middleware('permission:' . \App\Laravue\Acl::PERMISSION_PERMISSION_MANAGE);//获取地址列表
Route::post('user/addcontactsuser','UserController@addcontactsuser')->middleware('permission:' . \App\Laravue\Acl::PERMISSION_PERMISSION_MANAGE);//添加联系人 Route::post('user/addcontactsuser','UserController@addcontactsuser')->middleware('permission:' . \App\Laravue\Acl::PERMISSION_PERMISSION_MANAGE);//添加联系人
Route::get('user/contactslist','UserController@contactslist');//返回当前登入的联系人列表 Route::get('user/contactslist','UserController@contactslist');//返回当前登入的联系人列表
Route::get('user/deupuser','UserController@deupuser');//返回当前登入的联系人列表 Route::get('user/UpPaperBasket/{id}','UserController@UpPaperBasket');//更新废纸篓和禁用用户
Route::get('user/UpuserForbidden/{id}','UserController@UpuserForbidden');//禁用此用户
Route::get('user/paperBasket','UserController@paperBasket');//返回废纸篓数量
Route::get('user/paperBasketList','UserController@paperBasketList');//返回废纸篓和用户状态
}); });
//上传图片路由 //上传图片路由
...@@ -63,6 +67,10 @@ Route::group(['middleware'=>'auth:api'],function (){ ...@@ -63,6 +67,10 @@ Route::group(['middleware'=>'auth:api'],function (){
Route::match(['get','post'],'devices/updatedevice','DevicesController@updatedevice')->middleware('permission:' . \App\Laravue\Acl::PERMISSION_PERMISSION_MANAGE);//更新设备 Route::match(['get','post'],'devices/updatedevice','DevicesController@updatedevice')->middleware('permission:' . \App\Laravue\Acl::PERMISSION_PERMISSION_MANAGE);//更新设备
Route::get('devices/equipment','DevicesController@equipment');//获取设备监测列表 Route::get('devices/equipment','DevicesController@equipment');//获取设备监测列表
Route::get('devices/police','DevicesController@police');//获取设备当前报警列表 Route::get('devices/police','DevicesController@police');//获取设备当前报警列表
Route::get('devices/deviceBasket','DevicesController@deviceBasket');//获取设备废纸篓数量
Route::get('devices/deviceDelete','DevicesController@deviceDelete');//禁用设备和丢弃废纸篓
Route::get('devices/UpPaperBasket/{id}','DevicesController@UpPaperBasket');//更新废纸篓和禁用用户
Route::get('devices/deviceBasketList','DevicesController@deviceBasketList');//返回禁用设备和废纸篓设备
}); });
......
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