|
@@ -1,7 +1,12 @@
|
|
<script>
|
|
<script>
|
|
import { Columns, TabColumns } from "../column";
|
|
import { Columns, TabColumns } from "../column";
|
|
import { REFER } from "@/components/popover-select/api";
|
|
import { REFER } from "@/components/popover-select/api";
|
|
-import { ADD, CODE } from "@/api/business/purchase/contract";
|
|
+import {
|
|
|
|
+ ADD,
|
|
|
|
+ CODE,
|
|
|
|
+ TABLEADD,
|
|
|
|
+ TABLEROMOVE,
|
|
|
|
+} from "@/api/business/purchase/contract";
|
|
import { initDicts, initRules, initParams } from "@/utils/init";
|
|
import { initDicts, initRules, initParams } from "@/utils/init";
|
|
|
|
|
|
export default {
|
|
export default {
|
|
@@ -112,8 +117,37 @@ export default {
|
|
this.params[prop].push(initParams(tab.tableColumns));
|
|
this.params[prop].push(initParams(tab.tableColumns));
|
|
},
|
|
},
|
|
//
|
|
//
|
|
- rowDelete(prop, index) {
|
|
+ async rowDelete(prop, { row: { id }, $index }) {
|
|
- prop.splice(index, 1);
|
|
+ if (id) {
|
|
|
|
+ try {
|
|
|
|
+ this.loading = true;
|
|
|
|
+ const { code } = await TABLEROMOVE(id, prop);
|
|
|
|
+ if (code === 200) {
|
|
|
|
+ this.fetchTable(this.params.code, prop);
|
|
|
|
+ }
|
|
|
|
+ } catch (err) {
|
|
|
|
+ // catch
|
|
|
|
+ } finally {
|
|
|
|
+ // finally
|
|
|
|
+ this.loading = false;
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ this.params[prop].splice($index, 1);
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ //
|
|
|
|
+ async rowSubmit(prop, { row }) {
|
|
|
|
+ try {
|
|
|
|
+ this.loading = true;
|
|
|
|
+ const { code } = this.params;
|
|
|
|
+ await TABLEADD({ ...row, contractId: code }, prop);
|
|
|
|
+ } catch (err) {
|
|
|
|
+ // catch
|
|
|
|
+ console.error(err);
|
|
|
|
+ } finally {
|
|
|
|
+ // finally
|
|
|
|
+ this.loading = false;
|
|
|
|
+ }
|
|
},
|
|
},
|
|
//
|
|
//
|
|
submit(prop) {
|
|
submit(prop) {
|
|
@@ -331,7 +365,7 @@ export default {
|
|
<span v-else> {{ scope.row[cColumn.key] }}</span>
|
|
<span v-else> {{ scope.row[cColumn.key] }}</span>
|
|
</template>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table-column>
|
|
- <el-table-column fixed="right" label="操作" width="75">
|
|
+ <el-table-column fixed="right" label="操作" width="100">
|
|
<template slot="header" slot-scope="scope">
|
|
<template slot="header" slot-scope="scope">
|
|
<el-button
|
|
<el-button
|
|
circle
|
|
circle
|
|
@@ -344,11 +378,16 @@ export default {
|
|
<template slot-scope="scope">
|
|
<template slot-scope="scope">
|
|
<el-button
|
|
<el-button
|
|
circle
|
|
circle
|
|
|
|
+ icon="el-icon-check"
|
|
|
|
+ :size="size"
|
|
|
|
+ @click.native.prevent="rowSubmit(tabName, scope)"
|
|
|
|
+ >
|
|
|
|
+ </el-button>
|
|
|
|
+ <el-button
|
|
|
|
+ circle
|
|
icon="el-icon-minus"
|
|
icon="el-icon-minus"
|
|
:size="size"
|
|
:size="size"
|
|
- @click.native.prevent="
|
|
+ @click.native.prevent="rowDelete(tabName, scope)"
|
|
- rowDelete(params[tabName], scope.$index)
|
|
|
|
- "
|
|
|
|
>
|
|
>
|
|
</el-button>
|
|
</el-button>
|
|
</template>
|
|
</template>
|