| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232 |
- <template>
- <xn-form-container
- :title="formData.reportId ? '编辑论坛-帖子举报信息表' : '增加论坛-帖子举报信息表'"
- :width="700"
- :visible="visible"
- :destroy-on-close="true"
- @close="onClose"
- >
- <a-form ref="formRef" :model="formData" :rules="formRules" layout="vertical">
- <a-form-item label="帖子:" name="postId">
- <a-select
- v-model:value="formData.postId"
- show-search
- placeholder="请选择帖子"
- style="width: 100%"
- :options="invitationList"
- :filter-option="filterOption"
- ></a-select>
- </a-form-item>
- <!-- <a-form-item label="帖子类型:" name="postType">
- <a-select
- v-model:value="formData.postType"
- show-search
- placeholder="请选择帖子类型"
- style="width: 100%"
- :options="invitationType"
- :filter-option="filterOption"
- ></a-select>
- </a-form-item>
- <a-form-item label="帖子状态:" name="postStatus">
- <a-select
- v-model:value="formData.postStatus"
- show-search
- placeholder="请选择帖子状态"
- style="width: 100%"
- :options="invitationStatus"
- :filter-option="filterOption"
- ></a-select>
- </a-form-item> -->
- <a-form-item label="举报人:" name="userId">
- <a-select
- v-model:value="formData.userId"
- show-search
- placeholder="请选择用户"
- style="width: 100%"
- :options="usertypeOptions"
- :filter-option="filterOption"
- ></a-select>
- </a-form-item>
- <a-form-item label="举报原因类型:" name="reportReasonType">
- <a-select
- v-model:value="formData.reportReasonType"
- show-search
- placeholder="请选择类型"
- style="width: 100%"
- :options="reportType"
- :filter-option="filterOption"
- ></a-select>
- </a-form-item>
- <a-form-item label="举报信息描述:" name="reportDetail">
- <a-input v-model:value="formData.reportDetail" placeholder="请输入举报信息描述" allow-clear />
- </a-form-item>
- <a-form-item label="证据图片:" name="evidenceScreenshot">
- <UpLoadImg ref="upLoadImgRef" @handlerUpImage="handlerUpImage"></UpLoadImg>
- </a-form-item>
- <a-form-item label="举报处理状态:" name="reportStatus">
- <a-select
- v-model:value="formData.reportStatus"
- show-search
- placeholder="请选择分类"
- style="width: 100%"
- :options="statusType"
- :filter-option="filterOption"
- ></a-select>
- </a-form-item>
- </a-form>
- <template #footer>
- <a-button style="margin-right: 8px" @click="onClose">关闭</a-button>
- <a-button type="primary" @click="onSubmit" :loading="submitLoading">保存</a-button>
- </template>
- </xn-form-container>
- </template>
- <script setup name="forumReportInfoForm">
- import { cloneDeep } from 'lodash-es'
- import { required } from '@/utils/formRules'
- import forumReportInfoApi from '@/api/forum/forumReportInfoApi'
- import forumApi from '@/api/forum/forumApi'
- // 抽屉状态
- const visible = ref(false)
- const emit = defineEmits({ successful: null })
- const formRef = ref()
- // 表单数据
- const formData = ref({})
- const submitLoading = ref(false)
- //用户
- const usertypeOptions = ref([])
- //帖子
- const invitationList = ref([])
- //举报原因
- const reportType = ref([
- {
- label: '垃圾广告',
- value: 0
- },
- {
- label: '色情内容',
- value: 1
- },
- {
- label: '人身攻击',
- value: 2
- },
- {
- label: '政治敏感',
- value: 3
- },
- {
- label: '其他',
- value: 4
- }
- ])
- //状态
- const statusType = ref([
- {
- label: '待处理',
- value: 0
- },
- {
- label: '已关闭帖子',
- value: 1
- },
- {
- label: '已驳回',
- value: 2
- }
- ])
- //帖子类型
- const invitationType = ref([
- {
- label:'普通帖子',
- value:0
- },
- {
- label:'技术支持',
- value:1
- },
- {
- label:'内容纠错',
- value:2
- },
- ])
- //帖子状态
- const invitationStatus = ref([
- {
- label:'正常',
- value:0
- },
- {
- label:'关闭',
- value:1
- }
- ])
- //筛选
- const filterOption = (input, option) => {
- return option.value.toLowerCase().indexOf(input.toLowerCase()) >= 0
- }
- // 打开抽屉
- const onOpen = (record) => {
- visible.value = true
- forumApi.allUserList().then((data) => {
- usertypeOptions.value = data.map((r) => {
- return {
- label: r.name,
- value: r.id,
- ...r
- }
- })
- })
- forumApi
- .forumList({
- current: 1,
- size: 999999999,
- sortOrder: 0
- })
- .then((data) => {
- invitationList.value = data.records.map((r) => {
- return {
- label: r.postTitle,
- value: r.postId,
- ...r
- }
- })
- })
- if (record) {
- let recordData = cloneDeep(record)
- formData.value = Object.assign({}, recordData)
- }
- }
- // 关闭抽屉
- const onClose = () => {
- formRef.value.resetFields()
- formData.value = {}
- visible.value = false
- }
- // 默认要校验的
- const formRules = {}
- // 验证并提交数据
- const onSubmit = () => {
- formRef.value.validate().then(() => {
- submitLoading.value = true
- const formDataParam = cloneDeep(formData.value)
- forumReportInfoApi
- .forumReportInfoSubmitForm(formDataParam, formDataParam.reportId)
- .then(() => {
- onClose()
- emit('successful')
- })
- .finally(() => {
- submitLoading.value = false
- })
- })
- }
- //选择图片
- const handlerUpImage = (id) => {
- formData.value.evidenceScreenshot = id
- }
- // 抛出函数
- defineExpose({
- onOpen
- })
- </script>
|