PDM更新数据结构后,基础数据查询和BOM初始查询等基本功能都已经OK,待完善和细化相关的上传和下载服务等。

This commit is contained in:
panx
2024-12-29 22:18:05 +08:00
parent d3d429e964
commit d70fcccc1d
99 changed files with 4877 additions and 948 deletions

View File

@@ -0,0 +1,165 @@
<?php
declare (strict_types = 1);
namespace app\admin\controller;
use app\AdminController;
use Webman\Http\Request;
use app\admin\model\PdmFootprint as PdmFootprintModel;
use support\Response;
/**
* pdm_footprint
* 封装设计
* <!--partmanage-->
* Class PdmFootprint
* @package app\admin\controller
*/
class PdmFootprint extends AdminController
{
/**
* PdmFootprint模型对象
* @var \app\admin\model\PdmFootprint
*/
public function __construct()
{
parent::__construct();
$this->model = new PdmFootprintModel;
}
/**
* 默认生成的方法为index/add/edit/del/status 五个方法
* 当创建CURD的时候DIY的函数体和模板为空请自行编写代码
*/
/**
* 获取资源列表
* return Response
*/
public function index(): Response
{
if (request()->isAjax()) {
list($count, $list) = PdmFootprint::dataList(request()->all());
// $rules = list_to_tree($list,'id','pid','children',0);
$lists = list_to_tree($list,'id','pid','children',0);
return $this->success('获取成功', '/',$lists, $count);
// return $this->success('获取成功', '/');
}
return view('/pdm_footprint/index');
}
/**
* 获取资源列表
* @param array $params
* @return array
* @throws DataNotFoundException
* @throws DbException
* @throws ModelNotFoundException
*/
public static function dataList(array $params): array
{
$where = array();
if (!empty($params['footprint'])) {
$where[] = ['footprint','like','%'.$params['footprint'].'%'];
}
if (!empty($params['content'])) {
$where[] = ['content','like','%'.$params['content'].'%'];
}
$model = new PdmFootprintModel();
// $model = $this->model;
$count = $model->where($where)->count();
// $list = $model->where($where)->order('sort asc')->select()->toArray();
$list = $model->where($where)->order('sort asc')->select();
foreach($list as $key => $value){
// throw new \Exception(json_encode($value));
// throw new \Exception(json_encode($list[$key]->admin['nickname']));
$list[$key]['creator'] =__($list[$key]->admin['nickname']);
}
return [$count, $list->toArray()];
}
/**
* 添加节点数据
* @return Response
*/
public function add(): Response
{
if (request()->isPost()) {
$post = \request()->post();
// validate(\app\common\validate\system\AdminRules::class . '.add')->check($post);
$userid = get_admin_id();
$post['creatorid'] = $userid ;
if ($this->model->create($post)) {
return $this->success('添加FootPrint成功');
}
}
$data = $this->getTableFields();
$data['pid'] = input('pid', 0);
// $data['auth'] = 1;
// $data['type'] = 1;
list($count, $list) = PdmFootprint::dataList(request()->all());
return view('/pdm_footprint/add', [
'data' => $data,
'rules' => json_encode( list_to_tree($list), JSON_UNESCAPED_UNICODE),
]);
}
/**
* 编辑节点数据
* @return Response
* @throws DbException
* @throws DataNotFoundException
* @throws ModelNotFoundException
*/
public function edit(): Response
{
$id = input('id', 0);
$data = $this->model->find($id);
if (request()->isPost()) {
$post = \request()->post();
// validate(\app\common\validate\system\AdminRules::class . '.edit')->check($post);
if ($this->model->update($post)) {
return $this->success('更新FootPrint成功');
}
}
list($count, $list) = PdmFootprint::dataList(request()->all());
return view('/pdm_footprint/add', [
'data' => $data,
'rules' => json_encode( list_to_tree($list), JSON_UNESCAPED_UNICODE),
]);
}
/**
* 删除节点数据
* @return Response
* @throws DbException
*/
public function del(): Response
{
$id = input('id');
if (!empty($id)) {
// 查询子节点
if ($this->model->where('pid',$id)->count()) {
return $this->error('当前分类存在子项!');
}
// 删除单个
if ($this->model::destroy($id)) {
return $this->success('删除FootPrint成功');
}
}
return $this->error('删除失败,请检查您的参数!');
}
}

View File

@@ -4,7 +4,7 @@ namespace app\admin\controller;
use app\AdminController;
use Webman\Http\Request;
use app\common\model\PdmMfgName as PdmMfgNameModel;
use app\admin\model\PdmMfgName as PdmMfgNameModel;
use support\Response;
/**
* pdm_mfg_name
@@ -17,7 +17,7 @@ class PdmMfgName extends AdminController
{
/**
* PdmMfgName模型对象
* @var \app\common\model\PdmMfgName
* @var \app\admin\model\PdmMfgName
*/
public function __construct()
@@ -31,6 +31,43 @@ class PdmMfgName extends AdminController
* 当创建CURD的时候DIY的函数体和模板为空请自行编写代码
*/
/**
* 获取资源列表
* return Response
*/
public function index(): Response
{
$params = request()->all();
$where = array();
if (!empty($params['mfgname'])) {
$where[] = ['mfgname','like','%'.$params['mfgname'].'%'];
// $where[] = ['mfgname','like','%'.'ABRACON'.'%'];
}
if (!empty($params['mfgsite'])) {
$where[] = ['mfgsite','like','%'.$params['mfgsite'].'%'];
}
// $where[] = ['mfgname','like','%'.'ABRACON'.'%'];
$listtemp = $this->model->where($where)->select();
// $listtemp = $this->model->where($where);
// $listtemp = $this->model->find(1);
// throw new \Exception(json_encode($listtemp));
// $admin = $this->model->admin()->where($where)->select()->toArray();
// $admin = $listtemp->admin;
// throw new \Exception(json_encode($admin));
if (request()->isAjax()) {
list($count, $list) = PdmMfgName::dataList(request()->all());
// $rules = list_to_tree($list,'id','pid','children',0);
$lists = list_to_tree($list,'id','pid','children',0);
return $this->success('获取成功', '/',$lists, $count);
// return $this->success('获取成功', '/');
}
return view('/pdm_mfg_name/index');
}
/**
* 获取资源列表
@@ -46,47 +83,51 @@ class PdmMfgName extends AdminController
if (!empty($params['mfgname'])) {
$where[] = ['mfgname','like','%'.$params['mfgname'].'%'];
}
if (!empty($params['status'])) {
$where[] = ['status','like','%'.$params['status'].'%'];
if (!empty($params['mfgsite'])) {
$where[] = ['mfgsite','like','%'.$params['mfgsite'].'%'];
}
$model = new PdmMfgNameModel();
$count = $model->where($where)->count();
$list = $model->where($where)->order('sort asc')->select()->toArray();
// $list = $model->where($where)->order('sort asc')->select()->toArray();
$list = $model->where($where)->order('sort asc')->select();
foreach($list as $key => $value){
// throw new \Exception(json_encode($value));
// throw new \Exception(json_encode($lists[$key]->admin['nickname']));
$list[$key]['creator'] =__($list[$key]->admin['nickname']);
}
// $pidlist = array();
foreach ($list as $key => $value) {
$list[$key]['mfgname'] = __($value['mfgname']);
}
}
// $users = array();
$users = $model->usernames();
// throw new \Exception(json_encode($users));
foreach ($list as $key => $value) {
foreach ($users as $keyuser => $valueuser) {
if ($value['createrid'] == $valueuser['id']) {
// $list[$key]['createrid'] = __($valueuser['name']);
$list[$key]['createrid'] = __($valueuser['nickname']);
break;
}else{
$list[$key]['createrid'] =$list[$key]['createrid'].'|'. __('未知用户');
}
}
}
return [$count, $list];
// $users = $model->usernames();
// // throw new \Exception(json_encode($users));
// foreach ($list as $key => $value) {
// foreach ($users as $keyuser => $valueuser) {
// // if ($users[$keyuser]['id'] == $list[$key]['id']){
// // // $list[$key]['creatorid'] = __($users[$keyuser]['nickname']);
// // $list[$key]['creatorid'] = __($users[$keyuser]['name']);
// // break;
// // }
// if ($value['creatorid'] == $valueuser['id']) {
// // $list[$key]['creatorid'] = __($valueuser['name']);
// $list[$key]['creatorid'] = __($valueuser['nickname']);
// break;
// }else{
// $list[$key]['creatorid'] =$list[$key]['creatorid'].'|'. __('未知用户');
// }
// }
// }
return [$count, $list->toArray()];
}
/**
* 获取资源列表
* return Response
*/
public function index(): Response
{
if (request()->isAjax()) {
list($count, $list) = PdmMfgName::dataList(request()->all());
$rules = list_to_tree($list,'id','pid','children',0);
return $this->success('获取成功', '/',$rules, $count);
}
return view('/pdm_mfg_name/index');
}
/**
* 添加节点数据
* @return Response
@@ -97,19 +138,21 @@ class PdmMfgName extends AdminController
$post = \request()->post();
// validate(\app\common\validate\system\AdminRules::class . '.add')->check($post);
$userid = get_admin_id();
$post['createrid'] = $userid ;
$post['creatorid'] = $userid ;
// if(empty($userid)){
// $post['creatorid'] = 'empty';
// }else{
// $post['creatorid'] = 'noneempty' ;
// }
if ($this->model->create($post)) {
return $this->success('添加成功!');
}else{
return $this->error('添加失败!');
return $this->success('添加分类成功!');
}
}
$data = $this->getTableFields();
$data['pid'] = input('pid', 0);
$data['auth'] = 1;
$data['type'] = 1;
// $data['auth'] = 1;
// $data['type'] = 1;
list($count, $list) = PdmMfgName::dataList(request()->all());
return view('/pdm_mfg_name/add', [
@@ -118,54 +161,5 @@ class PdmMfgName extends AdminController
]);
}
/**
* 编辑节点数据
* @return Response
* @throws DbException
* @throws DataNotFoundException
* @throws ModelNotFoundException
*/
public function edit(): Response
{
$id = input('id', 0);
$data = $this->model->find($id);
if (request()->isPost()) {
$post = \request()->post();
// validate(\app\common\validate\system\AdminRules::class . '.edit')->check($post);
if ($this->model->update($post)) {
return $this->success('更新成功!');
}else{
return $this->error('更新失败!');
}
}
list($count, $list) = PdmMfgName::dataList(request()->all());
return view('/pdm_mfg_name/add', [
'data' => $data,
'rules' => json_encode( list_to_tree($list), JSON_UNESCAPED_UNICODE),
]);
}
/**
* 删除节点数据
* @return Response
* @throws DbException
*/
public function del(): Response
{
$id = input('id');
if (!empty($id)) {
// 查询子节点
if ($this->model->where('pid',$id)->count()) {
return $this->error('当前菜单存在子菜单!');
}
// 删除单个
if ($this->model::destroy($id)) {
return $this->success('删除菜单成功!');
}
}
return $this->error('删除失败,请检查您的参数!');
}
}

View File

@@ -0,0 +1,170 @@
<?php
declare (strict_types = 1);
namespace app\admin\controller;
use app\AdminController;
use Webman\Http\Request;
use app\admin\model\PdmPartitemIndex as PdmPartitemIndexModel;
use support\Response;
/**
* pdm_partitem_index
* Partnumber管理
* <!--partmanage-->
* Class PdmPartitemIndex
* @package app\admin\controller
*/
class PdmPartitemIndex extends AdminController
{
/**
* PdmPartitemIndex模型对象
* @var \app\admin\model\PdmPartitemIndex
*/
public function __construct()
{
parent::__construct();
$this->model = new PdmPartitemIndexModel;
}
/**
* 默认生成的方法为index/add/edit/del/status 五个方法
* 当创建CURD的时候DIY的函数体和模板为空请自行编写代码
*/
/**
* 获取资源列表
* return Response
*/
public function index(): Response
{
if (request()->isAjax()) {
list($count, $list) = PdmPartitemIndex::dataList(request()->all());
// $rules = list_to_tree($list,'id','pid','children',0);
$lists = list_to_tree($list,'id','pid','children',0);
return $this->success('获取成功', '/',$lists, $count);
// return $this->success('获取成功', '/');
}
return view('/pdm_partitem_index/index');
}
/**
* 获取资源列表
* @param array $params
* @return array
* @throws DataNotFoundException
* @throws DbException
* @throws ModelNotFoundException
*/
public static function dataList(array $params): array
{
$where = array();
if (!empty($params['partnumber'])) {
$where[] = ['partnumber','like','%'.$params['partnumber'].'%'];
}
if (!empty($params['content'])) {
$where[] = ['content','like','%'.$params['content'].'%'];
}
$model = new PdmPartitemIndexModel();
// $model = $this->model;
$count = $model->where($where)->count();
// $list = $model->where($where)->order('sort asc')->select()->toArray();
$list = $model->where($where)->order('sort asc')->select();
foreach($list as $key => $value){
// throw new \Exception(json_encode($value));
// throw new \Exception(json_encode($list[$key]->admin['nickname']));
$list[$key]['creator'] =__($list[$key]->admin == null?'': $list[$key]->admin['nickname']);
$list[$key]['parttype'] =__($list[$key]->parttype ==null?'': $list[$key]->parttype['name']);
$list[$key]['mfg_name'] =__($list[$key]->mfgname == null ?'': $list[$key]->mfgname['mfgname']);
// if($list[$key]->mfgname == null){
// $list[$key]['mfg_name'] ='';
// }else{
// $list[$key]['mfg_name'] =$list[$key]->mfgname['mfgname'];
// }
}
return [$count, $list->toArray()];
}
/**
* 添加节点数据
* @return Response
*/
public function add(): Response
{
if (request()->isPost()) {
$post = \request()->post();
// validate(\app\common\validate\system\AdminRules::class . '.add')->check($post);
$userid = get_admin_id();
$post['creatorid'] = $userid ;
if ($this->model->create($post)) {
return $this->success('添加FootPrint成功');
}
}
$data = $this->getTableFields();
$data['pid'] = input('pid', 0);
// $data['auth'] = 1;
// $data['type'] = 1;
list($count, $list) = PdmPartitemIndex::dataList(request()->all());
return view('/pdm_partitem_index/add', [
'data' => $data,
'rules' => json_encode( list_to_tree($list), JSON_UNESCAPED_UNICODE),
]);
}
/**
* 编辑节点数据
* @return Response
* @throws DbException
* @throws DataNotFoundException
* @throws ModelNotFoundException
*/
public function edit(): Response
{
$id = input('id', 0);
$data = $this->model->find($id);
if (request()->isPost()) {
$post = \request()->post();
// validate(\app\common\validate\system\AdminRules::class . '.edit')->check($post);
if ($this->model->update($post)) {
return $this->success('更新FootPrint成功');
}
}
list($count, $list) = PdmPartitemIndex::dataList(request()->all());
return view('/pdm_partitem_index/add', [
'data' => $data,
'rules' => json_encode( list_to_tree($list), JSON_UNESCAPED_UNICODE),
]);
}
/**
* 删除节点数据
* @return Response
* @throws DbException
*/
public function del(): Response
{
$id = input('id');
if (!empty($id)) {
// 查询子节点
if ($this->model->where('pid',$id)->count()) {
return $this->error('当前分类存在子项!');
}
// 删除单个
if ($this->model::destroy($id)) {
return $this->success('删除FootPrint成功');
}
}
return $this->error('删除失败,请检查您的参数!');
}
}

View File

@@ -4,26 +4,26 @@ namespace app\admin\controller;
use app\AdminController;
use Webman\Http\Request;
use app\admin\model\PdmPartitem as PdmPartitemModel;
use app\admin\model\PdmPartitemRelation as PdmPartitemRelationModel;
/**
* pdm_partitem
* 部件
* <!---->
* Class PdmPartitem
* pdm_partitem_relation
* PN关系维护
* <!--partmanage-->
* Class PdmPartitemRelation
* @package app\admin\controller
*/
class PdmPartitem extends AdminController
class PdmPartitemRelation extends AdminController
{
/**
* PdmPartitem模型对象
* @var \app\admin\model\PdmPartitem
* PdmPartitemRelation模型对象
* @var \app\admin\model\PdmPartitemRelation
*/
public function __construct()
{
parent::__construct();
$this->model = new PdmPartitemModel;
$this->model = new PdmPartitemRelationModel;
}
/**

View File

@@ -0,0 +1,83 @@
<?php
declare (strict_types = 1);
namespace app\admin\controller;
use app\AdminController;
use Webman\Http\Request;
use app\admin\model\PdmPartitemView as PdmPartitemViewModel;
/**
* pdm_partitem_view
* PN查询
* <!--partview-->
* Class PdmPartitemView
* @package app\admin\controller
*/
class PdmPartitemView extends AdminController
{
/**
* PdmPartitemView模型对象
* @var \app\admin\model\PdmPartitemView
*/
public function __construct()
{
parent::__construct();
$this->model = new PdmPartitemViewModel;
}
/**
* 默认生成的方法为index/add/edit/del/status 五个方法
* 当创建CURD的时候DIY的函数体和模板为空请自行编写代码
*/
public function index(): \support\Response
{
// $post = input();
// $post = request()->post();
$post = request()->all();
// $post['partnumber'] = input('partnumber');
$pid = input('pid');
$limit = input('limit') ?? 10;
$page = input('page') ?? 1;
// if ($pid == null) {
// $pid = (string)$this->model->minId();
// }
if (request()->isAjax()) {
// 生成查询数据
// $pid = !str_contains($pid, ',') ? $pid : explode(',',$pid);
// $where[] = ['pid','in',$pid];
// $where[] = [];
if (!empty($post['keyword'])) {
$where[] = ['partnumber|purchasecode|parttype|value|description|mpn|mfgname|symbol|footprint|datasheet|usernickname|department','like','%'.$post['keyword'].'%'];
// $where[] = ['reference','like','%'.$post['keyword'].'%'];
// $where[] = ['content','like','%'.$post['keyword'].'%'];
// $where[] = ['item','like','%'.$post['keyword'].'%'];
}else{
// $where[] = ['pid','in',$pid];
// $where[] = ['partnumber','like','%'.$post['partnumber'].'%'];
$where[] = ['partnumber|purchasecode|parttype|value|description|mpn|mfgname|symbol|footprint|datasheet|usernickname|department','like','%'.'%'];
}
$count = $this->model->where($where)->count();
// $list = $this->model->where($where)->limit((int)$limit)->page((int)$page)->select()
// ->each(function($item,$key) use ($pid){
// if ($key == 0 && $pid == '0') {
// $item['LAY_CHECKED'] = true;
// }
// return $item;
// });
$list = $this->model->where($where)->limit((int)$limit)->page((int)$page)->select();
return $this->success('查询成功', null, $list, $count);
}
return view('/pdm_partitem_view/index',[ ]);
}
}

View File

@@ -0,0 +1,92 @@
<?php
declare (strict_types = 1);
namespace app\admin\controller;
use app\AdminController;
use Webman\Http\Request;
use app\admin\model\PdmPartlist as PdmPartlistModel;
use support\Response;
use think\db\exception\DataNotFoundException;
use think\db\exception\DbException;
use think\db\exception\ModelNotFoundException;
/**
* pdm_partlist
* BOM查询
* <!--partlist-->
* Class PdmPartlist
* @package app\admin\controller
*/
class PdmPartlist extends AdminController
{
/**
* PdmPartlist模型对象
* @var \app\admin\model\PdmPartlist
*/
public function __construct()
{
parent::__construct();
$this->model = new PdmPartlistModel;
}
/**
* 默认生成的方法为index/add/edit/del/status 五个方法
* 当创建CURD的时候DIY的函数体和模板为空请自行编写代码
*/
/**
* 字典首页
* @return Response
* @throws DataNotFoundException
* @throws DbException
* @throws ModelNotFoundException
*/
public function index(): \support\Response
{
// $post = input();
// $post = request()->post();
$post = request()->all();
// $post['partnumber'] = input('partnumber');
$pid = input('pid');
$limit = input('limit') ?? 10;
$page = input('page') ?? 1;
if ($pid == null) {
$pid = (string)$this->model->minId();
}
if (request()->isAjax()) {
// 生成查询数据
$pid = !str_contains($pid, ',') ? $pid : explode(',',$pid);
$where[] = ['pid','in',$pid];
if (!empty($post['keyword'])) {
$where[] = ['partnumber|reference|content|item','like','%'.$post['keyword'].'%'];
// $where[] = ['reference','like','%'.$post['keyword'].'%'];
// $where[] = ['content','like','%'.$post['keyword'].'%'];
// $where[] = ['item','like','%'.$post['keyword'].'%'];
}else{
// $where[] = ['pid','in',$pid];
// $where[] = ['partnumber','like','%'.$post['partnumber'].'%'];
}
$count = $this->model->where($where)->count();
$list = $this->model->where($where)->limit((int)$limit)->page((int)$page)->select()
->each(function($item,$key) use ($pid){
if ($key == 0 && $pid == '0') {
$item['LAY_CHECKED'] = true;
}
// throw new \Exception(json_encode($item->admin['nickname']));
$item['creator'] = $item->admin ==null?'': $item->admin['nickname'];
// $item['purchasecode'] = $item->partitemview == null?'': $item->partitemview['purchasecode'];
$item->partitemview ;
return $item;
});
// throw new \Exception(json_encode($list));
return $this->success('查询成功', null, $list, $count);
}
return view('/pdm_partlist/index',[ 'pid' => $pid]);
}
}

View File

@@ -3,14 +3,13 @@ declare (strict_types = 1);
namespace app\admin\controller;
use app\AdminController;
use app\admin\service\AdminRuleService;
use Webman\Http\Request;
use app\admin\model\PdmParttype as PdmParttypeModel;
use support\Response;
/**
* pdm_parttype
* 分类目录
* <!---->
* <!--partmanage-->
* Class PdmParttype
* @package app\admin\controller
*/
@@ -41,7 +40,6 @@ class PdmParttype extends AdminController
if (request()->isAjax()) {
list($count, $list) = PdmParttype::dataList(request()->all());
$rules = list_to_tree($list,'id','pid','children',0);
return $this->success('获取成功', '/',$rules, $count);
}
@@ -60,41 +58,24 @@ class PdmParttype extends AdminController
public static function dataList(array $params): array
{
$where = array();
if (!empty($params['parttypetitle'])) {
$where[] = ['parttypetitle','like','%'.$params['parttypetitle'].'%'];
if (!empty($params['name'])) {
$where[] = ['name','like','%'.$params['name'].'%'];
}
if (!empty($params['parttypevalue'])) {
$where[] = ['parttypevalue','like','%'.$params['parttypevalue'].'%'];
if (!empty($params['value'])) {
$where[] = ['value','like','%'.$params['value'].'%'];
}
$model = new PdmParttypeModel();
$count = $model->where($where)->count();
$list = $model->where($where)->order('sort asc')->select()->toArray();
// $list = $model->where($where)->order('sort asc')->select()->toArray();
$list = $model->where($where)->order('sort asc')->select();
foreach ($list as $key => $value) {
$list[$key]['parttypetitle'] = __($value['parttypetitle']);
}
// $users = array();
$users = $model->usernames();
// $list[$key]['name'] = __($value['name']);
$list[$key]['creator'] = __($list[$key]->admin['nickname']);
}
// throw new \Exception(json_encode($users));
foreach ($list as $key => $value) {
foreach ($users as $keyuser => $valueuser) {
// if ($users[$keyuser]['id'] == $list[$key]['id']){
// // $list[$key]['createrid'] = __($users[$keyuser]['nickname']);
// $list[$key]['createrid'] = __($users[$keyuser]['name']);
// break;
// }
if ($value['createrid'] == $valueuser['id']) {
// $list[$key]['createrid'] = __($valueuser['name']);
$list[$key]['createrid'] = __($valueuser['nickname']);
break;
}else{
$list[$key]['createrid'] =$list[$key]['createrid'].'|'. __('未知用户');
}
}
}
return [$count, $list];
return [$count, $list->toArray()];
}
@@ -109,11 +90,11 @@ class PdmParttype extends AdminController
$post = \request()->post();
// validate(\app\common\validate\system\AdminRules::class . '.add')->check($post);
$userid = get_admin_id();
$post['createrid'] = $userid ;
$post['creatorid'] = $userid ;
// if(empty($userid)){
// $post['createrid'] = 'empty';
// $post['creatorid'] = 'empty';
// }else{
// $post['createrid'] = 'noneempty' ;
// $post['creatorid'] = 'noneempty' ;
// }
if ($this->model->create($post)) {
return $this->success('添加分类成功!');
@@ -122,8 +103,8 @@ class PdmParttype extends AdminController
$data = $this->getTableFields();
$data['pid'] = input('pid', 0);
$data['auth'] = 1;
$data['type'] = 1;
// $data['auth'] = 1;
// $data['type'] = 1;
list($count, $list) = PdmParttype::dataList(request()->all());
return view('/pdm_parttype/add', [
@@ -169,12 +150,12 @@ class PdmParttype extends AdminController
if (!empty($id)) {
// 查询子节点
if ($this->model->where('pid',$id)->count()) {
return $this->error('当前菜单存在子菜单');
return $this->error('当前分类存在子分类');
}
// 删除单个
if ($this->model::destroy($id)) {
return $this->success('删除菜单成功!');
return $this->success('删除分类成功!');
}
}

View File

@@ -4,7 +4,7 @@ namespace app\admin\controller;
use app\AdminController;
use Webman\Http\Request;
use app\common\model\PdmPurchasecode as PdmPurchasecodeModel;
use app\admin\model\PdmPurchasecode as PdmPurchasecodeModel;
/**
* pdm_purchasecode
@@ -17,7 +17,7 @@ class PdmPurchasecode extends AdminController
{
/**
* PdmPurchasecode模型对象
* @var \app\common\model\PdmPurchasecode
* @var \app\admin\model\PdmPurchasecode
*/
public function __construct()

View File

@@ -4,12 +4,13 @@ namespace app\admin\controller;
use app\AdminController;
use Webman\Http\Request;
use app\common\model\PdmSymbol as PdmSymbolModel;
use app\admin\model\PdmSymbol as PdmSymbolModel;
use support\Response;
/**
* pdm_symbol
* 原理符号
* <!---->
* <!--partmanage-->
* Class PdmSymbol
* @package app\admin\controller
*/
@@ -17,7 +18,7 @@ class PdmSymbol extends AdminController
{
/**
* PdmSymbol模型对象
* @var \app\common\model\PdmSymbol
* @var \app\admin\model\PdmSymbol
*/
public function __construct()
@@ -30,7 +31,133 @@ class PdmSymbol extends AdminController
* 默认生成的方法为index/add/edit/del/status 五个方法
* 当创建CURD的时候DIY的函数体和模板为空请自行编写代码
*/
/**
* 获取资源列表
* return Response
*/
public function index(): Response
{
if (request()->isAjax()) {
list($count, $list) = PdmSymbol::dataList(request()->all());
// $rules = list_to_tree($list,'id','pid','children',0);
$lists = list_to_tree($list,'id','pid','children',0);
return $this->success('获取成功', '/',$lists, $count);
// return $this->success('获取成功', '/');
}
return view('/pdm_symbol/index');
}
/**
* 获取资源列表
* @param array $params
* @return array
* @throws DataNotFoundException
* @throws DbException
* @throws ModelNotFoundException
*/
public static function dataList(array $params): array
{
$where = array();
if (!empty($params['symbolname'])) {
$where[] = ['symbolname','like','%'.$params['symbolname'].'%'];
}
if (!empty($params['content'])) {
$where[] = ['content','like','%'.$params['content'].'%'];
}
$model = new PdmSymbolModel();
// $model = $this->model;
$count = $model->where($where)->count();
// $list = $model->where($where)->order('sort asc')->select()->toArray();
$list = $model->where($where)->order('sort asc')->select();
foreach($list as $key => $value){
// throw new \Exception(json_encode($value));
// throw new \Exception(json_encode($list[$key]->admin['nickname']));
$list[$key]['creator'] =__($list[$key]->admin['nickname']);
}
return [$count, $list->toArray()];
}
/**
* 添加节点数据
* @return Response
*/
public function add(): Response
{
if (request()->isPost()) {
$post = \request()->post();
// validate(\app\common\validate\system\AdminRules::class . '.add')->check($post);
$userid = get_admin_id();
$post['creatorid'] = $userid ;
if ($this->model->create($post)) {
return $this->success('添加FootPrint成功');
}
}
$data = $this->getTableFields();
$data['pid'] = input('pid', 0);
// $data['auth'] = 1;
// $data['type'] = 1;
list($count, $list) = PdmSymbol::dataList(request()->all());
return view('/pdm_symbol/add', [
'data' => $data,
'rules' => json_encode( list_to_tree($list), JSON_UNESCAPED_UNICODE),
]);
}
/**
* 编辑节点数据
* @return Response
* @throws DbException
* @throws DataNotFoundException
* @throws ModelNotFoundException
*/
public function edit(): Response
{
$id = input('id', 0);
$data = $this->model->find($id);
if (request()->isPost()) {
$post = \request()->post();
// validate(\app\common\validate\system\AdminRules::class . '.edit')->check($post);
if ($this->model->update($post)) {
return $this->success('更新Symbol成功');
}
}
list($count, $list) = PdmSymbol::dataList(request()->all());
return view('/pdm_symbol/add', [
'data' => $data,
'rules' => json_encode( list_to_tree($list), JSON_UNESCAPED_UNICODE),
]);
}
/**
* 删除节点数据
* @return Response
* @throws DbException
*/
public function del(): Response
{
$id = input('id');
if (!empty($id)) {
// 查询子节点
if ($this->model->where('pid',$id)->count()) {
return $this->error('当前分类存在子项!');
}
// 删除单个
if ($this->model::destroy($id)) {
return $this->success('删除Symbol成功');
}
}
return $this->error('删除失败,请检查您的参数!');
}
}

View File

@@ -0,0 +1,33 @@
<?php
declare(strict_types = 1);
namespace app\admin\controller\partlist;
use app\AdminController;
use support\Response;
/**
* BOM管理后台控制器
* <!--Partlist-->
*/
class Index extends AdminController {
// 初始化函数
public function __construct()
{
parent::__construct();
/**
* TODO...
*/
}
/**
* 初始化后台首页
* @return Response
*/
public function index(): Response
{
echo '后台 BOM管理 控制器<br/>';
return $this->view();
}
}

View File

@@ -0,0 +1,33 @@
<?php
declare(strict_types = 1);
namespace app\admin\controller\partview;
use app\AdminController;
use support\Response;
/**
* 部件查询后台控制器
* <!--Partview-->
*/
class Index extends AdminController {
// 初始化函数
public function __construct()
{
parent::__construct();
/**
* TODO...
*/
}
/**
* 初始化后台首页
* @return Response
*/
public function index(): Response
{
echo '后台 部件查询 控制器<br/>';
return $this->view();
}
}

View File

@@ -41,7 +41,8 @@ class Dictionary extends AdminController
*/
public function index(): \support\Response
{
$post = input();
// $post = input();
$post = request()->all();
$pid = input('pid');
$limit = input('limit') ?? 10;
$page = input('page') ?? 1;