|
|
@ -24,7 +24,7 @@ |
|
|
</el-form-item> |
|
|
</el-form-item> |
|
|
<el-form-item label="关键字"> |
|
|
<el-form-item label="关键字"> |
|
|
<el-form-item> |
|
|
<el-form-item> |
|
|
<el-input v-model="dataForm.keyword" |
|
|
<el-input v-model="dataForm.keyword" @keyup.native="btKeyUpkeyword" |
|
|
placeholder="请输入标题" |
|
|
placeholder="请输入标题" |
|
|
clearable></el-input> |
|
|
clearable></el-input> |
|
|
</el-form-item> |
|
|
</el-form-item> |
|
|
@ -83,12 +83,14 @@ |
|
|
<el-form-item> |
|
|
<el-form-item> |
|
|
<el-button v-if="$hasPermission('news:news:save')" |
|
|
<el-button v-if="$hasPermission('news:news:save')" |
|
|
type="primary" |
|
|
type="primary" |
|
|
@click="addOrUpdateHandle()">{{ $t('add') }}</el-button> |
|
|
@click="addOrUpdateHandle()">{{ $t('add') }} |
|
|
|
|
|
</el-button> |
|
|
</el-form-item> |
|
|
</el-form-item> |
|
|
<el-form-item> |
|
|
<el-form-item> |
|
|
<el-button v-if="$hasPermission('news:news:delete')" |
|
|
<el-button v-if="$hasPermission('news:news:delete')" |
|
|
type="danger" |
|
|
type="danger" |
|
|
@click="deleteHandle()">{{ $t('deleteBatch') }}</el-button> |
|
|
@click="deleteHandle()">{{ $t('deleteBatch') }} |
|
|
|
|
|
</el-button> |
|
|
</el-form-item> |
|
|
</el-form-item> |
|
|
</el-form> |
|
|
</el-form> |
|
|
<el-table v-loading="dataListLoading" |
|
|
<el-table v-loading="dataListLoading" |
|
|
@ -155,21 +157,25 @@ |
|
|
<template slot-scope="scope"> |
|
|
<template slot-scope="scope"> |
|
|
<el-button type="text" |
|
|
<el-button type="text" |
|
|
size="small" |
|
|
size="small" |
|
|
@click="addOrUpdateHandle(scope.row.id)">{{ $t('update') }}</el-button> |
|
|
@click="addOrUpdateHandle(scope.row.id)">{{ $t('update') }} |
|
|
|
|
|
</el-button> |
|
|
<el-button type="text" |
|
|
<el-button type="text" |
|
|
size="small" |
|
|
size="small" |
|
|
@click="deleteHandle(scope.row.id)">{{ $t('delete') }}</el-button> |
|
|
@click="deleteHandle(scope.row.id)">{{ $t('delete') }} |
|
|
|
|
|
</el-button> |
|
|
<el-button v-if="$hasPermission('news:show:down') && scope.row.newsUpDownState === '0' && new Date(scope.row.newsReleaseStartTime.replace('-', '/')) < new Date() |
|
|
<el-button v-if="$hasPermission('news:show:down') && scope.row.newsUpDownState === '0' && new Date(scope.row.newsReleaseStartTime.replace('-', '/')) < new Date() |
|
|
&& new Date(scope.row.newsReleaseEndTime.replace('-', '/')) > new Date()" |
|
|
&& new Date(scope.row.newsReleaseEndTime.replace('-', '/')) > new Date()" |
|
|
|
|
|
|
|
|
type="text" |
|
|
type="text" |
|
|
size="small" |
|
|
size="small" |
|
|
@click="modifyOnLine(scope.row)">下线</el-button> |
|
|
@click="modifyOnLine(scope.row)">下线 |
|
|
|
|
|
</el-button> |
|
|
<el-button v-if="$hasPermission('news:banner:up') && scope.row.bannerFlag === '0' && scope.row.newsUpDownState === '0' && new Date(scope.row.newsReleaseStartTime.replace('-', '/')) < new Date() |
|
|
<el-button v-if="$hasPermission('news:banner:up') && scope.row.bannerFlag === '0' && scope.row.newsUpDownState === '0' && new Date(scope.row.newsReleaseStartTime.replace('-', '/')) < new Date() |
|
|
&& new Date(scope.row.newsReleaseEndTime.replace('-', '/')) > new Date() " |
|
|
&& new Date(scope.row.newsReleaseEndTime.replace('-', '/')) > new Date() " |
|
|
type="text" |
|
|
type="text" |
|
|
size="small" |
|
|
size="small" |
|
|
@click="newsToBanner(scope.row)">上banner</el-button> |
|
|
@click="newsToBanner(scope.row)">上banner |
|
|
|
|
|
</el-button> |
|
|
</template> |
|
|
</template> |
|
|
</el-table-column> |
|
|
</el-table-column> |
|
|
</el-table> |
|
|
</el-table> |
|
|
@ -189,11 +195,12 @@ |
|
|
</el-card> |
|
|
</el-card> |
|
|
</template> |
|
|
</template> |
|
|
<script> |
|
|
<script> |
|
|
import mixinViewModule from '@/mixins/view-module' |
|
|
import mixinViewModule from '@/mixins/view-module' |
|
|
import AddOrUpdate from './news-add-or-update' |
|
|
import AddOrUpdate from './news-add-or-update' |
|
|
export default { |
|
|
|
|
|
|
|
|
export default { |
|
|
mixins: [mixinViewModule], |
|
|
mixins: [mixinViewModule], |
|
|
data () { |
|
|
data() { |
|
|
return { |
|
|
return { |
|
|
mixinViewModuleOptions: { |
|
|
mixinViewModuleOptions: { |
|
|
getDataListURL: '/news/news/page', |
|
|
getDataListURL: '/news/news/page', |
|
|
@ -224,16 +231,17 @@ export default { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
created () { |
|
|
created() { |
|
|
this.$http |
|
|
this.$http |
|
|
.get(`/sys/user/deptOptions/getByLoginUser`) |
|
|
.get(`/sys/user/deptOptions/getByLoginUser`) |
|
|
.then(({ data: res }) => { |
|
|
.then(({data: res}) => { |
|
|
if (res.code !== 0) { |
|
|
if (res.code !== 0) { |
|
|
return this.$message.error(res.msg) |
|
|
return this.$message.error(res.msg) |
|
|
} |
|
|
} |
|
|
this.options = res.data.options |
|
|
this.options = res.data.options |
|
|
}) |
|
|
}) |
|
|
.catch(() => { }) |
|
|
.catch(() => { |
|
|
|
|
|
}) |
|
|
this.getDeptInfoList('street', localStorage.getItem('street') === null ? '1169154711480528897' : localStorage.getItem('street')) |
|
|
this.getDeptInfoList('street', localStorage.getItem('street') === null ? '1169154711480528897' : localStorage.getItem('street')) |
|
|
this.getListCategory() |
|
|
this.getListCategory() |
|
|
}, |
|
|
}, |
|
|
@ -260,8 +268,8 @@ export default { |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
// 获取部门列表 |
|
|
// 获取部门列表 |
|
|
getDeptInfoList (dataReceiver, faDeptId) { |
|
|
getDeptInfoList(dataReceiver, faDeptId) { |
|
|
this.$http.get(`/sys/dept/sublist/` + faDeptId).then(({ data: res }) => { |
|
|
this.$http.get(`/sys/dept/sublist/` + faDeptId).then(({data: res}) => { |
|
|
if (res.code !== 0) { |
|
|
if (res.code !== 0) { |
|
|
return this.$message.error(res.msg) |
|
|
return this.$message.error(res.msg) |
|
|
} |
|
|
} |
|
|
@ -272,9 +280,10 @@ export default { |
|
|
} else if (dataReceiver === 'grid') { |
|
|
} else if (dataReceiver === 'grid') { |
|
|
this.gridList = res.data |
|
|
this.gridList = res.data |
|
|
} |
|
|
} |
|
|
}).catch(() => { }) |
|
|
}).catch(() => { |
|
|
|
|
|
}) |
|
|
}, |
|
|
}, |
|
|
changeStreet (event) { |
|
|
changeStreet(event) { |
|
|
if (this.dataForm.streetId === '') { |
|
|
if (this.dataForm.streetId === '') { |
|
|
this.communityList = [] |
|
|
this.communityList = [] |
|
|
this.gridList = [] |
|
|
this.gridList = [] |
|
|
@ -289,7 +298,7 @@ export default { |
|
|
this.communityList = this.gridList = [] |
|
|
this.communityList = this.gridList = [] |
|
|
this.getDeptInfoList('community', event) |
|
|
this.getDeptInfoList('community', event) |
|
|
}, |
|
|
}, |
|
|
changeCommunity (event) { |
|
|
changeCommunity(event) { |
|
|
if (this.dataForm.communityId === '') { |
|
|
if (this.dataForm.communityId === '') { |
|
|
this.gridList = [] |
|
|
this.gridList = [] |
|
|
this.dataForm.gridId = '' |
|
|
this.dataForm.gridId = '' |
|
|
@ -302,30 +311,31 @@ export default { |
|
|
this.gridList = [] |
|
|
this.gridList = [] |
|
|
this.getDeptInfoList('grid', event) |
|
|
this.getDeptInfoList('grid', event) |
|
|
}, |
|
|
}, |
|
|
changeGrid (event) { |
|
|
changeGrid(event) { |
|
|
this.dataForm.gridId = event |
|
|
this.dataForm.gridId = event |
|
|
let choosenItem = this.gridList.filter(item => item.id === this.gridId)[0] |
|
|
let choosenItem = this.gridList.filter(item => item.id === this.gridId)[0] |
|
|
this.initDeptIdAndName(choosenItem) |
|
|
this.initDeptIdAndName(choosenItem) |
|
|
}, |
|
|
}, |
|
|
initDeptIdAndName (choosenItem) { |
|
|
initDeptIdAndName(choosenItem) { |
|
|
this.dataForm.dept = choosenItem.name |
|
|
this.dataForm.dept = choosenItem.name |
|
|
this.dataForm.deptId = choosenItem.id |
|
|
this.dataForm.deptId = choosenItem.id |
|
|
}, |
|
|
}, |
|
|
setRegistTime () { |
|
|
setRegistTime() { |
|
|
console.log(this.time[0]) |
|
|
console.log(this.time[0]) |
|
|
this.dataForm.startTime = this.time[0] |
|
|
this.dataForm.startTime = this.time[0] |
|
|
this.dataForm.endTime = this.time[1] |
|
|
this.dataForm.endTime = this.time[1] |
|
|
}, |
|
|
}, |
|
|
getListCategory () { |
|
|
getListCategory() { |
|
|
this.$http.get(`/news/newscategory/category/`).then(({ data: res }) => { |
|
|
this.$http.get(`/news/newscategory/category/`).then(({data: res}) => { |
|
|
if (res.code !== 0) { |
|
|
if (res.code !== 0) { |
|
|
return this.$message.error(res.msg) |
|
|
return this.$message.error(res.msg) |
|
|
} |
|
|
} |
|
|
this.categorys = res.data |
|
|
this.categorys = res.data |
|
|
}).catch(() => { }) |
|
|
}).catch(() => { |
|
|
|
|
|
}) |
|
|
}, |
|
|
}, |
|
|
modifyOnLine (row) { |
|
|
modifyOnLine(row) { |
|
|
this.$confirm(this.$t('prompt.info', { 'handle': '下线' }), this.$t('下线'), { |
|
|
this.$confirm(this.$t('prompt.info', {'handle': '下线'}), this.$t('下线'), { |
|
|
confirmButtonText: this.$t('confirm'), |
|
|
confirmButtonText: this.$t('confirm'), |
|
|
cancelButtonText: this.$t('cancel'), |
|
|
cancelButtonText: this.$t('cancel'), |
|
|
type: 'warning' |
|
|
type: 'warning' |
|
|
@ -333,7 +343,7 @@ export default { |
|
|
this.onLine.id = row.id |
|
|
this.onLine.id = row.id |
|
|
this.onLine.onLineState = '0' |
|
|
this.onLine.onLineState = '0' |
|
|
console.log(this.onLine) |
|
|
console.log(this.onLine) |
|
|
this.$http.post(`/news/news/modifyOnLine/`, this.onLine).then(({ data: res }) => { |
|
|
this.$http.post(`/news/news/modifyOnLine/`, this.onLine).then(({data: res}) => { |
|
|
if (res.code !== 0) { |
|
|
if (res.code !== 0) { |
|
|
return this.$message.error(res.msg) |
|
|
return this.$message.error(res.msg) |
|
|
} |
|
|
} |
|
|
@ -345,16 +355,18 @@ export default { |
|
|
} |
|
|
} |
|
|
}) |
|
|
}) |
|
|
this.getDataList() |
|
|
this.getDataList() |
|
|
}).catch(() => { }) |
|
|
}).catch(() => { |
|
|
}).catch(() => { }) |
|
|
}) |
|
|
|
|
|
}).catch(() => { |
|
|
|
|
|
}) |
|
|
}, |
|
|
}, |
|
|
newsToBanner (row) { |
|
|
newsToBanner(row) { |
|
|
this.$confirm(this.$t('prompt.info', { 'handle': '上banner' }), this.$t('上banner'), { |
|
|
this.$confirm(this.$t('prompt.info', {'handle': '上banner'}), this.$t('上banner'), { |
|
|
confirmButtonText: this.$t('confirm'), |
|
|
confirmButtonText: this.$t('confirm'), |
|
|
cancelButtonText: this.$t('cancel'), |
|
|
cancelButtonText: this.$t('cancel'), |
|
|
type: 'warning' |
|
|
type: 'warning' |
|
|
}).then(() => { |
|
|
}).then(() => { |
|
|
this.$http.post(`/news/news/newsToBanner/` + row.id).then(({ data: res }) => { |
|
|
this.$http.post(`/news/news/newsToBanner/` + row.id).then(({data: res}) => { |
|
|
if (res.code !== 0) { |
|
|
if (res.code !== 0) { |
|
|
return this.$message.error(res.msg) |
|
|
return this.$message.error(res.msg) |
|
|
} |
|
|
} |
|
|
@ -366,11 +378,13 @@ export default { |
|
|
} |
|
|
} |
|
|
}) |
|
|
}) |
|
|
this.getDataList() |
|
|
this.getDataList() |
|
|
}).catch(() => { }) |
|
|
}).catch(() => { |
|
|
}).catch(() => { }) |
|
|
}) |
|
|
|
|
|
}).catch(() => { |
|
|
|
|
|
}) |
|
|
}, |
|
|
}, |
|
|
// 获取数据列表 |
|
|
// 获取数据列表 |
|
|
getDataList () { |
|
|
getDataList() { |
|
|
if (this.time === null) { |
|
|
if (this.time === null) { |
|
|
this.dataForm.startTime = '' |
|
|
this.dataForm.startTime = '' |
|
|
this.dataForm.endTime = '' |
|
|
this.dataForm.endTime = '' |
|
|
@ -387,7 +401,7 @@ export default { |
|
|
...this.dataForm |
|
|
...this.dataForm |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
).then(({ data: res }) => { |
|
|
).then(({data: res}) => { |
|
|
this.dataListLoading = false |
|
|
this.dataListLoading = false |
|
|
if (res.code !== 0) { |
|
|
if (res.code !== 0) { |
|
|
this.dataList = [] |
|
|
this.dataList = [] |
|
|
@ -399,7 +413,12 @@ export default { |
|
|
}).catch(() => { |
|
|
}).catch(() => { |
|
|
this.dataListLoading = false |
|
|
this.dataListLoading = false |
|
|
}) |
|
|
}) |
|
|
} |
|
|
}, |
|
|
|
|
|
//特殊字符处理 |
|
|
|
|
|
btKeyUpkeyword(e) { |
|
|
|
|
|
e.target.value = e.target.value.replace(/[`~!#$%^&*()_\+=<>?:"{}|~!#¥%……&*()={}|《》?:“”【】、;‘’,。、]/g, '') |
|
|
|
|
|
this.dataForm.keyword = e.target.value |
|
|
|
|
|
}, |
|
|
}, |
|
|
}, |
|
|
components: { |
|
|
components: { |
|
|
AddOrUpdate |
|
|
AddOrUpdate |
|
|
@ -413,5 +432,5 @@ export default { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
</script> |
|
|
</script> |
|
|
|