@xilonglab/vue-main 1.3.8 → 1.3.10

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xilonglab/vue-main",
3
- "version": "1.3.8",
3
+ "version": "1.3.10",
4
4
  "description": "xilong vue main",
5
5
  "main": "packages/index.js",
6
6
  "scripts": {
@@ -0,0 +1,129 @@
1
+ <script setup>
2
+ defineOptions({ name: "XlSignatureInput" })
3
+
4
+ import { ref, computed } from 'vue'
5
+
6
+
7
+ const emits = defineEmits(['change', 'update:modelValue'])
8
+
9
+ const props = defineProps({
10
+ modelValue: {
11
+ default: "",
12
+ },
13
+ api: {
14
+ type: Function,
15
+ default: () => { },
16
+ },
17
+ headers: {
18
+ type: Object,
19
+ default: () => ({})
20
+ },
21
+ params: {
22
+ type: Object,
23
+ default: () => ({})
24
+ },
25
+ disabled: {
26
+ type: Boolean,
27
+ default: false,
28
+ },
29
+ accept: {
30
+ type: String,
31
+ default: ''
32
+ },
33
+ })
34
+
35
+
36
+ const value = computed({
37
+ get() {
38
+ return props.modelValue;
39
+ },
40
+ set(data) {
41
+ emits('change', data)
42
+ emits('update:modelValue', data)
43
+ },
44
+ });
45
+
46
+
47
+ const loading = ref(false)
48
+
49
+ function beforeUpload() {
50
+ loading.value = true
51
+ }
52
+
53
+ function onSuccess(data, file, filelist) {
54
+ loading.value = false;
55
+ emits('update:modelValue', data)
56
+ }
57
+
58
+ function upload(option) {
59
+ let formData = new FormData();
60
+ const { api, params } = props
61
+ const { file } = option
62
+ formData.append("file", file);
63
+ formData.append("filename", file.name);
64
+ for (let key in params) {
65
+ formData.append(key, params[key]);
66
+ }
67
+ return api(formData);
68
+ }
69
+ </script>
70
+
71
+
72
+ <template>
73
+ <el-upload class="xl-signature-input" action="" :headers="headers" :http-request="upload" :before-upload="beforeUpload"
74
+ :on-success="onSuccess" :show-file-list="false" :disabled="disabled" :accept="props.accept">
75
+ <div class="image-container" v-if="value">
76
+ <img class="image" :src="`/storage/${value.uri}`"
77
+ :style="{
78
+ width: value.width ? `${value.width}px` : 'auto',
79
+ height: value.height ? `${value.height}px` : 'auto'
80
+ }" />
81
+ </div>
82
+ <el-icon class="icon" v-else>
83
+ <Plus />
84
+ </el-icon>
85
+ </el-upload>
86
+ </template>
87
+
88
+
89
+ <style lang="less">
90
+ .xl-signature-input {
91
+
92
+ .el-upload {
93
+ border: 1px dashed var(--el-border-color);
94
+ border-radius: 6px;
95
+ cursor: pointer;
96
+ position: relative;
97
+ overflow: hidden;
98
+ transition: var(--el-transition-duration-fast);
99
+
100
+ &:hover {
101
+ border-color: var(--el-color-primary);
102
+ }
103
+ }
104
+
105
+ .image-container {
106
+ width: 356px;
107
+ height: 67px;
108
+ display: flex;
109
+ align-items: center;
110
+ justify-content: center;
111
+ overflow: hidden;
112
+ }
113
+
114
+ .image {
115
+ max-width: 100%;
116
+ max-height: 100%;
117
+ display: block;
118
+ object-fit: contain;
119
+ }
120
+
121
+ .el-icon.icon {
122
+ font-size: 28px;
123
+ color: #8c939d;
124
+ width: 356px;
125
+ height: 67px;
126
+ text-align: center;
127
+ }
128
+ }
129
+ </style>
@@ -78,24 +78,9 @@ defineExpose({
78
78
  :label-width="`${labelWidth}px`"
79
79
  >
80
80
  <el-row>
81
- <template v-for="col in columns" :key="col.prop">
82
- <slot
83
- v-if="col.slot"
84
- :name="col.slot"
85
- />
86
- <xl-form-col
87
- v-else-if="col.form"
88
- :span="col.form.span"
89
- :l="col.label"
90
- :p="col.prop"
91
- >
92
- <component
93
- :is="`xl-${col.form.type || 'input'}`"
94
- v-model="obj[col.prop]"
95
- v-bind="col.form || {}"
96
- />
97
- </xl-form-col>
98
- </template>
81
+ <xl-dialog-columns
82
+ :columns="columns"
83
+ :obj="obj"/>
99
84
  </el-row>
100
85
  <slot />
101
86
  </el-form>
@@ -0,0 +1,36 @@
1
+ <script setup>
2
+ defineOptions({ name: "XlDialogColumns" })
3
+
4
+ const props = defineProps({
5
+ columns: {
6
+ type: Array,
7
+ default: () => [],
8
+ },
9
+ obj: {
10
+ type: Object,
11
+ default: () => ({}),
12
+ },
13
+ });
14
+ </script>
15
+
16
+ <template>
17
+ <template v-for="col in columns" :key="col.prop">
18
+ <slot
19
+ v-if="col.slot"
20
+ :name="col.slot"
21
+ />
22
+ <xl-form-col
23
+ v-else-if="col.form"
24
+ :span="col.form.span"
25
+ :l="col.label"
26
+ :p="col.prop"
27
+ >
28
+ <component
29
+ :is="`xl-${col.form.type || 'input'}`"
30
+ v-model="obj[col.prop]"
31
+ v-bind="col.form || {}"
32
+ />
33
+ </xl-form-col>
34
+ </template>
35
+ </template>
36
+