emis-frontend/src/views/emis/emisDestination/index.vue
2026-03-26 09:39:14 +08:00

488 lines
17 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="10" label-width="90px" v-show="showSearch" @search="handleQuery" @reset="resetQuery">
<el-form-item :label="$t('所属国家')" prop="country">
<CountryPicker :placeholder="$t('所属国家')" v-model="queryParams.country" @onChange="handleQuery"></CountryPicker>
</el-form-item>
<!-- <el-form-item :label="$t('所属线路')" prop="lineCode">
<TransLinePicker :placeholder="$t('所属线路')" v-model="queryParams.lineCode" :countryCode="queryParams.country" @onChange="handleQuery"></TransLinePicker>
</el-form-item> -->
<el-form-item :label="$t('目的地名称')" prop="destName" label-width="90px">
<el-input
v-model="queryParams.destName"
placeholder="目的地名称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item :label="$t('目的地编码')" prop="destCode" label-width="90px">
<el-input
v-model="queryParams.destCode"
placeholder="目的地编码"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item :label="$t('服务网点')" prop="siteCode">
<EmisSiteSimplePicker :placeholder="$t('服务网点')" :countryCode="queryParams.country" v-model="queryParams.siteCode" @onChange="handleQuery"></EmisSiteSimplePicker>
</el-form-item>
<el-form-item :label="$t('是否偏远地区')" prop="isHinterland" label-width="110px">
<el-select v-model="queryParams.isHinterland" placeholder="是否偏远地区" clearable>
<el-option
v-for="dict in dict.type.emis_is_hinterland"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item :label="$t('启用状态')" prop="status">
<el-select v-model="queryParams.status" no-match-text filterable :placeholder="$t('启用状态')" @change="handleQuery">
<el-option key="0" label="未启用" :value="0" />
<el-option key="1" label="启用" :value="1" />
</el-select>
</el-form-item>
</SearchForm>
<XdTable
slot="pageContent"
slot-scope="slotProps"
:height="(slotProps.contentHeight)+'px'"
v-loading="loading"
border
stripe
size="mini"
:data="emisDestinationList"
:showSearch.sync="showSearch"
:total="total"
@queryTable="getList"
:queryParams="queryParams"
@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:emisDestination: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:emisDestination: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:emisDestination: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:emisDestination: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:emisDestination:draftSubmitDestination']"
>批量导入</el-button>
</el-row>
</div>
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="编码" align="center" prop="destCode" width="80" >
<template slot-scope="scope">
<div class="link-type" @click="handleUpdate(scope.row)">{{scope.row.destCode}}</div>
</template>
</el-table-column>
<!-- <el-table-column label="目的地名称" align="center" prop="destName" min-width="100" /> -->
<el-table-column label="目的地名称" align="left" prop="destName" min-width="180">
<template slot-scope="scope">
<div class="link-type" @click="handleUpdate(scope.row)">{{scope.row.destName}}</div>
</template>
</el-table-column>
<!-- <el-table-column label="英文名称" align="center" prop="destNameEn" min-width="100" /> -->
<el-table-column label="所属国家" align="center" prop="countryName" width="100" />
<!-- <el-table-column label="所属线路" align="center" prop="lineName" width="100" /> -->
<!-- <el-table-column label="服务网点" align="center" prop="siteCode" min-width="100" /> -->
<el-table-column label="服务网点" align="center" prop="siteName" width="120">
<template slot-scope="scope">
<div>{{scope.row.siteCode}}({{scope.row.siteName}})</div>
</template>
</el-table-column>
<el-table-column label="服务片区" align="center" prop="countryAreaName" width="100" />
<!-- <el-table-column label="省市区" align="left" prop="province" width="100">
<template slot-scope="scope">
<div>{{scope.row.provinceName}} {{scope.row.cityName}} {{scope.row.countyName}}</div>
</template>
</el-table-column> -->
<!-- <el-table-column label="省" align="center" prop="province" min-width="100" /> -->
<!-- <el-table-column label="市" align="center" prop="city" min-width="100" /> -->
<!-- <el-table-column label="区" align="center" prop="county" min-width="100" /> -->
<!-- <el-table-column label="乡镇" align="center" prop="town" min-width="100" /> -->
<el-table-column label="偏远地区" align="center" prop="isHinterland" width="80" >
<template slot-scope="scope">
<dict-tag :options="dict.type.emis_is_hinterland" :value="scope.row.isHinterland"/>
</template>
</el-table-column>
<el-table-column label="启用状态" align="center" prop="status" min-width="80" >
<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="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:emisDestination:edit']"
>修改</el-button>
<!--
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['emis:emisDestination:remove']"
>删除</el-button> -->
</template>
</el-table-column>
</XdTable>
<template>
<el-dialog :title="titleForm" :visible.sync="openForm" width="50%" v-dialogDrag append-to-body>
<emisDestinationForm :id="currentId" @on-changed="handleFormChanged" @on-cancel="cancelForm"></EmisDestinationForm>
</el-dialog>
</template>
<!-- append-to-body
:destroy-on-close="true"
:destroy-on-close="true"
-->
<!-- 批量导入弹出层 -->
<el-dialog :title="batchAddTitleForm" :visible.sync="openBatchAdd" width="50%" v-dialogDrag append-to-body>
<batchImportDestination></batchImportDestination>
</el-dialog>
</XdPageContainer>
</template>
<script>
import { listEmisDestination, getEmisDestination, delEmisDestination, addEmisDestination, updateEmisDestination, changeDescStatus } from "@/api/emis/emisDestination";
import batchImportDestination from '@/views/emis/emisDestination/batchImportDestination.vue';
import emisDestinationForm from '@/views/emis/emisDestination/emisDestinationForm';
import CountryTreePicker from '@/views/emis/EmisBaseTools/CountryTreePicker.vue';
import CountryPicker from '@/views/emis/EmisBaseTools/CountryPicker.vue';
import TransLinePicker from '@/views/emis/EmisBaseTools/TransLinePicker.vue';
import EmisSiteSimplePicker from '@/views/emis/EmisBaseTools/EmisSiteSimplePicker.vue';
export default {
name: "EmisDestination",
components: { CountryTreePicker,CountryPicker,TransLinePicker,EmisSiteSimplePicker,emisDestinationForm,batchImportDestination },
dicts: [
'sys_normal_disable','emis_is_hinterland'
],
data() {
return {
// 遮罩层
loading: true,
currentId:null,
countryName:null,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 创建时间搜索
dateTimeRange:[],
// 总条数
total: 0,
// 目的地表格数据
emisDestinationList: [],
countryTree:[],
countryIdsOptions:[],
siteIdsOptions:[],
// 弹出层标题
title: "",
defaultProps: {
children: "children",
label: "label"
},
// 是否显示弹出层
open: false,
openForm: false,
titleForm: "",
titleEmisDestination: "",
openEmisDestination: false,
// 显示编辑框更多
moreInputVisible: false,
// 弹出展示层
id:null,
titleView:"",
openView: false,
// 备注时间范围
daterangeCreateTime: [],
// 备注时间范围
daterangeUpdateTime: [],
// 批量导入弹出层
openBatchAdd: false,
batchAddTitleForm: "",
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 20,
destCode: null,
destName: null,
status: null,
lineCode: null,
siteCode: null,
province: null,
city: null,
county: null,
town: null,
remark: null,
countryId:null,
country:null,
},
};
},
created() {
this.getList();
},
watch: {
// 根据名称筛选部门树
countryName(val) {
this.$refs.tree.filter(val);
}
},
methods: {
handleStatusChange(row) {
let text = row.status === "0" ? "启用" : "停用";
this.$modal.confirm('确认要"' + text + '""' + row.destName + '"目的地吗?').then(function() {
//改变线路的启用状态
return changeDestStatus(row.id, row.status);
}).then(() => {
this.$modal.msgSuccess(text + "成功");
}).catch(function() {
row.status = row.status === "0" ? "1" : "0";
});
},
/** 查询目的地列表 */
getList() {
this.loading = true;
this.queryParams.params = {};
listEmisDestination(this.addDateRange(this.queryParams, this.dateTimeRange)).then(response => {
this.emisDestinationList = response.rows;
this.total = response.total;
this.loading = false;
});
},
handleSortChange(){
},
// 取消按钮
cancel() {
this.open = false;
this.reset();
},
/** 搜索按钮操作 */
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) {
updateEmisDestination(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addEmisDestination(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 delEmisDestination(ids);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
// this.download('emis/emisDestination/export', {
// ...this.queryParams
// }, `emisDestination_${new Date().getTime()}.xlsx`)
const loadingInstance = this.$loading({
text: '正在导出...'
})
var qParam = {...this.queryParams};
qParam.pageNum=1;
qParam.pageSize=5000;
listEmisDestination(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','destCode','destName','destNameEn','status','country','transLineCode','transLine','siteCode','siteName','province','city','county','town','remark','tenantId','delFlag','createBy','createTime','updateBy','updateTime',];
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;
},
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>