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.Inspectionrule',
})
export class Inspectionrule 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 getCheckTypeProjectList(query: any) {
    const result: any = await http.get(url.lanjuquality.Inspection.getCheckTypeProjectList, {
      //loginName: session.loginName,
      params: query,
    });
    const CheckTaskListall = result.rows;
    return { CheckTaskListall };
  }
}

export default getModule(Inspectionrule);
