vue-wiring-diagram 1.1.22 → 1.1.24
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 +93 -93
- package/dist/style.css +1 -1
- package/dist/vue-wiring-diagram.es.js +5563 -5234
- package/dist/vue-wiring-diagram.umd.js +27 -27
- package/package.json +1 -1
- package/packages/components/Shortcuts.vue +31 -31
- package/packages/components/baseShape.js +62 -62
- package/packages/components/common.js +105 -105
- package/packages/components/edge-control/arrow-line.vue +292 -292
- package/packages/components/edge-control/condition.vue +110 -110
- package/packages/components/edge-control/default-line.vue +156 -156
- package/packages/components/edge-control/index.vue +94 -94
- package/packages/components/edge-control/pipe-line.vue +354 -354
- package/packages/components/editor/index.vue +590 -590
- package/packages/components/enums.js +80 -80
- package/packages/components/graph-control/index.vue +121 -121
- package/packages/components/image-control/group-form.vue +114 -114
- package/packages/components/image-control/image-condition.vue +117 -0
- package/packages/components/image-control/image-form.vue +184 -184
- package/packages/components/image-control/image-management.vue +213 -213
- package/packages/components/image-control/index.vue +290 -124
- package/packages/components/portsOptions.js +21 -21
- package/packages/components/preview/index.vue +399 -355
- package/packages/components/settings.js +262 -262
- package/packages/components/text-control/index.vue +457 -457
- package/packages/components/tools.js +256 -256
- package/packages/http.js +104 -104
- package/packages/index.js +43 -43
- package/packages/styles/animation.scss +27 -27
- package/packages/styles/dialog.scss +4 -4
- package/packages/styles/editor.scss +165 -165
- package/packages/styles/elPath.scss +257 -257
|
@@ -1,80 +1,80 @@
|
|
|
1
|
-
export const LINE = 'line'
|
|
2
|
-
export const PIPE = 'pipe'
|
|
3
|
-
export const ARROW = 'arrow'
|
|
4
|
-
|
|
5
|
-
// 线类型
|
|
6
|
-
export const typeList = [{
|
|
7
|
-
label: '直线',
|
|
8
|
-
value: LINE,
|
|
9
|
-
}, {
|
|
10
|
-
label: '管道',
|
|
11
|
-
value: PIPE,
|
|
12
|
-
}, {
|
|
13
|
-
label: '箭头',
|
|
14
|
-
value: ARROW,
|
|
15
|
-
}]
|
|
16
|
-
|
|
17
|
-
// 箭头类型
|
|
18
|
-
export const arrowList = [
|
|
19
|
-
{
|
|
20
|
-
label: 'Block',
|
|
21
|
-
value: 'block'
|
|
22
|
-
},
|
|
23
|
-
{
|
|
24
|
-
label: 'Classic',
|
|
25
|
-
value: 'classic'
|
|
26
|
-
},
|
|
27
|
-
{
|
|
28
|
-
label: 'Diamond',
|
|
29
|
-
value: 'diamond'
|
|
30
|
-
},
|
|
31
|
-
{
|
|
32
|
-
label: 'Cross',
|
|
33
|
-
value: 'cross'
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
label: 'Async',
|
|
37
|
-
value: 'async'
|
|
38
|
-
},
|
|
39
|
-
{
|
|
40
|
-
label: 'Circle',
|
|
41
|
-
value: 'circle'
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
label: 'CirclePlus',
|
|
45
|
-
value: 'circlePlus'
|
|
46
|
-
},
|
|
47
|
-
{
|
|
48
|
-
label: 'Ellipse',
|
|
49
|
-
value: 'ellipse'
|
|
50
|
-
},
|
|
51
|
-
]
|
|
52
|
-
|
|
53
|
-
export const STOP = 'stop'
|
|
54
|
-
export const FORWARD_PIPE = 'forward-pipe'
|
|
55
|
-
export const REVERSE_PIPE = 'reverse-pipe'
|
|
56
|
-
|
|
57
|
-
// 管道方向
|
|
58
|
-
export const directionList = [{
|
|
59
|
-
label: '停止',
|
|
60
|
-
value: STOP,
|
|
61
|
-
}, {
|
|
62
|
-
label: '正向',
|
|
63
|
-
value: FORWARD_PIPE,
|
|
64
|
-
}, {
|
|
65
|
-
label: '反向',
|
|
66
|
-
value: REVERSE_PIPE,
|
|
67
|
-
}]
|
|
68
|
-
|
|
69
|
-
export const FLASHING = 'flashing'
|
|
70
|
-
export const ARROWFORWARD = 'arrowForward'
|
|
71
|
-
export const ARROWBACKWORD = 'arrowBackward'
|
|
72
|
-
|
|
73
|
-
// 箭头方向
|
|
74
|
-
export const arrowDirection = [{
|
|
75
|
-
label: '正向',
|
|
76
|
-
value: ARROWFORWARD,
|
|
77
|
-
}, {
|
|
78
|
-
label: '反向',
|
|
79
|
-
value: ARROWBACKWORD,
|
|
80
|
-
}]
|
|
1
|
+
export const LINE = 'line'
|
|
2
|
+
export const PIPE = 'pipe'
|
|
3
|
+
export const ARROW = 'arrow'
|
|
4
|
+
|
|
5
|
+
// 线类型
|
|
6
|
+
export const typeList = [{
|
|
7
|
+
label: '直线',
|
|
8
|
+
value: LINE,
|
|
9
|
+
}, {
|
|
10
|
+
label: '管道',
|
|
11
|
+
value: PIPE,
|
|
12
|
+
}, {
|
|
13
|
+
label: '箭头',
|
|
14
|
+
value: ARROW,
|
|
15
|
+
}]
|
|
16
|
+
|
|
17
|
+
// 箭头类型
|
|
18
|
+
export const arrowList = [
|
|
19
|
+
{
|
|
20
|
+
label: 'Block',
|
|
21
|
+
value: 'block'
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
label: 'Classic',
|
|
25
|
+
value: 'classic'
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
label: 'Diamond',
|
|
29
|
+
value: 'diamond'
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
label: 'Cross',
|
|
33
|
+
value: 'cross'
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
label: 'Async',
|
|
37
|
+
value: 'async'
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
label: 'Circle',
|
|
41
|
+
value: 'circle'
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
label: 'CirclePlus',
|
|
45
|
+
value: 'circlePlus'
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
label: 'Ellipse',
|
|
49
|
+
value: 'ellipse'
|
|
50
|
+
},
|
|
51
|
+
]
|
|
52
|
+
|
|
53
|
+
export const STOP = 'stop'
|
|
54
|
+
export const FORWARD_PIPE = 'forward-pipe'
|
|
55
|
+
export const REVERSE_PIPE = 'reverse-pipe'
|
|
56
|
+
|
|
57
|
+
// 管道方向
|
|
58
|
+
export const directionList = [{
|
|
59
|
+
label: '停止',
|
|
60
|
+
value: STOP,
|
|
61
|
+
}, {
|
|
62
|
+
label: '正向',
|
|
63
|
+
value: FORWARD_PIPE,
|
|
64
|
+
}, {
|
|
65
|
+
label: '反向',
|
|
66
|
+
value: REVERSE_PIPE,
|
|
67
|
+
}]
|
|
68
|
+
|
|
69
|
+
export const FLASHING = 'flashing'
|
|
70
|
+
export const ARROWFORWARD = 'arrowForward'
|
|
71
|
+
export const ARROWBACKWORD = 'arrowBackward'
|
|
72
|
+
|
|
73
|
+
// 箭头方向
|
|
74
|
+
export const arrowDirection = [{
|
|
75
|
+
label: '正向',
|
|
76
|
+
value: ARROWFORWARD,
|
|
77
|
+
}, {
|
|
78
|
+
label: '反向',
|
|
79
|
+
value: ARROWBACKWORD,
|
|
80
|
+
}]
|
|
@@ -1,121 +1,121 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @Author: HuaYJ
|
|
3
|
-
* @Date: 2024/10/22 12:56
|
|
4
|
-
*/
|
|
5
|
-
<template>
|
|
6
|
-
<div class="control">
|
|
7
|
-
<el-collapse v-model="activeName" accordion>
|
|
8
|
-
<el-collapse-item title="基础属性" name="1">
|
|
9
|
-
<div class="row-column">
|
|
10
|
-
<el-row :gutter="20">
|
|
11
|
-
<el-col :span="12">
|
|
12
|
-
<div class="row-label">背景色</div>
|
|
13
|
-
</el-col>
|
|
14
|
-
<el-col :span="12">
|
|
15
|
-
<el-color-picker v-model="color" size="small" show-alpha @change="changeColor"/>
|
|
16
|
-
</el-col>
|
|
17
|
-
</el-row>
|
|
18
|
-
<el-row :gutter="20">
|
|
19
|
-
<el-col :span="12">
|
|
20
|
-
<div class="row-label">网格</div>
|
|
21
|
-
</el-col>
|
|
22
|
-
<el-col :span="12">
|
|
23
|
-
<el-switch v-model="visible" :active-value="true" :inactive-value="false" size="small" @change="changeGrid"/>
|
|
24
|
-
</el-col>
|
|
25
|
-
</el-row>
|
|
26
|
-
<el-row :gutter="20">
|
|
27
|
-
<el-col :span="12">
|
|
28
|
-
<div class="row-label">网格大小</div>
|
|
29
|
-
</el-col>
|
|
30
|
-
<el-col :span="12">
|
|
31
|
-
<el-input-number v-model="size" :min="1" :max="20" size="small" controls-position="right" @change="changeGrid"/>
|
|
32
|
-
</el-col>
|
|
33
|
-
</el-row>
|
|
34
|
-
<el-row :gutter="20">
|
|
35
|
-
<el-col :span="12">
|
|
36
|
-
<div class="row-label">主网格颜色</div>
|
|
37
|
-
</el-col>
|
|
38
|
-
<el-col :span="12">
|
|
39
|
-
<el-color-picker v-model="gridColor" size="small" show-alpha @change="changeGrid"/>
|
|
40
|
-
</el-col>
|
|
41
|
-
</el-row>
|
|
42
|
-
<el-row :gutter="20">
|
|
43
|
-
<el-col :span="12">
|
|
44
|
-
<div class="row-label">次网格颜色</div>
|
|
45
|
-
</el-col>
|
|
46
|
-
<el-col :span="12">
|
|
47
|
-
<el-color-picker v-model="gridColor2" size="small" show-alpha @change="changeGrid"/>
|
|
48
|
-
</el-col>
|
|
49
|
-
</el-row>
|
|
50
|
-
<el-row :gutter="20">
|
|
51
|
-
<el-col :span="12">
|
|
52
|
-
<div class="row-label">主网格粗细</div>
|
|
53
|
-
</el-col>
|
|
54
|
-
<el-col :span="12">
|
|
55
|
-
<el-input-number v-model="thickness" :min=".5" :max="10" size="small" controls-position="right" @change="changeGrid"/>
|
|
56
|
-
</el-col>
|
|
57
|
-
</el-row>
|
|
58
|
-
<el-row :gutter="20">
|
|
59
|
-
<el-col :span="12">
|
|
60
|
-
<div class="row-label">次网格粗细</div>
|
|
61
|
-
</el-col>
|
|
62
|
-
<el-col :span="12">
|
|
63
|
-
<el-input-number v-model="thickness2" :min=".5" :max="10" size="small" controls-position="right" @change="changeGrid"/>
|
|
64
|
-
</el-col>
|
|
65
|
-
</el-row>
|
|
66
|
-
</div>
|
|
67
|
-
</el-collapse-item>
|
|
68
|
-
</el-collapse>
|
|
69
|
-
</div>
|
|
70
|
-
</template>
|
|
71
|
-
|
|
72
|
-
<script setup>
|
|
73
|
-
|
|
74
|
-
import {ref} from "vue";
|
|
75
|
-
|
|
76
|
-
const props = defineProps({
|
|
77
|
-
payload: Object
|
|
78
|
-
})
|
|
79
|
-
const color = ref(props.payload.value.options.background?.color || null) // 画布背景颜色
|
|
80
|
-
const visible = ref(props.payload.value.options?.grid?.visible || null) // 网格是否显示
|
|
81
|
-
const size = ref(props.payload.value.options?.grid?.size || 10) // 网格大小
|
|
82
|
-
const gridColor = ref(props.payload.value.options?.grid?.args?.[0]?.color || null) // 主网格颜色
|
|
83
|
-
const thickness = ref(props.payload.value.options?.grid?.args?.[0]?.thickness || 1) // 主网格粗细
|
|
84
|
-
const gridColor2 = ref(props.payload.value.options?.grid?.args?.[1]?.color || null) // 次网格颜色
|
|
85
|
-
const thickness2 = ref(props.payload.value.options?.grid?.args?.[1]?.thickness || 1) // 次网格粗细
|
|
86
|
-
const activeName = ref('1')// 控制面板激活项
|
|
87
|
-
|
|
88
|
-
/**
|
|
89
|
-
* 修改画布背景颜色
|
|
90
|
-
* @param color
|
|
91
|
-
*/
|
|
92
|
-
const changeColor = (color) => {
|
|
93
|
-
props.payload.value.drawBackground({
|
|
94
|
-
color: color
|
|
95
|
-
})
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
/**
|
|
99
|
-
* 修改网格类型
|
|
100
|
-
*/
|
|
101
|
-
const changeGrid = () => {
|
|
102
|
-
props.payload.value.drawGrid({
|
|
103
|
-
visible: visible.value,
|
|
104
|
-
size: size.value,
|
|
105
|
-
type: 'doubleMesh',
|
|
106
|
-
args: [
|
|
107
|
-
{
|
|
108
|
-
color: gridColor.value,
|
|
109
|
-
thickness: thickness.value
|
|
110
|
-
}, {
|
|
111
|
-
color: gridColor2.value,
|
|
112
|
-
thickness: thickness2.value
|
|
113
|
-
}
|
|
114
|
-
]
|
|
115
|
-
})
|
|
116
|
-
}
|
|
117
|
-
</script>
|
|
118
|
-
|
|
119
|
-
<style scoped lang="scss">
|
|
120
|
-
@use "packages/styles/editor";
|
|
121
|
-
</style>
|
|
1
|
+
/**
|
|
2
|
+
* @Author: HuaYJ
|
|
3
|
+
* @Date: 2024/10/22 12:56
|
|
4
|
+
*/
|
|
5
|
+
<template>
|
|
6
|
+
<div class="control">
|
|
7
|
+
<el-collapse v-model="activeName" accordion>
|
|
8
|
+
<el-collapse-item title="基础属性" name="1">
|
|
9
|
+
<div class="row-column">
|
|
10
|
+
<el-row :gutter="20">
|
|
11
|
+
<el-col :span="12">
|
|
12
|
+
<div class="row-label">背景色</div>
|
|
13
|
+
</el-col>
|
|
14
|
+
<el-col :span="12">
|
|
15
|
+
<el-color-picker v-model="color" size="small" show-alpha @change="changeColor"/>
|
|
16
|
+
</el-col>
|
|
17
|
+
</el-row>
|
|
18
|
+
<el-row :gutter="20">
|
|
19
|
+
<el-col :span="12">
|
|
20
|
+
<div class="row-label">网格</div>
|
|
21
|
+
</el-col>
|
|
22
|
+
<el-col :span="12">
|
|
23
|
+
<el-switch v-model="visible" :active-value="true" :inactive-value="false" size="small" @change="changeGrid"/>
|
|
24
|
+
</el-col>
|
|
25
|
+
</el-row>
|
|
26
|
+
<el-row :gutter="20">
|
|
27
|
+
<el-col :span="12">
|
|
28
|
+
<div class="row-label">网格大小</div>
|
|
29
|
+
</el-col>
|
|
30
|
+
<el-col :span="12">
|
|
31
|
+
<el-input-number v-model="size" :min="1" :max="20" size="small" controls-position="right" @change="changeGrid"/>
|
|
32
|
+
</el-col>
|
|
33
|
+
</el-row>
|
|
34
|
+
<el-row :gutter="20">
|
|
35
|
+
<el-col :span="12">
|
|
36
|
+
<div class="row-label">主网格颜色</div>
|
|
37
|
+
</el-col>
|
|
38
|
+
<el-col :span="12">
|
|
39
|
+
<el-color-picker v-model="gridColor" size="small" show-alpha @change="changeGrid"/>
|
|
40
|
+
</el-col>
|
|
41
|
+
</el-row>
|
|
42
|
+
<el-row :gutter="20">
|
|
43
|
+
<el-col :span="12">
|
|
44
|
+
<div class="row-label">次网格颜色</div>
|
|
45
|
+
</el-col>
|
|
46
|
+
<el-col :span="12">
|
|
47
|
+
<el-color-picker v-model="gridColor2" size="small" show-alpha @change="changeGrid"/>
|
|
48
|
+
</el-col>
|
|
49
|
+
</el-row>
|
|
50
|
+
<el-row :gutter="20">
|
|
51
|
+
<el-col :span="12">
|
|
52
|
+
<div class="row-label">主网格粗细</div>
|
|
53
|
+
</el-col>
|
|
54
|
+
<el-col :span="12">
|
|
55
|
+
<el-input-number v-model="thickness" :min=".5" :max="10" size="small" controls-position="right" @change="changeGrid"/>
|
|
56
|
+
</el-col>
|
|
57
|
+
</el-row>
|
|
58
|
+
<el-row :gutter="20">
|
|
59
|
+
<el-col :span="12">
|
|
60
|
+
<div class="row-label">次网格粗细</div>
|
|
61
|
+
</el-col>
|
|
62
|
+
<el-col :span="12">
|
|
63
|
+
<el-input-number v-model="thickness2" :min=".5" :max="10" size="small" controls-position="right" @change="changeGrid"/>
|
|
64
|
+
</el-col>
|
|
65
|
+
</el-row>
|
|
66
|
+
</div>
|
|
67
|
+
</el-collapse-item>
|
|
68
|
+
</el-collapse>
|
|
69
|
+
</div>
|
|
70
|
+
</template>
|
|
71
|
+
|
|
72
|
+
<script setup>
|
|
73
|
+
|
|
74
|
+
import {ref} from "vue";
|
|
75
|
+
|
|
76
|
+
const props = defineProps({
|
|
77
|
+
payload: Object
|
|
78
|
+
})
|
|
79
|
+
const color = ref(props.payload.value.options.background?.color || null) // 画布背景颜色
|
|
80
|
+
const visible = ref(props.payload.value.options?.grid?.visible || null) // 网格是否显示
|
|
81
|
+
const size = ref(props.payload.value.options?.grid?.size || 10) // 网格大小
|
|
82
|
+
const gridColor = ref(props.payload.value.options?.grid?.args?.[0]?.color || null) // 主网格颜色
|
|
83
|
+
const thickness = ref(props.payload.value.options?.grid?.args?.[0]?.thickness || 1) // 主网格粗细
|
|
84
|
+
const gridColor2 = ref(props.payload.value.options?.grid?.args?.[1]?.color || null) // 次网格颜色
|
|
85
|
+
const thickness2 = ref(props.payload.value.options?.grid?.args?.[1]?.thickness || 1) // 次网格粗细
|
|
86
|
+
const activeName = ref('1')// 控制面板激活项
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* 修改画布背景颜色
|
|
90
|
+
* @param color
|
|
91
|
+
*/
|
|
92
|
+
const changeColor = (color) => {
|
|
93
|
+
props.payload.value.drawBackground({
|
|
94
|
+
color: color
|
|
95
|
+
})
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* 修改网格类型
|
|
100
|
+
*/
|
|
101
|
+
const changeGrid = () => {
|
|
102
|
+
props.payload.value.drawGrid({
|
|
103
|
+
visible: visible.value,
|
|
104
|
+
size: size.value,
|
|
105
|
+
type: 'doubleMesh',
|
|
106
|
+
args: [
|
|
107
|
+
{
|
|
108
|
+
color: gridColor.value,
|
|
109
|
+
thickness: thickness.value
|
|
110
|
+
}, {
|
|
111
|
+
color: gridColor2.value,
|
|
112
|
+
thickness: thickness2.value
|
|
113
|
+
}
|
|
114
|
+
]
|
|
115
|
+
})
|
|
116
|
+
}
|
|
117
|
+
</script>
|
|
118
|
+
|
|
119
|
+
<style scoped lang="scss">
|
|
120
|
+
@use "packages/styles/editor";
|
|
121
|
+
</style>
|
|
@@ -1,114 +1,114 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @Author: HuaYJ
|
|
3
|
-
* @Date: 2025/2/8 09:22
|
|
4
|
-
*/
|
|
5
|
-
<template>
|
|
6
|
-
<div class="form-container">
|
|
7
|
-
<el-form ref="form" :model="model" :rules="rules" label-width="90px" label-suffix=":">
|
|
8
|
-
<el-form-item label="分组名称" prop="groupName">
|
|
9
|
-
<el-input v-model="model.groupName" placeholder="请输入分组名称" clearable/>
|
|
10
|
-
</el-form-item>
|
|
11
|
-
<el-form-item label="排序" prop="sort">
|
|
12
|
-
<el-input-number v-model="model.sort" :min="0" :max="999" :step="1" controls-position="right"/>
|
|
13
|
-
</el-form-item>
|
|
14
|
-
<el-form-item label="是否显示" prop="isShow">
|
|
15
|
-
<el-switch v-model="model.isShow" :active-value="1" :inactive-value="0" active-color="#13ce66"
|
|
16
|
-
inactive-color="#ff4949"/>
|
|
17
|
-
</el-form-item>
|
|
18
|
-
<div class="footer">
|
|
19
|
-
<el-button type="primary" @click="saveBtnClick">保存</el-button>
|
|
20
|
-
<el-button @click="cancelBtnClick">取消</el-button>
|
|
21
|
-
</div>
|
|
22
|
-
</el-form>
|
|
23
|
-
</div>
|
|
24
|
-
</template>
|
|
25
|
-
|
|
26
|
-
<script setup>
|
|
27
|
-
import {onMounted, reactive, ref} from "vue";
|
|
28
|
-
import {post} from "../../http.js";
|
|
29
|
-
import {ElMessage} from "element-plus";
|
|
30
|
-
|
|
31
|
-
const props = defineProps({
|
|
32
|
-
payload: {
|
|
33
|
-
type: Object,
|
|
34
|
-
default: () => {
|
|
35
|
-
return {}
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
})
|
|
39
|
-
|
|
40
|
-
const emits = defineEmits(['close'])
|
|
41
|
-
|
|
42
|
-
const model = reactive({
|
|
43
|
-
groupName: '',
|
|
44
|
-
sort: 1,
|
|
45
|
-
isShow: 1
|
|
46
|
-
})
|
|
47
|
-
const rules = reactive({
|
|
48
|
-
groupName: [
|
|
49
|
-
{required: true, message: '请输入分组名称', trigger: 'blur'},
|
|
50
|
-
{min: 1, max: 20, message: '长度在 1 到 20 个字符', trigger: 'blur'}
|
|
51
|
-
],
|
|
52
|
-
sort: [
|
|
53
|
-
{required: true, message: '请输入排序', trigger: 'blur'},
|
|
54
|
-
{type: 'number', message: '排序必须为数字值'}
|
|
55
|
-
],
|
|
56
|
-
isShow: [
|
|
57
|
-
{required: true, message: '请选择是否显示', trigger: 'change'}
|
|
58
|
-
]
|
|
59
|
-
})
|
|
60
|
-
|
|
61
|
-
const form = ref()
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
* 保存按钮点击事件
|
|
65
|
-
*/
|
|
66
|
-
const saveBtnClick = () => {
|
|
67
|
-
console.log(model)
|
|
68
|
-
form.value.validate((valid) => {
|
|
69
|
-
if (valid) {
|
|
70
|
-
if (!model.id) {
|
|
71
|
-
post('/custom/saveGroup', model).then(res => {
|
|
72
|
-
if (res?.isOk) {
|
|
73
|
-
ElMessage.success('保存成功')
|
|
74
|
-
emits('close', true)
|
|
75
|
-
} else {
|
|
76
|
-
ElMessage.error(res?.msg || '保存失败')
|
|
77
|
-
}
|
|
78
|
-
})
|
|
79
|
-
} else {
|
|
80
|
-
post('/custom/updateGroup', model).then(res => {
|
|
81
|
-
if (res?.isOk) {
|
|
82
|
-
ElMessage.success('保存成功')
|
|
83
|
-
emits('close', true)
|
|
84
|
-
} else {
|
|
85
|
-
ElMessage.error(res?.msg || '保存失败')
|
|
86
|
-
}
|
|
87
|
-
})
|
|
88
|
-
}
|
|
89
|
-
} else {
|
|
90
|
-
return false;
|
|
91
|
-
}
|
|
92
|
-
})
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
/**
|
|
96
|
-
* 取消按钮点击事件
|
|
97
|
-
*/
|
|
98
|
-
const cancelBtnClick = () => {
|
|
99
|
-
emits('close', false)
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
onMounted(() => {
|
|
103
|
-
if (props.payload?.id) {
|
|
104
|
-
model.id = props.payload.id
|
|
105
|
-
model.groupName = props.payload.groupName
|
|
106
|
-
model.sort = props.payload.sort
|
|
107
|
-
model.isShow = props.payload.isShow
|
|
108
|
-
}
|
|
109
|
-
})
|
|
110
|
-
</script>
|
|
111
|
-
|
|
112
|
-
<style lang="scss" scoped>
|
|
113
|
-
@use "../../styles/dialog.scss";
|
|
114
|
-
</style>
|
|
1
|
+
/**
|
|
2
|
+
* @Author: HuaYJ
|
|
3
|
+
* @Date: 2025/2/8 09:22
|
|
4
|
+
*/
|
|
5
|
+
<template>
|
|
6
|
+
<div class="form-container">
|
|
7
|
+
<el-form ref="form" :model="model" :rules="rules" label-width="90px" label-suffix=":">
|
|
8
|
+
<el-form-item label="分组名称" prop="groupName">
|
|
9
|
+
<el-input v-model="model.groupName" placeholder="请输入分组名称" clearable/>
|
|
10
|
+
</el-form-item>
|
|
11
|
+
<el-form-item label="排序" prop="sort">
|
|
12
|
+
<el-input-number v-model="model.sort" :min="0" :max="999" :step="1" controls-position="right"/>
|
|
13
|
+
</el-form-item>
|
|
14
|
+
<el-form-item label="是否显示" prop="isShow">
|
|
15
|
+
<el-switch v-model="model.isShow" :active-value="1" :inactive-value="0" active-color="#13ce66"
|
|
16
|
+
inactive-color="#ff4949"/>
|
|
17
|
+
</el-form-item>
|
|
18
|
+
<div class="footer">
|
|
19
|
+
<el-button type="primary" @click="saveBtnClick">保存</el-button>
|
|
20
|
+
<el-button @click="cancelBtnClick">取消</el-button>
|
|
21
|
+
</div>
|
|
22
|
+
</el-form>
|
|
23
|
+
</div>
|
|
24
|
+
</template>
|
|
25
|
+
|
|
26
|
+
<script setup>
|
|
27
|
+
import {onMounted, reactive, ref} from "vue";
|
|
28
|
+
import {post} from "../../http.js";
|
|
29
|
+
import {ElMessage} from "element-plus";
|
|
30
|
+
|
|
31
|
+
const props = defineProps({
|
|
32
|
+
payload: {
|
|
33
|
+
type: Object,
|
|
34
|
+
default: () => {
|
|
35
|
+
return {}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
})
|
|
39
|
+
|
|
40
|
+
const emits = defineEmits(['close'])
|
|
41
|
+
|
|
42
|
+
const model = reactive({
|
|
43
|
+
groupName: '',
|
|
44
|
+
sort: 1,
|
|
45
|
+
isShow: 1
|
|
46
|
+
})
|
|
47
|
+
const rules = reactive({
|
|
48
|
+
groupName: [
|
|
49
|
+
{required: true, message: '请输入分组名称', trigger: 'blur'},
|
|
50
|
+
{min: 1, max: 20, message: '长度在 1 到 20 个字符', trigger: 'blur'}
|
|
51
|
+
],
|
|
52
|
+
sort: [
|
|
53
|
+
{required: true, message: '请输入排序', trigger: 'blur'},
|
|
54
|
+
{type: 'number', message: '排序必须为数字值'}
|
|
55
|
+
],
|
|
56
|
+
isShow: [
|
|
57
|
+
{required: true, message: '请选择是否显示', trigger: 'change'}
|
|
58
|
+
]
|
|
59
|
+
})
|
|
60
|
+
|
|
61
|
+
const form = ref()
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* 保存按钮点击事件
|
|
65
|
+
*/
|
|
66
|
+
const saveBtnClick = () => {
|
|
67
|
+
console.log(model)
|
|
68
|
+
form.value.validate((valid) => {
|
|
69
|
+
if (valid) {
|
|
70
|
+
if (!model.id) {
|
|
71
|
+
post('/custom/saveGroup', model).then(res => {
|
|
72
|
+
if (res?.isOk) {
|
|
73
|
+
ElMessage.success('保存成功')
|
|
74
|
+
emits('close', true)
|
|
75
|
+
} else {
|
|
76
|
+
ElMessage.error(res?.msg || '保存失败')
|
|
77
|
+
}
|
|
78
|
+
})
|
|
79
|
+
} else {
|
|
80
|
+
post('/custom/updateGroup', model).then(res => {
|
|
81
|
+
if (res?.isOk) {
|
|
82
|
+
ElMessage.success('保存成功')
|
|
83
|
+
emits('close', true)
|
|
84
|
+
} else {
|
|
85
|
+
ElMessage.error(res?.msg || '保存失败')
|
|
86
|
+
}
|
|
87
|
+
})
|
|
88
|
+
}
|
|
89
|
+
} else {
|
|
90
|
+
return false;
|
|
91
|
+
}
|
|
92
|
+
})
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* 取消按钮点击事件
|
|
97
|
+
*/
|
|
98
|
+
const cancelBtnClick = () => {
|
|
99
|
+
emits('close', false)
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
onMounted(() => {
|
|
103
|
+
if (props.payload?.id) {
|
|
104
|
+
model.id = props.payload.id
|
|
105
|
+
model.groupName = props.payload.groupName
|
|
106
|
+
model.sort = props.payload.sort
|
|
107
|
+
model.isShow = props.payload.isShow
|
|
108
|
+
}
|
|
109
|
+
})
|
|
110
|
+
</script>
|
|
111
|
+
|
|
112
|
+
<style lang="scss" scoped>
|
|
113
|
+
@use "../../styles/dialog.scss";
|
|
114
|
+
</style>
|