emis-frontend/src/views/emis/emisSettleInvoiceRel/emisSettleInvoiceRelForm.vue

177 lines
4.9 KiB
Vue
Raw Normal View History

2024-07-22 00:43:22 +00:00
<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="applySeqNo">
<el-input v-model="form.applySeqNo" placeholder="请输入申请序号" />
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="分账单号" prop="billNo">
<el-input v-model="form.billNo" placeholder="请输入分账单号" />
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="申请开票金额" prop="money">
<el-input v-model="form.money" 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="emisSettleInvoiceRelOptions"
: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 { listEmisSettleInvoiceRel, getEmisSettleInvoiceRel, delEmisSettleInvoiceRel, addEmisSettleInvoiceRel, updateEmisSettleInvoiceRel } from "@/api/emis/emisSettleInvoiceRel";
export default {
name: "emisSettleInvoiceRelForm",
props:{
id:{
type:Number
}
},
components: { },
dicts: [
],
data() {
return {
emisSettleInvoiceRelOptions: [],
// 遮罩层
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;
getEmisSettleInvoiceRel(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,
applySeqNo: null,
payId: null,
billNo: null,
money: 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) {
updateEmisSettleInvoiceRel(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.$emit("on-changed");
});
} else {
addEmisSettleInvoiceRel(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 = {}
// listEmisSettleInvoiceRel(queryParams).then(response => {
// this.emisSettleInvoiceRelOptions = [];
// const rootItem = { idId: 0, emisSettleInvoiceRelName: '-', children: [] };
// rootItem.children = this.handleTree(response.data, "id");
// this.emisSettleInvoiceRelOptions.push(rootItem);
// if(this.parentId != undefined) {
// this.form.parentId = this.parentId;
// }
// });
// },
}
};
</script>