修改上报数据

main
ihzero 2024-05-26 22:44:09 +08:00
parent 7197f9a120
commit 04724f087f
4 changed files with 59 additions and 45 deletions

View File

@ -1,7 +1,7 @@
<template> <template>
<view> <view>
<CuNavbar :isBack="isBack || false" title="数据上报"></CuNavbar> <CuNavbar :isBack="isBack || false" title="数据上报"></CuNavbar>
<view <view
:class="[ :class="[
checkPermission(['store']) && form.allow_rereport checkPermission(['store']) && form.allow_rereport
@ -90,7 +90,9 @@
type="digit" type="digit"
:border="`none`" :border="`none`"
v-model="form.expenditure" v-model="form.expenditure"
:placeholder="`请输入总账${store?.is_lottery_store ? '兑奖' : '支出'}金额`" :placeholder="`请输入总账${
store?.is_lottery_store ? '兑奖' : '支出'
}金额`"
></uv-input> ></uv-input>
</uv-form-item> </uv-form-item>
<uv-line color="#f5f5f5"></uv-line> <uv-line color="#f5f5f5"></uv-line>
@ -150,7 +152,6 @@
class="fixed z-10 bottom-0 left-0 right-0 h-120rpx bg-white flex-center box-border px-base" class="fixed z-10 bottom-0 left-0 right-0 h-120rpx bg-white flex-center box-border px-base"
:style="style" :style="style"
> >
<view class="w-full"> <view class="w-full">
<uv-button <uv-button
:disabled="isRule" :disabled="isRule"
@ -201,15 +202,19 @@ import {
import { useUserStore } from '@/store/modules/user' import { useUserStore } from '@/store/modules/user'
import { timeFormat } from '@climblee/uv-ui/libs/function/index' import { timeFormat } from '@climblee/uv-ui/libs/function/index'
import { empty } from '@climblee/uv-ui/libs/function/test' import { empty } from '@climblee/uv-ui/libs/function/test'
import { add ,sub} from '@/utils/index' import { add, sub } from '@/utils/index'
import checkPermission from '@/utils/permission' import checkPermission from '@/utils/permission'
import { onShow } from '@dcloudio/uni-app' import { onShow } from '@dcloudio/uni-app'
const props = defineProps({ const props = defineProps({
isBack: { isBack: {
type: Boolean, type: Boolean,
default: false default: false,
} },
dete: {
type: String,
default: '',
},
}) })
const calendars = ref(null) const calendars = ref(null)
@ -219,8 +224,12 @@ const userStore = useUserStore()
const userInfo = computed(() => userStore.userInfo || {}) const userInfo = computed(() => userStore.userInfo || {})
const store = computed(() => userInfo.value.store) const store = computed(() => userInfo.value.store)
const endDate = timeFormat(new Date(), 'yyyy-mm-dd')
const isRule = computed(()=>{ const endDate = timeFormat(
props.dete ? new Date(props.dete) : new Date(),
'yyyy-mm-dd'
)
const isRule = computed(() => {
return !form.allow_rereport || !checkPermission(['store']) return !form.allow_rereport || !checkPermission(['store'])
}) })
@ -250,7 +259,7 @@ const rules = reactive({
}, },
expenditure: { expenditure: {
required: true, required: true,
message:`请输入总账${store.value?.is_lottery_store?'兑奖':'支出'}金额`, message: `请输入总账${store.value?.is_lottery_store ? '兑奖' : '支出'}金额`,
}, },
new_customers: { new_customers: {
required: true, required: true,
@ -263,7 +272,6 @@ const rules = reactive({
}, },
}) })
const style = computed(() => { const style = computed(() => {
const style = {} const style = {}
style.bottom = addUnit(sys().windowBottom, 'px') style.bottom = addUnit(sys().windowBottom, 'px')
@ -279,40 +287,36 @@ const submit = () => {
formRef.value.validate().then((res) => { formRef.value.validate().then((res) => {
modalRef.value.open() modalRef.value.open()
}) })
} }
function filterLotteryData(datas) { function filterLotteryData(datas) {
return datas.filter((item) => {
if (empty(item.sales) && empty(item.expenditure)) {
return false
}
return datas.filter(item => { return true
})
if (empty(item.sales) && empty(item.expenditure)) {
return false;
}
return true;
});
} }
function removeEmptyValues(datas) { function removeEmptyValues(datas) {
return datas.map(item => { return datas
// .map((item) => {
const filteredItem = Object.entries(item) //
.filter(([key, value]) => !empty(value)) const filteredItem = Object.entries(item)
.reduce((acc, [key, value]) => { .filter(([key, value]) => !empty(value))
acc[key] = value; .reduce((acc, [key, value]) => {
return acc; acc[key] = value
}, {}); return acc
}, {})
return filteredItem;
}).filter(item => Object.keys(item).length !== 0); // return filteredItem
})
.filter((item) => Object.keys(item).length !== 0) //
} }
const onSubmit = async () => { const onSubmit = async () => {
let valid = false let valid = false
filterLotteryData(form.items).forEach(item => { filterLotteryData(form.items).forEach((item) => {
if (!item.sales) { if (!item.sales) {
valid = true valid = true
return uni.showToast({ return uni.showToast({
@ -320,7 +324,7 @@ const onSubmit = async () => {
icon: 'none', icon: 'none',
}) })
} }
if (!item.expenditure) { if (!item.expenditure) {
valid = true valid = true
return uni.showToast({ return uni.showToast({
@ -459,8 +463,8 @@ const salesChange = async () => {
await nextTick() await nextTick()
const val = form?.items || [] const val = form?.items || []
const sales = val.reduce((a, b) => { const sales = val.reduce((a, b) => {
if(b.operator=='-') return sub(a, b?.sales ?? 0) if (b.operator == '-') return sub(a, b?.sales ?? 0)
else if(b.operator=='+') return add(a, b?.sales ?? 0) else if (b.operator == '+') return add(a, b?.sales ?? 0)
return a return a
}, 0) }, 0)
@ -471,8 +475,8 @@ const expenditureChange = async () => {
await nextTick() await nextTick()
const val = form?.items || [] const val = form?.items || []
const expenditure = val.reduce((a, b) => { const expenditure = val.reduce((a, b) => {
if(b.operator=='-') return sub(a, b?.expenditure ?? 0) if (b.operator == '-') return sub(a, b?.expenditure ?? 0)
else if(b.operator=='+') return add(a, b?.expenditure ?? 0) else if (b.operator == '+') return add(a, b?.expenditure ?? 0)
return a return a
}, 0) }, 0)
form.expenditure = expenditure || 0 form.expenditure = expenditure || 0

View File

@ -56,7 +56,9 @@ const baseColums = [
title: '未通过原因', title: '未通过原因',
dataIndex: 'taskable.workflow_check.check_remarks', dataIndex: 'taskable.workflow_check.check_remarks',
labelPosition: 'top', labelPosition: 'top',
isShow: (row) => row?.taskable?.workflow_check.check_status == 4 isShow: (row) => {
return row?.taskable?.status == 4
}
}, },
] ]
const id = ref(null) const id = ref(null)

View File

@ -26,7 +26,7 @@
v-for="item in list" v-for="item in list"
:key="item.id" :key="item.id"
:title="item.name" :title="item.name"
:status-text="item.taskable.status_text" :status-text="statusFun(item.taskable.status, 'task_hygienes' ,'name')"
:status-color="statusFun(item.taskable.status, 'task_hygienes' ,'color')" :status-color="statusFun(item.taskable.status, 'task_hygienes' ,'color')"
:body="[ :body="[
{label: '任务时间: ', value: item.start_format + '-' + item.end_format} {label: '任务时间: ', value: item.start_format + '-' + item.end_format}
@ -49,11 +49,11 @@
<ListItem <ListItem
v-for="item in list" v-for="item in list"
:key="item.id" :key="item.id"
:title="item.check.subject.task.name" :title="item?.check?.subject?.task?.name"
:status-text="statusFun(item.check_status,'statusExpense2','name')" :status-text="statusFun(item.check_status,'statusExpense2','name')"
:status-color="statusFun(item.check_status,'statusExpense2','color')" :status-color="statusFun(item.check_status,'statusExpense2','color')"
:body="[ :body="[
{label: '任务时间: ', value: item.check.subject.task.start_format + '-' + item.check.subject.task.end_format} {label: '任务时间: ', value: item?.check?.subject?.task?.start_format + '-' + item?.check?.subject?.task?.end_format}
]" ]"
@click.stop="checkClick(item)" @click.stop="checkClick(item)"
/> />
@ -113,7 +113,7 @@ const applyClick = (item) => {
const status = item.taskable.status const status = item.taskable.status
let url let url
if (status === 2 || status == 4) { if (status === 2 || status == 4) {
url = `/pages/task/${type}_submit?id=${item.id}` url = `/pages/task/${type}_submit?id=${item.id}&date=${item.taskable.date}`
} else { } else {
url = `/pages/task/detail?id=${item.id}` url = `/pages/task/detail?id=${item.id}`
} }

View File

@ -1,8 +1,16 @@
<template> <template>
<view> <view>
<RevertPage :isBack="true"></RevertPage> <RevertPage :isBack="true" :dete="date"></RevertPage>
</view> </view>
</template> </template>
<script setup> <script setup>
import { onLoad } from "@dcloudio/uni-app";
import RevertPage from "@/pages/revert/index"; import RevertPage from "@/pages/revert/index";
import { ref } from "vue";
const date = ref("")
onLoad((opt) => {
date.value = opt.date
})
</script> </script>