风险预警

This commit is contained in:
yanran200730
2022-03-24 11:03:20 +08:00
parent c33eb0e6f2
commit d9701c366d
7 changed files with 850 additions and 0 deletions

View File

@@ -0,0 +1,155 @@
<template>
<ai-detail>
<template slot="title">
<ai-title :title="params.id ? '编辑风险人员' : '添加风险人员'" isShowBack isShowBottomBorder @onBackClick="cancel(false)">
</ai-title>
</template>
<template slot="content">
<ai-card title="基本信息">
<template #content>
<el-form ref="form" class="ai-form" :model="form" label-width="110px" label-position="right">
<el-form-item label="姓名" prop="name" :rules="[{ required: true, message: '请输入姓名', trigger: 'blur' }]">
<el-input v-model="form.name" size="small" placeholder="请输入姓名"></el-input>
</el-form-item>
<el-form-item label="联系方式" prop="phone" :rules="[{ required: true, validator: validatorPhone, trigger: 'blur' }]">
<el-input v-model="form.phone" :maxlength="11" size="small" placeholder="请输入..."></el-input>
</el-form-item>
<el-form-item label="风险类型" prop="idNumber" :rules="[{ required: true, message: '请选择风险类型', trigger: 'blur' }]">
<ai-select
v-model="form.checkResult"
clearable
placeholder="请选择风险类型"
:selectList="dict.getDict('epidemicRecentTestResult')">
</ai-select>
</el-form-item>
<el-form-item label="身份证号" prop="idNumber" :rules="[{ required: true, validator: validatorId, trigger: 'blur' }]">
<el-input v-model="form.idNumber" :maxlength="20" size="small" placeholder="请输入..."></el-input>
</el-form-item>
<el-form-item style="width: 100%!important;" label="所在地区" prop="areaId" :rules="[{ required: true, message: '请选择所在地区', trigger: 'change' }]">
<ai-area-select
v-model="form.areaId"
always-show
:disabled="form.applyType === '1'"
:instance="$http"
clearable
@fullname="v=>form.areaName = v"
:disabledLevel="3"/>
</el-form-item>
<el-form-item label="联系地址" prop="idNumber" style="width: 100%;">
<el-input v-model="form.idNumber" :maxlength="30" size="small" placeholder="请输入联系地址"></el-input>
</el-form-item>
<el-form-item label="备注说明" prop="idNumber" style="width: 100%;">
<el-input v-model="form.idNumber" :rows="5" style="width: 100%;" type="textarea" :maxlength="500" size="small" placeholder="请输入..."></el-input>
</el-form-item>
</el-form>
</template>
</ai-card>
</template>
<template #footer>
<el-button @click="cancel">取消</el-button>
<el-button type="primary" @click="confirm">提交</el-button>
</template>
</ai-detail>
</template>
<script>
export default {
name: 'Add',
props: {
instance: Function,
dict: Object,
params: Object
},
data () {
const validatorId = (rule, value, callback) => {
if (value === '') {
callback(new Error('请输入身份证号'))
} else if (!this.idCardNoUtil.checkIdCardNo(value)) {
callback(new Error('身份证号格式错误'))
} else {
callback()
}
}
const validatorPhone = function (rule, value, callback) {
if (value === '') {
callback(new Error('请输入联系方式'))
} else if (!/^1\d{10}$/.test(value)) {
callback(new Error('手机号格式错误'))
} else {
callback()
}
}
return {
info: {},
validatorId,
validatorPhone,
form: {
title: '',
content: '',
publishUnitName: '',
images: []
},
id: ''
}
},
created () {
if (this.params && this.params.id) {
this.id = this.params.id
this.getInfo(this.params.id)
}
},
methods: {
getInfo (id) {
this.instance.post(`/app/appmininotice/queryDetailById?id=${id}`).then(res => {
if (res.code === 0) {
this.form = {
...res.data,
images: res.data.images ? JSON.parse(res.data.images) : []
}
}
})
},
onClose () {
this.form.explain = ''
},
confirm () {
this.$refs.form.validate((valid) => {
if (valid) {
if (!this.form.content && !this.form.images.length) {
return this.$message.error('请输入正文或上传图片')
}
this.instance.post(`/app/appmininotice/addOrUpdate`, {
...this.form,
images: this.form.images ? JSON.stringify(this.form.images) : []
}).then(res => {
if (res.code == 0) {
this.$message.success('提交成功')
setTimeout(() => {
this.cancel(true)
}, 600)
}
})
}
})
},
cancel (isRefresh) {
this.$emit('change', {
type: 'List',
isRefresh: !!isRefresh
})
}
}
}
</script>
<style scoped lang="scss">
</style>

View File

@@ -0,0 +1,71 @@
<template>
<ai-detail>
<template slot="title">
<ai-title title="详情" isShowBack isShowBottomBorder @onBackClick="cancel(false)">
</ai-title>
</template>
<template slot="content">
<ai-card title="基本信息">
<template #content>
<ai-wrapper>
<ai-info-item label="标题" isLine :value="info.title"></ai-info-item>
<ai-info-item label="发布组织" isLine :value="info.publishUnitName"></ai-info-item>
<ai-info-item label="正文" isLine>
<AiArticle :value="info.content"></AiArticle>
</ai-info-item>
<ai-info-item label="图片" isLine>
<ai-uploader v-model="info.images" disabled :instance="instance" :limit="9"></ai-uploader>
</ai-info-item>
</ai-wrapper>
</template>
</ai-card>
</template>
</ai-detail>
</template>
<script>
export default {
name: 'Detail',
props: {
instance: Function,
dict: Object,
params: Object
},
data () {
return {
info: {},
id: ''
}
},
created () {
if (this.params && this.params.id) {
this.id = this.params.id
this.getInfo(this.params.id)
}
},
methods: {
getInfo (id) {
this.instance.post(`/app/appmininotice/queryDetailById?id=${id}`).then(res => {
if (res.code === 0) {
this.info = res.data
this.info.images = res.data.images ? JSON.parse(res.data.images) : []
}
})
},
cancel (isRefresh) {
this.$emit('change', {
type: 'List',
isRefresh: !!isRefresh
})
}
}
}
</script>
<style scoped lang="scss">
</style>

View File

@@ -0,0 +1,167 @@
<template>
<ai-list class="notice">
<template slot="title">
<ai-title title="风险预警" isShowBottomBorder></ai-title>
</template>
<template slot="content">
<ai-search-bar bottomBorder>
<template #left>
<ai-select
v-model="search.checkResult"
clearable
placeholder="请选择风险类型"
:selectList="dict.getDict('epidemicRecentTestResult')"
@change="search.current = 1, getList()">
</ai-select>
<el-button icon="iconfont iconAdd" type="primary" size="small" @click="toAdd">添加 </el-button>
</template>
<template #right>
<el-input
v-model="search.name"
size="small"
placeholder="姓名/风险说明/操作人"
clearable
v-throttle="() => {search.current = 1, getList()}"
@clear="search.current = 1, search.name = '', getList()"
suffix-icon="iconfont iconSearch">
</el-input>
</template>
</ai-search-bar>
<ai-search-bar bottomBorder style="margin-top: 12px;">
<template #left>
<el-button icon="iconfont iconDelete" size="small" @click="removeAll" :disabled="ids.length == 0">删除 </el-button>
</template>
<template #right>
<ai-download :instance="instance" url="/app/appepidemicreportmember/export" :params="search" fileName="健康上报" :disabled="tableData.length == 0">
<el-button icon="iconfont iconExported" :disabled="tableData.length == 0">导出</el-button>
</ai-download>
<ai-import :instance="instance" :dict="dict" type="appcommunitybuildinginfo" :importParams="search" name="风险预警" @success="getList()">
<el-button icon="iconfont iconImport">导入</el-button>
</ai-import>
</template>
</ai-search-bar>
<ai-table
:tableData="tableData"
:col-configs="colConfigs"
:total="total"
style="margin-top: 12px;"
:current.sync="search.current"
:size.sync="search.size"
@selection-change="(v) => (ids = v.map((e) => e.id))"
@getList="getList">
<el-table-column slot="tags" label="标签">
<template slot-scope="{ row }">
<div class="table-tags">
<el-tag type="info" v-for="(item, index) in row.tags" size="small" :key="index">{{ item }}</el-tag>
</div>
</template>
</el-table-column>
<el-table-column slot="options" width="120px" fixed="right" label="操作" align="center">
<div class="table-options" slot-scope="{ row }">
<el-button type="text" @click="toDetail(row.id)">详情</el-button>
<el-button type="text" @click="remove(row.id)">删除</el-button>
</div>
</el-table-column>
</ai-table>
</template>
</ai-list>
</template>
<script>
import { mapState } from 'vuex'
export default {
name: 'List',
props: {
instance: Function,
dict: Object
},
data() {
return {
search: {
current: 1,
size: 10,
title: ''
},
ids: [],
total: 10,
colConfigs: [
{ type: 'selection' },
{prop: 'title', label: '姓名', align: 'left'},
{prop: 'createUserName', label: '联系方式', align: 'center' },
{prop: 'publishUnitName', label: '风险类型', align: 'center'},
{prop: 'createTime', label: '所属区域', align: 'center' },
{prop: 'createUserName', label: '备注说明', align: 'center' },
{prop: 'publishUnitName', label: '操作时间', align: 'center'},
{prop: 'createTime', label: '操作人', align: 'center' },
{prop: 'createTime', label: '归口部门', align: 'center' },
{slot: 'options', label: '操作'}
],
tableData: []
}
},
computed: {
...mapState(['user'])
},
created () {
this.dict.load('epidemicRecentTestResult').then(() => {
this.getList()
})
},
methods: {
getList() {
this.instance.post(`/app/appmininotice/list`, null, {
params: {
...this.search
}
}).then(res => {
if (res.code == 0) {
this.tableData = res.data.records
this.total = res.data.total
}
})
},
removeAll () {
var id = this.ids.join(',')
this.remove(id)
},
remove(id) {
this.$confirm('确定删除该数据?').then(() => {
this.instance.post(`/app/appmininotice/delete?ids=${id}`).then(res => {
if (res.code == 0) {
this.$message.success('删除成功!')
this.getList()
}
})
})
},
toDetail (id) {
this.$emit('change', {
type: 'Detail',
params: {
id: id || ''
}
})
},
toAdd(id) {
this.$emit('change', {
type: 'Add',
params: {
id: id || ''
}
})
}
}
}
</script>
<style lang="scss" scoped>
</style>