Merge branch 'dev' into pr@dev_memory_component

This commit is contained in:
dataeaseShu 2023-02-01 15:21:40 +08:00
commit 6787a19297
4 changed files with 19 additions and 21 deletions

View File

@ -152,11 +152,17 @@ public class DataSetTableFieldController {
@DePermission(type = DePermissionType.DATASET, value = "tableId", level = ResourceAuthLevel.DATASET_LEVEL_MANAGE)
@ApiOperation("保存")
@PostMapping("save")
public DatasetTableField save(@RequestBody DatasetTableField datasetTableField) {
public DatasetTableField save(@RequestBody DatasetTableField datasetTableField) throws Exception {
dataSetTableFieldsService.checkFieldName(datasetTableField);
// 非直连数据集需先完成数据同步
DatasetTable datasetTable = dataSetTableService.get(datasetTableField.getTableId());
if (datasetTable.getMode() == 1) {
if (!dataSetTableService.checkEngineTableIsExists(datasetTableField.getTableId())) {
throw new RuntimeException(Translator.get("i18n_data_not_sync"));
}
}
try {
// 执行一次sql确保数据集中所有字段均能正确执行
DatasetTable datasetTable = dataSetTableService.get(datasetTableField.getTableId());
DataSetTableRequest dataSetTableRequest = new DataSetTableRequest();
BeanUtils.copyProperties(datasetTable, dataSetTableRequest);
dataSetTableService.getPreviewData(dataSetTableRequest, 1, 1, Collections.singletonList(datasetTableField), null);

View File

@ -17,7 +17,7 @@ import java.util.List;
* Date: 2022/9/8
* Description:
*/
@Api(tags = "仪表板:应关系")
@Api(tags = "仪表板:应关系")
@ApiSupport(order = 170)
@RestController
@RequestMapping("appTemplate")

View File

@ -103,7 +103,7 @@ public class PanelAppTemplateService {
PanelAppTemplateWithBLOBs requestTemplate = new PanelAppTemplateWithBLOBs();
BeanUtils.copyBean(requestTemplate, request);
//Store static resource into the server
if (StringUtils.isNotEmpty(request.getSnapshot())) {
if (StringUtils.isNotEmpty(request.getSnapshot()) && request.getSnapshot().indexOf("static-resource") == -1) {
String snapshotName = "app-template-" + UUIDUtil.getUUIDAsString() + ".jpeg";
staticResourceService.saveSingleFileToServe(snapshotName, request.getSnapshot().replace("data:image/jpeg;base64,", ""));
requestTemplate.setSnapshot("/" + UPLOAD_URL_PREFIX + '/' + snapshotName);

View File

@ -1142,6 +1142,7 @@ export default {
this.$message.error(i18n.t('datasource.please_input_dataPath'))
return
}
this.originFieldItem.jsonFields = []
this.$refs.apiItemBasicInfo.validate((valid) => {
if (valid) {
const data = Base64.encode(JSON.stringify(this.apiItem))
@ -1157,9 +1158,7 @@ export default {
this.apiItem.jsonFields = res.data.jsonFields
this.apiItem.fields = []
this.handleFiledChange(this.apiItem)
this.$nextTick(() => {
this.$refs.plxTable?.reloadData(this.previewData(this.apiItem))
})
this.previewData(this.apiItem)
})
.catch((res) => {
this.loading = false
@ -1182,7 +1181,7 @@ export default {
res.data.jsonFields.forEach(((item) => {
item.checked = false
}))
this.originFieldItem.jsonFields = res.data.jsonFields
this.originFieldItem.jsonFields = res.data.jsonFields
this.loading = false
this.$success(i18n.t('commons.success'))
})
@ -1300,15 +1299,7 @@ export default {
this.handleCheckChange(this.apiItem, row)
this.apiItem.fields = []
this.handleFiledChange(this.apiItem, row)
if(ref === 'plxTable'){
this.$nextTick(() => {
this.$refs.plxTable?.reloadData(this.previewData(this.apiItem))
})
}else {
this.$nextTick(() => {
this.$refs.originPlxTable?.reloadData(this.previewData(this.apiItem))
})
}
this.previewData(this.apiItem)
if (this.errMsg.length) {
this.$message.error(
@ -1346,7 +1337,7 @@ export default {
apiItem.fields.push(jsonFields[i])
}
if (jsonFields[i].children !== undefined) {
this.handleFiledChange2(jsonFields[i].children)
this.handleFiledChange2(apiItem, jsonFields[i].children)
}
}
},
@ -1373,6 +1364,9 @@ export default {
apiItem.fields[i].value[j]
)
}
this.$nextTick(() => {
this.$refs.plxTable?.reloadData(data)
})
}
this.showEmpty = apiItem.fields.length === 0
return data
@ -1386,9 +1380,7 @@ export default {
}
},
fieldNameChange(row) {
this.$nextTick(() => {
this.$refs.plxTable?.reloadData(this.previewData(this.apiItem))
})
this.previewData(this.apiItem)
},
fieldTypeChange(row) {}
}