widget.qw 1.0.83 → 1.0.85
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 +75 -75
- package/build/style.css +521 -471
- package/build/widget.qw.es.js +253 -84
- package/build/widget.qw.umd.js +252 -83
- package/index.html +17 -17
- package/package.json +47 -47
- package/src/App.vue +26 -26
- package/src/api/index.js +173 -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 +375 -371
- package/src/components/CheckGroup.vue +113 -113
- package/src/components/DatetimeDropdown.vue +62 -0
- package/src/components/{DatetimePicker/index.vue → DatetimePicker.vue} +124 -124
- package/src/components/DayDropdown.vue +56 -56
- package/src/components/FilePicker.vue +169 -169
- package/src/components/HeadBar.vue +130 -0
- 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 +195 -195
- package/src/components/index.js +172 -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/{DatetimePicker → widget}/DatetimePop.vue +342 -342
- package/src/components/widget/TreePop.vue +88 -88
- package/src/components/widget/UserPop.vue +347 -347
- package/src/main.js +117 -117
- package/src/router/index.ts +183 -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/cascaderpicker/index.vue +0 -0
- package/src/views/cascaderpicker/userpicker.vue +183 -0
- 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/datetimedropdown/index.vue +34 -0
- package/src/views/datetimepicker/index.vue +34 -34
- package/src/views/daydropdown/index.vue +31 -31
- package/src/views/filepicker/index.vue +32 -32
- package/src/views/headbar/index.vue +28 -0
- package/src/views/home/index.vue +0 -0
- package/src/views/imagepicker/index.vue +31 -31
- package/src/views/imagespicker/index.vue +37 -37
- 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/vite.config.ts +122 -122
|
@@ -1,114 +1,114 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<van-field v-if="!isGone" :label="props.label" :required="isRequired" :rules="props.rules">
|
|
3
|
-
<template #input>
|
|
4
|
-
<van-checkbox-group v-model="modelValue" direction="vertical" :disabled="isDisabled">
|
|
5
|
-
<van-checkbox style="padding:5px 0;" v-for="(option, i) in totalOptions" :key="i" :name="option.code"
|
|
6
|
-
shape="square">{{ option.title }}</van-checkbox>
|
|
7
|
-
</van-checkbox-group>
|
|
8
|
-
</template>
|
|
9
|
-
</van-field>
|
|
10
|
-
</template>
|
|
11
|
-
|
|
12
|
-
<script setup>
|
|
13
|
-
import { ref, computed, onMounted, defineProps, defineEmits, watch } from "vue"
|
|
14
|
-
import util from "../util"
|
|
15
|
-
import { useVModel } from '@vueuse/core'
|
|
16
|
-
|
|
17
|
-
const props = defineProps({
|
|
18
|
-
id: {
|
|
19
|
-
type:String,
|
|
20
|
-
default: ''
|
|
21
|
-
},
|
|
22
|
-
modelValue: {
|
|
23
|
-
type: Array,
|
|
24
|
-
default:[]
|
|
25
|
-
},
|
|
26
|
-
label: {
|
|
27
|
-
type:String,
|
|
28
|
-
default: ''
|
|
29
|
-
},
|
|
30
|
-
readonly: {
|
|
31
|
-
type: Boolean,
|
|
32
|
-
default: true
|
|
33
|
-
},
|
|
34
|
-
required: {
|
|
35
|
-
type: Boolean,
|
|
36
|
-
default: false
|
|
37
|
-
},
|
|
38
|
-
auth: {
|
|
39
|
-
type: String,
|
|
40
|
-
default: ''
|
|
41
|
-
},
|
|
42
|
-
rules: {
|
|
43
|
-
type: Array,
|
|
44
|
-
default: null
|
|
45
|
-
}
|
|
46
|
-
})
|
|
47
|
-
const emit = defineEmits(['update:modelValue'])
|
|
48
|
-
const modelValue = useVModel(props, 'modelValue', emit)
|
|
49
|
-
const { isRequired, isReadonly, isGone, isDisabled } = util.props2auth(props)
|
|
50
|
-
const options = ref([])
|
|
51
|
-
// 将初始化数据与配置项合并
|
|
52
|
-
const totalOptions = computed(() => {
|
|
53
|
-
let selects = modelValue.value
|
|
54
|
-
if (!selects || selects.length<1)
|
|
55
|
-
selects = []
|
|
56
|
-
|
|
57
|
-
let codes = []
|
|
58
|
-
let res = []
|
|
59
|
-
|
|
60
|
-
if (options.value) {
|
|
61
|
-
codes = options.value.map(item => item.code)
|
|
62
|
-
res = JSON.parse(JSON.stringify(options.value))
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
if (!selects || selects.length<1)
|
|
66
|
-
return res
|
|
67
|
-
|
|
68
|
-
for(var i=0;i<selects.length;i++){
|
|
69
|
-
if (codes && codes.length>0 && !codes.includes(selects[i])) {
|
|
70
|
-
res.push({
|
|
71
|
-
code: selects[i],
|
|
72
|
-
title: selects[i]
|
|
73
|
-
})
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
return res
|
|
77
|
-
})
|
|
78
|
-
onMounted(async () => {
|
|
79
|
-
await query()
|
|
80
|
-
})
|
|
81
|
-
|
|
82
|
-
const query = async () => {
|
|
83
|
-
let params = {
|
|
84
|
-
id: props.id,
|
|
85
|
-
}
|
|
86
|
-
const res = await util.dictionary_dict(params)
|
|
87
|
-
console.log(res.data)
|
|
88
|
-
|
|
89
|
-
if (!res.data.parseValue) {
|
|
90
|
-
options.value = []
|
|
91
|
-
return
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
options.value = res.data.parseValue
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
watch(()=>props.modelValue,(o,n)=>{
|
|
98
|
-
if(!props.modelValue)
|
|
99
|
-
modelValue.value = []
|
|
100
|
-
},{immediate:true})
|
|
101
|
-
</script>
|
|
102
|
-
|
|
103
|
-
<style lang="scss" scoped>
|
|
104
|
-
:deep(.label) {
|
|
105
|
-
color: #000 !important;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
:deep(.van-field__control:disabled) {
|
|
109
|
-
color: #000 !important;
|
|
110
|
-
cursor: not-allowed;
|
|
111
|
-
opacity: 1;
|
|
112
|
-
-webkit-text-fill-color: #000;
|
|
113
|
-
}
|
|
1
|
+
<template>
|
|
2
|
+
<van-field v-if="!isGone" :label="props.label" :required="isRequired" :rules="props.rules">
|
|
3
|
+
<template #input>
|
|
4
|
+
<van-checkbox-group v-model="modelValue" direction="vertical" :disabled="isDisabled">
|
|
5
|
+
<van-checkbox style="padding:5px 0;" v-for="(option, i) in totalOptions" :key="i" :name="option.code"
|
|
6
|
+
shape="square">{{ option.title }}</van-checkbox>
|
|
7
|
+
</van-checkbox-group>
|
|
8
|
+
</template>
|
|
9
|
+
</van-field>
|
|
10
|
+
</template>
|
|
11
|
+
|
|
12
|
+
<script setup>
|
|
13
|
+
import { ref, computed, onMounted, defineProps, defineEmits, watch } from "vue"
|
|
14
|
+
import util from "../util"
|
|
15
|
+
import { useVModel } from '@vueuse/core'
|
|
16
|
+
|
|
17
|
+
const props = defineProps({
|
|
18
|
+
id: {
|
|
19
|
+
type:String,
|
|
20
|
+
default: ''
|
|
21
|
+
},
|
|
22
|
+
modelValue: {
|
|
23
|
+
type: Array,
|
|
24
|
+
default:[]
|
|
25
|
+
},
|
|
26
|
+
label: {
|
|
27
|
+
type:String,
|
|
28
|
+
default: ''
|
|
29
|
+
},
|
|
30
|
+
readonly: {
|
|
31
|
+
type: Boolean,
|
|
32
|
+
default: true
|
|
33
|
+
},
|
|
34
|
+
required: {
|
|
35
|
+
type: Boolean,
|
|
36
|
+
default: false
|
|
37
|
+
},
|
|
38
|
+
auth: {
|
|
39
|
+
type: String,
|
|
40
|
+
default: ''
|
|
41
|
+
},
|
|
42
|
+
rules: {
|
|
43
|
+
type: Array,
|
|
44
|
+
default: null
|
|
45
|
+
}
|
|
46
|
+
})
|
|
47
|
+
const emit = defineEmits(['update:modelValue'])
|
|
48
|
+
const modelValue = useVModel(props, 'modelValue', emit)
|
|
49
|
+
const { isRequired, isReadonly, isGone, isDisabled } = util.props2auth(props)
|
|
50
|
+
const options = ref([])
|
|
51
|
+
// 将初始化数据与配置项合并
|
|
52
|
+
const totalOptions = computed(() => {
|
|
53
|
+
let selects = modelValue.value
|
|
54
|
+
if (!selects || selects.length<1)
|
|
55
|
+
selects = []
|
|
56
|
+
|
|
57
|
+
let codes = []
|
|
58
|
+
let res = []
|
|
59
|
+
|
|
60
|
+
if (options.value) {
|
|
61
|
+
codes = options.value.map(item => item.code)
|
|
62
|
+
res = JSON.parse(JSON.stringify(options.value))
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
if (!selects || selects.length<1)
|
|
66
|
+
return res
|
|
67
|
+
|
|
68
|
+
for(var i=0;i<selects.length;i++){
|
|
69
|
+
if (codes && codes.length>0 && !codes.includes(selects[i])) {
|
|
70
|
+
res.push({
|
|
71
|
+
code: selects[i],
|
|
72
|
+
title: selects[i]
|
|
73
|
+
})
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
return res
|
|
77
|
+
})
|
|
78
|
+
onMounted(async () => {
|
|
79
|
+
await query()
|
|
80
|
+
})
|
|
81
|
+
|
|
82
|
+
const query = async () => {
|
|
83
|
+
let params = {
|
|
84
|
+
id: props.id,
|
|
85
|
+
}
|
|
86
|
+
const res = await util.dictionary_dict(params)
|
|
87
|
+
console.log(res.data)
|
|
88
|
+
|
|
89
|
+
if (!res.data.parseValue) {
|
|
90
|
+
options.value = []
|
|
91
|
+
return
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
options.value = res.data.parseValue
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
watch(()=>props.modelValue,(o,n)=>{
|
|
98
|
+
if(!props.modelValue)
|
|
99
|
+
modelValue.value = []
|
|
100
|
+
},{immediate:true})
|
|
101
|
+
</script>
|
|
102
|
+
|
|
103
|
+
<style lang="scss" scoped>
|
|
104
|
+
:deep(.label) {
|
|
105
|
+
color: #000 !important;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
:deep(.van-field__control:disabled) {
|
|
109
|
+
color: #000 !important;
|
|
110
|
+
cursor: not-allowed;
|
|
111
|
+
opacity: 1;
|
|
112
|
+
-webkit-text-fill-color: #000;
|
|
113
|
+
}
|
|
114
114
|
</style>
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<van-dropdown-item :title="formatTitle">
|
|
3
|
+
<DatetimePicker
|
|
4
|
+
v-model="modelValue"
|
|
5
|
+
:placeholder="props.placeholder"
|
|
6
|
+
:auth="props.auth" />
|
|
7
|
+
</van-dropdown-item>
|
|
8
|
+
</template>
|
|
9
|
+
<script setup>
|
|
10
|
+
import { reactive, onMounted, watch,computed } from "vue";
|
|
11
|
+
import DatetimePicker from "./DatetimePicker.vue";
|
|
12
|
+
import { useVModel } from '@vueuse/core'
|
|
13
|
+
|
|
14
|
+
const props = defineProps({
|
|
15
|
+
modelValue: {
|
|
16
|
+
type: String,
|
|
17
|
+
default: ''
|
|
18
|
+
},
|
|
19
|
+
label: {
|
|
20
|
+
type: String,
|
|
21
|
+
default: ''
|
|
22
|
+
},
|
|
23
|
+
readonly: {
|
|
24
|
+
type: Boolean,
|
|
25
|
+
default: false
|
|
26
|
+
},
|
|
27
|
+
disabled: {
|
|
28
|
+
type: Boolean,
|
|
29
|
+
default: false
|
|
30
|
+
},
|
|
31
|
+
required: {
|
|
32
|
+
type: Boolean,
|
|
33
|
+
default: false
|
|
34
|
+
},
|
|
35
|
+
placeholder: {
|
|
36
|
+
type: String,
|
|
37
|
+
default: ''
|
|
38
|
+
},
|
|
39
|
+
auth: {
|
|
40
|
+
type: String,
|
|
41
|
+
default: ''
|
|
42
|
+
},
|
|
43
|
+
rules: {
|
|
44
|
+
type: Array,
|
|
45
|
+
default: null
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
// 定义emit
|
|
50
|
+
const emit = defineEmits(["update:modelValue"]);
|
|
51
|
+
const modelValue = useVModel(props, 'modelValue', emit)
|
|
52
|
+
|
|
53
|
+
const formatTitle=computed(()=>{
|
|
54
|
+
return modelValue.value ? modelValue.value : props.label
|
|
55
|
+
})
|
|
56
|
+
|
|
57
|
+
//首页加载
|
|
58
|
+
onMounted(() => {
|
|
59
|
+
})
|
|
60
|
+
</script>
|
|
61
|
+
|
|
62
|
+
<style scoped></style>
|
|
@@ -1,125 +1,125 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<van-field v-if="!isGone" v-model="formatTime" name="datetimePicker" :label="props.label"
|
|
3
|
-
:disabled="isDisabled"
|
|
4
|
-
:readonly="isReadonly"
|
|
5
|
-
readonly
|
|
6
|
-
clearable
|
|
7
|
-
:placeholder="props.placeholder" :required="isRequired" :rules="props.rules"
|
|
8
|
-
:right-icon="rightIcon"
|
|
9
|
-
@click-right-icon="onToggleShow">
|
|
10
|
-
</van-field>
|
|
11
|
-
|
|
12
|
-
<!-- 弹出层 -->
|
|
13
|
-
<DatetimePop v-model:isShow="data.isShow" v-model="modelValue" :before="props.before" :defaultnow="props.defaultnow"
|
|
14
|
-
:columnsType="props.columnsType" />
|
|
15
|
-
</template>
|
|
16
|
-
|
|
17
|
-
<script setup>
|
|
18
|
-
import { ref, reactive, watch, getCurrentInstance, computed } from "vue"
|
|
19
|
-
import DatetimePop from './DatetimePop.vue'
|
|
20
|
-
import util from '
|
|
21
|
-
import { useVModel } from "@vueuse/core"
|
|
22
|
-
|
|
23
|
-
const props = defineProps({
|
|
24
|
-
modelValue: {
|
|
25
|
-
type: String,
|
|
26
|
-
default: ''
|
|
27
|
-
},
|
|
28
|
-
label: {
|
|
29
|
-
type: String,
|
|
30
|
-
default: ''
|
|
31
|
-
},
|
|
32
|
-
readonly: {
|
|
33
|
-
type: Boolean,
|
|
34
|
-
default: false
|
|
35
|
-
},
|
|
36
|
-
disabled:{
|
|
37
|
-
type:Boolean,
|
|
38
|
-
default:false
|
|
39
|
-
},
|
|
40
|
-
defaultnow: {
|
|
41
|
-
type: Boolean,
|
|
42
|
-
default: false
|
|
43
|
-
},
|
|
44
|
-
before: {
|
|
45
|
-
type: Boolean,
|
|
46
|
-
default: false
|
|
47
|
-
},
|
|
48
|
-
required: {
|
|
49
|
-
type: Boolean,
|
|
50
|
-
default: false
|
|
51
|
-
},
|
|
52
|
-
columnsType: {
|
|
53
|
-
type: Array,
|
|
54
|
-
default: ['year', 'month', 'day', 'hour', 'minute', 'second']
|
|
55
|
-
},
|
|
56
|
-
placeholder: {
|
|
57
|
-
type: String,
|
|
58
|
-
default: ''
|
|
59
|
-
},
|
|
60
|
-
auth: {
|
|
61
|
-
type: String,
|
|
62
|
-
default: ''
|
|
63
|
-
},
|
|
64
|
-
rules: {
|
|
65
|
-
type: Array,
|
|
66
|
-
default: null
|
|
67
|
-
}
|
|
68
|
-
})
|
|
69
|
-
const data = reactive({
|
|
70
|
-
isShow: false, //是否显示弹出层
|
|
71
|
-
})
|
|
72
|
-
const { isRequired, isReadonly, isGone, isDisabled } = util.props2auth(props)
|
|
73
|
-
//定义要向父组件传递的事件
|
|
74
|
-
const emit = defineEmits(["update:modelValue"])
|
|
75
|
-
const modelValue = useVModel(props, "modelValue", emit)
|
|
76
|
-
|
|
77
|
-
const formatTime = computed({
|
|
78
|
-
get() {
|
|
79
|
-
let res = props.modelValue
|
|
80
|
-
|
|
81
|
-
// let week_day = util.date2week_day(time)
|
|
82
|
-
// res = time+'/'+week_day
|
|
83
|
-
|
|
84
|
-
return res
|
|
85
|
-
},
|
|
86
|
-
set() {
|
|
87
|
-
modelValue.value = ''
|
|
88
|
-
}
|
|
89
|
-
})
|
|
90
|
-
|
|
91
|
-
const rightIcon = computed(()=>{
|
|
92
|
-
if(isReadonly.value || isDisabled.value)
|
|
93
|
-
return ''
|
|
94
|
-
|
|
95
|
-
return 'arrow'
|
|
96
|
-
})
|
|
97
|
-
|
|
98
|
-
// 默认当前时间
|
|
99
|
-
watch(
|
|
100
|
-
() => props.modelValue,
|
|
101
|
-
(n, o) => {
|
|
102
|
-
//不需要默认时间时,直接返回
|
|
103
|
-
if (!props.defaultnow)
|
|
104
|
-
return
|
|
105
|
-
|
|
106
|
-
//有值是,直接返回
|
|
107
|
-
if (n) {
|
|
108
|
-
return
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
// 没有值时,默认设置为当前时间
|
|
112
|
-
modelValue.value = util.date2yyyyMMddhhmmss(new Date())
|
|
113
|
-
},
|
|
114
|
-
{
|
|
115
|
-
immediate: true//立即监听--进入就会执行一次 监听显影状态
|
|
116
|
-
}
|
|
117
|
-
)
|
|
118
|
-
|
|
119
|
-
function onToggleShow() {
|
|
120
|
-
if (isReadonly.value)
|
|
121
|
-
return
|
|
122
|
-
|
|
123
|
-
data.isShow = true
|
|
124
|
-
}
|
|
1
|
+
<template>
|
|
2
|
+
<van-field v-if="!isGone" v-model="formatTime" name="datetimePicker" :label="props.label"
|
|
3
|
+
:disabled="isDisabled"
|
|
4
|
+
:readonly="isReadonly"
|
|
5
|
+
readonly
|
|
6
|
+
clearable
|
|
7
|
+
:placeholder="props.placeholder" :required="isRequired" :rules="props.rules"
|
|
8
|
+
:right-icon="rightIcon"
|
|
9
|
+
@click-right-icon="onToggleShow">
|
|
10
|
+
</van-field>
|
|
11
|
+
|
|
12
|
+
<!-- 弹出层 -->
|
|
13
|
+
<DatetimePop v-model:isShow="data.isShow" v-model="modelValue" :before="props.before" :defaultnow="props.defaultnow"
|
|
14
|
+
:columnsType="props.columnsType" />
|
|
15
|
+
</template>
|
|
16
|
+
|
|
17
|
+
<script setup>
|
|
18
|
+
import { ref, reactive, watch, getCurrentInstance, computed } from "vue"
|
|
19
|
+
import DatetimePop from './widget/DatetimePop.vue'
|
|
20
|
+
import util from '../util'
|
|
21
|
+
import { useVModel } from "@vueuse/core"
|
|
22
|
+
|
|
23
|
+
const props = defineProps({
|
|
24
|
+
modelValue: {
|
|
25
|
+
type: String,
|
|
26
|
+
default: ''
|
|
27
|
+
},
|
|
28
|
+
label: {
|
|
29
|
+
type: String,
|
|
30
|
+
default: ''
|
|
31
|
+
},
|
|
32
|
+
readonly: {
|
|
33
|
+
type: Boolean,
|
|
34
|
+
default: false
|
|
35
|
+
},
|
|
36
|
+
disabled:{
|
|
37
|
+
type:Boolean,
|
|
38
|
+
default:false
|
|
39
|
+
},
|
|
40
|
+
defaultnow: {
|
|
41
|
+
type: Boolean,
|
|
42
|
+
default: false
|
|
43
|
+
},
|
|
44
|
+
before: {
|
|
45
|
+
type: Boolean,
|
|
46
|
+
default: false
|
|
47
|
+
},
|
|
48
|
+
required: {
|
|
49
|
+
type: Boolean,
|
|
50
|
+
default: false
|
|
51
|
+
},
|
|
52
|
+
columnsType: {
|
|
53
|
+
type: Array,
|
|
54
|
+
default: ['year', 'month', 'day', 'hour', 'minute', 'second']
|
|
55
|
+
},
|
|
56
|
+
placeholder: {
|
|
57
|
+
type: String,
|
|
58
|
+
default: ''
|
|
59
|
+
},
|
|
60
|
+
auth: {
|
|
61
|
+
type: String,
|
|
62
|
+
default: ''
|
|
63
|
+
},
|
|
64
|
+
rules: {
|
|
65
|
+
type: Array,
|
|
66
|
+
default: null
|
|
67
|
+
}
|
|
68
|
+
})
|
|
69
|
+
const data = reactive({
|
|
70
|
+
isShow: false, //是否显示弹出层
|
|
71
|
+
})
|
|
72
|
+
const { isRequired, isReadonly, isGone, isDisabled } = util.props2auth(props)
|
|
73
|
+
//定义要向父组件传递的事件
|
|
74
|
+
const emit = defineEmits(["update:modelValue"])
|
|
75
|
+
const modelValue = useVModel(props, "modelValue", emit)
|
|
76
|
+
|
|
77
|
+
const formatTime = computed({
|
|
78
|
+
get() {
|
|
79
|
+
let res = props.modelValue
|
|
80
|
+
|
|
81
|
+
// let week_day = util.date2week_day(time)
|
|
82
|
+
// res = time+'/'+week_day
|
|
83
|
+
|
|
84
|
+
return res
|
|
85
|
+
},
|
|
86
|
+
set() {
|
|
87
|
+
modelValue.value = ''
|
|
88
|
+
}
|
|
89
|
+
})
|
|
90
|
+
|
|
91
|
+
const rightIcon = computed(()=>{
|
|
92
|
+
if(isReadonly.value || isDisabled.value)
|
|
93
|
+
return ''
|
|
94
|
+
|
|
95
|
+
return 'arrow'
|
|
96
|
+
})
|
|
97
|
+
|
|
98
|
+
// 默认当前时间
|
|
99
|
+
watch(
|
|
100
|
+
() => props.modelValue,
|
|
101
|
+
(n, o) => {
|
|
102
|
+
//不需要默认时间时,直接返回
|
|
103
|
+
if (!props.defaultnow)
|
|
104
|
+
return
|
|
105
|
+
|
|
106
|
+
//有值是,直接返回
|
|
107
|
+
if (n) {
|
|
108
|
+
return
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
// 没有值时,默认设置为当前时间
|
|
112
|
+
modelValue.value = util.date2yyyyMMddhhmmss(new Date())
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
immediate: true//立即监听--进入就会执行一次 监听显影状态
|
|
116
|
+
}
|
|
117
|
+
)
|
|
118
|
+
|
|
119
|
+
function onToggleShow() {
|
|
120
|
+
if (isReadonly.value)
|
|
121
|
+
return
|
|
122
|
+
|
|
123
|
+
data.isShow = true
|
|
124
|
+
}
|
|
125
125
|
</script>
|
|
@@ -1,57 +1,57 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<van-dropdown-item v-model="modelValue" :options="totalOptions" />
|
|
3
|
-
</template>
|
|
4
|
-
<script setup>
|
|
5
|
-
import { reactive, onMounted, computed } from "vue";
|
|
6
|
-
import util from "../util"
|
|
7
|
-
import { useVModel } from '@vueuse/core'
|
|
8
|
-
|
|
9
|
-
const props = defineProps({
|
|
10
|
-
year:{
|
|
11
|
-
type:Number,
|
|
12
|
-
default: 0
|
|
13
|
-
},
|
|
14
|
-
month:{
|
|
15
|
-
type:Number,
|
|
16
|
-
default: 0
|
|
17
|
-
},
|
|
18
|
-
modelValue: {
|
|
19
|
-
type: Number,
|
|
20
|
-
default: 0,
|
|
21
|
-
},
|
|
22
|
-
label: {
|
|
23
|
-
type: String,
|
|
24
|
-
default: "选择日",
|
|
25
|
-
},
|
|
26
|
-
placeholder: {
|
|
27
|
-
type: String,
|
|
28
|
-
default: "请选择日",
|
|
29
|
-
},
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
const totalOptions = computed(() => {
|
|
33
|
-
if (!props.year) return [];
|
|
34
|
-
|
|
35
|
-
const year = props.year
|
|
36
|
-
const month = props.month
|
|
37
|
-
const days = new Date(year, month, 0).getDate(); // 获取当月实际天数
|
|
38
|
-
|
|
39
|
-
let res = Array.from({length: days}, (_, i) => ({
|
|
40
|
-
text: `${i+1}日`,
|
|
41
|
-
value: i+1
|
|
42
|
-
}));
|
|
43
|
-
return [{
|
|
44
|
-
text: '日',
|
|
45
|
-
value: 0
|
|
46
|
-
}, ...res]
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
// 定义emit
|
|
50
|
-
const emit = defineEmits(["update:modelValue"]);
|
|
51
|
-
const modelValue = useVModel(props, 'modelValue', emit)
|
|
52
|
-
//首页加载
|
|
53
|
-
onMounted(() => {
|
|
54
|
-
})
|
|
55
|
-
</script>
|
|
56
|
-
|
|
1
|
+
<template>
|
|
2
|
+
<van-dropdown-item v-model="modelValue" :options="totalOptions" />
|
|
3
|
+
</template>
|
|
4
|
+
<script setup>
|
|
5
|
+
import { reactive, onMounted, computed } from "vue";
|
|
6
|
+
import util from "../util"
|
|
7
|
+
import { useVModel } from '@vueuse/core'
|
|
8
|
+
|
|
9
|
+
const props = defineProps({
|
|
10
|
+
year:{
|
|
11
|
+
type:Number,
|
|
12
|
+
default: 0
|
|
13
|
+
},
|
|
14
|
+
month:{
|
|
15
|
+
type:Number,
|
|
16
|
+
default: 0
|
|
17
|
+
},
|
|
18
|
+
modelValue: {
|
|
19
|
+
type: Number,
|
|
20
|
+
default: 0,
|
|
21
|
+
},
|
|
22
|
+
label: {
|
|
23
|
+
type: String,
|
|
24
|
+
default: "选择日",
|
|
25
|
+
},
|
|
26
|
+
placeholder: {
|
|
27
|
+
type: String,
|
|
28
|
+
default: "请选择日",
|
|
29
|
+
},
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
const totalOptions = computed(() => {
|
|
33
|
+
if (!props.year) return [];
|
|
34
|
+
|
|
35
|
+
const year = props.year
|
|
36
|
+
const month = props.month
|
|
37
|
+
const days = new Date(year, month, 0).getDate(); // 获取当月实际天数
|
|
38
|
+
|
|
39
|
+
let res = Array.from({length: days}, (_, i) => ({
|
|
40
|
+
text: `${i+1}日`,
|
|
41
|
+
value: i+1
|
|
42
|
+
}));
|
|
43
|
+
return [{
|
|
44
|
+
text: '日',
|
|
45
|
+
value: 0
|
|
46
|
+
}, ...res]
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
// 定义emit
|
|
50
|
+
const emit = defineEmits(["update:modelValue"]);
|
|
51
|
+
const modelValue = useVModel(props, 'modelValue', emit)
|
|
52
|
+
//首页加载
|
|
53
|
+
onMounted(() => {
|
|
54
|
+
})
|
|
55
|
+
</script>
|
|
56
|
+
|
|
57
57
|
<style scoped></style>
|