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"
:disabled="disabled || readOnly"
:format="dateFormat"
@change="handleMonthChange"
/>
@change="handleMonthChange"/>
<!--YYYY-->
<a-date-picker
v-if="showType === 'year'"
mode="year"
:placeholder="placeholder"
mode="year"
:format="dateFormat"
v-model="addForm.all_plan_one"
:value="year"
:open='yearShowOne'
@openChange="openChangeOne"
@panelChange="panelChangeOne"
@change="handleYearChange"/>
@panelChange="panelChangeOne"/>
</div>
</template>
<script>
@@ -96,9 +94,7 @@
let dateStr = this.value;
return {
yearShowOne:false, //控制年份模态框的显示与否
addForm:{
all_plan_one:null,//开始年限
},
year:'',
decorator:"",
momVal:!dateStr?null:moment(dateStr,this.dateFormat)
}
@@ -132,13 +128,11 @@
},
// 得到年份选择器的值
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
},
handleYearChange(mom,dateStr){
this.yearShowOne = false
this.$emit('change',dateStr)
}
},
//2.2新增 在组件内定义 指定父组件调用时候的传值属性和事件类型 这个牛逼
model: {
@@ -146,4 +140,9 @@
event: 'change'
}
}
// let bodyO = document.querySelector()
// bodyO.onclick = function (){
// console.log(0)
// }
</script>
+29 -3
View File
@@ -12,6 +12,7 @@
:value="treeValue"
:treeData="treeData"
:multiple="multiple"
:show-search="!multiple"
@change="onChange"
@search="onSearch">
</a-tree-select>
@@ -128,7 +129,7 @@
this.$emit('change', this.value,text)
}
},
initDictInfo(){
initDictInfo(){ //取出父组件传过来的codetexttableName
let arr = this.dict.split(",")
this.tableName = arr[0]
this.text = arr[1]
@@ -150,6 +151,7 @@
hasChildField:this.hasChildField,
condition:this.condition
}
console.log(param)
getAction(this.url,param).then(res=>{
if(res.success){
console.log(res)
@@ -184,7 +186,7 @@
}
}
},
loadRoot(){
loadRoot(){ // 初始化树
let param = {
pid:this.pidValue,
tableName:this.tableName,
@@ -224,7 +226,31 @@
},
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(){
return this.treeData