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.raw.badtable',
})
export class badtable extends VuexModule {
  locList2: any = [];
  materialtypeList: any = '';
  @MutationAction
  async getmaterialTypePDA() {
    const result: any = await http.get(url.lanjuquality.Materialinspection.getDictData, {
      //loginName: session.loginName,
      params: {
        dictType: 'material_type_oa',
      },
    });
    console.log(result);
    const materialtypeList: [] = result;
    const locList2 = materialtypeList.map((item: any) => ({
      label: item.ymdTypeName,
      value: item.ymdType,
    }));
    return { locList2 };
  }
  alldefectList: any = [];
  @MutationAction
  async getdefectList(params) {
    const result: any = await http.get(url.lanjuquality.Materialinspection.getClassInfoList, {
      //loginName: session.loginName,
      params: {
        defectCode: params,
      },
    });
    console.log(result);
    const materialtypeList: [] = result.data;
    const alldefectList = materialtypeList.map((item: any) => ({
      label: item.className,
      value: item.id,
    }));
    return { alldefectList };
  }
}

export default getModule(badtable);
