Browse Source

人群包管理接口联调

jiayufei 4 năm trước cách đây
mục cha
commit
9b39804a8a

+ 11 - 1
src/views/modules/crowd-control/components/tree-select/tree-select.vue

@@ -66,6 +66,17 @@ export default {
             return !this.treeData.length;
         }
     },
+    watch: {
+        applyTypeOption: {
+            handler(newName, oldName) {
+                if (newName.length > 100) {
+                    this.$message.error('最多不能超过100个');
+                    this.applyTypeOption = newName.splice(0, 99);
+                }
+            },
+            immediate: true
+        }
+    },
     mounted() {
         this.getAccountId();
     },
@@ -105,7 +116,6 @@ export default {
         onChange(e) {
             const value = e.target.value;
             const cloneTreeData = JSON.parse(JSON.stringify(this.treeData));
-            console.log(cloneTreeData, this.treeData, '---------');
             this.treeData = value !== '' ? this.getNewTreeData(cloneTreeData, value) : [...this.updateTreeData];
         },
         getNewTreeData(treeData, value) {

+ 1 - 0
src/views/modules/crowd-control/crowd-control-service.js

@@ -5,6 +5,7 @@
 
 class AppMarketService {
     constructor() {}
+    
     // 人群包类型
     setPopulationTypeTasks() {
         return [

+ 10 - 1
src/views/modules/crowd-control/crowd-control.less

@@ -9,7 +9,7 @@
         /deep/ .ant-form-inline .ant-form-item > .ant-form-item-control-wrapper, .ant-form-inline .ant-form-item > .ant-form-item-label {
             width: 200px !important;
         }
-        .resetClass {
+        .reset-class {
             margin-right: 10px !important;
         }
         .upload-person {
@@ -66,6 +66,15 @@
 }
 /deep/ .cause-modal {
     width: 600px !important;
+    .cause-modal-table-class {
+        height: 500px;
+        overflow-y: auto;
+    }
+    .pagin-table-class {
+        display: flex;
+        justify-content: flex-end;
+        margin-top: 20px;
+    }
 }
 /deep/ .relax-modal {
     width: 600px !important;

+ 97 - 55
src/views/modules/crowd-control/crowd-control.vue

@@ -4,11 +4,13 @@
             <a-form
                 class="grid-form" layout="inline"
                 :form="form"
-                hide-required-mark @submit="handleQueryList"
+                hide-required-mark
+                @submit="handleQueryList"
             >
                 <a-row class="grid-form-options">
                     <a-form-item
-                        class="grid-form-item" label="名称"
+                        class="grid-form-item"
+                        label="名称"
                         :colon="false"
                     >
                         <a-input
@@ -37,12 +39,14 @@
                         </a-select>
                     </a-form-item>
                     <a-form-item class="form-handle-btn">
-                        <a-button type="default" class="resetClass" @click="handleResetForm">重置</a-button>
+                        <a-button type="default" class="reset-class" @click="handleResetForm">重置</a-button>
                         <a-button type="primary" html-type="submit">查询</a-button>
                     </a-form-item>
                 </a-row>
             </a-form>
-            <a-button type="primary" class="upload-person" @click="handleUploadPerson">上传人群包</a-button>
+            <a-button type="primary" class="upload-person" @click="handleUploadPerson">
+                上传人群包
+            </a-button>
         </div>
         <div class="control-con-table">
             <a-table
@@ -59,7 +63,7 @@
                     <a @click="handleDelete(record)">删除</a>
                 </span>
                 <span slot="cause" slot-scope="text, record">
-                    <a class="cause-text-class" @click="handleCause">{{ text }}</a>
+                    <a class="cause-text-class" @click="handleCause(record)">{{ text }}</a>
                 </span>
                 <span slot="depRelax" slot-scope="text, record">
                     <a @click="handleAcountRelax('dep', record)">{{ text }}</a>
@@ -155,25 +159,29 @@
             v-if="causeVisible"
             :visible="causeVisible"
             :confirm-loading="causeConfirmLoading"
+            :footer="null"
             dialog-class="cause-modal"
-            @ok="handleCauseSure"
             @cancel="handleCauseCancel"
         >
             <div>
-                <a-table :columns="causeColumns" :data-source="causeData" bordered>
-                    <template>
-                        {{ text }}
-                    </template>
-                </a-table>
+                <div class="cause-modal-table-class">
+                    <a-table :columns="causeColumns" :data-source="causeData" bordered :pagination="false"></a-table>
+                </div>
+                <a-pagination
+                    class="pagin-table-class"
+                    :total="totalAllCause"
+                    size="small"
+                    @change="handleCauseSizeChange"
+                />
             </div>
-        </a-modal>
+        </a-modal>   
         <a-modal
             title="相关项目"
             v-if="relaxVisible"
             :visible="relaxVisible"
             :confirm-loading="relaxConfirmLoading"
+            :footer="null"
             dialog-class="relax-modal"
-            @ok="handleRelaxSure"
             @cancel="handleRelaxCancel"
         >
             <div>
@@ -187,17 +195,10 @@
                 </div>
                 <template v-if="relaxStatus === 'dep'">
                     <a-table :columns="depColumns" :data-source="depData" bordered>
-                        <template>
-                            {{ text }}
-                        </template>
                     </a-table>
                 </template>
                 <template v-if="relaxStatus === 'acount'">
-                    <a-table :columns="acountColumns" :data-source="acountData" bordered>
-                        <template>
-                            {{ text }}
-                        </template>
-                    </a-table>
+                    <a-table :columns="acountColumns" :data-source="acountData" bordered></a-table>
                 </template>
             </div>
         </a-modal>
@@ -223,6 +224,7 @@ export default {
     data() {
         let that = this;
         return {
+            totalAllCause: 0,
             acountId: undefined, // 搜索的账户ID
             uploadAcountIds: '',
             totalAll: 10,
@@ -285,13 +287,7 @@ export default {
                 }
             ],
             relaxStatus: '',
-            causeData: [ // 原因的table列表数据
-                {
-                    name: '1111',
-                    age: '222',
-                    address: '33333'
-                }
-            ],
+            causeData: [], // 原因的table列表数据,
             depData: [ // 相关项目的table列表数据
                 {
                     name: '1111',
@@ -343,17 +339,17 @@ export default {
             causeColumns: [ // 原因的table列表
                 {
                     title: '项目名称',
-                    dataIndex: 'name',
-                    width: '25%'
+                    dataIndex: 'projectName',
+                    width: '30%'
                 },
                 {
                     title: '账户名称',
-                    dataIndex: 'age',
-                    width: '15%'
+                    dataIndex: 'accountName',
+                    width: '30%'
                 },
                 {
                     title: '原因',
-                    dataIndex: 'address',
+                    dataIndex: 'message',
                     width: '40%'
                 }
             ],
@@ -362,6 +358,8 @@ export default {
                 {
                     title: '人群包名称',
                     align: 'center',
+                    width: 200,
+                    ellipsis: true,
                     dataIndex: 'orientationName'
                 },
                 {
@@ -369,16 +367,13 @@ export default {
                     align: 'center',
                     dataIndex: 'populationType',
                     customRender(t) {
-                        return that.populationTypeTasks.find(item => item.label === Number(t)).value || '-';
+                        return t ? that.populationTypeTasks.find(item => item.label === Number(t)).value : '-';
                     }
                 },
                 {
                     title: '匹配类型',
                     align: 'center',
-                    dataIndex: 'type',
-                    customRender(t) {
-                        return that.mateTypeTasks.find(item => item.label === t).value || '-';
-                    }
+                    dataIndex: 'typeStr'
                 },
                 {
                     title: '上传时间',
@@ -395,7 +390,7 @@ export default {
                     dataIndex: 'status',
                     align: 'center',
                     customRender(t) {
-                        return that.statusTasks.find(item => item.label === t).value || '-';
+                        return t ? that.statusTasks.find(item => item.label === t).value : '-';
                     }
                 },
                 {
@@ -445,8 +440,13 @@ export default {
                 page: 1,
                 size: 10
             },
+            causePag: {
+                page: 1,
+                size: 10
+            },
             tableSelectList: {},
-            acountRelaxDetail: {}
+            acountRelaxDetail: {},
+            causeDetailData: {}
         };
     },
     created() {
@@ -457,13 +457,20 @@ export default {
     },
     methods: {
         onShowSizeChange(current, pageSize) {
+            const params = this.form.getFieldsValue();
             this.tablePag = {
                 page: current,
                 size: pageSize
             };
-            const params = this.form.getFieldsValue();
             this.handleGetTableList(params);
         },
+        handleCauseSizeChange(current, pageSize) {
+            this.causePag = {
+                page: current,
+                size: pageSize
+            };
+            this.handleCauseTableData();
+        },
         handleGetTableList(data) {
             const params = {
                 orientationName: data.name,
@@ -486,13 +493,37 @@ export default {
                 title: '删除提示',
                 content: '确定要删除这一条吗?',
                 onOk() {
-                    return new Promise((resolve, reject) => {
-                        setTimeout(Math.random() > 0.5 ? resolve : reject, 1000);
-                    }).catch(() => console.log('Oops errors!'));
+                    getAction('/kuaishouCrowdPack/delete', {id: data.id}).then(result => {
+                        if (result.code === 200) {
+                            this.handleGetTableList({});
+                        }
+                    }).catch(error => {
+                        console.log(error, 'eeee');
+                    });
                 },
                 onCancel() {}
             });
         },
+        handleAcountRelaxTable(txt) {
+            const params = {
+                orientationId: this.acountRelaxDetail.orientationId,
+                accountId: this.acountRelaxDetail.accountId,
+                type: txt === 'dep' ? 1 : 2
+            };
+            getAction('/kuaishouCrowdPack/queryRel', params).then(result => {
+                if (result.code === 200) {
+                    console.log(result, 'result----relax');
+                    if (txt === 'dep') {
+                        this.depData = result.result;
+                    }
+                    else if (txt === 'acount') {
+                        this.acountData = result.result;
+                    }
+                }
+            }).catch(error => {
+                console.log(error, 'eeee');
+            });
+        },
         handleAcountRelax(txt, recd) {
             if (txt === 'dep') {
                 this.relaxStatus = 'dep';
@@ -501,16 +532,31 @@ export default {
                 this.relaxStatus = 'acount';
             }
             this.acountRelaxDetail = recd;
+            this.handleAcountRelaxTable(txt);
             this.relaxVisible = true;
         },
         handleRelaxCancel() {
             this.relaxVisible = false;
         },
-        handleRelaxSure() {
-            console.log('相关项目确认弹窗');
-        },
-        handleCause() {
+        handleCause(list) {
             this.causeVisible = true;
+            this.causeDetailData = list;
+            this.handleCauseTableData();
+        },
+        handleCauseTableData() {
+            const paramsData = {
+                accountId: this.causeDetailData.accountId,
+                pageNo: this.causePag.page,
+                pageSize: this.causePag.size
+            };
+            getAction('/kuaishouCrowdPack/queryFailReason', paramsData).then(result => {
+                if (result.code === 200) {
+                    this.causeData = result.result.list || [];
+                    this.totalAllCause = result.result.total || 0;
+                }
+            }).catch(error => {
+                console.log(error, 'eeee');
+            });
         },
         handleApplyType(list) {
             this.finallyRightTree = list;
@@ -519,9 +565,6 @@ export default {
             this.tableSelectList = val;
             this.pushVisible = true;
         },
-        handleCauseSure() {
-            console.log('错误原因确认按钮');
-        },
         handleCauseCancel() {
             this.causeVisible = false;
         },
@@ -550,14 +593,12 @@ export default {
                 this.$message.error('只能上传zip格式的文件或者txt文件');
                 return false;
             }
-            const fileOvesize = file.size > (1024 * 1024);
+            const fileOvesize = file.size > (1024 * 1024 * 1024);
             if (fileOvesize) {
                 this.$message.error('文件大小不能超过1G');
                 return;
             }
-            else {
-                this.cosUpload(file);
-            }
+            this.cosUpload(file);
         },
         cosUpload(file) {
             var that = this;
@@ -663,6 +704,7 @@ export default {
         handleCancel() {
             this.personVisible = false;
             this.$refs.ruleForm.resetFields();
+            this.uploadAcountIds = '';
         }
     }
 };

+ 2 - 2
vue.config.js

@@ -77,10 +77,10 @@ module.exports = {
         // target: 'http://192.168.1.43:8088', //请求本地 需要jeecg-boot后台项目  毕洁泉
         // target: 'http://192.168.1.43:8806', //请求本地 需要jeecg-boot后台项目  毕洁泉
         // target: 'http://192.168.0.252:8098', //请求本地 需要jeecg-boot后台项目  毕洁泉
-        // target: 'http://192.168.1.219:8080', //请求本地 需要jeecg-boot后台项目  赵西安
+        target: 'http://192.168.1.219:8080', //请求本地 需要jeecg-boot后台项目  赵西安
         // target: 'http://192.168.1.193:8080', //请求本地 需要jeecg-boot后台项目  李煜一
         // target: 'http://192.168.1.193:31012', //请求本地 需要jeecg-boot后台项目  李煜一
-         target: 'http://api.tjyourong.com.cn', //请求本地 需要jeecg-boot后台项目
+        //  target: 'http://api.tjyourong.com.cn', //请求本地 需要jeecg-boot后台项目
         // target: 'https://trac.tjyourong.com.cn', //请求本地 需要jeecg-boot后台项目
         // target: 'http://39.106.184.70:8088/', //请求本地 需要jeecg-boot后台项目
         //  target: 'http://adsp.tjyourong.com.cn/', //请求本地 需要jeecg-boot后台项目