FinishProductManageList.vue 6.3 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 :xl="6" :lg="7" :md="8" :sm="24">
                        <a-form-item label="品名">
                            <j-input placeholder="请输入品名" v-model="queryParam.productName"></j-input>
                        </a-form-item>
                    </a-col>
                    <a-col :xl="6" :lg="7" :md="8" :sm="24">
                        <span style="float: left; overflow: hidden" class="table-page-search-submitButtons">
                            <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
                            <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置
                            </a-button>
                        </span>
                    </a-col>
                </a-row>
            </a-form>
        </div>
        <!-- 操作按钮区域 -->
        <div class="table-operator">
            <a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>
        </div>

        <!-- table区域-begin -->
        <div>
            <a-table ref="table" size="middle" bordered rowKey="id" class="j-table-force-nowrap" :scroll="{ x: true }"
                :columns="columns" :dataSource="dataSource" :pagination="ipagination" :loading="loading"
                :rowSelection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange, type: 'radio' }"
                :customRow="clickThenSelect" @change="handleTableChange">
                
                <span slot="action" slot-scope="text, record">
                    <a @click="getQRCode(record)">二维码</a>
                    <a-divider type="vertical" />
                    <a @click="handleDetail(record)">查看</a>
                    <a-divider type="vertical" />
                    <a @click="handleEdit(record)">编辑</a>
                    <a-divider type="vertical" />
                    <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
                        <a>删除</a>
                    </a-popconfirm>
                </span>
            </a-table>
        </div>

        <finish-product-manage-modal-add ref="modalForm" @ok="modalFormOk" />
        <finish-product-manage-modal-edit ref="editForm" @ok="modalFormOk" />
        <finish-product-manage-modal-show ref="showForm" @ok="modalFormOk" />

        <div>
            <j-modal :width="250" :visible="visible" :maskClosable="false" switchFullscreen @cancel="handleCancel"
                okText="打印完成" @ok="handleCancel">
                <a-button v-print="'#printContent'" ghost type="primary">打印</a-button>
                <section id="printContent">
                    <vue-qr :text="imgUrl" :size="200" :margin="21" :logoScale="0.2"> </vue-qr>
                </section>
            </j-modal>
        </div>
    </a-card>
</template>

<script>
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import FinishProductManageModalAdd from './modules/FinishProductManageModalAdd'
import FinishProductManageModalEdit from './modules/FinishProductManageModalEdit'
import FinishProductManageModalShow from './modules/FinishProductManageModalShow'
import VueQr from 'vue-qr'
export default {
    name: 'FinishProductManageList',
    mixins: [JeecgListMixin],
    components: {
        FinishProductManageModalAdd,
        FinishProductManageModalEdit,
        FinishProductManageModalShow,
        VueQr,
    },
    data() {
        return {
            columns: [
                {
                    title: '编号',
                    align: 'center',
                    dataIndex: 'partNumber',
                },
                {
                    title: '品名',
                    align: 'center',
                    dataIndex: 'productName',
                },
                {
                    title: '规格',
                    align: 'center',
                    dataIndex: 'spec',
                },
                {
                    title: '型号',
                    align: 'center',
                    dataIndex: 'type',
                },
                {
                    title: '单位',
                    align: 'center',
                    dataIndex: 'unit',
                },
                {
                    title: '操作',
                    dataIndex: 'action',
                    align: 'center',
                    fixed: 'right',
                    width: 147,
                    scopedSlots: {
                        customRender: 'action',
                    },
                },
            ],
            url: {
                list: '/baseLibrary/baseLibraryInfo/list',
                delete: "/baseLibrary/baseLibraryInfo/delete",
            },
            visible: false,
            imgUrl: '',
        }
    },
    methods: {
        getQRCode(record) {
            this.visible = true
            this.imgUrl = record.partNumber;
        },
        handleCancel() {
            this.$emit('close')
            this.visible = false
        },
        clickThenSelect(record) {
            return {
                on: {
                    click: () => {
                        this.onSelectChange(record.id.split(","), [record]);
                    }
                }
            }
        },
        onClearSelected() {
            this.selectedRowKeys = [];
            this.selectionRows = [];
            this.selectedMainId = ''
        },
        onSelectChange(selectedRowKeys, selectionRows) {
            this.selectedMainId = selectedRowKeys[0]
            this.selectedRowKeys = selectedRowKeys;
            this.selectionRows = selectionRows;
            this.tblSupplierPriceMainId = selectionRows[0]['id']
        },
        handleEdit(record) {
            this.$refs.editForm.edit(record);
            this.$refs.editForm.title = "编辑";
            this.$refs.editForm.disableSubmit = false;
        },
        handleDetail(record) {
            console.log(record)
            this.$refs.showForm.show(record);
            this.$refs.showForm.title = "详情";
            this.$refs.showForm.disableSubmit = true;
        }
    }
}
</script>