import http from '@/request/index.js'; export const state = { acceptData: [], //验收数据 acceptDetaData: [], // 验收详情头部数据 acceptDetail: [], //验收详情列表数据 refusaData: { // 耗材清单详情数据 index: 0, data: {} }, udiData: [] // udi数据 }; export const mutations = { setAcceptData(state, data) { state.acceptData = data }, setAcceptDetaData(state, data) { state.acceptDetaData = data }, setAcceptDetail(state, data) { state.acceptDetail = data }, setRefusaData(state, data) { state.refusaData = data }, setUdiData(state, data) { state.udiData = data } } export const actions = { //获取待验收数据 getAceptData({ commit, rootState }, data) { return new Promise((resolve, reject) => { http('acceptance.getAwaitListData', data.pam, '加载中').then(res => { if (res.success == true && res.data) { data.that.$refs.paging.complete(res.data.records); } }).catch(e => { reject(e) }) }) }, //获取待验收详情数据 getAwaitDetail({ commit, rootState }, data) { return new Promise((resolve, reject) => { http('acceptance.getAwaitDetailListData', data, '加载中').then(res => { if (res.success == true && res.data) { res.data.records.length && res.data.records.forEach((item) => { if (item.shppCnt == null) { return item.shppCnt = item.stooutCnt; } }) commit('setAcceptDetail', res.data.records) } }).catch(e => { commit('setAcceptDetail', []) reject(e) }) }) }, //获取已验收数据 getAreadyData({ commit, rootState }, data) { return new Promise((resolve, reject) => { http('acceptance.getAlreadyData', data.pam, '加载中').then(res => { if (res.success == true && res.data) { data.that.$refs.paging.complete(res.data.records); } }).catch(e => { reject(e) }) }) }, //获取已验收详情数据 getAreadyDetail({ commit, rootState }, data) { return new Promise((resolve, reject) => { http('acceptance.getAreadyDetailListData', data, '加载中').then(res => { if (res.success == true && res.data) { res.data.records.length && res.data.records.forEach((item) => { if (item.shppCnt == null) { item.shppCnt = item.stooutCnt; } }) commit('setAcceptDetail', res.data.records) } }).catch(e => { commit('setAcceptDetail', []) reject(e) }) }) }, // 验收提交数据 submitAceptData({ commit, rootState }, data) { return new Promise((resolve, reject) => { http('acceptance.subMitAceptData', data, '加载中').then(res => { if (res.success == true) { resolve() } }).catch(e => { reject(e) }) }) }, //获取UDI码数据 getUDIData({ commit, rootState }, data) { return new Promise((resolve, reject) => { http('acceptance.queryUdiData', data, '加载中').then(res => { if (res.success == true) { commit('setUdiData', res.data.records) } }).catch(e => { reject(e) }) }) }, }