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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
<template>
  <app-dialog-form
    v-bind="dialogFormProps"
  >
    <app-collapse-form title="匹配规则">
      <div class="table">
        <div class="item" v-for="(item,index) in form.join">
          <el-input
            style="width: 35%;"
            v-model="item.base_band_column_name"
            readonly
          />
          <el-input
            style="width: 20%;"
            v-model="item.join_type"
            readonly
          />
          <el-input
            style="width: 35%;"
            v-model="item.target_band_column_name"
            readonly
          />
        </div>
      </div>
    </app-collapse-form>
    <app-collapse-form title="默认过滤">
      <div class="table">
        <div class="item" v-for="(item,index) in form.filter">
          <el-input
            style="width: 35%;"
            v-model="item.name"
            readonly
          />
          <el-input
            style="width: 20%;"
            v-model="item.filter_type"
            readonly
          />
          <el-input
            style="width: 35%;"
            v-model="item.filter_value"
            readonly
          />
        </div>
      </div>
    </app-collapse-form>
  </app-dialog-form>
</template>
 
<script setup>
 
import {dict} from '@/hooks';
 
const {useDictMap} = dict;
 
import {useAppStore, useEntityStore} from "@/store/modules";
 
const entityStore = useEntityStore();
 
const appStore = useAppStore();
 
const dialogFormRef = ref();
 
const loading = ref(false);
 
 
const filterMap = {
  'in': '范围内'
}
 
const [,dictMapCode] = useDictMap(['filter_type']);
 
const form = reactive({
  join: [],
  filter: []
});
 
const init = async (id) => {
  loadiyang.value = true;
  const [join, filter] = await Promise.all([
    entityStore.getEntitySet({
      dataName: "v_plan_join_info",
      attachMeta: false,
      filter: `id = '${id}'`
    }),
    entityStore.getEntitySet({
      dataName: "v_plan_filter_info",
      attachMeta: false,
      filter: `id = '${id}'`
    })
  ]);
 
  console.log(dictMapCode.filter_type);
  form.join = join.data.entityset.map(item => {
    item.join_type = dictMapCode.filter_type[item.join_type];
    return item;
  });
  form.filter = filter.data.entityset.map(item => {
    item.filter_type = filterMap[item.filter_type] || item.filter_type;
    return item;
  });
}
 
const dialogFormProps = {
  title: '列表',
  ref: dialogFormRef,
  footerDom: false
};
 
const onOpen = async (id) => {
  dialogFormRef.value.onOpen();
  await nextTick();
 
  await init(id);
}
 
defineExpose({
  onOpen
});
 
</script>
 
<style lang="scss" scoped>
.table {
 
  .item {
    margin-bottom: 10px;
    display: flex;
    justify-content: space-around;
  }
}
</style>