import { getModule, Module, MutationAction, VuexModule } from 'vuex-module-decorators';
import store from '@/store';
import http from '@/utils/request';
import { url } from '@/utils/url';
@Module({
  namespaced: true,
  dynamic: true,
  store,
  name: 'page.equipment.Repairbx',
})
export class Repairbx extends VuexModule {
  rowdata: any = [];
  orderNoItemList: any = [];
  @MutationAction
  async queryOrderNo(orderNo: any) {
    const result: any = await http.get(url.lanjuequipment.product.Repairbx.getInfoRepair + orderNo);
    const orderNoItemList = result.data;
    return { orderNoItemList };
  }
  @MutationAction
  async empty() {
    const orderNoItemList = [];
    return { orderNoItemList };
  }
  SubmitCode: any = '';
  //托盘信息变更x
  @MutationAction
  async addRepairRecord(params: any) {
    const result: any = await http.post(url.lanjuequipment.product.Repairbx.addRepairRecord, params);
    const SubmitCode = result;
    return { SubmitCode };
  }
  equipmentlist: any = [];
  @MutationAction
  async queryhandChecklist(params: any) {
    const result: any = await http.get(url.lanjuequipment.product.Repairbx.getEquipmentList, { params: params });
    const equipmentlist = result.rows;
    return { equipmentlist };
  }
  // 故障描述
  locList: any = [];
  @MutationAction
  async getFaultDescriptionList(params: any) {
    const result: any = await http.get(url.lanjuequipment.product.Repair.getFaultDescriptionList, {
      params,
    });
    const DictListoild: [] = result.data;
    const locList = DictListoild.map((item: any) => ({
      label: item.faultSubclass,
      value: item.faultSubclass,
    }));
    return { locList };
  }
  @MutationAction
  async rowdatanull() {
    const rowdata: [] = [];
    return { rowdata };
  }
}

export default getModule(Repairbx);
