You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ocr-web/src/views/worksheet/modal/ApprovalModal.vue

364 lines
8.8 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<script lang="ts" setup>
import { nextTick, onDeactivated, onMounted, reactive, ref, toRefs } from 'vue'
import { format } from 'date-fns'
import { NButton, NDataTable, useDialog, useMessage } from 'naive-ui'
import { aiApprovaltools, aiApprovaltoolsClearmark, setTF } from '@/api/work/work'
import { audit } from '@/api/task/task'
import { getToolsCount } from '@/api/home/main'
import { storage } from '@/utils/Storage'
import { CURRENT_USER } from '@/store/mutation-types'
import { useDataHeaderStore } from '@/store/modules/DataHeader'
const emit = defineEmits<{
(e: 'reject', params?: any)
(e: 'notPass', params: any)
}>()
const message = useMessage()
const haeaderstore = useDataHeaderStore()
const dialog = useDialog()
const state: any = reactive({
detail: {},
packageid: '',
})
const { detail } = toRefs(state)
const cardStyle = {
'width': '450px',
'--n-padding-bottom': '10px',
'--n-padding-left': '0px',
}
const show = ref(false)
function showModal(id) {
state.packageid = id
getDetail(id)
}
async function getDetail(id) {
// const userInfo = storage.get(CURRENT_USER);
// const nodeType = userInfo.nodeType;
// id = "264627119490116380";
const res = await aiApprovaltools({ taskid: id })
if (res.code === 'OK') {
state.detail = res.data
if (Number(res.data.pendingApprovaCount) > 0)
show.value = true
}
}
async function handleReject() {
const param = {
result: false,
comment: '',
disposeType: '',
disposeTypeId: '',
failCauseId: '',
failCauseName: '',
flowTaskInfoList: state.detail.flowTaskInfoList,
}
const res = await audit(param)
if (res.code == 'OK') {
haeaderstore.setDataConfig(true)
message.success(res.message)
}
else {
message.error(res.message)
}
emit('reject', state.packageid)
closeModal()
}
async function clearMark() {
const res = await aiApprovaltoolsClearmark({ taskid: state.packageid })
if (res.code === 'OK')
closeModal()
}
function closeModal() {
show.value = false
}
async function reject() {
// emit('reject', { a: 'todo' })
// closeModal()
dialog.info({
title: '确认提示',
content: '确认设置成假吗?',
positiveText: '确定',
negativeText: '取消',
onPositiveClick: async () => {
// TODO需要支持重置
// const result = await resetApproval()
clearMark()
},
onNegativeClick: () => {},
})
}
async function viewRepeat(e: MouseEvent) {
emit('notPass', {
id: state.packageid,
detail: state.detail,
})
e.preventDefault()
closeModal()
}
function initRem() {
const designWidth = 1440
const rempPx = 16
const scale = window.innerWidth / designWidth
document.documentElement.style.fontSize = `${scale * rempPx}px`
}
onMounted(() => {
nextTick(() => {
initRem()
})
window.addEventListener('resize', () => {
initRem()
})
})
onDeactivated(() => {
window.removeEventListener('resize', () => {})
})
defineExpose({
showModal,
})
</script>
<template>
<n-modal :show="show" transform-origin="center" class="modal_wrap">
<div class="wrapper">
<div class="closed">
<SvgIcon style="cursor: pointer" name="cut-down" width="32" @click="closeModal" />
</div>
<div class="wrapper-hearder">
<div class="wrapper-title">
智能AI审批工具
</div>
<div class="wrapper-mark">
{{ detail.tenantUserName || "部门信息" }}
</div>
</div>
<div class="wrapper-content">
<div class="item">
<div class="imgwrapper" />
<div class="back1">
1
</div>
<div class="back2">
2
</div>
<div class="content">
<div class="task_id">
{{ detail.packageName }}
</div>
<div class="tag_box">
<div class="tag_item error">
<span style="color: red"><SvgIcon name="error_icon" size="14" /></span> 重复图片({{
detail.similarComplete || 0
}})
</div>
</div>
<div class="time_box">
任务包生成时间
{{ format(detail?.createTime || 0, "yyyy-MM-dd HH:mm:ss") }}
</div>
</div>
</div>
<div class="mark_text">
<div style=" width: 100px;">
智能提示
</div>
<div>
{{ detail?.similarComplete || 0 }} 张图片相似度为100%重复图片{{
detail?.passCount || 0
}}张审批状态为<span style="color: #02c984">通过</span>剩余{{
detail?.pendingApprovaCount || 0
}}张图片建议审批为不通过
</div>
</div>
<div class="footer" @click="handleReject">
<!-- <SvgIcon
style="cursor: pointer"
name="r3"
width="162"
height="54"
@click="reject"
/>
<SvgIcon
style="cursor: pointer"
name="r2"
width="162"
height="54"
@click="viewRepeat"
/> -->
</div>
</div>
</div>
</n-modal>
</template>
<style lang="less" scoped>
.modal_wrap {
background-image: url(../../../assets/images/approval_modal_bg.png);
background-repeat: no-repeat;
background-size: 100%;
// width: 700px;
// height: 500px;
width: 510px;
height: 361px;
box-shadow: none !important;
}
.wrapper {
position: absolute;
left: 0;
right: 0;
.closed {
position: relative;
top: 0px;
left: 93%;
}
.wrapper-hearder {
margin-top: 10px;
.wrapper-title {
text-align: center;
font-size: 16px;
font-family: PingFang SC, PingFang SC-Semibold;
font-weight: 600;
text-align: center;
color: #333333;
line-height: 22px;
}
.wrapper-mark {
font-size: 13px;
font-family: HarmonyOS Sans SC, HarmonyOS Sans SC-Regular;
font-weight: 400;
text-align: center;
color: #666666;
line-height: 18px;
margin-top: 8px;
}
}
.wrapper-content {
flex: 1;
border-radius: 8px;
margin: 35px 50px 16px 48px;
.item {
display: flex;
flex-flow: row nowrap;
align-items: center;
position: relative;
}
.imgwrapper {
width: 138px;
height: 80px;
margin-right: 23px;
border-radius: 6px;
background-image: url("../../../assets/images/test.png");
background-repeat: no-repeat;
background-size: cover;
z-index: 5;
}
.back1{
position: absolute;
width: 139px;
height: 72px;
background: #cacbd0;
border-radius: 6px;
top:4px;
z-index: 4
}
.back2{
position: absolute;
width: 139px;
height: 60px;
background: #e3e4e7;
border-radius: 6px;
top:10px;
left: 3.5px
}
.content {
.task_id {
font-size: 14px;
font-family: PingFang SC, PingFang SC-Regular;
font-weight: Regular;
text-align: left;
color: #333333;
line-height: 20px;
}
.tag_box {
display: flex;
flex-flow: row nowrap;
margin: 8px 0;
.tag_item {
background: rgba(80, 122, 253, 0.1);
border-radius: 2px;
font-size: 12px;
font-family: PingFang SC, PingFang SC-Regular;
font-weight: Regular;
text-align: left;
color: #507afd;
line-height: 16px;
margin-right: 10px;
}
.error {
height: 20px;
width: 117px;
background: rgba(255, 78, 79, 0.1);
color: #ff4e4f;
padding: 1.5px 9px;
}
}
.time_box {
font-size: 14px;
font-family: PingFang SC, PingFang SC-Regular;
font-weight: Regular;
text-align: left;
color: #333333;
line-height: 20px;
white-space: nowrap;
}
}
.mark_text {
font-size: 13px;
font-family: PingFang SC, PingFang SC-Regular;
font-weight: Regular;
text-align: left;
color: #666666;
line-height: 16px;
margin-top: 16px;
display: flex;
}
.footer {
cursor: pointer;
display: flex;
flex-flow: row nowrap;
align-items: center;
justify-content: center;
margin: 16px auto 0;
width: 132px;
height: 40px;
background: linear-gradient(135deg, #3258e8, #786efc);
border-image: linear-gradient(123deg, #d7dffe 2%, #d7d5ff 88%) 1 1;
border-radius: 23px;
box-shadow: 0px 2px 6px 0px rgba(116, 153, 253, 0.3);
font-size: 18px;
font-family: YouSheBiaoTiHei, YouSheBiaoTiHei-Regular;
font-weight: 550;
text-align: left;
color: #ffffff;
line-height: 26px;
font-style: italic;
}
}
}
</style>