黑龙江民政完成

This commit is contained in:
aixianling
2022-10-25 15:47:46 +08:00
parent c6f85fa328
commit 60c2f64672
6 changed files with 79 additions and 78 deletions

View File

@@ -1,9 +1,9 @@
<template>
<section class="AppForm">
<template v-if="showDetail">
<form-detail/>
<form-detail :actions="actions"/>
</template>
<AiResult v-else :tips="errMsg" :status="errStatus"/>
<AiResult v-else :tips="errMsg" :status="errStatus" class="t-center"/>
</section>
</template>
@@ -24,29 +24,40 @@ export default {
},
computed: {
...mapState(['user']),
showDetail() {
return !!this.$route.query?.id && this.access
},
showDetail: v => !!v.$route.query?.id && v.access,
errMsg() {
this.access && (this.err = "表单不存在")
return this.err || "数据读取中..."
},
errStatus() {
return !!this.err ? "error" : "loading"
errStatus: v => !!v.err ? "error" : "loading",
isPreview: v => !!v.$route.query?.preview,
actions() {
const config = {
default: {
pageTitle: "调查问卷",
common: "appquestionnairetemplate",
detail: "appquestionnairetemplate",
preview: true //是否有预览模式的存在,若存在需要无登录查询模板数据
},
isPreview() {
return !!this.$route.query?.preview
AppAssessmentScoreTask: {
pageTitle: "考核评分",
common: "appassessmentscortask",
detail: "appassessmentscoretemplate",
preview: false, //是否有预览模式的存在,若存在需要无登录查询模板数据
back: true,//填写完是否要返回按钮
}
}
return config[this.$route.query.from || "default"]
},
action: v => v.$route.query.action || "appquestionnairetemplate"
},
methods: {
...mapActions(['getCode', 'getToken']),
checkAccess(review) {
let {code, suiteId, id} = this.$route.query
if (this.isPreview) {
const {code, suiteId, id, result} = this.$route.query
if (this.isPreview || result) {
this.access = true
} else if (!!this.user.token) {
this.$http.post(`/app/${this.action}/commitCheck`, null, {
this.$http.post(`/app/${this.actions.common}/commitCheck`, null, {
params: {id}
}).then(res => {
if (res?.code == 0) {
@@ -54,7 +65,7 @@ export default {
} else if (res?.code == 401) {
this.checkAccess()
} else {
this.err = "无法获取表单"
this.err = res?.msg || "无法获取表单"
}
}).catch(err => {
this.err = err
@@ -70,7 +81,7 @@ export default {
this.checkAccess()
},
onShow() {
document.title = '问卷调查'
document.title = this.actions.pageTitle
wx.hideOptionMenu()
},
}

View File

@@ -6,15 +6,17 @@
<div>成绩</div>
<div class="fill"><em v-html="score"/> </div>
</div>
<u-button v-if="actions.back" type="primary" @click="back">返回</u-button>
</template>
</AiResult>
<template v-else-if="form.id">
<image v-if="form.headPicture" class="headPicture" :src="form.headPicture"/>
<b class="title">{{ form.title || "标题" }}</b>
<div class="tableExplain">{{ form.tableExplain }}</div>
<u-form class="content" label-position="top">
<u-form-item class="item" v-for="(op,i) in fields" :key="i" :label="(i+1)+'.'+op.fieldName"
:required="op.fieldInfo.required==1">
<div class="tableExplain" v-if="form.tableExplain" v-text="form.tableExplain"/>
<AiGroup class="content">
<AiItem class="item" v-for="(op,i) in fields" :key="i" :label="(i+1)+'.'+op.fieldName"
:required="op.fieldInfo.required==1" topLabel>
<div class="color-999 mar-b32" v-if="op.fieldInfo.describe" v-text="op.fieldInfo.describe"/>
<template v-if="op.fieldType=='input'">
<input v-model="op.fieldValue" :placeholder="op.fieldInfo.placeholder" :disabled="isResult"/>
</template>
@@ -27,7 +29,7 @@
</template>
<u-row v-else-if="op.fieldType=='radio'">
<radio-group @change="({detail})=>op.fieldValue=detail.value">
<div class="option" flex v-for="option in op.fieldInfo.options" :key="option.label">
<div class="option mar-b16" flex v-for="option in op.fieldInfo.options" :key="option.label">
<radio :value="option.label" :disabled="isResult" :checked="op.fieldValue==option.label"/>
<AiImage class="option-img" v-if="option.img" :src="option.img" preview/>
<div class="label fill">{{ option.label }}</div>
@@ -36,7 +38,7 @@
</u-row>
<u-row v-else-if="op.fieldType=='checkbox'">
<checkbox-group @change="({detail})=>op.fieldValue=detail.value">
<div class="option" flex v-for="option in op.fieldInfo.options" :key="option.label">
<div class="option mar-b16" flex v-for="option in op.fieldInfo.options" :key="option.label">
<checkbox :value="option.label" :disabled="isResult"
:checked="option.checked"/>
<AiImage class="option-img" v-if="option.img" :src="option.img" preview/>
@@ -53,8 +55,8 @@
</div>
</AiSelect>
</template>
</u-form-item>
</u-form>
</AiItem>
</AiGroup>
<div class="bottom" v-if="!(isPreview||isResult)">
<div class="bottomBtn" @tap="handleSubmit">提交</div>
</div>
@@ -64,11 +66,13 @@
</template>
<script>
import {mapMutations, mapState} from "vuex";
export default {
name: "formDetail",
props: {
actions: Object
},
inject: {root: {}},
computed: {
...mapState(['openUser']),
@@ -81,7 +85,6 @@ export default {
isPreview() {
return !!this.$route.query?.preview
},
action: v => v.$route.query.action || "appquestionnairetemplate"
},
data() {
return {
@@ -113,9 +116,9 @@ export default {
methods: {
...mapMutations(['logout']),
getForm() {
let {id} = this.$route.query
this.$http.post(`/app/${this.action}/queryDetailById`, null, {
withoutToken: true,
let {tid: id} = this.$route.query
this.$http.post(`/app/${this.actions.detail}/queryDetailById`, null, {
withoutToken: this.actions.preview,
params: {id}
}).then(res => {
if (res?.data) {
@@ -124,9 +127,9 @@ export default {
})
},
getResult() {
let {id} = this.$route.query
this.$http.post(`/app/${this.action}/commitCheck`, null, {
params: {id}
let {id, result: alwaysReturn} = this.$route.query
this.$http.post(`/app/${this.actions.common}/commitCheck`, null, {
params: {id}, alwaysReturn
}).then(res => {
if (res?.data) {
this.form = res.data
@@ -144,8 +147,9 @@ export default {
handleSubmit() {
if (this.validateForm()) {
this.handleScore()
let {avatar: avatarUrl, openId, name: nickName, type: userType, unionId, corpName} = this.openUser
this.$http.post(`/app/${this.action}/commit`, {
const {avatar: avatarUrl, openId, name: nickName, type: userType, unionId, corpName} = this.openUser,
{id} = this.$route.query
this.$http.post(`/app/${this.actions.common}/commit`, {
fields: this.fields.map(e => ({
...e,
fieldInfo: JSON.stringify(e.fieldInfo),
@@ -153,7 +157,8 @@ export default {
})),
avatarUrl, openId, nickName, userType, unionId, corpName,
totalScore: this.score,
questionnaireTemplateId: this.$route.query.id
questionnaireTemplateId: id,
taskDetailId: id
}).then(res => {
if (res?.code == 0) {
this.result = {
@@ -206,6 +211,9 @@ export default {
}
})
},
back() {
uni.navigateBack()
}
},
created() {
this.isResult ? this.getResult() : this.getForm()
@@ -271,39 +279,12 @@ export default {
padding: 32px 24px;
}
::v-deep .u-form-item {
.u-form-item--left {
font-size: 30px;
font-weight: bold;
color: #333;
}
.u-form-item--right__content__slot > * {
width: 100%;
}
.display {
justify-content: space-between;
min-height: 58px;
}
.uni-radio-input, .uni-checkbox-input {
height: 32px;
width: 32px;
}
.label {
flex-shrink: 0;
* + & {
margin-left: 16px;
}
}
.content {
padding-top: 64px;
padding-bottom: 200px;
.option {
width: 100%;
margin-right: 16px;
margin-bottom: 16px;
.option-img {
margin-right: 20px;
@@ -316,11 +297,6 @@ export default {
}
}
.content {
padding: 64px 32px 200px;
background: #fff;
}
::v-deep .scorePane {
width: calc(100% - 40px);
padding: 0 32px;

View File

@@ -31,8 +31,9 @@ instance.interceptors.response.use(res => {
if (res.data) {
if (res.data.access_token) {
return res.data
}
if (res.data.code == 0) {
} else if (res.config.alwaysReturn) {
return res.data
} else if (res.data.code == 0) {
return res.data
} else if (res.data.code === 1) {
uni.showToast({

View File

@@ -30,6 +30,7 @@ export default {
getList() {
const {current, total, list} = this
if (current == 1 || list.length < total) {
current == 1 && (this.list = [])
this.getTasks()
}
},

View File

@@ -6,15 +6,15 @@
<div class="color-999">截止日期{{ $dateFormat(detail.endTime, "YYYY-MM-DD HH:mm") }}</div>
</AiGroup>
<AiGroup title="参评人员" description class="pad-t32">
<div flex class="pad-r32 pad-t16 pad-b16" v-for="item in list" :key="item.id" @click="handleScore(item.id)">
<div flex class="pad-r32 pad-t16 pad-b16" v-for="item in list" :key="item.id" @click="handleScore(item.id,item.templateId,!!item.commitTime)">
<div flex class="fill">
<ai-image class="mar-r32" :src="item.evaluatorsAvatar"/>
<AiImage class="mar-r32 circle avatar" :src="item.evaluatorsAvatar"/>
<div>
<h4>{{ item.evaluatorsName }}</h4>
<div class="color-999">{{ item.evaluatorsDepartments }}</div>
</div>
</div>
<div class="result" :class="{finish:item.status==1}">{{ item.status == 1 ? `${item.totalScore || 0}` : "去填报" }}</div>
<div class="result" :class="{finish:!!item.commitTime}">{{ !!item.commitTime ? `${item.totalScore || 0}` : "去填报" }}</div>
</div>
<AiEmpty class="pad-b32" v-if="!list.length"/>
</AiGroup>
@@ -48,6 +48,7 @@ export default {
const {id} = this.$route.query,
{current, list, total} = this
if (current == 1 || list.length < total) {
current == 1 && (this.list = [])
this.$http.post("/app/appassessmentscortask/myScoreList", null, {
params: {id, size: 999, current}
}).then(res => {
@@ -58,8 +59,8 @@ export default {
})
}
},
handleScore(id) {
uni.navigateTo({url: `/apps/AppAskForm/AppForm?id=${id}&action=${appassessmentscortask}`})
handleScore(id, tid, readonly) {
uni.navigateTo({url: `/apps/AppAskForm/AppForm?id=${id}&tid=${tid}&from=AppAssessmentScoreTask` + (readonly ? '&result=1' : '')})
}
},
onShow() {
@@ -89,7 +90,7 @@ export default {
.result {
color: #FFA938;
.finish {
&.finish {
color: #2C51CE;
}
}

View File

@@ -21,6 +21,17 @@
}
}
.avatar {
width: 120px;
height: 120px;
flex-shrink: 0;
}
.circle {
border-radius: 50%;
overflow: hidden;
}
div[flex] {
display: flex;
align-items: center;