You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
86 lines
2.0 KiB
86 lines
2.0 KiB
2 years ago
|
import {
|
||
|
postCreate,
|
||
|
postUpdate,
|
||
|
} from "@/api/wms-api"
|
||
|
export const newAndEdiDialogMixins = {
|
||
|
data() {
|
||
|
return {
|
||
|
//form数据显示操控
|
||
|
formReveal: true,
|
||
|
pageStatus: "",
|
||
|
active: 0,
|
||
|
ref: null
|
||
|
}
|
||
|
},
|
||
|
methods: {
|
||
|
//关闭弹窗
|
||
|
closeDialog(val) {
|
||
|
this.pageStatus = ""
|
||
|
if (this.formReveal) {
|
||
|
this.CreateFormData = val
|
||
|
this.displayDialog.newDialog = false
|
||
|
if (this.active) {
|
||
|
this.oldSkipCount = 1;
|
||
|
this.paging();
|
||
|
}
|
||
|
} else {
|
||
|
this.displayDialog.editDialog = false
|
||
|
if (this.active) {
|
||
|
this.paging();
|
||
|
}
|
||
|
}
|
||
|
this.active = 0
|
||
|
},
|
||
|
// //取消
|
||
|
// determine(val) {
|
||
|
// this.FormRemove(val)
|
||
|
// this.closeDialog()
|
||
|
// },
|
||
|
//控制步骤与返回结果
|
||
|
FormResult(val) {
|
||
|
if (val == "success") {
|
||
|
this.active = 1
|
||
|
this.pageStatus = "success"
|
||
|
} else {
|
||
|
this.active = 2
|
||
|
this.pageStatus = "error"
|
||
|
}
|
||
|
},
|
||
|
//提交表单
|
||
|
FormSubmit(val) {
|
||
|
this.ref = val
|
||
|
this.Loading.newAndEdiLoading = true
|
||
|
switch (this.formReveal) {
|
||
|
case true:
|
||
|
postCreate(this.CreateFormData, this.URL).then(res => {
|
||
|
this.oldSkipCount = 1;
|
||
|
this.Loading.newAndEdiLoading = false
|
||
|
this.FormResult("success")
|
||
|
}).catch(err => {
|
||
|
this.Loading.newAndEdiLoading = false
|
||
|
this.FormResult("error")
|
||
|
})
|
||
|
break;
|
||
|
case false:
|
||
|
postUpdate(this.editFormData, this.propsData.id, this.URL).then(res => {
|
||
|
this.propsData = res
|
||
|
this.Loading.newAndEdiLoading = false
|
||
|
this.FormResult("success")
|
||
|
}).catch(err => {
|
||
|
this.Loading.newAndEdiLoading = false
|
||
|
this.FormResult("error")
|
||
|
})
|
||
|
}
|
||
|
},
|
||
|
//删除表单、退出dialog
|
||
|
FormClose(val) {
|
||
|
this.closeDialog(val)
|
||
|
},
|
||
|
//回退
|
||
|
goBack() {
|
||
|
this.active = 0
|
||
|
this.pageStatus = ""
|
||
|
}
|
||
|
}
|
||
|
}
|