@ddwl/ddwl-ui 1.1.3 → 1.1.5-beta.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.
@@ -1,124 +1,124 @@
1
- <!-- eslint-disable vue/no-lone-template -->
2
- <!-- 描述列表 -->
3
- <template>
4
- <el-descriptions
5
- :class="{
6
- 'd-descriptions': true,
7
- 'border': border
8
- }"
9
- :border="border"
10
- :label-style="{
11
- width: labelWidth,
12
- ...labelStyle
13
- }"
14
- v-bind="$attrs"
15
- >
16
- <el-descriptions-item
17
- v-for="item in config"
18
- :key="item.prop"
19
- v-bind="item"
20
- >
21
- <template slot="label">
22
- <item-render v-if="item.labelRender" :scope="data" :render="item.labelRender" />
23
- <span v-else>{{ item.label }}</span>
24
- </template>
25
- <template>
26
- <component
27
- :is="item.component"
28
- v-if="item.component"
29
- v-bind="item"
30
- :row="data"
31
- />
32
- <item-render v-else-if="item.render" :scope="data" :render="item.render" />
33
- <span v-else>{{ data[item.prop] }}</span>
34
- </template>
35
- </el-descriptions-item>
36
- </el-descriptions>
37
- </template>
38
-
39
- <script>
40
- import ItemRender from '../render'
41
- import modules from '../../lib/slots'
42
-
43
- export default {
44
- name: 'DDescriptions',
45
- components: { ...modules, ItemRender },
46
- props: {
47
- data: {
48
- default: () => ({}),
49
- type: Object
50
- },
51
- config: {
52
- default: () => [],
53
- type: Array
54
- },
55
- border: {
56
- default: true,
57
- type: Boolean
58
- },
59
- labelWidth: {
60
- default: '112px',
61
- type: String
62
- },
63
- labelStyle: {
64
- default: () => ({}),
65
- type: Object
66
- }
67
- },
68
- data () {
69
- return {}
70
- },
71
- computed: {},
72
- watch: {},
73
- created () {},
74
- methods: {}
75
- }
76
- </script>
77
-
78
- <style lang='scss' scoped>
79
- .d-descriptions {
80
- :deep(.el-descriptions__body) {
81
- .el-descriptions__header {
82
- margin-bottom: 12px;
83
- }
84
- .el-descriptions-item__container {
85
- display: flex;
86
- }
87
- .el-descriptions-item__label {
88
- display: block;
89
- width: 112px;
90
- text-align: right;
91
- color: #333;
92
- }
93
- .el-descriptions-item__cell {
94
- padding: 6px 0;
95
- color: #333;
96
- vertical-align: middle;
97
- }
98
- .el-descriptions-item__content {
99
- color: #666;
100
- }
101
- }
102
- }
103
- .d-descriptions.border {
104
- :deep(.el-descriptions__body) {
105
- .el-descriptions__table.is-bordered {
106
- width: 100%;
107
- table-layout: fixed;
108
- border-collapse: collapse;
109
- }
110
- .el-descriptions-item__cell {
111
- padding: 12px;
112
- color: #333;
113
- border: 1px solid #ebeef5;
114
- vertical-align: middle;
115
- padding-left: 14px;
116
- }
117
- .el-descriptions-item__cell.el-descriptions-item__label.is-bordered-label {
118
- display: table-cell;
119
- vertical-align: middle;
120
- font-weight: normal;
121
- }
122
- }
123
- }
124
- </style>
1
+ <!-- eslint-disable vue/no-lone-template -->
2
+ <!-- 描述列表 -->
3
+ <template>
4
+ <el-descriptions
5
+ :class="{
6
+ 'd-descriptions': true,
7
+ 'border': border
8
+ }"
9
+ :border="border"
10
+ :label-style="{
11
+ width: labelWidth,
12
+ ...labelStyle
13
+ }"
14
+ v-bind="$attrs"
15
+ >
16
+ <el-descriptions-item
17
+ v-for="item in config"
18
+ :key="item.prop"
19
+ v-bind="item"
20
+ >
21
+ <template slot="label">
22
+ <item-render v-if="item.labelRender" :scope="data" :render="item.labelRender" />
23
+ <span v-else>{{ item.label }}</span>
24
+ </template>
25
+ <template>
26
+ <component
27
+ :is="item.component"
28
+ v-if="item.component"
29
+ v-bind="item"
30
+ :row="data"
31
+ />
32
+ <item-render v-else-if="item.render" :scope="data" :render="item.render" />
33
+ <span v-else>{{ data[item.prop] }}</span>
34
+ </template>
35
+ </el-descriptions-item>
36
+ </el-descriptions>
37
+ </template>
38
+
39
+ <script>
40
+ import ItemRender from '../render'
41
+ import modules from '../../lib/slots'
42
+
43
+ export default {
44
+ name: 'DDescriptions',
45
+ components: { ...modules, ItemRender },
46
+ props: {
47
+ data: {
48
+ default: () => ({}),
49
+ type: Object
50
+ },
51
+ config: {
52
+ default: () => [],
53
+ type: Array
54
+ },
55
+ border: {
56
+ default: true,
57
+ type: Boolean
58
+ },
59
+ labelWidth: {
60
+ default: '112px',
61
+ type: String
62
+ },
63
+ labelStyle: {
64
+ default: () => ({}),
65
+ type: Object
66
+ }
67
+ },
68
+ data () {
69
+ return {}
70
+ },
71
+ computed: {},
72
+ watch: {},
73
+ created () {},
74
+ methods: {}
75
+ }
76
+ </script>
77
+
78
+ <style lang='scss' scoped>
79
+ .d-descriptions {
80
+ :deep(.el-descriptions__body) {
81
+ .el-descriptions__header {
82
+ margin-bottom: 12px;
83
+ }
84
+ .el-descriptions-item__container {
85
+ display: flex;
86
+ }
87
+ .el-descriptions-item__label {
88
+ display: block;
89
+ width: 112px;
90
+ text-align: right;
91
+ color: #333;
92
+ }
93
+ .el-descriptions-item__cell {
94
+ padding: 6px 0;
95
+ color: #333;
96
+ vertical-align: middle;
97
+ }
98
+ .el-descriptions-item__content {
99
+ color: #666;
100
+ }
101
+ }
102
+ }
103
+ .d-descriptions.border {
104
+ :deep(.el-descriptions__body) {
105
+ .el-descriptions__table.is-bordered {
106
+ width: 100%;
107
+ table-layout: fixed;
108
+ border-collapse: collapse;
109
+ }
110
+ .el-descriptions-item__cell {
111
+ padding: 12px;
112
+ color: #333;
113
+ border: 1px solid #ebeef5;
114
+ vertical-align: middle;
115
+ padding-left: 14px;
116
+ }
117
+ .el-descriptions-item__cell.el-descriptions-item__label.is-bordered-label {
118
+ display: table-cell;
119
+ vertical-align: middle;
120
+ font-weight: normal;
121
+ }
122
+ }
123
+ }
124
+ </style>
@@ -1,172 +1,172 @@
1
- <!-- 弹窗 -->
2
- <template>
3
- <el-dialog
4
- :class="fullscreen ? 'cover-screen-dialog' : ''"
5
- class="d-dialog"
6
- v-bind="$attrs"
7
- :title="title"
8
- :close-on-click-modal="closeOnClickModal"
9
- :visible.sync="visible"
10
- :width="width"
11
- v-on="$listeners"
12
- @closed="closed"
13
- >
14
- <template slot="title">
15
- <slot name="title" />
16
- </template>
17
- <slot />
18
- <template slot="footer">
19
- <slot name="footer" />
20
- <div v-if="showButton" class="ar">
21
- <el-button
22
- type="primary"
23
- :icon="submitButtonIcon"
24
- :loading="loading"
25
- @click="submit"
26
- >
27
- {{ submitButtonText }}
28
- </el-button>
29
- <el-button @click="cancel">
30
- {{ cancelButtonText }}
31
- </el-button>
32
- </div>
33
- </template>
34
- </el-dialog>
35
- </template>
36
-
37
- <script>
38
- export default {
39
- name: 'DDialog',
40
- components: {},
41
- model: {
42
- prop: 'modelValue',
43
- event: 'change'
44
- },
45
- props: {
46
- modelValue: {
47
- type: Boolean,
48
- default: false
49
- },
50
- title: {
51
- type: String,
52
- default: ''
53
- },
54
- closeOnClickModal: {
55
- type: Boolean,
56
- default: false
57
- },
58
- showButton: {
59
- type: Boolean,
60
- default: true
61
- },
62
- submitButtonText: {
63
- type: String,
64
- default: '确定'
65
- },
66
- submitButtonIcon: {
67
- type: String,
68
- default: ''
69
- },
70
- cancelButtonText: {
71
- type: String,
72
- default: '取消'
73
- },
74
- // 需要重置的表单ref, 支持ref字符串或ref对象或ref字符串|对象数组
75
- formRefs: {
76
- type: [String, Object, Array],
77
- default: ''
78
- },
79
- width: {
80
- type: String,
81
- default: '70%'
82
- },
83
- maxWidth: {
84
- type: String,
85
- default: '70%'
86
- },
87
- // 是否高度撑满
88
- fullscreen: {
89
- type: Boolean,
90
- default: false
91
- }
92
- },
93
- data () {
94
- return {
95
- loading: false
96
- }
97
- },
98
- computed: {
99
- visible: {
100
- get () {
101
- return this.modelValue
102
- },
103
- set (value) {
104
- this.$emit('change', value)
105
- }
106
- }
107
- },
108
- methods: {
109
- getRef (ref) {
110
- return typeof ref === 'string' ? this.$parent.$refs[ref] : ref
111
- },
112
- async submit () {
113
- // 是否需要进行表单校验
114
- if (this.formRefs) {
115
- // 多表单校验
116
- if (Array.isArray(this.formRefs)) {
117
- await Promise.all(this.formRefs.map(ref => this.getRef(ref)?.validate()))
118
- } else {
119
- await this.getRef(this.formRefs)?.validate()
120
- }
121
- }
122
- this.loading = true
123
- this.$emit('submit', (status) => {
124
- this.loading = false
125
- if (!status) {
126
- this.visible = false
127
- }
128
- })
129
- },
130
- cancel () {
131
- this.$emit('cancel')
132
- this.visible = false
133
- },
134
- /**
135
- * @description: 弹窗关闭时清除表单校验
136
- */
137
- closed () {
138
- this.$emit('closed')
139
- if (this.formRefs) {
140
- // 多表单校验
141
- if (Array.isArray(this.formRefs)) {
142
- this.formRefs.forEach(ref => this.getRef(ref)?.resetFields())
143
- } else {
144
- this.getRef(this.formRefs)?.resetFields()
145
- }
146
- }
147
- }
148
- }
149
- }
150
- </script>
151
- <style lang="scss" scoped>
152
- .d-dialog {
153
- display: flex;
154
- align-items: center;
155
- justify-content: center;
156
- :deep(.el-dialog) {
157
- max-height: 90vh;
158
- display: flex;
159
- flex-direction: column;
160
- margin: 0 !important;
161
- .el-dialog__body {
162
- flex: 1;
163
- overflow: auto;
164
- }
165
- }
166
- }
167
- .cover-screen-dialog {
168
- :deep(.el-dialog) {
169
- height: 90vh;
170
- }
171
- }
172
- </style>
1
+ <!-- 弹窗 -->
2
+ <template>
3
+ <el-dialog
4
+ :class="fullscreen ? 'cover-screen-dialog' : ''"
5
+ class="d-dialog"
6
+ v-bind="$attrs"
7
+ :title="title"
8
+ :close-on-click-modal="closeOnClickModal"
9
+ :visible.sync="visible"
10
+ :width="width"
11
+ v-on="$listeners"
12
+ @closed="closed"
13
+ >
14
+ <template slot="title">
15
+ <slot name="title" />
16
+ </template>
17
+ <slot />
18
+ <template slot="footer">
19
+ <slot name="footer" />
20
+ <div v-if="showButton" class="ar">
21
+ <el-button
22
+ type="primary"
23
+ :icon="submitButtonIcon"
24
+ :loading="loading"
25
+ @click="submit"
26
+ >
27
+ {{ submitButtonText }}
28
+ </el-button>
29
+ <el-button @click="cancel">
30
+ {{ cancelButtonText }}
31
+ </el-button>
32
+ </div>
33
+ </template>
34
+ </el-dialog>
35
+ </template>
36
+
37
+ <script>
38
+ export default {
39
+ name: 'DDialog',
40
+ components: {},
41
+ model: {
42
+ prop: 'modelValue',
43
+ event: 'change'
44
+ },
45
+ props: {
46
+ modelValue: {
47
+ type: Boolean,
48
+ default: false
49
+ },
50
+ title: {
51
+ type: String,
52
+ default: ''
53
+ },
54
+ closeOnClickModal: {
55
+ type: Boolean,
56
+ default: false
57
+ },
58
+ showButton: {
59
+ type: Boolean,
60
+ default: true
61
+ },
62
+ submitButtonText: {
63
+ type: String,
64
+ default: '确定'
65
+ },
66
+ submitButtonIcon: {
67
+ type: String,
68
+ default: ''
69
+ },
70
+ cancelButtonText: {
71
+ type: String,
72
+ default: '取消'
73
+ },
74
+ // 需要重置的表单ref, 支持ref字符串或ref对象或ref字符串|对象数组
75
+ formRefs: {
76
+ type: [String, Object, Array],
77
+ default: ''
78
+ },
79
+ width: {
80
+ type: String,
81
+ default: '70%'
82
+ },
83
+ maxWidth: {
84
+ type: String,
85
+ default: '70%'
86
+ },
87
+ // 是否高度撑满
88
+ fullscreen: {
89
+ type: Boolean,
90
+ default: false
91
+ }
92
+ },
93
+ data () {
94
+ return {
95
+ loading: false
96
+ }
97
+ },
98
+ computed: {
99
+ visible: {
100
+ get () {
101
+ return this.modelValue
102
+ },
103
+ set (value) {
104
+ this.$emit('change', value)
105
+ }
106
+ }
107
+ },
108
+ methods: {
109
+ getRef (ref) {
110
+ return typeof ref === 'string' ? this.$parent.$refs[ref] : ref
111
+ },
112
+ async submit () {
113
+ // 是否需要进行表单校验
114
+ if (this.formRefs) {
115
+ // 多表单校验
116
+ if (Array.isArray(this.formRefs)) {
117
+ await Promise.all(this.formRefs.map(ref => this.getRef(ref)?.validate()))
118
+ } else {
119
+ await this.getRef(this.formRefs)?.validate()
120
+ }
121
+ }
122
+ this.loading = true
123
+ this.$emit('submit', (status) => {
124
+ this.loading = false
125
+ if (!status) {
126
+ this.visible = false
127
+ }
128
+ })
129
+ },
130
+ cancel () {
131
+ this.$emit('cancel')
132
+ this.visible = false
133
+ },
134
+ /**
135
+ * @description: 弹窗关闭时清除表单校验
136
+ */
137
+ closed () {
138
+ this.$emit('closed')
139
+ if (this.formRefs) {
140
+ // 多表单校验
141
+ if (Array.isArray(this.formRefs)) {
142
+ this.formRefs.forEach(ref => this.getRef(ref)?.resetFields())
143
+ } else {
144
+ this.getRef(this.formRefs)?.resetFields()
145
+ }
146
+ }
147
+ }
148
+ }
149
+ }
150
+ </script>
151
+ <style lang="scss" scoped>
152
+ .d-dialog {
153
+ display: flex;
154
+ align-items: center;
155
+ justify-content: center;
156
+ :deep(.el-dialog) {
157
+ max-height: 90vh;
158
+ display: flex;
159
+ flex-direction: column;
160
+ margin: 0 !important;
161
+ .el-dialog__body {
162
+ flex: 1;
163
+ overflow: auto;
164
+ }
165
+ }
166
+ }
167
+ .cover-screen-dialog {
168
+ :deep(.el-dialog) {
169
+ height: 90vh;
170
+ }
171
+ }
172
+ </style>