app-form-json-metric.vue 11.1 KB
<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 AppFormJsonMetric extends AppFormJson {
  public codeListService: CodeListService = new CodeListService({
    $store: this.$store,
  });

  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}/allpropertys",
                  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}/allpropertys/${p1}/fields",
                  title: "{{item.label}}",
                  value: "{{item.id}}",
                },
              ],

              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}/allpropertys",
                  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}/allpropertys/${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}/allpropertys",
                  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}/allpropertys/${p1}/fields",
                  title: "{{item.label}}",
                  value: "{{item.id}}",
                },
              ],

              options: {
                grid_columns: 6,
                select2_options: {
                  width: 250,
                  value: "",
                },
              },
              propertyOrder: 9,
            },

            keyvalueentity: {
              type: "selectnew",
              title: "标示实体",
              watch: {
                modelid: "arr_columnDefs.modelid",
              },
              enumSource: [
                {
                  source: [...[{ label: "--", id: "" }]],
                  p0: "modelid",
                  url: "/dst/datamodels/${p0}/allpropertys",
                  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}/allpropertys/${p1}/fields",
                  title: "{{item.label}}",
                  value: "{{item.id}}",
                },
              ],

              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}/allpropertys",
                  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}/allpropertys/${p1}/fields",
                  title: "{{item.label}}",
                  value: "{{item.id}}",
                },
              ],

              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}/allpropertys",
                  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}/allpropertys/${p1}/fields",
                  title: "{{item.label}}",
                  value: "{{item.id}}",
                },
              ],

              options: {
                grid_columns: 6, 
                select2_options: {
                  width: 250,
                  value: "",
                },
              },
              propertyOrder: 15,
            },
          },
        },
      },
    };

    return _schema;
  }
}
</script>