From f9608b880eb17ed232b1dc9c216ae57a7fb5b4a9 Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期一, 21 九月 2026 18:06:58 +0800
Subject: [PATCH] 新疆-融邦环保 1.「油品出库就生成出库台账,不用区分出库类别了」+「代储出库也需要出库扣库存,选批号,生成发货台账」 2.车辆管理与出库残油联动
---
src/views/basicData/customerFileOpenSea/index.vue | 167 +++++++++++++++++++++++++++++++++++++++++--------------
1 files changed, 123 insertions(+), 44 deletions(-)
diff --git a/src/views/basicData/customerFileOpenSea/index.vue b/src/views/basicData/customerFileOpenSea/index.vue
index 71cc051..e5a7ef4 100644
--- a/src/views/basicData/customerFileOpenSea/index.vue
+++ b/src/views/basicData/customerFileOpenSea/index.vue
@@ -1,6 +1,6 @@
<template>
<div class="app-container">
- <div class="search_form">
+ <div class="search_form" style="margin-bottom: 20px;">
<div>
<span class="search_title">瀹㈡埛鍚嶇О锛�</span>
<el-input v-model="searchForm.customerName"
@@ -9,17 +9,6 @@
@change="handleQuery"
clearable
:prefix-icon="Search" />
- <span class="search_title">瀹㈡埛鍒嗙被锛�</span>
- <el-select v-model="searchForm.customerType"
- placeholder="璇烽�夋嫨"
- style="width: 240px"
- clearable
- @change="handleQuery">
- <el-option label="闆跺敭瀹㈡埛"
- value="闆跺敭瀹㈡埛" />
- <el-option label="杩涢攢鍟嗗鎴�"
- value="杩涢攢鍟嗗鎴�" />
- </el-select>
<el-button type="primary"
@click="handleQuery"
style="margin-left: 10px">鎼滅储</el-button>
@@ -37,6 +26,17 @@
@click="handleDelete">鍒犻櫎</el-button>
</div>
</div>
+ <!-- 鎸夈�屽鎴峰垎绫汇�嶆媶椤电锛涖�屽叏閮ㄣ�嶄笉甯﹀垎绫绘煡璇紝淇濊瘉杩樻病琛ュ垎绫荤殑鑰佹暟鎹篃鑳界湅鍒� -->
+ <el-tabs v-model="activeTab"
+ @tab-change="handleTabChange"
+ class="customer-tabs">
+ <el-tab-pane label="鍏ㄩ儴"
+ name="鍏ㄩ儴" />
+ <el-tab-pane label="閿�鍞鎴�"
+ name="閿�鍞鎴�" />
+ <el-tab-pane label="浠e偍瀹㈡埛"
+ name="浠e偍瀹㈡埛" />
+ </el-tabs>
<div class="table_list">
<PIMTable rowKey="id"
:column="tableColumn"
@@ -125,10 +125,10 @@
<el-select v-model="form.customerType"
placeholder="璇烽�夋嫨"
clearable>
- <el-option label="闆跺敭瀹㈡埛"
- value="闆跺敭瀹㈡埛" />
- <el-option label="杩涢攢鍟嗗鎴�"
- value="杩涢攢鍟嗗鎴�" />
+ <el-option v-for="dict in customer_type"
+ :key="dict.value"
+ :label="dict.label"
+ :value="dict.value" />
</el-select>
</el-form-item>
</el-col>
@@ -280,7 +280,8 @@
:limit="1"
accept=".xlsx, .xls"
:headers="upload.headers"
- :action="upload.url + '?updateSupport=' + upload.updateSupport"
+ :action="upload.url"
+ :data="upload.data"
:disabled="upload.isUploading"
:before-upload="upload.beforeUpload"
:on-progress="upload.onProgress"
@@ -678,29 +679,40 @@
</template>
<script setup>
- import { onMounted, ref, reactive, getCurrentInstance, toRefs } from "vue";
+ import {
+ onMounted,
+ ref,
+ reactive,
+ getCurrentInstance,
+ toRefs,
+ watch,
+ } from "vue";
import { Search, Paperclip, Upload } from "@element-plus/icons-vue";
import {
- addCustomer,
- addCustomerPrivatePool,
- delCustomerPrivatePool,
- delCustomer,
- getCustomer,
- shareCustomer,
- listCustomer,
- updateCustomer,
addCustomerFollow,
updateCustomerFollow,
delCustomerFollow,
addReturnVisit,
getReturnVisit,
} from "@/api/basicData/customerFile.js";
+ import {
+ listCustomer,
+ addCustomer,
+ delCustomer,
+ updateCustomer,
+ getCustomer,
+ assignCustomer,
+ recycleCustomer,
+ shareCustomer,
+ } from "@/api/basicData/customer.js";
+
import { ElMessageBox } from "element-plus";
import { userListNoPage } from "@/api/system/user.js";
import useUserStore from "@/store/modules/user";
import { getToken } from "@/utils/auth.js";
const { proxy } = getCurrentInstance();
const userStore = useUserStore();
+ const { customer_type } = proxy.useDict("customer_type");
const assignDialogVisible = ref(false);
const assignFormRef = ref();
const assignForm = reactive({
@@ -805,6 +817,7 @@
label: "瀹㈡埛鍒嗙被",
prop: "customerType",
width: 120,
+ formatData: value => proxy.selectDictLabel(customer_type.value, value),
},
{
label: "瀹㈡埛鍚嶇О",
@@ -913,9 +926,14 @@
{
name: "鍥炴敹",
type: "text",
+ disabled: row => isCustomerRecoveryLocked(row),
showHide: row => row.usageStatus == 1,
clickFun: row => {
- recycleCustomer(row);
+ if (isCustomerRecoveryLocked(row)) {
+ proxy.$modal.msgWarning("宸查鐢ㄥ苟涓旇閿�鍞ā鍧楀紩鐢ㄧ殑鍏捣瀹㈡埛涓嶈兘鍥炴敹");
+ return;
+ }
+ recycle(row);
},
},
{
@@ -929,7 +947,12 @@
{
name: "缂栬緫",
type: "text",
- clickFun: row => {
+ disabled: row => isCustomerEditLocked(row),
+ clickFun: row => {
+ if (isCustomerEditLocked(row)) {
+ proxy.$modal.msgWarning("宸查鐢ㄥ苟涓旇閿�鍞ā鍧楀紩鐢ㄧ殑鍏捣瀹㈡埛涓嶈兘缂栬緫");
+ return;
+ }
openForm("edit", row);
},
},
@@ -969,7 +992,7 @@
const data = reactive({
searchForm: {
customerName: "",
- customerType: "",
+ type: 1
},
form: {
customerName: "",
@@ -984,6 +1007,7 @@
bankAccount: "",
bankCode: "",
customerType: "",
+ type: 1
},
rules: {
customerName: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
@@ -1015,6 +1039,9 @@
headers: { Authorization: "Bearer " + getToken() },
// 涓婁紶鐨勫湴鍧�
url: import.meta.env.VITE_APP_BASE_API + "/basic/customer/importData",
+ data: {
+ type: 1
+ },
// 鏂囦欢涓婁紶鍓嶇殑鍥炶皟
beforeUpload: file => {
console.log("鏂囦欢鍗冲皢涓婁紶", file);
@@ -1083,15 +1110,38 @@
page.size = obj.limit;
getList();
};
+ // 鍏ㄩ儴 / 閿�鍞鎴� / 浠e偍瀹㈡埛涓変釜椤电锛屽悇鑷甫瀹㈡埛鍒嗙被鏌ュ悓涓�涓垪琛ㄦ帴鍙�
+ const activeTab = ref("鍏ㄩ儴");
+ // 銆屽叏閮ㄣ�嶄笉浼犲垎绫伙紙undefined 浼氳 axios 涓㈡帀锛夛紝閿�鍞�/浠e偍鎸夊瓧鍏稿�肩瓫锛�
+ // 瀛楀吀鐨� value 鏈繀灏辨槸涓枃鏍囩锛屾寜 label 鍙嶆煡鐪熷疄鍙栧�煎啀浼犳帴鍙�
+ const activeCustomerType = () => {
+ if (activeTab.value === "鍏ㄩ儴") {
+ return undefined;
+ }
+ const list = customer_type.value || [];
+ const hit = list.find(item => item.label === activeTab.value);
+ return hit ? hit.value : activeTab.value;
+ };
+ // 椤电鍒囨崲锛氭崲瀹㈡埛鍒嗙被閲嶆柊鏌ュ垪琛�
+ const handleTabChange = () => {
+ page.current = 1;
+ getList();
+ };
const getList = () => {
tableLoading.value = true;
const { total, ...queryPage } = page;
- listCustomer({ ...searchForm.value, ...queryPage }).then(res => {
+ listCustomer({
+ ...searchForm.value,
+ ...queryPage,
+ customerType: activeCustomerType(),
+ }).then(res => {
tableLoading.value = false;
tableData.value = res.data.records;
page.total = res.data.total;
});
};
+ // 瀛楀吀鏄紓姝ユ媺鐨勶紝鍒拌揪鍚庢寜鐪熷疄瀛楀吀鍊奸噸鏌ヤ竴娆★紝閬垮厤棣栧睆鐢ㄤ腑鏂囨爣绛剧瓫涓嶅埌鏁版嵁
+ watch(customer_type, () => getList());
// 琛ㄦ牸閫夋嫨鏁版嵁
const handleSelectionChange = selection => {
selectedRows.value = selection;
@@ -1112,6 +1162,10 @@
}
// 鎵撳紑寮规
const openForm = (type, row) => {
+ if (type === "edit" && isCustomerEditLocked(row)) {
+ proxy.$modal.msgWarning("宸查鐢ㄥ苟涓旇閿�鍞ā鍧楀紩鐢ㄧ殑鍏捣瀹㈡埛涓嶈兘缂栬緫");
+ return;
+ }
operationType.value = type;
form.value = {};
form.value.maintainer = userStore.nickName;
@@ -1122,6 +1176,9 @@
},
];
form.value.maintenanceTime = getCurrentDate();
+ form.value.type = 1;
+ // 瀹㈡埛鍒嗙被榛樿璺熼殢褰撳墠椤电
+ form.value.customerType = activeCustomerType();
userListNoPage().then(res => {
userList.value = res.data;
});
@@ -1140,6 +1197,11 @@
}
dialogFormVisible.value = true;
};
+ const isCustomerSalesReferenced = row => Number(row?.salesReferenceFlag || 0) === 1;
+ const isCustomerRecoveryLocked = row => Number(row?.usageStatus || 0) === 1 && isCustomerSalesReferenced(row);
+ const isCustomerEditLocked = row => isCustomerSalesReferenced(row) && (
+ Number(row?.type) === 0 || (Number(row?.type) === 1 && Number(row?.usageStatus || 0) === 1)
+ );
// 鎻愪氦琛ㄥ崟
const submitForm = () => {
proxy.$refs["formRef"].validate(valid => {
@@ -1214,7 +1276,7 @@
const openShareDialog = row => {
shareForm.id = row.id;
shareForm.customerName = row.customerName;
- shareForm.boundIds = [];
+ shareForm.boundIds = row.userIds || [];
ensureUserList().then(() => {
shareDialogVisible.value = true;
});
@@ -1231,9 +1293,9 @@
if (!valid) {
return;
}
- addCustomerPrivatePool({
- customerId: assignForm.id,
- boundId: assignForm.boundId,
+ assignCustomer({
+ id: assignForm.id,
+ usageUser: assignForm.boundId,
}).then(() => {
proxy.$modal.msgSuccess("鍒嗛厤鎴愬姛");
closeAssignDialog();
@@ -1247,8 +1309,8 @@
return;
}
shareCustomer({
- customerId: shareForm.id,
- boundIds: shareForm.boundIds,
+ id: shareForm.id,
+ userIds: shareForm.boundIds,
}).then(() => {
proxy.$modal.msgSuccess("鍏变韩鎴愬姛");
closeShareDialog();
@@ -1256,18 +1318,17 @@
});
});
};
- const recycleCustomer = row => {
+ const recycle = row => {
ElMessageBox.confirm("纭鍥炴敹瀹㈡埛鈥�" + row.customerName + "鈥濆悧锛�", "鍥炴敹鎻愮ず", {
confirmButtonText: "纭",
cancelButtonText: "鍙栨秷",
type: "warning",
})
.then(() => {
- return delCustomerPrivatePool(row.id);
- })
- .then(() => {
- proxy.$modal.msgSuccess("鍥炴敹鎴愬姛");
- getList();
+ return recycleCustomer({id: row.id}).then(() => {
+ proxy.$modal.msgSuccess("鍥炴敹鎴愬姛");
+ getList();
+ })
})
.catch(error => {
if (error === "cancel" || error === "close") {
@@ -1283,7 +1344,12 @@
type: "warning",
})
.then(() => {
- proxy.download("/basic/customer/export", {}, "瀹㈡埛妗f.xlsx");
+ // 瀵煎嚭璺熼殢褰撳墠椤电鐨勫鎴峰垎绫�
+ proxy.download(
+ "/basic/customer/export",
+ { type: 1, customerType: activeCustomerType() },
+ "瀹㈡埛妗f.xlsx"
+ );
})
.catch(() => {
proxy.$modal.msg("宸插彇娑�");
@@ -1642,7 +1708,7 @@
const downloadAttachment = row => {
if (row.url) {
// proxy.download(row.url, {}, row.name);
- proxy.$download.name(row.url);
+ proxy.$download.byUrl(row.url, row.originalFilename);
} else {
proxy.$modal.msgError("涓嬭浇閾炬帴涓嶅瓨鍦�");
}
@@ -1709,6 +1775,19 @@
</script>
<style scoped lang="scss">
+ /* 閿�鍞鎴� / 浠e偍瀹㈡埛椤电锛氬彧瑕佹爣绛炬爮锛屽唴瀹圭敱涓嬫柟鍒楄〃灞曠ず */
+ .customer-tabs {
+ margin-bottom: 8px;
+
+ :deep(.el-tabs__header) {
+ margin-bottom: 0;
+ }
+
+ :deep(.el-tabs__content) {
+ display: none;
+ }
+ }
+
.detail-section {
margin-bottom: 20px;
padding: 15px;
--
Gitblit v1.9.3