更新插件的前台默认的显示页面,控制器的 bool变量名称更新后可以正常显示。
This commit is contained in:
@@ -27,7 +27,7 @@ class Easyflow extends HomeController
|
||||
/**
|
||||
* 鉴权控制器
|
||||
*/
|
||||
public $needLogin = false;
|
||||
public bool $needLogin = false;
|
||||
|
||||
|
||||
/**
|
||||
|
||||
4
plugin/easyflow/data/menu.html
Normal file
4
plugin/easyflow/data/menu.html
Normal file
@@ -0,0 +1,4 @@
|
||||
|
||||
<li class="layui-nav-item">
|
||||
<a class="#" lay-href="/index/easyflow/index">简单工作流插件</a>
|
||||
</li>
|
||||
55
plugin/partmanage/Partmanage.php
Normal file
55
plugin/partmanage/Partmanage.php
Normal file
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
namespace plugin\partmanage;
|
||||
|
||||
use app\PluginController;
|
||||
|
||||
/**
|
||||
* 部件管理插件
|
||||
*/
|
||||
class Partmanage extends PluginController
|
||||
{
|
||||
/**
|
||||
* 插件安装方法
|
||||
* @return bool
|
||||
*/
|
||||
public function install()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 插件卸载方法
|
||||
* @return bool
|
||||
*/
|
||||
public function uninstall()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 插件启用方法
|
||||
* @return bool
|
||||
*/
|
||||
public function enabled()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 插件禁用方法
|
||||
* @return bool
|
||||
*/
|
||||
public function disabled()
|
||||
{
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 插件初始化
|
||||
* @return bool
|
||||
*/
|
||||
public function appInit()
|
||||
{}
|
||||
}
|
||||
29
plugin/partmanage/README.md
Normal file
29
plugin/partmanage/README.md
Normal file
@@ -0,0 +1,29 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | swiftAdmin 极速开发框架 [基于 WebMan 开发]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2020-2099 http://www.swiftadmin.net
|
||||
// +----------------------------------------------------------------------
|
||||
// | swiftAdmin.net High Speed Development Framework
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: meystack <coolsec@foxmail.com> Apache2
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
* app 文件夹下所有文件将复制到根目录
|
||||
|
||||
* public 文件夹下所有文件将复制到根目录
|
||||
|
||||
* Partmanage.php 为插件的核心安装文件,请务必按要求书写代码
|
||||
> 请注意钩子函数为public类型,如需非钩子函数可使用protected类型
|
||||
|
||||
* function.php 为当前插件的函数库文件
|
||||
|
||||
* config.json 为当前插件的配置信息文件
|
||||
|
||||
* config.html 为当前配置模板,存在才会出现配置按钮
|
||||
|
||||
* install.sql 插件的数据库安装文件,不需要可删除!!
|
||||
*
|
||||
* uninstall.sql 插件的数据库卸载文件,不需要可删除!!
|
||||
|
||||
* library 该目录下为第三方类库文件,如果你的类库文件存在命名空间问题,可手动修改或自行实现install方法将第三方类库复制到extend文件夹下!
|
||||
|
||||
21
plugin/partmanage/Upgrade.php
Normal file
21
plugin/partmanage/Upgrade.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace plugin\partmanage;
|
||||
|
||||
/**
|
||||
* 部件管理插件
|
||||
*/
|
||||
class Upgrade
|
||||
{
|
||||
/**
|
||||
* 插件升级方法
|
||||
* @access public
|
||||
* @param $oldVersion
|
||||
* @param $newVersion
|
||||
* @return bool
|
||||
*/
|
||||
public function execute($oldVersion, $newVersion): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
33
plugin/partmanage/app/admin/controller/partmanage/Index.php
Normal file
33
plugin/partmanage/app/admin/controller/partmanage/Index.php
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
declare(strict_types = 1);
|
||||
|
||||
namespace app\admin\controller\partmanage;
|
||||
use app\AdminController;
|
||||
use support\Response;
|
||||
|
||||
/**
|
||||
* 部件管理后台控制器
|
||||
* <!--Partmanage-->
|
||||
*/
|
||||
class Index extends AdminController {
|
||||
|
||||
// 初始化函数
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
/**
|
||||
* TODO...
|
||||
*/
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化后台首页
|
||||
* @return Response
|
||||
*/
|
||||
public function index(): Response
|
||||
{
|
||||
echo '后台 部件管理 控制器<br/>';
|
||||
return $this->view();
|
||||
}
|
||||
|
||||
}
|
||||
35
plugin/partmanage/app/admin/model/partmanage/Partmanage.php
Normal file
35
plugin/partmanage/app/admin/model/partmanage/Partmanage.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
declare (strict_types = 1);
|
||||
|
||||
namespace app\admin\model\partmanage;
|
||||
|
||||
use think\Model;
|
||||
/**
|
||||
* 部件管理模型类
|
||||
* <!--Partmanage-->
|
||||
* @mixin Model
|
||||
*/
|
||||
class Partmanage 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;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\validate\partmanage;
|
||||
|
||||
use think\Validate;
|
||||
/**
|
||||
* 部件管理 验证器
|
||||
* <!--Partmanage-->
|
||||
*/
|
||||
class Partmanage extends Validate
|
||||
{
|
||||
/**
|
||||
* 验证规则
|
||||
*/
|
||||
protected $rule = [
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* 提示消息
|
||||
*/
|
||||
protected $message = [
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* 验证场景
|
||||
*/
|
||||
protected $scene = [
|
||||
'add' => [],
|
||||
'edit' => [],
|
||||
];
|
||||
|
||||
}
|
||||
13
plugin/partmanage/app/admin/view/partmanage/index/index.html
Normal file
13
plugin/partmanage/app/admin/view/partmanage/index/index.html
Normal file
@@ -0,0 +1,13 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>我是后台首页控制器模板</title>
|
||||
</head>
|
||||
<!--Partmanage-->
|
||||
<body>
|
||||
我是 Partmanage 控制器模板
|
||||
</body>
|
||||
</html>
|
||||
55
plugin/partmanage/app/index/controller/Partmanage.php
Normal file
55
plugin/partmanage/app/index/controller/Partmanage.php
Normal file
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
declare (strict_types = 1);
|
||||
// +----------------------------------------------------------------------
|
||||
// | swiftAdmin 极速开发框架 [基于 WebMan 开发]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2020-2099 http://www.swiftadmin.net
|
||||
// +----------------------------------------------------------------------
|
||||
// | swiftAdmin.net High Speed Development Framework
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: meystack <coolsec@foxmail.com> Apache2
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\index\controller;
|
||||
|
||||
use app\HomeController;
|
||||
use support\Response;
|
||||
|
||||
/**
|
||||
* 首页控制器
|
||||
* <!--Partmanage-->
|
||||
* Class Index
|
||||
* @package app\index\controller
|
||||
*/
|
||||
class Partmanage extends HomeController
|
||||
{
|
||||
|
||||
/**
|
||||
* 鉴权控制器
|
||||
*/
|
||||
public bool $needLogin = false;
|
||||
|
||||
|
||||
/**
|
||||
* 非鉴权方法
|
||||
* @var array
|
||||
*/
|
||||
public $noNeedAuth = ['index', 'home'];
|
||||
|
||||
// 初始化函数
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
* Partmanage 首页
|
||||
* @return Response
|
||||
* @throws InvalidArgumentException
|
||||
*/
|
||||
public function index(): Response
|
||||
{
|
||||
return response('Partmanage 前台首页模板');
|
||||
}
|
||||
|
||||
}
|
||||
22
plugin/partmanage/app/index/view/partmanage/index.html
Normal file
22
plugin/partmanage/app/index/view/partmanage/index.html
Normal file
@@ -0,0 +1,22 @@
|
||||
<!--Partmanage-->
|
||||
<layout name="layout:layout"/>
|
||||
<!-- 内容主体区域 -->
|
||||
<div id="content">
|
||||
<div class="layui-card">
|
||||
<div class="layui-card-body"> 示例页面 TODO...</div>
|
||||
<!-- // 创建数据实例 -->
|
||||
<table id="lay-tableList" lay-filter="lay-tableList"></table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- // 列表工具栏 -->
|
||||
<script type="text/html" id="tableBar">
|
||||
<!-- // TODO-->
|
||||
</script>
|
||||
|
||||
<script>
|
||||
layui.use(['table','jquery'], function () {
|
||||
let $ = layui.jquery;
|
||||
let table = layui.table;
|
||||
})
|
||||
</script>
|
||||
88
plugin/partmanage/config.html
Normal file
88
plugin/partmanage/config.html
Normal file
@@ -0,0 +1,88 @@
|
||||
<include file="/public/header" />
|
||||
<link rel="stylesheet" type="text/css" href="__STATICADMIN__css/plugin.css?v={:release()}">
|
||||
<!-- // 重定位style -->
|
||||
<style>
|
||||
body {
|
||||
background: #fff;
|
||||
}
|
||||
</style>
|
||||
<div class="layui-fluid">
|
||||
<form action="{:url('/system/Plugin/config')}" class="layui-form layui-form-fixed" >
|
||||
<input type="text" name="name" value="Partmanage" hidden="">
|
||||
<blockquote class="layui-elem-quote">配置项提示信息 TODO...</blockquote>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">{:__('配置项')}</label>
|
||||
<div class="layui-input-block">
|
||||
<input name="extends[title]"
|
||||
type="text" class="layui-input"
|
||||
value="{$config.extends.title}"
|
||||
lay-verType="tips" lay-verify="required"
|
||||
placeholder="{:__('请填写配置项')}"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<blockquote class="layui-elem-quote">{:__('伪静态规则')}</blockquote>
|
||||
<div class="layui-card">
|
||||
<table class="layui-table" lay-skin="nob">
|
||||
<colgroup>
|
||||
<col width="100">
|
||||
<col width="200">
|
||||
<col width="100">
|
||||
</colgroup>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>变量名</th>
|
||||
<th>变量值</th>
|
||||
<th>操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="layui-variable-content">
|
||||
<volist name="$config['rewrite']" id="vo">
|
||||
<tr>
|
||||
<td><input type="text" value="{$key}" class="layui-input layui-variable-key" lay-verType="tips" lay-verify="required" ></td>
|
||||
<td><input type="text" name="rewrite[{$key}]" value="{$vo}" class="layui-input layui-variable-value"></td>
|
||||
<td><button type="button" class="layui-btn layui-btn-primary layui-btn-xs"><i class="layui-icon layui-icon-delete"></i></button></td>
|
||||
</tr>
|
||||
</volist>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<button type="button" class="layui-btn layui-btn-sm layui-variable-add" >{:__('增加变量')}</button>
|
||||
</div>
|
||||
<div class="layui-footer layui-form-item layui-center ">
|
||||
<button class="layui-btn layui-btn-primary" type="button" sa-event="closeDialog">{:__('取消')}</button>
|
||||
<button class="layui-btn" lay-filter="submitIframe" lay-submit>{:__('提交')}</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<include file="/public/footer" />
|
||||
|
||||
<script>
|
||||
layui.use(['layer', 'admin'], function () {
|
||||
var $ = layui.jquery;
|
||||
var admin = layui.admin;
|
||||
|
||||
// 增加变量
|
||||
$('.layui-variable-add').on('click',function(){
|
||||
var html = '<tr>';
|
||||
html += '<td><input type="text" class="layui-input layui-variable-key" lay-verType="tips" lay-verify="required" ><\/td>';
|
||||
html += '<td><input type="text" class="layui-input layui-variable-value"><\/td>';
|
||||
html += '<td><button type="button" class="layui-btn layui-btn-primary layui-btn-xs"><i class="layui-icon layui-icon-delete"><\/i><\/button><\/td>';
|
||||
html += '<\/tr>';
|
||||
$('#layui-variable-content').append(html);
|
||||
})
|
||||
|
||||
// 改变表单值
|
||||
$('body').on('change','.layui-variable-key',function() {
|
||||
var that = $(this),
|
||||
name = 'rewrite['+ that.val() +']';
|
||||
$(that).parents('tr').find('.layui-variable-value').attr('name',name);
|
||||
})
|
||||
|
||||
// 删除自定义变量
|
||||
$('body').on('click','#layui-variable-content .layui-btn',function() {
|
||||
$(this).parents('tr').remove();
|
||||
})
|
||||
});
|
||||
</script>
|
||||
21
plugin/partmanage/config.json
Normal file
21
plugin/partmanage/config.json
Normal file
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"name": "partmanage",
|
||||
"title": "部件管理",
|
||||
"intro": "部件管理",
|
||||
"icon": "fa-home",
|
||||
"author": "Panjz",
|
||||
"home": "\/partmanage\/index",
|
||||
"version": "1.0.1",
|
||||
"config": 1,
|
||||
"menu": 1,
|
||||
"import": 0,
|
||||
"rewrite": [],
|
||||
"extends": {
|
||||
"title": "部件管理"
|
||||
},
|
||||
"area": [
|
||||
"600px",
|
||||
"650px"
|
||||
],
|
||||
"status": 1
|
||||
}
|
||||
4
plugin/partmanage/data/menu.html
Normal file
4
plugin/partmanage/data/menu.html
Normal file
@@ -0,0 +1,4 @@
|
||||
|
||||
<li class="layui-nav-item">
|
||||
<a class="#" lay-href="/index/partmanage/index">物料管理插件</a>
|
||||
</li>
|
||||
47
plugin/partmanage/data/menu.php
Normal file
47
plugin/partmanage/data/menu.php
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
return [
|
||||
0 => [
|
||||
'title' => '部件管理',
|
||||
'router' => '/partmanage/Index',
|
||||
'icon' => 'fa-home',
|
||||
'auth' => 1,
|
||||
'type' => 0,
|
||||
'children' => [
|
||||
0 => [
|
||||
'title' => '查看',
|
||||
'router' => '/partmanage/Index/index',
|
||||
'icon' => NULL,
|
||||
'auth' => 1,
|
||||
'type' => 1,
|
||||
],
|
||||
1 => [
|
||||
'title' => '添加',
|
||||
'router' => '/partmanage/Index/add',
|
||||
'icon' => NULL,
|
||||
'auth' => 1,
|
||||
'type' => 1,
|
||||
],
|
||||
2 => [
|
||||
'title' => '编辑',
|
||||
'router' => '/partmanage/Index/edit',
|
||||
'icon' => NULL,
|
||||
'auth' => 1,
|
||||
'type' => 1,
|
||||
],
|
||||
3 => [
|
||||
'title' => '删除',
|
||||
'router' => '/partmanage/Index/del',
|
||||
'icon' => NULL,
|
||||
'auth' => 1,
|
||||
'type' => 1,
|
||||
],
|
||||
4 => [
|
||||
'title' => '状态',
|
||||
'router' => '/partmanage/Index/status',
|
||||
'icon' => NULL,
|
||||
'auth' => 1,
|
||||
'type' => 1,
|
||||
],
|
||||
],
|
||||
],
|
||||
];
|
||||
16
plugin/partmanage/function.php
Normal file
16
plugin/partmanage/function.php
Normal file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Partmanage插件公共函数库
|
||||
*/
|
||||
|
||||
if (!function_exists('format_time')) {
|
||||
/*
|
||||
* 格式化时间戳
|
||||
*/
|
||||
function format_time()
|
||||
{
|
||||
return date('Y-m-d H:i:s', time());
|
||||
}
|
||||
}
|
||||
|
||||
24
plugin/partmanage/install.sql
Normal file
24
plugin/partmanage/install.sql
Normal file
@@ -0,0 +1,24 @@
|
||||
/*
|
||||
Navicat Premium Data Transfer
|
||||
|
||||
Source Server : database
|
||||
Source Server Type : MySQL
|
||||
Source Server Version : 50737
|
||||
Source Host : 127.0.0.1:3306
|
||||
Source Schema : database
|
||||
|
||||
Target Server Type : MySQL
|
||||
Target Server Version : 50737
|
||||
File Encoding : 65001
|
||||
|
||||
Date: 01/01/2022 00:00:00
|
||||
*/
|
||||
|
||||
SET NAMES utf8mb4;
|
||||
SET FOREIGN_KEY_CHECKS = 0;
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for __PREFIX__TABLE
|
||||
-- ----------------------------
|
||||
|
||||
SET FOREIGN_KEY_CHECKS = 1;
|
||||
@@ -0,0 +1 @@
|
||||
// 前端JS文件
|
||||
@@ -0,0 +1 @@
|
||||
// 后端JS文件
|
||||
0
plugin/partmanage/uninstall.sql
Normal file
0
plugin/partmanage/uninstall.sql
Normal file
Reference in New Issue
Block a user