|
@@ -48,7 +48,7 @@
|
|
|
@select-all="handleCheckAll"
|
|
|
v-if="type !== 'service'"
|
|
|
>
|
|
|
- <dg-table-column type="selection" width="55" />
|
|
|
+ <dg-table-column type="selection" reserve-selection width="55" />
|
|
|
<template v-for="(item, indexs) in cardAgencylist">
|
|
|
<dg-table-column :key="indexs" v-bind="item" align="center"> </dg-table-column>
|
|
|
</template>
|
|
@@ -124,16 +124,14 @@ export default {
|
|
|
let rowKeys = [];
|
|
|
for (let j = 0; j < content.length; j++) {
|
|
|
const cItem = content[j];
|
|
|
- const index = this.newChooseArr.findIndex((item) => item == cItem.id);
|
|
|
+ const index = this.newChooseArr.findIndex((item) => (item.id || item) == cItem.id);
|
|
|
if (index > -1) {
|
|
|
- rowKeys.push(this.newChooseArr[index]);
|
|
|
+ rowKeys.push(this.newChooseArr[index].id || this.newChooseArr[index]);
|
|
|
}
|
|
|
}
|
|
|
- this.$nextTick(() => {
|
|
|
- setTimeout(() => {
|
|
|
- this.$refs.table.setCheck(rowKeys);
|
|
|
- }, 200);
|
|
|
- });
|
|
|
+ setTimeout(() => {
|
|
|
+ this.$refs.table.setCheck(rowKeys);
|
|
|
+ }, 500);
|
|
|
}
|
|
|
|
|
|
const result = {
|
|
@@ -149,7 +147,7 @@ export default {
|
|
|
*/
|
|
|
handleSelect(selection, row) {
|
|
|
let copyAttr = _.cloneDeep(this.newChooseArr);
|
|
|
- const index = this.newChooseArr.findIndex((item) => item.id == row.id);
|
|
|
+ const index = this.newChooseArr.findIndex((item) => (item.id || item) == row.id);
|
|
|
if (index > -1) {
|
|
|
copyAttr.splice(index, 1);
|
|
|
} else {
|
|
@@ -162,9 +160,23 @@ export default {
|
|
|
* 选中/取消选中
|
|
|
*/
|
|
|
handleCheckAll(selection) {
|
|
|
- this.currentPageContent.forEach((element) => {
|
|
|
- this.handleSelect([], element);
|
|
|
+ const checked = selection.length == 0 ? false : true;
|
|
|
+ this.currentPageContent.forEach((row) => {
|
|
|
+ // this.handleSelect([], element);
|
|
|
+ let copyAttr = _.cloneDeep(this.newChooseArr);
|
|
|
+ const index = this.newChooseArr.findIndex((item) => (item.id || item) == row.id);
|
|
|
+ if (checked) {
|
|
|
+ if (index < 0) {
|
|
|
+ copyAttr.push(row);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if (index > -1) {
|
|
|
+ copyAttr.splice(index, 1);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.newChooseArr = copyAttr;
|
|
|
});
|
|
|
+ console.log(this.newChooseArr);
|
|
|
},
|
|
|
/**
|
|
|
* 关闭
|
|
@@ -178,10 +190,10 @@ export default {
|
|
|
handleSave() {
|
|
|
const params = {
|
|
|
...this.otherParams,
|
|
|
- relIds: this.newChooseArr.map((item) => item.id)
|
|
|
+ relIds: this.newChooseArr.map((item) => item.id || item)
|
|
|
};
|
|
|
addRelateApp(params).then((res) => {
|
|
|
- this.$message.success("添加成功");
|
|
|
+ this.$message.success("保存成功");
|
|
|
this.$emit("success");
|
|
|
});
|
|
|
}
|
|
@@ -192,7 +204,6 @@ export default {
|
|
|
});
|
|
|
},
|
|
|
mounted() {
|
|
|
- console.log(this.type);
|
|
|
}
|
|
|
};
|
|
|
</script>
|