完善字符串类型的体验
This commit is contained in:
@@ -341,6 +341,10 @@ export function publishTraceabilityBatch(id: string) {
|
||||
return requestClient.post(`/traceability/batches/${id}/publish`);
|
||||
}
|
||||
|
||||
export function resetTraceabilityBatchScanCount(id: string) {
|
||||
return requestClient.post(`/traceability/batches/${id}/scan-count/reset`);
|
||||
}
|
||||
|
||||
export function getTraceabilityPublicDetail(code: string) {
|
||||
return requestClient.get<TraceabilityApi.PublicDetail>(
|
||||
`/traceability/public/by-code/${code}`,
|
||||
|
||||
@@ -275,7 +275,10 @@ onMounted(loadBatches);
|
||||
>打开地图</a
|
||||
>
|
||||
</div>
|
||||
<strong v-else :style="getFieldDisplayStyle(entry.field)">
|
||||
<strong
|
||||
v-else
|
||||
:style="getFieldDisplayStyle(entry.field)"
|
||||
>
|
||||
{{ formatFieldValue(entry.value) }}
|
||||
</strong>
|
||||
</div>
|
||||
@@ -349,10 +352,7 @@ onMounted(loadBatches);
|
||||
>打开地图</a
|
||||
>
|
||||
</div>
|
||||
<strong
|
||||
v-else
|
||||
:style="getFieldDisplayStyle(entry.field)"
|
||||
>
|
||||
<strong v-else :style="getFieldDisplayStyle(entry.field)">
|
||||
{{ formatFieldValue(entry.value) }}
|
||||
</strong>
|
||||
</div>
|
||||
@@ -549,6 +549,7 @@ onMounted(loadBatches);
|
||||
.access-card strong {
|
||||
line-height: 1.6;
|
||||
word-break: break-word;
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
|
||||
.section-stack {
|
||||
@@ -578,6 +579,11 @@ onMounted(loadBatches);
|
||||
color: #6b7280;
|
||||
}
|
||||
|
||||
.timeline-card strong {
|
||||
white-space: pre-wrap;
|
||||
word-break: break-word;
|
||||
}
|
||||
|
||||
.kv-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
|
||||
@@ -27,6 +27,7 @@ import {
|
||||
getTraceabilityBatches,
|
||||
getTraceabilityTemplates,
|
||||
publishTraceabilityBatch,
|
||||
resetTraceabilityBatchScanCount,
|
||||
updateTraceabilityBatchStep,
|
||||
uploadTraceabilityImage,
|
||||
} from '#/api';
|
||||
@@ -435,6 +436,29 @@ async function saveStep() {
|
||||
}
|
||||
}
|
||||
|
||||
function resetBatchScanCount() {
|
||||
if (!batchDetail.value?.id) return;
|
||||
Modal.confirm({
|
||||
title: '重置扫码次数',
|
||||
content: `确认将批次“${batchDetail.value.batchName || batchDetail.value.batchCode}”的扫码次数重置为 0 吗?`,
|
||||
okText: '重置',
|
||||
cancelText: '取消',
|
||||
async onOk() {
|
||||
saving.value = true;
|
||||
try {
|
||||
const detail = await resetTraceabilityBatchScanCount(batchDetail.value!.id);
|
||||
if (detail) {
|
||||
applyBatch(detail);
|
||||
message.success('扫码次数已重置');
|
||||
await loadLists();
|
||||
}
|
||||
} finally {
|
||||
saving.value = false;
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
onMounted(async () => {
|
||||
await loadLists();
|
||||
});
|
||||
@@ -509,14 +533,23 @@ onMounted(async () => {
|
||||
title="发布信息"
|
||||
>
|
||||
<template #extra>
|
||||
<Button
|
||||
v-if="batchDetail.publicUrl"
|
||||
size="small"
|
||||
type="primary"
|
||||
@click="downloadBatchQrCode"
|
||||
>
|
||||
保存二维码
|
||||
</Button>
|
||||
<Space>
|
||||
<Button
|
||||
v-if="batchDetail.publicUrl"
|
||||
size="small"
|
||||
type="primary"
|
||||
@click="downloadBatchQrCode"
|
||||
>
|
||||
保存二维码
|
||||
</Button>
|
||||
<Button
|
||||
v-if="batchDetail.publicUrl"
|
||||
size="small"
|
||||
@click="resetBatchScanCount"
|
||||
>
|
||||
重置扫码次数
|
||||
</Button>
|
||||
</Space>
|
||||
</template>
|
||||
<div class="publish-panel">
|
||||
<div>
|
||||
@@ -755,11 +788,12 @@ onMounted(async () => {
|
||||
(value) => updateFieldValue(field, value)
|
||||
"
|
||||
/>
|
||||
<Input
|
||||
<Input.TextArea
|
||||
v-else-if="field.type === 'string'"
|
||||
:disabled="isFieldValueLocked(field)"
|
||||
:placeholder="field.placeholder || '请输入内容'"
|
||||
:value="currentStep.values[field.key]"
|
||||
:auto-size="{ minRows: 2, maxRows: 6 }"
|
||||
@update:value="
|
||||
(value) => updateFieldValue(field, value)
|
||||
"
|
||||
@@ -1261,6 +1295,8 @@ onMounted(async () => {
|
||||
font-size: 12px;
|
||||
border-top: 1px dashed #e4e9f2;
|
||||
padding-top: 10px;
|
||||
white-space: pre-wrap;
|
||||
word-break: break-word;
|
||||
}
|
||||
|
||||
.field-fixed-tip {
|
||||
|
||||
@@ -638,6 +638,7 @@ onMounted(loadPreviews);
|
||||
<Select v-else-if="currentField.type === 'select'" :options="(currentField.options ?? []).map((item) => ({ label: item, value: item }))" :value="getPreviewFieldValue(currentNode, currentField)" style="width: 100%" @update:value="(value) => updateFieldValue(currentNode!, currentField!, value)" />
|
||||
<Select v-else-if="currentField.type === 'multi_select'" mode="multiple" :options="(currentField.options ?? []).map((item) => ({ label: item, value: item }))" :value="getPreviewFieldValue(currentNode, currentField) ?? []" style="width: 100%" @update:value="(value) => updateFieldValue(currentNode!, currentField!, value)" />
|
||||
<Input.TextArea v-else-if="currentField.type === 'json'" :value="typeof getPreviewFieldValue(currentNode, currentField) === 'string' ? getPreviewFieldValue(currentNode, currentField) : JSON.stringify(getPreviewFieldValue(currentNode, currentField) ?? {}, null, 2)" :auto-size="{ minRows: 3, maxRows: 6 }" @update:value="(value) => updateFieldValue(currentNode!, currentField!, value)" />
|
||||
<Input.TextArea v-else-if="currentField.type === 'string'" :value="getPreviewFieldValue(currentNode, currentField)" :auto-size="{ minRows: 2, maxRows: 6 }" @update:value="(value) => updateFieldValue(currentNode!, currentField!, value)" />
|
||||
<Input v-else :value="getPreviewFieldValue(currentNode, currentField)" @update:value="(value) => updateFieldValue(currentNode!, currentField!, value)" />
|
||||
</Col>
|
||||
</Row>
|
||||
|
||||
Reference in New Issue
Block a user