返回刷新

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" icon: "none"
}) })
formRef.value.resetFields() formRef.value.resetFields()
uni.$emit('refresh')
uni.navigateBack() uni.navigateBack()
} catch (error) { } catch (error) {
console.log(error) console.log(error)

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -71,7 +71,7 @@
<script setup> <script setup>
import CuNavbar from '@/components/cu-navbar/index' import CuNavbar from '@/components/cu-navbar/index'
import { computed, reactive, ref } from 'vue' 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 useMescrollMore from '@/uni_modules/mescroll-uni/hooks/useMescrollMore.js'
import MescrollItem from '@/components/mescroll-api/more.vue' import MescrollItem from '@/components/mescroll-api/more.vue'
import statusFun from '@/utils/status' 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) => { const goPath = (url) => {
uni.navigateTo({ uni.navigateTo({
url, url,

View File

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

View File

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

View File

@ -55,7 +55,7 @@
v-for="item in list" v-for="item in list"
:key="item.id" :key="item.id"
:title="item.check.subject.type?.name" :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')" :status-color="statusFun(item.check_status,'statusExpense','color')"
:body="[ :body="[
{ label: '申请人: ', value: item.check.subject.employee.name }, { label: '申请人: ', value: item.check.subject.employee.name },
@ -74,10 +74,9 @@
<script setup> <script setup>
import CuNavbar from '@/components/cu-navbar/index' import CuNavbar from '@/components/cu-navbar/index'
import { ref } from 'vue' 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 useMescrollMore from '@/uni_modules/mescroll-uni/hooks/useMescrollMore.js'
import MescrollItem from '@/components/mescroll-api/more.vue' import MescrollItem from '@/components/mescroll-api/more.vue'
import { timeFormat } from '@climblee/uv-ui/libs/function'
import statusFun from '@/utils/status' import statusFun from '@/utils/status'
import ListItem from '@/components/list-item/index' 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 }) => { const tabChange = ({ index }) => {
tabIndex.value = index tabIndex.value = index
scrollToLastY() scrollToLastY()

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -67,7 +67,7 @@
<script setup> <script setup>
import CuNavbar from '@/components/cu-navbar/index' import CuNavbar from '@/components/cu-navbar/index'
import { computed, reactive, ref } from 'vue' 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 useMescrollMore from '@/uni_modules/mescroll-uni/hooks/useMescrollMore.js'
import MescrollItem from '@/components/mescroll-api/more.vue' import MescrollItem from '@/components/mescroll-api/more.vue'
import statusFun from '@/utils/status' 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 }) => { const tabChange = ({ index }) => {
tabIndex.value = index tabIndex.value = index
scrollToLastY() scrollToLastY()

View File

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

View File

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

View File

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