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

311 lines
7.7 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 { getToolsCount } from "@/api/home/main";
import { storage } from "@/utils/Storage";
import { CURRENT_USER } from "@/store/mutation-types";
const emit = defineEmits<{
(e: "reject", params: any);
(e: "notPass", params: any);
}>();
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 = "264626184091111068";
const res = await aiApprovaltools({ taskid: id });
if (res.code === "OK") {
state.detail = res.data;
show.value = true;
}
}
const handleReject = async () => {
const res = await setTF({
taskchildpictureids: state.detail.taskIdList.join(","),
packageid: state.packageid,
iztrueorfalse: 0,
});
console.log(res, "handleReject");
};
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();
}
async function getShowStatus() {
const res = await getToolsCount();
if (res.code == "OK") {
show.value = true;
}
}
const initRem = () => {
const designWidth = 1440;
const rempPx = 16;
const scale = window.innerWidth / designWidth;
document.documentElement.style.fontSize = scale * rempPx + "px";
};
onMounted(() => {
getShowStatus();
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="content">
<div class="task_id">#AI任务包{{ detail.packageId }}</div>
<div class="tag_box">
<div class="tag_item error">
<span style="color: red">error</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">
智能提示{{ detail?.similarComplete || 0 }} 张图片相似度为100%重复图片{{
detail?.passCount || 0
}}张审批状态为<span style="color: #02c984">通过</span>剩余{{
detail?.pendingApprovaCount || 0
}}张图片建议审批为不通过
</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: calc(50% - 350px);
.closed {
position: relative;
top: 0px;
left: 90%;
}
.wrapper-hearder {
margin-top: 20px;
.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: 24px 50px 16px 48px;
.item {
display: flex;
flex-flow: row nowrap;
align-items: center;
}
.imgwrapper {
width: 138px;
height: 80px;
margin-right: 23px;
border-radius: 8px;
background-image: url("../../../assets/images/test.png");
background-repeat: no-repeat;
background-size: cover;
}
.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 {
background: rgba(255, 78, 79, 0.1);
color: #ff4e4f;
}
}
.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;
}
.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: 20px;
font-family: YouSheBiaoTiHei, YouSheBiaoTiHei-Regular;
font-weight: Regular;
text-align: left;
color: #ffffff;
line-height: 26px;
font-style: italic;
}
}
}
</style>