文号更新
This commit is contained in:
parent
0cb0b9307f
commit
1b04dba5f5
@ -419,8 +419,8 @@ const updateNumber = async (date) => {
|
|||||||
const numberDate = await ClglApi.getClgl(date.id)
|
const numberDate = await ClglApi.getClgl(date.id)
|
||||||
const data = numberDate as unknown as ClglVO
|
const data = numberDate as unknown as ClglVO
|
||||||
// 检查编号类型是否为文号
|
// 检查编号类型是否为文号
|
||||||
if (data.numberType !== 1) {
|
if (data.numberType !== 1 && data.numberType ) {
|
||||||
message.error("编号类型不是文号!")
|
message.error("编号类型非文号!")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
// 检查是否已存在 usageName
|
// 检查是否已存在 usageName
|
||||||
|
@ -582,6 +582,60 @@
|
|||||||
</el-form>
|
</el-form>
|
||||||
</div>
|
</div>
|
||||||
</el-popover>
|
</el-popover>
|
||||||
|
|
||||||
|
<!--【文号】按钮 这个对应表单的文号, 只有对应节点可以选取文号 -->
|
||||||
|
<el-popover
|
||||||
|
:visible="popOverVisible.numbers"
|
||||||
|
placement="top-start"
|
||||||
|
:width="420"
|
||||||
|
trigger="click"
|
||||||
|
v-if="runningTask && isHandleTaskStatus() && isShowButton(OperationButtonType.NUMBER)"
|
||||||
|
>
|
||||||
|
<template #reference>
|
||||||
|
<div @click="openPopover('numbers')" class="hover-bg-gray-100 rounded-xl p-6px">
|
||||||
|
<Icon :size="14" icon="fa:mail-reply" />
|
||||||
|
{{ getButtonDisplayName(OperationButtonType.NUMBER) }}
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<div class="flex flex-col flex-1 pt-20px px-20px" v-loading="formLoading">
|
||||||
|
<el-form
|
||||||
|
label-position="top"
|
||||||
|
class="mb-auto"
|
||||||
|
ref="numbersFormRef"
|
||||||
|
:model="numbersForm"
|
||||||
|
:rules="numbersFormRule"
|
||||||
|
label-width="100px"
|
||||||
|
>
|
||||||
|
<el-form-item label="选择文号">
|
||||||
|
<span class="text-#878c93 text-12px"> 选择文号,确认后保存</span>
|
||||||
|
<el-table
|
||||||
|
:data="ListNumber"
|
||||||
|
highlight-current-row
|
||||||
|
@current-change="handleChangeNumbers"
|
||||||
|
>
|
||||||
|
<el-table-column width="60" label="序号" align="center" type="index" />
|
||||||
|
<el-table-column label="文号" >
|
||||||
|
<template #default="scope">
|
||||||
|
{{
|
||||||
|
(scope.row.fastCode || "") + (scope.row.fastBrackets || "") + (scope.row.year || "") +
|
||||||
|
((scope.row.month != null&&scope.row.month!=0) ? scope.row.month.toString().padStart(2,"0") : "") +
|
||||||
|
((scope.row.lastBrackets) || "") +
|
||||||
|
((scope.row.docOrder || "").toString().padStart(scope.row.lengthSelection,"0")) +
|
||||||
|
(scope.row.lastCode || "")
|
||||||
|
}}
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item>
|
||||||
|
<el-button :disabled="formLoading" type="primary" @click="handleNumbers()">
|
||||||
|
确认
|
||||||
|
</el-button>
|
||||||
|
<el-button @click="closePropover('numbers', numbersFormRef)"> 取消 </el-button>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
</div>
|
||||||
|
</el-popover>
|
||||||
<!-- 【再次提交】 按钮-->
|
<!-- 【再次提交】 按钮-->
|
||||||
<div
|
<div
|
||||||
@click="handleReCreate()"
|
@click="handleReCreate()"
|
||||||
@ -612,13 +666,14 @@ import { BpmProcessInstanceStatus, BpmModelFormType } from '@/utils/constants'
|
|||||||
import type { FormInstance, FormRules } from 'element-plus'
|
import type { FormInstance, FormRules } from 'element-plus'
|
||||||
import {UserVO} from "@/api/system/user";
|
import {UserVO} from "@/api/system/user";
|
||||||
import {Edit} from "@element-plus/icons-vue";
|
import {Edit} from "@element-plus/icons-vue";
|
||||||
|
import {numbersApi, numbersVO} from "@/api/home/numbers";
|
||||||
defineOptions({ name: 'ProcessInstanceBtnContainer' })
|
defineOptions({ name: 'ProcessInstanceBtnContainer' })
|
||||||
|
|
||||||
const router = useRouter() // 路由
|
const router = useRouter() // 路由
|
||||||
const message = useMessage() // 消息弹窗
|
const message = useMessage() // 消息弹窗
|
||||||
|
|
||||||
const userId = useUserStoreWithOut().getUser.id // 当前登录的编号
|
const userId = useUserStoreWithOut().getUser.id // 当前登录的编号
|
||||||
const emit = defineEmits(['success']) // 定义 success 事件,用于操作成功后的回调
|
const emit = defineEmits(['success', 'update']) // 定义 success 事件,用于操作成功后的回调
|
||||||
|
|
||||||
const props = defineProps< {
|
const props = defineProps< {
|
||||||
processInstance: any, // 流程实例信息
|
processInstance: any, // 流程实例信息
|
||||||
@ -627,8 +682,99 @@ const props = defineProps< {
|
|||||||
normalForm: any, // 流程表单 formCreate
|
normalForm: any, // 流程表单 formCreate
|
||||||
normalFormApi: any, // 流程表单 formCreate Api
|
normalFormApi: any, // 流程表单 formCreate Api
|
||||||
writableFields: string[] // 流程表单可以编辑的字段
|
writableFields: string[] // 流程表单可以编辑的字段
|
||||||
|
buttonNumberPath: any // 异步组件路径
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
|
const listNumbers = ref(); // 流水数据
|
||||||
|
const ListNumber = ref<numbersVO[]>([]) // 列表数据
|
||||||
|
// 搜索数据vo
|
||||||
|
const queryParamsNumbers = reactive({
|
||||||
|
pageNo: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
id: undefined,
|
||||||
|
fastCode: undefined,
|
||||||
|
fastBrackets: undefined,
|
||||||
|
year: undefined,
|
||||||
|
month: undefined,
|
||||||
|
lastBrackets: undefined,
|
||||||
|
docOrder: undefined,
|
||||||
|
lastCode: undefined,
|
||||||
|
enableMonth: undefined,
|
||||||
|
numbersType: undefined as number | undefined,
|
||||||
|
lengthSelection: undefined,
|
||||||
|
mappingData1: undefined as string | undefined,
|
||||||
|
mappingData2: undefined as string | undefined,
|
||||||
|
annotation: undefined,
|
||||||
|
createTime: [],
|
||||||
|
})
|
||||||
|
const formData = ref({
|
||||||
|
serialNumber: undefined as string | undefined,
|
||||||
|
})
|
||||||
|
|
||||||
|
// 根据编号类型获取编号数据后更新数据
|
||||||
|
const getNumberByType = async ()=> {
|
||||||
|
listNumbers.value = formData.value.serialNumber = undefined;
|
||||||
|
//获取文号数据
|
||||||
|
queryParamsNumbers.numbersType = 1
|
||||||
|
queryParamsNumbers.mappingData2 = props.buttonNumberPath
|
||||||
|
const data = await numbersApi.getnumbersPage(queryParamsNumbers)
|
||||||
|
if (data.total == 0) {
|
||||||
|
message.error("未找到文号数据!请配置文号!")
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//判断条数,如果只有一条就和流水号一样直接处理
|
||||||
|
if (data.total == 1 ) {
|
||||||
|
listNumbers.value = data.list[0]
|
||||||
|
await changeNumbers();
|
||||||
|
} else {
|
||||||
|
// 两条以上数据,给用户挑选,然后处理
|
||||||
|
ListNumber.value = data.list;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取旧数据后对比数据后更新
|
||||||
|
const changeNumbers = async ()=> {
|
||||||
|
if (!listNumbers.value) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const currentYear = new Date().getFullYear();
|
||||||
|
const currentMonth = new Date().getMonth() + 1;
|
||||||
|
listNumbers.value.docOrder+=1
|
||||||
|
|
||||||
|
// 判断年份不同时 更新年份,顺序号归一
|
||||||
|
if (currentYear != listNumbers.value.year) {
|
||||||
|
listNumbers.value.year = currentYear;
|
||||||
|
listNumbers.value.docOrder = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 判断月份不同时,判断不是禁用月份的时候 更新月份,顺序号归一
|
||||||
|
if (currentMonth != listNumbers.value.month&&listNumbers.value.month!==0) {
|
||||||
|
listNumbers.value.month = currentMonth;
|
||||||
|
listNumbers.value.docOrder = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 提取内部函数方便使用
|
||||||
|
const {fastCode, fastBrackets, year, month, lastBrackets, docOrder, lengthSelection, lastCode } = listNumbers.value
|
||||||
|
// 数据拼接
|
||||||
|
formData.value.serialNumber =
|
||||||
|
`${fastCode || ""}${fastBrackets || ""}${year || ""}`+
|
||||||
|
`${(month != null&&month!=0) ? month.toString().padStart(2,"0") : ""}`+
|
||||||
|
`${lastBrackets || ""}${(docOrder || "").toString().padStart(lengthSelection,"0")}${lastCode || ""}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 选择编号时赋值
|
||||||
|
const handleChangeNumbers = async (val: any | undefined) => {
|
||||||
|
listNumbers.value = JSON.parse(JSON.stringify(val)); // 深拷贝
|
||||||
|
formData.value.serialNumber = undefined
|
||||||
|
await changeNumbers();
|
||||||
|
}
|
||||||
|
|
||||||
|
watch(() => props.buttonNumberPath, () => {
|
||||||
|
if (runningTask.value && isHandleTaskStatus() && isShowButton(OperationButtonType.NUMBER)) {
|
||||||
|
getNumberByType()
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
const formLoading = ref(false) // 表单加载中
|
const formLoading = ref(false) // 表单加载中
|
||||||
const popOverVisible = ref({
|
const popOverVisible = ref({
|
||||||
approve: false,
|
approve: false,
|
||||||
@ -639,7 +785,8 @@ const popOverVisible = ref({
|
|||||||
return: false,
|
return: false,
|
||||||
copy: false,
|
copy: false,
|
||||||
cancel: false,
|
cancel: false,
|
||||||
deleteSign: false
|
deleteSign: false,
|
||||||
|
numbers: false
|
||||||
}) // 气泡卡是否展示
|
}) // 气泡卡是否展示
|
||||||
const returnList = ref([] as any) // 退回节点
|
const returnList = ref([] as any) // 退回节点
|
||||||
|
|
||||||
@ -750,6 +897,15 @@ const cancelForm = reactive({
|
|||||||
const cancelFormRule = reactive<FormRules<typeof cancelForm>>({
|
const cancelFormRule = reactive<FormRules<typeof cancelForm>>({
|
||||||
cancelReason: [{ required: true, message: '取消理由不能为空', trigger: 'blur' }],
|
cancelReason: [{ required: true, message: '取消理由不能为空', trigger: 'blur' }],
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// 文号
|
||||||
|
const numbersFormRef = ref<FormInstance>()
|
||||||
|
const numbersForm = reactive({
|
||||||
|
numbersReason: ''
|
||||||
|
})
|
||||||
|
const numbersFormRule = reactive<FormRules<typeof numbersForm>>({
|
||||||
|
numbersReason: [{ required: true, message: '文号不能为空', trigger: 'blur' }],
|
||||||
|
})
|
||||||
//pch 选人begin--------------------
|
//pch 选人begin--------------------
|
||||||
const userSelectFormRef = ref() // 用户选择弹窗 ref
|
const userSelectFormRef = ref() // 用户选择弹窗 ref
|
||||||
const userSelectSingleFormRef = ref() // 用户选择弹窗 ref
|
const userSelectSingleFormRef = ref() // 用户选择弹窗 ref
|
||||||
@ -964,7 +1120,6 @@ const handleTransfer = async () => {
|
|||||||
const handleDelegate = async () => {
|
const handleDelegate = async () => {
|
||||||
formLoading.value = true
|
formLoading.value = true
|
||||||
try {
|
try {
|
||||||
|
|
||||||
// 1.1 校验表单
|
// 1.1 校验表单
|
||||||
if (!delegateFormRef.value) return
|
if (!delegateFormRef.value) return
|
||||||
await delegateFormRef.value.validate()
|
await delegateFormRef.value.validate()
|
||||||
@ -1036,6 +1191,30 @@ const handleReturn = async () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 处理文号 */
|
||||||
|
const handleNumbers = async () => {
|
||||||
|
formLoading.value = true
|
||||||
|
try {
|
||||||
|
// 1.1 校验表单
|
||||||
|
if (!numbersFormRef.value) return
|
||||||
|
await numbersFormRef.value.validate()
|
||||||
|
//提交文号
|
||||||
|
const date = {
|
||||||
|
id: props.processInstance.businessKey,
|
||||||
|
value: formData.value.serialNumber
|
||||||
|
}
|
||||||
|
emit('update', date)
|
||||||
|
await numbersApi.updatenumbers(listNumbers.value)
|
||||||
|
popOverVisible.value.numbers = false
|
||||||
|
numbersFormRef.value.resetFields()
|
||||||
|
message.success('操作成功')
|
||||||
|
// 2 重新加载数据
|
||||||
|
reload()
|
||||||
|
} finally {
|
||||||
|
formLoading.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/** 处理取消 */
|
/** 处理取消 */
|
||||||
const handleCancel = async () => {
|
const handleCancel = async () => {
|
||||||
formLoading.value = true
|
formLoading.value = true
|
||||||
|
@ -334,7 +334,7 @@ const updateNumber = (date) => {
|
|||||||
if (businessForm.value && businessForm.value.updateNumber) {
|
if (businessForm.value && businessForm.value.updateNumber) {
|
||||||
businessForm.value.updateNumber(date);
|
businessForm.value.updateNumber(date);
|
||||||
}else {
|
}else {
|
||||||
message.error("流程未配置更新函数")
|
message.error("流程配置缺失")
|
||||||
}
|
}
|
||||||
// 重新获取详情
|
// 重新获取详情
|
||||||
getDetail()
|
getDetail()
|
||||||
|
Loading…
Reference in New Issue
Block a user