import http from '@/utils/http'
import { AppDispatch } from '..'

/**
 * 工作台-设置常用功能
 */
export const A1_APIsetStock = (userId: number, permRtf: string): any => {
  const obj = { permRtf, userId }

  return http.post('cms/bench/perm/save', obj)
}

/**
 * 工作台-列表数据
 */
export const A1_APIgetlist = (data: any): any => {
  return async (dispatch: AppDispatch) => {
    const res = await http.post('cms/bench/order/page', data)
    if (res.code === 0) {
      const obj = {
        list: res.data.records,
        total: res.data.total
      }

      dispatch({ type: 'A1/getList', payload: obj })
    }
  }
}
