widget.qw 1.0.75 → 1.0.76
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/.env.development +10 -10
- package/.env.production +8 -8
- package/README.md +73 -73
- package/build/style.css +473 -487
- package/build/widget.qw.es.js +1508 -129
- package/build/widget.qw.umd.js +1507 -128
- package/index.html +17 -17
- package/package.json +47 -47
- package/src/App.vue +26 -26
- package/src/api/index.js +165 -165
- package/src/components/AuditBar.vue +396 -396
- package/src/components/BillCard.vue +164 -164
- package/src/components/CascaderPicker.vue +132 -132
- package/src/components/CascaderPop.vue +371 -371
- package/src/components/CheckGroup.vue +113 -113
- package/src/components/DatetimePicker/DatetimePop.vue +342 -342
- package/src/components/DatetimePicker/index.vue +124 -124
- package/src/components/DayDropdown.vue +56 -56
- package/src/components/FilePicker.vue +145 -145
- package/src/components/Input.vue +80 -80
- package/src/components/MonthDropdown.vue +51 -51
- package/src/components/MultiPicker.vue +123 -123
- package/src/components/ObjsEditor.vue +334 -334
- package/src/components/SecretNotify.js +5 -5
- package/src/components/Sheet.vue +92 -92
- package/src/components/SingleApiPicker.vue +108 -108
- package/src/components/SinglePicker.vue +102 -102
- package/src/components/SingleUserSelector.vue +425 -425
- package/src/components/Switch.vue +64 -64
- package/src/components/TreePicker.vue +113 -113
- package/src/components/UserPicker.vue +106 -106
- package/src/components/UserProfile.vue +129 -129
- package/src/components/UsersPicker.vue +118 -118
- package/src/components/YearDropdown.vue +59 -59
- package/src/components/data_selector.vue +303 -303
- package/src/components/image_picker.vue +123 -123
- package/src/components/images_picker.vue +159 -144
- package/src/components/index.js +162 -162
- package/src/components/mult_list_selector.vue +155 -155
- package/src/components/subdepartment_selector.vue +481 -481
- package/src/components/user_selector.vue +639 -639
- package/src/components/widget/DataPop.vue +95 -95
- package/src/components/widget/TreePop.vue +88 -88
- package/src/components/widget/UserPop.vue +347 -347
- package/src/env.d.ts +8 -8
- package/src/main.js +117 -117
- package/src/router/index.ts +173 -173
- package/src/util/array_util.js +32 -32
- package/src/util/auth_util.js +72 -72
- package/src/util/bool_util.js +5 -5
- package/src/util/bus.js +1 -1
- package/src/util/cache_util.js +18 -18
- package/src/util/errer_code.js +6 -6
- package/src/util/eval_util.js +19 -19
- package/src/util/icon_util.js +36 -36
- package/src/util/image_util.js +27 -27
- package/src/util/index.js +57 -57
- package/src/util/num_util.js +70 -70
- package/src/util/obj_util.js +28 -28
- package/src/util/request.js +73 -73
- package/src/util/request_json.js +71 -71
- package/src/util/request_json_mute.js +65 -65
- package/src/util/request_upload.js +79 -79
- package/src/util/route_util.js +31 -31
- package/src/util/str_util.js +143 -143
- package/src/util/time_util.js +406 -406
- package/src/util/toast_util.js +24 -24
- package/src/util/tree_util.js +153 -153
- package/src/util/uuid_util.js +9 -9
- package/src/util/validate.js +182 -182
- package/src/util/vue_filter.js +223 -223
- package/src/views/auditbar/index.vue +78 -78
- package/src/views/billcard/index.vue +48 -48
- package/src/views/cascaderpop/index.vue +90 -90
- package/src/views/checkgroup/index.vue +35 -35
- package/src/views/dataSelector/index.vue +48 -48
- package/src/views/datetimepicker/index.vue +34 -34
- package/src/views/daydropdown/index.vue +31 -31
- package/src/views/filepicker/index.vue +31 -31
- package/src/views/imagepicker/index.vue +31 -31
- package/src/views/imagespicker/index.vue +31 -31
- package/src/views/input/index.vue +35 -35
- package/src/views/monthdropdown/index.vue +31 -31
- package/src/views/multListSelector/index.vue +61 -61
- package/src/views/multipicker/index.vue +36 -36
- package/src/views/objseditor/index.vue +277 -277
- package/src/views/productSelector/index.vue +35 -35
- package/src/views/projectpicker/index.vue +41 -41
- package/src/views/secretnotify/index.vue +27 -27
- package/src/views/sheet/index.vue +45 -45
- package/src/views/singlepicker/index.vue +35 -35
- package/src/views/subdepartmentSelector/index.vue +40 -40
- package/src/views/switch/index.vue +34 -34
- package/src/views/treepicker/index.vue +41 -41
- package/src/views/userSelector/index.vue +54 -54
- package/src/views/userSelectorNew/index.vue +45 -45
- package/src/views/userpicker/index.vue +43 -43
- package/src/views/userprofile/index.vue +30 -30
- package/src/views/userspicker/index.vue +43 -43
- package/src/views/yeardropdown/index.vue +32 -32
- package/src/vm/index.js +1 -1
- package/tsconfig.json +19 -19
- package/tsconfig.node.json +8 -8
- package/vite.config.ts +122 -122
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { showNotify } from 'vant'
|
|
2
|
-
|
|
3
|
-
//保密提醒
|
|
4
|
-
export const secret_notify=()=>{
|
|
5
|
-
showNotify({ type: 'danger', message: '严格执行信息保密要求,切实防范企业泄密风险',duration: 3000, })
|
|
1
|
+
import { showNotify } from 'vant'
|
|
2
|
+
|
|
3
|
+
//保密提醒
|
|
4
|
+
export const secret_notify=()=>{
|
|
5
|
+
showNotify({ type: 'danger', message: '严格执行信息保密要求,切实防范企业泄密风险',duration: 3000, })
|
|
6
6
|
}
|
package/src/components/Sheet.vue
CHANGED
|
@@ -1,93 +1,93 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<van-field :label="props.label" v-if="!isGone" :disabled="isDisabled" :required="isRequired"
|
|
3
|
-
:placeholder="props.placeholder">
|
|
4
|
-
|
|
5
|
-
<template #input>
|
|
6
|
-
<div class="actionbar" v-if="!isGone && !isDisabled && !isReadonly">
|
|
7
|
-
<van-button icon="plus" type="primary" size="mini" @click="onAdd(0)" />
|
|
8
|
-
</div>
|
|
9
|
-
<div class="item-box" v-for="(item, i) in modelValue" :key="i">
|
|
10
|
-
<slot name="item" :item="item" :auth="props.auth"></slot>
|
|
11
|
-
<div class="actionbar" v-if="!isGone && !isDisabled && !isReadonly">
|
|
12
|
-
<van-button icon="plus" type="primary" size="mini" @click="onAdd(i+1)" />
|
|
13
|
-
<van-button icon="cross" type="primary" size="mini" @click="onDelete(i)" />
|
|
14
|
-
</div>
|
|
15
|
-
</div>
|
|
16
|
-
</template>
|
|
17
|
-
|
|
18
|
-
</van-field>
|
|
19
|
-
</template>
|
|
20
|
-
|
|
21
|
-
<script setup>
|
|
22
|
-
import { ref, computed, onMounted, defineProps, defineEmits, watch } from "vue"
|
|
23
|
-
import { useVModel } from '@vueuse/core'
|
|
24
|
-
import util from '../util'
|
|
25
|
-
|
|
26
|
-
const props = defineProps({
|
|
27
|
-
modelValue: {
|
|
28
|
-
type: Array,
|
|
29
|
-
default: []
|
|
30
|
-
},
|
|
31
|
-
label: {
|
|
32
|
-
type: String,
|
|
33
|
-
default: ''
|
|
34
|
-
},
|
|
35
|
-
placeholder: {
|
|
36
|
-
type: String,
|
|
37
|
-
default: ''
|
|
38
|
-
},
|
|
39
|
-
readonly: {
|
|
40
|
-
type: Boolean,
|
|
41
|
-
default: true
|
|
42
|
-
},
|
|
43
|
-
required: {
|
|
44
|
-
type: Boolean,
|
|
45
|
-
default: false
|
|
46
|
-
},
|
|
47
|
-
auth: {
|
|
48
|
-
type: String,
|
|
49
|
-
default: ''
|
|
50
|
-
}
|
|
51
|
-
})
|
|
52
|
-
const emit = defineEmits(['update:modelValue'])
|
|
53
|
-
const modelValue = useVModel(props, 'modelValue', emit)
|
|
54
|
-
const { isRequired, isReadonly, isGone, isDisabled } = util.props2auth(props)
|
|
55
|
-
|
|
56
|
-
onMounted(() => {
|
|
57
|
-
})
|
|
58
|
-
|
|
59
|
-
const onAdd = (idx) => {
|
|
60
|
-
modelValue.value.splice(idx, 0, {})
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
const onDelete = (idx) => {
|
|
64
|
-
modelValue.value.splice(idx, 1)
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
watch(() => props.modelValue, (o, n) => {
|
|
68
|
-
if (!props.modelValue)
|
|
69
|
-
modelValue.value = []
|
|
70
|
-
}, { immediate: true })
|
|
71
|
-
</script>
|
|
72
|
-
|
|
73
|
-
<style lang="scss" scoped>
|
|
74
|
-
.item-box {
|
|
75
|
-
position: relative;
|
|
76
|
-
padding-bottom: 5px;
|
|
77
|
-
border-bottom: 1px solid #e1e1e1;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
.actionbar {
|
|
81
|
-
display: flex;
|
|
82
|
-
justify-content: center;
|
|
83
|
-
margin-top: 5px;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
:deep(.label) {
|
|
87
|
-
color: #000 !important;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
:deep(.van-field__control--custom) {
|
|
91
|
-
display: block;
|
|
92
|
-
}
|
|
1
|
+
<template>
|
|
2
|
+
<van-field :label="props.label" v-if="!isGone" :disabled="isDisabled" :required="isRequired"
|
|
3
|
+
:placeholder="props.placeholder">
|
|
4
|
+
|
|
5
|
+
<template #input>
|
|
6
|
+
<div class="actionbar" v-if="!isGone && !isDisabled && !isReadonly">
|
|
7
|
+
<van-button icon="plus" type="primary" size="mini" @click="onAdd(0)" />
|
|
8
|
+
</div>
|
|
9
|
+
<div class="item-box" v-for="(item, i) in modelValue" :key="i">
|
|
10
|
+
<slot name="item" :item="item" :auth="props.auth"></slot>
|
|
11
|
+
<div class="actionbar" v-if="!isGone && !isDisabled && !isReadonly">
|
|
12
|
+
<van-button icon="plus" type="primary" size="mini" @click="onAdd(i+1)" />
|
|
13
|
+
<van-button icon="cross" type="primary" size="mini" @click="onDelete(i)" />
|
|
14
|
+
</div>
|
|
15
|
+
</div>
|
|
16
|
+
</template>
|
|
17
|
+
|
|
18
|
+
</van-field>
|
|
19
|
+
</template>
|
|
20
|
+
|
|
21
|
+
<script setup>
|
|
22
|
+
import { ref, computed, onMounted, defineProps, defineEmits, watch } from "vue"
|
|
23
|
+
import { useVModel } from '@vueuse/core'
|
|
24
|
+
import util from '../util'
|
|
25
|
+
|
|
26
|
+
const props = defineProps({
|
|
27
|
+
modelValue: {
|
|
28
|
+
type: Array,
|
|
29
|
+
default: []
|
|
30
|
+
},
|
|
31
|
+
label: {
|
|
32
|
+
type: String,
|
|
33
|
+
default: ''
|
|
34
|
+
},
|
|
35
|
+
placeholder: {
|
|
36
|
+
type: String,
|
|
37
|
+
default: ''
|
|
38
|
+
},
|
|
39
|
+
readonly: {
|
|
40
|
+
type: Boolean,
|
|
41
|
+
default: true
|
|
42
|
+
},
|
|
43
|
+
required: {
|
|
44
|
+
type: Boolean,
|
|
45
|
+
default: false
|
|
46
|
+
},
|
|
47
|
+
auth: {
|
|
48
|
+
type: String,
|
|
49
|
+
default: ''
|
|
50
|
+
}
|
|
51
|
+
})
|
|
52
|
+
const emit = defineEmits(['update:modelValue'])
|
|
53
|
+
const modelValue = useVModel(props, 'modelValue', emit)
|
|
54
|
+
const { isRequired, isReadonly, isGone, isDisabled } = util.props2auth(props)
|
|
55
|
+
|
|
56
|
+
onMounted(() => {
|
|
57
|
+
})
|
|
58
|
+
|
|
59
|
+
const onAdd = (idx) => {
|
|
60
|
+
modelValue.value.splice(idx, 0, {})
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
const onDelete = (idx) => {
|
|
64
|
+
modelValue.value.splice(idx, 1)
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
watch(() => props.modelValue, (o, n) => {
|
|
68
|
+
if (!props.modelValue)
|
|
69
|
+
modelValue.value = []
|
|
70
|
+
}, { immediate: true })
|
|
71
|
+
</script>
|
|
72
|
+
|
|
73
|
+
<style lang="scss" scoped>
|
|
74
|
+
.item-box {
|
|
75
|
+
position: relative;
|
|
76
|
+
padding-bottom: 5px;
|
|
77
|
+
border-bottom: 1px solid #e1e1e1;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.actionbar {
|
|
81
|
+
display: flex;
|
|
82
|
+
justify-content: center;
|
|
83
|
+
margin-top: 5px;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
:deep(.label) {
|
|
87
|
+
color: #000 !important;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
:deep(.van-field__control--custom) {
|
|
91
|
+
display: block;
|
|
92
|
+
}
|
|
93
93
|
</style>
|
|
@@ -1,109 +1,109 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="widget">
|
|
3
|
-
<van-field v-if="!isGone" v-model="formatLabel" :is-link="!isReadonly && !isDisabled" :label="props.label" :placeholder="props.placeholder" readonly
|
|
4
|
-
:required="isRequired" :disabled="isDisabled" @click="onShow" />
|
|
5
|
-
<van-popup v-model:show="data.isShow" destroy-on-close round position="bottom">
|
|
6
|
-
<van-picker :columns="props.options" @cancel="onCancel" @confirm="onConfirm" />
|
|
7
|
-
</van-popup>
|
|
8
|
-
</div>
|
|
9
|
-
</template>
|
|
10
|
-
|
|
11
|
-
<script setup>
|
|
12
|
-
import { ref, onMounted, watch, reactive, computed } from 'vue'
|
|
13
|
-
import util from '../util'
|
|
14
|
-
import { useVModel } from '@vueuse/core'
|
|
15
|
-
|
|
16
|
-
const props = defineProps({
|
|
17
|
-
label: {
|
|
18
|
-
type: String,
|
|
19
|
-
default: ''
|
|
20
|
-
},
|
|
21
|
-
placeholder: {
|
|
22
|
-
type: String,
|
|
23
|
-
default: ''
|
|
24
|
-
},
|
|
25
|
-
required: {
|
|
26
|
-
type: Boolean,
|
|
27
|
-
default: false,
|
|
28
|
-
},
|
|
29
|
-
readonly: {
|
|
30
|
-
type: Boolean,
|
|
31
|
-
default: true,
|
|
32
|
-
},
|
|
33
|
-
auth: {
|
|
34
|
-
type: String,
|
|
35
|
-
default: "",
|
|
36
|
-
},
|
|
37
|
-
options: {
|
|
38
|
-
type:Array,
|
|
39
|
-
default: []
|
|
40
|
-
}
|
|
41
|
-
})
|
|
42
|
-
|
|
43
|
-
const emit = defineEmits(['update:modelValue', 'select'])
|
|
44
|
-
const modelValue = useVModel(props, 'modelValue', emit)
|
|
45
|
-
const { isRequired, isReadonly, isGone, isDisabled } = util.props2auth(props);
|
|
46
|
-
const data = reactive({
|
|
47
|
-
isShow: false
|
|
48
|
-
})
|
|
49
|
-
const formatLabel = computed(() => {
|
|
50
|
-
let one = props.options.find(item => item.value == modelValue.value)
|
|
51
|
-
return one ? one.text : ''
|
|
52
|
-
})
|
|
53
|
-
|
|
54
|
-
onMounted(() => {
|
|
55
|
-
})
|
|
56
|
-
|
|
57
|
-
const onShow=()=>{
|
|
58
|
-
if(isReadonly.value || isDisabled.value || isGone.value)
|
|
59
|
-
return
|
|
60
|
-
|
|
61
|
-
data.isShow = true
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
const onConfirm = ({ selectedOptions }) => {
|
|
65
|
-
console.log("selectedOptions: " + selectedOptions)
|
|
66
|
-
let selectOption = selectedOptions[selectedOptions.length - 1]
|
|
67
|
-
modelValue.value = selectOption.value
|
|
68
|
-
emit('select', selectOption)
|
|
69
|
-
data.isShow = false
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
const onCancel = () => {
|
|
73
|
-
data.isShow = false
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
</script>
|
|
77
|
-
|
|
78
|
-
<style lang="scss" scoped>
|
|
79
|
-
.widget {
|
|
80
|
-
:deep(.van-cell) {
|
|
81
|
-
align-items: center;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
:deep(.van-field__label) {
|
|
85
|
-
width: 90px;
|
|
86
|
-
flex: none;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
.readonly-field {
|
|
90
|
-
:deep(.van-field__control) {
|
|
91
|
-
color: #323233;
|
|
92
|
-
/* 修改文字颜色与普通字段一致 */
|
|
93
|
-
padding-right: 16px;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
/* 添加必填星号对齐 */
|
|
97
|
-
&.van-field--required {
|
|
98
|
-
:deep(.van-field__label::before) {
|
|
99
|
-
margin-right: 4px;
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
/* 统一字段间距 */
|
|
105
|
-
.readonly-field {
|
|
106
|
-
margin: 4px 0;
|
|
107
|
-
}
|
|
108
|
-
}
|
|
1
|
+
<template>
|
|
2
|
+
<div class="widget">
|
|
3
|
+
<van-field v-if="!isGone" v-model="formatLabel" :is-link="!isReadonly && !isDisabled" :label="props.label" :placeholder="props.placeholder" readonly
|
|
4
|
+
:required="isRequired" :disabled="isDisabled" @click="onShow" />
|
|
5
|
+
<van-popup v-model:show="data.isShow" destroy-on-close round position="bottom">
|
|
6
|
+
<van-picker :columns="props.options" @cancel="onCancel" @confirm="onConfirm" />
|
|
7
|
+
</van-popup>
|
|
8
|
+
</div>
|
|
9
|
+
</template>
|
|
10
|
+
|
|
11
|
+
<script setup>
|
|
12
|
+
import { ref, onMounted, watch, reactive, computed } from 'vue'
|
|
13
|
+
import util from '../util'
|
|
14
|
+
import { useVModel } from '@vueuse/core'
|
|
15
|
+
|
|
16
|
+
const props = defineProps({
|
|
17
|
+
label: {
|
|
18
|
+
type: String,
|
|
19
|
+
default: ''
|
|
20
|
+
},
|
|
21
|
+
placeholder: {
|
|
22
|
+
type: String,
|
|
23
|
+
default: ''
|
|
24
|
+
},
|
|
25
|
+
required: {
|
|
26
|
+
type: Boolean,
|
|
27
|
+
default: false,
|
|
28
|
+
},
|
|
29
|
+
readonly: {
|
|
30
|
+
type: Boolean,
|
|
31
|
+
default: true,
|
|
32
|
+
},
|
|
33
|
+
auth: {
|
|
34
|
+
type: String,
|
|
35
|
+
default: "",
|
|
36
|
+
},
|
|
37
|
+
options: {
|
|
38
|
+
type:Array,
|
|
39
|
+
default: []
|
|
40
|
+
}
|
|
41
|
+
})
|
|
42
|
+
|
|
43
|
+
const emit = defineEmits(['update:modelValue', 'select'])
|
|
44
|
+
const modelValue = useVModel(props, 'modelValue', emit)
|
|
45
|
+
const { isRequired, isReadonly, isGone, isDisabled } = util.props2auth(props);
|
|
46
|
+
const data = reactive({
|
|
47
|
+
isShow: false
|
|
48
|
+
})
|
|
49
|
+
const formatLabel = computed(() => {
|
|
50
|
+
let one = props.options.find(item => item.value == modelValue.value)
|
|
51
|
+
return one ? one.text : ''
|
|
52
|
+
})
|
|
53
|
+
|
|
54
|
+
onMounted(() => {
|
|
55
|
+
})
|
|
56
|
+
|
|
57
|
+
const onShow=()=>{
|
|
58
|
+
if(isReadonly.value || isDisabled.value || isGone.value)
|
|
59
|
+
return
|
|
60
|
+
|
|
61
|
+
data.isShow = true
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
const onConfirm = ({ selectedOptions }) => {
|
|
65
|
+
console.log("selectedOptions: " + selectedOptions)
|
|
66
|
+
let selectOption = selectedOptions[selectedOptions.length - 1]
|
|
67
|
+
modelValue.value = selectOption.value
|
|
68
|
+
emit('select', selectOption)
|
|
69
|
+
data.isShow = false
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
const onCancel = () => {
|
|
73
|
+
data.isShow = false
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
</script>
|
|
77
|
+
|
|
78
|
+
<style lang="scss" scoped>
|
|
79
|
+
.widget {
|
|
80
|
+
:deep(.van-cell) {
|
|
81
|
+
align-items: center;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
:deep(.van-field__label) {
|
|
85
|
+
width: 90px;
|
|
86
|
+
flex: none;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.readonly-field {
|
|
90
|
+
:deep(.van-field__control) {
|
|
91
|
+
color: #323233;
|
|
92
|
+
/* 修改文字颜色与普通字段一致 */
|
|
93
|
+
padding-right: 16px;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/* 添加必填星号对齐 */
|
|
97
|
+
&.van-field--required {
|
|
98
|
+
:deep(.van-field__label::before) {
|
|
99
|
+
margin-right: 4px;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/* 统一字段间距 */
|
|
105
|
+
.readonly-field {
|
|
106
|
+
margin: 4px 0;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
109
|
</style>
|
|
@@ -1,103 +1,103 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<van-field v-if="!isGone" v-model="modelValue" :is-link="!isDisabled" :disabled="isDisabled" readonly name="picker"
|
|
3
|
-
:label="label" label-class="label" :placeholder="props.placeholder" @click-input="onClick" :required="isRequired"
|
|
4
|
-
:rules="props.rules" />
|
|
5
|
-
<van-popup v-model:show="isShowPicker" position="bottom">
|
|
6
|
-
<van-picker :columns="totalOptions" @confirm="onConfirm" @cancel="isShowPicker = false" />
|
|
7
|
-
</van-popup>
|
|
8
|
-
</template>
|
|
9
|
-
|
|
10
|
-
<script setup>
|
|
11
|
-
import { ref, computed, onMounted, defineProps, defineEmits, watch } from "vue"
|
|
12
|
-
import util from "../util"
|
|
13
|
-
import { useVModel } from '@vueuse/core'
|
|
14
|
-
|
|
15
|
-
const props = defineProps({
|
|
16
|
-
id: String,
|
|
17
|
-
modelValue: String,
|
|
18
|
-
label: String,
|
|
19
|
-
placeholder:String,
|
|
20
|
-
readonly: {
|
|
21
|
-
type: Boolean,
|
|
22
|
-
default: true
|
|
23
|
-
},
|
|
24
|
-
required: {
|
|
25
|
-
type: Boolean,
|
|
26
|
-
default: false
|
|
27
|
-
},
|
|
28
|
-
auth: {
|
|
29
|
-
type: String,
|
|
30
|
-
default: ''
|
|
31
|
-
},
|
|
32
|
-
rules: {
|
|
33
|
-
type: Array,
|
|
34
|
-
default: null
|
|
35
|
-
}
|
|
36
|
-
})
|
|
37
|
-
const emit = defineEmits(['update:modelValue'])
|
|
38
|
-
const modelValue = useVModel(props, 'modelValue', emit)
|
|
39
|
-
const totalOptions = computed(() => {
|
|
40
|
-
if (!modelValue.value)
|
|
41
|
-
return columns.value
|
|
42
|
-
|
|
43
|
-
let ary = columns.value.filter(item => item.value == modelValue.value)
|
|
44
|
-
if (ary.length < 1)
|
|
45
|
-
ary = [{ text: modelValue.value, value: modelValue.value }, ...columns.value]
|
|
46
|
-
else
|
|
47
|
-
ary = [...columns.value]
|
|
48
|
-
return ary
|
|
49
|
-
})
|
|
50
|
-
const { isRequired, isGone, isDisabled,isReadonly } = util.props2auth(props)
|
|
51
|
-
|
|
52
|
-
const isShowPicker = ref(false)
|
|
53
|
-
const columns = ref([])
|
|
54
|
-
|
|
55
|
-
onMounted(() => {
|
|
56
|
-
query()
|
|
57
|
-
})
|
|
58
|
-
|
|
59
|
-
const query = async () => {
|
|
60
|
-
let params = {
|
|
61
|
-
id: props.id,
|
|
62
|
-
}
|
|
63
|
-
const res = await util.dictionary_dict(params)
|
|
64
|
-
console.log(res.data)
|
|
65
|
-
if (!res.data.parseValue) {
|
|
66
|
-
columns.value = []
|
|
67
|
-
return
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
columns.value = res.data.parseValue.map(item => {
|
|
71
|
-
return {
|
|
72
|
-
text: item.title,
|
|
73
|
-
value: item.code
|
|
74
|
-
}
|
|
75
|
-
})
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
const onClick = () => {
|
|
79
|
-
if (isDisabled.value)
|
|
80
|
-
return
|
|
81
|
-
|
|
82
|
-
isShowPicker.value = true
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
const onConfirm = ({ selectedOptions }) => {
|
|
86
|
-
console.log("selectedOptions: " + selectedOptions)
|
|
87
|
-
modelValue.value = selectedOptions[selectedOptions.length - 1].value
|
|
88
|
-
isShowPicker.value = false
|
|
89
|
-
}
|
|
90
|
-
</script>
|
|
91
|
-
|
|
92
|
-
<style lang="scss" scoped>
|
|
93
|
-
:deep(.label) {
|
|
94
|
-
color: #000 !important;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
:deep(.van-field__control:disabled) {
|
|
98
|
-
color: #000 !important;
|
|
99
|
-
cursor: not-allowed;
|
|
100
|
-
opacity: 1;
|
|
101
|
-
-webkit-text-fill-color: #000;
|
|
102
|
-
}
|
|
1
|
+
<template>
|
|
2
|
+
<van-field v-if="!isGone" v-model="modelValue" :is-link="!isDisabled" :disabled="isDisabled" readonly name="picker"
|
|
3
|
+
:label="label" label-class="label" :placeholder="props.placeholder" @click-input="onClick" :required="isRequired"
|
|
4
|
+
:rules="props.rules" />
|
|
5
|
+
<van-popup v-model:show="isShowPicker" position="bottom">
|
|
6
|
+
<van-picker :columns="totalOptions" @confirm="onConfirm" @cancel="isShowPicker = false" />
|
|
7
|
+
</van-popup>
|
|
8
|
+
</template>
|
|
9
|
+
|
|
10
|
+
<script setup>
|
|
11
|
+
import { ref, computed, onMounted, defineProps, defineEmits, watch } from "vue"
|
|
12
|
+
import util from "../util"
|
|
13
|
+
import { useVModel } from '@vueuse/core'
|
|
14
|
+
|
|
15
|
+
const props = defineProps({
|
|
16
|
+
id: String,
|
|
17
|
+
modelValue: String,
|
|
18
|
+
label: String,
|
|
19
|
+
placeholder:String,
|
|
20
|
+
readonly: {
|
|
21
|
+
type: Boolean,
|
|
22
|
+
default: true
|
|
23
|
+
},
|
|
24
|
+
required: {
|
|
25
|
+
type: Boolean,
|
|
26
|
+
default: false
|
|
27
|
+
},
|
|
28
|
+
auth: {
|
|
29
|
+
type: String,
|
|
30
|
+
default: ''
|
|
31
|
+
},
|
|
32
|
+
rules: {
|
|
33
|
+
type: Array,
|
|
34
|
+
default: null
|
|
35
|
+
}
|
|
36
|
+
})
|
|
37
|
+
const emit = defineEmits(['update:modelValue'])
|
|
38
|
+
const modelValue = useVModel(props, 'modelValue', emit)
|
|
39
|
+
const totalOptions = computed(() => {
|
|
40
|
+
if (!modelValue.value)
|
|
41
|
+
return columns.value
|
|
42
|
+
|
|
43
|
+
let ary = columns.value.filter(item => item.value == modelValue.value)
|
|
44
|
+
if (ary.length < 1)
|
|
45
|
+
ary = [{ text: modelValue.value, value: modelValue.value }, ...columns.value]
|
|
46
|
+
else
|
|
47
|
+
ary = [...columns.value]
|
|
48
|
+
return ary
|
|
49
|
+
})
|
|
50
|
+
const { isRequired, isGone, isDisabled,isReadonly } = util.props2auth(props)
|
|
51
|
+
|
|
52
|
+
const isShowPicker = ref(false)
|
|
53
|
+
const columns = ref([])
|
|
54
|
+
|
|
55
|
+
onMounted(() => {
|
|
56
|
+
query()
|
|
57
|
+
})
|
|
58
|
+
|
|
59
|
+
const query = async () => {
|
|
60
|
+
let params = {
|
|
61
|
+
id: props.id,
|
|
62
|
+
}
|
|
63
|
+
const res = await util.dictionary_dict(params)
|
|
64
|
+
console.log(res.data)
|
|
65
|
+
if (!res.data.parseValue) {
|
|
66
|
+
columns.value = []
|
|
67
|
+
return
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
columns.value = res.data.parseValue.map(item => {
|
|
71
|
+
return {
|
|
72
|
+
text: item.title,
|
|
73
|
+
value: item.code
|
|
74
|
+
}
|
|
75
|
+
})
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
const onClick = () => {
|
|
79
|
+
if (isDisabled.value)
|
|
80
|
+
return
|
|
81
|
+
|
|
82
|
+
isShowPicker.value = true
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
const onConfirm = ({ selectedOptions }) => {
|
|
86
|
+
console.log("selectedOptions: " + selectedOptions)
|
|
87
|
+
modelValue.value = selectedOptions[selectedOptions.length - 1].value
|
|
88
|
+
isShowPicker.value = false
|
|
89
|
+
}
|
|
90
|
+
</script>
|
|
91
|
+
|
|
92
|
+
<style lang="scss" scoped>
|
|
93
|
+
:deep(.label) {
|
|
94
|
+
color: #000 !important;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
:deep(.van-field__control:disabled) {
|
|
98
|
+
color: #000 !important;
|
|
99
|
+
cursor: not-allowed;
|
|
100
|
+
opacity: 1;
|
|
101
|
+
-webkit-text-fill-color: #000;
|
|
102
|
+
}
|
|
103
103
|
</style>
|