提交 b518aad0 编写于 作者: sq3536's avatar sq3536

配置完成

上级 df1c3172
...@@ -23,7 +23,7 @@ export default class AppFormJsonDaReport extends AppFormJson { ...@@ -23,7 +23,7 @@ export default class AppFormJsonDaReport extends AppFormJson {
let _schema = { let _schema = {
"title": "图表配置", "title": "图表配置",
"type": "array", "type": "array",
"format": "tabs", "format": "table",
"required": ["headerName"], "required": ["headerName"],
"items": { "items": {
"$ref": "#/definitions/columnDefs" "$ref": "#/definitions/columnDefs"
...@@ -41,11 +41,16 @@ export default class AppFormJsonDaReport extends AppFormJson { ...@@ -41,11 +41,16 @@ export default class AppFormJsonDaReport extends AppFormJson {
"type": "string", "type": "string",
"title": "指标自定义名称", "title": "指标自定义名称",
"default": "指标名称", "default": "指标名称",
options: {
grid_columns: 4,
input_width: 250
},
}, },
"entity": { "entity": {
"type": "string", "type": "string",
"title": "模型", "title": "模型",
options: { options: {
grid_columns: 4,
select2_options: { select2_options: {
width: 200, width: 200,
value: '' value: ''
...@@ -66,6 +71,7 @@ export default class AppFormJsonDaReport extends AppFormJson { ...@@ -66,6 +71,7 @@ export default class AppFormJsonDaReport extends AppFormJson {
} }
], ],
options: { options: {
grid_columns: 4,
select2_options: { select2_options: {
width: 350, width: 350,
value: '' value: ''
......
...@@ -34,6 +34,7 @@ export default class AppFormJsonDaChart extends AppFormJson { ...@@ -34,6 +34,7 @@ export default class AppFormJsonDaChart extends AppFormJson {
"id" : "arr_columnDefs", "id" : "arr_columnDefs",
"type": "object", "type": "object",
"title": "展现", "title": "展现",
"format": "grid",
"headerTemplate": "{{ self.headerName }}", "headerTemplate": "{{ self.headerName }}",
"required": ["headerName","entity","field"], "required": ["headerName","entity","field"],
"properties": { "properties": {
...@@ -41,18 +42,27 @@ export default class AppFormJsonDaChart extends AppFormJson { ...@@ -41,18 +42,27 @@ export default class AppFormJsonDaChart extends AppFormJson {
"type": "string", "type": "string",
"title": "列头", "title": "列头",
"default": "列名称", "default": "列名称",
options: {
grid_columns: 3,
input_width: 250
},
}, },
"width": { "width": {
"type": "integer", "type": "integer",
"title": "宽度", "title": "宽度",
"default": "50", "default": "50",
options: {
grid_columns: 3,
input_width: 50
},
}, },
"entity": { "entity": {
"type": "string", "type": "string",
"title": "模型", "title": "模型",
options: { options: {
grid_columns: 3,
select2_options: { select2_options: {
width: 200, width: 250,
value: '' value: ''
} }
}, },
...@@ -71,8 +81,9 @@ export default class AppFormJsonDaChart extends AppFormJson { ...@@ -71,8 +81,9 @@ export default class AppFormJsonDaChart extends AppFormJson {
} }
], ],
options: { options: {
grid_columns: 3,
select2_options: { select2_options: {
width: 350, width: 250,
value: '' value: ''
} }
}, },
......
<template>
<div class="app-form-json">
<div :id="id" :innerHTML="id"></div>
</div>
</template>
<script lang='tsx'>
import { Component, Vue, Prop, Model, Watch } from "vue-property-decorator";
import { VNode, CreateElement } from "vue";
import { interval, Subject, Subscription } from "rxjs";
import { Http, Util } from "@/utils";
import JSONEditor from "@json-editor/json-editor";
import BootstrapVue from "bootstrap-vue";
import "bootstrap/dist/css/bootstrap.css";
import "bootstrap-vue/dist/bootstrap-vue.css";
import CodeListService from "@/codelist/codelist-service";
import AppFormJson from "./app-form-json.vue";
@Component({
components: {},
})
export default class AppFormJsonDim extends AppFormJson {
public codeListService: CodeListService = new CodeListService({
$store: this.$store,
});
public async getSchema(): Promise<any> {
let _schema = {
title: "维度",
type: "array",
format: "table",
required: ["field", "dict", "recursive"],
default: [
{
field: "",
dict: "",
recursive: 0,
},
],
items: {
id: "arr_dim",
title: "维度",
type: "object",
format: "grid",
properties: {
id: {
grid_columns: 6,
type: "string",
title: "标识",
template: "{{field}}",
watch: {
field: "arr_dim.field",
},
options: {
hidden: true,
input_width: 200,
},
propertyOrder: 8,
},
buildid: {
grid_columns: 6,
type: "string",
title: "Build",
options: {
hidden: true,
},
enumSource: [
{
source: [{ id: this.data.buildid, text: this.data.buildname }],
title: "{{item.text}}",
value: "{{item.id}}",
},
],
propertyOrder: 9,
},
modelid: {
grid_columns: 6,
type: "string",
title: "模型",
options: {
hidden: true,
},
enumSource: [
{
source: [{ id: this.data.modelid, text: this.data.modelname }],
title: "{{item.text}}",
value: "{{item.id}}",
},
],
propertyOrder: 3,
},
name: {
type: "selectnew",
title: "实体",
watch: {
modelid: "arr_dim.modelid",
},
enumSource: [
{
source: [...[{ label: "--", id: "" }]],
p0: "modelid",
url: "/dst/datamodels/${p0}/propertys",
title: "{{item.label}}",
value: "{{item.id}}",
},
],
options: {
select2_options: {
width: 350,
value: "",
},
},
propertyOrder: 4,
},
field: {
type: "selectnew",
title: "维度属性",
watch: {
modelid: "arr_dim.modelid",
entity: "arr_dim.name",
},
enumSource: [
{
source: [...[{ label: "--", id: "" }]],
p0: "modelid",
p1: "entity",
url: "/dst/datamodels/${p0}/propertys/${p1}/fields",
title: "{{item.label}}",
value: "{{item.id}}",
},
],
links: [
{
rel: "查看",
href: "/dstweb/app/codelist/dst/fielddict/{{self}}",
},
],
options: {
select2_options: {
width: 250,
value: "",
},
},
propertyOrder: 5,
},
dict: {
title: "数据字典",
type: "string",
options: {
grid_columns: 4,
},
propertyOrder: 6,
},
recursive: {
title: "逐层核算",
type: "number",
enumSource: [
{
source: [
{ id: 1, label: "是" },
{ id: 0, label: "否" },
],
title: "{{item.label}}",
value: "{{item.id}}",
},
],
options: {
grid_columns: 4,
},
propertyOrder: 7,
},
},
},
};
return _schema;
}
/**
* 编辑器生成
*
* @memberof AppFormJson
*/
public async renderJsoneditor() {
var _this = this;
var element = document.getElementById(_this.id);
if (this.editor) {
this.editor.destroy();
}
let opt: any = await _this.getOptions();
this.editor = new JSONEditor(element, opt);
this.editor.on("change", () => {
let value = _this.editor.getValue();
_this.CurrentVal = value;
});
}
public async getOptions(): Promise<any> {
let _options = {
theme: "bootstrap3",
iconlib: "fontawesome4",
disable_edit_json: true,
display_required_only: true,
disable_collapse: true,
disable_array_delete_last_row: true,
ajax: true,
};
_options["schema"] = await this.getSchema();
if (this.CurrentVal) {
_options["startval"] = this.CurrentVal;
}
if (this.options) {
return Object.assign({}, _options, this.options);
}
return _options;
}
}
</script>
\ No newline at end of file
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<div class="app-form-json"> <div class="app-form-json">
<div :id='id' :innerHTML="id"></div> <div :id='id' :innerHTML="id"></div>
<el-input type="hidden" :rows="2" placeholder="请输入内容" v-model="CurrentVal"> <el-input type="textarea" :rows="10" placeholder="请输入内容" v-model="CurrentVal">
</el-input> </el-input>
</div> </div>
</template> </template>
...@@ -497,7 +497,19 @@ export default class AppFormJson extends Vue { ...@@ -497,7 +497,19 @@ export default class AppFormJson extends Vue {
if (Object.is($event.type, "load")) { if (Object.is($event.type, "load")) {
this.renderJsoneditor(); this.renderJsoneditor();
} }
if (Object.is($event.type, 'save')) {
this.renderJsoneditor();
}
// 表单项更新
if (Object.is($event.type, 'updateformitem')) {
if (!$event.data) {
return;
}
this.renderJsoneditor();
}
}); });
window["showdetail"]=this.showdetail; window["showdetail"]=this.showdetail;
} }
......
...@@ -40,7 +40,6 @@ export default class AppTreeselectRefreshview extends Vue { ...@@ -40,7 +40,6 @@ export default class AppTreeselectRefreshview extends Vue {
public props: any = { public props: any = {
value: "id", // ID字段名 value: "id", // ID字段名
label: "label", // 显示名称 label: "label", // 显示名称
children: "apps", // 子级字段名
}; };
/** /**
...@@ -117,14 +116,18 @@ export default class AppTreeselectRefreshview extends Vue { ...@@ -117,14 +116,18 @@ export default class AppTreeselectRefreshview extends Vue {
let tempData: any = []; let tempData: any = [];
data.forEach((item: any) => { data.forEach((item: any) => {
let tempItem: any = item; let tempItem: any = item;
if (tempItem.apps && tempItem.apps.length>0) {
tempItem.id = tempItem.apps[0].id;
tempItem.appname=tempItem.apps[0].label;
if (tempItem.pssystemid) { if (tempItem.pssystemid) {
tempItem.id = tempItem.pssystemid;
tempItem.systemId = tempItem.pssystemid; tempItem.systemId = tempItem.pssystemid;
} }
if (tempItem.pssystemname) { if (tempItem.pssystemname) {
tempItem.label = tempItem.pssystemname; tempItem.label = tempItem.pssystemname;
} }
tempData.push(tempItem); tempData.push(tempItem);
}
}); });
// 给树赋值 // 给树赋值
...@@ -132,12 +135,7 @@ export default class AppTreeselectRefreshview extends Vue { ...@@ -132,12 +135,7 @@ export default class AppTreeselectRefreshview extends Vue {
// 下拉树 // 下拉树
let tree: any = this.$refs.selectTree; let tree: any = this.$refs.selectTree;
// 第一个叶子节点 // 第一个叶子节点
let firstNode: any = {}; let firstNode: any = tempData[0];
if (tempData[0].apps) {
firstNode = tempData[0].apps;
} else {
firstNode = tempData[0];
}
// 从local中拿刷新前选中值 // 从local中拿刷新前选中值
if (localStorage.getItem("localdata")) { if (localStorage.getItem("localdata")) {
...@@ -145,16 +143,20 @@ export default class AppTreeselectRefreshview extends Vue { ...@@ -145,16 +143,20 @@ export default class AppTreeselectRefreshview extends Vue {
localStorage.getItem("localdata") as string localStorage.getItem("localdata") as string
); );
this.valueId = localdata.dstappid; this.valueId = localdata.dstappid;
this.valueTitle = localdata.title;
this.defaultExpandedKey.push(localdata.dstappid); this.defaultExpandedKey.push(localdata.dstappid);
tempData.forEach((item: any) => {
if(item.id===this.valueId)
this.valueTitle = item.label;
});
// 设置下拉树选中值 // 设置下拉树选中值
tree.setCurrentKey(localdata.dstappid); tree.setCurrentKey(localdata.dstappid);
} else { } else {
// 设置下拉框默认值 // 设置下拉框默认值
this.valueId = firstNode[0].id; this.valueId = firstNode[0].id;
this.valueTitle =
firstNode[0].systemId + "-" + firstNode[0].label;
this.defaultExpandedKey.push(firstNode[0].id); this.defaultExpandedKey.push(firstNode[0].id);
this.valueTitle = firstNode[0].label;
// 设置下拉树选中值 // 设置下拉树选中值
tree.setCurrentKey(firstNode[0].id); tree.setCurrentKey(firstNode[0].id);
} }
...@@ -188,10 +190,7 @@ export default class AppTreeselectRefreshview extends Vue { ...@@ -188,10 +190,7 @@ export default class AppTreeselectRefreshview extends Vue {
* @memberof AppTreeselectRefreshview * @memberof AppTreeselectRefreshview
*/ */
public handleNodeClick(node: any) { public handleNodeClick(node: any) {
// 父级节点不进行处理
if (node.apps) {
return;
}
// 从local中拿刷新前选中值 // 从local中拿刷新前选中值
if (localStorage.getItem("localdata")) { if (localStorage.getItem("localdata")) {
const localdata: any = JSON.parse( const localdata: any = JSON.parse(
...@@ -204,12 +203,12 @@ export default class AppTreeselectRefreshview extends Vue { ...@@ -204,12 +203,12 @@ export default class AppTreeselectRefreshview extends Vue {
// 重新赋值 // 重新赋值
this.valueId = node[this.props.value]; this.valueId = node[this.props.value];
const dstsystemid: any = node.systemId; const dstsystemid: any = node.systemId;
this.valueTitle = dstsystemid + "-" + node[this.props.label]; this.valueTitle = node[this.props.label];
// 添加本地应用数据 // 添加本地应用数据
const localdata: any = { const localdata: any = {
dstsystemid: dstsystemid, dstsystemid: dstsystemid,
dstappid: this.valueId, dstappid: this.valueId,
title: this.valueTitle, title: dstsystemid + "-" + node.appname,
}; };
this.$store.commit("addLocalData", localdata); this.$store.commit("addLocalData", localdata);
// 调用App.vue的加载行为 // 调用App.vue的加载行为
......
...@@ -5,6 +5,7 @@ import AppFormJsonDaChart from './components/app-form-json/app-form-json-da-cha ...@@ -5,6 +5,7 @@ import AppFormJsonDaChart from './components/app-form-json/app-form-json-da-cha
import AppFormJsonDaReport from './components/app-form-json/app-form-json-da-report.vue' import AppFormJsonDaReport from './components/app-form-json/app-form-json-da-report.vue'
import AppFormJsonLogic from './components/app-form-json/app-form-json-logic.vue' import AppFormJsonLogic from './components/app-form-json/app-form-json-logic.vue'
import AppFormJsonFieldSet from './components/app-form-json/app-form-json-field-set.vue' import AppFormJsonFieldSet from './components/app-form-json/app-form-json-field-set.vue'
import AppFormJsonDim from './components/app-form-json/app-form-json-dim.vue'
import AppTreeselectRefreshview from './components/app-treeselect-refreshview/app-treeselect-refreshview.vue' import AppTreeselectRefreshview from './components/app-treeselect-refreshview/app-treeselect-refreshview.vue'
import 'jquery/dist/jquery.min.js' import 'jquery/dist/jquery.min.js'
import $ from 'jquery' import $ from 'jquery'
...@@ -20,5 +21,6 @@ export const UserComponent = { ...@@ -20,5 +21,6 @@ export const UserComponent = {
v.component('app-form-json-da-report', AppFormJsonDaReport); v.component('app-form-json-da-report', AppFormJsonDaReport);
v.component('app-form-json-logic', AppFormJsonLogic); v.component('app-form-json-logic', AppFormJsonLogic);
v.component('app-form-json-field-set', AppFormJsonFieldSet); v.component('app-form-json-field-set', AppFormJsonFieldSet);
v.component('app-form-json-dim', AppFormJsonDim);
} }
}; };
\ No newline at end of file
...@@ -2,11 +2,15 @@ package cn.ibizlab.api.rest.extensions; ...@@ -2,11 +2,15 @@ package cn.ibizlab.api.rest.extensions;
import cn.ibizlab.core.dict.extensions.vo.Option; import cn.ibizlab.core.dict.extensions.vo.Option;
import cn.ibizlab.core.lite.domain.DstSystem; import cn.ibizlab.core.lite.domain.DstSystem;
import cn.ibizlab.core.lite.domain.MetaField;
import cn.ibizlab.core.lite.extensions.domain.*; import cn.ibizlab.core.lite.extensions.domain.*;
import cn.ibizlab.core.lite.extensions.model.DataModel; import cn.ibizlab.core.lite.extensions.model.DataModel;
import cn.ibizlab.core.lite.extensions.model.Property; import cn.ibizlab.core.lite.extensions.model.Property;
import cn.ibizlab.core.lite.extensions.service.DbEntityService; import cn.ibizlab.core.lite.extensions.service.DbEntityService;
import cn.ibizlab.core.lite.extensions.service.LiteModelService; import cn.ibizlab.core.lite.extensions.service.LiteModelService;
import cn.ibizlab.util.client.IBZDictFeignClient;
import cn.ibizlab.util.dict.CodeItem;
import cn.ibizlab.util.dict.CodeList;
import cn.ibizlab.util.errors.BadRequestAlertException; import cn.ibizlab.util.errors.BadRequestAlertException;
import cn.ibizlab.util.helper.DataObject; import cn.ibizlab.util.helper.DataObject;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
...@@ -90,6 +94,36 @@ public class DstCoreResource { ...@@ -90,6 +94,36 @@ public class DstCoreResource {
return ResponseEntity.ok(list); return ResponseEntity.ok(list);
} }
@Autowired
private IBZDictFeignClient dictFeignClient;
@RequestMapping(method = RequestMethod.GET, value = {"/dst/datamodels/{modelid}/{propertyname}.{fieldname}/dict"})
public ResponseEntity<List<CodeItem>> getDataModelFieldDict(@PathVariable(name="modelid",required = false) String modelid,
@PathVariable(name="propertyname",required = false) String propertyname,
@PathVariable(name="fieldname",required = false) String fieldname)
{
List<CodeItem> list = new ArrayList<>();
Property property=liteModelService.getDataModel(modelid).findObjectProperty(propertyname,"ALL");
if(property!=null)
{
MetaField field=property.getEntityModel().getField(fieldname).getField();
if(field!=null)
{
String dict = field.getDict();
if(!StringUtils.isEmpty(dict))
{
CodeList codeList=dictFeignClient.getCodeList(dict);
if(codeList!=null)
list=codeList.getOptions();
}
}
}
return ResponseEntity.ok(list);
}
@RequestMapping(method = RequestMethod.GET, value = "/dst/{system}/entitys") @RequestMapping(method = RequestMethod.GET, value = "/dst/{system}/entitys")
public ResponseEntity<List<EntityModel>> getEntityModel(@PathVariable("system") String system) { public ResponseEntity<List<EntityModel>> getEntityModel(@PathVariable("system") String system) {
return ResponseEntity.status(HttpStatus.OK).body(liteModelService.getEntityModel(system)); return ResponseEntity.status(HttpStatus.OK).body(liteModelService.getEntityModel(system));
......
package cn.ibizlab.util.client; package cn.ibizlab.util.client;
import cn.ibizlab.util.dict.CodeItem;
import cn.ibizlab.util.dict.CodeList;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.PathVariable;
import java.util.List;
@Component @Component
public class IBZDictFallback implements IBZDictFeignClient { public class IBZDictFallback implements IBZDictFeignClient {
...@@ -10,4 +15,9 @@ public class IBZDictFallback implements IBZDictFeignClient { ...@@ -10,4 +15,9 @@ public class IBZDictFallback implements IBZDictFeignClient {
public Boolean syncRuntimeDict(JSONArray catalogs) { public Boolean syncRuntimeDict(JSONArray catalogs) {
return null; return null;
} }
@Override
public CodeList getCodeList(@PathVariable("code") String code) {
return null;
}
} }
package cn.ibizlab.util.client; package cn.ibizlab.util.client;
import cn.ibizlab.util.dict.CodeItem;
import cn.ibizlab.util.dict.CodeList;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import org.springframework.cloud.openfeign.FeignClient; import org.springframework.cloud.openfeign.FeignClient;
...@@ -16,4 +18,9 @@ public interface IBZDictFeignClient ...@@ -16,4 +18,9 @@ public interface IBZDictFeignClient
{ {
@RequestMapping(method = RequestMethod.POST, value = "/dictionarys/catalogs/sync") @RequestMapping(method = RequestMethod.POST, value = "/dictionarys/catalogs/sync")
Boolean syncRuntimeDict(@RequestBody JSONArray catalogs); Boolean syncRuntimeDict(@RequestBody JSONArray catalogs);
@RequestMapping(method = RequestMethod.GET, value = "/dictionarys/codelist/{code}")
CodeList getCodeList(@PathVariable("code") String code);
} }
package cn.ibizlab.util.dict;
import cn.ibizlab.util.annotation.DEField;
import com.alibaba.fastjson.annotation.JSONField;
import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.experimental.Accessors;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
@Accessors(chain = true)
public class Catalog
{
private String code;
private String name;
@JSONField(name = "items")
@JsonProperty("items")
private List<Option> options = new ArrayList<>();
}
package cn.ibizlab.util.dict;
import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.experimental.Accessors;
import java.util.List;
import java.util.Map;
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
@Accessors(chain = true)
public class CodeItem
{
private String id;
private Object value;
private String label;
@JsonIgnore
@JSONField(serialize = false)
private List<CodeItem> children;
private String iconClass;
private String filter;
private Boolean disabled;
@JSONField(name = "pvalue")
@JsonProperty("pvalue")
private String parent;
private Map<String,Object> extension;
@JSONField(name = "text")
@JsonProperty("text")
public String getText()
{
return label;
}
}
package cn.ibizlab.util.dict;
import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.experimental.Accessors;
import java.util.ArrayList;
import java.util.List;
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
@Accessors(chain = true)
public class CodeList
{
@JSONField(name = "srfkey")
@JsonProperty("srfkey")
private String code;
private String name;
@JSONField(name = "emptytext")
@JsonProperty("emptytext")
public String getEmptytext()
{
return "";
}
@JSONField(name = "items")
@JsonProperty("items")
private List<CodeItem> options = new ArrayList<>();
}
package cn.ibizlab.util.dict;
import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.experimental.Accessors;
import java.util.List;
import java.util.Map;
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
@Accessors(chain = true)
public class Option
{
private String id;
private Object value;
private String label;
private List<Option> children;
private String iconClass;
private String filter;
private Boolean disabled;
@JsonIgnore
@JSONField(serialize = false)
private String parent;
private Map<String,Object> extension;
}
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册