返回刷新

main
panliang 2024-04-28 22:50:25 +08:00
parent 54f34af5cf
commit 3d3d101653
22 changed files with 117 additions and 92 deletions

View File

@ -178,6 +178,7 @@ const onSubmit = async () => {
icon: "none"
})
formRef.value.resetFields()
uni.$emit('refresh')
uni.navigateBack()
} catch (error) {
console.log(error)

View File

@ -69,7 +69,7 @@
<script setup>
import CuNavbar from '@/components/cu-navbar/index'
import { ref } from 'vue'
import { onPageScroll, onReachBottom, onShow } from '@dcloudio/uni-app'
import { onPageScroll, onReachBottom, onLoad } from '@dcloudio/uni-app'
import useMescrollMore from '@/uni_modules/mescroll-uni/hooks/useMescrollMore.js'
import MescrollItem from '@/components/mescroll-api/more.vue'
import statusFun from '@/utils/status'
@ -98,6 +98,14 @@ const { tabIndex, getMescroll, scrollToLastY } = useMescrollMore(
onPageScroll,
onReachBottom
)
onLoad(() => {
uni.$on('refresh', () => {
mescrollItem0?.value?.getMescroll()?.resetUpScroll()
mescrollItem1?.value?.getMescroll()?.resetUpScroll()
})
})
const goPath = (url) => {
uni.navigateTo({
url,

View File

@ -63,7 +63,7 @@ export default {
},
{
title: "申请时间",
dataIndex: "check.subject.created_at_format"
dataIndex: "check.subject.created_format"
},
{
title: '报销分类',

View File

@ -77,9 +77,11 @@ const onConfirm = async () => {
status: !modelOptions.isValue,
remarks: modelOptions.isValue ? value.value : '',
})
uni.$emit('audits:onRefresh')
uni.$emit('refresh', { index: 'check' })
uni.navigateBack()
} catch (error) {}
} catch (error) {
console.log(error)
}
}
const onTg = () => {

View File

@ -3,43 +3,23 @@
<CuNavbar title="审核流程"></CuNavbar>
<view class="card-shadow bg-white p-base">
<uv-steps direction="column">
<uv-steps-item
v-for="item in list"
:key="item.id"
:title="item.check_status_text"
:desc="timeFormat(item.checked_at, 'yyyy-mm-dd hh:MM:ss')"
>
<uv-steps-item v-for="item in list" :key="item.id">
<template #icon>
<view
class="w-31rpx h-31rpx rounded-full mt-4rpx"
:class="[
item.check_status == 2 || item.check_status == 3
? 'bg-blue'
: 'bg-gray-300',
]"
></view>
<view class="w-31rpx h-31rpx rounded-full mt-4rpx" :class="[item.check_status == 2 || item.check_status == 3? 'bg-blue': 'bg-gray-300']"></view>
</template>
<template #title>
<view class="space-y-6rpx">
<view class="flex items-center space-x-14rpx">
<view> {{ item.check_user ? item.check_user.name : item.check_name }}</view>
</view>
<view
class="text-24rpx"
:style="{
color: statusFun(item.check_status, 'statusExpense', 'color'),
}"
>{{ item.check_status_text }}</view
>
<view class="text-24rpx text-hex-999" v-if="item.check_status == 4">{{
item.remarks
}}</view>
<view v-if="item.check_status > 1" class="text-26rpx" :style="{ color: statusFun(item.check_status, 'statusExpense', 'color')}">
{{ item.check_status == 2 ? '待审核' : item.check_status_text }}
</view>
<view class="text-26rpx text-red" v-if="item.check_status == 4">{{item.remarks}}</view>
</view>
</template>
<template #desc>
<view v-if="item.checked_at" class="text-22rpx text-hex-999">
{{ timeFormat(item.checked_at, 'yyyy-mm-dd hh:MM:ss') }}
</view>
<view v-if="item.checked_at" class="text-26rpx text-hex-999">{{ item.checked_format }}</view>
</template>
</uv-steps-item>
</uv-steps>
@ -54,12 +34,9 @@ import { computed, ref } from 'vue'
import { timeFormat } from '@climblee/uv-ui/libs/function'
import statusFun from '@/utils/status'
const list = ref([])
// const currentStop = computed(()=>list.value.filter(e=>e.check_status>=3))
onLoad((options) => {
http
.get(`/workflow/${options.id}/logs`)
.then((res) => {
list.value = res
})
http.get(`/workflow/${options.id}/logs`).then((res) => {
list.value = res
})
})
</script>

View File

@ -164,6 +164,7 @@ const onSubmit = async () => {
icon: "none"
})
formRef.value.resetFields()
uni.$emit('refresh')
uni.navigateBack()
} catch (error) {
console.log(error)

View File

@ -74,7 +74,7 @@
<script setup>
import CuNavbar from '@/components/cu-navbar/index'
import { ref } from 'vue'
import { onPageScroll, onReachBottom, onShow } from '@dcloudio/uni-app'
import { onPageScroll, onReachBottom, onLoad } from '@dcloudio/uni-app'
import useMescrollMore from '@/uni_modules/mescroll-uni/hooks/useMescrollMore.js'
import MescrollItem from '@/components/mescroll-api/more.vue'
import statusFun from "@/utils/status"
@ -103,6 +103,13 @@ const { tabIndex, getMescroll, scrollToLastY } = useMescrollMore(
onPageScroll,
onReachBottom
)
onLoad(() => {
uni.$on('refresh', () => {
mescrollItem0?.value?.getMescroll()?.resetUpScroll()
mescrollItem1?.value?.getMescroll()?.resetUpScroll()
})
})
const goPath = (url) => {
uni.navigateTo({
url,

View File

@ -11,18 +11,19 @@
<uv-input placeholder="请输入合同名称" inputAlign="right" :border="`none`" v-model="form.name"> </uv-input>
</uv-form-item>
<uv-line color="#f5f5f5"></uv-line>
<uv-form-item label="合同照片" labelPosition="top" prop="images" required>
<view class="w-full mt-15rpx">
<uv-upload
:maxCount="9"
multiple
:fileList="form.images"
@afterRead="afterRead"
@delete="deletePic"
name="images"
></uv-upload>
</view>
<uv-form-item label="合同照片" prop="images" required>
<view class="text-right w-full text-hex-999">{{ form.images.length }}/{{ maxCount }}</view>
</uv-form-item>
<view class="w-full">
<uv-upload
:maxCount="maxCount"
multiple
:fileList="form.images"
@afterRead="afterRead"
@delete="deletePic"
name="images"
></uv-upload>
</view>
</uv-form>
</view>
<uv-modal ref="modalRef" title="提示" content="确定提交吗?" @confirm="onSubmit" :showCancelButton="true"></uv-modal>
@ -37,6 +38,7 @@ const formRef = ref(null)
const modalRef = ref(null)
const id = ref(0)
const loading = ref(false)
const maxCount = ref(50)
const form = reactive({
name: "",
images: []
@ -100,7 +102,7 @@ const onSubmit = async () => {
})
form.images = []
formRef.value.resetFields()
uni.$emit("task:submit")
uni.$emit('refresh')
uni.navigateBack()
} catch (error) {
console.log(error)

View File

@ -71,7 +71,7 @@
<script setup>
import CuNavbar from '@/components/cu-navbar/index'
import { computed, reactive, ref } from 'vue'
import { onPageScroll, onReachBottom, onShow } from '@dcloudio/uni-app'
import { onPageScroll, onReachBottom, onLoad } from '@dcloudio/uni-app'
import useMescrollMore from '@/uni_modules/mescroll-uni/hooks/useMescrollMore.js'
import MescrollItem from '@/components/mescroll-api/more.vue'
import statusFun from '@/utils/status'
@ -100,6 +100,14 @@ const tabList = ref([
},
},
])
onLoad(() => {
uni.$on('refresh', () => {
mescrollItem0?.value?.getMescroll()?.resetUpScroll()
mescrollItem1?.value?.getMescroll()?.resetUpScroll()
})
})
const goPath = (url) => {
uni.navigateTo({
url,

View File

@ -149,7 +149,7 @@ const onSubmit = async () => {
await http.post(`/train/examinations/${id.value}/answer`, {
answers: answer.value,
})
// uni.$emit('examination:onRefresh')
uni.$emit('examination:onRefresh')
uni.navigateBack()
} catch (error) {
} finally {

View File

@ -38,7 +38,7 @@ const { mescrollItem } = useMescrollComp(onPageScroll, onReachBottom)
onLoad(() => {
uni.$on('examination:onRefresh', () => {
mescrollItem.value?.refresh()
mescrollItem?.value?.refresh()
})
})

View File

@ -55,7 +55,7 @@
v-for="item in list"
:key="item.id"
:title="item.check.subject.type?.name"
:status-text="item.check_status_text"
:status-text="item.check_status == 2 ? '待审核' : item.check_status_text"
:status-color="statusFun(item.check_status,'statusExpense','color')"
:body="[
{ label: '申请人: ', value: item.check.subject.employee.name },
@ -74,10 +74,9 @@
<script setup>
import CuNavbar from '@/components/cu-navbar/index'
import { ref } from 'vue'
import { onPageScroll, onReachBottom } from '@dcloudio/uni-app'
import { onPageScroll, onReachBottom, onLoad } from '@dcloudio/uni-app'
import useMescrollMore from '@/uni_modules/mescroll-uni/hooks/useMescrollMore.js'
import MescrollItem from '@/components/mescroll-api/more.vue'
import { timeFormat } from '@climblee/uv-ui/libs/function'
import statusFun from '@/utils/status'
import ListItem from '@/components/list-item/index'
@ -103,6 +102,13 @@ const tabList = ref([
},
])
onLoad(() => {
uni.$on('refresh', () => {
mescrollItem0?.value?.getMescroll()?.resetUpScroll()
mescrollItem1?.value?.getMescroll()?.resetUpScroll()
})
})
const tabChange = ({ index }) => {
tabIndex.value = index
scrollToLastY()

View File

@ -12,12 +12,8 @@
labelPosition="left"
>
<uv-form-item label="报销分类" required prop="reimbursement_type_id">
<view
@click="openType"
keyName="name"
class="h-full w-full flex justify-end"
>
{{ type.name }}
<view @click="openType" keyName="name" class="h-full w-full flex justify-end">
<view :class="{'text-gray': !type.name }">{{ type.name ?? '请选择' }}</view>
<uv-icon name="arrow-right"></uv-icon>
</view>
</uv-form-item>
@ -29,6 +25,7 @@
type="digit"
input-align="right"
v-model="form.expense"
@blur="handleBlurExpense"
></uv-input>
</uv-form-item>
<uv-line color="#f5f5f5"></uv-line>
@ -94,6 +91,7 @@ const type = ref({})
const modalRef = ref(null)
const formRef = ref(null)
const loading = ref(false)
const id = ref(null)
const form = reactive({
reimbursement_type_id: '',
expense: '',
@ -112,13 +110,7 @@ const rules = reactive({
{
required: true,
type: 'number',
min: 0.01,
max: 22,
message: '报销金额不能小于0.01',
},{
validator: (rule, value) => {
return value > 0
},
min: 0,
message: '报销金额不能小于0',
}
],
@ -132,8 +124,8 @@ const rules = reactive({
onLoad((e) => {
if (e.id) {
id.value = e.id
http.get(`reimbursements/${e.id}`).then(res => {
console.log(res)
type.value = res.type
form.reimbursement_type_id = res.reimbursement_type_id
form.expense = res.expense
@ -148,27 +140,36 @@ onLoad((e) => {
getTypes()
})
const handleBlurExpense = (e) => {
form.expense = Math.floor(e * 100) / 100
}
const submit = () => {
formRef.value.validate().then((res) => {
modalRef.value.open()
})
}).catch(error => {})
}
const onSubmit = async () => {
if (loading.value) return
loading.value = true
try {
const resData = await http.post('/reimbursements', {
const params = {
reimbursement_type_id: form.reimbursement_type_id,
expense: form.expense,
reason: form.reason,
photos: form.photos.map((item) => item.url),
})
}
if (id.value) {
await http.put(`/reimbursements/${id.value}`, params)
} else {
await http.post('/reimbursements', params)
}
uni.showToast({
title: '提交成功',
icon: 'none',
})
formRef.value.resetFields()
uni.$emit('ex:submit', resData)
uni.$emit('refresh', { index: 0 })
uni.navigateBack()
} catch (error) {
} finally {

View File

@ -155,8 +155,8 @@ const onSubmit = async () => {
title: "提交成功",
icon: "none"
})
uni.$emit("make-card:update")
formRef.value.resetFields()
uni.$emit('refresh')
uni.navigateBack()
} catch (error) {
console.log(error)

View File

@ -101,8 +101,9 @@ const { tabIndex, getMescroll, scrollToLastY } = useMescrollMore(
)
onLoad(() => {
uni.$on('make-card:update', () => {
getMescroll(0).resetUpScroll()
uni.$on('refresh', () => {
mescrollItem0?.value?.getMescroll()?.resetUpScroll()
mescrollItem1?.value?.getMescroll()?.resetUpScroll()
})
})

View File

@ -176,6 +176,7 @@ const onSubmit = async () => {
icon: "none"
})
formRef.value.resetFields()
uni.$emit('refresh')
uni.navigateBack()
} catch (error) {
console.log(error)

View File

@ -72,7 +72,7 @@
<script setup>
import CuNavbar from '@/components/cu-navbar/index'
import { ref } from 'vue'
import { onPageScroll, onReachBottom, onShow } from '@dcloudio/uni-app'
import { onPageScroll, onReachBottom, onLoad } from '@dcloudio/uni-app'
import useMescrollMore from '@/uni_modules/mescroll-uni/hooks/useMescrollMore.js'
import MescrollItem from '@/components/mescroll-api/more.vue'
import statusFun from "@/utils/status"
@ -101,6 +101,13 @@ const { tabIndex, getMescroll, scrollToLastY } = useMescrollMore(
onPageScroll,
onReachBottom
)
onLoad(() => {
uni.$on('refresh', () => {
mescrollItem0?.value?.getMescroll()?.resetUpScroll()
mescrollItem1?.value?.getMescroll()?.resetUpScroll()
})
})
const goPath = (url) => {
uni.navigateTo({
url,

View File

@ -271,13 +271,8 @@ const onSubmit = async () => {
data: params,
})
.then((res) => {
uni.$emit('revert:submit', res)
getData()
uni.showToast({
title: '提交成功',
duration: 2000,
icon: 'none',
})
uni.$emit('refresh')
uni.navigateBack()
})
}

View File

@ -67,7 +67,7 @@
<script setup>
import CuNavbar from '@/components/cu-navbar/index'
import { computed, reactive, ref } from 'vue'
import { onPageScroll, onReachBottom, onShow } from '@dcloudio/uni-app'
import { onPageScroll, onReachBottom, onLoad } from '@dcloudio/uni-app'
import useMescrollMore from '@/uni_modules/mescroll-uni/hooks/useMescrollMore.js'
import MescrollItem from '@/components/mescroll-api/more.vue'
import statusFun from '@/utils/status'
@ -98,6 +98,13 @@ const tabList = ref([
},
])
onLoad(() => {
uni.$on('refresh', () => {
mescrollItem0?.value?.getMescroll()?.resetUpScroll()
mescrollItem1?.value?.getMescroll()?.resetUpScroll()
})
})
const tabChange = ({ index }) => {
tabIndex.value = index
scrollToLastY()

View File

@ -117,7 +117,7 @@ const onSubmit = async () => {
icon: 'none',
})
formRef.value.resetFields()
uni.$emit('task:submit')
uni.$emit('refresh')
uni.navigateBack()
} catch (error) {
console.log(error)

View File

@ -282,7 +282,7 @@ const onSubmit = async () => {
icon: 'none',
})
formRef.value.resetFields()
uni.$emit('work:submit')
uni.$emit('refresh')
uni.navigateBack()
} catch (error) {
console.log(error)

View File

@ -89,10 +89,9 @@
<script setup>
import CuNavbar from '@/components/cu-navbar/index'
import { ref } from 'vue'
import { onPageScroll, onReachBottom, onShow } from '@dcloudio/uni-app'
import { onPageScroll, onReachBottom, onLoad } from '@dcloudio/uni-app'
import useMescrollMore from '@/uni_modules/mescroll-uni/hooks/useMescrollMore.js'
import MescrollItem from '@/components/mescroll-api/more.vue'
import { onLoad } from '@dcloudio/uni-app'
import statusFun from '@/utils/status'
import ListItem from '@/components/list-item/index'
@ -126,8 +125,10 @@ const { tabIndex, getMescroll, scrollToLastY } = useMescrollMore(
)
onLoad(() => {
uni.$on('work:submit', () => {
getMescroll(tabIndex.value).resetUpScroll()
uni.$on('refresh', () => {
mescrollItem0?.value?.getMescroll()?.resetUpScroll()
mescrollItem1?.value?.getMescroll()?.resetUpScroll()
mescrollItem2?.value?.getMescroll()?.resetUpScroll()
})
})