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.ProductSample',
})
export class ProductSample extends VuexModule {
  list: any = [];
  @MutationAction
  async selectQcCheckSampleTaskList(query: any): Promise<{ list: any }> {
    const result: any = await http.get(url.lanjuquality.ProductSample.getQcCheckSampleTaskList, {
      params: query,
    });
    const list = result.rows;
    return { list };
  }

  confirmCode: any = '';
  @MutationAction
  async updateQcCheckSampleTask(data: any): Promise<{ confirmCode: string }> {
    const result: any = await http.put(url.lanjuquality.ProductSample.updateQcCheckSampleTask, data);
    const confirmCode = result.code;
    return { confirmCode };
  }
}

export default getModule(ProductSample);
