|
@@ -16,7 +16,7 @@
|
|
|
type="primary"
|
|
|
:disabled="disabled && detailData.status == 1"
|
|
|
@click="editCustomer('submit')"
|
|
|
- v-if="form.id&&detailData.status != 1"
|
|
|
+ v-if="form.id && detailData.status != 1"
|
|
|
>确认修改
|
|
|
</el-button>
|
|
|
<el-button
|
|
@@ -325,7 +325,10 @@ export default {
|
|
|
selectionList: [],
|
|
|
treeDeptId: null,
|
|
|
orderFeesList: [],
|
|
|
- freightData: []
|
|
|
+ freightData: [],
|
|
|
+ oldform: {},
|
|
|
+ olddata: [],
|
|
|
+ oldfreightData: []
|
|
|
};
|
|
|
},
|
|
|
props: {
|
|
@@ -472,39 +475,30 @@ export default {
|
|
|
detail(id).then(res => {
|
|
|
this.form = res.data.data;
|
|
|
this.data = res.data.data.itemsVOList ? res.data.data.itemsVOList : [];
|
|
|
- this.orderFeesList = res.data.data.orderFeesList
|
|
|
- ? res.data.data.orderFeesList
|
|
|
- : [];
|
|
|
this.freightData = res.data.data.orderFreightList
|
|
|
? res.data.data.orderFreightList
|
|
|
: [];
|
|
|
this.configuration.dicData = this.form.corpsName;
|
|
|
+ this.oldform = res.data.data;
|
|
|
+ this.olddata = this.deepClone(
|
|
|
+ res.data.data.itemsVOList ? res.data.data.itemsVOList : []
|
|
|
+ );
|
|
|
+ this.oldfreightData = this.deepClone(
|
|
|
+ res.data.data.orderFreightList ? res.data.data.orderFreightList : []
|
|
|
+ );
|
|
|
});
|
|
|
},
|
|
|
addFreight() {
|
|
|
this.freightData.push({ $cellEdit: true });
|
|
|
},
|
|
|
//修改提交触发
|
|
|
- editCustomer(status) {
|
|
|
+ editCustomer(status, status2) {
|
|
|
this.$refs["form"].validate((valid, done) => {
|
|
|
done();
|
|
|
if (valid) {
|
|
|
- let orderFeesList = this.$refs.feeInfo.submitData();
|
|
|
- for (let i = 0; i < orderFeesList.length; i++) {
|
|
|
- if (orderFeesList[i].corpId == null) {
|
|
|
- return this.$message.error(`请输入第${i + 1}行的结算中心`);
|
|
|
- }
|
|
|
- if (orderFeesList[i].price == 0) {
|
|
|
- return this.$message.error(`请正确输入第${i + 1}行的价格`);
|
|
|
- }
|
|
|
- if (orderFeesList[i].quantity == 0) {
|
|
|
- return this.$message.error(`请正确输入第${i + 1}行的数量`);
|
|
|
- }
|
|
|
- }
|
|
|
if (status == "submit") {
|
|
|
submit({
|
|
|
id: this.form.id,
|
|
|
- orderFeesList: orderFeesList,
|
|
|
orderFreightList: this.freightData
|
|
|
}).then(res => {
|
|
|
this.$message.success("修改成功");
|
|
@@ -512,19 +506,27 @@ export default {
|
|
|
this.data = res.data.data.itemsVOList
|
|
|
? res.data.data.itemsVOList
|
|
|
: [];
|
|
|
- this.orderFeesList = res.data.data.orderFeesList
|
|
|
- ? res.data.data.orderFeesList
|
|
|
- : [];
|
|
|
this.freightData = res.data.data.orderFreightList
|
|
|
? res.data.data.orderFreightList
|
|
|
: [];
|
|
|
this.configuration.dicData = this.form.corpsName;
|
|
|
+ this.oldform = res.data.data;
|
|
|
+ this.olddata = this.deepClone(
|
|
|
+ res.data.data.itemsVOList ? res.data.data.itemsVOList : []
|
|
|
+ );
|
|
|
+ this.oldfreightData = this.deepClone(
|
|
|
+ res.data.data.orderFreightList
|
|
|
+ ? res.data.data.orderFreightList
|
|
|
+ : []
|
|
|
+ );
|
|
|
+ if (status2 == "goBack") {
|
|
|
+ this.$emit("goBack");
|
|
|
+ }
|
|
|
});
|
|
|
}
|
|
|
if (status == "fix") {
|
|
|
commit({
|
|
|
id: this.form.id,
|
|
|
- orderFeesList: orderFeesList,
|
|
|
orderFreightList: this.freightData
|
|
|
}).then(res => {
|
|
|
this.$message.success("提交成功");
|
|
@@ -532,13 +534,19 @@ export default {
|
|
|
this.data = res.data.data.itemsVOList
|
|
|
? res.data.data.itemsVOList
|
|
|
: [];
|
|
|
- this.orderFeesList = res.data.data.orderFeesList
|
|
|
- ? res.data.data.orderFeesList
|
|
|
- : [];
|
|
|
this.freightData = res.data.data.orderFreightList
|
|
|
? res.data.data.orderFreightList
|
|
|
: [];
|
|
|
this.configuration.dicData = this.form.corpsName;
|
|
|
+ this.oldform = res.data.data;
|
|
|
+ this.olddata = this.deepClone(
|
|
|
+ res.data.data.itemsVOList ? res.data.data.itemsVOList : []
|
|
|
+ );
|
|
|
+ this.oldfreightData = this.deepClone(
|
|
|
+ res.data.data.orderFreightList
|
|
|
+ ? res.data.data.orderFreightList
|
|
|
+ : []
|
|
|
+ );
|
|
|
});
|
|
|
}
|
|
|
} else {
|
|
@@ -548,7 +556,25 @@ export default {
|
|
|
},
|
|
|
//返回列表
|
|
|
backToList() {
|
|
|
- this.$emit("goBack");
|
|
|
+ if (
|
|
|
+ contrastObj(this.form, this.oldform) ||
|
|
|
+ contrastList(this.data, this.olddata) ||
|
|
|
+ contrastList(this.freightData, this.oldfreightData)
|
|
|
+ ) {
|
|
|
+ this.$confirm("数据发生变化未有提交记录, 是否提交?", "提示", {
|
|
|
+ confirmButtonText: "确定",
|
|
|
+ cancelButtonText: "取消",
|
|
|
+ type: "warning"
|
|
|
+ })
|
|
|
+ .then(() => {
|
|
|
+ this.editCustomer("submit", "goBack");
|
|
|
+ })
|
|
|
+ .catch(() => {
|
|
|
+ this.$emit("goBack");
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ this.$emit("goBack");
|
|
|
+ }
|
|
|
},
|
|
|
onClose(val) {
|
|
|
this.switchDialog = val;
|