tianheng-ui 0.0.48 → 0.0.51

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "tianheng-ui",
3
3
  "description": "A Vue.js project",
4
- "version": "0.0.48",
4
+ "version": "0.0.51",
5
5
  "author": "shu lang <403732931@qq.com>",
6
6
  "license": "MIT",
7
7
  "private": false,
@@ -27,7 +27,10 @@
27
27
  </div>
28
28
  </div>
29
29
  <slot></slot>
30
- <span slot="footer">
30
+ <slot v-if="$slots.footer" slot="footer">
31
+ <slot name="footer"></slot>
32
+ </slot>
33
+ <span v-else slot="footer">
31
34
  <el-button
32
35
  v-if="showAffirm"
33
36
  type="primary"
@@ -359,7 +359,8 @@ export default {
359
359
  "select",
360
360
  "switch",
361
361
  "slider",
362
- "text"
362
+ "text",
363
+ "button"
363
364
  ]
364
365
  },
365
366
  advanceFields: {
@@ -418,7 +419,7 @@ export default {
418
419
  console.log("callback", response, file, fileList);
419
420
  }
420
421
  },
421
- widgetModels: {table:[{name:'这是'}]},
422
+ widgetModels: { table: [{ name: "这是" }] },
422
423
  blank: "",
423
424
  htmlTemplate: "",
424
425
  vueTemplate: "",
@@ -108,7 +108,7 @@ export default {
108
108
  }
109
109
  }
110
110
  });
111
- console.log(this.models)
111
+ // console.log(this.models)
112
112
  },
113
113
  generateRules(item) {
114
114
  if (this.rules[item.model]) {
@@ -1,5 +1,6 @@
1
1
  <template>
2
2
  <el-form-item
3
+ :class="widget.model"
3
4
  :label="widget.options.hideLabel || hideLabel ? '' : widget.name"
4
5
  :label-width="
5
6
  widget.options.hideLabel
@@ -568,7 +569,10 @@
568
569
  </template>
569
570
 
570
571
  <template v-if="widget.type == 'divider'">
571
- <el-divider :content-position="widget.options.contentPosition">
572
+ <el-divider
573
+ :content-position="widget.options.contentPosition"
574
+ :style="{ height: `${widget.options.height}px` }"
575
+ >
572
576
  {{ widget.name }}
573
577
  </el-divider>
574
578
  </template>
@@ -602,7 +606,7 @@ export default {
602
606
  return {
603
607
  dataModel: this.models[this.widget.model],
604
608
  dialogVisible: false,
605
- dialogImageUrl: "",
609
+ dialogImageUrl: ""
606
610
  };
607
611
  },
608
612
  created() {
@@ -475,12 +475,15 @@
475
475
  label="默认值"
476
476
  v-if="
477
477
  Object.keys(data.options).indexOf('defaultValue') >= 0 &&
478
- (data.type == 'textarea' ||
479
- data.type == 'input' ||
480
- data.type == 'rate' ||
481
- data.type == 'color' ||
482
- data.type == 'switch' ||
483
- data.type == 'text')
478
+ [
479
+ 'textarea',
480
+ 'input',
481
+ 'rate',
482
+ 'color',
483
+ 'switch',
484
+ 'text',
485
+ 'select'
486
+ ].includes(data.type)
484
487
  "
485
488
  >
486
489
  <el-input
@@ -490,23 +493,24 @@
490
493
  v-model="data.options.defaultValue"
491
494
  ></el-input>
492
495
  <el-input
493
- v-if="data.type == 'input'"
496
+ v-if="data.type == 'input' || data.type == 'select'"
494
497
  v-model="data.options.defaultValue"
495
498
  ></el-input>
496
- <el-rate
497
- v-if="data.type == 'rate'"
498
- style="display:inline-block;vertical-align: middle;"
499
- :max="data.options.max"
500
- :allow-half="data.options.allowHalf"
501
- v-model="data.options.defaultValue"
502
- ></el-rate>
503
- <el-button
504
- type="text"
505
- v-if="data.type == 'rate'"
506
- style="display:inline-block;vertical-align: middle;margin-left: 10px;"
507
- @click="data.options.defaultValue = 0"
508
- >清空</el-button
509
- >
499
+ <template v-if="data.type == 'rate'">
500
+ <el-rate
501
+ style="display:inline-block;vertical-align: middle;"
502
+ :max="data.options.max"
503
+ :allow-half="data.options.allowHalf"
504
+ v-model="data.options.defaultValue"
505
+ ></el-rate>
506
+ <el-button
507
+ type="text"
508
+ style="display:inline-block;vertical-align: middle;margin-left: 10px;"
509
+ @click="data.options.defaultValue = 0"
510
+ >清空</el-button
511
+ >
512
+ </template>
513
+
510
514
  <el-color-picker
511
515
  v-if="data.type == 'color'"
512
516
  v-model="data.options.defaultValue"
@@ -4,7 +4,9 @@
4
4
  v-if="element && element.key"
5
5
  :class="{
6
6
  active: selectWidget.key == element.key,
7
- is_req: element.options.required
7
+ is_req: element.options.required,
8
+ 'widget-col': ['grid','tabs','table'].includes(element.type),
9
+ [element.model]: true
8
10
  }"
9
11
  :label="
10
12
  data.type == 'table' || element.options.hideLabel ? '' : element.name
@@ -466,7 +468,11 @@
466
468
  </template>
467
469
 
468
470
  <template v-if="element.type == 'tabs'">
469
- <el-tabs v-model="element.options.defaultValue" :type="element.options.type" :tab-position="element.options.tabPosition">
471
+ <el-tabs
472
+ v-model="element.options.defaultValue"
473
+ :type="element.options.type"
474
+ :tab-position="element.options.tabPosition"
475
+ >
470
476
  <el-tab-pane
471
477
  v-for="(tabItem, tabIndex) in element.tabs"
472
478
  :key="tabItem.value"
@@ -730,13 +736,19 @@ export default {
730
736
  }
731
737
 
732
738
  if (row.tabs[colIndex].list[newIndex].type === "grid") {
733
- this.$set(row.tabs[colIndex].list, newIndex, JSON.parse(JSON.stringify(row.tabs[colIndex].list[newIndex])));
739
+ this.$set(
740
+ row.tabs[colIndex].list,
741
+ newIndex,
742
+ JSON.parse(JSON.stringify(row.tabs[colIndex].list[newIndex]))
743
+ );
734
744
  }
735
745
 
736
746
  if (row.tabs[colIndex].list[newIndex].type === "table") {
737
747
  this.$set(row.tabs[colIndex].list, newIndex, {
738
748
  ...row.tabs[colIndex].list[newIndex],
739
- list: row.tabs[colIndex].list[newIndex].list.map(item => ({ ...item }))
749
+ list: row.tabs[colIndex].list[newIndex].list.map(item => ({
750
+ ...item
751
+ }))
740
752
  });
741
753
  }
742
754
 
@@ -314,9 +314,38 @@ export const basicComponents = [
314
314
  options: {
315
315
  labelWidth: 100,
316
316
  isLabelWidth: false,
317
- defaultValue: "This is a text",
317
+ hideLabel: true,
318
+ defaultValue: "文字内容",
318
319
  customClass: ""
319
320
  }
321
+ },
322
+ {
323
+ type: "button",
324
+ icon: "icon-button",
325
+ options: {
326
+ customClass: "",
327
+ disabled: false,
328
+ labelWidth: 100,
329
+ isLabelWidth: false,
330
+ hideLabel: true,
331
+ hidden: false,
332
+ dataBind: false,
333
+ buttonSize: "small",
334
+ buttonType: "",
335
+ buttonPlain: false,
336
+ buttonRound: false,
337
+ buttonCircle: false,
338
+ buttonName: "Button",
339
+ width: "",
340
+ remoteFunc: "",
341
+ remoteOption: "",
342
+ tableColumn: false
343
+ },
344
+ events: {
345
+ onClick: ""
346
+ },
347
+ name: "按钮",
348
+ rules: []
320
349
  }
321
350
  ];
322
351
 
@@ -1,24 +1,32 @@
1
- function findRemoteFunc (list, funcList, tokenFuncList, blankList) {
1
+ function findRemoteFunc(list, funcList, tokenFuncList, blankList) {
2
2
  for (let i = 0; i < list.length; i++) {
3
- if (list[i].type == 'grid') {
3
+ if (list[i].type == "grid") {
4
4
  list[i].columns.forEach(item => {
5
- findRemoteFunc(item.list, funcList, tokenFuncList, blankList)
6
- })
5
+ findRemoteFunc(item.list, funcList, tokenFuncList, blankList);
6
+ });
7
+ } else if (list[i].type == "tabs") {
8
+ list[i].tabs.forEach(item => {
9
+ findRemoteFunc(item.list, funcList, tokenFuncList, blankList);
10
+ });
11
+ } else if (list[i].type == "table") {
12
+ // list[i].tabs.forEach(item => {
13
+ findRemoteFunc(list[i].list, funcList, tokenFuncList, blankList);
14
+ // })
7
15
  } else {
8
- if (list[i].type == 'blank') {
16
+ if (list[i].type == "blank") {
9
17
  if (list[i].model) {
10
18
  blankList.push({
11
19
  name: list[i].model,
12
20
  label: list[i].name
13
- })
21
+ });
14
22
  }
15
- } else if (list[i].type == 'imgupload') {
23
+ } else if (list[i].type == "imgupload") {
16
24
  if (list[i].options.tokenFunc) {
17
25
  tokenFuncList.push({
18
26
  func: list[i].options.tokenFunc,
19
27
  label: list[i].name,
20
28
  model: list[i].model
21
- })
29
+ });
22
30
  }
23
31
  } else {
24
32
  if (list[i].options.remote && list[i].options.remoteFunc) {
@@ -26,45 +34,44 @@ function findRemoteFunc (list, funcList, tokenFuncList, blankList) {
26
34
  func: list[i].options.remoteFunc,
27
35
  label: list[i].name,
28
36
  model: list[i].model
29
- })
37
+ });
30
38
  }
31
39
  }
32
40
  }
33
41
  }
34
42
  }
35
43
 
36
- export default function (data, type = 'vue') {
37
-
38
- const funcList = []
44
+ export default function(data, type = "vue") {
45
+ const funcList = [];
39
46
 
40
- const tokenFuncList = []
47
+ const tokenFuncList = [];
41
48
 
42
- const blankList = []
49
+ const blankList = [];
43
50
 
44
- findRemoteFunc(JSON.parse(data).list, funcList, tokenFuncList, blankList)
51
+ findRemoteFunc(JSON.parse(data).list, funcList, tokenFuncList, blankList);
45
52
 
46
- let funcTemplate = ''
53
+ let funcTemplate = "";
47
54
 
48
- let blankTemplate = ''
55
+ let blankTemplate = "";
49
56
 
50
- for(let i = 0; i < funcList.length; i++) {
57
+ for (let i = 0; i < funcList.length; i++) {
51
58
  funcTemplate += `
52
59
  ${funcList[i].func} (resolve) {
53
60
  // ${funcList[i].label} ${funcList[i].model}
54
61
  // Call callback function once get the data from remote server
55
62
  // resolve(data)
56
63
  },
57
- `
64
+ `;
58
65
  }
59
66
 
60
- for(let i = 0; i < tokenFuncList.length; i++) {
67
+ for (let i = 0; i < tokenFuncList.length; i++) {
61
68
  funcTemplate += `
62
69
  ${tokenFuncList[i].func} (resolve) {
63
70
  // ${tokenFuncList[i].label} ${tokenFuncList[i].model}
64
71
  // Call callback function once get the token
65
72
  // resolve(token)
66
73
  },
67
- `
74
+ `;
68
75
  }
69
76
 
70
77
  for (let i = 0; i < blankList.length; i++) {
@@ -73,11 +80,12 @@ export default function (data, type = 'vue') {
73
80
  <!-- ${blankList[i].label} -->
74
81
  <!-- use v-model="scope.model.${blankList[i].name}" to bind data -->
75
82
  </template>
76
- `
83
+ `;
77
84
  }
78
85
 
79
- if (type == 'vue') {
80
- return `<template>
86
+ if (type == "vue") {
87
+ return `
88
+ <template>
81
89
  <div>
82
90
  <fm-generate-form :data="jsonData" :remote="remoteFuncs" :value="editData" ref="generateForm">
83
91
  ${blankTemplate}
@@ -108,7 +116,7 @@ export default function (data, type = 'vue') {
108
116
  }
109
117
  }
110
118
  }
111
- </script>`
119
+ </script>`;
112
120
  } else {
113
121
  return `<!DOCTYPE html>
114
122
  <html>
@@ -150,6 +158,6 @@ export default function (data, type = 'vue') {
150
158
  })
151
159
  </script>
152
160
  </body>
153
- </html>`
161
+ </html>`;
154
162
  }
155
- }
163
+ }
@@ -1,40 +1,63 @@
1
1
  <template>
2
2
  <div class="th-table-search">
3
- <template v-for="(item, index) in options">
4
- <div
5
- class="th-table-search-item"
3
+ <div
4
+ class="th-table-search-item"
5
+ v-for="(item, index) in options"
6
+ :key="index"
7
+ >
8
+ <span class="th-table-search-item-title">{{ item.options.name }}:</span>
9
+ <el-input
6
10
  v-if="item.type === 'input'"
7
- :key="index"
8
- >
9
- <span class="th-table-search-item-title">{{ item.props.label }}:</span>
10
- <el-input
11
- v-model="params[item.props.prop]"
12
- :style="{ width: item.width + 'px' }"
13
- :placeholder="item.placeholder || '请输入'"
14
- :size="item.size"
15
- clearable
16
- ></el-input>
17
- </div>
18
- <div
19
- class="th-table-search-item"
11
+ v-model="params[item.options.prop]"
12
+ :style="{ width: item.options.width + 'px' }"
13
+ :placeholder="item.options.placeholder || '请输入'"
14
+ :disabled="item.options.disabled"
15
+ clearable
16
+ ></el-input>
17
+ <el-date-picker
20
18
  v-if="item.type === 'date'"
21
- :key="index"
19
+ v-model="params[item.options.prop]"
20
+ :style="{ width: item.options.width + 'px' }"
21
+ :type="item.options.dateType || 'date'"
22
+ :format="item.options.format"
23
+ :value-format="item.options.valueFormat"
24
+ range-separator="至"
25
+ start-placeholder="开始日期"
26
+ end-placeholder="结束日期"
27
+ clearable
22
28
  >
23
- <span class="th-table-search-item-title">{{ item.props.label }}:</span>
24
- <el-date-picker
25
- v-model="params[item.props.prop]"
26
- :style="{ width: item.width + 'px' }"
27
- :type="item.dateType || 'date'"
28
- :format="item.format"
29
- :value-format="item.valueFormat"
30
- :size="item.size"
31
- range-separator=""
32
- start-placeholder="开始日期"
33
- end-placeholder="结束日期"
34
- >
35
- </el-date-picker>
36
- </div>
37
- </template>
29
+ </el-date-picker>
30
+ <el-select
31
+ v-if="item.type === 'select'"
32
+ v-model="params[item.options.prop]"
33
+ :style="{ width: item.options.width + 'px' }"
34
+ :placeholder="item.options.placeholder || '请选择'"
35
+ :multiple="item.options.multiple"
36
+ :multiple-limit="item.options.multipleLimit"
37
+ :filterable="item.options.filterable"
38
+ :disabled="item.options.disabled"
39
+ clearable
40
+ >
41
+ <template v-if="item.options.remote">
42
+ <el-option
43
+ v-for="option in item.options.options"
44
+ :key="option[item.option.props.value]"
45
+ :label="option[item.option.props.label]"
46
+ :value="option[item.option.props.value]"
47
+ >
48
+ </el-option>
49
+ </template>
50
+ <template v-else>
51
+ <el-option
52
+ v-for="option in item.options.options"
53
+ :key="option.value"
54
+ :label="option.label"
55
+ :value="option.value"
56
+ >
57
+ </el-option>
58
+ </template>
59
+ </el-select>
60
+ </div>
38
61
 
39
62
  <el-button type="primary" icon="el-icon-search" plain @click="doSearch"
40
63
  >查询</el-button
@@ -94,12 +117,14 @@ export default {
94
117
 
95
118
  <style lang="less" scoped>
96
119
  .th-table-search {
97
- display: flex;
98
- align-items: center;
99
- margin-bottom: 20px;
120
+ margin-bottom: 15px;
100
121
  &-item {
101
122
  display: inline-block;
102
123
  margin-right: 15px;
124
+ margin-bottom: 10px;
125
+ &-title {
126
+ font-size: 14px;
127
+ }
103
128
  }
104
129
  .th-table-search-item:last-child {
105
130
  margin-right: 20px !important;