政策解读的完成。资讯快报页面初始化
This commit is contained in:
34
src/api/front/unscramble.js
Normal file
34
src/api/front/unscramble.js
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
import request from '@/utils/request';
|
||||||
|
|
||||||
|
// 获取政策解读列表
|
||||||
|
export function getPolicyRead(params) {
|
||||||
|
return request({
|
||||||
|
url: '/policy/getPolicyRead',
|
||||||
|
method: 'get',
|
||||||
|
params
|
||||||
|
});
|
||||||
|
}
|
||||||
|
// 删除政策解读
|
||||||
|
export function delRead(params) {
|
||||||
|
return request({
|
||||||
|
url: '/policy/delRead',
|
||||||
|
method: 'get',
|
||||||
|
params
|
||||||
|
});
|
||||||
|
}
|
||||||
|
// 添加/更新政策解读
|
||||||
|
export function read(data) {
|
||||||
|
return request({
|
||||||
|
url: '/policy/read',
|
||||||
|
method: 'post',
|
||||||
|
data
|
||||||
|
});
|
||||||
|
}
|
||||||
|
// 编辑政策解读的数据回显
|
||||||
|
export function getPolicyReadInfo(params) {
|
||||||
|
return request({
|
||||||
|
url: '/policy/getPolicyReadInfo',
|
||||||
|
method: 'get',
|
||||||
|
params
|
||||||
|
});
|
||||||
|
}
|
@ -15,12 +15,26 @@ const nestedRouter = {
|
|||||||
name: 'unscramble',
|
name: 'unscramble',
|
||||||
meta: { title: '政策解读' }
|
meta: { title: '政策解读' }
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: 'addUnscramble',
|
||||||
|
component: resolve => require(['@/views/front/unscramble/add'], resolve),
|
||||||
|
name: 'addUnscramble',
|
||||||
|
meta: { title: '解读' },
|
||||||
|
hidden: true
|
||||||
|
},
|
||||||
{
|
{
|
||||||
path: 'expressNews',
|
path: 'expressNews',
|
||||||
component: resolve =>
|
component: resolve =>
|
||||||
require(['@/views/front/expressNews/index'], resolve),
|
require(['@/views/front/expressNews/index'], resolve),
|
||||||
name: 'expressNews',
|
name: 'expressNews',
|
||||||
meta: { title: '资讯快报' }
|
meta: { title: '资讯快报' }
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: 'addExpressNews',
|
||||||
|
component: resolve => require(['@/views/front/expressNews/add'], resolve),
|
||||||
|
name: 'addExpressNews',
|
||||||
|
meta: { title: '资讯' },
|
||||||
|
hidden: true
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
83
src/views/front/expressNews/add.vue
Normal file
83
src/views/front/expressNews/add.vue
Normal file
@ -0,0 +1,83 @@
|
|||||||
|
<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="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 { read, getPolicyReadInfo } from '@/api/front/unscramble';
|
||||||
|
export default {
|
||||||
|
components: {
|
||||||
|
Editor
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
editPage: false,
|
||||||
|
ruleForm: {
|
||||||
|
title: '',
|
||||||
|
text: ''
|
||||||
|
},
|
||||||
|
rules: {
|
||||||
|
title: [{ required: true, message: '请输入资讯标题', trigger: 'blur' }],
|
||||||
|
text: [{ required: true, message: '请填写富文本内容', trigger: 'blur' }]
|
||||||
|
}
|
||||||
|
};
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
submitForm(formName) {
|
||||||
|
this.$refs[formName].validate(valid => {
|
||||||
|
if (valid) {
|
||||||
|
if (this.editPage) {
|
||||||
|
// 修改
|
||||||
|
read(this.ruleForm).then(({ message }) => {
|
||||||
|
this.msgSuccess(message);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
// 添加
|
||||||
|
read(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;
|
||||||
|
getPolicyReadInfo({ readId: id }).then(({ data }) => {
|
||||||
|
this.ruleForm = data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
@ -1,5 +1,98 @@
|
|||||||
<template>
|
<template>
|
||||||
<div>
|
<div class="app-container">
|
||||||
快报
|
<el-card shadow="never">
|
||||||
|
<i class="el-icon-tickets"></i>
|
||||||
|
<span>数据列表</span>
|
||||||
|
<el-button style="float: right" @click="handlePage(null)" size="mini">
|
||||||
|
添加资讯
|
||||||
|
</el-button>
|
||||||
|
</el-card>
|
||||||
|
<el-table style="width: 100%" class="table-container" :data="categoryList">
|
||||||
|
<el-table-column
|
||||||
|
label="序号"
|
||||||
|
align="center"
|
||||||
|
type="index"
|
||||||
|
></el-table-column>
|
||||||
|
<el-table-column label="资讯标题" prop="name" align="center">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-link type="primary" :underline="false">{{
|
||||||
|
scope.row.name
|
||||||
|
}}</el-link>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="操作" align="center">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-button @click="handlePage(scope.row.id)" type="text" size="small"
|
||||||
|
>编辑</el-button
|
||||||
|
>
|
||||||
|
<el-button
|
||||||
|
@click="handleDelete(scope.row.id)"
|
||||||
|
type="text"
|
||||||
|
size="small"
|
||||||
|
>删除</el-button
|
||||||
|
>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
<script>
|
||||||
|
import {
|
||||||
|
getCategory,
|
||||||
|
addCategory,
|
||||||
|
addLabel,
|
||||||
|
getLabel,
|
||||||
|
update,
|
||||||
|
del
|
||||||
|
} from '@/api/policy/tag';
|
||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
queryParams: {
|
||||||
|
pageNum: 1,
|
||||||
|
pageSize: 100
|
||||||
|
},
|
||||||
|
categoryList: []
|
||||||
|
};
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
handleSearchList() {
|
||||||
|
this.queryParams.pageNum = 1;
|
||||||
|
this.getList();
|
||||||
|
},
|
||||||
|
getList() {
|
||||||
|
getCategory(this.queryParams).then(({ data }) => {
|
||||||
|
this.categoryList = data.list;
|
||||||
|
// this.total = data.total
|
||||||
|
});
|
||||||
|
},
|
||||||
|
// 跳转页面
|
||||||
|
handlePage(id) {
|
||||||
|
this.$router.push({ path: '/front/addExpressNews', query: { id } });
|
||||||
|
},
|
||||||
|
/** 删除按钮操作 */
|
||||||
|
handleDelete(id) {
|
||||||
|
this.$confirm('确认删除该分类?', '提示', {
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
type: 'warning'
|
||||||
|
})
|
||||||
|
.then(function() {
|
||||||
|
return del({ id });
|
||||||
|
})
|
||||||
|
.then(() => {
|
||||||
|
this.getList();
|
||||||
|
this.msgSuccess('删除成功');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.getList();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
// .el-tag + .el-tag {
|
||||||
|
// margin-left: 10px;
|
||||||
|
// }
|
||||||
|
</style>
|
||||||
|
141
src/views/front/unscramble/add.vue
Normal file
141
src/views/front/unscramble/add.vue
Normal file
@ -0,0 +1,141 @@
|
|||||||
|
<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="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 { read, getPolicyReadInfo } from '@/api/front/unscramble';
|
||||||
|
export default {
|
||||||
|
components: {
|
||||||
|
Editor
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
editPage: false,
|
||||||
|
ruleForm: {
|
||||||
|
title: '',
|
||||||
|
attribute: '',
|
||||||
|
listDate: '',
|
||||||
|
source: '',
|
||||||
|
text: ''
|
||||||
|
},
|
||||||
|
// 归口选项
|
||||||
|
attributeOptions: [
|
||||||
|
{
|
||||||
|
value: 'KJJ',
|
||||||
|
label: '科技'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: 'JXJ',
|
||||||
|
label: '经信'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: 'FGW',
|
||||||
|
label: '发改'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: 'qita',
|
||||||
|
label: '其他'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
rules: {
|
||||||
|
title: [{ required: true, message: '请输入解读标题', trigger: 'blur' }],
|
||||||
|
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) {
|
||||||
|
// 修改
|
||||||
|
read(this.ruleForm).then(({ message }) => {
|
||||||
|
this.msgSuccess(message);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
// 添加
|
||||||
|
read(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;
|
||||||
|
getPolicyReadInfo({ readId: id }).then(({ data }) => {
|
||||||
|
this.ruleForm = data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
@ -18,7 +18,7 @@
|
|||||||
:inline="true"
|
:inline="true"
|
||||||
@submit.native.prevent
|
@submit.native.prevent
|
||||||
>
|
>
|
||||||
<el-form-item label="政策标题">
|
<el-form-item label="解读标题">
|
||||||
<el-input v-model="queryParams.title" placeholder="请输入" />
|
<el-input v-model="queryParams.title" placeholder="请输入" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
@ -27,47 +27,53 @@
|
|||||||
<el-card class="operate-container" shadow="never">
|
<el-card class="operate-container" shadow="never">
|
||||||
<i class="el-icon-tickets"></i>
|
<i class="el-icon-tickets"></i>
|
||||||
<span>数据列表</span>
|
<span>数据列表</span>
|
||||||
<el-button class="btn-add" @click="handleAdd" size="mini">
|
<el-button class="btn-add" @click="handlePage(null)" size="mini">
|
||||||
添加分类
|
添加解读
|
||||||
</el-button>
|
</el-button>
|
||||||
</el-card>
|
</el-card>
|
||||||
<el-table style="width: 100%" class="table-container" :data="categoryList">
|
<el-table
|
||||||
|
style="width: 100%"
|
||||||
|
class="table-container"
|
||||||
|
:data="unscrambleList"
|
||||||
|
>
|
||||||
<el-table-column
|
<el-table-column
|
||||||
label="序号"
|
label="序号"
|
||||||
align="center"
|
align="center"
|
||||||
type="index"
|
type="index"
|
||||||
></el-table-column>
|
></el-table-column>
|
||||||
<el-table-column
|
<el-table-column label="解读标题" prop="name" align="center">
|
||||||
label="标签分类"
|
|
||||||
prop="name"
|
|
||||||
align="center"
|
|
||||||
></el-table-column>
|
|
||||||
<el-table-column label="标签" align="center">
|
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-button
|
<el-link type="primary" :underline="false">{{
|
||||||
plain
|
scope.row.title
|
||||||
:disabled="scope.row.name == '类型' ? true : false"
|
}}</el-link>
|
||||||
size="mini"
|
|
||||||
@click="handleAddTag(scope.row.id)"
|
|
||||||
>添加标签</el-button
|
|
||||||
>
|
|
||||||
<el-button plain size="mini" @click="handleLook(scope.row.id)"
|
|
||||||
>查看标签</el-button
|
|
||||||
>
|
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
<el-table-column label="归口" align="center" prop="attribute">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
{{
|
||||||
|
attributeOptions.filter(
|
||||||
|
item => item.value == scope.row.attribute
|
||||||
|
)[0].label
|
||||||
|
}}
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column
|
||||||
|
label="发布日期"
|
||||||
|
align="center"
|
||||||
|
prop="listDate"
|
||||||
|
></el-table-column>
|
||||||
|
<el-table-column
|
||||||
|
label="来源"
|
||||||
|
align="center"
|
||||||
|
prop="source"
|
||||||
|
></el-table-column>
|
||||||
<el-table-column label="操作" align="center">
|
<el-table-column label="操作" align="center">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-button
|
<el-button @click="handlePage(scope.row.id)" type="text" size="small"
|
||||||
@click="editDialog(scope.row)"
|
|
||||||
type="text"
|
|
||||||
size="small"
|
|
||||||
:disabled="scope.row.name == '类型' ? true : false"
|
|
||||||
>编辑</el-button
|
>编辑</el-button
|
||||||
>
|
>
|
||||||
<el-button
|
<el-button
|
||||||
@click="handleDelete(scope.row.id)"
|
@click="handleDelete(scope.row.id)"
|
||||||
:disabled="scope.row.name == '类型' ? true : false"
|
|
||||||
type="text"
|
type="text"
|
||||||
size="small"
|
size="small"
|
||||||
>删除</el-button
|
>删除</el-button
|
||||||
@ -75,69 +81,10 @@
|
|||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
<!-- 添加修改 -->
|
|
||||||
<el-dialog :title="str" :visible.sync="addDialog" width="500px">
|
|
||||||
<el-form :model="form" ref="form" :rules="rules" @submit.native.prevent>
|
|
||||||
<el-form-item label="名称" prop="name" label-width="80px">
|
|
||||||
<el-input v-model="form.name"></el-input>
|
|
||||||
</el-form-item>
|
|
||||||
</el-form>
|
|
||||||
<div slot="footer" class="dialog-footer">
|
|
||||||
<el-button @click="addDialog = false">取 消</el-button>
|
|
||||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
|
||||||
</div>
|
|
||||||
</el-dialog>
|
|
||||||
<!-- 查看可删除 -->
|
|
||||||
<el-dialog title="查看标签" :visible.sync="lookDialog" width="300px">
|
|
||||||
<div v-for="(tag, index) in tagList" :key="tag.id">
|
|
||||||
<el-input
|
|
||||||
style="margin-top:10px;"
|
|
||||||
v-if="editable[index]"
|
|
||||||
v-model="tag.name"
|
|
||||||
:ref="'editableInput' + index"
|
|
||||||
size="small"
|
|
||||||
placeholder="请输入标签信息"
|
|
||||||
@keyup.enter.native="handleEditableInputConfirm(tag, index)"
|
|
||||||
@change="handleEditableInputConfirm(tag, index)"
|
|
||||||
@blur="handleEditableInputBlur(tag, index)"
|
|
||||||
show-word-limit
|
|
||||||
></el-input>
|
|
||||||
<div v-else>
|
|
||||||
<span style="margin-right:10px">{{ index + 1 }}</span>
|
|
||||||
<el-tag
|
|
||||||
style="margin-top:10px;"
|
|
||||||
@click="showEditTagInput(index)"
|
|
||||||
closable
|
|
||||||
@close="handleClose(tag.id, index)"
|
|
||||||
>{{ tag.name }}</el-tag
|
|
||||||
>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<!-- <el-tag
|
|
||||||
v-for="(tag,index) in tagList"
|
|
||||||
:key="tag.id"
|
|
||||||
closable
|
|
||||||
@click="showEditTagInput(index)"
|
|
||||||
@close="closeTag(tag, index)"
|
|
||||||
>
|
|
||||||
{{tag.name}}
|
|
||||||
</el-tag> -->
|
|
||||||
<!-- <div slot="footer" class="dialog-footer">
|
|
||||||
<el-button @click="lookDialog = false">取 消</el-button>
|
|
||||||
<el-button type="primary" @click="handleTag">确 定</el-button>
|
|
||||||
</div> -->
|
|
||||||
</el-dialog>
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import {
|
import { getPolicyRead, delRead } from '@/api/front/unscramble';
|
||||||
getCategory,
|
|
||||||
addCategory,
|
|
||||||
addLabel,
|
|
||||||
getLabel,
|
|
||||||
update,
|
|
||||||
del
|
|
||||||
} from '@/api/policy/tag';
|
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
@ -145,133 +92,51 @@ export default {
|
|||||||
pageNum: 1,
|
pageNum: 1,
|
||||||
pageSize: 100
|
pageSize: 100
|
||||||
},
|
},
|
||||||
// total:0,
|
unscrambleList: [],
|
||||||
categoryList: [],
|
// 归口选项
|
||||||
form: {
|
attributeOptions: [
|
||||||
name: ''
|
{
|
||||||
},
|
value: 'KJJ',
|
||||||
addDialog: false,
|
label: '科技'
|
||||||
lookDialog: false,
|
},
|
||||||
tagList: [],
|
{
|
||||||
// 当前行
|
value: 'JXJ',
|
||||||
rowId: null,
|
label: '经信'
|
||||||
// 弹出层标题
|
},
|
||||||
str: '',
|
{
|
||||||
// 表单校验
|
value: 'FGW',
|
||||||
rules: {
|
label: '发改'
|
||||||
name: [{ required: true, message: '名称不能为空', trigger: 'blur' }]
|
},
|
||||||
},
|
{
|
||||||
editable: []
|
value: 'qita',
|
||||||
|
label: '其他'
|
||||||
|
}
|
||||||
|
]
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
handleSearchList() {
|
||||||
|
this.queryParams.pageNum = 1;
|
||||||
|
this.getList();
|
||||||
|
},
|
||||||
getList() {
|
getList() {
|
||||||
getCategory(this.queryParams).then(({ data }) => {
|
getPolicyRead(this.queryParams).then(({ data }) => {
|
||||||
this.categoryList = data.list;
|
this.unscrambleList = data.list;
|
||||||
// this.total = data.total
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
/** 新增按钮操作 */
|
// 跳转页面
|
||||||
handleAdd() {
|
handlePage(id) {
|
||||||
this.reset();
|
this.$router.push({ path: '/front/addUnscramble', query: { id } });
|
||||||
this.addDialog = true;
|
|
||||||
this.str = '添加标签分类';
|
|
||||||
},
|
|
||||||
handleAddTag(id) {
|
|
||||||
this.handleAdd();
|
|
||||||
this.str = '添加标签';
|
|
||||||
this.rowId = id;
|
|
||||||
},
|
|
||||||
/** 表单重置 */
|
|
||||||
reset() {
|
|
||||||
this.form = {
|
|
||||||
name: ''
|
|
||||||
};
|
|
||||||
this.resetForm('form');
|
|
||||||
},
|
|
||||||
/** 提交表单 */
|
|
||||||
submitForm() {
|
|
||||||
this.$refs['form'].validate(valid => {
|
|
||||||
if (valid) {
|
|
||||||
if (this.str === '添加标签分类') {
|
|
||||||
addCategory(this.form).then(({ message }) => {
|
|
||||||
this.msgSuccess(message);
|
|
||||||
this.addDialog = false;
|
|
||||||
this.getList();
|
|
||||||
});
|
|
||||||
} else if (this.str === '添加标签') {
|
|
||||||
addLabel(Object.assign({}, { id: this.rowId }, this.form)).then(
|
|
||||||
({ message }) => {
|
|
||||||
this.msgSuccess(message);
|
|
||||||
this.addDialog = false;
|
|
||||||
this.getList();
|
|
||||||
}
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
update(this.form).then(({ message }) => {
|
|
||||||
this.msgSuccess(message);
|
|
||||||
this.addDialog = false;
|
|
||||||
this.getList();
|
|
||||||
});
|
|
||||||
// addLabel(Object.assign({},{id:this.rowId},this.form)).then(({message}) => {
|
|
||||||
// this.msgSuccess(message);
|
|
||||||
// this.addDialog = false;
|
|
||||||
// this.getList();
|
|
||||||
// });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
|
||||||
/** 查看标签 */
|
|
||||||
handleLook(id) {
|
|
||||||
this.lookDialog = true;
|
|
||||||
getLabel(Object.assign({}, { id }, this.queryParams)).then(({ data }) => {
|
|
||||||
this.tagList = data.list;
|
|
||||||
});
|
|
||||||
},
|
|
||||||
// 编辑 input发生改变
|
|
||||||
handleEditableInputConfirm(item, index) {
|
|
||||||
if (item.name) {
|
|
||||||
// 把当前修改的发送
|
|
||||||
update(item).then(res => {
|
|
||||||
this.$set(this.editable, index, false);
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
this.$message({ message: '请输入标签信息', type: 'info' });
|
|
||||||
}
|
|
||||||
},
|
|
||||||
//编辑 input失去焦点
|
|
||||||
handleEditableInputBlur(item, index) {
|
|
||||||
this.handleEditableInputConfirm(item, index);
|
|
||||||
},
|
|
||||||
// 编辑 input显示
|
|
||||||
showEditTagInput(index) {
|
|
||||||
this.$set(this.editable, index, true);
|
|
||||||
this.$nextTick(_ => {
|
|
||||||
let editableInput = 'editableInput' + index;
|
|
||||||
this.$refs[editableInput][0].$refs.input.focus();
|
|
||||||
});
|
|
||||||
},
|
|
||||||
handleClose(id, i) {
|
|
||||||
del({ id }).then(res => {
|
|
||||||
this.tagList.splice(i, 1);
|
|
||||||
});
|
|
||||||
// this.tagList.splice(this.tagList.indexOf(id), 1);
|
|
||||||
},
|
|
||||||
editDialog(row) {
|
|
||||||
this.form = Object.assign({}, row);
|
|
||||||
this.addDialog = true;
|
|
||||||
this.str = '修改标签分类';
|
|
||||||
},
|
},
|
||||||
/** 删除按钮操作 */
|
/** 删除按钮操作 */
|
||||||
handleDelete(id) {
|
handleDelete(id) {
|
||||||
this.$confirm('确认删除该分类?', '提示', {
|
this.$confirm('确认删除该数据?', '提示', {
|
||||||
confirmButtonText: '确定',
|
confirmButtonText: '确定',
|
||||||
cancelButtonText: '取消',
|
cancelButtonText: '取消',
|
||||||
type: 'warning'
|
type: 'warning'
|
||||||
})
|
})
|
||||||
.then(function() {
|
.then(function() {
|
||||||
return del({ id });
|
return delRead({ id });
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
this.getList();
|
this.getList();
|
||||||
@ -284,8 +149,3 @@ export default {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
<style lang="scss" scoped>
|
|
||||||
// .el-tag + .el-tag {
|
|
||||||
// margin-left: 10px;
|
|
||||||
// }
|
|
||||||
</style>
|
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
<el-card shadow="never">
|
<el-card shadow="never">
|
||||||
<i class="el-icon-tickets"></i>
|
<i class="el-icon-tickets"></i>
|
||||||
<span>数据列表</span>
|
<span>数据列表</span>
|
||||||
<el-button class="btn-add" @click="handleAdd" size="mini">
|
<el-button style="float: right" @click="handleAdd" size="mini">
|
||||||
添加分类
|
添加分类
|
||||||
</el-button>
|
</el-button>
|
||||||
</el-card>
|
</el-card>
|
||||||
|
Reference in New Issue
Block a user