|
@@ -1,7 +1,7 @@
|
|
|
<script>
|
|
|
import Column from "../add/column";
|
|
|
import useData from "../hooks/data";
|
|
|
-import { ITEM } from "@/api/business/purchase/apply";
|
|
|
+import { ITEM, LIST } from "@/api/business/purchase/apply";
|
|
|
|
|
|
export default {
|
|
|
name: "SeeDrawer",
|
|
@@ -9,31 +9,45 @@ export default {
|
|
|
return {
|
|
|
column: 3,
|
|
|
title: "明 细",
|
|
|
- lastPage: {},
|
|
|
...useData(Column),
|
|
|
};
|
|
|
},
|
|
|
+ props: {
|
|
|
+ // v-model
|
|
|
+ value: {
|
|
|
+ type: Boolean,
|
|
|
+ require: true,
|
|
|
+ },
|
|
|
+ },
|
|
|
computed: {
|
|
|
- root: function () {
|
|
|
- return this.$parent.$parent;
|
|
|
+ $father: {
|
|
|
+ get() {
|
|
|
+ return this.$parent.$parent;
|
|
|
+ },
|
|
|
},
|
|
|
$dicts: {
|
|
|
- get: function () {
|
|
|
- return this.$parent.$parent.$dicts;
|
|
|
+ get() {
|
|
|
+ return this.$father.$dicts;
|
|
|
},
|
|
|
},
|
|
|
},
|
|
|
watch: {},
|
|
|
methods: {
|
|
|
//
|
|
|
- async fetchItem(prop, index) {
|
|
|
+ async fetchItem(prop) {
|
|
|
try {
|
|
|
// try
|
|
|
this.loading = true;
|
|
|
- const { code, data } = await ITEM(prop);
|
|
|
+ const { params } = this.$father;
|
|
|
+ const {
|
|
|
+ code,
|
|
|
+ total,
|
|
|
+ rows: [data],
|
|
|
+ } = await LIST({ ...params }, { pageNum: prop, pageSize: 1 });
|
|
|
if (code === 200) {
|
|
|
this.params = data;
|
|
|
- this.params.$index = index;
|
|
|
+ this.params.$index = prop;
|
|
|
+ this.params.$total = total;
|
|
|
return true;
|
|
|
} else {
|
|
|
return false;
|
|
@@ -47,33 +61,16 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
//
|
|
|
- async open(prop, index, page) {
|
|
|
- this.lastPage = { ...page };
|
|
|
- this.visible = await this.fetchItem(prop, index);
|
|
|
+ async open(prop) {
|
|
|
+ this.visible = await this.fetchItem(prop);
|
|
|
},
|
|
|
//
|
|
|
async hide() {
|
|
|
this.visible = false;
|
|
|
- const { params, fetchList } = this.root;
|
|
|
- fetchList(params, this.lastPage);
|
|
|
- },
|
|
|
- //
|
|
|
- async useQueryLast(prop) {
|
|
|
- const { params, fetchList } = this.root;
|
|
|
- if (prop >= 1) {
|
|
|
- const [row] = await fetchList(params, { pageSize: 1, pageNum: prop });
|
|
|
- this.params = row;
|
|
|
- }
|
|
|
- },
|
|
|
- //
|
|
|
- async useQueryPrev(prop) {
|
|
|
- const { params, fetchList } = this.root;
|
|
|
- const [row] = await fetchList(params, { pageSize: 1, pageNum: prop });
|
|
|
- this.params = row;
|
|
|
},
|
|
|
//
|
|
|
async useDelete(prop) {
|
|
|
- await this.root
|
|
|
+ await this.$father
|
|
|
.useDelete(prop)
|
|
|
.then(() => {
|
|
|
this.hide();
|
|
@@ -82,10 +79,10 @@ export default {
|
|
|
},
|
|
|
//
|
|
|
async useSubmit(prop) {
|
|
|
- await this.root
|
|
|
+ await this.$father
|
|
|
.useSubmit(prop)
|
|
|
.then(() => {
|
|
|
- this.fetchItem(this.params.id);
|
|
|
+ this.hide();
|
|
|
})
|
|
|
.catch(() => {});
|
|
|
},
|
|
@@ -111,16 +108,16 @@ export default {
|
|
|
:disabled="params.$index === 1"
|
|
|
circle
|
|
|
icon="el-icon-top"
|
|
|
- @click="useQueryLast(params.$index - 1)"
|
|
|
+ @click="fetchItem(params.$index - 1)"
|
|
|
></el-button>
|
|
|
</el-tooltip>
|
|
|
<el-tooltip effect="dark" content="下一页" placement="bottom-end">
|
|
|
<el-button
|
|
|
:size="size"
|
|
|
- :disabled="params.$index === root.page.total"
|
|
|
+ :disabled="params.$index === params.$total"
|
|
|
circle
|
|
|
icon="el-icon-bottom"
|
|
|
- @click="useQueryPrev(params.$index + 1)"
|
|
|
+ @click="fetchItem(params.$index + 1)"
|
|
|
></el-button>
|
|
|
</el-tooltip>
|
|
|
<el-tooltip effect="dark" content="删 除" placement="bottom-end">
|
|
@@ -136,11 +133,11 @@ export default {
|
|
|
:size="size"
|
|
|
circle
|
|
|
icon="el-icon-document-copy"
|
|
|
- @click="root.useCopy([params])"
|
|
|
+ @click="$father.useCopy([params])"
|
|
|
></el-button>
|
|
|
</el-tooltip>
|
|
|
- <!-- v-if="root.hasPowerEdit([params])" -->
|
|
|
<el-tooltip
|
|
|
+ v-if="$father.hasPowerEdit([params])"
|
|
|
effect="dark"
|
|
|
content="编 辑"
|
|
|
placement="bottom-end"
|
|
@@ -149,11 +146,11 @@ export default {
|
|
|
:size="size"
|
|
|
circle
|
|
|
icon="el-icon-edit"
|
|
|
- @click="root.useEdit([params])"
|
|
|
+ @click="$father.useEdit([params])"
|
|
|
></el-button>
|
|
|
</el-tooltip>
|
|
|
<el-tooltip
|
|
|
- v-if="root.hasPowerSubmit([params])"
|
|
|
+ v-if="$father.hasPowerSubmit([params])"
|
|
|
effect="dark"
|
|
|
content="审 核"
|
|
|
placement="bottom-end"
|