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

获取选中案例

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