emis-frontend/src/views/emis/emisSupplier/index.vue
2025-02-18 19:29:55 +08:00

384 lines
14 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<XdPageContainer class="app-container">
<SearchForm slot="pageHeader" :model="queryParams" ref="queryForm" size="small" :maxShow="30" label-width="68px" v-show="showSearch" @search="handleQuery" @reset="resetQuery">
<el-form-item label="供应商编码" prop="code" label-width="90px">
<el-input
v-model="queryParams.code"
:placeholder="$t('供应商编码')"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="供应商名称" prop="name" label-width="90px" >
<el-input
v-model="queryParams.name"
:placeholder="$t('供应商名称')"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="英文简称" prop="nameEn">
<el-input
v-model="queryParams.nameEn"
:placeholder="$t('英文简称')"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="结算类型" prop="settledType">
<el-select clearable v-model="queryParams.settledType" placeholder="结算类型">
<el-option key="1" label="现金" value="1"></el-option>
<el-option key="2" label="月结" value="2"></el-option>
</el-select>
</el-form-item>
<el-form-item label="运输方式" prop="transType">
<el-select v-model="queryParams.transType" placeholder="运输方式" clearable filterable @change="handleQuery">
<el-option
v-for="item in dict.type.emis_biz_shipping_method"
v-bind:key="item.value"
v-bind:label="item.label"
v-bind:value="item.value"
/>
</el-select>
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input
v-model="queryParams.remark"
:placeholder="$t('备注')"
clearable
/>
</el-form-item>
<el-form-item label="业务网点" prop="bizSite">
<EmisSiteSimplePicker :placeholder="$t('所属网点')" v-model="queryParams.bizSite" ></EmisSiteSimplePicker>
</el-form-item>
</SearchForm>
<XdTable
slot="pageContent"
slot-scope="slotProps"
:height="(slotProps.contentHeight)+'px'"
v-loading="loading"
border
size="mini"
:data="emisSupplierList"
:showSearch.sync="showSearch"
:queryParams="queryParams"
:total="total"
@queryTable="getList"
@selection-change="handleSelectionChange"
@sort-change="handleSortChange"
>
<div slot="toolbar">
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['emis:emisSupplier:add']"
>新增供应商</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
plain
icon="el-icon-edit"
size="mini"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['emis:emisSupplier:edit']"
>修改</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['emis:emisSupplier:remove']"
>删除</el-button>
</el-col>
<!-- <el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
v-hasPermi="['emis:emisSupplier:export']"
>导出</el-button>
</el-col> -->
</el-row>
</div>
<el-table-column type="selection" width="55" align="center" />
<el-table-column :label="$t('供应商编码')" align="center" prop="code" min-width="100" >
<template slot-scope="scope">
<div class="link-type" @click="handleUpdate(scope.row)">{{scope.row.code}}</div>
</template>
</el-table-column>
<el-table-column :label="$t('供应商名称')" align="left" prop="name" min-width="220" :show-overflow-tooltip="true">
<template slot-scope="scope">
<div class="link-type" @click="handleUpdate(scope.row)">{{scope.row.name}}</div>
</template>
</el-table-column>
<el-table-column :label="$t('英文简称')" align="left" prop="nameEn" min-width="100" :show-overflow-tooltip="true"/>
<el-table-column :label="$t('结算类型')" align="center" prop="settledType" min-width="100" >
<template slot-scope="scope">
<el-tag v-if="scope.row.settledType=='1'" type="success">现金</el-tag>
<el-tag v-if="scope.row.settledType=='2'" type="warning">月结</el-tag>
</template>
</el-table-column>
<el-table-column label="运输方式" align="center" prop="transType" width="80" >
<template slot-scope="scope">
<dict-tag :options="dict.type.emis_biz_shipping_method" :value="scope.row.transType"/>
</template>
</el-table-column>
<!-- <el-table-column :label="$t('业务网点')" align="center" prop="bizSite" min-width="100" /> -->
<el-table-column :label="$t('业务网点范围')" align="center" prop="bizSiteName" min-width="150" :show-overflow-tooltip="true"/>
<el-table-column :label="$t('备注')" align="center" prop="remark" min-width="100" :show-overflow-tooltip="true"/>
<el-table-column label="创建人" align="center" prop="createByName" width="80" :show-overflow-tooltip="true"/>
<el-table-column label="创建网点" align="center" prop="createSiteName" width="80" :show-overflow-tooltip="true"/>
<el-table-column label="创建时间" align="center" prop="createTime" width="170"/>
<el-table-column label="修改人" align="center" prop="updateByName" width="80" :show-overflow-tooltip="true"/>
<el-table-column label="修改网点" align="center" prop="updateSiteName" width="80" :show-overflow-tooltip="true"/>
<el-table-column label="修改时间" align="center" prop="updateTime" width="170"/>
</XdTable>
<el-dialog :title="titleForm" :visible.sync="openForm" width="50%" :destroy-on-close="true" v-dialogDrag append-to-body>
<emisSupplierForm :id="currentId" @on-changed="handleFormChanged" @on-cancel="cancelForm"></EmisSupplierForm>
</el-dialog>
</XdPageContainer>
</template>
<script>
import { listEmisSupplier, getEmisSupplier, delEmisSupplier, addEmisSupplier, updateEmisSupplier } from "@/api/emis/emisSupplier";
import elDateSimplePicker from '@/components/DatePickerAdv/elDateSimplePicker';
// import emisSupplierView from '@/views/emis/emisSupplier/emisSupplierView';
import emisSupplierForm from '@/views/emis/emisSupplier/emisSupplierForm';
import EmisSiteSimplePicker from '@/views/emis/EmisBaseTools/EmisSiteSimplePicker.vue';
export default {
name: "EmisSupplier",
components: { elDateSimplePicker,emisSupplierForm ,EmisSiteSimplePicker},
dicts: ['emis_biz_shipping_method'
],
data() {
return {
// 遮罩层
loading: true,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 创建时间搜索
dateTimeRange:[],
// 总条数
total: 0,
// 公司供应商表表格数据
emisSupplierList: [],
currentId:null,
openForm: false,
titleForm: "",
// 弹出展示层
id:null,
titleView:"",
openView: false,
// 更新站点时间范围
daterangeCreateTime: [],
// 更新站点时间范围
daterangeUpdateTime: [],
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 20,
code: null,
name: null,
nameEn: null,
settledType: null,
transType: null,
bizSite: null,
bizSiteName: null,
companyName: null,
companyType: null,
licenceNo: null,
country: null,
province: null,
city: null,
district: null,
address: null,
tel: null,
email: null,
contact: null,
phone: null,
status: null,
remark: null,
delFlag: null,
},
};
},
created() {
this.getList();
},
methods: {
/** 查询公司供应商表列表 */
getList() {
this.loading = true;
listEmisSupplier(this.addDateRange(this.queryParams, this.dateTimeRange)).then(response => {
this.emisSupplierList = response.rows;
this.total = response.total;
this.loading = false;
});
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length!==1
this.multiple = !selection.length
},
// 排序 查询字段是表格中字段名字 动态取值排序顺序
handleSortChange(column) {
this.queryParams.orderByColumn = column.prop;
this.queryParams.isAsc = column.order;
this.getList();
},
/** 新增按钮操作 */
handleAdd(row) {
this.currentId=null;
this.openForm= true;
this.titleForm = "新增供应商";
},
handleShowMoreInput(){
this.moreInputVisible = !this.moreInputVisible;
},
/** 修改按钮操作 */
handleUpdate(row) {
this.currentId= row.id||this.ids[0];
this.openForm = true;
this.titleForm = "修改供应商";
},
handleView(row) {
this.id=row.id;
this.titleView="查看";
this.openView=true;
// this.router.push({ path: '/emis/emisSupplier/viewDetail', query: { id: row.id }})
},
handleFormChanged(){
this.openForm = false;
this.getList();
},
cancelForm(){
this.openForm = false;
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$modal.confirm('是否确认删除').then(function() {
return delEmisSupplier(ids);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
// this.download('emis/emisSupplier/export', {
// ...this.queryParams
// }, `emisSupplier_${new Date().getTime()}.xlsx`)
const loadingInstance = this.$loading({
text: '正在导出...'
})
var qParam = {...this.queryParams};
qParam.pageNum=1;
qParam.pageSize=5000;
listEmisSupplier(this.addDateRange(qParam, this.dateTimeRange)).then(response => {
this.downloadLoading = false
if (response.code === 200) {
const curList = response.rows
import('@/vendor/Export2Excel').then(excel => {
const tHeader = ['id','供应商编码','供应商名称','英文简称','结算类型','运输方式','业务网点','业务网点名称,逗号隔开','公司名称','公司类型','营业执照号','所在国','所在省','所在市','所在区','地址','公司电话','电子邮件','联系人','联系电话','状态','备注','删除标志(0代表存在','创建者','创建时间','更新者','更新时间','创建站点','更新站点',];
const filterVal = ['id','code','name','nameEn','settledType','transType','bizSite','bizSiteName','companyName','companyType','licenceNo','country','province','city','district','address','tel','email','contact','phone','status','remark','delFlag','createBy','createTime','updateBy','updateTime','createSite','updateSite',];
const data = this.formatJson(filterVal, curList, response.rows)
excel.export_json_to_excel({
header: tHeader,
data,
filename: '公司供应商表',
autoWidth: true
})
loadingInstance.close()
})
}
});
},
formatJson(filterVal, jsonData, resData) {
let index = 0
return jsonData.map(v => filterVal.map(j => {
if (j === 'index') {
return ++index
}
if (j === 'status') {
var statusStr='xxx'
if(v[j] == 10){
statusStr='xxx'
}
return statusStr;
}
return v[j]
}))
},
/** 列索引函数 */
getIndex($index) {
return (this.queryParams.pageNum - 1) * this.queryParams.pageSize + $index + 1
},
/** 时间搜索响应函数 */
dateTimeChange(value){
this.dateTimeRange=value;
},
}
};
</script>
<style scoped>
.el-divider{
margin-top: 0px;
background: 0 0;
border-top: 1px solid #E6EBF5;
}
.el-divider__text {
color: #0955ee;
cursor: pointer;
}
</style>