|
|
@@ -1,23 +1,29 @@
|
|
|
<template>
|
|
|
- <el-form :model="formData" ref="formData" :inline="true" size="small">
|
|
|
+ <el-form :model="formData"
|
|
|
+ :rules="rules"
|
|
|
+ ref="publicForm" :inline="true" size="small" >
|
|
|
<el-row :gutter="20">
|
|
|
<el-col :span="8" v-for="f in ruleForm" :key="f.prop">
|
|
|
- <el-form-item :label="f.label" :prop="f.prop" label-width="120px">
|
|
|
+ <el-form-item :label="f.label" :prop="f.prop" label-width="120px"
|
|
|
+ >
|
|
|
<template>
|
|
|
<template v-if="f.type === 'input'">
|
|
|
<el-input clearable v-model.trim="formData[f.prop]"
|
|
|
- :placeholder="'请输入' + f.label"></el-input>
|
|
|
+ :placeholder="'请输入' + f.label"
|
|
|
+ ></el-input>
|
|
|
</template>
|
|
|
- <template v-else-if="f.type === 'company'">
|
|
|
+ <!-- <template v-else-if="f.type === 'company'">
|
|
|
<el-select size="small" clearable v-model="formData[f.prop]"
|
|
|
:placeholder="'请输入' + f.label">
|
|
|
<el-option label="不限" value v-if="f.selectAuto"></el-option>
|
|
|
<el-option v-for="(s, i) in InsCompanyList" :key="i" :label="s.name"
|
|
|
:value="s.id"></el-option>
|
|
|
</el-select>
|
|
|
- </template>
|
|
|
+ </template> -->
|
|
|
+ <!-- 机构下拉 -->
|
|
|
<template v-if="f.type === 'dept'">
|
|
|
<el-cascader
|
|
|
+ ref="myCascader"
|
|
|
:options="option"
|
|
|
v-model.trim="formData[f.prop]"
|
|
|
clearable
|
|
|
@@ -68,7 +74,11 @@ export default {
|
|
|
formData: {
|
|
|
type: Object,
|
|
|
default: {}
|
|
|
- }
|
|
|
+ },
|
|
|
+ rules: {
|
|
|
+ type: Object,
|
|
|
+ default: {}
|
|
|
+ },
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
@@ -83,8 +93,20 @@ export default {
|
|
|
},
|
|
|
methods:{
|
|
|
handleChange(val){
|
|
|
- this.$emit('handleChange',val)
|
|
|
- }
|
|
|
+ console.log(val,this.$refs.myCascader[0],111111111)
|
|
|
+
|
|
|
+ if(val && val.length == 0) {
|
|
|
+ console.log(this.$refs.myCascader[0],111111111)
|
|
|
+ this.$refs.myCascader[0].$refs.panel.checkedValue = []; // 清空选中值
|
|
|
+ this.$refs.myCascader[0].$refs.panel.clearCheckedNodes(); // 清空级联选择器选中状态
|
|
|
+ this.$refs.myCascader[0].$refs.panel.activePath = []; // 清除高亮
|
|
|
+ this.$refs.myCascader[0].$refs.panel.syncActivePath(); // 初始化(只展示一级节点)
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ this.$emit('handleChange',val)
|
|
|
+ }
|
|
|
+
|
|
|
+ },
|
|
|
}
|
|
|
|
|
|
|