提交 dbfc6d34 authored 作者: pengxiaohui's avatar pengxiaohui

update: 优化一些交互

上级 3534d9a2
...@@ -42,3 +42,8 @@ export function getSelectRole() { ...@@ -42,3 +42,8 @@ export function getSelectRole() {
export function getWorkStatus() { export function getWorkStatus() {
return httpRequest.get('/api/xtraining/api/v1/show/analysis-status') return httpRequest.get('/api/xtraining/api/v1/show/analysis-status')
} }
// 选中案例
export function selectCase(id) {
return httpRequest.post(`/api/xtraining/api/v1/${id}/select-case`, {})
}
...@@ -40,12 +40,14 @@ export default { ...@@ -40,12 +40,14 @@ export default {
}, },
methods: { methods: {
handleClose() { handleClose() {
this.type = ''
this.$emit('input', false) this.$emit('input', false)
}, },
handleProdSelect(val) { handleProdSelect(val) {
this.type = val this.type = val
}, },
handleCaseSelect() { handleCaseSelect() {
this.type = ''
this.$emit('input', false) this.$emit('input', false)
} }
} }
......
...@@ -21,7 +21,8 @@ ...@@ -21,7 +21,8 @@
</div> </div>
</template> </template>
<script> <script>
import { getCategories, getCasesList, selectCase } from './api' import { getCategories, getCasesList } from './api'
import { selectCase } from '@/api/base'
export default { export default {
data() { data() {
return { return {
...@@ -54,13 +55,14 @@ export default { ...@@ -54,13 +55,14 @@ export default {
if (Array.isArray(this.$store.state.case)) { if (Array.isArray(this.$store.state.case)) {
this.selectConfirm() this.selectConfirm()
} else { } else {
this.$confirm('切换案例,当前填写的内容不会保存', '提示', { // this.$confirm('切换案例,当前填写的内容不会保存', '提示', {
confirmButtonText: '确定', // confirmButtonText: '确定',
cancelButtonText: '取消', // cancelButtonText: '取消',
type: 'warning' // type: 'warning'
}).then(() => { // }).then(() => {
// this.selectCase()
// })
this.selectCase() this.selectCase()
})
} }
}, },
selectConfirm() { selectConfirm() {
...@@ -76,8 +78,11 @@ export default { ...@@ -76,8 +78,11 @@ export default {
}, },
selectCase() { selectCase() {
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)
selectCase(data.id).then(res => { selectCase(data.id).then(res => {
let msg = '选择'
if (this.$store.state.case.id) msg = '切换'
this.$message.success(msg + '案例成功!')
this.$store.commit('setCase', data)
this.$emit('select', data) this.$emit('select', data)
}) })
} }
......
...@@ -3,11 +3,11 @@ ...@@ -3,11 +3,11 @@
<div class="header-bar"> <div class="header-bar">
<app-menu /> <app-menu />
<div> <div>
<el-button @click="visible = true" style="height: fit-content;" type="primary" v-if="showCaseSelect">切换案例</el-button> <!-- <el-button @click="visible = true" style="height: fit-content;" type="primary" v-if="showCaseSelect">切换案例</el-button> -->
<el-button @click="drawerVisible = true" style="height: fit-content;" type="primary" v-if="showCaseDetails">查看案例</el-button> <el-button @click="drawerVisible = true" style="height: fit-content;" type="primary" v-if="showCaseDetails">查看案例</el-button>
</div> </div>
</div> </div>
<case-select v-model="visible"></case-select> <!-- <case-select v-model="visible"></case-select> -->
<el-drawer title="" size="640px" :visible.sync="drawerVisible"> <el-drawer title="" size="640px" :visible.sync="drawerVisible">
<embed class="embed" width="100%" height="100%" :src="cases.pdf_uris[0]" /> <embed class="embed" width="100%" height="100%" :src="cases.pdf_uris[0]" />
</el-drawer> </el-drawer>
...@@ -16,18 +16,18 @@ ...@@ -16,18 +16,18 @@
<script> <script>
import AppMenu from '../base/AppMenu.vue' import AppMenu from '../base/AppMenu.vue'
import CaseSelect from '@/components/caseSelect/Index.vue' // import CaseSelect from '@/components/caseSelect/Index.vue'
export default { export default {
name: 'AppHeader', name: 'AppHeader',
components: { AppMenu, CaseSelect }, components: { AppMenu },
computed: { computed: {
path() { path() {
return this.$route.path return this.$route.path
}, },
showCaseSelect() { // showCaseSelect() {
if (this.path !== '/home' && !this.path.includes('/works-show')) return true // if (this.path !== '/home' && !this.path.includes('/works-show')) return true
else return false // else return false
}, // },
showCaseDetails() { showCaseDetails() {
if (this.path.includes('/user-study') || this.path.includes('/market-tools')) return true if (this.path.includes('/user-study') || this.path.includes('/market-tools')) return true
else return false else return false
......
...@@ -2,7 +2,8 @@ ...@@ -2,7 +2,8 @@
<div class="home"> <div class="home">
<div class="top"> <div class="top">
<el-button style="margin-left:10px;" type="primary" size="medium" plain round @click="handleLogout">退出系统</el-button> <el-button style="margin-left:10px;" type="primary" size="medium" plain round @click="handleLogout">退出系统</el-button>
<el-button type="primary" size="medium" plain round @click="roleVisible = true">切换角色</el-button> <!-- <el-button type="primary" size="medium" plain round @click="roleVisible = true">切换角色</el-button> -->
<el-button type="primary" size="medium" plain round @click="visible = true">切换案例</el-button>
</div> </div>
<div class="inner"> <div class="inner">
<div class="header"> <div class="header">
...@@ -12,7 +13,7 @@ ...@@ -12,7 +13,7 @@
<btn v-for="(item, index) in btnList" :key="index" :attrs="{ title: item.label, left: item.left, top: item.top }" @click.native="handleClick(item)" :disabled="item.disabled.includes(role)"/> <btn v-for="(item, index) in btnList" :key="index" :attrs="{ title: item.label, left: item.left, top: item.top }" @click.native="handleClick(item)" :disabled="item.disabled.includes(role)"/>
</div> </div>
<role-select :visible="roleVisible" @roleSelect="fetchSelectRole" /> <role-select :visible="roleVisible" @roleSelect="fetchSelectRole" />
<case-select v-model="visible" :show-close="false"></case-select> <case-select v-model="visible" :show-close="!!_case.id"></case-select>
</div> </div>
</template> </template>
...@@ -42,7 +43,7 @@ export default { ...@@ -42,7 +43,7 @@ export default {
path() { path() {
return this.$route.path return this.$route.path
}, },
case() { _case() {
return this.$store.state.case return this.$store.state.case
}, },
role() { role() {
...@@ -50,7 +51,7 @@ export default { ...@@ -50,7 +51,7 @@ export default {
} }
}, },
created() { created() {
if (this.case && !this.case.id) { if (this._case && !this._case.id) {
this.visible = true this.visible = true
} }
if (this.role !== 4) { if (this.role !== 4) {
......
...@@ -170,7 +170,8 @@ export default { ...@@ -170,7 +170,8 @@ export default {
const tableFilter = {} const tableFilter = {}
this.questions.forEach(item => { this.questions.forEach(item => {
if (item.selection.length) { if (item.selection.length) {
tableFilter[item.tag] = item.selection[0].tag const tagArr = item.selection.map(it => it.tag)
tableFilter[item.tag] = tagArr.join(',')
} }
}) })
this.tableFilter = tableFilter this.tableFilter = tableFilter
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论