黑龙江民政完成

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

View File

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

View File

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

View File

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

View File

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

View File

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