| | |
| | | </script> |
| | | |
| | | <script type="text/html" id="aiKnowledgeFileOption"> |
| | | <button class="layui-btn layui-btn-normal layui-btn-sm" type="button" shiro:hasPermission="knowledgeList:info" lay-event="aiKnowledgeFileInfoEvent">编辑</button> |
| | | <button class="layui-btn layui-btn-normal layui-btn-sm" type="button" shiro:hasPermission="knowledgeList:add" lay-event="aiKnowledgeFileRefreshEvent">刷新</button> |
| | | <button class="layui-btn layui-btn-danger layui-btn-sm" type="button" shiro:hasPermission="knowledgeList:add" lay-event="aiKnowledgeFileDeleteEvent">删除</button> |
| | | </script> |
| | | |
| | | |
| | |
| | | }); |
| | | } |
| | | |
| | | if (layEvent === 'aiKnowledgeFileRefreshEvent') { |
| | | if (data.state == 3){ |
| | | febs.alert.success('文件已成功解析'); |
| | | return; |
| | | } |
| | | febs.modal.confirm('刷新', '确认刷新?', function () { |
| | | aiKnowledgeFileRefreshEvent(data.id); |
| | | }); |
| | | } |
| | | |
| | | if (layEvent === 'aiKnowledgeFileDeleteEvent') { |
| | | if (data.state != 3){ |
| | | febs.alert.error('文件解析中,不能中断操作'); |
| | | return; |
| | | } |
| | | febs.modal.confirm('删除', '确认删除?', function () { |
| | | aiKnowledgeFileDeleteEvent(data.id); |
| | | }); |
| | | } |
| | | |
| | | }); |
| | | |
| | | function aiKnowledgeFileDeleteEvent(id) { |
| | | febs.get(ctx + 'admin/aiKnowledgeFile/delete/' + id, null, function (data) { |
| | | febs.alert.success(data.message); |
| | | $query.click(); |
| | | }); |
| | | } |
| | | |
| | | function aiKnowledgeFileRefreshEvent(id) { |
| | | febs.get(ctx + 'admin/aiKnowledgeFile/refresh/' + id, null, function (data) { |
| | | febs.alert.success(data.message); |
| | | $query.click(); |
| | | }); |
| | | } |
| | | |
| | | // 初始化表格操作栏各个按钮功能 |
| | | table.on('toolbar(aiKnowledgeFileTable)', function (obj) { |
| | |
| | | {type: 'numbers', title: '', width: 80}, |
| | | {title: '操作', toolbar: '#aiKnowledgeFileOption', minWidth: 200, align: 'center'}, |
| | | {field: 'id', title: 'ID', minWidth: 100,align:'center'}, |
| | | {field: 'companyName', title: '公司', minWidth: 100,align:'center'}, |
| | | {field: 'name', title: '名称', minWidth: 100,align:'center'}, |
| | | |
| | | {field: 'state', title: '状态', minWidth: 100,align:'center', templet: function(d) { |
| | | var stateMap = {'0': '上传服务器', '1': '应用数据应用中', '2': '知识库应用中', '3': '成功'}; |
| | | return stateMap[d.state] || '未知'; |
| | | }} |
| | | ]] |
| | | }); |
| | | } |