Commit 96e7742d by pangchong

feat: 协议单位收尾

parent e06a6419
import { http } from 'mocp/utils/http'
export const getRepairWorkSupervisionListApi = (data, config) => {
return http({
method: 'POST',
url: '/technical-support/getRepairWorkSupervisionList',
data,
config
})
}
export const getSurveyTemplateDetailApi = (data, config) => {
return http({
method: 'POST',
url: '/technical-support/getSurveyTemplateDetail',
data,
config
})
}
export const submitAnswersApi = (data, config) => {
return http({
method: 'POST',
url: '/technical-support/submitAnswers',
data,
config
})
}
export const getRepairTaskInfoListApi = (data, config) => {
return http({
method: 'POST',
url: '/technical-support/getRepairTaskInfoList',
data,
config
})
}
......@@ -6,8 +6,8 @@
:customStyle="getCustomStyle"
v-for="(item, index) in getColumns"
:key="index"
:label="item.label"
:name="item.value"
:label="item[labelField]"
:name="item[valueField]"
></up-checkbox>
</up-checkbox-group>
</view>
......
......@@ -346,6 +346,8 @@ const queryList = (pageIndex, pageSize) => {
} else {
if (ps.localData) {
paging.value?.complete(ps.localData || [])
} else if (ps.showEmpty) {
paging.value?.complete([])
} else {
paging.value?.complete(true)
}
......
......@@ -9,7 +9,13 @@
:disabled="disabled"
:borderBottom="borderBottom"
>
<up-radio :customStyle="getCustomStyle" v-for="(item, index) in getColumns" :key="index" :label="item.label" :name="item.value"></up-radio>
<up-radio
:customStyle="getCustomStyle"
v-for="(item, index) in getColumns"
:key="index"
:label="item[labelField]"
:name="item[valueField]"
></up-radio>
</up-radio-group>
</template>
......@@ -91,9 +97,12 @@ const getAlign = computed(() => {
return radioAlign
})
const getStyle = computed(() => {
return {
justifyContent: getAlign.value
const _style = {}
_style.justifyContent = getAlign.value
if (ps.placement == 'column') {
_style.marginTop = '16rpx'
}
return _style
})
const getCustomStyle = computed(() => {
const _style = {
......@@ -146,4 +155,10 @@ const radioChange = (value) => {
es('change', value)
}
</script>
<style lang="scss" scoped></style>
<style lang="scss">
:deep(.radio-group) {
.u-radio:last-child {
margin-bottom: 0 !important;
}
}
</style>
......@@ -30,7 +30,7 @@ const menuList = ref([
{ id: 'gcfx', name: '工程分析', icon: 'gcfx', group: '运行品质', default: false, count: 0 },
// 航站管理
{ id: 'hzgl', name: '航站管理', icon: 'hzgl', group: '航站管理', default: false, count: 0 },
{ id: 'xydw', name: '协议单位', icon: 'xydw', group: '航站管理', default: false, count: 0 }
{ id: 'xydw', name: '协议单位', icon: 'xydw', group: '航站管理', default: false, count: 0, url: '/panel/workSupervision/list' }
])
const useUserStore = defineStore('mocpUser', {
state: () => {
......
......@@ -542,6 +542,18 @@
"style": {
"navigationBarTitleText": "编辑航站不正常事件"
}
},
{
"path": "pages/modules/mocp/panel/workSupervision/list",
"style": {
"navigationBarTitleText": "协议单位工作监察"
}
},
{
"path": "pages/modules/mocp/panel/workSupervision/answerQuestion",
"style": {
"navigationBarTitleText": "答题"
}
}
],
"globalStyle": {
......
......@@ -98,6 +98,12 @@ const handleHomeMenu = (menu, type) => {
} else {
!menu.isHome && homeMenuList.value.push(menu)
}
} else {
if (menu.url) {
uni.$mocpJump.navigateTo(menu.url)
} else {
uni.$mocpMessage.warning('暂未开放!')
}
}
}
//获取全部应用
......
......@@ -41,10 +41,10 @@
<up-form-item label="机型类别" prop="modelType" :borderBottom="true" required>
<global-picker pickAlign="right" v-model="formData.modelType" dictkey="eb_modelType" clearable></global-picker>
</up-form-item>
<up-form-item label="进港航班号" prop="flightNoIn" :borderBottom="true" required>
<up-form-item label="进港航班号" prop="flightNoIn" :borderBottom="true">
<up-input v-model="formData.flightNoIn" inputAlign="right" border="none" placeholder="请输入" clearable></up-input>
</up-form-item>
<up-form-item label="出港航班号" prop="flightNoOut" :borderBottom="true">
<up-form-item label="出港航班号" prop="flightNoOut" :borderBottom="true" required>
<up-input v-model="formData.flightNoOut" inputAlign="right" border="none" placeholder="请输入" clearable></up-input>
</up-form-item>
</view>
......@@ -60,7 +60,7 @@
<global-switch v-model="formData.originalAircraftPositionDeicing"></global-switch>
</view>
<view class="mocp-switch">
<view class="mocp-switch-label">是否包含预除冰</view>
<view class="mocp-switch-label">预除冰</view>
<global-switch v-model="formData.expectDeicing"></global-switch>
</view>
</view>
......
......@@ -137,6 +137,13 @@ export const rules = reactive({
message: '请选择机型类别',
trigger: ['blur', 'change']
}
],
flightNoOut: [
{
required: true,
message: '请选择出港航班号',
trigger: ['blur', 'change']
}
]
})
export const formRef = ref()
......
......@@ -140,6 +140,8 @@ export const submitDeicing = () => {
if (formData.deicingQuantityTotal && formData.deicingQuantityTotal > 0) {
if (formData.deicingQuantityTotal > limit[1]) {
showDeicing.value = true
} else {
showToast('提交成功')
}
}
}
......@@ -160,6 +162,8 @@ export const submitAntiicing = () => {
if (formData.antiicingQuantityTotal && formData.antiicingQuantityTotal > 0) {
if (formData.antiicingQuantityTotal > limit[1]) {
showAntiicing.value = true
} else {
showToast('提交成功')
}
}
}
......
<template>
<global-page
:title="templateDetail?.templateName"
navLeftType="text"
:showNavRight="formData?.length > 0"
navRightType="button"
navRightText="提交"
:showEmpty="!templateDetail?.questionList?.length"
@handleRightClick="handleSubmit"
>
<view class="mocp-form" v-if="formData?.length > 0">
<up-form labelPosition="left" labelWidth="auto" :model="formData" ref="formRef">
<template v-for="(item, index) in templateDetail?.questionList" :key="item.id">
<!-- 单项填空 -->
<template v-if="item.quType == '0' && showQuestion(item)">
<up-form-item
:label="index + 1 + ',' + item.quName + (item.quDesc ? `[${item.quDesc}]` : '')"
labelPosition="top"
:borderBottom="true"
:required="item.required == '1'"
>
<up-textarea v-model="formData[index].value" placeholder="请输入" :height="40" border="none"></up-textarea>
</up-form-item>
</template>
<!-- 单选|判断 -->
<template v-if="(item.quType == '1' || item.quType == '2') && showQuestion(item)">
<up-form-item
:label="index + 1 + ',' + item.quName + (item.quDesc ? `[${item.quDesc}]` : '')"
labelPosition="top"
:borderBottom="true"
:required="item.required == '1'"
>
<up-radio-group placement="column" v-model="formData[index].value">
<view class="mocp-radio" v-for="(option, optionIndex) in item.quRadioList" :key="option.id">
<up-radio :label="option.optionName" :name="option.id"></up-radio>
<view class="mocp-input">
<up-input
placeholder="请输入"
clearable
v-if="option.isFillblank == '1' && formData[index].value?.includes(option.id)"
v-model="formData[index].quRadioList[optionIndex].value"
></up-input>
</view>
</view>
</up-radio-group>
</up-form-item>
</template>
<!-- 附件 -->
<template v-if="item.quType == '3' && showQuestion(item)">
<up-form-item
:label="index + 1 + ',' + item.quName + (item.quDesc ? `[${item.quDesc}]` : '')"
:borderBottom="true"
:required="item.required == '1'"
labelPosition="top"
>
<view style="margin-top: 16rpx">
<global-upload-image v-model="formData[index].value" map-field-name="id"></global-upload-image>
</view>
</up-form-item>
</template>
<!-- 多选 -->
<template v-if="item.quType == '4' && showQuestion(item)">
<up-form-item
:label="index + 1 + ',' + item.quName + (item.quDesc ? `[${item.quDesc}]` : '')"
labelPosition="top"
:borderBottom="true"
:required="item.required == '1'"
>
<up-checkbox-group placement="column" v-model="formData[index].value">
<view class="mocp-checkbox" v-for="option in item.quRadioList" :key="option.id">
<up-checkbox :label="option.optionName" :name="option.id"></up-checkbox>
<view class="mocp-input">
<up-input
placeholder="请输入"
clearable
v-if="option.isFillblank == '1' && formData[index].value?.includes(option.id)"
v-model="formData[index].quRadioList[optionIndex].value"
></up-input>
</view>
</view>
</up-checkbox-group>
</up-form-item>
</template>
<!-- 多项填空 -->
<template v-if="item.quType == '5' && showQuestion(item)">
<template v-for="(_item, _index) in item.quName?.split('##{input}##')" :key="_index">
<up-form-item
v-if="_item"
:label="
_index == 0
? `${index + 1 + ',' + _item}` + (item.quDesc ? `[${item.quDesc}]` : '')
: `${' ' + _item}` + (item.quDesc ? `[${item.quDesc}]` : '')
"
:borderBottom="true"
:required="item.required == '1'"
>
<up-input
inputAlign="right"
border="none"
placeholder="请输入"
clearable
v-model="formData[index].inputList[_index].value"
></up-input>
</up-form-item>
</template>
</template>
<!-- 日期 -->
<template v-if="item.quType == '6' && showQuestion(item)">
<up-form-item
:label="index + 1 + ',' + item.quName + (item.quDesc ? `[${item.quDesc}]` : '')"
:borderBottom="true"
:required="item.required == '1'"
>
<global-date v-model="formData[index].value" pickAlign="right" clearable></global-date>
</up-form-item>
</template>
<!-- 下拉框 -->
<template v-if="item.quType == '7' && showQuestion(item)">
<up-form-item
:label="index + 1 + ',' + item.quName + (item.quDesc ? `[${item.quDesc}]` : '')"
:borderBottom="true"
:required="item.required == '1'"
>
<global-picker
v-model="formData[index].value"
pickAlign="right"
:options="item.quRadioList"
labelField="optionName"
valueField="id"
clearable
></global-picker>
</up-form-item>
</template>
</template>
</up-form>
</view>
</global-page>
</template>
<script setup>
import { formData, formRef, templateDetail } from './constants/answerQuestion.compositions'
import { onLoad } from '@dcloudio/uni-app'
import { getParams, getSurveyTemplateDetail } from './constants/answerQuestion.functionals'
import { computed } from 'vue'
import { submitAnswersApi } from 'mocp/api/workSupervision'
defineOptions({
name: 'AnswerQuestion'
})
//初始化
const query = defineProps(['templateId'])
onLoad(() => {
getSurveyTemplateDetail(query.templateId)
})
// 验证
const validateQuestions = () => {
const questions = formData.value
for (let i = 0; i < questions.length; i++) {
const question = questions[i]
if (showQuestion(question) && question.required == '1') {
if (question.quType === '5') {
// 多项填空
if (question.inputList && question.inputList.length > 0) {
if (!question.inputList.every((input) => input.value.trim() !== '')) {
return { index: i, question: question }
}
}
} else {
// 单项填空|附件|日期|下拉框|单选|判断|多选
if (!question.value) {
return { index: i, question: question }
}
}
}
}
return null
}
//提交
const handleSubmit = async () => {
const validate = validateQuestions()
if (validate) {
return uni.$mocpMessage.warning(`请填写第${validate.index + 1}题`)
}
const params = getParams(query)
const res = await submitAnswersApi(params, { loading: '提交中...' })
if (res.code == 200) {
uni.$mocpJump.navigateBack()
uni.$mocpMessage.success('提交成功')
} else {
uni.$mocpMessage.error(res.message)
}
}
//回答选择的题ID(单选题和多选题)
const getCgQuItemId = computed(() => {
const getCgQuItemId = []
formData.value.forEach((item) => {
if (['1', '2', '4'].includes(item.quType) && item.value) {
getCgQuItemId.push(item.value)
}
})
return getCgQuItemId
})
//是否展示题目
const showQuestion = (question) => {
return (question.display == '1' && !question.cgQuItemId) || (question.cgQuItemId && getCgQuItemId.value.includes(question.cgQuItemId))
}
</script>
<style lang="scss" scoped>
.mocp-radio,
.mocp-checkbox {
display: flex;
align-items: center;
margin-top: 16rpx;
}
.mocp-input {
margin-left: 16rpx;
}
.mocp-form {
background: #fff;
margin-bottom: 24rpx;
padding: 0 32rpx;
}
</style>
import { ref } from 'vue'
export const formData = ref([])
export const formRef = ref()
export const templateDetail = ref()
import { getSurveyTemplateDetailApi } from 'mocp/api/workSupervision'
import { formData, templateDetail } from './answerQuestion.compositions'
export const getSurveyTemplateDetail = async (templateId) => {
//清空内容
templateDetail.value = undefined
formData.value = []
const res = await getSurveyTemplateDetailApi({ templateId }, { loading: true })
if (res.code == 200) {
templateDetail.value = res.data
formData.value = res.data?.questionList.map((item) => {
//选项
const quRadioList = item.quRadioList.map((option) => {
return {
...option,
value: undefined
}
})
//多选填空输入框
const inputList = []
item.quName?.split('##{input}##').forEach((option) => {
if (option && item.quType == '5') {
inputList.push({ value: '' })
}
})
return {
...item,
quRadioList,
inputList,
value: undefined
}
})
} else {
uni.$mocpMessage.error(res.message)
}
}
export const getParams = ({ templateId, belongId: belongTaskId }) => {
const anAttaList = [] //附件题答案
const anFillblankList = [] //填空题答案
const anRadioList = [] //单选题/多选题/判断题/下拉框答案
const anTimeList = [] //时间题型答案
formData.value.forEach((item) => {
// 附件题答案
if (item.quType == '3') {
anAttaList.push({
templateId,
belongTaskId,
quId: item.id,
atta: item.value
})
}
// 填空题答案
if (item.quType == '0') {
anFillblankList.push({
templateId,
belongTaskId,
quId: item.id,
answer: item.value
})
}
if (item.quType == '5') {
anFillblankList.push({
templateId,
belongTaskId,
quId: item.id,
answer: item.inputList.map((option) => option.value).join(',')
})
}
// 单选题/判断题/多选题/下拉框答案
if (item.quType == '1' || item.quType == '2' || item.quType == '4' || item.quType == '7') {
const quItemId = item.quType == '4' ? item.value.join(',') : item.value
const content = item.quRadioList
.filter((option) => item.value?.includes(option.id) && option.isFillblank == '1')
.map((option) => {
return {
id: option.id,
content: option.value || ''
}
})
if (content.length) {
anRadioList.push({
templateId,
belongTaskId,
quId: item.id,
quItemId,
content
})
} else {
anRadioList.push({
templateId,
belongTaskId,
quId: item.id,
quItemId
})
}
}
// 时间题型答案
if (item.quType == '6') {
anTimeList.push({
templateId,
belongTaskId,
quId: item.id,
answer: item.value
})
}
})
return {
anAttaList: JSON.stringify(anAttaList),
anFillblankList: JSON.stringify(anFillblankList),
anRadioList: JSON.stringify(anRadioList),
anTimeList: JSON.stringify(anTimeList),
repairTaskInfoId: belongTaskId
}
}
<template>
<global-page
title="协议单位工作监察"
isDataList
refresherEnabled
loadingMoreEnabled
auto
ref="paging"
:api="getRepairWorkSupervisionListApi"
:pageSize="20"
:padding="24"
>
<template #default="{ item }">
<view class="work-item" @tap="goTo(item)">
{{ item.taskName }}
<up-icon name="arrow-right"></up-icon>
</view>
</template>
</global-page>
</template>
<script setup>
import { getRepairTaskInfoListApi, getRepairWorkSupervisionListApi } from 'mocp/api/workSupervision'
const goTo = async (row) => {
const res = await getRepairTaskInfoListApi({ id: row.id }, { loading: true })
if (res.code == 200) {
if (res.data?.length) {
uni.$mocpJump.navigateTo('/panel/workSupervision/answerQuestion', { templateId: row.templateId, belongId: res.data[0].id })
} else {
uni.$mocpMessage.error('请下发任务')
}
} else {
uni.$mocpMessage.error(res.message)
}
}
</script>
<style lang="scss" scoped>
.work-item {
background: #fff;
margin-bottom: 16rpx;
border-radius: 12rpx;
padding: 24rpx;
font-size: 28rpx;
color: $mocp-text-5;
display: flex;
align-items: center;
justify-content: space-between;
}
</style>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment