系列文章目录
00. 泛微ecode 集成大模型效果展示
01. 泛微ecode二次开发环境搭建
02. 泛微ecode CRUD开发案例
03. 泛微ecode 集成大模型表分析
04. 泛微ecode 基础封装CRUD
05. 泛微ecode 大模型API KEY管理
06. 泛微ecode 大模型模型类型管理
07. 泛微ecode 大模型模型管理
08. 泛微ecode 大模型应用类型管理
09. 泛微ecode 大模型应用管理
10. 泛微ecode 大模型界面设计
11. 泛微ecode 大模型界面具体实现
12. 泛微ecode 集成第三方模型应用框架
13. 本地大模型部署
14. 泛微ecode 连接本地大模型
15. 泛微ecode 前后端接口对接
16. 泛微ecode 翻译助手实战
17. 泛微ecode 大模型结尾
目标
本节内容将介绍大模型应用管理页面的开发、
直接上码
一、前端代码
路径:\src4js\pc4ns\ai_md\apis\baseapi.js
import { WeaTools } from 'ecCom'; // 获取高级搜索条件 export const getCondition = (url, params) => { return WeaTools.callApi(url, 'GET', params); }; // 获取table数据 export const getTableDatas = (url, params) => { return WeaTools.callApi(url, 'GET', params); }; // 获取新增编辑弹框form数据 export const getDialogCondition = (url, params) => { return WeaTools.callApi(url, 'GET', params); }; // 新增保存 export const doAdd = (url, params) => { return WeaTools.callApi(url, 'POST', params); }; // 编辑保存 export const doEdit = (url, params) => { return WeaTools.callApi(url, 'POST', params); }; // 删除 export const doDel = (url, params) => { return WeaTools.callApi(url, 'POST', params); };js
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
路径:src4js\pc4ns\ai_md\components\ai_role.js
import React from 'react'; import { inject, observer } from 'mobx-react'; import { toJS } from 'mobx'; import { Button, Modal } from 'antd'; import { WeaTableNew } from 'comsMobx'; import { WeaTop, WeaTab, WeaRightMenu, WeaDialog } from 'ecCom'; import { renderNoright, getSearchs } from '../util'; // 渲染form数据的方法:因为多个页面都会使用,所以抽的公共方法在util中 const WeaTable = WeaTableNew.WeaTable; const cls = console; const PAGE_TITLE = "AI应用管理" const TS_API_BASE_URL = "/api/ai/role" @inject('roleStore') @observer export default class BaseTable extends React.Component { componentWillMount() { // 初始化渲染页面 const { roleStore: { doInit } } = this.props; doInit(TS_API_BASE_URL); } componentWillReceiveProps(nextProps) { const { roleStore } = this.props; } // 显示列定制 showColumn = () => { const { roleStore: { tableStore} } = this.props; tableStore.setColSetVisible(true); tableStore.tableColSet(true); } // 新增 onAdd = () => { const { roleStore: { setState, dialogForm, tableStore } } = this.props; setState({ isCreate: true, editId: '', visible: true, }); } _getKey(tableStore) { var ls = tableStore.columns.filter(item => item.isPrimarykey == "true"); if (ls.length > 0) { return ls[0].dbField; } return "id"; } // 编辑 onEdit = (record) => { const { roleStore: { setState, dialogForm, tableStore } } = this.props; setState({ isCreate: false, editId: record[this._getKey(tableStore)], visible: true, }); var model = { }; for (var key in dialogForm.fieldMap) { var item = dialogForm.fieldMap[key]; if (item.viewAttr == 2 || item.viewAttr == 3 || item.viewAttr == 1) { if (item.conditionType == "BROWSER") { model[key] = { value: record[key], valueSpan: record[key + 'Span'], valueObj: [{ id: record[key], name: record[key + 'Span'], }] } } else if (item.conditionType == "UPLOAD") { model[key] = { value: record[key], valueSpan: [{ id: record[key], fileid: record[key], filename: "uploadFile.png", filelink: "/spa/document/index2file.jsp?imagefileId="+record[key]+"#/main/document/fileView", imgSrc: "/weaver/weaver.file.FileDownload?fileid="+record[key], loadlink: "/weaver/weaver.file.FileDownload?fileid="+record[key], }], valueObj: [{ fileid: record[key], filename: "uploadFile.png", filelink: "/spa/document/index2file.jsp?imagefileId="+record[key]+"#/main/document/fileView", imgSrc: "/weaver/weaver.file.FileDownload?fileid="+record[key], loadlink: "/weaver/weaver.file.FileDownload?fileid="+record[key], }] } } else { model[key] = { value: record[key], } } } } cls.log(model) dialogForm.updateFields(model) } // 关闭弹框 onCancel = () => { const { roleStore: { setState, dialogForm, dialogFormCondition, initDialogForm } } = this.propsjs
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 60
- 61
- 62
- 63
- 64
- 65
- 66
- 67
- 68
- 69
- 70
- 71
- 72
- 73
- 74
- 75
- 76
- 77
- 78
- 79
- 80
- 81
- 82
- 83
- 84
- 85
- 86
- 87
- 88
- 89
- 90
- 91
- 92
- 93
- 94
- 95
- 96
- 97
- 98
- 99
- 100
- 101
- 102
- 103
- 104
- 105
- 106
- 107
- 108
- 109
- 110
- 111
- 112
- 113
- 114
- 115
- 116
- 117
- 118
- 119
- 120
- 121
- 122
- 123
- 124
- 125
- 126
- 127
- 128
- 129
- 130
- 131
- 132
- 133
- 134
- 135
- 136
- 137
- 138
- 139
- 140
- 141
- 142
- 143
- 144
- 145
- 146
- 147
- 148
- 149
- 150
- 151
- 152
- 153
- 154
- 155
- 156
- 157
- 158
- 159
- 160
- 161
- 162
- 163
- 164
- 165
- 166
- 167
- 168
- 169
- 170
- 171
- 172
- 173
- 174
- 175
- 176
- 177
- 178
- 179
- 180
- 181
- 182
- 183
- 184
- 185
