提交 3fa0dd74 编写于 作者: ibizdev's avatar ibizdev

zhujiamin 发布系统代码 [TrainSys,网页端]

上级 987bee88
...@@ -13,13 +13,13 @@ ...@@ -13,13 +13,13 @@
"dependencies": { "dependencies": {
"@floating-ui/dom": "^1.0.11", "@floating-ui/dom": "^1.0.11",
"@ibiz-template/command": "^0.0.1-beta.50", "@ibiz-template/command": "^0.0.1-beta.50",
"@ibiz-template/controller": "^0.0.1-beta.87", "@ibiz-template/controller": "^0.0.1-beta.88",
"@ibiz-template/core": "^0.0.1-beta.87", "@ibiz-template/core": "^0.0.1-beta.88",
"@ibiz-template/model": "^0.0.1-beta.87", "@ibiz-template/model": "^0.0.1-beta.88",
"@ibiz-template/runtime": "^0.0.1-beta.87", "@ibiz-template/runtime": "^0.0.1-beta.88",
"@ibiz-template/service": "^0.0.1-beta.87", "@ibiz-template/service": "^0.0.1-beta.88",
"@ibiz-template/theme": "^0.0.1-beta.87", "@ibiz-template/theme": "^0.0.1-beta.88",
"@ibiz-template/vue-util": "^0.0.1-beta.87", "@ibiz-template/vue-util": "^0.0.1-beta.88",
"@ibiz/dynamic-model-api": "^2.1.22", "@ibiz/dynamic-model-api": "^2.1.22",
"@riophae/vue-treeselect": "^0.4.0", "@riophae/vue-treeselect": "^0.4.0",
"dayjs": "^1.11.7", "dayjs": "^1.11.7",
......
此差异已折叠。
...@@ -4,8 +4,8 @@ import { ...@@ -4,8 +4,8 @@ import {
getEditorEmits, getEditorEmits,
useNamespace, useNamespace,
} from '@ibiz-template/vue-util'; } from '@ibiz-template/vue-util';
import { isNil } from 'ramda';
import '@ibiz-template/theme/style/components/editor/ibiz-picker-dropdown/ibiz-picker-dropdown.scss'; import '@ibiz-template/theme/style/components/editor/ibiz-picker-dropdown/ibiz-picker-dropdown.scss';
import { isNil } from 'ramda';
export const IBizPickerDropDown = defineComponent({ export const IBizPickerDropDown = defineComponent({
name: 'IBizPickerDropDown', name: 'IBizPickerDropDown',
...@@ -16,16 +16,28 @@ export const IBizPickerDropDown = defineComponent({ ...@@ -16,16 +16,28 @@ export const IBizPickerDropDown = defineComponent({
const c = props.controller; const c = props.controller;
// 当前值 // 当前文本
const curValue: Ref<Array<string> | string | null> = ref(''); const curValue: Ref<Array<string> | string | null> = ref('');
// 实体数据集 // 实体数据集
const items: Ref<IData[]> = ref([]); const items: Ref<IData[]> = ref([]);
// 是否是第一次搜索
const isFirstSearch = ref(false);
// 第一次搜索的时候需要保存值,否则回显有问题
const firstRefValue: Ref<string> = ref('');
// 是否选择过选项
const hasSelected = ref(false);
watch( watch(
() => props.value, () => props.value,
newVal => { (newVal, oldVal) => {
if (newVal || newVal === null) { if (newVal || newVal === null) {
if (oldVal === undefined || oldVal === null) {
isFirstSearch.value = true;
}
curValue.value = newVal; curValue.value = newVal;
const value = props.data[c.valueItem]; const value = props.data[c.valueItem];
const index = items.value.findIndex((item: IData) => const index = items.value.findIndex((item: IData) =>
...@@ -89,6 +101,7 @@ export const IBizPickerDropDown = defineComponent({ ...@@ -89,6 +101,7 @@ export const IBizPickerDropDown = defineComponent({
if (index >= 0) { if (index >= 0) {
onACSelect(items.value[index]); onACSelect(items.value[index]);
} }
hasSelected.value = true;
}; };
// 在搜索中时,再次触发搜索记录搜索值,等待上次搜索触发完成后再次搜索 // 在搜索中时,再次触发搜索记录搜索值,等待上次搜索触发完成后再次搜索
...@@ -98,8 +111,14 @@ export const IBizPickerDropDown = defineComponent({ ...@@ -98,8 +111,14 @@ export const IBizPickerDropDown = defineComponent({
const onSearch = async (query: string) => { const onSearch = async (query: string) => {
if (c.model.appDataEntity && loading.value === false) { if (c.model.appDataEntity && loading.value === false) {
loading.value = true; loading.value = true;
// 初次搜索时refValue需要置空,否则选项出不来
if (isFirstSearch.value) {
firstRefValue.value = refValue.value;
refValue.value = '';
}
try { try {
const res = await c.getServiceData(query, props.data!); const searchQuery = isFirstSearch.value ? '' : query;
const res = await c.getServiceData(searchQuery, props.data!);
if (res) { if (res) {
items.value = res.data as IData[]; items.value = res.data as IData[];
} }
...@@ -114,6 +133,7 @@ export const IBizPickerDropDown = defineComponent({ ...@@ -114,6 +133,7 @@ export const IBizPickerDropDown = defineComponent({
} else { } else {
waitQuery = query; waitQuery = query;
} }
isFirstSearch.value = false;
}; };
// 下拉打开 // 下拉打开
...@@ -122,6 +142,16 @@ export const IBizPickerDropDown = defineComponent({ ...@@ -122,6 +142,16 @@ export const IBizPickerDropDown = defineComponent({
if (isOpen) { if (isOpen) {
items.value = []; items.value = [];
onSearch(''); onSearch('');
} else if (!hasSelected.value) {
// 下拉关闭的时候,如果没有选择过,要把回显值重新赋回select
refValue.value = firstRefValue.value;
}
};
// 搜索词改变时触发
const onQueryChange = (query: string) => {
if (query === '') {
onSearch('');
} }
}; };
...@@ -146,6 +176,7 @@ export const IBizPickerDropDown = defineComponent({ ...@@ -146,6 +176,7 @@ export const IBizPickerDropDown = defineComponent({
loading, loading,
items, items,
onOpenChange, onOpenChange,
onQueryChange,
onClear, onClear,
onSelect, onSelect,
onSearch, onSearch,
...@@ -173,6 +204,7 @@ export const IBizPickerDropDown = defineComponent({ ...@@ -173,6 +204,7 @@ export const IBizPickerDropDown = defineComponent({
placeholder={this.c.placeHolder} placeholder={this.c.placeHolder}
remote-method={this.onSearch} remote-method={this.onSearch}
on-on-open-change={this.onOpenChange} on-on-open-change={this.onOpenChange}
on-on-query-change={this.onQueryChange}
on-on-change={this.onSelect} on-on-change={this.onSelect}
on-on-clear={this.onClear} on-on-clear={this.onClear}
disabled={this.disabled} disabled={this.disabled}
......
...@@ -651,54 +651,54 @@ ...@@ -651,54 +651,54 @@
dependencies: dependencies:
qx-util "^0.4.8" qx-util "^0.4.8"
"@ibiz-template/controller@^0.0.1-beta.87": "@ibiz-template/controller@^0.0.1-beta.88":
version "0.0.1-beta.87" version "0.0.1-beta.88"
resolved "http://npm.zhr.icu:4873/@ibiz-template/controller/-/controller-0.0.1-beta.87.tgz#ba7bdb0ae94df8b052767e17ee598b78b3be2bc0" resolved "http://npm.zhr.icu:4873/@ibiz-template/controller/-/controller-0.0.1-beta.88.tgz#182d9b9d96fb365a0bb7d8f2a3d32b5da38609be"
integrity sha512-xf+F6Uud3LdFV756nE7tFHs4kUeX/+5ETlUpbcsa1EYJCjuPWDx0/Gp6UpaVp6eabjARG3KXSFwjA77XQNG+xw== integrity sha512-kqSzzpkk0LopkF2JSuhF+Dj5Y6ajkhk1rv9wgfC5fD8G1G/N7Fis6OaBsBe8tlI1ytL38Oon4B2aMYUq36EjGQ==
dependencies: dependencies:
async-validator "^4.2.5" async-validator "^4.2.5"
dayjs "^1.11.5" dayjs "^1.11.5"
"@ibiz-template/core@^0.0.1-beta.87": "@ibiz-template/core@^0.0.1-beta.88":
version "0.0.1-beta.87" version "0.0.1-beta.88"
resolved "http://npm.zhr.icu:4873/@ibiz-template/core/-/core-0.0.1-beta.87.tgz#0e451605ddbde3a170f92f18f937da41708d3611" resolved "http://npm.zhr.icu:4873/@ibiz-template/core/-/core-0.0.1-beta.88.tgz#5f9fb8f0b192b6cb25ae63a82af4e1a7a5defe69"
integrity sha512-H99YbcCrVFeuxKjbtApQp2R7puVoDMa5TgVJWXmcKeJ2gguxNEjEH2seFG2ESMqH3lwVb3oUnepEBhI3cMeJCA== integrity sha512-d3t95s0n2QGlCWpx2OzJxqS/uUxIb8aF7D4AALj0ahasL3RHKF6YLrG/F55ng5/ub06OjbvkIPZzQic39Gu2Xg==
dependencies: dependencies:
axios "^1.2.1" axios "^1.2.1"
loglevel "^1.8.0" loglevel "^1.8.0"
pluralize "^8.0.0" pluralize "^8.0.0"
qs "^6.11.0" qs "^6.11.0"
"@ibiz-template/model@^0.0.1-beta.87": "@ibiz-template/model@^0.0.1-beta.88":
version "0.0.1-beta.87" version "0.0.1-beta.88"
resolved "http://npm.zhr.icu:4873/@ibiz-template/model/-/model-0.0.1-beta.87.tgz#d5b6deedde287afe254063d785cd0ab15d5a0f9e" resolved "http://npm.zhr.icu:4873/@ibiz-template/model/-/model-0.0.1-beta.88.tgz#f2f2889c6d8411673a97d909d014a7ececd0ed08"
integrity sha512-h/Ec6ppE4MfjjdJ7T1I/QQR2HTVmg+ZeotURTNHbbyq30AmzLydcQBPofQHKFRo4vbYb0es55ZaWKXbo9cj9eg== integrity sha512-8tqA1Py304BjUSAeFNq463q41cd0lAPtrAk6OQOuy2b531zZFq6H4amYVCV/XZn5rJJ32veub2L3bm9CxWijSQ==
dependencies: dependencies:
"@ibiz/dynamic-model-api" "^2.1.22" "@ibiz/dynamic-model-api" "^2.1.22"
pluralize "^8.0.0" pluralize "^8.0.0"
"@ibiz-template/runtime@^0.0.1-beta.87": "@ibiz-template/runtime@^0.0.1-beta.88":
version "0.0.1-beta.87" version "0.0.1-beta.88"
resolved "http://npm.zhr.icu:4873/@ibiz-template/runtime/-/runtime-0.0.1-beta.87.tgz#96c04d680d58d1c05456ef225d2bbf2316ad3f6f" resolved "http://npm.zhr.icu:4873/@ibiz-template/runtime/-/runtime-0.0.1-beta.88.tgz#7043438b752bc68b4b69c56ca1975c3f6de0c6e6"
integrity sha512-lK7E9JfUBGqCQEGpMGcd54LiCL9I8ZnXAAw9cQg3KzBKGoCLOLebaayW+4TAeOis/DV3r6xFUe182Li458GecA== integrity sha512-um7iSypiImO1fcTXP04vKa5Qn8VEl93QAUSylqBcjyRa6eTs8obmu+Skz8ETAyKOmdEgOw+utV7FuqTYHCIMOg==
dependencies: dependencies:
"@ibiz-template/command" "^0.0.1-beta.50" "@ibiz-template/command" "^0.0.1-beta.50"
qs "^6.11.0" qs "^6.11.0"
"@ibiz-template/service@^0.0.1-beta.87": "@ibiz-template/service@^0.0.1-beta.88":
version "0.0.1-beta.87" version "0.0.1-beta.88"
resolved "http://npm.zhr.icu:4873/@ibiz-template/service/-/service-0.0.1-beta.87.tgz#0ec46a97ab5011d040d33ec4c67ca41c89e605bd" resolved "http://npm.zhr.icu:4873/@ibiz-template/service/-/service-0.0.1-beta.88.tgz#8f0b74ddc176ef6b18a0108f5ef2e4f321c4d50a"
integrity sha512-wZcgbhOEp0FElkRF/XNygzmuHjHd6wBGOyV46YuccDqv7R6XAfhkMabe7xvlYtAJar/dPLg9UBqqWJxQ3uQ1QA== integrity sha512-Kzr3zl81Vuo073gsSPhOMTFoLknBBjyUsW2kPp2sCFAklzcM72tqV/QI5wLahRQ5D3rCjwR/QISslyeeXPa+oQ==
"@ibiz-template/theme@^0.0.1-beta.87": "@ibiz-template/theme@^0.0.1-beta.88":
version "0.0.1-beta.87" version "0.0.1-beta.88"
resolved "http://npm.zhr.icu:4873/@ibiz-template/theme/-/theme-0.0.1-beta.87.tgz#94096a4eb97f7c55d4582e848478feb8f8cc10b8" resolved "http://npm.zhr.icu:4873/@ibiz-template/theme/-/theme-0.0.1-beta.88.tgz#29ae44fd020d9a32fc1962968ef22bfeb92592d2"
integrity sha512-pelpQeJxu2nB4xzy2xTIVE+YshDd+znO5eVrjx/YnLDDBhEg4RzWat1+/nauFocZuA6/B1avwdgZBlfVqCH9xA== integrity sha512-Fo3R90FLrWmemWJAGetpem0CwevB1e4Z+QSssZPI2z3C1w47YByxDIBQMZJl2tGloUlKBxxh/fVz1v1r5UKHAQ==
"@ibiz-template/vue-util@^0.0.1-beta.87": "@ibiz-template/vue-util@^0.0.1-beta.88":
version "0.0.1-beta.87" version "0.0.1-beta.88"
resolved "http://npm.zhr.icu:4873/@ibiz-template/vue-util/-/vue-util-0.0.1-beta.87.tgz#32d3dbca7ee8f0ae6fe5fd023c9c84e99d3ec424" resolved "http://npm.zhr.icu:4873/@ibiz-template/vue-util/-/vue-util-0.0.1-beta.88.tgz#89d6951623eaa878c0fdd0af909f1cdd80f3198f"
integrity sha512-4A+ru5VWIdEa5NK5FA+98lR8obq3KXcueMj9D8a0bWYo0Z9mIKRaBmXi/Omm82povCqcRVzOkNM3yckBxz1r5Q== integrity sha512-fpKHFyzNwvsqKIh7TfoNkjcZE+gf37CI/OO5++uSBpRAEopPpR0wVjss2AtQUN0IfNKq4vNYnpLCwfBOMMQDWQ==
"@ibiz/dynamic-model-api@^2.1.22": "@ibiz/dynamic-model-api@^2.1.22":
version "2.1.22" version "2.1.22"
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册