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