作者 黄张义

更新附件

@@ -9,3 +9,14 @@ username = root @@ -9,3 +9,14 @@ username = root
9 password = root 9 password = root
10 hostport = 3306 10 hostport = 3306
11 prefix = fa_ 11 prefix = fa_
  12 +
  13 +[queue]
  14 + 'connector' => 'Redis', // Redis 驱动
  15 + 'expire' => 0, // 任务的过期时间,默认为60秒; 若要禁用,则设置为 null
  16 + 'default' => 'default', // 默认的队列名称
  17 + 'host' => '127.0.0.1', // redis 主机ip
  18 + 'port' => 6379, // redis 端口
  19 + 'password' => '', // redis 密码
  20 + 'select' => 0, // 使用哪一个 db,默认为 db0
  21 + 'timeout' => 0, // redis连接的超时时间
  22 + 'persistent' => false,
  1 +<?php
  2 +
  3 +namespace addons\command;
  4 +
  5 +use app\common\library\Menu;
  6 +use think\Addons;
  7 +
  8 +/**
  9 + * 在线命令插件
  10 + */
  11 +class Command extends Addons
  12 +{
  13 +
  14 + /**
  15 + * 插件安装方法
  16 + * @return bool
  17 + */
  18 + public function install()
  19 + {
  20 + $menu = [
  21 + [
  22 + 'name' => 'command',
  23 + 'title' => '在线命令管理',
  24 + 'icon' => 'fa fa-terminal',
  25 + 'sublist' => [
  26 + ['name' => 'command/index', 'title' => '查看'],
  27 + ['name' => 'command/add', 'title' => '添加'],
  28 + ['name' => 'command/detail', 'title' => '详情'],
  29 + ['name' => 'command/command', 'title' => '生成并执行命令'],
  30 + ['name' => 'command/execute', 'title' => '再次执行命令'],
  31 + ['name' => 'command/del', 'title' => '删除'],
  32 + ['name' => 'command/multi', 'title' => '批量更新'],
  33 + ]
  34 + ]
  35 + ];
  36 + Menu::create($menu);
  37 + return true;
  38 + }
  39 +
  40 + /**
  41 + * 插件卸载方法
  42 + * @return bool
  43 + */
  44 + public function uninstall()
  45 + {
  46 + Menu::delete('command');
  47 + return true;
  48 + }
  49 +
  50 + /**
  51 + * 插件启用方法
  52 + * @return bool
  53 + */
  54 + public function enable()
  55 + {
  56 + Menu::enable('command');
  57 + return true;
  58 + }
  59 +
  60 + /**
  61 + * 插件禁用方法
  62 + * @return bool
  63 + */
  64 + public function disable()
  65 + {
  66 + Menu::disable('command');
  67 + return true;
  68 + }
  69 +
  70 +}
  1 +<?php
  2 +
  3 +return [
  4 +];
  1 +<?php
  2 +
  3 +namespace addons\command\controller;
  4 +
  5 +use think\addons\Controller;
  6 +
  7 +class Index extends Controller
  8 +{
  9 +
  10 + public function index()
  11 + {
  12 + $this->error("当前插件暂无前台页面");
  13 + }
  14 +
  15 +}
  1 +name = command
  2 +title = 在线命令
  3 +intro = 可在线执行一键生成CRUD、一键生成菜单等相关命令
  4 +author = FastAdmin
  5 +website = https://www.fastadmin.net
  6 +version = 1.1.2
  7 +state = 1
  8 +url = /addons/command
  9 +license = regular
  10 +licenseto = 10789
  1 +CREATE TABLE IF NOT EXISTS `__PREFIX__command` (
  2 + `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'ID',
  3 + `type` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '类型',
  4 + `params` varchar(1500) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '参数',
  5 + `command` varchar(1500) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '命令',
  6 + `content` text COMMENT '返回结果',
  7 + `executetime` bigint(16) UNSIGNED DEFAULT NULL COMMENT '执行时间',
  8 + `createtime` bigint(16) UNSIGNED DEFAULT NULL COMMENT '创建时间',
  9 + `updatetime` bigint(16) UNSIGNED DEFAULT NULL COMMENT '更新时间',
  10 + `status` enum('successed','failured') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT 'failured' COMMENT '状态',
  11 + PRIMARY KEY (`id`) USING BTREE
  12 +) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '在线命令表';
  1 +<?php
  2 +
  3 +namespace addons\command\library;
  4 +
  5 +/**
  6 + * Class Output
  7 + */
  8 +class Output extends \think\console\Output
  9 +{
  10 +
  11 + protected $message = [];
  12 +
  13 + public function __construct($driver = 'console')
  14 + {
  15 + parent::__construct($driver);
  16 + }
  17 +
  18 + protected function block($style, $message)
  19 + {
  20 + $this->message[] = $message;
  21 + }
  22 +
  23 + public function getMessage()
  24 + {
  25 + return $this->message;
  26 + }
  27 +
  28 +}
@@ -59,7 +59,8 @@ return array( @@ -59,7 +59,8 @@ return array(
59 })', 59 })',
60 "extend" => 'data-source="facrm/common/selectpage/model/admin?type=all" data-field="nickname" data-orderBy="id desc"', 60 "extend" => 'data-source="facrm/common/selectpage/model/admin?type=all" data-field="nickname" data-orderBy="id desc"',
61 ), 61 ),
62 - 62 + array("field" => 'attachfiles', "title" => "附件", "operate" => 'LIKE', "formatter" => 'Table.api.formatter.files'),
  63 + array("field" => 'smallimages', "title" => "图片", "operate" => 'LIKE', "formatter" => 'Table.api.formatter.images'),
63 array("field" => 'create_time', "title" => '创建时间', "operate" => "RANGE", "sortable" => true, "formatter" => "Table.api.formatter.datetime", "addclass" => "datetimerange", "extend" => 'autocomplete="off" data-time-picker="true"'), 64 array("field" => 'create_time', "title" => '创建时间', "operate" => "RANGE", "sortable" => true, "formatter" => "Table.api.formatter.datetime", "addclass" => "datetimerange", "extend" => 'autocomplete="off" data-time-picker="true"'),
64 array("field" => 'check_status', "title" => '状态', "formatter" => "Table.api.formatter.status", "searchList" => 'check_status'), 65 array("field" => 'check_status', "title" => '状态', "formatter" => "Table.api.formatter.status", "searchList" => 'check_status'),
65 66
  1 +<?php
  2 +
  3 +namespace app\admin\controller;
  4 +
  5 +use app\common\controller\Backend;
  6 +use think\Config;
  7 +use think\console\Input;
  8 +use think\Db;
  9 +use think\Exception;
  10 +
  11 +/**
  12 + * 在线命令管理
  13 + *
  14 + * @icon fa fa-circle-o
  15 + */
  16 +class Command extends Backend
  17 +{
  18 +
  19 + /**
  20 + * Command模型对象
  21 + */
  22 + protected $model = null;
  23 + protected $noNeedRight = ['get_controller_list', 'get_field_list'];
  24 +
  25 + public function _initialize()
  26 + {
  27 + parent::_initialize();
  28 + $this->model = new \app\admin\model\Command;
  29 + $this->view->assign("statusList", $this->model->getStatusList());
  30 + }
  31 +
  32 + /**
  33 + * 添加
  34 + */
  35 + public function add()
  36 + {
  37 +
  38 + $tableList = [];
  39 + $list = \think\Db::query("SHOW TABLES");
  40 + foreach ($list as $key => $row) {
  41 + $tableList[reset($row)] = reset($row);
  42 + }
  43 +
  44 + $this->view->assign("tableList", $tableList);
  45 + return $this->view->fetch();
  46 + }
  47 +
  48 + /**
  49 + * 获取字段列表
  50 + * @internal
  51 + */
  52 + public function get_field_list()
  53 + {
  54 + $dbname = Config::get('database.database');
  55 + $prefix = Config::get('database.prefix');
  56 + $table = $this->request->request('table');
  57 + //从数据库中获取表字段信息
  58 + $sql = "SELECT * FROM `information_schema`.`columns` "
  59 + . "WHERE TABLE_SCHEMA = ? AND table_name = ? "
  60 + . "ORDER BY ORDINAL_POSITION";
  61 + //加载主表的列
  62 + $columnList = Db::query($sql, [$dbname, $table]);
  63 + $fieldlist = [];
  64 + foreach ($columnList as $index => $item) {
  65 + $fieldlist[] = $item['COLUMN_NAME'];
  66 + }
  67 + $this->success("", null, ['fieldlist' => $fieldlist]);
  68 + }
  69 +
  70 + /**
  71 + * 获取控制器列表
  72 + * @internal
  73 + */
  74 + public function get_controller_list()
  75 + {
  76 + //搜索关键词,客户端输入以空格分开,这里接收为数组
  77 + $word = (array)$this->request->request("q_word/a");
  78 + $word = implode('', $word);
  79 +
  80 + $adminPath = dirname(__DIR__) . DS;
  81 + $controllerDir = $adminPath . 'controller' . DS;
  82 + $files = new \RecursiveIteratorIterator(
  83 + new \RecursiveDirectoryIterator($controllerDir), \RecursiveIteratorIterator::LEAVES_ONLY
  84 + );
  85 + $list = [];
  86 + foreach ($files as $name => $file) {
  87 + if (!$file->isDir()) {
  88 + $filePath = $file->getRealPath();
  89 + $name = str_replace($controllerDir, '', $filePath);
  90 + $name = str_replace(DS, "/", $name);
  91 + if (!preg_match("/(.*)\.php\$/", $name)) {
  92 + continue;
  93 + }
  94 + if (!$word || stripos($name, $word) !== false) {
  95 + $list[] = ['id' => $name, 'name' => $name];
  96 + }
  97 + }
  98 + }
  99 + $pageNumber = $this->request->request("pageNumber");
  100 + $pageSize = $this->request->request("pageSize");
  101 + return json(['list' => array_slice($list, ($pageNumber - 1) * $pageSize, $pageSize), 'total' => count($list)]);
  102 + }
  103 +
  104 + /**
  105 + * 详情
  106 + */
  107 + public function detail($ids)
  108 + {
  109 + $row = $this->model->get($ids);
  110 + if (!$row) {
  111 + $this->error(__('No Results were found'));
  112 + }
  113 + $this->view->assign("row", $row);
  114 + return $this->view->fetch();
  115 + }
  116 +
  117 + /**
  118 + * 执行
  119 + */
  120 + public function execute($ids)
  121 + {
  122 + $row = $this->model->get($ids);
  123 + if (!$row) {
  124 + $this->error(__('No Results were found'));
  125 + }
  126 + $result = $this->doexecute($row['type'], json_decode($row['params'], true));
  127 + $this->success("", null, ['result' => $result]);
  128 + }
  129 +
  130 + /**
  131 + * 生成命令
  132 + */
  133 + public function command($action = '')
  134 + {
  135 + $commandtype = $this->request->request("commandtype");
  136 + $params = $this->request->request();
  137 + $allowfields = [
  138 + 'crud' => 'table,controller,model,fields,force,local,delete,menu',
  139 + 'menu' => 'controller,delete,force',
  140 + 'min' => 'module,resource,optimize',
  141 + 'api' => 'url,module,output,template,force,title,author,class,language,addon',
  142 + ];
  143 + $argv = [];
  144 + $allowfields = isset($allowfields[$commandtype]) ? explode(',', $allowfields[$commandtype]) : [];
  145 + $allowfields = array_filter(array_intersect_key($params, array_flip($allowfields)));
  146 + if (isset($params['local']) && !$params['local']) {
  147 + $allowfields['local'] = $params['local'];
  148 + } else {
  149 + unset($allowfields['local']);
  150 + }
  151 + foreach ($allowfields as $key => $param) {
  152 + $argv[] = "--{$key}=" . (is_array($param) ? implode(',', $param) : $param);
  153 + }
  154 + if ($commandtype == 'crud') {
  155 + $extend = 'setcheckboxsuffix,enumradiosuffix,imagefield,filefield,intdatesuffix,switchsuffix,citysuffix,selectpagesuffix,selectpagessuffix,ignorefields,sortfield,editorsuffix,headingfilterfield,tagsuffix,jsonsuffix,fixedcolumns';
  156 + $extendArr = explode(',', $extend);
  157 + foreach ($params as $index => $item) {
  158 + if (in_array($index, $extendArr)) {
  159 + foreach (explode(',', $item) as $key => $value) {
  160 + if ($value) {
  161 + $argv[] = "--{$index}={$value}";
  162 + }
  163 + }
  164 + }
  165 + }
  166 + $isrelation = (int)$this->request->request('isrelation');
  167 + if ($isrelation && isset($params['relation'])) {
  168 + foreach ($params['relation'] as $index => $relation) {
  169 + foreach ($relation as $key => $value) {
  170 + $argv[] = "--{$key}=" . (is_array($value) ? implode(',', $value) : $value);
  171 + }
  172 + }
  173 + }
  174 + } else {
  175 + if ($commandtype == 'menu') {
  176 + if (isset($params['allcontroller']) && $params['allcontroller']) {
  177 + $argv[] = "--controller=all-controller";
  178 + } else {
  179 + foreach (explode(',', $params['controllerfile']) as $index => $param) {
  180 + if ($param) {
  181 + $argv[] = "--controller=" . substr($param, 0, -4);
  182 + }
  183 + }
  184 + }
  185 + } else {
  186 + if ($commandtype == 'min') {
  187 +
  188 + } else {
  189 + if ($commandtype == 'api') {
  190 +
  191 + } else {
  192 +
  193 + }
  194 + }
  195 + }
  196 + }
  197 + if ($action == 'execute') {
  198 + if (stripos(implode(' ', $argv), '--controller=all-controller') !== false) {
  199 + $this->error("只允许在命令行执行该命令,执行前请做好菜单规则备份!!!");
  200 + }
  201 + if (config('app_debug')) {
  202 + $result = $this->doexecute($commandtype, $argv);
  203 + $this->success("", null, ['result' => $result]);
  204 + } else {
  205 + $this->error("只允许在开发环境下执行命令");
  206 + }
  207 + } else {
  208 + $this->success("", null, ['command' => "php think {$commandtype} " . implode(' ', $argv)]);
  209 + }
  210 +
  211 + return;
  212 + }
  213 +
  214 + protected function doexecute($commandtype, $argv)
  215 + {
  216 + if (!config('app_debug')) {
  217 + $this->error("只允许在开发环境下执行命令");
  218 + }
  219 + if (preg_match("/([;\|&]+)/", implode(' ', $argv))) {
  220 + $this->error("不支持的命令参数");
  221 + }
  222 + $commandName = "\\app\\admin\\command\\" . ucfirst($commandtype);
  223 + $input = new Input($argv);
  224 + $output = new \addons\command\library\Output();
  225 + $command = new $commandName($commandtype);
  226 + $data = [
  227 + 'type' => $commandtype,
  228 + 'params' => json_encode($argv),
  229 + 'command' => "php think {$commandtype} " . implode(' ', $argv),
  230 + 'executetime' => time(),
  231 + ];
  232 + $this->model->save($data);
  233 + try {
  234 + $command->run($input, $output);
  235 + $result = implode("\n", $output->getMessage());
  236 + $this->model->status = 'successed';
  237 + } catch (Exception $e) {
  238 + $result = implode("\n", $output->getMessage()) . "\n";
  239 + $result .= $e->getMessage();
  240 + $this->model->status = 'failured';
  241 + }
  242 + $result = trim($result);
  243 + $this->model->content = $result;
  244 + $this->model->save();
  245 + return $result;
  246 + }
  247 +
  248 +}
  1 +<?php
  2 +
  3 +return [
  4 + 'Id' => 'ID',
  5 + 'Type' => '类型',
  6 + 'Params' => '参数',
  7 + 'Command' => '命令',
  8 + 'Content' => '返回结果',
  9 + 'Executetime' => '执行时间',
  10 + 'Createtime' => '创建时间',
  11 + 'Updatetime' => '更新时间',
  12 + 'Execute again' => '再次执行',
  13 + 'Successed' => '成功',
  14 + 'Failured' => '失败',
  15 + 'Status' => '状态'
  16 +];
  1 +<?php
  2 +
  3 +namespace app\admin\model;
  4 +
  5 +use think\Model;
  6 +
  7 +class Command extends Model
  8 +{
  9 + // 表名
  10 + protected $name = 'command';
  11 +
  12 + // 自动写入时间戳字段
  13 + protected $autoWriteTimestamp = 'int';
  14 +
  15 + // 定义时间戳字段名
  16 + protected $createTime = 'createtime';
  17 + protected $updateTime = 'updatetime';
  18 +
  19 + // 追加属性
  20 + protected $append = [
  21 + 'executetime_text',
  22 + 'type_text',
  23 + 'status_text'
  24 + ];
  25 +
  26 +
  27 + public function getStatusList()
  28 + {
  29 + return ['successed' => __('Successed'), 'failured' => __('Failured')];
  30 + }
  31 +
  32 +
  33 + public function getExecutetimeTextAttr($value, $data)
  34 + {
  35 + $value = $value ? $value : $data['executetime'];
  36 + return is_numeric($value) ? date("Y-m-d H:i:s", $value) : $value;
  37 + }
  38 +
  39 + public function getTypeTextAttr($value, $data)
  40 + {
  41 + $value = $value ? $value : $data['type'];
  42 + $list = ['crud' => '一键生成CRUD', 'menu' => '一键生成菜单', 'min' => '一键压缩打包', 'api' => '一键生成文档'];
  43 + return $list[$value] ?? '';
  44 + }
  45 +
  46 + public function getStatusTextAttr($value, $data)
  47 + {
  48 + $value = $value ? $value : $data['status'];
  49 + $list = $this->getStatusList();
  50 + return $list[$value] ?? '';
  51 + }
  52 +
  53 + protected function setExecutetimeAttr($value)
  54 + {
  55 + return $value && !is_numeric($value) ? strtotime($value) : $value;
  56 + }
  57 +
  58 +
  59 +}
@@ -407,7 +407,10 @@ class Fields extends Model @@ -407,7 +407,10 @@ class Fields extends Model
407 407
408 if (!extension_loaded('redis')) { 408 if (!extension_loaded('redis')) {
409 $order=\app\admin\model\facrm\Setting::where('key',$cache_key)->value("values"); 409 $order=\app\admin\model\facrm\Setting::where('key',$cache_key)->value("values");
  410 +
410 $order=$order?json_decode($order):[]; 411 $order=$order?json_decode($order):[];
  412 +
  413 +
411 } else { 414 } else {
412 $queue_config=\think\Config::get('queue'); 415 $queue_config=\think\Config::get('queue');
413 $redis_cache = \think\Cache::connect([ 416 $redis_cache = \think\Cache::connect([
@@ -417,6 +420,7 @@ class Fields extends Model @@ -417,6 +420,7 @@ class Fields extends Model
417 'port'=>isset($queue_config['port'])?$queue_config['port']:'6379' 420 'port'=>isset($queue_config['port'])?$queue_config['port']:'6379'
418 ]); 421 ]);
419 $order = $redis_cache->get($cache_key); 422 $order = $redis_cache->get($cache_key);
  423 +
420 } 424 }
421 425
422 $fields = \app\admin\model\facrm\Fields::getCustomFieldsTable($type, [], 'isfilter=1 or islist=1'); 426 $fields = \app\admin\model\facrm\Fields::getCustomFieldsTable($type, [], 'isfilter=1 or islist=1');
  1 +<?php
  2 +
  3 +namespace app\admin\validate;
  4 +
  5 +use think\Validate;
  6 +
  7 +class Command extends Validate
  8 +{
  9 + /**
  10 + * 验证规则
  11 + */
  12 + protected $rule = [
  13 + ];
  14 + /**
  15 + * 提示消息
  16 + */
  17 + protected $message = [
  18 + ];
  19 + /**
  20 + * 验证场景
  21 + */
  22 + protected $scene = [
  23 + 'add' => [],
  24 + 'edit' => [],
  25 + ];
  26 +
  27 +}
  1 +<style>
  2 + .relation-item {margin-top:10px;}
  3 + legend {padding-bottom:5px;font-size:14px;font-weight:600;}
  4 + label {font-weight:normal;}
  5 + .form-control{padding:6px 8px;}
  6 + #extend-zone .col-xs-2 {margin-top:10px;padding-right:0;}
  7 + #extend-zone .col-xs-2:nth-child(6n+0) {padding-right:15px;}
  8 +</style>
  9 +<div class="panel panel-default panel-intro">
  10 + <div class="panel-heading">
  11 + <ul class="nav nav-tabs">
  12 + <li class="active"><a href="#crud" data-toggle="tab">{:__('一键生成CRUD')}</a></li>
  13 + <li><a href="#menu" data-toggle="tab">{:__('一键生成菜单')}</a></li>
  14 + <li><a href="#min" data-toggle="tab">{:__('一键压缩打包')}</a></li>
  15 + <li><a href="#api" data-toggle="tab">{:__('一键生成API文档')}</a></li>
  16 + </ul>
  17 + </div>
  18 + <div class="panel-body">
  19 + <div id="myTabContent" class="tab-content">
  20 + <div class="tab-pane fade active in" id="crud">
  21 + <div class="row">
  22 + <div class="col-xs-12">
  23 + <form role="form">
  24 + <input type="hidden" name="commandtype" value="crud" />
  25 + <div class="form-group">
  26 + <div class="row">
  27 + <div class="col-xs-3">
  28 + <input checked="" name="isrelation" type="hidden" value="0">
  29 + <label class="control-label" data-toggle="tooltip" title="当前只支持生成1对1关联模型,选中后请配置关联表和字段">
  30 + <input name="isrelation" type="checkbox" value="1">
  31 + 关联模型
  32 + </label>
  33 + </div>
  34 + <div class="col-xs-3">
  35 + <input checked="" name="local" type="hidden" value="1">
  36 + <label class="control-label" data-toggle="tooltip" title="默认模型生成在application/admin/model目录下,选中后将生成在application/common/model目录下">
  37 + <input name="local" type="checkbox" value="0"> 全局模型类
  38 + </label>
  39 + </div>
  40 + <div class="col-xs-3">
  41 + <input checked="" name="delete" type="hidden" value="0">
  42 + <label class="control-label" data-toggle="tooltip" title="删除CRUD生成的相关文件">
  43 + <input name="delete" type="checkbox" value="1"> 删除模式
  44 + </label>
  45 + </div>
  46 + <div class="col-xs-3">
  47 + <input checked="" name="force" type="hidden" value="0">
  48 + <label class="control-label" data-toggle="tooltip" title="选中后,如果已经存在同名文件将被覆盖。如果是删除将不再提醒">
  49 + <input name="force" type="checkbox" value="1">
  50 + 强制覆盖模式
  51 + </label>
  52 + </div>
  53 + <!--
  54 + <div class="col-xs-3">
  55 + <input checked="" name="menu" type="hidden" value="0">
  56 + <label class="control-label" data-toggle="tooltip" title="选中后,将同时生成后台菜单规则">
  57 + <input name="menu" type="checkbox" value="1">
  58 + 生成菜单
  59 + </label>
  60 + </div>
  61 + -->
  62 + </div>
  63 + </div>
  64 + <div class="form-group">
  65 + <legend>主表设置</legend>
  66 + <div class="row">
  67 + <div class="col-xs-3">
  68 + <label>请选择主表</label>
  69 + {:build_select('table',$tableList,null,['class'=>'form-control selectpicker', 'data-live-search'=>'true']);}
  70 + </div>
  71 + <div class="col-xs-3">
  72 + <label>自定义控制器名</label>
  73 + <input type="text" class="form-control" name="controller" data-toggle="tooltip" title="默认根据表名自动生成,如果需要放在二级目录请手动填写" placeholder="支持目录层级,以/分隔">
  74 + </div>
  75 + <div class="col-xs-3">
  76 + <label>自定义模型名</label>
  77 + <input type="text" class="form-control" name="model" data-toggle="tooltip" title="默认根据表名自动生成" placeholder="不支持目录层级">
  78 + </div>
  79 + <div class="col-xs-3">
  80 + <label>显示字段(默认全部)</label>
  81 + <select name="fields[]" id="fields" multiple style="height:30px;" class="form-control selectpicker"></select>
  82 + </div>
  83 +
  84 + </div>
  85 +
  86 + </div>
  87 +
  88 + <div class="form-group hide" id="relation-zone">
  89 + <legend>关联表设置</legend>
  90 +
  91 + <div class="row" style="margin-top:15px;">
  92 + <div class="col-xs-12">
  93 + <a href="javascript:;" class="btn btn-primary btn-sm btn-newrelation" data-index="1">追加关联模型</a>
  94 + </div>
  95 + </div>
  96 + </div>
  97 +
  98 + <hr>
  99 + <div class="form-group" id="extend-zone">
  100 + <legend>字段识别设置 <span style="font-size:12px;font-weight: normal;">(与之匹配的字段都将生成相应组件)</span></legend>
  101 + <div class="row">
  102 + <div class="col-xs-2">
  103 + <label>复选框后缀</label>
  104 + <input type="text" class="form-control" name="setcheckboxsuffix" placeholder="默认为set类型" />
  105 + </div>
  106 + <div class="col-xs-2">
  107 + <label>单选框后缀</label>
  108 + <input type="text" class="form-control" name="enumradiosuffix" placeholder="默认为enum类型" />
  109 + </div>
  110 + <div class="col-xs-2">
  111 + <label>图片类型后缀</label>
  112 + <input type="text" class="form-control" name="imagefield" placeholder="默认为image,images,avatar,avatars" />
  113 + </div>
  114 + <div class="col-xs-2">
  115 + <label>文件类型后缀</label>
  116 + <input type="text" class="form-control" name="filefield" placeholder="默认为file,files" />
  117 + </div>
  118 + <div class="col-xs-2">
  119 + <label>日期时间后缀</label>
  120 + <input type="text" class="form-control" name="intdatesuffix" placeholder="默认为time" />
  121 + </div>
  122 + <div class="col-xs-2">
  123 + <label>开关后缀</label>
  124 + <input type="text" class="form-control" name="switchsuffix" placeholder="默认为switch" />
  125 + </div>
  126 + <div class="col-xs-2">
  127 + <label>城市选择后缀</label>
  128 + <input type="text" class="form-control" name="citysuffix" placeholder="默认为city" />
  129 + </div>
  130 + <div class="col-xs-2">
  131 + <label>动态下拉后缀(单)</label>
  132 + <input type="text" class="form-control" name="selectpagesuffix" placeholder="默认为_id" />
  133 + </div>
  134 + <div class="col-xs-2">
  135 + <label>动态下拉后缀(多)</label>
  136 + <input type="text" class="form-control" name="selectpagessuffix" placeholder="默认为_ids" />
  137 + </div>
  138 + <div class="col-xs-2">
  139 + <label>忽略的字段</label>
  140 + <input type="text" class="form-control" name="ignorefields" placeholder="默认无" />
  141 + </div>
  142 + <div class="col-xs-2">
  143 + <label>排序字段</label>
  144 + <input type="text" class="form-control" name="sortfield" placeholder="默认为weigh" />
  145 + </div>
  146 + <div class="col-xs-2">
  147 + <label>富文本编辑器</label>
  148 + <input type="text" class="form-control" name="editorsuffix" placeholder="默认为content" />
  149 + </div>
  150 + <div class="col-xs-2">
  151 + <label>选项卡过滤字段</label>
  152 + <input type="text" class="form-control" name="headingfilterfield" placeholder="默认为status" />
  153 + </div>
  154 + <div class="col-xs-2">
  155 + <label>标签后缀 <i class="fa fa-info-circle" data-toggle="tooltip" data-title="只支持1.3.0+版本"></i></label>
  156 + <input type="text" class="form-control" name="tagsuffix" placeholder="默认为tag,tags" />
  157 + </div>
  158 + <div class="col-xs-2">
  159 + <label>JSON后缀 <i class="fa fa-info-circle" data-toggle="tooltip" data-title="只支持1.3.0+版本"></i></label>
  160 + <input type="text" class="form-control" name="jsonsuffix" placeholder="默认为json" />
  161 + </div>
  162 + <div class="col-xs-2">
  163 + <label>固定列数量 <i class="fa fa-info-circle" data-toggle="tooltip" data-title="只支持1.3.0+版本,大于0时为右侧固定列数量,小于0时为左侧固定列数量"></i></label>
  164 + <input type="text" class="form-control" name="fixedcolumns" placeholder="默认不启用" />
  165 + </div>
  166 +
  167 + </div>
  168 +
  169 + </div>
  170 +
  171 + <div class="form-group">
  172 + <legend>生成命令行</legend>
  173 + <textarea class="form-control" data-toggle="tooltip" title="如果在线执行命令失败,可以将命令复制到命令行进行执行" rel="command" rows="1" placeholder="请点击生成命令行"></textarea>
  174 + </div>
  175 +
  176 + <div class="form-group">
  177 + <legend>返回结果</legend>
  178 + <textarea class="form-control" rel="result" rows="5" placeholder="请点击立即执行"></textarea>
  179 + </div>
  180 +
  181 + <div class="form-group">
  182 + <button type="button" class="btn btn-info btn-embossed btn-command">{:__('生成命令行')}</button>
  183 + <button type="button" class="btn btn-success btn-embossed btn-execute">{:__('立即执行')}</button>
  184 + </div>
  185 +
  186 + </form>
  187 + </div>
  188 + </div>
  189 + </div>
  190 + <div class="tab-pane fade" id="menu">
  191 + <div class="row">
  192 + <div class="col-xs-12">
  193 + <form role="form">
  194 + <input type="hidden" name="commandtype" value="menu" />
  195 + <div class="form-group">
  196 + <div class="row">
  197 + <div class="col-xs-3">
  198 + <input checked="" name="allcontroller" type="hidden" value="0">
  199 + <label class="control-label" data-toggle="tooltip" title="将删除全部的菜单规则,重新按控制器进行生成,请做好备份,谨慎选择">
  200 + <input name="allcontroller" data-toggle="collapse" data-target="#controller" type="checkbox" value="1"> 一键生成全部控制器
  201 + </label>
  202 + </div>
  203 + <div class="col-xs-3">
  204 + <input checked="" name="delete" type="hidden" value="0">
  205 + <label class="control-label" data-toggle="tooltip" title="删除控制器菜单规则">
  206 + <input name="delete" type="checkbox" value="1"> 删除模式
  207 + </label>
  208 + </div>
  209 + <div class="col-xs-3">
  210 + <input checked="" name="force" type="hidden" value="0">
  211 + <label class="control-label" data-toggle="tooltip" title="如果菜单规则已经存在则覆盖">
  212 + <input name="force" type="checkbox" value="1"> 强制覆盖模式
  213 + </label>
  214 + </div>
  215 + </div>
  216 + </div>
  217 +
  218 + <div class="form-group in" id="controller">
  219 + <legend>控制器设置</legend>
  220 +
  221 + <div class="row" style="margin-top:15px;">
  222 + <div class="col-xs-12">
  223 + <input type="text" name="controllerfile" class="form-control selectpage" style="width:720px;" data-source="command/get_controller_list" data-multiple="true" name="controller" placeholder="请选择控制器" />
  224 + </div>
  225 + </div>
  226 + </div>
  227 +
  228 + <div class="form-group">
  229 + <legend>生成命令行</legend>
  230 + <textarea class="form-control" rel="command" rows="1" placeholder="请点击生成命令行"></textarea>
  231 + </div>
  232 +
  233 + <div class="form-group">
  234 + <legend>返回结果</legend>
  235 + <textarea class="form-control" rel="result" rows="5" placeholder="请点击立即执行"></textarea>
  236 + </div>
  237 +
  238 + <div class="form-group">
  239 + <button type="button" class="btn btn-info btn-embossed btn-command">{:__('生成命令行')}</button>
  240 + <button type="button" class="btn btn-success btn-embossed btn-execute">{:__('立即执行')}</button>
  241 + </div>
  242 +
  243 + </form>
  244 + </div>
  245 + </div>
  246 + </div>
  247 + <div class="tab-pane fade" id="min">
  248 + <div class="row">
  249 + <div class="col-xs-12">
  250 + <form role="form">
  251 + <input type="hidden" name="commandtype" value="min" />
  252 + <div class="form-group">
  253 + <legend>基础设置</legend>
  254 + <div class="row">
  255 + <div class="col-xs-3">
  256 + <label>请选择压缩模块</label>
  257 + <select name="module" class="form-control selectpicker">
  258 + <option value="all" selected>全部</option>
  259 + <option value="backend">后台Backend</option>
  260 + <option value="frontend">前台Frontend</option>
  261 + </select>
  262 + </div>
  263 + <div class="col-xs-3">
  264 + <label>请选择压缩资源</label>
  265 + <select name="resource" class="form-control selectpicker">
  266 + <option value="all" selected>全部</option>
  267 + <option value="js">JS</option>
  268 + <option value="css">CSS</option>
  269 + </select>
  270 + </div>
  271 + <div class="col-xs-3">
  272 + <label>请选择压缩模式</label>
  273 + <select name="optimize" class="form-control selectpicker">
  274 + <option value=""></option>
  275 + <option value="uglify">uglify</option>
  276 + <option value="closure">closure</option>
  277 + </select>
  278 + </div>
  279 + </div>
  280 + </div>
  281 +
  282 + <div class="form-group">
  283 + <legend>生成命令行</legend>
  284 + <textarea class="form-control" rel="command" rows="1" placeholder="请点击生成命令行"></textarea>
  285 + </div>
  286 +
  287 + <div class="form-group">
  288 + <legend>返回结果</legend>
  289 + <textarea class="form-control" rel="result" rows="5" placeholder="请点击立即执行"></textarea>
  290 + </div>
  291 +
  292 + <div class="form-group">
  293 + <button type="button" class="btn btn-info btn-embossed btn-command">{:__('生成命令行')}</button>
  294 + <button type="button" class="btn btn-success btn-embossed btn-execute">{:__('立即执行')}</button>
  295 + </div>
  296 +
  297 + </form>
  298 + </div>
  299 + </div>
  300 + </div>
  301 + <div class="tab-pane fade" id="api">
  302 + <div class="row">
  303 + <div class="col-xs-12">
  304 + <form role="form">
  305 + <input type="hidden" name="commandtype" value="api" />
  306 + <div class="form-group">
  307 + <div class="row">
  308 + <div class="col-xs-3">
  309 + <input checked="" name="force" type="hidden" value="0">
  310 + <label class="control-label" data-toggle="tooltip" title="如果已经存在则覆盖">
  311 + <input name="force" type="checkbox" value="1">
  312 + 覆盖模式
  313 + </label>
  314 + </div>
  315 + </div>
  316 + </div>
  317 + <div class="form-group">
  318 + <legend>文档设置</legend>
  319 + <div class="row">
  320 + <div class="col-xs-3">
  321 + <label>请输入接口URL</label>
  322 + <input type="text" name="url" class="form-control" placeholder="API URL,可留空" />
  323 + </div>
  324 + <div class="col-xs-3">
  325 + <label>接口生成文件</label>
  326 + <input type="text" name="output" class="form-control" placeholder="留空则使用api.html" />
  327 + </div>
  328 + <div class="col-xs-3">
  329 + <label>模板文件</label>
  330 + <input type="text" name="template" class="form-control" placeholder="如果不清楚请留空" />
  331 + </div>
  332 + <div class="col-xs-3">
  333 + <label>文档语言</label>
  334 + <select name="language" class="form-control">
  335 + <option value="" selected>请选择语言</option>
  336 + <option value="zh-cn">中文</option>
  337 + <option value="en">英文</option>
  338 + </select>
  339 + </div>
  340 + </div>
  341 + <div class="row" style="margin-top:10px;">
  342 + <div class="col-xs-3">
  343 + <label>文档标题</label>
  344 + <input type="text" name="title" class="form-control" placeholder="默认为{$site.name}" />
  345 + </div>
  346 + <div class="col-xs-3">
  347 + <label>文档作者</label>
  348 + <input type="text" name="author" class="form-control" placeholder="默认为{$site.name}" />
  349 + </div>
  350 + <div class="col-xs-3">
  351 + <label>生成模块</label>
  352 + <select name="module" class="form-control selectpicker">
  353 + <option value="" selected>请选择模块</option>
  354 + <option value="api">API</option>
  355 + <option value="backend">后台</option>
  356 + <option value="frontend">前台</option>
  357 + </select>
  358 + </div>
  359 + <div class="col-xs-3">
  360 + <label>生成插件文档</label>
  361 + <select name="addon" class="form-control selectpicker" data-live-search="true">
  362 + <option value="" selected>请选择插件</option>
  363 + {foreach name=":get_addon_list()" id="item"}
  364 + <option value="{$item.name}">{$item.title}</option>
  365 + {/foreach}
  366 + </select>
  367 + </div>
  368 + </div>
  369 + </div>
  370 +
  371 + <div class="form-group">
  372 + <legend>生成命令行</legend>
  373 + <textarea class="form-control" rel="command" rows="1" placeholder="请点击生成命令行"></textarea>
  374 + </div>
  375 +
  376 + <div class="form-group">
  377 + <legend>返回结果</legend>
  378 + <textarea class="form-control" rel="result" rows="5" placeholder="请点击立即执行"></textarea>
  379 + </div>
  380 +
  381 + <div class="form-group">
  382 + <button type="button" class="btn btn-info btn-embossed btn-command">{:__('生成命令行')}</button>
  383 + <button type="button" class="btn btn-success btn-embossed btn-execute">{:__('立即执行')}</button>
  384 + </div>
  385 +
  386 + </form>
  387 + </div>
  388 + </div>
  389 + </div>
  390 + </div>
  391 + </div>
  392 +</div>
  393 +<script id="relationtpl" type="text/html">
  394 + <div class="row relation-item">
  395 + <div class="col-xs-2">
  396 + <label>请选择关联表</label>
  397 + <select name="relation[<%=index%>][relation]" class="form-control relationtable" data-live-search="true"></select>
  398 + </div>
  399 + <div class="col-xs-2">
  400 + <label>请选择关联类型</label>
  401 + <select name="relation[<%=index%>][relationmode]" class="form-control relationmode"></select>
  402 + </div>
  403 + <div class="col-xs-2">
  404 + <label>关联外键</label>
  405 + <select name="relation[<%=index%>][relationforeignkey]" class="form-control relationforeignkey"></select>
  406 + </div>
  407 + <div class="col-xs-2">
  408 + <label>关联主键</label>
  409 + <select name="relation[<%=index%>][relationprimarykey]" class="form-control relationprimarykey"></select>
  410 + </div>
  411 + <div class="col-xs-2">
  412 + <label>请选择显示字段</label>
  413 + <select name="relation[<%=index%>][relationfields][]" multiple class="form-control relationfields"></select>
  414 + </div>
  415 + <div class="col-xs-2">
  416 + <label>&nbsp;</label>
  417 + <a href="javascript:;" class="btn btn-danger btn-block btn-removerelation">移除</a>
  418 + </div>
  419 + </div>
  420 +</script>
  1 +<table class="table table-striped">
  2 + <thead>
  3 + <tr>
  4 + <th>{:__('Title')}</th>
  5 + <th>{:__('Content')}</th>
  6 + </tr>
  7 + </thead>
  8 + <tbody>
  9 + <tr>
  10 + <td>{:__('Type')}</td>
  11 + <td>{$row.type}({$row.type_text})</td>
  12 + </tr>
  13 + <tr>
  14 + <td>{:__('Params')}</td>
  15 + <td>{$row.params|htmlentities}</td>
  16 + </tr>
  17 + <tr>
  18 + <td>{:__('Command')}</td>
  19 + <td>{$row.command|htmlentities}</td>
  20 + </tr>
  21 + <tr>
  22 + <td>{:__('Content')}</td>
  23 + <td>
  24 + <textarea class="form-control" name="" id="" cols="60" rows="10">{$row.content|htmlentities}</textarea>
  25 + </td>
  26 + </tr>
  27 + <tr>
  28 + <td>{:__('Executetime')}</td>
  29 + <td>{$row.executetime|datetime}</td>
  30 + </tr>
  31 + <tr>
  32 + <td>{:__('Status')}</td>
  33 + <td>{$row.status_text}</td>
  34 + </tr>
  35 + </tbody>
  36 +</table>
  37 +<div class="hide layer-footer">
  38 + <label class="control-label col-xs-12 col-sm-2"></label>
  39 + <div class="col-xs-12 col-sm-8">
  40 + <button type="reset" class="btn btn-primary btn-embossed btn-close" onclick="Layer.closeAll();">{:__('Close')}</button>
  41 + </div>
  42 +</div>
  1 +<div class="panel panel-default panel-intro">
  2 + {:build_heading()}
  3 +
  4 + <div class="panel-body">
  5 + <div id="myTabContent" class="tab-content">
  6 + <div class="tab-pane fade active in" id="one">
  7 + <div class="widget-body no-padding">
  8 + <div id="toolbar" class="toolbar">
  9 + <a href="javascript:;" class="btn btn-primary btn-refresh" title="{:__('Refresh')}" ><i class="fa fa-refresh"></i> </a>
  10 + <a href="javascript:;" class="btn btn-success btn-add {:$auth->check('command/add')?'':'hide'}" title="{:__('Add')}" ><i class="fa fa-plus"></i> {:__('Add')}</a>
  11 + <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>
  12 +
  13 + </div>
  14 + <table id="table" class="table table-striped table-bordered table-hover"
  15 + data-operate-detail="{:$auth->check('command/detail')}"
  16 + data-operate-execute="{:$auth->check('command/execute')}"
  17 + data-operate-del="{:$auth->check('command/del')}"
  18 + width="100%">
  19 + </table>
  20 + </div>
  21 + </div>
  22 +
  23 + </div>
  24 + </div>
  25 +</div>
1 <style> 1 <style>
2 - .form-group .col-sm-2{ 2 + .form-group .col-sm-2 {
3 min-width: 120px; 3 min-width: 120px;
4 } 4 }
5 5
@@ -22,30 +22,34 @@ @@ -22,30 +22,34 @@
22 22
23 <div class="col-md-4 col-xs-12 form-group"> 23 <div class="col-md-4 col-xs-12 form-group">
24 <label class="control-label col-xs-12 col-sm-2">{:__('合同编号')}:</label> 24 <label class="control-label col-xs-12 col-sm-2">{:__('合同编号')}:</label>
25 - <div class="col-xs-12 col-sm-8"style="height: 30px;"> 25 + <div class="col-xs-12 col-sm-8" style="height: 30px;">
26 <div class="input-group"> 26 <div class="input-group">
27 - <input id="c-number" data-rule="required" type="text" class="form-control" name="row[number]" value="{$cprefix|htmlentities}"/> 27 + <input id="c-number" data-rule="required" type="text" class="form-control"
  28 + name="row[number]" value="{$cprefix|htmlentities}"/>
28 <div class="input-group-addon no-border no-padding"> 29 <div class="input-group-addon no-border no-padding">
29 - <span><button type="button" id="number-create" class="btn btn-primary " > {:__('生成')}</button></span> 30 + <span><button type="button" id="number-create"
  31 + class="btn btn-primary "> {:__('生成')}</button></span>
30 </div> 32 </div>
31 </div> 33 </div>
32 34
33 35
34 -  
35 </div> 36 </div>
36 </div> 37 </div>
37 <div class="col-md-4 col-xs-12 form-group"> 38 <div class="col-md-4 col-xs-12 form-group">
38 <label for="c-name" class="control-label col-xs-12 col-sm-2">{:__('合同名称')}:</label> 39 <label for="c-name" class="control-label col-xs-12 col-sm-2">{:__('合同名称')}:</label>
39 <div class="col-xs-12 col-sm-8"> 40 <div class="col-xs-12 col-sm-8">
40 - <input id="c-name" data-rule="required" type="text" class="form-control" name="row[name]" value="{:isset($customer)?htmlentities($customer.name).'合同':''}"/> 41 + <input id="c-name" data-rule="required" type="text" class="form-control" name="row[name]"
  42 + value="{:isset($customer)?htmlentities($customer.name).'合同':''}"/>
41 </div> 43 </div>
42 </div> 44 </div>
43 45
44 <div class="col-md-4 col-xs-12 form-group"> 46 <div class="col-md-4 col-xs-12 form-group">
45 <label for="c-customer_id" class="control-label col-xs-12 col-sm-2">{:__('选择客户')}:</label> 47 <label for="c-customer_id" class="control-label col-xs-12 col-sm-2">{:__('选择客户')}:</label>
46 <div class="col-xs-12 col-sm-8"> 48 <div class="col-xs-12 col-sm-8">
47 - <input id="c-customer_id" data-rule="required" data-source="facrm/customer/index/selectpage/{$addtype=='add'?'type/all':''}"  
48 - class="form-control selectpage" name="row[customer_id]" type="text" value="{:input('customer_id')}"> 49 + <input id="c-customer_id" data-rule="required"
  50 + data-source="facrm/customer/index/selectpage/{$addtype=='add'?'type/all':''}"
  51 + class="form-control selectpage" name="row[customer_id]" type="text"
  52 + value="{:input('customer_id')}">
49 53
50 </div> 54 </div>
51 </div> 55 </div>
@@ -54,9 +58,12 @@ @@ -54,9 +58,12 @@
54 <div class="col-xs-12 col-sm-8"> 58 <div class="col-xs-12 col-sm-8">
55 59
56 <div class="clickbox"> 60 <div class="clickbox">
57 - <input type="hidden" name="row[business_id]" id="c-eventkey" class="form-control" value="0" data-rule="required" readonly/> 61 + <input type="hidden" name="row[business_id]" id="c-eventkey" class="form-control"
  62 + value="0" data-rule="required" readonly/>
58 <label class="control-label"> 63 <label class="control-label">
59 - <a href="javascript:;" data-url="{$addtype=='add'?'facrm/contract/index/selectbusiness':'facrm/business/index/index/select/1'}" id="select-resources"> 64 + <a href="javascript:;"
  65 + data-url="{$addtype=='add'?'facrm/contract/index/selectbusiness':'facrm/business/index/index/select/1'}"
  66 + id="select-resources">
60 {:__('选择商机')}</a> 67 {:__('选择商机')}</a>
61 </label> 68 </label>
62 </div> 69 </div>
@@ -74,20 +81,24 @@ @@ -74,20 +81,24 @@
74 <label for="c-order_time" class="control-label col-xs-12 col-sm-2">{:__('下单时间')}:</label> 81 <label for="c-order_time" class="control-label col-xs-12 col-sm-2">{:__('下单时间')}:</label>
75 <div class="col-xs-12 col-sm-8"> 82 <div class="col-xs-12 col-sm-8">
76 <input id="c-order_time" value="{:datetime(time())}" class="form-control datetimepicker" 83 <input id="c-order_time" value="{:datetime(time())}" class="form-control datetimepicker"
77 - data-date-format="YYYY-MM-DD" data-use-current="true" name="row[order_time]" type="text"> 84 + data-date-format="YYYY-MM-DD" data-use-current="true" name="row[order_time]"
  85 + type="text">
78 </div> 86 </div>
79 </div> 87 </div>
80 <div class="col-md-4 col-xs-12 form-group"> 88 <div class="col-md-4 col-xs-12 form-group">
81 - <label for="c-start_time" class="control-label col-xs-12 col-sm-2">{:__('合同开始时间')}:</label> 89 + <label for="c-start_time"
  90 + class="control-label col-xs-12 col-sm-2">{:__('合同开始时间')}:</label>
82 <div class="col-xs-12 col-sm-8"> 91 <div class="col-xs-12 col-sm-8">
83 <input id="c-start_time" value="{:datetime(time())}" class="form-control datetimepicker" 92 <input id="c-start_time" value="{:datetime(time())}" class="form-control datetimepicker"
84 - data-date-format="YYYY-MM-DD HH:mm" data-use-current="true" name="row[start_time]" type="text"> 93 + data-date-format="YYYY-MM-DD HH:mm" data-use-current="true" name="row[start_time]"
  94 + type="text">
85 </div> 95 </div>
86 </div> 96 </div>
87 <div class="col-md-4 col-xs-12 form-group"> 97 <div class="col-md-4 col-xs-12 form-group">
88 <label for="c-end_time" class="control-label col-xs-12 col-sm-2">{:__('合同结束时间')}:</label> 98 <label for="c-end_time" class="control-label col-xs-12 col-sm-2">{:__('合同结束时间')}:</label>
89 <div class="col-xs-12 col-sm-8"> 99 <div class="col-xs-12 col-sm-8">
90 - <input id="c-end_time" value="" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm" 100 + <input id="c-end_time" value="" class="form-control datetimepicker"
  101 + data-date-format="YYYY-MM-DD HH:mm"
91 data-use-current="true" name="row[end_time]" type="text"> 102 data-use-current="true" name="row[end_time]" type="text">
92 </div> 103 </div>
93 </div> 104 </div>
@@ -96,18 +107,22 @@ @@ -96,18 +107,22 @@
96 <div class="col-md-4 col-xs-12 form-group"> 107 <div class="col-md-4 col-xs-12 form-group">
97 <label for="c-contacts_id" class="control-label col-xs-12 col-sm-2">{:__('客户签约人')}:</label> 108 <label for="c-contacts_id" class="control-label col-xs-12 col-sm-2">{:__('客户签约人')}:</label>
98 <div class="col-xs-12 col-sm-8"> 109 <div class="col-xs-12 col-sm-8">
99 - <input id="c-contacts_id" data-source="{$addtype=='add'?'facrm/contract/index/selectcontact':'facrm/customer/contacts/index'}"  
100 - class="form-control selectpage" name="row[contacts_id]" type="text" value="" > 110 + <input id="c-contacts_id"
  111 + data-source="{$addtype=='add'?'facrm/contract/index/selectcontact':'facrm/customer/contacts/index'}"
  112 + class="form-control selectpage" name="row[contacts_id]" type="text" value="">
101 113
102 </div> 114 </div>
103 </div> 115 </div>
104 116
105 <div class="col-md-4 col-xs-12 form-group"> 117 <div class="col-md-4 col-xs-12 form-group">
106 - <label for="c-order_admin_id" class="control-label col-xs-12 col-sm-2">{:__('公司签约人')}:</label> 118 + <label for="c-order_admin_id"
  119 + class="control-label col-xs-12 col-sm-2">{:__('公司签约人')}:</label>
107 <div class="col-xs-12 col-sm-8"> 120 <div class="col-xs-12 col-sm-8">
108 - <input id="c-order_admin_id" data-source="facrm/common/selectpage/model/admin{$addtype=='add'?'/type/all':''}" 121 + <input id="c-order_admin_id"
  122 + data-source="facrm/common/selectpage/model/admin{$addtype=='add'?'/type/all':''}"
109 data-field="nickname" data-rule="required" 123 data-field="nickname" data-rule="required"
110 - class="form-control selectpage" name="row[order_admin_id]" type="text" value="{:isset($customer)?$customer.owner_user_id:$auth->id}"> 124 + class="form-control selectpage" name="row[order_admin_id]" type="text"
  125 + value="{:isset($customer)?$customer.owner_user_id:$auth->id}">
111 126
112 </div> 127 </div>
113 </div> 128 </div>
@@ -125,13 +140,51 @@ @@ -125,13 +140,51 @@
125 <textarea id="c-remark" class="form-control" name="row[remark]"></textarea> 140 <textarea id="c-remark" class="form-control" name="row[remark]"></textarea>
126 </div> 141 </div>
127 </div> 142 </div>
128 -  
129 - 143 + <div class="form-group">
  144 + <label class="control-label col-xs-12 col-sm-2">{:__('附件')}:</label>
  145 + <div class="col-xs-12 col-sm-8">
  146 + <div class="input-group">
  147 + <input id="c-attachfiles" class="form-control" size="20"
  148 + name="row[attachfiles]" type="text" value="{$row.attachfiles|htmlentities}">
  149 + <div class="input-group-addon no-border no-padding">
  150 + <span><button type="button" id="faupload-attachfiles"
  151 + class="btn btn-danger faupload" data-input-id="c-attachfiles"
  152 + data-multiple="true" data-preview-id="p-attachfiles"><i
  153 + class="fa fa-upload"></i> {:__('Upload')}</button></span>
  154 + <span><button type="button" id="fachoose-attachfiles"
  155 + class="btn btn-primary fachoose" data-input-id="c-attachfiles"
  156 + data-multiple="true"><i
  157 + class="fa fa-list"></i> {:__('Choose')}</button></span>
  158 + </div>
  159 + <span class="msg-box n-right" for="c-attachfiles"></span>
  160 + </div>
  161 + <ul class="row list-inline faupload-preview" id="p-attachfiles"></ul>
  162 + </div>
  163 + </div>
  164 + <div class="form-group">
  165 + <label class="control-label col-xs-12 col-sm-2">{:__('图片')}:</label>
  166 + <div class="col-xs-12 col-sm-8">
  167 + <div class="input-group">
  168 + <input id="c-smallimages" class="form-control" size="50" name="row[smallimages]"
  169 + type="text" value="{$row.smallimages|htmlentities}">
  170 + <div class="input-group-addon no-border no-padding">
  171 + <span><button type="button" id="plupload-smallimages"
  172 + class="btn btn-danger plupload" data-input-id="c-smallimages"
  173 + data-multiple="true" data-preview-id="p-smallimages"><i
  174 + class="fa fa-upload"></i> {:__('Upload')}</button></span>
  175 + <span><button type="button" id="fachoose-smallimages"
  176 + class="btn btn-primary fachoose" data-input-id="c-smallimages"
  177 + data-multiple="true"><i
  178 + class="fa fa-list"></i> {:__('Choose')}</button></span>
  179 + </div>
  180 + <span class="msg-box n-right" for="c-smallimages"></span>
  181 + </div>
  182 + <ul class="row list-inline plupload-preview" id="p-smallimages"></ul>
  183 + </div>
  184 + </div>
130 </div> 185 </div>
131 </div> 186 </div>
132 </div> 187 </div>
133 -  
134 -  
135 188
136 189
137 <div class="panel-group" id="accordion"> 190 <div class="panel-group" id="accordion">
@@ -188,10 +241,12 @@ @@ -188,10 +241,12 @@
188 </td> 241 </td>
189 <td> 242 <td>
190 <input type="number" style="width: 80px" name="product[0][nums]" 243 <input type="number" style="width: 80px" name="product[0][nums]"
191 - data-rule="required;integer;range(0~);" class="nums" onchange="totalNums(this)" onblur="totalNums(this)"> 244 + data-rule="required;integer;range(0~);" class="nums" onchange="totalNums(this)"
  245 + onblur="totalNums(this)">
192 </td> 246 </td>
193 - <td><input type="number" style="width: 80px" data-rule="required;range(0~);" onchange="calMoney(this)" onblur="calMoney(this)"  
194 - class="unit-price" name="product[0][price]" > 247 + <td><input type="number" style="width: 80px" data-rule="required;range(0~);"
  248 + onchange="calMoney(this)" onblur="calMoney(this)"
  249 + class="unit-price" name="product[0][price]">
195 <input type="hidden" name="product[0][subtotal]"> 250 <input type="hidden" name="product[0][subtotal]">
196 </td> 251 </td>
197 <td><textarea rows="1" class="remarks" name="product[0][remarks]" cols="20"></textarea></td> 252 <td><textarea rows="1" class="remarks" name="product[0][remarks]" cols="20"></textarea></td>
@@ -4,7 +4,7 @@ @@ -4,7 +4,7 @@
4 </div> 4 </div>
5 {/if} 5 {/if}
6 <style> 6 <style>
7 - .form-group .col-sm-2{ 7 + .form-group .col-sm-2 {
8 min-width: 120px; 8 min-width: 120px;
9 } 9 }
10 10
@@ -26,31 +26,37 @@ @@ -26,31 +26,37 @@
26 <div class="col-md-4 col-xs-12 form-group"> 26 <div class="col-md-4 col-xs-12 form-group">
27 <label for="c-number" class="control-label col-xs-12 col-sm-2">{:__('合同编号')}:</label> 27 <label for="c-number" class="control-label col-xs-12 col-sm-2">{:__('合同编号')}:</label>
28 <div class="col-xs-12 col-sm-8"> 28 <div class="col-xs-12 col-sm-8">
29 - <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} /> 29 + <input id="c-number" data-rule="required" type="text" class="form-control"
  30 + name="row[number]" value="{$row.number|htmlentities}" {if
  31 + $row.check_status=="2"}disabled{/if}/>
30 </div> 32 </div>
31 </div> 33 </div>
32 <div class="col-md-4 col-xs-12 form-group"> 34 <div class="col-md-4 col-xs-12 form-group">
33 <label for="c-name" class="control-label col-xs-12 col-sm-2">{:__('合同名称')}:</label> 35 <label for="c-name" class="control-label col-xs-12 col-sm-2">{:__('合同名称')}:</label>
34 <div class="col-xs-12 col-sm-8"> 36 <div class="col-xs-12 col-sm-8">
35 - <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} /> 37 + <input id="c-name" data-rule="required" type="text" class="form-control" name="row[name]"
  38 + value="{$row.name|htmlentities}" {if $row.check_status=="2"}disabled{/if}/>
36 </div> 39 </div>
37 </div> 40 </div>
38 41
39 <div class="col-md-4 col-xs-12 form-group"> 42 <div class="col-md-4 col-xs-12 form-group">
40 <label for="c-customer_id" class="control-label col-xs-12 col-sm-2">{:__('选择客户')}:</label> 43 <label for="c-customer_id" class="control-label col-xs-12 col-sm-2">{:__('选择客户')}:</label>
41 <div class="col-xs-12 col-sm-8"> 44 <div class="col-xs-12 col-sm-8">
42 - <input id="c-customer_id" data-rule="required" data-source="facrm/customer/index/selectpage/type/all"  
43 - class="form-control selectpage" type="text" value="{$row.customer_id|htmlentities}" disabled> 45 + <input id="c-customer_id" data-rule="required"
  46 + data-source="facrm/customer/index/selectpage/type/all"
  47 + class="form-control selectpage" type="text" value="{$row.customer_id|htmlentities}"
  48 + disabled>
44 49
45 </div> 50 </div>
46 </div> 51 </div>
47 - <div class="col-md-4 col-xs-12 form-group business_id_div" > 52 + <div class="col-md-4 col-xs-12 form-group business_id_div">
48 <label for="c-business_id" class="control-label col-xs-12 col-sm-2">{:__('选择商机')}:</label> 53 <label for="c-business_id" class="control-label col-xs-12 col-sm-2">{:__('选择商机')}:</label>
49 <div class="col-xs-12 col-sm-8"> 54 <div class="col-xs-12 col-sm-8">
50 55
51 56
52 <input id="c-business_id" data-rule="required" data-source="facrm/business/index/index" 57 <input id="c-business_id" data-rule="required" data-source="facrm/business/index/index"
53 - class="form-control selectpage" name="" type="text" value="{$row.business_id|htmlentities}" disabled> 58 + class="form-control selectpage" name="" type="text"
  59 + value="{$row.business_id|htmlentities}" disabled>
54 60
55 </div> 61 </div>
56 </div> 62 </div>
@@ -58,25 +64,36 @@ @@ -58,25 +64,36 @@
58 <div class="col-md-4 col-xs-12 form-group"> 64 <div class="col-md-4 col-xs-12 form-group">
59 <label for="c-money" class="control-label col-xs-12 col-sm-2">{:__('合同金额')}:</label> 65 <label for="c-money" class="control-label col-xs-12 col-sm-2">{:__('合同金额')}:</label>
60 <div class="col-xs-12 col-sm-8"> 66 <div class="col-xs-12 col-sm-8">
61 - <input id="c-money" type="number" class="form-control" name="row[money]" value="{$row.money|htmlentities}" {if $row.check_status=="2"}disabled{/if} /> 67 + <input id="c-money" type="number" class="form-control" name="row[money]"
  68 + value="{$row.money|htmlentities}" {if $row.check_status=="2"}disabled{/if}/>
62 </div> 69 </div>
63 </div> 70 </div>
64 <div class="col-md-4 col-xs-12 form-group"> 71 <div class="col-md-4 col-xs-12 form-group">
65 <label for="c-order_time" class="control-label col-xs-12 col-sm-2">{:__('下单时间')}:</label> 72 <label for="c-order_time" class="control-label col-xs-12 col-sm-2">{:__('下单时间')}:</label>
66 <div class="col-xs-12 col-sm-8"> 73 <div class="col-xs-12 col-sm-8">
67 - <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} > 74 + <input id="c-order_time" value="{:datetime($row.order_time)}"
  75 + class="form-control datetimepicker" data-date-format="YYYY-MM-DD"
  76 + data-use-current="true" name="row[order_time]" type="text" {if
  77 + $row.check_status=="2"}disabled{/if}>
68 </div> 78 </div>
69 </div> 79 </div>
70 <div class="col-md-4 col-xs-12 form-group"> 80 <div class="col-md-4 col-xs-12 form-group">
71 - <label for="c-start_time" class="control-label col-xs-12 col-sm-2">{:__('合同开始时间')}:</label> 81 + <label for="c-start_time"
  82 + class="control-label col-xs-12 col-sm-2">{:__('合同开始时间')}:</label>
72 <div class="col-xs-12 col-sm-8"> 83 <div class="col-xs-12 col-sm-8">
73 - <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} > 84 + <input id="c-start_time" value="{:datetime($row.start_time)}"
  85 + class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm"
  86 + data-use-current="true" name="row[start_time]" type="text" {if
  87 + $row.check_status=="2"}disabled{/if}>
74 </div> 88 </div>
75 </div> 89 </div>
76 <div class="col-md-4 col-xs-12 form-group"> 90 <div class="col-md-4 col-xs-12 form-group">
77 <label for="c-end_time" class="control-label col-xs-12 col-sm-2">{:__('合同结束时间')}:</label> 91 <label for="c-end_time" class="control-label col-xs-12 col-sm-2">{:__('合同结束时间')}:</label>
78 <div class="col-xs-12 col-sm-8"> 92 <div class="col-xs-12 col-sm-8">
79 - <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}> 93 + <input id="c-end_time" value="{:datetime($row.end_time)}"
  94 + class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm"
  95 + data-use-current="true" name="row[end_time]" type="text" {if
  96 + $row.check_status=="2"}disabled{/if}>
80 </div> 97 </div>
81 </div> 98 </div>
82 99
@@ -85,16 +102,20 @@ @@ -85,16 +102,20 @@
85 <label for="c-contacts_id" class="control-label col-xs-12 col-sm-2">{:__('客户签约人')}:</label> 102 <label for="c-contacts_id" class="control-label col-xs-12 col-sm-2">{:__('客户签约人')}:</label>
86 <div class="col-xs-12 col-sm-8"> 103 <div class="col-xs-12 col-sm-8">
87 <input id="c-contacts_id" data-source="facrm/contract/index/selectcontact" 104 <input id="c-contacts_id" data-source="facrm/contract/index/selectcontact"
88 - class="form-control selectpage" name="row[contacts_id]" type="text" value="{$row.contacts_id|htmlentities}" {if $row.check_status=="2"}disabled{/if} > 105 + class="form-control selectpage" name="row[contacts_id]" type="text"
  106 + value="{$row.contacts_id|htmlentities}" {if $row.check_status=="2"}disabled{/if}>
89 107
90 </div> 108 </div>
91 </div> 109 </div>
92 110
93 <div class="col-md-4 col-xs-12 form-group"> 111 <div class="col-md-4 col-xs-12 form-group">
94 - <label for="c-order_admin_id" class="control-label col-xs-12 col-sm-2">{:__('公司签约人')}:</label> 112 + <label for="c-order_admin_id"
  113 + class="control-label col-xs-12 col-sm-2">{:__('公司签约人')}:</label>
95 <div class="col-xs-12 col-sm-8"> 114 <div class="col-xs-12 col-sm-8">
96 - <input id="c-order_admin_id" data-rule="required" data-source="facrm/common/selectpage/model/admin/type/all" data-field="nickname"  
97 - class="form-control selectpage" name="row[order_admin_id]" type="text" value="{$row.order_admin_id|htmlentities}" {if $row.check_status=="2"}disabled{/if} > 115 + <input id="c-order_admin_id" data-rule="required"
  116 + data-source="facrm/common/selectpage/model/admin/type/all" data-field="nickname"
  117 + class="form-control selectpage" name="row[order_admin_id]" type="text"
  118 + value="{$row.order_admin_id|htmlentities}" {if $row.check_status=="2"}disabled{/if}>
98 119
99 </div> 120 </div>
100 </div> 121 </div>
@@ -104,8 +125,12 @@ @@ -104,8 +125,12 @@
104 <label for="c-flow_admin_id" class="control-label col-xs-12 col-sm-2">{:__('审批人')}:</label> 125 <label for="c-flow_admin_id" class="control-label col-xs-12 col-sm-2">{:__('审批人')}:</label>
105 <div class="col-xs-12 col-sm-8"> 126 <div class="col-xs-12 col-sm-8">
106 {if($flow)} 127 {if($flow)}
107 - <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"'}  
108 - class="form-control selectpage" name="row[flow_admin_id]" type="text" value="{if $flow->config==1}{$flow->step[0]['admin_ids']}{/if}"> 128 + <input id="c-flow_admin_id" value="{$row.flow_admin_id|htmlentities}"
  129 + data-source="facrm/common/selectpage/model/admin/type/all" data-field="nickname"
  130 + data-multiple="true" {if $row.check_status=="2"}disabled{/if} {$flow->config==1?'disabled
  131 + ':'data-rule="required"'}
  132 + class="form-control selectpage" name="row[flow_admin_id]" type="text" value="{if
  133 + $flow->config==1}{$flow->step[0]['admin_ids']}{/if}">
109 {else/} 134 {else/}
110 <label class="control-label">审批流程已被删除</label> 135 <label class="control-label">审批流程已被删除</label>
111 {/if} 136 {/if}
@@ -117,15 +142,19 @@ @@ -117,15 +142,19 @@
117 <div class="col-md-4 col-xs-12 form-group"> 142 <div class="col-md-4 col-xs-12 form-group">
118 <label for="c-expire_handle" class="control-label col-xs-12 col-sm-2">合同过期处理:</label> 143 <label for="c-expire_handle" class="control-label col-xs-12 col-sm-2">合同过期处理:</label>
119 <div class="col-xs-12 col-sm-8"> 144 <div class="col-xs-12 col-sm-8">
120 - {:build_radios('row[expire_handle]', ['0'=>'未处理', '1'=>'已续签', '2'=>'不再合作'], $row.expire_handle)} 145 + {:build_radios('row[expire_handle]', ['0'=>'未处理', '1'=>'已续签', '2'=>'不再合作'],
  146 + $row.expire_handle)}
121 </div> 147 </div>
122 </div> 148 </div>
123 {/if} 149 {/if}
124 <div class="col-md-4 col-xs-12 form-group"> 150 <div class="col-md-4 col-xs-12 form-group">
125 - <label for="c-order_admin_id" class="control-label col-xs-12 col-sm-2">{:__('合同负责人')}:</label> 151 + <label for="c-order_admin_id"
  152 + class="control-label col-xs-12 col-sm-2">{:__('合同负责人')}:</label>
126 <div class="col-xs-12 col-sm-8"> 153 <div class="col-xs-12 col-sm-8">
127 - <input id="c-owner_user_id" data-rule="required" data-source="facrm/common/selectpage/model/admin" data-field="nickname"  
128 - class="form-control selectpage" name="row[owner_user_id]" type="text" value="{$row.owner_user_id|htmlentities}" > 154 + <input id="c-owner_user_id" data-rule="required"
  155 + data-source="facrm/common/selectpage/model/admin" data-field="nickname"
  156 + class="form-control selectpage" name="row[owner_user_id]" type="text"
  157 + value="{$row.owner_user_id|htmlentities}">
129 158
130 </div> 159 </div>
131 </div> 160 </div>
@@ -133,10 +162,52 @@ @@ -133,10 +162,52 @@
133 <div class="col-md-4 col-xs-12 form-group"> 162 <div class="col-md-4 col-xs-12 form-group">
134 <label for="c-remark" class="control-label col-xs-12 col-sm-2">{:__('备注')}:</label> 163 <label for="c-remark" class="control-label col-xs-12 col-sm-2">{:__('备注')}:</label>
135 <div class="col-xs-12 col-sm-8"> 164 <div class="col-xs-12 col-sm-8">
136 - <textarea id="c-remark" class="form-control" name="row[remark]">{$row.remark|htmlentities}</textarea> 165 + <textarea id="c-remark" class="form-control"
  166 + name="row[remark]">{$row.remark|htmlentities}</textarea>
  167 + </div>
  168 + </div>
  169 + <div class="form-group">
  170 + <label class="control-label col-xs-12 col-sm-2">{:__('附件')}:</label>
  171 + <div class="col-xs-12 col-sm-8">
  172 + <div class="input-group">
  173 + <input id="c-attachfiles" class="form-control" size="20"
  174 + name="row[attachfiles]" type="text" value="{$row.attachfiles|htmlentities}">
  175 + <div class="input-group-addon no-border no-padding">
  176 + <span><button type="button" id="faupload-attachfiles"
  177 + class="btn btn-danger faupload" data-input-id="c-attachfiles"
  178 + data-multiple="true" data-preview-id="p-attachfiles"><i
  179 + class="fa fa-upload"></i> {:__('Upload')}</button></span>
  180 + <span><button type="button" id="fachoose-attachfiles"
  181 + class="btn btn-primary fachoose" data-input-id="c-attachfiles"
  182 + data-multiple="true"><i
  183 + class="fa fa-list"></i> {:__('Choose')}</button></span>
  184 + </div>
  185 + <span class="msg-box n-right" for="c-attachfiles"></span>
  186 + </div>
  187 + <ul class="row list-inline faupload-preview" id="p-attachfiles"></ul>
  188 + </div>
  189 + </div>
  190 + <div class="form-group">
  191 + <label class="control-label col-xs-12 col-sm-2">{:__('图片')}:</label>
  192 + <div class="col-xs-12 col-sm-8">
  193 + <div class="input-group">
  194 + <input id="c-smallimages" class="form-control" size="50" name="row[smallimages]"
  195 + type="text" value="{$row.smallimages|htmlentities}">
  196 + <div class="input-group-addon no-border no-padding">
  197 + <span><button type="button" id="plupload-smallimages"
  198 + class="btn btn-danger plupload" data-input-id="c-smallimages"
  199 + data-multiple="true" data-preview-id="p-smallimages"><i
  200 + class="fa fa-upload"></i> {:__('Upload')}</button></span>
  201 + <span><button type="button" id="fachoose-smallimages"
  202 + class="btn btn-primary fachoose" data-input-id="c-smallimages"
  203 + data-multiple="true"><i
  204 + class="fa fa-list"></i> {:__('Choose')}</button></span>
  205 + </div>
  206 + <span class="msg-box n-right" for="c-smallimages"></span>
  207 + </div>
  208 + <ul class="row list-inline plupload-preview" id="p-smallimages"></ul>
137 </div> 209 </div>
138 </div> 210 </div>
139 -  
140 </div> 211 </div>
141 </div> 212 </div>
142 </div> 213 </div>
@@ -177,7 +248,7 @@ @@ -177,7 +248,7 @@
177 <th>{:__('备注')}</th> 248 <th>{:__('备注')}</th>
178 <th>{:__('规格')}</th> 249 <th>{:__('规格')}</th>
179 <th>{:__('属性')}</th> 250 <th>{:__('属性')}</th>
180 - <th >{:__('单位')}</th> 251 + <th>{:__('单位')}</th>
181 <th>{:__('小计')}</th> 252 <th>{:__('小计')}</th>
182 253
183 254
@@ -202,20 +273,33 @@ @@ -202,20 +273,33 @@
202 <td>{$i|htmlentities}</td> 273 <td>{$i|htmlentities}</td>
203 <td>{$vo.sku|htmlentities}</td> 274 <td>{$vo.sku|htmlentities}</td>
204 <td> 275 <td>
205 - <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} >  
206 - <input type="hidden" name="product[{$i|htmlentities}][product_id]" value="{$vo.product_id|htmlentities}" >  
207 - <input type="hidden" name="product[{$i|htmlentities}][sku]" value="{$vo.sku|htmlentities}" >  
208 - <input type="hidden" name="product[{$i|htmlentities}][specification]" value="{$vo.specification|htmlentities}" >  
209 - <input type="hidden" name="product[{$i|htmlentities}][prop]" value="{$vo.prop|htmlentities}" >  
210 - <input type="hidden" name="product[{$i|htmlentities}][unit]" value="{$vo.unit|htmlentities}" > 276 + <input date-rule="required;" style="width: 100px" value="{$vo.name|htmlentities}" type="text"
  277 + name="product[{$i|htmlentities}][name]" data-index="{$i|htmlentities}" class="find"
  278 + class="" data-toggle="modal" data-target="#modelProduct" {if
  279 + $row.check_status=="2"}disabled{/if}>
  280 + <input type="hidden" name="product[{$i|htmlentities}][product_id]"
  281 + value="{$vo.product_id|htmlentities}">
  282 + <input type="hidden" name="product[{$i|htmlentities}][sku]" value="{$vo.sku|htmlentities}">
  283 + <input type="hidden" name="product[{$i|htmlentities}][specification]"
  284 + value="{$vo.specification|htmlentities}">
  285 + <input type="hidden" name="product[{$i|htmlentities}][prop]" value="{$vo.prop|htmlentities}">
  286 + <input type="hidden" name="product[{$i|htmlentities}][unit]" value="{$vo.unit|htmlentities}">
211 </td> 287 </td>
212 <td> 288 <td>
213 - <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}> 289 + <input type="number" value="{$vo.nums|htmlentities}" style="width: 80px"
  290 + name="product[{$i|htmlentities}][nums]" data-rule="required;integer;range(0~);"
  291 + class="nums" onchange="totalNums(this)" onblur="totalNums(this)" {if
  292 + $row.check_status=="2"}disabled{/if}>
214 </td> 293 </td>
215 - <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}>  
216 - <input type="hidden" name="product[{$i|htmlentities}][subtotal]" value="{$vo.subtotal|htmlentities}" > 294 + <td><input value="{$vo.sales_price|htmlentities}" type="number" style="width: 80px"
  295 + data-rule="required;range(0~);" onchange="calMoney(this)" onblur="calMoney(this)"
  296 + class="unit-price" name="product[{$i|htmlentities}][price]" {if
  297 + $row.check_status=="2"}disabled{/if}>
  298 + <input type="hidden" name="product[{$i|htmlentities}][subtotal]"
  299 + value="{$vo.subtotal|htmlentities}">
217 </td> 300 </td>
218 - <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> 301 + <td><textarea rows="1" class="remarks" name="product[{$i|htmlentities}][remarks]" cols="20" {if
  302 + $row.check_status=="2"}disabled{/if}>{$vo.remarks|htmlentities}</textarea></td>
219 303
220 <td class="gg">{$vo.specification|htmlentities}</td> 304 <td class="gg">{$vo.specification|htmlentities}</td>
221 <td> 305 <td>
@@ -235,7 +319,7 @@ @@ -235,7 +319,7 @@
235 <td></td> 319 <td></td>
236 <td></td> 320 <td></td>
237 <td></td> 321 <td></td>
238 - <td class="totalnums" >{$totalnums|htmlentities}</td> 322 + <td class="totalnums">{$totalnums|htmlentities}</td>
239 <td></td> 323 <td></td>
240 <td></td> 324 <td></td>
241 <td></td> 325 <td></td>
@@ -254,7 +338,9 @@ @@ -254,7 +338,9 @@
254 <div class="col-md-4 col-xs-12"> 338 <div class="col-md-4 col-xs-12">
255 <label class="control-label col-xs-12 col-sm-6">{:__('优惠率%')}:</label> 339 <label class="control-label col-xs-12 col-sm-6">{:__('优惠率%')}:</label>
256 <div class="col-xs-12 col-sm-6"> 340 <div class="col-xs-12 col-sm-6">
257 - <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()"> 341 + <input id="c-rate" {if $row.check_status=="2"}disabled{/if} class="form-control"
  342 + data-rule="required;float;range(0~100);" name="row[discount_rate]" type="number"
  343 + value="{$row.discount_rate|htmlentities}" onblur="calTotalMoneys()">
258 344
259 </div> 345 </div>
260 </div> 346 </div>
@@ -262,9 +348,12 @@ @@ -262,9 +348,12 @@
262 348
263 <label class="control-label col-xs-12 col-sm-6"> {:__('产品总额 $')}:</label> 349 <label class="control-label col-xs-12 col-sm-6"> {:__('产品总额 $')}:</label>
264 <div class="col-xs-12 col-sm-6"> 350 <div class="col-xs-12 col-sm-6">
265 - <input id="totalMoneys" class="form-control" name="row[total_price]" {if $row.check_status=="2"}disabled{/if} type="number" value="{$row.total_price|htmlentities}">  
266 - <input id="money" style="display: none;" readonly="readonly" type="number" >  
267 - <input id="allNums" style="display: none;" name="row[totalNums]" readonly="readonly" type="number" > 351 + <input id="totalMoneys" class="form-control" name="row[total_price]" {if
  352 + $row.check_status=="2"}disabled{/if} type="number"
  353 + value="{$row.total_price|htmlentities}">
  354 + <input id="money" style="display: none;" readonly="readonly" type="number">
  355 + <input id="allNums" style="display: none;" name="row[totalNums]" readonly="readonly"
  356 + type="number">
268 </div> 357 </div>
269 358
270 </div> 359 </div>
@@ -278,7 +367,8 @@ @@ -278,7 +367,8 @@
278 <button type="submit" class="btn btn-success btn-embossed disabled">{:__('OK')}</button> 367 <button type="submit" class="btn btn-success btn-embossed disabled">{:__('OK')}</button>
279 <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button> 368 <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
280 {if $row.check_status=="2" &&$auth->check('facrm/contract/index/change')} 369 {if $row.check_status=="2" &&$auth->check('facrm/contract/index/change')}
281 - <a class="btn btn-xs btn-danger btn-dialog" href="facrm/contract/index/change/ids/{$row.id|htmlentities}" data-title="合同更变">{:__('更变')}</a> 370 + <a class="btn btn-xs btn-danger btn-dialog" href="facrm/contract/index/change/ids/{$row.id|htmlentities}"
  371 + data-title="合同更变">{:__('更变')}</a>
282 {/if} 372 {/if}
283 373
284 </div> 374 </div>
@@ -291,12 +381,14 @@ @@ -291,12 +381,14 @@
291 <div class="modal-dialog" role="document"> 381 <div class="modal-dialog" role="document">
292 <div class="modal-content" style="padding: 15px;"> 382 <div class="modal-content" style="padding: 15px;">
293 <div class="modal-header"> 383 <div class="modal-header">
294 - <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button> 384 + <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span>
  385 + </button>
295 <h4 class="modal-title" id="myModalLabel">{:__('选择产品')}</h4> 386 <h4 class="modal-title" id="myModalLabel">{:__('选择产品')}</h4>
296 </div> 387 </div>
297 <div class="modal-body"> 388 <div class="modal-body">
298 - <div id="lays-row" class="row" >  
299 - <table id="table2" class="table table-striped table-bordered table-hover " data-show-export="false" data-show-toggle="false" data-show-columns="false"> 389 + <div id="lays-row" class="row">
  390 + <table id="table2" class="table table-striped table-bordered table-hover " data-show-export="false"
  391 + data-show-toggle="false" data-show-columns="false">
300 </table> 392 </table>
301 </div> 393 </div>
302 </div> 394 </div>
@@ -304,7 +396,11 @@ @@ -304,7 +396,11 @@
304 </div> 396 </div>
305 </div> 397 </div>
306 <script> 398 <script>
307 - var contract_id={:intval(input('ids'))}; 399 + var contract_id = {
  400 + :
  401 + intval(input('ids'))
  402 + }
  403 + ;
308 </script> 404 </script>
309 405
310 406
@@ -21,7 +21,7 @@ return [ @@ -21,7 +21,7 @@ return [
21 /** 21 /**
22 * 可上传的文件类型 22 * 可上传的文件类型
23 */ 23 */
24 - 'mimetype' => 'jpg,png,bmp,jpeg,gif,webp,zip,rar,wav,mp4,mp3,webm', 24 + 'mimetype' => 'jpg,png,bmp,jpeg,gif,webp,zip,rar,wav,mp4,mp3,webm,docx,pdf',
25 /** 25 /**
26 * 是否支持批量上传 26 * 是否支持批量上传
27 */ 27 */
1 -<IfModule mod_rewrite.c>  
2 - Options +FollowSymlinks -Multiviews  
3 - RewriteEngine On  
4 -  
5 - RewriteCond %{REQUEST_FILENAME} !-d  
6 - RewriteCond %{REQUEST_FILENAME} !-f  
7 - RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]  
8 -</IfModule>  
1 -open_basedir=/www/wwwroot/CRM/:/tmp/  
  1 +define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'template'], function ($, undefined, Backend, Table, Form, Template) {
  2 +
  3 + var Controller = {
  4 + index: function () {
  5 + // 初始化表格参数配置
  6 + Table.api.init({
  7 + extend: {
  8 + index_url: 'command/index',
  9 + add_url: 'command/add',
  10 + edit_url: '',
  11 + del_url: 'command/del',
  12 + multi_url: 'command/multi',
  13 + table: 'command',
  14 + }
  15 + });
  16 +
  17 + var table = $("#table");
  18 +
  19 + // 初始化表格
  20 + table.bootstrapTable({
  21 + url: $.fn.bootstrapTable.defaults.extend.index_url,
  22 + pk: 'id',
  23 + sortName: 'id',
  24 + columns: [
  25 + [
  26 + {checkbox: true},
  27 + {field: 'id', title: __('Id')},
  28 + {field: 'type', title: __('Type'), formatter: Table.api.formatter.search},
  29 + {field: 'type_text', title: __('Type')},
  30 + {
  31 + field: 'command', title: __('Command'), renderDefault: false, formatter: function (value, row, index) {
  32 + return '<input type="text" class="form-control" value="' + value + '">';
  33 + }
  34 + },
  35 + {
  36 + field: 'executetime',
  37 + title: __('Executetime'),
  38 + operate: 'RANGE',
  39 + addclass: 'datetimerange',
  40 + formatter: Table.api.formatter.datetime
  41 + },
  42 + {
  43 + field: 'createtime',
  44 + title: __('Createtime'),
  45 + operate: 'RANGE',
  46 + addclass: 'datetimerange',
  47 + formatter: Table.api.formatter.datetime
  48 + },
  49 + {
  50 + field: 'updatetime',
  51 + title: __('Updatetime'),
  52 + operate: 'RANGE',
  53 + addclass: 'datetimerange',
  54 + formatter: Table.api.formatter.datetime
  55 + },
  56 + {
  57 + field: 'status',
  58 + title: __('Status'),
  59 + table: table,
  60 + custom: {"successed": 'success', "failured": 'danger'},
  61 + searchList: {"successed": __('Successed'), "failured": __('Failured')},
  62 + formatter: Table.api.formatter.status
  63 + },
  64 + {
  65 + field: 'operate',
  66 + title: __('Operate'),
  67 + buttons: [
  68 + {
  69 + name: 'execute',
  70 + title: __('Execute again'),
  71 + text: __('Execute again'),
  72 + url: 'command/execute',
  73 + icon: 'fa fa-repeat',
  74 + classname: 'btn btn-success btn-xs btn-execute btn-ajax',
  75 + success: function (data) {
  76 + Layer.alert("<textarea class='form-control' cols='60' rows='5'>" + data.result + "</textarea>", {
  77 + title: __("执行结果"),
  78 + shadeClose: true
  79 + });
  80 + table.bootstrapTable('refresh');
  81 + return false;
  82 + }
  83 + },
  84 + {
  85 + name: 'execute',
  86 + title: __('Detail'),
  87 + text: __('Detail'),
  88 + url: 'command/detail',
  89 + icon: 'fa fa-list',
  90 + classname: 'btn btn-info btn-xs btn-execute btn-dialog'
  91 + }
  92 + ],
  93 + table: table,
  94 + events: Table.api.events.operate,
  95 + formatter: Table.api.formatter.operate
  96 + }
  97 + ]
  98 + ]
  99 + });
  100 +
  101 + // 为表格绑定事件
  102 + Table.api.bindevent(table);
  103 + },
  104 + add: function () {
  105 + require(['bootstrap-select', 'bootstrap-select-lang']);
  106 + var mainfields = [];
  107 + var relationfields = {};
  108 + var maintable = [];
  109 + var relationtable = [];
  110 + var relationmode = ["belongsto", "hasone"];
  111 +
  112 + var renderselect = function (select, data) {
  113 + var html = [];
  114 + for (var i = 0; i < data.length; i++) {
  115 + html.push("<option value='" + data[i] + "'>" + data[i] + "</option>");
  116 + }
  117 + $(select).html(html.join(""));
  118 + select.trigger("change");
  119 + if (select.data("selectpicker")) {
  120 + select.selectpicker('refresh');
  121 + }
  122 + return select;
  123 + };
  124 +
  125 + $("select[name=table] option").each(function () {
  126 + maintable.push($(this).val());
  127 + });
  128 + $(document).on('change', "input[name='isrelation']", function () {
  129 + $("#relation-zone").toggleClass("hide", !$(this).prop("checked"));
  130 + });
  131 + $(document).on('change', "select[name='table']", function () {
  132 + var that = this;
  133 + Fast.api.ajax({
  134 + url: "command/get_field_list",
  135 + data: {table: $(that).val()},
  136 + }, function (data, ret) {
  137 + mainfields = data.fieldlist;
  138 + $("#relation-zone .relation-item").remove();
  139 + renderselect($("#fields"), mainfields);
  140 + return false;
  141 + });
  142 + return false;
  143 + });
  144 + $(document).on('click', "a.btn-newrelation", function () {
  145 + var that = this;
  146 + var index = parseInt($(that).data("index")) + 1;
  147 + var content = Template("relationtpl", {index: index});
  148 + content = $(content.replace(/\[index\]/, index));
  149 + $(this).data("index", index);
  150 + $(content).insertBefore($(that).closest(".row"));
  151 + $('select', content).selectpicker();
  152 + var exists = [$("select[name='table']").val()];
  153 + $("select.relationtable").each(function () {
  154 + exists.push($(this).val());
  155 + });
  156 + relationtable = [];
  157 + $.each(maintable, function (i, j) {
  158 + if ($.inArray(j, exists) < 0) {
  159 + relationtable.push(j);
  160 + }
  161 + });
  162 + renderselect($("select.relationtable", content), relationtable);
  163 + $("select.relationtable", content).trigger("change");
  164 + });
  165 + $(document).on('click', "a.btn-removerelation", function () {
  166 + $(this).closest(".row").remove();
  167 + });
  168 + $(document).on('change', "#relation-zone select.relationmode", function () {
  169 + var table = $("select.relationtable", $(this).closest(".row")).val();
  170 + var that = this;
  171 + Fast.api.ajax({
  172 + url: "command/get_field_list",
  173 + data: {table: table},
  174 + }, function (data, ret) {
  175 + renderselect($(that).closest(".row").find("select.relationprimarykey"), $(that).val() == 'belongsto' ? data.fieldlist : mainfields);
  176 + renderselect($(that).closest(".row").find("select.relationforeignkey"), $(that).val() == 'hasone' ? data.fieldlist : mainfields);
  177 + return false;
  178 + });
  179 + });
  180 + $(document).on('change', "#relation-zone select.relationtable", function () {
  181 + var that = this;
  182 + Fast.api.ajax({
  183 + url: "command/get_field_list",
  184 + data: {table: $(that).val()},
  185 + }, function (data, ret) {
  186 + renderselect($(that).closest(".row").find("select.relationmode"), relationmode);
  187 + renderselect($(that).closest(".row").find("select.relationfields"), mainfields)
  188 + renderselect($(that).closest(".row").find("select.relationforeignkey"), data.fieldlist)
  189 + renderselect($(that).closest(".row").find("select.relationfields"), data.fieldlist)
  190 + return false;
  191 + });
  192 + });
  193 + $(document).on('click', ".btn-command", function () {
  194 + var form = $(this).closest("form");
  195 + var textarea = $("textarea[rel=command]", form);
  196 + textarea.val('');
  197 + Fast.api.ajax({
  198 + url: "command/command/action/command",
  199 + data: form.serialize(),
  200 + }, function (data, ret) {
  201 + textarea.val(data.command);
  202 + return false;
  203 + });
  204 + });
  205 + $(document).on('click', ".btn-execute", function () {
  206 + var form = $(this).closest("form");
  207 + var textarea = $("textarea[rel=result]", form);
  208 + textarea.val('');
  209 + Fast.api.ajax({
  210 + url: "command/command/action/execute",
  211 + data: form.serialize(),
  212 + }, function (data, ret) {
  213 + textarea.val(data.result);
  214 + window.parent.$(".toolbar .btn-refresh").trigger('click');
  215 + top.window.Fast.api.refreshmenu();
  216 + return false;
  217 + }, function () {
  218 + window.parent.$(".toolbar .btn-refresh").trigger('click');
  219 + });
  220 + });
  221 + $("select[name='table']").trigger("change");
  222 + Controller.api.bindevent();
  223 + },
  224 + edit: function () {
  225 + Controller.api.bindevent();
  226 + },
  227 + api: {
  228 + bindevent: function () {
  229 + Form.api.bindevent($("form[role=form]"));
  230 + }
  231 + }
  232 + };
  233 + return Controller;
  234 +});
@@ -214,6 +214,11 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'columntoggle'], func @@ -214,6 +214,11 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'columntoggle'], func
214 Controller.index({ 214 Controller.index({
215 index_url: 'facrm/contract/index/lists', 'scene_id': 'owner' 215 index_url: 'facrm/contract/index/lists', 'scene_id': 'owner'
216 }); 216 });
  217 +
  218 +
  219 +
  220 +
  221 +
217 }, 222 },
218 add: function () { 223 add: function () {
219 Controller.api.bindevent(); 224 Controller.api.bindevent();
@@ -606,7 +611,6 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'columntoggle'], func @@ -606,7 +611,6 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'columntoggle'], func
606 addclass: 'selectpage', 611 addclass: 'selectpage',
607 extend: 'data-source="facrm/common/selectpage/model/admin?type=all" data-field="nickname" data-orderBy="id desc"' 612 extend: 'data-source="facrm/common/selectpage/model/admin?type=all" data-field="nickname" data-orderBy="id desc"'
608 }, 613 },
609 -  
610 { 614 {
611 field: 'check_status', 615 field: 'check_status',
612 title: __('Status'), 616 title: __('Status'),