FastAdmin“文明随手拍”插件更改事件等级引起的bug修复方法
FastAdmin“文明随手拍”插件,后台“配置管理”菜单中修改“事件等级”的级别名称后,点击“事件上报”菜单显示“未知的数据格式!”。
原因:
后台“配置管理”菜单中修改“事件等级”的级别名称后,配置文件config.php中相关内容会自动变更,变更后的配置文件有bug,相关代码如下:
- [
- 'name' => 'levels',
- 'title' => '事件等级',
- 'type' => 'array',
- 'content' => [],
- 'value' => [
- [
- 'level' => '一般隐患',
- 'score' => '0',
- ],
- [
- 'level' => '严重隐患',
- 'score' => '5',
- ],
- [
- 'level' => '较大隐患',
- 'score' => '10',
- ],
- [
- 'level' => '重大隐患',
- 'score' => '20',
- ],
- ],
- 'rule' => 'required',
- 'msg' => '',
- 'tip' => '',
- 'ok' => '',
- 'extend' => '',
- ],
复制代码
临时解决办法:
打开 根目录/addons/keesuishoupai/config.php配置文件,把其中错误代码修正过来,修改好的代码如下:
- [
- 'name' => 'levels',
- 'title' => '事件等级',
- 'type' => 'array',
- 'content' => [],
- 'value' => [
- [
- 'id' => '1',
- 'level' => '一般隐患',
- 'score' => 0,
- ],
- [
- 'id' => '2',
- 'level' => '严重隐患',
- 'score' => 5,
- ],
- [
- 'id' => '3',
- 'level' => '较大隐患',
- 'score' => 10,
- ],
- [
- 'id' => '4',
- 'level' => '重大隐患',
- 'score' => 20,
- ],
- ],
- 'rule' => 'required',
- 'msg' => '',
- 'tip' => '',
- 'ok' => '',
- 'extend' => '',
- ],
复制代码
彻底解决方法:打开 网站根目录 /addons/keesuishoupai/config.html 文件,查找如下一段代码:- {case levels}
- <dl class="fieldlist" data-name="row[{$item.name}]" data-template="levelstpl">
- <dd>
- <ins>级别</ins>
- <ins>奖励积分</ins>
- </dd>
- <dd>
- <a href="javascript:;" class="btn btn-sm btn-success btn-append"><i class="fa fa-plus"></i> 追加</a>
- </dd>
- <textarea name="row[{$item.name}]" cols="30" rows="5" class="hide">{$item.value|json_encode|htmlentities}</textarea>
- </dl>
- <!--定义模板-->
- <script type="text/html" id="levelstpl">
- <dd class="form-inline">
- <input type="text" name="row[<%=name%>][<%=index%>][level]" class="form-control" value="<%=row['level']%>" size="20">
- <input type="text" name="row[<%=name%>][<%=index%>][score]" class="form-control" value="<%=row['score']%>" size="2">
- <span class="btn btn-sm btn-danger btn-remove"><i class="fa fa-times"></i></span> <span class="btn btn-sm btn-primary btn-dragsort"><i class="fa fa-arrows"></i></span>
- </dd>
- </script>
- {/case}
复制代码
在相应位置添加“id”列表项,修改后代码为:- {case levels}
- <dl class="fieldlist" data-name="row[{$item.name}]" data-template="levelstpl">
- <dd>
- <ins>键</ins>
- <ins>级别</ins>
- <ins>奖励积分</ins>
- </dd>
- <dd>
- <a href="javascript:;" class="btn btn-sm btn-success btn-append"><i class="fa fa-plus"></i> 追加</a>
- </dd>
- <textarea name="row[{$item.name}]" cols="30" rows="5" class="hide">{$item.value|json_encode|htmlentities}</textarea>
- </dl>
- <!--定义模板-->
- <script type="text/html" id="levelstpl">
- <dd class="form-inline">
- <input type="text" name="row[<%=name%>][<%=index%>][id]" class="form-control" value="<%=row['id']%>" size="2">
- <input type="text" name="row[<%=name%>][<%=index%>][level]" class="form-control" value="<%=row['level']%>" size="20">
- <input type="text" name="row[<%=name%>][<%=index%>][score]" class="form-control" value="<%=row['score']%>" size="2">
- <span class="btn btn-sm btn-danger btn-remove"><i class="fa fa-times"></i></span> <span class="btn btn-sm btn-primary btn-dragsort"><i class="fa fa-arrows"></i></span>
- </dd>
- </script>
- {/case}
复制代码 最终效果如下:
|
|