Merge remote-tracking branch 'origin/main'
This commit is contained in:
commit
6fe72903fd
|
@ -1,10 +1,11 @@
|
||||||
// page {
|
page {
|
||||||
// background-color: #e9eef4;
|
position: relative;
|
||||||
// }
|
}
|
||||||
|
|
||||||
// .container {
|
.container {
|
||||||
// background-color: #e9eef4;
|
width: 100%;
|
||||||
// }
|
|
||||||
|
}
|
||||||
|
|
||||||
.picker {
|
.picker {
|
||||||
padding: 30rpx 30rpx;
|
padding: 30rpx 30rpx;
|
||||||
|
|
|
@ -37,40 +37,31 @@
|
||||||
</view>
|
</view>
|
||||||
</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>
|
<view>
|
||||||
<nut-form labelWidth="320rpx" labelAlign="left">
|
<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="考核人员签字:">
|
<nut-form-item label="考核人员签字:">
|
||||||
<navigator :url="`/subPages/select/signature/signature?index=${1}`" hover-class="navigator-hover">
|
<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>
|
</navigator>
|
||||||
</nut-form-item>
|
</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="被考评学校签名:">
|
<nut-form-item label="被考评学校签名:">
|
||||||
<navigator :url="`/subPages/select/signature/signature?index=${2}`" hover-class="navigator-hover">
|
<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>
|
</navigator>
|
||||||
</nut-form-item>
|
</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>
|
</nut-form>
|
||||||
</view>
|
</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>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
<script setup lang="ts">
|
<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 base64_2 = computed(() => store.get_base64_2)
|
||||||
const currentCkProjectId = ref('')
|
const currentCkProjectId = ref('')
|
||||||
const submitData = ref<Item[]>([])
|
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({
|
const _form = reactive({
|
||||||
enterprisesUnitId: '', //企事业单位id
|
enterprisesUnitId: '', //企事业单位id
|
||||||
ckProjectId: '', //考核项目
|
ckProjectId: '', //考核项目
|
||||||
|
@ -108,19 +91,16 @@ watch(
|
||||||
([newDaily, newBase64_1, newBase64_2]) => {
|
([newDaily, newBase64_1, newBase64_2]) => {
|
||||||
_form.assessmentUserSignature = newBase64_1
|
_form.assessmentUserSignature = newBase64_1
|
||||||
_form.byAssessmentEnterprisesUnitUserSignature = newBase64_2
|
_form.byAssessmentEnterprisesUnitUserSignature = newBase64_2
|
||||||
console.log('watch_______________', _form)
|
|
||||||
|
|
||||||
if (newDaily.length > 0) {
|
if (newDaily.length > 0) {
|
||||||
starRating.value = newDaily
|
starRating.value = newDaily
|
||||||
}
|
}
|
||||||
submitData.value = newDaily
|
submitData.value = newDaily
|
||||||
|
console.log('watch_______________', _form, submitData.value)
|
||||||
},
|
},
|
||||||
{ immediate: true }
|
{ immediate: true }
|
||||||
)
|
)
|
||||||
|
|
||||||
const mydailycolors = ref('')
|
|
||||||
const mydailycolorschools = ref('')
|
|
||||||
|
|
||||||
useLoad(async () => {
|
useLoad(async () => {
|
||||||
await getUnitEnterprisesUnitList()
|
await getUnitEnterprisesUnitList()
|
||||||
})
|
})
|
||||||
|
@ -129,15 +109,6 @@ const Onrating = function (name: string, snowFlakeId: string) {
|
||||||
let index = starRating.value.findIndex((item) => item.snowFlakeId === snowFlakeId)
|
let index = starRating.value.findIndex((item) => item.snowFlakeId === snowFlakeId)
|
||||||
Taro.navigateTo({
|
Taro.navigateTo({
|
||||||
url: `/subPages/select/dailyLife/dailyLife?name=${name}&index=${index}`,
|
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 {
|
interface UnitEnterprisesUnitList {
|
||||||
|
@ -166,17 +137,42 @@ interface CkProjectListByType {
|
||||||
/**
|
/**
|
||||||
* @assessmentCriteriaRulesByCkProjectId 获取考核规则
|
* @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) {
|
const assessmentCriteriaRulesByCkProjectId = async function (ckProjectId) {
|
||||||
Taro.showLoading({
|
Taro.showLoading({
|
||||||
title: '加载中...',
|
title: '加载中...',
|
||||||
mask: true,
|
mask: true,
|
||||||
})
|
})
|
||||||
const res = await api.get<any[]>(`/assessmentCriteria/assessmentCriteriaRulesByCkProjectId`, { ckProjectId })
|
const res = await api.get<StarRating[]>(`/assessmentCriteria/assessmentCriteriaRulesByCkProjectId`, { ckProjectId })
|
||||||
// ————————————————————————————————————————处理数据,默认添加已选择项
|
// ————————————————————————————————————————处理数据,默认添加已选择项
|
||||||
res.data?.forEach((item) => {
|
res.data?.forEach((item) => {
|
||||||
item.currentScore = 0
|
item.currentScore = 0
|
||||||
|
|
||||||
item.itemList.forEach((element) => {
|
item.itemList.forEach((element: ItemList) => {
|
||||||
// element.selectedID = element.standardList[0].snowFlakeId
|
// element.selectedID = element.standardList[0].snowFlakeId
|
||||||
element.standardList.unshift({
|
element.standardList.unshift({
|
||||||
ckItemId: 'null',
|
ckItemId: 'null',
|
||||||
|
@ -274,9 +270,9 @@ const onSubmit = async function () {
|
||||||
mask: true,
|
mask: true,
|
||||||
})
|
})
|
||||||
|
|
||||||
submitData.value.forEach((element) => {
|
submitData.value.forEach((element: StarRating) => {
|
||||||
element?.itemList.forEach((item) => {
|
element?.itemList.forEach((item: ItemList) => {
|
||||||
item.standardList.forEach((ele) => {
|
item.standardList.forEach((ele: StandardList) => {
|
||||||
if (ele.snowFlakeId === item.selectedID && !item.hasOwnProperty('selectedGroup') && item.selectedID != 'null') {
|
if (ele.snowFlakeId === item.selectedID && !item.hasOwnProperty('selectedGroup') && item.selectedID != 'null') {
|
||||||
assessmentRecordDetails.value.push({
|
assessmentRecordDetails.value.push({
|
||||||
ckGroupId: element.snowFlakeId, //选项的雪花Id
|
ckGroupId: element.snowFlakeId, //选项的雪花Id
|
||||||
|
@ -287,15 +283,16 @@ const onSubmit = async function () {
|
||||||
})
|
})
|
||||||
if (item.hasOwnProperty('selectedGroup')) {
|
if (item.hasOwnProperty('selectedGroup')) {
|
||||||
item.selectedGroup.forEach((selectedItem) => {
|
item.selectedGroup.forEach((selectedItem) => {
|
||||||
console.log(selectedItem)
|
item.standardList.forEach((standard_Element) => {
|
||||||
if (selectedItem != 'null') {
|
if (selectedItem != 'null' && selectedItem === standard_Element.snowFlakeId) {
|
||||||
assessmentRecordDetails.value.push({
|
assessmentRecordDetails.value.push({
|
||||||
ckGroupId: element.snowFlakeId, //选项的雪花Id
|
ckGroupId: element.snowFlakeId, //选项的雪花Id
|
||||||
ckItemId: item.snowFlakeId, //已选择的ID
|
ckItemId: standard_Element.ckItemId, //已选择的ID
|
||||||
ckStandardId: selectedItem, //已选择的雪花ID
|
ckStandardId: selectedItem, //已选择的雪花ID
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
@ -311,7 +308,7 @@ const onSubmit = async function () {
|
||||||
console.log('🚀 ~ onSubmit ~ result:', result)
|
console.log('🚀 ~ onSubmit ~ result:', result)
|
||||||
Taro.hideLoading()
|
Taro.hideLoading()
|
||||||
store.dailyinspectionList([]) //清空数据
|
store.dailyinspectionList([]) //清空数据
|
||||||
assessmentRecordDetails.value = []
|
assessmentRecordDetails.value = [] //清空数据
|
||||||
assessmentCriteriaRulesByCkProjectId(currentCkProjectId.value) //重新获取数据
|
assessmentCriteriaRulesByCkProjectId(currentCkProjectId.value) //重新获取数据
|
||||||
if (result.code === 200) {
|
if (result.code === 200) {
|
||||||
Taro.showToast({
|
Taro.showToast({
|
||||||
|
@ -324,9 +321,4 @@ const onSubmit = async function () {
|
||||||
_showToast(result.message)
|
_showToast(result.message)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// useDidShow(() => {
|
|
||||||
// // 测试 pinia 数据是否更新
|
|
||||||
// console.log('onShow_______________测试 pinia 数据是否更新', submitData.value)
|
|
||||||
// })
|
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -44,23 +44,10 @@ useLoad((options) => {
|
||||||
})
|
})
|
||||||
|
|
||||||
findIndex.value = options.index
|
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)
|
const daily = computed(() => store.getdailyinspection)
|
||||||
|
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
daily,
|
daily,
|
||||||
(newData) => {
|
(newData) => {
|
||||||
|
|
|
@ -1,17 +1,24 @@
|
||||||
<template>
|
<template>
|
||||||
<nut-signature @confirm="confirm" @clear="clear"></nut-signature>
|
<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>
|
</template>
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { useDailyStore } from '@/store/daily'
|
import { useDailyStore } from '@/store/daily'
|
||||||
const store = useDailyStore()
|
const store = useDailyStore()
|
||||||
import Taro, { useLoad } from '@tarojs/taro'
|
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)
|
const _index = ref(0)
|
||||||
useLoad((options) => {
|
useLoad((options) => {
|
||||||
console.log(options)
|
console.log(options)
|
||||||
_index.value = Number(options.index)
|
_index.value = Number(options.index)
|
||||||
|
if (_index.value === 1) {
|
||||||
|
imgData.value = base64_1.value
|
||||||
|
} else {
|
||||||
|
imgData.value = base64_2.value
|
||||||
|
}
|
||||||
})
|
})
|
||||||
const imgData = ref('')
|
const imgData = ref('')
|
||||||
const convertToBase64 = (imgUrl: string): Promise<string> => {
|
const convertToBase64 = (imgUrl: string): Promise<string> => {
|
||||||
|
@ -21,6 +28,7 @@ const convertToBase64 = (imgUrl: string): Promise<string> => {
|
||||||
filePath: imgUrl, // 本地路径
|
filePath: imgUrl, // 本地路径
|
||||||
encoding: 'base64',
|
encoding: 'base64',
|
||||||
success(res) {
|
success(res) {
|
||||||
|
// resolve({})
|
||||||
resolve('data:image/png;base64,' + res.data) // 前缀加上 image 类型,适应 img 标签
|
resolve('data:image/png;base64,' + res.data) // 前缀加上 image 类型,适应 img 标签
|
||||||
},
|
},
|
||||||
fail(err) {
|
fail(err) {
|
||||||
|
@ -31,14 +39,17 @@ const convertToBase64 = (imgUrl: string): Promise<string> => {
|
||||||
}
|
}
|
||||||
const confirm = async (canvas: any, data: string) => {
|
const confirm = async (canvas: any, data: string) => {
|
||||||
if (data) {
|
if (data) {
|
||||||
imgData.value = data
|
|
||||||
console.log('imgData', canvas, data)
|
console.log('imgData', canvas, data)
|
||||||
try {
|
try {
|
||||||
const base64Image = await convertToBase64(data)
|
const base64Image = await convertToBase64(data)
|
||||||
if (_index.value === 1) {
|
if (_index.value === 1) {
|
||||||
|
// imgData.value = base64Image
|
||||||
store.change_base64_1(base64Image)
|
store.change_base64_1(base64Image)
|
||||||
|
Taro.navigateBack({ delta: 1 })
|
||||||
} else {
|
} else {
|
||||||
|
// imgData.value = base64Image
|
||||||
store.change_base64_2(base64Image)
|
store.change_base64_2(base64Image)
|
||||||
|
Taro.navigateBack({ delta: 1 })
|
||||||
}
|
}
|
||||||
// console.log('Base64 Image:', base64Image)
|
// console.log('Base64 Image:', base64Image)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|
Loading…
Reference in New Issue