Browse Source

修改人群包bug

朱鑫波 4 years ago
parent
commit
d0e9f8a0c1

+ 6 - 7
src/views/modules/crowd-control/components/tree-select/tree-select.vue

@@ -230,14 +230,17 @@ export default {
             }
         },
         onCheck(checkedKeys) {
-            console.log(checkedKeys, 'checkedKeys-checkedKeys');
             // this.checkedKeys = checkedKeys;
             this.nodes(this.treeData, checkedKeys);
-            console.log(this.selectRightData, 'this.selectRightData');
+            const filterCheckKey = this.checkedKeys.filter(item=>typeof item ==='number');
+            let filterCheckKeySet = new Set(filterCheckKey);
+            let selectRightDataSet = new Set(this.selectRightData);
+            let difference = new Set([...selectRightDataSet].filter((item) => !filterCheckKeySet.has(item.key)));
+            this.selectRightData.delete(...difference);
             this.applyTypeOption = this.Es6duplicate([...this.selectRightData], 'key');
-            console.log(this.applyTypeOption, 'this.applyTypeOption');
             const changeSelectData = this.applyTypeOption.map(item => item.key);
             this.checkedKeys = changeSelectData;
+              
             if (this.applyTypeOption.length > 100) {
                 const lastOptionKey = this.applyTypeOption[99].key;
                 const lastIndex = changeSelectData.findIndex(item => item === lastOptionKey);
@@ -247,10 +250,6 @@ export default {
             this.$emit('applyType', this.applyTypeOption);
         },
         nodes(data, checkedKeys) {
-            if (!checkedKeys.length) {
-                this.selectRightData = new Set();
-                return;
-            }
             data.forEach(item => {
                 if (item.children) {
                     this.nodes(item.children, checkedKeys);

+ 15 - 6
src/views/modules/crowd-control/crowd-control.vue

@@ -370,11 +370,12 @@ export default {
         handleGetTableList(data) {
             const paramsData = {
                 orientationName: data.name,
-                accountName: this.acountId,
+                accountId: this.acountId,
                 status: data.status,
                 pageNo: this.tablePag.page,
                 pageSize: this.tablePag.size
             };
+            this.dataSource = []
             getAction('/kuaishouCrowdPack/queryPageList', paramsData).then(result => {
                 if (result.code === 200) {
                     this.dataSource = result.result.list || [];
@@ -388,17 +389,18 @@ export default {
             });
         },
         handleDelete(data) {
+            let that = this
             this.$confirm({
                 title: '删除提示',
                 content: '确定要删除这一条吗?',
                 onOk() {
                     getAction('/kuaishouCrowdPack/delete', {id: data.id}).then(result => {
                         if (result.code === 200) {
-                            this.$message.success('删除成功');
-                            this.handleGetTableList({});
+                            that.handleGetTableList({});
+                            that.$message.success('删除成功');
                         }
                         else {
-                            this.$message.error(result.message);
+                            that.$message.error(result.message);
                         }
                     }).catch(error => {
                         console.log(error, 'eeee');
@@ -506,7 +508,6 @@ export default {
                 bmf.md5(file, (err, md5) => {
                     getAction('/kuaishouCrowdPack/checkCrowdPackage', {signature: md5}).then(result => {
                         if (result.code === 200) {
-                            that.$message.warning('人群包不存在,允许输入人群包名');
                             that.personNameDisabled = false;
                             that.personResourceDisabled = false;
                             resolve();
@@ -614,6 +615,7 @@ export default {
                         this.$message.error('请上传文件');
                         return;
                     }
+                    this.confirmLoading = true
                     this.handleUploadRuleForm();
                 }
                 else {
@@ -629,13 +631,17 @@ export default {
                 url: this.fileList[0].url
             };
             postAction('/kuaishouCrowdPack/uploadCrowdPack', paramsData).then(result => {
+                this.confirmLoading = false
                 if (result.code === 200) {
                     this.personVisible = false;
                     this.personResourceDisabled = false;
                     this.personNameDisabled = false;
-                    this.$message.error('上传成功');
+                    this.$message.success('上传成功');
                     this.handleGetTableList({});
                     this.fileList = [];
+                    this.personForm.name = '';
+                    this.personForm.resource = '';
+                    this.uploadAcountIds = undefined;
                 }
                 else {
                     this.$message.error(result.message);
@@ -645,11 +651,14 @@ export default {
             });
         },
         handleCancel() {
+            this.confirmLoading = false
             this.personVisible = false;
             this.personResourceDisabled = false;
             this.personNameDisabled = false;
             this.$refs.ruleForm.resetFields();
             this.uploadAcountIds = '';
+            this.personForm.name = '';
+            this.personForm.resource = '';
             this.fileList = [];
         }
     }