ny
23 小时以前 282fbc6488f4e8ceb5fda759f963ee88fbf7b999
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
<script lang="ts" setup>
import type { FormSchema } from '@jnpf/ui/form';
 
import { reactive } from 'vue';
 
import { BasicForm, useForm } from '@jnpf/ui/form';
import { BasicModal, useModalInner } from '@jnpf/ui/modal';
 
import { cloneDeep } from 'lodash-es';
 
import { getPrintDevSelector } from '#/api/system/printDev';
 
interface State {
  fileConfig: any;
}
 
const emit = defineEmits(['register', 'confirm']);
const state = reactive<State>({
  fileConfig: {},
});
const permissionTypeOptions = [
  { fullName: '当前流程所有人', id: 1 },
  { fullName: '流程发起人', id: 2 },
  { fullName: '最后节点审批人', id: 3 },
];
const schemas: FormSchema[] = [
  {
    field: '',
    label: '',
    component: 'Alert',
    componentProps: { message: '归档后在文档中心查看(APP端及批量审批操作不支持自动归档)', type: 'warning', showIcon: true },
  },
  {
    field: 'permissionType',
    label: '查看权限',
    component: 'Radio',
    componentProps: { options: permissionTypeOptions },
  },
  {
    field: 'templateId',
    label: '归档模板',
    component: 'TreeSelect',
    componentProps: { options: [], lastLevel: true },
    rules: [{ required: true, trigger: 'change', message: '必填' }],
  },
];
const [registerModal, { closeModal }] = useModalInner(init);
const [registerForm, { setFieldsValue, validate, clearValidate, updateSchema }] = useForm({ labelWidth: 80, schemas });
 
function init(data) {
  state.fileConfig = cloneDeep(data.fileConfig) || {};
  setFieldsValue(state.fileConfig);
  clearValidate();
  getPrintTplList();
}
function getPrintTplList() {
  getPrintDevSelector().then((res) => {
    const options = (res.data.list || []).filter((o) => o.children && o.children.length).map((o) => ({ ...o, hasChildren: true }));
    updateSchema({ field: 'templateId', componentProps: { options } });
  });
}
async function handleSubmit() {
  const values = await validate();
  if (!values) return;
  closeModal();
  emit('confirm', values);
}
</script>
<template>
  <BasicModal v-bind="$attrs" @register="registerModal" title="流程归档设置" @ok="handleSubmit" destroy-on-close>
    <BasicForm @register="registerForm" />
  </BasicModal>
</template>