From d5e65bf5925c8cd1fe0f0bf0b8b857006d64ad94 Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期五, 30 一月 2026 15:26:34 +0800
Subject: [PATCH] 进销存升级 1.部分输入框(有效日期、检定周期)输入做下限制(大于0的整数数字)
---
src/views/productionManagement/productionCosting/index.vue | 146 +++++++++++++++++++++++++++++++-----------------
1 files changed, 94 insertions(+), 52 deletions(-)
diff --git a/src/views/productionManagement/productionCosting/index.vue b/src/views/productionManagement/productionCosting/index.vue
index 3547087..8e1d40b 100644
--- a/src/views/productionManagement/productionCosting/index.vue
+++ b/src/views/productionManagement/productionCosting/index.vue
@@ -1,15 +1,32 @@
<template>
<div class="app-container">
- <div class="content-layout">
+ <el-row :gutter="16" class="content-row">
<!-- 宸︿晶鍙拌处 + 椤堕儴绛涢�� -->
- <div class="left-panel">
+ <el-col :xs="24" :sm="24" :md="24" :lg="8" :xl="8" class="left-col">
+ <div class="left-panel">
<div class="left-header">
- <!-- <div class="left-title">鐢熶骇鍙拌处</div> -->
- <el-radio-group v-model="dateType" size="small" @change="handleDateTypeChange">
- <el-radio-button label="day">鏃�</el-radio-button>
- <el-radio-button label="month">鏈�</el-radio-button>
- </el-radio-group>
-
+ <el-form :model="searchForm" inline>
+ <el-form-item prop="dateType">
+ <el-radio-group v-model="searchForm.dateType" size="small" @change="handleDateTypeChange">
+ <el-radio-button label="day">鏃�</el-radio-button>
+ <el-radio-button label="month">鏈�</el-radio-button>
+ </el-radio-group>
+ </el-form-item>
+
+ <el-form-item label="鏃ユ湡锛�" prop="dateRange">
+ <el-date-picker
+ v-model="searchForm.dateRange"
+ :type="searchForm.dateType === 'day' ? 'date' : 'daterange'"
+ range-separator="鑷�"
+ start-placeholder="寮�濮嬫棩鏈�"
+ end-placeholder="缁撴潫鏃ユ湡"
+ format="YYYY-MM-DD"
+ value-format="YYYY-MM-DD"
+ style="width: 200px"
+ @change="handleDateRangeChange"
+ />
+ </el-form-item>
+ </el-form>
</div>
<PIMTable
rowKey="id"
@@ -17,28 +34,33 @@
:tableData="leftTableData"
:tableLoading="tableLoading"
:page="page"
- :height="200"
@row-click="handleLeftRowClick"
@pagination="pagination"
></PIMTable>
- </div>
+ </div>
+ </el-col>
- <!-- 鍙充晶鏄庣粏锛堝師鏈夊唴瀹癸級 -->
- <div class="right-panel">
- <div class="header-filters">
- <el-button @click="handleOut" class="ml10">瀵煎嚭</el-button>
- </div>
+ <!-- 鍙充晶鏄庣粏 -->
+ <el-col :xs="24" :sm="24" :md="24" :lg="16" :xl="16" class="right-col">
+ <div class="right-panel">
+
+ <el-form inline>
+ <el-form-item>
+ <el-button type="primary" @click="handleOut">瀵煎嚭</el-button>
+ </el-form-item>
+ </el-form>
<PIMTable
rowKey="id"
:column="tableColumn"
:tableData="tableData"
:page="page1"
- :tableLoading="tableLoading"
+ :tableLoading="tableLoading1"
style="margin-right: 20px;"
@pagination="pagination1"
></PIMTable>
- </div>
- </div>
+ </div>
+ </el-col>
+ </el-row>
</div>
</template>
@@ -52,7 +74,7 @@
const tableColumn = ref([
{
label: "鐢熶骇鏃ユ湡",
- prop: "scheduleDate",
+ prop: "schedulingDate",
minWidth: 100,
},
{
@@ -130,7 +152,10 @@
label: "鍚堟牸鐜�",
prop: "outputRate",
minWidth: 100,
-
+ formatData: (val) => {
+ if (val == null || val === '') return '-'
+ return parseFloat(val).toFixed(2)
+ },
},
]);
@@ -139,7 +164,6 @@
const tableLoading1 = ref(false);
const leftTableData = ref([]);
// 鏃� / 鏈� 鍒囨崲锛堥粯璁ゆ寜鏃ワ級
-const dateType = ref("day");
const page = reactive({
current: 1,
size: 100,
@@ -156,12 +180,11 @@
searchForm: {
schedulingUserName: "",
salesContractNo: "",
- entryDate: [
- dayjs().format("YYYY-MM-DD"),
- dayjs().add(1, "day").format("YYYY-MM-DD"),
- ], // 褰曞叆鏃ユ湡
- entryDateStart: dayjs().format("YYYY-MM-DD"),
- entryDateEnd: dayjs().add(1, "day").format("YYYY-MM-DD"),
+ dateType: "day",
+ dateRange: dayjs().format("YYYY-MM-DD"),
+ entryDate: dayjs().format("YYYY-MM-DD"),
+ entryDateStart: undefined,
+ entryDateEnd: undefined,
},
});
const { searchForm } = toRefs(data);
@@ -178,28 +201,36 @@
getList1();
};
-const changeDaterange = (value) => {
+const handleDateRangeChange = (value) => {
if (value) {
- searchForm.value.entryDateStart = dayjs(value[0]).format("YYYY-MM-DD");
- searchForm.value.entryDateEnd = dayjs(value[1]).format("YYYY-MM-DD");
+ if (searchForm.value.dateType === "day") {
+ searchForm.value.entryDate = value;
+ } else {
+ searchForm.value.entryDateStart = dayjs(value[0]).format("YYYY-MM-DD");
+ searchForm.value.entryDateEnd = dayjs(value[1]).format("YYYY-MM-DD");
+ }
+
} else {
+ searchForm.value.entryDate = undefined;
searchForm.value.entryDateStart = undefined;
searchForm.value.entryDateEnd = undefined;
}
- handleQuery();
+ reloadData()
};
+
const getList = () => {
tableLoading.value = true;
const params = { ...searchForm.value, ...page };
- params.dateType = dateType.value;
- params.entryDate = undefined
salesLedgerProductionAccountingList(params).then((res) => {
- tableLoading.value = false;
const records = res.data.records || [];
leftTableData.value = records;
page.total = res.data.total || 0;
- });
+ }).finally(() => {
+ tableLoading.value = false;
+ })
+
+
};
@@ -207,10 +238,11 @@
tableLoading1.value = true;
const params = { ...page1, ...searchForm.value };
salesLedgerProductionAccountingListProductionDetails(params).then((res) => {
- tableLoading1.value = false;
tableData.value = res.data.records || [];;
page1.total = res.data.total || 0;
- });
+ }).finally(() => {
+ tableLoading1.value = false;
+ })
};
// 鏋勫缓宸︿晶姹囨�诲彴璐︼紙鎸夌敓浜т汉姹囨�讳骇閲忋�佸伐璧勭瓑锛�
@@ -237,12 +269,26 @@
};
// 宸︿晶鏃�/鏈堝垏鎹�
-const handleDateTypeChange = () => {
+const handleDateTypeChange = (value) => {
// 杩欓噷鍙綔涓虹瓫閫夋潯浠剁殑涓�閮ㄥ垎锛岀洿鎺ラ噸鏂版煡璇㈠垪琛�
- page.current = 1;
- getList();
- handleQuery()
+ if (value === "day") {
+ searchForm.value.entryDate = dayjs().format("YYYY-MM-DD");
+ searchForm.value.dateRange = searchForm.value.entryDate
+ } else {
+ searchForm.value.entryDateStart = dayjs().startOf("month").format("YYYY-MM-DD");
+ searchForm.value.entryDateEnd = dayjs().endOf("month").format("YYYY-MM-DD");
+ searchForm.value.dateRange = [searchForm.value.entryDateStart, searchForm.value.entryDateEnd]
+ }
+
+ reloadData()
};
+
+const reloadData = () => {
+ page.current = 1;
+ page1.current = 1;
+ getList();
+ tableData.value = []
+}
// 鐐瑰嚮宸︿晶琛岋紝鍒峰彸渚ф槑缁嗭紙鎸夌敓浜т汉杩囨护锛�
const handleLeftRowClick = (row) => {
@@ -279,31 +325,27 @@
</script>
<style scoped lang="scss">
-.content-layout {
- display: flex;
- flex-direction: column;
- gap: 16px;
+.content-row {
+ width: 100%;
}
-.left-panel {
- flex: 0 0 50%;
- display: flex;
- flex-direction: column;
- gap: 10px;
+.content-row .left-col,
+.content-row .right-col {
+ margin-bottom: 16px;
}
+.left-panel,
.right-panel {
- flex: 0 0 50%;
display: flex;
flex-direction: column;
gap: 10px;
+ min-width: 0;
}
.left-header {
display: flex;
align-items: center;
gap: 12px;
- margin-bottom: 8px;
}
.left-title {
--
Gitblit v1.9.3