emis-frontend/src/views/emis/emisQuoteDispArea/dispAreaPanel.vue
2024-06-24 09:22:55 +08:00

330 lines
11 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>
<div>
<el-row :gutter="0" type='flex' style="min-height: 400px;">
<el-col :span="14" :xs="14" style="border-right: 1px solid #f3f3f3;padding-right: 5px;">
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
plain
type="primary"
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['emis:emisQuoteDispArea: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:emisQuoteDispArea: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:emisQuoteDispArea:remove']"
>删除</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="primary"
size="mini"
@click="handleSelect"
v-hasPermi="['emis:emisQuoteDispArea:query']"
>使用选中区域</el-button>
</el-col>
<el-col :span="1.5">
<el-button
plain
type="primary"
icon="el-icon-plus"
size="mini"
@click="handleAddSite"
v-hasPermi="['emis:emisQuoteDispArea:edit']"
>追加网点</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:emisQuoteDispArea:export']"
>导出</el-button>
</el-col> -->
</el-row>
<el-form style="text-align: right;" :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="区域名称" prop="areaName" style="margin-bottom:5px">
<el-input
v-model="queryParams.areaName"
placeholder="区域名称"
clearable
size="mini"
@input="handleQuery"
/>
</el-form-item>
</el-form>
<el-table
size="mini"
ref="areaTable"
border
highlight-current-row
v-loading="loading"
:data="emisQuoteDispAreaList"
@selection-change="handleSelectionChange"
@row-click="handleSelectArea"
max-height="350px"
>
<el-table-column type="selection" width="55" align="center" />
<el-table-column :label="$t('报价区域名称')" align="center" prop="areaName" min-width="100" />
<el-table-column :label="$t('所属网点')" align="center" prop="useSite" min-width="100" />
<!-- <el-table-column :label="$t('使用站点代码')" align="center" prop="useSiteCode" min-width="100" /> -->
<!-- <el-table-column :label="$t('区域站点列表')" align="center" prop="areaSite" min-width="100" /> -->
<!-- <el-table-column :label="$t('费用类型')" align="center" prop="feeType" min-width="100" /> -->
<el-table-column :label="$t('费用类型')" align="center" prop="feeType" width="100" >
<template slot-scope="scope">
<dict-tag :options="dict.type.emis_fee_type" :value="scope.row.feeType"/>
</template>
</el-table-column>
<el-table-column :label="$t('区域类型')" align="center" prop="areaType" min-width="80" >
<template slot-scope="scope">
<span v-if="scope.row.areaType == -1">全部</span>
<span v-else>网点</span>
</template>
</el-table-column>
<!-- <el-table-column :label="$t('同步类型')" align="center" prop="sync" min-width="100" /> -->
<!-- <el-table-column :label="$t('启用状态')" align="center" prop="status" min-width="100" /> -->
<!-- <el-table-column :label="$t('备注')" align="center" prop="remark" min-width="100" /> -->
<!-- <el-table-column :label="$t('删除标志(0代表存在')" align="center" prop="delFlag" min-width="100" /> -->
<!-- <el-table-column :label="$t('操作')" 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:emisQuoteDispArea:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['emis:emisQuoteDispArea:remove']"
>删除</el-button>
</template>
</el-table-column> -->
</el-table>
</el-col>
<el-col :span="10" :xs="10" >
<EmisQuoteDispAreaForm :areaObj="currentArea" :feeType="feeType" :useSiteCode="useSiteCode" :useSiteName="useSiteName" :opType="formOpType" @on-changed="handleFormChanged" @on-cancel="cancelForm"></EmisQuoteDispAreaForm>
</el-col>
</el-row>
</div>
</template>
<script>
import { listEmisQuoteDispArea, getEmisQuoteDispArea, delEmisQuoteDispArea, addEmisQuoteDispArea, updateEmisQuoteDispArea } from "@/api/emis/emisQuoteDispArea";
import EmisQuoteDispAreaForm from '@/views/emis/emisQuoteDispArea/emisQuoteDispAreaForm';
export default {
name: "emisQuoteDispArea",
props:{
useSiteCode:{
type:String
},
useSiteName:{
type:String
},
feeType:{
type:String
}
},
components: {EmisQuoteDispAreaForm },
dicts: ['emis_fee_type'],
data() {
return {
// 遮罩层
loading: true,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 创建时间搜索
dateTimeRange:[],
// 总条数
total: 0,
// 寄件区域表格数据
emisQuoteDispAreaList: [],
formOpType:null,
currentId:null,
currentArea:null,
openForm: false,
titleForm: "",
// 弹出展示层
areaId:null,
// 更新网点时间范围
daterangeCreateTime: [],
// 更新网点时间范围
daterangeUpdateTime: [],
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 1000,
areaName: null,
useSite: null,
useSiteCode: null,
areaSite: null,
feeType: null,
areaType: null,
sync: null,
status: null,
remark: null,
delFlag: null,
},
};
},
watch: {
useSiteCode(newVal){
this.getList();
},
feeType(newVal){
this.getList();
},
},
created() {
this.getList();
},
methods: {
/** 查询寄件区域列表 */
getList() {
this.loading = true;
listEmisQuoteDispArea(this.queryParams).then(response => {
this.emisQuoteDispAreaList = response.rows;
this.total = response.total;
this.loading = false;
});
},
handleSelectArea(row, event, column){
this.currentId=row.areaId;
this.currentArea = row;
// let index = this.ids.findIndex(item => {
// // 判断已选数组中是否已存在该条数据
// return item.id == row.id
// })
// if (index == -1) {
// // 如果未存在,设置已选状态,并在list中添加这条数据
// this.$refs.areaTable.toggleRowSelection(row, true); //设置复选框为选中状态
// this.ids.push(row)
// } else {
// // 如果已存在,设置未选状态,并在list中删除这条数据
// this.$refs.areaTable.toggleRowSelection(row, false); //设置复选框为未选状态
// this.ids.splice(index, 1)
// }
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum=1,
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map(item => item.areaId)
this.currentId=this.ids.slice(-1)*1;
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.formOpType = 1;
},
handleSelect(){
this.$emit("on-changed",this.currentId);
},
handleAddSite(){
this.formOpType = 3;
},
/** 修改按钮操作 */
handleUpdate(row) {
this.currentId= row.areaId;
this.formOpType = 2;
},
handleFormChanged(){
this.getList();
},
cancelForm(){
this.formOpType = 0;
},
/** 删除按钮操作 */
handleDelete(row) {
const areaIds = row.areaId || this.ids;
this.$modal.confirm('是否确认删除').then(function() {
return delEmisQuoteDispArea(areaIds);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
/** 列索引函数 */
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>