This commit is contained in:
2025-03-28 22:08:54 +08:00
parent fc120b02c1
commit 632492eee7
17 changed files with 680 additions and 1 deletions

View File

@@ -0,0 +1,72 @@
<?php
namespace app\admin\controller;
use app\common\controller\Backend;
/**
* 客户反馈
*
* @icon fa fa-circle-o
*/
class Firmcustomerfeedback extends Backend
{
/**
* Firmcustomerfeedback模型对象
* @var \app\admin\model\Firmcustomerfeedback
*/
protected $model = null;
public function _initialize()
{
parent::_initialize();
$this->model = new \app\admin\model\Firmcustomerfeedback;
}
/**
* 默认生成的控制器所继承的父类中有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(['firmcustomer'])
->where($where)
->order($sort, $order)
->paginate($limit);
foreach ($list as $row) {
$row->visible(['id','rel_wx','rel_group','msg','create_time']);
$row->visible(['firmcustomer']);
$row->getRelation('firmcustomer')->visible(['name']);
}
$result = array("total" => $list->total(), "rows" => $list->items());
return json($result);
}
return $this->view->fetch();
}
}

View File

@@ -0,0 +1,12 @@
<?php
return [
'Id' => 'ID',
'Firmcustomer_id' => '客户',
'Firmcustomerfollowuprecord_id' => '回访记录ID',
'Rel_wx' => '关联微信',
'Rel_group' => '关联微信群',
'Msg' => '反馈内容',
'Create_time' => '反馈时间',
'Firmcustomer.name' => '客户'
];

View File

@@ -0,0 +1,44 @@
<?php
namespace app\admin\model;
use think\Model;
class Firmcustomerfeedback extends Model
{
// 表名
protected $name = 'firmcustomerfeedback';
// 自动写入时间戳字段
protected $autoWriteTimestamp = false;
// 定义时间戳字段名
protected $createTime = false;
protected $updateTime = false;
protected $deleteTime = false;
// 追加属性
protected $append = [
];
public function firmcustomer()
{
return $this->belongsTo('Firmcustomer', 'firmcustomer_id', 'id', [], 'LEFT')->setEagerlyType(0);
}
}

View File

@@ -0,0 +1,27 @@
<?php
namespace app\admin\validate;
use think\Validate;
class Firmcustomerfeedback extends Validate
{
/**
* 验证规则
*/
protected $rule = [
];
/**
* 提示消息
*/
protected $message = [
];
/**
* 验证场景
*/
protected $scene = [
'add' => [],
'edit' => [],
];
}

View File

@@ -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">{:__('Firmcustomer_id')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-firmcustomer_id" min="0" data-rule="required" data-source="firmcustomer/index" class="form-control selectpage" name="row[firmcustomer_id]" type="text" value="">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Firmcustomerfollowuprecord_id')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-firmcustomerfollowuprecord_id" min="0" data-rule="required" data-source="firmcustomerfollowuprecord/index" class="form-control selectpage" name="row[firmcustomerfollowuprecord_id]" type="text" value="">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Rel_wx')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-rel_wx" class="form-control" name="row[rel_wx]" type="text" value="">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Rel_group')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-rel_group" class="form-control" name="row[rel_group]" type="text" value="">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Msg')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-msg" class="form-control" name="row[msg]" 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 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>

View File

@@ -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">{:__('Firmcustomer_id')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-firmcustomer_id" min="0" data-rule="required" data-source="firmcustomer/index" class="form-control selectpage" name="row[firmcustomer_id]" type="text" value="{$row.firmcustomer_id|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Firmcustomerfollowuprecord_id')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-firmcustomerfollowuprecord_id" min="0" data-rule="required" data-source="firmcustomerfollowuprecord/index" class="form-control selectpage" name="row[firmcustomerfollowuprecord_id]" type="text" value="{$row.firmcustomerfollowuprecord_id|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Rel_wx')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-rel_wx" class="form-control" name="row[rel_wx]" type="text" value="{$row.rel_wx|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Rel_group')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-rel_group" class="form-control" name="row[rel_group]" type="text" value="{$row.rel_group|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Msg')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-msg" class="form-control" name="row[msg]" type="text" value="{$row.msg|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?datetime($row.create_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>

View 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('firmcustomerfeedback/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('firmcustomerfeedback/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('firmcustomerfeedback/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('firmcustomerfeedback/edit')}"
data-operate-del="{:$auth->check('firmcustomerfeedback/del')}"
width="100%">
</table>
</div>
</div>
</div>
</div>
</div>

View File

@@ -0,0 +1,55 @@
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
var Controller = {
index: function () {
// 初始化表格参数配置
Table.api.init({
extend: {
index_url: 'firmcustomerfeedback/index' + location.search,
add_url: 'firmcustomerfeedback/add',
edit_url: 'firmcustomerfeedback/edit',
del_url: 'firmcustomerfeedback/del',
multi_url: 'firmcustomerfeedback/multi',
import_url: 'firmcustomerfeedback/import',
table: 'firmcustomerfeedback',
}
});
var table = $("#table");
// 初始化表格
table.bootstrapTable({
url: $.fn.bootstrapTable.defaults.extend.index_url,
pk: 'id',
sortName: 'id',
columns: [
[
{checkbox: true},
{field: 'id', title: __('Id')},
{field: 'rel_wx', title: __('Rel_wx'), operate: 'LIKE'},
{field: 'rel_group', title: __('Rel_group'), operate: 'LIKE'},
{field: 'msg', title: __('Msg'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
{field: 'create_time', title: __('Create_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
{field: 'firmcustomer.name', title: __('Firmcustomer.name'), operate: 'LIKE'},
{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;
});