提交 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,135 +2,380 @@
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 { 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';
import AppFormJson from "./app-form-json.vue";
@Component({
components: {
}
components: {},
})
export default class AppFormJsonFieldSet extends AppFormJson {
public codeListService:CodeListService = new CodeListService({ $store: this.$store });
public codeListService: CodeListService = new CodeListService({
$store: this.$store,
});
public async getSchema(): Promise<any>{
let _schema = {
"title": "表头配置",
"type": "array",
"format": "tabs",
"required": ["headerName"],
"items": {
"$ref": "#/definitions/columnDefs"
},
"default":{headerName:"列名称"},
"definitions": {
"columnDefs": {
"id" : "arr_columnDefs",
"type": "object",
"title": "展现",
"headerTemplate": "{{ self.headerName }}",
"required": ["headerName","entity","field"],
"properties": {
"headerName": {
"type": "string",
"title": "列头",
"default": "列名称",
},
"width": {
"type": "integer",
"title": "宽度",
"default": "50",
},
"entity": {
"type": "string",
"title": "模型",
options: {
select2_options: {
width: 200,
value: ''
}
},
enumSource: []
},
"field":{
"type": "selectnew",
"title": "属性",
"watch": {
"entity12": "arr_columnDefs.entity" ,
},
"links": [
{
"rel": "查看",
"href": "javascript:window.showdetail('dametric-edit-view',{'dametric':'{{self}}'})"
}
],
options: {
select2_options: {
width: 350,
value: ''
}
},
"enumSource":[{"source":[...[{metric_name:"--",metric_id:""}]],
"p0":"entity12" ,"url":'/dabuilds/${p0}/dametrics/fetchdefault',
"title": "{{item.metric_name}}", "value": "{{item.metric_id}}"}]
},
"children": {
"type": "array",
"format": "tabs",
"required": ["headerName","entity","field"],
"title": "下级",
"items": {
"$ref": "#/definitions/columnDefs"
},
"default":{headerName:"列名称"}
}
}
}
}
};
public async getSchema(): Promise<any> {
let _schema = {
title: "指标",
type: "object",
format: "grid",
id: "arr_columnDefs",
$ref: "#/definitions/fieldDefs",
definitions: {
fieldDefs: {
type: "object",
title: "指标",
required: [
"metricentity",
"metricfield",
"timeentity",
"timefield",
"domainsentity",
"domainsfield",
"modelid",
],
properties: {
modelid: {
type: "string",
title: "模型",
options: {
grid_columns: 12,
hidden: true,
select2_options: {
width: 350,
},
},
enumSource: [
{
source: [
{ id: this.data.modelid, text: this.data.modelname },
],
title: "{{item.text}}",
value: "{{item.id}}",
},
],
propertyOrder: 21,
},
metricentity: {
type: "selectnew",
title: "指标实体",
watch: {
modelid: "arr_columnDefs.modelid",
},
enumSource: [
{
source: [...[{ label: "--", id: "" }]],
p0: "modelid",
url: "/dst/datamodels/${p0}/propertys",
title: "{{item.label}}",
value: "{{item.id}}",
},
],
options: {
grid_columns: 6,
select2_options: {
//width: 350,
value: "",
},
},
propertyOrder: 4,
},
metricfield: {
type: "selectnew",
title: "指标属性",
watch: {
modelid: "arr_columnDefs.modelid",
entity: "arr_columnDefs.metricentity",
},
enumSource: [
{
source: [...[{ label: "--", id: "" }]],
p0: "modelid",
p1: "entity",
url: "/dst/datamodels/${p0}/propertys/${p1}/fields",
title: "{{item.label}}",
value: "{{item.id}}",
},
],
let _eset: Array<any> = [];
try{
let cond={};
const localdata = window.localStorage.getItem('localdata');
if(localdata) cond={"n_systemid_eq":localdata["dstsystemid"]};
const res = await this.codeListService.getItems("CLModel",{},cond);
_eset.push(...res);
}catch(er){}
if (_eset) {
let _items = [...[{text:"--",id:""}],..._eset];
let sourceobj={"source":_items,"title": "{{item.text}}", "value": "{{item.id}}"};
_schema.definitions.columnDefs.properties.entity.enumSource=[sourceobj];
}
options: {
grid_columns: 6,
select2_options: {
//width: 250,
value: "",
},
},
propertyOrder: 5,
},
timeentity: {
type: "selectnew",
title: "时间实体",
watch: {
modelid: "arr_columnDefs.modelid",
},
enumSource: [
{
source: [...[{ label: "--", id: "" }]],
p0: "modelid",
url: "/dst/datamodels/${p0}/propertys",
title: "{{item.label}}",
value: "{{item.id}}",
},
],
options: {
grid_columns: 6,
select2_options: {
//width: 350,
value: "",
},
},
propertyOrder: 6,
},
timefield: {
type: "selectnew",
title: "时间属性",
watch: {
modelid: "arr_columnDefs.modelid",
entity: "arr_columnDefs.timeentity",
},
enumSource: [
{
source: [...[{ label: "--", id: "" }]],
p0: "modelid",
p1: "entity",
url: "/dst/datamodels/${p0}/propertys/${p1}/fields",
title: "{{item.label}}",
value: "{{item.id}}",
},
],
options: {
grid_columns: 6,
select2_options: {
//width: 250,
value: "",
},
},
propertyOrder: 7,
},
domainsentity: {
type: "selectnew",
title: "分区实体",
watch: {
modelid: "arr_columnDefs.modelid",
},
enumSource: [
{
source: [...[{ label: "--", id: "" }]],
p0: "modelid",
url: "/dst/datamodels/${p0}/propertys",
title: "{{item.label}}",
value: "{{item.id}}",
},
],
options: {
grid_columns: 6,
select2_options: {
//width: 350,
value: "",
},
},
propertyOrder: 8,
},
domainsfield: {
type: "selectnew",
title: "分区属性",
watch: {
modelid: "arr_columnDefs.modelid",
entity: "arr_columnDefs.domainsentity",
},
enumSource: [
{
source: [...[{ label: "--", id: "" }]],
p0: "modelid",
p1: "entity",
url: "/dst/datamodels/${p0}/propertys/${p1}/fields",
title: "{{item.label}}",
value: "{{item.id}}",
},
],
options: {
grid_columns: 6,
select2_options: {
//width: 250,
value: "",
},
},
propertyOrder: 9,
},
// let _fset: Array<any> = [];
keyvalueentity: {
type: "selectnew",
title: "标示实体",
watch: {
modelid: "arr_columnDefs.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: 10,
},
keyvaluefield: {
type: "selectnew",
title: "标示属性",
watch: {
modelid: "arr_columnDefs.modelid",
entity: "arr_columnDefs.keyvalueentity",
},
enumSource: [
{
source: [...[{ label: "--", id: "" }]],
p0: "modelid",
p1: "entity",
url: "/dst/datamodels/${p0}/propertys/${p1}/fields",
title: "{{item.label}}",
value: "{{item.id}}",
},
],
// try{
// const res = await this.codeListService.getItems("CLMetric");
// _fset.push(...res);
// }catch(er){
options: {
grid_columns: 6,
select2_options: {
// width: 250,
value: "",
},
},
propertyOrder: 11,
},
// }
ext1entity: {
type: "selectnew",
title: "附加实体1",
watch: {
modelid: "arr_columnDefs.modelid",
},
enumSource: [
{
source: [...[{ label: "--", id: "" }]],
p0: "modelid",
url: "/dst/datamodels/${p0}/propertys",
title: "{{item.label}}",
value: "{{item.id}}",
},
],
options: {
grid_columns: 6,
select2_options: {
// width: 350,
value: "",
},
},
propertyOrder: 12,
},
ext1field: {
type: "selectnew",
title: "附加属性1",
watch: {
modelid: "arr_columnDefs.modelid",
entity: "arr_columnDefs.ext1entity",
},
enumSource: [
{
source: [...[{ label: "--", id: "" }]],
p0: "modelid",
p1: "entity",
url: "/dst/datamodels/${p0}/propertys/${p1}/fields",
title: "{{item.label}}",
value: "{{item.id}}",
},
],
// if (_fset) {
// let _items = [...[{text:"--",id:""}],..._fset];
// let sourceobj={"source":_items,"filterText":"entity12","title": "{{item.text}}", "value": "{{item.id}}"};
// _schema.definitions.columnDefs.properties.field.enumSource=[sourceobj];
// }
return _schema;
}
options: {
grid_columns: 6,
select2_options: {
//width: 250,
value: "",
},
},
propertyOrder: 13,
},
ext2entity: {
type: "selectnew",
title: "附加实体2",
watch: {
modelid: "arr_columnDefs.modelid",
},
enumSource: [
{
source: [...[{ label: "--", id: "" }]],
p0: "modelid",
url: "/dst/datamodels/${p0}/propertys",
title: "{{item.label}}",
value: "{{item.id}}",
},
],
options: {
grid_columns: 6,
select2_options: {
//width: 350,
value: "",
},
},
propertyOrder: 14,
},
ext2field: {
type: "selectnew",
title: "附加属性2",
watch: {
modelid: "arr_columnDefs.modelid",
entity: "arr_columnDefs.ext2entity",
},
enumSource: [
{
source: [...[{ label: "--", id: "" }]],
p0: "modelid",
p1: "entity",
url: "/dst/datamodels/${p0}/propertys/${p1}/fields",
title: "{{item.label}}",
value: "{{item.id}}",
},
],
options: {
grid_columns: 6,
select2_options: {
//width: 250,
value: "",
},
},
propertyOrder: 15,
},
},
},
},
};
return _schema;
}
}
</script>
\ No newline at end of file
......@@ -2,316 +2,406 @@
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 { 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';
import AppFormJson from "./app-form-json.vue";
@Component({
components: {
}
components: {},
})
export default class AppFormJsonLogic extends AppFormJson {
public codeListService:CodeListService = new CodeListService({ $store: this.$store });
public async getSchema(): Promise<any>{
let _field ={
"type": "object",
"title": "值项",
"grid_columns": 12,
"headerTemplate": "{{ self.fieldname }} - {{ self.fieldcond }} - {{ self.condvalue }}",
"required": ["entityname","fieldname","fieldcond","condvalue"],
"properties": {
"entityname": {
"type": "selectnew",
"title": "实体",
"watch": {
"modelid": "root.rootmodelid"
},
"enumSource":[{"source":[...[{label:"--",id:""}]],
"p0":"modelid" ,"url":'/dst/datamodels/${p0}/propertys',
"title": "{{item.label}}", "value": "{{item.id}}"}],
options: {
select2_options: {
width: 250,
value: ''
}
}
},
"fieldname": {
"type": "selectnew",
"title": "属性",
"watch": {
"modelid": "root.rootmodelid" ,
"entity": "arr_field.entityname" ,
},
"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: 300,
value: ''
}
}
},
"fieldcond": {
"type": "string",
"title": "判断",
"enumSource":[],
options: {
select2_options: {
width: 100,
value: ''
}
}
},
"condvalue": {
"title": "值",
"type": "string"
},
"condref": {
"title": "辅助字典",
"type": "string",
"watch": {
"sourceitem": "arr_field.fieldname"
},
"enumSource":[{"source":[...[{text:"--",value:""}]], "filter3":"sourceitem" , "title": "{{item.text}}", "value": "{{item.value}}"}],
options: {
select2_options: {
width: 300,
value: ''
}
}
}
}
};
let _releationfield = JSON.parse(JSON.stringify(_field));
_releationfield.properties.entityname.watch={
"modelid": "root.rootmodelid" ,
"submodel": "arr_releation.releationentity" ,
};
_releationfield.properties.entityname.enumSource = [{"source":[...[{label:"--",id:""}]],
"p0":"modelid" ,"p1":"submodel" ,"url":'/dst/datamodels/${p0}/name/${p1}/propertys',
"title": "{{item.label}}", "value": "{{item.id}}"}];
_releationfield.properties.fieldname.watch={
"modelid": "root.rootmodelid" ,
"submodel": "arr_releation.releationentity" ,
"entity": "arr_field.entityname" ,
};
_releationfield.properties.fieldname.enumSource = [{"source":[...[{label:"--",id:""}]],
"p0":"modelid" ,"p1":"submodel", "p2":"entity" ,"url":'/dst/datamodels/${p0}/name/${p1}/propertys/${p2}/fields',
"title": "{{item.label}}", "value": "{{item.id}}"}];
let _group = {
"type": "object",
"title": "组逻辑",
"headerTemplate": "{{ self.groupcond }}",
"required": ["groupcond"],
"properties": {
"groupcond": {
"grid_columns": 12,
"type": "string",
"title": "AND/OR",
"default": "AND",
"enumSource": [{"source":[{"id":"AND"},{"id":"OR"}],"title": "{{item.id}}", "value": "{{item.id}}"}],
options: {
select2_options: {
width: 120,
value: '',
placeholder: "请选择",
}
}
},
"group": {
"type": "array",
"required": ["groupcond"],
"title": "组",
"items": {
"$ref": "#/definitions/group"
}
},
"field": {
"grid_columns": 12,
"type": "array",
"format": "table",
"title": "值项",
"items": {
"id":"arr_field",
"$ref": "#/definitions/field"
}
}
}
};
let _releationgroup = JSON.parse(JSON.stringify(_group));
public codeListService: CodeListService = new CodeListService({
$store: this.$store,
});
_releationgroup.properties.field.items.$ref="#/definitions/releationfield";
_releationgroup.properties.group.items.$ref="#/definitions/releationgroup";
_releationgroup.required = ["groupcond","field"];
public async getSchema(): Promise<any> {
window["showdetail"]=this.showdetail;
let _field = {
type: "object",
title: "值项",
grid_columns: 12,
headerTemplate:
"{{ self.fieldname }} - {{ self.fieldcond }} - {{ self.condvalue }}",
required: ["entityname", "fieldname", "fieldcond", "condvalue"],
properties: {
entityname: {
type: "selectnew",
title: "实体",
watch: {
modelid: "root.rootmodelid",
},
enumSource: [
{
source: [...[{ label: "--", id: "" }]],
p0: "modelid",
url: "/dst/datamodels/${p0}/propertys",
title: "{{item.label}}",
value: "{{item.id}}",
},
],
options: {
select2_options: {
width: 300,
value: "",
},
},
},
fieldname: {
type: "selectnew",
title: "属性",
watch: {
modelid: "root.rootmodelid",
entity: "arr_field.entityname",
},
enumSource: [
{
source: [...[{ label: "--", id: "" }]],
p0: "modelid",
p1: "entity",
url: "/dst/datamodels/${p0}/propertys/${p1}/fields",
title: "{{item.label}}",
value: "{{item.id}}",
},
],
links: [
{
rel: "查看",
"href": "javascript:window.showdetail('DICT',{'field':'{{self}}'})"
},
],
let _schema = {
"title": "逻辑规则",
"type": "object",
"$ref": "#/definitions/root",
"definitions": {
options: {
select2_options: {
width: 250,
value: "",
},
},
},
fieldcond: {
type: "string",
title: "判断",
enumSource: [],
options: {
select2_options: {
width: 100,
value: "",
},
},
},
condvalue: {
title: "值",
type: "string",
},
condref: {
title: "辅助字典",
type: "string",
options: {
hidden:true
},
},
},
};
"root": {
"type": "object",
"title": "逻辑",
"headerTemplate": "{{ self.groupcond }}",
"required": ["groupcond","rootmodelid"],
"properties": {
"rootmodelid": {
"grid_columns": 6,
"type": "string",
"title": "模型",
"enumSource": [{"source":[{"id":this.data.modelid,"text":this.data.modelname}],"title": "{{item.text}}", "value": "{{item.id}}"}]
},
"groupcond": {
"grid_columns": 6,
"type": "string",
"title": "AND",
"default": "AND",
"enumSource": [{"source":[{"id":"AND"}],"title": "{{item.id}}", "value": "{{item.id}}"}]
},
"field": {
"grid_columns": 12,
"type": "array",
"format": "table",
"title": "值项",
"items": {
"id":"arr_field",
"$ref": "#/definitions/field"
}
},
"group": {
"type": "array",
"required": ["groupcond","field"],
"title": "组逻辑",
"format": "tabs",
"items": {
"$ref": "#/definitions/group"
}
},
"releation": {
"type": "array",
"required": ["releationcond"],
"title": "子数据逻辑",
"format": "tabs",
"items": {
"id":"arr_releation",
"$ref": "#/definitions/releation"
}
}
}
},
"releation": {
"type": "object",
"title": "子数据逻辑",
"headerTemplate": "{{ self.releationcond }}-{{ self.releationentity }}",
"required": ["releationcond","releationentity","group"],
"properties": {
"releationcond": {
"grid_columns": 6,
"type": "string",
"title": "存在/不存在",
"default": "exists",
"enumSource": [{"source":[{"id":"exists"},{"id":"not exists"}],"title": "{{item.id}}", "value": "{{item.id}}"}],
options: {
select2_options: {
width: 120,
value: '',
placeholder: "请选择",
}
}
},
"releationentity": {
"grid_columns": 6,
"type": "selectnew",
"title": "子数据实体",
"watch": {
"modelid": "root.rootmodelid" ,
},
"enumSource":[{"source":[...[{label:"--",id:""}]],
"p0":"modelid" ,"url":'/dst/datamodels/${p0}/submodels',
"title": "{{item.label}}", "value": "{{item.id}}"}],
options: {
select2_options: {
width: 200,
value: '',
placeholder: "请选择",
}
}
},
"group": {
"type": "array",
"required": ["groupcond"],
"title": "组逻辑",
"items": {
"$ref": "#/definitions/releationgroup"
}
}
}
},
"group": _group,
"releationgroup": _releationgroup,
"field":_field,
"releationfield":_releationfield
let _releationfield = JSON.parse(JSON.stringify(_field));
_releationfield.properties.entityname.watch = {
modelid: "root.rootmodelid",
submodel: "arr_releation.releationentity",
};
_releationfield.properties.entityname.enumSource = [
{
source: [...[{ label: "--", id: "" }]],
p0: "modelid",
p1: "submodel",
url: "/dst/datamodels/${p0}/name/${p1}/propertys",
title: "{{item.label}}",
value: "{{item.id}}",
},
];
_releationfield.properties.fieldname.watch = {
modelid: "root.rootmodelid",
submodel: "arr_releation.releationentity",
entity: "arr_field.entityname",
};
_releationfield.properties.fieldname.enumSource = [
{
source: [...[{ label: "--", id: "" }]],
p0: "modelid",
p1: "submodel",
p2: "entity",
url: "/dst/datamodels/${p0}/name/${p1}/propertys/${p2}/fields",
title: "{{item.label}}",
value: "{{item.id}}",
},
];
}
};
let _fcond = JSON.parse(JSON.stringify(this.$store.getters.getCodeList("OPCond")));
if (_fcond) {
let _items = [..._fcond.items];
let sourceobj={"source":_items,"title": "{{item.text}}", "value": "{{item.id}}"};
_schema.definitions.field.properties.fieldcond.enumSource=[sourceobj];
_schema.definitions.releationfield.properties.fieldcond.enumSource=[sourceobj];
}
let _group = {
type: "object",
title: "组逻辑",
headerTemplate: "{{ self.groupcond }}",
required: ["groupcond"],
properties: {
groupcond: {
grid_columns: 12,
type: "string",
title: "AND/OR",
default: "AND",
enumSource: [
{
source: [{ id: "AND" }, { id: "OR" }],
title: "{{item.id}}",
value: "{{item.id}}",
},
],
options: {
select2_options: {
width: 120,
value: "",
placeholder: "请选择",
},
},
},
group: {
type: "array",
required: ["groupcond"],
title: "组",
items: {
$ref: "#/definitions/group",
},
},
field: {
grid_columns: 12,
type: "array",
format: "table",
title: "值项",
items: {
id: "arr_field",
$ref: "#/definitions/field",
},
},
},
};
let _releationgroup = JSON.parse(JSON.stringify(_group));
_releationgroup.properties.field.items.$ref =
"#/definitions/releationfield";
_releationgroup.properties.group.items.$ref =
"#/definitions/releationgroup";
_releationgroup.required = ["groupcond", "field"];
let _schema = {
title: "逻辑规则",
type: "object",
$ref: "#/definitions/root",
definitions: {
root: {
type: "object",
title: "逻辑",
headerTemplate: "{{ self.groupcond }}",
required: ["groupcond", "rootmodelid"],
properties: {
rootmodelid: {
grid_columns: 6,
type: "string",
title: "模型",
enumSource: [
{
source: [
{ id: this.data.modelid, text: this.data.modelname },
],
title: "{{item.text}}",
value: "{{item.id}}",
},
],
options: {
hidden: true,
},
},
groupcond: {
grid_columns: 6,
type: "string",
title: "AND",
default: "AND",
enumSource: [
{
source: [{ id: "AND" }],
title: "{{item.id}}",
value: "{{item.id}}",
},
],
options: {
hidden: true,
},
},
field: {
grid_columns: 12,
type: "array",
format: "table",
title: "值项",
items: {
id: "arr_field",
$ref: "#/definitions/field",
},
},
group: {
type: "array",
required: ["groupcond", "field"],
title: "组逻辑",
format: "tabs",
items: {
$ref: "#/definitions/group",
},
},
releation: {
type: "array",
required: ["releationcond"],
title: "子数据逻辑",
format: "tabs",
items: {
id: "arr_releation",
$ref: "#/definitions/releation",
},
},
},
},
releation: {
type: "object",
title: "子数据逻辑",
format: "grid",
headerTemplate: "{{ self.releationcond }}-{{ self.releationentity }}",
required: ["releationcond", "releationentity", "group"],
properties: {
releationcond: {
grid_columns: 3,
type: "string",
title: "存在/不存在",
default: "exists",
enumSource: [
{
source: [{ id: "exists" }, { id: "not exists" }],
title: "{{item.id}}",
value: "{{item.id}}",
},
],
options: {
grid_columns: 3,
select2_options: {
width: 120,
value: "",
placeholder: "请选择",
},
},
},
releationentity: {
grid_columns: 3,
type: "selectnew",
title: "子数据实体",
watch: {
modelid: "root.rootmodelid",
},
enumSource: [
{
source: [...[{ label: "--", id: "" }]],
p0: "modelid",
url: "/dst/datamodels/${p0}/submodels",
title: "{{item.label}}",
value: "{{item.id}}",
},
],
options: {
grid_columns: 3,
select2_options: {
width: 250,
value: "",
placeholder: "请选择",
},
},
},
group: {
type: "array",
required: ["groupcond","field"],
title: "组逻辑",
items: {
$ref: "#/definitions/releationgroup",
},
},
},
},
group: _group,
releationgroup: _releationgroup,
field: _field,
releationfield: _releationfield,
},
};
let _fcond = JSON.parse(
JSON.stringify(this.$store.getters.getCodeList("OPCond"))
);
if (_fcond) {
let _items = [..._fcond.items];
let sourceobj = {
source: _items,
title: "{{item.text}}",
value: "{{item.id}}",
};
_schema.definitions.field.properties.fieldcond.enumSource = [sourceobj];
_schema.definitions.releationfield.properties.fieldcond.enumSource = [
sourceobj,
];
}
// let _fset: Array<any> = [];
// let _fset: Array<any> = [];
// try{
// const res = await this.codeListService.getItems("CLMetric");
// _fset.push(...res);
// }catch(er){
// try{
// const res = await this.codeListService.getItems("CLMetric");
// _fset.push(...res);
// }catch(er){
// }
// }
// if (_fset) {
// let _items = [...[{text:"--",id:""}],..._fset];
// let sourceobj={"source":_items,"filterText":"entity12","title": "{{item.text}}", "value": "{{item.id}}"};
// _schema.definitions.columnDefs.properties.field.enumSource=[sourceobj];
// }
return _schema;
// if (_fset) {
// let _items = [...[{text:"--",id:""}],..._fset];
// let sourceobj={"source":_items,"filterText":"entity12","title": "{{item.text}}", "value": "{{item.id}}"};
// _schema.definitions.columnDefs.properties.field.enumSource=[sourceobj];
// }
return _schema;
}
public showdetail(path:any,arg:any)
{
if(path === 'DICT')
{
let fieldname:any = arg.field;
this.$http.get("/dst/datamodels/"+this.data.modelid+"/"+fieldname+"/dict").then((response: any) => {
if(response.data)
{
let newitem : Array<any>=[];
response.data.forEach((item:any) =>{
if(item.pvalue)
newitem.push({id:item.id,label:item.text,parent:item.pvalue})
else
newitem.push({id:item.id,label:item.text})
})
this.$alert('<div style="height:500px;width:100%;overflow:auto;background:#EEEEEE;"><pre>'+JSON.stringify(newitem,null,4)+'<PRE></div>', '字典', {
dangerouslyUseHTMLString: true
});
}
}).catch((response: any) => {
});
}
else
{
super.showdetail(path,arg);
}
}
}
</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 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册