政策库的完成,前端配置页面的初始化
This commit is contained in:
4
.prettierrc
Normal file
4
.prettierrc
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
{
|
||||||
|
"semi": true,
|
||||||
|
"singleQuote": true
|
||||||
|
}
|
@ -1,19 +1,78 @@
|
|||||||
import request from '@/utils/request';
|
import request from '@/utils/request';
|
||||||
|
|
||||||
// 获取标签列表
|
// 获取政策列表
|
||||||
export function getLabel(params) {
|
export function getPolicy(data) {
|
||||||
return request({
|
return request({
|
||||||
url: '/label/getLabel123',
|
url:
|
||||||
method: 'get',
|
'/policy/getPolicy?pageNum=' +
|
||||||
params
|
data.pageNum +
|
||||||
});
|
'&pageSize=' +
|
||||||
}
|
data.pageSize,
|
||||||
|
|
||||||
// 新增更新信号量
|
|
||||||
export function save(data) {
|
|
||||||
return request({
|
|
||||||
url: '/system/signal/save',
|
|
||||||
method: 'post',
|
method: 'post',
|
||||||
data
|
data
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
// 删除政策信息 body里ids数组
|
||||||
|
export function delPolicy(data) {
|
||||||
|
return request({
|
||||||
|
url: '/policy/delPolicy',
|
||||||
|
method: 'post',
|
||||||
|
data
|
||||||
|
});
|
||||||
|
}
|
||||||
|
// 获取政策标签管理初始化数据
|
||||||
|
export function getLabelSetting(params) {
|
||||||
|
return request({
|
||||||
|
url: '/policy/getLabelSetting',
|
||||||
|
method: 'get',
|
||||||
|
params
|
||||||
|
});
|
||||||
|
}
|
||||||
|
// 设置政策标签 body里id(政策),ids(标签id数组)
|
||||||
|
export function setPolicyLabel(data) {
|
||||||
|
return request({
|
||||||
|
url: '/policy/setPolicyLabel',
|
||||||
|
method: 'post',
|
||||||
|
data
|
||||||
|
});
|
||||||
|
}
|
||||||
|
// 修改政策信息/截止时间设置
|
||||||
|
export function updatePolicy(data) {
|
||||||
|
return request({
|
||||||
|
url: '/policy/updatePolicy',
|
||||||
|
method: 'post',
|
||||||
|
data
|
||||||
|
});
|
||||||
|
}
|
||||||
|
// 批量推送政策标签 body里ids(政策id数组)
|
||||||
|
export function pushPolicy(data) {
|
||||||
|
return request({
|
||||||
|
url: '/policy/pushPolicy',
|
||||||
|
method: 'post',
|
||||||
|
data
|
||||||
|
});
|
||||||
|
}
|
||||||
|
// 取消推送
|
||||||
|
export function noPushPolicy(params) {
|
||||||
|
return request({
|
||||||
|
url: '/policy/noPushPolicy',
|
||||||
|
method: 'get',
|
||||||
|
params
|
||||||
|
});
|
||||||
|
}
|
||||||
|
// 添加政策
|
||||||
|
export function addPolicy(data) {
|
||||||
|
return request({
|
||||||
|
url: '/policy/addPolicy',
|
||||||
|
method: 'post',
|
||||||
|
data
|
||||||
|
});
|
||||||
|
}
|
||||||
|
// 编辑政策的数据回显
|
||||||
|
export function getPolicyInfo(params) {
|
||||||
|
return request({
|
||||||
|
url: '/policy/getPolicyInfo',
|
||||||
|
method: 'get',
|
||||||
|
params
|
||||||
|
});
|
||||||
|
}
|
||||||
|
BIN
src/assets/logo/logo2.png
Normal file
BIN
src/assets/logo/logo2.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.3 KiB |
@ -194,7 +194,11 @@ aside {
|
|||||||
.operate-container .btn-add {
|
.operate-container .btn-add {
|
||||||
float: right;
|
float: right;
|
||||||
}
|
}
|
||||||
//表格栏样式
|
// 表格栏样式
|
||||||
.table-container {
|
.table-container {
|
||||||
margin-top: 20px;
|
margin-top: 20px;
|
||||||
}
|
}
|
||||||
|
// 操作栏样式
|
||||||
|
.operate-container{
|
||||||
|
margin-top: 20px;
|
||||||
|
}
|
@ -1,20 +1,25 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="sidebar-logo-container" :class="{'collapse':collapse}">
|
<div class="sidebar-logo-container" :class="{ collapse: collapse }">
|
||||||
<transition name="sidebarLogoFade">
|
<transition name="sidebarLogoFade">
|
||||||
<router-link v-if="collapse" key="collapse" class="sidebar-logo-link" to="/">
|
<router-link
|
||||||
<img v-if="logo" :src="logo" class="sidebar-logo">
|
v-if="collapse"
|
||||||
<h1 v-else class="sidebar-title">{{ title }}<span>管理端</span></h1>
|
key="collapse"
|
||||||
|
class="sidebar-logo-link"
|
||||||
|
to="/"
|
||||||
|
>
|
||||||
|
<img v-if="logo" :src="logo" class="sidebar-logo" />
|
||||||
|
<!-- <h1 v-else class="sidebar-title">{{ title }}<span>管理端</span></h1> -->
|
||||||
</router-link>
|
</router-link>
|
||||||
<router-link v-else key="expand" class="sidebar-logo-link" to="/">
|
<router-link v-else key="expand" class="sidebar-logo-link" to="/">
|
||||||
<img v-if="logo" :src="logo" class="sidebar-logo">
|
<img v-if="logo" :src="logo" class="sidebar-logo" />
|
||||||
<h1 class="sidebar-title">{{ title }}<span>管理端</span></h1>
|
<!-- <h1 class="sidebar-title">{{ title }}<span>管理端</span></h1> -->
|
||||||
</router-link>
|
</router-link>
|
||||||
</transition>
|
</transition>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import logoImg from '@/assets/logo/logo.png'
|
import logoImg from '@/assets/logo/logo2.png';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'SidebarLogo',
|
name: 'SidebarLogo',
|
||||||
@ -26,12 +31,12 @@ export default {
|
|||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
title: '嘉策',
|
title: '',
|
||||||
// logo: logoImg,
|
logo: logoImg
|
||||||
logo: ''
|
// logo: ''
|
||||||
|
};
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
@ -58,8 +63,8 @@ export default {
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
|
|
||||||
& .sidebar-logo {
|
& .sidebar-logo {
|
||||||
width: 32px;
|
// width: 32px;
|
||||||
height: 32px;
|
// height: 32px;
|
||||||
vertical-align: middle;
|
vertical-align: middle;
|
||||||
margin-right: 12px;
|
margin-right: 12px;
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,7 @@ router.beforeEach((to, from, next) => {
|
|||||||
// 判断当前用户是否已拉取完user_info信息
|
// 判断当前用户是否已拉取完user_info信息
|
||||||
store.dispatch('GetInfo').then(res => {
|
store.dispatch('GetInfo').then(res => {
|
||||||
// 拉取user_info
|
// 拉取user_info
|
||||||
console.log(res.roles);
|
// console.log(res.roles);
|
||||||
const roles = res.roles
|
const roles = res.roles
|
||||||
store.dispatch('GenerateRoutes', { roles }).then(accessRoutes => {
|
store.dispatch('GenerateRoutes', { roles }).then(accessRoutes => {
|
||||||
// 测试 默认静态页面
|
// 测试 默认静态页面
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/** When your routing table is too long, you can split it into small modules **/
|
/** When your routing table is too long, you can split it into small modules **/
|
||||||
|
|
||||||
import Layout from '@/layout'
|
import Layout from '@/layout';
|
||||||
// 政策管理
|
// 政策管理
|
||||||
const nestedRouter = {
|
const nestedRouter = {
|
||||||
path: '/policy',
|
path: '/policy',
|
||||||
@ -10,11 +10,17 @@ const nestedRouter = {
|
|||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
path: 'library',
|
path: 'library',
|
||||||
component: resolve =>
|
component: resolve => require(['@/views/policy/library/index'], resolve),
|
||||||
require(['@/views/policy/library/index'], resolve),
|
|
||||||
name: 'library',
|
name: 'library',
|
||||||
meta: { title: '政策库' }
|
meta: { title: '政策库' }
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: 'add',
|
||||||
|
component: resolve => require(['@/views/policy/library/add'], resolve),
|
||||||
|
name: 'add',
|
||||||
|
meta: { title: '添加' },
|
||||||
|
hidden: true
|
||||||
|
},
|
||||||
{
|
{
|
||||||
path: 'tag',
|
path: 'tag',
|
||||||
component: resolve => require(['@/views/policy/tag/index'], resolve),
|
component: resolve => require(['@/views/policy/tag/index'], resolve),
|
||||||
@ -22,7 +28,6 @@ const nestedRouter = {
|
|||||||
meta: { title: '政策标签' }
|
meta: { title: '政策标签' }
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
};
|
||||||
|
|
||||||
|
export default nestedRouter;
|
||||||
export default nestedRouter
|
|
||||||
|
@ -18,7 +18,7 @@ const permission = {
|
|||||||
// 生成路由
|
// 生成路由
|
||||||
GenerateRoutes({ commit }) {
|
GenerateRoutes({ commit }) {
|
||||||
return new Promise(resolve => {
|
return new Promise(resolve => {
|
||||||
console.log(DynamicRoutes);
|
// console.log(DynamicRoutes);
|
||||||
const accessedRoutes = filterAsyncRouter(DynamicRoutes)
|
const accessedRoutes = filterAsyncRouter(DynamicRoutes)
|
||||||
accessedRoutes.push({ path: '*', redirect: '/404', hidden: true })
|
accessedRoutes.push({ path: '*', redirect: '/404', hidden: true })
|
||||||
commit('SET_ROUTES', accessedRoutes)
|
commit('SET_ROUTES', accessedRoutes)
|
||||||
|
168
src/views/policy/library/add.vue
Normal file
168
src/views/policy/library/add.vue
Normal file
@ -0,0 +1,168 @@
|
|||||||
|
<template>
|
||||||
|
<div class="app-container">
|
||||||
|
<div>添加政策</div>
|
||||||
|
<el-form
|
||||||
|
style="width:50%;margin:15px 0 0 15px"
|
||||||
|
label-position="left"
|
||||||
|
:model="ruleForm"
|
||||||
|
:rules="rules"
|
||||||
|
ref="ruleForm"
|
||||||
|
label-width="80px"
|
||||||
|
>
|
||||||
|
<el-form-item label="政策标题" prop="title">
|
||||||
|
<el-input placeholder="请输入" v-model="ruleForm.title"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="级别" prop="level">
|
||||||
|
<el-select v-model="ruleForm.level" placeholder="请选择">
|
||||||
|
<el-option
|
||||||
|
v-for="item in levelOptions"
|
||||||
|
:key="item.value"
|
||||||
|
:label="item.label"
|
||||||
|
:value="item.value"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="归口" prop="attribute">
|
||||||
|
<el-select v-model="ruleForm.attribute" placeholder="请选择">
|
||||||
|
<el-option
|
||||||
|
v-for="item in attributeOptions"
|
||||||
|
:key="item.value"
|
||||||
|
:label="item.label"
|
||||||
|
:value="item.value"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="发布日期" required>
|
||||||
|
<el-form-item prop="listDate">
|
||||||
|
<el-date-picker
|
||||||
|
type="date"
|
||||||
|
placeholder="选择日期"
|
||||||
|
value-format="yyyy-MM-dd"
|
||||||
|
v-model="ruleForm.listDate"
|
||||||
|
style="width: 30%;"
|
||||||
|
></el-date-picker>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="来源" prop="source">
|
||||||
|
<el-input placeholder="请输入" v-model="ruleForm.source"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="正文" prop="text">
|
||||||
|
<editor v-model="ruleForm.text" :min-height="192" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item>
|
||||||
|
<el-button type="primary" @click="submitForm('ruleForm')"
|
||||||
|
>确定</el-button
|
||||||
|
>
|
||||||
|
<!-- <el-button @click="resetForm('ruleForm')">重置</el-button> -->
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<script>
|
||||||
|
import Editor from '@/components/Editor';
|
||||||
|
import { addPolicy, updatePolicy, getPolicyInfo } from '@/api/policy/library';
|
||||||
|
export default {
|
||||||
|
components: {
|
||||||
|
Editor
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
editPage: false,
|
||||||
|
ruleForm: {
|
||||||
|
title: '',
|
||||||
|
level: '',
|
||||||
|
attribute: '',
|
||||||
|
listDate: '',
|
||||||
|
source: '',
|
||||||
|
text: ''
|
||||||
|
},
|
||||||
|
// 归口选项
|
||||||
|
attributeOptions: [
|
||||||
|
{
|
||||||
|
value: 'KJJ',
|
||||||
|
label: '科技'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: 'JXJ',
|
||||||
|
label: '经信'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: 'FGW',
|
||||||
|
label: '发改'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: 'qita',
|
||||||
|
label: '其他'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
// 级别选项
|
||||||
|
levelOptions: [
|
||||||
|
{
|
||||||
|
value: 1,
|
||||||
|
label: '省级'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: 2,
|
||||||
|
label: '市级'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: 3,
|
||||||
|
label: '区级'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
rules: {
|
||||||
|
title: [{ required: true, message: '请输入政策标题', trigger: 'blur' }],
|
||||||
|
level: [{ required: true, message: '请选择级别', trigger: 'change' }],
|
||||||
|
attribute: [
|
||||||
|
{ required: true, message: '请选择归口', trigger: 'change' }
|
||||||
|
],
|
||||||
|
listDate: [
|
||||||
|
{
|
||||||
|
// type: 'date',
|
||||||
|
required: true,
|
||||||
|
message: '请选择日期',
|
||||||
|
trigger: 'change'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
source: [{ required: true, message: '请填写来源', trigger: 'blur' }],
|
||||||
|
text: [{ required: true, message: '请填写富文本内容', trigger: 'blur' }]
|
||||||
|
}
|
||||||
|
};
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
submitForm(formName) {
|
||||||
|
this.$refs[formName].validate(valid => {
|
||||||
|
if (valid) {
|
||||||
|
if (this.editPage) {
|
||||||
|
// 修改
|
||||||
|
updatePolicy(this.ruleForm).then(({ message }) => {
|
||||||
|
this.msgSuccess(message);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
// 添加
|
||||||
|
addPolicy(this.ruleForm).then(({ message }) => {
|
||||||
|
this.msgSuccess(message);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
this.$router.go(-1);
|
||||||
|
} else {
|
||||||
|
console.log('error submit!!');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
// resetForm(formName) {
|
||||||
|
// this.$refs[formName].resetFields();
|
||||||
|
// }
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
let { id } = this.$route.query;
|
||||||
|
if (id) {
|
||||||
|
this.editPage = true;
|
||||||
|
getPolicyInfo({ policyId: id }).then(({ data }) => {
|
||||||
|
this.ruleForm = data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user