From e0bea18c126ff9fd442491ee3a4f37f1faf76a7d Mon Sep 17 00:00:00 2001
From: spring <2396852758@qq.com>
Date: 星期四, 21 八月 2025 17:15:02 +0800
Subject: [PATCH] 自助服务平台
---
src/views/basicData/customerFile/index.vue | 80 ++++++++++++++++++++++++++++++++++------
1 files changed, 68 insertions(+), 12 deletions(-)
diff --git a/src/views/basicData/customerFile/index.vue b/src/views/basicData/customerFile/index.vue
index 2294dd7..a706616 100644
--- a/src/views/basicData/customerFile/index.vue
+++ b/src/views/basicData/customerFile/index.vue
@@ -197,8 +197,11 @@
:headers="upload.headers"
:action="upload.url + '?updateSupport=' + upload.updateSupport"
:disabled="upload.isUploading"
- :on-progress="handleFileUploadProgress"
- :on-success="handleFileSuccess"
+ :before-upload="upload.beforeUpload"
+ :on-progress="upload.onProgress"
+ :on-success="upload.onSuccess"
+ :on-error="upload.onError"
+ :on-change="upload.onChange"
:auto-upload="false"
drag
>
@@ -207,13 +210,13 @@
<template #tip>
<div class="el-upload__tip text-center">
<span>浠呭厑璁稿鍏ls銆亁lsx鏍煎紡鏂囦欢銆�</span>
- <el-link
- type="primary"
- :underline="false"
- style="font-size: 12px; vertical-align: baseline"
- @click="importTemplate"
- >涓嬭浇妯℃澘</el-link
- >
+<!-- <el-link-->
+<!-- type="primary"-->
+<!-- :underline="false"-->
+<!-- style="font-size: 12px; vertical-align: baseline"-->
+<!-- @click="importTemplate"-->
+<!-- >涓嬭浇妯℃澘</el-link-->
+<!-- >-->
</div>
</template>
</el-upload>
@@ -228,7 +231,7 @@
</template>
<script setup>
-import { ref } from "vue";
+import {onMounted, ref} from "vue";
import { Search } from "@element-plus/icons-vue";
import {
addCustomer,
@@ -258,7 +261,7 @@
{
label: "鍦板潃鍙婅仈绯绘柟寮�",
prop: "addressPhone",
- width: 220,
+ width: 250,
},
{
label: "鑱旂郴浜�",
@@ -267,18 +270,22 @@
{
label: "鑱旂郴鐢佃瘽",
prop: "contactPhone",
+ width:150
},
{
label: "閾惰鍩烘湰鎴�",
prop: "basicBankAccount",
+ width: 220,
},
{
label: "閾惰璐﹀彿",
prop: "bankAccount",
+ width: 220,
},
{
label: "寮�鎴疯鍙�",
prop: "bankCode",
+ width:220
},
{
label: "缁存姢浜�",
@@ -287,11 +294,13 @@
{
label: "缁存姢鏃堕棿",
prop: "maintenanceTime",
+ width: 100,
},
{
dataType: "action",
label: "鎿嶄綔",
align: "center",
+ fixed: 'right',
operation: [
{
name: "缂栬緫",
@@ -299,6 +308,9 @@
clickFun: (row) => {
openForm("edit", row);
},
+ disabled: (row) => {
+ return row.maintainer !== userStore.nickName
+ }
},
],
},
@@ -371,6 +383,40 @@
headers: { Authorization: "Bearer " + getToken() },
// 涓婁紶鐨勫湴鍧�
url: import.meta.env.VITE_APP_BASE_API + "/basic/customer/importData",
+ // 鏂囦欢涓婁紶鍓嶇殑鍥炶皟
+ beforeUpload: (file) => {
+ console.log('鏂囦欢鍗冲皢涓婁紶', file);
+ // 鍙互鍦ㄦ澶勫仛鏂囦欢绫诲瀷鎴栧ぇ灏忔牎楠�
+ const isValid = file.type === 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' || file.name.endsWith('.xlsx') || file.name.endsWith('.xls');
+ if (!isValid) {
+ proxy.$modal.msgError("鍙兘涓婁紶 Excel 鏂囦欢");
+ }
+ return isValid;
+ },
+ // 鏂囦欢鐘舵�佹敼鍙樻椂鐨勫洖璋�
+ onChange: (file, fileList) => {
+ console.log('鏂囦欢鐘舵�佹敼鍙�', file, fileList);
+ },
+ // 鏂囦欢涓婁紶鎴愬姛鏃剁殑鍥炶皟
+ onSuccess: (response, file, fileList) => {
+ console.log('涓婁紶鎴愬姛', response, file, fileList);
+ if(response.code === 200){
+ proxy.$modal.msgSuccess("鏂囦欢涓婁紶鎴愬姛");
+ }else if(response.code === 500){
+ proxy.$modal.msgError(response.msg);
+ }else{
+ proxy.$modal.msgWarning(response.msg);
+ }
+ },
+ // 鏂囦欢涓婁紶澶辫触鏃剁殑鍥炶皟
+ onError: (error, file, fileList) => {
+ console.error('涓婁紶澶辫触', error, file, fileList);
+ proxy.$modal.msgError("鏂囦欢涓婁紶澶辫触");
+ },
+ // 鏂囦欢涓婁紶杩涘害鍥炶皟
+ onProgress: (event, file, fileList) => {
+ console.log('涓婁紶涓�...', event.percent);
+ }
});
const { searchForm, form, rules } = toRefs(data);
const addNewContact = () => {
@@ -473,6 +519,8 @@
};
// 鎻愪氦淇敼
const submitEdit = () => {
+ form.value.contactPerson = formYYs.value.contactList.map(item => item.contactPerson).join(",");
+ form.value.contactPhone = formYYs.value.contactList.map(item => item.contactPhone).join(",");
updateCustomer(form.value).then((res) => {
proxy.$modal.msgSuccess("鎻愪氦鎴愬姛");
closeDia();
@@ -502,6 +550,12 @@
const handleDelete = () => {
let ids = [];
if (selectedRows.value.length > 0) {
+ // 妫�鏌ユ槸鍚︽湁浠栦汉缁存姢鐨勬暟鎹�
+ const unauthorizedData = selectedRows.value.filter(item => item.maintainer !== userStore.nickName);
+ if (unauthorizedData.length > 0) {
+ proxy.$modal.msgWarning("涓嶅彲鍒犻櫎浠栦汉缁存姢鐨勬暟鎹�");
+ return;
+ }
ids = selectedRows.value.map((item) => item.id);
} else {
proxy.$modal.msgWarning("璇烽�夋嫨鏁版嵁");
@@ -537,7 +591,9 @@
return `${year}-${month}-${day}`;
}
-getList();
+onMounted(() => {
+ getList();
+});
</script>
<style scoped lang="scss"></style>
--
Gitblit v1.9.3