@xilonglab/vue-main 1.3.9 → 1.3.11

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.9",
3
+ "version": "1.3.11",
4
4
  "description": "xilong vue main",
5
5
  "main": "packages/index.js",
6
6
  "scripts": {
@@ -0,0 +1,59 @@
1
+ <script setup>
2
+ defineOptions({ name: "XlBoxImage" })
3
+
4
+ import { computed } from 'vue'
5
+
6
+ const props = defineProps({
7
+ value: {
8
+ type: Object,
9
+ default: () => ({})
10
+ },
11
+ boxwidth: {
12
+ type: Number,
13
+ default: 100
14
+ },
15
+ boxheight: {
16
+ type: Number,
17
+ default: 100
18
+ },
19
+ })
20
+
21
+ const imageSrc = computed(() => {
22
+ if (props.value && props.value.uri) {
23
+ return `/storage/${props.value.uri}`
24
+ }
25
+ return ''
26
+ })
27
+
28
+ </script>
29
+
30
+ <template>
31
+ <div class="xl-box-image"
32
+ :style="{
33
+ width: `${boxwidth}px`,
34
+ height: `${boxheight}px`
35
+ }">
36
+ <img v-if="imageSrc"
37
+ class="image"
38
+ :src="imageSrc" />
39
+ </div>
40
+ </template>
41
+
42
+ <style lang="less" scoped>
43
+ .xl-box-image {
44
+ display: flex;
45
+ align-items: center;
46
+ justify-content: center;
47
+ overflow: hidden;
48
+ border: 1px solid var(--el-border-color);
49
+ border-radius: 4px;
50
+
51
+ .image {
52
+ max-width: 100%;
53
+ max-height: 100%;
54
+ display: block;
55
+ object-fit: contain;
56
+ }
57
+ }
58
+ </style>
59
+
@@ -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>
@@ -131,7 +131,7 @@ const { refs, api, params, obj, chartOptions, total } = inject('injections')
131
131
  :p="col.prop"
132
132
  />
133
133
  <xl-map-col
134
- v-else-if="col.type === 'map'"
134
+ v-else-if="col.map"
135
135
  :l="col.label"
136
136
  :p="col.prop"
137
137
  :width="col.width"
@@ -29,7 +29,7 @@ const props = defineProps({
29
29
  :p="col.prop"
30
30
  />
31
31
  <xl-map-col
32
- v-else-if="col.type === 'map'"
32
+ v-else-if="col.map"
33
33
  :l="col.label"
34
34
  :p="col.prop"
35
35
  :width="col.width"