store-manage-app/src/pages/make-card/detail.vue

129 lines
3.3 KiB
Vue

<template>
<view class="px-base" v-if="detail">
<CuNavbar title="补卡详情">
<template v-if="actions.length > 0" #right>
<uv-icon color="white" @click="open" name="more-dot-fill"></uv-icon>
</template>
</CuNavbar>
<view class="mt-30rpx card-shadow bg-white rounded-19rpx px-base text-[#333333] text-27rpx">
<BaseData :colums="detailColumns" :data="detail"></BaseData>
</view>
<uv-action-sheet ref="pickerRef" :actions="actions" @select="confirmPicker" />
<uv-modal ref="modalRef" title="提示" content="确定删除吗?" @confirm="onSubmit" :showCancelButton="true"></uv-modal>
</view>
</template>
<script setup>
import CuNavbar from "@/components/cu-navbar/index"
import { http } from "@/utils/request"
import { onLoad } from "@dcloudio/uni-app"
import { ref } from "vue"
import { timeFormat } from "@climblee/uv-ui/libs/function/index"
import BaseData from '@/pages/audits/base-data.vue'
import statusFun from '@/utils/status'
const modalRef = ref(null)
const actions = ref([
{ name: '修改', value: 'edit', disabled: false },
{ name: '删除', value: 'delete', disabled: false },
{ name: '审核流程', value: 'check-logs', disabled: false }
])
const detail = ref()
const pickerRef = ref(null)
const id = ref(0)
const detailColumns = [
{
title: "审核状态",
dataIndex: "workflow_check.check_status",
format: (value) => statusFun(value, 'statusExpense', 'name')
},
{
title: "申请人",
dataIndex: "employee.name"
},
{
title: "所属门店",
dataIndex: "store.title"
},
{
title: "电话号码",
dataIndex: "employee.phone"
},
{
title: "申请时间",
dataIndex: "created_format"
},
{
title: "补卡时间",
dataIndex: "date_format"
},
{
title: "补卡类别",
dataIndex: "sign_time_text"
},
{
title: "补卡原因",
dataIndex: "reason"
},
{
title: "是否外勤",
dataIndex: "sign_type",
format: (value) => value == 1 ? "否" : "是"
},
{
title: "外勤事由",
dataIndex: "outside_remarks",
isShow: (data) => data?.sign_type == 2
},
{
title: '未通过原因',
dataIndex: 'workflow_check.check_remarks',
labelPosition: 'top',
isShow: (row) => row?.workflow_check.check_status == 4
},
];
const open = () => {
pickerRef.value.open()
}
const confirmPicker = e => {
if (e.value == 'edit') {
uni.navigateTo({
url: `/pages/make-card/create?id=${id.value}`
})
} else if (e.value == 'delete') {
modalRef.value.open()
} else if (e.value == 'check-logs') {
return uni.navigateTo({
url: `/pages/audits/log?id=${detail.value.workflow_check.id}`
})
}
}
const onSubmit = async () => {
try {
await http.delete(`/hr/sign-repairs/${id.value}`)
uni.showToast({
title: "删除成功",
icon: "none"
})
uni.$emit('refresh')
uni.navigateBack()
} catch (error) {
console.log(error)
} finally {
loading.value = false
}
}
onLoad(options => {
id.value = options.id
http.get(`/hr/sign-repairs/${options.id}`).then(res => {
detail.value = res
let status = res.workflow_check.check_status
if ([2, 3].indexOf(status) != -1) {
actions.value[0].disabled = true
actions.value[1].disabled = true
// actions.value.splice(0, 2)
}
})
})
</script>