import { getModule, Module, MutationAction, VuexModule } from 'vuex-module-decorators';
import store from '@/store';
import http from '@/utils/request';
import { url } from '@/utils/url';
import { session } from '@/store/modules/session';
@Module({
  namespaced: true,
  dynamic: true,
  store,
  name: 'page.raw.Inspectionunit',
})
export class Inspectionunit extends VuexModule {
  WlList = [];
  orderNoItemList: any = [];
  selectList: any = [];
  @MutationAction
  async getCheckType() {
    const result: any = await http.get(url.lanjuquality.Inspection.pdaMaterialTree, {
      //loginName: session.loginName,
      params: {
        factoryCode: session.PoolName,
      },
    });
    const orderNoItemList = result.data;
    const selectList = result.data.map((item: any) => ({
      label: item.checkName,
      value: item.orderCode,
    }));
    return { orderNoItemList, selectList };
  }
  CheckTaskListall: any = [];
  @MutationAction
  async getQcUnitList() {
    const result: any = await http.get(url.lanjuquality.Inspection.getQcUnitList, {
      //loginName: session.loginName,
      params: {},
    });
    const CheckTaskListall = result.rows;
    return { CheckTaskListall };
  }
}

export default getModule(Inspectionunit);
