yudao-dev/src/views/base/coreSupplier/index.vue

183 lines
3.6 KiB
Vue
Raw Normal View History

2023-11-03 11:15:12 +08:00
<template>
<div class="app-container">
<search-bar
:formConfigs="formConfig"
ref="searchBarForm"
@headBtnClick="buttonClick" />
<base-table
v-loading="dataListLoading"
:table-props="tableProps"
:page="listQuery.pageNo"
:limit="listQuery.pageSize"
2024-08-21 11:42:23 +08:00
:max-height="tableH"
2023-11-03 11:15:12 +08:00
:table-data="tableData">
<method-btn
v-if="tableBtn.length"
slot="handleBtn"
:width="120"
label="操作"
:method-list="tableBtn"
@clickBtn="handleClick" />
</base-table>
<pagination
:limit.sync="listQuery.pageSize"
:page.sync="listQuery.pageNo"
:total="listQuery.total"
@pagination="getDataList" />
<base-dialog
:dialogTitle="addOrEditTitle"
:dialogVisible="addOrUpdateVisible"
@cancel="handleCancel"
@confirm="handleConfirm"
:before-close="handleCancel"
width="50%">
<add-or-update
ref="addOrUpdate"
@refreshDataList="successSubmit"></add-or-update>
</base-dialog>
</div>
</template>
<script>
import AddOrUpdate from './add-or-updata';
2024-08-21 11:42:23 +08:00
import basicPage from '@/mixins/basic-page';
2023-11-03 11:15:12 +08:00
import { parseTime } from '../../core/mixins/code-filter';
import {
getCoreSupplierPage,
2024-08-21 11:42:23 +08:00
deleteCoreSupplier,
2023-11-03 11:15:12 +08:00
} from '@/api/base/coreSupplier';
2024-08-21 11:42:23 +08:00
import tableHeightMixin from '@/mixins/tableHeightMixin';
2023-11-03 11:15:12 +08:00
const tableProps = [
{
prop: 'createTime',
label: '添加时间',
2024-08-21 11:42:23 +08:00
filter: parseTime,
width: 150,
2023-11-03 11:15:12 +08:00
},
{
prop: 'code',
2024-08-21 11:42:23 +08:00
label: '供应商编码',
width: 150,
2023-11-03 11:15:12 +08:00
},
{
prop: 'name',
2024-08-21 11:42:23 +08:00
label: '供应商名称',
2023-11-03 11:15:12 +08:00
},
{
prop: 'contact',
2024-08-21 11:42:23 +08:00
label: '联系人',
2023-11-03 11:15:12 +08:00
},
{
prop: 'telephone',
2024-08-21 11:42:23 +08:00
label: '联系电话',
2023-11-03 11:15:12 +08:00
},
{
prop: 'address',
2024-08-21 11:42:23 +08:00
label: '地址',
2023-11-03 11:15:12 +08:00
},
{
prop: 'remark',
2024-08-21 11:42:23 +08:00
label: '备注',
2023-11-03 11:15:12 +08:00
},
];
export default {
2024-08-21 11:42:23 +08:00
mixins: [basicPage, tableHeightMixin],
2023-11-03 11:15:12 +08:00
data() {
return {
urlOptions: {
getDataListURL: getCoreSupplierPage,
2024-08-21 11:42:23 +08:00
deleteURL: deleteCoreSupplier,
2023-11-03 11:15:12 +08:00
},
tableProps,
tableBtn: [
this.$auth.hasPermi(`base:core-supplier:update`)
? {
type: 'edit',
btnName: '编辑',
}
: undefined,
2024-08-21 11:42:23 +08:00
this.$auth.hasPermi(`base:core-supplier:delete`)
2023-11-03 11:15:12 +08:00
? {
type: 'delete',
btnName: '删除',
}
: undefined,
2024-08-21 11:42:23 +08:00
].filter((v) => v),
2023-11-03 11:15:12 +08:00
tableData: [],
formConfig: [
{
type: 'input',
2023-11-27 20:41:45 +08:00
label: '供应商',
2023-11-03 11:15:12 +08:00
placeholder: '供应商名称',
param: 'name',
},
{
type: 'button',
btnName: '查询',
name: 'search',
color: 'primary',
},
{
type: 'separate',
},
{
2024-08-21 11:42:23 +08:00
type: this.$auth.hasPermi('base:core-supplier:create')
? 'button'
: '',
2023-11-03 11:15:12 +08:00
btnName: '新增',
name: 'add',
color: 'success',
2024-08-21 11:42:23 +08:00
plain: true,
2023-11-03 11:15:12 +08:00
},
],
};
},
components: {
AddOrUpdate,
},
created() {},
methods: {
// 获取数据列表
2024-08-21 11:42:23 +08:00
// getDataList() {
// this.dataListLoading = true;
// this.urlOptions.getDataListURL(this.listQuery).then(response => {
// this.tableData = response.data.list;
// this.listQuery.total = response.data.total;
// this.dataListLoading = false;
// });
// },
2023-11-03 11:15:12 +08:00
buttonClick(val) {
switch (val.btnName) {
case 'search':
this.listQuery.pageNo = 1;
this.listQuery.pageSize = 10;
this.listQuery.name = val.name ? val.name : undefined;
this.getDataList();
break;
case 'reset':
this.$refs.searchBarForm.resetForm();
this.listQuery = {
pageSize: 10,
pageNo: 1,
total: 1,
};
this.getDataList();
break;
case 'add':
this.addOrEditTitle = '新增';
this.addOrUpdateVisible = true;
this.addOrUpdateHandle();
break;
case 'export':
this.handleExport();
break;
default:
console.log(val);
}
},
},
};
</script>