emis-frontend/src/views/emis/emisDestination/index.vue

469 lines
16 KiB
Vue
Raw Normal View History

2024-01-10 05:16:16 +00:00
<template>
2024-06-03 01:40:23 +00:00
<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">
2024-04-22 05:33:25 +00:00
2024-05-11 01:28:52 +00:00
<el-form-item :label="$t('所属国家')" prop="country">
2024-04-22 05:33:25 +00:00
<CountryPicker :placeholder="$t('所属国家')" v-model="queryParams.country" @onChange="handleQuery"></CountryPicker>
</el-form-item>
2024-05-12 15:21:00 +00:00
<!-- <el-form-item :label="$t('所属线路')" prop="lineCode">
2024-04-22 05:33:25 +00:00
<TransLinePicker :placeholder="$t('所属线路')" v-model="queryParams.lineCode" :countryCode="queryParams.country" @onChange="handleQuery"></TransLinePicker>
2024-05-12 15:21:00 +00:00
</el-form-item> -->
2024-04-22 05:33:25 +00:00
2024-05-11 01:28:52 +00:00
<el-form-item :label="$t('目的地名称')" prop="destName" label-width="90px">
2024-01-11 07:32:51 +00:00
<el-input
2024-04-22 05:33:25 +00:00
v-model="queryParams.destName"
placeholder="目的地名称"
clearable
@keyup.enter.native="handleQuery"
2024-01-11 07:32:51 +00:00
/>
2024-04-22 05:33:25 +00:00
</el-form-item>
2024-05-11 01:28:52 +00:00
<el-form-item :label="$t('目的地编码')" prop="destCode" label-width="90px">
2024-04-22 05:33:25 +00:00
<el-input
v-model="queryParams.destCode"
placeholder="目的地编码"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
2024-05-11 01:28:52 +00:00
<el-form-item :label="$t('服务网点')" prop="siteCode">
2024-04-22 05:33:25 +00:00
<EmisSiteSimplePicker :placeholder="$t('服务网点')" :countryCode="queryParams.country" v-model="queryParams.siteCode" @onChange="handleQuery"></EmisSiteSimplePicker>
</el-form-item>
2024-05-11 01:28:52 +00:00
<el-form-item :label="$t('是否偏远地区')" prop="isHinterland" label-width="110px">
2024-04-22 05:33:25 +00:00
<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>
2024-05-11 01:28:52 +00:00
<el-form-item :label="$t('启用状态')" prop="status">
<el-select v-model="queryParams.status" no-match-text filterable :placeholder="$t('启用状态')" @change="handleQuery">
2024-04-22 05:33:25 +00:00
<el-option key="0" label="未启用" :value="0" />
<el-option key="1" label="启用" :value="1" />
</el-select>
</el-form-item>
</SearchForm>
<XdTable
2024-06-03 01:40:23 +00:00
slot="pageContent"
slot-scope="slotProps"
:height="(slotProps.contentHeight)+'px'"
2024-04-22 05:33:25 +00:00
v-loading="loading"
border
stripe
size="mini"
:data="emisDestinationList"
:showSearch.sync="showSearch"
:total="total"
@queryTable="getList"
:queryParams="queryParams"
@selection-change="handleSelectionChange"
@sort-change="handleSortChange"
2024-01-11 07:32:51 +00:00
>
2024-01-10 05:16:16 +00:00
2024-04-22 05:33:25 +00:00
<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-row>
</div>
2024-01-10 05:16:16 +00:00
<el-table-column type="selection" width="55" align="center" />
2024-04-22 05:33:25 +00:00
<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>
2024-01-11 07:32:51 +00:00
<!-- <el-table-column label="目的地名称" align="center" prop="destName" min-width="100" /> -->
2024-04-22 05:33:25 +00:00
<el-table-column label="目的地名称" align="left" prop="destName" min-width="180">
2024-01-10 05:16:16 +00:00
<template slot-scope="scope">
2024-04-22 05:33:25 +00:00
<div class="link-type" @click="handleUpdate(scope.row)">{{scope.row.destName}}</div>
2024-01-10 05:16:16 +00:00
</template>
</el-table-column>
2024-01-11 07:32:51 +00:00
<!-- <el-table-column label="英文名称" align="center" prop="destNameEn" min-width="100" /> -->
2024-04-22 05:33:25 +00:00
<el-table-column label="所属国家" align="center" prop="countryName" width="100" />
2024-05-12 15:21:00 +00:00
<!-- <el-table-column label="所属线路" align="center" prop="lineName" width="100" /> -->
2024-04-22 05:33:25 +00:00
2024-01-11 07:37:01 +00:00
<!-- <el-table-column label="服务网点" align="center" prop="siteCode" min-width="100" /> -->
2024-04-22 05:33:25 +00:00
<el-table-column label="服务网点" align="center" prop="siteName" width="120">
2024-01-11 07:37:01 +00:00
<template slot-scope="scope">
2024-04-22 05:33:25 +00:00
<div>{{scope.row.siteCode}}({{scope.row.siteName}})</div>
2024-01-11 07:37:01 +00:00
</template>
</el-table-column>
2024-04-22 05:33:25 +00:00
<el-table-column label="服务片区" align="center" prop="countryAreaName" width="100" />
<!-- <el-table-column label="省市区" align="left" prop="province" width="100">
2024-01-11 07:32:51 +00:00
<template slot-scope="scope">
2024-04-22 05:33:25 +00:00
<div>{{scope.row.provinceName}} {{scope.row.cityName}} {{scope.row.countyName}}</div>
2024-01-11 07:32:51 +00:00
</template>
2024-04-22 05:33:25 +00:00
</el-table-column> -->
2024-01-11 07:32:51 +00:00
<!-- <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" /> -->
2024-04-22 05:33:25 +00:00
<el-table-column label="偏远地区" align="center" prop="isHinterland" width="80" >
2024-01-11 06:01:38 +00:00
<template slot-scope="scope">
2024-01-11 07:32:51 +00:00
<dict-tag :options="dict.type.emis_is_hinterland" :value="scope.row.isHinterland"/>
2024-01-11 06:01:38 +00:00
</template>
</el-table-column>
2024-05-11 01:28:52 +00:00
<el-table-column label="启用状态" align="center" prop="status" min-width="80" >
2024-05-10 05:30:02 +00:00
<template slot-scope="scope">
2024-05-11 01:28:52 +00:00
<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"/> -->
2024-05-10 05:30:02 +00:00
</template>
2024-05-11 01:28:52 +00:00
</el-table-column>
2024-06-02 09:59:42 +00:00
<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"/>
2024-05-22 22:44:51 +00:00
<el-table-column label="创建时间" align="center" prop="createTime" width="170"/>
2024-06-02 09:59:42 +00:00
<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"/>
2024-05-22 22:44:51 +00:00
<el-table-column label="修改时间" align="center" prop="updateTime" width="170"/>
2024-01-10 05:16:16 +00:00
<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)"
2024-01-11 07:32:51 +00:00
v-hasPermi="['emis:emisDestination:edit']"
2024-01-10 05:16:16 +00:00
>修改</el-button>
2024-01-11 06:01:38 +00:00
<!--
2024-01-10 05:16:16 +00:00
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
2024-01-11 07:32:51 +00:00
v-hasPermi="['emis:emisDestination:remove']"
2024-01-10 05:16:16 +00:00
>删除</el-button> -->
</template>
</el-table-column>
2024-04-22 05:33:25 +00:00
</XdTable>
2024-01-10 05:16:16 +00:00
2024-05-25 12:27:29 +00:00
<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>
2024-05-12 15:21:00 +00:00
<!-- append-to-body
:destroy-on-close="true"
2024-05-25 12:27:29 +00:00
:destroy-on-close="true"
2024-05-12 15:21:00 +00:00
-->
2024-01-10 05:16:16 +00:00
2024-06-03 01:40:23 +00:00
</XdPageContainer>
2024-01-10 05:16:16 +00:00
</template>
<script>
2024-01-11 07:32:51 +00:00
import { listEmisDestination, getEmisDestination, delEmisDestination, addEmisDestination, updateEmisDestination, changeDescStatus } from "@/api/emis/emisDestination";
2024-04-22 05:33:25 +00:00
2024-01-11 07:32:51 +00:00
import emisDestinationForm from '@/views/emis/emisDestination/emisDestinationForm';
2024-01-10 05:16:16 +00:00
2024-04-22 05:33:25 +00:00
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';
2024-01-10 05:16:16 +00:00
export default {
2024-01-11 07:32:51 +00:00
name: "emisDestination",
2024-04-22 05:33:25 +00:00
components: { CountryTreePicker,CountryPicker,TransLinePicker,EmisSiteSimplePicker,emisDestinationForm },
2024-01-10 05:16:16 +00:00
dicts: [
2024-01-11 07:37:01 +00:00
'sys_normal_disable','emis_is_hinterland'
2024-01-10 05:16:16 +00:00
],
data() {
return {
// 遮罩层
loading: true,
2024-01-11 07:32:51 +00:00
currentId:null,
countryName:null,
2024-01-10 05:16:16 +00:00
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 创建时间搜索
dateTimeRange:[],
// 总条数
total: 0,
2024-01-11 07:32:51 +00:00
// 目的地表格数据
emisDestinationList: [],
countryTree:[],
countryIdsOptions:[],
2024-01-11 12:51:48 +00:00
siteIdsOptions:[],
2024-01-10 05:16:16 +00:00
// 弹出层标题
title: "",
2024-01-11 07:32:51 +00:00
defaultProps: {
children: "children",
label: "label"
},
2024-01-10 05:16:16 +00:00
// 是否显示弹出层
open: false,
openForm: false,
titleForm: "",
2024-01-11 07:32:51 +00:00
titleEmisDestination: "",
openEmisDestination: false,
2024-01-10 05:16:16 +00:00
// 显示编辑框更多
moreInputVisible: false,
// 弹出展示层
id:null,
titleView:"",
openView: false,
// 备注时间范围
daterangeCreateTime: [],
// 备注时间范围
daterangeUpdateTime: [],
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 20,
2024-01-11 07:32:51 +00:00
destCode: null,
destName: null,
2024-01-10 05:16:16 +00:00
status: null,
2024-04-22 05:33:25 +00:00
lineCode: null,
2024-01-11 07:32:51 +00:00
siteCode: null,
province: null,
city: null,
county: null,
town: null,
remark: null,
countryId:null,
country:null,
2024-01-10 05:16:16 +00:00
},
2024-04-22 05:33:25 +00:00
2024-01-10 05:16:16 +00:00
};
},
created() {
this.getList();
2024-01-11 07:32:51 +00:00
},
watch: {
// 根据名称筛选部门树
countryName(val) {
this.$refs.tree.filter(val);
}
2024-01-10 05:16:16 +00:00
},
methods: {
2024-01-11 07:32:51 +00:00
handleStatusChange(row) {
let text = row.status === "0" ? "启用" : "停用";
2024-01-11 12:51:48 +00:00
this.$modal.confirm('确认要"' + text + '""' + row.destName + '"目的地吗?').then(function() {
2024-01-11 07:32:51 +00:00
//改变线路的启用状态
2024-01-11 12:51:48 +00:00
return changeDestStatus(row.id, row.status);
2024-01-11 07:32:51 +00:00
}).then(() => {
this.$modal.msgSuccess(text + "成功");
}).catch(function() {
row.status = row.status === "0" ? "1" : "0";
});
},
/** 查询目的地列表 */
2024-01-10 05:16:16 +00:00
getList() {
this.loading = true;
this.queryParams.params = {};
2024-01-11 07:32:51 +00:00
listEmisDestination(this.addDateRange(this.queryParams, this.dateTimeRange)).then(response => {
this.emisDestinationList = response.rows;
2024-01-10 05:16:16 +00:00
this.total = response.total;
this.loading = false;
});
},
2024-04-22 05:33:25 +00:00
handleSortChange(){
2024-01-11 07:32:51 +00:00
},
2024-01-10 05:16:16 +00:00
// 取消按钮
cancel() {
this.open = false;
this.reset();
},
2024-04-22 05:33:25 +00:00
2024-01-10 05:16:16 +00:00
/** 搜索按钮操作 */
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) {
2024-04-22 05:33:25 +00:00
// 子组件打开模式
this.currentId= null;
this.openForm = true;
this.titleForm = "新增";
2024-01-10 05:16:16 +00:00
},
handleShowMoreInput(){
this.moreInputVisible = !this.moreInputVisible;
},
/** 修改按钮操作 */
handleUpdate(row) {
// 子组件打开模式
2024-04-22 05:33:25 +00:00
this.currentId= row.id;
this.openForm = true;
this.titleForm = "修改";
2024-01-10 05:16:16 +00:00
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.id != null) {
2024-01-11 07:32:51 +00:00
updateEmisDestination(this.form).then(response => {
2024-01-10 05:16:16 +00:00
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
2024-01-11 07:32:51 +00:00
addEmisDestination(this.form).then(response => {
2024-01-10 05:16:16 +00:00
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() {
2024-01-11 07:32:51 +00:00
return delEmisDestination(ids);
2024-01-10 05:16:16 +00:00
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
2024-01-11 07:32:51 +00:00
// this.download('emis/emisDestination/export', {
2024-01-10 05:16:16 +00:00
// ...this.queryParams
2024-01-11 07:32:51 +00:00
// }, `emisDestination_${new Date().getTime()}.xlsx`)
2024-01-10 05:16:16 +00:00
const loadingInstance = this.$loading({
text: '正在导出...'
})
var qParam = {...this.queryParams};
qParam.pageNum=1;
qParam.pageSize=5000;
2024-01-11 07:32:51 +00:00
listEmisDestination(this.addDateRange(qParam, this.dateTimeRange)).then(response => {
2024-01-10 05:16:16 +00:00
this.downloadLoading = false
if (response.code === 200) {
const curList = response.rows
import('@/vendor/Export2Excel').then(excel => {
2024-01-11 07:32:51 +00:00
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',];
2024-01-10 05:16:16 +00:00
const data = this.formatJson(filterVal, curList, response.rows)
excel.export_json_to_excel({
header: tHeader,
data,
2024-01-11 07:32:51 +00:00
filename: '目的地',
2024-01-10 05:16:16 +00:00
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>