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

配置完成

上级 df1c3172
......@@ -23,7 +23,7 @@ export default class AppFormJsonDaReport extends AppFormJson {
let _schema = {
"title": "图表配置",
"type": "array",
"format": "tabs",
"format": "table",
"required": ["headerName"],
"items": {
"$ref": "#/definitions/columnDefs"
......@@ -41,11 +41,16 @@ export default class AppFormJsonDaReport extends AppFormJson {
"type": "string",
"title": "指标自定义名称",
"default": "指标名称",
options: {
grid_columns: 4,
input_width: 250
},
},
"entity": {
"type": "string",
"title": "模型",
options: {
grid_columns: 4,
select2_options: {
width: 200,
value: ''
......@@ -66,6 +71,7 @@ export default class AppFormJsonDaReport extends AppFormJson {
}
],
options: {
grid_columns: 4,
select2_options: {
width: 350,
value: ''
......
......@@ -34,6 +34,7 @@ export default class AppFormJsonDaChart extends AppFormJson {
"id" : "arr_columnDefs",
"type": "object",
"title": "展现",
"format": "grid",
"headerTemplate": "{{ self.headerName }}",
"required": ["headerName","entity","field"],
"properties": {
......@@ -41,18 +42,27 @@ export default class AppFormJsonDaChart extends AppFormJson {
"type": "string",
"title": "列头",
"default": "列名称",
options: {
grid_columns: 3,
input_width: 250
},
},
"width": {
"type": "integer",
"title": "宽度",
"default": "50",
options: {
grid_columns: 3,
input_width: 50
},
},
"entity": {
"type": "string",
"title": "模型",
options: {
grid_columns: 3,
select2_options: {
width: 200,
width: 250,
value: ''
}
},
......@@ -71,8 +81,9 @@ export default class AppFormJsonDaChart extends AppFormJson {
}
],
options: {
grid_columns: 3,
select2_options: {
width: 350,
width: 250,
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 @@
<div class="app-form-json">
<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>
</div>
</template>
......@@ -496,8 +496,20 @@ export default class AppFormJson extends Vue {
this.formStateEvent = this.formState.subscribe(($event: any) => {
if (Object.is($event.type, "load")) {
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;
}
......
......@@ -40,7 +40,6 @@ export default class AppTreeselectRefreshview extends Vue {
public props: any = {
value: "id", // ID字段名
label: "label", // 显示名称
children: "apps", // 子级字段名
};
/**
......@@ -117,14 +116,18 @@ export default class AppTreeselectRefreshview extends Vue {
let tempData: any = [];
data.forEach((item: any) => {
let tempItem: any = item;
if (tempItem.pssystemid) {
tempItem.id = tempItem.pssystemid;
tempItem.systemId = tempItem.pssystemid;
if (tempItem.apps && tempItem.apps.length>0) {
tempItem.id = tempItem.apps[0].id;
tempItem.appname=tempItem.apps[0].label;
if (tempItem.pssystemid) {
tempItem.systemId = tempItem.pssystemid;
}
if (tempItem.pssystemname) {
tempItem.label = tempItem.pssystemname;
}
tempData.push(tempItem);
}
if (tempItem.pssystemname) {
tempItem.label = tempItem.pssystemname;
}
tempData.push(tempItem);
});
// 给树赋值
......@@ -132,12 +135,7 @@ export default class AppTreeselectRefreshview extends Vue {
// 下拉树
let tree: any = this.$refs.selectTree;
// 第一个叶子节点
let firstNode: any = {};
if (tempData[0].apps) {
firstNode = tempData[0].apps;
} else {
firstNode = tempData[0];
}
let firstNode: any = tempData[0];
// 从local中拿刷新前选中值
if (localStorage.getItem("localdata")) {
......@@ -145,16 +143,20 @@ export default class AppTreeselectRefreshview extends Vue {
localStorage.getItem("localdata") as string
);
this.valueId = localdata.dstappid;
this.valueTitle = localdata.title;
this.defaultExpandedKey.push(localdata.dstappid);
tempData.forEach((item: any) => {
if(item.id===this.valueId)
this.valueTitle = item.label;
});
// 设置下拉树选中值
tree.setCurrentKey(localdata.dstappid);
} else {
// 设置下拉框默认值
this.valueId = firstNode[0].id;
this.valueTitle =
firstNode[0].systemId + "-" + firstNode[0].label;
this.defaultExpandedKey.push(firstNode[0].id);
this.valueTitle = firstNode[0].label;
// 设置下拉树选中值
tree.setCurrentKey(firstNode[0].id);
}
......@@ -188,10 +190,7 @@ export default class AppTreeselectRefreshview extends Vue {
* @memberof AppTreeselectRefreshview
*/
public handleNodeClick(node: any) {
// 父级节点不进行处理
if (node.apps) {
return;
}
// 从local中拿刷新前选中值
if (localStorage.getItem("localdata")) {
const localdata: any = JSON.parse(
......@@ -204,12 +203,12 @@ export default class AppTreeselectRefreshview extends Vue {
// 重新赋值
this.valueId = node[this.props.value];
const dstsystemid: any = node.systemId;
this.valueTitle = dstsystemid + "-" + node[this.props.label];
this.valueTitle = node[this.props.label];
// 添加本地应用数据
const localdata: any = {
dstsystemid: dstsystemid,
dstappid: this.valueId,
title: this.valueTitle,
title: dstsystemid + "-" + node.appname,
};
this.$store.commit("addLocalData", localdata);
// 调用App.vue的加载行为
......
......@@ -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 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 AppFormJsonDim from './components/app-form-json/app-form-json-dim.vue'
import AppTreeselectRefreshview from './components/app-treeselect-refreshview/app-treeselect-refreshview.vue'
import 'jquery/dist/jquery.min.js'
import $ from 'jquery'
......@@ -20,5 +21,6 @@ export const UserComponent = {
v.component('app-form-json-da-report', AppFormJsonDaReport);
v.component('app-form-json-logic', AppFormJsonLogic);
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;
import cn.ibizlab.core.dict.extensions.vo.Option;
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.model.DataModel;
import cn.ibizlab.core.lite.extensions.model.Property;
import cn.ibizlab.core.lite.extensions.service.DbEntityService;
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.helper.DataObject;
import com.alibaba.fastjson.JSON;
......@@ -90,6 +94,36 @@ public class DstCoreResource {
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")
public ResponseEntity<List<EntityModel>> getEntityModel(@PathVariable("system") String system) {
return ResponseEntity.status(HttpStatus.OK).body(liteModelService.getEntityModel(system));
......
package cn.ibizlab.util.client;
import cn.ibizlab.util.dict.CodeItem;
import cn.ibizlab.util.dict.CodeList;
import com.alibaba.fastjson.JSONArray;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.PathVariable;
import java.util.List;
@Component
public class IBZDictFallback implements IBZDictFeignClient {
......@@ -10,4 +15,9 @@ public class IBZDictFallback implements IBZDictFeignClient {
public Boolean syncRuntimeDict(JSONArray catalogs) {
return null;
}
@Override
public CodeList getCodeList(@PathVariable("code") String code) {
return null;
}
}
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.JSONObject;
import org.springframework.cloud.openfeign.FeignClient;
......@@ -16,4 +18,9 @@ public interface IBZDictFeignClient
{
@RequestMapping(method = RequestMethod.POST, value = "/dictionarys/catalogs/sync")
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 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册