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.RepairAudit',
})
export class RepairAudit extends VuexModule {
  rowdata: any = [];
  orderNoItemList: any = [];
  getTaskRecordList: any = {};
  @MutationAction
  async getTodayTask(params: any) {
    const result: any = await http.get(url.lanjuequipment.product.RepairAudit.getBXList, {
      params: {
        orderStatus: params,
      },
    });
    const orderNoItemList = result.data;
    return { orderNoItemList };
  }
  @MutationAction
  async getTaskRecord(params: any) {
    const result: any = await http.get(url.lanjuequipment.product.RepairAudit.getBXDetail + '/' + params);
    const getTaskRecordList = result.data;
    return { getTaskRecordList };
  }
  teamList: any = [];
  //是否开机保养
  @MutationAction
  async getTeamList() {
    const result: any = await http.get(url.lanjuequipment.product.RepairAudit.getMaintenanceTeamList);
    const oldteamList: [] = result.rows;
    const teamList = oldteamList.map((item: any) => {
      return {
        value: item.teamCode,
        label: item.teamName,
        ...item,
      };
    });
    return { teamList };
  }
  Checkcode: any = '';
  @MutationAction
  async updateTaskRecord(params: any) {
    const result: any = await http.put(url.lanjuequipment.product.RepairAudit.check, params);
    const Checkcode = result.code;
    return { Checkcode };
  }
  @MutationAction
  async rowdatanull() {
    const rowdata: [] = [];
    return { rowdata };
  }
}

export default getModule(RepairAudit);
