Merge branch 'main' of http://121.37.111.42:3000/ThbTech/gis-bi into main
This commit is contained in:
commit
bff8b62a34
@ -64,7 +64,15 @@ public class ModuleController {
|
|||||||
// 获取模块详情
|
// 获取模块详情
|
||||||
@GetMapping("/{id}")
|
@GetMapping("/{id}")
|
||||||
public ResponseResult getById(@PathVariable String id) {
|
public ResponseResult getById(@PathVariable String id) {
|
||||||
return ResponseResult.successData(moduleService.getById(id));
|
Map<String, Object> moduleMap=null;
|
||||||
|
try {
|
||||||
|
LambdaQueryWrapper<Module> wrapper = new LambdaQueryWrapper<>();
|
||||||
|
wrapper.eq(Module::getId, id);
|
||||||
|
moduleMap = moduleService.getMap(wrapper);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return ResponseResult.successData(moduleMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 新增:根据pid判断是否有子节点
|
// 新增:根据pid判断是否有子节点
|
||||||
|
@ -62,11 +62,13 @@ public class Module implements Serializable {
|
|||||||
/**
|
/**
|
||||||
* 样式数据
|
* 样式数据
|
||||||
*/
|
*/
|
||||||
|
@TableField(value = "canvas_style_data", jdbcType = JdbcType.VARCHAR)
|
||||||
private String canvasStyleData;
|
private String canvasStyleData;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 组件数据
|
* 组件数据
|
||||||
*/
|
*/
|
||||||
|
@TableField(value = "component_data", jdbcType = JdbcType.VARCHAR)
|
||||||
private String componentData;
|
private String componentData;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -20,6 +20,6 @@ import java.util.Map;
|
|||||||
*/
|
*/
|
||||||
@Mapper
|
@Mapper
|
||||||
public interface CoreDatasetTableMapper extends BaseMapper<CoreDatasetTable> {
|
public interface CoreDatasetTableMapper extends BaseMapper<CoreDatasetTable> {
|
||||||
@Select("select b.name group_name,a.table_name table_name,a.id table_id from core_dataset_table a join core_dataset_group b on (a.dataset_group_id=b.id) where b.app_id=#{appid} and a.type='db' order by a.name")
|
@Select("select b.name group_name,a.table_name table_name,a.id table_id,a.datasource_id datasource_id from core_dataset_table a join core_dataset_group b on (a.dataset_group_id=b.id) where b.app_id=#{appid} and a.type='db' order by a.name")
|
||||||
List<Map<String,Object>> getTablesByAppId(String appid);
|
List<Map<String,Object>> getTablesByAppId(String appid);
|
||||||
}
|
}
|
||||||
|
@ -41,6 +41,7 @@ import io.gisbi.extensions.view.dto.ColumnPermissionItem;
|
|||||||
import io.gisbi.extensions.view.dto.SqlVariableDetails;
|
import io.gisbi.extensions.view.dto.SqlVariableDetails;
|
||||||
import io.gisbi.i18n.Translator;
|
import io.gisbi.i18n.Translator;
|
||||||
import io.gisbi.utils.BeanUtils;
|
import io.gisbi.utils.BeanUtils;
|
||||||
|
import io.gisbi.utils.IDUtils;
|
||||||
import io.gisbi.utils.JsonUtil;
|
import io.gisbi.utils.JsonUtil;
|
||||||
import io.gisbi.utils.TreeUtils;
|
import io.gisbi.utils.TreeUtils;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
@ -1188,7 +1189,10 @@ public class DatasetDataManage {
|
|||||||
Map<String, Object> field = fieldList.get(i);
|
Map<String, Object> field = fieldList.get(i);
|
||||||
String fieldName = (String) field.get("fieldName");
|
String fieldName = (String) field.get("fieldName");
|
||||||
Object fieldValue = field.get("fieldValue");
|
Object fieldValue = field.get("fieldValue");
|
||||||
|
boolean isPrimaryKey = field.get("IsPrimaryKey") != null && (boolean) field.get("IsPrimaryKey");
|
||||||
|
if (isPrimaryKey) {
|
||||||
|
if (fieldValue == null) {fieldValue= IDUtils.snowID();}
|
||||||
|
}
|
||||||
if (i > 0) {
|
if (i > 0) {
|
||||||
columns.append(", ");
|
columns.append(", ");
|
||||||
values.append(", ");
|
values.append(", ");
|
||||||
@ -1222,6 +1226,68 @@ public class DatasetDataManage {
|
|||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
public Map<String, Object> getTableDataByPk(Long datasourceId, String tableData) throws Exception {
|
||||||
|
// 获取数据源信息
|
||||||
|
CoreDatasource coreDatasource = coreDatasourceMapper.selectById(datasourceId);
|
||||||
|
if (coreDatasource == null) {
|
||||||
|
DEException.throwException("数据源不存在");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 解析 JSON 数据
|
||||||
|
Map<String, Object> dataMap = JsonUtil.parseObject(tableData, Map.class);
|
||||||
|
String tableName = (String) dataMap.get("tableName");
|
||||||
|
String primaryKeyField = (String) dataMap.get("primaryKeyField");
|
||||||
|
Object primaryKeyValue = dataMap.get("primaryKeyValue");
|
||||||
|
|
||||||
|
// 参数校验
|
||||||
|
if (StringUtils.isBlank(tableName)) {
|
||||||
|
DEException.throwException("表名不能为空");
|
||||||
|
}
|
||||||
|
if (StringUtils.isBlank(primaryKeyField) || primaryKeyValue == null) {
|
||||||
|
DEException.throwException("主键字段或值不能为空");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 构建 SELECT 语句
|
||||||
|
String whereClause;
|
||||||
|
if (primaryKeyValue instanceof String) {
|
||||||
|
whereClause = String.format("%s = '%s'", primaryKeyField, primaryKeyValue);
|
||||||
|
} else {
|
||||||
|
whereClause = String.format("%s = %s", primaryKeyField, primaryKeyValue);
|
||||||
|
}
|
||||||
|
String sql = String.format("SELECT * FROM %s WHERE %s", tableName, whereClause);
|
||||||
|
|
||||||
|
// 执行查询操作
|
||||||
|
DatasourceSchemaDTO datasourceSchemaDTO = new DatasourceSchemaDTO();
|
||||||
|
BeanUtils.copyBean(datasourceSchemaDTO, coreDatasource);
|
||||||
|
|
||||||
|
Provider provider = ProviderFactory.getProvider(coreDatasource.getType());
|
||||||
|
DatasourceRequest datasourceRequest = new DatasourceRequest();
|
||||||
|
datasourceRequest.setQuery(sql);
|
||||||
|
datasourceRequest.setDsList(Map.of(datasourceSchemaDTO.getId(), datasourceSchemaDTO));
|
||||||
|
|
||||||
|
logger.debug("执行查询数据的SQL: {}", sql);
|
||||||
|
|
||||||
|
// 获取查询结果
|
||||||
|
Map<String, Object> data = provider.fetchResultField(datasourceRequest);
|
||||||
|
|
||||||
|
// 处理查询结果
|
||||||
|
List<String[]> dataList = (List<String[]>) data.get("data");
|
||||||
|
List<TableField> fields = (List<TableField>) data.get("fields");
|
||||||
|
|
||||||
|
if (CollectionUtils.isEmpty(dataList) || dataList.size() == 0) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 将结果转换为 Map 格式
|
||||||
|
String[] row = dataList.get(0);
|
||||||
|
Map<String, Object> resultMap = new LinkedHashMap<>();
|
||||||
|
for (int i = 0; i < fields.size(); i++) {
|
||||||
|
TableField field = fields.get(i);
|
||||||
|
String fieldName = field.getOriginName();
|
||||||
|
resultMap.put(fieldName, row[i]);
|
||||||
|
}
|
||||||
|
return resultMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean updateTableData(Long datasourceId, String tableData) throws Exception {
|
public boolean updateTableData(Long datasourceId, String tableData) throws Exception {
|
||||||
|
@ -104,6 +104,12 @@ public class DatasetDataServer implements DatasetDataApi {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @GetMapping("getTablesByAppId")
|
||||||
|
// public List<Map<String,Object>> getTablesByAppId(String appid) throws Exception {
|
||||||
|
// List<Map<String,Object>> result = datasetDataManage.getTablesByAppId(appid);
|
||||||
|
// return result;
|
||||||
|
// }
|
||||||
|
|
||||||
@GetMapping("getTablesByAppId")
|
@GetMapping("getTablesByAppId")
|
||||||
public List<Map<String,Object>> getTablesByAppId(String appid) throws Exception {
|
public List<Map<String,Object>> getTablesByAppId(String appid) throws Exception {
|
||||||
List<Map<String,Object>> result = datasetDataManage.getTablesByAppId(appid);
|
List<Map<String,Object>> result = datasetDataManage.getTablesByAppId(appid);
|
||||||
@ -115,15 +121,24 @@ public class DatasetDataServer implements DatasetDataApi {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@PostMapping("addTableData")
|
@PostMapping("addTableData")
|
||||||
public boolean addTableData(Long datasourceId, @RequestBody String tableData) throws Exception {
|
public boolean addTableData(Long datasourceId, @RequestParam("tableData") String tableData) throws Exception {
|
||||||
boolean result = datasetDataManage.addTableData(
|
boolean result = datasetDataManage.addTableData(
|
||||||
datasourceId,
|
datasourceId,
|
||||||
tableData
|
tableData
|
||||||
);
|
);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PostMapping("getTableDataByPk")
|
||||||
|
public Map<String, Object> getTableDataByPk(Long datasourceId,@RequestParam("whereJson") String whereJson) throws Exception {
|
||||||
|
Map<String, Object> result=datasetDataManage.getTableDataByPk(
|
||||||
|
datasourceId,
|
||||||
|
whereJson
|
||||||
|
);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
@PostMapping("updateTableData")
|
@PostMapping("updateTableData")
|
||||||
public boolean updateTableData(Long datasourceId, @RequestBody String tableData) throws Exception {
|
public boolean updateTableData(Long datasourceId, @RequestParam("tableData") String tableData) throws Exception {
|
||||||
boolean result = datasetDataManage.updateTableData(
|
boolean result = datasetDataManage.updateTableData(
|
||||||
datasourceId,
|
datasourceId,
|
||||||
tableData
|
tableData
|
||||||
@ -131,7 +146,7 @@ public class DatasetDataServer implements DatasetDataApi {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@PostMapping("deleteTableData")
|
@PostMapping("deleteTableData")
|
||||||
public boolean deleteTableData(Long datasourceId, @RequestBody String whereJson) throws Exception {
|
public boolean deleteTableData(Long datasourceId, @RequestParam("whereJson") String whereJson) throws Exception {
|
||||||
boolean result = datasetDataManage.deleteTableData(
|
boolean result = datasetDataManage.deleteTableData(
|
||||||
datasourceId,
|
datasourceId,
|
||||||
whereJson
|
whereJson
|
||||||
@ -139,7 +154,7 @@ public class DatasetDataServer implements DatasetDataApi {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@PostMapping("queryTableDataPaged")
|
@PostMapping("queryTableDataPaged")
|
||||||
public Page<Map<String, Object>> queryTableDataPaged(Long datasourceId, @RequestBody String queryJson) throws Exception {
|
public Page<Map<String, Object>> queryTableDataPaged(Long datasourceId, @RequestParam("queryJson") String queryJson) throws Exception {
|
||||||
Page<Map<String, Object>> result = datasetDataManage.queryTableDataPaged(
|
Page<Map<String, Object>> result = datasetDataManage.queryTableDataPaged(
|
||||||
datasourceId,
|
datasourceId,
|
||||||
queryJson
|
queryJson
|
||||||
|
@ -32,6 +32,7 @@ const onDatasetUpdate = () => {
|
|||||||
res.quotaList.pop()
|
res.quotaList.pop()
|
||||||
view.value.xAxis.push(...res.dimensionList, ...res.quotaList)
|
view.value.xAxis.push(...res.dimensionList, ...res.quotaList)
|
||||||
const viewTarget = view.value
|
const viewTarget = view.value
|
||||||
|
debugger
|
||||||
useEmitt().emitter.emit('calcData-' + viewTarget.id, viewTarget)
|
useEmitt().emitter.emit('calcData-' + viewTarget.id, viewTarget)
|
||||||
snapshotStore.recordSnapshotCache('calc', view.value.id)
|
snapshotStore.recordSnapshotCache('calc', view.value.id)
|
||||||
})
|
})
|
||||||
|
61018
core/core-frontend/src/fcDesignerPro/index.es.js
Normal file
61018
core/core-frontend/src/fcDesignerPro/index.es.js
Normal file
File diff suppressed because one or more lines are too long
1548
core/core-frontend/src/fcDesignerPro/index.umd.js
Normal file
1548
core/core-frontend/src/fcDesignerPro/index.umd.js
Normal file
File diff suppressed because one or more lines are too long
59669
core/core-frontend/src/fcDesignerPro/pc/index.es.js
Normal file
59669
core/core-frontend/src/fcDesignerPro/pc/index.es.js
Normal file
File diff suppressed because one or more lines are too long
1533
core/core-frontend/src/fcDesignerPro/pc/index.umd.js
Normal file
1533
core/core-frontend/src/fcDesignerPro/pc/index.umd.js
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
16363
core/core-frontend/src/fcDesignerPro/render/vant/form-create.es.js
Normal file
16363
core/core-frontend/src/fcDesignerPro/render/vant/form-create.es.js
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -168,7 +168,7 @@ export default {
|
|||||||
all: '全部',
|
all: '全部',
|
||||||
successful_go_to: '导出成功,前往',
|
successful_go_to: '导出成功,前往',
|
||||||
failed_go_to: '导出失败,前往',
|
failed_go_to: '导出失败,前往',
|
||||||
data_set: '数据集',
|
data_set: '数据集1',
|
||||||
view: '图表',
|
view: '图表',
|
||||||
organization: '所属组织',
|
organization: '所属组织',
|
||||||
download: '下载',
|
download: '下载',
|
||||||
@ -858,7 +858,7 @@ export default {
|
|||||||
menu: '菜单权限',
|
menu: '菜单权限',
|
||||||
panel: '仪表板',
|
panel: '仪表板',
|
||||||
screen: '数据大屏',
|
screen: '数据大屏',
|
||||||
dataset: '数据集',
|
dataset: '数据集2',
|
||||||
datasource: '数据源',
|
datasource: '数据源',
|
||||||
all_types: '全部类型',
|
all_types: '全部类型',
|
||||||
empty_desc: '请选择用户/角色以及资源类型',
|
empty_desc: '请选择用户/角色以及资源类型',
|
||||||
@ -2011,7 +2011,7 @@ export default {
|
|||||||
time_all: '日期-年月日时分秒',
|
time_all: '日期-年月日时分秒',
|
||||||
dataset_sync: ' ( 数据同步中... )',
|
dataset_sync: ' ( 数据同步中... )',
|
||||||
sheet_warn: '有多个 Sheet 页,默认抽取第一个',
|
sheet_warn: '有多个 Sheet 页,默认抽取第一个',
|
||||||
datalist: '数据集',
|
datalist: '数据集3',
|
||||||
name: '数据集名称',
|
name: '数据集名称',
|
||||||
add_group: '添加分组',
|
add_group: '添加分组',
|
||||||
add_scene: '添加场景',
|
add_scene: '添加场景',
|
||||||
@ -2150,7 +2150,7 @@ export default {
|
|||||||
next_exec_time: '下次执行时间',
|
next_exec_time: '下次执行时间',
|
||||||
last_exec_status: '上次执行结果',
|
last_exec_status: '上次执行结果',
|
||||||
task_status: '任务状态',
|
task_status: '任务状态',
|
||||||
dataset: '数据集',
|
dataset: '数据集4',
|
||||||
search_by_name: '根据名称搜索',
|
search_by_name: '根据名称搜索',
|
||||||
underway: '等待执行',
|
underway: '等待执行',
|
||||||
stopped: '执行结束',
|
stopped: '执行结束',
|
||||||
@ -2879,7 +2879,7 @@ export default {
|
|||||||
cancel: '取消',
|
cancel: '取消',
|
||||||
select_ds_group_folder: '请选择数据集分组所属文件夹',
|
select_ds_group_folder: '请选择数据集分组所属文件夹',
|
||||||
app_no_datasource_tips: '存在未配置的数据源',
|
app_no_datasource_tips: '存在未配置的数据源',
|
||||||
dataset: '数据集',
|
dataset: '数据集5',
|
||||||
delete: '删除',
|
delete: '删除',
|
||||||
delete_success: '删除成功',
|
delete_success: '删除成功',
|
||||||
save_success: '保存成功',
|
save_success: '保存成功',
|
||||||
@ -3496,7 +3496,7 @@ export default {
|
|||||||
big_data_screen: '数据大屏',
|
big_data_screen: '数据大屏',
|
||||||
big_screen: '大屏',
|
big_screen: '大屏',
|
||||||
dashboard: '仪表板',
|
dashboard: '仪表板',
|
||||||
data_set: '数据集',
|
data_set: '数据集6',
|
||||||
data_source: '数据源',
|
data_source: '数据源',
|
||||||
recently_used: '最近使用',
|
recently_used: '最近使用',
|
||||||
my_collection: '我的收藏',
|
my_collection: '我的收藏',
|
||||||
@ -4347,7 +4347,7 @@ export default {
|
|||||||
relation: {
|
relation: {
|
||||||
no_permission: '没有查看权限',
|
no_permission: '没有查看权限',
|
||||||
datasource: '数据源',
|
datasource: '数据源',
|
||||||
dataset: '数据集',
|
dataset: '数据集7',
|
||||||
dashboard: '仪表板',
|
dashboard: '仪表板',
|
||||||
dataV: '数据大屏',
|
dataV: '数据大屏',
|
||||||
analysis: '血缘分析',
|
analysis: '血缘分析',
|
||||||
|
@ -3,6 +3,8 @@ import '@/style/index.less'
|
|||||||
import 'normalize.css/normalize.css'
|
import 'normalize.css/normalize.css'
|
||||||
import '@antv/s2/dist/style.min.css'
|
import '@antv/s2/dist/style.min.css'
|
||||||
import App from './App.vue'
|
import App from './App.vue'
|
||||||
|
import FcDesigner from '@/fcDesignerPro/index.es.js'
|
||||||
|
|
||||||
import ElementPlus from 'element-plus';
|
import ElementPlus from 'element-plus';
|
||||||
import 'element-plus/theme-chalk/index.css';
|
import 'element-plus/theme-chalk/index.css';
|
||||||
import { setupI18n } from '@/plugins/vue-i18n'
|
import { setupI18n } from '@/plugins/vue-i18n'
|
||||||
@ -12,7 +14,7 @@ import { setupElementPlus, setupElementPlusIcons } from '@/plugins/element-plus'
|
|||||||
// 注册数据大屏组件
|
// 注册数据大屏组件
|
||||||
import { setupCustomComponent } from '@/custom-component'
|
import { setupCustomComponent } from '@/custom-component'
|
||||||
import { installDirective } from '@/directive'
|
import { installDirective } from '@/directive'
|
||||||
import FcDesigner from '@form-create/designer';
|
// import FcDesigner from '@form-create/designer';
|
||||||
import '@/utils/DateUtil'
|
import '@/utils/DateUtil'
|
||||||
import '@/permission'
|
import '@/permission'
|
||||||
import WebSocketPlugin from '../../websocket'
|
import WebSocketPlugin from '../../websocket'
|
||||||
|
@ -10,7 +10,7 @@ import { pathValid } from '@/store/modules/permission'
|
|||||||
import { useCache } from '@/hooks/web/useCache'
|
import { useCache } from '@/hooks/web/useCache'
|
||||||
import { useAppStoreWithOut } from '@/store/modules/app'
|
import { useAppStoreWithOut } from '@/store/modules/app'
|
||||||
import { useRoute } from 'vue-router'
|
import { useRoute } from 'vue-router'
|
||||||
|
import router from '@/router'
|
||||||
const appStore = useAppStoreWithOut()
|
const appStore = useAppStoreWithOut()
|
||||||
const { wsCache } = useCache()
|
const { wsCache } = useCache()
|
||||||
export interface InnerInteractive {
|
export interface InnerInteractive {
|
||||||
@ -75,8 +75,14 @@ export const interactiveStore = defineStore('interactive', {
|
|||||||
if (!resParam) {
|
if (!resParam) {
|
||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
const appId:any = ref('')
|
const appId:any = ref('')
|
||||||
if (route.query.id) {
|
if (route && route.query.id) {
|
||||||
appId.value = route.query.id
|
appId.value = route.query.id
|
||||||
|
}else{
|
||||||
|
if(router.currentRoute.value.query.id){
|
||||||
|
appId.value = router.currentRoute.value.query.id
|
||||||
|
}else if(router.currentRoute.value.query.appId){
|
||||||
|
appId.value = router.currentRoute.value.query.appId
|
||||||
|
}
|
||||||
}
|
}
|
||||||
const method = apiMap[flag]
|
const method = apiMap[flag]
|
||||||
param.appId = appId.value
|
param.appId = appId.value
|
||||||
|
@ -129,7 +129,7 @@ function editClic(data:any){
|
|||||||
}else if(data.type == '0301'){
|
}else if(data.type == '0301'){
|
||||||
window.open('/#/dashboard?resourceId=' + data.id + '&appId='+projectInfo.value.id, '_blank');
|
window.open('/#/dashboard?resourceId=' + data.id + '&appId='+projectInfo.value.id, '_blank');
|
||||||
}else if(data.type == '09'){
|
}else if(data.type == '09'){
|
||||||
window.open('/#/formcreatedesigner?moduleId=' +data.id, '_blank');
|
window.open('/#/formcreatedesigner?moduleId=' +data.id + '&appId='+projectInfo.value.id, '_blank');
|
||||||
}
|
}
|
||||||
// window.open('/#/dvCanvas?dvId=' + "1097641013486424064", '_blank');
|
// window.open('/#/dvCanvas?dvId=' + "1097641013486424064", '_blank');
|
||||||
}
|
}
|
||||||
|
@ -296,7 +296,6 @@ const saveDataset = () => {
|
|||||||
}
|
}
|
||||||
request.apiConfiguration = ''
|
request.apiConfiguration = ''
|
||||||
request.appId = appId.value
|
request.appId = appId.value
|
||||||
debugger
|
|
||||||
checkRepeat(request).then(res => {
|
checkRepeat(request).then(res => {
|
||||||
let method = request.id === '' ? save : update
|
let method = request.id === '' ? save : update
|
||||||
if (!request.type.startsWith('API')) {
|
if (!request.type.startsWith('API')) {
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
v-model="formData"
|
v-model="formData"
|
||||||
v-model:api="fapi"
|
v-model:api="fapi"
|
||||||
:rule="rule"
|
:rule="rule"
|
||||||
|
:field="field"
|
||||||
:option="option"
|
:option="option"
|
||||||
@submit="onSubmit"
|
@submit="onSubmit"
|
||||||
></form-create>
|
></form-create>
|
||||||
@ -13,8 +14,6 @@ import {onMounted,ref,watch} from "vue";
|
|||||||
import formCreate from "@form-create/element-ui";
|
import formCreate from "@form-create/element-ui";
|
||||||
import { moduleById } from '@/api/application/module'
|
import { moduleById } from '@/api/application/module'
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const moduleInfo:any = ref({})
|
const moduleInfo:any = ref({})
|
||||||
const props:any = defineProps({
|
const props:any = defineProps({
|
||||||
moduleInfo: {
|
moduleInfo: {
|
||||||
@ -26,6 +25,10 @@ watch(() => props.moduleInfo, val => { // 初始化数据
|
|||||||
moduleInfo.value = val
|
moduleInfo.value = val
|
||||||
getInit()
|
getInit()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const field = ref([])
|
||||||
|
|
||||||
|
|
||||||
const option :any = ref({});
|
const option :any = ref({});
|
||||||
const rule :any = ref([]);
|
const rule :any = ref([]);
|
||||||
const fapi = ref(null);
|
const fapi = ref(null);
|
||||||
|
@ -3,31 +3,38 @@
|
|||||||
<div style="display: flex;justify-content: flex-end;padding: 10px;">
|
<div style="display: flex;justify-content: flex-end;padding: 10px;">
|
||||||
<el-button type="primary" @click="exportData">保存</el-button>
|
<el-button type="primary" @click="exportData">保存</el-button>
|
||||||
</div>
|
</div>
|
||||||
<!-- <el-button @click="exportData">显示</el-button> -->
|
<FcDesigner ref="designerRef" style="width: 100vw;height:calc(100vh - 60px) " :field="field"
|
||||||
<FcDesigner ref="designerRef" style="width: 100vw;height:calc(100vh - 60px) " />
|
:appId="appId" :config="config" :appUrl="basePath"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { onMounted, reactive, ref, toRefs, watch, nextTick } from 'vue';
|
import { onMounted, ref } from 'vue';
|
||||||
import { ElMessage,ElMessageBox } from 'element-plus-secondary'
|
import { ElMessage } from 'element-plus-secondary'
|
||||||
|
|
||||||
import formCreate from "@form-create/element-ui";
|
import formCreate from "@form-create/element-ui";
|
||||||
import { useRoute, useRouter } from 'vue-router'
|
import { useRoute } from 'vue-router'
|
||||||
import { moduleById,moduleUpdate } from '@/api/application/module'
|
import { moduleById,moduleUpdate } from '@/api/application/module'
|
||||||
const route = useRoute()
|
const basePath = import.meta.env.VITE_API_BASEPATH
|
||||||
|
|
||||||
|
const route = useRoute()
|
||||||
|
const designerForm = formCreate.factory();
|
||||||
|
const appId:any = ref(route.query.appId)
|
||||||
|
if(route.query.appId == null){
|
||||||
|
appId.value = '00'
|
||||||
|
}
|
||||||
const designerRef:any = ref();
|
const designerRef:any = ref();
|
||||||
|
const field:any = [{}]
|
||||||
|
const config:any = {
|
||||||
|
fieldReadonly: false,
|
||||||
|
showSaveBtn: true,
|
||||||
|
}
|
||||||
const exportData = () => {
|
const exportData = () => {
|
||||||
if (!designerRef.value) return;
|
if (!designerRef.value) return;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 获取规则和配置
|
// 获取规则和配置
|
||||||
const rules = JSON.stringify(designerRef.value.getRule()) ;
|
const rules = designerForm.toJson(designerRef.value.getRule()) ;
|
||||||
const options = JSON.stringify(designerRef.value.getOption());
|
const options = designerForm.toJson(designerRef.value.getOption());
|
||||||
|
|
||||||
|
|
||||||
let data = {
|
let data = {
|
||||||
id:route.query.moduleId,
|
id:route.query.moduleId,
|
||||||
canvasStyleData:rules,
|
canvasStyleData:rules,
|
||||||
@ -43,40 +50,39 @@ const exportData = () => {
|
|||||||
}).catch(() => {
|
}).catch(() => {
|
||||||
|
|
||||||
})
|
})
|
||||||
// console.log(rule,option)
|
|
||||||
|
|
||||||
// option.value = formCreate.parseJson(options)
|
|
||||||
// rule.value = formCreate.parseJson(rules)
|
|
||||||
// dialogVisible.value = true
|
|
||||||
|
|
||||||
};
|
};
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
console.log(route.query.moduleId)
|
// designerRef.value.setOption(formCreate.parseJson('{"form":{"inline":false,"hideRequiredAsterisk":false,"labelPosition":"right","size":"default","labelWidth":"125px"},"resetBtn":{"show":false,"innerText":"重置"},"submitBtn":{"show":true,"innerText":"提交"}}'));
|
||||||
|
// designerRef.value.setRule(formCreate.parseJson('[{"type":"fcInlineForm","_fc_id":"id_Fjdrm1vqsjnub0c","name":"ref_F1mkm1vqsjnub1c","_fc_drag_tag":"fcInlineForm","children":[{"type":"input","field":"Fwqlm1vqu2c1b2c","title":"关键字","$required":false,"_fc_id":"id_F6omm1vqu2c1b3c","name":"ref_F8l5m1vqu2c1b4c","_fc_drag_tag":"input","wrap":{"labelWidth":"5em"},"style":{"width":"180px"},"display":true,"hidden":false},{"type":"select","field":"Fkh7m1vqzakub7c","title":"商品分类","effect":{"fetch":""},"$required":false,"options":[{"label":"熊熊百货","value":"6"},{"label":"时尚优品","value":"3"}],"_fc_id":"id_Ffb3m1vqzakub8c","name":"ref_Floem1vqzakub9c","_fc_drag_tag":"select","wrap":{"labelWidth":"6em"},"style":{"width":"180px"},"display":true,"hidden":false},{"type":"elButton","children":["搜索"],"_fc_id":"id_Fgecm1vquanjb5c","name":"ref_Fdshm1vquanjb6c","_fc_drag_tag":"elButton","style":{"marginLeft":"15px"},"display":true,"hidden":false,"on":{"click":"$FNX:$inject.api.getRule(\'ref_Fd9xlxvrabk0jmc\').props.fetch.action = `https://mer.crmeb.net/api/product/spu/lst?keywrod=${$inject.api.form.Fwqlm1vqu2c1b2c || \'\'}&mer_id=${$inject.api.form.Fkh7m1vqzakub7c || \'\'}`;\\n\\n$inject.api.el(\'ref_Fd9xlxvrabk0jmc\').initPage();"}}],"style":{"display":"flex","flexDirection":"row","alignItems":"flex-start"},"display":true,"hidden":false},{"type":"dataTable","native":true,"props":{"height":"500px","button":{"open":true,"column":[{"key":1,"name":"详情","prop":["link"],"type":"primary","size":"small","click":"[[FORM-CREATE-PREFIX-function click(scope, api){api.open(\'ref_Fraim1unt0jhisc\', scope.row);}-FORM-CREATE-SUFFIX]]"},{"key":2,"name":"删除","prop":["link"],"type":"primary","handle":"[[FORM-CREATE-PREFIX-function render(props, scope){return scope.row.spu_id % 2 === 1;}-FORM-CREATE-SUFFIX]]","size":"small"}],"width":"100px"},"column":[{"format":"default","prop":"spu_id","label":"ID","width":"150"},{"format":"default","prop":"store_name","label":"商品名称","width":""},{"format":"default","prop":"stock","label":"库存","width":"100"},{"format":"tag","prop":"unit_name","label":"单位","width":"100"},{"format":"image","prop":"image","label":"主图","width":"200"}],"page":{"totalField":"count","dataField":"list","orderField":"order","orderByField":"orderBy","pageField":"page","pageSizeField":"limit","open":true,"props":{"pageSize":10,"small":true,"background":true}},"_optionType":2,"fetch":{"action":"https://mer.crmeb.net/api/product/spu/lst","method":"GET","headers":{},"data":{},"parse":"[[FORM-CREATE-PREFIX-function parse(res){return res.data;}-FORM-CREATE-SUFFIX]]","onError":"","to":"options"},"rowKey":"spu_id"},"_fc_id":"id_Fe33lxvrabk0jlc","name":"ref_Fd9xlxvrabk0jmc","_fc_drag_tag":"dataTable","display":true,"hidden":false},{"type":"fcDialog","props":{"title":"弹出框","rule":[{"type":"input","field":"store_name","title":"商品名称","$required":false,"_fc_id":"id_F22lm1unts3aiuc","name":"ref_Ft1nm1unts3aivc","_fc_drag_tag":"input","display":true,"hidden":false},{"type":"inputNumber","field":"stock","title":"库存","$required":false,"_fc_id":"id_Fmzhm1ununlrixc","name":"ref_Fhj5m1ununlriyc","_fc_drag_tag":"inputNumber","display":true,"hidden":false},{"type":"input","field":"unit_name","title":"单位","$required":false,"_fc_id":"id_Fzp1m1unv5trj0c","name":"ref_Fxc0m1unv5trj1c","_fc_drag_tag":"input","display":true,"hidden":false}]},"_fc_id":"id_Ft1em1unt0jhirc","name":"ref_Fraim1unt0jhisc","_fc_drag_tag":"fcDialog","native":true,"ignore":true,"field":"Fwxrmb0h4qovafc","display":true,"hidden":false}]'));
|
||||||
|
|
||||||
if(route.query.moduleId == null){
|
if(route.query.moduleId == null){
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
appId.value = route.query.moduleId
|
||||||
|
route.query.moduleId
|
||||||
moduleById(route.query.moduleId).then(res => {
|
moduleById(route.query.moduleId).then(res => {
|
||||||
if(res.code ==0){
|
if(res.code ==0){
|
||||||
|
|
||||||
if(res.data.data.canvas_style_data != null && res.data.data.canvas_style_data != ""){
|
if(res.data.data.canvas_style_data != null && res.data.data.canvas_style_data != ""){
|
||||||
|
|
||||||
|
|
||||||
designerRef.value.setOption(formCreate.parseJson(res.data.data.component_data))
|
designerRef.value.setOption(formCreate.parseJson(res.data.data.component_data))
|
||||||
designerRef.value.setRule( formCreate.parseJson(res.data.data.canvas_style_data))
|
designerRef.value.setRule( formCreate.parseJson(res.data.data.canvas_style_data))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
console.log(res.data.data)
|
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
</style>
|
</style>
|
||||||
<style>
|
<style>
|
||||||
|
|
||||||
._fc-m-tools-l{
|
/* ._fc-m-tools-l{
|
||||||
/* display: none; */
|
display: none;
|
||||||
}
|
}
|
||||||
._fc-m-tools-r{
|
._fc-m-tools-r{
|
||||||
/* display: none; */
|
display: none;
|
||||||
}
|
} */
|
||||||
</style>
|
</style>
|
||||||
|
Loading…
Reference in New Issue
Block a user