emis-frontend/src/views/emis/emisNotCalcAging/emisNotCalcAgingForm.vue

176 lines
4.7 KiB
Vue
Raw Normal View History

2024-01-10 07:38:42 +00:00
<template>
<div >
<el-row :gutter="0">
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-col :span="24">
2024-01-11 06:38:10 +00:00
<el-form-item label="所属国家,可能多个国家,逗号隔开" prop="country">
<el-input v-model="form.country" placeholder="请输入所属国家,可能多个国家,逗号隔开" />
2024-01-10 07:38:42 +00:00
</el-form-item>
</el-col>
<el-col :span="24">
2024-01-11 06:38:10 +00:00
<el-form-item label="不计时效日期" prop="noCalcDay">
2024-01-10 07:38:42 +00:00
<el-date-picker clearable
2024-01-11 06:38:10 +00:00
v-model="form.noCalcDay"
2024-01-10 07:38:42 +00:00
type="date"
value-format="yyyy-MM-dd"
2024-01-11 06:38:10 +00:00
placeholder="请选择不计时效日期">
2024-01-10 07:38:42 +00:00
</el-date-picker>
</el-form-item>
</el-col>
2024-01-11 06:38:10 +00:00
<el-col :span="24">
2024-01-10 07:38:42 +00:00
<el-form-item label="备注" prop="remark">
2024-01-11 06:38:10 +00:00
<el-input v-model="form.remark" placeholder="请输入备注" />
2024-01-10 07:38:42 +00:00
</el-form-item>
2024-01-11 06:38:10 +00:00
</el-col>
2024-01-10 07:38:42 +00:00
2024-01-11 06:38:10 +00:00
<el-form-item label="上级字典">
2024-01-10 07:38:42 +00:00
<treeselect
ref="tree"
v-model="form.parentId"
:options="emisNotCalcAgingOptions"
:normalizer="normalizer"
:default-expand-level="1"
:show-count="true"
placeholder="选择上级"
/>
2024-01-11 06:38:10 +00:00
</el-form-item>
2024-01-10 07:38:42 +00:00
</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 { listEmisNotCalcAging, getEmisNotCalcAging, delEmisNotCalcAging, addEmisNotCalcAging, updateEmisNotCalcAging } from "@/api/emis/emisNotCalcAging";
export default {
name: "emisNotCalcAgingForm",
props:{
id:undefined
},
components: { },
dicts: [
'sys_normal_disable',
],
data() {
return {
emisNotCalcAgingOptions: [],
// 遮罩层
loading: true,
// 表单参数
form: {},
// 表单校验
rules: {
2024-01-11 06:38:10 +00:00
country: [
{ required: true, message: "所属国家,可能多个国家,逗号隔开不能为空", trigger: "blur" }
],
noCalcDay: [
{ required: true, message: "不计时效日期不能为空", trigger: "blur" }
2024-01-10 07:38:42 +00:00
],
2024-01-11 06:38:10 +00:00
status: [
{ required: true, message: "启用状态不能为空", trigger: "blur" }
2024-01-10 07:38:42 +00:00
],
}
};
},
watch: {
"id": {
handler (newValue, oldValue) {
this.id = newValue;
this.initData();
},
deep: true
}
},
created() {
this.initData();
},
methods: {
initData() {
this.reset();
if(this.id !=undefined) {
this.loading = true;
getEmisNotCalcAging(this.id).then(response => {
this.form = response.data;
this.loading = false;
});
}
this.getTreeselect();
},
// 取消按钮
cancel() {
this.reset();
this.$emit("on-cancel");
},
// 表单重置
reset() {
this.form = {
id: null,
country: null,
2024-01-11 06:38:10 +00:00
noCalcDay: null,
2024-01-10 07:38:42 +00:00
status: null,
remark: null,
tenantId: null,
delFlag: null,
createBy: null,
createTime: null,
updateBy: null,
updateTime: null
};
this.resetForm("form");
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.id != null) {
updateEmisNotCalcAging(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.$emit("on-changed");
});
} else {
addEmisNotCalcAging(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 = {}
listEmisNotCalcAging(queryParams).then(response => {
this.emisNotCalcAgingOptions = [];
const rootItem = { idId: 0, emisNotCalcAgingName: '-', children: [] };
rootItem.children = this.handleTree(response.data, "id");
this.emisNotCalcAgingOptions.push(rootItem);
if(this.parentId != undefined) {
this.form.parentId = this.parentId;
}
});
},
}
};
</script>