From 4f0517d5c30ec2962c16883f0552cfa6db2034dc Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期五, 30 十月 2026 10:08:37 +0800
Subject: [PATCH] feat: 设备台账启用状态、审批签核展示与导入交互修复
---
src/api/salesManagement/salesLedger.js | 2
src/views/officeProcessAutomation/ApproveManage/approve-list/approveListConstants.js | 5 +
src/views/salesManagement/salesLedger/index.vue | 8 +-
src/views/equipmentManagement/ledger/index.vue | 92 +++++++++++++++++++++++++++---
src/views/equipmentManagement/ledger/Form.vue | 11 ++-
src/views/procurementManagement/paymentLedger/index.vue | 9 +-
6 files changed, 101 insertions(+), 26 deletions(-)
diff --git a/src/api/salesManagement/salesLedger.js b/src/api/salesManagement/salesLedger.js
index b9ef283..1c95fd0 100644
--- a/src/api/salesManagement/salesLedger.js
+++ b/src/api/salesManagement/salesLedger.js
@@ -118,7 +118,7 @@
});
}
-// 鍒涘缓妗嗘灦璁㈠崟
+// 鍒涘缓鍙戣揣璁㈠崟
export function createFrameworkOrder(query) {
return request({
url: "/sales/ledger/createFrameworkOrder",
diff --git a/src/views/equipmentManagement/ledger/Form.vue b/src/views/equipmentManagement/ledger/Form.vue
index 46d5c98..f820cdc 100644
--- a/src/views/equipmentManagement/ledger/Form.vue
+++ b/src/views/equipmentManagement/ledger/Form.vue
@@ -57,8 +57,11 @@
</el-form-item>
</el-col>
<el-col :span="12">
- <el-form-item label="瀛樻斁浣嶇疆" prop="storageLocation">
- <el-input v-model="form.storageLocation" placeholder="璇疯緭鍏ュ瓨鏀句綅缃�" />
+ <el-form-item label="鍚敤鐘舵��" prop="isEnabled">
+ <el-radio-group v-model="form.isEnabled">
+ <el-radio :value="1">鍚敤</el-radio>
+ <el-radio :value="0">鍋滅敤</el-radio>
+ </el-radio-group>
</el-form-item>
</el-col>
<el-col :span="12">
@@ -246,7 +249,7 @@
type: undefined, // 璁惧绫诲瀷
areaId: undefined, // 鎵�灞炲尯鍩�
supplierName: undefined, // 渚涘簲鍟�
- storageLocation: undefined, // 瀛樻斁浣嶇疆
+ isEnabled: 1, // 鍚敤鐘舵�� 1-鍚敤 0-鍋滅敤锛屽仠鐢ㄨ澶囦笉鍙備笌宸℃
isDepr: 2, // 鏄惁鍚敤鎶樻棫 1-鏄� 2-鍚�
annualDepreciationAmount: undefined, // 姣忓勾鎶樻棫閲戦
unit: undefined, // 鍗曚綅
@@ -292,7 +295,7 @@
form.type = data.type;
form.supplierName = data.supplierName;
form.areaId = data.areaId;
- form.storageLocation = data.storageLocation;
+ form.isEnabled = data.isEnabled ?? 1;
form.isDepr = data.isDepr;
form.annualDepreciationAmount = data.annualDepreciationAmount;
form.unit = data.unit;
diff --git a/src/views/equipmentManagement/ledger/index.vue b/src/views/equipmentManagement/ledger/index.vue
index 95baaca..ceb66b1 100644
--- a/src/views/equipmentManagement/ledger/index.vue
+++ b/src/views/equipmentManagement/ledger/index.vue
@@ -140,6 +140,11 @@
@selection-change="handleSelectionChange"
@pagination="changePage"
>
+ <template #isEnabled="{ row }">
+ <el-tag :type="row.isEnabled === 0 ? 'info' : 'success'" size="small">
+ {{ row.isEnabled === 0 ? '鍋滅敤' : '鍚敤' }}
+ </el-tag>
+ </template>
</PIMTable>
</div>
</div>
@@ -166,6 +171,9 @@
:disabled="upload.isUploading"
:on-progress="handleFileUploadProgress"
:on-success="handleFileSuccess"
+ :on-error="handleFileError"
+ :on-change="handleFileChange"
+ :on-exceed="handleFileExceed"
:auto-upload="false"
drag
>
@@ -202,7 +210,11 @@
<el-descriptions-item label="璁惧绫诲瀷">{{ detailData.type }}</el-descriptions-item>
<el-descriptions-item label="渚涘簲鍟�">{{ detailData.supplierName }}</el-descriptions-item>
<el-descriptions-item label="鎵�灞炲尯鍩�">{{ detailData.areaName }}</el-descriptions-item>
- <el-descriptions-item label="瀛樻斁浣嶇疆">{{ detailData.storageLocation }}</el-descriptions-item>
+ <el-descriptions-item label="鍚敤鐘舵��">
+ <el-tag :type="detailData.isEnabled === 0 ? 'info' : 'success'" size="small">
+ {{ detailData.isEnabled === 0 ? '鍋滅敤' : '鍚敤' }}
+ </el-tag>
+ </el-descriptions-item>
<el-descriptions-item label="鍗曚綅">{{ detailData.unit }}</el-descriptions-item>
<el-descriptions-item label="鏁伴噺">{{ detailData.number }}</el-descriptions-item>
<el-descriptions-item label="鍚敤鎶樻棫">{{ detailData.isDepr === 1 ? '鏄�' : '鍚�' }}</el-descriptions-item>
@@ -287,7 +299,7 @@
editDeviceArea,
delDeviceArea,
} from "@/api/equipmentManagement/area";
-import { onMounted, getCurrentInstance, ref, reactive, computed } from "vue";
+import { onMounted, getCurrentInstance, ref, reactive, computed, nextTick } from "vue";
import Modal from "./Modal.vue";
import { ElMessageBox, ElMessage } from "element-plus";
import { UploadFilled } from "@element-plus/icons-vue";
@@ -339,6 +351,7 @@
open: false,
title: "",
isUploading: false,
+ file: null,
headers: { Authorization: "Bearer " + getToken() },
url: import.meta.env.VITE_APP_BASE_API + "/device/ledger/import",
});
@@ -387,8 +400,11 @@
prop: "supplierName",
},
{
- label: "瀛樻斁浣嶇疆",
- prop: "storageLocation",
+ label: "鍚敤鐘舵��",
+ prop: "isEnabled",
+ dataType: "slot",
+ slot: "isEnabled",
+ width: 100,
},
{
label: "鏁伴噺",
@@ -670,7 +686,13 @@
const handleImport = () => {
upload.title = "璁惧鍙拌处瀵煎叆";
+ upload.isUploading = false;
+ upload.file = null;
upload.open = true;
+ // 娓呯悊涓婁竴娆″け璐�/鎴愬姛閬楃暀鐨勬枃浠讹紝閬垮厤鍑虹幇宸查�夋枃浠跺嵈鏃犳硶鍐嶆閫夋嫨鐨勬儏鍐�
+ nextTick(() => {
+ proxy.$refs["uploadRef"] && proxy.$refs["uploadRef"].clearFiles();
+ });
};
const importTemplate = () => {
@@ -685,21 +707,71 @@
upload.isUploading = true;
};
-const handleFileSuccess = (response, file, fileList) => {
- upload.open = false;
- upload.isUploading = false;
- proxy.$refs["uploadRef"].handleRemove(file);
+const handleFileChange = (file) => {
+ // 鍙褰曞緟涓婁紶鐨勬枃浠讹紱鍒犻櫎/鎴愬姛/澶辫触鏃� Element Plus 涔熶細瑙﹀彂 change锛屼笉鑳借鐩栨垚鏃ф枃浠�
+ upload.file = file && file.status === "ready" ? file.raw : null;
+};
+
+const handleFileExceed = (files) => {
+ // 鍙厑璁搁�夋嫨涓�涓枃浠讹紝鍚庨�夌殑鏂囦欢瑕嗙洊鍏堥�夌殑鏂囦欢
+ proxy.$refs["uploadRef"].clearFiles();
+ proxy.$refs["uploadRef"].handleStart(files[0]);
+};
+
+const showImportResult = (msg) => {
proxy.$alert(
"<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" +
- response.msg +
+ msg +
"</div>",
"瀵煎叆缁撴灉",
{ dangerouslyUseHTMLString: true }
);
- getTableData();
+};
+
+const handleFileSuccess = (response, file, fileList) => {
+ upload.open = false;
+ upload.isUploading = false;
+ upload.file = null;
+ proxy.$refs["uploadRef"].handleRemove(file);
+ const success = response && response.code === 200;
+ showImportResult((response && response.msg) || (success ? "瀵煎叆鎴愬姛" : "瀵煎叆澶辫触"));
+ if (success) {
+ getTableData();
+ }
+};
+
+// 缃戠粶寮傚父/鍚庣杩斿洖闈� 2xx 鏃惰Е鍙戯紝蹇呴』澶嶄綅涓婁紶鐘舵�佸苟缁欏嚭鎻愮ず锛屽惁鍒欏啀娆$偣鍑烩�滅‘瀹氣�濅笉浼氭湁浠讳綍鍙嶅簲
+const handleFileError = (error, file, fileList) => {
+ upload.isUploading = false;
+ upload.file = null;
+ // 绉婚櫎澶辫触鏂囦欢锛屽惁鍒欐枃浠剁姸鎬佷负 fail锛屽啀娆$偣鈥滅‘瀹氣�濅笉浼氶噸鏂颁笂浼�
+ try {
+ proxy.$refs["uploadRef"].handleRemove(file);
+ } catch (e) {
+ // ignore
+ }
+ let msg = "瀵煎叆澶辫触锛岃妫�鏌ョ綉缁滄垨绋嶅悗閲嶈瘯";
+ try {
+ const data = error && error.message ? JSON.parse(error.message) : null;
+ if (data && data.msg) {
+ msg = data.msg;
+ }
+ } catch (e) {
+ // 闈� JSON 鍝嶅簲锛屼娇鐢ㄩ粯璁ゆ彁绀�
+ }
+ showImportResult(msg);
};
const submitFileForm = () => {
+ if (upload.isUploading) {
+ ElMessage.warning("鏂囦欢涓婁紶涓紝璇风◢鍊�");
+ return;
+ }
+ if (!upload.file) {
+ ElMessage.warning("璇峰厛閫夋嫨瑕佸鍏ョ殑 Excel 鏂囦欢");
+ return;
+ }
+ upload.isUploading = true;
proxy.$refs["uploadRef"].submit();
};
diff --git a/src/views/officeProcessAutomation/ApproveManage/approve-list/approveListConstants.js b/src/views/officeProcessAutomation/ApproveManage/approve-list/approveListConstants.js
index e2f1e45..e9d630d 100644
--- a/src/views/officeProcessAutomation/ApproveManage/approve-list/approveListConstants.js
+++ b/src/views/officeProcessAutomation/ApproveManage/approve-list/approveListConstants.js
@@ -186,8 +186,9 @@
templateId: t.templateId,
approverId: t.approverId,
approverName: t.approverName || "",
- status: t.status,
- approveComment: t.approveComment,
+ // 鍚庣瀛楁涓� taskStatus / comment锛屽吋瀹规棫鐨� status / approveComment
+ status: t.status ?? t.taskStatus,
+ approveComment: t.approveComment ?? t.comment,
approveTime: t.approveTime,
});
node.tasks.push(t);
diff --git a/src/views/procurementManagement/paymentLedger/index.vue b/src/views/procurementManagement/paymentLedger/index.vue
index decf8de..89be166 100644
--- a/src/views/procurementManagement/paymentLedger/index.vue
+++ b/src/views/procurementManagement/paymentLedger/index.vue
@@ -127,12 +127,12 @@
v-model="paymentForm.paymentAmount"
:precision="2"
:min="0.01"
- :max="Math.max(0, (Number(currentPaymentRow.payableAmount) || 0) - (Number(currentPaymentRow.paymentAmount) || 0))"
+ :max="Math.max(0, Number(currentPaymentRow.payableAmount) || 0)"
placeholder="璇疯緭鍏ヤ粯娆鹃噾棰�"
controls-position="right"
/>
<div style="color: #e6a23c; font-size: 12px; margin-top: 4px">
- 褰撳墠鍙粯娆句綑棰濓細{{ (Number(currentPaymentRow.payableAmount) || 0) - (Number(currentPaymentRow.paymentAmount) || 0) > 0 ? ((Number(currentPaymentRow.payableAmount) || 0) - (Number(currentPaymentRow.paymentAmount) || 0)).toFixed(2) : '0.00' }} 鍏�
+ 褰撳墠鍙粯娆句綑棰濓細{{ Number(currentPaymentRow.payableAmount) > 0 ? Number(currentPaymentRow.payableAmount).toFixed(2) : '0.00' }} 鍏�
</div>
</el-form-item>
<el-form-item label="浠樻鏂瑰紡锛�" prop="paymentMethod">
@@ -277,9 +277,8 @@
if (!value) {
return callback(new Error("璇疯緭鍏ヤ粯娆鹃噾棰�"));
}
- const remaining =
- (Number(currentPaymentRow.value.payableAmount) || 0) -
- (Number(currentPaymentRow.value.paymentAmount) || 0);
+ // 搴斾粯閲戦宸叉墸鍑忚繃绱浠樻锛屾澶勭洿鎺ヤ娇鐢ㄥ墿浣欏簲浠橀噾棰�
+ const remaining = Number(currentPaymentRow.value.payableAmount) || 0;
if (value > remaining) {
return callback(new Error(`浠樻閲戦涓嶈兘瓒呰繃鍙粯娆句綑棰� ${remaining.toFixed(2)} 鍏僠));
}
diff --git a/src/views/salesManagement/salesLedger/index.vue b/src/views/salesManagement/salesLedger/index.vue
index 0c25737..007c4c2 100644
--- a/src/views/salesManagement/salesLedger/index.vue
+++ b/src/views/salesManagement/salesLedger/index.vue
@@ -282,7 +282,7 @@
link
type="success"
@click="openFrameworkOrderDialog(scope.row)"
- >鍒涘缓妗嗘灦璁㈠崟
+ >鍒涘缓鍙戣揣璁㈠崟
</el-button>
<el-button
v-if="scope.row.contractType === 2"
@@ -1264,10 +1264,10 @@
</div>
</template>
</el-dialog>
- <!-- 鍒涘缓妗嗘灦璁㈠崟寮圭獥 -->
+ <!-- 鍒涘缓鍙戣揣璁㈠崟寮圭獥 -->
<el-dialog
v-model="frameworkOrderDialogVisible"
- title="鍒涘缓妗嗘灦璁㈠崟"
+ title="鍒涘缓鍙戣揣璁㈠崟"
width="70%"
:close-on-click-modal="false"
>
@@ -3504,7 +3504,7 @@
deliveryDate: p.deliveryDate,
})),
});
- proxy.$modal.msgSuccess("妗嗘灦璁㈠崟鍒涘缓鎴愬姛");
+ proxy.$modal.msgSuccess("鍙戣揣璁㈠崟鍒涘缓鎴愬姛");
frameworkOrderDialogVisible.value = false;
} catch (e) {
// 閿欒宸茬敱璇锋眰鎷︽埅鍣ㄧ粺涓�鎻愮ず
--
Gitblit v1.9.3