@ebiz/designer-components 0.1.112 → 0.1.114

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,6 +1,6 @@
1
1
  {
2
2
  "name": "@ebiz/designer-components",
3
- "version": "0.1.112",
3
+ "version": "0.1.114",
4
4
  "private": false,
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -1,7 +1,15 @@
1
1
  <template>
2
2
  <div class='ebiz-approval-container'>
3
3
  <div class='detail-container'>
4
- <div class="title">{{ approvalDetail.variables?.startUserName + '的' + approvalDetail.processDefinitionName }}</div>
4
+ <div class="title">{{ approvalDetail.variables?.startUserName + '的' + approvalDetail.processDefinitionName }}
5
+ <ebiz-tag
6
+ variant="light"
7
+ size="medium"
8
+ class="component-base-style"
9
+ :theme="themeMap[approvalDetail?.state]"
10
+ :content="approvalDetail.stateDesc || '-'"
11
+ ></ebiz-tag>
12
+ </div>
5
13
  <!-- 区块详情 -->
6
14
  <div class="block-detail">
7
15
  <slot name="block"></slot>
@@ -20,7 +28,7 @@
20
28
  <script lang='ts' setup>
21
29
 
22
30
  import { ref, onMounted } from 'vue';
23
- import { dataService, EbizSApprovalProcess, EbizApprovalForm } from '../index'
31
+ import { dataService, EbizSApprovalProcess, EbizApprovalForm, EbizTag } from '../index'
24
32
  import { MessagePlugin as message, LoadingPlugin as loading } from 'tdesign-vue-next'
25
33
 
26
34
  const props = defineProps({
@@ -54,6 +62,15 @@ const isAssignee = ref(false)
54
62
  // 加载状态
55
63
  const isLoading = ref(false)
56
64
 
65
+ const themeMap = {
66
+ CANCELED: 'default',
67
+ REJECTED: 'danger',
68
+ APPROVED: 'success',
69
+ ACTIVE: 'primary',
70
+ COMPLETED: 'success',
71
+ SUSPENDED: 'warning'
72
+ }
73
+
57
74
  // 获取审批详情
58
75
  const getApprovalDetail = () => {
59
76
  loading(true)
@@ -125,7 +142,7 @@ defineExpose({
125
142
  position: absolute;
126
143
  top: 0;
127
144
  left: 0;
128
- padding: 24px 12px;
145
+ padding: 4px 12px;
129
146
  color: #000000;
130
147
  font-size: 18px;
131
148
  font-weight: 600;
@@ -135,7 +152,7 @@ defineExpose({
135
152
  position: relative;
136
153
  display: flex;
137
154
  width: 900px;
138
- padding: 60px 12px;
155
+ padding: 30px 12px;
139
156
  background-color: #ffffff;
140
157
  border-radius: 4px;
141
158
  box-sizing: border-box;
@@ -35,7 +35,7 @@
35
35
  <t-icon name="check" size="large" class="component-base-style"></t-icon>
36
36
  </template>
37
37
  </t-button>
38
- <t-button content="拒绝" the type="reset" style="margin-left: 10px" @click="handleReject">
38
+ <t-button theme="danger" content="拒绝" the type="reset" style="margin-left: 10px" @click="handleReject">
39
39
  <template #icon>
40
40
  <t-icon name="close" size="large" class="component-base-style"></t-icon>
41
41
  </template>
@@ -0,0 +1,127 @@
1
+ <template>
2
+ <div color="#999">
3
+ <div class="card">
4
+ <div class="header">
5
+ <ebiz-tag size="medium" variant="dark" class="component-base-style" :content="{
6
+ REJECTED: '已驳回',
7
+ APPROVED: '已通过',
8
+ ACTIVE: '进行中',
9
+ CANCELED: '已取消'
10
+ }[status] || '未知状态'
11
+ " :theme="{
12
+ REJECTED: 'danger',
13
+ APPROVED: 'success',
14
+ ACTIVE: 'primary',
15
+ CANCELED: 'default'
16
+ }[status] || 'default'
17
+ "></ebiz-tag>
18
+ <span style="display: inline-block; font-size: 14px">{{ typeDesc || '未知' }}</span>
19
+ <span style="display: inline-block; font-size: 14px; color: #666; margin-left: auto"
20
+ class="component-base-style">{{ utils.calcTime(date, 'y/M/d') }}</span>
21
+ </div>
22
+ <div v-if="fields.length">
23
+ <div class="body">
24
+ <div v-for="(item, index) in fields.sort((a, b) => a.sort - b.sort)" class="component-base-style"
25
+ :key="index">
26
+ <span style="display: inline-block" class="label">{{ item.label + ':' }}</span>
27
+ <span v-if="item.value_type == 'text' || item.value_type == 'textarea'" style="display: inline-block"
28
+ class="value">{{ item.actual_value }}</span>
29
+ <ebiz-file-list v-if="item.value_type == 'files' || item.value_type == 'images'" displayMode="grid"
30
+ :showActions="true" :showFileSize="true" size="mini" class="component-base-style"
31
+ :files="item.actual_value || []"></ebiz-file-list>
32
+ </div>
33
+ </div>
34
+ </div>
35
+ <div v-if="!fields.length" style="
36
+ display: flex;
37
+ align-items: center;
38
+ justify-content: center;
39
+ gap: 15px;
40
+ height: 100px;
41
+ flex-direction: column;
42
+ " class="component-base-style">
43
+ <ebiz-tdesign-icon name="data-error" size="large" color="#999" style="font-size: 40px"
44
+ class="component-base-style"></ebiz-tdesign-icon>
45
+ <span style="display: inline-block; color: #999" class="component-base-style">字段未配置</span>
46
+ </div>
47
+ <div v-if="btns?.length" class="footer">
48
+ <ebiz-tdesign-button v-for="(item, index) in btns ?? []" size="medium" :content="item.label"
49
+ :theme="item.theme || 'primary'" :disabled="item.disabled" :key="index" :class="item.hidden ? 'hidden' : ''"
50
+ @click="(...eventArgs) => btnClick(eventArgs, index, item)"></ebiz-tdesign-button>
51
+ </div>
52
+ </div>
53
+ </div>
54
+ </template>
55
+
56
+ <script setup>
57
+ import { EbizTag, EbizTdesignIcon, EbizTdesignButton, EbizFileList } from ''
58
+ import * as vue from 'vue'
59
+ import { defineProps, defineEmits } from 'vue'
60
+ import { I18nInjectionKey } from 'vue-i18n'
61
+
62
+ const props = defineProps({
63
+ status: { type: String, default: '' },
64
+ type: { type: String, default: '' },
65
+ typeDesc: { type: String, default: '' },
66
+ date: { type: String, default: '' },
67
+ fields: { type: Array, default: () => [] },
68
+ btns: { type: Array, default: () => [] },
69
+ mode: { type: String, default: 'ing' },
70
+ item: { type: Object, default: () => ({}) }
71
+ })
72
+
73
+ const emit = defineEmits(['btn-click'])
74
+ const { t, lowcodeWrap, stores } = vue.inject(I18nInjectionKey).lowcode()
75
+ const wrap = lowcodeWrap(props, { emit })
76
+ wrap({ stores })
77
+
78
+ const { utils } = wrap(function () {
79
+ return this
80
+ })()
81
+ const state = vue.reactive({})
82
+ wrap({ state })
83
+
84
+ const btnClick = wrap(function btnClick(event, args0, args1) {
85
+ this.emit('btnClick', args0, args1)
86
+ })
87
+
88
+ wrap({ btnClick })
89
+ </script>
90
+ <style scoped>
91
+ .card {
92
+ padding: 12px;
93
+ border-radius: 15px;
94
+ box-shadow: 0 1px 10px rgba(0, 0, 0, 0.05), 0 4px 5px rgba(0, 0, 0, 0.08), 0 2px 4px -1px rgba(0, 0, 0, 0.12);
95
+ }
96
+
97
+ .header {
98
+ display: flex;
99
+ align-items: center;
100
+ gap: 10px;
101
+ margin-bottom: 10px;
102
+ }
103
+
104
+ .body {}
105
+
106
+ .label {
107
+ color: #666;
108
+ min-width: 100px;
109
+ font-size: 14px;
110
+ }
111
+
112
+ .value {
113
+ color: #666;
114
+ font-size: 14px;
115
+ }
116
+
117
+ .footer {
118
+ margin-top: 10px;
119
+ display: flex;
120
+ justify-content: flex-end;
121
+ gap: 10px;
122
+ }
123
+
124
+ .hidden {
125
+ display: none !important;
126
+ }
127
+ </style>
@@ -240,7 +240,8 @@ const emit = defineEmits([
240
240
  'error',
241
241
  'cancel',
242
242
  'detail-loaded',
243
- 'detail-error'
243
+ 'detail-error',
244
+ 'update:data'
244
245
  ]);
245
246
 
246
247
  const formRef = ref(null);
@@ -252,21 +253,20 @@ const localFormData = ref(props.data || {});
252
253
  // 合并rules并监听变化
253
254
  const formRules = computed(() => props.rules);
254
255
 
255
- // 监听props的data变化,同步到localFormData
256
- watch(() => props.data, (newData) => {
257
- // 如果外部传入的数据变化,同步更新本地数据
258
- if (newData && typeof newData === 'object') {
259
- // 清空现有数据
260
- Object.keys(localFormData.value).forEach(key => {
261
- delete localFormData.value[key];
262
- });
263
256
 
264
- // 写入新数据
265
- Object.keys(newData).forEach(key => {
266
- localFormData.value[key] = newData[key];
267
- });
268
- }
269
- }, { deep: true });
257
+ // 监听props的data变化,同步到localFormData
258
+ watch(() => props.data, (newFormData) => {
259
+ if (newFormData) {
260
+ // 合并新的表单数据到本地数据
261
+ Object.keys(newFormData).forEach(key => {
262
+ localFormData.value[key] = newFormData[key]
263
+ })
264
+ }
265
+ }, { deep: true })
266
+
267
+ watch(localFormData, (newValue) => {
268
+ emit('update:data', { ...newValue })
269
+ }, { deep: true })
270
270
 
271
271
  /**
272
272
  * 获取错误消息
@@ -73,6 +73,18 @@
73
73
  :clearable="clearable" :format="timeFormat || 'HH:mm:ss'" @change="handleChange" />
74
74
  </template>
75
75
 
76
+ <!-- 范围日期选择器 -->
77
+ <template v-else-if="type === 'date-range'">
78
+ <t-date-range-picker v-model="computedModelValue" :placeholder="placeholder || '请选择日期范围'" :disabled="disabled"
79
+ :clearable="clearable" :format="dateFormat || 'YYYY-MM-DD'" :mode="dateMode || 'date'" @change="handleChange" />
80
+ </template>
81
+
82
+ <!-- 范围日期时间选择器 -->
83
+ <template v-else-if="type === 'datetime-range'">
84
+ <t-date-range-picker v-model="computedModelValue" :placeholder="placeholder || '请选择日期时间范围'" :disabled="disabled"
85
+ :clearable="clearable" format="YYYY-MM-DD HH:mm:ss" :mode="dateMode || 'date'" enable-time-picker @change="handleChange" />
86
+ </template>
87
+
76
88
  <!-- 单选框组 -->
77
89
  <template v-else-if="type === 'radio'">
78
90
  <t-radio-group v-model="computedModelValue" :disabled="disabled" :options="options"
@@ -305,7 +317,8 @@ import {
305
317
  ColorPicker as TColorPicker,
306
318
  Table as TTable,
307
319
  Button as TButton,
308
- Space as TSpace
320
+ Space as TSpace,
321
+ DateRangePicker as TDateRangePicker
309
322
  } from 'tdesign-vue-next';
310
323
  import EbizRemoteSelect from '../../EbizRemoteSelect.vue';
311
324
  import EbizEmployeeSelector from '../../EbizEmployeeSelector.vue';