Merge remote-tracking branch 'origin/main'
This commit is contained in:
commit
6fe72903fd
|
@ -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">
|
||||
|
@ -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,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
|
||||
})
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
})
|
||||
|
@ -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>
|
||||
|
|
|
@ -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) => {
|
||||
|
|
|
@ -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