import {ContentType, HttpClient, RequestParams} from "/@/api/admin/http-client";
import {pageInput} from "/@/api/admin/shareDto/shareDto";
import {AxiosResponse} from "axios";
import {ProductionLogRequestBody} from "/@/api/admin/productionManagement/ComopnentDto";

export class ComponentDetails<SecurityDataType = unknown> extends HttpClient<SecurityDataType> {
  /**
  * No description
  *
  * @tags data
  * @name getBasicInfo
  * @summary  获取产品详情基础信息
  * @request GET:
  * @secure
  */

  timer = 500
  getBasicInfo = (query:any ,params: RequestParams = {}) : any  =>
    this.request<AxiosResponse,any>({
      path:'/api/app/compoent/get-part-details',
      method: 'POST',
      secure: true,
      type: ContentType.Json,
      format: 'json',
      query:query,
      ...params
    })
  /**
  * No description
  *
  * @tags data
  * @name getProductionLog
  * @summary  获取产品详情生产日志
  * @request GET:
  * @secure
  */

  getProductionLog = (data: ProductionLogRequestBody) : any =>
    this.request<AxiosResponse, any>({
      path:'/api/app/compoent/get-part-detail-production-log',
      method: 'POST',
      secure: true,
      body:data,
      type: ContentType.Json,
      format: 'json',
    })

  /**
  * No description
  *
  * @tags
  * @name getAlarmLog
  * @summary 获取产品详情报警日志
  * @request GET:
  * @secure
  */
  getAlarmLog = (data: pageInput, params:any ) : any => {
    // eslint-disable-next-line no-console
    return new Promise((resolve) => {
      setTimeout(()=> {
        resolve({
          tableData:[
            {
              alarmDate:"23-07-06 09:14",
              eventName:"通讯异常1",
              remarks:"",
              state:false
            },
            {
              alarmDate:"23-07-06 09:14",
              eventName:"通讯异常2",
              remarks:"",
              state:false
            },
            {
              alarmDate:"23-07-06 09:14",
              eventName:"通讯异常3",
              remarks:"",
              state:false
            }
          ],
          dynamicColumns:[
            { prop: 'alarmDate', label: '生产时间' },
            { prop: 'eventName', label: '操作人' },
            { prop: 'remarks', label: '工序' },
            { prop: 'state', label: '状态' },
            { prop: 'state', label: '状态' },
            { prop: 'state', label: '状态' },
          ],
          pageInput: {
            currentPage: 1,
            pageSize: 5
          },
          total: 100
        })
      },this.timer)
    })
  }
}
