From 352fbcfaa09e261918f5a7b50bcd9ba15583b1aa Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期五, 13 三月 2026 13:55:16 +0800
Subject: [PATCH] 军泰伟业 1.销售退货逻辑完善与联调
---
src/views/salesManagement/deliveryLedger/index.vue | 2
src/views/salesManagement/returnOrder/components/formDia.vue | 125 +++++++++++---
src/views/salesManagement/returnOrder/components/detailDia.vue | 146 ++++++++++++++++++
src/views/salesManagement/returnOrder/index.vue | 165 ++++++--------------
4 files changed, 294 insertions(+), 144 deletions(-)
diff --git a/src/views/salesManagement/deliveryLedger/index.vue b/src/views/salesManagement/deliveryLedger/index.vue
index db21d42..2b1b0b0 100644
--- a/src/views/salesManagement/deliveryLedger/index.vue
+++ b/src/views/salesManagement/deliveryLedger/index.vue
@@ -639,6 +639,7 @@
'瀹℃牳涓�': '瀹℃牳涓�',
'瀹℃牳鎷掔粷': '瀹℃牳鎷掔粷',
'瀹℃牳閫氳繃': '瀹℃牳閫氳繃',
+ '宸插彂璐�': '宸插彂璐�',
'0': '寰呭鏍�',
'1': '瀹℃牳涓�',
'2': '瀹℃牳鎷掔粷',
@@ -669,6 +670,7 @@
'瀹℃牳涓�': 'warning',
'瀹℃牳鎷掔粷': 'danger',
'瀹℃牳閫氳繃': 'success',
+ '宸插彂璐�': 'success',
'0': 'info',
'1': 'warning',
'2': 'danger',
diff --git a/src/views/salesManagement/returnOrder/components/detailDia.vue b/src/views/salesManagement/returnOrder/components/detailDia.vue
new file mode 100644
index 0000000..9ff4e89
--- /dev/null
+++ b/src/views/salesManagement/returnOrder/components/detailDia.vue
@@ -0,0 +1,146 @@
+<template>
+ <el-dialog v-model="dialogVisible" title="閫�璐у崟璇︽儏" width="90%" @close="closeDia">
+ <div v-loading="loading">
+ <span class="descriptions">鍩烘湰淇℃伅</span>
+ <el-descriptions :column="4" border>
+ <el-descriptions-item label="閫�璐у崟鍙�">{{ detail.returnNo }}</el-descriptions-item>
+ <el-descriptions-item label="鍗曟嵁鐘舵��">
+ <el-tag :type="getStatusType(detail.status)">{{ getStatusText(detail.status) }}</el-tag>
+ </el-descriptions-item>
+ <el-descriptions-item label="瀹㈡埛鍚嶇О">{{ detail.customerName }}</el-descriptions-item>
+ <el-descriptions-item label="閿�鍞崟鍙�">{{ detail.salesContractNo }}</el-descriptions-item>
+ <el-descriptions-item label="涓氬姟鍛�">{{ detail.salesman }}</el-descriptions-item>
+ <el-descriptions-item label="鍏宠仈鍑哄簱鍗曞彿">{{ detail.shippingNo }}</el-descriptions-item>
+ <el-descriptions-item label="椤圭洰鍚嶇О">{{ detail.projectName }}</el-descriptions-item>
+ <el-descriptions-item label="鍒跺崟浜�">{{ detail.maker }}</el-descriptions-item>
+ <el-descriptions-item label="鍒跺崟鏃堕棿">{{ detail.makeTime }}</el-descriptions-item>
+ <el-descriptions-item label="閫�璐у師鍥�">{{ detail.returnReason }}</el-descriptions-item>
+ <el-descriptions-item label="閫�娆炬�婚">{{ detail.refundAmount }}</el-descriptions-item>
+ </el-descriptions>
+
+ <div style="padding-top: 20px">
+ <span class="descriptions">浜у搧鍒楄〃</span>
+ <PIMTable :isShowPagination="false" rowKey="id" :column="tableColumn" :tableData="tableData" />
+ </div>
+ </div>
+ <template #footer>
+ <div class="dialog-footer">
+ <el-button @click="closeDia">鍏抽棴</el-button>
+ </div>
+ </template>
+ </el-dialog>
+</template>
+
+<script setup>
+import { ref } from "vue";
+import { returnManagementGetById, returnManagementGetByShippingId } from "@/api/salesManagement/returnOrder.js";
+
+const dialogVisible = ref(false);
+const loading = ref(false);
+const detail = ref({});
+const tableData = ref([]);
+const availableProducts = ref([]);
+
+const tableColumn = [
+ {align: "center", label: "浜у搧澶х被", prop: "productCategory"},
+ {align: "center", label: "瑙勬牸鍨嬪彿", prop: "specificationModel"},
+ {align: "center", label: "鍗曚綅", prop: "unit", width: 80},
+ {align: "center", label: "鎬绘暟閲�", prop: "quantity", width: 120},
+ {align: "center", label: "宸查��璐ф暟閲�", prop: "totalReturnNum", width: 120},
+ {align: "center", label: "鏈��璐ф暟閲�", prop: "unQuantity", width: 120},
+ {align: "center", label: "閫�璐ф暟閲�", prop: "returnQuantity", width: 120},
+ {align: "center", label: "閫�璐т骇鍝佸崟浠�", prop: "price", width: 120},
+ {align: "center", label: "閫�璐т骇鍝侀噾棰�", prop: "amount", width: 120},
+ {align: "center", label: "鏄惁鏈夎川閲忛棶棰�", prop: "isQuality", width: 140, formatData: (v) => ({ "1": "鏄�", "2": "鍚�" }[String(v)] ?? v)},
+ {align: "center", label: "澶囨敞", prop: "remark", width: 150},
+];
+
+const getStatusType = (status) => {
+ const statusMap = {
+ 0: "warning",
+ 1: "success"
+ };
+ return statusMap[status] || "info";
+};
+
+const getStatusText = (status) => {
+ const statusMap = {
+ 0: "寰呭鐞�",
+ 1: "宸插鐞�"
+ };
+ return statusMap[status] || "鏈煡";
+};
+
+const openDialog = async (row) => {
+ if (!row?.id) return;
+ dialogVisible.value = true;
+ loading.value = true;
+ try {
+ const res = await returnManagementGetById({ returnManagementId: row.id });
+ detail.value = res?.data ?? res ?? {};
+
+ if (detail.value.shippingId) {
+ const productRes = await returnManagementGetByShippingId({ shippingId: detail.value.shippingId });
+ if (productRes.code === 200) {
+ availableProducts.value = productRes.data.productDtoData || [];
+ }
+ }
+
+ const list =
+ detail.value?.returnSaleProducts ||
+ detail.value?.returnSaleProductList ||
+ detail.value?.returnSaleProductDtoData ||
+ [];
+
+ tableData.value = Array.isArray(list) ? list.map(raw => {
+ const productId = raw?.returnSaleLedgerProductId ?? raw?.saleLedgerProductId ?? raw?.id;
+ const product = availableProducts.value.find((p) => p.id === productId);
+ const normalized = {
+ ...raw,
+ id: productId,
+ returnQuantity: Number(raw?.num ?? raw?.returnQuantity ?? 0),
+ price: Number(raw?.taxInclusiveUnitPrice ?? raw?.price ?? 0),
+ amount: Number(raw?.amount ?? 0).toFixed(2),
+ isQuality: raw?.isQuality ?? 2,
+ remark: raw?.remark ?? "",
+ };
+ return product ? { ...product, ...normalized } : normalized;
+ }) : [];
+ } catch (e) {
+ console.error("Failed to load detail", e);
+ } finally {
+ loading.value = false;
+ }
+};
+
+const closeDia = () => {
+ dialogVisible.value = false;
+ detail.value = {};
+ tableData.value = [];
+ availableProducts.value = [];
+};
+
+defineExpose({ openDialog });
+</script>
+
+<style scoped lang="scss">
+.descriptions {
+ margin-bottom: 20px;
+ display: inline-block;
+ font-size: 1rem;
+ font-weight: 600;
+ padding-left: 12px;
+ position: relative;
+}
+.descriptions::before {
+ content: "";
+ position: absolute;
+ left: 0;
+ top: 50%;
+ transform: translateY(-50%);
+ width: 4px;
+ height: 1rem;
+ background-color: #002FA7;
+ border-radius: 2px;
+}
+</style>
diff --git a/src/views/salesManagement/returnOrder/components/formDia.vue b/src/views/salesManagement/returnOrder/components/formDia.vue
index 82b3766..9f1bb9a 100644
--- a/src/views/salesManagement/returnOrder/components/formDia.vue
+++ b/src/views/salesManagement/returnOrder/components/formDia.vue
@@ -44,11 +44,6 @@
</el-form-item>
</el-col>
<el-col :span="4">
- <el-form-item label="椤圭洰闃舵锛�" prop="projectStage">
- <el-input v-model="form.projectStage" placeholder="椤圭洰闃舵" />
- </el-form-item>
- </el-col>
- <el-col :span="4">
<el-form-item label="鍒跺崟浜猴細" prop="maker">
<el-select v-model="form.maker" filterable placeholder="璇烽�夋嫨鍒跺崟浜�">
<el-option v-for="u in userOptions" :key="u.value" :label="u.label" :value="u.value" />
@@ -61,19 +56,21 @@
</el-form-item>
</el-col>
<el-col :span="4">
- <el-form-item label="缁撶畻浜猴細" prop="settler">
- <el-select v-model="form.settler" filterable placeholder="璇烽�夋嫨缁撶畻浜�">
- <el-option v-for="u in userOptions" :key="u.value" :label="u.label" :value="u.value" />
+ <el-form-item label="鐘舵�侊細" prop="status">
+ <el-select v-model="form.status" placeholder="璇烽�夋嫨鐘舵��">
+ <el-option label="寰呭鐞�" :value="0" />
+ <el-option label="宸插鐞�" :value="1" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="4">
- <el-form-item label="鐘舵�侊細" prop="status">
- <el-select v-model="form.status" placeholder="璇烽�夋嫨鐘舵��">
- <el-option label="寰呭鏍�" :value="0" />
- <el-option label="瀹℃牳涓�" :value="1" />
- <el-option label="宸插鏍�" :value="2" />
- </el-select>
+ <el-form-item label="閫�璐у師鍥狅細" prop="returnReason">
+ <el-input v-model="form.returnReason" placeholder="璇疯緭鍏ラ��璐у師鍥�" />
+ </el-form-item>
+ </el-col>
+ <el-col :span="4">
+ <el-form-item label="閫�娆炬�婚锛�" prop="refundAmount">
+ <el-input v-model="form.refundAmount" disabled placeholder="鑷姩璁$畻" />
</el-form-item>
</el-col>
</el-row>
@@ -92,6 +89,37 @@
placeholder="璇疯緭鍏�"
type="number"
@input="(val) => handleReturnQuantityChange(val, row)"
+ />
+ </template>
+ <template #price="{ row }">
+ <el-input
+ v-model="row.price"
+ style="width:100px"
+ placeholder="璇疯緭鍏�"
+ type="number"
+ @input="(val) => handlePriceChange(val, row)"
+ />
+ </template>
+ <template #amount="{ row }">
+ <el-input
+ v-model="row.amount"
+ style="width:100px"
+ placeholder="鑷姩璁$畻"
+ type="number"
+ disabled
+ />
+ </template>
+ <template #isQuality="{ row }">
+ <el-select v-model="row.isQuality" placeholder="璇烽�夋嫨" style="width:120px">
+ <el-option label="鏄�" :value="1" />
+ <el-option label="鍚�" :value="2" />
+ </el-select>
+ </template>
+ <template #remark="{ row }">
+ <el-input
+ v-model="row.remark"
+ style="width:130px"
+ placeholder="璇疯緭鍏�"
/>
</template>
<template #action="{ row, index }">
@@ -159,11 +187,11 @@
customerId: "",
shippingId: "",
projectId: "",
- projectStage: "",
maker: "",
makeTime: "",
- settler: "",
status: 0,
+ returnReason: "",
+ refundAmount: "",
},
rules: {
returnNo: [{
@@ -194,6 +222,10 @@
{align: "center", label: "宸查��璐ф暟閲�", prop: "totalReturnNum", width: 120 },
{align: "center", label: "鏈��璐ф暟閲�", prop: "unQuantity", width: 120 },
{align: "center", label: "閫�璐ф暟閲�", prop: "returnQuantity", dataType: "slot", slot: "returnQuantity", width: 120 },
+ {align: "center", label: "閫�璐т骇鍝佸崟浠�", prop: "price", dataType: "slot", slot: "price", width: 120 },
+ {align: "center", label: "閫�璐т骇鍝侀噾棰�", prop: "amount", dataType: "slot", slot: "amount", width: 120 },
+ {align: "center", label: "鏄惁鏈夎川閲忛棶棰�", prop: "isQuality", dataType: "slot", slot: "isQuality", width: 140 },
+ {align: "center", label: "澶囨敞", prop: "remark", dataType: "slot", slot: "remark", width: 150 },
{align: "center", label: "鎿嶄綔" , prop: "action", dataType: "slot", slot: "action", width: 120 },
]);
const tableData = ref([]);
@@ -215,8 +247,13 @@
id: productId,
returnSaleProductId,
returnSaleLedgerProductId: productId,
+ productModelId: raw?.productModelId,
num,
returnQuantity: Number.isFinite(num) ? num : 0,
+ price: Number(raw?.taxInclusiveUnitPrice ?? raw?.price ?? 0),
+ amount: Number(raw?.amount ?? 0).toFixed(2),
+ isQuality: raw?.isQuality ?? 2,
+ remark: raw?.remark ?? "",
};
};
@@ -248,6 +285,8 @@
return product ? { ...product, ...normalized } : normalized;
})
: [];
+
+ calculateTotalRefund();
};
const openDialog = async (type, row) => {
@@ -265,11 +304,11 @@
customerId: "",
shippingId: "",
projectId: "",
- projectStage: "",
maker: "",
makeTime: "",
- settler: "",
status: 0,
+ returnReason: "",
+ refundAmount: "",
});
form.value.maker = userStore.nickName || userStore.name || "";
form.value.makeTime = new Date().toISOString().replace('T', ' ').split('.')[0]; // Default to now
@@ -282,7 +321,13 @@
if (!valid) return;
const returnSaleProducts = (tableData.value || []).map(el => ({
returnSaleLedgerProductId: el.returnSaleLedgerProductId ?? el.id,
+ productModelId: el.productModelId,
+ unit: el.unit,
num: Number(el.num ?? el.returnQuantity ?? 0),
+ price: Number(el.price ?? 0),
+ amount: Number(el.amount ?? 0),
+ isQuality: el.isQuality ?? 2,
+ remark: el.remark ?? "",
id: operationType.value === "edit" ? (el.returnSaleProductId ?? "") : ""
}));
const payload = { ...form.value, returnSaleProducts };
@@ -374,7 +419,6 @@
if(res.code === 200){
// If backend returns project info, set it
if (res.data.projectId) form.value.projectId = res.data.projectId;
- if (res.data.projectStage) form.value.projectStage = res.data.projectStage;
// Store available products for selection
availableProducts.value = res.data.productDtoData || [];
@@ -388,7 +432,6 @@
const current = Number(val);
if (current > max) {
- // Need nextTick to ensure update if user typed too fast or pasted
proxy.$nextTick(() => {
row.returnQuantity = max;
row.num = max;
@@ -402,6 +445,29 @@
} else {
row.num = current;
}
+ calculateRowAmount(row);
+ calculateTotalRefund();
+};
+
+const handlePriceChange = (val, row) => {
+ if (val === "" || val === null) {
+ row.price = 0;
+ }
+ calculateRowAmount(row);
+ calculateTotalRefund();
+};
+
+const calculateRowAmount = (row) => {
+ const quantity = Number(row.returnQuantity || 0);
+ const price = Number(row.price || 0);
+ row.amount = (quantity * price).toFixed(2);
+};
+
+const calculateTotalRefund = () => {
+ const total = tableData.value.reduce((sum, row) => {
+ return sum + Number(row.amount || 0);
+ }, 0);
+ form.value.refundAmount = total.toFixed(2);
};
const availableProducts = ref([]);
@@ -429,26 +495,23 @@
// Removed checkSelectable to allow toggling existing items
const confirmProductSelection = () => {
- // Rebuild tableData based on selection, preserving existing data (returnQuantity)
const newTableData = [];
selectedProducts.value.forEach(product => {
- // Check if product was already in tableData to preserve user input
const existing = tableData.value.find(item => item.id === product.id);
if (existing) {
newTableData.push(existing);
} else {
- // Create new entry
newTableData.push({
- ...product, // Keep all product display fields (productName, model, unit, etc.)
-
- // Map to backend entity structure for submission
+ ...product,
returnSaleLedgerProductId: product.id,
- returnQuantity: 0, // Default input
- num: 0, // Backend quantity field
-
- // Ensure display fields are available if they come from 'product'
- // If product has different field names than tableColumn expects, map them here
+ productModelId: product.productModelId,
+ returnQuantity: 0,
+ num: 0,
+ price: Number(product.taxInclusiveUnitPrice ?? 0),
+ amount: "0.00",
+ isQuality: 2,
+ remark: "",
productName: product.productName,
specificationModel: product.specificationModel,
unit: product.unit,
diff --git a/src/views/salesManagement/returnOrder/index.vue b/src/views/salesManagement/returnOrder/index.vue
index a83dd24..5a5aa05 100644
--- a/src/views/salesManagement/returnOrder/index.vue
+++ b/src/views/salesManagement/returnOrder/index.vue
@@ -4,22 +4,22 @@
<el-form :model="searchForm" class="demo-form-inline">
<el-row :gutter="20">
<el-col :span="4">
- <el-form-item>
+ <el-form-item label="閫�璐у崟鍙�">
<el-input v-model="searchForm.returnNo" placeholder="璇疯緭鍏ラ��璐у崟鍙�" clearable />
</el-form-item>
</el-col>
<el-col :span="4">
- <el-form-item>
+ <el-form-item label="瀹㈡埛鍚嶇О">
<el-input v-model="searchForm.customerName" placeholder="瀹㈡埛鍚嶇О" clearable />
</el-form-item>
</el-col>
<el-col :span="4">
- <el-form-item>
+ <el-form-item label="閿�鍞崟鍙�">
<el-input v-model="searchForm.salesContractNo" placeholder="閿�鍞崟鍙�" clearable />
</el-form-item>
</el-col>
<el-col :span="4">
- <el-form-item>
+ <el-form-item label="鍏宠仈鍑哄簱鍗曞彿">
<el-input v-model="searchForm.shippingNo" placeholder="鍏宠仈鍑哄簱鍗曞彿" clearable />
</el-form-item>
</el-col>
@@ -33,46 +33,27 @@
</el-form>
</div>
<div class="table_list">
- <div class="table_header" style="display:flex;justify-content:space-between;align-items:center;">
- <div>
- <el-button type="primary" @click="openForm('add')">鏂板缓閿�鍞��璐�</el-button>
- </div>
- <div>
- <el-button type="danger" plain @click="handleDelete">鍒犻櫎</el-button>
- <el-button @click="columnsDialogVisible = true">鍒楄〃瀛楁</el-button>
- </div>
+ <div class="table_header" style="display: flex;justify-content: flex-end;margin-bottom: 10px;">
+ <el-button type="primary" @click="openForm('add')">鏂板缓閿�鍞��璐�</el-button>
+ <el-button type="danger" plain @click="handleDelete">鍒犻櫎</el-button>
</div>
<PIMTable
rowKey="id"
- :column="visibleColumns"
+ :column="tableColumn"
:tableData="tableData"
:page="page"
:isSelection="true"
@selection-change="handleSelectionChange"
:tableLoading="tableLoading"
@pagination="pagination"
- />
+ >
+ <template #status="{ row }">
+ <el-tag :type="getStatusType(row.status)">{{ getStatusText(row.status) }}</el-tag>
+ </template>
+ </PIMTable>
</div>
<form-dia ref="formDia" @close="handleQuery" />
-
- <el-dialog v-model="columnsDialogVisible" title="鑷畾涔夋樉绀哄垪椤�" width="600px">
- <div class="columns-tip">娉細鍒楄〃椤规樉绀轰笉寰楀皯浜�5椤癸紱鎷栧姩鍙充晶鎶婃墜鍙皟鏁存樉绀洪『搴�</div>
- <ul class="columns-list">
- <li v-for="(col, idx) in allColumns" :key="col.prop"
- class="columns-item"
- draggable="true"
- @dragstart="onDragStart(idx)"
- @dragover.prevent
- @drop="onDrop(idx)">
- <el-checkbox v-model="col.selected">{{ col.label }}</el-checkbox>
- <span class="drag-handle">鈮�</span>
- </li>
- </ul>
- <template #footer>
- <el-button @click="resetColumns">鎭㈠榛樿</el-button>
- <el-button type="primary" @click="saveColumns">淇濆瓨</el-button>
- </template>
- </el-dialog>
+ <detail-dia ref="detailDia" />
</div>
</template>
@@ -80,12 +61,18 @@
import { reactive, ref, toRefs, computed, getCurrentInstance, nextTick, onMounted } from "vue";
import { ElMessageBox } from "element-plus";
import FormDia from "./components/formDia.vue";
+import DetailDia from "./components/detailDia.vue";
import { returnManagementList, returnManagementDel, returnManagementHandle } from "@/api/salesManagement/returnOrder.js";
const { proxy } = getCurrentInstance();
const formDia = ref();
+const detailDia = ref();
const openForm = (type, row) => {
nextTick(() => formDia.value?.openDialog(type, row));
+};
+
+const openDetail = (row) => {
+ nextTick(() => detailDia.value?.openDialog(row));
};
const handleRowDelete = (row) => {
@@ -132,86 +119,36 @@
const { searchForm } = toRefs(data);
const documentStatusOptions = ref([
- { label: "寰呭鏍�", value: 0 },
- { label: "瀹℃牳涓�", value: 1 },
- { label: "宸插鏍�", value: 2 }
+ { label: "寰呭鐞�", value: 0 },
+ { label: "宸插鐞�", value: 1 }
]);
const defaultColumns = [
- { label: "閫�璐у崟鍙�", prop: "returnNo", minWidth: 160 },
- { label: "鍗曟嵁鐘舵��", prop: "status", minWidth: 120, formatData: (v) => ({ "0": "寰呭鏍�", "1": "瀹℃牳涓�", "2": "宸插鏍�" }[String(v)] ?? v) },
- { label: "鍒跺崟鏃堕棿", prop: "makeTime", minWidth: 170 },
- { label: "瀹㈡埛鍚嶇О", prop: "customerName", minWidth: 220 },
- { label: "閿�鍞崟鍙�", prop: "salesContractNo", minWidth: 160 },
- { label: "涓氬姟鍛�", prop: "salesman", minWidth: 120 },
- { label: "鍏宠仈鍑哄簱鍗曞彿", prop: "shippingNo", minWidth: 170 },
- { label: "椤圭洰鍚嶇О", prop: "projectName", minWidth: 180 },
- { label: "椤圭洰闃舵", prop: "projectStage", minWidth: 120 },
- { label: "鍒跺崟浜�", prop: "maker", minWidth: 120 },
- { label: "缁撶畻浜�", prop: "settler", minWidth: 120 },
+ { label: "閫�璐у崟鍙�", prop: "returnNo", width: 160 },
+ { label: "鍗曟嵁鐘舵��", prop: "status", width: 90, dataType: "slot", slot: "status" },
+ { label: "鍒跺崟鏃堕棿", prop: "makeTime", width: 170 },
+ { label: "瀹㈡埛鍚嶇О", prop: "customerName", width: 220 },
+ { label: "閿�鍞崟鍙�", prop: "salesContractNo", width: 160 },
+ { label: "涓氬姟鍛�", prop: "salesman", width: 120 },
+ { label: "鍏宠仈鍑哄簱鍗曞彿", prop: "shippingNo", width: 170 },
+ { label: "椤圭洰鍚嶇О", prop: "projectName", width: 180 },
+ { label: "鍒跺崟浜�", prop: "maker", width: 120 },
{
label: "鎿嶄綔",
prop: "operation",
dataType: "action",
align: "center",
fixed: "right",
- width: 160,
+ width: 240,
operation: [
{ name: "缂栬緫", disabled: (row) => row.status !== 0, type: "text", clickFun: (row) => openForm("edit", row) },
- { name: "澶勭悊", disabled: (row) => row.status !== 0, type: "text", clickFun: (row) => handleRowHandle(row) },
+ { name: "閫�娆惧鐞�", disabled: (row) => row.status !== 0, type: "text", clickFun: (row) => handleRowHandle(row) },
+ { name: "璇︽儏", type: "text", clickFun: (row) => openDetail(row) },
{ name: "鍒犻櫎", disabled: (row) => row.status !== 0, type: "text", clickFun: (row) => handleRowDelete(row) },
],
},
];
-const COLUMNS_KEY = "return_order_columns_v2";
-const columnsDialogVisible = ref(false);
-const allColumns = ref([]);
-
-const initColumns = () => {
- const saved = localStorage.getItem(COLUMNS_KEY);
- if (saved) {
- try {
- const parsed = JSON.parse(saved);
- // 鍚堝苟榛樿鍒椾笌宸蹭繚瀛橀厤缃紝閬垮厤鍚庣画鏂板鍒椾涪澶�
- const map = new Map(parsed.map(c => [c.prop, c]));
- allColumns.value = defaultColumns.map(d => {
- const found = map.get(d.prop);
- return { ...d, selected: found ? !!found.selected : true };
- });
- // 浠ヤ繚瀛樼殑椤哄簭涓哄噯
- const order = parsed.map(p => p.prop);
- allColumns.value.sort((a, b) => order.indexOf(a.prop) - order.indexOf(b.prop));
- return;
- } catch {}
- }
- allColumns.value = defaultColumns.map(c => ({ ...c, selected: true }));
-};
-initColumns();
-
-const visibleColumns = computed(() => allColumns.value.filter(c => c.selected));
-
-let dragFrom = -1;
-const onDragStart = (idx) => {
- dragFrom = idx;
-};
-const onDrop = (to) => {
- if (dragFrom < 0 || dragFrom === to) return;
- const arr = [...allColumns.value];
- const [moved] = arr.splice(dragFrom, 1);
- arr.splice(to, 0, moved);
- allColumns.value = arr;
- dragFrom = -1;
-};
-
-const resetColumns = () => {
- allColumns.value = defaultColumns.map(c => ({ ...c, selected: true }));
- localStorage.removeItem(COLUMNS_KEY);
-};
-const saveColumns = () => {
- const toSave = allColumns.value.map(({ label, prop, width, selected }) => ({ label, prop, width, selected }));
- localStorage.setItem(COLUMNS_KEY, JSON.stringify(toSave));
- columnsDialogVisible.value = false;
-};
+const tableColumn = defaultColumns;
const tableData = ref([]);
const tableLoading = ref(false);
@@ -221,6 +158,7 @@
const handleReset = () => {
Object.keys(searchForm.value).forEach(k => searchForm.value[k] = "");
+ handleQuery();
};
const handleSelectionChange = (selection) => {
selectedRows.value = selection;
@@ -265,6 +203,22 @@
});
};
+const getStatusType = (status) => {
+ const statusMap = {
+ 0: "warning",
+ 1: "success"
+ };
+ return statusMap[status] || "info";
+};
+
+const getStatusText = (status) => {
+ const statusMap = {
+ 0: "寰呭鐞�",
+ 1: "宸插鐞�"
+ };
+ return statusMap[status] || "鏈煡";
+};
+
onMounted(() => {
getList();
});
@@ -276,20 +230,5 @@
padding: 1rem 1rem 0 1rem;
border: 8px;
border-radius: 16px;
-}
-.table_list {
- height: calc(100vh - 230px);
- min-height: 360px;
- background: #fff;
- margin-top: 20px;
- display: flex;
- flex-direction: column;
-}
-.columns-tip{color:#909399;margin-bottom:10px;font-size:12px;}
-.columns-list{list-style:none;padding:0;margin:0;max-height:360px;overflow:auto;}
-.columns-item{display:flex;justify-content:space-between;align-items:center;padding:8px 10px;border:1px solid #f0f0f0;border-radius:6px;margin-bottom:8px;cursor:move;background:#fff;}
-.columns-item .drag-handle{color:#909399;padding-left:12px;user-select:none;}
-.table_header {
- margin-bottom: 15px;
}
</style>
--
Gitblit v1.9.3