✨ feat: 部门选择组件添加快捷二次菜单
This commit is contained in:
parent
9568f7b59c
commit
1a8bffc97a
|
@ -8,6 +8,11 @@
|
||||||
placeholder="请选择组织部门"
|
placeholder="请选择组织部门"
|
||||||
@select="handleDeptSelect"
|
@select="handleDeptSelect"
|
||||||
/>
|
/>
|
||||||
|
<el-button-group v-if="showQuickGroup">
|
||||||
|
<el-button v-for="child in firstChildList" :key="child.deptName" plain @click="quickSelect(child)">
|
||||||
|
{{ child.deptName }}
|
||||||
|
</el-button>
|
||||||
|
</el-button-group>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -22,11 +27,18 @@ export default {
|
||||||
components: {
|
components: {
|
||||||
Treeselect,
|
Treeselect,
|
||||||
},
|
},
|
||||||
|
props: {
|
||||||
|
showQuickGroup: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false,
|
||||||
|
},
|
||||||
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
deptId: "",
|
deptId: "",
|
||||||
// 部门树数据
|
// 部门树数据
|
||||||
deptList: [],
|
deptList: [],
|
||||||
|
firstChildList: [],
|
||||||
normalizer(node) {
|
normalizer(node) {
|
||||||
return {
|
return {
|
||||||
id: node.deptId,
|
id: node.deptId,
|
||||||
|
@ -56,11 +68,14 @@ export default {
|
||||||
// this.$message.error("默认企业配置错误,请配置sys.user.defaultFactoryId");
|
// this.$message.error("默认企业配置错误,请配置sys.user.defaultFactoryId");
|
||||||
// }
|
// }
|
||||||
// },
|
// },
|
||||||
|
quickSelect(child) {
|
||||||
|
this.deptId = child.deptId;
|
||||||
|
this.$emit("deptChange", child);
|
||||||
|
},
|
||||||
async initDeptList() {
|
async initDeptList() {
|
||||||
const [err, response] = await to(
|
const [err, response] = await to(
|
||||||
listDept({
|
listDept({
|
||||||
deptName: undefined,
|
deptName: undefined,
|
||||||
|
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
if (err) {
|
if (err) {
|
||||||
|
@ -71,6 +86,7 @@ export default {
|
||||||
if (response.code === 200) {
|
if (response.code === 200) {
|
||||||
this.deptList = this.handleTree(response.data, "deptId");
|
this.deptList = this.handleTree(response.data, "deptId");
|
||||||
this.deptId = this.deptList[0].deptId;
|
this.deptId = this.deptList[0].deptId;
|
||||||
|
this.firstChildList = this.deptList[0].children;
|
||||||
this.$emit("deptChange", this.deptList[0]);
|
this.$emit("deptChange", this.deptList[0]);
|
||||||
} else {
|
} else {
|
||||||
console.error(response);
|
console.error(response);
|
||||||
|
@ -85,4 +101,14 @@ export default {
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped></style>
|
<style scoped>
|
||||||
|
.dept-tree {
|
||||||
|
width: 100%;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: flex-start;
|
||||||
|
.el-button-group {
|
||||||
|
margin-top: 5px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
|
@ -1,24 +1,21 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="data-monitor">
|
<div class="data-monitor">
|
||||||
<el-row :gutter="10">
|
<el-row :gutter="10">
|
||||||
<el-col :span="6" style="margin-top: 10px; margin-bottom: 10px">
|
<el-col :span="10" style="margin-top: 10px; margin-bottom: 10px">
|
||||||
<dept-tree @deptChange="handleDeptChange" />
|
<dept-tree @deptChange="handleDeptChange" :showQuickGroup="true" />
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="6" style="margin-top: 10px; margin-bottom: 10px">
|
<el-col :span="6" style="margin-top: 10px; margin-bottom: 10px">
|
||||||
<!-- 时间范围选择 -->
|
<!-- 时间范围选择 -->
|
||||||
<el-date-picker v-model="dateValue" type="daterange" start-placeholder="开始日期" end-placeholder="结束日期"
|
<el-date-picker
|
||||||
:default-time="['00:00:00', '23:59:59']" @change="handleDateChange">
|
v-model="dateValue"
|
||||||
|
type="daterange"
|
||||||
|
start-placeholder="开始日期"
|
||||||
|
end-placeholder="结束日期"
|
||||||
|
:default-time="['00:00:00', '23:59:59']"
|
||||||
|
@change="handleDateChange"
|
||||||
|
>
|
||||||
</el-date-picker>
|
</el-date-picker>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col>
|
|
||||||
<el-radio-group v-model="deptId" @change="handleRadioDeptChange">
|
|
||||||
<el-radio-button :label="229">青岛港</el-radio-button>
|
|
||||||
<el-radio-button :label="230">日照港</el-radio-button>
|
|
||||||
<el-radio-button :label="231">烟台港</el-radio-button>
|
|
||||||
<el-radio-button :label="232">渤海湾港</el-radio-button>
|
|
||||||
</el-radio-group>
|
|
||||||
|
|
||||||
</el-col>
|
|
||||||
</el-row>
|
</el-row>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
@ -36,13 +33,6 @@ export default {
|
||||||
// chooseDept:null,
|
// chooseDept:null,
|
||||||
deptId: "",
|
deptId: "",
|
||||||
dateValue: [],
|
dateValue: [],
|
||||||
normalizer(node) {
|
|
||||||
return {
|
|
||||||
id: node.deptId,
|
|
||||||
label: node.deptName,
|
|
||||||
children: node.children,
|
|
||||||
};
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
|
@ -64,7 +54,7 @@ export default {
|
||||||
];
|
];
|
||||||
},
|
},
|
||||||
handleRadioDeptChange(value) {
|
handleRadioDeptChange(value) {
|
||||||
this.deptId = value
|
this.deptId = value;
|
||||||
this.emitChange();
|
this.emitChange();
|
||||||
},
|
},
|
||||||
handleDeptChange(value) {
|
handleDeptChange(value) {
|
||||||
|
|
Loading…
Reference in New Issue