监督考核页面优化(页面显示、数据等等)
This commit is contained in:
parent
f0aedc78f8
commit
535d509445
|
@ -1,10 +1,11 @@
|
|||
// page {
|
||||
// background-color: #e9eef4;
|
||||
// }
|
||||
page {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
// .container {
|
||||
// background-color: #e9eef4;
|
||||
// }
|
||||
.container {
|
||||
width: 100%;
|
||||
|
||||
}
|
||||
|
||||
.picker {
|
||||
padding: 30rpx 30rpx;
|
||||
|
|
|
@ -37,40 +37,31 @@
|
|||
</view>
|
||||
</view>
|
||||
|
||||
<nut-form>
|
||||
<nut-form-item label-width="50" label="备注">
|
||||
<nut-input v-model="_form.remark" placeholder="请输入备注" type="text" />
|
||||
</nut-form-item>
|
||||
</nut-form>
|
||||
<!-- 签字 -->
|
||||
<view>
|
||||
<nut-form labelWidth="320rpx" labelAlign="left">
|
||||
<nut-form-item label="备注">
|
||||
<nut-input v-model="_form.remark" placeholder="请输入备注" type="text" />
|
||||
</nut-form-item>
|
||||
|
||||
<nut-form-item label="考核人员签字:">
|
||||
<navigator :url="`/subPages/select/signature/signature?index=${1}`" hover-class="navigator-hover">
|
||||
<nut-button style="height: 50rpx" shape="square" type="info">考核人员签字</nut-button>
|
||||
<image v-if="_form.assessmentUserSignature" :src="_form.assessmentUserSignature" mode="heightFix" style="height: 80rpx"></image>
|
||||
<nut-button v-else style="height: 50rpx" shape="square" type="info">考核人员签字</nut-button>
|
||||
</navigator>
|
||||
</nut-form-item>
|
||||
<nut-form-item v-if="mydailycolors">
|
||||
<view style="padding: 0">
|
||||
<image :src="mydailycolors"></image>
|
||||
</view>
|
||||
</nut-form-item>
|
||||
|
||||
<nut-form-item label="被考评学校签名:">
|
||||
<navigator :url="`/subPages/select/signature/signature?index=${2}`" hover-class="navigator-hover">
|
||||
<nut-button style="height: 50rpx" shape="square" type="info">被考评学校负责人</nut-button>
|
||||
<image v-if="_form.byAssessmentEnterprisesUnitUserSignature" :src="_form.byAssessmentEnterprisesUnitUserSignature" mode="heightFix" style="height: 80rpx"></image>
|
||||
<nut-button v-else style="height: 50rpx" shape="square" type="info">被考评学校负责人</nut-button>
|
||||
</navigator>
|
||||
</nut-form-item>
|
||||
<nut-form-item v-if="mydailycolorschools">
|
||||
<view style="padding: 0">
|
||||
<image :src="mydailycolorschools"></image>
|
||||
</view>
|
||||
</nut-form-item>
|
||||
<nut-form-item label="确认:">
|
||||
<nut-button style="height: 50rpx" shape="square" type="info" @click="onSubmit">确认提交</nut-button>
|
||||
</nut-form-item>
|
||||
<view style="height: 20px"></view>
|
||||
</nut-form>
|
||||
</view>
|
||||
<view style="height: 150rpx"></view>
|
||||
<view style="display: flex; width: 100%; justify-content: center; position: fixed; bottom: 50rpx">
|
||||
<nut-button shape="round" type="info" @click="onSubmit" style="height: 80rpx; width: 702rpx; margin: 10rpx auto">确认提交</nut-button>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
|
@ -100,19 +91,16 @@ watch(
|
|||
([newDaily, newBase64_1, newBase64_2]) => {
|
||||
_form.assessmentUserSignature = newBase64_1
|
||||
_form.byAssessmentEnterprisesUnitUserSignature = newBase64_2
|
||||
console.log('watch_______________', _form)
|
||||
|
||||
if (newDaily.length > 0) {
|
||||
starRating.value = newDaily
|
||||
}
|
||||
submitData.value = newDaily
|
||||
console.log('watch_______________', _form, submitData.value)
|
||||
},
|
||||
{ immediate: true }
|
||||
)
|
||||
|
||||
const mydailycolors = ref('')
|
||||
const mydailycolorschools = ref('')
|
||||
|
||||
useLoad(async () => {
|
||||
await getUnitEnterprisesUnitList()
|
||||
})
|
||||
|
@ -149,17 +137,42 @@ interface CkProjectListByType {
|
|||
/**
|
||||
* @assessmentCriteriaRulesByCkProjectId 获取考核规则
|
||||
*/
|
||||
interface StandardList {
|
||||
ckItemId: string
|
||||
deductionPoints: number
|
||||
name: string
|
||||
snowFlakeId: string
|
||||
}
|
||||
interface ItemList {
|
||||
ckGroupId: string
|
||||
name: string
|
||||
remark: string
|
||||
snowFlakeId: string
|
||||
standardList: StandardList[]
|
||||
type: { value: string; label: string }
|
||||
selectedID: string
|
||||
selected_points: number
|
||||
selectedGroup: string[]
|
||||
}
|
||||
interface StarRating {
|
||||
itemList: ItemList[]
|
||||
name: string
|
||||
remark: string
|
||||
snowFlakeId: string
|
||||
totalScore: number
|
||||
currentScore: number
|
||||
}
|
||||
const assessmentCriteriaRulesByCkProjectId = async function (ckProjectId) {
|
||||
Taro.showLoading({
|
||||
title: '加载中...',
|
||||
mask: true,
|
||||
})
|
||||
const res = await api.get<any[]>(`/assessmentCriteria/assessmentCriteriaRulesByCkProjectId`, { ckProjectId })
|
||||
const res = await api.get<StarRating[]>(`/assessmentCriteria/assessmentCriteriaRulesByCkProjectId`, { ckProjectId })
|
||||
// ————————————————————————————————————————处理数据,默认添加已选择项
|
||||
res.data?.forEach((item) => {
|
||||
item.currentScore = 0
|
||||
|
||||
item.itemList.forEach((element) => {
|
||||
item.itemList.forEach((element: ItemList) => {
|
||||
// element.selectedID = element.standardList[0].snowFlakeId
|
||||
element.standardList.unshift({
|
||||
ckItemId: 'null',
|
||||
|
@ -257,9 +270,9 @@ const onSubmit = async function () {
|
|||
mask: true,
|
||||
})
|
||||
|
||||
submitData.value.forEach((element) => {
|
||||
element?.itemList.forEach((item) => {
|
||||
item.standardList.forEach((ele) => {
|
||||
submitData.value.forEach((element: StarRating) => {
|
||||
element?.itemList.forEach((item: ItemList) => {
|
||||
item.standardList.forEach((ele: StandardList) => {
|
||||
if (ele.snowFlakeId === item.selectedID && !item.hasOwnProperty('selectedGroup') && item.selectedID != 'null') {
|
||||
assessmentRecordDetails.value.push({
|
||||
ckGroupId: element.snowFlakeId, //选项的雪花Id
|
||||
|
@ -270,14 +283,15 @@ const onSubmit = async function () {
|
|||
})
|
||||
if (item.hasOwnProperty('selectedGroup')) {
|
||||
item.selectedGroup.forEach((selectedItem) => {
|
||||
console.log(selectedItem)
|
||||
if (selectedItem != 'null') {
|
||||
assessmentRecordDetails.value.push({
|
||||
ckGroupId: element.snowFlakeId, //选项的雪花Id
|
||||
ckItemId: item.snowFlakeId, //已选择的ID
|
||||
ckStandardId: selectedItem, //已选择的雪花ID
|
||||
})
|
||||
}
|
||||
item.standardList.forEach((standard_Element) => {
|
||||
if (selectedItem != 'null' && selectedItem === standard_Element.snowFlakeId) {
|
||||
assessmentRecordDetails.value.push({
|
||||
ckGroupId: element.snowFlakeId, //选项的雪花Id
|
||||
ckItemId: standard_Element.ckItemId, //已选择的ID
|
||||
ckStandardId: selectedItem, //已选择的雪花ID
|
||||
})
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
})
|
||||
|
|
|
@ -1,17 +1,24 @@
|
|||
<template>
|
||||
<nut-signature @confirm="confirm" @clear="clear"></nut-signature>
|
||||
<img v-if="imgData" :src="imgData" class="imgData" style="width: 100%" />
|
||||
<image mode="widthFix" v-if="imgData" :src="imgData" style="width: 100%"></image>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { useDailyStore } from '@/store/daily'
|
||||
const store = useDailyStore()
|
||||
import Taro, { useLoad } from '@tarojs/taro'
|
||||
import { ref } from 'vue'
|
||||
import { ref, computed } from 'vue'
|
||||
const base64_1 = computed(() => store.get_base64_1)
|
||||
const base64_2 = computed(() => store.get_base64_2)
|
||||
|
||||
const _index = ref(0)
|
||||
useLoad((options) => {
|
||||
console.log(options)
|
||||
_index.value = Number(options.index)
|
||||
if (_index.value === 1) {
|
||||
imgData.value = base64_1.value
|
||||
} else {
|
||||
imgData.value = base64_2.value
|
||||
}
|
||||
})
|
||||
const imgData = ref('')
|
||||
const convertToBase64 = (imgUrl: string): Promise<string> => {
|
||||
|
@ -21,6 +28,7 @@ const convertToBase64 = (imgUrl: string): Promise<string> => {
|
|||
filePath: imgUrl, // 本地路径
|
||||
encoding: 'base64',
|
||||
success(res) {
|
||||
// resolve({})
|
||||
resolve('data:image/png;base64,' + res.data) // 前缀加上 image 类型,适应 img 标签
|
||||
},
|
||||
fail(err) {
|
||||
|
@ -31,14 +39,17 @@ const convertToBase64 = (imgUrl: string): Promise<string> => {
|
|||
}
|
||||
const confirm = async (canvas: any, data: string) => {
|
||||
if (data) {
|
||||
imgData.value = data
|
||||
console.log('imgData', canvas, data)
|
||||
try {
|
||||
const base64Image = await convertToBase64(data)
|
||||
if (_index.value === 1) {
|
||||
// imgData.value = base64Image
|
||||
store.change_base64_1(base64Image)
|
||||
Taro.navigateBack({ delta: 1 })
|
||||
} else {
|
||||
// imgData.value = base64Image
|
||||
store.change_base64_2(base64Image)
|
||||
Taro.navigateBack({ delta: 1 })
|
||||
}
|
||||
// console.log('Base64 Image:', base64Image)
|
||||
} catch (error) {
|
||||
|
|
Loading…
Reference in New Issue