This commit is contained in:
linfso 2025-06-25 05:17:05 +08:00
parent 82aa575f73
commit 6c1946b53c
2 changed files with 453 additions and 0 deletions

View File

@ -0,0 +1,146 @@
<template>
<el-select
style="width:100%"
ref="selectRef"
filterable
clearable
remote
:remote-method="remoteDebounce"
v-model="svalue"
:placeholder="placeholder"
auto-complete="new-password"
:disabled="disabled"
@blur="onBlur"
@change="onChange"
@click.native="onClick"
@visible-change="reverseArrow"
>
<el-option v-for="item in optionItems" :key="item.code" :label="item.name" :value="item.code" ></el-option>
</el-select>
</template>
<script>
import emitter from 'element-ui/src/mixins/emitter';
import { chooseSupplier } from "@/api/emis/emisSupplier";
// /api/bizsvr/emis/emisSupplier/chooseSupplier?params%5BstartSiteCode%5D=84007&params%5BnextSiteCode%5D=84001
import { debounce} from "@/utils/custom";
export default {
name: "EmisSupplierPicker",
mixins: [emitter],
props: {
value: {
type: [String],
required: false
},
startSiteCode: {
type: String,
required: false
},
nextSiteCode: {
type: String,
required: false
},
placeholder:{
type: [String],
required: false
},
disabled:{
type: [Boolean],
required: false
},
},
data() {
return {
svalue: this.value,
optionItems: [],
// 缺省值
defaultItems: null,
countryMap:new Map()
};
},
watch: {
value(newVal,oldVal) {
// 逻辑 有初始值先查询初值
// if(this.value!=null){
this.svalue=this.value;
this.queryData(null,this.svalue);
// }
},
startSiteCode(newVal,oldVal) {
this.queryData(null,this.svalue);
},
nextSiteCode(newVal,oldVal) {
this.queryData(null,this.svalue);
},
},
created() {
if(this.svalue!=null){
this.queryData(null,this.svalue);
}
},
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: {
onClick(){
// 第一次点击时需要初始化
if(!this.defaultItems){
this.queryData(null,null);
}else{
this.optionItems = [...this.defaultItems];
}
},
onBlur(val){
this.$emit("input", this.svalue);
this.dispatch('ElFormItem', 'el.form.blur');
},
onChange() {
this.$emit("input", this.svalue);
let itemData = this.optionItems.find(item => item.code == this.svalue);
this.$emit("change",itemData);
this.$emit("onChange",itemData);
this.dispatch('ElFormItem', 'el.form.change', [this.svalue]);
},
remoteDebounce(val,key){
debounce(this.queryData(val,key),1000);
},
queryData(val,key) {
this.optionItems=[];
let queryParams = {
pageNum:1,
pageSize:5,
code:key,
name:val,
params:{
startSiteCode:this.startSiteCode,
nextSiteCode:this.nextSiteCode
}
};
chooseSupplier(queryParams).then(response => {
this.optionItems =response.rows;
// 初始值存储
if(key==null && val==null){
this.defaultItems=[...this.optionItems]
}else{
this.onChange();
}
});
},
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,307 @@
<template>
<div >
<el-form ref="form" size="mini" :model="form" :rules="rules" label-width="80px">
<el-row :gutter="0" style="display: flex;flex-wrap: wrap;">
<el-col :span="8">
<el-form-item :label="$t('起始网点')" prop="startSiteCode">
<EmisSiteSimplePicker :placeholder="$t('请选择')" @onChange="onSiteSelect" v-model="form.startSiteCode" ></EmisSiteSimplePicker>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item :label="$t('下一网点')" prop="nextSiteCode">
<EmisSiteSimplePicker :placeholder="$t('请选择')" @onChange="onNextSiteSelect" v-model="form.nextSiteCode" ></EmisSiteSimplePicker>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item :label="$t('供应商')" prop="supplierCode">
<EmisTmsSiteBatchSupplierPicker :placeholder="$t('请选择')" :startSiteCode="form.startSiteCode" :nextSiteCode="form.nextSiteCode" @onChange="onSupplierSelect" v-model="form.supplierCode" ></EmisTmsSiteBatchSupplierPicker>
</el-form-item>
</el-col>
</el-row>
</el-form>
<div style="text-align: center;margin-bottom: 10px;">
<el-button type="primary" @click="submitForm">确 定</el-button>
<el-button @click="cancel">取 消</el-button>
</div>
</div>
</template>
<script>
import {
getTmsGroupBatchNo, getEmisTmsSiteBatch,
batchEdit
} from "@/api/emis/emisTmsSiteBatch";
import emisTmsPackForm from '@/views/emis/emisTmsPack/emisTmsPackForm';
import elDateAdvPicker from '@/components/DatePickerAdv/elDateAdvPicker';
import CountryPicker from '@/views/emis/EmisBaseTools/CountryPicker.vue';
import EmisSiteSimplePicker from '@/views/emis/EmisBaseTools/EmisSiteSimplePicker.vue';
import EmisGetNextSitePicker from '@/views/emis/EmisBaseTools/EmisGetNextSitePicker.vue';
import TransProductPicker from '@/views/emis/EmisBaseTools/TransProductPicker.vue';
import TransLinePicker from '@/views/emis/EmisBaseTools/TransLinePicker.vue';
import { parseTime, dateToStr } from "@/utils/custom";
import { formatSearchStr } from '@/utils/index'
import moment from 'moment'
import PackListView from '@/views/emis/emisTmsSiteBatch/packListView';
import EmisSupplierPicker from '@/views/emis/EmisBaseTools/EmisSupplierPicker';
import EmisTmsSiteBatchSupplierPicker from '@/views/emis/EmisBaseTools/EmisTmsSiteBatchSupplierPicker';
export default {
name: "BigBatchEditForm",
props:{
ids:{
type:[Number,Array]
},
},
components: { EmisGetNextSitePicker, CountryPicker, EmisSiteSimplePicker, elDateAdvPicker, emisTmsPackForm, TransLinePicker, TransProductPicker, PackListView,EmisSupplierPicker,EmisTmsSiteBatchSupplierPicker},
dicts: ['emis_waybill_status', 'emis_payment_type', 'emis_biz_shipping_method', 'emis_qujian_fangshi', 'cebp_return_status','emis_declare_mode','emis_customs_clear','emis_big_batch_type'],
data() {
return {
// 遮罩层
loading: false,
form: {},
isDataChangeCount:0,
rules: {
supplierCode: [
{ required: true, message: "供应商不能为空", trigger: ["blur","change"] },
],
startSiteCode: [
{ required: true, message: "起始网点不能为空", trigger: ["blur","change"] },
],
nextSiteCode: [
{ required: true, message: "下一网点不能为空", trigger: ["blur","change"] },
],
},
openBatch: false,
titleBatch: "",
formBatchBillList:"",
wayBillotal:0,
currentId:null,
openForm: false,
titleForm: "",
titleWayBill:null,
openWayBillForm:false,
// 弹出展示层
id:null,
titleView:"",
openView: false,
};
},
watch: {
form: {
handler (n, o) {
this.isDataChangeCount++
},
deep: true
}
},
created() {
this.isDataChangeCount=0;
this.reset();
},
methods: {
// 表单重置
reset() {
this.form = {
id: null,
batchNo: null,
batchName: null,
batchDate: null,
supplierCode: null,
supplierName: null,
supplierNameEn: null,
transLineType: null,
productType: null,
batchType: null,
transType: null,
startSiteCode: null,
startSiteSizeCode3:null,
sendCountry: null,
nextSiteCode: null,
nextSiteSizeCode3:null,
airBilllNo: null,
etd: null,
eta: null,
carNo: null,
shipNo: null,
clearanceResStatus: null,
declareResStatus: null,
destCountry: null,
destCountryName: null,
transWeight: null,
packNum: null,
totalParcelQty: null,
totalWaybillQty: null,
totalVolume: null,
totalWeight: null,
opMan: null,
remark: null,
tenantId: null,
};
this.resetForm("form");
},
onSupplierSelect(item){
console.log("==onSupplierSelect===>",item);
if(!item){
this.form.supplierCode=null;
this.form.supplierName=null;
this.form.supplierNameEn=null;
return;
}
this.form.supplierCode=item.code;
this.form.supplierName=item.name;
this.form.supplierNameEn=item.nameEn;
},
onSiteSelect(item){
console.log("==onSiteSelect===>",item);
if(!item){
// this.form.startSiteCode = null;
this.form.startSiteName = null;
this.form.startSiteSizeCode3 = null;
return;
}
// this.form.startSiteCode=item && item.siteCode;
this.form.startSiteName=item && item.siteName;
this.form.startSiteSizeCode3 = item && item.sizeCode3;
},
onNextSiteSelect(item){
if(!item){
// this.form.nextSiteCode = null;
this.form.nextSiteName = null;
this.form.nextSiteSizeCode3 = null;
return;
}
// this.form.nextSiteCode=item && item.siteCode;
this.form.nextSiteName=item && item.siteName;
this.form.nextSiteSizeCode3 = item && item.sizeCode3;
},
// 取消按钮
cancel() {
this.reset();
this.$emit("on-cancel");
},
/** 提交按钮 */
async submitForm() {
// 判断是否有变动
if (this.isDataChangeCount>0 ) {
console.log(this.ids);
if(this.ids.length==0){
let updList = [];
let item={
id:this.ids,
supplierCode: this.form.supplierCode,
supplierName: this.form.supplierName,
supplierNameEn: this.form.supplierNameEn,
startSiteCode: this.form.startSiteCode,
startSiteSizeCode3:this.form.startSiteSizeCode3,
nextSiteCode:this.form.nextSiteCode,
nextSiteSizeCode3:this.form.nextSiteSizeCode3,
}
updList.push(item);
await batchEdit(updList);
}
else if(this.ids.length>0){
let updList = [];
for(let i=0;i<this.ids.length;i++){
let item={
id:this.ids[i],
supplierCode: this.form.supplierCode,
supplierName: this.form.supplierName,
supplierNameEn: this.form.supplierNameEn,
startSiteCode: this.form.startSiteCode,
startSiteSizeCode3:this.form.startSiteSizeCode3,
nextSiteCode:this.form.nextSiteCode,
nextSiteSizeCode3:this.form.nextSiteSizeCode3,
}
updList.push(item);
}
await batchEdit(updList);
}
this.$modal.msgSuccess("修改成功");
this.$emit("on-changed");
}else{
this.$modal.msgSuccess("无变动,无需修改");
}
},
}
};
</script>
<style lang="scss">
.el-divider{
margin-top: 0px;
background: 0 0;
border-top: 1px solid #E6EBF5;
}
.el-divider__text {
color: #0955ee;
cursor: pointer;
}
.query-label {
.el-radio{
display: block;
line-height: 23px;
white-space: normal;
margin-right: 0;
}
}
.overflowhidden{
overflow: hidden;
}
.ellipsis {
width: 100px;
overflow: hidden;
text-overflow: ellipsis;
vertical-align: top;
white-space: nowrap;
}
.cargoList{
.el-input__inner {
height: 28px;
line-height: 28px;
border: none;
background: #ffffcd;
font-size: 10px;
padding: 0px;
text-align: center;
}
.el-input-number {
width: 100%!important;
}
.el-input-number.is-without-controls .el-input__inner {
height: 28px;
line-height: 28px;
border: none;
background: #ffffcd;
font-size: 10px;
padding: 0px;
text-align: center;
}
}
</style>