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

576 lines
18 KiB
Vue
Raw Normal View History

2024-01-10 07:38:42 +00:00
<template>
<div class="app-container">
2024-01-12 12:08:57 +00:00
<el-row :gutter="20" type='flex'>
<el-col :span="5" :xs="5">
<div class="head-container">
<el-row :gutter="10">
<el-col :span="15" :xs="15">
<el-input
v-model="countryName"
placeholder="国家名称"
clearable
size="small"
prefix-icon="el-icon-search"
style="margin-bottom: 20px"
/>
</el-col>
</el-row>
</div>
<div class="head-container">
<el-tree
ref="tree"
class="filter-tree tree"
:data="countryTree"
:props="defaultProps"
:expand-on-click-node="false"
:filter-node-method="filterNode"
node-key="id"
highlight-current
default-expand-all
@node-click="handleNodeClick"
>
</el-tree>
</div>
</el-col>
<el-col :span="20" :xs="20">
2024-01-10 07:38:42 +00:00
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
2024-01-11 06:38:10 +00:00
<el-form-item label="" prop="country">
2024-01-10 07:38:42 +00:00
<el-input
2024-01-11 06:38:10 +00:00
v-model="queryParams.country"
2024-01-12 12:08:57 +00:00
placeholder="名称"
2024-01-10 07:38:42 +00:00
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
2024-01-12 12:08:57 +00:00
<!--
2024-01-11 06:38:10 +00:00
<el-form-item label="" prop="noCalcDay">
<el-date-picker clearable
v-model="queryParams.noCalcDay"
type="date"
value-format="yyyy-MM-dd HH:mm:ss"
placeholder="请选择不计时效日期">
</el-date-picker>
</el-form-item>
2024-01-12 12:08:57 +00:00
-->
2024-01-10 07:38:42 +00:00
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<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:emisNotCalcAging: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:emisNotCalcAging: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:emisNotCalcAging: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:emisNotCalcAging:export']"
>导出</el-button>
</el-col> -->
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="emisNotCalcAgingList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
2024-01-12 12:08:57 +00:00
<el-table-column label="日期" align="left" prop="noCalcDay" min-width="180">
2024-01-10 07:38:42 +00:00
<template slot-scope="scope">
2024-01-11 07:07:28 +00:00
<div class="link-type" @click="handleUpdate(scope.row)">{{scope.row.noCalcDay}}</div>
2024-01-10 07:38:42 +00:00
</template>
</el-table-column>
2024-01-11 07:07:28 +00:00
<el-table-column label="国家" align="center" prop="country" min-width="100" />
<el-table-column label="启用状态" align="center" prop="status" min-width="100" >
<template slot-scope="scope">
<el-switch
v-model="scope.row.status"
active-value="0"
inactive-value="1"
@change="handleStatusChange(scope.row)"
></el-switch>
</template>
</el-table-column>
2024-01-12 12:08:57 +00:00
<el-table-column label="创建时间" align="center" prop="createTime" min-width="100" />
2024-01-10 07:38:42 +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)"
v-hasPermi="['emis:emisNotCalcAging:edit']"
>修改</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page-sizes="[20,50,100,300,500,1000,2000,5000]"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
:page-size="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改不计时效维护对话框 -->
2024-01-12 12:08:57 +00:00
<el-dialog :title="title" :visible.sync="open" width="700px" :close-on-click-modal="false" append-to-body>
2024-01-10 07:38:42 +00:00
<el-row :gutter="0">
2024-01-11 07:07:28 +00:00
<el-form ref="form" :model="form" :rules="rules" label-width="110px">
2024-01-12 12:08:57 +00:00
<el-col :span="12">
2024-01-11 06:38:10 +00:00
<el-form-item label="不计时效日期" prop="noCalcDay">
2024-01-10 07:38:42 +00:00
<el-date-picker clearable
2024-01-11 06:38:10 +00:00
v-model="form.noCalcDay"
2024-01-10 07:38:42 +00:00
type="date"
value-format="yyyy-MM-dd"
2024-01-11 06:38:10 +00:00
placeholder="请选择不计时效日期">
2024-01-10 07:38:42 +00:00
</el-date-picker>
</el-form-item>
</el-col>
2024-01-12 12:08:57 +00:00
<el-col :span="12">
<el-form-item label="所属国家" prop="country">
<el-select v-model="form.country" multiple placeholder="请输入所属国家,可能多个国家,逗号隔开" >
<el-option
v-for="item in countryIdsOptions"
:key="item.label"
:label="item.label"
:value="item.label"
:disabled="item.status == 1"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="是否启用" prop="status">
<el-radio-group v-model="form.status">
<el-radio
v-for="dict in dict.type.sys_normal_disable"
:key="dict.value"
:label="dict.value"
>{{dict.label}}</el-radio>
</el-radio-group>
</el-form-item>
</el-col>
<!--
2024-01-11 06:38:10 +00:00
<el-col :span="24">
2024-01-10 07:38:42 +00:00
<el-form-item label="备注" prop="remark">
2024-01-11 06:38:10 +00:00
<el-input v-model="form.remark" placeholder="请输入备注" />
2024-01-10 07:38:42 +00:00
</el-form-item>
2024-01-11 06:38:10 +00:00
</el-col>
2024-01-10 07:38:42 +00:00
<el-col :span="24" v-show="moreInputVisible" > </el-col>
<el-col :span="24">
<el-divider content-position="right" @click="handleShowMoreInput" >更多信息[+]</el-divider>
</el-col>
-->
</el-form>
</el-row>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm">确 定</el-button>
<el-button @click="cancel">取 消</el-button>
</div>
</el-dialog>
<el-dialog :title="titleForm" :visible.sync="openForm" width="500px" append-to-body>
<emisNotCalcAgingForm :id="currentId" @on-changed="handleFormChanged" @on-cancel="cancelForm"></EmisNotCalcAgingForm>
</el-dialog>
<el-dialog :title="titleView" :visible.sync="openView" width="60%" :close-on-click-modal="false" append-to-body>
<emisNotCalcAgingView :id="id" ></EmisNotCalcAgingView>
</el-dialog>
2024-01-12 12:08:57 +00:00
</el-col>
</el-row>
2024-01-10 07:38:42 +00:00
</div>
</template>
<script>
2024-01-12 12:08:57 +00:00
import { listEmisNotCalcAging, getEmisNotCalcAging, delEmisNotCalcAging, addEmisNotCalcAging, updateEmisNotCalcAging,changeCalcStatus } from "@/api/emis/emisNotCalcAging";
import { listEmisCountry, getEmisCountry, delEmisCountry, addEmisCountry, updateEmisCountry } from "@/api/emis/emisCountry";
2024-01-10 07:38:42 +00:00
import elDateSimplePicker from '@/components/DatePickerAdv/elDateSimplePicker';
import emisNotCalcAgingView from '@/views/emis/emisNotCalcAging/emisNotCalcAgingView';
import emisNotCalcAgingForm from '@/views/emis/emisNotCalcAging/emisNotCalcAgingForm';
export default {
name: "emisNotCalcAging",
components: { elDateSimplePicker,emisNotCalcAgingView,emisNotCalcAgingForm },
dicts: [
'sys_normal_disable',
],
data() {
return {
// 遮罩层
loading: true,
2024-01-12 12:08:57 +00:00
currentId:null,
2024-01-10 07:38:42 +00:00
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 创建时间搜索
dateTimeRange:[],
// 总条数
total: 0,
// 不计时效维护表格数据
emisNotCalcAgingList: [],
2024-01-12 12:08:57 +00:00
countryTree:[],
countryIdsOptions:[],
2024-01-10 07:38:42 +00:00
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
openForm: false,
titleForm: "",
titleEmisNotCalcAging: "",
openEmisNotCalcAging: false,
// 显示编辑框更多
moreInputVisible: false,
// 弹出展示层
id:null,
2024-01-12 12:08:57 +00:00
defaultProps: {
children: "children",
label: "label"
},
2024-01-10 07:38:42 +00:00
titleView:"",
openView: false,
// 备注时间范围
2024-01-11 06:38:10 +00:00
daterangeNoCalcDay: [],
2024-01-10 07:38:42 +00:00
// 备注时间范围
daterangeCreateTime: [],
// 备注时间范围
daterangeUpdateTime: [],
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 20,
country: null,
2024-01-11 06:38:10 +00:00
noCalcDay: null,
status: null,
remark: null,
2024-01-10 07:38:42 +00:00
},
2024-01-12 12:08:57 +00:00
countryName:null,
2024-01-10 07:38:42 +00:00
// 表单参数
form: {},
// 表单校验
rules: {
2024-01-11 06:38:10 +00:00
country: [
{ required: true, message: "所属国家,可能多个国家,逗号隔开不能为空", trigger: "blur" }
2024-01-10 07:38:42 +00:00
],
2024-01-11 06:38:10 +00:00
noCalcDay: [
{ required: true, message: "不计时效日期不能为空", trigger: "blur" }
],
status: [
{ required: true, message: "启用状态不能为空", trigger: "blur" }
2024-01-10 07:38:42 +00:00
],
}
};
},
2024-01-12 12:08:57 +00:00
watch: {
// 根据名称筛选部门树
countryName(val) {
this.$refs.tree.filter(val);
}
},
2024-01-10 07:38:42 +00:00
created() {
this.getList();
2024-01-12 12:08:57 +00:00
this.getCountryList();
2024-01-10 07:38:42 +00:00
},
methods: {
2024-01-12 12:08:57 +00:00
handleStatusChange(row) {
let text = row.status === "0" ? "启用" : "停用";
this.$modal.confirm('确认要"' + text + '不计算时效吗?').then(function() {
//改变线路的启用状态
return changeCalcStatus(row.id, row.status);
}).then(() => {
this.$modal.msgSuccess(text + "成功");
}).catch(function() {
row.status = row.status === "0" ? "1" : "0";
});
},
2024-01-10 07:38:42 +00:00
/** 查询不计时效维护列表 */
getList() {
this.loading = true;
this.queryParams.params = {};
2024-01-11 06:38:10 +00:00
if (null != this.daterangeNoCalcDay && '' != this.daterangeNoCalcDay) {
this.queryParams.params["beginNoCalcDay"] = this.daterangeNoCalcDay[0];
this.queryParams.params["endNoCalcDay"] = this.daterangeNoCalcDay[1];
2024-01-10 07:38:42 +00:00
}
if (null != this.daterangeCreateTime && '' != this.daterangeCreateTime) {
this.queryParams.params["beginCreateTime"] = this.daterangeCreateTime[0];
this.queryParams.params["endCreateTime"] = this.daterangeCreateTime[1];
}
if (null != this.daterangeUpdateTime && '' != this.daterangeUpdateTime) {
this.queryParams.params["beginUpdateTime"] = this.daterangeUpdateTime[0];
this.queryParams.params["endUpdateTime"] = this.daterangeUpdateTime[1];
}
listEmisNotCalcAging(this.addDateRange(this.queryParams, this.dateTimeRange)).then(response => {
this.emisNotCalcAgingList = response.rows;
this.total = response.total;
this.loading = false;
});
},
2024-01-12 12:08:57 +00:00
getCountryList() {
this.loading = true;
listEmisCountry(this.queryParams).then(response => {
this.loading = false;
this.countryTree = [];
this.countryIdsOptions = [];
var cTree={"id":"","label":"国家列表","children":[]};
cTree.children.push({"id":40,"label":"中国"});
this.countryIdsOptions.push({"value":40,"label":"中国"})
//var lastContinentId = -1;
response.rows.forEach(item =>{
if(item.id != 40){
var optItem={value:item.id,label:item.name};
this.countryIdsOptions.push(optItem)
var treeItem={"id":item.id,"label":item.name};
cTree.children.push(treeItem);
}
//lastContinentId = item.id;
});
this.queryParams.countryId = this.currentCountryId;
this.countryTree.push(cTree);
//this.getAreaList();
});
},
// 筛选节点
filterNode(value, data) {
if (!value) return true;
return data.label.indexOf(value) !== -1;
},
// 节点单击事件
handleNodeClick(data) {
if(data.label=="国家列表"){
this.queryParams.country = null;
}else{
this.queryParams.country = data.label;
}
this.handleQuery();
},
2024-01-10 07:38:42 +00:00
// 取消按钮
cancel() {
this.open = false;
this.reset();
},
// 表单重置
reset() {
this.form = {
id: null,
country: null,
2024-01-11 06:38:10 +00:00
noCalcDay: null,
2024-01-10 07:38:42 +00:00
status: null,
remark: null,
tenantId: null,
delFlag: null,
createBy: null,
createTime: null,
updateBy: null,
updateTime: 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.reset();
this.open = true;
this.title = "新增";
// 子组件打开模式
// if(row != undefined){
// this.currentParentId = row.id
// }
// this.openEmisNotCalcAging = true;
// this.titleEmisNotCalcAging = "新增";
},
handleShowMoreInput(){
this.moreInputVisible = !this.moreInputVisible;
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id || this.ids
getEmisNotCalcAging(id).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改";
});
// 子组件打开模式
// this.currentId= row.id || this.ids;
// this.openEmisNotCalcAging = true;
// this.titleEmisNotCalcAging = "修改";
},
handleView(row) {
this.id=row.id;
this.titleView="查看";
this.openView=true;
// this.router.push({ path: '/emis/emisNotCalcAging/viewDetail', query: { id: row.id }})
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.id != null) {
updateEmisNotCalcAging(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addEmisNotCalcAging(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 delEmisNotCalcAging(ids);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
// this.download('emis/emisNotCalcAging/export', {
// ...this.queryParams
// }, `emisNotCalcAging_${new Date().getTime()}.xlsx`)
const loadingInstance = this.$loading({
text: '正在导出...'
})
var qParam = {...this.queryParams};
qParam.pageNum=1;
qParam.pageSize=5000;
listEmisNotCalcAging(this.addDateRange(qParam, this.dateTimeRange)).then(response => {
this.downloadLoading = false
if (response.code === 200) {
const curList = response.rows
import('@/vendor/Export2Excel').then(excel => {
2024-01-11 06:38:10 +00:00
const tHeader = ['序号','所属国家,可能多个国家,逗号隔开','不计时效日期','启用状态','备注','租户ID','删除标志(0代表存在','创建者','创建时间','更新者','更新时间',];
const filterVal = ['id','country','noCalcDay','status','remark','tenantId','delFlag','createBy','createTime','updateBy','updateTime',];
2024-01-10 07:38:42 +00:00
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>