Forráskód Böngészése

政策添加作废和导出

朱鑫波 3 éve
szülő
commit
0345ab8d95

+ 2 - 2
src/views/modules/policy-management/policy-management-server.js

@@ -3,9 +3,9 @@
  * @author jiayufei
  */
 
- export const urlAcount = 'http://api.tjyourong.com.cn'; // 线上
+//  export const urlAcount = 'http://api.tjyourong.com.cn'; // 线上
 //  export const urlAcount = 'http://gateway.tjyourong.com.cn'; // 测试
-//  export const urlAcount = 'http://192.168.1.43:9999'; // 子安
+ export const urlAcount = 'http://192.168.1.43:9999'; // 子安
 //  export const urlAcount = 'http://gateway.tjyourong.com.cn'; // 测试
 //  export const urlAcount = 'http://192.168.0.195:9999'; // 学超
  

+ 133 - 1
src/views/modules/policy-management/policy-management.vue

@@ -39,6 +39,10 @@
                 ||userInfo().id == 'a8c0a3d4df4f4b7083107a429b5391df'" class="add-acount-policy-btn">
                     <a-button @click="handleAddSale">销售对应人员</a-button>
                 </span>
+                <span v-if="userInfo().roleName == '管理员'
+                ||userInfo().roleName == '财务'" class="add-acount-policy-btn">
+                    <a-button @click="exportPolicy" :loading="exportLoading">导出</a-button>
+                </span>
                 <span v-if="userInfo().roleName !== '财务' && userInfo().roleName != '法务'" class="add-acount-policy-btn">
                     <a-button type="primary" @click="handleAddAccountPolicy">新增政策</a-button>
                 </span>
@@ -209,6 +213,10 @@
                 <span slot="dianPayCompanyRebateRate" slot-scope="text">
                     <span>{{ text ? text + '%' : '-' }}</span>
                 </span>
+                <span slot="delReason" slot-scope="text">
+                    <span>{{ text ? text : '-' }}</span>
+                </span>
+                
                 <span slot="accountingPeriod" slot-scope="text">
                     <span>{{ text ? text + '天' : '-' }}</span>
                 </span>
@@ -243,6 +251,8 @@
                     <a v-if="record.updateOperation.includes('提交审核')" @click="handleSubmitReview(record)">提交审核</a>
                     <a-divider v-if="record.updateOperation.includes('编辑')" type="vertical"/>
                     <a v-if="record.updateOperation.includes('编辑')" @click="handleEditTable(record)">编辑</a>
+                    <a-divider v-if="record.updateOperation.includes('作废')" type="vertical"/>
+                    <a v-if="record.updateOperation.includes('作废')" @click="handleVoid(record)">作废</a>
                     <!-- 
                     <a-divider v-if="record.updateOperation.includes('审核通过')" type="vertical"/>
                     <a v-if="record.updateOperation.includes('审核通过')" @click="handleAuditSure(record)">审核通过</a>
@@ -470,6 +480,37 @@
             </div>
         </a-modal>
         
+        
+        <!-- 作废原因 -->
+        <a-modal
+            v-if="voidOperationStatus"
+            title="作废原因"
+            dialog-class="rejection-reason-class"
+            :visible="voidOperationStatus"
+            @ok="handleVoidOk"
+            @cancel="
+                voidOperationStatus = false
+                reasonForm.desc = undefined
+            "
+        >
+            <div>
+                <div class="reason-class-header">请输入作废原因:</div>
+                <a-form-model
+                    ref="rejectRuleForm"
+                    :model="reasonForm"
+                    :rules="reasonRulesVoid"
+                >
+                    <a-form-model-item label="" prop="desc">
+                        <a-input
+                            class="rejection-textarea-msg"
+                            v-model="reasonForm.desc"
+                            type="textarea"
+                            placeholder="请输入至少五个字符"
+                        />
+                    </a-form-model-item>
+                </a-form-model>
+            </div>
+        </a-modal>
         <!-- 新增、编辑政策 -->
         <a-modal
             v-if="policyOperationStatus"
@@ -845,7 +886,7 @@
 <script>
 import moment from 'moment';
 
-import {getAction, postAction} from '@/api/manage';
+import {getAction, postAction, downFile} from '@/api/manage';
 import {mapGetters} from 'vuex';
 import {urlAcount} from './policy-management-server.js';
 
@@ -947,6 +988,10 @@ export default {
                 {
                     id: 4,
                     name: '审核拒绝'
+                },
+                {
+                    id: 5,
+                    name: '作废'
                 }
             ],
             subTitleMsgStatus: false,
@@ -962,6 +1007,7 @@ export default {
             rejectionReasonStatus: false,
             auditPolicyStatus: false,
             policyOperationStatus: false,
+            voidOperationStatus: false,
             totalAll: 0,
             policyOperationForm: {
                 defaultFormList: [
@@ -989,6 +1035,7 @@ export default {
                 addTimes: [],
                 remarks: ''
             },
+            voidId: undefined,
             reasonForm: {
                 desc: ''
             },
@@ -1046,6 +1093,12 @@ export default {
                     { min: 5, max: 100, message: '请输入5-100个字符', trigger: 'blur' },
                 ]
             },
+            reasonRulesVoid:{
+                desc: [
+                    {required: true, message: '请输入推送作废理由', trigger: 'blur'},
+                    { min: 5, max: 100, message: '请输入5-100个字符', trigger: 'blur' },
+                ]
+            },
             dataSource: [],
             okType:3,
             columns: [
@@ -1166,6 +1219,13 @@ export default {
                     scopedSlots: {customRender: 'legalAffairsContent'}
                 },
                 {
+                    title: '作废理由',
+                    align: 'center',
+                    dataIndex: 'delReason',
+                    width: 200,
+                    scopedSlots: {customRender: 'delReason'}
+                },
+                {
                     title: '备注',
                     align: 'center',
                     dataIndex: 'remarks',
@@ -1255,6 +1315,7 @@ export default {
                 }
             },
             toLeaderVisible: false,
+            exportLoading: false
         };
     },
     created() {
@@ -1267,6 +1328,42 @@ export default {
     },
     methods: {
         ...mapGetters(['userInfo']),
+        exportPolicy(){
+
+            this.exportLoading = true;
+            const paramsData = {
+                userId: this.userInfo().id,
+                companyName: this.configForm.companyName,
+                advertiserName: this.configForm.adverName,
+                productName: this.configForm.productName,
+                mediaType: this.configForm.creativeMedia === 'no' ? '' : this.configForm.creativeMedia,
+                rebateType: this.configForm.creativeRebate === 'no' ? '' : this.configForm.creativeRebate,
+                dianPayCompanyName: this.configForm.creativeAdvance,
+                saleId: this.configForm.creativeSale === 'no' ? '' : this.configForm.creativeSale,
+                promotionType: this.configForm.creativeOperate === 'no' ? '' : this.configForm.creativeOperate,
+                approvedStatus: this.configForm.searchStatus === 'no' ? '' : this.configForm.searchStatus,
+                startTime: this.configForm.time[0],
+                endTime: this.configForm.time[1],
+                pageNo: this.tablePag.page,
+                pageSize: this.tablePag.size
+            };
+            downFile(urlAcount + '/finance/cwjsPolicyInfo/list', paramsData).then(res => {
+                    // console.log(res)
+                    this.exportLoading=false;
+                    let blob = new Blob([res], {
+                        type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
+                    })
+                    // console.log(blob)
+                    let downloadElement = document.createElement('a')
+                    let href = window.URL.createObjectURL(blob) //创建下载的链接
+                    downloadElement.href = href
+                    downloadElement.download = '销售政策列表'+'.xlsx'    //下载后文件名
+                    document.body.appendChild(downloadElement)
+                    downloadElement.click() //点击下载
+                    document.body.removeChild(downloadElement) //下载完成移除元素
+                    window.URL.revokeObjectURL(href) //释放掉blob对象
+                })
+        },
         moment,
         toLeader () {
             // this.queryByIdList
@@ -1724,6 +1821,11 @@ export default {
             };
             this.handleInitTable();
         },
+        //作废操作
+        handleVoid(list){
+            this.voidOperationStatus = true
+            this.voidId = list.id
+        },
         // 编辑按钮操作
         handleEditTable(list) {
             this.addType = 'edit';
@@ -1856,6 +1958,36 @@ export default {
             });
         },
         //领导审核理由
+        handleVoidOk() {
+            this.$refs.rejectRuleForm.validate(valid => {
+                if (valid) {
+                    const params = {
+                        policyId: this.voidId,
+                        delReason: this.reasonForm.desc
+                    };
+                    
+                    getAction(urlAcount + '/finance/cwjsPolicyInfo/toVoidpolicy', params).then(result => {
+                        if (result.code === 0) {
+                            
+                            this.voidOperationStatus = false
+                            this.reasonForm.desc = undefined
+                            this.handleInitTable()
+                        }
+                        else {
+                           this.$message.error(result.message)
+                        }
+                    }).catch(error => {
+                        console.log(error, 'eeee');
+                    }).finally(() => {
+                        this.voidOperationStatus = false;
+                    });
+                }
+                else {
+                    return false;
+                }
+            });
+        },
+        //领导审核理由
         handleLeader() {
             this.$refs.rejectRuleForm.validate(valid => {
                 if (valid) {