widget.qw 0.0.1
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/README.md +73 -0
- package/build/favicon.ico +0 -0
- package/build/style.css +763 -0
- package/build/widget.qw.es.js +20653 -0
- package/build/widget.qw.umd.js +20660 -0
- package/index.html +17 -0
- package/package.json +47 -0
- package/public/favicon.ico +0 -0
- package/src/App.vue +26 -0
- package/src/api/index.js +126 -0
- package/src/assets/avatar.png +0 -0
- package/src/assets/banner_handle.png +0 -0
- package/src/assets/bg_blue.png +0 -0
- package/src/assets/bg_white.png +0 -0
- package/src/assets/down.png +0 -0
- package/src/assets/home.jpg +0 -0
- package/src/assets/icon_box.png +0 -0
- package/src/assets/icon_dot.png +0 -0
- package/src/assets/icon_draw.png +0 -0
- package/src/assets/icon_file.png +0 -0
- package/src/assets/icon_fold.png +0 -0
- package/src/assets/icon_shield.png +0 -0
- package/src/assets/logo.png +0 -0
- package/src/components/AuditBar.vue +341 -0
- package/src/components/BillCard.vue +156 -0
- package/src/components/CheckGroup.vue +114 -0
- package/src/components/DatetimePicker/DatetimePop.vue +343 -0
- package/src/components/DatetimePicker/index.vue +113 -0
- package/src/components/DayDropdown.vue +57 -0
- package/src/components/FilePicker.vue +114 -0
- package/src/components/Input.vue +72 -0
- package/src/components/MonthDropdown.vue +52 -0
- package/src/components/MultiPicker.vue +124 -0
- package/src/components/ProjectDropdown.vue +62 -0
- package/src/components/ProjectPicker.vue +111 -0
- package/src/components/SecretNotify.js +6 -0
- package/src/components/Sheet.vue +93 -0
- package/src/components/SinglePicker.vue +103 -0
- package/src/components/SingleUserSelector.vue +425 -0
- package/src/components/Switch.vue +65 -0
- package/src/components/TreePicker.vue +113 -0
- package/src/components/UserPicker.vue +107 -0
- package/src/components/UserProfile.vue +128 -0
- package/src/components/UsersPicker.vue +118 -0
- package/src/components/YearDropdown.vue +60 -0
- package/src/components/data_selector.vue +281 -0
- package/src/components/image_picker.vue +115 -0
- package/src/components/images_picker.vue +140 -0
- package/src/components/index.js +157 -0
- package/src/components/mult_list_selector.vue +156 -0
- package/src/components/product_selector.vue +186 -0
- package/src/components/subdepartment_selector.vue +481 -0
- package/src/components/user_selector.vue +639 -0
- package/src/components/widget/DataPop.vue +96 -0
- package/src/components/widget/TreePop.vue +89 -0
- package/src/components/widget/UserPop.vue +347 -0
- package/src/env.d.ts +8 -0
- package/src/main.js +111 -0
- package/src/router/index.ts +165 -0
- package/src/util/array_util.js +32 -0
- package/src/util/auth_util.js +73 -0
- package/src/util/bool_util.js +6 -0
- package/src/util/bus.js +2 -0
- package/src/util/cache_util.js +19 -0
- package/src/util/errer_code.js +7 -0
- package/src/util/eval_util.js +20 -0
- package/src/util/icon_util.js +37 -0
- package/src/util/image_util.js +28 -0
- package/src/util/index.js +56 -0
- package/src/util/num_util.js +71 -0
- package/src/util/obj_util.js +29 -0
- package/src/util/request.js +74 -0
- package/src/util/request_json.js +72 -0
- package/src/util/request_json_mute.js +66 -0
- package/src/util/request_upload.js +79 -0
- package/src/util/route_util.js +32 -0
- package/src/util/str_util.js +144 -0
- package/src/util/time_util.js +407 -0
- package/src/util/toast_util.js +25 -0
- package/src/util/tree_util.js +120 -0
- package/src/util/validate.js +183 -0
- package/src/util/vue_filter.js +223 -0
- package/src/views/auditbar/index.vue +66 -0
- package/src/views/billcard/index.vue +46 -0
- package/src/views/checkgroup/index.vue +36 -0
- package/src/views/dataSelector/index.vue +49 -0
- package/src/views/datetimepicker/index.vue +35 -0
- package/src/views/daydropdown/index.vue +31 -0
- package/src/views/filepicker/index.vue +32 -0
- package/src/views/home/index.vue +64 -0
- package/src/views/imagepicker/index.vue +32 -0
- package/src/views/imagespicker/index.vue +32 -0
- package/src/views/input/index.vue +35 -0
- package/src/views/monthdropdown/index.vue +31 -0
- package/src/views/multListSelector/index.vue +61 -0
- package/src/views/multipicker/index.vue +37 -0
- package/src/views/productSelector/index.vue +35 -0
- package/src/views/projectdropdown/index.vue +31 -0
- package/src/views/projectpicker/index.vue +42 -0
- package/src/views/secretnotify/index.vue +28 -0
- package/src/views/sheet/index.vue +46 -0
- package/src/views/singlepicker/index.vue +36 -0
- package/src/views/subdepartmentSelector/index.vue +41 -0
- package/src/views/switch/index.vue +35 -0
- package/src/views/treepicker/index.vue +42 -0
- package/src/views/userSelector/index.vue +54 -0
- package/src/views/userSelectorNew/index.vue +45 -0
- package/src/views/userpicker/index.vue +43 -0
- package/src/views/userprofile/index.vue +30 -0
- package/src/views/userspicker/index.vue +43 -0
- package/src/views/yeardropdown/index.vue +32 -0
- package/src/vm/index.js +6 -0
- package/tsconfig.json +19 -0
- package/tsconfig.node.json +8 -0
- package/vite.config.ts +73 -0
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<van-field v-if="!isGone"
|
|
3
|
+
v-model="props.modelValue" name="datetimePicker" :label="props.label"
|
|
4
|
+
:placeholder="props.placeholder" readonly :required="isRequired" :rules="props.rules"
|
|
5
|
+
:is-link="isReadonly ? false : true"
|
|
6
|
+
@click="onToggleShow">
|
|
7
|
+
<template #input>
|
|
8
|
+
{{ formatTime(props.modelValue) }}
|
|
9
|
+
</template>
|
|
10
|
+
</van-field>
|
|
11
|
+
|
|
12
|
+
<!-- 弹出层 -->
|
|
13
|
+
<DatetimePop v-model:isShow="data.isShow"
|
|
14
|
+
v-model="modelValue"
|
|
15
|
+
:before="props.before"
|
|
16
|
+
:defaultnow="props.defaultnow"
|
|
17
|
+
:columnsType="props.columnsType" />
|
|
18
|
+
</template>
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
<script setup>
|
|
22
|
+
import { ref,reactive, watch, getCurrentInstance, computed } from "vue"
|
|
23
|
+
import DatetimePop from './DatetimePop.vue'
|
|
24
|
+
import util from '../../util'
|
|
25
|
+
import { useVModel } from "@vueuse/core"
|
|
26
|
+
|
|
27
|
+
const props = defineProps({
|
|
28
|
+
modelValue:{
|
|
29
|
+
type: String,
|
|
30
|
+
default: ''
|
|
31
|
+
},
|
|
32
|
+
label: {
|
|
33
|
+
type:String,
|
|
34
|
+
default: ''
|
|
35
|
+
},
|
|
36
|
+
readonly: {
|
|
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=(time)=>{
|
|
78
|
+
let res = time
|
|
79
|
+
|
|
80
|
+
// let week_day = util.date2week_day(time)
|
|
81
|
+
// res = time+'/'+week_day
|
|
82
|
+
|
|
83
|
+
return res
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
// 默认当前时间
|
|
87
|
+
watch(
|
|
88
|
+
() => props.modelValue,
|
|
89
|
+
(n, o) => {
|
|
90
|
+
//不需要默认时间时,直接返回
|
|
91
|
+
if (!props.defaultnow)
|
|
92
|
+
return
|
|
93
|
+
|
|
94
|
+
//有值是,直接返回
|
|
95
|
+
if (n) {
|
|
96
|
+
return
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
// 没有值时,默认设置为当前时间
|
|
100
|
+
modelValue.value = util.date2yyyyMMddhhmmss(new Date())
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
immediate: true//立即监听--进入就会执行一次 监听显影状态
|
|
104
|
+
}
|
|
105
|
+
)
|
|
106
|
+
|
|
107
|
+
function onToggleShow() {
|
|
108
|
+
if (isReadonly.value)
|
|
109
|
+
return
|
|
110
|
+
|
|
111
|
+
data.isShow = true
|
|
112
|
+
}
|
|
113
|
+
</script>
|
|
@@ -0,0 +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
|
+
|
|
57
|
+
<style scoped></style>
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<van-field v-if="!isGone" name="image" :label="props.label" :required="isRequired" :rules="props.rules"
|
|
3
|
+
label-class="label" :placeholder="props.placeholder">
|
|
4
|
+
<template #input>
|
|
5
|
+
<div class="image-box">
|
|
6
|
+
<van-uploader v-model="files" :max-count="1" :afterRead="onAfterRead" :disabled="isDisabled"
|
|
7
|
+
:accept="props.accept" upload-icon="plus" :deletable="!isDisabled" :before-delete="onBeforeDelete"
|
|
8
|
+
@click-preview="onPreview" />
|
|
9
|
+
</div>
|
|
10
|
+
</template>
|
|
11
|
+
</van-field>
|
|
12
|
+
</template>
|
|
13
|
+
|
|
14
|
+
<script setup>
|
|
15
|
+
import { ref, computed, onMounted, defineProps, defineEmits, watch } from "vue"
|
|
16
|
+
import util from '../util'
|
|
17
|
+
import { useVModel } from "@vueuse/core"
|
|
18
|
+
|
|
19
|
+
const props = defineProps({
|
|
20
|
+
modelValue: {
|
|
21
|
+
type: String,
|
|
22
|
+
default: ''
|
|
23
|
+
},
|
|
24
|
+
label: {
|
|
25
|
+
type: String,
|
|
26
|
+
default: ''
|
|
27
|
+
},
|
|
28
|
+
required: {
|
|
29
|
+
type: Boolean,
|
|
30
|
+
default: false
|
|
31
|
+
},
|
|
32
|
+
readonly: {
|
|
33
|
+
type: Boolean,
|
|
34
|
+
default: false
|
|
35
|
+
},
|
|
36
|
+
placeholder: {
|
|
37
|
+
type: String,
|
|
38
|
+
default: ''
|
|
39
|
+
},
|
|
40
|
+
rules: {
|
|
41
|
+
type: Array,
|
|
42
|
+
default: () => []
|
|
43
|
+
},
|
|
44
|
+
accept: {
|
|
45
|
+
type: String,
|
|
46
|
+
default: ""
|
|
47
|
+
},
|
|
48
|
+
auth: {
|
|
49
|
+
type: String,
|
|
50
|
+
default: ''
|
|
51
|
+
}
|
|
52
|
+
})
|
|
53
|
+
|
|
54
|
+
const emit = defineEmits(['update:modelValue'])
|
|
55
|
+
const modelValue = useVModel(props, 'modelValue', emit)
|
|
56
|
+
const { isRequired, isReadonly, isGone, isDisabled } = util.props2auth(props)
|
|
57
|
+
|
|
58
|
+
const files = ref([])
|
|
59
|
+
|
|
60
|
+
onMounted(() => {
|
|
61
|
+
|
|
62
|
+
})
|
|
63
|
+
|
|
64
|
+
const onAfterRead = async (file) => {
|
|
65
|
+
console.log(file)
|
|
66
|
+
let params = {
|
|
67
|
+
file: file.file
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
return util.file_upload(params).then(res => {
|
|
71
|
+
modelValue.value = res.data.url
|
|
72
|
+
return Promise.resolve(file)
|
|
73
|
+
})
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
const onBeforeDelete = (e) => {
|
|
77
|
+
modelValue.value = ''
|
|
78
|
+
return Promise.resolve(e)
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
const onPreview = (e) => {
|
|
82
|
+
console.log('onPreview', e)
|
|
83
|
+
window.open(e.url, "_blank");
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
watch(() => props.modelValue,
|
|
87
|
+
(newVal, oldVal) => {
|
|
88
|
+
if (!props.modelValue) {
|
|
89
|
+
files.value = []
|
|
90
|
+
return
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
files.value = [{
|
|
94
|
+
url: props.modelValue
|
|
95
|
+
}]
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
immediate: true
|
|
99
|
+
}
|
|
100
|
+
)
|
|
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
|
+
</style>
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<van-field :label="props.label" v-model="modelValue" v-if="!isGone" :disabled="isDisabled" :required="isRequired"
|
|
3
|
+
:placeholder="props.placeholder" :type="props.type" :rows="props.rows" :autosize="props.autosize" :rules="props.rules"/>
|
|
4
|
+
</template>
|
|
5
|
+
|
|
6
|
+
<script setup>
|
|
7
|
+
import { ref, computed, onMounted, defineProps, defineEmits, watch } from "vue"
|
|
8
|
+
import { useVModel } from '@vueuse/core'
|
|
9
|
+
import util from '../util'
|
|
10
|
+
|
|
11
|
+
const props = defineProps({
|
|
12
|
+
modelValue: {
|
|
13
|
+
type:String,
|
|
14
|
+
default:null
|
|
15
|
+
},
|
|
16
|
+
label: {
|
|
17
|
+
type:String,
|
|
18
|
+
default: ''
|
|
19
|
+
},
|
|
20
|
+
type: {
|
|
21
|
+
type: String,
|
|
22
|
+
default: 'text'
|
|
23
|
+
},
|
|
24
|
+
rows:{
|
|
25
|
+
type:Number,
|
|
26
|
+
default:1
|
|
27
|
+
},
|
|
28
|
+
autosize:{
|
|
29
|
+
type:Boolean,
|
|
30
|
+
default:false
|
|
31
|
+
},
|
|
32
|
+
placeholder: {
|
|
33
|
+
type: String,
|
|
34
|
+
default: ''
|
|
35
|
+
},
|
|
36
|
+
readonly: {
|
|
37
|
+
type: Boolean,
|
|
38
|
+
default: true
|
|
39
|
+
},
|
|
40
|
+
required: {
|
|
41
|
+
type: Boolean,
|
|
42
|
+
default: false
|
|
43
|
+
},
|
|
44
|
+
auth: {
|
|
45
|
+
type: String,
|
|
46
|
+
default: ''
|
|
47
|
+
},
|
|
48
|
+
rules:{
|
|
49
|
+
type: Array,
|
|
50
|
+
default:null
|
|
51
|
+
}
|
|
52
|
+
})
|
|
53
|
+
const emit = defineEmits(['update:modelValue'])
|
|
54
|
+
const modelValue = useVModel(props, 'modelValue', emit)
|
|
55
|
+
const {isRequired, isReadonly, isGone, isDisabled} = util.props2auth(props)
|
|
56
|
+
|
|
57
|
+
onMounted(() => {
|
|
58
|
+
})
|
|
59
|
+
</script>
|
|
60
|
+
|
|
61
|
+
<style lang="scss" scoped>
|
|
62
|
+
:deep(.label) {
|
|
63
|
+
color: #000 !important;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
:deep(.van-field__control:disabled) {
|
|
67
|
+
color: #000 !important;
|
|
68
|
+
cursor: not-allowed;
|
|
69
|
+
opacity: 1;
|
|
70
|
+
-webkit-text-fill-color: #000;
|
|
71
|
+
}
|
|
72
|
+
</style>
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<van-dropdown-item v-model="modelValue" :options="data.monthOptions" />
|
|
3
|
+
</template>
|
|
4
|
+
<script setup>
|
|
5
|
+
import { reactive, onMounted, watch } from "vue";
|
|
6
|
+
import util from "../util"
|
|
7
|
+
import { useVModel } from '@vueuse/core'
|
|
8
|
+
|
|
9
|
+
const props = defineProps({
|
|
10
|
+
modelValue: {
|
|
11
|
+
type: Number,
|
|
12
|
+
default: 0,
|
|
13
|
+
},
|
|
14
|
+
label: {
|
|
15
|
+
type: String,
|
|
16
|
+
default: "选择月份",
|
|
17
|
+
},
|
|
18
|
+
placeholder: {
|
|
19
|
+
type: String,
|
|
20
|
+
default: "请选择月份",
|
|
21
|
+
},
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
// 弹出层
|
|
25
|
+
const data = reactive({
|
|
26
|
+
monthOptions: []
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
// 定义emit
|
|
30
|
+
const emit = defineEmits(["update:modelValue"]);
|
|
31
|
+
const modelValue = useVModel(props, 'modelValue', emit)
|
|
32
|
+
|
|
33
|
+
const setupOptions = () => {
|
|
34
|
+
data.monthOptions.push({
|
|
35
|
+
text: '月',
|
|
36
|
+
value: 0
|
|
37
|
+
})
|
|
38
|
+
for (var i = 1; i <= 12; i++) {
|
|
39
|
+
data.monthOptions.push({
|
|
40
|
+
text: i+'月',
|
|
41
|
+
value: i,
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
//首页加载
|
|
47
|
+
onMounted(() => {
|
|
48
|
+
setupOptions()
|
|
49
|
+
})
|
|
50
|
+
</script>
|
|
51
|
+
|
|
52
|
+
<style scoped></style>
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<van-field v-if="!isGone" :label="props.label" :required="isRequired" :rules="props.rules" :disabled="isDisabled"
|
|
3
|
+
:placeholder="props.placeholder" :is-link="isReadonly ? false : true" @click="data.isShowPop = !isReadonly"
|
|
4
|
+
label-class="label">
|
|
5
|
+
<template #input v-if="selectOptions.length>0">
|
|
6
|
+
<div class="data-list">
|
|
7
|
+
<van-tag class="data-item" :closeable="!isDisabled" type="primary" plain v-for="(item, i) in selectOptions"
|
|
8
|
+
:key="item" @close.stop="onDelete(i)">
|
|
9
|
+
{{ item.title }}
|
|
10
|
+
</van-tag>
|
|
11
|
+
</div>
|
|
12
|
+
</template>
|
|
13
|
+
</van-field>
|
|
14
|
+
<data-pop v-model="modelValue" :options="totalOptions" v-model:show="data.isShowPop" />
|
|
15
|
+
</template>
|
|
16
|
+
|
|
17
|
+
<script setup>
|
|
18
|
+
import { onMounted, ref, onBeforeUpdate, computed, nextTick, watch, reactive } from "vue"
|
|
19
|
+
import util from '../util'
|
|
20
|
+
import DataPop from "./widget/DataPop.vue";
|
|
21
|
+
import { useVModel } from "@vueuse/core";
|
|
22
|
+
|
|
23
|
+
const props = defineProps({
|
|
24
|
+
id: String,
|
|
25
|
+
label: String,
|
|
26
|
+
placeholder: String,
|
|
27
|
+
options: {
|
|
28
|
+
type: Array,
|
|
29
|
+
default: [],
|
|
30
|
+
},
|
|
31
|
+
modelValue: {
|
|
32
|
+
type: Array,
|
|
33
|
+
default: () => [],
|
|
34
|
+
},
|
|
35
|
+
rules: {
|
|
36
|
+
type: Array,
|
|
37
|
+
default: () => []
|
|
38
|
+
},
|
|
39
|
+
required: {
|
|
40
|
+
type: Boolean,
|
|
41
|
+
default: false,
|
|
42
|
+
},
|
|
43
|
+
readonly: {
|
|
44
|
+
type: Boolean,
|
|
45
|
+
default: false,
|
|
46
|
+
},
|
|
47
|
+
auth: {
|
|
48
|
+
type: String,
|
|
49
|
+
default: ''
|
|
50
|
+
},
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
const { isRequired, isReadonly, isGone, isDisabled } = util.props2auth(props)
|
|
54
|
+
const emit = defineEmits(["update:modelValue"]);
|
|
55
|
+
const modelValue = useVModel(props, 'modelValue', emit)
|
|
56
|
+
|
|
57
|
+
const data = reactive({
|
|
58
|
+
isShowPop: false,
|
|
59
|
+
options: []
|
|
60
|
+
})
|
|
61
|
+
|
|
62
|
+
// 将modelValue与选项列表合并
|
|
63
|
+
const totalOptions = computed(() => {
|
|
64
|
+
if (!modelValue.value || modelValue.value.length < 1)
|
|
65
|
+
return data.options
|
|
66
|
+
|
|
67
|
+
let res = [...data.options]
|
|
68
|
+
|
|
69
|
+
for (var i = 0; i < modelValue.value.length; i++) {
|
|
70
|
+
let ary = data.options.filter(item => item.code == modelValue.value[i])
|
|
71
|
+
if (ary.length < 1)
|
|
72
|
+
res = [{ code: modelValue.value[i], title: modelValue.value[i] }, ...res]
|
|
73
|
+
}
|
|
74
|
+
return res
|
|
75
|
+
})
|
|
76
|
+
|
|
77
|
+
const selectOptions = computed(() => {
|
|
78
|
+
if (!modelValue.value || modelValue.value.length < 1)
|
|
79
|
+
return []
|
|
80
|
+
|
|
81
|
+
let res = totalOptions.value.filter(item => {
|
|
82
|
+
return modelValue.value.includes(item.code)
|
|
83
|
+
})
|
|
84
|
+
return res
|
|
85
|
+
})
|
|
86
|
+
|
|
87
|
+
onMounted(() => {
|
|
88
|
+
query()
|
|
89
|
+
})
|
|
90
|
+
|
|
91
|
+
const query = async () => {
|
|
92
|
+
if(!props.id){
|
|
93
|
+
data.options = props.options
|
|
94
|
+
return
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
let params = {
|
|
98
|
+
id: props.id,
|
|
99
|
+
}
|
|
100
|
+
const res = await util.dictionary_dict(params)
|
|
101
|
+
if (!res.data.parseValue) {
|
|
102
|
+
data.options = []
|
|
103
|
+
return
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
data.options = res.data.parseValue
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
const onDelete = (idx) => {
|
|
110
|
+
modelValue.value.splice(idx, 1)
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
watch(()=>props.modelValue,(o,n)=>{
|
|
114
|
+
if(!props.modelValue)
|
|
115
|
+
modelValue.value = []
|
|
116
|
+
},{immediate:true})
|
|
117
|
+
</script>
|
|
118
|
+
|
|
119
|
+
<style scoped>
|
|
120
|
+
.data-item{
|
|
121
|
+
margin: 0 8px 8px 0;
|
|
122
|
+
padding: 2px 5px;
|
|
123
|
+
}
|
|
124
|
+
</style>
|
|
@@ -0,0 +1,62 @@
|
|
|
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
|
+
modelValue: {
|
|
11
|
+
type: Number,
|
|
12
|
+
default: 0,
|
|
13
|
+
},
|
|
14
|
+
label: {
|
|
15
|
+
type: String,
|
|
16
|
+
default: "选择项目",
|
|
17
|
+
},
|
|
18
|
+
placeholder: {
|
|
19
|
+
type: String,
|
|
20
|
+
default: "请选择项目",
|
|
21
|
+
},
|
|
22
|
+
maxStage: {
|
|
23
|
+
type: String,
|
|
24
|
+
default: ''
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
// 弹出层
|
|
29
|
+
const data = reactive({
|
|
30
|
+
options: []
|
|
31
|
+
})
|
|
32
|
+
|
|
33
|
+
// 定义emit
|
|
34
|
+
const emit = defineEmits(["update:modelValue"]);
|
|
35
|
+
const modelValue = useVModel(props, 'modelValue', emit)
|
|
36
|
+
|
|
37
|
+
const totalOptions = computed(() => {
|
|
38
|
+
return [{
|
|
39
|
+
text: '工程编号',
|
|
40
|
+
value: ''
|
|
41
|
+
}, ...data.options]
|
|
42
|
+
})
|
|
43
|
+
|
|
44
|
+
//首页加载
|
|
45
|
+
onMounted(() => {
|
|
46
|
+
query()
|
|
47
|
+
})
|
|
48
|
+
|
|
49
|
+
const query = async () => {
|
|
50
|
+
let params = { isBasic: true, limit: 99999, page: 1 }
|
|
51
|
+
if(props.maxStage)
|
|
52
|
+
params.maxStage = props.maxStage
|
|
53
|
+
|
|
54
|
+
const res = await util.project_list(params)
|
|
55
|
+
data.options = res.data.list.map(item => ({
|
|
56
|
+
text: `${item.projectCode}/${item.name}`,
|
|
57
|
+
value: item.id
|
|
58
|
+
}))
|
|
59
|
+
}
|
|
60
|
+
</script>
|
|
61
|
+
|
|
62
|
+
<style scoped></style>
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="widget">
|
|
3
|
+
<!-- 项目名称选择 -->
|
|
4
|
+
<DataSelector v-model="modelValue" v-if="!isGone" :label="props.label" :required="isRequired" :rules="props.rules"
|
|
5
|
+
:disabled="isDisabled" :readonly="isReadonly" mode="single" :options="data.options" class="selector-field"
|
|
6
|
+
@select="onSelect" />
|
|
7
|
+
</div>
|
|
8
|
+
</template>
|
|
9
|
+
|
|
10
|
+
<script setup>
|
|
11
|
+
import { ref, onMounted, watch, reactive } from 'vue'
|
|
12
|
+
import util from '../util'
|
|
13
|
+
import DataSelector from './data_selector.vue'
|
|
14
|
+
import { useVModel } from '@vueuse/core'
|
|
15
|
+
|
|
16
|
+
const props = defineProps({
|
|
17
|
+
modelValue: {
|
|
18
|
+
type: String,
|
|
19
|
+
default: null
|
|
20
|
+
},
|
|
21
|
+
required: {
|
|
22
|
+
type: Boolean,
|
|
23
|
+
default: true
|
|
24
|
+
},
|
|
25
|
+
label: {
|
|
26
|
+
type: String,
|
|
27
|
+
default: "",
|
|
28
|
+
},
|
|
29
|
+
placeholder: {
|
|
30
|
+
type: String,
|
|
31
|
+
default: "请选择项目",
|
|
32
|
+
},
|
|
33
|
+
readonly: {
|
|
34
|
+
type: Boolean,
|
|
35
|
+
default: false,
|
|
36
|
+
},
|
|
37
|
+
rules: {
|
|
38
|
+
type: Array,
|
|
39
|
+
default: () => []
|
|
40
|
+
},
|
|
41
|
+
auth: {
|
|
42
|
+
type: String,
|
|
43
|
+
default: "",
|
|
44
|
+
},
|
|
45
|
+
maxStage: {
|
|
46
|
+
type: String,
|
|
47
|
+
default: ''
|
|
48
|
+
}
|
|
49
|
+
})
|
|
50
|
+
|
|
51
|
+
const emit = defineEmits(['update:modelValue', 'select'])
|
|
52
|
+
const { isRequired, isReadonly, isGone, isDisabled } = util.props2auth(props)
|
|
53
|
+
const data = reactive({
|
|
54
|
+
options: []
|
|
55
|
+
})
|
|
56
|
+
const modelValue = useVModel(props, 'modelValue', emit)
|
|
57
|
+
|
|
58
|
+
const query = async () => {
|
|
59
|
+
let params = { isBasic: true, limit: 99999, page: 1 }
|
|
60
|
+
if (props.maxStage)
|
|
61
|
+
params.maxStage = props.maxStage
|
|
62
|
+
|
|
63
|
+
const res = await util.project_list(params)
|
|
64
|
+
data.options = res.data.list.map(item => ({
|
|
65
|
+
text: `${item.projectCode}/${item.name}`,
|
|
66
|
+
value: item.id
|
|
67
|
+
}))
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
const onSelect = (item) => {
|
|
71
|
+
emit('select', item)
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// 修改后的挂载逻辑
|
|
75
|
+
onMounted(async () => {
|
|
76
|
+
query()
|
|
77
|
+
})
|
|
78
|
+
</script>
|
|
79
|
+
|
|
80
|
+
<style lang="scss" scoped>
|
|
81
|
+
.widget {
|
|
82
|
+
:deep(.van-cell) {
|
|
83
|
+
align-items: center;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
:deep(.van-field__label) {
|
|
87
|
+
width: 90px;
|
|
88
|
+
flex: none;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.readonly-field {
|
|
92
|
+
:deep(.van-field__control) {
|
|
93
|
+
color: #323233;
|
|
94
|
+
/* 修改文字颜色与普通字段一致 */
|
|
95
|
+
padding-right: 16px;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/* 添加必填星号对齐 */
|
|
99
|
+
&.van-field--required {
|
|
100
|
+
:deep(.van-field__label::before) {
|
|
101
|
+
margin-right: 4px;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/* 统一字段间距 */
|
|
107
|
+
.readonly-field {
|
|
108
|
+
margin: 4px 0;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
</style>
|