Files
dvcp_v2_webapp/project/tianfuxing/AppTaskReview/AppTaskReview.vue
2022-11-04 16:18:10 +08:00

157 lines
4.9 KiB
Vue

<template>
<section class="AppTaskReview">
<ai-list>
<ai-title slot="title" title="任务审核" isShowBottomBorder />
<template #content>
<ai-table :tableData="tableData" :total="page.total" :current.sync="page.current" :size.sync="page.size" @getList="getList" :col-configs="colConfigs"
:dict="dict" @sort-change="sortChange">
<el-table-column slot="accessUrl" label="凭证内容" align="left">
<template slot-scope="{ row }">
<el-image class="row-img" :src="row.accessUrl" :preview-src-list="[row.accessUrl]"/>
</template>
</el-table-column>
<el-table-column slot="options" label="操作" fixed="right" align="center">
<template slot-scope="{ row }">
<el-button type="text" v-if="row.status == 0" @click="pass(row)">通过</el-button>
<el-button type="text" v-if="row.status == 0" @click="refuse(row)">拒绝</el-button>
<el-button type="text" v-if="row.status != 0 && row.openStatus != 1" @click="open(row)">展示</el-button>
<el-button type="text" v-if="row.status != 0 && row.openStatus == 1" @click="open(row)">取消展示</el-button>
</template>
</el-table-column>
</ai-table>
<ai-dialog
title="审核通过"
:visible.sync="dialog"
:destroyOnClose="true"
width="720px"
@onConfirm="onConfirm"
@closed="form={}">
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="发放积分" prop="integral">
<el-input v-model.trim="form.integral" placeholder="请输入正数" size="small"></el-input>
</el-form-item>
<p><el-checkbox v-model="form.openStatus">同时将随手拍展示到文明广场</el-checkbox></p>
</el-form>
</ai-dialog>
</template>
</ai-list>
</section>
</template>
<script>
export default {
name: "AppTaskReview",
label: "任务审核",
props: {
instance: Function,
dict: Object,
},
data () {
return {
page: {
current: 1,
size: 10,
total: 0,
},
tableData: [],
dialog: false,
form: {
integral: '',
},
}
},
created () {
this.$dict.load('tfx_status', 'tfx_listType').then(()=> {
this.getList()
})
},
computed: {
colConfigs() {
return [
{slot: "accessUrl", align: "left"},
{prop: "userName", label: "上传人", align: "center"},
{prop: "type", label: "任务分类", align: "center",dict:"tfx_listType"},
{prop: "createTime", label: "上传时间", align: "center"},
{
prop: "status",
label: "状态",
align: "center",
render: (h, {row}) => {
return h('span', {style: {color: this.dict.getColor('tfx_status', row.status)}}, this.dict.getLabel('tfx_status', row.status))
},
},
{prop: "auditUserName", label: "处理人", align: "center"},
{slot: "options"},
]
},
rules() {
return {
integral: [{required: true, message: '请输入积分', trigger: 'blur' },
{pattern: /^([1-9]\d*|0)(\.\d{1,2})?$/, message: '请输入正数且最多只能保留两位小数'}],
}
},
},
methods: {
onConfirm() {
this.$refs.form.validate((valid)=> {
if(valid) {
var openStatus = this.form.openStatus ? 1 : 0
this.instance.post(`api/appwechatescalation/examine?id=${this.form.id}&pass=1&integral=${this.form.integral}&openStatus=${openStatus}`).then(res => {
if(res?.code == 0) {
this.dialog = false
this.$message.success('审核成功')
this.getList()
}
})
}
})
},
open(row) {
this.instance.post(`api//appwechatescalation/openShow?id=${row.id}`).then(res => {
if (res.code == 0) {
this.$message.success('操作成功')
this.getList()
}
})
},
pass(row) {
this.dialog = true
this.form = {...row}
this.form.openStatus = row.openStatus == 1 ? true : false
},
refuse(row) {
this.$confirm('确定拒绝该任务?').then(() => {
this.instance.post(`api/appwechatescalation/examine?id=${row.id}&pass=0`).then(res => {
if (res.code == 0) {
this.$message.success('审核成功')
this.getList()
}
})
})
},
getList() {
this.instance.post(`api/appwechatescalation/list`,null,{
params: {
...this.page,
}
}).then(res=> {
if(res?.data) {
this.tableData = res.data.records
this.page.total = res.data.total
}
})
},
}
}
</script>
<style lang="scss" scoped>
.AppTaskReview {
height: 100%;
.row-img {
width: 80px;
height: 80px;
}
}
</style>