ci-plus 1.0.1
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 +8 -0
- package/index.ts +13 -0
- package/package.json +44 -0
- package/script/build/index.ts +32 -0
- package/script/publish/index.ts +7 -0
- package/script/utils/delpath.ts +30 -0
- package/script/utils/paths.ts +7 -0
- package/script/utils/run.ts +15 -0
- package/src/button/button.vue +41 -0
- package/src/button/index.ts +4 -0
- package/src/button/style/index.less +35 -0
- package/src/buttons/buttons.vue +18 -0
- package/src/buttons/index.ts +4 -0
- package/src/ccapp/ccapp.vue +27 -0
- package/src/ccapp/index.ts +4 -0
- package/src/components.d.ts +18 -0
- package/src/dailog/dialog.vue +266 -0
- package/src/dailog/index.ts +4 -0
- package/src/dailog/style/index.less +69 -0
- package/src/icon/icon.vue +7 -0
- package/src/icon/index.ts +4 -0
- package/src/icon/style/index.less +3 -0
- package/src/index.ts +5 -0
- package/src/sortableTable/headButtons.vue +25 -0
- package/src/sortableTable/headerCheckBox.vue +74 -0
- package/src/sortableTable/headerInput.vue +148 -0
- package/src/sortableTable/headerRange.vue +108 -0
- package/src/sortableTable/headerSelectV2.vue +178 -0
- package/src/sortableTable/sortableTable.ts +4 -0
- package/src/sortableTable/sortableTable.vue +221 -0
- package/src/sortableTable/sortableTableDialog.vue +109 -0
- package/src/sortableTable/utils/dataOpt.ts +65 -0
- package/src/sortableTable/utils/dateShortcuts.ts +72 -0
- package/src/sortableTable/utils/filter.vue +30 -0
- package/src/sortableTable/utils/filterIcon.vue +8 -0
- package/src/sortableTable/utils/headerPopover.vue +92 -0
- package/src/sortableTable/utils/index.d.ts +11 -0
- package/src/sortableTable/utils/interface.ts +52 -0
- package/src/sortableTable/utils/removeParamsFilters.ts +9 -0
- package/src/sortableTable/utils/sortableTableColumnCell.vue +91 -0
- package/src/sortableTable/utils/sortableTableColumnCell2.vue +72 -0
- package/src/sortableTable/utils/sortableTableDragItem.vue +164 -0
- package/src/sortableTable/utils/sortableTableDragItem2.vue +144 -0
- package/src/sortableTable/utils/sortableTableTs.ts +9 -0
- package/src/utils/index.ts +1 -0
- package/src/utils/withinstall/index.ts +12 -0
- package/vite.config.ts +76 -0
package/README.md
ADDED
package/index.ts
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "ci-plus",
|
|
3
|
+
"version": "1.0.1",
|
|
4
|
+
"description": "cc组件库",
|
|
5
|
+
"main": "./index.ts",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"build": "vite build",
|
|
8
|
+
"test": "vitest",
|
|
9
|
+
"coverage": "vitest run --coverage"
|
|
10
|
+
},
|
|
11
|
+
"keywords": [
|
|
12
|
+
"vue",
|
|
13
|
+
"element-plus",
|
|
14
|
+
"ui组件库二次封装"
|
|
15
|
+
],
|
|
16
|
+
"author": "cc",
|
|
17
|
+
"license": "ISC",
|
|
18
|
+
"dependencies": {
|
|
19
|
+
"@element-plus/icons-vue": "^2.3.1",
|
|
20
|
+
"element-plus": "^2.5.1",
|
|
21
|
+
"lodash": "^4.17.21",
|
|
22
|
+
"sortablejs": "^1.15.1",
|
|
23
|
+
"vuedraggable": "^2.24.3"
|
|
24
|
+
},
|
|
25
|
+
"devDependencies": {
|
|
26
|
+
"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
|
+
"sortablejs": "^1.15.1",
|
|
34
|
+
"vuedraggable": "^2.24.3"
|
|
35
|
+
},
|
|
36
|
+
"peerDependenciesMeta": {
|
|
37
|
+
"element-plus": {
|
|
38
|
+
"optional": true
|
|
39
|
+
},
|
|
40
|
+
"lodash": {
|
|
41
|
+
"optional": true
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import delPath from '../utils/delpath';
|
|
2
|
+
import { series, parallel, src, dest } from 'gulp';
|
|
3
|
+
import { pkgPath, componentPath } from '../utils/paths';
|
|
4
|
+
import less from 'gulp-less';
|
|
5
|
+
import autoprefixer from 'gulp-autoprefixer';
|
|
6
|
+
import run from '../utils/run';
|
|
7
|
+
//删除easyest
|
|
8
|
+
|
|
9
|
+
export const removeDist = () => {
|
|
10
|
+
return delPath(`${pkgPath}/easyest`);
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
//打包样式
|
|
14
|
+
export const buildStyle = () => {
|
|
15
|
+
return src(`${componentPath}/src/**/style/**.less`)
|
|
16
|
+
.pipe(less())
|
|
17
|
+
.pipe(autoprefixer())
|
|
18
|
+
.pipe(dest(`${pkgPath}/easyest/lib/src`))
|
|
19
|
+
.pipe(dest(`${pkgPath}/easyest/es/src`));
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
//打包组件
|
|
23
|
+
export const buildComponent = async () => {
|
|
24
|
+
run('pnpm run build', componentPath);
|
|
25
|
+
};
|
|
26
|
+
export default series(
|
|
27
|
+
async () => removeDist(),
|
|
28
|
+
parallel(
|
|
29
|
+
async () => buildStyle(),
|
|
30
|
+
async () => buildComponent()
|
|
31
|
+
)
|
|
32
|
+
);
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import fs from 'fs';
|
|
2
|
+
import { resolve } from 'path';
|
|
3
|
+
import { pkgPath } from './paths';
|
|
4
|
+
//保留的文件
|
|
5
|
+
const stayFile = ['package.json', 'README.md'];
|
|
6
|
+
|
|
7
|
+
const delPath = async (path: string) => {
|
|
8
|
+
let files: string[] = [];
|
|
9
|
+
|
|
10
|
+
if (fs.existsSync(path)) {
|
|
11
|
+
files = fs.readdirSync(path);
|
|
12
|
+
|
|
13
|
+
files.forEach(async (file) => {
|
|
14
|
+
const curPath = resolve(path, file);
|
|
15
|
+
|
|
16
|
+
if (fs.statSync(curPath).isDirectory()) {
|
|
17
|
+
// recurse
|
|
18
|
+
if (file != 'node_modules') await delPath(curPath);
|
|
19
|
+
} else {
|
|
20
|
+
// delete file
|
|
21
|
+
if (!stayFile.includes(file)) {
|
|
22
|
+
fs.unlinkSync(curPath);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
if (path != `${pkgPath}/easyest`) fs.rmdirSync(path);
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
export default delPath;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { spawn } from 'child_process';
|
|
2
|
+
|
|
3
|
+
export default async (command: string, path: string) => {
|
|
4
|
+
//cmd表示命令,args代表参数,如 rm -rf rm就是命令,-rf就为参数
|
|
5
|
+
const [cmd, ...args] = command.split(' ');
|
|
6
|
+
return new Promise((resolve) => {
|
|
7
|
+
const app = spawn(cmd, args, {
|
|
8
|
+
cwd: path, //执行命令的路径
|
|
9
|
+
stdio: 'inherit', //输出共享给父进程
|
|
10
|
+
shell: true //mac不需要开启,windows下git base需要开启支持
|
|
11
|
+
});
|
|
12
|
+
//执行完毕关闭并resolve
|
|
13
|
+
app.on('close', resolve);
|
|
14
|
+
});
|
|
15
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<button
|
|
3
|
+
class="ea-button"
|
|
4
|
+
:class="buttonStyle"
|
|
5
|
+
>
|
|
6
|
+
<slot />
|
|
7
|
+
</button>
|
|
8
|
+
<el-button type="danger">这是个默认的按钮</el-button>
|
|
9
|
+
</template>
|
|
10
|
+
|
|
11
|
+
<script lang="ts" setup>
|
|
12
|
+
import './style/index.less'
|
|
13
|
+
import { computed } from 'vue'
|
|
14
|
+
import { ElButton } from 'element-plus'
|
|
15
|
+
defineOptions({ name: 'ea-button' })
|
|
16
|
+
|
|
17
|
+
// const props = defineProps({
|
|
18
|
+
// // 标题
|
|
19
|
+
// type: {
|
|
20
|
+
// type: String,
|
|
21
|
+
// default: '',
|
|
22
|
+
// },
|
|
23
|
+
// size: {
|
|
24
|
+
// type: String,
|
|
25
|
+
// default: '',
|
|
26
|
+
// },
|
|
27
|
+
// })
|
|
28
|
+
export interface Props {
|
|
29
|
+
type?: string
|
|
30
|
+
size?: string
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const props = withDefaults(defineProps<Props>(), {
|
|
34
|
+
type: '',
|
|
35
|
+
size: '30',
|
|
36
|
+
})
|
|
37
|
+
|
|
38
|
+
const buttonStyle = computed(() => {
|
|
39
|
+
return { [`ea-button--${props.type}`]: props.type }
|
|
40
|
+
})
|
|
41
|
+
</script>
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
.ea-button{
|
|
2
|
+
box-sizing: border-box;
|
|
3
|
+
display: inline-block;
|
|
4
|
+
padding: 12px 20px;
|
|
5
|
+
margin: 0;
|
|
6
|
+
font-size: 14px;
|
|
7
|
+
font-weight: 500;
|
|
8
|
+
line-height: 1;
|
|
9
|
+
color: #606266;
|
|
10
|
+
text-align: center;
|
|
11
|
+
white-space: nowrap;
|
|
12
|
+
cursor: pointer;
|
|
13
|
+
background: #fff;
|
|
14
|
+
border: 1px solid #dcdfe6;
|
|
15
|
+
border-radius: 4px;
|
|
16
|
+
outline: none;
|
|
17
|
+
transition: 0.1s;
|
|
18
|
+
appearance: none;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.ea-button--primary{
|
|
22
|
+
color: #fff;
|
|
23
|
+
background-color: #409eff;
|
|
24
|
+
border-color: #409eff;
|
|
25
|
+
&:hover{
|
|
26
|
+
color: #fff;
|
|
27
|
+
background: #73ff66;
|
|
28
|
+
border-color: #66b1ff;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
// .ea-button--primary:hover{
|
|
32
|
+
// color: #fff;
|
|
33
|
+
// background: #66b1ff;
|
|
34
|
+
// border-color: #66b1ff;
|
|
35
|
+
// }
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<el-button v-bind="props">
|
|
3
|
+
<slot />
|
|
4
|
+
</el-button>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script lang="ts" setup>
|
|
8
|
+
import { ElButton } from 'element-plus'
|
|
9
|
+
import { useAttrs, ref } from 'vue'
|
|
10
|
+
defineOptions({ name: 'ea-buttons' })
|
|
11
|
+
// 获取ElButton的类型提示
|
|
12
|
+
type ButtonProps = (typeof import('element-plus'))['ElButton']
|
|
13
|
+
const aa = ref<ButtonProps>()
|
|
14
|
+
|
|
15
|
+
const props = defineProps(ElButton.props)
|
|
16
|
+
|
|
17
|
+
console.log('props: ', props)
|
|
18
|
+
</script>
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div id="ccapp">我是一个测试组件</div>
|
|
3
|
+
<div>{{ count }}</div>
|
|
4
|
+
<button @click="count++">点击</button>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script setup lang="ts">
|
|
8
|
+
defineOptions({ name: 'cc-app' })
|
|
9
|
+
import { ref } from 'vue'
|
|
10
|
+
const count = ref(0)
|
|
11
|
+
const add = () => {
|
|
12
|
+
count.value++
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
defineExpose({
|
|
16
|
+
add
|
|
17
|
+
})
|
|
18
|
+
console.log(count.value)
|
|
19
|
+
</script>
|
|
20
|
+
|
|
21
|
+
<style lang="less" scoped>
|
|
22
|
+
#ccapp {
|
|
23
|
+
color: pink;
|
|
24
|
+
font-size: 40px;
|
|
25
|
+
font-weight: 900;
|
|
26
|
+
}
|
|
27
|
+
</style>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @Description:
|
|
3
|
+
* @Date: 2023-02-20 19:20:06
|
|
4
|
+
* @Author: 导出类型定义
|
|
5
|
+
* @LastEditTime: 2023-05-22 16:12:52
|
|
6
|
+
*/
|
|
7
|
+
import * as components from './index';
|
|
8
|
+
declare module '@vue/runtime-core' {
|
|
9
|
+
export interface GlobalComponents {
|
|
10
|
+
EaButton: typeof components.Button;
|
|
11
|
+
EaIcon: typeof components.Icon;
|
|
12
|
+
EaButtons: typeof components.Buttons;
|
|
13
|
+
CcDialog: typeof components.Dialog;
|
|
14
|
+
CcApp: typeof components.Ccapp;
|
|
15
|
+
CcTable: typeof components.sortableTable;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
export { };
|
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
<!-- @format -->
|
|
2
|
+
|
|
3
|
+
<script setup lang="ts">
|
|
4
|
+
defineOptions({ name: 'cc-dialog' })
|
|
5
|
+
import { ref, reactive } from 'vue'
|
|
6
|
+
import { Close, FullScreen } from '@element-plus/icons-vue'
|
|
7
|
+
import './style/index.less'
|
|
8
|
+
// 接收fugure组件传值
|
|
9
|
+
export interface Props {
|
|
10
|
+
dialogVisible?: boolean // 是否显示 弹窗
|
|
11
|
+
title?: string // 标题
|
|
12
|
+
draggable?: boolean // 是否可拖拽
|
|
13
|
+
fullscreen?: boolean // 是否全屏
|
|
14
|
+
showfooter?: boolean // 是否显示footer插槽
|
|
15
|
+
closeOnClicModal?: boolean //是否可以通过点击 modal 关闭 Dialog
|
|
16
|
+
closeOnPressEscape?: boolean //是否可以通过按下 ESC 关闭 Dialog
|
|
17
|
+
destroyOnClose?: boolean //当关闭 Dialog 时,销毁其中的元素
|
|
18
|
+
SubmitCb?: () => void //提交表单
|
|
19
|
+
CloseCb?: () => void // 关闭弹窗的回调函数
|
|
20
|
+
style?: string
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const props = withDefaults(defineProps<Props>(), {
|
|
24
|
+
dialogVisible: false,
|
|
25
|
+
title: '',
|
|
26
|
+
draggable: true,
|
|
27
|
+
fullscreen: false,
|
|
28
|
+
showfooter: false,
|
|
29
|
+
closeOnClicModal: false,
|
|
30
|
+
closeOnPressEscape: false,
|
|
31
|
+
destroyOnClose: true,
|
|
32
|
+
style: 'width: 50%;translate(59px, 4px)',
|
|
33
|
+
})
|
|
34
|
+
|
|
35
|
+
// 给父亲组件传递回选中的数据
|
|
36
|
+
|
|
37
|
+
const emit = defineEmits<{
|
|
38
|
+
(e: 'update:sValue', value: string): string
|
|
39
|
+
(e: 'SubmitCb', val?: () => void): any
|
|
40
|
+
(e: 'CloseCb', val?: () => void): any
|
|
41
|
+
}>()
|
|
42
|
+
|
|
43
|
+
// console.log('MySelect传参:', props, emit)
|
|
44
|
+
|
|
45
|
+
const MyDialogRef = ref<any>(null)
|
|
46
|
+
const dialogVisible = ref(false) // 是否弹出编辑出口
|
|
47
|
+
const MyFullscreen = ref(props.fullscreen) // 是否全屏
|
|
48
|
+
|
|
49
|
+
// 定义一个函数获取窗口高度
|
|
50
|
+
let windowHeightL =
|
|
51
|
+
window.innerHeight ||
|
|
52
|
+
document.documentElement.clientHeight ||
|
|
53
|
+
document.body.clientHeight
|
|
54
|
+
const windowHeight = ref(windowHeightL)
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* 处理样子逻辑:初始样式为空,然后根据传递是否全屏进行调整
|
|
58
|
+
* 全屏的时候:MyStyle 还是为空
|
|
59
|
+
* 窗口化时候:获取传递的样式或者默认样式
|
|
60
|
+
* 窗口时默认样式设置为:props.style + `max-height: calc( ${windowHeight.value}px - 20vh);translate(59px, 4px)`
|
|
61
|
+
* */
|
|
62
|
+
const MyStyle = ref('') //初始样式为空
|
|
63
|
+
const dTop = ref() // 弹窗在非全屏时候距离顶部的距离
|
|
64
|
+
// 判断在非全屏状态 距离顶部的距离
|
|
65
|
+
if (!MyFullscreen.value) {
|
|
66
|
+
dTop.value = '10vh'
|
|
67
|
+
} else {
|
|
68
|
+
dTop.value = '0px' // 全屏时候为0
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// 根据传递搜全屏给调整最大高度:如果为不全屏立马给一个最大高度
|
|
72
|
+
if (props.fullscreen == false) {
|
|
73
|
+
console.log('判断进来没222')
|
|
74
|
+
MyStyle.value =
|
|
75
|
+
props.style +
|
|
76
|
+
`max-height: calc( ${windowHeight.value}px - ${dTop.value});translate(59px, 4px)`
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
// 函数
|
|
80
|
+
// 关闭函数
|
|
81
|
+
const closeDialog = () => {
|
|
82
|
+
dialogVisible.value = false // 关闭弹窗
|
|
83
|
+
// 初始样式
|
|
84
|
+
if (props.fullscreen) {
|
|
85
|
+
MyStyle.value = '' //'' + `max-height: calc( ${windowHeight.value}px - 20vh);translate(59px, 4px)`;
|
|
86
|
+
} else {
|
|
87
|
+
MyStyle.value =
|
|
88
|
+
props.style +
|
|
89
|
+
`max-height: calc( ${windowHeight.value}px - ${dTop.value});translate(59px, 4px)`
|
|
90
|
+
//props.style + `translate(59px, 4px)`;
|
|
91
|
+
}
|
|
92
|
+
MyFullscreen.value = props.fullscreen
|
|
93
|
+
|
|
94
|
+
// 如果父组件传递了关闭函数回调 需要执行父组件的关闭函数逻辑
|
|
95
|
+
emit('CloseCb')
|
|
96
|
+
console.log('通过 @CloseCb="Function" 方式可传递关闭回调函数')
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
// 是否全局按钮切换
|
|
100
|
+
const fullscreenChang = () => {
|
|
101
|
+
MyFullscreen.value = !MyFullscreen.value
|
|
102
|
+
if (MyFullscreen.value) {
|
|
103
|
+
MyStyle.value = '' // 全屏
|
|
104
|
+
} else {
|
|
105
|
+
MyStyle.value =
|
|
106
|
+
props.style +
|
|
107
|
+
`max-height: calc( ${window.innerHeight}px - ${dTop.value});translate(59px, 4px)` // 非全屏
|
|
108
|
+
dTop.value = '10vh'
|
|
109
|
+
}
|
|
110
|
+
// console.log('窗口高度', window.innerHeight, MyStyle.value)
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
// console.log('窗口高度66666', window.innerHeight, MyStyle.value)
|
|
114
|
+
|
|
115
|
+
//提交函数
|
|
116
|
+
const Submit = (val: any) => {
|
|
117
|
+
// 执行父组件传递的提交函数:如果父组件没传递提交回调函数就提醒
|
|
118
|
+
emit('SubmitCb')
|
|
119
|
+
// if (true) {
|
|
120
|
+
console.log('通过 @SubmitCb="Function()" 方式可传递提交回调函数')
|
|
121
|
+
// }
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
// 打开弹窗
|
|
125
|
+
const showMydia = async () => {
|
|
126
|
+
dialogVisible.value = true
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
// 弹窗打开时执行的函数
|
|
130
|
+
const openChang = (val: any) => {
|
|
131
|
+
console.log('打开了', val)
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
defineExpose({
|
|
135
|
+
showMydia,
|
|
136
|
+
closeDialog, //关闭函数
|
|
137
|
+
})
|
|
138
|
+
|
|
139
|
+
/////////////////////////////////////////////////////
|
|
140
|
+
const domInfo = reactive({
|
|
141
|
+
baseW: 0,
|
|
142
|
+
baseH: 0,
|
|
143
|
+
})
|
|
144
|
+
const container = ref<HTMLElement>(null)
|
|
145
|
+
|
|
146
|
+
const updateTarget = (event: MouseEvent) => {
|
|
147
|
+
if (!MyDialogRef.value) {
|
|
148
|
+
console.error('drag--- 请传入一个HTMLElement节点')
|
|
149
|
+
return
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
// console.log('样式', MyDialogRef.value.dialogContentRef.$el.style);
|
|
153
|
+
|
|
154
|
+
// console.log('w', MyDialogRef.value.dialogContentRef.$el.style.width)
|
|
155
|
+
// console.log('w', MyDialogRef.value.dialogContentRef.$el.style.height)
|
|
156
|
+
// console.log('H', MyDialogRef.value.dialogContentRef.$el.style.clientHeight);
|
|
157
|
+
|
|
158
|
+
// movementX/movementY
|
|
159
|
+
// 两个鼠标移动事件间隔时间中当中鼠标移动的相对坐标;
|
|
160
|
+
domInfo.baseW = parseInt(MyDialogRef.value.dialogContentRef.$el.style.width)
|
|
161
|
+
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`
|
|
168
|
+
// console.log('参数x', event.movementX)
|
|
169
|
+
// console.log('参数y', event.movementY)
|
|
170
|
+
}
|
|
171
|
+
// change 回调方式
|
|
172
|
+
const onTdMousedown = (e: MouseEvent) => {
|
|
173
|
+
window.addEventListener('mousemove', updateTarget)
|
|
174
|
+
window.onmouseup = function () {
|
|
175
|
+
window.onmouseup = null
|
|
176
|
+
window.removeEventListener('mousemove', updateTarget)
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
</script>
|
|
180
|
+
<template>
|
|
181
|
+
<!-- :width="typeOpen == 'add' ? '900px' : '600px'"
|
|
182
|
+
:height="typeOpen == 'add' ? '500px' : '200px'" -->
|
|
183
|
+
|
|
184
|
+
<div id="dia">
|
|
185
|
+
<el-dialog
|
|
186
|
+
class="container"
|
|
187
|
+
v-if="dialogVisible"
|
|
188
|
+
v-model="dialogVisible"
|
|
189
|
+
:title="title"
|
|
190
|
+
:draggable="draggable"
|
|
191
|
+
:fullscreen="MyFullscreen"
|
|
192
|
+
:close-on-click-modal="closeOnClicModal"
|
|
193
|
+
:close-on-press-escape="closeOnPressEscape"
|
|
194
|
+
:destroy-on-close="destroyOnClose"
|
|
195
|
+
@close="closeDialog"
|
|
196
|
+
:show-close="false"
|
|
197
|
+
@open="openChang"
|
|
198
|
+
:style="MyStyle"
|
|
199
|
+
:top="dTop"
|
|
200
|
+
ref="MyDialogRef"
|
|
201
|
+
>
|
|
202
|
+
<template #header="{ close, titleId, titleClass }">
|
|
203
|
+
<div class="my-header">
|
|
204
|
+
<div class="title">
|
|
205
|
+
<div
|
|
206
|
+
:id="titleId"
|
|
207
|
+
:class="titleClass"
|
|
208
|
+
>
|
|
209
|
+
{{ title }}
|
|
210
|
+
</div>
|
|
211
|
+
</div>
|
|
212
|
+
<div class="btn">
|
|
213
|
+
<el-button
|
|
214
|
+
size="small"
|
|
215
|
+
type="primary"
|
|
216
|
+
:icon="FullScreen"
|
|
217
|
+
circle
|
|
218
|
+
@click="fullscreenChang"
|
|
219
|
+
/>
|
|
220
|
+
<el-button
|
|
221
|
+
size="small"
|
|
222
|
+
type="danger"
|
|
223
|
+
:icon="Close"
|
|
224
|
+
circle
|
|
225
|
+
@click="closeDialog"
|
|
226
|
+
/>
|
|
227
|
+
</div>
|
|
228
|
+
</div>
|
|
229
|
+
</template>
|
|
230
|
+
|
|
231
|
+
<template #default="props">
|
|
232
|
+
<!-- <div class="my-body"> -->
|
|
233
|
+
<slot :data="MyDialogRef"></slot>
|
|
234
|
+
<slot
|
|
235
|
+
name="dialong"
|
|
236
|
+
:data="props"
|
|
237
|
+
></slot>
|
|
238
|
+
<!-- </div> -->
|
|
239
|
+
<div
|
|
240
|
+
class="drag"
|
|
241
|
+
@mousedown="onTdMousedown($event)"
|
|
242
|
+
></div>
|
|
243
|
+
</template>
|
|
244
|
+
|
|
245
|
+
<template
|
|
246
|
+
#footer
|
|
247
|
+
v-if="showfooter"
|
|
248
|
+
>
|
|
249
|
+
<slot name="myfooter">
|
|
250
|
+
<span class="dialog-footer">
|
|
251
|
+
<el-button @click="closeDialog">取消</el-button>
|
|
252
|
+
<el-button
|
|
253
|
+
type="primary"
|
|
254
|
+
@click="Submit"
|
|
255
|
+
>
|
|
256
|
+
保存
|
|
257
|
+
</el-button>
|
|
258
|
+
</span>
|
|
259
|
+
</slot>
|
|
260
|
+
</template>
|
|
261
|
+
<!-- <div class="drag" @mousedown="onTdMousedown($event)"></div> -->
|
|
262
|
+
</el-dialog>
|
|
263
|
+
</div>
|
|
264
|
+
</template>
|
|
265
|
+
|
|
266
|
+
<style lang="less" scope></style>
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
#dia {
|
|
2
|
+
.el-dialog {
|
|
3
|
+
// height: 100% !important;
|
|
4
|
+
// max-height: calc(100% - 10vh);
|
|
5
|
+
.el-dialog__header {
|
|
6
|
+
height: 35px !important;
|
|
7
|
+
line-height: 35px !important;
|
|
8
|
+
margin: 0 !important;
|
|
9
|
+
padding: 0px !important;
|
|
10
|
+
background-color: rgba(0, 0, 0, 0.1) !important;
|
|
11
|
+
|
|
12
|
+
.my-header {
|
|
13
|
+
display: flex;
|
|
14
|
+
height: 35px;
|
|
15
|
+
line-height: 35px;
|
|
16
|
+
margin: 0 10px;
|
|
17
|
+
.title {
|
|
18
|
+
flex: 1;
|
|
19
|
+
.el-dialog__title {
|
|
20
|
+
margin: 0px !important;
|
|
21
|
+
padding: 0px !important;
|
|
22
|
+
height: 35px !important;
|
|
23
|
+
line-height: 35px;
|
|
24
|
+
margin: 0 !important;
|
|
25
|
+
padding: 0 !important;
|
|
26
|
+
text-align: left !important;
|
|
27
|
+
font-weight: 700;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
.btn {
|
|
31
|
+
max-width: 100px;
|
|
32
|
+
display: flex;
|
|
33
|
+
justify-content: flex-end;
|
|
34
|
+
height: 35px;
|
|
35
|
+
line-height: 35px;
|
|
36
|
+
align-items: center;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// 内容区域
|
|
42
|
+
.el-dialog__body {
|
|
43
|
+
height: calc(100% - 65px);
|
|
44
|
+
overflow: auto;
|
|
45
|
+
.my-body {
|
|
46
|
+
text-align: left;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
.drag {
|
|
51
|
+
position: absolute;
|
|
52
|
+
width: 16px;
|
|
53
|
+
height: 16px;
|
|
54
|
+
bottom: 3px;
|
|
55
|
+
// background: red;
|
|
56
|
+
right: 3px;
|
|
57
|
+
z-index: 999;
|
|
58
|
+
border-radius: inherit;
|
|
59
|
+
box-shadow: 2px 2px 0px -1px red;
|
|
60
|
+
cursor: se-resize; // move:十字
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// .container {
|
|
64
|
+
// width: 100px;
|
|
65
|
+
// height: 100px;
|
|
66
|
+
// // background-color: #ccc;
|
|
67
|
+
// position: relative;
|
|
68
|
+
// }
|
|
69
|
+
}
|