|
|
|
@ -1,10 +1,9 @@ |
|
|
|
|
<template> |
|
|
|
|
<div> |
|
|
|
|
<el-tabs v-model="curTab" |
|
|
|
|
@tab-click="tabChange"> |
|
|
|
|
<el-tabs v-model="curTab"> |
|
|
|
|
<el-tab-pane label="产品审批" |
|
|
|
|
name="tab1"> |
|
|
|
|
<info /> |
|
|
|
|
<info ref="infoRef" /> |
|
|
|
|
<el-form ref="formRef" |
|
|
|
|
:model="form" |
|
|
|
|
:rules="rules" |
|
|
|
@ -32,11 +31,15 @@ |
|
|
|
|
<div class="flex flex-col items-end"> |
|
|
|
|
<div class="mb-[18px] text-sm leading-[1.6]"> |
|
|
|
|
<span class="text-sm font-semibold">审批日期:</span> |
|
|
|
|
<span>2022年10月18日</span> |
|
|
|
|
<span>{{ date }}</span> |
|
|
|
|
</div> |
|
|
|
|
<div class="inline-flex items-center mb-[18px] text-sm leading-[1.6]"> |
|
|
|
|
<span class="text-sm font-semibold">审批员:</span> |
|
|
|
|
<span class="py-2 px-5 ml-1 text-sm text-white bg-[#006BFF] cursor-pointer">签章</span> |
|
|
|
|
<span v-if="signed" |
|
|
|
|
class="text-lg text-[#f00]">{{ signed }}</span> |
|
|
|
|
<span v-else |
|
|
|
|
class="py-2 px-5 ml-1 text-sm text-white bg-[#006BFF] cursor-pointer" |
|
|
|
|
@click="sign">签章</span> |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
<div class="flex justify-end"> |
|
|
|
@ -50,14 +53,17 @@ |
|
|
|
|
</template> |
|
|
|
|
|
|
|
|
|
<script setup lang="ts"> |
|
|
|
|
import { ref, computed, reactive, watch, onMounted } from 'vue'; |
|
|
|
|
import { ref, computed, reactive, onMounted } from 'vue'; |
|
|
|
|
import { ElMessage } from 'element-plus'; |
|
|
|
|
import type { TabsPaneContext, FormInstance, FormRules } from 'element-plus'; |
|
|
|
|
import { useRouter, useRoute } from 'vue-router'; |
|
|
|
|
import Info from './Info.vue'; |
|
|
|
|
import { handleId } from '@/utils/common'; |
|
|
|
|
import { findById, examineAndApprove } from '@/api/bank'; |
|
|
|
|
import { getTheCurrentUserName, getOperationTime } from '@/api/config'; |
|
|
|
|
import { getProcessInformationBasedOnRoles, addOperation } from '@/api/judgment'; |
|
|
|
|
import dayjs from 'dayjs'; |
|
|
|
|
import Cookies from 'js-cookie'; |
|
|
|
|
|
|
|
|
|
const emit = defineEmits(['getList']); |
|
|
|
|
interface RuleForm { |
|
|
|
@ -67,10 +73,14 @@ interface RuleForm { |
|
|
|
|
} |
|
|
|
|
const router = useRouter(); |
|
|
|
|
const route = useRoute(); |
|
|
|
|
const projectId = +Cookies.get('sand-projectId'); |
|
|
|
|
const levelId = +Cookies.get('sand-level'); |
|
|
|
|
const curTab = ref<string>('tab1'); |
|
|
|
|
const date = ref<string>(dayjs(new Date()).format('YYYY-M-D')); |
|
|
|
|
const info = ref<any>({}); |
|
|
|
|
const config = ref<any[]>([]); |
|
|
|
|
const formRef = ref<FormInstance>(); |
|
|
|
|
const infoRef = ref<any>(null); |
|
|
|
|
const form = reactive<RuleForm>({ |
|
|
|
|
id: computed(() => +route.query.id), |
|
|
|
|
status: '', |
|
|
|
@ -80,25 +90,41 @@ const rules = reactive<FormRules<RuleForm>>({ |
|
|
|
|
status: [{ required: true, message: '请选择审批意见', trigger: 'change' }], |
|
|
|
|
opinionDescription: [{ required: true, message: '请输入意见描述', trigger: 'blur' }], |
|
|
|
|
}); |
|
|
|
|
const signed = ref<string>(); |
|
|
|
|
|
|
|
|
|
// tab切换回调 |
|
|
|
|
const tabChange = (tab: TabsPaneContext, event: Event) => { |
|
|
|
|
console.log(tab, event); |
|
|
|
|
}; |
|
|
|
|
// 配置项 |
|
|
|
|
const getConfig = async () => { |
|
|
|
|
const { process } = await getProcessInformationBasedOnRoles(43); // 专家委员会43 |
|
|
|
|
config.value = process; |
|
|
|
|
}; |
|
|
|
|
watch( |
|
|
|
|
() => route.query, |
|
|
|
|
() => { |
|
|
|
|
// getDetail(); |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
immediate: true, |
|
|
|
|
}, |
|
|
|
|
); |
|
|
|
|
// 获取操作日期 |
|
|
|
|
const getDate = async () => { |
|
|
|
|
const res = await getOperationTime(levelId, projectId); |
|
|
|
|
if (res.operationTime) { |
|
|
|
|
date.value = res.operationTime; |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
// 签章 |
|
|
|
|
const sign = async () => { |
|
|
|
|
const res = await getTheCurrentUserName(); |
|
|
|
|
signed.value = res.userName; |
|
|
|
|
}; |
|
|
|
|
// 新增判分记录 |
|
|
|
|
const addRecord = async (data: Record<string, any>) => { |
|
|
|
|
const preIds = `1,${levelId},43`; // 1,关卡id,角色(这个页面是专家委员会审批) |
|
|
|
|
const approved = !!infoRef.value.info.approvalTime; // 有审批时间则表示审批过了,判分点要用第二次审批的id |
|
|
|
|
const lcRule = [ |
|
|
|
|
handleId(approved ? 1215 : 145, 69, data.status, preIds + ',' + (approved ? 1215 : 145), 1), |
|
|
|
|
handleId(approved ? 1216 : 146, 70, data.opinionDescription, preIds + ',' + (approved ? 1216 : 146), 3), |
|
|
|
|
handleId(approved ? 1217 : 758, 233, signed.value ? 514 : 515, preIds + ',' + (approved ? 1217 : 758), 1), |
|
|
|
|
]; |
|
|
|
|
await addOperation({ |
|
|
|
|
checkpointId: levelId, |
|
|
|
|
parentId: preIds, |
|
|
|
|
lcJudgmentRuleReq: lcRule, |
|
|
|
|
projectId, |
|
|
|
|
}); |
|
|
|
|
}; |
|
|
|
|
// 提交 |
|
|
|
|
const submit = async (formEl: FormInstance | undefined) => { |
|
|
|
|
if (!formEl) return; |
|
|
|
@ -106,34 +132,20 @@ const submit = async (formEl: FormInstance | undefined) => { |
|
|
|
|
if (valid) { |
|
|
|
|
try { |
|
|
|
|
const param = JSON.parse(JSON.stringify(form)); |
|
|
|
|
param.approvalTime = dayjs(new Date()).format('YYYY年-M月-D日'); |
|
|
|
|
param.approvalTime = dayjs(new Date()).format('YYYY-M-D'); |
|
|
|
|
|
|
|
|
|
// const { message } = await examineAndApprove(param); |
|
|
|
|
const { message } = await examineAndApprove(param.id, param.opinionDescription, param.status, param.approvalTime); |
|
|
|
|
// addRecord(param, message); |
|
|
|
|
await examineAndApprove(param.id, param.opinionDescription, param.status, param.approvalTime); |
|
|
|
|
addRecord(param); |
|
|
|
|
ElMessage.success('提交成功!'); |
|
|
|
|
emit('getList', 1); |
|
|
|
|
} finally { |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
console.log('error submit!', fields); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
}; |
|
|
|
|
// 新增判分记录 |
|
|
|
|
const addRecord = async (data: Record<string, any>, newId: number) => { |
|
|
|
|
const preIds = `1,2,43,${data.productType ? 45 : 44},${newId}`; // 1,关卡id,角色(这个页面是专家委员会审批),个人/企业(44/45) |
|
|
|
|
const lcRule: Array<Record<string, any>> = [handleId(145, 69, data.status, preIds + ',145', 1), handleId(146, 70, data.opinionDescription, preIds + ',146', 3)]; |
|
|
|
|
|
|
|
|
|
await addOperation({ |
|
|
|
|
checkpointId: +Cookies.get('sand-level'), |
|
|
|
|
parentId: preIds, |
|
|
|
|
lcJudgmentRuleReq: lcRule, |
|
|
|
|
projectId: +Cookies.get('sand-projectId'), |
|
|
|
|
}); |
|
|
|
|
}; |
|
|
|
|
onMounted(() => { |
|
|
|
|
getConfig(); |
|
|
|
|
getDate(); |
|
|
|
|
}); |
|
|
|
|
</script> |
|
|
|
|
|
|
|
|
|