This commit is contained in:
linfso 2025-07-01 17:37:50 +08:00
parent 97961f2945
commit 831dcec011
4 changed files with 303 additions and 7 deletions

View File

@ -17,6 +17,14 @@ export function listSimpleEmisTransLine(query) {
})
}
export function listSimpleAllEmisTransLine(query) {
return request({
url: '/emis/emisTransLine/listSimpleAll',
method: 'get',
params: query
})
}
// 查询线路详细
export function getEmisTransLine(id) {

View File

@ -0,0 +1,134 @@
<template>
<el-select
ref="selectRef"
:disabled="disabled"
style="width:100%"
filterable
clearable
remote
:remote-method="queryData"
v-model="svalue"
:placeholder="placeholder"
@focus="onFocus"
@blur="onBlur"
@change="onChange"
@visible-change="reverseArrow"
>
<el-option v-for="item in optionItems" :key="item.lineCode" :label="item.lineName" :value="item.lineCode" />
</el-select>
<!-- style="width:100%" -->
</template>
<script>
import emitter from 'element-ui/src/mixins/emitter';
import { listSimpleAllEmisTransLine } from "@/api/emis/emisTransLine";
export default {
name: "TransLinePicker",
mixins: [emitter],
props: {
value: {
type: String,
required: false
},
placeholder:{
type: String,
required: false
},
countryCode: {
type: String,
required: false
},
fromCountry: {
type: String,
required: false
},
isInitiated:{
type: [Boolean,String],
required: false,
default:false
},
disabled:{
type: [Boolean],
required: false
},
},
data() {
return {
optionItems: [],
svalue: this.value,
filterMap:new Map(),
queryParams: {
pageNum: 1,
pageSize: 50,
lineCode:null,
lineName:null,
country:this.countryCode,
fromCountry:this.fromCountry
}
};
},
watch: {
value(newVal) {
this.svalue = newVal;
this.queryParams.lineCode=this.svalue ;
},
countryCode(newVal) {
this.queryParams.country=this.countryCode;
this.queryData();
},
fromCountry(newVal) {
this.queryParams.fromCountry=this.fromCountry;
this.queryData();
},
},
created() {
if(this.isInitiated || this.svalue!=null){
this.queryData();
}
},
mounted(){
let rulesDom = this.$refs["selectRef"].$el.querySelector(".el-input .el-input__suffix .el-input__suffix-inner .el-input__icon"); // 找到dom
    rulesDom.classList.add("el-icon-arrow-up"); // 对dom新增class
},
methods: {
onFocus(val){
this.optionItems=[];
this.queryData();
},
onBlur(val){
this.$emit("input", this.svalue);
this.dispatch('ElFormItem', 'el.form.blur', [this.svalue]);
},
onChange() {
this.$emit("input", this.svalue);
this.$emit("onChange",this.filterMap[this.svalue]);
this.dispatch('ElFormItem', 'el.form.change', [this.svalue]);
},
queryData(val) {
this.queryParams.lineName=val;
listSimpleAllEmisTransLine( this.queryParams).then(response => {
this.optionItems = response.rows;
this.optionItems.forEach(item => {
this.filterMap[item.lineCode]=item;
});
});
},
reverseArrow(flag) {
let rulesDom = this.$refs["selectRef"].$el.querySelector(
".el-input .el-input__suffix .el-input__suffix-inner .el-input__icon"
); // 找到dom
if (flag) {
rulesDom.classList.add("is-reverse"); // 对dom新增class
} else {
rulesDom.classList.remove("is-reverse"); // 对dom新增class
}
},
}
};
</script>

View File

@ -0,0 +1,156 @@
<template>
<el-select
multiple
collapse-tags
clearable
ref="selectRef"
v-model="svalue"
:placeholder="placeholder"
@blur="onBlur"
@focus="onFocus"
style="width:100%"
class="mutiSelect"
:popper-append-to-body="false"
@change="onChange">
<div style="padding: 0px 8px 0 20px;width:100%;line-height:34px;display:inline-flex">
<div style="width:50%">
<el-checkbox :indeterminate="isIndeterminate" v-model="checkAll" @change="handleCheckAllChange">全选</el-checkbox>
</div>
<div style="width:50%;text-align:right">
<el-button type="primary" size="mini" style="padding:2px 10px" @click="hideMe">确定</el-button>
</div>
</div>
<el-checkbox-group v-model="svalue">
<el-option v-for="item in optionItems" :key="item.prodCode" :label="item.prodName" :value="item.prodCode">
<el-checkbox style="pointer-events: none" :key="item.prodCode" :label="item.prodCode+''">
<span v-if="item.status==1">{{item.prodName}}</span>
<span v-else style="text-decoration: line-through;color: gray;">{{item.prodName}}(停用)</span>
</el-checkbox>
</el-option>
<!-- style="pointer-events: none" -->
</el-checkbox-group>
</el-select>
<!-- style="width:100%" multiple-->
</template>
<script>
import emitter from 'element-ui/src/mixins/emitter';
import { listEmisTransProduct } from "@/api/emis/emisTransProduct";
export default {
name: "TransProductMultiplePicker",
mixins: [emitter],
props: {
value: {
type: [String],
required: false
},
transLineCode: {
type: String,
required: false
},
placeholder:{
type: String,
required: false
},
isInitiated:{
type: [Boolean,String],
required: false,
default:false
}
},
data() {
return {
optionItems: [],
svalue: [],
isFistInit:true,
checkAll: false, //招标阶段 是否全选
isIndeterminate: false, //全选复选框标识
searchProdCode:this.value,
};
},
watch: {
value(newVal) {
if(this.value){
this.svalue = this.value.split(',');
}
},
transLineCode(newVal) {
this.queryData();
}
},
created() {
this.queryData();
},
methods: {
hideMe(){
this.$refs.selectRef.blur();
},
onFocus(){
this.searchProdCode=null;
},
onBlur(val){
this.$emit("input", this.svalue?this.svalue.join(','):null);
this.dispatch('ElFormItem', 'el.form.blur', [this.svalue]);
},
handleCheckAllChange(isCheckAll){
if(isCheckAll){
const data = this.optionItems.map(item => {
return item.prodCode
})
this.svalue=data
}else{
this.svalue=[];
}
this.$emit("input", this.svalue?this.svalue.join(','):null);
this.isIndeterminate = false;
},
onChange(val) {
console.log(val)
const checkedCount = this.svalue.length;
this.checkAll = checkedCount === this.optionItems.length;
this.isIndeterminate = checkedCount > 0 && checkedCount < this.optionItems.length;
// this.$emit("input", this.svalue);
this.$emit("input", this.svalue?this.svalue.join(','):null);
let itemSelData =[]
this.optionItems.forEach(item=>{
if(item.prodCode === this.svalue){
itemSelData.push(item);
}
});
this.$emit("onChange",itemSelData);
this.dispatch('ElFormItem', 'el.form.change', [this.svalue]);
},
queryData() {
if(!this.transLineCode ){
if(this.isFistInit && !this.value){
this.optionItems=[];
return;
}
}
let queryParams = {
pageNum: 1,
pageSize: 300,
prodCode:this.searchProdCode,
transLineCode:this.transLineCode
};
listEmisTransProduct(queryParams).then(response => {
this.optionItems = response.rows;
});
},
}
};
</script>
<style scoped>
.mutiSelect :deep .el-select-dropdown.is-multiple .el-select-dropdown__item.selected::after {
display: none;
}
</style>

View File

@ -4,7 +4,7 @@
<el-row :gutter="0" style="display: flex;flex-wrap: wrap;">
<el-col :span="12">
<el-form-item label="线路" prop="lineCode">
<TransLinePicker v-model="form.lineCode" isInitiated="true" ></TransLinePicker>
<TransLineAllPicker v-model="form.lineCode" isInitiated="true" ></TransLineAllPicker>
</el-form-item>
</el-col>
<el-col :span="12">
@ -78,9 +78,8 @@ import { listEmisTransPlanRule, getEmisTransPlanRule, delEmisTransPlanRule, addE
import emisTransPlanRuleForm from '@/views/emis/emisTransPlanRule/emisTransPlanRuleForm';
import TransLinePicker from '@/views/emis/EmisBaseTools/TransLinePicker.vue';
import TransProductPicker from '@/views/emis/EmisBaseTools/TransProductPicker.vue';
import TransProductMultiplePicker from '@/views/emis/EmisBaseTools/TransProductMultiplePicker.vue';
import TransLineAllPicker from '@/views/emis/EmisBaseTools/TransLineAllPicker.vue';
import TransProductMultipleAllPicker from '@/views/emis/EmisBaseTools/TransProductMultipleAllPicker.vue';
import EmisSiteSimplePicker1 from '@/views/emis/EmisBaseTools/EmisSiteSimplePicker.vue';
import EmisSiteSimplePicker2 from '@/views/emis/EmisBaseTools/EmisSiteSimplePicker.vue';
@ -100,9 +99,8 @@ export default {
EmisSupplierMultiplePicker,
EmisSiteSimplePicker1,
EmisSiteSimplePicker2,
TransLinePicker,
TransProductPicker,
TransProductMultiplePicker,
TransLineAllPicker,
TransProductMultipleAllPicker,
EmpNamePicker
},
dicts: [