1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980 |
- <script setup lang="ts">
- import { onMounted, computed,ref } from 'vue'
- const props = defineProps({
- content: {
- type: String,
- default: ''
- },
- })
- const show = ref(false)
- const tableData = computed(() => {
- let arr = []
- if (props.content.includes('json')) {
- arr = JSON.parse(props.content.split('json')[1].split('```')[0])
- }
- else arr = JSON.parse(props.content)
- if (arr[0].data) show.value = true
- return arr.map((_:any) => ({
- label: _.label ?? _.findByValue,
- source: _.excelColumn,
- value:_.data
- }))
- })
- </script>
- <template>
- <div class="mb-2" >抽取对应关系</div>
- <el-table :data="tableData" style="width: 100%">
- <el-table-column show-overflow-tooltip prop="label" label="表单项" width="100" />
- <el-table-column show-overflow-tooltip prop="source" label="数据源" width="100" />
- <el-table-column v-if="show" show-overflow-tooltip prop="value" label="数据值" width="100" />
- </el-table>
- </template>
- <style scoped lang="scss">
- .els {
- white-space: nowrap; /* 强制文本不换行 */
- overflow: hidden; /* 隐藏溢出内容 */
- text-overflow: ellipsis; /* 显示省略号 */
- }
- .document_r {
- display: flex;
- flex-direction: column;
- align-items: end;
- }
- .document_content {
- width: 240px;
- height: 50px;
- display: flex;
- align-items: center;
- justify-content: start;
- padding: 8px 8px;
- background-color: rgba(255, 255, 255, 0.3);
- border: 1px solid rgba(102, 102, 102, 0.3);
- border-radius: 6px;
- margin-bottom: 6px;
- .document_img {
- margin-right: 8px;
- height: 32px;
- }
- .document_text {
- flex-shrink: 0;
- width: calc(100% - 56px);
- }
- }
- .document_content1 {
- width: fit-content;
- max-width: 240px;
- padding: 10px 12px;
- border-radius: 6px;
- background-color: rgba(255, 255, 255, 0.8);
- }
- </style>
|