emis-frontend/src/views/emis/emisNotCalcAging/index.vue
2024-06-05 11:31:04 +08:00

431 lines
14 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 class="app-container">
<el-row :gutter="20" type='flex'>
<!-- <el-col :span="4" :xs="4" style="border-right:1px solid rgb(248 249 251);">
<CountryTreePicker placeholder="所属国家" v-model="queryParams.country"></CountryTreePicker>
</el-col> -->
<el-col :span="24" :xs="24">
<SearchForm :model="queryParams" ref="queryForm" size="small" :maxShow="3" label-width="68px" v-show="showSearch" @search="handleQuery" @reset="resetQuery">
<el-form-item label="国家" prop="country" label-width="40px">
<CountryPicker :placeholder="$t('国家')" v-model="queryParams.country" @onChange="handleQuery"></CountryPicker>
</el-form-item>
<el-form-item label="时效不计算日期" label-width="150px" prop="daterangeNoCalcDay">
<elDateSimplePicker placeholder="日期范围" v-model="queryParams.daterangeNoCalcDay"></elDateSimplePicker>
</el-form-item>
</SearchForm>
<XdTable
v-loading="loading"
border
stripe
size="mini"
:data="emisNotCalcAgingList"
: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: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> -->
</el-row>
</div>
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="日期" align="left" prop="noCalcDay" min-width="180">
<template slot-scope="scope">
<div class="link-type" @click="handleUpdate(scope.row)">{{scope.row.noCalcDay}}</div>
</template>
</el-table-column>
<el-table-column label="国家" align="center" prop="countryName" min-width="100" >
<template slot-scope="scope">
<span v-if="scope.row.country=='-1'">全部国家</span>
<span v-else>{{scope.row.countryName}}</span>
</template>
</el-table-column>
<!-- <el-table-column label="启用状态" align="center" prop="status" min-width="100" >
<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="createTime" min-width="100" />
<el-table-column label="创建人" align="center" prop="createBy" width="80" :show-overflow-tooltip="true"/>
<el-table-column label="创建网点" align="center" prop="createSite" width="80" :show-overflow-tooltip="true"/>
<el-table-column label="创建时间" align="center" prop="createTime" width="170"/>
<el-table-column label="修改人" align="center" prop="updateBy" width="80" :show-overflow-tooltip="true"/>
<el-table-column label="修改网点" align="center" prop="updateSite" 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:emisNotCalcAging:edit']"
>修改</el-button>
</template>
</el-table-column>
</XdTable>
<el-dialog :title="titleForm" :visible.sync="openForm" width="50%" :destroy-on-close="true" append-to-body>
<emisNotCalcAgingForm :id="currentId" @on-changed="handleFormChanged" @on-cancel="cancelForm"></EmisNotCalcAgingForm>
</el-dialog>
</el-col>
</el-row>
</div>
</template>
<script>
import { listEmisNotCalcAging, getEmisNotCalcAging, delEmisNotCalcAging, addEmisNotCalcAging, updateEmisNotCalcAging,changeCalcStatus } from "@/api/emis/emisNotCalcAging";
import elDateSimplePicker from '@/components/DatePickerAdv/elDateSimplePicker';
import emisNotCalcAgingForm from '@/views/emis/emisNotCalcAging/emisNotCalcAgingForm';
import CountryTreePicker from '@/views/emis/EmisBaseTools/CountryTreePicker.vue';
import CountryPicker from '@/views/emis/EmisBaseTools/CountryPicker.vue';
export default {
name: "emisNotCalcAging",
components: { elDateSimplePicker,CountryPicker,CountryTreePicker,emisNotCalcAgingForm },
dicts: [
'sys_normal_disable',
],
data() {
return {
// 遮罩层
loading: true,
currentId:null,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 创建时间搜索
dateTimeRange:[],
// 总条数
total: 0,
// 不计时效维护表格数据
emisNotCalcAgingList: [],
countryTree:[],
countryIdsOptions:[],
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
openForm: false,
titleForm: "",
titleEmisNotCalcAging: "",
openEmisNotCalcAging: false,
// 显示编辑框更多
moreInputVisible: false,
// 弹出展示层
id:null,
defaultProps: {
children: "children",
label: "label"
},
titleView:"",
openView: false,
// 备注时间范围
daterangeNoCalcDay: [],
// 备注时间范围
daterangeCreateTime: [],
// 备注时间范围
daterangeUpdateTime: [],
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 20,
country: null,
noCalcDay: null,
status: null,
remark: null,
daterangeNoCalcDay:null,
},
countryName:null,
// 表单参数
form: {},
// 表单校验
rules: {
country: [
{ required: true, message: "所属国家,可能多个国家,逗号隔开不能为空", trigger: "blur" }
],
noCalcDay: [
{ required: true, message: "不计时效日期不能为空", trigger: "blur" }
],
status: [
{ required: true, message: "启用状态不能为空", trigger: "blur" }
],
}
};
},
watch: {
// 根据名称筛选部门树
countryName(val) {
this.$refs.tree.filter(val);
}
},
created() {
this.getList();
},
methods: {
handleStatusChange(row) {
let text = row.status == "1" ? "启用" : "停用";
this.$modal.confirm('确认要"' + text + '"不计算时效吗?').then(function() {
//改变线路的启用状态
return changeCalcStatus(row.id, row.status);
}).then(() => {
this.$modal.msgSuccess(text + "成功");
}).catch(function() {
// row.status = row.status === "" ? "1" : "0";
});
},
/** 查询不计时效维护列表 */
getList() {
this.loading = true;
this.queryParams.params = {};
console.log(this.daterangeNoCalcDay);
if (null != this.queryParams.daterangeNoCalcDay && '' != this.queryParams.daterangeNoCalcDay) {
this.queryParams.params["beginNoCalcDay"] = this.queryParams.daterangeNoCalcDay[0];
this.queryParams.params["endNoCalcDay"] = this.queryParams.daterangeNoCalcDay[1];
}
listEmisNotCalcAging(this.queryParams).then(response => {
this.emisNotCalcAgingList = response.rows;
this.total = response.total;
this.loading = false;
});
},
/** 搜索按钮操作 */
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
},
// 排序 查询字段是表格中字段名字 动态取值排序顺序
handleSortChange(column) {
this.queryParams.orderByColumn = column.prop;
this.queryParams.isAsc = column.order;
this.getList();
},
/** 新增按钮操作 */
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= "修改";
},
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) {
var country = "";
this.form.country.map((res) => {
country+=res+",";
});
if (country.charAt(country.length - 1) === ",") {
country = country.slice(0, -1);
}
this.form.country = country;
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 => {
const tHeader = ['序号','所属国家,可能多个国家,逗号隔开','不计时效日期','启用状态','备注','租户ID','删除标志(0代表存在','创建者','创建时间','更新者','更新时间',];
const filterVal = ['id','country','noCalcDay','status','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;
},
}
};
</script>
<style scoped>
.el-divider{
margin-top: 0px;
background: 0 0;
border-top: 1px solid #E6EBF5;
}
.el-divider__text {
color: #0955ee;
cursor: pointer;
}
</style>