emis-frontend/src/views/emis/emisTransLine/index.vue
2026-03-31 14:12:51 +08:00

517 lines
17 KiB
Vue

<template>
<div class="app-container">
<el-row :gutter="10" type='flex'>
<!-- <el-col :span="4" :xs="4">
<CountryTreePicker placeholder="目的国" v-model="queryParams.country" @onNodeClick="handleQuery"></CountryTreePicker>
</el-col> -->
<el-col :span="24" :xs="24">
<SearchForm :model="queryParams" ref="queryForm" size="small" :maxShow="20" label-width="68px" v-show="showSearch" @search="handleQuery" @reset="resetQuery">
<el-form-item label="目的国" prop="country">
<CountryPicker :placeholder="$t('目的国')" v-model="queryParams.country" @onChange="handleQuery"></CountryPicker>
</el-form-item>
<el-form-item label="起始国" prop="fromCountry">
<CountryPicker :placeholder="$t('起始国')" v-model="queryParams.fromCountry" @onChange="handleQuery"></CountryPicker>
</el-form-item>
<el-form-item label="所属品牌" prop="logoType">
<EmisBrandPicker :placeholder="$t('所属品牌')" v-model="queryParams.logoType" @onChange="handleQuery"></EmisBrandPicker>
</el-form-item>
<el-form-item label="线路名称" prop="lineName">
<el-input
v-model="queryParams.lineName"
placeholder="线路名称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="启用状态" prop="status">
<el-select v-model="queryParams.status" no-match-text filterable placeholder="启用状态" @change="handleQuery">
<el-option key="0" label="停用" :value="0" />
<el-option key="1" label="启用" :value="1" />
</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>
</SearchForm>
<!-- :header-cell-style="{background:'#f7f7f7',color:'#606266'}" -->
<XdTable
ref="refTable"
v-loading="loading"
border
stripe
size="mini"
storageName="emisTransLine_main"
:data="emisTransLineList"
:showSearch.sync="showSearch"
:total="total"
@queryTable="getList"
:queryParams="queryParams"
@selection-change="handleSelectionChange"
@sort-change="handleSortChange"
v-if="tableHeight" :max-height="tableHeight + 'px'"
>
<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:emisTransLine: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:emisTransLine: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:emisTransLine: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:emisTransLine:export']"
>导出</el-button>
</el-col>
<el-button style="margin-right: 5px;"
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleBatchAdd"
v-hasPermi="['emis:emisTransLine:draftSubmitTransLine']"
>批量导入</el-button>
</el-row>
</div>
<el-table-column type="selection" width="55" align="center" />
<!-- <el-table-column label="线路编号" align="left" prop="lineCode" :sort-orders="['descending','ascending']" sortable="custom" width="110">
<template slot-scope="scope">
<div class="link-type" @click="handleUpdate(scope.row)">{{scope.row.lineCode}}</div>
</template>
</el-table-column> -->
<el-table-column label="线路名称" align="left" prop="lineName" :sort-orders="['descending','ascending']" sortable="custom" min-width="130">
<template slot-scope="scope">
<div class="link-type" @click="handleUpdate(scope.row)">{{scope.row.lineName}}</div>
</template>
</el-table-column>
<el-table-column label="起始国" align="center" prop="fromCountryName" width="80" />
<el-table-column label="目的国" align="center" prop="countryName" width="80" />
<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="品牌" align="center" prop="logoTypeName" width="150" >
<template slot-scope="scope">
<span v-if="scope.row.logoType=='-1'">全品牌</span>
<span v-else>{{ scope.row.logoTypeName }}</span>
</template>
</el-table-column>
<el-table-column label="泡重比" align="center" prop="meterRate" width="80" />
<!-- <el-table-column label="启用状态" align="center" prop="status" width="80" >
<template slot-scope="scope">
<el-switch
v-model="scope.row.status"
:active-value="1"
:inactive-value="0"
@change="handleStatusChange(scope.row)"
></el-switch>
</template>
</el-table-column> -->
<el-table-column label="启用状态" align="center" prop="status" min-width="100" >
<template slot-scope="scope">
<el-tag v-if="scope.row.status==1" type="success">启用</el-tag>
<el-tag v-if="scope.row.status==0" type="danger">停用</el-tag>
<!-- <dict-tag :options="dict.type.sys_biz_enable_status" :value="scope.row.status"/> -->
</template>
</el-table-column>
<el-table-column label="负责人" align="center" prop="transManager" width="100" />
<el-table-column label="排序" align="center" prop="orderNum" width="100" :sort-orders="['descending','ascending']" sortable="custom" />
<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"/>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['emis:emisTransLine:edit']"
>修改</el-button>
<!--
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['emis:emisTransLine:remove']"
>删除</el-button> -->
</template>
</el-table-column>
</XdTable>
</el-col>
</el-row>
<el-dialog :title="titleForm" :visible.sync="openForm" width="50%" :destroy-on-close="true" append-to-body>
<emisTransLineForm :id="currentId" @on-changed="handleFormChanged" @on-cancel="cancelForm"></EmisTransLineForm>
</el-dialog>
<!-- 批量导入弹窗 -->
<el-dialog :title="batchAddTitleForm" :visible.sync="openBatchAdd" width="50%" :destroy-on-close="true" append-to-body>
<BatchImportTransLine></BatchImportTransLine>
</el-dialog>
</div>
</template>
<script>
import { listEmisTransLine, delEmisTransLine, addEmisTransLine, updateEmisTransLine,changeTransLineStatus } from "@/api/emis/emisTransLine";
import emisTransLineForm from '@/views/emis/emisTransLine/emisTransLineForm';
import CountryTreePicker from '@/views/emis/EmisBaseTools/CountryTreePicker.vue';
import CountryPicker from '@/views/emis/EmisBaseTools/CountryPicker.vue';
import EmisBrandPicker from '@/views/emis/EmisBaseTools/EmisBrandPicker.vue';
import BatchImportTransLine from '@/views/emis/emisTransLine/batchImportTransLine.vue';
export default {
name: "EmisTransLine",
components: { CountryTreePicker,emisTransLineForm,CountryPicker,EmisBrandPicker,BatchImportTransLine},
dicts: ['sys_normal_disable','emis_biz_shipping_method','emis_affiliate_type'],
data() {
return {
tableHeight: 200,
// 遮罩层
loading: true,
// 选中数组
ids: [],
countryName:null,
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 创建时间搜索
dateTimeRange:[],
// 总条数
total: 0,
// 线路表格数据
emisTransLineList: [],
countryTree:[],
countryIdsOptions:[],
logoTypeIdsOptions:[],
// 弹出层标题
title: "",
currentId:null,
// 是否显示弹出层
open: false,
defaultProps: {
children: "children",
label: "label"
},
openForm: false,
titleForm: "",
titleEmisTransLine: "",
openEmisTransLine: false,
// 显示编辑框更多
moreInputVisible: false,
// 弹出展示层
id:null,
titleView:"",
openView: false,
openBatchAdd: false,
batchAddTitleForm: "",
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 20,
lineCode: null,
lineName: null,
status: null,
siteAuditMan: null,
siteAuditManCode: null,
marketMan: null,
marketManCode: null,
operateMan: null,
operateManCode: null,
country: null,
applyScope: null,
logoType: null
},
// 表单参数
form: {},
// 表单校验
rules: {
}
};
},
created() {
this.getList();
this.$nextTick(function() {
let queryFormEl = this.$refs.queryForm.$el;
let tableH = queryFormEl.offsetHeight+190;
this.tableHeight = window.innerHeight - tableH;
});
},
watch: {
// 根据名称筛选部门树
countryName(val) {
this.$refs.tree.filter(val);
}
},
methods: {
/** 查询线路列表 */
getList() {
this.loading = true;
listEmisTransLine(this.queryParams).then(response => {
this.emisTransLineList = response.rows;
this.total = response.total;
this.loading = false;
});
},
// 排序 查询字段是表格中字段名字 动态取值排序顺序
handleSortChange(column) {
this.queryParams.orderByColumn = column.prop;
this.queryParams.isAsc = column.order;
this.getList();
},
// 取消按钮
cancel() {
this.open = false;
this.reset();
},
handleStatusChange(row) {
let text = row.status === 1 ? "启用" : "停用";
this.$modal.confirm('确认要"' + text + '""' + row.lineName + '"线路吗?').then(function() {
//改变线路的启用状态
return changeTransLineStatus(row.id, row.status);
}).then(() => {
this.$modal.msgSuccess(text + "成功");
}).catch(function() {
// row.status =
// row.status = row.status === 1 ? "1" : "0";
});
},
// 节点单击事件
handleNodeClick(data) {
this.queryParams.countryId = data.id;
this.handleCountryAreaQuery();
},
/** 搜索按钮操作 */
handleCountryAreaQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
// 表单重置
reset() {
this.form = {
id: null,
lineCode: null,
lineName: null,
status: null,
siteAuditMan: null,
siteAuditManCode: null,
marketMan: null,
marketManCode: null,
operateMan: null,
operateManCode: null,
country: null,
applyScope: null,
logoType: null
};
this.resetForm("form");
},
/** 搜索按钮操作 */
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
},
/** 新增按钮操作 */
handleAdd(row) {
// 子组件打开模式
this.currentId= null;
this.openForm = true;
this.titleForm = "新增线路";
},
handleShowMoreInput(){
this.moreInputVisible = !this.moreInputVisible;
},
/** 修改按钮操作 */
handleUpdate(row) {
// 子组件打开模式
this.currentId=row.id;
this.openForm = true;
this.titleForm = "修改";
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.id != null) {
updateEmisTransLine(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addEmisTransLine(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
handleFormChanged(){
this.openForm = false;
this.getList();
},
cancelForm(){
this.openForm = false;
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$modal.confirm('是否确认删除').then(function() {
return delEmisTransLine(ids);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
const loadingInstance = this.$loading({
text: '正在导出...'
})
const qParam = { ...this.queryParams }
qParam.pageNum = 1
qParam.pageSize = 5000
listEmisTransLine(this.addDateRange(qParam, this.dateTimeRange)).then(response => {
if (response.code === 200) {
this.exportData(response.rows, loadingInstance)
return
}
loadingInstance.close()
}).catch(() => {
loadingInstance.close()
})
},
exportData(selData, loadingInstance) {
const curList = selData || []
import('@/vendor/Export2Excel').then(excel => {
const exportParam = this.$refs.refTable.getExportParam()
const tHeader = exportParam.header
const filterVal = exportParam.filter
const data = this.formatJson(filterVal, curList)
excel.export_json_to_excel({
header: tHeader,
data,
filename: '线路',
autoWidth: true
})
loadingInstance.close()
}).catch(() => {
loadingInstance.close()
})
},
formatJson(filterVal, jsonData) {
let index = 0
return jsonData.map(v => filterVal.map(j => {
if (j === 'index') {
return ++index
}
if (j === 'status' && (v[j] === 0 || v[j] === 1 || v[j] === '0' || v[j] === '1')) {
return Number(v[j]) === 1 ? '启用' : '停用'
}
return v[j]
}))
},
/** 列索引函数 */
getIndex($index) {
return (this.queryParams.pageNum - 1) * this.queryParams.pageSize + $index + 1
},
/** 时间搜索响应函数 */
dateTimeChange(value){
this.dateTimeRange=value;
},
handleBatchAdd(){
this.openBatchAdd= true;
this.batchAddTitleForm = "批量导入";
},
}
};
</script>
<style scoped>
.el-divider{
margin-top: 0px;
background: 0 0;
border-top: 1px solid #E6EBF5;
}
.el-divider__text {
color: #0955ee;
cursor: pointer;
}
</style>