This commit is contained in:
xman 2025-04-21 16:29:25 +08:00
parent 68f869f0bb
commit c55bdf99b7
14 changed files with 2525 additions and 4 deletions

1
addons/editable/.addonrc Normal file
View File

@ -0,0 +1 @@
{"files":["public\/assets\/addons\/editable\/css\/bootstrap-editable.css","public\/assets\/addons\/editable\/img\/clear.png","public\/assets\/addons\/editable\/img\/loading.gif","public\/assets\/addons\/editable\/js\/bootstrap-editable.min.js","public\/assets\/addons\/editable\/less\/bootstrap-editable.less"],"license":"regular","licenseto":"15976","licensekey":"sQBJOrTzvke89ZHK TKQknw3vTsKKB6lZzEFy1A==","domains":["fast.cc"],"licensecodes":[],"validations":["043c5318e9fc4870124f0d65db900fc1"]}

View File

@ -0,0 +1,54 @@
<?php
namespace addons\editable;
use app\common\library\Menu;
use think\Addons;
/**
* 插件
*/
class Editable extends Addons
{
/**
* 插件安装方法
* @return bool
*/
public function install()
{
return true;
}
/**
* 插件卸载方法
* @return bool
*/
public function uninstall()
{
return true;
}
/**
* 插件启用方法
* @return bool
*/
public function enable()
{
return true;
}
/**
* 插件禁用方法
* @return bool
*/
public function disable()
{
return true;
}
}

26
addons/editable/bootstrap.js vendored Normal file
View File

@ -0,0 +1,26 @@
require.config({
paths: {
'editable': '../libs/bootstrap-table/dist/extensions/editable/bootstrap-table-editable.min',
'x-editable': '../addons/editable/js/bootstrap-editable.min',
},
shim: {
'editable': {
deps: ['x-editable', 'bootstrap-table']
},
"x-editable": {
deps: ["css!../addons/editable/css/bootstrap-editable.css"],
}
}
});
if ($("table.table").length > 0) {
require(['editable', 'table'], function (Editable, Table) {
$.fn.bootstrapTable.defaults.onEditableSave = function (field, row, oldValue, $el) {
var data = {};
data["row[" + field + "]"] = row[field];
Fast.api.ajax({
url: this.extend.edit_url + "/ids/" + row[this.pk],
data: data
});
};
});
}

View File

@ -0,0 +1,5 @@
<?php
return [
];

View File

@ -0,0 +1,15 @@
<?php
namespace addons\editable\controller;
use think\addons\Controller;
class Index extends Controller
{
public function index()
{
$this->error("当前插件暂无前台页面");
}
}

10
addons/editable/info.ini Normal file
View File

@ -0,0 +1,10 @@
name = editable
title = 无刷新表格行内编辑
intro = 基于x-editable的无刷新表格行内编辑
author = FastAdmin
website = https://www.fastadmin.net
version = 1.0.2
state = 1
url = http://fast.cc:8088/addons/editable
license = regular
licenseto = 15976

View File

@ -3,8 +3,8 @@ return [
'connector' => 'Redis', // Redis 驱动 'connector' => 'Redis', // Redis 驱动
'expire' => 0, // 任务的过期时间默认为60秒; 若要禁用,则设置为 null 'expire' => 0, // 任务的过期时间默认为60秒; 若要禁用,则设置为 null
'default' => 'default', // 默认的队列名称 'default' => 'default', // 默认的队列名称
'host' => '127.0.0.1', // redis 主机ip 'host' => \think\Env::get('redis.redis_host'), // redis 主机ip
'port' => 6379, // redis 端口 'port' => \think\Env::get('redis.redis_host'), // redis 端口
'password' => '', // redis 密码 'password' => '', // redis 密码
'select' => 0, // 使用哪一个 db默认为 db0 'select' => 0, // 使用哪一个 db默认为 db0
'timeout' => 0, // redis连接的超时时间 'timeout' => 0, // redis连接的超时时间

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 509 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

View File

@ -312,6 +312,33 @@ require(['fast', 'layer'], function (Fast, Layer) {
} }
} }
}); });
require.config({
paths: {
'editable': '../libs/bootstrap-table/dist/extensions/editable/bootstrap-table-editable.min',
'x-editable': '../addons/editable/js/bootstrap-editable.min',
},
shim: {
'editable': {
deps: ['x-editable', 'bootstrap-table']
},
"x-editable": {
deps: ["css!../addons/editable/css/bootstrap-editable.css"],
}
}
});
if ($("table.table").length > 0) {
require(['editable', 'table'], function (Editable, Table) {
$.fn.bootstrapTable.defaults.onEditableSave = function (field, row, oldValue, $el) {
var data = {};
data["row[" + field + "]"] = row[field];
Fast.api.ajax({
url: this.extend.edit_url + "/ids/" + row[this.pk],
data: data
});
};
});
}
require.config({ require.config({
paths: { paths: {
'nkeditor': '../addons/nkeditor/js/customplugin', 'nkeditor': '../addons/nkeditor/js/customplugin',

View File

@ -1,4 +1,4 @@
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) { define(['jquery', 'bootstrap', 'backend', 'table', 'form','editable'], function ($, undefined, Backend, Table, Form) {
var Controller = { var Controller = {
index: function () { index: function () {
@ -29,9 +29,19 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
// {checkbox: true}, // {checkbox: true},
{field: 'id', title: __('Id')}, {field: 'id', title: __('Id')},
{field: 'type', title: '种类',formatter: function ($val) { {field: 'type', title: '种类',formatter: function ($val) {
if($val === 1){
return '订单报错';
}
if($val === 2){
return '取消订单';
}
if($val === 3){
return '取消派单'
}
return $val === 1 ? '异常类型' : '取消类型'; return $val === 1 ? '异常类型' : '取消类型';
}}, }},
{field: 'title', title: __('Title'), operate: 'LIKE'}, {field: 'title', title: __('Title'), operate: 'LIKE',editable:true},
{field: 'sort', title: __('Sort'),sortable:true}, {field: 'sort', title: __('Sort'),sortable:true},
{field: 'operate', title: __('Operate'), table: table, {field: 'operate', title: __('Operate'), table: table,
buttons:[ buttons:[