Merge remote-tracking branch 'origin/main'

This commit is contained in:
wangyilin 2024-11-11 11:27:32 +08:00
commit 6fe72903fd
4 changed files with 76 additions and 85 deletions

View File

@ -1,10 +1,11 @@
// page {
// background-color: #e9eef4;
// }
page {
position: relative;
}
// .container {
// background-color: #e9eef4;
// }
.container {
width: 100%;
}
.picker {
padding: 30rpx 30rpx;

View File

@ -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">
@ -87,15 +78,7 @@ const base64_1 = computed(() => store.get_base64_1)
const base64_2 = computed(() => store.get_base64_2)
const currentCkProjectId = ref('')
const submitData = ref<Item[]>([])
// watch(
// daily,
// (newData) => {
// console.log('watch_______________', newData)
// if (newData.length > 0) starRating.value = newData
// submitData.value = newData
// },
// { immediate: true }
// )
const _form = reactive({
enterprisesUnitId: '', //id
ckProjectId: '', //
@ -108,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()
})
@ -129,15 +109,6 @@ const Onrating = function (name: string, snowFlakeId: string) {
let index = starRating.value.findIndex((item) => item.snowFlakeId === snowFlakeId)
Taro.navigateTo({
url: `/subPages/select/dailyLife/dailyLife?name=${name}&index=${index}`,
// url: `/subPages/select/dailyLife/dailyLife`,
// success: function (res) {
// try {
// if (process.env.TARO_ENV === 'weapp') {
// res.eventChannel.emit('starRating', { data: selectedItemList })
// }
// } catch (error) {
// }
// },
})
}
interface UnitEnterprisesUnitList {
@ -166,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',
@ -274,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
@ -287,15 +283,16 @@ const onSubmit = async function () {
})
if (item.hasOwnProperty('selectedGroup')) {
item.selectedGroup.forEach((selectedItem) => {
console.log(selectedItem)
if (selectedItem != 'null') {
item.standardList.forEach((standard_Element) => {
if (selectedItem != 'null' && selectedItem === standard_Element.snowFlakeId) {
assessmentRecordDetails.value.push({
ckGroupId: element.snowFlakeId, //Id
ckItemId: item.snowFlakeId, //ID
ckItemId: standard_Element.ckItemId, //ID
ckStandardId: selectedItem, //ID
})
}
})
})
}
})
})
@ -311,7 +308,7 @@ const onSubmit = async function () {
console.log('🚀 ~ onSubmit ~ result:', result)
Taro.hideLoading()
store.dailyinspectionList([]) //
assessmentRecordDetails.value = []
assessmentRecordDetails.value = [] //
assessmentCriteriaRulesByCkProjectId(currentCkProjectId.value) //
if (result.code === 200) {
Taro.showToast({
@ -324,9 +321,4 @@ const onSubmit = async function () {
_showToast(result.message)
}
}
// useDidShow(() => {
// // pinia
// console.log('onShow_______________ pinia ', submitData.value)
// })
</script>

View File

@ -44,23 +44,10 @@ useLoad((options) => {
})
findIndex.value = options.index
// console.log('starRating.value_______________', starRating.value)
// if (process.env.TARO_ENV === 'weapp') {
// const instance = Taro.getCurrentInstance()
// const eventChannel = instance.page.getOpenerEventChannel()
// eventChannel.on('starRating', function (data) {
// Taro.setNavigationBarTitle({
// title: data.data.name,
// })
// airdefenceEnumdata.value = [...data.data.itemList]
// })
// }
})
const daily = computed(() => store.getdailyinspection)
watch(
daily,
(newData) => {

View File

@ -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) {