|
@@ -21,19 +21,30 @@ export default {
|
|
|
},
|
|
|
set() {},
|
|
|
},
|
|
|
+ disabled: {
|
|
|
+ get() {
|
|
|
+ let { innerValue } = this;
|
|
|
+
|
|
|
+ if (innerValue.length > 0) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ return true;
|
|
|
+ },
|
|
|
+ set() {},
|
|
|
+ },
|
|
|
},
|
|
|
methods: {
|
|
|
async open() {
|
|
|
let { innerValue } = this;
|
|
|
let data = innerValue.find((item) => item.isPayment === "N");
|
|
|
- if (!data) {
|
|
|
+ if (!data && innerValue.length) {
|
|
|
this.$prompt("请输入打开原因", "提示", {
|
|
|
confirmButtonText: "确定",
|
|
|
cancelButtonText: "取消",
|
|
|
inputPattern: /\s*\S+?/,
|
|
|
inputErrorMessage: "打开原因不能为空",
|
|
|
})
|
|
|
- .then(async ({value}) => {
|
|
|
+ .then(async ({ value }) => {
|
|
|
try {
|
|
|
let puOrderIds = innerValue.map((order) => Number(order.id));
|
|
|
let { code } = await orderApi.itemOpen({
|
|
@@ -51,7 +62,7 @@ export default {
|
|
|
.catch(() => {});
|
|
|
} else {
|
|
|
this.$notify.warning({
|
|
|
- message: "存在已经完成打开的行",
|
|
|
+ message: "不满足打开条件",
|
|
|
});
|
|
|
}
|
|
|
},
|
|
@@ -60,5 +71,7 @@ export default {
|
|
|
};
|
|
|
</script>
|
|
|
<template>
|
|
|
- <el-button :size="$attrs.size" @click="open">{{ title }}</el-button>
|
|
|
+ <el-button :size="$attrs.size" @click="open" :disabled="disabled">{{
|
|
|
+ title
|
|
|
+ }}</el-button>
|
|
|
</template>
|