|
@@ -3,17 +3,17 @@ import { addQuestionReportData, getQuestionTypeList, pageQuestionReportData } fr
|
|
|
import { AddQuestionReportDataReq, QuestionListRes, QuestionType, QuestionTypeListRes } from '@/api/questionReqort/types'
|
|
|
import { onMounted, ref } from 'vue'
|
|
|
import GridAddress from '@/components/address/gridAddress/index.vue'
|
|
|
-import { showNotify } from 'vant';
|
|
|
+import { showNotify } from 'vant'
|
|
|
|
|
|
const active = ref(0)
|
|
|
|
|
|
const formData = ref<AddQuestionReportDataReq & { location?: string }>({})
|
|
|
-const range = ref<{text: string, value: string}[]>([])
|
|
|
+const range = ref<{ text: string; value: string }[]>([])
|
|
|
const rules = ref({
|
|
|
- type: [{ required: true, message: '请选择问题类型' }],
|
|
|
- title: [{ required: true, message: '请输入问题标题' }],
|
|
|
- content: [{ required: true, message: '请输入问题内容' }],
|
|
|
- location: [{ required: true, message: '请输入问题所在地' }],
|
|
|
+ questionType: [{ required: true, message: '请选择问题类型' }],
|
|
|
+ questionTitle: [{ required: true, message: '请输入问题标题' }],
|
|
|
+ questionContent: [{ required: true, message: '请输入问题内容' }],
|
|
|
+ addrName: [{ required: true, message: '请输入问题所在地' }],
|
|
|
})
|
|
|
|
|
|
/** 上报问题 */
|
|
@@ -23,6 +23,18 @@ const handleAddressFinish = (value) => {
|
|
|
addressList.value = value
|
|
|
}
|
|
|
const submit = async () => {
|
|
|
+ if (!formData.value.questionType) {
|
|
|
+ showNotify('请选择问题类型')
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if (!formData.value.questionTitle) {
|
|
|
+ showNotify('请输入问题标题')
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if (!formData.value.questionContent) {
|
|
|
+ showNotify('请输入问题内容')
|
|
|
+ return
|
|
|
+ }
|
|
|
if (!addressList.value || addressList.value.length === 0) {
|
|
|
showNotify('请选择问题所在地')
|
|
|
return
|
|
@@ -82,24 +94,21 @@ const hanleSelectArea = () => {
|
|
|
areaShow.value = true
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-
|
|
|
onMounted(async () => {
|
|
|
- const {data} = await getQuestionTypeList({
|
|
|
+ const { data } = await getQuestionTypeList({
|
|
|
page: 1,
|
|
|
limit: 9999,
|
|
|
- category:QuestionType.QUESTION
|
|
|
-
|
|
|
+ category: QuestionType.QUESTION,
|
|
|
})
|
|
|
if (data.records) {
|
|
|
- range.value = data.records.map(item => {
|
|
|
+ range.value = data.records.map((item) => {
|
|
|
return {
|
|
|
text: item.typeName,
|
|
|
- value: item.typeName
|
|
|
+ value: item.typeName,
|
|
|
}
|
|
|
})
|
|
|
} else {
|
|
|
- range.value = []
|
|
|
+ range.value = []
|
|
|
}
|
|
|
})
|
|
|
</script>
|
|
@@ -108,7 +117,7 @@ onMounted(async () => {
|
|
|
<van-tabs v-model:active="active" type="card" class="top-tabs">
|
|
|
<van-tab title="上报问题">
|
|
|
<view class="tab-container">
|
|
|
- <uni-forms :modelValue="formData" :rules="rules" label-align="right" label-width="80">
|
|
|
+ <uni-forms ref="questionReportFormRef" :modelValue="formData" :rules="rules" label-align="right" label-width="80">
|
|
|
<uni-forms-item label="问题类型" required name="questionType">
|
|
|
<uni-data-select v-model="formData.questionType" :localdata="range"></uni-data-select>
|
|
|
</uni-forms-item>
|
|
@@ -140,7 +149,14 @@ onMounted(async () => {
|
|
|
<view>定位:{{ item.addrName }}</view>
|
|
|
<view class="flex gap-3">
|
|
|
<view class="type">问题类型</view>
|
|
|
- <van-tag color="#CFFECE" text-color="black">{{ item.questionType }}</van-tag>
|
|
|
+ <van-tag
|
|
|
+ class="max-w-[100px] text-ellipsis overflow-hidden text-nowrap !block !leading-[25px]"
|
|
|
+ color="#CFFECE"
|
|
|
+ text-color="black"
|
|
|
+ >{{ item.questionType }}</van-tag
|
|
|
+ >
|
|
|
+ <van-tag v-if="item?.status === 0" color="red">未解答</van-tag>
|
|
|
+ <van-tag v-if="item?.status === 1" color="green">已解答</van-tag>
|
|
|
</view>
|
|
|
</view>
|
|
|
</van-list>
|