Commit a53622e0 authored by LiXuyang's avatar LiXuyang

标签-图像分析

parent 4bd1a098
<template>
<BasicModal
width="40%"
v-bind="$attrs"
@register="registerModal"
:title="getTitle"
@ok="handleSubmit"
>
<BasicForm @register="registerForm">
<template #path="{ field, model }">
<InputSearch :disabled="true" v-model:value="model[field]" enter-button="选择" @search="handlePath" />
</template>
<template #type="{ field, model }">
<span>{{ model[field] }}</span>
</template>
</BasicForm>
</BasicModal>
</template>
<script lang="ts" setup>
import { ref, unref } from 'vue';
import { InputSearch } from 'ant-design-vue';
import { BasicModal, useModalInner } from '@/components/Modal';
import { BasicForm, useForm } from '@/components/Form';
import { addFileModalFormSchema } from '@/views/mallResourceDevelopment/label/portraitAnalysis/portrait.data';
const isUpdate = ref(false);
const isMove = ref(false);
const rowId = ref('');
function handlePath() {}
const [registerForm, { getFieldsValue, setFieldsValue, updateSchema, resetFields, validate }] =
useForm({
labelWidth: 100,
baseColProps: { span: 24 },
schemas: addFileModalFormSchema,
showActionButtonGroup: false,
actionColOptions: {
span: 23,
},
});
//初始化弹框
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
await resetFields();
setModalProps({ confirmLoading: false });
isUpdate.value = !!data?.isUpdate;
isMove.value = !!data?.isMove;
await setFieldsValue({
path: data.path,
});
if (unref(isUpdate)) {
// 获取行数据的id
rowId.value = data.record.businessId;
// 塞值
await setFieldsValue({
...data.record,
});
}
});
// const getTitle = computed(() => (isUpdate.value ? '编辑实体' : '新建实体'));
const getTitle = '转物理模型';
/**确定按钮*/
async function handleSubmit() {
await validate();
closeModal();
}
</script>
......@@ -23,6 +23,7 @@ export const detailFormSchema: FormSchema[] = [
{
label: '画像样式',
field: 'style',
defaultValue: 0,
slot: 'style',
},
];
......
......@@ -5,16 +5,24 @@
<a-button type="primary">保存</a-button>
</template>
<template #footer>
<div>基本信息</div>
<div class="des-title" style="margin: 0 0 20px 30px">基本信息</div>
<BasicForm @register="registerForm">
<template #style="{ field, model }">
<div class="flex" style="text-align: center; gap: 10px">
<div style="cursor: pointer" @click="model[field] = 0">
<AlignLeftOutlined class="style-icon" :class="model[field] === 0 ? 'check-class' : null" />
<AlignLeftOutlined
class="style-icon"
:class="model[field] === 0 ? 'check-class' : null"
/>
<div>默认</div>
</div>
<div style="cursor: pointer" @click="model[field] = 1">
<Icon icon="ion:body-outline" class="style-icon" :class="model[field] === 1 ? 'check-class' : null" style="font-size: 50px" />
<Icon
icon="ion:body-outline"
class="style-icon"
:class="model[field] === 1 ? 'check-class' : null"
style="font-size: 50px"
/>
<div>人物</div>
</div>
<div style="cursor: pointer" @click="model[field] = 2">
......@@ -28,7 +36,7 @@
<div class="flex">
<div class="w-1/2">
<div class="flex justify-between" style="padding: 16px 16px 0 32px">
<div style="font-size: 16px; font-weight: bolder">属性</div>
<div class="des-title">属性</div>
<a-button type="primary"><PlusOutlined />添加字段</a-button>
</div>
<BasicTable @register="fieldTable">
......@@ -48,7 +56,7 @@
</div>
<div class="w-1/2">
<div class="flex justify-between" style="padding: 16px 16px 0 32px">
<div style="font-size: 16px; font-weight: bolder">标签</div>
<div class="des-title">标签</div>
<a-button type="primary"><PlusOutlined />添加标签</a-button>
</div>
<BasicTable @register="tagTable">
......@@ -79,7 +87,7 @@
import { ref } from 'vue';
import BasicForm from '@/components/Form/src/BasicForm.vue';
import Icon from '@/components/Icon/Icon.vue';
import { Divider, Input } from 'ant-design-vue';
import {Divider, FormProps, Input} from 'ant-design-vue';
import { AlignLeftOutlined, BankOutlined, PlusOutlined } from '@ant-design/icons-vue';
import { useForm } from '@/components/Form';
import { editFormSchema } from '@/views/dataWarehousePlanning/logicalModel/modelDetail/model.data';
......@@ -100,6 +108,7 @@
tagTableData,
} from '@/views/mallResourceDevelopment/label/portraitAnalysis/detail/detailData';
import TableAction from '@/components/Table/src/components/TableAction.vue';
import {BaseFormatProps} from "vue-i18n";
const route = useRoute();
const title = route.query.title;
......@@ -136,16 +145,17 @@
baseColProps: { span: 12 },
schemas: fieldFormSchema,
autoSubmitOnEnter: true,
} as BasicTableProps,
} as FormProps,
useSearchForm: true,
showTableSetting: false,
bordered: true,
pagination: false,
actionColumn: {
width: 100,
title: '操作',
dataIndex: 'action',
},
});
} as BasicTableProps);
const [tagTable] = useTable({
title: '',
api: async (params) => {
......@@ -170,16 +180,17 @@
baseColProps: { span: 12 },
schemas: tagFormSchema,
autoSubmitOnEnter: true,
} as BasicTableProps,
} as FormProps,
useSearchForm: true,
showTableSetting: false,
bordered: true,
pagination: false,
actionColumn: {
width: 100,
title: '操作',
dataIndex: 'action',
},
});
} as BasicTableProps);
</script>
<style scoped>
......@@ -192,4 +203,8 @@
color: #3b8cf7;
border: 3px solid #3b8cf7;
}
.des-title {
font-size: 16px;
font-weight: bolder;
}
</style>
......@@ -5,7 +5,7 @@
<div class="flex w-2/11">
<BasicTree
class="flex-1"
:treeData="labelTreeData"
:treeData="portraitTreeData"
defaultExpandLevel="1"
@select="handleSelect"
ref="treeData"
......@@ -23,7 +23,9 @@
>移动</a-button
>
<a-button class="top-button" type="primary">新建文件夹</a-button>
<a-button class="top-button" type="primary" @click="handleAddPortrait">新建画像</a-button>
<a-button class="top-button" type="primary" @click="handleAddPortrait"
>新建画像</a-button
>
</template>
<template #footer>
<BasicTable @register="portraitTable" ref="tabTableRef">
......@@ -68,7 +70,8 @@
</template>
</template>
<template #name="{ text, record }">
<a @click="handleBody(record)">{{ text }}</a>
<a v-if="record.relationBody" @click="handleBody(record)">{{ text }}</a>
<span v-else>{{ text }}</span>
</template>
<template #originalSubject="{ text, record }">
<a-button type="link" @click="handleBody(record)">{{ text }}</a-button>
......@@ -79,6 +82,7 @@
</div>
</div>
</template>
<AddFileModal @register="addFileModal" />
</PageWrapper>
</template>
......@@ -121,15 +125,21 @@
portraitTableColumn,
portraitTableFormSchema,
} from '@/views/mallResourceDevelopment/label/portraitAnalysis/portrait.data';
import { portraitTreeData } from './portraitData';
import AddFileModal from './addFileModal.vue';
const [addFileModal, { openModal: openAddFileModal }] = useModal();
const tabName = ref('');
const treeData = ref();
const path = ref();
function handleSelect() {
const keys = unref(treeData).getSelectedKeys();
const node = unref(treeData).getSelectedNode(keys[0]);
console.log('node', node);
// 获取标题
tabName.value = node.title;
path.value = getPath(portraitTreeData[0]);
console.log('path', path.value);
if (node.children) {
const list = cloneDeep(node.children);
list.forEach((item) => {
......@@ -145,7 +155,22 @@
// tabName.value = findTitleById(labelTreeData[0], key[0]);
// console.log('tabName', tabName.value);
}
// 嵌套 -获取树title
// 嵌套获取路径
function getPath(data) {
if (data.name === tabName.value) {
return '/' + data.name;
} else {
if (data.children && data.children.length > 0) {
for (let item of data.children) {
const path = getPath(item);
if (path) {
return '/' + data.name + path;
}
}
}
return;
}
}
const tabTableRef = ref(null);
function topButtonDisabled() {
if (tabTableRef.value) {
......@@ -162,16 +187,14 @@
function handleBody(record) {
console.log('recode', record);
router.push({
path: '/mallResourceDevelopment/label/label/labelDetail',
path: '/mallResourceDevelopment/label/portraitAnalysis/detail',
query: { ...record },
});
}
function handleAddPortrait() {
router.push({
path: '/mallResourceDevelopment/label/portraitAnalysis/detail',
query: {
title: tabName.value,
},
openAddFileModal(true, {
isUpdate: false,
path: path.value,
});
}
const [portraitTable, { setTableData: tabSetTableData, getRowSelection: tabGetRowSelection }] =
......
......@@ -15,6 +15,7 @@ export const portraitTableColumn: BasicColumn[] = [
title: '名称',
dataIndex: 'name',
width: 100,
slots: { customRender: 'name' },
},
{
title: '创建时间',
......@@ -32,3 +33,22 @@ export const portraitTableColumn: BasicColumn[] = [
width: 100,
},
];
export const addFileModalFormSchema: FormSchema[] = [
{
label: '路径',
field: 'path',
slot: 'path',
},
{
label: '文件名称',
field: 'name',
required: true,
component: 'Input',
},
{
label: '文件类型',
field: 'type',
defaultValue: '画像分析',
slot: 'type',
},
];
export const portraitTreeData = [
{
title: '画像分析',
key: '0',
name: '画像分析',
icon: 'ant-design:pic-left-outlined',
children: [
{
title: '共享工作区',
key: '0-1',
icon: 'ant-design:desktop-outlined',
name: '共享工作区',
createTime: '2023/11/16 06:50:23',
updateTime: '2023/12/08 19:33:26',
children: [
{
title: '共享区1',
key: '0-1-0',
icon: 'ant-design:apartment-outlined',
name: '共享区1',
createTime: '2023/11/16 06:50:23',
updateTime: '2023/12/08 19:33:26',
children: [
{
title: '共享1测试',
key: '0-1-0-0',
icon: 'ant-design:smile-outlined',
name: '共享1测试',
relationBody: '共享区1',
createTime: '2023/09/09 19:16:22',
updateTime: '2023/09/09 22:09:36',
owner: 'admin',
},
{
title: '共享1-2',
key: '0-1-0-1',
icon: 'ant-design:smile-outlined',
name: '共享1-2',
relationBody: '共享区1',
createTime: '2023/09/09 19:16:22',
updateTime: '2023/09/09 22:09:36',
owner: 'admin',
},
{
title: '传送包',
key: '0-1-0-2',
icon: 'ant-design:folder-open-outlined',
name: '传送包',
createTime: '2023/11/16 06:50:23',
updateTime: '2023/12/08 19:33:26',
children: [
{
title: '包测试3',
key: '0-1-0-2-0',
icon: 'ant-design:smile-outlined',
name: '包测试3',
relationBody: '共享区1',
createTime: '2023/09/09 19:16:22',
updateTime: '2023/09/09 22:09:36',
owner: 'admin',
},
],
},
],
},
{
title: '共享区2',
key: '0-1-1',
icon: 'ant-design:apartment-outlined',
name: '共享区2',
createTime: '2023/11/16 06:50:23',
updateTime: '2023/12/08 19:33:26',
children: [
{
title: '经济',
key: '0-1-1-0',
icon: 'ant-design:smile-outlined',
name: '经济',
relationBody: '共享区2',
createTime: '2023/09/09 19:16:22',
updateTime: '2023/09/09 22:09:36',
owner: 'admin',
},
{
title: '商品',
key: '0-1-1-1',
icon: 'ant-design:smile-outlined',
name: '商品',
relationBody: '共享区2',
createTime: '2023/09/09 19:16:22',
updateTime: '2023/09/09 22:09:36',
owner: 'admin',
},
{
title: '购物包',
key: '0-1-1-2',
icon: 'ant-design:folder-open-outlined',
name: '购物包',
createTime: '2023/11/16 06:50:23',
updateTime: '2023/12/08 19:33:26',
children: [
{
title: '测试标签',
key: '0-1-1-2-0',
icon: 'ant-design:smile-outlined',
name: '测试标签',
relationBody: '共享区2',
createTime: '2023/09/09 19:16:22',
updateTime: '2023/09/09 22:09:36',
owner: 'admin',
},
],
},
],
},
],
},
],
},
]
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment