Commit ae718f44 by hank

修改交互

parent d77aac57
import request from '@/utils/request'
/**
* 获取预警发布列表
* @param {*} p
* @param {*} c
*/
export function getList(query = {}, p = 1, c = 200) {
return request({
url: '/event/get/list',
method: 'post',
data: {
beginTime: query.beginTime,
endTime: query.endTime,
type: query.type,
title: query.title
},
params: {
p, c
}
})
}
/**
*
* @param {*} eventId
* 获取预警发布详情
*/
export function getDetail(eventId) {
return request({
url: `/event/get/info/${eventId}`,
method: 'get'
})
}
/**
* 删除预警发布
* @param {*} eventId
*/
export function del(eventId) {
return request({
url: `/event/del/info/${eventId}`,
method: 'get'
})
}
/**
* 更新预警发布信息
* @param {*} data
*/
export function update(data = {}) {
console.log(data)
return request({
url: `/event/update/info`,
method: 'post',
data: data
})
}
export function add(data = {}) {
return request({
url: `/event/add/info`,
method: 'post',
data: data
})
}
import request from '@/utils/request'
/**
* 获取预警发布列表
* @param {*} p
* @param {*} cconstruction/add/info
新增预警中心建设接口
*/
export function getList(query = {}, p = 1, c = 200) {
return request({
url: '/construction/get/list',
method: 'post',
data: {
beginTime: query.beginTime,
endTime: query.endTime,
type: query.type,
title: query.title
},
params: {
p, c
}
})
}
/**
*
* @param {*} constructionId
* 获取预警发布详情
*/
export function getDetail(constructionId) {
return request({
url: `/construction/get/info/${constructionId}`,
method: 'get'
})
}
/**
* 删除预警发布
* @param {*} constructionId
*/
export function del(constructionId) {
return request({
url: `/construction/del/info/${constructionId}`,
method: 'get'
})
}
/**
* 更新预警发布信息
* @param {*} data
*/
export function update(data = {}) {
console.log(data)
return request({
url: `/construction/update/info`,
method: 'post',
data: data
})
}
export function add(data = {}) {
return request({
url: `/construction/add/info`,
method: 'post',
data: data
})
}
import request from '@/utils/request'
export function getCenterType(type) {
return request({
url: `/centre/get/info/${type}`,
method: 'get'
})
}
export function updateCenterType(data) {
return request({
url: `/centre/update/info`,
method: 'post',
data
})
}
......@@ -15,15 +15,29 @@ export function getValueList(p = 1, c = 20) {
}
})
}
export function getProvince() {
return request({
url: '/area/get/province',
method: 'get',
params: {
}
})
}
export function updateTitle(tiltle) {
return request({
url: '/system/get/variable/list',
url: '/index/update/title',
method: 'post',
data: {
tiltle
}
})
}
export function getTitle() {
return request({
url: '/index/get/title',
method: 'get'
})
}
export function uploadUrl() {
return process.env.VUE_APP_BASE_API + '/common/upload/resource'
}
import request from '@/utils/request'
/**
* 获取联系人列表
* @param {*} p
* @param {*} c
*/
export function getList(query = {}, p = 1, c = 200) {
return request({
url: '/liaison/get/list',
method: 'post',
data: {
beginTime: query.beginTime,
endTime: query.endTime,
code: query.code,
title: query.title
},
params: {
p, c
}
})
}
/**
*
* @param {*} liaisonId
* 获取联系人详情
*/
export function getDetail(liaisonId) {
return request({
url: `/liaison/get/info/${liaisonId}`,
method: 'get'
})
}
/**
* 删除联系人
* @param {*} liaisonId
*/
export function del(liaisonId) {
return request({
url: `/liaison/del/info/${liaisonId}`,
method: 'get'
})
}
/**
* 更新联系人信息
* @param {*} data
*/
export function update(data = {}) {
console.log(data)
return request({
url: `/liaison/update/info`,
method: 'post',
data: data
})
}
export function add(data = {}) {
return request({
url: `/liaison/add/info`,
method: 'post',
data: data
})
}
import request from '@/utils/request'
/**
* 获取预警发布列表
* @param {*} p
* @param {*} c
*/
export function getList(query = {}, p = 1, c = 200) {
return request({
url: '/benefit/get/list',
method: 'post',
data: {
beginTime: query.beginTime,
endTime: query.endTime,
type: query.type,
title: query.title
},
params: {
p, c
}
})
}
/**
*
* @param {*} benefitId
* 获取预警发布详情
*/
export function getDetail(benefitId) {
return request({
url: `/benefit/get/info/${benefitId}`,
method: 'get'
})
}
/**
* 删除预警发布
* @param {*} benefitId
*/
export function del(benefitId) {
return request({
url: `/benefit/del/info/${benefitId}`,
method: 'get'
})
}
/**
* 更新预警发布信息
* @param {*} data
*/
export function update(data = {}) {
console.log(data)
return request({
url: `/benefit/update/info`,
method: 'post',
data: data
})
}
export function add(data = {}) {
return request({
url: `/benefit/add/info`,
method: 'post',
data: data
})
}
import request from '@/utils/request'
/**
* 获取预警发布列表
* @param {*} p
* @param {*} c
*/
export function getList(query = {}, p = 1, c = 200) {
return request({
url: '/promotional/get/list',
method: 'post',
data: {
beginTime: query.beginTime,
endTime: query.endTime,
type: query.type,
title: query.title
},
params: {
p, c
}
})
}
/**
*
* @param {*} promotionalId
* 获取预警发布详情
*/
export function getDetail(promotionalId) {
return request({
url: `/promotional/get/info/${promotionalId}`,
method: 'get'
})
}
/**
* 删除预警发布
* @param {*} promotionalId
*/
export function del(promotionalId) {
return request({
url: `/promotional/del/info/${promotionalId}`,
method: 'get'
})
}
/**
* 更新预警发布信息
* @param {*} data
*/
export function update(data = {}) {
console.log(data)
return request({
url: `/promotional/update/info`,
method: 'post',
data: data
})
}
export function add(data = {}) {
return request({
url: `/promotional/add/info`,
method: 'post',
data: data
})
}
......@@ -66,6 +66,7 @@ export default {
},
async logout() {
await this.$store.dispatch('user/logout')
this.$router.push(`/login?redirect=${this.$route.fullPath}`)
}
}
......
......@@ -13,7 +13,7 @@ const whiteList = ['/login', '/auth-redirect'] // no redirect whitelist
router.beforeEach(async(to, from, next) => {
// start progress bar
NProgress.start()
// return;
// set page title
document.title = getPageTitle(to.meta.title)
......
......@@ -8,7 +8,7 @@ import Layout from '@/layout'
/* Router Modules */
import tableRouter from './modules/table'
// import tableRouter from './modules/table'
// import DeviceRouter from './modules/device'
// import TempaltesRouter from './modules/templates'
// import CommonRouter from './modules/common'
......@@ -64,12 +64,14 @@ export const constantRoutes = [
{
path: '/',
component: Layout,
hidden: true,
redirect: '/profile/index',
children: [
{
path: 'dashboard',
component: () => import('@/views/dashboard/index'),
name: 'Dashboard',
hidden: true,
meta: { title: '首页', icon: 'dashboard', affix: true }
}
]
......@@ -111,23 +113,23 @@ export const constantRoutes = [
* the routes that need to be dynamically loaded based on user roles
*/
export const asyncRoutes = [
{
path: '/icon',
component: Layout,
children: [
{
path: 'index',
component: () => import('@/views/icons/index'),
name: 'Icons',
meta: { title: 'Icons', icon: 'icon', noCache: true }
}
]
},
// {
// path: '/icon',
// component: Layout,
// children: [
// {
// path: 'index',
// component: () => import('@/views/icons/index'),
// name: 'Icons',
// meta: { title: 'Icons', icon: 'icon', noCache: true }
// }
// ]
// },
/** when your routing map is too long, you can split it into small modules **/
// DeviceRouter,
// TempaltesRouter,
tableRouter,
// tableRouter,
// CommonRouter,
// {
// path: 'external-link',
......
......@@ -10,7 +10,7 @@ const contentsRouter = {
name: 'contents',
meta: {
title: '内容管理',
icon: 'table'
icon: 'education'
},
children: [
{
......
import { login, logout, getInfo } from '@/api/user'
import { login, getInfo } from '@/api/user'
import { getToken, setToken, removeToken } from '@/utils/auth'
import router, { resetRouter } from '@/router'
......@@ -74,15 +74,20 @@ const actions = {
// user logout
logout({ commit, state }) {
return new Promise((resolve, reject) => {
logout(state.token).then(() => {
commit('SET_TOKEN', '')
commit('SET_ROLES', [])
removeToken()
resetRouter()
resolve()
}).catch(error => {
reject(error)
})
commit('SET_TOKEN', '')
commit('SET_ROLES', [])
removeToken()
resetRouter()
resolve()
// logout(state.token).then(() => {
// commit('SET_TOKEN', '')
// commit('SET_ROLES', [])
// removeToken()
// resetRouter()
// resolve()
// }).catch(error => {
// reject(error)
// })
})
},
......
......@@ -6,6 +6,7 @@
class="filter-item"
type="datetimerange"
:picker-options="pickerOptions"
value-format="yyyy-MM-dd HH:mm:ss"
range-separator="至"
start-placeholder="开始时间"
end-placeholder="结束时间"
......
......@@ -6,6 +6,7 @@
class="filter-item"
type="datetimerange"
:picker-options="pickerOptions"
value-format="yyyy-MM-dd HH:mm:ss"
range-separator="至"
start-placeholder="开始时间"
end-placeholder="结束时间"
......@@ -168,7 +169,7 @@
v-model="temp.content"
:autosize="{ minRows: 2, maxRows: 4}"
type="textarea"
placeholder="Please input"
placeholder="请输入"
/>
</el-form-item>
<el-form-item label="上传图片" prop="type">
......
......@@ -15,7 +15,6 @@
<el-select
v-model="temp.type"
placeholder="请选择"
clearable
class="filter-item"
style="width: 130px"
@change="selectChange"
......@@ -32,21 +31,23 @@
<el-input
v-model="temp.title"
:autosize="{ minRows: 2, maxRows: 4}"
type="password"
type="text"
placeholder="请输入"
/>
</el-form-item>
<el-form-item label="时间" prop="content">
<el-form-item label="时间" prop="updateTime" disabled>
<el-input
v-model="temp.content"
v-model="temp.updateTime"
disabled
:autosize="{ minRows: 2, maxRows: 4}"
type="datetime"
placeholder="请选择"
/>
</el-form-item>
<el-form-item label="发布者" prop="content">
<el-form-item label="发布者" prop="userName" aria-disabled>
<el-input
v-model="temp.content"
v-model="temp.userName"
disabled
:autosize="{ minRows: 2, maxRows: 4}"
type="text"
placeholder="请输入"
......@@ -60,7 +61,7 @@
placeholder="请输入"
/>
</el-form-item>
<el-form-item label="邮编" prop="type">
<el-form-item label="上传内容" prop="type">
<el-upload
class="upload-demo"
drag
......@@ -79,7 +80,7 @@
<div slot="tip" class="el-upload__tip">只能上传图片</div>
</el-upload>
</el-form-item>
<el-button type="primary" @click="dialogStatus==='create'?createData():updateData()">提交</el-button>
<el-button type="primary" @click="updateData()">提交</el-button>
</el-form>
</div>
</template>
......@@ -89,10 +90,12 @@ import { uploadUrl } from '@/api/common'
import waves from '@/directive/waves' // waves directive
import { parseTime } from '@/utils'
import { getCenterType, updateCenterType } from '@/api/centre'
const calendarTypeOptions = [
{ id: 1, name: '气象中心' },
{ id: 2, name: '地域气象局' },
{ id: 3, name: '机构' }
{ id: '1', name: '主要职责' },
{ id: '2', name: '地位' },
{ id: '3', name: '成立时间' }
]
export default {
name: 'ComplexTable',
......@@ -112,13 +115,7 @@ export default {
calendarTypeOptions,
uploadUrl: uploadUrl(),
temp: {
id: undefined,
importance: 1,
remark: '',
timestamp: new Date(),
title: '',
type: '',
status: 'published'
type: '1'
},
rules: {
type: [
......@@ -134,14 +131,29 @@ export default {
],
title: [
{ required: true, message: 'title is required', trigger: 'blur' }
],
content: [
{ required: true, message: 'title is required', trigger: 'blur' }
],
url: [
{ required: true, message: 'title is required', trigger: 'blur' }
]
},
downloadLoading: false
}
},
created() {},
created() {
this.getList()
},
methods: {
getList() {},
getList() {
getCenterType(this.temp.type).then(res => {
console.log(res.data)
if (res.data) {
this.temp = res.data
}
})
},
selectChange() {
this.getList()
},
......@@ -160,7 +172,15 @@ export default {
this.$refs['dataForm'].validate(valid => {
if (valid) {
const tempData = Object.assign({}, this.temp)
tempData.timestamp = +new Date(tempData.timestamp) // change Thu Nov 30 2017 16:41:05 GMT
tempData.timestamp = +new Date(tempData.timestamp)
updateCenterType(this.temp).then(res => {
this.$notify({
title: 'Success',
message: '修改成功',
type: 'success',
duration: 2000
})
})
}
})
},
......
<template>
<div class="app-container">
<el-form
ref="dataForm"
:rules="rules"
:model="temp"
label-position="left"
label-width="100px"
style="width: 400px; margin-left:50px;"
<div class="filter-container">
<el-date-picker
v-model="listQuery.time"
class="filter-item"
type="datetimerange"
:picker-options="pickerOptions"
value-format="yyyy-MM-dd HH:mm:ss"
range-separator="至"
start-placeholder="开始时间"
end-placeholder="结束时间"
align="right"
@change="formateBtime"
/>
<el-input
v-model="listQuery.title"
placeholder="名称"
style="width: 200px;"
class="filter-item"
@keyup.enter.native="handleFilter"
/>
<el-button
v-waves
class="filter-item"
type="primary"
icon="el-icon-search"
@click="handleFilter"
>搜索</el-button>
<el-button
class="filter-item"
style="margin-left: 10px;"
type="primary"
@click="handlerReset"
>重置</el-button>
<el-button
class="filter-item"
style="margin-left: 10px;"
type="primary"
@click="handleCreate"
>添加</el-button>
</div>
<el-table
:key="tableKey"
ref="multipleTable"
v-loading="listLoading"
:data="list"
border
fit
highlight-current-row
style="width: 100%;"
@selection-change="handleSelectionChange"
@sort-change="sortChange"
>
<!-- <el-form-item label="Date" prop="timestamp">
<el-date-picker v-model="temp.timestamp" type="datetime" placeholder="Please pick a date" />
</el-form-item>-->
<el-form-item label="标题" prop="title">
<el-input
v-model="temp.title"
:autosize="{ minRows: 2, maxRows: 4}"
type="password"
placeholder="请输入"
/>
</el-form-item>
<el-form-item label="内容" prop="content">
<el-input
v-model="temp.content"
:autosize="{ minRows: 2, maxRows: 4}"
type="text"
placeholder="请输入"
/>
</el-form-item>
<el-form-item label="上传视频" prop="type">
<el-upload
class="upload-demo"
drag
name="resource"
accept="image/*"
:show-file-list="false"
:on-success="uploadZipSuccess"
:on-progress="onProgress"
:action="uploadUrl"
>
<i class="el-icon-upload" />
<div class="el-upload__text">
将文件拖到此处,或
<em>点击上传</em>
</div>
<div slot="tip" class="el-upload__tip">只能上传图片</div>
</el-upload>
</el-form-item>
<el-button type="primary" @click="dialogStatus==='create'?createData():updateData()">提交</el-button>
</el-form>
<el-table-column type="selection" width="55" />
<el-table-column label="序号" type="index" width="55" />
<el-table-column
label="ID"
prop="id"
sortable="custom"
align="center"
width="80"
:class-name="getSortClass('id')"
>
<template slot-scope="scope">
<span>{{ scope.row.promotionalId }}</span>
</template>
</el-table-column>
<el-table-column label="标题" min-width="150px">
<template slot-scope="{row}">
<span class="link-type" @click="handleUpdate(row)">{{ row.title }}</span>
</template>
</el-table-column>
<!-- <el-table-column label="类型" width="110px" align="center">
<template slot-scope="scope">
<span>{{ scope.row.type }}</span>
</template>
</el-table-column> -->
<el-table-column label="发布者" width="90px">
<template slot-scope="scope">
<span>{{ scope.row.userName }}</span>
</template>
</el-table-column>
<el-table-column label="更新时间" width="150px" align="center">
<template slot-scope="scope">
<span>{{ scope.row.updateTime }}</span>
</template>
</el-table-column>
<el-table-column label="操作" align="center" width="230" class-name="small-padding fixed-width">
<template slot-scope="{row}">
<el-button type="primary" size="mini" @click="handleUpdate(row)">修改</el-button>
<el-button size="mini" type="danger" @click="handleDelete(row,'deleted')">删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="listQuery.page"
:limit.sync="listQuery.limit"
@pagination="getList"
/>
<el-dialog :title="textMap[dialogStatus]" :visible.sync="dialogFormVisible">
<el-form
ref="dataForm"
:rules="rules"
:model="temp"
label-position="left"
label-width="100px"
style="width: 400px; margin-left:50px;"
>
<el-form-item label="标题" prop="title">
<el-input v-model="temp.title" type="text" placeholder="请输入" />
</el-form-item>
<el-form-item label="内容" prop="content">
<el-input
v-model="temp.content"
:autosize="{ minRows: 2, maxRows: 4}"
type="textarea"
placeholder="请输入"
/>
</el-form-item>
<el-form-item label="上传图片" prop="type">
<el-upload
class="upload-demo"
drag
name="resource"
accept="image/*"
:show-file-list="false"
:on-success="uploadZipSuccess"
:on-progress="onProgress"
:action="uploadUrl"
>
<i class="el-icon-upload" />
<div class="el-upload__text">
将文件拖到此处,或
<em>点击上传</em>
</div>
<div slot="tip" class="el-upload__tip">只能上传图片</div>
</el-upload>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="dialogFormVisible = false">取消</el-button>
<el-button type="primary" @click="dialogStatus==='create'?createData():updateData()">确认</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { getList, add, del, update, getDetail } from '@/api/video'
import { uploadUrl } from '@/api/common'
import waves from '@/directive/waves' // waves directive
import { parseTime } from '@/utils'
import Pagination from '@/components/Pagination' // secondary package based on el-pagination
const calendarTypeOptions = [
{ id: 1, name: '气象中心' },
{ id: 2, name: '地域气象局' },
{ id: 3, name: '机构' }
{ id: '1', name: '预警中心' },
{ id: '2', name: '预警发布系统' }
]
const calendarType2Options = [
{ id: '1', name: '华东' },
{ id: '2', name: '华中' },
{ id: '3', name: '华北' },
{ id: '4', name: '东北' },
{ id: '6', name: '华南' },
{ id: '7', name: '西南' },
{ id: '8', name: '华东' }
]
const calendarType3Options = [
{ id: '1', name: '水利' },
{ id: '2', name: '民政' },
{ id: '3', name: '交通' },
{ id: '4', name: '海洋' },
{ id: '5', name: '旅游' },
{ id: '6', name: '卫生' },
{ id: '7', name: '公交' }
]
export default {
name: 'ComplexTable',
components: { Pagination },
directives: { waves },
filters: {
statusFilter(status) {
......@@ -76,17 +195,69 @@ export default {
},
data() {
return {
tableKey: 0,
list: null,
total: 0,
listLoading: true,
listQuery: {
page: 1,
limit: 20,
title: undefined,
type: undefined,
sort: '+id'
},
multipleSelection: [],
pickerOptions: {
shortcuts: [
{
text: '最近一周',
onClick(picker) {
const end = new Date()
const start = new Date()
start.setTime(start.getTime() - 3600 * 1000 * 24 * 7)
picker.$emit('pick', [start, end])
}
},
{
text: '最近一个月',
onClick(picker) {
const end = new Date()
const start = new Date()
start.setTime(start.getTime() - 3600 * 1000 * 24 * 30)
picker.$emit('pick', [start, end])
}
},
{
text: '最近三个月',
onClick(picker) {
const end = new Date()
const start = new Date()
start.setTime(start.getTime() - 3600 * 1000 * 24 * 90)
picker.$emit('pick', [start, end])
}
}
]
},
importanceOptions: [1, 2, 3],
calendarTypeOptions,
calendarType2Options,
calendarType3Options,
uploadUrl: uploadUrl(),
temp: {
id: undefined,
importance: 1,
remark: '',
timestamp: new Date(),
content: '',
url: '',
title: '',
type: '',
status: 'published'
type: ''
},
dialogFormVisible: false,
dialogStatus: '',
textMap: {
update: '编辑',
create: '添加'
},
dialogPvVisible: false,
pvData: [],
rules: {
type: [
{ required: true, message: 'type is required', trigger: 'change' }
......@@ -100,46 +271,153 @@ export default {
}
],
title: [
{ required: true, message: 'content is required', trigger: 'blur' }
],
content: [
{ required: true, message: 'title is required', trigger: 'blur' }
]
},
downloadLoading: false
}
},
created() {},
created() {
this.getList()
},
methods: {
getList() {},
selectChange() {
this.getList()
getList() {
this.listLoading = true
getList(this.listQuery, this.listQuery.page, this.listQuery.limit).then(
response => {
this.list = response.data.list
this.total = response.data.count
// Just to simulate the time of the request
setTimeout(() => {
this.listLoading = false
}, 1.5 * 1000)
}
)
},
handleFilter() {
this.listQuery.page = 1
this.getList()
},
handleModifyStatus(row, status) {
this.$message({
message: '操作Success',
type: 'success'
})
row.status = status
},
handlerReset() {
this.listQuery = {
page: 1,
limit: 20
}
this.getList()
},
formateBtime() {
const time = this.listQuery.time
this.listQuery.beginTime = time[0]
this.listQuery.endTime = time[1]
},
sortChange(data) {
const { prop, order } = data
if (prop === 'id') {
this.sortByID(order)
}
},
sortByID(order) {
if (order === 'ascending') {
this.listQuery.sort = '+id'
} else {
this.listQuery.sort = '-id'
}
this.handleFilter()
},
handleReset() {
this.listQuery = {
page: 1,
limit: 20,
importance: undefined,
title: undefined,
type: undefined,
sort: '+id'
}
this.getList()
},
resetTemp() {
this.temp = {
id: undefined,
importance: 1,
remark: '',
timestamp: new Date(),
title: '',
status: 'published',
type: ''
}
},
handleCreate() {
this.resetTemp()
this.dialogStatus = 'create'
this.dialogFormVisible = true
this.$nextTick(() => {
this.$refs['dataForm'].clearValidate()
})
},
createData() {
this.$refs['dataForm'].validate(valid => {
if (valid) {
this.temp.id = parseInt(Math.random() * 100) + 1024 // mock a id
add(this.temp).then(() => {
this.dialogFormVisible = false
this.getList()
this.$notify({
title: 'Success',
message: '添加成功',
type: 'success',
duration: 2000
})
})
}
})
},
handleUpdate(row) {
getDetail(row.promotionalId).then(res => {
this.temp = res.data
this.dialogStatus = 'update'
this.dialogFormVisible = true
this.$nextTick(() => {
this.$refs['dataForm'].clearValidate()
})
})
},
updateData() {
this.$refs['dataForm'].validate(valid => {
if (valid) {
const tempData = Object.assign({}, this.temp)
tempData.timestamp = +new Date(tempData.timestamp) // change Thu Nov 30 2017 16:41:05 GMT
tempData.timestamp = +new Date(tempData.timestamp) // change Thu Nov 30 2017 16:41:05 GMT+0800 (CST) to 1512031311464
update(tempData).then(() => {
this.getList()
this.dialogFormVisible = false
this.$notify({
title: 'Success',
message: 'Update Successfully',
type: 'success',
duration: 2000
})
})
}
})
},
handleDelete(row) {
this.$notify({
title: 'Success',
message: 'Delete Successfully',
type: 'success',
duration: 2000
del(row.promotionalId).then(() => {
this.getList()
this.$notify({
title: 'Success',
message: 'Delete Successfully',
type: 'success',
duration: 2000
})
})
const index = this.list.indexOf(row)
this.list.splice(index, 1)
},
onProgress(event) {
console.log(event)
......@@ -155,19 +433,7 @@ export default {
} else {
this.fullscreenLoading = false
this.$message('上传成功')
this.temp.frameInfo.frameUrl = e.frameUrl
this.temp.resourceInfo.resourceUrl = e.resourceUrl
this.temp.templateCount = e.pictureUrl.length
this.temp.templateUrl = e.pictureUrl
.map(item => {
if (item.indexOf('http') !== -1 || item.indexOf('https') !== -1) {
return item + ''
} else {
return e.url + item + ''
}
})
.join(',')
this.temp.addVersionInfoDTO.zipUrl = e.zipUrl
this.temp.url = e.url
console.log(this.temp)
}
console.log(e)
......@@ -205,6 +471,14 @@ export default {
}
})
)
},
getSortClass: function(key) {
const sort = this.listQuery.sort
return sort === `+${key}`
? 'ascending'
: sort === `-${key}`
? 'descending'
: ''
}
}
}
......
......@@ -6,10 +6,12 @@
class="filter-item"
type="datetimerange"
:picker-options="pickerOptions"
value-format="yyyy-MM-dd HH:mm:ss"
range-separator="至"
start-placeholder="开始时间"
end-placeholder="结束时间"
align="right"
@change="formateBtime"
/>
<el-input
v-model="listQuery.title"
......@@ -66,6 +68,7 @@
@sort-change="sortChange"
>
<el-table-column type="selection" width="55" />
<el-table-column label="序号" type="index" width="55" />
<el-table-column
label="ID"
prop="id"
......@@ -75,39 +78,33 @@
:class-name="getSortClass('id')"
>
<template slot-scope="scope">
<span>{{ scope.row.id }}</span>
<span>{{ scope.row.eventId }}</span>
</template>
</el-table-column>
<el-table-column label="标题" min-width="150px">
<template slot-scope="{row}">
<span class="link-type" @click="handleUpdate(row)">{{ row.title }}</span>
<el-tag>{{ row.type }}</el-tag>
</template>
</el-table-column>
<el-table-column label="类型" width="110px" align="center">
<!-- <el-table-column label="类型" width="110px" align="center">
<template slot-scope="scope">
<span>{{ scope.row.author }}</span>
<span>{{ scope.row.type }}</span>
</template>
</el-table-column>
<el-table-column label="发布者" width="80px">
</el-table-column> -->
<el-table-column label="发布者" width="90px">
<template slot-scope="scope">
<span>{{ scope.row.author }}</span>
<span>{{ scope.row.userName }}</span>
</template>
</el-table-column>
<el-table-column label="更新时间" width="150px" align="center">
<template slot-scope="scope">
<span>{{ scope.row.timestamp | parseTime('{y}-{m}-{d} {h}:{i}') }}</span>
<span>{{ scope.row.updateTime }}</span>
</template>
</el-table-column>
<el-table-column
label="Actions"
align="center"
width="230"
class-name="small-padding fixed-width"
>
<el-table-column label="操作" align="center" width="230" class-name="small-padding fixed-width">
<template slot-scope="{row}">
<el-button type="primary" size="mini" @click="handleUpdate(row)">修改</el-button>
<el-button size="mini" type="danger" @click="handleModifyStatus(row,'deleted')">删除</el-button>
<el-button size="mini" type="danger" @click="handleDelete(row,'deleted')">删除</el-button>
</template>
</el-table-column>
</el-table>
......@@ -148,19 +145,14 @@
</el-select>
</el-form-item>
<el-form-item label="标题" prop="title">
<el-input
v-model="temp.title"
:autosize="{ minRows: 2, maxRows: 4}"
type="password"
placeholder="请输入"
/>
<el-input v-model="temp.title" type="text" placeholder="请输入" />
</el-form-item>
<el-form-item label="内容" prop="content">
<el-input
v-model="temp.content"
:autosize="{ minRows: 2, maxRows: 4}"
type="textarea"
placeholder="Please input"
placeholder="请输入"
/>
</el-form-item>
<el-form-item label="上传图片" prop="type">
......@@ -192,39 +184,33 @@
</template>
<script>
import {
fetchList,
fetchPv,
createArticle,
updateArticle
} from '@/api/article'
import { getList, add, del, update, getDetail } from '@/api/bigEvents'
import { uploadUrl } from '@/api/common'
import waves from '@/directive/waves' // waves directive
import { parseTime } from '@/utils'
import Pagination from '@/components/Pagination' // secondary package based on el-pagination
const calendarTypeOptions = [
{ id: 1, name: '预警中心' },
{ id: 2, name: '预警发布系统' },
{ id: 3, name: '建设成效' }
{ id: '1', name: '预警中心' },
{ id: '2', name: '预警发布系统' }
]
const calendarType2Options = [
{ id: 1, name: '华东' },
{ id: 2, name: '华中' },
{ id: 3, name: '华北' },
{ id: 4, name: '东北' },
{ id: 6, name: '华南' },
{ id: 7, name: '西南' },
{ id: 8, name: '华东' }
{ id: '1', name: '华东' },
{ id: '2', name: '华中' },
{ id: '3', name: '华北' },
{ id: '4', name: '东北' },
{ id: '6', name: '华南' },
{ id: '7', name: '西南' },
{ id: '8', name: '华东' }
]
const calendarType3Options = [
{ id: 1, name: '水利' },
{ id: 2, name: '民政' },
{ id: 3, name: '交通' },
{ id: 4, name: '海洋' },
{ id: 5, name: '旅游' },
{ id: 6, name: '卫生' },
{ id: 7, name: '公交' }
{ id: '1', name: '水利' },
{ id: '2', name: '民政' },
{ id: '3', name: '交通' },
{ id: '4', name: '海洋' },
{ id: '5', name: '旅游' },
{ id: '6', name: '卫生' },
{ id: '7', name: '公交' }
]
export default {
name: 'ComplexTable',
......@@ -249,7 +235,6 @@ export default {
listQuery: {
page: 1,
limit: 20,
importance: undefined,
title: undefined,
type: undefined,
sort: '+id'
......@@ -293,12 +278,10 @@ export default {
uploadUrl: uploadUrl(),
temp: {
id: undefined,
importance: 1,
remark: '',
timestamp: new Date(),
content: '',
url: '',
title: '',
type: '',
status: 'published'
type: ''
},
dialogFormVisible: false,
dialogStatus: '',
......@@ -321,6 +304,9 @@ export default {
}
],
title: [
{ required: true, message: 'content is required', trigger: 'blur' }
],
content: [
{ required: true, message: 'title is required', trigger: 'blur' }
]
},
......@@ -333,15 +319,16 @@ export default {
methods: {
getList() {
this.listLoading = true
fetchList(this.listQuery).then(response => {
this.list = response.data.items
this.total = response.data.total
// Just to simulate the time of the request
setTimeout(() => {
this.listLoading = false
}, 1.5 * 1000)
})
getList(this.listQuery, this.listQuery.page, this.listQuery.limit).then(
response => {
this.list = response.data.list
this.total = response.data.count
// Just to simulate the time of the request
setTimeout(() => {
this.listLoading = false
}, 1.5 * 1000)
}
)
},
handleFilter() {
this.listQuery.page = 1
......@@ -355,9 +342,17 @@ export default {
row.status = status
},
handlerReset() {
this.listQuery = {}
this.listQuery = {
page: 1,
limit: 20
}
this.getList()
},
formateBtime() {
const time = this.listQuery.time
this.listQuery.beginTime = time[0]
this.listQuery.endTime = time[1]
},
sortChange(data) {
const { prop, order } = data
if (prop === 'id') {
......@@ -405,14 +400,12 @@ export default {
createData() {
this.$refs['dataForm'].validate(valid => {
if (valid) {
this.temp.id = parseInt(Math.random() * 100) + 1024 // mock a id
this.temp.author = 'vue-element-admin'
createArticle(this.temp).then(() => {
this.list.unshift(this.temp)
add(this.temp).then(() => {
this.dialogFormVisible = false
this.getList()
this.$notify({
title: 'Success',
message: 'Created Successfully',
message: '添加成功',
type: 'success',
duration: 2000
})
......@@ -421,12 +414,13 @@ export default {
})
},
handleUpdate(row) {
this.temp = Object.assign({}, row) // copy obj
this.temp.timestamp = new Date(this.temp.timestamp)
this.dialogStatus = 'update'
this.dialogFormVisible = true
this.$nextTick(() => {
this.$refs['dataForm'].clearValidate()
getDetail(row.eventId).then(res => {
this.temp = res.data
this.dialogStatus = 'update'
this.dialogFormVisible = true
this.$nextTick(() => {
this.$refs['dataForm'].clearValidate()
})
})
},
updateData() {
......@@ -434,14 +428,8 @@ export default {
if (valid) {
const tempData = Object.assign({}, this.temp)
tempData.timestamp = +new Date(tempData.timestamp) // change Thu Nov 30 2017 16:41:05 GMT+0800 (CST) to 1512031311464
updateArticle(tempData).then(() => {
for (const v of this.list) {
if (v.id === this.temp.id) {
const index = this.list.indexOf(v)
this.list.splice(index, 1, this.temp)
break
}
}
update(tempData).then(() => {
this.getList()
this.dialogFormVisible = false
this.$notify({
title: 'Success',
......@@ -454,19 +442,14 @@ export default {
})
},
handleDelete(row) {
this.$notify({
title: 'Success',
message: 'Delete Successfully',
type: 'success',
duration: 2000
})
const index = this.list.indexOf(row)
this.list.splice(index, 1)
},
handleFetchPv(pv) {
fetchPv(pv).then(response => {
this.pvData = response.data.pvData
this.dialogPvVisible = true
del(row.eventId).then(() => {
this.getList()
this.$notify({
title: 'Success',
message: 'Delete Successfully',
type: 'success',
duration: 2000
})
})
},
onProgress(event) {
......@@ -483,19 +466,7 @@ export default {
} else {
this.fullscreenLoading = false
this.$message('上传成功')
this.temp.frameInfo.frameUrl = e.frameUrl
this.temp.resourceInfo.resourceUrl = e.resourceUrl
this.temp.templateCount = e.pictureUrl.length
this.temp.templateUrl = e.pictureUrl
.map(item => {
if (item.indexOf('http') !== -1 || item.indexOf('https') !== -1) {
return item + ''
} else {
return e.url + item + ''
}
})
.join(',')
this.temp.addVersionInfoDTO.zipUrl = e.zipUrl
this.temp.url = e.url
console.log(this.temp)
}
console.log(e)
......
......@@ -6,6 +6,7 @@
class="filter-item"
type="datetimerange"
:picker-options="pickerOptions"
value-format="yyyy-MM-dd HH:mm:ss"
range-separator="至"
start-placeholder="开始时间"
end-placeholder="结束时间"
......@@ -89,7 +90,7 @@
<template slot-scope="scope">
<span>{{ scope.row.type }}</span>
</template>
</el-table-column> -->
</el-table-column>-->
<el-table-column label="发布者" width="90px">
<template slot-scope="scope">
<span>{{ scope.row.userName }}</span>
......@@ -151,7 +152,7 @@
v-model="temp.content"
:autosize="{ minRows: 2, maxRows: 4}"
type="textarea"
placeholder="Please input"
placeholder="请输入"
/>
</el-form-item>
<el-form-item label="上传图片" prop="type">
......@@ -188,7 +189,25 @@ import { uploadUrl } from '@/api/common'
import waves from '@/directive/waves' // waves directive
import { parseTime } from '@/utils'
import Pagination from '@/components/Pagination' // secondary package based on el-pagination
// {
// '大事记': [
// { id: '1', name: '预警中心' },
// { id: '2', name: '预警发布系统' }]
// '预警发布系统':[
// { id: '1', name: '建设背景' },
// { id: '2', name: '发展历程' },
// { id: '3', name: '建设成效' }
// ],
// '中心介绍': [
// { id: '1', name: '气象中心' },
// { id: '2', name: '地域气象局' },
// { id: '3', name: '机构' }
// ],
// '信息服务应用效益': [
// { id: '1', name: '应用效益' },
// { id: '2', name: '服务宗旨' }
// ]
// }
const calendarTypeOptions = [
{ id: '1', name: '建设背景' },
{ id: '2', name: '发展历程' },
......@@ -429,13 +448,7 @@ export default {
const tempData = Object.assign({}, this.temp)
tempData.timestamp = +new Date(tempData.timestamp) // change Thu Nov 30 2017 16:41:05 GMT+0800 (CST) to 1512031311464
update(tempData).then(() => {
for (const v of this.list) {
if (v.id === this.temp.id) {
const index = this.list.indexOf(v)
this.list.splice(index, 1, this.temp)
break
}
}
this.getList()
this.dialogFormVisible = false
this.$notify({
title: 'Success',
......
......@@ -6,10 +6,12 @@
class="filter-item"
type="datetimerange"
:picker-options="pickerOptions"
value-format="yyyy-MM-dd HH:mm:ss"
range-separator="至"
start-placeholder="开始时间"
end-placeholder="结束时间"
align="right"
@change="formateBtime"
/>
<el-input
v-model="listQuery.title"
......@@ -18,20 +20,6 @@
class="filter-item"
@keyup.enter.native="handleFilter"
/>
<el-select
v-model="listQuery.type"
placeholder="类型"
clearable
class="filter-item"
style="width: 130px"
>
<el-option
v-for="item in calendarTypeOptions"
:key="item.id"
:label="item.name"
:value="item.id"
/>
</el-select>
<el-button
v-waves
class="filter-item"
......@@ -75,28 +63,22 @@
:class-name="getSortClass('id')"
>
<template slot-scope="scope">
<span>{{ scope.row.id }}</span>
<span>{{ scope.row.benefitId }}</span>
</template>
</el-table-column>
<el-table-column label="标题" min-width="150px">
<template slot-scope="{row}">
<span class="link-type" @click="handleUpdate(row)">{{ row.title }}</span>
<el-tag>{{ row.type }}</el-tag>
</template>
</el-table-column>
<el-table-column label="类型" width="110px" align="center">
<template slot-scope="scope">
<span>{{ scope.row.author }}</span>
</template>
</el-table-column>
<el-table-column label="发布者" width="80px">
<template slot-scope="scope">
<span>{{ scope.row.author }}</span>
<span>{{ scope.row.userName }}</span>
</template>
</el-table-column>
<el-table-column label="更新时间" width="150px" align="center">
<template slot-scope="scope">
<span>{{ scope.row.timestamp | parseTime('{y}-{m}-{d} {h}:{i}') }}</span>
<span>{{ scope.row.updateTime }}</span>
</template>
</el-table-column>
<el-table-column
......@@ -128,25 +110,6 @@
label-width="100px"
style="width: 400px; margin-left:50px;"
>
<!-- <el-form-item label="Date" prop="timestamp">
<el-date-picker v-model="temp.timestamp" type="datetime" placeholder="Please pick a date" />
</el-form-item>-->
<el-form-item label="类型" prop="type">
<el-select
v-model="temp.type"
placeholder="类型"
clearable
class="filter-item"
style="width: 130px"
>
<el-option
v-for="item in calendarTypeOptions"
:key="item.id"
:label="item.name"
:value="item.id"
/>
</el-select>
</el-form-item>
<el-form-item label="标题" prop="title">
<el-input
v-model="temp.title"
......@@ -155,20 +118,12 @@
placeholder="请输入"
/>
</el-form-item>
<el-form-item label="时间" prop="title">
<el-input
v-model="temp.title"
:autosize="{ minRows: 2, maxRows: 4}"
type="datetime"
placeholder="请输入"
/>
</el-form-item>
<el-form-item label="内容" prop="content">
<el-input
v-model="temp.content"
:autosize="{ minRows: 2, maxRows: 4}"
:autosize="{ minRows: 3, maxRows: 6}"
type="textarea"
placeholder="Please input"
placeholder="请输入"
/>
</el-form-item>
<el-form-item label="上传图片" prop="type">
......@@ -200,43 +155,33 @@
</template>
<script>
import {
fetchList,
fetchPv,
createArticle,
updateArticle
} from '@/api/article'
import { getList, add, del, update, getDetail } from '@/api/serviceEfficiency'
import { uploadUrl } from '@/api/common'
import waves from '@/directive/waves' // waves directive
import { parseTime } from '@/utils'
import Pagination from '@/components/Pagination' // secondary package based on el-pagination
const calendarTypeOptions = [
{ id: 1, name: '泥石流' },
{ id: 2, name: '雷电' },
{ id: 3, name: '大雾' },
{ id: 4, name: '干旱' },
{ id: 5, name: '寒流' },
{ id: 6, name: '大雪' },
{ id: 7, name: '大风' }
{ id: '1', name: '预警中心' },
{ id: '2', name: '预警发布系统' }
]
const calendarType2Options = [
{ id: 1, name: '华东' },
{ id: 2, name: '华中' },
{ id: 3, name: '华北' },
{ id: 4, name: '东北' },
{ id: 6, name: '华南' },
{ id: 7, name: '西南' },
{ id: 8, name: '华东' }
{ id: '1', name: '华东' },
{ id: '2', name: '华中' },
{ id: '3', name: '华北' },
{ id: '4', name: '东北' },
{ id: '6', name: '华南' },
{ id: '7', name: '西南' },
{ id: '8', name: '华东' }
]
const calendarType3Options = [
{ id: 1, name: '水利' },
{ id: 2, name: '民政' },
{ id: 3, name: '交通' },
{ id: 4, name: '海洋' },
{ id: 5, name: '旅游' },
{ id: 6, name: '卫生' },
{ id: 7, name: '公交' }
{ id: '1', name: '水利' },
{ id: '2', name: '民政' },
{ id: '3', name: '交通' },
{ id: '4', name: '海洋' },
{ id: '5', name: '旅游' },
{ id: '6', name: '卫生' },
{ id: '7', name: '公交' }
]
export default {
name: 'ComplexTable',
......@@ -261,7 +206,6 @@ export default {
listQuery: {
page: 1,
limit: 20,
importance: undefined,
title: undefined,
type: undefined,
sort: '+id'
......@@ -305,12 +249,10 @@ export default {
uploadUrl: uploadUrl(),
temp: {
id: undefined,
importance: 1,
remark: '',
timestamp: new Date(),
content: '',
url: '',
title: '',
type: '',
status: 'published'
type: ''
},
dialogFormVisible: false,
dialogStatus: '',
......@@ -324,15 +266,18 @@ export default {
type: [
{ required: true, message: 'type is required', trigger: 'change' }
],
timestamp: [
time: [
{
type: 'date',
required: true,
message: 'timestamp is required',
message: 'time is required',
trigger: 'change'
}
],
title: [
{ required: true, message: 'content is required', trigger: 'blur' }
],
content: [
{ required: true, message: 'title is required', trigger: 'blur' }
]
},
......@@ -345,15 +290,16 @@ export default {
methods: {
getList() {
this.listLoading = true
fetchList(this.listQuery).then(response => {
this.list = response.data.items
this.total = response.data.total
// Just to simulate the time of the request
setTimeout(() => {
this.listLoading = false
}, 1.5 * 1000)
})
getList(this.listQuery, this.listQuery.page, this.listQuery.limit).then(
response => {
this.list = response.data.list
this.total = response.data.count
// Just to simulate the time of the request
setTimeout(() => {
this.listLoading = false
}, 1.5 * 1000)
}
)
},
handleFilter() {
this.listQuery.page = 1
......@@ -367,9 +313,17 @@ export default {
row.status = status
},
handlerReset() {
this.listQuery = {}
this.listQuery = {
page: 1,
limit: 20
}
this.getList()
},
formateBtime() {
const time = this.listQuery.time
this.listQuery.beginTime = time[0]
this.listQuery.endTime = time[1]
},
sortChange(data) {
const { prop, order } = data
if (prop === 'id') {
......@@ -417,14 +371,12 @@ export default {
createData() {
this.$refs['dataForm'].validate(valid => {
if (valid) {
this.temp.id = parseInt(Math.random() * 100) + 1024 // mock a id
this.temp.author = 'vue-element-admin'
createArticle(this.temp).then(() => {
this.list.unshift(this.temp)
add(this.temp).then(() => {
this.dialogFormVisible = false
this.getList()
this.$notify({
title: 'Success',
message: 'Created Successfully',
message: '添加成功',
type: 'success',
duration: 2000
})
......@@ -433,12 +385,13 @@ export default {
})
},
handleUpdate(row) {
this.temp = Object.assign({}, row) // copy obj
this.temp.timestamp = new Date(this.temp.timestamp)
this.dialogStatus = 'update'
this.dialogFormVisible = true
this.$nextTick(() => {
this.$refs['dataForm'].clearValidate()
getDetail(row.benefitId).then(res => {
this.temp = res.data
this.dialogStatus = 'update'
this.dialogFormVisible = true
this.$nextTick(() => {
this.$refs['dataForm'].clearValidate()
})
})
},
updateData() {
......@@ -446,14 +399,8 @@ export default {
if (valid) {
const tempData = Object.assign({}, this.temp)
tempData.timestamp = +new Date(tempData.timestamp) // change Thu Nov 30 2017 16:41:05 GMT+0800 (CST) to 1512031311464
updateArticle(tempData).then(() => {
for (const v of this.list) {
if (v.id === this.temp.id) {
const index = this.list.indexOf(v)
this.list.splice(index, 1, this.temp)
break
}
}
update(tempData).then(() => {
this.getList()
this.dialogFormVisible = false
this.$notify({
title: 'Success',
......@@ -466,19 +413,14 @@ export default {
})
},
handleDelete(row) {
this.$notify({
title: 'Success',
message: 'Delete Successfully',
type: 'success',
duration: 2000
})
const index = this.list.indexOf(row)
this.list.splice(index, 1)
},
handleFetchPv(pv) {
fetchPv(pv).then(response => {
this.pvData = response.data.pvData
this.dialogPvVisible = true
del(row.benefitId).then(() => {
this.getList()
this.$notify({
title: 'Success',
message: 'Delete Successfully',
type: 'success',
duration: 2000
})
})
},
onProgress(event) {
......@@ -495,19 +437,7 @@ export default {
} else {
this.fullscreenLoading = false
this.$message('上传成功')
this.temp.frameInfo.frameUrl = e.frameUrl
this.temp.resourceInfo.resourceUrl = e.resourceUrl
this.temp.templateCount = e.pictureUrl.length
this.temp.templateUrl = e.pictureUrl
.map(item => {
if (item.indexOf('http') !== -1 || item.indexOf('https') !== -1) {
return item + ''
} else {
return e.url + item + ''
}
})
.join(',')
this.temp.addVersionInfoDTO.zipUrl = e.zipUrl
this.temp.url = e.url
console.log(this.temp)
}
console.log(e)
......
......@@ -10,9 +10,9 @@
>
<el-form-item
label="系统标题"
prop="typeMenuOrder"
prop="title"
>
<el-input v-model="temp.typeMenuOrder" />
<el-input v-model="temp.title" />
</el-form-item>
</el-form>
<div
......@@ -21,7 +21,7 @@
>
<el-button
type="primary"
@click="dialogStatus==='create'?createData():updateData()"
@click="updateData()"
>
确认
</el-button>
......@@ -30,11 +30,11 @@
</template>
<script>
import { typeAdd } from '@/api/menu'
import { updateTitle, getTitle } from '@/api/common'
import waves from '@/directive/waves' // waves directive
export default {
name: 'ComplexTable',
name: 'Title',
components: { },
directives: { waves },
filters: {
......@@ -43,8 +43,7 @@ export default {
data() {
return {
temp: {
typeMenuOrde: 0,
typeMenuName: ''
title: '123123'
},
dialogFormVisible: false,
dialogStatus: '',
......@@ -70,7 +69,7 @@ export default {
trigger: 'change'
}
],
typeMenuOrder: [
title: [
{
required: true,
message: 'title is required',
......@@ -81,29 +80,30 @@ export default {
}
},
created() {
getTitle().then(res => {
this.temp = res.data
console.log(res.data)
})
},
methods: {
createData() {
this.$refs['dataForm'].validate(valid => {
if (valid) {
typeAdd(this.temp.typeMenuName, this.temp.typeMenuOrder).then(() => {
this.getList()
this.dialogFormVisible = false
this.$notify({
title: 'Success',
message: 'Created Successfully',
type: 'success',
duration: 2000
})
})
console.log(valid)
}
})
},
updateData() {
this.$refs['dataForm'].validate(valid => {
if (valid) {
const tempData = Object.assign({}, this.temp)
tempData.timestamp = +new Date(tempData.timestamp) // change Thu Nov 30 2017 16:41:05 GMT+0800 (CST) to 1512031311464
updateTitle(this.temp.title).then(res => {
this.$notify({
title: 'Success',
message: '修改成功',
type: 'success',
duration: 2000
})
})
}
})
}
......
......@@ -6,10 +6,12 @@
class="filter-item"
type="datetimerange"
:picker-options="pickerOptions"
value-format="yyyy-MM-dd HH:mm:ss"
range-separator="至"
start-placeholder="开始时间"
end-placeholder="结束时间"
align="right"
@change="formateBtime"
/>
<el-input
v-model="listQuery.title"
......@@ -52,6 +54,7 @@
@sort-change="sortChange"
>
<el-table-column type="selection" width="55" />
<el-table-column label="序号" type="index" width="55" />
<el-table-column
label="ID"
prop="id"
......@@ -61,34 +64,33 @@
:class-name="getSortClass('id')"
>
<template slot-scope="scope">
<span>{{ scope.row.id }}</span>
<span>{{ scope.row.constructionId }}</span>
</template>
</el-table-column>
<el-table-column label="标题" min-width="150px">
<template slot-scope="{row}">
<span class="link-type" @click="handleUpdate(row)">{{ row.title }}</span>
<el-tag>{{ row.type }}</el-tag>
</template>
</el-table-column>
<el-table-column label="发布者" width="110px" align="center">
<!-- <el-table-column label="类型" width="110px" align="center">
<template slot-scope="scope">
<span>{{ scope.row.author }}</span>
<span>{{ scope.row.type }}</span>
</template>
</el-table-column>-->
<el-table-column label="发布者" width="90px">
<template slot-scope="scope">
<span>{{ scope.row.userName }}</span>
</template>
</el-table-column>
<el-table-column label="更新时间" width="150px" align="center">
<template slot-scope="scope">
<span>{{ scope.row.timestamp | parseTime('{y}-{m}-{d} {h}:{i}') }}</span>
<span>{{ scope.row.updateTime }}</span>
</template>
</el-table-column>
<el-table-column
label="Actions"
align="center"
width="230"
class-name="small-padding fixed-width"
>
<el-table-column label="操作" align="center" width="230" class-name="small-padding fixed-width">
<template slot-scope="{row}">
<el-button type="primary" size="mini" @click="handleUpdate(row)">修改</el-button>
<el-button size="mini" type="danger" @click="handleModifyStatus(row,'deleted')">删除</el-button>
<el-button size="mini" type="danger" @click="handleDelete(row,'deleted')">删除</el-button>
</template>
</el-table-column>
</el-table>
......@@ -113,11 +115,7 @@
<el-date-picker v-model="temp.timestamp" type="datetime" placeholder="Please pick a date" />
</el-form-item>-->
<el-form-item label="标题" prop="title">
<el-input
v-model="temp.title"
type="text"
placeholder="请输入"
/>
<el-input v-model="temp.title" type="text" placeholder="请输入" />
</el-form-item>
<el-form-item label="内容" prop="content">
<el-input
......@@ -127,7 +125,7 @@
placeholder="请输入"
/>
</el-form-item>
<el-form-item label="上传图片" prop="type">
<el-form-item label="上传图片" prop="url">
<el-upload
class="upload-demo"
drag
......@@ -156,39 +154,33 @@
</template>
<script>
import {
fetchList,
fetchPv,
createArticle,
updateArticle
} from '@/api/article'
import { getList, add, del, update, getDetail } from '@/api/centerConstruction'
import { uploadUrl } from '@/api/common'
import waves from '@/directive/waves' // waves directive
import { parseTime } from '@/utils'
import Pagination from '@/components/Pagination' // secondary package based on el-pagination
const calendarTypeOptions = [
{ id: 1, name: '预警中心' },
{ id: 2, name: '预警发布系统' },
{ id: 3, name: '建设成效' }
{ id: '1', name: '预警中心' },
{ id: '2', name: '预警发布系统' }
]
const calendarType2Options = [
{ id: 1, name: '华东' },
{ id: 2, name: '华中' },
{ id: 3, name: '华北' },
{ id: 4, name: '东北' },
{ id: 6, name: '华南' },
{ id: 7, name: '西南' },
{ id: 8, name: '华东' }
{ id: '1', name: '华东' },
{ id: '2', name: '华中' },
{ id: '3', name: '华北' },
{ id: '4', name: '东北' },
{ id: '6', name: '华南' },
{ id: '7', name: '西南' },
{ id: '8', name: '华东' }
]
const calendarType3Options = [
{ id: 1, name: '水利' },
{ id: 2, name: '民政' },
{ id: 3, name: '交通' },
{ id: 4, name: '海洋' },
{ id: 5, name: '旅游' },
{ id: 6, name: '卫生' },
{ id: 7, name: '公交' }
{ id: '1', name: '水利' },
{ id: '2', name: '民政' },
{ id: '3', name: '交通' },
{ id: '4', name: '海洋' },
{ id: '5', name: '旅游' },
{ id: '6', name: '卫生' },
{ id: '7', name: '公交' }
]
export default {
name: 'ComplexTable',
......@@ -213,7 +205,6 @@ export default {
listQuery: {
page: 1,
limit: 20,
importance: undefined,
title: undefined,
type: undefined,
sort: '+id'
......@@ -257,12 +248,10 @@ export default {
uploadUrl: uploadUrl(),
temp: {
id: undefined,
importance: 1,
remark: '',
timestamp: new Date(),
content: '',
url: '',
title: '',
type: '',
status: 'published'
type: ''
},
dialogFormVisible: false,
dialogStatus: '',
......@@ -285,6 +274,9 @@ export default {
}
],
title: [
{ required: true, message: 'content is required', trigger: 'blur' }
],
content: [
{ required: true, message: 'title is required', trigger: 'blur' }
]
},
......@@ -297,15 +289,16 @@ export default {
methods: {
getList() {
this.listLoading = true
fetchList(this.listQuery).then(response => {
this.list = response.data.items
this.total = response.data.total
// Just to simulate the time of the request
setTimeout(() => {
this.listLoading = false
}, 1.5 * 1000)
})
getList(this.listQuery, this.listQuery.page, this.listQuery.limit).then(
response => {
this.list = response.data.list
this.total = response.data.count
// Just to simulate the time of the request
setTimeout(() => {
this.listLoading = false
}, 1.5 * 1000)
}
)
},
handleFilter() {
this.listQuery.page = 1
......@@ -319,9 +312,17 @@ export default {
row.status = status
},
handlerReset() {
this.listQuery = {}
this.listQuery = {
page: 1,
limit: 20
}
this.getList()
},
formateBtime() {
const time = this.listQuery.time
this.listQuery.beginTime = time[0]
this.listQuery.endTime = time[1]
},
sortChange(data) {
const { prop, order } = data
if (prop === 'id') {
......@@ -369,14 +370,12 @@ export default {
createData() {
this.$refs['dataForm'].validate(valid => {
if (valid) {
this.temp.id = parseInt(Math.random() * 100) + 1024 // mock a id
this.temp.author = 'vue-element-admin'
createArticle(this.temp).then(() => {
this.list.unshift(this.temp)
add(this.temp).then(() => {
this.dialogFormVisible = false
this.getList()
this.$notify({
title: 'Success',
message: 'Created Successfully',
message: '添加成功',
type: 'success',
duration: 2000
})
......@@ -385,12 +384,13 @@ export default {
})
},
handleUpdate(row) {
this.temp = Object.assign({}, row) // copy obj
this.temp.timestamp = new Date(this.temp.timestamp)
this.dialogStatus = 'update'
this.dialogFormVisible = true
this.$nextTick(() => {
this.$refs['dataForm'].clearValidate()
getDetail(row.constructionId).then(res => {
this.temp = res.data
this.dialogStatus = 'update'
this.dialogFormVisible = true
this.$nextTick(() => {
this.$refs['dataForm'].clearValidate()
})
})
},
updateData() {
......@@ -398,14 +398,8 @@ export default {
if (valid) {
const tempData = Object.assign({}, this.temp)
tempData.timestamp = +new Date(tempData.timestamp) // change Thu Nov 30 2017 16:41:05 GMT+0800 (CST) to 1512031311464
updateArticle(tempData).then(() => {
for (const v of this.list) {
if (v.id === this.temp.id) {
const index = this.list.indexOf(v)
this.list.splice(index, 1, this.temp)
break
}
}
update(tempData).then(() => {
this.getList()
this.dialogFormVisible = false
this.$notify({
title: 'Success',
......@@ -418,19 +412,14 @@ export default {
})
},
handleDelete(row) {
this.$notify({
title: 'Success',
message: 'Delete Successfully',
type: 'success',
duration: 2000
})
const index = this.list.indexOf(row)
this.list.splice(index, 1)
},
handleFetchPv(pv) {
fetchPv(pv).then(response => {
this.pvData = response.data.pvData
this.dialogPvVisible = true
del(row.constructionId).then(() => {
this.getList()
this.$notify({
title: 'Success',
message: 'Delete Successfully',
type: 'success',
duration: 2000
})
})
},
onProgress(event) {
......@@ -447,19 +436,7 @@ export default {
} else {
this.fullscreenLoading = false
this.$message('上传成功')
this.temp.frameInfo.frameUrl = e.frameUrl
this.temp.resourceInfo.resourceUrl = e.resourceUrl
this.temp.templateCount = e.pictureUrl.length
this.temp.templateUrl = e.pictureUrl
.map(item => {
if (item.indexOf('http') !== -1 || item.indexOf('https') !== -1) {
return item + ''
} else {
return e.url + item + ''
}
})
.join(',')
this.temp.addVersionInfoDTO.zipUrl = e.zipUrl
this.temp.url = e.url
console.log(this.temp)
}
console.log(e)
......
......@@ -6,6 +6,7 @@
class="filter-item"
type="datetimerange"
:picker-options="pickerOptions"
value-format="yyyy-MM-dd HH:mm:ss"
range-separator="至"
start-placeholder="开始时间"
end-placeholder="结束时间"
......@@ -19,7 +20,7 @@
@keyup.enter.native="handleFilter"
/>
<el-select
v-model="listQuery.type"
v-model="listQuery.code"
placeholder="省份"
clearable
class="filter-item"
......@@ -27,9 +28,9 @@
>
<el-option
v-for="item in calendarTypeOptions"
:key="item.id"
:key="item.code"
:label="item.name"
:value="item.id"
:value="item.code"
/>
</el-select>
<el-button
......@@ -75,38 +76,37 @@
:class-name="getSortClass('id')"
>
<template slot-scope="scope">
<span>{{ scope.row.id }}</span>
<span>{{ scope.row.liaisonId }}</span>
</template>
</el-table-column>
<el-table-column label="省份" width="110px" align="center">
<template slot-scope="scope">
<span>{{ scope.row.author }}</span>
<span>{{ scope.row.areaName }}</span>
</template>
</el-table-column>
<el-table-column label="标题" min-width="150px">
<template slot-scope="{row}">
<span class="link-type" @click="handleUpdate(row)">{{ row.title }}</span>
<el-tag>{{ row.type }}</el-tag>
</template>
</el-table-column>
<el-table-column label="联系电话" width="110px" align="center">
<template slot-scope="scope">
<span>{{ scope.row.author }}</span>
<span>{{ scope.row.phone }}</span>
</template>
</el-table-column>
<el-table-column label="电子邮箱" width="80px">
<template slot-scope="scope">
<span>{{ scope.row.author }}</span>
<span>{{ scope.row.email }}</span>
</template>
</el-table-column>
<el-table-column label="地址" width="150px" align="center">
<template slot-scope="scope">
<span>{{ scope.row.timestamp | parseTime('{y}-{m}-{d} {h}:{i}') }}</span>
<span>{{ scope.row.location }}</span>
</template>
</el-table-column>
<el-table-column label="邮编" width="150px" align="center">
<template slot-scope="scope">
<span>{{ scope.row.timestamp | parseTime('{y}-{m}-{d} {h}:{i}') }}</span>
<span>{{ scope.row.postal }}</span>
</template>
</el-table-column>
<el-table-column
......@@ -117,7 +117,7 @@
>
<template slot-scope="{row}">
<el-button type="primary" size="mini" @click="handleUpdate(row)">修改</el-button>
<el-button size="mini" type="danger" @click="handleModifyStatus(row,'deleted')">删除</el-button>
<el-button size="mini" type="danger" @click="handleDelete(row,'deleted')">删除</el-button>
</template>
</el-table-column>
</el-table>
......@@ -143,17 +143,17 @@
</el-form-item>-->
<el-form-item label="省份" prop="type">
<el-select
v-model="temp.type"
placeholder="类型"
v-model="temp.code"
placeholder="请选择"
clearable
class="filter-item"
style="width: 130px"
>
<el-option
v-for="item in calendarTypeOptions"
:key="item.id"
:key="item.code"
:label="item.name"
:value="item.id"
:value="item.code"
/>
</el-select>
</el-form-item>
......@@ -161,38 +161,29 @@
<el-input
v-model="temp.title"
:autosize="{ minRows: 2, maxRows: 4}"
type="password"
placeholder="请输入"
/>
</el-form-item>
<el-form-item label="联系电话" prop="content">
<el-input
v-model="temp.content"
:autosize="{ minRows: 2, maxRows: 4}"
type="text"
placeholder="请输入"
/>
</el-form-item>
<el-form-item label="联系电话" prop="content">
<el-form-item label="联系电话" prop="phone">
<el-input
v-model="temp.content"
v-model="temp.phone"
:autosize="{ minRows: 2, maxRows: 4}"
type="text"
placeholder="请输入"
/>
</el-form-item>
<el-form-item label="地址" prop="content">
<el-form-item label="地址" prop="location">
<el-input
v-model="temp.content"
v-model="temp.location"
:autosize="{ minRows: 2, maxRows: 4}"
type="text"
placeholder="请输入"
/>
</el-form-item>
<el-form-item label="邮编" prop="type">
<el-form-item label="邮编" prop="postal">
<el-input
v-model="temp.content"
:autosize="{ minRows: 2, maxRows: 4}"
v-model="temp.postal"
type="text"
placeholder="请输入"
/>
......@@ -205,41 +196,35 @@
</el-dialog>
</div>
</template>
<script>
import {
fetchList,
fetchPv,
createArticle,
updateArticle
} from '@/api/article'
import { getList, add, del, update, getDetail } from '@/api/liaison'
import { uploadUrl } from '@/api/common'
import { getProvince } from '@/api/common'
import waves from '@/directive/waves' // waves directive
import { parseTime } from '@/utils'
import Pagination from '@/components/Pagination' // secondary package based on el-pagination
const calendarTypeOptions = [
{ id: 1, name: '预警中心' },
{ id: 2, name: '预警发布系统' },
{ id: 3, name: '建设成效' }
{ id: '1', name: '预警中心' },
{ id: '2', name: '预警发布系统' }
]
const calendarType2Options = [
{ id: 1, name: '华东' },
{ id: 2, name: '华中' },
{ id: 3, name: '华北' },
{ id: 4, name: '东北' },
{ id: 6, name: '华南' },
{ id: 7, name: '西南' },
{ id: 8, name: '华东' }
{ id: '1', name: '华东' },
{ id: '2', name: '华中' },
{ id: '3', name: '华北' },
{ id: '4', name: '东北' },
{ id: '6', name: '华南' },
{ id: '7', name: '西南' },
{ id: '8', name: '华东' }
]
const calendarType3Options = [
{ id: 1, name: '水利' },
{ id: 2, name: '民政' },
{ id: 3, name: '交通' },
{ id: 4, name: '海洋' },
{ id: 5, name: '旅游' },
{ id: 6, name: '卫生' },
{ id: 7, name: '公交' }
{ id: '1', name: '水利' },
{ id: '2', name: '民政' },
{ id: '3', name: '交通' },
{ id: '4', name: '海洋' },
{ id: '5', name: '旅游' },
{ id: '6', name: '卫生' },
{ id: '7', name: '公交' }
]
export default {
name: 'ComplexTable',
......@@ -264,9 +249,8 @@ export default {
listQuery: {
page: 1,
limit: 20,
importance: undefined,
title: undefined,
type: undefined,
code: undefined,
sort: '+id'
},
multipleSelection: [],
......@@ -308,12 +292,10 @@ export default {
uploadUrl: uploadUrl(),
temp: {
id: undefined,
importance: 1,
remark: '',
timestamp: new Date(),
content: '',
url: '',
title: '',
type: '',
status: 'published'
type: ''
},
dialogFormVisible: false,
dialogStatus: '',
......@@ -324,19 +306,30 @@ export default {
dialogPvVisible: false,
pvData: [],
rules: {
type: [
code: [
{ required: true, message: 'type is required', trigger: 'change' }
],
timestamp: [
location: [
{
type: 'date',
required: true,
message: 'timestamp is required',
message: 'location is required',
trigger: 'change'
}
],
title: [
{ required: true, message: 'title is required', trigger: 'blur' }
],
content: [
{ required: true, message: 'content is required', trigger: 'blur' }
],
phone: [
{ required: true, message: 'phone is required', trigger: 'blur' }
],
email: [
{ required: true, message: 'email is required', trigger: 'blur' }
],
postal: [
{ required: true, message: 'postal is required', trigger: 'blur' }
]
},
downloadLoading: false
......@@ -344,19 +337,26 @@ export default {
},
created() {
this.getList()
this.getPro()
},
methods: {
getPro() {
getProvince().then(res => {
this.calendarTypeOptions = res.data
})
},
getList() {
this.listLoading = true
fetchList(this.listQuery).then(response => {
this.list = response.data.items
this.total = response.data.total
// Just to simulate the time of the request
setTimeout(() => {
this.listLoading = false
}, 1.5 * 1000)
})
getList(this.listQuery, this.listQuery.page, this.listQuery.limit).then(
response => {
this.list = response.data.list
this.total = response.data.count
// Just to simulate the time of the request
setTimeout(() => {
this.listLoading = false
}, 1.5 * 1000)
}
)
},
handleFilter() {
this.listQuery.page = 1
......@@ -370,9 +370,18 @@ export default {
row.status = status
},
handlerReset() {
this.listQuery = {}
this.listQuery = {
page: 1,
limit: 20,
code: undefined
}
this.getList()
},
formateBtime() {
const time = this.listQuery.time
this.listQuery.beginTime = time[0]
this.listQuery.endTime = time[1]
},
sortChange(data) {
const { prop, order } = data
if (prop === 'id') {
......@@ -420,14 +429,12 @@ export default {
createData() {
this.$refs['dataForm'].validate(valid => {
if (valid) {
this.temp.id = parseInt(Math.random() * 100) + 1024 // mock a id
this.temp.author = 'vue-element-admin'
createArticle(this.temp).then(() => {
this.list.unshift(this.temp)
add(this.temp).then(() => {
this.dialogFormVisible = false
this.getList()
this.$notify({
title: 'Success',
message: 'Created Successfully',
message: '添加成功',
type: 'success',
duration: 2000
})
......@@ -436,12 +443,13 @@ export default {
})
},
handleUpdate(row) {
this.temp = Object.assign({}, row) // copy obj
this.temp.timestamp = new Date(this.temp.timestamp)
this.dialogStatus = 'update'
this.dialogFormVisible = true
this.$nextTick(() => {
this.$refs['dataForm'].clearValidate()
getDetail(row.liaisonId).then(res => {
this.temp = res.data
this.dialogStatus = 'update'
this.dialogFormVisible = true
this.$nextTick(() => {
this.$refs['dataForm'].clearValidate()
})
})
},
updateData() {
......@@ -449,14 +457,8 @@ export default {
if (valid) {
const tempData = Object.assign({}, this.temp)
tempData.timestamp = +new Date(tempData.timestamp) // change Thu Nov 30 2017 16:41:05 GMT+0800 (CST) to 1512031311464
updateArticle(tempData).then(() => {
for (const v of this.list) {
if (v.id === this.temp.id) {
const index = this.list.indexOf(v)
this.list.splice(index, 1, this.temp)
break
}
}
update(tempData).then(() => {
this.getList()
this.dialogFormVisible = false
this.$notify({
title: 'Success',
......@@ -469,19 +471,14 @@ export default {
})
},
handleDelete(row) {
this.$notify({
title: 'Success',
message: 'Delete Successfully',
type: 'success',
duration: 2000
})
const index = this.list.indexOf(row)
this.list.splice(index, 1)
},
handleFetchPv(pv) {
fetchPv(pv).then(response => {
this.pvData = response.data.pvData
this.dialogPvVisible = true
del(row.liaisonId).then(() => {
this.getList()
this.$notify({
title: 'Success',
message: 'Delete Successfully',
type: 'success',
duration: 2000
})
})
},
onProgress(event) {
......@@ -498,19 +495,7 @@ export default {
} else {
this.fullscreenLoading = false
this.$message('上传成功')
this.temp.frameInfo.frameUrl = e.frameUrl
this.temp.resourceInfo.resourceUrl = e.resourceUrl
this.temp.templateCount = e.pictureUrl.length
this.temp.templateUrl = e.pictureUrl
.map(item => {
if (item.indexOf('http') !== -1 || item.indexOf('https') !== -1) {
return item + ''
} else {
return e.url + item + ''
}
})
.join(',')
this.temp.addVersionInfoDTO.zipUrl = e.zipUrl
this.temp.url = e.url
console.log(this.temp)
}
console.log(e)
......
......@@ -59,14 +59,14 @@
<span class="link-type" @click="handleUpdate(row)">{{ row.userName }}</span>
</template>
</el-table-column>
<el-table-column label="所属角色" width="110px" align="center">
<!-- <el-table-column label="所属角色" width="110px" align="center">
<template slot-scope="scope">
<span>{{ scope.row.author }}</span>
</template>
</el-table-column>
</el-table-column> -->
<el-table-column label="最后登录ip" width="120px">
<template slot-scope="scope">
<div>27.184.152.171 {{ scope.row.loginIp }}</div>
<div>{{ scope.row.loginIp }}</div>
</template>
</el-table-column>
<el-table-column label="最后登录时间" width="150px" align="center">
......@@ -126,7 +126,7 @@
v-model="temp.userEmail"
:autosize="{ minRows: 2, maxRows: 4}"
type="text"
placeholder="Please input"
placeholder="请输入"
/>
</el-form-item>
<el-form-item v-show="false" label="所属角色" prop="type">
......
......@@ -121,7 +121,7 @@
<el-rate v-model="temp.importance" :colors="['#99A9BF', '#F7BA2A', '#FF9900']" :max="3" style="margin-top:8px;" />
</el-form-item>
<el-form-item label="Remark">
<el-input v-model="temp.remark" :autosize="{ minRows: 2, maxRows: 4}" type="textarea" placeholder="Please input" />
<el-input v-model="temp.remark" :autosize="{ minRows: 2, maxRows: 4}" type="textarea" placeholder="请输入" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment