@netang/quasar 0.0.75 → 0.0.77
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.
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
v-for="(item, itemIndex) in options"
|
|
9
9
|
>
|
|
10
10
|
<template v-if="! item.hide">
|
|
11
|
+
|
|
11
12
|
<!-- 如果有 name 插槽 -->
|
|
12
13
|
<slot
|
|
13
14
|
:name="`name-${item.name}`"
|
|
@@ -121,6 +122,7 @@
|
|
|
121
122
|
v-model="modelValue[itemIndex][index].value"
|
|
122
123
|
dense
|
|
123
124
|
outlined
|
|
125
|
+
:value-type="multiple ? 'stringArray' : 'string'"
|
|
124
126
|
:multiple="multiple"
|
|
125
127
|
v-bind="item.table"
|
|
126
128
|
v-else-if="item.searchType === 'table'"
|
|
@@ -66,10 +66,12 @@
|
|
|
66
66
|
<script>
|
|
67
67
|
import { watch } from 'vue'
|
|
68
68
|
|
|
69
|
+
import $n_isArray from 'lodash/isArray'
|
|
69
70
|
import $n_cloneDeep from 'lodash/cloneDeep'
|
|
70
71
|
|
|
71
72
|
import $n_split from '@netang/utils/split'
|
|
72
73
|
import $n_indexOf from '@netang/utils/indexOf'
|
|
74
|
+
import $n_numberDeep from '@netang/utils/numberDeep'
|
|
73
75
|
|
|
74
76
|
import { configs } from '../../utils/config'
|
|
75
77
|
|
|
@@ -112,21 +114,63 @@ export default {
|
|
|
112
114
|
/**
|
|
113
115
|
* 监听值的比较类型
|
|
114
116
|
*/
|
|
115
|
-
watch(()=>props.modelValue[0].compare, function(
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
117
|
+
watch(()=>props.modelValue[0].compare, function(compare) {
|
|
118
|
+
|
|
119
|
+
// 获取当前值
|
|
120
|
+
const value = props.modelValue[0].value
|
|
121
|
+
|
|
122
|
+
// 如果类型为 in / not in, 则为多选
|
|
123
|
+
// --------------------------------------------------
|
|
124
|
+
if ($n_indexOf([dicts.SEARCH_COMPARE_TYPE__IN, dicts.SEARCH_COMPARE_TYPE__NOT_IN], compare) > -1) {
|
|
125
|
+
|
|
126
|
+
// 如果当前值不为数组
|
|
127
|
+
if (! $n_isArray(value)) {
|
|
128
|
+
|
|
129
|
+
// 则将值转为数组
|
|
130
|
+
// 触发更新值
|
|
131
|
+
emitModelValue($n_split(value, ','))
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
// 否则为单选 && 如果值为: 数组
|
|
135
|
+
// --------------------------------------------------
|
|
136
|
+
} else if ($n_isArray(value)) {
|
|
137
|
+
|
|
138
|
+
// 触发更新值
|
|
139
|
+
emitModelValue(value.length ? $n_numberDeep(value[0]) : '')
|
|
140
|
+
|
|
141
|
+
// 否则为单选 && 值为: 字符串 / 数字
|
|
142
|
+
// --------------------------------------------------
|
|
143
|
+
} else {
|
|
144
|
+
|
|
145
|
+
// 将值转为数组
|
|
146
|
+
const arr = $n_split(value, ',')
|
|
147
|
+
|
|
148
|
+
// 如果数组长度不为 1, 则说明有多个值 || 无值
|
|
119
149
|
if (arr.length !== 1) {
|
|
120
|
-
// 克隆值
|
|
121
|
-
const _modelValue = $n_cloneDeep(props.modelValue)
|
|
122
150
|
|
|
123
|
-
//
|
|
124
|
-
|
|
125
|
-
emit('update:modelValue', _modelValue)
|
|
151
|
+
// 触发更新值
|
|
152
|
+
emitModelValue(arr.length > 1 ? arr[0] : '')
|
|
126
153
|
}
|
|
127
154
|
}
|
|
128
155
|
})
|
|
129
156
|
|
|
157
|
+
// ==========【方法】=============================================================================================
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* 触发更新值
|
|
161
|
+
*/
|
|
162
|
+
function emitModelValue(value) {
|
|
163
|
+
|
|
164
|
+
// 克隆值
|
|
165
|
+
const _modelValue = $n_cloneDeep(props.modelValue)
|
|
166
|
+
|
|
167
|
+
// 更新值
|
|
168
|
+
_modelValue[0].value = value
|
|
169
|
+
|
|
170
|
+
// 更新值
|
|
171
|
+
emit('update:modelValue', _modelValue)
|
|
172
|
+
}
|
|
173
|
+
|
|
130
174
|
// ==========【返回】=============================================================================================
|
|
131
175
|
|
|
132
176
|
return {
|
|
@@ -25,21 +25,6 @@
|
|
|
25
25
|
v-if="preview"
|
|
26
26
|
></div>
|
|
27
27
|
</q-img>
|
|
28
|
-
|
|
29
|
-
<!-- 错误图标 -->
|
|
30
|
-
<div
|
|
31
|
-
class="flex flex-center bg-grey-5 text-white no-padding"
|
|
32
|
-
:style="{
|
|
33
|
-
width: toPx(size),
|
|
34
|
-
height: toPx(size),
|
|
35
|
-
}"
|
|
36
|
-
v-else
|
|
37
|
-
>
|
|
38
|
-
<q-icon
|
|
39
|
-
:size="errorIconSize"
|
|
40
|
-
:name="errorIcon"
|
|
41
|
-
/>
|
|
42
|
-
</div>
|
|
43
28
|
</template>
|
|
44
29
|
|
|
45
30
|
<script>
|
|
@@ -109,6 +94,7 @@ export default {
|
|
|
109
94
|
if (res) {
|
|
110
95
|
return res
|
|
111
96
|
}
|
|
97
|
+
return 'error'
|
|
112
98
|
})
|
|
113
99
|
|
|
114
100
|
// ==========【方法】=============================================================================================
|
package/package.json
CHANGED