zhuoyuan.wang
2024-06-19 15ebe96f28cadec6a726c5324593a40bbf56205f
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
<template>
  <app-dialog-form
    v-bind="dialogFormProps"
  >
    <app-layout-row top="-13">
      <app-tab-wrapper v-bind="tabWrapperProps">
        <template #property="scope">
          <property-table
            v-bind="tableProps"
            :options="options"
          />
        </template>
        <template #flow="scope">
          <flow-table
            v-bind="tableProps"
          />
        </template>
      </app-tab-wrapper>
    </app-layout-row>
  </app-dialog-form>
</template>
 
<script setup>
import FlowTable from './FlowTable';
import PropertyTable from './PropertyTable';
import {useEntityStore, useAppStore} from '@/store/modules';
import {meta} from '@/hooks';
 
const {useMetaData} = meta;
 
const tableSearchRef = ref();
const tableProRef = ref();
const entityStore = useEntityStore();
const appStore = useAppStore();
 
const props = defineProps({
  subSubmit: {
    type: Function,
    default: () => {
    }
  },
});
 
let options;
 
const tableRef = ref();
 
const tableProps = {
  ref: tableRef,
}
 
const tabWrapperRef = ref();
 
const tabWrapperProps = {
  tabList: [
    {name: 'property', label: '业务参数'},
    {name: 'flow', label: '流程参数'}
  ],
  ref: tabWrapperRef
};
 
const dialogFormRef = ref();
 
const dialogFormProps = {
  title: '请选择参数',
  ref: dialogFormRef,
  resetDom: false,
  subSubmit: async () => {
    const current = tableRef.value.getTableCurrent();
    const active = tabWrapperRef.value.getActive();
 
    if (active === 'property') {
      props.subSubmit({name: `业务参数.${current.label_chinese}`});
    }
    if (active === 'flow') {
      props.subSubmit({name: `流程.${current.value}`});
    }
 
  }
};
 
const onOpen = async (_options) => {
  options = _options || {};
  dialogFormRef.value.onOpen();
  await nextTick();
  tabWrapperProps.tabList = [
    {name: 'property', label: '业务参数'},
    options.has_flow === 'T' ? {name: 'flow', label: '流程参数'} : null
  ].filter(Boolean);
  if(options.has_flow !== 'T') {
    tabWrapperRef.value.setActive('property');
  }
  tabWrapperRef.value.$forceUpdate(tabWrapperProps);
}
 
defineExpose({
  onOpen
});
 
</script>