vue2-client 1.14.94 → 1.14.97

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 (145) hide show
  1. package/docs/Logic/345/207/275/346/225/260/344/275/277/347/224/250/347/233/270/345/205/263.md +0 -1
  2. package/docs//345/207/275/346/225/260/344/275/277/347/224/250/347/233/270/345/205/263.md +2 -4
  3. package/package.json +1 -1
  4. package/src/base-client/components/common/XFormTable/XFormTable.vue +6 -0
  5. package/src/base-client/components/common/XTab/XTab.vue +40 -8
  6. package/src/base-client/components/common/XTable/XTable.vue +30 -23
  7. package/src/base-client/components/common/XTable/XTableWrapper.vue +13 -6
  8. package/src/base-client/components/common/XUploadFilesView/index.vue +485 -485
  9. package/src/base-client/components/his/XList/XList.vue +35 -35
  10. package/src/base-client/components/his/XQuestionnaire/XQuestionnaire.json +0 -34
  11. package/src/base-client/components/his/XQuestionnaire/XQuestionnaire.vue +51 -23
  12. package/src/base-client/components/his/XQuestionnaire/XQuestionnaireDemo.vue +19 -2
  13. package/src/base-client/components/his/XQuestionnaire/XQuestionnaireItem.vue +39 -56
  14. package/src/base-client/components/his/XShiftSchedule/XShiftSchedule.vue +1 -1
  15. package/src/base-client/components/his/XTextCard/XTextCard.vue +207 -207
  16. package/src/base-client/components/his/XTreeRows/TreeNode.vue +100 -100
  17. package/src/base-client/components/his/XTreeRows/XTreeRows.vue +197 -197
  18. package/src/base-client/components/his/threeTestOrders/editor.vue +111 -111
  19. package/src/base-client/components/layout/XPageView/RenderRow.vue +88 -90
  20. package/src/base-client/components/layout/XPageView/XPageRowTemplate.vue +37 -0
  21. package/src/base-client/components/layout/XPageView/XPageView.vue +223 -222
  22. package/src/base-client/components/layout/XPageView/XTab/XTab.vue +96 -0
  23. package/src/base-client/components/layout/XPageView/XTab/index.js +3 -0
  24. package/src/base-client/components/layout/XPageView/componentTypes.js +22 -0
  25. package/src/base-client/components/layout/XPageView/index.js +1 -0
  26. package/src/base-client/components/layout/XPageView/index.md +19 -0
  27. package/src/pages/WorkflowDetail/WorkflowPageDetail/LeaveMessage.vue +388 -388
  28. package/src/pages/WorkflowDetail/WorkflowPageDetail/WorkFlowHandle.vue +10 -4
  29. package/src/pages/WorkflowDetail/WorkflowPageDetail/WorkFlowTimeline.vue +1 -1
  30. package/src/pages/XPageViewExample/index.vue +149 -71
  31. package/.history/public/his/editor/editor_20250606134713.html +0 -51
  32. package/.history/src/base-client/components/common/AddressSearchCombobox/AddressSearchCombobox_20250527173925.vue +0 -509
  33. package/.history/src/base-client/components/common/AddressSearchCombobox/AddressSearchCombobox_20250527174316.vue +0 -524
  34. package/.history/src/base-client/components/common/AddressSearchCombobox/AddressSearchCombobox_20250527174419.vue +0 -524
  35. package/.history/src/base-client/components/common/AddressSearchCombobox/AddressSearchCombobox_20250527174422.vue +0 -524
  36. package/.history/src/base-client/components/common/XAddReport/XAddReport_20250611172825.vue +0 -207
  37. package/.history/src/base-client/components/common/XAddReport/XAddReport_20250611172945.vue +0 -211
  38. package/.history/src/base-client/components/common/XAddReport/XAddReport_20250611172949.vue +0 -212
  39. package/.history/src/base-client/components/common/XAddReport/XAddReport_20250611173010.vue +0 -212
  40. package/.history/src/base-client/components/common/XForm/XFormItem_20250508134122.vue +0 -1320
  41. package/.history/src/base-client/components/common/XForm/XFormItem_20250527171604.vue +0 -1332
  42. package/.history/src/base-client/components/common/XForm/XFormItem_20250527171613.vue +0 -1331
  43. package/.history/src/base-client/components/common/XForm/XFormItem_20250527171703.vue +0 -1331
  44. package/.history/src/base-client/components/common/XForm/XFormItem_20250527171720.vue +0 -1331
  45. package/.history/src/base-client/components/common/XForm/XFormItem_20250527174327.vue +0 -1339
  46. package/.history/src/base-client/components/common/XReportGrid/XReportTrGroup_20250612092804.vue +0 -731
  47. package/.history/src/base-client/components/common/XReportGrid/XReportTrGroup_20250612112546.vue +0 -748
  48. package/.history/src/base-client/components/common/XReportGrid/XReportTrGroup_20250612113808.vue +0 -748
  49. package/.history/src/base-client/components/common/XReportGrid/XReport_20250612115237.vue +0 -1071
  50. package/.history/src/base-client/components/common/XReportGrid/XReport_20250612115346.vue +0 -1078
  51. package/.history/src/base-client/components/common/XReportGrid/XReport_20250612115350.vue +0 -1077
  52. package/.history/src/base-client/components/common/XReportGrid/XReport_20250612115415.vue +0 -1077
  53. package/.history/src/base-client/components/common/XReportGrid/XReport_20250612115429.vue +0 -1077
  54. package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611091619.vue +0 -442
  55. package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611092547.vue +0 -442
  56. package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611092552.vue +0 -442
  57. package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611092744.vue +0 -475
  58. package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611092955.vue +0 -475
  59. package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611092957.vue +0 -475
  60. package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611095652.vue +0 -477
  61. package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611095701.vue +0 -477
  62. package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611095704.vue +0 -477
  63. package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611100005.vue +0 -473
  64. package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611100011.vue +0 -473
  65. package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611100014.vue +0 -473
  66. package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611100833.vue +0 -473
  67. package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611100853.vue +0 -473
  68. package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611100940.vue +0 -473
  69. package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611101011.vue +0 -473
  70. package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611101013.vue +0 -473
  71. package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611101014.vue +0 -473
  72. package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611101159.vue +0 -473
  73. package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611101238.vue +0 -474
  74. package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611101240.vue +0 -474
  75. package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611101242.vue +0 -474
  76. package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611101404.vue +0 -472
  77. package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611101410.vue +0 -472
  78. package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611101459.vue +0 -472
  79. package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611101500.vue +0 -472
  80. package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611101502.vue +0 -472
  81. package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611101504.vue +0 -472
  82. package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611101610.vue +0 -501
  83. package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611101700.vue +0 -501
  84. package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611101702.vue +0 -501
  85. package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611101741.vue +0 -504
  86. package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611101749.vue +0 -504
  87. package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611101759.vue +0 -504
  88. package/.history/src/base-client/components/his/XHisEditor/dome_20250611091349.vue +0 -131
  89. package/.history/src/base-client/components/his/XHisEditor/dome_20250611105854.vue +0 -160
  90. package/.history/src/base-client/components/his/XHisEditor/dome_20250611105902.vue +0 -160
  91. package/.history/src/base-client/components/his/XHisEditor/dome_20250611105924.vue +0 -160
  92. package/.history/src/base-client/components/his/XHisEditor/dome_20250611105932.vue +0 -158
  93. package/.history/src/base-client/components/his/XList/XList_20250609135848.vue +0 -173
  94. package/.history/src/base-client/components/his/XList/XList_20250609141026.vue +0 -222
  95. package/.history/src/base-client/components/his/XList/XList_20250609141035.vue +0 -229
  96. package/.history/src/base-client/components/his/XList/XList_20250609141103.vue +0 -229
  97. package/.history/src/base-client/components/his/XList/XList_20250609141105.vue +0 -229
  98. package/.history/src/base-client/components/his/XList/XList_20250609141334.vue +0 -241
  99. package/.history/src/base-client/components/his/XList/XList_20250609141404.vue +0 -241
  100. package/.history/src/base-client/components/his/XList/XList_20250609141406.vue +0 -241
  101. package/.history/src/base-client/components/his/XList/XList_20250609141801.vue +0 -245
  102. package/.history/src/base-client/components/his/XList/XList_20250609142033.vue +0 -245
  103. package/.history/src/base-client/components/his/XList/XList_20250609142038.vue +0 -245
  104. package/.history/src/base-client/components/his/XList/XList_20250609142435.vue +0 -255
  105. package/.history/src/base-client/components/his/XList/XList_20250609142503.vue +0 -255
  106. package/.history/src/base-client/components/his/XList/XList_20250609142504.vue +0 -255
  107. package/.history/src/base-client/components/his/XList/XList_20250609143012.vue +0 -270
  108. package/.history/src/base-client/components/his/XList/XList_20250609143044.vue +0 -270
  109. package/.history/src/base-client/components/his/XList/XList_20250609143046.vue +0 -270
  110. package/.history/src/base-client/components/his/XList/XList_20250609143210.vue +0 -270
  111. package/.history/src/base-client/components/his/XList/XList_20250609144339.vue +0 -294
  112. package/.history/src/base-client/components/his/XList/XList_20250609144410.vue +0 -294
  113. package/.history/src/base-client/components/his/XList/XList_20250609144412.vue +0 -294
  114. package/.history/src/base-client/components/his/XList/XList_20250609144647.vue +0 -303
  115. package/.history/src/base-client/components/his/XList/XList_20250609144716.vue +0 -303
  116. package/.history/src/base-client/components/his/XList/XList_20250609144729.vue +0 -303
  117. package/.history/src/base-client/components/his/XList/XList_20250609151232.vue +0 -288
  118. package/.history/src/base-client/components/his/XList/XList_20250609151247.vue +0 -288
  119. package/.history/src/base-client/components/his/XList/XList_20250609151252.vue +0 -288
  120. package/.history/src/base-client/components/his/XList/XList_20250609161220.vue +0 -317
  121. package/.history/src/base-client/components/his/XList/XList_20250609161258.vue +0 -306
  122. package/.history/src/base-client/components/his/XList/XList_20250609161319.vue +0 -306
  123. package/.history/src/base-client/components/his/XList/XList_20250609161320.vue +0 -306
  124. package/.history/src/base-client/components/his/XShiftSchedule/XShiftSchedule_20250609151519.vue +0 -222
  125. package/.history/src/base-client/components/his/XShiftSchedule/XShiftSchedule_20250612155514.vue +0 -183
  126. package/.history/src/base-client/components/his/XShiftSchedule/XShiftSchedule_20250612155556.vue +0 -183
  127. package/.history/src/base-client/components/his/XShiftSchedule/XShiftSchedule_20250612155600.vue +0 -183
  128. package/.history/src/base-client/components/his/XShiftSchedule/XShiftSchedule_20250612181609.vue +0 -206
  129. package/.history/src/base-client/components/his/XShiftSchedule/XShiftSchedule_20250612181629.vue +0 -209
  130. package/.history/src/base-client/components/his/XShiftSchedule/XShiftSchedule_20250613095553.vue +0 -242
  131. package/.history/src/base-client/components/his/XShiftSchedule/XShiftSchedule_20250613095610.vue +0 -242
  132. package/.history/src/base-client/components/his/XShiftSchedule/XShiftSchedule_20250613095612.vue +0 -242
  133. package/.history/src/base-client/components/his/XShiftSchedule/XShiftSchedule_20250613100041.vue +0 -251
  134. package/.history/src/base-client/components/his/XShiftSchedule/XShiftSchedule_20250613100047.vue +0 -251
  135. package/.history/src/base-client/components/his/XShiftSchedule/XShiftSchedule_20250613100054.vue +0 -250
  136. package/.history/src/base-client/components/his/XShiftSchedule/XShiftSchedule_20250613100105.vue +0 -250
  137. package/.history/src/base-client/components/his/XShiftSchedule/XShiftSchedule_20250613100107.vue +0 -250
  138. package/.history/src/base-client/components/his/XShiftSchedule/XShiftSchedule_20250613100114.vue +0 -250
  139. package/.history/src/base-client/components/his/XShiftSchedule/XShiftSchedule_20250613140844.vue +0 -238
  140. package/.history/src/base-client/components/his/XShiftSchedule/XShiftSchedule_20250613140910.vue +0 -238
  141. package/.history/src/base-client/components/his/XShiftSchedule/XShiftSchedule_20250613140912.vue +0 -238
  142. package/Users/objecrt/af-vue2-client/src/base-client/components/his/XShiftSchedule/XShiftSchedule.vue +0 -36
  143. package/src/base-client/components/TreeList/TreeList.vue +0 -91
  144. package/src/base-client/components/TreeList/TreeNode.vue +0 -81
  145. package/src/base-client/components/common/XCardSet/XTiltle.vue +0 -191
@@ -1,388 +1,388 @@
1
- <template>
2
- <div class="message-container">
3
- <a-spin size="large" :spinning="messageLoading">
4
- <!-- 留言输入区域 -->
5
- <div class="message-input-area">
6
- <div class="user-avatar">
7
- <a-avatar :style="avatarStyle(user.name)">
8
- {{ user.name.substr(0, 1) }}
9
- </a-avatar>
10
- <span class="user-name">{{ user.name }}</span>
11
- </div>
12
- <div class="input-wrapper">
13
- <a-textarea
14
- v-model="messageText"
15
- placeholder="写下你的留言..."
16
- class="text-input"
17
- :autoSize="{ minRows: 3, maxRows: 6 }"
18
- />
19
- <div class="action-area">
20
- <div></div> <!-- 占位,保持右对齐 -->
21
- <a-button
22
- type="primary"
23
- :loading="submitting"
24
- :disabled="messageText.trim() === ''"
25
- @click="onSubmit"
26
- class="submit-btn"
27
- >
28
- 发送
29
- </a-button>
30
- </div>
31
- </div>
32
- </div>
33
-
34
- <!-- 留言列表分割线 -->
35
- <div class="message-divider" v-if="messageList.length">
36
- <span class="divider-text">全部留言</span>
37
- </div>
38
-
39
- <!-- 留言统计 -->
40
- <div class="message-stats" v-if="messageList.length">
41
- <span>共 {{ messageList.length }} 条留言</span>
42
- </div>
43
-
44
- <!-- 空状态 -->
45
- <a-empty v-if="!messageList.length" description="暂无留言,发表第一条留言吧" />
46
-
47
- <!-- 留言列表 -->
48
- <div class="comment-list" v-else>
49
- <div
50
- v-for="message in sortedMessages"
51
- :key="message.id"
52
- class="comment-item"
53
- >
54
- <!-- 留言主体 -->
55
- <div class="comment-main">
56
- <div class="comment-avatar">
57
- <a-avatar :style="commentAvatarStyle(message.f_created_by)">
58
- {{ message.f_created_by.substr(0, 1) }}
59
- </a-avatar>
60
- </div>
61
- <div class="comment-content">
62
- <div class="comment-author">
63
- <span class="author-name">{{ message.f_created_by }}</span>
64
- <span class="author-badge" v-if="isCurrentUser(message.f_created_by)">我</span>
65
- </div>
66
- <div class="comment-text">{{ message.f_content }}</div>
67
- <div class="comment-footer">
68
- <span class="comment-time">{{ format(message.f_create_date) }}</span>
69
- </div>
70
- </div>
71
- </div>
72
- </div>
73
- </div>
74
-
75
- <!-- 加载更多 -->
76
- <div class="load-more" v-if="messageList.length > 5">
77
- <a-button type="link">查看更多留言</a-button>
78
- </div>
79
- </a-spin>
80
- </div>
81
- </template>
82
-
83
- <script>
84
- import { formatDate } from '@vue2-client/utils/util'
85
- import { mapState } from 'vuex'
86
- import { postByServiceName } from '@vue2-client/services/api/restTools'
87
- import { workFlowViewApi } from '@vue2-client/services/api/workFlow'
88
-
89
- export default {
90
- name: 'LeaveMessage',
91
- props: {
92
- projectName: {
93
- type: String,
94
- required: true
95
- },
96
- workflowId: {
97
- type: String,
98
- required: true
99
- },
100
- },
101
- data () {
102
- return {
103
- messageList: [],
104
- submitting: false,
105
- summaryVisible: false,
106
- messageText: '',
107
- messageLoading: false,
108
- colorMap: {}
109
- }
110
- },
111
- mounted () {
112
- this.getMessage()
113
- },
114
- computed: {
115
- ...mapState('account', ['user']),
116
- // 对留言列表按创建时间倒序排序
117
- sortedMessages () {
118
- // 创建一个副本,避免直接修改原数组
119
- return [...this.messageList].sort((a, b) => {
120
- // 否则按ID倒序排序
121
- return b.id - a.id
122
- })
123
- }
124
- },
125
- methods: {
126
- format (date) {
127
- return formatDate(date, 'yyyy-MM-dd hh:mm:ss')
128
- },
129
- onSubmit () {
130
- this.submitting = true
131
- this.submitMessage({
132
- f_created_by: this.user.name,
133
- f_content: this.messageText.trim()
134
- }).then(() => {
135
- this.submitting = false
136
- this.$message.success('留言成功')
137
- this.messageText = ''
138
- this.getMessage()
139
- this.$emit('refresh')
140
- }).catch(() => {
141
- this.submitting = false
142
- this.$message.error('留言失败,请重试')
143
- })
144
- },
145
- // 获取留言
146
- getMessage () {
147
- this.messageLoading = true
148
- postByServiceName(workFlowViewApi.getWorkFlowLeaveMessage, {
149
- workflowId: this.workflowId
150
- }).then(res => {
151
- this.messageList = res
152
- this.messageLoading = false
153
- })
154
- },
155
- // 提交留言
156
- submitMessage (data) {
157
- data.f_workflow_id = this.workflowId
158
- return postByServiceName('/entity/save/t_workflow_leave_message', data)
159
- },
160
- // 生成头像样式
161
- avatarStyle (name) {
162
- return {
163
- background: this.getAvatarColor(name),
164
- color: '#fff'
165
- }
166
- },
167
- // 生成评论头像样式
168
- commentAvatarStyle (name) {
169
- return {
170
- background: this.getAvatarColor(name),
171
- color: '#fff',
172
- fontSize: '16px',
173
- display: 'flex',
174
- alignItems: 'center',
175
- justifyContent: 'center'
176
- }
177
- },
178
- // 根据用户名生成固定的头像颜色
179
- getAvatarColor (name) {
180
- if (!name) return '#1890ff'
181
-
182
- // 如果已经生成过这个用户的颜色,直接返回
183
- if (this.colorMap[name]) {
184
- return this.colorMap[name]
185
- }
186
-
187
- // 预定义一组好看的颜色
188
- const colors = [
189
- '#1890ff', '#52c41a', '#722ed1', '#fa8c16', '#eb2f96',
190
- '#13c2c2', '#faad14', '#a0d911', '#fa541c', '#2f54eb'
191
- ]
192
-
193
- // 根据名字计算一个固定的索引
194
- let hash = 0
195
- for (let i = 0; i < name.length; i++) {
196
- hash = name.charCodeAt(i) + ((hash << 5) - hash)
197
- }
198
-
199
- const index = Math.abs(hash) % colors.length
200
- this.colorMap[name] = colors[index]
201
- return colors[index]
202
- },
203
- // 判断是否是当前用户
204
- isCurrentUser (name) {
205
- return name === this.user.name
206
- }
207
- }
208
- }
209
- </script>
210
-
211
- <style lang="less" scoped>
212
- .message-container {
213
- padding: 24px;
214
- background: #fff;
215
- border-radius: 8px;
216
- box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
217
- }
218
-
219
- // 留言统计
220
- .message-stats {
221
- margin-bottom: 20px;
222
- color: #8c8c8c;
223
- font-size: 14px;
224
- }
225
-
226
- // 留言输入区域
227
- .message-input-area {
228
- margin-bottom: 32px;
229
- background: #f9fafb;
230
- border-radius: 8px;
231
- padding: 16px;
232
-
233
- .user-avatar {
234
- display: flex;
235
- align-items: center;
236
- margin-bottom: 12px;
237
-
238
- .ant-avatar {
239
- margin-right: 8px;
240
- }
241
-
242
- .user-name {
243
- font-size: 14px;
244
- font-weight: 500;
245
- color: #262626;
246
- }
247
- }
248
-
249
- .input-wrapper {
250
- width: 100%;
251
- }
252
-
253
- .text-input {
254
- margin-bottom: 12px;
255
- border-radius: 4px;
256
- resize: none;
257
- background: #fff;
258
-
259
- /deep/ .ant-input {
260
- padding: 12px 16px;
261
- font-size: 14px;
262
- }
263
- }
264
-
265
- .action-area {
266
- display: flex;
267
- justify-content: space-between;
268
- align-items: center;
269
- }
270
-
271
- .submit-btn {
272
- padding: 0 16px;
273
- border-radius: 4px;
274
- font-size: 14px;
275
- }
276
- }
277
-
278
- // 分割线
279
- .message-divider {
280
- position: relative;
281
- text-align: center;
282
- margin: 24px 0;
283
-
284
- &::before {
285
- content: '';
286
- position: absolute;
287
- top: 50%;
288
- left: 0;
289
- width: 100%;
290
- height: 1px;
291
- background: #f0f0f0;
292
- z-index: 0;
293
- }
294
-
295
- .divider-text {
296
- position: relative;
297
- display: inline-block;
298
- padding: 0 16px;
299
- background: #fff;
300
- font-size: 14px;
301
- color: #8c8c8c;
302
- z-index: 1;
303
- }
304
- }
305
-
306
- // 留言列表
307
- .comment-list {
308
- .comment-item {
309
- padding: 16px 0;
310
- border-bottom: 1px solid #f0f0f0;
311
-
312
- &:last-child {
313
- border-bottom: none;
314
- }
315
- }
316
-
317
- .comment-main {
318
- display: flex;
319
-
320
- .comment-avatar {
321
- margin-right: 16px;
322
- flex-shrink: 0;
323
- }
324
-
325
- .comment-content {
326
- flex: 1;
327
- overflow: hidden;
328
-
329
- .comment-author {
330
- margin-bottom: 8px;
331
- display: flex;
332
- align-items: center;
333
-
334
- .author-name {
335
- font-size: 15px;
336
- font-weight: 600;
337
- color: #262626;
338
- }
339
-
340
- .author-badge {
341
- margin-left: 8px;
342
- background: #e6f7ff;
343
- color: #1890ff;
344
- padding: 0 6px;
345
- border-radius: 10px;
346
- font-size: 12px;
347
- line-height: 18px;
348
- }
349
- }
350
-
351
- .comment-text {
352
- font-size: 15px;
353
- line-height: 1.6;
354
- color: #333;
355
- margin-bottom: 8px;
356
- word-break: break-word;
357
- }
358
-
359
- .comment-footer {
360
- display: flex;
361
- justify-content: space-between;
362
- align-items: center;
363
- margin-bottom: 4px;
364
-
365
- .comment-time {
366
- font-size: 13px;
367
- color: #8c8c8c;
368
- }
369
- }
370
- }
371
- }
372
- }
373
-
374
- // 加载更多
375
- .load-more {
376
- text-align: center;
377
- margin-top: 16px;
378
- }
379
-
380
- // 空状态
381
- /deep/ .ant-empty {
382
- margin: 32px 0;
383
-
384
- .ant-empty-description {
385
- color: #8c8c8c;
386
- }
387
- }
388
- </style>
1
+ <template>
2
+ <div class="message-container">
3
+ <a-spin size="large" :spinning="messageLoading">
4
+ <!-- 留言输入区域 -->
5
+ <div class="message-input-area">
6
+ <div class="user-avatar">
7
+ <a-avatar :style="avatarStyle(user.name)">
8
+ {{ user.name.substr(0, 1) }}
9
+ </a-avatar>
10
+ <span class="user-name">{{ user.name }}</span>
11
+ </div>
12
+ <div class="input-wrapper">
13
+ <a-textarea
14
+ v-model="messageText"
15
+ placeholder="写下你的留言..."
16
+ class="text-input"
17
+ :autoSize="{ minRows: 3, maxRows: 6 }"
18
+ />
19
+ <div class="action-area">
20
+ <div></div> <!-- 占位,保持右对齐 -->
21
+ <a-button
22
+ type="primary"
23
+ :loading="submitting"
24
+ :disabled="messageText.trim() === ''"
25
+ @click="onSubmit"
26
+ class="submit-btn"
27
+ >
28
+ 发送
29
+ </a-button>
30
+ </div>
31
+ </div>
32
+ </div>
33
+
34
+ <!-- 留言列表分割线 -->
35
+ <div class="message-divider" v-if="messageList.length">
36
+ <span class="divider-text">全部留言</span>
37
+ </div>
38
+
39
+ <!-- 留言统计 -->
40
+ <div class="message-stats" v-if="messageList.length">
41
+ <span>共 {{ messageList.length }} 条留言</span>
42
+ </div>
43
+
44
+ <!-- 空状态 -->
45
+ <a-empty v-if="!messageList.length" description="暂无留言,发表第一条留言吧" />
46
+
47
+ <!-- 留言列表 -->
48
+ <div class="comment-list" v-else>
49
+ <div
50
+ v-for="message in sortedMessages"
51
+ :key="message.id"
52
+ class="comment-item"
53
+ >
54
+ <!-- 留言主体 -->
55
+ <div class="comment-main">
56
+ <div class="comment-avatar">
57
+ <a-avatar :style="commentAvatarStyle(message.f_created_by)">
58
+ {{ message.f_created_by.substr(0, 1) }}
59
+ </a-avatar>
60
+ </div>
61
+ <div class="comment-content">
62
+ <div class="comment-author">
63
+ <span class="author-name">{{ message.f_created_by }}</span>
64
+ <span class="author-badge" v-if="isCurrentUser(message.f_created_by)">我</span>
65
+ </div>
66
+ <div class="comment-text">{{ message.f_content }}</div>
67
+ <div class="comment-footer">
68
+ <span class="comment-time">{{ format(message.f_create_date) }}</span>
69
+ </div>
70
+ </div>
71
+ </div>
72
+ </div>
73
+ </div>
74
+
75
+ <!-- 加载更多 -->
76
+ <div class="load-more" v-if="messageList.length > 5">
77
+ <a-button type="link">查看更多留言</a-button>
78
+ </div>
79
+ </a-spin>
80
+ </div>
81
+ </template>
82
+
83
+ <script>
84
+ import { formatDate } from '@vue2-client/utils/util'
85
+ import { mapState } from 'vuex'
86
+ import { postByServiceName } from '@vue2-client/services/api/restTools'
87
+ import { workFlowViewApi } from '@vue2-client/services/api/workFlow'
88
+
89
+ export default {
90
+ name: 'LeaveMessage',
91
+ props: {
92
+ projectName: {
93
+ type: String,
94
+ required: true
95
+ },
96
+ workflowId: {
97
+ type: String,
98
+ required: true
99
+ },
100
+ },
101
+ data () {
102
+ return {
103
+ messageList: [],
104
+ submitting: false,
105
+ summaryVisible: false,
106
+ messageText: '',
107
+ messageLoading: false,
108
+ colorMap: {}
109
+ }
110
+ },
111
+ mounted () {
112
+ this.getMessage()
113
+ },
114
+ computed: {
115
+ ...mapState('account', ['user']),
116
+ // 对留言列表按创建时间倒序排序
117
+ sortedMessages () {
118
+ // 创建一个副本,避免直接修改原数组
119
+ return [...this.messageList].sort((a, b) => {
120
+ // 否则按ID倒序排序
121
+ return b.id - a.id
122
+ })
123
+ }
124
+ },
125
+ methods: {
126
+ format (date) {
127
+ return formatDate(date, 'yyyy-MM-dd hh:mm:ss')
128
+ },
129
+ onSubmit () {
130
+ this.submitting = true
131
+ this.submitMessage({
132
+ f_created_by: this.user.name,
133
+ f_content: this.messageText.trim()
134
+ }).then(() => {
135
+ this.submitting = false
136
+ this.$message.success('留言成功')
137
+ this.messageText = ''
138
+ this.getMessage()
139
+ this.$emit('refresh')
140
+ }).catch(() => {
141
+ this.submitting = false
142
+ this.$message.error('留言失败,请重试')
143
+ })
144
+ },
145
+ // 获取留言
146
+ getMessage () {
147
+ this.messageLoading = true
148
+ postByServiceName(workFlowViewApi.getWorkFlowLeaveMessage, {
149
+ workflowId: this.workflowId
150
+ }).then(res => {
151
+ this.messageList = res
152
+ this.messageLoading = false
153
+ })
154
+ },
155
+ // 提交留言
156
+ submitMessage (data) {
157
+ data.f_workflow_id = this.workflowId
158
+ return postByServiceName('/entity/save/t_workflow_leave_message', data)
159
+ },
160
+ // 生成头像样式
161
+ avatarStyle (name) {
162
+ return {
163
+ background: this.getAvatarColor(name),
164
+ color: '#fff'
165
+ }
166
+ },
167
+ // 生成评论头像样式
168
+ commentAvatarStyle (name) {
169
+ return {
170
+ background: this.getAvatarColor(name),
171
+ color: '#fff',
172
+ fontSize: '16px',
173
+ display: 'flex',
174
+ alignItems: 'center',
175
+ justifyContent: 'center'
176
+ }
177
+ },
178
+ // 根据用户名生成固定的头像颜色
179
+ getAvatarColor (name) {
180
+ if (!name) return '#1890ff'
181
+
182
+ // 如果已经生成过这个用户的颜色,直接返回
183
+ if (this.colorMap[name]) {
184
+ return this.colorMap[name]
185
+ }
186
+
187
+ // 预定义一组好看的颜色
188
+ const colors = [
189
+ '#1890ff', '#52c41a', '#722ed1', '#fa8c16', '#eb2f96',
190
+ '#13c2c2', '#faad14', '#a0d911', '#fa541c', '#2f54eb'
191
+ ]
192
+
193
+ // 根据名字计算一个固定的索引
194
+ let hash = 0
195
+ for (let i = 0; i < name.length; i++) {
196
+ hash = name.charCodeAt(i) + ((hash << 5) - hash)
197
+ }
198
+
199
+ const index = Math.abs(hash) % colors.length
200
+ this.colorMap[name] = colors[index]
201
+ return colors[index]
202
+ },
203
+ // 判断是否是当前用户
204
+ isCurrentUser (name) {
205
+ return name === this.user.name
206
+ }
207
+ }
208
+ }
209
+ </script>
210
+
211
+ <style lang="less" scoped>
212
+ .message-container {
213
+ padding: 24px;
214
+ background: #fff;
215
+ border-radius: 8px;
216
+ box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
217
+ }
218
+
219
+ // 留言统计
220
+ .message-stats {
221
+ margin-bottom: 20px;
222
+ color: #8c8c8c;
223
+ font-size: 14px;
224
+ }
225
+
226
+ // 留言输入区域
227
+ .message-input-area {
228
+ margin-bottom: 32px;
229
+ background: #f9fafb;
230
+ border-radius: 8px;
231
+ padding: 16px;
232
+
233
+ .user-avatar {
234
+ display: flex;
235
+ align-items: center;
236
+ margin-bottom: 12px;
237
+
238
+ .ant-avatar {
239
+ margin-right: 8px;
240
+ }
241
+
242
+ .user-name {
243
+ font-size: 14px;
244
+ font-weight: 500;
245
+ color: #262626;
246
+ }
247
+ }
248
+
249
+ .input-wrapper {
250
+ width: 100%;
251
+ }
252
+
253
+ .text-input {
254
+ margin-bottom: 12px;
255
+ border-radius: 4px;
256
+ resize: none;
257
+ background: #fff;
258
+
259
+ /deep/ .ant-input {
260
+ padding: 12px 16px;
261
+ font-size: 14px;
262
+ }
263
+ }
264
+
265
+ .action-area {
266
+ display: flex;
267
+ justify-content: space-between;
268
+ align-items: center;
269
+ }
270
+
271
+ .submit-btn {
272
+ padding: 0 16px;
273
+ border-radius: 4px;
274
+ font-size: 14px;
275
+ }
276
+ }
277
+
278
+ // 分割线
279
+ .message-divider {
280
+ position: relative;
281
+ text-align: center;
282
+ margin: 24px 0;
283
+
284
+ &::before {
285
+ content: '';
286
+ position: absolute;
287
+ top: 50%;
288
+ left: 0;
289
+ width: 100%;
290
+ height: 1px;
291
+ background: #f0f0f0;
292
+ z-index: 0;
293
+ }
294
+
295
+ .divider-text {
296
+ position: relative;
297
+ display: inline-block;
298
+ padding: 0 16px;
299
+ background: #fff;
300
+ font-size: 14px;
301
+ color: #8c8c8c;
302
+ z-index: 1;
303
+ }
304
+ }
305
+
306
+ // 留言列表
307
+ .comment-list {
308
+ .comment-item {
309
+ padding: 16px 0;
310
+ border-bottom: 1px solid #f0f0f0;
311
+
312
+ &:last-child {
313
+ border-bottom: none;
314
+ }
315
+ }
316
+
317
+ .comment-main {
318
+ display: flex;
319
+
320
+ .comment-avatar {
321
+ margin-right: 16px;
322
+ flex-shrink: 0;
323
+ }
324
+
325
+ .comment-content {
326
+ flex: 1;
327
+ overflow: hidden;
328
+
329
+ .comment-author {
330
+ margin-bottom: 8px;
331
+ display: flex;
332
+ align-items: center;
333
+
334
+ .author-name {
335
+ font-size: 15px;
336
+ font-weight: 600;
337
+ color: #262626;
338
+ }
339
+
340
+ .author-badge {
341
+ margin-left: 8px;
342
+ background: #e6f7ff;
343
+ color: #1890ff;
344
+ padding: 0 6px;
345
+ border-radius: 10px;
346
+ font-size: 12px;
347
+ line-height: 18px;
348
+ }
349
+ }
350
+
351
+ .comment-text {
352
+ font-size: 15px;
353
+ line-height: 1.6;
354
+ color: #333;
355
+ margin-bottom: 8px;
356
+ word-break: break-word;
357
+ }
358
+
359
+ .comment-footer {
360
+ display: flex;
361
+ justify-content: space-between;
362
+ align-items: center;
363
+ margin-bottom: 4px;
364
+
365
+ .comment-time {
366
+ font-size: 13px;
367
+ color: #8c8c8c;
368
+ }
369
+ }
370
+ }
371
+ }
372
+ }
373
+
374
+ // 加载更多
375
+ .load-more {
376
+ text-align: center;
377
+ margin-top: 16px;
378
+ }
379
+
380
+ // 空状态
381
+ /deep/ .ant-empty {
382
+ margin: 32px 0;
383
+
384
+ .ant-empty-description {
385
+ color: #8c8c8c;
386
+ }
387
+ }
388
+ </style>