lw-cdp-ui 1.2.29 → 1.2.31

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.
@@ -157,22 +157,22 @@ export default class Dagre {
157
157
  // 根据源节点和目标节点的位置计算路径点
158
158
  if (newSourceNodeData.x < newTargetNodeData.x) {
159
159
  pointsList.push({
160
- x: newSourceNodeData.x + sourceNodeModel.width / 2 + 5,
161
- y: newSourceNodeData.y + 5
162
- })
160
+ x: newSourceNodeData.x + sourceNodeModel.width / 2,
161
+ y: newSourceNodeData.y,
162
+ });
163
163
  pointsList.push({
164
164
  x: newSourceNodeData.x + sourceNodeModel.width / 2 + (model.offset || 50),
165
- y: newSourceNodeData.y + 5
166
- })
165
+ y: newSourceNodeData.y,
166
+ });
167
167
  pointsList.push({
168
168
  x: newSourceNodeData.x + sourceNodeModel.width / 2 + (model.offset || 50),
169
- y: newTargetNodeData.y + 5
170
- })
169
+ y: newTargetNodeData.y,
170
+ });
171
171
  pointsList.push({
172
- x: newTargetNodeData.x - targetNodeModel.width / 2 + 5,
173
- y: newTargetNodeData.y + 5
174
- })
175
- return this.pointFilter(pointsList)
172
+ x: newTargetNodeData.x - targetNodeModel.width / 2,
173
+ y: newTargetNodeData.y,
174
+ });
175
+ return this.pointFilter(pointsList);
176
176
  }
177
177
  if (newSourceNodeData.x > newTargetNodeData.x) {
178
178
  if (newSourceNodeData.y >= newTargetNodeData.y) {
@@ -283,7 +283,7 @@ export default {
283
283
  })
284
284
  this.initMenu()
285
285
  await this.initNode()
286
- if (this.modelValue && this.modelValue?.nodes.length > 0) {
286
+ if (this.modelValue && this.modelValue?.nodes?.length > 0) {
287
287
  this.logicFlow.render(this.modelValue)
288
288
  } else {
289
289
  // 根据节点数据初始化节点
@@ -2,25 +2,24 @@
2
2
  <draggable :list="formItems"
3
3
  item-key="name"
4
4
  group="people"
5
- :disabled="!hideBorder"
5
+ :disabled="hideBorder"
6
6
  class="draggable-item"
7
7
  ghost-class="draggable-ghost"
8
- :class="{ showBorder: hideBorder, cur: curIndex == (formItems.name || formItems?.options?.items[0]?.name) }">
8
+ :class="{ showBorder: !hideBorder, cur: curIndex == (`${this.uuid}${formItems.name || formItems?.options?.items[0]?.name}`) }">
9
9
  <template #item="{element: item, index}">
10
10
  <el-col :span="['list'].includes(item.component) ? 24 : item.span || 24"
11
- :class="{ borderItem: hideBorder, cur: hideBorder && curIndex == (item.name || item?.options?.items[0]?.name) }"
11
+ :class="{ borderItem: !hideBorder, cur: !hideBorder && curIndex == (`${this.uuid}${item.name || item?.options?.items[0]?.name}`) }"
12
12
  v-if="!hideHandle(item)"
13
- @click.capture="changeClick(item)">
13
+ @click.stop="changeClick(item)">
14
14
  <!-- 组合 -->
15
15
  <template v-if="['object'].includes(item.component)">
16
- <el-form-item :label="item.label"
17
- @click.capture="changeClick(item)">
16
+ <el-form-item :label="item.label">
18
17
  <JsonItem :formItems="item.value"
19
18
  :form="form[item.name]"
20
19
  class="object-item"
21
20
  :custom="custom"
22
21
  :hideBorder="hideBorder"
23
- @curClick="changeClick">
22
+ @curClick="emitClick">
24
23
  <template v-for="c in custom"
25
24
  v-slot:[c.component]="{ itemCur, formCur }">
26
25
  <slot :name="c.component"
@@ -33,10 +32,10 @@
33
32
  </template>
34
33
  <!-- 列表 显示时 -->
35
34
  <template v-else-if="['list'].includes(item.component)">
36
- <el-form-item @click.capture="changeClick(item)">
35
+ <el-form-item>
37
36
  <template #label>
38
37
  {{ item.label }}
39
- <el-button v-if="!hideBorder"
38
+ <el-button v-if="hideBorder"
40
39
  type="primary"
41
40
  class="add-btn"
42
41
  plain
@@ -47,13 +46,13 @@
47
46
  <el-col :span="item.span || 24"
48
47
  v-for="(x, xIndex) in item.value">
49
48
  <div class="list-item"
50
- :class="{borderItem: hideBorder}">
49
+ :class="{borderItem: !hideBorder}">
51
50
  <JsonItem v-if="form[item.name]"
52
51
  :formItems="x"
53
52
  :custom="custom"
54
53
  :form="form[item.name][xIndex]"
55
54
  :hideBorder="hideBorder"
56
- @curClick="changeClick">
55
+ @curClick="emitClick">
57
56
  <template v-for="c in custom"
58
57
  v-slot:[c.component]="{ itemCur, formCur }">
59
58
  <slot :name="c.component"
@@ -63,7 +62,7 @@
63
62
  </JsonItem>
64
63
  <el-icon class="remove-btn"
65
64
  size="14"
66
- v-if="!hideBorder && item.value.length > 1"
65
+ v-if="hideBorder && item.value.length > 1"
67
66
  @click="deleteListItem(item.value, xIndex)"><el-icon-delete /></el-icon>
68
67
  </div>
69
68
 
@@ -83,9 +82,8 @@
83
82
  :formCur="form"></slot>
84
83
  </template>
85
84
  </FormItem>
86
-
87
85
  <!-- 工具 -->
88
- <div v-if="hideBorder && curIndex == (item.name || item?.options?.items[0]?.name)"
86
+ <div v-if="!hideBorder && curIndex == (`${this.uuid}${item.name || item?.options?.items[0]?.name}`)"
89
87
  class="tool-list">
90
88
  <el-icon class="btn"
91
89
  size="14"
@@ -107,6 +105,11 @@ import FormItem from '../lwFormMini/FormItem'
107
105
  import draggable from 'vuedraggable'
108
106
  export default {
109
107
  name: 'JsonItem',
108
+ data() {
109
+ return {
110
+ uuid: this.$tool.getUUID('', 12)
111
+ }
112
+ },
110
113
  components: {
111
114
  FormItem,
112
115
  draggable
@@ -121,7 +124,7 @@ export default {
121
124
  default: () => { }
122
125
  },
123
126
  // 是否是显示边界
124
- hideBorder: { type: Boolean, default: true },
127
+ hideBorder: { type: Boolean, default: false },
125
128
  // 自定义组件
126
129
  custom: { type: Array, default: () => [] },
127
130
  },
@@ -143,7 +146,10 @@ export default {
143
146
  return false
144
147
  },
145
148
  changeClick(item) {
146
- this.$store.state.curIndex = item.name || item?.options.items[0]?.name
149
+ this.$store.state.curIndex = `${this.uuid}${item.name || item?.options.items[0]?.name}`
150
+ this.emitClick(item)
151
+ },
152
+ emitClick(item) {
147
153
  this.$emit('curClick', item)
148
154
  },
149
155
  // 列表删除
@@ -1,6 +1,6 @@
1
1
  <template>
2
2
  <el-container :style="{ maxHeight }">
3
- <el-aside v-if="hideTool"
3
+ <el-aside v-if="!hideModule"
4
4
  width="200px"
5
5
  class="form-json-body">
6
6
  <div class="menu-list">
@@ -56,7 +56,7 @@
56
56
  </el-main>
57
57
  </el-container>
58
58
 
59
- <el-aside v-if="hideTool"
59
+ <el-aside v-if="!hideConfig"
60
60
  width="300px"
61
61
  class="aside-right">
62
62
  <StatsConfig :item="curItem"
@@ -115,14 +115,17 @@ export default {
115
115
  maxHeight: { type: String, default: 'calc(100vh - 137px)' },
116
116
  // 自定义组件
117
117
  custom: { type: Array, default: () => [] },
118
+ customTitle: { type: String, default: '自定义组件' },
118
119
  // 是否显示加载中
119
120
  loading: { type: Boolean, default: false },
120
- // 隐藏工具
121
+ // 隐藏工具、组件、属性
121
122
  hideTool: { type: Boolean, default: true },
123
+ hideModule: { type: Boolean, default: false },
124
+ hideConfig: { type: Boolean, default: false },
122
125
  // 是否是查看模式
123
126
  isView: { type: Boolean, default: false },
124
127
  // 隐藏边界
125
- hideBorder: { type: Boolean, default: true },
128
+ hideBorder: { type: Boolean, default: false },
126
129
  // 隐藏默认组件
127
130
  hideDefault: { type: Boolean, default: false }
128
131
  },
@@ -161,10 +164,9 @@ export default {
161
164
 
162
165
  // 如果有自定义组件
163
166
  if (val.length) {
164
- const CUSTOM_TITLE = '自定义组件';
165
167
 
166
168
  // 查找现有的自定义组件菜单
167
- const existingCustomMenu = this.menuList.find(item => item.title === CUSTOM_TITLE);
169
+ const existingCustomMenu = this.menuList.find(item => item.title === this.customTitle);
168
170
 
169
171
  if (existingCustomMenu) {
170
172
  // 更新现有的自定义组件列表
@@ -172,7 +174,7 @@ export default {
172
174
  } else {
173
175
  // 添加新的自定义组件菜单
174
176
  this.menuList.push({
175
- title: CUSTOM_TITLE,
177
+ title: this.customTitle,
176
178
  list: val
177
179
  });
178
180
  }
@@ -101,7 +101,12 @@
101
101
  </template>
102
102
  <!-- date -->
103
103
  <template v-else-if="item.component == 'date'">
104
- {{ dayjs(objItem.value).format(item?.options?.valueFormat || 'YYYY-MM-DD HH:mm:ss') }}
104
+ <template v-if="typeof objItem.value == 'string'">
105
+ {{ dayjs(objItem.value).format(item?.options?.valueFormat || 'YYYY-MM-DD HH:mm:ss') }}
106
+ </template>
107
+ <template v-if="typeof objItem.value == 'object'">
108
+ {{ objItem.value.length > 0 ? dayjs(objItem.value[0]).format(item?.options?.valueFormat || 'YYYY-MM-DD HH:mm:ss') + ' - ' + dayjs(objItem.value[1]).format(item?.options?.valueFormat || 'YYYY-MM-DD HH:mm:ss') : '--' }}
109
+ </template>
105
110
  </template>
106
111
  <!-- number -->
107
112
  <template v-else-if="item.component == 'number'">