添加事项模版功能
This commit is contained in:
37
superadmin/application/admin/controller/Mattertemplate.php
Normal file
37
superadmin/application/admin/controller/Mattertemplate.php
Normal file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\controller;
|
||||
|
||||
use app\common\controller\Backend;
|
||||
|
||||
/**
|
||||
* 事项模版
|
||||
*
|
||||
* @icon fa fa-circle-o
|
||||
*/
|
||||
class Mattertemplate extends Backend
|
||||
{
|
||||
|
||||
/**
|
||||
* Mattertemplate模型对象
|
||||
* @var \app\admin\model\Mattertemplate
|
||||
*/
|
||||
protected $model = null;
|
||||
|
||||
public function _initialize()
|
||||
{
|
||||
parent::_initialize();
|
||||
$this->model = new \app\admin\model\Mattertemplate;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
|
||||
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
|
||||
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
|
||||
*/
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\controller;
|
||||
|
||||
use app\common\controller\Backend;
|
||||
use think\Db;
|
||||
|
||||
/**
|
||||
* 事项模版分类
|
||||
*
|
||||
* @icon fa fa-circle-o
|
||||
*/
|
||||
class Mattertemplatecategorization extends Backend
|
||||
{
|
||||
|
||||
/**
|
||||
* Mattertemplatecategorization模型对象
|
||||
* @var \app\admin\model\Mattertemplatecategorization
|
||||
*/
|
||||
protected $model = null;
|
||||
|
||||
public function _initialize()
|
||||
{
|
||||
parent::_initialize();
|
||||
$this->model = new \app\admin\model\Mattertemplatecategorization;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
|
||||
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
|
||||
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* 查看
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
//当前是否为关联查询
|
||||
$this->relationSearch = true;
|
||||
//设置过滤方法
|
||||
$this->request->filter(['strip_tags', 'trim']);
|
||||
if ($this->request->isAjax()) {
|
||||
//如果发送的来源是Selectpage,则转发到Selectpage
|
||||
if ($this->request->request('keyField')) {
|
||||
return $this->selectpage();
|
||||
}
|
||||
list($where, $sort, $order, $offset, $limit) = $this->buildparams();
|
||||
|
||||
$list = $this->model
|
||||
->with(['mattertemplate','firmstoreprojectsone','firmstoreprojectstwo'])
|
||||
->where($where)
|
||||
->order($sort, $order)
|
||||
->paginate($limit);
|
||||
|
||||
foreach ($list as $row) {
|
||||
$row->visible(['id','name','create_time','update_time']);
|
||||
$row->visible(['mattertemplate']);
|
||||
$row->getRelation('mattertemplate')->visible(['name']);
|
||||
$row->visible(['firmstoreprojectsone']);
|
||||
$row->getRelation('firmstoreprojectsone')->visible(['name']);
|
||||
$row->visible(['firmstoreprojectstwo']);
|
||||
$row->getRelation('firmstoreprojectstwo')->visible(['name']);
|
||||
}
|
||||
|
||||
$result = array("total" => $list->total(), "rows" => $list->items());
|
||||
|
||||
return json($result);
|
||||
}
|
||||
return $this->view->fetch();
|
||||
}
|
||||
public function getPrecautions(){
|
||||
$firmstoreprojectsone_id = input('firmstoreprojectsone_id');
|
||||
$firmstoreprojectstwo_id = input('firmstoreprojectstwo_id');
|
||||
$model = $this->model->where('mattertemplate_id',1);
|
||||
if (!empty($firmstoreprojectsone_id)){
|
||||
$model = $model->where('firmstoreprojectsone_id',$firmstoreprojectsone_id);
|
||||
}
|
||||
if (!empty($firmstoreprojectstwo_id)){
|
||||
$model = $model->where('firmstoreprojectstwo_id',$firmstoreprojectstwo_id);
|
||||
}
|
||||
$data = $model->select();
|
||||
return json(['total'=>count($data),'data'=>$data]);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,171 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\controller;
|
||||
|
||||
use app\common\controller\Backend;
|
||||
use think\Db;
|
||||
|
||||
/**
|
||||
* 模板分类内容
|
||||
*
|
||||
* @icon fa fa-circle-o
|
||||
*/
|
||||
class Mattertemplatecategorizedcontent extends Backend
|
||||
{
|
||||
|
||||
/**
|
||||
* Mattertemplatecategorizedcontent模型对象
|
||||
* @var \app\admin\model\Mattertemplatecategorizedcontent
|
||||
*/
|
||||
protected $model = null;
|
||||
|
||||
public function _initialize()
|
||||
{
|
||||
parent::_initialize();
|
||||
$this->model = new \app\admin\model\Mattertemplatecategorizedcontent;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
|
||||
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
|
||||
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* 查看
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
//当前是否为关联查询
|
||||
$this->relationSearch = true;
|
||||
//设置过滤方法
|
||||
$this->request->filter(['strip_tags', 'trim']);
|
||||
if ($this->request->isAjax()) {
|
||||
//如果发送的来源是Selectpage,则转发到Selectpage
|
||||
if ($this->request->request('keyField')) {
|
||||
return $this->selectpage();
|
||||
}
|
||||
list($where, $sort, $order, $offset, $limit) = $this->buildparams();
|
||||
|
||||
$list = $this->model
|
||||
->with(['mattertemplatecategorization'])
|
||||
->where($where)
|
||||
->order($sort, $order)
|
||||
->paginate($limit);
|
||||
|
||||
foreach ($list as $row) {
|
||||
$row->visible(['id','content','day','times']);
|
||||
$row->visible(['mattertemplatecategorization']);
|
||||
$row->getRelation('mattertemplatecategorization')->visible(['name']);
|
||||
}
|
||||
|
||||
$result = array("total" => $list->total(), "rows" => $list->items());
|
||||
|
||||
return json($result);
|
||||
}
|
||||
return $this->view->fetch();
|
||||
}
|
||||
public function add()
|
||||
{
|
||||
if (false === $this->request->isPost()) {
|
||||
$ids = input('ids');
|
||||
$name = Db::table('fa_mattertemplatecategorization')->where('id',$ids)->find();
|
||||
$data = $this->model->where('mattertemplatecategorization_id',$ids)->select();
|
||||
$this->view->assign('name',$name);
|
||||
if (count($data) >0 ){
|
||||
$this->view->assign('row',$data);
|
||||
return $this->view->fetch('edit');
|
||||
}
|
||||
return $this->view->fetch();
|
||||
}
|
||||
$params = $this->request->post();
|
||||
if (empty($params)) {
|
||||
$this->error(__('Parameter %s can not be empty', ''));
|
||||
}
|
||||
$params = $this->preExcludeFields($params);
|
||||
|
||||
if ($this->dataLimit && $this->dataLimitFieldAutoFill) {
|
||||
$params[$this->dataLimitField] = $this->auth->id;
|
||||
}
|
||||
$dataList = [];
|
||||
$inputInfo = [];
|
||||
foreach($params['inputInfo'] as $key=>$value){
|
||||
if (!empty($value['name'])){
|
||||
$inputInfo[$value['name']] = $value['value'];
|
||||
}
|
||||
$inputInfo['mattertemplatecategorization_id'] = $params['mattertemplatecategorization_id'];
|
||||
$inputInfo['create_time'] = $params['create_time'];
|
||||
$inputInfo['update_time'] = $params['update_time'];
|
||||
if (($key+1)%5==0){
|
||||
$dataList[] = $inputInfo;
|
||||
$inputInfo = [];
|
||||
}
|
||||
}
|
||||
$result = false;
|
||||
Db::startTrans();
|
||||
try {
|
||||
//是否采用模型验证
|
||||
if ($this->modelValidate) {
|
||||
$name = str_replace("\\model\\", "\\validate\\", get_class($this->model));
|
||||
$validate = is_bool($this->modelValidate) ? ($this->modelSceneValidate ? $name . '.add' : $name) : $this->modelValidate;
|
||||
$this->model->validateFailException()->validate($validate);
|
||||
}
|
||||
$result = $this->model->allowField(true)->insertAll($dataList);
|
||||
Db::commit();
|
||||
} catch (ValidateException|PDOException|Exception $e) {
|
||||
Db::rollback();
|
||||
$this->error($e->getMessage());
|
||||
}
|
||||
if ($result === false) {
|
||||
$this->error(__('No rows were inserted'));
|
||||
}
|
||||
$this->success();
|
||||
}
|
||||
|
||||
public function newEdit(){
|
||||
$params = $this->request->post();
|
||||
if (empty($params)) {
|
||||
$this->error(__('Parameter %s can not be empty', ''));
|
||||
}
|
||||
$params = $this->preExcludeFields($params);
|
||||
|
||||
$dataList = [];
|
||||
$inputInfo = [];
|
||||
foreach($params['inputInfo'] as $key=>$value){
|
||||
if (!empty($value['name'])){
|
||||
$inputInfo[$value['name']] = $value['value'];
|
||||
}
|
||||
$inputInfo['mattertemplatecategorization_id'] = $params['mattertemplatecategorization_id'];
|
||||
$inputInfo['create_time'] = $params['create_time'];
|
||||
$inputInfo['update_time'] = date('Y-m-d H:i:s');
|
||||
if (($key+1)%6==0){
|
||||
$dataList[] = $inputInfo;
|
||||
$inputInfo = [];
|
||||
}
|
||||
}
|
||||
$result = false;
|
||||
Db::startTrans();
|
||||
try {
|
||||
//是否采用模型验证
|
||||
if ($this->modelValidate) {
|
||||
$name = str_replace("\\model\\", "\\validate\\", get_class($this->model));
|
||||
$validate = is_bool($this->modelValidate) ? ($this->modelSceneValidate ? $name . '.edit' : $name) : $this->modelValidate;
|
||||
$this->model->validateFailException()->validate($validate);
|
||||
}
|
||||
$this->model->where('mattertemplatecategorization_id',$params['mattertemplatecategorization_id'])->delete();
|
||||
$result = $this->model->allowField(true)->insertAll($dataList);
|
||||
Db::commit();
|
||||
} catch (ValidateException|PDOException|Exception $e) {
|
||||
Db::rollback();
|
||||
$this->error($e->getMessage());
|
||||
}
|
||||
if (false === $result) {
|
||||
$this->error(__('No rows were updated'));
|
||||
}
|
||||
$this->success();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
'Id' => '主键ID',
|
||||
'Name' => '事项模板名称',
|
||||
'Create_time' => '创建时间',
|
||||
'Update_time' => '更新时间'
|
||||
];
|
||||
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
'Id' => '序号',
|
||||
'Mattertemplate_id' => '事项模板ID',
|
||||
'Name' => '模板名称',
|
||||
'Firmstoreprojectsone_id' => '到店项目',
|
||||
'Firmstoreprojectstwo_id' => '详细项目',
|
||||
'Create_time' => '创建时间',
|
||||
'Update_time' => '更新时间',
|
||||
'Mattertemplate.name' => '事项模板名称',
|
||||
'Firmstoreprojectsone.name' => '到店项目',
|
||||
'Firmstoreprojectstwo.name' => '详细项目'
|
||||
];
|
||||
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
'Id' => '主键ID',
|
||||
'Mattertemplatecategorization_id' => '事项模版分类ID',
|
||||
'Content' => '内容',
|
||||
'Day' => 'N天后回访',
|
||||
'Times' => '回访时间',
|
||||
'Create_time' => '创建时间',
|
||||
'Update_time' => '更新时间',
|
||||
'Mattertemplatecategorization.name' => '模板名称'
|
||||
];
|
||||
40
superadmin/application/admin/model/Mattertemplate.php
Normal file
40
superadmin/application/admin/model/Mattertemplate.php
Normal file
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\model;
|
||||
|
||||
use think\Model;
|
||||
|
||||
|
||||
class Mattertemplate extends Model
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// 表名
|
||||
protected $name = 'mattertemplate';
|
||||
|
||||
// 自动写入时间戳字段
|
||||
protected $autoWriteTimestamp = false;
|
||||
|
||||
// 定义时间戳字段名
|
||||
protected $createTime = false;
|
||||
protected $updateTime = false;
|
||||
protected $deleteTime = false;
|
||||
|
||||
// 追加属性
|
||||
protected $append = [
|
||||
|
||||
];
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\model;
|
||||
|
||||
use think\Model;
|
||||
|
||||
|
||||
class Mattertemplatecategorization extends Model
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// 表名
|
||||
protected $name = 'mattertemplatecategorization';
|
||||
|
||||
// 自动写入时间戳字段
|
||||
protected $autoWriteTimestamp = false;
|
||||
|
||||
// 定义时间戳字段名
|
||||
protected $createTime = false;
|
||||
protected $updateTime = false;
|
||||
protected $deleteTime = false;
|
||||
|
||||
// 追加属性
|
||||
protected $append = [
|
||||
|
||||
];
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public function mattertemplate()
|
||||
{
|
||||
return $this->belongsTo('Mattertemplate', 'mattertemplate_id', 'id', [], 'LEFT')->setEagerlyType(0);
|
||||
}
|
||||
|
||||
|
||||
public function firmstoreprojectsone()
|
||||
{
|
||||
return $this->belongsTo('Firmstoreprojectsone', 'firmstoreprojectsone_id', 'id', [], 'LEFT')->setEagerlyType(0);
|
||||
}
|
||||
|
||||
|
||||
public function firmstoreprojectstwo()
|
||||
{
|
||||
return $this->belongsTo('Firmstoreprojectstwo', 'id', 'id', [], 'LEFT')->setEagerlyType(0);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\model;
|
||||
|
||||
use think\Model;
|
||||
|
||||
|
||||
class Mattertemplatecategorizedcontent extends Model
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// 表名
|
||||
protected $name = 'mattertemplatecategorizedcontent';
|
||||
|
||||
// 自动写入时间戳字段
|
||||
protected $autoWriteTimestamp = false;
|
||||
|
||||
// 定义时间戳字段名
|
||||
protected $createTime = false;
|
||||
protected $updateTime = false;
|
||||
protected $deleteTime = false;
|
||||
|
||||
// 追加属性
|
||||
protected $append = [
|
||||
|
||||
];
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public function mattertemplatecategorization()
|
||||
{
|
||||
return $this->belongsTo('Mattertemplatecategorization', 'mattertemplatecategorization_id', 'id', [], 'LEFT')->setEagerlyType(0);
|
||||
}
|
||||
}
|
||||
27
superadmin/application/admin/validate/Mattertemplate.php
Normal file
27
superadmin/application/admin/validate/Mattertemplate.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\validate;
|
||||
|
||||
use think\Validate;
|
||||
|
||||
class Mattertemplate extends Validate
|
||||
{
|
||||
/**
|
||||
* 验证规则
|
||||
*/
|
||||
protected $rule = [
|
||||
];
|
||||
/**
|
||||
* 提示消息
|
||||
*/
|
||||
protected $message = [
|
||||
];
|
||||
/**
|
||||
* 验证场景
|
||||
*/
|
||||
protected $scene = [
|
||||
'add' => [],
|
||||
'edit' => [],
|
||||
];
|
||||
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\validate;
|
||||
|
||||
use think\Validate;
|
||||
|
||||
class Mattertemplatecategorization extends Validate
|
||||
{
|
||||
/**
|
||||
* 验证规则
|
||||
*/
|
||||
protected $rule = [
|
||||
];
|
||||
/**
|
||||
* 提示消息
|
||||
*/
|
||||
protected $message = [
|
||||
];
|
||||
/**
|
||||
* 验证场景
|
||||
*/
|
||||
protected $scene = [
|
||||
'add' => [],
|
||||
'edit' => [],
|
||||
];
|
||||
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\validate;
|
||||
|
||||
use think\Validate;
|
||||
|
||||
class Mattertemplatecategorizedcontent extends Validate
|
||||
{
|
||||
/**
|
||||
* 验证规则
|
||||
*/
|
||||
protected $rule = [
|
||||
];
|
||||
/**
|
||||
* 提示消息
|
||||
*/
|
||||
protected $message = [
|
||||
];
|
||||
/**
|
||||
* 验证场景
|
||||
*/
|
||||
protected $scene = [
|
||||
'add' => [],
|
||||
'edit' => [],
|
||||
];
|
||||
|
||||
}
|
||||
27
superadmin/application/admin/view/mattertemplate/add.html
Normal file
27
superadmin/application/admin/view/mattertemplate/add.html
Normal file
@@ -0,0 +1,27 @@
|
||||
<form id="add-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
|
||||
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('Name')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<input id="c-name" data-rule="required" class="form-control" name="row[name]" type="text">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('Create_time')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<input id="c-create_time" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[create_time]" type="text" value="{:date('Y-m-d H:i:s')}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('Update_time')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<input id="c-update_time" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[update_time]" type="text" value="{:date('Y-m-d H:i:s')}">
|
||||
</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-primary btn-embossed disabled">{:__('OK')}</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
27
superadmin/application/admin/view/mattertemplate/edit.html
Normal file
27
superadmin/application/admin/view/mattertemplate/edit.html
Normal file
@@ -0,0 +1,27 @@
|
||||
<form id="edit-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
|
||||
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('Name')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<input id="c-name" data-rule="required" class="form-control" name="row[name]" type="text" value="{$row.name|htmlentities}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('Create_time')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<input id="c-create_time" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[create_time]" type="text" value="{$row.create_time}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('Update_time')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<input id="c-update_time" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[update_time]" type="text" value="{$row.update_time}">
|
||||
</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-primary btn-embossed disabled">{:__('OK')}</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
29
superadmin/application/admin/view/mattertemplate/index.html
Normal file
29
superadmin/application/admin/view/mattertemplate/index.html
Normal file
@@ -0,0 +1,29 @@
|
||||
<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('mattertemplate/add')?'':'hide'}" title="{:__('Add')}" ><i class="fa fa-plus"></i> {:__('Add')}</a>
|
||||
<a href="javascript:;" class="btn btn-success btn-edit btn-disabled disabled {:$auth->check('mattertemplate/edit')?'':'hide'}" title="{:__('Edit')}" ><i class="fa fa-pencil"></i> {:__('Edit')}</a>
|
||||
<a href="javascript:;" class="btn btn-danger btn-del btn-disabled disabled {:$auth->check('mattertemplate/del')?'':'hide'}" title="{:__('Delete')}" ><i class="fa fa-trash"></i> {:__('Delete')}</a>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
<table id="table" class="table table-striped table-bordered table-hover table-nowrap"
|
||||
data-operate-edit="{:$auth->check('mattertemplate/edit')}"
|
||||
data-operate-del="{:$auth->check('mattertemplate/del')}"
|
||||
width="100%">
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,45 @@
|
||||
<form id="add-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
|
||||
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('Mattertemplate_id')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<input id="c-mattertemplate_id" data-rule="required" data-source="mattertemplate/index" class="form-control selectpage" name="row[mattertemplate_id]" type="text" value="">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('Name')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<input id="c-name" class="form-control" name="row[name]" type="text">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('Firmstoreprojectsone_id')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<input id="c-firmstoreprojectsone_id" data-rule="required" data-source="firmstoreprojectsone/index" class="form-control selectpage" name="row[firmstoreprojectsone_id]" type="text" value="">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('Firmstoreprojectstwo_id')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<input id="c-firmstoreprojectstwo_id" data-rule="required" data-source="firmstoreprojectstwo/index" class="form-control selectpage" name="row[firmstoreprojectstwo_id]" type="text" value="">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('Create_time')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<input id="c-create_time" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[create_time]" type="text" value="{:date('Y-m-d H:i:s')}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('Update_time')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<input id="c-update_time" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[update_time]" type="text" value="{:date('Y-m-d H:i:s')}">
|
||||
</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-primary btn-embossed disabled">{:__('OK')}</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
@@ -0,0 +1,45 @@
|
||||
<form id="edit-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
|
||||
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('Mattertemplate_id')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<input id="c-mattertemplate_id" data-rule="required" data-source="mattertemplate/index" class="form-control selectpage" name="row[mattertemplate_id]" type="text" value="{$row.mattertemplate_id|htmlentities}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('Name')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<input id="c-name" class="form-control" name="row[name]" type="text" value="{$row.name|htmlentities}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('Firmstoreprojectsone_id')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<input id="c-firmstoreprojectsone_id" data-rule="required" data-source="firmstoreprojectsone/index" class="form-control selectpage" name="row[firmstoreprojectsone_id]" type="text" value="{$row.firmstoreprojectsone_id|htmlentities}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('Firmstoreprojectstwo_id')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<input id="c-firmstoreprojectstwo_id" data-rule="required" data-source="firmstoreprojectstwo/index" class="form-control selectpage" name="row[firmstoreprojectstwo_id]" type="text" value="{$row.firmstoreprojectstwo_id|htmlentities}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('Create_time')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<input id="c-create_time" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[create_time]" type="text" value="{$row.create_time}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('Update_time')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<input id="c-update_time" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[update_time]" type="text" value="{$row.update_time}">
|
||||
</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-primary btn-embossed disabled">{:__('OK')}</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
@@ -0,0 +1,29 @@
|
||||
<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('mattertemplatecategorization/add')?'':'hide'}" title="{:__('Add')}" ><i class="fa fa-plus"></i> {:__('Add')}</a>
|
||||
<a href="javascript:;" class="btn btn-success btn-edit btn-disabled disabled {:$auth->check('mattertemplatecategorization/edit')?'':'hide'}" title="{:__('Edit')}" ><i class="fa fa-pencil"></i> {:__('Edit')}</a>
|
||||
<a href="javascript:;" class="btn btn-danger btn-del btn-disabled disabled {:$auth->check('mattertemplatecategorization/del')?'':'hide'}" title="{:__('Delete')}" ><i class="fa fa-trash"></i> {:__('Delete')}</a>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
<table id="table" class="table table-striped table-bordered table-hover table-nowrap"
|
||||
data-operate-edit="{:$auth->check('mattertemplatecategorization/edit')}"
|
||||
data-operate-del="{:$auth->check('mattertemplatecategorization/del')}"
|
||||
width="100%">
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,72 @@
|
||||
<form id="add-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
|
||||
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('Mattertemplatecategorization_id')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<input id="c-mattertemplatecategorization_id" data-rule="required" data-source="mattertemplatecategorization/index" class="form-control selectpage" disabled="ture" name="row[mattertemplatecategorization_id]" type="text" value="{$name.id|htmlentities}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form_group_add ">
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('Day')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<input id="c-day" class="form-control" name="day" type="number">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('Times')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<input class="form-control datetimepicker c-times" data-date-format="HH:mm:ss" data-use-current="true" name="times" type="text" value="{:date('H:i:s')}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('回访要点')}:</label>
|
||||
<div class="col-xs-12 col-sm-6">
|
||||
<input class="form-control" class="c-hui-fang-yao-dian" type="text" value="" placeholder="请输入回访要点">
|
||||
</div>
|
||||
<div class="col-xs-12 col-sm-2">
|
||||
<input class="form-control shili_huashu_btn" type="button" value="示例话术">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('Content')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<textarea class="c-content" class="form-control editor" rows="5" name="content" cols="50"></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">
|
||||
<td width="90">
|
||||
<button type="button" class="btn btn-sm btn-danger btn-remove deleteButton"><i class="fa fa-times"></i></button>
|
||||
</td>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="form-group" id="c-add_group_last_div">
|
||||
<label class="control-label col-xs-12 col-sm-2"></label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<button id="c-add_group_content" type="button" class="btn btn-sm btn-success btn-append"><i class="fa fa-plus"></i> {:__('Append')}</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('Create_time')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<input id="c-create_time" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[create_time]" type="text" value="{:date('Y-m-d H:i:s')}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('Update_time')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<input id="c-update_time" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[update_time]" type="text" value="{:date('Y-m-d H:i:s')}">
|
||||
</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="button" id="submit-button" class="btn btn-primary btn-embossed ">{:__('OK')}</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
@@ -0,0 +1,67 @@
|
||||
<form id="edit-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
|
||||
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('Mattertemplatecategorization_id')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<input id="c-mattertemplatecategorization_id" data-rule="required" data-source="mattertemplatecategorization/index" class="form-control selectpage" disabled="ture" name="row[mattertemplatecategorization_id]" type="text" value="{$name.id|htmlentities}">
|
||||
</div>
|
||||
</div>
|
||||
{foreach($row as $value)}
|
||||
<div class="form_group_add ">
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('Day')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<input class="form-control c-day" name="day" type="number" value="{$value.day|htmlentities}">
|
||||
</div>
|
||||
</div>
|
||||
<input type="hidden" name="id" value="{$value.id}">
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('Times')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<input class="form-control datetimepicker c-times" data-date-format="HH:mm:ss" data-use-current="true" name="times" type="text" value="{$value.times}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('回访要点')}:</label>
|
||||
<div class="col-xs-12 col-sm-6">
|
||||
<input class="form-control" class="c-hui-fang-yao-dian" type="text" value="" placeholder="请输入回访要点">
|
||||
</div>
|
||||
<div class="col-xs-12 col-sm-2">
|
||||
<input class="form-control shili_huashu_btn" type="button" value="示例话术">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('Content')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<textarea class="c-content" class="form-control editor" rows="5" name="content" cols="50">{$value.content}</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">
|
||||
<td width="90">
|
||||
<button type="button" class="btn btn-sm btn-danger btn-remove deleteButton"><i class="fa fa-times"></i></button>
|
||||
</td>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/foreach}
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('Create_time')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<input id="c-create_time" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[create_time]" type="text" value="{$row.0.create_time}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('Update_time')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<input id="c-update_time" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[update_time]" type="text" value="{$row.0.update_time}">
|
||||
</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="button" id="submit-button-edit" class="btn btn-primary btn-embossed ">{:__('OK')}</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
@@ -0,0 +1,29 @@
|
||||
<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('mattertemplatecategorizedcontent/add')?'':'hide'}" title="{:__('Add')}" ><i class="fa fa-plus"></i> {:__('Add')}</a>
|
||||
<a href="javascript:;" class="btn btn-success btn-edit btn-disabled disabled {:$auth->check('mattertemplatecategorizedcontent/edit')?'':'hide'}" title="{:__('Edit')}" ><i class="fa fa-pencil"></i> {:__('Edit')}</a>
|
||||
<a href="javascript:;" class="btn btn-danger btn-del btn-disabled disabled {:$auth->check('mattertemplatecategorizedcontent/del')?'':'hide'}" title="{:__('Delete')}" ><i class="fa fa-trash"></i> {:__('Delete')}</a>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
<table id="table" class="table table-striped table-bordered table-hover table-nowrap"
|
||||
data-operate-edit="{:$auth->check('mattertemplatecategorizedcontent/edit')}"
|
||||
data-operate-del="{:$auth->check('mattertemplatecategorizedcontent/del')}"
|
||||
width="100%">
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
53
superadmin/public/assets/js/backend/mattertemplate.js
Normal file
53
superadmin/public/assets/js/backend/mattertemplate.js
Normal file
@@ -0,0 +1,53 @@
|
||||
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
|
||||
|
||||
var Controller = {
|
||||
index: function () {
|
||||
// 初始化表格参数配置
|
||||
Table.api.init({
|
||||
extend: {
|
||||
index_url: 'mattertemplate/index' + location.search,
|
||||
add_url: 'mattertemplate/add',
|
||||
edit_url: 'mattertemplate/edit',
|
||||
del_url: 'mattertemplate/del',
|
||||
multi_url: 'mattertemplate/multi',
|
||||
import_url: 'mattertemplate/import',
|
||||
table: 'mattertemplate',
|
||||
}
|
||||
});
|
||||
|
||||
var table = $("#table");
|
||||
|
||||
// 初始化表格
|
||||
table.bootstrapTable({
|
||||
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
||||
pk: 'id',
|
||||
sortName: 'id',
|
||||
columns: [
|
||||
[
|
||||
{checkbox: true},
|
||||
{field: 'id', title: __('Id')},
|
||||
{field: 'name', title: __('Name'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
|
||||
{field: 'create_time', title: __('Create_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
|
||||
{field: 'update_time', title: __('Update_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
|
||||
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
|
||||
]
|
||||
]
|
||||
});
|
||||
|
||||
// 为表格绑定事件
|
||||
Table.api.bindevent(table);
|
||||
},
|
||||
add: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
edit: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
api: {
|
||||
bindevent: function () {
|
||||
Form.api.bindevent($("form[role=form]"));
|
||||
}
|
||||
}
|
||||
};
|
||||
return Controller;
|
||||
});
|
||||
@@ -0,0 +1,66 @@
|
||||
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
|
||||
|
||||
var Controller = {
|
||||
index: function () {
|
||||
// 初始化表格参数配置
|
||||
Table.api.init({
|
||||
extend: {
|
||||
index_url: 'mattertemplatecategorization/index' + location.search,
|
||||
add_url: 'mattertemplatecategorization/add',
|
||||
edit_url: 'mattertemplatecategorization/edit',
|
||||
del_url: 'mattertemplatecategorization/del',
|
||||
multi_url: 'mattertemplatecategorization/multi',
|
||||
import_url: 'mattertemplatecategorization/import',
|
||||
table: 'mattertemplatecategorization',
|
||||
}
|
||||
});
|
||||
|
||||
var table = $("#table");
|
||||
|
||||
// 初始化表格
|
||||
table.bootstrapTable({
|
||||
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
||||
pk: 'id',
|
||||
sortName: 'id',
|
||||
columns: [
|
||||
[
|
||||
{checkbox: true},
|
||||
{field: 'id', title: __('Id')},
|
||||
{field: 'name', title: __('Name'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
|
||||
{field: 'mattertemplate.name', title: __('Mattertemplate.name'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
|
||||
{field: 'firmstoreprojectsone.name', title: __('Firmstoreprojectsone.name'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
|
||||
{field: 'firmstoreprojectstwo.name', title: __('Firmstoreprojectstwo.name'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
|
||||
{field: 'create_time', title: __('Create_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
|
||||
{field: 'update_time', title: __('Update_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
|
||||
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate,
|
||||
buttons: [
|
||||
{
|
||||
name: 'addUpdata',
|
||||
text: __('添加具体内容'),
|
||||
title: __('添加具体内容'),
|
||||
classname: 'btn btn-xs btn-primary btn-dialog',
|
||||
icon: 'fa fa-magic',
|
||||
url: 'mattertemplatecategorizedcontent/add',
|
||||
},]
|
||||
}
|
||||
]
|
||||
]
|
||||
});
|
||||
|
||||
// 为表格绑定事件
|
||||
Table.api.bindevent(table);
|
||||
},
|
||||
add: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
edit: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
api: {
|
||||
bindevent: function () {
|
||||
Form.api.bindevent($("form[role=form]"));
|
||||
}
|
||||
}
|
||||
};
|
||||
return Controller;
|
||||
});
|
||||
@@ -0,0 +1,130 @@
|
||||
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
|
||||
|
||||
var Controller = {
|
||||
index: function () {
|
||||
// 初始化表格参数配置
|
||||
Table.api.init({
|
||||
extend: {
|
||||
index_url: 'mattertemplatecategorizedcontent/index' + location.search,
|
||||
add_url: 'mattertemplatecategorizedcontent/add',
|
||||
edit_url: 'mattertemplatecategorizedcontent/edit',
|
||||
del_url: 'mattertemplatecategorizedcontent/del',
|
||||
multi_url: 'mattertemplatecategorizedcontent/multi',
|
||||
import_url: 'mattertemplatecategorizedcontent/import',
|
||||
table: 'mattertemplatecategorizedcontent',
|
||||
}
|
||||
});
|
||||
|
||||
var table = $("#table");
|
||||
|
||||
// 初始化表格
|
||||
table.bootstrapTable({
|
||||
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
||||
pk: 'id',
|
||||
sortName: 'id',
|
||||
columns: [
|
||||
[
|
||||
{checkbox: true},
|
||||
{field: 'id', title: __('Id')},
|
||||
{field: 'day', title: __('Day')},
|
||||
{field: 'times', title: __('Times')},
|
||||
{field: 'mattertemplatecategorization.name', title: __('Mattertemplatecategorization.name'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
|
||||
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
|
||||
]
|
||||
]
|
||||
});
|
||||
|
||||
// 为表格绑定事件
|
||||
Table.api.bindevent(table);
|
||||
},
|
||||
add: function () {
|
||||
$('.shili_huashu_btn').on('click',function (e){
|
||||
//读取下拉框的值
|
||||
var groupdiv=$('.shili_huashu_btn').parent().parent().find('form_group_add');
|
||||
console.log($(this));
|
||||
let txt = $('#c-hui-fang-yao-dian').val();
|
||||
// console.log(wx_id);
|
||||
// console.log(e);
|
||||
// let load_index = layer.load(1);
|
||||
$.post('ai/talk_skill',{txt:txt},function (res) {
|
||||
// layer.close(load_index);
|
||||
//回显
|
||||
$('#c-content').val(res.data);
|
||||
},'json');
|
||||
});
|
||||
$('#c-add_group_content').on('click',function (res){
|
||||
res.preventDefault();
|
||||
var html = $('.form_group_add').html();
|
||||
|
||||
html = "<div class='form_group_add'>"+html+"</div>";
|
||||
$('#c-add_group_last_div').before(html);
|
||||
});
|
||||
$('#add-form').on('click', '.deleteButton', function () {
|
||||
// 获取当前删除按钮所在的大 div 并移除
|
||||
var number = $('.form_group_add').length;
|
||||
if (number == 1){layer.msg('至少保留一个')}else
|
||||
$(this).closest('.form_group_add').remove();
|
||||
});
|
||||
$('#edit-form').on('click', '.deleteButton', function () {
|
||||
// 获取当前删除按钮所在的大 div 并移除
|
||||
var number = $('.form_group_add').length;
|
||||
if (number == 1){layer.msg('至少保留一个')}else
|
||||
$(this).closest('.form_group_add').remove();
|
||||
});
|
||||
$('#submit-button').on('click',function (res){
|
||||
var inputInfo = [];
|
||||
$('.form_group_add input , .form_group_add textarea ').each(function () {
|
||||
var value = $(this).val();
|
||||
var valueName = $(this).attr('name');
|
||||
inputInfo.push({ name: valueName, value: value });
|
||||
});
|
||||
var mattertemplatecategorization_id=$('#c-mattertemplatecategorization_id').val();
|
||||
var create_time=$('#c-create_time').val();
|
||||
var update_time=$('#c-update_time').val();
|
||||
$.post('Mattertemplatecategorizedcontent/add',
|
||||
{inputInfo:inputInfo,mattertemplatecategorization_id:mattertemplatecategorization_id,
|
||||
create_time:create_time,update_time:update_time},function (res) {
|
||||
// layer.close(load_index);
|
||||
//回显
|
||||
if (res.code == 1){
|
||||
layer.msg('添加成功');
|
||||
}else {
|
||||
layer.msg('添加失败');
|
||||
}
|
||||
},'json');
|
||||
});
|
||||
$('#submit-button-edit').on('click',function (res){
|
||||
var inputInfo = [];
|
||||
$('.form_group_add input , .form_group_add textarea ').each(function () {
|
||||
var value = $(this).val();
|
||||
var valueName = $(this).attr('name');
|
||||
inputInfo.push({ name: valueName, value: value });
|
||||
});
|
||||
var mattertemplatecategorization_id=$('#c-mattertemplatecategorization_id').val();
|
||||
var create_time=$('#c-create_time').val();
|
||||
var update_time=$('#c-update_time').val();
|
||||
$.post('Mattertemplatecategorizedcontent/newEdit',
|
||||
{inputInfo:inputInfo,mattertemplatecategorization_id:mattertemplatecategorization_id,
|
||||
create_time:create_time,update_time:update_time},function (res) {
|
||||
// layer.close(load_index);
|
||||
//回显
|
||||
if (res.code == 1){
|
||||
layer.msg('添加成功');
|
||||
}else {
|
||||
layer.msg('添加失败');
|
||||
}
|
||||
},'json');
|
||||
});
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
edit: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
api: {
|
||||
bindevent: function () {
|
||||
Form.api.bindevent($("form[role=form]"));
|
||||
}
|
||||
}
|
||||
};
|
||||
return Controller;
|
||||
});
|
||||
Reference in New Issue
Block a user