|
@@ -2,7 +2,7 @@
|
|
|
import Column from "../column";
|
|
|
import useData from "../hooks/data";
|
|
|
import useDicts from "../hooks/dicts";
|
|
|
-import useMethods from "../hooks/function";
|
|
|
+import { ITEM } from "@/api/business/purchase/catalogue";
|
|
|
|
|
|
export default {
|
|
|
name: "SeeDrawer",
|
|
@@ -15,44 +15,59 @@ export default {
|
|
|
};
|
|
|
},
|
|
|
computed: {
|
|
|
- hasPowerEnable: function () {
|
|
|
- return this.$parent.$parent.hasPowerEnable;
|
|
|
- },
|
|
|
- hasPowerInvalid: function () {
|
|
|
- return this.$parent.$parent.hasPowerInvalid;
|
|
|
+ root: function () {
|
|
|
+ return this.$parent.$parent;
|
|
|
},
|
|
|
},
|
|
|
watch: {},
|
|
|
methods: {
|
|
|
//
|
|
|
+ async fetchItem(prop) {
|
|
|
+ try {
|
|
|
+ // try
|
|
|
+ this.loading = true;
|
|
|
+ const { code, data } = await ITEM(prop);
|
|
|
+ if (code === 200) {
|
|
|
+ this.params = data;
|
|
|
+ return true;
|
|
|
+ } else {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ } catch (err) {
|
|
|
+ // catch
|
|
|
+ console.error(err);
|
|
|
+ } finally {
|
|
|
+ // finally
|
|
|
+ this.loading = false;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ //
|
|
|
async open(prop) {
|
|
|
- const { open, fetchItem } = useMethods();
|
|
|
- await open({ _this: this });
|
|
|
- await fetchItem({ _this: this, prop });
|
|
|
+ this.visible = await this.fetchItem(prop);
|
|
|
},
|
|
|
//
|
|
|
async hide() {
|
|
|
- const { hide } = useMethods();
|
|
|
- await hide({ _this: this });
|
|
|
+ this.visible = false;
|
|
|
},
|
|
|
//
|
|
|
async useInvalid(prop) {
|
|
|
- const { useInvalid } = this.$parent.$parent;
|
|
|
- await useInvalid(prop).then(() => {
|
|
|
- const [{ id }] = prop;
|
|
|
- const { fetchItem } = useMethods();
|
|
|
- fetchItem({ _this: this, prop: id });
|
|
|
- });
|
|
|
+ await this.root
|
|
|
+ .useInvalid(prop)
|
|
|
+ .then(() => {
|
|
|
+ this.fetchItem(this.params.id);
|
|
|
+ })
|
|
|
+ .catch(() => {});
|
|
|
},
|
|
|
//
|
|
|
async useEnable(prop) {
|
|
|
- const [{ id, enableStatus }] = prop;
|
|
|
- const { useEnable } = this.$parent.$parent;
|
|
|
+ const [{ enableStatus }] = prop;
|
|
|
const status = enableStatus === "2" ? "0" : "2";
|
|
|
- await useEnable(prop, status).then(() => {
|
|
|
- const { fetchItem } = useMethods();
|
|
|
- fetchItem({ _this: this, prop: id });
|
|
|
- });
|
|
|
+ await this.root
|
|
|
+ .useEnable(prop, status)
|
|
|
+ .then(() => {
|
|
|
+ this.fetchItem(this.params.id);
|
|
|
+ })
|
|
|
+ .catch(() => {});
|
|
|
},
|
|
|
},
|
|
|
created() {},
|
|
@@ -70,14 +85,8 @@ export default {
|
|
|
<template slot="title">
|
|
|
<span>{{ title }}</span>
|
|
|
<span>
|
|
|
- <el-button
|
|
|
- :size="size"
|
|
|
- circle
|
|
|
- icon="el-icon-close"
|
|
|
- @click="hide"
|
|
|
- ></el-button>
|
|
|
<el-tooltip
|
|
|
- v-if="hasPowerInvalid([params])"
|
|
|
+ v-if="root.hasPowerInvalid([params])"
|
|
|
effect="dark"
|
|
|
content="失 效"
|
|
|
placement="bottom-end"
|
|
@@ -90,7 +99,7 @@ export default {
|
|
|
></el-button>
|
|
|
</el-tooltip>
|
|
|
<el-tooltip
|
|
|
- v-if="hasPowerEnable([params])"
|
|
|
+ v-if="root.hasPowerEnable([params])"
|
|
|
effect="dark"
|
|
|
:content="params.enableStatus === '2' ? '启 用' : '停 用'"
|
|
|
placement="bottom-end"
|
|
@@ -102,6 +111,13 @@ export default {
|
|
|
@click="useEnable([params])"
|
|
|
></el-button>
|
|
|
</el-tooltip>
|
|
|
+ <el-button
|
|
|
+ :size="size"
|
|
|
+ circle
|
|
|
+ type="danger"
|
|
|
+ icon="el-icon-close"
|
|
|
+ @click="hide"
|
|
|
+ ></el-button>
|
|
|
</span>
|
|
|
</template>
|
|
|
<el-descriptions :size="size" :column="column" border style="margin: 10px">
|