Commit 7990f5f2 authored by 罗林杰's avatar 罗林杰

Merge remote-tracking branch 'origin/master'

parents 108dcc89 b7f5f4d3
......@@ -10,7 +10,7 @@
:checkable="true"
:defaultExpandAll="true"
:treeData="treeData"
:fieldNames="{ key: 'businessId', title: 'label' }"
:fieldNames="{ key: 'businessId', title: 'basicStandardName' }"
@select="handleSelect"
/>
</div>
......@@ -28,7 +28,7 @@ import {nextTick, onMounted, ref, unref} from 'vue';
async function fetch() {
treeData.value = chooseDictoryTreeData
treeData.value = handleTree(chooseDictoryTreeData, 'businessId',undefined,undefined,undefined)
await nextTick(() => {
getTree().expandAll(true)
})
......@@ -49,6 +49,26 @@ function getTree() {
onMounted(() => {
fetch();
});
function handleTree(data, id, parentId, children, rootId) {
id = id || 'id'
parentId = parentId || 'parentId'
children = children || 'children'
rootId = rootId || Math.min.apply(Math, data.map(item => { return item[parentId] })) || 0
// 对源数据深度克隆
const cloneData = JSON.parse(JSON.stringify(data))
// 循环所有项
const treeData = cloneData.filter(father => {
const branchArr = cloneData.filter(child => {
// 返回每一项的子级数组
return father[id] === child[parentId]
})
branchArr.length > 0 ? father.children = branchArr : ''
// 返回第一层
return father[parentId] === rootId
})
return treeData !== '' ? treeData : data
}
</script>
<style lang="scss" scoped>
.bg-white{
......
......@@ -109,12 +109,11 @@ function contrastButton() {
/** 撤回成功*/
function withdrawButton() {
createMessage.success('撤回成功!')
}
/** 查看*/
function detailButton(record) {
console.log('record:',record)
emit('success', { values: { ...record }});
closeModal();
}
......
......@@ -642,16 +642,63 @@ export const treeDataListTwo = [
},
]
/**编辑页 选择字典树 数据*/
export const chooseDictoryTreeData = [
{
label: '默认工作组',
businessId: 1,
children: [
{ label: '默认工作组01', businessId: 2 },
{ label: '默认工作组02', businessId: 3 },
{ label: '默认工作组03', businessId: 4 },
{ label: '默认工作组04', businessId: 5 },
],
"delFlag" : "0",
"flag" : "1",
"businessId" : 100,
"basicStandardName" : "所有命名字典",
"anotherName":"所有命名字典",
"parentId" : 0,
"ancestors" : "0",
"orderNum" : 0,
"children" : [ ],
icon: 'ion:settings-outline',
},
{
"delFlag" : "0",
"flag" : "1",
"businessId" : 101,
"basicStandardName" : "共享工作区",
"anotherName":"共享工作区",
"parentId" : 100,
"ancestors" : "0,100",
"children" : [ ],
icon: 'ion:settings-outline',
},
{
"delFlag" : "0",
"flag" : "1",
"businessId" : 102,
"basicStandardName" : "关联域",
"anotherName":"关联域",
"parentId" : 101,
"ancestors" : "0,100,101",
"children" : [ ],
icon: 'ion:settings-outline',
},
{
"delFlag" : "0",
"flag" : "1",
"businessId" : 103,
"basicStandardName" : "日期",
"anotherName":"日期",
"parentId" : 102,
"ancestors" : "0,100,101,102",
"children" : [ ],
icon: 'ion:settings-outline',
},
{
"delFlag" : "0",
"flag" : "1",
"businessId" : 104,
"basicStandardName" : "创建日期",
"anotherName":"创建日期",
"parentId" : 102,
"ancestors" : "0,100,101,102",
"children" : [ ],
icon: 'ion:settings-outline',
},
]
<template>
<PageWrapper title="基础标准编辑页" contentBackground>
<div style="background-color: white">
<Divider />
<div style="display: flex;justify-content: space-between; align-items: center;margin-bottom: 10px;margin-left: 12px">
<div style="margin-top: 10px;display: flex;font-weight: bold;font-size: 25px">
{{title}}
......@@ -23,7 +24,7 @@
<!-- 选择命名字典 弹窗-->
<ChooseNamingDictionaryModal @register="registerChooseNamingDictionaryModal" @success="handleSuccess" />
</PageWrapper>
</div>
</template>
<script lang="ts" setup>
import { Description } from '@/components/Description';
......@@ -41,11 +42,13 @@ import {onMounted, ref} from "vue";
import {useRoute} from "vue-router";
import ChooseNamingDictionaryModal from './ChooseNamingDictionaryModal.vue'
import {useModal} from "@/components/Modal";
import { useMessage } from '@/hooks/web/useMessage';
const route = useRoute()
const title = ref('')
const formData = ref({})
const businessId = ref('')
const { createMessage, createConfirm } = useMessage();
const [registerChooseNamingDictionaryModal, { openModal: openChooseNamingDictonaryModal }] = useModal();
const [registerForm1, { setFieldsValue: setFieldsValue1 }] = useForm({
labelWidth: 100,
......@@ -87,9 +90,17 @@ function exitEditButton(record) {
/**保存*/
function saveButton(record) {
createMessage.success('保存成功')
router.push({
path: '/dataStandards/basicStandards/detailStandard',
query: {
businessId:businessId.value,
},
});
}
/**发布*/
function publishButton(record) {
......
......@@ -90,7 +90,6 @@
import { useRoute } from 'vue-router';
import { TreeData } from "@/views/dataStandards/basicStandards/basicStandardsData";
import { router } from '@/router';
import { demoListApi } from '@/api/demo/table';
import {exportUserList} from "@/api/system/user/user";
import {downloadByData} from "@/utils/file/download";
......
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