<template>
|
<a-card
|
:bordered="false"
|
>
|
<!-- 查询区域 -->
|
<div class="table-page-search-wrapper">
|
<a-form
|
layout="inline"
|
@keyup.enter.native="searchQuery"
|
>
|
<a-row :gutter="30">
|
|
<a-col :xl="6" :lg="7" :md="8" :sm="24">
|
<a-form-item label="供应商编号">
|
<j-input
|
placeholder="请输入供应商编号检索"
|
v-model="queryParam.supplierCode"
|
></j-input>
|
</a-form-item>
|
</a-col>
|
|
<a-col :xl="6" :lg="7" :md="8" :sm="24">
|
<a-form-item label="供应商名称">
|
<j-input
|
placeholder="请输入供应商名称检索"
|
v-model="queryParam.supplierName"
|
></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="info" @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>
|
<!-- <a-button type="primary" @click="exportToExcel('供应商信息导入模板')" icon="export" style="margin-left: 8px" >下载导入模板</a-button>
|
<a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel">
|
<a-button type="primary" icon="import" :disabled="!nodeSelected.key || nodeSelected.entity.leafFlag === '2'">导入</a-button>
|
</a-upload> -->
|
</div>
|
|
<!-- table区域-begin -->
|
<div>
|
<a-table
|
ref="table"
|
size="middle"
|
bordered
|
rowKey="id"
|
filterMultiple="filterMultiple"
|
:columns="columns"
|
:rowClassName="tableRowClass"
|
:dataSource="dataSource"
|
:pagination="ipagination"
|
:loading="loading"
|
>
|
<!--状态栏个性展示-->
|
<span
|
slot="status"
|
slot-scope="text,record"
|
>
|
<a-badge
|
v-if="record.supplierStatus==1"
|
status="success"
|
/>
|
<span
|
v-if="record.supplierStatus==1"
|
class="success"
|
>启用</span>
|
<a-badge
|
v-if="record.supplierStatus==0"
|
status="error"
|
/>
|
<span
|
v-if="record.supplierStatus==0"
|
class="error"
|
>禁用</span>
|
</span>
|
<span
|
slot="action"
|
slot-scope="text, record"
|
>
|
<a
|
href="javascript:;"
|
@click="handleDetail(record)"
|
>详情</a>
|
|
<a-divider type="vertical" />
|
<a-dropdown>
|
<a class="ant-dropdown-link">更多
|
<a-icon type="down" />
|
</a>
|
<a-menu slot="overlay">
|
<a-menu-item v-if="record.supplierStatus==1">
|
<a @click="handleEdit(record)">编辑</a>
|
</a-menu-item>
|
<a-menu-item>
|
<a-popconfirm
|
title="确定删除吗?"
|
@confirm="() => handleDelete(record.id)"
|
>
|
<a>删除</a>
|
</a-popconfirm>
|
|
</a-menu-item>
|
<a-menu-item v-if="record.supplierStatus == 0">
|
<a-popconfirm
|
title="确定启用吗?"
|
@confirm="() => handleActive(record.id)"
|
>
|
<a>启用</a>
|
</a-popconfirm>
|
</a-menu-item>
|
<a-menu-item v-if="record.supplierStatus == 1">
|
<a-popconfirm
|
title="确定禁用吗?"
|
@confirm="() => handleActive(record.id)"
|
>
|
<a>禁用</a>
|
</a-popconfirm>
|
</a-menu-item>
|
</a-menu>
|
</a-dropdown>
|
</span>
|
|
</a-table>
|
</div>
|
<!-- table区域-end -->
|
|
<!-- 表单区域 -->
|
<supplier-model
|
ref="modalForm"
|
@ok="modalFormOk"
|
></supplier-model>
|
</a-card>
|
</template>
|
|
<script>
|
//按需引入 组件
|
import SupplierModel from './modules/supplier/SupplierModel'
|
|
import { deleteAction, requestPut, getAction } from '@/api/manage'
|
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
|
import JEllipsis from '@/components/jeecg/JEllipsis'
|
import JInput from '@/components/jeecg/JInput'
|
|
export default {
|
name: 'SupplierList',
|
mixins: [JeecgListMixin],
|
components: {
|
SupplierModel,
|
JEllipsis,
|
JInput,
|
},
|
data() {
|
return {
|
dataSource: [],
|
/* 分页参数 */
|
ipagination: {
|
current: 1,
|
pageSize: 5,
|
pageSizeOptions: ['5', '10', '20'],
|
showTotal: (total, range) => {
|
return range[0] + "-" + range[1] + " 共" + total + "条"
|
},
|
showQuickJumper: true,
|
showSizeChanger: true,
|
total: 0
|
},
|
// 表头
|
columns: [
|
{
|
title: '#',
|
dataIndex: '',
|
key: 'rowIndex',
|
width: 60,
|
align: "center",
|
customRender: function (t, r, index) {
|
return parseInt(index) + 1;
|
}
|
},
|
{
|
title: '供应商编号',
|
align: "center",
|
dataIndex: 'supplierCode'
|
},
|
{
|
title: '供应商名称',
|
align: "center",
|
dataIndex: 'supplierName'
|
},
|
{
|
title: '国家',
|
align: 'center',
|
dataIndex: 'country'
|
},
|
{
|
title: '省份',
|
align: 'center',
|
dataIndex: 'province'
|
},
|
{
|
title: '城市',
|
align: 'center',
|
dataIndex: 'city'
|
},
|
{
|
title: '详细地址',
|
align: 'center',
|
dataIndex: 'address'
|
},
|
{
|
title: '联系人',
|
align: 'center',
|
dataIndex: 'contact'
|
},
|
{
|
title: '电话',
|
align: 'center',
|
dataIndex: 'phone'
|
},
|
{
|
width: 100,
|
title: '状态',
|
align: 'center',
|
scopedSlots: {
|
customRender: 'status',
|
},
|
dataIndex: 'supplierStatus'
|
},
|
{
|
width: 150,
|
title: '操作',
|
dataIndex: 'action',
|
align: 'center',
|
scopedSlots: { customRender: 'action' },
|
}
|
],
|
url: {
|
list: '/base/supplier/list',
|
delete: '/base/supplier/delete',
|
active: '/base/supplier/active',
|
},
|
}
|
},
|
mounted() {
|
|
},
|
methods: {
|
loadData(arg) {
|
if (arg === 1) {
|
this.ipagination.current = 1;
|
}
|
var params = this.getQueryParams();//查询条件
|
this.loading = true;
|
getAction(this.url.list, params).then((res) => {
|
if (res.success) {
|
this.dataSource = res.result.records;
|
this.ipagination.total = res.result.total;
|
}
|
if (res.code === 510) {
|
this.$message.warning(res.message)
|
}
|
this.loading = false;
|
})
|
},
|
//禁用状态样式
|
tableRowClass(record, index) {
|
if (record.supplierStatus != "1") {
|
return "frozenRowClass";
|
}
|
return "";
|
},
|
//启用禁用
|
handleActive(id) {
|
if (!this.url.active) {
|
this.$message.error("请设置url.active!")
|
return
|
}
|
let that = this;
|
requestPut(that.url.active, {}, { id: id }).then((res) => {
|
if (res.success) {
|
that.$message.success(res.message);
|
that.loadData();
|
} else {
|
that.$message.warning(res.message);
|
}
|
});
|
},
|
exportToExcel(fileName) {
|
this.loading = true // 显示加载遮罩
|
this.queryParam.paraTypeFlag = this.paraTypeFlag
|
var params = this.getQueryParams()
|
downFile(this.url.loadTemplate,params).then((data)=>{
|
if (!data) {
|
this.$message.warning("文件下载失败")
|
return
|
}
|
if (typeof window.navigator.msSaveBlob !== 'undefined') {
|
window.navigator.msSaveBlob(new Blob([data],{type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'}), fileName+'.xlsx')
|
}else{
|
let url = window.URL.createObjectURL(new Blob([data],{type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'}))
|
let link = document.createElement('a')
|
link.style.display = 'none'
|
link.href = url
|
link.setAttribute('download', fileName+'.xlsx')
|
document.body.appendChild(link)
|
link.click()
|
document.body.removeChild(link); //下载完成移除元素
|
window.URL.revokeObjectURL(url); //释放掉blob对象
|
}
|
this.loading = false // 隐藏遮罩
|
})
|
},
|
},
|
|
}
|
</script>
|
<style lang="less" scoped>
|
@import '~@assets/less/common.less';
|
.frozenRowClass {
|
color: #c9c9c9;
|
}
|
.success {
|
color: green;
|
}
|
.error {
|
color: red;
|
}
|
.fontweight {
|
font-weight: bold;
|
}
|
.ant-card-body .table-operator {
|
margin-bottom: 18px;
|
}
|
|
.ant-table-tbody .ant-table-row td {
|
padding-top: 15px;
|
padding-bottom: 15px;
|
}
|
|
.anty-row-operator button {
|
margin: 0 5px;
|
}
|
|
/deep/.ant-btn-danger {
|
background-color: #ffffff;
|
}
|
|
.ant-modal-cust-warp {
|
height: 100%;
|
}
|
|
.ant-modal-cust-warp .ant-modal-body {
|
height: calc(100% - 110px) !important;
|
overflow-y: auto;
|
}
|
|
.ant-modal-cust-warp .ant-modal-content {
|
height: 90% !important;
|
overflow-y: hidden;
|
}
|
</style>
|