Commit b7f5f4d3 authored by liwei's avatar liwei

基础标准页面

parent 1a7875f7
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
:checkable="true" :checkable="true"
:defaultExpandAll="true" :defaultExpandAll="true"
:treeData="treeData" :treeData="treeData"
:fieldNames="{ key: 'businessId', title: 'label' }" :fieldNames="{ key: 'businessId', title: 'basicStandardName' }"
@select="handleSelect" @select="handleSelect"
/> />
</div> </div>
...@@ -28,7 +28,7 @@ import {nextTick, onMounted, ref, unref} from 'vue'; ...@@ -28,7 +28,7 @@ import {nextTick, onMounted, ref, unref} from 'vue';
async function fetch() { async function fetch() {
treeData.value = chooseDictoryTreeData treeData.value = handleTree(chooseDictoryTreeData, 'businessId',undefined,undefined,undefined)
await nextTick(() => { await nextTick(() => {
getTree().expandAll(true) getTree().expandAll(true)
}) })
...@@ -49,6 +49,26 @@ function getTree() { ...@@ -49,6 +49,26 @@ function getTree() {
onMounted(() => { onMounted(() => {
fetch(); 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> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.bg-white{ .bg-white{
......
...@@ -109,12 +109,11 @@ function contrastButton() { ...@@ -109,12 +109,11 @@ function contrastButton() {
/** 撤回成功*/ /** 撤回成功*/
function withdrawButton() { function withdrawButton() {
createMessage.success('撤回成功!')
} }
/** 查看*/ /** 查看*/
function detailButton(record) { function detailButton(record) {
console.log('record:',record)
emit('success', { values: { ...record }}); emit('success', { values: { ...record }});
closeModal(); closeModal();
} }
......
...@@ -642,16 +642,63 @@ export const treeDataListTwo = [ ...@@ -642,16 +642,63 @@ export const treeDataListTwo = [
}, },
] ]
/**编辑页 选择字典树 数据*/ /**编辑页 选择字典树 数据*/
export const chooseDictoryTreeData = [ export const chooseDictoryTreeData = [
{ {
label: '默认工作组', "delFlag" : "0",
businessId: 1, "flag" : "1",
children: [ "businessId" : 100,
{ label: '默认工作组01', businessId: 2 }, "basicStandardName" : "所有命名字典",
{ label: '默认工作组02', businessId: 3 }, "anotherName":"所有命名字典",
{ label: '默认工作组03', businessId: 4 }, "parentId" : 0,
{ label: '默认工作组04', businessId: 5 }, "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> <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="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"> <div style="margin-top: 10px;display: flex;font-weight: bold;font-size: 25px">
{{title}} {{title}}
...@@ -23,7 +24,7 @@ ...@@ -23,7 +24,7 @@
<!-- 选择命名字典 弹窗--> <!-- 选择命名字典 弹窗-->
<ChooseNamingDictionaryModal @register="registerChooseNamingDictionaryModal" @success="handleSuccess" /> <ChooseNamingDictionaryModal @register="registerChooseNamingDictionaryModal" @success="handleSuccess" />
</PageWrapper> </div>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { Description } from '@/components/Description'; import { Description } from '@/components/Description';
...@@ -41,11 +42,13 @@ import {onMounted, ref} from "vue"; ...@@ -41,11 +42,13 @@ import {onMounted, ref} from "vue";
import {useRoute} from "vue-router"; import {useRoute} from "vue-router";
import ChooseNamingDictionaryModal from './ChooseNamingDictionaryModal.vue' import ChooseNamingDictionaryModal from './ChooseNamingDictionaryModal.vue'
import {useModal} from "@/components/Modal"; import {useModal} from "@/components/Modal";
import { useMessage } from '@/hooks/web/useMessage';
const route = useRoute() const route = useRoute()
const title = ref('') const title = ref('')
const formData = ref({}) const formData = ref({})
const businessId = ref('') const businessId = ref('')
const { createMessage, createConfirm } = useMessage();
const [registerChooseNamingDictionaryModal, { openModal: openChooseNamingDictonaryModal }] = useModal(); const [registerChooseNamingDictionaryModal, { openModal: openChooseNamingDictonaryModal }] = useModal();
const [registerForm1, { setFieldsValue: setFieldsValue1 }] = useForm({ const [registerForm1, { setFieldsValue: setFieldsValue1 }] = useForm({
labelWidth: 100, labelWidth: 100,
...@@ -87,9 +90,17 @@ function exitEditButton(record) { ...@@ -87,9 +90,17 @@ function exitEditButton(record) {
/**保存*/ /**保存*/
function saveButton(record) { function saveButton(record) {
createMessage.success('保存成功')
router.push({
path: '/dataStandards/basicStandards/detailStandard',
query: {
businessId:businessId.value,
},
});
} }
/**发布*/ /**发布*/
function publishButton(record) { function publishButton(record) {
......
...@@ -90,7 +90,6 @@ ...@@ -90,7 +90,6 @@
import { useRoute } from 'vue-router'; import { useRoute } from 'vue-router';
import { TreeData } from "@/views/dataStandards/basicStandards/basicStandardsData"; import { TreeData } from "@/views/dataStandards/basicStandards/basicStandardsData";
import { router } from '@/router'; import { router } from '@/router';
import { demoListApi } from '@/api/demo/table';
import {exportUserList} from "@/api/system/user/user"; import {exportUserList} from "@/api/system/user/user";
import {downloadByData} from "@/utils/file/download"; 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