app-form-json-field-set.vue 14.6 KB
Newer Older
sq3536's avatar
sq3536 committed
1 2 3 4
<script lang='tsx'>
import { Component, Vue, Prop, Model, Watch } from "vue-property-decorator";
import { VNode, CreateElement } from "vue";
import { interval, Subject, Subscription } from "rxjs";
sq3536's avatar
sq3536 committed
5
import { Http, Util } from "@/utils";
sq3536's avatar
sq3536 committed
6 7 8 9 10
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";
sq3536's avatar
sq3536 committed
11
import AppFormJson from "./app-form-json.vue";
sq3536's avatar
sq3536 committed
12 13

@Component({
sq3536's avatar
sq3536 committed
14
  components: {},
sq3536's avatar
sq3536 committed
15 16
})
export default class AppFormJsonFieldSet extends AppFormJson {
sq3536's avatar
sq3536 committed
17 18 19
  public codeListService: CodeListService = new CodeListService({
    $store: this.$store,
  });
sq3536's avatar
sq3536 committed
20

sq3536's avatar
sq3536 committed
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
  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",
sq3536's avatar
sq3536 committed
39 40
            "dimentity",
            "dimfield",
sq3536's avatar
sq3536 committed
41 42 43 44 45 46 47 48 49 50

            "keyvalueentity",
            "keyvaluefield",
            "businesscatentity",
            "businesscatfield",
            "ext1entity",
            "ext1field",
            "ext2entity",
            "ext2field",

sq3536's avatar
sq3536 committed
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84
            "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",
sq3536's avatar
sq3536 committed
85
                  url: "/dst/datamodels/${p0}/allpropertys",
sq3536's avatar
sq3536 committed
86 87 88 89 90 91 92
                  title: "{{item.label}}",
                  value: "{{item.id}}",
                },
              ],
              options: {
                grid_columns: 6,
                select2_options: {
sq3536's avatar
sq3536 committed
93
                  width: 350,
sq3536's avatar
sq3536 committed
94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110
                  value: "",
                },
              },
              propertyOrder: 4,
            },
            metricfield: {
              type: "selectnew",
              title: "指标属性",
              watch: {
                modelid: "arr_columnDefs.modelid",
                entity: "arr_columnDefs.metricentity",
              },
              enumSource: [
                {
                  source: [...[{ label: "--", id: "" }]],
                  p0: "modelid",
                  p1: "entity",
sq3536's avatar
sq3536 committed
111
                  url: "/dst/datamodels/${p0}/allpropertys/${p1}/fields",
sq3536's avatar
sq3536 committed
112 113 114 115
                  title: "{{item.label}}",
                  value: "{{item.id}}",
                },
              ],
sq3536's avatar
sq3536 committed
116

sq3536's avatar
sq3536 committed
117 118 119
              options: {
                grid_columns: 6,
                select2_options: {
sq3536's avatar
sq3536 committed
120
                  width: 250,
sq3536's avatar
sq3536 committed
121 122 123 124 125
                  value: "",
                },
              },
              propertyOrder: 5,
            },
sq3536's avatar
sq3536 committed
126

sq3536's avatar
sq3536 committed
127 128 129 130 131 132 133 134 135 136
            timeentity: {
              type: "selectnew",
              title: "时间实体",
              watch: {
                modelid: "arr_columnDefs.modelid",
              },
              enumSource: [
                {
                  source: [...[{ label: "--", id: "" }]],
                  p0: "modelid",
sq3536's avatar
sq3536 committed
137
                  url: "/dst/datamodels/${p0}/allpropertys",
sq3536's avatar
sq3536 committed
138 139 140 141 142 143 144
                  title: "{{item.label}}",
                  value: "{{item.id}}",
                },
              ],
              options: {
                grid_columns: 6,
                select2_options: {
sq3536's avatar
sq3536 committed
145
                  width: 350,
sq3536's avatar
sq3536 committed
146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162
                  value: "",
                },
              },
              propertyOrder: 6,
            },
            timefield: {
              type: "selectnew",
              title: "时间属性",
              watch: {
                modelid: "arr_columnDefs.modelid",
                entity: "arr_columnDefs.timeentity",
              },
              enumSource: [
                {
                  source: [...[{ label: "--", id: "" }]],
                  p0: "modelid",
                  p1: "entity",
sq3536's avatar
sq3536 committed
163
                  url: "/dst/datamodels/${p0}/allpropertys/${p1}/fields",
sq3536's avatar
sq3536 committed
164 165 166 167
                  title: "{{item.label}}",
                  value: "{{item.id}}",
                },
              ],
sq3536's avatar
sq3536 committed
168

sq3536's avatar
sq3536 committed
169 170 171
              options: {
                grid_columns: 6,
                select2_options: {
sq3536's avatar
sq3536 committed
172
                  width: 250,
sq3536's avatar
sq3536 committed
173 174 175 176 177
                  value: "",
                },
              },
              propertyOrder: 7,
            },
sq3536's avatar
sq3536 committed
178

sq3536's avatar
sq3536 committed
179 180 181 182 183 184 185 186 187 188
            domainsentity: {
              type: "selectnew",
              title: "分区实体",
              watch: {
                modelid: "arr_columnDefs.modelid",
              },
              enumSource: [
                {
                  source: [...[{ label: "--", id: "" }]],
                  p0: "modelid",
sq3536's avatar
sq3536 committed
189
                  url: "/dst/datamodels/${p0}/allpropertys",
sq3536's avatar
sq3536 committed
190 191 192 193 194 195 196
                  title: "{{item.label}}",
                  value: "{{item.id}}",
                },
              ],
              options: {
                  grid_columns: 6,
                select2_options: {
sq3536's avatar
sq3536 committed
197
                  width: 350,
sq3536's avatar
sq3536 committed
198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214
                  value: "",
                },
              },
              propertyOrder: 8,
            },
            domainsfield: {
              type: "selectnew",
              title: "分区属性",
              watch: {
                modelid: "arr_columnDefs.modelid",
                entity: "arr_columnDefs.domainsentity",
              },
              enumSource: [
                {
                  source: [...[{ label: "--", id: "" }]],
                  p0: "modelid",
                  p1: "entity",
sq3536's avatar
sq3536 committed
215
                  url: "/dst/datamodels/${p0}/allpropertys/${p1}/fields",
sq3536's avatar
sq3536 committed
216 217 218 219
                  title: "{{item.label}}",
                  value: "{{item.id}}",
                },
              ],
sq3536's avatar
sq3536 committed
220

sq3536's avatar
sq3536 committed
221 222 223
              options: {
                grid_columns: 6,
                select2_options: {
sq3536's avatar
sq3536 committed
224
                  width: 250,
sq3536's avatar
sq3536 committed
225 226 227 228 229
                  value: "",
                },
              },
              propertyOrder: 9,
            },
sq3536's avatar
sq3536 committed
230

sq3536's avatar
sq3536 committed
231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282
            dimentity: {
              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: 10,
            },
            dimfield: {
              type: "selectnew",
              title: "维度属性",
              watch: {
                modelid: "arr_columnDefs.modelid",
                entity: "arr_columnDefs.dimentity",
              },
              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,
            },

sq3536's avatar
sq3536 committed
283 284 285 286 287 288 289 290 291 292
            keyvalueentity: {
              type: "selectnew",
              title: "标示实体",
              watch: {
                modelid: "arr_columnDefs.modelid",
              },
              enumSource: [
                {
                  source: [...[{ label: "--", id: "" }]],
                  p0: "modelid",
sq3536's avatar
sq3536 committed
293
                  url: "/dst/datamodels/${p0}/allpropertys",
sq3536's avatar
sq3536 committed
294 295 296 297 298
                  title: "{{item.label}}",
                  value: "{{item.id}}",
                },
              ],
              options: {
sq3536's avatar
sq3536 committed
299
                 grid_columns: 6,
sq3536's avatar
sq3536 committed
300
                select2_options: {
sq3536's avatar
sq3536 committed
301
                  width: 350,
sq3536's avatar
sq3536 committed
302 303 304
                  value: "",
                },
              },
sq3536's avatar
sq3536 committed
305
              propertyOrder: 12,
sq3536's avatar
sq3536 committed
306 307 308 309 310 311 312 313 314 315 316 317 318
            },
            keyvaluefield: {
              type: "selectnew",
              title: "标示属性",
              watch: {
                modelid: "arr_columnDefs.modelid",
                entity: "arr_columnDefs.keyvalueentity",
              },
              enumSource: [
                {
                  source: [...[{ label: "--", id: "" }]],
                  p0: "modelid",
                  p1: "entity",
sq3536's avatar
sq3536 committed
319
                  url: "/dst/datamodels/${p0}/allpropertys/${p1}/fields",
sq3536's avatar
sq3536 committed
320 321 322 323
                  title: "{{item.label}}",
                  value: "{{item.id}}",
                },
              ],
sq3536's avatar
sq3536 committed
324

sq3536's avatar
sq3536 committed
325 326 327
              options: {
                grid_columns: 6,
                select2_options: {
sq3536's avatar
sq3536 committed
328
                   width: 250,
sq3536's avatar
sq3536 committed
329 330 331
                  value: "",
                },
              },
sq3536's avatar
sq3536 committed
332
              propertyOrder: 13,
sq3536's avatar
sq3536 committed
333
            },
sq3536's avatar
sq3536 committed
334

sq3536's avatar
sq3536 committed
335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351

            businesscatentity: {
              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: {
sq3536's avatar
sq3536 committed
352
                 grid_columns: 6,
sq3536's avatar
sq3536 committed
353 354 355 356 357 358 359 360 361
                select2_options: {
                  width: 350,
                  value: "",
                },
              },
              propertyOrder: 14,
            },
            businesscatfield: {
              type: "selectnew",
sq3536's avatar
sq3536 committed
362
              title: "业务类别属性",
sq3536's avatar
sq3536 committed
363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387
              watch: {
                modelid: "arr_columnDefs.modelid",
                entity: "arr_columnDefs.businesscatentity",
              },
              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,
            },

sq3536's avatar
sq3536 committed
388 389 390 391 392 393 394 395 396 397
            ext1entity: {
              type: "selectnew",
              title: "附加实体1",
              watch: {
                modelid: "arr_columnDefs.modelid",
              },
              enumSource: [
                {
                  source: [...[{ label: "--", id: "" }]],
                  p0: "modelid",
sq3536's avatar
sq3536 committed
398
                  url: "/dst/datamodels/${p0}/allpropertys",
sq3536's avatar
sq3536 committed
399 400 401 402 403 404 405
                  title: "{{item.label}}",
                  value: "{{item.id}}",
                },
              ],
              options: {
                grid_columns: 6,
                select2_options: {
sq3536's avatar
sq3536 committed
406
                   width: 350,
sq3536's avatar
sq3536 committed
407 408 409
                  value: "",
                },
              },
sq3536's avatar
sq3536 committed
410
              propertyOrder: 16,
sq3536's avatar
sq3536 committed
411 412 413 414 415 416 417 418 419 420 421 422 423
            },
            ext1field: {
              type: "selectnew",
              title: "附加属性1",
              watch: {
                modelid: "arr_columnDefs.modelid",
                entity: "arr_columnDefs.ext1entity",
              },
              enumSource: [
                {
                  source: [...[{ label: "--", id: "" }]],
                  p0: "modelid",
                  p1: "entity",
sq3536's avatar
sq3536 committed
424
                  url: "/dst/datamodels/${p0}/allpropertys/${p1}/fields",
sq3536's avatar
sq3536 committed
425 426 427 428
                  title: "{{item.label}}",
                  value: "{{item.id}}",
                },
              ],
sq3536's avatar
sq3536 committed
429

sq3536's avatar
sq3536 committed
430 431 432
              options: {
                grid_columns: 6,
                select2_options: {
sq3536's avatar
sq3536 committed
433
                  width: 250,
sq3536's avatar
sq3536 committed
434 435 436
                  value: "",
                },
              },
sq3536's avatar
sq3536 committed
437
              propertyOrder: 17,
sq3536's avatar
sq3536 committed
438 439 440 441 442 443 444 445 446 447 448 449
            },

            ext2entity: {
              type: "selectnew",
              title: "附加实体2",
              watch: {
                modelid: "arr_columnDefs.modelid",
              },
              enumSource: [
                {
                  source: [...[{ label: "--", id: "" }]],
                  p0: "modelid",
sq3536's avatar
sq3536 committed
450
                  url: "/dst/datamodels/${p0}/allpropertys",
sq3536's avatar
sq3536 committed
451 452 453 454 455 456 457
                  title: "{{item.label}}",
                  value: "{{item.id}}",
                },
              ],
              options: {
                grid_columns: 6,
                select2_options: {
sq3536's avatar
sq3536 committed
458
                  width: 350,
sq3536's avatar
sq3536 committed
459 460 461
                  value: "",
                },
              },
sq3536's avatar
sq3536 committed
462
              propertyOrder: 18,
sq3536's avatar
sq3536 committed
463 464 465 466 467 468 469 470 471 472 473 474 475
            },
            ext2field: {
              type: "selectnew",
              title: "附加属性2",
              watch: {
                modelid: "arr_columnDefs.modelid",
                entity: "arr_columnDefs.ext2entity",
              },
              enumSource: [
                {
                  source: [...[{ label: "--", id: "" }]],
                  p0: "modelid",
                  p1: "entity",
sq3536's avatar
sq3536 committed
476
                  url: "/dst/datamodels/${p0}/allpropertys/${p1}/fields",
sq3536's avatar
sq3536 committed
477 478 479 480
                  title: "{{item.label}}",
                  value: "{{item.id}}",
                },
              ],
sq3536's avatar
sq3536 committed
481

sq3536's avatar
sq3536 committed
482 483 484
              options: {
                grid_columns: 6, 
                select2_options: {
sq3536's avatar
sq3536 committed
485
                  width: 250,
sq3536's avatar
sq3536 committed
486 487 488
                  value: "",
                },
              },
sq3536's avatar
sq3536 committed
489
              propertyOrder: 19,
sq3536's avatar
sq3536 committed
490 491 492 493 494 495 496 497
            },
          },
        },
      },
    };

    return _schema;
  }
sq3536's avatar
sq3536 committed
498 499
}
</script>