自定义表单bug修复

This commit is contained in:
2017-10-04 10:14:28 +08:00
parent 679f2e9310
commit ef5d7747aa
3 changed files with 66 additions and 2 deletions

View File

@@ -533,6 +533,17 @@ function list_to_tree($list, $pk = 'id', $pid = 'pid', $child = '_child', $root
return $tree;
}
/**
* 获取父树列表
*
*/
function get_parent_tree($id = ''){
if ($id) {
return array();
}
}
/**
* 将list_to_tree的树还原成列表
* @param array $tree 原来的树

View File

@@ -15,15 +15,26 @@ namespace app\common\validate;
class Form extends Base {
protected $rule = array(
'title' => 'require',
'name' => 'require|unique:form|/^[a-zA-Z]\w{0,39}$/',
'name' => 'require|checkTable|unique:form|/^[a-zA-Z]\w{0,39}$/',
);
protected $message = array(
'title.require' => '字段标题不能为空!',
'name.checkTable' => '数据库中有此表',
);
protected $scene = array(
'add' => 'title',
'add' => 'title, name',
'edit' => 'title'
);
protected function checkTable($value, $rule, $data){
$tablename = 'form_' . strtolower($value);
$db = new \com\Datatable();
if (!$db->CheckTable($tablename)) {
return true;
}else{
return false;
}
}
}

View File

@@ -1060,12 +1060,44 @@ CREATE TABLE `sent_form` (
`id` int(10) UNSIGNED NOT NULL COMMENT '文件ID',
`title` varchar(200) NOT NULL DEFAULT '' COMMENT '表单名称',
`name` varchar(100) NOT NULL DEFAULT '' COMMENT '表单标识',
`status` tinyint(1) NOT NULL DEFAULT '1' COMMENT '状态',
`create_time` int(10) UNSIGNED NOT NULL DEFAULT '0' COMMENT '创建时间',
`update_time` int(10) UNSIGNED NOT NULL DEFAULT '0' COMMENT '更新时间'
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='自定义表单';
-- --------------------------------------------------------
--
-- 表的结构 `sent_form_attr`
--
DROP TABLE IF EXISTS `sent_form_attr`;
CREATE TABLE `sent_form_attr` (
`id` int(10) UNSIGNED NOT NULL,
`name` varchar(30) NOT NULL DEFAULT '' COMMENT '字段名',
`title` varchar(100) NOT NULL DEFAULT '' COMMENT '字段注释',
`length` varchar(100) NOT NULL DEFAULT '' COMMENT '字段定义',
`type` varchar(20) NOT NULL DEFAULT '' COMMENT '数据类型',
`value` varchar(100) NOT NULL DEFAULT '' COMMENT '字段默认值',
`remark` varchar(100) NOT NULL DEFAULT '' COMMENT '备注',
`extra` varchar(255) NOT NULL DEFAULT '' COMMENT '参数',
`form_id` int(11) NOT NULL COMMENT '所属模型',
`is_show` int(11) NOT NULL DEFAULT '1' COMMENT '是否显示',
`is_must` int(11) NOT NULL DEFAULT '0' COMMENT '是否必填',
`group_id` int(11) NOT NULL DEFAULT '1' COMMENT '分组',
`sort` int(11) NOT NULL DEFAULT '0' COMMENT '排序',
`status` tinyint(2) NOT NULL DEFAULT '0' COMMENT '状态',
`update_time` int(11) UNSIGNED NOT NULL DEFAULT '0' COMMENT '更新时间',
`create_time` int(11) UNSIGNED NOT NULL DEFAULT '0' COMMENT '创建时间',
`validate_rule` varchar(255) NOT NULL DEFAULT '',
`validate_time` tinyint(1) UNSIGNED NOT NULL DEFAULT '0',
`error_info` varchar(100) NOT NULL DEFAULT '',
`validate_type` varchar(25) NOT NULL DEFAULT '',
`auto_rule` varchar(100) NOT NULL DEFAULT '',
`auto_time` tinyint(1) UNSIGNED NOT NULL DEFAULT '0',
`auto_type` varchar(25) NOT NULL DEFAULT ''
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='模型属性表';
-- --------------------------------------------------------
--
-- 表的结构 `sent_hooks`
--
@@ -1499,6 +1531,11 @@ ALTER TABLE `sent_file`
--
ALTER TABLE `sent_form`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `sent_attribute`
--
ALTER TABLE `sent_form_attr`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `sent_hooks`
@@ -1655,6 +1692,11 @@ ALTER TABLE `sent_file`
ALTER TABLE `sent_form`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '标识ID';
--
-- 使用表AUTO_INCREMENT `sent_attribute`
--
ALTER TABLE `sent_form_attr`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=1;
--
-- 使用表AUTO_INCREMENT `sent_hooks`
--
ALTER TABLE `sent_hooks`