修改bug

This commit is contained in:
‘937886381’
2024-03-21 16:34:34 +08:00
parent aa582495de
commit f7aa5375d0
12 changed files with 220 additions and 195 deletions

View File

@@ -17,10 +17,10 @@
@mouseleave="factoryListOpen = false">
{{ currentFactory?.label || '点我选择设备' }}
<div class="factory-list__wrapper" :class="{ open: factoryListOpen }">
<ul class="factory-list" v-if="sidebarContent.length" @click.prevent="factoryChangeHandler">
<li v-for="fc in sidebarContent" :key="fc.id" :data-value="fc.id" class="factory-list__item"
<ul class="factory-list" v-if="sidebarContent.length" @click.capture="factoryChangeHandler">
<li v-for="fc in sidebarContent" :key="fc.id" class="factory-list__item"
:class="{ 'is-current': fc.id == currentFactory?.id }">
<span>
<span :data-value="fc.id">
{{ fc.label }}
</span>
<svg-icon v-if="fc.id == currentFactory?.id" icon-class="Confirm" style="height: 14px; width: 14px" />
@@ -95,12 +95,12 @@ export default {
factoryListOpen: false,
currentFactory: null,
factoryList: [
{ name: '1', value: 1 },
{ name: '2', value: 2 },
{ name: '3', value: 3 },
{ name: '4', value: 4 },
{ name: '5', value: 5 },
{ name: '6', value: 6 },
// { name: '1', value: 1 },
// { name: '2', value: 2 },
// { name: '3', value: 3 },
// { name: '4', value: 4 },
// { name: '5', value: 5 },
// { name: '6', value: 6 },
],
sidebarContent: [
// {
@@ -486,14 +486,12 @@ export default {
},
async getTree(id) {
getTreeData({id:id}).then((res) => {
console.log(res.data);
this.sidebarContent = res.data;
this.buildTree(res.data);
console.log('tree', this.sidebarContent);
// console.log(this.formConfig[0].selectOptions);
// this.listQuery.total = response.data.total;
})
const res = await getTreeData({ id: id })
console.log(res.data)
this.buildTree(res.data);
this.sidebarContent = res.data;
console.log('tree', this.sidebarContent)
console.log(this.sidebarContent);
// const { data } = await this.$axios('/base/core-factory/getTreeByWorkOrder');
// console.log(data)
@@ -504,10 +502,13 @@ export default {
},
factoryChangeHandler(event) {
this.factoryListOpen = false;
this.currentFactory =undefined
this.factoryListOpen = false
console.log(event.target.dataset);
const fcId = event.target.dataset.value;
this.handleSidebarItemClick({ id: fcId, type: '工厂' });
this.currentFactory = this.sidebarContent.find((item) => item.id == fcId);
this.currentFactory = this.sidebarContent.find((item) => item.id == fcId)
console.log(this.currentFactory);
},
handleSidebarItemClick({ label, id, type }) {