commit:前端webpack版本

This commit is contained in:
Jerry
2024-07-14 22:11:19 +08:00
parent 8295a6a167
commit ed5b9fc602
47 changed files with 23209 additions and 5197 deletions

View File

@@ -19,10 +19,7 @@ export const useDate = () => {
statsType = allowStatsType.indexOf(statsType) === -1 ? 'day' : statsType;
if (statsType === 'datetime') format = 'YYYY-MM-DD HH:mm:ss';
//console.log('date', statsType, format, date);
const tempDate = date instanceof Date ? date : parseDate(date, format);
//console.log('tempDate', tempDate);
if (!tempDate) return undefined;
switch (statsType) {
case 'time':

View File

@@ -25,7 +25,6 @@ export const useDownload = () => {
},
)
.then(res => {
console.log('============= download', res);
const data = res instanceof Blob ? res : res.data;
if (data instanceof Blob) {
const url = window.URL.createObjectURL(data);
@@ -41,7 +40,6 @@ export const useDownload = () => {
}
})
.catch(e => {
console.error('============= download', e);
if (e instanceof Blob) {
const reader = new FileReader();
reader.onload = function () {

View File

@@ -16,14 +16,11 @@ export const useDropdown = <T>(options: DropdownOptions<T>) => {
const { loadData, isTree, idKey, parentIdKey } = finalOptions;
//console.log('dropdown', loadData, isTree, idKey, parentIdKey);
const loadDropdownData = (): Promise<T[]> => {
return new Promise((resolve, reject) => {
if (!loaded && !loading.value) {
loadData()
.then(res => {
console.log(`loadDropdownData 加载了${res.dataList.length}条数据`);
loaded = true;
dropdownList.value = isTree
? treeDataTranslate(res.dataList, idKey, parentIdKey)

View File

@@ -5,7 +5,6 @@ export const usePermissions = () => {
const loginStorage = useLoginStore();
const checkPermCodeExist = (permCode: string) => {
//console.log(permCode);
if (getAppId() != null && getAppId() !== '') return true;
if (loginStorage.userInfo == null) {

View File

@@ -35,7 +35,6 @@ export const useTable = <T>(options: TableOptions<T>) => {
// 监听pageSize变化
watch(pageSize, (newVal, oldVal) => {
//console.log('pageSize change', newVal, oldVal);
if (newVal != oldVal) {
loadData(1, newVal)
.then(() => {
@@ -70,14 +69,8 @@ export const useTable = <T>(options: TableOptions<T>) => {
*/
const loadData = (pageNum: number, pageSize: number, reload = false): Promise<void> => {
if (paged && !reload && oldPage == pageNum && oldPageSize == pageSize) {
console.log('数据已加载,无须重复执行');
return Promise.resolve();
}
if (paged) {
console.log(`开始加载数据, 第${pageNum}页,每页${pageSize}, 强制加载:${reload}`);
} else {
console.log(`开始加载数据, 无分页, 强制加载:${reload}`);
}
const params = {} as RequestParam;
if (orderInfo.fieldName != null) params.orderParam = [orderInfo];
@@ -91,13 +84,11 @@ export const useTable = <T>(options: TableOptions<T>) => {
loading.value = true;
loadTableData(params)
.then(res => {
//console.log(res.dataList, res.totalCount);
// vxetable需要用到对象的hasOwnerProperty方法因此需要重新构造对象
dataList.value = res.dataList.map((item: T) => {
return { ...item };
});
totalCount.value = res.totalCount;
console.log(`本次加载${res.dataList.length}条数据,共有${res.totalCount}条数据`);
resolve();
})
.catch(e => {
@@ -105,7 +96,6 @@ export const useTable = <T>(options: TableOptions<T>) => {
})
.finally(() => {
loading.value = false;
//console.log('加载数据完毕');
});
});
};
@@ -125,7 +115,6 @@ export const useTable = <T>(options: TableOptions<T>) => {
* @param {String} order 正序还是倒序
*/
const onSortChange = ({ prop, field, order }: SortInfo) => {
//console.log(prop, field, order);
orderInfo.fieldName = prop || field;
orderInfo.asc = order == 'ascending' || order == 'asc';
refreshTable();
@@ -137,7 +126,6 @@ export const useTable = <T>(options: TableOptions<T>) => {
* @param showMsg 是否显示查询结果成功与否消息
*/
const refreshTable = (research = false, pageNum = 0, showMsg = false) => {
//console.log(research, pageNum, showMsg);
let reload = false;
if (research) {
if (!verifyTableParameter()) return;

View File

@@ -13,7 +13,7 @@ export const useUpload = () => {
* @returns {Array} 上传文件信息,[{name, downloadUri, filename, url}]
*/
const parseUploadData = (jsonData: string, params: ANY_OBJECT) => {
let pathList = [];
let pathList: Array<ANY_OBJECT> = [];
if (jsonData != null) {
try {
pathList = JSON.parse(jsonData);
@@ -39,7 +39,7 @@ export const useUpload = () => {
* @param {*} item 上传文件
* @param {*} params 上传文件的参数
*/
const getUploadFileUrl = (item: { downloadUri: string }, params?: ANY_OBJECT) => {
const getUploadFileUrl = (item: ANY_OBJECT, params?: ANY_OBJECT) => {
if (item == null || item.downloadUri == null) {
return null;
} else {
@@ -101,7 +101,6 @@ export const useUpload = () => {
},
)
.then((res: ANY_OBJECT) => {
console.log('uploaded file fetchUpload', res);
if (res.data && res.success) {
resolve(res.data);
}

View File

@@ -9,14 +9,13 @@ export const useUrlBuilder = () => {
* @returns 请求全路径(含参数)
*/
const buildGetUrl = (actionName: string, params: ANY_OBJECT | null = null) => {
console.log('getUrl', actionName);
const queryString = objectToQueryString(params);
if (actionName != null && actionName !== '') {
if (actionName.substring(0, 1) === '/') actionName = actionName.substring(1);
}
return (
import.meta.env.VITE_SERVER_HOST + actionName + (queryString == null ? '' : '?' + queryString)
process.env.VUE_APP_SERVER_HOST + actionName + (queryString == null ? '' : '?' + queryString)
);
};
@@ -25,14 +24,13 @@ export const useUrlBuilder = () => {
* @param actionName action方法名称
*/
const requestUrl = (actionName: string) => {
console.log('requestUrl', actionName);
if (actionName) {
if (actionName.substring(0, 1) === '/') actionName = actionName.substring(1);
}
if (actionName.indexOf('http://') === 0 || actionName.indexOf('https://') === 0) {
return actionName;
} else {
return import.meta.env.VITE_SERVER_HOST + actionName;
return process.env.VUE_APP_SERVER_HOST + actionName;
}
};

View File

@@ -12,7 +12,6 @@ const documentClientHeight = ref(0);
*/
export const useWindowResize = () => {
const windowResize = () => {
//console.log('窗口尺寸发生变化');
documentClientHeight.value = document.documentElement.clientHeight;
if (window.innerWidth <= WIDTH) {
layoutStore.defaultFormItemSize = 'default';