main
ihzero 2024-04-30 00:25:29 +08:00
parent 29cb357a1b
commit 444b7c550f
3 changed files with 125 additions and 14 deletions

View File

@ -43,6 +43,9 @@
<uv-checkbox
:customStyle="{ margin: '8px' }"
v-for="(op, i) in item.options"
:activeColor="
(op.selected!=op.is_true && op.selected) ? '#e3e3e3' : '#3678f7'
"
:key="i"
:label="op.text"
:name="i"
@ -50,9 +53,9 @@
<view class="flex items-center">
<view>{{ op.text }}</view>
<uv-icon
v-if="op.selected"
:color="op.is_true ? '#ee2c37' : '#5ac725'"
:name="op.is_true ? 'checkbox-mark' : 'close'"
v-if="op.selected || op.is_true"
:color="op.is_true&&op.selected ? '#4caf50' : '#ee2c37'"
:name="op.is_true&&op.selected ? 'checkbox-mark' : 'close'"
></uv-icon>
</view>
</uv-checkbox>
@ -60,6 +63,7 @@
</template>
<template v-if="item.cate == 1">
<uv-radio-group
v-if="!readonly"
activeColor="#ee2c37"
v-model="item.answer"
placement="column"
@ -81,6 +85,33 @@
</view>
</uv-radio>
</uv-radio-group>
<template v-else>
<uv-checkbox-group
activeColor="#ee2c37"
v-model="item.answer"
placement="column"
>
<uv-checkbox
:customStyle="{ margin: '8px' }"
v-for="(op, i) in item.options"
:activeColor="
(op.selected!=op.is_true && op.selected) ? '#e3e3e3' : '#3678f7'
"
:key="i"
:label="op.text"
:name="i"
>
<view class="flex items-center">
<view>{{ op.text }}</view>
<uv-icon
v-if="op.selected || op.is_true"
:color="op.is_true&&op.selected ? '#4caf50' : '#ee2c37'"
:name="op.is_true&&op.selected ? 'checkbox-mark' : 'close'"
></uv-icon>
</view>
</uv-checkbox>
</uv-checkbox-group>
</template>
</template>
</view>
</view>
@ -117,17 +148,30 @@ const loading = ref(false)
const list = computed(() => {
const content = info.value?.content ?? []
content.forEach((item) => {
if (item.cate == 1) {
item.answer = item.user_answer?.[0] ?? ''
} else {
item.answer = item.user_answer ?? []
}
const trueIndices = item.options.reduce((indices, item, index) => {
if (item.is_true || item.selected) {
indices.push(index)
}
return indices
}, [])
item.answer = trueIndices
// if (item.cate == 1) {
// item.answer = item.user_answer?.[0] ?? ''
// } else {
// item.answer = item.user_answer ?? []
// }
})
return info.value.content || []
})
const total = computed(() => list.value.length)
const readonly = computed(() => (info.value.finished_at ? true : false))
function findAllIndices(arr, predicate) {
console.log(arr)
return arr.filter(predicate).keys()
}
const answer = computed(() => {
const arr = list.value.reduce((a, b) => {
const c = [].concat(b.answer ?? [])

View File

@ -7,6 +7,14 @@
}}</view>
</view>
<view class="mt-14rpx text-hex-999 text-26rpx"> {{ item?.content }} </view>
<view
class="text-right text-hex-999 text-24rpx flex items-center justify-end"
>
<view class="flex items-center">
<view>点击查看详情</view>
<uv-icon size="22rpx" class="ml-10rpx" name="arrow-right"></uv-icon>
</view>
</view>
<view class="absolute right-10rpx top-10rpx" v-if="item.is_read == 0">
<uv-badge :isDot="true" type="error"></uv-badge>
</view>
@ -15,6 +23,34 @@
<script setup>
import { timeFormat } from '@climblee/uv-ui/libs/function/index'
import statusFun from '@/utils/status'
import { http } from '@/utils/request'
const pageData = {
task_hygienes: {
path: '/pages/task/detail',
},
reimbursements: {
path: '/pages/expense-account/detail',
},
employee_promotions: {
path: '/pages/work/detail',
},
employee_sign_repairs: {
path: '/pages/make-card/detail',
},
holiday_applies: {
path: '/pages/ask-leave/detail',
},
offical_business: {
path: '/pages/business/detail',
},
overtime_applies: {
path: '/pages/overtime/detail',
},
agreements: {
path: '/pages/contract/detail',
},
}
const props = defineProps({
item: {
type: Object,
@ -23,11 +59,42 @@ const props = defineProps({
})
const onClick = () => {
props.item.is_read = 1
// props.item.is_read = 1
const { type, is_read, id } = props.item
const { additional } = props.item
const { subject_id, subject_type } = additional.workflow_check
uni.navigateTo({
url: `/pages/audits/detail?id=${subject_id}&type=${subject_type}`,
})
if (is_read == 0) {
http.get(`/message/messages/${id}`)
props.item.is_read = 1
}
if (type == 'approval') {
//
if (additional.workflow_check) {
const { subject_id, subject_type } = additional.workflow_check
const path = pageData[subject_type].path
if (path) {
uni.navigateTo({
url: `${path}?id=${subject_id}&type=${subject_type}`,
})
}
}
//
if (additional.workflow_log) {
const { check } = additional.workflow_log
const { subject_type, subject_id } = check
uni.navigateTo({
url: `/pages/audits/detail?id=${subject_id}&type=${subject_type}`,
})
}
} else if (type == 'exam') {
//
const { paper } = additional
const { id } = paper
uni.navigateTo({
url: `/pages/examination/detail?id=${id}`,
})
}
}
</script>

View File

@ -38,7 +38,7 @@
<view
class="font-600 flex-center h-80rpx"
:class="[
ledger.sales_growth_rate < 0 ? 'text-primary' : 'text-green',
ledger.sales_growth_rate > 0 ? 'text-primary' : 'text-green',
]"
>{{ ledger.sales_growth_rate }}%</view
>