|
@@ -53,22 +53,23 @@ export default {
|
|
|
this.tabColumns = TabColumns;
|
|
|
}
|
|
|
this.tabName = this.tabColumns[0].key;
|
|
|
+ this.fetchTable(this.params.code, this.tabName);
|
|
|
},
|
|
|
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,
|
|
|
- },
|
|
|
+ // "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,8 +90,6 @@ export default {
|
|
|
const { code, data } = await ITEM(prop);
|
|
|
if (code === 200) {
|
|
|
this.params = data;
|
|
|
- this.tabName = this.tabColumns[0].key;
|
|
|
- this.fetchTable(this.params.code, this.tabName);
|
|
|
}
|
|
|
} catch (err) {
|
|
|
// catch
|
|
@@ -145,18 +144,22 @@ export default {
|
|
|
this.params[prop].push(initParams(tab.tableColumns));
|
|
|
},
|
|
|
//
|
|
|
- async rowDelete(prop, { row: { id } }) {
|
|
|
- try {
|
|
|
- this.loading = true;
|
|
|
- const { code } = await TABLEROMOVE(id, prop);
|
|
|
- if (code === 200) {
|
|
|
- this.fetchTable(this.params.code, this.tabName);
|
|
|
+ async rowDelete(prop, { row: { id }, $index }) {
|
|
|
+ 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;
|
|
|
}
|
|
|
- } catch (err) {
|
|
|
- // catch
|
|
|
- } finally {
|
|
|
- // finally
|
|
|
- this.loading = false;
|
|
|
+ } else {
|
|
|
+ this.params[prop].splice($index, 1);
|
|
|
}
|
|
|
},
|
|
|
//
|