Commit d5e6fdda by LiRui

apf静态交易修改

parent 1fc24ec4
import Api from "~/service/Api" import Api from "~/service/Api"
export function queryByPage(data) { export function queryByPage(data) {
return Api.post("/manager/act/queryByPage", data) return Api.post("/manager/apf/queryByPage", data)
} }
export function queryDetailById(inr) { export function queryById(data) {
return Api.post(`/manager/act/queryDetailById?inr=${inr}`) return Api.post(`/manager/apf/queryById`, data)
} }
export function add(data) { export function add(data) {
return Api.post("/manager/act/add", data) return Api.post("/manager/apf/add", data)
} }
export function edit(data) { export function edit(data) {
return Api.post("/manager/act/edit", data) return Api.post("/manager/apf/edit", data)
} }
export function deleteById(inr) { export function deleteById(data) {
return Api.post(`/manager/act/deleteById?inr=${inr}`) return Api.post(`/manager/apf/deleteById`, data)
} }
<template> <template>
<div class="eContainer"> <div class="eContainer">
<c-page :title="title"> <c-page :title="title">
<el-form <el-form
ref="modelForm" ref="modelForm"
label-width="160px" label-width="160px"
size="small" size="small"
label-position="right" label-position="right"
:model="model" :model="model"
:rules="rules" :rules="rules"
:validate-on-rule-change="false" :validate-on-rule-change="false"
:disabled="isDisabled" :disabled="isDisabled"
>
<c-tabs v-model="tabVal" ref="elment" type="card">
<el-tab-pane label="基本信息" name="apf">
<c-content>
<m-apf-info :model="model" />
</c-content>
</el-tab-pane>
</c-tabs>
</el-form>
<div style="text-align: center">
<c-button
type="primary"
style="margin-right: 10px"
@click="commitAdd"
v-if="type === 'add'"
>提 交</c-button
> >
<c-tabs v-model="tabVal" ref="elment" type="card"> <c-button
<el-tab-pane label="基本信息" name="apf"> type="primary"
<c-content> style="margin-right: 10px"
<m-apf-info :model="model" /> @click="commitEdit"
</c-content> v-if="type === 'edit'"
</el-tab-pane> >提 交</c-button
</c-tabs> >
</el-form> <c-button
<div style="text-align: center"> type="primary"
<c-button style="margin-right: 10px"
type="primary" @click="commitDelete"
style="margin-right: 10px" v-if="type === 'delete'"
@click="commitAdd" >提 交</c-button
v-if="type === 'add'" >
>提 交</c-button <c-button type="primary" @click="goBack">返 回</c-button>
> </div>
<c-button </c-page>
type="primary" </div>
style="margin-right: 10px" </template>
@click="commitEdit"
v-if="type === 'edit'"
>提 交</c-button
>
<c-button
type="primary"
style="margin-right: 10px"
@click="commitDelete"
v-if="type === 'delete'"
>提 交</c-button
>
<c-button type="primary" @click="goBack">返 回</c-button>
</div>
</c-page>
</div>
</template>
<script> <script>
import Utils from "~/utils"; import Utils from "~/utils";
import Apf, { Pattern } from "./Apf.js"; import Apf, { Pattern } from "./Apf.js";
import ApfInfo from "./ApfInfo.vue"; import ApfInfo from "./ApfInfo.vue";
import { queryDetailById, add, edit, deleteById } from "~/service/test/apf.js"; import { queryById, add, edit, deleteById } from "~/service/test/apf.js";
export default { export default {
name: "StaticsDbiapf", name: "StaticsDbiapf",
components: { components: {
"m-apf-info": ApfInfo, "m-apf-info": ApfInfo,
},
provide() {
return {
root: this,
};
},
props: {
type: {
type: String,
default: "info",
}, },
provide() { title: {
return { type: String,
root: this, default: "dbiapf",
};
}, },
props: { },
type: { data() {
type: String, return {
default: "info" model: new Apf().data,
}, tabVal: "apf",
title: { rules: Pattern,
type: String, };
default: "dbiapf" },
} computed: {
}, isDisabled() {
data() { return this.type === "info" || this.type === "delete";
return {
model: new Apf().data,
tabVal: "apf",
rules: Pattern,
};
}, },
computed: { },
isDisabled() { created() {
return this.type === "info" || this.type === "delete"; if (this.type !== "add") {
}, const inr = this.$route.params.inr;
const data = { inr: inr };
queryById(data).then((res) => {
if (res.inr) {
this.model = res;
} else {
this.$message.error("客户不存在");
}
});
}
},
methods: {
commitAdd() {
this.$refs.modelForm.validate((validated) => {
if (validated) {
add(this.model)
.then((res) => {
this.$message.success("保存成功!");
this.goBack(true);
})
.catch((err) => {
this.$message.error("保存失败!");
});
} else {
Utils.formValidateTips(this.$refs.modelForm.fields);
}
});
}, },
created() { commitEdit() {
if (this.type !== "add") { this.$refs.modelForm.validate((validated) => {
const inr = this.$route.params.inr; if (validated) {
queryDetailById(inr).then((res) => { edit(this.model)
if (res.inr) { .then((res) => {
this.model = res; this.$message.success("保存成功!");
} else { this.goBack();
this.$message.error("客户不存在") })
} .catch((err) => {
}); this.$message.error("保存失败!");
} });
} else {
Utils.formValidateTips(this.$refs.modelForm.fields);
}
});
}, },
methods: { commitDelete() {
commitAdd() { this.$confirm("是否确认删除?", "提示", {
this.$refs.modelForm.validate((validated) => { confirmButtonText: "确定",
if (validated) { cancelButtonText: "取消",
add(this.model) type: "warning",
.then((res) => { })
this.$message.success("保存成功!"); .then(() => {
this.goBack(true) const data = { inr: this.model.inr };
}) deleteById(data)
.catch((err) => { .then((res) => {
this.$message.error("保存失败!"); this.$message.success("删除成功!");
}); this.goBack(true);
} else { })
Utils.formValidateTips(this.$refs.modelForm.fields) .catch((err) => {
} this.$message.error("删除失败!");
});
},
commitEdit() {
this.$refs.modelForm.validate((validated) => {
if (validated) {
edit(this.model)
.then((res) => {
this.$message.success("保存成功!");
this.goBack()
})
.catch((err) => {
this.$message.error("保存失败!");
});
} else {
Utils.formValidateTips(this.$refs.modelForm.fields)
}
});
},
commitDelete() {
this.$confirm("是否确认删除?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
})
.then(() => {
deleteById(this.model.inr)
.then((res) => {
this.$message.success("删除成功!");
this.goBack(true)
})
.catch((err) => {
this.$message.error("删除失败!");
});
})
.catch(() => {
this.$message({
type: "info",
message: "已取消删除",
}); });
})
.catch(() => {
this.$message({
type: "info",
message: "已取消删除",
}); });
}, });
/** },
* update 是否更新infapf的查询列表 /**
*/ * update 是否更新infapf的查询列表
goBack(update) { */
this.$store.dispatch("TagsView/delView", this.$route); goBack(update) {
this.$router.push({ name: "StaticsDblapf", params: { update } }); this.$store.dispatch("TagsView/delView", this.$route);
}, this.$router.push({ name: "StaticsDblapf", params: { update } });
}, },
}; },
</script> };
</script>
<style> <style>
</style> </style>
\ No newline at end of file \ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment