emis-frontend/src/views/emis/emisTmsCostProfit/emisTmsCostProfitForm.vue
2024-10-10 18:52:59 +08:00

194 lines
5.5 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<div >
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-row :gutter="0" style="display: flex;flex-wrap: wrap;">
<el-col :span="24">
<el-form-item label="运单号" prop="billCode">
<el-input v-model="form.billCode" placeholder="请输入运单号" />
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="标准费" prop="standardFee">
<el-input v-model="form.standardFee" placeholder="请输入标准费" />
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="账单费用" prop="billFee">
<el-input v-model="form.billFee" placeholder="请输入账单费用" />
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="运输成本" prop="costFee">
<el-input v-model="form.costFee" placeholder="请输入运输成本" />
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="运单利润" prop="billProfit">
<el-input v-model="form.billProfit" placeholder="请输入运单利润" />
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" placeholder="请输入备注" />
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="删除标志(0代表存在" prop="delFlag">
<el-input v-model="form.delFlag" placeholder="请输入删除标志(0代表存在" />
</el-form-item>
</el-col>
<!--
<el-form-item label="上级字典">
<treeselect
ref="tree"
v-model="form.parentId"
:options="emisTmsCostProfitOptions"
:normalizer="normalizer"
:default-expand-level="1"
:show-count="true"
placeholder="选择上级"
/>
</el-form-item>
-->
</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 { listEmisTmsCostProfit, getEmisTmsCostProfit, delEmisTmsCostProfit, addEmisTmsCostProfit, updateEmisTmsCostProfit } from "@/api/emis/emisTmsCostProfit";
export default {
name: "emisTmsCostProfitForm",
props:{
id:{
type:Number
}
},
components: { },
dicts: [
],
data() {
return {
emisTmsCostProfitOptions: [],
// 遮罩层
loading: true,
// 表单参数
form: {},
// 表单校验
rules: {
id: [
{ required: true, message: "id不能为空", trigger: "blur" }
],
delFlag: [
{ required: true, message: "删除标志(0代表存在不能为空", trigger: "blur" }
],
}
};
},
watch: {
"id": {
handler (newValue, oldValue) {
this.id = newValue;
this.initData();
},
deep: true
}
},
created() {
this.initData();
},
methods: {
initData() {
if(this.id !=null) {
this.loading = true;
getEmisTmsCostProfit(this.id).then(response => {
this.form = response.data;
this.loading = false;
});
}else{
this.reset();
}
// this.getTreeselect();
},
// 取消按钮
cancel() {
this.reset();
this.$emit("on-cancel");
},
// 表单重置
reset() {
this.form = {
id: null,
billCode: null,
standardFee: null,
billFee: null,
costFee: null,
billProfit: null,
remark: null,
delFlag: null,
createBy: null,
createTime: null,
updateBy: null,
updateTime: null,
createSite: null,
updateSite: null
};
this.resetForm("form");
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.id != null) {
updateEmisTmsCostProfit(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.$emit("on-changed");
});
} else {
addEmisTmsCostProfit(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.$emit("on-changed");
});
}
}
});
},
// /** 转换菜单数据结构 */
// normalizer(node) {
// if (node.children && !node.children.length) {
// delete node.children;
// }
// return {
// id: node.id,
// label: node.idName,
// children: node.children
// };
// },
// /** 查询菜单下拉树结构 */
// getTreeselect() {
// const queryParams = {}
// listEmisTmsCostProfit(queryParams).then(response => {
// this.emisTmsCostProfitOptions = [];
// const rootItem = { idId: 0, emisTmsCostProfitName: '-', children: [] };
// rootItem.children = this.handleTree(response.data, "id");
// this.emisTmsCostProfitOptions.push(rootItem);
// if(this.parentId != undefined) {
// this.form.parentId = this.parentId;
// }
// });
// },
}
};
</script>