git子项目测试

This commit is contained in:
焦钰锟 2025-03-17 10:04:28 +08:00
parent c44a9eb4f7
commit 1c6f9095a4
17 changed files with 999 additions and 5 deletions

View File

@ -0,0 +1,208 @@
<?php
/**
* +----------------------------------------------------------------------
* | CRMEB [ CRMEB赋能开发者助力企业发展 ]
* +----------------------------------------------------------------------
* | Copyright (c) 2016~2025 https://www.crmeb.com All rights reserved.
* +----------------------------------------------------------------------
* | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
* +----------------------------------------------------------------------
* | Author: CRMEB Team <admin@crmeb.com>
* +----------------------------------------------------------------------
*/
/**
* 联系我们留言
* @author crud自动生成代码
* @date 2025/03/13
*/
namespace app\adminapi\controller\crud;
use app\adminapi\controller\AuthController;
use think\facade\App;
use app\services\crud\LeaveWordServices;
/**
* Class LeaveWord
* @date 2025/03/13
* @package app\adminapi\controller\crud
*/
class LeaveWord extends AuthController
{
/**
* @var LeaveWordServices
*/
protected $service;
/**
* LeaveWordController constructor.
* @param App $app
* @param LeaveWordServices $service
*/
public function __construct(App $app, LeaveWordServices $service)
{
parent::__construct($app);
$this->service = $service;
}
/**
* 列表
* @date 2025/03/13
* @return \think\Response
*/
public function index()
{
$where = $this->request->getMore([
['name', ''],
['mobile', ''],
['content', ''],
['create_time', ''],
]);
return app('json')->success($this->service->getCrudListIndex($where));
}
/**
* 创建
* @return \think\Response
* @date 2025/03/13
*/
public function create()
{
return app('json')->success($this->service->getCrudForm());
}
/**
* 保存
* @return \think\Response
* @date 2025/03/13
*/
public function save()
{
$data = $this->request->postMore([
['name', ''],
['mobile', ''],
['content', ''],
['create_time', ''],
]);
validate(\app\adminapi\validate\crud\LeaveWordValidate::class)->check($data);
$this->service->crudSave($data);
return app('json')->success(100021);
}
/**
* 编辑获取数据
* @param $id
* @return \think\Response
* @date 2025/03/13
*/
public function edit($id)
{
return app('json')->success($this->service->getCrudForm((int)$id));
}
/**
* 修改
* @param $id
* @return \think\Response
* @date 2025/03/13
*/
public function update($id)
{
if (!$id) {
return app('json')->fail(100100);
}
$data = $this->request->postMore([
['name', ''],
['mobile', ''],
['content', ''],
['create_time', ''],
]);
validate(\app\adminapi\validate\crud\LeaveWordValidate::class)->check($data);
$this->service->crudUpdate((int)$id, $data);
return app('json')->success(100001);
}
/**
* 修改状态
* @param $id
* @return \think\Response
* @date 2025/03/13
*/
public function status($id)
{
if (!$id) {
return app('json')->fail(100100);
}
$data = $this->request->postMore([
['field', ''],
['value', '']
]);
$filedAll = [];
if (!in_array($data['field'], $filedAll)) {
return app('json')->fail(100100);
}
if ($this->service->update(['id'=> $id], [$data['field']=> $data['value']])) {
return app('json')->success(100001);
} else {
return app('json')->fail(100100);
}
}
/**
* 删除
* @param $id
* @return \think\Response
* @date 2025/03/13
*/
public function delete($id)
{
if (!$id) {
return app('json')->fail(100100);
}
if ($this->service->destroy((int)$id)) {
return app('json')->success(100002);
} else {
return app('json')->success(100008);
}
}
/**
* 查看
* @param $id
* @return \think\Response
* @date 2025/03/13
*/
public function read($id)
{
if (!$id) {
return app('json')->fail(100100);
}
$info = $this->service->get($id, ['*'], []);
if (!$info) {
return app('json')->fail(100100);
}
return app('json')->success($info->toArray());
}
}

View File

@ -0,0 +1,23 @@
<?php
use think\facade\Route;
Route::get('crud/leave_word', 'crud.LeaveWord/index')->option(['real_name' => '联系我们留言列表接口']);
Route::get('crud/leave_word/create', 'crud.LeaveWord/create')->option(['real_name' => '联系我们留言获取创建表单接口']);
Route::post('crud/leave_word', 'crud.LeaveWord/save')->option(['real_name' => '联系我们留言保存接口']);
Route::get('crud/leave_word/:id/edit', 'crud.LeaveWord/edit')->option(['real_name' => '联系我们留言获取修改表单接口']);
Route::put('crud/leave_word/:id', 'crud.LeaveWord/update')->option(['real_name' => '联系我们留言修改接口']);
Route::put('crud/leave_word/status/:id', 'crud.LeaveWord/status')->option(['real_name' => '联系我们留言修改状态接口']);
Route::delete('crud/leave_word/:id', 'crud.LeaveWord/delete')->option(['real_name' => '联系我们留言删除接口']);
Route::get('crud/leave_word/:id', 'crud.LeaveWord/read')->option(['real_name' => '联系我们留言查看接口']);

View File

@ -0,0 +1,59 @@
<?php
/**
* +----------------------------------------------------------------------
* | CRMEB [ CRMEB赋能开发者助力企业发展 ]
* +----------------------------------------------------------------------
* | Copyright (c) 2016~2025 https://www.crmeb.com All rights reserved.
* +----------------------------------------------------------------------
* | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
* +----------------------------------------------------------------------
* | Author: CRMEB Team <admin@crmeb.com>
* +----------------------------------------------------------------------
*/
/**
* 联系我们留言
* @author crud自动生成代码
* @date 2025/03/13 11:55:43
*/
namespace app\adminapi\validate\crud;
use think\Validate;
/**
* Class CrudValidate
* @date 2025/03/13
* @package app\adminapi\validate\crud
*/
class LeaveWordValidate extends Validate
{
/**
* @var array
*/
protected $rule = [
'name'=> 'require',
'mobile'=> 'require',
'content'=> 'require',
'create_time'=> 'require',
];
/**
* @var array
*/
protected $message = [
'name.require'=> '姓名必须填写',
'mobile.require'=> '联系方式必须填写',
'content.require'=> '留言必须填写',
'create_time.require'=> '添加时间必须填写',
];
/**
* @var array
*/
protected $scene = [
];
}

View File

@ -12,6 +12,7 @@ namespace app\api\controller\v1;
use app\model\system\config\SystemConfig;
use app\services\diy\DiyServices; use app\services\diy\DiyServices;
use app\services\kefu\service\StoreServiceServices; use app\services\kefu\service\StoreServiceServices;
use app\services\order\DeliveryServiceServices; use app\services\order\DeliveryServiceServices;
@ -24,6 +25,7 @@ use app\services\shipping\SystemCityServices;
use app\services\system\AppVersionServices; use app\services\system\AppVersionServices;
use app\services\system\attachment\SystemAttachmentServices; use app\services\system\attachment\SystemAttachmentServices;
use app\services\system\config\SystemConfigServices; use app\services\system\config\SystemConfigServices;
use app\services\system\config\SystemConfigTabServices;
use app\services\system\lang\LangCodeServices; use app\services\system\lang\LangCodeServices;
use app\services\system\lang\LangCountryServices; use app\services\system\lang\LangCountryServices;
use app\services\system\lang\LangTypeServices; use app\services\system\lang\LangTypeServices;
@ -114,7 +116,7 @@ class PublicController
* 通用根据配置分类获取配置 * 通用根据配置分类获取配置
* @return mixed * @return mixed
*/ */
public function getSysConfig(Request $request) public function getSysConfig(Request $request,SystemConfigTabServices $tab_services)
{ {
[$name] = $request->getMore([ [$name] = $request->getMore([
'name' 'name'
@ -123,9 +125,33 @@ class PublicController
if (!$name) { if (!$name) {
return app('json')->fail('参数错误'); return app('json')->fail('参数错误');
} }
try{
$data = sys_config($name); $data = sys_config($name);
if(!$data){
$tabs = $tab_services->getConfgTabListAll(["eng_title" =>$name]);
if(!$tabs)return app('json')->success("");
return app('json')->success($data); //将数组里的id字段取出成id数组
$tab_ids = array_column($tabs,'id');
// var_dump($tab_ids);
//查询所有等于config_tab_id的配置
$configs = app()->make(SystemConfigServices::class)->getAllConfigList(["tab_id"=>$tab_ids],1, 1000);
// var_dump(app()->make(SystemConfig::class)->getLastSql());
if(!$configs)return app('json')->success("");
$menu_names = array_column($configs,'menu_name');
$data = [];
foreach ($menu_names as $menu_name){
$data[$menu_name] = sys_config($menu_name);
}
}
}catch (\Exception $e){
return app('json')->fail($e->getMessage().$e->getFile().$e->getLine());
}
return app('json')->success("查询成功",["config"=>$data]);
} }
/** /**

View File

@ -10,7 +10,9 @@
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
namespace app\api\controller\v1\publics; namespace app\api\controller\v1\publics;
use app\Request;
use app\services\article\ArticleServices; use app\services\article\ArticleServices;
use app\services\crud\LeaveWordServices;
/** /**
* 文章类 * 文章类
@ -93,11 +95,13 @@ class ArticleController
public function new() public function new()
{ {
[$page, $limit] = $this->services->getPageValue(); [$page, $limit] = $this->services->getPageValue();
$list = $this->services->getList([], $page, $limit)['list']; $data = $this->services->getList([], $page, $limit);
$list = $data['list'];
$count = $data['count'];
foreach ($list as &$item){ foreach ($list as &$item){
$item['add_time'] = date('Y-m-d H:i', $item['add_time']); $item['add_time'] = date('Y-m-d H:i', $item['add_time']);
} }
return app('json')->success($list); return app('json')->success("调用成功",['list'=>$list,"count"=>$count]);
} }
/** /**
@ -117,4 +121,34 @@ class ArticleController
} }
return app('json')->success($list); return app('json')->success($list);
} }
/**
* 联系我们
* @param Request $request
* @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function leave_word(Request $request, LeaveWordServices $service)
{
$data = $request->postMore([
['name', ''],
['mobile', ''],
['content', ''],
['create_time', time()],
]);
validate(\app\adminapi\validate\crud\LeaveWordValidate::class)->check($data);
$service->crudSave($data);
return app('json')->success(100021);
}
} }

View File

@ -38,6 +38,8 @@ Route::group(function () {
Route::get('sys_config', 'v1.PublicController/getSysConfig')->name('getSysConfig')->option(['real_name' => '通用根据配置分类获取配置']);//获取网站配置 Route::get('sys_config', 'v1.PublicController/getSysConfig')->name('getSysConfig')->option(['real_name' => '通用根据配置分类获取配置']);//获取网站配置
Route::post('leave_word', 'v1.publics.ArticleController/leave_word')->option(['real_name' => '联系我们留言保存接口']);
})->option(['mark' => 'index', 'mark_name' => '主页接口']); })->option(['mark' => 'index', 'mark_name' => '主页接口']);
Route::group(function () { Route::group(function () {

View File

@ -0,0 +1,67 @@
<?php
/**
* +----------------------------------------------------------------------
* | CRMEB [ CRMEB赋能开发者助力企业发展 ]
* +----------------------------------------------------------------------
* | Copyright (c) 2016~2025 https://www.crmeb.com All rights reserved.
* +----------------------------------------------------------------------
* | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
* +----------------------------------------------------------------------
* | Author: CRMEB Team <admin@crmeb.com>
* +----------------------------------------------------------------------
*/
/**
* 联系我们留言
* @author crud自动生成代码
* @date 2025/03/13 11:55:43
*/
namespace app\dao\crud;
use app\dao\BaseDao;
use app\model\crud\LeaveWord;
/**
* Class LeaveWordDao
* @date 2025/03/13
* @package app\dao\crud
*/
class LeaveWordDao extends BaseDao
{
/**
* 设置模型
* @return string
* @date 2025/03/13
*/
protected function setModel(): string
{
return LeaveWord::class;
}
/**
* 搜索
* @param array $where
* @return \crmeb\basic\BaseModel
* @throws \ReflectionException
* @date {%DATE%}
*/
public function searchCrudModel(array $where = [], $field = ['*'], string $order = '', array $with = [])
{
return $this->getModel()->field($field)->when($order !== '', function ($query) use ($order) {
$query->order($order);
})->when($with, function ($query) use ($with) {
$query->with($with);
})->when(!empty($where['name']), function($query) use ($where) {
$query->whereLike('name', '%'.$where['name'].'%');
})->when(!empty($where['mobile']), function($query) use ($where) {
$query->whereLike('mobile', '%'.$where['mobile'].'%');
})->when(!empty($where['content']), function($query) use ($where) {
$query->whereLike('content', '%'.$where['content'].'%');
})->when(!empty($where['create_time']), function($query) use ($where) {
$query->whereBetween('create_time', $where['create_time']);
});
}
}

View File

@ -0,0 +1,45 @@
<?php
/**
* +----------------------------------------------------------------------
* | CRMEB [ CRMEB赋能开发者助力企业发展 ]
* +----------------------------------------------------------------------
* | Copyright (c) 2016~2025 https://www.crmeb.com All rights reserved.
* +----------------------------------------------------------------------
* | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
* +----------------------------------------------------------------------
* | Author: CRMEB Team <admin@crmeb.com>
* +----------------------------------------------------------------------
*/
/**
* 联系我们留言
* @author crud自动生成代码
* @date 2025/03/13 11:55:43
*/
namespace app\model\crud;
use crmeb\basic\BaseModel;
/**
* Class LeaveWord
* @date 2025/03/13
* @package app\model\crud
*/
class LeaveWord extends BaseModel
{
/**
* 表名
* @var string
*/
protected $name = 'leave_word';
/**
* 主键
* @var string
*/
protected $pk = 'id';
}

View File

@ -57,7 +57,9 @@ class SystemConfig extends BaseModel
*/ */
public function searchTabIdAttr($query, $value) public function searchTabIdAttr($query, $value)
{ {
$query->where('config_tab_id', $value); // var_dump($value);
// var_dump(1111);
$query->where('config_tab_id',"in", is_int($value)? ''.$value:$value);
} }
/** /**

View File

@ -85,4 +85,15 @@ class SystemConfigTab extends BaseModel
$query->whereLike('title', '%' . $value . '%'); $query->whereLike('title', '%' . $value . '%');
} }
/**
* 分类英文名称搜索器
* @param Model $query
* @param $value
*/
public function searchEngTitleAttr($query, $value)
{
$query->whereLike('eng_title', '%' . $value . '%');
}
} }

View File

@ -0,0 +1,110 @@
<?php
/**
* +----------------------------------------------------------------------
* | CRMEB [ CRMEB赋能开发者助力企业发展 ]
* +----------------------------------------------------------------------
* | Copyright (c) 2016~2025 https://www.crmeb.com All rights reserved.
* +----------------------------------------------------------------------
* | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
* +----------------------------------------------------------------------
* | Author: CRMEB Team <admin@crmeb.com>
* +----------------------------------------------------------------------
*/
/**
* 联系我们留言
* @author crud自动生成代码
* @date 2025/03/13 11:55:43
*/
namespace app\services\crud;
use app\services\BaseServices;
use think\exception\ValidateException;
use app\dao\crud\LeaveWordDao;
use crmeb\services\FormBuilder;
/**
* Class CrudService
* @date 2025/03/13
* @package app\services\crud
*/
class LeaveWordServices extends BaseServices
{
/**
* LeaveWordServices constructor.
* @param LeaveWordDao $dao
*/
public function __construct(LeaveWordDao $dao)
{
$this->dao = $dao;
}
/**
* 主页数据接口
* @param array $where
* @return array
* @date 2025/03/13
*/
public function getCrudListIndex(array $where = [])
{
[$page, $limit] = $this->getPageValue();
$model = $this->dao->searchCrudModel($where, 'name,mobile,content,create_time,id', 'id desc', []);
return ['count' => $model->count(), 'list' => $model->page($page ?: 1, $limit ?: 10)->select()->toArray()];
}
/**
* 编辑和获取表单
* @date 2025/03/13
* @param int $id
* @return array
*/
public function getCrudForm(int $id = 0)
{
$url = '/crud/leave_word';
$info = [];
if ($id) {
$info = $this->dao->get($id);
if (!$info) {
throw new ValidateException(100026);
}
$url .= '/' . $id;
}
$rule = [];
$rule[] = FormBuilder::input("name", "姓名", $info["name"] ?? '');
$rule[] = FormBuilder::input("mobile", "联系方式", $info["mobile"] ?? '');
$rule[] = FormBuilder::textarea("content", "留言", $info["content"] ?? '');
$rule[] = FormBuilder::dateTime("create_time", "添加时间", $info["create_time"] ?? '');
return create_form('联系我们留言', $rule, $url, $id ? 'PUT' : 'POST');
}
/**
* 新增
* @date 2025/03/13
* @param array $data
* @return mixed
*/
public function crudSave(array $data)
{
return $this->dao->save($data);
}
/**
* 修改
* @date 2025/03/13
* @param int $id
* @param array $data
* @return \crmeb\basic\BaseModel
*/
public function crudUpdate(int $id, array $data)
{
return $this->dao->update($id, $data);
}
}

View File

@ -1341,4 +1341,20 @@ WSS;
} }
return true; return true;
} }
/**
* 得到所有配置列表
* @param array $where
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function getAllConfigList(array $where,$page=1, $limit=10)
{
$list = $this->dao->getConfigList($where, $page, $limit);
return $list;
}
} }

View File

@ -49,6 +49,21 @@ class SystemConfigTabServices extends BaseServices
return get_tree_children($list); return get_tree_children($list);
} }
/**
* 获取配置分类
* @param array $where
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function getConfgTabListAll(array $where)
{
return $this->dao->getConfigTabAll(array_merge($where,['status' => 1]), ['id', 'id as value', 'title as label', 'pid', 'icon', 'type']);
}
/** /**
* 获取配置分类列表 * 获取配置分类列表
* @param array $where * @param array $where

@ -0,0 +1 @@
Subproject commit d92a981289af0185c2cfa50486edf382a219b83c

View File

@ -0,0 +1,112 @@
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2025 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
import request from '@/libs/request';
/**
* 获取列表数据
* @param params
* @return {*}
*/
export function getLeaveWordListApi(params) {
return request({
url: 'crud/leave_word',
method: 'get',
params,
});
}
/**
* 获取添加表单数据
* @return {*}
*/
export function getLeaveWordCreateApi() {
return request({
url: 'crud/leave_word/create',
method: 'get',
});
}
/**
* 添加数据
* @param data
* @return {*}
*/
export function leaveWordSaveApi(data) {
return request({
url: 'crud/leave_word',
method: 'post',
data
});
}
/**
* 获取编辑表单数据
* @param id
* @return {*}
*/
export function getLeaveWordEditApi(id) {
return request({
url: `crud/leave_word/${id}/edit`,
method: 'get'
});
}
/**
* 修改数据
* @param id
* @return {*}
*/
export function leaveWordUpdateApi(id, data) {
return request({
url: `crud/leave_word/${id}`,
method: 'put',
data
});
}
/**
* 修改状态
* @param id
* @return {*}
*/
export function leaveWordStatusApi(id, data) {
return request({
url: `crud/leave_word/status/${id}`,
method: 'put',
data
});
}
/**
* 删除数据
* @param id
* @return {*}
*/
export function leaveWordDeleteApi(id) {
return request({
url: `crud/leave_word/${id}`,
method: 'delete'
});
}
/**
* 获取数据
* @param id
* @return {*}
*/
export function getLeaveWordReadApi(id) {
return request({
url: `crud/leave_word/${id}`,
method: 'get'
});
}

View File

@ -0,0 +1,224 @@
<template>
<div>
<el-card shadow="never" class="ivu-mt" :body-style="{padding:0}">
<div class="padding-add">
<el-form
ref="curlFrom"
:model="from"
:label-width="labelWidth"
:label-position="labelPosition"
inline
@submit.native.prevent
>
<el-form-item label="姓名:" label-for="name">
<el-input
v-model="from.name"
placeholder="请输入姓名"
class="form_content_width"
/>
</el-form-item>
<el-form-item label="联系方式:" label-for="mobile">
<el-input
v-model="from.mobile"
placeholder="请输入联系方式"
class="form_content_width"
/>
</el-form-item>
<el-form-item label="留言:" label-for="content">
<el-input
v-model="from.content"
placeholder="请输入留言"
class="form_content_width"
/>
</el-form-item>
<el-form-item label="添加时间:">
<el-date-picker
:editable="false"
clearabl
@change="searchs"
v-model="from.create_time"
format="yyyy/MM/dd"
type="daterange"
value-format="yyyy/MM/dd"
start-placeholder="开始日期"
end-placeholder="结束日期"
style="width:250px;"
></el-date-picker>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="searchs">查询</el-button>
</el-form-item>
</el-form>
</div>
</el-card>
<el-card shadow="never" dis-hover class="ivu-mt mt16">
<el-row type="flex">
<el-col v-bind="grid">
<el-button v-auth="['leave_word-add']" type="primary" icon="md-add" @click="add">添加</el-button>
</el-col>
</el-row>
<el-table
:data="dataList"
ref="table"
class="mt25"
:loading="loading"
highlight-current-row
>
<el-table-column prop="name" label="姓名">
</el-table-column>
<el-table-column prop="mobile" label="联系方式">
</el-table-column>
<el-table-column prop="content" label="留言">
</el-table-column>
<el-table-column prop="create_time" label="添加时间">
</el-table-column>
<el-table-column label="操作">
<template slot-scope="scope">
<a @click="show(scope.row)">详情</a>
<el-divider direction="vertical" />
<a @click="edit(scope.row.id)">修改</a>
<el-divider direction="vertical" />
<a @click="del(scope.row, '删除', scope.$index)">删除</a>
</template>
</el-table-column>
</el-table>
<div class="acea-row row-right page">
<pagination :total="total" @pagination="pageChange" :limit.sync="from.limit" :page.sync="from.page" />
</div>
</el-card>
<el-dialog title="查看详情" :visible.sync="dialogTableVisible" v-if='dialogTableVisible'>
<el-descriptions title="leave_word">
<el-descriptions-item label="">{{info.id}}</el-descriptions-item>
<el-descriptions-item label="姓名">{{info.name}}</el-descriptions-item>
<el-descriptions-item label="联系方式">{{info.mobile}}</el-descriptions-item>
<el-descriptions-item label="留言">{{info.content}}</el-descriptions-item>
<el-descriptions-item label="添加时间">{{info.create_time}}</el-descriptions-item>
</el-descriptions>
</el-dialog>
</div>
</template>
<script>
import { mapState } from 'vuex';
import { leaveWordSaveApi, leaveWordStatusApi, leaveWordDeleteApi, leaveWordUpdateApi, getLeaveWordCreateApi, getLeaveWordEditApi, getLeaveWordListApi, getLeaveWordReadApi} from '@/api/crud/leaveWord';
export default {
name: 'leave_word',
data() {
return {
grid: {
xl: 7,
lg: 7,
md: 12,
sm: 24,
xs: 24,
},
loading: false,
from: {
name:'',
mobile:'',
content:'',
create_time:'',
page: 1,
limit: 15,
},
dataList: [],
total: 0,
dialogTableVisible: false,
info: {},
};
},
computed: {
...mapState('media', ['isMobile']),
labelWidth() {
return this.isMobile ? undefined : '75px';
},
labelPosition() {
return this.isMobile ? 'top' : 'left';
},
},
created() {
this.getList();
},
methods: {
show(row) {
getLeaveWordReadApi(row.id).then(res => {
this.dialogTableVisible = true;
this.info = res.data;
}).catch(res => {
this.$Message.error(res.msg);
})
},
//
updateStatus(row, field) {
leaveWordStatusApi(row.id, {field: field, value: row[field]})
.then(async (res) => {
this.$message.success(res.msg);
})
.catch((res) => {
this.$message.error(res.msg);
});
},
//
add() {
this.$modalForm(getLeaveWordCreateApi()).then(() => this.getList());
},
//
searchs() {
this.from.page = 1;
this.getList();
},
//
getList() {
this.loading = true;
getLeaveWordListApi(this.from)
.then(async (res) => {
let data = res.data;
this.dataList = data.list;
this.total = data.count;
this.loading = false;
})
.catch((res) => {
this.loading = false;
this.$Message.error(res.msg);
});
},
//
pageChange(index) {
this.from.page = index;
this.getList();
},
//
edit(id) {
this.$modalForm(getLeaveWordEditApi(id)).then(() => this.getList());
},
//
del(row, tit, num) {
let delfromData = {
title: tit,
num: num,
url: `crud/leave_word/${row.id}`,
method: 'DELETE',
ids: '',
};
this.$modalSure(delfromData)
.then((res) => {
this.$Message.success(res.msg);
this.getList();
})
.catch((res) => {
this.$Message.error(res.msg);
});
},
},
};
</script>
<style scoped lang="stylus"></style>

View File

@ -0,0 +1,39 @@
// +---------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +---------------------------------------------------------------------
// | Copyright (c) 2016~2025 https://www.crmeb.com All rights reserved.
// +---------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +---------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +---------------------------------------------------------------------
import LayoutMain from '@/layout';
import setting from '@/setting'
let routePre = setting.routePre
const meta = {
auth: true,
}
const pre = 'leave_word_'
export default {
path: `${routePre}`,
name: 'crud_leave_word',
header: '',
meta,
component: LayoutMain,
children: [
{
path: 'crud/leave_word',
name: `${pre}list`,
meta: {
auth: ['leave_word-crud-list-index'],
title: '联系我们留言',
},
component: () => import('@/pages/crud/leaveWord/index'),
},
],
}