Strategy.vue 12.7 KB

<template>
    <a-card :bordered="false">
        <!-- 查询区域 -->
        <div class="table-page-search-wrapper">
            <a-form layout="inline" @keyup.enter.native="searchQuery">
                <a-row :gutter="24">
                    <a-col :md="6" :sm="12">
                        <a-form-item label="审批流程编号:">
                            <a-input v-model="queryParam.strategyNo" />
                        </a-form-item>
                    </a-col>
                    <a-col :md="6" :sm="12">
                        <a-form-item label="审批流程名称:">
                            <a-input v-model="queryParam.strategyName" />
                        </a-form-item>
                    </a-col>
                    <template v-if="toggleSearchStatus">
                        <a-col :md="6" :sm="12">
                            <a-form-item label="启用状态:">
                                <a-select placeholder="" v-model="queryParam.strategyStatus">
                                    <a-select-option value="">请选择</a-select-option>
                                    <a-select-option :value="1">启用</a-select-option>
                                    <a-select-option :value="2">停用</a-select-option>
                                </a-select>
                            </a-form-item>
                        </a-col>
                        <!-- <a-col :md="6" :sm="12">
                            <a-form-item label="业务线编号:" >
                                <a-input
                                    v-model="queryParam.processNo"
                                />
                            </a-form-item>
                        </a-col> -->
                        <a-col :md="6" :sm="12">
                            <a-form-item label="产品名称">
                                <a-input v-model="queryParam.processNo" />
                            </a-form-item>
                        </a-col>
                        <a-col :md="6" :sm="12">
                            <a-form-item label="审批流程类型:">
                                <a-select v-model="queryParam.strategyType" placeholder="请选择审批流程类型"
                                    @change="handleSelectChange">
                                    <a-select-option value="">请选择</a-select-option>
                                    <a-select-option :value="1">进件审批</a-select-option>
                                    <a-select-option :value="2">用信审批</a-select-option>
                                </a-select>
                            </a-form-item>
                        </a-col>
                        <!-- <a-col :md="6" :sm="12">
                            <a-form-item label="进件/用信流名称:" >
                                <a-input
                                    v-model="queryParam.processName"
                                />
                                <a-select
                                    v-model="queryParam.processName"
                                    placeholder="请选择进件/用信流名称"
                                >
                                    <a-select-option v-for="(item,index) in copyProcessList" :key="index" :value="item.value">{{item.value}}</a-select-option>
                                </a-select>
                            </a-form-item>
                        </a-col> -->

                    </template>
                    <a-col :md="6" :sm="12">
                        <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
                            <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
                            <a-button @click="searchReset" icon="reload" style="margin-left: 8px">重置
                            </a-button>
                            <a @click="handleToggleSearch" style="margin-left: 8px">
                                {{ toggleSearchStatus ? '收起' : '展开' }}
                                <a-icon :type="toggleSearchStatus ? 'up' : 'down'" />
                            </a>
                        </span>
                    </a-col>
                </a-row>
            </a-form>
        </div>
        <!-- 操作按钮区域 -->
        <div class="table-operator" style="border-top: 5px">
            <a-button @click="handleAdd" type="primary" icon="plus" v-has="'strategy:add'">新增</a-button>
        </div>
        <!-- table区域-begin -->
        <div>
            <a-table ref="table" bordered size="middle" rowKey="id" :columns="columns" :dataSource="dataSource"
                :pagination="ipagination" :loading="loading" :scroll="{ x: 1400 }" @change="handleTableChange">
                <span slot="actionOpen" slot-scope="text, record">
                    <a-popconfirm title="修改模板状态?" @confirm="confirm(record)" @cancel="cancel" okText="Yes"
                        cancelText="No">
                        <a-switch size='small'
                            :checked="(record.strategyStatus == 1 || record.strategyStatus == true) ? true : false" />
                    </a-popconfirm>
                </span>
                <span slot="action" slot-scope="text, record">
                    <a-button
                        type="link"
                        size="small"
                        @click="handleShow(record)" v-has="'strategy:look'"
                        icon="search"
                        style="font-size: 12px"
                    >
                        查看</a-button
                    >
                    <a-button
                        type="link"
                        size="small"
                        v-show="record.strategyStatus == '2'" @click="handleEdit(record)" v-has="'strategy:edit'"
                        icon="edit"
                        style="font-size: 12px"
                    >
                    {{ record.strategyStatus == '2' ? '编辑' : '不可编辑' }}</a-button
                    >
                </span>
                <span slot="strategyType" slot-scope="text, record">
                    {{ record.strategyType == '1' ? '进件审批' : '用信审批' }}
                </span>
                <div style="maxWidth:100px;whiteSpace:nowrap;textOverflow:ellipsis;overflow:hidden; wordWrap:break-word; wordBreak:break-all"
                    slot="strategyNote" slot-scope="text, record">
                    <a-tooltip placement="left">
                        <template slot="title">
                            <span>{{ record.strategyNote }}</span>
                        </template>
                        {{ record.strategyNote }}
                    </a-tooltip>
                </div>
            </a-table>
        </div>
        <!-- table区域-end -->

        <strategic-add-modal ref="modalForm"></strategic-add-modal>
    </a-card>
</template>
<script>
import Vue from 'vue'
import store from '@/store'
import strategicAddModal from './modules/strategicAddModal'
import { approvalStrategyStatus } from '@/api/insys';
import { JeecgListMixin } from '@/mixins/CoreListMixin'
export default {
    name: 'Strategy',
    mixins: [JeecgListMixin],
    components: {
        strategicAddModal
    },
    data() {
        return {
            loading: false,
            formLayout: 'horizontal',
            form: this.$form.createForm(this, { name: 'coordinated' }),
            publicPath: process.env.BASE_URL,
            modelId: '',
            queryParam: {},
            columns: [
                {
                    title: '序号',
                    dataIndex: '',
                    key: 'rowIndex',
                    width: 55,
                    align: "center",
                    customRender: function (t, r, index) {
                        return parseInt(index) + 1;
                    }
                },
                {
                    title: '审批流程编号',
                    align: "center",
                    dataIndex: 'strategyNo',
                    width: 200
                },
                {
                    title: '审批流程名称',
                    align: "center",
                    width: 200,
                    dataIndex: 'strategyName',
                },
                {
                    title: '审批流程类型',
                    align: "center",
                    width: 200,
                    dataIndex: 'strategyType',
                    scopedSlots: { customRender: "strategyType" }
                },

                // {
                //     title: '进件/用信流编号',
                //     align: "center",
                //     width: 200,
                //     dataIndex: 'processNo',
                // },
                // {
                //     title: '业务线编号',
                //     align: "center",
                //     width: 200,
                //     dataIndex: 'processName',
                // },
                {
                    title: '产品编号',
                    align: "center",
                    width: 200,
                    dataIndex: 'productNo',
                },
                {
                    title: '产品名称',
                    align: "center",
                    width: 200,
                    dataIndex: 'productName',
                },
                {
                    title: '备注',
                    align: "center",
                    width: 100,
                    dataIndex: 'strategyNote',
                    width: '100px',
                    scopedSlots: { customRender: 'strategyNote' },
                },
                {
                    title: '启用状态',
                    align: "center",
                    width: 80,
                    dataIndex: 'strategyStatus',
                    scopedSlots: { customRender: 'actionOpen' },
                },

                {
                    title: '创建时间',
                    align: "center",
                    width: 180,
                    dataIndex: 'createTime',
                },
                {
                    title: '更新时间',
                    align: "center",
                    width: 180,
                    dataIndex: 'updateTime'
                },
                {
                    title: '操作',
                    dataIndex: 'action',
                    scopedSlots: { customRender: 'action' },
                    align: "center",
                    width: 170,
                    fixed: 'right',
                }
            ],
            url: {
                list: "/approval/admin/queryApprovalStrategyConfigPage",
            },
            copyProcessList: []
        }
    },
    created() {
        // this.handleSelectData('GetProcessData',{
        //     code:'collectionNo',
        //     value:'collectionName'
        // })
        // this.handleSelectData('GetCollectProcessData',{
        //     code:'loanInfoNo',
        //     value:'loanInfoName'
        // })

        this.disableMixinCreated = true
        this.columns = this.preFilter(this.columns, 'strategy:');
    },
    methods: {
        handleSelectChange(value) {
            if (value == 1) {
                this.copyProcessList = Vue.ls.get('SET_PROCESSLIST')
            } else {
                this.copyProcessList = Vue.ls.get('SET_COLLECTPROCESSLIST')
            }
        },
        handleSelectData(dispatchName, _prama) {
            let that = this
            let prama = {
                p: {
                    pageNo: 1,
                    pageSize: 30,
                    params: {},
                },
                name: _prama
            }
            store.dispatch(dispatchName, prama).then(res => {
            }).catch((err) => {
                console.log(err);
            });
        },
        confirm(record) {
            let prama = {
                id: record.id,
                strategyStatus: record.strategyStatus == true ? 2 : 1
            }
            this.loading = true
            approvalStrategyStatus(prama).then(e => {
                if (e.status.statusCode == 0) {
                    record.strategyStatus = (record.strategyStatus == 1 || record.strategyStatus == true) ? false : true
                    //页面刷新处理方法
                    this.searchQuery()
                    this.loading = false
                } else {
                    this.$message.error(e.message);
                    this.loading = false
                }
            })
        },
        cancel(cont) {
            console.log(cont)
        }
    },
    mounted() {
        console.log(window.getMyVue)
        window.getMyVue = this;//全局存入当前vue实例,供activiti调用 
    }
}
</script>
<style scoped>
</style>