widget.qw 1.0.70 → 1.0.72
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/build/style.css +21 -21
- package/build/widget.qw.es.js +110 -64
- package/build/widget.qw.umd.js +110 -64
- package/package.json +1 -1
- package/src/components/BillCard.vue +37 -28
- package/src/components/FilePicker.vue +43 -14
- package/src/components/ObjsEditor.vue +14 -2
- package/src/components/image_picker.vue +3 -3
- package/src/components/images_picker.vue +4 -4
- package/src/env.d.ts +8 -8
- package/src/views/billcard/index.vue +15 -12
- package/src/views/filepicker/index.vue +3 -3
- package/src/views/imagespicker/index.vue +2 -2
- package/src/views/objseditor/index.vue +6 -0
- package/tsconfig.json +19 -19
- package/tsconfig.node.json +8 -8
|
@@ -2,9 +2,10 @@
|
|
|
2
2
|
<van-field v-if="!isGone" name="image" :label="props.label" :required="isRequired" :rules="props.rules"
|
|
3
3
|
label-class="label" :placeholder="props.placeholder">
|
|
4
4
|
<template #input>
|
|
5
|
-
<div class="
|
|
6
|
-
<van-uploader v-model="files" :max-count="
|
|
7
|
-
:accept="props.accept" upload-icon="plus" :deletable="!isDisabled"
|
|
5
|
+
<div class="file-box">
|
|
6
|
+
<van-uploader v-model="files" :max-count="props.max" :afterRead="onAfterRead" :disabled="isDisabled"
|
|
7
|
+
:accept="props.accept" upload-icon="plus" :deletable="!isDisabled"
|
|
8
|
+
:before-delete="onBeforeDelete" />
|
|
8
9
|
</div>
|
|
9
10
|
</template>
|
|
10
11
|
</van-field>
|
|
@@ -17,13 +18,17 @@ import { useVModel } from "@vueuse/core"
|
|
|
17
18
|
|
|
18
19
|
const props = defineProps({
|
|
19
20
|
modelValue: {
|
|
20
|
-
type: String,
|
|
21
|
-
default:
|
|
21
|
+
type: [String, Array],
|
|
22
|
+
default: null
|
|
22
23
|
},
|
|
23
24
|
label: {
|
|
24
25
|
type: String,
|
|
25
26
|
default: ''
|
|
26
27
|
},
|
|
28
|
+
multiple: {
|
|
29
|
+
type: Boolean,
|
|
30
|
+
default: false
|
|
31
|
+
},
|
|
27
32
|
required: {
|
|
28
33
|
type: Boolean,
|
|
29
34
|
default: false
|
|
@@ -67,26 +72,50 @@ const onAfterRead = async (file) => {
|
|
|
67
72
|
}
|
|
68
73
|
|
|
69
74
|
return util.file_upload(params).then(res => {
|
|
70
|
-
|
|
75
|
+
if (props.multiple)
|
|
76
|
+
modelValue.value = [...(modelValue.value || []), res.data]
|
|
77
|
+
else
|
|
78
|
+
modelValue.value = res.data
|
|
71
79
|
return Promise.resolve(file)
|
|
72
80
|
})
|
|
73
81
|
}
|
|
74
82
|
|
|
75
83
|
const onBeforeDelete = (e) => {
|
|
76
|
-
|
|
84
|
+
if (props.multiple) {
|
|
85
|
+
let newUrls = props.modelValue.filter(item => {
|
|
86
|
+
return item != e.url
|
|
87
|
+
})
|
|
88
|
+
emit('update:modelValue', newUrls)
|
|
89
|
+
} else {
|
|
90
|
+
modelValue.value = ''
|
|
91
|
+
}
|
|
92
|
+
|
|
77
93
|
return Promise.resolve(e)
|
|
78
94
|
}
|
|
79
95
|
|
|
80
96
|
watch(() => props.modelValue,
|
|
81
97
|
(newVal, oldVal) => {
|
|
82
|
-
if (
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
98
|
+
if (props.multiple) {
|
|
99
|
+
if (!props.modelValue || props.modelValue.length < 1) {
|
|
100
|
+
files.value = []
|
|
101
|
+
return
|
|
102
|
+
}
|
|
86
103
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
104
|
+
files.value = props.modelValue.map(item => {
|
|
105
|
+
return {
|
|
106
|
+
url: item
|
|
107
|
+
}
|
|
108
|
+
})
|
|
109
|
+
} else {
|
|
110
|
+
if (!props.modelValue) {
|
|
111
|
+
files.value = []
|
|
112
|
+
return
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
files.value = [{
|
|
116
|
+
url: props.modelValue
|
|
117
|
+
}]
|
|
118
|
+
}
|
|
90
119
|
},
|
|
91
120
|
{
|
|
92
121
|
immediate: true
|
|
@@ -8,7 +8,12 @@
|
|
|
8
8
|
<van-icon name="arrow-left" @click.stop="onForward(index)" />
|
|
9
9
|
<div style="padding: 5px 5px;">
|
|
10
10
|
<div v-for="(k, j) in visiableKeys" :key="j" style="padding:2px 2px;font-size: 12px;">
|
|
11
|
-
|
|
11
|
+
<div v-if="props.schema[k].type != 'Images'">
|
|
12
|
+
{{ `${key2name(k)}:${key2value(k, item)}` }}
|
|
13
|
+
</div>
|
|
14
|
+
<div v-else>
|
|
15
|
+
<ImagesPicker v-model="item[k]" readonly/>
|
|
16
|
+
</div>
|
|
12
17
|
</div>
|
|
13
18
|
</div>
|
|
14
19
|
|
|
@@ -45,6 +50,9 @@
|
|
|
45
50
|
<DatetimePicker v-if="props.schema[key].type == 'Datetime'"
|
|
46
51
|
v-model="data.inputValue[key]" placeholder="选择时间" />
|
|
47
52
|
|
|
53
|
+
<ImagesPicker v-if="props.schema[key].type == 'Images'"
|
|
54
|
+
v-model="data.inputValue[key]" />
|
|
55
|
+
|
|
48
56
|
<DateSelector v-if="props.schema[key]?.schema?.options" v-model="data.inputValue[key]"
|
|
49
57
|
:options="props.schema[key]?.schema?.options" :placeholder="`请输入${key2name(key)}`"
|
|
50
58
|
:columnsFieldNames="{
|
|
@@ -77,6 +85,7 @@ import { useVModel } from '@vueuse/core'
|
|
|
77
85
|
import util from '@/util'
|
|
78
86
|
import DatetimePicker from './DatetimePicker/index.vue'
|
|
79
87
|
import DateSelector from './data_selector.vue'
|
|
88
|
+
import ImagesPicker from './images_picker.vue'
|
|
80
89
|
|
|
81
90
|
const props = defineProps({
|
|
82
91
|
modelValue: {
|
|
@@ -176,7 +185,10 @@ const key2value = (key, item) => {
|
|
|
176
185
|
console.log('key2value', key, item[key], item)
|
|
177
186
|
|
|
178
187
|
let v = item[key]
|
|
179
|
-
if (
|
|
188
|
+
if (props.schema[key].type === 'Images') {
|
|
189
|
+
return (v || []).join(',')
|
|
190
|
+
}
|
|
191
|
+
else if (Array.isArray(v)) {
|
|
180
192
|
let formatValues = v.map(e => {
|
|
181
193
|
let kvs = Object.keys(e).map(k => {
|
|
182
194
|
console.log(props.schema[key])
|
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
<div class="image-box">
|
|
6
6
|
<van-uploader v-if="props.capture" v-model="files" :max-count="1" :capture="props.capture"
|
|
7
7
|
accept="image/jpeg,image/png" :afterRead="onAfterRead" :disabled="isDisabled"
|
|
8
|
-
:deletable="!isDisabled" :before-delete="onBeforeDelete"
|
|
8
|
+
:deletable="!isReadonly && !isDisabled" :before-delete="onBeforeDelete" :show-upload="!isReadonly"
|
|
9
9
|
/>
|
|
10
10
|
<van-uploader v-else v-model="files" :max-count="1" accept="image/jpeg,image/png"
|
|
11
|
-
:afterRead="onAfterRead" :disabled="isDisabled" :deletable="!isDisabled"
|
|
12
|
-
:before-delete="onBeforeDelete"
|
|
11
|
+
:afterRead="onAfterRead" :disabled="isDisabled" :deletable="!isReadonly && !isDisabled"
|
|
12
|
+
:before-delete="onBeforeDelete" :show-upload="!isReadonly"
|
|
13
13
|
/>
|
|
14
14
|
</div>
|
|
15
15
|
</template>
|
|
@@ -4,11 +4,11 @@
|
|
|
4
4
|
<template #input>
|
|
5
5
|
<div class="image-box">
|
|
6
6
|
<van-uploader v-if="props.capture" v-model="files" :max-count="props.max" :capture="props.capture"
|
|
7
|
-
accept="image/jpeg,image/png" :disabled="isDisabled" :deletable="!isDisabled"
|
|
8
|
-
:afterRead="onAfterRead" :before-delete="onBeforeDelete" />
|
|
7
|
+
accept="image/jpeg,image/png" :disabled="isDisabled" :deletable="!isRequired && !isDisabled"
|
|
8
|
+
:afterRead="onAfterRead" :before-delete="onBeforeDelete" :show-upload="!isReadonly"/>
|
|
9
9
|
<van-uploader v-else v-model="files" :max-count="props.max" accept="image/jpeg,image/png"
|
|
10
|
-
:disabled="isDisabled" :deletable="!isDisabled" :afterRead="onAfterRead"
|
|
11
|
-
:before-delete="onBeforeDelete" />
|
|
10
|
+
:disabled="isDisabled" :deletable="!isReadonly && !isDisabled" :afterRead="onAfterRead"
|
|
11
|
+
:before-delete="onBeforeDelete" :show-upload="!isReadonly"/>
|
|
12
12
|
</div>
|
|
13
13
|
</template>
|
|
14
14
|
</van-field>
|
package/src/env.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
/// <reference types="vite/client" />
|
|
2
|
-
|
|
3
|
-
declare module '*.vue' {
|
|
4
|
-
import type { DefineComponent } from 'vue'
|
|
5
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/ban-types
|
|
6
|
-
const component: DefineComponent<{}, {}, any>
|
|
7
|
-
export default component
|
|
8
|
-
}
|
|
1
|
+
/// <reference types="vite/client" />
|
|
2
|
+
|
|
3
|
+
declare module '*.vue' {
|
|
4
|
+
import type { DefineComponent } from 'vue'
|
|
5
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/ban-types
|
|
6
|
+
const component: DefineComponent<{}, {}, any>
|
|
7
|
+
export default component
|
|
8
|
+
}
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="page">
|
|
3
|
-
<widget-qw-bill-card
|
|
4
|
-
:
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
<widget-qw-bill-card :category="data.category" :no="data.no" :userState="data.loginUserState"
|
|
4
|
+
:processState="data.processState" :fields="data.fields">
|
|
5
|
+
|
|
6
|
+
<template #foot>
|
|
7
|
+
<div style="text-align: right;">
|
|
8
|
+
<van-button type="warning" size="small">警告按钮</van-button>
|
|
9
|
+
</div>
|
|
10
|
+
</template>
|
|
11
|
+
</widget-qw-bill-card>
|
|
9
12
|
</div>
|
|
10
13
|
</template>
|
|
11
14
|
|
|
@@ -13,21 +16,21 @@
|
|
|
13
16
|
import { onMounted, reactive, watch } from "vue";
|
|
14
17
|
|
|
15
18
|
const data = reactive({
|
|
16
|
-
category:'作业单',
|
|
19
|
+
category: '作业单',
|
|
17
20
|
no: '123',
|
|
18
|
-
loginUserState:'pass',
|
|
21
|
+
loginUserState: 'pass',
|
|
19
22
|
processState: 'finish_pass',
|
|
20
|
-
fields:[{
|
|
23
|
+
fields: [{
|
|
21
24
|
title: '字段1',
|
|
22
25
|
value: '一号门与二号门之间前花园1',
|
|
23
|
-
},{
|
|
26
|
+
}, {
|
|
24
27
|
title: '字段2',
|
|
25
28
|
value: '一号门与二号门之间前花园2',
|
|
26
29
|
}]
|
|
27
30
|
})
|
|
28
31
|
|
|
29
|
-
watch(()=>data.codes,(newVal,oldVal)=>{
|
|
30
|
-
console.log(newVal,oldVal)
|
|
32
|
+
watch(() => data.codes, (newVal, oldVal) => {
|
|
33
|
+
console.log(newVal, oldVal)
|
|
31
34
|
})
|
|
32
35
|
</script>
|
|
33
36
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="page">
|
|
3
|
-
<widget-qw-file-picker label="文件" v-model="data.
|
|
3
|
+
<widget-qw-file-picker label="文件" multiple v-model="data.urls" :auth="data.auth" accept=".jpg,.png" />
|
|
4
4
|
</div>
|
|
5
5
|
</template>
|
|
6
6
|
|
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
import { onMounted, reactive, watch } from "vue";
|
|
9
9
|
|
|
10
10
|
const data = reactive({
|
|
11
|
-
auth:'
|
|
12
|
-
|
|
11
|
+
auth:'require',
|
|
12
|
+
urls: ['https://1.pdf']
|
|
13
13
|
})
|
|
14
14
|
|
|
15
15
|
watch(()=>data.url,(newVal,oldVal)=>{
|
package/tsconfig.json
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"target": "esnext",
|
|
4
|
-
"useDefineForClassFields": true,
|
|
5
|
-
"module": "esnext",
|
|
6
|
-
"moduleResolution": "node",
|
|
7
|
-
"strict": true,
|
|
8
|
-
"jsx": "preserve",
|
|
9
|
-
"sourceMap": true,
|
|
10
|
-
"resolveJsonModule": true,
|
|
11
|
-
"isolatedModules": true,
|
|
12
|
-
"esModuleInterop": true,
|
|
13
|
-
"lib": ["esnext", "dom"],
|
|
14
|
-
"skipLibCheck": true,
|
|
15
|
-
"allowJs": true,
|
|
16
|
-
},
|
|
17
|
-
"include": ["src/**/*.ts", "src/**/*.d.ts", "src/**/*.tsx", "src/**/*.vue"],
|
|
18
|
-
"references": [{ "path": "./tsconfig.node.json" }]
|
|
19
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "esnext",
|
|
4
|
+
"useDefineForClassFields": true,
|
|
5
|
+
"module": "esnext",
|
|
6
|
+
"moduleResolution": "node",
|
|
7
|
+
"strict": true,
|
|
8
|
+
"jsx": "preserve",
|
|
9
|
+
"sourceMap": true,
|
|
10
|
+
"resolveJsonModule": true,
|
|
11
|
+
"isolatedModules": true,
|
|
12
|
+
"esModuleInterop": true,
|
|
13
|
+
"lib": ["esnext", "dom"],
|
|
14
|
+
"skipLibCheck": true,
|
|
15
|
+
"allowJs": true,
|
|
16
|
+
},
|
|
17
|
+
"include": ["src/**/*.ts", "src/**/*.d.ts", "src/**/*.tsx", "src/**/*.vue"],
|
|
18
|
+
"references": [{ "path": "./tsconfig.node.json" }]
|
|
19
|
+
}
|
package/tsconfig.node.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"composite": true,
|
|
4
|
-
"module": "esnext",
|
|
5
|
-
"moduleResolution": "node"
|
|
6
|
-
},
|
|
7
|
-
"include": ["vite.config.ts"]
|
|
8
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"composite": true,
|
|
4
|
+
"module": "esnext",
|
|
5
|
+
"moduleResolution": "node"
|
|
6
|
+
},
|
|
7
|
+
"include": ["vite.config.ts"]
|
|
8
|
+
}
|