|
@@ -4,8 +4,10 @@ import {
|
|
|
EDIT,
|
|
|
ITEM,
|
|
|
TABLELIST,
|
|
|
+ TABLEEDIT,
|
|
|
TABLEROMOVE,
|
|
|
} from "@/api/business/purchase/contract";
|
|
|
+import { REFER } from "@/components/popover-select/api";
|
|
|
import { initDicts, initRules, initParams } from "@/utils/init";
|
|
|
|
|
|
export default {
|
|
@@ -53,6 +55,19 @@ export default {
|
|
|
},
|
|
|
immediate: true,
|
|
|
},
|
|
|
+ "params.contractItemList": {
|
|
|
+ handler: function (newProp, oldProp) {
|
|
|
+ console.log(newProp, oldProp);
|
|
|
+ if (newProp.length === oldProp.length) {
|
|
|
+ const index = newProp.findIndex(
|
|
|
+ (item, index) =>
|
|
|
+ JSON.stringify(item) === JSON.stringify(oldProp[index])
|
|
|
+ );
|
|
|
+ console.log(index);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ deep: true,
|
|
|
+ },
|
|
|
},
|
|
|
methods: {
|
|
|
//
|
|
@@ -89,7 +104,10 @@ export default {
|
|
|
this.loading = true;
|
|
|
const { code, rows } = await TABLELIST({ contractId: prop }, name);
|
|
|
if (code === 200) {
|
|
|
- this.params[name] = rows;
|
|
|
+ this.params[name] = rows.map((item) => ({
|
|
|
+ ...item,
|
|
|
+ status: "success",
|
|
|
+ }));
|
|
|
}
|
|
|
} catch (err) {
|
|
|
// catch
|
|
@@ -99,6 +117,28 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
//
|
|
|
+ async fetchRefer(prop, type, source) {
|
|
|
+ const { rateCode } = prop;
|
|
|
+ if (type === "MATERIAL_PARAM") {
|
|
|
+ try {
|
|
|
+ this.loading = true;
|
|
|
+ const { code, rows } = await REFER({
|
|
|
+ search: rateCode,
|
|
|
+ type: "TAX_RATE_PARAM",
|
|
|
+ });
|
|
|
+ if (code === 200) {
|
|
|
+ const [{ ntaxrate }] = rows;
|
|
|
+ source.tax = ntaxrate;
|
|
|
+ }
|
|
|
+ } catch (err) {
|
|
|
+ // catch
|
|
|
+ } finally {
|
|
|
+ // finally
|
|
|
+ this.loading = false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ //
|
|
|
rowAdd(prop) {
|
|
|
const tab = this.tabColumns.find((element) => element.key === prop);
|
|
|
this.params[prop].push(initParams(tab.tableColumns));
|
|
@@ -119,6 +159,20 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
//
|
|
|
+ async rowSubmit(prop, { row }) {
|
|
|
+ try {
|
|
|
+ this.loading = true;
|
|
|
+ const { code } = await TABLEEDIT(row, prop);
|
|
|
+ if (code === 200) {
|
|
|
+ }
|
|
|
+ } catch (err) {
|
|
|
+ // catch
|
|
|
+ } finally {
|
|
|
+ // finally
|
|
|
+ this.loading = false;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ //
|
|
|
submit(prop) {
|
|
|
this.$refs[prop].validate(async (valid) => {
|
|
|
if (valid) {
|
|
@@ -267,11 +321,11 @@ export default {
|
|
|
</el-table-column>
|
|
|
<el-table-column
|
|
|
v-for="(cColumn, cIndex) in column.tableColumns"
|
|
|
+ show-overflow-tooltip
|
|
|
:key="cIndex"
|
|
|
:prop="cColumn.key"
|
|
|
:label="cColumn.title"
|
|
|
:width="cColumn.width"
|
|
|
- show-overflow-tooltip
|
|
|
>
|
|
|
<template slot-scope="scope">
|
|
|
<el-input
|
|
@@ -303,6 +357,7 @@ export default {
|
|
|
:clearable="cColumn.clearable"
|
|
|
:placeholder="cColumn.placeholder"
|
|
|
:data-mapping="cColumn.dataMapping"
|
|
|
+ @change="fetchRefer"
|
|
|
>
|
|
|
</dr-popover-select>
|
|
|
<el-input-number
|
|
@@ -334,7 +389,7 @@ export default {
|
|
|
<span v-else> {{ scope.row[cColumn.key] }}</span>
|
|
|
</template>
|
|
|
</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">
|
|
|
<el-button
|
|
|
circle
|
|
@@ -345,13 +400,19 @@ export default {
|
|
|
</el-button>
|
|
|
</template>
|
|
|
<template slot-scope="scope">
|
|
|
+ <!-- v-if="scope.row.status !== 'success'" -->
|
|
|
+ <el-button
|
|
|
+ circle
|
|
|
+ icon="el-icon-check"
|
|
|
+ :size="size"
|
|
|
+ @click.native.prevent="rowSubmit(tabName, scope)"
|
|
|
+ >
|
|
|
+ </el-button>
|
|
|
<el-button
|
|
|
circle
|
|
|
icon="el-icon-minus"
|
|
|
:size="size"
|
|
|
- @click.native.prevent="
|
|
|
- rowDelete(params[tabName], scope.$index)
|
|
|
- "
|
|
|
+ @click.native.prevent="rowDelete(tabName, scope)"
|
|
|
>
|
|
|
</el-button>
|
|
|
</template>
|