工作小记录

<div id="salesSeal" class="self_bg">
    <div class="contract_query">
        <!-- <span>用印申请状态:</span> -->
        <span style="padding: 15px 15px 5px 15px;display: inline-block;">用印申请状态 :</span>
        <a-button-group>
            <a-button :class="{active:filterContractStatus === item.printingApplyStatus}"
                v-for="(item,index) in statusList" :key="index" @click="filterStatus(item.printingApplyStatus, index)">
                {{item.name}}({{item.counts}})
            </a-button>
        </a-button-group>
        <!-- <div class="status_item" v-for="(item,index) in statusList" :key="index"
                :class="{active:filterContractStatus === item.printingApplyStatus}"
                @click="filterStatus(item.printingApplyStatus, index)">{{item.name}}({{item.counts}})</div> -->
        <!-- <a-button type="primary" icon="search" class="query_btn" @click="toggleQuery" /> -->
        <!-- <div class="line_dashed" v-if="showMore"></div> -->
        <div class="query" v-if="showMore">
            <div class="w200  mb8 query_item">
                <label>用印申请编号</label></br>
                <a-input placeholder="请输入用印申请编号" v-model="queryParams.printingApplyNum" class="full_width" />
            </div>
            <div class="w200  mb8 query_item">
                <label>合同编号</label></br>
                <a-input placeholder="请输入合同编号" v-model="queryParams.printingContractNum" class="full_width" />
            </div>
            <div class="w200  mb8 query_item">
                <label>合同签报号</label></br>
                <a-input placeholder="请输入合同签报号" v-model="queryParams.signNum" class="full_width" />
            </div>
            <!-- <div class="w200  mb8 query_item">
                <label>合同名称</label></br>
                <a-input placeholder="请输入合同名称" v-model="queryParams.contractName" class="full_width" />
            </div> -->
            <div class="w200  mb8 query_item">
                <label>签约业务条线</label></br>
                <a-select placeholder="请选择" v-model="queryParams.businessLineCode" class="full_width"
                    @change="changeBusinessLine">
                    <a-select-option value="">全部</a-select-option>
                    <a-select-option v-for="(item,index) in buLineList" :value="item.lineCode" :key="index">
                        {{item.lineName}}
                    </a-select-option>
                </a-select>
            </div>
            <!-- <div class="w200  mb8 query_item">
                <label>签约子条线</label></br>
                <a-select placeholder="请选择" v-model="queryParams.subLineCode" class="full_width"
                    :disabled="!queryParams.businessLineName">
                    <a-select-option value="">全部</a-select-option>
                    <a-select-option v-for="(item,index) in subLineList" :value="item.lineCode" :key="index">
                        {{item.lineName}}
                    </a-select-option>
                </a-select>
            </div> -->
            <div class="w200  mb8 query_item">
                <label>交易我方主体名称</label></br>
                <a-select placeholder="请输入主体名称" showSearch :showArrow="false" :filterOption="false" @search="fetchTN"
                    v-model="queryParams.legalSubjectNum" class="full_width">
                    <a-spin v-if="fetching1" slot="notFoundContent" size="small" />
                    <a-select-option v-for="(item,index) in tranList" :value="item.companySectionCode" :key="index">
                        {{item.legalPersonSubjectName}}
                    </a-select-option>
                </a-select>
            </div>
            <div class="w200  mb8 query_item">
                <label>客户名称</label></br>
                <a-select placeholder="请输入客户名称" showSearch :showArrow="false" :filterOption="false" @search="fetchCN"
                    v-model="queryParams.orgCode" class="full_width">
                    <a-spin v-if="fetching2" slot="notFoundContent" size="small" />
                    <a-select-option v-for="(item,index) in cusList" :value="item.customerCode" :key="index">
                        {{item.customerName}}
                    </a-select-option>
                </a-select>
            </div>
            <div class="w200  mb8 query_item">
                <label>创建人</label></br>
                <a-select placeholder="请输入创建人" showSearch :showArrow="false" :filterOption="false"
                    @search="fetchUM($event,'createBylist')" v-model="queryParams.createBy" class="full_width">
                    <a-spin v-if="createByLoading" slot="notFoundContent" size="small" />
                    <a-select-option v-for="(item,index) in createBylist" :value="item.userUM" :key="index">
                        {{item.userName}}
                    </a-select-option>
                </a-select>
            </div>
            <div v-if="showMore" style="height: 29px;" class="mr24 mb8">
                <a-button type="primary" class="mr16 com-btn" @click="handleSearch" v-if="authority(35)">查询
                </a-button>
                <a-button class="mr16 com-btn reset-btn" @click="handleReset" v-if="authority(35)">重置</a-button>
                <a-button style="color: #2c3e50;" type="link" class="query_btn dropdown" @click="toggleQuery">收起查询条件
                    <a-icon :type="isdown" />
                </a-button>
            </div>
            <!-- <div class="mr24 mb8">
                <a-button type="primary" class="mr16" @click="handleSearch" v-if="authority(35)">查询</a-button>
                <a-button class="mr16" @click="handleReset" v-if="authority(35)">重置</a-button>
            </div> -->
        </div>
        <div v-if="!showMore" style="margin:10px 0 0 6px">
            <a-button style="color: #2c3e50;margin-right: 15px;" type="link" class="query_btn dropdown"
                @click="toggleQuery">展开查询条件
                <a-icon :type="isdown" />
            </a-button>
        </div>
    </div>
    <!-- 查询条件 -->
    <div class="contract_list">
        <div class="btn_group" style="display: flex; flex-direction: row; justify-content: space-between;">
            <span style="font-weight: 700;padding-top: 5px;">用印申请列表</span>
        </div>

        <!-- 列表 -->
        <a-table size="middle" :rowKey="record => record.index" :columns="columns" :rowClassName="getRowClassName"
            :dataSource="dataSource" :scroll="{ x: 2650 }" :pagination="false" :loading="loader">
            <!-- 悬浮提示tooltip -->
            <template v-for="(item,index) in tooltipArr" :slot="item" slot-scope="text, record">
                <a-tooltip placement="topLeft" :title="text">
                    <a v-if="item==='printingApplyNum'" @click="handleCreate(record)">{{text}}</a>
                    <span v-else-if="item==='index'" style="display: inline-block;width: 60px;">
                        {{text}}
                    </span>
                    <span v-else-if="item==='contractStartDate'|| 'contractEndDate'"
                        style="display: inline-block;width: 200px;overflow: hidden;text-overflow: ellipsis; white-space: nowrap;">
                        {{text}}
                    </span>
                    <span v-else>{{text}}</span>
                </a-tooltip>
            </template>
            <template slot="operation" slot-scope="text, record">
                <a class="mr16" @click="handleCreate(record)" v-if="authority(38)">查看详情</a>
                <!-- <a class="mr16" @click="handleOn(record)" v-if="authority(38)">下一步</a> -->
                <!-- <a @click="copy(record)" v-if="authority(38)">合同复制</a> -->
            </template>
        </a-table>

        <!-- 查看详情跳转用印合同类型选择-->
        <a-modal title="用印合同类型选择" :visible="showAdd" :footer="null" width="60%" @cancel="closeAdd" class="add_model">
            <a-spin :spinning="inloading" class="">
                <div v-if="this.secondLevelCode=='2004'" class="type_list">
                    <div v-for="item in contractTypeList" class="type_item">
                        <div class="item_tit" v-if="item.title">
                            <span>{{item.title}}</span>
                            <a-popover placement="right" :overlayStyle="{ width:'450px', fontSize:'12px' }">
                                <template slot="content">
                                    <div v-if="['2001','2002','2003'].includes(item.codeS)">
                                        <!-- <span style="color: #1890ff;">二级类型:</span> -->
                                        <!-- 二级类型,战略协议/合作协议/框架协议为没有履约实质,不能创建收入信息ID的合同,也不能直接用于发票和收入确认的协议,可以关联相关业务合同。 -->
                                        战略协议:指有合作意向,不涉及具体交付内容和金额的协议。</br>
                                        合作协议:规定明确的合作内容,但是不会产生实际支出的协议。</br>
                                        框架协议:约定具体的交付范围和责任义务,每个业务具体的数量或金额通过后续补充协议方式明确,具体履约以业务合同管理。
                                    </div>
                                    <div v-if="item.codeS==='2004'">
                                        <!-- <span style="color: #1890ff;">二级类型:</span> -->
                                        <!-- 二级类型,战略协议/合作协议/框架协议为没有履约实质,不能创建收入信息ID的合同,也不能直接用于发票和收入确认的协议,可以关联相关业务合同。 -->
                                        约定具体的交付范围和责任义务,会产生实际费用支出的合同。
                                    </div>
                                    <div v-if="item.codeS==='2005'">
                                        <!-- <span style="color: #1890ff;">二级类型:</span> -->
                                        <!-- 二级类型,战略协议/合作协议/框架协议为没有履约实质,不能创建收入信息ID的合同,也不能直接用于发票和收入确认的协议,可以关联相关业务合同。 -->
                                        约定具体的交付范围和责任义务,会产生实际费用支出,但因特殊原因未签订线下用印的合同。
                                    </div>
                                </template>
                                <a-icon type="question-circle" theme="twoTone" twoToneColor='#ff6700'
                                    style="font-size: 12px;vertical-align: baseline;margin-left: 5px;" />
                            </a-popover>

                            <!-- <span class="item_tip">描述描述</span> -->
                        </div>
                        <div class="item_con">
                            <div>
                                <a-icon :type="item.icon" theme="filled" style="font-size:22px;color:#1890ff;" />
                            </div>
                            <div class="item_name">{{item.name}}</div>
                            <a-button type="primary" size="small" class="btn" @click="addContract(item)">新建</a-button>
                        </div>
                    </div>
                </div>
                <div v-else-if="this.secondLevelCode=='2001'" class="type_list">
                    <div v-for="item in contractTypeListz" class="type_item">
                        <div class="item_tit" v-if="item.title">
                            <span>{{item.title}}</span>
                            <a-popover placement="right" :overlayStyle="{ width:'450px', fontSize:'12px' }">
                                <template slot="content">
                                    <div v-if="['2001','2002','2003'].includes(item.codeS)">
                                        <!-- <span style="color: #1890ff;">二级类型:</span> -->
                                        <!-- 二级类型,战略协议/合作协议/框架协议为没有履约实质,不能创建收入信息ID的合同,也不能直接用于发票和收入确认的协议,可以关联相关业务合同。 -->
                                        战略协议:指有合作意向,不涉及具体交付内容和金额的协议。</br>
                                    </div>
                                    <div v-if="item.codeS==='2004'">
                                        <!-- <span style="color: #1890ff;">二级类型:</span> -->
                                        <!-- 二级类型,战略协议/合作协议/框架协议为没有履约实质,不能创建收入信息ID的合同,也不能直接用于发票和收入确认的协议,可以关联相关业务合同。 -->
                                        约定具体的交付范围和责任义务,会产生实际费用支出的合同。
                                    </div>
                                    <div v-if="item.codeS==='2005'">
                                        <!-- <span style="color: #1890ff;">二级类型:</span> -->
                                        <!-- 二级类型,战略协议/合作协议/框架协议为没有履约实质,不能创建收入信息ID的合同,也不能直接用于发票和收入确认的协议,可以关联相关业务合同。 -->
                                        约定具体的交付范围和责任义务,会产生实际费用支出,但因特殊原因未签订线下用印的合同。
                                    </div>
                                </template>
                                <a-icon type="question-circle" theme="twoTone" twoToneColor='#ff6700'
                                    style="font-size: 12px;vertical-align: baseline;margin-left: 5px;" />
                            </a-popover>

                            <!-- <span class="item_tip">描述描述</span> -->
                        </div>
                        <div class="item_con">
                            <div>
                                <a-icon :type="item.icon" theme="filled" style="font-size:22px;color:#1890ff;" />
                            </div>
                            <div class="item_name">{{item.name}}</div>
                            <a-button type="primary" size="small" class="btn" @click="addContract(item)">新建</a-button>
                        </div>
                    </div>
                </div>
                <div v-else-if="this.secondLevelCode=='2002'" class="type_list">
                    <div v-for="item in contractTypeListk" class="type_item">
                        <div class="item_tit" v-if="item.title">
                            <span>{{item.title}}</span>
                            <a-popover placement="right" :overlayStyle="{ width:'450px', fontSize:'12px' }">
                                <template slot="content">
                                    <div v-if="['2001','2002','2003'].includes(item.codeS)">
                                        <!-- <span style="color: #1890ff;">二级类型:</span> -->
                                        <!-- 二级类型,战略协议/合作协议/框架协议为没有履约实质,不能创建收入信息ID的合同,也不能直接用于发票和收入确认的协议,可以关联相关业务合同。 -->
                                        框架协议:约定具体的交付范围和责任义务,每个业务具体的数量或金额通过后续补充协议方式明确,具体履约以业务合同管理。
                                    </div>
                                    <div v-if="item.codeS==='2004'">
                                        <!-- <span style="color: #1890ff;">二级类型:</span> -->
                                        <!-- 二级类型,战略协议/合作协议/框架协议为没有履约实质,不能创建收入信息ID的合同,也不能直接用于发票和收入确认的协议,可以关联相关业务合同。 -->
                                        约定具体的交付范围和责任义务,会产生实际费用支出的合同。
                                    </div>
                                    <div v-if="item.codeS==='2005'">
                                        <!-- <span style="color: #1890ff;">二级类型:</span> -->
                                        <!-- 二级类型,战略协议/合作协议/框架协议为没有履约实质,不能创建收入信息ID的合同,也不能直接用于发票和收入确认的协议,可以关联相关业务合同。 -->
                                        约定具体的交付范围和责任义务,会产生实际费用支出,但因特殊原因未签订线下用印的合同。
                                    </div>
                                </template>
                                <a-icon type="question-circle" theme="twoTone" twoToneColor='#ff6700'
                                    style="font-size: 12px;vertical-align: baseline;margin-left: 5px;" />
                            </a-popover>

                            <!-- <span class="item_tip">描述描述</span> -->
                        </div>
                        <div class="item_con">
                            <div>
                                <a-icon :type="item.icon" theme="filled" style="font-size:22px;color:#1890ff;" />
                            </div>
                            <div class="item_name">{{item.name}}</div>
                            <a-button type="primary" size="small" class="btn" @click="addContract(item)">新建</a-button>
                        </div>
                    </div>
                </div>
                <div v-else-if="this.secondLevelCode=='2003'" class="type_list">
                    <div v-for="item in contractTypeListh" class="type_item">
                        <div class="item_tit" v-if="item.title">
                            <span>{{item.title}}</span>
                            <a-popover placement="right" :overlayStyle="{ width:'450px', fontSize:'12px' }">
                                <template slot="content">
                                    <div v-if="['2001','2002','2003'].includes(item.codeS)">
                                        <!-- <span style="color: #1890ff;">二级类型:</span> -->
                                        <!-- 二级类型,战略协议/合作协议/框架协议为没有履约实质,不能创建收入信息ID的合同,也不能直接用于发票和收入确认的协议,可以关联相关业务合同。 -->
                                        合作协议:规定明确的合作内容,但是不会产生实际支出的协议。</br>
                                    </div>
                                    <div v-if="item.codeS==='2004'">
                                        <!-- <span style="color: #1890ff;">二级类型:</span> -->
                                        <!-- 二级类型,战略协议/合作协议/框架协议为没有履约实质,不能创建收入信息ID的合同,也不能直接用于发票和收入确认的协议,可以关联相关业务合同。 -->
                                        约定具体的交付范围和责任义务,会产生实际费用支出的合同。
                                    </div>
                                    <div v-if="item.codeS==='2005'">
                                        <!-- <span style="color: #1890ff;">二级类型:</span> -->
                                        <!-- 二级类型,战略协议/合作协议/框架协议为没有履约实质,不能创建收入信息ID的合同,也不能直接用于发票和收入确认的协议,可以关联相关业务合同。 -->
                                        约定具体的交付范围和责任义务,会产生实际费用支出,但因特殊原因未签订线下用印的合同。
                                    </div>
                                </template>
                                <a-icon type="question-circle" theme="twoTone" twoToneColor='#ff6700'
                                    style="font-size: 12px;vertical-align: baseline;margin-left: 5px;" />
                            </a-popover>

                            <!-- <span class="item_tip">描述描述</span> -->
                        </div>
                        <div class="item_con">
                            <div>
                                <a-icon :type="item.icon" theme="filled" style="font-size:22px;color:#1890ff;" />
                            </div>
                            <div class="item_name">{{item.name}}</div>
                            <a-button type="primary" size="small" class="btn" @click="addContract(item)">新建</a-button>
                        </div>
                    </div>
                </div>
            </a-spin>
        </a-modal>


        <!-- 分页组件 -->
        <a-pagination class="pagination" size="small" :pageSizeOptions="['10', '20', '50', '100']" :pageSize="pageSize"
            :total="total" v-model="currentPage" :showTotal="setPageInfo" @change="onPageChange"
            @showSizeChange="onPageSizeChange" showSizeChanger>
        </a-pagination>
    </div>
</div>

import { mapState, mapActions, mapMutations, mapGetters } from 'vuex'
import axios from 'axios'
import { authority } from '@/utils/auth'
import { getRowClassName } from '@/utils'
import { printingSealApply, getLegalSubject, getCRM, consistencyPush, importContract, lisenceImport, addPrintingContract } from '@/api/contractManList'
import { getLoginUrl } from '@/api/performance'
import { getUmData } from '@/api/chainConfig'
import debounce from 'lodash/debounce'
import { removeUserInfo } from '@/utils/auth'
import { COMMON_URL } from '@/config'

const columns = [
	{
		title: '序号',
		dataIndex: 'index',
		align: 'center',
		scopedSlots: {
			customRender: 'index'
		},
		width: '80px'
	},
	{
		title: '用印申请编号',
		dataIndex: 'printingApplyNum',
		scopedSlots: {
			customRender: 'printingApplyNum'
		},
		width: '180px'
	},
	{
		title: '状态',
		dataIndex: 'printingApplyStatus',
		scopedSlots: {
			customRender: 'printingApplyStatus'
		},
		width: '100px'
	},
	{
		title: '合同编号',
		dataIndex: 'printingContractNum',
		scopedSlots: {
			customRender: 'printingContractNum'
		},
		width: '180px'
	},
	{
		title: '合同类型',
		dataIndex: 'showType',
		scopedSlots: {
			customRender: 'showType'
		},
		width: '180px'
	},
	{
		title: '合同签报号',
		dataIndex: 'signNum',
		scopedSlots: {
			customRender: 'signNum'
		},
		width: '180px'
	},
	{
		title: '交易我方主体名称',
		dataIndex: 'legalSubjectNameTotal',
		scopedSlots: {
			customRender: 'legalSubjectNameTotal'
		},
		width: '200px'
	},
	{
		title: '客户名称',
		dataIndex: 'orgName',
		scopedSlots: {
			customRender: 'orgName'
		},
		width: '200px'
	},
	{
		title: '签约业务条线',
		dataIndex: 'businessLineName',
		scopedSlots: {
			customRender: 'businessLineName'
		},
		width: '150px'
	},
	{
		title: '签约部门',
		dataIndex: 'signDepartment',
		scopedSlots: {
			customRender: 'signDepartment'
		},
		width: '150px'
	},
	{
		title: '创建人',
		dataIndex: 'createBy',
		scopedSlots: {
			customRender: 'createBy'
		},
		width: '150px'
	},
	{
		title: '创建时间',
		dataIndex: 'createdDate',
		scopedSlots: {
			customRender: 'createdDate'
		},
		width: '150px'
	},
	{
		title: '更新时间',
		dataIndex: 'updatedDate',
		scopedSlots: {
			customRender: 'updatedDate'
		},
		width: '150px'
	},
	{
		title: '有效时间',
		dataIndex: 'validDate',
		scopedSlots: {
			customRender: 'validDate'
		},
		width: '150px'
	},
	{
		title: '操作',
		dataIndex: 'operation',
		fixed: 'right',
		scopedSlots: {
			customRender: 'operation'
		},
		width: '100px'
	}
]
const tooltipArr = ['index', 'printingApplyNum', 'printingApplyStatus', 'printingContractNum', 'showType', 'signNum', 'legalSubjectNameTotal', 'orgName', 'contractStartDate', 'signDepartment', 'contractStartDate', 'subLineName', 'createBy', 'createdDate', 'updatedDate', 'validDate', 'operation']
const statusMap = {
	'1': '草稿',
	'2': '已失效',
	'3': '已提交至印章系统',
	'4': '审核中',
	'5': '待处理',
	'6': '已作废',
	'7': '审核终止',
	'8': '审核通过',
	'9': '履约中'
}
const dataResourceList = {
	CP: '创配',
	CMS: '合同管理系统'
}
const contractTypeListz = [
	{
		codeS: '2001',
		codeT: '3001',
		title: '战略协议',
		icon: 'flag',
		name: '战略协议'
	}
]
const contractTypeListk = [
	{
		codeS: '2002',
		codeT: '3002',
		title: '框架协议',
		icon: 'flag',
		name: '框架协议'
	}
]
const contractTypeListh = [
	{
		codeS: '2003',
		codeT: '3003',
		title: '合作协议',
		icon: 'flag',
		name: '合作协议'
	}
]
const contractTypeList = [
	// {
	// 	codeS: '2001',
	// 	codeT: '3001',
	// 	title: '协议合同',
	// 	icon: 'flag',
	// 	name: '战略协议'
	// },
	// {
	// 	codeS: '2002',
	// 	codeT: '3002',
	// 	title: '',
	// 	icon: 'read',
	// 	name: '框架协议'
	// },
	// {
	// 	codeS: '2003',
	// 	codeT: '3003',
	// 	title: '',
	// 	icon: 'contacts',
	// 	name: '合作协议'
	// },
	{
		codeS: '2004',
		codeT: '3005',
		title: '业务合同',
		icon: 'pie-chart',
		name: '费率类合同'
	},
	{
		codeS: '2004',
		codeT: '3006',
		title: '',
		icon: 'profile',
		name: '开口类合同'
	},
	{
		codeS: '2004',
		codeT: '3004',
		title: '',
		icon: 'pay-circle',
		name: '固定额合同'
	}
	// {
	// 	codeS: '2005',
	// 	codeT: '3008',
	// 	title: '虚拟合同',
	// 	icon: 'pie-chart',
	// 	name: '费率类合同'
	// },
	// {
	// 	codeS: '2005',
	// 	codeT: '3009',
	// 	title: '',
	// 	icon: 'profile',
	// 	name: '开口类合同'
	// },
	// {
	// 	codeS: '2005',
	// 	codeT: '3007',
	// 	title: '',
	// 	icon: 'pay-circle',
	// 	name: '固定额合同'
	// }
]
export default {
	name: 'salesSeal',
	data() {
		this.fetchUM = debounce(this.fetchUM, 800)
		return {
			secondLevelCode: '', //采购用印的二级协议是多少
			contractTypeList,
			contractTypeListz,
			contractTypeListk,
			contractTypeListh,
			showAdd: false,
			inloading: false,
			down: 'down',
			isdown: 'down',
			placements: ['bottomCenter'],
			loading: false,
			updateLoading: false,
			contractLoading: false,
			lisenceLoading: false,
			visibleTest: false,
			visibleInput: false,
			submitloading: false,
			successNum: 0,
			failNum: 0,
			statusList: [],
			cusList: [], // 客户名称
			createList: [], //创建人
			// umList: [],
			currentPage: 1, // 当前页
			pageSize: 10,
			total: 0,
			columns,
			dataSource: [], // 列表源数据
			tooltipArr, // 悬浮列表内容
			loader: false,
			fetching1: false,
			fetching2: false,
			fetching3: false,
			tranList: [],
			queryParams: {
				// contractStatus: '',  // 状态
				printingApplyStatus: '', //用印申请状态
				legalSubjectNameTotal: '', // 我方主体名称
				printingApplyNum: '', //用印申请编号
				businessLineCode: '',
				legalSubjectNum: '',
				orgCode: '',
				createBy: '',
				contractName: '', //合同名称
				printingContractNum: '',
				signNum: '', //合同签报号
				// holderMan: '',
				// beginTime: '',
				// endTime: '',
				orgName: '' //客户名称
				// incomeInfoId: '',
			},
			query: {},
			date: [undefined, undefined],
			showMore: false,
			activeIndex: 0,
			totalNum: 0,
			filterContractStatus: '', // 状态
			accontUrl: '', // 跳转会计引擎登录url
			accontLoading: false,
			createByLoading: false, // 合同创建人loading
			holderManLoading: false, // 合同负责人loading
			holderManList: [],
			createBylist: [],
			applyId: ''
		}
	},
	computed: {
		...mapGetters('tagsView', ['visitedNames']),
		...mapGetters('assignRole', ['parentLineList']),
		...mapState('assignRole', ['buLineList']),
		subLineList() {
			let subLineList = []
			const businessLineCode = this.queryParams.businessLineCode
			if (businessLineCode) {
				this.buLineList &&
					this.buLineList.forEach(item => {
						if (businessLineCode == item.lineCode) {
							subLineList = item.children
						}
					})
			} else {
				this.$set(this.queryParams, 'subLineCode', '')
			}
			return subLineList
		}
	},
	mounted() {
		console.log('.........mounted')
		this.getBuLineList()
		this.handleReset()
		this.printingSealApply()
		// 	//  接收a页面传来的数据
		//   window.addEventListener('message',function(e){
		//       console.log(e.data.id)
		//   })
	},

	activated() {
		console.log('.........activated')
		this.getBuLineList()
		this.printingSealApply()
	},

	watch: {
		visitedNames(newVal, oldVal) {
			// 当页面关闭时,清空查询条件
			if (newVal && !newVal.includes('salesSeal')) {
				this.reset()
			}
		}
	},
	methods: {
		// 判断下拉菜单扽状态,从而判断icon的改变
		// 给c页面发送数据
		// handleOn() {
		// 	// var arr = {
		// 	// 	name: 'hhh',
		// 	// 	type: 2,
		// 	// 	id: 1
		// 	// }

		// 	this.$router.push({
		// 		name: 'salesSealDetail'
		// 	})
		// 	console.log('哈哈哈1111',this.$route)
		// 		// window.postMessage(arr, 'http://localhost:7777/#/home')
		// },
		authority,
		getRowClassName,
		...mapActions('assignRole', ['getBuLineList']),
		addContract(item) {
			if (this.inloading) return
			const param = {
				thirdLevelCode: item.codeT,
				thirdLevel: item.name,
				applyId: this.applyId
			}
			this.inloading = true
			addPrintingContract(param)
				.then(res => {
					this.inloading = false
					if (res && res.retCode === '000000') {
						this.showAdd = false
						this.$router.push({
							name: 'contractMark',
							query: {
								printingId: this.applyId,
								type: 'edit'
							}
						})
					}
				})
				.catch(err => {
					this.inloading = false
				})
		},
		// 	const res = await addPrintingContract(param)
		// 	if (res.data.retCode === '000000') {
		// 		this.$router.push({
		// 			name: 'salesSeal',
		// 			query: {
		// 				printingId: this.applyId,
		// 				type: 'edit'
		// 			}
		// 		})
		// 	}

		// },
		// addContract(item) {
		// 	if (this.inloading) return

		// 	const param = {
		// 		applyId:this.applyId
		// 	}
		// 	this.inloading = true
		// 	newContract(param)
		// 		.then(res => {
		// 			this.inloading = false
		// 			if (res && res.retCode === '000000') {
		// 				this.showAdd = false
		// 				this.$router.push({
		// 					name: 'salesSeal',
		// 					query: {
		// 						printingId: res.data.id,
		// 						type: 'edit'
		// 					}
		// 				})
		// 			}
		// 		})
		// 		.catch(err => {
		// 			this.inloading = false
		// 		})
		// },
		changeBusinessLine() {
			this.$set(this.queryParams, 'subLineCode', '')
		},
		getStatus(status) {
			return status ? statusMap[status] : ''
		},
		// UM 模糊搜索
		fetchUM(value, type) {
			if (!value) return
			const loadMap = {
				createBylist: 'createByLoading',
				holderManList: 'holderManLoading'
			}
			this[loadMap[type]] = true
			if (value) {
				getUmData({
					name: value
				})
					.then(res => {
						this[loadMap[type]] = false
						if (res.data && res.data.userUM && res.data.userName) {
							this[type].length = 0
							this[type].push(res.data)
						}
					})
					.catch(() => {
						this[loadMap[type]] = false
					})
			}
		},
		fetchCN(value) {
			this.cusList.length = 0
			this.fetching2 = true
			getCRM({
				customerName: value,
				pageSize: 50,
				customerCode: '',
				pageNum: 1
			})
				.then(res => {
					this.cusList = res.data.list
					this.fetching2 = false
				})
				.catch(() => {
					this.fetching2 = false
				})
		},

		// 交易我方主体名称 模糊搜索
		fetchTN(value) {
			this.tranList.length = 0
			this.fetching1 = true
			getLegalSubject({
				legalSubjectName: value
			})
				.then(res => {
					this.tranList = res.data
					this.fetching1 = false
				})
				.catch(() => {
					this.fetching1 = false
				})
		},

		onChangeDate(date, dateString) {
			this.queryParams.beginTime = dateString[0]
			this.queryParams.endTime = dateString[1]
		},
		filterStatus(status, index) {
			this.currentPage = 1
			// this.activeIndex = index;
			this.filterContractStatus = status
			this.printingSealApply()
		},
		printingSealApply() {
			const params = {
				currentPage: this.currentPage,
				pageSize: this.pageSize,
				printingApplyStatus: this.filterContractStatus,
				...this.query
			}
			this.loader = true
			printingSealApply(params)
				.then(res => {
					const { records, total } = res.data.contractInfoDto
					this.dataSource =
						(records &&
							records.length &&
							records.map((v, i) => {
								return {
									...v,
									showType: v.thirdLevel ? `${v.contractType}-${v.secondLevel}-${v.thirdLevel}` : `${v.contractType}-${v.secondLevel}`,
									index: i + 1 + (this.currentPage - 1) * this.pageSize,
									// contractStatus: this.getStatus(v.contractStatus),
									printingApplyStatus: this.getStatus(v.printingApplyStatus),
									dataResource: dataResourceList[v.dataResource]
								}
							})) ||
						[]
					this.total = total
					let totalNum = 0
					res.data.statisticsGroupList.forEach(item => {
						totalNum += Number(item.counts)
					})
					this.totalNum = totalNum

					this.loader = false
					// if(!params.contractStatus) {
					//     this.activeIndex = 0;
					// }
					const list = res.data.statisticsGroupList.map(item => {
						return {
							...item,
							// name: this.getStatus(item.contractStatus)
							name: this.getStatus(item.printingApplyStatus)
						}
					})
					list.unshift({
						// contractStatus: '',
						printingApplyStatus: '',
						name: '全部',
						counts: this.totalNum
					})
					this.statusList = list
					const codeList = list.map(item => {
						// return item.contractStatus
						return item.printingApplyStatus
					})
					// if(!total && param.contractStatus && !codeList.includes(param.contractStatus)) {
					// if (!total && params.contractStatus) {
					// 	this.filterStatus('')
					// }
					if (!total && params.printingApplyStatus) {
						this.filterStatus('')
					}
				})
				.catch(err => {
					this.loader = false
					this.dataSource = []
				})
		},
		toggleQuery() {
			this.showMore = !this.showMore
			this.showMore == true ? (this.isdown = 'up') : (this.isdown = 'down')
		},

		handleSearch() {
			this.currentPage = 1
			this.query = {}
			this.filterContractStatus = ''
			setTimeout(() => {
				const self = this
				console.log('ssss====>>>', self.queryParams)
				console.log('ssss====>>>', self.query)
				for (let key in self.queryParams) {
					const value = self.queryParams[key]
					if (value) {
						if (key == 'createBy' || key == 'signNum') {
							self.query[key] = value.toLocaleUpperCase()
						} else {
							self.query[key] = typeof value === 'string' ? value.trim() : value
						}
					}
				}
				self.printingSealApply()
			}, 200)
		},
		handleReset() {
			this.reset()
			this.printingSealApply()
		},
		reset() {
			this.currentPage = 1
			this.pageSize = 10
			this.filterContractStatus = ''
			this.queryParams = {
				// contractStatus: '',
				businessLineCode: '',
				subLineCode: '',
				legalSubjectNum: undefined,
				orgCode: undefined
			}
			this.query = {}
			this.date = [undefined, undefined]
		},
		// 查看详情新建用印合同类型选择
		handleCreate(record) {
			if (this.visitedNames.includes('contractMark')) {
				return this.$message.warning('请先完成已打开的销售合同用印信息页面的操作')
			}
			this.applyId = record.id
			// console.log(this.applyId)
			// && record.printingApplyStatus != statusMap['2']
			this.secondLevelCode = record.secondLevelCode
			console.log(record)
			console.log(this.type == '2004')
			console.log(record.thirdLevel)
			if (!record.showType.includes(record.thirdLevel) && record.printingApplyStatus != statusMap['2']) {
				this.showAdd = true
			} else {
				this.$router.push({
					name: 'contractMark',
					query: {
						printingId: record.id,
						type: 'edit'
					}
				})
			}
		},
		closeAdd() {
			this.showAdd = false
		},
		// downloadExcel(url) {
		// 	let obj = null
		// 	let response
		// 	fetch(url, {
		// 		method: 'get',
		// 		credentials: 'include',
		// 		headers: {
		// 			'Content-type': 'application/json'
		// 		}
		// 	})
		// 		.then(res => {
		// 			response = res
		// 			obj = res.clone().blob()
		// 			return res.clone().json()
		// 		})
		// 		.then(message => {
		// 			this.$message.error(message.retMessage)
		// 			this.loading = false
		// 		})
		// 		.catch(error => {
		// 			obj.then(blob => {
		// 				const url = window.URL.createObjectURL(blob)
		// 				// 创建下载的链接
		// 				const downloadElement = document.createElement('a')
		// 				downloadElement.style.display = 'none'
		// 				downloadElement.href = url
		// 				downloadElement.download = decodeURI(response.headers.get('filename'))
		// 				document.body.appendChild(downloadElement)
		// 				downloadElement.click()
		// 				// 下载完成移除元素,释放掉blob对象
		// 				document.body.removeChild(downloadElement)
		// 				window.URL.revokeObjectURL(url)
		// 				this.loading = false
		// 			})
		// 		})
		// },
		// updateInfo() {
		// 	this.updateLoading = true
		// 	consistencyPush()
		// 		.then(res => {
		// 			if (res.retCode === '000000') {
		// 				this.$message.success(res.retMessage)
		// 			} else {
		// 				this.$message.error(res.retMessage)
		// 			}
		// 			this.updateLoading = false
		// 		})
		// 		.catch(error => {
		// 			this.updateLoading = false
		// 			console.log(error)
		// 		})
		// },
		// //下载错误信息
		// downloadText() {
		// 	// to DO 授权下载错误信息接口
		// 	let url = this.importType === 'contract' ? '/cms/api/v1/contractReadIn/downloadFailExcel' : '/cms/api/v1/sale/contract/auth/readIn/downloadFailExcel'
		// 	this.downloadExcel(url)
		// },
		// async handleOk() {
		// 	this.submitloading = true
		// 	try {
		// 		let res
		// 		if (this.importType === 'contract') {
		// 			res = await importContract()
		// 		} else {
		// 			res = await lisenceImport()
		// 		}
		// 		if (res.retCode === '000000') {
		// 			this.$message.success(res.retMessage)
		// 		} else if (res.retCode == '300050') {
		// 			let a = res.retMessage.replace(/\\n/gim, '<br>')
		// 			let arr = a.split('<br>')
		// 			this.$message.warning(this.renderStr(arr))
		// 			this.submitloading = false
		// 			this.visibleInput = false
		// 			this.getList()
		// 			return
		// 		} else {
		// 			this.$message.error(res.retMessage)
		// 		}
		// 		this.submitloading = false
		// 		this.visibleInput = false
		// 		this.getList()
		// 	} catch (error) {
		// 		this.submitloading = false
		// 		this.visibleInput = false
		// 	}
		// },
		// handleCancel() {
		// 	this.visibleInput = false
		// },
		// contractInput(data) {
		// 	// 合同导入
		// 	const url = '/cms/api/v1/contractReadIn/readInContracts'
		// 	this.importType = 'contract'
		// 	this.dataInput(data, url, 'contractLoading')
		// },
		// lisenceInput(data) {
		// 	// 批量授权导入
		// 	const url = '/cms/api/v1/sale/contract/auth/readIn/checkExcel'
		// 	this.importType = 'lisence'
		// 	this.dataInput(data, url, 'lisenceLoading')
		// },
		// 设置messgae提示时候换行函数
		// renderStr(arr) {
		// 	let good = []
		// 	arr.forEach(function(item, index) {
		// 		if (index == 0) {
		// 			good.push(<span>{item}</span>)
		// 		} else {
		// 			good.push(<div>{item}</div>)
		// 		}
		// 	})
		// 	return good
		// },
		//导入合同
		// dataInput(data, url, loadingType) {
		// 	this[loadingType] = true
		// 	this.visibleTest = true
		// 	const formData = new FormData()
		// 	const file = data.file
		// 	formData.append('file', file)
		// 	axios
		// 		.create({
		// 			withCredentials: true
		// 		})
		// 		.post(url, formData)
		// 		.then(res => {
		// 			const { data, retCode, retMessage } = res.data
		// 			console.log(retCode, 11111)
		// 			if (retCode === '000000') {
		// 				// this.$message.success(retMessage)
		// 				this.successNum = data.successNum
		// 				this.failNum = data.failNum
		// 				this.visibleTest = false
		// 				this[loadingType] = false
		// 				this.visibleInput = true
		// 			} else {
		// 				this[loadingType] = false
		// 				this.visibleTest = false
		// 				this.$message.error(retMessage)
		// 				if (retCode === '000006' || retCode === '000005') {
		// 					removeUserInfo()
		// 					location.href = COMMON_URL.logOut
		// 					return
		// 				}
		// 			}
		// 		})
		// 		.catch(err => {
		// 			this.visibleTest = false
		// 			this[loadingType] = false
		// 			if (err.response && (err.response.status == '308' || err.response.status == '302')) {
		// 				this.$message.error('登录态失效,请重新登录')
		// 				removeUserInfo()
		// 				window.location = COMMON_URL.logOut
		// 				return
		// 			} else {
		// 				this.$message.error('服务器开小差了~')
		// 			}
		// 		})
		// },

		// dataDownload(url) {
		// 	// let url = '/cms/api/v1/contractReadIn/downloadTemplate'
		// 	this.downloadExcel(url)
		// },
		handleView(records) {
			const hasAuthority = this.authority(38)
			if (!hasAuthority) {
				return this.$message.warning('未配置该合同查看详情的权限!')
			}
			console.log(records)
			// if (this.visitedNames.includes('contractInfo')) {
			// 	return this.$message.warning('请先完成已打开的销售合同的新增或查看详情页面的操作')
			// }
			this.$store.commit('contractAdd/SET_PREKEY', 'basic')
			this.$router.push({
				// name: 'contractMan_add',
				name: 'contractInfo',
				query: {
					contractId: records.id,
					type: 'edit'
				}
			})
		},
		// copy() {
		// 	this.$confirm({
		// 		title: '是否复制当前选择的合同?',
		// 		okText: '确认',
		// 		cancelText: '否',
		// 		onOk: () => {
		// 			this.getList()
		// 		}
		// 	})
		// },
		// async toAccoun() {  // 批量开票 跳转会计引擎登录页面
		//     if(this.accontLoading) return false;
		//     this.accontLoading = true;
		//     let accontUrl = ''
		//     try {
		//         const res = await getLoginUrl();
		//         this.accontLoading = false;
		//         if(res && res.retCode === '000000' && res.data) {
		//             accontUrl = res.data;
		//         }
		//     } catch (error) {
		//         this.accontLoading = false;
		//     }
		//     this.accontUrl = accontUrl
		//     window.open(this.accontUrl, '_blank')
		// },

		// 分页
		setPageInfo(total, range, size) {
			var totalPage = parseInt(this.total) / parseInt(this.pageSize)
			return `共 ${total} 条, ${Math.ceil(totalPage)} 页`
		},
		onPageChange(current, pageSize) {
			this.currentPage = current
			this.printingSealApply()
		},
		onPageSizeChange(current, pageSize) {
			this.currentPage = 1
			this.pageSize = pageSize
			this.printingSealApply()
		}
	}
}


<style lang="less">
#salesSeal {
    width: 100%;
    background: transparent;
    .contract_query {
      width: 100%;
      background: #fff;
      // margin-bottom: 8px;
      // padding-bottom: 8px;
      .ant-btn {
        height: 30px;
      }
      .status_filter {
        // padding: 0 16px;
        display: flex;
        align-items: center;
        flex-wrap: wrap;
        .status_item {
          padding: 2px 6px;
          margin-right: 8px;
          background: #9e9e9e54;
          opacity: 0.6;
          margin-bottom: 6px;
          margin-top: 6px;
          cursor: pointer;
          &.active {
            background: #1890ff;
            color: #fff;
            opacity: 1;
          }
          // &:first-child {
          //     margin-right: 0px;
          // }
        }
        .query_btn {
          margin-left: 10px;
          border-radius: 20px;
        }
      }
      .line_dashed {
        width: 100%;
        height: 1px;
        background-image: linear-gradient(90deg, #ccc 0, #ccc 50%, transparent 0);
        background-size: 18px 1px;
        background-repeat: repeat-x;
        margin: 8px 0;
      }
      .query {
        margin-top: 10px;
        padding-left: 16px;
        display: flex;
        flex-wrap: wrap;
        align-items: flex-end;
        .query_item {
          width: 22%;
          max-width: 300px;
          margin-right: 15px;
          .full_width {
            width: 100%;
          }
        }
      }
    }
    .contract_list {
      padding: 8px 16px 0;
      background: #fff;
      .btn_group {
        margin-bottom: 8px;
        margin-top: 8px;
        height: 30px;
        .ant-btn {
          height: 30px;
        }
      }
    }
  
    .activeClass {
      color: #1890ff;
    }
  
    .ant-table-tbody > tr > td {
      min-width: 90px;
      max-width: 150px;
    }
  }
  .ant-modal-footer {
    text-align: center;
  }
  
  .type_list {
    width: 100%;
    // position: relative;
    // .load {
    //     position: absolute;
    //     left: 50%;
    //     top: 50%;
    //     transform: translate(-50%, -50%);
    // }
    .type_item {
      display: inline-block;
      width: 31%;
      margin-bottom: 40px;
      &:nth-child(3n-1) {
        margin: 0 3%;
      }
      .item_tit {
        height: 30px;
        line-height: 20px;
        font-size: 16px;
        font-weight: 500;
        color: #807b7b;
        .item_tip {
          font-size: 12px;
          margin-left: 10px;
        }
      }
      .item_con {
        display: flex;
        align-items: center;
        height: 90px;
        border: 2px solid #9e9e9e4f;
        border-radius: 6px;
        padding: 0 16px;
        justify-content: space-between;
        .item_name {
          font-weight: 500;
          font-size: 15px;
        }
        .btn {
          // display: none;
          height: 32px;
          padding: 0 8px;
          visibility: hidden;
        }
        &:hover {
          border-color: #1890ff;
          .item_name {
            color: #1890ff;
          }
          .btn {
            visibility: visible;
          }
        }
        // &:hover .btn {
        //     // display: block;;
        //     visibility: visible;
        // }
        // &>div:nth-child(2) {
        //     margin: 0 16px 0 10px;
        // }
      }
    }
  }
  .add_model {
    max-width: 1000px;
    .ant-modal-content {
      min-height: 240px;
      // height: 100%;
      // min-height: 460px;
      .ant-modal-body {
        position: relative;
        .load {
          position: absolute;
          left: 50%;
          top: 50%;
          transform: translate(-50%, -50%);
        }
      }
    }
  }
  #components-dropdown-demo-placement .ant-btn {
    margin-right: 8px;
    margin-bottom: 8px;
  }
  .dropdown {
    svg {
      width: 10px;
    }
  }
  
}

  

posted @ 2021-05-14 15:03  前端出发者  阅读(45)  评论(0)    收藏  举报