Commit fd5835ba by hewei

cod不允许重复值优化

parent 45907c24
......@@ -12,6 +12,10 @@ export function add(data) {
return Api.post("/manager/atp/add", data)
}
export function queryCod(cod) {
return Api.post(`/manager/atp/queryCod?cod=${cod}`)
}
export function edit(data) {
return Api.post("/manager/atp/edit", data)
}
......
......@@ -12,6 +12,10 @@ export function add(data) {
return Api.post("/manager/cty/add", data)
}
export function queryCod(cod) {
return Api.post(`/manager/cty/queryCod?cod=${cod}`)
}
export function edit(data) {
return Api.post("/manager/cty/edit", data)
}
......
......@@ -12,6 +12,10 @@ export function add(data) {
return Api.post("/manager/cur/add", data)
}
export function queryCod(cod) {
return Api.post(`/manager/cur/queryCod?cod=${cod}`)
}
export function edit(data) {
return Api.post("/manager/cur/edit", data)
}
......
......@@ -267,8 +267,11 @@ export default {
if (this.isInDisplay) {
this.restoreDisplay();
}
// this.$refs.ovwp.$refs.setp.$refs.table.$refs.table.toggleRowSelection(this.model.liaall.tenstm.rows[0], true);
this.$refs.ovwp.$refs.setp.$refs.table.$refs.table.toggleAllSelection();
//多选表格,选择某一行的选中状态,第二个参数设置选中与否,true为选中
if (this.$refs.ovwp.$refs.setp.$refs.table.$refs.table.data.length > 0) {
this.$refs.ovwp.$refs.setp.$refs.table.$refs.table.toggleRowSelection(this.$refs.ovwp.$refs.setp.$refs.table.$refs.table.data[0], true);
}
// this.$refs.ovwp.$refs.setp.$refs.table.$refs.table.toggleAllSelection();
// this.$refs.setp.$refs.table.$refs.table.toggleAllSelection();
}else{
this.$notify.error({title: '错误',message: '服务请求失败!'});
......
......@@ -53,7 +53,7 @@ import Atp, { Pattern } from "./Atp.js";
import AtpInfo from "./AtpInfo.vue";
import { queryById, add, edit, deleteById } from "~/service/test/atp.js";
import { queryById, add, edit, deleteById, queryCod } from "~/service/test/atp.js";
export default {
name: "StaticsDbiatp",
......@@ -103,14 +103,22 @@ export default {
commitAdd() {
this.$refs.modelForm.validate((validated) => {
if (validated) {
add(this.model)
.then((res) => {
this.$message.success("添加成功!");
this.goBack(true)
})
.catch((err) => {
this.$message.error("添加失败!");
});
queryCod(this.model.cod)
.then((res) => {
console.log("res" + res)
if (!res) {
add(this.model)
.then((res) => {
this.$message.success("添加成功!");
this.goBack(true)
})
.catch((err) => {
this.$message.error("添加失败!");
});
} else {
return this.$message.error('交易配置信息代码重复');
}
})
} else {
Utils.formValidateTips(this.$refs.modelForm.fields)
}
......
......@@ -59,7 +59,7 @@ import Cty, { Pattern } from "./Cty.js";
import CtyInfo from "./CtyInfo.vue";
import BopctyInfo from "./BopctyInfo.vue";
import { queryById, add, edit, deleteById, editBopctyData, deleteBopctyById} from "~/service/test/cty.js";
import { queryById, add, edit, deleteById, editBopctyData, deleteBopctyById, queryCod} from "~/service/test/cty.js";
export default {
name: "StaticsDbicty",
......@@ -112,14 +112,23 @@ export default {
this.$refs.modelForm.validate((validated) => {
if (validated) {
this.model.codBopcty=this.model.bopcod;
add(this.model)
.then((res) => {
this.$message.success("保存成功!");
this.goBack(true)
})
.catch((err) => {
this.$message.error("保存失败!");
});
queryCod(this.model.cod)
.then((res) => {
if (!res) {
add(this.model)
.then((res) => {
this.$message.success("保存成功!");
this.goBack(true)
})
.catch((err) => {
this.$message.error("保存失败!");
});
}
else {
this.$message.error("国家代码重复")
}
})
} else {
Utils.formValidateTips(this.$refs.modelForm.fields)
}
......
......@@ -23,7 +23,7 @@ import Cur, { Pattern } from "../Infcur/Cur.js";
import Currency from "./Currency.vue";
import { curInfo, add, edit, deleteById } from "~/service/test/cur.js";
import { curInfo, add, edit, deleteById,queryCod } from "~/service/test/cur.js";
export default {
name: "StaticsDbicur",
......@@ -75,14 +75,22 @@ export default {
commitAdd() {
this.$refs.modelForm.validate((validated) => {
if (validated) {
add(this.model)
.then((res) => {
this.$message.success("保存成功!");
this.goBack(true)
})
.catch((err) => {
this.$message.error("保存失败!");
});
queryCod(this.model.cod)
.then(((res) => {
if (!res) {
add(this.model)
.then((res) => {
this.$message.success("保存成功!");
this.goBack(true)
})
.catch((err) => {
this.$message.error("保存失败!");
});
} else {
this.$message.error("货币种类重复")
}
}))
} else {
Utils.formValidateTips(this.$refs.modelForm.fields)
}
......
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