2 changed files with 438 additions and 0 deletions
@ -0,0 +1,173 @@ |
|||||
|
<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="gridId"> |
||||
|
<el-input v-model="dataForm.gridId" placeholder="网格ID"></el-input> |
||||
|
</el-form-item> |
||||
|
<el-form-item label="小程序码URL" prop="codeUrl"> |
||||
|
<el-input v-model="dataForm.codeUrl" placeholder="小程序码URL"></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-item label="删除标记" prop="delFlag"> |
||||
|
<el-input v-model="dataForm.delFlag" placeholder="删除标记"></el-input> |
||||
|
</el-form-item> |
||||
|
<el-form-item label="是否是网格长码,0否 1是" prop="leaderFlag"> |
||||
|
<el-input v-model="dataForm.leaderFlag" placeholder="是否是网格长码,0否 1是"></el-input> |
||||
|
</el-form-item> |
||||
|
<el-form-item label="网格名称" prop="grid"> |
||||
|
<el-input v-model="dataForm.grid" placeholder="网格名称"></el-input> |
||||
|
</el-form-item> |
||||
|
<el-form-item label="父所有部门" prop="parentDeptIds"> |
||||
|
<el-input v-model="dataForm.parentDeptIds" placeholder="父所有部门"></el-input> |
||||
|
</el-form-item> |
||||
|
<el-form-item label="父所有部门" prop="parentDeptNames"> |
||||
|
<el-input v-model="dataForm.parentDeptNames" placeholder="父所有部门"></el-input> |
||||
|
</el-form-item> |
||||
|
<el-form-item label="所有部门ID" prop="allDeptIds"> |
||||
|
<el-input v-model="dataForm.allDeptIds" placeholder="所有部门ID"></el-input> |
||||
|
</el-form-item> |
||||
|
<el-form-item label="所有部门名称" prop="allDeptNames"> |
||||
|
<el-input v-model="dataForm.allDeptNames" 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: '', |
||||
|
gridId: '', |
||||
|
codeUrl: '', |
||||
|
revision: '', |
||||
|
createdBy: '', |
||||
|
createdTime: '', |
||||
|
updatedBy: '', |
||||
|
updatedTime: '', |
||||
|
delFlag: '', |
||||
|
leaderFlag: '', |
||||
|
grid: '', |
||||
|
parentDeptIds: '', |
||||
|
parentDeptNames: '', |
||||
|
allDeptIds: '', |
||||
|
allDeptNames: '' |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
computed: { |
||||
|
dataRule () { |
||||
|
return { |
||||
|
gridId: [ |
||||
|
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } |
||||
|
], |
||||
|
codeUrl: [ |
||||
|
{ 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' } |
||||
|
], |
||||
|
delFlag: [ |
||||
|
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } |
||||
|
], |
||||
|
leaderFlag: [ |
||||
|
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } |
||||
|
], |
||||
|
grid: [ |
||||
|
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } |
||||
|
], |
||||
|
parentDeptIds: [ |
||||
|
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } |
||||
|
], |
||||
|
parentDeptNames: [ |
||||
|
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } |
||||
|
], |
||||
|
allDeptIds: [ |
||||
|
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } |
||||
|
], |
||||
|
allDeptNames: [ |
||||
|
{ 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(`//reportmacode/${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']('//reportmacode/', 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,265 @@ |
|||||
|
<template> |
||||
|
<el-card shadow="never" class="aui-card--fill"> |
||||
|
<div class="mod-__reportmacode}"> |
||||
|
<el-form :inline="true" |
||||
|
:model="dataForm" |
||||
|
@keyup.enter.native="getDataList()"> |
||||
|
<el-form-item label="所属机构"> |
||||
|
<el-cascader v-model="deptIdList" |
||||
|
:options="options" |
||||
|
:props="{ checkStrictly: true }" |
||||
|
clearable></el-cascader> |
||||
|
</el-form-item> |
||||
|
<el-form-item> |
||||
|
<el-button @click="getDataList()">{{ $t('query') }}</el-button> |
||||
|
</el-form-item> |
||||
|
<el-form-item> |
||||
|
<el-button type="info" |
||||
|
@click="clearDataForm()">清空</el-button> |
||||
|
</el-form-item> |
||||
|
<el-form-item> |
||||
|
<el-button v-if="$hasPermission('sys:reportmacode:init')" |
||||
|
type="primary" |
||||
|
@click="initDeptMaCodeHandle()">初始化机构</el-button> |
||||
|
</el-form-item> |
||||
|
</el-form> |
||||
|
<el-table v-loading="dataListLoading" |
||||
|
:data="dataList" |
||||
|
border |
||||
|
@selection-change="dataListSelectionChangeHandle" |
||||
|
style="width: 100%;"> |
||||
|
<el-table-column prop="allDeptNames" |
||||
|
label="所属部门" |
||||
|
header-align="center" |
||||
|
align="center"></el-table-column> |
||||
|
<el-table-column align="center" |
||||
|
label="报事码" |
||||
|
:show-overflow-tooltip="true" |
||||
|
prop="codeUrl"> |
||||
|
<template slot-scope="scope"> |
||||
|
<el-popover placement="right" |
||||
|
title="" |
||||
|
trigger="click" |
||||
|
class="big_image"> |
||||
|
<el-image slot="reference" |
||||
|
min-width="70" |
||||
|
height="70" |
||||
|
v-if="scope.row.codeUrl" |
||||
|
:src="scope.row.codeUrl" |
||||
|
:alt="scope.row.codeUrl"></el-image> |
||||
|
<img class="big_image" |
||||
|
:src="scope.row.codeUrl" /> |
||||
|
</el-popover> |
||||
|
</template> |
||||
|
</el-table-column> |
||||
|
<el-table-column prop="createdTime" |
||||
|
label="创建时间" |
||||
|
header-align="center" |
||||
|
align="center"></el-table-column> |
||||
|
<el-table-column :label="$t('handle')" |
||||
|
fixed="right" |
||||
|
header-align="center" |
||||
|
width="300" |
||||
|
align="center"> |
||||
|
<template slot-scope="scope"> |
||||
|
<el-button v-if="$hasPermission('sys:reportmacode:delete') && scope.row.codeUrl && scope.row.leaderFlag === '0'" |
||||
|
type="danger" |
||||
|
size="mini" |
||||
|
@click="deleteHandle(scope.row.id)">{{ $t('delete') }}</el-button> |
||||
|
<el-button v-if="scope.row.codeUrl" |
||||
|
type="danger" |
||||
|
size="mini" |
||||
|
@click="downloadHandle(scope.row.codeUrl)">下载</el-button> |
||||
|
<el-button v-if="$hasPermission('sys:reportmacode:create') && !scope.row.codeUrl" |
||||
|
type="primary" |
||||
|
size="mini" |
||||
|
@click="createDeptMaCodeHandle(scope.row.gridId)">生成</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> |
||||
|
<epidemicSentryPost v-if="epidemicSentryPostVisible" |
||||
|
ref="epidemicSentryPost" |
||||
|
@refreshDataList="getDataList"></epidemicSentryPost> |
||||
|
</div> |
||||
|
</el-card> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
import mixinViewModule from '@/mixins/view-module' |
||||
|
import epidemicSentryPost from '../custom/epidemicsentrypost' |
||||
|
import Cookies from 'js-cookie' |
||||
|
export default { |
||||
|
mixins: [mixinViewModule], |
||||
|
data () { |
||||
|
return { |
||||
|
mixinViewModuleOptions: { |
||||
|
getDataListURL: '/sys/reportmacode/page', |
||||
|
getDataListIsPage: true, |
||||
|
deleteURL: '/sys/reportmacode', |
||||
|
deleteIsBatch: true |
||||
|
}, |
||||
|
dataForm: { |
||||
|
streetId: null, |
||||
|
communityId: null, |
||||
|
gridId: null, |
||||
|
leaderFlag: '0' |
||||
|
}, |
||||
|
epidemicSentryPostVisible: false, |
||||
|
upLoadUrl: '', |
||||
|
deptIdList: [], |
||||
|
options: [], |
||||
|
streetList: [], |
||||
|
communityList: [], |
||||
|
gridList: [], |
||||
|
maCodeCategorys: [ |
||||
|
{ id: '0', name: '群众注册码' }, |
||||
|
] |
||||
|
} |
||||
|
}, |
||||
|
components: { |
||||
|
epidemicSentryPost |
||||
|
}, |
||||
|
created () { |
||||
|
this.uploadUrl = `${window.SITE_CONFIG['apiURL']}/custom/epidemicSentryPost/importExcel?token=${Cookies.get('token')}` |
||||
|
this.$http |
||||
|
.get(`/sys/user/deptOptions/getBusinessDeptByUser`) |
||||
|
.then(({ data: res }) => { |
||||
|
if (res.code !== 0) { |
||||
|
return this.$message.error(res.msg) |
||||
|
} |
||||
|
this.options = res.data.options |
||||
|
}) |
||||
|
.catch(() => { }) |
||||
|
}, |
||||
|
watch: { |
||||
|
'deptIdList': function (val) { |
||||
|
if (val.length === 0) { |
||||
|
this.dataForm.streetId = '' |
||||
|
this.dataForm.communityId = '' |
||||
|
this.dataForm.gridId = '' |
||||
|
} |
||||
|
if (val.length === 1) { |
||||
|
this.dataForm.streetId = this.deptIdList[0] |
||||
|
this.dataForm.communityId = '' |
||||
|
this.dataForm.gridId = '' |
||||
|
} |
||||
|
if (val.length === 2) { |
||||
|
this.dataForm.streetId = this.deptIdList[0] |
||||
|
this.dataForm.communityId = this.deptIdList[1] |
||||
|
this.dataForm.gridId = '' |
||||
|
} |
||||
|
if (val.length === 3) { |
||||
|
this.dataForm.streetId = this.deptIdList[0] |
||||
|
this.dataForm.communityId = this.deptIdList[1] |
||||
|
this.dataForm.gridId = this.deptIdList[2] |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
methods: { |
||||
|
createDeptMaCodeHandle (id) { |
||||
|
this.$confirm( |
||||
|
this.$t('prompt.info', { handle: '生成报事码' }), |
||||
|
this.$t('生成'), |
||||
|
{ |
||||
|
confirmButtonText: this.$t('confirm'), |
||||
|
cancelButtonText: this.$t('cancel'), |
||||
|
type: 'warning' |
||||
|
} |
||||
|
) |
||||
|
.then(() => { |
||||
|
this.$http |
||||
|
.post(`/sys/reportmacode/create/${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(() => { }) |
||||
|
}, |
||||
|
initDeptMaCodeHandle () { |
||||
|
this.$confirm('加载全部网格,加载完成后可在操作栏生成报事码', this.$t('初始化'), { |
||||
|
confirmButtonText: this.$t('confirm'), |
||||
|
cancelButtonText: this.$t('cancel'), |
||||
|
type: 'warning' |
||||
|
}) |
||||
|
.then(() => { |
||||
|
let loading = this.$loading({ |
||||
|
lock: true, |
||||
|
text: '正在进行初始化...', |
||||
|
spinner: 'el-icon-loading', |
||||
|
background: 'rgba(0, 0, 0, 0.7)' |
||||
|
}) |
||||
|
this.$http |
||||
|
.post(`/sys/reportmacode/initDeptForMaCode`) |
||||
|
.then(({ data: res }) => { |
||||
|
if (res.code !== 0) { |
||||
|
return this.$message.error(res.msg) |
||||
|
} |
||||
|
loading.close() |
||||
|
this.$message({ |
||||
|
message: this.$t('prompt.success'), |
||||
|
type: 'success', |
||||
|
duration: 500, |
||||
|
onClose: () => { |
||||
|
this.getDataList() |
||||
|
} |
||||
|
}) |
||||
|
}) |
||||
|
.catch(() => { |
||||
|
loading.close() |
||||
|
}) |
||||
|
}) |
||||
|
.catch(() => { }) |
||||
|
}, |
||||
|
clearDataForm () { |
||||
|
this.dataForm.streetId = this.dataForm.communityId = this.dataForm.gridId = null |
||||
|
this.communityList = this.gridList = [] |
||||
|
}, |
||||
|
downloadHandle (codeUrl) { |
||||
|
window.location.href = `${window.SITE_CONFIG['apiURL']}/oss/file/download?fileUrl=${codeUrl}` |
||||
|
}, |
||||
|
// 哨卡管理 |
||||
|
sentryManage (id) { |
||||
|
this.epidemicSentryPostVisible = true |
||||
|
this.$nextTick(() => { |
||||
|
this.$refs.epidemicSentryPost.dataForm.gridId = id |
||||
|
this.$refs.epidemicSentryPost.init() |
||||
|
}) |
||||
|
}, |
||||
|
uploadSuccess (response, file, fileList) { |
||||
|
this.$refs.upload.clearFiles() |
||||
|
if (response.code !== 0) { |
||||
|
return this.$message.error(response.msg) |
||||
|
} |
||||
|
this.$message({ |
||||
|
message: this.$t('prompt.success'), |
||||
|
type: 'success', |
||||
|
duration: 500, |
||||
|
onClose: () => { |
||||
|
} |
||||
|
}) |
||||
|
}, |
||||
|
errorExceed (file, fileList) { |
||||
|
this.$message.error('上传失败请重试') |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
</script> |
Loading…
Reference in new issue