From d70fcccc1de7ec388c5fac66b8bb5b5fe44ae6d0 Mon Sep 17 00:00:00 2001
From: panx <651666084@qq.com>
Date: Sun, 29 Dec 2024 22:18:05 +0800
Subject: [PATCH] =?UTF-8?q?PDM=E6=9B=B4=E6=96=B0=E6=95=B0=E6=8D=AE?=
=?UTF-8?q?=E7=BB=93=E6=9E=84=E5=90=8E=EF=BC=8C=E5=9F=BA=E7=A1=80=E6=95=B0?=
=?UTF-8?q?=E6=8D=AE=E6=9F=A5=E8=AF=A2=E5=92=8CBOM=E5=88=9D=E5=A7=8B?=
=?UTF-8?q?=E6=9F=A5=E8=AF=A2=E7=AD=89=E5=9F=BA=E6=9C=AC=E5=8A=9F=E8=83=BD?=
=?UTF-8?q?=E9=83=BD=E5=B7=B2=E7=BB=8FOK=EF=BC=8C=E5=BE=85=E5=AE=8C?=
=?UTF-8?q?=E5=96=84=E5=92=8C=E7=BB=86=E5=8C=96=E7=9B=B8=E5=85=B3=E7=9A=84?=
=?UTF-8?q?=E4=B8=8A=E4=BC=A0=E5=92=8C=E4=B8=8B=E8=BD=BD=E6=9C=8D=E5=8A=A1?=
=?UTF-8?q?=E7=AD=89=E3=80=82?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/admin/controller/PdmFootprint.php | 165 ++++++++++
app/admin/controller/PdmMfgName.php | 174 +++++-----
app/admin/controller/PdmPartitemIndex.php | 170 ++++++++++
...dmPartitem.php => PdmPartitemRelation.php} | 18 +-
app/admin/controller/PdmPartitemView.php | 83 +++++
app/admin/controller/PdmPartlist.php | 92 ++++++
app/admin/controller/PdmParttype.php | 59 ++--
app/admin/controller/PdmPurchasecode.php | 4 +-
app/admin/controller/PdmSymbol.php | 135 +++++++-
app/admin/controller/partlist/Index.php | 33 ++
app/admin/controller/partview/Index.php | 33 ++
app/admin/controller/system/Dictionary.php | 3 +-
app/admin/model/PdmFootprint.php | 38 +++
app/admin/model/PdmMfgName.php | 38 +++
app/admin/model/PdmPartitem.php | 59 ----
app/admin/model/PdmPartitemIndex.php | 80 +++++
app/admin/model/PdmPartitemRelation.php | 38 +++
app/admin/model/PdmPartitemView.php | 29 ++
app/admin/model/PdmPartlist.php | 87 +++++
app/admin/model/PdmParttype.php | 66 ++--
.../model/PdmPurchasecode.php | 26 +-
app/{common => admin}/model/PdmSymbol.php | 26 +-
app/admin/model/partlist/Partlist.php | 35 ++
app/admin/model/partview/Partview.php | 35 ++
app/admin/validate/PdmFootprint.php | 36 ++
app/{common => admin}/validate/PdmMfgName.php | 4 +-
app/admin/validate/PdmPartitemIndex.php | 36 ++
app/admin/validate/PdmPartitemRelation.php | 36 ++
app/admin/validate/PdmPartitemView.php | 36 ++
.../{PdmPartitem.php => PdmPartlist.php} | 8 +-
app/admin/validate/PdmParttype.php | 2 +-
.../validate/PdmPurchasecode.php | 4 +-
app/{common => admin}/validate/PdmSymbol.php | 6 +-
app/admin/validate/partlist/Partlist.php | 34 ++
app/admin/validate/partview/Partview.php | 34 ++
app/admin/view/partlist/index/index.html | 13 +
app/admin/view/partview/index/index.html | 13 +
app/admin/view/pdm_footprint/add.html | 176 ++++++++++
app/admin/view/pdm_footprint/index.html | 233 +++++++++++++
app/admin/view/pdm_mfg_name/add.html | 222 ++++---------
app/admin/view/pdm_mfg_name/index.html | 113 ++-----
app/admin/view/pdm_partitem_index/add.html | 81 +++++
app/admin/view/pdm_partitem_index/index.html | 217 ++++++++++++
app/admin/view/pdm_partitem_relation/add.html | 51 +++
.../view/pdm_partitem_relation/index.html | 171 ++++++++++
app/admin/view/pdm_partitem_view/add.html | 66 ++++
app/admin/view/pdm_partitem_view/index.html | 171 ++++++++++
app/admin/view/pdm_partlist/add.html | 51 +++
app/admin/view/pdm_partlist/index.html | 308 ++++++++++++++++++
app/admin/view/pdm_parttype/add.html | 160 +++++----
app/admin/view/pdm_parttype/index.html | 210 +++++++-----
app/admin/view/pdm_purchasecode/add.html | 163 +++++----
app/admin/view/pdm_purchasecode/index.html | 133 ++++++--
app/admin/view/pdm_symbol/add.html | 244 +++++++++-----
app/admin/view/pdm_symbol/index.html | 164 ++++++----
app/common/model/PdmMfgName.php | 42 ---
app/index/controller/Partlist.php | 55 ++++
app/index/controller/Partview.php | 55 ++++
app/index/view/index/index.html | 4 +-
app/index/view/partlist/index.html | 22 ++
app/index/view/partview/index.html | 22 ++
app/index/view/public/nav.html | 1 +
plugin/partlist/Partlist.php | 55 ++++
plugin/partlist/README.md | 29 ++
plugin/partlist/Upgrade.php | 21 ++
.../app/admin/controller/partlist/Index.php | 33 ++
.../app/admin/model/partlist/Partlist.php | 35 ++
.../app/admin/validate/partlist/Partlist.php | 34 ++
.../app/admin/view/partlist/index/index.html | 13 +
.../app/index/controller/Partlist.php | 55 ++++
.../app/index/view/partlist/index.html | 22 ++
plugin/partlist/config.html | 88 +++++
plugin/partlist/config.json | 22 ++
plugin/partlist/function.php | 16 +
plugin/partlist/install.sql | 24 ++
.../public/static/plugin/partlist/index.js | 1 +
.../static/system/plugin/partlist/function.js | 1 +
plugin/partlist/uninstall.sql | 0
plugin/partview/Partview.php | 55 ++++
plugin/partview/README.md | 29 ++
plugin/partview/Upgrade.php | 21 ++
.../app/admin/controller/partview/Index.php | 33 ++
.../app/admin/model/partview/Partview.php | 35 ++
.../app/admin/validate/partview/Partview.php | 34 ++
.../app/admin/view/partview/index/index.html | 13 +
.../app/index/controller/Partview.php | 55 ++++
.../app/index/view/partview/index.html | 22 ++
plugin/partview/config.html | 88 +++++
plugin/partview/config.json | 22 ++
plugin/partview/function.php | 16 +
plugin/partview/install.sql | 24 ++
.../public/static/plugin/partview/index.js | 1 +
.../static/system/plugin/partview/function.js | 1 +
plugin/partview/uninstall.sql | 0
public/static/plugin/partlist/index.js | 1 +
public/static/plugin/partview/index.js | 1 +
.../static/system/plugin/partlist/function.js | 1 +
.../static/system/plugin/partview/function.js | 1 +
.../images/2024-12-25/676be061509df.png | Bin 0 -> 423245 bytes
99 files changed, 4877 insertions(+), 948 deletions(-)
create mode 100644 app/admin/controller/PdmFootprint.php
create mode 100644 app/admin/controller/PdmPartitemIndex.php
rename app/admin/controller/{PdmPartitem.php => PdmPartitemRelation.php} (53%)
create mode 100644 app/admin/controller/PdmPartitemView.php
create mode 100644 app/admin/controller/PdmPartlist.php
create mode 100644 app/admin/controller/partlist/Index.php
create mode 100644 app/admin/controller/partview/Index.php
create mode 100644 app/admin/model/PdmFootprint.php
create mode 100644 app/admin/model/PdmMfgName.php
delete mode 100644 app/admin/model/PdmPartitem.php
create mode 100644 app/admin/model/PdmPartitemIndex.php
create mode 100644 app/admin/model/PdmPartitemRelation.php
create mode 100644 app/admin/model/PdmPartitemView.php
create mode 100644 app/admin/model/PdmPartlist.php
rename app/{common => admin}/model/PdmPurchasecode.php (71%)
rename app/{common => admin}/model/PdmSymbol.php (53%)
create mode 100644 app/admin/model/partlist/Partlist.php
create mode 100644 app/admin/model/partview/Partview.php
create mode 100644 app/admin/validate/PdmFootprint.php
rename app/{common => admin}/validate/PdmMfgName.php (80%)
create mode 100644 app/admin/validate/PdmPartitemIndex.php
create mode 100644 app/admin/validate/PdmPartitemRelation.php
create mode 100644 app/admin/validate/PdmPartitemView.php
rename app/admin/validate/{PdmPartitem.php => PdmPartlist.php} (72%)
rename app/{common => admin}/validate/PdmPurchasecode.php (80%)
rename app/{common => admin}/validate/PdmSymbol.php (76%)
create mode 100644 app/admin/validate/partlist/Partlist.php
create mode 100644 app/admin/validate/partview/Partview.php
create mode 100644 app/admin/view/partlist/index/index.html
create mode 100644 app/admin/view/partview/index/index.html
create mode 100644 app/admin/view/pdm_footprint/add.html
create mode 100644 app/admin/view/pdm_footprint/index.html
create mode 100644 app/admin/view/pdm_partitem_index/add.html
create mode 100644 app/admin/view/pdm_partitem_index/index.html
create mode 100644 app/admin/view/pdm_partitem_relation/add.html
create mode 100644 app/admin/view/pdm_partitem_relation/index.html
create mode 100644 app/admin/view/pdm_partitem_view/add.html
create mode 100644 app/admin/view/pdm_partitem_view/index.html
create mode 100644 app/admin/view/pdm_partlist/add.html
create mode 100644 app/admin/view/pdm_partlist/index.html
delete mode 100644 app/common/model/PdmMfgName.php
create mode 100644 app/index/controller/Partlist.php
create mode 100644 app/index/controller/Partview.php
create mode 100644 app/index/view/partlist/index.html
create mode 100644 app/index/view/partview/index.html
create mode 100644 plugin/partlist/Partlist.php
create mode 100644 plugin/partlist/README.md
create mode 100644 plugin/partlist/Upgrade.php
create mode 100644 plugin/partlist/app/admin/controller/partlist/Index.php
create mode 100644 plugin/partlist/app/admin/model/partlist/Partlist.php
create mode 100644 plugin/partlist/app/admin/validate/partlist/Partlist.php
create mode 100644 plugin/partlist/app/admin/view/partlist/index/index.html
create mode 100644 plugin/partlist/app/index/controller/Partlist.php
create mode 100644 plugin/partlist/app/index/view/partlist/index.html
create mode 100644 plugin/partlist/config.html
create mode 100644 plugin/partlist/config.json
create mode 100644 plugin/partlist/function.php
create mode 100644 plugin/partlist/install.sql
create mode 100644 plugin/partlist/public/static/plugin/partlist/index.js
create mode 100644 plugin/partlist/public/static/system/plugin/partlist/function.js
create mode 100644 plugin/partlist/uninstall.sql
create mode 100644 plugin/partview/Partview.php
create mode 100644 plugin/partview/README.md
create mode 100644 plugin/partview/Upgrade.php
create mode 100644 plugin/partview/app/admin/controller/partview/Index.php
create mode 100644 plugin/partview/app/admin/model/partview/Partview.php
create mode 100644 plugin/partview/app/admin/validate/partview/Partview.php
create mode 100644 plugin/partview/app/admin/view/partview/index/index.html
create mode 100644 plugin/partview/app/index/controller/Partview.php
create mode 100644 plugin/partview/app/index/view/partview/index.html
create mode 100644 plugin/partview/config.html
create mode 100644 plugin/partview/config.json
create mode 100644 plugin/partview/function.php
create mode 100644 plugin/partview/install.sql
create mode 100644 plugin/partview/public/static/plugin/partview/index.js
create mode 100644 plugin/partview/public/static/system/plugin/partview/function.js
create mode 100644 plugin/partview/uninstall.sql
create mode 100644 public/static/plugin/partlist/index.js
create mode 100644 public/static/plugin/partview/index.js
create mode 100644 public/static/system/plugin/partlist/function.js
create mode 100644 public/static/system/plugin/partview/function.js
create mode 100644 public/upload/images/2024-12-25/676be061509df.png
diff --git a/app/admin/controller/PdmFootprint.php b/app/admin/controller/PdmFootprint.php
new file mode 100644
index 0000000..08d7773
--- /dev/null
+++ b/app/admin/controller/PdmFootprint.php
@@ -0,0 +1,165 @@
+
+ * 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('删除失败,请检查您的参数!');
+ }
+
+
+
+
+}
diff --git a/app/admin/controller/PdmMfgName.php b/app/admin/controller/PdmMfgName.php
index 9b871f3..16180ff 100644
--- a/app/admin/controller/PdmMfgName.php
+++ b/app/admin/controller/PdmMfgName.php
@@ -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('删除失败,请检查您的参数!');
- }
}
diff --git a/app/admin/controller/PdmPartitemIndex.php b/app/admin/controller/PdmPartitemIndex.php
new file mode 100644
index 0000000..aacfca9
--- /dev/null
+++ b/app/admin/controller/PdmPartitemIndex.php
@@ -0,0 +1,170 @@
+
+ * 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('删除失败,请检查您的参数!');
+ }
+
+}
diff --git a/app/admin/controller/PdmPartitem.php b/app/admin/controller/PdmPartitemRelation.php
similarity index 53%
rename from app/admin/controller/PdmPartitem.php
rename to app/admin/controller/PdmPartitemRelation.php
index 53ca232..b88a4c2 100644
--- a/app/admin/controller/PdmPartitem.php
+++ b/app/admin/controller/PdmPartitemRelation.php
@@ -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关系维护
+ *
+ * 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;
}
/**
diff --git a/app/admin/controller/PdmPartitemView.php b/app/admin/controller/PdmPartitemView.php
new file mode 100644
index 0000000..644b75f
--- /dev/null
+++ b/app/admin/controller/PdmPartitemView.php
@@ -0,0 +1,83 @@
+
+ * 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',[ ]);
+ }
+
+
+}
diff --git a/app/admin/controller/PdmPartlist.php b/app/admin/controller/PdmPartlist.php
new file mode 100644
index 0000000..ec9a342
--- /dev/null
+++ b/app/admin/controller/PdmPartlist.php
@@ -0,0 +1,92 @@
+
+ * 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]);
+ }
+
+
+}
diff --git a/app/admin/controller/PdmParttype.php b/app/admin/controller/PdmParttype.php
index 5decd5b..b4a2f0f 100644
--- a/app/admin/controller/PdmParttype.php
+++ b/app/admin/controller/PdmParttype.php
@@ -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
* 分类目录
- *
+ *
* 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('删除分类成功!');
}
}
diff --git a/app/admin/controller/PdmPurchasecode.php b/app/admin/controller/PdmPurchasecode.php
index 9c5198a..1793d12 100644
--- a/app/admin/controller/PdmPurchasecode.php
+++ b/app/admin/controller/PdmPurchasecode.php
@@ -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()
diff --git a/app/admin/controller/PdmSymbol.php b/app/admin/controller/PdmSymbol.php
index c264c48..a1609bd 100644
--- a/app/admin/controller/PdmSymbol.php
+++ b/app/admin/controller/PdmSymbol.php
@@ -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
* 原理符号
- *
+ *
* 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('删除失败,请检查您的参数!');
+ }
}
diff --git a/app/admin/controller/partlist/Index.php b/app/admin/controller/partlist/Index.php
new file mode 100644
index 0000000..2997e63
--- /dev/null
+++ b/app/admin/controller/partlist/Index.php
@@ -0,0 +1,33 @@
+
+ */
+class Index extends AdminController {
+
+ // 初始化函数
+ public function __construct()
+ {
+ parent::__construct();
+ /**
+ * TODO...
+ */
+ }
+
+ /**
+ * 初始化后台首页
+ * @return Response
+ */
+ public function index(): Response
+ {
+ echo '后台 BOM管理 控制器
';
+ return $this->view();
+ }
+
+}
diff --git a/app/admin/controller/partview/Index.php b/app/admin/controller/partview/Index.php
new file mode 100644
index 0000000..b7ca995
--- /dev/null
+++ b/app/admin/controller/partview/Index.php
@@ -0,0 +1,33 @@
+
+ */
+class Index extends AdminController {
+
+ // 初始化函数
+ public function __construct()
+ {
+ parent::__construct();
+ /**
+ * TODO...
+ */
+ }
+
+ /**
+ * 初始化后台首页
+ * @return Response
+ */
+ public function index(): Response
+ {
+ echo '后台 部件查询 控制器
';
+ return $this->view();
+ }
+
+}
diff --git a/app/admin/controller/system/Dictionary.php b/app/admin/controller/system/Dictionary.php
index 8e0f8f3..f555d9e 100644
--- a/app/admin/controller/system/Dictionary.php
+++ b/app/admin/controller/system/Dictionary.php
@@ -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;
diff --git a/app/admin/model/PdmFootprint.php b/app/admin/model/PdmFootprint.php
new file mode 100644
index 0000000..03aafb7
--- /dev/null
+++ b/app/admin/model/PdmFootprint.php
@@ -0,0 +1,38 @@
+
+ * 封装设计
+ * Class PdmFootprint
+ * @package app\admin\model
+ */
+class PdmFootprint extends Model
+{
+
+ use SoftDelete;
+
+ // 定义时间戳字段名
+ protected $createTime = 'create_time';
+ protected $updateTime = 'update_time';
+ protected $deleteTime = 'delete_time';
+
+
+ /**
+ * 定义 sa_admin 关联模型
+ * @localKey creatorid
+ * @bind nickname,name
+ */
+ public function admin()
+ {
+ return $this->hasOne(\app\common\model\system\Admin::Class,'id','creatorid')->bind(['nickname','name']);
+ }
+
+
+
+}
\ No newline at end of file
diff --git a/app/admin/model/PdmMfgName.php b/app/admin/model/PdmMfgName.php
new file mode 100644
index 0000000..1b441fe
--- /dev/null
+++ b/app/admin/model/PdmMfgName.php
@@ -0,0 +1,38 @@
+
+ * 制造商名录
+ * Class PdmMfgName
+ * @package app\admin\model
+ */
+class PdmMfgName extends Model
+{
+
+ use SoftDelete;
+
+ // 定义时间戳字段名
+ protected $createTime = 'create_time';
+ protected $updateTime = 'update_time';
+ protected $deleteTime = 'delete_time';
+
+
+ /**
+ * 定义 sa_admin 关联模型
+ * @localKey creatorid
+ * @bind nickname
+ */
+ public function admin()
+ {
+ return $this->hasOne(\app\common\model\system\Admin::Class,'id','creatorid')->bind(['nickname']);
+ }
+
+
+
+}
\ No newline at end of file
diff --git a/app/admin/model/PdmPartitem.php b/app/admin/model/PdmPartitem.php
deleted file mode 100644
index 23df366..0000000
--- a/app/admin/model/PdmPartitem.php
+++ /dev/null
@@ -1,59 +0,0 @@
-
- * 部件
- * Class PdmPartitem
- * @package app\admin\model
- */
-class PdmPartitem extends Model
-{
-
- use SoftDelete;
-
- // 定义时间戳字段名
- protected $createTime = 'create_time';
- protected $updateTime = 'update_time';
- protected $deleteTime = 'delete_time';
-
-
- /**
- * 定义 sa_user 关联模型
- * @localKey createrid
- * @bind nickname,name
- */
- public function user()
- {
- return $this->hasOne(\app\common\model\system\User::Class,'id','createrid')->bind(['nickname','name']);
- }
-
- public function setPartattributeAttr($value)
- {
- if (!empty($value) && is_array($value)) {
- $arr = [];
- foreach ($value['key'] as $key => $elem) {
- $arr[$elem] = $value['value'][$key];
- }
-
- $value = json_encode($arr,JSON_UNESCAPED_UNICODE);
- }
-
- return $value ?: json_encode([]);
- }
-
- public function getPartattributeAttr($value)
- {
- if (!empty($value) && is_string($value)) {
- $value = json_decode($value, true);
- }
-
- return $value;
- }
-
-}
\ No newline at end of file
diff --git a/app/admin/model/PdmPartitemIndex.php b/app/admin/model/PdmPartitemIndex.php
new file mode 100644
index 0000000..58f4640
--- /dev/null
+++ b/app/admin/model/PdmPartitemIndex.php
@@ -0,0 +1,80 @@
+
+ * Partnumber管理
+ * Class PdmPartitemIndex
+ * @package app\admin\model
+ */
+class PdmPartitemIndex extends Model
+{
+
+ use SoftDelete;
+
+ // 定义时间戳字段名
+ protected $createTime = 'create_time';
+ protected $updateTime = 'update_time';
+ protected $deleteTime = 'delete_time';
+
+
+ /**
+ * 定义 sa_admin 关联模型
+ * @localKey creatorid
+ * @bind nickname,name
+ */
+ public function admin()
+ {
+ return $this->hasOne(\app\common\model\system\Admin::Class,'id','creatorid')->bind(['nickname','name']);
+ }
+
+
+ /**
+ * 定义 sa_admin 关联模型
+ * @localKey parttypeid
+ * @bind name
+ */
+ public function parttype()
+ {
+ return $this->hasOne(\app\admin\model\PdmParttype::Class,'id','parttypeid')->bind(['name']);
+ }
+
+ /**
+ * 定义 sa_admin 关联模型
+ * @localKey parttypeid
+ * @bind name
+ */
+ public function mfgname()
+ {
+ return $this->hasOne(\app\admin\model\PdmMfgName::Class,'id','mfg_id')->bind(['mfgname']);
+ }
+
+ public function setPartattributeAttr($value)
+ {
+ if (!empty($value) && is_array($value)) {
+ $arr = [];
+ foreach ($value['key'] as $key => $elem) {
+ $arr[$elem] = $value['value'][$key];
+ }
+
+ $value = json_encode($arr,JSON_UNESCAPED_UNICODE);
+ }
+
+ return $value ?: json_encode([]);
+ }
+
+ public function getPartattributeAttr($value)
+ {
+ if (!empty($value) && is_string($value)) {
+ $value = json_decode($value, true);
+ }
+
+ return $value;
+ }
+
+}
\ No newline at end of file
diff --git a/app/admin/model/PdmPartitemRelation.php b/app/admin/model/PdmPartitemRelation.php
new file mode 100644
index 0000000..ebe4d91
--- /dev/null
+++ b/app/admin/model/PdmPartitemRelation.php
@@ -0,0 +1,38 @@
+
+ * PN关系维护
+ * Class PdmPartitemRelation
+ * @package app\admin\model
+ */
+class PdmPartitemRelation extends Model
+{
+
+ use SoftDelete;
+
+ // 定义时间戳字段名
+ protected $createTime = 'create_time';
+ protected $updateTime = 'update_time';
+ protected $deleteTime = 'delete_time';
+
+
+ /**
+ * 定义 sa_admin 关联模型
+ * @localKey creatorid
+ * @bind name,nickname
+ */
+ public function admin()
+ {
+ return $this->hasOne(\app\common\model\system\Admin::Class,'id','creatorid')->bind(['name','nickname']);
+ }
+
+
+
+}
\ No newline at end of file
diff --git a/app/admin/model/PdmPartitemView.php b/app/admin/model/PdmPartitemView.php
new file mode 100644
index 0000000..876095e
--- /dev/null
+++ b/app/admin/model/PdmPartitemView.php
@@ -0,0 +1,29 @@
+
+ * PN查询
+ * Class PdmPartitemView
+ * @package app\admin\model
+ */
+class PdmPartitemView extends Model
+{
+
+
+
+ // 定义时间戳字段名
+ protected $createTime = false;
+ protected $updateTime = false;
+ protected $deleteTime = false;
+
+
+
+
+
+}
\ No newline at end of file
diff --git a/app/admin/model/PdmPartlist.php b/app/admin/model/PdmPartlist.php
new file mode 100644
index 0000000..ee085a9
--- /dev/null
+++ b/app/admin/model/PdmPartlist.php
@@ -0,0 +1,87 @@
+
+ * BOM查询
+ * Class PdmPartlist
+ * @package app\admin\model
+ */
+class PdmPartlist extends Model
+{
+
+ use SoftDelete;
+
+ // 定义时间戳字段名
+ protected $createTime = 'create_time';
+ protected $updateTime = 'update_time';
+ protected $deleteTime = 'delete_time';
+
+
+ /**
+ * 定义 sa_admin 关联模型
+ * @localKey creatorid
+ * @bind name,nickname
+ */
+ public function admin()
+ {
+ return $this->hasOne(\app\common\model\system\Admin::Class,'id','creatorid')->bind(['name','nickname']);
+ }
+
+ /**
+ * 定义 sa_admin 关联模型
+ * @localKey creatorid
+ * @bind name,nickname
+ */
+ public function partitemview()
+ {
+ return $this->hasOne(\app\admin\model\PdmPartitemView::Class,'partnumber','partnumber')->bind(['purchasecode','parttype','value','description','mpn','mfgname','footprint','manufacture']);
+ }
+
+ // 字段修改器
+ public function setSortAttr($value)
+ {
+ if (is_empty($value)) {
+ return self::max('id') + 1;
+ }
+
+ return $value;
+ }
+
+ /**
+ * 获取字典信息
+ * @param string $value
+ * @return array
+ * @throws DataNotFoundException
+ * @throws DbException
+ * @throws ModelNotFoundException
+ */
+ public static function getValueList(string $value = ''): array
+ {
+ $list = [];
+ $data = self::where(['pid' => 0,'value' => $value])->find();
+ if (!empty($data)) {
+ $list = self::where('pid', $data['id'])->select()->toArray();
+ }
+
+ return $list;
+ }
+
+ /**
+ * 返回最小id
+ * @return int
+ */
+ public static function minId(): int
+ {
+ return (int)self::where('pid', '0')->min('id');
+ }
+
+
+
+
+}
\ No newline at end of file
diff --git a/app/admin/model/PdmParttype.php b/app/admin/model/PdmParttype.php
index 59dcedd..2a88923 100644
--- a/app/admin/model/PdmParttype.php
+++ b/app/admin/model/PdmParttype.php
@@ -7,7 +7,7 @@ use think\model\concern\SoftDelete;
/**
* pdm_parttype
- *
+ *
* 分类目录
* Class PdmParttype
* @package app\admin\model
@@ -22,46 +22,38 @@ class PdmParttype extends Model
protected $updateTime = 'update_time';
protected $deleteTime = 'delete_time';
-
- /**
- * 定义 sa_user 关联模型
- * @localKey id
- * @bind name,nickname
- */
- public function user()
- {
- return $this->hasOne(\app\common\model\system\User::Class,'createrid','id')->bind(['nickname']);
- }
+
+ /**
+ * 定义 sa_admin 关联模型
+ * @localKey creatorid
+ * @bind nickname
+ */
+ public function admin()
+ {
+ return $this->hasOne(\app\common\model\system\Admin::Class,'id','creatorid')->bind(['nickname']);
+ }
- public function usernames()
- {
- // return \app\common\model\system\User::select()->toArray();
- return \app\common\model\system\Admin::select()->toArray();
- }
+ public function setAttributeAttr($value)
+ {
+ if (!empty($value) && is_array($value)) {
+ $arr = [];
+ foreach ($value['key'] as $key => $elem) {
+ $arr[$elem] = $value['value'][$key];
+ }
- public function setPartattributeAttr($value)
- {
- if (!empty($value) && is_array($value)) {
- $arr = [];
- foreach ($value['key'] as $key => $elem) {
- $arr[$elem] = $value['value'][$key];
- }
+ $value = json_encode($arr,JSON_UNESCAPED_UNICODE);
+ }
- $value = json_encode($arr,JSON_UNESCAPED_UNICODE);
- }
+ return $value ?: json_encode([]);
+ }
- return $value ?: json_encode([]);
- }
+ public function getAttributeAttr($value)
+ {
+ if (!empty($value) && is_string($value)) {
+ $value = json_decode($value, true);
+ }
- public function getPartattributeAttr($value)
- {
- if (!empty($value) && is_string($value)) {
- $value = json_decode($value, true);
- }
-
- return $value;
- }
-
-
+ return $value;
+ }
}
\ No newline at end of file
diff --git a/app/common/model/PdmPurchasecode.php b/app/admin/model/PdmPurchasecode.php
similarity index 71%
rename from app/common/model/PdmPurchasecode.php
rename to app/admin/model/PdmPurchasecode.php
index 93b987d..a788e14 100644
--- a/app/common/model/PdmPurchasecode.php
+++ b/app/admin/model/PdmPurchasecode.php
@@ -1,6 +1,6 @@
* 采购编码
* Class PdmPurchasecode
- * @package app\common\model
+ * @package app\admin\model
*/
class PdmPurchasecode extends Model
{
@@ -22,18 +22,18 @@ class PdmPurchasecode extends Model
protected $updateTime = 'update_time';
protected $deleteTime = 'delete_time';
-
- /**
- * 定义 sa_user 关联模型
- * @localKey user_id
- * @bind nickname,name
- */
- public function user()
- {
- return $this->hasOne(\app\common\model\system\User::Class,'id','user_id')->bind(['nickname','name']);
- }
+
+ /**
+ * 定义 sa_admin 关联模型
+ * @localKey creatorid
+ * @bind nickname
+ */
+ public function admin()
+ {
+ return $this->hasOne(\app\common\model\system\Admin::Class,'id','creatorid')->bind(['nickname']);
+ }
- public function setAttributeAttr($value)
+ public function setAttributeAttr($value)
{
if (!empty($value) && is_array($value)) {
$arr = [];
diff --git a/app/common/model/PdmSymbol.php b/app/admin/model/PdmSymbol.php
similarity index 53%
rename from app/common/model/PdmSymbol.php
rename to app/admin/model/PdmSymbol.php
index d6a1f83..aae711c 100644
--- a/app/common/model/PdmSymbol.php
+++ b/app/admin/model/PdmSymbol.php
@@ -1,16 +1,16 @@
+ *
* 原理符号
* Class PdmSymbol
- * @package app\common\model
+ * @package app\admin\model
*/
class PdmSymbol extends Model
{
@@ -22,16 +22,16 @@ class PdmSymbol extends Model
protected $updateTime = 'update_time';
protected $deleteTime = 'delete_time';
-
- /**
- * 定义 sa_user 关联模型
- * @localKey admin_id
- * @bind nickname,name
- */
- public function user()
- {
- return $this->hasOne(\app\common\model\system\User::Class,'id','admin_id')->bind(['nickname','name']);
- }
+
+ /**
+ * 定义 sa_admin 关联模型
+ * @localKey createrid
+ * @bind nickname
+ */
+ public function admin()
+ {
+ return $this->hasOne(\app\common\model\system\Admin::Class,'id','creatorid')->bind(['nickname']);
+ }
diff --git a/app/admin/model/partlist/Partlist.php b/app/admin/model/partlist/Partlist.php
new file mode 100644
index 0000000..0e549f7
--- /dev/null
+++ b/app/admin/model/partlist/Partlist.php
@@ -0,0 +1,35 @@
+
+ * @mixin Model
+ */
+class Partlist extends Model
+{
+
+ // 自动写入时间戳字段
+ protected $autoWriteTimestamp = 'int';
+
+ // 定义时间戳字段名
+ protected $createTime = 'create_time';
+ protected $updatetime = 'update_time';
+
+ /**
+ * 字段修改器
+ * @param $value
+ * @return int|mixed
+ */
+ public function setSortAttr($value)
+ {
+ if (is_empty($value)) {
+ return self::max('id') + 1;
+ }
+
+ return $value;
+ }
+}
diff --git a/app/admin/model/partview/Partview.php b/app/admin/model/partview/Partview.php
new file mode 100644
index 0000000..174a5f1
--- /dev/null
+++ b/app/admin/model/partview/Partview.php
@@ -0,0 +1,35 @@
+
+ * @mixin Model
+ */
+class Partview extends Model
+{
+
+ // 自动写入时间戳字段
+ protected $autoWriteTimestamp = 'int';
+
+ // 定义时间戳字段名
+ protected $createTime = 'create_time';
+ protected $updatetime = 'update_time';
+
+ /**
+ * 字段修改器
+ * @param $value
+ * @return int|mixed
+ */
+ public function setSortAttr($value)
+ {
+ if (is_empty($value)) {
+ return self::max('id') + 1;
+ }
+
+ return $value;
+ }
+}
diff --git a/app/admin/validate/PdmFootprint.php b/app/admin/validate/PdmFootprint.php
new file mode 100644
index 0000000..b554209
--- /dev/null
+++ b/app/admin/validate/PdmFootprint.php
@@ -0,0 +1,36 @@
+
+ * PdmFootprint 验证器
+ * Class PdmFootprint
+ * @package app\admin\validate
+ */
+class PdmFootprint extends Validate
+{
+ /**
+ * 验证规则
+ */
+ protected $rule = [
+ ];
+
+
+ /**
+ * 提示消息
+ */
+ protected $message = [
+ ];
+
+
+ /**
+ * 验证场景
+ */
+ protected $scene = [
+ 'add' => [],
+ 'edit' => [],
+ ];
+
+}
diff --git a/app/common/validate/PdmMfgName.php b/app/admin/validate/PdmMfgName.php
similarity index 80%
rename from app/common/validate/PdmMfgName.php
rename to app/admin/validate/PdmMfgName.php
index e9b43fb..762e178 100644
--- a/app/common/validate/PdmMfgName.php
+++ b/app/admin/validate/PdmMfgName.php
@@ -1,13 +1,13 @@
* PdmMfgName 验证器
* Class PdmMfgName
- * @package app\common\validate
+ * @package app\admin\validate
*/
class PdmMfgName extends Validate
{
diff --git a/app/admin/validate/PdmPartitemIndex.php b/app/admin/validate/PdmPartitemIndex.php
new file mode 100644
index 0000000..8db3abd
--- /dev/null
+++ b/app/admin/validate/PdmPartitemIndex.php
@@ -0,0 +1,36 @@
+
+ * PdmPartitemIndex 验证器
+ * Class PdmPartitemIndex
+ * @package app\admin\validate
+ */
+class PdmPartitemIndex extends Validate
+{
+ /**
+ * 验证规则
+ */
+ protected $rule = [
+ ];
+
+
+ /**
+ * 提示消息
+ */
+ protected $message = [
+ ];
+
+
+ /**
+ * 验证场景
+ */
+ protected $scene = [
+ 'add' => [],
+ 'edit' => [],
+ ];
+
+}
diff --git a/app/admin/validate/PdmPartitemRelation.php b/app/admin/validate/PdmPartitemRelation.php
new file mode 100644
index 0000000..653addd
--- /dev/null
+++ b/app/admin/validate/PdmPartitemRelation.php
@@ -0,0 +1,36 @@
+
+ * PdmPartitemRelation 验证器
+ * Class PdmPartitemRelation
+ * @package app\admin\validate
+ */
+class PdmPartitemRelation extends Validate
+{
+ /**
+ * 验证规则
+ */
+ protected $rule = [
+ ];
+
+
+ /**
+ * 提示消息
+ */
+ protected $message = [
+ ];
+
+
+ /**
+ * 验证场景
+ */
+ protected $scene = [
+ 'add' => [],
+ 'edit' => [],
+ ];
+
+}
diff --git a/app/admin/validate/PdmPartitemView.php b/app/admin/validate/PdmPartitemView.php
new file mode 100644
index 0000000..500dc63
--- /dev/null
+++ b/app/admin/validate/PdmPartitemView.php
@@ -0,0 +1,36 @@
+
+ * PdmPartitemView 验证器
+ * Class PdmPartitemView
+ * @package app\admin\validate
+ */
+class PdmPartitemView extends Validate
+{
+ /**
+ * 验证规则
+ */
+ protected $rule = [
+ ];
+
+
+ /**
+ * 提示消息
+ */
+ protected $message = [
+ ];
+
+
+ /**
+ * 验证场景
+ */
+ protected $scene = [
+ 'add' => [],
+ 'edit' => [],
+ ];
+
+}
diff --git a/app/admin/validate/PdmPartitem.php b/app/admin/validate/PdmPartlist.php
similarity index 72%
rename from app/admin/validate/PdmPartitem.php
rename to app/admin/validate/PdmPartlist.php
index c33869f..645981b 100644
--- a/app/admin/validate/PdmPartitem.php
+++ b/app/admin/validate/PdmPartlist.php
@@ -4,12 +4,12 @@ namespace app\admin\validate;
use think\Validate;
/**
- *
- * PdmPartitem 验证器
- * Class PdmPartitem
+ *
+ * PdmPartlist 验证器
+ * Class PdmPartlist
* @package app\admin\validate
*/
-class PdmPartitem extends Validate
+class PdmPartlist extends Validate
{
/**
* 验证规则
diff --git a/app/admin/validate/PdmParttype.php b/app/admin/validate/PdmParttype.php
index 00902e5..6fcb980 100644
--- a/app/admin/validate/PdmParttype.php
+++ b/app/admin/validate/PdmParttype.php
@@ -4,7 +4,7 @@ namespace app\admin\validate;
use think\Validate;
/**
- *
+ *
* PdmParttype 验证器
* Class PdmParttype
* @package app\admin\validate
diff --git a/app/common/validate/PdmPurchasecode.php b/app/admin/validate/PdmPurchasecode.php
similarity index 80%
rename from app/common/validate/PdmPurchasecode.php
rename to app/admin/validate/PdmPurchasecode.php
index 7f29fad..f50175f 100644
--- a/app/common/validate/PdmPurchasecode.php
+++ b/app/admin/validate/PdmPurchasecode.php
@@ -1,13 +1,13 @@
* PdmPurchasecode 验证器
* Class PdmPurchasecode
- * @package app\common\validate
+ * @package app\admin\validate
*/
class PdmPurchasecode extends Validate
{
diff --git a/app/common/validate/PdmSymbol.php b/app/admin/validate/PdmSymbol.php
similarity index 76%
rename from app/common/validate/PdmSymbol.php
rename to app/admin/validate/PdmSymbol.php
index 466dac9..7f3c918 100644
--- a/app/common/validate/PdmSymbol.php
+++ b/app/admin/validate/PdmSymbol.php
@@ -1,13 +1,13 @@
+ *
* PdmSymbol 验证器
* Class PdmSymbol
- * @package app\common\validate
+ * @package app\admin\validate
*/
class PdmSymbol extends Validate
{
diff --git a/app/admin/validate/partlist/Partlist.php b/app/admin/validate/partlist/Partlist.php
new file mode 100644
index 0000000..d07e186
--- /dev/null
+++ b/app/admin/validate/partlist/Partlist.php
@@ -0,0 +1,34 @@
+
+ */
+class Partlist extends Validate
+{
+ /**
+ * 验证规则
+ */
+ protected $rule = [
+ ];
+
+
+ /**
+ * 提示消息
+ */
+ protected $message = [
+ ];
+
+
+ /**
+ * 验证场景
+ */
+ protected $scene = [
+ 'add' => [],
+ 'edit' => [],
+ ];
+
+}
diff --git a/app/admin/validate/partview/Partview.php b/app/admin/validate/partview/Partview.php
new file mode 100644
index 0000000..2154f9c
--- /dev/null
+++ b/app/admin/validate/partview/Partview.php
@@ -0,0 +1,34 @@
+
+ */
+class Partview extends Validate
+{
+ /**
+ * 验证规则
+ */
+ protected $rule = [
+ ];
+
+
+ /**
+ * 提示消息
+ */
+ protected $message = [
+ ];
+
+
+ /**
+ * 验证场景
+ */
+ protected $scene = [
+ 'add' => [],
+ 'edit' => [],
+ ];
+
+}
diff --git a/app/admin/view/partlist/index/index.html b/app/admin/view/partlist/index/index.html
new file mode 100644
index 0000000..699e461
--- /dev/null
+++ b/app/admin/view/partlist/index/index.html
@@ -0,0 +1,13 @@
+
+
+