确定合同功能模式

This commit is contained in:
huangdeliang
2020-10-26 00:46:16 +08:00
parent 378b6ef815
commit 8b93c763c3
6 changed files with 114 additions and 84 deletions

View File

@ -91,8 +91,15 @@ public class SysContractController extends BaseController {
@GetMapping("/file/{id}") @GetMapping("/file/{id}")
public String getContract(@PathVariable long id) { public AjaxResult getfile(@PathVariable long id) {
return redirect("/swagger-ui.html"); try {
AjaxResult ajax = AjaxResult.success();
// ajax.put("url", "/login");
ajax.put("data", id);
return ajax;
} catch (Exception e) {
return AjaxResult.error(e.getMessage());
}
} }
/** /**

View File

@ -50,4 +50,11 @@ export function exportContract(query) {
method: 'get', method: 'get',
params: query params: query
}) })
} }
export function getFile(id) {
return request({
url: '/custom/contract/file/' + id,
method: 'get',
})
}

View File

@ -1,20 +1,20 @@
import router from './router' import router from './router'
import store from './store' import store from './store'
import { Message } from 'element-ui' import {Message} from 'element-ui'
import NProgress from 'nprogress' import NProgress from 'nprogress'
import 'nprogress/nprogress.css' import 'nprogress/nprogress.css'
import { getToken } from '@/utils/auth' import {getToken} from '@/utils/auth'
NProgress.configure({ showSpinner: false }) NProgress.configure({showSpinner: false})
const whiteList = ['/login', '/auth-redirect', '/bind', '/register', '/sign'] const whiteList = ['/login', '/auth-redirect', '/bind', '/register']
router.beforeEach((to, from, next) => { router.beforeEach((to, from, next) => {
NProgress.start() NProgress.start()
if (getToken()) { if (getToken()) {
/* has token*/ /* has token*/
if (to.path === '/login') { if (to.path === '/login') {
next({ path: '/' }) next({path: '/'})
NProgress.done() NProgress.done()
} else { } else {
if (store.getters.roles.length === 0) { if (store.getters.roles.length === 0) {
@ -22,18 +22,18 @@ router.beforeEach((to, from, next) => {
store.dispatch('GetInfo').then(res => { store.dispatch('GetInfo').then(res => {
// 拉取user_info // 拉取user_info
const roles = res.roles const roles = res.roles
store.dispatch('GenerateRoutes', { roles }).then(accessRoutes => { store.dispatch('GenerateRoutes', {roles}).then(accessRoutes => {
// 测试 默认静态页面 // 测试 默认静态页面
// store.dispatch('permission/generateRoutes', { roles }).then(accessRoutes => { // store.dispatch('permission/generateRoutes', { roles }).then(accessRoutes => {
// 根据roles权限生成可访问的路由表 // 根据roles权限生成可访问的路由表
router.addRoutes(accessRoutes) // 动态添加可访问路由表 router.addRoutes(accessRoutes) // 动态添加可访问路由表
next({ ...to, replace: true }) // hack方法 确保addRoutes已完成 next({...to, replace: true}) // hack方法 确保addRoutes已完成
}) })
}) })
.catch(err => { .catch(err => {
store.dispatch('FedLogOut').then(() => { store.dispatch('FedLogOut').then(() => {
Message.error(err) Message.error(err)
next({ path: '/' }) next({path: '/'})
}) })
}) })
} else { } else {
@ -49,7 +49,7 @@ router.beforeEach((to, from, next) => {
} }
} else { } else {
// 没有token // 没有token
if (whiteList.indexOf(to.path) !== -1) { if (whiteList.indexOf(to.path) !== -1 || to.path.startsWith('/contract')) {
// 在免登录白名单,直接进入 // 在免登录白名单,直接进入
next() next()
} else { } else {

View File

@ -125,9 +125,10 @@ export const constantRoutes = [
] ]
}, },
{ {
path: '/sign', path: '/contract/:id(\\d+)',
hidden: true, hidden: true,
component: (resolve) => require(['@/views/custom/signContract'], resolve), component: (resolve) => require(['@/views/custom/signContract'], resolve),
meta: { title: '合同' }
} }
] ]

View File

@ -1,85 +1,59 @@
<template> <template>
<div class="dashboard-editor-container"> <div v-if="show">
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<panel-group @handleSetLineChartData="handleSetLineChartData"/> <el-form-item label="姓名" prop="name">
<el-input v-model="form.name" placeholder="请输入客户姓名"/>
<el-row style="background:#fff;padding:16px 16px 0;margin-bottom:32px;"> </el-form-item>
<line-chart :chart-data="lineChartData"/> <el-form-item label="电话" prop="phone">
</el-row> <el-input v-model="form.phone" placeholder="请输入电话"/>
</el-form-item>
<!-- <el-row :gutter="32">--> </el-form>
<!-- <el-col :xs="24" :sm="24" :lg="8">--> <el-button type="primary" @click="submitForm">提交</el-button>
<!-- <div class="chart-wrapper">-->
<!-- <raddar-chart />-->
<!-- </div>-->
<!-- </el-col>-->
<!-- <el-col :xs="24" :sm="24" :lg="8">-->
<!-- <div class="chart-wrapper">-->
<!-- <pie-chart />-->
<!-- </div>-->
<!-- </el-col>-->
<!-- <el-col :xs="24" :sm="24" :lg="8">-->
<!-- <div class="chart-wrapper">-->
<!-- <bar-chart />-->
<!-- </div>-->
<!-- </el-col>-->
<!-- </el-row>-->
</div> </div>
</template> </template>
<script> <script>
import PanelGroup from '@/views/dashboard/PanelGroup'
import LineChart from '@/views/dashboard/LineChart'
import RaddarChart from '@/views/dashboard/RaddarChart'
import PieChart from '@/views/dashboard/PieChart'
import BarChart from '@/views/dashboard/BarChart'
import Base64 from 'base-64';
const lineChartData = { import {getFile} from "@/api/custom/contract";
newVisitis: {
expectedData: [100, 120, 161, 134, 105, 160, 165],
actualData: [120, 82, 91, 154, 162, 140, 145]
},
messages: {
expectedData: [200, 192, 120, 144, 160, 130, 140],
actualData: [180, 160, 151, 106, 145, 150, 130]
},
purchases: {
expectedData: [80, 100, 121, 104, 105, 90, 100],
actualData: [120, 90, 100, 138, 142, 130, 130]
},
shoppings: {
expectedData: [130, 140, 141, 142, 145, 150, 160],
actualData: [120, 82, 91, 154, 162, 140, 130]
}
}
let params = window.location.search.substring(1);
if(params){
params = Base64.decode( window.location.search.substring(1))
params = this.searchToParams((params));
}
console.log(params)
export default { export default {
name: 'Index', name: 'sign',
components: {
PanelGroup,
LineChart,
RaddarChart,
PieChart,
BarChart
},
data() { data() {
return { return {
lineChartData: lineChartData.newVisitis show: false,
form: {},
rules: {
name: [
{required: true, message: "姓名不能为空", trigger: "blur"}
],
phone: [
{required: true, message: "电话不能为空", trigger: "blur"}
]
}
} }
}, },
created() {
this.getContract();
},
methods: { methods: {
handleSetLineChartData(type) { getContract() {
this.lineChartData = lineChartData[type] const {pathname} = window.location;
const id = pathname.substring(pathname.lastIndexOf('/') + 1);
console.log(id)
getFile(id).then(result => {
if (result.url) {
this.$router.push(result.url);
} else if (result.data) {
this.show = true;
}
})
},
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
this.$emit('handleOnSubmit', this.form);
}
})
} }
} }
} }

View File

@ -0,0 +1,41 @@
<template>
<div>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="姓名" prop="name">
<el-input v-model="form.name" placeholder="请输入客户姓名"/>
</el-form-item>
<el-form-item label="电话" prop="phone">
<el-input v-model="form.phone" placeholder="请输入电话"/>
</el-form-item>
</el-form>
<el-button type="primary" @click="submitForm">提交</el-button>
</div>
</template>
<script>
export default {
name: 'signContract',
data() {
return {
form: {},
rules: {
name: [
{required: true, message: "姓名不能为空", trigger: "blur"}
],
phone: [
{required: true, message: "电话不能为空", trigger: "blur"}
]
}
}
},
methods: {
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
this.$emit('handleOnSubmit', this.form);
}
})
}
}
}
</script>