huoshicang 2025-08-08 12:03:57 +08:00 committed by GitHub
commit edb8944fc3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 74 additions and 39 deletions

View File

@ -2,15 +2,10 @@
<template>
<div class="JPopup components-input-demo-presuffix" v-if="avalid">
<!--输入框-->
<a-input @click="handleOpen" :value="innerShowText || showText" :placeholder="placeholder" readOnly v-bind="attrs">
<a-input @click="handleOpen" v-model:value="showText" :placeholder="placeholder" v-bind="attrs" allow-clear @change="handleEmpty">
<template #prefix>
<Icon icon="ant-design:cluster-outlined"></Icon>
</template>
<!-- update-begin-author:taoyan date:2022-5-31 for: VUEN-1157 popup 选中后有两个清除图标后边这个清除只是把输入框中数据清除实际值并没有清除 -->
<!-- <template #suffix>
<Icon icon="ant-design:close-circle-outlined" @click="handleEmpty" title="清空" v-if="showText"></Icon>
</template>-->
<!-- update-begin-author:taoyan date:2022-5-31 for: VUEN-1157 popup 选中后有两个清除图标后边这个清除只是把输入框中数据清除实际值并没有清除 -->
</a-input>
<!-- update-begin--author:liaozhiyang---date:20240515---forQQYUN-9260必填模式下会影响到弹窗内antd组件的样式 -->
<a-form-item>
@ -116,8 +111,25 @@
/**
* TODO 清空
*/
function handleEmpty() {
showText.value = '';
function handleEmpty(e) {
// showText.value = '';
// update-begin--author:huoshicang---date:20250716
if (!e.target.value) {
// popup
let { fieldConfig } = props;
//
let values = {};
for (let item of fieldConfig) {
item.target.split(',').forEach((target) => {
//
values[target] = '';
});
}
props.formElRef && props.formElRef.setFieldsValue(values);
props.setFieldsValue && props.setFieldsValue(values);
emit('popUpChange', values);
}
// update-end--author:huoshicang---date:20250716
}
/**

View File

@ -34,6 +34,10 @@ interface ListPageOptions {
//update-end-author:taoyan date:20220507 for: erp
//
success?: (fileInfo?: any) => void;
// update-begin--author:huoshicang---date:20250805
parameters?: { key: String; value: String };
// update-end--author:huoshicang---date:20250805
};
}
@ -118,11 +122,13 @@ export function useListPage(options: ListPageOptions) {
// excel
function onImportXls(file) {
let { url, success } = options?.importConfig ?? {};
let { url, success, parameters = {} } = options?.importConfig ?? {};
//update-begin-author:taoyan date:20220507 for: erp
let realUrl = typeof url === 'function' ? url() : url;
if (realUrl) {
return handleImportXls(file, realUrl, success || reload);
// update-begin--author:huoshicang---date:20250805
return handleImportXls(file, realUrl, success || reload, parameters);
// update-end--author:huoshicang---date:20250805
//update-end-author:taoyan date:20220507 for: erp
} else {
$message.createMessage.warn('没有传递 importConfig.url 参数');

View File

@ -59,8 +59,9 @@ export function useMethods() {
* @param data 导入的数据
* @param url
* @param success 成功后的回调
* @param parameters 导入携带的参数
*/
async function importXls(data, url, success) {
async function importXls(data, url, success, parameters) {
const isReturn = (fileInfo) => {
try {
if (fileInfo.code === 201) {
@ -90,12 +91,14 @@ export function useMethods() {
typeof success === 'function' ? success(fileInfo) : '';
}
};
await defHttp.uploadFile({ url }, { file: data.file }, { success: isReturn });
await defHttp.uploadFile({ url }, { file: data.file }, { success: isReturn }, parameters);
}
return {
handleExportXls: (name: string, url: string, params?: object) => exportXls(name, url, params),
handleImportXls: (data, url, success) => importXls(data, url, success),
// update-begin--author:huoshicang---date:20250805
handleImportXls: (data, url, success, parameters) => importXls(data, url, success, parameters),
// update-end--author:huoshicang---date:20250805
handleExportXlsx: (name: string, url: string, params?: object) => exportXls(name, url, params, true),
};

View File

@ -71,7 +71,12 @@ export class VAxios {
if (!transform) {
return;
}
const { requestInterceptors, requestInterceptorsCatch, responseInterceptors, responseInterceptorsCatch } = transform;
const {
requestInterceptors,
requestInterceptorsCatch,
responseInterceptors,
responseInterceptorsCatch
} = transform;
const axiosCanceler = new AxiosCanceler();
@ -114,7 +119,11 @@ export class VAxios {
* 文件上传
*/
//--@updateBy-begin----author:liusq---date:20211117------for:callback------
uploadFile<T = any>(config: AxiosRequestConfig, params: UploadFileParams, callback?: UploadFileCallBack) {
// update-begin--author:huoshicang---date:20250805
uploadFile<T = any>(config: AxiosRequestConfig, params: UploadFileParams, callback?: UploadFileCallBack, parameters?: {
key: String;
value: String
}) {
//--@updateBy-end----author:liusq---date:20211117------for:callback------
const formData = new window.FormData();
const customFilename = params.name || 'file';
@ -139,6 +148,11 @@ export class VAxios {
formData.append(key, params.data[key]);
});
}
// update-begin--author:huoshicang---date:20250805
if (Object.keys(parameters).length != 0) {
for (const key in parameters) formData.append(key, parameters[key]);
}
// update-end--author:huoshicang---date:20250805
return this.axiosInstance
.request<T>({