|
@@ -155,8 +155,8 @@
|
|
|
<template #footer v-if="oData && oData.tagApplyStateId === '0'">
|
|
|
<div class="flex center dialog-footer">
|
|
|
<el-button
|
|
|
- @click="onCloseBtnClick"
|
|
|
- >导入</el-button>
|
|
|
+ @click="onImportOrUpdateBtnClick"
|
|
|
+ >{{ isAuto ? '导入' : '修改' }}</el-button>
|
|
|
<el-button
|
|
|
v-if="oData && oData.tagApplyStateId === '0'"
|
|
|
type="primary"
|
|
@@ -188,7 +188,8 @@ export default {
|
|
|
},
|
|
|
data: () => ({
|
|
|
visible: false,
|
|
|
- oData: null
|
|
|
+ oData: null,
|
|
|
+ isAuto: false // flag=true 标识导入订单后自动弹出,false标识从详情弹出
|
|
|
}),
|
|
|
computed: {
|
|
|
formattedTitle () {
|
|
@@ -196,12 +197,14 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
- open (data) {
|
|
|
+ open (data, flag) {
|
|
|
+ this.isAuto = flag
|
|
|
this.oData = data
|
|
|
this.visible = true
|
|
|
this.list = data.details
|
|
|
},
|
|
|
close () {
|
|
|
+ this.isAuto = false
|
|
|
this.oData = null
|
|
|
this.visible = false
|
|
|
this.list = Object.freeze([])
|
|
@@ -254,6 +257,31 @@ export default {
|
|
|
onCloseBtnClick () {
|
|
|
this.close()
|
|
|
},
|
|
|
+ onImportOrUpdateBtnClick () {
|
|
|
+ if (this.oData && this.oData.details && this.oData.details.length > 0) {
|
|
|
+ const datas = this.oData.details.filter(item => item.number && item.number > 0)
|
|
|
+ if (datas.length !== this.oData.details.length) {
|
|
|
+ this.$notify.error({
|
|
|
+ title: '失败',
|
|
|
+ message: '标签数量需大于0',
|
|
|
+ position: 'bottom-right'
|
|
|
+ })
|
|
|
+ return
|
|
|
+ }
|
|
|
+ this.$$request(this.api, this.oData).then((flag) => {
|
|
|
+ if (flag) {
|
|
|
+ this.$notify({
|
|
|
+ title: '成功',
|
|
|
+ message: '操作成功',
|
|
|
+ type: 'success',
|
|
|
+ position: 'bottom-right'
|
|
|
+ })
|
|
|
+ this.close()
|
|
|
+ this.$emit('saved')
|
|
|
+ }
|
|
|
+ }).catch(console.error).finally(() => {})
|
|
|
+ }
|
|
|
+ },
|
|
|
onOkBtnClick () {
|
|
|
this.$$request(this.api, this.oData).then((flag) => {
|
|
|
if (flag) {
|