This commit is contained in:
bb_pan 2026-01-05 20:21:17 +08:00
parent cac7fc5ef1
commit 38935f76cc
1 changed files with 34 additions and 4 deletions

View File

@ -122,9 +122,18 @@
</el-select>
</el-form-item>
</el-col> -->
<el-col :span="6">
<el-form-item label="产权单位" prop="propertyUnitId">
<el-select
<el-col :span="6" v-if="hasChildrenPropertyUnit">
<el-form-item label="产权单位" prop="propertyUnitIds">
<el-cascader
clearable
v-model="queryParams.propertyUnitIds"
placeholder="请选择工序"
:options="propertyUnitList"
:props="{ label: 'label', value: 'id', children: 'children' }"
style="width: 100%"
@change="handleUnitChange"
/>
<!-- <el-select
v-model="queryParams.propertyUnitId"
placeholder="请选择产权单位"
clearable
@ -132,7 +141,7 @@
style="width: 100%"
>
<el-option v-for="item in propertyUnitList" :key="item.id" :label="item.label" :value="item.id" />
</el-select>
</el-select> -->
</el-form-item>
</el-col>
<el-col :span="6">
@ -795,6 +804,7 @@ export default {
queryParams: {
province: undefined, //
propertyUnitId: undefined, //
propertyUnitIds: [],
name: undefined, //
specificationModel: undefined, //
major: undefined, //
@ -942,7 +952,27 @@ export default {
],
}
},
computed: {
hasChildrenPropertyUnit() {
const check = (list = []) => {
return list.some(item => {
return (
Array.isArray(item.children) &&
item.children.length > 0
) || check(item.children)
})
}
return check(this.propertyUnitList)
}
},
methods: {
handleUnitChange(value) {
if (value.length === 0) {
this.queryParams.propertyUnitId = undefined
return
}
this.queryParams.propertyUnitId = value[value.length - 1]
},
// key
initDefaultExpandedKeys() {
const keys = []