276 lines
8.4 KiB
Vue
276 lines
8.4 KiB
Vue
<template>
|
|
<div >
|
|
<el-form ref="form" :model="form" size="mini" :rules="rules" label-width="80px" :disabled="isFormDisabled">
|
|
<el-row :gutter="0" style="display: flex;flex-wrap: wrap;">
|
|
<el-col :span="6">
|
|
<el-form-item label="运单号" prop="billCode">
|
|
<el-input v-model="form.billCode" clearable="" placeholder="单号输入后按回车" @keyup.enter.native="handleScanInput" >
|
|
<i slot="suffix" class="iconfont"></i>
|
|
</el-input>
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="6">
|
|
<el-form-item label="发往站点" prop="destConfirmSiteCode">
|
|
<EmisSiteSimplePicker :placeholder="$t('发往站点')" v-model="form.destConfirmSiteCode" :isInitiated="true" ></EmisSiteSimplePicker>
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="12">
|
|
<el-form-item label="修改项目" prop="applyType">
|
|
<AjustApplyTypePicker v-model="form.applyType" :disabled="isEditDisabled" @onChange="onApplyTypeChange"></AjustApplyTypePicker>
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="24" >
|
|
<el-form-item label="调整数值" prop="applyValue">
|
|
<AdjustPanel ref="refAdjustDetail" :applyType="form.applyType" :oldValue="form.jsonDataObj.oldValue" :newValue="form.jsonDataObj.newValue" :disabled="isFormDisabled"></AdjustPanel>
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="24">
|
|
<el-form-item label="调整说明" prop="applyMemo">
|
|
<el-input v-model="form.applyMemo" type="textarea" placeholder="" :disabled="isEditDisabled"/>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-row>
|
|
|
|
<div style="text-align: center;margin-bottom: 10px;" v-if="!isFormDisabled">
|
|
<el-button type="primary" @click="submitForm">确 定</el-button>
|
|
<el-button @click="cancel">取 消</el-button>
|
|
</div>
|
|
</el-form>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
|
|
|
|
import { getWaybillDetail} from "@/api/emis/emisWaybill";
|
|
import { getEmisWaybillAjustApply,addEmisWaybillAjustApply, updateEmisWaybillAjustApply } from "@/api/emis/emisWaybillAjustApply";
|
|
|
|
import AdjustPanel from '@/views/emis/emisWaybillAjustApply/adjustPanel.vue';
|
|
|
|
import AjustApplyTypePicker from '@/views/emis/EmisBaseTools/AjustApplyTypePicker.vue';
|
|
import EmisSiteSimplePicker from '@/views/emis/EmisBaseTools/EmisSiteSimplePicker.vue';
|
|
|
|
import { deepClone } from '@/utils/index'
|
|
export default {
|
|
name: "emisWaybillAjustApplyForm",
|
|
props:{
|
|
id:{
|
|
type:[Number,Array]
|
|
},
|
|
isReApply:{
|
|
type:[Boolean],
|
|
default:false
|
|
}
|
|
},
|
|
components: {
|
|
AdjustPanel,
|
|
AjustApplyTypePicker,
|
|
EmisSiteSimplePicker
|
|
|
|
},
|
|
dicts: ['emis_qujian_fangshi','emis_declare_mode','emis_customs_clear',
|
|
'emis_tab_packing_type','emis_tab_dispatch_mode','emis_payment_type',
|
|
'emis_calc_fee_type','emis_print_type'],
|
|
data() {
|
|
return {
|
|
|
|
isFormDisabled:null,
|
|
|
|
emisWaybillAjustApplyOptions: [],
|
|
|
|
ajustTypeItems:[],
|
|
|
|
isEditDisabled:null,
|
|
// 遮罩层
|
|
loading: true,
|
|
|
|
billDetail:{},
|
|
// 表单参数
|
|
form: {
|
|
},
|
|
// 表单校验
|
|
rules: {
|
|
billCode: [
|
|
{ required: true, message: "运单号不能为空", trigger: "blur" }
|
|
],
|
|
applyType: [
|
|
{ required: true, message: "调整类型不能为空", trigger: ["blur","change"] }
|
|
],
|
|
newValue: [
|
|
{ required: true, message: "改后值不能为空", trigger: "blur" }
|
|
],
|
|
applyMemo: [
|
|
{ required: true, message: "问题说明不能为空", trigger: "blur" }
|
|
],
|
|
destConfirmSiteCode: [
|
|
{ required: true, message: "发往站点必填", trigger: ["blur","change"] }
|
|
],
|
|
}
|
|
};
|
|
},
|
|
watch: {
|
|
"id": {
|
|
handler (newValue, oldValue) {
|
|
this.id = newValue;
|
|
this.initData();
|
|
},
|
|
deep: true
|
|
},
|
|
"isReApply": {
|
|
handler (newValue, oldValue) {
|
|
if(newValue){
|
|
this.isFormDisabled=false;
|
|
}
|
|
|
|
},
|
|
deep: true
|
|
}
|
|
},
|
|
created() {
|
|
this.initData();
|
|
},
|
|
methods: {
|
|
onApplyTypeChange(item){
|
|
console.log("===>item==>",item);
|
|
},
|
|
initData() {
|
|
if(this.id !=null) {
|
|
this.loading = true;
|
|
this.isFormDisabled=true;
|
|
getEmisWaybillAjustApply(this.id).then(async response => {
|
|
this.form = response.data;
|
|
this.form.jsonDataObj=JSON.parse(this.form.jsonData);
|
|
console.log("===>this.form.jsonDataObj ==>",this.form.jsonDataObj);
|
|
|
|
if(this.form.jsonDataObj.oldValue!=null){
|
|
this.billDetail=this.form.jsonDataObj.oldValue;
|
|
this.form.jsonDataObj.oldValue=Object.assign({},this.billDetail);
|
|
}else{
|
|
this.$set(this.form.jsonDataObj,'oldValue',{})
|
|
}
|
|
|
|
|
|
if(this.form.jsonDataObj.newValue!=null){
|
|
this.form.jsonDataObj.newValue=Object.assign({},this.form.jsonDataObj.newValue);
|
|
}else{
|
|
this.$set(this.form.jsonDataObj,'newValue',{})
|
|
}
|
|
|
|
// 再次申请
|
|
console.log("===>this.isReApply ==>",this.isReApply);
|
|
if(this.isReApply){
|
|
|
|
let res=await getWaybillDetail(this.form.billCode);
|
|
this.billDetail=res.data;
|
|
this.form.jsonDataObj.oldValue=deepClone(this.billDetail);
|
|
|
|
this.isFormDisabled=false;
|
|
this.form.id=null;
|
|
}
|
|
|
|
this.loading = false;
|
|
});
|
|
}else{
|
|
this.reset();
|
|
this.isFormDisabled=false;
|
|
}
|
|
},
|
|
|
|
async handleScanInput(){
|
|
if(this.form.billCode==null || this.form.billCode==''){
|
|
this.$modal.msgError("输入单号后回车");
|
|
return;
|
|
}
|
|
this.form.billCode=this.form.billCode.replace(/\s+/g, '');
|
|
let res=await getWaybillDetail(this.form.billCode);
|
|
if(res.code != 200){
|
|
this.$modal.msgError(res.msg);
|
|
return;
|
|
}
|
|
this.billDetail=res.data;
|
|
if(this.billDetail.orderStatus=='0'){
|
|
this.$modal.msgError("未接单");
|
|
return;
|
|
}
|
|
|
|
|
|
this.form.billCode=this.billDetail.billCode;
|
|
this.form.jsonDataObj.oldValue=deepClone(this.billDetail);
|
|
this.form.jsonDataObj.newValue=deepClone(this.billDetail);
|
|
|
|
this.isEditDisabled=false;
|
|
|
|
this.form.applyManCode=this.$store.getters.empCode;
|
|
this.form.applySiteCode=this.$store.getters.ownerSiteCode;
|
|
if(this.billDetail.sendSiteCode == this.$store.getters.ownerSiteCode){
|
|
this.form.destConfirmSiteCode=this.billDetail.dispatchUnderlingSiteCode;
|
|
}else{
|
|
this.form.destConfirmSiteCode=this.billDetail.sendSiteCode;
|
|
}
|
|
},
|
|
// 取消按钮
|
|
cancel() {
|
|
this.reset();
|
|
this.$emit("on-cancel");
|
|
},
|
|
// 表单重置
|
|
reset() {
|
|
this.form = {
|
|
id: null,
|
|
billCode: null,
|
|
applyType: null,
|
|
applyManCode: null,
|
|
applySiteCode: null,
|
|
applyFinanceCenterCode: null,
|
|
applyDate: null,
|
|
blDestConfirmed: null,
|
|
destConfirmSiteCode: null,
|
|
destConfirmDate: null,
|
|
destConfirmNote: null,
|
|
destConfirmManCode: null,
|
|
destFinanceCenterCode: null,
|
|
oldValue: null,
|
|
newValue: null,
|
|
blValueJson: null,
|
|
applyMemo: null,
|
|
blCenterConfirmed: null,
|
|
centerConfirmSiteCode: null,
|
|
centerConfirmManCode: null,
|
|
centerConfirmDate: null,
|
|
centerConfirmNote: null,
|
|
remark: null,
|
|
tenantId: null,
|
|
delFlag: null,
|
|
createBy: null,
|
|
createTime: null,
|
|
updateBy: null,
|
|
updateTime: null,
|
|
createSite: null,
|
|
updateSite: null,
|
|
jsonData: null,
|
|
jsonDataObj:{
|
|
oldValue:{},
|
|
newValue:{},
|
|
}
|
|
};
|
|
this.resetForm("form");
|
|
},
|
|
/** 提交按钮 */
|
|
submitForm() {
|
|
this.$refs["form"].validate(valid => {
|
|
if (valid) {
|
|
let jsonData=this.$refs.refAdjustDetail.getJsonData();
|
|
console.log("====>jsonData==>",jsonData);
|
|
this.form.jsonData=JSON.stringify(jsonData);
|
|
addEmisWaybillAjustApply(this.form).then(response => {
|
|
this.$modal.msgSuccess("申请成功");
|
|
this.$emit("on-changed");
|
|
});
|
|
}
|
|
});
|
|
},
|
|
|
|
}
|
|
};
|
|
</script>
|