|
@@ -57,6 +57,7 @@ export default {
|
|
|
data: [],
|
|
|
selectData: [],
|
|
|
lastSelectData: [],
|
|
|
+ jsData: [],
|
|
|
};
|
|
|
},
|
|
|
computed: {
|
|
@@ -83,7 +84,6 @@ export default {
|
|
|
},
|
|
|
dataListArray: {
|
|
|
handler: function (newValue) {
|
|
|
- console.log("A:::" + JSON.stringify(newValue))
|
|
|
if (newValue.length>0){
|
|
|
newValue.forEach(element => {
|
|
|
this.lastSelectData.push(element)
|
|
@@ -108,7 +108,12 @@ export default {
|
|
|
},
|
|
|
// fetch list
|
|
|
async fetchList(prop, page) {
|
|
|
+
|
|
|
try {
|
|
|
+ this.selectData.forEach(element => {
|
|
|
+ this.jsData.push({"code":element.code,"name":element.name})
|
|
|
+ });
|
|
|
+ this.selectData = [];
|
|
|
// try
|
|
|
this.loading = true;
|
|
|
const { pageNum, pageSize } = page;
|
|
@@ -152,11 +157,24 @@ export default {
|
|
|
},
|
|
|
// delete
|
|
|
useDelete(prop) {
|
|
|
- this.selectData.splice(prop, 1);
|
|
|
- this.useConfirm(this.selectData);
|
|
|
+ this.lastSelectData.splice(prop, 1);
|
|
|
+ this.useConfirm(this.lastSelectData);
|
|
|
+
|
|
|
},
|
|
|
// confirm
|
|
|
useConfirm(prop) {
|
|
|
+ this.lastSelectData.forEach(element => {
|
|
|
+ prop.push({"code":element.code,"name":element.name})
|
|
|
+ });
|
|
|
+ this.selectData.forEach(element => {
|
|
|
+ prop.push({"code":element.code,"name":element.name})
|
|
|
+ });
|
|
|
+ const uniqueMap = {};
|
|
|
+ prop = prop.filter((item) => {
|
|
|
+ const isAlreadyPresent = uniqueMap[item.code];
|
|
|
+ uniqueMap[item.code] = true;
|
|
|
+ return !isAlreadyPresent;
|
|
|
+ });
|
|
|
const {
|
|
|
$props: { valueKey },
|
|
|
} = this;
|
|
@@ -171,8 +189,8 @@ export default {
|
|
|
//
|
|
|
this.hide();
|
|
|
this.lastSelectData = deepCopy(prop);
|
|
|
- // console.log("A:::" + JSON.stringify(this.lastSelectData))
|
|
|
this.$emit("change", prop, this.$props);
|
|
|
+ this.selectData = [];
|
|
|
},
|
|
|
// cancel
|
|
|
useCancel() {
|
|
@@ -224,7 +242,7 @@ export default {
|
|
|
type="primary"
|
|
|
:size="$attrs.size"
|
|
|
:loading="loading"
|
|
|
- @click="useConfirm(selectData)"
|
|
|
+ @click="useConfirm(jsData)"
|
|
|
>
|
|
|
确认
|
|
|
</el-button>
|