From 68aac33ec30eedd770a1281348c7ff0d1d29225e Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期二, 06 一月 2026 11:17:06 +0800
Subject: [PATCH] 二级套餐包改造: 1.封装公用组件 2.替换公共函数
---
src/views/basicData/customerFile/index.vue | 98 ++++++++++++++++++-------------------------------
1 files changed, 36 insertions(+), 62 deletions(-)
diff --git a/src/views/basicData/customerFile/index.vue b/src/views/basicData/customerFile/index.vue
index 0f39e25..ea75164 100644
--- a/src/views/basicData/customerFile/index.vue
+++ b/src/views/basicData/customerFile/index.vue
@@ -47,11 +47,14 @@
@pagination="pagination"
></PIMTable>
</div>
- <el-dialog
+ <FormDialog
v-model="dialogFormVisible"
- :title="operationType === 'add' ? '鏂板瀹㈡埛淇℃伅' : '缂栬緫瀹㈡埛淇℃伅'"
+ :title="(type) => type === 'add' ? '鏂板瀹㈡埛淇℃伅' : '缂栬緫瀹㈡埛淇℃伅'"
+ :operation-type="operationType"
width="70%"
@close="closeDia"
+ @confirm="submitForm"
+ @cancel="closeDia"
>
<el-form
:model="form"
@@ -193,63 +196,31 @@
</el-col>
</el-row>
</el-form>
- <template #footer>
- <div class="dialog-footer">
- <el-button type="primary" @click="submitForm">纭</el-button>
- <el-button @click="closeDia">鍙栨秷</el-button>
- </div>
- </template>
- </el-dialog>
+ </FormDialog>
<!-- 鐢ㄦ埛瀵煎叆瀵硅瘽妗� -->
- <el-dialog
- :title="upload.title"
+ <ImportDialog
+ ref="importDialogRef"
v-model="upload.open"
+ :title="upload.title"
width="400px"
- append-to-body
- >
- <el-upload
- ref="uploadRef"
- :limit="1"
- accept=".xlsx, .xls"
- :headers="upload.headers"
- :action="upload.url + '?updateSupport=' + upload.updateSupport"
- :disabled="upload.isUploading"
- :before-upload="upload.beforeUpload"
- :on-progress="upload.onProgress"
- :on-success="upload.onSuccess"
- :on-error="upload.onError"
- :on-change="upload.onChange"
- :auto-upload="false"
- drag
- >
- <el-icon class="el-icon--upload"><upload-filled /></el-icon>
- <div class="el-upload__text">灏嗘枃浠舵嫋鍒版澶勶紝鎴�<em>鐐瑰嚮涓婁紶</em></div>
- <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
- >
- </div>
- </template>
- </el-upload>
- <template #footer>
- <div class="dialog-footer">
- <el-button type="primary" @click="submitFileForm">纭� 瀹�</el-button>
- <el-button @click="upload.open = false">鍙� 娑�</el-button>
- </div>
- </template>
- </el-dialog>
+ :action="upload.url"
+ :headers="upload.headers"
+ :disabled="upload.isUploading"
+ :before-upload="upload.beforeUpload"
+ :on-progress="upload.onProgress"
+ :on-success="upload.onSuccess"
+ :on-error="upload.onError"
+ :on-change="upload.onChange"
+ @confirm="submitFileForm"
+ @cancel="handleImportCancel"
+ @download-template="importTemplate"
+ />
</div>
</template>
<script setup>
import {onMounted, ref} from "vue";
-import { Search } from "@element-plus/icons-vue";
+import { Search, Close } from "@element-plus/icons-vue";
import {
addCustomer,
delCustomer,
@@ -261,6 +232,9 @@
import { userListNoPage } from "@/api/system/user.js";
import useUserStore from "@/store/modules/user";
import { getToken } from "@/utils/auth.js";
+import { getCurrentDate } from "@/utils/index.js";
+import FormDialog from "@/components/Dialog/FormDialog.vue";
+import ImportDialog from "@/components/Dialog/ImportDialog.vue";
const { proxy } = getCurrentInstance();
const userStore = useUserStore();
@@ -338,6 +312,7 @@
const selectedRows = ref([]);
const userList = ref([]);
const tableLoading = ref(false);
+const importDialogRef = ref(null);
const page = reactive({
current: 1,
size: 100,
@@ -426,7 +401,9 @@
if(response.code === 200){
proxy.$modal.msgSuccess("鏂囦欢涓婁紶鎴愬姛");
upload.open = false;
- proxy.$refs["uploadRef"].clearFiles();
+ if (importDialogRef.value) {
+ importDialogRef.value.clearFiles();
+ }
getList();
}else if(response.code === 500){
proxy.$modal.msgError(response.msg);
@@ -484,7 +461,13 @@
/** 鎻愪氦涓婁紶鏂囦欢 */
function submitFileForm() {
upload.isUploading = true;
- proxy.$refs["uploadRef"].submit();
+ if (importDialogRef.value) {
+ importDialogRef.value.submit();
+ }
+}
+/** 鍙栨秷瀵煎叆 */
+function handleImportCancel() {
+ upload.open = false;
}
/** 瀵煎叆鎸夐挳鎿嶄綔 */
function handleImport() {
@@ -613,15 +596,6 @@
proxy.$modal.msg("宸插彇娑�");
});
};
-
-// 鑾峰彇褰撳墠鏃ユ湡骞舵牸寮忓寲涓� YYYY-MM-DD
-function getCurrentDate() {
- const today = new Date();
- const year = today.getFullYear();
- const month = String(today.getMonth() + 1).padStart(2, "0"); // 鏈堜唤浠�0寮�濮�
- const day = String(today.getDate()).padStart(2, "0");
- return `${year}-${month}-${day}`;
-}
onMounted(() => {
getList();
--
Gitblit v1.9.3