Commit 203bdf7b authored by 冯超鹏's avatar 冯超鹏

提交装维人员

parent 4df1e763
Pipeline #48 failed with stages
...@@ -17,31 +17,65 @@ use Validator; ...@@ -17,31 +17,65 @@ use Validator;
class InstallerController extends Controller class InstallerController extends Controller
{ {
//装维人员列表 //装维人员列表
public function installerlist (){ public function installerlist (Request $request){
return $this->jsonSuccessData(Installer::where('delete','=','1') $pagenNum= (int)$request->input('page')-1;//页数
->get()); $limit = (int)$request->input('limit');
$instllerdata = Installer::offset($pagenNum)->limit($limit)->get();
$count = Installer::count();
return $this->jsonSuccessData(['instllerdata'=>$instllerdata,'count'=>$count]);
} }
//用户添加 //用户添加
public function addinstaller(Request $request){ public function addinstaller(Request $request){
$keys = $request->all();
$validator = Validator::make($request->all(), $this->getValidationRulesinstaller(false)); $validator = Validator::make($request->all(), $this->getValidationRulesinstaller(false));
if ($validator->fails()) { if ($validator->fails()) {
return response()->json(['errors' => $validator->errors()], 403); return response()->json(['errors' => $validator->errors()], 403);
} }
$type = new Installer(); $type = new Installer();
return $this->jsonSuccessData($type->addinstall($request->all())); foreach ($keys as $key => $val) {
if ($key == 'ispassword') {
unset($keys[$key]);
}
}
return $this->jsonSuccessData($type->addinstall($keys));
}
// 用户搜索
public function seekInstaller(Request $request){
$keys = $request->all();
$handle = DB::table('installer');
foreach ($keys as $key => $val) {
if ($key == 'page') {
unset($keys[$key]);
} elseif ($key == 'limit'){
unset($keys[$key]);
}
}
foreach ($keys as $k => $v) {
if ($v == '正常'){
$v = 1;
}else if ($v == '禁用'){
$v = 2;
}
$keys[$key] && $handle->where($k, 'like', '%' . $v . '%');
}
return $this->jsonSuccessData(['instllerdata'=>$handle->get(),'count'=>$handle->count()]);
} }
//更新用户操作 //更新用户操作
public function updateinstaller(Request $request){ public function updateinstaller(Request $request){
$uid = $request->input('uid');//用户id $uid = $request->input('id');//用户id
$data = $request->all(); $data = $request->all();
if (is_null($uid)){ if (is_null($uid)){
return $this->jsonErrorData(105,'用户id不能为空'); return $this->jsonErrorData(105,'用户id不能为空');
} }
if ($_POST){ if ($request->isMethod('post')){
foreach ($data as $k => $v) { foreach ($data as $k => $v) {
if ($k == 'uid') { if ($k == 'id') {
unset($data[$k]); unset($data[$k]);
}else if ($k == 'ispassword'){
unset($data[$k]);
}else if ($k == 'password') {
$data['password'] = md5(md5($v) . $data['salt']);
} }
} }
$upin = Installer::where('id','=',(int)$uid)->update($data); $upin = Installer::where('id','=',(int)$uid)->update($data);
...@@ -72,10 +106,14 @@ class InstallerController extends Controller ...@@ -72,10 +106,14 @@ class InstallerController extends Controller
if ($type == 1){//物理删除 if ($type == 1){//物理删除
return $this->jsonSuccessData(Installer::where('id','=',$uid)->delete()); return $this->jsonSuccessData(Installer::where('id','=',$uid)->delete());
}elseif($type == 2){//逻辑删除 }elseif($type == 2){//逻辑删除
return $this->jsonSuccessData(Installer::where('id','=',$uid)->update(['delete'=>2])); return $this->jsonSuccessData(Installer::where('id','=',$uid)->update(['delete'=>2,'status'=>2]));
} }
} }
//用户回复正常
public function normalinstaller($id){
return $this->jsonSuccessData(Installer::where('id','=',$id)->update(['delete'=>1,'status'=>1]));
}
//验证用户提交表单 //验证用户提交表单
private function getValidationRulesinstaller($isNew = true){ private function getValidationRulesinstaller($isNew = true){
......
import request from '@/utils/request';
export function installerlist(limit, page) { // 设备类型
return request({
url: 'installer/installerlist?page=' + page + '&limit=' + limit,
method: 'get',
});
}
export function seekInstaller(data) { // 设备类型
return request({
url: 'installer/seekInstaller',
method: 'post',
data,
});
}
export function deleteInsrall(id, type) { // 删除设备
return request({
url: 'installer/deleteinstaller?uid=' + id + '&type=' + type,
method: 'get',
});
}
export function addinstaller(data) { // 添加
return request({
url: 'installer/addinstaller',
method: 'post',
data,
});
}
export function updateinstaller(id) { // 添加
return request({
url: 'installer/updateinstaller?id=' + id,
method: 'get',
});
}
export function postupdateinstaller(data) { // 添加
return request({
url: 'installer/updateinstaller',
method: 'post',
data,
});
}
export function normalinstaller(id) { // 添加
return request({
url: 'installer/normalinstaller/' + id,
method: 'get',
});
}
...@@ -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="userdata" style="display: inline-block;"> <el-form ref="query" :model="userdata" style="display: inline-block;">
<el-input v-model="userdata.nickname" placeholder="用户名称" style="width: 200px;" class="filter-item" name="userskk" /> <el-input v-model="userdata.nickname" placeholder="用户名称" clearable style="width: 200px;" class="filter-item" name="userskk" @input="changeValue" />
<el-select v-model="userdata.state" placeholder="状态" clearable class="filter-item" style="width: 130px" @change="selectOne"> <el-select v-model="userdata.state" placeholder="状态" clearable class="filter-item" style="width: 130px" @change="selectOne">
<el-option v-for="item in calendarTypeOptions" :key="item" :label="item" :value="item" /> <el-option v-for="item in calendarTypeOptions" :key="item" :label="item" :value="item" />
</el-select> </el-select>
...@@ -236,6 +236,11 @@ export default { ...@@ -236,6 +236,11 @@ export default {
this.userdata.state = undefined; this.userdata.state = undefined;
} }
}, },
changeValue(event, item) {
if (event === '') {
this.userdata.nickname = undefined;
}
},
// 重置 // 重置
resetForm() { resetForm() {
for (const key in this.upUserData) { for (const key in this.upUserData) {
......
This diff is collapsed.
...@@ -88,6 +88,8 @@ Route::group(['middleware'=>'auth:api'],function (){ ...@@ -88,6 +88,8 @@ Route::group(['middleware'=>'auth:api'],function (){
Route::post('installer/addinstaller','InstallerController@addinstaller')->middleware('permission:' . \App\Laravue\Acl::PERMISSION_PERMISSION_MANAGE);//添加新的装维人员 Route::post('installer/addinstaller','InstallerController@addinstaller')->middleware('permission:' . \App\Laravue\Acl::PERMISSION_PERMISSION_MANAGE);//添加新的装维人员
Route::match(['get','post'],'installer/updateinstaller','InstallerController@updateinstaller')->middleware('permission:' . \App\Laravue\Acl::PERMISSION_PERMISSION_MANAGE);//返回设备列表和更改设备 Route::match(['get','post'],'installer/updateinstaller','InstallerController@updateinstaller')->middleware('permission:' . \App\Laravue\Acl::PERMISSION_PERMISSION_MANAGE);//返回设备列表和更改设备
Route::get('installer/deleteinstaller','InstallerController@deleteinstaller')->middleware('permission:' . \App\Laravue\Acl::PERMISSION_PERMISSION_MANAGE);//删除用户 Route::get('installer/deleteinstaller','InstallerController@deleteinstaller')->middleware('permission:' . \App\Laravue\Acl::PERMISSION_PERMISSION_MANAGE);//删除用户
Route::post('installer/seekInstaller','InstallerController@seekInstaller')->middleware('permission:' . \App\Laravue\Acl::PERMISSION_PERMISSION_MANAGE);//用户搜索
Route::get('installer/normalinstaller/{id}','InstallerController@normalinstaller');//回复状态
}); });
// Fake APIs // Fake APIs
Route::get('/table/list', function () { Route::get('/table/list', function () {
......
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