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.Belowstandard',
})
export class Belowstandard extends VuexModule {
  WlList = [];
  orderNoItemList: any = [];
  selectList: any = [];
  @MutationAction
  async getCheckType() {
    const result: any = await http.get(url.lanjuquality.Materialinspection.getCheckType, {
      //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 getCheckTaskListall(query: any) {
    const result: any = await http.get(url.lanjuquality.Materialinspection.getUnqualifiedListMobile, {
      //loginName: session.loginName,
      params: query,
    });
    const CheckTaskListall = result;
    return { CheckTaskListall };
  }
  CheckTaskList: any = [];
  @MutationAction
  async getCheckTaskList(belongTo: any) {
    const result: any = await http.get(url.lanjuquality.Materialinspection.getOAInfoListMobile, {
      //loginName: session.loginName,
      params: {
        taskId: belongTo,
      },
    });
    const CheckTaskList = result;
    return { CheckTaskList };
  }
  SubmitCode: any = '';
  @MutationAction
  async commitCheckTaskList(params: any) {
    const result: any = await http.post(url.lanjuquality.Materialinspection.commitCheckTaskList, params);
    const SubmitCode: [] = result;
    return { SubmitCode };
  }
}

export default getModule(Belowstandard);
