md
This commit is contained in:
parent
2635f6b887
commit
fe46614af9
@ -1,194 +0,0 @@
|
||||
<template>
|
||||
<el-cascader
|
||||
ref="selectRef"
|
||||
:size="size"
|
||||
:props="props"
|
||||
:key="resetCascader"
|
||||
v-model="svalue"
|
||||
style="width: 100%"
|
||||
clearable
|
||||
filterable
|
||||
@click.native="onClick"
|
||||
@clear="onClear"
|
||||
@blur="onBlur"
|
||||
@change="onChange"
|
||||
></el-cascader>
|
||||
</template>
|
||||
<!-- @input.native="searchFilter" -->
|
||||
<!-- filterable -->
|
||||
<!-- :before-filter="beforeFilter"
|
||||
@input.native="searchFilter" -->
|
||||
<script>
|
||||
|
||||
import { listSimpleEmisTransLine } from "@/api/emis/emisTransLine";
|
||||
import { listSimpleEmisTransProduct } from "@/api/emis/emisTransProduct";
|
||||
|
||||
export default {
|
||||
name: "TransProductCasPicker",
|
||||
props: {
|
||||
value: {
|
||||
type: [String, Number,Array],
|
||||
required: false
|
||||
},
|
||||
countryCode: {
|
||||
type: String,
|
||||
required: false
|
||||
},
|
||||
size:{
|
||||
type: String,
|
||||
required: false
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
resetCascader:0,
|
||||
svalue: this.value,
|
||||
isInit: true,
|
||||
lineCode:null,
|
||||
prodCode:null,
|
||||
searchVal:null,
|
||||
props: {
|
||||
// checkStrictly: true,
|
||||
lazy: true,
|
||||
lazyLoad: (node, resolve) => {
|
||||
const nodes = [];
|
||||
// level: 层级
|
||||
// node 节点数据
|
||||
// 一级菜单数据
|
||||
let level = node.level;
|
||||
// level==0 ? "1" : node.value;
|
||||
let parentCode = node.value;
|
||||
this.queryData(level,parentCode)
|
||||
.then((res) => {
|
||||
res.rows.map((item) => {
|
||||
if(level==0){
|
||||
let obj = {
|
||||
value: item.lineCode,
|
||||
label: item.lineName,
|
||||
leaf: false,
|
||||
};
|
||||
nodes.push(obj);
|
||||
}
|
||||
else if(level==1){
|
||||
let obj = {
|
||||
value: item.prodCode,
|
||||
label: item.prodName+"("+item.agingDesc+")",
|
||||
leaf: true,
|
||||
};
|
||||
nodes.push(obj);
|
||||
}
|
||||
});
|
||||
|
||||
// resolve 节点返回
|
||||
resolve(nodes);
|
||||
})
|
||||
.catch((error) => {
|
||||
// console.log(error);
|
||||
});
|
||||
},
|
||||
},
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
value(newVal) {
|
||||
this.svalue = newVal;
|
||||
if(this.svalue!=null && this.svalue.length==2 && this.isInit) {
|
||||
this.lineCode=this.svalue[0];
|
||||
this.prodCode=this.svalue[1];
|
||||
this.resetCascader++
|
||||
}else{
|
||||
this.$refs.selectRef.handleClear()
|
||||
this.lineCode=null;
|
||||
this.prodCode=null;
|
||||
this.resetCascader++
|
||||
}
|
||||
},
|
||||
countryCode(newVal) {
|
||||
this.resetCascader++
|
||||
}
|
||||
},
|
||||
created() {
|
||||
|
||||
},
|
||||
methods: {
|
||||
beforeFilter (val) {
|
||||
return false;
|
||||
},
|
||||
searchFilter(el){
|
||||
let val = el.target.value;
|
||||
this.searchVal = val;
|
||||
},
|
||||
onClear(){
|
||||
console.log("=======333=>"+this.svalue)
|
||||
this.svalue = null;
|
||||
this.$emit("input", this.svalue);
|
||||
this.$emit("onChange", this.svalue);
|
||||
},
|
||||
onBlur(){
|
||||
this.$emit("input", this.svalue);
|
||||
this.$emit("onChange", this.svalue);
|
||||
},
|
||||
onClick(){
|
||||
this.isInit = false;
|
||||
this.lineCode=null;
|
||||
this.prodCode=null;
|
||||
this.queryData(0,0);
|
||||
},
|
||||
onChange(value) {
|
||||
this.$emit("input", this.svalue);
|
||||
this.$emit("onChange", this.svalue);
|
||||
},
|
||||
async queryData(level,parentCode,val) {
|
||||
// 第1级是线路
|
||||
if(level == 0){
|
||||
let queryParams={
|
||||
pageNum:1,
|
||||
pageSize:500,
|
||||
country:this.countryCode,
|
||||
lineCode:this.lineCode,
|
||||
lineName:val
|
||||
};
|
||||
let res=await listSimpleEmisTransLine(queryParams);
|
||||
return res;
|
||||
}
|
||||
// 产品
|
||||
if(level == 1){
|
||||
let queryParams={
|
||||
pageNum:1,
|
||||
pageSize:500,
|
||||
transLineCode:parentCode,
|
||||
prodCode:this.prodCode,
|
||||
prodName:val,
|
||||
status:1
|
||||
};
|
||||
let res=await listSimpleEmisTransProduct(queryParams);
|
||||
return res;
|
||||
}
|
||||
},
|
||||
|
||||
},
|
||||
};
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.con {
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.el-radio__inner {
|
||||
border-radius: 0;
|
||||
border: 0;
|
||||
width: 170px;
|
||||
height: 34px;
|
||||
background-color: transparent;
|
||||
cursor: pointer;
|
||||
box-sizing: border-box;
|
||||
position: absolute;
|
||||
top: -18px;
|
||||
left: -19px;
|
||||
}
|
||||
|
||||
.el-radio__input.is-checked .el-radio__inner {
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
</style>
|
||||
@ -1,22 +1,21 @@
|
||||
<template>
|
||||
<el-cascader
|
||||
:key="resetCascader"
|
||||
ref="selectRef"
|
||||
:size="size"
|
||||
:props="props"
|
||||
:key="resetCascader"
|
||||
v-model="svalue"
|
||||
style="width: 100%"
|
||||
clearable
|
||||
filterable
|
||||
:filter-method="dataFilter"
|
||||
@click.native="onClick"
|
||||
@clear="onClear"
|
||||
@blur="onBlur"
|
||||
@change="onChange"
|
||||
:debounce="200"
|
||||
></el-cascader>
|
||||
</template>
|
||||
<!-- :append-to-body="false" -->
|
||||
<!-- :before-filter="beforeFilter" -->
|
||||
<!-- :filter-method="dataFilter" -->
|
||||
<!-- @input.native="searchFilter" -->
|
||||
<!-- filterable -->
|
||||
<!-- :before-filter="beforeFilter"
|
||||
@ -51,7 +50,8 @@ export default {
|
||||
prodCode:null,
|
||||
searchVal:null,
|
||||
props: {
|
||||
// checkStrictly: true,
|
||||
checkStrictly: true,
|
||||
emitPath: true,
|
||||
lazy: true,
|
||||
lazyLoad: (node, resolve) => {
|
||||
const nodes = [];
|
||||
@ -68,6 +68,8 @@ export default {
|
||||
let obj = {
|
||||
value: item.lineCode,
|
||||
label: item.lineName,
|
||||
// disabled:true,
|
||||
children:[],
|
||||
leaf: false,
|
||||
};
|
||||
nodes.push(obj);
|
||||
@ -114,29 +116,18 @@ export default {
|
||||
|
||||
},
|
||||
methods: {
|
||||
// beforeFilter (val) {
|
||||
// return false;
|
||||
// },
|
||||
// beforeFilter(value) {
|
||||
// console.log("=======beforeFilter=>"+value)
|
||||
// this.searchVal = value?.trim()
|
||||
// console.log(this.searchVal)
|
||||
// // 手动筛选
|
||||
// data.options2 = data.options2.filter(v => v.label.indexOf(data.keyWord) > -1)
|
||||
// // 空的时候显示默认的筛选无结果面板
|
||||
// if (data.options2.length === 0) {
|
||||
// return true
|
||||
// }
|
||||
// // 懒加载时默认筛选无效 直接禁用它 让组件加载我们手动筛选的数据
|
||||
// return false
|
||||
// },
|
||||
beforeFilter (val) {
|
||||
return false;
|
||||
},
|
||||
searchFilter(el){
|
||||
let val = el.target.value;
|
||||
this.searchVal = val;
|
||||
setTimeout(() => {
|
||||
this.resetCascader++;
|
||||
},1000);
|
||||
|
||||
},
|
||||
regionMenuChange(boolean){
|
||||
if(boolean){
|
||||
this.$refs.selectRef.$refs.panel.activePath=[];
|
||||
this.queryData(0,0);
|
||||
}
|
||||
},
|
||||
onClear(){
|
||||
console.log("=======333=>"+this.svalue)
|
||||
@ -160,7 +151,7 @@ export default {
|
||||
},
|
||||
dataFilter(node, val) {
|
||||
console.log('val', val, 'node', node)
|
||||
if (!!~node.text.indexOf(val) || !!~node.text.toUpperCase().indexOf(val.toUpperCase())) {
|
||||
if (!!~node.label.indexOf(val) || !!~node.label.toUpperCase().indexOf(val.toUpperCase())) {
|
||||
return true
|
||||
}
|
||||
},
|
||||
@ -184,7 +175,6 @@ export default {
|
||||
pageSize:500,
|
||||
transLineCode:parentCode,
|
||||
prodCode:this.prodCode,
|
||||
prodName:this.searchVal,
|
||||
status:1
|
||||
};
|
||||
let res=await listSimpleEmisTransProduct(queryParams);
|
||||
@ -195,7 +185,7 @@ export default {
|
||||
},
|
||||
};
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
<style lang="scss">
|
||||
.con {
|
||||
display: inline-block;
|
||||
}
|
||||
@ -217,4 +207,27 @@ export default {
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
.el-cascader-panel [id^="cascader-menu-"][id$="-1"] div .el-radio {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
z-index: 10;
|
||||
position: absolute;
|
||||
top: 0px;
|
||||
right: 30px;
|
||||
}
|
||||
.el-cascader-panel [id^="cascader-menu-"][id$="-2"] div .el-radio {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
z-index: 10;
|
||||
position: absolute;
|
||||
top: 0px;
|
||||
right: 30px;
|
||||
}
|
||||
.el-cascader-panel .el-radio__input {
|
||||
visibility: hidden;
|
||||
}
|
||||
.el-cascader-panel [id^="cascader-menu-"][id$="-0"] div .el-radio__input {
|
||||
display: none;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
@ -9,7 +9,7 @@
|
||||
:showPagination="false"
|
||||
:showOperateButton="false"
|
||||
:showCustomizeTpl="false"
|
||||
:default-sort="{prop: 'scanDate', order: 'descending'}"
|
||||
:default-sort="{prop: 'scanDate', order: 'ascending'}"
|
||||
>
|
||||
<el-table-column label="序号" align="center" min-width="60">
|
||||
<template slot-scope="scope">
|
||||
@ -17,7 +17,6 @@
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
|
||||
<el-table-column :label="$t('扫描时间')" align="center" prop="scanDate" :sortable="true" :sort-method="sortByScanDate" min-width="170" >
|
||||
<template slot-scope="scope">
|
||||
<span>{{ parseTime(scope.row.scanDate) }}</span>
|
||||
|
||||
@ -1548,7 +1548,7 @@ methods: {
|
||||
});
|
||||
},
|
||||
startTimer(){
|
||||
if(this.action=='add' || action=='preAdd'){
|
||||
if(this.action=='add' || this.action=='preAdd'){
|
||||
this.sendDate=parseTime(new Date());
|
||||
this.timer = setTimeout(this.startTimer, 1000);
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user