@ctzy-web-client/plugin-component-vue 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.
- package/package.json +43 -0
- package/src/advance-select/advance-operation.vue +44 -0
- package/src/advance-select/advance-option.vue +115 -0
- package/src/advance-select/advance-select.vue +343 -0
- package/src/advance-select/events-helpers.js +40 -0
- package/src/advance-select/index.js +13 -0
- package/src/advance-select/use-advance-option.js +58 -0
- package/src/advance-select/use-advance-select.js +142 -0
- package/src/application-slot/application-slot.js +70 -0
- package/src/application-slot/breadcrumb-item.vue +12 -0
- package/src/application-slot/header-tools-item.vue +12 -0
- package/src/application-slot/index.js +17 -0
- package/src/breadcrumb-select/breadcrumb-select.vue +97 -0
- package/src/breadcrumb-select/index.js +6 -0
- package/src/components.js +39 -0
- package/src/contextmenu/contextmenu-item.vue +13 -0
- package/src/contextmenu/contextmenu.vue +56 -0
- package/src/contextmenu/index.js +11 -0
- package/src/contextmenu/use-contextmenu.js +117 -0
- package/src/data-form/data-form-item.vue +49 -0
- package/src/data-form/data-form.vue +212 -0
- package/src/data-form/dynamic-component.js +24 -0
- package/src/data-form/form-components/Blots/AtBlot.js +32 -0
- package/src/data-form/form-components/bwa-date-picker.vue +43 -0
- package/src/data-form/form-components/bwa-date-time-picker.vue +49 -0
- package/src/data-form/form-components/bwa-input-float.vue +41 -0
- package/src/data-form/form-components/bwa-input-integer.vue +58 -0
- package/src/data-form/form-components/bwa-input.vue +32 -0
- package/src/data-form/form-components/bwa-multi-select.vue +27 -0
- package/src/data-form/form-components/bwa-rich-text-tinymce.vue +561 -0
- package/src/data-form/form-components/bwa-rich-text.vue +395 -0
- package/src/data-form/form-components/bwa-select.vue +67 -0
- package/src/data-form/form-components/bwa-textarea.vue +28 -0
- package/src/data-form/form-components/bwa-upload.vue +145 -0
- package/src/data-form/form-components/bwa-user-multi-select.vue +25 -0
- package/src/data-form/form-components/bwa-user-select.vue +81 -0
- package/src/data-form/index.js +35 -0
- package/src/data-table/data-column-view.vue +131 -0
- package/src/data-table/data-table-card.vue +81 -0
- package/src/data-table/data-table-column.vue +52 -0
- package/src/data-table/data-table.vue +426 -0
- package/src/data-table/dynamic-component.js +58 -0
- package/src/data-table/index.js +13 -0
- package/src/data-table/use-datatable-drag.js +156 -0
- package/src/datatable-settings/datatable-settings.vue +323 -0
- package/src/datatable-settings/index.js +6 -0
- package/src/date-range/date-picker.vue +115 -0
- package/src/date-range/date-range.vue +202 -0
- package/src/date-range/index.js +6 -0
- package/src/drag-list/constants.js +1 -0
- package/src/drag-list/drag-item.vue +46 -0
- package/src/drag-list/drag-list.vue +50 -0
- package/src/drag-list/index.js +6 -0
- package/src/drag-list/use-drag-list.js +209 -0
- package/src/dragable/constants.js +3 -0
- package/src/dragable/dragable-item.vue +19 -0
- package/src/dragable/dragable-operation.vue +28 -0
- package/src/dragable/dragable.vue +26 -0
- package/src/dragable/index.js +14 -0
- package/src/dragable/use-dragable.js +227 -0
- package/src/filter-panel/conditions/condition.js +35 -0
- package/src/filter-panel/conditions/date-range-condition.vue +35 -0
- package/src/filter-panel/conditions/department-condition/data.json +29537 -0
- package/src/filter-panel/conditions/department-condition/department-condition.vue +92 -0
- package/src/filter-panel/conditions/department-condition/department-node.vue +52 -0
- package/src/filter-panel/conditions/index.js +22 -0
- package/src/filter-panel/conditions/input-condition.vue +63 -0
- package/src/filter-panel/conditions/multi-user-condition.vue +56 -0
- package/src/filter-panel/conditions/multiple-menu-condition.vue +45 -0
- package/src/filter-panel/conditions/single-menu-condition.vue +58 -0
- package/src/filter-panel/conditions/single-user-condition.vue +56 -0
- package/src/filter-panel/filter-panel-item.vue +46 -0
- package/src/filter-panel/filter-panel.vue +149 -0
- package/src/filter-panel/index.js +17 -0
- package/src/filter-panel/use-filter-panel-item.js +59 -0
- package/src/filter-panel/use-filter-panel.js +203 -0
- package/src/hooks/use-data/index.js +234 -0
- package/src/index.js +48 -0
- package/src/layout/index.js +6 -0
- package/src/layout/layout.vue +74 -0
- package/src/make-installer.js +36 -0
- package/src/math/Rectangle.js +28 -0
- package/src/menu/index.js +6 -0
- package/src/menu/menu-item.vue +41 -0
- package/src/menu/menu.vue +53 -0
- package/src/panel/index.js +6 -0
- package/src/panel/panel.vue +42 -0
- package/src/panel-tabs/index.js +6 -0
- package/src/panel-tabs/panel-tabs.js +92 -0
- package/src/pct-filter-panel/index.js +10 -0
- package/src/pct-filter-panel/pct-compents/index.js +10 -0
- package/src/pct-filter-panel/pct-compents/pct-Input-condition.vue +63 -0
- package/src/pct-filter-panel/pct-compents/pct-date-range-condition.vue +60 -0
- package/src/pct-filter-panel/pct-compents/pct-multiple-menu-condition.vue +177 -0
- package/src/pct-filter-panel/pct-compents/pct-multiple-menu-condition2.vue +142 -0
- package/src/pct-filter-panel/pct-filter-panel-item.vue +46 -0
- package/src/pct-filter-panel/pct-filter-panel.vue +201 -0
- package/src/pct-filter-panel/use-filter-panel-item.js +61 -0
- package/src/pct-filter-panel/use-filter-panel.js +206 -0
- package/src/plugins.js +3 -0
- package/src/progress/index.js +8 -0
- package/src/progress/progress-item.vue +81 -0
- package/src/progress/progress.vue +58 -0
- package/src/progress/use-progress.js +66 -0
- package/src/utils/db.js +8 -0
- package/src/utils.js +263 -0
- package/src/where-filter-panel/index.js +0 -0
- package/src/where-filter-panel/use-where-filter-panel.js +28 -0
- package/src/where-filter-panel/where-filter-panel.vue +9 -0
- package/style/advance-select.scss +316 -0
- package/style/breadcrumb-select.scss +80 -0
- package/style/common/var.scss +240 -0
- package/style/common.scss +48 -0
- package/style/contextmenu.scss +58 -0
- package/style/data-form.scss +35 -0
- package/style/data-table.scss +81 -0
- package/style/datatable-settings.scss +125 -0
- package/style/date-range.scss +136 -0
- package/style/department-condition.scss +39 -0
- package/style/drag-list.scss +68 -0
- package/style/dragable.scss +8 -0
- package/style/filter-panel.scss +199 -0
- package/style/index.scss +22 -0
- package/style/input-condition.scss +30 -0
- package/style/layout.scss +70 -0
- package/style/menu.scss +184 -0
- package/style/mixins/_var.scss +21 -0
- package/style/mixins/config.scss +4 -0
- package/style/mixins/function.scss +62 -0
- package/style/mixins/mixins.scss +88 -0
- package/style/panel-tabs.scss +60 -0
- package/style/panel.scss +110 -0
- package/style/pct-filter-panel.scss +306 -0
- package/style/progress.scss +122 -0
- package/style/rich-text.scss +30 -0
- package/style/theme/theme.scss +161 -0
- package/style/theme/var.scss +34 -0
- package/style/var.scss +21 -0
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<ElForm
|
|
3
|
+
ref="dataFormElRef"
|
|
4
|
+
v-bind="attrs"
|
|
5
|
+
:model="dataForm.data"
|
|
6
|
+
:label-position="labelPosition"
|
|
7
|
+
:label-width="computedLabelWidth"
|
|
8
|
+
:rules="rules"
|
|
9
|
+
:validate-on-rule-change="validateOnRuleChange"
|
|
10
|
+
:disabled="dataForm.disabled"
|
|
11
|
+
>
|
|
12
|
+
<slot :dataForm="dataForm">
|
|
13
|
+
<BwaDataFormItem
|
|
14
|
+
v-for="column in dataForm.getDisplayColumns()"
|
|
15
|
+
:key="column.fullAttrName"
|
|
16
|
+
:name="column.fullAttrName"
|
|
17
|
+
:isShowLabelColon="isShowLabelColon"
|
|
18
|
+
>
|
|
19
|
+
<slot
|
|
20
|
+
:name="'form-item-' + column.fullAttrName"
|
|
21
|
+
:column="column"
|
|
22
|
+
:record="dataForm.data"
|
|
23
|
+
:dataForm="dataForm"
|
|
24
|
+
>
|
|
25
|
+
</slot>
|
|
26
|
+
</BwaDataFormItem>
|
|
27
|
+
</slot>
|
|
28
|
+
</ElForm>
|
|
29
|
+
</template>
|
|
30
|
+
<script setup>
|
|
31
|
+
import {
|
|
32
|
+
provide,
|
|
33
|
+
ref,
|
|
34
|
+
computed,
|
|
35
|
+
watch,
|
|
36
|
+
useAttrs,
|
|
37
|
+
onMounted,
|
|
38
|
+
unref,
|
|
39
|
+
onBeforeUnmount,
|
|
40
|
+
} from 'vue';
|
|
41
|
+
import { ElMessage, ElForm } from 'element-plus';
|
|
42
|
+
import { dataFormKey } from 'web-base-client-vue';
|
|
43
|
+
import { mergeWith, isArray } from 'lodash';
|
|
44
|
+
import BwaDataFormItem from './data-form-item.vue';
|
|
45
|
+
|
|
46
|
+
defineOptions({ name: 'BwaDataForm' });
|
|
47
|
+
|
|
48
|
+
const props = defineProps({
|
|
49
|
+
dataForm: {
|
|
50
|
+
type: Object,
|
|
51
|
+
},
|
|
52
|
+
autoLoad: {
|
|
53
|
+
type: Boolean,
|
|
54
|
+
default: true,
|
|
55
|
+
},
|
|
56
|
+
//注册id 和 记录数据
|
|
57
|
+
record: {
|
|
58
|
+
type: Object,
|
|
59
|
+
},
|
|
60
|
+
recID: {
|
|
61
|
+
type: String,
|
|
62
|
+
},
|
|
63
|
+
labelPosition: {
|
|
64
|
+
type: String,
|
|
65
|
+
},
|
|
66
|
+
labelWidth: {
|
|
67
|
+
type: String,
|
|
68
|
+
default: '',
|
|
69
|
+
},
|
|
70
|
+
rules: {
|
|
71
|
+
type: Object,
|
|
72
|
+
default: () => ({}),
|
|
73
|
+
},
|
|
74
|
+
validateOnRuleChange: {
|
|
75
|
+
type: Boolean,
|
|
76
|
+
default: false,
|
|
77
|
+
},
|
|
78
|
+
isShowLabelColon: {
|
|
79
|
+
type: Boolean,
|
|
80
|
+
default: true,
|
|
81
|
+
},
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
const attrs = useAttrs();
|
|
85
|
+
|
|
86
|
+
const dataForm = props.dataForm;
|
|
87
|
+
|
|
88
|
+
//表单对象的引用
|
|
89
|
+
const dataFormElRef = ref();
|
|
90
|
+
|
|
91
|
+
//验证规则
|
|
92
|
+
const rules = computed(() => {
|
|
93
|
+
let data = {};
|
|
94
|
+
|
|
95
|
+
dataForm.getDisplayColumns().forEach((item) => {
|
|
96
|
+
data[item.fullAttrName] = (
|
|
97
|
+
item.required ? [{ required: true, message: item.title + '必填!' }] : []
|
|
98
|
+
).concat(item.rules);
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
return mergeWith(
|
|
102
|
+
{},
|
|
103
|
+
data,
|
|
104
|
+
props.rules,
|
|
105
|
+
function customizer(objValue, srcValue) {
|
|
106
|
+
if (isArray(objValue)) {
|
|
107
|
+
return objValue.concat(srcValue);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
);
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
//计算后的描述宽度
|
|
114
|
+
const computedLabelWidth = computed(() => {
|
|
115
|
+
if (props.labelWidth) {
|
|
116
|
+
return props.labelWidth;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
let labelWidth = 0;
|
|
120
|
+
|
|
121
|
+
if (props.labelPosition != 'top') {
|
|
122
|
+
let maxLabelCharCount = 0;
|
|
123
|
+
dataForm.getDisplayColumns().forEach((item) => {
|
|
124
|
+
maxLabelCharCount = Math.max(
|
|
125
|
+
maxLabelCharCount,
|
|
126
|
+
item.title.length + (item.required ? 1 : 0)
|
|
127
|
+
);
|
|
128
|
+
});
|
|
129
|
+
labelWidth = (maxLabelCharCount + 1) * 18;
|
|
130
|
+
}
|
|
131
|
+
return labelWidth + 'px';
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
if (props.autoLoad) {
|
|
135
|
+
//监听recid的变化 是否自动加载数据
|
|
136
|
+
watch(
|
|
137
|
+
computed(() => props.record),
|
|
138
|
+
async () => {
|
|
139
|
+
if (props.recID) {
|
|
140
|
+
try {
|
|
141
|
+
await dataForm.loadDataByRecId(props.recID);
|
|
142
|
+
} catch (e) {
|
|
143
|
+
console.error(e);
|
|
144
|
+
ElMessage.error('获取记录失败。');
|
|
145
|
+
}
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
if (props.record) {
|
|
150
|
+
dataForm.setData(props.record);
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
dataForm.setData();
|
|
155
|
+
},
|
|
156
|
+
{ immediate: true }
|
|
157
|
+
);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
//当前data table 上下文对象
|
|
161
|
+
provide(dataFormKey, dataForm);
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* 表单验证
|
|
165
|
+
* @param {*} data
|
|
166
|
+
*/
|
|
167
|
+
const validate = (callback) => {
|
|
168
|
+
return dataFormElRef.value.validate(callback);
|
|
169
|
+
};
|
|
170
|
+
|
|
171
|
+
window.dataFormElRef = dataFormElRef;
|
|
172
|
+
window.aaavvv = validate;
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* 提交表单
|
|
176
|
+
* @param {Object} 额外附加的提交数据
|
|
177
|
+
*/
|
|
178
|
+
const submit = (data) => {
|
|
179
|
+
return validate()
|
|
180
|
+
.then(() => {
|
|
181
|
+
dataForm
|
|
182
|
+
.submit(data)
|
|
183
|
+
.then(() => {
|
|
184
|
+
ElMessage.info('保存成功!');
|
|
185
|
+
})
|
|
186
|
+
.catch((e) => ElMessage.error(e.message));
|
|
187
|
+
})
|
|
188
|
+
.catch((result) => {
|
|
189
|
+
console.log(result);
|
|
190
|
+
});
|
|
191
|
+
};
|
|
192
|
+
|
|
193
|
+
onMounted(() => {
|
|
194
|
+
unref(dataForm).formValivators.push(unref(dataFormElRef));
|
|
195
|
+
});
|
|
196
|
+
|
|
197
|
+
onBeforeUnmount(() => {
|
|
198
|
+
const _dataFormEl = unref(dataFormElRef);
|
|
199
|
+
unref(dataForm).formValivators = unref(dataForm).formValivators.filter(
|
|
200
|
+
(validate) => validate !== _dataFormEl
|
|
201
|
+
);
|
|
202
|
+
});
|
|
203
|
+
|
|
204
|
+
defineExpose({
|
|
205
|
+
dataForm,
|
|
206
|
+
dataFormElRef,
|
|
207
|
+
validate,
|
|
208
|
+
submit,
|
|
209
|
+
rules,
|
|
210
|
+
computedLabelWidth,
|
|
211
|
+
});
|
|
212
|
+
</script>
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { h, unref } from 'vue';
|
|
2
|
+
import get from 'lodash/get';
|
|
3
|
+
import set from 'lodash/set';
|
|
4
|
+
import { useDynamicComponent } from '../utils.js';
|
|
5
|
+
export default {
|
|
6
|
+
props: {
|
|
7
|
+
column: Object,
|
|
8
|
+
record: Object,
|
|
9
|
+
},
|
|
10
|
+
emits: ['on-change'],
|
|
11
|
+
setup(props, context) {
|
|
12
|
+
//组件信息
|
|
13
|
+
const { component, params } = useDynamicComponent(
|
|
14
|
+
props,
|
|
15
|
+
context,
|
|
16
|
+
'BwaInput',
|
|
17
|
+
'fullAttrName'
|
|
18
|
+
);
|
|
19
|
+
|
|
20
|
+
return () => {
|
|
21
|
+
return h(unref(component), unref(params));
|
|
22
|
+
};
|
|
23
|
+
},
|
|
24
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import Quill from 'quill';
|
|
2
|
+
|
|
3
|
+
const Parchment = Quill.imports.parchment;
|
|
4
|
+
// const BlockEmbed = Quill.import('blots/block/embed');
|
|
5
|
+
|
|
6
|
+
class AtBlot extends Parchment.Embed {
|
|
7
|
+
static blotName = 'at';
|
|
8
|
+
static tagName = 'span';
|
|
9
|
+
|
|
10
|
+
static create(options) {
|
|
11
|
+
options = options || '';
|
|
12
|
+
let node = super.create();
|
|
13
|
+
node.setAttribute('d-id', options.id);
|
|
14
|
+
node.setAttribute('class', options.class || 'ptp-at-item');
|
|
15
|
+
options.style && node.setAttribute('style', options.style);
|
|
16
|
+
node.innerHTML = options.desc.startsWith('@')
|
|
17
|
+
? options.desc
|
|
18
|
+
: '@' + options.desc;
|
|
19
|
+
return node;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
static value(node) {
|
|
23
|
+
return {
|
|
24
|
+
id: node.getAttribute('d-id'),
|
|
25
|
+
desc: node.innerHTML,
|
|
26
|
+
style: node.getAttribute('style'),
|
|
27
|
+
class: node.getAttribute('ptp-at-item'),
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
Quill.register(AtBlot, true);
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<el-date-picker
|
|
3
|
+
v-model="modelValue"
|
|
4
|
+
type="date"
|
|
5
|
+
:placeholder="placeholder"
|
|
6
|
+
v-bind="attrs"
|
|
7
|
+
:teleported="false"
|
|
8
|
+
style="width: 100%"
|
|
9
|
+
/>
|
|
10
|
+
</template>
|
|
11
|
+
|
|
12
|
+
<script setup>
|
|
13
|
+
import { computed, useAttrs } from 'vue';
|
|
14
|
+
import { ElDatePicker, dayjs } from 'element-plus';
|
|
15
|
+
|
|
16
|
+
defineOptions({
|
|
17
|
+
name: 'BwaDatePicker',
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
const props = defineProps({
|
|
21
|
+
modelValue: {
|
|
22
|
+
type: [String, Date],
|
|
23
|
+
default: null,
|
|
24
|
+
},
|
|
25
|
+
placeholder: {
|
|
26
|
+
type: String,
|
|
27
|
+
default: '请选择',
|
|
28
|
+
},
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
const attrs = useAttrs();
|
|
32
|
+
|
|
33
|
+
const emit = defineEmits(['update:model-value']);
|
|
34
|
+
|
|
35
|
+
const modelValue = computed({
|
|
36
|
+
get: () => props.modelValue,
|
|
37
|
+
set: (v) =>
|
|
38
|
+
emit(
|
|
39
|
+
'update:model-value',
|
|
40
|
+
v ? dayjs(new Date(v.getTime())).format('YYYY-MM-DD') : ''
|
|
41
|
+
),
|
|
42
|
+
});
|
|
43
|
+
</script>
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<el-date-picker
|
|
3
|
+
v-bind="attrs"
|
|
4
|
+
v-model="modelValue"
|
|
5
|
+
type="datetime"
|
|
6
|
+
:placeholder="placeholder"
|
|
7
|
+
:teleported="false"
|
|
8
|
+
style="width: 100%"
|
|
9
|
+
/>
|
|
10
|
+
</template>
|
|
11
|
+
|
|
12
|
+
<script setup>
|
|
13
|
+
import { computed, useAttrs } from 'vue';
|
|
14
|
+
import { ElDatePicker, dayjs } from 'element-plus';
|
|
15
|
+
|
|
16
|
+
defineOptions({
|
|
17
|
+
name: 'BwaDateTimePicker',
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
const props = defineProps({
|
|
21
|
+
modelValue: {
|
|
22
|
+
type: [String, Date],
|
|
23
|
+
default: null,
|
|
24
|
+
},
|
|
25
|
+
placeholder: {
|
|
26
|
+
type: String,
|
|
27
|
+
default: '请选择',
|
|
28
|
+
},
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
const attrs = useAttrs();
|
|
32
|
+
|
|
33
|
+
const emit = defineEmits(['update:model-value']);
|
|
34
|
+
|
|
35
|
+
const modelValue = computed({
|
|
36
|
+
get: () => props.modelValue,
|
|
37
|
+
set: (v) => {
|
|
38
|
+
if (!v) {
|
|
39
|
+
emit('update:model-value', '');
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
emit(
|
|
44
|
+
'update:model-value',
|
|
45
|
+
dayjs(new Date(v.getTime())).format('YYYY-MM-DD HH:mm:ss')
|
|
46
|
+
);
|
|
47
|
+
},
|
|
48
|
+
});
|
|
49
|
+
</script>
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<BwaInputInteger
|
|
3
|
+
v-bind="attrs"
|
|
4
|
+
v-model="modelValue"
|
|
5
|
+
:precision="precision"
|
|
6
|
+
:step="step"
|
|
7
|
+
/>
|
|
8
|
+
</template>
|
|
9
|
+
|
|
10
|
+
<script setup>
|
|
11
|
+
import { useAttrs, computed } from 'vue';
|
|
12
|
+
import BwaInputInteger from './bwa-input-integer.vue';
|
|
13
|
+
|
|
14
|
+
defineOptions({
|
|
15
|
+
name: 'BwaInputFloat',
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
const props = defineProps({
|
|
19
|
+
modelValue: {
|
|
20
|
+
type: [String, Number],
|
|
21
|
+
default: 0,
|
|
22
|
+
},
|
|
23
|
+
precision: {
|
|
24
|
+
type: Number,
|
|
25
|
+
default: 1,
|
|
26
|
+
},
|
|
27
|
+
step: {
|
|
28
|
+
type: Number,
|
|
29
|
+
default: 0.1,
|
|
30
|
+
},
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
const attrs = useAttrs();
|
|
34
|
+
|
|
35
|
+
const emit = defineEmits(['update:model-value']);
|
|
36
|
+
|
|
37
|
+
const modelValue = computed({
|
|
38
|
+
get: () => props.modelValue,
|
|
39
|
+
set: (v) => emit('update:model-value', v),
|
|
40
|
+
});
|
|
41
|
+
</script>
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<el-input-number v-bind="attrs" v-model="value" />
|
|
3
|
+
</template>
|
|
4
|
+
|
|
5
|
+
<script setup>
|
|
6
|
+
import { useAttrs, computed, unref, watch, ref } from 'vue';
|
|
7
|
+
import { ElInputNumber } from 'element-plus';
|
|
8
|
+
|
|
9
|
+
defineOptions({
|
|
10
|
+
name: 'BwaInputInteger',
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
const props = defineProps({
|
|
14
|
+
modelValue: {
|
|
15
|
+
type: [String, Number],
|
|
16
|
+
default: 0,
|
|
17
|
+
},
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
const attrs = useAttrs();
|
|
21
|
+
|
|
22
|
+
const emit = defineEmits(['update:model-value']);
|
|
23
|
+
|
|
24
|
+
const modelValue = computed({
|
|
25
|
+
get: () => props.modelValue,
|
|
26
|
+
set: (v) => {
|
|
27
|
+
emit('update:model-value', v);
|
|
28
|
+
},
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
const value = ref(modelValue.value);
|
|
32
|
+
|
|
33
|
+
watch(value, (newValue) => {
|
|
34
|
+
if (newValue === unref(modelValue)) {
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
modelValue.value = newValue;
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
watch(
|
|
42
|
+
modelValue,
|
|
43
|
+
(newValue) => {
|
|
44
|
+
if (typeof newValue === 'string') {
|
|
45
|
+
newValue = Number.parseFloat(newValue);
|
|
46
|
+
|
|
47
|
+
newValue = Number.isNaN(newValue) ? 0 : newValue;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
if (value.value === newValue && value.value !== unref(modelValue)) {
|
|
51
|
+
modelValue.value = newValue;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
value.value = newValue;
|
|
55
|
+
},
|
|
56
|
+
{ immediate: true }
|
|
57
|
+
);
|
|
58
|
+
</script>
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<el-input v-bind="attrs" v-model="modelValue" :placeholder="placeholder" />
|
|
3
|
+
</template>
|
|
4
|
+
|
|
5
|
+
<script setup>
|
|
6
|
+
import { useAttrs, computed } from 'vue';
|
|
7
|
+
import { ElInput } from 'element-plus';
|
|
8
|
+
|
|
9
|
+
defineOptions({
|
|
10
|
+
name: 'BwaInput',
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
const props = defineProps({
|
|
14
|
+
value: {
|
|
15
|
+
type: [String, Number],
|
|
16
|
+
default: '',
|
|
17
|
+
},
|
|
18
|
+
placeholder: {
|
|
19
|
+
type: String,
|
|
20
|
+
default: '请输入'
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
const attrs = useAttrs();
|
|
25
|
+
|
|
26
|
+
const emit = defineEmits(['update:model-value']);
|
|
27
|
+
|
|
28
|
+
const modelValue = computed({
|
|
29
|
+
get: () => props.modelValue,
|
|
30
|
+
set: (v) => emit('update:model-value', v),
|
|
31
|
+
});
|
|
32
|
+
</script>
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<BwaSelect v-model="modelValue" v-bind="attrs" multiple>
|
|
3
|
+
<slot></slot>
|
|
4
|
+
</BwaSelect>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script setup>
|
|
8
|
+
import { computed, useAttrs } from 'vue';
|
|
9
|
+
import BwaSelect from './bwa-select.vue';
|
|
10
|
+
|
|
11
|
+
defineOptions({
|
|
12
|
+
name: 'BwaMultiSelect',
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
const props = defineProps({
|
|
16
|
+
modelValue: null,
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
const emit = defineEmits(['update:model-value']);
|
|
20
|
+
|
|
21
|
+
const modelValue = computed({
|
|
22
|
+
get: () => props.modelValue,
|
|
23
|
+
set: (v) => emit('update:model-value', v),
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
const attrs = useAttrs();
|
|
27
|
+
</script>
|