12 changed files with 1692 additions and 1 deletions
@ -0,0 +1,213 @@ |
|||
<template> |
|||
<el-dialog :visible.sync="visible" :title="!dataForm.id ? $t('add') : $t('update')" :close-on-click-modal="false" :close-on-press-escape="false"> |
|||
<el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmitHandle()" :label-width="$i18n.locale === 'en-US' ? '120px' : '80px'"> |
|||
<!-- <el-form-item label="上级ID" prop="pid">--> |
|||
<!-- <el-input v-model="dataForm.pid" placeholder="上级ID"></el-input>--> |
|||
<!-- </el-form-item>--> |
|||
<!-- <el-form-item label="所有上级ID 逗号分隔" prop="pids">--> |
|||
<!-- <el-input v-model="dataForm.pids" placeholder="所有上级ID 逗号分隔"></el-input>--> |
|||
<!-- </el-form-item>--> |
|||
<el-form-item label="类别名称" prop="typeName"> |
|||
<el-input v-model="dataForm.typeName" placeholder="类别名称"></el-input> |
|||
</el-form-item> |
|||
<el-form-item label="类别编码" prop="typeCode"> |
|||
<el-input v-model="dataForm.typeCode" placeholder="类别编码"></el-input> |
|||
</el-form-item> |
|||
<el-form-item prop="parentName" label="上级分类" class="category-list"> |
|||
<el-popover v-model="categoryListVisible" ref="categoryListPopover" placement="bottom-start" trigger="click"> |
|||
<el-tree :data="categoryList" |
|||
:props="{ label: 'typeName', children: 'children' }" |
|||
node-key="id" |
|||
ref="categoryListTree" |
|||
:highlight-current="true" |
|||
:expand-on-click-node="false" |
|||
accordion |
|||
@current-change="categoryListTreeCurrentChangeHandle"> |
|||
</el-tree> |
|||
</el-popover> |
|||
<el-input v-model="dataForm.parentName" v-popover:categoryListPopover :readonly="true" placeholder="上级分类"> |
|||
<i v-if="dataForm.pid !== '0'" slot="suffix" @click.stop="categoryListTreeSetDefaultHandle()" class="el-icon-circle-close el-input__icon"></i> |
|||
</el-input> |
|||
</el-form-item> |
|||
<el-form-item prop="sort" label="排序"> |
|||
<el-input-number v-model="dataForm.sort" controls-position="right" :min="0" label="排序"></el-input-number> |
|||
</el-form-item> |
|||
<!-- <el-form-item label="启用标识 0-否,1-是" prop="bannerFlag">--> |
|||
<!-- <el-input v-model="dataForm.bannerFlag" placeholder="启用标识 0-否,1-是"></el-input>--> |
|||
<!-- </el-form-item>--> |
|||
<!-- <el-form-item label="删除标识 0-否,1-是" prop="delFlag">--> |
|||
<!-- <el-input v-model="dataForm.delFlag" placeholder="删除标识 0-否,1-是"></el-input>--> |
|||
<!-- </el-form-item>--> |
|||
<!-- <el-form-item label="乐观锁" prop="revision">--> |
|||
<!-- <el-input v-model="dataForm.revision" placeholder="乐观锁"></el-input>--> |
|||
<!-- </el-form-item>--> |
|||
<!-- <el-form-item label="创建人" prop="createdBy">--> |
|||
<!-- <el-input v-model="dataForm.createdBy" placeholder="创建人"></el-input>--> |
|||
<!-- </el-form-item>--> |
|||
<!-- <el-form-item label="创建时间" prop="createdTime">--> |
|||
<!-- <el-input v-model="dataForm.createdTime" placeholder="创建时间"></el-input>--> |
|||
<!-- </el-form-item>--> |
|||
<!-- <el-form-item label="更新人" prop="updatedBy">--> |
|||
<!-- <el-input v-model="dataForm.updatedBy" placeholder="更新人"></el-input>--> |
|||
<!-- </el-form-item>--> |
|||
<!-- <el-form-item label="更新时间" prop="updatedTime">--> |
|||
<!-- <el-input v-model="dataForm.updatedTime" placeholder="更新时间"></el-input>--> |
|||
<!-- </el-form-item>--> |
|||
</el-form> |
|||
<template slot="footer"> |
|||
<el-button @click="visible = false">{{ $t('cancel') }}</el-button> |
|||
<el-button type="primary" @click="dataFormSubmitHandle()">{{ $t('confirm') }}</el-button> |
|||
</template> |
|||
</el-dialog> |
|||
</template> |
|||
|
|||
<script> |
|||
import debounce from 'lodash/debounce' |
|||
export default { |
|||
data () { |
|||
return { |
|||
visible: false, |
|||
dataForm: { |
|||
id: '', |
|||
pid: '', |
|||
pids: '', |
|||
typeName: '', |
|||
typeCode: '', |
|||
sort: '', |
|||
bannerFlag: '', |
|||
delFlag: '', |
|||
revision: '', |
|||
createdBy: '', |
|||
createdTime: '', |
|||
updatedBy: '', |
|||
updatedTime: '' |
|||
}, |
|||
categoryList: [], |
|||
categoryListVisible: false, |
|||
} |
|||
}, |
|||
computed: { |
|||
dataRule () { |
|||
return { |
|||
// pid: [ |
|||
// { required: true, message: this.$t('validate.required'), trigger: 'blur' } |
|||
// ], |
|||
// pids: [ |
|||
// { required: true, message: this.$t('validate.required'), trigger: 'blur' } |
|||
// ], |
|||
// parentName: [ |
|||
// { required: true, message: this.$t('validate.required'), trigger: 'change' } |
|||
// ], |
|||
typeName: [ |
|||
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } |
|||
], |
|||
typeCode: [ |
|||
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } |
|||
], |
|||
sort: [ |
|||
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } |
|||
], |
|||
// bannerFlag: [ |
|||
// { required: true, message: this.$t('validate.required'), trigger: 'blur' } |
|||
// ], |
|||
// delFlag: [ |
|||
// { required: true, message: this.$t('validate.required'), trigger: 'blur' } |
|||
// ], |
|||
// revision: [ |
|||
// { required: true, message: this.$t('validate.required'), trigger: 'blur' } |
|||
// ], |
|||
// createdBy: [ |
|||
// { required: true, message: this.$t('validate.required'), trigger: 'blur' } |
|||
// ], |
|||
// createdTime: [ |
|||
// { required: true, message: this.$t('validate.required'), trigger: 'blur' } |
|||
// ], |
|||
// updatedBy: [ |
|||
// { required: true, message: this.$t('validate.required'), trigger: 'blur' } |
|||
// ], |
|||
// updatedTime: [ |
|||
// { required: true, message: this.$t('validate.required'), trigger: 'blur' } |
|||
// ] |
|||
} |
|||
} |
|||
}, |
|||
methods: { |
|||
init () { |
|||
this.visible = true |
|||
this.$nextTick(() => { |
|||
this.$refs['dataForm'].resetFields() |
|||
this.getcategoryList().then(() => { |
|||
this.categoryListTreeSetDefaultHandle() |
|||
if (this.dataForm.id) { |
|||
this.getInfo() |
|||
} |
|||
if (this.dataForm.id) { |
|||
} else { |
|||
this.dataForm.categoryCode = '' |
|||
} |
|||
}) |
|||
}) |
|||
}, |
|||
categoryListTreeCurrentChangeHandle (data) { |
|||
this.dataForm.pid = data.id |
|||
this.dataForm.parentName = data.typeName |
|||
this.categoryListVisible = false |
|||
}, |
|||
getcategoryList () { |
|||
return this.$http.get('/news/moduletype/getList').then(({ data: res }) => { |
|||
if (res.code !== 0) { |
|||
return this.$message.error(res.msg) |
|||
} |
|||
this.categoryList = res.data |
|||
}).catch(() => { }) |
|||
}, |
|||
categoryListTreeCurrentChangeHandle (data) { |
|||
this.dataForm.pid = data.id |
|||
this.dataForm.parentName = data.typeName |
|||
this.categoryListVisible = false |
|||
}, |
|||
// 获取信息 |
|||
getInfo () { |
|||
this.$http.get(`/news/moduletype/${this.dataForm.id}`).then(({ data: res }) => { |
|||
if (res.code !== 0) { |
|||
return this.$message.error(res.msg) |
|||
} |
|||
this.dataForm = { |
|||
...this.dataForm, |
|||
...res.data |
|||
} |
|||
if (this.dataForm.pid === '0') { |
|||
return this.categoryListTreeSetDefaultHandle() |
|||
} |
|||
this.$refs.categoryListTree.setCurrentKey(this.dataForm.pid) |
|||
}).catch(() => {}) |
|||
}, |
|||
categoryListTreeSetDefaultHandle () { |
|||
this.dataForm.pid = '0' |
|||
this.dataForm.parentName = '一级分类' |
|||
}, |
|||
// 表单提交 |
|||
dataFormSubmitHandle: debounce(function () { |
|||
this.$refs['dataForm'].validate((valid) => { |
|||
if (!valid) { |
|||
return false |
|||
} |
|||
this.$http[!this.dataForm.id ? 'post' : 'put']('/news/moduletype/', this.dataForm).then(({ data: res }) => { |
|||
if (res.code !== 0) { |
|||
return this.$message.error(res.msg) |
|||
} |
|||
this.$message({ |
|||
message: this.$t('prompt.success'), |
|||
type: 'success', |
|||
duration: 500, |
|||
onClose: () => { |
|||
this.visible = false |
|||
this.$emit('refreshDataList') |
|||
} |
|||
}) |
|||
}).catch(() => {}) |
|||
}) |
|||
}, 1000, { 'leading': true, 'trailing': false }) |
|||
} |
|||
} |
|||
</script> |
@ -0,0 +1,77 @@ |
|||
<template> |
|||
<el-card shadow="never" class="aui-card--fill"> |
|||
<div class="mod-news__moduletype}"> |
|||
<el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()"> |
|||
<el-form-item> |
|||
<el-input v-model="dataForm.id" placeholder="id" clearable></el-input> |
|||
</el-form-item> |
|||
<el-form-item> |
|||
<el-button @click="getDataList()">{{ $t('query') }}</el-button> |
|||
</el-form-item> |
|||
<el-form-item> |
|||
<el-button v-if="$hasPermission('news:moduletype:save')" type="primary" @click="addOrUpdateHandle()">{{ $t('add') }}</el-button> |
|||
</el-form-item> |
|||
<el-form-item> |
|||
<el-button v-if="$hasPermission('news:moduletype:delete')" type="danger" @click="deleteHandle()">{{ $t('deleteBatch') }}</el-button> |
|||
</el-form-item> |
|||
</el-form> |
|||
<el-table v-loading="dataListLoading" :data="dataList" border @selection-change="dataListSelectionChangeHandle" style="width: 100%;"> |
|||
<el-table-column type="selection" header-align="center" align="center" width="50"></el-table-column> |
|||
<el-table-column prop="id" label="标识号" header-align="center" align="center"></el-table-column> |
|||
<el-table-column prop="pid" label="上级ID" header-align="center" align="center"></el-table-column> |
|||
<el-table-column prop="pids" label="所有上级ID 逗号分隔" header-align="center" align="center"></el-table-column> |
|||
<el-table-column prop="typeName" label="类别名称" header-align="center" align="center"></el-table-column> |
|||
<el-table-column prop="typeCode" label="类别编码" header-align="center" align="center"></el-table-column> |
|||
<el-table-column prop="sort" label="排序" header-align="center" align="center"></el-table-column> |
|||
<el-table-column prop="bannerFlag" label="启用标识 0-否,1-是" header-align="center" align="center"></el-table-column> |
|||
<el-table-column prop="delFlag" label="删除标识 0-否,1-是" header-align="center" align="center"></el-table-column> |
|||
<el-table-column prop="revision" label="乐观锁" header-align="center" align="center"></el-table-column> |
|||
<el-table-column prop="createdBy" label="创建人" header-align="center" align="center"></el-table-column> |
|||
<el-table-column prop="createdTime" label="创建时间" header-align="center" align="center"></el-table-column> |
|||
<el-table-column prop="updatedBy" label="更新人" header-align="center" align="center"></el-table-column> |
|||
<el-table-column prop="updatedTime" label="更新时间" header-align="center" align="center"></el-table-column> |
|||
<el-table-column :label="$t('handle')" fixed="right" header-align="center" align="center" width="150"> |
|||
<template slot-scope="scope"> |
|||
<el-button v-if="$hasPermission('news:moduletype:update')" type="text" size="small" @click="addOrUpdateHandle(scope.row.id)">{{ $t('update') }}</el-button> |
|||
<el-button v-if="$hasPermission('news:moduletype:delete')" type="text" size="small" @click="deleteHandle(scope.row.id)">{{ $t('delete') }}</el-button> |
|||
</template> |
|||
</el-table-column> |
|||
</el-table> |
|||
<el-pagination |
|||
:current-page="page" |
|||
:page-sizes="[10, 20, 50, 100]" |
|||
:page-size="limit" |
|||
:total="total" |
|||
layout="total, sizes, prev, pager, next, jumper" |
|||
@size-change="pageSizeChangeHandle" |
|||
@current-change="pageCurrentChangeHandle"> |
|||
</el-pagination> |
|||
<!-- 弹窗, 新增 / 修改 --> |
|||
<add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update> |
|||
</div> |
|||
</el-card> |
|||
</template> |
|||
|
|||
<script> |
|||
import mixinViewModule from '@/mixins/view-module' |
|||
import AddOrUpdate from './moduletype-add-or-update' |
|||
export default { |
|||
mixins: [mixinViewModule], |
|||
data () { |
|||
return { |
|||
mixinViewModuleOptions: { |
|||
getDataListURL: '/news/moduletype/page', |
|||
getDataListIsPage: true, |
|||
deleteURL: '/news/moduletype', |
|||
deleteIsBatch: true |
|||
}, |
|||
dataForm: { |
|||
id: '' |
|||
} |
|||
} |
|||
}, |
|||
components: { |
|||
AddOrUpdate |
|||
} |
|||
} |
|||
</script> |
@ -0,0 +1,53 @@ |
|||
<template> |
|||
<el-card shadow="never" class="aui-card--fill"> |
|||
<div class="mod-sys__dept"> |
|||
<el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()"> |
|||
<el-form-item> |
|||
<el-button v-if="$hasPermission('events:category:save')" type="primary" @click="addOrUpdateHandle()">{{ $t('add') }}</el-button> |
|||
</el-form-item> |
|||
</el-form> |
|||
<el-table v-loading="dataListLoading" :data="dataList" border style="width: 100%;"> |
|||
<table-tree-column prop="typeName" :label="$t('dept.name')" header-align="center"></table-tree-column> |
|||
<el-table-column prop="parentName" :label="$t('dept.parentName')" header-align="center" align="center"></el-table-column> |
|||
<el-table-column prop="sort" :label="$t('dept.sort')" header-align="center" align="center" width="80"></el-table-column> |
|||
<el-table-column :label="$t('handle')" fixed="right" header-align="center" align="center" width="150"> |
|||
<template slot-scope="scope"> |
|||
<el-button type="text" size="small" @click="addOrUpdateHandle(scope.row.id)">{{ $t('update') }}</el-button> |
|||
<el-button type="text" size="small" @click="deleteHandle(scope.row.id)">{{ $t('delete') }}</el-button> |
|||
</template> |
|||
</el-table-column> |
|||
</el-table> |
|||
<!-- 弹窗, 新增 / 修改 --> |
|||
<add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update> |
|||
</div> |
|||
</el-card> |
|||
</template> |
|||
|
|||
<script> |
|||
import mixinViewModule from '@/mixins/view-module' |
|||
import TableTreeColumn from '@/components/table-tree-column' |
|||
import AddOrUpdate from './moduletype-add-or-update' |
|||
import Cookies from 'js-cookie' |
|||
export default { |
|||
mixins: [mixinViewModule], |
|||
data () { |
|||
return { |
|||
mixinViewModuleOptions: { |
|||
getDataListURL: '/news/moduletype/getList', |
|||
deleteURL: '/news/moduletype' |
|||
}, |
|||
upLoadUrl: '' |
|||
} |
|||
}, |
|||
components: { |
|||
TableTreeColumn, |
|||
AddOrUpdate |
|||
}, |
|||
created: function () { |
|||
|
|||
}, |
|||
methods: { |
|||
|
|||
} |
|||
} |
|||
</script> |
@ -0,0 +1,346 @@ |
|||
<template> |
|||
<el-dialog :visible.sync="visible" |
|||
:title="!dataForm.id ? $t('add') : $t('update')" |
|||
:close-on-click-modal="false" |
|||
:close-on-press-escape="false"> |
|||
<el-form :model="dataForm" |
|||
:rules="dataRule" |
|||
ref="dataForm" |
|||
:label-width="$i18n.locale === 'en-US' ? '120px' : '80px'"> |
|||
<el-form-item label="所属部门" |
|||
prop="allDeptIdsShow"> |
|||
<el-cascader v-model="dataForm.allDeptIdsShow" |
|||
:options="options" |
|||
:props="{ multiple: true }" |
|||
clearable |
|||
collapse-tags></el-cascader> |
|||
</el-form-item> |
|||
<el-form-item label="栏目" prop="allTypeId"> |
|||
<el-cascader v-model="dataForm.allTypeId" :options="moduleOptions" @change="changeHandle" |
|||
:props="{ checkStrictly: true, multiple: false, emitPath: true }" |
|||
clearable> |
|||
</el-cascader> |
|||
</el-form-item> |
|||
<el-form-item label="置顶" prop="topFlag"> |
|||
<el-select v-model="dataForm.topFlag" clearable placeholder="置顶状态"> |
|||
<el-option v-for="item in topFlagList" :key="item.dictValue" :label="item.dictName" :value="item.dictValue"> |
|||
</el-option> |
|||
</el-select> |
|||
</el-form-item> |
|||
<el-form-item label="上下架" prop="noticeUpDownState"> |
|||
<el-select v-model="dataForm.noticeUpDownState" clearable placeholder="上下架状态"> |
|||
<el-option v-for="item in noticeUpDownStateList" :key="item.dictValue" :label="item.dictName" :value="item.dictValue"> |
|||
</el-option> |
|||
</el-select> |
|||
</el-form-item> |
|||
<el-form-item label="标题" |
|||
prop="noticeTitle"> |
|||
<el-input v-model="dataForm.noticeTitle" |
|||
maxlength="50" |
|||
show-word-limit |
|||
placeholder="标题"></el-input> |
|||
</el-form-item> |
|||
<el-form-item prop="noticeContent" |
|||
label="内容"> |
|||
<el-row style="height: 550px;"> |
|||
<!-- 富文本编辑器, 容器 --> |
|||
<div id="J_quillEditor" class="ql-editor" |
|||
style="height: 500px;"></div> |
|||
</el-row> |
|||
<!-- 自定义上传图片功能 (使用element upload组件) --> |
|||
<el-upload :action="uploadUrl" |
|||
:show-file-list="false" |
|||
:before-upload="uploadBeforeUploadHandle" |
|||
:on-success="uploadSuccessHandle" |
|||
style="display: none;"> |
|||
<el-button ref="uploadBtn" |
|||
type="primary" |
|||
size="small">{{ $t('upload.button') }}</el-button> |
|||
</el-upload> |
|||
</el-form-item> |
|||
</el-form> |
|||
<template slot="footer"> |
|||
<el-button @click="visible = false">{{ $t('cancel') }}</el-button> |
|||
<el-button type="primary" |
|||
@click="dataFormSubmitHandle()">{{ $t('confirm') }}</el-button> |
|||
</template> |
|||
</el-dialog> |
|||
</template> |
|||
|
|||
<script> |
|||
import Cookies from 'js-cookie' |
|||
import debounce from 'lodash/debounce' |
|||
import 'quill/dist/quill.snow.css' |
|||
import Quill from 'quill' |
|||
export default { |
|||
data () { |
|||
return { |
|||
visible: false, |
|||
dataForm: { |
|||
id: '', |
|||
streetId: null, |
|||
street: null, |
|||
communityId: null, |
|||
community: null, |
|||
gridId: null, |
|||
grid: null, |
|||
noticeTitle: '', |
|||
noticeContent: '', |
|||
allDeptIdsShow: [], |
|||
allTypeId:[], |
|||
typeId:'', |
|||
topFlag:'', |
|||
noticeUpDownStateList:'' |
|||
}, |
|||
value: '', |
|||
// 富文本 |
|||
quillEditor: null, |
|||
quillEditorToolbarOptions: [ |
|||
['bold', 'italic', 'underline', 'strike'], |
|||
['image'], |
|||
[{ 'header': 1 }, { 'header': 2 }], |
|||
[{ 'list': 'ordered' }, { 'list': 'bullet' }], |
|||
[{ 'script': 'sub' }, { 'script': 'super' }], |
|||
[{ 'indent': '-1' }, { 'indent': '+1' }], |
|||
[{ 'size': ['small', false, 'large', 'huge'] }], |
|||
[{ 'header': [1, 2, 3, 4, 5, 6, false] }], |
|||
[{ 'color': [] }, { 'background': [] }], |
|||
[{ 'font': [] }], |
|||
[{ 'align': [] }], |
|||
['clean'] |
|||
], |
|||
uploadUrl: '', |
|||
// 富文本end |
|||
streetList: [], |
|||
communityList: [], |
|||
gridList: [], |
|||
options: [], |
|||
moduleOptions:[], |
|||
topFlagList: [ |
|||
{dictValue: '0', dictName: '否'}, |
|||
{dictValue: '1', dictName: '是'}, |
|||
], |
|||
noticeUpDownStateList: [ |
|||
{dictValue: '0', dictName: '下架'}, |
|||
{dictValue: '1', dictName: '上架'}, |
|||
] |
|||
} |
|||
}, |
|||
computed: { |
|||
dataRule () { |
|||
return { |
|||
topFlag: [ |
|||
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } |
|||
], |
|||
allTypeId: [ |
|||
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } |
|||
], |
|||
noticeUpDownState: [ |
|||
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } |
|||
], |
|||
streetId: [ |
|||
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } |
|||
], |
|||
allDeptIdsShow: [ |
|||
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } |
|||
], |
|||
noticeTitle: [ |
|||
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } |
|||
], |
|||
noticeContent: [ |
|||
{ required: true, message: this.$t(' ') } |
|||
] |
|||
} |
|||
} |
|||
}, |
|||
created () { |
|||
|
|||
this.$http |
|||
.get(`/sys/user/deptOptions/getAllByLoginUser`) |
|||
.then(({ data: res }) => { |
|||
if (res.code !== 0) { |
|||
return this.$message.error(res.msg) |
|||
} |
|||
this.options = res.data.options |
|||
}) |
|||
.catch(() => { }) |
|||
// 1169154711480528897 为榆山区部门ID |
|||
this.getDeptInfoList('street', localStorage.getItem('street') === null ? '1169154711480528897' : localStorage.getItem('street')) |
|||
}, |
|||
methods: { |
|||
changeHandle(value){ |
|||
this.dataForm.typeId = this.dataForm.allTypeId[value.length-1] |
|||
}, |
|||
//获取栏目分类 |
|||
getModuleTypeInfo() { |
|||
this.$http.get(`news/moduletype/getModuleListByRole`).then(({data: res}) => { |
|||
this.moduleOptions = res.data.moduleOptions |
|||
}).catch(() => { |
|||
}) |
|||
}, |
|||
// 富文本编辑器 |
|||
quillEditorHandle () { |
|||
this.quillEditor = new Quill('#J_quillEditor', { |
|||
modules: { |
|||
toolbar: this.quillEditorToolbarOptions |
|||
}, |
|||
theme: 'snow' |
|||
}) |
|||
// // 自定义上传图片功能 (使用element upload组件) |
|||
this.quillEditor.getModule('toolbar').addHandler('image', () => { |
|||
this.$refs.uploadBtn.$el.click() |
|||
}) |
|||
// 监听内容变化,动态赋值 |
|||
this.quillEditor.on('text-change', () => { |
|||
this.dataForm.noticeContent = this.quillEditor.root.innerHTML |
|||
if ((this.dataForm.noticeContent).length > 10000) { |
|||
return this.$message.error('您输入的的内容已超过字数不能提交') |
|||
} |
|||
}) |
|||
}, |
|||
// 上传图片之前 (富文本) |
|||
uploadBeforeUploadHandle (file) { |
|||
if (file.type !== 'image/jpg' && file.type !== 'image/jpeg' && file.type !== 'image/png' && file.type !== 'image/gif') { |
|||
this.$message.error(this.$t('upload.tip', { 'format': 'jpg、png、gif' })) |
|||
return false |
|||
} |
|||
}, |
|||
// 上传图片成功 (富文本) |
|||
uploadSuccessHandle (res, file, fileList) { |
|||
if (res.code !== 0) { |
|||
return this.$message.error(res.msg) |
|||
} |
|||
this.quillEditor.insertEmbed(this.quillEditor.getSelection().index, 'image', res.data.url) |
|||
}, |
|||
init () { |
|||
this.getModuleTypeInfo() |
|||
this.visible = true |
|||
this.$nextTick(() => { |
|||
this.dataForm.communityId = this.dataForm.streetId = this.dataForm.gridId = null |
|||
this.communityList = this.gridList = [] |
|||
// 富文本 |
|||
this.hideUpload = false |
|||
this.uploadUrl = `${window.SITE_CONFIG['apiURL']}/oss/file/upload?token=${Cookies.get('token')}` |
|||
if (this.quillEditor) { |
|||
this.quillEditor.deleteText(0, this.quillEditor.getLength()) |
|||
} else { |
|||
this.quillEditorHandle() |
|||
} |
|||
// 富文本end |
|||
this.$refs['dataForm'].resetFields() |
|||
if (this.dataForm.id) { |
|||
this.getInfo() |
|||
} else { |
|||
this.dataForm = {} |
|||
} |
|||
}) |
|||
}, |
|||
// 获取信息 |
|||
getInfo () { |
|||
this.$http.get(`/news/notice/${this.dataForm.id}`).then(({ data: res }) => { |
|||
if (res.code !== 0) { |
|||
return this.$message.error(res.msg) |
|||
} |
|||
this.dataForm = { ...this.dataForm, ...res.data } |
|||
this.quillEditor.root.innerHTML = res.data.noticeContent |
|||
if (this.dataForm.streetId) { |
|||
if (this.dataForm.communityId === 0) { |
|||
this.dataForm.communityId = this.dataForm.gridId = null |
|||
} |
|||
this.getDeptInfoList('community', this.dataForm.streetId) |
|||
} |
|||
if (this.dataForm.communityId) { |
|||
if (this.dataForm.gridId === 0) { |
|||
this.dataForm.gridId = null |
|||
} |
|||
this.getDeptInfoList('grid', this.dataForm.communityId) |
|||
} |
|||
}).catch(() => { }) |
|||
}, |
|||
removeHTMLTag (str) { |
|||
str = str.replace('<p><br></p>', '') |
|||
str = str.replace(/<\/?[^>]*>/g, '') // 去除HTML tag |
|||
str = str.replace(/[ | ]*\n/g, '\n') // 去除行尾空白 |
|||
str = str.replace(/ /ig, '') // 去掉 |
|||
return str |
|||
}, |
|||
// 表单提交 |
|||
dataFormSubmitHandle: debounce(function () { |
|||
console.log(this.dataForm.noticeContent) |
|||
if (this.dataForm.noticeContent != null && this.dataForm.noticeContent !== undefined) { |
|||
this.dataForm.noticeContent = this.removeHTMLTag(this.dataForm.noticeContent) |
|||
if ((this.dataForm.noticeContent).length > 10000) { |
|||
return this.$message.error('您输入的的内容已超过字数不能提交') |
|||
} else if (this.dataForm.noticeContent.length === 0) { |
|||
return this.$message.error('内容不能空') |
|||
} |
|||
} else { |
|||
return this.$message.error('内容不能为空') |
|||
} |
|||
this.$refs['dataForm'].validate((valid) => { |
|||
if (!valid) { |
|||
return false |
|||
} |
|||
this.$http[!this.dataForm.id ? 'post' : 'put']('/news/notice/saveOrUpContent', this.dataForm).then(({ data: res }) => { |
|||
if (res.code !== 0) { |
|||
return this.$message.error(res.msg) |
|||
} |
|||
this.$message({ |
|||
message: this.$t('prompt.success'), |
|||
type: 'success', |
|||
duration: 500, |
|||
onClose: () => { |
|||
this.visible = false |
|||
this.$emit('refreshDataList') |
|||
} |
|||
}) |
|||
}).catch(() => { }) |
|||
}) |
|||
}, 1000, { 'leading': true, 'trailing': false }), |
|||
// 获取部门列表 |
|||
getDeptInfoList (dataReceiver, faDeptId) { |
|||
this.$http.get(`/sys/dept/sublist/` + faDeptId).then(({ data: res }) => { |
|||
if (res.code !== 0) { |
|||
return this.$message.error(res.msg) |
|||
} |
|||
if (dataReceiver === 'street') { |
|||
this.streetList = res.data |
|||
} else if (dataReceiver === 'community') { |
|||
this.communityList = res.data |
|||
} else if (dataReceiver === 'grid') { |
|||
this.gridList = res.data |
|||
} |
|||
}).catch(() => { }) |
|||
}, |
|||
changeStreet () { |
|||
// 给街道变量赋值 |
|||
let choosenItem = this.streetList.filter(item => item.id === this.dataForm.streetId)[0] |
|||
this.dataForm.street = choosenItem.name |
|||
// 清空社区与网格的变量值 |
|||
this.dataForm.communityId = this.dataForm.gridId = this.dataForm.community = this.dataForm.grid = null |
|||
this.communityList = this.gridList = [] |
|||
// 获取街道下属社区 |
|||
this.getDeptInfoList('community', this.dataForm.streetId) |
|||
}, |
|||
changeCommunity () { |
|||
// 给社区变量赋值 |
|||
let choosenItem = this.communityList.filter(item => item.id === this.dataForm.communityId)[0] |
|||
this.dataForm.community = choosenItem.name |
|||
// 情况网格的变量值 |
|||
this.dataForm.gridId = this.dataForm.grid = null |
|||
this.gridList = [] |
|||
// 获取社区下属网格 |
|||
this.getDeptInfoList('grid', this.dataForm.communityId) |
|||
}, |
|||
changeGrid (item) { |
|||
console.log(item) |
|||
// 给网格变量赋值 |
|||
// let choosenItem = this.gridList.filter(item => item.id === this.dataForm.gridId)[0] |
|||
// this.dataForm.grid = choosenItem.name |
|||
// this.dataForm = Object.assign(this.dataForm, { gridId: item }) |
|||
console.log(this.dataForm) |
|||
} |
|||
|
|||
} |
|||
} |
|||
</script> |
@ -0,0 +1,181 @@ |
|||
<template> |
|||
<el-card shadow="never" |
|||
class="aui-card--fill"> |
|||
<div class="mod-news__notice}"> |
|||
<el-form :inline="true" |
|||
:model="dataForm" |
|||
@keyup.enter.native="getDataList()"> |
|||
<el-form-item> |
|||
<el-input v-model="dataForm.noticeTitle" |
|||
placeholder="标题" |
|||
clearable></el-input> |
|||
</el-form-item> |
|||
<el-form-item> |
|||
<el-button @click="getDataList()">{{ $t('query') }}</el-button> |
|||
</el-form-item> |
|||
<el-form-item> |
|||
<el-button v-if="$hasPermission('news:notice:save')" |
|||
type="primary" |
|||
@click="addOrUpdateHandle()">{{ $t('add') }}</el-button> |
|||
</el-form-item> |
|||
<el-form-item> |
|||
<el-button v-if="$hasPermission('news:notice:delete')" |
|||
type="danger" |
|||
@click="deleteHandle()">{{ $t('deleteBatch') }}</el-button> |
|||
</el-form-item> |
|||
</el-form> |
|||
<el-table v-loading="dataListLoading" |
|||
:data="dataList" |
|||
border |
|||
@selection-change="dataListSelectionChangeHandle" |
|||
style="width: 100%;"> |
|||
<el-table-column type="selection" |
|||
header-align="center" |
|||
align="center"></el-table-column> |
|||
<el-table-column type="index" |
|||
width="50" |
|||
label="序号" align="center"></el-table-column> |
|||
<el-table-column prop="noticeTitle" |
|||
label="标题" |
|||
header-align="center" |
|||
align="left" |
|||
min-width="400px" |
|||
show-overflow-tooltip></el-table-column> |
|||
<el-table-column prop="typeName" |
|||
label="所属栏目" |
|||
header-align="center" |
|||
align="center" |
|||
min-width="130px" |
|||
show-overflow-tooltip></el-table-column> |
|||
<el-table-column prop="deptName" |
|||
label="所属网格" |
|||
header-align="center" |
|||
min-width="150px" |
|||
align="center"></el-table-column> |
|||
<!-- <el-table-column prop="readingAmount"--> |
|||
<!-- label="阅读量"--> |
|||
<!-- header-align="center"--> |
|||
<!-- align="center"--> |
|||
<!-- width="80"></el-table-column>--> |
|||
<el-table-column prop="creatorName" |
|||
label="创建人" |
|||
header-align="center" |
|||
width="100px" |
|||
align="center"></el-table-column> |
|||
<el-table-column prop="createdTime" |
|||
label="创建时间" |
|||
header-align="center" |
|||
width="180px" |
|||
align="center"></el-table-column> |
|||
<!-- <el-table-column prop="noticeReleaseState"--> |
|||
<!-- label="已发布"--> |
|||
<!-- header-align="center"--> |
|||
<!-- :formatter="showIsPublishFormatter"--> |
|||
<!-- align="center"--> |
|||
<!-- width="70"></el-table-column>--> |
|||
<!-- <el-table-column prop="releaseTime"--> |
|||
<!-- label="发布时间"--> |
|||
<!-- width="180"--> |
|||
<!-- header-align="center"--> |
|||
<!-- align="center"></el-table-column>--> |
|||
<el-table-column :label="$t('handle')" |
|||
fixed="right" |
|||
header-align="center" |
|||
align="center" |
|||
width="150"> |
|||
<template slot-scope="scope"> |
|||
<el-button v-if="$hasPermission('news:notice:publish') && scope.row.noticeReleaseState === '0'" |
|||
type="text" |
|||
size="small" |
|||
@click="noticePublishHandle(scope.row.id)">发布</el-button> |
|||
<el-button v-if="$hasPermission('news:notice:update')" |
|||
type="text" |
|||
size="small" |
|||
@click="addOrUpdateHandle(scope.row.id)">{{ $t('update') }}</el-button> |
|||
<el-button v-if="$hasPermission('news:notice:delete')" |
|||
type="text" |
|||
size="small" |
|||
@click="deleteHandle(scope.row.id)">{{ $t('delete') }}</el-button> |
|||
</template> |
|||
</el-table-column> |
|||
</el-table> |
|||
<el-pagination :current-page="page" |
|||
:page-sizes="[10, 20, 50, 100]" |
|||
:page-size="limit" |
|||
:total="total" |
|||
layout="total, sizes, prev, pager, next, jumper" |
|||
@size-change="pageSizeChangeHandle" |
|||
@current-change="pageCurrentChangeHandle"> |
|||
</el-pagination> |
|||
<!-- 弹窗, 新增 / 修改 --> |
|||
<add-or-update v-if="addOrUpdateVisible" |
|||
ref="addOrUpdate" |
|||
@refreshDataList="getDataList"></add-or-update> |
|||
</div> |
|||
</el-card> |
|||
</template> |
|||
|
|||
<script> |
|||
import mixinViewModule from '@/mixins/view-module' |
|||
import AddOrUpdate from './noticeadmin-add-or-update' |
|||
export default { |
|||
mixins: [mixinViewModule], |
|||
data () { |
|||
return { |
|||
mixinViewModuleOptions: { |
|||
getDataListURL: '/news/notice/modulePage', |
|||
getDataListIsPage: true, |
|||
deleteURL: '/news/notice', |
|||
deleteIsBatch: true |
|||
}, |
|||
dataForm: { |
|||
noticeTitle: '' |
|||
} |
|||
} |
|||
}, |
|||
components: { |
|||
AddOrUpdate |
|||
}, |
|||
methods: { |
|||
// 发布 |
|||
noticePublishHandle (id) { |
|||
this.$confirm(this.$t('prompt.info', { 'handle': '发布' }), this.$t('发布'), { |
|||
confirmButtonText: this.$t('confirm'), |
|||
cancelButtonText: this.$t('cancel'), |
|||
type: 'warning' |
|||
}).then(() => { |
|||
this.$http.post(`/news/notice/publish/${id}`).then(({ data: res }) => { |
|||
if (res.code !== 0) { |
|||
return this.$message.error(res.msg) |
|||
} |
|||
this.$message({ |
|||
message: this.$t('prompt.success'), |
|||
type: 'success', |
|||
duration: 500, |
|||
onClose: () => { |
|||
this.getDataList() |
|||
} |
|||
}) |
|||
}).catch(() => { }) |
|||
}).catch(() => { }) |
|||
}, |
|||
showIsPublishFormatter: function (row, column) { |
|||
if (row.noticeReleaseState === '0') { |
|||
return '否' |
|||
} |
|||
return '是' |
|||
}, |
|||
showDeptNameFormatter: function (row, column) { |
|||
if (row.grid) { |
|||
return row.grid |
|||
} |
|||
if (row.community) { |
|||
return row.community |
|||
} |
|||
if (row.street) { |
|||
return row.street |
|||
} |
|||
} |
|||
} |
|||
} |
|||
</script> |
@ -0,0 +1,131 @@ |
|||
<template> |
|||
<el-dialog :visible.sync="visible" :title="!dataForm.id ? $t('add') : $t('update')" :close-on-click-modal="false" :close-on-press-escape="false"> |
|||
<el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmitHandle()" :label-width="$i18n.locale === 'en-US' ? '120px' : '80px'"> |
|||
<el-form-item label="角色ID" prop="roleId"> |
|||
<el-input v-model="dataForm.roleId" placeholder="角色ID"></el-input> |
|||
</el-form-item> |
|||
<el-form-item label="栏目ID" prop="moduleId"> |
|||
<el-input v-model="dataForm.moduleId" placeholder="栏目ID"></el-input> |
|||
</el-form-item> |
|||
<el-form-item label="删除标识 0-否,1-是" prop="delFlag"> |
|||
<el-input v-model="dataForm.delFlag" placeholder="删除标识 0-否,1-是"></el-input> |
|||
</el-form-item> |
|||
<el-form-item label="乐观锁" prop="revision"> |
|||
<el-input v-model="dataForm.revision" placeholder="乐观锁"></el-input> |
|||
</el-form-item> |
|||
<el-form-item label="创建人" prop="createdBy"> |
|||
<el-input v-model="dataForm.createdBy" placeholder="创建人"></el-input> |
|||
</el-form-item> |
|||
<el-form-item label="创建时间" prop="createdTime"> |
|||
<el-input v-model="dataForm.createdTime" placeholder="创建时间"></el-input> |
|||
</el-form-item> |
|||
<el-form-item label="更新人" prop="updatedBy"> |
|||
<el-input v-model="dataForm.updatedBy" placeholder="更新人"></el-input> |
|||
</el-form-item> |
|||
<el-form-item label="更新时间" prop="updatedTime"> |
|||
<el-input v-model="dataForm.updatedTime" placeholder="更新时间"></el-input> |
|||
</el-form-item> |
|||
</el-form> |
|||
<template slot="footer"> |
|||
<el-button @click="visible = false">{{ $t('cancel') }}</el-button> |
|||
<el-button type="primary" @click="dataFormSubmitHandle()">{{ $t('confirm') }}</el-button> |
|||
</template> |
|||
</el-dialog> |
|||
</template> |
|||
|
|||
<script> |
|||
import debounce from 'lodash/debounce' |
|||
export default { |
|||
data () { |
|||
return { |
|||
visible: false, |
|||
dataForm: { |
|||
id: '', |
|||
roleId: '', |
|||
moduleId: '', |
|||
delFlag: '', |
|||
revision: '', |
|||
createdBy: '', |
|||
createdTime: '', |
|||
updatedBy: '', |
|||
updatedTime: '' |
|||
} |
|||
} |
|||
}, |
|||
computed: { |
|||
dataRule () { |
|||
return { |
|||
roleId: [ |
|||
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } |
|||
], |
|||
moduleId: [ |
|||
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } |
|||
], |
|||
delFlag: [ |
|||
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } |
|||
], |
|||
revision: [ |
|||
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } |
|||
], |
|||
createdBy: [ |
|||
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } |
|||
], |
|||
createdTime: [ |
|||
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } |
|||
], |
|||
updatedBy: [ |
|||
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } |
|||
], |
|||
updatedTime: [ |
|||
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } |
|||
] |
|||
} |
|||
} |
|||
}, |
|||
methods: { |
|||
init () { |
|||
this.visible = true |
|||
this.$nextTick(() => { |
|||
this.$refs['dataForm'].resetFields() |
|||
if (this.dataForm.id) { |
|||
this.getInfo() |
|||
} |
|||
}) |
|||
}, |
|||
// 获取信息 |
|||
getInfo () { |
|||
this.$http.get(`/news/rolemodule/${this.dataForm.id}`).then(({ data: res }) => { |
|||
if (res.code !== 0) { |
|||
return this.$message.error(res.msg) |
|||
} |
|||
this.dataForm = { |
|||
...this.dataForm, |
|||
...res.data |
|||
} |
|||
}).catch(() => {}) |
|||
}, |
|||
// 表单提交 |
|||
dataFormSubmitHandle: debounce(function () { |
|||
this.$refs['dataForm'].validate((valid) => { |
|||
if (!valid) { |
|||
return false |
|||
} |
|||
this.$http[!this.dataForm.id ? 'post' : 'put']('/news/rolemodule/', this.dataForm).then(({ data: res }) => { |
|||
if (res.code !== 0) { |
|||
return this.$message.error(res.msg) |
|||
} |
|||
this.$message({ |
|||
message: this.$t('prompt.success'), |
|||
type: 'success', |
|||
duration: 500, |
|||
onClose: () => { |
|||
this.visible = false |
|||
this.$emit('refreshDataList') |
|||
} |
|||
}) |
|||
}).catch(() => {}) |
|||
}) |
|||
}, 1000, { 'leading': true, 'trailing': false }) |
|||
} |
|||
} |
|||
</script> |
@ -0,0 +1,73 @@ |
|||
<template> |
|||
<el-card shadow="never" class="aui-card--fill"> |
|||
<div class="mod-news__rolemodule}"> |
|||
<el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()"> |
|||
<el-form-item> |
|||
<el-input v-model="dataForm.id" placeholder="id" clearable></el-input> |
|||
</el-form-item> |
|||
<el-form-item> |
|||
<el-button @click="getDataList()">{{ $t('query') }}</el-button> |
|||
</el-form-item> |
|||
<el-form-item> |
|||
<el-button v-if="$hasPermission('news:rolemodule:save')" type="primary" @click="addOrUpdateHandle()">{{ $t('add') }}</el-button> |
|||
</el-form-item> |
|||
<el-form-item> |
|||
<el-button v-if="$hasPermission('news:rolemodule:delete')" type="danger" @click="deleteHandle()">{{ $t('deleteBatch') }}</el-button> |
|||
</el-form-item> |
|||
</el-form> |
|||
<el-table v-loading="dataListLoading" :data="dataList" border @selection-change="dataListSelectionChangeHandle" style="width: 100%;"> |
|||
<el-table-column type="selection" header-align="center" align="center" width="50"></el-table-column> |
|||
<el-table-column prop="id" label="标识号" header-align="center" align="center"></el-table-column> |
|||
<el-table-column prop="roleId" label="角色ID" header-align="center" align="center"></el-table-column> |
|||
<el-table-column prop="moduleId" label="栏目ID" header-align="center" align="center"></el-table-column> |
|||
<el-table-column prop="delFlag" label="删除标识 0-否,1-是" header-align="center" align="center"></el-table-column> |
|||
<el-table-column prop="revision" label="乐观锁" header-align="center" align="center"></el-table-column> |
|||
<el-table-column prop="createdBy" label="创建人" header-align="center" align="center"></el-table-column> |
|||
<el-table-column prop="createdTime" label="创建时间" header-align="center" align="center"></el-table-column> |
|||
<el-table-column prop="updatedBy" label="更新人" header-align="center" align="center"></el-table-column> |
|||
<el-table-column prop="updatedTime" label="更新时间" header-align="center" align="center"></el-table-column> |
|||
<el-table-column :label="$t('handle')" fixed="right" header-align="center" align="center" width="150"> |
|||
<template slot-scope="scope"> |
|||
<el-button v-if="$hasPermission('news:rolemodule:update')" type="text" size="small" @click="addOrUpdateHandle(scope.row.id)">{{ $t('update') }}</el-button> |
|||
<el-button v-if="$hasPermission('news:rolemodule:delete')" type="text" size="small" @click="deleteHandle(scope.row.id)">{{ $t('delete') }}</el-button> |
|||
</template> |
|||
</el-table-column> |
|||
</el-table> |
|||
<el-pagination |
|||
:current-page="page" |
|||
:page-sizes="[10, 20, 50, 100]" |
|||
:page-size="limit" |
|||
:total="total" |
|||
layout="total, sizes, prev, pager, next, jumper" |
|||
@size-change="pageSizeChangeHandle" |
|||
@current-change="pageCurrentChangeHandle"> |
|||
</el-pagination> |
|||
<!-- 弹窗, 新增 / 修改 --> |
|||
<add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update> |
|||
</div> |
|||
</el-card> |
|||
</template> |
|||
|
|||
<script> |
|||
import mixinViewModule from '@/mixins/view-module' |
|||
import AddOrUpdate from './rolemodule-add-or-update' |
|||
export default { |
|||
mixins: [mixinViewModule], |
|||
data () { |
|||
return { |
|||
mixinViewModuleOptions: { |
|||
getDataListURL: '/news/rolemodule/page', |
|||
getDataListIsPage: true, |
|||
deleteURL: '/news/rolemodule', |
|||
deleteIsBatch: true |
|||
}, |
|||
dataForm: { |
|||
id: '' |
|||
} |
|||
} |
|||
}, |
|||
components: { |
|||
AddOrUpdate |
|||
} |
|||
} |
|||
</script> |
@ -0,0 +1,358 @@ |
|||
<template> |
|||
<el-dialog :visible.sync="visible" :title="!dataForm.id ? $t('add') : $t('update')" :close-on-click-modal="false" :close-on-press-escape="false"> |
|||
<el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmitHandle()" :label-width="$i18n.locale === 'en-US' ? '140px' : '100px'"> |
|||
<el-form-item label="所属组织" prop="deptId"> |
|||
<el-cascader v-model="dataForm.allDeptIdArr" |
|||
:options="options" |
|||
ref="org" |
|||
:props="{ checkStrictly: true }" |
|||
@change="allDeptIdsChangeHandle" |
|||
style="width: 100%" |
|||
show-overflow-tooltip |
|||
clearable> |
|||
</el-cascader> |
|||
</el-form-item> |
|||
<el-form-item label="党组织类型" prop="typeCode"> |
|||
<el-select v-model="dataForm.typeCode" clearable |
|||
placeholder="请选择" style="width: 100%"> |
|||
<el-option v-for="item in orgTypeOptions" |
|||
:key="item.tagValue" |
|||
:label="item.tagName" |
|||
:value="item.tagValue"> |
|||
</el-option> |
|||
</el-select> |
|||
</el-form-item> |
|||
<el-form-item label="党组织名称" prop="partyOrgName"> |
|||
<el-input v-model="dataForm.partyOrgName" placeholder="党组织名称(20字以内)" maxlength="20" show-word-limit></el-input> |
|||
</el-form-item> |
|||
<el-form-item label="党组织介绍" prop="introduction"> |
|||
<el-input v-model="dataForm.introduction" type="textarea" autosize maxlength="500" show-word-limit placeholder="党组织介(500字以内)"></el-input> |
|||
</el-form-item> |
|||
<el-form-item label="两委干部" prop="twoCommittees"> |
|||
<el-input v-model="dataForm.twoCommittees" placeholder="两委干部" maxlength="100" show-word-limit></el-input> |
|||
</el-form-item> |
|||
<el-form-item label="党员数量" prop="partyMemberNum"> |
|||
<el-input-number v-model="dataForm.partyMemberNum" :min="0" :max="999990000"></el-input-number> |
|||
</el-form-item> |
|||
<el-form-item label="经度" prop="longitude"> |
|||
<el-input v-model="dataForm.longitude" :disabled = "true" placeholder="经度" style="width: 82%"></el-input>  |
|||
<el-button type="primary" |
|||
@click="mapSelectHandle(2)">地图选择</el-button> |
|||
</el-form-item> |
|||
<el-form-item label="纬度" prop="latitude"> |
|||
<el-input v-model="dataForm.latitude" :disabled = "true" placeholder="纬度"></el-input> |
|||
</el-form-item> |
|||
</el-form> |
|||
<template slot="footer"> |
|||
<el-button @click="visible = false">{{ $t('cancel') }}</el-button> |
|||
<el-button type="primary" @click="dataFormSubmitHandle()">{{ $t('confirm') }}</el-button> |
|||
</template> |
|||
<map-select v-if="mapSelectVisible" |
|||
ref="mapSelect" |
|||
v-on:position="position"></map-select> |
|||
</el-dialog> |
|||
</template> |
|||
|
|||
<script> |
|||
import debounce from 'lodash/debounce' |
|||
import MapSelect from './map-select' |
|||
export default { |
|||
data () { |
|||
return { |
|||
visible: false, |
|||
dataForm: { |
|||
id: '', |
|||
partyOrgName: '', |
|||
introduction: '', |
|||
twoCommittees: '', |
|||
partyMemberNum: '', |
|||
longitude: '', |
|||
latitude: '', |
|||
deptName: '', |
|||
deptId: '', |
|||
typeCode: '', |
|||
allDeptIdArr: [] |
|||
}, |
|||
orgTypeOptions: [], |
|||
options: [], |
|||
mapSelectVisible: false |
|||
} |
|||
}, |
|||
computed: { |
|||
dataRule () { |
|||
return { |
|||
partyOrgName: [ |
|||
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } |
|||
], |
|||
twoCommittees: [ |
|||
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } |
|||
], |
|||
partyMemberNum: [ |
|||
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } |
|||
], |
|||
longitude: [ |
|||
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } |
|||
], |
|||
latitude: [ |
|||
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } |
|||
], |
|||
deptId: [ |
|||
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } |
|||
], |
|||
typeCode: [ |
|||
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } |
|||
] |
|||
} |
|||
} |
|||
}, |
|||
components: { |
|||
MapSelect |
|||
}, |
|||
methods: { |
|||
init () { |
|||
this.visible = true |
|||
this.getOrgTypeOptions() |
|||
this.getOptions() |
|||
this.$nextTick(() => { |
|||
this.$refs['dataForm'].resetFields() |
|||
if (this.dataForm.id) { |
|||
this.getInfo() |
|||
} |
|||
}) |
|||
}, |
|||
// 获取党组织类型 |
|||
getOrgTypeOptions () { |
|||
this.$http |
|||
.get(`/sys/partyorgtype/getPartyOrgType`) |
|||
.then(({ data: res }) => { |
|||
if (res.code !== 0) { |
|||
return this.$message.error(res.msg) |
|||
} |
|||
this.orgTypeOptions = res.data |
|||
}) |
|||
.catch(() => { }) |
|||
}, |
|||
// 获取组织信息 |
|||
getOptions () { |
|||
this.$http.get(`/sys/user/deptOptions/getByLoginUser`).then(({ data: res }) => { |
|||
if (res.code !== 0) { |
|||
return this.$message.error(res.msg) |
|||
} |
|||
this.options = res.data.options |
|||
}).catch(() => { }) |
|||
}, |
|||
allDeptIdsChangeHandle (value, selectedData) { |
|||
this.dataForm.deptName = this.$refs['org'].getCheckedNodes()[0].label |
|||
this.dataForm.deptId = this.$refs['org'].getCheckedNodes()[0].value |
|||
}, |
|||
// 地图相关 |
|||
position (position) { |
|||
// this.dataForm.actAddress = position.address |
|||
this.dataForm.latitude = position.latitude |
|||
this.dataForm.longitude = position.longitude |
|||
this.mapSelectVisible = false |
|||
}, |
|||
mapSelectHandle (type) { |
|||
this.mapSelectVisible = true |
|||
this.$nextTick(() => { |
|||
this.$refs.mapSelect.init(type, 200) |
|||
}) |
|||
}, |
|||
// 获取信息 |
|||
getInfo () { |
|||
this.$http.get(`/sys/partyorg/${this.dataForm.id}`).then(({ data: res }) => { |
|||
if (res.code !== 0) { |
|||
return this.$message.error(res.msg) |
|||
} |
|||
this.dataForm = { |
|||
...this.dataForm, |
|||
...res.data |
|||
} |
|||
}).catch(() => {}) |
|||
}, |
|||
// 表单提交 |
|||
dataFormSubmitHandle: debounce(function () { |
|||
this.$refs['dataForm'].validate((valid) => { |
|||
if (!valid) { |
|||
return false |
|||
} |
|||
this.$http[!this.dataForm.id ? 'post' : 'put']('/sys/partyorg/', this.dataForm).then(({ data: res }) => { |
|||
if (res.code !== 0) { |
|||
return this.$message.error(res.msg) |
|||
} |
|||
this.$message({ |
|||
message: this.$t('prompt.success'), |
|||
type: 'success', |
|||
duration: 500, |
|||
onClose: () => { |
|||
this.visible = false |
|||
this.$emit('refreshDataList') |
|||
} |
|||
}) |
|||
}).catch(() => {}) |
|||
}) |
|||
}, 1000, { 'leading': true, 'trailing': false }) |
|||
} |
|||
} |
|||
</script> |
|||
<style> |
|||
.avatar-uploader .el-upload { |
|||
border: 1px dashed #d9d9d9; |
|||
border-radius: 6px; |
|||
cursor: pointer; |
|||
position: relative; |
|||
overflow: hidden; |
|||
} |
|||
.avatar-uploader .el-upload:hover { |
|||
border-color: #409eff; |
|||
} |
|||
.avatar-uploader-icon { |
|||
font-size: 28px; |
|||
color: #8c939d; |
|||
width: 178px; |
|||
height: 178px; |
|||
line-height: 178px; |
|||
text-align: center; |
|||
} |
|||
.avatar { |
|||
width: 178px; |
|||
height: 178px; |
|||
display: block; |
|||
} |
|||
</style> |
|||
<style lang="scss"> |
|||
.project-handle { |
|||
.el-timeline { |
|||
padding-left: 9px; |
|||
font-size: 13px; |
|||
} |
|||
.el-textarea { |
|||
width: 600px !important; |
|||
} |
|||
.el-input { |
|||
width: 600px !important; |
|||
} |
|||
} |
|||
.el-form-item__label { |
|||
font-weight: bold; |
|||
} |
|||
</style> |
|||
|
|||
<style lang="scss" scoped> |
|||
.project-handle { |
|||
width: 100%; |
|||
height: calc(100vh - 120px); |
|||
background: #ffffff; |
|||
box-sizing: border-box; |
|||
padding: 10px; |
|||
.project-detail { |
|||
width: 100%; |
|||
height: 49%; |
|||
border: 2px solid #ccc; |
|||
box-sizing: border-box; |
|||
padding: 10px; |
|||
padding-top: 20px; |
|||
float: left; |
|||
margin-bottom: 1%; |
|||
position: relative; |
|||
.project-detail-tip { |
|||
position: absolute; |
|||
top: 0; |
|||
left: 0; |
|||
width: 80px; |
|||
height: 30px; |
|||
line-height: 30px; |
|||
color: #ffffff; |
|||
background: #4ac38b; |
|||
text-align: center; |
|||
} |
|||
.el-form { |
|||
width: 58%; |
|||
height: 100%; |
|||
float: left; |
|||
overflow-y: auto; |
|||
&::-webkit-scrollbar { |
|||
width: 5px; |
|||
height: 1px; |
|||
} |
|||
&::-webkit-scrollbar-thumb { |
|||
border-radius: 5px; |
|||
background: #ccc; |
|||
} |
|||
&::-webkit-scrollbar-track { |
|||
border-radius: 10px; |
|||
background: #fff; |
|||
} |
|||
} |
|||
.container { |
|||
width: 40%; |
|||
height: 100%; |
|||
float: right; |
|||
.location { |
|||
height: 30px; |
|||
line-height: 30px; |
|||
} |
|||
#map { |
|||
width: 100%; |
|||
height: calc(100% - 30px); |
|||
} |
|||
} |
|||
} |
|||
.project-progress { |
|||
width: 20%; |
|||
height: 100%; |
|||
float: right; |
|||
border: 2px solid #ccc; |
|||
box-sizing: border-box; |
|||
margin-left: 1%; |
|||
padding-top: 20px; |
|||
overflow-y: auto; |
|||
&::-webkit-scrollbar { |
|||
width: 5px; |
|||
height: 1px; |
|||
} |
|||
&::-webkit-scrollbar-thumb { |
|||
border-radius: 5px; |
|||
background: #aaa; |
|||
} |
|||
&::-webkit-scrollbar-track { |
|||
border-radius: 10px; |
|||
background: #ccc; |
|||
} |
|||
} |
|||
.handle-operation { |
|||
padding-top: 30px; |
|||
box-sizing: border-box; |
|||
width: 100%; |
|||
height: 49%; |
|||
box-sizing: border-box; |
|||
border: 2px solid #ccc; |
|||
float: left; |
|||
position: relative; |
|||
overflow-y: auto; |
|||
&::-webkit-scrollbar { |
|||
width: 5px; |
|||
height: 1px; |
|||
} |
|||
&::-webkit-scrollbar-thumb { |
|||
border-radius: 5px; |
|||
background: #aaa; |
|||
} |
|||
&::-webkit-scrollbar-track { |
|||
border-radius: 10px; |
|||
background: #ccc; |
|||
} |
|||
.handle-operation-tip { |
|||
position: absolute; |
|||
top: 0; |
|||
left: 0; |
|||
width: 80px; |
|||
height: 30px; |
|||
line-height: 30px; |
|||
color: #ffffff; |
|||
background: #ff7600; |
|||
text-align: center; |
|||
} |
|||
} |
|||
} |
|||
</style> |
@ -0,0 +1,67 @@ |
|||
<template> |
|||
<el-card shadow="never" class="aui-card--fill"> |
|||
<div class="mod-sys__partyorg}"> |
|||
<el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()"> |
|||
<el-form-item> |
|||
<el-input v-model="dataForm.id" placeholder="id" clearable></el-input> |
|||
</el-form-item> |
|||
<el-form-item> |
|||
<el-button @click="getDataList()">{{ $t('query') }}</el-button> |
|||
</el-form-item> |
|||
<el-form-item> |
|||
<el-button v-if="$hasPermission('sys:partyorg:save')" type="primary" @click="addOrUpdateHandle()">{{ $t('add') }}</el-button> |
|||
</el-form-item> |
|||
<el-form-item> |
|||
<el-button v-if="$hasPermission('sys:partyorg:delete')" type="danger" @click="deleteHandle()">{{ $t('deleteBatch') }}</el-button> |
|||
</el-form-item> |
|||
</el-form> |
|||
<el-table v-loading="dataListLoading" :data="dataList" border @selection-change="dataListSelectionChangeHandle" style="width: 100%;"> |
|||
<el-table-column type="selection" header-align="center" align="center" width="50"></el-table-column> |
|||
<el-table-column prop="allDeptNames" label="所属组织" header-align="center" align="center"></el-table-column> |
|||
<el-table-column prop="partyOrgName" label="党组织名称" header-align="center" align="center"></el-table-column> |
|||
<el-table-column prop="typeName" label="党组织类型" header-align="center" align="center"></el-table-column> |
|||
<el-table-column :label="$t('handle')" fixed="right" header-align="center" align="center" width="150"> |
|||
<template slot-scope="scope"> |
|||
<el-button v-if="$hasPermission('sys:partyorg:update')" type="text" size="small" @click="addOrUpdateHandle(scope.row.id)">{{ $t('update') }}</el-button> |
|||
<el-button v-if="$hasPermission('sys:partyorg:delete')" type="text" size="small" @click="deleteHandle(scope.row.id)">{{ $t('delete') }}</el-button> |
|||
</template> |
|||
</el-table-column> |
|||
</el-table> |
|||
<el-pagination |
|||
:current-page="page" |
|||
:page-sizes="[10, 20, 50, 100]" |
|||
:page-size="limit" |
|||
:total="total" |
|||
layout="total, sizes, prev, pager, next, jumper" |
|||
@size-change="pageSizeChangeHandle" |
|||
@current-change="pageCurrentChangeHandle"> |
|||
</el-pagination> |
|||
<!-- 弹窗, 新增 / 修改 --> |
|||
<add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update> |
|||
</div> |
|||
</el-card> |
|||
</template> |
|||
|
|||
<script> |
|||
import mixinViewModule from '@/mixins/view-module' |
|||
import AddOrUpdate from './partyorg-add-or-update' |
|||
export default { |
|||
mixins: [mixinViewModule], |
|||
data () { |
|||
return { |
|||
mixinViewModuleOptions: { |
|||
getDataListURL: '/sys/partyorg/page', |
|||
getDataListIsPage: true, |
|||
deleteURL: '/sys/partyorg', |
|||
deleteIsBatch: true |
|||
}, |
|||
dataForm: { |
|||
id: '' |
|||
} |
|||
} |
|||
}, |
|||
components: { |
|||
AddOrUpdate |
|||
} |
|||
} |
|||
</script> |
@ -0,0 +1,117 @@ |
|||
<template> |
|||
<el-dialog :visible.sync="visible" :title="!dataForm.id ? $t('add') : $t('update')" :close-on-click-modal="false" :close-on-press-escape="false"> |
|||
<el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmitHandle()" :label-width="$i18n.locale === 'en-US' ? '160px' : '120px'"> |
|||
<el-form-item label="党组织类型名称" prop="typeName"> |
|||
<el-input v-model="dataForm.typeName" placeholder="类型名称"></el-input> |
|||
</el-form-item> |
|||
<el-form-item label="党组织类型编码" prop="typeCode"> |
|||
<el-input v-model="dataForm.typeCode" placeholder="类型编码" maxlength="30"></el-input> |
|||
</el-form-item> |
|||
<el-form-item label="排序" prop="sort"> |
|||
<el-input-number v-model="dataForm.sort" :min="0" :max="99990"></el-input-number> |
|||
</el-form-item> |
|||
<el-form-item label="启用标识" prop="enable"> |
|||
<el-select v-model="dataForm.enable" placeholder="是否启用" style="width: 100%;"> |
|||
<el-option |
|||
v-for="item in options" |
|||
:key="item.value" |
|||
:label="item.label" |
|||
:value="item.value"> |
|||
</el-option> |
|||
</el-select> |
|||
</el-form-item> |
|||
</el-form> |
|||
<template slot="footer"> |
|||
<el-button @click="visible = false">{{ $t('cancel') }}</el-button> |
|||
<el-button type="primary" @click="dataFormSubmitHandle()">{{ $t('confirm') }}</el-button> |
|||
</template> |
|||
</el-dialog> |
|||
</template> |
|||
|
|||
<script> |
|||
import debounce from 'lodash/debounce' |
|||
export default { |
|||
data () { |
|||
return { |
|||
visible: false, |
|||
dataForm: { |
|||
id: '', |
|||
typeName: '', |
|||
typeCode: '', |
|||
sort: '', |
|||
enable: '' |
|||
}, |
|||
options: [{ |
|||
value: '0', |
|||
label: '否' |
|||
}, { |
|||
value: '1', |
|||
label: '是' |
|||
}] |
|||
} |
|||
}, |
|||
computed: { |
|||
dataRule () { |
|||
return { |
|||
typeName: [ |
|||
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } |
|||
], |
|||
typeCode: [ |
|||
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } |
|||
], |
|||
sort: [ |
|||
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } |
|||
], |
|||
enable: [ |
|||
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } |
|||
] |
|||
} |
|||
} |
|||
}, |
|||
methods: { |
|||
init () { |
|||
this.visible = true |
|||
this.$nextTick(() => { |
|||
this.$refs['dataForm'].resetFields() |
|||
if (this.dataForm.id) { |
|||
this.getInfo() |
|||
} |
|||
}) |
|||
}, |
|||
// 获取信息 |
|||
getInfo () { |
|||
this.$http.get(`/sys/partyorgtype/${this.dataForm.id}`).then(({ data: res }) => { |
|||
if (res.code !== 0) { |
|||
return this.$message.error(res.msg) |
|||
} |
|||
this.dataForm = { |
|||
...this.dataForm, |
|||
...res.data |
|||
} |
|||
}).catch(() => {}) |
|||
}, |
|||
// 表单提交 |
|||
dataFormSubmitHandle: debounce(function () { |
|||
this.$refs['dataForm'].validate((valid) => { |
|||
if (!valid) { |
|||
return false |
|||
} |
|||
this.$http[!this.dataForm.id ? 'post' : 'put']('/sys/partyorgtype/', this.dataForm).then(({ data: res }) => { |
|||
if (res.code !== 0) { |
|||
return this.$message.error(res.msg) |
|||
} |
|||
this.$message({ |
|||
message: this.$t('prompt.success'), |
|||
type: 'success', |
|||
duration: 500, |
|||
onClose: () => { |
|||
this.visible = false |
|||
this.$emit('refreshDataList') |
|||
} |
|||
}) |
|||
}).catch(() => {}) |
|||
}) |
|||
}, 1000, { 'leading': true, 'trailing': false }) |
|||
} |
|||
} |
|||
</script> |
@ -0,0 +1,73 @@ |
|||
<template> |
|||
<el-card shadow="never" class="aui-card--fill"> |
|||
<div class="mod-sys__partyorgtype}"> |
|||
<el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()"> |
|||
<el-form-item> |
|||
<el-button v-if="$hasPermission('sys:partyorgtype:save')" type="primary" @click="addOrUpdateHandle()">{{ $t('add') }}</el-button> |
|||
</el-form-item> |
|||
<el-form-item> |
|||
<el-button v-if="$hasPermission('sys:partyorgtype:delete')" type="danger" @click="deleteHandle()">{{ $t('deleteBatch') }}</el-button> |
|||
</el-form-item> |
|||
</el-form> |
|||
<el-table v-loading="dataListLoading" :data="dataList" border @selection-change="dataListSelectionChangeHandle" style="width: 100%;"> |
|||
<el-table-column type="selection" header-align="center" align="center" width="50"></el-table-column> |
|||
<el-table-column prop="typeName" label="党组织类型" header-align="center" align="center"></el-table-column> |
|||
<el-table-column prop="typeCode" label="党组织类型编码" header-align="center" align="center"></el-table-column> |
|||
<el-table-column prop="enable" label="是否启用" :formatter="enableFormat" header-align="center" align="center"></el-table-column> |
|||
<el-table-column prop="sort" label="排序" header-align="center" align="center"></el-table-column> |
|||
<el-table-column :label="$t('handle')" fixed="right" header-align="center" align="center" width="150"> |
|||
<template slot-scope="scope"> |
|||
<el-button v-if="$hasPermission('sys:partyorgtype:update')" type="text" size="small" @click="addOrUpdateHandle(scope.row.id)">{{ $t('update') }}</el-button> |
|||
<el-button v-if="$hasPermission('sys:partyorgtype:delete')" type="text" size="small" @click="deleteHandle(scope.row.id)">{{ $t('delete') }}</el-button> |
|||
</template> |
|||
</el-table-column> |
|||
</el-table> |
|||
<el-pagination |
|||
:current-page="page" |
|||
:page-sizes="[10, 20, 50, 100]" |
|||
:page-size="limit" |
|||
:total="total" |
|||
layout="total, sizes, prev, pager, next, jumper" |
|||
@size-change="pageSizeChangeHandle" |
|||
@current-change="pageCurrentChangeHandle"> |
|||
</el-pagination> |
|||
<!-- 弹窗, 新增 / 修改 --> |
|||
<add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update> |
|||
</div> |
|||
</el-card> |
|||
</template> |
|||
|
|||
<script> |
|||
import mixinViewModule from '@/mixins/view-module' |
|||
import AddOrUpdate from './partyorgtype-add-or-update' |
|||
export default { |
|||
mixins: [mixinViewModule], |
|||
data () { |
|||
return { |
|||
mixinViewModuleOptions: { |
|||
getDataListURL: '/sys/partyorgtype/page', |
|||
getDataListIsPage: true, |
|||
deleteURL: '/sys/partyorgtype', |
|||
deleteIsBatch: true |
|||
}, |
|||
dataForm: { |
|||
id: '' |
|||
} |
|||
} |
|||
}, |
|||
methods: { |
|||
enableFormat (row, column) { |
|||
if (row.enable == 0) { |
|||
return '否' |
|||
} else if(row.enable == 1){ |
|||
return '是' |
|||
} else { |
|||
return '未知' |
|||
} |
|||
}, |
|||
}, |
|||
components: { |
|||
AddOrUpdate |
|||
} |
|||
} |
|||
</script> |
Loading…
Reference in new issue