tianheng-ui 0.1.11 → 0.1.12

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.
Files changed (31) hide show
  1. package/lib/tianheng-ui.js +13 -14
  2. package/package.json +1 -1
  3. package/packages/FormMaking/GenerateForm.vue +6 -1
  4. package/packages/FormMaking/GenerateFormItem.vue +7 -3
  5. package/packages/FormMaking/GenerateFormItemH5.vue +1 -1
  6. package/packages/FormMaking/WidgetConfig.vue +35 -48
  7. package/packages/FormMaking/WidgetTools.vue +538 -0
  8. package/packages/FormMaking/config/index.js +6 -0
  9. package/packages/FormMaking/custom/config.js +21 -24
  10. package/packages/FormMaking/custom/configs/button.vue +24 -25
  11. package/packages/FormMaking/custom/configs/cascader.vue +7 -7
  12. package/packages/FormMaking/custom/configs/checkbox.vue +23 -22
  13. package/packages/FormMaking/custom/configs/color.vue +3 -3
  14. package/packages/FormMaking/custom/configs/date.vue +3 -3
  15. package/packages/FormMaking/custom/configs/input.vue +3 -3
  16. package/packages/FormMaking/custom/configs/number.vue +3 -3
  17. package/packages/FormMaking/custom/configs/radio.vue +23 -19
  18. package/packages/FormMaking/custom/configs/rate.vue +3 -3
  19. package/packages/FormMaking/custom/configs/select.vue +25 -20
  20. package/packages/FormMaking/custom/configs/slider.vue +3 -3
  21. package/packages/FormMaking/custom/configs/switch.vue +3 -3
  22. package/packages/FormMaking/custom/configs/tabs.vue +12 -17
  23. package/packages/FormMaking/custom/configs/textarea.vue +3 -3
  24. package/packages/FormMaking/custom/configs/time.vue +3 -3
  25. package/packages/FormMaking/custom/configs/upload.vue +5 -5
  26. package/packages/FormMaking/custom/items/button.vue +35 -1
  27. package/packages/FormMaking/custom/items/checkbox.vue +1 -1
  28. package/packages/FormMaking/custom/mixins/index.js +12 -12
  29. package/packages/FormMaking/index.vue +91 -468
  30. package/packages/FormMaking/styles/index.scss +0 -21
  31. package/packages/FormMaking/util/request.js +9 -12
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.1.11",
4
+ "version": "0.1.12",
5
5
  "author": "shu lang <403732931@qq.com>",
6
6
  "license": "MIT",
7
7
  "private": false,
@@ -22,6 +22,7 @@
22
22
  :prop="item.type === 'grid' ? '' : item.model"
23
23
  :componentsData="componentsData"
24
24
  @input-change="onInputChange"
25
+ @button-submit="handleButtonSubmit"
25
26
  >
26
27
  <template v-for="name in slotKeys" :slot="name">
27
28
  <slot :name="name" />
@@ -132,6 +133,7 @@ export default {
132
133
  }
133
134
  },
134
135
  created() {
136
+ localStorage.setItem("_TH_OauthConfig", JSON.stringify(this.oauthConfig));
135
137
  this.axios = Axios.init(this.oauthConfig);
136
138
  this.generateModle(this.formJson.list);
137
139
  },
@@ -225,7 +227,7 @@ export default {
225
227
 
226
228
  const remoteFunc = item.options.remoteFunc;
227
229
  this.axios({
228
- url: remoteFunc.api,
230
+ url: remoteFunc.url,
229
231
  method: remoteFunc.method,
230
232
  headers: remoteFunc.headers,
231
233
  data: { ...remoteFunc.params }
@@ -240,6 +242,9 @@ export default {
240
242
  });
241
243
  });
242
244
  },
245
+ handleButtonSubmit(val){
246
+ this.$emit("button-submit", val);
247
+ },
243
248
  getData() {
244
249
  return new Promise((resolve, reject) => {
245
250
  this.$refs.generateForm.validate(valid => {
@@ -28,6 +28,7 @@
28
28
  :prop="prop"
29
29
  :slotKeys="slotKeys"
30
30
  :componentsData="componentsData"
31
+ @button-submit="handleButtonSubmit"
31
32
  ></component>
32
33
 
33
34
  <!-- <template v-if="widget.type == 'input'">
@@ -227,7 +228,7 @@ export default {
227
228
  let baseUrl = "";
228
229
  if (info) baseUrl = JSON.parse(info).baseUrl;
229
230
 
230
- return `${baseUrl}/${this.widget.options.remoteFunc.api}`;
231
+ return `${baseUrl}/${this.widget.options.remoteFunc.url}`;
231
232
  } else {
232
233
  return this.widget.options.action;
233
234
  }
@@ -311,6 +312,9 @@ export default {
311
312
  handleTableDelete(index) {
312
313
  this.dataModel.splice(index, 1);
313
314
  },
315
+ handleButtonSubmit(val) {
316
+ this.$emit("button-submit", val);
317
+ },
314
318
 
315
319
  // 支撑 JavaScript 动态编译
316
320
  handleEventAction(key) {
@@ -320,7 +324,7 @@ export default {
320
324
  for (let i = 0; i < eventScript.length; i++) {
321
325
  const element = eventScript[i];
322
326
  if (element.key === key) {
323
- const func = `(item,value)=>{${element.func}}`;
327
+ const func = `(item,value)=>{${element.value}}`;
324
328
  eval(func)(this.widget, this.dataModel);
325
329
  }
326
330
  }
@@ -367,7 +371,7 @@ export default {
367
371
  }
368
372
  },
369
373
  // 获取数据,仅支持获取当前组件节点下的数据
370
- getData() {
374
+ getData(obj) {
371
375
  return this.models;
372
376
  }
373
377
  }
@@ -774,7 +774,7 @@ export default {
774
774
  for (let i = 0; i < eventScript.length; i++) {
775
775
  const element = eventScript[i];
776
776
  if (element.key === key) {
777
- const func = `(item,value)=>{${element.func}}`;
777
+ const func = `(item,value)=>{${element.value}}`;
778
778
  eval(func)(this.widget, this.dataModel);
779
779
  }
780
780
  }
@@ -31,7 +31,6 @@
31
31
  <component
32
32
  :widget="data"
33
33
  :config="config"
34
- :remoteApis="remoteApis"
35
34
  :is="compsData[data.type].content"
36
35
  @events-show="handleEventDialogShow"
37
36
  @events-edit="handleEventsCollapseClick"
@@ -45,9 +44,13 @@
45
44
  >
46
45
  <div class="eventsSetting">
47
46
  <div class="list">
48
- <div class="list-header" @click="handleAddEvent">
47
+ <div class="list-header">
49
48
  <div>动作库</div>
50
- <el-button type="text" icon="el-icon-plus" size="mini"
49
+ <el-button
50
+ type="text"
51
+ icon="el-icon-plus"
52
+ size="mini"
53
+ @click="handleAddEvent"
51
54
  >添加</el-button
52
55
  >
53
56
  </div>
@@ -58,9 +61,9 @@
58
61
  @click="eventsDialog.active = item"
59
62
  >
60
63
  <div class="list-item-title">Function</div>
61
- <div class="list-item-value">{{ item.name }}</div>
64
+ <div class="list-item-value">{{ item.label }}</div>
62
65
  <el-popconfirm
63
- :title="`是否确定删除方法 ${item.name}`"
66
+ :title="`是否确定删除方法 ${item.label}`"
64
67
  confirm-button-text="删除"
65
68
  confirm-button-type="danger"
66
69
  @confirm="handleEventDialogDelete(item, index)"
@@ -73,12 +76,12 @@
73
76
  <div>
74
77
  <span>Function Name</span>
75
78
  <el-input
76
- v-model="eventsDialog.active.name"
79
+ v-model="eventsDialog.active.label"
77
80
  placeholder="请输入动作名称"
78
81
  size="small"
79
82
  :disabled="
80
- eventsDialog.active.name === 'mounted' ||
81
- eventsDialog.active.name === 'refresh'
83
+ eventsDialog.active.label === 'mounted' ||
84
+ eventsDialog.active.label === 'refresh'
82
85
  "
83
86
  ></el-input>
84
87
  </div>
@@ -86,8 +89,8 @@
86
89
  <div>
87
90
  function(
88
91
  {{
89
- eventsDialog.active.name !== "mounted" &&
90
- eventsDialog.active.name !== "refresh"
92
+ eventsDialog.active.label !== "mounted" &&
93
+ eventsDialog.active.label !== "refresh"
91
94
  ? "item,value"
92
95
  : ""
93
96
  }}
@@ -104,17 +107,21 @@
104
107
  slot="reference"
105
108
  class="el-icon-question"
106
109
  ></i>
107
- <div class="functions">
108
- <div>setData</div>
109
- <div>getData</div>
110
- <div>display</div>
111
- <div>hide</div>
110
+ <div>
111
+ <div
112
+ style="display: flex;justify-content: space-between;"
113
+ v-for="item in aceCompletions"
114
+ :key="item.caption"
115
+ >
116
+ <div>{{ item.caption }}</div>
117
+ <div>{{ item.meta }}</div>
118
+ </div>
112
119
  </div>
113
120
  </el-popover>
114
121
  </div>
115
122
  <th-code-editor
116
123
  style="height:calc(100% - 48px)"
117
- v-model="eventsDialog.active.func"
124
+ v-model="eventsDialog.active.value"
118
125
  :completions="aceCompletions"
119
126
  ref="codeEditor"
120
127
  ></th-code-editor>
@@ -144,12 +151,6 @@ export default {
144
151
  return {};
145
152
  }
146
153
  },
147
- remoteApis: {
148
- type: Array,
149
- default: () => {
150
- return [];
151
- }
152
- },
153
154
  config: {
154
155
  type: Object,
155
156
  default: () => {
@@ -196,6 +197,12 @@ export default {
196
197
  caption: "hide",
197
198
  value: "hide([ ])",
198
199
  score: 1
200
+ },
201
+ {
202
+ meta: "跳转页面",
203
+ caption: "goPage",
204
+ value: "goPage({path:'',query:{}})",
205
+ score: 1
199
206
  }
200
207
  ]
201
208
  };
@@ -324,9 +331,9 @@ export default {
324
331
  handleAddEvent() {
325
332
  const key = new Date().getTime();
326
333
  const dic = {
327
- key: key,
328
- name: key,
329
- func: ""
334
+ id: key,
335
+ label: key,
336
+ value: ""
330
337
  };
331
338
  this.eventsDialog.eventScript.push(dic);
332
339
  this.eventsDialog.active = dic;
@@ -372,23 +379,8 @@ export default {
372
379
  };
373
380
  </script>
374
381
 
375
- <style lang="less" scoped>
382
+ <style lang="scss" scoped>
376
383
  .widgetConfig {
377
- .remoteApis {
378
- width: 100%;
379
- margin-bottom: 6px;
380
-
381
- /deep/ .el-input--prefix .el-input__inner {
382
- padding-left: 85px;
383
- }
384
-
385
- /deep/ .el-input__prefix {
386
- left: 0;
387
- width: 75px;
388
- color: #999;
389
- }
390
- }
391
-
392
384
  .el-dialog__body {
393
385
  padding: 20px;
394
386
  }
@@ -453,7 +445,7 @@ export default {
453
445
  margin-bottom: 20px;
454
446
  padding-left: 10px;
455
447
 
456
- /deep/ .el-input {
448
+ .el-input {
457
449
  flex: 1;
458
450
  margin-left: 10px;
459
451
  }
@@ -483,16 +475,11 @@ export default {
483
475
  .selectableRange {
484
476
  width: 100%;
485
477
 
486
- /deep/ .el-range-separator {
478
+ .el-range-separator {
487
479
  width: 20px;
488
480
  }
489
481
  }
490
482
 
491
- .functions {
492
- span {
493
- margin: 0 5px;
494
- }
495
- }
496
483
  .flexView {
497
484
  display: flex;
498
485
  align-items: center;