| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697 |
- import { http } from "@/utils/http";
- type Result = {
- code: number;
- message: string;
- data?: any;
- };
- type ResultTable = {
- code: number;
- message: string;
- data?: {
- list: Array<any>;
- total: number;
- pageSize: number;
- currentPage: number;
- };
- };
- export const getReplenisherList = (params: {
- page?: number;
- pageSize?: number;
- keyword?: string;
- status?: number;
- }) => {
- return http.request<ResultTable>("get", "/replenishers/list", { params });
- };
- export const getReplenisherById = (id: number) => {
- return http.request<Result>("get", `/replenishers/${id}`);
- };
- export const searchReplenishers = (keyword?: string) => {
- return http.request<Result>(
- "get",
- `/replenishers/search${keyword ? `?keyword=${keyword}` : ""}`
- );
- };
- export const createReplenisher = (data: {
- name: string;
- phone?: string;
- employeeId?: string;
- }) => {
- return http.request<Result>("post", "/replenishers", { data });
- };
- export const updateReplenisher = (
- id: number,
- data: {
- name?: string;
- phone?: string;
- employeeId?: string;
- status?: number;
- }
- ) => {
- return http.request<Result>("put", `/replenishers/${id}`, { data });
- };
- export const updateReplenisherStatus = (id: number, data: { status: number }) => {
- return http.request<Result>("put", `/replenishers/${id}/status`, { data });
- };
- export const deleteReplenisher = (id: number) => {
- return http.request<Result>("delete", `/replenishers/${id}`);
- };
- export const getBoundDevices = (id: number) => {
- return http.request<Result>("get", `/replenishers/${id}/devices`);
- };
- export const bindDevices = (id: number, data: { deviceIds: string[] }) => {
- return http.request<Result>("post", `/replenishers/${id}/devices`, { data });
- };
- export const unbindDevice = (replenisherId: number, deviceId: string) => {
- return http.request<Result>(
- "delete",
- `/replenishers/${replenisherId}/devices/${deviceId}`
- );
- };
- export const batchBindDevices = (data: {
- replenisherIds: number[];
- deviceIds: string[];
- }) => {
- return http.request<Result>("post", "/replenishers/batch-bind", { data });
- };
- /**
- * 生成补货员绑定码
- * @param id 补货员ID
- * @returns bindingCode
- */
- export const generateBindingCode = (id: number) => {
- return http.request<Result>("post", `/replenishers/${id}/binding-code`);
- };
|