FastAdmin菜单规则树形结构分类显示

server/2024/9/19 11:54:39/ 标签: fastadmin, php, 树形分类

控制器controller文件Classification.php

php"><?phpnamespace app\admin\controller\classification;use app\common\controller\Backend;
use fast\Tree;
use think\Db;
use app\admin\model\AuthRule;
use think\Cache;/*** 模块分类管理** @icon fa fa-circle-o*/
class Classification extends Backend
{/*** Classification模型对象* @var \app\admin\model\classification\Classification*/protected $model = null;protected $classificationlist = [];protected $multiFields = 'ismenu,status';public function _initialize(){parent::_initialize();$this->model = new \app\admin\model\classification\Classification;list($where, $sort, $order, $offset, $limit) = $this->buildparams();// 必须将结果集转换为数组$classificationList = \think\Db::name("classification")->field('createtime,updatetime', true)->where($where)->order('weigh DESC,id ASC')->select();$search_id_arr = [];$filter_arr = json_decode($this->request->get("filter"), true);$this->assignconfig("show", 0); // 1 支持搜索 搜索后正常展示数据 0 支持搜索 搜索后不展示数据只记录条数if ($filter_arr != []) {$this->assignconfig("show", 1);}foreach ($classificationList as $k => &$v) {$v['name'] = __($v['name']);if ($filter_arr != [] && isset($filter_arr['name'])) {$search_id_arr[] = $v['pid'];}}unset($v);Tree::instance()->init($classificationList)->icon = ['&nbsp;&nbsp;&nbsp;&nbsp;', '&nbsp;&nbsp;&nbsp;&nbsp;', '&nbsp;&nbsp;&nbsp;&nbsp;'];$this->classificationlist = Tree::instance()->getTreeList(Tree::instance()->getTreeArray(0, '', $search_id_arr), 'name');$classificationdata = [0 => __('None')];foreach ($this->classificationlist as $k => &$v) {if (!$v['ismenu']) {continue;}$classificationdata[$v['id']] = $v['name'];unset($v['spacer']);}unset($v);$this->view->assign('ruledata', $classificationdata);$this->view->assign("menutypeList", $this->model->getMenutypeList());$getPromotionPlatformList = Db::table('fa_classification')->where('pid', '0')->column('promotion_platform');$this->view->assign("promotionPlatformList", array_combine($getPromotionPlatformList, $getPromotionPlatformList));$this->view->assign("statusList", $this->model->getStatusList());}/*** 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改*//*** 查看*/public function index(){if ($this->request->isAjax()) {$list = $this->classificationlist;$total = count($this->classificationlist);$result = array("total" => $total, "rows" => $list);return json($result);}return $this->view->fetch();}/*** 添加*/public function add(){if ($this->request->isPost()) {$this->token();$params = $this->request->post("row/a", [], 'strip_tags');if ($params) {if (!$params['ismenu'] && !$params['pid']) {$this->error(__('The non-menu rule must have parent'));}$result = $this->model->save($params);if ($result === false) {$this->error($this->model->getError());}Cache::rm('__menu__');$this->success();}$this->error();}return $this->view->fetch();}/*** 编辑*/public function edit($ids = null){// 类不存在:app\common\validate\Classification$row = $this->model->get(['id' => $ids]);if (!$row) {$this->error(__('No Results were found'));}if ($this->request->isPost()) {$this->token();$params = $this->request->post("row/a", [], 'strip_tags');if ($params) {if (!$params['ismenu'] && !$params['pid']) {$this->error(__('The non-menu rule must have parent'));}if ($params['pid'] == $row['id']) {$this->error(__('Can not change the parent to self'));}if ($params['pid'] != $row['pid']) {$childrenIds = Tree::instance()->init(collection(AuthRule::select())->toArray())->getChildrenIds($row['id']);if (in_array($params['pid'], $childrenIds)) {$this->error(__('Can not change the parent to child'));}}//这里需要针对name做唯一验证
//                $ruleValidate = \think\Loader::validate('Classification');
//                $ruleValidate->rule([
//                    'name' => 'require|unique:AuthRule,name,' . $row->id,
//                ]);$result = $row->save($params);if ($result === false) {$this->error($row->getError());}Cache::rm('__menu__');$this->success();}$this->error();}$this->view->assign("row", $row);return $this->view->fetch();}/*** 删除*/public function del($ids = ""){if (!$this->request->isPost()) {$this->error(__("Invalid parameters"));}$ids = $ids ? $ids : $this->request->post("ids");if ($ids) {$delIds = [];foreach (explode(',', $ids) as $k => $v) {$delIds = array_merge($delIds, Tree::instance()->getChildrenIds($v, true));}$delIds = array_unique($delIds);$count = $this->model->where('id', 'in', $delIds)->delete();if ($count) {Cache::rm('__menu__');$this->success();}}$this->error();}}

模型model文件Classification.php

php"><?phpnamespace app\admin\model\classification;use think\Model;class Classification extends Model
{// 表名protected $name = 'classification';// 自动写入时间戳字段protected $autoWriteTimestamp = 'integer';// 定义时间戳字段名protected $createTime = 'createtime';protected $updateTime = 'updatetime';protected $deleteTime = false;// 追加属性protected $append = ['menutype_text','status_text'];protected static function init(){self::afterInsert(function ($row) {$pk = $row->getPk();$row->getQuery()->where($pk, $row[$pk])->update(['weigh' => $row[$pk]]);});}public function getMenutypeList(){return ['addtabs' => __('Addtabs'), 'blank' => __('Blank'), 'dialog' => __('Dialog'), 'ajax' => __('Ajax')];}public function getStatusList(){return ['normal' => __('Normal'), 'hidden' => __('Hidden')];}public function getStatusTextAttr($value, $data){$value = $value ? $value : (isset($data['status']) ? $data['status'] : '');$list = $this->getStatusList();return isset($list[$value]) ? $list[$value] : '';}public function getMenutypeTextAttr($value, $data){$value = $value ? $value : (isset($data['menutype']) ? $data['menutype'] : '');$list = $this->getMenutypeList();return isset($list[$value]) ? $list[$value] : '';}}

页面view文件

首页index.html

<div class="panel panel-default panel-intro"><div class="panel-heading">{:build_heading(null,FALSE)}<ul class="nav nav-tabs" data-field="promotion_platform"><li class="{:$Think.get.promotion_platform === null ? 'active' : ''}"><a href="#t-all" data-value="" data-toggle="tab">{:__('All')}</a></li>{foreach name="promotionPlatformList" item="vo"}<li class="{:$Think.get.promotion_platform === (string)$key ? 'active' : ''}"><a href="#t-{$key}" data-value="{$key}" data-toggle="tab">{$vo}</a></li>{/foreach}</ul></div><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('classification/classification/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('classification/classification/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('classification/classification/del')?'':'hide'}" title="{:__('Delete')}" ><i class="fa fa-trash"></i> {:__('Delete')}</a><a href="javascript:;" class="btn btn-danger btn-toggle-all"><i class="fa fa-plus"></i> {:__('Toggle all')}</a></div><table id="table" class="table table-striped table-bordered table-hover table-nowrap"data-operate-edit="{:$auth->check('classification/classification/edit')}"data-operate-del="{:$auth->check('classification/classification/del')}"width="100%"></table></div></div></div></div>
</div>

添加add.html

<form id="add-form" class="form-horizontal form-ajax" role="form" data-toggle="validator" method="POST" action="">{:token()}<div class="form-group"><label class="control-label col-xs-12 col-sm-2">{:__('Ismenu')}:</label><div class="col-xs-12 col-sm-8">{:build_radios('row[ismenu]', ['1'=>__('Yes'), '0'=>__('No')])}</div></div><div class="form-group"><label  class="control-label col-xs-12 col-sm-2">{:__('Parent')}:</label><div class="col-xs-12 col-sm-8">{:build_select('row[pid]', $ruledata, null, ['class'=>'form-control', 'required'=>''])}</div></div><div class="form-group"><label class="control-label col-xs-12 col-sm-2">{:__('Promotion_platform')}:</label><div class="col-xs-12 col-sm-8"><input id="c-promotion_platform" class="form-control" name="row[promotion_platform]" type="text" value="{$row.promotion_platform|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 type="text" class="form-control" id="name" name="row[name]" value="" data-rule="required" /></div></div><div class="form-group"><label class="control-label col-xs-12 col-sm-2">{:__('Keywords')}:</label><div class="col-xs-12 col-sm-8"><input id="c-keywords" class="form-control" name="row[keywords]" type="text" value=""></div></div><div class="form-group"><label class="control-label col-xs-12 col-sm-2">{:__('Description')}:</label><div class="col-xs-12 col-sm-8"><input id="c-description" class="form-control" name="row[description]" type="text" value=""></div></div><div class="form-group" data-type="menu"><label for="remark" class="control-label col-xs-12 col-sm-2">{:__('Menutype')}:</label><div class="col-xs-12 col-sm-8">{:build_radios('row[menutype]', $menutypeList)}</div></div><div class="form-group hidden layer-footer"><div class="col-xs-2"></div><div class="col-xs-12 col-sm-8"><button type="submit" class="btn btn-primary btn-embossed disabled">{:__('OK')}</button><button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button></div></div>
</form>
{include file="auth/rule/tpl" /}

编辑edit.html

<form id="edit-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">{:token()}<div class="form-group"><label class="control-label col-xs-12 col-sm-2">{:__('Ismenu')}:</label><div class="col-xs-12 col-sm-8">{:build_radios('row[ismenu]', ['1'=>__('Yes'), '0'=>__('No')], $row['ismenu'])}</div></div><div class="form-group"><label class="control-label col-xs-12 col-sm-2">{:__('Parent')}:</label><div class="col-xs-12 col-sm-8">{:build_select('row[pid]', $ruledata, $row['pid'], ['class'=>'form-control', 'required'=>''])}</div></div><div class="form-group"><label class="control-label col-xs-12 col-sm-2">{:__('Promotion_platform')}:</label><div class="col-xs-12 col-sm-8"><input id="c-promotion_platform" class="form-control" name="row[promotion_platform]" type="text" value="{$row.promotion_platform|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 type="text" class="form-control" id="name" name="row[name]" value="{$row.name|htmlentities}" data-rule="required" /></div></div><div class="form-group"><label class="control-label col-xs-12 col-sm-2">{:__('Keywords')}:</label><div class="col-xs-12 col-sm-8"><input id="c-keywords" class="form-control" name="row[keywords]" type="text" value="{$row.keywords|htmlentities}"></div></div><div class="form-group"><label class="control-label col-xs-12 col-sm-2">{:__('Description')}:</label><div class="col-xs-12 col-sm-8"><input id="c-description" class="form-control" name="row[description]" type="text" value="{$row.description|htmlentities}"></div></div><div class="form-group" data-type="menu"><label for="remark" class="control-label col-xs-12 col-sm-2">{:__('Menutype')}:</label><div class="col-xs-12 col-sm-8">{:build_radios('row[menutype]', $menutypeList, $row['menutype'])}</div></div><div class="form-group"><label class="control-label col-xs-12 col-sm-2">{:__('Weigh')}:</label><div class="col-xs-12 col-sm-8"><input id="c-weigh" data-rule="required" class="form-control" name="row[weigh]" type="number" value="{$row.weigh|htmlentities}"></div></div><div class="form-group"><label class="control-label col-xs-12 col-sm-2">{:__('Status')}:</label><div class="col-xs-12 col-sm-8"><div class="radio">{foreach name="statusList" item="vo"}<label for="row[status]-{$key}"><input id="row[status]-{$key}" name="row[status]" type="radio" value="{$key}" {in name="key" value="$row.status"}checked{/in} /> {$vo}</label> {/foreach}</div></div></div><div class="form-group layer-footer"><label class="control-label col-xs-12 col-sm-2"></label><div class="col-xs-12 col-sm-8"><button type="submit" class="btn btn-primary btn-embossed disabled">{:__('OK')}</button></div></div>
</form>

对应js文件classification.js

define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {var Controller = {index: function () {// 初始化表格参数配置Table.api.init({extend: {index_url: 'classification/classification/index' + location.search,add_url: 'classification/classification/add',edit_url: 'classification/classification/edit',del_url: 'classification/classification/del',multi_url: 'classification/classification/multi',import_url: 'classification/classification/import',table: 'classification',}});var table = $("#table");// 初始化表格table.bootstrapTable({url: $.fn.bootstrapTable.defaults.extend.index_url,pk: 'id',sortName: 'weigh',fixedColumns: true,fixedRightNumber: 1,// sortName: '',// escape: false,// pagination: false,search: false,// commonSearch: false,rowAttributes: function (row, index) {return row.pid == 0 || Config.show ? {} : {style: 'display:none'};},columns: [[{checkbox: true},{field: 'id', title: __('Id')},{field: 'pid', title: __('Pid')},{field: 'promotion_platform', title: __('Promotion_platform'), formatter: Table.api.formatter.search},{field: 'name', title: __('Name'), operate: 'LIKE', align: 'left', formatter: Controller.api.formatter.title, clickToSelect: !false},{field: 'keywords', title: __('Keywords'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},{field: 'description', title: __('Description'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},{field: 'weigh', title: __('Weigh'), operate: false},{field: 'status', title: __('Status'), formatter: Table.api.formatter.status},{field: 'ismenu',title: __('Ismenu'),align: 'center',table: table,formatter: Table.api.formatter.toggle},{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}]]});// 为表格绑定事件Table.api.bindevent(table);var btnSuccessEvent = function (data, ret) {if ($(this).hasClass("btn-change")) {var index = $(this).data("index");var row = Table.api.getrowbyindex(table, index);row.ismenu = $("i.fa.text-gray", this).length > 0 ? 1 : 0;table.bootstrapTable("updateRow", {index: index, row: row});} else if ($(this).hasClass("btn-delone")) {if ($(this).closest("tr[data-index]").find("a.btn-node-sub.disabled").length > 0) {$(this).closest("tr[data-index]").remove();} else {table.bootstrapTable('refresh');}} else if ($(this).hasClass("btn-dragsort")) {table.bootstrapTable('refresh');}Fast.api.refreshmenu();return false;};//表格内容渲染前table.on('pre-body.bs.table', function (e, data) {var options = table.bootstrapTable("getOptions");options.escape = true;});//当内容渲染完成后table.on('post-body.bs.table', function (e, data) {var options = table.bootstrapTable("getOptions");options.escape = false;//点击切换/排序/删除操作后刷新左侧菜单$(".btn-change[data-id],.btn-delone,.btn-dragsort").data("success", btnSuccessEvent);});table.on('post-body.bs.table', function (e, settings, json, xhr) {//显示隐藏子节点$(">tbody>tr[data-index] > td", this).on('click', "a.btn-node-sub", function () {var status = $(this).data("shown") ? true : false;$("a[data-pid='" + $(this).data("id") + "']").each(function () {$(this).closest("tr").toggle(!status);});if (status) {$("a[data-pid='" + $(this).data("id") + "']").trigger("collapse");}$(this).data("shown", !status);$("i", this).toggleClass("fa-caret-down").toggleClass("fa-caret-right");return false;});});//隐藏子节点$(document).on("collapse", ".btn-node-sub", function () {if ($("i", this).length > 0) {$("a[data-pid='" + $(this).data("id") + "']").trigger("collapse");}$("i", this).removeClass("fa-caret-down").addClass("fa-caret-right");$(this).data("shown", false);$(this).closest("tr").toggle(false);});//批量删除后的回调$(".toolbar > .btn-del,.toolbar .btn-more~ul>li>a").data("success", function (e) {Fast.api.refreshmenu();});//展开隐藏一级$(document.body).on("click", ".btn-toggle", function (e) {$("a[data-id][data-pid][data-pid!=0].disabled").closest("tr").hide();var that = this;var show = $("i", that).hasClass("fa-chevron-down");$("i", that).toggleClass("fa-chevron-down", !show).toggleClass("fa-chevron-up", show);$("a[data-id][data-pid][data-pid!=0]").not('.disabled').closest("tr").toggle(show);$(".btn-node-sub[data-pid=0]").data("shown", show);});//展开隐藏全部$(document.body).on("click", ".btn-toggle-all", function (e) {var that = this;var show = $("i", that).hasClass("fa-plus");$("i", that).toggleClass("fa-plus", !show).toggleClass("fa-minus", show);$(".btn-node-sub:not([data-pid=0])").closest("tr").toggle(show);$(".btn-node-sub").data("shown", show);$(".btn-node-sub > i").toggleClass("fa-caret-down", show).toggleClass("fa-caret-right", !show);});},add: function () {Controller.api.bindevent();},edit: function () {Controller.api.bindevent();},api: {formatter: {title: function (value, row, index) {value = value.toString().replace(/(&|&amp;)nbsp;/g, '&nbsp;');var caret = row.haschild == 1 || row.ismenu == 1 ? '<i class="fa fa-caret-right"></i>' : '';value = value.indexOf("&nbsp;") > -1 ? value.replace(/(.*)&nbsp;/, "$1" + caret) : caret + value;value = !row.ismenu || row.status == 'hidden' ? "<span class='text-muted'>" + value + "</span>" : value;return '<a href="javascript:;" data-id="' + row.id + '" data-pid="' + row.pid + '" class="'+ (row.haschild == 1 || row.ismenu == 1 ? 'text-primary' : 'disabled') + ' btn-node-sub">' + value + '</a>';},name: function (value, row, index) {return !row.ismenu || row.status == 'hidden' ? "<span class='text-muted'>" + value + "</span>" : value;},icon: function (value, row, index) {return '<span class="' + (!row.ismenu || row.status == 'hidden' ? 'text-muted' : '') + '"><i class="' + value + '"></i></span>';}},bindevent: function () {$(document).on('click', "input[name='row[ismenu]']", function () {var name = $("input[name='row[name]']");var ismenu = $(this).val() == 1;name.prop("placeholder", ismenu ? name.data("placeholder-menu") : name.data("placeholder-node"));$('div[data-type="menu"]').toggleClass("hidden", !ismenu);});$("input[name='row[ismenu]']:checked").trigger("click");var iconlist = [];var iconfunc = function () {Layer.open({type: 1,area: ['99%', '98%'], //宽高content: Template('chooseicontpl', {iconlist: iconlist})});};Form.api.bindevent($("form[role=form]"), function (data) {Fast.api.refreshmenu();});$(document).on('change keyup', "#icon", function () {$(this).prev().find("i").prop("class", $(this).val());});$(document).on('click', ".btn-search-icon", function () {if (iconlist.length == 0) {$.get(Config.site.cdnurl + "/assets/libs/font-awesome/less/variables.less", function (ret) {var exp = /fa-var-(.*):/ig;var result;while ((result = exp.exec(ret)) != null) {iconlist.push(result[1]);}iconfunc();});} else {iconfunc();}});$(document).on('click', '#chooseicon ul li', function () {$("input[name='row[icon]']").val('fa fa-' + $(this).data("font")).trigger("change");Layer.closeAll();});$(document).on('keyup', 'input.js-icon-search', function () {$("#chooseicon ul li").show();if ($(this).val() != '') {$("#chooseicon ul li:not([data-font*='" + $(this).val() + "'])").hide();}});}}};return Controller;
});

特别修改(支持搜索)

一. extend\fast\Tree.php中getTreeArray()

php">    /**** 获取树状数组* @param string $myid 要查询的ID* @param string $itemprefix 前缀* @return array*/public function getTreeArray($myid, $itemprefix = '', $search_id_arr = []){$childs = $this->getChild($myid, $search_id_arr);$n = 0;$data = [];$number = 1;if ($childs) {$total = count($childs);foreach ($childs as $id => $value) {$j = $k = '';if ($number == $total) {$j .= $this->icon[2];$k = $itemprefix ? $this->nbsp : '';} else {$j .= $this->icon[1];$k = $itemprefix ? $this->icon[0] : '';}$spacer = $itemprefix ? $itemprefix . $j : '';$value['spacer'] = $spacer;$data[$n] = $value;$data[$n]['childlist'] = $this->getTreeArray($id, $itemprefix . $k . $this->nbsp);$n++;$number++;}}return $data;}

二.extend\fast\Tree.php中getChild()

php">    /*** 得到子级数组* @param int* @return array*/public function getChild($myid, $search_id_arr = []){$newarr = [];foreach ($this->arr as $value) {if (!isset($value['id'])) {continue;}if ($search_id_arr) {if (in_array($value[$this->pidname], $search_id_arr)) {$newarr[$value['id']] = $value;}} else {if ($value[$this->pidname] == $myid) {$newarr[$value['id']] = $value;}}}return $newarr;}

代码不是很精简, 感兴趣的可自行优化!!!


http://www.ppmy.cn/server/41741.html

相关文章

MongoDB聚合运算符:$trim

MongoDB聚合运算符&#xff1a;$trim 文章目录 MongoDB聚合运算符&#xff1a;$trim语法使用空白字符 举例 $trim用来删除字符串开头和结尾的空白字符&#xff08;包括空值&#xff09;或指定字符。 语法 { $trim: { input: <string>, chars: <string> } }input&…

Go 阻塞

阻塞 在Go语言中&#xff0c;阻塞通常指的是一个goroutine&#xff08;轻量级线程&#xff09;在等待另一个goroutine完成操作&#xff08;如I/O操作、channel通信等&#xff09;时&#xff0c;暂时停止执行的现象。Go语言提供了多种同步和通信机制&#xff0c;可以用于实现阻…

linux系统修改网卡名称

说明&#xff1a; 因操作过程需要停用网卡&#xff0c;导致ssh远程连接不上&#xff0c;需要控制台登录操作。 测试环境&#xff1a; CentOS7.9、8.2虚拟机 Suse15 SP4虚拟机 操作步骤&#xff1a; 方法一&#xff1a; 1、 查看网卡当前名称及状态 ip a2、 将网卡状态从启用…

docker镜像容器常用命令

常用基础命令1、docker info #查看docker版本等信息 2、docker search jenkins #搜索jenkins镜像 3、docker history nginx #查看镜像中各层内容及大小,每层对应的dockerfile中的一条指令。 4、docker network ls #显示当前主机上的所有网络 5、docker logs nginx …

c++ vector容器

在C中&#xff0c;vector 是一个动态数组&#xff0c;它可以根据需要自动增长和缩小。以下是对vector的基本概念和常用操作的详细解释&#xff1a; vector基本概念 vector 是一个模板类&#xff0c;它提供了对动态数组的封装。你可以用它来存储任何类型的对象&#xff0c;并自…

Mysql-几何类型-POINT

在MySQL中&#xff0c;地理空间数据类型和功能被称为GIS&#xff08;Geographic Information System&#xff0c;地理信息系统&#xff09;。MySQL支持几种不同的空间数据类型&#xff0c;包括点&#xff08;POINT&#xff09;、线&#xff08;LINESTRING&#xff09;、多边形&…

Spring的表达式语言(SpEL)使用

Spring表达式语言&#xff08;Spring Expression Language&#xff0c;简称SpEL&#xff09;是Spring框架提供的一种强大的表达式语言&#xff0c;它在Spring 2.0版本引入。SpEL的设计灵感来源于传统的EL&#xff08;Expression Language&#xff09;&#xff0c;即JSP中的表达…

基于ChatGPT 和 OpenAI 模型的现代生成式 AI

书籍&#xff1a;Modern Generative AI with ChatGPT and OpenAI Models: Leverage the capabilities of OpenAIs LLM for productivity and innovation with GPT3 and GPT4 作者&#xff1a;Valentina Alto 出版&#xff1a;Packt Publishing 书籍下载-《基于ChatGPT 和 Op…

vue3+ts(<script setup lang=“ts“>)刷新页面后保持下拉框选中效果

效果图&#xff1a; 代码&#xff1a; <template><div class"app-layout"><div class"app-box"><div class"header"><div class"header-left"></div><div class"title">室外智…

泽众财务RPA机器人常见五个应用场景

泽众RPA&#xff08;即机器人流程自动化&#xff0c;Robotic Process Automation, RPA&#xff09;解决方案是依托于各类先进信息技术手段的虚拟劳动力 &#xff08;数字劳动力&#xff09;&#xff0c;根据预先设定的程序操作指令对任务进行自动化处理&#xff0c;实现业务流程…

Golang | Leetcode Golang题解之第90题子集II

题目&#xff1a; 题解&#xff1a; func subsetsWithDup(nums []int) (ans [][]int) {sort.Ints(nums)n : len(nums) outer:for mask : 0; mask < 1<<n; mask {t : []int{}for i, v : range nums {if mask>>i&1 > 0 {if i > 0 && mask>&…

VSCode-vue3.0-安装与配置-export default简单例子

文章目录 1.下载VSCode2.修改语言为中文3.辅助插件列表4.vue3模板文件简单例子5.总结 1.下载VSCode 从官网下载VSCode&#xff0c;并按下一步安装成功。 2.修改语言为中文 点击确认修改&#xff0c;如下图所示&#xff1a; 或者打开命令面板&#xff1a;输入Configure Displ…

k8s的整体架构及其内部工作原理,以及创建一个pod的原理

一、k8s整体架构 二、k8s的作用&#xff0c;为什么要用k8s&#xff0c;以及服务器的发展历程 1、服务器&#xff1a;缺点容易浪费资源&#xff0c;且每个服务器都要装系统&#xff0c;且扩展迁移成本高 2、虚拟机很好地解决了服务器浪费资源的缺点&#xff0c;且部署快&#x…

无人机+通信中继:短波电台技术详解

随着无线通信技术的不断发展&#xff0c;无人机作为一种新型的信息传输平台&#xff0c;已经在多个领域得到了广泛应用。其中&#xff0c;无人机与短波电台的结合&#xff0c;为通信中继领域带来了全新的可能性。本文将详细解析无人机在通信中继中的应用&#xff0c;以及短波电…

近邻算法原理详解

近邻算法&#xff0c;也称为K近邻&#xff08;K-Nearest Neighbors&#xff0c;简称KNN&#xff09;&#xff0c;是监督学习中的一个基础方法&#xff0c;尤其在分类和回归问题中广泛应用。本文将深入探讨近邻算法的基本原理、工作流程以及在实际应用中的优缺点。 ### 基本概念…

HTML【常用的标签】、CSS【选择器】

day45 HTML 继day44&#xff0c;w3cschool 常用的标签 k) 表格 表格由 table 标签来定义。每个表格均有若干行&#xff08;由 tr 标签定义&#xff09;&#xff0c;每行被分割为若干单元格&#xff08;由 标签定义&#xff09;。字母 td指表格数据&#xff08;table data&…

Unity WebGL全屏显示

一、删除footer节点 二、删除最下面点击事件绑定 修改Canvas宽高 canvas.style.width "960px"; canvas.style.height "600px"; 改成 canvas.style.width document.documentElement.clientWidth"px"; canvas.style.height document.document…

@PostMapping和@GetMapping的区别

这两个注解用了很久了&#xff0c;一直没有认真的了解过&#xff0c;单纯的就认为&#xff0c; 前端用get请求&#xff0c;我就用getmapping&#xff0c;或者后端对于数据的增加的时候就用postmapping&#xff0c; 上周的时候&#xff0c;修改一个接口&#xff0c;后端是post…

环境光遮蔽技术在AI去衣应用中的创新探索

引言&#xff1a; 随着计算机视觉和人工智能技术的飞速发展&#xff0c;AI去衣技术逐渐走进公众视野。这一技术以其独特的应用前景和技术挑战引起了广泛的关注。在实现衣物去除的同时保持图像质量的关键技术之一&#xff0c;便是环境光遮蔽技术。本文将深入探讨环境光遮蔽技术在…

51单片机小车制造过程记录

首先感谢B站up主好家伙vcc的资料。 这次小车做出来虽然资料挺全的&#xff0c;但中间还是犯了很多不该犯的错误。 第一个&#xff0c;物料这次我们搞错了挺多&#xff0c;最离谱的应该是最小系统板都错了。 资料里用的stm32f103c8t6&#xff0c;我们开始买成了stm32f103c8t6。…