<template>
|
<a-card
|
:bordered='false'
|
title='供应商'
|
>
|
<!-- 查询区域 -->
|
<div class='table-page-search-wrapper'>
|
<a-form
|
layout='inline'
|
@keyup.enter.native='searchQuery'
|
>
|
<a-row :gutter="24">
|
<a-col
|
:md="8"
|
:sm="8"
|
>
|
<a-form-item label='供应商编码'>
|
<j-input
|
placeholder='请输入供应商编码'
|
v-model='queryParam.num'
|
></j-input>
|
</a-form-item>
|
</a-col>
|
<a-col
|
:md='8'
|
:sm='8'
|
>
|
<a-form-item label='供应商名称'>
|
<j-input
|
placeholder='请输入供应商名称'
|
v-model='queryParam.name'
|
></j-input>
|
</a-form-item>
|
</a-col>
|
</a-row>
|
</a-form>
|
</div>
|
|
<!-- 操作按钮区域 -->
|
<div
|
class='table-operator'
|
style='margin-top: 5px'
|
>
|
<a-button
|
type='primary'
|
@click='searchQuery'
|
icon='search'
|
>查询
|
</a-button>
|
<a-button
|
@click='searchReset'
|
icon='reload'
|
>重置
|
</a-button>
|
<a-button
|
@click='handleAdd'
|
type='primary'
|
icon='plus'
|
:hidden='disabled'
|
>新增
|
</a-button>
|
<a-button
|
type='primary'
|
icon='download'
|
@click="handleExportXls('供应商')"
|
>导出
|
</a-button>
|
<a-dropdown v-if='selectedRowKeys.length > 0'>
|
<a-button style='margin-left: 8px'>
|
批量操作
|
<a-icon type='down' />
|
</a-button>
|
<a-menu slot='overlay'>
|
<a-menu-item @click='batchDel'>
|
<a-icon type='delete' />
|
删除
|
</a-menu-item>
|
</a-menu>
|
</a-dropdown>
|
</div>
|
|
<!-- table区域-begin -->
|
|
<a-table
|
ref='table'
|
bordered
|
size='middle'
|
rowKey='id'
|
:columns='columns'
|
:rowClassName='tableRowClass'
|
:dataSource='dataSource'
|
:pagination='ipagination'
|
:loading='loading'
|
:rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
|
@change='handleTableChange'
|
:scroll="{ x: 'calc(1200px + 50%)', y: 900 }"
|
:customRow="clickThenSelect"
|
>
|
|
|
<!--字符串超长截取省略号显示-->
|
<!-- <span-->
|
<!-- slot='num'-->
|
<!-- slot-scope='text'-->
|
<!-- style='font-weight: bold'-->
|
<!-- >-->
|
<!-- <j-ellipsis-->
|
<!-- :value='text'-->
|
<!-- :length='15'-->
|
<!-- />-->
|
<!-- </span>-->
|
<!-- <span-->
|
<!-- slot='name'-->
|
<!-- slot-scope='text'-->
|
<!-- style='font-weight: bold'-->
|
<!-- >-->
|
<!-- <j-ellipsis-->
|
<!-- :value='text'-->
|
<!-- :length='15'-->
|
<!-- />-->
|
<!-- </span>-->
|
<!-- <span-->
|
<!-- slot='model'-->
|
<!-- slot-scope='text'-->
|
<!-- >-->
|
<!-- <j-ellipsis-->
|
<!-- :value='text'-->
|
<!-- :length='15'-->
|
<!-- />-->
|
<!-- </span>-->
|
<span
|
slot='action'
|
slot-scope='text, record'
|
>
|
<a @click='handleEdit(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>
|
<a
|
href='javascript:;'
|
@click='handleDetail(record)'
|
>详情</a>
|
</a-menu-item>
|
|
<a-menu-item>
|
<a-popconfirm
|
title='确定删除吗?'
|
@confirm='() => handleDelete(record.id)'
|
>
|
<a>删除</a>
|
</a-popconfirm>
|
</a-menu-item>
|
</a-menu>
|
</a-dropdown>
|
</span>
|
|
</a-table>
|
|
<a-tabs defaultActiveKey="1">
|
<a-tab-pane key="1">
|
<span slot="tab">
|
<a-badge v-if="showTabsFlag">供应商联系人</a-badge>
|
<a-badge
|
v-if="!showTabsFlag"
|
:count="1"
|
show-zero
|
:number-style="{ backgroundColor: '#52c41a' }"
|
>供应商联系人</a-badge>
|
</span>
|
<div
|
class="table-operator"
|
style="margin-top: 0px"
|
>
|
<supplier-contact-detail ref="SupplierContactDetail"></supplier-contact-detail>
|
</div>
|
</a-tab-pane>
|
</a-tabs>
|
|
<!-- table区域-end -->
|
|
<supplier-model
|
ref='modalForm'
|
@ok='modalFormOk'
|
:nodeSelected='nodeSelected'></supplier-model>
|
</a-card>
|
</template>
|
|
<script>
|
import SupplierContactDetail from './SupplierContactDetail'
|
import JDictSelectTag from '@/components/dict/JDictSelectTag'
|
import { deleteAction, requestPut } from '@/api/manage'
|
import SupplierModel from './SupplierModel'
|
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
|
import JInput from '@/components/jeecg/JInput'
|
import JEllipsis from '@/components/jeecg/JEllipsis'
|
import Tooltip from 'ant-design-vue/es/tooltip'
|
|
|
export default {
|
name: 'SupplierModelRight',
|
mixins: [JeecgListMixin],
|
components: {
|
SupplierContactDetail,
|
Tooltip,
|
SupplierModel,
|
JDictSelectTag,
|
JInput,
|
JEllipsis
|
|
},
|
props: {
|
recordSelect: {}
|
},
|
data() {
|
return {
|
showTabsFlag: true,
|
disabled: true,
|
ipagination: {
|
current: 1,
|
pageSize: 5,
|
pageSizeOptions: ['5', '10', '20'],
|
showTotal: (total, range) => {
|
return range[0] + "-" + range[1] + " 共" + total + "条"
|
},
|
showQuickJumper: true,
|
showSizeChanger: true,
|
total: 0
|
},
|
nodeSelected: {},
|
isorter: {
|
column: 'num',
|
order: 'asc',
|
},
|
columns: [
|
{
|
title: '#',
|
dataIndex: '',
|
key: 'rowIndex',
|
align: 'center',
|
customRender: function(t, r, index) {
|
return parseInt(index) + 1
|
},
|
width: 50
|
},
|
{
|
title: '供应商编码',
|
align: 'center',
|
dataIndex: 'num',
|
scopedSlots: {
|
customRender: 'num'
|
}
|
// sorter: true,
|
},
|
{
|
title: '供应商名称',
|
align: 'center',
|
dataIndex: 'name',
|
scopedSlots: {
|
customRender: 'name'
|
}
|
// sorter: true,
|
},
|
{
|
title: '供应商类型',
|
align: 'center',
|
dataIndex: 'supplierType_dictText'
|
},
|
|
{
|
title: '供应商简称',
|
align: 'center',
|
dataIndex: 'abbreviation'
|
},
|
|
{
|
title: '所属行业',
|
align: 'center',
|
dataIndex: 'affiliationIndustry'
|
},
|
{
|
title: '地址',
|
align: 'center',
|
dataIndex: 'address'
|
},
|
{
|
title: '创建人',
|
align: 'center',
|
dataIndex: 'createBy'
|
},
|
{
|
title: '创建时间',
|
align: 'center',
|
dataIndex: 'createTime'
|
},
|
{
|
title: '修改人',
|
align: 'center',
|
dataIndex: 'updateBy'
|
},
|
{
|
title: '修改时间',
|
align: 'center',
|
dataIndex: 'updateTime'
|
},
|
{
|
title: '备注',
|
align: "center",
|
dataIndex: 'remark',
|
},
|
{
|
|
title: '操作',
|
dataIndex: 'action',
|
align: 'center',
|
scopedSlots: {
|
customRender: 'action'
|
},
|
width: 150,
|
fixed: 'right'
|
}
|
],
|
url: {
|
list: '/eam/supplier/list',
|
delete: '/eam/supplier/delete',
|
deleteBatch: '/eam/supplier/deleteBatch',
|
exportXlsUrl: '/eam/supplier/exportXls',
|
importExcelUrl: 'eam/supplier/importExcel'
|
},
|
supplierCategoryId: '',
|
}
|
},
|
|
|
methods: {
|
|
clickThenSelect(record) {
|
return {
|
on: {
|
click: () => {
|
this.onSelectChange(record.id.split(","), [record]);
|
}
|
}
|
}
|
},
|
|
onSelectChange(selectedRowKeys, selectionRows) {
|
if (selectedRowKeys.length == 1) {
|
this.$refs.SupplierContactDetail.supplierId = selectedRowKeys[0]
|
console.log(this.$refs.SupplierContactDetail.supplierId)
|
} else {
|
this.$refs.SupplierContactDetail.supplierId = '-1'
|
}
|
this.selectedRowKeys = selectedRowKeys;
|
this.selectionRows = selectionRows;
|
},
|
|
handleAdd: function() {
|
|
this.$refs.modalForm.add({ supplierCategoryNumName: this.supplierCategoryNumName,supplierCategoryId:this.supplierCategoryId });
|
this.$refs.modalForm.title = "新增";
|
this.$refs.modalForm.disableSubmit = false;
|
this.$refs.modalForm.supplierCategoryId = this.nodeSelected.key;
|
console.log(this.$refs.modalForm.supplierCategoryId)
|
},
|
|
|
|
batchDel: function () {
|
if (!this.url.deleteBatch) {
|
this.$message.error("请设置url.deleteBatch属性!")
|
return
|
}
|
if (this.selectedRowKeys.length <= 0) {
|
this.$message.warning('请选择一条记录!');
|
return;
|
} else {
|
var ids = "";
|
for (var a = 0; a < this.selectedRowKeys.length; a++) {
|
ids += this.selectedRowKeys[a] + ",";
|
}
|
var that = this;
|
this.$confirm({
|
title: "确认删除",
|
content: "是否删除选中数据?",
|
onOk: function () {
|
that.loading = true;
|
deleteAction(that.url.deleteBatch, { ids: ids }).then((res) => {
|
if (res.success) {
|
//重新计算分页问题
|
that.reCalculatePage(that.selectedRowKeys.length)
|
that.$message.success(res.message);
|
that.loadData();
|
that.onClearSelected();
|
that.alterFlag = new Date();
|
} else {
|
that.$message.warning(res.message);
|
}
|
}).finally(() => {
|
that.loading = false;
|
});
|
}
|
});
|
}
|
},
|
|
|
//禁用状态样式
|
tableRowClass(record, index) {
|
if (record.status != '1') {
|
return 'frozenRowClass'
|
}
|
return ''
|
},
|
searchReset() {
|
if ('-1' != this.nodeSelected.key) {
|
this.disabled = false
|
this.queryParam = []
|
this.queryParam.supplierCategoryId = this.nodeSelected.key
|
} else {
|
this.disabled = true
|
this.queryParam = []
|
}
|
this.loadData(1)
|
}
|
},
|
watch: {
|
selectionRows() {
|
this.$bus.$emit('supplierContactSelectionRows', this.selectionRows);
|
},
|
recordSelect(val) {
|
this.nodeSelected = val
|
this.supplierCategoryNumName = this.nodeSelected.rfield1 + '/' + this.nodeSelected.rfield2
|
if ('-1' != this.nodeSelected.key) {
|
this.disabled = false
|
this.queryParam = []
|
this.queryParam.supplierCategoryId = this.nodeSelected.key
|
} else {
|
this.disabled = true
|
this.queryParam = []
|
}
|
this.loadData(1)
|
}
|
},
|
created() {
|
this.queryParam = {};
|
this.queryParam.supplierCategoryId = this.nodeSelected.key;
|
this.selectedRowKeys = []
|
this.selectionRows = []
|
this.loadData(1);
|
}
|
|
}
|
</script>
|
|
<style lang='less' scoped>
|
@import '~@assets/less/common.less';
|
|
.frozenRowClass {
|
color: #c9c9c9;
|
}
|
|
.success {
|
color: green;
|
}
|
|
.error {
|
color: red;
|
}
|
|
.notShow {
|
display: none;
|
}
|
|
.fontweight {
|
font-weight: bold;
|
}
|
</style>
|