hlq-cli 1.0.0

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 (88) hide show
  1. package/README.md +18 -0
  2. package/bin/index.js +16 -0
  3. package/lib/aesCreate.js +11 -0
  4. package/lib/axiosCreate.js +11 -0
  5. package/lib/create.js +172 -0
  6. package/lib/echartCreate.js +12 -0
  7. package/lib/jwtDecodeCreate.js +16 -0
  8. package/lib/rsaCreate.js +11 -0
  9. package/lib/stateCreate.js +34 -0
  10. package/lib/websocketCreate.js +16 -0
  11. package/package.json +21 -0
  12. package/templates/.env +1 -0
  13. package/templates/.env.dev +2 -0
  14. package/templates/.env.pro +2 -0
  15. package/templates/index.html +15 -0
  16. package/templates/package-lock.json +4058 -0
  17. package/templates/package.json +31 -0
  18. package/templates/public/config.js +1 -0
  19. package/templates/public/font/iconfont.css +579 -0
  20. package/templates/public/font/iconfont.js +1 -0
  21. package/templates/public/font/iconfont.ttf +0 -0
  22. package/templates/public/font/iconfont.woff +0 -0
  23. package/templates/public/font/iconfont.woff2 +0 -0
  24. package/templates/src/App.vue +35 -0
  25. package/templates/src/components/chart/barChart.vue +103 -0
  26. package/templates/src/components/chart/color.ts +43 -0
  27. package/templates/src/components/chart/lineChart.vue +114 -0
  28. package/templates/src/components/chart/mapChart.vue +135 -0
  29. package/templates/src/components/chart/mixedChart.vue +148 -0
  30. package/templates/src/components/chart/pieChart.vue +104 -0
  31. package/templates/src/components/chart/radarChart.vue +112 -0
  32. package/templates/src/components/chart/scatterChart.vue +144 -0
  33. package/templates/src/components/chart/sunburstChart.vue +183 -0
  34. package/templates/src/components/descript/index.vue +45 -0
  35. package/templates/src/components/dialog/index.vue +54 -0
  36. package/templates/src/components/drawer/index.vue +53 -0
  37. package/templates/src/components/form/component/cascader.vue +65 -0
  38. package/templates/src/components/form/component/checkbox.vue +31 -0
  39. package/templates/src/components/form/component/datePicker.vue +39 -0
  40. package/templates/src/components/form/component/dateRange.vue +36 -0
  41. package/templates/src/components/form/component/datetimePicker.vue +25 -0
  42. package/templates/src/components/form/component/fileUpload.vue +80 -0
  43. package/templates/src/components/form/component/formFun.ts +132 -0
  44. package/templates/src/components/form/component/imageUpload.vue +92 -0
  45. package/templates/src/components/form/component/input.vue +41 -0
  46. package/templates/src/components/form/component/location.vue +79 -0
  47. package/templates/src/components/form/component/radio.vue +31 -0
  48. package/templates/src/components/form/component/select.vue +66 -0
  49. package/templates/src/components/form/component/textarea.vue +26 -0
  50. package/templates/src/components/form/component/timePicker.vue +28 -0
  51. package/templates/src/components/form/component/upload.ts +20 -0
  52. package/templates/src/components/form/formInterface.ts +115 -0
  53. package/templates/src/components/form/index.vue +193 -0
  54. package/templates/src/components/form/item.vue +323 -0
  55. package/templates/src/components/groupForm/index.vue +91 -0
  56. package/templates/src/components/icon/index.vue +29 -0
  57. package/templates/src/components/layout/header.vue +238 -0
  58. package/templates/src/components/layout/index.vue +167 -0
  59. package/templates/src/components/layout/menu.vue +130 -0
  60. package/templates/src/components/layout/sideBarItem.vue +49 -0
  61. package/templates/src/components/searchBox/height.ts +9 -0
  62. package/templates/src/components/searchBox/index.vue +265 -0
  63. package/templates/src/components/table/index.vue +371 -0
  64. package/templates/src/components/table/table.ts +23 -0
  65. package/templates/src/components/tree/index.vue +222 -0
  66. package/templates/src/components/tree/lazyTree.vue +136 -0
  67. package/templates/src/data.d.ts +4 -0
  68. package/templates/src/main.ts +18 -0
  69. package/templates/src/router/index.ts +60 -0
  70. package/templates/src/store/menuInterface.ts +10 -0
  71. package/templates/src/store/permission.ts +59 -0
  72. package/templates/src/store/user.ts +24 -0
  73. package/templates/src/utils/alioss/index.ts +0 -0
  74. package/templates/src/utils/axios/http.ts +99 -0
  75. package/templates/src/utils/axios/index.ts +112 -0
  76. package/templates/src/utils/axios/service.ts +8 -0
  77. package/templates/src/utils/crypto/index.ts +28 -0
  78. package/templates/src/utils/rsa/index.ts +18 -0
  79. package/templates/src/utils/token/index.ts +6 -0
  80. package/templates/src/utils/tree/index.ts +74 -0
  81. package/templates/src/utils/websocket/index.ts +136 -0
  82. package/templates/src/views/login/index.vue +248 -0
  83. package/templates/src/views/templete/table.vue +122 -0
  84. package/templates/src/views/templete/tableConfig.ts +153 -0
  85. package/templates/tsconfig.app.json +19 -0
  86. package/templates/tsconfig.json +7 -0
  87. package/templates/tsconfig.node.json +23 -0
  88. package/templates/vite.config.ts +34 -0
@@ -0,0 +1,9 @@
1
+ export const HeightMap: { [key: string]: number } = {
2
+ input: 40,
3
+ select: 40,
4
+ date: 40,
5
+ time: 40,
6
+ cascader: 40,
7
+ treeSelect: 40,
8
+ textarea: 52,
9
+ }
@@ -0,0 +1,265 @@
1
+ <template>
2
+ <div class="searchBox" ref="searchBoxRef">
3
+ <div
4
+ class="cardBox"
5
+ :class="state.showMore ? 'showMoreBox' : ''"
6
+ :style="state.showMore ? { height: listHeight + 'px' } : {}"
7
+ >
8
+ <div class="row">
9
+ <div
10
+ :style="`width: calc(100% / ${layoutMax} - 12px);`"
11
+ class="searchItem"
12
+ v-for="item in showList"
13
+ :key="item.key"
14
+ >
15
+ <div class="label">{{ item.label }}</div>
16
+ <div class="content">
17
+ <SearchItem
18
+ :config="item"
19
+ :formData="state.searchData"
20
+ @enter="search"
21
+ :onlyRead="false"
22
+ ></SearchItem>
23
+ </div>
24
+ </div>
25
+ <div
26
+ :style="`width: calc(100% / ${layoutMax} - 12px);justify-content: flex-start;`"
27
+ class="searchItem"
28
+ v-if="buttonShowRow"
29
+ >
30
+ <div class="button">
31
+ <el-button
32
+ @click="search"
33
+ v-if="showList.length > 0"
34
+ type="primary"
35
+ >
36
+ 查询
37
+ </el-button>
38
+ <el-button @click="reset" v-if="showList.length > 0">
39
+ 重置
40
+ </el-button>
41
+ </div>
42
+ </div>
43
+ </div>
44
+ <div
45
+ class="searchItem"
46
+ v-for="item in otherList"
47
+ :key="item.key"
48
+ :style="`width: calc(100% / ${layoutMax} - 12px);`"
49
+ >
50
+ <div class="label ellipsis">{{ item.label }}</div>
51
+ <div class="content">
52
+ <SearchItem
53
+ :config="item"
54
+ :formData="state.searchData"
55
+ @enter="search"
56
+ :onlyRead="false"
57
+ ></SearchItem>
58
+ </div>
59
+ </div>
60
+ </div>
61
+ <div v-if="!buttonShowRow" class="openMoreBox">
62
+ <div class="button">
63
+ <el-button @click="search" v-if="showList.length > 0" type="primary">
64
+ 查询
65
+ </el-button>
66
+ <el-button @click="reset" v-if="showList.length > 0"> 重置 </el-button>
67
+ <div
68
+ class="openMoreText"
69
+ v-if="otherList.length"
70
+ @click="state.showMore = !state.showMore"
71
+ >
72
+ {{ state.showMore ? '收起' : '展开' }}
73
+ </div>
74
+ </div>
75
+ </div>
76
+ </div>
77
+ </template>
78
+ <script lang="ts" setup>
79
+ import { computed, onMounted, reactive, ref, watch } from 'vue'
80
+ import SearchItem from '@/components/form/item.vue'
81
+ import { chunk } from 'lodash'
82
+ import { HeightMap } from './height'
83
+ interface extraItem extends selectItem {
84
+ code: string
85
+ label: string
86
+ }
87
+ interface Props {
88
+ config: SearchItemConfig[]
89
+ /** 传入时固定一行「格子」数量(含查询按钮列),覆盖按宽度自动计算;不传则保持原逻辑 */
90
+ max?: number
91
+ extraList?: extraItem[] | null
92
+ buttonControl?: boolean // 是否控制按钮显隐
93
+ buttonList?: Array<any> // 可显示按钮列表
94
+ permission?: any
95
+ onlyRead?: boolean // 是否只读
96
+ }
97
+ const props = withDefaults(defineProps<Props>(), {
98
+ extraList: null,
99
+ buttonControl: false,
100
+ })
101
+ const searchBoxRef = ref()
102
+ /** 未传 max 时由挂载后宽度计算得到,与改造前 state.max 一致 */
103
+ const state = reactive({
104
+ searchData: {},
105
+ showMore: false,
106
+ autoMax: 3,
107
+ })
108
+ // 按钮是否与搜索项同行
109
+ // 有展开按钮时增加一行
110
+ const buttonShowRow = computed(() => {
111
+ return props.config.length <= layoutMax.value - 1
112
+ })
113
+ const layoutMax = computed(() => Math.max(2, props.max ?? state.autoMax))
114
+ // 默认展示的搜索项
115
+ const showList = computed(() => {
116
+ if (buttonShowRow.value) return props.config
117
+ return props.config.slice(0, layoutMax.value)
118
+ })
119
+ // 展开后展示的搜索项
120
+ const otherList = computed(() => {
121
+ return props.config.slice(layoutMax.value)
122
+ })
123
+ const listHeight = computed(() => {
124
+ // 数组切割
125
+ const chunkedArray = chunk(props.config, layoutMax.value - 1)
126
+ let heightSum = 0
127
+ chunkedArray.forEach((chunk) => {
128
+ let MaxHeight = 0
129
+ chunk.forEach((item) => {
130
+ MaxHeight = Math.max(MaxHeight, HeightMap[item.type] || 40)
131
+ })
132
+ heightSum += MaxHeight
133
+ })
134
+ return heightSum
135
+ })
136
+ const emits = defineEmits(['search', 'reset', 'showMoreChange'])
137
+
138
+ // 查询
139
+ const search = () => {
140
+ // state.showMore = false
141
+ emits('search', state.searchData)
142
+ }
143
+ // 重置
144
+ const reset = () => {
145
+ state.searchData = {}
146
+ emits('reset')
147
+ }
148
+ onMounted(() => {
149
+ if (props.max != null) return
150
+ const minWidth = 361
151
+ const maxWidth = 699
152
+ let x = Math.floor(searchBoxRef.value.clientWidth / 4)
153
+ x = Math.max(minWidth, Math.min(x, maxWidth))
154
+ state.autoMax = Math.floor(searchBoxRef.value.clientWidth / x)
155
+ })
156
+ watch(
157
+ () => [state.showMore, buttonShowRow.value],
158
+ () => {
159
+ let height = 12
160
+ if (!buttonShowRow.value) {
161
+ height += 45
162
+ }
163
+ emits(
164
+ 'showMoreChange',
165
+ state.showMore ? listHeight.value + height : 40 + height,
166
+ )
167
+ },
168
+ {
169
+ immediate: true,
170
+ },
171
+ )
172
+ </script>
173
+ <style lang="scss" scoped>
174
+ .el-button + .el-dropdown {
175
+ margin-left: 12px;
176
+ }
177
+ .searchBox {
178
+ width: 100%;
179
+ position: relative;
180
+ .cardBox {
181
+ width: 100%;
182
+ display: flex;
183
+ flex-wrap: wrap;
184
+ column-gap: 12px;
185
+ flex: 1;
186
+ height: 40px;
187
+ align-items: start;
188
+ overflow: hidden;
189
+ transition: height 0.3s;
190
+ // position: absolute;
191
+ // z-index: 99;
192
+ // top: 0;
193
+ // left: 0;
194
+ background-color: #fff;
195
+ margin-bottom: 12px;
196
+ .row {
197
+ width: 100%;
198
+ height: 44px;
199
+ display: flex;
200
+ align-items: center;
201
+ column-gap: 12px;
202
+ .rowBox {
203
+ display: flex;
204
+ align-items: center;
205
+ column-gap: 12px;
206
+ }
207
+ }
208
+ }
209
+ .showMoreBox {
210
+ // border-bottom: 1px solid var(--el-border-color-light);
211
+ margin-bottom: 0px;
212
+ }
213
+ .openMoreBox {
214
+ padding-bottom: 12px;
215
+ // border-bottom: 1px solid var(--el-border-color-light);
216
+ border-bottom: 1px solid #f5f4f4;
217
+ }
218
+ .searchItem {
219
+ width: 25%;
220
+ display: flex;
221
+ align-items: center;
222
+ justify-content: right;
223
+ margin-bottom: 12px;
224
+ .label {
225
+ margin-right: 12px;
226
+ width: 86px;
227
+ text-align: right;
228
+ }
229
+ .content {
230
+ width: calc(100% - 124px);
231
+ }
232
+ .button {
233
+ display: flex;
234
+ }
235
+ }
236
+ .openMoreBox {
237
+ cursor: pointer;
238
+ margin-left: 12px;
239
+ display: flex;
240
+ align-items: center;
241
+ justify-content: center;
242
+ color: var(--el-color-primary);
243
+ .button {
244
+ display: flex;
245
+ align-items: center;
246
+ justify-content: center;
247
+ .openMoreText {
248
+ margin-left: 12px;
249
+ }
250
+ }
251
+ }
252
+ }
253
+
254
+ :deep() {
255
+ .el-button {
256
+ span {
257
+ display: inline-block;
258
+ max-width: 120px;
259
+ overflow: hidden;
260
+ text-overflow: ellipsis;
261
+ white-space: nowrap;
262
+ }
263
+ }
264
+ }
265
+ </style>
@@ -0,0 +1,371 @@
1
+ <template>
2
+ <div class="queryBox" v-if="searchShow && searchConfig">
3
+ <SearchBox
4
+ @search="search"
5
+ @reset="reset"
6
+ ref="searchBoxRef"
7
+ :config="searchConfig"
8
+ :extra-list="extraList"
9
+ :max="max"
10
+ :permission="permission"
11
+ @showMoreChange="showMoreChange"
12
+ ></SearchBox>
13
+ </div>
14
+ <div class="optionBox" v-if="dropdownList && dropdownList.length > 0">
15
+ <el-button
16
+ v-for="item in dropdownList"
17
+ :type="item.type || 'primary'"
18
+ @click="command(item.code)"
19
+ v-if="dropdownList"
20
+ >
21
+ {{ item.label }}
22
+ </el-button>
23
+ </div>
24
+
25
+ <div
26
+ class="tableBox"
27
+ :class="{
28
+ tablePageBox: pageShow && pagination,
29
+ tabelSearchBox: searchShow && searchConfig,
30
+ }"
31
+ :style="`height: calc(100% - ${getTableHeight}px);`"
32
+ >
33
+ <el-table
34
+ :data="tableData"
35
+ style="width: 100%; height: 100%"
36
+ max-height="100%"
37
+ :row-key="rowKey"
38
+ @selection-change="handleSelectionChange"
39
+ @current-change="handleCurrentChange"
40
+ :highlight-current-row="selectType ? true : false"
41
+ :default-expand-all="defaultExpandAll"
42
+ ref="tableRef"
43
+ >
44
+ <el-table-column
45
+ fixed
46
+ v-if="selectType === 'checkbox'"
47
+ type="selection"
48
+ />
49
+ <template v-for="(item, index) in columns" :key="item.prop">
50
+ <el-table-column v-if="item.type === 'index'" type="index" fixed />
51
+ <el-table-column
52
+ v-else-if="item.type === 'time'"
53
+ :label="item.label"
54
+ :prop="item.prop"
55
+ :width="item.width"
56
+ :format="item.formatter"
57
+ :formatter="timeformatter"
58
+ min-width="200"
59
+ >
60
+ </el-table-column>
61
+ <el-table-column
62
+ :fixed="index === 0"
63
+ v-else
64
+ :prop="item.prop"
65
+ :label="item.label"
66
+ :width="item.width"
67
+ :formatter="item.formatter"
68
+ :show-overflow-tooltip="!item.slot"
69
+ min-width="200"
70
+ >
71
+ <template #default="scope" v-if="item.showColor">
72
+ <el-text :type="scope.row[item.prop.split('.')[0]]?.displayColor">
73
+ {{ displayShow(scope.row, item.prop) }}
74
+ </el-text>
75
+ </template>
76
+ <template #default="scope" v-else-if="item.slot">
77
+ <slot :name="item.slot" :row="scope.row"></slot>
78
+ </template>
79
+ </el-table-column>
80
+ </template>
81
+ <el-table-column
82
+ v-if="option"
83
+ :label="option.label"
84
+ prop="option"
85
+ fixed="right"
86
+ class-name="optionColumn"
87
+ :min-width="option.actionList.length * 68"
88
+ >
89
+ <template #default="scope">
90
+ <template
91
+ v-for="item in option.actionList.length > 3
92
+ ? option.actionList.slice(0, 2)
93
+ : option.actionList.slice(0, 3)"
94
+ >
95
+ <el-popconfirm
96
+ :title="`确定要${item.label}吗?`"
97
+ @confirm="execute(item, scope.row)"
98
+ v-if="item.type === 'danger'"
99
+ >
100
+ <template #reference>
101
+ <el-link :type="item.type" style="margin-right: 12px">
102
+ {{ item.label }}
103
+ </el-link>
104
+ </template>
105
+ </el-popconfirm>
106
+ <el-link
107
+ type="primary"
108
+ @click="execute(item, scope.row)"
109
+ style="margin-right: 12px"
110
+ v-else
111
+ >
112
+ {{ item.label }}
113
+ </el-link>
114
+ </template>
115
+
116
+ <template v-if="option.actionList.length > 3">
117
+ <el-dropdown
118
+ placement="bottom"
119
+ trigger="click"
120
+ class-name="moreDropdown"
121
+ >
122
+ <span class="el-link"> 更多 </span>
123
+ <template #dropdown>
124
+ <el-dropdown-menu>
125
+ <template v-for="item in option.actionList.slice(2)">
126
+ <el-dropdown-item @click="execute(item, scope.row)">
127
+ {{ item.label }}
128
+ </el-dropdown-item>
129
+ </template>
130
+ </el-dropdown-menu>
131
+ </template>
132
+ </el-dropdown>
133
+ </template>
134
+ </template>
135
+ </el-table-column>
136
+ </el-table>
137
+ </div>
138
+ <div class="pageBox" v-if="pageShow && pagination && state.total">
139
+ <el-pagination
140
+ size="small"
141
+ layout="prev, pager, next,sizes, total"
142
+ :total="pagination.total"
143
+ :page-size="pagination.pageSize"
144
+ v-model:current-page="pagination.currentPage"
145
+ @size-change="sizeChange"
146
+ @current-change="currentChange"
147
+ />
148
+ </div>
149
+ </template>
150
+ <script lang="ts" setup>
151
+ import { computed, nextTick, onMounted, reactive, ref, watch } from 'vue'
152
+ import type { ColumnItem, TableData, OptionItem } from './table'
153
+ import SearchBox from '@/components/searchBox/index.vue'
154
+ import { ElMessageBox } from 'element-plus'
155
+ import { cloneDeep, isEqual } from 'lodash'
156
+ import type { ActionItem } from '../page/template/common'
157
+ import dayjs from 'dayjs'
158
+ interface extraItem extends selectItem {
159
+ action?: string | ActionItem // 额外按钮的操作
160
+ code: string
161
+ type?: string
162
+ }
163
+ interface Props {
164
+ pageShow?: boolean // 是否显示分页
165
+ searchShow?: boolean // 是否显示搜索
166
+ extraList?: extraItem[] | null // 额外按钮菜单
167
+ tableData?: Array<TableData> // 表格数据 在autoSearch为false时展示
168
+ columns: Array<ColumnItem> // 表格列配置
169
+ pagination?: PageItem // 分页
170
+ searchConfig?: Array<SearchItemConfig> // 搜索框配置
171
+ max?: number // 搜索框一行最大数量
172
+ selectType?: false | 'radio' | 'checkbox' // 表格选择类型(无选择 | 单选 | 多选)
173
+ option?: OptionItem // 操作
174
+ rowKey?: string // 表格数据主键
175
+ defaultExpandAll?: boolean
176
+ }
177
+ const props = withDefaults(defineProps<Props>(), {
178
+ pageShow: true,
179
+ searchShow: true,
180
+ selectType: false,
181
+ rowKey: 'id',
182
+ defaultExpandAll: false,
183
+ })
184
+ const state = reactive({
185
+ pageSize: 20,
186
+ currentPage: 1,
187
+ total: 0,
188
+ searchData: {},
189
+ tableData: [] as Array<Data>,
190
+ formDrawerShow: false,
191
+ formDrawerData: {} as Data,
192
+ formDrawerTitle: '',
193
+ formDrawerConfig: {} as FormConfig,
194
+ formDrawerItemConfig: [] as Array<FormItemConfig>,
195
+ formSubmitUrl: '',
196
+ selectData: [] as Array<TableData>,
197
+ searchHeight: 40,
198
+ })
199
+ const emits = defineEmits([
200
+ 'sizeChange',
201
+ 'currentChange',
202
+ 'selectionChange',
203
+ 'currentSelectChange',
204
+ 'search',
205
+ 'reset',
206
+ 'upload',
207
+ 'down',
208
+ 'tableCommand',
209
+ 'extraClick',
210
+ ])
211
+ const showMoreChange = (height: number) => {
212
+ state.searchHeight = height
213
+ }
214
+ const displayShow = (data: Data, prop: string) => {
215
+ let showText = data
216
+ for (const key of prop.split('.')) {
217
+ if (showText[key]) {
218
+ showText = showText[key]
219
+ } else {
220
+ return ''
221
+ }
222
+ }
223
+ return showText
224
+ }
225
+
226
+ // searchPermission();
227
+ const dropdownList = computed(() => {
228
+ return props.extraList || []
229
+ })
230
+
231
+ const command = (command: string) => {
232
+ const item = props.extraList?.find((item) => item.code === command)
233
+ if (item && item.action) {
234
+ if (typeof item.action === 'object' && item.action?.type === 'export') {
235
+ execute(item.action, state.searchData)
236
+ } else {
237
+ execute(item.action, {})
238
+ }
239
+ } else {
240
+ emits('extraClick', command)
241
+ }
242
+ }
243
+ // 计算除表格以外的控件高度
244
+ const getTableHeight = computed(() => {
245
+ let height = 0
246
+ if (props.pageShow && props.pagination) {
247
+ height += 40
248
+ }
249
+ if (props.searchShow && props.searchConfig) {
250
+ height += state.searchHeight
251
+ }
252
+ if (dropdownList.value && dropdownList.value.length > 0) {
253
+ height += 44
254
+ }
255
+ return height + 18
256
+ })
257
+ // 页码变化
258
+ const currentChange = (num: number) => {
259
+ emits('currentChange', num)
260
+ }
261
+ const tableRef = ref<any>(null)
262
+ // 分页条数变化
263
+ const sizeChange = (num: number) => {
264
+ nextTick(() => {
265
+ window.dispatchEvent(new Event('resize'))
266
+ })
267
+ emits('sizeChange', num)
268
+ }
269
+ // 多选
270
+ const handleSelectionChange = (val: Array<TableData>) => {
271
+ emits('selectionChange', val)
272
+ state.selectData = val
273
+ }
274
+ // 单选
275
+ const handleCurrentChange = (val: TableData) => {
276
+ emits('currentSelectChange', val)
277
+ state.selectData = [val]
278
+ }
279
+ // 查询
280
+ const search = (data: Data) => {
281
+ emits('search', data)
282
+ }
283
+ // 重置
284
+ const reset = () => {
285
+ emits('reset')
286
+ }
287
+ // 格式化
288
+ const timeformatter = (_row: any, col: any, value: string | number) => {
289
+ const config = props.columns.find((item) => item.prop === col.property)
290
+ if (config && config.format) {
291
+ return dayjs(value).format(config.format)
292
+ }
293
+ return value
294
+ }
295
+ // 执行命令
296
+ const execute = (command: string | ActionItem, rowData: Data) => {
297
+ if (
298
+ typeof command === 'object' &&
299
+ command.type === 'delRow' &&
300
+ props.option &&
301
+ props.option.actionList?.length > 3
302
+ ) {
303
+ ElMessageBox.alert('确认删除吗?', '提示', {
304
+ confirmButtonText: '确定',
305
+ callback: () => {
306
+ const obj = cloneDeep(command)
307
+ emits('tableCommand', obj)
308
+ },
309
+ })
310
+ } else {
311
+ const obj = cloneDeep(command)
312
+ emits('tableCommand', obj)
313
+ }
314
+ }
315
+ defineExpose({})
316
+ onMounted(() => {})
317
+ watch(
318
+ () => props.pagination,
319
+ (val) => {
320
+ if (val) {
321
+ state.pageSize = val.pageSize
322
+ state.currentPage = val.currentPage
323
+ state.total = val.total
324
+ }
325
+ },
326
+ {
327
+ immediate: true,
328
+ deep: true,
329
+ },
330
+ )
331
+ </script>
332
+ <style scoped lang="scss">
333
+ .tableBox {
334
+ height: 100%;
335
+ }
336
+ .tablePageBox {
337
+ height: calc(100% - 40px);
338
+ }
339
+ .tabelSearchBox {
340
+ margin-top: 18px;
341
+ height: calc(100% - 58px);
342
+ }
343
+ .tabelSearchBox.tablePageBox {
344
+ height: calc(100% - 98px);
345
+ }
346
+ .pageBox {
347
+ height: 40px;
348
+ display: flex;
349
+ justify-content: end;
350
+ align-items: end;
351
+ }
352
+ :deep() {
353
+ .el-scrollbar__wrap--hidden-default {
354
+ max-height: 100% !important;
355
+ }
356
+ .optionColumn {
357
+ .cell {
358
+ display: flex;
359
+ align-items: center;
360
+ .el-dropdown {
361
+ line-height: 23px;
362
+ }
363
+ }
364
+ }
365
+ }
366
+ .optionBox {
367
+ display: flex;
368
+ justify-content: end;
369
+ padding-top: 12px;
370
+ }
371
+ </style>
@@ -0,0 +1,23 @@
1
+ export interface ColumnItem {
2
+ label: string
3
+ prop: string
4
+ width?: string | number
5
+ slot?: string
6
+ formatter?: Function
7
+ format?: string
8
+ type?: string
9
+ showColor?: boolean
10
+ }
11
+ export interface ActionItem {
12
+ label: string
13
+ type: 'primary' | 'success' | 'warning' | 'danger' | 'info' | 'none'
14
+ icon?: string
15
+ code: string
16
+ }
17
+ export interface OptionItem {
18
+ label: string
19
+ actionList: ActionItem[]
20
+ }
21
+ export interface TableData {
22
+ [key: string]: any
23
+ }