|
|
@ -70,10 +70,14 @@ async function fetchMenuItems() {
|
|
|
|
async function fetchData() {
|
|
|
|
async function fetchData() {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
const data = await fetchMenuItems()
|
|
|
|
const data = await fetchMenuItems()
|
|
|
|
|
|
|
|
console.log(data)
|
|
|
|
|
|
|
|
|
|
|
|
// 使用响应式数据保存获取到的菜单项
|
|
|
|
// 使用响应式数据保存获取到的菜单项
|
|
|
|
// items变量通过reactive函数创建为响应式数据。在fetchData函数中,使用splice方法来替换items数组的内容,确保新的数据被响应式地更新。这样,当fetchData异步请求完成后,items数组中的数据将被更新为获取到的菜单项数据
|
|
|
|
// items变量通过reactive函数创建为响应式数据。在fetchData函数中,使用splice方法来替换items数组的内容,确保新的数据被响应式地更新。这样,当fetchData异步请求完成后,items数组中的数据将被更新为获取到的菜单项数据
|
|
|
|
items.splice(0, items.length, ...data.map(item => getItem(item.label, item.key, null, item.children)))
|
|
|
|
items.splice(0, items.length, ...data.map(item => getItem(item.label, item.key, null, item.children)))
|
|
|
|
// items.value = data.map(item => getItem(item.label, item.key, null, item.children))
|
|
|
|
|
|
|
|
|
|
|
|
title.value.label = data[0].children[0].label
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch (error) {
|
|
|
|
catch (error) {
|
|
|
|
console.error('Error fetching menu items:', error)
|
|
|
|
console.error('Error fetching menu items:', error)
|
|
|
@ -367,36 +371,41 @@ const dataSource: any = [
|
|
|
|
},
|
|
|
|
},
|
|
|
|
]
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
|
|
// //被选中时调
|
|
|
|
//删除
|
|
|
|
// function myFunction({ item, key, selectedKeys }) {
|
|
|
|
const [modal, contextHolder] = Modal.useModal()
|
|
|
|
// // 在这里可以使用 item、key 和 selectedKeys
|
|
|
|
function showDeleteConfirm() {
|
|
|
|
// console.log(item)
|
|
|
|
modal.confirm({
|
|
|
|
// console.log(key)
|
|
|
|
title: '操作确认',
|
|
|
|
// console.log(selectedKeys)
|
|
|
|
icon: h(ExclamationCircleOutlined),
|
|
|
|
// }
|
|
|
|
content: '确认删除嘛',
|
|
|
|
|
|
|
|
okText: '确认',
|
|
|
|
// // 调用函数时传递一个包含 item、key 和 selectedKeys 属性的对象
|
|
|
|
okType: 'danger',
|
|
|
|
// const data = {
|
|
|
|
cancelText: '取消',
|
|
|
|
// item: '仓库名称',
|
|
|
|
onOk() {
|
|
|
|
// key: 'someKey',
|
|
|
|
console.log('OK')
|
|
|
|
// selectedKeys: ['key1', 'key2'],
|
|
|
|
},
|
|
|
|
// }
|
|
|
|
onCancel() {
|
|
|
|
|
|
|
|
console.log('Cancel')
|
|
|
|
// myFunction(data)
|
|
|
|
},
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
onMounted(() => {
|
|
|
|
onMounted(() => {
|
|
|
|
fetchData()
|
|
|
|
fetchData()
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
const handleClick: MenuProps['onClick'] = (e) => {
|
|
|
|
const menusubhandleClick: MenuProps['onClick'] = (e) => {
|
|
|
|
console.log(e)
|
|
|
|
// console.log('click', JSON.parse(JSON.stringify(e.item.originItemValue)) )
|
|
|
|
|
|
|
|
// alert(`当前打开的是${e.key}`)
|
|
|
|
|
|
|
|
title.value = JSON.parse(JSON.stringify(e.item.originItemValue))
|
|
|
|
|
|
|
|
|
|
|
|
console.log('click', e)
|
|
|
|
|
|
|
|
alert(`当前打开的是${e.key}`)
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
watch(navopenKeys, (val) => {
|
|
|
|
// watch(navopenKeys, (val) => {
|
|
|
|
console.log('navopenKeys', val)
|
|
|
|
// console.log('-----------')
|
|
|
|
})
|
|
|
|
// console.log('navopenKeys', val)
|
|
|
|
|
|
|
|
// })
|
|
|
|
</script>
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
<template>
|
|
|
|
<template>
|
|
|
@ -417,14 +426,14 @@ watch(navopenKeys, (val) => {
|
|
|
|
style="width: 256px;height: 900px;"
|
|
|
|
style="width: 256px;height: 900px;"
|
|
|
|
mode="inline"
|
|
|
|
mode="inline"
|
|
|
|
:items="items"
|
|
|
|
:items="items"
|
|
|
|
@click="handleClick"
|
|
|
|
@click="menusubhandleClick"
|
|
|
|
/>
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="main">
|
|
|
|
<div class="main">
|
|
|
|
<div class="designation">
|
|
|
|
<div class="designation">
|
|
|
|
<p>
|
|
|
|
<p>
|
|
|
|
<span>▋</span>
|
|
|
|
<span>▋</span>
|
|
|
|
{{ `车间名称` }}
|
|
|
|
{{ title.label }}
|
|
|
|
</p>
|
|
|
|
</p>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<!-- 表单 -->
|
|
|
|
<!-- 表单 -->
|
|
|
@ -513,6 +522,7 @@ watch(navopenKeys, (val) => {
|
|
|
|
<a-col :span="24">
|
|
|
|
<a-col :span="24">
|
|
|
|
<a-table
|
|
|
|
<a-table
|
|
|
|
class="ant-table-striped" :data-source="dataSource" :row-selection="rowSelection"
|
|
|
|
class="ant-table-striped" :data-source="dataSource" :row-selection="rowSelection"
|
|
|
|
|
|
|
|
style="width: 1000px;"
|
|
|
|
:columns="columns"
|
|
|
|
:columns="columns"
|
|
|
|
:row-class-name="(_record, index) => (index % 2 === 1 ? 'table-tr-b' : 'table-tr-a')" :scroll="{ x: 1500, y: 500 }"
|
|
|
|
:row-class-name="(_record, index) => (index % 2 === 1 ? 'table-tr-b' : 'table-tr-a')" :scroll="{ x: 1500, y: 500 }"
|
|
|
|
>
|
|
|
|
>
|
|
|
@ -636,7 +646,10 @@ watch(navopenKeys, (val) => {
|
|
|
|
</a-row>
|
|
|
|
</a-row>
|
|
|
|
</template>
|
|
|
|
</template>
|
|
|
|
<template v-else-if="column.key === 'key'">
|
|
|
|
<template v-else-if="column.key === 'key'">
|
|
|
|
<div><a>详情</a></div>
|
|
|
|
<div centered style="color: red;cursor:pointer" @click="showDeleteConfirm">
|
|
|
|
|
|
|
|
删除
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<contextHolder />
|
|
|
|
</template>
|
|
|
|
</template>
|
|
|
|
</template>
|
|
|
|
</template>
|
|
|
|
</a-table>
|
|
|
|
</a-table>
|
|
|
@ -650,17 +663,16 @@ watch(navopenKeys, (val) => {
|
|
|
|
<style scoped lang="less">
|
|
|
|
<style scoped lang="less">
|
|
|
|
.card{
|
|
|
|
.card{
|
|
|
|
box-sizing: border-box;
|
|
|
|
box-sizing: border-box;
|
|
|
|
width: 90%;
|
|
|
|
width: 1800px;
|
|
|
|
margin: 0 auto;
|
|
|
|
margin: 0 auto;
|
|
|
|
overflow: hidden;
|
|
|
|
overflow: hidden;
|
|
|
|
border-radius: 3px;
|
|
|
|
border-radius: 3px;
|
|
|
|
|
|
|
|
|
|
|
|
.mainbody{
|
|
|
|
.mainbody{
|
|
|
|
box-sizing: border-box;
|
|
|
|
box-sizing: border-box;
|
|
|
|
display: flex;
|
|
|
|
display: flex;
|
|
|
|
width: 100%;
|
|
|
|
width: 1420px;
|
|
|
|
height: 1000px;
|
|
|
|
height: 942px;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.aside{
|
|
|
|
.aside{
|
|
|
|
margin: 50px 0;
|
|
|
|
margin: 50px 0;
|
|
|
@ -678,7 +690,7 @@ watch(navopenKeys, (val) => {
|
|
|
|
margin: 10px 0 ;
|
|
|
|
margin: 10px 0 ;
|
|
|
|
|
|
|
|
|
|
|
|
p{
|
|
|
|
p{
|
|
|
|
width: 110px;
|
|
|
|
width: 120px;
|
|
|
|
height: 24px;
|
|
|
|
height: 24px;
|
|
|
|
margin-bottom: 15px;
|
|
|
|
margin-bottom: 15px;
|
|
|
|
font-family: "AlibabaPuHuiTi_3_55_Regular-55 Regular";
|
|
|
|
font-family: "AlibabaPuHuiTi_3_55_Regular-55 Regular";
|
|
|
|