vue2-client 1.14.84 → 1.14.86

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 (134) 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 +7 -0
  5. package/src/base-client/components/his/XQuestionnaire/XQuestionnaire.vue +20 -7
  6. package/src/base-client/components/his/XQuestionnaire/XQuestionnaireDemo.vue +10 -1
  7. package/src/base-client/components/his/XQuestionnaire/XQuestionnaireItem.vue +0 -3
  8. package/src/base-client/components/his/XTextCard/XTextCard.vue +207 -207
  9. package/src/base-client/components/his/XTreeRows/TreeNode.vue +100 -100
  10. package/src/base-client/components/his/XTreeRows/XTreeRows.vue +197 -197
  11. package/src/base-client/components/his/threeTestOrders/editor.vue +111 -111
  12. package/src/base-client/components/layout/XPageView/RenderRow.vue +57 -31
  13. package/src/base-client/components/layout/XPageView/XErrorView.vue +14 -3
  14. package/src/base-client/components/layout/XPageView/XPageView.vue +138 -71
  15. package/src/base-client/components/layout/XPageView/index.js +1 -3
  16. package/src/base-client/components/layout/XPageView/index.md +65 -26
  17. package/src/pages/WorkflowDetail/WorkFlowDemo2.vue +90 -0
  18. package/src/pages/WorkflowDetail/WorkflowPageDetail/WorkFlowHandle.vue +13 -1
  19. package/src/pages/XPageViewExample/index.vue +41 -8
  20. package/src/pages/addressSelect/addressDemo.vue +24 -24
  21. package/src/pages/addressSelect/index.vue +6 -12
  22. package/src/router/async/router.map.js +4 -2
  23. package/.history/public/his/editor/editor_20250606134713.html +0 -51
  24. package/.history/src/base-client/components/common/AddressSearchCombobox/AddressSearchCombobox_20250527173925.vue +0 -509
  25. package/.history/src/base-client/components/common/AddressSearchCombobox/AddressSearchCombobox_20250527174316.vue +0 -524
  26. package/.history/src/base-client/components/common/AddressSearchCombobox/AddressSearchCombobox_20250527174419.vue +0 -524
  27. package/.history/src/base-client/components/common/AddressSearchCombobox/AddressSearchCombobox_20250527174422.vue +0 -524
  28. package/.history/src/base-client/components/common/XAddReport/XAddReport_20250611172825.vue +0 -207
  29. package/.history/src/base-client/components/common/XAddReport/XAddReport_20250611172945.vue +0 -211
  30. package/.history/src/base-client/components/common/XAddReport/XAddReport_20250611172949.vue +0 -212
  31. package/.history/src/base-client/components/common/XAddReport/XAddReport_20250611173010.vue +0 -212
  32. package/.history/src/base-client/components/common/XForm/XFormItem_20250508134122.vue +0 -1320
  33. package/.history/src/base-client/components/common/XForm/XFormItem_20250527171604.vue +0 -1332
  34. package/.history/src/base-client/components/common/XForm/XFormItem_20250527171613.vue +0 -1331
  35. package/.history/src/base-client/components/common/XForm/XFormItem_20250527171703.vue +0 -1331
  36. package/.history/src/base-client/components/common/XForm/XFormItem_20250527171720.vue +0 -1331
  37. package/.history/src/base-client/components/common/XForm/XFormItem_20250527174327.vue +0 -1339
  38. package/.history/src/base-client/components/common/XReportGrid/XReportTrGroup_20250612092804.vue +0 -731
  39. package/.history/src/base-client/components/common/XReportGrid/XReportTrGroup_20250612112546.vue +0 -748
  40. package/.history/src/base-client/components/common/XReportGrid/XReportTrGroup_20250612113808.vue +0 -748
  41. package/.history/src/base-client/components/common/XReportGrid/XReport_20250612115237.vue +0 -1071
  42. package/.history/src/base-client/components/common/XReportGrid/XReport_20250612115346.vue +0 -1078
  43. package/.history/src/base-client/components/common/XReportGrid/XReport_20250612115350.vue +0 -1077
  44. package/.history/src/base-client/components/common/XReportGrid/XReport_20250612115415.vue +0 -1077
  45. package/.history/src/base-client/components/common/XReportGrid/XReport_20250612115429.vue +0 -1077
  46. package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611091619.vue +0 -442
  47. package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611092547.vue +0 -442
  48. package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611092552.vue +0 -442
  49. package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611092744.vue +0 -475
  50. package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611092955.vue +0 -475
  51. package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611092957.vue +0 -475
  52. package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611095652.vue +0 -477
  53. package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611095701.vue +0 -477
  54. package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611095704.vue +0 -477
  55. package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611100005.vue +0 -473
  56. package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611100011.vue +0 -473
  57. package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611100014.vue +0 -473
  58. package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611100833.vue +0 -473
  59. package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611100853.vue +0 -473
  60. package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611100940.vue +0 -473
  61. package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611101011.vue +0 -473
  62. package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611101013.vue +0 -473
  63. package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611101014.vue +0 -473
  64. package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611101159.vue +0 -473
  65. package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611101238.vue +0 -474
  66. package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611101240.vue +0 -474
  67. package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611101242.vue +0 -474
  68. package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611101404.vue +0 -472
  69. package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611101410.vue +0 -472
  70. package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611101459.vue +0 -472
  71. package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611101500.vue +0 -472
  72. package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611101502.vue +0 -472
  73. package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611101504.vue +0 -472
  74. package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611101610.vue +0 -501
  75. package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611101700.vue +0 -501
  76. package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611101702.vue +0 -501
  77. package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611101741.vue +0 -504
  78. package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611101749.vue +0 -504
  79. package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611101759.vue +0 -504
  80. package/.history/src/base-client/components/his/XHisEditor/dome_20250611091349.vue +0 -131
  81. package/.history/src/base-client/components/his/XHisEditor/dome_20250611105854.vue +0 -160
  82. package/.history/src/base-client/components/his/XHisEditor/dome_20250611105902.vue +0 -160
  83. package/.history/src/base-client/components/his/XHisEditor/dome_20250611105924.vue +0 -160
  84. package/.history/src/base-client/components/his/XHisEditor/dome_20250611105932.vue +0 -158
  85. package/.history/src/base-client/components/his/XList/XList_20250609135848.vue +0 -173
  86. package/.history/src/base-client/components/his/XList/XList_20250609141026.vue +0 -222
  87. package/.history/src/base-client/components/his/XList/XList_20250609141035.vue +0 -229
  88. package/.history/src/base-client/components/his/XList/XList_20250609141103.vue +0 -229
  89. package/.history/src/base-client/components/his/XList/XList_20250609141105.vue +0 -229
  90. package/.history/src/base-client/components/his/XList/XList_20250609141334.vue +0 -241
  91. package/.history/src/base-client/components/his/XList/XList_20250609141404.vue +0 -241
  92. package/.history/src/base-client/components/his/XList/XList_20250609141406.vue +0 -241
  93. package/.history/src/base-client/components/his/XList/XList_20250609141801.vue +0 -245
  94. package/.history/src/base-client/components/his/XList/XList_20250609142033.vue +0 -245
  95. package/.history/src/base-client/components/his/XList/XList_20250609142038.vue +0 -245
  96. package/.history/src/base-client/components/his/XList/XList_20250609142435.vue +0 -255
  97. package/.history/src/base-client/components/his/XList/XList_20250609142503.vue +0 -255
  98. package/.history/src/base-client/components/his/XList/XList_20250609142504.vue +0 -255
  99. package/.history/src/base-client/components/his/XList/XList_20250609143012.vue +0 -270
  100. package/.history/src/base-client/components/his/XList/XList_20250609143044.vue +0 -270
  101. package/.history/src/base-client/components/his/XList/XList_20250609143046.vue +0 -270
  102. package/.history/src/base-client/components/his/XList/XList_20250609143210.vue +0 -270
  103. package/.history/src/base-client/components/his/XList/XList_20250609144339.vue +0 -294
  104. package/.history/src/base-client/components/his/XList/XList_20250609144410.vue +0 -294
  105. package/.history/src/base-client/components/his/XList/XList_20250609144412.vue +0 -294
  106. package/.history/src/base-client/components/his/XList/XList_20250609144647.vue +0 -303
  107. package/.history/src/base-client/components/his/XList/XList_20250609144716.vue +0 -303
  108. package/.history/src/base-client/components/his/XList/XList_20250609144729.vue +0 -303
  109. package/.history/src/base-client/components/his/XList/XList_20250609151232.vue +0 -288
  110. package/.history/src/base-client/components/his/XList/XList_20250609151247.vue +0 -288
  111. package/.history/src/base-client/components/his/XList/XList_20250609151252.vue +0 -288
  112. package/.history/src/base-client/components/his/XList/XList_20250609161220.vue +0 -317
  113. package/.history/src/base-client/components/his/XList/XList_20250609161258.vue +0 -306
  114. package/.history/src/base-client/components/his/XList/XList_20250609161319.vue +0 -306
  115. package/.history/src/base-client/components/his/XList/XList_20250609161320.vue +0 -306
  116. package/.history/src/base-client/components/his/XShiftSchedule/XShiftSchedule_20250609151519.vue +0 -222
  117. package/.history/src/base-client/components/his/XShiftSchedule/XShiftSchedule_20250612155514.vue +0 -183
  118. package/.history/src/base-client/components/his/XShiftSchedule/XShiftSchedule_20250612155556.vue +0 -183
  119. package/.history/src/base-client/components/his/XShiftSchedule/XShiftSchedule_20250612155600.vue +0 -183
  120. package/.history/src/base-client/components/his/XShiftSchedule/XShiftSchedule_20250612181609.vue +0 -206
  121. package/.history/src/base-client/components/his/XShiftSchedule/XShiftSchedule_20250612181629.vue +0 -209
  122. package/.history/src/base-client/components/his/XShiftSchedule/XShiftSchedule_20250613095553.vue +0 -242
  123. package/.history/src/base-client/components/his/XShiftSchedule/XShiftSchedule_20250613095610.vue +0 -242
  124. package/.history/src/base-client/components/his/XShiftSchedule/XShiftSchedule_20250613095612.vue +0 -242
  125. package/.history/src/base-client/components/his/XShiftSchedule/XShiftSchedule_20250613100041.vue +0 -251
  126. package/.history/src/base-client/components/his/XShiftSchedule/XShiftSchedule_20250613100047.vue +0 -251
  127. package/.history/src/base-client/components/his/XShiftSchedule/XShiftSchedule_20250613100054.vue +0 -250
  128. package/.history/src/base-client/components/his/XShiftSchedule/XShiftSchedule_20250613100105.vue +0 -250
  129. package/.history/src/base-client/components/his/XShiftSchedule/XShiftSchedule_20250613100107.vue +0 -250
  130. package/.history/src/base-client/components/his/XShiftSchedule/XShiftSchedule_20250613100114.vue +0 -250
  131. package/Users/objecrt/af-vue2-client/src/base-client/components/his/XShiftSchedule/XShiftSchedule.vue +0 -36
  132. package/src/base-client/components/TreeList/TreeList.vue +0 -91
  133. package/src/base-client/components/TreeList/TreeNode.vue +0 -81
  134. package/src/base-client/components/common/XCardSet/XTiltle.vue +0 -191
@@ -11,7 +11,6 @@
11
11
  - ENV 对应 一个 org.json.JSONObject {tenantName:"租户名称",orgName:"分公司名称",applicationName:"应用名称",dbType:"数据库类型"}
12
12
  - logic 对应 LogicService 类,其中有方法
13
13
  * logic.run(logicName,param) 执行logic / logicName 执行的业务逻辑名称,param 参数 返回 org.json.JSONObject
14
- * logic.remoteRun("服务名","logicName", "param")
15
14
  - sql 对应 [SqlService]() 类,其中有方法
16
15
  * sql.query(sql别名 string,sql参数 string) 执行已经注册的sql 返回 org.json.JSONArray
17
16
  * sql.query(sql别名 string,sql参数 string,页数 int,每页行数 int) 执行已经注册的sql 返回 org.json.JSONArray
@@ -10,12 +10,11 @@
10
10
  - openDialog(configName, selectedId, mixinData, outEnv, attr):打开一个对话框:
11
11
  - setColSpanByName(slotRef, colSpan):设置栅格的宽度
12
12
  - openDrawer(configName, selectedId, mixinData):打开一个对话框,例如:this.openDialog('xxx', 5, {})
13
- - openDrawer(configName, selectedId, mixinData, outEnv, attr, showButton):打开一个对话框:
13
+ - openDrawer(configName, selectedId, mixinData, outEnv, attr):打开一个对话框:
14
14
  - selectId:id号,formtable选择时,用selectId过滤数据 可以传递 json {a_id: 1} 或者 传递 1 ,传递数值会默认拼接查询条件 {selected_id:1}
15
15
  - mixinData: form表单需要的数据
16
16
  - outEnv: 传递给打开的界面的数据,在打开界面的js中通过this.outEnv可以访问
17
17
  - attr: 用于传递参数绑定到 modal 弹框上
18
- - showButton: true/false 是否显示提交按钮 默认:true
19
18
  - getOutEnv 获取获取 outEnv
20
19
  - this.getRealKeyData(obj) 获取真实的数据 传递 {a_a:"1"} 返回 {a:"1"}
21
20
  - this.currUser.operaInfo 获取当前用户信息
@@ -61,8 +60,7 @@ this.openDialog('xxx', 5, {}, {}, {})
61
60
  afterDelete( res (删除接口返回数据)) 删除后触发
62
61
  action(record (当前记录), id (当前记录主键), actionType (操作类型)) 操作按钮触发
63
62
  - expandedGrid:"栅格名"
64
- - json配置相关
65
- - "pageMaxSize": (int) num,
63
+
66
64
  # x-report 插槽 使用说明
67
65
 
68
66
  - init(configName,configData) 配置名称 / 报表数据
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vue2-client",
3
- "version": "1.14.84",
3
+ "version": "1.14.86",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "serve": "SET NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service serve --no-eslint",
@@ -361,6 +361,13 @@ export default {
361
361
  extraHeight: {
362
362
  type: Number,
363
363
  default: 80
364
+ },
365
+ // 额外参数,用于控制组件行为
366
+ extraParams: {
367
+ type: Object,
368
+ default: () => {
369
+ return {}
370
+ }
364
371
  }
365
372
  },
366
373
  watch: {
@@ -1,7 +1,7 @@
1
1
  <template>
2
2
  <div class="list-container" style="display: flex;">
3
3
  <template v-for="(config, index) in configs">
4
- <x-questionnaire-item :queryParamsName="config" :ref="el => setItemRef(el, index)" :key="`questionnaire-${index}`"></x-questionnaire-item>
4
+ <x-questionnaire-item :fixedQueryForm="conditions[index]" :queryParamsName="config" :ref="el => setItemRef(el, index)" :key="`questionnaire-${index}`"></x-questionnaire-item>
5
5
  </template>
6
6
  </div>
7
7
  </template>
@@ -26,24 +26,37 @@ export default {
26
26
  data () {
27
27
  return {
28
28
  configs: [],
29
- questionnaireItemRefs: [] // 存储子组件实例
29
+ questionnaireItemRefs: [], // 存储子组件实例
30
+ conditions: []
30
31
  }
31
32
  },
32
- created () {
33
- this.getData(this.queryParamsName)
34
- },
35
33
  methods: {
36
34
  // 获取配置
37
- async getData (queryParamsName) {
35
+ async getData (queryParamsName, conditions) {
38
36
  const that = this
39
37
  getConfigByName(queryParamsName, 'af-his', res => {
40
- that.configs = res.configs || []
38
+ if (res.configs) {
39
+ that.configs = []
40
+ }
41
+ for (let i = 0; i < res.configs.length; i++) {
42
+ const condition = i < conditions.length ? conditions[i] : {}
43
+ that.configs.push(res.configs[i])
44
+ that.conditions.push(condition)
45
+ }
41
46
  })
42
47
  },
43
48
  setItemRef (el, index) {
44
49
  if (el) {
45
50
  this.questionnaireItemRefs[index] = el // 保存实例
46
51
  }
52
+ },
53
+ init (conditions) {
54
+ this.getData(this.queryParamsName, conditions)
55
+ },
56
+ refreshList (index, condition) {
57
+ if (index < this.conditions.length) {
58
+ this.conditions[index] = condition
59
+ }
47
60
  }
48
61
  },
49
62
  }
@@ -9,14 +9,23 @@ export default {
9
9
  return {
10
10
  queryParamsName: 'surgeryRiskAssessConfig'
11
11
  }
12
+ },
13
+ methods: {
14
+ init () {
15
+ console.log(this)
16
+ this.$refs.questionnaireRef.init([{ id: 10 }, { id: 20 }, { id: 10 }])
17
+ }
12
18
  }
13
19
  }
14
20
  </script>
15
21
 
16
22
  <template>
17
23
  <div style="display: flex">
18
- <x-questionnaire :queryParamsName="queryParamsName">
24
+ <x-questionnaire ref="questionnaireRef" :queryParamsName="queryParamsName">
19
25
  </x-questionnaire>
26
+ <a-button type="primary" @click="init">
27
+ 初始化
28
+ </a-button>
20
29
  </div>
21
30
  </template>
22
31
 
@@ -195,9 +195,6 @@ export default {
195
195
  this.refreshList(val)
196
196
  }
197
197
  }
198
- },
199
- beforeDestroy () {
200
- this.clearAllTimers()
201
198
  }
202
199
  }
203
200
  </script>
@@ -1,207 +1,207 @@
1
- <template>
2
- <div>
3
- <div class="text-card">
4
- <div
5
- v-for="(item, index) in displayItems"
6
- :key="index"
7
- class="text-item"
8
- @click="handleItemClick(index, item.id)"
9
- @contextmenu.prevent="handleContextMenu(index, item.id)">
10
- <div class="text-content" :class="{ 'is-empty': !item.content }">
11
- {{ item.content || '+' }}
12
- </div>
13
- </div>
14
- <!-- 编辑弹出框 -->
15
- <div
16
- v-if="showEdit"
17
- class="edit-overlay"
18
- @click.self="handleOverlayClick">
19
- <div class="edit-card">
20
- <a-textarea
21
- v-model="editingContent"
22
- :autoSize="{ minRows: 3 }"
23
- @keyup.enter="handleSave"
24
- ref="textarea"/>
25
- </div>
26
- </div>
27
- <!-- 删除确认弹框 -->
28
- <a-modal
29
- v-model="showDeleteModal"
30
- title="确认删除"
31
- okText="确认"
32
- cancelText="取消"
33
- @ok="handleDeleteConfirm">
34
- <p>确定要删除这条内容吗?</p>
35
- </a-modal>
36
- </div>
37
- </div>
38
- </template>
39
-
40
- <script>
41
- import { runLogic } from '@vue2-client/services/api/common'
42
-
43
- export default {
44
- name: 'XTextCard',
45
- props: {
46
- // logic配置名,要求返回一个数组[{ id: , content: }]
47
- queryParamsName: {
48
- type: String,
49
- default: 'memorandumLOGIC'
50
- },
51
- queryParams: {
52
- type: Object,
53
- default: () => { return {} }
54
- },
55
- // 请求参数
56
- parameter: {
57
- type: Object,
58
- default: () => { return {} }
59
- }
60
- },
61
- data () {
62
- return {
63
- localItems: [], // 本地数据
64
- showEdit: false, // 是否显示编辑框
65
- editingIndex: -1, // 当前编辑的索引
66
- editingContent: '', // 编辑框的内容
67
- showDeleteModal: false, // 是否显示删除确认框
68
- deleteIndex: -1, // 要删除的项目索引
69
- ID: 0
70
- }
71
- },
72
- computed: {
73
- // 显示的列表,始终保持一个空行
74
- displayItems () {
75
- const items = [...this.localItems]
76
- // 如果最后一项不是空的,添加一个空项
77
- if (!items.length || items[items.length - 1].content) {
78
- items.push({ content: '' })
79
- }
80
- return items
81
- }
82
- },
83
- methods: {
84
- // 点击项目
85
- handleItemClick (index, id) {
86
- this.ID = id
87
- this.editingIndex = index
88
- this.editingContent = this.displayItems[index].content
89
- this.showEdit = true
90
- this.$nextTick(() => {
91
- this.$refs.textarea?.focus()
92
- })
93
- },
94
- // 点击遮罩层保存
95
- handleOverlayClick () {
96
- this.handleSave()
97
- },
98
- // 保存内容
99
- handleSave () {
100
- if (this.editingContent.trim()) {
101
- if (this.editingIndex === this.localItems.length) {
102
- // 如果是在最后一个空行添加,push新内容
103
- this.localItems.push({ content: this.editingContent.trim() })
104
- } else {
105
- // 否则更新现有内容
106
- this.localItems[this.editingIndex].content = this.editingContent.trim()
107
- }
108
- const addData = { data: this.editingContent.trim(), ID: this.ID }
109
- // 触发更新事件
110
- this.$emit('add', addData)
111
- }
112
- this.showEdit = false
113
- this.editingIndex = -1
114
- this.editingContent = ''
115
- },
116
- // 初始化数据
117
- async initData (data, parameter) {
118
- // 从配置中获取数据
119
- const resData = await runLogic(data, parameter, 'af-his')
120
- this.localItems = resData
121
- return resData
122
- },
123
- // 处理右键菜单
124
- handleContextMenu (index, id) {
125
- // 如果是最后一个空行,不显示删除框
126
- if (index === this.localItems.length) {
127
- return
128
- }
129
- this.ID = id
130
- this.deleteIndex = index
131
- this.showDeleteModal = true
132
- },
133
- // 确认删除
134
- handleDeleteConfirm () {
135
- if (this.deleteIndex > -1) {
136
- this.localItems.splice(this.deleteIndex, 1)
137
- const deleteData = { data: [...this.localItems][this.deleteIndex], ID: this.ID }
138
- this.$emit('deleteData', deleteData)
139
- this.deleteIndex = -1
140
- }
141
- this.showDeleteModal = false
142
- }
143
- },
144
- watch: {
145
- queryParamsName: {
146
- immediate: true,
147
- handler (newVal) {
148
- this.initData(newVal, this.parameter)
149
- },
150
- deep: true
151
- }
152
- }
153
- }
154
- </script>
155
-
156
- <style scoped lang="less">
157
- .text-card {
158
- position: relative;
159
- width: 100%;
160
- .text-item {
161
- padding: 8px 12px;
162
- border-bottom: 1px solid #f0f0f0;
163
- cursor: pointer;
164
- transition: all 0.3s;
165
- user-select: none;
166
-
167
- &:hover {
168
- background-color: #f5f5f5;
169
- }
170
-
171
- .text-content {
172
- white-space: nowrap;
173
- overflow: hidden;
174
- text-overflow: ellipsis;
175
- line-height: 1.5;
176
-
177
- &.is-empty {
178
- color: #5D5C5C;
179
- font-weight: 400;
180
- }
181
- }
182
- }
183
- .edit-overlay {
184
- position: fixed;
185
- top: 0;
186
- left: 0;
187
- right: 0;
188
- bottom: 0;
189
- background-color: rgba(0, 0, 0, 0.45);
190
- z-index: 1000;
191
- display: flex;
192
- align-items: center;
193
- justify-content: center;
194
- .edit-card {
195
- background: white;
196
- padding: 16px;
197
- border-radius: 8px;
198
- width: 90%;
199
- max-width: 500px;
200
- box-shadow: 0 3px 6px -4px rgba(0, 0, 0, 0.12);
201
- .ant-input {
202
- width: 100%;
203
- }
204
- }
205
- }
206
- }
207
- </style>
1
+ <template>
2
+ <div>
3
+ <div class="text-card">
4
+ <div
5
+ v-for="(item, index) in displayItems"
6
+ :key="index"
7
+ class="text-item"
8
+ @click="handleItemClick(index, item.id)"
9
+ @contextmenu.prevent="handleContextMenu(index, item.id)">
10
+ <div class="text-content" :class="{ 'is-empty': !item.content }">
11
+ {{ item.content || '+' }}
12
+ </div>
13
+ </div>
14
+ <!-- 编辑弹出框 -->
15
+ <div
16
+ v-if="showEdit"
17
+ class="edit-overlay"
18
+ @click.self="handleOverlayClick">
19
+ <div class="edit-card">
20
+ <a-textarea
21
+ v-model="editingContent"
22
+ :autoSize="{ minRows: 3 }"
23
+ @keyup.enter="handleSave"
24
+ ref="textarea"/>
25
+ </div>
26
+ </div>
27
+ <!-- 删除确认弹框 -->
28
+ <a-modal
29
+ v-model="showDeleteModal"
30
+ title="确认删除"
31
+ okText="确认"
32
+ cancelText="取消"
33
+ @ok="handleDeleteConfirm">
34
+ <p>确定要删除这条内容吗?</p>
35
+ </a-modal>
36
+ </div>
37
+ </div>
38
+ </template>
39
+
40
+ <script>
41
+ import { runLogic } from '@vue2-client/services/api/common'
42
+
43
+ export default {
44
+ name: 'XTextCard',
45
+ props: {
46
+ // logic配置名,要求返回一个数组[{ id: , content: }]
47
+ queryParamsName: {
48
+ type: String,
49
+ default: 'memorandumLOGIC'
50
+ },
51
+ queryParams: {
52
+ type: Object,
53
+ default: () => { return {} }
54
+ },
55
+ // 请求参数
56
+ parameter: {
57
+ type: Object,
58
+ default: () => { return {} }
59
+ }
60
+ },
61
+ data () {
62
+ return {
63
+ localItems: [], // 本地数据
64
+ showEdit: false, // 是否显示编辑框
65
+ editingIndex: -1, // 当前编辑的索引
66
+ editingContent: '', // 编辑框的内容
67
+ showDeleteModal: false, // 是否显示删除确认框
68
+ deleteIndex: -1, // 要删除的项目索引
69
+ ID: 0
70
+ }
71
+ },
72
+ computed: {
73
+ // 显示的列表,始终保持一个空行
74
+ displayItems () {
75
+ const items = [...this.localItems]
76
+ // 如果最后一项不是空的,添加一个空项
77
+ if (!items.length || items[items.length - 1].content) {
78
+ items.push({ content: '' })
79
+ }
80
+ return items
81
+ }
82
+ },
83
+ methods: {
84
+ // 点击项目
85
+ handleItemClick (index, id) {
86
+ this.ID = id
87
+ this.editingIndex = index
88
+ this.editingContent = this.displayItems[index].content
89
+ this.showEdit = true
90
+ this.$nextTick(() => {
91
+ this.$refs.textarea?.focus()
92
+ })
93
+ },
94
+ // 点击遮罩层保存
95
+ handleOverlayClick () {
96
+ this.handleSave()
97
+ },
98
+ // 保存内容
99
+ handleSave () {
100
+ if (this.editingContent.trim()) {
101
+ if (this.editingIndex === this.localItems.length) {
102
+ // 如果是在最后一个空行添加,push新内容
103
+ this.localItems.push({ content: this.editingContent.trim() })
104
+ } else {
105
+ // 否则更新现有内容
106
+ this.localItems[this.editingIndex].content = this.editingContent.trim()
107
+ }
108
+ const addData = { data: this.editingContent.trim(), ID: this.ID }
109
+ // 触发更新事件
110
+ this.$emit('add', addData)
111
+ }
112
+ this.showEdit = false
113
+ this.editingIndex = -1
114
+ this.editingContent = ''
115
+ },
116
+ // 初始化数据
117
+ async initData (data, parameter) {
118
+ // 从配置中获取数据
119
+ const resData = await runLogic(data, parameter, 'af-his')
120
+ this.localItems = resData
121
+ return resData
122
+ },
123
+ // 处理右键菜单
124
+ handleContextMenu (index, id) {
125
+ // 如果是最后一个空行,不显示删除框
126
+ if (index === this.localItems.length) {
127
+ return
128
+ }
129
+ this.ID = id
130
+ this.deleteIndex = index
131
+ this.showDeleteModal = true
132
+ },
133
+ // 确认删除
134
+ handleDeleteConfirm () {
135
+ if (this.deleteIndex > -1) {
136
+ this.localItems.splice(this.deleteIndex, 1)
137
+ const deleteData = { data: [...this.localItems][this.deleteIndex], ID: this.ID }
138
+ this.$emit('deleteData', deleteData)
139
+ this.deleteIndex = -1
140
+ }
141
+ this.showDeleteModal = false
142
+ }
143
+ },
144
+ watch: {
145
+ queryParamsName: {
146
+ immediate: true,
147
+ handler (newVal) {
148
+ this.initData(newVal, this.parameter)
149
+ },
150
+ deep: true
151
+ }
152
+ }
153
+ }
154
+ </script>
155
+
156
+ <style scoped lang="less">
157
+ .text-card {
158
+ position: relative;
159
+ width: 100%;
160
+ .text-item {
161
+ padding: 8px 12px;
162
+ border-bottom: 1px solid #f0f0f0;
163
+ cursor: pointer;
164
+ transition: all 0.3s;
165
+ user-select: none;
166
+
167
+ &:hover {
168
+ background-color: #f5f5f5;
169
+ }
170
+
171
+ .text-content {
172
+ white-space: nowrap;
173
+ overflow: hidden;
174
+ text-overflow: ellipsis;
175
+ line-height: 1.5;
176
+
177
+ &.is-empty {
178
+ color: #5D5C5C;
179
+ font-weight: 400;
180
+ }
181
+ }
182
+ }
183
+ .edit-overlay {
184
+ position: fixed;
185
+ top: 0;
186
+ left: 0;
187
+ right: 0;
188
+ bottom: 0;
189
+ background-color: rgba(0, 0, 0, 0.45);
190
+ z-index: 1000;
191
+ display: flex;
192
+ align-items: center;
193
+ justify-content: center;
194
+ .edit-card {
195
+ background: white;
196
+ padding: 16px;
197
+ border-radius: 8px;
198
+ width: 90%;
199
+ max-width: 500px;
200
+ box-shadow: 0 3px 6px -4px rgba(0, 0, 0, 0.12);
201
+ .ant-input {
202
+ width: 100%;
203
+ }
204
+ }
205
+ }
206
+ }
207
+ </style>