ci-plus 1.0.1 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -4,5 +4,56 @@
4
4
  # 本地安装项目
5
5
  pnpm install 项目package.json所在目录
6
6
  pnpm install D:\UserData\Public\InternalUse\59529\zjk\ci-plus\packages\components
7
+ # 安装npm包
8
+ pnpm install ci-plus
9
+ # 本库依赖element-plus,需要安装element-plus 图标库
10
+ pnpm install element-plus@2.5.1 -S
11
+ pnpm install @element-plus/icons-vue@2.3.1 -S
12
+ # 发布包
13
+ npm publish
7
14
 
8
15
  ```
16
+
17
+ ## svg图标组件使用说明
18
+
19
+ ```ts
20
+ 1、首先需要安装插件
21
+ pnpm i fast-glob@3.x vite-plugin-svg-icons@2.x -D
22
+
23
+ 2、在src/assets/icons中创建svg文件夹,(可将组件库中的assets/icons文件夹移动到项目中的assets/icons文件夹中)
24
+
25
+ 3、在main.ts中引入svg图标
26
+ import 'virtual:svg-icons-register'
27
+
28
+ 4、在vite.config.ts中配置svg图标
29
+ import path from 'path'
30
+ import { defineConfig } from 'vite'
31
+ import { createSvgIconsPlugin } from 'vite-plugin-svg-icons'
32
+ export default defineConfig({
33
+ plugins: [
34
+ createSvgIconsPlugin({
35
+ // 配置svg文件存放的文件夹,(可将组件库中的assets/icons文件夹移动到项目中的assets/icons文件夹中)
36
+ iconDirs: [path.resolve(process.cwd(), 'src/assets/icons')],
37
+ // clas命名规则
38
+ symbolId: 'icon-[dir]-[name]'
39
+ }
40
+ )
41
+ ]
42
+ })
43
+ ```
44
+
45
+ 6、在组件中使用svg图标
46
+
47
+ ```vue
48
+ <template>
49
+ <div>
50
+ <!-- 单独引入 -->
51
+ <Svgicon icon-class="search" />
52
+ <!-- 全局引入:name就是svg文件的文件名 -->
53
+ <ci-svg-icon name="regular-left" size="20" color="#2C93FF" ></ci-svg-icon>
54
+ </div>
55
+ </template>
56
+ <script setup>
57
+ // 单独引入
58
+ import { Svgicon } from '@ci-plus/components'
59
+ ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ci-plus",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "description": "cc组件库",
5
5
  "main": "./index.ts",
6
6
  "scripts": {
@@ -16,29 +16,13 @@
16
16
  "author": "cc",
17
17
  "license": "ISC",
18
18
  "dependencies": {
19
- "@element-plus/icons-vue": "^2.3.1",
20
- "element-plus": "^2.5.1",
21
19
  "lodash": "^4.17.21",
22
- "sortablejs": "^1.15.1",
23
- "vuedraggable": "^2.24.3"
24
- },
25
- "devDependencies": {
26
20
  "less": "^4.2.0",
27
- "vite-plugin-svg-icons": "^2.0.1"
28
- },
29
- "peerDependencies": {
30
- "@element-plus/icons-vue": "^2.3.1",
31
- "element-plus": "^2.5.1",
32
- "lodash": "^4.17.21",
33
21
  "sortablejs": "^1.15.1",
22
+ "vite-plugin-svg-icons": "^2.0.1",
34
23
  "vuedraggable": "^2.24.3"
35
24
  },
36
- "peerDependenciesMeta": {
37
- "element-plus": {
38
- "optional": true
39
- },
40
- "lodash": {
41
- "optional": true
42
- }
43
- }
25
+ "devDependencies": {},
26
+ "peerDependencies": {},
27
+ "peerDependenciesMeta": {}
44
28
  }
@@ -0,0 +1,33 @@
1
+ <svg t="1703575342209" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="12984" data-spm-anchor-id="a313x.search_index.0.i24.6fa73a81kLccOp" width="200" height="200">
2
+
3
+ <path
4
+ d="M160.768 102.4h702.464L568.32 486.912V967.68l-139.776-128V486.912z"
5
+
6
+ p-id="12985"
7
+ data-spm-anchor-id="a313x.search_index.0.i25.6fa73a81kLccOp"
8
+ class="selected">
9
+ </path>
10
+ <path
11
+ d="M588.8 998.4c-6.656 0-13.824-2.048-18.944-6.656l-160.256-128c-7.168-5.632-11.776-14.848-11.776-24.064V497.152L115.712 120.832c-7.168-9.216-8.192-22.016-3.072-32.256s15.872-16.896 27.648-16.896h743.424c11.776 0 22.528 6.656 27.648 16.896s4.096 23.04-3.072 32.256L619.52 497.152V967.68c0 11.776-6.656 22.528-17.408 27.648-4.096 2.048-8.704 3.072-13.312 3.072z m-129.536-173.568l98.816 78.848V486.912c0-6.656 2.048-13.312 6.144-18.944L821.248 133.12h-619.52l251.392 335.36c4.096 5.12 6.144 11.776 6.144 18.432v337.92z"
12
+
13
+ p-id="12986"
14
+ data-spm-anchor-id="a313x.search_index.0.i21.6fa73a81kLccOp"
15
+ class="mysearch">
16
+ </path>
17
+ </svg>
18
+
19
+ <!-- 漏斗筛选组件 -->
20
+ <!-- <path
21
+ d="M160.768 102.4h702.464L568.32 486.912V967.68l-139.776-128V486.912z"
22
+ fill="#2C93FF"
23
+ p-id="12985"
24
+ data-spm-anchor-id="a313x.search_index.0.i25.6fa73a81kLccOp"
25
+ class="selected">
26
+ </path>
27
+ <path
28
+ d="M588.8 998.4c-6.656 0-13.824-2.048-18.944-6.656l-160.256-128c-7.168-5.632-11.776-14.848-11.776-24.064V497.152L115.712 120.832c-7.168-9.216-8.192-22.016-3.072-32.256s15.872-16.896 27.648-16.896h743.424c11.776 0 22.528 6.656 27.648 16.896s4.096 23.04-3.072 32.256L619.52 497.152V967.68c0 11.776-6.656 22.528-17.408 27.648-4.096 2.048-8.704 3.072-13.312 3.072z m-129.536-173.568l98.816 78.848V486.912c0-6.656 2.048-13.312 6.144-18.944L821.248 133.12h-619.52l251.392 335.36c4.096 5.12 6.144 11.776 6.144 18.432v337.92z"
29
+ fill="#666767"
30
+ p-id="12986"
31
+ data-spm-anchor-id="a313x.search_index.0.i21.6fa73a81kLccOp"
32
+ class="mysearch">
33
+ </path> -->
@@ -0,0 +1,12 @@
1
+ <svg
2
+ t="1703574894341"
3
+ class="icon"
4
+ viewBox="0 0 1024 1024"
5
+ version="1.1"
6
+ xmlns="http://www.w3.org/2000/svg"
7
+ p-id="4767"
8
+ width="200"
9
+ height="200"
10
+ >
11
+ <path d="M393.846154 64.174932l117.454119 0.399843H512.499805l117.454119-0.399843-10.395939 10.395939c-18.89262 18.89262-28.488872 44.982429-26.28973 71.472081l20.292073 250.502148c2.998829 36.68567 18.092932 72.171808 42.483405 99.661069l34.186646 38.684889-122.252245-0.899648-55.478329-0.399844h-0.99961l-55.478329 0.399844-122.452167 0.799687 34.186646-38.684888c24.390472-27.589223 39.484576-62.9754 42.483405-99.66107l20.292074-250.402187c2.199141-26.589613-7.397111-52.679422-26.289731-71.472081l-10.395939-10.395939m281.889887-64.174932h-0.199922L512.399844 0.599766h-0.799688L348.36392 0h-0.199922c-20.891839 0-39.684498 13.494729-45.582194 33.58688-4.098399 13.994533-1.899258 30.887934 17.79305 47.581414l38.584927 38.584927c5.597813 5.597813 8.39672 13.294807 7.796955 21.091761L346.464662 391.247169c-1.899258 23.190941-11.195627 45.08239-26.589613 62.475596l-61.87583 69.872706c-8.696603 9.796173-13.894572 22.291292-14.394377 35.386177-0.299883 8.996486 1.599375 18.89262 8.596642 27.28934 6.897306 8.296759 17.293245 12.894963 27.989067 12.894963h0.299882l175.931277-1.199532 55.178446 422.834831 0.399844 3.098789 0.399844-3.098789 55.178446-422.834831 175.931277 1.199532h0.299882c10.795783 0 21.191722-4.598204 27.989067-12.894963 6.897306-8.39672 8.796564-18.292854 8.596642-27.28934-0.399844-13.094885-5.697774-25.590004-14.394377-35.386177l-61.87583-69.872706c-15.393987-17.393206-24.690355-39.284654-26.589613-62.475596l-20.292074-250.402187c-0.599766-7.796954 2.199141-15.593909 7.796955-21.091761l38.584927-38.584927c19.692308-16.693479 21.891449-33.58688 17.79305-47.581414-5.997657-19.992191-24.790316-33.58688-45.682155-33.58688z" p-id="4768"></path>
12
+ </svg>
@@ -0,0 +1,11 @@
1
+ <svg t="1703571942554"
2
+ class="icon"
3
+ viewBox="0 0 1024 1024"
4
+ version="1.1"
5
+ xmlns="http://www.w3.org/2000/svg"
6
+ p-id="3583"
7
+ width="200"
8
+ height="200"
9
+ >
10
+ <path d="M944.576 383.296a42.496 42.496 0 0 1-40.768 21.952h-62.656a27.456 27.456 0 0 0-20.992 9.728l-167.104 196.416a109.952 109.952 0 0 0-26.048 64.64l-5.76 95.68a58.048 58.048 0 0 1-15.232 36.096 40.512 40.512 0 0 1-26.048 13.568h-3.264a37.44 37.44 0 0 1-26.368-11.2L423.424 681.6l-347.2 266.752-2.432 2.24 1.984-2.56 266.816-347.328-128.512-126.848a37.248 37.248 0 0 1-11.008-29.632 41.152 41.152 0 0 1 13.568-26.048 57.6 57.6 0 0 1 36.096-15.232l95.68-5.76a109.952 109.952 0 0 0 64.576-26.24l196.416-167.104a27.456 27.456 0 0 0 9.728-20.992v-55.936a44.8 44.8 0 0 1 21.632-47.424 47.616 47.616 0 0 1 22.72-5.76 49.28 49.28 0 0 1 34.752 14.464l117.952 118.912 0.576 0.576 118.912 118.144a48.448 48.448 0 0 1 8.768 57.6z" p-id="3584"></path>
11
+ </svg>
@@ -0,0 +1,12 @@
1
+ <svg
2
+ t="1703575012117"
3
+ class="icon"
4
+ viewBox="0 0 1024 1024"
5
+ version="1.1"
6
+ xmlns="http://www.w3.org/2000/svg"
7
+ p-id="7766"
8
+ width="200"
9
+ height="200"
10
+ >
11
+ <path d="M418.828 642.702l0 157.703 38.272 37.575 158.377-155.61 345.128 278.212-265.838-356.04 157.41-154.71-39.51-38.813-157.972-2.407-313.29-238.838 73.013-71.685-35.28-34.695-315.743 310.18500001 35.257 34.67199999 79.402-77.287 240.773 311.737z" p-id="7767"></path>
12
+ </svg>
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>
@@ -5,7 +5,7 @@
5
5
  </template>
6
6
 
7
7
  <script setup lang="ts">
8
- defineOptions({ name: 'cc-app' })
8
+ defineOptions({ name: 'ci-app' })
9
9
  import { ref } from 'vue'
10
10
  const count = ref(0)
11
11
  const add = () => {
@@ -10,9 +10,14 @@ declare module '@vue/runtime-core' {
10
10
  EaButton: typeof components.Button;
11
11
  EaIcon: typeof components.Icon;
12
12
  EaButtons: typeof components.Buttons;
13
- CcDialog: typeof components.Dialog;
14
- CcApp: typeof components.Ccapp;
15
- CcTable: typeof components.sortableTable;
13
+ CiDialog: typeof components.Dialog;
14
+ CiApp: typeof components.Ccapp;
15
+ CiSvgicon: typeof components.Svgicon
16
+ CiSuffix: typeof components.Suffix;
17
+ CiTable: typeof components.SorTables;
18
+ CiHeadbtns: typeof components.Headbtns
19
+ CiSdialog: typeof components.Sdialog
20
+ CiColumncell: typeof components.Columncell
16
21
  }
17
22
  }
18
23
  export { };
@@ -1,7 +1,7 @@
1
1
  <!-- @format -->
2
2
 
3
3
  <script setup lang="ts">
4
- defineOptions({ name: 'cc-dialog' })
4
+ defineOptions({ name: 'ci-dialog' })
5
5
  import { ref, reactive } from 'vue'
6
6
  import { Close, FullScreen } from '@element-plus/icons-vue'
7
7
  import './style/index.less'
@@ -29,7 +29,7 @@ const props = withDefaults(defineProps<Props>(), {
29
29
  closeOnClicModal: false,
30
30
  closeOnPressEscape: false,
31
31
  destroyOnClose: true,
32
- style: 'width: 50%;translate(59px, 4px)',
32
+ style: 'width: 50%;translate(59px, 4px)'
33
33
  })
34
34
 
35
35
  // 给父亲组件传递回选中的数据
@@ -48,9 +48,7 @@ const MyFullscreen = ref(props.fullscreen) // 是否全屏
48
48
 
49
49
  // 定义一个函数获取窗口高度
50
50
  let windowHeightL =
51
- window.innerHeight ||
52
- document.documentElement.clientHeight ||
53
- document.body.clientHeight
51
+ window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight
54
52
  const windowHeight = ref(windowHeightL)
55
53
 
56
54
  /**
@@ -72,8 +70,7 @@ if (!MyFullscreen.value) {
72
70
  if (props.fullscreen == false) {
73
71
  console.log('判断进来没222')
74
72
  MyStyle.value =
75
- props.style +
76
- `max-height: calc( ${windowHeight.value}px - ${dTop.value});translate(59px, 4px)`
73
+ props.style + `max-height: calc( ${windowHeight.value}px - ${dTop.value});translate(59px, 4px)`
77
74
  }
78
75
 
79
76
  // 函数
@@ -133,13 +130,13 @@ const openChang = (val: any) => {
133
130
 
134
131
  defineExpose({
135
132
  showMydia,
136
- closeDialog, //关闭函数
133
+ closeDialog //关闭函数
137
134
  })
138
135
 
139
136
  /////////////////////////////////////////////////////
140
137
  const domInfo = reactive({
141
138
  baseW: 0,
142
- baseH: 0,
139
+ baseH: 0
143
140
  })
144
141
  const container = ref<HTMLElement>(null)
145
142
 
@@ -159,12 +156,8 @@ const updateTarget = (event: MouseEvent) => {
159
156
  // 两个鼠标移动事件间隔时间中当中鼠标移动的相对坐标;
160
157
  domInfo.baseW = parseInt(MyDialogRef.value.dialogContentRef.$el.style.width)
161
158
  domInfo.baseH = parseInt(MyDialogRef.value.dialogContentRef.$el.style.height)
162
- MyDialogRef.value.dialogContentRef.$el.style.width = `${
163
- domInfo.baseW + event.movementX
164
- }px`
165
- MyDialogRef.value.dialogContentRef.$el.style.height = `${
166
- domInfo.baseH + event.movementY
167
- }px`
159
+ MyDialogRef.value.dialogContentRef.$el.style.width = `${domInfo.baseW + event.movementX}px`
160
+ MyDialogRef.value.dialogContentRef.$el.style.height = `${domInfo.baseH + event.movementY}px`
168
161
  // console.log('参数x', event.movementX)
169
162
  // console.log('参数y', event.movementY)
170
163
  }
@@ -202,10 +195,7 @@ const onTdMousedown = (e: MouseEvent) => {
202
195
  <template #header="{ close, titleId, titleClass }">
203
196
  <div class="my-header">
204
197
  <div class="title">
205
- <div
206
- :id="titleId"
207
- :class="titleClass"
208
- >
198
+ <div :id="titleId" :class="titleClass">
209
199
  {{ title }}
210
200
  </div>
211
201
  </div>
@@ -217,13 +207,7 @@ const onTdMousedown = (e: MouseEvent) => {
217
207
  circle
218
208
  @click="fullscreenChang"
219
209
  />
220
- <el-button
221
- size="small"
222
- type="danger"
223
- :icon="Close"
224
- circle
225
- @click="closeDialog"
226
- />
210
+ <el-button size="small" type="danger" :icon="Close" circle @click="closeDialog" />
227
211
  </div>
228
212
  </div>
229
213
  </template>
@@ -231,30 +215,16 @@ const onTdMousedown = (e: MouseEvent) => {
231
215
  <template #default="props">
232
216
  <!-- <div class="my-body"> -->
233
217
  <slot :data="MyDialogRef"></slot>
234
- <slot
235
- name="dialong"
236
- :data="props"
237
- ></slot>
218
+ <slot name="dialong" :data="props"></slot>
238
219
  <!-- </div> -->
239
- <div
240
- class="drag"
241
- @mousedown="onTdMousedown($event)"
242
- ></div>
220
+ <div class="drag" @mousedown="onTdMousedown($event)"></div>
243
221
  </template>
244
222
 
245
- <template
246
- #footer
247
- v-if="showfooter"
248
- >
223
+ <template #footer v-if="showfooter">
249
224
  <slot name="myfooter">
250
225
  <span class="dialog-footer">
251
226
  <el-button @click="closeDialog">取消</el-button>
252
- <el-button
253
- type="primary"
254
- @click="Submit"
255
- >
256
- 保存
257
- </el-button>
227
+ <el-button type="primary" @click="Submit"> 保存 </el-button>
258
228
  </span>
259
229
  </slot>
260
230
  </template>
package/src/index.ts CHANGED
@@ -2,4 +2,10 @@ export * from './button';
2
2
  export * from './icon';
3
3
  export * from './buttons';
4
4
  export * from './dailog';
5
- export * from './ccapp';
5
+ export * from './ccapp';
6
+ export * from './svgicon';// svg图标
7
+ export * from './selectSuffix';
8
+ export * from './sortableTable/index/headButtons'; // 导出排序表头按钮
9
+ export * from './sortableTable/index/sortableTableTs'; // 导出排序表格
10
+ export * from './sortableTable/index/sortableTableDialog'; // 导出表排序组件
11
+ export * from './sortableTable/index/sortableTableColumnCell'; // 导出表列组件
@@ -0,0 +1,4 @@
1
+ import _Suffix from './selectSuffix.vue';
2
+ import { withInstall } from '../utils/index';
3
+ export const Suffix = withInstall(_Suffix);
4
+ export default Suffix;
@@ -0,0 +1,239 @@
1
+ <template>
2
+ <span
3
+ class="el-input-number__increase"
4
+ @click.stop="openTable"
5
+ >
6
+ <el-icon>
7
+ <Operation />
8
+ </el-icon>
9
+ </span>
10
+ <el-dialog
11
+ class="L-dialog"
12
+ v-model="basic.is_dialogTable"
13
+ :title="title ? title : '请选择'"
14
+ append-to-body
15
+ style="height: 60%; width: 800px"
16
+ draggable
17
+ >
18
+ <div
19
+ style="display: flex; flex-direction: column; height: 100%"
20
+ v-loading="basic.loading"
21
+ >
22
+ <el-row style="margin-bottom: 3px">
23
+ <el-col
24
+ v-if="mul && Array.isArray(props.modelValue)"
25
+ :span="14"
26
+ >
27
+ <template v-for="(v, i) in props.modelValue">
28
+ <el-tag
29
+ v-if="i <= 2"
30
+ :key="v"
31
+ closable
32
+ type=""
33
+ style="width: 70px"
34
+ >
35
+ {{ v }}
36
+ </el-tag>
37
+ </template>
38
+ </el-col>
39
+ <el-col
40
+ v-else
41
+ :span="14"
42
+ class="flex"
43
+ >
44
+ <el-tag
45
+ v-if="props.modelValue?.length"
46
+ closable
47
+ type=""
48
+ @close="closeTag"
49
+ >
50
+ {{ tagLabel }}
51
+ </el-tag>
52
+ </el-col>
53
+ <el-col :span="10">
54
+ <el-input
55
+ v-model="basic.search"
56
+ placeholder="模糊搜索"
57
+ @keyup.enter="getTableData({}, true)"
58
+ @change="getTableData({}, true)"
59
+ >
60
+ <template #append>
61
+ <el-button
62
+ icon="Search"
63
+ @click="getTableData({}, true)"
64
+ />
65
+ </template>
66
+ </el-input>
67
+ </el-col>
68
+ </el-row>
69
+ <el-table
70
+ :data="tableData"
71
+ size="small"
72
+ @row-click="rowClick"
73
+ ref="tableRef"
74
+ style="width: 100%; flex: 1"
75
+ :highlight-current-row="!mul"
76
+ >
77
+ <template v-for="column in columns">
78
+ <el-table-column
79
+ v-if="column.component"
80
+ v-bind="column.col"
81
+ >
82
+ <template #default="scope">
83
+ <component
84
+ :is="column.component(h, scope)"
85
+ :scope="scope"
86
+ ></component>
87
+ </template>
88
+ </el-table-column>
89
+ <el-table-column
90
+ v-else
91
+ v-bind="column.col"
92
+ />
93
+ </template>
94
+ </el-table>
95
+ <el-pagination
96
+ background
97
+ layout="total,sizes, prev, pager, next,jumper"
98
+ :pager-count="5"
99
+ :total="basic.count"
100
+ small
101
+ :page-sizes="[30, 100, 200]"
102
+ v-model:current-page="basic.page"
103
+ v-model:page-size="basic.limit"
104
+ @size-change="getTableData()"
105
+ @current-change="getTableData()"
106
+ @prev-click="getTableData()"
107
+ @next-click="getTableData()"
108
+ style="margin-top: 3px"
109
+ />
110
+ </div>
111
+ </el-dialog>
112
+ </template>
113
+
114
+ <script setup lang="ts">
115
+ defineOptions({ name: 'ci-suffix' })
116
+ import { reactive, h, ref } from 'vue'
117
+ import { ElMessage, ElTable } from 'element-plus'
118
+ import axios from 'axios'
119
+ import { SelectSuffix } from './types'
120
+ interface AnyO {
121
+ [key: string]: any
122
+ }
123
+ interface Basic {
124
+ page: number
125
+ limit: number
126
+ count: number
127
+ is_dialogTable: boolean
128
+ loading: boolean
129
+ search: string
130
+ }
131
+ const tableRef = ref<InstanceType<typeof ElTable>>()
132
+ const props = withDefaults(defineProps<SelectSuffix>(), {
133
+ title: '', //弹出层标题
134
+ modelValue: '', //下拉框value
135
+ columns: () => [], // 表格列配置
136
+ mul: false, // 是否多选
137
+ prop: () => ({ label: '', value: '' }), //下拉框字段对象
138
+ where: () => ({}), //弹出层打开需要展示Label的请求对象
139
+ axiosConfig: () => ({}), //Axios请求配置对象
140
+ isExist: false, // 是否选中关闭,单选默认true,多选默认false
141
+ searchKey: 'search', // 模糊搜索字段,默认search
142
+ })
143
+ console.log('props', props)
144
+
145
+ const emits = defineEmits(['update:modelValue', 'change'])
146
+ const basic = reactive<Basic>({
147
+ page: 1,
148
+ limit: 30,
149
+ count: 0,
150
+ loading: false,
151
+ is_dialogTable: false,
152
+ search: '',
153
+ })
154
+ const tagLabel = ref('')
155
+ const tableData = ref<AnyO[]>([])
156
+ const rowClick = (row: AnyO) => {
157
+ console.log('row', row)
158
+ if (!props.mul) {
159
+ emits('update:modelValue', row[props.prop.value])
160
+
161
+ emits('change', row[props.prop.value], row)
162
+ tagLabel.value = row[props.prop.label]
163
+ if (!props.isExist) basic.is_dialogTable = false
164
+ }
165
+ }
166
+
167
+ const closeTag = () => {
168
+ emits('update:modelValue', '')
169
+ tableRef.value!.setCurrentRow(null)
170
+ }
171
+ const openTable = () => {
172
+ basic.is_dialogTable = true
173
+ if (!tableData.value.length) getTableData()
174
+ let searchObj: AnyO = {}
175
+ searchObj[props.searchKey ? props.searchKey : 'search'] = props.modelValue
176
+ if (props.modelValue)
177
+ getAxios(props.where ? props.where : searchObj).then((res) => {
178
+ if (res.code == 200 && res.data.length) {
179
+ tagLabel.value = res.data[0]?.[props.prop.label]
180
+ } else tagLabel.value = ''
181
+ setCurrent()
182
+ })
183
+ }
184
+ const getTableData = (obj = {}, page1 = false) => {
185
+ getAxios(obj, page1).then((res) => {
186
+ if (res.code !== 200) return ElMessage.warning(res.msg)
187
+ basic.count = res.count
188
+ tableData.value = res.data
189
+ setCurrent()
190
+ })
191
+ }
192
+ const setCurrent = (row?: AnyO) => {
193
+ let chooseRow = tableData.value.find(
194
+ (v) => v[props.prop.value] === props.modelValue,
195
+ )
196
+ if (chooseRow) tableRef.value!.setCurrentRow(chooseRow)
197
+ else tableRef.value!.setCurrentRow(null)
198
+ }
199
+ //获取数据
200
+ const getAxios = async (obj = {}, page1 = false): Promise<any> => {
201
+ basic.loading = true
202
+ if (page1) basic.page = 1
203
+ let data,
204
+ searchObj: AnyO = {}
205
+ searchObj[props.searchKey ? props.searchKey : 'search'] = basic.search
206
+ await axios({
207
+ ...props.axiosConfig,
208
+ params: {
209
+ page: basic.page,
210
+ limit: basic.limit,
211
+ ...searchObj,
212
+ ...props.axiosConfig.params,
213
+ ...obj,
214
+ },
215
+ })
216
+ .then((res) => {
217
+ basic.loading = false
218
+ data = res.data
219
+ })
220
+ .catch((err) => {
221
+ ElMessage.error(err.code)
222
+ basic.loading = false
223
+ })
224
+ return data
225
+ }
226
+ </script>
227
+
228
+ <style lang="scss">
229
+ .L-dialog {
230
+ .flex {
231
+ display: flex;
232
+ align-items: center;
233
+ }
234
+
235
+ .el-table__body tr.current-row > td.el-table__cell {
236
+ background-color: #bbe7ff !important;
237
+ }
238
+ }
239
+ </style>
@@ -0,0 +1,30 @@
1
+ import { Component as ComponentIns, h } from 'vue'
2
+ import { TableColumnInstance, ColumnCls } from 'element-plus'
3
+ import { AxiosRequestConfig } from 'axios';
4
+ export type Props<T> = Partial<Omit<T, `$${string}` | `_${string}` | '$' | '_'>>
5
+ export interface Scope<T> {
6
+ row: T,
7
+ $index: number,
8
+ column: ColumnCls<T>
9
+ }
10
+ export interface SelectColumn {
11
+ col: Props<TableColumnInstance>
12
+ scope?(props: any): string
13
+ component?: (createVNode: typeof h, data: Scope<any>) => ComponentIns
14
+ }
15
+ export interface SelectSuffix {
16
+ title?: string //弹出层标题
17
+ modelValue: string | string[] //下拉框value
18
+ columns: SelectColumn[] // 表格列配置
19
+ mul?: boolean, //多选
20
+ prop: { //下拉框字段
21
+ label: string
22
+ value: string
23
+ }
24
+ where?: { //弹出层打开需要展示Label的请求
25
+ [key: string]: string
26
+ }
27
+ axiosConfig: AxiosRequestConfig //Axios请求配置
28
+ isExist?: boolean, // 是否选中关闭,单选默认true,多选默认false
29
+ searchKey?: string // 模糊搜索字段,默认search
30
+ }
@@ -7,7 +7,7 @@
7
7
  */ -->
8
8
 
9
9
  <template>
10
- <div class="cl-buttons">
10
+ <div class="ci-buttons">
11
11
  <div>
12
12
  <slot name="left"></slot>
13
13
  </div>
@@ -16,8 +16,11 @@
16
16
  </div>
17
17
  </div>
18
18
  </template>
19
+ <script lang="ts" setup>
20
+ defineOptions({ name: 'ci-headbtns' })
21
+ </script>
19
22
  <style lang="scss">
20
- .cl-buttons {
23
+ .ci-buttons {
21
24
  display: flex;
22
25
  justify-content: space-between;
23
26
  padding: 5px 10px;
@@ -0,0 +1,4 @@
1
+ import _Headbtns from '../headButtons.vue';
2
+ import { withInstall } from '../../utils/index';
3
+ export const Headbtns = withInstall(_Headbtns);
4
+ export default Headbtns;
@@ -0,0 +1,4 @@
1
+ import _Columncell from '../utils/sortableTableColumnCell.vue';
2
+ import { withInstall } from '../../utils/index';
3
+ export const Columncell = withInstall(_Columncell);
4
+ export default Columncell;
@@ -0,0 +1,4 @@
1
+ import _Sdialog from '../sortableTableDialog.vue';
2
+ import { withInstall } from '../../utils/index';
3
+ export const Sdialog = withInstall(_Sdialog);
4
+ export default Sdialog;
@@ -1,4 +1,4 @@
1
- import { SortColumn } from './interface'
1
+ import { SortColumn } from '../utils/interface'
2
2
 
3
3
  export const setKey = (data: SortColumn[], path: number[] = []) => {
4
4
  data.forEach((v, i) => {
@@ -10,12 +10,12 @@
10
10
  </el-table>
11
11
  </template>
12
12
  <script setup lang="ts">
13
- defineOptions({ name: 'cc-table' })
13
+ defineOptions({ name: 'ci-table' })
14
14
  import { CellCls, ElTable } from 'element-plus'
15
15
  import Sortable from 'sortablejs'
16
16
  import { computed, onBeforeMount, onMounted, ref } from 'vue'
17
17
  import { SortableTableIns, SortColumn } from './utils/interface'
18
- import sortableTableColumnCell from './utils/sortableTableColumnCell.vue'
18
+ import sortableTableColumnCell from './index/sortableTableColumnCell'
19
19
  import { cloneDeep } from 'lodash'
20
20
  let props = defineProps<SortableTableIns>()
21
21
  const elTableRef = ref<InstanceType<typeof ElTable>>()
@@ -1,32 +1,17 @@
1
1
  <template>
2
- <el-dialog
3
- v-model="state"
4
- v-bind="config"
5
- draggable
6
- >
2
+ <el-dialog v-model="state" v-bind="config" draggable>
7
3
  <div class="container">
8
4
  <b>
9
5
  按住
10
6
  <el-icon><Rank /></el-icon>
11
7
  进行移动,点击表头名字进行隐藏, 点击确定进行保存,点击
12
8
  <!-- <Star style="width: 1em; height: 1em; margin-right: 8px" /> -->
13
- <svg-icon
14
- name="regular-center"
15
- size="14"
16
- ></svg-icon>
9
+ <svg-icon name="regular-center" size="14"></svg-icon>
17
10
  固定,点击
18
11
  <!-- <StarFilled style="width: 1em; height: 1em; margin-right: 8px" /> -->
19
- <svg-icon
20
- name="regular-left"
21
- size="14"
22
- color="#2C93FF"
23
- ></svg-icon>
12
+ <svg-icon name="regular-left" size="14" color="#2C93FF"></svg-icon>
24
13
 
25
- <svg-icon
26
- name="regular-right"
27
- size="14"
28
- color="#2C93FF"
29
- ></svg-icon>
14
+ <svg-icon name="regular-right" size="14" color="#2C93FF"></svg-icon>
30
15
  取消固定
31
16
 
32
17
  <el-popover
@@ -48,10 +33,7 @@
48
33
  show-pin
49
34
  />
50
35
 
51
- <el-tooltip
52
- content="将表头配置保存到数据库"
53
- placement="top-end"
54
- >
36
+ <el-tooltip content="将表头配置保存到数据库" placement="top-end">
55
37
  <el-button
56
38
  type="primary"
57
39
  style="width: 100%; margin-top: 10px"
@@ -64,15 +46,13 @@
64
46
  </el-dialog>
65
47
  </template>
66
48
  <script setup lang="ts">
49
+ defineOptions({ name: 'ci-sdialog', inheritAttrs: false })
67
50
  import { computed, ref } from 'vue'
68
51
  import { SortableTableDialog } from './utils/interface'
69
52
  import sortableTableDragItem from './utils/sortableTableDragItem.vue'
70
53
  import { Rank } from '@element-plus/icons-vue'
71
- import SvgIcon from '@/components/SvgIcon.vue'
54
+ import SvgIcon from '../svgIcon/index'
72
55
 
73
- defineOptions({
74
- inheritAttrs: false,
75
- })
76
56
  const emits = defineEmits(['update:modelValue', 'update:data', 'submit'])
77
57
  const state = ref(false)
78
58
  const props = defineProps<SortableTableDialog>()
@@ -82,7 +62,7 @@ const modelValue = computed({
82
62
  },
83
63
  set(value) {
84
64
  emits('update:modelValue', value)
85
- },
65
+ }
86
66
  })
87
67
  defineExpose({
88
68
  open: () => {
@@ -91,7 +71,7 @@ defineExpose({
91
71
  close: () => {
92
72
  state.value = false
93
73
  },
94
- state,
74
+ state
95
75
  })
96
76
  </script>
97
77
  <style scoped lang="scss">
@@ -0,0 +1,4 @@
1
+ import _SorTable from '../sortableTable.vue';
2
+ import { withInstall } from '../../utils/index';
3
+ export const SorTables = withInstall(_SorTable);
4
+ export default SorTables;
@@ -9,15 +9,8 @@
9
9
  */ -->
10
10
 
11
11
  <template>
12
- <el-table-column
13
- v-if="!data.hide && data.children"
14
- v-bind="data.col"
15
- >
16
- <sortable-table-column-cell
17
- v-for="v in data.children || []"
18
- :key="v.key"
19
- :data="v"
20
- />
12
+ <el-table-column v-if="!data.hide && data.children" v-bind="data.col">
13
+ <sortable-table-column-cell v-for="v in data.children || []" :key="v.key" :data="v" />
21
14
  </el-table-column>
22
15
  <el-table-column
23
16
  v-else-if="!data.hide && data.scope"
@@ -30,10 +23,7 @@
30
23
  {{ data.scope(scope) }}
31
24
  </template>
32
25
  <template #header="header">
33
- <component
34
- :is="headerVue(header)"
35
- :header="header"
36
- ></component>
26
+ <component :is="headerVue(header)" :header="header"></component>
37
27
  </template>
38
28
  </el-table-column>
39
29
  <el-table-column
@@ -44,16 +34,10 @@
44
34
  :resizable="data.col.resizable || true"
45
35
  >
46
36
  <template #default="scope">
47
- <component
48
- :is="data.component(h, scope)"
49
- :scope="scope"
50
- ></component>
37
+ <component :is="data.component(h, scope)" :scope="scope"></component>
51
38
  </template>
52
39
  <template #header="header">
53
- <component
54
- :is="headerVue(header)"
55
- :header="header"
56
- ></component>
40
+ <component :is="headerVue(header)" :header="header"></component>
57
41
  </template>
58
42
  </el-table-column>
59
43
  <el-table-column
@@ -64,19 +48,14 @@
64
48
  :resizable="data.col.resizable || true"
65
49
  >
66
50
  <template #header="header">
67
- <component
68
- :is="headerVue(header)"
69
- :header="header"
70
- ></component>
51
+ <component :is="headerVue(header)" :header="header"></component>
71
52
  </template>
72
53
  </el-table-column>
73
54
  </template>
74
55
  <script setup lang="ts">
75
56
  import { Scope, SortColumn } from './interface'
76
57
  import { h } from 'vue'
77
- defineOptions({
78
- name: 'sortable-table-column-cell',
79
- })
58
+ defineOptions({ name: 'ci-columncell' })
80
59
 
81
60
  const props = defineProps<{
82
61
  data: SortColumn
@@ -9,60 +9,29 @@
9
9
  draggable=".item"
10
10
  itemKey="key"
11
11
  >
12
- <template
13
- #item="{ element, index }: { element: SortColumn; index: number }"
14
- >
12
+ <template #item="{ element, index }: { element: SortColumn; index: number }">
15
13
  <div :class="{ item: true, 'item-hide': element.hide }">
16
14
  <div class="mover">
17
15
  <el-icon :size="16"><Rank /></el-icon>
18
16
  </div>
19
- <div
20
- class="title"
21
- @click="handleShow(element)"
22
- >
17
+ <div class="title" @click="handleShow(element)">
23
18
  {{ element.col.label }}
24
19
  </div>
25
- <div
26
- class="pin"
27
- v-if="showPin"
28
- >
20
+ <div class="pin" v-if="showPin">
29
21
  <span
30
22
  v-if="element.col.fixed === true || element.col.fixed === 'left'"
31
23
  @click="element.col.fixed = void 0"
32
24
  >
33
- <svg-icon
34
- name="regular-left"
35
- size="20"
36
- color="#2C93FF"
37
- ></svg-icon>
25
+ <svg-icon name="regular-left" size="20" color="#2C93FF"></svg-icon>
38
26
  </span>
39
- <span
40
- v-else
41
- @click="element.col.fixed = 'left'"
42
- >
43
- <svg-icon
44
- name="regular-center"
45
- size="20"
46
- ></svg-icon>
27
+ <span v-else @click="element.col.fixed = 'left'">
28
+ <svg-icon name="regular-center" size="20"></svg-icon>
47
29
  </span>
48
- <span
49
- v-if="element.col.fixed === 'right'"
50
- @click="element.col.fixed = void 0"
51
- >
52
- <svg-icon
53
- name="regular-right"
54
- size="20"
55
- color="#2C93FF"
56
- ></svg-icon>
30
+ <span v-if="element.col.fixed === 'right'" @click="element.col.fixed = void 0">
31
+ <svg-icon name="regular-right" size="20" color="#2C93FF"></svg-icon>
57
32
  </span>
58
- <span
59
- v-else
60
- @click="element.col.fixed = 'right'"
61
- >
62
- <svg-icon
63
- name="regular-center"
64
- size="20"
65
- ></svg-icon>
33
+ <span v-else @click="element.col.fixed = 'right'">
34
+ <svg-icon name="regular-center" size="20"></svg-icon>
66
35
  </span>
67
36
  </div>
68
37
  <div class="ifshow">
@@ -74,16 +43,13 @@
74
43
  {{ element.hide ? '显示' : '隐藏' }}
75
44
  </el-button>
76
45
  </div>
77
- <sortable-table-drag-item
78
- v-if="element.children"
79
- v-model="element.children"
80
- />
46
+ <sortable-table-drag-item v-if="element.children" v-model="element.children" />
81
47
  </div>
82
48
  </template>
83
49
  </draggable>
84
50
  </template>
85
51
  <script setup lang="ts">
86
- import SvgIcon from '@/components/SvgIcon.vue'
52
+ import SvgIcon from '../../svgIcon/index'
87
53
  import { computed } from 'vue'
88
54
  import draggable from 'vuedraggable'
89
55
  import { SortColumn, SortableTableIns } from './interface'
@@ -99,7 +65,7 @@ const modelValue = computed({
99
65
  },
100
66
  set(value) {
101
67
  emits('update:modelValue', value)
102
- },
68
+ }
103
69
  })
104
70
 
105
71
  // 显示或者隐藏列
@@ -0,0 +1,4 @@
1
+ import _Svgicon from './svgicon.vue'
2
+ import { withInstall } from '../utils/index';
3
+ export const Svgicon = withInstall(_Svgicon)
4
+ export default Svgicon
@@ -0,0 +1,90 @@
1
+ <template>
2
+ <svg aria-hidden="true" :class="['svg-icon', spin && 'svg-icon-spin']" :style="getStyle">
3
+ <use :xlink:href="symbolId" :fill="color" rel="external nofollow" />
4
+ </svg>
5
+ </template>
6
+
7
+ <script setup lang="ts">
8
+ defineOptions({ name: 'ci-svgicon' })
9
+ import { computed } from 'vue'
10
+ import type { CSSProperties } from 'vue'
11
+ const props = defineProps({
12
+ // 图标的id名称默认为 #icon-name
13
+ prefix: {
14
+ type: String,
15
+ default: 'icon'
16
+ },
17
+ // 使用的svg图标名称,也就是svg文件名
18
+ name: {
19
+ type: String,
20
+ required: true
21
+ },
22
+ // 颜色:如果想要用color控制svg图标颜色,那么需要修改.svg文件中的fill属性改成 fill="currentColor"或者直接删掉 fill
23
+ color: {
24
+ type: String,
25
+ default: ''
26
+ },
27
+ // 悬停颜色
28
+ colorh: {
29
+ type: String,
30
+ default: '#000'
31
+ },
32
+ // 大小
33
+ size: {
34
+ type: [Number, String],
35
+ default: 20
36
+ },
37
+ // 修旋转
38
+ spin: {
39
+ type: Boolean,
40
+ default: false
41
+ }
42
+ })
43
+
44
+ // 计算图标id 名称
45
+ const symbolId = computed(() => {
46
+ // console.log(`#${props.prefix}-${props.name}`);
47
+ return `#${props.prefix}-${props.name}`
48
+ })
49
+
50
+ // 计算图标大小
51
+ const getStyle = computed((): CSSProperties => {
52
+ const { size } = props
53
+ let s = `${size}`
54
+ s = `${s.replace('px', '')}px`
55
+ return {
56
+ width: s,
57
+ height: s
58
+ }
59
+ })
60
+ </script>
61
+
62
+ <style scoped>
63
+ .svg-icon {
64
+ display: inline-block;
65
+ overflow: hidden;
66
+ vertical-align: -0.08em;
67
+ fill: currentColor;
68
+ color: v-bind(color);
69
+ }
70
+
71
+ .svg-icon-spin {
72
+ animation: loadingCircle 1s infinite linear;
73
+ }
74
+
75
+ /* 自定义class 悬停 */
76
+ .svg-icon:hover {
77
+ color: v-bind(colorh);
78
+ }
79
+
80
+ /* 旋转动画 */
81
+ @keyframes loadingCircle {
82
+ 0% {
83
+ transform: rotate(0);
84
+ }
85
+
86
+ 100% {
87
+ transform: rotate(360deg);
88
+ }
89
+ }
90
+ </style>
@@ -1,4 +0,0 @@
1
- import _sortableTable from './sortableTable.vue';
2
- import { withInstall } from '../utils/index';
3
- export const sortableTable = withInstall(_sortableTable);
4
- export default sortableTable;