262 lines
7.8 KiB
Vue
262 lines
7.8 KiB
Vue
<template>
|
|
<div >
|
|
<el-row :gutter="0">
|
|
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
|
<!-- <el-col :span="12">
|
|
<el-form-item label="所属国家" prop="country">
|
|
<CountryPicker :placeholder="$t('所属国家')" v-model="form.country" ></CountryPicker>
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="12">
|
|
<el-form-item label="所属线路" prop="lineCode">
|
|
<TransLinePicker v-model="form.lineCode" :countryCode="form.country"></TransLinePicker>
|
|
</el-form-item>
|
|
</el-col> -->
|
|
<el-col :span="12">
|
|
<el-form-item label="产品类型" prop="prodCode">
|
|
<TransProductCasPicker placeholder="产品类型" v-model="form.prodCodeSelArr" @onChange="onProductChange" ></TransProductCasPicker>
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="12">
|
|
<el-form-item label="取重方式" prop="carryType">
|
|
<el-select v-model="form.carryType" placeholder="请选择取重方式" style="width:100%">
|
|
<el-option
|
|
v-for="dict in dict.type.emis_take_weight_method"
|
|
:key="dict.value"
|
|
:label="dict.label":value="dict.value"
|
|
></el-option>
|
|
</el-select>
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="12">
|
|
<el-form-item label="起始重量" prop="beginWeight">
|
|
<el-input v-model="form.beginWeight" placeholder="请输入起始重量" />
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="12">
|
|
<el-form-item label="结束重量" prop="endWeight">
|
|
<el-input v-model="form.endWeight" placeholder="请输入结束重量" />
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="12">
|
|
<el-form-item label="生效时间" prop="beginDate">
|
|
<div class="date_box">
|
|
<el-date-picker clearable
|
|
style="width:100%"
|
|
class="right-icon"
|
|
v-model="form.beginDate"
|
|
type="datetime"
|
|
value-format="yyyy-MM-dd HH:mm:ss"
|
|
default-time = "00:00:00"
|
|
placeholder="生效时间"
|
|
@change="onStartDateChange"
|
|
>
|
|
</el-date-picker>
|
|
</div>
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="12">
|
|
<el-form-item label="失效时间" prop="endDate">
|
|
<el-date-picker
|
|
style="width:100%"
|
|
clearable
|
|
align="right"
|
|
class="right-icon"
|
|
v-model="form.endDate"
|
|
type="datetime"
|
|
value-format="yyyy-MM-dd HH:mm:ss"
|
|
default-time = "23:59:59"
|
|
placeholder="失效时间">
|
|
</el-date-picker>
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="24">
|
|
<el-form-item label="备注" prop="remark">
|
|
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
|
|
</el-form-item>
|
|
</el-col>
|
|
|
|
</el-form>
|
|
</el-row>
|
|
<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 { listEmisSpecialCalcWeight, getEmisSpecialCalcWeight, delEmisSpecialCalcWeight, addEmisSpecialCalcWeight, updateEmisSpecialCalcWeight } from "@/api/emis/emisSpecialCalcWeight";
|
|
import CountryPicker from '@/views/emis/EmisBaseTools/CountryPicker.vue';
|
|
import TransLinePicker from '@/views/emis/EmisBaseTools/TransLinePicker.vue';
|
|
import TransProductCasPicker from '@/views/emis/EmisBaseTools/TransProductCasPicker.vue';
|
|
import {addDateTimeByDay,dateToStr} from '@/utils/custom'
|
|
|
|
export default {
|
|
name: "emisSpecialCalcWeightForm",
|
|
props:{
|
|
id:{
|
|
type:Number,
|
|
}
|
|
},
|
|
components: { CountryPicker,TransLinePicker,TransProductCasPicker },
|
|
dicts: [
|
|
'sys_normal_disable',
|
|
'emis_take_weight_method',
|
|
],
|
|
data() {
|
|
return {
|
|
emisSpecialCalcWeightOptions: [],
|
|
// 遮罩层
|
|
loading: true,
|
|
// 表单参数
|
|
form: {},
|
|
// 表单校验
|
|
rules: {
|
|
prodCode: [
|
|
{ required: true, message: "产品类型代码不能为空", trigger: "blur" }
|
|
],
|
|
prodName: [
|
|
{ required: true, message: "产品类型名称不能为空", trigger: "blur" }
|
|
],
|
|
status: [
|
|
{ required: true, message: "启用状态不能为空", trigger: "blur" }
|
|
],
|
|
carryType: [
|
|
{ required: true, message: "取重方式不能为空", trigger: "change" }
|
|
],
|
|
beginWeight: [
|
|
{ required: true, message: "起始重量不能为空", trigger: "blur" }
|
|
],
|
|
endWeight: [
|
|
{ required: true, message: "结束重量不能为空", trigger: "blur" }
|
|
],
|
|
beginDate: [
|
|
{ required: true, message: "起始时间不能为空", trigger: "blur" }
|
|
],
|
|
endDate: [
|
|
{ required: true, message: "结束时间不能为空", trigger: "blur" }
|
|
],
|
|
}
|
|
};
|
|
},
|
|
watch: {
|
|
id(newVal){
|
|
this.initData();
|
|
}
|
|
},
|
|
created() {
|
|
this.initData();
|
|
},
|
|
|
|
methods: {
|
|
initData() {
|
|
if(this.id !=null) {
|
|
this.loading = true;
|
|
getEmisSpecialCalcWeight(this.id).then(response => {
|
|
this.loading = false;
|
|
this.form = response.data;
|
|
this.form.prodCodeSelArr = [this.form.lineCode,this.form.prodCode]
|
|
console.log( this.form.prodCodeSelArr)
|
|
|
|
});
|
|
}else{
|
|
this.reset();
|
|
}
|
|
},
|
|
onStartDateChange(){
|
|
this.form.endDate=dateToStr(addDateTimeByDay(this.form.beginDate,365));
|
|
},
|
|
onProdChange(item){
|
|
console.log(item)
|
|
this.form.prodName=item.prodName;
|
|
},
|
|
// 取消按钮
|
|
cancel() {
|
|
this.reset();
|
|
this.$emit("on-cancel");
|
|
},
|
|
// 表单重置
|
|
reset() {
|
|
this.form = {
|
|
id: null,
|
|
country: null,
|
|
lineCode: null,
|
|
prodCodeSelArr:null,
|
|
prodCode: null,
|
|
prodName: null,
|
|
status: null,
|
|
carryType: null,
|
|
beginWeight: null,
|
|
endWeight: null,
|
|
beginDate: null,
|
|
endDate: null,
|
|
remark: null,
|
|
tenantId: null,
|
|
delFlag: null,
|
|
createBy: null,
|
|
createTime: null,
|
|
updateBy: null,
|
|
updateTime: null
|
|
};
|
|
this.resetForm("form");
|
|
},
|
|
onProductChange(item){
|
|
this.form.lineCode=item[0];
|
|
this.form.prodCode=item[1];
|
|
// this.form.prodName=
|
|
},
|
|
/** 提交按钮 */
|
|
submitForm() {
|
|
this.$refs["form"].validate(valid => {
|
|
if (valid) {
|
|
if (this.form.id != null) {
|
|
updateEmisSpecialCalcWeight(this.form).then(response => {
|
|
this.$modal.msgSuccess("修改成功");
|
|
this.$emit("on-changed");
|
|
});
|
|
} else {
|
|
addEmisSpecialCalcWeight(this.form).then(response => {
|
|
this.$modal.msgSuccess("修改成功");
|
|
this.$emit("on-changed");
|
|
});
|
|
}
|
|
}
|
|
});
|
|
},
|
|
|
|
}
|
|
};
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
.right-icon .el-input__icon {
|
|
right: 10px;
|
|
}
|
|
|
|
:deep .el-range__icon {
|
|
display: none;
|
|
}
|
|
.date_box {
|
|
position: relative;
|
|
width: fit-content;
|
|
.data_icon {
|
|
position: absolute;
|
|
top: 50%;
|
|
right: 17px;
|
|
z-index: 9;
|
|
color: #c0c4cc;
|
|
font-size: 14px;
|
|
transform: translateY(-50%);
|
|
}
|
|
::v-deep .el-range__close-icon {
|
|
position: absolute;
|
|
right: 34px;
|
|
top: 54%;
|
|
transform: translateY(-50%);
|
|
}
|
|
}
|
|
|
|
</style>
|