update 国内、海外提出问题

This commit is contained in:
赵霄
2023-09-28 17:39:22 +08:00
parent ac5f98bc4d
commit 279f0cee18
3 changed files with 70 additions and 18 deletions
@@ -23,7 +23,7 @@
<!-- 项目-->
<a-form-item :label="$t('project')" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-select :placeholder="$t('pleaseSelect') + $t('project')" v-decorator="['project', validatorRules.project]">
<a-select-option v-for="item in projectSelectOptions" :key="item">{{ item }}</a-select-option>
<a-select-option v-for="item in projectSelectOptions" :key="item.id">{{ item.projectName }}</a-select-option>
</a-select>
</a-form-item>
</a-col>
@@ -38,10 +38,13 @@
</a-form-item>
</a-col>
<a-col :span="12">
<!-- 回答人-->
<a-form-item :label="$t('standardRegulationLibrary.standardDetail.respondent')" :labelCol="labelCol" :wrapperCol="wrapperCol">
<user-selection v-decorator="['respondent', validatorRules.respondent]"
:placeholder="$t('pleaseSelect') + $t('standardRegulationLibrary.standardDetail.respondent')" />
<!-- 提问时间-->
<a-form-item :label="$t('standardRegulationLibrary.standardDetail.problemOccurrenceTime')" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-date-picker :placeholder="$t('pleaseSelect') + $t('standardRegulationLibrary.standardDetail.problemOccurrenceTime')"
:getCalendarContainer="(trigger) => trigger.parentNode"
v-decorator="['quizTime', validatorRules.quizTime]"
showTime
style="width: 100%" />
</a-form-item>
</a-col>
<a-col :span="24">
@@ -54,7 +57,7 @@
@change="event => event.target.value = event.target.value.trim()"
:maxLength="500"
v-decorator="['problemDescription', validatorRules.problemDescription]" />
<j-upload v-decorator="['fileIds', validatorRules.fileIds]" />
<j-upload v-decorator="['file', validatorRules.file]" return-id/>
</a-form-item>
</a-col>
</a-row>
@@ -63,11 +66,12 @@
</template>
<script>
import UserSelection from '../../../../components/selection/UserSelection.vue'
import { submitDomesticQuestion, submitOverseasQuestion } from '../../../../api/standardRegulationLibraryApi.js'
import { getCarTypeProjectList } from '../../../../api/api.js'
import { StandardSource } from '../../../../enums/commonEnums.js'
export default {
name: 'SubmitQuestionModal',
components: { UserSelection },
data () {
return {
width: 800,
@@ -108,32 +112,74 @@ export default {
validateTrigger: 'blur'
},
// 问题发生时间
problemOccurrenceTime: {
quizTime: {
rules: [{ required: false, message: this.$t('pleaseSelect') + this.$t('standardRegulationLibrary.standardDetail.problemOccurrenceTime') }],
validateTrigger: 'change'
},
// 回答人
respondent: {
rules: [{ required: false, message: this.$t('pleaseSelect') + this.$t('standardRegulationLibrary.standardDetail.respondent') }],
validateTrigger: 'change'
},
// 问题描述
problemDescription: {
rules: [{ required: true, message: this.$t('pleaseEnter') + this.$t('standardRegulationLibrary.standardDetail.problemDescription') }],
validateTrigger: 'blur'
},
// 附件
fileIds: {}
file: {},
type: null
},
projectSelectOptions: [] // 项目下拉数据
}
},
methods: {
open () {
open (standardNumber, type) {
this.visible = true
this.initProjectOptions()
this.type = type
const param = {}
param.standardNumber = standardNumber
param.quizTime = new Date().getFullYear() + '-' + new Date().getMonth() + '-' + new Date().getDay() + ' ' +
new Date().getHours() + ':' + new Date().getMinutes() + ':' + new Date().getSeconds()
this.$nextTick(() => {
this.form.setFieldsValue(param)
})
},
// 获取项目下拉框数据
initProjectOptions () {
getCarTypeProjectList().then(res => {
if (res.success) {
this.projectSelectOptions = res.result
} else {
this.$message.warning(res.message)
}
})
},
handleOk () {
if (this.confirmLoading) return
this.form.validateFields((err, values) => {
if (!err) {
let submitFunc
switch (this.type) {
case StandardSource.DOMESTIC.value:
submitFunc = submitDomesticQuestion
break
case StandardSource.OVERSEAS.value:
submitFunc = submitOverseasQuestion
break
default:
break
}
this.confirmLoading = true
const param = Object.assign({}, values)
submitFunc(param).then(res => {
if (res.success) {
this.$message.success(res.message)
this.close()
} else {
this.$message.warning(res.message)
}
}).finally(() => {
this.confirmLoading = false
})
}
})
},
handleCancel () {
this.close()