tianheng-ui 0.1.66 → 0.1.68

Sign up to get free protection for your applications and to get access to all the features.
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.66",
4
+ "version": "0.1.68",
5
5
  "author": "shu lang <403732931@qq.com>",
6
6
  "license": "MIT",
7
7
  "private": false,
@@ -181,7 +181,7 @@ export default {
181
181
  hendleElementRemoteData(item) {
182
182
  if (!item.options.remote || !item.options.remote.open) return;
183
183
  if (item.type === "upload" || item.type === "button") return;
184
-
184
+
185
185
  let api = "";
186
186
  if (item.options.remote.api.constructor === String) {
187
187
  api = this.formConfig.config.network[item.options.remote.api];
@@ -259,6 +259,7 @@ export default {
259
259
  const params = {};
260
260
  for (let e of api.inParams) {
261
261
  const value =
262
+ e.defaultValue ||
262
263
  getProperty(this.models, e.pAlias) ||
263
264
  getProperty(this.query, e.pAlias) ||
264
265
  null;
@@ -291,18 +292,18 @@ export default {
291
292
  if (!api) return this.$message.warning("未知的接口,请检查配置信息");
292
293
 
293
294
  let params = {};
294
- const inParams = api.inParams || [];
295
295
  const initParams = list => {
296
296
  list.map(item => {
297
297
  if (item.children) {
298
298
  initParams(item.children);
299
299
  } else {
300
- const value = getProperty(this.models, item.pAlias) || null;
300
+ const value =
301
+ item.defaultValue || getProperty(this.models, item.pAlias) || null;
301
302
  setProperty(params, item.pAlias, value);
302
303
  }
303
304
  });
304
305
  };
305
- initParams(inParams);
306
+ api.inParams && initParams(api.inParams);
306
307
  if (api.needPage) {
307
308
  params.pageNum = params.pageNum || 1;
308
309
  params.pageSize = params.pageNum || 20;
@@ -102,6 +102,7 @@
102
102
  :config="config"
103
103
  :apiOptions="apiOptions"
104
104
  :is="compsData[data.type].content"
105
+ @remote-params="handleFieldsApiChange"
105
106
  ></component>
106
107
 
107
108
  <el-collapse-item
@@ -515,7 +516,7 @@ export default {
515
516
  "config.mounted.api"(val) {
516
517
  this.handleFieldsApiChange(val);
517
518
  },
518
- "data.options.remoteFunc"(val) {
519
+ "data.options.remote.api"(val) {
519
520
  this.handleFieldsApiChange(val);
520
521
  },
521
522
  apiOptions() {
@@ -480,8 +480,10 @@ export default {
480
480
  });
481
481
  } else if (item.type === "table" || item.type === "tableH5") {
482
482
  initList(item.options.columns);
483
- } else if (item.options.remote?.open || item.options.remote?.api) {
484
- fieldsApi[item.model] = item.options.remote.api;
483
+ } else if (item.type === "workflow") {
484
+ initList(item.options.buttons);
485
+ } else if (item.options.remote?.open || item.options.remote?.api) {
486
+ fieldsApi[item.model || item.name] = item.options.remote.api;
485
487
  }
486
488
  }
487
489
  };
@@ -906,7 +906,6 @@ export const businessComponents = [
906
906
  format: "",
907
907
  style: {
908
908
  label: {
909
- width: "",
910
909
  customStyle: ""
911
910
  },
912
911
  value: {
@@ -931,6 +930,7 @@ export const businessComponents = [
931
930
  reverse: false,
932
931
  placement: "right",
933
932
  hideTimestamp: false,
933
+ buttonsSticky: true,
934
934
  remote: {
935
935
  open: false,
936
936
  api: "",
@@ -998,43 +998,44 @@ export const businessComponents = [
998
998
  timestamp: "2023-05-05 14:30"
999
999
  }
1000
1000
  ],
1001
- processInstButtons: [
1002
- {
1003
- name: "通过",
1004
- options: {
1005
- remote: {
1006
- api: ""
1007
- },
1008
- type: "primary",
1009
- icon: "",
1010
- size: "small",
1011
- plain: false,
1012
- round: false,
1013
- circle: false,
1014
- disabled: false,
1015
- loading: false,
1016
- customStyle: ""
1017
- }
1018
- },
1019
- {
1020
- name: "驳回",
1021
- options: {
1022
- remote: {
1023
- api: ""
1024
- },
1025
- type: "primary",
1026
- icon: "",
1027
- size: "small",
1028
- plain: false,
1029
- round: false,
1030
- circle: false,
1031
- disabled: false,
1032
- loading: false,
1033
- customStyle: ""
1034
- }
1035
- }
1036
- ]
1001
+ processInstButtons: null
1037
1002
  },
1003
+ buttons: [
1004
+ {
1005
+ name: "通过",
1006
+ options: {
1007
+ remote: {
1008
+ api: ""
1009
+ },
1010
+ type: "primary",
1011
+ icon: "",
1012
+ size: "small",
1013
+ plain: false,
1014
+ round: false,
1015
+ circle: false,
1016
+ disabled: false,
1017
+ loading: false,
1018
+ customStyle: ""
1019
+ }
1020
+ },
1021
+ {
1022
+ name: "驳回",
1023
+ options: {
1024
+ remote: {
1025
+ api: ""
1026
+ },
1027
+ type: "primary",
1028
+ icon: "",
1029
+ size: "small",
1030
+ plain: false,
1031
+ round: false,
1032
+ circle: false,
1033
+ disabled: false,
1034
+ loading: false,
1035
+ customStyle: ""
1036
+ }
1037
+ }
1038
+ ],
1038
1039
  hideLabel: true
1039
1040
  },
1040
1041
  events: {},
@@ -42,10 +42,10 @@
42
42
 
43
43
  <el-form-item label="数据类型">
44
44
  <el-radio-group
45
- v-model="widget.options.remote"
45
+ v-model="widget.options.remote.open"
46
46
  @input="
47
47
  val => {
48
- if (!val) widget.options.remoteFunc = '';
48
+ if (!val) widget.options.remote.api = '';
49
49
  }
50
50
  "
51
51
  >
@@ -58,7 +58,7 @@
58
58
  <div v-if="widget.options.remote">
59
59
  <el-select
60
60
  style="width:100%"
61
- v-model="widget.options.remoteFunc"
61
+ v-model="widget.options.remote.api"
62
62
  placeholder="请选择"
63
63
  no-data-text="暂无数据,请查阅相关文档说明"
64
64
  clearable
@@ -62,11 +62,11 @@
62
62
 
63
63
  <el-form-item label="上传地址" :required="true">
64
64
  <el-radio-group
65
- v-model="widget.options.remote"
65
+ v-model="widget.options.remote.open"
66
66
  size="mini"
67
67
  @input="
68
68
  val => {
69
- if (!val) widget.options.remoteFunc = '';
69
+ if (!val) widget.options.remote.api = '';
70
70
  }
71
71
  "
72
72
  >
@@ -76,7 +76,7 @@
76
76
  <el-select
77
77
  v-if="widget.options.remote"
78
78
  style="width:100%"
79
- v-model="widget.options.remoteFunc"
79
+ v-model="widget.options.remote.api"
80
80
  placeholder="请选择"
81
81
  no-data-text="暂无数据,请查阅相关文档说明"
82
82
  clearable
@@ -20,6 +20,9 @@
20
20
  <el-form-item label="隐藏时间">
21
21
  <el-switch v-model="widget.options.hideTimestamp"></el-switch>
22
22
  </el-form-item>
23
+ <el-form-item label="操作悬浮">
24
+ <el-switch v-model="widget.options.buttonsSticky"></el-switch>
25
+ </el-form-item>
23
26
 
24
27
  <el-form-item label="节点数据">
25
28
  <el-radio-group
@@ -49,7 +52,7 @@
49
52
  </el-option>
50
53
  </el-select>
51
54
  </el-form-item>
52
- <el-form-item v-if="!widget.options.remote.open" label-width="0">
55
+ <el-form-item v-else label-width="0">
53
56
  <draggable
54
57
  :list="widget.options.defaultValue.processInstTaskRsps"
55
58
  v-bind="{
@@ -98,9 +101,20 @@
98
101
  >
99
102
  </div>
100
103
  </el-form-item>
101
- <el-form-item v-if="!widget.options.remote.open" label-width="0">
104
+
105
+ <el-form-item>
106
+ <el-tooltip
107
+ slot="label"
108
+ effect="light"
109
+ content="流程节点的默认操作,可被远端节点数据的 processInstButtons 配置属性覆盖"
110
+ placement="top"
111
+ >
112
+ <span style="color: #409EFF;">操作按钮</span>
113
+ </el-tooltip>
114
+ </el-form-item>
115
+ <el-form-item label-width="0">
102
116
  <draggable
103
- :list="widget.options.defaultValue.processInstButtons"
117
+ :list="widget.options.buttons"
104
118
  v-bind="{
105
119
  group: { name: 'options' },
106
120
  ghostClass: 'ghost',
@@ -109,8 +123,7 @@
109
123
  handle=".drag"
110
124
  >
111
125
  <div
112
- v-for="(item, index) in widget.options.defaultValue
113
- .processInstButtons"
126
+ v-for="(item, index) in widget.options.buttons"
114
127
  class="draggable-item"
115
128
  :key="index"
116
129
  >
@@ -239,8 +252,7 @@
239
252
  >
240
253
  </div>
241
254
  <div
242
- v-for="(item, index) in widget.options.defaultValue
243
- .processInstButtons"
255
+ v-for="(item, index) in widget.options.buttons"
244
256
  class="list-item th-is_hover"
245
257
  :class="{
246
258
  'th-is_active': dialog.data && dialog.data.name === item.name
@@ -325,16 +337,17 @@
325
337
  <el-select
326
338
  v-model="dialog.data.options.remote.api"
327
339
  style="width:100%"
328
- value-key="id"
329
340
  clearable
330
341
  placeholder=""
342
+ filterable
331
343
  no-data-text="暂无接口,请前往【接口模块】创建"
344
+ @change="handleRemoteApiChange"
332
345
  >
333
346
  <el-option
334
347
  v-for="item in apiOptions"
335
348
  :key="item.id"
336
349
  :label="item.name"
337
- :value="item"
350
+ :value="item.id"
338
351
  >
339
352
  </el-option>
340
353
  </el-select>
@@ -396,9 +409,8 @@ export default {
396
409
  timestamp: "节点时间"
397
410
  });
398
411
  } else {
399
- this.widget.options.defaultValue.processInstButtons.push({
400
- name: `操作${this.widget.options.defaultValue.processInstButtons
401
- .length + 1}`,
412
+ this.widget.options.buttons.push({
413
+ name: `操作${this.widget.options.buttons.length + 1}`,
402
414
  options: {
403
415
  remote: {
404
416
  api: ""
@@ -419,7 +431,7 @@ export default {
419
431
  handleRemoveOption(index, type) {
420
432
  if (type === "processInstTaskRsps")
421
433
  this.widget.options.defaultValue.processInstTaskRsps.splice(index, 1);
422
- else this.widget.options.defaultValue.processInstButtons.splice(index, 1);
434
+ else this.widget.options.buttons.splice(index, 1);
423
435
  },
424
436
  handleRemoteChange(val) {
425
437
  if (val) return;
@@ -429,13 +441,16 @@ export default {
429
441
  const data =
430
442
  action === "processInstTaskRsps"
431
443
  ? this.widget.options.defaultValue.processInstTaskRsps[index]
432
- : this.widget.options.defaultValue.processInstButtons[index];
444
+ : this.widget.options.buttons[index];
433
445
  this.dialog = {
434
446
  show: true,
435
447
  action,
436
448
  data,
437
449
  index
438
450
  };
451
+ },
452
+ handleRemoteApiChange(val) {
453
+ this.$emit("remote-params", val);
439
454
  }
440
455
  }
441
456
  };
@@ -79,7 +79,6 @@ export default {
79
79
  ...row.options.columns[colIndex].list[newIndex],
80
80
  options: {
81
81
  ...row.options.columns[colIndex].list[newIndex].options
82
- // remoteFunc: "func_" + key
83
82
  },
84
83
  key,
85
84
  // 绑定键值
@@ -20,43 +20,8 @@
20
20
 
21
21
  <script>
22
22
  import { itemsComponent, eventMixin } from "../mixins/index";
23
- import * as Axios from "lib/theme-chalk/js/axios";
24
23
  export default {
25
- mixins: [itemsComponent, eventMixin],
26
- data() {
27
- return {
28
- axios: null
29
- };
30
- },
31
- created() {
32
- const oauthConfig = localStorage.getItem("TH_OauthConfig") || "{}";
33
- this.axios = Axios.init(JSON.parse(oauthConfig));
34
- },
35
- methods: {
36
- // hendleRemoteData() {
37
- // const remoteFunc = this.config.network[this.widget.options.remoteFunc];
38
- // console.log(remoteFunc);
39
- // const requestConfig = {
40
- // url: remoteFunc.url,
41
- // method: remoteFunc.method,
42
- // headers: remoteFunc.headers
43
- // };
44
- // let params = { ...remoteFunc.params };
45
- // if (remoteFunc.needPage) {
46
- // params.pageNum = 1;
47
- // params.pageSize = 20;
48
- // }
49
- // if (remoteFunc.method.toLowerCase() === "get") {
50
- // requestConfig.params = params;
51
- // } else {
52
- // params = Object.assign(params, this.models);
53
- // requestConfig.data = params;
54
- // }
55
- // this.axios(requestConfig).then(res => {
56
- // this.$emit("button-submit", requestConfig);
57
- // });
58
- // }
59
- }
24
+ mixins: [itemsComponent, eventMixin]
60
25
  };
61
26
  </script>
62
27
 
@@ -14,14 +14,14 @@
14
14
  >
15
15
  <el-descriptions-item v-for="(item, index) in dataModel" :key="index">
16
16
  <template slot="label">
17
- <div :style="labelStyle(item)">
17
+ <div class="item-label" :style="labelStyle(item)">
18
18
  <i v-if="item.icon" :class="item.icon"></i>
19
19
  <span v-html="item.label"></span>
20
20
  <span v-if="widget.options.colon">:</span>
21
21
  </div>
22
22
  </template>
23
23
  <a v-if="item.type === 'url'" :href="item.value">{{ item.value }}</a>
24
- <span v-else v-html="item.value"></span>
24
+ <span v-else class="item-value" v-html="item.value"></span>
25
25
  </el-descriptions-item>
26
26
  </el-descriptions>
27
27
  </div>
@@ -36,7 +36,7 @@ export default {
36
36
  return item => {
37
37
  let style = {
38
38
  width: this.widget.options.labelWidth,
39
- textAlignLast: this.widget.options.textAlignLast
39
+ "text-align-last": this.widget.options.textAlignLast
40
40
  };
41
41
  if (item.options?.style?.label) {
42
42
  style = Object.assign(style, item.options.style.label);
@@ -70,6 +70,12 @@ export default {
70
70
 
71
71
  <style lang="scss" scoped>
72
72
  .component-descriptions {
73
+ .item-label {
74
+ color: #333;
75
+ }
76
+ .item-value {
77
+ color: #666;
78
+ }
73
79
  .el-descriptions {
74
80
  padding: 0px;
75
81
  }
@@ -3,8 +3,6 @@
3
3
  <el-upload
4
4
  class="upload-demo"
5
5
  :action="uploadUrl"
6
- :headers="widget.options.remote ? widget.options.remoteFunc.headers : {}"
7
- :data="widget.options.remote ? widget.options.remoteFunc.params : {}"
8
6
  :multiple="widget.options.multiple"
9
7
  :limit="widget.options.length"
10
8
  :width="widget.options.size.width"
@@ -66,11 +64,11 @@ export default {
66
64
  },
67
65
  computed: {
68
66
  uploadUrl() {
69
- if (this.widget.options.remote) {
67
+ if (this.widget.options.remote.open) {
70
68
  const info = sessionStorage.getItem("th_oauth_info");
71
69
  let baseUrl = "";
72
70
  if (info) baseUrl = JSON.parse(info).baseUrl;
73
- const func = this.config.network[this.widget.options.remoteFunc];
71
+ const func = this.config.network[this.widget.options.remote.api];
74
72
  if (!func) {
75
73
  this.$message.warning("未知的请求接口,请检查配置信息");
76
74
  return "";
@@ -24,7 +24,7 @@
24
24
  "
25
25
  >
26
26
  <div>
27
- <div class="workflow-item-header">
27
+ <div class="item-header">
28
28
  <div class="title">{{ item.name }}</div>
29
29
  <div
30
30
  v-if="
@@ -54,13 +54,18 @@
54
54
  />
55
55
  </th-cell>
56
56
  </div>
57
- <div class="workflow-item-footer"></div>
58
57
  </div>
59
58
  </el-timeline-item>
60
59
  </el-timeline>
61
- <div v-if="dataModel.processInstButtons.length" class="footer">
60
+ <div
61
+ v-if="dataModel.processInstButtons || widget.options.buttons.length"
62
+ class="footer"
63
+ :class="{ sticky: widget.options.buttonsSticky }"
64
+ >
62
65
  <el-button
63
- v-for="(item, index) in dataModel.processInstButtons"
66
+ v-for="(item, index) in dataModel.processInstButtons
67
+ ? dataModel.processInstButtons
68
+ : widget.options.buttons"
64
69
  :key="index"
65
70
  :style="item.options.customStyle"
66
71
  :type="item.options.type"
@@ -95,7 +100,7 @@ export default {
95
100
  .el-timeline {
96
101
  padding: 0px;
97
102
  }
98
- .workflow-item-header {
103
+ .item-header {
99
104
  margin-bottom: 5px;
100
105
  height: 20px;
101
106
  line-height: 20px;
@@ -117,15 +122,20 @@ export default {
117
122
  height: 24px;
118
123
  }
119
124
  }
120
- .workflow-item-footer {
121
- }
122
125
 
123
126
  .footer {
124
127
  display: flex;
128
+ align-items: center;
129
+ justify-content: space-evenly;
125
130
 
126
131
  .el-button {
127
132
  flex: 1;
128
133
  }
129
134
  }
135
+ .sticky {
136
+ position: sticky;
137
+ bottom: 0;
138
+ z-index: 99;
139
+ }
130
140
  }
131
141
  </style>
@@ -349,9 +349,9 @@ export default {
349
349
  } else if (item.type === "table" || item.type === "tableH5") {
350
350
  initList(item.options.columns);
351
351
  } else if (item.type === "workflow") {
352
- initList(item.options.defaultValue.processInstButtons);
352
+ initList(item.options.buttons);
353
353
  } else if (item.options.remote?.open || item.options.remote?.api) {
354
- fieldsApi[item.model] = item.options.remote.api;
354
+ fieldsApi[item.model || item.name] = item.options.remote.api;
355
355
  }
356
356
  }
357
357
  };
@@ -29,9 +29,9 @@ function findRemoteFunc(list, funcList, tokenFuncList, blankList) {
29
29
  });
30
30
  }
31
31
  } else {
32
- if (list[i].options.remote && list[i].options.remoteFunc) {
32
+ if (list[i].options.remote.open && list[i].options.remote.api) {
33
33
  funcList.push({
34
- func: list[i].options.remoteFunc,
34
+ func: list[i].options.remote.api,
35
35
  label: list[i].name,
36
36
  model: list[i].model
37
37
  });