change(mes/baseMateria): 增强轮胎停放时间功能

- 在列表页面添加最小和最大停放时间的格式化显示
- 在表单页面将停放时间输入改为天、小时、分钟的组合输入
- 实现天小时分钟与秒之间的相互转换
- 在 API 类型中添加新的停放时间字段
master
zch 1 month ago
parent d8f1176466
commit 9aab98ca3a

@ -530,6 +530,14 @@ export interface BaseMaterialInfoForm extends BaseEntity {
*/
remark?: string;
minParkingDays?: number;
minParkingHours?: number;
minParkingMinutes?: number;
maxParkingDays?: number;
maxParkingHours?: number;
maxParkingMinutes?: number;
}
export interface BaseMaterialInfoQuery extends PageQuery {

@ -338,8 +338,19 @@
<dict-tag :options="tire_markings" :value="scope.row.tireMarkings"/>
</template>
</el-table-column>
<el-table-column label="最小停放时间" align="center" prop="minParkingTime" v-if="columns[39].visible"/>
<el-table-column label="最大停放时间" align="center" prop="maxParkingTime" v-if="columns[40].visible"/>
<!-- <el-table-column label="最小停放时间" align="center" prop="minParkingTime" v-if="columns[39].visible"/>-->
<el-table-column label="最小停放时间" align="center" prop="minParkingTime" v-if="columns[39].visible">
<template #default="scope">
<span>{{ formatDayHourMinutes(scope.row.minParkingTime) }}</span>
</template>
</el-table-column>
<!-- <el-table-column label="最大停放时间" align="center" prop="maxParkingTime" v-if="columns[40].visible"/>-->
<el-table-column label="最大停放时间" align="center" prop="maxParkingTime" v-if="columns[40].visible">
<template #default="scope">
<span>{{ formatDayHourMinutes(scope.row.maxParkingTime) }}</span>
</template>
</el-table-column>
<el-table-column label="标准重量" align="center" prop="standardWeight" v-if="columns[41].visible"/>
<el-table-column label="标准重量上限" align="center" prop="weightUpperLimit" v-if="columns[42].visible"/>
<el-table-column label="标准重量下限" align="center" prop="weightLowerLimit" v-if="columns[43].visible"/>
@ -618,10 +629,28 @@
</el-select>
</el-form-item>
<el-form-item label="最小停放时间" prop="minParkingTime">
<el-input v-model="form.minParkingTime" placeholder="请输入最小停放时间" />
<!-- <el-input v-model="form.minParkingTime" placeholder="请输入最小停放时间" />-->
<el-input-number v-model="form.minParkingDays" placeholder="请输入天数" :min="0" :max="10000"
:controls="false" :style="{ width: '50px' }"/>
<span>&nbsp;&nbsp;</span>
<el-input-number v-model="form.minParkingHours" placeholder="请输入小时" :min="0" :max="23"
:controls="false" :style="{ width: '50px' }"/>
<span>&nbsp;小时&nbsp;</span>
<el-input-number v-model="form.minParkingMinutes" placeholder="请输入分钟" :min="0" :max="59"
:controls="false" :style="{ width: '50px' }"/>
<span>&nbsp;分钟&nbsp;</span>
</el-form-item>
<el-form-item label="最大停放时间" prop="maxParkingTime">
<el-input v-model="form.maxParkingTime" placeholder="请输入最大停放时间" />
<!-- <el-input v-model="form.maxParkingTime" placeholder="请输入最大停放时间" />-->
<el-input-number v-model="form.maxParkingDays" placeholder="请输入天数" :min="0" :max="10000"
:controls="false" :style="{ width: '50px' }"/>
<span>&nbsp;&nbsp;</span>
<el-input-number v-model="form.maxParkingHours" placeholder="请输入小时" :min="0" :max="23"
:controls="false" :style="{ width: '50px' }"/>
<span>&nbsp;小时&nbsp;</span>
<el-input-number v-model="form.maxParkingMinutes" placeholder="请输入分钟" :min="0" :max="59"
:controls="false" :style="{ width: '50px' }"/>
<span>&nbsp;分钟&nbsp;</span>
</el-form-item>
<el-form-item label="标准重量" prop="standardWeight">
<el-input v-model="form.standardWeight" placeholder="请输入标准重量" />
@ -811,6 +840,13 @@ const initFormData: BaseMaterialInfoForm = {
innerTubeFlag: undefined,
saleType: undefined,
remark: undefined,
minParkingDays:0,
minParkingHours:0,
minParkingMinutes:0,
maxParkingDays:0,
maxParkingHours:0,
maxParkingMinutes:0,
}
const data = reactive<PageData<BaseMaterialInfoForm, BaseMaterialInfoQuery>>({
form: {...initFormData},
@ -955,6 +991,7 @@ const handleUpdate = async (row?: BaseMaterialInfoVO) => {
const _materialId = row?.materialId || ids.value[0]
const res = await getBaseMaterialInfo(_materialId);
Object.assign(form.value, res.data);
convertToTime();
dialog.visible = true;
dialog.title = "修改物料信息";
}
@ -964,6 +1001,7 @@ const submitForm = () => {
baseMaterialInfoFormRef.value?.validate(async (valid: boolean) => {
if (valid) {
buttonLoading.value = true;
convertToSeconds();
if (form.value.materialId) {
await updateBaseMaterialInfo(form.value).finally(() => buttonLoading.value = false);
} else {
@ -1016,6 +1054,7 @@ const getMaterialType = async () => {
materialTypeList.value = res.data;
}
//
let InfoOptions = ref([]);
const getInfoOptions = async () => {
@ -1029,24 +1068,91 @@ const handleTreeNodeClick = async (data: any) => {
handleQuery();
}
/**
* 过滤节点函数
* 用于筛选或显示数据节点基于提供的值和数据对象
*
* @param {string} value - 用户输入的过滤值如果为空则显示所有节点
* @param {any} data - 当前数据节点对象包含需要过滤的属性
* @returns {boolean} - 返回一个布尔值决定节点是否应该显示
*/
const filterNode = (value: string, data: any) => {
//
if (!value) return true;
//
return data.matrialTypeName.toLowerCase().includes(value.toLowerCase());
}
/**
* 树形组件过滤功能相关逻辑
*
* @var filterBoxName 用于绑定过滤关键词的响应式字符串控制树节点过滤条件
* @var props 树形组件配置对象包含字段映射配置
* @property {string} children 子节点字段名默认'children'
* @property {string} label 节点显示文本字段名默认'matrialTypeName'
* @property {string} value 节点值字段名默认'matrialTypeId'
*/
const filterBoxName = ref('');
const props = reactive({
children: 'children',
label: 'matrialTypeName',
value: 'matrialTypeId'
});
/**
* 树形组件实例引用用于调用组件方法
*/
const tree = ref();
/**
* 监听过滤关键词变化实时执行树节点过滤
* @param newVal 新的过滤关键词将传递给树组件的filter方法
*/
watch(filterBoxName, (newVal) => {
if (tree.value) {
tree.value.filter(newVal);
}
});
/** 天小时分钟转换为秒 */
const convertToSeconds = () => {
const maxDaysInSeconds = form.value.maxParkingDays * 24 * 60 * 60;
const maxHoursInSeconds = form.value.maxParkingHours * 60 * 60;
const maxMinutesInSeconds = form.value.maxParkingMinutes * 60;
form.value.maxParkingTime = maxDaysInSeconds + maxHoursInSeconds + maxMinutesInSeconds;
const minDaysInSeconds = form.value.minParkingDays * 24 * 60 * 60;
const minHoursInSeconds = form.value.minParkingHours * 60 * 60;
const minMinutesInSeconds = form.value.minParkingMinutes * 60;
form.value.minParkingTime = minDaysInSeconds + minHoursInSeconds + minMinutesInSeconds;
}
/** 秒转换为天小时分钟 */
const convertToTime = () => {
const maxTotalSeconds = form.value.maxParkingTime;
const maxDays = Math.floor(totalSeconds / (24 * 60 * 60));
const maxHours = Math.floor((totalSeconds % (24 * 60 * 60)) / 3600);
const maxMinutes = Math.floor((totalSeconds % 3600) / 60);
//
form.value.maxParkingDays = maxDays;
form.value.maxParkingHours = maxHours;
form.value.maxParkingMinutes = maxMinutes;
const minTotalSeconds = form.value.minParkingTime;
const minDays = Math.floor(totalSeconds / (24 * 60 * 60));
const minHours = Math.floor((totalSeconds % (24 * 60 * 60)) / 3600);
const minMinutes = Math.floor((totalSeconds % 3600) / 60);
form.value.minParkingDays = minDays;
form.value.minParkingHours = minHours;
form.value.minParkingMinutes = minMinutes;
}
onMounted(() => {
getInfoOptions();
getList();

Loading…
Cancel
Save