作者 黄张义

更新附件

... ... @@ -9,3 +9,14 @@ username = root
password = root
hostport = 3306
prefix = fa_
[queue]
'connector' => 'Redis', // Redis 驱动
'expire' => 0, // 任务的过期时间,默认为60秒; 若要禁用,则设置为 null
'default' => 'default', // 默认的队列名称
'host' => '127.0.0.1', // redis 主机ip
'port' => 6379, // redis 端口
'password' => '', // redis 密码
'select' => 0, // 使用哪一个 db,默认为 db0
'timeout' => 0, // redis连接的超时时间
'persistent' => false,
\ No newline at end of file
... ...
<?php
namespace addons\command;
use app\common\library\Menu;
use think\Addons;
/**
* 在线命令插件
*/
class Command extends Addons
{
/**
* 插件安装方法
* @return bool
*/
public function install()
{
$menu = [
[
'name' => 'command',
'title' => '在线命令管理',
'icon' => 'fa fa-terminal',
'sublist' => [
['name' => 'command/index', 'title' => '查看'],
['name' => 'command/add', 'title' => '添加'],
['name' => 'command/detail', 'title' => '详情'],
['name' => 'command/command', 'title' => '生成并执行命令'],
['name' => 'command/execute', 'title' => '再次执行命令'],
['name' => 'command/del', 'title' => '删除'],
['name' => 'command/multi', 'title' => '批量更新'],
]
]
];
Menu::create($menu);
return true;
}
/**
* 插件卸载方法
* @return bool
*/
public function uninstall()
{
Menu::delete('command');
return true;
}
/**
* 插件启用方法
* @return bool
*/
public function enable()
{
Menu::enable('command');
return true;
}
/**
* 插件禁用方法
* @return bool
*/
public function disable()
{
Menu::disable('command');
return true;
}
}
... ...
<?php
return [
];
... ...
<?php
namespace addons\command\controller;
use think\addons\Controller;
class Index extends Controller
{
public function index()
{
$this->error("当前插件暂无前台页面");
}
}
... ...
name = command
title = 在线命令
intro = 可在线执行一键生成CRUD、一键生成菜单等相关命令
author = FastAdmin
website = https://www.fastadmin.net
version = 1.1.2
state = 1
url = /addons/command
license = regular
licenseto = 10789
... ...
CREATE TABLE IF NOT EXISTS `__PREFIX__command` (
`id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'ID',
`type` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '类型',
`params` varchar(1500) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '参数',
`command` varchar(1500) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '命令',
`content` text COMMENT '返回结果',
`executetime` bigint(16) UNSIGNED DEFAULT NULL COMMENT '执行时间',
`createtime` bigint(16) UNSIGNED DEFAULT NULL COMMENT '创建时间',
`updatetime` bigint(16) UNSIGNED DEFAULT NULL COMMENT '更新时间',
`status` enum('successed','failured') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT 'failured' COMMENT '状态',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '在线命令表';
... ...
<?php
namespace addons\command\library;
/**
* Class Output
*/
class Output extends \think\console\Output
{
protected $message = [];
public function __construct($driver = 'console')
{
parent::__construct($driver);
}
protected function block($style, $message)
{
$this->message[] = $message;
}
public function getMessage()
{
return $this->message;
}
}
... ...
... ... @@ -59,7 +59,8 @@ return array(
})',
"extend" => 'data-source="facrm/common/selectpage/model/admin?type=all" data-field="nickname" data-orderBy="id desc"',
),
array("field" => 'attachfiles', "title" => "附件", "operate" => 'LIKE', "formatter" => 'Table.api.formatter.files'),
array("field" => 'smallimages', "title" => "图片", "operate" => 'LIKE', "formatter" => 'Table.api.formatter.images'),
array("field" => 'create_time', "title" => '创建时间', "operate" => "RANGE", "sortable" => true, "formatter" => "Table.api.formatter.datetime", "addclass" => "datetimerange", "extend" => 'autocomplete="off" data-time-picker="true"'),
array("field" => 'check_status', "title" => '状态', "formatter" => "Table.api.formatter.status", "searchList" => 'check_status'),
... ...
<?php
namespace app\admin\controller;
use app\common\controller\Backend;
use think\Config;
use think\console\Input;
use think\Db;
use think\Exception;
/**
* 在线命令管理
*
* @icon fa fa-circle-o
*/
class Command extends Backend
{
/**
* Command模型对象
*/
protected $model = null;
protected $noNeedRight = ['get_controller_list', 'get_field_list'];
public function _initialize()
{
parent::_initialize();
$this->model = new \app\admin\model\Command;
$this->view->assign("statusList", $this->model->getStatusList());
}
/**
* 添加
*/
public function add()
{
$tableList = [];
$list = \think\Db::query("SHOW TABLES");
foreach ($list as $key => $row) {
$tableList[reset($row)] = reset($row);
}
$this->view->assign("tableList", $tableList);
return $this->view->fetch();
}
/**
* 获取字段列表
* @internal
*/
public function get_field_list()
{
$dbname = Config::get('database.database');
$prefix = Config::get('database.prefix');
$table = $this->request->request('table');
//从数据库中获取表字段信息
$sql = "SELECT * FROM `information_schema`.`columns` "
. "WHERE TABLE_SCHEMA = ? AND table_name = ? "
. "ORDER BY ORDINAL_POSITION";
//加载主表的列
$columnList = Db::query($sql, [$dbname, $table]);
$fieldlist = [];
foreach ($columnList as $index => $item) {
$fieldlist[] = $item['COLUMN_NAME'];
}
$this->success("", null, ['fieldlist' => $fieldlist]);
}
/**
* 获取控制器列表
* @internal
*/
public function get_controller_list()
{
//搜索关键词,客户端输入以空格分开,这里接收为数组
$word = (array)$this->request->request("q_word/a");
$word = implode('', $word);
$adminPath = dirname(__DIR__) . DS;
$controllerDir = $adminPath . 'controller' . DS;
$files = new \RecursiveIteratorIterator(
new \RecursiveDirectoryIterator($controllerDir), \RecursiveIteratorIterator::LEAVES_ONLY
);
$list = [];
foreach ($files as $name => $file) {
if (!$file->isDir()) {
$filePath = $file->getRealPath();
$name = str_replace($controllerDir, '', $filePath);
$name = str_replace(DS, "/", $name);
if (!preg_match("/(.*)\.php\$/", $name)) {
continue;
}
if (!$word || stripos($name, $word) !== false) {
$list[] = ['id' => $name, 'name' => $name];
}
}
}
$pageNumber = $this->request->request("pageNumber");
$pageSize = $this->request->request("pageSize");
return json(['list' => array_slice($list, ($pageNumber - 1) * $pageSize, $pageSize), 'total' => count($list)]);
}
/**
* 详情
*/
public function detail($ids)
{
$row = $this->model->get($ids);
if (!$row) {
$this->error(__('No Results were found'));
}
$this->view->assign("row", $row);
return $this->view->fetch();
}
/**
* 执行
*/
public function execute($ids)
{
$row = $this->model->get($ids);
if (!$row) {
$this->error(__('No Results were found'));
}
$result = $this->doexecute($row['type'], json_decode($row['params'], true));
$this->success("", null, ['result' => $result]);
}
/**
* 生成命令
*/
public function command($action = '')
{
$commandtype = $this->request->request("commandtype");
$params = $this->request->request();
$allowfields = [
'crud' => 'table,controller,model,fields,force,local,delete,menu',
'menu' => 'controller,delete,force',
'min' => 'module,resource,optimize',
'api' => 'url,module,output,template,force,title,author,class,language,addon',
];
$argv = [];
$allowfields = isset($allowfields[$commandtype]) ? explode(',', $allowfields[$commandtype]) : [];
$allowfields = array_filter(array_intersect_key($params, array_flip($allowfields)));
if (isset($params['local']) && !$params['local']) {
$allowfields['local'] = $params['local'];
} else {
unset($allowfields['local']);
}
foreach ($allowfields as $key => $param) {
$argv[] = "--{$key}=" . (is_array($param) ? implode(',', $param) : $param);
}
if ($commandtype == 'crud') {
$extend = 'setcheckboxsuffix,enumradiosuffix,imagefield,filefield,intdatesuffix,switchsuffix,citysuffix,selectpagesuffix,selectpagessuffix,ignorefields,sortfield,editorsuffix,headingfilterfield,tagsuffix,jsonsuffix,fixedcolumns';
$extendArr = explode(',', $extend);
foreach ($params as $index => $item) {
if (in_array($index, $extendArr)) {
foreach (explode(',', $item) as $key => $value) {
if ($value) {
$argv[] = "--{$index}={$value}";
}
}
}
}
$isrelation = (int)$this->request->request('isrelation');
if ($isrelation && isset($params['relation'])) {
foreach ($params['relation'] as $index => $relation) {
foreach ($relation as $key => $value) {
$argv[] = "--{$key}=" . (is_array($value) ? implode(',', $value) : $value);
}
}
}
} else {
if ($commandtype == 'menu') {
if (isset($params['allcontroller']) && $params['allcontroller']) {
$argv[] = "--controller=all-controller";
} else {
foreach (explode(',', $params['controllerfile']) as $index => $param) {
if ($param) {
$argv[] = "--controller=" . substr($param, 0, -4);
}
}
}
} else {
if ($commandtype == 'min') {
} else {
if ($commandtype == 'api') {
} else {
}
}
}
}
if ($action == 'execute') {
if (stripos(implode(' ', $argv), '--controller=all-controller') !== false) {
$this->error("只允许在命令行执行该命令,执行前请做好菜单规则备份!!!");
}
if (config('app_debug')) {
$result = $this->doexecute($commandtype, $argv);
$this->success("", null, ['result' => $result]);
} else {
$this->error("只允许在开发环境下执行命令");
}
} else {
$this->success("", null, ['command' => "php think {$commandtype} " . implode(' ', $argv)]);
}
return;
}
protected function doexecute($commandtype, $argv)
{
if (!config('app_debug')) {
$this->error("只允许在开发环境下执行命令");
}
if (preg_match("/([;\|&]+)/", implode(' ', $argv))) {
$this->error("不支持的命令参数");
}
$commandName = "\\app\\admin\\command\\" . ucfirst($commandtype);
$input = new Input($argv);
$output = new \addons\command\library\Output();
$command = new $commandName($commandtype);
$data = [
'type' => $commandtype,
'params' => json_encode($argv),
'command' => "php think {$commandtype} " . implode(' ', $argv),
'executetime' => time(),
];
$this->model->save($data);
try {
$command->run($input, $output);
$result = implode("\n", $output->getMessage());
$this->model->status = 'successed';
} catch (Exception $e) {
$result = implode("\n", $output->getMessage()) . "\n";
$result .= $e->getMessage();
$this->model->status = 'failured';
}
$result = trim($result);
$this->model->content = $result;
$this->model->save();
return $result;
}
}
... ...
<?php
return [
'Id' => 'ID',
'Type' => '类型',
'Params' => '参数',
'Command' => '命令',
'Content' => '返回结果',
'Executetime' => '执行时间',
'Createtime' => '创建时间',
'Updatetime' => '更新时间',
'Execute again' => '再次执行',
'Successed' => '成功',
'Failured' => '失败',
'Status' => '状态'
];
... ...
<?php
namespace app\admin\model;
use think\Model;
class Command extends Model
{
// 表名
protected $name = 'command';
// 自动写入时间戳字段
protected $autoWriteTimestamp = 'int';
// 定义时间戳字段名
protected $createTime = 'createtime';
protected $updateTime = 'updatetime';
// 追加属性
protected $append = [
'executetime_text',
'type_text',
'status_text'
];
public function getStatusList()
{
return ['successed' => __('Successed'), 'failured' => __('Failured')];
}
public function getExecutetimeTextAttr($value, $data)
{
$value = $value ? $value : $data['executetime'];
return is_numeric($value) ? date("Y-m-d H:i:s", $value) : $value;
}
public function getTypeTextAttr($value, $data)
{
$value = $value ? $value : $data['type'];
$list = ['crud' => '一键生成CRUD', 'menu' => '一键生成菜单', 'min' => '一键压缩打包', 'api' => '一键生成文档'];
return $list[$value] ?? '';
}
public function getStatusTextAttr($value, $data)
{
$value = $value ? $value : $data['status'];
$list = $this->getStatusList();
return $list[$value] ?? '';
}
protected function setExecutetimeAttr($value)
{
return $value && !is_numeric($value) ? strtotime($value) : $value;
}
}
... ...
... ... @@ -407,7 +407,10 @@ class Fields extends Model
if (!extension_loaded('redis')) {
$order=\app\admin\model\facrm\Setting::where('key',$cache_key)->value("values");
$order=$order?json_decode($order):[];
} else {
$queue_config=\think\Config::get('queue');
$redis_cache = \think\Cache::connect([
... ... @@ -417,6 +420,7 @@ class Fields extends Model
'port'=>isset($queue_config['port'])?$queue_config['port']:'6379'
]);
$order = $redis_cache->get($cache_key);
}
$fields = \app\admin\model\facrm\Fields::getCustomFieldsTable($type, [], 'isfilter=1 or islist=1');
... ...
<?php
namespace app\admin\validate;
use think\Validate;
class Command extends Validate
{
/**
* 验证规则
*/
protected $rule = [
];
/**
* 提示消息
*/
protected $message = [
];
/**
* 验证场景
*/
protected $scene = [
'add' => [],
'edit' => [],
];
}
... ...
<style>
.relation-item {margin-top:10px;}
legend {padding-bottom:5px;font-size:14px;font-weight:600;}
label {font-weight:normal;}
.form-control{padding:6px 8px;}
#extend-zone .col-xs-2 {margin-top:10px;padding-right:0;}
#extend-zone .col-xs-2:nth-child(6n+0) {padding-right:15px;}
</style>
<div class="panel panel-default panel-intro">
<div class="panel-heading">
<ul class="nav nav-tabs">
<li class="active"><a href="#crud" data-toggle="tab">{:__('一键生成CRUD')}</a></li>
<li><a href="#menu" data-toggle="tab">{:__('一键生成菜单')}</a></li>
<li><a href="#min" data-toggle="tab">{:__('一键压缩打包')}</a></li>
<li><a href="#api" data-toggle="tab">{:__('一键生成API文档')}</a></li>
</ul>
</div>
<div class="panel-body">
<div id="myTabContent" class="tab-content">
<div class="tab-pane fade active in" id="crud">
<div class="row">
<div class="col-xs-12">
<form role="form">
<input type="hidden" name="commandtype" value="crud" />
<div class="form-group">
<div class="row">
<div class="col-xs-3">
<input checked="" name="isrelation" type="hidden" value="0">
<label class="control-label" data-toggle="tooltip" title="当前只支持生成1对1关联模型,选中后请配置关联表和字段">
<input name="isrelation" type="checkbox" value="1">
关联模型
</label>
</div>
<div class="col-xs-3">
<input checked="" name="local" type="hidden" value="1">
<label class="control-label" data-toggle="tooltip" title="默认模型生成在application/admin/model目录下,选中后将生成在application/common/model目录下">
<input name="local" type="checkbox" value="0"> 全局模型类
</label>
</div>
<div class="col-xs-3">
<input checked="" name="delete" type="hidden" value="0">
<label class="control-label" data-toggle="tooltip" title="删除CRUD生成的相关文件">
<input name="delete" type="checkbox" value="1"> 删除模式
</label>
</div>
<div class="col-xs-3">
<input checked="" name="force" type="hidden" value="0">
<label class="control-label" data-toggle="tooltip" title="选中后,如果已经存在同名文件将被覆盖。如果是删除将不再提醒">
<input name="force" type="checkbox" value="1">
强制覆盖模式
</label>
</div>
<!--
<div class="col-xs-3">
<input checked="" name="menu" type="hidden" value="0">
<label class="control-label" data-toggle="tooltip" title="选中后,将同时生成后台菜单规则">
<input name="menu" type="checkbox" value="1">
生成菜单
</label>
</div>
-->
</div>
</div>
<div class="form-group">
<legend>主表设置</legend>
<div class="row">
<div class="col-xs-3">
<label>请选择主表</label>
{:build_select('table',$tableList,null,['class'=>'form-control selectpicker', 'data-live-search'=>'true']);}
</div>
<div class="col-xs-3">
<label>自定义控制器名</label>
<input type="text" class="form-control" name="controller" data-toggle="tooltip" title="默认根据表名自动生成,如果需要放在二级目录请手动填写" placeholder="支持目录层级,以/分隔">
</div>
<div class="col-xs-3">
<label>自定义模型名</label>
<input type="text" class="form-control" name="model" data-toggle="tooltip" title="默认根据表名自动生成" placeholder="不支持目录层级">
</div>
<div class="col-xs-3">
<label>显示字段(默认全部)</label>
<select name="fields[]" id="fields" multiple style="height:30px;" class="form-control selectpicker"></select>
</div>
</div>
</div>
<div class="form-group hide" id="relation-zone">
<legend>关联表设置</legend>
<div class="row" style="margin-top:15px;">
<div class="col-xs-12">
<a href="javascript:;" class="btn btn-primary btn-sm btn-newrelation" data-index="1">追加关联模型</a>
</div>
</div>
</div>
<hr>
<div class="form-group" id="extend-zone">
<legend>字段识别设置 <span style="font-size:12px;font-weight: normal;">(与之匹配的字段都将生成相应组件)</span></legend>
<div class="row">
<div class="col-xs-2">
<label>复选框后缀</label>
<input type="text" class="form-control" name="setcheckboxsuffix" placeholder="默认为set类型" />
</div>
<div class="col-xs-2">
<label>单选框后缀</label>
<input type="text" class="form-control" name="enumradiosuffix" placeholder="默认为enum类型" />
</div>
<div class="col-xs-2">
<label>图片类型后缀</label>
<input type="text" class="form-control" name="imagefield" placeholder="默认为image,images,avatar,avatars" />
</div>
<div class="col-xs-2">
<label>文件类型后缀</label>
<input type="text" class="form-control" name="filefield" placeholder="默认为file,files" />
</div>
<div class="col-xs-2">
<label>日期时间后缀</label>
<input type="text" class="form-control" name="intdatesuffix" placeholder="默认为time" />
</div>
<div class="col-xs-2">
<label>开关后缀</label>
<input type="text" class="form-control" name="switchsuffix" placeholder="默认为switch" />
</div>
<div class="col-xs-2">
<label>城市选择后缀</label>
<input type="text" class="form-control" name="citysuffix" placeholder="默认为city" />
</div>
<div class="col-xs-2">
<label>动态下拉后缀(单)</label>
<input type="text" class="form-control" name="selectpagesuffix" placeholder="默认为_id" />
</div>
<div class="col-xs-2">
<label>动态下拉后缀(多)</label>
<input type="text" class="form-control" name="selectpagessuffix" placeholder="默认为_ids" />
</div>
<div class="col-xs-2">
<label>忽略的字段</label>
<input type="text" class="form-control" name="ignorefields" placeholder="默认无" />
</div>
<div class="col-xs-2">
<label>排序字段</label>
<input type="text" class="form-control" name="sortfield" placeholder="默认为weigh" />
</div>
<div class="col-xs-2">
<label>富文本编辑器</label>
<input type="text" class="form-control" name="editorsuffix" placeholder="默认为content" />
</div>
<div class="col-xs-2">
<label>选项卡过滤字段</label>
<input type="text" class="form-control" name="headingfilterfield" placeholder="默认为status" />
</div>
<div class="col-xs-2">
<label>标签后缀 <i class="fa fa-info-circle" data-toggle="tooltip" data-title="只支持1.3.0+版本"></i></label>
<input type="text" class="form-control" name="tagsuffix" placeholder="默认为tag,tags" />
</div>
<div class="col-xs-2">
<label>JSON后缀 <i class="fa fa-info-circle" data-toggle="tooltip" data-title="只支持1.3.0+版本"></i></label>
<input type="text" class="form-control" name="jsonsuffix" placeholder="默认为json" />
</div>
<div class="col-xs-2">
<label>固定列数量 <i class="fa fa-info-circle" data-toggle="tooltip" data-title="只支持1.3.0+版本,大于0时为右侧固定列数量,小于0时为左侧固定列数量"></i></label>
<input type="text" class="form-control" name="fixedcolumns" placeholder="默认不启用" />
</div>
</div>
</div>
<div class="form-group">
<legend>生成命令行</legend>
<textarea class="form-control" data-toggle="tooltip" title="如果在线执行命令失败,可以将命令复制到命令行进行执行" rel="command" rows="1" placeholder="请点击生成命令行"></textarea>
</div>
<div class="form-group">
<legend>返回结果</legend>
<textarea class="form-control" rel="result" rows="5" placeholder="请点击立即执行"></textarea>
</div>
<div class="form-group">
<button type="button" class="btn btn-info btn-embossed btn-command">{:__('生成命令行')}</button>
<button type="button" class="btn btn-success btn-embossed btn-execute">{:__('立即执行')}</button>
</div>
</form>
</div>
</div>
</div>
<div class="tab-pane fade" id="menu">
<div class="row">
<div class="col-xs-12">
<form role="form">
<input type="hidden" name="commandtype" value="menu" />
<div class="form-group">
<div class="row">
<div class="col-xs-3">
<input checked="" name="allcontroller" type="hidden" value="0">
<label class="control-label" data-toggle="tooltip" title="将删除全部的菜单规则,重新按控制器进行生成,请做好备份,谨慎选择">
<input name="allcontroller" data-toggle="collapse" data-target="#controller" type="checkbox" value="1"> 一键生成全部控制器
</label>
</div>
<div class="col-xs-3">
<input checked="" name="delete" type="hidden" value="0">
<label class="control-label" data-toggle="tooltip" title="删除控制器菜单规则">
<input name="delete" type="checkbox" value="1"> 删除模式
</label>
</div>
<div class="col-xs-3">
<input checked="" name="force" type="hidden" value="0">
<label class="control-label" data-toggle="tooltip" title="如果菜单规则已经存在则覆盖">
<input name="force" type="checkbox" value="1"> 强制覆盖模式
</label>
</div>
</div>
</div>
<div class="form-group in" id="controller">
<legend>控制器设置</legend>
<div class="row" style="margin-top:15px;">
<div class="col-xs-12">
<input type="text" name="controllerfile" class="form-control selectpage" style="width:720px;" data-source="command/get_controller_list" data-multiple="true" name="controller" placeholder="请选择控制器" />
</div>
</div>
</div>
<div class="form-group">
<legend>生成命令行</legend>
<textarea class="form-control" rel="command" rows="1" placeholder="请点击生成命令行"></textarea>
</div>
<div class="form-group">
<legend>返回结果</legend>
<textarea class="form-control" rel="result" rows="5" placeholder="请点击立即执行"></textarea>
</div>
<div class="form-group">
<button type="button" class="btn btn-info btn-embossed btn-command">{:__('生成命令行')}</button>
<button type="button" class="btn btn-success btn-embossed btn-execute">{:__('立即执行')}</button>
</div>
</form>
</div>
</div>
</div>
<div class="tab-pane fade" id="min">
<div class="row">
<div class="col-xs-12">
<form role="form">
<input type="hidden" name="commandtype" value="min" />
<div class="form-group">
<legend>基础设置</legend>
<div class="row">
<div class="col-xs-3">
<label>请选择压缩模块</label>
<select name="module" class="form-control selectpicker">
<option value="all" selected>全部</option>
<option value="backend">后台Backend</option>
<option value="frontend">前台Frontend</option>
</select>
</div>
<div class="col-xs-3">
<label>请选择压缩资源</label>
<select name="resource" class="form-control selectpicker">
<option value="all" selected>全部</option>
<option value="js">JS</option>
<option value="css">CSS</option>
</select>
</div>
<div class="col-xs-3">
<label>请选择压缩模式</label>
<select name="optimize" class="form-control selectpicker">
<option value=""></option>
<option value="uglify">uglify</option>
<option value="closure">closure</option>
</select>
</div>
</div>
</div>
<div class="form-group">
<legend>生成命令行</legend>
<textarea class="form-control" rel="command" rows="1" placeholder="请点击生成命令行"></textarea>
</div>
<div class="form-group">
<legend>返回结果</legend>
<textarea class="form-control" rel="result" rows="5" placeholder="请点击立即执行"></textarea>
</div>
<div class="form-group">
<button type="button" class="btn btn-info btn-embossed btn-command">{:__('生成命令行')}</button>
<button type="button" class="btn btn-success btn-embossed btn-execute">{:__('立即执行')}</button>
</div>
</form>
</div>
</div>
</div>
<div class="tab-pane fade" id="api">
<div class="row">
<div class="col-xs-12">
<form role="form">
<input type="hidden" name="commandtype" value="api" />
<div class="form-group">
<div class="row">
<div class="col-xs-3">
<input checked="" name="force" type="hidden" value="0">
<label class="control-label" data-toggle="tooltip" title="如果已经存在则覆盖">
<input name="force" type="checkbox" value="1">
覆盖模式
</label>
</div>
</div>
</div>
<div class="form-group">
<legend>文档设置</legend>
<div class="row">
<div class="col-xs-3">
<label>请输入接口URL</label>
<input type="text" name="url" class="form-control" placeholder="API URL,可留空" />
</div>
<div class="col-xs-3">
<label>接口生成文件</label>
<input type="text" name="output" class="form-control" placeholder="留空则使用api.html" />
</div>
<div class="col-xs-3">
<label>模板文件</label>
<input type="text" name="template" class="form-control" placeholder="如果不清楚请留空" />
</div>
<div class="col-xs-3">
<label>文档语言</label>
<select name="language" class="form-control">
<option value="" selected>请选择语言</option>
<option value="zh-cn">中文</option>
<option value="en">英文</option>
</select>
</div>
</div>
<div class="row" style="margin-top:10px;">
<div class="col-xs-3">
<label>文档标题</label>
<input type="text" name="title" class="form-control" placeholder="默认为{$site.name}" />
</div>
<div class="col-xs-3">
<label>文档作者</label>
<input type="text" name="author" class="form-control" placeholder="默认为{$site.name}" />
</div>
<div class="col-xs-3">
<label>生成模块</label>
<select name="module" class="form-control selectpicker">
<option value="" selected>请选择模块</option>
<option value="api">API</option>
<option value="backend">后台</option>
<option value="frontend">前台</option>
</select>
</div>
<div class="col-xs-3">
<label>生成插件文档</label>
<select name="addon" class="form-control selectpicker" data-live-search="true">
<option value="" selected>请选择插件</option>
{foreach name=":get_addon_list()" id="item"}
<option value="{$item.name}">{$item.title}</option>
{/foreach}
</select>
</div>
</div>
</div>
<div class="form-group">
<legend>生成命令行</legend>
<textarea class="form-control" rel="command" rows="1" placeholder="请点击生成命令行"></textarea>
</div>
<div class="form-group">
<legend>返回结果</legend>
<textarea class="form-control" rel="result" rows="5" placeholder="请点击立即执行"></textarea>
</div>
<div class="form-group">
<button type="button" class="btn btn-info btn-embossed btn-command">{:__('生成命令行')}</button>
<button type="button" class="btn btn-success btn-embossed btn-execute">{:__('立即执行')}</button>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
<script id="relationtpl" type="text/html">
<div class="row relation-item">
<div class="col-xs-2">
<label>请选择关联表</label>
<select name="relation[<%=index%>][relation]" class="form-control relationtable" data-live-search="true"></select>
</div>
<div class="col-xs-2">
<label>请选择关联类型</label>
<select name="relation[<%=index%>][relationmode]" class="form-control relationmode"></select>
</div>
<div class="col-xs-2">
<label>关联外键</label>
<select name="relation[<%=index%>][relationforeignkey]" class="form-control relationforeignkey"></select>
</div>
<div class="col-xs-2">
<label>关联主键</label>
<select name="relation[<%=index%>][relationprimarykey]" class="form-control relationprimarykey"></select>
</div>
<div class="col-xs-2">
<label>请选择显示字段</label>
<select name="relation[<%=index%>][relationfields][]" multiple class="form-control relationfields"></select>
</div>
<div class="col-xs-2">
<label>&nbsp;</label>
<a href="javascript:;" class="btn btn-danger btn-block btn-removerelation">移除</a>
</div>
</div>
</script>
... ...
<table class="table table-striped">
<thead>
<tr>
<th>{:__('Title')}</th>
<th>{:__('Content')}</th>
</tr>
</thead>
<tbody>
<tr>
<td>{:__('Type')}</td>
<td>{$row.type}({$row.type_text})</td>
</tr>
<tr>
<td>{:__('Params')}</td>
<td>{$row.params|htmlentities}</td>
</tr>
<tr>
<td>{:__('Command')}</td>
<td>{$row.command|htmlentities}</td>
</tr>
<tr>
<td>{:__('Content')}</td>
<td>
<textarea class="form-control" name="" id="" cols="60" rows="10">{$row.content|htmlentities}</textarea>
</td>
</tr>
<tr>
<td>{:__('Executetime')}</td>
<td>{$row.executetime|datetime}</td>
</tr>
<tr>
<td>{:__('Status')}</td>
<td>{$row.status_text}</td>
</tr>
</tbody>
</table>
<div class="hide layer-footer">
<label class="control-label col-xs-12 col-sm-2"></label>
<div class="col-xs-12 col-sm-8">
<button type="reset" class="btn btn-primary btn-embossed btn-close" onclick="Layer.closeAll();">{:__('Close')}</button>
</div>
</div>
\ No newline at end of file
... ...
<div class="panel panel-default panel-intro">
{:build_heading()}
<div class="panel-body">
<div id="myTabContent" class="tab-content">
<div class="tab-pane fade active in" id="one">
<div class="widget-body no-padding">
<div id="toolbar" class="toolbar">
<a href="javascript:;" class="btn btn-primary btn-refresh" title="{:__('Refresh')}" ><i class="fa fa-refresh"></i> </a>
<a href="javascript:;" class="btn btn-success btn-add {:$auth->check('command/add')?'':'hide'}" title="{:__('Add')}" ><i class="fa fa-plus"></i> {:__('Add')}</a>
<a href="javascript:;" class="btn btn-danger btn-del btn-disabled disabled {:$auth->check('command/del')?'':'hide'}" title="{:__('Delete')}" ><i class="fa fa-trash"></i> {:__('Delete')}</a>
</div>
<table id="table" class="table table-striped table-bordered table-hover"
data-operate-detail="{:$auth->check('command/detail')}"
data-operate-execute="{:$auth->check('command/execute')}"
data-operate-del="{:$auth->check('command/del')}"
width="100%">
</table>
</div>
</div>
</div>
</div>
</div>
... ...
<style>
.form-group .col-sm-2{
.form-group .col-sm-2 {
min-width: 120px;
}
</style>
<form id="edit-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
<div class="">
<div class="panel panel-success">
<div class="panel-heading">
<h4 class="panel-title">
<a data-toggle="collapse"
href="#collapseOne">
<span>{:__('基本信息')}</span>
</a>
</h4>
</div>
<div id="collapseOne" class="panel-collapse collapse in">
<div class="panel-body">
<div class="col-md-4 col-xs-12 form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('合同编号')}:</label>
<div class="col-xs-12 col-sm-8"style="height: 30px;">
<div class="input-group">
<input id="c-number" data-rule="required" type="text" class="form-control" name="row[number]" value="{$cprefix|htmlentities}"/>
<div class="input-group-addon no-border no-padding">
<span><button type="button" id="number-create" class="btn btn-primary " > {:__('生成')}</button></span>
</div>
</div>
<div class="panel panel-success">
<div class="panel-heading">
<h4 class="panel-title">
<a data-toggle="collapse"
href="#collapseOne">
<span>{:__('基本信息')}</span>
</a>
</h4>
</div>
<div id="collapseOne" class="panel-collapse collapse in">
<div class="panel-body">
</div>
</div>
<div class="col-md-4 col-xs-12 form-group">
<label for="c-name" class="control-label col-xs-12 col-sm-2">{:__('合同名称')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-name" data-rule="required" type="text" class="form-control" name="row[name]" value="{:isset($customer)?htmlentities($customer.name).'合同':''}"/>
</div>
</div>
<div class="col-md-4 col-xs-12 form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('合同编号')}:</label>
<div class="col-xs-12 col-sm-8" style="height: 30px;">
<div class="input-group">
<input id="c-number" data-rule="required" type="text" class="form-control"
name="row[number]" value="{$cprefix|htmlentities}"/>
<div class="input-group-addon no-border no-padding">
<span><button type="button" id="number-create"
class="btn btn-primary "> {:__('生成')}</button></span>
</div>
</div>
<div class="col-md-4 col-xs-12 form-group">
<label for="c-customer_id" class="control-label col-xs-12 col-sm-2">{:__('选择客户')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-customer_id" data-rule="required" data-source="facrm/customer/index/selectpage/{$addtype=='add'?'type/all':''}"
class="form-control selectpage" name="row[customer_id]" type="text" value="{:input('customer_id')}">
</div>
</div>
<div class="col-md-4 col-xs-12 form-group business_id_div ">
<label for="c-business_id" class="control-label col-xs-12 col-sm-2">{:__('选择商机')}:</label>
<div class="col-xs-12 col-sm-8">
</div>
</div>
<div class="col-md-4 col-xs-12 form-group">
<label for="c-name" class="control-label col-xs-12 col-sm-2">{:__('合同名称')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-name" data-rule="required" type="text" class="form-control" name="row[name]"
value="{:isset($customer)?htmlentities($customer.name).'合同':''}"/>
</div>
</div>
<div class="clickbox">
<input type="hidden" name="row[business_id]" id="c-eventkey" class="form-control" value="0" data-rule="required" readonly/>
<label class="control-label">
<a href="javascript:;" data-url="{$addtype=='add'?'facrm/contract/index/selectbusiness':'facrm/business/index/index/select/1'}" id="select-resources">
{:__('选择商机')}</a>
</label>
</div>
<div class="col-md-4 col-xs-12 form-group">
<label for="c-customer_id" class="control-label col-xs-12 col-sm-2">{:__('选择客户')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-customer_id" data-rule="required"
data-source="facrm/customer/index/selectpage/{$addtype=='add'?'type/all':''}"
class="form-control selectpage" name="row[customer_id]" type="text"
value="{:input('customer_id')}">
</div>
</div>
</div>
</div>
<div class="col-md-4 col-xs-12 form-group business_id_div ">
<label for="c-business_id" class="control-label col-xs-12 col-sm-2">{:__('选择商机')}:</label>
<div class="col-xs-12 col-sm-8">
<div class="col-md-4 col-xs-12 form-group">
<label for="c-money" class="control-label col-xs-12 col-sm-2">{:__('合同金额')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-money" type="number" class="form-control" name="row[money]" value=""/>
</div>
</div>
<div class="col-md-4 col-xs-12 form-group">
<label for="c-order_time" class="control-label col-xs-12 col-sm-2">{:__('下单时间')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-order_time" value="{:datetime(time())}" class="form-control datetimepicker"
data-date-format="YYYY-MM-DD" data-use-current="true" name="row[order_time]" type="text">
</div>
</div>
<div class="col-md-4 col-xs-12 form-group">
<label for="c-start_time" class="control-label col-xs-12 col-sm-2">{:__('合同开始时间')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-start_time" value="{:datetime(time())}" class="form-control datetimepicker"
data-date-format="YYYY-MM-DD HH:mm" data-use-current="true" name="row[start_time]" type="text">
</div>
</div>
<div class="col-md-4 col-xs-12 form-group">
<label for="c-end_time" class="control-label col-xs-12 col-sm-2">{:__('合同结束时间')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-end_time" value="" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm"
data-use-current="true" name="row[end_time]" type="text">
</div>
</div>
<div class="clickbox">
<input type="hidden" name="row[business_id]" id="c-eventkey" class="form-control"
value="0" data-rule="required" readonly/>
<label class="control-label">
<a href="javascript:;"
data-url="{$addtype=='add'?'facrm/contract/index/selectbusiness':'facrm/business/index/index/select/1'}"
id="select-resources">
{:__('选择商机')}</a>
</label>
</div>
</div>
</div>
<div class="col-md-4 col-xs-12 form-group">
<label for="c-contacts_id" class="control-label col-xs-12 col-sm-2">{:__('客户签约人')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-contacts_id" data-source="{$addtype=='add'?'facrm/contract/index/selectcontact':'facrm/customer/contacts/index'}"
class="form-control selectpage" name="row[contacts_id]" type="text" value="" >
<div class="col-md-4 col-xs-12 form-group">
<label for="c-money" class="control-label col-xs-12 col-sm-2">{:__('合同金额')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-money" type="number" class="form-control" name="row[money]" value=""/>
</div>
</div>
<div class="col-md-4 col-xs-12 form-group">
<label for="c-order_time" class="control-label col-xs-12 col-sm-2">{:__('下单时间')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-order_time" value="{:datetime(time())}" class="form-control datetimepicker"
data-date-format="YYYY-MM-DD" data-use-current="true" name="row[order_time]"
type="text">
</div>
</div>
<div class="col-md-4 col-xs-12 form-group">
<label for="c-start_time"
class="control-label col-xs-12 col-sm-2">{:__('合同开始时间')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-start_time" value="{:datetime(time())}" class="form-control datetimepicker"
data-date-format="YYYY-MM-DD HH:mm" data-use-current="true" name="row[start_time]"
type="text">
</div>
</div>
<div class="col-md-4 col-xs-12 form-group">
<label for="c-end_time" class="control-label col-xs-12 col-sm-2">{:__('合同结束时间')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-end_time" value="" class="form-control datetimepicker"
data-date-format="YYYY-MM-DD HH:mm"
data-use-current="true" name="row[end_time]" type="text">
</div>
</div>
</div>
</div>
<div class="col-md-4 col-xs-12 form-group">
<label for="c-order_admin_id" class="control-label col-xs-12 col-sm-2">{:__('公司签约人')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-order_admin_id" data-source="facrm/common/selectpage/model/admin{$addtype=='add'?'/type/all':''}"
data-field="nickname" data-rule="required"
class="form-control selectpage" name="row[order_admin_id]" type="text" value="{:isset($customer)?$customer.owner_user_id:$auth->id}">
<div class="col-md-4 col-xs-12 form-group">
<label for="c-contacts_id" class="control-label col-xs-12 col-sm-2">{:__('客户签约人')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-contacts_id"
data-source="{$addtype=='add'?'facrm/contract/index/selectcontact':'facrm/customer/contacts/index'}"
class="form-control selectpage" name="row[contacts_id]" type="text" value="">
</div>
</div>
<div class="col-md-4 col-xs-12 form-group">
<label for="c-flow_admin_id" class="control-label col-xs-12 col-sm-2">{:__('审批人')}:</label>
<div class="col-xs-12 col-sm-8">
{:\\app\\admin\\model\\facrm\\Flow::getFlowHtml($flow,$auth->id)}
</div>
</div>
</div>
</div>
<div class="col-md-4 col-xs-12 form-group">
<label for="c-remark" class="control-label col-xs-12 col-sm-2">{:__('备注')}:</label>
<div class="col-xs-12 col-sm-8">
<textarea id="c-remark" class="form-control" name="row[remark]"></textarea>
</div>
</div>
<div class="col-md-4 col-xs-12 form-group">
<label for="c-order_admin_id"
class="control-label col-xs-12 col-sm-2">{:__('公司签约人')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-order_admin_id"
data-source="facrm/common/selectpage/model/admin{$addtype=='add'?'/type/all':''}"
data-field="nickname" data-rule="required"
class="form-control selectpage" name="row[order_admin_id]" type="text"
value="{:isset($customer)?$customer.owner_user_id:$auth->id}">
</div>
</div>
<div class="col-md-4 col-xs-12 form-group">
<label for="c-flow_admin_id" class="control-label col-xs-12 col-sm-2">{:__('审批人')}:</label>
<div class="col-xs-12 col-sm-8">
{:\\app\\admin\\model\\facrm\\Flow::getFlowHtml($flow,$auth->id)}
</div>
</div>
<div class="col-md-4 col-xs-12 form-group">
<label for="c-remark" class="control-label col-xs-12 col-sm-2">{:__('备注')}:</label>
<div class="col-xs-12 col-sm-8">
<textarea id="c-remark" class="form-control" name="row[remark]"></textarea>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('附件')}:</label>
<div class="col-xs-12 col-sm-8">
<div class="input-group">
<input id="c-attachfiles" class="form-control" size="20"
name="row[attachfiles]" type="text" value="{$row.attachfiles|htmlentities}">
<div class="input-group-addon no-border no-padding">
<span><button type="button" id="faupload-attachfiles"
class="btn btn-danger faupload" data-input-id="c-attachfiles"
data-multiple="true" data-preview-id="p-attachfiles"><i
class="fa fa-upload"></i> {:__('Upload')}</button></span>
<span><button type="button" id="fachoose-attachfiles"
class="btn btn-primary fachoose" data-input-id="c-attachfiles"
data-multiple="true"><i
class="fa fa-list"></i> {:__('Choose')}</button></span>
</div>
<span class="msg-box n-right" for="c-attachfiles"></span>
</div>
<ul class="row list-inline faupload-preview" id="p-attachfiles"></ul>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('图片')}:</label>
<div class="col-xs-12 col-sm-8">
<div class="input-group">
<input id="c-smallimages" class="form-control" size="50" name="row[smallimages]"
type="text" value="{$row.smallimages|htmlentities}">
<div class="input-group-addon no-border no-padding">
<span><button type="button" id="plupload-smallimages"
class="btn btn-danger plupload" data-input-id="c-smallimages"
data-multiple="true" data-preview-id="p-smallimages"><i
class="fa fa-upload"></i> {:__('Upload')}</button></span>
<span><button type="button" id="fachoose-smallimages"
class="btn btn-primary fachoose" data-input-id="c-smallimages"
data-multiple="true"><i
class="fa fa-list"></i> {:__('Choose')}</button></span>
</div>
<span class="msg-box n-right" for="c-smallimages"></span>
</div>
<ul class="row list-inline plupload-preview" id="p-smallimages"></ul>
</div>
</div>
</div>
</div>
<div class="panel-group" id="accordion">
<div class="panel panel-info">
</div>
<div class="panel-group" id="accordion">
<div class="panel panel-info">
<div class="panel-heading">
<h4 class="panel-title">
<a data-toggle="collapse"
href="#collapseThree">
合同扩展
合同扩展
</a>
</h4>
</div>
... ... @@ -151,110 +204,112 @@
</div>
</div>
</div>
</div>
<div class="row">
<div class="table-responsive" style="margin: 20px">
<table id="table" class="table table-striped table-bordered table-hover table-nowrap">
<thead>
<th style="width: 120px">{:__('操作')}</th>
<th style="width: 50px">{:__('序号')}</th>
<th>{:__('编码')}</th>
<th style="width: 100px">{:__('商品')}</th>
<th style="width: 80px">{:__('数量')}</th>
<th style="width: 80px">{:__('售价')}</th>
<th>{:__('备注')}</th>
<th>{:__('规格')}</th>
<th>{:__('属性')}</th>
<th>{:__('单位')}</th>
<th>{:__('小计')}</th>
</thead>
<tbody>
<tr>
<td>
<button type="button" class="btn btn-primary" onclick="addRow()">{:__('添加')}</button>
<button type="button" class="btn btn-default" onclick="delRow(this)">{:__('删除')}</button>
</td>
<td></td>
<td></td>
<td>
<input date-rule="required;" style="width: 100px" type="text" name="product[0][name]"
data-index="0" class="find" class="" data-toggle="modal" data-target="#modelProduct">
<input type="hidden" name="product[0][product_id]">
<input type="hidden" name="product[0][sku]">
<input type="hidden" name="product[0][specification]">
<input type="hidden" name="product[0][prop]">
<input type="hidden" name="product[0][unit]">
</td>
<td>
<input type="number" style="width: 80px" name="product[0][nums]"
data-rule="required;integer;range(0~);" class="nums" onchange="totalNums(this)" onblur="totalNums(this)">
</td>
<td><input type="number" style="width: 80px" data-rule="required;range(0~);" onchange="calMoney(this)" onblur="calMoney(this)"
class="unit-price" name="product[0][price]" >
<input type="hidden" name="product[0][subtotal]">
</td>
<td><textarea rows="1" class="remarks" name="product[0][remarks]" cols="20"></textarea></td>
<td class="gg"></td>
<td></td>
<td class="unit"></td>
<td class="subtotal">
</td>
</tr>
<tr>
<td>{:__('合计')}</td>
<td></td>
<td></td>
<td></td>
<td class="totalnums">0</td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td id="allMoney"></td>
</tr>
</tbody>
</table>
</div>
<div>
<div class="row">
<div class="table-responsive" style="margin: 20px">
<table id="table" class="table table-striped table-bordered table-hover table-nowrap">
<thead>
<th style="width: 120px">{:__('操作')}</th>
<th style="width: 50px">{:__('序号')}</th>
<th>{:__('编码')}</th>
<th style="width: 100px">{:__('商品')}</th>
<th style="width: 80px">{:__('数量')}</th>
<th style="width: 80px">{:__('售价')}</th>
<th>{:__('备注')}</th>
<th>{:__('规格')}</th>
<th>{:__('属性')}</th>
<th>{:__('单位')}</th>
<th>{:__('小计')}</th>
</thead>
<tbody>
<tr>
<td>
<button type="button" class="btn btn-primary" onclick="addRow()">{:__('添加')}</button>
<button type="button" class="btn btn-default" onclick="delRow(this)">{:__('删除')}</button>
</td>
<td></td>
<td></td>
<td>
<input date-rule="required;" style="width: 100px" type="text" name="product[0][name]"
data-index="0" class="find" class="" data-toggle="modal" data-target="#modelProduct">
<input type="hidden" name="product[0][product_id]">
<input type="hidden" name="product[0][sku]">
<input type="hidden" name="product[0][specification]">
<input type="hidden" name="product[0][prop]">
<input type="hidden" name="product[0][unit]">
</td>
<td>
<input type="number" style="width: 80px" name="product[0][nums]"
data-rule="required;integer;range(0~);" class="nums" onchange="totalNums(this)"
onblur="totalNums(this)">
</td>
<td><input type="number" style="width: 80px" data-rule="required;range(0~);"
onchange="calMoney(this)" onblur="calMoney(this)"
class="unit-price" name="product[0][price]">
<input type="hidden" name="product[0][subtotal]">
</td>
<td><textarea rows="1" class="remarks" name="product[0][remarks]" cols="20"></textarea></td>
<td class="gg"></td>
<td></td>
<td class="unit"></td>
<div class="row">
<div class="col-md-4 col-xs-12">
</div>
<div class="col-md-4 col-xs-12">
<label class="control-label col-xs-12 col-sm-6">{:__('优惠率%')}:</label>
<div class="col-xs-12 col-sm-6">
<input id="c-rate" class="form-control" data-rule="required;float;range(0~100);"
name="row[discount_rate]" type="number" value="0" onblur="calTotalMoneys()">
<td class="subtotal">
</td>
</tr>
<tr>
<td>{:__('合计')}</td>
<td></td>
<td></td>
<td></td>
<td class="totalnums">0</td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td id="allMoney"></td>
</tr>
</tbody>
</table>
</div>
<div>
<div class="row">
<div class="col-md-4 col-xs-12">
</div>
</div>
<div class="col-md-4 col-xs-12">
<label class="control-label col-xs-12 col-sm-6"> {:__('产品总额$')}:</label>
<div class="col-xs-12 col-sm-6">
<input id="totalMoneys" class="form-control" name="row[total_price]" type="number">
<input id="money" style="display: none;" readonly="readonly" type="number">
<input id="allNums" style="display: none;" name="row[totalNums]" readonly="readonly"
type="number">
<div class="col-md-4 col-xs-12">
<label class="control-label col-xs-12 col-sm-6">{:__('优惠率%')}:</label>
<div class="col-xs-12 col-sm-6">
<input id="c-rate" class="form-control" data-rule="required;float;range(0~100);"
name="row[discount_rate]" type="number" value="0" onblur="calTotalMoneys()">
</div>
</div>
<div class="col-md-4 col-xs-12">
<label class="control-label col-xs-12 col-sm-6"> {:__('产品总额$')}:</label>
<div class="col-xs-12 col-sm-6">
<input id="totalMoneys" class="form-control" name="row[total_price]" type="number">
<input id="money" style="display: none;" readonly="readonly" type="number">
<input id="allNums" style="display: none;" name="row[totalNums]" readonly="readonly"
type="number">
</div>
</div>
</div>
</div>
</div>
</div>
<div class="form-group layer-footer">
<label class="control-label col-xs-12 col-sm-2"></label>
<div class="col-xs-12 col-sm-8">
<button type="submit" class="btn btn-success btn-embossed disabled">{:__('OK')}</button>
<button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
<div class="form-group layer-footer">
<label class="control-label col-xs-12 col-sm-2"></label>
<div class="col-xs-12 col-sm-8">
<button type="submit" class="btn btn-success btn-embossed disabled">{:__('OK')}</button>
<button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
</div>
</div>
</div>
</form>
... ...
... ... @@ -4,151 +4,222 @@
</div>
{/if}
<style>
.form-group .col-sm-2{
.form-group .col-sm-2 {
min-width: 120px;
}
</style>
<form id="edit-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
<div class="">
<div class="panel panel-success">
<div class="panel-heading">
<h4 class="panel-title">
<a data-toggle="collapse"
href="#collapseOne">
<span>{:__('基本信息')}</span>
</a>
</h4>
</div>
<div id="collapseOne" class="panel-collapse collapse in">
<div class="panel-body">
<div class="col-md-4 col-xs-12 form-group">
<label for="c-number" class="control-label col-xs-12 col-sm-2">{:__('合同编号')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-number" data-rule="required" type="text" class="form-control" name="row[number]" value="{$row.number|htmlentities}" {if $row.check_status=="2"}disabled{/if} />
</div>
</div>
<div class="col-md-4 col-xs-12 form-group">
<label for="c-name" class="control-label col-xs-12 col-sm-2">{:__('合同名称')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-name" data-rule="required" type="text" class="form-control" name="row[name]" value="{$row.name|htmlentities}" {if $row.check_status=="2"}disabled{/if} />
</div>
</div>
<div class="col-md-4 col-xs-12 form-group">
<label for="c-customer_id" class="control-label col-xs-12 col-sm-2">{:__('选择客户')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-customer_id" data-rule="required" data-source="facrm/customer/index/selectpage/type/all"
class="form-control selectpage" type="text" value="{$row.customer_id|htmlentities}" disabled>
</div>
</div>
<div class="col-md-4 col-xs-12 form-group business_id_div" >
<label for="c-business_id" class="control-label col-xs-12 col-sm-2">{:__('选择商机')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-business_id" data-rule="required" data-source="facrm/business/index/index"
class="form-control selectpage" name="" type="text" value="{$row.business_id|htmlentities}" disabled>
</div>
</div>
<div class="col-md-4 col-xs-12 form-group">
<label for="c-money" class="control-label col-xs-12 col-sm-2">{:__('合同金额')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-money" type="number" class="form-control" name="row[money]" value="{$row.money|htmlentities}" {if $row.check_status=="2"}disabled{/if} />
</div>
</div>
<div class="col-md-4 col-xs-12 form-group">
<label for="c-order_time" class="control-label col-xs-12 col-sm-2">{:__('下单时间')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-order_time" value="{:datetime($row.order_time)}" class="form-control datetimepicker" data-date-format="YYYY-MM-DD" data-use-current="true" name="row[order_time]" type="text" {if $row.check_status=="2"}disabled{/if} >
</div>
</div>
<div class="col-md-4 col-xs-12 form-group">
<label for="c-start_time" class="control-label col-xs-12 col-sm-2">{:__('合同开始时间')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-start_time" value="{:datetime($row.start_time)}" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm" data-use-current="true" name="row[start_time]" type="text" {if $row.check_status=="2"}disabled{/if} >
</div>
</div>
<div class="col-md-4 col-xs-12 form-group">
<label for="c-end_time" class="control-label col-xs-12 col-sm-2">{:__('合同结束时间')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-end_time" value="{:datetime($row.end_time)}" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm" data-use-current="true" name="row[end_time]" type="text" {if $row.check_status=="2"}disabled{/if}>
</div>
</div>
<div class="col-md-4 col-xs-12 form-group">
<label for="c-contacts_id" class="control-label col-xs-12 col-sm-2">{:__('客户签约人')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-contacts_id" data-source="facrm/contract/index/selectcontact"
class="form-control selectpage" name="row[contacts_id]" type="text" value="{$row.contacts_id|htmlentities}" {if $row.check_status=="2"}disabled{/if} >
</div>
</div>
<div class="col-md-4 col-xs-12 form-group">
<label for="c-order_admin_id" class="control-label col-xs-12 col-sm-2">{:__('公司签约人')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-order_admin_id" data-rule="required" data-source="facrm/common/selectpage/model/admin/type/all" data-field="nickname"
class="form-control selectpage" name="row[order_admin_id]" type="text" value="{$row.order_admin_id|htmlentities}" {if $row.check_status=="2"}disabled{/if} >
</div>
</div>
{if $row.check_status!="2"}
<div class="col-md-4 col-xs-12 form-group">
<label for="c-flow_admin_id" class="control-label col-xs-12 col-sm-2">{:__('审批人')}:</label>
<div class="col-xs-12 col-sm-8">
{if($flow)}
<input id="c-flow_admin_id" value="{$row.flow_admin_id|htmlentities}" data-source="facrm/common/selectpage/model/admin/type/all" data-field="nickname" data-multiple="true" {if $row.check_status=="2"}disabled{/if} {$flow->config==1?'disabled ':'data-rule="required"'}
class="form-control selectpage" name="row[flow_admin_id]" type="text" value="{if $flow->config==1}{$flow->step[0]['admin_ids']}{/if}">
{else/}
<label class="control-label">审批流程已被删除</label>
{/if}
</div>
</div>
{/if}
{if $row.check_status=="2"}
<div class="col-md-4 col-xs-12 form-group">
<label for="c-expire_handle" class="control-label col-xs-12 col-sm-2">合同过期处理:</label>
<div class="col-xs-12 col-sm-8">
{:build_radios('row[expire_handle]', ['0'=>'未处理', '1'=>'已续签', '2'=>'不再合作'], $row.expire_handle)}
</div>
</div>
{/if}
<div class="col-md-4 col-xs-12 form-group">
<label for="c-order_admin_id" class="control-label col-xs-12 col-sm-2">{:__('合同负责人')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-owner_user_id" data-rule="required" data-source="facrm/common/selectpage/model/admin" data-field="nickname"
class="form-control selectpage" name="row[owner_user_id]" type="text" value="{$row.owner_user_id|htmlentities}" >
</div>
</div>
<div class="col-md-4 col-xs-12 form-group">
<label for="c-remark" class="control-label col-xs-12 col-sm-2">{:__('备注')}:</label>
<div class="col-xs-12 col-sm-8">
<textarea id="c-remark" class="form-control" name="row[remark]">{$row.remark|htmlentities}</textarea>
</div>
</div>
</div>
<div class="panel panel-success">
<div class="panel-heading">
<h4 class="panel-title">
<a data-toggle="collapse"
href="#collapseOne">
<span>{:__('基本信息')}</span>
</a>
</h4>
</div>
<div id="collapseOne" class="panel-collapse collapse in">
<div class="panel-body">
<div class="col-md-4 col-xs-12 form-group">
<label for="c-number" class="control-label col-xs-12 col-sm-2">{:__('合同编号')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-number" data-rule="required" type="text" class="form-control"
name="row[number]" value="{$row.number|htmlentities}" {if
$row.check_status=="2"}disabled{/if}/>
</div>
</div>
<div class="col-md-4 col-xs-12 form-group">
<label for="c-name" class="control-label col-xs-12 col-sm-2">{:__('合同名称')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-name" data-rule="required" type="text" class="form-control" name="row[name]"
value="{$row.name|htmlentities}" {if $row.check_status=="2"}disabled{/if}/>
</div>
</div>
<div class="col-md-4 col-xs-12 form-group">
<label for="c-customer_id" class="control-label col-xs-12 col-sm-2">{:__('选择客户')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-customer_id" data-rule="required"
data-source="facrm/customer/index/selectpage/type/all"
class="form-control selectpage" type="text" value="{$row.customer_id|htmlentities}"
disabled>
</div>
</div>
<div class="col-md-4 col-xs-12 form-group business_id_div">
<label for="c-business_id" class="control-label col-xs-12 col-sm-2">{:__('选择商机')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-business_id" data-rule="required" data-source="facrm/business/index/index"
class="form-control selectpage" name="" type="text"
value="{$row.business_id|htmlentities}" disabled>
</div>
</div>
<div class="col-md-4 col-xs-12 form-group">
<label for="c-money" class="control-label col-xs-12 col-sm-2">{:__('合同金额')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-money" type="number" class="form-control" name="row[money]"
value="{$row.money|htmlentities}" {if $row.check_status=="2"}disabled{/if}/>
</div>
</div>
<div class="col-md-4 col-xs-12 form-group">
<label for="c-order_time" class="control-label col-xs-12 col-sm-2">{:__('下单时间')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-order_time" value="{:datetime($row.order_time)}"
class="form-control datetimepicker" data-date-format="YYYY-MM-DD"
data-use-current="true" name="row[order_time]" type="text" {if
$row.check_status=="2"}disabled{/if}>
</div>
</div>
<div class="col-md-4 col-xs-12 form-group">
<label for="c-start_time"
class="control-label col-xs-12 col-sm-2">{:__('合同开始时间')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-start_time" value="{:datetime($row.start_time)}"
class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm"
data-use-current="true" name="row[start_time]" type="text" {if
$row.check_status=="2"}disabled{/if}>
</div>
</div>
<div class="col-md-4 col-xs-12 form-group">
<label for="c-end_time" class="control-label col-xs-12 col-sm-2">{:__('合同结束时间')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-end_time" value="{:datetime($row.end_time)}"
class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm"
data-use-current="true" name="row[end_time]" type="text" {if
$row.check_status=="2"}disabled{/if}>
</div>
</div>
<div class="col-md-4 col-xs-12 form-group">
<label for="c-contacts_id" class="control-label col-xs-12 col-sm-2">{:__('客户签约人')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-contacts_id" data-source="facrm/contract/index/selectcontact"
class="form-control selectpage" name="row[contacts_id]" type="text"
value="{$row.contacts_id|htmlentities}" {if $row.check_status=="2"}disabled{/if}>
</div>
</div>
<div class="col-md-4 col-xs-12 form-group">
<label for="c-order_admin_id"
class="control-label col-xs-12 col-sm-2">{:__('公司签约人')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-order_admin_id" data-rule="required"
data-source="facrm/common/selectpage/model/admin/type/all" data-field="nickname"
class="form-control selectpage" name="row[order_admin_id]" type="text"
value="{$row.order_admin_id|htmlentities}" {if $row.check_status=="2"}disabled{/if}>
</div>
</div>
{if $row.check_status!="2"}
<div class="col-md-4 col-xs-12 form-group">
<label for="c-flow_admin_id" class="control-label col-xs-12 col-sm-2">{:__('审批人')}:</label>
<div class="col-xs-12 col-sm-8">
{if($flow)}
<input id="c-flow_admin_id" value="{$row.flow_admin_id|htmlentities}"
data-source="facrm/common/selectpage/model/admin/type/all" data-field="nickname"
data-multiple="true" {if $row.check_status=="2"}disabled{/if} {$flow->config==1?'disabled
':'data-rule="required"'}
class="form-control selectpage" name="row[flow_admin_id]" type="text" value="{if
$flow->config==1}{$flow->step[0]['admin_ids']}{/if}">
{else/}
<label class="control-label">审批流程已被删除</label>
{/if}
</div>
</div>
{/if}
{if $row.check_status=="2"}
<div class="col-md-4 col-xs-12 form-group">
<label for="c-expire_handle" class="control-label col-xs-12 col-sm-2">合同过期处理:</label>
<div class="col-xs-12 col-sm-8">
{:build_radios('row[expire_handle]', ['0'=>'未处理', '1'=>'已续签', '2'=>'不再合作'],
$row.expire_handle)}
</div>
</div>
{/if}
<div class="col-md-4 col-xs-12 form-group">
<label for="c-order_admin_id"
class="control-label col-xs-12 col-sm-2">{:__('合同负责人')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-owner_user_id" data-rule="required"
data-source="facrm/common/selectpage/model/admin" data-field="nickname"
class="form-control selectpage" name="row[owner_user_id]" type="text"
value="{$row.owner_user_id|htmlentities}">
</div>
</div>
<div class="col-md-4 col-xs-12 form-group">
<label for="c-remark" class="control-label col-xs-12 col-sm-2">{:__('备注')}:</label>
<div class="col-xs-12 col-sm-8">
<textarea id="c-remark" class="form-control"
name="row[remark]">{$row.remark|htmlentities}</textarea>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('附件')}:</label>
<div class="col-xs-12 col-sm-8">
<div class="input-group">
<input id="c-attachfiles" class="form-control" size="20"
name="row[attachfiles]" type="text" value="{$row.attachfiles|htmlentities}">
<div class="input-group-addon no-border no-padding">
<span><button type="button" id="faupload-attachfiles"
class="btn btn-danger faupload" data-input-id="c-attachfiles"
data-multiple="true" data-preview-id="p-attachfiles"><i
class="fa fa-upload"></i> {:__('Upload')}</button></span>
<span><button type="button" id="fachoose-attachfiles"
class="btn btn-primary fachoose" data-input-id="c-attachfiles"
data-multiple="true"><i
class="fa fa-list"></i> {:__('Choose')}</button></span>
</div>
<span class="msg-box n-right" for="c-attachfiles"></span>
</div>
<ul class="row list-inline faupload-preview" id="p-attachfiles"></ul>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('图片')}:</label>
<div class="col-xs-12 col-sm-8">
<div class="input-group">
<input id="c-smallimages" class="form-control" size="50" name="row[smallimages]"
type="text" value="{$row.smallimages|htmlentities}">
<div class="input-group-addon no-border no-padding">
<span><button type="button" id="plupload-smallimages"
class="btn btn-danger plupload" data-input-id="c-smallimages"
data-multiple="true" data-preview-id="p-smallimages"><i
class="fa fa-upload"></i> {:__('Upload')}</button></span>
<span><button type="button" id="fachoose-smallimages"
class="btn btn-primary fachoose" data-input-id="c-smallimages"
data-multiple="true"><i
class="fa fa-list"></i> {:__('Choose')}</button></span>
</div>
<span class="msg-box n-right" for="c-smallimages"></span>
</div>
<ul class="row list-inline plupload-preview" id="p-smallimages"></ul>
</div>
</div>
</div>
</div>
<div class="panel-group" id="accordion">
<div class="panel panel-info">
</div>
<div class="panel-group" id="accordion">
<div class="panel panel-info">
<div class="panel-heading">
<h4 class="panel-title">
<a data-toggle="collapse"
href="#collapseThree">
合同扩展
合同扩展
</a>
</h4>
</div>
... ... @@ -159,9 +230,9 @@
</div>
</div>
</div>
</div>
</div>
</div>
<div class="row">
... ... @@ -177,7 +248,7 @@
<th>{:__('备注')}</th>
<th>{:__('规格')}</th>
<th>{:__('属性')}</th>
<th >{:__('单位')}</th>
<th>{:__('单位')}</th>
<th>{:__('小计')}</th>
... ... @@ -188,9 +259,9 @@
$allMoney=0;//产品金额小计
{/php}
{foreach name="product_list" item="vo" index="i" }
{foreach name="product_list" item="vo" index="i" }
{php}
$totalnums +=$vo['nums'];
$allMoney+=$vo['subtotal'];
{/php}
... ... @@ -202,20 +273,33 @@
<td>{$i|htmlentities}</td>
<td>{$vo.sku|htmlentities}</td>
<td>
<input date-rule="required;" style="width: 100px" value="{$vo.name|htmlentities}" type="text" name="product[{$i|htmlentities}][name]" data-index="{$i|htmlentities}" class="find" class="" data-toggle="modal" data-target="#modelProduct" {if $row.check_status=="2"}disabled{/if} >
<input type="hidden" name="product[{$i|htmlentities}][product_id]" value="{$vo.product_id|htmlentities}" >
<input type="hidden" name="product[{$i|htmlentities}][sku]" value="{$vo.sku|htmlentities}" >
<input type="hidden" name="product[{$i|htmlentities}][specification]" value="{$vo.specification|htmlentities}" >
<input type="hidden" name="product[{$i|htmlentities}][prop]" value="{$vo.prop|htmlentities}" >
<input type="hidden" name="product[{$i|htmlentities}][unit]" value="{$vo.unit|htmlentities}" >
<input date-rule="required;" style="width: 100px" value="{$vo.name|htmlentities}" type="text"
name="product[{$i|htmlentities}][name]" data-index="{$i|htmlentities}" class="find"
class="" data-toggle="modal" data-target="#modelProduct" {if
$row.check_status=="2"}disabled{/if}>
<input type="hidden" name="product[{$i|htmlentities}][product_id]"
value="{$vo.product_id|htmlentities}">
<input type="hidden" name="product[{$i|htmlentities}][sku]" value="{$vo.sku|htmlentities}">
<input type="hidden" name="product[{$i|htmlentities}][specification]"
value="{$vo.specification|htmlentities}">
<input type="hidden" name="product[{$i|htmlentities}][prop]" value="{$vo.prop|htmlentities}">
<input type="hidden" name="product[{$i|htmlentities}][unit]" value="{$vo.unit|htmlentities}">
</td>
<td>
<input type="number" value="{$vo.nums|htmlentities}" style="width: 80px" name="product[{$i|htmlentities}][nums]" data-rule="required;integer;range(0~);" class="nums" onchange="totalNums(this)" onblur="totalNums(this)" {if $row.check_status=="2"}disabled{/if}>
<input type="number" value="{$vo.nums|htmlentities}" style="width: 80px"
name="product[{$i|htmlentities}][nums]" data-rule="required;integer;range(0~);"
class="nums" onchange="totalNums(this)" onblur="totalNums(this)" {if
$row.check_status=="2"}disabled{/if}>
</td>
<td><input value="{$vo.sales_price|htmlentities}" type="number" style="width: 80px" data-rule="required;range(0~);" onchange="calMoney(this)" onblur="calMoney(this)" class="unit-price" name="product[{$i|htmlentities}][price]" {if $row.check_status=="2"}disabled{/if}>
<input type="hidden" name="product[{$i|htmlentities}][subtotal]" value="{$vo.subtotal|htmlentities}" >
<td><input value="{$vo.sales_price|htmlentities}" type="number" style="width: 80px"
data-rule="required;range(0~);" onchange="calMoney(this)" onblur="calMoney(this)"
class="unit-price" name="product[{$i|htmlentities}][price]" {if
$row.check_status=="2"}disabled{/if}>
<input type="hidden" name="product[{$i|htmlentities}][subtotal]"
value="{$vo.subtotal|htmlentities}">
</td>
<td> <textarea rows="1" class="remarks" name="product[{$i|htmlentities}][remarks]" cols="20" {if $row.check_status=="2"}disabled{/if}>{$vo.remarks|htmlentities}</textarea></td>
<td><textarea rows="1" class="remarks" name="product[{$i|htmlentities}][remarks]" cols="20" {if
$row.check_status=="2"}disabled{/if}>{$vo.remarks|htmlentities}</textarea></td>
<td class="gg">{$vo.specification|htmlentities}</td>
<td>
... ... @@ -235,7 +319,7 @@
<td></td>
<td></td>
<td></td>
<td class="totalnums" >{$totalnums|htmlentities}</td>
<td class="totalnums">{$totalnums|htmlentities}</td>
<td></td>
<td></td>
<td></td>
... ... @@ -254,7 +338,9 @@
<div class="col-md-4 col-xs-12">
<label class="control-label col-xs-12 col-sm-6">{:__('优惠率%')}:</label>
<div class="col-xs-12 col-sm-6">
<input id="c-rate" {if $row.check_status=="2"}disabled{/if} class="form-control" data-rule="required;float;range(0~100);" name="row[discount_rate]" type="number" value="{$row.discount_rate|htmlentities}" onblur="calTotalMoneys()">
<input id="c-rate" {if $row.check_status=="2"}disabled{/if} class="form-control"
data-rule="required;float;range(0~100);" name="row[discount_rate]" type="number"
value="{$row.discount_rate|htmlentities}" onblur="calTotalMoneys()">
</div>
</div>
... ... @@ -262,9 +348,12 @@
<label class="control-label col-xs-12 col-sm-6"> {:__('产品总额 $')}:</label>
<div class="col-xs-12 col-sm-6">
<input id="totalMoneys" class="form-control" name="row[total_price]" {if $row.check_status=="2"}disabled{/if} type="number" value="{$row.total_price|htmlentities}">
<input id="money" style="display: none;" readonly="readonly" type="number" >
<input id="allNums" style="display: none;" name="row[totalNums]" readonly="readonly" type="number" >
<input id="totalMoneys" class="form-control" name="row[total_price]" {if
$row.check_status=="2"}disabled{/if} type="number"
value="{$row.total_price|htmlentities}">
<input id="money" style="display: none;" readonly="readonly" type="number">
<input id="allNums" style="display: none;" name="row[totalNums]" readonly="readonly"
type="number">
</div>
</div>
... ... @@ -278,7 +367,8 @@
<button type="submit" class="btn btn-success btn-embossed disabled">{:__('OK')}</button>
<button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
{if $row.check_status=="2" &&$auth->check('facrm/contract/index/change')}
<a class="btn btn-xs btn-danger btn-dialog" href="facrm/contract/index/change/ids/{$row.id|htmlentities}" data-title="合同更变">{:__('更变')}</a>
<a class="btn btn-xs btn-danger btn-dialog" href="facrm/contract/index/change/ids/{$row.id|htmlentities}"
data-title="合同更变">{:__('更变')}</a>
{/if}
</div>
... ... @@ -291,12 +381,14 @@
<div class="modal-dialog" role="document">
<div class="modal-content" style="padding: 15px;">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span>
</button>
<h4 class="modal-title" id="myModalLabel">{:__('选择产品')}</h4>
</div>
<div class="modal-body">
<div id="lays-row" class="row" >
<table id="table2" class="table table-striped table-bordered table-hover " data-show-export="false" data-show-toggle="false" data-show-columns="false">
<div id="lays-row" class="row">
<table id="table2" class="table table-striped table-bordered table-hover " data-show-export="false"
data-show-toggle="false" data-show-columns="false">
</table>
</div>
</div>
... ... @@ -304,7 +396,11 @@
</div>
</div>
<script>
var contract_id={:intval(input('ids'))};
var contract_id = {
:
intval(input('ids'))
}
;
</script>
... ...
... ... @@ -5,7 +5,7 @@ return [
'default' => 'default', // 默认的队列名称
'host' => '127.0.0.1', // redis 主机ip
'port' => 6379, // redis 端口
'password' => 'jswdwsx888!', // redis 密码
'password' => 'jswdwsx888!', // redis 密码
'select' => 0, // 使用哪一个 db,默认为 db0
'timeout' => 0, // redis连接的超时时间
'persistent' => false,
... ...
... ... @@ -21,7 +21,7 @@ return [
/**
* 可上传的文件类型
*/
'mimetype' => 'jpg,png,bmp,jpeg,gif,webp,zip,rar,wav,mp4,mp3,webm',
'mimetype' => 'jpg,png,bmp,jpeg,gif,webp,zip,rar,wav,mp4,mp3,webm,docx,pdf',
/**
* 是否支持批量上传
*/
... ...
<IfModule mod_rewrite.c>
Options +FollowSymlinks -Multiviews
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]
</IfModule>
open_basedir=/www/wwwroot/CRM/:/tmp/
\ No newline at end of file
define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'template'], function ($, undefined, Backend, Table, Form, Template) {
var Controller = {
index: function () {
// 初始化表格参数配置
Table.api.init({
extend: {
index_url: 'command/index',
add_url: 'command/add',
edit_url: '',
del_url: 'command/del',
multi_url: 'command/multi',
table: 'command',
}
});
var table = $("#table");
// 初始化表格
table.bootstrapTable({
url: $.fn.bootstrapTable.defaults.extend.index_url,
pk: 'id',
sortName: 'id',
columns: [
[
{checkbox: true},
{field: 'id', title: __('Id')},
{field: 'type', title: __('Type'), formatter: Table.api.formatter.search},
{field: 'type_text', title: __('Type')},
{
field: 'command', title: __('Command'), renderDefault: false, formatter: function (value, row, index) {
return '<input type="text" class="form-control" value="' + value + '">';
}
},
{
field: 'executetime',
title: __('Executetime'),
operate: 'RANGE',
addclass: 'datetimerange',
formatter: Table.api.formatter.datetime
},
{
field: 'createtime',
title: __('Createtime'),
operate: 'RANGE',
addclass: 'datetimerange',
formatter: Table.api.formatter.datetime
},
{
field: 'updatetime',
title: __('Updatetime'),
operate: 'RANGE',
addclass: 'datetimerange',
formatter: Table.api.formatter.datetime
},
{
field: 'status',
title: __('Status'),
table: table,
custom: {"successed": 'success', "failured": 'danger'},
searchList: {"successed": __('Successed'), "failured": __('Failured')},
formatter: Table.api.formatter.status
},
{
field: 'operate',
title: __('Operate'),
buttons: [
{
name: 'execute',
title: __('Execute again'),
text: __('Execute again'),
url: 'command/execute',
icon: 'fa fa-repeat',
classname: 'btn btn-success btn-xs btn-execute btn-ajax',
success: function (data) {
Layer.alert("<textarea class='form-control' cols='60' rows='5'>" + data.result + "</textarea>", {
title: __("执行结果"),
shadeClose: true
});
table.bootstrapTable('refresh');
return false;
}
},
{
name: 'execute',
title: __('Detail'),
text: __('Detail'),
url: 'command/detail',
icon: 'fa fa-list',
classname: 'btn btn-info btn-xs btn-execute btn-dialog'
}
],
table: table,
events: Table.api.events.operate,
formatter: Table.api.formatter.operate
}
]
]
});
// 为表格绑定事件
Table.api.bindevent(table);
},
add: function () {
require(['bootstrap-select', 'bootstrap-select-lang']);
var mainfields = [];
var relationfields = {};
var maintable = [];
var relationtable = [];
var relationmode = ["belongsto", "hasone"];
var renderselect = function (select, data) {
var html = [];
for (var i = 0; i < data.length; i++) {
html.push("<option value='" + data[i] + "'>" + data[i] + "</option>");
}
$(select).html(html.join(""));
select.trigger("change");
if (select.data("selectpicker")) {
select.selectpicker('refresh');
}
return select;
};
$("select[name=table] option").each(function () {
maintable.push($(this).val());
});
$(document).on('change', "input[name='isrelation']", function () {
$("#relation-zone").toggleClass("hide", !$(this).prop("checked"));
});
$(document).on('change', "select[name='table']", function () {
var that = this;
Fast.api.ajax({
url: "command/get_field_list",
data: {table: $(that).val()},
}, function (data, ret) {
mainfields = data.fieldlist;
$("#relation-zone .relation-item").remove();
renderselect($("#fields"), mainfields);
return false;
});
return false;
});
$(document).on('click', "a.btn-newrelation", function () {
var that = this;
var index = parseInt($(that).data("index")) + 1;
var content = Template("relationtpl", {index: index});
content = $(content.replace(/\[index\]/, index));
$(this).data("index", index);
$(content).insertBefore($(that).closest(".row"));
$('select', content).selectpicker();
var exists = [$("select[name='table']").val()];
$("select.relationtable").each(function () {
exists.push($(this).val());
});
relationtable = [];
$.each(maintable, function (i, j) {
if ($.inArray(j, exists) < 0) {
relationtable.push(j);
}
});
renderselect($("select.relationtable", content), relationtable);
$("select.relationtable", content).trigger("change");
});
$(document).on('click', "a.btn-removerelation", function () {
$(this).closest(".row").remove();
});
$(document).on('change', "#relation-zone select.relationmode", function () {
var table = $("select.relationtable", $(this).closest(".row")).val();
var that = this;
Fast.api.ajax({
url: "command/get_field_list",
data: {table: table},
}, function (data, ret) {
renderselect($(that).closest(".row").find("select.relationprimarykey"), $(that).val() == 'belongsto' ? data.fieldlist : mainfields);
renderselect($(that).closest(".row").find("select.relationforeignkey"), $(that).val() == 'hasone' ? data.fieldlist : mainfields);
return false;
});
});
$(document).on('change', "#relation-zone select.relationtable", function () {
var that = this;
Fast.api.ajax({
url: "command/get_field_list",
data: {table: $(that).val()},
}, function (data, ret) {
renderselect($(that).closest(".row").find("select.relationmode"), relationmode);
renderselect($(that).closest(".row").find("select.relationfields"), mainfields)
renderselect($(that).closest(".row").find("select.relationforeignkey"), data.fieldlist)
renderselect($(that).closest(".row").find("select.relationfields"), data.fieldlist)
return false;
});
});
$(document).on('click', ".btn-command", function () {
var form = $(this).closest("form");
var textarea = $("textarea[rel=command]", form);
textarea.val('');
Fast.api.ajax({
url: "command/command/action/command",
data: form.serialize(),
}, function (data, ret) {
textarea.val(data.command);
return false;
});
});
$(document).on('click', ".btn-execute", function () {
var form = $(this).closest("form");
var textarea = $("textarea[rel=result]", form);
textarea.val('');
Fast.api.ajax({
url: "command/command/action/execute",
data: form.serialize(),
}, function (data, ret) {
textarea.val(data.result);
window.parent.$(".toolbar .btn-refresh").trigger('click');
top.window.Fast.api.refreshmenu();
return false;
}, function () {
window.parent.$(".toolbar .btn-refresh").trigger('click');
});
});
$("select[name='table']").trigger("change");
Controller.api.bindevent();
},
edit: function () {
Controller.api.bindevent();
},
api: {
bindevent: function () {
Form.api.bindevent($("form[role=form]"));
}
}
};
return Controller;
});
... ...
... ... @@ -214,6 +214,11 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'columntoggle'], func
Controller.index({
index_url: 'facrm/contract/index/lists', 'scene_id': 'owner'
});
},
add: function () {
Controller.api.bindevent();
... ... @@ -606,7 +611,6 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'columntoggle'], func
addclass: 'selectpage',
extend: 'data-source="facrm/common/selectpage/model/admin?type=all" data-field="nickname" data-orderBy="id desc"'
},
{
field: 'check_status',
title: __('Status'),
... ...