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

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

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

  getProductionLog = (data: pageInput, params: any ) : any => {
    // eslint-disable-next-line no-console
    return new Promise((resolve) => {
      setTimeout(()=> {
        resolve({
          tableData:[
            {
              dateOfManufacture:"2023-07-05",
              operator:"蒋工1",
              workingProcedure:"团标密钥灌注1",
              state:true,
              productionPictures:"111",
              remarks:"222"
            },
            {
              dateOfManufacture:"2023-07-05",
              operator:"蒋工2",
              workingProcedure:"团标密钥灌注2",
              state:true,
              productionPictures:"111",
              remarks:"222"
            },
            {
              dateOfManufacture:"2023-07-05",
              operator:"蒋工3",
              workingProcedure:"团标密钥灌3",
              state:true,
              productionPictures:"2323",
              remarks:"333"
            },
          ],
          dynamicColumns: [
            { prop: 'dateOfManufacture', label: '生产时间' },
            { prop: 'operator', label: '操作人' },
            { prop: 'workingProcedure', label: '工序' },
            { prop: 'state', label: '状态' },
            { prop: 'productionPictures', label: '生产图片' },
            { prop: 'remarks', label: '备注' },
            { prop: 'remarks', label: '备注' },
            { prop: 'remarks', label: '备注' },
            { prop: 'remarks', label: '备注' },
            { prop: 'remarks', label: '备注' },
            // You can generate and push more columns based on your data
          ],
          pageInput: {
            currentPage: 1,
            pageSize: 5
          },
          total: 100
        })
      },this.timer)
    })
  }

  /**
  * No description
  *
  * @tags
  * @name getAlarmLog
  * @summary 获取产品详情报警日志
  * @request GET:
  * @secure
  */
  getAlarmLog = (data: pageInput, params:any ) : any => {
    // eslint-disable-next-line no-console
    console.log(params)
    console.log(data)
    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)
    })
  }
}
