1.JDate年份显示正常(模态框需完善)

2.a-tree-select搜索接口联调(value值重复需完善)
This commit is contained in:
yaoyanan
2021-03-18 17:40:45 +08:00
parent 8c489cac12
commit 3e3a523644
2 changed files with 42 additions and 17 deletions
+13 -14
View File
@@ -31,19 +31,17 @@
:value="momVal" :value="momVal"
:disabled="disabled || readOnly" :disabled="disabled || readOnly"
:format="dateFormat" :format="dateFormat"
@change="handleMonthChange" @change="handleMonthChange"/>
/>
<!--YYYY--> <!--YYYY-->
<a-date-picker <a-date-picker
v-if="showType === 'year'" v-if="showType === 'year'"
mode="year"
:placeholder="placeholder" :placeholder="placeholder"
mode="year"
:format="dateFormat" :format="dateFormat"
v-model="addForm.all_plan_one" :value="year"
:open='yearShowOne' :open='yearShowOne'
@openChange="openChangeOne" @openChange="openChangeOne"
@panelChange="panelChangeOne" @panelChange="panelChangeOne"/>
@change="handleYearChange"/>
</div> </div>
</template> </template>
<script> <script>
@@ -96,9 +94,7 @@
let dateStr = this.value; let dateStr = this.value;
return { return {
yearShowOne:false, //控制年份模态框的显示与否 yearShowOne:false, //控制年份模态框的显示与否
addForm:{ year:'',
all_plan_one:null,//开始年限
},
decorator:"", decorator:"",
momVal:!dateStr?null:moment(dateStr,this.dateFormat) momVal:!dateStr?null:moment(dateStr,this.dateFormat)
} }
@@ -132,13 +128,11 @@
}, },
// 得到年份选择器的值 // 得到年份选择器的值
panelChangeOne(value){ panelChangeOne(value){
this.addForm.all_plan_one = value let year = moment(value,this.dateFormat).year().toString() // 处理成字符串
this.year = value //组件显示的
this.$emit('change',year)
this.yearShowOne = false this.yearShowOne = false
}, },
handleYearChange(mom,dateStr){
this.yearShowOne = false
this.$emit('change',dateStr)
}
}, },
//2.2新增 在组件内定义 指定父组件调用时候的传值属性和事件类型 这个牛逼 //2.2新增 在组件内定义 指定父组件调用时候的传值属性和事件类型 这个牛逼
model: { model: {
@@ -146,4 +140,9 @@
event: 'change' event: 'change'
} }
} }
// let bodyO = document.querySelector()
// bodyO.onclick = function (){
// console.log(0)
// }
</script> </script>
+29 -3
View File
@@ -12,6 +12,7 @@
:value="treeValue" :value="treeValue"
:treeData="treeData" :treeData="treeData"
:multiple="multiple" :multiple="multiple"
:show-search="!multiple"
@change="onChange" @change="onChange"
@search="onSearch"> @search="onSearch">
</a-tree-select> </a-tree-select>
@@ -128,7 +129,7 @@
this.$emit('change', this.value,text) this.$emit('change', this.value,text)
} }
}, },
initDictInfo(){ initDictInfo(){ //取出父组件传过来的codetexttableName
let arr = this.dict.split(",") let arr = this.dict.split(",")
this.tableName = arr[0] this.tableName = arr[0]
this.text = arr[1] this.text = arr[1]
@@ -150,6 +151,7 @@
hasChildField:this.hasChildField, hasChildField:this.hasChildField,
condition:this.condition condition:this.condition
} }
console.log(param)
getAction(this.url,param).then(res=>{ getAction(this.url,param).then(res=>{
if(res.success){ if(res.success){
console.log(res) console.log(res)
@@ -184,7 +186,7 @@
} }
} }
}, },
loadRoot(){ loadRoot(){ // 初始化树
let param = { let param = {
pid:this.pidValue, pid:this.pidValue,
tableName:this.tableName, tableName:this.tableName,
@@ -224,7 +226,31 @@
}, },
onSearch(value){ onSearch(value){
console.log(value) let param = {
code:this.code,
keyword:value,
pidField:this.pidField,
tableName:this.tableName,
text:this.text
}
getAction('/sys/dict/queryTreeDataByKeyword',param).then((res)=>{
if (res.success){
//设置是否是叶子节点(是否能展开)
for(let i of res.result){
i.value = i.key
if(i.leaf==false){
i.isLeaf=false
}else if(i.leaf==true){
i.isLeaf=true
}
}
//赋值树的数据
this.treeData = []
this.treeData = [...res.result]
// this.treeData = fn(res.result)
// fn(res.result)
}
})
}, },
getCurrTreeData(){ getCurrTreeData(){
return this.treeData return this.treeData