This commit is contained in:
mkm 2024-04-23 18:03:12 +08:00
parent f40c47ae68
commit 54a510494c
63 changed files with 4542 additions and 336 deletions

View File

@ -0,0 +1,95 @@
<?php
namespace app\admin\controller\customer;
use app\admin\controller\BaseAdminController;
use app\admin\lists\customer\CustomerLists;
use app\admin\logic\customer\CustomerLogic;
use app\admin\validate\customer\CustomerValidate;
/**
* 客户管理控制器
* Class CustomerController
* @package app\admin\controller\customer
*/
class CustomerController extends BaseAdminController
{
/**
* @notes 获取客户管理列表
* @return \think\response\Json
* @author likeadmin
* @date 2024/04/23 14:44
*/
public function lists()
{
return $this->dataLists(new CustomerLists());
}
/**
* @notes 添加客户管理
* @return \think\response\Json
* @author likeadmin
* @date 2024/04/23 14:44
*/
public function add()
{
$params = (new CustomerValidate())->post()->goCheck('add');
$result = CustomerLogic::add($params);
if (true === $result) {
return $this->success('添加成功', [], 1, 1);
}
return $this->fail(CustomerLogic::getError());
}
/**
* @notes 编辑客户管理
* @return \think\response\Json
* @author likeadmin
* @date 2024/04/23 14:44
*/
public function edit()
{
$params = (new CustomerValidate())->post()->goCheck('edit');
$result = CustomerLogic::edit($params);
if (true === $result) {
return $this->success('编辑成功', [], 1, 1);
}
return $this->fail(CustomerLogic::getError());
}
/**
* @notes 删除客户管理
* @return \think\response\Json
* @author likeadmin
* @date 2024/04/23 14:44
*/
public function delete()
{
$params = (new CustomerValidate())->post()->goCheck('delete');
CustomerLogic::delete($params);
return $this->success('删除成功', [], 1, 1);
}
/**
* @notes 获取客户管理详情
* @return \think\response\Json
* @author likeadmin
* @date 2024/04/23 14:44
*/
public function detail()
{
$params = (new CustomerValidate())->goCheck('detail');
$result = CustomerLogic::detail($params);
return $this->data($result);
}
}

View File

@ -0,0 +1,95 @@
<?php
namespace app\admin\controller\goods;
use app\admin\controller\BaseAdminController;
use app\admin\lists\goods\BrandLists;
use app\admin\logic\goods\BrandLogic;
use app\admin\validate\goods\BrandValidate;
/**
* 商品品牌控制器
* Class BrandController
* @package app\admin\controller\goods
*/
class BrandController extends BaseAdminController
{
/**
* @notes 获取商品品牌列表
* @return \think\response\Json
* @author likeadmin
* @date 2024/04/23 10:34
*/
public function lists()
{
return $this->dataLists(new BrandLists());
}
/**
* @notes 添加商品品牌
* @return \think\response\Json
* @author likeadmin
* @date 2024/04/23 10:34
*/
public function add()
{
$params = (new BrandValidate())->post()->goCheck('add');
$result = BrandLogic::add($params);
if (true === $result) {
return $this->success('添加成功', [], 1, 1);
}
return $this->fail(BrandLogic::getError());
}
/**
* @notes 编辑商品品牌
* @return \think\response\Json
* @author likeadmin
* @date 2024/04/23 10:34
*/
public function edit()
{
$params = (new BrandValidate())->post()->goCheck('edit');
$result = BrandLogic::edit($params);
if (true === $result) {
return $this->success('编辑成功', [], 1, 1);
}
return $this->fail(BrandLogic::getError());
}
/**
* @notes 删除商品品牌
* @return \think\response\Json
* @author likeadmin
* @date 2024/04/23 10:34
*/
public function delete()
{
$params = (new BrandValidate())->post()->goCheck('delete');
BrandLogic::delete($params);
return $this->success('删除成功', [], 1, 1);
}
/**
* @notes 获取商品品牌详情
* @return \think\response\Json
* @author likeadmin
* @date 2024/04/23 10:34
*/
public function detail()
{
$params = (new BrandValidate())->goCheck('detail');
$result = BrandLogic::detail($params);
return $this->data($result);
}
}

View File

@ -0,0 +1,95 @@
<?php
namespace app\admin\controller\goods;
use app\admin\controller\BaseAdminController;
use app\admin\lists\goods\CodeLists;
use app\admin\logic\goods\CodeLogic;
use app\admin\validate\goods\CodeValidate;
/**
* 条码管理控制器
* Class CodeController
* @package app\admin\controller\goods
*/
class CodeController extends BaseAdminController
{
/**
* @notes 获取条码管理列表
* @return \think\response\Json
* @author likeadmin
* @date 2024/04/23 10:54
*/
public function lists()
{
return $this->dataLists(new CodeLists());
}
/**
* @notes 添加条码管理
* @return \think\response\Json
* @author likeadmin
* @date 2024/04/23 10:54
*/
public function add()
{
$params = (new CodeValidate())->post()->goCheck('add');
$result = CodeLogic::add($params);
if (true === $result) {
return $this->success('添加成功', [], 1, 1);
}
return $this->fail(CodeLogic::getError());
}
/**
* @notes 编辑条码管理
* @return \think\response\Json
* @author likeadmin
* @date 2024/04/23 10:54
*/
public function edit()
{
$params = (new CodeValidate())->post()->goCheck('edit');
$result = CodeLogic::edit($params);
if (true === $result) {
return $this->success('编辑成功', [], 1, 1);
}
return $this->fail(CodeLogic::getError());
}
/**
* @notes 删除条码管理
* @return \think\response\Json
* @author likeadmin
* @date 2024/04/23 10:54
*/
public function delete()
{
$params = (new CodeValidate())->post()->goCheck('delete');
CodeLogic::delete($params);
return $this->success('删除成功', [], 1, 1);
}
/**
* @notes 获取条码管理详情
* @return \think\response\Json
* @author likeadmin
* @date 2024/04/23 10:54
*/
public function detail()
{
$params = (new CodeValidate())->goCheck('detail');
$result = CodeLogic::detail($params);
return $this->data($result);
}
}

View File

@ -0,0 +1,95 @@
<?php
namespace app\admin\controller\goods;
use app\admin\controller\BaseAdminController;
use app\admin\lists\goods\GoodsLists;
use app\admin\logic\goods\GoodsLogic;
use app\admin\validate\goods\GoodsValidate;
/**
* 商品列表控制器
* Class GoodsController
* @package app\admin\controller\goods
*/
class GoodsController extends BaseAdminController
{
/**
* @notes 获取商品列表列表
* @return \think\response\Json
* @author likeadmin
* @date 2024/04/23 11:28
*/
public function lists()
{
return $this->dataLists(new GoodsLists());
}
/**
* @notes 添加商品列表
* @return \think\response\Json
* @author likeadmin
* @date 2024/04/23 11:28
*/
public function add()
{
$params = (new GoodsValidate())->post()->goCheck('add');
$result = GoodsLogic::add($params);
if (true === $result) {
return $this->success('添加成功', [], 1, 1);
}
return $this->fail(GoodsLogic::getError());
}
/**
* @notes 编辑商品列表
* @return \think\response\Json
* @author likeadmin
* @date 2024/04/23 11:28
*/
public function edit()
{
$params = (new GoodsValidate())->post()->goCheck('edit');
$result = GoodsLogic::edit($params);
if (true === $result) {
return $this->success('编辑成功', [], 1, 1);
}
return $this->fail(GoodsLogic::getError());
}
/**
* @notes 删除商品列表
* @return \think\response\Json
* @author likeadmin
* @date 2024/04/23 11:28
*/
public function delete()
{
$params = (new GoodsValidate())->post()->goCheck('delete');
GoodsLogic::delete($params);
return $this->success('删除成功', [], 1, 1);
}
/**
* @notes 获取商品列表详情
* @return \think\response\Json
* @author likeadmin
* @date 2024/04/23 11:28
*/
public function detail()
{
$params = (new GoodsValidate())->goCheck('detail');
$result = GoodsLogic::detail($params);
return $this->data($result);
}
}

View File

@ -0,0 +1,95 @@
<?php
namespace app\admin\controller\goods;
use app\admin\controller\BaseAdminController;
use app\admin\lists\goods\GoodsclassLists;
use app\admin\logic\goods\GoodsclassLogic;
use app\admin\validate\goods\GoodsclassValidate;
/**
* 商品分类控制器
* Class GoodsclassController
* @package app\admin\controller\goods
*/
class GoodsclassController extends BaseAdminController
{
/**
* @notes 获取商品分类列表
* @return \think\response\Json
* @author likeadmin
* @date 2024/04/23 10:27
*/
public function lists()
{
return $this->dataLists(new GoodsclassLists());
}
/**
* @notes 添加商品分类
* @return \think\response\Json
* @author likeadmin
* @date 2024/04/23 10:27
*/
public function add()
{
$params = (new GoodsclassValidate())->post()->goCheck('add');
$result = GoodsclassLogic::add($params);
if (true === $result) {
return $this->success('添加成功', [], 1, 1);
}
return $this->fail(GoodsclassLogic::getError());
}
/**
* @notes 编辑商品分类
* @return \think\response\Json
* @author likeadmin
* @date 2024/04/23 10:27
*/
public function edit()
{
$params = (new GoodsclassValidate())->post()->goCheck('edit');
$result = GoodsclassLogic::edit($params);
if (true === $result) {
return $this->success('编辑成功', [], 1, 1);
}
return $this->fail(GoodsclassLogic::getError());
}
/**
* @notes 删除商品分类
* @return \think\response\Json
* @author likeadmin
* @date 2024/04/23 10:27
*/
public function delete()
{
$params = (new GoodsclassValidate())->post()->goCheck('delete');
GoodsclassLogic::delete($params);
return $this->success('删除成功', [], 1, 1);
}
/**
* @notes 获取商品分类详情
* @return \think\response\Json
* @author likeadmin
* @date 2024/04/23 10:27
*/
public function detail()
{
$params = (new GoodsclassValidate())->goCheck('detail');
$result = GoodsclassLogic::detail($params);
return $this->data($result);
}
}

View File

@ -0,0 +1,95 @@
<?php
namespace app\admin\controller\goods;
use app\admin\controller\BaseAdminController;
use app\admin\lists\goods\UnitLists;
use app\admin\logic\goods\UnitLogic;
use app\admin\validate\goods\UnitValidate;
/**
* 计量单位控制器
* Class UnitController
* @package app\admin\controller\goods
*/
class UnitController extends BaseAdminController
{
/**
* @notes 获取计量单位列表
* @return \think\response\Json
* @author likeadmin
* @date 2024/04/23 10:42
*/
public function lists()
{
return $this->dataLists(new UnitLists());
}
/**
* @notes 添加计量单位
* @return \think\response\Json
* @author likeadmin
* @date 2024/04/23 10:42
*/
public function add()
{
$params = (new UnitValidate())->post()->goCheck('add');
$result = UnitLogic::add($params);
if (true === $result) {
return $this->success('添加成功', [], 1, 1);
}
return $this->fail(UnitLogic::getError());
}
/**
* @notes 编辑计量单位
* @return \think\response\Json
* @author likeadmin
* @date 2024/04/23 10:42
*/
public function edit()
{
$params = (new UnitValidate())->post()->goCheck('edit');
$result = UnitLogic::edit($params);
if (true === $result) {
return $this->success('编辑成功', [], 1, 1);
}
return $this->fail(UnitLogic::getError());
}
/**
* @notes 删除计量单位
* @return \think\response\Json
* @author likeadmin
* @date 2024/04/23 10:42
*/
public function delete()
{
$params = (new UnitValidate())->post()->goCheck('delete');
UnitLogic::delete($params);
return $this->success('删除成功', [], 1, 1);
}
/**
* @notes 获取计量单位详情
* @return \think\response\Json
* @author likeadmin
* @date 2024/04/23 10:42
*/
public function detail()
{
$params = (new UnitValidate())->goCheck('detail');
$result = UnitLogic::detail($params);
return $this->data($result);
}
}

View File

@ -0,0 +1,95 @@
<?php
namespace app\admin\controller\merchat;
use app\admin\controller\BaseAdminController;
use app\admin\lists\merchat\MerchantLists;
use app\admin\logic\merchat\MerchantLogic;
use app\admin\validate\merchat\MerchantValidate;
/**
* 商户列表控制器
* Class MerchantController
* @package app\admin\controller\merchat
*/
class MerchantController extends BaseAdminController
{
/**
* @notes 获取商户列表列表
* @return \think\response\Json
* @author likeadmin
* @date 2024/04/23 16:35
*/
public function lists()
{
return $this->dataLists(new MerchantLists());
}
/**
* @notes 添加商户列表
* @return \think\response\Json
* @author likeadmin
* @date 2024/04/23 16:35
*/
public function add()
{
$params = (new MerchantValidate())->post()->goCheck('add');
$result = MerchantLogic::add($params);
if (true === $result) {
return $this->success('添加成功', [], 1, 1);
}
return $this->fail(MerchantLogic::getError());
}
/**
* @notes 编辑商户列表
* @return \think\response\Json
* @author likeadmin
* @date 2024/04/23 16:35
*/
public function edit()
{
$params = (new MerchantValidate())->post()->goCheck('edit');
$result = MerchantLogic::edit($params);
if (true === $result) {
return $this->success('编辑成功', [], 1, 1);
}
return $this->fail(MerchantLogic::getError());
}
/**
* @notes 删除商户列表
* @return \think\response\Json
* @author likeadmin
* @date 2024/04/23 16:35
*/
public function delete()
{
$params = (new MerchantValidate())->post()->goCheck('delete');
MerchantLogic::delete($params);
return $this->success('删除成功', [], 1, 1);
}
/**
* @notes 获取商户列表详情
* @return \think\response\Json
* @author likeadmin
* @date 2024/04/23 16:35
*/
public function detail()
{
$params = (new MerchantValidate())->goCheck('detail');
$result = MerchantLogic::detail($params);
return $this->data($result);
}
}

View File

@ -0,0 +1,95 @@
<?php
namespace app\admin\controller\supplier;
use app\admin\controller\BaseAdminController;
use app\admin\lists\supplier\SupplierLists;
use app\admin\logic\supplier\SupplierLogic;
use app\admin\validate\supplier\SupplierValidate;
/**
* 供应商管理控制器
* Class SupplierController
* @package app\admin\controller\supplier
*/
class SupplierController extends BaseAdminController
{
/**
* @notes 获取供应商管理列表
* @return \think\response\Json
* @author likeadmin
* @date 2024/04/23 15:56
*/
public function lists()
{
return $this->dataLists(new SupplierLists());
}
/**
* @notes 添加供应商管理
* @return \think\response\Json
* @author likeadmin
* @date 2024/04/23 15:56
*/
public function add()
{
$params = (new SupplierValidate())->post()->goCheck('add');
$result = SupplierLogic::add($params);
if (true === $result) {
return $this->success('添加成功', [], 1, 1);
}
return $this->fail(SupplierLogic::getError());
}
/**
* @notes 编辑供应商管理
* @return \think\response\Json
* @author likeadmin
* @date 2024/04/23 15:56
*/
public function edit()
{
$params = (new SupplierValidate())->post()->goCheck('edit');
$result = SupplierLogic::edit($params);
if (true === $result) {
return $this->success('编辑成功', [], 1, 1);
}
return $this->fail(SupplierLogic::getError());
}
/**
* @notes 删除供应商管理
* @return \think\response\Json
* @author likeadmin
* @date 2024/04/23 15:56
*/
public function delete()
{
$params = (new SupplierValidate())->post()->goCheck('delete');
SupplierLogic::delete($params);
return $this->success('删除成功', [], 1, 1);
}
/**
* @notes 获取供应商管理详情
* @return \think\response\Json
* @author likeadmin
* @date 2024/04/23 15:56
*/
public function detail()
{
$params = (new SupplierValidate())->goCheck('detail');
$result = SupplierLogic::detail($params);
return $this->data($result);
}
}

View File

@ -0,0 +1,95 @@
<?php
namespace app\admin\controller\warehouse;
use app\admin\controller\BaseAdminController;
use app\admin\lists\warehouse\WarehouseLists;
use app\admin\logic\warehouse\WarehouseLogic;
use app\admin\validate\warehouse\WarehouseValidate;
/**
* 仓库列表控制器
* Class WarehouseController
* @package app\admin\controller\warehouse
*/
class WarehouseController extends BaseAdminController
{
/**
* @notes 获取仓库列表列表
* @return \think\response\Json
* @author likeadmin
* @date 2024/04/23 11:06
*/
public function lists()
{
return $this->dataLists(new WarehouseLists());
}
/**
* @notes 添加仓库列表
* @return \think\response\Json
* @author likeadmin
* @date 2024/04/23 11:06
*/
public function add()
{
$params = (new WarehouseValidate())->post()->goCheck('add');
$result = WarehouseLogic::add($params);
if (true === $result) {
return $this->success('添加成功', [], 1, 1);
}
return $this->fail(WarehouseLogic::getError());
}
/**
* @notes 编辑仓库列表
* @return \think\response\Json
* @author likeadmin
* @date 2024/04/23 11:06
*/
public function edit()
{
$params = (new WarehouseValidate())->post()->goCheck('edit');
$result = WarehouseLogic::edit($params);
if (true === $result) {
return $this->success('编辑成功', [], 1, 1);
}
return $this->fail(WarehouseLogic::getError());
}
/**
* @notes 删除仓库列表
* @return \think\response\Json
* @author likeadmin
* @date 2024/04/23 11:06
*/
public function delete()
{
$params = (new WarehouseValidate())->post()->goCheck('delete');
WarehouseLogic::delete($params);
return $this->success('删除成功', [], 1, 1);
}
/**
* @notes 获取仓库列表详情
* @return \think\response\Json
* @author likeadmin
* @date 2024/04/23 11:06
*/
public function detail()
{
$params = (new WarehouseValidate())->goCheck('detail');
$result = WarehouseLogic::detail($params);
return $this->data($result);
}
}

View File

@ -0,0 +1,65 @@
<?php
namespace app\admin\lists\customer;
use app\admin\lists\BaseAdminDataLists;
use app\common\model\customer\Customer;
use app\common\lists\ListsSearchInterface;
/**
* 客户管理列表
* Class CustomerLists
* @package app\admin\listscustomer
*/
class CustomerLists extends BaseAdminDataLists implements ListsSearchInterface
{
/**
* @notes 设置搜索条件
* @return \string[][]
* @author likeadmin
* @date 2024/04/23 14:44
*/
public function setSearch(): array
{
return [
'=' => ['name', 'number', 'contacts', 'tel', 'customer_type', 'dept_type', 'related_suppliers', 'invoice_type'],
];
}
/**
* @notes 获取客户管理列表
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author likeadmin
* @date 2024/04/23 14:44
*/
public function lists(): array
{
return Customer::where($this->searchWhere)
->field(['id', 'name', 'number', 'contacts', 'tel', 'customer_type', 'dept_type', 'related_suppliers', 'invoice_type'])
->limit($this->limitOffset, $this->limitLength)
->order(['id' => 'desc'])
->select()
->toArray();
}
/**
* @notes 获取客户管理数量
* @return int
* @author likeadmin
* @date 2024/04/23 14:44
*/
public function count(): int
{
return Customer::where($this->searchWhere)->count();
}
}

View File

@ -0,0 +1,65 @@
<?php
namespace app\admin\lists\goods;
use app\admin\lists\BaseAdminDataLists;
use app\common\model\goods\Brand;
use app\common\lists\ListsSearchInterface;
/**
* 商品品牌列表
* Class BrandLists
* @package app\admin\listsgoods
*/
class BrandLists extends BaseAdminDataLists implements ListsSearchInterface
{
/**
* @notes 设置搜索条件
* @return \string[][]
* @author likeadmin
* @date 2024/04/23 10:34
*/
public function setSearch(): array
{
return [
'=' => ['name', 'py', 'number', 'data', 'more', 'pic', 'sort'],
];
}
/**
* @notes 获取商品品牌列表
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author likeadmin
* @date 2024/04/23 10:34
*/
public function lists(): array
{
return Brand::where($this->searchWhere)
->field(['id', 'name', 'py', 'number', 'data', 'more', 'pic', 'sort'])
->limit($this->limitOffset, $this->limitLength)
->order(['id' => 'desc'])
->select()
->toArray();
}
/**
* @notes 获取商品品牌数量
* @return int
* @author likeadmin
* @date 2024/04/23 10:34
*/
public function count(): int
{
return Brand::where($this->searchWhere)->count();
}
}

View File

@ -0,0 +1,65 @@
<?php
namespace app\admin\lists\goods;
use app\admin\lists\BaseAdminDataLists;
use app\common\model\goods\Code;
use app\common\lists\ListsSearchInterface;
/**
* 条码管理列表
* Class CodeLists
* @package app\admin\listsgoods
*/
class CodeLists extends BaseAdminDataLists implements ListsSearchInterface
{
/**
* @notes 设置搜索条件
* @return \string[][]
* @author likeadmin
* @date 2024/04/23 10:54
*/
public function setSearch(): array
{
return [
'=' => ['name', 'py', 'code', 'type', 'data', 'more', 'sort'],
];
}
/**
* @notes 获取条码管理列表
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author likeadmin
* @date 2024/04/23 10:54
*/
public function lists(): array
{
return Code::where($this->searchWhere)
->field(['id', 'name', 'py', 'code', 'type', 'data', 'more', 'sort'])
->limit($this->limitOffset, $this->limitLength)
->order(['id' => 'desc'])
->select()
->toArray();
}
/**
* @notes 获取条码管理数量
* @return int
* @author likeadmin
* @date 2024/04/23 10:54
*/
public function count(): int
{
return Code::where($this->searchWhere)->count();
}
}

View File

@ -0,0 +1,66 @@
<?php
namespace app\admin\lists\goods;
use app\admin\lists\BaseAdminDataLists;
use app\common\model\goods\Goods;
use app\common\lists\ListsSearchInterface;
/**
* 商品列表列表
* Class GoodsLists
* @package app\admin\listsgoods
*/
class GoodsLists extends BaseAdminDataLists implements ListsSearchInterface
{
/**
* @notes 设置搜索条件
* @return \string[][]
* @author likeadmin
* @date 2024/04/23 11:28
*/
public function setSearch(): array
{
return [
'=' => ['name', 'class', 'brand', 'unit', 'code', 'warehouse', 'retail_name', 'sort'],
];
}
/**
* @notes 获取商品列表列表
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author likeadmin
* @date 2024/04/23 11:28
*/
public function lists(): array
{
return Goods::where($this->searchWhere)
// ->field(['id', 'name', 'py', 'number', 'spec', 'class', 'brand', 'unit', 'buy', 'sell', 'retail', 'code', 'warehouse', 'location', 'stocktip', 'retail_name', 'imgs', 'data', 'sort'])
->limit($this->limitOffset, $this->limitLength)
->with(['className','brandName','unitName','warehouseName'])
->order(['id' => 'desc'])
->select()
->toArray();
}
/**
* @notes 获取商品列表数量
* @return int
* @author likeadmin
* @date 2024/04/23 11:28
*/
public function count(): int
{
return Goods::where($this->searchWhere)->count();
}
}

View File

@ -0,0 +1,67 @@
<?php
namespace app\admin\lists\goods;
use app\admin\lists\BaseAdminDataLists;
use app\common\model\goods\Goodsclass;
use app\common\lists\ListsSearchInterface;
/**
* 商品分类列表
* Class GoodsclassLists
* @package app\admin\listsgoods
*/
class GoodsclassLists extends BaseAdminDataLists implements ListsSearchInterface
{
/**
* @notes 设置搜索条件
* @return \string[][]
* @author likeadmin
* @date 2024/04/23 10:27
*/
public function setSearch(): array
{
return [
'=' => ['pid', 'name', 'data', 'pic', 'sort'],
];
}
/**
* @notes 获取商品分类列表
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author likeadmin
* @date 2024/04/23 10:27
*/
public function lists(): array
{
$lists= Goodsclass::where($this->searchWhere)
->field(['id', 'pid', 'name', 'data', 'pic', 'sort'])
->limit($this->limitOffset, $this->limitLength)
->order(['id' => 'desc'])
->select()
->toArray();
return linear_to_tree($lists, 'children');
}
/**
* @notes 获取商品分类数量
* @return int
* @author likeadmin
* @date 2024/04/23 10:27
*/
public function count(): int
{
return Goodsclass::where($this->searchWhere)->count();
}
}

View File

@ -0,0 +1,65 @@
<?php
namespace app\admin\lists\goods;
use app\admin\lists\BaseAdminDataLists;
use app\common\model\goods\Unit;
use app\common\lists\ListsSearchInterface;
/**
* 计量单位列表
* Class UnitLists
* @package app\admin\listsgoods
*/
class UnitLists extends BaseAdminDataLists implements ListsSearchInterface
{
/**
* @notes 设置搜索条件
* @return \string[][]
* @author likeadmin
* @date 2024/04/23 10:42
*/
public function setSearch(): array
{
return [
'=' => ['name', 'py', 'number', 'data', 'more'],
];
}
/**
* @notes 获取计量单位列表
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author likeadmin
* @date 2024/04/23 10:42
*/
public function lists(): array
{
return Unit::where($this->searchWhere)
->field(['id', 'name', 'py', 'number', 'data', 'more'])
->limit($this->limitOffset, $this->limitLength)
->order(['id' => 'desc'])
->select()
->toArray();
}
/**
* @notes 获取计量单位数量
* @return int
* @author likeadmin
* @date 2024/04/23 10:42
*/
public function count(): int
{
return Unit::where($this->searchWhere)->count();
}
}

View File

@ -0,0 +1,65 @@
<?php
namespace app\admin\lists\merchat;
use app\admin\lists\BaseAdminDataLists;
use app\common\model\merchat\Merchant;
use app\common\lists\ListsSearchInterface;
/**
* 商户列表列表
* Class MerchantLists
* @package app\admin\listsmerchat
*/
class MerchantLists extends BaseAdminDataLists implements ListsSearchInterface
{
/**
* @notes 设置搜索条件
* @return \string[][]
* @author likeadmin
* @date 2024/04/23 16:35
*/
public function setSearch(): array
{
return [
'=' => ['category_id', 'type_id', 'mer_name', 'credit_buy', 'status', 'commission_rate', 'service_phone', 'mer_money', 'financial_bank', 'financial_wechat', 'financial_alipay'],
];
}
/**
* @notes 获取商户列表列表
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author likeadmin
* @date 2024/04/23 16:35
*/
public function lists(): array
{
return Merchant::where($this->searchWhere)
->field(['mer_id', 'category_id', 'type_id', 'mer_name', 'credit_buy', 'settle_cycle', 'interest_rate', 'city_id', 'area_id', 'street_id', 'village_id', 'mer_address', 'mer_avatar', 'mark', 'commission_rate', 'service_phone', 'mer_money', 'financial_bank', 'financial_wechat', 'financial_alipay'])
->limit($this->limitOffset, $this->limitLength)
->order(['mer_id' => 'desc'])
->select()
->toArray();
}
/**
* @notes 获取商户列表数量
* @return int
* @author likeadmin
* @date 2024/04/23 16:35
*/
public function count(): int
{
return Merchant::where($this->searchWhere)->count();
}
}

View File

@ -0,0 +1,65 @@
<?php
namespace app\admin\lists\supplier;
use app\admin\lists\BaseAdminDataLists;
use app\common\model\supplier\Supplier;
use app\common\lists\ListsSearchInterface;
/**
* 供应商管理列表
* Class SupplierLists
* @package app\admin\listssupplier
*/
class SupplierLists extends BaseAdminDataLists implements ListsSearchInterface
{
/**
* @notes 设置搜索条件
* @return \string[][]
* @author likeadmin
* @date 2024/04/23 15:56
*/
public function setSearch(): array
{
return [
'=' => ['name', 'tel', 'supplier_type', 'invoice_type'],
];
}
/**
* @notes 获取供应商管理列表
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author likeadmin
* @date 2024/04/23 15:56
*/
public function lists(): array
{
return Supplier::where($this->searchWhere)
->field(['id', 'name', 'py', 'number', 'uid', 'contacts', 'tel', 'bank', 'account', 'tax', 'supplier_type', 'tax_rate', 'invoice_type', 'dept_type'])
->limit($this->limitOffset, $this->limitLength)
->order(['id' => 'desc'])
->select()
->toArray();
}
/**
* @notes 获取供应商管理数量
* @return int
* @author likeadmin
* @date 2024/04/23 15:56
*/
public function count(): int
{
return Supplier::where($this->searchWhere)->count();
}
}

View File

@ -0,0 +1,65 @@
<?php
namespace app\admin\lists\warehouse;
use app\admin\lists\BaseAdminDataLists;
use app\common\model\warehouse\Warehouse;
use app\common\lists\ListsSearchInterface;
/**
* 仓库列表列表
* Class WarehouseLists
* @package app\admin\listswarehouse
*/
class WarehouseLists extends BaseAdminDataLists implements ListsSearchInterface
{
/**
* @notes 设置搜索条件
* @return \string[][]
* @author likeadmin
* @date 2024/04/23 11:06
*/
public function setSearch(): array
{
return [
'=' => ['name', 'py', 'dept_id', 'number', 'contacts', 'tel', 'add', 'data', 'more', 'sort'],
];
}
/**
* @notes 获取仓库列表列表
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author likeadmin
* @date 2024/04/23 11:06
*/
public function lists(): array
{
return Warehouse::where($this->searchWhere)
->field(['id', 'name', 'py', 'dept_id', 'number', 'contacts', 'tel', 'add', 'data', 'more', 'sort'])
->limit($this->limitOffset, $this->limitLength)
->order(['id' => 'desc'])
->select()
->toArray();
}
/**
* @notes 获取仓库列表数量
* @return int
* @author likeadmin
* @date 2024/04/23 11:06
*/
public function count(): int
{
return Warehouse::where($this->searchWhere)->count();
}
}

View File

@ -0,0 +1,130 @@
<?php
namespace app\admin\logic\customer;
use app\common\model\customer\Customer;
use app\common\logic\BaseLogic;
use think\facade\Db;
/**
* 客户管理逻辑
* Class CustomerLogic
* @package app\admin\logic\customer
*/
class CustomerLogic extends BaseLogic
{
/**
* @notes 添加客户管理
* @param array $params
* @return bool
* @author likeadmin
* @date 2024/04/23 14:44
*/
public static function add(array $params): bool
{
Db::startTrans();
try {
Customer::create([
'name' => $params['name'],
'number' => $params['number'],
'contacts' => $params['contacts'],
'tel' => $params['tel'],
'add' => $params['add'],
'birthday' => $params['birthday'],
'bank' => $params['bank'],
'account' => $params['account'],
'tax' => $params['tax'],
'other' => $params['other'],
'email' => $params['email'],
'data' => $params['data'],
'more' => $params['more'],
'sort' => $params['sort'],
'customer_type' => $params['customer_type'],
'price_level' => $params['price_level'],
'dept_type' => $params['dept_type'],
'related_suppliers' => $params['related_suppliers'],
'invoice_type' => $params['invoice_type']
]);
Db::commit();
return true;
} catch (\Exception $e) {
Db::rollback();
self::setError($e->getMessage());
return false;
}
}
/**
* @notes 编辑客户管理
* @param array $params
* @return bool
* @author likeadmin
* @date 2024/04/23 14:44
*/
public static function edit(array $params): bool
{
Db::startTrans();
try {
Customer::where('id', $params['id'])->update([
'name' => $params['name'],
'number' => $params['number'],
'contacts' => $params['contacts'],
'tel' => $params['tel'],
'add' => $params['add'],
'birthday' => $params['birthday'],
'bank' => $params['bank'],
'account' => $params['account'],
'tax' => $params['tax'],
'other' => $params['other'],
'email' => $params['email'],
'data' => $params['data'],
'more' => $params['more'],
'sort' => $params['sort'],
'customer_type' => $params['customer_type'],
'price_level' => $params['price_level'],
'dept_type' => $params['dept_type'],
'related_suppliers' => $params['related_suppliers'],
'invoice_type' => $params['invoice_type']
]);
Db::commit();
return true;
} catch (\Exception $e) {
Db::rollback();
self::setError($e->getMessage());
return false;
}
}
/**
* @notes 删除客户管理
* @param array $params
* @return bool
* @author likeadmin
* @date 2024/04/23 14:44
*/
public static function delete(array $params): bool
{
return Customer::destroy($params['id']);
}
/**
* @notes 获取客户管理详情
* @param $params
* @return array
* @author likeadmin
* @date 2024/04/23 14:44
*/
public static function detail($params): array
{
return Customer::findOrEmpty($params['id'])->toArray();
}
}

View File

@ -0,0 +1,106 @@
<?php
namespace app\admin\logic\goods;
use app\common\model\goods\Brand;
use app\common\logic\BaseLogic;
use think\facade\Db;
/**
* 商品品牌逻辑
* Class BrandLogic
* @package app\admin\logic\goods
*/
class BrandLogic extends BaseLogic
{
/**
* @notes 添加商品品牌
* @param array $params
* @return bool
* @author likeadmin
* @date 2024/04/23 10:34
*/
public static function add(array $params): bool
{
Db::startTrans();
try {
Brand::create([
'name' => $params['name'],
'py' => $params['py'],
'number' => $params['number'],
'data' => $params['data'],
'more' => $params['more'],
'pic' => $params['pic'],
'sort' => $params['sort']
]);
Db::commit();
return true;
} catch (\Exception $e) {
Db::rollback();
self::setError($e->getMessage());
return false;
}
}
/**
* @notes 编辑商品品牌
* @param array $params
* @return bool
* @author likeadmin
* @date 2024/04/23 10:34
*/
public static function edit(array $params): bool
{
Db::startTrans();
try {
Brand::where('id', $params['id'])->update([
'name' => $params['name'],
'py' => $params['py'],
'number' => $params['number'],
'data' => $params['data'],
'more' => $params['more'],
'pic' => $params['pic'],
'sort' => $params['sort']
]);
Db::commit();
return true;
} catch (\Exception $e) {
Db::rollback();
self::setError($e->getMessage());
return false;
}
}
/**
* @notes 删除商品品牌
* @param array $params
* @return bool
* @author likeadmin
* @date 2024/04/23 10:34
*/
public static function delete(array $params): bool
{
return Brand::destroy($params['id']);
}
/**
* @notes 获取商品品牌详情
* @param $params
* @return array
* @author likeadmin
* @date 2024/04/23 10:34
*/
public static function detail($params): array
{
return Brand::findOrEmpty($params['id'])->toArray();
}
}

View File

@ -0,0 +1,106 @@
<?php
namespace app\admin\logic\goods;
use app\common\model\goods\Code;
use app\common\logic\BaseLogic;
use think\facade\Db;
/**
* 条码管理逻辑
* Class CodeLogic
* @package app\admin\logic\goods
*/
class CodeLogic extends BaseLogic
{
/**
* @notes 添加条码管理
* @param array $params
* @return bool
* @author likeadmin
* @date 2024/04/23 10:54
*/
public static function add(array $params): bool
{
Db::startTrans();
try {
Code::create([
'name' => $params['name'],
'py' => $params['py'],
'code' => $params['code'],
'type' => $params['type'],
'data' => $params['data'],
'more' => $params['more'],
'sort' => $params['sort']
]);
Db::commit();
return true;
} catch (\Exception $e) {
Db::rollback();
self::setError($e->getMessage());
return false;
}
}
/**
* @notes 编辑条码管理
* @param array $params
* @return bool
* @author likeadmin
* @date 2024/04/23 10:54
*/
public static function edit(array $params): bool
{
Db::startTrans();
try {
Code::where('id', $params['id'])->update([
'name' => $params['name'],
'py' => $params['py'],
'code' => $params['code'],
'type' => $params['type'],
'data' => $params['data'],
'more' => $params['more'],
'sort' => $params['sort']
]);
Db::commit();
return true;
} catch (\Exception $e) {
Db::rollback();
self::setError($e->getMessage());
return false;
}
}
/**
* @notes 删除条码管理
* @param array $params
* @return bool
* @author likeadmin
* @date 2024/04/23 10:54
*/
public static function delete(array $params): bool
{
return Code::destroy($params['id']);
}
/**
* @notes 获取条码管理详情
* @param $params
* @return array
* @author likeadmin
* @date 2024/04/23 10:54
*/
public static function detail($params): array
{
return Code::findOrEmpty($params['id'])->toArray();
}
}

View File

@ -0,0 +1,134 @@
<?php
namespace app\admin\logic\goods;
use app\common\model\goods\Goods;
use app\common\logic\BaseLogic;
use think\facade\Db;
/**
* 商品列表逻辑
* Class GoodsLogic
* @package app\admin\logic\goods
*/
class GoodsLogic extends BaseLogic
{
/**
* @notes 添加商品列表
* @param array $params
* @return bool
* @author likeadmin
* @date 2024/04/23 11:28
*/
public static function add(array $params): bool
{
Db::startTrans();
try {
Goods::create([
'name' => $params['name'],
'py' => $params['py'],
'number' => $params['number'],
'spec' => $params['spec'],
'class' => $params['class'],
'brand' => $params['brand'],
'unit' => $params['unit'],
'buy' => $params['buy'],
'sell' => $params['sell'],
'retail' => $params['retail'],
'integral' => $params['integral'],
'code' => $params['code'],
'warehouse' => $params['warehouse'],
'location' => $params['location'],
'stocktip' => $params['stocktip'],
'retail_name' => $params['retail_name'],
'imgs' => $params['imgs'],
'details' => $params['details']?implode(',',$params['details']):'',
'data' => $params['data'],
'more' => $params['more'],
'sort' => $params['sort']
]);
Db::commit();
return true;
} catch (\Exception $e) {
Db::rollback();
self::setError($e->getMessage());
return false;
}
}
/**
* @notes 编辑商品列表
* @param array $params
* @return bool
* @author likeadmin
* @date 2024/04/23 11:28
*/
public static function edit(array $params): bool
{
Db::startTrans();
try {
Goods::where('id', $params['id'])->update([
'name' => $params['name'],
'py' => $params['py'],
'number' => $params['number'],
'spec' => $params['spec'],
'class' => $params['class'],
'brand' => $params['brand'],
'unit' => $params['unit'],
'buy' => $params['buy'],
'sell' => $params['sell'],
'retail' => $params['retail'],
'integral' => $params['integral'],
'code' => $params['code'],
'warehouse' => $params['warehouse'],
'location' => $params['location'],
'stocktip' => $params['stocktip'],
'retail_name' => $params['retail_name'],
'imgs' => $params['imgs'],
'details' => $params['details']?implode(',',$params['details']):'',
'data' => $params['data'],
'more' => $params['more'],
'sort' => $params['sort']
]);
Db::commit();
return true;
} catch (\Exception $e) {
Db::rollback();
self::setError($e->getMessage());
return false;
}
}
/**
* @notes 删除商品列表
* @param array $params
* @return bool
* @author likeadmin
* @date 2024/04/23 11:28
*/
public static function delete(array $params): bool
{
return Goods::destroy($params['id']);
}
/**
* @notes 获取商品列表详情
* @param $params
* @return array
* @author likeadmin
* @date 2024/04/23 11:28
*/
public static function detail($params): array
{
return Goods::findOrEmpty($params['id'])->toArray();
}
}

View File

@ -0,0 +1,102 @@
<?php
namespace app\admin\logic\goods;
use app\common\model\goods\Goodsclass;
use app\common\logic\BaseLogic;
use think\facade\Db;
/**
* 商品分类逻辑
* Class GoodsclassLogic
* @package app\admin\logic\goods
*/
class GoodsclassLogic extends BaseLogic
{
/**
* @notes 添加商品分类
* @param array $params
* @return bool
* @author likeadmin
* @date 2024/04/23 10:27
*/
public static function add(array $params): bool
{
Db::startTrans();
try {
Goodsclass::create([
'pid' => $params['pid'],
'name' => $params['name'],
'data' => $params['data'],
'pic' => $params['pic'],
'sort' => $params['sort']
]);
Db::commit();
return true;
} catch (\Exception $e) {
Db::rollback();
self::setError($e->getMessage());
return false;
}
}
/**
* @notes 编辑商品分类
* @param array $params
* @return bool
* @author likeadmin
* @date 2024/04/23 10:27
*/
public static function edit(array $params): bool
{
Db::startTrans();
try {
Goodsclass::where('id', $params['id'])->update([
'pid' => $params['pid'],
'name' => $params['name'],
'data' => $params['data'],
'pic' => $params['pic'],
'sort' => $params['sort']
]);
Db::commit();
return true;
} catch (\Exception $e) {
Db::rollback();
self::setError($e->getMessage());
return false;
}
}
/**
* @notes 删除商品分类
* @param array $params
* @return bool
* @author likeadmin
* @date 2024/04/23 10:27
*/
public static function delete(array $params): bool
{
return Goodsclass::destroy($params['id']);
}
/**
* @notes 获取商品分类详情
* @param $params
* @return array
* @author likeadmin
* @date 2024/04/23 10:27
*/
public static function detail($params): array
{
return Goodsclass::findOrEmpty($params['id'])->toArray();
}
}

View File

@ -0,0 +1,102 @@
<?php
namespace app\admin\logic\goods;
use app\common\model\goods\Unit;
use app\common\logic\BaseLogic;
use think\facade\Db;
/**
* 计量单位逻辑
* Class UnitLogic
* @package app\admin\logic\goods
*/
class UnitLogic extends BaseLogic
{
/**
* @notes 添加计量单位
* @param array $params
* @return bool
* @author likeadmin
* @date 2024/04/23 10:42
*/
public static function add(array $params): bool
{
Db::startTrans();
try {
Unit::create([
'name' => $params['name'],
'py' => $params['py'],
'number' => $params['number'],
'data' => $params['data'],
'more' => $params['more']
]);
Db::commit();
return true;
} catch (\Exception $e) {
Db::rollback();
self::setError($e->getMessage());
return false;
}
}
/**
* @notes 编辑计量单位
* @param array $params
* @return bool
* @author likeadmin
* @date 2024/04/23 10:42
*/
public static function edit(array $params): bool
{
Db::startTrans();
try {
Unit::where('id', $params['id'])->update([
'name' => $params['name'],
'py' => $params['py'],
'number' => $params['number'],
'data' => $params['data'],
'more' => $params['more']
]);
Db::commit();
return true;
} catch (\Exception $e) {
Db::rollback();
self::setError($e->getMessage());
return false;
}
}
/**
* @notes 删除计量单位
* @param array $params
* @return bool
* @author likeadmin
* @date 2024/04/23 10:42
*/
public static function delete(array $params): bool
{
return Unit::destroy($params['id']);
}
/**
* @notes 获取计量单位详情
* @param $params
* @return array
* @author likeadmin
* @date 2024/04/23 10:42
*/
public static function detail($params): array
{
return Unit::findOrEmpty($params['id'])->toArray();
}
}

View File

@ -0,0 +1,142 @@
<?php
namespace app\admin\logic\merchat;
use app\common\model\merchat\Merchant;
use app\common\logic\BaseLogic;
use think\facade\Db;
/**
* 商户列表逻辑
* Class MerchantLogic
* @package app\admin\logic\merchat
*/
class MerchantLogic extends BaseLogic
{
/**
* @notes 添加商户列表
* @param array $params
* @return bool
* @author likeadmin
* @date 2024/04/23 16:35
*/
public static function add(array $params): bool
{
Db::startTrans();
try {
Merchant::create([
'mer_id' => $params['mer_id'],
'category_id' => $params['category_id'],
'type_id' => $params['type_id'],
'mer_name' => $params['mer_name'],
'credit_buy' => $params['credit_buy'],
'settle_cycle' => $params['settle_cycle'],
'interest_rate' => $params['interest_rate'],
'city_id' => $params['city_id'],
'area_id' => $params['area_id'],
'street_id' => $params['street_id'],
'village_id' => $params['village_id'],
'mer_address' => $params['mer_address'],
'mer_avatar' => $params['mer_avatar'],
'mark' => $params['mark'],
'sort' => $params['sort'],
'status' => $params['status'],
'commission_rate' => $params['commission_rate'],
'commission_switch' => $params['commission_switch'],
'long' => $params['long'],
'lat' => $params['lat'],
'service_phone' => $params['service_phone'],
'mer_money' => $params['mer_money'],
'financial_bank' => $params['financial_bank'],
'financial_wechat' => $params['financial_wechat'],
'financial_alipay' => $params['financial_alipay']
]);
Db::commit();
return true;
} catch (\Exception $e) {
Db::rollback();
self::setError($e->getMessage());
return false;
}
}
/**
* @notes 编辑商户列表
* @param array $params
* @return bool
* @author likeadmin
* @date 2024/04/23 16:35
*/
public static function edit(array $params): bool
{
Db::startTrans();
try {
Merchant::where('mer_id', $params['mer_id'])->update([
'mer_id' => $params['mer_id'],
'category_id' => $params['category_id'],
'type_id' => $params['type_id'],
'mer_name' => $params['mer_name'],
'credit_buy' => $params['credit_buy'],
'settle_cycle' => $params['settle_cycle'],
'interest_rate' => $params['interest_rate'],
'city_id' => $params['city_id'],
'area_id' => $params['area_id'],
'street_id' => $params['street_id'],
'village_id' => $params['village_id'],
'mer_address' => $params['mer_address'],
'mer_avatar' => $params['mer_avatar'],
'mark' => $params['mark'],
'sort' => $params['sort'],
'status' => $params['status'],
'commission_rate' => $params['commission_rate'],
'commission_switch' => $params['commission_switch'],
'long' => $params['long'],
'lat' => $params['lat'],
'service_phone' => $params['service_phone'],
'mer_money' => $params['mer_money'],
'financial_bank' => $params['financial_bank'],
'financial_wechat' => $params['financial_wechat'],
'financial_alipay' => $params['financial_alipay']
]);
Db::commit();
return true;
} catch (\Exception $e) {
Db::rollback();
self::setError($e->getMessage());
return false;
}
}
/**
* @notes 删除商户列表
* @param array $params
* @return bool
* @author likeadmin
* @date 2024/04/23 16:35
*/
public static function delete(array $params): bool
{
return Merchant::destroy($params['mer_id']);
}
/**
* @notes 获取商户列表详情
* @param $params
* @return array
* @author likeadmin
* @date 2024/04/23 16:35
*/
public static function detail($params): array
{
return Merchant::findOrEmpty($params['mer_id'])->toArray();
}
}

View File

@ -0,0 +1,130 @@
<?php
namespace app\admin\logic\supplier;
use app\common\model\supplier\Supplier;
use app\common\logic\BaseLogic;
use think\facade\Db;
/**
* 供应商管理逻辑
* Class SupplierLogic
* @package app\admin\logic\supplier
*/
class SupplierLogic extends BaseLogic
{
/**
* @notes 添加供应商管理
* @param array $params
* @return bool
* @author likeadmin
* @date 2024/04/23 15:56
*/
public static function add(array $params): bool
{
Db::startTrans();
try {
Supplier::create([
'name' => $params['name'],
'py' => $params['py'],
'number' => $params['number'],
'uid' => $params['uid'],
'contacts' => $params['contacts'],
'tel' => $params['tel'],
'add' => $params['add'],
'bank' => $params['bank'],
'account' => $params['account'],
'tax' => $params['tax'],
'other' => $params['other'],
'email' => $params['email'],
'data' => $params['data'],
'more' => $params['more'],
'supplier_type' => $params['supplier_type'],
'tax_rate' => $params['tax_rate'],
'invoice_type' => $params['invoice_type'],
'dept_type' => $params['dept_type'],
'sort' => $params['sort']
]);
Db::commit();
return true;
} catch (\Exception $e) {
Db::rollback();
self::setError($e->getMessage());
return false;
}
}
/**
* @notes 编辑供应商管理
* @param array $params
* @return bool
* @author likeadmin
* @date 2024/04/23 15:56
*/
public static function edit(array $params): bool
{
Db::startTrans();
try {
Supplier::where('id', $params['id'])->update([
'name' => $params['name'],
'py' => $params['py'],
'number' => $params['number'],
'uid' => $params['uid'],
'contacts' => $params['contacts'],
'tel' => $params['tel'],
'add' => $params['add'],
'bank' => $params['bank'],
'account' => $params['account'],
'tax' => $params['tax'],
'other' => $params['other'],
'email' => $params['email'],
'data' => $params['data'],
'more' => $params['more'],
'supplier_type' => $params['supplier_type'],
'tax_rate' => $params['tax_rate'],
'invoice_type' => $params['invoice_type'],
'dept_type' => $params['dept_type'],
'sort' => $params['sort']
]);
Db::commit();
return true;
} catch (\Exception $e) {
Db::rollback();
self::setError($e->getMessage());
return false;
}
}
/**
* @notes 删除供应商管理
* @param array $params
* @return bool
* @author likeadmin
* @date 2024/04/23 15:56
*/
public static function delete(array $params): bool
{
return Supplier::destroy($params['id']);
}
/**
* @notes 获取供应商管理详情
* @param $params
* @return array
* @author likeadmin
* @date 2024/04/23 15:56
*/
public static function detail($params): array
{
return Supplier::findOrEmpty($params['id'])->toArray();
}
}

View File

@ -0,0 +1,112 @@
<?php
namespace app\admin\logic\warehouse;
use app\common\model\warehouse\Warehouse;
use app\common\logic\BaseLogic;
use think\facade\Db;
/**
* 仓库列表逻辑
* Class WarehouseLogic
* @package app\admin\logic\warehouse
*/
class WarehouseLogic extends BaseLogic
{
/**
* @notes 添加仓库列表
* @param array $params
* @return bool
* @author likeadmin
* @date 2024/04/23 11:06
*/
public static function add(array $params): bool
{
Db::startTrans();
try {
Warehouse::create([
'name' => $params['name'],
'py' => $params['py'],
'dept_id' => $params['dept_id'],
'number' => $params['number'],
'contacts' => $params['contacts'],
'tel' => $params['tel'],
'add' => $params['add'],
'data' => $params['data'],
'more' => $params['more'],
'sort' => $params['sort']
]);
Db::commit();
return true;
} catch (\Exception $e) {
Db::rollback();
self::setError($e->getMessage());
return false;
}
}
/**
* @notes 编辑仓库列表
* @param array $params
* @return bool
* @author likeadmin
* @date 2024/04/23 11:06
*/
public static function edit(array $params): bool
{
Db::startTrans();
try {
Warehouse::where('id', $params['id'])->update([
'name' => $params['name'],
'py' => $params['py'],
'dept_id' => $params['dept_id'],
'number' => $params['number'],
'contacts' => $params['contacts'],
'tel' => $params['tel'],
'add' => $params['add'],
'data' => $params['data'],
'more' => $params['more'],
'sort' => $params['sort']
]);
Db::commit();
return true;
} catch (\Exception $e) {
Db::rollback();
self::setError($e->getMessage());
return false;
}
}
/**
* @notes 删除仓库列表
* @param array $params
* @return bool
* @author likeadmin
* @date 2024/04/23 11:06
*/
public static function delete(array $params): bool
{
return Warehouse::destroy($params['id']);
}
/**
* @notes 获取仓库列表详情
* @param $params
* @return array
* @author likeadmin
* @date 2024/04/23 11:06
*/
public static function detail($params): array
{
return Warehouse::findOrEmpty($params['id'])->toArray();
}
}

View File

@ -0,0 +1,84 @@
<?php
namespace app\admin\validate\customer;
use app\common\validate\BaseValidate;
/**
* 客户管理验证器
* Class CustomerValidate
* @package app\admin\validate\customer
*/
class CustomerValidate extends BaseValidate
{
/**
* 设置校验规则
* @var string[]
*/
protected $rule = [
'id' => 'require',
'name' => 'require',
];
/**
* 参数描述
* @var string[]
*/
protected $field = [
'id' => 'id',
'name' => '客户名称',
];
/**
* @notes 添加场景
* @return CustomerValidate
* @author likeadmin
* @date 2024/04/23 14:44
*/
public function sceneAdd()
{
return $this->only(['name']);
}
/**
* @notes 编辑场景
* @return CustomerValidate
* @author likeadmin
* @date 2024/04/23 14:44
*/
public function sceneEdit()
{
return $this->only(['id','name']);
}
/**
* @notes 删除场景
* @return CustomerValidate
* @author likeadmin
* @date 2024/04/23 14:44
*/
public function sceneDelete()
{
return $this->only(['id']);
}
/**
* @notes 详情场景
* @return CustomerValidate
* @author likeadmin
* @date 2024/04/23 14:44
*/
public function sceneDetail()
{
return $this->only(['id']);
}
}

View File

@ -0,0 +1,84 @@
<?php
namespace app\admin\validate\goods;
use app\common\validate\BaseValidate;
/**
* 商品品牌验证器
* Class BrandValidate
* @package app\admin\validate\goods
*/
class BrandValidate extends BaseValidate
{
/**
* 设置校验规则
* @var string[]
*/
protected $rule = [
'id' => 'require',
'name' => 'require',
];
/**
* 参数描述
* @var string[]
*/
protected $field = [
'id' => 'id',
'name' => '品牌名称',
];
/**
* @notes 添加场景
* @return BrandValidate
* @author likeadmin
* @date 2024/04/23 10:34
*/
public function sceneAdd()
{
return $this->only(['name']);
}
/**
* @notes 编辑场景
* @return BrandValidate
* @author likeadmin
* @date 2024/04/23 10:34
*/
public function sceneEdit()
{
return $this->only(['id','name']);
}
/**
* @notes 删除场景
* @return BrandValidate
* @author likeadmin
* @date 2024/04/23 10:34
*/
public function sceneDelete()
{
return $this->only(['id']);
}
/**
* @notes 详情场景
* @return BrandValidate
* @author likeadmin
* @date 2024/04/23 10:34
*/
public function sceneDetail()
{
return $this->only(['id']);
}
}

View File

@ -0,0 +1,90 @@
<?php
namespace app\admin\validate\goods;
use app\common\validate\BaseValidate;
/**
* 条码管理验证器
* Class CodeValidate
* @package app\admin\validate\goods
*/
class CodeValidate extends BaseValidate
{
/**
* 设置校验规则
* @var string[]
*/
protected $rule = [
'id' => 'require',
'name' => 'require',
'py' => 'require',
'code' => 'require',
'type' => 'require',
];
/**
* 参数描述
* @var string[]
*/
protected $field = [
'id' => 'id',
'name' => '条码名称',
'py' => '拼音信息',
'code' => '条码内容',
'type' => '条码类型0:条形码 | 1:二维码',
];
/**
* @notes 添加场景
* @return CodeValidate
* @author likeadmin
* @date 2024/04/23 10:54
*/
public function sceneAdd()
{
return $this->only(['name','py','code','type']);
}
/**
* @notes 编辑场景
* @return CodeValidate
* @author likeadmin
* @date 2024/04/23 10:54
*/
public function sceneEdit()
{
return $this->only(['id','name','py','code','type']);
}
/**
* @notes 删除场景
* @return CodeValidate
* @author likeadmin
* @date 2024/04/23 10:54
*/
public function sceneDelete()
{
return $this->only(['id']);
}
/**
* @notes 详情场景
* @return CodeValidate
* @author likeadmin
* @date 2024/04/23 10:54
*/
public function sceneDetail()
{
return $this->only(['id']);
}
}

View File

@ -0,0 +1,93 @@
<?php
namespace app\admin\validate\goods;
use app\common\validate\BaseValidate;
/**
* 商品列表验证器
* Class GoodsValidate
* @package app\admin\validate\goods
*/
class GoodsValidate extends BaseValidate
{
/**
* 设置校验规则
* @var string[]
*/
protected $rule = [
'id' => 'require',
'name' => 'require',
'class' => 'require',
'brand' => 'require',
'unit' => 'require',
// 'warehouse' => 'require',
];
/**
* 参数描述
* @var string[]
*/
protected $field = [
'id' => 'id',
'name' => '商品名称',
'py' => '首拼字母',
'class' => '商品分类',
'brand' => '商品品牌',
'unit' => '商品单位',
'warehouse' => '默认仓库',
];
/**
* @notes 添加场景
* @return GoodsValidate
* @author likeadmin
* @date 2024/04/23 11:28
*/
public function sceneAdd()
{
return $this->only(['name','py','class','brand','unit','warehouse']);
}
/**
* @notes 编辑场景
* @return GoodsValidate
* @author likeadmin
* @date 2024/04/23 11:28
*/
public function sceneEdit()
{
return $this->only(['id','name','py','class','brand','unit','warehouse']);
}
/**
* @notes 删除场景
* @return GoodsValidate
* @author likeadmin
* @date 2024/04/23 11:28
*/
public function sceneDelete()
{
return $this->only(['id']);
}
/**
* @notes 详情场景
* @return GoodsValidate
* @author likeadmin
* @date 2024/04/23 11:28
*/
public function sceneDetail()
{
return $this->only(['id']);
}
}

View File

@ -0,0 +1,86 @@
<?php
namespace app\admin\validate\goods;
use app\common\validate\BaseValidate;
/**
* 商品分类验证器
* Class GoodsclassValidate
* @package app\admin\validate\goods
*/
class GoodsclassValidate extends BaseValidate
{
/**
* 设置校验规则
* @var string[]
*/
protected $rule = [
'id' => 'require',
'pid' => 'require',
'name' => 'require',
];
/**
* 参数描述
* @var string[]
*/
protected $field = [
'id' => 'id',
'pid' => '所属ID',
'name' => '分类名称',
];
/**
* @notes 添加场景
* @return GoodsclassValidate
* @author likeadmin
* @date 2024/04/23 10:27
*/
public function sceneAdd()
{
return $this->only(['pid','name']);
}
/**
* @notes 编辑场景
* @return GoodsclassValidate
* @author likeadmin
* @date 2024/04/23 10:27
*/
public function sceneEdit()
{
return $this->only(['id','pid','name']);
}
/**
* @notes 删除场景
* @return GoodsclassValidate
* @author likeadmin
* @date 2024/04/23 10:27
*/
public function sceneDelete()
{
return $this->only(['id']);
}
/**
* @notes 详情场景
* @return GoodsclassValidate
* @author likeadmin
* @date 2024/04/23 10:27
*/
public function sceneDetail()
{
return $this->only(['id']);
}
}

View File

@ -0,0 +1,84 @@
<?php
namespace app\admin\validate\goods;
use app\common\validate\BaseValidate;
/**
* 计量单位验证器
* Class UnitValidate
* @package app\admin\validate\goods
*/
class UnitValidate extends BaseValidate
{
/**
* 设置校验规则
* @var string[]
*/
protected $rule = [
'id' => 'require',
'name' => 'require',
];
/**
* 参数描述
* @var string[]
*/
protected $field = [
'id' => 'id',
'name' => '单位名称',
];
/**
* @notes 添加场景
* @return UnitValidate
* @author likeadmin
* @date 2024/04/23 10:42
*/
public function sceneAdd()
{
return $this->only(['name']);
}
/**
* @notes 编辑场景
* @return UnitValidate
* @author likeadmin
* @date 2024/04/23 10:42
*/
public function sceneEdit()
{
return $this->only(['id','name']);
}
/**
* @notes 删除场景
* @return UnitValidate
* @author likeadmin
* @date 2024/04/23 10:42
*/
public function sceneDelete()
{
return $this->only(['id']);
}
/**
* @notes 详情场景
* @return UnitValidate
* @author likeadmin
* @date 2024/04/23 10:42
*/
public function sceneDetail()
{
return $this->only(['id']);
}
}

View File

@ -0,0 +1,104 @@
<?php
namespace app\admin\validate\merchat;
use app\common\validate\BaseValidate;
/**
* 商户列表验证器
* Class MerchantValidate
* @package app\admin\validate\merchat
*/
class MerchantValidate extends BaseValidate
{
/**
* 设置校验规则
* @var string[]
*/
protected $rule = [
'mer_id' => 'require',
'category_id' => 'require',
'mer_name' => 'require',
'credit_buy' => 'require',
'settle_cycle' => 'require',
'interest_rate' => 'require',
'mer_address' => 'require',
'mark' => 'require',
'sort' => 'require',
'status' => 'require',
'service_phone' => 'require',
'mer_money' => 'require',
];
/**
* 参数描述
* @var string[]
*/
protected $field = [
'mer_id' => 'mer_id',
'category_id' => '商户分类',
'mer_name' => '商户名称',
'credit_buy' => '是否支持先货后款',
'settle_cycle' => '结算周期,单位天',
'interest_rate' => '利率',
'mer_address' => '商户地址',
'mark' => '商户备注',
'sort' => 'sort',
'status' => '商户是否禁用0锁定,1正常',
'service_phone' => '店铺电话',
'mer_money' => '商户余额',
];
/**
* @notes 添加场景
* @return MerchantValidate
* @author likeadmin
* @date 2024/04/23 16:35
*/
public function sceneAdd()
{
return $this->only(['category_id','mer_name','credit_buy','settle_cycle','interest_rate','mer_address','mark','sort','status','service_phone','mer_money']);
}
/**
* @notes 编辑场景
* @return MerchantValidate
* @author likeadmin
* @date 2024/04/23 16:35
*/
public function sceneEdit()
{
return $this->only(['mer_id','category_id','mer_name','credit_buy','settle_cycle','interest_rate','mer_address','mark','sort','status','service_phone','mer_money']);
}
/**
* @notes 删除场景
* @return MerchantValidate
* @author likeadmin
* @date 2024/04/23 16:35
*/
public function sceneDelete()
{
return $this->only(['mer_id']);
}
/**
* @notes 详情场景
* @return MerchantValidate
* @author likeadmin
* @date 2024/04/23 16:35
*/
public function sceneDetail()
{
return $this->only(['mer_id']);
}
}

View File

@ -0,0 +1,84 @@
<?php
namespace app\admin\validate\supplier;
use app\common\validate\BaseValidate;
/**
* 供应商管理验证器
* Class SupplierValidate
* @package app\admin\validate\supplier
*/
class SupplierValidate extends BaseValidate
{
/**
* 设置校验规则
* @var string[]
*/
protected $rule = [
'id' => 'require',
'name' => 'require',
];
/**
* 参数描述
* @var string[]
*/
protected $field = [
'id' => 'id',
'name' => '名称',
];
/**
* @notes 添加场景
* @return SupplierValidate
* @author likeadmin
* @date 2024/04/23 15:56
*/
public function sceneAdd()
{
return $this->only(['name']);
}
/**
* @notes 编辑场景
* @return SupplierValidate
* @author likeadmin
* @date 2024/04/23 15:56
*/
public function sceneEdit()
{
return $this->only(['id','name']);
}
/**
* @notes 删除场景
* @return SupplierValidate
* @author likeadmin
* @date 2024/04/23 15:56
*/
public function sceneDelete()
{
return $this->only(['id']);
}
/**
* @notes 详情场景
* @return SupplierValidate
* @author likeadmin
* @date 2024/04/23 15:56
*/
public function sceneDetail()
{
return $this->only(['id']);
}
}

View File

@ -0,0 +1,86 @@
<?php
namespace app\admin\validate\warehouse;
use app\common\validate\BaseValidate;
/**
* 仓库列表验证器
* Class WarehouseValidate
* @package app\admin\validate\warehouse
*/
class WarehouseValidate extends BaseValidate
{
/**
* 设置校验规则
* @var string[]
*/
protected $rule = [
'id' => 'require',
'name' => 'require',
'py' => 'require',
];
/**
* 参数描述
* @var string[]
*/
protected $field = [
'id' => 'id',
'name' => '仓库名称',
'py' => '首拼信息',
];
/**
* @notes 添加场景
* @return WarehouseValidate
* @author likeadmin
* @date 2024/04/23 11:06
*/
public function sceneAdd()
{
return $this->only(['name','py']);
}
/**
* @notes 编辑场景
* @return WarehouseValidate
* @author likeadmin
* @date 2024/04/23 11:06
*/
public function sceneEdit()
{
return $this->only(['id','name','py']);
}
/**
* @notes 删除场景
* @return WarehouseValidate
* @author likeadmin
* @date 2024/04/23 11:06
*/
public function sceneDelete()
{
return $this->only(['id']);
}
/**
* @notes 详情场景
* @return WarehouseValidate
* @author likeadmin
* @date 2024/04/23 11:06
*/
public function sceneDetail()
{
return $this->only(['id']);
}
}

View File

@ -0,0 +1,22 @@
<?php
namespace app\common\model\customer;
use app\common\model\BaseModel;
use think\model\concern\SoftDelete;
/**
* 客户管理模型
* Class Customer
* @package app\common\model\customer
*/
class Customer extends BaseModel
{
use SoftDelete;
protected $name = 'customer';
protected $deleteTime = 'delete_time';
}

View File

@ -0,0 +1,22 @@
<?php
namespace app\common\model\goods;
use app\common\model\BaseModel;
use think\model\concern\SoftDelete;
/**
* 商品品牌模型
* Class Brand
* @package app\common\model\goods
*/
class Brand extends BaseModel
{
use SoftDelete;
protected $name = 'brand';
protected $deleteTime = 'delete_time';
}

View File

@ -0,0 +1,22 @@
<?php
namespace app\common\model\goods;
use app\common\model\BaseModel;
use think\model\concern\SoftDelete;
/**
* 条码管理模型
* Class Code
* @package app\common\model\goods
*/
class Code extends BaseModel
{
use SoftDelete;
protected $name = 'code';
protected $deleteTime = 'delete_time';
}

View File

@ -0,0 +1,42 @@
<?php
namespace app\common\model\goods;
use app\common\model\BaseModel;
use app\common\model\warehouse\Warehouse;
use think\model\concern\SoftDelete;
/**
* 商品列表模型
* Class Goods
* @package app\common\model\goods
*/
class Goods extends BaseModel
{
use SoftDelete;
protected $name = 'goods';
protected $deleteTime = 'delete_time';
function getDetailsAttr($value)
{
return explode(',',$value);
}
public function className()
{
return $this->hasOne(Goodsclass::class,'id','class')->bind(['class_name'=>'name']);
}
public function brandName()
{
return $this->hasOne(Brand::class,'id','brand')->bind(['brand_name'=>'name']);
}
public function unitName()
{
return $this->hasOne(Unit::class,'id','unit')->bind(['unit_name'=>'name']);
}
public function warehouseName()
{
return $this->hasOne(Warehouse::class,'id','warehouse')->bind(['warehouse_name'=>'name']);
}
}

View File

@ -0,0 +1,22 @@
<?php
namespace app\common\model\goods;
use app\common\model\BaseModel;
use think\model\concern\SoftDelete;
/**
* 商品分类模型
* Class Goodsclass
* @package app\common\model\goods
*/
class Goodsclass extends BaseModel
{
use SoftDelete;
protected $name = 'goodsclass';
protected $deleteTime = 'delete_time';
}

View File

@ -0,0 +1,22 @@
<?php
namespace app\common\model\goods;
use app\common\model\BaseModel;
use think\model\concern\SoftDelete;
/**
* 计量单位模型
* Class Unit
* @package app\common\model\goods
*/
class Unit extends BaseModel
{
use SoftDelete;
protected $name = 'unit';
protected $deleteTime = 'delete_time';
}

View File

@ -0,0 +1,22 @@
<?php
namespace app\common\model\merchat;
use app\common\model\BaseModel;
use think\model\concern\SoftDelete;
/**
* 商户列表模型
* Class Merchant
* @package app\common\model\merchat
*/
class Merchant extends BaseModel
{
use SoftDelete;
protected $name = 'merchant';
protected $deleteTime = 'delete_time';
}

View File

@ -0,0 +1,22 @@
<?php
namespace app\common\model\supplier;
use app\common\model\BaseModel;
use think\model\concern\SoftDelete;
/**
* 供应商管理模型
* Class Supplier
* @package app\common\model\supplier
*/
class Supplier extends BaseModel
{
use SoftDelete;
protected $name = 'supplier';
protected $deleteTime = 'delete_time';
}

View File

@ -0,0 +1,22 @@
<?php
namespace app\common\model\warehouse;
use app\common\model\BaseModel;
use think\model\concern\SoftDelete;
/**
* 仓库列表模型
* Class Warehouse
* @package app\common\model\warehouse
*/
class Warehouse extends BaseModel
{
use SoftDelete;
protected $name = 'warehouse';
protected $deleteTime = 'delete_time';
}

View File

@ -22,6 +22,7 @@ use app\common\service\generator\core\ModelGenerator;
use app\common\service\generator\core\SqlGenerator;
use app\common\service\generator\core\ValidateGenerator;
use app\common\service\generator\core\VueApiGenerator;
use app\common\service\generator\core\VueDetailsGenerator;
use app\common\service\generator\core\VueEditGenerator;
use app\common\service\generator\core\VueIndexGenerator;
use support\Cache;
@ -129,6 +130,7 @@ class GenerateService
VueApiGenerator::class,
VueIndexGenerator::class,
VueEditGenerator::class,
VueDetailsGenerator::class,
SqlGenerator::class,
];
}

View File

@ -0,0 +1,451 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
declare(strict_types=1);
namespace app\common\service\generator\core;
use app\common\enum\GeneratorEnum;
/**
* vue-edit生成器
* Class VueDetailsGenerator
* @package app\common\service\generator\core
*/
class VueDetailsGenerator extends BaseGenerator implements GenerateInterface
{
/**
* @notes 替换变量
* @return mixed|void
* @author 段誉
* @date 2022/6/22 18:19
*/
public function replaceVariables()
{
// 需要替换的变量
$needReplace = [
'{FORM_VIEW}',
'{UPPER_CAMEL_NAME}',
'{DICT_DATA}',
'{DICT_DATA_API}',
'{FORM_DATA}',
'{TABLE_COMMENT}',
'{PK}',
'{API_DIR}',
'{CHECKBOX_JOIN}',
'{CHECKBOX_SPLIT}',
'{FORM_DATE}',
'{SETUP_NAME}',
'{IMPORT_LISTS}',
'{TREE_CONST}',
'{GET_TREE_LISTS}'
];
// 等待替换的内容
$waitReplace = [
$this->getFormViewContent(),
$this->getUpperCamelName(),
$this->getDictDataContent(),
$this->getDictDataApiContent(),
$this->getFormDataContent(),
$this->tableData['table_comment'],
$this->getPkContent(),
$this->getTableName(),
$this->getCheckBoxJoinContent(),
$this->getCheckBoxSplitContent(),
$this->getFormDateContent(),
$this->getLowerCamelName(),
$this->getImportListsContent(),
$this->getTreeConstContent(),
$this->getTreeListsContent(),
];
$templatePath = $this->getTemplatePath('vue/details');
// 替换内容
$content = $this->replaceFileData($needReplace, $waitReplace, $templatePath);
$this->setContent($content);
}
/**
* @notes 复选框处理
* @return string
* @author 段誉
* @date 2022/6/24 19:30
*/
public function getCheckBoxJoinContent()
{
$content = '';
foreach ($this->tableColumn as $column) {
if (empty($column['view_type']) || $column['is_pk']) {
continue;
}
if ($column['view_type'] != 'checkbox') {
continue;
}
$content .= $column['column_name'] . ': formData.' . $column['column_name'] . '.join(",")' . PHP_EOL;
}
if (!empty($content)) {
$content = substr($content, 0, -1);
}
return $content;
}
/**
* @notes 复选框处理
* @return string
* @author 段誉
* @date 2022/6/24 19:30
*/
public function getCheckBoxSplitContent()
{
$content = '';
foreach ($this->tableColumn as $column) {
if (empty($column['view_type']) || $column['is_pk']) {
continue;
}
if ($column['view_type'] != 'checkbox') {
continue;
}
$content .= '//@ts-ignore' . PHP_EOL;
$content .= 'data.' . $column['column_name'] . ' && ' .'(formData.' . $column['column_name'] . ' = String(data.' . $column['column_name'] . ').split(","))' . PHP_EOL;
}
if (!empty($content)) {
$content = substr($content, 0, -1);
}
return $this->setBlankSpace($content, ' ');
}
/**
* @notes 树表contst
* @return string
* @author 段誉
* @date 2022/12/22 18:19
*/
public function getTreeConstContent()
{
$content = "";
if ($this->isTreeCrud()) {
$content = file_get_contents($this->getTemplatePath('vue/other_item/editTreeConst'));
}
return $content;
}
/**
* @notes 获取树表列表
* @return string
* @author 段誉
* @date 2022/12/22 18:26
*/
public function getTreeListsContent()
{
$content = '';
if (!$this->isTreeCrud()) {
return $content;
}
$needReplace = [
'{TREE_ID}',
'{TREE_NAME}',
'{UPPER_CAMEL_NAME}',
];
$waitReplace = [
$this->treeConfig['tree_id'],
$this->treeConfig['tree_name'],
$this->getUpperCamelName(),
];
$templatePath = $this->getTemplatePath('vue/other_item/editTreeLists');
if (file_exists($templatePath)) {
$content = $this->replaceFileData($needReplace, $waitReplace, $templatePath);
}
return $content;
}
/**
* @notes 表单日期处理
* @return string
* @author 段誉
* @date 2022/6/27 16:45
*/
public function getFormDateContent()
{
$content = '';
foreach ($this->tableColumn as $column) {
if (empty($column['view_type']) || $column['is_pk']) {
continue;
}
if ($column['view_type'] != 'datetime' || $column['column_type'] != 'int') {
continue;
}
$content .= '//@ts-ignore' . PHP_EOL;
$content .= 'formData.' . $column['column_name'] . ' = timeFormat(formData.' . $column['column_name'] . ','."'yyyy-mm-dd hh:MM:ss'".') ' . PHP_EOL;
}
if (!empty($content)) {
$content = substr($content, 0, -1);
}
return $this->setBlankSpace($content, ' ');
}
/**
* @notes 获取表单内容
* @return string
* @author 段誉
* @date 2022/6/23 11:57
*/
public function getFormViewContent()
{
$content = '';
foreach ($this->tableColumn as $column) {
if (!$column['is_insert'] || !$column['is_update'] || $column['is_pk']) {
continue;
}
$needReplace = [
'{COLUMN_COMMENT}',
'{COLUMN_NAME}',
'{DICT_TYPE}',
];
$waitReplace = [
$column['column_comment'],
$column['column_name'],
$column['dict_type'],
];
$viewType = $column['view_type'];
if($viewType=='editor'){
$viewType = 'editorView';
}
// 树表,树状结构下拉框
if ($this->isTreeCrud() && $column['column_name'] == $this->treeConfig['tree_pid']) {
$viewType = 'treeSelect';
array_push($needReplace, '{TREE_ID}', '{TREE_NAME}');
array_push($waitReplace, $this->treeConfig['tree_id'], $this->treeConfig['tree_name']);
}
$templatePath = $this->getTemplatePath('vue/form_item/' . $viewType);
if (!file_exists($templatePath)) {
continue;
}
// 单选框值处理
if ($column['view_type'] == 'radio' || $column['view_type'] == 'select') {
$stubItemValue = 'item.value';
$intFieldValue = ['tinyint', 'smallint', 'mediumint', 'int', 'integer', 'bigint'];
if (in_array($column['column_type'], $intFieldValue)) {
$stubItemValue = 'parseInt(item.value)';
}
array_push($needReplace, '{ITEM_VALUE}');
array_push($waitReplace, $stubItemValue);
}
array_push($needReplace, '{READONLY}');
array_push($waitReplace, 'true');
$content .= $this->replaceFileData($needReplace, $waitReplace, $templatePath) . PHP_EOL;
}
if (!empty($content)) {
$content = substr($content, 0, -1);
}
$content = $this->setBlankSpace($content, ' ');
return $content;
}
/**
* @notes 获取字典数据内容
* @return string
* @author 段誉
* @date 2022/6/23 11:58
*/
public function getDictDataContent()
{
$content = '';
$isExist = [];
foreach ($this->tableColumn as $column) {
if (empty($column['dict_type']) || $column['is_pk']) {
continue;
}
if (in_array($column['dict_type'], $isExist)) {
continue;
}
$content .= $column['dict_type'] . ': ' . "[]," . PHP_EOL;
$isExist[] = $column['dict_type'];
}
if (!empty($content)) {
$content = substr($content, 0, -1);
}
return $this->setBlankSpace($content, ' ');
}
/**
* @notes 获取字典数据api内容
* @return false|string
* @author 段誉
* @date 2022/6/23 11:58
*/
public function getDictDataApiContent()
{
$content = '';
$isExist = [];
foreach ($this->tableColumn as $column) {
if (empty($column['dict_type']) || $column['is_pk']) {
continue;
}
if (in_array($column['dict_type'], $isExist)) {
continue;
}
$needReplace = [
'{UPPER_CAMEL_NAME}',
'{DICT_TYPE}',
];
$waitReplace = [
$this->getUpperCamelName(),
$column['dict_type'],
];
$templatePath = $this->getTemplatePath('vue/other_item/dictDataApi');
if (!file_exists($templatePath)) {
continue;
}
$content .= $this->replaceFileData($needReplace, $waitReplace, $templatePath) . '' . PHP_EOL;
$isExist[] = $column['dict_type'];
}
$content = substr($content, 0, -1);
return $content;
}
/**
* @notes 获取表单默认字段内容
* @return string
* @author 段誉
* @date 2022/6/23 15:15
*/
public function getFormDataContent()
{
$content = '';
$isExist = [];
foreach ($this->tableColumn as $column) {
if (!$column['is_insert'] || !$column['is_update'] || $column['is_pk']) {
continue;
}
if (in_array($column['column_name'], $isExist)) {
continue;
}
// 复选框类型返回数组
if ($column['view_type'] == 'checkbox') {
$content .= $column['column_name'] . ': ' . "[]," . PHP_EOL;
} else {
$content .= $column['column_name'] . ': ' . "''," . PHP_EOL;
}
$isExist[] = $column['column_name'];
}
if (!empty($content)) {
$content = substr($content, 0, -1);
}
return $this->setBlankSpace($content, ' ');
}
/**
* @notes 树表时导入列表
* @author 段誉
* @date 2022/12/23 9:56
*/
public function getImportListsContent()
{
$content = "";
if ($this->isTreeCrud()) {
$content = "api". $this->getUpperCamelName(). 'Lists,';
}
if (empty($content)) {
return $content;
}
return $this->setBlankSpace($content, ' ');
}
/**
* @notes 获取文件生成到模块的文件夹路径
* @return mixed|void
* @author 段誉
* @date 2022/6/22 18:19
*/
public function getModuleGenerateDir()
{
$dir = dirname(app_path()) . '/admin/src/views/' . $this->getTableName() . '/';
$this->checkDir($dir);
return $dir;
}
/**
* @notes 获取文件生成到runtime的文件夹路径
* @return string
* @author 段誉
* @date 2022/6/22 18:20
*/
public function getRuntimeGenerateDir()
{
$dir = $this->generatorDir . 'vue/src/views/' . $this->getTableName() . '/';
$this->checkDir($dir);
return $dir;
}
/**
* @notes 生成的文件名
* @return string
* @author 段誉
* @date 2022/6/22 18:20
*/
public function getGenerateName()
{
return 'details.vue';
}
/**
* @notes 文件信息
* @return array
* @author 段誉
* @date 2022/6/23 15:57
*/
public function fileInfo(): array
{
return [
'name' => $this->getGenerateName(),
'type' => 'vue',
'content' => $this->content
];
}
}

View File

@ -257,7 +257,8 @@ class VueEditGenerator extends BaseGenerator implements GenerateInterface
array_push($needReplace, '{ITEM_VALUE}');
array_push($waitReplace, $stubItemValue);
}
array_push($needReplace, '{READONLY}');
array_push($waitReplace, 'false');
$content .= $this->replaceFileData($needReplace, $waitReplace, $templatePath) . PHP_EOL;
}

View File

@ -0,0 +1,77 @@
<template>
<div class="edit-popup">
<popup
ref="popupRef"
:title="popupTitle"
:async="true"
width="550px"
:cancelButtonText="false"
:confirmButtonText="false"
>
<el-form ref="formRef" :model="formData" label-width="90px" :rules="formRules">
{FORM_VIEW}
</el-form>
</popup>
</div>
</template>
<script lang="ts" setup name="{SETUP_NAME}Edit">
import type { FormInstance } from 'element-plus'
import Popup from '@/components/popup/index.vue'
import {{IMPORT_LISTS} api{UPPER_CAMEL_NAME}Add, api{UPPER_CAMEL_NAME}Edit, api{UPPER_CAMEL_NAME}Detail } from '@/api/{API_DIR}'
import { timeFormat } from '@/utils/util'
import type { PropType } from 'vue'
defineProps({
dictData: {
type: Object as PropType<Record<string, any[]>>,
default: () => ({})
}
})
const emit = defineEmits(['success', 'close'])
const formRef = shallowRef<FormInstance>()
const popupRef = shallowRef<InstanceType<typeof Popup>>()
const mode = ref('add')
{TREE_CONST}
// 表单数据
const formData = reactive({
{PK}: '',
{FORM_DATA}
})
// 获取详情
const setFormData = async (data: Record<any, any>) => {
for (const key in formData) {
if (data[key] != null && data[key] != undefined) {
//@ts-ignore
formData[key] = data[key]
}
}
{CHECKBOX_SPLIT}
{FORM_DATE}
}
const getDetail = async (row: Record<string, any>) => {
const data = await api{UPPER_CAMEL_NAME}Detail({
{PK}: row.{PK}
})
setFormData(data)
}
// 关闭回调
const handleClose = () => {
emit('close')
}
{GET_TREE_LISTS}
defineExpose({
open,
setFormData,
getDetail
})
</script>

View File

@ -1,5 +1,5 @@
<el-form-item label="{COLUMN_COMMENT}" prop="{COLUMN_NAME}">
<el-checkbox-group v-model="formData.{COLUMN_NAME}" placeholder="请选择{COLUMN_COMMENT}">
<el-checkbox-group v-model="formData.{COLUMN_NAME}" placeholder="请选择{COLUMN_COMMENT}" :disabled="{READONLY}>
<el-checkbox
v-for="(item, index) in dictData.{DICT_TYPE}"
:key="index"

View File

@ -1,5 +1,6 @@
<el-form-item label="{COLUMN_COMMENT}" prop="{COLUMN_NAME}">
<el-date-picker
:readonly="{READONLY}"
class="flex-1 !flex"
v-model="formData.{COLUMN_NAME}"
clearable

View File

@ -2,5 +2,6 @@
<daterange-picker
v-model:startTime="formData.start_{COLUMN_NAME}"
v-model:endTime="formData.end_{COLUMN_NAME}"
:readonly="{READONLY}"
/>
</el-form-item>

View File

@ -0,0 +1,3 @@
<el-form-item label="{COLUMN_COMMENT}" prop="{COLUMN_NAME}">
<div class="flex-1" v-html="formData.{COLUMN_NAME}" :height="500" />
</el-form-item>

View File

@ -1,3 +1,3 @@
<el-form-item label="{COLUMN_COMMENT}" prop="{COLUMN_NAME}">
<material-picker v-model="formData.{COLUMN_NAME}" />
<material-picker v-model="formData.{COLUMN_NAME}" :disabled="{READONLY}"/>
</el-form-item>

View File

@ -1,3 +1,3 @@
<el-form-item label="{COLUMN_COMMENT}" prop="{COLUMN_NAME}">
<el-input v-model="formData.{COLUMN_NAME}" clearable placeholder="请输入{COLUMN_COMMENT}" />
<el-input v-model="formData.{COLUMN_NAME}" clearable placeholder="请输入{COLUMN_COMMENT}" :readonly="{READONLY}"/>
</el-form-item>

View File

@ -1,5 +1,5 @@
<el-form-item label="{COLUMN_COMMENT}" prop="{COLUMN_NAME}">
<el-radio-group v-model="formData.{COLUMN_NAME}" placeholder="请选择{COLUMN_COMMENT}">
<el-radio-group v-model="formData.{COLUMN_NAME}" placeholder="请选择{COLUMN_COMMENT}" :disabled="{READONLY}">
<el-radio
v-for="(item, index) in dictData.{DICT_TYPE}"
:key="index"

View File

@ -1,5 +1,5 @@
<el-form-item label="{COLUMN_COMMENT}" prop="{COLUMN_NAME}">
<el-select class="flex-1" v-model="formData.{COLUMN_NAME}" clearable placeholder="请选择{COLUMN_COMMENT}">
<el-select class="flex-1" v-model="formData.{COLUMN_NAME}" clearable placeholder="请选择{COLUMN_COMMENT}" :disabled="{READONLY}">
<el-option
v-for="(item, index) in dictData.{DICT_TYPE}"
:key="index"

View File

@ -1,3 +1,3 @@
<el-form-item label="{COLUMN_COMMENT}" prop="{COLUMN_NAME}">
<el-input class="flex-1" v-model="formData.{COLUMN_NAME}" type="textarea" rows="4" clearable placeholder="请输入{COLUMN_COMMENT}" />
<el-input class="flex-1" v-model="formData.{COLUMN_NAME}" type="textarea" rows="4" clearable placeholder="请输入{COLUMN_COMMENT}" :readonly="{READONLY}"/>
</el-form-item>

View File

@ -9,5 +9,6 @@
:default-expand-all="true"
placeholder="请选择{COLUMN_COMMENT}"
check-strictly
:disabled="{READONLY}"
/>
</el-form-item>

View File

@ -1,5 +1,6 @@
<el-form-item label="{COLUMN_COMMENT}" prop="{COLUMN_NAME}">
<el-select class="w-[280px]" v-model="queryParams.{COLUMN_NAME}" clearable placeholder="请选择{COLUMN_COMMENT}">
<el-select
v-model="queryParams.{COLUMN_NAME}" clearable placeholder="请选择{COLUMN_COMMENT}">
<el-option label="全部" value=""></el-option>
<el-option
v-for="(item, index) in dictData.{DICT_TYPE}"

View File

@ -43,8 +43,9 @@
"php-di/php-di": "^6",
"doctrine/annotations": "^1.14",
"illuminate/redis": "^10.22",
"symfony/cache": "^5.4",
"max/var-dumper": "^0.1.1"
"max/var-dumper": "^0.1.1",
"symfony/cache": "^6.4",
"yansongda/pay": "^3.6"
},
"suggest": {
"ext-event": "For better performance. "

797
composer.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -16,7 +16,7 @@ use function DI\env;
return [
'default' => [
'host' => '127.0.0.1',
'password' => 'jhkdjhkjdhsIUTYURTU_xM6ine',
'password' => '',
'port' => 6379,
'database' => 1,
],