Commit 9d47e966 by yancanhua

Merge branch 'release/venus-usedcar-h5/1.0.0' of http://192.168.3.233:8090/monor…

…epo/venus into release/venus-usedcar-h5/1.0.0
2 parents a9144f5c ccd2611c
Pipeline #107 for 9d47e966 failed in 0 seconds
...@@ -7,18 +7,18 @@ export {} ...@@ -7,18 +7,18 @@ export {}
declare module 'vue' { declare module 'vue' {
export interface GlobalComponents { export interface GlobalComponents {
ButtonSelect: typeof import('./components/customizeForm/buttonSelect.vue')['default'] ButtonSelect: typeof import('./components/CustomizeForm/buttonSelect.vue')['default']
CustomizeUploadFile: typeof import('./components/customizeForm/customizeUploadFile.vue')['default'] CustomizeUploadFile: typeof import('./components/CustomizeForm/customizeUploadFile.vue')['default']
Index: typeof import('./components/customizeForm/Index.vue')['default'] Index: typeof import('./components/CustomizeForm/Index.vue')['default']
Layouts: typeof import('./layouts/index.vue')['default'] Layouts: typeof import('./layouts/index.vue')['default']
LogoutConfirmModal: typeof import('./components/LogoutConfirmModal.vue')['default'] LogoutConfirmModal: typeof import('./components/LogoutConfirmModal.vue')['default']
PageTitle: typeof import('./components/PageTitle.vue')['default'] PageTitle: typeof import('./components/PageTitle.vue')['default']
PageTop: typeof import('./components/PageTop.vue')['default'] PageTop: typeof import('./components/PageTop.vue')['default']
RadioSelect: typeof import('./components/customizeForm/radioSelect.vue')['default'] RadioSelect: typeof import('./components/CustomizeForm/radioSelect.vue')['default']
RouterLink: typeof import('vue-router')['RouterLink'] RouterLink: typeof import('vue-router')['RouterLink']
RouterView: typeof import('vue-router')['RouterView'] RouterView: typeof import('vue-router')['RouterView']
SelectDatePicker: typeof import('./components/customizeForm/selectDatePicker.vue')['default'] SelectDatePicker: typeof import('./components/CustomizeForm/selectDatePicker.vue')['default']
SelectDropdown: typeof import('./components/customizeForm/selectDropdown.vue')['default'] SelectDropdown: typeof import('./components/CustomizeForm/selectDropdown.vue')['default']
VanActionSheet: typeof import('vant/es')['ActionSheet'] VanActionSheet: typeof import('vant/es')['ActionSheet']
VanButton: typeof import('vant/es')['Button'] VanButton: typeof import('vant/es')['Button']
VanCheckbox: typeof import('vant/es')['Checkbox'] VanCheckbox: typeof import('vant/es')['Checkbox']
......
...@@ -8,9 +8,11 @@ ...@@ -8,9 +8,11 @@
<input class="score-input" <input class="score-input"
inputmode="numeric" inputmode="numeric"
maxlength="3" maxlength="3"
pattern="[0-9]*"
type="text" type="text"
:value="String(form.appearanceScore)" :value="String(form.appearanceScore)"
@input="onAppearanceScoreInput" /> @input="onAppearanceScoreInput"
@keydown="onScoreInputKeydown" />
<span class="score-unit">分</span> <span class="score-unit">分</span>
</div> </div>
</div> </div>
...@@ -133,9 +135,11 @@ ...@@ -133,9 +135,11 @@
<input class="score-input" <input class="score-input"
inputmode="numeric" inputmode="numeric"
maxlength="3" maxlength="3"
pattern="[0-9]*"
type="text" type="text"
:value="String(form.overallScore)" :value="String(form.overallScore)"
@input="onOverallScoreInput" /> @input="onOverallScoreInput"
@keydown="onScoreInputKeydown" />
<span class="score-unit">分</span> <span class="score-unit">分</span>
</div> </div>
</div> </div>
...@@ -317,6 +321,28 @@ function clampScoreFromInput(raw: string): number { ...@@ -317,6 +321,28 @@ function clampScoreFromInput(raw: string): number {
return Math.min(100, Math.max(0, n)); return Math.min(100, Math.max(0, n));
} }
/** 阻止键入非数字;粘贴仍走 @input + clampScoreFromInput */
function onScoreInputKeydown(e: KeyboardEvent) {
if (e.isComposing) return;
if (e.ctrlKey || e.metaKey || e.altKey) return;
const navKeys = new Set([
"ArrowDown",
"ArrowLeft",
"ArrowRight",
"ArrowUp",
"Backspace",
"Delete",
"End",
"Enter",
"Escape",
"Home",
"Tab",
]);
if (navKeys.has(e.key)) return;
if (/^\d$/.test(e.key)) return;
e.preventDefault();
}
function onAppearanceScoreInput(e: Event) { function onAppearanceScoreInput(e: Event) {
form.appearanceScore = clampScoreFromInput((e.target as HTMLInputElement).value); form.appearanceScore = clampScoreFromInput((e.target as HTMLInputElement).value);
} }
...@@ -493,8 +519,8 @@ defineExpose({ validate, getCompleteInspectionPayload }); ...@@ -493,8 +519,8 @@ defineExpose({ validate, getCompleteInspectionPayload });
.rating-btn-check { .rating-btn-check {
position: absolute; position: absolute;
top: 2px; top: -3px;
right: 2px; right: 0px;
width: 14px; width: 14px;
height: 14px; height: 14px;
object-fit: contain; object-fit: contain;
......
...@@ -12,7 +12,8 @@ ...@@ -12,7 +12,8 @@
@click="onOpenModulePicker"> @click="onOpenModulePicker">
<span class="nav-module-name">{{ activeBigModule?.label || "加载中..." }}</span> <span class="nav-module-name">{{ activeBigModule?.label || "加载中..." }}</span>
<van-icon class="nav-module-arrow" <van-icon class="nav-module-arrow"
name="arrow-down" color="#333333"
name="arrow"
size="13" /> size="13" />
</div> </div>
</div> </div>
...@@ -308,15 +309,16 @@ async function initializeInspection() { ...@@ -308,15 +309,16 @@ async function initializeInspection() {
/** /**
* @param bigModuleKey 大项 id * @param bigModuleKey 大项 id
* @param syncSelection 为 false 时只拉取/填充 subTabs,不改当前 activeSubKey(用于后台匹配节点) * @param syncSelection 为 false 时只拉取/填充 subTabs,不改当前 activeSubKey(用于后台匹配节点)
* @param force 为 true 时忽略已有 subTabs 缓存,重新请求 `getInspectionChildren`
*/ */
async function loadSubTabsForBigModule(bigModuleKey: number | string, syncSelection = true) { async function loadSubTabsForBigModule(bigModuleKey: number | string, syncSelection = true, force = false) {
if (bigModuleKey === SCORE_BIG_KEY) return; if (bigModuleKey === SCORE_BIG_KEY) return;
try { try {
const targetBigModule = bigModules.value.find((module) => module.key === bigModuleKey); const targetBigModule = bigModules.value.find((module) => module.key === bigModuleKey);
if (!targetBigModule) return; if (!targetBigModule) return;
if (targetBigModule.subTabs.length > 0) { if (!force && targetBigModule.subTabs.length > 0) {
if (syncSelection) { if (syncSelection) {
activeSubKey.value = targetBigModule.subTabs[0]!.key; activeSubKey.value = targetBigModule.subTabs[0]!.key;
} }
...@@ -391,13 +393,13 @@ async function switchToUncompletedInspectionNode(nodeId: number | string): Promi ...@@ -391,13 +393,13 @@ async function switchToUncompletedInspectionNode(nodeId: number | string): Promi
); );
if (rootHit) { if (rootHit) {
activeBigKey.value = rootHit.key; activeBigKey.value = rootHit.key;
await loadSubTabsForBigModule(rootHit.key); await loadSubTabsForBigModule(rootHit.key, true, true);
activeSubKey.value = rootHit.subTabs[0]?.key ?? ""; activeSubKey.value = rootHit.subTabs[0]?.key ?? "";
return true; return true;
} }
for (const m of mains) { for (const m of mains) {
await loadSubTabsForBigModule(m.key, false); await loadSubTabsForBigModule(m.key, false, true);
const sub = m.subTabs.find( const sub = m.subTabs.find(
(s) => String(s.key) === idStr || String(s.nodeId ?? "") === idStr, (s) => String(s.key) === idStr || String(s.nodeId ?? "") === idStr,
); );
...@@ -446,7 +448,7 @@ function advanceInspectionStep() { ...@@ -446,7 +448,7 @@ function advanceInspectionStep() {
if (activeMainIndex < mains.length - 1) { if (activeMainIndex < mains.length - 1) {
const nextMain = mains[activeMainIndex + 1]!; const nextMain = mains[activeMainIndex + 1]!;
activeBigKey.value = nextMain.key; activeBigKey.value = nextMain.key;
loadSubTabsForBigModule(nextMain.key).then(() => { loadSubTabsForBigModule(nextMain.key, true, true).then(() => {
activeSubKey.value = nextMain.subTabs[0]?.key ?? ""; activeSubKey.value = nextMain.subTabs[0]?.key ?? "";
}); });
} else { } else {
...@@ -481,16 +483,6 @@ async function saveCurrentLeafInspectionRecord(nextFlag: boolean): Promise<boole ...@@ -481,16 +483,6 @@ async function saveCurrentLeafInspectionRecord(nextFlag: boolean): Promise<boole
return true; return true;
} }
/** 下一步保存成功后同步当前二级 Tab 完成态,避免进度条与 Tab 勾选依赖再次拉模板 */
function markActiveSubTabCompletedLocally() {
if (activeBigKey.value === SCORE_BIG_KEY) return;
const mod = bigModules.value.find((m) => m.key === activeBigKey.value);
const sub = mod?.subTabs.find((s) => s.key === activeSubKey.value);
if (sub) {
sub.completedFlag = 1;
}
}
/** 切换大项 / 二级项前静默落库当前叶子数据 */ /** 切换大项 / 二级项前静默落库当前叶子数据 */
async function persistCurrentSubTabSilently() { async function persistCurrentSubTabSilently() {
if (activeBigKey.value === SCORE_BIG_KEY) return; if (activeBigKey.value === SCORE_BIG_KEY) return;
...@@ -508,13 +500,17 @@ async function onSelectBigModule(selectedBigModule: BigModule) { ...@@ -508,13 +500,17 @@ async function onSelectBigModule(selectedBigModule: BigModule) {
activeBigKey.value = selectedBigModule.key; activeBigKey.value = selectedBigModule.key;
activeSubKey.value = ""; activeSubKey.value = "";
if (selectedBigModule.key !== SCORE_BIG_KEY) { if (selectedBigModule.key !== SCORE_BIG_KEY) {
loadSubTabsForBigModule(selectedBigModule.key); await loadSubTabsForBigModule(selectedBigModule.key, true, true);
} }
} }
async function onSelectSubTab(subTabKey: number | string) { async function onSelectSubTab(subTabKey: number | string) {
if (subTabKey === activeSubKey.value) return; if (subTabKey === activeSubKey.value) return;
await persistCurrentSubTabSilently(); await persistCurrentSubTabSilently();
const bigKey = activeBigKey.value;
if (bigKey !== SCORE_BIG_KEY) {
await loadSubTabsForBigModule(bigKey, false, true);
}
activeSubKey.value = subTabKey; activeSubKey.value = subTabKey;
} }
...@@ -533,7 +529,9 @@ async function onNext() { ...@@ -533,7 +529,9 @@ async function onNext() {
showToast("未获取到表单数据"); showToast("未获取到表单数据");
return; return;
} }
markActiveSubTabCompletedLocally(); if (activeBigKey.value !== SCORE_BIG_KEY) {
await loadSubTabsForBigModule(activeBigKey.value, false, true);
}
advanceInspectionStep(); advanceInspectionStep();
} catch (error) { } catch (error) {
if (!isRequestFailureAlreadyHandled(error)) { if (!isRequestFailureAlreadyHandled(error)) {
...@@ -559,7 +557,7 @@ async function onPrev() { ...@@ -559,7 +557,7 @@ async function onPrev() {
const lastMain = mains[mains.length - 1]; const lastMain = mains[mains.length - 1];
if (lastMain) { if (lastMain) {
activeBigKey.value = lastMain.key; activeBigKey.value = lastMain.key;
await loadSubTabsForBigModule(lastMain.key); await loadSubTabsForBigModule(lastMain.key, true, true);
activeSubKey.value = lastMain.subTabs[lastMain.subTabs.length - 1]?.key ?? ""; activeSubKey.value = lastMain.subTabs[lastMain.subTabs.length - 1]?.key ?? "";
} }
return; return;
...@@ -571,14 +569,16 @@ async function onPrev() { ...@@ -571,14 +569,16 @@ async function onPrev() {
const activeSubIndex = subTabsOfActive.findIndex((subTab) => subTab.key === activeSubKey.value); const activeSubIndex = subTabsOfActive.findIndex((subTab) => subTab.key === activeSubKey.value);
if (activeSubIndex > 0) { if (activeSubIndex > 0) {
activeSubKey.value = subTabsOfActive[activeSubIndex - 1]!.key; const prevSubKey = subTabsOfActive[activeSubIndex - 1]!.key;
await loadSubTabsForBigModule(activeBigKey.value, false, true);
activeSubKey.value = prevSubKey;
} else { } else {
const mains = mainInspectionBigModules.value; const mains = mainInspectionBigModules.value;
const activeMainIndex = mains.findIndex((module) => module.key === activeBigKey.value); const activeMainIndex = mains.findIndex((module) => module.key === activeBigKey.value);
if (activeMainIndex > 0) { if (activeMainIndex > 0) {
const previousMain = mains[activeMainIndex - 1]!; const previousMain = mains[activeMainIndex - 1]!;
activeBigKey.value = previousMain.key; activeBigKey.value = previousMain.key;
await loadSubTabsForBigModule(previousMain.key); await loadSubTabsForBigModule(previousMain.key, true, true);
activeSubKey.value = activeSubKey.value =
previousMain.subTabs[previousMain.subTabs.length - 1]?.key ?? ""; previousMain.subTabs[previousMain.subTabs.length - 1]?.key ?? "";
} }
...@@ -675,7 +675,8 @@ onMounted(() => { ...@@ -675,7 +675,8 @@ onMounted(() => {
} }
.nav-module-arrow { .nav-module-arrow {
color: $color-text-secondary; color: #333333;
font-weight: 600;
transition: $transition-fast; transition: $transition-fast;
} }
} }
......
...@@ -203,6 +203,15 @@ void onRefresh(); ...@@ -203,6 +203,15 @@ void onRefresh();
.search-wrap { .search-wrap {
padding: 0 12px; padding: 0 12px;
:deep(.van-search) {
padding: 0;
background: transparent;
}
:deep(.van-search__content) {
background: #fff;
}
} }
.list-wrap { .list-wrap {
......
...@@ -115,9 +115,15 @@ async function fillMore() { ...@@ -115,9 +115,15 @@ async function fillMore() {
finished.value = !!res.last || next.length === 0; finished.value = !!res.last || next.length === 0;
} }
/**
* van-list 在 emit load 前会先 `update:loading` 为 true,若此处再判断 `loading` 会直接 return,
* 且不会走 finally,导致 loading 一直为 true,`listEmpty` 永远为 false,空列表不显示「暂无数据」。
*/
async function onLoad() { async function onLoad() {
if (loading.value || finished.value) return; if (refreshing.value || finished.value) {
loading.value = true; loading.value = false;
return;
}
try { try {
await fillMore(); await fillMore();
} finally { } finally {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!