|
@@ -9,6 +9,7 @@
|
|
|
style="width: 100%"
|
|
|
class="demo-ruleForm"
|
|
|
>
|
|
|
+ {{ ruleForm }}
|
|
|
<el-row>
|
|
|
<!-- <el-col :span="24">
|
|
|
<el-form-item label="出库单编号">
|
|
@@ -262,22 +263,17 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
},
|
|
|
- mounted() {
|
|
|
- console.log(this.id);
|
|
|
- },
|
|
|
created() {
|
|
|
- this.getReason();
|
|
|
+ this.getReason(); //获取异常原因
|
|
|
this.initForm();
|
|
|
},
|
|
|
watch: {
|
|
|
id: function (val) {
|
|
|
- console.log(val);
|
|
|
if (val) {
|
|
|
this.initForm();
|
|
|
}
|
|
|
},
|
|
|
newTime: function (val) {
|
|
|
- console.log(val);
|
|
|
if (val) {
|
|
|
this.initForm();
|
|
|
}
|
|
@@ -308,35 +304,42 @@ export default {
|
|
|
this.loading = false;
|
|
|
},
|
|
|
async initData() {
|
|
|
- console.log(this.sitem);
|
|
|
- let { anomalous_numbers, anomalous_reason, expect_wish, remark, image } =
|
|
|
- this.sitem;
|
|
|
- this.ruleForm = {
|
|
|
- stock_out_numbers: "", //出库单编号
|
|
|
- anomalous_numbers: anomalous_numbers, //异常数量
|
|
|
- anomalous_reason: anomalous_reason, //异常原因
|
|
|
- expect_wish: expect_wish, //期望意愿
|
|
|
- anomalous_images: [image],
|
|
|
- anomalous_remark: remark, //异常备注
|
|
|
- };
|
|
|
- const res = await asyncRequest.detail({ id: this.id });
|
|
|
- if (res && res.code === 0 && res.data) {
|
|
|
- let { hand_name, resign_name, hand_uid, resign_uid, status } = res.data;
|
|
|
- this.resign_name = resign_name;
|
|
|
- this.hand_name = hand_name;
|
|
|
- this.status = status;
|
|
|
+ if (this.sitem) {
|
|
|
+ let {
|
|
|
+ anomalous_numbers,
|
|
|
+ anomalous_reason,
|
|
|
+ expect_wish,
|
|
|
+ remark,
|
|
|
+ image,
|
|
|
+ } = this.sitem;
|
|
|
this.ruleForm = {
|
|
|
stock_out_numbers: "", //出库单编号
|
|
|
- anomalous_numbers: this.sitem.anomalous_numbers, //异常数量
|
|
|
- anomalous_reason: this.sitem.anomalous_reason, //异常原因
|
|
|
- expect_wish: this.sitem.expect_wish, //期望意愿
|
|
|
- anomalous_images: [],
|
|
|
- anomalous_remark: this.sitem.remark, //异常备注
|
|
|
+ anomalous_numbers: anomalous_numbers, //异常数量
|
|
|
+ anomalous_reason: anomalous_reason, //异常原因
|
|
|
+ expect_wish: expect_wish, //期望意愿
|
|
|
+ anomalous_images: [image],
|
|
|
+ anomalous_remark: remark, //异常备注
|
|
|
+ };
|
|
|
+ const res = await asyncRequest.detail({ id: this.id });
|
|
|
+ if (res && res.code === 0 && res.data) {
|
|
|
+ let { hand_name, resign_name, hand_uid, resign_uid, status } =
|
|
|
+ res.data;
|
|
|
+ this.resign_name = resign_name;
|
|
|
+ this.hand_name = hand_name;
|
|
|
+ this.status = status;
|
|
|
+ this.ruleForm = {
|
|
|
+ stock_out_numbers: "", //出库单编号
|
|
|
+ anomalous_numbers: this.sitem.anomalous_numbers, //异常数量
|
|
|
+ anomalous_reason: this.sitem.anomalous_reason, //异常原因
|
|
|
+ expect_wish: this.sitem.expect_wish, //期望意愿
|
|
|
+ anomalous_images: [],
|
|
|
+ anomalous_remark: this.sitem.remark, //异常备注
|
|
|
+ };
|
|
|
+ } else if (res && res.code >= 100 && res.code <= 104) {
|
|
|
+ await this.logout();
|
|
|
+ } else {
|
|
|
+ this.$message.warning(res.message);
|
|
|
};
|
|
|
- } else if (res && res.code >= 100 && res.code <= 104) {
|
|
|
- await this.logout();
|
|
|
- } else {
|
|
|
- this.$message.warning(res.message);
|
|
|
}
|
|
|
},
|
|
|
|
|
@@ -361,46 +364,30 @@ export default {
|
|
|
async submitForm() {
|
|
|
await this.$refs.ruleForm.validate(async (valid) => {
|
|
|
if (valid) {
|
|
|
- const { resign_uid, hand_uid } = this.ruleForm;
|
|
|
- let rUid = resign_uid.toString(),
|
|
|
- hUid = hand_uid.toString();
|
|
|
- if (rUid === hUid) {
|
|
|
- this.$message.error("离职人和接收人不能相同");
|
|
|
- return;
|
|
|
- }
|
|
|
- this.loading = true;
|
|
|
- const model = {
|
|
|
- id: this.id,
|
|
|
- resign_uid: rUid,
|
|
|
- hand_uid: hUid,
|
|
|
- };
|
|
|
- let res = {};
|
|
|
- if (this.id === "add") {
|
|
|
- delete model["id"];
|
|
|
- res = await asyncRequest.add(model);
|
|
|
- } else {
|
|
|
- res = await asyncRequest.update(model);
|
|
|
+ const { anomalous_numbers } = this.ruleForm;
|
|
|
+ if (this.sitem.send_num < anomalous_numbers) {
|
|
|
+ this.$message.warning("异常数量不能大于发货数量");
|
|
|
+ return false;
|
|
|
}
|
|
|
+ console.log("调接口");
|
|
|
+ // if (res && res.code === 0) {
|
|
|
+ // const title = this.id === "add" ? "添加成功!" : "修改成功!";
|
|
|
+ // this.$notify.success({
|
|
|
+ // title,
|
|
|
+ // message: "",
|
|
|
+ // });
|
|
|
|
|
|
- this.loading = false;
|
|
|
- if (res && res.code === 0) {
|
|
|
- const title = this.id === "add" ? "添加成功!" : "修改成功!";
|
|
|
- this.$notify.success({
|
|
|
- title,
|
|
|
- message: "",
|
|
|
- });
|
|
|
-
|
|
|
- if (this.id === "add") {
|
|
|
- this.showModelThis = false;
|
|
|
- this.$emit("refresh", false);
|
|
|
- } else {
|
|
|
- this.initForm();
|
|
|
- }
|
|
|
- } else if (res && res.code >= 100 && res.code <= 104) {
|
|
|
- await this.logout();
|
|
|
- } else {
|
|
|
- this.$message.warning(res.message);
|
|
|
- }
|
|
|
+ // if (this.id === "add") {
|
|
|
+ // this.showModelThis = false;
|
|
|
+ // this.$emit("refresh", false);
|
|
|
+ // } else {
|
|
|
+ // this.initForm();
|
|
|
+ // }
|
|
|
+ // } else if (res && res.code >= 100 && res.code <= 104) {
|
|
|
+ // await this.logout();
|
|
|
+ // } else {
|
|
|
+ // this.$message.warning(res.message);
|
|
|
+ // }
|
|
|
} else {
|
|
|
console.log("error submit!!");
|
|
|
return false;
|
|
@@ -475,8 +462,6 @@ export default {
|
|
|
const res = await asyncRequest.reasonList(model);
|
|
|
this.loading = false;
|
|
|
if (res && res.code === 0) {
|
|
|
- console.log(res.data);
|
|
|
-
|
|
|
this.reason_options = res.data.list;
|
|
|
} else if (res && res.code >= 100 && res.code <= 104) {
|
|
|
await this.logout();
|
|
@@ -501,10 +486,8 @@ export default {
|
|
|
},
|
|
|
//图片上传成功
|
|
|
UploadSuccessEvent(data) {
|
|
|
- console.log(data);
|
|
|
if (data && data.url && data.url !== "break") {
|
|
|
const { url } = data.url;
|
|
|
- console.log(url);
|
|
|
this.ruleForm.anomalous_images.push(url);
|
|
|
this.$message.success("图片上传成功!");
|
|
|
this.$refs.ruleForm.validateField("anomalous_images");
|