add DateTimeNowPicker.vue
This commit is contained in:
@@ -25,7 +25,7 @@
|
||||
<strong v-text="`单位 ${unitIndex + 1}`" />
|
||||
<t-button v-if="1 < unitList.length" theme="danger" variant="text" size="extra-small" content="删除" @click="removeUnit(unitIndex)" />
|
||||
</div>
|
||||
<t-form class="unit-form" label-align="left" label-width="6rem">
|
||||
<t-form class="unit-form" label-width="6rem">
|
||||
<t-form-item label="单位名称" required-mark>
|
||||
<t-input v-model.trim="unit.name" borderless maxlength="32" placeholder="如 件、盒、箱" />
|
||||
</t-form-item>
|
||||
|
||||
@@ -22,23 +22,7 @@
|
||||
<t-input v-model="quantity" type="number" align="right" borderless />
|
||||
</t-form-item>
|
||||
<t-form-item label="发生时间" content-align="right">
|
||||
<div class="time-actions">
|
||||
<t-button
|
||||
theme="primary"
|
||||
variant="outline"
|
||||
size="extra-small"
|
||||
:content="occurredAtText || '此刻'"
|
||||
@click="openOccurredAtPicker"
|
||||
/>
|
||||
<t-button
|
||||
v-if="occurredAtText"
|
||||
theme="primary"
|
||||
variant="text"
|
||||
size="extra-small"
|
||||
content="此刻"
|
||||
@click="resetOccurredAt"
|
||||
/>
|
||||
</div>
|
||||
<date-time-now-picker v-model="occurredAtText" title="库存发生时间" :start="minimumDateTimeText" />
|
||||
</t-form-item>
|
||||
<t-form-item label="备注" required-mark>
|
||||
<div class="remark-wrap">
|
||||
@@ -70,18 +54,6 @@
|
||||
</t-form>
|
||||
</div>
|
||||
</bottom-popup>
|
||||
<t-popup v-model="occurredAtPickerVisible" placement="bottom">
|
||||
<t-date-time-picker
|
||||
v-if="occurredAtPickerVisible"
|
||||
v-model="occurredAtDraftText"
|
||||
:start="minimumDateTimeText"
|
||||
:mode="['date', 'minute']"
|
||||
format="YYYY-MM-DD HH:mm"
|
||||
title="库存发生时间"
|
||||
@cancel="occurredAtPickerVisible = false"
|
||||
@confirm="confirmOccurredAt"
|
||||
/>
|
||||
</t-popup>
|
||||
<t-popup
|
||||
v-model="unitPickerVisible"
|
||||
placement="bottom"
|
||||
@@ -93,9 +65,9 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import DateTimeNowPicker from "@/components/DateTimeNowPicker.vue";
|
||||
import { watch } from "vue";
|
||||
import { BottomPopup } from "timi-tdesign-mobile";
|
||||
import { Time } from "timi-web";
|
||||
import ProductAPI from "@/api/ProductAPI";
|
||||
import AttachmentSelector from "@/components/attachmentSelector/AttachmentSelector.vue";
|
||||
import type {
|
||||
@@ -132,8 +104,6 @@ const quantity = ref("");
|
||||
const remark = ref("");
|
||||
const requestNo = ref("");
|
||||
const occurredAtText = ref("");
|
||||
const occurredAtDraftText = ref("");
|
||||
const occurredAtPickerVisible = ref(false);
|
||||
const photoItems = ref<PhotoItem[]>([]);
|
||||
const selectedUnitId = ref("");
|
||||
const unitPickerVisible = ref(false);
|
||||
@@ -153,27 +123,10 @@ function resetForm(): void {
|
||||
remark.value = "";
|
||||
requestNo.value = "";
|
||||
occurredAtText.value = "";
|
||||
occurredAtDraftText.value = "";
|
||||
occurredAtPickerVisible.value = false;
|
||||
photoItems.value = [];
|
||||
selectedUnitId.value = selectableUnits.value[0]?.id || "";
|
||||
}
|
||||
|
||||
function openOccurredAtPicker(): void {
|
||||
occurredAtDraftText.value = occurredAtText.value || Time.toDateTime(new Date());
|
||||
occurredAtPickerVisible.value = true;
|
||||
}
|
||||
|
||||
function confirmOccurredAt(value?: string | number): void {
|
||||
occurredAtText.value = String(value || occurredAtDraftText.value);
|
||||
occurredAtPickerVisible.value = false;
|
||||
}
|
||||
|
||||
function resetOccurredAt(): void {
|
||||
occurredAtText.value = "";
|
||||
occurredAtDraftText.value = "";
|
||||
}
|
||||
|
||||
function openUnitPicker(): void {
|
||||
if (selectableUnits.value.length) {
|
||||
unitDraft.value = [selectedUnitId.value];
|
||||
@@ -290,11 +243,5 @@ watch(() => [visible.value, props.operation] as const, ([isVisible]) => {
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.time-actions {
|
||||
gap: .5rem;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user