Commit da2a4784 authored by limengyang's avatar limengyang

fix(lmy): bug修复及部分添加TS校验

parent 23c4e7b5
import { tmallabHttp } from '/@/utils/http/axios'; import { tmallabHttp } from '/@/utils/http/axios';
import { SearchFormType, ListTpyes, UploadTaskType } from '/@/views/regionalSpotManage/types';
enum Api { enum Api {
GetStatus = '/system/opsProduct/IsOpsSupplier', GetStatus = '/system/opsProduct/IsOpsSupplier',
List = '/system/opsProduct/getList', List = '/system/opsProduct/getList',
...@@ -17,6 +18,14 @@ enum Api { ...@@ -17,6 +18,14 @@ enum Api {
PlatformProBatchGetDetail = '/system/logNegotiationProductOperate/getDetail', PlatformProBatchGetDetail = '/system/logNegotiationProductOperate/getDetail',
} }
type ResponseData<T> = {
code: number;
message: string;
data: T;
success: boolean;
time: string;
};
/** /**
* @description: 区域现货管理列表 * @description: 区域现货管理列表
*/ */
...@@ -25,8 +34,11 @@ export const regionalSpotManageGetStatusApi = () => tmallabHttp.post({ url: Api. ...@@ -25,8 +34,11 @@ export const regionalSpotManageGetStatusApi = () => tmallabHttp.post({ url: Api.
/** /**
* @description: 区域现货管理列表 * @description: 区域现货管理列表
*/ */
export const regionalSpotManageListApi = (data) => export const regionalSpotManageListApi = (data: SearchFormType) =>
tmallabHttp.post({ url: Api.List, data }, { errorMessageMode: 'message' }); tmallabHttp.post<ResponseData<ListTpyes[]>>(
{ url: Api.List, data },
{ errorMessageMode: 'message' },
);
/** /**
* @description: 获取品牌列表 * @description: 获取品牌列表
...@@ -93,7 +105,8 @@ export const regionalSpotManageUploadOpsProductApi = (data, file) => ...@@ -93,7 +105,8 @@ export const regionalSpotManageUploadOpsProductApi = (data, file) =>
/** /**
* @description: 任务中心获取列表 * @description: 任务中心获取列表
*/ */
export const taskCenterQueryListApi = (data) => tmallabHttp.post({ url: Api.QueryList, data }); export const taskCenterQueryListApi = (data: { type: number }) =>
tmallabHttp.post<ResponseData<UploadTaskType[]>>({ url: Api.QueryList, data });
/** /**
* @description: 撤销 * @description: 撤销
......
...@@ -25,40 +25,32 @@ ...@@ -25,40 +25,32 @@
regionalSpotManageUploadOpsProductApi, regionalSpotManageUploadOpsProductApi,
} from '/@/api/regionalSpotManage'; } from '/@/api/regionalSpotManage';
import addProductModal from './addProduct.vue'; import addProductModal from './addProduct.vue';
import type { ListTpyes, AreaIds, BrandTypes } from '../types';
const config = import.meta.env; const config = import.meta.env;
const userInfo: any = getAuthCache('USER__INFO__'); const userInfo: any = getAuthCache('USER__INFO__');
const ghsCode = userInfo.supplier.ghsCode; const ghsCode = userInfo.supplier.ghsCode;
const ghsName = userInfo.supplier.ghsName; const ghsName = userInfo.supplier.ghsName;
const router = useRouter(); const router = useRouter();
const list = ref<any[]>([]); const list = ref<ListTpyes[]>([]);
onMounted(async () => { onMounted(async () => {
getList(); getList();
getAllAreaList(); getAllAreaList();
getGroupOption(); getGroupOption();
}); });
const searchForm = ref<{ const searchForm = ref<{
brands: any; brands: string[];
goodsNo: any; goodsNo: string;
areaIds: any; areaIds: number[];
types: any; types: string[];
}>({ }>({
brands: [], brands: [],
goodsNo: '', goodsNo: '',
areaIds: [], areaIds: [],
types: [], types: [],
}); });
interface AreaIds {
city?: string;
cityId?: number;
creationTime?: string;
creator?: string;
id?: number;
province?: string;
provinceId?: number;
}
const areaIdsOption = ref<AreaIds[]>([]); const areaIdsOption = ref<AreaIds[]>([]);
const typesOption = ref([]); const typesOption = ref<string[]>([]);
const searchBrandList = ref<any[]>([]); const searchBrandList = ref<BrandTypes[]>([]);
const handleSearch = async (value) => { const handleSearch = async (value) => {
const res = await regionalSpotManageBrandListApi({ brand: value }); const res = await regionalSpotManageBrandListApi({ brand: value });
if (res.success) { if (res.success) {
...@@ -77,19 +69,16 @@ ...@@ -77,19 +69,16 @@
showQuickJumper: true, showQuickJumper: true,
showSizeChanger: true, showSizeChanger: true,
pageSizeOptions: ['10', '20', '30', '50', '100'], pageSizeOptions: ['10', '20', '30', '50', '100'],
onChange: (current) => { onChange: (current, size) => {
pagination.value.current = current; pagination.value.current = current;
getList();
},
onShowSizeChange: (size) => {
pagination.value.pageSize = size; pagination.value.pageSize = size;
getList(); getList();
}, },
}); });
const getList = async () => { const getList = async () => {
const pager = ref({ const pager = ref({
pageIndex: 1, pageIndex: pagination.value.current,
pageSize: 10, pageSize: pagination.value.pageSize,
}); });
const param = ref({ const param = ref({
...searchForm.value, ...searchForm.value,
...@@ -101,7 +90,7 @@ ...@@ -101,7 +90,7 @@
const res = await regionalSpotManageListApi(param.value); const res = await regionalSpotManageListApi(param.value);
if (res.success) { if (res.success) {
list.value = res.data; list.value = res.data;
pagination.value.total = res.data[0].total; pagination.value.total = res.data[0].total as number;
} else { } else {
list.value = []; list.value = [];
pagination.value.total = 0; pagination.value.total = 0;
...@@ -132,7 +121,7 @@ ...@@ -132,7 +121,7 @@
} }
}; };
const curItem = ref<{ [key: string]: any }>({}); const curItem = ref<ListTpyes>({});
// =========查看区域现货 statr =========== // =========查看区域现货 statr ===========
const loading1 = ref(false); const loading1 = ref(false);
...@@ -167,7 +156,7 @@ ...@@ -167,7 +156,7 @@
// ==========查看区域现货 end ============= // ==========查看区域现货 end =============
const selectedRowKeys = ref([]); const selectedRowKeys = ref([]);
const selectedRows = ref<any[]>([]); const selectedRows = ref<ListTpyes[]>([]);
const onSelectChange = (Keys, Rows) => { const onSelectChange = (Keys, Rows) => {
selectedRowKeys.value = Keys; selectedRowKeys.value = Keys;
selectedRows.value = Rows; selectedRows.value = Rows;
...@@ -195,7 +184,7 @@ ...@@ -195,7 +184,7 @@
const curArr = delAreaList.value.map((it) => it.cityCode); const curArr = delAreaList.value.map((it) => it.cityCode);
for (const k of allAreaList.value) { for (const k of allAreaList.value) {
if (curArr.includes(k.cityId)) { if (curArr.includes(k.cityId)) {
addCheckboxValue.value.push(k.cityId); addCheckboxValue.value.push(k.cityId as number);
k.disabled = true; k.disabled = true;
} }
} }
...@@ -235,7 +224,7 @@ ...@@ -235,7 +224,7 @@
const delLoading = ref(false); const delLoading = ref(false);
const deleteNum = ref(0); const deleteNum = ref(0);
const radioValue = ref(1); const radioValue = ref(1);
const delAreaList = ref<any[]>([]); //已添加的区域 const delAreaList = ref<AreaIds[]>([]); //已添加的区域
const delCheckboxValue = ref([]); const delCheckboxValue = ref([]);
const del = async (val) => { const del = async (val) => {
curItem.value = val; curItem.value = val;
...@@ -336,7 +325,7 @@ ...@@ -336,7 +325,7 @@
}; };
// ================区域现货商品删除 end===================== // ================区域现货商品删除 end=====================
const allAreaList = ref<any[]>([]); const allAreaList = ref<AreaIds[]>([]);
const getAllAreaList = async () => { const getAllAreaList = async () => {
const res = await regionalSpotManageGetAreaListApi({}); const res = await regionalSpotManageGetAreaListApi({});
if (res.success) { if (res.success) {
...@@ -357,7 +346,7 @@ ...@@ -357,7 +346,7 @@
// =====================批量导入 start======================= // =====================批量导入 start=======================
const productExcelList = ref<any[]>([]); const productExcelList = ref<any[]>([]);
const importVisible = ref(false); const importVisible = ref(false);
const impotrCheckboxValue = ref<any[]>([]); const impotrCheckboxValue = ref<number[]>([]);
const batchImport = () => { const batchImport = () => {
importVisible.value = true; importVisible.value = true;
allAreaList.value.forEach((v) => { allAreaList.value.forEach((v) => {
...@@ -445,12 +434,12 @@ ...@@ -445,12 +434,12 @@
v-model:value="searchForm.brands" v-model:value="searchForm.brands"
show-search show-search
mode="multiple" mode="multiple"
placeholder="请输入品牌名称" placeholder="请输入搜索品牌名称"
style="width: 100%" style="width: 100%"
:default-active-first-option="false" :default-active-first-option="false"
:show-arrow="false" :show-arrow="false"
:filter-option="false" :filter-option="false"
:not-found-content="null" not-found-content="暂无数据"
:maxTagCount="1" :maxTagCount="1"
@search="handleSearch" @search="handleSearch"
> >
......
...@@ -19,11 +19,8 @@ ...@@ -19,11 +19,8 @@
showQuickJumper: true, showQuickJumper: true,
showSizeChanger: true, showSizeChanger: true,
pageSizeOptions: ['10', '20', '30', '50', '100'], pageSizeOptions: ['10', '20', '30', '50', '100'],
onChange: (current) => { onChange: (current, size) => {
pagination.value.current = current; pagination.value.current = current;
getList();
},
onShowSizeChange: (size) => {
pagination.value.pageSize = size; pagination.value.pageSize = size;
getList(); getList();
}, },
......
...@@ -6,11 +6,12 @@ ...@@ -6,11 +6,12 @@
taskCenterQueryListApi, taskCenterQueryListApi,
taskCenterRevokeExcelUploadApi, taskCenterRevokeExcelUploadApi,
} from '/@/api/regionalSpotManage'; } from '/@/api/regionalSpotManage';
import { UploadTaskType } from '../types';
onMounted(async () => { onMounted(async () => {
getList(); getList();
}); });
let list = ref<any[]>([]); const list = ref<UploadTaskType[]>([]);
let listLoading = ref(false); const listLoading = ref(false);
const downLoad = (url) => { const downLoad = (url) => {
window.open(config.VITE_GLOB_TMALLAB_URL + '/system/excelFile/' + url, '_blank'); window.open(config.VITE_GLOB_TMALLAB_URL + '/system/excelFile/' + url, '_blank');
}; };
......
export interface SearchFormType {
areaIds?: number[];
brands?: string[];
goodsNo?: string;
pageIndex?: number;
pageSize?: number;
types?: string[];
}
export interface ListTpyes {
brand?: string;
goodsNo?: string;
productName?: string;
productStatus?: boolean;
spec?: string;
total?: number;
}
export interface AreaIds {
city?: string;
cityId?: number;
creationTime?: string;
creator?: string;
id?: number;
province?: string;
provinceId?: number;
cityCode?: number;
provinceName?: string;
cityName?: string;
disabled?: boolean;
}
export interface BrandTypes {
agentLevel: string;
applierName: string;
brand: string;
brandPass: boolean;
brandQualification: string;
count: number | null;
createTime: string;
expirationDate: string;
salePlat: number;
}
export interface UploadTaskType {
createName: string;
createTime: string;
failNum: number;
fileUrl: string;
isRevoke: boolean;
productNum: number;
revokeTime: string | null;
revokeUsername: string | null;
status: number;
successNum: number;
supplierCode: string;
supplierFileName: string;
type: string;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment