|
|
@@ -132,7 +132,7 @@ let form = ref(null);
|
|
|
let visable = ref(false);
|
|
|
let ruleForm = ref({
|
|
|
cargo: "",
|
|
|
- proxyIds: [],
|
|
|
+ proxyIds: "",
|
|
|
});
|
|
|
function resetForm() {
|
|
|
visable.value = false;
|
|
|
@@ -180,32 +180,36 @@ function pageChange(e) {
|
|
|
getCargoList();
|
|
|
}
|
|
|
async function addCargo() {
|
|
|
- let { cargo, proxyIds, cargoId } = ruleForm.value;
|
|
|
- let arr = [];
|
|
|
- for (let i of proxyIds) {
|
|
|
- arr.push(i.key);
|
|
|
- }
|
|
|
- let postData = {};
|
|
|
- if (cargoId) {
|
|
|
- postData = { cargoId };
|
|
|
- }
|
|
|
- let res = await api[cargoId ? "updateCargo" : "addCargo"]({
|
|
|
- ...postData,
|
|
|
- cargo,
|
|
|
- proxyIds: arr.join(","),
|
|
|
+ form.value.validate(async (valid) => {
|
|
|
+ if (valid) {
|
|
|
+ let { cargo, proxyIds, cargoId } = ruleForm.value;
|
|
|
+ let arr = [];
|
|
|
+ for (let i of proxyIds) {
|
|
|
+ arr.push(i.key);
|
|
|
+ }
|
|
|
+ let postData = {};
|
|
|
+ if (cargoId) {
|
|
|
+ postData = { cargoId };
|
|
|
+ }
|
|
|
+ let res = await api[cargoId ? "updateCargo" : "addCargo"]({
|
|
|
+ ...postData,
|
|
|
+ cargo,
|
|
|
+ proxyIds: arr.join(","),
|
|
|
+ });
|
|
|
+ if (res.data.status == 0) {
|
|
|
+ ElNotification({
|
|
|
+ title: "成功",
|
|
|
+ duration: 1500,
|
|
|
+ message: res.data.msg,
|
|
|
+ type: "success",
|
|
|
+ });
|
|
|
+ resetForm();
|
|
|
+ getCargoList();
|
|
|
+ } else {
|
|
|
+ console.log(res);
|
|
|
+ }
|
|
|
+ }
|
|
|
});
|
|
|
- if (res.data.status == 0) {
|
|
|
- ElNotification({
|
|
|
- title: "成功",
|
|
|
- duration: 1500,
|
|
|
- message: res.data.msg,
|
|
|
- type: "success",
|
|
|
- });
|
|
|
- resetForm();
|
|
|
- getCargoList();
|
|
|
- } else {
|
|
|
- console.log(res);
|
|
|
- }
|
|
|
}
|
|
|
|
|
|
async function changeStatus(status, cargoId) {
|