lw-cdp-ui 1.2.58 → 1.2.61

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.
@@ -71,7 +71,7 @@
71
71
  <!-- checkboxGroup 、select、radio -->
72
72
  <template
73
73
  v-else-if="item.component == 'checkboxGroup' || item.component == 'select' || item.component == 'radio'">
74
- {{ getKeyToLabel(objItem.value, item?.options.items) }}
74
+ {{ getKeyToLabel(objItem.value, item?.options) }}
75
75
  </template>
76
76
 
77
77
  <!-- switch -->
@@ -285,9 +285,12 @@ export default {
285
285
  return item.rules;
286
286
  },
287
287
  // key to label
288
- getKeyToLabel(val, items = []) {
289
- let item = items.find(item => { return item.value == val })
290
- return item?.label || val || '--'
288
+ getKeyToLabel(val, options = {}) {
289
+ if (!options?.multiple) {
290
+ val = [val]
291
+ }
292
+ let items = options.items.filter(item => { return val.includes(item.value) })
293
+ return items?.map(item => item.label).join('、') || val || '--'
291
294
  },
292
295
  dayjs: dayjs
293
296
  }
@@ -0,0 +1,172 @@
1
+ <template>
2
+ <div class="task-item">
3
+ <div class="task-btn"
4
+ @click="openTask">
5
+ <el-icon><el-icon-finished /></el-icon>
6
+ 任务中心
7
+ </div>
8
+
9
+ </div>
10
+ <el-drawer v-model="drawer"
11
+ title="任务中心"
12
+ size="61.8%">
13
+ <div class="task-content">
14
+ <lw-search :options="searchOptions"
15
+ v-model="searchParams"
16
+ :columnNumber="layout.grid"
17
+ :expandNumber="4"
18
+ :labelWidth="layout.labelWidth + 'px'"
19
+ :hideLabel="layout.hideLabel"
20
+ :labelAlign="layout.labelAlign"
21
+ @search="search"
22
+ @reset="reset" />
23
+ <div class="table-block">
24
+ <lw-table :hideTool="false"
25
+ :loading="loading"
26
+ :table-data="tableData"
27
+ :tableColumns="tableHeaders"
28
+ :search-params="searchParams"
29
+ :isShowPagination="true"
30
+ :total-count="totalCount"
31
+ @getTableData="getTableData" />
32
+ </div>
33
+ </div>
34
+ </el-drawer>
35
+ </template>
36
+
37
+ <script>
38
+ import dayjs from 'dayjs'
39
+ import lwTable from '../../lwTable/index.vue'
40
+ import lwSearch from '../../lwSearch/index.vue'
41
+
42
+
43
+ export default {
44
+ components: {
45
+ lwTable,
46
+ lwSearch
47
+ },
48
+ data() {
49
+ return {
50
+ drawer: false,
51
+ searchOptions: [
52
+ {
53
+ label: '类型',
54
+ prop: 'type_like',
55
+ renderType: 'select',
56
+ options: [
57
+ { value: 'Manual', label: '手动执行' },
58
+ { value: 'Timer', label: '定时执行' },
59
+ { value: 'Cycle', label: '周期执行' }
60
+ ],
61
+ valueKey: 'value',
62
+ labelKey: 'label'
63
+ },
64
+ { label: '类型', prop: 'type_like', renderType: 'se' },
65
+ { label: '状态', prop: 'status_like', renderType: 'input' }
66
+ ],
67
+ searchParams: {
68
+ page: 1,
69
+ size: 10
70
+ },
71
+ layout: { grid: 4, labelWidth: '0', hideLabel: true, labelAlign: 'right' },
72
+ tableData: [],
73
+ totalCount: 0,
74
+ tableHeaders: [
75
+ { title: '名称', dataIndex: 'name', minWidth: '120', copy: true, tooltip: true },
76
+ { title: '类型', dataIndex: 'type', minWidth: '120', copy: true, tooltip: true },
77
+ {
78
+ title: '开启时间',
79
+ dataIndex: 'startTime',
80
+ width: '180',
81
+ eleRender: (scope) => `<span>${dayjs(scope.startTime).format('YYYY-MM-DD HH:mm:ss')}</span>`
82
+ },
83
+ {
84
+ title: '结束时间',
85
+ dataIndex: 'executeMode.expireTime',
86
+ width: '180',
87
+ eleRender: (scope) => `<span>${dayjs(scope.executeMode?.expireTime).format('YYYY-MM-DD HH:mm:ss')}</span>`
88
+ },
89
+ {
90
+ title: '执行模式', dataIndex: 'executeMode.type', minWidth: '120',
91
+ eleRender: (scope) => {
92
+ let typeList = {
93
+ Manual: '手动执行',
94
+ Timer: '定时执行',
95
+ Cycle: '周期执行'
96
+ }
97
+ return typeList[scope.executeMode.type]
98
+ }
99
+ },
100
+ {
101
+ title: this.$t('btn.operation'),
102
+ width: '140',
103
+ fixed: 'right',
104
+ ellipsis: true,
105
+ operation: [
106
+ {
107
+ icon: '',
108
+ clickFun: this.del,
109
+ label: this.$t('btn.delete'),
110
+ isShow: () => true
111
+ }
112
+ ]
113
+ }
114
+ ],
115
+ visible: false,
116
+ loading: false
117
+ }
118
+ },
119
+ methods: {
120
+ async getTableData(page = 0) {
121
+ this.loading = true
122
+ let params = {
123
+ page: page,
124
+ size: this.searchParams.size,
125
+ expression: this.$expression(this.searchParams)
126
+ }
127
+ this.searchParams.page = page + 1
128
+
129
+ let code = `${this.$tool.data.get('tenantId')}_${this.$tool.data.get('tenantId')}_${this.$config.APP_NAME.toLowerCase()}`
130
+ let url = `${this.$config.API_URL}/job-manage/${code}/job`
131
+
132
+ await this.$http.get(url, params)
133
+ this.tableData = res.content
134
+ this.currentPage = page
135
+ this.totalCount = res.size
136
+ this.loading = false
137
+ },
138
+ reset() {
139
+ this.searchParams = {}
140
+ this.getTableData()
141
+ },
142
+ search() {
143
+ this.getTableData()
144
+ },
145
+ openTask() {
146
+ this.getTableData()
147
+ this.drawer = true
148
+ }
149
+ }
150
+ }
151
+ </script>
152
+ <style lang="scss" scoped>
153
+ .task-item {
154
+ height: 100%;
155
+ .task-btn {
156
+ display: flex;
157
+ align-items: center;
158
+ gap: 5px;
159
+ height: 100%;
160
+ white-space: nowrap;
161
+ color: var(--el-text-color-regular);
162
+ padding: 0 10px;
163
+ cursor: pointer;
164
+ &:hover {
165
+ background: rgba(0, 0, 0, 0.1);
166
+ }
167
+ }
168
+ }
169
+ .task-content {
170
+ padding: 20px;
171
+ }
172
+ </style>
@@ -1,6 +1,10 @@
1
1
  <template>
2
2
  <div class="user-bar">
3
3
  <slot name="userbarActionBox"></slot>
4
+ <!-- 任务中心 -->
5
+ <task v-if="isShowTask" />
6
+
7
+ <!-- 下拉BU -->
4
8
  <bu v-if="isShowBu"
5
9
  :isInitialized="isInitialized" />
6
10
 
@@ -38,6 +42,7 @@
38
42
 
39
43
  <script>
40
44
  import bu from './bu.vue'
45
+ import task from './task.vue'
41
46
  import empty from '@/assets/images/empty.jpg'
42
47
  export default {
43
48
  props: {
@@ -45,13 +50,18 @@ export default {
45
50
  type: Boolean,
46
51
  default: true
47
52
  },
53
+ isShowTask: {
54
+ type: Boolean,
55
+ default: true
56
+ },
48
57
  isInitialized: {
49
58
  type: Boolean,
50
59
  default: true
51
60
  },
52
61
  },
53
62
  components: {
54
- bu
63
+ bu,
64
+ task
55
65
  },
56
66
  data() {
57
67
  return {
@@ -23,6 +23,7 @@
23
23
  </div>
24
24
  <div class="adminui-header-right">
25
25
  <userbar :isShowBu="isShowBu"
26
+ :isShowTask="isShowTask"
26
27
  :isInitialized="isInitialized">
27
28
  <template #userbarActionBox>
28
29
  <slot name="userbarActionBox"></slot>
@@ -112,6 +113,7 @@
112
113
  <Topbar v-if="!ismobile"></Topbar>
113
114
  </div>
114
115
  <userbar :isShowBu="isShowBu"
116
+ :isShowTask="isShowTask"
115
117
  :isInitialized="isInitialized">
116
118
  <template #userbarActionBox>
117
119
  <slot name="userbarActionBox"></slot>
@@ -163,6 +165,7 @@
163
165
  </div>
164
166
  <Side-m v-if="ismobile"></Side-m>
165
167
  <userbar :isShowBu="isShowBu"
168
+ :isShowTask="isShowTask"
166
169
  :isInitialized="isInitialized">
167
170
  <template #userbarActionBox>
168
171
  <slot name="userbarActionBox"></slot>
@@ -242,6 +245,7 @@
242
245
  <div class="aminui-body el-container">
243
246
  <Topbar>
244
247
  <userbar :isShowBu="isShowBu"
248
+ :isShowTask="isShowTask"
245
249
  :isInitialized="isInitialized">
246
250
  <template #userbarActionBox>
247
251
  <slot name="userbarActionBox"></slot>
@@ -298,6 +302,10 @@ export default {
298
302
  type: Boolean,
299
303
  default: true
300
304
  },
305
+ isShowTask: {
306
+ type: Boolean,
307
+ default: false
308
+ },
301
309
  // 是否要校验初始化
302
310
  isInitialized: {
303
311
  type: Boolean,
@@ -0,0 +1,20 @@
1
+ export default {
2
+ user: {
3
+ settings: 'Settings',
4
+ nightmode: 'Night Mode',
5
+ color: 'Theme Color',
6
+ layout: 'Layout',
7
+ menu: 'Collapse Menu',
8
+ tag: 'Tag Bar',
9
+ lang: 'Internationalization',
10
+ nightmode_msg: 'Suitable for low-light environments; the current dark mode is in beta.',
11
+ language: 'Language',
12
+ language_msg: 'Translation in progress; only the text of this view has been translated.'
13
+ },
14
+ layout: {
15
+ topbar: 'Location',
16
+ userData: 'User Center',
17
+ outLogin: 'Logout',
18
+ clearCache: 'Clear Cache'
19
+ }
20
+ }
@@ -0,0 +1,20 @@
1
+ export default {
2
+ user: {
3
+ settings: '设置',
4
+ nightmode: '黑夜模式',
5
+ color: '主题颜色',
6
+ layout: '框架布局',
7
+ menu: '折叠菜单',
8
+ tag: '标签栏',
9
+ lang: '国际化',
10
+ nightmode_msg: '适合光线较弱的环境,当前黑暗模式为beta版本',
11
+ language: '语言',
12
+ language_msg: '翻译进行中,暂翻译了本视图的文本'
13
+ },
14
+ layout: {
15
+ topbar: '所在位置',
16
+ userData: '个人中心',
17
+ outLogin: '退出登录',
18
+ clearCache: '清除缓存'
19
+ }
20
+ }
@@ -342,6 +342,10 @@ export default {
342
342
  this.islogin = true;
343
343
  // 获取所有bu
344
344
  let bu = await this.$api.auth.bu()
345
+ if (bu.length == 0) {
346
+ this.$message.warning('用户没有应用权限');
347
+ return false
348
+ }
345
349
  this.$tool.data.set('buList', bu)
346
350
  let code = this.$tool.data.get('buCode')
347
351
  let item = bu.find(x => { return x.code == code })
@@ -6,7 +6,7 @@
6
6
 
7
7
  <!-- lwSvgIcon组件,可将svg图标直接当组件使用 -->
8
8
  <script setup>
9
- import { defineProps, computed } from 'vue'
9
+ import { computed } from 'vue'
10
10
  const props = defineProps({
11
11
  name: {
12
12
  type: String,
@@ -13,6 +13,30 @@
13
13
  :col="item" />
14
14
  </el-table-column>
15
15
 
16
+ <!-- 子级展开 -->
17
+ <el-table-column v-else-if="col.expand"
18
+ :prop="col.dataIndex"
19
+ :label="col.title"
20
+ type="expand"
21
+ :width="col.width"
22
+ :min-width="col.minWidth"
23
+ :align="col.align ?? 'center'"
24
+ :fixed="col.fixed"
25
+ :sortable="col.sortable"
26
+ :show-overflow-tooltip="col.tooltip">
27
+ <template #default="scope">
28
+ <!-- 自定义组件 -->
29
+ <template v-if="col.component">
30
+ <slot :name="col.component"
31
+ :scope="scope.row"
32
+ :col="col">
33
+ <el-tag type="danger">[{{ col.component }}]
34
+ 没有这个默认组件也未自定义插槽内容</el-tag>
35
+ </slot>
36
+ </template>
37
+ </template>
38
+ </el-table-column>
39
+
16
40
  <el-table-column v-else
17
41
  :prop="col.dataIndex"
18
42
  :label="col.title"
@@ -138,6 +162,17 @@
138
162
  :preview-teleported="true" />
139
163
  </template>
140
164
 
165
+ <!-- switch -->
166
+ <template v-else-if="col.switch">
167
+ <el-switch v-model="scope.row[col.dataIndex]"
168
+ inline-prompt
169
+ :active-text="col?.activeText || '是'"
170
+ :inactive-text="col?.inactiveText || '否'"
171
+ :active-value="col?.activeValue || true"
172
+ :inactive-value="col?.inactiveValue || false"
173
+ @click="col.callback(scope.row[col.dataIndex], scope.row)"></el-switch>
174
+ </template>
175
+
141
176
  <!-- 选项列 -->
142
177
  <template v-else-if="!col.switch && col.options?.length">
143
178
  <template v-if="scope.row.isEdit && col.canEdit">
@@ -101,13 +101,15 @@
101
101
  <!-- select -->
102
102
  <template v-else-if="item.component=='select'">
103
103
  <el-select v-model="row[item.name]"
104
- :multiple="item.options?.multiple"
105
- :allow-create="item.options?.allowCreate"
104
+ :multiple="item?.options?.multiple"
105
+ :allow-create="item?.options?.allowCreate"
106
106
  default-first-option
107
- :placeholder="item.options?.placeholder || ''"
108
- :clearable="item.options?.clearable"
109
- :disabled="isDisabled(item, row)"
107
+ :placeholder="item?.options?.placeholder || ''"
108
+ :clearable="item?.options?.clearable"
109
+ :collapse-tags="item?.options?.collapseTags"
110
+ :collapse-tags-tooltip="item?.options?.collapseTagsTooltip"
110
111
  filterable
112
+ :disabled="isDisabled(item, row)"
111
113
  :size="config.size || 'small'"
112
114
  style="width: 100%;">
113
115
  <el-option v-for="option in item.options.items"
@@ -295,7 +297,7 @@
295
297
  layout="prev, pager, next"
296
298
  :total="tableData.length" />
297
299
  </div>
298
- <div v-if="!isView"
300
+ <div v-if="!isView && showAddBtn"
299
301
  class="btn-list">
300
302
  <el-button type="primary"
301
303
  class="add-btn"
@@ -320,6 +322,8 @@ export default {
320
322
  isView: { type: Boolean, default: false },
321
323
  // 是否分页
322
324
  isPagination: { type: Boolean, default: false },
325
+ // 是否显示添加
326
+ showAddBtn: { type: Boolean, default: true },
323
327
  },
324
328
  data() {
325
329
  return {
@@ -537,8 +541,8 @@ export default {
537
541
  return
538
542
  }
539
543
  // 如果有子节点,则递归调用
540
- if (data[i][this.config.treeProps.children]) {
541
- this.removeNode(data[i][this.config.treeProps.children], item)
544
+ if (data[i][this.config.treeProps?.children]) {
545
+ this.removeNode(data[i][this.config.treeProps?.children], item)
542
546
  }
543
547
  }
544
548
  },
@@ -74,6 +74,7 @@ export default {
74
74
  disabled: { type: Boolean, default: false },
75
75
  tableWidth: { type: Number, default: 400 },
76
76
  mode: { type: String, default: "popover" },
77
+ valueKey: { type: String, default: "" },
77
78
  // 定义什么参数就返回什么 value label 为 必须字段
78
79
  props: { type: Object, default: () => { } }
79
80
  },
@@ -262,35 +263,38 @@ export default {
262
263
  setTimeout(() => {
263
264
  this.isLock = false
264
265
  }, 1000)
265
- this.$emit('update:modelValue', this.defaultValue);
266
- this.$emit('change', this.defaultValue);
266
+ this.$emit('update:modelValue', { ...this.modelValue, ...this.defaultValue });
267
+ this.$emit('change', { ...this.modelValue, ...this.defaultValue });
267
268
  },
268
269
  // 初始化回显
269
270
  initValue(val = this.modelValue) {
270
- if (val && !this.isLock) {
271
- this.defaultProps = Object.assign(this.defaultProps, this.props);
272
- // 自动判断类型回显
273
- let list = []
274
- if (typeof val === 'string') {
275
- list.push(val)
276
- } else if (Array.isArray(val)) {
277
- val.forEach(item => {
278
- console.log(item)
279
- if (typeof item === 'string' && item) {
280
- list.push(item)
281
- } else if (typeof item === 'object' && item) {
282
- list.push(item[this.defaultProps.value])
283
- }
284
- })
285
- } else if (typeof val === 'object') {
286
- list.push(val[this.defaultProps.value])
287
- }
271
+ if (!val || this.isLock) return; // 直接返回,避免执行无意义的逻辑
288
272
 
289
- this.listIds = list
290
- this.idExpression = this.$expression({ [`${this.defaultProps.value}_in`]: list })
273
+ this.defaultProps = { ...this.defaultProps, ...this.props }; // 使用展开运算符简化 Object.assign
291
274
 
292
- this.getData(10000)
275
+ let list = [];
276
+
277
+ if (typeof val === 'string' && val.trim()) {
278
+ list.push(val);
279
+ } else if (Array.isArray(val)) {
280
+ list = val
281
+ .map(item => {
282
+ if (typeof item === 'string' && item.trim()) return item;
283
+ if (typeof item === 'object' && item) return item[this.valueKey || this.defaultProps.value];
284
+ return null;
285
+ })
286
+ .filter(Boolean); // 过滤掉 null、undefined、空字符串
287
+ } else if (typeof val === 'object' && val) {
288
+ const value = val[this.valueKey || this.defaultProps.value];
289
+ if (value) list.push(value);
293
290
  }
291
+
292
+ if (!list.length) return; // 如果最终 list 为空,则不进行后续操作
293
+
294
+ this.listIds = list;
295
+ this.idExpression = this.$expression({ [`${this.defaultProps.value}_in`]: list });
296
+
297
+ this.getData(10000);
294
298
  },
295
299
  // 关键值查询表格数据行
296
300
  findRowByKey(value) {