star-horse-lowcode 2.7.62 → 2.7.65

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 (221) hide show
  1. package/.env.development +3 -0
  2. package/.env.production +3 -0
  3. package/.eslintrc-auto-import.json +77 -0
  4. package/.gitignore +27 -0
  5. package/.idea/.gitignore +5 -0
  6. package/.idea/MarsCodeWorkspaceAppSettings.xml +6 -0
  7. package/.idea/inspectionProfiles/Project_Default.xml +7 -0
  8. package/.idea/modules.xml +8 -0
  9. package/.idea/testcode.iml +12 -0
  10. package/.idea/vcs.xml +6 -0
  11. package/.idea/watcherTasks.xml +4 -0
  12. package/.idea/workspace.xml +207 -0
  13. package/.npmignore +21 -0
  14. package/.prettierignore +26 -0
  15. package/README.md +2 -0
  16. package/auto-imports.d.ts +137 -0
  17. package/components.d.ts +189 -0
  18. package/dist/assets/index.css +1 -1
  19. package/dist/index.es.js +941 -720
  20. package/dist/types/index.d.ts +8 -8
  21. package/eslint.config.js +37 -0
  22. package/index.html +14 -0
  23. package/package-lock.json +8276 -0
  24. package/package.json +6 -6
  25. package/prettier.config.js +20 -0
  26. package/public/logo.svg +660 -0
  27. package/src/App.vue +11 -0
  28. package/src/api/date_utils.ts +219 -0
  29. package/src/api/finger_utils.ts +71 -0
  30. package/src/api/form_utils.ts +281 -0
  31. package/src/api/jquery.min.js +2 -0
  32. package/src/api/pcas-code.json +1 -0
  33. package/src/api/settings.ts +81 -0
  34. package/src/api/star_horse_apis.ts +196 -0
  35. package/src/api/star_horse_utils.ts +797 -0
  36. package/src/api/system.ts +351 -0
  37. package/src/api/user_func.ts +147 -0
  38. package/src/api/valid_utils.ts +165 -0
  39. package/src/assets/css/index.scss +908 -0
  40. package/src/assets/icons.css +574 -0
  41. package/src/assets/star-horse-icons.woff +0 -0
  42. package/src/components/comp/ShDynamicForm.vue +160 -0
  43. package/src/components/comp/ShForm.vue +30 -0
  44. package/src/components/comp/ShTableListColumn.vue +61 -0
  45. package/src/components/comp/StarHorseDataSelector.vue +139 -0
  46. package/src/components/comp/StarHorseDataView.vue +110 -0
  47. package/src/components/comp/StarHorseDataViewItems.vue +61 -0
  48. package/src/components/comp/StarHorseDataViewTable.vue +102 -0
  49. package/src/components/comp/StarHorseDialog.vue +383 -0
  50. package/src/components/comp/StarHorseDraggable.vue +401 -0
  51. package/src/components/comp/StarHorseForm.vue +458 -0
  52. package/src/components/comp/StarHorseFormItem.vue +82 -0
  53. package/src/components/comp/StarHorseFormList.vue +516 -0
  54. package/src/components/comp/StarHorseFormTable.vue +56 -0
  55. package/src/components/comp/StarHorseIcon.vue +76 -0
  56. package/src/components/comp/StarHorseItem.vue +302 -0
  57. package/src/components/comp/StarHorseJsonEditor.vue +115 -0
  58. package/src/components/comp/StarHorsePopover.vue +66 -0
  59. package/src/components/comp/StarHorseSearchComp.vue +253 -0
  60. package/src/components/comp/StarHorseStaticTable.vue +395 -0
  61. package/src/components/comp/StarHorseTableColumn.vue +249 -0
  62. package/src/components/comp/StarHorseTableComp.vue +1193 -0
  63. package/src/components/comp/StarHorseTableViewColumn.vue +61 -0
  64. package/src/components/comp/StarHorseTree.vue +494 -0
  65. package/src/components/comp/index.ts +22 -0
  66. package/src/components/comp/items/UTableColumn.vue +65 -0
  67. package/src/components/comp/items/boxItem.vue +98 -0
  68. package/src/components/comp/items/callitem.ts +9 -0
  69. package/src/components/comp/items/cardItem.vue +152 -0
  70. package/src/components/comp/items/collapseItem.vue +134 -0
  71. package/src/components/comp/items/dytableItem.vue +135 -0
  72. package/src/components/comp/items/otherItem.vue +65 -0
  73. package/src/components/comp/items/tabItem.vue +155 -0
  74. package/src/components/comp/items/tabPanelItem.vue +110 -0
  75. package/src/components/comp/items/tableColumn.vue +129 -0
  76. package/src/components/comp/items/tableItem.vue +97 -0
  77. package/src/components/comp/items/tablebtn.vue +158 -0
  78. package/src/components/comp/items/viewBoxItem.vue +55 -0
  79. package/src/components/comp/items/viewCardItem.vue +47 -0
  80. package/src/components/comp/items/viewCollapseItem.vue +71 -0
  81. package/src/components/comp/items/viewDytableItem.vue +77 -0
  82. package/src/components/comp/items/viewOtherItem.vue +55 -0
  83. package/src/components/comp/items/viewTabItem.vue +77 -0
  84. package/src/components/comp/items/viewTabPanelItem.vue +54 -0
  85. package/src/components/comp/items/viewTableItem.vue +74 -0
  86. package/src/components/comp/selfcomp.ts +9 -0
  87. package/src/components/comp/utils/DataPicker.vue +302 -0
  88. package/src/components/comp/utils/DataTag.vue +51 -0
  89. package/src/components/cron/Crontab-Day.vue +230 -0
  90. package/src/components/cron/Crontab-Hour.vue +165 -0
  91. package/src/components/cron/Crontab-Min.vue +166 -0
  92. package/src/components/cron/Crontab-Month.vue +166 -0
  93. package/src/components/cron/Crontab-Result.vue +615 -0
  94. package/src/components/cron/Crontab-Second.vue +185 -0
  95. package/src/components/cron/Crontab-Week.vue +208 -0
  96. package/src/components/cron/Crontab-Year.vue +183 -0
  97. package/src/components/cron/Crontab.vue +474 -0
  98. package/src/components/enums/ModuleEnums.ts +10 -0
  99. package/src/components/enums/ServiceEnums.ts +18 -0
  100. package/src/components/formcomp/container/box-container.vue +162 -0
  101. package/src/components/formcomp/container/callitem.ts +9 -0
  102. package/src/components/formcomp/container/card-container.vue +170 -0
  103. package/src/components/formcomp/container/collapse-container.vue +133 -0
  104. package/src/components/formcomp/container/dytable-col.vue +448 -0
  105. package/src/components/formcomp/container/dytable-container.vue +57 -0
  106. package/src/components/formcomp/container/dytableUtils.ts +358 -0
  107. package/src/components/formcomp/container/group-box-container.vue +331 -0
  108. package/src/components/formcomp/container/index.ts +6 -0
  109. package/src/components/formcomp/container/tab-container.vue +153 -0
  110. package/src/components/formcomp/container/table-container.vue +249 -0
  111. package/src/components/formcomp/items/allitem.ts +9 -0
  112. package/src/components/formcomp/items/area-item.vue +116 -0
  113. package/src/components/formcomp/items/audio-item.vue +163 -0
  114. package/src/components/formcomp/items/autocomplete-item.vue +118 -0
  115. package/src/components/formcomp/items/barcode-item.vue +87 -0
  116. package/src/components/formcomp/items/base-json-item.vue +207 -0
  117. package/src/components/formcomp/items/button-item.vue +228 -0
  118. package/src/components/formcomp/items/cascade-item.vue +113 -0
  119. package/src/components/formcomp/items/checkbox-item.vue +97 -0
  120. package/src/components/formcomp/items/color-item.vue +70 -0
  121. package/src/components/formcomp/items/cron-item.vue +115 -0
  122. package/src/components/formcomp/items/datetime-item.vue +99 -0
  123. package/src/components/formcomp/items/depart-item.vue +51 -0
  124. package/src/components/formcomp/items/dialog-input-item.vue +207 -0
  125. package/src/components/formcomp/items/divider-item.vue +66 -0
  126. package/src/components/formcomp/items/html-item.vue +65 -0
  127. package/src/components/formcomp/items/htmleditor-item.vue +104 -0
  128. package/src/components/formcomp/items/icon-item.vue +195 -0
  129. package/src/components/formcomp/items/image-item.vue +247 -0
  130. package/src/components/formcomp/items/index.ts +44 -0
  131. package/src/components/formcomp/items/input-item.vue +150 -0
  132. package/src/components/formcomp/items/json-array-item.vue +67 -0
  133. package/src/components/formcomp/items/json-item.vue +66 -0
  134. package/src/components/formcomp/items/markdown-item.vue +77 -0
  135. package/src/components/formcomp/items/number-item.vue +94 -0
  136. package/src/components/formcomp/items/number-range-item.vue +278 -0
  137. package/src/components/formcomp/items/page-select-item.vue +407 -0
  138. package/src/components/formcomp/items/password-item.vue +71 -0
  139. package/src/components/formcomp/items/qrcode-item.vue +84 -0
  140. package/src/components/formcomp/items/radio-item.vue +112 -0
  141. package/src/components/formcomp/items/rate-item.vue +68 -0
  142. package/src/components/formcomp/items/select-item.vue +133 -0
  143. package/src/components/formcomp/items/signature-item.vue +216 -0
  144. package/src/components/formcomp/items/slider-item.vue +68 -0
  145. package/src/components/formcomp/items/starhorse-form-item.vue +334 -0
  146. package/src/components/formcomp/items/switch-item.vue +77 -0
  147. package/src/components/formcomp/items/tag-item.vue +77 -0
  148. package/src/components/formcomp/items/text-item.vue +75 -0
  149. package/src/components/formcomp/items/textarea-item.vue +85 -0
  150. package/src/components/formcomp/items/time-item.vue +77 -0
  151. package/src/components/formcomp/items/time-picker-item.vue +74 -0
  152. package/src/components/formcomp/items/transfer-item.vue +93 -0
  153. package/src/components/formcomp/items/tselect-item.vue +121 -0
  154. package/src/components/formcomp/items/unknown-item.vue +51 -0
  155. package/src/components/formcomp/items/upload-item.vue +189 -0
  156. package/src/components/formcomp/items/user-item.vue +177 -0
  157. package/src/components/formcomp/items/usercomp-item.vue +85 -0
  158. package/src/components/formcomp/items/view-markdown-item.vue +77 -0
  159. package/src/components/formcomp/utils/EditDataDialog.vue +67 -0
  160. package/src/components/formcomp/utils/FieldList.vue +125 -0
  161. package/src/components/formcomp/utils/ItemRelationEventUtils.ts +284 -0
  162. package/src/components/help.vue +31 -0
  163. package/src/components/menu/MenuItem.vue +95 -0
  164. package/src/components/menu/SubMenu.vue +68 -0
  165. package/src/components/menu/SubSystemMenu.vue +142 -0
  166. package/src/components/register.ts +24 -0
  167. package/src/components/system/ContentMenu.vue +260 -0
  168. package/src/components/system/StarHorseButtonList.vue +344 -0
  169. package/src/components/system/StarHorseMenu.vue +97 -0
  170. package/src/components/system/StarHorseSvg.vue +62 -0
  171. package/src/components/system/SystemComp.ts +9 -0
  172. package/src/components/system/index.ts +4 -0
  173. package/src/components/types/ApiUrls.ts +168 -0
  174. package/src/components/types/BtnAction.ts +51 -0
  175. package/src/components/types/BtnAuth.ts +43 -0
  176. package/src/components/types/CompInfo.ts +81 -0
  177. package/src/components/types/DialogProps.ts +55 -0
  178. package/src/components/types/DyCompField.ts +23 -0
  179. package/src/components/types/DynamicNode.ts +42 -0
  180. package/src/components/types/MenusInfo.ts +45 -0
  181. package/src/components/types/PageFieldInfo.ts +530 -0
  182. package/src/components/types/PageProps.ts +25 -0
  183. package/src/components/types/Params.ts +93 -0
  184. package/src/components/types/RuleType.ts +10 -0
  185. package/src/components/types/SearchProps.ts +42 -0
  186. package/src/components/types/ShortKey.ts +30 -0
  187. package/src/components/types/StarHorseType.ts +18 -0
  188. package/src/components/types/index.ts +15 -0
  189. package/src/config/element.ts +15 -0
  190. package/src/config/styles.ts +4 -0
  191. package/src/index.ts +98 -0
  192. package/src/install.ts +33 -0
  193. package/src/lang/en_US.ts +81 -0
  194. package/src/lang/index.ts +35 -0
  195. package/src/lang/zh_CN.ts +84 -0
  196. package/src/main.ts +57 -0
  197. package/src/plugins/AblesPlugin.ts +618 -0
  198. package/src/plugins/registerCompPlugin.ts +15 -0
  199. package/src/sample/test.vue +9 -0
  200. package/src/store/ButtonPermission.ts +101 -0
  201. package/src/store/ConsumerView.ts +52 -0
  202. package/src/store/ContinusConfig.ts +78 -0
  203. package/src/store/CopyerOperation.ts +74 -0
  204. package/src/store/DesignForm.ts +481 -0
  205. package/src/store/DesignPage.ts +59 -0
  206. package/src/store/DynamicForm.ts +241 -0
  207. package/src/store/GlobalConfig.ts +90 -0
  208. package/src/store/SelfOperation.ts +95 -0
  209. package/src/store/UserInfo.ts +88 -0
  210. package/src/store/index.ts +6 -0
  211. package/src/theme/localStorge.ts +16 -0
  212. package/src/theme/theme.ts +27 -0
  213. package/src/utils/FieldOperationUtils.ts +91 -0
  214. package/src/utils/auth.ts +83 -0
  215. package/src/utils/message.ts +69 -0
  216. package/src/utils/preview.ts +125 -0
  217. package/tsconfig.json +39 -0
  218. package/tsconfig.node.json +10 -0
  219. package/vite-env.d.ts +16 -0
  220. package/vite.config.ts +162 -0
  221. package/yarn.lock +4627 -0
@@ -0,0 +1,1193 @@
1
+ <script lang="ts" setup name="StarHorseTableComp">
2
+ import {Config} from "@/api/settings";
3
+ import {download, postRequest} from "@/api/star_horse_apis";
4
+ import {closeLoad, createCondition, deleteByIds, isJson, load, loadData,} from "@/api/star_horse_utils";
5
+ import {compKey, removeEmptyCondition, uuid} from "@/api/system";
6
+ import Tablebtn from "@/components/comp/items/tablebtn.vue";
7
+ import TableColumn from "@/components/comp/items/tableColumn.vue";
8
+ import Help from "@/components/help.vue";
9
+ import {ApiUrls} from "@/components/types/ApiUrls";
10
+ import {PreValid} from "@/components/types/BtnAuth";
11
+ import {DialogProps} from "@/components/types/DialogProps";
12
+ import {ExpandTable, FieldInfo, OrderByInfo, PageFieldInfo, UserFuncInfo,} from "@/components/types/PageFieldInfo";
13
+ import {PageProps} from "@/components/types/PageProps";
14
+ import {BtnHideCondition, SearchParams} from "@/components/types/Params";
15
+ import piniaInstance from "@/store";
16
+ import {useButtonPermissionStore} from "@/store/ButtonPermission";
17
+ import {useDynamicFormStore} from "@/store/DynamicForm";
18
+ import {useGlobalConfigStore} from "@/store/GlobalConfig";
19
+ import {isSystemManage} from "@/utils/auth";
20
+ import {error, warning} from "@/utils/message";
21
+ import {analysisFields} from "@/utils/preview";
22
+ import Sortable from "sortablejs";
23
+ import {computed, inject, onMounted, PropType, reactive, ref, unref, watch,} from "vue";
24
+
25
+ const dynamicForm = useDynamicFormStore(piniaInstance);
26
+ const props = defineProps({
27
+ //url地址
28
+ compUrl: {type: Object as PropType<ApiUrls | any>, required: true},
29
+ //主键
30
+ primaryKey: {
31
+ type: [String, Object] as PropType<string | any>,
32
+ required: true,
33
+ },
34
+ //列名
35
+ fieldList: {type: Object as PropType<PageFieldInfo>, required: true},
36
+ //按钮隐藏条件
37
+ hideBtnCondition: {
38
+ type: Array as PropType<BtnHideCondition[]>,
39
+ default: [],
40
+ },
41
+ //是否显示批量属性
42
+ showBatchField: {type: Boolean, default: false},
43
+ //格式化方法
44
+ dataFormat: {type: Function, default: null},
45
+ //禁用事件
46
+ disableAction: {type: Boolean, default: false},
47
+ //弹窗模式
48
+ dialogInput: {type: Boolean, default: false},
49
+ //默认表格高度
50
+ height: {type: String, default: "400"},
51
+ //过滤条件
52
+ filterCondition: {type: Array as PropType<SearchParams[]>},
53
+ orderBy: {type: Array as PropType<OrderByInfo[]>},
54
+ //是否显示分页条
55
+ showPageBar: {type: Boolean, default: true},
56
+ //数据列表
57
+ tableDataList: {type: Array},
58
+ //回显数据列表
59
+ reverseDataList: {type: Array},
60
+ //是否运行选择父级节点
61
+ allowSelectParent: {type: Boolean, default: true},
62
+ //默认是否展开所有子节点
63
+ expand: {type: Boolean, default: false},
64
+ //是否需要加载框
65
+ needLoad: {type: Boolean, default: true},
66
+ //标题
67
+ title: {type: String},
68
+ //自定义按钮
69
+ extendBtns: {type: Array as PropType<UserFuncInfo[]>},
70
+ //预检查方法,如果设置了预检查方法,必须要检查通过后,按钮事件才能继续往下执行
71
+ preValidFunc: {type: Object as PropType<Array<PreValid>>, default: {}},
72
+ //多选
73
+ multipleSelect: {type: Boolean, default: false},
74
+ //行高
75
+ lineHeight: {type: String, default: "30px"},
76
+ //显示多选框
77
+ showSelection: {type: Boolean, default: true},
78
+ //扩展表格属性
79
+ expandTable: {type: Object as PropType<ExpandTable>},
80
+ //帮助提示
81
+ helpMsg: {type: String},
82
+ //全局配置,动态页面使用
83
+ globalConfig: {type: Object as PropType<any>, required: false},
84
+ //是否动态页面
85
+ isDynamic: {type: Boolean, default: false},
86
+ //隐藏按钮列表
87
+ hideButtonList: {type: Boolean, default: false},
88
+ /**
89
+ * 数据共享人
90
+ * 拿到别人共享的信息
91
+ * let resultData = await loadData('/system-config/system/dataPermission/currentMenuPermissionPerson', {});
92
+ * 上面接口主要返回共享人的账号
93
+ * commonPersons.value = resultData?.data;
94
+ */
95
+ commonPersons: {type: Array as PropType<any>, default: []},
96
+ //按钮权限
97
+ btnPermissions: {type: Object as PropType<any>, required: false},
98
+ });
99
+ const emits = defineEmits(["selectItem"]);
100
+ let pagePermission = useButtonPermissionStore(piniaInstance);
101
+ let configStore = useGlobalConfigStore(piniaInstance);
102
+ let permissions = ref<any>({});
103
+ const configInfo = computed(() => {
104
+ let data = configStore.configFormInfo;
105
+ showType(data.tableType == "card" ? "list" : "card");
106
+ return data;
107
+ });
108
+ let compSize = computed(
109
+ () => configStore.configFormInfo?.inputSize || Config.compSize,
110
+ );
111
+ const multipleSelection = ref<any>([]);
112
+ const starHorseTableCompRef = ref();
113
+ const baseInfo: PageProps = {
114
+ pageSize: 20,
115
+ currentPage: 1,
116
+ totalData: 0,
117
+ totalPage: 0,
118
+ dataList: [],
119
+ }
120
+ let pageInfo = ref<PageProps>({});
121
+ let searchFields = reactive<Array<SearchParams>>([]);
122
+ let orderBys = reactive<Array<OrderByInfo>>([]);
123
+ let fieldVisible = ref<boolean>(false);
124
+ let dialogProps = inject("dialogProps") as DialogProps;
125
+ let toolFields = reactive<Array<any>>([]);
126
+ const exportOperationVisible = ref<boolean>(false);
127
+ /**
128
+ * 按钮区域派发过来的事件
129
+ * @param authority 权限编码
130
+ */
131
+ const tableCompFunc = (authority: any) => {
132
+ if (authority == "refresh") {
133
+ loadByPage();
134
+ } else if (authority == "batchDelete") {
135
+ batchDelete();
136
+ } else if (authority == "export") {
137
+ exportOperationVisible.value = true;
138
+ } else if (authority == "execution") {
139
+ console.log("你点击了执行按钮");
140
+ }
141
+ };
142
+
143
+ const selectedFields = () => {
144
+ exportData();
145
+ exportOperationVisible.value = false;
146
+ };
147
+ const exportData = () => {
148
+ load("数据处理中");
149
+ let ids: any = getIds();
150
+ let params = [];
151
+ let keys: any = props.primaryKey;
152
+ if (ids.length > 0) {
153
+ if (Array.isArray(keys)) {
154
+ for (let key of keys) {
155
+ let temp: Array<any> = [];
156
+ for (let id in ids) {
157
+ if (id[key]) {
158
+ temp.push(id[key]);
159
+ }
160
+ }
161
+ if (temp.length > 0) {
162
+ params.push(createCondition(key, temp, "in"));
163
+ }
164
+ }
165
+ } else {
166
+ params.push(createCondition(keys, ids, "in"));
167
+ }
168
+ } else {
169
+ params = searchFields;
170
+ }
171
+ if (params.length == 0) {
172
+ params = searchFields;
173
+ }
174
+ let defaultcond: any = removeEmptyCondition(props.compUrl?.condition!);
175
+ if (defaultcond && defaultcond.length > 0) {
176
+ params.push(...defaultcond);
177
+ }
178
+ let condition: any = {
179
+ fieldList: params,
180
+ };
181
+ if (props.fieldList?.orderBy) {
182
+ condition["orderBy"] = props.fieldList.orderBy;
183
+ }
184
+ download(props.compUrl!.exportAllUrl!, condition)
185
+ .catch((err: any) => {
186
+ error("接口不存在或网络异常:" + err);
187
+ })
188
+ .finally(() => {
189
+ closeLoad();
190
+ });
191
+ };
192
+ const getIds = () => {
193
+ let selectDatas = unref(multipleSelection);
194
+ let ids: any = [];
195
+ for (let key in selectDatas) {
196
+ let temp = selectDatas[key];
197
+ ids.push(analysisPrimaryKeys(props.primaryKey, temp));
198
+ }
199
+ return ids;
200
+ };
201
+ /**
202
+ * 批量删除
203
+ */
204
+ const batchDelete = async () => {
205
+ await deleteById(getIds());
206
+ };
207
+ /**
208
+ * 创建查询条件
209
+ * @param formData
210
+ * @param orderBy 排序
211
+ */
212
+ const createSearchParams = (
213
+ formData: SearchParams[],
214
+ orderBy: OrderByInfo[] = [],
215
+ ) => {
216
+ searchFields = formData;
217
+ orderBys = orderBy;
218
+ loadByPage();
219
+ };
220
+ /**
221
+ * 对外导出权限
222
+ */
223
+ const permissionList = () => {
224
+ return permissions.value;
225
+ };
226
+ const init = async () => {
227
+ pageInfo.value = {...baseInfo};
228
+ if (props.btnPermissions && Object.keys(props.btnPermissions).length > 0) {
229
+ permissions.value = props.btnPermissions;
230
+ } else {
231
+ permissions.value = await pagePermission.addRoute(window.__hostRouter__?.currentRoute.value);
232
+ }
233
+ //是否初始化时自动加载列表数据开关
234
+ if (!props.fieldList?.stopAutoLoad) {
235
+ loadByPage();
236
+ } else {
237
+ pageInfo.value.dataList = props.tableDataList || [];
238
+ starHorseTableCompRef.value!.clearSelection();
239
+ //如果有需要回显的数据则需要选中
240
+ //在手动设置选中前,一定要先做清除选中,否则会出现很多重复被选中的情况
241
+ props.reverseDataList?.forEach((item: any) => {
242
+ starHorseTableCompRef.value!.toggleRowSelection(item, true);
243
+ });
244
+ }
245
+ moveColumn();
246
+ reCreateData();
247
+ };
248
+ //监听外面传入数据的变化
249
+ watch(
250
+ () => props.tableDataList,
251
+ (val) => {
252
+ if (props.fieldList?.stopAutoLoad) {
253
+ pageInfo.value.dataList = val;
254
+ }
255
+ },
256
+ {deep: true, immediate: false},
257
+ );
258
+ const assignData = (dataList: Array<any>) => {
259
+ for (let key in dataList) {
260
+ let temp: any = dataList[key];
261
+ if (temp instanceof Array) {
262
+ toolFields.push(...temp);
263
+ } else if (temp.tabList?.length > 0) {
264
+ for (let skey in temp.tabList) {
265
+ let stemp = temp.tabList[skey];
266
+ if (stemp?.fieldList) {
267
+ toolFields.push(...stemp.fieldList);
268
+ }
269
+ }
270
+ } else if (temp.dytableList?.length > 0) {
271
+ for (let skey in temp.dytableList) {
272
+ let stemp = temp.dytableList[skey];
273
+ if (stemp) {
274
+ toolFields.push(...stemp);
275
+ }
276
+ }
277
+ } else {
278
+ toolFields.push(temp);
279
+ }
280
+ }
281
+ };
282
+ const reCreateData = () => {
283
+ toolFields = [];
284
+ let tempList = props.fieldList?.fieldList;
285
+ if (tempList) {
286
+ assignData(tempList);
287
+ }
288
+ };
289
+ const moveColumn = () => {
290
+ const tbody = document.querySelector(
291
+ ".sh-columns .el-table__body-wrapper tbody",
292
+ ) as HTMLElement | null;
293
+ if (tbody) {
294
+ Sortable.create(tbody, {
295
+ handle: ".move",
296
+ animation: 200,
297
+ ghostClass: "ghost",
298
+ onEnd(event: any) {
299
+ const {oldIndex, newIndex} = event;
300
+ if (oldIndex === newIndex) {
301
+ return;
302
+ }
303
+ //再拖动结束位置插入当前行
304
+ // props.fieldList?.fieldList.splice(newIndex, 0, currRow);
305
+ let oitem = props.fieldList?.fieldList[oldIndex];
306
+ let nitem = props.fieldList?.fieldList[newIndex];
307
+ props.fieldList.fieldList[newIndex] = oitem;
308
+ props.fieldList.fieldList[oldIndex] = nitem;
309
+ },
310
+ });
311
+ }
312
+ };
313
+
314
+ const editData = (row: any, _column?: any, evt?: Event) => {
315
+ if (evt) {
316
+ evt.stopPropagation();
317
+ }
318
+ let id = getRowIdentity(row);
319
+ dynamicForm.setDataId(id);
320
+ dynamicForm.setSelectData(row);
321
+ if (!props.dialogInput) {
322
+ viewById(id);
323
+ } else {
324
+ emits("selectItem", row);
325
+ }
326
+ };
327
+ /**
328
+ * 检查是否可以选择父节点
329
+ * @param val
330
+ */
331
+ const checkParent = (val: any) => {
332
+ if (props.allowSelectParent) {
333
+ return true;
334
+ }
335
+ let flag = false;
336
+ for (let i in val) {
337
+ let item = val[i];
338
+ if (item["children"] && item["children"].length > 0) {
339
+ flag = true;
340
+ starHorseTableCompRef.value.toggleRowSelection(item, false);
341
+ }
342
+ }
343
+ if (flag) {
344
+ warning("非叶子节点不能选择");
345
+ return false;
346
+ }
347
+ return true;
348
+ };
349
+ const handleSelectionChange = (val: any) => {
350
+ if (!checkParent(val)) {
351
+ return;
352
+ }
353
+ //如果是弹出选择,没有指定多选 只能选择一条数据
354
+ if (props.dialogInput && !props.multipleSelect) {
355
+ if (val.length <= 1) {
356
+ multipleSelection.value = val;
357
+ } else {
358
+ let keys: any = props.primaryKey;
359
+ if (Array.isArray(keys)) {
360
+ let arr: any = [];
361
+ for (let index in multipleSelection.value) {
362
+ let temp = multipleSelection.value[index];
363
+ let temp1: any = {};
364
+ for (let key of keys) {
365
+ temp1[key] = temp[key];
366
+ }
367
+ arr.push(temp1);
368
+ }
369
+ let filters: Array<any> = [];
370
+ for (let index in val) {
371
+ let temp = val[index];
372
+ for (let sindex in arr) {
373
+ let stemp = arr[sindex];
374
+ let bflag: number = 0;
375
+ for (let skey in stemp) {
376
+ if (temp.hasOwnProperty(skey) && stemp[skey] == temp[skey]) {
377
+ bflag++;
378
+ }
379
+ }
380
+ //如果不相等说明没有相同数据了
381
+ if (bflag != Object.keys(stemp).length) {
382
+ filters.push(temp);
383
+ }
384
+ }
385
+ }
386
+ multipleSelection.value = filters;
387
+ } else {
388
+ let ids = multipleSelection.value.map(
389
+ (item: any) => item[keys],
390
+ ) as Array<any>;
391
+ multipleSelection.value = val.filter(
392
+ (item: any) => !ids.includes(item[keys]),
393
+ );
394
+ }
395
+ let data = multipleSelection.value[0];
396
+ starHorseTableCompRef.value.toggleRowSelection(data, true);
397
+ }
398
+ } else {
399
+ multipleSelection.value = val;
400
+ }
401
+ };
402
+ const getRowIdentity = (row: any) => {
403
+ return analysisPrimaryKeys(props.primaryKey, row) || "";
404
+ };
405
+
406
+ const tbCommonFun = (name: string | undefined, param: any) => {
407
+ let id = analysisPrimaryKeys(props.primaryKey, param);
408
+ if (name == "view") {
409
+ viewById(id);
410
+ } else if (name == "edit") {
411
+ editById(id);
412
+ } else if (name == "delete" || name == "batchDelete") {
413
+ deleteById(id);
414
+ } else {
415
+ console.log("未定义的功能", name);
416
+ }
417
+ return false;
418
+ };
419
+ /**
420
+ * 解析主键
421
+ * @param keys 主键
422
+ * @param row
423
+ */
424
+ const analysisPrimaryKeys = (keys: any, row: any) => {
425
+ if (Array.isArray(keys)) {
426
+ let obj: any = {};
427
+ for (let key of keys) {
428
+ if (isJson(key)) {
429
+ obj[key.dist] = splitKey(key.source, row);
430
+ } else {
431
+ obj[key] = splitKey(key, row);
432
+ }
433
+ }
434
+ return obj;
435
+ } else {
436
+ return splitKey(keys, row);
437
+ }
438
+ };
439
+ const splitKey = (key: string, row: any) => {
440
+ let arr = key?.split(".");
441
+ if (arr?.length > 1) {
442
+ let temp = row;
443
+ for (let i in arr) {
444
+ temp = temp[arr[i]];
445
+ }
446
+ return temp;
447
+ } else {
448
+ return row[key] ?? uuid();
449
+ }
450
+ };
451
+ const viewById = (id: any, isExpand: boolean = false) => {
452
+ dialogProps!.viewVisible = true;
453
+ dialogProps!.ids = id;
454
+ if (isExpand) {
455
+ dialogProps.isExpand = isExpand;
456
+ dialogProps.expandUrl = props.expandTable?.expandUrls;
457
+ }
458
+ };
459
+ /**
460
+ * 编辑数据
461
+ * @param id
462
+ * @param isExpand
463
+ */
464
+ const editById = (id: any, isExpand: boolean = false) => {
465
+ dialogProps!.editVisible = true;
466
+ dialogProps!.ids = id;
467
+ if (isExpand) {
468
+ dialogProps.isExpand = isExpand;
469
+ dialogProps.expandUrl = props.expandTable?.expandUrls;
470
+ }
471
+ };
472
+ /**
473
+ * 删除数据
474
+ * @param id
475
+ * @param isExpand
476
+ */
477
+ const deleteById = async (id: any, isExpand: boolean = false) => {
478
+ let deleteUrl = props.compUrl?.deleteUrl!;
479
+ if (isExpand) {
480
+ deleteUrl = props.expandTable?.expandUrls?.deleteUrl!;
481
+ }
482
+ let flag = await deleteByIds(deleteUrl, Array.isArray(id) ? id : [id]);
483
+ if (flag) {
484
+ loadByPage();
485
+ }
486
+ };
487
+ const pageSizeClick = (pageSize: number) => {
488
+ pageInfo.value.pageSize = pageSize;
489
+ loadByPage();
490
+ };
491
+ const pageChangeClick = (currentPage: number) => {
492
+ pageInfo.value.currentPage = currentPage;
493
+ loadByPage();
494
+ };
495
+ //弹出选择框属性名称
496
+ const inputFieldName = ref<string>("");
497
+ //弹窗选择框属性值
498
+ const inputFieldVal = ref<any>();
499
+ const createParams = () => {
500
+ let searchTemp = [];
501
+ let orderByTemp = JSON.parse(JSON.stringify(orderBys)) || [];
502
+ if (props.filterCondition) {
503
+ searchTemp.push(...props.filterCondition);
504
+ }
505
+ if (props.orderBy) {
506
+ orderByTemp.push(...props.orderBy);
507
+ }
508
+ if (props.fieldList?.orderBy) {
509
+ orderByTemp.push(...props.fieldList.orderBy);
510
+ }
511
+ if (searchFields.length > 0) {
512
+ searchTemp.push(...searchFields);
513
+ }
514
+ let condition: any = removeEmptyCondition(props.compUrl?.condition!);
515
+ if (condition && condition.length > 0) {
516
+ searchTemp.push(...condition);
517
+ }
518
+ //加入共享人的信息
519
+ if (props.commonPersons?.length && !isSystemManage()) {
520
+ searchTemp.push(createCondition("a.createdBy", props.commonPersons, "in"));
521
+ }
522
+ if (!props.compUrl?.pageListUrl) {
523
+ return;
524
+ }
525
+ let params: any = {
526
+ currentPage: pageInfo.value.currentPage,
527
+ pageSize: pageInfo.value.pageSize,
528
+ fieldList: searchTemp,
529
+ orderBy: orderByTemp,
530
+ };
531
+ return params;
532
+ };
533
+ /**
534
+ * 分页显示数据
535
+ * @param initPageInfo 是否初始化分页信息
536
+ */
537
+ const loadByPage = (initPageInfo?: boolean) => {
538
+ if (initPageInfo) {
539
+ pageInfo.value = {...baseInfo};
540
+ }
541
+ let url: string = props.compUrl?.pageListUrl as string;
542
+ let params: any = createParams();
543
+ if (props.compUrl?.redirect) {
544
+ params = {
545
+ url,
546
+ host: props.compUrl?.host,
547
+ port: props.compUrl?.port,
548
+ protocol: props.compUrl?.protocol,
549
+ env: props.compUrl?.env,
550
+ httpMethod: props.compUrl?.httpMethod || "POST",
551
+ dataType: props.compUrl?.dataType || "JSON",
552
+ searchInfo: params,
553
+ };
554
+ url = "/system-config/redirect/pageList";
555
+ }
556
+ if (props.needLoad) {
557
+ load("数据加载中");
558
+ }
559
+ postRequest(url, params)
560
+ .then((res: any) => {
561
+ if (res?.data?.code != 0) {
562
+ res && console.error(res?.data?.cnMessage);
563
+ return;
564
+ }
565
+ let redata = res?.data?.data;
566
+ //如果不是分页之间显示返回的所有数据
567
+ pageInfo.value.dataList = redata?.dataList || redata;
568
+ if (props.dialogInput) {
569
+ filterData();
570
+ }
571
+ pageInfo.value.totalPage = redata?.totalPages;
572
+ pageInfo.value.totalData = redata?.totalDatas;
573
+ })
574
+ .catch((err: any) => {
575
+ console.log(err);
576
+ })
577
+ .finally(() => {
578
+ closeLoad();
579
+ });
580
+ };
581
+ const filterData = () => {
582
+ let name = unref(inputFieldName) as string;
583
+ if (pageInfo.value.dataList && name && inputFieldVal.value) {
584
+ let row = pageInfo.value.dataList.find(
585
+ (item: any) => item[name] == inputFieldVal.value,
586
+ );
587
+ if (row) {
588
+ multipleSelection.value.push(row);
589
+ starHorseTableCompRef.value.toggleRowSelection(row, true);
590
+ }
591
+ }
592
+ };
593
+ const setDataInfo = (fieldName: string, val: any) => {
594
+ multipleSelection.value = [];
595
+ inputFieldName.value = fieldName;
596
+ inputFieldVal.value = val;
597
+ filterData();
598
+ };
599
+ /**
600
+ * 单选选择行
601
+ * @param row
602
+ * @param column
603
+ * @param evt
604
+ */
605
+ const selectRow = (row: any, _column?: any, evt?: Event) => {
606
+ if (!evt) {
607
+ dynamicForm.setSelectData(row);
608
+ emits("selectItem", row);
609
+ return;
610
+ }
611
+ evt.stopPropagation();
612
+ if (!checkParent(row)) {
613
+ return;
614
+ }
615
+ //展开/折叠
616
+ if (props.expandTable) {
617
+ starHorseTableCompRef.value.toggleRowExpansion(row);
618
+ }
619
+ if (multipleSelection.value?.length > 0) {
620
+ for (let valueElement of multipleSelection.value) {
621
+ starHorseTableCompRef.value.toggleRowSelection(valueElement);
622
+ }
623
+ }
624
+ const selected = multipleSelection.value?.some(
625
+ (item: any) => item[props.primaryKey] === row[props.primaryKey],
626
+ );
627
+ if (!selected) {
628
+ multipleSelection.value.push(row);
629
+ starHorseTableCompRef.value.toggleRowSelection(row, true);
630
+ } else {
631
+ multipleSelection.value = multipleSelection.value?.filter((item: any) => {
632
+ return item[props.primaryKey] !== row[props.primaryKey];
633
+ });
634
+ starHorseTableCompRef.value.toggleRowSelection(row, false);
635
+ }
636
+ dynamicForm.setSelectData(row);
637
+ emits("selectItem", row);
638
+ };
639
+
640
+
641
+ /**
642
+ * 扩展按钮
643
+ */
644
+ const extendBtnFunction = (): Array<UserFuncInfo> => {
645
+ let arr: Array<UserFuncInfo> = [];
646
+ const extendBtnsCopy: UserFuncInfo[] = props.extendBtns ?? [];
647
+
648
+ //单独定义的按钮
649
+ extendBtnsCopy?.forEach((item: UserFuncInfo) => {
650
+ if (item.position != "toolbar") {
651
+ if (!item.funcName) {
652
+ item.funcName = (row: any) => tbCommonFun(item.authority, row);
653
+ }
654
+ arr.push(item);
655
+ }
656
+ });
657
+ //在定义字段时定义的按钮
658
+ props.fieldList["userTableFuncs"]?.forEach((item: UserFuncInfo) => {
659
+ if (item.position != "toolbar") {
660
+ if (!item.funcName) {
661
+ item.funcName = (row: any) => tbCommonFun(item.authority, row);
662
+ }
663
+ arr.push(item);
664
+ }
665
+ });
666
+ if (!props.disableAction) {
667
+ let edit = arr.filter((item) => item.authority == "edit")?.length;
668
+ if (!edit) {
669
+ arr.push({
670
+ authority: "edit",
671
+ btnName: "编辑",
672
+ icon: "edit",
673
+ priority: 10,
674
+ funcName: (row: any) => tbCommonFun("edit", row),
675
+ });
676
+ }
677
+ let view = arr.filter((item) => item.authority == "view")?.length;
678
+ if (!view) {
679
+ arr.push({
680
+ authority: "view",
681
+ btnName: "查看",
682
+ priority: 20,
683
+ icon: "data-view",
684
+ funcName: (row: any) => tbCommonFun("view", row),
685
+ });
686
+ }
687
+ let del = arr.filter((item) => item.authority == "delete")?.length;
688
+ if (!del) {
689
+ arr.push({
690
+ authority: "delete",
691
+ btnName: "删除",
692
+ priority: 30,
693
+ icon: "delete",
694
+ funcName: (row: any) => tbCommonFun("delete", row),
695
+ });
696
+ }
697
+ }
698
+ //如果没有指定优先级,排序时就按照默认累加方式处理
699
+ arr.sort(
700
+ (a: UserFuncInfo, b: UserFuncInfo) =>
701
+ (a.priority || 40) - (b.priority || 40),
702
+ );
703
+ return arr;
704
+ };
705
+ // 修改后
706
+ const buttonList = computed(() => extendBtnFunction());
707
+ /**
708
+ * 扩展表的操作
709
+ * @param name 事件条件
710
+ * @param row 当前节点的数据
711
+ * @param parentRow 父节点的数据
712
+ */
713
+ const expandCommonFun = (name: string, row: any, parentRow: any) => {
714
+ let id = analysisPrimaryKeys(props.expandTable?.primaryKey, row);
715
+ for (let key in id) {
716
+ if (!id[key]) {
717
+ id[key] = parentRow[key];
718
+ }
719
+ }
720
+ //如果在当前行数据没有找到对应的字段,再从父级进行查找
721
+ if (name == "view") {
722
+ viewById(id, true);
723
+ } else if (name == "edit") {
724
+ editById(id, true);
725
+ } else if (name == "delete") {
726
+ deleteById(id, true);
727
+ }
728
+ };
729
+ /**
730
+ * 借助列表组件获取需要的数据
731
+ * @param limitSize 需要加载的数据
732
+ * @param url 请求的Url,如果为空,则使用getAllByCondition接口
733
+ * @param usePageCondition 是否使用分页查询的条件
734
+ * @param params 查询参数
735
+ * @param orderBys 排序
736
+ */
737
+ const getDatas = async (
738
+ limitSize: number = 0,
739
+ params: SearchParams[] = [],
740
+ orderBys: OrderByInfo[] = [],
741
+ url: string = "",
742
+ usePageCondition: boolean = true,
743
+ ) => {
744
+ let tempSearchParams: SearchParams[] = [];
745
+ if (usePageCondition) {
746
+ let temp = createParams();
747
+ tempSearchParams.push(...temp.fieldList);
748
+ orderBys.push(...temp.orderBy);
749
+ }
750
+ if (params && params.length > 0) {
751
+ tempSearchParams.push(...params);
752
+ }
753
+ let result = await loadData(url || props.compUrl?.listConditionUrl!, {
754
+ limits: limitSize,
755
+ fieldList: tempSearchParams,
756
+ orderBy: orderBys,
757
+ });
758
+ if (result.error) {
759
+ warning("数据加载异常:" + result.error);
760
+ }
761
+ return result.data;
762
+ };
763
+
764
+ let dataShowType = ref<string>("list");
765
+ let cardFieldList = ref<FieldInfo[]>([]);
766
+ const loadField = (): FieldInfo[] => {
767
+ let {fieldList} = analysisFields(props.fieldList?.fieldList);
768
+ if (fieldList) {
769
+ fieldList.sort(
770
+ (a: FieldInfo, b: FieldInfo) => (a.priority || 100) - (b.priority || 100),
771
+ );
772
+ return fieldList.filter((item) => item.listVisible)?.slice(0, 3);
773
+ }
774
+ return [];
775
+ };
776
+ let typeTitle = ref<string>("切换为卡片模式");
777
+ let typeIcon = ref<string>("card1");
778
+
779
+ /**
780
+ * 数据展示风格
781
+ * @param type
782
+ */
783
+ const showType = (type: string) => {
784
+ type = type == "card" ? "list" : "card";
785
+ dataShowType.value = type;
786
+ if (type == "card" && cardFieldList.value.length == 0) {
787
+ cardFieldList.value = loadField();
788
+ }
789
+ if (type == "card") {
790
+ typeTitle.value = "切换为列表模式";
791
+ typeIcon.value = "list";
792
+ } else {
793
+ typeTitle.value = "切换为卡片模式";
794
+ typeIcon.value = "card1";
795
+ }
796
+ };
797
+ const getSelectedDatas = () => {
798
+ return multipleSelection.value;
799
+ };
800
+ onMounted(() => {
801
+ init();
802
+ });
803
+ //导出方法和变量
804
+ defineExpose({
805
+ init,
806
+ //查询
807
+ createSearchParams,
808
+ loadByPage,
809
+ getIds,
810
+ getSelectedDatas,
811
+ multipleSelection,
812
+ setDataInfo,
813
+ //按钮事件
814
+ tableCompFunc,
815
+ getDatas,
816
+ permissionList,
817
+ });
818
+ </script>
819
+ <template>
820
+ <!--导出数据指定字段-->
821
+ <star-horse-dialog
822
+ :isShowBtnContinue="false"
823
+ :selfFunc="true"
824
+ @merge="selectedFields"
825
+ :dialogVisible="exportOperationVisible"
826
+ @closeAction="exportOperationVisible = false"
827
+ >
828
+ 功能开发中,现在点击提交按钮导出所有数据
829
+ </star-horse-dialog>
830
+ <div class="star-horse-table">
831
+ <div
832
+ class="flex w-full justify-between"
833
+ style="border-bottom: var(--star-horse-style) 1px solid"
834
+ v-if="!dialogInput"
835
+ >
836
+ <div class="tb_title">
837
+ <div v-if="title || helpMsg">
838
+ <help :message="helpMsg" v-if="helpMsg"/>
839
+ <star-horse-icon
840
+ icon-class="info"
841
+ v-else
842
+ size="14px"
843
+ style="font-weight: bold; color: var(--star-horse-style)"
844
+ />
845
+ {{ title }}
846
+ </div>
847
+ <star-horse-button-list
848
+ @tableCompFunc="(fun: any) => tableCompFunc(fun)"
849
+ :compUrl="compUrl"
850
+ :btnPermissions="permissions"
851
+ :extendBtns="extendBtns"
852
+ :dialogProps="dialogProps"
853
+ :preValidFunc="preValidFunc"
854
+ v-if="!hideButtonList"
855
+ />
856
+ </div>
857
+ <div class="flex items-center flex-row-reverse">
858
+ <star-horse-icon
859
+ title="刷新"
860
+ @click="loadByPage"
861
+ icon-class="refresh"
862
+ style="cursor: pointer; color: var(--star-horse-style)"
863
+ />
864
+ <el-popover
865
+ v-if="dataShowType == 'list'"
866
+ trigger="click"
867
+ :popper-style="{ width: 'unset !important' }"
868
+ placement="left-end"
869
+ >
870
+ <template #reference>
871
+ <star-horse-icon
872
+ @click="fieldVisible = !fieldVisible"
873
+ title="显示/隐藏列"
874
+ icon-class="setting"
875
+ style="color: var(--star-horse-style); cursor: pointer"
876
+ />
877
+ </template>
878
+ <el-table
879
+ class="sh-columns"
880
+ ref="table"
881
+ :data="toolFields"
882
+ :strip="true"
883
+ :fit="true"
884
+ :highlight-current-row="true"
885
+ max-height="400px"
886
+ row-key="prop"
887
+ style="width: 100%"
888
+ :size="compSize"
889
+ border
890
+ >
891
+ <el-table-column prop="" label="排序" width="60">
892
+ <el-tag class="move" style="cursor: move">
893
+ <el-icon style="cursor: move">
894
+ <Sort/>
895
+ </el-icon>
896
+ </el-tag>
897
+ </el-table-column>
898
+ <el-table-column
899
+ prop="label"
900
+ label="列名"
901
+ :show-overflow-tooltip="true"
902
+ >
903
+ <template #default="scope">
904
+ <el-tag
905
+ round
906
+ :effect="scope.row.listVisible ? 'dark' : 'light'"
907
+ :size="compSize"
908
+ >
909
+ {{ scope.row.label }}
910
+ </el-tag>
911
+ </template>
912
+ </el-table-column>
913
+ <el-table-column prop="listVisible" label="显示/隐藏" width="100">
914
+ <template #default="scope">
915
+ <el-switch
916
+ v-model="scope.row.listVisible"
917
+ :size="compSize"
918
+ :active-value="true"
919
+ :inactive-value="false"
920
+ />
921
+ </template>
922
+ </el-table-column>
923
+ </el-table>
924
+ </el-popover>
925
+ <star-horse-icon
926
+ @click="showType(dataShowType)"
927
+ :title="typeTitle"
928
+ :icon-class="typeIcon"
929
+ style="cursor: pointer; color: var(--star-horse-style)"
930
+ />
931
+ </div>
932
+ </div>
933
+ <div class="data-list-area" v-if="dataShowType == 'list'">
934
+ <el-table
935
+ ref="starHorseTableCompRef"
936
+ :data="pageInfo.dataList"
937
+ @selection-change="handleSelectionChange"
938
+ @row-click="selectRow"
939
+ @row-dblclick="editData"
940
+ :row-key="getRowIdentity"
941
+ :stripe="true"
942
+ :fit="true"
943
+ :size="compSize"
944
+ :min-height="height"
945
+ :highlight-current-row="true"
946
+ :default-expand-all="expand"
947
+ :row-style="{ height: lineHeight }"
948
+ :cell-style="{ height: lineHeight, 'font-size': '12px' }"
949
+ :header-cell-style="{
950
+ background: '#f2f2f2',
951
+ color: '#707070',
952
+ 'font-size': '13px',
953
+ 'background-image':
954
+ '-webkit-gradient(linear,left 0,left 100%,from(#f8f8f8),to(#ececec))',
955
+ }"
956
+ border
957
+ >
958
+ <el-table-column
959
+ type="selection"
960
+ align="center"
961
+ fixed="left"
962
+ :reserve-selection="true"
963
+ v-if="showSelection"
964
+ />
965
+ <el-table-column type="expand" v-if="expandTable">
966
+ <template #default="scope">
967
+ <div class="expand-table">
968
+ <h4>{{ expandTable.title }}</h4>
969
+ <el-table
970
+ :data="scope.row[expandTable.dataField]"
971
+ :row-key="getRowIdentity"
972
+ :stripe="true"
973
+ :fit="true"
974
+ :size="compSize"
975
+ :highlight-current-row="true"
976
+ :max-height="'400px'"
977
+ :row-style="{ height: '30px' }"
978
+ :cell-style="{ height: '30px', 'font-size': '12px' }"
979
+ border
980
+ >
981
+ <el-table-column
982
+ fixed="left"
983
+ label="操作"
984
+ :width="160"
985
+ v-if="
986
+ expandTable.showButton && expandTable.extendFuncs.length > 0
987
+ "
988
+ >
989
+ <template #default="innerScope">
990
+ <template
991
+ v-for="epd in expandTable.extendFuncs"
992
+ :key="compKey(epd, epd.authority)"
993
+ >
994
+ <el-tooltip :content="epd.btnName">
995
+ <star-horse-icon
996
+ v-if="permissions[epd.authority!]"
997
+ @click="
998
+ expandCommonFun(
999
+ epd.authority!,
1000
+ innerScope.row,
1001
+ scope.row,
1002
+ )
1003
+ "
1004
+ :icon-class="epd.icon || 'edit'"
1005
+ style="cursor: pointer"
1006
+ :color="
1007
+ epd.authority == 'delete'
1008
+ ? 'var(--el-color-danger)'
1009
+ : 'var(--star-horse-style)'
1010
+ "
1011
+ />
1012
+ </el-tooltip>
1013
+ </template>
1014
+ </template>
1015
+ </el-table-column>
1016
+ <table-column
1017
+ :fieldList="expandTable"
1018
+ :compSize="configInfo.inputSize"
1019
+ :compUrl="compUrl"
1020
+ :dataFormat="dataFormat"
1021
+ :sortable="false"
1022
+ :globalConfig="globalConfig"
1023
+ :isDynamic="isDynamic"
1024
+ :showBatchField="showBatchField"
1025
+ />
1026
+ </el-table>
1027
+ </div>
1028
+ </template>
1029
+ </el-table-column>
1030
+ <table-column
1031
+ :fieldList="fieldList"
1032
+ :compSize="configInfo.inputSize"
1033
+ :compUrl="compUrl"
1034
+ :dataFormat="dataFormat"
1035
+ :globalConfig="globalConfig"
1036
+ :isDynamic="isDynamic"
1037
+ :showBatchField="showBatchField"
1038
+ />
1039
+ <el-table-column
1040
+ v-if="
1041
+ buttonList.length > 0 && Object.keys(permissions || {}).length > 0
1042
+ "
1043
+ fixed="right"
1044
+ label="操作"
1045
+ :width="buttonList.length > 3 ? 160 : 110"
1046
+ >
1047
+ <template #default="scope">
1048
+ <tablebtn
1049
+ :row="scope.row"
1050
+ :permissions="permissions"
1051
+ :buttonList="buttonList"
1052
+ :hideBtnCondition="hideBtnCondition"
1053
+ :compSize="compSize"
1054
+ />
1055
+ </template>
1056
+ </el-table-column>
1057
+ </el-table>
1058
+ </div>
1059
+ <div class="data-card-area" v-else>
1060
+ <el-scrollbar height="100%">
1061
+ <el-space wrap>
1062
+ <el-card
1063
+ v-for="(data, key) in pageInfo.dataList"
1064
+ :key="compKey(data, key)"
1065
+ class="box-card"
1066
+ style="width: 250px !important; height: 180px !important"
1067
+ shadow="hover"
1068
+ >
1069
+ <template #header>
1070
+ <div
1071
+ class="card-header"
1072
+ @click="selectRow(data)"
1073
+ @dblclick="editData(data)"
1074
+ >
1075
+ <span>{{
1076
+ dataFormat(
1077
+ cardFieldList[0]?.fieldName,
1078
+ data[cardFieldList[0]?.fieldName],
1079
+ data,
1080
+ )
1081
+ }}</span>
1082
+ </div>
1083
+ </template>
1084
+
1085
+ <div
1086
+ class="card-item item"
1087
+ style="width: 99%; margin: 1px auto"
1088
+ :Key="compKey(item, key)"
1089
+ v-for="(item, key) in cardFieldList?.slice(1, 3)"
1090
+ >
1091
+ <label>{{ item.label }} :</label>
1092
+ <div
1093
+ class="content"
1094
+ @click="selectRow(data)"
1095
+ @dblclick="editData(data)"
1096
+ >
1097
+ <el-tooltip
1098
+ :content="
1099
+ dataFormat(item.fieldName, data[item.fieldName], data)
1100
+ "
1101
+ >
1102
+ {{ dataFormat(item.fieldName, data[item.fieldName], data) }}
1103
+ </el-tooltip>
1104
+ </div>
1105
+ </div>
1106
+ <template #footer>
1107
+ <tablebtn
1108
+ :row="data"
1109
+ :permissions="permissions"
1110
+ :buttonList="buttonList"
1111
+ :showLimit="6"
1112
+ :hideBtnCondition="hideBtnCondition"
1113
+ :compSize="compSize"
1114
+ />
1115
+ </template>
1116
+ </el-card>
1117
+ </el-space>
1118
+ </el-scrollbar>
1119
+ </div>
1120
+
1121
+ <el-pagination
1122
+ v-if="showPageBar"
1123
+ :total="pageInfo.totalData"
1124
+ @current-change="pageChangeClick"
1125
+ @size-change="pageSizeClick"
1126
+ :size="compSize"
1127
+ :page-sizes="[20, 50, 100, 200, 300, 400]"
1128
+ layout="total, sizes, prev, pager, next, jumper,slot"
1129
+ v-model:currentPage="pageInfo.currentPage"
1130
+ v-model:page-size="pageInfo.pageSize"
1131
+ v-model:pageCount="pageInfo.totalPage"
1132
+ >
1133
+ <el-button text icon="refresh" :size="compSize" @click="loadByPage" title="刷新"/>
1134
+ </el-pagination>
1135
+ </div>
1136
+ </template>
1137
+ <style lang="scss" scoped>
1138
+ .star-horse-table {
1139
+ height: 100%;
1140
+ display: flex;
1141
+ flex-direction: column;
1142
+ overflow: hidden;
1143
+ width: 100%;
1144
+
1145
+ .data-list-area,
1146
+ .data-card-area {
1147
+ display: flex;
1148
+ overflow: hidden;
1149
+ flex-direction: column;
1150
+ flex: 1;
1151
+ }
1152
+
1153
+ .data-card-area {
1154
+ margin: 5px;
1155
+ width: 99%;
1156
+ }
1157
+ }
1158
+
1159
+ .expand-table {
1160
+ width: 100%;
1161
+ margin: 10px auto;
1162
+
1163
+ h4 {
1164
+ display: block;
1165
+ margin: 10px;
1166
+ }
1167
+ }
1168
+
1169
+ .warning-row {
1170
+ background: var(--star-horse-shadow);
1171
+ }
1172
+
1173
+ :deep(.el-table__cell) {
1174
+ padding: 0;
1175
+ }
1176
+
1177
+ :deep(th.el-table__cell:first-child) {
1178
+ padding: 5px 0;
1179
+ }
1180
+
1181
+ .tb_title {
1182
+ display: flex;
1183
+ align-items: center;
1184
+ flex-direction: row;
1185
+ flex: 1;
1186
+ color: var(--star-horse-style);
1187
+ }
1188
+
1189
+ :deep(.el-card__footer) {
1190
+ padding: 5px 20px;
1191
+ display: flex;
1192
+ }
1193
+ </style>