import {init, save} from "../../../../../../service/business/rmb";
import Utils from "../../../../../../utils";
export default {
	methods: {
		saveTga() {
			this.$refs['modelForm'].validate(async (validStatic) => {
				if (validStatic) {
					save('rmb2108', this.model).then(response => {
						if (response.respCode === SUCCESS) {
							this.$notify({
								title: "成功",
								message: "提交成功",
								type: "success",
							});
							this.$store.commit('delTagsArry', this.$route.path);
							this.$router.back()
						} else {
							this.$notify({
								title: "失败",
								message: "提交失败",
								type: "error",
							});
						}
					});
				} else {
					// 前端校验失败
					this.$notify({
						title: '失败',
						message: '校验失败',
						type: 'error',
					});
				}
			})
		},

		init(transName, pblInr) {
			this.model.pblmod.wrkpbl.inr = pblInr;
			this.model.pblmod.pbl.inr = pblInr;
			init('rmb2108', this.model).then(response => {
				if (response.respCode === SUCCESS) {
					Utils.copyValueFromVoData(this.model, response.data);
				}
			})
		},
	}
}