Files
dvcp_v2_webapp/project/fengdu/app/AppIntegratingAudit/components/Detail.vue
yanran200730 6b4051b984 306
2023-04-19 13:51:37 +08:00

233 lines
7.8 KiB
Vue

<template>
<ai-detail class="detail">
<template slot="title">
<ai-title title="积分审核" isShowBack isShowBottomBorder @onBackClick="cancel(false)">
<template #rightBtn>
<el-button size="small" type="primary" @click="isShow = true" v-if="info.status === '0'">审核</el-button>
</template>
</ai-title>
</template>
<template slot="content">
<ai-card title="基本信息">
<template #content>
<ai-wrapper>
<ai-info-item label="事件类型" isLine :value="info.applyItemName"></ai-info-item>
<ai-info-item label="申请人" :value="info.createUserName"></ai-info-item>
<ai-info-item label="手机号" :value="info.phone"></ai-info-item>
<ai-info-item label="所属地区" :value="info.areaName"></ai-info-item>
<ai-info-item label="所属网格" :value="info.girdName"></ai-info-item>
<ai-info-item label="审核时间" v-if="info.status === '1'" :value="info.auditTime"></ai-info-item>
<ai-info-item label="申请时间" v-if="info.status === '0'" :value="info.createTime"></ai-info-item>
<ai-info-item label="状态">
<span>{{ dict.getLabel('appIntegralApplyEventStatus', info.status) }}</span>
<span v-if="info.status === '1'" style="margin-left: 10px; color: green">积分+{{ info.applyIntegral }}</span>
</ai-info-item>
</ai-wrapper>
</template>
</ai-card>
<ai-card title="事件信息">
<template #right>
<el-button size="small" type="primary" @click="showEvent" v-if="info.status === '0'">编辑</el-button>
</template>
<template #content>
<ai-wrapper>
<ai-info-item label="积分值" isLine :value="info.applyIntegral"></ai-info-item>
<ai-info-item label="事件描述" isLine :value="info.content"></ai-info-item>
<ai-info-item label="事件附件" isLine>
<div class="files">
<div class="file-item" v-for="(item, index) in info.files" :key="index">
<img :src="item.url" v-viewer="{movable: true}" v-if="item.postfix !== '.mp4'">
<video controls v-else :src="item.url"></video>
</div>
</div>
</ai-info-item>
</ai-wrapper>
</template>
</ai-card>
<ai-dialog
:visible.sync="isShow"
@onConfirm="onConfirm"
@close="onClose"
width="890px"
title="审核">
<el-form class="ai-form" :model="form" label-width="120px" ref="form">
<el-form-item label="是否通过" prop="auditStatus" style="width: 100%;" :rules="[{required: true, message: '请选择是否通过', trigger: 'change'}]">
<el-radio-group v-model="form.auditStatus">
<el-radio label="0"></el-radio>
<el-radio label="1"></el-radio>
</el-radio-group>
</el-form-item>
<el-form-item prop="auditDesc" v-if="form.auditStatus === '0'" label="审批意见" style="width: 100%" :rules="[{required: true, message: '请输入审批意见', trigger: 'blur'}]">
<el-input size="small" type="textarea" :rows="5" v-model="form.auditDesc" clearable placeholder="请输入审批意见"></el-input>
</el-form-item>
</el-form>
</ai-dialog>
<ai-dialog
:visible.sync="isShowEvent"
@onConfirm="onEventConfirm"
@close="onClose"
width="890px"
title="编辑">
<el-form class="ai-form" :model="eventForm" label-width="120px" ref="eventForm">
<el-form-item label="积分值" prop="applyIntegral" :rules="[{required: true, message: '请输入积分值', trigger: 'change'}]">
<el-input-number style="width: 200px;" size="small" :precision="2" type="input" v-model="eventForm.applyIntegral" clearable placeholder="请输入积分值" :min="0"></el-input-number>
</el-form-item>
<el-form-item prop="content" label="事件描述" style="width: 100%" :rules="[{required: true, message: '请输入事件描述', trigger: 'blur'}]">
<el-input size="small" type="textarea" :rows="5" :maxlength="300" show-word-limit v-model="eventForm.content" clearable placeholder="请输入事件描述"></el-input>
</el-form-item>
<el-form-item style="width: 100%" label="事件附件" prop="files" :rules="[{required: true, message: '请选择事件附件', trigger: 'change'}]">
<ai-uploader
:instance="instance"
fileType="file"
v-model="eventForm.files"
:limit="9">
</ai-uploader>
</el-form-item>
</el-form>
</ai-dialog>
</template>
</ai-detail>
</template>
<script>
export default {
name: 'Detail',
props: {
instance: Function,
dict: Object,
params: Object
},
data () {
return {
info: {},
form: {
auditDesc: '',
auditStatus: ''
},
eventForm: {
files: [],
content: '',
applyIntegral: ''
},
isShowEvent: false,
isShow: false
}
},
created () {
this.getInfo()
},
methods: {
getInfo () {
this.instance.post(`/app/appintegraluserapply/queryDetailById?id=${this.params.id}`).then(res => {
if (res.code == 0) {
if (res.data) {
this.info = {
...res.data,
files: res.data.files.map(v => {
return {
...v,
postfix: v.postfix.toLowerCase()
}
})
}
if (res.data.status === '0') {
this.eventForm.files = res.data.files
this.eventForm.content = res.data.content
this.eventForm.applyIntegral = res.data.applyIntegral
}
}
}
})
},
showEvent () {
this.eventForm.files = this.info.files
this.eventForm.content = this.info.content
this.eventForm.applyIntegral = this.info.applyIntegral
this.isShowEvent = true
},
onClose () {
this.form.auditDesc = ''
this.form.auditStatus = ''
},
onEventConfirm () {
this.$refs.eventForm.validate((valid) => {
if (valid) {
this.instance.post(`/app/appintegraluserapply/updateByGirdMember`, {
...this.eventForm,
id: this.params.id
}).then(res => {
if (res.code == 0) {
this.$message.success('编辑成功!')
this.isShowEvent = false
this.getInfo()
}
})
}
})
},
onConfirm () {
this.$refs.form.validate((valid) => {
if (valid) {
this.instance.post(`/app/appintegraluserapply/auditById`, {
...this.form,
id: this.params.id
}).then(res => {
if (res.code == 0) {
this.$message.success('审核成功!')
this.isShow = false
this.getInfo()
}
})
}
})
},
cancel () {
this.$emit('change', {
type: 'List',
isRefresh: true
})
}
}
}
</script>
<style scoped lang="scss">
.detail {
.files {
display: flex;
align-items: center;
flex-wrap: wrap;
.file-item {
width: 240px;
height: 240px;
margin: 0 20px 20px 0;
img, video {
width: 100%;
height: 100%;
object-fit: cover;
}
img {
cursor: pointer;
transition: all ease 0.3s;
&:hover {
opacity: 0.7;
}
}
}
}
}
</style>