提交 41a557ec authored 作者: lihuihui's avatar lihuihui

获取选中案例

上级 ca913c1b
......@@ -27,3 +27,8 @@ export function uploadFile(data) {
headers: { 'Content-Type': 'multipart/form-data' }
})
}
// 获取已选中的案例
export function getSelectCase() {
return httpRequest.get('/api/xtraining/api/v1/selected-case')
}
......@@ -7,14 +7,14 @@ export function getCategories(id) {
return httpRequest.get(`/api/xtraining/api/v1/${id}/categories`).then({})
}
// 获取支付过滤条件
// 获取案例列表
export function getCasesList(id) {
return httpRequest.get(`/api/xtraining/api/v1/${id}/cases`)
}
// 分配发票跟进人
export function assignSales(data) {
return httpRequest.post('/api/finance/v1/invoices/assign-sales', data, {})
// 选中案例
export function selectCase(id) {
return httpRequest.post(`/api/xtraining/api/v1/${id}/select-case`, {})
}
// 发票充值
......
......@@ -18,7 +18,7 @@
</div>
</template>
<script>
import { getCategories, getCasesList } from '../api'
import { getCategories, getCasesList, selectCase } from '../api'
export default {
data() {
return {
......@@ -50,14 +50,19 @@ export default {
handleGo() {
const data = this.caseList.find(item => { return item.id === this.caseSelect })
this.$store.commit('setCase', data)
this.selectCase(data.id)
// console.log(this.$store.state.case, '1231')
// this.$router.push({ path: '/product-analysis/report', query: { id: this.caseSelect } })
},
getCasesList(id) {
getCasesList(id).then(res => {
this.caseList = res.data.items
this.caseSelect = res.data.items[0].id
})
},
selectCase(id) {
selectCase(id).then(res => {
this.$router.push({ path: '/product-analysis/report' })
})
}
}
}
......
......@@ -26,6 +26,9 @@ export default {
]
}
},
mounted() {
console.log(this.$store.state.case, '123')
},
methods: {
handleClick(item) {
this.$router.push({ path: '/product-analysis/case-select', query: { type: item.type } })
......
import Vue from 'vue'
import Vuex from 'vuex'
import { getUser, logout } from '@/api/base'
import Vuex, { Store } from 'vuex'
import { getUser, logout, getSelectCase } from '@/api/base'
Vue.use(Vuex)
......@@ -36,6 +36,10 @@ export default new Vuex.Store({
.then(response => {
if (response.code === 0) {
commit('setUser', response.data)
// 获取选中案例
getSelectCase().then(response => {
commit('setCase', response.data.case)
})
return true
} else {
commit('setUser', {})
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论